From 0605f9d03e791159af04c8f69a26864c187998af Mon Sep 17 00:00:00 2001 From: SmileTheory Date: Tue, 17 Dec 2013 04:08:25 -0800 Subject: #6077: OpenGL2: Add r_ignoreDstAlpha. --- src/renderergl2/tr_init.c | 2 ++ src/renderergl2/tr_local.h | 1 + src/renderergl2/tr_shader.c | 12 ++++++++++++ 3 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/renderergl2/tr_init.c b/src/renderergl2/tr_init.c index 010603a1..b0120875 100644 --- a/src/renderergl2/tr_init.c +++ b/src/renderergl2/tr_init.c @@ -160,6 +160,7 @@ cvar_t *r_shadowMapSize; cvar_t *r_shadowCascadeZNear; cvar_t *r_shadowCascadeZFar; cvar_t *r_shadowCascadeZBias; +cvar_t *r_ignoreDstAlpha; cvar_t *r_ignoreGLErrors; cvar_t *r_logFile; @@ -1145,6 +1146,7 @@ void R_Register( void ) r_shadowCascadeZNear = ri.Cvar_Get( "r_shadowCascadeZNear", "4", CVAR_ARCHIVE | CVAR_LATCH ); r_shadowCascadeZFar = ri.Cvar_Get( "r_shadowCascadeZFar", "3072", CVAR_ARCHIVE | CVAR_LATCH ); r_shadowCascadeZBias = ri.Cvar_Get( "r_shadowCascadeZBias", "-320", CVAR_ARCHIVE | CVAR_LATCH ); + r_ignoreDstAlpha = ri.Cvar_Get( "r_ignoreDstAlpha", "1", CVAR_ARCHIVE | CVAR_LATCH ); // // temporary latched variables that can only change over a restart diff --git a/src/renderergl2/tr_local.h b/src/renderergl2/tr_local.h index 3effb9f8..c98ec28e 100644 --- a/src/renderergl2/tr_local.h +++ b/src/renderergl2/tr_local.h @@ -1819,6 +1819,7 @@ extern cvar_t *r_shadowMapSize; extern cvar_t *r_shadowCascadeZNear; extern cvar_t *r_shadowCascadeZFar; extern cvar_t *r_shadowCascadeZBias; +extern cvar_t *r_ignoreDstAlpha; extern cvar_t *r_greyscale; diff --git a/src/renderergl2/tr_shader.c b/src/renderergl2/tr_shader.c index 7edb8309..c5438f6d 100644 --- a/src/renderergl2/tr_shader.c +++ b/src/renderergl2/tr_shader.c @@ -204,10 +204,16 @@ static int NameToSrcBlendMode( const char *name ) } else if ( !Q_stricmp( name, "GL_DST_ALPHA" ) ) { + if (r_ignoreDstAlpha->integer) + return GLS_SRCBLEND_ONE; + return GLS_SRCBLEND_DST_ALPHA; } else if ( !Q_stricmp( name, "GL_ONE_MINUS_DST_ALPHA" ) ) { + if (r_ignoreDstAlpha->integer) + return GLS_SRCBLEND_ZERO; + return GLS_SRCBLEND_ONE_MINUS_DST_ALPHA; } else if ( !Q_stricmp( name, "GL_SRC_ALPHA_SATURATE" ) ) @@ -244,10 +250,16 @@ static int NameToDstBlendMode( const char *name ) } else if ( !Q_stricmp( name, "GL_DST_ALPHA" ) ) { + if (r_ignoreDstAlpha->integer) + return GLS_DSTBLEND_ONE; + return GLS_DSTBLEND_DST_ALPHA; } else if ( !Q_stricmp( name, "GL_ONE_MINUS_DST_ALPHA" ) ) { + if (r_ignoreDstAlpha->integer) + return GLS_DSTBLEND_ZERO; + return GLS_DSTBLEND_ONE_MINUS_DST_ALPHA; } else if ( !Q_stricmp( name, "GL_SRC_COLOR" ) ) -- cgit