Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-05 01:40:39 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-05 01:40:39 +0400
commitfedc8e17223cc5490d465788cac211328a712e5f (patch)
tree78fa4eb2ab6a50cc29dcb411272c71b24d971568 /intern/cycles/kernel/kernel_object.h
parent984e9f9cc8eee131c6602b326e588d2903eda90a (diff)
Cycles: add "From Dupli" option for texture coordinate node. This gets the
Generated and UV coordinates from the duplicator of instance instead of the object itself. This was used in e.g. Big Buck Bunny for texturing instanced feathers with a UV map on the bird. Many files changed, mainly to do some refactoring to get rid of G.rendering global in duplilist code.
Diffstat (limited to 'intern/cycles/kernel/kernel_object.h')
-rw-r--r--intern/cycles/kernel/kernel_object.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_object.h b/intern/cycles/kernel/kernel_object.h
index 222ade504cc..01da5050c8d 100644
--- a/intern/cycles/kernel/kernel_object.h
+++ b/intern/cycles/kernel/kernel_object.h
@@ -23,7 +23,8 @@ enum ObjectTransform {
OBJECT_INVERSE_TRANSFORM = 3,
OBJECT_PROPERTIES = 6,
OBJECT_TRANSFORM_MOTION_PRE = 8,
- OBJECT_TRANSFORM_MOTION_POST = 12
+ OBJECT_TRANSFORM_MOTION_POST = 12,
+ OBJECT_DUPLI = 16
};
__device_inline Transform object_fetch_transform(KernelGlobals *kg, int object, float time, enum ObjectTransform type)
@@ -164,6 +165,27 @@ __device_inline uint object_particle_id(KernelGlobals *kg, int object)
return __float_as_int(f.w);
}
+__device_inline float3 object_dupli_generated(KernelGlobals *kg, int object)
+{
+ if(object == ~0)
+ return make_float3(0.0f, 0.0f, 0.0f);
+
+ int offset = object*OBJECT_SIZE + OBJECT_DUPLI;
+ float4 f = kernel_tex_fetch(__objects, offset);
+ return make_float3(f.x, f.y, f.z);
+}
+
+__device_inline float3 object_dupli_uv(KernelGlobals *kg, int object)
+{
+ if(object == ~0)
+ return make_float3(0.0f, 0.0f, 0.0f);
+
+ int offset = object*OBJECT_SIZE + OBJECT_DUPLI;
+ float4 f = kernel_tex_fetch(__objects, offset + 1);
+ return make_float3(f.x, f.y, 0.0f);
+}
+
+
__device int shader_pass_id(KernelGlobals *kg, ShaderData *sd)
{
return kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2 + 1);