Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/bullet/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h @ 3188

Last change on this file since 3188 was 2882, checked in by rgrieder, 16 years ago

Update from Bullet 2.73 to 2.74.

  • Property svn:eol-style set to native
File size: 4.7 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_DEFAULT_COLLISION_CONFIGURATION
17#define BT_DEFAULT_COLLISION_CONFIGURATION
18
19#include "btCollisionConfiguration.h"
20class btVoronoiSimplexSolver;
21class btConvexPenetrationDepthSolver;
22
23struct  btDefaultCollisionConstructionInfo
24{
25        btStackAlloc*           m_stackAlloc;
26        btPoolAllocator*        m_persistentManifoldPool;
27        btPoolAllocator*        m_collisionAlgorithmPool;
28        int                                     m_defaultMaxPersistentManifoldPoolSize;
29        int                                     m_defaultMaxCollisionAlgorithmPoolSize;
30        int                                     m_defaultStackAllocatorSize;
31
32        btDefaultCollisionConstructionInfo()
33                :m_stackAlloc(0),
34                m_persistentManifoldPool(0),
35                m_collisionAlgorithmPool(0),
36                m_defaultMaxPersistentManifoldPoolSize(4096),
37                m_defaultMaxCollisionAlgorithmPoolSize(4096),
38                m_defaultStackAllocatorSize(0)
39        {
40        }
41};
42
43
44
45///btCollisionConfiguration allows to configure Bullet collision detection
46///stack allocator, pool memory allocators
47///@todo: describe the meaning
48class   btDefaultCollisionConfiguration : public btCollisionConfiguration
49{
50
51protected:
52
53        int     m_persistentManifoldPoolSize;
54       
55        btStackAlloc*   m_stackAlloc;
56        bool    m_ownsStackAllocator;
57
58        btPoolAllocator*        m_persistentManifoldPool;
59        bool    m_ownsPersistentManifoldPool;
60
61
62        btPoolAllocator*        m_collisionAlgorithmPool;
63        bool    m_ownsCollisionAlgorithmPool;
64
65        //default simplex/penetration depth solvers
66        btVoronoiSimplexSolver* m_simplexSolver;
67        btConvexPenetrationDepthSolver* m_pdSolver;
68       
69        //default CreationFunctions, filling the m_doubleDispatch table
70        btCollisionAlgorithmCreateFunc* m_convexConvexCreateFunc;
71        btCollisionAlgorithmCreateFunc* m_convexConcaveCreateFunc;
72        btCollisionAlgorithmCreateFunc* m_swappedConvexConcaveCreateFunc;
73        btCollisionAlgorithmCreateFunc* m_compoundCreateFunc;
74        btCollisionAlgorithmCreateFunc* m_swappedCompoundCreateFunc;
75        btCollisionAlgorithmCreateFunc* m_emptyCreateFunc;
76        btCollisionAlgorithmCreateFunc* m_sphereSphereCF;
77#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
78        btCollisionAlgorithmCreateFunc* m_sphereBoxCF;
79        btCollisionAlgorithmCreateFunc* m_boxSphereCF;
80#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
81
82        btCollisionAlgorithmCreateFunc* m_boxBoxCF;
83        btCollisionAlgorithmCreateFunc* m_sphereTriangleCF;
84        btCollisionAlgorithmCreateFunc* m_triangleSphereCF;
85        btCollisionAlgorithmCreateFunc* m_planeConvexCF;
86        btCollisionAlgorithmCreateFunc* m_convexPlaneCF;
87       
88public:
89
90
91        btDefaultCollisionConfiguration(const btDefaultCollisionConstructionInfo& constructionInfo = btDefaultCollisionConstructionInfo());
92
93        virtual ~btDefaultCollisionConfiguration();
94
95                ///memory pools
96        virtual btPoolAllocator* getPersistentManifoldPool()
97        {
98                return m_persistentManifoldPool;
99        }
100
101        virtual btPoolAllocator* getCollisionAlgorithmPool()
102        {
103                return m_collisionAlgorithmPool;
104        }
105
106        virtual btStackAlloc*   getStackAllocator()
107        {
108                return m_stackAlloc;
109        }
110
111
112        virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1);
113
114        ///Use this method to allow to generate multiple contact points between at once, between two objects using the generic convex-convex algorithm.
115        ///By default, this feature is disabled for best performance.
116        ///@param numPerturbationIterations controls the number of collision queries. Set it to zero to disable the feature.
117        ///@param minimumPointsPerturbationThreshold is the minimum number of points in the contact cache, above which the feature is disabled
118        ///3 is a good value for both params, if you want to enable the feature. This is because the default contact cache contains a maximum of 4 points, and one collision query at the unperturbed orientation is performed first.
119        ///See Bullet/Demos/CollisionDemo for an example how this feature gathers multiple points.
120        ///@todo we could add a per-object setting of those parameters, for level-of-detail collision detection.
121        void    setConvexConvexMultipointIterations(int numPerturbationIterations=3, int minimumPointsPerturbationThreshold = 3);
122
123};
124
125#endif //BT_DEFAULT_COLLISION_CONFIGURATION
126
Note: See TracBrowser for help on using the repository browser.