Просмотр исходного кода

Fixed a bug with loading cube textures

Moved code accounting for moving past the data field for the size of the texture outside of the loop loading them.
John DeCorato 6 лет назад
Родитель
Сommit
de6698727f
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      examples/js/loaders/KTXLoader.js

+ 2 - 1
examples/js/loaders/KTXLoader.js

@@ -137,13 +137,14 @@ var KhronosTextureContainer = ( function () {
 		for ( var level = 0; level < mipmapCount; level ++ ) {
 
 			var imageSize = new Int32Array( this.arrayBuffer, dataOffset, 1 )[ 0 ]; // size per face, since not supporting array cubemaps
+			dataOffset += imageSize + 4; // size of the image + 4 for the imageSize field
+			
 			for ( var face = 0; face < this.numberOfFaces; face ++ ) {
 
 				var byteArray = new Uint8Array( this.arrayBuffer, dataOffset + 4, imageSize );
 
 				mipmaps.push( { "data": byteArray, "width": width, "height": height } );
 
-				dataOffset += imageSize + 4; // size of the image + 4 for the imageSize field
 				dataOffset += 3 - ( ( imageSize + 3 ) % 4 ); // add padding for odd sized image
 
 			}