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

WebGLRenderTarget: Refactor copy(). #23237

Merged
merged 1 commit into from
Jan 14, 2022
Merged

WebGLRenderTarget: Refactor copy(). #23237

merged 1 commit into from
Jan 14, 2022

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jan 14, 2022

Related issue: see https://github.com/mrdoob/three.js/compare/dev...Mugen87:dev62?expand=1

Description

Ensures the image property is correctly processed in copy(). Also avoid the usage of the spread operator to avoid issues with bundlers, see #22618.

@gkjohnson
Copy link
Collaborator

Ensures the image property is correctly processed in copy().

Just a quick note that

this.texture.image = { ...this.texture.image };

is the same result as

this.texture.image = { ...source.texture.image };

since this.texture.image === source.texture.image after source.texture.clone().

@mrdoob
Copy link
Owner

mrdoob commented Jan 14, 2022

This suggestion by @gkjohnson is nicer:

@Mugen87 suggestion looks good but Object.assign( {}, this.texture.image ) would work, as well

@mrdoob mrdoob added this to the r137 milestone Jan 14, 2022
@Mugen87
Copy link
Collaborator Author

Mugen87 commented Jan 14, 2022

@gkjohnson Indeed, I've just misread the code. I've used source in the new version for better clarity.

@mrdoob Updated!

@mrdoob mrdoob merged commit 0a8fa90 into mrdoob:dev Jan 14, 2022
@mrdoob
Copy link
Owner

mrdoob commented Jan 14, 2022

Thanks!

@Mugen87 Mugen87 changed the title WebGLRenderTarget: Correctly process image property in copy(). WebGLRenderTarget: Refactor copy(). Jan 16, 2022
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.

3 participants