]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into mirceakitsune/hud_postprocessing
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 29 May 2011 15:38:01 +0000 (18:38 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 29 May 2011 15:38:01 +0000 (18:38 +0300)
defaultXonotic.cfg
effects-high.cfg
effects-low.cfg
effects-med.cfg
effects-normal.cfg
effects-omg.cfg
effects-ultimate.cfg
effects-ultra.cfg
qcsrc/client/View.qc
qcsrc/client/autocvars.qh
qcsrc/menu/xonotic/dialog_settings_effects.c

index 29d71ce9bde267daff4362d1d7d19607fbbadd1e..2ef5294f8ebccb5b9fadfd510ef941a8a6f79f6f 100644 (file)
@@ -281,7 +281,7 @@ cl_rollangle 0 // amount of view tilt when strafing, default is 2.0
 v_kicktime 0 // how long damage kicks of the view last, default is 0 seconds
 gl_polyblend 0 // whether to use screen tints, this has now been replaced by a better system in CSQC
 r_motionblur 0 // motion blur value, default is 0
-r_damageblur 0 // motion blur when damaged, default is 0
+r_damageblur 0 // motion blur when damaged, default is 0 (removed in Xonotic)
 
 r_bloom_blur 8
 r_bloom_brighten 3
@@ -898,6 +898,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
@@ -1471,6 +1472,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"
@@ -1483,7 +1486,15 @@ 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_powerup 0 "power of the sharpen effect when owning the shield or strength powerups, default is 0.5"
+
+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 "maximum alpha which the blur postprocess can be, default is 0.5"
+seta hud_postprocessing_maxblurradius 8 "maximum radius which the blur postprocess can be, default is 8"
+
 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_blur 10 "Use postprocessing to blur the screen when you are inside a liquid. Higher values = more blur"
+seta hud_contents_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_contents_factor 1 "factor at which to multiply the current faded value."
 seta hud_contents_fadeintime 0.02 "factor of time it takes for the alpha level to reach normal value when entering the liquid"
 seta hud_contents_fadeouttime 0.1 "factor of time it takes for the alpha level to reach normal value when leaving the liquid"
index e4d9632bcb458ec751958fe75220fe5da22a060e..664fca7ad3aa2b8e51e595a3e0e0f17bd5f30824 100644 (file)
@@ -8,7 +8,8 @@ mod_q3bsp_nolightmaps 0
 r_bloom 1
 r_coronas 1
 r_coronas_occlusionquery 1
-r_damageblur 0.4
+hud_postprocessing_maxbluralpha 0.5
+hud_powerup 0
 r_depthfirst 2
 r_drawdecals_drawdistance 500
 r_drawparticles_drawdistance 2000
index 0c3fef95b8cd4524e1052a0d23444a01a93fe9e2..769ca51217b5a36b2d5691f34ca3bf8fbe5fb6b7 100644 (file)
@@ -8,7 +8,8 @@ mod_q3bsp_nolightmaps 1
 r_bloom 0
 r_coronas 1
 r_coronas_occlusionquery 0
-r_damageblur 0
+hud_postprocessing_maxbluralpha 0
+hud_powerup 0
 r_depthfirst 0
 r_drawdecals_drawdistance 200
 r_drawparticles_drawdistance 500
index 5b9ea85f39f48e75ee90ce96188460fe7655b629..a6e5e7d0bd76b1f829cfa6761117040958c602bc 100644 (file)
@@ -8,7 +8,8 @@ mod_q3bsp_nolightmaps 0
 r_bloom 0
 r_coronas 1
 r_coronas_occlusionquery 0
-r_damageblur 0
+hud_postprocessing_maxbluralpha 0
+hud_powerup 0
 r_depthfirst 0
 r_drawdecals_drawdistance 300
 r_drawparticles_drawdistance 1000
index 1ee62d057729f09d4eb04be9082c675c1cfdeff8..dbad238261bf234989f3c1fc7fc6cc383daea6ee 100644 (file)
@@ -8,7 +8,8 @@ mod_q3bsp_nolightmaps 0
 r_bloom 0
 r_coronas 1
 r_coronas_occlusionquery 0
-r_damageblur 0
+hud_postprocessing_maxbluralpha 0
+hud_powerup 0
 r_depthfirst 1
 r_drawdecals_drawdistance 300
 r_drawparticles_drawdistance 1000
index ffd5af713e2fae60aa7942b7a4e1a017a6d0018b..6e6a1dcbbe96abc8b91f13090016ce4c40fec1b0 100644 (file)
@@ -8,7 +8,8 @@ mod_q3bsp_nolightmaps 1
 r_bloom 0
 r_coronas 1
 r_coronas_occlusionquery 0
-r_damageblur 0
+hud_postprocessing_maxbluralpha 0.5
+hud_powerup 0.5
 r_depthfirst 0
 r_drawdecals_drawdistance 100
 r_drawparticles_drawdistance 250
index e7a2efb3f1a0c368448853ae2ae779b037f24317..d6e501892b4fb334dc40a354e5b3d00888475e77 100644 (file)
@@ -8,7 +8,8 @@ mod_q3bsp_nolightmaps 0
 r_bloom 1
 r_coronas 1
 r_coronas_occlusionquery 1
-r_damageblur 0.4
+hud_postprocessing_maxbluralpha 0.5
+hud_powerup 0.5
 r_depthfirst 2
 r_drawdecals_drawdistance 500
 r_drawparticles_drawdistance 2000
index 218565408d372a4d3647ab023060e95b42d51575..47949e551b06203da8447f0425a42023c00eb50e 100644 (file)
@@ -8,7 +8,8 @@ mod_q3bsp_nolightmaps 0
 r_bloom 1
 r_coronas 1
 r_coronas_occlusionquery 1
-r_damageblur 0.4
+hud_postprocessing_maxbluralpha 0.5
+hud_powerup 0.5
 r_depthfirst 2
 r_drawdecals_drawdistance 500
 r_drawparticles_drawdistance 2000
index 82a18f2437561a9fa4a117f7d0835c3babdeb5c0..13051f4ef2b0cfb02de488322b87a90700179ace 100644 (file)
@@ -360,6 +360,9 @@ float use_nex_chargepool;
 float myhealth, myhealth_prev;
 float myhealth_flash;
 
+float old_blurradius, old_bluralpha;
+float old_sharpen_intensity;
+
 vector myhealth_gentlergb;
 
 float contentavgalpha, liquidalpha_prev;
@@ -367,6 +370,8 @@ vector liquidcolor_prev;
 
 float eventchase_current_distance;
 
+vector damage_blurpostprocess, content_blurpostprocess;
+
 float checkfail[16];
 
 void CSQC_UpdateView(float w, float h)
@@ -764,6 +769,22 @@ void CSQC_UpdateView(float w, float h)
                
                if(contentavgalpha)
                        drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL);
+
+               if(autocvar_hud_postprocessing)
+               {
+                       if(autocvar_hud_contents_blur && contentavgalpha)
+                       {
+                               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 && !autocvar_chase_active)
@@ -830,6 +851,74 @@ void CSQC_UpdateView(float w, float h)
                }
                else
                        drawpic(splash_pos, "gfx/blood", splash_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 && myhealth_flash_temp)
+                       {
+                               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)
+       {
+               // all of this should be done in the engine eventually
+
+               // enable or disable rendering types if they are used or not
+               if(cvar("r_glsl_postprocess_uservec1_enable") != (cvar("hud_postprocessing_maxbluralpha") != 0))
+                       cvar_set("r_glsl_postprocess_uservec1_enable", ftos(cvar("hud_postprocessing_maxbluralpha") != 0));
+               if(cvar("r_glsl_postprocess_uservec2_enable") != (cvar("hud_powerup") != 0))
+                       cvar_set("r_glsl_postprocess_uservec2_enable", ftos(cvar("hud_powerup") != 0));
+
+               // lets apply the postprocess effects from the previous two functions if needed
+               if((damage_blurpostprocess_x || content_blurpostprocess_x) && autocvar_chase_active >= 0) // not while the event chase camera is active
+               {
+                       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);
+                       if(blurradius != old_blurradius || bluralpha != old_bluralpha) // reduce cvar_set spam as much as possible
+                       {
+                               cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));
+                               old_blurradius = blurradius;
+                               old_bluralpha = bluralpha;
+                       }
+               }
+               else if(cvar_string("r_glsl_postprocess_uservec1") != "0 0 0 0") // reduce cvar_set spam as much as possible
+               {
+                       cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
+                       old_blurradius = 0;
+                       old_bluralpha = 0;
+               }
+
+               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);
+
+               if(autocvar_hud_powerup && sharpen_intensity > 0 && autocvar_chase_active >= 0) // not while the event chase camera is active
+               {
+                       sharpen_intensity = bound(0, sharpen_intensity, 5); // powerup warning time is 5 seconds, so fade the effect from there
+
+                       if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible
+                       {
+                               cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(-sharpen_intensity * cvar("hud_powerup")), " 0 0"));
+                               old_sharpen_intensity = sharpen_intensity;
+                       }
+               }
+               else if(cvar_string("r_glsl_postprocess_uservec2") != "0 0 0 0") // reduce cvar_set spam as much as possible
+               {
+                       cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");
+                       old_sharpen_intensity = 0;
+               }
        }
 
        if(menu_visible)
index bf9924a9279ddd1ac6f3f0cc5266527cffa26a34..3c1f16278b4d5e0b79e0d751e99ad2f5bf011639 100644 (file)
@@ -147,6 +147,8 @@ 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_fadeintime;
 float autocvar_hud_contents_fadeouttime;
@@ -157,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;
@@ -168,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;
index 53903aac7a8e5f172a5b1568676448389e390a71..9988fb850ce2751060734fc35bde40457d293c57 100644 (file)
@@ -184,11 +184,8 @@ void XonoticEffectsSettingsTab_fill(entity me)
                        e.savedValue = 0.5; // default
                me.TD(me, 1, 2, s);
        me.TR(me);
-               s = makeXonoticSlider(0.1, 1, 0.1, "r_damageblur");
-               me.TD(me, 1, 1, e = makeXonoticSliderCheckBox(0, 1, s, _("Damage blur:")));
-               if(s.value != e.savedValue)
-                       e.savedValue = 0.4; // default
-               me.TD(me, 1, 2, s);
+               me.TD(me, 1, 2, e = makeXonoticCheckBoxEx(0.5, 0, "hud_postprocessing_maxbluralpha", "Damage & water blur"));
+               me.TD(me, 1, 1, e = makeXonoticCheckBoxEx(0.5, 0, "hud_powerup", "Powerup sharpen"));
        
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "vid_restart", COMMANDBUTTON_APPLY));