From 53077c2c545a86542b17d6aa05c588525ad61e5d Mon Sep 17 00:00:00 2001 From: Kevin Shanahan Date: Sun, 21 Oct 2012 17:27:34 +1030 Subject: [PATCH] efrags: Merge remaining differences between gl/sw efrags Signed-off-by: Kevin Shanahan --- common/gl_refrag.c | 47 ++++++++++++++++++++++++++++++++++++++++++++-- common/r_efrag.c | 12 ++++++++++-- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/common/gl_refrag.c b/common/gl_refrag.c index 83fc2e9..aa26e1f 100644 --- a/common/gl_refrag.c +++ b/common/gl_refrag.c @@ -20,11 +20,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // r_efrag.c #include "console.h" -#include "glquake.h" -#include "gl_model.h" #include "quakedef.h" #include "sys.h" +#ifdef GLQUAKE +#include "glquake.h" +#include "gl_model.h" +#else +#include "r_local.h" +#endif + mnode_t *r_pefragtopnode; @@ -147,6 +152,44 @@ R_SplitEntityOnNode(mnode_t *node) } +#ifndef GLQUAKE +/* +=================== +R_SplitEntityOnNode2 +=================== +*/ +void +R_SplitEntityOnNode2(mnode_t *node) +{ + mplane_t *splitplane; + int sides; + + if (node->visframe != r_visframecount) + return; + + if (node->contents < 0) { + if (node->contents != CONTENTS_SOLID) + r_pefragtopnode = node; // we've reached a non-solid leaf, so it's + // visible and not BSP clipped + return; + } + + splitplane = node->plane; + sides = BOX_ON_PLANE_SIDE(r_emins, r_emaxs, splitplane); + + if (sides == 3) { + // remember first splitter + r_pefragtopnode = node; + return; + } +// not split yet; recurse down the contacted side + if (sides & 1) + R_SplitEntityOnNode2(node->children[0]); + else + R_SplitEntityOnNode2(node->children[1]); +} +#endif + /* =========== diff --git a/common/r_efrag.c b/common/r_efrag.c index 244b64b..aa26e1f 100644 --- a/common/r_efrag.c +++ b/common/r_efrag.c @@ -21,9 +21,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "console.h" #include "quakedef.h" -#include "r_local.h" #include "sys.h" +#ifdef GLQUAKE +#include "glquake.h" +#include "gl_model.h" +#else +#include "r_local.h" +#endif + mnode_t *r_pefragtopnode; @@ -32,7 +38,7 @@ mnode_t *r_pefragtopnode; /* =============================================================================== - ENTITY FRAGMENT FUNCTIONS + ENTITY FRAGMENT FUNCTIONS =============================================================================== */ @@ -146,6 +152,7 @@ R_SplitEntityOnNode(mnode_t *node) } +#ifndef GLQUAKE /* =================== R_SplitEntityOnNode2 @@ -181,6 +188,7 @@ R_SplitEntityOnNode2(mnode_t *node) else R_SplitEntityOnNode2(node->children[1]); } +#endif /*