Blender  V2.59
DNA_meshdata_types.h
Go to the documentation of this file.
00001 /*
00002  * $Id: DNA_meshdata_types.h 38866 2011-07-31 02:24:06Z nicholasbishop $ 
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 #ifndef DNA_MESHDATA_TYPES_H
00030 #define DNA_MESHDATA_TYPES_H
00031 
00036 #include "DNA_customdata_types.h"
00037 #include "DNA_listBase.h"
00038 
00039 struct Bone;
00040 struct Image;
00041 
00042 typedef struct MFace {
00043         unsigned int v1, v2, v3, v4;
00044         short mat_nr;
00045         char edcode, flag;      /* we keep edcode, for conversion to edges draw flags in old files */
00046 } MFace;
00047 
00048 typedef struct MEdge {
00049         unsigned int v1, v2;
00050         char crease, bweight;
00051         short flag;
00052 } MEdge;
00053 
00054 typedef struct MDeformWeight {
00055         int                             def_nr;
00056         float                   weight;
00057 } MDeformWeight;
00058 
00059 typedef struct MDeformVert {
00060         struct MDeformWeight *dw;
00061         int totweight;
00062         int flag;       /* flag only in use for weightpaint now */
00063 } MDeformVert;
00064 
00065 typedef struct MVert {
00066         float   co[3];
00067         short   no[3];
00068         char flag, bweight;
00069 } MVert;
00070 
00071 /* at the moment alpha is abused for vertex painting
00072  * and not used for transperency, note that red and blue are swapped */
00073 typedef struct MCol {
00074         char a, r, g, b;        
00075 } MCol;
00076 
00077 /*bmesh custom data stuff*/
00078 typedef struct MTexPoly{
00079         struct Image *tpage;
00080         char flag, transp;
00081         short mode,tile,unwrap;
00082 }MTexPoly;
00083 
00084 typedef struct MLoopUV{
00085         float uv[2];
00086 }MLoopUV;
00087 
00088 typedef struct MLoopCol{
00089         char a, r, g, b;
00090         int pad;  /*waste!*/
00091 }MLoopCol;
00092 
00093 typedef struct MSticky {
00094         float co[2];
00095 } MSticky;
00096 
00097 typedef struct MSelect {
00098         int index;
00099         int type;
00100 } MSelect;
00101 
00102 typedef struct MTFace {
00103         float uv[4][2];
00104         struct Image *tpage;
00105         char flag, transp;
00106         short mode, tile, unwrap;
00107 } MTFace;
00108 
00109 /*Custom Data Properties*/
00110 typedef struct MFloatProperty{
00111         float   f;
00112 } MFloatProperty;
00113 typedef struct MIntProperty{
00114         int             i;
00115 } MIntProperty;
00116 typedef struct MStringProperty{
00117         char    s[256];
00118 } MStringProperty;
00119 
00120 typedef struct OrigSpaceFace {
00121         float uv[4][2];
00122 } OrigSpaceFace;
00123 
00124 typedef struct MDisps {
00125         /* Strange bug in SDNA: if disps pointer comes first, it fails to see totdisp */
00126         int totdisp;
00127         char pad[4];
00128         float (*disps)[3];
00129 } MDisps;
00130 
00132 typedef struct MultiresCol {
00133         float a, r, g, b;
00134 } MultiresCol;
00135 typedef struct MultiresColFace {
00136         /* vertex colors */
00137         MultiresCol col[4];
00138 } MultiresColFace;
00139 typedef struct MultiresFace {
00140         unsigned int v[4];
00141         unsigned int mid;
00142         char flag, mat_nr, pad[2];
00143 } MultiresFace;
00144 typedef struct MultiresEdge {
00145         unsigned int v[2];
00146         unsigned int mid;
00147 } MultiresEdge;
00148 
00149 struct MultiresMapNode;
00150 typedef struct MultiresLevel {
00151         struct MultiresLevel *next, *prev;
00152 
00153         MultiresFace *faces;
00154         MultiresColFace *colfaces;
00155         MultiresEdge *edges;
00156 
00157         unsigned int totvert, totface, totedge, pad;
00158 
00159         /* Kept for compatibility with even older files */
00160         MVert *verts;
00161 } MultiresLevel;
00162 
00163 typedef struct Multires {
00164         ListBase levels;
00165         MVert *verts;
00166 
00167         unsigned char level_count, current, newlvl, edgelvl, pinlvl, renderlvl;
00168         unsigned char use_col, flag;
00169 
00170         /* Special level 1 data that cannot be modified from other levels */
00171         CustomData vdata;
00172         CustomData fdata;
00173         short *edge_flags;
00174         char *edge_creases;
00175 } Multires;
00176 
00179 typedef struct PartialVisibility {
00180         unsigned int *vert_map; /* vert_map[Old Index]= New Index */
00181         int *edge_map; /* edge_map[Old Index]= New Index, -1= hidden */
00182         MFace *old_faces;
00183         MEdge *old_edges;
00184         unsigned int totface, totedge, totvert, pad;
00185 } PartialVisibility;
00186 
00187 /* mvert->flag (1=SELECT) */
00188 #define ME_SPHERETEST           2
00189 #define ME_VERT_TMP_TAG         4
00190 #define ME_HIDE                         16
00191 #define ME_VERT_MERGED          (1<<6)
00192 #define ME_VERT_PBVH_UPDATE     (1<<7)
00193 
00194 /* medge->flag (1=SELECT)*/
00195 #define ME_EDGEDRAW                     (1<<1)
00196 #define ME_SEAM                         (1<<2)
00197 #define ME_FGON                         (1<<3)
00198                                                 /* reserve 16 for ME_HIDE */
00199 #define ME_EDGERENDER           (1<<5)
00200 #define ME_LOOSEEDGE            (1<<7)
00201 #define ME_SEAM_LAST            (1<<8)
00202 #define ME_SHARP                        (1<<9)
00203 
00204 /* puno = vertexnormal (mface) */
00205 /* render assumes flips to be ordered like this */
00206 #define ME_FLIPV1               1
00207 #define ME_FLIPV2               2
00208 #define ME_FLIPV3               4
00209 #define ME_FLIPV4               8
00210 #define ME_PROJXY               16
00211 #define ME_PROJXZ               32
00212 #define ME_PROJYZ               64
00213 
00214 /* edcode (mface) */
00215 #define ME_V1V2                 1
00216 #define ME_V2V3                 2
00217 #define ME_V3V1                 4
00218 #define ME_V3V4                 4
00219 #define ME_V4V1                 8
00220 
00221 /* flag (mface) */
00222 #define ME_SMOOTH                       1
00223 #define ME_FACE_SEL                     2
00224                                                 /* flag ME_HIDE==16 is used here too */ 
00225 /* mselect->type */
00226 #define ME_VSEl 0
00227 #define ME_ESEl 1
00228 #define ME_FSEL 2
00229 
00230 /* mtface->flag */
00231 #define TF_SELECT       1 /* use MFace hide flag (after 2.43), should be able to reuse after 2.44 */
00232 #define TF_ACTIVE       2 /* deprecated! */
00233 #define TF_SEL1         4
00234 #define TF_SEL2         8
00235 #define TF_SEL3         16
00236 #define TF_SEL4         32
00237 #define TF_HIDE         64 /* unused, same as TF_SELECT */
00238 
00239 /* mtface->mode */
00240 #define TF_DYNAMIC              1
00241 #define TF_ALPHASORT    2
00242 #define TF_TEX                  4
00243 #define TF_SHAREDVERT   8
00244 #define TF_LIGHT                16
00245 
00246 #define TF_SHAREDCOL    64
00247 #define TF_TILES                128             /* deprecated */
00248 #define TF_BILLBOARD    256
00249 #define TF_TWOSIDE              512
00250 #define TF_INVISIBLE    1024
00251 
00252 #define TF_OBCOL                2048
00253 #define TF_BILLBOARD2   4096    /* with Z axis constraint */
00254 #define TF_SHADOW               8192
00255 #define TF_BMFONT               16384
00256 
00257 /* mtface->transp, values 1-4 are used as flags in the GL, WARNING, TF_SUB cant work with this */
00258 #define TF_SOLID        0
00259 #define TF_ADD          1
00260 #define TF_ALPHA        2
00261 #define TF_CLIP         4 /* clipmap alpha/binary alpha all or nothing! */
00262 
00263 /* sub is not available in the user interface anymore */
00264 #define TF_SUB          3
00265 
00266 
00267 /* mtface->unwrap */
00268 #define TF_DEPRECATED1  1
00269 #define TF_DEPRECATED2  2
00270 #define TF_DEPRECATED3  4
00271 #define TF_DEPRECATED4  8
00272 #define TF_PIN1             16
00273 #define TF_PIN2             32
00274 #define TF_PIN3                 64
00275 #define TF_PIN4         128
00276 
00277 #endif