diff options
Diffstat (limited to 'intern/cycles/kernel/svm/svm_geometry.h')
-rw-r--r-- | intern/cycles/kernel/svm/svm_geometry.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/intern/cycles/kernel/svm/svm_geometry.h b/intern/cycles/kernel/svm/svm_geometry.h index 77fe26c809e..dab19983946 100644 --- a/intern/cycles/kernel/svm/svm_geometry.h +++ b/intern/cycles/kernel/svm/svm_geometry.h @@ -74,5 +74,25 @@ __device void svm_node_geometry_bump_dy(ShaderData *sd, float *stack, uint type, #endif } +/* Object Info */ + +__device void svm_node_object_info(KernelGlobals *kg, ShaderData *sd, float *stack, uint type, uint out_offset) +{ + float data; + + switch(type) { + case NODE_INFO_OB_LOCATION: { + stack_store_float3(stack, out_offset, object_location(kg, sd)); + return; + } + case NODE_INFO_OB_INDEX: data = object_pass_id(kg, sd->object); break; + case NODE_INFO_MAT_INDEX: data = shader_pass_id(kg, sd); break; + case NODE_INFO_OB_RANDOM: data = object_random_number(kg, sd->object); break; + default: data = 0.0f; break; + } + + stack_store_float(stack, out_offset, data); +} + CCL_NAMESPACE_END |