From f21ad90ba40e2b19c9730d43b8ddb7d46582c782 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 24 May 2001 16:30:25 +0000 Subject: [PATCH] total nukage of brighten, brightness and contrast. --- include/view.h | 3 -- libs/video/targets/vid_3dfxsvga.c | 1 - libs/video/targets/vid_common_gl.c | 49 ------------------------------ libs/video/targets/vid_sgl.c | 1 - libs/video/targets/vid_wgl.c | 1 - nq/source/gl_screen.c | 8 ++--- nq/source/gl_sky.c | 6 ---- nq/source/gl_sky_clip.c | 2 -- nq/source/gl_view.c | 9 ------ nq/source/r_view.c | 6 ---- qw/source/gl_screen.c | 8 ++--- qw/source/gl_sky.c | 6 ---- qw/source/gl_sky_clip.c | 2 -- qw/source/gl_view.c | 9 ------ 14 files changed, 4 insertions(+), 107 deletions(-) diff --git a/include/view.h b/include/view.h index 0987afcab..6bf8c450c 100644 --- a/include/view.h +++ b/include/view.h @@ -33,9 +33,6 @@ #include "QF/mathlib.h" #include "QF/cvar.h" -extern cvar_t *brightness; -extern cvar_t *contrast; - #define INFO_CSHIFT_BONUS (1 << 0) #define INFO_CSHIFT_CONTENTS (1 << 1) #define INFO_CSHIFT_DAMAGE (1 << 2) diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index b4b49fa3e..a7aaa0e12 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -276,7 +276,6 @@ VID_Init (unsigned char *palette) GL_Init (); - GL_CheckBrightness (palette); VID_InitGamma (palette); VID_SetPalette (palette); diff --git a/libs/video/targets/vid_common_gl.c b/libs/video/targets/vid_common_gl.c index 30bad0015..23ace557e 100644 --- a/libs/video/targets/vid_common_gl.c +++ b/libs/video/targets/vid_common_gl.c @@ -61,7 +61,6 @@ unsigned int d_8to24table[256]; unsigned char d_15to8table[65536]; cvar_t *vid_mode; -cvar_t *brighten; cvar_t *gl_multitexture; extern byte gammatable[256]; @@ -87,8 +86,6 @@ QF_glColorTableEXT qglColorTableEXT = NULL; qboolean is8bit = false; cvar_t *vid_use8bit; -cvar_t *brightness; -cvar_t *contrast; /*-----------------------------------------------------------------------*/ @@ -96,8 +93,6 @@ void GL_Common_Init_Cvars (void) { vid_use8bit = Cvar_Get ("vid_use8bit", "0", CVAR_ROM, NULL, "Use 8-bit shared palettes."); - brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, NULL, "Brightness level"); - contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, NULL, "Contrast level"); gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL, "Use multitexture when available"); } @@ -379,50 +374,6 @@ VID_Init8bitPalette (void) } } -/* - GL_CheckBrightness - - This is something like the brightness cvar, except it hacks the palette - directly instead of brightening the screen afterward. -*/ -void -GL_CheckBrightness (unsigned char *pal) -{ - int i, inf; - float brightness; - - brighten = Cvar_Get ("brighten", "1", CVAR_NONE, NULL, - "Palette hack equivalent to brightness"); - - if ((i = COM_CheckParm ("-brighten"))) { - brightness = atof (com_argv[i + 1]); - } else { - brightness = brighten->value; - } - brightness = bound (1, brightness, 5); - - Cvar_SetValue (brighten, brightness); - Cvar_SetFlags (brighten, brighten->flags | CVAR_ROM); - - // Build gamma table - if (brightness == 1.0) { // screw the math - for (i = 0; i < 256; i++) { - gammatable[i] = i; - } - } else { - for (i = 0; i < 256; i++) { // brighten up the palette - inf = (i * brightness); - inf = bound (0, inf, 255); - gammatable[i] = inf; - } - } - - // correct the palette - for (i = 0; i < 768; i++) { - pal[i] = gammatable[pal[i]]; - } -} - void VID_LockBuffer (void) { diff --git a/libs/video/targets/vid_sgl.c b/libs/video/targets/vid_sgl.c index eb03d5120..17e1b6d90 100644 --- a/libs/video/targets/vid_sgl.c +++ b/libs/video/targets/vid_sgl.c @@ -230,7 +230,6 @@ VID_Init (unsigned char *palette) VID_SDL_GammaCheck (); - GL_CheckBrightness (palette); VID_InitGamma (palette); VID_SetPalette (palette); diff --git a/libs/video/targets/vid_wgl.c b/libs/video/targets/vid_wgl.c index 6af707f04..9b4f85b60 100644 --- a/libs/video/targets/vid_wgl.c +++ b/libs/video/targets/vid_wgl.c @@ -1383,7 +1383,6 @@ VID_Init (unsigned char *palette) DestroyWindow (hwnd_dialog); #endif - GL_CheckBrightness (palette); VID_InitGamma (palette); VID_SetPalette (palette); diff --git a/nq/source/gl_screen.c b/nq/source/gl_screen.c index f4fae93b9..ce807092c 100644 --- a/nq/source/gl_screen.c +++ b/nq/source/gl_screen.c @@ -807,7 +807,6 @@ int oldviewsize = 0; unsigned char lighthalf_v[3]; qboolean lighthalf; extern cvar_t *gl_lightmode; -extern cvar_t *brightness; /* SCR_UpdateScreen @@ -890,16 +889,13 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap) } } - // LordHavoc: adjustable brightness and contrast, // also makes polyblend apply to whole screen glDisable (GL_TEXTURE_2D); - Cvar_SetValue (brightness, bound (1, brightness->value, 5)); if (lighthalf) { // LordHavoc: render was done at half brightness - f = brightness->value * 2; + f = 2; } else { - Cvar_SetValue (brightness, bound (1, brightness->value, 5)); - f = brightness->value; + f = 1; } if (f >= 1.002) { // Make sure we don't get bit by roundoff errors diff --git a/nq/source/gl_sky.c b/nq/source/gl_sky.c index e15764726..38f5dae4f 100644 --- a/nq/source/gl_sky.c +++ b/nq/source/gl_sky.c @@ -264,16 +264,10 @@ R_DrawSkyDome (void) void R_DrawSky (void) { - float l = 1 / (256 * brightness->value); - - glColor3f (lighthalf_v[0] * l, lighthalf_v[1] * l, lighthalf_v[2] * l); - if (skyloaded) R_DrawSkyBox (); else R_DrawSkyDome (); - - glColor3ubv (lighthalf_v); } diff --git a/nq/source/gl_sky_clip.c b/nq/source/gl_sky_clip.c index 75ac23d4d..cf32983d8 100644 --- a/nq/source/gl_sky_clip.c +++ b/nq/source/gl_sky_clip.c @@ -673,9 +673,7 @@ void R_DrawSkyChain (msurface_t *sky_chain) { msurface_t *sc = sky_chain; - float l = 1 / (256 * brightness->value); - glColor3f (lighthalf_v[0] * l, lighthalf_v[1] * l, lighthalf_v[2] * l); if (skyloaded) { glDepthRange (gldepthmax, gldepthmax); while (sc) { diff --git a/nq/source/gl_view.c b/nq/source/gl_view.c index 9e9ab56fc..70682e163 100644 --- a/nq/source/gl_view.c +++ b/nq/source/gl_view.c @@ -83,15 +83,6 @@ V_CalcBlend (void) a = 1.0 - a3; } - if ((a2 = 1 - bound (0.0, contrast->value, 1.0)) < 0.999) { // add contrast - r += (128 - r) * a2; - g += (128 - g) * a2; - b += (128 - b) * a2; - - a3 = (1.0 - a) * (1.0 - a2); - a = 1.0 - a3; - } - // LordHavoc: saturate color if (a) { a2 = 1.0 / a; diff --git a/nq/source/r_view.c b/nq/source/r_view.c index 4ec63cffa..16bd72ebf 100644 --- a/nq/source/r_view.c +++ b/nq/source/r_view.c @@ -83,9 +83,6 @@ cvar_t *v_kicktime; cvar_t *v_kickroll; cvar_t *v_kickpitch; -cvar_t *brightness; -cvar_t *contrast; - float v_dmg_time, v_dmg_roll, v_dmg_pitch; extern cvar_t *vid_gamma; @@ -757,7 +754,4 @@ V_Init_Cvars (void) "How much you lean when hit"); v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, NULL, "How much you look up when hit"); - - brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, NULL, "None"); - contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, NULL, "None"); } diff --git a/qw/source/gl_screen.c b/qw/source/gl_screen.c index f4fae93b9..ce807092c 100644 --- a/qw/source/gl_screen.c +++ b/qw/source/gl_screen.c @@ -807,7 +807,6 @@ int oldviewsize = 0; unsigned char lighthalf_v[3]; qboolean lighthalf; extern cvar_t *gl_lightmode; -extern cvar_t *brightness; /* SCR_UpdateScreen @@ -890,16 +889,13 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap) } } - // LordHavoc: adjustable brightness and contrast, // also makes polyblend apply to whole screen glDisable (GL_TEXTURE_2D); - Cvar_SetValue (brightness, bound (1, brightness->value, 5)); if (lighthalf) { // LordHavoc: render was done at half brightness - f = brightness->value * 2; + f = 2; } else { - Cvar_SetValue (brightness, bound (1, brightness->value, 5)); - f = brightness->value; + f = 1; } if (f >= 1.002) { // Make sure we don't get bit by roundoff errors diff --git a/qw/source/gl_sky.c b/qw/source/gl_sky.c index e15764726..38f5dae4f 100644 --- a/qw/source/gl_sky.c +++ b/qw/source/gl_sky.c @@ -264,16 +264,10 @@ R_DrawSkyDome (void) void R_DrawSky (void) { - float l = 1 / (256 * brightness->value); - - glColor3f (lighthalf_v[0] * l, lighthalf_v[1] * l, lighthalf_v[2] * l); - if (skyloaded) R_DrawSkyBox (); else R_DrawSkyDome (); - - glColor3ubv (lighthalf_v); } diff --git a/qw/source/gl_sky_clip.c b/qw/source/gl_sky_clip.c index 75ac23d4d..cf32983d8 100644 --- a/qw/source/gl_sky_clip.c +++ b/qw/source/gl_sky_clip.c @@ -673,9 +673,7 @@ void R_DrawSkyChain (msurface_t *sky_chain) { msurface_t *sc = sky_chain; - float l = 1 / (256 * brightness->value); - glColor3f (lighthalf_v[0] * l, lighthalf_v[1] * l, lighthalf_v[2] * l); if (skyloaded) { glDepthRange (gldepthmax, gldepthmax); while (sc) { diff --git a/qw/source/gl_view.c b/qw/source/gl_view.c index 663330dce..8e121e5a0 100644 --- a/qw/source/gl_view.c +++ b/qw/source/gl_view.c @@ -84,15 +84,6 @@ V_CalcBlend (void) a = 1.0 - a3; } - if ((a2 = 1 - bound (0.0, contrast->value, 1.0)) < 0.999) { // add contrast - r += (128 - r) * a2; - g += (128 - g) * a2; - b += (128 - b) * a2; - - a3 = (1.0 - a) * (1.0 - a2); - a = 1.0 - a3; - } - // LordHavoc: saturate color if (a) { a2 = 1.0 / a;