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-07-04 03:46:56 +0400
committerThomas Dinges <blender@dingto.org>2013-07-04 03:46:56 +0400
commit285ef99931447646b20ec968ec87f7c68939a104 (patch)
tree52c8b276b800baef886cf0867ad1a99554503ea2 /intern/cycles/render/nodes.cpp
parente7fc69bdfd06f9fda7ddbcf53f26fee0b81abf8d (diff)
Cycles:
* Added 2 new nodes to combine and separate HSV colors. Screenshot: http://www.pasteall.org/pic/show.php?id=54828
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 3fbcadee423..319d8210377 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -2644,6 +2644,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")
@@ -2737,7 +2768,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")
{