Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-28 22:31:32 +0300
committerHans Goudey <h.goudey@me.com>2022-09-28 22:31:32 +0300
commit25533dbe219f8bbcb3f04ffe2ff1e57599addf3f (patch)
treefd4d4260fbb807d3d0484d2c4259b43378390875 /source/blender/blenkernel/BKE_mesh_mapping.h
parent878dea4e0fcca68ba3ad93edeae22114e1252f9e (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/BKE_mesh_mapping.h')
-rw-r--r--source/blender/blenkernel/BKE_mesh_mapping.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h
index 2ee50fbaaee..350c4c4bb36 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -7,6 +7,10 @@
*/
#ifdef __cplusplus
+# include "BLI_array.hh"
+#endif
+
+#ifdef __cplusplus
extern "C" {
#endif
@@ -330,3 +334,19 @@ int *BKE_mesh_calc_smoothgroups(const struct MEdge *medge,
#ifdef __cplusplus
}
#endif
+
+#ifdef __cplusplus
+namespace blender::mesh_topology {
+
+Array<int> build_corner_to_poly_map(Span<MPoly> polys, int loops_num);
+
+Array<Vector<int>> build_vert_to_edge_map(Span<MEdge> edges, int verts_num);
+Array<Vector<int>> build_vert_to_corner_map(Span<MLoop> loops, int verts_num);
+
+inline int previous_poly_corner(const MPoly &poly, int corner_i)
+{
+ return corner_i - 1 + (corner_i == poly.loopstart) * poly.totloop;
+}
+
+} // namespace blender::mesh_topology
+#endif