Blender  V3.3
BKE_mesh.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 #pragma once
4 
9 #include "BKE_mesh_types.h"
10 #include "BLI_compiler_attrs.h"
11 #include "BLI_utildefines.h"
12 
13 struct BLI_Stack;
14 struct BMesh;
15 struct BMeshCreateParams;
16 struct BMeshFromMeshParams;
17 struct BMeshToMeshParams;
18 struct BoundBox;
19 struct CustomData;
21 struct Depsgraph;
22 struct EdgeHash;
23 struct ID;
24 struct KeyBlock;
25 struct LinkNode;
26 struct ListBase;
27 struct MDeformVert;
28 struct MDisps;
29 struct MEdge;
30 struct MFace;
31 struct MLoop;
32 struct MLoopTri;
33 struct MLoopUV;
34 struct MPoly;
35 struct MVert;
36 struct Main;
37 struct MemArena;
38 struct Mesh;
39 struct ModifierData;
40 struct Object;
41 struct PointCloud;
42 struct Scene;
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /* setting zero so we can catch bugs in OpenMP/BMesh */
49 #ifdef DEBUG
50 # define BKE_MESH_OMP_LIMIT 0
51 #else
52 # define BKE_MESH_OMP_LIMIT 10000
53 #endif
54 
55 /* mesh_runtime.cc */
56 
61 
66 
67 /* *** mesh.c *** */
68 
69 struct BMesh *BKE_mesh_to_bmesh_ex(const struct Mesh *me,
70  const struct BMeshCreateParams *create_params,
71  const struct BMeshFromMeshParams *convert_params);
72 struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me,
73  struct Object *ob,
74  bool add_key_index,
75  const struct BMeshCreateParams *params);
76 
78  const struct BMeshToMeshParams *params,
79  const struct Mesh *me_settings);
81  const struct CustomData_MeshMasks *cd_mask_extra,
82  const struct Mesh *me_settings);
83 
92 
98 
103 int poly_find_loop_from_vert(const struct MPoly *poly, const struct MLoop *loopstart, uint vert);
109 int poly_get_adj_loops_from_vert(const struct MPoly *poly,
110  const struct MLoop *mloop,
111  unsigned int vert,
112  unsigned int r_adj[2]);
113 
118 int BKE_mesh_edge_other_vert(const struct MEdge *e, int v);
123  const struct MLoopTri *looptri,
124  int r_edges[3]);
125 
130 void BKE_mesh_free_data_for_undo(struct Mesh *me);
131 void BKE_mesh_clear_geometry(struct Mesh *me);
132 struct Mesh *BKE_mesh_add(struct Main *bmain, const char *name);
133 
134 void BKE_mesh_free_editmesh(struct Mesh *mesh);
135 
142 void BKE_mesh_copy_parameters_for_eval(struct Mesh *me_dst, const struct Mesh *me_src);
147 void BKE_mesh_copy_parameters(struct Mesh *me_dst, const struct Mesh *me_src);
148 void BKE_mesh_update_customdata_pointers(struct Mesh *me, bool do_ensure_tess_cd);
149 void BKE_mesh_ensure_skin_customdata(struct Mesh *me);
150 
151 struct Mesh *BKE_mesh_new_nomain(
152  int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len);
153 struct Mesh *BKE_mesh_new_nomain_from_template(const struct Mesh *me_src,
154  int verts_len,
155  int edges_len,
156  int tessface_len,
157  int loops_len,
158  int polys_len);
159 struct Mesh *BKE_mesh_new_nomain_from_template_ex(const struct Mesh *me_src,
160  int verts_len,
161  int edges_len,
162  int tessface_len,
163  int loops_len,
164  int polys_len,
165  struct CustomData_MeshMasks mask);
166 
167 void BKE_mesh_eval_delete(struct Mesh *mesh_eval);
168 
173 struct Mesh *BKE_mesh_copy_for_eval(const struct Mesh *source, bool reference);
174 
179 struct Mesh *BKE_mesh_new_nomain_from_curve(const struct Object *ob);
181  const struct ListBase *dispbase);
182 
184 bool BKE_mesh_clear_facemap_customdata(struct Mesh *me);
185 
186 float (*BKE_mesh_orco_verts_get(struct Object *ob))[3];
187 void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert);
188 
192 void BKE_mesh_orco_ensure(struct Object *ob, struct Mesh *mesh);
193 
194 struct Mesh *BKE_mesh_from_object(struct Object *ob);
195 void BKE_mesh_assign_object(struct Main *bmain, struct Object *ob, struct Mesh *me);
196 void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me);
197 void BKE_mesh_to_curve_nurblist(const struct Mesh *me,
198  struct ListBase *nurblist,
199  int edge_users_test);
200 void BKE_mesh_to_curve(struct Main *bmain,
201  struct Depsgraph *depsgraph,
202  struct Scene *scene,
203  struct Object *ob);
204 void BKE_pointcloud_from_mesh(struct Mesh *me, struct PointCloud *pointcloud);
205 void BKE_mesh_to_pointcloud(struct Main *bmain,
206  struct Depsgraph *depsgraph,
207  struct Scene *scene,
208  struct Object *ob);
209 void BKE_mesh_from_pointcloud(const struct PointCloud *pointcloud, struct Mesh *me);
210 void BKE_pointcloud_to_mesh(struct Main *bmain,
211  struct Depsgraph *depsgraph,
212  struct Scene *scene,
213  struct Object *ob);
214 void BKE_mesh_material_index_remove(struct Mesh *me, short index);
215 bool BKE_mesh_material_index_used(struct Mesh *me, short index);
216 void BKE_mesh_material_index_clear(struct Mesh *me);
217 void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, unsigned int remap_len);
218 void BKE_mesh_smooth_flag_set(struct Mesh *me, bool use_smooth);
219 void BKE_mesh_auto_smooth_flag_set(struct Mesh *me, bool use_auto_smooth, float auto_smooth_angle);
220 
224 void BKE_mesh_edges_set_draw_render(struct Mesh *me);
225 
232 const char *BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh);
233 
234 struct BoundBox *BKE_mesh_boundbox_get(struct Object *ob);
235 
236 void BKE_mesh_texspace_calc(struct Mesh *me);
237 void BKE_mesh_texspace_ensure(struct Mesh *me);
238 void BKE_mesh_texspace_get(struct Mesh *me, float r_loc[3], float r_size[3]);
239 void BKE_mesh_texspace_get_reference(struct Mesh *me,
240  char **r_texflag,
241  float **r_loc,
242  float **r_size);
243 void BKE_mesh_texspace_copy_from_object(struct Mesh *me, struct Object *ob);
244 
251 void BKE_mesh_split_faces(struct Mesh *mesh, bool free_loop_normals);
252 
264  struct Object *object,
265  bool preserve_all_data_layers,
266  bool preserve_origindex);
267 
273 struct Mesh *BKE_mesh_new_from_object_to_bmain(struct Main *bmain,
274  struct Depsgraph *depsgraph,
275  struct Object *object,
276  bool preserve_all_data_layers);
277 
284  struct Scene *scene,
285  struct Object *ob_eval,
286  struct ModifierData *md_eval,
287  bool use_virtual_modifiers,
288  bool build_shapekey_layers);
289 
293 void BKE_mesh_nomain_to_mesh(struct Mesh *mesh_src,
294  struct Mesh *mesh_dst,
295  struct Object *ob,
296  const struct CustomData_MeshMasks *mask,
297  bool take_ownership);
298 void BKE_mesh_nomain_to_meshkey(struct Mesh *mesh_src, struct Mesh *mesh_dst, struct KeyBlock *kb);
299 
300 /* vertex level transformations & checks (no derived mesh) */
301 
302 /* basic vertex data functions */
303 bool BKE_mesh_minmax(const struct Mesh *me, float r_min[3], float r_max[3]);
304 void BKE_mesh_transform(struct Mesh *me, const float mat[4][4], bool do_keys);
305 void BKE_mesh_translate(struct Mesh *me, const float offset[3], bool do_keys);
306 
307 void BKE_mesh_tessface_clear(struct Mesh *mesh);
308 
310 
311 void BKE_mesh_mselect_clear(struct Mesh *me);
312 void BKE_mesh_mselect_validate(struct Mesh *me);
316 int BKE_mesh_mselect_find(struct Mesh *me, int index, int type);
320 int BKE_mesh_mselect_active_get(struct Mesh *me, int type);
321 void BKE_mesh_mselect_active_set(struct Mesh *me, int index, int type);
322 
323 void BKE_mesh_count_selected_items(const struct Mesh *mesh, int r_count[3]);
324 
325 float (*BKE_mesh_vert_coords_alloc(const struct Mesh *mesh, int *r_vert_len))[3];
326 void BKE_mesh_vert_coords_get(const struct Mesh *mesh, float (*vert_coords)[3]);
327 
329  const float (*vert_coords)[3],
330  const float mat[4][4]);
331 void BKE_mesh_vert_coords_apply(struct Mesh *mesh, const float (*vert_coords)[3]);
332 
333 /* *** mesh_tessellate.cc *** */
334 
339  const struct MPoly *mpoly,
340  const struct MVert *mvert,
341  int totloop,
342  int totpoly,
343  struct MLoopTri *mlooptri);
353  const struct MPoly *mpoly,
354  const struct MVert *mvert,
355  int totloop,
356  int totpoly,
357  struct MLoopTri *mlooptri,
358  const float (*poly_normals)[3]);
359 
360 /* *** mesh_normals.cc *** */
361 
367 const float (*BKE_mesh_vertex_normals_ensure(const struct Mesh *mesh))[3];
368 
374 const float (*BKE_mesh_poly_normals_ensure(const struct Mesh *mesh))[3];
375 
382 void BKE_mesh_normals_tag_dirty(struct Mesh *mesh);
383 
390 
403 
416 
427 
432 
437 
443 
449 
457  int mvert_len,
458  const struct MLoop *mloop,
459  int mloop_len,
460  const struct MPoly *mpoly,
461  int mpoly_len,
462  float (*r_poly_normals)[3]);
463 
471  int mvert_len,
472  const struct MLoop *mloop,
473  int mloop_len,
474  const struct MPoly *mpoly,
475  int mpoly_len,
476  float (*r_poly_normals)[3],
477  float (*r_vert_normals)[3]);
478 
486 void BKE_mesh_calc_normals(struct Mesh *me);
487 
493  int numVerts,
494  const struct MLoop *mloop,
495  const struct MLoopTri *looptri,
496  int looptri_num,
497  float (*r_tri_nors)[3]);
499  const struct MPoly *mpolys,
500  const int *loop_to_poly,
501  const int *e2lfan_curr,
502  uint mv_pivot_index,
503  const struct MLoop **r_mlfan_curr,
504  int *r_mlfan_curr_index,
505  int *r_mlfan_vert_index,
506  int *r_mpfan_curr_index);
507 
514 void BKE_edges_sharp_from_angle_set(const struct MVert *mverts,
515  int numVerts,
516  struct MEdge *medges,
517  int numEdges,
518  struct MLoop *mloops,
519  int numLoops,
520  struct MPoly *mpolys,
521  const float (*polynors)[3],
522  int numPolys,
523  float split_angle);
524 
528 typedef struct MLoopNorSpace {
530  float vec_lnor[3];
532  float vec_ref[3];
534  float vec_ortho[3];
536  float ref_alpha;
538  float ref_beta;
543  struct LinkNode *loops;
544  char flags;
545 
547  void *user_data;
552 enum {
554 };
555 
559 typedef struct MLoopNorSpaceArray {
560  MLoopNorSpace **lspacearr; /* MLoop aligned array */
561  struct LinkNode
562  *loops_pool; /* Allocated once, avoids to call BLI_linklist_prepend_arena() for each loop! */
563  char data_type; /* Whether we store loop indices, or pointers to BMLoop. */
564  int spaces_num; /* Number of clnors spaces defined in this array. */
565  struct MemArena *mem;
570 enum {
573 };
574 
575 /* Low-level custom normals functions. */
576 void BKE_lnor_spacearr_init(MLoopNorSpaceArray *lnors_spacearr, int numLoops, char data_type);
577 void BKE_lnor_spacearr_clear(MLoopNorSpaceArray *lnors_spacearr);
578 void BKE_lnor_spacearr_free(MLoopNorSpaceArray *lnors_spacearr);
579 
588  MLoopNorSpaceArray *lnors_spacearr_tls);
594  MLoopNorSpaceArray *lnors_spacearr_tls);
595 
603 void BKE_lnor_space_define(MLoopNorSpace *lnor_space,
604  const float lnor[3],
605  float vec_ref[3],
606  float vec_other[3],
607  struct BLI_Stack *edge_vectors);
616 void BKE_lnor_space_add_loop(MLoopNorSpaceArray *lnors_spacearr,
617  MLoopNorSpace *lnor_space,
618  int ml_index,
619  void *bm_loop,
620  bool is_single);
622  const short clnor_data[2],
623  float r_custom_lnor[3]);
625  const float custom_lnor[3],
626  short r_clnor_data[2]);
627 
628 /* Medium-level custom normals functions. */
629 
635 void BKE_mesh_normals_loop_split(const struct MVert *mverts,
636  const float (*vert_normals)[3],
637  int numVerts,
638  struct MEdge *medges,
639  int numEdges,
640  struct MLoop *mloops,
641  float (*r_loopnors)[3],
642  int numLoops,
643  struct MPoly *mpolys,
644  const float (*polynors)[3],
645  int numPolys,
646  bool use_split_normals,
647  float split_angle,
648  MLoopNorSpaceArray *r_lnors_spacearr,
649  short (*clnors_data)[2],
650  int *r_loop_to_poly);
651 
652 void BKE_mesh_normals_loop_custom_set(const struct MVert *mverts,
653  const float (*vert_normals)[3],
654  int numVerts,
655  struct MEdge *medges,
656  int numEdges,
657  struct MLoop *mloops,
658  float (*r_custom_loopnors)[3],
659  int numLoops,
660  struct MPoly *mpolys,
661  const float (*polynors)[3],
662  int numPolys,
663  short (*r_clnors_data)[2]);
665  const float (*vert_normals)[3],
666  float (*r_custom_vertnors)[3],
667  int numVerts,
668  struct MEdge *medges,
669  int numEdges,
670  struct MLoop *mloops,
671  int numLoops,
672  struct MPoly *mpolys,
673  const float (*polynors)[3],
674  int numPolys,
675  short (*r_clnors_data)[2]);
676 
684  const struct MLoop *mloops,
685  int numLoops,
686  const float (*clnors)[3],
687  float (*r_vert_clnors)[3]);
688 
692 bool BKE_mesh_has_custom_loop_normals(struct Mesh *me);
693 
703  struct MLoopNorSpaceArray *r_lnors_spacearr,
704  float (*r_corner_normals)[3]);
705 
713 void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loopnors)[3]);
721 void BKE_mesh_set_custom_normals_from_vertices(struct Mesh *mesh, float (*r_custom_vertnors)[3]);
722 
723 /* *** mesh_evaluate.cc *** */
724 
725 void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly,
726  const struct MLoop *loopstart,
727  const struct MVert *mvarray,
728  float r_no[3]);
729 void BKE_mesh_calc_poly_normal_coords(const struct MPoly *mpoly,
730  const struct MLoop *loopstart,
731  const float (*vertex_coords)[3],
732  float r_no[3]);
733 void BKE_mesh_calc_poly_center(const struct MPoly *mpoly,
734  const struct MLoop *loopstart,
735  const struct MVert *mvarray,
736  float r_cent[3]);
737 /* NOTE: passing poly-normal is only a speedup so we can skip calculating it. */
738 float BKE_mesh_calc_poly_area(const struct MPoly *mpoly,
739  const struct MLoop *loopstart,
740  const struct MVert *mvarray);
741 float BKE_mesh_calc_area(const struct Mesh *me);
742 float BKE_mesh_calc_poly_uv_area(const struct MPoly *mpoly, const struct MLoopUV *uv_array);
743 void BKE_mesh_calc_poly_angles(const struct MPoly *mpoly,
744  const struct MLoop *loopstart,
745  const struct MVert *mvarray,
746  float angles[]);
747 
749  const struct MPoly *mp,
750  const struct MLoop *mloop);
751 void BKE_mesh_poly_edgebitmap_insert(unsigned int *edge_bitmap,
752  const struct MPoly *mp,
753  const struct MLoop *mloop);
754 
755 bool BKE_mesh_center_median(const struct Mesh *me, float r_cent[3]);
760 bool BKE_mesh_center_median_from_polys(const struct Mesh *me, float r_cent[3]);
761 bool BKE_mesh_center_bounds(const struct Mesh *me, float r_cent[3]);
762 bool BKE_mesh_center_of_surface(const struct Mesh *me, float r_cent[3]);
767 bool BKE_mesh_center_of_volume(const struct Mesh *me, float r_cent[3]);
768 
775 void BKE_mesh_calc_volume(const struct MVert *mverts,
776  int mverts_num,
777  const struct MLoopTri *mlooptri,
778  int looptri_num,
779  const struct MLoop *mloop,
780  float *r_volume,
781  float r_center[3]);
782 
787 void BKE_mesh_mdisp_flip(struct MDisps *md, bool use_loop_mdisp_flip);
788 
797 void BKE_mesh_polygon_flip_ex(struct MPoly *mpoly,
798  struct MLoop *mloop,
799  struct CustomData *ldata,
800  float (*lnors)[3],
801  struct MDisps *mdisp,
802  bool use_loop_mdisp_flip);
803 void BKE_mesh_polygon_flip(struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata);
809 void BKE_mesh_polygons_flip(struct MPoly *mpoly,
810  struct MLoop *mloop,
811  struct CustomData *ldata,
812  int totpoly);
813 
814 /* Merge verts. */
815 /* Enum for merge_mode of #BKE_mesh_merge_verts.
816  * Refer to mesh_merge.c for details. */
817 enum {
820 };
850 struct Mesh *BKE_mesh_merge_verts(struct Mesh *mesh,
851  const int *vtargetmap,
852  int tot_vtargetmap,
853  int merge_mode);
854 
862 
863 /* Flush flags. */
864 
869  const struct MLoop *mloop,
870  struct MEdge *medge,
871  int totedge,
872  struct MPoly *mpoly,
873  int totpoly);
874 void BKE_mesh_flush_hidden_from_verts(struct Mesh *me);
876  const struct MLoop *mloop,
877  struct MEdge *medge,
878  int totedge,
879  const struct MPoly *mpoly,
880  int totpoly);
881 void BKE_mesh_flush_hidden_from_polys(struct Mesh *me);
886  int totvert,
887  const struct MLoop *mloop,
888  struct MEdge *medge,
889  int totedge,
890  const struct MPoly *mpoly,
891  int totpoly);
892 void BKE_mesh_flush_select_from_polys(struct Mesh *me);
893 void BKE_mesh_flush_select_from_verts(struct Mesh *me);
894 
895 /* spatial evaluation */
908  int totpoly,
909  const struct MLoop *mloop,
910  int totvert,
911 
912  const float (*vert_cos_src)[3],
913  const float (*vert_cos_dst)[3],
914 
915  const float (*vert_cos_org)[3],
916  float (*vert_cos_new)[3]);
917 
918 /* *** mesh_validate.cc *** */
919 
925 bool BKE_mesh_validate(struct Mesh *me, bool do_verbose, bool cddata_check_mask);
930 bool BKE_mesh_is_valid(struct Mesh *me);
936 
952 bool BKE_mesh_validate_arrays(struct Mesh *me,
953  struct MVert *mverts,
954  unsigned int totvert,
955  struct MEdge *medges,
956  unsigned int totedge,
957  struct MFace *mfaces,
958  unsigned int totface,
959  struct MLoop *mloops,
960  unsigned int totloop,
961  struct MPoly *mpolys,
962  unsigned int totpoly,
963  struct MDeformVert *dverts, /* assume totvert length */
964  bool do_verbose,
965  bool do_fixes,
966  bool *r_change);
967 
972  uint totvert,
973  struct CustomData *edata,
974  uint totedge,
975  struct CustomData *ldata,
976  uint totloop,
977  struct CustomData *pdata,
978  uint totpoly,
979  bool check_meshmask,
980  bool do_verbose,
981  bool do_fixes,
982  bool *r_change);
983 
984 void BKE_mesh_strip_loose_faces(struct Mesh *me);
992 void BKE_mesh_strip_loose_polysloops(struct Mesh *me);
993 void BKE_mesh_strip_loose_edges(struct Mesh *me);
994 
999 void BKE_mesh_calc_edges_legacy(struct Mesh *me, bool use_old);
1000 void BKE_mesh_calc_edges_loose(struct Mesh *mesh);
1004 void BKE_mesh_calc_edges(struct Mesh *mesh, bool keep_existing_edges, bool select_new_edges);
1010 void BKE_mesh_calc_edges_tessface(struct Mesh *mesh);
1011 
1012 /* In DerivedMesh.cc */
1014  const struct CustomData_MeshMasks *cd_mask_finalize);
1015 
1016 /* **** Depsgraph evaluation **** */
1017 
1018 void BKE_mesh_eval_geometry(struct Depsgraph *depsgraph, struct Mesh *mesh);
1019 
1020 /* Draw Cache */
1022 void BKE_mesh_batch_cache_free(struct Mesh *me);
1023 
1025 extern void (*BKE_mesh_batch_cache_free_cb)(struct Mesh *me);
1026 
1027 /* mesh_debug.c */
1028 
1029 #ifndef NDEBUG
1030 char *BKE_mesh_debug_info(const struct Mesh *me)
1032 void BKE_mesh_debug_print(const struct Mesh *me) ATTR_NONNULL(1);
1033 #endif
1034 
1035 #ifdef __cplusplus
1036 }
1037 #endif
typedef float(TangentPoint)[2]
float(* BKE_mesh_vertex_normals_for_write(struct Mesh *mesh))[3]
void BKE_mesh_calc_edges_tessface(struct Mesh *mesh)
struct Mesh * BKE_mesh_copy_for_eval(const struct Mesh *source, bool reference)
void(* BKE_mesh_batch_cache_dirty_tag_cb)(struct Mesh *me, eMeshBatchDirtyMode mode)
void BKE_mesh_strip_loose_faces(struct Mesh *me)
const char * BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh)
Definition: mesh.cc:702
int BKE_mesh_edge_other_vert(const struct MEdge *e, int v)
void BKE_mesh_assign_object(struct Main *bmain, struct Object *ob, struct Mesh *me)
Definition: mesh.cc:1377
int poly_get_adj_loops_from_vert(const struct MPoly *poly, const struct MLoop *mloop, unsigned int vert, unsigned int r_adj[2])
bool BKE_mesh_material_index_used(struct Mesh *me, short index)
Definition: mesh.cc:1420
float(* BKE_mesh_orco_verts_get(struct Object *ob))[3]
Definition: mesh.cc:1314
struct Mesh * BKE_mesh_new_from_object_to_bmain(struct Main *bmain, struct Depsgraph *depsgraph, struct Object *object, bool preserve_all_data_layers)
void BKE_mesh_edges_set_draw_render(struct Mesh *me)
const float(* BKE_mesh_poly_normals_ensure(const struct Mesh *mesh))[3]
MLoopNorSpace * BKE_lnor_space_create(MLoopNorSpaceArray *lnors_spacearr)
void BKE_mesh_calc_poly_angles(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float angles[])
void BKE_mesh_flush_select_from_verts(struct Mesh *me)
@ MLNOR_SPACEARR_LOOP_INDEX
Definition: BKE_mesh.h:571
@ MLNOR_SPACEARR_BMLOOP_PTR
Definition: BKE_mesh.h:572
struct Mesh * BKE_mesh_new_nomain_from_curve_displist(const struct Object *ob, const struct ListBase *dispbase)
void BKE_mesh_copy_parameters(struct Mesh *me_dst, const struct Mesh *me_src)
bool BKE_mesh_clear_facemap_customdata(struct Mesh *me)
Definition: mesh.cc:838
void BKE_mesh_translate(struct Mesh *me, const float offset[3], bool do_keys)
Definition: mesh.cc:1632
void BKE_mesh_tessface_clear(struct Mesh *mesh)
Definition: mesh.cc:1654
void BKE_mesh_poly_edgebitmap_insert(unsigned int *edge_bitmap, const struct MPoly *mp, const struct MLoop *mloop)
void BKE_mesh_copy_parameters_for_eval(struct Mesh *me_dst, const struct Mesh *me_src)
@ MESH_MERGE_VERTS_DUMP_IF_EQUAL
Definition: BKE_mesh.h:819
@ MESH_MERGE_VERTS_DUMP_IF_MAPPED
Definition: BKE_mesh.h:818
bool BKE_mesh_has_custom_loop_normals(struct Mesh *me)
Definition: mesh.cc:894
struct Mesh * BKE_mesh_new_nomain_from_template(const struct Mesh *me_src, int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
struct BoundBox * BKE_mesh_boundbox_get(struct Object *ob)
Definition: mesh.cc:1207
void BKE_mesh_flush_select_from_polys_ex(struct MVert *mvert, int totvert, const struct MLoop *mloop, struct MEdge *medge, int totedge, const struct MPoly *mpoly, int totpoly)
void BKE_mesh_orco_ensure(struct Object *ob, struct Mesh *mesh)
Definition: mesh.cc:1353
struct Mesh * BKE_mesh_from_object(struct Object *ob)
Definition: mesh.cc:1365
void BKE_mesh_texspace_get_reference(struct Mesh *me, char **r_texflag, float **r_loc, float **r_size)
Definition: mesh.cc:1287
void BKE_mesh_free_editmesh(struct Mesh *mesh)
Definition: mesh.cc:169
void BKE_mesh_poly_edgehash_insert(struct EdgeHash *ehash, const struct MPoly *mp, const struct MLoop *mloop)
void BKE_mesh_calc_poly_center(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float r_cent[3])
void BKE_mesh_strip_loose_edges(struct Mesh *me)
void BKE_mesh_polygon_flip_ex(struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata, float(*lnors)[3], struct MDisps *mdisp, bool use_loop_mdisp_flip)
void BKE_mesh_ensure_skin_customdata(struct Mesh *me)
Definition: mesh.cc:786
void BKE_mesh_calc_normals_poly_and_vertex(const struct MVert *mvert, int mvert_len, const struct MLoop *mloop, int mloop_len, const struct MPoly *mpoly, int mpoly_len, float(*r_poly_normals)[3], float(*r_vert_normals)[3])
void BKE_mesh_normals_loop_custom_set(const struct MVert *mverts, const float(*vert_normals)[3], int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, float(*r_custom_loopnors)[3], int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, short(*r_clnors_data)[2])
void BKE_mesh_nomain_to_mesh(struct Mesh *mesh_src, struct Mesh *mesh_dst, struct Object *ob, const struct CustomData_MeshMasks *mask, bool take_ownership)
void BKE_pointcloud_to_mesh(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
bool BKE_mesh_center_of_volume(const struct Mesh *me, float r_cent[3])
void BKE_mesh_mselect_active_set(struct Mesh *me, int index, int type)
Definition: mesh.cc:1784
void BKE_lnor_space_define(MLoopNorSpace *lnor_space, const float lnor[3], float vec_ref[3], float vec_other[3], struct BLI_Stack *edge_vectors)
void BKE_mesh_calc_edges_loose(struct Mesh *mesh)
void BKE_mesh_calc_normals_poly(const struct MVert *mvert, int mvert_len, const struct MLoop *mloop, int mloop_len, const struct MPoly *mpoly, int mpoly_len, float(*r_poly_normals)[3])
void BKE_mesh_mselect_validate(struct Mesh *me)
Definition: mesh.cc:1701
void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me)
Definition: mesh_convert.cc:72
struct BMesh * BKE_mesh_to_bmesh_ex(const struct Mesh *me, const struct BMeshCreateParams *create_params, const struct BMeshFromMeshParams *convert_params)
struct Mesh * BKE_mesh_add(struct Main *bmain, const char *name)
Definition: mesh.cc:963
void BKE_mesh_smooth_flag_set(struct Mesh *me, bool use_smooth)
Definition: mesh.cc:1486
bool BKE_mesh_is_valid(struct Mesh *me)
void BKE_mesh_normals_loop_custom_from_vertices_set(const struct MVert *mverts, const float(*vert_normals)[3], float(*r_custom_vertnors)[3], int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, short(*r_clnors_data)[2])
void BKE_mesh_vert_coords_apply(struct Mesh *mesh, const float(*vert_coords)[3])
Definition: mesh.cc:1834
void BKE_mesh_nomain_to_meshkey(struct Mesh *mesh_src, struct Mesh *mesh_dst, struct KeyBlock *kb)
const float(* BKE_mesh_vertex_normals_ensure(const struct Mesh *mesh))[3]
bool BKE_mesh_poly_normals_are_dirty(const struct Mesh *mesh)
void BKE_mesh_assert_normals_dirty_or_calculated(const struct Mesh *mesh)
void BKE_mesh_calc_normals_looptri(struct MVert *mverts, int numVerts, const struct MLoop *mloop, const struct MLoopTri *looptri, int looptri_num, float(*r_tri_nors)[3])
void BKE_mesh_to_pointcloud(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
bool BKE_mesh_center_median(const struct Mesh *me, float r_cent[3])
void BKE_mesh_merge_customdata_for_apply_modifier(struct Mesh *me)
void BKE_mesh_looptri_get_real_edges(const struct Mesh *mesh, const struct MLoopTri *looptri, int r_edges[3])
bool BKE_mesh_center_median_from_polys(const struct Mesh *me, float r_cent[3])
bool BKE_mesh_ensure_facemap_customdata(struct Mesh *me)
Definition: mesh.cc:819
void BKE_mesh_poly_normals_clear_dirty(struct Mesh *mesh)
int poly_find_loop_from_vert(const struct MPoly *poly, const struct MLoop *loopstart, uint vert)
struct Mesh * BKE_mesh_from_bmesh_nomain(struct BMesh *bm, const struct BMeshToMeshParams *params, const struct Mesh *me_settings)
void BKE_mesh_from_pointcloud(const struct PointCloud *pointcloud, struct Mesh *me)
void BKE_mesh_eval_delete(struct Mesh *mesh_eval)
Definition: mesh.cc:1117
bool BKE_mesh_validate(struct Mesh *me, bool do_verbose, bool cddata_check_mask)
bool BKE_mesh_validate_arrays(struct Mesh *me, struct MVert *mverts, unsigned int totvert, struct MEdge *medges, unsigned int totedge, struct MFace *mfaces, unsigned int totface, struct MLoop *mloops, unsigned int totloop, struct MPoly *mpolys, unsigned int totpoly, struct MDeformVert *dverts, bool do_verbose, bool do_fixes, bool *r_change)
void BKE_mesh_recalc_looptri_with_normals(const struct MLoop *mloop, const struct MPoly *mpoly, const struct MVert *mvert, int totloop, int totpoly, struct MLoopTri *mlooptri, const float(*poly_normals)[3])
void BKE_mesh_flush_hidden_from_polys_ex(struct MVert *mvert, const struct MLoop *mloop, struct MEdge *medge, int totedge, const struct MPoly *mpoly, int totpoly)
void BKE_mesh_flush_hidden_from_verts_ex(const struct MVert *mvert, const struct MLoop *mloop, struct MEdge *medge, int totedge, struct MPoly *mpoly, int totpoly)
void BKE_mesh_recalc_looptri(const struct MLoop *mloop, const struct MPoly *mpoly, const struct MVert *mvert, int totloop, int totpoly, struct MLoopTri *mlooptri)
void BKE_lnor_spacearr_clear(MLoopNorSpaceArray *lnors_spacearr)
void BKE_mesh_batch_cache_free(struct Mesh *me)
int BKE_mesh_mselect_active_get(struct Mesh *me, int type)
Definition: mesh.cc:1772
void BKE_mesh_vert_coords_apply_with_mat4(struct Mesh *mesh, const float(*vert_coords)[3], const float mat[4][4])
Definition: mesh.cc:1846
struct Mesh * BKE_mesh_new_nomain(int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
Definition: mesh.cc:991
void BKE_mesh_update_customdata_pointers(struct Mesh *me, bool do_ensure_tess_cd)
Definition: mesh.cc:874
void BKE_mesh_texspace_copy_from_object(struct Mesh *me, struct Object *ob)
Definition: mesh.cc:1302
void BKE_lnor_spacearr_init(MLoopNorSpaceArray *lnors_spacearr, int numLoops, char data_type)
struct Mesh * BKE_mesh_from_bmesh_for_eval_nomain(struct BMesh *bm, const struct CustomData_MeshMasks *cd_mask_extra, const struct Mesh *me_settings)
bool BKE_mesh_validate_material_indices(struct Mesh *me)
struct MLoopNorSpace MLoopNorSpace
void BKE_mesh_calc_normals(struct Mesh *me)
void BKE_mesh_calc_edges_legacy(struct Mesh *me, bool use_old)
void BKE_mesh_normals_loop_to_vertex(int numVerts, const struct MLoop *mloops, int numLoops, const float(*clnors)[3], float(*r_vert_clnors)[3])
void BKE_mesh_clear_derived_normals(struct Mesh *mesh)
void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float r_no[3])
void BKE_lnor_space_add_loop(MLoopNorSpaceArray *lnors_spacearr, MLoopNorSpace *lnor_space, int ml_index, void *bm_loop, bool is_single)
void BKE_mesh_calc_normals_split_ex(struct Mesh *mesh, struct MLoopNorSpaceArray *r_lnors_spacearr, float(*r_corner_normals)[3])
Definition: mesh.cc:1875
int BKE_mesh_mselect_find(struct Mesh *me, int index, int type)
Definition: mesh.cc:1759
void BKE_mesh_batch_cache_dirty_tag(struct Mesh *me, eMeshBatchDirtyMode mode)
struct Mesh * BKE_mesh_new_nomain_from_curve(const struct Object *ob)
void BKE_mesh_do_versions_cd_flag_init(struct Mesh *mesh)
Definition: mesh.cc:1659
void BKE_mesh_clear_geometry(struct Mesh *me)
Definition: mesh.cc:941
void BKE_mesh_calc_normals_split(struct Mesh *mesh)
Definition: mesh.cc:1911
void BKE_mesh_ensure_default_orig_index_customdata_no_check(struct Mesh *mesh)
Definition: mesh.cc:1200
void BKE_mesh_orco_verts_transform(struct Mesh *me, float(*orco)[3], int totvert, int invert)
Definition: mesh.cc:1331
bool BKE_mesh_center_of_surface(const struct Mesh *me, float r_cent[3])
struct Mesh * BKE_mesh_create_derived_for_modifier(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_eval, struct ModifierData *md_eval, bool use_virtual_modifiers, bool build_shapekey_layers)
void BKE_mesh_count_selected_items(const struct Mesh *mesh, int r_count[3])
void BKE_mesh_strip_loose_polysloops(struct Mesh *me)
bool BKE_mesh_validate_all_customdata(struct CustomData *vdata, uint totvert, struct CustomData *edata, uint totedge, struct CustomData *ldata, uint totloop, struct CustomData *pdata, uint totpoly, bool check_meshmask, bool do_verbose, bool do_fixes, bool *r_change)
void BKE_mesh_vert_coords_get(const struct Mesh *mesh, float(*vert_coords)[3])
void BKE_mesh_calc_relative_deform(const struct MPoly *mpoly, int totpoly, const struct MLoop *mloop, 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])
bool BKE_mesh_vertex_normals_are_dirty(const struct Mesh *mesh)
void BKE_mesh_texspace_calc(struct Mesh *me)
Definition: mesh.cc:1231
struct BMesh * BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob, bool add_key_index, const struct BMeshCreateParams *params)
Definition: mesh.cc:1150
struct Mesh * BKE_mesh_new_from_object(struct Depsgraph *depsgraph, struct Object *object, bool preserve_all_data_layers, bool preserve_origindex)
void BKE_mesh_loop_manifold_fan_around_vert_next(const struct MLoop *mloops, const struct MPoly *mpolys, const int *loop_to_poly, const int *e2lfan_curr, uint mv_pivot_index, const struct MLoop **r_mlfan_curr, int *r_mlfan_curr_index, int *r_mlfan_vert_index, int *r_mpfan_curr_index)
struct Mesh * BKE_mesh_merge_verts(struct Mesh *mesh, const int *vtargetmap, int tot_vtargetmap, int merge_mode)
Definition: mesh_merge.c:192
void BKE_mesh_texspace_ensure(struct Mesh *me)
Definition: mesh.cc:1268
void BKE_mesh_debug_print(const struct Mesh *me) ATTR_NONNULL(1)
void BKE_mesh_normals_loop_split(const struct MVert *mverts, const float(*vert_normals)[3], int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, float(*r_loopnors)[3], int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, bool use_split_normals, float split_angle, MLoopNorSpaceArray *r_lnors_spacearr, short(*clnors_data)[2], int *r_loop_to_poly)
void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, unsigned int remap_len)
Definition: mesh.cc:1456
void BKE_mesh_flush_select_from_polys(struct Mesh *me)
@ MLNOR_SPACE_IS_SINGLE
Definition: BKE_mesh.h:553
void BKE_pointcloud_from_mesh(struct Mesh *me, struct PointCloud *pointcloud)
float BKE_mesh_calc_poly_uv_area(const struct MPoly *mpoly, const struct MLoopUV *uv_array)
void BKE_mesh_vertex_normals_clear_dirty(struct Mesh *mesh)
void BKE_mesh_set_custom_normals_from_vertices(struct Mesh *mesh, float(*r_custom_vertnors)[3])
void BKE_mesh_mselect_clear(struct Mesh *me)
Definition: mesh.cc:1695
char * BKE_mesh_debug_info(const struct Mesh *me) ATTR_NONNULL(1) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
float BKE_mesh_calc_area(const struct Mesh *me)
float(* BKE_mesh_poly_normals_for_write(struct Mesh *mesh))[3]
void BKE_mesh_split_faces(struct Mesh *mesh, bool free_loop_normals)
Definition: mesh.cc:2121
void BKE_mesh_calc_volume(const struct MVert *mverts, int mverts_num, const struct MLoopTri *mlooptri, int looptri_num, const struct MLoop *mloop, float *r_volume, float r_center[3])
void BKE_lnor_spacearr_free(MLoopNorSpaceArray *lnors_spacearr)
void BKE_mesh_normals_tag_dirty(struct Mesh *mesh)
Definition: mesh_normals.cc:95
void BKE_mesh_tag_coords_changed_uniformly(struct Mesh *mesh)
void BKE_lnor_space_custom_data_to_normal(MLoopNorSpace *lnor_space, const short clnor_data[2], float r_custom_lnor[3])
bool BKE_mesh_minmax(const struct Mesh *me, float r_min[3], float r_max[3])
void BKE_mesh_polygons_flip(struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata, int totpoly)
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float(*r_custom_loopnors)[3])
struct Mesh * BKE_mesh_new_nomain_from_template_ex(const struct Mesh *me_src, int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len, struct CustomData_MeshMasks mask)
void BKE_mesh_texspace_get(struct Mesh *me, float r_loc[3], float r_size[3])
Definition: mesh.cc:1275
void BKE_mesh_flush_hidden_from_verts(struct Mesh *me)
void BKE_mesh_to_curve(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
struct MLoopNorSpaceArray MLoopNorSpaceArray
void BKE_mesh_mdisp_flip(struct MDisps *md, bool use_loop_mdisp_flip)
void BKE_lnor_spacearr_tls_join(MLoopNorSpaceArray *lnors_spacearr, MLoopNorSpaceArray *lnors_spacearr_tls)
float(* BKE_mesh_vert_coords_alloc(const struct Mesh *mesh, int *r_vert_len))[3]
void BKE_mesh_auto_smooth_flag_set(struct Mesh *me, bool use_auto_smooth, float auto_smooth_angle)
Definition: mesh.cc:1500
void BKE_mesh_flush_hidden_from_polys(struct Mesh *me)
void BKE_mesh_free_data_for_undo(struct Mesh *me)
Definition: mesh.cc:903
void BKE_mesh_tag_coords_changed(struct Mesh *mesh)
void BKE_mesh_ensure_default_orig_index_customdata(struct Mesh *mesh)
Definition: mesh.cc:1194
float BKE_mesh_calc_poly_area(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray)
void BKE_mesh_ensure_normals_for_display(struct Mesh *mesh)
void BKE_mesh_material_index_remove(struct Mesh *me, short index)
Definition: mesh.cc:1401
void BKE_mesh_calc_poly_normal_coords(const struct MPoly *mpoly, const struct MLoop *loopstart, const float(*vertex_coords)[3], float r_no[3])
bool BKE_mesh_center_bounds(const struct Mesh *me, float r_cent[3])
void BKE_mesh_transform(struct Mesh *me, const float mat[4][4], bool do_keys)
Definition: mesh.cc:1594
void BKE_mesh_material_index_clear(struct Mesh *me)
Definition: mesh.cc:1441
void BKE_mesh_polygon_flip(struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata)
void BKE_mesh_eval_geometry(struct Depsgraph *depsgraph, struct Mesh *mesh)
Definition: mesh.cc:2199
void BKE_lnor_spacearr_tls_init(MLoopNorSpaceArray *lnors_spacearr, MLoopNorSpaceArray *lnors_spacearr_tls)
void BKE_mesh_wrapper_deferred_finalize_mdata(struct Mesh *me_eval, const struct CustomData_MeshMasks *cd_mask_finalize)
void BKE_mesh_calc_edges(struct Mesh *mesh, bool keep_existing_edges, bool select_new_edges)
void BKE_mesh_to_curve_nurblist(const struct Mesh *me, struct ListBase *nurblist, int edge_users_test)
void(* BKE_mesh_batch_cache_free_cb)(struct Mesh *me)
void BKE_edges_sharp_from_angle_set(const struct MVert *mverts, int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, float split_angle)
void BKE_lnor_space_custom_normal_to_data(MLoopNorSpace *lnor_space, const float custom_lnor[3], short r_clnor_data[2])
eMeshBatchDirtyMode
Definition: BKE_mesh_types.h:9
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_MALLOC
#define ATTR_NONNULL(...)
unsigned int uint
Definition: BLI_sys_types.h:67
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
ATTR_WARN_UNUSED_RESULT BMesh * bm
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
size_t index
Scene scene
const Depsgraph * depsgraph
SyclQueue void void size_t num_bytes void
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
Definition: invert.h:8
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
Definition: DNA_ID.h:368
struct LinkNode * loops_pool
Definition: BKE_mesh.h:561
struct MemArena * mem
Definition: BKE_mesh.h:565
MLoopNorSpace ** lspacearr
Definition: BKE_mesh.h:560
float ref_alpha
Definition: BKE_mesh.h:536
float vec_ortho[3]
Definition: BKE_mesh.h:534
float ref_beta
Definition: BKE_mesh.h:538
float vec_ref[3]
Definition: BKE_mesh.h:532
float vec_lnor[3]
Definition: BKE_mesh.h:530
void * user_data
Definition: BKE_mesh.h:547
struct LinkNode * loops
Definition: BKE_mesh.h:543
Definition: BKE_main.h:121
struct MEdge * medge
CustomData vdata
struct MVert * mvert
struct Material ** mat
int totedge
int totvert
struct MLoop * mloop
int totface
CustomData pdata
int totpoly
CustomData edata
int totloop
struct MPoly * mpoly
CustomData ldata
ustring name
Definition: graph/node.h:174
void reference()
Definition: graph/node.h:185