~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/cycles/bvh/bvh_node.cpp

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
CCL_NAMESPACE_BEGIN
26
26
 
 
27
/* BVH Node */
 
28
 
27
29
int BVHNode::getSubtreeSize(BVH_STAT stat) const
28
30
{
29
31
        int cnt = 0;
50
52
        }
51
53
 
52
54
        if(!is_leaf())
53
 
                for(int i=0;i<num_children();i++)
 
55
                for(int i = 0; i < num_children(); i++)
54
56
                        cnt += get_child(i)->getSubtreeSize(stat);
55
57
 
56
58
        return cnt;
58
60
 
59
61
void BVHNode::deleteSubtree()
60
62
{
61
 
        for(int i=0;i<num_children();i++)
62
 
                get_child(i)->deleteSubtree();
 
63
        for(int i = 0; i < num_children(); i++)
 
64
                if(get_child(i))
 
65
                        get_child(i)->deleteSubtree();
63
66
 
64
67
        delete this;
65
68
}
68
71
{
69
72
        float SAH = probability * p.cost(num_children(), num_triangles());
70
73
 
71
 
        for(int i=0;i<num_children();i++) {
 
74
        for(int i = 0; i < num_children(); i++) {
72
75
                BVHNode *child = get_child(i);
73
 
                SAH += child->computeSubtreeSAHCost(p, probability * child->m_bounds.area()/m_bounds.area());
 
76
                SAH += child->computeSubtreeSAHCost(p, probability * child->m_bounds.safe_area()/m_bounds.safe_area());
74
77
        }
75
78
 
76
79
        return SAH;
77
80
}
78
81
 
 
82
uint BVHNode::update_visibility()
 
83
{
 
84
        if(!is_leaf() && m_visibility == 0) {
 
85
                InnerNode *inner = (InnerNode*)this;
 
86
                BVHNode *child0 = inner->children[0];
 
87
                BVHNode *child1 = inner->children[1];
 
88
 
 
89
                m_visibility = child0->update_visibility()|child1->update_visibility();
 
90
        }
 
91
 
 
92
        return m_visibility;
 
93
}
 
94
 
 
95
/* Inner Node */
 
96
 
79
97
void InnerNode::print(int depth) const
80
98
{
81
99
        for(int i = 0; i < depth; i++)