1 | /* |
---|
2 | Bullet Continuous Collision Detection and Physics Library |
---|
3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ |
---|
4 | |
---|
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: |
---|
10 | |
---|
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. |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef _DISPATCHER_H |
---|
17 | #define _DISPATCHER_H |
---|
18 | |
---|
19 | #include "LinearMath/btScalar.h" |
---|
20 | |
---|
21 | class btCollisionAlgorithm; |
---|
22 | struct btBroadphaseProxy; |
---|
23 | class btRigidBody; |
---|
24 | class btCollisionObject; |
---|
25 | class btOverlappingPairCache; |
---|
26 | |
---|
27 | |
---|
28 | class btPersistentManifold; |
---|
29 | class btStackAlloc; |
---|
30 | |
---|
31 | struct btDispatcherInfo |
---|
32 | { |
---|
33 | enum DispatchFunc |
---|
34 | { |
---|
35 | DISPATCH_DISCRETE = 1, |
---|
36 | DISPATCH_CONTINUOUS |
---|
37 | }; |
---|
38 | btDispatcherInfo() |
---|
39 | :m_timeStep(btScalar(0.)), |
---|
40 | m_stepCount(0), |
---|
41 | m_dispatchFunc(DISPATCH_DISCRETE), |
---|
42 | m_timeOfImpact(btScalar(1.)), |
---|
43 | m_useContinuous(false), |
---|
44 | m_debugDraw(0), |
---|
45 | m_enableSatConvex(false), |
---|
46 | m_enableSPU(true), |
---|
47 | m_useEpa(true), |
---|
48 | m_allowedCcdPenetration(btScalar(0.04)), |
---|
49 | m_stackAllocator(0) |
---|
50 | { |
---|
51 | |
---|
52 | } |
---|
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 | btStackAlloc* m_stackAllocator; |
---|
64 | |
---|
65 | }; |
---|
66 | |
---|
67 | ///The btDispatcher interface class can be used in combination with broadphase to dispatch calculations for overlapping pairs. |
---|
68 | ///For example for pairwise collision detection, calculating contact points stored in btPersistentManifold or user callbacks (game logic). |
---|
69 | class btDispatcher |
---|
70 | { |
---|
71 | |
---|
72 | |
---|
73 | public: |
---|
74 | virtual ~btDispatcher() ; |
---|
75 | |
---|
76 | virtual btCollisionAlgorithm* findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold=0) = 0; |
---|
77 | |
---|
78 | virtual btPersistentManifold* getNewManifold(void* body0,void* body1)=0; |
---|
79 | |
---|
80 | virtual void releaseManifold(btPersistentManifold* manifold)=0; |
---|
81 | |
---|
82 | virtual void clearManifold(btPersistentManifold* manifold)=0; |
---|
83 | |
---|
84 | virtual bool needsCollision(btCollisionObject* body0,btCollisionObject* body1) = 0; |
---|
85 | |
---|
86 | virtual bool needsResponse(btCollisionObject* body0,btCollisionObject* body1)=0; |
---|
87 | |
---|
88 | virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) =0; |
---|
89 | |
---|
90 | virtual int getNumManifolds() const = 0; |
---|
91 | |
---|
92 | virtual btPersistentManifold* getManifoldByIndexInternal(int index) = 0; |
---|
93 | |
---|
94 | virtual btPersistentManifold** getInternalManifoldPointer() = 0; |
---|
95 | |
---|
96 | virtual void* allocateCollisionAlgorithm(int size) = 0; |
---|
97 | |
---|
98 | virtual void freeCollisionAlgorithm(void* ptr) = 0; |
---|
99 | |
---|
100 | }; |
---|
101 | |
---|
102 | |
---|
103 | #endif //_DISPATCHER_H |
---|