Skip to content

Commit ceb3cb3

Browse files
committed
CompressedTextureLoader: put first mipmap data into image to simulate ImageData.
1 parent 0f0d05d commit ceb3cb3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/loaders/CompressedTextureLoader.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,23 @@ class CompressedTextureLoader extends Loader {
107107
texture.image.height = texDatas.height;
108108
texture.mipmaps = texDatas.mipmaps;
109109

110+
// put first mipmap data into image to simulate ImageData
111+
if ( texDatas.mipmaps[ 0 ] && texDatas.mipmaps[ 0 ].data ) {
112+
113+
const firstBitmapData = texDatas.mipmaps[ 0 ].data;
114+
115+
if ( firstBitmapData instanceof Uint8ClampedArray ) {
116+
117+
texture.image.data = firstBitmapData;
118+
119+
} else if ( firstBitmapData instanceof Uint8Array ) {
120+
121+
texture.image.data = new Uint8ClampedArray( firstBitmapData );
122+
123+
}
124+
125+
}
126+
110127
}
111128

112129
if ( texDatas.mipmapCount === 1 ) {

0 commit comments

Comments
 (0)