Merge branch 'use-software-bsp-opengl' into 'next'

Use software's BSP node traversal in OpenGL

See merge request STJr/SRB2!2584
This commit is contained in:
Lactozilla 2025-02-21 22:08:19 +00:00
commit a2aaa45d4f

View file

@ -2671,45 +2671,31 @@ fixed_t *hwbbox;
static void HWR_RenderBSPNode(INT32 bspnum)
{
node_t *bsp = &nodes[bspnum];
// Decide which side the view point is on
node_t *bsp;
INT32 side;
ps_numbspcalls.value.i++;
// Found a subsector?
if (bspnum & NF_SUBSECTOR)
while (!(bspnum & NF_SUBSECTOR)) // Found a subsector?
{
if (bspnum == -1)
{
//*(gl_drawsubsector_p++) = 0;
HWR_Subsector(0);
}
else
{
//*(gl_drawsubsector_p++) = bspnum&(~NF_SUBSECTOR);
HWR_Subsector(bspnum&(~NF_SUBSECTOR));
}
return;
}
bsp = &nodes[bspnum];
// Decide which side the view point is on.
side = R_PointOnSide(viewx, viewy, bsp);
// BP: big hack for a test in lighning ref : 1249753487AB
hwbbox = bsp->bbox[side];
// Recursively divide front space.
HWR_RenderBSPNode(bsp->children[side]);
// Possibly divide back space.
if (HWR_CheckBBox(bsp->bbox[side^1]))
{
// Decide which side the view point is on.
side = R_PointOnSide(viewx, viewy, bsp);
// BP: big hack for a test in lighning ref : 1249753487AB
hwbbox = bsp->bbox[side^1];
HWR_RenderBSPNode(bsp->children[side^1]);
hwbbox = bsp->bbox[side];
// Recursively divide front space.
HWR_RenderBSPNode(bsp->children[side]);
// Possibly divide back space.
if (!HWR_CheckBBox(bsp->bbox[side^1]))
return;
bspnum = bsp->children[side^1];
}
HWR_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR);
}
// ==========================================================================