-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
Sampler: Fix dispose. #31751
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
Sampler: Fix dispose. #31751
Conversation
| * @type {function} | ||
| * @private | ||
| */ | ||
| this._onDisposeTexture = () => { |
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.
_onDisposeTexture() is cloned like all other properties. Because EventListener does not let you assign the same listener more than once, only the first dispose works. It has to be inlined in the setter of texture to make it work.
| // TODO: Find better solution, see #31747 | ||
|
|
||
| clonedSampler._texture = null; | ||
| clonedSampler.texture = this.texture; |
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.
An explicit call of the texture setter is required so cloned instances have proper dispose event listeners.
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
For |
Related issue: #31747 (comment)
Description
Fixes the dispose logic in the
Samplerbinding class.