//RenderBSPNode
//Renders all subsectors below a given node,
//traversing subtree recursively.
//Just call with BSP root.
void R_RenderBSPNode (int bspnum)
{
node_t* |
bsp; |
int |
side; |
// Found a |
subsector? |
if (bspnum |
& NF_SUBSECTOR) |
{ |
|
if (bspnum == -1) R_Subsector (0);
else
R_Subsector (bspnum&(~NF_SUBSECTOR)); return;
}
bsp = &nodes[bspnum];
//Decide which side the view point is on. side = R_PointOnSide (viewx, viewy, bsp);
//Recursively divide front space.
R_RenderBSPNode (bsp->children[side]);
// Possibly divide back space.
if (R_CheckBBox (bsp->bbox[side^1])) R_RenderBSPNode (bsp->children[side^1]);
}
10.2r bsp.h
// Emacs style mode select -*- C++ -*- //-----------------------------------------------------------------------------
//
//$Id:$
//Copyright (C) 1993-1996 by id Software, Inc.
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//DESCRIPTION:
//Refresh module, BSP traversal and handling.
//-----------------------------------------------------------------------------
#ifndef __R_BSP__ #define __R_BSP__
#ifdef __GNUG__ #pragma interface #endif