Blender V2.61 - r43446

DNA_mesh_types.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00032 #ifndef DNA_MESH_TYPES_H
00033 #define DNA_MESH_TYPES_H
00034 
00035 #include "DNA_defs.h"
00036 #include "DNA_listBase.h"
00037 #include "DNA_ID.h"
00038 #include "DNA_customdata_types.h"
00039 
00040 #include "DNA_defs.h" /* USE_BMESH_FORWARD_COMPAT */
00041 
00042 struct DerivedMesh;
00043 struct Ipo;
00044 struct Key;
00045 struct Material;
00046 struct MVert;
00047 struct MEdge;
00048 struct MFace;
00049 struct MCol;
00050 struct MSticky;
00051 struct Mesh;
00052 struct OcInfo;
00053 struct MPoly;
00054 struct MTexPoly;
00055 struct MLoop;
00056 struct MLoopUV;
00057 struct MLoopCol;
00058 struct Multires;
00059 struct EditMesh;
00060 struct AnimData;
00061 
00062 typedef struct Mesh {
00063     ID id;
00064     struct AnimData *adt;       /* animation data (must be immediately after id for utilities to use it) */
00065 
00066     struct BoundBox *bb;
00067     
00068     struct Ipo *ipo  DNA_DEPRECATED;  /* old animation system, deprecated for 2.5 */
00069     struct Key *key;
00070     struct Material **mat;
00071 
00072 /*#ifdef USE_BMESH_FORWARD_COMPAT*/ /* XXX - ifdefs dont work here! */
00073 /* BMESH ONLY */
00074     /*new face structures*/
00075     struct MPoly *mpoly;
00076     struct MTexPoly *mtpoly;
00077     struct MLoop *mloop;
00078     struct MLoopUV *mloopuv;
00079     struct MLoopCol *mloopcol;
00080 /* END BMESH ONLY */
00081 /*#endif*/
00082 
00083     struct MFace *mface;    /* array of mesh object mode faces */
00084     struct MTFace *mtface;  /* store face UV's and texture here */
00085     struct TFace *tface;    /* depecrated, use mtface */
00086     struct MVert *mvert;    /* array of verts */
00087     struct MEdge *medge;    /* array of edges */
00088     struct MDeformVert *dvert;  /* deformgroup vertices */
00089     struct MCol *mcol;      /* array of colors, this must be the number of faces * 4 */
00090     struct MSticky *msticky;
00091     struct Mesh *texcomesh;
00092     struct MSelect *mselect;
00093     
00094     struct EditMesh *edit_mesh; /* not saved in file! */
00095 
00096     struct CustomData vdata, edata, fdata;
00097 
00098 /*#ifdef USE_BMESH_FORWARD_COMPAT*/ /* XXX - ifdefs dont work here! */
00099 /* BMESH ONLY */
00100     struct CustomData pdata, ldata;
00101 /* END BMESH ONLY */
00102 /*#endif*/
00103 
00104     int totvert, totedge, totface, totselect;
00105 
00106 /*#ifdef USE_BMESH_FORWARD_COMPAT*/
00107 /* BMESH ONLY */
00108     int totpoly, totloop;
00109 /* END BMESH ONLY */
00110 /*#endif*/ /* XXX - ifdefs dont work here! */
00111 
00112     /* the last selected vertex/edge/face are used for the active face however
00113      * this means the active face must always be selected, this is to keep track
00114      * of the last selected face and is similar to the old active face flag where
00115      * the face does not need to be selected, -1 is inactive */
00116     int act_face; 
00117 
00118     /* texture space, copied as one block in editobject.c */
00119     float loc[3];
00120     float size[3];
00121     float rot[3];
00122 
00123     short texflag, drawflag;
00124     short smoothresh, flag;
00125 
00126     short subdiv  DNA_DEPRECATED, subdivr  DNA_DEPRECATED;
00127     char subsurftype  DNA_DEPRECATED; /* only kept for backwards compat, not used anymore */
00128     char editflag;
00129 
00130     short totcol;
00131 
00132     struct Multires *mr DNA_DEPRECATED; /* deprecated multiresolution modeling data, only keep for loading old files */
00133 } Mesh;
00134 
00135 /* deprecated by MTFace, only here for file reading */
00136 typedef struct TFace {
00137     void *tpage;    /* the faces image for the active UVLayer */
00138     float uv[4][2];
00139     unsigned int col[4];
00140     char flag, transp;
00141     short mode, tile, unwrap;
00142 } TFace;
00143 
00144 /* **************** MESH ********************* */
00145 
00146 /* texflag */
00147 #define AUTOSPACE   1
00148 
00149 /* me->editflag */
00150 #define ME_EDIT_MIRROR_X (1 << 0)
00151 #define ME_EDIT_MIRROR_Y (1 << 1) // unused so far
00152 #define ME_EDIT_MIRROR_Z (1 << 2) // unused so far
00153 
00154 #define ME_EDIT_PAINT_MASK (1 << 3)
00155 #define ME_EDIT_MIRROR_TOPO (1 << 4)
00156 #define ME_EDIT_VERT_SEL (1 << 5)
00157 
00158 /* we cant have both flags enabled at once,
00159  * flags defined in DNA_scene_types.h */
00160 #define ME_EDIT_PAINT_SEL_MODE(_me)  (                                        \
00161     (_me->editflag & ME_EDIT_PAINT_MASK) ? SCE_SELECT_FACE :                  \
00162         (_me->editflag & ME_EDIT_VERT_SEL) ? SCE_SELECT_VERTEX :              \
00163             0                                                                 \
00164     )
00165 
00166 /* me->flag */
00167 /* #define ME_ISDONE        1 */
00168 #define ME_DEPRECATED   2
00169 #define ME_TWOSIDED     4
00170 #define ME_UVEFFECT     8
00171 #define ME_VCOLEFFECT   16
00172 #define ME_AUTOSMOOTH   32
00173 #define ME_SMESH        64
00174 #define ME_SUBSURF      128
00175 #define ME_OPT_EDGES    256
00176 #define ME_DS_EXPAND    512
00177 
00178 /* me->drawflag, short */
00179 #define ME_DRAWEDGES    (1 << 0)
00180 #define ME_DRAWFACES    (1 << 1)
00181 #define ME_DRAWNORMALS  (1 << 2)
00182 #define ME_DRAW_VNORMALS (1 << 3)
00183 
00184 #define ME_ALLEDGES     (1 << 4)
00185 #define ME_HIDDENEDGES  (1 << 5)
00186 
00187 #define ME_DRAWCREASES  (1 << 6)
00188 #define ME_DRAWSEAMS    (1 << 7)
00189 #define ME_DRAWSHARP    (1 << 8)
00190 #define ME_DRAWBWEIGHTS (1 << 9)
00191 
00192 #define ME_DRAWEXTRA_EDGELEN  (1 << 10)
00193 #define ME_DRAWEXTRA_FACEAREA (1 << 11)
00194 #define ME_DRAWEXTRA_FACEANG  (1 << 12)
00195 
00196 /* debug only option */
00197 #define ME_DRAWEXTRA_INDICES (1 << 13)
00198 
00199 /* old global flags:
00200 #define G_DRAWEDGES     (1 << 18)
00201 #define G_DRAWFACES     (1 <<  7)
00202 #define G_DRAWNORMALS   (1 <<  6)
00203 #define G_DRAW_VNORMALS (1 << 14)
00204 
00205 #define G_ALLEDGES      (1 << 11)
00206 #define G_HIDDENEDGES   (1 << 21)
00207 
00208 #define G_DRAWCREASES   (1 << 19)
00209 #define G_DRAWSEAMS     (1 << 20)
00210 #define G_DRAWSHARP     (1 << 28)
00211 #define G_DRAWBWEIGHTS  (1 << 31)
00212 
00213 #define G_DRAW_EDGELEN  (1 << 22) 
00214 #define G_DRAW_FACEAREA (1 << 23)
00215 #define G_DRAW_EDGEANG  (1 << 24)
00216 */
00217 
00218 
00219 
00220 /* Subsurf Type */
00221 #define ME_CC_SUBSURF       0
00222 #define ME_SIMPLE_SUBSURF   1
00223 
00224 #define MESH_MAX_VERTS 2000000000L
00225 
00226 /* this is so we can save bmesh files that load in trunk, ignoring NGons
00227  * will eventually be removed */
00228 
00229 #if 0 /* enable in bmesh branch only for now */
00230 #define USE_BMESH_SAVE_AS_COMPAT
00231 #endif
00232 
00233 
00234 #endif