diff options
author | Julian Eisel <julian@blender.org> | 2022-11-10 15:17:42 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-11-10 15:17:42 +0300 |
commit | 7246c387435769a169ac24c91434c615df6434b4 (patch) | |
tree | 61842e3e0ce85e80720fdd7476d44d2e629f59fd /source/blender/blenkernel/BKE_mesh_mapping.h | |
parent | c5f55d17096d373791363e46004176e3f7f7ae52 (diff) | |
parent | 0b4bd3ddc016298e868169a541cf6c132b10c587 (diff) |
Merge branch 'master' into asset-browser-grid-viewasset-browser-grid-view
Diffstat (limited to 'source/blender/blenkernel/BKE_mesh_mapping.h')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh_mapping.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h index cf9763d50a4..705158bec0b 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 @@ -59,6 +63,10 @@ typedef struct UvElement { * If islands are calculated, it also stores UvElements * belonging to the same uv island in sequence and * the number of uvs per island. + * + * \note in C++, #head_table and #unique_index_table would + * be `mutable`, as they are created on demand, and never + * changed after creation. */ typedef struct UvElementMap { /** UvElement Storage. */ @@ -74,6 +82,9 @@ typedef struct UvElementMap { /** If Non-NULL, pointer to local head of each unique UV. */ struct UvElement **head_table; + /** If Non-NULL, pointer to index of each unique UV. */ + int *unique_index_table; + /** Number of islands, or zero if not calculated. */ int total_islands; /** Array of starting index in #storage where each island begins. */ @@ -93,6 +104,7 @@ typedef struct MeshElemMap { /* mapping */ UvVertMap *BKE_mesh_uv_vert_map_create(const struct MPoly *mpoly, const bool *hide_poly, + const bool *select_poly, const struct MLoop *mloop, const struct MLoopUV *mloopuv, unsigned int totpoly, @@ -329,3 +341,19 @@ int *BKE_mesh_calc_smoothgroups(const struct MEdge *medge, #ifdef __cplusplus } #endif + +#ifdef __cplusplus +namespace blender::bke::mesh_topology { + +Array<int> build_loop_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_loop_map(Span<MLoop> loops, int verts_num); + +inline int previous_poly_loop(const MPoly &poly, int loop_i) +{ + return loop_i - 1 + (loop_i == poly.loopstart) * poly.totloop; +} + +} // namespace blender::bke::mesh_topology +#endif |