diff options
author | Zack Middleton <zturtleman@gmail.com> | 2015-07-04 19:17:58 -0500 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2016-04-07 11:02:29 +0100 |
commit | 00a83e798f7934962facba8e7864b215e1d94701 (patch) | |
tree | f060fbffb8fc20fabc2d9dd42ed8276bbf76ea70 | |
parent | bb035728e23db00c7dfaecbdacf4e73aede43b2a (diff) |
Apply greyscaling to fog blocks
-rw-r--r-- | src/renderergl1/tr_shader.c | 17 | ||||
-rw-r--r-- | src/renderergl2/tr_shader.c | 17 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/renderergl1/tr_shader.c b/src/renderergl1/tr_shader.c index 2a66afd0..34d6d64e 100644 --- a/src/renderergl1/tr_shader.c +++ b/src/renderergl1/tr_shader.c @@ -1569,6 +1569,23 @@ static qboolean ParseShader( char **text ) return qfalse; } + if ( r_greyscale->integer ) + { + float luminance; + + luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] ); + VectorSet( shader.fogParms.color, luminance, luminance, luminance ); + } + else if ( r_greyscale->value ) + { + float luminance; + + luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] ); + shader.fogParms.color[0] = LERP( shader.fogParms.color[0], luminance, r_greyscale->value ); + shader.fogParms.color[1] = LERP( shader.fogParms.color[1], luminance, r_greyscale->value ); + shader.fogParms.color[2] = LERP( shader.fogParms.color[2], luminance, r_greyscale->value ); + } + token = COM_ParseExt( text, qfalse ); if ( !token[0] ) { diff --git a/src/renderergl2/tr_shader.c b/src/renderergl2/tr_shader.c index 4143b246..68b5cb60 100644 --- a/src/renderergl2/tr_shader.c +++ b/src/renderergl2/tr_shader.c @@ -1857,6 +1857,23 @@ static qboolean ParseShader( char **text ) return qfalse; } + if ( r_greyscale->integer ) + { + float luminance; + + luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] ); + VectorSet( shader.fogParms.color, luminance, luminance, luminance ); + } + else if ( r_greyscale->value ) + { + float luminance; + + luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] ); + shader.fogParms.color[0] = LERP( shader.fogParms.color[0], luminance, r_greyscale->value ); + shader.fogParms.color[1] = LERP( shader.fogParms.color[1], luminance, r_greyscale->value ); + shader.fogParms.color[2] = LERP( shader.fogParms.color[2], luminance, r_greyscale->value ); + } + token = COM_ParseExt( text, qfalse ); if ( !token[0] ) { |