Revert "try recursion limit for _RenderBSPNode"
This reverts commit 501b8b7bf5.
This commit is contained in:
1 parent
5bad795c60
commit
d3edc19de9
2 files changed
+52
-131
No files matched your search
+27
-67
@@ -3127,87 +3127,47 @@ static void HWR_Subsector(size_t num)
|
||||
}
|
||||
|
||||
//
|
||||
// RenderBSPNode
|
||||
// Renders all subsectors below a given node,
|
||||
// traversing subtree recursively.
|
||||
// Just call with BSP root.
|
||||
|
||||
#define MAX_BSP_DEPTH 112
|
||||
|
||||
static void HWR_RenderBSPNode(INT32 bspnum)
|
||||
{
|
||||
node_t *bsp;
|
||||
INT32 stack_bsp[MAX_BSP_DEPTH];
|
||||
INT32 stack_side[MAX_BSP_DEPTH];
|
||||
int sp = 0;
|
||||
const node_t *bsp;
|
||||
INT32 side;
|
||||
ps_numbspcalls.value.i++;
|
||||
|
||||
while (true)
|
||||
while (!(bspnum & NF_SUBSECTOR)) // Found a subsector?
|
||||
{
|
||||
ps_numbspcalls.value.i++;
|
||||
bsp = &nodes[bspnum];
|
||||
|
||||
// Front sides.
|
||||
while ((short)bspnum >= 0)
|
||||
{
|
||||
if (sp == MAX_BSP_DEPTH)
|
||||
break;
|
||||
// Decide which side the view point is on.
|
||||
side = R_PointOnSideFast(viewx, viewy, bsp);
|
||||
|
||||
bsp = &nodes[bspnum];
|
||||
// Recursively divide front space.
|
||||
if (HWR_PortalCheckBBox(bsp->bbox[side]))
|
||||
HWR_RenderBSPNode(bsp->children[side]);
|
||||
|
||||
const INT32 side = R_PointOnSideFast(viewx, viewy, bsp);
|
||||
|
||||
stack_bsp[sp] = bspnum;
|
||||
stack_side[sp] = side ^ 1;
|
||||
|
||||
sp++;
|
||||
|
||||
bspnum = bsp->children[side];
|
||||
}
|
||||
|
||||
if (portalclipline && portalcullsector)
|
||||
{
|
||||
// skip all subsectors encountered before the portal
|
||||
// destination's front sector
|
||||
if (portalcullsector != subsectors[bspnum & ~NF_SUBSECTOR].sector)
|
||||
goto skipsubsector;
|
||||
else
|
||||
portalcullsector = NULL;
|
||||
}
|
||||
|
||||
HWR_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR);
|
||||
|
||||
skipsubsector:
|
||||
if (sp == 0)
|
||||
{
|
||||
// back at root node and not visible. All done!
|
||||
// Possibly divide back space
|
||||
if (!(HWR_CheckBBox(bsp->bbox[side^1]) && HWR_PortalCheckBBox(bsp->bbox[side^1])))
|
||||
return;
|
||||
}
|
||||
|
||||
// Back sides.
|
||||
|
||||
sp--;
|
||||
|
||||
bsp = &nodes[stack_bsp[sp]];
|
||||
|
||||
// Possibly divide back space.
|
||||
// Walk back up the tree until we find
|
||||
// a node that has a visible backspace.
|
||||
while (!(HWR_CheckBBox(bsp->bbox[stack_side[sp]]) && HWR_PortalCheckBBox(bsp->bbox[stack_side[sp]])))
|
||||
{
|
||||
if (sp == 0)
|
||||
{
|
||||
// back at root node and not visible. All done!
|
||||
return;
|
||||
}
|
||||
|
||||
// Back side next.
|
||||
|
||||
sp--;
|
||||
|
||||
bsp = &nodes[stack_bsp[sp]];
|
||||
}
|
||||
|
||||
bspnum = bsp->children[stack_side[sp]];
|
||||
bspnum = bsp->children[side^1];
|
||||
}
|
||||
|
||||
// PORTAL CULLING
|
||||
if (portalclipline && portalcullsector)
|
||||
{
|
||||
// skip all subsectors encountered before the portal
|
||||
// destination's front sector
|
||||
if (portalcullsector != subsectors[bspnum & ~NF_SUBSECTOR].sector)
|
||||
return;
|
||||
else
|
||||
portalcullsector = NULL;
|
||||
}
|
||||
|
||||
// e6y: support for extended nodes
|
||||
HWR_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
+25
-64
@@ -1316,78 +1316,39 @@ INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside)
|
||||
// Renders all subsectors below a given node,
|
||||
// traversing subtree recursively.
|
||||
// Just call with BSP root.
|
||||
|
||||
#define MAX_BSP_DEPTH 112
|
||||
//
|
||||
// killough 5/2/98: reformatted, removed tail recursion
|
||||
|
||||
void R_RenderBSPNode(INT32 bspnum)
|
||||
{
|
||||
node_t *bsp;
|
||||
INT32 stack_bsp[MAX_BSP_DEPTH];
|
||||
INT32 stack_side[MAX_BSP_DEPTH];
|
||||
int sp = 0;
|
||||
const node_t *bsp;
|
||||
INT32 side;
|
||||
|
||||
while (true)
|
||||
ps_numbspcalls.value.i++;
|
||||
|
||||
while (!(bspnum & NF_SUBSECTOR)) // Found a subsector?
|
||||
{
|
||||
// Front sides.
|
||||
while ((short)bspnum >= 0)
|
||||
{
|
||||
if (sp == MAX_BSP_DEPTH)
|
||||
break;
|
||||
bsp = &nodes[bspnum];
|
||||
|
||||
bsp = &nodes[bspnum];
|
||||
|
||||
// Decide which side the view point is on.
|
||||
const INT32 side = R_PointOnSideFast(viewx, viewy, bsp);
|
||||
|
||||
stack_bsp[sp] = bspnum;
|
||||
stack_side[sp] = side ^ 1;
|
||||
|
||||
sp++;
|
||||
|
||||
bspnum = bsp->children[side];
|
||||
}
|
||||
|
||||
// PORTAL CULLING
|
||||
if (portalcullsector)
|
||||
{
|
||||
if (subsectors[bspnum & ~NF_SUBSECTOR].sector != portalcullsector)
|
||||
goto skipsubsector;
|
||||
portalcullsector = NULL;
|
||||
}
|
||||
|
||||
R_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR);
|
||||
|
||||
skipsubsector:
|
||||
if (sp == 0)
|
||||
{
|
||||
// back at root node and not visible. All done!
|
||||
return;
|
||||
}
|
||||
|
||||
// Back sides.
|
||||
|
||||
sp--;
|
||||
|
||||
bsp = &nodes[stack_bsp[sp]];
|
||||
// Decide which side the view point is on.
|
||||
side = R_PointOnSideFast(viewx, viewy, bsp);
|
||||
// Recursively divide front space.
|
||||
R_RenderBSPNode(bsp->children[side]);
|
||||
|
||||
// Possibly divide back space.
|
||||
// Walk back up the tree until we find
|
||||
// a node that has a visible backspace.
|
||||
while (!R_CheckBBox(bsp->bbox[stack_side[sp]]))
|
||||
{
|
||||
if (sp == 0)
|
||||
{
|
||||
// back at root node and not visible. All done!
|
||||
return;
|
||||
}
|
||||
if (!R_CheckBBox(bsp->bbox[side^1]))
|
||||
return;
|
||||
|
||||
// Back side next.
|
||||
|
||||
sp--;
|
||||
|
||||
bsp = &nodes[stack_bsp[sp]];
|
||||
}
|
||||
|
||||
bspnum = bsp->children[stack_side[sp]];
|
||||
bspnum = bsp->children[side^1];
|
||||
}
|
||||
|
||||
// PORTAL CULLING
|
||||
if (portalcullsector)
|
||||
{
|
||||
if (subsectors[bspnum & ~NF_SUBSECTOR].sector != portalcullsector)
|
||||
return;
|
||||
portalcullsector = NULL;
|
||||
}
|
||||
|
||||
R_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR);
|
||||
}
|
||||
Reference in new issue
Block a user