diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2011-12-17 00:35:06 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2011-12-17 00:35:06 +0400 |
commit | 2a6fdbcccdb285664d921d59f66f96d0345124de (patch) | |
tree | 3d7b8d41a05318d43821efe43548ac8df5162d78 /intern/cycles/render | |
parent | 3311164b24da61f2967f96d0ee27508a7e2e0267 (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')
-rw-r--r-- | intern/cycles/render/nodes.cpp | 27 | ||||
-rw-r--r-- | intern/cycles/render/nodes.h | 5 |
2 files changed, 32 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") diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index 9d947de1af5..28fff22fc34 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -302,6 +302,11 @@ public: SHADER_NODE_CLASS(CombineRGBNode) }; +class GammaNode : public ShaderNode { +public: + SHADER_NODE_CLASS(GammaNode) +}; + class SeparateRGBNode : public ShaderNode { public: SHADER_NODE_CLASS(SeparateRGBNode) |