diff options
Diffstat (limited to 'intern/cycles/bvh/bvh_split.cpp')
-rw-r--r-- | intern/cycles/bvh/bvh_split.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/intern/cycles/bvh/bvh_split.cpp b/intern/cycles/bvh/bvh_split.cpp index 9185bd99d10..8084975565e 100644 --- a/intern/cycles/bvh/bvh_split.cpp +++ b/intern/cycles/bvh/bvh_split.cpp @@ -44,6 +44,8 @@ BVHObjectSplit::BVHObjectSplit(BVHBuild *builder, const BVHReference *ref_ptr = &references_->at(range.start()); float min_sah = FLT_MAX; + storage_->right_bounds.resize(range.size()); + for(int dim = 0; dim < 3; dim++) { /* Sort references. */ bvh_reference_sort(range.start(), @@ -53,8 +55,6 @@ BVHObjectSplit::BVHObjectSplit(BVHBuild *builder, /* sweep right to left and determine bounds. */ BoundBox right_bounds = BoundBox::empty; - - storage_->right_bounds.resize(range.size()); for(int i = range.size() - 1; i > 0; i--) { right_bounds.grow(ref_ptr[i].bounds()); storage_->right_bounds[i - 1] = right_bounds; @@ -157,11 +157,10 @@ BVHSpatialSplit::BVHSpatialSplit(const BVHBuild& builder, } /* select best split plane. */ + storage_->right_bounds.resize(BVHParams::NUM_SPATIAL_BINS); for(int dim = 0; dim < 3; dim++) { /* sweep right to left and determine bounds. */ BoundBox right_bounds = BoundBox::empty; - - storage_->right_bounds.resize(BVHParams::NUM_SPATIAL_BINS); for(int i = BVHParams::NUM_SPATIAL_BINS - 1; i > 0; i--) { right_bounds.grow(storage_->bins[dim][i].bounds); storage_->right_bounds[i - 1] = right_bounds; |