diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-28 22:31:32 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-28 22:31:32 +0300 |
commit | 25533dbe219f8bbcb3f04ffe2ff1e57599addf3f (patch) | |
tree | fd4d4260fbb807d3d0484d2c4259b43378390875 /source/blender/blenkernel/intern/mesh_fair.cc | |
parent | 878dea4e0fcca68ba3ad93edeae22114e1252f9e (diff) |
Mesh: Add C++ implementaiton of topology mappings
Because they are friendlier to use in C++ code than the existing mesh
mapping API, these mappings from one domain to another were often
reimplemented in separate files. This commit moves some basic
implementations to a `mesh_topology` namespace in the existing
mesh mapping header file. These is plenty of room for performance
improvement here, particularly by not using an array of Vectors, but
that can come later.
Split from D16029
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_fair.cc')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_fair.cc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/mesh_fair.cc b/source/blender/blenkernel/intern/mesh_fair.cc index bb0a5610cf4..df61169fa5c 100644 --- a/source/blender/blenkernel/intern/mesh_fair.cc +++ b/source/blender/blenkernel/intern/mesh_fair.cc @@ -26,6 +26,7 @@ #include "MEM_guardedalloc.h" #include "eigen_capi.h" +using blender::Array; using blender::Map; using blender::MutableSpan; using blender::Span; @@ -220,12 +221,7 @@ class MeshFairingContext : public FairingContext { } } - loop_to_poly_map_.reserve(mesh->totloop); - for (int i = 0; i < mesh->totpoly; i++) { - for (int l = 0; l < mpoly_[i].totloop; l++) { - loop_to_poly_map_[l + mpoly_[i].loopstart] = i; - } - } + loop_to_poly_map_ = blender::mesh_topology::build_corner_to_poly_map(mpoly_, mloop_.size()); } ~MeshFairingContext() override @@ -259,7 +255,7 @@ class MeshFairingContext : public FairingContext { Span<MLoop> mloop_; Span<MPoly> mpoly_; Span<MEdge> medge_; - Vector<int> loop_to_poly_map_; + Array<int> loop_to_poly_map_; }; class BMeshFairingContext : public FairingContext { |