From 3740c55decb0a24cef53a76aa1c485ba7f7f4e88 Mon Sep 17 00:00:00 2001 From: SmileTheory Date: Thu, 20 Feb 2014 17:01:50 -0800 Subject: [PATCH] OpenGL2: Remove and force r_softOverbright. --- code/renderergl2/tr_image.c | 41 +++++-------------------------------- code/renderergl2/tr_init.c | 4 ---- code/renderergl2/tr_local.h | 2 -- code/renderergl2/tr_shade.c | 2 +- code/renderergl2/tr_sky.c | 2 +- 5 files changed, 7 insertions(+), 44 deletions(-) diff --git a/code/renderergl2/tr_image.c b/code/renderergl2/tr_image.c index 243d27df..bd20a7fc 100644 --- a/code/renderergl2/tr_image.c +++ b/code/renderergl2/tr_image.c @@ -3013,37 +3013,14 @@ void R_SetColorMappings( void ) { int i, j; float g; int inf; - int shift; // setup the overbright lighting tr.overbrightBits = r_overBrightBits->integer; - if ( !glConfig.deviceSupportsGamma ) { - tr.overbrightBits = 0; // need hardware gamma for overbright - } - // never overbright in windowed mode without soft overbright - if ( !glConfig.isFullscreen && !r_softOverbright->integer ) - { - tr.overbrightBits = 0; - } - - // never overbright with tonemapping - if ( r_toneMap->integer && r_hdr->integer ) - { - tr.overbrightBits = 0; - } - - // allow 2 overbright bits in 24 bit, but only 1 in 16 bit - if ( glConfig.colorBits > 16 ) { - if ( tr.overbrightBits > 2 ) { - tr.overbrightBits = 2; - } - } else { - if ( tr.overbrightBits > 1 ) { - tr.overbrightBits = 1; - } - } - if ( tr.overbrightBits < 0 ) { + // allow 2 overbright bits + if ( tr.overbrightBits > 2 ) { + tr.overbrightBits = 2; + } else if ( tr.overbrightBits < 0 ) { tr.overbrightBits = 0; } @@ -3063,14 +3040,6 @@ void R_SetColorMappings( void ) { g = r_gamma->value; - shift = tr.overbrightBits; - - // no shift with soft overbright - if (r_softOverbright->integer) - { - shift = 0; - } - for ( i = 0; i < 256; i++ ) { int i2; @@ -3088,7 +3057,7 @@ void R_SetColorMappings( void ) { } else { inf = 255 * pow ( i2/255.0f, 1.0f / g ) + 0.5f; } - inf <<= shift; + if (inf < 0) { inf = 0; } diff --git a/code/renderergl2/tr_init.c b/code/renderergl2/tr_init.c index 84bbeba2..4fb1d99e 100644 --- a/code/renderergl2/tr_init.c +++ b/code/renderergl2/tr_init.c @@ -108,8 +108,6 @@ cvar_t *r_mergeLeafSurfaces; cvar_t *r_cameraExposure; -cvar_t *r_softOverbright; - cvar_t *r_hdr; cvar_t *r_floatLightmap; cvar_t *r_postProcess; @@ -1161,8 +1159,6 @@ void R_Register( void ) r_greyscale = ri.Cvar_Get("r_greyscale", "0", CVAR_ARCHIVE | CVAR_LATCH); ri.Cvar_CheckRange(r_greyscale, 0, 1, qfalse); - r_softOverbright = ri.Cvar_Get( "r_softOverbright", "1", CVAR_ARCHIVE | CVAR_LATCH ); - r_hdr = ri.Cvar_Get( "r_hdr", "1", CVAR_ARCHIVE | CVAR_LATCH ); r_floatLightmap = ri.Cvar_Get( "r_floatLightmap", "0", CVAR_ARCHIVE | CVAR_LATCH ); r_postProcess = ri.Cvar_Get( "r_postProcess", "1", CVAR_ARCHIVE ); diff --git a/code/renderergl2/tr_local.h b/code/renderergl2/tr_local.h index 12fa10ad..d0448507 100644 --- a/code/renderergl2/tr_local.h +++ b/code/renderergl2/tr_local.h @@ -1765,8 +1765,6 @@ extern cvar_t *r_anaglyphMode; extern cvar_t *r_mergeMultidraws; extern cvar_t *r_mergeLeafSurfaces; -extern cvar_t *r_softOverbright; - extern cvar_t *r_hdr; extern cvar_t *r_floatLightmap; extern cvar_t *r_postProcess; diff --git a/code/renderergl2/tr_shade.c b/code/renderergl2/tr_shade.c index 856b8748..115a2c30 100644 --- a/code/renderergl2/tr_shade.c +++ b/code/renderergl2/tr_shade.c @@ -602,7 +602,7 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t } // multiply color by overbrightbits if this isn't a blend - if (r_softOverbright->integer && tr.overbrightBits + if (tr.overbrightBits && !((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_DST_COLOR) && !((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_ONE_MINUS_DST_COLOR) && !((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_SRC_COLOR) diff --git a/code/renderergl2/tr_sky.c b/code/renderergl2/tr_sky.c index 6a220318..3b739df0 100644 --- a/code/renderergl2/tr_sky.c +++ b/code/renderergl2/tr_sky.c @@ -449,7 +449,7 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max color[0] = color[1] = - color[2] = (r_softOverbright->integer ? 1.0 : tr.identityLight) * backEnd.refdef.colorScale; + color[2] = backEnd.refdef.colorScale; color[3] = 1.0f; GLSL_SetUniformVec4(sp, UNIFORM_BASECOLOR, color);