Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug with loading KTX cube textures #16088

Merged
merged 2 commits into from
Apr 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions examples/js/loaders/KTXLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ 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 += 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 );
var byteArray = new Uint8Array( this.arrayBuffer, dataOffset, imageSize );

mipmaps.push( { "data": byteArray, "width": width, "height": height } );

dataOffset += imageSize + 4; // size of the image + 4 for the imageSize field
dataOffset += imageSize;
dataOffset += 3 - ( ( imageSize + 3 ) % 4 ); // add padding for odd sized image

}
Expand Down