Cleanup: Use utility function to fill triangle face offsets

This commit is contained in:
Hans Goudey
2023-11-02 13:48:13 +01:00
parent fdd702d2c9
commit 22e706e87a

View File

@@ -75,16 +75,8 @@ Mesh *STLMeshHelper::to_mesh()
}
Mesh *mesh = BKE_mesh_new_nomain(verts_.size(), 0, tris_.size(), tris_.size() * 3);
mesh->vert_positions_for_write().copy_from(verts_);
MutableSpan<int> face_offsets = mesh->face_offsets_for_write();
threading::parallel_for(face_offsets.index_range(), 4096, [&](const IndexRange range) {
for (const int i : range) {
face_offsets[i] = i * 3;
}
});
offset_indices::fill_constant_group_size(3, 0, mesh->face_offsets_for_write());
array_utils::copy(tris_.as_span().cast<int>(), mesh->corner_verts_for_write());
/* NOTE: edges must be calculated first before setting custom normals. */