Skip to content

Commit 85b81c3

Browse files
authored
Merge pull request #16088 from John-DeCorato-HZ/dev
Fixed a bug with loading KTX cube textures
2 parents 3ae41a6 + f626651 commit 85b81c3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/js/loaders/KTXLoader.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,15 @@ var KhronosTextureContainer = ( function () {
137137
for ( var level = 0; level < mipmapCount; level ++ ) {
138138

139139
var imageSize = new Int32Array( this.arrayBuffer, dataOffset, 1 )[ 0 ]; // size per face, since not supporting array cubemaps
140+
dataOffset += 4; // size of the image + 4 for the imageSize field
141+
140142
for ( var face = 0; face < this.numberOfFaces; face ++ ) {
141143

142-
var byteArray = new Uint8Array( this.arrayBuffer, dataOffset + 4, imageSize );
144+
var byteArray = new Uint8Array( this.arrayBuffer, dataOffset, imageSize );
143145

144146
mipmaps.push( { "data": byteArray, "width": width, "height": height } );
145-
146-
dataOffset += imageSize + 4; // size of the image + 4 for the imageSize field
147+
148+
dataOffset += imageSize;
147149
dataOffset += 3 - ( ( imageSize + 3 ) % 4 ); // add padding for odd sized image
148150

149151
}

0 commit comments

Comments
 (0)