Blender  V3.3
DNA_mesh_types.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 
8 #pragma once
9 
10 #include "DNA_ID.h"
11 #include "DNA_customdata_types.h"
12 #include "DNA_defs.h"
13 #include "DNA_session_uuid_types.h"
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 struct AnimData;
20 struct BVHCache;
21 struct Ipo;
22 struct Key;
23 struct MCol;
24 struct MEdge;
25 struct MFace;
26 struct MLoop;
27 struct MLoopCol;
28 struct MLoopTri;
29 struct MLoopUV;
30 struct MPoly;
31 struct MVert;
32 struct Material;
33 struct Mesh;
34 struct SubdivCCG;
35 struct SubsurfRuntimeData;
36 
37 #
38 #
39 typedef struct EditMeshData {
41  const float (*vertexCos)[3];
42 
44  float const (*vertexNos)[3];
45  float const (*polyNos)[3];
47  const float (*polyCos)[3];
49 
56 
57  /* WARNING! swapping between array (ready-to-be-used data) and array_wip
58  * (where data is actually computed)
59  * shall always be protected by same lock as one used for looptris computing. */
61  int len;
62  int len_alloc;
63 };
64 
66 typedef struct Mesh_Runtime {
68 
69  /* Evaluated mesh for objects which do not have effective modifiers.
70  * This mesh is used as a result of modifier stack evaluation.
71  * Since modifier stack evaluation is threaded on object level we need some synchronization. */
72  struct Mesh *mesh_eval;
73  void *eval_mutex;
74 
75  /* A separate mutex is needed for normal calculation, because sometimes
76  * the normals are needed while #eval_mutex is already locked. */
77  void *normals_mutex;
78 
80  void *render_mutex;
81 
83  struct EditMeshData *edit_data;
84 
89  void *batch_cache;
90 
92  struct MLoopTri_Store looptris;
93 
95  struct BVHCache *bvh_cache;
96 
98  struct ShrinkwrapBoundaryData *shrinkwrap_data;
99 
101  CustomData_MeshMasks cd_mask_extra;
102 
103  struct SubdivCCG *subdiv_ccg;
104  int subdiv_ccg_tot_level;
105 
107  char deformed_only;
115  char is_original;
116 
118  char wrapper_type;
123  char wrapper_type_finalize;
124 
130  struct SubsurfRuntimeData *subsurf_runtime_data;
131  void *_pad1;
132 
138  char _pad2[6];
139  char vert_normals_dirty;
140  char poly_normals_dirty;
141  float (*vert_normals)[3];
142  float (*poly_normals)[3];
143 
148  uint32_t *subsurf_face_dot_tags;
150 
151 typedef struct Mesh {
153 
154  ID id;
156  struct AnimData *adt;
157 
159  struct Ipo *ipo DNA_DEPRECATED;
160  struct Key *key;
161 
166  struct Material **mat;
167 
172  struct MVert *mvert;
179  struct MEdge *medge;
185  struct MPoly *mpoly;
190  struct MLoop *mloop;
191 
193  int totvert;
195  int totedge;
197  int totpoly;
199  int totloop;
200 
201  CustomData vdata, edata, pdata, ldata;
202 
204  struct MDeformVert *dvert;
209  ListBase vertex_group_names;
211  int vertex_group_active_index;
212 
217  int attributes_active_index;
218 
223  struct MLoopUV *mloopuv;
229  struct MLoopCol *mloopcol;
230 
236  struct BMEditMesh *edit_mesh;
237 
245  struct MSelect *mselect;
246 
248  int totselect;
249 
259  int act_face;
260 
266  struct Mesh *texcomesh;
267 
269  float loc[3];
270  float size[3];
271  char texflag;
272 
274  char editflag;
276  uint16_t flag;
277 
281  float smoothresh;
282 
288  char cd_flag;
289 
294  char symmetry;
295 
297  short totcol;
298 
300  char remesh_mode;
301 
302  char subdiv DNA_DEPRECATED;
303  char subdivr DNA_DEPRECATED;
304  char subsurftype DNA_DEPRECATED;
305 
312  struct MTFace *mtface;
314  struct TFace *tface DNA_DEPRECATED;
315 
316  /* Deprecated. Array of colors for the tessellated faces, must be number of tessellated
317  * faces * 4 in length. This is stored in #fdata, and deprecated. */
318  struct MCol *mcol;
319 
327  struct MFace *mface;
328  /* Deprecated storage of old faces (only triangles or quads). */
329  CustomData fdata;
330  /* Deprecated size of #fdata. */
331  int totface;
332 
334  float remesh_voxel_size;
335  float remesh_voxel_adaptivity;
336 
337  int face_sets_color_seed;
338  /* Stores the initial Face Set to be rendered white. This way the overlay can be enabled by
339  * default and Face Sets can be used without affecting the color of the mesh. */
340  int face_sets_color_default;
341 
342  char _pad1[4];
343 
344  void *_pad2;
345 
346  Mesh_Runtime runtime;
348 
349 /* deprecated by MTFace, only here for file reading */
350 #ifdef DNA_DEPRECATED_ALLOW
351 typedef struct TFace {
353 
354 
355  void *tpage;
356  float uv[4][2];
357  unsigned int col[4];
358  char flag, transp;
359  short mode, tile, unwrap;
360 } TFace;
361 #endif
362 
363 /* **************** MESH ********************* */
364 
366 typedef enum eMeshWrapperType {
374 
376 enum {
379 };
380 
382 enum {
384  ME_EDIT_MIRROR_Y = 1 << 1, /* unused so far */
385  ME_EDIT_MIRROR_Z = 1 << 2, /* unused so far */
386 
390 };
391 
392 /* Helper macro to see if vertex group X mirror is on. */
393 #define ME_USING_MIRROR_X_VERTEX_GROUPS(_me) \
394  (((_me)->editflag & ME_EDIT_MIRROR_VERTEX_GROUPS) && ((_me)->symmetry & ME_SYMMETRY_X))
395 
396 /* We can't have both flags enabled at once,
397  * flags defined in DNA_scene_types.h */
398 #define ME_EDIT_PAINT_SEL_MODE(_me) \
399  (((_me)->editflag & ME_EDIT_PAINT_FACE_SEL) ? SCE_SELECT_FACE : \
400  ((_me)->editflag & ME_EDIT_PAINT_VERT_SEL) ? SCE_SELECT_VERTEX : \
401  0)
402 
404 enum {
405  ME_FLAG_UNUSED_0 = 1 << 0, /* cleared */
406  ME_FLAG_UNUSED_1 = 1 << 1, /* cleared */
407  ME_FLAG_DEPRECATED_2 = 1 << 2, /* deprecated */
408  ME_FLAG_UNUSED_3 = 1 << 3, /* cleared */
409  ME_FLAG_UNUSED_4 = 1 << 4, /* cleared */
410  ME_AUTOSMOOTH = 1 << 5,
411  ME_FLAG_UNUSED_6 = 1 << 6, /* cleared */
412  ME_FLAG_UNUSED_7 = 1 << 7, /* cleared */
414  ME_DS_EXPAND = 1 << 9,
416  ME_FLAG_UNUSED_8 = 1 << 11, /* cleared */
421 };
422 
424 enum {
429 };
430 
432 enum {
435 };
436 
438 enum {
441 };
442 
444 typedef enum eMeshSymmetryType {
445  ME_SYMMETRY_X = 1 << 0,
446  ME_SYMMETRY_Y = 1 << 1,
447  ME_SYMMETRY_Z = 1 << 2,
449 
450 #define MESH_MAX_VERTS 2000000000L
451 
452 #ifdef __cplusplus
453 }
454 #endif
typedef float(TangentPoint)[2]
ID and Library types, which are fundamental for sdna.
#define DNA_DEFINE_CXX_METHODS(class_name)
Definition: DNA_defs.h:64
#define DNA_DEPRECATED
Definition: DNA_defs.h:21
eMeshWrapperType
@ ME_WRAPPER_TYPE_MDATA
@ ME_WRAPPER_TYPE_SUBD
@ ME_WRAPPER_TYPE_BMESH
@ REMESH_QUAD
@ REMESH_VOXEL
@ ME_EDIT_MIRROR_VERTEX_GROUPS
@ ME_EDIT_PAINT_VERT_SEL
@ ME_EDIT_PAINT_FACE_SEL
@ ME_EDIT_MIRROR_Z
@ ME_EDIT_MIRROR_Y
@ ME_EDIT_MIRROR_TOPO
@ ME_CC_SUBSURF
@ ME_SIMPLE_SUBSURF
@ ME_FLAG_UNUSED_6
@ ME_REMESH_REPROJECT_VOLUME
@ ME_FLAG_UNUSED_4
@ ME_REMESH_REPROJECT_VERTEX_COLORS
@ ME_FLAG_UNUSED_3
@ ME_DS_EXPAND
@ ME_FLAG_UNUSED_7
@ ME_FLAG_UNUSED_8
@ ME_REMESH_REPROJECT_SCULPT_FACE_SETS
@ ME_FLAG_UNUSED_1
@ ME_AUTOSMOOTH
@ ME_REMESH_FIX_POLES
@ ME_FLAG_DEPRECATED_2
@ ME_SCULPT_DYNAMIC_TOPOLOGY
@ ME_REMESH_REPROJECT_PAINT_MASK
@ ME_FLAG_UNUSED_0
eMeshSymmetryType
@ ME_SYMMETRY_X
@ ME_SYMMETRY_Y
@ ME_SYMMETRY_Z
@ ME_AUTOSPACE_EVALUATED
@ ME_AUTOSPACE
struct EditMeshData EditMeshData
@ ME_CDFLAG_VERT_CREASE
@ ME_CDFLAG_EDGE_CREASE
@ ME_CDFLAG_VERT_BWEIGHT
@ ME_CDFLAG_EDGE_BWEIGHT
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
uint col
ccl_global const KernelWorkTile * tile
static PartialUpdateUserImpl * unwrap(struct PartialUpdateUser *user)
unsigned short uint16_t
Definition: stdint.h:79
unsigned int uint32_t
Definition: stdint.h:80
const float(* polyCos)[3]
const float(* vertexCos)[3]
Definition: DNA_ID.h:368
struct MLoopTri * array_wip