From 53e363d10f720efb91f1203db0fd386ef3afaaab Mon Sep 17 00:00:00 2001 From: Lajos Meszaros Date: Fri, 13 Oct 2023 15:56:59 +0200 Subject: [PATCH] fix(Texture): don't downsample internal textures, like jorge --- src/Texture.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Texture.ts b/src/Texture.ts index e06bd895..6f3a7230 100644 --- a/src/Texture.ts +++ b/src/Texture.ts @@ -155,7 +155,14 @@ export class Texture extends ThreeJsTextue { const image = await getSharpInstance(originalSource) let quality = 100 - if (settings.variant !== 'premium' && !this.filename.endsWith('[icon].bmp')) { + + const needsDownsampling = !( + settings.variant === 'premium' || + this.isInternalAsset || + this.filename.endsWith('[icon].bmp') + ) + + if (needsDownsampling) { quality = 70 let maxWidth = 128 @@ -213,7 +220,13 @@ export class Texture extends ThreeJsTextue { let newSize = powerOfTwo let quality = 100 - if (settings.variant !== 'premium' && !this.filename.endsWith('[icon].bmp')) { + + const needsDownsampling = !( + settings.variant === 'premium' || + this.isInternalAsset || + this.filename.endsWith('[icon].bmp') + ) + if (needsDownsampling) { newSize = Math.max(128, newSize) quality = 70 }