Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default ambientMaterial to the base material color if unspecified #6130

Merged
merged 1 commit into from May 5, 2023

Conversation

davepagurek
Copy link
Contributor

Resolves #6125

Changes

  • In Feature Implemeted -- Multiple Material support for geometry #5774, we updated p5's material model to be a bit more like Processing's, where one can specify a separate color for the ambient, specular, and emissive components of the material
  • Unlike in processing, the p5 implementation required all components to be set separately
    • This meant that previous code that only specified, for example, fill(), would look different due to the ambient component remaining at a default value
  • In Processing, the ambient color defaults to the same color as the specular color or fill if left unspecified
  • This PR updates the p5 implementation to match Processing:
    • If you only specify the specular color or fill, it will be used for the ambient color too
    • Otherwise, your explicitly set ambient color will be used

Screenshots of the change

//v1.4.2
fill('red')
//v1.6.0
fill('red')
//updated
fill('red')
//updated
fill('red')

// Explicitly specified white
// ambient material
ambientMaterial(255, 255, 255)

PR Checklist

  • npm run lint passes
  • [Inline documentation] is included / updated
  • [Unit tests] are included / updated

@Qianqianye Qianqianye merged commit 4121fd2 into processing:main May 5, 2023
5 checks passed
@davepagurek davepagurek deleted the fix/ambient branch May 5, 2023 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebGL ambientMaterial() defaults to white instead of the fill color
2 participants