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:
authorThomas Dinges <blender@dingto.org>2013-06-23 21:51:08 +0400
committerThomas Dinges <blender@dingto.org>2013-06-23 21:51:08 +0400
commite4ef608020e3d77f05ec869e598dfa42d525da66 (patch)
tree4fb9f4908a00e6a255b5f878563cf83972a43c2d /intern/cycles/kernel/shaders
parent230f4e7ca2f4861c6bc828f5f0c618a7988607f0 (diff)
Cycles / Vector Transform Node:
* Implementation of Vector Transform Node into Cycles. * OSL backend is done, SVM needs the matrices still.
Diffstat (limited to 'intern/cycles/kernel/shaders')
-rw-r--r--intern/cycles/kernel/shaders/CMakeLists.txt1
-rw-r--r--intern/cycles/kernel/shaders/node_vector_transform.osl50
2 files changed, 51 insertions, 0 deletions
diff --git a/intern/cycles/kernel/shaders/CMakeLists.txt b/intern/cycles/kernel/shaders/CMakeLists.txt
index f8454d3ad40..db20dd43ca7 100644
--- a/intern/cycles/kernel/shaders/CMakeLists.txt
+++ b/intern/cycles/kernel/shaders/CMakeLists.txt
@@ -64,6 +64,7 @@ set(SRC_OSL
node_value.osl
node_vector_curves.osl
node_vector_math.osl
+ node_vector_transform.osl
node_velvet_bsdf.osl
node_voronoi_texture.osl
node_ward_bsdf.osl
diff --git a/intern/cycles/kernel/shaders/node_vector_transform.osl b/intern/cycles/kernel/shaders/node_vector_transform.osl
new file mode 100644
index 00000000000..ae0cb1c7a49
--- /dev/null
+++ b/intern/cycles/kernel/shaders/node_vector_transform.osl
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2013, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_vector_transform(
+ string type = "Vector",
+ string convert_from = "World",
+ string convert_to = "Object",
+ vector VectorIn = vector(0.0, 0.0, 0.0),
+ output vector VectorOut = vector(0.0, 0.0, 0.0))
+{
+ /* OSL uses lower case variable names here */
+ string from = "world";
+ string to = "object";
+
+ if (convert_from == "Object")
+ from = "object";
+ else if (convert_from == "Camera")
+ from = "camera";
+
+ if (convert_to == "World")
+ to = "world";
+ else if (convert_to == "Camera")
+ to = "camera";
+
+ if (type == "Vector") {
+ VectorOut = transform(from, to, VectorIn);
+ }
+ else if (type == "Point") {
+ point Point = point(VectorIn[0], VectorIn[1], VectorIn[2]);
+ VectorOut = transform(from, to, Point);
+ }
+}
+