Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2009-08-12 13:54:29 +0400
committerJanne Karhu <jhkarh@gmail.com>2009-08-12 13:54:29 +0400
commitb221c0e2e6f390f3ed810b7f520b0ad60511ba36 (patch)
tree09b3b18e14773ee015959b214284cc5010f6fdc4 /source/blender/makesdna/DNA_object_force.h
parent8641833b57606a2ac21f7c83b53ea5fc55664815 (diff)
New point cache file format:
- HEADER (beginning of each file) * general header: + 8 char: "BPHYSICS" + 1 int: simulation type (same as PTCacheID->type) * custom header (same for sb, particles and cloth, but can be different for new dynamics) + 1 int: totpoint (number of points) + 1 int: data_types (bit flags for what the stored data is) - DATA (directly after header) *totpoint times the data as specified in data_types flags - simulation type soft body = 0, particles = 1, cloth = 2 - data types (more can be added easily when needed) data flag contains ---------------------------------------- index (1<<0) 1 int (index of current point) location (1<<1) 3 float velocity (1<<2) 3 float rotation (1<<3) 4 float (quaternion) avelocity (1<<4) 3 float (used for particles) xconst (1<<4) 3 float (used for cloth) size (1<<5) 1 float times (1<<6) 3 float (birth, die & lifetime of particle) boids (1<<7) 1 BoidData Notes: - Every frame is not nescessary since data is interpolated for the inbetween frames. - For now every point is needed for every cached frame, the "index" data type is reserved for future usage. - For loading external particle caches only "location" data is necessary, other needed values are determined from the given data. - Non-dynamic data should be written into an info file if external usage is desired. * Info file is named as normal cache files, but with frame number 0; * "Non-dynamic" means data such as particle times. * Written automatically when baking to disk so basically a library of particle simulations should be possible. - Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend. - External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui. Other changes: - Multiple point caches per dynamics system. * In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used. * Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present. - Generalization of point cache baking etc operator & rna code. - Comb brushing particle hair didn't work smoothly.
Diffstat (limited to 'source/blender/makesdna/DNA_object_force.h')
-rw-r--r--source/blender/makesdna/DNA_object_force.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h
index b5b33610bfe..d7ef3d73ecf 100644
--- a/source/blender/makesdna/DNA_object_force.h
+++ b/source/blender/makesdna/DNA_object_force.h
@@ -74,14 +74,36 @@ typedef struct PartDeflect {
int seed; /* wind noise random seed */
} PartDeflect;
+/* Point cache file data types:
+/* - used as (1<<flag) so poke jahka if you reach the limit of 15
+/* - to add new data types update:
+/* * BKE_ptcache_data_size()
+/* * ptcache_file_init_pointers()
+*/
+#define BPHYS_DATA_INDEX 0
+#define BPHYS_DATA_LOCATION 1
+#define BPHYS_DATA_VELOCITY 2
+#define BPHYS_DATA_ROTATION 3
+#define BPHYS_DATA_AVELOCITY 4 /* used for particles */
+#define BPHYS_DATA_XCONST 4 /* used for cloth */
+#define BPHYS_DATA_SIZE 5
+#define BPHYS_DATA_TIMES 6
+#define BPHYS_DATA_BOIDS 7
+
+#define BPHYS_TOT_DATA 8
+
typedef struct PTCacheMem {
struct PTCacheMem *next, *prev;
int frame, totpoint;
- float *data; /* data points */
- void *xdata; /* extra data */
+ unsigned int data_types, rt;
+ int *index_array; /* quick access to stored points with index */
+
+ void *data[8]; /* BPHYS_TOT_DATA */
+ void *cur[8]; /* BPHYS_TOT_DATA */
} PTCacheMem;
typedef struct PointCache {
+ struct PointCache *next, *prev;
int flag; /* generic flag */
int step; /* frames between cached frames */
int simframe; /* current frame of simulation (only if SIMULATION_VALID) */
@@ -229,6 +251,7 @@ typedef struct SoftBody {
float inpush;
struct PointCache *pointcache;
+ struct ListBase ptcaches;
} SoftBody;
@@ -283,6 +306,7 @@ typedef struct SoftBody {
#define PTCACHE_QUICK_CACHE 128
#define PTCACHE_FRAMES_SKIPPED 256
#define PTCACHE_EXTERNAL 512
+#define PTCACHE_READ_INFO 1024
/* PTCACHE_OUTDATED + PTCACHE_FRAMES_SKIPPED */
#define PTCACHE_REDO_NEEDED 258