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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-17 16:17:17 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-17 16:17:17 +0400
commitafb75ad2af0c30f1bc6fd252ca115a59d04e3b85 (patch)
treebf26823ca7542e7b5cd2e455fa551006d6be4500 /intern/cycles/render/nodes.cpp
parent0551aa14bb2e58e79200823cde6d71c2288ca7fa (diff)
Cycles: add Tangent input for Anisotropic BSDF.
Also refactor SVM BSDF code, preparing it to be shared with OSL.
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r--intern/cycles/render/nodes.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index b4ef93a4ff8..0bd24f71930 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -1184,6 +1184,7 @@ void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *
{
ShaderInput *color_in = input("Color");
ShaderInput *normal_in = input("Normal");
+ ShaderInput *tangent_in = input("Tangent");
if(color_in->link) {
compiler.stack_assign(color_in);
@@ -1207,7 +1208,16 @@ void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *
if(normal_in->link)
compiler.stack_assign(normal_in);
- compiler.add_node(NODE_CLOSURE_BSDF, normal_in->stack_offset);
+
+ if(tangent_in) {
+ if(tangent_in->link)
+ compiler.stack_assign(tangent_in);
+
+ compiler.add_node(NODE_CLOSURE_BSDF, normal_in->stack_offset, tangent_in->stack_offset);
+ }
+ else {
+ compiler.add_node(NODE_CLOSURE_BSDF, normal_in->stack_offset);
+ }
}
void BsdfNode::compile(SVMCompiler& compiler)
@@ -1246,15 +1256,6 @@ void WardBsdfNode::compile(SVMCompiler& compiler)
{
ShaderInput *tangent_in = input("Tangent");
- if(tangent_in->link) {
- int attr = compiler.attribute(ATTR_STD_TANGENT);
- compiler.stack_assign(tangent_in);
- compiler.add_node(NODE_ATTR, attr, tangent_in->stack_offset, NODE_ATTR_FLOAT3);
- compiler.add_node(NODE_CLOSURE_TANGENT, tangent_in->stack_offset);
- }
- else
- compiler.add_node(NODE_CLOSURE_SET_TANGENT, tangent_in->value);
-
BsdfNode::compile(compiler, input("Roughness U"), input("Roughness V"));
}