aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ephysics/src/lib
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-11-23 21:43:25 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-11-23 21:43:25 +0000
commitfa05bab34341081ebc65d126fdfa54fc032c7469 (patch)
treee8b2c7426aa06f0f30295dc5090fcc5190fd1638 /legacy/ephysics/src/lib
parenta7e90dc5a777a0b4a954f61f85ff603b8a2a4d1b (diff)
downloadefl-fa05bab34341081ebc65d126fdfa54fc032c7469.tar.gz
efl-fa05bab34341081ebc65d126fdfa54fc032c7469.tar.xz
efl-fa05bab34341081ebc65d126fdfa54fc032c7469.zip
EPhysics: generate bending constraints just once
Unlikely the cluster generate bullet will not rebuild the bending constraints every call, so we must prevent creating duplicated constraints. Patch by: Leandro Dorileo <dorileo@profusion.mobi> SVN revision: 79591
Diffstat (limited to 'legacy/ephysics/src/lib')
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp16
-rw-r--r--legacy/ephysics/src/lib/ephysics_private.h1
2 files changed, 13 insertions, 4 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 89ca93cfb..9508eca2a 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -776,8 +776,12 @@ _ephysics_body_cloth_constraints_rebuild(EPhysics_Body *body)
}
}
soft_body->generateClusters(0);
- soft_body->generateBendingConstraints(2, soft_body->m_materials[
- body->material_index]);
+ if (!body->bending_constraints)
+ {
+ soft_body->generateBendingConstraints(2, soft_body->
+ m_materials[body->material_index]);
+ body->bending_constraints = EINA_TRUE;
+ }
}
static void
@@ -798,8 +802,12 @@ _ephysics_body_soft_body_constraints_rebuild(EPhysics_Body *body)
}
soft_body->generateClusters(0);
- soft_body->generateBendingConstraints(10, soft_body->m_materials[
- body->material_index]);
+ if (!body->bending_constraints)
+ {
+ soft_body->generateBendingConstraints(10, soft_body->
+ m_materials[body->material_index]);
+ body->bending_constraints = EINA_TRUE;
+ }
}
inline static double
diff --git a/legacy/ephysics/src/lib/ephysics_private.h b/legacy/ephysics/src/lib/ephysics_private.h
index 2e5c37345..85a41038e 100644
--- a/legacy/ephysics/src/lib/ephysics_private.h
+++ b/legacy/ephysics/src/lib/ephysics_private.h
@@ -151,6 +151,7 @@ struct _EPhysics_Body {
Eina_Bool back_face_culling:1;
Eina_Bool clockwise:1;
Eina_Bool boundary:1;
+ Eina_Bool bending_constraints:1;
};
extern int _ephysics_log_dom;