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/bvh/bvh_node.h')
-rw-r--r--intern/cycles/bvh/bvh_node.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/intern/cycles/bvh/bvh_node.h b/intern/cycles/bvh/bvh_node.h
index 5e0a17a1193..5c00f7b7a38 100644
--- a/intern/cycles/bvh/bvh_node.h
+++ b/intern/cycles/bvh/bvh_node.h
@@ -49,8 +49,6 @@ public:
virtual int num_triangles() const { return 0; }
virtual void print(int depth = 0) const = 0;
- float getArea() const { return m_bounds.area(); }
-
BoundBox m_bounds;
uint m_visibility;
@@ -58,6 +56,8 @@ public:
int getSubtreeSize(BVH_STAT stat=BVH_STAT_NODE_COUNT) const;
float computeSubtreeSAHCost(const BVHParams& p, float probability = 1.0f) const;
void deleteSubtree();
+
+ uint update_visibility();
};
class InnerNode : public BVHNode
@@ -66,9 +66,21 @@ public:
InnerNode(const BoundBox& bounds, BVHNode* child0, BVHNode* child1)
{
m_bounds = bounds;
- m_visibility = child0->m_visibility|child1->m_visibility;
children[0] = child0;
children[1] = child1;
+
+ if(child0 && child1)
+ m_visibility = child0->m_visibility|child1->m_visibility;
+ else
+ m_visibility = 0; /* happens on build cancel */
+ }
+
+ InnerNode(const BoundBox& bounds)
+ {
+ m_bounds = bounds;
+ m_visibility = 0;
+ children[0] = NULL;
+ children[1] = NULL;
}
bool is_leaf() const { return false; }