aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ephysics/src/lib
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-12-11 20:48:24 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-12-11 20:48:24 +0000
commit6891e9a0e8763523ce96b5e9ea7e750fe9bcaafb (patch)
treee2457450715d7832d04bdde219d101c71bc8ff22 /legacy/ephysics/src/lib
parent3909a4ba367490509786066aa1ee39256704583b (diff)
downloadefl-6891e9a0e8763523ce96b5e9ea7e750fe9bcaafb.tar.gz
efl-6891e9a0e8763523ce96b5e9ea7e750fe9bcaafb.tar.xz
efl-6891e9a0e8763523ce96b5e9ea7e750fe9bcaafb.zip
ephysics: warn if try to use functions not implemented
by clothes SVN revision: 80713
Diffstat (limited to 'legacy/ephysics/src/lib')
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 8945f58ab..7fb263a92 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -17,6 +17,15 @@
extern "C" {
#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_Evas_Stacking EPhysics_Body_Evas_Stacking;
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;
}
- if (body->type == EPHYSICS_BODY_TYPE_CLOTH)
- {
- ERR("Can't set angular velocity, not implemented for cloth.");
- return;
- }
+ BODY_CLOTH_CHECK();
ephysics_world_lock_take(body->world);
ephysics_body_activate(body, EINA_TRUE);
@@ -3577,11 +3582,7 @@ ephysics_body_angular_velocity_get(const EPhysics_Body *body, double *x, double
return;
}
- if (body->type == EPHYSICS_BODY_TYPE_CLOTH)
- {
- ERR("Can't get angular velocity, not implemented for cloth.");
- return;
- }
+ BODY_CLOTH_CHECK();
if (x) *x = -body->rigid_body->getAngularVelocity().getX() * 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;
}
+ BODY_CLOTH_CHECK();
+
ephysics_world_lock_take(body->world);
_ephysics_body_sleeping_threshold_set(body, linear_threshold,
angular_threshold,
@@ -3615,6 +3618,8 @@ ephysics_body_sleeping_threshold_get(const EPhysics_Body *body, double *linear_t
return;
}
+ BODY_CLOTH_CHECK();
+
rate = ephysics_world_rate_get(body->world);
if (linear_threshold)
*linear_threshold = body->rigid_body->getLinearSleepingThreshold() * rate;
@@ -3661,6 +3666,8 @@ ephysics_body_damping_set(EPhysics_Body *body, double linear_damping, double ang
return;
}
+ BODY_CLOTH_CHECK();
+
ephysics_world_lock_take(body->world);
body->rigid_body->setDamping(btScalar(linear_damping),
btScalar(angular_damping));
@@ -3676,6 +3683,8 @@ ephysics_body_damping_get(const EPhysics_Body *body, double *linear_damping, dou
return;
}
+ BODY_CLOTH_CHECK();
+
if (linear_damping) *linear_damping = body->rigid_body->getLinearDamping();
if (angular_damping) *angular_damping =
body->rigid_body->getAngularDamping();
@@ -3953,6 +3962,8 @@ ephysics_body_linear_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x
return;
}
+ BODY_CLOTH_CHECK();
+
ephysics_world_lock_take(body->world);
body->rigid_body->setLinearFactor(btVector3(!!enable_x, !!enable_y,
!!enable_z));
@@ -3968,6 +3979,8 @@ ephysics_body_linear_movement_enable_get(const EPhysics_Body *body, Eina_Bool *e
return;
}
+ BODY_CLOTH_CHECK();
+
if (enable_x) *enable_x = !!body->rigid_body->getLinearFactor().x();
if (enable_y) *enable_y = !!body->rigid_body->getLinearFactor().y();
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;
}
+ BODY_CLOTH_CHECK();
+
ephysics_world_lock_take(body->world);
body->rigid_body->setAngularFactor(btVector3(!!enable_x, !!enable_y,
!!enable_z));
@@ -4012,6 +4027,8 @@ ephysics_body_angular_movement_enable_get(const EPhysics_Body *body, Eina_Bool *
return;
}
+ BODY_CLOTH_CHECK();
+
if (enable_x) *enable_x = !!body->rigid_body->getAngularFactor().x();
if (enable_y) *enable_y = !!body->rigid_body->getAngularFactor().y();
if (enable_z) *enable_z = !!body->rigid_body->getAngularFactor().z();