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