Skip to content

Commit

Permalink
KTX2Loader: Fix calculation of level dimensions for NPOT textures.
Browse files Browse the repository at this point in the history
  • Loading branch information
Don McCurdy committed Dec 14, 2020
1 parent 977cf79 commit 74658ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/jsm/loaders/KTX2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,8 @@ class KTX2Container {

for ( var level = 0; level < this.header.levelCount; level ++ ) {

var levelWidth = Math.ceil( width / Math.pow( 2, level ) );
var levelHeight = Math.ceil( height / Math.pow( 2, level ) );
var levelWidth = Math.floor( width / ( 1 << level ) ) || 1;
var levelHeight = Math.floor( height / ( 1 << level ) ) || 1;

var numImagesInLevel = 1; // TODO(donmccurdy): Support cubemaps, arrays and 3D.
var imageOffsetInLevel = 0;
Expand Down

0 comments on commit 74658ba

Please sign in to comment.