| 
						
						
							
								
							
						
						
					 | 
					@ -89,31 +89,31 @@ baked_blobtree_t::baked_blobtree_t(const blobtree_t& tree) noexcept | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    assert(this->leaf_indices.front() == 0); | 
					 | 
					 | 
					    assert(this->leaf_indices.front() == 0); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    // step 3: sort & remove duplicates of subfaces
 | 
					 | 
					 | 
					    // step 3: sort & remove duplicates of subfaces
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    { | 
					 | 
					 | 
					    // {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        stl_vector_mp<uint32_t> old_to_new_mapping(this->subfaces.size()); | 
					 | 
					 | 
					    //     stl_vector_mp<uint32_t> old_to_new_mapping(this->subfaces.size());
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        { | 
					 | 
					 | 
					    //     {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            stl_vector_mp<uint32_t> subface_indices(this->subfaces.size()); | 
					 | 
					 | 
					    //         stl_vector_mp<uint32_t> subface_indices(this->subfaces.size());
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            std::iota(subface_indices.begin(), subface_indices.end(), 0); | 
					 | 
					 | 
					    //         std::iota(subface_indices.begin(), subface_indices.end(), 0);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            std::sort(subface_indices.begin(), subface_indices.end(), [this](uint32_t lhs, uint32_t rhs) { | 
					 | 
					 | 
					    //         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; | 
					 | 
					 | 
					    //             return this->subfaces[lhs].object_ptr < this->subfaces[rhs].object_ptr;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            }); | 
					 | 
					 | 
					    //         });
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            for (uint32_t new_index = 0; new_index < subface_indices.size(); ++new_index) { | 
					 | 
					 | 
					    //         for (uint32_t new_index = 0; new_index < subface_indices.size(); ++new_index) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                const auto old_index          = subface_indices[new_index]; | 
					 | 
					 | 
					    //             const auto old_index          = subface_indices[new_index];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                old_to_new_mapping[old_index] = new_index; | 
					 | 
					 | 
					    //             old_to_new_mapping[old_index] = new_index;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            } | 
					 | 
					 | 
					    //         }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        } | 
					 | 
					 | 
					    //     }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        stl_vector_mp<object_with_index_mapping<subface>> temp_subfaces(this->subfaces.size()); | 
					 | 
					 | 
					    //     stl_vector_mp<object_with_index_mapping<subface>> temp_subfaces(this->subfaces.size());
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        for (size_t i = 0; i < this->subfaces.size(); ++i) { | 
					 | 
					 | 
					    //     for (size_t i = 0; i < this->subfaces.size(); ++i) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            auto& subface     = this->subfaces[i]; | 
					 | 
					 | 
					    //         auto& subface     = this->subfaces[i];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            auto& new_subface = temp_subfaces[old_to_new_mapping[i]]; | 
					 | 
					 | 
					    //         auto& new_subface = temp_subfaces[old_to_new_mapping[i]];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            new_subface       = std::move(subface); | 
					 | 
					 | 
					    //         new_subface       = std::move(subface);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        } | 
					 | 
					 | 
					    //     }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        std::swap(this->subfaces, temp_subfaces); | 
					 | 
					 | 
					    //     std::swap(this->subfaces, temp_subfaces);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        for (auto& primitive : this->primitives) { | 
					 | 
					 | 
					    //     for (auto& primitive : this->primitives) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            auto& primitive_mapping = primitive.index_mapping; | 
					 | 
					 | 
					    //         auto& primitive_mapping = primitive.index_mapping;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            for (auto& index : primitive_mapping) { index = old_to_new_mapping[index]; } | 
					 | 
					 | 
					    //         for (auto& index : primitive_mapping) { index = old_to_new_mapping[index]; }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        } | 
					 | 
					 | 
					    //     }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    } | 
					 | 
					 | 
					    // }
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					    // merge subfaces: basically a specialization of std::unique
 | 
					 | 
					 | 
					    // merge subfaces: basically a specialization of std::unique
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    { | 
					 | 
					 | 
					    { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        auto current_iter = this->subfaces.begin(); | 
					 | 
					 | 
					        auto current_iter = this->subfaces.begin(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |