Blender V2.61 - r43446

btDispatcher.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 _DISPATCHER_H
00017 #define _DISPATCHER_H
00018 
00019 #include "LinearMath/btScalar.h"
00020 
00021 class btCollisionAlgorithm;
00022 struct btBroadphaseProxy;
00023 class btRigidBody;
00024 class   btCollisionObject;
00025 class btOverlappingPairCache;
00026 
00027 
00028 class btPersistentManifold;
00029 class btStackAlloc;
00030 
00031 struct btDispatcherInfo
00032 {
00033     enum DispatchFunc
00034     {
00035         DISPATCH_DISCRETE = 1,
00036         DISPATCH_CONTINUOUS
00037     };
00038     btDispatcherInfo()
00039         :m_timeStep(btScalar(0.)),
00040         m_stepCount(0),
00041         m_dispatchFunc(DISPATCH_DISCRETE),
00042         m_timeOfImpact(btScalar(1.)),
00043         m_useContinuous(false),
00044         m_debugDraw(0),
00045         m_enableSatConvex(false),
00046         m_enableSPU(true),
00047         m_useEpa(true),
00048         m_allowedCcdPenetration(btScalar(0.04)),
00049         m_useConvexConservativeDistanceUtil(false),
00050         m_convexConservativeDistanceThreshold(0.0f),
00051         m_convexMaxDistanceUseCPT(false),
00052         m_stackAllocator(0)
00053     {
00054 
00055     }
00056     btScalar    m_timeStep;
00057     int         m_stepCount;
00058     int         m_dispatchFunc;
00059     mutable btScalar    m_timeOfImpact;
00060     bool        m_useContinuous;
00061     class btIDebugDraw* m_debugDraw;
00062     bool        m_enableSatConvex;
00063     bool        m_enableSPU;
00064     bool        m_useEpa;
00065     btScalar    m_allowedCcdPenetration;
00066     bool        m_useConvexConservativeDistanceUtil;
00067     btScalar    m_convexConservativeDistanceThreshold;
00068     bool        m_convexMaxDistanceUseCPT;
00069     btStackAlloc*   m_stackAllocator;
00070 };
00071 
00074 class btDispatcher
00075 {
00076 
00077 
00078 public:
00079     virtual ~btDispatcher() ;
00080 
00081     virtual btCollisionAlgorithm* findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold=0) = 0;
00082 
00083     virtual btPersistentManifold*   getNewManifold(void* body0,void* body1)=0;
00084 
00085     virtual void releaseManifold(btPersistentManifold* manifold)=0;
00086 
00087     virtual void clearManifold(btPersistentManifold* manifold)=0;
00088 
00089     virtual bool    needsCollision(btCollisionObject* body0,btCollisionObject* body1) = 0;
00090 
00091     virtual bool    needsResponse(btCollisionObject* body0,btCollisionObject* body1)=0;
00092 
00093     virtual void    dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher)  =0;
00094 
00095     virtual int getNumManifolds() const = 0;
00096 
00097     virtual btPersistentManifold* getManifoldByIndexInternal(int index) = 0;
00098 
00099     virtual btPersistentManifold**  getInternalManifoldPointer() = 0;
00100 
00101     virtual void* allocateCollisionAlgorithm(int size)  = 0;
00102 
00103     virtual void freeCollisionAlgorithm(void* ptr) = 0;
00104 
00105 };
00106 
00107 
00108 #endif //_DISPATCHER_H