Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
|
||
| constructor( images, format, type ) { | ||
|
|
||
| super( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping ); |
There was a problem hiding this comment.
@donmccurdy Would it work to pass in [] for mipmaps instead of undefined? I'm working on the types for this. If taken strictly, Texture.mipmaps and CompressedTexture.mipmaps would now need to be ImageData[] | undefined instead of ImageData[], which is more disruptive of a change for the users of the types.
There was a problem hiding this comment.
I believe it's correct that the .mipmaps property is a non-nullable array, but not safe to pass an empty array up to the constructor here... I would just assume that mipmaps gets populated correctly during texture initialization, and not make the property nullable in the TS definitions.
There was a problem hiding this comment.
Okay, thanks, good to know. For my own education, where do the mipmaps end up getting set for the CompressedCubeTexture in KTX2Loader?
There was a problem hiding this comment.
I see mipmaps getting set for other textures in createRawTexture, but don't do something similar in _createTextureFrom where CompressedCubeTexture is used.
There was a problem hiding this comment.
You can see where it would be set in #26642, but I can't promise that KTX2Loader sets up all texture types correctly today. Constructing compressed array, cube, and 3D textures is not a fully-documented API, and we don't have many test cases for it, so I'm kind of trial-and-erroring my through this part. Maybe once #26642 is working we'll have a better idea how to construct textures for each of these cases...
Related:
Adds a THREE.CompressedCubeTexture class, and updates THREE.KTX2Loader to use it where appropriate. This resolves issues discussed in #25909, where the renderer failed to recognize 'synthetic' compressed cube textures in some cases.
I've kept the constructor signature simple, at least for the time being:
Tested against the texture below:
pisa.ktx2.zip
The texture was generated from our Pisa PNG cubemap, with the KTX-Software v4.3 alpha release. I ran into an issue with the alpha release, tracked in KhronosGroup/KTX-Software#728, but in future stable releases the command below should work as-is: