ref: gl: reorganize checks in R_CullSurface

This commit is contained in:
Alibek Omarov
2026-04-06 11:04:33 +05:00
parent 7b665b3763
commit 9d22827395
2 changed files with 7 additions and 5 deletions

View File

@@ -67,16 +67,15 @@ int R_CullSurface( const msurface_t *surf, const gl_frustum_t *frustum, uint cli
{
cl_entity_t *e = RI.currententity;
if( unlikely( !e || !surf || !surf->texinfo || !surf->texinfo->texture ))
if( surf->visframe != tr.framecount && e == CL_GetEntityByIndex( 0 ))
return CULL_VISFRAME;
if( unlikely( !surf->texinfo || !surf->texinfo->texture ))
return CULL_OTHER;
if( unlikely( r_nocull.value ))
return CULL_VISIBLE;
// world surfaces can be culled by vis frame too
if( e == CL_GetEntityByIndex( 0 ) && surf->visframe != tr.framecount )
return CULL_VISFRAME;
// only static ents can be culled by frustum
if( !R_StaticEntity( e ))
frustum = NULL;

View File

@@ -165,6 +165,9 @@ qboolean GL_FrustumCullSphere( const gl_frustum_t *out, const vec3_t center, flo
if( unlikely( r_nocull.value ))
return false;
if( !iClipFlags )
return false;
for( i = FRUSTUM_PLANES, bit = 1; i > 0; i--, bit <<= 1 )
{
const mplane_t *p = &out->planes[FRUSTUM_PLANES - i];