Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Private Attributes
btDefaultCollisionConfiguration Class Reference

btCollisionConfiguration allows to configure Bullet collision detection stack allocator, pool memory allocators todo: describe the meaning More...

#include <btDefaultCollisionConfiguration.h>

Inheritance diagram for btDefaultCollisionConfiguration:
Inheritance graph
[legend]
Collaboration diagram for btDefaultCollisionConfiguration:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 btDefaultCollisionConfiguration (btStackAlloc *stackAlloc=0, btPoolAllocator *persistentManifoldPool=0, btPoolAllocator *collisionAlgorithmPool=0)
virtual ~btDefaultCollisionConfiguration ()
virtual btPoolAllocatorgetPersistentManifoldPool ()
 memory pools
virtual btPoolAllocatorgetCollisionAlgorithmPool ()
virtual btStackAllocgetStackAllocator ()
virtual
btCollisionAlgorithmCreateFunc
getCollisionAlgorithmCreateFunc (int proxyType0, int proxyType1)

Private Attributes

int m_persistentManifoldPoolSize
btStackAllocm_stackAlloc
bool m_ownsStackAllocator
btPoolAllocatorm_persistentManifoldPool
bool m_ownsPersistentManifoldPool
btPoolAllocatorm_collisionAlgorithmPool
bool m_ownsCollisionAlgorithmPool
btVoronoiSimplexSolverm_simplexSolver
btGjkEpaPenetrationDepthSolverm_pdSolver
btCollisionAlgorithmCreateFuncm_convexConvexCreateFunc
btCollisionAlgorithmCreateFuncm_convexConcaveCreateFunc
btCollisionAlgorithmCreateFuncm_swappedConvexConcaveCreateFunc
btCollisionAlgorithmCreateFuncm_compoundCreateFunc
btCollisionAlgorithmCreateFuncm_swappedCompoundCreateFunc
btCollisionAlgorithmCreateFuncm_emptyCreateFunc
btCollisionAlgorithmCreateFuncm_sphereSphereCF
btCollisionAlgorithmCreateFuncm_sphereBoxCF
btCollisionAlgorithmCreateFuncm_boxSphereCF
btCollisionAlgorithmCreateFuncm_boxBoxCF
btCollisionAlgorithmCreateFuncm_sphereTriangleCF
btCollisionAlgorithmCreateFuncm_triangleSphereCF
btCollisionAlgorithmCreateFuncm_planeConvexCF
btCollisionAlgorithmCreateFuncm_convexPlaneCF

Detailed Description

btCollisionConfiguration allows to configure Bullet collision detection stack allocator, pool memory allocators todo: describe the meaning

Definition at line 27 of file btDefaultCollisionConfiguration.h.


Constructor & Destructor Documentation

btDefaultCollisionConfiguration::btDefaultCollisionConfiguration ( btStackAlloc stackAlloc = 0,
btPoolAllocator persistentManifoldPool = 0,
btPoolAllocator collisionAlgorithmPool = 0 
)

calculate maximum element size, big enough to fit any collision algorithm in the memory pool

Definition at line 42 of file btDefaultCollisionConfiguration.cpp.

{

       void* mem = btAlignedAlloc(sizeof(btVoronoiSimplexSolver),16);
       m_simplexSolver = new (mem)btVoronoiSimplexSolver();
       mem = btAlignedAlloc(sizeof(btGjkEpaPenetrationDepthSolver),16);
       m_pdSolver = new (mem)btGjkEpaPenetrationDepthSolver;

       //default CreationFunctions, filling the m_doubleDispatch table
       mem = btAlignedAlloc(sizeof(btConvexConvexAlgorithm::CreateFunc),16);
       m_convexConvexCreateFunc = new(mem) btConvexConvexAlgorithm::CreateFunc(m_simplexSolver,m_pdSolver);
       mem = btAlignedAlloc(sizeof(btConvexConcaveCollisionAlgorithm::CreateFunc),16);
       m_convexConcaveCreateFunc = new (mem)btConvexConcaveCollisionAlgorithm::CreateFunc;
       mem = btAlignedAlloc(sizeof(btConvexConcaveCollisionAlgorithm::CreateFunc),16);
       m_swappedConvexConcaveCreateFunc = new (mem)btConvexConcaveCollisionAlgorithm::SwappedCreateFunc;
       mem = btAlignedAlloc(sizeof(btCompoundCollisionAlgorithm::CreateFunc),16);
       m_compoundCreateFunc = new (mem)btCompoundCollisionAlgorithm::CreateFunc;
       mem = btAlignedAlloc(sizeof(btCompoundCollisionAlgorithm::SwappedCreateFunc),16);
       m_swappedCompoundCreateFunc = new (mem)btCompoundCollisionAlgorithm::SwappedCreateFunc;
       mem = btAlignedAlloc(sizeof(btEmptyAlgorithm::CreateFunc),16);
       m_emptyCreateFunc = new(mem) btEmptyAlgorithm::CreateFunc;
       
       mem = btAlignedAlloc(sizeof(btSphereSphereCollisionAlgorithm::CreateFunc),16);
       m_sphereSphereCF = new(mem) btSphereSphereCollisionAlgorithm::CreateFunc;
       mem = btAlignedAlloc(sizeof(btSphereBoxCollisionAlgorithm::CreateFunc),16);
       m_sphereBoxCF = new(mem) btSphereBoxCollisionAlgorithm::CreateFunc;
       mem = btAlignedAlloc(sizeof(btSphereBoxCollisionAlgorithm::CreateFunc),16);
       m_boxSphereCF = new (mem)btSphereBoxCollisionAlgorithm::CreateFunc;
       m_boxSphereCF->m_swapped = true;
       mem = btAlignedAlloc(sizeof(btSphereTriangleCollisionAlgorithm::CreateFunc),16);
       m_sphereTriangleCF = new (mem)btSphereTriangleCollisionAlgorithm::CreateFunc;
       mem = btAlignedAlloc(sizeof(btSphereTriangleCollisionAlgorithm::CreateFunc),16);
       m_triangleSphereCF = new (mem)btSphereTriangleCollisionAlgorithm::CreateFunc;
       m_triangleSphereCF->m_swapped = true;
       
       mem = btAlignedAlloc(sizeof(btBoxBoxCollisionAlgorithm::CreateFunc),16);
       m_boxBoxCF = new(mem)btBoxBoxCollisionAlgorithm::CreateFunc;

       //convex versus plane
       mem = btAlignedAlloc (sizeof(btConvexPlaneCollisionAlgorithm::CreateFunc),16);
       m_convexPlaneCF = new (mem) btConvexPlaneCollisionAlgorithm::CreateFunc;
       mem = btAlignedAlloc (sizeof(btConvexPlaneCollisionAlgorithm::CreateFunc),16);
       m_planeConvexCF = new (mem) btConvexPlaneCollisionAlgorithm::CreateFunc;
       m_planeConvexCF->m_swapped = true;
       
       int maxSize = sizeof(btConvexConvexAlgorithm);
       int maxSize2 = sizeof(btConvexConcaveCollisionAlgorithm);
       int maxSize3 = sizeof(btCompoundCollisionAlgorithm);
       int maxSize4 = sizeof(btEmptyAlgorithm);
       
       int    collisionAlgorithmMaxElementSize = btMax(maxSize,maxSize2);
       collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize3);
       collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize4);

       if (stackAlloc)
       {
              m_ownsStackAllocator = false;
              this->m_stackAlloc = stackAlloc;
       } else
       {
              m_ownsStackAllocator = true;
              void* mem = btAlignedAlloc(sizeof(btStackAlloc),16);
              m_stackAlloc = new(mem)btStackAlloc(DEFAULT_STACK_ALLOCATOR_SIZE);
       }
              
       if (persistentManifoldPool)
       {
              m_ownsPersistentManifoldPool = false;
              m_persistentManifoldPool = persistentManifoldPool;
       } else
       {
              m_ownsPersistentManifoldPool = true;
              void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
              m_persistentManifoldPool = new (mem) btPoolAllocator(sizeof(btPersistentManifold),DEFAULT_MAX_OVERLAPPING_PAIRS);
       }
       
       if (collisionAlgorithmPool)
       {
              m_ownsCollisionAlgorithmPool = false;
              m_collisionAlgorithmPool = collisionAlgorithmPool;
       } else
       {
              m_ownsCollisionAlgorithmPool = true;
              void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
              m_collisionAlgorithmPool = new(mem) btPoolAllocator(collisionAlgorithmMaxElementSize,DEFAULT_MAX_OVERLAPPING_PAIRS);
       }


}

Here is the call graph for this function:

Definition at line 133 of file btDefaultCollisionConfiguration.cpp.

{
       if (m_ownsStackAllocator)
       {
              m_stackAlloc->destroy();
              m_stackAlloc->~btStackAlloc();
              btAlignedFree(m_stackAlloc);
       }
       if (m_ownsCollisionAlgorithmPool)
       {
              m_collisionAlgorithmPool->~btPoolAllocator();
              btAlignedFree(m_collisionAlgorithmPool);
       }
       if (m_ownsPersistentManifoldPool)
       {
              m_persistentManifoldPool->~btPoolAllocator();
              btAlignedFree(m_persistentManifoldPool);
       }

       m_convexConvexCreateFunc->~btCollisionAlgorithmCreateFunc();
       btAlignedFree(       m_convexConvexCreateFunc);

       m_convexConcaveCreateFunc->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_convexConcaveCreateFunc);
       m_swappedConvexConcaveCreateFunc->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_swappedConvexConcaveCreateFunc);

       m_compoundCreateFunc->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_compoundCreateFunc);

       m_swappedCompoundCreateFunc->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_swappedCompoundCreateFunc);

       m_emptyCreateFunc->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_emptyCreateFunc);

       m_sphereSphereCF->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_sphereSphereCF);

       m_sphereBoxCF->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_sphereBoxCF);
       m_boxSphereCF->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_boxSphereCF);
       m_sphereTriangleCF->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_sphereTriangleCF);
       m_triangleSphereCF->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_triangleSphereCF);
       m_boxBoxCF->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_boxBoxCF);

       m_convexPlaneCF->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_convexPlaneCF);
       m_planeConvexCF->~btCollisionAlgorithmCreateFunc();
       btAlignedFree( m_planeConvexCF);

       m_simplexSolver->~btVoronoiSimplexSolver();
       btAlignedFree(m_simplexSolver);
       m_pdSolver->~btGjkEpaPenetrationDepthSolver();
       btAlignedFree(m_pdSolver);


}

Here is the call graph for this function:


Member Function Documentation

Implements btCollisionConfiguration.

Definition at line 197 of file btDefaultCollisionConfiguration.cpp.

{



       if ((proxyType0 == SPHERE_SHAPE_PROXYTYPE) && (proxyType1==SPHERE_SHAPE_PROXYTYPE))
       {
              return m_sphereSphereCF;
       }

       if ((proxyType0 == SPHERE_SHAPE_PROXYTYPE) && (proxyType1==BOX_SHAPE_PROXYTYPE))
       {
              return m_sphereBoxCF;
       }

       if ((proxyType0 == BOX_SHAPE_PROXYTYPE ) && (proxyType1==SPHERE_SHAPE_PROXYTYPE))
       {
              return m_boxSphereCF;
       }

       if ((proxyType0 == SPHERE_SHAPE_PROXYTYPE ) && (proxyType1==TRIANGLE_SHAPE_PROXYTYPE))
       {
              return m_sphereTriangleCF;
       }

       if ((proxyType0 == TRIANGLE_SHAPE_PROXYTYPE  ) && (proxyType1==SPHERE_SHAPE_PROXYTYPE))
       {
              return m_triangleSphereCF;
       }

       if ((proxyType0 == BOX_SHAPE_PROXYTYPE) && (proxyType1 == BOX_SHAPE_PROXYTYPE))
       {
              return m_boxBoxCF;
       }
       
       if (btBroadphaseProxy::isConvex(proxyType0) && (proxyType1 == STATIC_PLANE_PROXYTYPE))
       {
              return m_convexPlaneCF;
       }

       if (btBroadphaseProxy::isConvex(proxyType1) && (proxyType0 == STATIC_PLANE_PROXYTYPE))
       {
              return m_planeConvexCF;
       }

       if (btBroadphaseProxy::isConvex(proxyType0) && btBroadphaseProxy::isConvex(proxyType1))
       {
              return m_convexConvexCreateFunc;
       }

       if (btBroadphaseProxy::isConvex(proxyType0) && btBroadphaseProxy::isConcave(proxyType1))
       {
              return m_convexConcaveCreateFunc;
       }

       if (btBroadphaseProxy::isConvex(proxyType1) && btBroadphaseProxy::isConcave(proxyType0))
       {
              return m_swappedConvexConcaveCreateFunc;
       }

       if (btBroadphaseProxy::isCompound(proxyType0))
       {
              return m_compoundCreateFunc;
       } else
       {
              if (btBroadphaseProxy::isCompound(proxyType1))
              {
                     return m_swappedCompoundCreateFunc;
              }
       }

       //failed to find an algorithm
       return m_emptyCreateFunc;
}

Implements btCollisionConfiguration.

Definition at line 73 of file btDefaultCollisionConfiguration.h.

memory pools

Implements btCollisionConfiguration.

Definition at line 68 of file btDefaultCollisionConfiguration.h.

Implements btCollisionConfiguration.

Definition at line 78 of file btDefaultCollisionConfiguration.h.

       {
              return m_stackAlloc;
       }

Member Data Documentation

Definition at line 55 of file btDefaultCollisionConfiguration.h.

Definition at line 54 of file btDefaultCollisionConfiguration.h.

Definition at line 38 of file btDefaultCollisionConfiguration.h.

Definition at line 49 of file btDefaultCollisionConfiguration.h.

Definition at line 47 of file btDefaultCollisionConfiguration.h.

Definition at line 46 of file btDefaultCollisionConfiguration.h.

Definition at line 59 of file btDefaultCollisionConfiguration.h.

Definition at line 51 of file btDefaultCollisionConfiguration.h.

Definition at line 39 of file btDefaultCollisionConfiguration.h.

Definition at line 36 of file btDefaultCollisionConfiguration.h.

Definition at line 33 of file btDefaultCollisionConfiguration.h.

Definition at line 43 of file btDefaultCollisionConfiguration.h.

Definition at line 35 of file btDefaultCollisionConfiguration.h.

Definition at line 30 of file btDefaultCollisionConfiguration.h.

Definition at line 58 of file btDefaultCollisionConfiguration.h.

Definition at line 42 of file btDefaultCollisionConfiguration.h.

Definition at line 53 of file btDefaultCollisionConfiguration.h.

Definition at line 52 of file btDefaultCollisionConfiguration.h.

Definition at line 56 of file btDefaultCollisionConfiguration.h.

Definition at line 32 of file btDefaultCollisionConfiguration.h.

Definition at line 50 of file btDefaultCollisionConfiguration.h.

Definition at line 48 of file btDefaultCollisionConfiguration.h.

Definition at line 57 of file btDefaultCollisionConfiguration.h.


The documentation for this class was generated from the following files: