This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit 26f1a720db2145f90e3c9c18a03079b309b3b669
Author: m4n4t4...@gmail.com 
<m4n4t4...@gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Wed Mar 12 05:12:34 2014 +0000

    All: Rend2: Set cap on ambient and direct light
---
 MP/code/rend2/tr_shade.c | 15 +++++++++++++++
 SP/code/rend2/tr_shade.c | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/MP/code/rend2/tr_shade.c b/MP/code/rend2/tr_shade.c
index 1a2e8e1..c429e5c 100644
--- a/MP/code/rend2/tr_shade.c
+++ b/MP/code/rend2/tr_shade.c
@@ -1288,11 +1288,26 @@ static void RB_IterateStagesGeneric( shaderCommands_t 
*input )
                if (pStage->rgbGen == CGEN_LIGHTING_DIFFUSE)
                {
                        vec4_t vec;
+                       vec_t cap = 1.0f / (1 << tr.overbrightBits);
 
                        VectorScale(backEnd.currentEntity->ambientLight, 1.0f / 
255.0f, vec);
+                       if ((vec[0] > cap) || (vec[1] > cap) || (vec[2] > cap))
+                       {
+                               vec_t hi = MAX(vec[0], vec[1]);
+                               hi = MAX(hi, vec[2]);
+                               
+                               VectorScale(vec, cap / hi, vec);
+                       }
                        GLSL_SetUniformVec3(sp, UNIFORM_AMBIENTLIGHT, vec);
 
                        VectorScale(backEnd.currentEntity->directedLight, 1.0f 
/ 255.0f, vec);
+                       if ((vec[0] > cap) || (vec[1] > cap) || (vec[2] > cap))
+                       {
+                               vec_t hi = MAX(vec[0], vec[1]);
+                               hi = MAX(hi, vec[2]);
+                               
+                               VectorScale(vec, cap / hi, vec);
+                       }
                        GLSL_SetUniformVec3(sp, UNIFORM_DIRECTEDLIGHT, vec);
                        
                        VectorCopy(backEnd.currentEntity->lightDir, vec);
diff --git a/SP/code/rend2/tr_shade.c b/SP/code/rend2/tr_shade.c
index 28b1589..58788d3 100644
--- a/SP/code/rend2/tr_shade.c
+++ b/SP/code/rend2/tr_shade.c
@@ -1282,11 +1282,26 @@ static void RB_IterateStagesGeneric( shaderCommands_t 
*input )
                if (pStage->rgbGen == CGEN_LIGHTING_DIFFUSE)
                {
                        vec4_t vec;
+                       vec_t cap = 1.0f / (1 << tr.overbrightBits);
 
                        VectorScale(backEnd.currentEntity->ambientLight, 1.0f / 
255.0f, vec);
+                       if ((vec[0] > cap) || (vec[1] > cap) || (vec[2] > cap))
+                       {
+                               vec_t hi = MAX(vec[0], vec[1]);
+                               hi = MAX(hi, vec[2]);
+                               
+                               VectorScale(vec, cap / hi, vec);
+                       }
                        GLSL_SetUniformVec3(sp, UNIFORM_AMBIENTLIGHT, vec);
 
                        VectorScale(backEnd.currentEntity->directedLight, 1.0f 
/ 255.0f, vec);
+                       if ((vec[0] > cap) || (vec[1] > cap) || (vec[2] > cap))
+                       {
+                               vec_t hi = MAX(vec[0], vec[1]);
+                               hi = MAX(hi, vec[2]);
+                               
+                               VectorScale(vec, cap / hi, vec);
+                       }
                        GLSL_SetUniformVec3(sp, UNIFORM_DIRECTEDLIGHT, vec);
                        
                        VectorCopy(backEnd.currentEntity->lightDir, vec);

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/iortcw.git

_______________________________________________
Pkg-games-commits mailing list
Pkg-games-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to