diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2015-12-29 16:42:49 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2016-01-02 01:25:37 +0300 |
commit | 5c682a901b2ae9acf656f19e5f9b470d957d71cc (patch) | |
tree | 18ffa9d0ed4164ce601c285c700642a26a3c6eb9 /intern/cycles/render | |
parent | 1991ee173865ed79a78b50afc3f7a46af472e9dd (diff) |
Cycles: Add Saw option to the wave texture
This commit adds "Bands Saw" and "Rings Saw" to the options for the Wave texture node in Cycles, behaving similar to the Saw option in BI textures.
Requested by @cekuhnen on BA.
Reviewers: dingto, sergey
Subscribers: cekuhnen
Differential Revision: https://developer.blender.org/D1699
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/nodes.cpp | 16 | ||||
-rw-r--r-- | intern/cycles/render/nodes.h | 5 |
2 files changed, 19 insertions, 2 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 92ade79781a..e35c4a9dd46 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -1073,12 +1073,24 @@ static ShaderEnum wave_type_init() return enm; } +static ShaderEnum wave_profile_init() +{ + ShaderEnum enm; + + enm.insert("Sine", NODE_WAVE_PROFILE_SIN); + enm.insert("Saw", NODE_WAVE_PROFILE_SAW); + + return enm; +} + ShaderEnum WaveTextureNode::type_enum = wave_type_init(); +ShaderEnum WaveTextureNode::profile_enum = wave_profile_init(); WaveTextureNode::WaveTextureNode() : TextureNode("wave_texture") { type = ustring("Bands"); + profile = ustring("Sine"); add_input("Scale", SHADER_SOCKET_FLOAT, 1.0f); add_input("Distortion", SHADER_SOCKET_FLOAT, 0.0f); @@ -1120,7 +1132,8 @@ void WaveTextureNode::compile(SVMCompiler& compiler) compiler.add_node(NODE_TEX_WAVE, compiler.encode_uchar4(type_enum[type], color_out->stack_offset, fac_out->stack_offset, dscale_in->stack_offset), - compiler.encode_uchar4(vector_offset, scale_in->stack_offset, detail_in->stack_offset, distortion_in->stack_offset)); + compiler.encode_uchar4(vector_offset, scale_in->stack_offset, detail_in->stack_offset, distortion_in->stack_offset), + profile_enum[profile]); compiler.add_node( __float_as_int(scale_in->value.x), @@ -1137,6 +1150,7 @@ void WaveTextureNode::compile(OSLCompiler& compiler) tex_mapping.compile(compiler); compiler.parameter("Type", type); + compiler.parameter("Profile", profile); compiler.add(this, "node_wave_texture"); } diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index 67943775b92..cede4205a6a 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -267,12 +267,15 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } ustring type; + ustring profile; static ShaderEnum type_enum; + static ShaderEnum profile_enum; virtual bool equals(const ShaderNode *other) { const WaveTextureNode *wave_node = (const WaveTextureNode*)other; return TextureNode::equals(other) && - type == wave_node->type; + type == wave_node->type && + profile == wave_node->profile; } }; |