2017-08-01 12:30:58 +00:00
|
|
|
/*
|
|
|
|
Bullet Continuous Collision Detection and Physics Library
|
|
|
|
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied warranty.
|
|
|
|
In no event will the authors be held liable for any damages arising from the use of this software.
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it freely,
|
|
|
|
subject to the following restrictions:
|
|
|
|
|
|
|
|
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.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "btDefaultCollisionConfiguration.h"
|
|
|
|
|
|
|
|
#include "BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h"
|
|
|
|
#include "BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h"
|
|
|
|
#include "BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h"
|
|
|
|
#include "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h"
|
|
|
|
#include "BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.h"
|
|
|
|
|
|
|
|
#include "BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h"
|
|
|
|
#include "BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h"
|
|
|
|
#include "BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h"
|
|
|
|
#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
|
|
|
|
#include "BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.h"
|
2019-01-03 13:26:51 +00:00
|
|
|
#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
|
2017-08-01 12:30:58 +00:00
|
|
|
#include "BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h"
|
|
|
|
#include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h"
|
|
|
|
#include "BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h"
|
|
|
|
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
|
|
|
|
|
|
|
|
#include "LinearMath/btPoolAllocator.h"
|
|
|
|
|
|
|
|
btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefaultCollisionConstructionInfo& constructionInfo)
|
|
|
|
//btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(btStackAlloc* stackAlloc,btPoolAllocator* persistentManifoldPool,btPoolAllocator* collisionAlgorithmPool)
|
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
void* mem = NULL;
|
2017-08-01 12:30:58 +00:00
|
|
|
if (constructionInfo.m_useEpaPenetrationAlgorithm)
|
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
mem = btAlignedAlloc(sizeof(btGjkEpaPenetrationDepthSolver), 16);
|
|
|
|
m_pdSolver = new (mem) btGjkEpaPenetrationDepthSolver;
|
|
|
|
}
|
|
|
|
else
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
mem = btAlignedAlloc(sizeof(btMinkowskiPenetrationDepthSolver), 16);
|
|
|
|
m_pdSolver = new (mem) btMinkowskiPenetrationDepthSolver;
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
2019-01-03 13:26:51 +00:00
|
|
|
|
2017-08-01 12:30:58 +00:00
|
|
|
//default CreationFunctions, filling the m_doubleDispatch table
|
2019-01-03 13:26:51 +00:00
|
|
|
mem = btAlignedAlloc(sizeof(btConvexConvexAlgorithm::CreateFunc), 16);
|
|
|
|
m_convexConvexCreateFunc = new (mem) btConvexConvexAlgorithm::CreateFunc(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(btCompoundCompoundCollisionAlgorithm::CreateFunc), 16);
|
|
|
|
m_compoundCompoundCreateFunc = new (mem) btCompoundCompoundCollisionAlgorithm::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;
|
2017-08-01 12:30:58 +00:00
|
|
|
#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
|
2019-01-03 13:26:51 +00:00
|
|
|
mem = btAlignedAlloc(sizeof(btSphereBoxCollisionAlgorithm::CreateFunc), 16);
|
|
|
|
m_sphereBoxCF = new (mem) btSphereBoxCollisionAlgorithm::CreateFunc;
|
|
|
|
mem = btAlignedAlloc(sizeof(btSphereBoxCollisionAlgorithm::CreateFunc), 16);
|
|
|
|
m_boxSphereCF = new (mem) btSphereBoxCollisionAlgorithm::CreateFunc;
|
2017-08-01 12:30:58 +00:00
|
|
|
m_boxSphereCF->m_swapped = true;
|
2019-01-03 13:26:51 +00:00
|
|
|
#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
|
2017-08-01 12:30:58 +00:00
|
|
|
|
2019-01-03 13:26:51 +00:00
|
|
|
mem = btAlignedAlloc(sizeof(btSphereTriangleCollisionAlgorithm::CreateFunc), 16);
|
|
|
|
m_sphereTriangleCF = new (mem) btSphereTriangleCollisionAlgorithm::CreateFunc;
|
|
|
|
mem = btAlignedAlloc(sizeof(btSphereTriangleCollisionAlgorithm::CreateFunc), 16);
|
|
|
|
m_triangleSphereCF = new (mem) btSphereTriangleCollisionAlgorithm::CreateFunc;
|
2017-08-01 12:30:58 +00:00
|
|
|
m_triangleSphereCF->m_swapped = true;
|
2019-01-03 13:26:51 +00:00
|
|
|
|
|
|
|
mem = btAlignedAlloc(sizeof(btBoxBoxCollisionAlgorithm::CreateFunc), 16);
|
|
|
|
m_boxBoxCF = new (mem) btBoxBoxCollisionAlgorithm::CreateFunc;
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
//convex versus plane
|
2019-01-03 13:26:51 +00:00
|
|
|
mem = btAlignedAlloc(sizeof(btConvexPlaneCollisionAlgorithm::CreateFunc), 16);
|
2017-08-01 12:30:58 +00:00
|
|
|
m_convexPlaneCF = new (mem) btConvexPlaneCollisionAlgorithm::CreateFunc;
|
2019-01-03 13:26:51 +00:00
|
|
|
mem = btAlignedAlloc(sizeof(btConvexPlaneCollisionAlgorithm::CreateFunc), 16);
|
2017-08-01 12:30:58 +00:00
|
|
|
m_planeConvexCF = new (mem) btConvexPlaneCollisionAlgorithm::CreateFunc;
|
|
|
|
m_planeConvexCF->m_swapped = true;
|
2019-01-03 13:26:51 +00:00
|
|
|
|
2017-08-01 12:30:58 +00:00
|
|
|
///calculate maximum element size, big enough to fit any collision algorithm in the memory pool
|
|
|
|
int maxSize = sizeof(btConvexConvexAlgorithm);
|
|
|
|
int maxSize2 = sizeof(btConvexConcaveCollisionAlgorithm);
|
|
|
|
int maxSize3 = sizeof(btCompoundCollisionAlgorithm);
|
|
|
|
int maxSize4 = sizeof(btCompoundCompoundCollisionAlgorithm);
|
|
|
|
|
2019-01-03 13:26:51 +00:00
|
|
|
int collisionAlgorithmMaxElementSize = btMax(maxSize, constructionInfo.m_customCollisionAlgorithmMaxElementSize);
|
|
|
|
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize, maxSize2);
|
|
|
|
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize, maxSize3);
|
|
|
|
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize, maxSize4);
|
|
|
|
|
2017-08-01 12:30:58 +00:00
|
|
|
if (constructionInfo.m_persistentManifoldPool)
|
|
|
|
{
|
|
|
|
m_ownsPersistentManifoldPool = false;
|
|
|
|
m_persistentManifoldPool = constructionInfo.m_persistentManifoldPool;
|
2019-01-03 13:26:51 +00:00
|
|
|
}
|
|
|
|
else
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
|
|
|
m_ownsPersistentManifoldPool = true;
|
2019-01-03 13:26:51 +00:00
|
|
|
void* mem = btAlignedAlloc(sizeof(btPoolAllocator), 16);
|
|
|
|
m_persistentManifoldPool = new (mem) btPoolAllocator(sizeof(btPersistentManifold), constructionInfo.m_defaultMaxPersistentManifoldPoolSize);
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
2019-01-03 13:26:51 +00:00
|
|
|
|
|
|
|
collisionAlgorithmMaxElementSize = (collisionAlgorithmMaxElementSize + 16) & 0xffffffffffff0;
|
2017-08-01 12:30:58 +00:00
|
|
|
if (constructionInfo.m_collisionAlgorithmPool)
|
|
|
|
{
|
|
|
|
m_ownsCollisionAlgorithmPool = false;
|
|
|
|
m_collisionAlgorithmPool = constructionInfo.m_collisionAlgorithmPool;
|
2019-01-03 13:26:51 +00:00
|
|
|
}
|
|
|
|
else
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
|
|
|
m_ownsCollisionAlgorithmPool = true;
|
2019-01-03 13:26:51 +00:00
|
|
|
void* mem = btAlignedAlloc(sizeof(btPoolAllocator), 16);
|
|
|
|
m_collisionAlgorithmPool = new (mem) btPoolAllocator(collisionAlgorithmMaxElementSize, constructionInfo.m_defaultMaxCollisionAlgorithmPoolSize);
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
btDefaultCollisionConfiguration::~btDefaultCollisionConfiguration()
|
|
|
|
{
|
|
|
|
if (m_ownsCollisionAlgorithmPool)
|
|
|
|
{
|
|
|
|
m_collisionAlgorithmPool->~btPoolAllocator();
|
|
|
|
btAlignedFree(m_collisionAlgorithmPool);
|
|
|
|
}
|
|
|
|
if (m_ownsPersistentManifoldPool)
|
|
|
|
{
|
|
|
|
m_persistentManifoldPool->~btPoolAllocator();
|
|
|
|
btAlignedFree(m_persistentManifoldPool);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_convexConvexCreateFunc->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_convexConvexCreateFunc);
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
m_convexConcaveCreateFunc->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_convexConcaveCreateFunc);
|
2017-08-01 12:30:58 +00:00
|
|
|
m_swappedConvexConcaveCreateFunc->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_swappedConvexConcaveCreateFunc);
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
m_compoundCreateFunc->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_compoundCreateFunc);
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
m_compoundCompoundCreateFunc->~btCollisionAlgorithmCreateFunc();
|
|
|
|
btAlignedFree(m_compoundCompoundCreateFunc);
|
|
|
|
|
|
|
|
m_swappedCompoundCreateFunc->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_swappedCompoundCreateFunc);
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
m_emptyCreateFunc->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_emptyCreateFunc);
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
m_sphereSphereCF->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_sphereSphereCF);
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
|
|
|
|
m_sphereBoxCF->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_sphereBoxCF);
|
2017-08-01 12:30:58 +00:00
|
|
|
m_boxSphereCF->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_boxSphereCF);
|
|
|
|
#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
m_sphereTriangleCF->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_sphereTriangleCF);
|
2017-08-01 12:30:58 +00:00
|
|
|
m_triangleSphereCF->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_triangleSphereCF);
|
2017-08-01 12:30:58 +00:00
|
|
|
m_boxBoxCF->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_boxBoxCF);
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
m_convexPlaneCF->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_convexPlaneCF);
|
2017-08-01 12:30:58 +00:00
|
|
|
m_planeConvexCF->~btCollisionAlgorithmCreateFunc();
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_planeConvexCF);
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
m_pdSolver->~btConvexPenetrationDepthSolver();
|
|
|
|
|
2019-01-03 13:26:51 +00:00
|
|
|
btAlignedFree(m_pdSolver);
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
btCollisionAlgorithmCreateFunc* btDefaultCollisionConfiguration::getClosestPointsAlgorithmCreateFunc(int proxyType0, int proxyType1)
|
|
|
|
{
|
|
|
|
if ((proxyType0 == SPHERE_SHAPE_PROXYTYPE) && (proxyType1 == SPHERE_SHAPE_PROXYTYPE))
|
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
return m_sphereSphereCF;
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
|
|
|
#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
|
|
|
|
if ((proxyType0 == SPHERE_SHAPE_PROXYTYPE) && (proxyType1 == BOX_SHAPE_PROXYTYPE))
|
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
return m_sphereBoxCF;
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((proxyType0 == BOX_SHAPE_PROXYTYPE) && (proxyType1 == SPHERE_SHAPE_PROXYTYPE))
|
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
return m_boxSphereCF;
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
2019-01-03 13:26:51 +00:00
|
|
|
#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
if ((proxyType0 == SPHERE_SHAPE_PROXYTYPE) && (proxyType1 == TRIANGLE_SHAPE_PROXYTYPE))
|
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
return m_sphereTriangleCF;
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((proxyType0 == TRIANGLE_SHAPE_PROXYTYPE) && (proxyType1 == SPHERE_SHAPE_PROXYTYPE))
|
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
return m_triangleSphereCF;
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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) && btBroadphaseProxy::isCompound(proxyType1))
|
|
|
|
{
|
|
|
|
return m_compoundCompoundCreateFunc;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (btBroadphaseProxy::isCompound(proxyType0))
|
|
|
|
{
|
|
|
|
return m_compoundCreateFunc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (btBroadphaseProxy::isCompound(proxyType1))
|
|
|
|
{
|
|
|
|
return m_swappedCompoundCreateFunc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//failed to find an algorithm
|
|
|
|
return m_emptyCreateFunc;
|
|
|
|
}
|
|
|
|
|
2019-01-03 13:26:51 +00:00
|
|
|
btCollisionAlgorithmCreateFunc* btDefaultCollisionConfiguration::getCollisionAlgorithmCreateFunc(int proxyType0, int proxyType1)
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
if ((proxyType0 == SPHERE_SHAPE_PROXYTYPE) && (proxyType1 == SPHERE_SHAPE_PROXYTYPE))
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
return m_sphereSphereCF;
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
|
|
|
#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
|
2019-01-03 13:26:51 +00:00
|
|
|
if ((proxyType0 == SPHERE_SHAPE_PROXYTYPE) && (proxyType1 == BOX_SHAPE_PROXYTYPE))
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
return m_sphereBoxCF;
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
|
|
|
|
2019-01-03 13:26:51 +00:00
|
|
|
if ((proxyType0 == BOX_SHAPE_PROXYTYPE) && (proxyType1 == SPHERE_SHAPE_PROXYTYPE))
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
return m_boxSphereCF;
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
2019-01-03 13:26:51 +00:00
|
|
|
#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
|
2017-08-01 12:30:58 +00:00
|
|
|
|
2019-01-03 13:26:51 +00:00
|
|
|
if ((proxyType0 == SPHERE_SHAPE_PROXYTYPE) && (proxyType1 == TRIANGLE_SHAPE_PROXYTYPE))
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
return m_sphereTriangleCF;
|
2017-08-01 12:30:58 +00:00
|
|
|
}
|
|
|
|
|
2019-01-03 13:26:51 +00:00
|
|
|
if ((proxyType0 == TRIANGLE_SHAPE_PROXYTYPE) && (proxyType1 == SPHERE_SHAPE_PROXYTYPE))
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
return m_triangleSphereCF;
|
|
|
|
}
|
2017-08-01 12:30:58 +00:00
|
|
|
|
|
|
|
if ((proxyType0 == BOX_SHAPE_PROXYTYPE) && (proxyType1 == BOX_SHAPE_PROXYTYPE))
|
|
|
|
{
|
|
|
|
return m_boxBoxCF;
|
|
|
|
}
|
2019-01-03 13:26:51 +00:00
|
|
|
|
2017-08-01 12:30:58 +00:00
|
|
|
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) && btBroadphaseProxy::isCompound(proxyType1))
|
|
|
|
{
|
|
|
|
return m_compoundCompoundCreateFunc;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (btBroadphaseProxy::isCompound(proxyType0))
|
|
|
|
{
|
|
|
|
return m_compoundCreateFunc;
|
2019-01-03 13:26:51 +00:00
|
|
|
}
|
|
|
|
else
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
|
|
|
if (btBroadphaseProxy::isCompound(proxyType1))
|
|
|
|
{
|
|
|
|
return m_swappedCompoundCreateFunc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//failed to find an algorithm
|
|
|
|
return m_emptyCreateFunc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void btDefaultCollisionConfiguration::setConvexConvexMultipointIterations(int numPerturbationIterations, int minimumPointsPerturbationThreshold)
|
|
|
|
{
|
2019-01-03 13:26:51 +00:00
|
|
|
btConvexConvexAlgorithm::CreateFunc* convexConvex = (btConvexConvexAlgorithm::CreateFunc*)m_convexConvexCreateFunc;
|
2017-08-01 12:30:58 +00:00
|
|
|
convexConvex->m_numPerturbationIterations = numPerturbationIterations;
|
|
|
|
convexConvex->m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
|
|
|
|
}
|
|
|
|
|
2019-01-03 13:26:51 +00:00
|
|
|
void btDefaultCollisionConfiguration::setPlaneConvexMultipointIterations(int numPerturbationIterations, int minimumPointsPerturbationThreshold)
|
2017-08-01 12:30:58 +00:00
|
|
|
{
|
|
|
|
btConvexPlaneCollisionAlgorithm::CreateFunc* cpCF = (btConvexPlaneCollisionAlgorithm::CreateFunc*)m_convexPlaneCF;
|
|
|
|
cpCF->m_numPerturbationIterations = numPerturbationIterations;
|
|
|
|
cpCF->m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
|
2019-01-03 13:26:51 +00:00
|
|
|
|
2017-08-01 12:30:58 +00:00
|
|
|
btConvexPlaneCollisionAlgorithm::CreateFunc* pcCF = (btConvexPlaneCollisionAlgorithm::CreateFunc*)m_planeConvexCF;
|
|
|
|
pcCF->m_numPerturbationIterations = numPerturbationIterations;
|
|
|
|
pcCF->m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
|
|
|
|
}
|