00001 /* 00002 Bullet Continuous Collision Detection and Physics Library 00003 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 00004 00005 This software is provided 'as-is', without any express or implied warranty. 00006 In no event will the authors be held liable for any damages arising from the use of this software. 00007 Permission is granted to anyone to use this software for any purpose, 00008 including commercial applications, and to alter it and redistribute it freely, 00009 subject to the following restrictions: 00010 00011 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. 00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 00013 3. This notice may not be removed or altered from any source distribution. 00014 */ 00015 00016 #ifndef BT_DEFAULT_COLLISION_CONFIGURATION 00017 #define BT_DEFAULT_COLLISION_CONFIGURATION 00018 00019 #include "btCollisionConfiguration.h" 00020 class btVoronoiSimplexSolver; 00021 class btConvexPenetrationDepthSolver; 00022 00023 struct btDefaultCollisionConstructionInfo 00024 { 00025 btStackAlloc* m_stackAlloc; 00026 btPoolAllocator* m_persistentManifoldPool; 00027 btPoolAllocator* m_collisionAlgorithmPool; 00028 int m_defaultMaxPersistentManifoldPoolSize; 00029 int m_defaultMaxCollisionAlgorithmPoolSize; 00030 int m_customCollisionAlgorithmMaxElementSize; 00031 int m_defaultStackAllocatorSize; 00032 int m_useEpaPenetrationAlgorithm; 00033 00034 btDefaultCollisionConstructionInfo() 00035 :m_stackAlloc(0), 00036 m_persistentManifoldPool(0), 00037 m_collisionAlgorithmPool(0), 00038 m_defaultMaxPersistentManifoldPoolSize(4096), 00039 m_defaultMaxCollisionAlgorithmPoolSize(4096), 00040 m_customCollisionAlgorithmMaxElementSize(0), 00041 m_defaultStackAllocatorSize(0), 00042 m_useEpaPenetrationAlgorithm(true) 00043 { 00044 } 00045 }; 00046 00047 00048 00052 class btDefaultCollisionConfiguration : public btCollisionConfiguration 00053 { 00054 00055 protected: 00056 00057 int m_persistentManifoldPoolSize; 00058 00059 btStackAlloc* m_stackAlloc; 00060 bool m_ownsStackAllocator; 00061 00062 btPoolAllocator* m_persistentManifoldPool; 00063 bool m_ownsPersistentManifoldPool; 00064 00065 00066 btPoolAllocator* m_collisionAlgorithmPool; 00067 bool m_ownsCollisionAlgorithmPool; 00068 00069 //default simplex/penetration depth solvers 00070 btVoronoiSimplexSolver* m_simplexSolver; 00071 btConvexPenetrationDepthSolver* m_pdSolver; 00072 00073 //default CreationFunctions, filling the m_doubleDispatch table 00074 btCollisionAlgorithmCreateFunc* m_convexConvexCreateFunc; 00075 btCollisionAlgorithmCreateFunc* m_convexConcaveCreateFunc; 00076 btCollisionAlgorithmCreateFunc* m_swappedConvexConcaveCreateFunc; 00077 btCollisionAlgorithmCreateFunc* m_compoundCreateFunc; 00078 btCollisionAlgorithmCreateFunc* m_swappedCompoundCreateFunc; 00079 btCollisionAlgorithmCreateFunc* m_emptyCreateFunc; 00080 btCollisionAlgorithmCreateFunc* m_sphereSphereCF; 00081 #ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM 00082 btCollisionAlgorithmCreateFunc* m_sphereBoxCF; 00083 btCollisionAlgorithmCreateFunc* m_boxSphereCF; 00084 #endif //USE_BUGGY_SPHERE_BOX_ALGORITHM 00085 00086 btCollisionAlgorithmCreateFunc* m_boxBoxCF; 00087 btCollisionAlgorithmCreateFunc* m_sphereTriangleCF; 00088 btCollisionAlgorithmCreateFunc* m_triangleSphereCF; 00089 btCollisionAlgorithmCreateFunc* m_planeConvexCF; 00090 btCollisionAlgorithmCreateFunc* m_convexPlaneCF; 00091 00092 public: 00093 00094 00095 btDefaultCollisionConfiguration(const btDefaultCollisionConstructionInfo& constructionInfo = btDefaultCollisionConstructionInfo()); 00096 00097 virtual ~btDefaultCollisionConfiguration(); 00098 00100 virtual btPoolAllocator* getPersistentManifoldPool() 00101 { 00102 return m_persistentManifoldPool; 00103 } 00104 00105 virtual btPoolAllocator* getCollisionAlgorithmPool() 00106 { 00107 return m_collisionAlgorithmPool; 00108 } 00109 00110 virtual btStackAlloc* getStackAllocator() 00111 { 00112 return m_stackAlloc; 00113 } 00114 00115 virtual btVoronoiSimplexSolver* getSimplexSolver() 00116 { 00117 return m_simplexSolver; 00118 } 00119 00120 00121 virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1); 00122 00130 void setConvexConvexMultipointIterations(int numPerturbationIterations=3, int minimumPointsPerturbationThreshold = 3); 00131 00132 }; 00133 00134 #endif //BT_DEFAULT_COLLISION_CONFIGURATION 00135