mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 15:01:41 +00:00
Remove R_SplitEntityOnNode2
When R_AddEfrags is used (as is the case in nq), this function is redundant. Brush models in qw are currently broken (invisible), but that's just a matter of getting qw to use R_AddEfrags instead of R_NewEntity. This removal should speed up the software renderers a little bit.
This commit is contained in:
parent
d24837af4a
commit
085b0f4448
4 changed files with 10 additions and 69 deletions
|
@ -302,8 +302,6 @@ extern qboolean r_dowarpold, r_viewchanged;
|
|||
|
||||
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
|
||||
|
||||
extern vec3_t r_emins, r_emaxs;
|
||||
extern mnode_t *r_pefragtopnode;
|
||||
extern int r_clipflags;
|
||||
extern int r_dlightframecount;
|
||||
extern qboolean r_fov_greater_than_90;
|
||||
|
@ -325,7 +323,6 @@ void R_SetupFrame (void);
|
|||
void R_cshift_f (void);
|
||||
void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1);
|
||||
void R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip);
|
||||
void R_SplitEntityOnNode2 (mnode_t *node);
|
||||
void R_RecursiveMarkLights (const vec3_t lightorigin, struct dlight_s *light,
|
||||
int bit, mnode_t *node);
|
||||
void R_MarkLights (const vec3_t lightorigin, struct dlight_s *light, int bit,
|
||||
|
|
|
@ -38,8 +38,8 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
|
||||
#include "r_local.h"
|
||||
|
||||
mnode_t *r_pefragtopnode;
|
||||
vec3_t r_emins, r_emaxs;
|
||||
static mnode_t *r_pefragtopnode;
|
||||
static vec3_t r_emins, r_emaxs;
|
||||
|
||||
typedef struct s_efrag_list {
|
||||
struct s_efrag_list *next;
|
||||
|
@ -189,43 +189,10 @@ R_SplitEntityOnNode (mnode_t *node)
|
|||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
void
|
||||
R_AddEfrags (entity_t *ent)
|
||||
{
|
||||
model_t *entmodel;
|
||||
int i;
|
||||
|
||||
if (!ent->model)
|
||||
return;
|
||||
|
@ -240,10 +207,8 @@ R_AddEfrags (entity_t *ent)
|
|||
|
||||
entmodel = ent->model;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
r_emins[i] = ent->origin[i] + entmodel->mins[i];
|
||||
r_emaxs[i] = ent->origin[i] + entmodel->maxs[i];
|
||||
}
|
||||
VectorAdd (ent->origin, entmodel->mins, r_emins);
|
||||
VectorAdd (ent->origin, entmodel->maxs, r_emaxs);
|
||||
|
||||
R_SplitEntityOnNode (r_worldentity.model->nodes);
|
||||
|
||||
|
|
|
@ -658,19 +658,10 @@ R_DrawBEntitiesOnList (void)
|
|||
if (r_drawpolys | r_drawculledpolys) {
|
||||
R_ZDrawSubmodelPolys (clmodel);
|
||||
} else {
|
||||
r_pefragtopnode = NULL;
|
||||
if (currententity->topnode) {
|
||||
mnode_t *topnode = currententity->topnode;
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
r_emins[j] = minmaxs[j];
|
||||
r_emaxs[j] = minmaxs[3 + j];
|
||||
}
|
||||
|
||||
R_SplitEntityOnNode2 (r_worldentity.model->nodes);
|
||||
|
||||
if (r_pefragtopnode) {
|
||||
currententity->topnode = r_pefragtopnode;
|
||||
|
||||
if (r_pefragtopnode->contents >= 0) {
|
||||
if (topnode->contents >= 0) {
|
||||
// not a leaf; has to be clipped to the world
|
||||
// BSP
|
||||
r_clipflags = clipflags;
|
||||
|
@ -682,7 +673,6 @@ R_DrawBEntitiesOnList (void)
|
|||
R_DrawSubmodelPolygons (clmodel, clipflags);
|
||||
}
|
||||
|
||||
currententity->topnode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -677,19 +677,10 @@ R_DrawBEntitiesOnList (void)
|
|||
if (r_drawpolys | r_drawculledpolys) {
|
||||
R_ZDrawSubmodelPolys (clmodel);
|
||||
} else {
|
||||
r_pefragtopnode = NULL;
|
||||
if (currententity->topnode) {
|
||||
mnode_t *topnode = currententity->topnode;
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
r_emins[j] = minmaxs[j];
|
||||
r_emaxs[j] = minmaxs[3 + j];
|
||||
}
|
||||
|
||||
R_SplitEntityOnNode2 (r_worldentity.model->nodes);
|
||||
|
||||
if (r_pefragtopnode) {
|
||||
currententity->topnode = r_pefragtopnode;
|
||||
|
||||
if (r_pefragtopnode->contents >= 0) {
|
||||
if (topnode->contents >= 0) {
|
||||
// not a leaf; has to be clipped to the world
|
||||
// BSP
|
||||
r_clipflags = clipflags;
|
||||
|
@ -700,8 +691,6 @@ R_DrawBEntitiesOnList (void)
|
|||
// sorting handle drawing order
|
||||
R_DrawSubmodelPolygons (clmodel, clipflags);
|
||||
}
|
||||
|
||||
currententity->topnode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue