some minor work on soft body, to make it easier to integrate into apps.
This commit is contained in:
@@ -29,7 +29,7 @@ subject to the following restrictions:
|
||||
#include "BulletCollision/BroadphaseCollision/btDbvt.h"
|
||||
|
||||
class btBroadphaseInterface;
|
||||
class btCollisionDispatcher;
|
||||
class btDispatcher;
|
||||
|
||||
/* btSoftBodyWorldInfo */
|
||||
struct btSoftBodyWorldInfo
|
||||
@@ -39,7 +39,7 @@ struct btSoftBodyWorldInfo
|
||||
btScalar water_offset;
|
||||
btVector3 water_normal;
|
||||
btBroadphaseInterface* m_broadphase;
|
||||
btCollisionDispatcher* m_dispatcher;
|
||||
btDispatcher* m_dispatcher;
|
||||
btVector3 m_gravity;
|
||||
btSparseSdf<3> m_sparsesdf;
|
||||
};
|
||||
@@ -607,6 +607,7 @@ public:
|
||||
virtual ~btSoftBody();
|
||||
/* Check for existing link */
|
||||
|
||||
btAlignedObjectArray<int> m_userIndexMapping;
|
||||
|
||||
virtual void setCollisionShape(btCollisionShape* collisionShape)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,10 @@ subject to the following restrictions:
|
||||
#include "btSoftBody.h"
|
||||
#include "btSoftBodyHelpers.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
btSoftRigidDynamicsWorld::btSoftRigidDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration)
|
||||
:btDiscreteDynamicsWorld(dispatcher,pairCache,constraintSolver,collisionConfiguration)
|
||||
{
|
||||
@@ -28,6 +32,11 @@ m_drawFlags = fDrawFlags::Std;
|
||||
m_drawNodeTree = true;
|
||||
m_drawFaceTree = false;
|
||||
m_drawClusterTree = false;
|
||||
m_sbi.m_broadphase = pairCache;
|
||||
m_sbi.m_dispatcher = dispatcher;
|
||||
m_sbi.m_sparsesdf.Initialize();
|
||||
m_sbi.m_sparsesdf.Reset();
|
||||
|
||||
}
|
||||
|
||||
btSoftRigidDynamicsWorld::~btSoftRigidDynamicsWorld()
|
||||
|
||||
@@ -13,12 +13,12 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
|
||||
|
||||
#ifndef BT_SOFT_RIGID_DYNAMICS_WORLD_H
|
||||
#define BT_SOFT_RIGID_DYNAMICS_WORLD_H
|
||||
|
||||
class btSoftBody;
|
||||
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
|
||||
#include "btSoftBody.h"
|
||||
|
||||
typedef btAlignedObjectArray<btSoftBody*> btSoftBodyArray;
|
||||
|
||||
class btSoftRigidDynamicsWorld : public btDiscreteDynamicsWorld
|
||||
@@ -29,7 +29,8 @@ class btSoftRigidDynamicsWorld : public btDiscreteDynamicsWorld
|
||||
bool m_drawNodeTree;
|
||||
bool m_drawFaceTree;
|
||||
bool m_drawClusterTree;
|
||||
|
||||
btSoftBodyWorldInfo m_sbi;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void predictUnconstraintMotion(btScalar timeStep);
|
||||
@@ -40,7 +41,6 @@ protected:
|
||||
|
||||
void solveSoftBodiesConstraints();
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@@ -57,6 +57,15 @@ public:
|
||||
int getDrawFlags() const { return(m_drawFlags); }
|
||||
void setDrawFlags(int f) { m_drawFlags=f; }
|
||||
|
||||
btSoftBodyWorldInfo& getWorldInfo()
|
||||
{
|
||||
return m_sbi;
|
||||
}
|
||||
const btSoftBodyWorldInfo& getWorldInfo() const
|
||||
{
|
||||
return m_sbi;
|
||||
}
|
||||
|
||||
|
||||
btSoftBodyArray& getSoftBodyArray()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user