diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-01 18:44:08 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-01 18:45:59 +0300 |
commit | 0f6f9218985957aace8ae2135ac91133fb4370d9 (patch) | |
tree | fd2cb217a7f4106301294e8a50b48572cb82d9fa /intern/cycles/bvh/bvh_sort.cpp | |
parent | 8e6d6cc4dc2b19b6d9db42a1c9057fdf8c6c5404 (diff) |
Cycles: Temporarily revert index sort commit for spatial split
There are in fact some missing parts to it (Split BVH builder should
be creating bins from result of Object Split constructor).
Doable, but need to quickly fix issue for the studio here, easier to
revert for now.
Diffstat (limited to 'intern/cycles/bvh/bvh_sort.cpp')
-rw-r--r-- | intern/cycles/bvh/bvh_sort.cpp | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/intern/cycles/bvh/bvh_sort.cpp b/intern/cycles/bvh/bvh_sort.cpp index 8088dccbc07..3140bf23376 100644 --- a/intern/cycles/bvh/bvh_sort.cpp +++ b/intern/cycles/bvh/bvh_sort.cpp @@ -65,54 +65,5 @@ void bvh_reference_sort(int start, int end, BVHReference *data, int dim) sort(data+start, data+end, compare); } -struct BVHReferenceCompareIndexed { -public: - BVHReferenceCompareIndexed(int dim, const BVHReference *data, int start) - : dim_(dim), - start_(start), - data_(data) - {} - - bool operator()(const int a, const int b) - { - const BVHReference& ra = data_[start_ + a]; - const BVHReference& rb = data_[start_ + b]; - NO_EXTENDED_PRECISION float ca = ra.bounds().min[dim_] + ra.bounds().max[dim_]; - NO_EXTENDED_PRECISION float cb = rb.bounds().min[dim_] + rb.bounds().max[dim_]; - - if(ca < cb) return true; - else if(ca > cb) return false; - else if(ra.prim_object() < rb.prim_object()) return true; - else if(ra.prim_object() > rb.prim_object()) return false; - else if(ra.prim_index() < rb.prim_index()) return true; - else if(ra.prim_index() > rb.prim_index()) return false; - else if(ra.prim_type() < rb.prim_type()) return true; - else if(ra.prim_type() > rb.prim_type()) return false; - - return false; - } - -private: - int dim_, start_; - const BVHReference *data_; -}; - -/* NOTE: indices are always from 0 to count, even in the cases when start is not - * zero. This is to simplify indexing in the object splitter. Index array is also - * always zero-based index. - */ -void bvh_reference_sort_indices(int start, - int end, - const BVHReference *data, - int *indices, - int dim) -{ - const int count = end - start; - for(int i = 0; i < count; ++i) { - indices[i] = i; - } - BVHReferenceCompareIndexed compare(dim, data, start); - sort(indices, indices+count, compare); -} - CCL_NAMESPACE_END + |