ref: 9912aef9564f75230bc4e77a01f1b72473c7cc4d
parent: 1d9c69e0ff3b386a33ed87da12286bbff3285caf
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Oct 14 22:37:21 EDT 2023
simpler backface cull check expression
--- a/r_bsp.c
+++ b/r_bsp.c
@@ -333,8 +333,7 @@
dot = DotProduct (modelorg, pplane->normal) - pplane->dist;
// draw the polygon
- if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) ||
- (!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON)))
+ if ((dot > 0) ^ !!(psurf->flags & SURF_PLANEBACK))
{
// FIXME: use bounding-box-based frustum clipping info?
@@ -411,8 +410,7 @@
dot = DotProduct (modelorg, pplane->normal) - pplane->dist;
// draw the polygon
- if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) ||
- (!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON)))
+ if ((dot > 0) ^ !!(psurf->flags & SURF_PLANEBACK))
{
r_currentkey = ((mleaf_t *)currententity->topnode)->key;
--- a/r_draw.c
+++ b/r_draw.c
@@ -872,12 +872,9 @@
dot = DotProduct (modelorg, pplane->normal) - pplane->dist;
// draw the polygon
- if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) ||
- (!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON)))
- {
- // FIXME: use bounding-box-based frustum clipping info?
+ // FIXME: use bounding-box-based frustum clipping info?
+ if ((dot > 0) ^ !!(psurf->flags & SURF_PLANEBACK))
R_RenderPoly (psurf, 15);
- }
}
}