|
Blender
V2.59
|
00001 /* 00002 * $Id: DNA_particle_types.h 38413 2011-07-15 13:32:02Z jhk $ 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) 2007 by Janne Karhu. 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 00030 #ifndef DNA_PARTICLE_TYPES_H 00031 #define DNA_PARTICLE_TYPES_H 00032 00037 #include "DNA_ID.h" 00038 #include "DNA_boid_types.h" 00039 00040 struct AnimData; 00041 00042 typedef struct HairKey { 00043 float co[3]; /* location of hair vertex */ 00044 float time; /* time along hair, default 0-100 */ 00045 float weight; /* softbody weight */ 00046 short editflag; /* saved particled edit mode flags */ 00047 short pad; 00048 } HairKey; 00049 00050 typedef struct ParticleKey { /* when changed update size of struct to copy_particleKey()!! */ 00051 float co[3]; /* location */ 00052 float vel[3]; /* velocity */ 00053 float rot[4]; /* rotation quaternion */ 00054 float ave[3]; /* angular velocity */ 00055 float time; /* when this key happens */ 00056 } ParticleKey; 00057 00058 typedef struct BoidParticle { 00059 struct Object *ground; 00060 struct BoidData data; 00061 float gravity[3]; 00062 float wander[3]; 00063 float rt; 00064 } BoidParticle; 00065 00066 typedef struct ParticleSpring { 00067 float rest_length; 00068 unsigned int particle_index[2], delete_flag; 00069 }ParticleSpring; 00070 00071 /* Child particles are created around or between parent particles */ 00072 typedef struct ChildParticle { 00073 int num, parent; /* num is face index on the final derived mesh */ 00074 int pa[4]; /* nearest particles to the child, used for the interpolation */ 00075 float w[4]; /* interpolation weights for the above particles */ 00076 float fuv[4], foffset; /* face vertex weights and offset */ 00077 float rt; 00078 } ChildParticle; 00079 00080 typedef struct ParticleTarget { 00081 struct ParticleTarget *next, *prev; 00082 struct Object *ob; 00083 int psys; 00084 short flag, mode; 00085 float time, duration; 00086 } ParticleTarget; 00087 00088 typedef struct ParticleDupliWeight { 00089 struct ParticleDupliWeight *next, *prev; 00090 struct Object *ob; 00091 short count; 00092 short flag; 00093 short index, rt; /* only updated on file save and used on file load */ 00094 } ParticleDupliWeight; 00095 00096 typedef struct ParticleData { 00097 ParticleKey state; /* current global coordinates */ 00098 00099 ParticleKey prev_state; /* previous state */ 00100 00101 HairKey *hair; /* hair vertices */ 00102 00103 ParticleKey *keys; /* keyed keys */ 00104 00105 BoidParticle *boid; /* boids data */ 00106 00107 int totkey; /* amount of hair or keyed keys*/ 00108 00109 float time, lifetime; /* dietime is not nescessarily time+lifetime as */ 00110 float dietime; /* particles can die unnaturally (collision) */ 00111 00112 int num; /* index to vert/edge/face */ 00113 int num_dmcache; /* index to derived mesh data (face) to avoid slow lookups */ 00114 00115 float fuv[4], foffset; /* coordinates on face/edge number "num" and depth along*/ 00116 /* face normal for volume emission */ 00117 00118 float size; /* size and multiplier so that we can update size when ever */ 00119 00120 int hair_index; 00121 short flag; 00122 short alive; /* the life state of a particle */ 00123 } ParticleData; 00124 00125 typedef struct SPHFluidSettings { 00126 /*Particle Fluid*/ 00127 float radius, spring_k, rest_length; 00128 float plasticity_constant, yield_ratio; 00129 float plasticity_balance, yield_balance; 00130 float viscosity_omega, viscosity_beta; 00131 float stiffness_k, stiffness_knear, rest_density; 00132 float buoyancy; 00133 int flag, spring_frames; 00134 } SPHFluidSettings; 00135 00136 /* fluid->flag */ 00137 #define SPH_VISCOELASTIC_SPRINGS 1 00138 #define SPH_CURRENT_REST_LENGTH 2 00139 #define SPH_FAC_REPULSION 4 00140 #define SPH_FAC_DENSITY 8 00141 #define SPH_FAC_RADIUS 16 00142 #define SPH_FAC_VISCOSITY 32 00143 #define SPH_FAC_REST_LENGTH 64 00144 00145 typedef struct ParticleSettings { 00146 ID id; 00147 struct AnimData *adt; 00148 00149 struct BoidSettings *boids; 00150 struct SPHFluidSettings *fluid; 00151 00152 struct EffectorWeights *effector_weights; 00153 00154 int flag, rt; 00155 short type, from, distr, texact; 00156 /* physics modes */ 00157 short phystype, rotmode, avemode, reactevent; 00158 short draw, draw_as, draw_size, childtype; 00159 short ren_as, subframes, draw_col; 00160 /* number of path segments, power of 2 except */ 00161 short draw_step, ren_step; 00162 short hair_step, keys_step; 00163 00164 /* adaptive path rendering */ 00165 short adapt_angle, adapt_pix; 00166 00167 short disp, omat, interpolation, rotfrom, integrator; 00168 short kink, kink_axis; 00169 00170 /* billboards */ 00171 short bb_align, bb_uv_split, bb_anim, bb_split_offset; 00172 float bb_tilt, bb_rand_tilt, bb_offset[2], bb_size[2], bb_vel_head, bb_vel_tail; 00173 00174 /* draw color */ 00175 float color_vec_max; 00176 00177 /* simplification */ 00178 short simplify_flag, simplify_refsize; 00179 float simplify_rate, simplify_transition; 00180 float simplify_viewport; 00181 00182 /* general values */ 00183 float sta, end, lifetime, randlife; 00184 float timetweak, jitfac, eff_hair, grid_rand; 00185 int totpart, userjit, grid_res, effector_amount; 00186 00187 /* initial velocity factors */ 00188 float normfac, obfac, randfac, partfac, tanfac, tanphase, reactfac; 00189 float ob_vel[3]; 00190 float avefac, phasefac, randrotfac, randphasefac; 00191 /* physical properties */ 00192 float mass, size, randsize; 00193 /* global physical properties */ 00194 float acc[3], dragfac, brownfac, dampfac; 00195 /* length */ 00196 float randlength; 00197 /* children */ 00198 int child_nbr, ren_child_nbr; 00199 float parents, childsize, childrandsize; 00200 float childrad, childflat; 00201 /* clumping */ 00202 float clumpfac, clumppow; 00203 /* kink */ 00204 float kink_amp, kink_freq, kink_shape, kink_flat; 00205 float kink_amp_clump; 00206 /* rough */ 00207 float rough1, rough1_size; 00208 float rough2, rough2_size, rough2_thres; 00209 float rough_end, rough_end_shape; 00210 /* length */ 00211 float clength, clength_thres; 00212 /* parting */ 00213 float parting_fac; 00214 float parting_min, parting_max; 00215 /* branching */ 00216 float branch_thres; 00217 /* drawing stuff */ 00218 float draw_line[2]; 00219 float path_start, path_end; 00220 int trail_count; 00221 /* keyed particles */ 00222 int keyed_loops; 00223 00224 struct MTex *mtex[18]; /* MAX_MTEX */ 00225 00226 struct Group *dup_group; 00227 struct ListBase dupliweights; 00228 struct Group *eff_group; // deprecated 00229 struct Object *dup_ob; 00230 struct Object *bb_ob; 00231 struct Ipo *ipo; // xxx depreceated... old animation system 00232 struct PartDeflect *pd; 00233 struct PartDeflect *pd2; 00234 } ParticleSettings; 00235 00236 typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in copy_particlesystem */ 00237 struct ParticleSystem *next, *prev; 00238 00239 ParticleSettings *part; /* particle settings */ 00240 00241 ParticleData *particles; /* (parent) particles */ 00242 ChildParticle *child; /* child particles */ 00243 00244 struct PTCacheEdit *edit; /* particle editmode (runtime) */ 00245 void (*free_edit)(struct PTCacheEdit *edit); /* free callback */ 00246 00247 struct ParticleCacheKey **pathcache; /* path cache (runtime) */ 00248 struct ParticleCacheKey **childcache; /* child cache (runtime) */ 00249 ListBase pathcachebufs, childcachebufs; /* buffers for the above */ 00250 00251 struct ClothModifierData *clmd; /* cloth simulation for hair */ 00252 struct DerivedMesh *hair_in_dm, *hair_out_dm; /* input/output for cloth simulation */ 00253 00254 struct Object *target_ob; 00255 struct Object *lattice; 00256 struct Object *parent; /* particles from global space -> parent space */ 00257 00258 struct ListBase targets; /* used for keyed and boid physics */ 00259 00260 char name[32]; /* particle system name */ 00261 00262 float imat[4][4]; /* used for duplicators */ 00263 float cfra, tree_frame, bvhtree_frame; 00264 int seed, child_seed; 00265 int flag, totpart, totunexist, totchild, totcached, totchildcache; 00266 short recalc, target_psys, totkeyed, bakespace; 00267 00268 char bb_uvname[3][32]; /* billboard uv name */ 00269 00270 /* if you change these remember to update array lengths to PSYS_TOT_VG! */ 00271 short vgroup[12], vg_neg, rt3; /* vertex groups, 0==disable, 1==starting index */ 00272 00273 /* temporary storage during render */ 00274 void *renderdata; 00275 00276 /* point cache */ 00277 struct PointCache *pointcache; 00278 struct ListBase ptcaches; 00279 00280 struct ListBase *effectors; 00281 00282 ParticleSpring *fluid_springs; 00283 int tot_fluidsprings, alloc_fluidsprings; 00284 00285 struct KDTree *tree; /* used for interactions with self and other systems */ 00286 struct BVHTree *bvhtree; /* used for interactions with self and other systems */ 00287 00288 struct ParticleDrawData *pdd; 00289 00290 float *frand; /* array of 1024 random floats for fast lookups */ 00291 }ParticleSystem; 00292 00293 /* part->type */ 00294 /* hair is allways baked static in object/geometry space */ 00295 /* other types (normal particles) are in global space and not static baked */ 00296 #define PART_EMITTER 0 00297 //#define PART_REACTOR 1 00298 #define PART_HAIR 2 00299 #define PART_FLUID 3 00300 00301 /* part->flag */ 00302 #define PART_REACT_STA_END 1 00303 #define PART_REACT_MULTIPLE 2 00304 00305 //#define PART_LOOP 4 /* not used anymore */ 00306 /* for dopesheet */ 00307 #define PART_DS_EXPAND 8 00308 00309 #define PART_HAIR_REGROW 16 /* regrow hair for each frame */ 00310 00311 #define PART_UNBORN 32 /*show unborn particles*/ 00312 #define PART_DIED 64 /*show died particles*/ 00313 00314 #define PART_TRAND 128 00315 #define PART_EDISTR 256 /* particle/face from face areas */ 00316 00317 //#define PART_STICKY 512 /*collided particles can stick to collider*/ 00318 #define PART_DIE_ON_COL (1<<12) 00319 #define PART_SIZE_DEFL (1<<13) /* swept sphere deflections */ 00320 #define PART_ROT_DYN (1<<14) /* dynamic rotation */ 00321 #define PART_SIZEMASS (1<<16) 00322 00323 #define PART_HIDE_ADVANCED_HAIR (1<<15) 00324 00325 //#define PART_ABS_TIME (1<<17) 00326 //#define PART_GLOB_TIME (1<<18) 00327 00328 #define PART_BOIDS_2D (1<<19) 00329 00330 //#define PART_BRANCHING (1<<20) 00331 //#define PART_ANIM_BRANCHING (1<<21) 00332 00333 #define PART_HAIR_BSPLINE 1024 00334 00335 #define PART_GRID_HEXAGONAL (1<<24) 00336 #define PART_GRID_INVERT (1<<26) 00337 00338 #define PART_CHILD_EFFECT (1<<27) 00339 #define PART_CHILD_LONG_HAIR (1<<28) 00340 /* #define PART_CHILD_RENDER (1<<29) */ /*UNUSED*/ 00341 #define PART_CHILD_GUIDE (1<<30) 00342 00343 #define PART_SELF_EFFECT (1<<22) 00344 00345 /* part->rotfrom */ 00346 #define PART_ROT_KEYS 0 /* interpolate directly from keys */ 00347 #define PART_ROT_ZINCR 1 /* same as zdir but done incrementally from previous position */ 00348 #define PART_ROT_IINCR 2 /* same as idir but done incrementally from previous position */ 00349 00350 /* part->from */ 00351 #define PART_FROM_VERT 0 00352 #define PART_FROM_FACE 1 00353 #define PART_FROM_VOLUME 2 00354 /* #define PART_FROM_PARTICLE 3 deprecated! */ 00355 #define PART_FROM_CHILD 4 00356 00357 /* part->distr */ 00358 #define PART_DISTR_JIT 0 00359 #define PART_DISTR_RAND 1 00360 #define PART_DISTR_GRID 2 00361 00362 /* part->phystype */ 00363 #define PART_PHYS_NO 0 00364 #define PART_PHYS_NEWTON 1 00365 #define PART_PHYS_KEYED 2 00366 #define PART_PHYS_BOIDS 3 00367 #define PART_PHYS_FLUID 4 00368 00369 /* part->kink */ 00370 #define PART_KINK_NO 0 00371 #define PART_KINK_CURL 1 00372 #define PART_KINK_RADIAL 2 00373 #define PART_KINK_WAVE 3 00374 #define PART_KINK_BRAID 4 00375 00376 /* part->draw */ 00377 #define PART_DRAW_VEL 1 00378 #define PART_DRAW_GLOBAL_OB 2 00379 #define PART_DRAW_SIZE 4 00380 #define PART_DRAW_EMITTER 8 /* render emitter also */ 00381 #define PART_DRAW_HEALTH 16 00382 #define PART_ABS_PATH_TIME 32 00383 #define PART_DRAW_COUNT_GR 64 00384 #define PART_DRAW_BB_LOCK 128 00385 #define PART_DRAW_PARENT 256 00386 #define PART_DRAW_NUM 512 00387 #define PART_DRAW_RAND_GR 1024 00388 #define PART_DRAW_REN_ADAPT 2048 00389 #define PART_DRAW_VEL_LENGTH (1<<12) 00390 #define PART_DRAW_MAT_COL (1<<13) /* deprecated, but used in do_versions */ 00391 #define PART_DRAW_WHOLE_GR (1<<14) 00392 #define PART_DRAW_REN_STRAND (1<<15) 00393 00394 /* part->draw_col */ 00395 #define PART_DRAW_COL_NONE 0 00396 #define PART_DRAW_COL_MAT 1 00397 #define PART_DRAW_COL_VEL 2 00398 #define PART_DRAW_COL_ACC 3 00399 00400 00401 /* part->simplify_flag */ 00402 #define PART_SIMPLIFY_ENABLE 1 00403 #define PART_SIMPLIFY_VIEWPORT 2 00404 00405 /* part->bb_align */ 00406 #define PART_BB_X 0 00407 #define PART_BB_Y 1 00408 #define PART_BB_Z 2 00409 #define PART_BB_VIEW 3 00410 #define PART_BB_VEL 4 00411 00412 /* part->bb_anim */ 00413 #define PART_BB_ANIM_NONE 0 00414 #define PART_BB_ANIM_AGE 1 00415 #define PART_BB_ANIM_ANGLE 2 00416 #define PART_BB_ANIM_FRAME 3 00417 00418 /* part->bb_split_offset */ 00419 #define PART_BB_OFF_NONE 0 00420 #define PART_BB_OFF_LINEAR 1 00421 #define PART_BB_OFF_RANDOM 2 00422 00423 /* part->draw_as */ 00424 /* part->ren_as*/ 00425 #define PART_DRAW_NOT 0 00426 #define PART_DRAW_DOT 1 00427 #define PART_DRAW_HALO 1 00428 #define PART_DRAW_CIRC 2 00429 #define PART_DRAW_CROSS 3 00430 #define PART_DRAW_AXIS 4 00431 #define PART_DRAW_LINE 5 00432 #define PART_DRAW_PATH 6 00433 #define PART_DRAW_OB 7 00434 #define PART_DRAW_GR 8 00435 #define PART_DRAW_BB 9 00436 #define PART_DRAW_REND 10 00437 00438 /* part->integrator */ 00439 #define PART_INT_EULER 0 00440 #define PART_INT_MIDPOINT 1 00441 #define PART_INT_RK4 2 00442 #define PART_INT_VERLET 3 00443 00444 /* part->rotmode */ 00445 #define PART_ROT_NOR 1 00446 #define PART_ROT_VEL 2 00447 #define PART_ROT_GLOB_X 3 00448 #define PART_ROT_GLOB_Y 4 00449 #define PART_ROT_GLOB_Z 5 00450 #define PART_ROT_OB_X 6 00451 #define PART_ROT_OB_Y 7 00452 #define PART_ROT_OB_Z 8 00453 00454 /* part->avemode */ 00455 #define PART_AVE_SPIN 1 00456 #define PART_AVE_RAND 2 00457 00458 /* part->reactevent */ 00459 #define PART_EVENT_DEATH 0 00460 #define PART_EVENT_COLLIDE 1 00461 #define PART_EVENT_NEAR 2 00462 00463 /* part->childtype */ 00464 #define PART_CHILD_PARTICLES 1 00465 #define PART_CHILD_FACES 2 00466 00467 /* psys->recalc */ 00468 /* starts from 8 so that the first bits can be ob->recalc */ 00469 #define PSYS_RECALC_REDO 8 /* only do pathcache etc */ 00470 #define PSYS_RECALC_RESET 16 /* reset everything including pointcache */ 00471 #define PSYS_RECALC_TYPE 32 /* handle system type change */ 00472 #define PSYS_RECALC_CHILD 64 /* only child settings changed */ 00473 #define PSYS_RECALC_PHYS 128 /* physics type changed */ 00474 #define PSYS_RECALC 248 00475 00476 /* psys->flag */ 00477 #define PSYS_CURRENT 1 00478 #define PSYS_GLOBAL_HAIR 2 00479 #define PSYS_HAIR_DYNAMICS 4 00480 #define PSYS_KEYED_TIMING 8 00481 #define PSYS_ENABLED 16 /* deprecated */ 00482 #define PSYS_HAIR_UPDATED 32 /* signal for updating hair particle mode */ 00483 #define PSYS_DRAWING 64 00484 #define PSYS_USE_IMAT 128 00485 #define PSYS_DELETE 256 /* remove particlesystem as soon as possible */ 00486 #define PSYS_HAIR_DONE 512 00487 #define PSYS_KEYED 1024 00488 #define PSYS_EDITED 2048 00489 //#define PSYS_PROTECT_CACHE 4096 /* deprecated */ 00490 #define PSYS_DISABLED 8192 00491 00492 /* pars->flag */ 00493 #define PARS_UNEXIST 1 00494 #define PARS_NO_DISP 2 00495 //#define PARS_STICKY 4 /* deprecated */ 00496 #define PARS_REKEY 8 00497 00498 /* pars->alive */ 00499 //#define PARS_KILLED 0 /* deprecated */ 00500 #define PARS_DEAD 1 00501 #define PARS_UNBORN 2 00502 #define PARS_ALIVE 3 00503 #define PARS_DYING 4 00504 00505 /* ParticleDupliWeight->flag */ 00506 #define PART_DUPLIW_CURRENT 1 00507 00508 /* psys->vg */ 00509 #define PSYS_TOT_VG 12 00510 00511 #define PSYS_VG_DENSITY 0 00512 #define PSYS_VG_VEL 1 00513 #define PSYS_VG_LENGTH 2 00514 #define PSYS_VG_CLUMP 3 00515 #define PSYS_VG_KINK 4 00516 #define PSYS_VG_ROUGH1 5 00517 #define PSYS_VG_ROUGH2 6 00518 #define PSYS_VG_ROUGHE 7 00519 #define PSYS_VG_SIZE 8 00520 #define PSYS_VG_TAN 9 00521 #define PSYS_VG_ROT 10 00522 #define PSYS_VG_EFFECTOR 11 00523 00524 /* ParticleTarget->flag */ 00525 #define PTARGET_CURRENT 1 00526 #define PTARGET_VALID 2 00527 00528 /* ParticleTarget->mode */ 00529 #define PTARGET_MODE_NEUTRAL 0 00530 #define PTARGET_MODE_FRIEND 1 00531 #define PTARGET_MODE_ENEMY 2 00532 00533 /* mapto */ 00534 /* init */ 00535 #define PAMAP_INIT 15 00536 #define PAMAP_TIME (1<<0) /* emission time */ 00537 #define PAMAP_LIFE (1<<1) /* life time */ 00538 #define PAMAP_DENS (1<<2) /* density */ 00539 #define PAMAP_SIZE (1<<3) /* physical size */ 00540 /* reset */ 00541 #define PAMAP_IVEL (1<<5) /* initial velocity */ 00542 /* physics */ 00543 #define PAMAP_PHYSICS 3136 00544 #define PAMAP_FIELD (1<<6) /* force fields */ 00545 #define PAMAP_GRAVITY (1<<10) 00546 #define PAMAP_DAMP (1<<11) 00547 /* children */ 00548 #define PAMAP_CHILD 912 00549 #define PAMAP_CLUMP (1<<7) 00550 #define PAMAP_KINK (1<<8) 00551 #define PAMAP_ROUGH (1<<9) 00552 #define PAMAP_LENGTH (1<<4) 00553 00554 #endif