preconvert our polyvertex coords to fixed point

yes this is unironically faster, by atleast 5-10fps in the wandering falls test case
This commit is contained in:
Alug committed 2025-09-16 02:27:25 +02:00
1 parent 3e38faed2e
commit 08e91c1cc2
3 files changed
+24 -20

No files matched your search

+10 -5
View File
@@ -175,9 +175,9 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
INT32 ps = -1, pe = -1;
INT32 nptfront, nptback;
polyvertex_t vs = {0,0,0};
polyvertex_t ve = {0,0,0};
polyvertex_t lastpv = {0,0,0};
polyvertex_t vs = {};
polyvertex_t ve = {};
polyvertex_t lastpv = {};
float fracs = 0.0f, frace = 0.0f; //used to tell which poly is on
// the front side of the bsp partition line
INT32 psonline = 0, peonline = 0;
@@ -349,8 +349,8 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
INT32 i, j;
polyvertex_t *pv;
INT32 nump = 0, ps, pe;
polyvertex_t vs = {0, 0, 0}, ve = {0, 0, 0},
p1 = {0, 0, 0}, p2 = {0, 0, 0};
polyvertex_t vs = {}, ve = {},
p1 = {}, p2 = {};
float fracs = 0.0f;
fdivline_t cutseg; // x, y, dx, dy as start of node_t struct
poly_t *temppoly;
@@ -936,6 +936,11 @@ static void AdjustSegs(void)
pv->y = FIXED_TO_FLOAT(lseg->v2->y);
lseg->pv2 = pv;
}
lseg->pv1->x2 = FloatToFixed(lseg->pv1->x);
lseg->pv1->y2 = FloatToFixed(lseg->pv1->y);
lseg->pv2->x2 = FloatToFixed(lseg->pv2->x);
lseg->pv2->y2 = FloatToFixed(lseg->pv2->y);
}
}
}
+2 -3
View File
@@ -95,9 +95,8 @@ typedef struct
// a vertex of a Doom 'plane' polygon
typedef struct
{
float x;
float y;
float z;
float x, y, z;
fixed_t x2, y2, z2;
} polyvertex_t;
#ifdef _MSC_VER
+12 -12
View File
@@ -1371,8 +1371,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
vs.x = gl_curline->pv1->x;
vs.y = gl_curline->pv1->y;
v1x = FloatToFixed(vs.x);
v1y = FloatToFixed(vs.y);
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
@@ -1386,8 +1386,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
ve.x = gl_curline->pv2->x;
ve.y = gl_curline->pv2->y;
v2x = FloatToFixed(ve.x);
v2y = FloatToFixed(ve.y);
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
@@ -2248,8 +2248,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
if (LIKELY(gl_curline->pv1))
{
v1x = FloatToFixed(gl_curline->pv1->x);
v1y = FloatToFixed(gl_curline->pv1->y);
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
@@ -2259,8 +2259,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
if (LIKELY(gl_curline->pv2))
{
v2x = FloatToFixed(gl_curline->pv2->x);
v2y = FloatToFixed(gl_curline->pv2->y);
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{
@@ -2476,8 +2476,8 @@ static void HWR_AddLine(seg_t *line)
if (LIKELY(gl_curline->pv1))
{
v1x = FloatToFixed(gl_curline->pv1->x);
v1y = FloatToFixed(gl_curline->pv1->y);
v1x = gl_curline->pv1->x2;
v1y = gl_curline->pv1->y2;
}
else
{
@@ -2487,8 +2487,8 @@ static void HWR_AddLine(seg_t *line)
if (LIKELY(gl_curline->pv2))
{
v2x = FloatToFixed(gl_curline->pv2->x);
v2y = FloatToFixed(gl_curline->pv2->y);
v2x = gl_curline->pv2->x2;
v2y = gl_curline->pv2->y2;
}
else
{