Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-07 02:48:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-07 02:48:28 +0400
commit3a0593cc3d5de33248b3a7b913a45729c37dc1b4 (patch)
tree88fcddc5e3c060c87a6313d853315f0efa484a52 /source/blender/render
parent2336aadb80f8602f001b2c5b0bcaacf3ad858f83 (diff)
code cleanup: dont use function calls like dot_v3v3, pow and sqrt within macros which results in calling the function multiple times needlessly.
also added some comments.
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/source/shadeoutput.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 82f2add7c3d..b208df74de9 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -798,7 +798,6 @@ static float OrenNayar_Diff(float nl, const float n[3], const float l[3], const
/* Minnaert diffuse */
static float Minnaert_Diff(float nl, const float n[3], const float v[3], float darkness)
{
-
float i, nv;
/* nl = dot product between surface normal and light vector */
@@ -806,12 +805,12 @@ static float Minnaert_Diff(float nl, const float n[3], const float v[3], float d
return 0.0f;
/* nv = dot product between surface normal and view vector */
- nv = n[0]*v[0]+n[1]*v[1]+n[2]*v[2];
+ nv = dot_v3v3(n, v);
if (nv < 0.0f)
nv = 0.0f;
if (darkness <= 1.0f)
- i = nl * pow(MAX2(nv*nl, 0.1f), (darkness - 1.0f) ); /*The Real model*/
+ i = nl * pow(maxf(nv * nl, 0.1f), (darkness - 1.0f) ); /*The Real model*/
else
i = nl * pow( (1.001f - nv), (darkness - 1.0f) ); /*Nvidia model*/