Blender V2.61 - r43446

BKE_bmeshCustomData.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) 2004 Blender Foundation.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): Geoffrey Bantle.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00028 
00029 #ifndef BKE_BMESHCUSTOMDATA_H
00030 #define BKE_BMESHCUSTOMDATA_H
00031 
00038 struct BLI_mempool;
00039 
00040 /*Custom Data Types and defines
00041     Eventual plan is to move almost everything to custom data and let caller
00042     decide when making the mesh what layers they want to store in the mesh
00043 
00044     This stuff should probably go in a seperate file....
00045 */
00046 
00047 #define BME_CD_FACETEX      0       /*Image texture/texface*/
00048 #define BME_CD_LOOPTEX      1       /*UV coordinates*/
00049 #define BME_CD_LOOPCOL      2       /*Vcolors*/
00050 #define BME_CD_DEFORMVERT   3       /*Vertex Group/Weights*/
00051 #define BME_CD_NUMTYPES     4
00052 
00053 typedef struct BME_CustomDataLayer {
00054     int type;                       /* type of data in layer */
00055     int offset;                     /* offset of layer in block */
00056     int active;                     /* offset of active layer*/
00057     char name[32];                  /* layer name */
00058 } BME_CustomDataLayer;
00059 
00060 typedef struct BME_CustomData {
00061     struct BME_CustomDataLayer *layers; /*Custom Data Layers*/
00062     struct BLI_mempool *pool;               /*pool for alloc of blocks*/
00063     int totlayer, totsize;          /*total layers and total size in bytes of each block*/
00064 } BME_CustomData;
00065 
00066 typedef struct BME_CustomDataInit{
00067     int layout[BME_CD_NUMTYPES];
00068     int active[BME_CD_NUMTYPES];
00069     int totlayers;
00070     char *nametemplate;
00071 } BME_CustomDataInit;
00072 
00073 /*Custom data types*/
00074 typedef struct BME_DeformWeight {
00075     int             def_nr;
00076     float           weight;
00077 } BME_DeformWeight;
00078 
00079 typedef struct BME_DeformVert {
00080     struct BME_DeformWeight *dw;
00081     int totweight;
00082 } BME_DeformVert;
00083 
00084 typedef struct BME_facetex{
00085     struct Image *tpage;
00086     char flag, transp;
00087     short mode, tile, unwrap;
00088 }BME_facetex;
00089 
00090 typedef struct BME_looptex{
00091     float u, v;
00092 }BME_looptex;
00093 
00094 typedef struct BME_loopcol{
00095     char r, g, b, a;
00096 }BME_loopcol;
00097 
00098 /*CUSTOM DATA API*/
00099 void BME_CD_Create(struct BME_CustomData *data, struct BME_CustomDataInit *init, int initalloc);
00100 void BME_CD_Free(struct BME_CustomData *data);
00101 void BME_CD_free_block(struct BME_CustomData *data, void **block);
00102 void BME_CD_copy_data(const struct BME_CustomData *source, struct BME_CustomData *dest, void *src_block, void **dest_block);
00103 void BME_CD_set_default(struct BME_CustomData *data, void **block);
00104 
00105 #endif