use highly optmized (but slightly inaccurate) version of R_PointOnSide for rendering

This commit is contained in:
Alug committed 2024-11-20 21:24:04 +01:00
1 parent 7b26ecb5f5
commit 809ae20558
3 files changed
+9 -2

No files matched your search

+1 -1
View File
@@ -3103,7 +3103,7 @@ static void HWR_RenderBSPNode(INT32 bspnum)
bsp = &nodes[bspnum];
// Decide which side the view point is on.
side = R_PointOnSide(viewx, viewy, bsp);
side = R_PointOnSideRender(viewx, viewy, bsp);
// Recursively divide front space.
if (HWR_PortalCheckBBox(bsp->bbox[side]))
+2 -1
View File
@@ -1320,7 +1320,8 @@ void R_RenderBSPNode(INT32 bspnum)
bsp = &nodes[bspnum];
// Decide which side the view point is on.
side = R_PointOnSide(viewx, viewy, bsp);
side = R_PointOnSideRender(viewx, viewy, bsp);
// Recursively divide front space.
R_RenderBSPNode(bsp->children[side]);
+6
View File
@@ -74,6 +74,12 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
// Utility functions.
INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *node);
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSideRender(fixed_t x, fixed_t y, const node_t *node)
{
// use cross product to determine side quickly
return (INT64)(y - node->y) * node->dx - (INT64)(x - node->x) * node->dy > 0;
}
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line)
{
fixed_t lx = line->v1->x;