Code cleanup / Cycles:
authorThomas Dinges <blender@dingto.org>
Wed, 15 May 2013 20:38:17 +0000 (20:38 +0000)
committerThomas Dinges <blender@dingto.org>
Wed, 15 May 2013 20:38:17 +0000 (20:38 +0000)
* Some simplification of closure code (Velvet and Toon).

intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h
intern/cycles/kernel/closure/bsdf_toon.h

index 60f809159acbda2b7ae8f50ead0a2f9a4a875bab..94bc6eb0dc5503f197855d950592f97a5581fec5 100644 (file)
@@ -37,13 +37,10 @@ CCL_NAMESPACE_BEGIN
 
 __device int bsdf_ashikhmin_velvet_setup(ShaderClosure *sc)
 {
-       float sigma = sc->data0;
-       sigma = fmaxf(sigma, 0.01f);
-
-       float m_invsigma2 = 1.0f/(sigma * sigma);
-
+       float sigma = fmaxf(sc->data0, 0.01f);
+       sc->data0 = 1.0f/(sigma * sigma); /* m_invsigma2 */
+       
        sc->type = CLOSURE_BSDF_ASHIKHMIN_VELVET_ID;
-       sc->data0 = m_invsigma2;
 
        return SD_BSDF|SD_BSDF_HAS_EVAL;
 }
index 40001bf7531691b7d4c6cc503d8b0608fc800b90..ac66114ca7680b6eb070623b7b5d3d5636f5d3f7 100644 (file)
@@ -52,14 +52,12 @@ __device void bsdf_diffuse_toon_blur(ShaderClosure *sc, float roughness)
 
 __device float3 bsdf_toon_get_intensity(float max_angle, float smooth, float angle)
 {
-       float is;
+       float is = 0.0f;
 
        if(angle < max_angle)
                is = 1.0f;
        else if(angle < (max_angle + smooth) && smooth != 0.0f)
                is = (1.0f - (angle - max_angle)/smooth);
-       else
-               is = 0.0f;
        
        return make_float3(is, is, is);
 }