]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
gl: Fix r_lockpvs behaving like r_lockvisibility. Minor refactoring
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 16 Dec 2020 19:19:57 +0000 (19:19 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 16 Dec 2020 19:19:57 +0000 (19:19 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13064 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
gl_rsurf.c

index 439ff002d3beedebcf5353ca2c744940c601ff1f..e348e3e9427b4229ed84b7b51bf90f563cec5a16 100644 (file)
@@ -4256,7 +4256,7 @@ static void R_View_SetFrustum(const int *scissor)
        int i;
        double fpx = +1, fnx = -1, fpy = +1, fny = -1;
        vec3_t forward, left, up, origin, v;
-       if(r_lockvisibility.integer || r_lockpvs.integer)
+       if(r_lockvisibility.integer)
                return;
        if(scissor)
        {
index 6ac291c910f6385a9c7e19ecad3109de85fca207..512b94919a0b975848bcc8c2f51676578c340463 100644 (file)
@@ -447,13 +447,18 @@ void R_View_WorldVisibility(qbool forcenovis)
        if (!model)
                return;
 
-       if (r_refdef.view.usecustompvs)
-       {
-               // clear the visible surface and leaf flags arrays
-               memset(r_refdef.viewcache.world_surfacevisible, 0, model->num_surfaces);
+       if (r_lockvisibility.integer)
+               return;
+
+       // clear the visible surface and leaf flags arrays
+       memset(r_refdef.viewcache.world_surfacevisible, 0, model->num_surfaces);
+       if(!r_lockpvs.integer)
                memset(r_refdef.viewcache.world_leafvisible, 0, model->brush.num_leafs);
-               r_refdef.viewcache.world_novis = false;
 
+       r_refdef.viewcache.world_novis = false;
+
+       if (r_refdef.view.usecustompvs)
+       {
                // 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++)
                {
@@ -467,23 +472,14 @@ void R_View_WorldVisibility(qbool forcenovis)
                                                r_refdef.viewcache.world_surfacevisible[*mark] = true;
                        }
                }
-               R_View_WorldVisibility_CullSurfaces();
-               return;
        }
-
-       // if possible find the leaf the view origin is in
-       viewleaf = model->brush.PointInLeaf ? model->brush.PointInLeaf(model, r_refdef.view.origin) : NULL;
-       // if possible fetch the visible cluster bits
-       if (!r_lockpvs.integer && model->brush.FatPVS)
-               model->brush.FatPVS(model, r_refdef.view.origin, 2, r_refdef.viewcache.world_pvsbits, (r_refdef.viewcache.world_numclusters+7)>>3, false);
-
-       if (!r_lockvisibility.integer)
+       else
        {
-               // 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;
+               // if possible find the leaf the view origin is in
+               viewleaf = model->brush.PointInLeaf ? model->brush.PointInLeaf(model, r_refdef.view.origin) : NULL;
+               // if possible fetch the visible cluster bits
+               if (!r_lockpvs.integer && model->brush.FatPVS)
+                       model->brush.FatPVS(model, r_refdef.view.origin, 2, r_refdef.viewcache.world_pvsbits, (r_refdef.viewcache.world_numclusters+7)>>3, false);
 
                // if floating around in the void (no pvs data available, and no
                // portals available), simply use all on-screen leafs.
@@ -595,8 +591,10 @@ void R_View_WorldVisibility(qbool forcenovis)
                                }
                        }
                }
-               R_View_WorldVisibility_CullSurfaces();
        }
+
+       // Cull the rest
+       R_View_WorldVisibility_CullSurfaces();
 }
 
 void R_Mod_DrawSky(entity_render_t *ent)