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-08-01 01:27:48 +0400
committerThomas Dinges <blender@dingto.org>2013-08-01 01:27:48 +0400
commit2a2f0319bc1e9c16331f356730a1edb837f4056b (patch)
treec306be867a197ad2201ec158865111a7fc65f962 /intern/cycles/render/nodes.cpp
parent34009da32efcea87e80c6205c9a152ad3f30bbb7 (diff)
parent285ef99931447646b20ec968ec87f7c68939a104 (diff)
Cycles / HSV Separator and Combine node:
* Added nodes to separate and combine hsv colors. Part of my GSoC 2013 project, SVN merge of r57981.
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r--intern/cycles/render/nodes.cpp65
1 files changed, 64 insertions, 1 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index bd718ed51e5..b5107315d4c 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -2651,6 +2651,37 @@ void CombineRGBNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_combine_rgb");
}
+/* Combine HSV */
+CombineHSVNode::CombineHSVNode()
+: ShaderNode("combine_hsv")
+{
+ add_input("H", SHADER_SOCKET_FLOAT);
+ add_input("S", SHADER_SOCKET_FLOAT);
+ add_input("V", SHADER_SOCKET_FLOAT);
+ add_output("Color", SHADER_SOCKET_COLOR);
+}
+
+void CombineHSVNode::compile(SVMCompiler& compiler)
+{
+ ShaderInput *hue_in = input("H");
+ ShaderInput *saturation_in = input("S");
+ ShaderInput *value_in = input("V");
+ ShaderOutput *color_out = output("Color");
+
+ compiler.stack_assign(color_out);
+ compiler.stack_assign(hue_in);
+ compiler.stack_assign(saturation_in);
+ compiler.stack_assign(value_in);
+
+ compiler.add_node(NODE_COMBINE_HSV, hue_in->stack_offset, saturation_in->stack_offset, value_in->stack_offset);
+ compiler.add_node(NODE_COMBINE_HSV, color_out->stack_offset);
+}
+
+void CombineHSVNode::compile(OSLCompiler& compiler)
+{
+ compiler.add(this, "node_combine_hsv");
+}
+
/* Gamma */
GammaNode::GammaNode()
: ShaderNode("gamma")
@@ -2744,7 +2775,39 @@ void SeparateRGBNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_separate_rgb");
}
-/* Separate RGB */
+/* Separate HSV */
+SeparateHSVNode::SeparateHSVNode()
+: ShaderNode("separate_rgb")
+{
+ add_input("Color", SHADER_SOCKET_COLOR);
+ add_output("H", SHADER_SOCKET_FLOAT);
+ add_output("S", SHADER_SOCKET_FLOAT);
+ add_output("V", SHADER_SOCKET_FLOAT);
+}
+
+void SeparateHSVNode::compile(SVMCompiler& compiler)
+{
+ ShaderInput *color_in = input("Color");
+ ShaderOutput *hue_out = output("H");
+ ShaderOutput *saturation_out = output("S");
+ ShaderOutput *value_out = output("V");
+
+ compiler.stack_assign(color_in);
+ compiler.stack_assign(hue_out);
+ compiler.stack_assign(saturation_out);
+ compiler.stack_assign(value_out);
+
+ compiler.add_node(NODE_SEPARATE_HSV, color_in->stack_offset, hue_out->stack_offset, saturation_out->stack_offset);
+ compiler.add_node(NODE_SEPARATE_HSV, value_out->stack_offset);
+
+}
+
+void SeparateHSVNode::compile(OSLCompiler& compiler)
+{
+ compiler.add(this, "node_separate_hsv");
+}
+
+/* Hue Saturation Value */
HSVNode::HSVNode()
: ShaderNode("hsv")
{