]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Create a cvar which changes brightness when r_bloom is enabled. This is useful to...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 6 Apr 2012 18:20:27 +0000 (18:20 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 6 Apr 2012 18:19:55 +0000 (20:19 +0200)
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11788 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=5c14d50381283d88583257c848da5f38d8a6fd26

gl_rmain.c

index 5c76df44029479e13d88f614df347edc8ba076a1..52fd013a71e3bd023f6a9eba0bc4acc5d4c3a3b5 100644 (file)
@@ -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