Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/spaceraceTwo/src/external/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.h @ 8881

Last change on this file since 8881 was 8393, checked in by rgrieder, 14 years ago

Updated Bullet from v2.77 to v2.78.
(I'm not going to make a branch for that since the update from 2.74 to 2.77 hasn't been tested that much either).

You will HAVE to do a complete RECOMPILE! I tested with MSVC and MinGW and they both threw linker errors at me.

  • Property svn:eol-style set to native
File size: 5.0 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BT_COLLISION__DISPATCHER_H
17#define BT_COLLISION__DISPATCHER_H
18
19#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
20#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
21
22#include "BulletCollision/CollisionDispatch/btManifoldResult.h"
23
24#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
25#include "LinearMath/btAlignedObjectArray.h"
26
27class btIDebugDraw;
28class btOverlappingPairCache;
29class btPoolAllocator;
30class btCollisionConfiguration;
31
32#include "btCollisionCreateFunc.h"
33
34#define USE_DISPATCH_REGISTRY_ARRAY 1
35
36class btCollisionDispatcher;
37///user can override this nearcallback for collision filtering and more finegrained control over collision detection
38typedef void (*btNearCallback)(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, const btDispatcherInfo& dispatchInfo);
39
40
41///btCollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs.
42///Time of Impact, Closest Points and Penetration Depth.
43class btCollisionDispatcher : public btDispatcher
44{
45
46protected:
47
48        int             m_dispatcherFlags;
49
50        btAlignedObjectArray<btPersistentManifold*>     m_manifoldsPtr;
51
52        btManifoldResult        m_defaultManifoldResult;
53
54        btNearCallback          m_nearCallback;
55       
56        btPoolAllocator*        m_collisionAlgorithmPoolAllocator;
57
58        btPoolAllocator*        m_persistentManifoldPoolAllocator;
59
60        btCollisionAlgorithmCreateFunc* m_doubleDispatch[MAX_BROADPHASE_COLLISION_TYPES][MAX_BROADPHASE_COLLISION_TYPES];
61
62        btCollisionConfiguration*       m_collisionConfiguration;
63
64
65public:
66
67        enum DispatcherFlags
68        {
69                CD_STATIC_STATIC_REPORTED = 1,
70                CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD = 2,
71                CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION = 4
72        };
73
74        int     getDispatcherFlags() const
75        {
76                return m_dispatcherFlags;
77        }
78
79        void    setDispatcherFlags(int flags)
80        {
81                m_dispatcherFlags = flags;
82        }
83
84        ///registerCollisionCreateFunc allows registration of custom/alternative collision create functions
85        void    registerCollisionCreateFunc(int proxyType0,int proxyType1, btCollisionAlgorithmCreateFunc* createFunc);
86
87        int     getNumManifolds() const
88        { 
89                return int( m_manifoldsPtr.size());
90        }
91
92        btPersistentManifold**  getInternalManifoldPointer()
93        {
94                return &m_manifoldsPtr[0];
95        }
96
97         btPersistentManifold* getManifoldByIndexInternal(int index)
98        {
99                return m_manifoldsPtr[index];
100        }
101
102         const btPersistentManifold* getManifoldByIndexInternal(int index) const
103        {
104                return m_manifoldsPtr[index];
105        }
106
107        btCollisionDispatcher (btCollisionConfiguration* collisionConfiguration);
108
109        virtual ~btCollisionDispatcher();
110
111        virtual btPersistentManifold*   getNewManifold(void* b0,void* b1);
112       
113        virtual void releaseManifold(btPersistentManifold* manifold);
114
115
116        virtual void clearManifold(btPersistentManifold* manifold);
117
118                       
119        btCollisionAlgorithm* findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold = 0);
120               
121        virtual bool    needsCollision(btCollisionObject* body0,btCollisionObject* body1);
122       
123        virtual bool    needsResponse(btCollisionObject* body0,btCollisionObject* body1);
124       
125        virtual void    dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) ;
126
127        void    setNearCallback(btNearCallback  nearCallback)
128        {
129                m_nearCallback = nearCallback; 
130        }
131
132        btNearCallback  getNearCallback() const
133        {
134                return m_nearCallback;
135        }
136
137        //by default, Bullet will use this near callback
138        static void  defaultNearCallback(btBroadphasePair& collisionPair, btCollisionDispatcher& dispatcher, const btDispatcherInfo& dispatchInfo);
139
140        virtual void* allocateCollisionAlgorithm(int size);
141
142        virtual void freeCollisionAlgorithm(void* ptr);
143
144        btCollisionConfiguration*       getCollisionConfiguration()
145        {
146                return m_collisionConfiguration;
147        }
148
149        const btCollisionConfiguration* getCollisionConfiguration() const
150        {
151                return m_collisionConfiguration;
152        }
153
154        void    setCollisionConfiguration(btCollisionConfiguration* config)
155        {
156                m_collisionConfiguration = config;
157        }
158
159        virtual btPoolAllocator*        getInternalManifoldPool()
160        {
161                return m_persistentManifoldPoolAllocator;
162        }
163
164        virtual const btPoolAllocator*  getInternalManifoldPool() const
165        {
166                return m_persistentManifoldPoolAllocator;
167        }
168
169};
170
171#endif //BT_COLLISION__DISPATCHER_H
172
Note: See TracBrowser for help on using the repository browser.