mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-30 17:01:03 +00:00
- used display size for all texture positioning.
This commit is contained in:
parent
81a690970b
commit
d9ff2fd1e2
4 changed files with 24 additions and 24 deletions
|
@ -220,8 +220,8 @@ void GetWallSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
width = tex->GetTexelWidth();
|
width = (int)tex->GetDisplayWidth();
|
||||||
leftofs = (tex->GetTexelLeftOffset() + spr->xoffset);
|
leftofs = ((int)tex->GetDisplayLeftOffset() + spr->xoffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = bsin(spr->ang) * spr->xrepeat;
|
int x = bsin(spr->ang) * spr->xrepeat;
|
||||||
|
@ -258,10 +258,10 @@ void GetFlatSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
width = tex->GetTexelWidth() * spr->xrepeat;
|
width = (int)tex->GetDisplayWidth() * spr->xrepeat;
|
||||||
height = tex->GetTexelHeight() * spr->yrepeat;
|
height = (int)tex->GetDisplayHeight() * spr->yrepeat;
|
||||||
leftofs = (tex->GetTexelLeftOffset() + spr->xoffset) * spr->xrepeat;
|
leftofs = ((int)tex->GetDisplayLeftOffset() + spr->xoffset) * spr->xrepeat;
|
||||||
topofs = (tex->GetTexelTopOffset() + spr->yoffset) * spr->yrepeat;
|
topofs = ((int)tex->GetDisplayTopOffset() + spr->yoffset) * spr->yrepeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spr->cstat & CSTAT_SPRITE_XFLIP) leftofs = -leftofs;
|
if (spr->cstat & CSTAT_SPRITE_XFLIP) leftofs = -leftofs;
|
||||||
|
|
|
@ -357,10 +357,10 @@ void HWSprite::Process(HWDrawInfo* di, spritetype* spr, sectortype* sector, int
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xsize = tex->GetTexelWidth();
|
xsize = (int)tex->GetDisplayWidth();
|
||||||
ysize = tex->GetTexelHeight();
|
ysize = (int)tex->GetDisplayHeight();
|
||||||
tilexoff = tex->GetTexelLeftOffset();
|
tilexoff = (int)tex->GetDisplayLeftOffset();
|
||||||
tileyoff = tex->GetTexelTopOffset();
|
tileyoff = (int)tex->GetDisplayTopOffset();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,12 +196,12 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags)
|
||||||
|
|
||||||
SetLightAndFog(state);
|
SetLightAndFog(state);
|
||||||
|
|
||||||
int h = texture->GetTexelHeight();
|
int h = (int)texture->GetDisplayHeight();
|
||||||
int h2 = 1 << sizeToBits(h);
|
int h2 = 1 << sizeToBits(h);
|
||||||
if (h2 < h) h2 *= 2;
|
if (h2 < h) h2 *= 2;
|
||||||
if (h != h2)
|
if (h != h2)
|
||||||
{
|
{
|
||||||
float xOffset = 1.f / texture->GetTexelWidth();
|
float xOffset = 1.f / texture->GetDisplayWidth();
|
||||||
state.SetNpotEmulation(float(h2) / h, xOffset);
|
state.SetNpotEmulation(float(h2) / h, xOffset);
|
||||||
}
|
}
|
||||||
else
|
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 leftdist = xflipped ? 1.f - glseg.fracleft : glseg.fracleft;
|
||||||
float rightdist = xflipped ? 1.f - glseg.fracright : glseg.fracright;
|
float rightdist = xflipped ? 1.f - glseg.fracright : glseg.fracright;
|
||||||
|
|
||||||
float tw = texture->GetTexelWidth();
|
float tw = texture->GetDisplayWidth();
|
||||||
float th = texture->GetTexelHeight();
|
float th = texture->GetDisplayHeight();
|
||||||
int pow2size = 1 << sizeToBits(th);
|
int pow2size = 1 << sizeToBits(th);
|
||||||
if (pow2size < th) pow2size *= 2;
|
if (pow2size < th) pow2size *= 2;
|
||||||
float ypanning = refwall->ypan_ ? pow2size * refwall->ypan_ / (256.0f * th) : 0;
|
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
|
else
|
||||||
{
|
{
|
||||||
height = tex->GetTexelHeight();
|
height = (int)tex->GetDisplayHeight();
|
||||||
topofs = (tex->GetTexelTopOffset() + spr->yoffset);
|
topofs = ((int)tex->GetDisplayTopOffset() + spr->yoffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spr->cstat & CSTAT_SPRITE_YFLIP)
|
if (spr->cstat & CSTAT_SPRITE_YFLIP)
|
||||||
|
|
|
@ -138,14 +138,14 @@ public:
|
||||||
cosalign = vang.Cos();
|
cosalign = vang.Cos();
|
||||||
sinalign = vang.Sin();
|
sinalign = vang.Sin();
|
||||||
|
|
||||||
int pow2width = 1 << sizeToBits(tx->GetTexelWidth());
|
int pow2width = 1 << sizeToBits((int)tx->GetDisplayWidth());
|
||||||
if (pow2width < tx->GetTexelWidth()) pow2width *= 2;
|
if (pow2width < (int)tx->GetDisplayWidth()) pow2width *= 2;
|
||||||
|
|
||||||
int pow2height = 1 << sizeToBits(tx->GetTexelHeight());
|
int pow2height = 1 << sizeToBits((int)tx->GetDisplayHeight());
|
||||||
if (pow2height < tx->GetTexelHeight()) pow2height *= 2;
|
if (pow2height < (int)tx->GetDisplayHeight()) pow2height *= 2;
|
||||||
|
|
||||||
xpanning = pow2width * xpan / (256.f * tx->GetTexelWidth());
|
xpanning = pow2width * xpan / (256.f * tx->GetDisplayWidth());
|
||||||
ypanning = pow2height * ypan / (256.f * tx->GetTexelHeight());
|
ypanning = pow2height * ypan / (256.f * tx->GetDisplayHeight());
|
||||||
|
|
||||||
float scalefactor = (stat & CSTAT_SECTOR_TEXHALF) ? 8.0f : 16.0f;
|
float scalefactor = (stat & CSTAT_SECTOR_TEXHALF) ? 8.0f : 16.0f;
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xscaled = scalefactor * tx->GetTexelWidth();
|
xscaled = scalefactor * (int)tx->GetDisplayWidth();
|
||||||
yscaled = scalefactor * tx->GetTexelHeight();
|
yscaled = scalefactor * (int)tx->GetDisplayHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
FVector2 GetUV(int x, int y, float z)
|
FVector2 GetUV(int x, int y, float z)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue