Skip to content

Commit

Permalink
Texture resizing to power-of-two sides is slow #105
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacsv committed Jul 28, 2021
1 parent 8f4151f commit 55aafe8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
18 changes: 0 additions & 18 deletions source/import/importerutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,6 @@ OV.NextPowerOfTwo = function (x)
return parseInt (npot, 10);
};

OV.ResizeImageToPowerOfTwoSides = function (image)
{
if (OV.IsPowerOfTwo (image.width) && OV.IsPowerOfTwo (image.height)) {
return image;
}

let width = OV.NextPowerOfTwo (image.width);
let height = OV.NextPowerOfTwo (image.height);

let canvas = document.createElement ('canvas');
canvas.width = width;
canvas.height = height;

let context = canvas.getContext ('2d');
context.drawImage (image, 0, 0, width, height);
return context.getImageData (0, 0, width, height);
};

OV.UpdateMaterialTransparency = function (material)
{
material.transparent = false;
Expand Down
1 change: 0 additions & 1 deletion source/threejs/threeconverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ OV.ConvertModelToThreeMeshes = function (model, params, output, callbacks)
let loader = new THREE.TextureLoader ();
loader.load (texture.url, (threeTexture) => {
SetTextureParameters (texture, threeTexture);
threeTexture.image = OV.ResizeImageToPowerOfTwoSides (threeTexture.image);
threeMaterial.needsUpdate = true;
onLoad (threeTexture);
});
Expand Down

0 comments on commit 55aafe8

Please sign in to comment.