- fixed a few wall sprite rendering issues.

* masked walls were inserted into the sprite render list, causing sorting issues and depth fighting (see Duke's cameras and the 'closed' sign in Route66/Carnival.map)
* vertical and horizontal wall sprites needed their sorting functions swapped.
* plane clipping for wall sprites used bad coordinates.
This commit is contained in:
Christoph Oelckers 2021-03-28 13:09:26 +02:00
parent b7bad558da
commit 83760d4974
3 changed files with 6 additions and 5 deletions

View File

@ -437,8 +437,8 @@ void HWDrawInfo::RenderScene(FRenderState &state)
// These lists must be drawn in two passes for color and depth to avoid depth fighting with overlapping entries // These lists must be drawn in two passes for color and depth to avoid depth fighting with overlapping entries
drawlists[GLDL_MASKEDFLATS].SortFlats(this); drawlists[GLDL_MASKEDFLATS].SortFlats(this);
drawlists[GLDL_MASKEDWALLSV].SortWallsVert(this); drawlists[GLDL_MASKEDWALLSV].SortWallsHorz(this);
drawlists[GLDL_MASKEDWALLSH].SortWallsHorz(this); drawlists[GLDL_MASKEDWALLSH].SortWallsVert(this);
state.SetDepthBias(-1, -128); state.SetDepthBias(-1, -128);

View File

@ -50,7 +50,7 @@ void HWDrawInfo::AddWall(HWWall *wall)
int list; int list;
if (wall->type != RENDERWALL_M2S) list = GLDL_PLAINWALLS; if (wall->type != RENDERWALL_M2S) list = GLDL_PLAINWALLS;
else if (sprite == nullptr) list = GLDL_MASKEDWALLS; else if (wall->sprite == nullptr) list = GLDL_MASKEDWALLS;
else if (wall->glseg.x1 == wall->glseg.x2) list = GLDL_MASKEDWALLSV; else if (wall->glseg.x1 == wall->glseg.x2) list = GLDL_MASKEDWALLSV;
else if (wall->glseg.y1 == wall->glseg.y2) list = GLDL_MASKEDWALLSH; else if (wall->glseg.y1 == wall->glseg.y2) list = GLDL_MASKEDWALLSH;
else list = GLDL_MASKEDWALLSS; else list = GLDL_MASKEDWALLSS;

View File

@ -898,6 +898,7 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
this->seg = wal; this->seg = wal;
this->frontsector = frontsector; this->frontsector = frontsector;
this->backsector = backsector; this->backsector = backsector;
sprite = nullptr;
vertindex = 0; vertindex = 0;
vertcount = 0; vertcount = 0;
@ -1135,7 +1136,7 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect
float polyh = (zbottom[0] - origz); float polyh = (zbottom[0] - origz);
if (!(sector->ceilingstat & CSTAT_SECTOR_SKY)) if (!(sector->ceilingstat & CSTAT_SECTOR_SKY))
{ {
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 - origz) / polyh;
@ -1145,7 +1146,7 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect
} }
if (!(sector->floorstat & CSTAT_SECTOR_SKY)) if (!(sector->floorstat & CSTAT_SECTOR_SKY))
{ {
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 - origz) / polyh;