Bullet 2.85 update
[Torque-3d.git] / Engine / lib / bullet / src / BulletCollision / BroadphaseCollision / btDispatcher.h
blob7b0f9489afd5d69cb0afac5b9895aac643cd1377
1 /*
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;
22 class btRigidBody;
23 class btCollisionObject;
24 class btOverlappingPairCache;
25 struct btCollisionObjectWrapper;
27 class btPersistentManifold;
28 class btPoolAllocator;
30 struct btDispatcherInfo
32 enum DispatchFunc
34 DISPATCH_DISCRETE = 1,
35 DISPATCH_CONTINUOUS
37 btDispatcherInfo()
38 :m_timeStep(btScalar(0.)),
39 m_stepCount(0),
40 m_dispatchFunc(DISPATCH_DISCRETE),
41 m_timeOfImpact(btScalar(1.)),
42 m_useContinuous(true),
43 m_debugDraw(0),
44 m_enableSatConvex(false),
45 m_enableSPU(true),
46 m_useEpa(true),
47 m_allowedCcdPenetration(btScalar(0.04)),
48 m_useConvexConservativeDistanceUtil(false),
49 m_convexConservativeDistanceThreshold(0.0f)
53 btScalar m_timeStep;
54 int m_stepCount;
55 int m_dispatchFunc;
56 mutable btScalar m_timeOfImpact;
57 bool m_useContinuous;
58 class btIDebugDraw* m_debugDraw;
59 bool m_enableSatConvex;
60 bool m_enableSPU;
61 bool m_useEpa;
62 btScalar m_allowedCcdPenetration;
63 bool m_useConvexConservativeDistanceUtil;
64 btScalar m_convexConservativeDistanceThreshold;
67 enum ebtDispatcherQueryType
69 BT_CONTACT_POINT_ALGORITHMS = 1,
70 BT_CLOSEST_POINT_ALGORITHMS = 2
73 ///The btDispatcher interface class can be used in combination with broadphase to dispatch calculations for overlapping pairs.
74 ///For example for pairwise collision detection, calculating contact points stored in btPersistentManifold or user callbacks (game logic).
75 class btDispatcher
79 public:
80 virtual ~btDispatcher() ;
82 virtual btCollisionAlgorithm* findAlgorithm(const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,btPersistentManifold* sharedManifold, ebtDispatcherQueryType queryType) = 0;
84 virtual btPersistentManifold* getNewManifold(const btCollisionObject* b0,const btCollisionObject* b1)=0;
86 virtual void releaseManifold(btPersistentManifold* manifold)=0;
88 virtual void clearManifold(btPersistentManifold* manifold)=0;
90 virtual bool needsCollision(const btCollisionObject* body0,const btCollisionObject* body1) = 0;
92 virtual bool needsResponse(const btCollisionObject* body0,const btCollisionObject* body1)=0;
94 virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) =0;
96 virtual int getNumManifolds() const = 0;
98 virtual btPersistentManifold* getManifoldByIndexInternal(int index) = 0;
100 virtual btPersistentManifold** getInternalManifoldPointer() = 0;
102 virtual btPoolAllocator* getInternalManifoldPool() = 0;
104 virtual const btPoolAllocator* getInternalManifoldPool() const = 0;
106 virtual void* allocateCollisionAlgorithm(int size) = 0;
108 virtual void freeCollisionAlgorithm(void* ptr) = 0;
113 #endif //BT_DISPATCHER_H