mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-13 11:30:44 +00:00
- handle the wall sprite clipping properly.
This commit is contained in:
parent
028a196777
commit
a348508779
1 changed files with 8 additions and 6 deletions
|
@ -1094,28 +1094,30 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect
|
||||||
auto zz = zbottom[0];
|
auto zz = zbottom[0];
|
||||||
zbottom[0] = zbottom[1] = ztop[0];
|
zbottom[0] = zbottom[1] = ztop[0];
|
||||||
ztop[0] = ztop[1] = zz;
|
ztop[0] = ztop[1] = zz;
|
||||||
|
tcs[UPLFT].v = tcs[UPRGT].v = 1.f - tcs[UPLFT].v;
|
||||||
|
tcs[LOLFT].v = tcs[LORGT].v = 1.f - tcs[LOLFT].v;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clip sprites to ceilings/floors
|
// Clip sprites to ceilings/floors
|
||||||
float origz = zbottom[0];
|
|
||||||
float polyh = (ztop[0] - origz);
|
|
||||||
if (!(sector->ceilingstat & CSTAT_SECTOR_SKY))
|
if (!(sector->ceilingstat & CSTAT_SECTOR_SKY))
|
||||||
{
|
{
|
||||||
|
float polyh = (ztop[0] - zbottom[0]);
|
||||||
float ceilingz = sector->ceilingz * (1 / -256.f);
|
float ceilingz = sector->ceilingz * (1 / -256.f);
|
||||||
if (ceilingz < ztop[0] && ceilingz > zbottom[0])
|
if (ceilingz < ztop[0] && ceilingz > zbottom[0])
|
||||||
{
|
{
|
||||||
float newv = (ceilingz - origz) / polyh;
|
float newv = (ceilingz - zbottom[0]) / polyh;
|
||||||
tcs[UPLFT].v = tcs[UPRGT].v = newv;
|
tcs[UPLFT].v = tcs[UPRGT].v = tcs[LOLFT].v + newv * (tcs[UPLFT].v - tcs[LOLFT].v);
|
||||||
ztop[0] = ztop[1] = ceilingz;
|
ztop[0] = ztop[1] = ceilingz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(sector->floorstat & CSTAT_SECTOR_SKY))
|
if (!(sector->floorstat & CSTAT_SECTOR_SKY))
|
||||||
{
|
{
|
||||||
|
float polyh = (ztop[0] - zbottom[0]);
|
||||||
float floorz = sector->floorz * (1 / -256.f);
|
float floorz = sector->floorz * (1 / -256.f);
|
||||||
if (floorz < ztop[0] && floorz > zbottom[0])
|
if (floorz < ztop[0] && floorz > zbottom[0])
|
||||||
{
|
{
|
||||||
float newv = (floorz - origz) / polyh;
|
float newv = (floorz - zbottom[0]) / polyh;
|
||||||
tcs[LOLFT].v = tcs[LORGT].v = newv;
|
tcs[LOLFT].v = tcs[LORGT].v = tcs[LOLFT].v + newv * (tcs[UPLFT].v - tcs[LOLFT].v);
|
||||||
zbottom[0] = zbottom[1] = floorz;
|
zbottom[0] = zbottom[1] = floorz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue