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

KTX2Loader: Fix calculation of level dimensions for NPOT textures. #20888

Merged
merged 2 commits into from
Jan 9, 2021
Merged
Changes from 1 commit
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
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;
donmccurdy marked this conversation as resolved.
Show resolved Hide resolved
var levelHeight = Math.floor( height / ( 1 << level ) ) || 1;

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