From: cloudwalk Date: Wed, 16 Dec 2020 19:19:57 +0000 (+0000) Subject: gl: Fix r_lockpvs behaving like r_lockvisibility. Minor refactoring X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=8b26f70d09928dacff04bd9d77fa5bfbe204b50a;p=xonotic%2Fdarkplaces.git gl: Fix r_lockpvs behaving like r_lockvisibility. Minor refactoring git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13064 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 439ff002..e348e3e9 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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) { diff --git a/gl_rsurf.c b/gl_rsurf.c index 6ac291c9..512b9491 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -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)