aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ephysics/src/lib
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-12-03 21:29:03 +0000
committerLeandro Dorileo <dorileo@profusion.mobi>2012-12-03 21:29:03 +0000
commit4a1a773d2710d005141feabecf40f53830e60ed6 (patch)
tree76867ccc44b09c54bc600e3179fd50a603d4109c /legacy/ephysics/src/lib
parentf481315a265987d7de4cc8eeea80f56d708091af (diff)
downloadefl-4a1a773d2710d005141feabecf40f53830e60ed6.tar.gz
efl-4a1a773d2710d005141feabecf40f53830e60ed6.tar.xz
efl-4a1a773d2710d005141feabecf40f53830e60ed6.zip
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
Diffstat (limited to 'legacy/ephysics/src/lib')
-rw-r--r--legacy/ephysics/src/lib/ephysics_camera.cpp2
-rw-r--r--legacy/ephysics/src/lib/ephysics_private.h1
-rw-r--r--legacy/ephysics/src/lib/ephysics_world.cpp14
3 files changed, 16 insertions, 1 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_camera.cpp b/legacy/ephysics/src/lib/ephysics_camera.cpp
index f315f5d82..e1d95664f 100644
--- a/legacy/ephysics/src/lib/ephysics_camera.cpp
+++ b/legacy/ephysics/src/lib/ephysics_camera.cpp
@@ -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
diff --git a/legacy/ephysics/src/lib/ephysics_private.h b/legacy/ephysics/src/lib/ephysics_private.h
index 8afeee7b5..0b96a6c92 100644
--- a/legacy/ephysics/src/lib/ephysics_private.h
+++ b/legacy/ephysics/src/lib/ephysics_private.h
@@ -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);
diff --git a/legacy/ephysics/src/lib/ephysics_world.cpp b/legacy/ephysics/src/lib/ephysics_world.cpp
index 2aef76529..6c9ca35b7 100644
--- a/legacy/ephysics/src/lib/ephysics_world.cpp
+++ b/legacy/ephysics/src/lib/ephysics_world.cpp
@@ -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