diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-07 02:48:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-07 02:48:28 +0400 |
commit | 3a0593cc3d5de33248b3a7b913a45729c37dc1b4 (patch) | |
tree | 88fcddc5e3c060c87a6313d853315f0efa484a52 /source/blender/render | |
parent | 2336aadb80f8602f001b2c5b0bcaacf3ad858f83 (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.c | 5 |
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*/ |