diff options
author | Thomas Dinges <blender@dingto.org> | 2013-05-14 22:31:55 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2013-05-14 22:31:55 +0400 |
commit | 1f3bf34ccd8b7b29560b819c72619fce7bfc7f4c (patch) | |
tree | 58eecca0c36cd3d3822b8b04b9a89cdcacc4f82c /intern/cycles/kernel | |
parent | 6fc51bf20e48fd0565ccce928693455f6a12551c (diff) |
Cycles :
* Use is_zero(a) rather than dot(a, a) == 0, saves some calculations.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/kernel_camera.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_light.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index 8bd09247339..a23586a53a4 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -187,7 +187,7 @@ __device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float ra } /* indicates ray should not receive any light, outside of the lens */ - if(len_squared(ray->D) == 0.0f) { + if(is_zero(ray->D)) { ray->t = 0.0f; return; } diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h index a4877acdc53..c07f1ffe5a3 100644 --- a/intern/cycles/kernel/kernel_light.h +++ b/intern/cycles/kernel/kernel_light.h @@ -492,7 +492,7 @@ __device void curve_segment_light_sample(KernelGlobals *kg, int prim, int object float r2 = P2.w; float3 tg = (float4_to_float3(P2) - float4_to_float3(P1)) / l; float3 xc = make_float3(tg.x * tg.z, tg.y * tg.z, -(tg.x * tg.x + tg.y * tg.y)); - if (dot(xc, xc) == 0.0f) + if (is_zero(xc)) xc = make_float3(tg.x * tg.y, -(tg.x * tg.x + tg.z * tg.z), tg.z * tg.y); xc = normalize(xc); float3 yc = cross(tg, xc); |