- match alignment of NPOT flat textures to the software renderer

Tested in RR E1L4, sector 224+40, probably needs more checking in other places as well to confirm that it is correct there as well.
This commit is contained in:
Christoph Oelckers 2021-12-11 00:39:13 +01:00
parent b4a968841a
commit 7b14aacdf4

View file

@ -143,13 +143,10 @@ public:
sinalign = float(vang.Sin()); sinalign = float(vang.Sin());
int pow2width = 1 << sizeToBits((int)tx->GetDisplayWidth()); int pow2width = 1 << sizeToBits((int)tx->GetDisplayWidth());
if (pow2width < (int)tx->GetDisplayWidth()) pow2width *= 2;
int pow2height = 1 << sizeToBits((int)tx->GetDisplayHeight()); int pow2height = 1 << sizeToBits((int)tx->GetDisplayHeight());
if (pow2height < (int)tx->GetDisplayHeight()) pow2height *= 2;
xpanning = pow2width * xpan / (256.f * tx->GetDisplayWidth()); xpanning = xpan / 256.f;
ypanning = pow2height * ypan / (256.f * tx->GetDisplayHeight()); ypanning = ypan / 256.f;
float scalefactor = (stat & CSTAT_SECTOR_TEXHALF) ? 8.0f : 16.0f; float scalefactor = (stat & CSTAT_SECTOR_TEXHALF) ? 8.0f : 16.0f;
@ -167,8 +164,8 @@ public:
} }
} }
xscaled = scalefactor * (int)tx->GetDisplayWidth(); xscaled = scalefactor * pow2width;
yscaled = scalefactor * (int)tx->GetDisplayHeight(); yscaled = scalefactor * pow2height;
} }
FVector2 GetUV(int x, int y, float z) FVector2 GetUV(int x, int y, float z)