Texture resizing to power-of-two sides is slow #105

This commit is contained in:
kovacsv 2021-07-28 20:25:55 +02:00
parent 8f4151fce5
commit 55aafe8d88
2 changed files with 0 additions and 19 deletions

View File

@ -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;

View File

@ -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);
});