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:
authorDalai Felinto <dfelinto@gmail.com>2011-12-17 00:35:06 +0400
committerDalai Felinto <dfelinto@gmail.com>2011-12-17 00:35:06 +0400
commit2a6fdbcccdb285664d921d59f66f96d0345124de (patch)
tree3d7b8d41a05318d43821efe43548ac8df5162d78 /intern/cycles/render/nodes.cpp
parent3311164b24da61f2967f96d0ee27508a7e2e0267 (diff)
Cycles Gamma Node
Node specially useful for Texture correction. This is also a nice example of a simple node made from scratch in case someone wants to create their custom nodes. Review by Brecht.
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r--intern/cycles/render/nodes.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index aec6f1f3e26..5cabb248709 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -1726,6 +1726,33 @@ void CombineRGBNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_combine_rgb");
}
+/* Gamma */
+GammaNode::GammaNode()
+: ShaderNode("gamma")
+{
+ add_input("Color", SHADER_SOCKET_COLOR);
+ add_input("Gamma", SHADER_SOCKET_FLOAT);
+ add_output("Color", SHADER_SOCKET_COLOR);
+}
+
+void GammaNode::compile(SVMCompiler& compiler)
+{
+ ShaderInput *color_in = input("Color");
+ ShaderInput *gamma_in = input("Gamma");
+ ShaderOutput *color_out = output("Color");
+
+ compiler.stack_assign(color_in);
+ compiler.stack_assign(gamma_in);
+ compiler.stack_assign(color_out);
+
+ compiler.add_node(NODE_GAMMA, gamma_in->stack_offset, color_in->stack_offset, color_out->stack_offset);
+}
+
+void GammaNode::compile(OSLCompiler& compiler)
+{
+ compiler.add(this, "node_gamma");
+}
+
/* Separate RGB */
SeparateRGBNode::SeparateRGBNode()
: ShaderNode("separate_rgb")