aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ephysics/src/lib
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-12-10 17:15:11 +0000
committerLeandro Dorileo <dorileo@profusion.mobi>2012-12-10 17:15:11 +0000
commitd56bd9c189357d117fea631a5dc4e7465ea8fdfa (patch)
treec98a867a8826ffcd235105c2baf7d928f7b499e5 /legacy/ephysics/src/lib
parent8fed4fff457f435f81555203948563af51ee715c (diff)
downloadefl-d56bd9c189357d117fea631a5dc4e7465ea8fdfa.tar.gz
efl-d56bd9c189357d117fea631a5dc4e7465ea8fdfa.tar.xz
efl-d56bd9c189357d117fea631a5dc4e7465ea8fdfa.zip
EPHysics: change the location of _ephysics_body_geometry_set
--This line, and those below, will be ignored-- SVN revision: 80613
Diffstat (limited to 'legacy/ephysics/src/lib')
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 15c23a356..608c259db 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -962,6 +962,65 @@ _ephysics_body_mass_set(EPhysics_Body *body, double mass)
}
static void
+_ephysics_body_geometry_set(EPhysics_Body *body, Evas_Coord x, Evas_Coord y, Evas_Coord z, Evas_Coord w, Evas_Coord h, Evas_Coord d, double rate)
+{
+ double mx, my, mz, sx, sy, sz;
+ btTransform trans;
+ int wy, height;
+ btVector3 body_scale;
+
+ ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL,
+ NULL, &height, NULL);
+ height += wy;
+
+ mx = (x + w * body->cm.x) / rate;
+ my = (height - (y + h * body->cm.y)) / rate;
+ mz = (z + d * body->cm.z) / rate;
+ sx = (w <= 0) ? 1 : w / rate;
+ sy = (h <= 0) ? 1 : h / rate;
+ sz = (d <= 0) ? 1 : d / rate;
+
+ trans = _ephysics_body_transform_get(body);
+ trans.setOrigin(btVector3(mx, my, mz));
+ body_scale = btVector3(sx, sy, sz);
+
+ if (body->type == EPHYSICS_BODY_TYPE_SOFT)
+ {
+ body->soft_body->scale(btVector3(1, 1, 1) / body->scale);
+ body->soft_body->scale(body_scale);
+ body->rigid_body->proceedToTransform(trans);
+ _ephysics_body_transform_set(body, trans);
+ _ephysics_body_soft_body_constraints_rebuild(body);
+ }
+ else if (body->type == EPHYSICS_BODY_TYPE_CLOTH)
+ {
+ body->soft_body->scale(btVector3(1, 1, 1) / body->scale);
+ body->soft_body->scale(body_scale);
+ _ephysics_body_transform_set(body, trans);
+ _ephysics_body_cloth_constraints_rebuild(body);
+ }
+ else
+ {
+ body->collision_shape->setLocalScaling(body_scale);
+ body->rigid_body->proceedToTransform(trans);
+
+ if (!body->rigid_body->isStaticObject())
+ _ephysics_body_mass_set(body, ephysics_body_mass_get(body));
+ }
+
+ _ephysics_body_transform_set(body, trans);
+ ephysics_body_activate(body, EINA_TRUE);
+
+ body->size.w = w;
+ body->size.h = h;
+ body->size.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);
+}
+
+static void
_ephysics_body_resize(EPhysics_Body *body, Evas_Coord w, Evas_Coord h, Evas_Coord d)
{
double rate, sx, sy, sz;
@@ -1050,65 +1109,6 @@ _ephysics_body_move(EPhysics_Body *body, Evas_Coord x, Evas_Coord y, Evas_Coord
}
static void
-_ephysics_body_geometry_set(EPhysics_Body *body, Evas_Coord x, Evas_Coord y, Evas_Coord z, Evas_Coord w, Evas_Coord h, Evas_Coord d, double rate)
-{
- double mx, my, mz, sx, sy, sz;
- btTransform trans;
- int wy, height;
- btVector3 body_scale;
-
- ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL,
- NULL, &height, NULL);
- height += wy;
-
- mx = (x + w * body->cm.x) / rate;
- my = (height - (y + h * body->cm.y)) / rate;
- mz = (z + d * body->cm.z) / rate;
- sx = (w <= 0) ? 1 : w / rate;
- sy = (h <= 0) ? 1 : h / rate;
- sz = (d <= 0) ? 1 : d / rate;
-
- trans = _ephysics_body_transform_get(body);
- trans.setOrigin(btVector3(mx, my, mz));
- body_scale = btVector3(sx, sy, sz);
-
- if (body->type == EPHYSICS_BODY_TYPE_SOFT)
- {
- body->soft_body->scale(btVector3(1, 1, 1) / body->scale);
- body->soft_body->scale(body_scale);
- body->rigid_body->proceedToTransform(trans);
- _ephysics_body_transform_set(body, trans);
- _ephysics_body_soft_body_constraints_rebuild(body);
- }
- else if (body->type == EPHYSICS_BODY_TYPE_CLOTH)
- {
- body->soft_body->scale(btVector3(1, 1, 1) / body->scale);
- body->soft_body->scale(body_scale);
- _ephysics_body_transform_set(body, trans);
- _ephysics_body_cloth_constraints_rebuild(body);
- }
- else
- {
- body->collision_shape->setLocalScaling(body_scale);
- body->rigid_body->proceedToTransform(trans);
-
- if (!body->rigid_body->isStaticObject())
- _ephysics_body_mass_set(body, ephysics_body_mass_get(body));
- }
-
- _ephysics_body_transform_set(body, trans);
- ephysics_body_activate(body, EINA_TRUE);
-
- body->size.w = w;
- body->size.h = h;
- body->size.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);
-}
-
-static void
_ephysics_body_evas_obj_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
EPhysics_Body *body = (EPhysics_Body *) data;