Apply greyscaling to fog blocks

This commit is contained in:
Zack Middleton 2015-07-04 19:17:58 -05:00
parent 386a00fc2b
commit 5e575ae82e
2 changed files with 34 additions and 0 deletions

View file

@ -1568,6 +1568,23 @@ static qboolean ParseShader( char **text )
return qfalse; 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 ); token = COM_ParseExt( text, qfalse );
if ( !token[0] ) if ( !token[0] )
{ {

View file

@ -1856,6 +1856,23 @@ static qboolean ParseShader( char **text )
return qfalse; 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 ); token = COM_ParseExt( text, qfalse );
if ( !token[0] ) if ( !token[0] )
{ {