diff options
Diffstat (limited to 'src/renderer/tr_image.c')
-rw-r--r-- | src/renderer/tr_image.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/renderer/tr_image.c b/src/renderer/tr_image.c index 0cb18759..1fa8042d 100644 --- a/src/renderer/tr_image.c +++ b/src/renderer/tr_image.c @@ -561,6 +561,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) |