diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-01-03 16:08:54 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-01-03 16:08:54 +0400 |
commit | 57cf48e7c6fd04f864072c21433a822907774f78 (patch) | |
tree | 45f3fa51f532a03e25c4d8ffa0c1be58027d01b2 /intern/cycles/render/nodes.cpp | |
parent | 8ca977b16e745f716d044a5b6ccbb5be4a70ac94 (diff) |
Cycles Hair: refactoring to support generic attributes for hair curves. There
should be no functional changes yet. UV, tangent and intercept are now stored
as attributes, with the intention to add more like multiple uv's, vertex
colors, generated coordinates and motion vectors later.
Things got a bit messy due to having both triangle and curve data in the same
mesh data structure, which also gives us two sets of attributes. This will get
cleaned up when we split the mesh class.
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r-- | intern/cycles/render/nodes.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 13e9ae81cf0..14ef3c68ad3 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -2251,6 +2251,16 @@ HairInfoNode::HairInfoNode() add_output("Tangent Normal", SHADER_SOCKET_NORMAL); } +void HairInfoNode::attributes(AttributeRequestSet *attributes) +{ + ShaderOutput *intercept_out = output("Intercept"); + + if(!intercept_out->links.empty()) + attributes->add(ATTR_STD_CURVE_INTERCEPT); + + ShaderNode::attributes(attributes); +} + void HairInfoNode::compile(SVMCompiler& compiler) { ShaderOutput *out; @@ -2263,8 +2273,9 @@ void HairInfoNode::compile(SVMCompiler& compiler) out = output("Intercept"); if(!out->links.empty()) { + int attr = compiler.attribute(ATTR_STD_CURVE_INTERCEPT); compiler.stack_assign(out); - compiler.add_node(NODE_HAIR_INFO, NODE_INFO_CURVE_INTERCEPT, out->stack_offset); + compiler.add_node(NODE_ATTR, attr, out->stack_offset, NODE_ATTR_FLOAT); } out = output("Thickness"); |