Commit: 166286e6de36afa318b7fd80266dc88a47726308
Author: Sergey Sharybin
Date:   Wed Sep 21 11:50:11 2016 +0200
Branches: master
https://developer.blender.org/rB166286e6de36afa318b7fd80266dc88a47726308

Cycles: Make code more uniform across two versions of shadow_blocked()

Just to make it easier to research ways of possible code de-duplication.

===================================================================

M       intern/cycles/kernel/kernel_shadow.h

===================================================================

diff --git a/intern/cycles/kernel/kernel_shadow.h 
b/intern/cycles/kernel/kernel_shadow.h
index 3de3aff..95b5740 100644
--- a/intern/cycles/kernel/kernel_shadow.h
+++ b/intern/cycles/kernel/kernel_shadow.h
@@ -130,8 +130,9 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, 
ShaderData *shadow_sd,
 
                                /* move ray forward */
                                ray->P = shadow_sd->P;
-                               if(ray->t != FLT_MAX)
+                               if(ray->t != FLT_MAX) {
                                        ray->D = normalize_len(Pend - ray->P, 
&ray->t);
+                               }
 
 #ifdef __VOLUME__
                                /* exit/enter volume */
@@ -233,8 +234,9 @@ ccl_device_noinline bool shadow_blocked(KernelGlobals *kg,
                                        return false;
                                }
 
-                               if(!shader_transparent_shadow(kg, isect))
+                               if(!shader_transparent_shadow(kg, isect)) {
                                        return true;
+                               }
 
 #ifdef __VOLUME__
                                /* attenuation between last surface and next 
surface */
@@ -257,13 +259,16 @@ ccl_device_noinline bool shadow_blocked(KernelGlobals *kg,
                                        throughput *= 
shader_bsdf_transparency(kg, shadow_sd);
                                }
 
-                               if(is_zero(throughput))
+                               /* stop if all light is blocked */
+                               if(is_zero(throughput)) {
                                        return true;
+                               }
 
                                /* move ray forward */
                                ray->P = ray_offset(ccl_fetch(shadow_sd, P), 
-ccl_fetch(shadow_sd, Ng));
-                               if(ray->t != FLT_MAX)
+                               if(ray->t != FLT_MAX) {
                                        ray->D = normalize_len(Pend - ray->P, 
&ray->t);
+                               }
 
 #ifdef __VOLUME__
                                /* exit/enter volume */

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to