Make 'randomizeConstraints' optional, switched on by default (to keep existing behaviour)

Thanks Benoit for the report: http://code.google.com/p/bullet/issues/detail?id=315
This commit is contained in:
erwin.coumans
2009-12-13 20:37:09 +00:00
parent 6536d8cc31
commit d7a07e9745
2 changed files with 16 additions and 6 deletions

View File

@@ -813,7 +813,7 @@ btSoftBody* btSoftBodyHelpers::CreateEllipsoid(btSoftBodyWorldInfo& worldInfo,c
//
btSoftBody* btSoftBodyHelpers::CreateFromTriMesh(btSoftBodyWorldInfo& worldInfo,const btScalar* vertices,
const int* triangles,
int ntriangles)
int ntriangles, bool randomizeConstraints)
{
int maxidx=0;
int i,j,ni;
@@ -848,13 +848,18 @@ btSoftBody* btSoftBodyHelpers::CreateFromTriMesh(btSoftBodyWorldInfo& worldInfo
#undef IDX
psb->appendFace(idx[0],idx[1],idx[2]);
}
psb->randomizeConstraints();
if (randomizeConstraints)
{
psb->randomizeConstraints();
}
return(psb);
}
//
btSoftBody* btSoftBodyHelpers::CreateFromConvexHull(btSoftBodyWorldInfo& worldInfo, const btVector3* vertices,
int nvertices)
int nvertices, bool randomizeConstraints)
{
HullDesc hdsc(QF_TRIANGLES,nvertices,vertices);
HullResult hres;
@@ -874,7 +879,10 @@ btSoftBody* btSoftBodyHelpers::CreateFromConvexHull(btSoftBodyWorldInfo& worldI
psb->appendFace(idx[0],idx[1],idx[2]);
}
hlib.ReleaseResult(hres);
psb->randomizeConstraints();
if (randomizeConstraints)
{
psb->randomizeConstraints();
}
return(psb);
}