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

Texture: add setValues() #28756

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

CodyJasonBennett
Copy link
Contributor

Related issue: #28100

Description

Adds a setValues method to Texture, and uses it in render target classes, some of which didn't set texture parameters before.

Comment on lines -33 to -35
this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are default values inherited from RenderTarget. Should we use NearestFilter as the default for WebGL3DRenderTarget and WebGLArrayRenderTarget? #28100 (comment)

Copy link
Collaborator

@Mugen87 Mugen87 Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that seems right.

FYI: I've deleted my previous comment since I had to read the change more closely to better understand it^^.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm still wrong here, since RenderTarget creates its own texture whose configuration I was referring to here. We can make texture an option and pass the instantiated CubeTexture etc. if we really wanted to inherit the configuration there.

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
682.2 kB (169 kB) 682 kB (169 kB) -158 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
459.4 kB (110.9 kB) 459.2 kB (110.9 kB) -209 B

@Mugen87 Mugen87 added this to the r167 milestone Jun 28, 2024
for ( let i = 0; i < count; i ++ ) {

this.textures[ i ] = texture.clone();
this.textures[ i ].isRenderTargetTexture = true;

}

this.depthBuffer = options.depthBuffer;
Copy link
Collaborator

@Mugen87 Mugen87 Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid it is not correct to add non-texture related properties into the setValues() parameter. options should only hold values which are properties of textures. Something like depthBuffer is a RenderTarget property.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The examples print now a lot of warnings. E.g. misc_boxselection:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR doesn't generally discern options belonging to the render target and its underlying texture.

Need to do that all over.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll convert the PR to a Draft-PR in the meanwhile. Convert it back when it is ready for a review 👍

@Mugen87 Mugen87 marked this pull request as draft June 28, 2024 09:14
@mrdoob mrdoob modified the milestones: r167, r168 Jul 25, 2024
@mrdoob mrdoob modified the milestones: r168, r169 Aug 30, 2024
@mrdoob mrdoob modified the milestones: r169, r170 Sep 26, 2024
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