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>2014-06-13 23:44:48 +0400
committerThomas Dinges <blender@dingto.org>2014-06-13 23:59:14 +0400
commit3de3987ea190415d0d088c3917b45f44afb43840 (patch)
tree35577ec3798ee74ee4c37821ec74981b3c9d7342 /intern/cycles/kernel/svm
parent49df707496e505c8a8b21c1ea36b479e950cc66c (diff)
Cycles: Add dedicated nodes to split/combine vectors.
This was already possible via the RGB nodes, but that seems weird.
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r--intern/cycles/kernel/svm/svm.h7
-rw-r--r--intern/cycles/kernel/svm/svm_sepcomb_xyz.h42
-rw-r--r--intern/cycles/kernel/svm/svm_types.h2
3 files changed, 51 insertions, 0 deletions
diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h
index 6d556a66afa..acdc5183e18 100644
--- a/intern/cycles/kernel/svm/svm.h
+++ b/intern/cycles/kernel/svm/svm.h
@@ -169,6 +169,7 @@ CCL_NAMESPACE_END
#include "svm_ramp.h"
#include "svm_sepcomb_rgb.h"
#include "svm_sepcomb_hsv.h"
+#include "svm_sepcomb_xyz.h"
#include "svm_musgrave.h"
#include "svm_sky.h"
#include "svm_tex_coord.h"
@@ -333,6 +334,12 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, Shade
case NODE_COMBINE_RGB:
svm_node_combine_rgb(sd, stack, node.y, node.z, node.w);
break;
+ case NODE_SEPARATE_XYZ:
+ svm_node_separate_xyz(sd, stack, node.y, node.z, node.w);
+ break;
+ case NODE_COMBINE_XYZ:
+ svm_node_combine_xyz(sd, stack, node.y, node.z, node.w);
+ break;
case NODE_SEPARATE_HSV:
svm_node_separate_hsv(kg, sd, stack, node.y, node.z, node.w, &offset);
break;
diff --git a/intern/cycles/kernel/svm/svm_sepcomb_xyz.h b/intern/cycles/kernel/svm/svm_sepcomb_xyz.h
new file mode 100644
index 00000000000..f9f966451fd
--- /dev/null
+++ b/intern/cycles/kernel/svm/svm_sepcomb_xyz.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2011-2014 Blender Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+CCL_NAMESPACE_BEGIN
+
+ccl_device void svm_node_combine_xyz(ShaderData *sd, float *stack, uint in_offset, uint vector_index, uint out_offset)
+{
+ float vector = stack_load_float(stack, in_offset);
+
+ if (stack_valid(out_offset))
+ stack_store_float(stack, out_offset+vector_index, vector);
+}
+
+ccl_device void svm_node_separate_xyz(ShaderData *sd, float *stack, uint ivector_offset, uint vector_index, uint out_offset)
+{
+ float3 vector = stack_load_float3(stack, ivector_offset);
+
+ if (stack_valid(out_offset)) {
+ if (vector_index == 0)
+ stack_store_float(stack, out_offset, vector.x);
+ else if (vector_index == 1)
+ stack_store_float(stack, out_offset, vector.y);
+ else
+ stack_store_float(stack, out_offset, vector.z);
+ }
+}
+
+CCL_NAMESPACE_END
+
diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h
index fda035fdbe0..29a0d264237 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -80,6 +80,8 @@ typedef enum NodeType {
NODE_CLOSURE_VOLUME,
NODE_SEPARATE_RGB,
NODE_COMBINE_RGB,
+ NODE_SEPARATE_XYZ,
+ NODE_COMBINE_XYZ,
NODE_SEPARATE_HSV,
NODE_COMBINE_HSV,
NODE_HSV,