R_CullSurfaces: small optimization. Avoid doing (s->visframe == r_visframecount) test on all world surfaces, instead, use the surfaces in the world texture chains, which already passed that test in R_MarkSurfaces.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@991 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Eric Wasylishen 2014-09-08 04:31:26 +00:00
parent 093ecad80b
commit d8a33d73cc
1 changed files with 10 additions and 3 deletions

View File

@ -203,14 +203,21 @@ void R_CullSurfaces (void)
{
msurface_t *s;
int i;
texture_t *t;
if (!r_drawworld_cheatsafe)
return;
s = &cl.worldmodel->surfaces[cl.worldmodel->firstmodelsurface];
for (i=0 ; i<cl.worldmodel->nummodelsurfaces ; i++, s++)
// ericw -- instead of testing (s->visframe == r_visframecount) on all world
// surfaces, use the chained surfaces, which is exactly the same set of sufaces
for (i=0 ; i<cl.worldmodel->numtextures ; i++)
{
if (s->visframe == r_visframecount)
t = cl.worldmodel->textures[i];
if (!t || !t->texturechains[chain_world])
continue;
for (s = t->texturechains[chain_world]; s; s = s->texturechain)
{
if (R_CullBox(s->mins, s->maxs) || R_BackFaceCull (s))
s->culled = true;