- Add support for linearly desaturating images via r_greyscale
- Use correct luminance values for rendering textures Patch submitted by Forrest Voight.
This commit is contained in:
parent
13836e5f4a
commit
e66abb3237
6 changed files with 61 additions and 8 deletions
|
@ -560,6 +560,27 @@ static void Upload32( unsigned *data,
|
|||
scan = ((byte *)data);
|
||||
samples = 3;
|
||||
|
||||
if( r_greyscale->integer )
|
||||
{
|
||||
for ( i = 0; i < c; i++ )
|
||||
{
|
||||
byte luma = LUMA(scan[i*4], scan[i*4 + 1], scan[i*4 + 2]);
|
||||
scan[i*4] = luma;
|
||||
scan[i*4 + 1] = luma;
|
||||
scan[i*4 + 2] = luma;
|
||||
}
|
||||
}
|
||||
else if( r_greyscale->value )
|
||||
{
|
||||
for ( i = 0; i < c; i++ )
|
||||
{
|
||||
float luma = LUMA(scan[i*4], scan[i*4 + 1], scan[i*4 + 2]);
|
||||
scan[i*4] = LERP(scan[i*4], luma, r_greyscale->value);
|
||||
scan[i*4 + 1] = LERP(scan[i*4 + 1], luma, r_greyscale->value);
|
||||
scan[i*4 + 2] = LERP(scan[i*4 + 2], luma, r_greyscale->value);
|
||||
}
|
||||
}
|
||||
|
||||
if(lightMap)
|
||||
{
|
||||
if(r_greyscale->integer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue