summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-10-04 22:38:00 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-04 22:38:00 +0000
commitcfdd39c2d70c4414cadf0c2296fe5f0f99e4da57 (patch)
treeb23f09f744bf90ed15d4966b0f31c5d1220cd05d /legacy
parent62f7b42c3bafd6b671237023b0b1ea722c10a5b4 (diff)
ephysics: free overlap filter callback
This patch makes sure the overlap filter callback instance is removed on world removal. Patch by: Leandro Dorileo <dorileo@profusion.mobi> SVN revision: 77454
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ephysics/src/lib/ephysics_world.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_world.cpp b/legacy/ephysics/src/lib/ephysics_world.cpp
index 5fa3470..328d894 100644
--- a/legacy/ephysics/src/lib/ephysics_world.cpp
+++ b/legacy/ephysics/src/lib/ephysics_world.cpp
@@ -31,6 +31,7 @@ struct _EPhysics_World {
31 btSoftRigidDynamicsWorld* dynamics_world; 31 btSoftRigidDynamicsWorld* dynamics_world;
32 btSoftBodyWorldInfo* world_info; 32 btSoftBodyWorldInfo* world_info;
33 btSoftBodySolver* soft_solver; 33 btSoftBodySolver* soft_solver;
34 btOverlapFilterCallback *filter_cb;
34 35
35 EPhysics_Body *boundaries[4]; 36 EPhysics_Body *boundaries[4];
36 EPhysics_Camera *camera; 37 EPhysics_Camera *camera;
@@ -276,6 +277,7 @@ _ephysics_world_free(EPhysics_World *world)
276 277
277 ephysics_camera_del(world->camera); 278 ephysics_camera_del(world->camera);
278 279
280 delete world->filter_cb;
279 delete world->dynamics_world; 281 delete world->dynamics_world;
280 delete world->solver; 282 delete world->solver;
281 delete world->broadphase; 283 delete world->broadphase;
@@ -487,7 +489,6 @@ EAPI EPhysics_World *
487ephysics_world_new(void) 489ephysics_world_new(void)
488{ 490{
489 EPhysics_World *world; 491 EPhysics_World *world;
490 btOverlapFilterCallback *filter_cb;
491 492
492 world = (EPhysics_World *) calloc(1, sizeof(EPhysics_World)); 493 world = (EPhysics_World *) calloc(1, sizeof(EPhysics_World));
493 if (!world) 494 if (!world)
@@ -570,11 +571,12 @@ ephysics_world_new(void)
570 EPHYSICS_WORLD_SOLVER_SIMD; 571 EPHYSICS_WORLD_SOLVER_SIMD;
571 world->dynamics_world->setGravity(DEFAULT_GRAVITY); 572 world->dynamics_world->setGravity(DEFAULT_GRAVITY);
572 573
573 filter_cb = new _ephysics_world_ovelap_filter_cb(); 574 world->filter_cb = new _ephysics_world_ovelap_filter_cb();
574 if (!filter_cb) 575 if (!world->filter_cb)
575 INF("Couldn't initialize the collision filter."); 576 INF("Couldn't initialize the collision filter.");
576 else 577 else
577 world->dynamics_world->getPairCache()->setOverlapFilterCallback(filter_cb); 578 world->dynamics_world->getPairCache()->setOverlapFilterCallback(
579 world->filter_cb);
578 580
579 world->rate = 30; 581 world->rate = 30;
580 world->max_sub_steps = 3; 582 world->max_sub_steps = 3;