- used display size for all texture positioning.

This commit is contained in:
Christoph Oelckers 2021-03-28 18:22:30 +02:00
parent 81a690970b
commit d9ff2fd1e2
4 changed files with 24 additions and 24 deletions

View file

@ -220,8 +220,8 @@ void GetWallSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool
}
else
{
width = tex->GetTexelWidth();
leftofs = (tex->GetTexelLeftOffset() + spr->xoffset);
width = (int)tex->GetDisplayWidth();
leftofs = ((int)tex->GetDisplayLeftOffset() + spr->xoffset);
}
int x = bsin(spr->ang) * spr->xrepeat;
@ -258,10 +258,10 @@ void GetFlatSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool
}
else
{
width = tex->GetTexelWidth() * spr->xrepeat;
height = tex->GetTexelHeight() * spr->yrepeat;
leftofs = (tex->GetTexelLeftOffset() + spr->xoffset) * spr->xrepeat;
topofs = (tex->GetTexelTopOffset() + spr->yoffset) * spr->yrepeat;
width = (int)tex->GetDisplayWidth() * spr->xrepeat;
height = (int)tex->GetDisplayHeight() * spr->yrepeat;
leftofs = ((int)tex->GetDisplayLeftOffset() + spr->xoffset) * spr->xrepeat;
topofs = ((int)tex->GetDisplayTopOffset() + spr->yoffset) * spr->yrepeat;
}
if (spr->cstat & CSTAT_SPRITE_XFLIP) leftofs = -leftofs;

View file

@ -357,10 +357,10 @@ void HWSprite::Process(HWDrawInfo* di, spritetype* spr, sectortype* sector, int
}
else
{
xsize = tex->GetTexelWidth();
ysize = tex->GetTexelHeight();
tilexoff = tex->GetTexelLeftOffset();
tileyoff = tex->GetTexelTopOffset();
xsize = (int)tex->GetDisplayWidth();
ysize = (int)tex->GetDisplayHeight();
tilexoff = (int)tex->GetDisplayLeftOffset();
tileyoff = (int)tex->GetDisplayTopOffset();
}

View file

@ -196,12 +196,12 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags)
SetLightAndFog(state);
int h = texture->GetTexelHeight();
int h = (int)texture->GetDisplayHeight();
int h2 = 1 << sizeToBits(h);
if (h2 < h) h2 *= 2;
if (h != h2)
{
float xOffset = 1.f / texture->GetTexelWidth();
float xOffset = 1.f / texture->GetDisplayWidth();
state.SetNpotEmulation(float(h2) / h, xOffset);
}
else
@ -721,8 +721,8 @@ void HWWall::DoTexture(HWDrawInfo* di, walltype* wal, walltype* refwall, float r
float leftdist = xflipped ? 1.f - glseg.fracleft : glseg.fracleft;
float rightdist = xflipped ? 1.f - glseg.fracright : glseg.fracright;
float tw = texture->GetTexelWidth();
float th = texture->GetTexelHeight();
float tw = texture->GetDisplayWidth();
float th = texture->GetDisplayHeight();
int pow2size = 1 << sizeToBits(th);
if (pow2size < th) pow2size *= 2;
float ypanning = refwall->ypan_ ? pow2size * refwall->ypan_ / (256.0f * th) : 0;
@ -1102,8 +1102,8 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect
}
else
{
height = tex->GetTexelHeight();
topofs = (tex->GetTexelTopOffset() + spr->yoffset);
height = (int)tex->GetDisplayHeight();
topofs = ((int)tex->GetDisplayTopOffset() + spr->yoffset);
}
if (spr->cstat & CSTAT_SPRITE_YFLIP)

View file

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