Skip to content

Commit 4a7c241

Browse files
authored
feat(loaders): Add CompressedCubeTexture (#26369)
1 parent e502a12 commit 4a7c241

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

examples/jsm/loaders/KTX2Loader.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import {
1515
CompressedTexture,
1616
CompressedArrayTexture,
17+
CompressedCubeTexture,
1718
Data3DTexture,
1819
DataTexture,
1920
FileLoader,
@@ -261,10 +262,7 @@ class KTX2Loader extends Loader {
261262

262263
if ( container.faceCount === 6 ) {
263264

264-
texture = new CompressedTexture();
265-
texture.image = faces;
266-
texture.format = format;
267-
texture.type = UnsignedByteType;
265+
texture = new CompressedCubeTexture( faces, format, UnsignedByteType );
268266

269267
} else {
270268

src/Three.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export { DataArrayTexture } from './textures/DataArrayTexture.js';
3434
export { Data3DTexture } from './textures/Data3DTexture.js';
3535
export { CompressedTexture } from './textures/CompressedTexture.js';
3636
export { CompressedArrayTexture } from './textures/CompressedArrayTexture.js';
37+
export { CompressedCubeTexture } from './textures/CompressedCubeTexture.js';
3738
export { CubeTexture } from './textures/CubeTexture.js';
3839
export { CanvasTexture } from './textures/CanvasTexture.js';
3940
export { DepthTexture } from './textures/DepthTexture.js';
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { CubeReflectionMapping } from '../constants.js';
2+
import { CompressedTexture } from './CompressedTexture.js';
3+
4+
class CompressedCubeTexture extends CompressedTexture {
5+
6+
constructor( images, format, type ) {
7+
8+
super( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );
9+
10+
this.isCompressedCubeTexture = true;
11+
this.isCubeTexture = true;
12+
13+
this.image = images;
14+
15+
}
16+
17+
}
18+
19+
export { CompressedCubeTexture };

0 commit comments

Comments
 (0)