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_DISPATCHER_H
00017 #define BT_DISPATCHER_H
00018 #include "LinearMath/btScalar.h"
00019
00020 class btCollisionAlgorithm;
00021 struct btBroadphaseProxy;
00022 class btRigidBody;
00023 class btCollisionObject;
00024 class btOverlappingPairCache;
00025
00026
00027 class btPersistentManifold;
00028 class btStackAlloc;
00029 class btPoolAllocator;
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(true),
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_stackAllocator(0)
00052 {
00053
00054 }
00055 btScalar m_timeStep;
00056 int m_stepCount;
00057 int m_dispatchFunc;
00058 mutable btScalar m_timeOfImpact;
00059 bool m_useContinuous;
00060 class btIDebugDraw* m_debugDraw;
00061 bool m_enableSatConvex;
00062 bool m_enableSPU;
00063 bool m_useEpa;
00064 btScalar m_allowedCcdPenetration;
00065 bool m_useConvexConservativeDistanceUtil;
00066 btScalar m_convexConservativeDistanceThreshold;
00067 btStackAlloc* m_stackAllocator;
00068 };
00069
00072 class btDispatcher
00073 {
00074
00075
00076 public:
00077 virtual ~btDispatcher() ;
00078
00079 virtual btCollisionAlgorithm* findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold=0) = 0;
00080
00081 virtual btPersistentManifold* getNewManifold(void* body0,void* body1)=0;
00082
00083 virtual void releaseManifold(btPersistentManifold* manifold)=0;
00084
00085 virtual void clearManifold(btPersistentManifold* manifold)=0;
00086
00087 virtual bool needsCollision(btCollisionObject* body0,btCollisionObject* body1) = 0;
00088
00089 virtual bool needsResponse(btCollisionObject* body0,btCollisionObject* body1)=0;
00090
00091 virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) =0;
00092
00093 virtual int getNumManifolds() const = 0;
00094
00095 virtual btPersistentManifold* getManifoldByIndexInternal(int index) = 0;
00096
00097 virtual btPersistentManifold** getInternalManifoldPointer() = 0;
00098
00099 virtual btPoolAllocator* getInternalManifoldPool() = 0;
00100
00101 virtual const btPoolAllocator* getInternalManifoldPool() const = 0;
00102
00103 virtual void* allocateCollisionAlgorithm(int size) = 0;
00104
00105 virtual void freeCollisionAlgorithm(void* ptr) = 0;
00106
00107 };
00108
00109
00110 #endif //BT_DISPATCHER_H