EPhysics: force body update on light/perspective changes

If light configuration has been changed or perspective changed or simply
enabled/disabled force inactive bodies to update.

--This line, and those below, will be ignored--


SVN revision: 80105
This commit is contained in:
Leandro Dorileo 2012-12-03 21:29:03 +00:00
parent f481315a26
commit 4a1a773d27
3 changed files with 16 additions and 1 deletions

View File

@ -228,6 +228,7 @@ ephysics_camera_perspective_set(EPhysics_Camera *camera, Evas_Coord px, Evas_Coo
camera->perspective.py = py;
camera->perspective.z0 = z0;
camera->perspective.foc = foc;
ephysics_world_force_update_set(camera->world, EINA_TRUE);
}
EAPI void
@ -255,6 +256,7 @@ ephysics_camera_perspective_enabled_set(EPhysics_Camera *camera, Eina_Bool enabl
}
camera->perspective.enabled = !!enabled;
ephysics_world_force_update_set(camera->world, EINA_TRUE);
}
EAPI Eina_Bool

View File

@ -185,6 +185,7 @@ btSoftBodyWorldInfo *ephysics_world_info_get(const EPhysics_World *world);
void ephysics_world_lock_take(EPhysics_World *world);
void ephysics_world_lock_release(EPhysics_World *world);
Eina_List *ephysics_world_constraints_get(EPhysics_World *world);
void ephysics_world_force_update_set(EPhysics_World *world, Eina_Bool force_update);
/* Body */
Eina_Bool ephysics_body_filter_collision(EPhysics_Body *body0, EPhysics_Body *body1);

View File

@ -99,6 +99,7 @@ struct _EPhysics_World {
Eina_Bool outside_back:1;
Eina_Bool pending_simulation:1;
Eina_Bool stacking:1;
Eina_Bool force_update:1;
};
static int _ephysics_world_init_count = 0;
@ -108,6 +109,12 @@ static Eina_List *_worlds_to_delete = NULL;
static Ecore_Animator *_anim_simulate = NULL;
static int _worlds_walking = 0;
void
ephysics_world_force_update_set(EPhysics_World *world, Eina_Bool force_update)
{
world->force_update = force_update;
}
btSoftBodyWorldInfo *
ephysics_world_info_get(const EPhysics_World *world)
{
@ -235,7 +242,7 @@ _ephysics_world_tick(btDynamicsWorld *dynamics_world)
else
{
ephysics_body_active_set(body, EINA_FALSE);
if (camera_moved)
if (camera_moved || world->force_update)
ephysics_body_evas_object_update_select(body);
}
}
@ -243,6 +250,7 @@ _ephysics_world_tick(btDynamicsWorld *dynamics_world)
if (world->stacking)
ephysics_body_evas_objects_restack(world);
world->force_update = EINA_FALSE;
if (camera_moved)
{
ephysics_camera_moved_set(world->camera, EINA_FALSE);
@ -1540,6 +1548,7 @@ ephysics_world_point_light_position_set(EPhysics_World *world, Evas_Coord lx, Ev
world->light.lx = lx;
world->light.ly = ly;
world->light.lz = lz;
world->force_update = EINA_TRUE;
}
EAPI void
@ -1554,6 +1563,7 @@ ephysics_world_point_light_color_set(EPhysics_World *world, int lr, int lg, int
world->light.lr = lr;
world->light.lg = lg;
world->light.lb = lb;
world->force_update = EINA_TRUE;
}
EAPI void
@ -1568,6 +1578,7 @@ ephysics_world_ambient_light_color_set(EPhysics_World *world, int ar, int ag, in
world->light.ar = ar;
world->light.ag = ag;
world->light.ab = ab;
world->force_update = EINA_TRUE;
}
EAPI void
@ -1622,6 +1633,7 @@ ephysics_world_light_all_bodies_set(EPhysics_World *world, Eina_Bool enable)
}
world->light.all_bodies = !!enable;
world->force_update = EINA_TRUE;
}
EAPI Eina_Bool