From e0d2500971bb9a079813077149e4cd1ef163b037 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang <1627343141@qq.com> Date: Thu, 30 Oct 2025 11:51:31 +0800 Subject: [PATCH] remove duplicate codes --- blobtree_structure/src/baked_blobtree.cpp | 50 +++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/blobtree_structure/src/baked_blobtree.cpp b/blobtree_structure/src/baked_blobtree.cpp index d3a4b5d..8579b6c 100644 --- a/blobtree_structure/src/baked_blobtree.cpp +++ b/blobtree_structure/src/baked_blobtree.cpp @@ -89,31 +89,31 @@ baked_blobtree_t::baked_blobtree_t(const blobtree_t& tree) noexcept assert(this->leaf_indices.front() == 0); // step 3: sort & remove duplicates of subfaces - { - stl_vector_mp old_to_new_mapping(this->subfaces.size()); - { - stl_vector_mp subface_indices(this->subfaces.size()); - std::iota(subface_indices.begin(), subface_indices.end(), 0); - std::sort(subface_indices.begin(), subface_indices.end(), [this](uint32_t lhs, uint32_t rhs) { - return this->subfaces[lhs].object_ptr < this->subfaces[rhs].object_ptr; - }); - for (uint32_t new_index = 0; new_index < subface_indices.size(); ++new_index) { - const auto old_index = subface_indices[new_index]; - old_to_new_mapping[old_index] = new_index; - } - } - stl_vector_mp> temp_subfaces(this->subfaces.size()); - for (size_t i = 0; i < this->subfaces.size(); ++i) { - auto& subface = this->subfaces[i]; - auto& new_subface = temp_subfaces[old_to_new_mapping[i]]; - new_subface = std::move(subface); - } - std::swap(this->subfaces, temp_subfaces); - for (auto& primitive : this->primitives) { - auto& primitive_mapping = primitive.index_mapping; - for (auto& index : primitive_mapping) { index = old_to_new_mapping[index]; } - } - } + // { + // stl_vector_mp old_to_new_mapping(this->subfaces.size()); + // { + // stl_vector_mp subface_indices(this->subfaces.size()); + // std::iota(subface_indices.begin(), subface_indices.end(), 0); + // std::sort(subface_indices.begin(), subface_indices.end(), [this](uint32_t lhs, uint32_t rhs) { + // return this->subfaces[lhs].object_ptr < this->subfaces[rhs].object_ptr; + // }); + // for (uint32_t new_index = 0; new_index < subface_indices.size(); ++new_index) { + // const auto old_index = subface_indices[new_index]; + // old_to_new_mapping[old_index] = new_index; + // } + // } + // stl_vector_mp> temp_subfaces(this->subfaces.size()); + // for (size_t i = 0; i < this->subfaces.size(); ++i) { + // auto& subface = this->subfaces[i]; + // auto& new_subface = temp_subfaces[old_to_new_mapping[i]]; + // new_subface = std::move(subface); + // } + // std::swap(this->subfaces, temp_subfaces); + // for (auto& primitive : this->primitives) { + // auto& primitive_mapping = primitive.index_mapping; + // for (auto& index : primitive_mapping) { index = old_to_new_mapping[index]; } + // } + // } // merge subfaces: basically a specialization of std::unique { auto current_iter = this->subfaces.begin();