diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-01-23 09:56:34 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-01-23 09:56:34 +0400 |
commit | 089cf12435dfbc4b934a73b73ecd617b27ac678d (patch) | |
tree | e2c8b7b187694ca7ae4640b76634ddcba5644600 /source/blender/blenkernel/intern/rigidbody.c | |
parent | fc377c17e3d4803ef4db7a72daae629a322ffde8 (diff) |
rigidbody: Add point cache support
Add read/write/interpolate functions.
In order to get rigid body point cache id from object it's now required to pass the
scene to BKE_ptcache_ids_from_object().
Rigid body cache is drawn in the orange color of the bullet logo.
Diffstat (limited to 'source/blender/blenkernel/intern/rigidbody.c')
-rw-r--r-- | source/blender/blenkernel/intern/rigidbody.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 90200fd6742..17ced6fa54d 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -97,6 +97,10 @@ void BKE_rigidbody_free_world(RigidBodyWorld *rbw) if (rbw->objects) free(rbw->objects); + /* free cache */ + BKE_ptcache_free_list(&(rbw->ptcaches)); + rbw->pointcache = NULL; + /* free effector weights */ if (rbw->effector_weights) MEM_freeN(rbw->effector_weights); @@ -472,6 +476,9 @@ RigidBodyWorld *BKE_rigidbody_create_world(Scene *scene) rbw->steps_per_second = 60; /* Bullet default (60 Hz) */ rbw->num_solver_iterations = 10; /* 10 is bullet default */ + rbw->pointcache = BKE_ptcache_add(&(rbw->ptcaches)); + rbw->pointcache->step = 1; + /* return this sim world */ return rbw; } @@ -749,7 +756,8 @@ void BKE_rigidbody_sync_transforms(Scene *scene, Object *ob, float ctime) void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw) { -// RB_TODO implement this + if (rbw) + rbw->pointcache->flag |= PTCACHE_OUTDATED; } /* ------------------ */ |