Skip to content

Commit

Permalink
Merge pull request #20888 from donmccurdy/bug-ktx2-mip-sizes
Browse files Browse the repository at this point in the history
KTX2Loader: Fix calculation of level dimensions for NPOT textures.
  • Loading branch information
mrdoob authored Jan 9, 2021
2 parents b7ff986 + c21e5a9 commit 03e97e7
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.max( 1, Math.floor( width / Math.pow( 2, level ) ) );
var levelHeight = Math.max( 1, Math.floor( height / Math.pow( 2, level ) ) );

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

0 comments on commit 03e97e7

Please sign in to comment.