Go to the documentation of this file.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 btSoftBodySolver;
00025
00026 class btSoftRigidDynamicsWorld : public btDiscreteDynamicsWorld
00027 {
00028
00029 btSoftBodyArray m_softBodies;
00030 int m_drawFlags;
00031 bool m_drawNodeTree;
00032 bool m_drawFaceTree;
00033 bool m_drawClusterTree;
00034 btSoftBodyWorldInfo m_sbi;
00036 btSoftBodySolver *m_softBodySolver;
00037 bool m_ownsSolver;
00038
00039 protected:
00040
00041 virtual void predictUnconstraintMotion(btScalar timeStep);
00042
00043 virtual void internalSingleStepSimulation( btScalar timeStep);
00044
00045 void solveSoftBodiesConstraints( btScalar timeStep );
00046
00047 void serializeSoftBodies(btSerializer* serializer);
00048
00049 public:
00050
00051 btSoftRigidDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver, btCollisionConfiguration* collisionConfiguration, btSoftBodySolver *softBodySolver = 0 );
00052
00053 virtual ~btSoftRigidDynamicsWorld();
00054
00055 virtual void debugDrawWorld();
00056
00057 void addSoftBody(btSoftBody* body,short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter);
00058
00059 void removeSoftBody(btSoftBody* body);
00060
00062 virtual void removeCollisionObject(btCollisionObject* collisionObject);
00063
00064 int getDrawFlags() const { return(m_drawFlags); }
00065 void setDrawFlags(int f) { m_drawFlags=f; }
00066
00067 btSoftBodyWorldInfo& getWorldInfo()
00068 {
00069 return m_sbi;
00070 }
00071 const btSoftBodyWorldInfo& getWorldInfo() const
00072 {
00073 return m_sbi;
00074 }
00075
00076 virtual btDynamicsWorldType getWorldType() const
00077 {
00078 return BT_SOFT_RIGID_DYNAMICS_WORLD;
00079 }
00080
00081 btSoftBodyArray& getSoftBodyArray()
00082 {
00083 return m_softBodies;
00084 }
00085
00086 const btSoftBodyArray& getSoftBodyArray() const
00087 {
00088 return m_softBodies;
00089 }
00090
00091
00092 virtual void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const;
00093
00097 static void rayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans,
00098 btCollisionObject* collisionObject,
00099 const btCollisionShape* collisionShape,
00100 const btTransform& colObjWorldTransform,
00101 RayResultCallback& resultCallback);
00102
00103 virtual void serialize(btSerializer* serializer);
00104
00105 };
00106
00107 #endif //BT_SOFT_RIGID_DYNAMICS_WORLD_H