From: vortex Date: Sun, 14 Feb 2010 23:10:49 +0000 (+0000) Subject: r_shadows_shadowmapscale cvar which as a multiple to r_shadow_shadowmapping_precision... X-Git-Tag: xonotic-v0.1.0preview~686 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=86c35fd4e16f893c418828d7cf510d09f4e4b215;p=xonotic%2Fdarkplaces.git r_shadows_shadowmapscale cvar which as a multiple to r_shadow_shadowmapping_precision for fake shadows. Useful since otho shadowmaps likes high resolution (to get rid of pixel bleeding effect) and quite cheap. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9956 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=862719557ab3fed44f0671bbd639d6c5440b9e70 --- diff --git a/gl_rmain.c b/gl_rmain.c index 86ff11ea..c2f1a1cf 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -92,6 +92,7 @@ cvar_t r_shadows_throwdirection = {CVAR_SAVE, "r_shadows_throwdirection", "0 0 - cvar_t r_shadows_drawafterrtlighting = {CVAR_SAVE, "r_shadows_drawafterrtlighting", "0", "draw fake shadows AFTER realtime lightning is drawn. May be useful for simulating fast sunlight on large outdoor maps with only one noshadow rtlight. The price is less realistic appearance of dynamic light shadows."}; cvar_t r_shadows_castfrombmodels = {CVAR_SAVE, "r_shadows_castfrombmodels", "0", "do cast shadows from bmodels"}; cvar_t r_shadows_focus = {CVAR_SAVE, "r_shadows_focus", "0 0 0", "offset the shadowed area focus"}; +cvar_t r_shadows_shadowmapscale = {CVAR_SAVE, "r_shadows_shadowmapscale", "1", "increases shadowmap quality (multiply global shadowmap precision) for fake shadows. Needs shadowmapping ON."}; cvar_t r_q1bsp_skymasking = {0, "r_q1bsp_skymasking", "1", "allows sky polygons in quake1 maps to obscure other geometry"}; cvar_t r_polygonoffset_submodel_factor = {0, "r_polygonoffset_submodel_factor", "0", "biases depth values of world submodels such as doors, to prevent z-fighting artifacts in Quake maps"}; cvar_t r_polygonoffset_submodel_offset = {0, "r_polygonoffset_submodel_offset", "14", "biases depth values of world submodels such as doors, to prevent z-fighting artifacts in Quake maps"}; @@ -6253,6 +6254,7 @@ void GL_Main_Init(void) Cvar_RegisterVariable(&r_shadows_throwdistance); Cvar_RegisterVariable(&r_shadows_throwdirection); Cvar_RegisterVariable(&r_shadows_focus); + Cvar_RegisterVariable(&r_shadows_shadowmapscale); Cvar_RegisterVariable(&r_q1bsp_skymasking); Cvar_RegisterVariable(&r_polygonoffset_submodel_factor); Cvar_RegisterVariable(&r_polygonoffset_submodel_offset); diff --git a/r_shadow.c b/r_shadow.c index 6410fec5..bcc699cd 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -4203,6 +4203,7 @@ extern cvar_t r_shadows_castfrombmodels; extern cvar_t r_shadows_throwdistance; extern cvar_t r_shadows_throwdirection; extern cvar_t r_shadows_focus; +extern cvar_t r_shadows_shadowmapscale; void R_Shadow_PrepareModelShadows(void) { @@ -4232,7 +4233,7 @@ void R_Shadow_PrepareModelShadows(void) } size = 2*r_shadow_shadowmapmaxsize; - scale = r_shadow_shadowmapping_precision.value; + scale = r_shadow_shadowmapping_precision.value * r_shadows_shadowmapscale.value; radius = 0.5f * size / scale; Math_atov(r_shadows_throwdirection.string, shadowdir); @@ -4326,7 +4327,7 @@ void R_DrawModelShadowMaps(void) } size = 2*r_shadow_shadowmapmaxsize; - scale = r_shadow_shadowmapping_precision.value / size; + scale = (r_shadow_shadowmapping_precision.value * r_shadows_shadowmapscale.value) / size; radius = 0.5f / scale; nearclip = -r_shadows_throwdistance.value; farclip = r_shadows_throwdistance.value;