+ if (r_refdef.view.usecustompvs)
+ {
+ // clear the visible surface and leaf flags arrays
+ memset(r_refdef.viewcache.world_surfacevisible, 0, model->num_surfaces);
+ memset(r_refdef.viewcache.world_leafvisible, 0, model->brush.num_leafs);
+ r_refdef.viewcache.world_novis = false;
+
+ // simply cull each marked leaf to the frustum (view pyramid)
+ for (j = 0, leaf = model->brush.data_leafs;j < model->brush.num_leafs;j++, leaf++)
+ {
+ // if leaf is in current pvs and on the screen, mark its surfaces
+ if (CHECKPVSBIT(r_refdef.viewcache.world_pvsbits, leaf->clusterindex) && !R_CullBox(leaf->mins, leaf->maxs))
+ {
+ r_refdef.stats.world_leafs++;
+ r_refdef.viewcache.world_leafvisible[j] = true;
+ if (leaf->numleafsurfaces)
+ for (i = 0, mark = leaf->firstleafsurface;i < leaf->numleafsurfaces;i++, mark++)
+ r_refdef.viewcache.world_surfacevisible[*mark] = true;
+ }
+ }
+ return;
+ }
+