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
This commit is contained in:
Leandro Dorileo 2012-11-23 21:43:25 +00:00 committed by Bruno Dilly
parent a7e90dc5a7
commit fa05bab343
2 changed files with 13 additions and 4 deletions

View File

@ -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

View File

@ -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;