summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-10-04 22:40:52 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-04 22:40:52 +0000
commitc6e04869ead72b20ef8da0ca82b4b30d5eb4ec5b (patch)
tree250a593fea8c4aa6cc6d21dd8152c50099ef415d /legacy
parent14459c4d745828e13779b116f6b53860eaa67e16 (diff)
ephysics: don't send a msg per sub step
Only send one msg at the end of the simulation step. SVN revision: 77471
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ephysics/src/lib/ephysics_world.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_world.cpp b/legacy/ephysics/src/lib/ephysics_world.cpp
index e765558..c0e1b04 100644
--- a/legacy/ephysics/src/lib/ephysics_world.cpp
+++ b/legacy/ephysics/src/lib/ephysics_world.cpp
@@ -64,6 +64,7 @@ struct _EPhysics_World {
64 Eina_Lock mutex; 64 Eina_Lock mutex;
65 Eina_Condition condition; 65 Eina_Condition condition;
66 Eina_Bool running:1; 66 Eina_Bool running:1;
67 Eina_Bool ticked:1;
67 Eina_Bool active:1; 68 Eina_Bool active:1;
68 Eina_Bool deleted:1; 69 Eina_Bool deleted:1;
69 Eina_Bool outside_autodel:1; 70 Eina_Bool outside_autodel:1;
@@ -244,17 +245,27 @@ body_del:
244} 245}
245 246
246static void 247static void
247_ephysics_world_tick_cb(btDynamicsWorld *dynamics_world, btScalar timeStep __UNUSED__) 248_ephysics_world_tick_dispatch(EPhysics_World *world)
248{ 249{
249 EPhysics_World *world;
250 Simulation_Msg *msg; 250 Simulation_Msg *msg;
251 251
252 if (!world->ticked)
253 return;
254
255 world->ticked = EINA_FALSE;
256 world->pending_ticks++;
257
252 msg = (Simulation_Msg *) calloc(1, sizeof(Simulation_Msg)); 258 msg = (Simulation_Msg *) calloc(1, sizeof(Simulation_Msg));
253 msg->tick = EINA_TRUE; 259 msg->tick = EINA_TRUE;
260 ecore_thread_feedback(world->cur_th, msg);
261}
254 262
263static void
264_ephysics_world_tick_cb(btDynamicsWorld *dynamics_world, btScalar timeStep __UNUSED__)
265{
266 EPhysics_World *world;
255 world = (EPhysics_World *) dynamics_world->getWorldUserInfo(); 267 world = (EPhysics_World *) dynamics_world->getWorldUserInfo();
256 world->pending_ticks++; 268 world->ticked = EINA_TRUE;
257 ecore_thread_feedback(world->cur_th, msg);
258} 269}
259 270
260static void 271static void
@@ -564,6 +575,7 @@ _th_simulate(void *data, Ecore_Thread *th)
564 ((btDiscreteDynamicsWorld *)world->dynamics_world)->stepSimulation( 575 ((btDiscreteDynamicsWorld *)world->dynamics_world)->stepSimulation(
565 delta, world->max_sub_steps, world->fixed_time_step); 576 delta, world->max_sub_steps, world->fixed_time_step);
566 577
578 _ephysics_world_tick_dispatch(world);
567 world->pending_ticks--; 579 world->pending_ticks--;
568 eina_lock_release(&world->mutex); 580 eina_lock_release(&world->mutex);
569 } 581 }