summaryrefslogtreecommitdiff
path: root/legacy/ephysics/src/lib/ephysics_body.cpp
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/ephysics_body.cpp
parent3909a4ba367490509786066aa1ee39256704583b (diff)
ephysics: warn if try to use functions not implemented
by clothes SVN revision: 80713
Diffstat (limited to '')
-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 8945f58ab3..7fb263a927 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -17,6 +17,15 @@
17extern "C" { 17extern "C" {
18#endif 18#endif
19 19
20#define BODY_CLOTH_CHECK() \
21 do { \
22 if (body->type == EPHYSICS_BODY_TYPE_CLOTH) \
23 { \
24 WRN("Not supported for cloth"); \
25 return; \
26 } \
27 } while(0);
28
20typedef struct _EPhysics_Body_Callback EPhysics_Body_Callback; 29typedef struct _EPhysics_Body_Callback EPhysics_Body_Callback;
21typedef struct _EPhysics_Body_Evas_Stacking EPhysics_Body_Evas_Stacking; 30typedef struct _EPhysics_Body_Evas_Stacking EPhysics_Body_Evas_Stacking;
22typedef struct _EPhysics_Body_Soft_Body_Slice EPhysics_Body_Soft_Body_Slice; 31typedef 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
3552 return; 3561 return;
3553 } 3562 }
3554 3563
3555 if (body->type == EPHYSICS_BODY_TYPE_CLOTH) 3564 BODY_CLOTH_CHECK();
3556 {
3557 ERR("Can't set angular velocity, not implemented for cloth.");
3558 return;
3559 }
3560 3565
3561 ephysics_world_lock_take(body->world); 3566 ephysics_world_lock_take(body->world);
3562 ephysics_body_activate(body, EINA_TRUE); 3567 ephysics_body_activate(body, EINA_TRUE);
@@ -3577,11 +3582,7 @@ ephysics_body_angular_velocity_get(const EPhysics_Body *body, double *x, double
3577 return; 3582 return;
3578 } 3583 }
3579 3584
3580 if (body->type == EPHYSICS_BODY_TYPE_CLOTH) 3585 BODY_CLOTH_CHECK();
3581 {
3582 ERR("Can't get angular velocity, not implemented for cloth.");
3583 return;
3584 }
3585 3586
3586 if (x) *x = -body->rigid_body->getAngularVelocity().getX() * RAD_TO_DEG; 3587 if (x) *x = -body->rigid_body->getAngularVelocity().getX() * RAD_TO_DEG;
3587 if (y) *y = -body->rigid_body->getAngularVelocity().getY() * RAD_TO_DEG; 3588 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
3597 return; 3598 return;
3598 } 3599 }
3599 3600
3601 BODY_CLOTH_CHECK();
3602
3600 ephysics_world_lock_take(body->world); 3603 ephysics_world_lock_take(body->world);
3601 _ephysics_body_sleeping_threshold_set(body, linear_threshold, 3604 _ephysics_body_sleeping_threshold_set(body, linear_threshold,
3602 angular_threshold, 3605 angular_threshold,
@@ -3615,6 +3618,8 @@ ephysics_body_sleeping_threshold_get(const EPhysics_Body *body, double *linear_t
3615 return; 3618 return;
3616 } 3619 }
3617 3620
3621 BODY_CLOTH_CHECK();
3622
3618 rate = ephysics_world_rate_get(body->world); 3623 rate = ephysics_world_rate_get(body->world);
3619 if (linear_threshold) 3624 if (linear_threshold)
3620 *linear_threshold = body->rigid_body->getLinearSleepingThreshold() * rate; 3625 *linear_threshold = body->rigid_body->getLinearSleepingThreshold() * rate;
@@ -3661,6 +3666,8 @@ ephysics_body_damping_set(EPhysics_Body *body, double linear_damping, double ang
3661 return; 3666 return;
3662 } 3667 }
3663 3668
3669 BODY_CLOTH_CHECK();
3670
3664 ephysics_world_lock_take(body->world); 3671 ephysics_world_lock_take(body->world);
3665 body->rigid_body->setDamping(btScalar(linear_damping), 3672 body->rigid_body->setDamping(btScalar(linear_damping),
3666 btScalar(angular_damping)); 3673 btScalar(angular_damping));
@@ -3676,6 +3683,8 @@ ephysics_body_damping_get(const EPhysics_Body *body, double *linear_damping, dou
3676 return; 3683 return;
3677 } 3684 }
3678 3685
3686 BODY_CLOTH_CHECK();
3687
3679 if (linear_damping) *linear_damping = body->rigid_body->getLinearDamping(); 3688 if (linear_damping) *linear_damping = body->rigid_body->getLinearDamping();
3680 if (angular_damping) *angular_damping = 3689 if (angular_damping) *angular_damping =
3681 body->rigid_body->getAngularDamping(); 3690 body->rigid_body->getAngularDamping();
@@ -3953,6 +3962,8 @@ ephysics_body_linear_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x
3953 return; 3962 return;
3954 } 3963 }
3955 3964
3965 BODY_CLOTH_CHECK();
3966
3956 ephysics_world_lock_take(body->world); 3967 ephysics_world_lock_take(body->world);
3957 body->rigid_body->setLinearFactor(btVector3(!!enable_x, !!enable_y, 3968 body->rigid_body->setLinearFactor(btVector3(!!enable_x, !!enable_y,
3958 !!enable_z)); 3969 !!enable_z));
@@ -3968,6 +3979,8 @@ ephysics_body_linear_movement_enable_get(const EPhysics_Body *body, Eina_Bool *e
3968 return; 3979 return;
3969 } 3980 }
3970 3981
3982 BODY_CLOTH_CHECK();
3983
3971 if (enable_x) *enable_x = !!body->rigid_body->getLinearFactor().x(); 3984 if (enable_x) *enable_x = !!body->rigid_body->getLinearFactor().x();
3972 if (enable_y) *enable_y = !!body->rigid_body->getLinearFactor().y(); 3985 if (enable_y) *enable_y = !!body->rigid_body->getLinearFactor().y();
3973 if (enable_z) *enable_z = !!body->rigid_body->getLinearFactor().z(); 3986 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_
3997 return; 4010 return;
3998 } 4011 }
3999 4012
4013 BODY_CLOTH_CHECK();
4014
4000 ephysics_world_lock_take(body->world); 4015 ephysics_world_lock_take(body->world);
4001 body->rigid_body->setAngularFactor(btVector3(!!enable_x, !!enable_y, 4016 body->rigid_body->setAngularFactor(btVector3(!!enable_x, !!enable_y,
4002 !!enable_z)); 4017 !!enable_z));
@@ -4012,6 +4027,8 @@ ephysics_body_angular_movement_enable_get(const EPhysics_Body *body, Eina_Bool *
4012 return; 4027 return;
4013 } 4028 }
4014 4029
4030 BODY_CLOTH_CHECK();
4031
4015 if (enable_x) *enable_x = !!body->rigid_body->getAngularFactor().x(); 4032 if (enable_x) *enable_x = !!body->rigid_body->getAngularFactor().x();
4016 if (enable_y) *enable_y = !!body->rigid_body->getAngularFactor().y(); 4033 if (enable_y) *enable_y = !!body->rigid_body->getAngularFactor().y();
4017 if (enable_z) *enable_z = !!body->rigid_body->getAngularFactor().z(); 4034 if (enable_z) *enable_z = !!body->rigid_body->getAngularFactor().z();