Remove the recursive versions of R_RecursiveWorldNode.

They seem to not be needed any more.
This commit is contained in:
Bill Currie 2013-01-07 19:57:21 +09:00
parent 9758302023
commit a852eeb711
2 changed files with 0 additions and 302 deletions

View file

@ -334,7 +334,6 @@ R_DrawSubmodelPolygons (model_t *pmodel, int clipflags)
}
}
#if 1
static inline void
visit_leaf (mleaf_t *leaf)
{
@ -497,156 +496,6 @@ R_RecursiveWorldNode (model_t *model, int clipflags)
if (node->contents < 0 && node->contents != CONTENTS_SOLID)
visit_leaf ((mleaf_t *) node);
}
#else
static void
R_RecursiveWorldNode (mnode_t *node, int clipflags)
{
int i, c, side, *pindex;
vec3_t acceptpt, rejectpt;
plane_t *plane;
msurface_t *surf;
mleaf_t *pleaf;
double d, dot;
if (node->contents == CONTENTS_SOLID)
return; // solid
if (node->visframe != r_visframecount)
return;
// cull the clipping planes if not trivial accept
// FIXME: the compiler is doing a lousy job of optimizing here; it could be
// twice as fast in ASM
if (clipflags) {
for (i = 0; i < 4; i++) {
if (!(clipflags & (1 << i)))
continue; // don't need to clip against it
// generate accept and reject points
// FIXME: do with fast look-ups or integer tests based on the
// sign bit of the floating point values
pindex = pfrustum_indexes[i];
rejectpt[0] = (float) node->minmaxs[pindex[0]];
rejectpt[1] = (float) node->minmaxs[pindex[1]];
rejectpt[2] = (float) node->minmaxs[pindex[2]];
d = DotProduct (rejectpt, view_clipplanes[i].normal);
d -= view_clipplanes[i].dist;
if (d <= 0)
return;
acceptpt[0] = (float) node->minmaxs[pindex[3 + 0]];
acceptpt[1] = (float) node->minmaxs[pindex[3 + 1]];
acceptpt[2] = (float) node->minmaxs[pindex[3 + 2]];
d = DotProduct (acceptpt, view_clipplanes[i].normal);
d -= view_clipplanes[i].dist;
if (d >= 0)
clipflags &= ~(1 << i); // node is entirely on screen
}
}
// if a leaf node, draw stuff
if (node->contents < 0) {
pleaf = (mleaf_t *) node;
// deal with model fragments in this leaf
if (pleaf->efrags) {
R_StoreEfrags (pleaf->efrags);
}
pleaf->key = r_currentkey;
r_currentkey++; // all bmodels in a leaf share the same key
} else {
// node is just a decision point, so go down the apropriate sides
// find which side of the node we are on
plane = node->plane;
switch (plane->type) {
case PLANE_X:
dot = modelorg[0] - plane->dist;
break;
case PLANE_Y:
dot = modelorg[1] - plane->dist;
break;
case PLANE_Z:
dot = modelorg[2] - plane->dist;
break;
default:
dot = DotProduct (modelorg, plane->normal) - plane->dist;
break;
}
if (dot >= 0)
side = 0;
else
side = 1;
// recurse down the children, front side first
R_RecursiveWorldNode (node->children[side], clipflags);
// draw stuff
c = node->numsurfaces;
if (c) {
surf = r_worldentity.model->surfaces + node->firstsurface;
if (dot < -BACKFACE_EPSILON) {
do {
if ((surf->flags & SURF_PLANEBACK) &&
(surf->visframe == r_visframecount)) {
if (r_drawpolys) {
if (r_worldpolysbacktofront) {
if (numbtofpolys < MAX_BTOFPOLYS) {
pbtofpolys[numbtofpolys].clipflags =
clipflags;
pbtofpolys[numbtofpolys].psurf = surf;
numbtofpolys++;
}
} else {
R_RenderPoly (surf, clipflags);
}
} else {
R_RenderFace (surf, clipflags);
}
}
surf++;
} while (--c);
} else if (dot > BACKFACE_EPSILON) {
do {
if (!(surf->flags & SURF_PLANEBACK) &&
(surf->visframe == r_visframecount)) {
if (r_drawpolys) {
if (r_worldpolysbacktofront) {
if (numbtofpolys < MAX_BTOFPOLYS) {
pbtofpolys[numbtofpolys].clipflags =
clipflags;
pbtofpolys[numbtofpolys].psurf = surf;
numbtofpolys++;
}
} else {
R_RenderPoly (surf, clipflags);
}
} else {
R_RenderFace (surf, clipflags);
}
}
surf++;
} while (--c);
}
// all surfaces on the same node share the same sequence number
r_currentkey++;
}
// recurse down the back side
R_RecursiveWorldNode (node->children[!side], clipflags);
}
}
#endif
void
R_RenderWorld (void)

View file

@ -337,7 +337,6 @@ sw32_R_DrawSubmodelPolygons (model_t *pmodel, int clipflags)
}
}
#if 1
static inline void
visit_leaf (mleaf_t *leaf)
{
@ -500,156 +499,6 @@ R_RecursiveWorldNode (model_t *model, int clipflags)
if (node->contents < 0 && node->contents != CONTENTS_SOLID)
visit_leaf ((mleaf_t *) node);
}
#else
static void
R_RecursiveWorldNode (mnode_t *node, int clipflags)
{
int i, c, side, *pindex;
vec3_t acceptpt, rejectpt;
plane_t *plane;
msurface_t *surf;
mleaf_t *pleaf;
double d, dot;
if (node->contents == CONTENTS_SOLID)
return; // solid
if (node->visframe != r_visframecount)
return;
// cull the clipping planes if not trivial accept
// FIXME: the compiler is doing a lousy job of optimizing here; it could be
// twice as fast in ASM
if (clipflags) {
for (i = 0; i < 4; i++) {
if (!(clipflags & (1 << i)))
continue; // don't need to clip against it
// generate accept and reject points
// FIXME: do with fast look-ups or integer tests based on the
// sign bit of the floating point values
pindex = sw32_pfrustum_indexes[i];
rejectpt[0] = (float) node->minmaxs[pindex[0]];
rejectpt[1] = (float) node->minmaxs[pindex[1]];
rejectpt[2] = (float) node->minmaxs[pindex[2]];
d = DotProduct (rejectpt, sw32_view_clipplanes[i].normal);
d -= sw32_view_clipplanes[i].dist;
if (d <= 0)
return;
acceptpt[0] = (float) node->minmaxs[pindex[3 + 0]];
acceptpt[1] = (float) node->minmaxs[pindex[3 + 1]];
acceptpt[2] = (float) node->minmaxs[pindex[3 + 2]];
d = DotProduct (acceptpt, sw32_view_clipplanes[i].normal);
d -= sw32_view_clipplanes[i].dist;
if (d >= 0)
clipflags &= ~(1 << i); // node is entirely on screen
}
}
// if a leaf node, draw stuff
if (node->contents < 0) {
pleaf = (mleaf_t *) node;
// deal with model fragments in this leaf
if (pleaf->efrags) {
R_StoreEfrags (pleaf->efrags);
}
pleaf->key = sw32_r_currentkey;
sw32_r_currentkey++; // all bmodels in a leaf share the same key
} else {
// node is just a decision point, so go down the apropriate sides
// find which side of the node we are on
plane = node->plane;
switch (plane->type) {
case PLANE_X:
dot = modelorg[0] - plane->dist;
break;
case PLANE_Y:
dot = modelorg[1] - plane->dist;
break;
case PLANE_Z:
dot = modelorg[2] - plane->dist;
break;
default:
dot = DotProduct (modelorg, plane->normal) - plane->dist;
break;
}
if (dot >= 0)
side = 0;
else
side = 1;
// recurse down the children, front side first
R_RecursiveWorldNode (node->children[side], clipflags);
// draw stuff
c = node->numsurfaces;
if (c) {
surf = r_worldentity.model->surfaces + node->firstsurface;
if (dot < -BACKFACE_EPSILON) {
do {
if ((surf->flags & SURF_PLANEBACK) &&
(surf->visframe == r_visframecount)) {
if (sw32_r_drawpolys) {
if (sw32_r_worldpolysbacktofront) {
if (sw32_numbtofpolys < MAX_BTOFPOLYS) {
pbtofpolys[sw32_numbtofpolys].clipflags =
clipflags;
pbtofpolys[sw32_numbtofpolys].psurf = surf;
sw32_numbtofpolys++;
}
} else {
sw32_R_RenderPoly (surf, clipflags);
}
} else {
sw32_R_RenderFace (surf, clipflags);
}
}
surf++;
} while (--c);
} else if (dot > BACKFACE_EPSILON) {
do {
if (!(surf->flags & SURF_PLANEBACK) &&
(surf->visframe == r_visframecount)) {
if (sw32_r_drawpolys) {
if (sw32_r_worldpolysbacktofront) {
if (sw32_numbtofpolys < MAX_BTOFPOLYS) {
pbtofpolys[sw32_numbtofpolys].clipflags =
clipflags;
pbtofpolys[sw32_numbtofpolys].psurf = surf;
sw32_numbtofpolys++;
}
} else {
sw32_R_RenderPoly (surf, clipflags);
}
} else {
sw32_R_RenderFace (surf, clipflags);
}
}
surf++;
} while (--c);
}
// all surfaces on the same node share the same sequence number
sw32_r_currentkey++;
}
// recurse down the back side
R_RecursiveWorldNode (node->children[!side], clipflags);
}
}
#endif
void
sw32_R_RenderWorld (void)