Blender  V2.59
BKE_bmeshCustomData.h
Go to the documentation of this file.
00001 /*
00002  * $Id: BKE_bmeshCustomData.h 34962 2011-02-18 13:05:18Z jesterking $
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. The Blender
00010  * Foundation also sells licenses for use in proprietary software under
00011  * the Blender License.  See http://www.blender.org/BL/ for information
00012  * about this.  
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software Foundation,
00021  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00022  *
00023  * The Original Code is Copyright (C) 2004 Blender Foundation.
00024  * All rights reserved.
00025  *
00026  * The Original Code is: all of this file.
00027  *
00028  * Contributor(s): Geoffrey Bantle.
00029  *
00030  * ***** END GPL LICENSE BLOCK *****
00031  */
00032 
00033 
00034 #ifndef BKE_BMESHCUSTOMDATA_H
00035 #define BKE_BMESHCUSTOMDATA_H
00036 
00043 struct BLI_mempool;
00044 
00045 /*Custom Data Types and defines
00046         Eventual plan is to move almost everything to custom data and let caller
00047         decide when making the mesh what layers they want to store in the mesh
00048 
00049         This stuff should probably go in a seperate file....
00050 */
00051 
00052 #define BME_CD_FACETEX          0               /*Image texture/texface*/
00053 #define BME_CD_LOOPTEX          1               /*UV coordinates*/
00054 #define BME_CD_LOOPCOL          2               /*Vcolors*/
00055 #define BME_CD_DEFORMVERT       3               /*Vertex Group/Weights*/
00056 #define BME_CD_NUMTYPES         4
00057 
00058 typedef struct BME_CustomDataLayer {
00059         int type;                                       /* type of data in layer */
00060         int offset;                                     /* offset of layer in block */
00061         int active;                                     /* offset of active layer*/
00062         char name[32];                                  /* layer name */
00063 } BME_CustomDataLayer;
00064 
00065 typedef struct BME_CustomData {
00066         struct BME_CustomDataLayer *layers;     /*Custom Data Layers*/
00067         struct BLI_mempool *pool;                               /*pool for alloc of blocks*/
00068         int totlayer, totsize;          /*total layers and total size in bytes of each block*/
00069 } BME_CustomData;
00070 
00071 typedef struct BME_CustomDataInit{
00072         int layout[BME_CD_NUMTYPES];
00073         int active[BME_CD_NUMTYPES];
00074         int totlayers;
00075         char *nametemplate;
00076 } BME_CustomDataInit;
00077 
00078 /*Custom data types*/
00079 typedef struct BME_DeformWeight {
00080         int                             def_nr;
00081         float                   weight;
00082 } BME_DeformWeight;
00083 
00084 typedef struct BME_DeformVert {
00085         struct BME_DeformWeight *dw;
00086         int totweight;
00087 } BME_DeformVert;
00088 
00089 typedef struct BME_facetex{
00090         struct Image *tpage;
00091         char flag, transp;
00092         short mode, tile, unwrap;
00093 }BME_facetex;
00094 
00095 typedef struct BME_looptex{
00096         float u, v;
00097 }BME_looptex;
00098 
00099 typedef struct BME_loopcol{
00100         char r, g, b, a;
00101 }BME_loopcol;
00102 
00103 /*CUSTOM DATA API*/
00104 void BME_CD_Create(struct BME_CustomData *data, struct BME_CustomDataInit *init, int initalloc);
00105 void BME_CD_Free(struct BME_CustomData *data);
00106 void BME_CD_free_block(struct BME_CustomData *data, void **block);
00107 void BME_CD_copy_data(const struct BME_CustomData *source, struct BME_CustomData *dest, void *src_block, void **dest_block);
00108 void BME_CD_set_default(struct BME_CustomData *data, void **block);
00109 
00110 #endif