diff options
Diffstat (limited to 'intern/cycles/kernel/geom/point_intersect.h')
-rw-r--r-- | intern/cycles/kernel/geom/point_intersect.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/intern/cycles/kernel/geom/point_intersect.h b/intern/cycles/kernel/geom/point_intersect.h index c7ae72bb488..ee5a564947b 100644 --- a/intern/cycles/kernel/geom/point_intersect.h +++ b/intern/cycles/kernel/geom/point_intersect.h @@ -9,8 +9,12 @@ CCL_NAMESPACE_BEGIN #ifdef __POINTCLOUD__ -ccl_device_forceinline bool point_intersect_test( - const float4 point, const float3 P, const float3 dir, const float tmax, ccl_private float *t) +ccl_device_forceinline bool point_intersect_test(const float4 point, + const float3 P, + const float3 dir, + const float tmin, + const float tmax, + ccl_private float *t) { const float3 center = float4_to_float3(point); const float radius = point.w; @@ -28,12 +32,12 @@ ccl_device_forceinline bool point_intersect_test( const float td = sqrt((r2 - l2) * rd2); const float t_front = projC0 - td; - const bool valid_front = (0.0f <= t_front) & (t_front <= tmax); + const bool valid_front = (tmin <= t_front) & (t_front <= tmax); /* Always back-face culling for now. */ # if 0 const float t_back = projC0 + td; - const bool valid_back = (0.0f <= t_back) & (t_back <= tmax); + const bool valid_back = (tmin <= t_back) & (t_back <= tmax); /* check if there is a first hit */ const bool valid_first = valid_front | valid_back; @@ -56,6 +60,7 @@ ccl_device_forceinline bool point_intersect(KernelGlobals kg, ccl_private Intersection *isect, const float3 P, const float3 dir, + const float tmin, const float tmax, const int object, const int prim, @@ -63,9 +68,9 @@ ccl_device_forceinline bool point_intersect(KernelGlobals kg, const int type) { const float4 point = (type & PRIMITIVE_MOTION) ? motion_point(kg, object, prim, time) : - kernel_tex_fetch(__points, prim); + kernel_data_fetch(points, prim); - if (!point_intersect_test(point, P, dir, tmax, &isect->t)) { + if (!point_intersect_test(point, P, dir, tmin, tmax, &isect->t)) { return false; } @@ -82,7 +87,7 @@ ccl_device_inline void point_shader_setup(KernelGlobals kg, ccl_private const Intersection *isect, ccl_private const Ray *ray) { - sd->shader = kernel_tex_fetch(__points_shader, isect->prim); + sd->shader = kernel_data_fetch(points_shader, isect->prim); sd->P = ray->P + ray->D * isect->t; /* Texture coordinates, zero for now. */ @@ -94,7 +99,7 @@ ccl_device_inline void point_shader_setup(KernelGlobals kg, /* Compute point center for normal. */ float3 center = float4_to_float3((isect->type & PRIMITIVE_MOTION) ? motion_point(kg, sd->object, sd->prim, sd->time) : - kernel_tex_fetch(__points, sd->prim)); + kernel_data_fetch(points, sd->prim)); if (!(sd->object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { object_position_transform_auto(kg, sd, ¢er); } |