2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
11 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
16 #ifndef BT_DISPATCHER_H
17 #define BT_DISPATCHER_H
18 #include "LinearMath/btScalar.h"
20 class btCollisionAlgorithm;
21 struct btBroadphaseProxy;
23 class btCollisionObject;
24 class btOverlappingPairCache;
27 class btPersistentManifold;
29 class btPoolAllocator;
31 struct btDispatcherInfo
35 DISPATCH_DISCRETE = 1,
39 :m_timeStep(btScalar(0.)),
41 m_dispatchFunc(DISPATCH_DISCRETE),
42 m_timeOfImpact(btScalar(1.)),
43 m_useContinuous(true),
45 m_enableSatConvex(false),
48 m_allowedCcdPenetration(btScalar(0.04)),
49 m_useConvexConservativeDistanceUtil(false),
50 m_convexConservativeDistanceThreshold(0.0f),
58 mutable btScalar m_timeOfImpact;
60 class btIDebugDraw* m_debugDraw;
61 bool m_enableSatConvex;
64 btScalar m_allowedCcdPenetration;
65 bool m_useConvexConservativeDistanceUtil;
66 btScalar m_convexConservativeDistanceThreshold;
67 btStackAlloc* m_stackAllocator;
70 ///The btDispatcher interface class can be used in combination with broadphase to dispatch calculations for overlapping pairs.
71 ///For example for pairwise collision detection, calculating contact points stored in btPersistentManifold or user callbacks (game logic).
77 virtual ~btDispatcher() ;
79 virtual btCollisionAlgorithm* findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold=0) = 0;
81 virtual btPersistentManifold* getNewManifold(void* body0,void* body1)=0;
83 virtual void releaseManifold(btPersistentManifold* manifold)=0;
85 virtual void clearManifold(btPersistentManifold* manifold)=0;
87 virtual bool needsCollision(btCollisionObject* body0,btCollisionObject* body1) = 0;
89 virtual bool needsResponse(btCollisionObject* body0,btCollisionObject* body1)=0;
91 virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) =0;
93 virtual int getNumManifolds() const = 0;
95 virtual btPersistentManifold* getManifoldByIndexInternal(int index) = 0;
97 virtual btPersistentManifold** getInternalManifoldPointer() = 0;
99 virtual btPoolAllocator* getInternalManifoldPool() = 0;
101 virtual const btPoolAllocator* getInternalManifoldPool() const = 0;
103 virtual void* allocateCollisionAlgorithm(int size) = 0;
105 virtual void freeCollisionAlgorithm(void* ptr) = 0;
110 #endif //BT_DISPATCHER_H