From: havoc Date: Thu, 13 May 2004 22:02:33 +0000 (+0000) Subject: Tomaz's gl_polyblend patch to control intensity of view blends X-Git-Tag: xonotic-v0.1.0preview~5888 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b249b64acbbfaec2526203fb44fc1f6cb47b42fa;p=xonotic%2Fdarkplaces.git Tomaz's gl_polyblend patch to control intensity of view blends git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4161 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_backend.c b/gl_backend.c index 9ea11dea..ee241172 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -13,6 +13,7 @@ cvar_t gl_printcheckerror = {0, "gl_printcheckerror", "0"}; cvar_t r_render = {0, "r_render", "1"}; cvar_t r_waterwarp = {CVAR_SAVE, "r_waterwarp", "1"}; +cvar_t gl_polyblend = {CVAR_SAVE, "gl_polyblend", "1"}; cvar_t gl_dither = {CVAR_SAVE, "gl_dither", "1"}; // whether or not to use dithering cvar_t gl_lockarrays = {0, "gl_lockarrays", "1"}; @@ -206,6 +207,7 @@ void gl_backend_init(void) Cvar_RegisterVariable(&r_render); Cvar_RegisterVariable(&r_waterwarp); + Cvar_RegisterVariable(&gl_polyblend); Cvar_RegisterVariable(&gl_dither); Cvar_RegisterVariable(&gl_lockarrays); Cvar_RegisterVariable(&gl_delayfinish); diff --git a/menu.c b/menu.c index 0a1289b1..0131729e 100644 --- a/menu.c +++ b/menu.c @@ -1423,7 +1423,7 @@ void M_Options_Key (int k, char ascii) } } -#define OPTIONS_EFFECTS_ITEMS 23 +#define OPTIONS_EFFECTS_ITEMS 24 int options_effects_cursor; @@ -1478,6 +1478,7 @@ void M_Menu_Options_Effects_AdjustSliders (int dir) else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood_bloodhack, !cl_particles_blood_bloodhack.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lerpmodels, !r_lerpmodels.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lerpsprites, !r_lerpsprites.integer); + else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&gl_polyblend, bound(0, gl_polyblend.value + dir * 0.1, 1)); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterwarp, bound(0, r_waterwarp.value + dir * 0.1, 1)); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_wateralpha, bound(0, r_wateralpha.value + dir * 0.1, 1)); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterscroll, bound(0, r_waterscroll.value + dir * 0.5, 10)); @@ -1519,6 +1520,7 @@ void M_Options_Effects_Draw (void) M_Options_PrintCheckbox("Force New Blood Effect", true, cl_particles_blood_bloodhack.integer); M_Options_PrintCheckbox(" Model Interpolation", true, r_lerpmodels.integer); M_Options_PrintCheckbox(" Sprite Interpolation", true, r_lerpsprites.integer); + M_Options_PrintSlider( " View Blend", true, gl_polyblend.value, 0, 1); M_Options_PrintSlider( " Underwater View Warp", true, r_waterwarp.value, 0, 1); M_Options_PrintSlider( " Water Alpha (opacity)", true, r_wateralpha.value, 0, 1); M_Options_PrintSlider( " Water Movement", true, r_waterscroll.value, 0, 10); diff --git a/render.h b/render.h index c669cd47..339333ae 100644 --- a/render.h +++ b/render.h @@ -155,6 +155,7 @@ extern cvar_t r_render; extern cvar_t r_waterwarp; extern cvar_t r_textureunits; +extern cvar_t gl_polyblend; extern cvar_t gl_dither; #include "gl_backend.h" diff --git a/view.c b/view.c index bb713d8b..cca80214 100644 --- a/view.c +++ b/view.c @@ -442,7 +442,7 @@ void V_CalcViewBlend(void) r_refdef.viewblend[1] = 0; r_refdef.viewblend[2] = 0; r_refdef.viewblend[3] = 0; - if (cls.state == ca_connected && cls.signon == SIGNONS) + if (cls.state == ca_connected && cls.signon == SIGNONS && gl_polyblend.value > 0) { // set contents color switch (CL_PointQ1Contents(r_vieworigin)) @@ -519,7 +519,7 @@ void V_CalcViewBlend(void) if (a2 > 0) { VectorLerp(r_refdef.viewblend, a2, cl.cshifts[j].destcolor, r_refdef.viewblend); - r_refdef.viewblend[3] = 1 - (1 - r_refdef.viewblend[3]) * (1 - a2); // correct alpha multiply... took a while to find it on the web + r_refdef.viewblend[3] = (1 - (1 - r_refdef.viewblend[3]) * (1 - a2)); // correct alpha multiply... took a while to find it on the web } } // saturate color (to avoid blending in black) @@ -532,7 +532,7 @@ void V_CalcViewBlend(void) r_refdef.viewblend[0] = bound(0.0f, r_refdef.viewblend[0] * (1.0f/255.0f), 1.0f); r_refdef.viewblend[1] = bound(0.0f, r_refdef.viewblend[1] * (1.0f/255.0f), 1.0f); r_refdef.viewblend[2] = bound(0.0f, r_refdef.viewblend[2] * (1.0f/255.0f), 1.0f); - r_refdef.viewblend[3] = bound(0.0f, r_refdef.viewblend[3] , 1.0f); + r_refdef.viewblend[3] = bound(0.0f, r_refdef.viewblend[3] * gl_polyblend.value, 1.0f); } }