diff options
Diffstat (limited to 'intern/cycles/bvh/bvh_node.cpp')
-rw-r--r-- | intern/cycles/bvh/bvh_node.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/intern/cycles/bvh/bvh_node.cpp b/intern/cycles/bvh/bvh_node.cpp index 7cc9bd333b0..8294690da7d 100644 --- a/intern/cycles/bvh/bvh_node.cpp +++ b/intern/cycles/bvh/bvh_node.cpp @@ -47,6 +47,20 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const case BVH_STAT_CHILDNODE_COUNT: cnt = num_children(); break; + case BVH_STAT_QNODE_COUNT: + cnt = 1; + for(int i = 0; i < num_children(); i++) { + BVHNode *node = get_child(i); + if(node->is_leaf()) { + cnt += 1; + } + else { + for(int j = 0; j < node->num_children(); j++) { + cnt += node->get_child(j)->getSubtreeSize(stat); + } + } + } + return cnt; default: assert(0); /* unknown mode */ } |