forked from enlightenment/efl
ephysics: warn if try to use functions not implemented
by clothes SVN revision: 80713
This commit is contained in:
parent
3909a4ba36
commit
6891e9a0e8
|
@ -17,6 +17,15 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define BODY_CLOTH_CHECK() \
|
||||||
|
do { \
|
||||||
|
if (body->type == EPHYSICS_BODY_TYPE_CLOTH) \
|
||||||
|
{ \
|
||||||
|
WRN("Not supported for cloth"); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
} while(0);
|
||||||
|
|
||||||
typedef struct _EPhysics_Body_Callback EPhysics_Body_Callback;
|
typedef struct _EPhysics_Body_Callback EPhysics_Body_Callback;
|
||||||
typedef struct _EPhysics_Body_Evas_Stacking EPhysics_Body_Evas_Stacking;
|
typedef struct _EPhysics_Body_Evas_Stacking EPhysics_Body_Evas_Stacking;
|
||||||
typedef struct _EPhysics_Body_Soft_Body_Slice EPhysics_Body_Soft_Body_Slice;
|
typedef struct _EPhysics_Body_Soft_Body_Slice EPhysics_Body_Soft_Body_Slice;
|
||||||
|
@ -3552,11 +3561,7 @@ ephysics_body_angular_velocity_set(EPhysics_Body *body, double x, double y, doub
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body->type == EPHYSICS_BODY_TYPE_CLOTH)
|
BODY_CLOTH_CHECK();
|
||||||
{
|
|
||||||
ERR("Can't set angular velocity, not implemented for cloth.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ephysics_world_lock_take(body->world);
|
ephysics_world_lock_take(body->world);
|
||||||
ephysics_body_activate(body, EINA_TRUE);
|
ephysics_body_activate(body, EINA_TRUE);
|
||||||
|
@ -3577,11 +3582,7 @@ ephysics_body_angular_velocity_get(const EPhysics_Body *body, double *x, double
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body->type == EPHYSICS_BODY_TYPE_CLOTH)
|
BODY_CLOTH_CHECK();
|
||||||
{
|
|
||||||
ERR("Can't get angular velocity, not implemented for cloth.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x) *x = -body->rigid_body->getAngularVelocity().getX() * RAD_TO_DEG;
|
if (x) *x = -body->rigid_body->getAngularVelocity().getX() * RAD_TO_DEG;
|
||||||
if (y) *y = -body->rigid_body->getAngularVelocity().getY() * RAD_TO_DEG;
|
if (y) *y = -body->rigid_body->getAngularVelocity().getY() * RAD_TO_DEG;
|
||||||
|
@ -3597,6 +3598,8 @@ ephysics_body_sleeping_threshold_set(EPhysics_Body *body, double linear_threshol
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BODY_CLOTH_CHECK();
|
||||||
|
|
||||||
ephysics_world_lock_take(body->world);
|
ephysics_world_lock_take(body->world);
|
||||||
_ephysics_body_sleeping_threshold_set(body, linear_threshold,
|
_ephysics_body_sleeping_threshold_set(body, linear_threshold,
|
||||||
angular_threshold,
|
angular_threshold,
|
||||||
|
@ -3615,6 +3618,8 @@ ephysics_body_sleeping_threshold_get(const EPhysics_Body *body, double *linear_t
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BODY_CLOTH_CHECK();
|
||||||
|
|
||||||
rate = ephysics_world_rate_get(body->world);
|
rate = ephysics_world_rate_get(body->world);
|
||||||
if (linear_threshold)
|
if (linear_threshold)
|
||||||
*linear_threshold = body->rigid_body->getLinearSleepingThreshold() * rate;
|
*linear_threshold = body->rigid_body->getLinearSleepingThreshold() * rate;
|
||||||
|
@ -3661,6 +3666,8 @@ ephysics_body_damping_set(EPhysics_Body *body, double linear_damping, double ang
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BODY_CLOTH_CHECK();
|
||||||
|
|
||||||
ephysics_world_lock_take(body->world);
|
ephysics_world_lock_take(body->world);
|
||||||
body->rigid_body->setDamping(btScalar(linear_damping),
|
body->rigid_body->setDamping(btScalar(linear_damping),
|
||||||
btScalar(angular_damping));
|
btScalar(angular_damping));
|
||||||
|
@ -3676,6 +3683,8 @@ ephysics_body_damping_get(const EPhysics_Body *body, double *linear_damping, dou
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BODY_CLOTH_CHECK();
|
||||||
|
|
||||||
if (linear_damping) *linear_damping = body->rigid_body->getLinearDamping();
|
if (linear_damping) *linear_damping = body->rigid_body->getLinearDamping();
|
||||||
if (angular_damping) *angular_damping =
|
if (angular_damping) *angular_damping =
|
||||||
body->rigid_body->getAngularDamping();
|
body->rigid_body->getAngularDamping();
|
||||||
|
@ -3953,6 +3962,8 @@ ephysics_body_linear_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BODY_CLOTH_CHECK();
|
||||||
|
|
||||||
ephysics_world_lock_take(body->world);
|
ephysics_world_lock_take(body->world);
|
||||||
body->rigid_body->setLinearFactor(btVector3(!!enable_x, !!enable_y,
|
body->rigid_body->setLinearFactor(btVector3(!!enable_x, !!enable_y,
|
||||||
!!enable_z));
|
!!enable_z));
|
||||||
|
@ -3968,6 +3979,8 @@ ephysics_body_linear_movement_enable_get(const EPhysics_Body *body, Eina_Bool *e
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BODY_CLOTH_CHECK();
|
||||||
|
|
||||||
if (enable_x) *enable_x = !!body->rigid_body->getLinearFactor().x();
|
if (enable_x) *enable_x = !!body->rigid_body->getLinearFactor().x();
|
||||||
if (enable_y) *enable_y = !!body->rigid_body->getLinearFactor().y();
|
if (enable_y) *enable_y = !!body->rigid_body->getLinearFactor().y();
|
||||||
if (enable_z) *enable_z = !!body->rigid_body->getLinearFactor().z();
|
if (enable_z) *enable_z = !!body->rigid_body->getLinearFactor().z();
|
||||||
|
@ -3997,6 +4010,8 @@ ephysics_body_angular_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BODY_CLOTH_CHECK();
|
||||||
|
|
||||||
ephysics_world_lock_take(body->world);
|
ephysics_world_lock_take(body->world);
|
||||||
body->rigid_body->setAngularFactor(btVector3(!!enable_x, !!enable_y,
|
body->rigid_body->setAngularFactor(btVector3(!!enable_x, !!enable_y,
|
||||||
!!enable_z));
|
!!enable_z));
|
||||||
|
@ -4012,6 +4027,8 @@ ephysics_body_angular_movement_enable_get(const EPhysics_Body *body, Eina_Bool *
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BODY_CLOTH_CHECK();
|
||||||
|
|
||||||
if (enable_x) *enable_x = !!body->rigid_body->getAngularFactor().x();
|
if (enable_x) *enable_x = !!body->rigid_body->getAngularFactor().x();
|
||||||
if (enable_y) *enable_y = !!body->rigid_body->getAngularFactor().y();
|
if (enable_y) *enable_y = !!body->rigid_body->getAngularFactor().y();
|
||||||
if (enable_z) *enable_z = !!body->rigid_body->getAngularFactor().z();
|
if (enable_z) *enable_z = !!body->rigid_body->getAngularFactor().z();
|
||||||
|
|
Loading…
Reference in New Issue