Blender V4.3
BKE_mesh_mapping.hh File Reference

Go to the source code of this file.

Classes

struct  UvMapVert
 
struct  UvVertMap
 
struct  UvElement
 
struct  UvElementMap
 
struct  MeshElemMap
 
struct  MeshIslandStore
 

Namespaces

namespace  blender
 
namespace  blender::bke
 
namespace  blender::bke::mesh
 

Macros

#define STD_UV_CONNECT_LIMIT   0.0001f
 
#define BKE_MESH_TESSTRI_VINDEX_ORDER(_tri, _v)
 

Typedefs

using MeshRemapIslandsCalc
 

Enumerations

enum  {
  MISLAND_TYPE_NONE = 0 , MISLAND_TYPE_VERT = 1 , MISLAND_TYPE_EDGE = 2 , MISLAND_TYPE_POLY = 3 ,
  MISLAND_TYPE_LOOP = 4
}
 

Functions

UvVertMapBKE_mesh_uv_vert_map_create (blender::OffsetIndices< int > faces, const bool *hide_poly, const bool *select_poly, const int *corner_verts, const float(*mloopuv)[2], unsigned int totvert, const float limit[2], bool selected, bool use_winding)
 
UvMapVertBKE_mesh_uv_vert_map_get_vert (UvVertMap *vmap, unsigned int v)
 
void BKE_mesh_uv_vert_map_free (UvVertMap *vmap)
 
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)
 
void BKE_mesh_origindex_map_create (MeshElemMap **r_map, int **r_mem, int totsource, const int *final_origindex, int totfinal)
 
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)
 
void BKE_mesh_loop_islands_init (MeshIslandStore *island_store, short item_type, int items_num, short island_type, 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, int item_num, const int *items_indices, int num_island_items, int *island_item_indices, int num_innercut_items, int *innercut_item_indices)
 
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)
 
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)
 
intBKE_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)
 
Array< intblender::bke::mesh::build_corner_to_face_map (OffsetIndices< int > faces)
 
GroupedSpan< intblender::bke::mesh::build_vert_to_edge_map (Span< int2 > edges, int verts_num, Array< int > &r_offsets, Array< int > &r_indices)
 
void blender::bke::mesh::build_vert_to_face_indices (OffsetIndices< int > faces, Span< int > corner_verts, OffsetIndices< int > offsets, MutableSpan< int > face_indices)
 
GroupedSpan< intblender::bke::mesh::build_vert_to_face_map (OffsetIndices< int > faces, Span< int > corner_verts, int verts_num, Array< int > &r_offsets, Array< int > &r_indices)
 
Array< intblender::bke::mesh::build_vert_to_corner_indices (Span< int > corner_verts, OffsetIndices< int > offsets)
 
GroupedSpan< intblender::bke::mesh::build_vert_to_corner_map (Span< int > corner_verts, int verts_num, Array< int > &r_offsets, Array< int > &r_indices)
 
GroupedSpan< intblender::bke::mesh::build_edge_to_corner_map (Span< int > corner_edges, int edges_num, Array< int > &r_offsets, Array< int > &r_indices)
 
GroupedSpan< intblender::bke::mesh::build_edge_to_face_map (OffsetIndices< int > faces, Span< int > corner_edges, int edges_num, Array< int > &r_offsets, Array< int > &r_indices)
 

Macro Definition Documentation

◆ BKE_MESH_TESSTRI_VINDEX_ORDER

#define BKE_MESH_TESSTRI_VINDEX_ORDER ( _tri,
_v )
Value:
_tri, unsigned int *, int *, int[3], const unsigned int *, const int *, const int[3]), \
CHECK_TYPE_ANY(_v, unsigned int, const unsigned int, int, const int)), \
(((_tri)[0] == _v) ? 0 : \
((_tri)[1] == _v) ? 1 : \
((_tri)[2] == _v) ? 2 : \
-1))
#define CHECK_TYPE_ANY(...)

Definition at line 268 of file BKE_mesh_mapping.hh.

Referenced by check_seam().

◆ STD_UV_CONNECT_LIMIT

Typedef Documentation

◆ MeshRemapIslandsCalc

Initial value:
bool (*)(const float (*vert_positions)[3],
int totvert,
const blender::int2 *edges,
int totedge,
const bool *uv_seams,
const int *corner_verts,
const int *corner_edges,
int corners_num,
MeshIslandStore *r_island_store)
draw_view in_light_buf[] float
static char faces[256]

Definition at line 195 of file BKE_mesh_mapping.hh.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MISLAND_TYPE_NONE 
MISLAND_TYPE_VERT 
MISLAND_TYPE_EDGE 
MISLAND_TYPE_POLY 
MISLAND_TYPE_LOOP 

Definition at line 156 of file BKE_mesh_mapping.hh.

Function Documentation

◆ BKE_mesh_calc_islands_loop_face_edgeseam()

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().

◆ BKE_mesh_calc_islands_loop_face_uvmap()

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.

Note
If no UV layer is passed, we only consider edges tagged as seams as UV boundaries. This has the advantages of simplicity, and being valid/common to all UV maps. However, it means actual UV islands without matching UV seams will not be handled correctly. If a valid UV layer is passed as luvs parameter, UV coordinates are also used to detect islands boundaries.
All this could be optimized. Not sure it would be worth the more complex code, though, those loops are supposed to be really quick to do.

Definition at line 1007 of file mesh_mapping.cc.

References BLI_assert, mesh_calc_islands_loop_face_uv(), and UNUSED_VARS.

◆ BKE_mesh_calc_smoothgroups()

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.

Parameters
sharp_edgesOptional (possibly empty) span.
sharp_facesOptional (possibly empty) span.
r_totgroupThe total number of groups, 1 or more.
Returns
Polygon aligned array of group index values (bitflags if use_bitflags is true), starting at 1 (0 being used as 'invalid' flag). Note it's callers's responsibility to MEM_freeN returned array.

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().

◆ BKE_mesh_loop_islands_add()

void BKE_mesh_loop_islands_add ( MeshIslandStore * island_store,
int item_num,
const int * items_indices,
int num_island_items,
int * island_item_indices,
int num_innercut_items,
int * innercut_item_indices )

◆ BKE_mesh_loop_islands_clear()

◆ BKE_mesh_loop_islands_free()

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().

◆ BKE_mesh_loop_islands_init()

◆ BKE_mesh_origindex_map_create()

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.

Parameters
totsourceThe total number of elements that final_origindex points to.
totfinalThe size of final_origindex
final_origindexThe size of the final array.
Note
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.

◆ BKE_mesh_origindex_map_create_corner_tri()

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().

◆ BKE_mesh_uv_vert_map_create()

UvVertMap * BKE_mesh_uv_vert_map_create ( blender::OffsetIndices< int > faces,
const bool * hide_poly,
const bool * select_poly,
const int * corner_verts,
const float(*) mloopuv[2],
unsigned int totvert,
const float limit[2],
bool selected,
bool use_winding )

◆ BKE_mesh_uv_vert_map_free()

void BKE_mesh_uv_vert_map_free ( UvVertMap * vmap)

◆ BKE_mesh_uv_vert_map_get_vert()

UvMapVert * BKE_mesh_uv_vert_map_get_vert ( UvVertMap * vmap,
unsigned int v )

◆ BKE_mesh_vert_corner_tri_map_create()

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().