diff options
author | Tim Angus <tim@ngus.net> | 2009-10-03 11:52:53 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:28 +0000 |
commit | b47a49a03370e7ea42f47623b9f72a5ca799f0e7 (patch) | |
tree | 9d64d778ded2971d7ebd05970d903d886bd81436 /src/renderer/tr_shade.c | |
parent | 09ceb08b95978feb0a9b737f22ac0f662c7465d6 (diff) |
* Merge ioq3-r1423
+ IPv6
+ VoIP
+ Stereo rendering
+ Other minor stuff
Diffstat (limited to 'src/renderer/tr_shade.c')
-rw-r--r-- | src/renderer/tr_shade.c | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/src/renderer/tr_shade.c b/src/renderer/tr_shade.c index 0214083b..dd8b81bb 100644 --- a/src/renderer/tr_shade.c +++ b/src/renderer/tr_shade.c @@ -456,9 +456,19 @@ static void ProjectDlightTexture_altivec( void ) { radius = dl->radius; scale = 1.0f / radius; - floatColor[0] = dl->color[0] * 255.0f; - floatColor[1] = dl->color[1] * 255.0f; - floatColor[2] = dl->color[2] * 255.0f; + if(r_greyscale->integer) + { + float luminance; + + luminance = (dl->color[0] * 255.0f + dl->color[1] * 255.0f + dl->color[2] * 255.0f) / 3; + floatColor[0] = floatColor[1] = floatColor[2] = luminance; + } + else + { + floatColor[0] = dl->color[0] * 255.0f; + floatColor[1] = dl->color[1] * 255.0f; + floatColor[2] = dl->color[2] * 255.0f; + } floatColorVec0 = vec_ld(0, floatColor); floatColorVec1 = vec_ld(11, floatColor); floatColorVec0 = vec_perm(floatColorVec0,floatColorVec0,floatColorVecPerm); @@ -600,9 +610,20 @@ static void ProjectDlightTexture_scalar( void ) { radius = dl->radius; scale = 1.0f / radius; - floatColor[0] = dl->color[0] * 255.0f; - floatColor[1] = dl->color[1] * 255.0f; - floatColor[2] = dl->color[2] * 255.0f; + if(r_greyscale->integer) + { + float luminance; + + luminance = (dl->color[0] * 255.0f + dl->color[1] * 255.0f + dl->color[2] * 255.0f) / 3; + floatColor[0] = floatColor[1] = floatColor[2] = luminance; + } + else + { + floatColor[0] = dl->color[0] * 255.0f; + floatColor[1] = dl->color[1] * 255.0f; + floatColor[2] = dl->color[2] * 255.0f; + } + for ( i = 0 ; i < tess.numVertexes ; i++, texCoords += 2, colors += 4 ) { int clip = 0; vec3_t dist; @@ -939,6 +960,18 @@ static void ComputeColors( shaderStage_t *pStage ) break; } } + + // if in greyscale rendering mode turn all color values into greyscale. + if(r_greyscale->integer) + { + int scale; + + for(i = 0; i < tess.numVertexes; i++) + { + scale = (tess.svars.colors[i][0] + tess.svars.colors[i][1] + tess.svars.colors[i][2]) / 3; + tess.svars.colors[i][0] = tess.svars.colors[i][1] = tess.svars.colors[i][2] = scale; + } + } } /* |