Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_mesh.h
| Show All 28 Lines | |||||
| struct ID; | struct ID; | ||||
| struct KeyBlock; | struct KeyBlock; | ||||
| struct LinkNode; | struct LinkNode; | ||||
| struct ListBase; | struct ListBase; | ||||
| struct MDeformVert; | struct MDeformVert; | ||||
| struct MDisps; | struct MDisps; | ||||
| struct MEdge; | struct MEdge; | ||||
| struct MFace; | struct MFace; | ||||
| struct MLoop; | |||||
| struct MLoopTri; | struct MLoopTri; | ||||
| struct MPoly; | struct MPoly; | ||||
| struct Main; | struct Main; | ||||
| struct MemArena; | struct MemArena; | ||||
| struct Mesh; | struct Mesh; | ||||
| struct Object; | struct Object; | ||||
| struct PointCloud; | struct PointCloud; | ||||
| struct Scene; | struct Scene; | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
| * must be done by the caller. | * must be done by the caller. | ||||
| */ | */ | ||||
| void BKE_mesh_ensure_default_orig_index_customdata_no_check(struct Mesh *mesh); | void BKE_mesh_ensure_default_orig_index_customdata_no_check(struct Mesh *mesh); | ||||
| /** | /** | ||||
| * Find the index of the loop in 'poly' which references vertex, | * Find the index of the loop in 'poly' which references vertex, | ||||
| * returns -1 if not found | * returns -1 if not found | ||||
| */ | */ | ||||
| int poly_find_loop_from_vert(const struct MPoly *poly, const struct MLoop *loopstart, int vert); | int poly_find_loop_from_vert(const struct MPoly *poly, const int *poly_verts, int vert); | ||||
| /** | /** | ||||
| * Fill \a r_adj with the loop indices in \a poly adjacent to the | * Fill \a r_adj with the loop indices in \a poly adjacent to the | ||||
| * vertex. Returns the index of the loop matching vertex, or -1 if the | * vertex. Returns the index of the loop matching vertex, or -1 if the | ||||
| * vertex is not in \a poly | * vertex is not in \a poly | ||||
| */ | */ | ||||
| int poly_get_adj_loops_from_vert(const struct MPoly *poly, | int poly_get_adj_loops_from_vert(const struct MPoly *poly, | ||||
| const struct MLoop *mloop, | const int *corner_verts, | ||||
| int vert, | int vert, | ||||
| int r_adj[2]); | int r_adj[2]); | ||||
| /** | /** | ||||
| * Return the index of the edge vert that is not equal to \a v. If | * Return the index of the edge vert that is not equal to \a v. If | ||||
| * neither edge vertex is equal to \a v, returns -1. | * neither edge vertex is equal to \a v, returns -1. | ||||
| */ | */ | ||||
| int BKE_mesh_edge_other_vert(const struct MEdge *e, int v); | int BKE_mesh_edge_other_vert(const struct MEdge *e, int v); | ||||
| /** | /** | ||||
| * Sets each output array element to the edge index if it is a real edge, or -1. | * Sets each output array element to the edge index if it is a real edge, or -1. | ||||
| */ | */ | ||||
| void BKE_mesh_looptri_get_real_edges(const struct MEdge *edges, | void BKE_mesh_looptri_get_real_edges(const struct MEdge *edges, | ||||
| const struct MLoop *loops, | const int *corner_verts, | ||||
| const struct MLoopTri *looptri, | const int *corner_edges, | ||||
| const struct MLoopTri *tri, | |||||
| int r_edges[3]); | int r_edges[3]); | ||||
| /** | /** | ||||
| * Free (or release) any data used by this mesh (does not free the mesh itself). | * Free (or release) any data used by this mesh (does not free the mesh itself). | ||||
| * Only use for undo, in most cases `BKE_id_free(nullptr, me)` should be used. | * Only use for undo, in most cases `BKE_id_free(nullptr, me)` should be used. | ||||
| */ | */ | ||||
| void BKE_mesh_free_data_for_undo(struct Mesh *me); | void BKE_mesh_free_data_for_undo(struct Mesh *me); | ||||
| void BKE_mesh_clear_geometry(struct Mesh *me); | void BKE_mesh_clear_geometry(struct Mesh *me); | ||||
| ▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | void BKE_mesh_vert_coords_apply_with_mat4(struct Mesh *mesh, | ||||
| const float mat[4][4]); | const float mat[4][4]); | ||||
| void BKE_mesh_vert_coords_apply(struct Mesh *mesh, const float (*vert_coords)[3]); | void BKE_mesh_vert_coords_apply(struct Mesh *mesh, const float (*vert_coords)[3]); | ||||
| /* *** mesh_tessellate.cc *** */ | /* *** mesh_tessellate.cc *** */ | ||||
| /** | /** | ||||
| * Calculate tessellation into #MLoopTri which exist only for this purpose. | * Calculate tessellation into #MLoopTri which exist only for this purpose. | ||||
| */ | */ | ||||
| void BKE_mesh_recalc_looptri(const struct MLoop *mloop, | void BKE_mesh_recalc_looptri(const int *corner_verts, | ||||
| const struct MPoly *mpoly, | const struct MPoly *mpoly, | ||||
| const float (*vert_positions)[3], | const float (*vert_positions)[3], | ||||
| int totloop, | int totloop, | ||||
| int totpoly, | int totpoly, | ||||
| struct MLoopTri *mlooptri); | struct MLoopTri *mlooptri); | ||||
| /** | /** | ||||
| * A version of #BKE_mesh_recalc_looptri which takes pre-calculated polygon normals | * A version of #BKE_mesh_recalc_looptri which takes pre-calculated polygon normals | ||||
| * (used to avoid having to calculate the face normal for NGON tessellation). | * (used to avoid having to calculate the face normal for NGON tessellation). | ||||
| * | * | ||||
| * \note Only use this function if normals have already been calculated, there is no need | * \note Only use this function if normals have already been calculated, there is no need | ||||
| * to calculate normals just to use this function as it will cause the normals for triangles | * to calculate normals just to use this function as it will cause the normals for triangles | ||||
| * to be calculated which aren't needed for tessellation. | * to be calculated which aren't needed for tessellation. | ||||
| */ | */ | ||||
| void BKE_mesh_recalc_looptri_with_normals(const struct MLoop *mloop, | void BKE_mesh_recalc_looptri_with_normals(const int *corner_verts, | ||||
| const struct MPoly *mpoly, | const struct MPoly *mpoly, | ||||
| const float (*vert_positions)[3], | const float (*vert_positions)[3], | ||||
| int totloop, | int totloop, | ||||
| int totpoly, | int totpoly, | ||||
| struct MLoopTri *mlooptri, | struct MLoopTri *mlooptri, | ||||
| const float (*poly_normals)[3]); | const float (*poly_normals)[3]); | ||||
| /* *** mesh_normals.cc *** */ | /* *** mesh_normals.cc *** */ | ||||
| ▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
| /** | /** | ||||
| * Return true if the mesh polygon normals either are not stored or are dirty. | * Return true if the mesh polygon normals either are not stored or are dirty. | ||||
| * This can be used to help decide whether to transfer them when copying a mesh. | * This can be used to help decide whether to transfer them when copying a mesh. | ||||
| */ | */ | ||||
| bool BKE_mesh_poly_normals_are_dirty(const struct Mesh *mesh); | bool BKE_mesh_poly_normals_are_dirty(const struct Mesh *mesh); | ||||
| void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly, | void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly, | ||||
| const struct MLoop *loopstart, | const int *poly_verts, | ||||
| const float (*vert_positions)[3], | const float (*vert_positions)[3], | ||||
| float r_no[3]); | float r_no[3]); | ||||
| /** | /** | ||||
| * Calculate face normals directly into a result array. | * Calculate face normals directly into a result array. | ||||
| * | * | ||||
| * \note Usually #BKE_mesh_poly_normals_ensure is the preferred way to access face normals, | * \note Usually #BKE_mesh_poly_normals_ensure is the preferred way to access face normals, | ||||
| * since they may already be calculated and cached on the mesh. | * since they may already be calculated and cached on the mesh. | ||||
| */ | */ | ||||
| void BKE_mesh_calc_normals_poly(const float (*vert_positions)[3], | void BKE_mesh_calc_normals_poly(const float (*vert_positions)[3], | ||||
| int mvert_len, | int mvert_len, | ||||
| const struct MLoop *mloop, | const int *corner_verts, | ||||
| int mloop_len, | int mloop_len, | ||||
| const struct MPoly *mpoly, | const struct MPoly *mpoly, | ||||
| int mpoly_len, | int mpoly_len, | ||||
| float (*r_poly_normals)[3]); | float (*r_poly_normals)[3]); | ||||
| /** | /** | ||||
| * Calculate face and vertex normals directly into result arrays. | * Calculate face and vertex normals directly into result arrays. | ||||
| * | * | ||||
| * \note Usually #BKE_mesh_vertex_normals_ensure is the preferred way to access vertex normals, | * \note Usually #BKE_mesh_vertex_normals_ensure is the preferred way to access vertex normals, | ||||
| * since they may already be calculated and cached on the mesh. | * since they may already be calculated and cached on the mesh. | ||||
| */ | */ | ||||
| void BKE_mesh_calc_normals_poly_and_vertex(const float (*vert_positions)[3], | void BKE_mesh_calc_normals_poly_and_vertex(const float (*vert_positions)[3], | ||||
| int mvert_len, | int mvert_len, | ||||
| const struct MLoop *mloop, | const int *corner_verts, | ||||
| int mloop_len, | int mloop_len, | ||||
| const struct MPoly *mpoly, | const struct MPoly *mpoly, | ||||
| int mpoly_len, | int mpoly_len, | ||||
| float (*r_poly_normals)[3], | float (*r_poly_normals)[3], | ||||
| float (*r_vert_normals)[3]); | float (*r_vert_normals)[3]); | ||||
| /** | /** | ||||
| * Calculate vertex and face normals, storing the result in custom data layers on the mesh. | * Calculate vertex and face normals, storing the result in custom data layers on the mesh. | ||||
| Show All 11 Lines | |||||
| /** | /** | ||||
| * Define sharp edges as needed to mimic 'autosmooth' from angle threshold. | * Define sharp edges as needed to mimic 'autosmooth' from angle threshold. | ||||
| * | * | ||||
| * Used when defining an empty custom loop normals data layer, | * Used when defining an empty custom loop normals data layer, | ||||
| * to keep same shading as with auto-smooth! | * to keep same shading as with auto-smooth! | ||||
| */ | */ | ||||
| void BKE_edges_sharp_from_angle_set(int numEdges, | void BKE_edges_sharp_from_angle_set(int numEdges, | ||||
| const struct MLoop *mloops, | const int *corner_verts, | ||||
| int numLoops, | const int *corner_edges, | ||||
| int corners_num, | |||||
| const struct MPoly *mpolys, | const struct MPoly *mpolys, | ||||
| const float (*poly_normals)[3], | const float (*poly_normals)[3], | ||||
| int numPolys, | int numPolys, | ||||
| float split_angle, | float split_angle, | ||||
| bool *sharp_edges); | bool *sharp_edges); | ||||
| /** | /** | ||||
| * References a contiguous loop-fan with normal offset vars. | * References a contiguous loop-fan with normal offset vars. | ||||
| Show All 25 Lines | |||||
| enum { | enum { | ||||
| MLNOR_SPACE_IS_SINGLE = 1 << 0, | MLNOR_SPACE_IS_SINGLE = 1 << 0, | ||||
| }; | }; | ||||
| /** | /** | ||||
| * Collection of #MLoopNorSpace basic storage & pre-allocation. | * Collection of #MLoopNorSpace basic storage & pre-allocation. | ||||
| */ | */ | ||||
| typedef struct MLoopNorSpaceArray { | typedef struct MLoopNorSpaceArray { | ||||
| MLoopNorSpace **lspacearr; /* MLoop aligned array */ | MLoopNorSpace **lspacearr; /* Face corner aligned array */ | ||||
| struct LinkNode | struct LinkNode | ||||
| *loops_pool; /* Allocated once, avoids to call BLI_linklist_prepend_arena() for each loop! */ | *loops_pool; /* Allocated once, avoids to call BLI_linklist_prepend_arena() for each loop! */ | ||||
| char data_type; /* Whether we store loop indices, or pointers to BMLoop. */ | char data_type; /* Whether we store loop indices, or pointers to BMLoop. */ | ||||
| int spaces_num; /* Number of clnors spaces defined in this array. */ | int spaces_num; /* Number of clnors spaces defined in this array. */ | ||||
| struct MemArena *mem; | struct MemArena *mem; | ||||
| } MLoopNorSpaceArray; | } MLoopNorSpaceArray; | ||||
| /** | /** | ||||
| * MLoopNorSpaceArray.data_type | * MLoopNorSpaceArray.data_type | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
| * \param sharp_edges: Optional array of sharp edge tags, used to split the evaluated normals on | * \param sharp_edges: Optional array of sharp edge tags, used to split the evaluated normals on | ||||
| * each side of the edge. | * each side of the edge. | ||||
| */ | */ | ||||
| void BKE_mesh_normals_loop_split(const float (*vert_positions)[3], | void BKE_mesh_normals_loop_split(const float (*vert_positions)[3], | ||||
| const float (*vert_normals)[3], | const float (*vert_normals)[3], | ||||
| int numVerts, | int numVerts, | ||||
| const struct MEdge *medges, | const struct MEdge *medges, | ||||
| int numEdges, | int numEdges, | ||||
| const struct MLoop *mloops, | const int *corner_verts, | ||||
| const int *corner_edges, | |||||
| float (*r_loop_normals)[3], | float (*r_loop_normals)[3], | ||||
| int numLoops, | int numLoops, | ||||
| const struct MPoly *mpolys, | const struct MPoly *mpolys, | ||||
| const float (*poly_normals)[3], | const float (*poly_normals)[3], | ||||
| int numPolys, | int numPolys, | ||||
| bool use_split_normals, | bool use_split_normals, | ||||
| float split_angle, | float split_angle, | ||||
| const bool *sharp_edges, | const bool *sharp_edges, | ||||
| const int *loop_to_poly_map, | const int *loop_to_poly_map, | ||||
| MLoopNorSpaceArray *r_lnors_spacearr, | MLoopNorSpaceArray *r_lnors_spacearr, | ||||
| short (*clnors_data)[2]); | short (*clnors_data)[2]); | ||||
| void BKE_mesh_normals_loop_custom_set(const float (*vert_positions)[3], | void BKE_mesh_normals_loop_custom_set(const float (*vert_positions)[3], | ||||
| const float (*vert_normals)[3], | const float (*vert_normals)[3], | ||||
| int numVerts, | int numVerts, | ||||
| const struct MEdge *medges, | const struct MEdge *medges, | ||||
| int numEdges, | int numEdges, | ||||
| const struct MLoop *mloops, | const int *corner_verts, | ||||
| const int *corner_edges, | |||||
| float (*r_custom_loop_normals)[3], | float (*r_custom_loop_normals)[3], | ||||
| int numLoops, | int numLoops, | ||||
| const struct MPoly *mpolys, | const struct MPoly *mpolys, | ||||
| const float (*poly_normals)[3], | const float (*poly_normals)[3], | ||||
| int numPolys, | int numPolys, | ||||
| bool *sharp_edges, | bool *sharp_edges, | ||||
| short (*r_clnors_data)[2]); | short (*r_clnors_data)[2]); | ||||
| void BKE_mesh_normals_loop_custom_from_verts_set(const float (*vert_positions)[3], | void BKE_mesh_normals_loop_custom_from_verts_set(const float (*vert_positions)[3], | ||||
| const float (*vert_normals)[3], | const float (*vert_normals)[3], | ||||
| float (*r_custom_vert_normals)[3], | float (*r_custom_vert_normals)[3], | ||||
| int numVerts, | int numVerts, | ||||
| const struct MEdge *medges, | const struct MEdge *medges, | ||||
| int numEdges, | int numEdges, | ||||
| const struct MLoop *mloops, | const int *corner_verts, | ||||
| int numLoops, | const int *corner_edges, | ||||
| int corners_num, | |||||
| const struct MPoly *mpolys, | const struct MPoly *mpolys, | ||||
| const float (*poly_normals)[3], | const float (*poly_normals)[3], | ||||
| int numPolys, | int numPolys, | ||||
| bool *sharp_edges, | bool *sharp_edges, | ||||
| short (*r_clnors_data)[2]); | short (*r_clnors_data)[2]); | ||||
| /** | /** | ||||
| * Computes average per-vertex normals from given custom loop normals. | * Computes average per-vertex normals from given custom loop normals. | ||||
| * | * | ||||
| * \param clnors: The computed custom loop normals. | * \param clnors: The computed custom loop normals. | ||||
| * \param r_vert_clnors: The (already allocated) array where to store averaged per-vertex normals. | * \param r_vert_clnors: The (already allocated) array where to store averaged per-vertex normals. | ||||
| */ | */ | ||||
| void BKE_mesh_normals_loop_to_vertex(int numVerts, | void BKE_mesh_normals_loop_to_vertex(int numVerts, | ||||
| const struct MLoop *mloops, | const int *corner_verts, | ||||
| int numLoops, | int numLoops, | ||||
| const float (*clnors)[3], | const float (*clnors)[3], | ||||
| float (*r_vert_clnors)[3]); | float (*r_vert_clnors)[3]); | ||||
| /** | /** | ||||
| * High-level custom normals functions. | * High-level custom normals functions. | ||||
| */ | */ | ||||
| bool BKE_mesh_has_custom_loop_normals(struct Mesh *me); | bool BKE_mesh_has_custom_loop_normals(struct Mesh *me); | ||||
| Show All 25 Lines | |||||
| * \param r_custom_vert_normals: is not const, since code will replace zero_v3 normals there | * \param r_custom_vert_normals: is not const, since code will replace zero_v3 normals there | ||||
| * with automatically computed vectors. | * with automatically computed vectors. | ||||
| */ | */ | ||||
| void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_vert_normals)[3]); | void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_vert_normals)[3]); | ||||
| /* *** mesh_evaluate.cc *** */ | /* *** mesh_evaluate.cc *** */ | ||||
| void BKE_mesh_calc_poly_center(const struct MPoly *mpoly, | void BKE_mesh_calc_poly_center(const struct MPoly *mpoly, | ||||
| const struct MLoop *loopstart, | const int *poly_verts, | ||||
| const float (*vert_positions)[3], | const float (*vert_positions)[3], | ||||
| float r_cent[3]); | float r_cent[3]); | ||||
| /* NOTE: passing poly-normal is only a speedup so we can skip calculating it. */ | /* NOTE: passing poly-normal is only a speedup so we can skip calculating it. */ | ||||
| float BKE_mesh_calc_poly_area(const struct MPoly *mpoly, | float BKE_mesh_calc_poly_area(const struct MPoly *mpoly, | ||||
| const struct MLoop *loopstart, | const int *poly_verts, | ||||
| const float (*vert_positions)[3]); | const float (*vert_positions)[3]); | ||||
| float BKE_mesh_calc_area(const struct Mesh *me); | float BKE_mesh_calc_area(const struct Mesh *me); | ||||
| void BKE_mesh_calc_poly_angles(const struct MPoly *mpoly, | void BKE_mesh_calc_poly_angles(const struct MPoly *mpoly, | ||||
| const struct MLoop *loopstart, | const int *poly_verts, | ||||
| const float (*vert_positions)[3], | const float (*vert_positions)[3], | ||||
| float angles[]); | float angles[]); | ||||
| void BKE_mesh_poly_edgehash_insert(struct EdgeHash *ehash, | void BKE_mesh_poly_edgehash_insert(struct EdgeHash *ehash, | ||||
| const struct MPoly *mp, | const struct MPoly *mp, | ||||
| const struct MLoop *mloop); | const int *corner_verts); | ||||
| void BKE_mesh_poly_edgebitmap_insert(unsigned int *edge_bitmap, | void BKE_mesh_poly_edgebitmap_insert(unsigned int *edge_bitmap, | ||||
| const struct MPoly *mp, | const struct MPoly *mp, | ||||
| const struct MLoop *mloop); | const int *poly_edges); | ||||
| bool BKE_mesh_center_median(const struct Mesh *me, float r_cent[3]); | bool BKE_mesh_center_median(const struct Mesh *me, float r_cent[3]); | ||||
| /** | /** | ||||
| * Calculate the center from polygons, | * Calculate the center from polygons, | ||||
| * use when we want to ignore vertex locations that don't have connected faces. | * use when we want to ignore vertex locations that don't have connected faces. | ||||
| */ | */ | ||||
| bool BKE_mesh_center_median_from_polys(const struct Mesh *me, float r_cent[3]); | bool BKE_mesh_center_median_from_polys(const struct Mesh *me, float r_cent[3]); | ||||
| bool BKE_mesh_center_bounds(const struct Mesh *me, float r_cent[3]); | bool BKE_mesh_center_bounds(const struct Mesh *me, float r_cent[3]); | ||||
| Show All 9 Lines | |||||
| * | * | ||||
| * \param r_volume: Volume (unsigned). | * \param r_volume: Volume (unsigned). | ||||
| * \param r_center: Center of mass. | * \param r_center: Center of mass. | ||||
| */ | */ | ||||
| void BKE_mesh_calc_volume(const float (*vert_positions)[3], | void BKE_mesh_calc_volume(const float (*vert_positions)[3], | ||||
| int mverts_num, | int mverts_num, | ||||
| const struct MLoopTri *mlooptri, | const struct MLoopTri *mlooptri, | ||||
| int looptri_num, | int looptri_num, | ||||
| const struct MLoop *mloop, | const int *corner_verts, | ||||
| float *r_volume, | float *r_volume, | ||||
| float r_center[3]); | float r_center[3]); | ||||
| /** | /** | ||||
| * Flip a single MLoop's #MDisps structure, | * Flip a single corner's #MDisps structure, | ||||
| * low level function to be called from face-flipping code which re-arranged the mdisps themselves. | * low level function to be called from face-flipping code which re-arranged the mdisps themselves. | ||||
| */ | */ | ||||
| void BKE_mesh_mdisp_flip(struct MDisps *md, bool use_loop_mdisp_flip); | void BKE_mesh_mdisp_flip(struct MDisps *md, bool use_loop_mdisp_flip); | ||||
| /** | /** | ||||
| * Flip (invert winding of) the given \a mpoly, i.e. reverse order of its loops | * Flip (invert winding of) the given \a mpoly, i.e. reverse order of its loops | ||||
| * (keeping the same vertex as 'start point'). | * (keeping the same vertex as 'start point'). | ||||
| * | * | ||||
| * \param mpoly: the polygon to flip. | * \param mpoly: the polygon to flip. | ||||
| * \param mloop: the full loops array. | |||||
| * \param ldata: the loops custom data. | |||||
| */ | */ | ||||
| void BKE_mesh_polygon_flip_ex(const struct MPoly *mpoly, | void BKE_mesh_polygon_flip_ex(const struct MPoly *mpoly, | ||||
| struct MLoop *mloop, | int *corner_verts, | ||||
| int *corner_edges, | |||||
| struct CustomData *ldata, | struct CustomData *ldata, | ||||
| float (*lnors)[3], | float (*lnors)[3], | ||||
| struct MDisps *mdisp, | struct MDisps *mdisp, | ||||
| bool use_loop_mdisp_flip); | bool use_loop_mdisp_flip); | ||||
| void BKE_mesh_polygon_flip(const struct MPoly *mpoly, | void BKE_mesh_polygon_flip(const struct MPoly *mpoly, | ||||
| struct MLoop *mloop, | int *corner_verts, | ||||
| int *corner_edges, | |||||
| struct CustomData *ldata, | struct CustomData *ldata, | ||||
| int totloop); | int totloop); | ||||
| /** | /** | ||||
| * Flip (invert winding of) all polygons (used to inverse their normals). | * Flip (invert winding of) all polygons (used to inverse their normals). | ||||
| * | * | ||||
| * \note Invalidates tessellation, caller must handle that. | * \note Invalidates tessellation, caller must handle that. | ||||
| */ | */ | ||||
| void BKE_mesh_polys_flip(const struct MPoly *mpoly, | void BKE_mesh_polys_flip(const struct MPoly *mpoly, | ||||
| struct MLoop *mloop, | int *corner_verts, | ||||
| int *corner_edges, | |||||
| struct CustomData *ldata, | struct CustomData *ldata, | ||||
| int totpoly); | int totpoly); | ||||
| /* Merge verts. */ | /* Merge verts. */ | ||||
| /* Enum for merge_mode of #BKE_mesh_merge_verts. | /* Enum for merge_mode of #BKE_mesh_merge_verts. | ||||
| * Refer to mesh_merge.c for details. */ | * Refer to mesh_merge.c for details. */ | ||||
| enum { | enum { | ||||
| MESH_MERGE_VERTS_DUMP_IF_MAPPED, | MESH_MERGE_VERTS_DUMP_IF_MAPPED, | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
| * \param vert_cos_src: reference deform source. | * \param vert_cos_src: reference deform source. | ||||
| * \param vert_cos_dst: reference deform destination. | * \param vert_cos_dst: reference deform destination. | ||||
| * | * | ||||
| * \param vert_cos_org: reference for the output location. | * \param vert_cos_org: reference for the output location. | ||||
| * \param vert_cos_new: resulting coords. | * \param vert_cos_new: resulting coords. | ||||
| */ | */ | ||||
| void BKE_mesh_calc_relative_deform(const struct MPoly *mpoly, | void BKE_mesh_calc_relative_deform(const struct MPoly *mpoly, | ||||
| int totpoly, | int totpoly, | ||||
| const struct MLoop *mloop, | const int *corner_verts, | ||||
| int totvert, | int totvert, | ||||
| const float (*vert_cos_src)[3], | const float (*vert_cos_src)[3], | ||||
| const float (*vert_cos_dst)[3], | const float (*vert_cos_dst)[3], | ||||
| const float (*vert_cos_org)[3], | const float (*vert_cos_org)[3], | ||||
| float (*vert_cos_new)[3]); | float (*vert_cos_new)[3]); | ||||
| Show All 33 Lines | |||||
| */ | */ | ||||
| bool BKE_mesh_validate_arrays(struct Mesh *me, | bool BKE_mesh_validate_arrays(struct Mesh *me, | ||||
| float (*vert_positions)[3], | float (*vert_positions)[3], | ||||
| unsigned int totvert, | unsigned int totvert, | ||||
| struct MEdge *medges, | struct MEdge *medges, | ||||
| unsigned int totedge, | unsigned int totedge, | ||||
| struct MFace *mfaces, | struct MFace *mfaces, | ||||
| unsigned int totface, | unsigned int totface, | ||||
| struct MLoop *mloops, | int *corner_verts, | ||||
| int *corner_edges, | |||||
| unsigned int totloop, | unsigned int totloop, | ||||
| struct MPoly *mpolys, | struct MPoly *mpolys, | ||||
| unsigned int totpoly, | unsigned int totpoly, | ||||
| struct MDeformVert *dverts, /* assume totvert length */ | struct MDeformVert *dverts, /* assume totvert length */ | ||||
| bool do_verbose, | bool do_verbose, | ||||
| bool do_fixes, | bool do_fixes, | ||||
| bool *r_change); | bool *r_change); | ||||
| ▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| return (const MPoly *)CustomData_get_layer(&mesh->pdata, CD_MPOLY); | return (const MPoly *)CustomData_get_layer(&mesh->pdata, CD_MPOLY); | ||||
| } | } | ||||
| BLI_INLINE MPoly *BKE_mesh_polys_for_write(Mesh *mesh) | BLI_INLINE MPoly *BKE_mesh_polys_for_write(Mesh *mesh) | ||||
| { | { | ||||
| return (MPoly *)CustomData_get_layer_for_write(&mesh->pdata, CD_MPOLY, mesh->totpoly); | return (MPoly *)CustomData_get_layer_for_write(&mesh->pdata, CD_MPOLY, mesh->totpoly); | ||||
| } | } | ||||
| BLI_INLINE const MLoop *BKE_mesh_loops(const Mesh *mesh) | BLI_INLINE const int *BKE_mesh_corner_verts(const Mesh *mesh) | ||||
| { | |||||
| return (const int *)CustomData_get_layer_named(&mesh->ldata, CD_PROP_INT32, ".corner_vert"); | |||||
| } | |||||
| BLI_INLINE int *BKE_mesh_corner_verts_for_write(Mesh *mesh) | |||||
| { | |||||
| return (int *)CustomData_get_layer_named_for_write( | |||||
| &mesh->ldata, CD_PROP_INT32, ".corner_vert", mesh->totloop); | |||||
| } | |||||
| BLI_INLINE const int *BKE_mesh_corner_edges(const Mesh *mesh) | |||||
| { | { | ||||
| return (const MLoop *)CustomData_get_layer(&mesh->ldata, CD_MLOOP); | return (const int *)CustomData_get_layer_named(&mesh->ldata, CD_PROP_INT32, ".corner_edge"); | ||||
| } | } | ||||
| BLI_INLINE MLoop *BKE_mesh_loops_for_write(Mesh *mesh) | BLI_INLINE int *BKE_mesh_corner_edges_for_write(Mesh *mesh) | ||||
| { | { | ||||
| return (MLoop *)CustomData_get_layer_for_write(&mesh->ldata, CD_MLOOP, mesh->totloop); | return (int *)CustomData_get_layer_named_for_write( | ||||
| &mesh->ldata, CD_PROP_INT32, ".corner_edge", mesh->totloop); | |||||
| } | } | ||||
| BLI_INLINE const MDeformVert *BKE_mesh_deform_verts(const Mesh *mesh) | BLI_INLINE const MDeformVert *BKE_mesh_deform_verts(const Mesh *mesh) | ||||
| { | { | ||||
| return (const MDeformVert *)CustomData_get_layer(&mesh->vdata, CD_MDEFORMVERT); | return (const MDeformVert *)CustomData_get_layer(&mesh->vdata, CD_MDEFORMVERT); | ||||
| } | } | ||||
| BLI_INLINE MDeformVert *BKE_mesh_deform_verts_for_write(Mesh *mesh) | BLI_INLINE MDeformVert *BKE_mesh_deform_verts_for_write(Mesh *mesh) | ||||
| { | { | ||||
| Show All 38 Lines | |||||
| { | { | ||||
| return {BKE_mesh_polys(this), this->totpoly}; | return {BKE_mesh_polys(this), this->totpoly}; | ||||
| } | } | ||||
| inline blender::MutableSpan<MPoly> Mesh::polys_for_write() | inline blender::MutableSpan<MPoly> Mesh::polys_for_write() | ||||
| { | { | ||||
| return {BKE_mesh_polys_for_write(this), this->totpoly}; | return {BKE_mesh_polys_for_write(this), this->totpoly}; | ||||
| } | } | ||||
| inline blender::Span<MLoop> Mesh::loops() const | inline blender::Span<int> Mesh::corner_verts() const | ||||
| { | |||||
| return {BKE_mesh_corner_verts(this), this->totloop}; | |||||
| } | |||||
| inline blender::MutableSpan<int> Mesh::corner_verts_for_write() | |||||
| { | |||||
| return {BKE_mesh_corner_verts_for_write(this), this->totloop}; | |||||
| } | |||||
| inline blender::Span<int> Mesh::corner_edges() const | |||||
| { | { | ||||
| return {BKE_mesh_loops(this), this->totloop}; | return {BKE_mesh_corner_edges(this), this->totloop}; | ||||
| } | } | ||||
| inline blender::MutableSpan<MLoop> Mesh::loops_for_write() | inline blender::MutableSpan<int> Mesh::corner_edges_for_write() | ||||
| { | { | ||||
| return {BKE_mesh_loops_for_write(this), this->totloop}; | return {BKE_mesh_corner_edges_for_write(this), this->totloop}; | ||||
| } | } | ||||
| inline blender::Span<MDeformVert> Mesh::deform_verts() const | inline blender::Span<MDeformVert> Mesh::deform_verts() const | ||||
| { | { | ||||
| const MDeformVert *dverts = BKE_mesh_deform_verts(this); | const MDeformVert *dverts = BKE_mesh_deform_verts(this); | ||||
| if (!dverts) { | if (!dverts) { | ||||
| return {}; | return {}; | ||||
| } | } | ||||
| Show All 22 Lines | |||||