|
Blender
V2.93
|
#include <limits.h>#include "CLG_log.h"#include "MEM_guardedalloc.h"#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "DNA_object_types.h"#include "BLI_alloca.h"#include "BLI_bitmap.h"#include "BLI_edgehash.h"#include "BLI_linklist.h"#include "BLI_linklist_stack.h"#include "BLI_math.h"#include "BLI_memarena.h"#include "BLI_polyfill_2d.h"#include "BLI_stack.h"#include "BLI_task.h"#include "BLI_utildefines.h"#include "BKE_customdata.h"#include "BKE_editmesh_cache.h"#include "BKE_global.h"#include "BKE_mesh.h"#include "BKE_multires.h"#include "BKE_report.h"#include "BLI_strict_flags.h"#include "atomic_ops.h"#include "mikktspace.h"#include "PIL_time.h"Go to the source code of this file.
Classes | |
| struct | MeshCalcNormalsData |
| struct | LoopSplitTaskData |
| struct | LoopSplitTaskDataCommon |
Macros | |
| #define | USE_TESSFACE_SPEEDUP |
| #define | USE_TESSFACE_QUADS /* NEEDS FURTHER TESTING */ |
| #define | TESSFACE_IS_QUAD 1 |
| #define | ML_TO_MF(i1, i2, i3) |
| #define | ML_TO_MF_QUAD() |
| #define | USE_TESSFACE_SPEEDUP |
| #define | ML_TO_MLT(i1, i2, i3) |
| #define | ME_FGON (1 << 3) |
| #define | ML(v1, v2) |
Functions | |
| void | BKE_mesh_mdisp_flip (MDisps *md, const bool use_loop_mdisp_flip) |
| void | BKE_mesh_polygon_flip_ex (MPoly *mpoly, MLoop *mloop, CustomData *ldata, float(*lnors)[3], MDisps *mdisp, const bool use_loop_mdisp_flip) |
| void | BKE_mesh_polygon_flip (MPoly *mpoly, MLoop *mloop, CustomData *ldata) |
| void | BKE_mesh_polygons_flip (MPoly *mpoly, MLoop *mloop, CustomData *ldata, int totpoly) |
Polygon Calculations | |
| static void | mesh_calc_ngon_normal (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvert, float normal[3]) |
| void | BKE_mesh_calc_poly_normal (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float r_no[3]) |
| static void | mesh_calc_ngon_normal_coords (const MPoly *mpoly, const MLoop *loopstart, const float(*vertex_coords)[3], float r_normal[3]) |
| void | BKE_mesh_calc_poly_normal_coords (const MPoly *mpoly, const MLoop *loopstart, const float(*vertex_coords)[3], float r_no[3]) |
| static void | mesh_calc_ngon_center (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvert, float cent[3]) |
| void | BKE_mesh_calc_poly_center (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float r_cent[3]) |
| float | BKE_mesh_calc_poly_area (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray) |
| float | BKE_mesh_calc_area (const Mesh *me) |
| float | BKE_mesh_calc_poly_uv_area (const MPoly *mpoly, const MLoopUV *uv_array) |
| static float UNUSED_FUNCTION() | mesh_calc_poly_volume_centroid (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float r_cent[3]) |
| static float | mesh_calc_poly_volume_centroid_with_reference_center (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, const float reference_center[3], float r_cent[3]) |
| static float | mesh_calc_poly_area_centroid (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float r_cent[3]) |
| void | BKE_mesh_calc_poly_angles (const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray, float angles[]) |
| void | BKE_mesh_poly_edgehash_insert (EdgeHash *ehash, const MPoly *mp, const MLoop *mloop) |
| void | BKE_mesh_poly_edgebitmap_insert (unsigned int *edge_bitmap, const MPoly *mp, const MLoop *mloop) |
Mesh Center Calculation | |
| bool | BKE_mesh_center_median (const Mesh *me, float r_cent[3]) |
| bool | BKE_mesh_center_median_from_polys (const Mesh *me, float r_cent[3]) |
| bool | BKE_mesh_center_bounds (const Mesh *me, float r_cent[3]) |
| bool | BKE_mesh_center_of_surface (const Mesh *me, float r_cent[3]) |
| bool | BKE_mesh_center_of_volume (const Mesh *me, float r_cent[3]) |
Mesh Volume Calculation | |
| static bool | mesh_calc_center_centroid_ex (const MVert *mverts, int UNUSED(mverts_num), const MLoopTri *looptri, int looptri_num, const MLoop *mloop, float r_center[3]) |
| void | BKE_mesh_calc_volume (const MVert *mverts, const int mverts_num, const MLoopTri *looptri, const int looptri_num, const MLoop *mloop, float *r_volume, float r_center[3]) |
NGon Tessellation (NGon/Tessface Conversion) | |
| void | BKE_mesh_loops_to_mface_corners (CustomData *fdata, CustomData *ldata, CustomData *UNUSED(pdata), unsigned int lindex[4], int findex, const int UNUSED(polyindex), const int mf_len, const int numUV, const int numCol, const bool hasPCol, const bool hasOrigSpace, const bool hasLNor) |
| void | BKE_mesh_loops_to_tessdata (CustomData *fdata, CustomData *ldata, MFace *mface, const int *polyindices, unsigned int(*loopindices)[4], const int num_faces) |
| void | BKE_mesh_tangent_loops_to_tessdata (CustomData *fdata, CustomData *ldata, MFace *mface, const int *polyindices, unsigned int(*loopindices)[4], const int num_faces, const char *layer_name) |
| int | BKE_mesh_tessface_calc_ex (CustomData *fdata, CustomData *ldata, CustomData *pdata, MVert *mvert, int totface, int totloop, int totpoly, const bool do_face_nor_copy) |
| void | BKE_mesh_recalc_looptri (const MLoop *mloop, const MPoly *mpoly, const MVert *mvert, int totloop, int totpoly, MLoopTri *mlooptri) |
| static void | bm_corners_to_loops_ex (ID *id, CustomData *fdata, CustomData *ldata, MFace *mface, int totloop, int findex, int loopstart, int numTex, int numCol) |
| void | BKE_mesh_convert_mfaces_to_mpolys (Mesh *mesh) |
| void | BKE_mesh_do_versions_convert_mfaces_to_mpolys (Mesh *mesh) |
| void | BKE_mesh_convert_mfaces_to_mpolys_ex (ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata, int totedge_i, int totface_i, int totloop_i, int totpoly_i, MEdge *medge, MFace *mface, int *r_totloop, int *r_totpoly, MLoop **r_mloop, MPoly **r_mpoly) |
Mesh Flag Flushing | |
| void | BKE_mesh_flush_hidden_from_verts_ex (const MVert *mvert, const MLoop *mloop, MEdge *medge, const int totedge, MPoly *mpoly, const int totpoly) |
| void | BKE_mesh_flush_hidden_from_verts (Mesh *me) |
| void | BKE_mesh_flush_hidden_from_polys_ex (MVert *mvert, const MLoop *mloop, MEdge *medge, const int UNUSED(totedge), const MPoly *mpoly, const int totpoly) |
| void | BKE_mesh_flush_hidden_from_polys (Mesh *me) |
| void | BKE_mesh_flush_select_from_polys_ex (MVert *mvert, const int totvert, const MLoop *mloop, MEdge *medge, const int totedge, const MPoly *mpoly, const int totpoly) |
| void | BKE_mesh_flush_select_from_polys (Mesh *me) |
| void | BKE_mesh_flush_select_from_verts_ex (const MVert *mvert, const int UNUSED(totvert), const MLoop *mloop, MEdge *medge, const int totedge, MPoly *mpoly, const int totpoly) |
| void | BKE_mesh_flush_select_from_verts (Mesh *me) |
Mesh Spatial Calculation | |
| void | BKE_mesh_calc_relative_deform (const MPoly *mpoly, const int totpoly, const MLoop *mloop, const int totvert, const float(*vert_cos_src)[3], const float(*vert_cos_dst)[3], const float(*vert_cos_org)[3], float(*vert_cos_new)[3]) |
Variables | |
| static CLG_LogRef | LOG = {"bke.mesh_evaluate"} |
Mesh Normal Calculation | |
| #define | LNOR_SPACE_TRIGO_THRESHOLD (1.0f - 1e-4f) |
| #define | LOOP_SPLIT_TASK_BLOCK_SIZE 1024 |
| #define | INDEX_UNSET INT_MIN |
| #define | INDEX_INVALID -1 |
| #define | IS_EDGE_SHARP(_e2l) (ELEM((_e2l)[1], INDEX_UNSET, INDEX_INVALID)) |
| typedef struct MeshCalcNormalsData | MeshCalcNormalsData |
| typedef struct LoopSplitTaskData | LoopSplitTaskData |
| typedef struct LoopSplitTaskDataCommon | LoopSplitTaskDataCommon |
| static void | mesh_calc_normals_vert_fallback (MVert *mverts, int numVerts) |
| void | BKE_mesh_calc_normals_mapping_simple (struct Mesh *mesh) |
| void | BKE_mesh_calc_normals_mapping (MVert *mverts, int numVerts, const MLoop *mloop, const MPoly *mpolys, int numLoops, int numPolys, float(*r_polyNors)[3], const MFace *mfaces, int numFaces, const int *origIndexFace, float(*r_faceNors)[3]) |
| void | BKE_mesh_calc_normals_mapping_ex (MVert *mverts, int numVerts, const MLoop *mloop, const MPoly *mpolys, int numLoops, int numPolys, float(*r_polyNors)[3], const MFace *mfaces, int numFaces, const int *origIndexFace, float(*r_faceNors)[3], const bool only_face_normals) |
| static void | mesh_calc_normals_poly_cb (void *__restrict userdata, const int pidx, const TaskParallelTLS *__restrict UNUSED(tls)) |
| static void | mesh_calc_normals_poly_prepare_cb (void *__restrict userdata, const int pidx, const TaskParallelTLS *__restrict UNUSED(tls)) |
| static void | mesh_calc_normals_poly_finalize_cb (void *__restrict userdata, const int vidx, const TaskParallelTLS *__restrict UNUSED(tls)) |
| void | BKE_mesh_calc_normals_poly (MVert *mverts, float(*r_vertnors)[3], int numVerts, const MLoop *mloop, const MPoly *mpolys, int numLoops, int numPolys, float(*r_polynors)[3], const bool only_face_normals) |
| void | BKE_mesh_ensure_normals (Mesh *mesh) |
| void | BKE_mesh_ensure_normals_for_display (Mesh *mesh) |
| void | BKE_mesh_calc_normals (Mesh *mesh) |
| void | BKE_mesh_calc_normals_looptri (MVert *mverts, int numVerts, const MLoop *mloop, const MLoopTri *looptri, int looptri_num, float(*r_tri_nors)[3]) |
| void | BKE_lnor_spacearr_init (MLoopNorSpaceArray *lnors_spacearr, const int numLoops, const char data_type) |
| void | BKE_lnor_spacearr_clear (MLoopNorSpaceArray *lnors_spacearr) |
| void | BKE_lnor_spacearr_free (MLoopNorSpaceArray *lnors_spacearr) |
| MLoopNorSpace * | BKE_lnor_space_create (MLoopNorSpaceArray *lnors_spacearr) |
| void | BKE_lnor_space_define (MLoopNorSpace *lnor_space, const float lnor[3], float vec_ref[3], float vec_other[3], BLI_Stack *edge_vectors) |
| void | BKE_lnor_space_add_loop (MLoopNorSpaceArray *lnors_spacearr, MLoopNorSpace *lnor_space, const int ml_index, void *bm_loop, const bool is_single) |
| MINLINE float | unit_short_to_float (const short val) |
| MINLINE short | unit_float_to_short (const float val) |
| void | BKE_lnor_space_custom_data_to_normal (MLoopNorSpace *lnor_space, const short clnor_data[2], float r_custom_lnor[3]) |
| void | BKE_lnor_space_custom_normal_to_data (MLoopNorSpace *lnor_space, const float custom_lnor[3], short r_clnor_data[2]) |
| static void | mesh_edges_sharp_tag (LoopSplitTaskDataCommon *data, const bool check_angle, const float split_angle, const bool do_sharp_edges_tag) |
| void | BKE_edges_sharp_from_angle_set (const struct MVert *mverts, const int UNUSED(numVerts), struct MEdge *medges, const int numEdges, struct MLoop *mloops, const int numLoops, struct MPoly *mpolys, const float(*polynors)[3], const int numPolys, const float split_angle) |
| void | BKE_mesh_loop_manifold_fan_around_vert_next (const MLoop *mloops, const MPoly *mpolys, const int *loop_to_poly, const int *e2lfan_curr, const uint mv_pivot_index, const MLoop **r_mlfan_curr, int *r_mlfan_curr_index, int *r_mlfan_vert_index, int *r_mpfan_curr_index) |
| static void | split_loop_nor_single_do (LoopSplitTaskDataCommon *common_data, LoopSplitTaskData *data) |
| static void | split_loop_nor_fan_do (LoopSplitTaskDataCommon *common_data, LoopSplitTaskData *data) |
| static void | loop_split_worker_do (LoopSplitTaskDataCommon *common_data, LoopSplitTaskData *data, BLI_Stack *edge_vectors) |
| static void | loop_split_worker (TaskPool *__restrict pool, void *taskdata) |
| static bool | loop_split_generator_check_cyclic_smooth_fan (const MLoop *mloops, const MPoly *mpolys, const int(*edge_to_loops)[2], const int *loop_to_poly, const int *e2l_prev, BLI_bitmap *skip_loops, const MLoop *ml_curr, const MLoop *ml_prev, const int ml_curr_index, const int ml_prev_index, const int mp_curr_index) |
| static void | loop_split_generator (TaskPool *pool, LoopSplitTaskDataCommon *common_data) |
| void | BKE_mesh_normals_loop_split (const MVert *mverts, const int UNUSED(numVerts), MEdge *medges, const int numEdges, MLoop *mloops, float(*r_loopnors)[3], const int numLoops, MPoly *mpolys, const float(*polynors)[3], const int numPolys, const bool use_split_normals, const float split_angle, MLoopNorSpaceArray *r_lnors_spacearr, short(*clnors_data)[2], int *r_loop_to_poly) |
| static void | mesh_normals_loop_custom_set (const MVert *mverts, const int numVerts, MEdge *medges, const int numEdges, MLoop *mloops, float(*r_custom_loopnors)[3], const int numLoops, MPoly *mpolys, const float(*polynors)[3], const int numPolys, short(*r_clnors_data)[2], const bool use_vertices) |
| void | BKE_mesh_normals_loop_custom_set (const MVert *mverts, const int numVerts, MEdge *medges, const int numEdges, MLoop *mloops, float(*r_custom_loopnors)[3], const int numLoops, MPoly *mpolys, const float(*polynors)[3], const int numPolys, short(*r_clnors_data)[2]) |
| void | BKE_mesh_normals_loop_custom_from_vertices_set (const MVert *mverts, float(*r_custom_vertnors)[3], const int numVerts, MEdge *medges, const int numEdges, MLoop *mloops, const int numLoops, MPoly *mpolys, const float(*polynors)[3], const int numPolys, short(*r_clnors_data)[2]) |
| static void | mesh_set_custom_normals (Mesh *mesh, float(*r_custom_nors)[3], const bool use_vertices) |
| void | BKE_mesh_set_custom_normals (Mesh *mesh, float(*r_custom_loopnors)[3]) |
| void | BKE_mesh_set_custom_normals_from_vertices (Mesh *mesh, float(*r_custom_vertnors)[3]) |
| void | BKE_mesh_normals_loop_to_vertex (const int numVerts, const MLoop *mloops, const int numLoops, const float(*clnors)[3], float(*r_vert_clnors)[3]) |
Functions to evaluate mesh data.
Definition in file mesh_evaluate.c.
| #define INDEX_INVALID -1 |
Definition at line 819 of file mesh_evaluate.c.
| #define INDEX_UNSET INT_MIN |
Definition at line 818 of file mesh_evaluate.c.
| #define IS_EDGE_SHARP | ( | _e2l | ) | (ELEM((_e2l)[1], INDEX_UNSET, INDEX_INVALID)) |
Definition at line 821 of file mesh_evaluate.c.
| #define LNOR_SPACE_TRIGO_THRESHOLD (1.0f - 1e-4f) |
Definition at line 565 of file mesh_evaluate.c.
| #define LOOP_SPLIT_TASK_BLOCK_SIZE 1024 |
Definition at line 773 of file mesh_evaluate.c.
| #define ME_FGON (1 << 3) |
| #define ML_TO_MF | ( | i1, | |
| i2, | |||
| i3 | |||
| ) |
| #define ML_TO_MF_QUAD | ( | ) |
| #define ML_TO_MLT | ( | i1, | |
| i2, | |||
| i3 | |||
| ) |
| #define TESSFACE_IS_QUAD 1 |
| #define USE_TESSFACE_QUADS /* NEEDS FURTHER TESTING */ |
| #define USE_TESSFACE_SPEEDUP |
| #define USE_TESSFACE_SPEEDUP |
| typedef struct LoopSplitTaskData LoopSplitTaskData |
| typedef struct LoopSplitTaskDataCommon LoopSplitTaskDataCommon |
| typedef struct MeshCalcNormalsData MeshCalcNormalsData |
| void BKE_edges_sharp_from_angle_set | ( | const struct MVert * | mverts, |
| const int | UNUSEDnumVerts, | ||
| struct MEdge * | medges, | ||
| const int | numEdges, | ||
| struct MLoop * | mloops, | ||
| const int | numLoops, | ||
| struct MPoly * | mpolys, | ||
| const float(*) | polynors[3], | ||
| const int | numPolys, | ||
| const float | split_angle | ||
| ) |
Define sharp edges as needed to mimic 'autosmooth' from angle threshold.
Used when defining an empty custom loop normals data layer, to keep same shading as with autosmooth!
Definition at line 936 of file mesh_evaluate.c.
References M_PI, MEM_calloc_arrayN, MEM_freeN, MEM_malloc_arrayN, mesh_edges_sharp_tag(), and LoopSplitTaskDataCommon::mverts.
| void BKE_lnor_space_add_loop | ( | MLoopNorSpaceArray * | lnors_spacearr, |
| MLoopNorSpace * | lnor_space, | ||
| const int | ml_index, | ||
| void * | bm_loop, | ||
| const bool | is_single | ||
| ) |
Add a new given loop to given lnor_space. Depending on lnor_space->data_type, we expect bm_loop to be a pointer to BMLoop struct (in case of BMLOOP_PTR), or NULL (in case of LOOP_INDEX), loop index is then stored in pointer. If is_single is set, the BMLoop or loop index is directly stored in lnor_space->loops pointer (since there is only one loop in this fan), else it is added to the linked list of loops in the fan.
Definition at line 652 of file mesh_evaluate.c.
References BLI_assert, BLI_linklist_prepend_nlink(), MLoopNorSpaceArray::data_type, MLoopNorSpace::flags, MLoopNorSpace::loops, MLoopNorSpaceArray::loops_pool, MLoopNorSpaceArray::lspacearr, MLNOR_SPACE_IS_SINGLE, MLNOR_SPACEARR_BMLOOP_PTR, MLNOR_SPACEARR_LOOP_INDEX, NULL, and POINTER_FROM_INT.
Referenced by bm_mesh_loops_calc_normals(), split_loop_nor_fan_do(), and split_loop_nor_single_do().
| MLoopNorSpace* BKE_lnor_space_create | ( | MLoopNorSpaceArray * | lnors_spacearr | ) |
Definition at line 558 of file mesh_evaluate.c.
References BLI_memarena_calloc(), MLoopNorSpaceArray::mem, and MLoopNorSpaceArray::num_spaces.
Referenced by bm_mesh_loops_calc_normals(), and loop_split_generator().
| void BKE_lnor_space_custom_data_to_normal | ( | MLoopNorSpace * | lnor_space, |
| const short | clnor_data[2], | ||
| float | r_custom_lnor[3] | ||
| ) |
Definition at line 687 of file mesh_evaluate.c.
References alpha, beta(), copy_v3_v3(), cosf, float(), M_PI, madd_v3_v3fl(), mul_v3_v3fl(), MLoopNorSpace::ref_alpha, MLoopNorSpace::ref_beta, sinf, unit_short_to_float(), MLoopNorSpace::vec_lnor, MLoopNorSpace::vec_ortho, and MLoopNorSpace::vec_ref.
Referenced by BM_custom_loop_normals_to_vector_layer(), BM_lnorspace_rebuild(), bm_mesh_loops_calc_normals(), edbm_average_normals_exec(), edbm_smooth_normals_exec(), loop_normal_editdata_init(), split_loop_nor_fan_do(), and split_loop_nor_single_do().
| void BKE_lnor_space_custom_normal_to_data | ( | MLoopNorSpace * | lnor_space, |
| const float | custom_lnor[3], | ||
| short | r_clnor_data[2] | ||
| ) |
Definition at line 721 of file mesh_evaluate.c.
References add_v3_v3(), alpha, beta(), compare_v3v3(), dot_v3v3(), float(), is_zero_v3(), LNOR_SPACE_TRIGO_THRESHOLD, M_PI, mul_v3_v3fl(), normalize_v3(), MLoopNorSpace::ref_alpha, MLoopNorSpace::ref_beta, saacosf(), unit_float_to_short(), MLoopNorSpace::vec_lnor, MLoopNorSpace::vec_ortho, and MLoopNorSpace::vec_ref.
Referenced by applyNormalRotation(), bevel_harden_normals(), BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), BM_lnorspace_rebuild(), bm_mesh_loops_assign_normal_data(), edbm_average_normals_exec(), edbm_flip_normals_exec(), edbm_normals_tools_exec(), edbm_set_normals_from_faces_exec(), edbm_smooth_normals_exec(), flip_custom_normals(), freeCustomNormalArray(), mesh_normals_loop_custom_set(), normals_merge(), normals_split(), and point_normals_apply().
| void BKE_lnor_space_define | ( | MLoopNorSpace * | lnor_space, |
| const float | lnor[3], | ||
| float | vec_ref[3], | ||
| float | vec_other[3], | ||
| BLI_Stack * | edge_vectors | ||
| ) |
Definition at line 572 of file mesh_evaluate.c.
References alpha, beta(), BLI_assert, BLI_stack_clear(), BLI_stack_discard(), BLI_stack_is_empty(), BLI_stack_peek(), copy_v3_v3(), cross_v3_v3v3(), dot_v3v3(), fabsf, float(), LIKELY, LNOR_SPACE_TRIGO_THRESHOLD, M_PI, mul_v3_v3fl(), normalize_v3(), normalize_v3_v3(), MLoopNorSpace::ref_alpha, MLoopNorSpace::ref_beta, saacos(), saacosf(), sub_v3_v3(), UNLIKELY, MLoopNorSpace::vec_lnor, MLoopNorSpace::vec_ortho, and MLoopNorSpace::vec_ref.
Referenced by bm_mesh_loops_calc_normals(), split_loop_nor_fan_do(), and split_loop_nor_single_do().
| void BKE_lnor_spacearr_clear | ( | MLoopNorSpaceArray * | lnors_spacearr | ) |
Definition at line 539 of file mesh_evaluate.c.
References BLI_memarena_clear(), MLoopNorSpaceArray::loops_pool, MLoopNorSpaceArray::lspacearr, MLoopNorSpaceArray::mem, NULL, and MLoopNorSpaceArray::num_spaces.
Referenced by BM_lnorspace_rebuild(), bm_mesh_loops_custom_normals_set(), mesh_customdata_custom_splitnormals_clear_exec(), and mesh_normals_loop_custom_set().
| void BKE_lnor_spacearr_free | ( | MLoopNorSpaceArray * | lnors_spacearr | ) |
Definition at line 549 of file mesh_evaluate.c.
References BLI_memarena_free(), MLoopNorSpaceArray::loops_pool, MLoopNorSpaceArray::lspacearr, MLoopNorSpaceArray::mem, NULL, and MLoopNorSpaceArray::num_spaces.
Referenced by apply_weights_vertex_normal(), BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), BKE_mesh_normals_loop_split(), BKE_mesh_split_faces(), BM_lnorspace_err(), BM_mesh_data_free(), bm_mesh_loops_calc_normals(), and mesh_normals_loop_custom_set().
| void BKE_lnor_spacearr_init | ( | MLoopNorSpaceArray * | lnors_spacearr, |
| const int | numLoops, | ||
| const char | data_type | ||
| ) |
Definition at line 518 of file mesh_evaluate.c.
References BLI_assert, BLI_memarena_alloc(), BLI_memarena_calloc(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, MLoopNorSpaceArray::data_type, ELEM, MLoopNorSpaceArray::loops_pool, MLoopNorSpaceArray::lspacearr, MLoopNorSpaceArray::mem, MLNOR_SPACEARR_BMLOOP_PTR, MLNOR_SPACEARR_LOOP_INDEX, and MLoopNorSpaceArray::num_spaces.
Referenced by BKE_mesh_normals_loop_split(), BM_lnorspace_err(), and bm_mesh_loops_calc_normals().
Definition at line 2323 of file mesh_evaluate.c.
References BKE_mesh_calc_poly_area(), MPoly::loopstart, Mesh::mloop, Mesh::mpoly, Mesh::mvert, and Mesh::totpoly.
| void BKE_mesh_calc_normals | ( | Mesh * | mesh | ) |
Definition at line 442 of file mesh_evaluate.c.
References BKE_mesh_calc_normals(), BKE_mesh_calc_normals_poly(), Mesh_Runtime::cd_dirty_vert, CD_MASK_NORMAL, mesh, Mesh::mloop, Mesh::mpoly, Mesh::mvert, NULL, Mesh::runtime, TIMEIT_END_AVERAGED, TIMEIT_START_AVERAGED, Mesh::totloop, Mesh::totpoly, and Mesh::totvert.
Referenced by apply_objects_internal(), BKE_mesh_calc_normals(), BKE_mesh_ensure_normals(), BKE_mesh_from_metaball(), BKE_mesh_from_nurbs_displist(), BKE_modifier_deform_vertsEM(), cloth_build_springs(), blender::nodes::create_cylinder_or_cone_mesh(), MeshImporter::create_mesh_object(), deformVerts(), do_versions_after_linking_280(), ED_mesh_join_objects_exec(), ED_mesh_update(), blender::nodes::geo_node_subdivide_exec(), blender::nodes::geo_node_subdivision_surface_exec(), geometry_extract_apply(), modwrap_dependsOnNormals(), multires_reshape_apply_base_refit_base_mesh(), normalEditModifier_do_radial(), paint_mask_slice_exec(), blender::io::alembic::process_no_normals(), quadriflow_start_job(), SCULPT_flush_stroke_deform(), sculpt_gesture_trim_normals_update(), sculpt_symmetrize_exec(), sculpt_undo_restore_list(), SCULPT_vertcos_to_key(), blender::nodes::transform_mesh(), and voxel_remesh_exec().
| void BKE_mesh_calc_normals_looptri | ( | MVert * | mverts, |
| int | numVerts, | ||
| const MLoop * | mloop, | ||
| const MLoopTri * | looptri, | ||
| int | looptri_num, | ||
| float(*) | r_tri_nors[3] | ||
| ) |
Definition at line 462 of file mesh_evaluate.c.
References accumulate_vertex_normals_tri_v3(), float(), MEM_calloc_arrayN, MEM_freeN, normal_float_to_short_v3(), normal_tri_v3(), normalize_v3(), normalize_v3_v3(), MLoopTri::tri, UNLIKELY, and MLoop::v.
| void BKE_mesh_calc_normals_mapping | ( | MVert * | mverts, |
| int | numVerts, | ||
| const MLoop * | mloop, | ||
| const MPoly * | mpolys, | ||
| int | numLoops, | ||
| int | numPolys, | ||
| float(*) | r_polyNors[3], | ||
| const MFace * | mfaces, | ||
| int | numFaces, | ||
| const int * | origIndexFace, | ||
| float(*) | r_faceNors[3] | ||
| ) |
Definition at line 111 of file mesh_evaluate.c.
References BKE_mesh_calc_normals_mapping_ex().
| void BKE_mesh_calc_normals_mapping_ex | ( | MVert * | mverts, |
| int | numVerts, | ||
| const MLoop * | mloop, | ||
| const MPoly * | mpolys, | ||
| int | numLoops, | ||
| int | numPolys, | ||
| float(*) | r_polyNors[3], | ||
| const MFace * | mfaces, | ||
| int | numFaces, | ||
| const int * | origIndexFace, | ||
| float(*) | r_faceNors[3], | ||
| const bool | only_face_normals | ||
| ) |
Definition at line 137 of file mesh_evaluate.c.
References BKE_mesh_calc_normals_poly(), BKE_mesh_calc_poly_normal(), CLOG_ERROR, CLOG_WARN, copy_v3_v3(), float(), LOG, MPoly::loopstart, MEM_calloc_arrayN, MEM_freeN, mesh_calc_normals_vert_fallback(), and NULL.
Referenced by BKE_mesh_calc_normals_mapping(), and BKE_mesh_calc_normals_mapping_simple().
| void BKE_mesh_calc_normals_mapping_simple | ( | struct Mesh * | mesh | ) |
Definition at line 90 of file mesh_evaluate.c.
References BKE_mesh_calc_normals_mapping_ex(), CD_MVERT, CustomData_is_referenced_layer(), mesh, Mesh::mface, Mesh::mloop, Mesh::mpoly, Mesh::mvert, NULL, Mesh::totface, Mesh::totloop, Mesh::totpoly, and Mesh::totvert.
Referenced by curve_calc_modifiers_post().
| void BKE_mesh_calc_normals_poly | ( | MVert * | mverts, |
| float(*) | r_vertnors[3], | ||
| int | numVerts, | ||
| const MLoop * | mloop, | ||
| const MPoly * | mpolys, | ||
| int | numLoops, | ||
| int | numPolys, | ||
| float(*) | r_polynors[3], | ||
| const bool | only_face_normals | ||
| ) |
Definition at line 308 of file mesh_evaluate.c.
References add_v3_v3(), BLI_assert, BLI_parallel_range_settings_defaults(), BLI_task_parallel_range(), data, float(), MEM_calloc_arrayN, MEM_freeN, MEM_malloc_arrayN, mesh_calc_normals_poly_cb(), mesh_calc_normals_poly_finalize_cb(), mesh_calc_normals_poly_prepare_cb(), TaskParallelSettings::min_iter_per_thread, NULL, and v.
Referenced by BKE_mesh_calc_normals(), BKE_mesh_calc_normals_mapping_ex(), BKE_mesh_ensure_normals_for_display(), and mesh_set_custom_normals().
| void BKE_mesh_calc_poly_angles | ( | const MPoly * | mpoly, |
| const MLoop * | loopstart, | ||
| const MVert * | mvarray, | ||
| float | angles[] | ||
| ) |
Definition at line 2479 of file mesh_evaluate.c.
References angle_normalized_v3v3(), copy_v3_v3(), normalize_v3(), sub_v3_v3v3(), MPoly::totloop, and v.
| float BKE_mesh_calc_poly_area | ( | const MPoly * | mpoly, |
| const MLoop * | loopstart, | ||
| const MVert * | mvarray | ||
| ) |
Definition at line 2302 of file mesh_evaluate.c.
References blender::compositor::area(), area_poly_v3(), area_tri_v3(), BLI_array_alloca, MVert::co, copy_v3_v3(), float(), MPoly::totloop, v, and MLoop::v.
Referenced by BKE_mesh_calc_area().
| void BKE_mesh_calc_poly_center | ( | const MPoly * | mpoly, |
| const MLoop * | loopstart, | ||
| const MVert * | mvarray, | ||
| float | r_cent[3] | ||
| ) |
Definition at line 2278 of file mesh_evaluate.c.
References mesh_calc_ngon_center(), mid_v3_v3v3v3(), mid_v3_v3v3v3v3(), MPoly::totloop, and v.
| void BKE_mesh_calc_poly_normal | ( | const MPoly * | mpoly, |
| const MLoop * | loopstart, | ||
| const MVert * | mvarray, | ||
| float | r_no[3] | ||
| ) |
Definition at line 2187 of file mesh_evaluate.c.
References mesh_calc_ngon_normal(), normal_quad_v3(), normal_tri_v3(), MPoly::totloop, and v.
Referenced by BKE_mesh_calc_normals_mapping_ex(), mesh_calc_normals_poly_cb(), and mesh_calc_poly_area_centroid().
| void BKE_mesh_calc_poly_normal_coords | ( | const MPoly * | mpoly, |
| const MLoop * | loopstart, | ||
| const float(*) | vertex_coords[3], | ||
| float | r_no[3] | ||
| ) |
Definition at line 2236 of file mesh_evaluate.c.
References mesh_calc_ngon_normal_coords(), normal_quad_v3(), normal_tri_v3(), MPoly::totloop, and v.
Definition at line 2341 of file mesh_evaluate.c.
References blender::compositor::area(), area_poly_v2(), BLI_array_alloca, copy_v2_v2(), float(), MPoly::loopstart, and MPoly::totloop.
| void BKE_mesh_calc_relative_deform | ( | const MPoly * | mpoly, |
| const int | totpoly, | ||
| const MLoop * | mloop, | ||
| const int | totvert, | ||
| const float(*) | vert_cos_src[3], | ||
| const float(*) | vert_cos_dst[3], | ||
| const float(*) | vert_cos_org[3], | ||
| float(*) | vert_cos_new[3] | ||
| ) |
This function takes the difference between 2 vertex-coord-arrays (vert_cos_src, vert_cos_dst), and applies the difference to vert_cos_new relative to vert_cos_org.
| vert_cos_src | reference deform source. |
| vert_cos_dst | reference deform destination. |
| vert_cos_org | reference for the output location. |
| vert_cos_new | resulting coords. |
Definition at line 4007 of file mesh_evaluate.c.
References add_v3_v3(), copy_v3_v3(), MPoly::loopstart, MEM_calloc_arrayN, MEM_freeN, mul_v3_fl(), MPoly::totloop, transform_point_by_tri_v3(), and MLoop::v.
| void BKE_mesh_calc_volume | ( | const MVert * | mverts, |
| const int | mverts_num, | ||
| const MLoopTri * | looptri, | ||
| const int | looptri_num, | ||
| const MLoop * | mloop, | ||
| float * | r_volume, | ||
| float | r_center[3] | ||
| ) |
Calculate the volume and center.
| r_volume | Volume (unsigned). |
| r_center | Center of mass. |
Definition at line 2720 of file mesh_evaluate.c.
References center, BMVert::co, MVert::co, fabsf, madd_v3_v3fl(), mesh_calc_center_centroid_ex(), mul_v3_fl(), MLoopTri::tri, MLoop::v, v1, v2, volume_tetrahedron_signed_v3(), and zero_v3().
Definition at line 2583 of file mesh_evaluate.c.
References BKE_mesh_minmax(), INIT_MINMAX, max, mid_v3_v3v3(), and min.
Definition at line 2542 of file mesh_evaluate.c.
References add_v3_v3(), MVert::co, mul_v3_fl(), Mesh::mvert, Mesh::totvert, and zero_v3().
Referenced by BKE_mesh_center_of_surface().
Calculate the center from polygons, use when we want to ignore vertex locations that don't have connected faces.
Definition at line 2561 of file mesh_evaluate.c.
References add_v3_v3(), MPoly::loopstart, Mesh::mloop, Mesh::mpoly, mul_v3_fl(), Mesh::mvert, MPoly::totloop, Mesh::totpoly, v, and zero_v3().
Referenced by BKE_mesh_center_of_volume().
Definition at line 2595 of file mesh_evaluate.c.
References BKE_mesh_center_median(), is_finite_v3(), MPoly::loopstart, madd_v3_v3fl(), mesh_calc_poly_area_centroid(), Mesh::mloop, Mesh::mpoly, mul_v3_fl(), Mesh::mvert, Mesh::totpoly, UNLIKELY, and zero_v3().
Definition at line 2630 of file mesh_evaluate.c.
References add_v3_v3(), BKE_mesh_center_median_from_polys(), copy_v3_v3(), is_finite_v3(), MPoly::loopstart, mesh_calc_poly_volume_centroid_with_reference_center(), Mesh::mloop, Mesh::mpoly, mul_v3_fl(), Mesh::mvert, Mesh::totpoly, UNLIKELY, and zero_v3().
| void BKE_mesh_convert_mfaces_to_mpolys | ( | Mesh * | mesh | ) |
Definition at line 3523 of file mesh_evaluate.c.
References BKE_mesh_convert_mfaces_to_mpolys_ex(), BKE_mesh_update_customdata_pointers(), Mesh::fdata, Mesh::id, Mesh::ldata, Mesh::medge, mesh, Mesh::mface, Mesh::mloop, Mesh::mpoly, Mesh::totedge, Mesh::totface, Mesh::totloop, and Mesh::totpoly.
Referenced by cutEdges(), and explodeMesh().
| void BKE_mesh_convert_mfaces_to_mpolys_ex | ( | ID * | id, |
| CustomData * | fdata, | ||
| CustomData * | ldata, | ||
| CustomData * | pdata, | ||
| int | totedge_i, | ||
| int | totface_i, | ||
| int | totloop_i, | ||
| int | totpoly_i, | ||
| MEdge * | medge, | ||
| MFace * | mface, | ||
| int * | r_totloop, | ||
| int * | r_totpoly, | ||
| MLoop ** | r_mloop, | ||
| MPoly ** | r_mpoly | ||
| ) |
Definition at line 3577 of file mesh_evaluate.c.
References BLI_edgehash_free(), BLI_edgehash_insert(), BLI_edgehash_new_ex(), bm_corners_to_loops_ex(), CD_ASSIGN, CD_MASK_MDISPS, CD_MCOL, CD_MLOOP, CD_MPOLY, CD_MTFACE, CD_ORIGINDEX, CustomData_add_layer(), CustomData_external_read(), CustomData_free(), CustomData_get_layer(), CustomData_number_of_layers(), CustomData_to_bmeshpoly(), MEdge::flag, MPoly::flag, MFace::flag, MPoly::loopstart, MPoly::mat_nr, MFace::mat_nr, ME_FGON, MEM_calloc_arrayN, ML, NULL, POINTER_FROM_UINT, MPoly::totloop, v1, MEdge::v1, v2, MEdge::v2, and MFace::v4.
Referenced by BKE_mesh_convert_mfaces_to_mpolys(), and BKE_mesh_do_versions_convert_mfaces_to_mpolys().
| void BKE_mesh_do_versions_convert_mfaces_to_mpolys | ( | Mesh * | mesh | ) |
The same as BKE_mesh_convert_mfaces_to_mpolys but oriented to be used in do_versions from readfile.c the difference is how active/render/clone/stencil indices are handled here
normally thay're being set from pdata which totally makes sense for meshes which are already converted to bmesh structures, but when loading older files indices shall be updated in other way around, so newly added pdata and ldata would have this indices set based on fdata layer
this is normally only needed when reading older files, in all other cases BKE_mesh_convert_mfaces_to_mpolys shall be always used
Definition at line 3555 of file mesh_evaluate.c.
References BKE_mesh_convert_mfaces_to_mpolys_ex(), BKE_mesh_update_customdata_pointers(), CustomData_bmesh_do_versions_update_active_layers(), Mesh::fdata, Mesh::id, Mesh::ldata, Mesh::medge, mesh, Mesh::mface, Mesh::mloop, Mesh::mpoly, Mesh::totedge, Mesh::totface, Mesh::totloop, and Mesh::totpoly.
Referenced by do_versions_after_linking_280().
| void BKE_mesh_ensure_normals | ( | Mesh * | mesh | ) |
Definition at line 382 of file mesh_evaluate.c.
References BKE_mesh_calc_normals(), BLI_assert, Mesh_Runtime::cd_dirty_vert, CD_MASK_NORMAL, mesh, and Mesh::runtime.
Referenced by BKE_mesh_nomain_to_mesh(), curve_calc_modifiers_post(), and MOD_deform_mesh_eval_get().
| void BKE_mesh_ensure_normals_for_display | ( | Mesh * | mesh | ) |
Called after calculating all modifiers.
Definition at line 393 of file mesh_evaluate.c.
References BKE_editmesh_cache_ensure_poly_normals(), BKE_editmesh_cache_ensure_vert_normals(), BKE_mesh_calc_normals_poly(), CD_ASSIGN, Mesh_Runtime::cd_dirty_poly, Mesh_Runtime::cd_dirty_vert, CD_MASK_NORMAL, CD_NORMAL, CustomData_add_layer(), CustomData_get_layer(), Mesh_Runtime::edit_data, Mesh::edit_mesh, float(), ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, MEM_malloc_arrayN, mesh, Mesh::mloop, Mesh::mpoly, Mesh::mvert, NULL, Mesh::runtime, Mesh::totloop, Mesh::totpoly, Mesh::totvert, EditMeshData::vertexCos, and Mesh_Runtime::wrapper_type.
Referenced by editbmesh_calc_modifier_final_normals(), mesh_calc_modifier_final_normals(), and mesh_calc_tri_tessface().
| void BKE_mesh_flush_hidden_from_polys | ( | Mesh * | me | ) |
Definition at line 3885 of file mesh_evaluate.c.
References BKE_mesh_flush_hidden_from_polys_ex(), Mesh::medge, Mesh::mloop, Mesh::mpoly, Mesh::mvert, Mesh::totedge, and Mesh::totpoly.
Referenced by BKE_sculpt_sync_face_sets_visibility_to_base_mesh(), paintface_hide(), and paintface_reveal().
| void BKE_mesh_flush_hidden_from_polys_ex | ( | MVert * | mvert, |
| const MLoop * | mloop, | ||
| MEdge * | medge, | ||
| const int | UNUSEDtotedge, | ||
| const MPoly * | mpoly, | ||
| const int | totpoly | ||
| ) |
Definition at line 3854 of file mesh_evaluate.c.
References MLoop::e, MVert::flag, MEdge::flag, ME_HIDE, and MLoop::v.
Referenced by BKE_mesh_flush_hidden_from_polys().
| void BKE_mesh_flush_hidden_from_verts | ( | Mesh * | me | ) |
Definition at line 3848 of file mesh_evaluate.c.
References BKE_mesh_flush_hidden_from_verts_ex(), Mesh::medge, Mesh::mloop, Mesh::mpoly, Mesh::mvert, Mesh::totedge, and Mesh::totpoly.
Referenced by face_set_edit_do_post_visibility_updates(), hide_show_exec(), sculpt_face_set_init_exec(), and sculpt_undo_restore_list().
| void BKE_mesh_flush_hidden_from_verts_ex | ( | const MVert * | mvert, |
| const MLoop * | mloop, | ||
| MEdge * | medge, | ||
| const int | totedge, | ||
| MPoly * | mpoly, | ||
| const int | totpoly | ||
| ) |
Definition at line 3820 of file mesh_evaluate.c.
References e, MVert::flag, MPoly::flag, MPoly::loopstart, ME_HIDE, MPoly::totloop, and MLoop::v.
Referenced by BKE_mesh_flush_hidden_from_verts().
| void BKE_mesh_flush_select_from_polys | ( | Mesh * | me | ) |
Definition at line 3931 of file mesh_evaluate.c.
References BKE_mesh_flush_select_from_polys_ex(), Mesh::medge, Mesh::mloop, Mesh::mpoly, Mesh::mvert, Mesh::totedge, Mesh::totpoly, and Mesh::totvert.
Referenced by ed_vwpaintmode_exit_generic(), paint_weight_gradient_exec(), and paintface_flush_flags().
| void BKE_mesh_flush_select_from_polys_ex | ( | MVert * | mvert, |
| const int | totvert, | ||
| const MLoop * | mloop, | ||
| MEdge * | medge, | ||
| const int | totedge, | ||
| const MPoly * | mpoly, | ||
| const int | totpoly | ||
| ) |
simple poly -> vert/edge selection.
Definition at line 3894 of file mesh_evaluate.c.
References MLoop::e, MVert::flag, MEdge::flag, MPoly::flag, MPoly::loopstart, ME_FACE_SEL, SELECT, MPoly::totloop, and MLoop::v.
Referenced by BKE_mesh_flush_select_from_polys().
| void BKE_mesh_flush_select_from_verts | ( | Mesh * | me | ) |
Definition at line 3985 of file mesh_evaluate.c.
References BKE_mesh_flush_select_from_verts_ex(), Mesh::medge, Mesh::mloop, Mesh::mpoly, Mesh::mvert, Mesh::totedge, Mesh::totpoly, and Mesh::totvert.
Referenced by ed_vwpaintmode_exit_generic(), and paintvert_flush_flags().
| void BKE_mesh_flush_select_from_verts_ex | ( | const MVert * | mvert, |
| const int | UNUSEDtotvert, | ||
| const MLoop * | mloop, | ||
| MEdge * | medge, | ||
| const int | totedge, | ||
| MPoly * | mpoly, | ||
| const int | totpoly | ||
| ) |
Definition at line 3937 of file mesh_evaluate.c.
References MVert::flag, MEdge::flag, MPoly::flag, MPoly::loopstart, ME_FACE_SEL, ME_HIDE, SELECT, MPoly::totloop, MLoop::v, MEdge::v1, and MEdge::v2.
Referenced by BKE_mesh_flush_select_from_verts().
| void BKE_mesh_loop_manifold_fan_around_vert_next | ( | const MLoop * | mloops, |
| const MPoly * | mpolys, | ||
| const int * | loop_to_poly, | ||
| const int * | e2lfan_curr, | ||
| const uint | mv_pivot_index, | ||
| const MLoop ** | r_mlfan_curr, | ||
| int * | r_mlfan_curr_index, | ||
| int * | r_mlfan_vert_index, | ||
| int * | r_mpfan_curr_index | ||
| ) |
Definition at line 976 of file mesh_evaluate.c.
References BLI_assert, MPoly::loopstart, MPoly::totloop, and MLoop::v.
Referenced by loop_split_generator_check_cyclic_smooth_fan(), and split_loop_nor_fan_do().
| void BKE_mesh_loops_to_mface_corners | ( | CustomData * | fdata, |
| CustomData * | ldata, | ||
| CustomData * | UNUSEDpdata, | ||
| unsigned int | lindex[4], | ||
| int | findex, | ||
| const int | UNUSEDpolyindex, | ||
| const int | mf_len, | ||
| const int | numUV, | ||
| const int | numCol, | ||
| const bool | hasPCol, | ||
| const bool | hasOrigSpace, | ||
| const bool | hasLNor | ||
| ) |
Convert a triangle or quadrangle of loop/poly data to tessface data
Definition at line 2794 of file mesh_evaluate.c.
References CD_MCOL, CD_MLOOPCOL, CD_MLOOPUV, CD_MTFACE, CD_NORMAL, CD_ORIGSPACE, CD_ORIGSPACE_MLOOP, CD_PREVIEW_MCOL, CD_PREVIEW_MLOOPCOL, CD_TESSLOOPNORMAL, copy_v2_v2(), CustomData_get(), CustomData_get_n(), MESH_MLOOPCOL_TO_MCOL, normal_float_to_short_v3(), MLoopUV::uv, OrigSpaceLoop::uv, OrigSpaceFace::uv, and MTFace::uv.
| void BKE_mesh_loops_to_tessdata | ( | CustomData * | fdata, |
| CustomData * | ldata, | ||
| MFace * | mface, | ||
| const int * | polyindices, | ||
| unsigned int(*) | loopindices[4], | ||
| const int | num_faces | ||
| ) |
Convert all CD layers from loop/poly to tessface data.
| loopindices | is an array of an int[4] per tessface, mapping tessface's verts to loops indices. |
Definition at line 2872 of file mesh_evaluate.c.
References CD_MCOL, CD_MLOOPCOL, CD_MLOOPUV, CD_MTFACE, CD_NORMAL, CD_ORIGSPACE, CD_ORIGSPACE_MLOOP, CD_PREVIEW_MCOL, CD_PREVIEW_MLOOPCOL, CD_TANGENT, CD_TESSLOOPNORMAL, copy_v2_v2(), copy_v4_v4(), CustomData_get_layer(), CustomData_get_layer_n(), CustomData_has_layer(), CustomData_number_of_layers(), float(), MESH_MLOOPCOL_TO_MCOL, normal_float_to_short_v3(), MLoopUV::uv, OrigSpaceLoop::uv, OrigSpaceFace::uv, MTFace::uv, and MFace::v4.
Referenced by BKE_mesh_tessface_calc_ex().
| void BKE_mesh_mdisp_flip | ( | MDisps * | md, |
| const bool | use_loop_mdisp_flip | ||
| ) |
Flip a single MLoop's MDisps structure, low level function to be called from face-flipping code which re-arranged the mdisps themselves.
Definition at line 3705 of file mesh_evaluate.c.
References MDisps::disps, float(), sqrt(), SWAP, swap_v3_v3(), MDisps::totdisp, UNLIKELY, x, and y.
Referenced by BKE_mesh_polygon_flip_ex(), and bmesh_kernel_loop_reverse().
| void BKE_mesh_normals_loop_custom_from_vertices_set | ( | const MVert * | mverts, |
| float(*) | r_custom_vertnors[3], | ||
| const int | numVerts, | ||
| MEdge * | medges, | ||
| const int | numEdges, | ||
| MLoop * | mloops, | ||
| const int | numLoops, | ||
| MPoly * | mpolys, | ||
| const float(*) | polynors[3], | ||
| const int | numPolys, | ||
| short(*) | r_clnors_data[2] | ||
| ) |
Definition at line 2020 of file mesh_evaluate.c.
References mesh_normals_loop_custom_set().
| void BKE_mesh_normals_loop_custom_set | ( | const MVert * | mverts, |
| const int | numVerts, | ||
| MEdge * | medges, | ||
| const int | numEdges, | ||
| MLoop * | mloops, | ||
| float(*) | r_custom_loopnors[3], | ||
| const int | numLoops, | ||
| MPoly * | mpolys, | ||
| const float(*) | polynors[3], | ||
| const int | numPolys, | ||
| short(*) | r_clnors_data[2] | ||
| ) |
Definition at line 1994 of file mesh_evaluate.c.
References mesh_normals_loop_custom_set().
| void BKE_mesh_normals_loop_split | ( | const MVert * | mverts, |
| const int | UNUSEDnumVerts, | ||
| MEdge * | medges, | ||
| const int | numEdges, | ||
| MLoop * | mloops, | ||
| float(*) | r_loopnors[3], | ||
| const int | numLoops, | ||
| MPoly * | mpolys, | ||
| const float(*) | polynors[3], | ||
| const int | numPolys, | ||
| const bool | use_split_normals, | ||
| const float | split_angle, | ||
| MLoopNorSpaceArray * | r_lnors_spacearr, | ||
| short(*) | clnors_data[2], | ||
| int * | r_loop_to_poly | ||
| ) |
Compute split normals, i.e. vertex normals associated with each poly (hence 'loop normals'). Useful to materialize sharp edges (or non-smooth faces) without actually modifying the geometry (splitting edges).
Mapping edge -> loops. If that edge is used by more than two loops (polys), it is always sharp (and tagged as such, see below). We also use the second loop index as a kind of flag:
Note that currently we only have two values for second loop of sharp edges. However, if needed, we can store the negated value of loop index instead of INDEX_INVALID to retrieve the real value later in code). Note also that loose edges always have both values set to 0!
Definition at line 1604 of file mesh_evaluate.c.
References BKE_lnor_spacearr_free(), BKE_lnor_spacearr_init(), BLI_assert, BLI_task_pool_create(), BLI_task_pool_free(), BLI_task_pool_work_and_wait(), copy_v3_v3(), MPoly::flag, float(), LoopSplitTaskDataCommon::lnors_spacearr, loop_split_generator(), LOOP_SPLIT_TASK_BLOCK_SIZE, MPoly::loopstart, M_PI, ME_SMOOTH, MEM_calloc_arrayN, MEM_freeN, MEM_malloc_arrayN, mesh_edges_sharp_tag(), MLNOR_SPACEARR_LOOP_INDEX, normal_short_to_float_v3(), NULL, task_pool, TASK_PRIORITY_HIGH, TIMEIT_END_AVERAGED, TIMEIT_START_AVERAGED, MPoly::totloop, and v.
Referenced by mesh_normals_loop_custom_set().
| void BKE_mesh_normals_loop_to_vertex | ( | const int | numVerts, |
| const MLoop * | mloops, | ||
| const int | numLoops, | ||
| const float(*) | clnors[3], | ||
| float(*) | r_vert_clnors[3] | ||
| ) |
Computes average per-vertex normals from given custom loop normals.
| clnors | The computed custom loop normals. |
| r_vert_clnors | The (already allocated) array where to store averaged per-vertex normals. |
Definition at line 2123 of file mesh_evaluate.c.
References add_v3_v3(), copy_vn_fl(), MEM_calloc_arrayN, MEM_freeN, mul_v3_fl(), v, and MLoop::v.
| void BKE_mesh_poly_edgebitmap_insert | ( | unsigned int * | edge_bitmap, |
| const MPoly * | mp, | ||
| const MLoop * | mloop | ||
| ) |
Definition at line 2521 of file mesh_evaluate.c.
References BLI_BITMAP_ENABLE, MLoop::e, and MPoly::totloop.
Definition at line 2505 of file mesh_evaluate.c.
References BLI_edgehash_reinsert(), NULL, MPoly::totloop, and MLoop::v.
| void BKE_mesh_polygon_flip | ( | MPoly * | mpoly, |
| MLoop * | mloop, | ||
| CustomData * | ldata | ||
| ) |
Definition at line 3792 of file mesh_evaluate.c.
References BKE_mesh_polygon_flip_ex(), CD_MDISPS, CustomData_get_layer(), and NULL.
| void BKE_mesh_polygon_flip_ex | ( | MPoly * | mpoly, |
| MLoop * | mloop, | ||
| CustomData * | ldata, | ||
| float(*) | lnors[3], | ||
| MDisps * | mdisp, | ||
| const bool | use_loop_mdisp_flip | ||
| ) |
Flip (invert winding of) the given mpoly, i.e. reverse order of its loops (keeping the same vertex as 'start point').
| mpoly | the polygon to flip. |
| mloop | the full loops array. |
| ldata | the loops custom data. |
Definition at line 3749 of file mesh_evaluate.c.
References BKE_mesh_mdisp_flip(), CD_MLOOP, CustomData_get_layer(), CustomData_swap(), e, MLoop::e, MPoly::loopstart, SWAP, swap_v3_v3(), and MPoly::totloop.
Referenced by BKE_mesh_polygon_flip(), BKE_mesh_polygons_flip(), and polygons_check_flip().
| void BKE_mesh_polygons_flip | ( | MPoly * | mpoly, |
| MLoop * | mloop, | ||
| CustomData * | ldata, | ||
| int | totpoly | ||
| ) |
Flip (invert winding of) all polygons (used to inverse their normals).
Definition at line 3803 of file mesh_evaluate.c.
References BKE_mesh_polygon_flip_ex(), CD_MDISPS, CustomData_get_layer(), and NULL.
| void BKE_mesh_recalc_looptri | ( | const MLoop * | mloop, |
| const MPoly * | mpoly, | ||
| const MVert * | mvert, | ||
| int | totloop, | ||
| int | totpoly, | ||
| MLoopTri * | mlooptri | ||
| ) |
Calculate tessellation into MLoopTri which exist only for this purpose.
Definition at line 3284 of file mesh_evaluate.c.
References add_newell_cross_v3_v3v3(), ARRAY_SET_ITEMS, axis_dominant_v3_to_m3_negate(), BLI_assert, BLI_memarena_alloc(), BLI_memarena_clear(), BLI_memarena_free(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, BLI_polyfill_calc_arena(), MVert::co, float(), is_quad_flip_v3_first_third_fast(), MPoly::loopstart, ML_TO_MLT, mul_v2_m3v3(), normal, normalize_v3(), NULL, MLoopTri::poly, poly_to_tri_count(), MPoly::totloop, MLoopTri::tri, UNLIKELY, UNUSED_VARS_NDEBUG, MLoop::v, and zero_v3().
Higher level functions hiding most of the code needed around call to BKE_mesh_normals_loop_custom_set().
| r_custom_loopnors | is not const, since code will replace zero_v3 normals there with automatically computed vectors. |
Definition at line 2100 of file mesh_evaluate.c.
References mesh, and mesh_set_custom_normals().
Referenced by modifyMesh(), blender::io::alembic::process_loop_normals(), and triangulate_mesh().
Higher level functions hiding most of the code needed around call to BKE_mesh_normals_loop_custom_from_vertices_set().
| r_custom_vertnors | is not const, since code will replace zero_v3 normals there with automatically computed vectors. |
Definition at line 2112 of file mesh_evaluate.c.
References mesh, and mesh_set_custom_normals().
Referenced by blender::io::alembic::process_vertex_normals().
| void BKE_mesh_tangent_loops_to_tessdata | ( | CustomData * | fdata, |
| CustomData * | ldata, | ||
| MFace * | mface, | ||
| const int * | polyindices, | ||
| unsigned int(*) | loopindices[4], | ||
| const int | num_faces, | ||
| const char * | layer_name | ||
| ) |
Definition at line 2965 of file mesh_evaluate.c.
References CD_TANGENT, copy_v4_v4(), CustomData_get_layer(), CustomData_get_layer_named(), float(), NULL, and MFace::v4.
| int BKE_mesh_tessface_calc_ex | ( | CustomData * | fdata, |
| CustomData * | ldata, | ||
| CustomData * | pdata, | ||
| MVert * | mvert, | ||
| int | totface, | ||
| int | totloop, | ||
| int | totpoly, | ||
| const bool | do_face_nor_copy | ||
| ) |
Recreate tessellation.
| do_face_nor_copy | Controls whether the normals from the poly are copied to the tessellated faces. |
Definition at line 3021 of file mesh_evaluate.c.
References add_newell_cross_v3_v3v3(), axis_dominant_v3_to_m3_negate(), BKE_mesh_loops_to_tessdata(), BLI_assert, BLI_memarena_alloc(), BLI_memarena_clear(), BLI_memarena_free(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, BLI_polyfill_calc_arena(), CD_ASSIGN, CD_CALLOC, CD_MFACE, CD_MLOOP, CD_MPOLY, CD_NORMAL, CD_ORIGINDEX, MVert::co, copy_v3_v3(), CustomData_add_layer(), CustomData_free(), CustomData_from_bmeshpoly(), CustomData_get_layer(), CustomData_has_layer(), MFace::edcode, MPoly::flag, MFace::flag, float(), LIKELY, MPoly::loopstart, MPoly::mat_nr, MFace::mat_nr, MEM_freeN, MEM_malloc_arrayN, MEM_reallocN, ML_TO_MF, ML_TO_MF_QUAD, mul_v2_m3v3(), normal, normalize_v3(), NULL, poly_to_tri_count(), TESSFACE_IS_QUAD, test_index_face(), MPoly::totloop, UNLIKELY, MLoop::v, MFace::v1, MFace::v2, MFace::v3, MFace::v4, and zero_v3().
Referenced by BKE_mesh_tessface_calc().
|
static |
Definition at line 3423 of file mesh_evaluate.c.
References BLI_assert, CD_MCOL, CD_MDISPS, CD_MLOOPCOL, CD_MLOOPUV, CD_MTFACE, CD_NORMAL, CD_TESSLOOPNORMAL, copy_v2_v2(), CustomData_external_add(), CustomData_external_test(), CustomData_get(), CustomData_get_n(), CustomData_has_layer(), MDisps::disps, CustomData::external, CustomDataExternal::filename, float(), MDisps::level, logf, M_LN2, max, MEM_freeN, MEM_malloc_arrayN, MESH_MLOOPCOL_FROM_MCOL, multires_mdisp_corners(), normal_short_to_float_v3(), sqrtf, MDisps::totdisp, MLoopUV::uv, MTFace::uv, and MFace::v4.
Referenced by BKE_mesh_convert_mfaces_to_mpolys_ex().
|
static |
Definition at line 1422 of file mesh_evaluate.c.
References BKE_lnor_space_create(), BLI_BITMAP_NEW, BLI_BITMAP_TEST, BLI_BITMAP_TEST_BOOL, BLI_stack_free(), BLI_stack_new, BLI_task_pool_push(), data, MLoop::e, LoopSplitTaskDataCommon::edge_to_loops, float(), IS_EDGE_SHARP, LoopSplitTaskDataCommon::lnors_spacearr, loop_split_generator_check_cyclic_smooth_fan(), LOOP_SPLIT_TASK_BLOCK_SIZE, loop_split_worker(), loop_split_worker_do(), LoopSplitTaskDataCommon::loop_to_poly, LoopSplitTaskDataCommon::loopnors, MPoly::loopstart, MEM_calloc_arrayN, MEM_freeN, LoopSplitTaskDataCommon::mloops, LoopSplitTaskDataCommon::mpolys, NULL, LoopSplitTaskDataCommon::numLoops, LoopSplitTaskDataCommon::numPolys, blender::compositor::pool, TIMEIT_END_AVERAGED, TIMEIT_START_AVERAGED, MPoly::totloop, and MLoop::v.
Referenced by BKE_mesh_normals_loop_split().
|
static |
Check whether given loop is part of an unknown-so-far cyclic smooth fan, or not. Needed because cyclic smooth fans have no obvious 'entry point', and yet we need to walk them once, and only once.
Definition at line 1352 of file mesh_evaluate.c.
References BKE_mesh_loop_manifold_fan_around_vert_next(), BLI_assert, BLI_BITMAP_ENABLE, BLI_BITMAP_TEST, MLoop::e, IS_EDGE_SHARP, and MLoop::v.
Referenced by loop_split_generator().
|
static |
Definition at line 1315 of file mesh_evaluate.c.
References BLI_stack_free(), BLI_stack_new, BLI_task_pool_user_data(), data, LoopSplitTaskDataCommon::lnors_spacearr, LOOP_SPLIT_TASK_BLOCK_SIZE, loop_split_worker_do(), NULL, blender::compositor::pool, TIMEIT_END_AVERAGED, and TIMEIT_START_AVERAGED.
Referenced by loop_split_generator().
|
static |
Definition at line 1299 of file mesh_evaluate.c.
References BLI_assert, BLI_stack_is_empty(), data, NULL, split_loop_nor_fan_do(), and split_loop_nor_single_do().
Referenced by loop_split_generator(), and loop_split_worker().
|
static |
Definition at line 2676 of file mesh_evaluate.c.
References blender::compositor::area(), area_tri_v3(), BMVert::co, MVert::co, madd_v3_v3fl(), mul_v3_fl(), MLoopTri::tri, MLoop::v, v1, v2, and zero_v3().
Referenced by BKE_mesh_calc_volume().
|
static |
Definition at line 2264 of file mesh_evaluate.c.
References float(), madd_v3_v3fl(), MPoly::totloop, v, w(), and zero_v3().
Referenced by BKE_mesh_calc_poly_center().
|
static |
Definition at line 2164 of file mesh_evaluate.c.
References add_newell_cross_v3_v3v3(), MVert::co, normal, normalize_v3(), MPoly::totloop, UNLIKELY, MLoop::v, and zero_v3().
Referenced by BKE_mesh_calc_poly_normal().
|
static |
Definition at line 2213 of file mesh_evaluate.c.
References add_newell_cross_v3_v3v3(), normalize_v3(), MPoly::totloop, UNLIKELY, MLoop::v, and zero_v3().
Referenced by BKE_mesh_calc_poly_normal_coords().
|
static |
Definition at line 218 of file mesh_evaluate.c.
References BKE_mesh_calc_poly_normal(), data, and MPoly::loopstart.
Referenced by BKE_mesh_calc_normals_poly().
|
static |
Definition at line 291 of file mesh_evaluate.c.
References data, normal_float_to_short_v3(), normalize_v3(), normalize_v3_v3(), and UNLIKELY.
Referenced by BKE_mesh_calc_normals_poly().
|
static |
Definition at line 228 of file mesh_evaluate.c.
References add_newell_cross_v3_v3v3(), BLI_array_alloca, MVert::co, data, dot_v3v3(), float(), MPoly::loopstart, mul_v3_v3fl(), normalize_v3(), saacos(), sub_v3_v3v3(), MPoly::totloop, UNLIKELY, MLoop::v, and zero_v3().
Referenced by BKE_mesh_calc_normals_poly().
|
static |
Call when there are no polygons.
Definition at line 76 of file mesh_evaluate.c.
References normal_float_to_short_v3(), and normalize_v3_v3().
Referenced by BKE_mesh_calc_normals_mapping_ex().
|
static |
Definition at line 2449 of file mesh_evaluate.c.
References area_tri_signed_v3(), BKE_mesh_calc_poly_normal(), copy_v3_v3(), madd_v3_v3fl(), mid_v3_v3v3v3(), mul_v3_fl(), normal, MPoly::totloop, v, v1, v2, and zero_v3().
Referenced by BKE_mesh_center_of_surface().
|
static |
Calculate the volume and volume-weighted centroid of the volume formed by the polygon and the origin. Results will be negative if the origin is "outside" the polygon (+ve normal side), but the polygon may be non-planar with no effect.
Method from:
Definition at line 2376 of file mesh_evaluate.c.
References MPoly::totloop, MLoop::v, volume_tri_tetrahedron_signed_v3_6x(), and zero_v3().
|
static |
A version of mesh_calc_poly_volume_centroid that takes an initial reference center, use this to increase numeric stability as the quality of the result becomes very low quality as the value moves away from 0.0, see: T65986.
Definition at line 2418 of file mesh_evaluate.c.
References copy_v3_v3(), sub_v3_v3v3(), MPoly::totloop, v, volume_tri_tetrahedron_signed_v3_6x(), and zero_v3().
Referenced by BKE_mesh_center_of_volume().
|
static |
Definition at line 823 of file mesh_evaluate.c.
References BLI_BITMAP_NEW, BLI_BITMAP_SET, BLI_BITMAP_TEST, cosf, data, dot_v3v3(), MLoop::e, MEdge::flag, MPoly::flag, float(), INDEX_INVALID, INDEX_UNSET, IS_EDGE_SHARP, MPoly::loopstart, ME_SHARP, ME_SMOOTH, MEM_freeN, MVert::no, normal_short_to_float_v3(), NULL, MPoly::totloop, and MLoop::v.
Referenced by BKE_edges_sharp_from_angle_set(), and BKE_mesh_normals_loop_split().
|
static |
Compute internal representation of given custom normals (as an array of float[2]). It also makes sure the mesh matches those custom normals, by setting sharp edges flag as needed to get a same custom lnor for all loops sharing a same smooth fan. If use_vertices if true, r_custom_loopnors is assumed to be per-vertex, not per-loop (this allows to set whole vert's normals at once, useful in some cases). r_custom_loopnors is expected to have normalized normals, or zero ones, in which case they will be replaced by default loop/vertex normal.
Definition at line 1756 of file mesh_evaluate.c.
References add_v3_v3(), BKE_lnor_space_custom_normal_to_data(), BKE_lnor_spacearr_clear(), BKE_lnor_spacearr_free(), BKE_mesh_normals_loop_split(), BLI_assert, BLI_BITMAP_DISABLE, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_bitmap_set_all(), BLI_BITMAP_TEST, BLI_BITMAP_TEST_BOOL, BLI_SMALLSTACK_DECLARE, BLI_SMALLSTACK_POP, BLI_SMALLSTACK_PUSH, copy_v3_v3(), MLoopNorSpaceArray::data_type, dot_v3v3(), MLoop::e, MEdge::flag, MLoopNorSpace::flags, float(), G, G_DEBUG, is_zero_v3(), LinkNode::link, LNOR_SPACE_TRIGO_THRESHOLD, MLoopNorSpace::loops, MPoly::loopstart, MLoopNorSpaceArray::lspacearr, M_PI, ME_SHARP, MEM_calloc_arrayN, MEM_freeN, MEM_malloc_arrayN, MLNOR_SPACE_IS_SINGLE, MLNOR_SPACEARR_LOOP_INDEX, mul_v3_fl(), LinkNode::next, nor, normal_short_to_float_v3(), NULL, POINTER_AS_INT, MPoly::totloop, v, and zero_v3().
Referenced by BKE_mesh_normals_loop_custom_from_vertices_set(), BKE_mesh_normals_loop_custom_set(), and mesh_set_custom_normals().
|
static |
Definition at line 2046 of file mesh_evaluate.c.
References BKE_mesh_calc_normals_poly(), CD_CALLOC, CD_CUSTOMLOOPNORMAL, CD_NORMAL, CustomData_add_layer(), CustomData_get_layer(), float(), Mesh::ldata, Mesh::medge, MEM_freeN, MEM_mallocN, mesh, mesh_normals_loop_custom_set(), Mesh::mloop, Mesh::mpoly, Mesh::mvert, NULL, Mesh::totedge, Mesh::totloop, Mesh::totpoly, and Mesh::totvert.
Referenced by BKE_mesh_set_custom_normals(), and BKE_mesh_set_custom_normals_from_vertices().
|
static |
Definition at line 1086 of file mesh_evaluate.c.
References BKE_lnor_space_add_loop(), BKE_lnor_space_custom_data_to_normal(), BKE_lnor_space_define(), BKE_mesh_loop_manifold_fan_around_vert_next(), BLI_assert, BLI_SMALLSTACK_DECLARE, BLI_SMALLSTACK_POP, BLI_SMALLSTACK_PUSH, BLI_stack_push(), LoopSplitTaskDataCommon::clnors_data, MVert::co, copy_v3_v3(), data, dot_v3v3(), MLoop::e, LoopSplitTaskDataCommon::edge_to_loops, float(), G, G_DEBUG, IS_EDGE_SHARP, LIKELY, LoopSplitTaskDataCommon::lnors_spacearr, LoopSplitTaskDataCommon::loop_to_poly, LoopSplitTaskDataCommon::loopnors, madd_v3_v3fl(), LoopSplitTaskDataCommon::medges, LoopSplitTaskDataCommon::mloops, LoopSplitTaskDataCommon::mpolys, LoopSplitTaskDataCommon::mverts, nor, normal, normalize_v3(), NULL, LoopSplitTaskDataCommon::polynors, saacos(), sub_v3_v3v3(), UNLIKELY, MLoop::v, MEdge::v1, and MEdge::v2.
Referenced by loop_split_worker_do().
|
static |
Definition at line 1024 of file mesh_evaluate.c.
References BKE_lnor_space_add_loop(), BKE_lnor_space_custom_data_to_normal(), BKE_lnor_space_define(), LoopSplitTaskDataCommon::clnors_data, MVert::co, copy_v3_v3(), data, MLoop::e, float(), LoopSplitTaskDataCommon::lnors_spacearr, LoopSplitTaskDataCommon::medges, LoopSplitTaskDataCommon::mverts, normalize_v3(), NULL, LoopSplitTaskDataCommon::polynors, sub_v3_v3v3(), MLoop::v, MEdge::v1, and MEdge::v2.
Referenced by loop_split_worker_do().
Definition at line 681 of file mesh_evaluate.c.
References floorf.
Referenced by BKE_lnor_space_custom_normal_to_data().
Definition at line 676 of file mesh_evaluate.c.
References float().
Referenced by BKE_lnor_space_custom_data_to_normal().
|
static |
Definition at line 67 of file mesh_evaluate.c.
Referenced by BKE_mesh_calc_normals_mapping_ex().