1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 17 * All rights reserved. 18 */ 19 20 /** \file 21 * \ingroup DNA 22 */ 23 24 #pragma once 25 26 #include "DNA_ID.h" 27 #include "DNA_defs.h" 28 #include "DNA_listBase.h" 29 30 struct AnimData; 31 struct BoundBox; 32 struct Ipo; 33 struct Material; 34 35 typedef struct MetaElem { 36 struct MetaElem *next, *prev; 37 38 /** Bound Box of MetaElem. */ 39 struct BoundBox *bb; 40 41 short type, flag; 42 char _pad[4]; 43 /** Position of center of MetaElem. */ 44 float x, y, z; 45 /** Rotation of MetaElem (MUST be kept normalized). */ 46 float quat[4]; 47 /** Dimension parameters, used for some types like cubes. */ 48 float expx; 49 float expy; 50 float expz; 51 /** Radius of the meta element. */ 52 float rad; 53 /** Temp field, used only while processing. */ 54 float rad2; 55 /** Stiffness, how much of the element to fill. */ 56 float s; 57 /** Old, only used for backwards compat. use dimensions now. */ 58 float len; 59 60 /** Matrix and inverted matrix. */ 61 float *mat, *imat; 62 } MetaElem; 63 64 typedef struct MetaBall { 65 ID id; 66 struct AnimData *adt; 67 68 ListBase elems; 69 ListBase disp; 70 /** Not saved in files, note we use pointer for editmode check. */ 71 ListBase *editelems; 72 /** Old animation system, deprecated for 2.5. */ 73 struct Ipo *ipo DNA_DEPRECATED; 74 75 /* material of the mother ball will define the material used of all others */ 76 struct Material **mat; 77 78 /** Flag is enum for updates, flag2 is bitflags for settings. */ 79 char flag, flag2; 80 short totcol; 81 /** Used to store MB_AUTOSPACE. */ 82 short texflag; 83 char _pad[1]; 84 85 /** 86 * ID data is older than edit-mode data (TODO: move to edit-mode struct). 87 * Set #Main.is_memfile_undo_flush_needed when enabling. 88 */ 89 char needs_flush_to_id; 90 91 /* texture space, copied as one block in editobject.c */ 92 float loc[3]; 93 float size[3]; 94 float rot[3]; 95 96 /** Display and render res. */ 97 float wiresize, rendersize; 98 99 /* bias elements to have an offset volume. 100 * mother ball changes will effect other objects thresholds, 101 * but these may also have their own thresh as an offset */ 102 float thresh; 103 104 /* used in editmode */ 105 /*ListBase edit_elems;*/ 106 MetaElem *lastelem; 107 108 void *batch_cache; 109 } MetaBall; 110 111 /* **************** METABALL ********************* */ 112 113 /* texflag */ 114 #define MB_AUTOSPACE 1 115 116 /* mb->flag */ 117 #define MB_UPDATE_ALWAYS 0 118 #define MB_UPDATE_HALFRES 1 119 #define MB_UPDATE_FAST 2 120 #define MB_UPDATE_NEVER 3 121 122 /* mb->flag2 */ 123 #define MB_DS_EXPAND (1 << 0) 124 125 /* ml->type */ 126 #define MB_BALL 0 127 #define MB_TUBEX 1 /* depercated */ 128 #define MB_TUBEY 2 /* depercated */ 129 #define MB_TUBEZ 3 /* depercated */ 130 #define MB_TUBE 4 131 #define MB_PLANE 5 132 #define MB_ELIPSOID 6 133 #define MB_CUBE 7 134 135 #define MB_TYPE_SIZE_SQUARED(type) (type == MB_ELIPSOID) 136 137 /* ml->flag */ 138 #define MB_NEGATIVE 2 139 #define MB_HIDE 8 140 #define MB_SCALE_RAD 16 141