diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2017-08-23 07:40:35 +0300 |
---|---|---|
committer | Mai Lavelle <mai.lavelle@gmail.com> | 2017-08-23 13:54:26 +0300 |
commit | 579edb1510d22571b5e10a55d1cc7be9d6fcf9f8 (patch) | |
tree | cb380160a249453ad83cbd16d8eeeec904657b7c /intern/cycles/bvh/bvh_node.cpp | |
parent | 2540741dee789f752687198c6f272a995d45073e (diff) |
Cycles: Add maximum depth stat to bvh builder
Diffstat (limited to 'intern/cycles/bvh/bvh_node.cpp')
-rw-r--r-- | intern/cycles/bvh/bvh_node.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/intern/cycles/bvh/bvh_node.cpp b/intern/cycles/bvh/bvh_node.cpp index 4237c62ab5b..ab6df4d265d 100644 --- a/intern/cycles/bvh/bvh_node.cpp +++ b/intern/cycles/bvh/bvh_node.cpp @@ -132,6 +132,17 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const case BVH_STAT_UNALIGNED_LEAF_COUNT: cnt = (is_leaf() && is_unaligned) ? 1 : 0; break; + case BVH_STAT_DEPTH: + if(is_leaf()) { + cnt = 1; + } + else { + for(int i = 0; i < num_children(); i++) { + cnt = max(cnt, get_child(i)->getSubtreeSize(stat)); + } + cnt += 1; + } + return cnt; default: assert(0); /* unknown mode */ } |