diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_mesh_mapping.h')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh_mapping.h | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h index 163acf062e0..cf9763d50a4 100644 --- a/source/blender/blenkernel/BKE_mesh_mapping.h +++ b/source/blender/blenkernel/BKE_mesh_mapping.h @@ -17,11 +17,10 @@ struct MLoopUV; struct MPoly; struct MVert; -/* map from uv vertex to face (for select linked, stitch, uv suburf) */ - /* UvVertMap */ #define STD_UV_CONNECT_LIMIT 0.0001f +/* Map from uv vertex to face. Used by select linked, uv subdivision-surface and obj exporter. */ typedef struct UvVertMap { struct UvMapVert **vert; struct UvMapVert *buf; @@ -52,24 +51,38 @@ typedef struct UvElement { unsigned int island; } UvElement; -/* UvElementMap is a container for UvElements of a mesh. It stores some UvElements belonging to the - * same uv island in sequence and the number of uvs per island so it is possible to access all uvs - * belonging to an island directly by iterating through the buffer. +/** UvElementMap is a container for UvElements of a BMesh. + * + * It simplifies access to UV information and ensures the + * different UV selection modes are respected. + * + * If islands are calculated, it also stores UvElements + * belonging to the same uv island in sequence and + * the number of uvs per island. */ typedef struct UvElementMap { - /* address UvElements by their vertex */ - struct UvElement **vert; - /* UvElement Store */ - struct UvElement *buf; - /* Total number of UVs in the layer. Useful to know */ - int totalUVs; - /* Number of Islands in the mesh */ - int totalIslands; - /* Stores the starting index in buf where each island begins */ - int *islandIndices; -} UvElementMap; + /** UvElement Storage. */ + struct UvElement *storage; + /** Total number of UVs. */ + int total_uvs; + /** Total number of unique UVs. */ + int total_unique_uvs; -#define INVALID_ISLAND ((unsigned int)-1) + /** If Non-NULL, address UvElements by `BM_elem_index_get(BMVert*)`. */ + struct UvElement **vertex; + + /** If Non-NULL, pointer to local head of each unique UV. */ + struct UvElement **head_table; + + /** Number of islands, or zero if not calculated. */ + int total_islands; + /** Array of starting index in #storage where each island begins. */ + int *island_indices; + /** Array of number of UVs in each island. */ + int *island_total_uvs; + /** Array of number of unique UVs in each island. */ + int *island_total_unique_uvs; +} UvElementMap; /* Connectivity data */ typedef struct MeshElemMap { @@ -79,6 +92,7 @@ typedef struct MeshElemMap { /* mapping */ UvVertMap *BKE_mesh_uv_vert_map_create(const struct MPoly *mpoly, + const bool *hide_poly, const struct MLoop *mloop, const struct MLoopUV *mloopuv, unsigned int totpoly, @@ -234,13 +248,13 @@ void BKE_mesh_loop_islands_add(MeshIslandStore *island_store, int num_innercut_items, int *innercut_item_indices); -typedef bool (*MeshRemapIslandsCalc)(struct MVert *verts, +typedef bool (*MeshRemapIslandsCalc)(const struct MVert *verts, int totvert, - struct MEdge *edges, + const struct MEdge *edges, int totedge, - struct MPoly *polys, + const struct MPoly *polys, int totpoly, - struct MLoop *loops, + const struct MLoop *loops, int totloop, struct MeshIslandStore *r_island_store); @@ -251,13 +265,13 @@ typedef bool (*MeshRemapIslandsCalc)(struct MVert *verts, * Calculate 'generic' UV islands, i.e. based only on actual geometry data (edge seams), * not some UV layers coordinates. */ -bool BKE_mesh_calc_islands_loop_poly_edgeseam(struct MVert *verts, +bool BKE_mesh_calc_islands_loop_poly_edgeseam(const struct MVert *verts, int totvert, - struct MEdge *edges, + const struct MEdge *edges, int totedge, - struct MPoly *polys, + const struct MPoly *polys, int totpoly, - struct MLoop *loops, + const struct MLoop *loops, int totloop, MeshIslandStore *r_island_store); |