ephysics: don't send a msg per sub step
Only send one msg at the end of the simulation step. SVN revision: 77471
This commit is contained in:
parent
14459c4d74
commit
c6e04869ea
|
@ -64,6 +64,7 @@ struct _EPhysics_World {
|
||||||
Eina_Lock mutex;
|
Eina_Lock mutex;
|
||||||
Eina_Condition condition;
|
Eina_Condition condition;
|
||||||
Eina_Bool running:1;
|
Eina_Bool running:1;
|
||||||
|
Eina_Bool ticked:1;
|
||||||
Eina_Bool active:1;
|
Eina_Bool active:1;
|
||||||
Eina_Bool deleted:1;
|
Eina_Bool deleted:1;
|
||||||
Eina_Bool outside_autodel:1;
|
Eina_Bool outside_autodel:1;
|
||||||
|
@ -244,19 +245,29 @@ body_del:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephysics_world_tick_cb(btDynamicsWorld *dynamics_world, btScalar timeStep __UNUSED__)
|
_ephysics_world_tick_dispatch(EPhysics_World *world)
|
||||||
{
|
{
|
||||||
EPhysics_World *world;
|
|
||||||
Simulation_Msg *msg;
|
Simulation_Msg *msg;
|
||||||
|
|
||||||
|
if (!world->ticked)
|
||||||
|
return;
|
||||||
|
|
||||||
|
world->ticked = EINA_FALSE;
|
||||||
|
world->pending_ticks++;
|
||||||
|
|
||||||
msg = (Simulation_Msg *) calloc(1, sizeof(Simulation_Msg));
|
msg = (Simulation_Msg *) calloc(1, sizeof(Simulation_Msg));
|
||||||
msg->tick = EINA_TRUE;
|
msg->tick = EINA_TRUE;
|
||||||
|
|
||||||
world = (EPhysics_World *) dynamics_world->getWorldUserInfo();
|
|
||||||
world->pending_ticks++;
|
|
||||||
ecore_thread_feedback(world->cur_th, msg);
|
ecore_thread_feedback(world->cur_th, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ephysics_world_tick_cb(btDynamicsWorld *dynamics_world, btScalar timeStep __UNUSED__)
|
||||||
|
{
|
||||||
|
EPhysics_World *world;
|
||||||
|
world = (EPhysics_World *) dynamics_world->getWorldUserInfo();
|
||||||
|
world->ticked = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ephysics_world_body_del(EPhysics_World *world, EPhysics_Body *body)
|
_ephysics_world_body_del(EPhysics_World *world, EPhysics_Body *body)
|
||||||
{
|
{
|
||||||
|
@ -564,6 +575,7 @@ _th_simulate(void *data, Ecore_Thread *th)
|
||||||
((btDiscreteDynamicsWorld *)world->dynamics_world)->stepSimulation(
|
((btDiscreteDynamicsWorld *)world->dynamics_world)->stepSimulation(
|
||||||
delta, world->max_sub_steps, world->fixed_time_step);
|
delta, world->max_sub_steps, world->fixed_time_step);
|
||||||
|
|
||||||
|
_ephysics_world_tick_dispatch(world);
|
||||||
world->pending_ticks--;
|
world->pending_ticks--;
|
||||||
eina_lock_release(&world->mutex);
|
eina_lock_release(&world->mutex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue