forked from enlightenment/efl
EPhysics: fix sleeping threshold getter
SVN revision: 75143
This commit is contained in:
parent
e1036529b3
commit
73e77dff26
|
@ -9,6 +9,7 @@ _world_populate(Test_Data *test_data)
|
||||||
{
|
{
|
||||||
Evas_Object *sphere1, *sphere2, *sh1, *sh2;
|
Evas_Object *sphere1, *sphere2, *sh1, *sh2;
|
||||||
EPhysics_Body *sphere_body1, *sphere_body2;
|
EPhysics_Body *sphere_body1, *sphere_body2;
|
||||||
|
double linear, angular;
|
||||||
|
|
||||||
sh1 = elm_layout_add(test_data->win);
|
sh1 = elm_layout_add(test_data->win);
|
||||||
elm_layout_file_set(
|
elm_layout_file_set(
|
||||||
|
@ -65,6 +66,11 @@ _world_populate(Test_Data *test_data)
|
||||||
ephysics_body_linear_velocity_set(sphere_body2, -100, 0);
|
ephysics_body_linear_velocity_set(sphere_body2, -100, 0);
|
||||||
ephysics_body_damping_set(sphere_body2, 0.5, 0.5);
|
ephysics_body_damping_set(sphere_body2, 0.5, 0.5);
|
||||||
test_data->bodies = eina_list_append(test_data->bodies, sphere_body2);
|
test_data->bodies = eina_list_append(test_data->bodies, sphere_body2);
|
||||||
|
|
||||||
|
ephysics_body_sleeping_threshold_get(sphere_body1, &linear, &angular);
|
||||||
|
INF("Body 1: linear threshold: %.2f, angular: %.2f", linear, angular);
|
||||||
|
ephysics_body_sleeping_threshold_get(sphere_body2, &linear, &angular);
|
||||||
|
INF("Body 2: linear threshold: %.2f, angular: %.2f", linear, angular);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1497,9 +1497,9 @@ EAPI double ephysics_body_angular_velocity_get(const EPhysics_Body *body);
|
||||||
* @param linear_threshold The linear sleeping threshold factor.
|
* @param linear_threshold The linear sleeping threshold factor.
|
||||||
* @param angular_threshold The angular sleeping threshold factor.
|
* @param angular_threshold The angular sleeping threshold factor.
|
||||||
*
|
*
|
||||||
* @see ephysics_body_linear_sleeping_threshold_get()
|
* @see ephysics_body_sleeping_threshold_get().
|
||||||
* @see ephysics_body_angular_sleeping_threshold_get()
|
|
||||||
* @see ephysics_world_max_sleeping_time_set() for sleeping time details.
|
* @see ephysics_world_max_sleeping_time_set() for sleeping time details.
|
||||||
|
*
|
||||||
* @ingroup EPhysics_Body
|
* @ingroup EPhysics_Body
|
||||||
*/
|
*/
|
||||||
EAPI void ephysics_body_sleeping_threshold_set(EPhysics_Body *body, double linear_threshold, double angular_threshold);
|
EAPI void ephysics_body_sleeping_threshold_set(EPhysics_Body *body, double linear_threshold, double angular_threshold);
|
||||||
|
@ -1509,29 +1509,17 @@ EAPI void ephysics_body_sleeping_threshold_set(EPhysics_Body *body, double linea
|
||||||
* Get the linear sleeping threshold.
|
* Get the linear sleeping threshold.
|
||||||
*
|
*
|
||||||
* @note The linear sleeping threshold is measured in Evas coordinates per
|
* @note The linear sleeping threshold is measured in Evas coordinates per
|
||||||
* second.
|
* second and the angular sleeping threshold is measured in degrees..
|
||||||
*
|
*
|
||||||
* @param body The body to get the linear sleeping threshold from.
|
* @param body The body to get the linear sleeping threshold from.
|
||||||
* @return The linear sleeping threshold from @p body.
|
* @param linear_threshold The linear sleeping threshold factor.
|
||||||
|
* @param angular_threshold The angular sleeping threshold factor.
|
||||||
|
*
|
||||||
|
* @see ephysics_body_sleeping_threshold_set() for more details.
|
||||||
*
|
*
|
||||||
* @see ephysics_body_sleeping_threshold_set()
|
|
||||||
* @ingroup EPhysics_Body
|
* @ingroup EPhysics_Body
|
||||||
*/
|
*/
|
||||||
EAPI double ephysics_body_linear_sleeping_threshold_get(const EPhysics_Body *body);
|
EAPI void ephysics_body_sleeping_threshold_get(const EPhysics_Body *body, double *linear_threshold, double *angular_threshold);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
* Get the angular sleeping threshold.
|
|
||||||
*
|
|
||||||
* @note The angular sleeping threshold is measured in degrees.
|
|
||||||
*
|
|
||||||
* @param body The body to get the angular sleeping threshold from.
|
|
||||||
* @return The angular sleeping threshold from @p body.
|
|
||||||
*
|
|
||||||
* @see ephysics_body_sleeping_threshold_set()
|
|
||||||
* @ingroup EPhysics_Body
|
|
||||||
*/
|
|
||||||
EAPI double ephysics_body_angular_sleeping_threshold_get(const EPhysics_Body *body);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
|
|
|
@ -786,31 +786,23 @@ ephysics_body_sleeping_threshold_set(EPhysics_Body *body, double linear_threshol
|
||||||
angular_threshold / RAD_TO_DEG);
|
angular_threshold / RAD_TO_DEG);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI double
|
EAPI void
|
||||||
ephysics_body_linear_sleeping_threshold_get(const EPhysics_Body *body)
|
ephysics_body_sleeping_threshold_get(const EPhysics_Body *body, double *linear_threshold, double *angular_threshold)
|
||||||
{
|
{
|
||||||
double rate;
|
double rate;
|
||||||
|
|
||||||
if (!body)
|
if (!body)
|
||||||
{
|
{
|
||||||
ERR("Can't get linear sleeping threshold, body is null.");
|
ERR("Can't get linear sleeping threshold, body is null.");
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rate = ephysics_world_rate_get(body->world);
|
rate = ephysics_world_rate_get(body->world);
|
||||||
return body->rigid_body->getLinearSleepingThreshold() * rate;
|
if (linear_threshold)
|
||||||
}
|
*linear_threshold = body->rigid_body->getLinearSleepingThreshold() * rate;
|
||||||
|
if (angular_threshold)
|
||||||
EAPI double
|
*angular_threshold = body->rigid_body->getAngularSleepingThreshold() *
|
||||||
ephysics_body_angular_sleeping_threshold_get(const EPhysics_Body *body)
|
RAD_TO_DEG;
|
||||||
{
|
|
||||||
if (!body)
|
|
||||||
{
|
|
||||||
ERR("Can't get angular sleeping threshold, body is null.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return body->rigid_body->getAngularSleepingThreshold() * RAD_TO_DEG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
|
Loading…
Reference in New Issue