Blender  V2.93
DNA_meshdata_types.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "DNA_customdata_types.h"
27 #include "DNA_listBase.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /* -------------------------------------------------------------------- */
42 typedef struct MVert {
43  float co[3];
48  short no[3];
49  char flag, bweight;
51 
53 enum {
54  /* SELECT = (1 << 0), */
55  ME_VERT_TMP_TAG = (1 << 2),
56  ME_HIDE = (1 << 4),
57  ME_VERT_FACEDOT = (1 << 5),
58  /* ME_VERT_MERGED = (1 << 6), */
59  ME_VERT_PBVH_UPDATE = (1 << 7),
60 };
61 
67 typedef struct MEdge {
69  unsigned int v1, v2;
70  char crease, bweight;
71  short flag;
73 
75 enum {
76  /* SELECT = (1 << 0), */
77  ME_EDGEDRAW = (1 << 1),
78  ME_SEAM = (1 << 2),
79  /* ME_HIDE = (1 << 4), */
80  ME_EDGERENDER = (1 << 5),
81  ME_LOOSEEDGE = (1 << 7),
82  ME_EDGE_TMP_TAG = (1 << 8),
83  ME_SHARP = (1 << 9), /* only reason this flag remains a 'short' */
84 };
85 
92 typedef struct MPoly {
94  int loopstart;
96  int totloop;
97  short mat_nr;
98  char flag, _pad;
100 
102 enum {
103  ME_SMOOTH = (1 << 0),
104  ME_FACE_SEL = (1 << 1),
105  /* ME_HIDE = (1 << 4), */
106 };
107 
114 typedef struct MLoop {
116  unsigned int v;
122  unsigned int e;
124 
127 /* -------------------------------------------------------------------- */
137 typedef struct MSelect {
139  int index;
141  int type;
143 
145 enum {
146  ME_VSEL = 0,
147  ME_ESEL = 1,
148  ME_FSEL = 2,
149 };
150 
153 /* -------------------------------------------------------------------- */
248 typedef struct MLoopTri {
249  unsigned int tri[3];
250  unsigned int poly;
252 #
253 #
254 typedef struct MVertTri {
255  unsigned int tri[3];
257 
260 /* -------------------------------------------------------------------- */
265 typedef struct MFloatProperty {
266  float f;
268 typedef struct MIntProperty {
269  int i;
271 typedef struct MStringProperty {
272  char s[255], s_len;
274 typedef struct MBoolProperty {
277 
280 /* -------------------------------------------------------------------- */
287 typedef struct MDeformWeight {
289  unsigned int def_nr;
291  float weight;
293 
294 typedef struct MDeformVert {
295  struct MDeformWeight *dw;
298  int flag;
300 
301 typedef struct MVertSkin {
306  float radius[3];
307 
309  int flag;
311 
312 typedef enum eMVertSkinFlag {
317 
323 
326 /* -------------------------------------------------------------------- */
333 typedef struct MLoopUV {
334  float uv[2];
335  int flag;
337 
339 enum {
340  /* MLOOPUV_DEPRECATED = (1 << 0), MLOOPUV_EDGESEL removed */
341  MLOOPUV_VERTSEL = (1 << 1),
342  MLOOPUV_PINNED = (1 << 2),
343 };
344 
349 typedef struct MLoopCol {
350  unsigned char r, g, b, a;
352 
353 typedef struct MPropCol {
354  float color[4];
356 
358 typedef struct MDisps {
359  /* Strange bug in SDNA: if disps pointer comes first, it fails to see totdisp */
360  int totdisp;
361  int level;
362  float (*disps)[3];
363 
370  unsigned int *hidden;
372 
374 typedef struct GridPaintMask {
379  float *data;
380 
382  unsigned int level;
383 
384  char _pad[4];
386 
389 /* -------------------------------------------------------------------- */
400 #
401 #
402 typedef struct OrigSpaceFace {
403  float uv[4][2];
405 
406 #
407 #
408 typedef struct OrigSpaceLoop {
409  float uv[2];
411 
414 /* -------------------------------------------------------------------- */
418 typedef struct FreestyleEdge {
419  char flag;
421 
423 enum {
425 };
426 
427 typedef struct FreestyleFace {
428  char flag;
430 
432 enum {
434 };
435 
438 /* -------------------------------------------------------------------- */
442 #define ME_POLY_LOOP_PREV(mloop, mp, i) \
443  (&(mloop)[(mp)->loopstart + (((i) + (mp)->totloop - 1) % (mp)->totloop)])
444 #define ME_POLY_LOOP_NEXT(mloop, mp, i) (&(mloop)[(mp)->loopstart + (((i) + 1) % (mp)->totloop)])
445 
447 #define ME_POLY_TRI_TOT(mp) ((mp)->totloop - 2)
448 
454 #define ME_MAT_NR_TEST(mat_nr, totmat) \
455  (CHECK_TYPE_ANY(mat_nr, short, const short), \
456  CHECK_TYPE_ANY(totmat, short, const short), \
457  (LIKELY(mat_nr < totmat) ? mat_nr : 0))
458 
461 /* -------------------------------------------------------------------- */
469 typedef struct MFace {
470  unsigned int v1, v2, v3, v4;
471  short mat_nr;
473  char edcode, flag;
475 
477 enum {
478  ME_V1V2 = (1 << 0),
479  ME_V2V3 = (1 << 1),
480  ME_V3V1 = (1 << 2),
482  ME_V4V1 = (1 << 3),
483 };
484 
486 typedef struct MTFace {
487  float uv[4][2];
489 
495 typedef struct MCol {
496  unsigned char a, r, g, b;
498 
499 #define MESH_MLOOPCOL_FROM_MCOL(_mloopcol, _mcol) \
500  { \
501  MLoopCol *mloopcol__tmp = _mloopcol; \
502  const MCol *mcol__tmp = _mcol; \
503  mloopcol__tmp->r = mcol__tmp->b; \
504  mloopcol__tmp->g = mcol__tmp->g; \
505  mloopcol__tmp->b = mcol__tmp->r; \
506  mloopcol__tmp->a = mcol__tmp->a; \
507  } \
508  (void)0
509 
510 #define MESH_MLOOPCOL_TO_MCOL(_mloopcol, _mcol) \
511  { \
512  const MLoopCol *mloopcol__tmp = _mloopcol; \
513  MCol *mcol__tmp = _mcol; \
514  mcol__tmp->b = mloopcol__tmp->r; \
515  mcol__tmp->g = mloopcol__tmp->g; \
516  mcol__tmp->r = mloopcol__tmp->b; \
517  mcol__tmp->a = mloopcol__tmp->a; \
518  } \
519  (void)0
520 
522 typedef struct MRecast {
523  int i;
525 
528 #ifdef __cplusplus
529 }
530 #endif
typedef float(TangentPoint)[2]
These structs are the foundation for all linked lists in the library system.
@ ME_VSEL
@ ME_FSEL
@ ME_ESEL
struct MLoop MLoop
struct FreestyleEdge FreestyleEdge
struct MBoolProperty MBoolProperty
struct MDisps MDisps
struct MEdge MEdge
struct MVertTri MVertTri
@ FREESTYLE_EDGE_MARK
@ ME_HIDE
@ ME_VERT_TMP_TAG
@ ME_VERT_PBVH_UPDATE
@ ME_VERT_FACEDOT
struct MVertSkin MVertSkin
struct MStringProperty MStringProperty
@ ME_V4V1
@ ME_V2V3
@ ME_V1V2
@ ME_V3V4
@ ME_V3V1
struct MLoopTri MLoopTri
struct GridPaintMask GridPaintMask
struct MRecast MRecast
struct MCol MCol
struct MDeformVert MDeformVert
@ ME_EDGEDRAW
@ ME_SEAM
@ ME_EDGERENDER
@ ME_EDGE_TMP_TAG
@ ME_LOOSEEDGE
@ ME_SHARP
struct MTFace MTFace
@ MLOOPUV_PINNED
@ MLOOPUV_VERTSEL
struct OrigSpaceFace OrigSpaceFace
@ FREESTYLE_FACE_MARK
struct MDeformWeight MDeformWeight
struct OrigSpaceLoop OrigSpaceLoop
struct MIntProperty MIntProperty
eMVertSkinFlag
@ MVERT_SKIN_LOOSE
@ MVERT_SKIN_ROOT
struct MLoopCol MLoopCol
struct MPoly MPoly
struct MFloatProperty MFloatProperty
struct MPropCol MPropCol
struct MFace MFace
struct MSelect MSelect
struct MLoopUV MLoopUV
struct FreestyleFace FreestyleFace
@ ME_SMOOTH
@ ME_FACE_SEL
struct MVert MVert
unsigned char uint8_t
Definition: stdint.h:81
unsigned int level
unsigned char r
unsigned char a
unsigned char g
unsigned char b
struct MDeformWeight * dw
unsigned int def_nr
float(* disps)[3]
unsigned int * hidden
unsigned int v1
unsigned int v2
unsigned int v2
unsigned int v1
unsigned int v4
unsigned int v3
unsigned char a
unsigned char b
unsigned char r
unsigned char g
unsigned int poly
unsigned int tri[3]
unsigned int e
unsigned int v
short mat_nr
float color[4]
float uv[4][2]
unsigned int tri[3]
float co[3]
short no[3]