summaryrefslogtreecommitdiff
path: root/legacy
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
parentf481315a265987d7de4cc8eeea80f56d708091af (diff)
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')
-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 f315f5d82e..e1d95664ff 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
228 camera->perspective.py = py; 228 camera->perspective.py = py;
229 camera->perspective.z0 = z0; 229 camera->perspective.z0 = z0;
230 camera->perspective.foc = foc; 230 camera->perspective.foc = foc;
231 ephysics_world_force_update_set(camera->world, EINA_TRUE);
231} 232}
232 233
233EAPI void 234EAPI void
@@ -255,6 +256,7 @@ ephysics_camera_perspective_enabled_set(EPhysics_Camera *camera, Eina_Bool enabl
255 } 256 }
256 257
257 camera->perspective.enabled = !!enabled; 258 camera->perspective.enabled = !!enabled;
259 ephysics_world_force_update_set(camera->world, EINA_TRUE);
258} 260}
259 261
260EAPI Eina_Bool 262EAPI Eina_Bool
diff --git a/legacy/ephysics/src/lib/ephysics_private.h b/legacy/ephysics/src/lib/ephysics_private.h
index 8afeee7b5d..0b96a6c92c 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);
185void ephysics_world_lock_take(EPhysics_World *world); 185void ephysics_world_lock_take(EPhysics_World *world);
186void ephysics_world_lock_release(EPhysics_World *world); 186void ephysics_world_lock_release(EPhysics_World *world);
187Eina_List *ephysics_world_constraints_get(EPhysics_World *world); 187Eina_List *ephysics_world_constraints_get(EPhysics_World *world);
188void ephysics_world_force_update_set(EPhysics_World *world, Eina_Bool force_update);
188 189
189/* Body */ 190/* Body */
190Eina_Bool ephysics_body_filter_collision(EPhysics_Body *body0, EPhysics_Body *body1); 191Eina_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 2aef765293..6c9ca35b71 100644
--- a/legacy/ephysics/src/lib/ephysics_world.cpp
+++ b/legacy/ephysics/src/lib/ephysics_world.cpp
@@ -99,6 +99,7 @@ struct _EPhysics_World {
99 Eina_Bool outside_back:1; 99 Eina_Bool outside_back:1;
100 Eina_Bool pending_simulation:1; 100 Eina_Bool pending_simulation:1;
101 Eina_Bool stacking:1; 101 Eina_Bool stacking:1;
102 Eina_Bool force_update:1;
102}; 103};
103 104
104static int _ephysics_world_init_count = 0; 105static int _ephysics_world_init_count = 0;
@@ -108,6 +109,12 @@ static Eina_List *_worlds_to_delete = NULL;
108static Ecore_Animator *_anim_simulate = NULL; 109static Ecore_Animator *_anim_simulate = NULL;
109static int _worlds_walking = 0; 110static int _worlds_walking = 0;
110 111
112void
113ephysics_world_force_update_set(EPhysics_World *world, Eina_Bool force_update)
114{
115 world->force_update = force_update;
116}
117
111btSoftBodyWorldInfo * 118btSoftBodyWorldInfo *
112ephysics_world_info_get(const EPhysics_World *world) 119ephysics_world_info_get(const EPhysics_World *world)
113{ 120{
@@ -235,7 +242,7 @@ _ephysics_world_tick(btDynamicsWorld *dynamics_world)
235 else 242 else
236 { 243 {
237 ephysics_body_active_set(body, EINA_FALSE); 244 ephysics_body_active_set(body, EINA_FALSE);
238 if (camera_moved) 245 if (camera_moved || world->force_update)
239 ephysics_body_evas_object_update_select(body); 246 ephysics_body_evas_object_update_select(body);
240 } 247 }
241 } 248 }
@@ -243,6 +250,7 @@ _ephysics_world_tick(btDynamicsWorld *dynamics_world)
243 if (world->stacking) 250 if (world->stacking)
244 ephysics_body_evas_objects_restack(world); 251 ephysics_body_evas_objects_restack(world);
245 252
253 world->force_update = EINA_FALSE;
246 if (camera_moved) 254 if (camera_moved)
247 { 255 {
248 ephysics_camera_moved_set(world->camera, EINA_FALSE); 256 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
1540 world->light.lx = lx; 1548 world->light.lx = lx;
1541 world->light.ly = ly; 1549 world->light.ly = ly;
1542 world->light.lz = lz; 1550 world->light.lz = lz;
1551 world->force_update = EINA_TRUE;
1543} 1552}
1544 1553
1545EAPI void 1554EAPI void
@@ -1554,6 +1563,7 @@ ephysics_world_point_light_color_set(EPhysics_World *world, int lr, int lg, int
1554 world->light.lr = lr; 1563 world->light.lr = lr;
1555 world->light.lg = lg; 1564 world->light.lg = lg;
1556 world->light.lb = lb; 1565 world->light.lb = lb;
1566 world->force_update = EINA_TRUE;
1557} 1567}
1558 1568
1559EAPI void 1569EAPI void
@@ -1568,6 +1578,7 @@ ephysics_world_ambient_light_color_set(EPhysics_World *world, int ar, int ag, in
1568 world->light.ar = ar; 1578 world->light.ar = ar;
1569 world->light.ag = ag; 1579 world->light.ag = ag;
1570 world->light.ab = ab; 1580 world->light.ab = ab;
1581 world->force_update = EINA_TRUE;
1571} 1582}
1572 1583
1573EAPI void 1584EAPI void
@@ -1622,6 +1633,7 @@ ephysics_world_light_all_bodies_set(EPhysics_World *world, Eina_Bool enable)
1622 } 1633 }
1623 1634
1624 world->light.all_bodies = !!enable; 1635 world->light.all_bodies = !!enable;
1636 world->force_update = EINA_TRUE;
1625} 1637}
1626 1638
1627EAPI Eina_Bool 1639EAPI Eina_Bool