|
Blender V4.3
|
#include "MEM_guardedalloc.h"#include "atomic_ops.h"#include "BLI_array.hh"#include "BLI_bitmap.h"#include "BLI_buffer.h"#include "BLI_function_ref.hh"#include "BLI_math_geom.h"#include "BLI_math_vector.h"#include "BLI_task.hh"#include "BLI_utildefines.h"#include "BKE_customdata.hh"#include "BKE_mesh.hh"#include "BKE_mesh_mapping.hh"#include "BLI_memarena.h"#include "BLI_strict_flags.h"Go to the source code of this file.
Namespaces | |
| namespace | blender |
| namespace | blender::bke |
| namespace | blender::bke::mesh |
Mesh loops/face islands. | |
Used currently for UVs and 'smooth groups'. | |
| #define | MISLAND_DEFAULT_BUFSIZE 64 |
| using | MeshRemap_CheckIslandBoundary |
| static void | face_edge_loop_islands_calc (const int totedge, const blender::OffsetIndices< int > faces, const blender::Span< int > corner_edges, blender::GroupedSpan< int > edge_face_map, const bool use_bitflags, MeshRemap_CheckIslandBoundary edge_boundary_check, int **r_face_groups, int *r_totgroup, BLI_bitmap **r_edge_borders, int *r_totedgeborder) |
| int * | BKE_mesh_calc_smoothgroups (int edges_num, const blender::OffsetIndices< int > faces, const blender::Span< int > corner_edges, const blender::Span< bool > sharp_edges, const blender::Span< bool > sharp_faces, int *r_totgroup, bool use_bitflags) |
| void | BKE_mesh_loop_islands_init (MeshIslandStore *island_store, const short item_type, const int items_num, const short island_type, const short innercut_type) |
| void | BKE_mesh_loop_islands_clear (MeshIslandStore *island_store) |
| void | BKE_mesh_loop_islands_free (MeshIslandStore *island_store) |
| void | BKE_mesh_loop_islands_add (MeshIslandStore *island_store, const int item_num, const int *items_indices, const int num_island_items, int *island_item_indices, const int num_innercut_items, int *innercut_item_indices) |
| static bool | mesh_calc_islands_loop_face_uv (const int totedge, const bool *uv_seams, const blender::OffsetIndices< int > faces, const int *corner_verts, const int *corner_edges, const int corners_num, const float(*luvs)[2], MeshIslandStore *r_island_store) |
| bool | BKE_mesh_calc_islands_loop_face_edgeseam (const float(*vert_positions)[3], const int totvert, const blender::int2 *edges, const int totedge, const bool *uv_seams, const blender::OffsetIndices< int > faces, const int *corner_verts, const int *corner_edges, const int corners_num, MeshIslandStore *r_island_store) |
| bool | BKE_mesh_calc_islands_loop_face_uvmap (float(*vert_positions)[3], const int totvert, blender::int2 *edges, const int totedge, const bool *uv_seams, const blender::OffsetIndices< int > faces, const int *corner_verts, const int *corner_edges, const int corners_num, const float(*luvs)[2], MeshIslandStore *r_island_store) |
Functions for accessing mesh connectivity data. eg: faces connected to verts, UVs connected to verts.
Definition in file mesh_mapping.cc.
| #define MISLAND_DEFAULT_BUFSIZE 64 |
Definition at line 705 of file mesh_mapping.cc.
Referenced by BKE_mesh_loop_islands_init().
Callback deciding whether the given face/loop/edge define an island boundary or not.
Definition at line 473 of file mesh_mapping.cc.
| bool BKE_mesh_calc_islands_loop_face_edgeseam | ( | const float(*) | vert_positions[3], |
| int | totvert, | ||
| const blender::int2 * | edges, | ||
| int | totedge, | ||
| const bool * | uv_seams, | ||
| blender::OffsetIndices< int > | faces, | ||
| const int * | corner_verts, | ||
| const int * | corner_edges, | ||
| int | corners_num, | ||
| MeshIslandStore * | r_island_store ) |
Calculate 'generic' UV islands, i.e. based only on actual geometry data (edge seams), not some UV layers coordinates.
Definition at line 991 of file mesh_mapping.cc.
References mesh_calc_islands_loop_face_uv(), and UNUSED_VARS.
Referenced by data_transfer_get_loop_islands_generator().
| bool BKE_mesh_calc_islands_loop_face_uvmap | ( | float(*) | vert_positions[3], |
| int | totvert, | ||
| blender::int2 * | edges, | ||
| int | totedge, | ||
| const bool * | uv_seams, | ||
| blender::OffsetIndices< int > | faces, | ||
| const int * | corner_verts, | ||
| const int * | corner_edges, | ||
| int | corners_num, | ||
| const float(*) | luvs[2], | ||
| MeshIslandStore * | r_island_store ) |
Calculate UV islands.
Definition at line 1007 of file mesh_mapping.cc.
References BLI_assert, mesh_calc_islands_loop_face_uv(), and UNUSED_VARS.
| int * BKE_mesh_calc_smoothgroups | ( | int | edges_num, |
| blender::OffsetIndices< int > | faces, | ||
| blender::Span< int > | corner_edges, | ||
| blender::Span< bool > | sharp_edges, | ||
| blender::Span< bool > | sharp_faces, | ||
| int * | r_totgroup, | ||
| bool | use_bitflags ) |
Calculate smooth groups from sharp edges.
| sharp_edges | Optional (possibly empty) span. |
| sharp_faces | Optional (possibly empty) span. |
| r_totgroup | The total number of groups, 1 or more. |
Definition at line 661 of file mesh_mapping.cc.
References face_edge_loop_islands_calc(), and blender::Span< T >::is_empty().
Referenced by blender::io::obj::OBJMesh::calc_smooth_groups().
| void BKE_mesh_loop_islands_add | ( | MeshIslandStore * | island_store, |
| const int | item_num, | ||
| const int * | items_indices, | ||
| const int | num_island_items, | ||
| int * | island_item_indices, | ||
| const int | num_innercut_items, | ||
| int * | innercut_item_indices ) |
Definition at line 769 of file mesh_mapping.cc.
References BLI_memarena_alloc(), MeshElemMap::count, MeshElemMap::indices, MeshIslandStore::innercuts, MeshIslandStore::islands, MeshIslandStore::islands_num, MeshIslandStore::islands_num_alloc, MeshIslandStore::items_to_islands, MeshIslandStore::mem, and UNLIKELY.
Referenced by mesh_calc_islands_loop_face_uv().
| void BKE_mesh_loop_islands_clear | ( | MeshIslandStore * | island_store | ) |
Definition at line 741 of file mesh_mapping.cc.
References BLI_memarena_clear(), MeshIslandStore::innercut_type, MeshIslandStore::innercuts, MeshIslandStore::island_type, MeshIslandStore::islands, MeshIslandStore::islands_num, MeshIslandStore::islands_num_alloc, MeshIslandStore::item_type, MeshIslandStore::items_to_islands, MeshIslandStore::items_to_islands_num, MeshIslandStore::mem, and MISLAND_TYPE_NONE.
Referenced by mesh_calc_islands_loop_face_uv().
| void BKE_mesh_loop_islands_free | ( | MeshIslandStore * | island_store | ) |
Definition at line 761 of file mesh_mapping.cc.
References BLI_memarena_free(), and MeshIslandStore::mem.
Referenced by BKE_mesh_remap_calc_loops_from_mesh().
| void BKE_mesh_loop_islands_init | ( | MeshIslandStore * | island_store, |
| const short | item_type, | ||
| const int | items_num, | ||
| const short | island_type, | ||
| const short | innercut_type ) |
Definition at line 707 of file mesh_mapping.cc.
References BLI_assert, BLI_memarena_alloc(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, ELEM, MeshIslandStore::innercut_type, MeshIslandStore::innercuts, MeshIslandStore::island_type, MeshIslandStore::islands, MeshIslandStore::islands_num_alloc, MeshIslandStore::item_type, MeshIslandStore::items_to_islands, MeshIslandStore::items_to_islands_num, MeshIslandStore::mem, MISLAND_DEFAULT_BUFSIZE, MISLAND_TYPE_EDGE, MISLAND_TYPE_LOOP, MISLAND_TYPE_POLY, and MISLAND_TYPE_VERT.
Referenced by mesh_calc_islands_loop_face_uv().
| void BKE_mesh_origindex_map_create | ( | MeshElemMap ** | r_map, |
| int ** | r_mem, | ||
| int | totsource, | ||
| const int * | final_origindex, | ||
| int | totfinal ) |
This function creates a map so the source-data (vert/edge/loop/face) can loop over the destination data (using the destination arrays origindex).
This has the advantage that it can operate on any data-types.
| totsource | The total number of elements that final_origindex points to. |
| totfinal | The size of final_origindex |
| final_origindex | The size of the final array. |
totsource could be faces_num, totfinal could be tottessface and final_origindex its ORIGINDEX custom-data. This would allow a face to loop over its tessfaces. Definition at line 231 of file mesh_mapping.cc.
References BLI_assert, MeshElemMap::count, indices, MeshElemMap::indices, MEM_mallocN, and ORIGINDEX_NONE.
| void BKE_mesh_origindex_map_create_corner_tri | ( | MeshElemMap ** | r_map, |
| int ** | r_mem, | ||
| blender::OffsetIndices< int > | faces, | ||
| const int * | corner_tri_faces, | ||
| int | corner_tris_num ) |
A version of BKE_mesh_origindex_map_create that takes a corner tri array. Making a face -> corner tri map.
Definition at line 272 of file mesh_mapping.cc.
References MeshElemMap::count, blender::bke::mesh::face_triangles_num(), indices, MeshElemMap::indices, MEM_mallocN, and size().
Referenced by BKE_mesh_remap_calc_loops_from_mesh().
| UvVertMap * BKE_mesh_uv_vert_map_create | ( | const blender::OffsetIndices< int > | faces, |
| const bool * | hide_poly, | ||
| const bool * | select_poly, | ||
| const int * | corner_verts, | ||
| const float(*) | mloopuv[2], | ||
| uint | totvert, | ||
| const float | limit[2], | ||
| const bool | selected, | ||
| const bool | use_winding ) |
Definition at line 36 of file mesh_mapping.cc.
References BKE_mesh_uv_vert_map_free(), BLI_buffer_declare_static, BLI_buffer_free, BLI_BUFFER_NOP, BLI_buffer_reinit_data, UvVertMap::buf, copy_v2_v2(), cross_poly_v2(), fabsf, UvMapVert::face_index, float, int, UvMapVert::loop_of_face_index, MEM_calloc_arrayN, MEM_callocN, MEM_freeN(), next, UvMapVert::next, UvMapVert::separate, size(), sub_v2_v2v2(), v, and UvVertMap::vert.
Referenced by blender::bke::subdiv::precalc_uv_layer(), and ss_sync_from_uv().
| void BKE_mesh_uv_vert_map_free | ( | UvVertMap * | vmap | ) |
Definition at line 176 of file mesh_mapping.cc.
References UvVertMap::buf, MEM_freeN(), and UvVertMap::vert.
Referenced by BKE_mesh_uv_vert_map_create(), BM_uv_vert_map_create(), blender::bke::subdiv::precalc_uv_layer(), and ss_sync_from_uv().
Definition at line 171 of file mesh_mapping.cc.
References v, and UvVertMap::vert.
Referenced by get_face_uv_map_vert(), blender::bke::subdiv::precalc_uv_layer(), and ss_sync_from_uv().
| void BKE_mesh_vert_corner_tri_map_create | ( | MeshElemMap ** | r_map, |
| int ** | r_mem, | ||
| int | totvert, | ||
| const blender::int3 * | corner_tris, | ||
| int | tris_num, | ||
| const int * | corner_verts, | ||
| int | corners_num ) |
Generates a map where the key is the edge and the value is a list of corner_tris that use that edge. The lists are allocated from one memory pool.
Definition at line 189 of file mesh_mapping.cc.
References MeshElemMap::count, indices, MeshElemMap::indices, and MEM_mallocN.
Referenced by dynamicPaint_createUVSurface().
|
static |
Definition at line 480 of file mesh_mapping.cc.
References BLI_assert, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_BITMAP_TEST, blender::bke::mesh::build_edge_to_face_map(), blender::Span< T >::data(), ELEM, int, blender::offset_indices::GroupedSpan< T >::is_empty(), MEM_callocN, MEM_freeN(), MEM_mallocN, printf, blender::Span< T >::size(), and UNLIKELY.
Referenced by BKE_mesh_calc_smoothgroups(), and mesh_calc_islands_loop_face_uv().
|
static |
Definition at line 820 of file mesh_mapping.cc.
References BKE_mesh_loop_islands_add(), BKE_mesh_loop_islands_clear(), BKE_mesh_loop_islands_init(), BLI_assert, BLI_BITMAP_TEST, equals_v2v2(), face_edge_loop_islands_calc(), int, MEM_freeN(), MEM_mallocN, MISLAND_TYPE_EDGE, MISLAND_TYPE_LOOP, MISLAND_TYPE_POLY, blender::Span< T >::size(), UNUSED_VARS_NDEBUG, and v2.
Referenced by BKE_mesh_calc_islands_loop_face_edgeseam(), and BKE_mesh_calc_islands_loop_face_uvmap().