-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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 targetScene
parameter to compile()
methods.
#26966
Conversation
@@ -1036,15 +1004,15 @@ class WebGLRenderer { | |||
|
|||
const material2 = material[ i ]; | |||
|
|||
prepareMaterial( material2, scene, object ); | |||
compiling.add( material2 ); | |||
prepareMaterial( material2, targetScene, object ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a subtle but important change. We have to use targetScene
here since otherwise we miss environment definitions (and then end up with recompilations during the first render).
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
This would work for my use case, yes! (And hopefully many others as well!) I really like the change to have |
Thanks for the review! And sorry for deleting |
Thank you! I'm glad that we ended up going through this review separately in the end, because I think having this call through to 'compile()' makes the implementation better. |
Related issue: #19752
Description
This PR implements the feedback from #19752 (comment) and introduces the
targetScene
parameter, which was part of the original version of #19752.@toji I've managed to refactor the code such that
compileAsync()
reuses the implementation fromcompile()
which makes the code more manageable. Do you think your use case will work with this version ofcompileAsync()
?BTW: Existing usage of
compile()
should not be affected by this change.targetScene
is optional.