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:
authorLukas Stockner <lukas.stockner@freenet.de>2016-10-29 19:54:42 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2016-10-29 20:24:08 +0300
commit1272ee455e7aeed3f6acb0b8a8366af5ad6aec99 (patch)
tree1ea02f9f80aea75403d78e898a6d2449d6331036 /intern/cycles/kernel/geom
parentd3b0977a354d91c363d7128f3e0ef2c5eea977e7 (diff)
Cycles: Implement texture coordinates for Point, Spot and Area Lamps
When using the Normal output of the Texture Coordinate node on Point and Spot lamps, the coordinates now depend on the rotation of the lamp. On Area lamps, the Parametric output of the Geometry node now returns UV coordinates on the area lamp. Credit for the Area lamp part goes to Stefan Werner (from D1995).
Diffstat (limited to 'intern/cycles/kernel/geom')
-rw-r--r--intern/cycles/kernel/geom/geom_object.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/intern/cycles/kernel/geom/geom_object.h b/intern/cycles/kernel/geom/geom_object.h
index 32900f7f27a..6b42f66b0d5 100644
--- a/intern/cycles/kernel/geom/geom_object.h
+++ b/intern/cycles/kernel/geom/geom_object.h
@@ -55,6 +55,21 @@ ccl_device_inline Transform object_fetch_transform(KernelGlobals *kg, int object
return tfm;
}
+/* Lamp to world space transformation */
+
+ccl_device_inline Transform lamp_fetch_transform(KernelGlobals *kg, int lamp, bool inverse)
+{
+ int offset = lamp*LIGHT_SIZE + (inverse? 8 : 5);
+
+ Transform tfm;
+ tfm.x = kernel_tex_fetch(__light_data, offset + 0);
+ tfm.y = kernel_tex_fetch(__light_data, offset + 1);
+ tfm.z = kernel_tex_fetch(__light_data, offset + 2);
+ tfm.w = make_float4(0.0f, 0.0f, 0.0f, 1.0f);
+
+ return tfm;
+}
+
/* Object to world space transformation for motion vectors */
ccl_device_inline Transform object_fetch_vector_transform(KernelGlobals *kg, int object, enum ObjectVectorTransform type)