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:
Diffstat (limited to 'intern/cycles/render/graph.cpp')
-rw-r--r--intern/cycles/render/graph.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 749640040f5..7e6e960d585 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -266,7 +266,10 @@ void ShaderGraph::relink(vector<ShaderInput*> inputs, vector<ShaderInput*> outpu
}
}
-void ShaderGraph::finalize(bool do_bump, bool do_osl)
+void ShaderGraph::finalize(Scene *scene,
+ bool do_bump,
+ bool do_osl,
+ bool do_simplify)
{
/* before compiling, the shader graph may undergo a number of modifications.
* currently we set default geometry shader inputs, and create automatic bump
@@ -274,7 +277,7 @@ void ShaderGraph::finalize(bool do_bump, bool do_osl)
* modified afterwards. */
if(!finalized) {
- clean();
+ clean(scene);
default_inputs(do_osl);
refine_bump_nodes();
@@ -293,6 +296,9 @@ void ShaderGraph::finalize(bool do_bump, bool do_osl)
finalized = true;
}
+ else if(do_simplify) {
+ simplify_nodes(scene);
+ }
}
void ShaderGraph::find_dependencies(set<ShaderNode*>& dependencies, ShaderInput *input)
@@ -557,10 +563,10 @@ void ShaderGraph::remove_unneeded_nodes()
}
/* Step 3: Simplification.*/
-void ShaderGraph::simplify_nodes()
+void ShaderGraph::simplify_nodes(Scene *scene)
{
foreach(ShaderNode *node, nodes) {
- node->optimize();
+ node->optimize(scene);
}
}
@@ -588,7 +594,7 @@ void ShaderGraph::break_cycles(ShaderNode *node, vector<bool>& visited, vector<b
on_stack[node->id] = false;
}
-void ShaderGraph::clean()
+void ShaderGraph::clean(Scene *scene)
{
/* Graph simplification:
* 1: Remove unnecesarry nodes
@@ -604,7 +610,7 @@ void ShaderGraph::clean()
/* TODO(dingto): Implement */
/* 3: Simplification. */
- simplify_nodes();
+ simplify_nodes(scene);
/* 4: De-duplication. */
/* TODO(dingto): Implement */