#5866: Fix surface culling through portals, and use the correct number of frustum planes.

This commit is contained in:
SmileTheory 2013-01-09 18:30:12 -08:00
parent daa9619913
commit ed87774a77
4 changed files with 32 additions and 23 deletions

View file

@ -119,11 +119,6 @@ static qboolean R_CullSurface( msurface_t *surf ) {
{
return qtrue;
}
if ( sphereCull == CULL_IN )
{
return qfalse;
}
}
if (surf->cullinfo.type & CULLINFO_BOX)
@ -140,11 +135,6 @@ static qboolean R_CullSurface( msurface_t *surf ) {
{
return qtrue;
}
if ( boxCull == CULL_IN )
{
return qfalse;
}
}
return qfalse;
@ -782,6 +772,8 @@ R_AddWorldSurfaces
=============
*/
void R_AddWorldSurfaces (void) {
int planeBits, dlightBits, pshadowBits;
if ( !r_drawworld->integer ) {
return;
}
@ -809,19 +801,26 @@ void R_AddWorldSurfaces (void) {
tr.refdef.num_pshadows = 32 ;
}
planeBits = (tr.viewParms.flags & VPF_FARPLANEFRUSTUM) ? 31 : 15;
if ( tr.viewParms.flags & VPF_DEPTHSHADOW )
{
R_RecursiveWorldNode( tr.world->nodes, 31, 0, 0);
dlightBits = 0;
pshadowBits = 0;
}
else if ( !(tr.viewParms.flags & VPF_SHADOWMAP) )
{
R_RecursiveWorldNode( tr.world->nodes, 15, ( 1 << tr.refdef.num_dlights ) - 1, ( 1 << tr.refdef.num_pshadows ) - 1 );
dlightBits = ( 1 << tr.refdef.num_dlights ) - 1;
pshadowBits = ( 1 << tr.refdef.num_pshadows ) - 1;
}
else
{
R_RecursiveWorldNode( tr.world->nodes, 31, ( 1 << tr.refdef.num_dlights ) - 1, 0 );
dlightBits = ( 1 << tr.refdef.num_dlights ) - 1;
pshadowBits = 0;
}
R_RecursiveWorldNode( tr.world->nodes, planeBits, dlightBits, pshadowBits);
// now add all the potentially visible surfaces
// also mask invisible dlights for next frame
{