Bullet: synchronize soft body helpers with current SVN.
authorBenoit Bolsee <benoit.bolsee@online.be>
Tue, 22 Dec 2009 19:52:14 +0000 (19:52 +0000)
committerBenoit Bolsee <benoit.bolsee@online.be>
Tue, 22 Dec 2009 19:52:14 +0000 (19:52 +0000)
extern/bullet2/src/BulletSoftBody/btSoftBodyHelpers.cpp
extern/bullet2/src/BulletSoftBody/btSoftBodyHelpers.h

index 4f81b0953a2c6b21ef6bf091d602ff2a812257d6..61aac5b4ce552817991a952fcc96558426d55cc6 100644 (file)
@@ -793,7 +793,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;
@@ -828,14 +828,16 @@ btSoftBody*               btSoftBodyHelpers::CreateFromTriMesh(btSoftBodyWorldInfo& worldInfo
 #undef IDX
                psb->appendFace(idx[0],idx[1],idx[2]);
        }
-       // don't randomize now, let's give a chance to the application to set face data 
-       //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;
@@ -855,6 +857,9 @@ btSoftBody*         btSoftBodyHelpers::CreateFromConvexHull(btSoftBodyWorldInfo& worldI
                psb->appendFace(idx[0],idx[1],idx[2]);
        }
        hlib.ReleaseResult(hres);
-       psb->randomizeConstraints();
+       if (randomizeConstraints)
+       {
+               psb->randomizeConstraints();
+       }
        return(psb);
 }
index 0e3b50397ee659196f3e788abce700e322193c3f..5eb2ebc0735292938d6025f264a2a67073b207a9 100644 (file)
@@ -109,11 +109,13 @@ struct    btSoftBodyHelpers
        static  btSoftBody*             CreateFromTriMesh(      btSoftBodyWorldInfo& worldInfo,
                const btScalar* vertices,
                const int* triangles,
-               int ntriangles);
+               int ntriangles,
+               bool randomizeConstraints = true);
        /* Create from convex-hull                                                                                              */ 
        static  btSoftBody*             CreateFromConvexHull(   btSoftBodyWorldInfo& worldInfo,
                const btVector3* vertices,
-               int nvertices);
+               int nvertices,
+               bool randomizeConstraints = true);
 };
 
 #endif //SOFT_BODY_HELPERS_H