diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-21 12:50:11 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-21 12:50:11 +0300 |
commit | 166286e6de36afa318b7fd80266dc88a47726308 (patch) | |
tree | 0c845c1af401ab27aefabf8a914b3a3b10ad8244 | |
parent | e4f7bf6ccb61c6dc9e83beba1b8b5414fdba0e04 (diff) |
Cycles: Make code more uniform across two versions of shadow_blocked()
Just to make it easier to research ways of possible code de-duplication.
-rw-r--r-- | intern/cycles/kernel/kernel_shadow.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h index 3de3aff5601..95b57404a77 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 */ |