diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-03-17 14:54:19 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-03-17 14:54:19 +0300 |
commit | e69192968616b17709e6a3bd0d2dc59d463c52ba (patch) | |
tree | 4018a1dc7f631ad340b11c0b738fade9f24d0c6e /intern/cycles/render/shader.cpp | |
parent | 0af22625c9f9357e873160d265b9eae4a43a549d (diff) | |
parent | 9d2397c710af9180e7e2ec6db42e8513390b4ab1 (diff) |
Merge branch 'blender2.7'
Diffstat (limited to 'intern/cycles/render/shader.cpp')
-rw-r--r-- | intern/cycles/render/shader.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 21bac460255..3c94f2dfb59 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -220,20 +220,37 @@ bool Shader::is_constant_emission(float3 *emission) { ShaderInput *surf = graph->output()->input("Surface"); - if(!surf->link || surf->link->parent->type != EmissionNode::node_type) { + if(surf->link == NULL) { return false; } - EmissionNode *node = (EmissionNode*) surf->link->parent; + if(surf->link->parent->type == EmissionNode::node_type) { + EmissionNode *node = (EmissionNode*) surf->link->parent; - assert(node->input("Color")); - assert(node->input("Strength")); + assert(node->input("Color")); + assert(node->input("Strength")); - if(node->input("Color")->link || node->input("Strength")->link) { - return false; + if(node->input("Color")->link || node->input("Strength")->link) { + return false; + } + + *emission = node->color*node->strength; } + else if(surf->link->parent->type == BackgroundNode::node_type) { + BackgroundNode *node = (BackgroundNode*) surf->link->parent; - *emission = node->color*node->strength; + assert(node->input("Color")); + assert(node->input("Strength")); + + if(node->input("Color")->link || node->input("Strength")->link) { + return false; + } + + *emission = node->color*node->strength; + } + else { + return false; + } return true; } |