Blender V2.61 - r43446

DNA_meshdata_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_MESHDATA_TYPES_H
00033 #define DNA_MESHDATA_TYPES_H
00034 
00035 #include "DNA_customdata_types.h"
00036 #include "DNA_listBase.h"
00037 
00038 struct Bone;
00039 struct Image;
00040 
00041 typedef struct MFace {
00042     unsigned int v1, v2, v3, v4;
00043     short mat_nr;
00044     char edcode, flag;  /* we keep edcode, for conversion to edges draw flags in old files */
00045 } MFace;
00046 
00047 typedef struct MEdge {
00048     unsigned int v1, v2;
00049     char crease, bweight;
00050     short flag;
00051 } MEdge;
00052 
00053 typedef struct MDeformWeight {
00054     int             def_nr;
00055     float           weight;
00056 } MDeformWeight;
00057 
00058 typedef struct MDeformVert {
00059     struct MDeformWeight *dw;
00060     int totweight;
00061     int flag;   /* flag only in use for weightpaint now */
00062 } MDeformVert;
00063 
00064 typedef struct MVert {
00065     float   co[3];
00066     short   no[3];
00067     char flag, bweight;
00068 } MVert;
00069 
00070 /* at the moment alpha is abused for vertex painting
00071  * and not used for transperency, note that red and blue are swapped */
00072 typedef struct MCol {
00073     char a, r, g, b;    
00074 } MCol;
00075 
00076 #ifdef USE_BMESH_FORWARD_COMPAT
00077 
00078 /*new face structure, replaces MFace, which is now
00079   only used for storing tesselations.*/
00080 typedef struct MPoly {
00081     /* offset into loop array and number of loops in the face */
00082     int loopstart;
00083     int totloop; /* keep signed since we need to subtract when getting the previous loop */
00084     short mat_nr;
00085     char flag, pad;
00086 } MPoly;
00087 
00088 /*the e here is because we want to move away from
00089   relying on edge hashes.*/
00090 typedef struct MLoop {
00091     unsigned int v; /*vertex index*/
00092     unsigned int e; /*edge index*/
00093 } MLoop;
00094 
00095 #endif /* USE_BMESH_FORWARD_COMPAT */
00096 
00097 /*bmesh custom data stuff*/
00098 typedef struct MTexPoly {
00099     struct Image *tpage;
00100     char flag, transp;
00101     short mode,tile,unwrap;
00102 } MTexPoly;
00103 
00104 typedef struct MLoopUV {
00105     float uv[2];
00106 } MLoopUV;
00107 
00108 typedef struct MLoopCol {
00109     char a, r, g, b;
00110 } MLoopCol;
00111 
00112 typedef struct MSticky {
00113     float co[2];
00114 } MSticky;
00115 
00116 typedef struct MSelect {
00117     int index;
00118     int type; /* EDITVERT/EDITEDGE/EDITFACE */
00119 } MSelect;
00120 
00121 typedef struct MTFace {
00122     float uv[4][2];
00123     struct Image *tpage;
00124     char flag, transp;
00125     short mode, tile, unwrap;
00126 } MTFace;
00127 
00128 /*Custom Data Properties*/
00129 typedef struct MFloatProperty {
00130     float   f;
00131 } MFloatProperty;
00132 typedef struct MIntProperty {
00133     int     i;
00134 } MIntProperty;
00135 typedef struct MStringProperty {
00136     char    s[256];
00137 } MStringProperty;
00138 
00139 typedef struct OrigSpaceFace {
00140     float uv[4][2];
00141 } OrigSpaceFace;
00142 
00143 typedef struct MDisps {
00144     /* Strange bug in SDNA: if disps pointer comes first, it fails to see totdisp */
00145     int totdisp;
00146     char pad[4];
00147     float (*disps)[3];
00148 } MDisps;
00149 
00151 typedef struct MultiresCol {
00152     float a, r, g, b;
00153 } MultiresCol;
00154 typedef struct MultiresColFace {
00155     /* vertex colors */
00156     MultiresCol col[4];
00157 } MultiresColFace;
00158 typedef struct MultiresFace {
00159     unsigned int v[4];
00160     unsigned int mid;
00161     char flag, mat_nr, pad[2];
00162 } MultiresFace;
00163 typedef struct MultiresEdge {
00164     unsigned int v[2];
00165     unsigned int mid;
00166 } MultiresEdge;
00167 
00168 struct MultiresMapNode;
00169 typedef struct MultiresLevel {
00170     struct MultiresLevel *next, *prev;
00171 
00172     MultiresFace *faces;
00173     MultiresColFace *colfaces;
00174     MultiresEdge *edges;
00175 
00176     unsigned int totvert, totface, totedge, pad;
00177 
00178     /* Kept for compatibility with even older files */
00179     MVert *verts;
00180 } MultiresLevel;
00181 
00182 typedef struct Multires {
00183     ListBase levels;
00184     MVert *verts;
00185 
00186     unsigned char level_count, current, newlvl, edgelvl, pinlvl, renderlvl;
00187     unsigned char use_col, flag;
00188 
00189     /* Special level 1 data that cannot be modified from other levels */
00190     CustomData vdata;
00191     CustomData fdata;
00192     short *edge_flags;
00193     char *edge_creases;
00194 } Multires;
00195 
00198 typedef struct MRecast {
00199     int     i;
00200 } MRecast;
00201 
00202 /* mvert->flag (1=SELECT) */
00203 #define ME_SPHERETEST       2
00204 #define ME_VERT_TMP_TAG     4
00205 #define ME_HIDE             16
00206 #define ME_VERT_MERGED      (1<<6)
00207 #define ME_VERT_PBVH_UPDATE (1<<7)
00208 
00209 /* medge->flag (1=SELECT)*/
00210 #define ME_EDGEDRAW         (1<<1)
00211 #define ME_SEAM             (1<<2)
00212 #define ME_FGON             (1<<3)
00213                         /* reserve 16 for ME_HIDE */
00214 #define ME_EDGERENDER       (1<<5)
00215 #define ME_LOOSEEDGE        (1<<7)
00216 /* #define ME_SEAM_LAST     (1<<8) */ /* UNUSED */
00217 #define ME_SHARP            (1<<9)    /* only reason this flag remains a 'short' */
00218 
00219 /* puno = vertexnormal (mface) */
00220 #define ME_PROJXY       16
00221 #define ME_PROJXZ       32
00222 #define ME_PROJYZ       64
00223 
00224 /* edcode (mface) */
00225 #define ME_V1V2         1
00226 #define ME_V2V3         2
00227 #define ME_V3V1         4
00228 #define ME_V3V4         4
00229 #define ME_V4V1         8
00230 
00231 /* flag (mface) */
00232 #define ME_SMOOTH           1
00233 #define ME_FACE_SEL         2
00234                         /* flag ME_HIDE==16 is used here too */ 
00235 /* mtface->flag */
00236 #define TF_SELECT   1 /* use MFace hide flag (after 2.43), should be able to reuse after 2.44 */
00237 #define TF_ACTIVE   2 /* deprecated! */
00238 #define TF_SEL1     4
00239 #define TF_SEL2     8
00240 #define TF_SEL3     16
00241 #define TF_SEL4     32
00242 #define TF_HIDE     64 /* unused, same as TF_SELECT */
00243 
00244 /* mtface->mode */
00245 #define TF_DYNAMIC      1
00246 #define TF_ALPHASORT    2
00247 #define TF_TEX          4
00248 #define TF_SHAREDVERT   8
00249 #define TF_LIGHT        16
00250 
00251 #define TF_CONVERTED 32 /* tface converted to material */
00252 
00253 #define TF_SHAREDCOL    64
00254 #define TF_TILES        128     /* deprecated */
00255 #define TF_BILLBOARD    256
00256 #define TF_TWOSIDE      512
00257 #define TF_INVISIBLE    1024
00258 
00259 #define TF_OBCOL        2048
00260 #define TF_BILLBOARD2   4096    /* with Z axis constraint */
00261 #define TF_SHADOW       8192
00262 #define TF_BMFONT       16384
00263 
00264 /* mtface->transp, values 1-4 are used as flags in the GL, WARNING, TF_SUB cant work with this */
00265 #define TF_SOLID    0
00266 #define TF_ADD      1
00267 #define TF_ALPHA    2
00268 #define TF_CLIP     4 /* clipmap alpha/binary alpha all or nothing! */
00269 
00270 /* sub is not available in the user interface anymore */
00271 #define TF_SUB      3
00272 
00273 
00274 /* mtface->unwrap */
00275 #define TF_DEPRECATED1  1
00276 #define TF_DEPRECATED2  2
00277 #define TF_DEPRECATED3  4
00278 #define TF_DEPRECATED4  8
00279 #define TF_PIN1         16
00280 #define TF_PIN2         32
00281 #define TF_PIN3         64
00282 #define TF_PIN4         128
00283 
00284 #endif