diff options
author | Janne Karhu <jhkarh@gmail.com> | 2011-01-09 22:09:41 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2011-01-09 22:09:41 +0300 |
commit | 9231ff41604039ca55f1da4945a077cfab9e1e84 (patch) | |
tree | c9c29bb10aabaa44e8e683bab8d3ce7a06a39744 /source/blender/blenkernel/BKE_pointcache.h | |
parent | 84a464ab62e67eb21e12d0c3b0fad061c38d9e4a (diff) |
Viscoelastic springs for sph particle fluids, original patch by Stephen Whitehorn (chickencoop)
* Viscoelastic springs between the fluid particles can simulate all kinds
of viscous and elastic substances, such as jelly and honey. This is
achieved by creating springs dynamically between neighboring particles
and adjusting their rest length based on stretching/compression.
* This nearly completes the currently intended functionality for particle
fluids. The last missing thing is a surfacing extraction algorithm,
which is needed for a proper representation of a sph fluid.
* I also cleaned up and renamed some of the fluid parameters to make the
ui a bit easier to understand.
* One addition to the patch is an option to use "initial rest length" for
the springs, which uses the lengths between the particles at the time of
spring creation as the spring rest lengths instead of interaction radius/2.
This makes the fluid keep it's original shape better (good for very
viscoelastic materials), but can create large density differences inside
the fluid (not really physically correct for a fluid).
* Viscoelastic springs are stored in point cache as extra data.
Diffstat (limited to 'source/blender/blenkernel/BKE_pointcache.h')
-rw-r--r-- | source/blender/blenkernel/BKE_pointcache.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 68c4177fe3a..a4ce46409a1 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -32,6 +32,7 @@ #include "DNA_ID.h" #include "DNA_object_force.h" #include "DNA_boid_types.h" +#include "DNA_particle_types.h" #include <stdio.h> /* for FILE */ /* Point cache clearing option, for BKE_ptcache_id_clear, before @@ -110,6 +111,16 @@ static char *ptcache_datastruct[] = { "BoidData" // case BPHYS_DATA_BOIDS: }; +static char *ptcache_extra_datastruct[] = { + "", + "ParticleSpring" +}; + +static int ptcache_extra_datasize[] = { + 0, + sizeof(ParticleSpring) +}; + typedef struct PTCacheFile { FILE *fp; @@ -149,11 +160,11 @@ typedef struct PTCacheID { void (*read_stream)(PTCacheFile *pf, void *calldata); /* copies custom extradata to cache data */ - int (*write_extra_data)(void *calldata, struct PTCacheMem *pm, int cfra); + void (*write_extra_data)(void *calldata, struct PTCacheMem *pm, int cfra); /* copies custom extradata to cache data */ - int (*read_extra_data)(void *calldata, struct PTCacheMem *pm, float cfra); + void (*read_extra_data)(void *calldata, struct PTCacheMem *pm, float cfra); /* copies custom extradata to cache data */ - int (*interpolate_extra_data)(void *calldata, struct PTCacheMem *pm, float cfra, float cfra1, float cfra2); + void (*interpolate_extra_data)(void *calldata, struct PTCacheMem *pm, float cfra, float cfra1, float cfra2); /* total number of simulated points (the cfra parameter is just for using same function pointer with totwrite) */ int (*totpoint)(void *calldata, int cfra); |