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:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-05-09 17:11:37 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-05-09 17:13:32 +0300
commit5068f7dc015eb66a292d0027b3268f535201b3af (patch)
tree566626a56175182e68ebea7c4ea536e440ea1c16 /intern/cycles/render/graph.cpp
parentb3299bace003d9d061b188760a263ca7b42c36d7 (diff)
Cycles: Add utility function to graph to query number of closures used in it
Currently unused but will be needed soon for the split kernel work.
Diffstat (limited to 'intern/cycles/render/graph.cpp')
-rw-r--r--intern/cycles/render/graph.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index b36cbb5ea6f..ab89ee3ae37 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -833,6 +833,26 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
}
}
+int ShaderGraph::get_num_closures()
+{
+ int num_closures = 0;
+ foreach(ShaderNode *node, nodes) {
+ if(node->special_type == SHADER_SPECIAL_TYPE_CLOSURE) {
+ BsdfNode *bsdf_node = static_cast<BsdfNode*>(node);
+ /* TODO(sergey): Make it more generic approach, maybe some utility
+ * macros like CLOSURE_IS_FOO()?
+ */
+ if(CLOSURE_IS_BSSRDF(bsdf_node->closure))
+ num_closures = num_closures + 3;
+ else if(CLOSURE_IS_GLASS(bsdf_node->closure))
+ num_closures = num_closures + 2;
+ else
+ num_closures = num_closures + 1;
+ }
+ }
+ return num_closures;
+}
+
void ShaderGraph::dump_graph(const char *filename)
{
FILE *fd = fopen(filename, "w");