btSoftRigidDynamicsWorld.h

Go to the documentation of this file.
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 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

Generated on Mon Feb 15 22:17:06 2010 for Bullet Collision Detection & Physics Library by  doxygen 1.6.1