aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-10-25 21:54:06 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-25 21:54:06 +0000
commit5d3d4978ad1bec1f480ae3742afdb4c2a590c3ae (patch)
tree7dd09876b8cc9261c2b6cf0bc28221a59f6a7204
parent4906b47a59c03b39d38ba3db29274d3338eeabb5 (diff)
downloadefl-5d3d4978ad1bec1f480ae3742afdb4c2a590c3ae.tar.gz
efl-5d3d4978ad1bec1f480ae3742afdb4c2a590c3ae.tar.xz
efl-5d3d4978ad1bec1f480ae3742afdb4c2a590c3ae.zip
EPhysics: soft body geometry get fix
Since every shape has its own implementation for local scaling it`s better to trust just our selves and hold it for further calculations. Patch by: Leandro Dorileo <dorileo@profusion.mobi> SVN revision: 78482
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp13
-rw-r--r--legacy/ephysics/src/lib/ephysics_private.h1
2 files changed, 4 insertions, 10 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 248e27cb5..312ceffca 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -455,15 +455,6 @@ _ephysics_body_transform_set(EPhysics_Body *body, btTransform trans)
body->rigid_body->getMotionState()->setWorldTransform(trans);
}
-static btVector3
-_ephysics_body_scale_get(const EPhysics_Body *body)
-{
- if (body->type == EPHYSICS_BODY_TYPE_RIGID)
- return body->collision_shape->getLocalScaling();
-
- return body->soft_body->getCollisionShape()->getLocalScaling();
-}
-
void
ephysics_body_activate(const EPhysics_Body *body, Eina_Bool activate)
{
@@ -658,6 +649,7 @@ _ephysics_body_new(EPhysics_World *world, btScalar mass, double cm_x, double cm_
return NULL;
}
+ body->scale = btVector3(1, 1, 1);
body->mass = mass;
body->world = world;
body->cm.x = cm_x;
@@ -987,6 +979,7 @@ _ephysics_body_geometry_set(EPhysics_Body *body, Evas_Coord x, Evas_Coord y, Eva
body->w = w;
body->h = h;
body->d = d;
+ body->scale = body_scale;
DBG("Body %p position changed to (%lf, %lf, %lf).", body, mx, my, mz);
DBG("Body %p scale changed to (%lf, %lf, %lf).", body, sx, sy, sz);
@@ -2379,7 +2372,7 @@ ephysics_body_geometry_get(const EPhysics_Body *body, Evas_Coord *x, Evas_Coord
}
trans = _ephysics_body_transform_get(body);
- scale = _ephysics_body_scale_get(body);
+ scale = body->scale;
rate = ephysics_world_rate_get(body->world);
ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL,
diff --git a/legacy/ephysics/src/lib/ephysics_private.h b/legacy/ephysics/src/lib/ephysics_private.h
index 41c819830..3cb54d934 100644
--- a/legacy/ephysics/src/lib/ephysics_private.h
+++ b/legacy/ephysics/src/lib/ephysics_private.h
@@ -86,6 +86,7 @@ struct _EPhysics_Body {
Evas_Coord w;
Evas_Coord h;
Evas_Coord d;
+ btVector3 scale;
void *data;
Eina_Inlist *callbacks;
Eina_List *collision_groups;