]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Re-merge Samual's HUD post processing effects. Including a new one, using the sharpen...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 26 Feb 2011 01:39:55 +0000 (03:39 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 26 Feb 2011 01:39:55 +0000 (03:39 +0200)
defaultXonotic.cfg
qcsrc/client/View.qc
qcsrc/client/autocvars.qh

index d038dc523c1df5762333a6c82066c39f789511e4..3ff6fe2b7c31221bf9236656cfdb7b8d5f0d6a0a 100644 (file)
@@ -875,6 +875,7 @@ set g_multijump_add 0       "0 = make the current z velocity equal to jumpvelocity, 1
 set g_multijump_speed -999999  "Minimum vertical speed a player must have in order to jump again"
 
 // effects
+r_glsl_postprocess 1
 r_picmipsprites 0 // Xonotic uses sprites that should never be picmipped (team mate, typing, waypoints)
 r_picmipworld 1
 gl_picmip_world 0
@@ -1433,6 +1434,8 @@ 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 for damage, draw an image instead when hurt"
+seta hud_damage_blur 10 "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_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"
@@ -1444,6 +1447,11 @@ seta hud_damage_pain_threshold_lower 1.25 "how much we lower pain_threshold with
 seta hud_damage_pain_threshold_lower_health 50 "at which health we start lowering pain_threshold"
 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_powerup 0.5 "power of the sharpen effect when owning the shield or strength powerups"
+
+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 when inside the liquid"
 seta hud_contents_factor 1 "factor at which to multiply the current faded value."
index 7270a9cf19e0882a9f41bf26434ff325dcb33f9f..de8be6af898a08c97f765293ae01ebfd9b75ae62 100644 (file)
@@ -366,6 +366,8 @@ vector myhealth_gentlergb;
 float contentavgalpha, liquidalpha_prev;
 vector liquidcolor_prev;
 
+vector damage_blurpostprocess, content_blurpostprocess;
+
 void CSQC_UpdateView(float w, float h)
 {
        entity e;
@@ -785,6 +787,73 @@ void CSQC_UpdateView(float w, float h)
                }
                else
                        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");
+               }
+
+               if(autocvar_hud_powerup)
+               {
+                       float sharpen_intensity;
+                       if (getstatf(STAT_STRENGTH_FINISHED) - time > 0)
+                               sharpen_intensity += (getstatf(STAT_STRENGTH_FINISHED) - time);
+                       if (getstatf(STAT_INVINCIBLE_FINISHED) - time > 0)
+                               sharpen_intensity += (getstatf(STAT_INVINCIBLE_FINISHED) - time);
+                       sharpen_intensity = bound(0, sharpen_intensity, 5); // powerup warning time is 5 seconds, so fade the effect from there
+
+                       if(sharpen_intensity > 0)
+                       {
+                               cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(-sharpen_intensity * cvar("hud_powerup")), " 0 0"));
+                               cvar_set("r_glsl_postprocess_uservec2_enable", "1");
+                       }
+                       else
+                       {
+                               cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");
+                               cvar_set("r_glsl_postprocess_uservec2_enable", "0");
+                       }
+               }
+       }
+
+       if not(autocvar_hud_damage && autocvar_hud_postprocessing)
+       {
+               // don't allow blur to get stuck on if we disable the cvar while damaged
+               cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
+               cvar_set("r_glsl_postprocess_uservec1_enable", "0");
+       }
+       if not(autocvar_hud_powerup && autocvar_hud_postprocessing)
+       {
+               // don't allow sharpen to get stuck on if we disable the cvar while powered up
+               cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");
+               cvar_set("r_glsl_postprocess_uservec2_enable", "0");
        }
 
        // Draw the mouse cursor
index 0cf1e4bf8dc8d5f76652fa0141d269ce66ff358f..cb28f21868ebc47e60d1a88b86391d219eff4711 100644 (file)
@@ -159,6 +159,8 @@ 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;
@@ -170,6 +172,10 @@ float autocvar_hud_damage_pain_threshold_lower;
 float autocvar_hud_damage_pain_threshold_lower_health;
 float autocvar_hud_damage_pain_threshold_pulsating_min;
 float autocvar_hud_damage_pain_threshold_pulsating_period;
+float autocvar_hud_powerup;
+float autocvar_hud_postprocessing;
+float autocvar_hud_postprocessing_maxbluralpha;
+float autocvar_hud_postprocessing_maxblurradius;
 string autocvar_hud_dock;
 float autocvar_hud_dock_alpha;
 string autocvar_hud_dock_color;