Bullet Collision Detection & Physics Library
btDefaultCollisionConfiguration.cpp
Go to the documentation of this file.
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
17
23
27#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
29#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
34
35
36
38
39
40
41
42
44//btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(btStackAlloc* stackAlloc,btPoolAllocator* persistentManifoldPool,btPoolAllocator* collisionAlgorithmPool)
45{
46
47 void* mem = NULL;
48 if (constructionInfo.m_useEpaPenetrationAlgorithm)
49 {
52 }else
53 {
56 }
57
58 //default CreationFunctions, filling the m_doubleDispatch table
67
70
75
78#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
84#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
85
91
94
95 //convex versus plane
101
103 int maxSize = sizeof(btConvexConvexAlgorithm);
107
108 int collisionAlgorithmMaxElementSize = btMax(maxSize,constructionInfo.m_customCollisionAlgorithmMaxElementSize);
112
113 if (constructionInfo.m_persistentManifoldPool)
114 {
116 m_persistentManifoldPool = constructionInfo.m_persistentManifoldPool;
117 } else
118 {
120 void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
121 m_persistentManifoldPool = new (mem) btPoolAllocator(sizeof(btPersistentManifold),constructionInfo.m_defaultMaxPersistentManifoldPoolSize);
122 }
123
125 if (constructionInfo.m_collisionAlgorithmPool)
126 {
128 m_collisionAlgorithmPool = constructionInfo.m_collisionAlgorithmPool;
129 } else
130 {
132 void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
134 }
135
136
137}
138
140{
142 {
145 }
147 {
150 }
151
154
159
162
165
168
171
174
175#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
180#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
181
188
193
195
197
198
199}
200
202{
203
204
206 {
207 return m_sphereSphereCF;
208 }
209#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
211 {
212 return m_sphereBoxCF;
213 }
214
216 {
217 return m_boxSphereCF;
218 }
219#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
220
221
223 {
224 return m_sphereTriangleCF;
225 }
226
228 {
229 return m_triangleSphereCF;
230 }
231
233 {
234 return m_convexPlaneCF;
235 }
236
238 {
239 return m_planeConvexCF;
240 }
241
242
243
245 {
247 }
248
250 {
252 }
253
255 {
257 }
258
259
261 {
263 }
264
266 {
268 }
269 else
270 {
272 {
274 }
275 }
276
277 //failed to find an algorithm
278 return m_emptyCreateFunc;
279
280}
281
283{
284
285
286
288 {
289 return m_sphereSphereCF;
290 }
291#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
293 {
294 return m_sphereBoxCF;
295 }
296
298 {
299 return m_boxSphereCF;
300 }
301#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
302
303
305 {
306 return m_sphereTriangleCF;
307 }
308
310 {
311 return m_triangleSphereCF;
312 }
313
315 {
316 return m_boxBoxCF;
317 }
318
320 {
321 return m_convexPlaneCF;
322 }
323
325 {
326 return m_planeConvexCF;
327 }
328
329
330
332 {
334 }
335
337 {
339 }
340
342 {
344 }
345
346
348 {
350 }
351
353 {
355 } else
356 {
358 {
360 }
361 }
362
363 //failed to find an algorithm
364 return m_emptyCreateFunc;
365}
366
368{
370 convexConvex->m_numPerturbationIterations = numPerturbationIterations;
371 convexConvex->m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
372}
373
375{
377 cpCF->m_numPerturbationIterations = numPerturbationIterations;
378 cpCF->m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
379
381 pcCF->m_numPerturbationIterations = numPerturbationIterations;
382 pcCF->m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
383}
#define btAlignedFree(ptr)
#define btAlignedAlloc(size, alignment)
@ TRIANGLE_SHAPE_PROXYTYPE
@ STATIC_PLANE_PROXYTYPE
@ SPHERE_SHAPE_PROXYTYPE
@ BOX_SHAPE_PROXYTYPE
const T & btMax(const T &a, const T &b)
Definition btMinMax.h:29
btCompoundCollisionAlgorithm supports collision between CompoundCollisionShapes and other collision s...
btCompoundCompoundCollisionAlgorithm supports collision between two btCompoundCollisionShape shapes
btConvexConcaveCollisionAlgorithm supports collision between convex shapes and (concave) trianges mes...
Enabling USE_SEPDISTANCE_UTIL2 requires 100% reliable distance computation.
btCollisionAlgorithmCreateFunc * m_boxSphereCF
btCollisionAlgorithmCreateFunc * m_compoundCreateFunc
btCollisionAlgorithmCreateFunc * m_triangleSphereCF
void setConvexConvexMultipointIterations(int numPerturbationIterations=3, int minimumPointsPerturbationThreshold=3)
Use this method to allow to generate multiple contact points between at once, between two objects usi...
btCollisionAlgorithmCreateFunc * m_boxBoxCF
btCollisionAlgorithmCreateFunc * m_sphereTriangleCF
virtual btCollisionAlgorithmCreateFunc * getClosestPointsAlgorithmCreateFunc(int proxyType0, int proxyType1)
btCollisionAlgorithmCreateFunc * m_convexConcaveCreateFunc
btCollisionAlgorithmCreateFunc * m_planeConvexCF
void setPlaneConvexMultipointIterations(int numPerturbationIterations=3, int minimumPointsPerturbationThreshold=3)
btCollisionAlgorithmCreateFunc * m_compoundCompoundCreateFunc
btConvexPenetrationDepthSolver * m_pdSolver
btCollisionAlgorithmCreateFunc * m_convexPlaneCF
btCollisionAlgorithmCreateFunc * m_sphereSphereCF
virtual btCollisionAlgorithmCreateFunc * getCollisionAlgorithmCreateFunc(int proxyType0, int proxyType1)
btDefaultCollisionConfiguration(const btDefaultCollisionConstructionInfo &constructionInfo=btDefaultCollisionConstructionInfo())
btCollisionAlgorithmCreateFunc * m_swappedConvexConcaveCreateFunc
btCollisionAlgorithmCreateFunc * m_emptyCreateFunc
btCollisionAlgorithmCreateFunc * m_swappedCompoundCreateFunc
btCollisionAlgorithmCreateFunc * m_convexConvexCreateFunc
btCollisionAlgorithmCreateFunc * m_sphereBoxCF
EpaPenetrationDepthSolver uses the Expanding Polytope Algorithm to calculate the penetration depth be...
MinkowskiPenetrationDepthSolver implements bruteforce penetration depth estimation.
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
The btPoolAllocator class allows to efficiently allocate a large pool of objects, instead of dynamica...
static bool isCompound(int proxyType)
static bool isConcave(int proxyType)
static bool isConvex(int proxyType)
Used by the btCollisionDispatcher to register and create instances for btCollisionAlgorithm.