mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
A curious Polymost optimization from Nuke.YKT
This bails out of drawing any domost spans that seem to be entirely outside of the range of the screen coordinates. Since this seems so obvious, I have to wonder if Polymost is supposed to be doing this elsewhere already... git-svn-id: https://svn.eduke32.com/eduke32@7379 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e61831ad5d
commit
a050281006
1 changed files with 14 additions and 0 deletions
|
@ -38,6 +38,8 @@ typedef struct { float x, cy[2], fy[2]; int32_t tag; int16_t n, p, ctag, ftag; }
|
|||
#define VSPMAX 2048 //<- careful!
|
||||
static vsptyp vsp[VSPMAX];
|
||||
static int32_t gtag;
|
||||
static float xbl, xbr;
|
||||
int32_t domost_rejectcount;
|
||||
|
||||
static float dxb1[MAXWALLSB], dxb2[MAXWALLSB];
|
||||
|
||||
|
@ -3562,6 +3564,13 @@ static void polymost_domost(float x0, float y0, float x1, float y1)
|
|||
y1 += DOMOST_OFFSET; //necessary?
|
||||
}
|
||||
|
||||
// Test if span is outside screen bounds
|
||||
if (x1+DOMOST_OFFSET < xbl || x0-DOMOST_OFFSET > xbr)
|
||||
{
|
||||
domost_rejectcount++;
|
||||
return;
|
||||
}
|
||||
|
||||
vec2f_t const dm0 = { x0, y0 };
|
||||
vec2f_t const dm1 = { x1, y1 };
|
||||
|
||||
|
@ -5296,6 +5305,7 @@ static void polymost_initmosts(const float * px, const float * py, int const n)
|
|||
|
||||
int32_t vcnt = 1; //0 is dummy solid node
|
||||
|
||||
xbl = px[imin];
|
||||
vsp[vcnt].x = px[imin];
|
||||
vsp[vcnt].cy[0] = vsp[vcnt].fy[0] = py[imin];
|
||||
vcnt++;
|
||||
|
@ -5344,6 +5354,8 @@ static void polymost_initmosts(const float * px, const float * py, int const n)
|
|||
}
|
||||
} while (i != j);
|
||||
|
||||
xbr = px[i];
|
||||
|
||||
if (px[i] > vsp[vcnt-1].x)
|
||||
{
|
||||
vsp[vcnt].x = px[i];
|
||||
|
@ -5351,6 +5363,8 @@ static void polymost_initmosts(const float * px, const float * py, int const n)
|
|||
vcnt++;
|
||||
}
|
||||
|
||||
domost_rejectcount = 0;
|
||||
|
||||
vsp_finalize_init(vcnt);
|
||||
gtag = vcnt;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue