From: divverent Date: Fri, 6 Apr 2012 18:20:27 +0000 (+0000) Subject: Create a cvar which changes brightness when r_bloom is enabled. This is useful to... X-Git-Tag: xonotic-v0.7.0~170 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=18497d6ae243ab258fdfb6078d90e64fe2725203;p=xonotic%2Fdarkplaces.git Create a cvar which changes brightness when r_bloom is enabled. This is useful to tweak overall scene brightness when bloom is on, so that it matches the same brightness and the over-brightening caused by bloom can be somewhat canceled. From: MirceaKitsune git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11788 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=5c14d50381283d88583257c848da5f38d8a6fd26 --- diff --git a/gl_rmain.c b/gl_rmain.c index 5c76df44..52fd013a 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -203,6 +203,7 @@ cvar_t r_bloom_blur = {CVAR_SAVE, "r_bloom_blur", "4", "how large the glow is"}; cvar_t r_bloom_resolution = {CVAR_SAVE, "r_bloom_resolution", "320", "what resolution to perform the bloom effect at (independent of screen resolution)"}; cvar_t r_bloom_colorexponent = {CVAR_SAVE, "r_bloom_colorexponent", "1", "how exaggerated the glow is"}; cvar_t r_bloom_colorsubtract = {CVAR_SAVE, "r_bloom_colorsubtract", "0.125", "reduces bloom colors by a certain amount"}; +cvar_t r_bloom_scenebrightness = {CVAR_SAVE, "r_bloom_scenebrightness", "1", "global rendering brightness when bloom is enabled"}; cvar_t r_hdr_scenebrightness = {CVAR_SAVE, "r_hdr_scenebrightness", "1", "global rendering brightness"}; cvar_t r_hdr_glowintensity = {CVAR_SAVE, "r_hdr_glowintensity", "1", "how bright light emitting textures should appear"}; @@ -4297,6 +4298,7 @@ void GL_Main_Init(void) Cvar_RegisterVariable(&r_bloom_resolution); Cvar_RegisterVariable(&r_bloom_colorexponent); Cvar_RegisterVariable(&r_bloom_colorsubtract); + Cvar_RegisterVariable(&r_bloom_scenebrightness); Cvar_RegisterVariable(&r_hdr_scenebrightness); Cvar_RegisterVariable(&r_hdr_glowintensity); Cvar_RegisterVariable(&r_hdr_irisadaptation); @@ -6908,6 +6910,10 @@ void R_RenderView(void) r_refdef.view.colorscale = r_hdr_scenebrightness.value * r_hdr_irisadaptation_value.value; + // apply bloom brightness offset + if(r_bloom.integer) + r_refdef.view.colorscale *= r_bloom_scenebrightness.value; + if(vid_sRGB.integer && vid_sRGB_fallback.integer && !vid.sRGB3D) // in sRGB fallback, behave similar to true sRGB: convert this // value from linear to sRGB