forked from enlightenment/efl
ephysics: add autodel functions for front and back of
the scene SVN revision: 78016
This commit is contained in:
parent
c2b0c76b74
commit
bb90530f7b
|
@ -1033,6 +1033,8 @@ EAPI double ephysics_world_linear_slop_get(const EPhysics_World *world);
|
||||||
* @see ephysics_world_bodies_outside_bottom_autodel_set().
|
* @see ephysics_world_bodies_outside_bottom_autodel_set().
|
||||||
* @see ephysics_world_bodies_outside_left_autodel_set().
|
* @see ephysics_world_bodies_outside_left_autodel_set().
|
||||||
* @see ephysics_world_bodies_outside_right_autodel_set().
|
* @see ephysics_world_bodies_outside_right_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_front_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_back_autodel_set().
|
||||||
*
|
*
|
||||||
* @ingroup EPhysics_World
|
* @ingroup EPhysics_World
|
||||||
*/
|
*/
|
||||||
|
@ -1066,6 +1068,8 @@ EAPI Eina_Bool ephysics_world_bodies_outside_top_autodel_get(const EPhysics_Worl
|
||||||
* @see ephysics_world_bodies_outside_bottom_autodel_get().
|
* @see ephysics_world_bodies_outside_bottom_autodel_get().
|
||||||
* @see ephysics_world_bodies_outside_left_autodel_set().
|
* @see ephysics_world_bodies_outside_left_autodel_set().
|
||||||
* @see ephysics_world_bodies_outside_right_autodel_set().
|
* @see ephysics_world_bodies_outside_right_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_front_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_back_autodel_set().
|
||||||
*
|
*
|
||||||
* @ingroup EPhysics_World
|
* @ingroup EPhysics_World
|
||||||
*/
|
*/
|
||||||
|
@ -1099,6 +1103,8 @@ EAPI Eina_Bool ephysics_world_bodies_outside_bottom_autodel_get(const EPhysics_W
|
||||||
* @see ephysics_world_bodies_outside_right_autodel_get().
|
* @see ephysics_world_bodies_outside_right_autodel_get().
|
||||||
* @see ephysics_world_bodies_outside_bottom_autodel_set().
|
* @see ephysics_world_bodies_outside_bottom_autodel_set().
|
||||||
* @see ephysics_world_bodies_outside_left_autodel_set().
|
* @see ephysics_world_bodies_outside_left_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_front_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_back_autodel_set().
|
||||||
*
|
*
|
||||||
* @ingroup EPhysics_World
|
* @ingroup EPhysics_World
|
||||||
*/
|
*/
|
||||||
|
@ -1132,6 +1138,8 @@ EAPI Eina_Bool ephysics_world_bodies_outside_right_autodel_get(const EPhysics_Wo
|
||||||
* @see ephysics_world_bodies_outside_left_autodel_get().
|
* @see ephysics_world_bodies_outside_left_autodel_get().
|
||||||
* @see ephysics_world_bodies_outside_bottom_autodel_set().
|
* @see ephysics_world_bodies_outside_bottom_autodel_set().
|
||||||
* @see ephysics_world_bodies_outside_right_autodel_set().
|
* @see ephysics_world_bodies_outside_right_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_front_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_back_autodel_set().
|
||||||
*
|
*
|
||||||
* @ingroup EPhysics_World
|
* @ingroup EPhysics_World
|
||||||
*/
|
*/
|
||||||
|
@ -1152,6 +1160,76 @@ EAPI void ephysics_world_bodies_outside_left_autodel_set(EPhysics_World *world,
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool ephysics_world_bodies_outside_left_autodel_get(const EPhysics_World *world);
|
EAPI Eina_Bool ephysics_world_bodies_outside_left_autodel_get(const EPhysics_World *world);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Set world autodeleting bodies mode when they're outside of render area
|
||||||
|
* by the front.
|
||||||
|
*
|
||||||
|
* @param world The physics world.
|
||||||
|
* @param autodel If @c EINA_TRUE delete bodies when they are outside render
|
||||||
|
* area, otherwise, don't delete.
|
||||||
|
*
|
||||||
|
* @see ephysics_world_bodies_outside_top_autodel_set() for more details.
|
||||||
|
* @see ephysics_world_bodies_outside_left_autodel_get().
|
||||||
|
* @see ephysics_world_bodies_outside_bottom_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_right_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_front_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_back_autodel_set().
|
||||||
|
*
|
||||||
|
* @ingroup EPhysics_World
|
||||||
|
*/
|
||||||
|
EAPI void ephysics_world_bodies_outside_front_autodel_set(EPhysics_World *world, Eina_Bool autodel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Get world autodeleting bodies mode when they're outside of render area by
|
||||||
|
* the front.
|
||||||
|
*
|
||||||
|
* @param world The physics world.
|
||||||
|
* @return @c EINA_TRUE if bodies will be deleted or @c EINA_FALSE if they
|
||||||
|
* won't, or on error.
|
||||||
|
*
|
||||||
|
* @see ephysics_world_bodies_outside_front_autodel_set() for details.
|
||||||
|
*
|
||||||
|
* @ingroup EPhysics_World
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool ephysics_world_bodies_outside_front_autodel_get(const EPhysics_World *world);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Set world autodeleting bodies mode when they're outside of render area
|
||||||
|
* by the back.
|
||||||
|
*
|
||||||
|
* @param world The physics world.
|
||||||
|
* @param autodel If @c EINA_TRUE delete bodies when they are outside render
|
||||||
|
* area, otherwise, don't delete.
|
||||||
|
*
|
||||||
|
* @see ephysics_world_bodies_outside_top_autodel_set() for more details.
|
||||||
|
* @see ephysics_world_bodies_outside_left_autodel_get().
|
||||||
|
* @see ephysics_world_bodies_outside_bottom_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_right_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_front_autodel_set().
|
||||||
|
* @see ephysics_world_bodies_outside_back_autodel_set().
|
||||||
|
*
|
||||||
|
* @ingroup EPhysics_World
|
||||||
|
*/
|
||||||
|
EAPI void ephysics_world_bodies_outside_back_autodel_set(EPhysics_World *world, Eina_Bool autodel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Get world autodeleting bodies mode when they're outside of render area by
|
||||||
|
* the back.
|
||||||
|
*
|
||||||
|
* @param world The physics world.
|
||||||
|
* @return @c EINA_TRUE if bodies will be deleted or @c EINA_FALSE if they
|
||||||
|
* won't, or on error.
|
||||||
|
*
|
||||||
|
* @see ephysics_world_bodies_outside_back_autodel_set() for details.
|
||||||
|
*
|
||||||
|
* @ingroup EPhysics_World
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool ephysics_world_bodies_outside_back_autodel_get(const EPhysics_World *world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
* Set world simulation's fixed time step and max number of sub steps
|
* Set world simulation's fixed time step and max number of sub steps
|
||||||
|
|
|
@ -1071,11 +1071,11 @@ _ephysics_body_evas_object_default_update(EPhysics_Body *body)
|
||||||
static void
|
static void
|
||||||
_ephysics_body_outside_render_area_check(EPhysics_Body *body)
|
_ephysics_body_outside_render_area_check(EPhysics_Body *body)
|
||||||
{
|
{
|
||||||
int wx, wy, ww, wh, bx, by, bw, bh;
|
int wx, wy, wz, ww, wh, wd, bx, by, bz, bw, bh, bd;
|
||||||
|
|
||||||
ephysics_world_render_geometry_get(body->world, &wx, &wy, NULL,
|
ephysics_world_render_geometry_get(body->world, &wx, &wy, &wz,
|
||||||
&ww, &wh, NULL);
|
&ww, &wh, &wd);
|
||||||
ephysics_body_geometry_get(body, &bx, &by, NULL, &bw, &bh, NULL);
|
ephysics_body_geometry_get(body, &bx, &by, &bz, &bw, &bh, &bd);
|
||||||
|
|
||||||
// FIXME: check what should be done regarding rotated bodies
|
// FIXME: check what should be done regarding rotated bodies
|
||||||
if (((ephysics_world_bodies_outside_top_autodel_get(body->world)) &&
|
if (((ephysics_world_bodies_outside_top_autodel_get(body->world)) &&
|
||||||
|
@ -1085,7 +1085,11 @@ _ephysics_body_outside_render_area_check(EPhysics_Body *body)
|
||||||
((ephysics_world_bodies_outside_left_autodel_get(body->world)) &&
|
((ephysics_world_bodies_outside_left_autodel_get(body->world)) &&
|
||||||
(bx + bh < wx)) ||
|
(bx + bh < wx)) ||
|
||||||
((ephysics_world_bodies_outside_right_autodel_get(body->world)) &&
|
((ephysics_world_bodies_outside_right_autodel_get(body->world)) &&
|
||||||
(bx > wx + ww)))
|
(bx > wx + ww)) ||
|
||||||
|
((ephysics_world_bodies_outside_front_autodel_get(body->world)) &&
|
||||||
|
(bz + bd < wz)) ||
|
||||||
|
((ephysics_world_bodies_outside_back_autodel_get(body->world)) &&
|
||||||
|
(bz > wz + wd)))
|
||||||
{
|
{
|
||||||
DBG("Body %p out of render area", body);
|
DBG("Body %p out of render area", body);
|
||||||
ephysics_body_del(body);
|
ephysics_body_del(body);
|
||||||
|
|
|
@ -97,6 +97,8 @@ struct _EPhysics_World {
|
||||||
Eina_Bool outside_bottom:1;
|
Eina_Bool outside_bottom:1;
|
||||||
Eina_Bool outside_left:1;
|
Eina_Bool outside_left:1;
|
||||||
Eina_Bool outside_right:1;
|
Eina_Bool outside_right:1;
|
||||||
|
Eina_Bool outside_front:1;
|
||||||
|
Eina_Bool outside_back:1;
|
||||||
Eina_Bool pending_simulation:1;
|
Eina_Bool pending_simulation:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1284,7 +1286,8 @@ ephysics_world_bodies_outside_top_autodel_set(EPhysics_World *world, Eina_Bool a
|
||||||
|
|
||||||
world->outside_top = !!autodel;
|
world->outside_top = !!autodel;
|
||||||
world->outside_autodel = world->outside_top || world->outside_bottom ||
|
world->outside_autodel = world->outside_top || world->outside_bottom ||
|
||||||
world->outside_left || world->outside_right;
|
world->outside_left || world->outside_right ||
|
||||||
|
world->outside_front || world->outside_back;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
|
@ -1310,7 +1313,8 @@ ephysics_world_bodies_outside_bottom_autodel_set(EPhysics_World *world, Eina_Boo
|
||||||
|
|
||||||
world->outside_bottom = !!autodel;
|
world->outside_bottom = !!autodel;
|
||||||
world->outside_autodel = world->outside_top || world->outside_bottom ||
|
world->outside_autodel = world->outside_top || world->outside_bottom ||
|
||||||
world->outside_left || world->outside_right;
|
world->outside_left || world->outside_right ||
|
||||||
|
world->outside_front || world->outside_back;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
|
@ -1336,7 +1340,8 @@ ephysics_world_bodies_outside_left_autodel_set(EPhysics_World *world, Eina_Bool
|
||||||
|
|
||||||
world->outside_left = !!autodel;
|
world->outside_left = !!autodel;
|
||||||
world->outside_autodel = world->outside_top || world->outside_bottom ||
|
world->outside_autodel = world->outside_top || world->outside_bottom ||
|
||||||
world->outside_left || world->outside_right;
|
world->outside_left || world->outside_right ||
|
||||||
|
world->outside_front || world->outside_back;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
|
@ -1362,7 +1367,8 @@ ephysics_world_bodies_outside_right_autodel_set(EPhysics_World *world, Eina_Bool
|
||||||
|
|
||||||
world->outside_right = !!autodel;
|
world->outside_right = !!autodel;
|
||||||
world->outside_autodel = world->outside_top || world->outside_bottom ||
|
world->outside_autodel = world->outside_top || world->outside_bottom ||
|
||||||
world->outside_left || world->outside_right;
|
world->outside_left || world->outside_right ||
|
||||||
|
world->outside_front || world->outside_back;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
|
@ -1377,6 +1383,60 @@ ephysics_world_bodies_outside_right_autodel_get(const EPhysics_World *world)
|
||||||
return world->outside_right;
|
return world->outside_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
ephysics_world_bodies_outside_front_autodel_set(EPhysics_World *world, Eina_Bool autodel)
|
||||||
|
{
|
||||||
|
if (!world)
|
||||||
|
{
|
||||||
|
ERR("Can't set autodelete mode, world is null.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
world->outside_front = !!autodel;
|
||||||
|
world->outside_autodel = world->outside_top || world->outside_bottom ||
|
||||||
|
world->outside_left || world->outside_right ||
|
||||||
|
world->outside_front || world->outside_back;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
ephysics_world_bodies_outside_front_autodel_get(const EPhysics_World *world)
|
||||||
|
{
|
||||||
|
if (!world)
|
||||||
|
{
|
||||||
|
ERR("Can't get autodelete mode, world is null.");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return world->outside_front;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
ephysics_world_bodies_outside_back_autodel_set(EPhysics_World *world, Eina_Bool autodel)
|
||||||
|
{
|
||||||
|
if (!world)
|
||||||
|
{
|
||||||
|
ERR("Can't set autodelete mode, world is null.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
world->outside_back = !!autodel;
|
||||||
|
world->outside_autodel = world->outside_top || world->outside_bottom ||
|
||||||
|
world->outside_left || world->outside_right ||
|
||||||
|
world->outside_front || world->outside_back;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
ephysics_world_bodies_outside_back_autodel_get(const EPhysics_World *world)
|
||||||
|
{
|
||||||
|
if (!world)
|
||||||
|
{
|
||||||
|
ERR("Can't get autodelete mode, world is null.");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return world->outside_back;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
ephysics_world_bodies_outside_autodel_get(const EPhysics_World *world)
|
ephysics_world_bodies_outside_autodel_get(const EPhysics_World *world)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue