Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/engine/renderer/tr_bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2980,10 +2980,6 @@ static void R_LoadNodesAndLeafs( lump_t *nodeLump, lump_t *leafLump )
s_worldData.numnodes = numNodes + numLeafs;
s_worldData.numDecisionNodes = numNodes;

// ydnar: skybox optimization
s_worldData.numSkyNodes = 0;
s_worldData.skyNodes = (bspNode_t**) ri.Hunk_Alloc( WORLD_MAX_SKY_NODES * sizeof( *s_worldData.skyNodes ), ha_pref::h_low );

// load nodes
for ( i = 0; i < numNodes; i++, in++, out++ )
{
Expand Down
6 changes: 0 additions & 6 deletions src/engine/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1890,9 +1890,6 @@ enum class ssaoMode {
vec3_t maxs;
};

// ydnar: optimization
#define WORLD_MAX_SKY_NODES 32

struct world_t
{
char name[ MAX_QPATH ]; // ie: maps/tim_dm2.bsp
Expand All @@ -1913,9 +1910,6 @@ enum class ssaoMode {
int numDecisionNodes;
bspNode_t *nodes;

int numSkyNodes;
bspNode_t **skyNodes; // ydnar: don't walk the entire bsp when rendering sky

int numPortals;
AABB *portals;

Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ void RE_RenderScene( const refdef_t *fd )
// will force a reset of the visible leafs even if the view hasn't moved
tr.refdef.areamaskModified = false;

if ( !( tr.refdef.rdflags & RDF_NOWORLDMODEL ) && !( ( tr.refdef.rdflags & RDF_SKYBOXPORTAL ) && tr.world->numSkyNodes > 0 ) )
if ( !( tr.refdef.rdflags & RDF_NOWORLDMODEL ) )
{
int areaDiff;
int i;
Expand Down
40 changes: 6 additions & 34 deletions src/engine/renderer/tr_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,20 +794,6 @@ static void R_MarkLeaves()
continue;
}

// ydnar: don't want to walk the entire bsp to add skybox surfaces
if ( tr.refdef.rdflags & RDF_SKYBOXPORTAL )
{
// this only happens once, as game/cgame know the origin of the skybox
// this also means the skybox portal cannot move, as this list is calculated once and never again
if ( tr.world->numSkyNodes < WORLD_MAX_SKY_NODES )
{
tr.world->skyNodes[ tr.world->numSkyNodes++ ] = leaf;
}

R_AddLeafSurfaces( leaf, FRUSTUM_CLIPALL );
continue;
}

parent = leaf;

do
Expand Down Expand Up @@ -846,28 +832,14 @@ void R_AddWorldSurfaces()
// clear out the visible min/max
ClearBounds( tr.viewParms.visBounds[ 0 ], tr.viewParms.visBounds[ 1 ] );

// render sky or world?
if ( tr.refdef.rdflags & RDF_SKYBOXPORTAL && tr.world->numSkyNodes > 0 )
{
int i;
bspNode_t **node;
// determine which leaves are in the PVS / areamask
R_MarkLeaves();

for ( i = 0, node = tr.world->skyNodes; i < tr.world->numSkyNodes; i++, node++ )
{
R_AddLeafSurfaces( *node, FRUSTUM_CLIPALL );
}
}
else
{
// determine which leaves are in the PVS / areamask
R_MarkLeaves();

// clear traversal list
backEndData[ tr.smpFrame ]->traversalLength = 0;
// clear traversal list
backEndData[ tr.smpFrame ]->traversalLength = 0;

// update visbounds and add surfaces that weren't cached with VBOs
R_RecursiveWorldNode( tr.world->nodes, FRUSTUM_CLIPALL );
}
// update visbounds and add surfaces that weren't cached with VBOs
R_RecursiveWorldNode( tr.world->nodes, FRUSTUM_CLIPALL );
}

/*
Expand Down