Blender V2.61 - r43446
|
00001 /* 00002 Bullet Continuous Collision Detection and Physics Library 00003 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 00004 00005 This software is provided 'as-is', without any express or implied warranty. 00006 In no event will the authors be held liable for any damages arising from the use of this software. 00007 Permission is granted to anyone to use this software for any purpose, 00008 including commercial applications, and to alter it and redistribute it freely, 00009 subject to the following restrictions: 00010 00011 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 00013 3. This notice may not be removed or altered from any source distribution. 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 00077 btSoftBodyArray& getSoftBodyArray() 00078 { 00079 return m_softBodies; 00080 } 00081 00082 const btSoftBodyArray& getSoftBodyArray() const 00083 { 00084 return m_softBodies; 00085 } 00086 00087 00088 virtual void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const; 00089 00093 static void rayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans, 00094 btCollisionObject* collisionObject, 00095 const btCollisionShape* collisionShape, 00096 const btTransform& colObjWorldTransform, 00097 RayResultCallback& resultCallback); 00098 00099 virtual void serialize(btSerializer* serializer); 00100 00101 }; 00102 00103 #endif //BT_SOFT_RIGID_DYNAMICS_WORLD_H