Hopefully work around more Polymost polygon leakages

Patch from Nuke.YKT.

git-svn-id: https://svn.eduke32.com/eduke32@7867 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-08-01 06:50:29 +00:00 committed by Christoph Oelckers
parent acc0b527a9
commit 0f4ccaf970

View file

@ -2783,9 +2783,6 @@ static void polymost_domost(float x0, float y0, float x1, float y1, float y0top
y1 += DOMOST_OFFSET; //necessary? y1 += DOMOST_OFFSET; //necessary?
} }
x0 -= DOMOST_OFFSET;
x1 += DOMOST_OFFSET;
// Test if span is outside screen bounds // Test if span is outside screen bounds
if (x1 < xbl || x0 > xbr) if (x1 < xbl || x0 > xbr)
{ {
@ -2793,8 +2790,8 @@ static void polymost_domost(float x0, float y0, float x1, float y1, float y0top
return; return;
} }
vec2f_t dm0 = { x0, y0 }; vec2f_t dm0 = { x0 - DOMOST_OFFSET, y0 };
vec2f_t dm1 = { x1, y1 }; vec2f_t dm1 = { x1 + DOMOST_OFFSET, y1 };
float const slop = (dm1.y - dm0.y) / (dm1.x - dm0.x); float const slop = (dm1.y - dm0.y) / (dm1.x - dm0.x);
@ -3166,8 +3163,9 @@ skip: ;
int const ni = vsp[i].n; int const ni = vsp[i].n;
//POGO: specially treat the viewport nodes so that we will never end up in a situation where we accidentally access the sentinel node //POGO: specially treat the viewport nodes so that we will never end up in a situation where we accidentally access the sentinel node
if (ni >= viewportNodeCount && if (ni >= viewportNodeCount)
(vsp[i].ctag == vsp[ni].ctag) && (vsp[i].ftag == vsp[ni].ftag)) {
if ((vsp[i].ctag == vsp[ni].ctag) && (vsp[i].ftag == vsp[ni].ftag))
{ {
MERGE_NODES(i, ni); MERGE_NODES(i, ni);
#if 0 #if 0
@ -3197,8 +3195,20 @@ skip: ;
glStencilFunc(GL_EQUAL, 0, 0xFF); glStencilFunc(GL_EQUAL, 0, 0xFF);
glColor4f(1.f, 1.f, 1.f, 1.f); glColor4f(1.f, 1.f, 1.f, 1.f);
#endif #endif
continue;
} }
else i = ni; if (vsp[ni].x - vsp[i].x < DOMOST_OFFSET)
{
vsp[i].x = vsp[ni].x;
vsp[i].cy[0] = vsp[ni].cy[0];
vsp[i].fy[0] = vsp[ni].fy[0];
vsp[i].ctag = vsp[ni].ctag;
vsp[i].ftag = vsp[ni].ftag;
MERGE_NODES(i, ni);
continue;
}
}
i = ni;
} }
while (i); while (i);
#endif #endif