]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Somehow I bet this is done in an unacceptable way, but - blur the screen whilst under...
authorSamual <samual@xonotic.org>
Mon, 10 Jan 2011 00:12:03 +0000 (19:12 -0500)
committerSamual <samual@xonotic.org>
Mon, 10 Jan 2011 00:12:03 +0000 (19:12 -0500)
defaultXonotic.cfg
qcsrc/client/View.qc
qcsrc/client/autocvars.qh

index 72f43f6fd453e639938bd07b5420eb782d39725e..23b7c20436159cc9dd49d40e358a3739291e3e6c 100644 (file)
@@ -1424,7 +1424,10 @@ seta hud_showbinds_limit 2       "maximum number of bound keys to show for a command.
 
 seta hud_colorflash_alpha 0.5 "starting alpha of the color flash"
 
-seta hud_damage 0.55 "an improved version of gl_polyblend, draw an image instead when hurt"
+seta hud_damage 0.55 "an improved version of gl_polyblend for damage, draw an image or blur instead when hurt"
+seta hud_damage_blur 0 "Use postprocessing to blur the screen when you have taken damage. This can be paired with current hud damage or just used alone. Higher values = more blur"
+seta hud_damage_blur_alpha 0.5 "Amount of alpha to use when merging the blurred layers back into the render. Turning this up higher will remove bloom, so it's best to find a balance"
+seta hud_damage_image 1 "Enable the drawing of an image for damage. This allows you to disable the image if you want to only have damage blur"
 seta hud_damage_gentle_alpha_multiplier 0.10 "how much to multiply alpha of flash when using the cl_gentle version, it's much more opaque than the non-gentle version"
 seta hud_damage_gentle_color "1 0.7 1" "color of flash for cl_gentle version"
 seta hud_damage_color "1 0 0" "color of flash"
@@ -1437,6 +1440,22 @@ seta hud_damage_pain_threshold_lower_health 50 "at which health we start lowerin
 seta hud_damage_pain_threshold_pulsating_min 0.6 "minimum value when calculating the pulse: max(pulsating_min, fabs(sin(PI * time / period))"
 seta hud_damage_pain_threshold_pulsating_period 0.8 "one pulse every X seconds"
 
+seta hud_postprocessing 1 "enables the ability for effects such as hud_damage_blur and hud_contents to apply a postprocessing method upon the screen - enabling this disables manual editing of the postprocess cvars"
+seta hud_postprocessing_maxbluralpha 0.5 "maximum alpha which the blur postprocess can be"
+seta hud_postprocessing_maxblurradius 10 "maximum radius which the blur postprocess can be"
+
+seta hud_contents 1 "an improved version of gl_polyblend for liquids such as water/lava/slime, draw a filler or blur when inside the liquid"
+seta hud_contents_blur 0 "Use postprocessing to blur the screen when you are inside a liquid. Higher values = more blur"
+seta hud_contents_blur_alpha 1 "Amount of alpha to use when merging the blurred layers back into the render. Turning this up higher will remove bloom, so it's best to find a balance"
+seta hud_contents_factor 1 "factor at which to multiply the current faded value."
+seta hud_contents_fadetime 0.1 "factor of time for average alpha level to go to the actual content value"
+seta hud_contents_lava_alpha 0.7 "alpha of the lava color blend when inside it"
+seta hud_contents_lava_color "0.8 0.1 0" 
+seta hud_contents_slime_alpha 0.7 "alpha of the slime color blend when inside it"
+seta hud_contents_slime_color "0 0.5 0.2"
+seta hud_contents_water_alpha 0.5 "alpha of the water color blend when inside it"
+seta hud_contents_water_color "0 0.5 0.7"
+
 // scoreboard
 seta scoreboard_columns default
 seta scoreboard_border_thickness 1 "scoreboard border thickness"
index 704e58107f597a67ec33e3b201a816da196b09fc..934209143937b6134a3d0cf66885302d146906f7 100644 (file)
@@ -357,6 +357,8 @@ float myhealth_flash;
 
 vector myhealth_gentlergb;
 
+float contentavgalpha;
+
 void CSQC_UpdateView(float w, float h)
 {
        entity e;
@@ -666,8 +668,66 @@ void CSQC_UpdateView(float w, float h)
                        drawpic(reticle_pos, "gfx/reticle_nex", reticle_size, '1 1 1', f * autocvar_cl_reticle_item_nex, DRAWFLAG_NORMAL);
        }
 
-       // improved polyblend
+       // improved polyblend with post processing effects
        vector rgb;
+       vector damage_blurpostprocess;
+       vector content_blurpostprocess;
+       if(autocvar_hud_contents)
+       {
+               float contentalpha_temp, incontent, liquidalpha;
+               vector liquidcolor;
+               
+               switch(pointcontents(view_origin))
+               {
+                       case CONTENT_WATER:
+                               liquidalpha = autocvar_hud_contents_water_alpha;
+                               liquidcolor = stov(autocvar_hud_contents_water_color);
+                               incontent = 1;
+                               break;
+                               
+                       case CONTENT_LAVA:
+                               liquidalpha = autocvar_hud_contents_lava_alpha;
+                               liquidcolor = stov(autocvar_hud_contents_lava_color);
+                               incontent = 1;
+                               break;  
+                                                       
+                       case CONTENT_SLIME:
+                               liquidalpha = autocvar_hud_contents_slime_alpha;
+                               liquidcolor = stov(autocvar_hud_contents_slime_color);
+                               incontent = 1;
+                               break;
+                               
+                       default:
+                               liquidalpha = 0;
+                               liquidcolor = '0 0 0';
+                               incontent = 0;
+                               break;
+               }
+               
+               contentalpha_temp = bound(0, drawframetime / max(0.0001, autocvar_hud_contents_fadetime), 1);
+               contentavgalpha = contentavgalpha * (1 - contentalpha_temp) + incontent * contentalpha_temp;
+               //contentalpha_temp = contentavgalpha;
+               
+               if(incontent)
+                       drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, liquidcolor, contentavgalpha * liquidalpha, DRAWFLAG_NORMAL);
+               
+               if(autocvar_hud_postprocessing)
+               {
+                       if(autocvar_hud_contents_blur)
+                       {
+                               content_blurpostprocess_x = 1;
+                               content_blurpostprocess_y = contentavgalpha * autocvar_hud_contents_blur;
+                               content_blurpostprocess_z = contentavgalpha * autocvar_hud_contents_blur_alpha;
+                       }
+                       else
+                       {
+                               content_blurpostprocess_x = 0;
+                               content_blurpostprocess_y = 0;
+                               content_blurpostprocess_z = 0;
+                       }
+               }
+       }
+       
        if(autocvar_hud_damage)
        {
                float myhealth_flash_temp;
@@ -725,9 +785,42 @@ void CSQC_UpdateView(float w, float h)
 
                        drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
                }
-               else
+               else if(autocvar_hud_damage_image)
                        drawpic(reticle_pos, "gfx/blood", reticle_size, stov(autocvar_hud_damage_color), bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
+                       
+               if(autocvar_hud_postprocessing)
+               {
+                       if(autocvar_hud_damage_blur)
+                       {
+                               damage_blurpostprocess_x = 1;
+                               damage_blurpostprocess_y = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur;
+                               damage_blurpostprocess_z = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur_alpha;
+                       }
+                       else
+                       {
+                               damage_blurpostprocess_x = 0;
+                               damage_blurpostprocess_y = 0;
+                               damage_blurpostprocess_z = 0;
+                       }
+               }
+       }
+       
+       if(autocvar_hud_postprocessing)
+       { // lets apply the postprocess effects from the previous two functions if needed
+               if(damage_blurpostprocess_x || content_blurpostprocess_x)
+               {
+                       float blurradius = bound(0, damage_blurpostprocess_y + content_blurpostprocess_y, autocvar_hud_postprocessing_maxblurradius);
+                       float bluralpha = bound(0, damage_blurpostprocess_z + content_blurpostprocess_z, autocvar_hud_postprocessing_maxbluralpha);
+                       cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));
+                       cvar_set("r_glsl_postprocess_uservec1_enable", "1");
+               }
+               else
+               {
+                       cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
+                       cvar_set("r_glsl_postprocess_uservec1_enable", "0");
+               }
        }
+       
 
        // Draw the mouse cursor
        // NOTE: drawpic must happen after R_RenderScene for some reason
index 08ad7b9022d33fd90ce7b987254b1d5d7c01ad74..218ab85f49d613cc2cbb01ad8859772c5900ad01 100644 (file)
@@ -145,12 +145,26 @@ float autocvar_hud_configure_grid_alpha;
 float autocvar_hud_configure_grid_xsize;
 float autocvar_hud_configure_grid_ysize;
 float autocvar_hud_configure_teamcolorforced;
+float autocvar_hud_contents;
+float autocvar_hud_contents_blur;
+float autocvar_hud_contents_blur_alpha;
+float autocvar_hud_contents_factor;
+float autocvar_hud_contents_fadetime;
+float autocvar_hud_contents_lava_alpha;
+string autocvar_hud_contents_lava_color;
+float autocvar_hud_contents_slime_alpha;
+string autocvar_hud_contents_slime_color;
+float autocvar_hud_contents_water_alpha;
+string autocvar_hud_contents_water_color;
 float autocvar_hud_damage;
+float autocvar_hud_damage_blur;
+float autocvar_hud_damage_blur_alpha;
 string autocvar_hud_damage_color;
 float autocvar_hud_damage_factor;
 float autocvar_hud_damage_fade_rate;
 float autocvar_hud_damage_gentle_alpha_multiplier;
 string autocvar_hud_damage_gentle_color;
+float autocvar_hud_damage_image;
 float autocvar_hud_damage_maxalpha;
 float autocvar_hud_damage_pain_threshold;
 float autocvar_hud_damage_pain_threshold_lower;
@@ -242,6 +256,9 @@ var float autocvar_hud_panel_weapons_fade = 1;
 float autocvar_hud_panel_weapons_label;
 float autocvar_hud_panel_weapons_timeout;
 float autocvar_hud_panel_weapons_timeout_effect;
+float autocvar_hud_postprocessing;
+float autocvar_hud_postprocessing_maxbluralpha;
+float autocvar_hud_postprocessing_maxblurradius;
 float autocvar_hud_progressbar_alpha;
 float autocvar_hud_showbinds;
 float autocvar_hud_showbinds_limit;