00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef BT_SOFT_RIGID_DYNAMICS_WORLD_H
00017 #define BT_SOFT_RIGID_DYNAMICS_WORLD_H
00018
00019 #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
00020 #include "btSoftBody.h"
00021
00022 typedef btAlignedObjectArray<btSoftBody*> btSoftBodyArray;
00023
00024 class btSoftRigidDynamicsWorld : public btDiscreteDynamicsWorld
00025 {
00026
00027 btSoftBodyArray m_softBodies;
00028 int m_drawFlags;
00029 bool m_drawNodeTree;
00030 bool m_drawFaceTree;
00031 bool m_drawClusterTree;
00032 btSoftBodyWorldInfo m_sbi;
00033
00034 protected:
00035
00036 virtual void predictUnconstraintMotion(btScalar timeStep);
00037
00038 virtual void internalSingleStepSimulation( btScalar timeStep);
00039
00040 void updateSoftBodies();
00041
00042 void solveSoftBodiesConstraints();
00043
00044
00045 public:
00046
00047 btSoftRigidDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration);
00048
00049 virtual ~btSoftRigidDynamicsWorld();
00050
00051 virtual void debugDrawWorld();
00052
00053 void addSoftBody(btSoftBody* body,short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter);
00054
00055 void removeSoftBody(btSoftBody* body);
00056
00058 virtual void removeCollisionObject(btCollisionObject* collisionObject);
00059
00060 int getDrawFlags() const { return(m_drawFlags); }
00061 void setDrawFlags(int f) { m_drawFlags=f; }
00062
00063 btSoftBodyWorldInfo& getWorldInfo()
00064 {
00065 return m_sbi;
00066 }
00067 const btSoftBodyWorldInfo& getWorldInfo() const
00068 {
00069 return m_sbi;
00070 }
00071
00072
00073 btSoftBodyArray& getSoftBodyArray()
00074 {
00075 return m_softBodies;
00076 }
00077
00078 const btSoftBodyArray& getSoftBodyArray() const
00079 {
00080 return m_softBodies;
00081 }
00082
00083
00084 virtual void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const;
00085
00089 static void rayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans,
00090 btCollisionObject* collisionObject,
00091 const btCollisionShape* collisionShape,
00092 const btTransform& colObjWorldTransform,
00093 RayResultCallback& resultCallback);
00094
00095 };
00096
00097 #endif //BT_SOFT_RIGID_DYNAMICS_WORLD_H