limit vertex deduplication search to 1000 vertices, it was too slow

This commit is contained in:
milek7
2020-10-21 01:02:42 +02:00
parent 6af6f5156d
commit 0a8359068f

View File

@@ -202,7 +202,7 @@ void calculate_indices( index_array &Indices, vertex_array &Vertices, float tole
// if found, remap these to use our current vertex instead
auto vertex { Vertices[ idx ] };
auto matchiter { std::cbegin( Vertices ) + idx };
for( auto matchidx = idx + 1; matchidx < Indices.size(); ++matchidx ) {
for( auto matchidx = idx + 1; matchidx < Indices.size() && matchidx < idx + 1000; ++matchidx ) {
++matchiter;
if( ( glm::all( glm::epsilonEqual( vertex.position, matchiter->position, matchtolerance ) ) )
&& ( glm::all( glm::epsilonEqual( vertex.normal, matchiter->normal, matchtolerance ) ) )