diff options
Diffstat (limited to 'intern/cycles/kernel/geom/primitive.h')
-rw-r--r-- | intern/cycles/kernel/geom/primitive.h | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/intern/cycles/kernel/geom/primitive.h b/intern/cycles/kernel/geom/primitive.h index 6d7b550d82f..9416385638c 100644 --- a/intern/cycles/kernel/geom/primitive.h +++ b/intern/cycles/kernel/geom/primitive.h @@ -48,6 +48,11 @@ ccl_device_inline float primitive_surface_attribute_float(KernelGlobals kg, return curve_attribute_float(kg, sd, desc, dx, dy); } #endif +#ifdef __POINTCLOUD__ + else if (sd->type & PRIMITIVE_ALL_POINT) { + return point_attribute_float(kg, sd, desc, dx, dy); + } +#endif else { if (dx) *dx = 0.0f; @@ -74,6 +79,11 @@ ccl_device_inline float2 primitive_surface_attribute_float2(KernelGlobals kg, return curve_attribute_float2(kg, sd, desc, dx, dy); } #endif +#ifdef __POINTCLOUD__ + else if (sd->type & PRIMITIVE_ALL_POINT) { + return point_attribute_float2(kg, sd, desc, dx, dy); + } +#endif else { if (dx) *dx = make_float2(0.0f, 0.0f); @@ -100,6 +110,11 @@ ccl_device_inline float3 primitive_surface_attribute_float3(KernelGlobals kg, return curve_attribute_float3(kg, sd, desc, dx, dy); } #endif +#ifdef __POINTCLOUD__ + else if (sd->type & PRIMITIVE_ALL_POINT) { + return point_attribute_float3(kg, sd, desc, dx, dy); + } +#endif else { if (dx) *dx = make_float3(0.0f, 0.0f, 0.0f); @@ -126,6 +141,11 @@ ccl_device_forceinline float4 primitive_surface_attribute_float4(KernelGlobals k return curve_attribute_float4(kg, sd, desc, dx, dy); } #endif +#ifdef __POINTCLOUD__ + else if (sd->type & PRIMITIVE_ALL_POINT) { + return point_attribute_float4(kg, sd, desc, dx, dy); + } +#endif else { if (dx) *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f); @@ -225,8 +245,8 @@ ccl_device bool primitive_ptex(KernelGlobals kg, ccl_device float3 primitive_tangent(KernelGlobals kg, ccl_private ShaderData *sd) { -#ifdef __HAIR__ - if (sd->type & PRIMITIVE_ALL_CURVE) +#if defined(__HAIR__) || defined(__POINTCLOUD__) + if (sd->type & (PRIMITIVE_ALL_CURVE | PRIMITIVE_ALL_POINT)) # ifdef __DPDU__ return normalize(sd->dPdu); # else @@ -261,10 +281,21 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals kg, /* center position */ float3 center; -#ifdef __HAIR__ - bool is_curve_primitive = sd->type & PRIMITIVE_ALL_CURVE; - if (is_curve_primitive) { - center = curve_motion_center_location(kg, sd); +#if defined(__HAIR__) || defined(__POINTCLOUD__) + bool is_curve_or_point = sd->type & (PRIMITIVE_ALL_CURVE | PRIMITIVE_ALL_POINT); + if (is_curve_or_point) { + center = make_float3(0.0f, 0.0f, 0.0f); + + if (sd->type & PRIMITIVE_ALL_CURVE) { +# if defined(__HAIR__) + center = curve_motion_center_location(kg, sd); +# endif + } + else if (sd->type & PRIMITIVE_ALL_POINT) { +# if defined(__POINTCLOUD__) + center = point_motion_center_location(kg, sd); +# endif + } if (!(sd->object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { object_position_transform(kg, sd, ¢er); @@ -272,7 +303,9 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals kg, } else #endif + { center = sd->P; + } float3 motion_pre = center, motion_post = center; @@ -284,8 +317,8 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals kg, int numverts, numkeys; object_motion_info(kg, sd->object, NULL, &numverts, &numkeys); -#ifdef __HAIR__ - if (is_curve_primitive) { +#if defined(__HAIR__) || defined(__POINTCLOUD__) + if (is_curve_or_point) { motion_pre = float4_to_float3(curve_attribute_float4(kg, sd, desc, NULL, NULL)); desc.offset += numkeys; motion_post = float4_to_float3(curve_attribute_float4(kg, sd, desc, NULL, NULL)); |