- fixed: texture upscaling was disabled by default.

It should only be disabled if the scale of a texture is greater than 2.
This commit is contained in:
Christoph Oelckers 2020-05-25 20:41:47 +02:00
parent 3e8f53e98c
commit 29344006a0
2 changed files with 11 additions and 3 deletions

View File

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

View File

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