From: divverent Date: Mon, 1 Jun 2015 09:40:54 +0000 (+0000) Subject: Add a cvar: r_water_cameraentitiesonly. X-Git-Tag: xonotic-v0.8.1~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=200d1d9cb52e8a7e6e4cbd470b620d91b7b9637a;p=xonotic%2Fdarkplaces.git Add a cvar: r_water_cameraentitiesonly. If set, water-style effects are only allowed when CL_VM_TransformView would be called (in other words, for CSQC-generated cameras/portals). git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12209 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=6db2dfc6943b5e8eb32e27fc0e74f5d994213a03 --- diff --git a/gl_rmain.c b/gl_rmain.c index 9fe3087c..3d9686e0 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -184,6 +184,7 @@ cvar_t r_glsl_postprocess_uservec3_enable = {CVAR_SAVE, "r_glsl_postprocess_user cvar_t r_glsl_postprocess_uservec4_enable = {CVAR_SAVE, "r_glsl_postprocess_uservec4_enable", "1", "enables postprocessing uservec4 usage, creates USERVEC1 define (only useful if default.glsl has been customized)"}; cvar_t r_water = {CVAR_SAVE, "r_water", "0", "whether to use reflections and refraction on water surfaces (note: r_wateralpha must be set below 1)"}; +cvar_t r_water_cameraentitiesonly = {CVAR_SAVE, "r_water_cameraentitiesonly", "0", "whether to only show QC-defined reflections/refractions (typically used for camera- or portal-like effects)"}; cvar_t r_water_clippingplanebias = {CVAR_SAVE, "r_water_clippingplanebias", "1", "a rather technical setting which avoids black pixels around water edges"}; cvar_t r_water_resolutionmultiplier = {CVAR_SAVE, "r_water_resolutionmultiplier", "0.5", "multiplier for screen resolution when rendering refracted/reflected scenes, 1 is full quality, lower values are faster"}; cvar_t r_water_refractdistort = {CVAR_SAVE, "r_water_refractdistort", "0.01", "how much water refractions shimmer"}; @@ -4375,6 +4376,7 @@ void GL_Main_Init(void) Cvar_RegisterVariable(&r_celoutlines); Cvar_RegisterVariable(&r_water); + Cvar_RegisterVariable(&r_water_cameraentitiesonly); Cvar_RegisterVariable(&r_water_resolutionmultiplier); Cvar_RegisterVariable(&r_water_clippingplanebias); Cvar_RegisterVariable(&r_water_refractdistort); @@ -6040,7 +6042,7 @@ void R_Water_AddWaterPlane(msurface_t *surface, int entno) if(!(p->materialflags & MATERIALFLAG_CAMERA)) { // merge this surface's PVS into the waterplane - if (p->materialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION | MATERIALFLAG_REFLECTION | MATERIALFLAG_CAMERA) && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brush.FatPVS + if (p->materialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION | MATERIALFLAG_REFLECTION) && r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brush.FatPVS && r_refdef.scene.worldmodel->brush.PointInLeaf && r_refdef.scene.worldmodel->brush.PointInLeaf(r_refdef.scene.worldmodel, center)->clusterindex >= 0) { r_refdef.scene.worldmodel->brush.FatPVS(r_refdef.scene.worldmodel, center, 2, p->pvsbits, sizeof(p->pvsbits), p->pvsvalid); @@ -6092,6 +6094,8 @@ static void R_Water_ProcessPlanes(int fbo, rtexture_t *depthtexture, rtexture_t // make sure enough textures are allocated for (planeindex = 0, p = r_fb.water.waterplanes;planeindex < r_fb.water.numwaterplanes;planeindex++, p++) { + if (r_water_cameraentitiesonly.value != 0 && !p->camera_entity) + continue; if (p->materialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION)) { if (!p->texture_refraction) @@ -6147,6 +6151,8 @@ static void R_Water_ProcessPlanes(int fbo, rtexture_t *depthtexture, rtexture_t r_fb.water.renderingscene = true; for (planeindex = 0, p = r_fb.water.waterplanes;planeindex < r_fb.water.numwaterplanes;planeindex++, p++) { + if (r_water_cameraentitiesonly.value != 0 && !p->camera_entity) + continue; if (p->materialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFLECTION)) { r_refdef.view = myview;