From 29344006a0f912fa06f976d1ad58ac2b526e3170 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 25 May 2020 20:41:47 +0200 Subject: [PATCH] - fixed: texture upscaling was disabled by default. It should only be disabled if the scale of a texture is greater than 2. --- src/common/textures/gametexture.cpp | 2 +- src/common/textures/gametexture.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/common/textures/gametexture.cpp b/src/common/textures/gametexture.cpp index 1ec6a6062..caf5d4357 100644 --- a/src/common/textures/gametexture.cpp +++ b/src/common/textures/gametexture.cpp @@ -430,7 +430,7 @@ CUSTOM_CVAR(Int, r_spriteadjust, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) float FTexCoordInfo::RowOffset(float rowoffset) const { - float scale = fabs(mScale.Y); + float scale = fabsf(mScale.Y); if (scale == 1.f || mWorldPanning) return rowoffset; else return rowoffset / scale; } diff --git a/src/common/textures/gametexture.h b/src/common/textures/gametexture.h index 31864f9eb..7b4c46174 100644 --- a/src/common/textures/gametexture.h +++ b/src/common/textures/gametexture.h @@ -84,7 +84,7 @@ class FGameTexture float DisplayWidth, DisplayHeight; float ScaleX, ScaleY; - int8_t shouldUpscaleFlag = 0; // Without explicit setup, scaling is disabled for a texture. + int8_t shouldUpscaleFlag = 1; ETextureType UseType = ETextureType::Wall; // This texture's primary purpose SpritePositioningInfo* spi = nullptr; @@ -131,7 +131,7 @@ public: ETextureType GetUseType() const { return UseType; } void SetUpscaleFlag(int what) { shouldUpscaleFlag = what; } - int GetUpscaleFlag() { return shouldUpscaleFlag; } + int GetUpscaleFlag() { return shouldUpscaleFlag == 1; } FTexture* GetTexture() { return Base.get(); } int GetSourceLump() const { return Base->GetSourceLump(); } @@ -234,6 +234,10 @@ public: DisplayHeight = h; ScaleX = TexelWidth / w; ScaleY = TexelHeight / h; + if (shouldUpscaleFlag < 2) + { + shouldUpscaleFlag = ScaleX < 2 && ScaleY < 2; + } // compensate for roundoff errors if (int(ScaleX * w) != TexelWidth) ScaleX += (1 / 65536.); @@ -253,6 +257,10 @@ public: { ScaleX = x; ScaleY = y; + if (shouldUpscaleFlag < 2) + { + shouldUpscaleFlag = ScaleX < 2 && ScaleY < 2; + } DisplayWidth = TexelWidth / x; DisplayHeight = TexelHeight / y; }