-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
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
WebGLRenderer: Add "target" argument to "getClearColor" #20818
Conversation
The fix is correct since the same code style is used in various post processing passes, too. @mrdoob What do you think about rewriting this.getClearColor = function ( target ) {
if ( target === undefined ) {
console.warn( 'WebGLRenderer: .getClearColor() now requires a Color as an argument' );
target = new Color();
}
return target.copy( background.getClearColor() );
}; However, this style requires some refactoring in the code base. |
Sounds good to me! Would you like @gkjohnson to do that in this PR? Or should we leave it for a different PR? |
This one. In this way, the code base can migrated in one go. |
Done! Updated WebGLRenderer, docs, and examples. I didn't touch WebGPURenderer but maybe that should be updated, too? |
Damn, this escalated quickly 😁 |
# Conflicts: # src/renderers/WebGLRenderer.js
Heh, it's what you wanted, right?! 😁 |
Thanks! |
Related issue: #20819
Description
When scene.background is set to a color the renderer clear color is modified because
WebGLRenderer.getClearColor()
returns a reference to its color instance.Repro (can be run in console on docs page):
In
dev
this logs0, 0, 0
then1, 0, 0
. With this PR both log statements print0, 0, 0
as expected.