From: havoc Date: Tue, 1 May 2018 02:48:46 +0000 (+0000) Subject: Generate a pvs for refraction renders just like for reflection renders, this fixes... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=086c6c4f1ccdafa4e305eb0903f5570361594c20;p=xonotic%2Fdarkplaces.git Generate a pvs for refraction renders just like for reflection renders, this fixes a water rendering issue in the Doombringer map duel2.bsp where certain leafs did not include the necessary pvs data (or something was wrong with how the renderer used the existing vis data). In light of the above, allow r_wateralpha when r_water is used, even if the bsp is not watervised - this works for all non-recursive cases (so the elder hall water pool in start.bsp is still broken). git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12411 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 0970fdb7..b32206dc 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -4982,6 +4982,7 @@ static void R_Water_ProcessPlanes(int fbo, rtexture_t *depthtexture, rtexture_t // reverse the cullface settings for this render r_refdef.view.cullface_front = GL_FRONT; r_refdef.view.cullface_back = GL_BACK; + // combined pvs (based on what can be seen from each surface center) if (r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brush.num_pvsclusterbytes) { r_refdef.view.usecustompvs = true; @@ -5029,6 +5030,16 @@ static void R_Water_ProcessPlanes(int fbo, rtexture_t *depthtexture, rtexture_t } } + // combined pvs (based on what can be seen from each surface center) + if (r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brush.num_pvsclusterbytes) + { + r_refdef.view.usecustompvs = true; + if (p->pvsvalid) + memcpy(r_refdef.viewcache.world_pvsbits, p->pvsbits, r_refdef.scene.worldmodel->brush.num_pvsclusterbytes); + else + memset(r_refdef.viewcache.world_pvsbits, 0xFF, r_refdef.scene.worldmodel->brush.num_pvsclusterbytes); + } + r_fb.water.hideplayer = ((r_water_hideplayer.integer >= 1) && !chase_active.integer); r_refdef.view.clipplane = p->plane; @@ -6782,7 +6793,7 @@ texture_t *R_GetCurrentTexture(texture_t *t) t->currentmaterialflags = t->basematerialflags; t->currentalpha = rsurface.entity->alpha * t->basealpha; - if (t->basematerialflags & MATERIALFLAG_WATERALPHA && (model->brush.supportwateralpha || r_novis.integer || r_trippy.integer)) + if (t->basematerialflags & MATERIALFLAG_WATERALPHA && (model->brush.supportwateralpha || r_water.integer || r_novis.integer || r_trippy.integer)) t->currentalpha *= r_wateralpha.value; if(t->basematerialflags & MATERIALFLAG_WATERSHADER && r_fb.water.enabled && !r_refdef.view.isoverlay) t->currentmaterialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW; // we apply wateralpha later