Refactoring: another huge number of changes, renamed methods to start with lower-case.
This commit is contained in:
@@ -21,25 +21,25 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
btBroadphaseProxy* btAxisSweep3::CreateProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask)
|
||||
btBroadphaseProxy* btAxisSweep3::createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask)
|
||||
{
|
||||
unsigned short handleId = AddHandle(min,max, userPtr,collisionFilterGroup,collisionFilterMask);
|
||||
unsigned short handleId = addHandle(min,max, userPtr,collisionFilterGroup,collisionFilterMask);
|
||||
|
||||
Handle* handle = GetHandle(handleId);
|
||||
Handle* handle = getHandle(handleId);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
void btAxisSweep3::DestroyProxy(btBroadphaseProxy* proxy)
|
||||
void btAxisSweep3::destroyProxy(btBroadphaseProxy* proxy)
|
||||
{
|
||||
Handle* handle = static_cast<Handle*>(proxy);
|
||||
RemoveHandle(handle->m_handleId);
|
||||
removeHandle(handle->m_handleId);
|
||||
}
|
||||
|
||||
void btAxisSweep3::SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
|
||||
void btAxisSweep3::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
|
||||
{
|
||||
Handle* handle = static_cast<Handle*>(proxy);
|
||||
UpdateHandle(handle->m_handleId,aabbMin,aabbMax);
|
||||
updateHandle(handle->m_handleId,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ btAxisSweep3::~btAxisSweep3()
|
||||
delete[] m_pHandles;
|
||||
}
|
||||
|
||||
void btAxisSweep3::Quantize(unsigned short* out, const btPoint3& point, int isMax) const
|
||||
void btAxisSweep3::quantize(unsigned short* out, const btPoint3& point, int isMax) const
|
||||
{
|
||||
btPoint3 clampedPoint(point);
|
||||
/*
|
||||
@@ -132,22 +132,22 @@ void btAxisSweep3::Quantize(unsigned short* out, const btPoint3& point, int isMa
|
||||
|
||||
|
||||
|
||||
unsigned short btAxisSweep3::AllocHandle()
|
||||
unsigned short btAxisSweep3::allocHandle()
|
||||
{
|
||||
assert(m_firstFreeHandle);
|
||||
|
||||
unsigned short handle = m_firstFreeHandle;
|
||||
m_firstFreeHandle = GetHandle(handle)->GetNextFree();
|
||||
m_firstFreeHandle = getHandle(handle)->GetNextFree();
|
||||
m_numHandles++;
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
void btAxisSweep3::FreeHandle(unsigned short handle)
|
||||
void btAxisSweep3::freeHandle(unsigned short handle)
|
||||
{
|
||||
assert(handle > 0 && handle < m_maxHandles);
|
||||
|
||||
GetHandle(handle)->SetNextFree(m_firstFreeHandle);
|
||||
getHandle(handle)->SetNextFree(m_firstFreeHandle);
|
||||
m_firstFreeHandle = handle;
|
||||
|
||||
m_numHandles--;
|
||||
@@ -155,18 +155,18 @@ void btAxisSweep3::FreeHandle(unsigned short handle)
|
||||
|
||||
|
||||
|
||||
unsigned short btAxisSweep3::AddHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask)
|
||||
unsigned short btAxisSweep3::addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask)
|
||||
{
|
||||
// quantize the bounds
|
||||
unsigned short min[3], max[3];
|
||||
Quantize(min, aabbMin, 0);
|
||||
Quantize(max, aabbMax, 1);
|
||||
quantize(min, aabbMin, 0);
|
||||
quantize(max, aabbMax, 1);
|
||||
|
||||
// allocate a handle
|
||||
unsigned short handle = AllocHandle();
|
||||
unsigned short handle = allocHandle();
|
||||
assert(handle!= 0xcdcd);
|
||||
|
||||
Handle* pHandle = GetHandle(handle);
|
||||
Handle* pHandle = getHandle(handle);
|
||||
|
||||
pHandle->m_handleId = handle;
|
||||
//pHandle->m_pOverlaps = 0;
|
||||
@@ -195,12 +195,12 @@ unsigned short btAxisSweep3::AddHandle(const btPoint3& aabbMin,const btPoint3& a
|
||||
}
|
||||
|
||||
// now sort the new edges to their correct position
|
||||
SortMinDown(0, pHandle->m_minEdges[0], false);
|
||||
SortMaxDown(0, pHandle->m_maxEdges[0], false);
|
||||
SortMinDown(1, pHandle->m_minEdges[1], false);
|
||||
SortMaxDown(1, pHandle->m_maxEdges[1], false);
|
||||
SortMinDown(2, pHandle->m_minEdges[2], true);
|
||||
SortMaxDown(2, pHandle->m_maxEdges[2], true);
|
||||
sortMinDown(0, pHandle->m_minEdges[0], false);
|
||||
sortMaxDown(0, pHandle->m_maxEdges[0], false);
|
||||
sortMinDown(1, pHandle->m_minEdges[1], false);
|
||||
sortMaxDown(1, pHandle->m_maxEdges[1], false);
|
||||
sortMinDown(2, pHandle->m_minEdges[2], true);
|
||||
sortMaxDown(2, pHandle->m_maxEdges[2], true);
|
||||
|
||||
//PrintAxis(1);
|
||||
|
||||
@@ -208,14 +208,14 @@ unsigned short btAxisSweep3::AddHandle(const btPoint3& aabbMin,const btPoint3& a
|
||||
}
|
||||
|
||||
|
||||
void btAxisSweep3::RemoveHandle(unsigned short handle)
|
||||
void btAxisSweep3::removeHandle(unsigned short handle)
|
||||
{
|
||||
Handle* pHandle = GetHandle(handle);
|
||||
Handle* pHandle = getHandle(handle);
|
||||
|
||||
//explicitly remove the pairs containing the proxy
|
||||
//we could do it also in the SortMinUp (passing true)
|
||||
//we could do it also in the sortMinUp (passing true)
|
||||
//todo: compare performance
|
||||
RemoveOverlappingPairsContainingProxy(pHandle);
|
||||
removeOverlappingPairsContainingProxy(pHandle);
|
||||
|
||||
|
||||
// compute current limit of edge arrays
|
||||
@@ -238,12 +238,12 @@ void btAxisSweep3::RemoveHandle(unsigned short handle)
|
||||
int max = pHandle->m_maxEdges[axis];
|
||||
pEdges[max].m_pos = 0xffff;
|
||||
|
||||
SortMaxUp(axis,max,false);
|
||||
sortMaxUp(axis,max,false);
|
||||
|
||||
int i = pHandle->m_minEdges[axis];
|
||||
pEdges[i].m_pos = 0xffff;
|
||||
|
||||
SortMinUp(axis,i,false);
|
||||
sortMinUp(axis,i,false);
|
||||
|
||||
pEdges[limit-1].m_handle = 0;
|
||||
pEdges[limit-1].m_pos = 0xffff;
|
||||
@@ -251,12 +251,12 @@ void btAxisSweep3::RemoveHandle(unsigned short handle)
|
||||
}
|
||||
|
||||
// free the handle
|
||||
FreeHandle(handle);
|
||||
freeHandle(handle);
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool btAxisSweep3::TestOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB)
|
||||
bool btAxisSweep3::testOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB)
|
||||
{
|
||||
//optimization 1: check the array index (memory address), instead of the m_pos
|
||||
|
||||
@@ -287,17 +287,17 @@ bool btAxisSweep3::TestOverlap(int ignoreAxis,const Handle* pHandleA, const Hand
|
||||
return true;
|
||||
}
|
||||
|
||||
void btAxisSweep3::UpdateHandle(unsigned short handle, const btPoint3& aabbMin,const btPoint3& aabbMax)
|
||||
void btAxisSweep3::updateHandle(unsigned short handle, const btPoint3& aabbMin,const btPoint3& aabbMax)
|
||||
{
|
||||
// assert(bounds.IsFinite());
|
||||
//assert(bounds.HasVolume());
|
||||
|
||||
Handle* pHandle = GetHandle(handle);
|
||||
Handle* pHandle = getHandle(handle);
|
||||
|
||||
// quantize the new bounds
|
||||
unsigned short min[3], max[3];
|
||||
Quantize(min, aabbMin, 0);
|
||||
Quantize(max, aabbMax, 1);
|
||||
quantize(min, aabbMin, 0);
|
||||
quantize(max, aabbMax, 1);
|
||||
|
||||
// update changed edges
|
||||
for (int axis = 0; axis < 3; axis++)
|
||||
@@ -313,39 +313,39 @@ void btAxisSweep3::UpdateHandle(unsigned short handle, const btPoint3& aabbMin,c
|
||||
|
||||
// expand (only adds overlaps)
|
||||
if (dmin < 0)
|
||||
SortMinDown(axis, emin);
|
||||
sortMinDown(axis, emin);
|
||||
|
||||
if (dmax > 0)
|
||||
SortMaxUp(axis, emax);
|
||||
sortMaxUp(axis, emax);
|
||||
|
||||
// shrink (only removes overlaps)
|
||||
if (dmin > 0)
|
||||
SortMinUp(axis, emin);
|
||||
sortMinUp(axis, emin);
|
||||
|
||||
if (dmax < 0)
|
||||
SortMaxDown(axis, emax);
|
||||
sortMaxDown(axis, emax);
|
||||
}
|
||||
|
||||
//PrintAxis(1);
|
||||
}
|
||||
|
||||
// sorting a min edge downwards can only ever *add* overlaps
|
||||
void btAxisSweep3::SortMinDown(int axis, unsigned short edge, bool updateOverlaps)
|
||||
void btAxisSweep3::sortMinDown(int axis, unsigned short edge, bool updateOverlaps)
|
||||
{
|
||||
Edge* pEdge = m_pEdges[axis] + edge;
|
||||
Edge* pPrev = pEdge - 1;
|
||||
Handle* pHandleEdge = GetHandle(pEdge->m_handle);
|
||||
Handle* pHandleEdge = getHandle(pEdge->m_handle);
|
||||
|
||||
while (pEdge->m_pos < pPrev->m_pos)
|
||||
{
|
||||
Handle* pHandlePrev = GetHandle(pPrev->m_handle);
|
||||
Handle* pHandlePrev = getHandle(pPrev->m_handle);
|
||||
|
||||
if (pPrev->IsMax())
|
||||
{
|
||||
// if previous edge is a maximum check the bounds and add an overlap if necessary
|
||||
if (updateOverlaps && TestOverlap(axis,pHandleEdge, pHandlePrev))
|
||||
if (updateOverlaps && testOverlap(axis,pHandleEdge, pHandlePrev))
|
||||
{
|
||||
AddOverlappingPair(pHandleEdge,pHandlePrev);
|
||||
addOverlappingPair(pHandleEdge,pHandlePrev);
|
||||
|
||||
//AddOverlap(pEdge->m_handle, pPrev->m_handle);
|
||||
|
||||
@@ -371,25 +371,25 @@ void btAxisSweep3::SortMinDown(int axis, unsigned short edge, bool updateOverlap
|
||||
}
|
||||
|
||||
// sorting a min edge upwards can only ever *remove* overlaps
|
||||
void btAxisSweep3::SortMinUp(int axis, unsigned short edge, bool updateOverlaps)
|
||||
void btAxisSweep3::sortMinUp(int axis, unsigned short edge, bool updateOverlaps)
|
||||
{
|
||||
Edge* pEdge = m_pEdges[axis] + edge;
|
||||
Edge* pNext = pEdge + 1;
|
||||
Handle* pHandleEdge = GetHandle(pEdge->m_handle);
|
||||
Handle* pHandleEdge = getHandle(pEdge->m_handle);
|
||||
|
||||
while (pEdge->m_pos > pNext->m_pos)
|
||||
{
|
||||
Handle* pHandleNext = GetHandle(pNext->m_handle);
|
||||
Handle* pHandleNext = getHandle(pNext->m_handle);
|
||||
|
||||
if (pNext->IsMax())
|
||||
{
|
||||
// if next edge is maximum remove any overlap between the two handles
|
||||
if (updateOverlaps)
|
||||
{
|
||||
Handle* handle0 = GetHandle(pEdge->m_handle);
|
||||
Handle* handle1 = GetHandle(pNext->m_handle);
|
||||
Handle* handle0 = getHandle(pEdge->m_handle);
|
||||
Handle* handle1 = getHandle(pNext->m_handle);
|
||||
btBroadphasePair tmpPair(*handle0,*handle1);
|
||||
RemoveOverlappingPair(tmpPair);
|
||||
removeOverlappingPair(tmpPair);
|
||||
|
||||
}
|
||||
|
||||
@@ -413,29 +413,29 @@ void btAxisSweep3::SortMinUp(int axis, unsigned short edge, bool updateOverlaps)
|
||||
}
|
||||
|
||||
// sorting a max edge downwards can only ever *remove* overlaps
|
||||
void btAxisSweep3::SortMaxDown(int axis, unsigned short edge, bool updateOverlaps)
|
||||
void btAxisSweep3::sortMaxDown(int axis, unsigned short edge, bool updateOverlaps)
|
||||
{
|
||||
Edge* pEdge = m_pEdges[axis] + edge;
|
||||
Edge* pPrev = pEdge - 1;
|
||||
Handle* pHandleEdge = GetHandle(pEdge->m_handle);
|
||||
Handle* pHandleEdge = getHandle(pEdge->m_handle);
|
||||
|
||||
while (pEdge->m_pos < pPrev->m_pos)
|
||||
{
|
||||
Handle* pHandlePrev = GetHandle(pPrev->m_handle);
|
||||
Handle* pHandlePrev = getHandle(pPrev->m_handle);
|
||||
|
||||
if (!pPrev->IsMax())
|
||||
{
|
||||
// if previous edge was a minimum remove any overlap between the two handles
|
||||
if (updateOverlaps)
|
||||
{
|
||||
Handle* handle0 = GetHandle(pEdge->m_handle);
|
||||
Handle* handle1 = GetHandle(pPrev->m_handle);
|
||||
btBroadphasePair* pair = FindPair(handle0,handle1);
|
||||
Handle* handle0 = getHandle(pEdge->m_handle);
|
||||
Handle* handle1 = getHandle(pPrev->m_handle);
|
||||
btBroadphasePair* pair = findPair(handle0,handle1);
|
||||
//assert(pair);
|
||||
|
||||
if (pair)
|
||||
{
|
||||
RemoveOverlappingPair(*pair);
|
||||
removeOverlappingPair(*pair);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,24 +459,24 @@ void btAxisSweep3::SortMaxDown(int axis, unsigned short edge, bool updateOverlap
|
||||
}
|
||||
|
||||
// sorting a max edge upwards can only ever *add* overlaps
|
||||
void btAxisSweep3::SortMaxUp(int axis, unsigned short edge, bool updateOverlaps)
|
||||
void btAxisSweep3::sortMaxUp(int axis, unsigned short edge, bool updateOverlaps)
|
||||
{
|
||||
Edge* pEdge = m_pEdges[axis] + edge;
|
||||
Edge* pNext = pEdge + 1;
|
||||
Handle* pHandleEdge = GetHandle(pEdge->m_handle);
|
||||
Handle* pHandleEdge = getHandle(pEdge->m_handle);
|
||||
|
||||
while (pEdge->m_pos > pNext->m_pos)
|
||||
{
|
||||
Handle* pHandleNext = GetHandle(pNext->m_handle);
|
||||
Handle* pHandleNext = getHandle(pNext->m_handle);
|
||||
|
||||
if (!pNext->IsMax())
|
||||
{
|
||||
// if next edge is a minimum check the bounds and add an overlap if necessary
|
||||
if (updateOverlaps && TestOverlap(axis, pHandleEdge, pHandleNext))
|
||||
if (updateOverlaps && testOverlap(axis, pHandleEdge, pHandleNext))
|
||||
{
|
||||
Handle* handle0 = GetHandle(pEdge->m_handle);
|
||||
Handle* handle1 = GetHandle(pNext->m_handle);
|
||||
AddOverlappingPair(handle0,handle1);
|
||||
Handle* handle0 = getHandle(pEdge->m_handle);
|
||||
Handle* handle1 = getHandle(pNext->m_handle);
|
||||
addOverlappingPair(handle0,handle1);
|
||||
}
|
||||
|
||||
// update edge reference in other handle
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/// btAxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase.
|
||||
/// It uses arrays rather then lists for storage of the 3 axis. Also it operates using integer coordinates instead of floats.
|
||||
/// The TestOverlap check is optimized to check the array index, rather then the actual AABB coordinates/pos
|
||||
/// The testOverlap check is optimized to check the array index, rather then the actual AABB coordinates/pos
|
||||
class btAxisSweep3 : public btOverlappingPairCache
|
||||
{
|
||||
|
||||
@@ -74,41 +74,41 @@ private:
|
||||
|
||||
|
||||
// allocation/deallocation
|
||||
unsigned short AllocHandle();
|
||||
void FreeHandle(unsigned short handle);
|
||||
unsigned short allocHandle();
|
||||
void freeHandle(unsigned short handle);
|
||||
|
||||
|
||||
bool TestOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB);
|
||||
bool testOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB);
|
||||
|
||||
//Overlap* AddOverlap(unsigned short handleA, unsigned short handleB);
|
||||
//void RemoveOverlap(unsigned short handleA, unsigned short handleB);
|
||||
|
||||
void Quantize(unsigned short* out, const btPoint3& point, int isMax) const;
|
||||
void quantize(unsigned short* out, const btPoint3& point, int isMax) const;
|
||||
|
||||
void SortMinDown(int axis, unsigned short edge, bool updateOverlaps = true);
|
||||
void SortMinUp(int axis, unsigned short edge, bool updateOverlaps = true);
|
||||
void SortMaxDown(int axis, unsigned short edge, bool updateOverlaps = true);
|
||||
void SortMaxUp(int axis, unsigned short edge, bool updateOverlaps = true);
|
||||
void sortMinDown(int axis, unsigned short edge, bool updateOverlaps = true);
|
||||
void sortMinUp(int axis, unsigned short edge, bool updateOverlaps = true);
|
||||
void sortMaxDown(int axis, unsigned short edge, bool updateOverlaps = true);
|
||||
void sortMaxUp(int axis, unsigned short edge, bool updateOverlaps = true);
|
||||
|
||||
public:
|
||||
btAxisSweep3(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, int maxHandles = 16384);
|
||||
virtual ~btAxisSweep3();
|
||||
|
||||
virtual void RefreshOverlappingPairs()
|
||||
virtual void refreshOverlappingPairs()
|
||||
{
|
||||
//this is replace by sweep and prune
|
||||
}
|
||||
|
||||
unsigned short AddHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask);
|
||||
void RemoveHandle(unsigned short handle);
|
||||
void UpdateHandle(unsigned short handle, const btPoint3& aabbMin,const btPoint3& aabbMax);
|
||||
inline Handle* GetHandle(unsigned short index) const {return m_pHandles + index;}
|
||||
unsigned short addHandle(const btPoint3& aabbMin,const btPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask);
|
||||
void removeHandle(unsigned short handle);
|
||||
void updateHandle(unsigned short handle, const btPoint3& aabbMin,const btPoint3& aabbMax);
|
||||
inline Handle* getHandle(unsigned short index) const {return m_pHandles + index;}
|
||||
|
||||
|
||||
//Broadphase Interface
|
||||
virtual btBroadphaseProxy* CreateProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
|
||||
virtual void DestroyProxy(btBroadphaseProxy* proxy);
|
||||
virtual void SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
|
||||
virtual btBroadphaseProxy* createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
|
||||
virtual void destroyProxy(btBroadphaseProxy* proxy);
|
||||
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ class btBroadphaseInterface
|
||||
public:
|
||||
virtual ~btBroadphaseInterface() {}
|
||||
|
||||
virtual btBroadphaseProxy* CreateProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask) =0;
|
||||
virtual void DestroyProxy(btBroadphaseProxy* proxy)=0;
|
||||
virtual void SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)=0;
|
||||
virtual void CleanProxyFromPairs(btBroadphaseProxy* proxy)=0;
|
||||
virtual btBroadphaseProxy* createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask) =0;
|
||||
virtual void destroyProxy(btBroadphaseProxy* proxy)=0;
|
||||
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)=0;
|
||||
virtual void cleanProxyFromPairs(btBroadphaseProxy* proxy)=0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -74,22 +74,22 @@ struct btBroadphaseProxy
|
||||
{
|
||||
}
|
||||
|
||||
static inline bool IsPolyhedral(int proxyType)
|
||||
static inline bool isPolyhedral(int proxyType)
|
||||
{
|
||||
return (proxyType < IMPLICIT_CONVEX_SHAPES_START_HERE);
|
||||
}
|
||||
|
||||
static inline bool IsConvex(int proxyType)
|
||||
static inline bool isConvex(int proxyType)
|
||||
{
|
||||
return (proxyType < CONCAVE_SHAPES_START_HERE);
|
||||
}
|
||||
|
||||
static inline bool IsConcave(int proxyType)
|
||||
static inline bool isConcave(int proxyType)
|
||||
{
|
||||
return ((proxyType > CONCAVE_SHAPES_START_HERE) &&
|
||||
(proxyType < CONCAVE_SHAPES_END_HERE));
|
||||
}
|
||||
static inline bool IsCompound(int proxyType)
|
||||
static inline bool isCompound(int proxyType)
|
||||
{
|
||||
return (proxyType == COMPOUND_SHAPE_PROXYTYPE);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ struct btCollisionAlgorithmConstructionInfo
|
||||
|
||||
btDispatcher* m_dispatcher;
|
||||
|
||||
int GetDispatcherId();
|
||||
int getDispatcherId();
|
||||
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ protected:
|
||||
btDispatcher* m_dispatcher;
|
||||
|
||||
protected:
|
||||
int GetDispatcherId();
|
||||
int getDispatcherId();
|
||||
|
||||
public:
|
||||
|
||||
@@ -57,9 +57,9 @@ public:
|
||||
|
||||
virtual ~btCollisionAlgorithm() {};
|
||||
|
||||
virtual void ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const struct btDispatcherInfo& dispatchInfo) = 0;
|
||||
virtual void processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const struct btDispatcherInfo& dispatchInfo) = 0;
|
||||
|
||||
virtual float CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const struct btDispatcherInfo& dispatchInfo) = 0;
|
||||
virtual float calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const struct btDispatcherInfo& dispatchInfo) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -66,32 +66,32 @@ class btDispatcher
|
||||
public:
|
||||
virtual ~btDispatcher() ;
|
||||
|
||||
virtual btCollisionAlgorithm* FindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1) = 0;
|
||||
virtual btCollisionAlgorithm* findAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1) = 0;
|
||||
|
||||
//
|
||||
// asume dispatchers to have unique id's in the range [0..max dispacher]
|
||||
//
|
||||
virtual int GetUniqueId() = 0;
|
||||
virtual int getUniqueId() = 0;
|
||||
|
||||
virtual btPersistentManifold* GetNewManifold(void* body0,void* body1)=0;
|
||||
virtual btPersistentManifold* getNewManifold(void* body0,void* body1)=0;
|
||||
|
||||
virtual void ReleaseManifold(btPersistentManifold* manifold)=0;
|
||||
virtual void releaseManifold(btPersistentManifold* manifold)=0;
|
||||
|
||||
virtual void ClearManifold(btPersistentManifold* manifold)=0;
|
||||
virtual void clearManifold(btPersistentManifold* manifold)=0;
|
||||
|
||||
virtual bool NeedsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1) = 0;
|
||||
virtual bool needsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1) = 0;
|
||||
|
||||
virtual bool NeedsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1)=0;
|
||||
virtual bool needsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1)=0;
|
||||
|
||||
virtual btManifoldResult* GetNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold) =0;
|
||||
virtual btManifoldResult* getNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold) =0;
|
||||
|
||||
virtual void ReleaseManifoldResult(btManifoldResult*)=0;
|
||||
virtual void releaseManifoldResult(btManifoldResult*)=0;
|
||||
|
||||
virtual void DispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)=0;
|
||||
virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)=0;
|
||||
|
||||
virtual int GetNumManifolds() const = 0;
|
||||
virtual int getNumManifolds() const = 0;
|
||||
|
||||
virtual btPersistentManifold* GetManifoldByIndexInternal(int index) = 0;
|
||||
virtual btPersistentManifold* getManifoldByIndexInternal(int index) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ btOverlappingPairCache::~btOverlappingPairCache()
|
||||
}
|
||||
|
||||
|
||||
void btOverlappingPairCache::RemoveOverlappingPair(btBroadphasePair& findPair)
|
||||
void btOverlappingPairCache::removeOverlappingPair(btBroadphasePair& findPair)
|
||||
{
|
||||
|
||||
std::set<btBroadphasePair>::iterator it = m_overlappingPairSet.find(findPair);
|
||||
@@ -46,13 +46,13 @@ void btOverlappingPairCache::RemoveOverlappingPair(btBroadphasePair& findPair)
|
||||
{
|
||||
gOverlappingPairs--;
|
||||
btBroadphasePair* pair = (btBroadphasePair*)(&(*it));
|
||||
CleanOverlappingPair(*pair);
|
||||
cleanOverlappingPair(*pair);
|
||||
m_overlappingPairSet.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void btOverlappingPairCache::CleanOverlappingPair(btBroadphasePair& pair)
|
||||
void btOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair)
|
||||
{
|
||||
for (int dispatcherId=0;dispatcherId<SIMPLE_MAX_ALGORITHMS;dispatcherId++)
|
||||
{
|
||||
@@ -70,12 +70,12 @@ void btOverlappingPairCache::CleanOverlappingPair(btBroadphasePair& pair)
|
||||
|
||||
|
||||
|
||||
void btOverlappingPairCache::AddOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
||||
void btOverlappingPairCache::addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
||||
{
|
||||
//don't add overlap with own
|
||||
assert(proxy0 != proxy1);
|
||||
|
||||
if (!NeedsCollision(proxy0,proxy1))
|
||||
if (!needsCollision(proxy0,proxy1))
|
||||
return;
|
||||
|
||||
|
||||
@@ -86,13 +86,13 @@ void btOverlappingPairCache::AddOverlappingPair(btBroadphaseProxy* proxy0,btBroa
|
||||
|
||||
}
|
||||
|
||||
///this FindPair becomes really slow. Either sort the list to speedup the query, or
|
||||
///this findPair becomes really slow. Either sort the list to speedup the query, or
|
||||
///use a different solution. It is mainly used for Removing overlapping pairs. Removal could be delayed.
|
||||
///we could keep a linked list in each proxy, and store pair in one of the proxies (with lowest memory address)
|
||||
///Also we can use a 2D bitmap, which can be useful for a future GPU implementation
|
||||
btBroadphasePair* btOverlappingPairCache::FindPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
||||
btBroadphasePair* btOverlappingPairCache::findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
||||
{
|
||||
if (!NeedsCollision(proxy0,proxy1))
|
||||
if (!needsCollision(proxy0,proxy1))
|
||||
return 0;
|
||||
|
||||
btBroadphasePair tmpPair(*proxy0,*proxy1);
|
||||
@@ -109,7 +109,7 @@ void btOverlappingPairCache::AddOverlappingPair(btBroadphaseProxy* proxy0,btBroa
|
||||
|
||||
|
||||
|
||||
void btOverlappingPairCache::CleanProxyFromPairs(btBroadphaseProxy* proxy)
|
||||
void btOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy)
|
||||
{
|
||||
|
||||
class CleanPairCallback : public btOverlapCallback
|
||||
@@ -123,12 +123,12 @@ void btOverlappingPairCache::CleanProxyFromPairs(btBroadphaseProxy* proxy)
|
||||
m_pairCache(pairCache)
|
||||
{
|
||||
}
|
||||
virtual bool ProcessOverlap(btBroadphasePair& pair)
|
||||
virtual bool processOverlap(btBroadphasePair& pair)
|
||||
{
|
||||
if ((pair.m_pProxy0 == m_cleanProxy) ||
|
||||
(pair.m_pProxy1 == m_cleanProxy))
|
||||
{
|
||||
m_pairCache->CleanOverlappingPair(pair);
|
||||
m_pairCache->cleanOverlappingPair(pair);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -137,13 +137,13 @@ void btOverlappingPairCache::CleanProxyFromPairs(btBroadphaseProxy* proxy)
|
||||
|
||||
CleanPairCallback cleanPairs(proxy,this);
|
||||
|
||||
ProcessAllOverlappingPairs(&cleanPairs);
|
||||
processAllOverlappingPairs(&cleanPairs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void btOverlappingPairCache::RemoveOverlappingPairsContainingProxy(btBroadphaseProxy* proxy)
|
||||
void btOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy)
|
||||
{
|
||||
|
||||
class RemovePairCallback : public btOverlapCallback
|
||||
@@ -155,7 +155,7 @@ void btOverlappingPairCache::RemoveOverlappingPairsContainingProxy(btBroadphaseP
|
||||
:m_obsoleteProxy(obsoleteProxy)
|
||||
{
|
||||
}
|
||||
virtual bool ProcessOverlap(btBroadphasePair& pair)
|
||||
virtual bool processOverlap(btBroadphasePair& pair)
|
||||
{
|
||||
return ((pair.m_pProxy0 == m_obsoleteProxy) ||
|
||||
(pair.m_pProxy1 == m_obsoleteProxy));
|
||||
@@ -166,21 +166,21 @@ void btOverlappingPairCache::RemoveOverlappingPairsContainingProxy(btBroadphaseP
|
||||
|
||||
RemovePairCallback removeCallback(proxy);
|
||||
|
||||
ProcessAllOverlappingPairs(&removeCallback);
|
||||
processAllOverlappingPairs(&removeCallback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void btOverlappingPairCache::ProcessAllOverlappingPairs(btOverlapCallback* callback)
|
||||
void btOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callback)
|
||||
{
|
||||
std::set<btBroadphasePair>::iterator it = m_overlappingPairSet.begin();
|
||||
for (; !(it==m_overlappingPairSet.end());)
|
||||
{
|
||||
|
||||
btBroadphasePair* pair = (btBroadphasePair*)(&(*it));
|
||||
if (callback->ProcessOverlap(*pair))
|
||||
if (callback->processOverlap(*pair))
|
||||
{
|
||||
CleanOverlappingPair(*pair);
|
||||
cleanOverlappingPair(*pair);
|
||||
|
||||
std::set<btBroadphasePair>::iterator it2 = it;
|
||||
//why does next line not compile under OS X??
|
||||
|
||||
@@ -30,7 +30,7 @@ virtual ~btOverlapCallback()
|
||||
{
|
||||
}
|
||||
//return true for deletion of the pair
|
||||
virtual bool ProcessOverlap(btBroadphasePair& pair) = 0;
|
||||
virtual bool processOverlap(btBroadphasePair& pair) = 0;
|
||||
};
|
||||
|
||||
///OverlappingPairCache maintains the objects with overlapping AABB
|
||||
@@ -48,23 +48,23 @@ class btOverlappingPairCache : public btBroadphaseInterface
|
||||
btOverlappingPairCache();
|
||||
virtual ~btOverlappingPairCache();
|
||||
|
||||
void ProcessAllOverlappingPairs(btOverlapCallback*);
|
||||
void processAllOverlappingPairs(btOverlapCallback*);
|
||||
|
||||
void RemoveOverlappingPair(btBroadphasePair& pair);
|
||||
void removeOverlappingPair(btBroadphasePair& pair);
|
||||
|
||||
void CleanOverlappingPair(btBroadphasePair& pair);
|
||||
void cleanOverlappingPair(btBroadphasePair& pair);
|
||||
|
||||
void AddOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
|
||||
void addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
|
||||
|
||||
btBroadphasePair* FindPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
|
||||
btBroadphasePair* findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
|
||||
|
||||
|
||||
void CleanProxyFromPairs(btBroadphaseProxy* proxy);
|
||||
void cleanProxyFromPairs(btBroadphaseProxy* proxy);
|
||||
|
||||
void RemoveOverlappingPairsContainingProxy(btBroadphaseProxy* proxy);
|
||||
void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy);
|
||||
|
||||
|
||||
inline bool NeedsCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const
|
||||
inline bool needsCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const
|
||||
{
|
||||
bool collides = proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask;
|
||||
collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask);
|
||||
@@ -74,7 +74,7 @@ class btOverlappingPairCache : public btBroadphaseInterface
|
||||
|
||||
|
||||
|
||||
virtual void RefreshOverlappingPairs() =0;
|
||||
virtual void refreshOverlappingPairs() =0;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ btSimpleBroadphase::~btSimpleBroadphase()
|
||||
}
|
||||
|
||||
|
||||
btBroadphaseProxy* btSimpleBroadphase::CreateProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask)
|
||||
btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask)
|
||||
{
|
||||
if (m_numProxies >= m_maxProxies)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ btBroadphaseProxy* btSimpleBroadphase::CreateProxy( const btVector3& min, cons
|
||||
class RemovingOverlapCallback : public btOverlapCallback
|
||||
{
|
||||
protected:
|
||||
virtual bool ProcessOverlap(btBroadphasePair& pair)
|
||||
virtual bool processOverlap(btBroadphasePair& pair)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class RemovePairContainingProxy
|
||||
{
|
||||
}
|
||||
protected:
|
||||
virtual bool ProcessOverlap(btBroadphasePair& pair)
|
||||
virtual bool processOverlap(btBroadphasePair& pair)
|
||||
{
|
||||
btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy0);
|
||||
btSimpleBroadphaseProxy* proxy1 = static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy1);
|
||||
@@ -122,7 +122,7 @@ protected:
|
||||
};
|
||||
};
|
||||
|
||||
void btSimpleBroadphase::DestroyProxy(btBroadphaseProxy* proxyOrg)
|
||||
void btSimpleBroadphase::destroyProxy(btBroadphaseProxy* proxyOrg)
|
||||
{
|
||||
|
||||
int i;
|
||||
@@ -134,7 +134,7 @@ void btSimpleBroadphase::DestroyProxy(btBroadphaseProxy* proxyOrg)
|
||||
assert (index < m_maxProxies);
|
||||
m_freeProxies[--m_firstFreeProxy] = index;
|
||||
|
||||
//RemoveOverlappingPairsContainingProxy(proxyOrg);
|
||||
//removeOverlappingPairsContainingProxy(proxyOrg);
|
||||
|
||||
assert(0);
|
||||
//then remove non-overlapping ones
|
||||
@@ -142,11 +142,11 @@ void btSimpleBroadphase::DestroyProxy(btBroadphaseProxy* proxyOrg)
|
||||
{
|
||||
btBroadphasePair& pair = GetOverlappingPair(i);
|
||||
|
||||
btSimpleBroadphaseProxy* proxy0 = GetSimpleProxyFromProxy(pair.m_pProxy0);
|
||||
btSimpleBroadphaseProxy* proxy1 = GetSimpleProxyFromProxy(pair.m_pProxy1);
|
||||
btSimpleBroadphaseProxy* proxy0 = getSimpleProxyFromProxy(pair.m_pProxy0);
|
||||
btSimpleBroadphaseProxy* proxy1 = getSimpleProxyFromProxy(pair.m_pProxy1);
|
||||
if ((proxy0==proxyOrg) || (proxy1==proxyOrg))
|
||||
{
|
||||
RemoveOverlappingPair(pair);
|
||||
removeOverlappingPair(pair);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -167,9 +167,9 @@ void btSimpleBroadphase::DestroyProxy(btBroadphaseProxy* proxyOrg)
|
||||
|
||||
}
|
||||
|
||||
void btSimpleBroadphase::SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
|
||||
void btSimpleBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax)
|
||||
{
|
||||
btSimpleBroadphaseProxy* sbp = GetSimpleProxyFromProxy(proxy);
|
||||
btSimpleBroadphaseProxy* sbp = getSimpleProxyFromProxy(proxy);
|
||||
sbp->m_min = aabbMin;
|
||||
sbp->m_max = aabbMax;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ void btSimpleBroadphase::SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbM
|
||||
|
||||
|
||||
|
||||
bool btSimpleBroadphase::AabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1)
|
||||
bool btSimpleBroadphase::aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1)
|
||||
{
|
||||
return proxy0->m_min[0] <= proxy1->m_max[0] && proxy1->m_min[0] <= proxy0->m_max[0] &&
|
||||
proxy0->m_min[1] <= proxy1->m_max[1] && proxy1->m_min[1] <= proxy0->m_max[1] &&
|
||||
@@ -196,13 +196,13 @@ bool btSimpleBroadphase::AabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBro
|
||||
class CheckOverlapCallback : public btOverlapCallback
|
||||
{
|
||||
public:
|
||||
virtual bool ProcessOverlap(btBroadphasePair& pair)
|
||||
virtual bool processOverlap(btBroadphasePair& pair)
|
||||
{
|
||||
return (!btSimpleBroadphase::AabbOverlap(static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy0),static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy1)));
|
||||
return (!btSimpleBroadphase::aabbOverlap(static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy0),static_cast<btSimpleBroadphaseProxy*>(pair.m_pProxy1)));
|
||||
}
|
||||
};
|
||||
|
||||
void btSimpleBroadphase::RefreshOverlappingPairs()
|
||||
void btSimpleBroadphase::refreshOverlappingPairs()
|
||||
{
|
||||
//first check for new overlapping pairs
|
||||
int i,j;
|
||||
@@ -213,14 +213,14 @@ void btSimpleBroadphase::RefreshOverlappingPairs()
|
||||
for (j=i+1;j<m_numProxies;j++)
|
||||
{
|
||||
btBroadphaseProxy* proxy1 = m_pProxies[j];
|
||||
btSimpleBroadphaseProxy* p0 = GetSimpleProxyFromProxy(proxy0);
|
||||
btSimpleBroadphaseProxy* p1 = GetSimpleProxyFromProxy(proxy1);
|
||||
btSimpleBroadphaseProxy* p0 = getSimpleProxyFromProxy(proxy0);
|
||||
btSimpleBroadphaseProxy* p1 = getSimpleProxyFromProxy(proxy1);
|
||||
|
||||
if (AabbOverlap(p0,p1))
|
||||
if (aabbOverlap(p0,p1))
|
||||
{
|
||||
if ( !FindPair(proxy0,proxy1))
|
||||
if ( !findPair(proxy0,proxy1))
|
||||
{
|
||||
AddOverlappingPair(proxy0,proxy1);
|
||||
addOverlappingPair(proxy0,proxy1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ void btSimpleBroadphase::RefreshOverlappingPairs()
|
||||
|
||||
CheckOverlapCallback checkOverlap;
|
||||
|
||||
ProcessAllOverlappingPairs(&checkOverlap);
|
||||
processAllOverlappingPairs(&checkOverlap);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class btSimpleBroadphase : public btOverlappingPairCache
|
||||
int m_maxProxies;
|
||||
|
||||
|
||||
inline btSimpleBroadphaseProxy* GetSimpleProxyFromProxy(btBroadphaseProxy* proxy)
|
||||
inline btSimpleBroadphaseProxy* getSimpleProxyFromProxy(btBroadphaseProxy* proxy)
|
||||
{
|
||||
btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(proxy);
|
||||
return proxy0;
|
||||
@@ -64,20 +64,20 @@ class btSimpleBroadphase : public btOverlappingPairCache
|
||||
protected:
|
||||
|
||||
|
||||
virtual void RefreshOverlappingPairs();
|
||||
virtual void refreshOverlappingPairs();
|
||||
public:
|
||||
btSimpleBroadphase(int maxProxies=16384);
|
||||
virtual ~btSimpleBroadphase();
|
||||
|
||||
|
||||
static bool AabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1);
|
||||
static bool aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1);
|
||||
|
||||
|
||||
virtual btBroadphaseProxy* CreateProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
|
||||
virtual btBroadphaseProxy* createProxy( const btVector3& min, const btVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask);
|
||||
|
||||
|
||||
virtual void DestroyProxy(btBroadphaseProxy* proxy);
|
||||
virtual void SetAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
|
||||
virtual void destroyProxy(btBroadphaseProxy* proxy);
|
||||
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ btCollisionDispatcher::btCollisionDispatcher ():
|
||||
{
|
||||
for (int j=0;j<MAX_BROADPHASE_COLLISION_TYPES;j++)
|
||||
{
|
||||
m_doubleDispatch[i][j] = InternalFindCreateFunc(i,j);
|
||||
m_doubleDispatch[i][j] = internalFindCreateFunc(i,j);
|
||||
assert(m_doubleDispatch[i][j]);
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ btCollisionDispatcher::btCollisionDispatcher ():
|
||||
|
||||
};
|
||||
|
||||
void btCollisionDispatcher::RegisterCollisionCreateFunc(int proxyType0, int proxyType1, btCollisionAlgorithmCreateFunc *createFunc)
|
||||
void btCollisionDispatcher::registerCollisionCreateFunc(int proxyType0, int proxyType1, btCollisionAlgorithmCreateFunc *createFunc)
|
||||
{
|
||||
m_doubleDispatch[proxyType0][proxyType1] = createFunc;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ btCollisionDispatcher::~btCollisionDispatcher()
|
||||
delete m_emptyCreateFunc;
|
||||
}
|
||||
|
||||
btPersistentManifold* btCollisionDispatcher::GetNewManifold(void* b0,void* b1)
|
||||
btPersistentManifold* btCollisionDispatcher::getNewManifold(void* b0,void* b1)
|
||||
{
|
||||
gNumManifold++;
|
||||
|
||||
@@ -91,20 +91,20 @@ btPersistentManifold* btCollisionDispatcher::GetNewManifold(void* b0,void* b1)
|
||||
return manifold;
|
||||
}
|
||||
|
||||
void btCollisionDispatcher::ClearManifold(btPersistentManifold* manifold)
|
||||
void btCollisionDispatcher::clearManifold(btPersistentManifold* manifold)
|
||||
{
|
||||
manifold->ClearManifold();
|
||||
manifold->clearManifold();
|
||||
}
|
||||
|
||||
|
||||
void btCollisionDispatcher::ReleaseManifold(btPersistentManifold* manifold)
|
||||
void btCollisionDispatcher::releaseManifold(btPersistentManifold* manifold)
|
||||
{
|
||||
|
||||
gNumManifold--;
|
||||
|
||||
//printf("ReleaseManifold: gNumManifold %d\n",gNumManifold);
|
||||
//printf("releaseManifold: gNumManifold %d\n",gNumManifold);
|
||||
|
||||
ClearManifold(manifold);
|
||||
clearManifold(manifold);
|
||||
|
||||
std::vector<btPersistentManifold*>::iterator i =
|
||||
std::find(m_manifoldsPtr.begin(), m_manifoldsPtr.end(), manifold);
|
||||
@@ -121,7 +121,7 @@ void btCollisionDispatcher::ReleaseManifold(btPersistentManifold* manifold)
|
||||
|
||||
|
||||
|
||||
btCollisionAlgorithm* btCollisionDispatcher::FindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
btCollisionAlgorithm* btCollisionDispatcher::findAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
{
|
||||
#define USE_DISPATCH_REGISTRY_ARRAY 1
|
||||
#ifdef USE_DISPATCH_REGISTRY_ARRAY
|
||||
@@ -129,39 +129,39 @@ btCollisionAlgorithm* btCollisionDispatcher::FindAlgorithm(btBroadphaseProxy& pr
|
||||
btCollisionObject* body1 = (btCollisionObject*)proxy1.m_clientObject;
|
||||
btCollisionAlgorithmConstructionInfo ci;
|
||||
ci.m_dispatcher = this;
|
||||
btCollisionAlgorithm* algo = m_doubleDispatch[body0->m_collisionShape->GetShapeType()][body1->m_collisionShape->GetShapeType()]
|
||||
btCollisionAlgorithm* algo = m_doubleDispatch[body0->m_collisionShape->getShapeType()][body1->m_collisionShape->getShapeType()]
|
||||
->CreateCollisionAlgorithm(ci,&proxy0,&proxy1);
|
||||
#else
|
||||
btCollisionAlgorithm* algo = InternalFindAlgorithm(proxy0,proxy1);
|
||||
btCollisionAlgorithm* algo = internalFindAlgorithm(proxy0,proxy1);
|
||||
#endif //USE_DISPATCH_REGISTRY_ARRAY
|
||||
return algo;
|
||||
}
|
||||
|
||||
|
||||
btCollisionAlgorithmCreateFunc* btCollisionDispatcher::InternalFindCreateFunc(int proxyType0,int proxyType1)
|
||||
btCollisionAlgorithmCreateFunc* btCollisionDispatcher::internalFindCreateFunc(int proxyType0,int proxyType1)
|
||||
{
|
||||
|
||||
if (btBroadphaseProxy::IsConvex(proxyType0) && btBroadphaseProxy::IsConvex(proxyType1))
|
||||
if (btBroadphaseProxy::isConvex(proxyType0) && btBroadphaseProxy::isConvex(proxyType1))
|
||||
{
|
||||
return m_convexConvexCreateFunc;
|
||||
}
|
||||
|
||||
if (btBroadphaseProxy::IsConvex(proxyType0) && btBroadphaseProxy::IsConcave(proxyType1))
|
||||
if (btBroadphaseProxy::isConvex(proxyType0) && btBroadphaseProxy::isConcave(proxyType1))
|
||||
{
|
||||
return m_convexConcaveCreateFunc;
|
||||
}
|
||||
|
||||
if (btBroadphaseProxy::IsConvex(proxyType1) && btBroadphaseProxy::IsConcave(proxyType0))
|
||||
if (btBroadphaseProxy::isConvex(proxyType1) && btBroadphaseProxy::isConcave(proxyType0))
|
||||
{
|
||||
return m_swappedConvexConcaveCreateFunc;
|
||||
}
|
||||
|
||||
if (btBroadphaseProxy::IsCompound(proxyType0))
|
||||
if (btBroadphaseProxy::isCompound(proxyType0))
|
||||
{
|
||||
return m_compoundCreateFunc;
|
||||
} else
|
||||
{
|
||||
if (btBroadphaseProxy::IsCompound(proxyType1))
|
||||
if (btBroadphaseProxy::isCompound(proxyType1))
|
||||
{
|
||||
return m_swappedCompoundCreateFunc;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ btCollisionAlgorithmCreateFunc* btCollisionDispatcher::InternalFindCreateFunc(in
|
||||
|
||||
|
||||
|
||||
btCollisionAlgorithm* btCollisionDispatcher::InternalFindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
btCollisionAlgorithm* btCollisionDispatcher::internalFindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
{
|
||||
m_count++;
|
||||
btCollisionObject* body0 = (btCollisionObject*)proxy0.m_clientObject;
|
||||
@@ -182,27 +182,27 @@ btCollisionAlgorithm* btCollisionDispatcher::InternalFindAlgorithm(btBroadphaseP
|
||||
btCollisionAlgorithmConstructionInfo ci;
|
||||
ci.m_dispatcher = this;
|
||||
|
||||
if (body0->m_collisionShape->IsConvex() && body1->m_collisionShape->IsConvex() )
|
||||
if (body0->m_collisionShape->isConvex() && body1->m_collisionShape->isConvex() )
|
||||
{
|
||||
return new btConvexConvexAlgorithm(0,ci,&proxy0,&proxy1);
|
||||
}
|
||||
|
||||
if (body0->m_collisionShape->IsConvex() && body1->m_collisionShape->IsConcave())
|
||||
if (body0->m_collisionShape->isConvex() && body1->m_collisionShape->isConcave())
|
||||
{
|
||||
return new btConvexConcaveCollisionAlgorithm(ci,&proxy0,&proxy1);
|
||||
}
|
||||
|
||||
if (body1->m_collisionShape->IsConvex() && body0->m_collisionShape->IsConcave())
|
||||
if (body1->m_collisionShape->isConvex() && body0->m_collisionShape->isConcave())
|
||||
{
|
||||
return new btConvexConcaveCollisionAlgorithm(ci,&proxy1,&proxy0);
|
||||
}
|
||||
|
||||
if (body0->m_collisionShape->IsCompound())
|
||||
if (body0->m_collisionShape->isCompound())
|
||||
{
|
||||
return new btCompoundCollisionAlgorithm(ci,&proxy0,&proxy1);
|
||||
} else
|
||||
{
|
||||
if (body1->m_collisionShape->IsCompound())
|
||||
if (body1->m_collisionShape->isCompound())
|
||||
{
|
||||
return new btCompoundCollisionAlgorithm(ci,&proxy1,&proxy0);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ btCollisionAlgorithm* btCollisionDispatcher::InternalFindAlgorithm(btBroadphaseP
|
||||
|
||||
}
|
||||
|
||||
bool btCollisionDispatcher::NeedsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1)
|
||||
bool btCollisionDispatcher::needsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1)
|
||||
{
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ bool btCollisionDispatcher::NeedsResponse(const btCollisionObject& colObj0,cons
|
||||
return hasResponse;
|
||||
}
|
||||
|
||||
bool btCollisionDispatcher::NeedsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
bool btCollisionDispatcher::needsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
{
|
||||
|
||||
btCollisionObject* body0 = (btCollisionObject*)proxy0.m_clientObject;
|
||||
@@ -249,7 +249,7 @@ bool btCollisionDispatcher::NeedsCollision(btBroadphaseProxy& proxy0,btBroadphas
|
||||
}
|
||||
|
||||
///allows the user to get contact point callbacks
|
||||
btManifoldResult* btCollisionDispatcher::GetNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold)
|
||||
btManifoldResult* btCollisionDispatcher::getNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold)
|
||||
{
|
||||
|
||||
|
||||
@@ -259,34 +259,34 @@ btManifoldResult* btCollisionDispatcher::GetNewManifoldResult(btCollisionObject*
|
||||
}
|
||||
|
||||
///allows the user to get contact point callbacks
|
||||
void btCollisionDispatcher::ReleaseManifoldResult(btManifoldResult*)
|
||||
void btCollisionDispatcher::releaseManifoldResult(btManifoldResult*)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
class CollisionPairCallback : public btOverlapCallback
|
||||
class btCollisionPairCallback : public btOverlapCallback
|
||||
{
|
||||
btDispatcherInfo& m_dispatchInfo;
|
||||
btCollisionDispatcher* m_dispatcher;
|
||||
int m_dispatcherId;
|
||||
public:
|
||||
|
||||
CollisionPairCallback(btDispatcherInfo& dispatchInfo,btCollisionDispatcher* dispatcher,int dispatcherId)
|
||||
btCollisionPairCallback(btDispatcherInfo& dispatchInfo,btCollisionDispatcher* dispatcher,int dispatcherId)
|
||||
:m_dispatchInfo(dispatchInfo),
|
||||
m_dispatcher(dispatcher),
|
||||
m_dispatcherId(dispatcherId)
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool ProcessOverlap(btBroadphasePair& pair)
|
||||
virtual bool processOverlap(btBroadphasePair& pair)
|
||||
{
|
||||
if (m_dispatcherId>= 0)
|
||||
{
|
||||
//dispatcher will keep algorithms persistent in the collision pair
|
||||
if (!pair.m_algorithms[m_dispatcherId])
|
||||
{
|
||||
pair.m_algorithms[m_dispatcherId] = m_dispatcher->FindAlgorithm(
|
||||
pair.m_algorithms[m_dispatcherId] = m_dispatcher->findAlgorithm(
|
||||
*pair.m_pProxy0,
|
||||
*pair.m_pProxy1);
|
||||
}
|
||||
@@ -295,10 +295,10 @@ public:
|
||||
{
|
||||
if (m_dispatchInfo.m_dispatchFunc == btDispatcherInfo::DISPATCH_DISCRETE)
|
||||
{
|
||||
pair.m_algorithms[m_dispatcherId]->ProcessCollision(pair.m_pProxy0,pair.m_pProxy1,m_dispatchInfo);
|
||||
pair.m_algorithms[m_dispatcherId]->processCollision(pair.m_pProxy0,pair.m_pProxy1,m_dispatchInfo);
|
||||
} else
|
||||
{
|
||||
float toi = pair.m_algorithms[m_dispatcherId]->CalculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,m_dispatchInfo);
|
||||
float toi = pair.m_algorithms[m_dispatcherId]->calculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,m_dispatchInfo);
|
||||
if (m_dispatchInfo.m_timeOfImpact > toi)
|
||||
m_dispatchInfo.m_timeOfImpact = toi;
|
||||
|
||||
@@ -307,7 +307,7 @@ public:
|
||||
} else
|
||||
{
|
||||
//non-persistent algorithm dispatcher
|
||||
btCollisionAlgorithm* algo = m_dispatcher->FindAlgorithm(
|
||||
btCollisionAlgorithm* algo = m_dispatcher->findAlgorithm(
|
||||
*pair.m_pProxy0,
|
||||
*pair.m_pProxy1);
|
||||
|
||||
@@ -315,10 +315,10 @@ public:
|
||||
{
|
||||
if (m_dispatchInfo.m_dispatchFunc == btDispatcherInfo::DISPATCH_DISCRETE)
|
||||
{
|
||||
algo->ProcessCollision(pair.m_pProxy0,pair.m_pProxy1,m_dispatchInfo);
|
||||
algo->processCollision(pair.m_pProxy0,pair.m_pProxy1,m_dispatchInfo);
|
||||
} else
|
||||
{
|
||||
float toi = algo->CalculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,m_dispatchInfo);
|
||||
float toi = algo->calculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,m_dispatchInfo);
|
||||
if (m_dispatchInfo.m_timeOfImpact > toi)
|
||||
m_dispatchInfo.m_timeOfImpact = toi;
|
||||
}
|
||||
@@ -330,15 +330,15 @@ public:
|
||||
};
|
||||
|
||||
|
||||
void btCollisionDispatcher::DispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)
|
||||
void btCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
//m_blockedForChanges = true;
|
||||
|
||||
int dispatcherId = GetUniqueId();
|
||||
int dispatcherId = getUniqueId();
|
||||
|
||||
CollisionPairCallback collisionCallback(dispatchInfo,this,dispatcherId);
|
||||
btCollisionPairCallback collisionCallback(dispatchInfo,this,dispatcherId);
|
||||
|
||||
pairCache->ProcessAllOverlappingPairs(&collisionCallback);
|
||||
pairCache->processAllOverlappingPairs(&collisionCallback);
|
||||
|
||||
//m_blockedForChanges = false;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class btCollisionDispatcher : public btDispatcher
|
||||
|
||||
btCollisionAlgorithmCreateFunc* m_doubleDispatch[MAX_BROADPHASE_COLLISION_TYPES][MAX_BROADPHASE_COLLISION_TYPES];
|
||||
|
||||
btCollisionAlgorithmCreateFunc* InternalFindCreateFunc(int proxyType0,int proxyType1);
|
||||
btCollisionAlgorithmCreateFunc* internalFindCreateFunc(int proxyType0,int proxyType1);
|
||||
|
||||
//default CreationFunctions, filling the m_doubleDispatch table
|
||||
btCollisionAlgorithmCreateFunc* m_convexConvexCreateFunc;
|
||||
@@ -58,10 +58,10 @@ class btCollisionDispatcher : public btDispatcher
|
||||
|
||||
public:
|
||||
|
||||
///RegisterCollisionCreateFunc allows registration of custom/alternative collision create functions
|
||||
void RegisterCollisionCreateFunc(int proxyType0,int proxyType1, btCollisionAlgorithmCreateFunc* createFunc);
|
||||
///registerCollisionCreateFunc allows registration of custom/alternative collision create functions
|
||||
void registerCollisionCreateFunc(int proxyType0,int proxyType1, btCollisionAlgorithmCreateFunc* createFunc);
|
||||
|
||||
int GetNumManifolds() const
|
||||
int getNumManifolds() const
|
||||
{
|
||||
return m_manifoldsPtr.size();
|
||||
}
|
||||
@@ -71,12 +71,12 @@ public:
|
||||
return &m_manifoldsPtr[0];
|
||||
}
|
||||
|
||||
btPersistentManifold* GetManifoldByIndexInternal(int index)
|
||||
btPersistentManifold* getManifoldByIndexInternal(int index)
|
||||
{
|
||||
return m_manifoldsPtr[index];
|
||||
}
|
||||
|
||||
const btPersistentManifold* GetManifoldByIndexInternal(int index) const
|
||||
const btPersistentManifold* getManifoldByIndexInternal(int index) const
|
||||
{
|
||||
return m_manifoldsPtr[index];
|
||||
}
|
||||
@@ -86,31 +86,31 @@ public:
|
||||
btCollisionDispatcher ();
|
||||
virtual ~btCollisionDispatcher();
|
||||
|
||||
virtual btPersistentManifold* GetNewManifold(void* b0,void* b1);
|
||||
virtual btPersistentManifold* getNewManifold(void* b0,void* b1);
|
||||
|
||||
virtual void ReleaseManifold(btPersistentManifold* manifold);
|
||||
virtual void releaseManifold(btPersistentManifold* manifold);
|
||||
|
||||
|
||||
///allows the user to get contact point callbacks
|
||||
virtual btManifoldResult* GetNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold);
|
||||
virtual btManifoldResult* getNewManifoldResult(btCollisionObject* obj0,btCollisionObject* obj1,btPersistentManifold* manifold);
|
||||
|
||||
///allows the user to get contact point callbacks
|
||||
virtual void ReleaseManifoldResult(btManifoldResult*);
|
||||
virtual void releaseManifoldResult(btManifoldResult*);
|
||||
|
||||
virtual void ClearManifold(btPersistentManifold* manifold);
|
||||
virtual void clearManifold(btPersistentManifold* manifold);
|
||||
|
||||
|
||||
btCollisionAlgorithm* FindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1);
|
||||
btCollisionAlgorithm* findAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1);
|
||||
|
||||
btCollisionAlgorithm* InternalFindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1);
|
||||
btCollisionAlgorithm* internalFindAlgorithm(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1);
|
||||
|
||||
virtual bool NeedsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1);
|
||||
virtual bool needsCollision(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1);
|
||||
|
||||
virtual bool NeedsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1);
|
||||
virtual bool needsResponse(const btCollisionObject& colObj0,const btCollisionObject& colObj1);
|
||||
|
||||
virtual int GetUniqueId() { return RIGIDBODY_DISPATCHER;}
|
||||
virtual int getUniqueId() { return RIGIDBODY_DISPATCHER;}
|
||||
|
||||
virtual void DispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo);
|
||||
virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,btDispatcherInfo& dispatchInfo);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ btCollisionWorld::~btCollisionWorld()
|
||||
//
|
||||
// only clear the cached algorithms
|
||||
//
|
||||
GetBroadphase()->CleanProxyFromPairs(bp);
|
||||
GetBroadphase()->DestroyProxy(bp);
|
||||
getBroadphase()->cleanProxyFromPairs(bp);
|
||||
getBroadphase()->destroyProxy(bp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ btCollisionWorld::~btCollisionWorld()
|
||||
|
||||
|
||||
|
||||
void btCollisionWorld::AddCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup,short int collisionFilterMask)
|
||||
void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup,short int collisionFilterMask)
|
||||
{
|
||||
m_collisionObjects.push_back(collisionObject);
|
||||
|
||||
@@ -70,10 +70,10 @@ void btCollisionWorld::AddCollisionObject(btCollisionObject* collisionObject,sho
|
||||
|
||||
btVector3 minAabb;
|
||||
btVector3 maxAabb;
|
||||
collisionObject->m_collisionShape->GetAabb(trans,minAabb,maxAabb);
|
||||
collisionObject->m_collisionShape->getAabb(trans,minAabb,maxAabb);
|
||||
|
||||
int type = collisionObject->m_collisionShape->GetShapeType();
|
||||
collisionObject->m_broadphaseHandle = GetBroadphase()->CreateProxy(
|
||||
int type = collisionObject->m_collisionShape->getShapeType();
|
||||
collisionObject->m_broadphaseHandle = getBroadphase()->createProxy(
|
||||
minAabb,
|
||||
maxAabb,
|
||||
type,
|
||||
@@ -87,7 +87,7 @@ void btCollisionWorld::AddCollisionObject(btCollisionObject* collisionObject,sho
|
||||
|
||||
}
|
||||
|
||||
void btCollisionWorld::PerformDiscreteCollisionDetection()
|
||||
void btCollisionWorld::performDiscreteCollisionDetection()
|
||||
{
|
||||
btDispatcherInfo dispatchInfo;
|
||||
dispatchInfo.m_timeStep = 0.f;
|
||||
@@ -99,20 +99,20 @@ void btCollisionWorld::PerformDiscreteCollisionDetection()
|
||||
for (size_t i=0;i<m_collisionObjects.size();i++)
|
||||
{
|
||||
m_collisionObjects[i]->m_cachedInvertedWorldTransform = m_collisionObjects[i]->m_worldTransform.inverse();
|
||||
m_collisionObjects[i]->m_collisionShape->GetAabb(m_collisionObjects[i]->m_worldTransform,aabbMin,aabbMax);
|
||||
m_pairCache->SetAabb(m_collisionObjects[i]->m_broadphaseHandle,aabbMin,aabbMax);
|
||||
m_collisionObjects[i]->m_collisionShape->getAabb(m_collisionObjects[i]->m_worldTransform,aabbMin,aabbMax);
|
||||
m_pairCache->setAabb(m_collisionObjects[i]->m_broadphaseHandle,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
m_pairCache->RefreshOverlappingPairs();
|
||||
m_pairCache->refreshOverlappingPairs();
|
||||
|
||||
btDispatcher* dispatcher = GetDispatcher();
|
||||
btDispatcher* dispatcher = getDispatcher();
|
||||
if (dispatcher)
|
||||
dispatcher->DispatchAllCollisionPairs(m_pairCache,dispatchInfo);
|
||||
dispatcher->dispatchAllCollisionPairs(m_pairCache,dispatchInfo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void btCollisionWorld::RemoveCollisionObject(btCollisionObject* collisionObject)
|
||||
void btCollisionWorld::removeCollisionObject(btCollisionObject* collisionObject)
|
||||
{
|
||||
|
||||
|
||||
@@ -126,8 +126,8 @@ void btCollisionWorld::RemoveCollisionObject(btCollisionObject* collisionObject)
|
||||
//
|
||||
// only clear the cached algorithms
|
||||
//
|
||||
GetBroadphase()->CleanProxyFromPairs(bp);
|
||||
GetBroadphase()->DestroyProxy(bp);
|
||||
getBroadphase()->cleanProxyFromPairs(bp);
|
||||
getBroadphase()->destroyProxy(bp);
|
||||
collisionObject->m_broadphaseHandle = 0;
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ void btCollisionWorld::RemoveCollisionObject(btCollisionObject* collisionObject)
|
||||
}
|
||||
}
|
||||
|
||||
void btCollisionWorld::RayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans,
|
||||
void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans,
|
||||
btCollisionObject* collisionObject,
|
||||
const btCollisionShape* collisionShape,
|
||||
const btTransform& colObjWorldTransform,
|
||||
@@ -151,7 +151,7 @@ void btCollisionWorld::RayTestSingle(const btTransform& rayFromTrans,const btTra
|
||||
|
||||
btSphereShape pointShape(0.0f);
|
||||
|
||||
if (collisionShape->IsConvex())
|
||||
if (collisionShape->isConvex())
|
||||
{
|
||||
btConvexCast::CastResult castResult;
|
||||
castResult.m_fraction = 1.f;//??
|
||||
@@ -189,7 +189,7 @@ void btCollisionWorld::RayTestSingle(const btTransform& rayFromTrans,const btTra
|
||||
else
|
||||
{
|
||||
|
||||
if (collisionShape->IsConcave())
|
||||
if (collisionShape->isConcave())
|
||||
{
|
||||
|
||||
btTriangleMeshShape* triangleMesh = (btTriangleMeshShape*)collisionShape;
|
||||
@@ -217,7 +217,7 @@ void btCollisionWorld::RayTestSingle(const btTransform& rayFromTrans,const btTra
|
||||
}
|
||||
|
||||
|
||||
virtual float ReportHit(const btVector3& hitNormalLocal, float hitFraction, int partId, int triangleIndex )
|
||||
virtual float reportHit(const btVector3& hitNormalLocal, float hitFraction, int partId, int triangleIndex )
|
||||
{
|
||||
btCollisionWorld::LocalShapeInfo shapeInfo;
|
||||
shapeInfo.m_shapePart = partId;
|
||||
@@ -245,21 +245,21 @@ void btCollisionWorld::RayTestSingle(const btTransform& rayFromTrans,const btTra
|
||||
btVector3 rayAabbMaxLocal = rayFromLocal;
|
||||
rayAabbMaxLocal.setMax(rayToLocal);
|
||||
|
||||
triangleMesh->ProcessAllTriangles(&rcb,rayAabbMinLocal,rayAabbMaxLocal);
|
||||
triangleMesh->processAllTriangles(&rcb,rayAabbMinLocal,rayAabbMaxLocal);
|
||||
|
||||
} else
|
||||
{
|
||||
//todo: use AABB tree or other BVH acceleration structure!
|
||||
if (collisionShape->IsCompound())
|
||||
if (collisionShape->isCompound())
|
||||
{
|
||||
const btCompoundShape* compoundShape = static_cast<const btCompoundShape*>(collisionShape);
|
||||
int i=0;
|
||||
for (i=0;i<compoundShape->GetNumChildShapes();i++)
|
||||
for (i=0;i<compoundShape->getNumChildShapes();i++)
|
||||
{
|
||||
btTransform childTrans = compoundShape->GetChildTransform(i);
|
||||
const btCollisionShape* childCollisionShape = compoundShape->GetChildShape(i);
|
||||
btTransform childTrans = compoundShape->getChildTransform(i);
|
||||
const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
|
||||
btTransform childWorldTrans = colObjWorldTransform * childTrans;
|
||||
RayTestSingle(rayFromTrans,rayToTrans,
|
||||
rayTestSingle(rayFromTrans,rayToTrans,
|
||||
collisionObject,
|
||||
childCollisionShape,
|
||||
childWorldTrans,
|
||||
@@ -273,7 +273,7 @@ void btCollisionWorld::RayTestSingle(const btTransform& rayFromTrans,const btTra
|
||||
}
|
||||
}
|
||||
|
||||
void btCollisionWorld::RayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback)
|
||||
void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback)
|
||||
{
|
||||
|
||||
|
||||
@@ -304,13 +304,13 @@ void btCollisionWorld::RayTest(const btVector3& rayFromWorld, const btVector3& r
|
||||
|
||||
//RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
|
||||
btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
|
||||
collisionObject->m_collisionShape->GetAabb(collisionObject->m_worldTransform,collisionObjectAabbMin,collisionObjectAabbMax);
|
||||
collisionObject->m_collisionShape->getAabb(collisionObject->m_worldTransform,collisionObjectAabbMin,collisionObjectAabbMax);
|
||||
|
||||
//check aabb overlap
|
||||
|
||||
if (TestAabbAgainstAabb2(rayAabbMin,rayAabbMax,collisionObjectAabbMin,collisionObjectAabbMax))
|
||||
{
|
||||
RayTestSingle(rayFromTrans,rayToTrans,
|
||||
rayTestSingle(rayFromTrans,rayToTrans,
|
||||
collisionObject,
|
||||
collisionObject->m_collisionShape,
|
||||
collisionObject->m_worldTransform,
|
||||
|
||||
@@ -44,7 +44,8 @@ subject to the following restrictions:
|
||||
* The Dependencies can be seen in this documentation under Directories
|
||||
*
|
||||
* @subsection step4 Step 4: Integrating in your application, Full Rigid Body Simulation
|
||||
* Check out CcdPhysicsDemo how to create a CcdPhysicsEnvironment , btCollisionShape and btRigidBody, Stepping the simulation and synchronizing your derived version of the PHY_IMotionState class.
|
||||
* Check out CcdPhysicsDemo how to create a btDynamicsWorld, btRigidBody and btCollisionShape, Stepping the simulation and synchronizing your graphics object transform.
|
||||
* PLEASE NOTE THE CcdPhysicsEnvironment and CcdPhysicsController is obsolete and will be removed. It has been replaced by classes derived frmo btDynamicsWorld and btRididBody
|
||||
* @subsection step5 Step 5 : Integrate the Collision Detection Library (without Dynamics and other Extras)
|
||||
* Bullet Collision Detection can also be used without the Dynamics/Extras.
|
||||
* Check out btCollisionWorld and btCollisionObject, and the CollisionInterfaceDemo. Also in Extras/test_BulletOde.cpp there is a sample Collision Detection integration with Open Dynamics Engine, ODE, http://www.ode.org
|
||||
@@ -101,18 +102,18 @@ public:
|
||||
virtual ~btCollisionWorld();
|
||||
|
||||
|
||||
btBroadphaseInterface* GetBroadphase()
|
||||
btBroadphaseInterface* getBroadphase()
|
||||
{
|
||||
return m_pairCache;
|
||||
}
|
||||
|
||||
btOverlappingPairCache* GetPairCache()
|
||||
btOverlappingPairCache* getPairCache()
|
||||
{
|
||||
return m_pairCache;
|
||||
}
|
||||
|
||||
|
||||
btDispatcher* GetDispatcher()
|
||||
btDispatcher* getDispatcher()
|
||||
{
|
||||
return m_dispatcher1;
|
||||
}
|
||||
@@ -200,40 +201,40 @@ public:
|
||||
|
||||
|
||||
|
||||
int GetNumCollisionObjects() const
|
||||
int getNumCollisionObjects() const
|
||||
{
|
||||
return m_collisionObjects.size();
|
||||
}
|
||||
|
||||
/// RayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback
|
||||
/// rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback
|
||||
/// This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback.
|
||||
void RayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback);
|
||||
void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback);
|
||||
|
||||
/// RayTestSingle performs a raycast call and calls the resultCallback. It is used internally by RayTest.
|
||||
/// rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest.
|
||||
/// In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape.
|
||||
/// This allows more customization.
|
||||
void RayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans,
|
||||
void rayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans,
|
||||
btCollisionObject* collisionObject,
|
||||
const btCollisionShape* collisionShape,
|
||||
const btTransform& colObjWorldTransform,
|
||||
RayResultCallback& resultCallback);
|
||||
|
||||
void AddCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=1,short int collisionFilterMask=1);
|
||||
void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=1,short int collisionFilterMask=1);
|
||||
|
||||
btCollisionObjectArray& GetCollisionObjectArray()
|
||||
btCollisionObjectArray& getCollisionObjectArray()
|
||||
{
|
||||
return m_collisionObjects;
|
||||
}
|
||||
|
||||
const btCollisionObjectArray& GetCollisionObjectArray() const
|
||||
const btCollisionObjectArray& getCollisionObjectArray() const
|
||||
{
|
||||
return m_collisionObjects;
|
||||
}
|
||||
|
||||
|
||||
void RemoveCollisionObject(btCollisionObject* collisionObject);
|
||||
void removeCollisionObject(btCollisionObject* collisionObject);
|
||||
|
||||
virtual void PerformDiscreteCollisionDetection();
|
||||
virtual void performDiscreteCollisionDetection();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ m_compoundProxy(*proxy0),
|
||||
m_otherProxy(*proxy1)
|
||||
{
|
||||
btCollisionObject* colObj = static_cast<btCollisionObject*>(m_compoundProxy.m_clientObject);
|
||||
assert (colObj->m_collisionShape->IsCompound());
|
||||
assert (colObj->m_collisionShape->isCompound());
|
||||
|
||||
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->m_collisionShape);
|
||||
int numChildren = compoundShape->GetNumChildShapes();
|
||||
int numChildren = compoundShape->getNumChildShapes();
|
||||
m_childProxies.resize( numChildren );
|
||||
int i;
|
||||
for (i=0;i<numChildren;i++)
|
||||
@@ -38,11 +38,11 @@ m_otherProxy(*proxy1)
|
||||
m_childCollisionAlgorithms.resize(numChildren);
|
||||
for (i=0;i<numChildren;i++)
|
||||
{
|
||||
btCollisionShape* childShape = compoundShape->GetChildShape(i);
|
||||
btCollisionShape* childShape = compoundShape->getChildShape(i);
|
||||
btCollisionObject* colObj = static_cast<btCollisionObject*>(m_childProxies[i].m_clientObject);
|
||||
btCollisionShape* orgShape = colObj->m_collisionShape;
|
||||
colObj->m_collisionShape = childShape;
|
||||
m_childCollisionAlgorithms[i] = m_dispatcher->FindAlgorithm(m_childProxies[i],m_otherProxy);
|
||||
m_childCollisionAlgorithms[i] = m_dispatcher->findAlgorithm(m_childProxies[i],m_otherProxy);
|
||||
colObj->m_collisionShape =orgShape;
|
||||
}
|
||||
}
|
||||
@@ -58,10 +58,10 @@ btCompoundCollisionAlgorithm::~btCompoundCollisionAlgorithm()
|
||||
}
|
||||
}
|
||||
|
||||
void btCompoundCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* ,btBroadphaseProxy* ,const btDispatcherInfo& dispatchInfo)
|
||||
void btCompoundCollisionAlgorithm::processCollision (btBroadphaseProxy* ,btBroadphaseProxy* ,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
btCollisionObject* colObj = static_cast<btCollisionObject*>(m_compoundProxy.m_clientObject);
|
||||
assert (colObj->m_collisionShape->IsCompound());
|
||||
assert (colObj->m_collisionShape->isCompound());
|
||||
|
||||
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->m_collisionShape);
|
||||
|
||||
@@ -78,29 +78,29 @@ void btCompoundCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* ,btBroad
|
||||
for (i=0;i<numChildren;i++)
|
||||
{
|
||||
//temporarily exchange parent btCollisionShape with childShape, and recurse
|
||||
btCollisionShape* childShape = compoundShape->GetChildShape(i);
|
||||
btCollisionShape* childShape = compoundShape->getChildShape(i);
|
||||
btCollisionObject* colObj = static_cast<btCollisionObject*>(m_childProxies[i].m_clientObject);
|
||||
|
||||
//backup
|
||||
btTransform orgTrans = colObj->m_worldTransform;
|
||||
btCollisionShape* orgShape = colObj->m_collisionShape;
|
||||
|
||||
btTransform childTrans = compoundShape->GetChildTransform(i);
|
||||
btTransform childTrans = compoundShape->getChildTransform(i);
|
||||
btTransform newChildWorldTrans = orgTrans*childTrans ;
|
||||
colObj->m_worldTransform = newChildWorldTrans;
|
||||
|
||||
colObj->m_collisionShape = childShape;
|
||||
m_childCollisionAlgorithms[i]->ProcessCollision(&m_childProxies[i],&m_otherProxy,dispatchInfo);
|
||||
m_childCollisionAlgorithms[i]->processCollision(&m_childProxies[i],&m_otherProxy,dispatchInfo);
|
||||
//revert back
|
||||
colObj->m_collisionShape =orgShape;
|
||||
colObj->m_worldTransform = orgTrans;
|
||||
}
|
||||
}
|
||||
|
||||
float btCompoundCollisionAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
float btCompoundCollisionAlgorithm::calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
btCollisionObject* colObj = static_cast<btCollisionObject*>(m_compoundProxy.m_clientObject);
|
||||
assert (colObj->m_collisionShape->IsCompound());
|
||||
assert (colObj->m_collisionShape->isCompound());
|
||||
|
||||
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->m_collisionShape);
|
||||
|
||||
@@ -118,19 +118,19 @@ float btCompoundCollisionAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy* pro
|
||||
for (i=0;i<numChildren;i++)
|
||||
{
|
||||
//temporarily exchange parent btCollisionShape with childShape, and recurse
|
||||
btCollisionShape* childShape = compoundShape->GetChildShape(i);
|
||||
btCollisionShape* childShape = compoundShape->getChildShape(i);
|
||||
btCollisionObject* colObj = static_cast<btCollisionObject*>(m_childProxies[i].m_clientObject);
|
||||
|
||||
//backup
|
||||
btTransform orgTrans = colObj->m_worldTransform;
|
||||
btCollisionShape* orgShape = colObj->m_collisionShape;
|
||||
|
||||
btTransform childTrans = compoundShape->GetChildTransform(i);
|
||||
btTransform childTrans = compoundShape->getChildTransform(i);
|
||||
btTransform newChildWorldTrans = orgTrans*childTrans ;
|
||||
colObj->m_worldTransform = newChildWorldTrans;
|
||||
|
||||
colObj->m_collisionShape = childShape;
|
||||
float frac = m_childCollisionAlgorithms[i]->CalculateTimeOfImpact(&m_childProxies[i],&m_otherProxy,dispatchInfo);
|
||||
float frac = m_childCollisionAlgorithms[i]->calculateTimeOfImpact(&m_childProxies[i],&m_otherProxy,dispatchInfo);
|
||||
if (frac<hitFraction)
|
||||
{
|
||||
hitFraction = frac;
|
||||
|
||||
@@ -47,9 +47,9 @@ public:
|
||||
|
||||
virtual ~btCompoundCollisionAlgorithm();
|
||||
|
||||
virtual void ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
virtual void processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
float CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
float calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
struct CreateFunc :public btCollisionAlgorithmCreateFunc
|
||||
{
|
||||
|
||||
@@ -48,27 +48,27 @@ btConvexTriangleCallback::btConvexTriangleCallback(btDispatcher* dispatcher,btB
|
||||
//
|
||||
// create the manifold from the dispatcher 'manifold pool'
|
||||
//
|
||||
m_manifoldPtr = m_dispatcher->GetNewManifold(proxy0->m_clientObject,proxy1->m_clientObject);
|
||||
m_manifoldPtr = m_dispatcher->getNewManifold(proxy0->m_clientObject,proxy1->m_clientObject);
|
||||
|
||||
ClearCache();
|
||||
clearCache();
|
||||
}
|
||||
|
||||
btConvexTriangleCallback::~btConvexTriangleCallback()
|
||||
{
|
||||
ClearCache();
|
||||
m_dispatcher->ReleaseManifold( m_manifoldPtr );
|
||||
clearCache();
|
||||
m_dispatcher->releaseManifold( m_manifoldPtr );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void btConvexTriangleCallback::ClearCache()
|
||||
void btConvexTriangleCallback::clearCache()
|
||||
{
|
||||
m_dispatcher->ClearManifold(m_manifoldPtr);
|
||||
m_dispatcher->clearManifold(m_manifoldPtr);
|
||||
};
|
||||
|
||||
|
||||
|
||||
void btConvexTriangleCallback::ProcessTriangle(btVector3* triangle,int partId, int triangleIndex)
|
||||
void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, int triangleIndex)
|
||||
{
|
||||
|
||||
//just for debugging purposes
|
||||
@@ -85,29 +85,29 @@ void btConvexTriangleCallback::ProcessTriangle(btVector3* triangle,int partId, i
|
||||
|
||||
|
||||
///debug drawing of the overlapping triangles
|
||||
if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && m_dispatchInfoPtr->m_debugDraw->GetDebugMode() > 0)
|
||||
if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && m_dispatchInfoPtr->m_debugDraw->getDebugMode() > 0)
|
||||
{
|
||||
btVector3 color(255,255,0);
|
||||
btTransform& tr = ob->m_worldTransform;
|
||||
m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[0]),tr(triangle[1]),color);
|
||||
m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[1]),tr(triangle[2]),color);
|
||||
m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[2]),tr(triangle[0]),color);
|
||||
m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(triangle[1]),color);
|
||||
m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(triangle[2]),color);
|
||||
m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(triangle[0]),color);
|
||||
|
||||
//btVector3 center = triangle[0] + triangle[1]+triangle[2];
|
||||
//center *= 0.333333f;
|
||||
//m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[0]),tr(center),color);
|
||||
//m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[1]),tr(center),color);
|
||||
//m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[2]),tr(center),color);
|
||||
//m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(center),color);
|
||||
//m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(center),color);
|
||||
//m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(center),color);
|
||||
|
||||
}
|
||||
|
||||
|
||||
btCollisionObject* colObj = static_cast<btCollisionObject*>(m_convexProxy->m_clientObject);
|
||||
|
||||
if (colObj->m_collisionShape->IsConvex())
|
||||
if (colObj->m_collisionShape->isConvex())
|
||||
{
|
||||
btTriangleShape tm(triangle[0],triangle[1],triangle[2]);
|
||||
tm.SetMargin(m_collisionMarginTriangle);
|
||||
tm.setMargin(m_collisionMarginTriangle);
|
||||
|
||||
|
||||
btCollisionShape* tmpShape = ob->m_collisionShape;
|
||||
@@ -115,8 +115,8 @@ void btConvexTriangleCallback::ProcessTriangle(btVector3* triangle,int partId, i
|
||||
|
||||
///this should use the btDispatcher, so the actual registered algorithm is used
|
||||
btConvexConvexAlgorithm cvxcvxalgo(m_manifoldPtr,ci,m_convexProxy,&m_triangleProxy);
|
||||
cvxcvxalgo.SetShapeIdentifiers(-1,-1,partId,triangleIndex);
|
||||
cvxcvxalgo.ProcessCollision(m_convexProxy,&m_triangleProxy,*m_dispatchInfoPtr);
|
||||
cvxcvxalgo.setShapeIdentifiers(-1,-1,partId,triangleIndex);
|
||||
cvxcvxalgo.processCollision(m_convexProxy,&m_triangleProxy,*m_dispatchInfoPtr);
|
||||
ob->m_collisionShape = tmpShape;
|
||||
|
||||
}
|
||||
@@ -127,7 +127,7 @@ void btConvexTriangleCallback::ProcessTriangle(btVector3* triangle,int partId, i
|
||||
|
||||
|
||||
|
||||
void btConvexTriangleCallback::SetTimeStepAndCounters(float collisionMarginTriangle,const btDispatcherInfo& dispatchInfo)
|
||||
void btConvexTriangleCallback::setTimeStepAndCounters(float collisionMarginTriangle,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
m_dispatchInfoPtr = &dispatchInfo;
|
||||
m_collisionMarginTriangle = collisionMarginTriangle;
|
||||
@@ -142,7 +142,7 @@ void btConvexTriangleCallback::SetTimeStepAndCounters(float collisionMarginTrian
|
||||
btCollisionShape* convexShape = static_cast<btCollisionShape*>(convexBody->m_collisionShape);
|
||||
//CollisionShape* triangleShape = static_cast<btCollisionShape*>(triBody->m_collisionShape);
|
||||
|
||||
convexShape->GetAabb(convexInTriangleSpace,m_aabbMin,m_aabbMax);
|
||||
convexShape->getAabb(convexInTriangleSpace,m_aabbMin,m_aabbMax);
|
||||
|
||||
float extraMargin = collisionMarginTriangle;//CONVEX_DISTANCE_MARGIN;//+0.1f;
|
||||
|
||||
@@ -153,22 +153,22 @@ void btConvexTriangleCallback::SetTimeStepAndCounters(float collisionMarginTrian
|
||||
|
||||
}
|
||||
|
||||
void btConvexConcaveCollisionAlgorithm::ClearCache()
|
||||
void btConvexConcaveCollisionAlgorithm::clearCache()
|
||||
{
|
||||
m_btConvexTriangleCallback.ClearCache();
|
||||
m_btConvexTriangleCallback.clearCache();
|
||||
|
||||
}
|
||||
|
||||
void btConvexConcaveCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* ,btBroadphaseProxy* ,const btDispatcherInfo& dispatchInfo)
|
||||
void btConvexConcaveCollisionAlgorithm::processCollision (btBroadphaseProxy* ,btBroadphaseProxy* ,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
|
||||
btCollisionObject* convexBody = static_cast<btCollisionObject* >(m_convex.m_clientObject);
|
||||
btCollisionObject* triBody = static_cast<btCollisionObject* >(m_concave.m_clientObject);
|
||||
|
||||
if (triBody->m_collisionShape->IsConcave())
|
||||
if (triBody->m_collisionShape->isConcave())
|
||||
{
|
||||
|
||||
if (!m_dispatcher->NeedsCollision(m_convex,m_concave))
|
||||
if (!m_dispatcher->needsCollision(m_convex,m_concave))
|
||||
return;
|
||||
|
||||
|
||||
@@ -176,19 +176,19 @@ void btConvexConcaveCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* ,bt
|
||||
btCollisionObject* triOb = static_cast<btCollisionObject*>(m_concave.m_clientObject);
|
||||
ConcaveShape* concaveShape = static_cast<ConcaveShape*>( triOb->m_collisionShape);
|
||||
|
||||
if (convexBody->m_collisionShape->IsConvex())
|
||||
if (convexBody->m_collisionShape->isConvex())
|
||||
{
|
||||
float collisionMarginTriangle = concaveShape->GetMargin();
|
||||
float collisionMarginTriangle = concaveShape->getMargin();
|
||||
|
||||
m_btConvexTriangleCallback.SetTimeStepAndCounters(collisionMarginTriangle,dispatchInfo);
|
||||
m_btConvexTriangleCallback.setTimeStepAndCounters(collisionMarginTriangle,dispatchInfo);
|
||||
|
||||
//Disable persistency. previously, some older algorithm calculated all contacts in one go, so you can clear it here.
|
||||
//m_dispatcher->ClearManifold(m_btConvexTriangleCallback.m_manifoldPtr);
|
||||
//m_dispatcher->clearManifold(m_btConvexTriangleCallback.m_manifoldPtr);
|
||||
|
||||
|
||||
m_btConvexTriangleCallback.m_manifoldPtr->SetBodies(m_convex.m_clientObject,m_concave.m_clientObject);
|
||||
m_btConvexTriangleCallback.m_manifoldPtr->setBodies(m_convex.m_clientObject,m_concave.m_clientObject);
|
||||
|
||||
concaveShape->ProcessAllTriangles( &m_btConvexTriangleCallback,m_btConvexTriangleCallback.GetAabbMin(),m_btConvexTriangleCallback.GetAabbMax());
|
||||
concaveShape->processAllTriangles( &m_btConvexTriangleCallback,m_btConvexTriangleCallback.getAabbMin(),m_btConvexTriangleCallback.getAabbMax());
|
||||
|
||||
|
||||
}
|
||||
@@ -198,7 +198,7 @@ void btConvexConcaveCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* ,bt
|
||||
}
|
||||
|
||||
|
||||
float btConvexConcaveCollisionAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy* ,btBroadphaseProxy* ,const btDispatcherInfo& dispatchInfo)
|
||||
float btConvexConcaveCollisionAlgorithm::calculateTimeOfImpact(btBroadphaseProxy* ,btBroadphaseProxy* ,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
|
||||
//quick approximation using raycast, todo: hook up to the continuous collision detection (one of the btConvexCast)
|
||||
@@ -239,7 +239,7 @@ float btConvexConcaveCollisionAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy
|
||||
}
|
||||
|
||||
|
||||
virtual void ProcessTriangle(btVector3* triangle, int partId, int triangleIndex)
|
||||
virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex)
|
||||
{
|
||||
//do a swept sphere for now
|
||||
btTransform ident;
|
||||
@@ -269,7 +269,7 @@ float btConvexConcaveCollisionAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy
|
||||
|
||||
|
||||
|
||||
if (triBody->m_collisionShape->IsConcave())
|
||||
if (triBody->m_collisionShape->isConcave())
|
||||
{
|
||||
btVector3 rayAabbMin = convexFromLocal.getOrigin();
|
||||
rayAabbMin.setMin(convexToLocal.getOrigin());
|
||||
@@ -290,7 +290,7 @@ float btConvexConcaveCollisionAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy
|
||||
|
||||
if (triangleMesh)
|
||||
{
|
||||
triangleMesh->ProcessAllTriangles(&raycastCallback,rayAabbMin,rayAabbMax);
|
||||
triangleMesh->processAllTriangles(&raycastCallback,rayAabbMin,rayAabbMax);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class btDispatcher;
|
||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
|
||||
#include "btCollisionCreateFunc.h"
|
||||
|
||||
///For each triangle in the concave mesh that overlaps with the AABB of a convex (m_convexProxy), ProcessTriangle is called.
|
||||
///For each triangle in the concave mesh that overlaps with the AABB of a convex (m_convexProxy), processTriangle is called.
|
||||
class btConvexTriangleCallback : public btTriangleCallback
|
||||
{
|
||||
btBroadphaseProxy* m_convexProxy;
|
||||
@@ -45,19 +45,19 @@ int m_triangleCount;
|
||||
|
||||
btConvexTriangleCallback(btDispatcher* dispatcher,btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
|
||||
|
||||
void SetTimeStepAndCounters(float collisionMarginTriangle,const btDispatcherInfo& dispatchInfo);
|
||||
void setTimeStepAndCounters(float collisionMarginTriangle,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
virtual ~btConvexTriangleCallback();
|
||||
|
||||
virtual void ProcessTriangle(btVector3* triangle, int partId, int triangleIndex);
|
||||
virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex);
|
||||
|
||||
void ClearCache();
|
||||
void clearCache();
|
||||
|
||||
inline const btVector3& GetAabbMin() const
|
||||
inline const btVector3& getAabbMin() const
|
||||
{
|
||||
return m_aabbMin;
|
||||
}
|
||||
inline const btVector3& GetAabbMax() const
|
||||
inline const btVector3& getAabbMax() const
|
||||
{
|
||||
return m_aabbMax;
|
||||
}
|
||||
@@ -84,11 +84,11 @@ public:
|
||||
|
||||
virtual ~btConvexConcaveCollisionAlgorithm();
|
||||
|
||||
virtual void ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
virtual void processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
float CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
float calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
void ClearCache();
|
||||
void clearCache();
|
||||
|
||||
struct CreateFunc :public btCollisionAlgorithmCreateFunc
|
||||
{
|
||||
|
||||
@@ -91,12 +91,12 @@ m_ownManifold (false),
|
||||
m_manifoldPtr(mf),
|
||||
m_lowLevelOfDetail(false)
|
||||
{
|
||||
CheckPenetrationDepthSolver();
|
||||
checkPenetrationDepthSolver();
|
||||
|
||||
{
|
||||
if (!m_manifoldPtr && m_dispatcher->NeedsCollision(m_box0,m_box1))
|
||||
if (!m_manifoldPtr && m_dispatcher->needsCollision(m_box0,m_box1))
|
||||
{
|
||||
m_manifoldPtr = m_dispatcher->GetNewManifold(proxy0->m_clientObject,proxy1->m_clientObject);
|
||||
m_manifoldPtr = m_dispatcher->getNewManifold(proxy0->m_clientObject,proxy1->m_clientObject);
|
||||
m_ownManifold = true;
|
||||
}
|
||||
}
|
||||
@@ -110,11 +110,11 @@ btConvexConvexAlgorithm::~btConvexConvexAlgorithm()
|
||||
if (m_ownManifold)
|
||||
{
|
||||
if (m_manifoldPtr)
|
||||
m_dispatcher->ReleaseManifold(m_manifoldPtr);
|
||||
m_dispatcher->releaseManifold(m_manifoldPtr);
|
||||
}
|
||||
}
|
||||
|
||||
void btConvexConvexAlgorithm ::SetLowLevelOfDetail(bool useLowLevel)
|
||||
void btConvexConvexAlgorithm ::setLowLevelOfDetail(bool useLowLevel)
|
||||
{
|
||||
m_lowLevelOfDetail = useLowLevel;
|
||||
}
|
||||
@@ -133,11 +133,11 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual void AddContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
{
|
||||
btVector3 flippedNormal = -normalOnBInWorld;
|
||||
|
||||
m_org->AddContactPoint(flippedNormal,pointInWorld,depth);
|
||||
m_org->addContactPoint(flippedNormal,pointInWorld,depth);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -150,7 +150,7 @@ static btMinkowskiPenetrationDepthSolver gPenetrationDepthSolver;
|
||||
Solid3EpaPenetrationDepth gSolidEpaPenetrationSolver;
|
||||
#endif //USE_EPA
|
||||
|
||||
void btConvexConvexAlgorithm::CheckPenetrationDepthSolver()
|
||||
void btConvexConvexAlgorithm::checkPenetrationDepthSolver()
|
||||
{
|
||||
if (m_useEpa != gUseEpa)
|
||||
{
|
||||
@@ -158,12 +158,12 @@ void btConvexConvexAlgorithm::CheckPenetrationDepthSolver()
|
||||
if (m_useEpa)
|
||||
{
|
||||
|
||||
// m_gjkPairDetector.SetPenetrationDepthSolver(&gEpaPenetrationDepthSolver);
|
||||
// m_gjkPairDetector.setPenetrationDepthSolver(&gEpaPenetrationDepthSolver);
|
||||
|
||||
|
||||
} else
|
||||
{
|
||||
m_gjkPairDetector.SetPenetrationDepthSolver(&gPenetrationDepthSolver);
|
||||
m_gjkPairDetector.setPenetrationDepthSolver(&gPenetrationDepthSolver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
//normalOnBInWorld.normalize();
|
||||
btVector3 pointInWorld(positionsWorld[i].GetX(),positionsWorld[i].GetY(),positionsWorld[i].GetZ());
|
||||
float depth = -depths[i];
|
||||
m_manifoldResult.AddContactPoint(normalOnBInWorld,pointInWorld,depth);
|
||||
m_manifoldResult.addContactPoint(normalOnBInWorld,pointInWorld,depth);
|
||||
|
||||
}
|
||||
return 0;
|
||||
@@ -237,17 +237,17 @@ public:
|
||||
//
|
||||
// Convex-Convex collision algorithm
|
||||
//
|
||||
void btConvexConvexAlgorithm ::ProcessCollision (btBroadphaseProxy* ,btBroadphaseProxy* ,const btDispatcherInfo& dispatchInfo)
|
||||
void btConvexConvexAlgorithm ::processCollision (btBroadphaseProxy* ,btBroadphaseProxy* ,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
|
||||
if (!m_manifoldPtr)
|
||||
return;
|
||||
|
||||
CheckPenetrationDepthSolver();
|
||||
checkPenetrationDepthSolver();
|
||||
|
||||
// printf("btConvexConvexAlgorithm::ProcessCollision\n");
|
||||
// printf("btConvexConvexAlgorithm::processCollision\n");
|
||||
|
||||
bool needsCollision = m_dispatcher->NeedsCollision(m_box0,m_box1);
|
||||
bool needsCollision = m_dispatcher->needsCollision(m_box0,m_box1);
|
||||
if (!needsCollision)
|
||||
return;
|
||||
|
||||
@@ -259,8 +259,8 @@ void btConvexConvexAlgorithm ::ProcessCollision (btBroadphaseProxy* ,btBroadphas
|
||||
|
||||
if (dispatchInfo.m_enableSatConvex)
|
||||
{
|
||||
if ((col0->m_collisionShape->IsPolyhedral()) &&
|
||||
(col1->m_collisionShape->IsPolyhedral()))
|
||||
if ((col0->m_collisionShape->isPolyhedral()) &&
|
||||
(col1->m_collisionShape->isPolyhedral()))
|
||||
{
|
||||
|
||||
|
||||
@@ -283,8 +283,8 @@ void btConvexConvexAlgorithm ::ProcessCollision (btBroadphaseProxy* ,btBroadphas
|
||||
Transform trB = GetTransformFrombtTransform(col1->m_worldTransform);
|
||||
|
||||
//either use persistent manifold or clear it every time
|
||||
m_dispatcher->ClearManifold(m_manifoldPtr);
|
||||
btManifoldResult* resultOut = m_dispatcher->GetNewManifoldResult(col0,col1,m_manifoldPtr);
|
||||
m_dispatcher->clearManifold(m_manifoldPtr);
|
||||
btManifoldResult* resultOut = m_dispatcher->getNewManifoldResult(col0,col1,m_manifoldPtr);
|
||||
|
||||
btManifoldResultCollector hullContactCollector(*resultOut);
|
||||
|
||||
@@ -301,7 +301,7 @@ void btConvexConvexAlgorithm ::ProcessCollision (btBroadphaseProxy* ,btBroadphas
|
||||
#endif //USE_HULL
|
||||
|
||||
|
||||
btManifoldResult* resultOut = m_dispatcher->GetNewManifoldResult(col0,col1,m_manifoldPtr);
|
||||
btManifoldResult* resultOut = m_dispatcher->getNewManifoldResult(col0,col1,m_manifoldPtr);
|
||||
|
||||
btConvexShape* min0 = static_cast<btConvexShape*>(col0->m_collisionShape);
|
||||
btConvexShape* min1 = static_cast<btConvexShape*>(col1->m_collisionShape);
|
||||
@@ -310,9 +310,9 @@ void btConvexConvexAlgorithm ::ProcessCollision (btBroadphaseProxy* ,btBroadphas
|
||||
|
||||
|
||||
//TODO: if (dispatchInfo.m_useContinuous)
|
||||
m_gjkPairDetector.SetMinkowskiA(min0);
|
||||
m_gjkPairDetector.SetMinkowskiB(min1);
|
||||
input.m_maximumDistanceSquared = min0->GetMargin() + min1->GetMargin() + m_manifoldPtr->GetContactBreakingTreshold();
|
||||
m_gjkPairDetector.setMinkowskiA(min0);
|
||||
m_gjkPairDetector.setMinkowskiB(min1);
|
||||
input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactBreakingTreshold();
|
||||
input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared;
|
||||
|
||||
// input.m_maximumDistanceSquared = 1e30f;
|
||||
@@ -320,15 +320,15 @@ void btConvexConvexAlgorithm ::ProcessCollision (btBroadphaseProxy* ,btBroadphas
|
||||
input.m_transformA = col0->m_worldTransform;
|
||||
input.m_transformB = col1->m_worldTransform;
|
||||
|
||||
m_gjkPairDetector.GetClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
|
||||
m_gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
|
||||
|
||||
m_dispatcher->ReleaseManifoldResult(resultOut);
|
||||
m_dispatcher->releaseManifoldResult(resultOut);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool disableCcd = false;
|
||||
float btConvexConvexAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
float btConvexConvexAlgorithm::calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
///Rather then checking ALL pairs, only calculate TOI when motion exceeds treshold
|
||||
|
||||
@@ -350,7 +350,7 @@ float btConvexConvexAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy* proxy0,b
|
||||
if (disableCcd)
|
||||
return 1.f;
|
||||
|
||||
CheckPenetrationDepthSolver();
|
||||
checkPenetrationDepthSolver();
|
||||
|
||||
//An adhoc way of testing the Continuous Collision Detection algorithms
|
||||
//One object is approximated as a sphere, to simplify things
|
||||
@@ -358,7 +358,7 @@ float btConvexConvexAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy* proxy0,b
|
||||
//For proper CCD, better accuracy and handling of 'allowed' penetration should be added
|
||||
//also the mainloop of the physics should have a kind of toi queue (something like Brian Mirtich's application of Timewarp for Rigidbodies)
|
||||
|
||||
bool needsCollision = m_dispatcher->NeedsCollision(m_box0,m_box1);
|
||||
bool needsCollision = m_dispatcher->needsCollision(m_box0,m_box1);
|
||||
|
||||
if (!needsCollision)
|
||||
return 1.f;
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
btPersistentManifold* m_manifoldPtr;
|
||||
bool m_lowLevelOfDetail;
|
||||
|
||||
void CheckPenetrationDepthSolver();
|
||||
void checkPenetrationDepthSolver();
|
||||
|
||||
|
||||
|
||||
@@ -50,13 +50,13 @@ public:
|
||||
|
||||
virtual ~btConvexConvexAlgorithm();
|
||||
|
||||
virtual void ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
virtual void processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
virtual float CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
virtual float calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
void SetLowLevelOfDetail(bool useLowLevel);
|
||||
void setLowLevelOfDetail(bool useLowLevel);
|
||||
|
||||
virtual void SetShapeIdentifiers(int partId0,int index0, int partId1,int index1)
|
||||
virtual void setShapeIdentifiers(int partId0,int index0, int partId1,int index1)
|
||||
{
|
||||
m_gjkPairDetector.m_partId0=partId0;
|
||||
m_gjkPairDetector.m_partId1=partId1;
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
m_gjkPairDetector.m_index1=index1;
|
||||
}
|
||||
|
||||
const btPersistentManifold* GetManifold()
|
||||
const btPersistentManifold* getManifold()
|
||||
{
|
||||
return m_manifoldPtr;
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ btEmptyAlgorithm::btEmptyAlgorithm(const btCollisionAlgorithmConstructionInfo& c
|
||||
{
|
||||
}
|
||||
|
||||
void btEmptyAlgorithm::ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
void btEmptyAlgorithm::processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
float btEmptyAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
float btEmptyAlgorithm::calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
return 1.f;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ public:
|
||||
|
||||
btEmptyAlgorithm(const btCollisionAlgorithmConstructionInfo& ci);
|
||||
|
||||
virtual void ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
virtual void processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
virtual float CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
virtual float calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
struct CreateFunc :public btCollisionAlgorithmCreateFunc
|
||||
{
|
||||
|
||||
@@ -51,9 +51,9 @@ btManifoldResult::btManifoldResult(btCollisionObject* body0,btCollisionObject* b
|
||||
}
|
||||
|
||||
|
||||
void btManifoldResult::AddContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
{
|
||||
if (depth > m_manifoldPtr->GetContactBreakingTreshold())
|
||||
if (depth > m_manifoldPtr->getContactBreakingTreshold())
|
||||
return;
|
||||
|
||||
|
||||
@@ -69,14 +69,14 @@ void btManifoldResult::AddContactPoint(const btVector3& normalOnBInWorld,const b
|
||||
|
||||
|
||||
|
||||
int insertIndex = m_manifoldPtr->GetCacheEntry(newPt);
|
||||
int insertIndex = m_manifoldPtr->getCacheEntry(newPt);
|
||||
if (insertIndex >= 0)
|
||||
{
|
||||
|
||||
// This is not needed, just use the old info!
|
||||
// const btManifoldPoint& oldPoint = m_manifoldPtr->GetContactPoint(insertIndex);
|
||||
// const btManifoldPoint& oldPoint = m_manifoldPtr->getContactPoint(insertIndex);
|
||||
// newPt.CopyPersistentInformation(oldPoint);
|
||||
// m_manifoldPtr->ReplaceContactPoint(newPt,insertIndex);
|
||||
// m_manifoldPtr->replaceContactPoint(newPt,insertIndex);
|
||||
|
||||
|
||||
} else
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
|
||||
virtual ~btManifoldResult() {};
|
||||
|
||||
virtual void SetShapeIdentifiers(int partId0,int index0, int partId1,int index1)
|
||||
virtual void setShapeIdentifiers(int partId0,int index0, int partId1,int index1)
|
||||
{
|
||||
m_partId0=partId0;
|
||||
m_partId1=partId1;
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
m_index1=index1;
|
||||
}
|
||||
|
||||
virtual void AddContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth);
|
||||
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,23 +18,23 @@ btSimulationIslandManager::~btSimulationIslandManager()
|
||||
}
|
||||
|
||||
|
||||
void btSimulationIslandManager::InitUnionFind(int n)
|
||||
void btSimulationIslandManager::initUnionFind(int n)
|
||||
{
|
||||
m_unionFind.reset(n);
|
||||
}
|
||||
|
||||
|
||||
void btSimulationIslandManager::FindUnions(btDispatcher* dispatcher)
|
||||
void btSimulationIslandManager::findUnions(btDispatcher* dispatcher)
|
||||
{
|
||||
|
||||
{
|
||||
for (int i=0;i<dispatcher->GetNumManifolds();i++)
|
||||
for (int i=0;i<dispatcher->getNumManifolds();i++)
|
||||
{
|
||||
const btPersistentManifold* manifold = dispatcher->GetManifoldByIndexInternal(i);
|
||||
const btPersistentManifold* manifold = dispatcher->getManifoldByIndexInternal(i);
|
||||
//static objects (invmass 0.f) don't merge !
|
||||
|
||||
const btCollisionObject* colObj0 = static_cast<const btCollisionObject*>(manifold->GetBody0());
|
||||
const btCollisionObject* colObj1 = static_cast<const btCollisionObject*>(manifold->GetBody1());
|
||||
const btCollisionObject* colObj0 = static_cast<const btCollisionObject*>(manifold->getBody0());
|
||||
const btCollisionObject* colObj1 = static_cast<const btCollisionObject*>(manifold->getBody1());
|
||||
|
||||
if (((colObj0) && ((colObj0)->mergesSimulationIslands())) &&
|
||||
((colObj1) && ((colObj1)->mergesSimulationIslands())))
|
||||
@@ -48,18 +48,18 @@ void btSimulationIslandManager::FindUnions(btDispatcher* dispatcher)
|
||||
}
|
||||
|
||||
|
||||
void btSimulationIslandManager::UpdateActivationState(btCollisionWorld* colWorld,btDispatcher* dispatcher)
|
||||
void btSimulationIslandManager::updateActivationState(btCollisionWorld* colWorld,btDispatcher* dispatcher)
|
||||
{
|
||||
|
||||
InitUnionFind(colWorld->GetCollisionObjectArray().size());
|
||||
initUnionFind(colWorld->getCollisionObjectArray().size());
|
||||
|
||||
// put the index into m_controllers into m_tag
|
||||
{
|
||||
std::vector<btCollisionObject*>::iterator i;
|
||||
|
||||
int index = 0;
|
||||
for (i=colWorld->GetCollisionObjectArray().begin();
|
||||
!(i==colWorld->GetCollisionObjectArray().end()); i++)
|
||||
for (i=colWorld->getCollisionObjectArray().begin();
|
||||
!(i==colWorld->getCollisionObjectArray().end()); i++)
|
||||
{
|
||||
|
||||
btCollisionObject* collisionObject= (*i);
|
||||
@@ -71,7 +71,7 @@ void btSimulationIslandManager::UpdateActivationState(btCollisionWorld* colWorld
|
||||
}
|
||||
// do the union find
|
||||
|
||||
FindUnions(dispatcher);
|
||||
findUnions(dispatcher);
|
||||
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ void btSimulationIslandManager::UpdateActivationState(btCollisionWorld* colWorld
|
||||
|
||||
|
||||
|
||||
void btSimulationIslandManager::StoreIslandActivationState(btCollisionWorld* colWorld)
|
||||
void btSimulationIslandManager::storeIslandActivationState(btCollisionWorld* colWorld)
|
||||
{
|
||||
// put the islandId ('find' value) into m_tag
|
||||
{
|
||||
@@ -89,8 +89,8 @@ void btSimulationIslandManager::StoreIslandActivationState(btCollisionWorld* col
|
||||
std::vector<btCollisionObject*>::iterator i;
|
||||
|
||||
int index = 0;
|
||||
for (i=colWorld->GetCollisionObjectArray().begin();
|
||||
!(i==colWorld->GetCollisionObjectArray().end()); i++)
|
||||
for (i=colWorld->getCollisionObjectArray().begin();
|
||||
!(i==colWorld->getCollisionObjectArray().end()); i++)
|
||||
{
|
||||
btCollisionObject* collisionObject= (*i);
|
||||
|
||||
@@ -109,8 +109,8 @@ void btSimulationIslandManager::StoreIslandActivationState(btCollisionWorld* col
|
||||
inline int getIslandId(const btPersistentManifold* lhs)
|
||||
{
|
||||
int islandId;
|
||||
const btCollisionObject* rcolObj0 = static_cast<const btCollisionObject*>(lhs->GetBody0());
|
||||
const btCollisionObject* rcolObj1 = static_cast<const btCollisionObject*>(lhs->GetBody1());
|
||||
const btCollisionObject* rcolObj0 = static_cast<const btCollisionObject*>(lhs->getBody0());
|
||||
const btCollisionObject* rcolObj1 = static_cast<const btCollisionObject*>(lhs->getBody1());
|
||||
islandId= rcolObj0->m_islandTag1>=0?rcolObj0->m_islandTag1:rcolObj1->m_islandTag1;
|
||||
return islandId;
|
||||
|
||||
@@ -128,21 +128,21 @@ bool btPersistentManifoldSortPredicate(const btPersistentManifold* lhs, const bt
|
||||
//
|
||||
// todo: this is random access, it can be walked 'cache friendly'!
|
||||
//
|
||||
void btSimulationIslandManager::BuildAndProcessIslands(btDispatcher* dispatcher,btCollisionObjectArray& collisionObjects, IslandCallback* callback)
|
||||
void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,btCollisionObjectArray& collisionObjects, IslandCallback* callback)
|
||||
{
|
||||
//we are going to sort the unionfind array, and store the element id in the size
|
||||
//afterwards, we clean unionfind, to make sure no-one uses it anymore
|
||||
|
||||
GetUnionFind().sortIslands();
|
||||
int numElem = GetUnionFind().getNumElements();
|
||||
getUnionFind().sortIslands();
|
||||
int numElem = getUnionFind().getNumElements();
|
||||
|
||||
int endIslandIndex=1;
|
||||
|
||||
//update the sleeping state for bodies, if all are sleeping
|
||||
for (int startIslandIndex=0;startIslandIndex<numElem;startIslandIndex = endIslandIndex)
|
||||
{
|
||||
int islandId = GetUnionFind().getElement(startIslandIndex).m_id;
|
||||
for (endIslandIndex = startIslandIndex+1;(endIslandIndex<numElem) && (GetUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
|
||||
int islandId = getUnionFind().getElement(startIslandIndex).m_id;
|
||||
for (endIslandIndex = startIslandIndex+1;(endIslandIndex<numElem) && (getUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void btSimulationIslandManager::BuildAndProcessIslands(btDispatcher* dispatcher,
|
||||
int idx;
|
||||
for (idx=startIslandIndex;idx<endIslandIndex;idx++)
|
||||
{
|
||||
int i = GetUnionFind().getElement(idx).m_sz;
|
||||
int i = getUnionFind().getElement(idx).m_sz;
|
||||
|
||||
btCollisionObject* colObj0 = collisionObjects[i];
|
||||
if ((colObj0->m_islandTag1 != islandId) && (colObj0->m_islandTag1 != -1))
|
||||
@@ -180,7 +180,7 @@ void btSimulationIslandManager::BuildAndProcessIslands(btDispatcher* dispatcher,
|
||||
int idx;
|
||||
for (idx=startIslandIndex;idx<endIslandIndex;idx++)
|
||||
{
|
||||
int i = GetUnionFind().getElement(idx).m_sz;
|
||||
int i = getUnionFind().getElement(idx).m_sz;
|
||||
btCollisionObject* colObj0 = collisionObjects[i];
|
||||
if ((colObj0->m_islandTag1 != islandId) && (colObj0->m_islandTag1 != -1))
|
||||
{
|
||||
@@ -200,7 +200,7 @@ void btSimulationIslandManager::BuildAndProcessIslands(btDispatcher* dispatcher,
|
||||
int idx;
|
||||
for (idx=startIslandIndex;idx<endIslandIndex;idx++)
|
||||
{
|
||||
int i = GetUnionFind().getElement(idx).m_sz;
|
||||
int i = getUnionFind().getElement(idx).m_sz;
|
||||
|
||||
btCollisionObject* colObj0 = collisionObjects[i];
|
||||
if ((colObj0->m_islandTag1 != islandId) && (colObj0->m_islandTag1 != -1))
|
||||
@@ -223,22 +223,22 @@ void btSimulationIslandManager::BuildAndProcessIslands(btDispatcher* dispatcher,
|
||||
|
||||
std::vector<btPersistentManifold*> islandmanifold;
|
||||
int i;
|
||||
int maxNumManifolds = dispatcher->GetNumManifolds();
|
||||
int maxNumManifolds = dispatcher->getNumManifolds();
|
||||
islandmanifold.reserve(maxNumManifolds);
|
||||
|
||||
for (i=0;i<maxNumManifolds ;i++)
|
||||
{
|
||||
btPersistentManifold* manifold = dispatcher->GetManifoldByIndexInternal(i);
|
||||
btPersistentManifold* manifold = dispatcher->getManifoldByIndexInternal(i);
|
||||
|
||||
btCollisionObject* colObj0 = static_cast<btCollisionObject*>(manifold->GetBody0());
|
||||
btCollisionObject* colObj1 = static_cast<btCollisionObject*>(manifold->GetBody1());
|
||||
btCollisionObject* colObj0 = static_cast<btCollisionObject*>(manifold->getBody0());
|
||||
btCollisionObject* colObj1 = static_cast<btCollisionObject*>(manifold->getBody1());
|
||||
|
||||
//todo: check sleeping conditions!
|
||||
if (((colObj0) && colObj0->GetActivationState() != ISLAND_SLEEPING) ||
|
||||
((colObj1) && colObj1->GetActivationState() != ISLAND_SLEEPING))
|
||||
{
|
||||
//filtering for response
|
||||
if (dispatcher->NeedsResponse(*colObj0,*colObj1))
|
||||
if (dispatcher->needsResponse(*colObj0,*colObj1))
|
||||
islandmanifold.push_back(manifold);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,16 +32,16 @@ public:
|
||||
virtual ~btSimulationIslandManager();
|
||||
|
||||
|
||||
void InitUnionFind(int n);
|
||||
void initUnionFind(int n);
|
||||
|
||||
|
||||
btUnionFind& GetUnionFind() { return m_unionFind;}
|
||||
btUnionFind& getUnionFind() { return m_unionFind;}
|
||||
|
||||
virtual void UpdateActivationState(btCollisionWorld* colWorld,btDispatcher* dispatcher);
|
||||
virtual void StoreIslandActivationState(btCollisionWorld* world);
|
||||
virtual void updateActivationState(btCollisionWorld* colWorld,btDispatcher* dispatcher);
|
||||
virtual void storeIslandActivationState(btCollisionWorld* world);
|
||||
|
||||
|
||||
void FindUnions(btDispatcher* dispatcher);
|
||||
void findUnions(btDispatcher* dispatcher);
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
virtual void ProcessIsland(class btPersistentManifold** manifolds,int numManifolds) = 0;
|
||||
};
|
||||
|
||||
void BuildAndProcessIslands(btDispatcher* dispatcher,btCollisionObjectArray& collisionObjects, IslandCallback* callback);
|
||||
void buildAndProcessIslands(btDispatcher* dispatcher,btCollisionObjectArray& collisionObjects, IslandCallback* callback);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ btSphereSphereCollisionAlgorithm::btSphereSphereCollisionAlgorithm(btPersistentM
|
||||
m_ownManifold(false),
|
||||
m_manifoldPtr(mf)
|
||||
{
|
||||
if (!m_manifoldPtr && m_dispatcher->NeedsCollision(*proxy0,*proxy1))
|
||||
if (!m_manifoldPtr && m_dispatcher->needsCollision(*proxy0,*proxy1))
|
||||
{
|
||||
m_manifoldPtr = m_dispatcher->GetNewManifold(proxy0->m_clientObject,proxy1->m_clientObject);
|
||||
m_manifoldPtr = m_dispatcher->getNewManifold(proxy0->m_clientObject,proxy1->m_clientObject);
|
||||
m_ownManifold = true;
|
||||
}
|
||||
}
|
||||
@@ -35,11 +35,11 @@ btSphereSphereCollisionAlgorithm::~btSphereSphereCollisionAlgorithm()
|
||||
if (m_ownManifold)
|
||||
{
|
||||
if (m_manifoldPtr)
|
||||
m_dispatcher->ReleaseManifold(m_manifoldPtr);
|
||||
m_dispatcher->releaseManifold(m_manifoldPtr);
|
||||
}
|
||||
}
|
||||
|
||||
void btSphereSphereCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
void btSphereSphereCollisionAlgorithm::processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
if (!m_manifoldPtr)
|
||||
return;
|
||||
@@ -51,8 +51,8 @@ void btSphereSphereCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* prox
|
||||
|
||||
btVector3 diff = col0->m_worldTransform.getOrigin()- col1->m_worldTransform.getOrigin();
|
||||
float len = diff.length();
|
||||
btScalar radius0 = sphere0->GetRadius();
|
||||
btScalar radius1 = sphere1->GetRadius();
|
||||
btScalar radius0 = sphere0->getRadius();
|
||||
btScalar radius1 = sphere1->getRadius();
|
||||
|
||||
///iff distance positive, don't generate a new contact
|
||||
if ( len > (radius0+radius1))
|
||||
@@ -68,13 +68,13 @@ void btSphereSphereCollisionAlgorithm::ProcessCollision (btBroadphaseProxy* prox
|
||||
btVector3 pos1 = col1->m_worldTransform.getOrigin() + radius1* normalOnSurfaceB;
|
||||
|
||||
/// report a contact. internally this will be kept persistent, and contact reduction is done
|
||||
btManifoldResult* resultOut = m_dispatcher->GetNewManifoldResult(col0,col1,m_manifoldPtr);
|
||||
resultOut->AddContactPoint(normalOnSurfaceB,pos1,dist);
|
||||
m_dispatcher->ReleaseManifoldResult(resultOut);
|
||||
btManifoldResult* resultOut = m_dispatcher->getNewManifoldResult(col0,col1,m_manifoldPtr);
|
||||
resultOut->addContactPoint(normalOnSurfaceB,pos1,dist);
|
||||
m_dispatcher->releaseManifoldResult(resultOut);
|
||||
|
||||
}
|
||||
|
||||
float btSphereSphereCollisionAlgorithm::CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
float btSphereSphereCollisionAlgorithm::calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo)
|
||||
{
|
||||
//not yet
|
||||
return 1.f;
|
||||
|
||||
@@ -33,9 +33,9 @@ public:
|
||||
btSphereSphereCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
|
||||
: btCollisionAlgorithm(ci) {}
|
||||
|
||||
virtual void ProcessCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
virtual void processCollision (btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
virtual float CalculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
virtual float calculateTimeOfImpact(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,const btDispatcherInfo& dispatchInfo);
|
||||
|
||||
btSphereSphereCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ btUnionFind::btUnionFind()
|
||||
|
||||
}
|
||||
|
||||
void btUnionFind::Allocate(int N)
|
||||
void btUnionFind::allocate(int N)
|
||||
{
|
||||
m_elements.resize(N);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ void btUnionFind::Free()
|
||||
|
||||
void btUnionFind::reset(int N)
|
||||
{
|
||||
Allocate(N);
|
||||
allocate(N);
|
||||
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ class btUnionFind
|
||||
return m_elements[index];
|
||||
}
|
||||
|
||||
void Allocate(int N);
|
||||
void allocate(int N);
|
||||
void Free();
|
||||
|
||||
|
||||
|
||||
@@ -15,23 +15,23 @@ subject to the following restrictions:
|
||||
|
||||
#include "btBoxShape.h"
|
||||
|
||||
btVector3 btBoxShape::GetHalfExtents() const
|
||||
btVector3 btBoxShape::getHalfExtents() const
|
||||
{
|
||||
return m_boxHalfExtents1 * m_localScaling;
|
||||
}
|
||||
//{
|
||||
|
||||
|
||||
void btBoxShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
void btBoxShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
btMatrix3x3 abs_b = t.getBasis().absolute();
|
||||
btPoint3 center = t.getOrigin();
|
||||
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),
|
||||
abs_b[1].dot(halfExtents),
|
||||
abs_b[2].dot(halfExtents));
|
||||
extent += btVector3(GetMargin(),GetMargin(),GetMargin());
|
||||
extent += btVector3(getMargin(),getMargin(),getMargin());
|
||||
|
||||
aabbMin = center - extent;
|
||||
aabbMax = center + extent;
|
||||
@@ -40,10 +40,10 @@ void btBoxShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabb
|
||||
}
|
||||
|
||||
|
||||
void btBoxShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btBoxShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//float margin = 0.f;
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
btScalar lx=2.f*(halfExtents.x());
|
||||
btScalar ly=2.f*(halfExtents.y());
|
||||
|
||||
@@ -31,18 +31,18 @@ class btBoxShape: public btPolyhedralConvexShape
|
||||
|
||||
public:
|
||||
|
||||
btVector3 GetHalfExtents() const;
|
||||
btVector3 getHalfExtents() const;
|
||||
//{ return m_boxHalfExtents1 * m_localScaling;}
|
||||
//const btVector3& GetHalfExtents() const{ return m_boxHalfExtents1;}
|
||||
//const btVector3& getHalfExtents() const{ return m_boxHalfExtents1;}
|
||||
|
||||
|
||||
|
||||
virtual int GetShapeType() const { return BOX_SHAPE_PROXYTYPE;}
|
||||
virtual int getShapeType() const { return BOX_SHAPE_PROXYTYPE;}
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec) const
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
|
||||
{
|
||||
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
btVector3 supVertex;
|
||||
supVertex = btPoint3(vec.x() < btScalar(0.0f) ? -halfExtents.x() : halfExtents.x(),
|
||||
@@ -52,10 +52,10 @@ public:
|
||||
return supVertex;
|
||||
}
|
||||
|
||||
virtual inline btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
virtual inline btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 margin(GetMargin(),GetMargin(),GetMargin());
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
halfExtents -= margin;
|
||||
|
||||
return btVector3(vec.x() < btScalar(0.0f) ? -halfExtents.x() : halfExtents.x(),
|
||||
@@ -63,10 +63,10 @@ public:
|
||||
vec.z() < btScalar(0.0f) ? -halfExtents.z() : halfExtents.z());
|
||||
}
|
||||
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 margin(GetMargin(),GetMargin(),GetMargin());
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
halfExtents -= margin;
|
||||
|
||||
|
||||
@@ -83,41 +83,41 @@ public:
|
||||
|
||||
btBoxShape( const btVector3& boxHalfExtents) : m_boxHalfExtents1(boxHalfExtents){};
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
{
|
||||
//this plane might not be aligned...
|
||||
btVector4 plane ;
|
||||
GetPlaneEquation(plane,i);
|
||||
getPlaneEquation(plane,i);
|
||||
planeNormal = btVector3(plane.getX(),plane.getY(),plane.getZ());
|
||||
planeSupport = LocalGetSupportingVertex(-planeNormal);
|
||||
planeSupport = localGetSupportingVertex(-planeNormal);
|
||||
}
|
||||
|
||||
|
||||
virtual int GetNumPlanes() const
|
||||
virtual int getNumPlanes() const
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
virtual int GetNumVertices() const
|
||||
virtual int getNumVertices() const
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
virtual int GetNumEdges() const
|
||||
virtual int getNumEdges() const
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
|
||||
virtual void GetVertex(int i,btVector3& vtx) const
|
||||
virtual void getVertex(int i,btVector3& vtx) const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
vtx = btVector3(
|
||||
halfExtents.x() * (1-(i&1)) - halfExtents.x() * (i&1),
|
||||
@@ -126,9 +126,9 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void GetPlaneEquation(btVector4& plane,int i) const
|
||||
virtual void getPlaneEquation(btVector4& plane,int i) const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
switch (i)
|
||||
{
|
||||
@@ -162,8 +162,8 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
//virtual void GetEdge(int i,Edge& edge) const
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
//virtual void getEdge(int i,Edge& edge) const
|
||||
{
|
||||
int edgeVert0 = 0;
|
||||
int edgeVert1 = 0;
|
||||
@@ -225,17 +225,17 @@ public:
|
||||
|
||||
}
|
||||
|
||||
GetVertex(edgeVert0,pa );
|
||||
GetVertex(edgeVert1,pb );
|
||||
getVertex(edgeVert0,pa );
|
||||
getVertex(edgeVert1,pb );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const
|
||||
{
|
||||
btVector3 halfExtents = GetHalfExtents();
|
||||
btVector3 halfExtents = getHalfExtents();
|
||||
|
||||
//btScalar minDist = 2*tolerance;
|
||||
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "Box";
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ btBvhTriangleMeshShape::btBvhTriangleMeshShape(btStridingMeshInterface* meshInte
|
||||
#ifndef DISABLE_BVH
|
||||
|
||||
m_bvh = new btOptimizedBvh();
|
||||
m_bvh->Build(meshInterface);
|
||||
m_bvh->build(meshInterface);
|
||||
|
||||
#endif //DISABLE_BVH
|
||||
|
||||
@@ -40,12 +40,12 @@ btBvhTriangleMeshShape::~btBvhTriangleMeshShape()
|
||||
}
|
||||
|
||||
//perform bvh tree traversal and report overlapping triangles to 'callback'
|
||||
void btBvhTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btBvhTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
#ifdef DISABLE_BVH
|
||||
//brute force traverse all triangles
|
||||
btTriangleMeshShape::ProcessAllTriangles(callback,aabbMin,aabbMax);
|
||||
btTriangleMeshShape::processAllTriangles(callback,aabbMin,aabbMax);
|
||||
#else
|
||||
|
||||
//first get all the nodes
|
||||
@@ -64,7 +64,7 @@ void btBvhTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,co
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ProcessNode(const btOptimizedBvhNode* node)
|
||||
virtual void processNode(const btOptimizedBvhNode* node)
|
||||
{
|
||||
const unsigned char *vertexbase;
|
||||
int numverts;
|
||||
@@ -108,7 +108,7 @@ void btBvhTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,co
|
||||
#endif //DEBUG_TRIANGLE_MESH
|
||||
}
|
||||
|
||||
m_callback->ProcessTriangle(m_triangle,node->m_subPart,node->m_triangleIndex);
|
||||
m_callback->processTriangle(m_triangle,node->m_subPart,node->m_triangleIndex);
|
||||
m_meshInterface->unLockReadOnlyVertexBase(node->m_subPart);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ void btBvhTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,co
|
||||
|
||||
MyNodeOverlapCallback myNodeCallback(callback,m_meshInterface);
|
||||
|
||||
m_bvh->ReportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax);
|
||||
m_bvh->reportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax);
|
||||
|
||||
|
||||
#endif//DISABLE_BVH
|
||||
@@ -132,7 +132,7 @@ void btBvhTriangleMeshShape::setLocalScaling(const btVector3& scaling)
|
||||
btTriangleMeshShape::setLocalScaling(scaling);
|
||||
delete m_bvh;
|
||||
m_bvh = new btOptimizedBvh();
|
||||
m_bvh->Build(m_meshInterface);
|
||||
m_bvh->build(m_meshInterface);
|
||||
//rebuild the bvh...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
|
||||
/*
|
||||
virtual int GetShapeType() const
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return TRIANGLE_MESH_SHAPE_PROXYTYPE;
|
||||
}
|
||||
@@ -42,11 +42,11 @@ public:
|
||||
|
||||
|
||||
|
||||
virtual void ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "BVHTRIANGLEMESH";}
|
||||
virtual char* getName()const {return "BVHTRIANGLEMESH";}
|
||||
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
|
||||
@@ -15,31 +15,31 @@ subject to the following restrictions:
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
|
||||
|
||||
void btCollisionShape::GetBoundingSphere(btVector3& center,btScalar& radius) const
|
||||
void btCollisionShape::getBoundingSphere(btVector3& center,btScalar& radius) const
|
||||
{
|
||||
btTransform tr;
|
||||
tr.setIdentity();
|
||||
btVector3 aabbMin,aabbMax;
|
||||
|
||||
GetAabb(tr,aabbMin,aabbMax);
|
||||
getAabb(tr,aabbMin,aabbMax);
|
||||
|
||||
radius = (aabbMax-aabbMin).length()*0.5f;
|
||||
center = (aabbMin+aabbMax)*0.5f;
|
||||
}
|
||||
|
||||
float btCollisionShape::GetAngularMotionDisc() const
|
||||
float btCollisionShape::getAngularMotionDisc() const
|
||||
{
|
||||
btVector3 center;
|
||||
float disc;
|
||||
GetBoundingSphere(center,disc);
|
||||
getBoundingSphere(center,disc);
|
||||
disc += (center).length();
|
||||
return disc;
|
||||
}
|
||||
|
||||
void btCollisionShape::CalculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax)
|
||||
void btCollisionShape::calculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax)
|
||||
{
|
||||
//start with static aabb
|
||||
GetAabb(curTrans,temporalAabbMin,temporalAabbMax);
|
||||
getAabb(curTrans,temporalAabbMin,temporalAabbMax);
|
||||
|
||||
float temporalAabbMaxx = temporalAabbMax.getX();
|
||||
float temporalAabbMaxy = temporalAabbMax.getY();
|
||||
@@ -65,7 +65,7 @@ void btCollisionShape::CalculateTemporalAabb(const btTransform& curTrans,const b
|
||||
temporalAabbMinz += linMotion.z();
|
||||
|
||||
//add conservative angular motion
|
||||
btScalar angularMotion = angvel.length() * GetAngularMotionDisc() * timeStep;
|
||||
btScalar angularMotion = angvel.length() * getAngularMotionDisc() * timeStep;
|
||||
btVector3 angularMotion3d(angularMotion,angularMotion,angularMotion);
|
||||
temporalAabbMin = btVector3(temporalAabbMinx,temporalAabbMiny,temporalAabbMinz);
|
||||
temporalAabbMax = btVector3(temporalAabbMaxx,temporalAabbMaxy,temporalAabbMaxz);
|
||||
|
||||
@@ -34,50 +34,50 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const =0;
|
||||
|
||||
virtual void GetBoundingSphere(btVector3& center,btScalar& radius) const;
|
||||
virtual void getBoundingSphere(btVector3& center,btScalar& radius) const;
|
||||
|
||||
virtual float GetAngularMotionDisc() const;
|
||||
virtual float getAngularMotionDisc() const;
|
||||
|
||||
virtual int GetShapeType() const=0;
|
||||
virtual int getShapeType() const=0;
|
||||
|
||||
///CalculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep)
|
||||
///calculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep)
|
||||
///result is conservative
|
||||
void CalculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax);
|
||||
void calculateTemporalAabb(const btTransform& curTrans,const btVector3& linvel,const btVector3& angvel,btScalar timeStep, btVector3& temporalAabbMin,btVector3& temporalAabbMax);
|
||||
|
||||
inline bool IsPolyhedral() const
|
||||
inline bool isPolyhedral() const
|
||||
{
|
||||
return btBroadphaseProxy::IsPolyhedral(GetShapeType());
|
||||
return btBroadphaseProxy::isPolyhedral(getShapeType());
|
||||
}
|
||||
|
||||
inline bool IsConvex() const
|
||||
inline bool isConvex() const
|
||||
{
|
||||
return btBroadphaseProxy::IsConvex(GetShapeType());
|
||||
return btBroadphaseProxy::isConvex(getShapeType());
|
||||
}
|
||||
inline bool IsConcave() const
|
||||
inline bool isConcave() const
|
||||
{
|
||||
return btBroadphaseProxy::IsConcave(GetShapeType());
|
||||
return btBroadphaseProxy::isConcave(getShapeType());
|
||||
}
|
||||
inline bool IsCompound() const
|
||||
inline bool isCompound() const
|
||||
{
|
||||
return btBroadphaseProxy::IsCompound(GetShapeType());
|
||||
return btBroadphaseProxy::isCompound(getShapeType());
|
||||
}
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling) =0;
|
||||
virtual const btVector3& getLocalScaling() const =0;
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia) = 0;
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) = 0;
|
||||
|
||||
//debugging support
|
||||
virtual char* GetName()const =0 ;
|
||||
const char* GetExtraDebugInfo() const { return m_tempDebug;}
|
||||
void SetExtraDebugInfo(const char* extraDebugInfo) { m_tempDebug = extraDebugInfo;}
|
||||
virtual char* getName()const =0 ;
|
||||
const char* getExtraDebugInfo() const { return m_tempDebug;}
|
||||
void setExtraDebugInfo(const char* extraDebugInfo) { m_tempDebug = extraDebugInfo;}
|
||||
const char * m_tempDebug;
|
||||
//endif debugging support
|
||||
|
||||
virtual void SetMargin(float margin) = 0;
|
||||
virtual float GetMargin() const = 0;
|
||||
virtual void setMargin(float margin) = 0;
|
||||
virtual float getMargin() const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -33,14 +33,14 @@ btCompoundShape::~btCompoundShape()
|
||||
{
|
||||
}
|
||||
|
||||
void btCompoundShape::AddChildShape(const btTransform& localTransform,btCollisionShape* shape)
|
||||
void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisionShape* shape)
|
||||
{
|
||||
m_childTransforms.push_back(localTransform);
|
||||
m_childShapes.push_back(shape);
|
||||
|
||||
//extend the local aabbMin/aabbMax
|
||||
btVector3 localAabbMin,localAabbMax;
|
||||
shape->GetAabb(localTransform,localAabbMin,localAabbMax);
|
||||
shape->getAabb(localTransform,localAabbMin,localAabbMax);
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
if (m_localAabbMin[i] > localAabbMin[i])
|
||||
@@ -57,8 +57,8 @@ void btCompoundShape::AddChildShape(const btTransform& localTransform,btCollisio
|
||||
|
||||
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void btCompoundShape::GetAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void btCompoundShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
btVector3 localHalfExtents = 0.5f*(m_localAabbMax-m_localAabbMin);
|
||||
btVector3 localCenter = 0.5f*(m_localAabbMax+m_localAabbMin);
|
||||
@@ -70,19 +70,19 @@ void btCompoundShape::GetAabb(const btTransform& trans,btVector3& aabbMin,btVect
|
||||
btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
|
||||
abs_b[1].dot(localHalfExtents),
|
||||
abs_b[2].dot(localHalfExtents));
|
||||
extent += btVector3(GetMargin(),GetMargin(),GetMargin());
|
||||
extent += btVector3(getMargin(),getMargin(),getMargin());
|
||||
|
||||
aabbMin = center - extent;
|
||||
aabbMax = center + extent;
|
||||
}
|
||||
|
||||
void btCompoundShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//approximation: take the inertia from the aabb for now
|
||||
btTransform ident;
|
||||
ident.setIdentity();
|
||||
btVector3 aabbMin,aabbMax;
|
||||
GetAabb(ident,aabbMin,aabbMax);
|
||||
getAabb(ident,aabbMin,aabbMax);
|
||||
|
||||
btVector3 halfExtents = (aabbMax-aabbMin)*0.5f;
|
||||
|
||||
|
||||
@@ -42,33 +42,33 @@ public:
|
||||
|
||||
virtual ~btCompoundShape();
|
||||
|
||||
void AddChildShape(const btTransform& localTransform,btCollisionShape* shape);
|
||||
void addChildShape(const btTransform& localTransform,btCollisionShape* shape);
|
||||
|
||||
int GetNumChildShapes() const
|
||||
int getNumChildShapes() const
|
||||
{
|
||||
return m_childShapes.size();
|
||||
}
|
||||
|
||||
btCollisionShape* GetChildShape(int index)
|
||||
btCollisionShape* getChildShape(int index)
|
||||
{
|
||||
return m_childShapes[index];
|
||||
}
|
||||
const btCollisionShape* GetChildShape(int index) const
|
||||
const btCollisionShape* getChildShape(int index) const
|
||||
{
|
||||
return m_childShapes[index];
|
||||
}
|
||||
|
||||
btTransform GetChildTransform(int index)
|
||||
btTransform getChildTransform(int index)
|
||||
{
|
||||
return m_childTransforms[index];
|
||||
}
|
||||
const btTransform GetChildTransform(int index) const
|
||||
const btTransform getChildTransform(int index) const
|
||||
{
|
||||
return m_childTransforms[index];
|
||||
}
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling)
|
||||
@@ -80,27 +80,27 @@ public:
|
||||
return m_localScaling;
|
||||
}
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual int GetShapeType() const { return COMPOUND_SHAPE_PROXYTYPE;}
|
||||
virtual int getShapeType() const { return COMPOUND_SHAPE_PROXYTYPE;}
|
||||
|
||||
virtual void SetMargin(float margin)
|
||||
virtual void setMargin(float margin)
|
||||
{
|
||||
m_collisionMargin = margin;
|
||||
}
|
||||
virtual float GetMargin() const
|
||||
virtual float getMargin() const
|
||||
{
|
||||
return m_collisionMargin;
|
||||
}
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "Compound";
|
||||
}
|
||||
|
||||
//this is optional, but should make collision queries faster, by culling non-overlapping nodes
|
||||
void CreateAabbTreeFromChildren();
|
||||
void createAabbTreeFromChildren();
|
||||
|
||||
const btOptimizedBvh* GetAabbTree() const
|
||||
const btOptimizedBvh* getAabbTree() const
|
||||
{
|
||||
return m_aabbTree;
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ public:
|
||||
|
||||
virtual ~ConcaveShape();
|
||||
|
||||
virtual void ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const = 0;
|
||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const = 0;
|
||||
|
||||
virtual float GetMargin() const {
|
||||
virtual float getMargin() const {
|
||||
return m_collisionMargin;
|
||||
}
|
||||
virtual void SetMargin(float collisionMargin)
|
||||
virtual void setMargin(float collisionMargin)
|
||||
{
|
||||
m_collisionMargin = collisionMargin;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ m_height(height)
|
||||
}
|
||||
|
||||
|
||||
btVector3 btConeShape::ConeLocalSupport(const btVector3& v) const
|
||||
btVector3 btConeShape::coneLocalSupport(const btVector3& v) const
|
||||
{
|
||||
|
||||
float halfHeight = m_height * 0.5f;
|
||||
@@ -66,25 +66,25 @@ btVector3 btConeShape::ConeLocalSupport(const btVector3& v) const
|
||||
|
||||
}
|
||||
|
||||
btVector3 btConeShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec) const
|
||||
btVector3 btConeShape::localGetSupportingVertexWithoutMargin(const btVector3& vec) const
|
||||
{
|
||||
return ConeLocalSupport(vec);
|
||||
return coneLocalSupport(vec);
|
||||
}
|
||||
|
||||
void btConeShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btConeShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
const btVector3& vec = vectors[i];
|
||||
supportVerticesOut[i] = ConeLocalSupport(vec);
|
||||
supportVerticesOut[i] = coneLocalSupport(vec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
btVector3 btConeShape::LocalGetSupportingVertex(const btVector3& vec) const
|
||||
btVector3 btConeShape::localGetSupportingVertex(const btVector3& vec) const
|
||||
{
|
||||
btVector3 supVertex = ConeLocalSupport(vec);
|
||||
if ( GetMargin()!=0.f )
|
||||
btVector3 supVertex = coneLocalSupport(vec);
|
||||
if ( getMargin()!=0.f )
|
||||
{
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -92,7 +92,7 @@ btVector3 btConeShape::LocalGetSupportingVertex(const btVector3& vec) const
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
}
|
||||
return supVertex;
|
||||
}
|
||||
|
||||
@@ -28,30 +28,30 @@ class btConeShape : public btConvexShape
|
||||
float m_radius;
|
||||
float m_height;
|
||||
|
||||
btVector3 ConeLocalSupport(const btVector3& v) const;
|
||||
btVector3 coneLocalSupport(const btVector3& v) const;
|
||||
|
||||
|
||||
public:
|
||||
btConeShape (btScalar radius,btScalar height);
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec) const;
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec) const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
float GetRadius() const { return m_radius;}
|
||||
float GetHeight() const { return m_height;}
|
||||
float getRadius() const { return m_radius;}
|
||||
float getHeight() const { return m_height;}
|
||||
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
btTransform identity;
|
||||
identity.setIdentity();
|
||||
btVector3 aabbMin,aabbMax;
|
||||
GetAabb(identity,aabbMin,aabbMax);
|
||||
getAabb(identity,aabbMin,aabbMax);
|
||||
|
||||
btVector3 halfExtents = (aabbMax-aabbMin)*0.5f;
|
||||
|
||||
float margin = GetMargin();
|
||||
float margin = getMargin();
|
||||
|
||||
btScalar lx=2.f*(halfExtents.x()+margin);
|
||||
btScalar ly=2.f*(halfExtents.y()+margin);
|
||||
@@ -70,9 +70,9 @@ public:
|
||||
|
||||
|
||||
|
||||
virtual int GetShapeType() const { return CONE_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType() const { return CONE_SHAPE_PROXYTYPE; }
|
||||
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "Cone";
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ btConvexHullShape ::btConvexHullShape (btPoint3* points,int numPoints,int stride
|
||||
}
|
||||
}
|
||||
|
||||
btVector3 btConvexHullShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
btVector3 btConvexHullShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
{
|
||||
btVector3 supVec(0.f,0.f,0.f);
|
||||
btScalar newDot,maxDot = -1e30f;
|
||||
@@ -61,7 +61,7 @@ btVector3 btConvexHullShape::LocalGetSupportingVertexWithoutMargin(const btVecto
|
||||
return supVec;
|
||||
}
|
||||
|
||||
void btConvexHullShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btConvexHullShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
btScalar newDot;
|
||||
//use 'w' component of supportVerticesOut?
|
||||
@@ -95,11 +95,11 @@ void btConvexHullShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const
|
||||
|
||||
|
||||
|
||||
btVector3 btConvexHullShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
btVector3 btConvexHullShape::localGetSupportingVertex(const btVector3& vec)const
|
||||
{
|
||||
btVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec);
|
||||
btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
|
||||
|
||||
if ( GetMargin()!=0.f )
|
||||
if ( getMargin()!=0.f )
|
||||
{
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -107,7 +107,7 @@ btVector3 btConvexHullShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
}
|
||||
return supVertex;
|
||||
}
|
||||
@@ -122,17 +122,17 @@ btVector3 btConvexHullShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
|
||||
//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
|
||||
//Please note that you can debug-draw btConvexHullShape with the Raytracer Demo
|
||||
int btConvexHullShape::GetNumVertices() const
|
||||
int btConvexHullShape::getNumVertices() const
|
||||
{
|
||||
return m_points.size();
|
||||
}
|
||||
|
||||
int btConvexHullShape::GetNumEdges() const
|
||||
int btConvexHullShape::getNumEdges() const
|
||||
{
|
||||
return m_points.size()*m_points.size();
|
||||
}
|
||||
|
||||
void btConvexHullShape::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
void btConvexHullShape::getEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
{
|
||||
|
||||
int index0 = i%m_points.size();
|
||||
@@ -141,23 +141,23 @@ void btConvexHullShape::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
pb = m_points[index1]*m_localScaling;
|
||||
}
|
||||
|
||||
void btConvexHullShape::GetVertex(int i,btPoint3& vtx) const
|
||||
void btConvexHullShape::getVertex(int i,btPoint3& vtx) const
|
||||
{
|
||||
vtx = m_points[i]*m_localScaling;
|
||||
}
|
||||
|
||||
int btConvexHullShape::GetNumPlanes() const
|
||||
int btConvexHullShape::getNumPlanes() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btConvexHullShape::GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
void btConvexHullShape::getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
//not yet
|
||||
bool btConvexHullShape::IsInside(const btPoint3& pt,btScalar tolerance) const
|
||||
bool btConvexHullShape::isInside(const btPoint3& pt,btScalar tolerance) const
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
|
||||
@@ -22,7 +22,7 @@ subject to the following restrictions:
|
||||
#include <vector>
|
||||
|
||||
///ConvexHullShape implements an implicit (getSupportingVertex) Convex Hull of a Point Cloud (vertices)
|
||||
///No connectivity is needed. LocalGetSupportingVertex iterates linearly though all vertices.
|
||||
///No connectivity is needed. localGetSupportingVertex iterates linearly though all vertices.
|
||||
///on modern hardware, due to cache coherency this isn't that bad. Complex algorithms tend to trash the cash.
|
||||
///(memory is much slower then the cpu)
|
||||
class btConvexHullShape : public btPolyhedralConvexShape
|
||||
@@ -32,28 +32,28 @@ class btConvexHullShape : public btPolyhedralConvexShape
|
||||
public:
|
||||
btConvexHullShape(btPoint3* points,int numPoints, int stride=sizeof(btPoint3));
|
||||
|
||||
void AddPoint(const btPoint3& point)
|
||||
void addPoint(const btPoint3& point)
|
||||
{
|
||||
m_points.push_back(point);
|
||||
}
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
|
||||
virtual int GetShapeType()const { return CONVEX_HULL_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType()const { return CONVEX_HULL_SHAPE_PROXYTYPE; }
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "Convex";}
|
||||
virtual char* getName()const {return "Convex";}
|
||||
|
||||
|
||||
virtual int GetNumVertices() const;
|
||||
virtual int GetNumEdges() const;
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
virtual void GetVertex(int i,btPoint3& vtx) const;
|
||||
virtual int GetNumPlanes() const;
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
virtual int getNumVertices() const;
|
||||
virtual int getNumEdges() const;
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
virtual void getVertex(int i,btPoint3& vtx) const;
|
||||
virtual int getNumPlanes() const;
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -29,30 +29,30 @@ void btConvexShape::setLocalScaling(const btVector3& scaling)
|
||||
|
||||
|
||||
|
||||
void btConvexShape::GetAabbSlow(const btTransform& trans,btVector3&minAabb,btVector3&maxAabb) const
|
||||
void btConvexShape::getAabbSlow(const btTransform& trans,btVector3&minAabb,btVector3&maxAabb) const
|
||||
{
|
||||
|
||||
btScalar margin = GetMargin();
|
||||
btScalar margin = getMargin();
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
btVector3 vec(0.f,0.f,0.f);
|
||||
vec[i] = 1.f;
|
||||
|
||||
btVector3 sv = LocalGetSupportingVertex(vec*trans.getBasis());
|
||||
btVector3 sv = localGetSupportingVertex(vec*trans.getBasis());
|
||||
|
||||
btVector3 tmp = trans(sv);
|
||||
maxAabb[i] = tmp[i]+margin;
|
||||
vec[i] = -1.f;
|
||||
tmp = trans(LocalGetSupportingVertex(vec*trans.getBasis()));
|
||||
tmp = trans(localGetSupportingVertex(vec*trans.getBasis()));
|
||||
minAabb[i] = tmp[i]-margin;
|
||||
}
|
||||
};
|
||||
|
||||
btVector3 btConvexShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
btVector3 btConvexShape::localGetSupportingVertex(const btVector3& vec)const
|
||||
{
|
||||
btVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec);
|
||||
btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
|
||||
|
||||
if ( GetMargin()!=0.f )
|
||||
if ( getMargin()!=0.f )
|
||||
{
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -60,7 +60,7 @@ btVector3 btConvexShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
}
|
||||
return supVertex;
|
||||
|
||||
|
||||
@@ -36,23 +36,23 @@ class btConvexShape : public btCollisionShape
|
||||
public:
|
||||
btConvexShape();
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec) const= 0;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const= 0;
|
||||
|
||||
//notice that the vectors should be unit length
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const= 0;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const= 0;
|
||||
|
||||
// testing for hullnode code
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
GetAabbSlow(t,aabbMin,aabbMax);
|
||||
getAabbSlow(t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void GetAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
@@ -62,11 +62,11 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void SetMargin(float margin)
|
||||
virtual void setMargin(float margin)
|
||||
{
|
||||
m_collisionMargin = margin;
|
||||
}
|
||||
virtual float GetMargin() const
|
||||
virtual float getMargin() const
|
||||
{
|
||||
return m_collisionMargin;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
{
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
|
||||
|
||||
|
||||
btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
btVector3 btConvexTriangleMeshShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
{
|
||||
btVector3 supVec(0.f,0.f,0.f);
|
||||
|
||||
@@ -92,7 +92,7 @@ btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertexWithoutMargin(const
|
||||
return supVec;
|
||||
}
|
||||
|
||||
void btConvexTriangleMeshShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btConvexTriangleMeshShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
//use 'w' component of supportVerticesOut?
|
||||
{
|
||||
@@ -118,11 +118,11 @@ void btConvexTriangleMeshShape::BatchedUnitVectorGetSupportingVertexWithoutMargi
|
||||
|
||||
|
||||
|
||||
btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
btVector3 btConvexTriangleMeshShape::localGetSupportingVertex(const btVector3& vec)const
|
||||
{
|
||||
btVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec);
|
||||
btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
|
||||
|
||||
if ( GetMargin()!=0.f )
|
||||
if ( getMargin()!=0.f )
|
||||
{
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -130,7 +130,7 @@ btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertex(const btVector3& v
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
}
|
||||
return supVertex;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ btVector3 btConvexTriangleMeshShape::LocalGetSupportingVertex(const btVector3& v
|
||||
|
||||
//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection
|
||||
//Please note that you can debug-draw btConvexTriangleMeshShape with the Raytracer Demo
|
||||
int btConvexTriangleMeshShape::GetNumVertices() const
|
||||
int btConvexTriangleMeshShape::getNumVertices() const
|
||||
{
|
||||
//cache this?
|
||||
assert(0);
|
||||
@@ -153,34 +153,34 @@ int btConvexTriangleMeshShape::GetNumVertices() const
|
||||
|
||||
}
|
||||
|
||||
int btConvexTriangleMeshShape::GetNumEdges() const
|
||||
int btConvexTriangleMeshShape::getNumEdges() const
|
||||
{
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btConvexTriangleMeshShape::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
void btConvexTriangleMeshShape::getEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void btConvexTriangleMeshShape::GetVertex(int i,btPoint3& vtx) const
|
||||
void btConvexTriangleMeshShape::getVertex(int i,btPoint3& vtx) const
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
int btConvexTriangleMeshShape::GetNumPlanes() const
|
||||
int btConvexTriangleMeshShape::getNumPlanes() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btConvexTriangleMeshShape::GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
void btConvexTriangleMeshShape::getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
//not yet
|
||||
bool btConvexTriangleMeshShape::IsInside(const btPoint3& pt,btScalar tolerance) const
|
||||
bool btConvexTriangleMeshShape::isInside(const btPoint3& pt,btScalar tolerance) const
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
|
||||
@@ -17,27 +17,27 @@ class btConvexTriangleMeshShape : public btPolyhedralConvexShape
|
||||
public:
|
||||
btConvexTriangleMeshShape(btStridingMeshInterface* meshInterface);
|
||||
|
||||
class btStridingMeshInterface* GetStridingMesh()
|
||||
class btStridingMeshInterface* getStridingMesh()
|
||||
{
|
||||
return m_stridingMesh;
|
||||
}
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
virtual int GetShapeType()const { return CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType()const { return CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE; }
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "ConvexTrimesh";}
|
||||
virtual char* getName()const {return "ConvexTrimesh";}
|
||||
|
||||
virtual int GetNumVertices() const;
|
||||
virtual int GetNumEdges() const;
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
virtual void GetVertex(int i,btPoint3& vtx) const;
|
||||
virtual int GetNumPlanes() const;
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
virtual int getNumVertices() const;
|
||||
virtual int getNumEdges() const;
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
virtual void getVertex(int i,btPoint3& vtx) const;
|
||||
virtual int getNumPlanes() const;
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
|
||||
|
||||
void setLocalScaling(const btVector3& scaling);
|
||||
|
||||
@@ -151,45 +151,45 @@ const int ZZ = 1;
|
||||
|
||||
}
|
||||
|
||||
btVector3 btCylinderShapeX::LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
btVector3 btCylinderShapeX::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
return CylinderLocalSupportX(GetHalfExtents(),vec);
|
||||
return CylinderLocalSupportX(getHalfExtents(),vec);
|
||||
}
|
||||
|
||||
|
||||
btVector3 btCylinderShapeZ::LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
btVector3 btCylinderShapeZ::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
return CylinderLocalSupportZ(GetHalfExtents(),vec);
|
||||
return CylinderLocalSupportZ(getHalfExtents(),vec);
|
||||
}
|
||||
btVector3 btCylinderShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
btVector3 btCylinderShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
return CylinderLocalSupportY(GetHalfExtents(),vec);
|
||||
return CylinderLocalSupportY(getHalfExtents(),vec);
|
||||
}
|
||||
|
||||
void btCylinderShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btCylinderShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
supportVerticesOut[i] = CylinderLocalSupportY(GetHalfExtents(),vectors[i]);
|
||||
supportVerticesOut[i] = CylinderLocalSupportY(getHalfExtents(),vectors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void btCylinderShapeZ::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btCylinderShapeZ::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
supportVerticesOut[i] = CylinderLocalSupportZ(GetHalfExtents(),vectors[i]);
|
||||
supportVerticesOut[i] = CylinderLocalSupportZ(getHalfExtents(),vectors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void btCylinderShapeX::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btCylinderShapeX::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
supportVerticesOut[i] = CylinderLocalSupportX(GetHalfExtents(),vectors[i]);
|
||||
supportVerticesOut[i] = CylinderLocalSupportX(getHalfExtents(),vectors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,23 +28,23 @@ class btCylinderShape : public btBoxShape
|
||||
public:
|
||||
btCylinderShape (const btVector3& halfExtents);
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
GetAabbSlow(t,aabbMin,aabbMax);
|
||||
getAabbSlow(t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec) const
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
|
||||
{
|
||||
|
||||
btVector3 supVertex;
|
||||
supVertex = LocalGetSupportingVertexWithoutMargin(vec);
|
||||
supVertex = localGetSupportingVertexWithoutMargin(vec);
|
||||
|
||||
if ( GetMargin()!=0.f )
|
||||
if ( getMargin()!=0.f )
|
||||
{
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -52,32 +52,32 @@ public:
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
}
|
||||
return supVertex;
|
||||
}
|
||||
|
||||
|
||||
//use box inertia
|
||||
// virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
// virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual int GetShapeType() const
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return CYLINDER_SHAPE_PROXYTYPE;
|
||||
}
|
||||
|
||||
virtual int GetUpAxis() const
|
||||
virtual int getUpAxis() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual float GetRadius() const
|
||||
virtual float getRadius() const
|
||||
{
|
||||
return GetHalfExtents().getX();
|
||||
return getHalfExtents().getX();
|
||||
}
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "CylinderY";
|
||||
}
|
||||
@@ -91,21 +91,21 @@ class btCylinderShapeX : public btCylinderShape
|
||||
public:
|
||||
btCylinderShapeX (const btVector3& halfExtents);
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual int GetUpAxis() const
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual int getUpAxis() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
//debugging
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "CylinderX";
|
||||
}
|
||||
|
||||
virtual float GetRadius() const
|
||||
virtual float getRadius() const
|
||||
{
|
||||
return GetHalfExtents().getY();
|
||||
return getHalfExtents().getY();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -115,22 +115,22 @@ class btCylinderShapeZ : public btCylinderShape
|
||||
public:
|
||||
btCylinderShapeZ (const btVector3& halfExtents);
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
virtual int GetUpAxis() const
|
||||
virtual int getUpAxis() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
//debugging
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "CylinderZ";
|
||||
}
|
||||
|
||||
virtual float GetRadius() const
|
||||
virtual float getRadius() const
|
||||
{
|
||||
return GetHalfExtents().getX();
|
||||
return getHalfExtents().getX();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -29,10 +29,10 @@ btEmptyShape::~btEmptyShape()
|
||||
}
|
||||
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void btEmptyShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void btEmptyShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
btVector3 margin(GetMargin(),GetMargin(),GetMargin());
|
||||
btVector3 margin(getMargin(),getMargin(),getMargin());
|
||||
|
||||
aabbMin = t.getOrigin() - margin;
|
||||
|
||||
@@ -40,7 +40,7 @@ void btEmptyShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aa
|
||||
|
||||
}
|
||||
|
||||
void btEmptyShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btEmptyShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ public:
|
||||
virtual ~btEmptyShape();
|
||||
|
||||
|
||||
///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
|
||||
void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling)
|
||||
@@ -50,12 +50,12 @@ public:
|
||||
return m_localScaling;
|
||||
}
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual int GetShapeType() const { return EMPTY_SHAPE_PROXYTYPE;}
|
||||
virtual int getShapeType() const { return EMPTY_SHAPE_PROXYTYPE;}
|
||||
|
||||
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "Empty";
|
||||
}
|
||||
|
||||
@@ -24,32 +24,32 @@ m_shapeB(shapeB)
|
||||
m_transB.setIdentity();
|
||||
}
|
||||
|
||||
btVector3 btMinkowskiSumShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
btVector3 btMinkowskiSumShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
btVector3 supVertexA = m_transA(m_shapeA->LocalGetSupportingVertexWithoutMargin(vec*m_transA.getBasis()));
|
||||
btVector3 supVertexB = m_transB(m_shapeB->LocalGetSupportingVertexWithoutMargin(vec*m_transB.getBasis()));
|
||||
btVector3 supVertexA = m_transA(m_shapeA->localGetSupportingVertexWithoutMargin(vec*m_transA.getBasis()));
|
||||
btVector3 supVertexB = m_transB(m_shapeB->localGetSupportingVertexWithoutMargin(vec*m_transB.getBasis()));
|
||||
return supVertexA + supVertexB;
|
||||
}
|
||||
|
||||
void btMinkowskiSumShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btMinkowskiSumShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
//todo: could make recursive use of batching. probably this shape is not used frequently.
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
supportVerticesOut[i] = LocalGetSupportingVertexWithoutMargin(vectors[i]);
|
||||
supportVerticesOut[i] = localGetSupportingVertexWithoutMargin(vectors[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
float btMinkowskiSumShape::GetMargin() const
|
||||
float btMinkowskiSumShape::getMargin() const
|
||||
{
|
||||
return m_shapeA->GetMargin() + m_shapeB->GetMargin();
|
||||
return m_shapeA->getMargin() + m_shapeB->getMargin();
|
||||
}
|
||||
|
||||
|
||||
void btMinkowskiSumShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btMinkowskiSumShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
assert(0);
|
||||
inertia.setValue(0,0,0);
|
||||
|
||||
@@ -32,28 +32,28 @@ public:
|
||||
|
||||
btMinkowskiSumShape(btConvexShape* shapeA,btConvexShape* shapeB);
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
void SetTransformA(const btTransform& transA) { m_transA = transA;}
|
||||
void SetTransformB(const btTransform& transB) { m_transB = transB;}
|
||||
void setTransformA(const btTransform& transA) { m_transA = transA;}
|
||||
void setTransformB(const btTransform& transB) { m_transB = transB;}
|
||||
|
||||
const btTransform& GetTransformA()const { return m_transA;}
|
||||
const btTransform& getTransformA()const { return m_transA;}
|
||||
const btTransform& GetTransformB()const { return m_transB;}
|
||||
|
||||
|
||||
virtual int GetShapeType() const { return MINKOWSKI_SUM_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType() const { return MINKOWSKI_SUM_SHAPE_PROXYTYPE; }
|
||||
|
||||
virtual float GetMargin() const;
|
||||
virtual float getMargin() const;
|
||||
|
||||
const btConvexShape* GetShapeA() const { return m_shapeA;}
|
||||
const btConvexShape* GetShapeB() const { return m_shapeB;}
|
||||
const btConvexShape* getShapeA() const { return m_shapeA;}
|
||||
const btConvexShape* getShapeB() const { return m_shapeB;}
|
||||
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "MinkowskiSum";
|
||||
}
|
||||
|
||||
@@ -30,14 +30,14 @@ btMultiSphereShape::btMultiSphereShape (const btVector3& inertiaHalfExtents,cons
|
||||
if (radi[i] < m_minRadius)
|
||||
m_minRadius = radi[i];
|
||||
}
|
||||
SetMargin(m_minRadius);
|
||||
setMargin(m_minRadius);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
btVector3 btMultiSphereShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
btVector3 btMultiSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
{
|
||||
int i;
|
||||
btVector3 supVec(0,0,0);
|
||||
@@ -79,7 +79,7 @@ btMultiSphereShape::btMultiSphereShape (const btVector3& inertiaHalfExtents,cons
|
||||
|
||||
}
|
||||
|
||||
void btMultiSphereShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btMultiSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
|
||||
for (int j=0;j<numVectors;j++)
|
||||
@@ -116,7 +116,7 @@ btMultiSphereShape::btMultiSphereShape (const btVector3& inertiaHalfExtents,cons
|
||||
|
||||
|
||||
|
||||
void btMultiSphereShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btMultiSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//as an approximation, take the inertia of the box that bounds the spheres
|
||||
|
||||
@@ -124,7 +124,7 @@ void btMultiSphereShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
ident.setIdentity();
|
||||
// btVector3 aabbMin,aabbMax;
|
||||
|
||||
// GetAabb(ident,aabbMin,aabbMax);
|
||||
// getAabb(ident,aabbMin,aabbMax);
|
||||
|
||||
btVector3 halfExtents = m_inertiaHalfExtents;//(aabbMax - aabbMin)* 0.5f;
|
||||
|
||||
|
||||
@@ -41,17 +41,17 @@ public:
|
||||
btMultiSphereShape (const btVector3& inertiaHalfExtents,const btVector3* positions,const btScalar* radi,int numSpheres);
|
||||
|
||||
///CollisionShape Interface
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
/// btConvexShape Interface
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
|
||||
virtual int GetShapeType() const { return MULTI_SPHERE_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType() const { return MULTI_SPHERE_SHAPE_PROXYTYPE; }
|
||||
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "MultiSphere";
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ subject to the following restrictions:
|
||||
|
||||
|
||||
|
||||
void btOptimizedBvh::Build(btStridingMeshInterface* triangles)
|
||||
void btOptimizedBvh::build(btStridingMeshInterface* triangles)
|
||||
{
|
||||
//int countTriangles = 0;
|
||||
|
||||
@@ -37,7 +37,7 @@ void btOptimizedBvh::Build(btStridingMeshInterface* triangles)
|
||||
|
||||
}
|
||||
|
||||
virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
{
|
||||
|
||||
btOptimizedBvhNode node;
|
||||
@@ -78,7 +78,7 @@ void btOptimizedBvh::Build(btStridingMeshInterface* triangles)
|
||||
m_contiguousNodes = new btOptimizedBvhNode[2*m_leafNodes.size()];
|
||||
m_curNodeIndex = 0;
|
||||
|
||||
m_rootNode1 = BuildTree(m_leafNodes,0,m_leafNodes.size());
|
||||
m_rootNode1 = buildTree(m_leafNodes,0,m_leafNodes.size());
|
||||
|
||||
|
||||
///create the leafnodes first
|
||||
@@ -91,7 +91,7 @@ btOptimizedBvh::~btOptimizedBvh()
|
||||
delete m_contiguousNodes;
|
||||
}
|
||||
|
||||
btOptimizedBvhNode* btOptimizedBvh::BuildTree (NodeArray& leafNodes,int startIndex,int endIndex)
|
||||
btOptimizedBvhNode* btOptimizedBvh::buildTree (NodeArray& leafNodes,int startIndex,int endIndex)
|
||||
{
|
||||
btOptimizedBvhNode* internalNode;
|
||||
|
||||
@@ -107,9 +107,9 @@ btOptimizedBvhNode* btOptimizedBvh::BuildTree (NodeArray& leafNodes,int startInd
|
||||
}
|
||||
//calculate Best Splitting Axis and where to split it. Sort the incoming 'leafNodes' array within range 'startIndex/endIndex'.
|
||||
|
||||
splitAxis = CalcSplittingAxis(leafNodes,startIndex,endIndex);
|
||||
splitAxis = calcSplittingAxis(leafNodes,startIndex,endIndex);
|
||||
|
||||
splitIndex = SortAndCalcSplittingIndex(leafNodes,startIndex,endIndex,splitAxis);
|
||||
splitIndex = sortAndCalcSplittingIndex(leafNodes,startIndex,endIndex,splitAxis);
|
||||
|
||||
internalNode = &m_contiguousNodes[m_curNodeIndex++];
|
||||
|
||||
@@ -125,14 +125,14 @@ btOptimizedBvhNode* btOptimizedBvh::BuildTree (NodeArray& leafNodes,int startInd
|
||||
|
||||
|
||||
//internalNode->m_escapeIndex;
|
||||
internalNode->m_leftChild = BuildTree(leafNodes,startIndex,splitIndex);
|
||||
internalNode->m_rightChild = BuildTree(leafNodes,splitIndex,endIndex);
|
||||
internalNode->m_leftChild = buildTree(leafNodes,startIndex,splitIndex);
|
||||
internalNode->m_rightChild = buildTree(leafNodes,splitIndex,endIndex);
|
||||
|
||||
internalNode->m_escapeIndex = m_curNodeIndex - curIndex;
|
||||
return internalNode;
|
||||
}
|
||||
|
||||
int btOptimizedBvh::SortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis)
|
||||
int btOptimizedBvh::sortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis)
|
||||
{
|
||||
int i;
|
||||
int splitIndex =startIndex;
|
||||
@@ -170,7 +170,7 @@ int btOptimizedBvh::SortAndCalcSplittingIndex(NodeArray& leafNodes,int startInde
|
||||
}
|
||||
|
||||
|
||||
int btOptimizedBvh::CalcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex)
|
||||
int btOptimizedBvh::calcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -199,16 +199,16 @@ int btOptimizedBvh::CalcSplittingAxis(NodeArray& leafNodes,int startIndex,int en
|
||||
|
||||
|
||||
|
||||
void btOptimizedBvh::ReportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btOptimizedBvh::reportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
//either choose recursive traversal (WalkTree) or stackless (WalkStacklessTree)
|
||||
//either choose recursive traversal (walkTree) or stackless (walkStacklessTree)
|
||||
|
||||
//WalkTree(m_rootNode1,nodeCallback,aabbMin,aabbMax);
|
||||
//walkTree(m_rootNode1,nodeCallback,aabbMin,aabbMax);
|
||||
|
||||
WalkStacklessTree(m_rootNode1,nodeCallback,aabbMin,aabbMax);
|
||||
walkStacklessTree(m_rootNode1,nodeCallback,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
void btOptimizedBvh::WalkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btOptimizedBvh::walkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
bool isLeafNode, aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMin,rootNode->m_aabbMax);
|
||||
if (aabbOverlap)
|
||||
@@ -216,11 +216,11 @@ void btOptimizedBvh::WalkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback
|
||||
isLeafNode = (!rootNode->m_leftChild && !rootNode->m_rightChild);
|
||||
if (isLeafNode)
|
||||
{
|
||||
nodeCallback->ProcessNode(rootNode);
|
||||
nodeCallback->processNode(rootNode);
|
||||
} else
|
||||
{
|
||||
WalkTree(rootNode->m_leftChild,nodeCallback,aabbMin,aabbMax);
|
||||
WalkTree(rootNode->m_rightChild,nodeCallback,aabbMin,aabbMax);
|
||||
walkTree(rootNode->m_leftChild,nodeCallback,aabbMin,aabbMax);
|
||||
walkTree(rootNode->m_rightChild,nodeCallback,aabbMin,aabbMax);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ void btOptimizedBvh::WalkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback
|
||||
|
||||
int maxIterations = 0;
|
||||
|
||||
void btOptimizedBvh::WalkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btOptimizedBvh::walkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
int escapeIndex, curIndex = 0;
|
||||
int walkIterations = 0;
|
||||
@@ -245,7 +245,7 @@ void btOptimizedBvh::WalkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverla
|
||||
|
||||
if (isLeafNode && aabbOverlap)
|
||||
{
|
||||
nodeCallback->ProcessNode(rootNode);
|
||||
nodeCallback->processNode(rootNode);
|
||||
}
|
||||
|
||||
if (aabbOverlap || isLeafNode)
|
||||
@@ -267,7 +267,7 @@ void btOptimizedBvh::WalkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverla
|
||||
}
|
||||
|
||||
|
||||
void btOptimizedBvh::ReportSphereOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btOptimizedBvh::reportSphereOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class btNodeOverlapCallback
|
||||
public:
|
||||
virtual ~btNodeOverlapCallback() {};
|
||||
|
||||
virtual void ProcessNode(const btOptimizedBvhNode* node) = 0;
|
||||
virtual void processNode(const btOptimizedBvhNode* node) = 0;
|
||||
};
|
||||
|
||||
typedef std::vector<btOptimizedBvhNode> NodeArray;
|
||||
@@ -71,26 +71,26 @@ public:
|
||||
btOptimizedBvh() :m_rootNode1(0), m_numNodes(0) { }
|
||||
virtual ~btOptimizedBvh();
|
||||
|
||||
void Build(btStridingMeshInterface* triangles);
|
||||
void build(btStridingMeshInterface* triangles);
|
||||
|
||||
btOptimizedBvhNode* BuildTree (NodeArray& leafNodes,int startIndex,int endIndex);
|
||||
btOptimizedBvhNode* buildTree (NodeArray& leafNodes,int startIndex,int endIndex);
|
||||
|
||||
int CalcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex);
|
||||
int calcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex);
|
||||
|
||||
int SortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis);
|
||||
int sortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis);
|
||||
|
||||
void WalkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
void walkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
void WalkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
void walkStacklessTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
|
||||
//OptimizedBvhNode* GetRootNode() { return m_rootNode1;}
|
||||
|
||||
int GetNumNodes() { return m_numNodes;}
|
||||
int getNumNodes() { return m_numNodes;}
|
||||
|
||||
void ReportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
void reportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
void ReportSphereOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
void reportSphereOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ btPolyhedralConvexShape::btPolyhedralConvexShape()
|
||||
|
||||
|
||||
|
||||
btVector3 btPolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
btVector3 btPolyhedralConvexShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
|
||||
{
|
||||
int i;
|
||||
btVector3 supVec(0,0,0);
|
||||
@@ -44,9 +44,9 @@ btVector3 btPolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const b
|
||||
btVector3 vtx;
|
||||
btScalar newDot;
|
||||
|
||||
for (i=0;i<GetNumVertices();i++)
|
||||
for (i=0;i<getNumVertices();i++)
|
||||
{
|
||||
GetVertex(i,vtx);
|
||||
getVertex(i,vtx);
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > maxDot)
|
||||
{
|
||||
@@ -59,7 +59,7 @@ btVector3 btPolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const b
|
||||
|
||||
}
|
||||
|
||||
void btPolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btPolyhedralConvexShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -76,9 +76,9 @@ void btPolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(
|
||||
|
||||
const btVector3& vec = vectors[j];
|
||||
|
||||
for (i=0;i<GetNumVertices();i++)
|
||||
for (i=0;i<getNumVertices();i++)
|
||||
{
|
||||
GetVertex(i,vtx);
|
||||
getVertex(i,vtx);
|
||||
newDot = vec.dot(vtx);
|
||||
if (newDot > supportVerticesOut[j][3])
|
||||
{
|
||||
@@ -92,16 +92,16 @@ void btPolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(
|
||||
|
||||
|
||||
|
||||
void btPolyhedralConvexShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btPolyhedralConvexShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//not yet, return box inertia
|
||||
|
||||
float margin = GetMargin();
|
||||
float margin = getMargin();
|
||||
|
||||
btTransform ident;
|
||||
ident.setIdentity();
|
||||
btVector3 aabbMin,aabbMax;
|
||||
GetAabb(ident,aabbMin,aabbMax);
|
||||
getAabb(ident,aabbMin,aabbMax);
|
||||
btVector3 halfExtents = (aabbMax-aabbMin)*0.5f;
|
||||
|
||||
btScalar lx=2.f*(halfExtents.x()+margin);
|
||||
|
||||
@@ -30,22 +30,22 @@ public:
|
||||
btPolyhedralConvexShape();
|
||||
|
||||
//brute force implementations
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
|
||||
|
||||
virtual int GetNumVertices() const = 0 ;
|
||||
virtual int GetNumEdges() const = 0;
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const = 0;
|
||||
virtual void GetVertex(int i,btPoint3& vtx) const = 0;
|
||||
virtual int GetNumPlanes() const = 0;
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const = 0;
|
||||
// virtual int GetIndex(int i) const = 0 ;
|
||||
virtual int getNumVertices() const = 0 ;
|
||||
virtual int getNumEdges() const = 0;
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const = 0;
|
||||
virtual void getVertex(int i,btPoint3& vtx) const = 0;
|
||||
virtual int getNumPlanes() const = 0;
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const = 0;
|
||||
// virtual int getIndex(int i) const = 0 ;
|
||||
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const = 0;
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const = 0;
|
||||
|
||||
/// optional Hull is for optional Separating Axis Test Hull collision detection, see Hull.cpp
|
||||
class Hull* m_optionalHull;
|
||||
|
||||
@@ -24,12 +24,12 @@ btSphereShape ::btSphereShape (btScalar radius)
|
||||
{
|
||||
}
|
||||
|
||||
btVector3 btSphereShape::LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
return btVector3(0.f,0.f,0.f);
|
||||
}
|
||||
|
||||
void btSphereShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
void btSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
@@ -38,10 +38,10 @@ void btSphereShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVe
|
||||
}
|
||||
|
||||
|
||||
btVector3 btSphereShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
btVector3 btSphereShape::localGetSupportingVertex(const btVector3& vec)const
|
||||
{
|
||||
btVector3 supVertex;
|
||||
supVertex = LocalGetSupportingVertexWithoutMargin(vec);
|
||||
supVertex = localGetSupportingVertexWithoutMargin(vec);
|
||||
|
||||
btVector3 vecnorm = vec;
|
||||
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
|
||||
@@ -49,25 +49,25 @@ btVector3 btSphereShape::LocalGetSupportingVertex(const btVector3& vec)const
|
||||
vecnorm.setValue(-1.f,-1.f,-1.f);
|
||||
}
|
||||
vecnorm.normalize();
|
||||
supVertex+= GetMargin() * vecnorm;
|
||||
supVertex+= getMargin() * vecnorm;
|
||||
return supVertex;
|
||||
}
|
||||
|
||||
|
||||
//broken due to scaling
|
||||
void btSphereShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
void btSphereShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
const btVector3& center = t.getOrigin();
|
||||
btVector3 extent(GetMargin(),GetMargin(),GetMargin());
|
||||
btVector3 extent(getMargin(),getMargin(),getMargin());
|
||||
aabbMin = center - extent;
|
||||
aabbMax = center + extent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void btSphereShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
btScalar elem = 0.4f * mass * GetMargin()*GetMargin();
|
||||
btScalar elem = 0.4f * mass * getMargin()*getMargin();
|
||||
inertia[0] = inertia[1] = inertia[2] = elem;
|
||||
|
||||
}
|
||||
|
||||
@@ -29,32 +29,32 @@ public:
|
||||
btSphereShape (btScalar radius);
|
||||
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec)const;
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||
//notice that the vectors should be unit length
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual int GetShapeType() const { return SPHERE_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType() const { return SPHERE_SHAPE_PROXYTYPE; }
|
||||
|
||||
btScalar GetRadius() const { return m_radius;}
|
||||
btScalar getRadius() const { return m_radius;}
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "SPHERE";}
|
||||
virtual char* getName()const {return "SPHERE";}
|
||||
|
||||
virtual void SetMargin(float margin)
|
||||
virtual void setMargin(float margin)
|
||||
{
|
||||
btConvexShape::SetMargin(margin);
|
||||
btConvexShape::setMargin(margin);
|
||||
}
|
||||
virtual float GetMargin() const
|
||||
virtual float getMargin() const
|
||||
{
|
||||
//to improve gjk behaviour, use radius+margin as the full margin, so never get into the penetration case
|
||||
//this means, non-uniform scaling is not supported anymore
|
||||
return m_localScaling[0] * m_radius + btConvexShape::GetMargin();
|
||||
return m_localScaling[0] * m_radius + btConvexShape::getMargin();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ btStaticPlaneShape::~btStaticPlaneShape()
|
||||
|
||||
|
||||
|
||||
void btStaticPlaneShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
void btStaticPlaneShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
btVector3 infvec (1e30f,1e30f,1e30f);
|
||||
|
||||
@@ -50,7 +50,7 @@ void btStaticPlaneShape::GetAabb(const btTransform& t,btVector3& aabbMin,btVecto
|
||||
|
||||
|
||||
|
||||
void btStaticPlaneShape::ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btStaticPlaneShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
btVector3 halfExtents = (aabbMax - aabbMin) * 0.5f;
|
||||
@@ -73,17 +73,17 @@ void btStaticPlaneShape::ProcessAllTriangles(btTriangleCallback* callback,const
|
||||
triangle[1] = projectedCenter + tangentDir0*radius - tangentDir1*radius;
|
||||
triangle[2] = projectedCenter - tangentDir0*radius - tangentDir1*radius;
|
||||
|
||||
callback->ProcessTriangle(triangle,0,0);
|
||||
callback->processTriangle(triangle,0,0);
|
||||
|
||||
triangle[0] = projectedCenter - tangentDir0*radius - tangentDir1*radius;
|
||||
triangle[1] = projectedCenter - tangentDir0*radius + tangentDir1*radius;
|
||||
triangle[2] = projectedCenter + tangentDir0*radius + tangentDir1*radius;
|
||||
|
||||
callback->ProcessTriangle(triangle,0,1);
|
||||
callback->processTriangle(triangle,0,1);
|
||||
|
||||
}
|
||||
|
||||
void btStaticPlaneShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btStaticPlaneShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//moving concave objects not supported
|
||||
|
||||
|
||||
@@ -37,23 +37,23 @@ public:
|
||||
virtual ~btStaticPlaneShape();
|
||||
|
||||
|
||||
virtual int GetShapeType() const
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return STATIC_PLANE_PROXYTYPE;
|
||||
}
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual void ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
virtual const btVector3& getLocalScaling() const;
|
||||
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "STATICPLANE";}
|
||||
virtual char* getName()const {return "STATICPLANE";}
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde
|
||||
triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
|
||||
graphicsbase = (float*)(vertexbase+tri_indices[2]*stride);
|
||||
triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
|
||||
callback->InternalProcessTriangleIndex(triangle,part,gfxindex);
|
||||
callback->internalProcessTriangleIndex(triangle,part,gfxindex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde
|
||||
triangle[1].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
|
||||
graphicsbase = (float*)(vertexbase+tri_indices[2]*stride);
|
||||
triangle[2].setValue(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(), graphicsbase[2]*meshScaling.getZ());
|
||||
callback->InternalProcessTriangleIndex(triangle,part,gfxindex);
|
||||
callback->internalProcessTriangleIndex(triangle,part,gfxindex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -24,49 +24,49 @@ btBU_Simplex1to4::btBU_Simplex1to4()
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btPoint3& pt0)
|
||||
:m_numVertices(0)
|
||||
{
|
||||
AddVertex(pt0);
|
||||
addVertex(pt0);
|
||||
}
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btPoint3& pt0,const btPoint3& pt1)
|
||||
:m_numVertices(0)
|
||||
{
|
||||
AddVertex(pt0);
|
||||
AddVertex(pt1);
|
||||
addVertex(pt0);
|
||||
addVertex(pt1);
|
||||
}
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btPoint3& pt0,const btPoint3& pt1,const btPoint3& pt2)
|
||||
:m_numVertices(0)
|
||||
{
|
||||
AddVertex(pt0);
|
||||
AddVertex(pt1);
|
||||
AddVertex(pt2);
|
||||
addVertex(pt0);
|
||||
addVertex(pt1);
|
||||
addVertex(pt2);
|
||||
}
|
||||
|
||||
btBU_Simplex1to4::btBU_Simplex1to4(const btPoint3& pt0,const btPoint3& pt1,const btPoint3& pt2,const btPoint3& pt3)
|
||||
:m_numVertices(0)
|
||||
{
|
||||
AddVertex(pt0);
|
||||
AddVertex(pt1);
|
||||
AddVertex(pt2);
|
||||
AddVertex(pt3);
|
||||
addVertex(pt0);
|
||||
addVertex(pt1);
|
||||
addVertex(pt2);
|
||||
addVertex(pt3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void btBU_Simplex1to4::AddVertex(const btPoint3& pt)
|
||||
void btBU_Simplex1to4::addVertex(const btPoint3& pt)
|
||||
{
|
||||
m_vertices[m_numVertices++] = pt;
|
||||
}
|
||||
|
||||
|
||||
int btBU_Simplex1to4::GetNumVertices() const
|
||||
int btBU_Simplex1to4::getNumVertices() const
|
||||
{
|
||||
return m_numVertices;
|
||||
}
|
||||
|
||||
int btBU_Simplex1to4::GetNumEdges() const
|
||||
int btBU_Simplex1to4::getNumEdges() const
|
||||
{
|
||||
//euler formula, F-E+V = 2, so E = F+V-2
|
||||
|
||||
@@ -85,7 +85,7 @@ int btBU_Simplex1to4::GetNumEdges() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btBU_Simplex1to4::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
void btBU_Simplex1to4::getEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
{
|
||||
|
||||
switch (m_numVertices)
|
||||
@@ -149,12 +149,12 @@ void btBU_Simplex1to4::GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
|
||||
}
|
||||
|
||||
void btBU_Simplex1to4::GetVertex(int i,btPoint3& vtx) const
|
||||
void btBU_Simplex1to4::getVertex(int i,btPoint3& vtx) const
|
||||
{
|
||||
vtx = m_vertices[i];
|
||||
}
|
||||
|
||||
int btBU_Simplex1to4::GetNumPlanes() const
|
||||
int btBU_Simplex1to4::getNumPlanes() const
|
||||
{
|
||||
switch (m_numVertices)
|
||||
{
|
||||
@@ -176,17 +176,17 @@ int btBU_Simplex1to4::GetNumPlanes() const
|
||||
}
|
||||
|
||||
|
||||
void btBU_Simplex1to4::GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const
|
||||
void btBU_Simplex1to4::getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int btBU_Simplex1to4::GetIndex(int i) const
|
||||
int btBU_Simplex1to4::getIndex(int i) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool btBU_Simplex1to4::IsInside(const btPoint3& pt,btScalar tolerance) const
|
||||
bool btBU_Simplex1to4::isInside(const btPoint3& pt,btScalar tolerance) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,37 +38,37 @@ public:
|
||||
btBU_Simplex1to4(const btPoint3& pt0,const btPoint3& pt1,const btPoint3& pt2,const btPoint3& pt3);
|
||||
|
||||
|
||||
void Reset()
|
||||
void reset()
|
||||
{
|
||||
m_numVertices = 0;
|
||||
}
|
||||
|
||||
|
||||
virtual int GetShapeType() const{ return TETRAHEDRAL_SHAPE_PROXYTYPE; }
|
||||
virtual int getShapeType() const{ return TETRAHEDRAL_SHAPE_PROXYTYPE; }
|
||||
|
||||
void AddVertex(const btPoint3& pt);
|
||||
void addVertex(const btPoint3& pt);
|
||||
|
||||
//PolyhedralConvexShape interface
|
||||
|
||||
virtual int GetNumVertices() const;
|
||||
virtual int getNumVertices() const;
|
||||
|
||||
virtual int GetNumEdges() const;
|
||||
virtual int getNumEdges() const;
|
||||
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const;
|
||||
|
||||
virtual void GetVertex(int i,btPoint3& vtx) const;
|
||||
virtual void getVertex(int i,btPoint3& vtx) const;
|
||||
|
||||
virtual int GetNumPlanes() const;
|
||||
virtual int getNumPlanes() const;
|
||||
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const;
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const;
|
||||
|
||||
virtual int GetIndex(int i) const;
|
||||
virtual int getIndex(int i) const;
|
||||
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const;
|
||||
|
||||
|
||||
///GetName is for debugging
|
||||
virtual char* GetName()const { return "btBU_Simplex1to4";}
|
||||
///getName is for debugging
|
||||
virtual char* getName()const { return "btBU_Simplex1to4";}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class btTriangleCallback
|
||||
public:
|
||||
|
||||
virtual ~btTriangleCallback();
|
||||
virtual void ProcessTriangle(btVector3* triangle, int partId, int triangleIndex) = 0;
|
||||
virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex) = 0;
|
||||
};
|
||||
|
||||
class btInternalTriangleIndexCallback
|
||||
@@ -32,7 +32,7 @@ class btInternalTriangleIndexCallback
|
||||
public:
|
||||
|
||||
virtual ~btInternalTriangleIndexCallback();
|
||||
virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex) = 0;
|
||||
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ btTriangleIndexVertexArray::btTriangleIndexVertexArray(int numTriangles,int* tri
|
||||
mesh.m_vertexBase = vertexBase;
|
||||
mesh.m_vertexStride = vertexStride;
|
||||
|
||||
AddIndexedMesh(mesh);
|
||||
addIndexedMesh(mesh);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ struct btIndexedMesh
|
||||
};
|
||||
|
||||
///TriangleIndexVertexArray allows to use multiple meshes, by indexing into existing triangle/index arrays.
|
||||
///Additional meshes can be added using AddIndexedMesh
|
||||
///Additional meshes can be added using addIndexedMesh
|
||||
///No duplcate is made of the vertex/index data, it only indexes into external vertex/index arrays.
|
||||
///So keep those arrays around during the lifetime of this btTriangleIndexVertexArray.
|
||||
class btTriangleIndexVertexArray : public btStridingMeshInterface
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
//just to be backwards compatible
|
||||
btTriangleIndexVertexArray(int numTriangleIndices,int* triangleIndexBase,int triangleIndexStride,int numVertices,float* vertexBase,int vertexStride);
|
||||
|
||||
void AddIndexedMesh(const btIndexedMesh& mesh)
|
||||
void addIndexedMesh(const btIndexedMesh& mesh)
|
||||
{
|
||||
m_indexedMeshes.push_back(mesh);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class btTriangleMesh : public btStridingMeshInterface
|
||||
public:
|
||||
btTriangleMesh ();
|
||||
|
||||
void AddTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2)
|
||||
void addTriangle(const btVector3& vertex0,const btVector3& vertex1,const btVector3& vertex2)
|
||||
{
|
||||
btMyTriangle tri;
|
||||
tri.m_vert0 = vertex0;
|
||||
|
||||
@@ -25,7 +25,7 @@ subject to the following restrictions:
|
||||
btTriangleMeshShape::btTriangleMeshShape(btStridingMeshInterface* meshInterface)
|
||||
: m_meshInterface(meshInterface)
|
||||
{
|
||||
RecalcLocalAabb();
|
||||
recalcLocalAabb();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ btTriangleMeshShape::~btTriangleMeshShape()
|
||||
|
||||
|
||||
|
||||
void btTriangleMeshShape::GetAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
void btTriangleMeshShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
btVector3 localHalfExtents = 0.5f*(m_localAabbMax-m_localAabbMin);
|
||||
@@ -50,7 +50,7 @@ void btTriangleMeshShape::GetAabb(const btTransform& trans,btVector3& aabbMin,bt
|
||||
btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
|
||||
abs_b[1].dot(localHalfExtents),
|
||||
abs_b[2].dot(localHalfExtents));
|
||||
extent += btVector3(GetMargin(),GetMargin(),GetMargin());
|
||||
extent += btVector3(getMargin(),getMargin(),getMargin());
|
||||
|
||||
aabbMin = center - extent;
|
||||
aabbMax = center + extent;
|
||||
@@ -58,16 +58,16 @@ void btTriangleMeshShape::GetAabb(const btTransform& trans,btVector3& aabbMin,bt
|
||||
|
||||
}
|
||||
|
||||
void btTriangleMeshShape::RecalcLocalAabb()
|
||||
void btTriangleMeshShape::recalcLocalAabb()
|
||||
{
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
btVector3 vec(0.f,0.f,0.f);
|
||||
vec[i] = 1.f;
|
||||
btVector3 tmp = LocalGetSupportingVertex(vec);
|
||||
btVector3 tmp = localGetSupportingVertex(vec);
|
||||
m_localAabbMax[i] = tmp[i]+m_collisionMargin;
|
||||
vec[i] = -1.f;
|
||||
tmp = LocalGetSupportingVertex(vec);
|
||||
tmp = localGetSupportingVertex(vec);
|
||||
m_localAabbMin[i] = tmp[i]-m_collisionMargin;
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
m_supportVecLocal = supportVecWorld * m_worldTrans.getBasis();
|
||||
}
|
||||
|
||||
virtual void ProcessTriangle( btVector3* triangle,int partId, int triangleIndex)
|
||||
virtual void processTriangle( btVector3* triangle,int partId, int triangleIndex)
|
||||
{
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
void btTriangleMeshShape::setLocalScaling(const btVector3& scaling)
|
||||
{
|
||||
m_meshInterface->setScaling(scaling);
|
||||
RecalcLocalAabb();
|
||||
recalcLocalAabb();
|
||||
}
|
||||
|
||||
const btVector3& btTriangleMeshShape::getLocalScaling() const
|
||||
@@ -136,7 +136,7 @@ const btVector3& btTriangleMeshShape::getLocalScaling() const
|
||||
//#define DEBUG_TRIANGLE_MESH
|
||||
|
||||
|
||||
void btTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
void btTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
|
||||
struct FilteredCallback : public btInternalTriangleIndexCallback
|
||||
@@ -152,12 +152,12 @@ void btTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,const
|
||||
{
|
||||
}
|
||||
|
||||
virtual void InternalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
{
|
||||
if (TestTriangleAgainstAabb2(&triangle[0],m_aabbMin,m_aabbMax))
|
||||
{
|
||||
//check aabb in triangle-space, before doing this
|
||||
m_callback->ProcessTriangle(triangle,partId,triangleIndex);
|
||||
m_callback->processTriangle(triangle,partId,triangleIndex);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -174,7 +174,7 @@ void btTriangleMeshShape::ProcessAllTriangles(btTriangleCallback* callback,const
|
||||
|
||||
|
||||
|
||||
void btTriangleMeshShape::CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
void btTriangleMeshShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
//moving concave objects not supported
|
||||
assert(0);
|
||||
@@ -182,7 +182,7 @@ void btTriangleMeshShape::CalculateLocalInertia(btScalar mass,btVector3& inertia
|
||||
}
|
||||
|
||||
|
||||
btVector3 btTriangleMeshShape::LocalGetSupportingVertex(const btVector3& vec) const
|
||||
btVector3 btTriangleMeshShape::localGetSupportingVertex(const btVector3& vec) const
|
||||
{
|
||||
btVector3 supportVertex;
|
||||
|
||||
@@ -193,7 +193,7 @@ btVector3 btTriangleMeshShape::LocalGetSupportingVertex(const btVector3& vec) co
|
||||
|
||||
btVector3 aabbMax(1e30f,1e30f,1e30f);
|
||||
|
||||
ProcessAllTriangles(&supportCallback,-aabbMax,aabbMax);
|
||||
processAllTriangles(&supportCallback,-aabbMax,aabbMax);
|
||||
|
||||
supportVertex = supportCallback.GetSupportVertexLocal();
|
||||
|
||||
|
||||
@@ -34,33 +34,33 @@ public:
|
||||
|
||||
virtual ~btTriangleMeshShape();
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertex(const btVector3& vec) const;
|
||||
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const;
|
||||
|
||||
virtual btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const
|
||||
{
|
||||
assert(0);
|
||||
return LocalGetSupportingVertex(vec);
|
||||
return localGetSupportingVertex(vec);
|
||||
}
|
||||
|
||||
void RecalcLocalAabb();
|
||||
void recalcLocalAabb();
|
||||
|
||||
virtual int GetShapeType() const
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return TRIANGLE_MESH_SHAPE_PROXYTYPE;
|
||||
}
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
|
||||
virtual void ProcessAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
virtual const btVector3& getLocalScaling() const;
|
||||
|
||||
|
||||
//debugging
|
||||
virtual char* GetName()const {return "TRIANGLEMESH";}
|
||||
virtual char* getName()const {return "TRIANGLEMESH";}
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -28,49 +28,49 @@ public:
|
||||
btVector3 m_vertices1[3];
|
||||
|
||||
|
||||
virtual int GetNumVertices() const
|
||||
virtual int getNumVertices() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
const btVector3& GetVertexPtr(int index) const
|
||||
const btVector3& getVertexPtr(int index) const
|
||||
{
|
||||
return m_vertices1[index];
|
||||
}
|
||||
virtual void GetVertex(int index,btVector3& vert) const
|
||||
virtual void getVertex(int index,btVector3& vert) const
|
||||
{
|
||||
vert = m_vertices1[index];
|
||||
}
|
||||
virtual int GetShapeType() const
|
||||
virtual int getShapeType() const
|
||||
{
|
||||
return TRIANGLE_SHAPE_PROXYTYPE;
|
||||
}
|
||||
|
||||
virtual int GetNumEdges() const
|
||||
virtual int getNumEdges() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
virtual void GetEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const
|
||||
{
|
||||
GetVertex(i,pa);
|
||||
GetVertex((i+1)%3,pb);
|
||||
getVertex(i,pa);
|
||||
getVertex((i+1)%3,pb);
|
||||
}
|
||||
|
||||
virtual void GetAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax)const
|
||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax)const
|
||||
{
|
||||
// ASSERT(0);
|
||||
GetAabbSlow(t,aabbMin,aabbMax);
|
||||
getAabbSlow(t,aabbMin,aabbMax);
|
||||
}
|
||||
|
||||
btVector3 LocalGetSupportingVertexWithoutMargin(const btVector3& dir)const
|
||||
btVector3 localGetSupportingVertexWithoutMargin(const btVector3& dir)const
|
||||
{
|
||||
btVector3 dots(dir.dot(m_vertices1[0]), dir.dot(m_vertices1[1]), dir.dot(m_vertices1[2]));
|
||||
return m_vertices1[dots.maxAxis()];
|
||||
|
||||
}
|
||||
|
||||
virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
|
||||
{
|
||||
for (int i=0;i<numVectors;i++)
|
||||
{
|
||||
@@ -92,38 +92,38 @@ public:
|
||||
|
||||
|
||||
|
||||
virtual void GetPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const
|
||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i) const
|
||||
{
|
||||
GetPlaneEquation(i,planeNormal,planeSupport);
|
||||
getPlaneEquation(i,planeNormal,planeSupport);
|
||||
}
|
||||
|
||||
virtual int GetNumPlanes() const
|
||||
virtual int getNumPlanes() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CalcNormal(btVector3& normal) const
|
||||
void calcNormal(btVector3& normal) const
|
||||
{
|
||||
normal = (m_vertices1[1]-m_vertices1[0]).cross(m_vertices1[2]-m_vertices1[0]);
|
||||
normal.normalize();
|
||||
}
|
||||
|
||||
virtual void GetPlaneEquation(int i, btVector3& planeNormal,btPoint3& planeSupport) const
|
||||
virtual void getPlaneEquation(int i, btVector3& planeNormal,btPoint3& planeSupport) const
|
||||
{
|
||||
CalcNormal(planeNormal);
|
||||
calcNormal(planeNormal);
|
||||
planeSupport = m_vertices1[0];
|
||||
}
|
||||
|
||||
virtual void CalculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia)
|
||||
{
|
||||
ASSERT(0);
|
||||
inertia.setValue(0.f,0.f,0.f);
|
||||
}
|
||||
|
||||
virtual bool IsInside(const btPoint3& pt,btScalar tolerance) const
|
||||
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const
|
||||
{
|
||||
btVector3 normal;
|
||||
CalcNormal(normal);
|
||||
calcNormal(normal);
|
||||
//distance to plane
|
||||
btScalar dist = pt.dot(normal);
|
||||
btScalar planeconst = m_vertices1[0].dot(normal);
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
for (i=0;i<3;i++)
|
||||
{
|
||||
btPoint3 pa,pb;
|
||||
GetEdge(i,pa,pb);
|
||||
getEdge(i,pa,pb);
|
||||
btVector3 edge = pb-pa;
|
||||
btVector3 edgeNormal = edge.cross(normal);
|
||||
edgeNormal.normalize();
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
//debugging
|
||||
virtual char* GetName()const
|
||||
virtual char* getName()const
|
||||
{
|
||||
return "Triangle";
|
||||
}
|
||||
|
||||
@@ -49,11 +49,11 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
||||
|
||||
/// compute linear and angular velocity for this interval, to interpolate
|
||||
btVector3 linVelA,angVelA,linVelB,angVelB;
|
||||
btTransformUtil::CalculateVelocity(fromA,toA,1.f,linVelA,angVelA);
|
||||
btTransformUtil::CalculateVelocity(fromB,toB,1.f,linVelB,angVelB);
|
||||
btTransformUtil::calculateVelocity(fromA,toA,1.f,linVelA,angVelA);
|
||||
btTransformUtil::calculateVelocity(fromB,toB,1.f,linVelB,angVelB);
|
||||
|
||||
btScalar boundingRadiusA = m_convexA->GetAngularMotionDisc();
|
||||
btScalar boundingRadiusB = m_convexB->GetAngularMotionDisc();
|
||||
btScalar boundingRadiusA = m_convexA->getAngularMotionDisc();
|
||||
btScalar boundingRadiusB = m_convexB->getAngularMotionDisc();
|
||||
|
||||
btScalar maxAngularProjectedVelocity = angVelA.length() * boundingRadiusA + angVelB.length() * boundingRadiusB;
|
||||
|
||||
@@ -80,10 +80,10 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
||||
identityTrans.setIdentity();
|
||||
|
||||
btSphereShape raySphere(0.0f);
|
||||
raySphere.SetMargin(0.f);
|
||||
raySphere.setMargin(0.f);
|
||||
|
||||
|
||||
// result.DrawCoordSystem(sphereTr);
|
||||
// result.drawCoordSystem(sphereTr);
|
||||
|
||||
btPointCollector pointCollector1;
|
||||
|
||||
@@ -93,11 +93,11 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
||||
btGjkPairDetector::ClosestPointInput input;
|
||||
|
||||
//we don't use margins during CCD
|
||||
gjk.SetIgnoreMargin(true);
|
||||
gjk.setIgnoreMargin(true);
|
||||
|
||||
input.m_transformA = fromA;
|
||||
input.m_transformB = fromB;
|
||||
gjk.GetClosestPoints(input,pointCollector1,0);
|
||||
gjk.getClosestPoints(input,pointCollector1,0);
|
||||
|
||||
hasResult = pointCollector1.m_hasResult;
|
||||
c = pointCollector1.m_pointInWorld;
|
||||
@@ -145,8 +145,8 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
||||
//interpolate to next lambda
|
||||
btTransform interpolatedTransA,interpolatedTransB,relativeTrans;
|
||||
|
||||
btTransformUtil::IntegrateTransform(fromA,linVelA,angVelA,lambda,interpolatedTransA);
|
||||
btTransformUtil::IntegrateTransform(fromB,linVelB,angVelB,lambda,interpolatedTransB);
|
||||
btTransformUtil::integrateTransform(fromA,linVelA,angVelA,lambda,interpolatedTransA);
|
||||
btTransformUtil::integrateTransform(fromB,linVelB,angVelB,lambda,interpolatedTransB);
|
||||
relativeTrans = interpolatedTransB.inverseTimes(interpolatedTransA);
|
||||
|
||||
result.DebugDraw( lambda );
|
||||
@@ -156,7 +156,7 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
|
||||
btGjkPairDetector::ClosestPointInput input;
|
||||
input.m_transformA = interpolatedTransA;
|
||||
input.m_transformB = interpolatedTransB;
|
||||
gjk.GetClosestPoints(input,pointCollector,0);
|
||||
gjk.getClosestPoints(input,pointCollector,0);
|
||||
if (pointCollector.m_hasResult)
|
||||
{
|
||||
if (pointCollector.m_distance < 0.f)
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
//virtual bool addRayResult(const btVector3& normal,btScalar fraction) = 0;
|
||||
|
||||
virtual void DebugDraw(btScalar fraction) {}
|
||||
virtual void DrawCoordSystem(const btTransform& trans) {}
|
||||
virtual void drawCoordSystem(const btTransform& trans) {}
|
||||
|
||||
CastResult()
|
||||
:m_fraction(1e30f),
|
||||
|
||||
@@ -29,7 +29,7 @@ class btConvexPenetrationDepthSolver
|
||||
public:
|
||||
|
||||
virtual ~btConvexPenetrationDepthSolver() {};
|
||||
virtual bool CalcPenDepth( btSimplexSolverInterface& simplexSolver,
|
||||
virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver,
|
||||
btConvexShape* convexA,btConvexShape* convexB,
|
||||
const btTransform& transA,const btTransform& transB,
|
||||
btVector3& v, btPoint3& pa, btPoint3& pb,
|
||||
|
||||
@@ -35,9 +35,9 @@ struct btDiscreteCollisionDetectorInterface
|
||||
|
||||
virtual ~Result(){}
|
||||
|
||||
///SetShapeIdentifiers provides experimental support for per-triangle material / custom material combiner
|
||||
virtual void SetShapeIdentifiers(int partId0,int index0, int partId1,int index1)=0;
|
||||
virtual void AddContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)=0;
|
||||
///setShapeIdentifiers provides experimental support for per-triangle material / custom material combiner
|
||||
virtual void setShapeIdentifiers(int partId0,int index0, int partId1,int index1)=0;
|
||||
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)=0;
|
||||
};
|
||||
|
||||
struct ClosestPointInput
|
||||
@@ -58,7 +58,7 @@ struct btDiscreteCollisionDetectorInterface
|
||||
// give either closest points (distance > 0) or penetration (distance)
|
||||
// the normal always points from B towards A
|
||||
//
|
||||
virtual void GetClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw) = 0;
|
||||
virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw) = 0;
|
||||
|
||||
btScalar getCollisionMargin() { return 0.2f;}
|
||||
};
|
||||
@@ -75,7 +75,7 @@ struct btStorageResult : public btDiscreteCollisionDetectorInterface::Result
|
||||
}
|
||||
virtual ~btStorageResult() {};
|
||||
|
||||
virtual void AddContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
{
|
||||
if (depth < m_distance)
|
||||
{
|
||||
|
||||
@@ -54,8 +54,8 @@ bool btGjkConvexCast::calcTimeOfImpact(
|
||||
trA.setOrigin(btPoint3(0,0,0));
|
||||
trB.setOrigin(btPoint3(0,0,0));
|
||||
|
||||
convex->SetTransformA(trA);
|
||||
convex->SetTransformB(trB);
|
||||
convex->setTransformA(trA);
|
||||
convex->setTransformB(trB);
|
||||
|
||||
|
||||
|
||||
@@ -82,13 +82,13 @@ bool btGjkConvexCast::calcTimeOfImpact(
|
||||
identityTrans.setIdentity();
|
||||
|
||||
btSphereShape raySphere(0.0f);
|
||||
raySphere.SetMargin(0.f);
|
||||
raySphere.setMargin(0.f);
|
||||
|
||||
btTransform sphereTr;
|
||||
sphereTr.setIdentity();
|
||||
sphereTr.setOrigin( rayFromLocalA.getOrigin());
|
||||
|
||||
result.DrawCoordSystem(sphereTr);
|
||||
result.drawCoordSystem(sphereTr);
|
||||
{
|
||||
btPointCollector pointCollector1;
|
||||
btGjkPairDetector gjk(&raySphere,convex,m_simplexSolver,penSolverPtr);
|
||||
@@ -96,7 +96,7 @@ bool btGjkConvexCast::calcTimeOfImpact(
|
||||
btGjkPairDetector::ClosestPointInput input;
|
||||
input.m_transformA = sphereTr;
|
||||
input.m_transformB = identityTrans;
|
||||
gjk.GetClosestPoints(input,pointCollector1,0);
|
||||
gjk.getClosestPoints(input,pointCollector1,0);
|
||||
|
||||
hasResult = pointCollector1.m_hasResult;
|
||||
c = pointCollector1.m_pointInWorld;
|
||||
@@ -134,13 +134,13 @@ bool btGjkConvexCast::calcTimeOfImpact(
|
||||
x = s + lambda * r;
|
||||
|
||||
sphereTr.setOrigin( x );
|
||||
result.DrawCoordSystem(sphereTr);
|
||||
result.drawCoordSystem(sphereTr);
|
||||
btPointCollector pointCollector;
|
||||
btGjkPairDetector gjk(&raySphere,convex,m_simplexSolver,penSolverPtr);
|
||||
btGjkPairDetector::ClosestPointInput input;
|
||||
input.m_transformA = sphereTr;
|
||||
input.m_transformB = identityTrans;
|
||||
gjk.GetClosestPoints(input,pointCollector,0);
|
||||
gjk.getClosestPoints(input,pointCollector,0);
|
||||
if (pointCollector.m_hasResult)
|
||||
{
|
||||
if (pointCollector.m_distance < 0.f)
|
||||
|
||||
@@ -43,14 +43,14 @@ m_index1(-1)
|
||||
{
|
||||
}
|
||||
|
||||
void btGjkPairDetector::GetClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw)
|
||||
void btGjkPairDetector::getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw)
|
||||
{
|
||||
btScalar distance=0.f;
|
||||
btVector3 normalInB(0.f,0.f,0.f);
|
||||
btVector3 pointOnA,pointOnB;
|
||||
|
||||
float marginA = m_minkowskiA->GetMargin();
|
||||
float marginB = m_minkowskiB->GetMargin();
|
||||
float marginA = m_minkowskiA->getMargin();
|
||||
float marginB = m_minkowskiB->getMargin();
|
||||
|
||||
//for CCD we don't use margins
|
||||
if (m_ignoreMargin)
|
||||
@@ -87,8 +87,8 @@ int curIter = 0;
|
||||
m_cachedSeparatingAxis.getY(),
|
||||
m_cachedSeparatingAxis.getZ(),
|
||||
squaredDistance,
|
||||
m_minkowskiA->GetShapeType(),
|
||||
m_minkowskiB->GetShapeType());
|
||||
m_minkowskiA->getShapeType(),
|
||||
m_minkowskiB->getShapeType());
|
||||
#endif
|
||||
break;
|
||||
|
||||
@@ -97,8 +97,8 @@ int curIter = 0;
|
||||
btVector3 seperatingAxisInA = (-m_cachedSeparatingAxis)* input.m_transformA.getBasis();
|
||||
btVector3 seperatingAxisInB = m_cachedSeparatingAxis* input.m_transformB.getBasis();
|
||||
|
||||
btVector3 pInA = m_minkowskiA->LocalGetSupportingVertexWithoutMargin(seperatingAxisInA);
|
||||
btVector3 qInB = m_minkowskiB->LocalGetSupportingVertexWithoutMargin(seperatingAxisInB);
|
||||
btVector3 pInA = m_minkowskiA->localGetSupportingVertexWithoutMargin(seperatingAxisInA);
|
||||
btVector3 qInB = m_minkowskiB->localGetSupportingVertexWithoutMargin(seperatingAxisInB);
|
||||
btPoint3 pWorld = input.m_transformA(pInA);
|
||||
btPoint3 qWorld = input.m_transformB(qInB);
|
||||
|
||||
@@ -184,7 +184,7 @@ int curIter = 0;
|
||||
if (m_penetrationDepthSolver)
|
||||
{
|
||||
// Penetration depth case.
|
||||
isValid = m_penetrationDepthSolver->CalcPenDepth(
|
||||
isValid = m_penetrationDepthSolver->calcPenDepth(
|
||||
*m_simplexSolver,
|
||||
m_minkowskiA,m_minkowskiB,
|
||||
input.m_transformA,input.m_transformB,
|
||||
@@ -211,9 +211,9 @@ int curIter = 0;
|
||||
|
||||
if (isValid)
|
||||
{
|
||||
output.SetShapeIdentifiers(m_partId0,m_index0,m_partId1,m_index1);
|
||||
output.setShapeIdentifiers(m_partId0,m_index0,m_partId1,m_index1);
|
||||
|
||||
output.AddContactPoint(
|
||||
output.addContactPoint(
|
||||
normalInB,
|
||||
pointOnB,
|
||||
distance);
|
||||
|
||||
@@ -53,28 +53,28 @@ public:
|
||||
btGjkPairDetector(btConvexShape* objectA,btConvexShape* objectB,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver* penetrationDepthSolver);
|
||||
virtual ~btGjkPairDetector() {};
|
||||
|
||||
virtual void GetClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw);
|
||||
virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw);
|
||||
|
||||
void SetMinkowskiA(btConvexShape* minkA)
|
||||
void setMinkowskiA(btConvexShape* minkA)
|
||||
{
|
||||
m_minkowskiA = minkA;
|
||||
}
|
||||
|
||||
void SetMinkowskiB(btConvexShape* minkB)
|
||||
void setMinkowskiB(btConvexShape* minkB)
|
||||
{
|
||||
m_minkowskiB = minkB;
|
||||
}
|
||||
void SetCachedSeperatingAxis(const btVector3& seperatingAxis)
|
||||
void setCachedSeperatingAxis(const btVector3& seperatingAxis)
|
||||
{
|
||||
m_cachedSeparatingAxis = seperatingAxis;
|
||||
}
|
||||
|
||||
void SetPenetrationDepthSolver(btConvexPenetrationDepthSolver* penetrationDepthSolver)
|
||||
void setPenetrationDepthSolver(btConvexPenetrationDepthSolver* penetrationDepthSolver)
|
||||
{
|
||||
m_penetrationDepthSolver = penetrationDepthSolver;
|
||||
}
|
||||
|
||||
void SetIgnoreMargin(bool ignoreMargin)
|
||||
void setIgnoreMargin(bool ignoreMargin)
|
||||
{
|
||||
m_ignoreMargin = ignoreMargin;
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ btManifoldContactAddResult::btManifoldContactAddResult(btTransform transA,btTran
|
||||
}
|
||||
|
||||
|
||||
void btManifoldContactAddResult::AddContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
void btManifoldContactAddResult::addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
{
|
||||
if (depth > m_manifoldPtr->GetContactBreakingTreshold())
|
||||
if (depth > m_manifoldPtr->getContactBreakingTreshold())
|
||||
return;
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ void btManifoldContactAddResult::AddContactPoint(const btVector3& normalOnBInWor
|
||||
btVector3 localB = m_transBInv(pointInWorld);
|
||||
btManifoldPoint newPt(localA,localB,normalOnBInWorld,depth);
|
||||
|
||||
int insertIndex = m_manifoldPtr->GetCacheEntry(newPt);
|
||||
int insertIndex = m_manifoldPtr->getCacheEntry(newPt);
|
||||
if (insertIndex >= 0)
|
||||
{
|
||||
m_manifoldPtr->ReplaceContactPoint(newPt,insertIndex);
|
||||
m_manifoldPtr->replaceContactPoint(newPt,insertIndex);
|
||||
} else
|
||||
{
|
||||
m_manifoldPtr->AddManifoldPoint(newPt);
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
|
||||
btManifoldContactAddResult(btTransform transA,btTransform transB,btPersistentManifold* manifoldPtr);
|
||||
|
||||
virtual void AddContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth);
|
||||
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class btManifoldPoint
|
||||
btVector3 m_localPointA;
|
||||
btVector3 m_localPointB;
|
||||
btVector3 m_positionWorldOnB;
|
||||
///m_positionWorldOnA is redundant information, see GetPositionWorldOnA(), but for clarity
|
||||
///m_positionWorldOnA is redundant information, see getPositionWorldOnA(), but for clarity
|
||||
btVector3 m_positionWorldOnA;
|
||||
btVector3 m_normalWorldOnB;
|
||||
|
||||
@@ -67,26 +67,26 @@ class btManifoldPoint
|
||||
|
||||
int m_lifeTime;//lifetime of the contactpoint in frames
|
||||
|
||||
float GetDistance() const
|
||||
float getDistance() const
|
||||
{
|
||||
return m_distance1;
|
||||
}
|
||||
int GetLifeTime() const
|
||||
int getLifeTime() const
|
||||
{
|
||||
return m_lifeTime;
|
||||
}
|
||||
|
||||
btVector3 GetPositionWorldOnA() {
|
||||
btVector3 getPositionWorldOnA() {
|
||||
return m_positionWorldOnA;
|
||||
// return m_positionWorldOnB + m_normalWorldOnB * m_distance1;
|
||||
}
|
||||
|
||||
const btVector3& GetPositionWorldOnB()
|
||||
const btVector3& getPositionWorldOnB()
|
||||
{
|
||||
return m_positionWorldOnB;
|
||||
}
|
||||
|
||||
void SetDistance(float dist)
|
||||
void setDistance(float dist)
|
||||
{
|
||||
m_distance1 = dist;
|
||||
}
|
||||
|
||||
@@ -32,10 +32,10 @@ struct MyResult : public btDiscreteCollisionDetectorInterface::Result
|
||||
float m_depth;
|
||||
bool m_hasResult;
|
||||
|
||||
virtual void SetShapeIdentifiers(int partId0,int index0, int partId1,int index1)
|
||||
virtual void setShapeIdentifiers(int partId0,int index0, int partId1,int index1)
|
||||
{
|
||||
}
|
||||
void AddContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
{
|
||||
m_normalOnBInWorld = normalOnBInWorld;
|
||||
m_pointInWorld = pointInWorld;
|
||||
@@ -92,7 +92,7 @@ btVector3(0.162456f , 0.499995f,0.850654f)
|
||||
};
|
||||
|
||||
|
||||
bool btMinkowskiPenetrationDepthSolver::CalcPenDepth(btSimplexSolverInterface& simplexSolver,
|
||||
bool btMinkowskiPenetrationDepthSolver::calcPenDepth(btSimplexSolverInterface& simplexSolver,
|
||||
btConvexShape* convexA,btConvexShape* convexB,
|
||||
const btTransform& transA,const btTransform& transB,
|
||||
btVector3& v, btPoint3& pa, btPoint3& pb,
|
||||
@@ -123,8 +123,8 @@ bool btMinkowskiPenetrationDepthSolver::CalcPenDepth(btSimplexSolverInterface& s
|
||||
seperatingAxisInBBatch[i] = norm * transB.getBasis();
|
||||
}
|
||||
|
||||
convexA->BatchedUnitVectorGetSupportingVertexWithoutMargin(seperatingAxisInABatch,supportVerticesABatch,NUM_UNITSPHERE_POINTS);
|
||||
convexB->BatchedUnitVectorGetSupportingVertexWithoutMargin(seperatingAxisInBBatch,supportVerticesBBatch,NUM_UNITSPHERE_POINTS);
|
||||
convexA->batchedUnitVectorGetSupportingVertexWithoutMargin(seperatingAxisInABatch,supportVerticesABatch,NUM_UNITSPHERE_POINTS);
|
||||
convexB->batchedUnitVectorGetSupportingVertexWithoutMargin(seperatingAxisInBBatch,supportVerticesBBatch,NUM_UNITSPHERE_POINTS);
|
||||
for (i=0;i<NUM_UNITSPHERE_POINTS;i++)
|
||||
{
|
||||
const btVector3& norm = sPenetrationDirections[i];
|
||||
@@ -153,8 +153,8 @@ bool btMinkowskiPenetrationDepthSolver::CalcPenDepth(btSimplexSolverInterface& s
|
||||
const btVector3& norm = sPenetrationDirections[i];
|
||||
seperatingAxisInA = (-norm)* transA.getBasis();
|
||||
seperatingAxisInB = norm* transB.getBasis();
|
||||
pInA = convexA->LocalGetSupportingVertexWithoutMargin(seperatingAxisInA);
|
||||
qInB = convexB->LocalGetSupportingVertexWithoutMargin(seperatingAxisInB);
|
||||
pInA = convexA->localGetSupportingVertexWithoutMargin(seperatingAxisInA);
|
||||
qInB = convexB->localGetSupportingVertexWithoutMargin(seperatingAxisInB);
|
||||
pWorld = transA(pInA);
|
||||
qWorld = transB(qInB);
|
||||
w = qWorld - pWorld;
|
||||
@@ -172,9 +172,9 @@ bool btMinkowskiPenetrationDepthSolver::CalcPenDepth(btSimplexSolverInterface& s
|
||||
|
||||
//add the margins
|
||||
|
||||
minA += minNorm*convexA->GetMargin();
|
||||
minB -= minNorm*convexB->GetMargin();
|
||||
minProj += (convexA->GetMargin() + convexB->GetMargin());
|
||||
minA += minNorm*convexA->getMargin();
|
||||
minB -= minNorm*convexB->getMargin();
|
||||
minProj += (convexA->getMargin() + convexB->getMargin());
|
||||
|
||||
|
||||
|
||||
@@ -184,11 +184,11 @@ bool btMinkowskiPenetrationDepthSolver::CalcPenDepth(btSimplexSolverInterface& s
|
||||
if (debugDraw)
|
||||
{
|
||||
btVector3 color(0,1,0);
|
||||
debugDraw->DrawLine(minA,minB,color);
|
||||
debugDraw->drawLine(minA,minB,color);
|
||||
color = btVector3 (1,1,1);
|
||||
btVector3 vec = minB-minA;
|
||||
float prj2 = minNorm.dot(vec);
|
||||
debugDraw->DrawLine(minA,minA+(minNorm*minProj),color);
|
||||
debugDraw->drawLine(minA,minA+(minNorm*minProj),color);
|
||||
|
||||
}
|
||||
#endif //DEBUG_DRAW
|
||||
@@ -214,7 +214,7 @@ bool btMinkowskiPenetrationDepthSolver::CalcPenDepth(btSimplexSolverInterface& s
|
||||
input.m_maximumDistanceSquared = 1e30f;//minProj;
|
||||
|
||||
MyResult res;
|
||||
gjkdet.GetClosestPoints(input,res,debugDraw);
|
||||
gjkdet.getClosestPoints(input,res,debugDraw);
|
||||
|
||||
float correctedMinNorm = minProj - res.m_depth;
|
||||
|
||||
@@ -233,7 +233,7 @@ bool btMinkowskiPenetrationDepthSolver::CalcPenDepth(btSimplexSolverInterface& s
|
||||
if (debugDraw)
|
||||
{
|
||||
btVector3 color(1,0,0);
|
||||
debugDraw->DrawLine(pa,pb,color);
|
||||
debugDraw->drawLine(pa,pb,color);
|
||||
}
|
||||
#endif//DEBUG_DRAW
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class btMinkowskiPenetrationDepthSolver : public btConvexPenetrationDepthSolver
|
||||
{
|
||||
public:
|
||||
|
||||
virtual bool CalcPenDepth( btSimplexSolverInterface& simplexSolver,
|
||||
virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver,
|
||||
btConvexShape* convexA,btConvexShape* convexB,
|
||||
const btTransform& transA,const btTransform& transB,
|
||||
btVector3& v, btPoint3& pa, btPoint3& pb,
|
||||
|
||||
@@ -32,12 +32,12 @@ m_index1(0)
|
||||
}
|
||||
|
||||
|
||||
void btPersistentManifold::ClearManifold()
|
||||
void btPersistentManifold::clearManifold()
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<m_cachedPoints;i++)
|
||||
{
|
||||
ClearUserCache(m_pointCache[i]);
|
||||
clearUserCache(m_pointCache[i]);
|
||||
}
|
||||
m_cachedPoints = 0;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ void btPersistentManifold::DebugPersistency()
|
||||
}
|
||||
#endif //DEBUG_PERSISTENCY
|
||||
|
||||
void btPersistentManifold::ClearUserCache(btManifoldPoint& pt)
|
||||
void btPersistentManifold::clearUserCache(btManifoldPoint& pt)
|
||||
{
|
||||
|
||||
void* oldPtr = pt.m_userPersistentData;
|
||||
@@ -70,7 +70,7 @@ void btPersistentManifold::ClearUserCache(btManifoldPoint& pt)
|
||||
{
|
||||
occurance++;
|
||||
if (occurance>1)
|
||||
printf("error in ClearUserCache\n");
|
||||
printf("error in clearUserCache\n");
|
||||
}
|
||||
}
|
||||
assert(occurance<=0);
|
||||
@@ -91,7 +91,7 @@ void btPersistentManifold::ClearUserCache(btManifoldPoint& pt)
|
||||
}
|
||||
|
||||
|
||||
int btPersistentManifold::SortCachedPoints(const btManifoldPoint& pt)
|
||||
int btPersistentManifold::sortCachedPoints(const btManifoldPoint& pt)
|
||||
{
|
||||
|
||||
//calculate 4 possible cases areas, and take biggest area
|
||||
@@ -100,13 +100,13 @@ int btPersistentManifold::SortCachedPoints(const btManifoldPoint& pt)
|
||||
int maxPenetrationIndex = -1;
|
||||
#define KEEP_DEEPEST_POINT 1
|
||||
#ifdef KEEP_DEEPEST_POINT
|
||||
float maxPenetration = pt.GetDistance();
|
||||
float maxPenetration = pt.getDistance();
|
||||
for (int i=0;i<4;i++)
|
||||
{
|
||||
if (m_pointCache[i].GetDistance() < maxPenetration)
|
||||
if (m_pointCache[i].getDistance() < maxPenetration)
|
||||
{
|
||||
maxPenetrationIndex = i;
|
||||
maxPenetration = m_pointCache[i].GetDistance();
|
||||
maxPenetration = m_pointCache[i].getDistance();
|
||||
}
|
||||
}
|
||||
#endif //KEEP_DEEPEST_POINT
|
||||
@@ -149,10 +149,10 @@ int btPersistentManifold::SortCachedPoints(const btManifoldPoint& pt)
|
||||
}
|
||||
|
||||
|
||||
int btPersistentManifold::GetCacheEntry(const btManifoldPoint& newPoint) const
|
||||
int btPersistentManifold::getCacheEntry(const btManifoldPoint& newPoint) const
|
||||
{
|
||||
btScalar shortestDist = GetContactBreakingTreshold() * GetContactBreakingTreshold();
|
||||
int size = GetNumContacts();
|
||||
btScalar shortestDist = getContactBreakingTreshold() * getContactBreakingTreshold();
|
||||
int size = getNumContacts();
|
||||
int nearestPoint = -1;
|
||||
for( int i = 0; i < size; i++ )
|
||||
{
|
||||
@@ -171,14 +171,14 @@ int btPersistentManifold::GetCacheEntry(const btManifoldPoint& newPoint) const
|
||||
|
||||
void btPersistentManifold::AddManifoldPoint(const btManifoldPoint& newPoint)
|
||||
{
|
||||
assert(ValidContactDistance(newPoint));
|
||||
assert(validContactDistance(newPoint));
|
||||
|
||||
int insertIndex = GetNumContacts();
|
||||
int insertIndex = getNumContacts();
|
||||
if (insertIndex == MANIFOLD_CACHE_SIZE)
|
||||
{
|
||||
#if MANIFOLD_CACHE_SIZE >= 4
|
||||
//sort cache so best points come first, based on area
|
||||
insertIndex = SortCachedPoints(newPoint);
|
||||
insertIndex = sortCachedPoints(newPoint);
|
||||
#else
|
||||
insertIndex = 0;
|
||||
#endif
|
||||
@@ -190,20 +190,20 @@ void btPersistentManifold::AddManifoldPoint(const btManifoldPoint& newPoint)
|
||||
|
||||
|
||||
}
|
||||
ReplaceContactPoint(newPoint,insertIndex);
|
||||
replaceContactPoint(newPoint,insertIndex);
|
||||
}
|
||||
|
||||
float btPersistentManifold::GetContactBreakingTreshold() const
|
||||
float btPersistentManifold::getContactBreakingTreshold() const
|
||||
{
|
||||
return gContactBreakingTreshold;
|
||||
}
|
||||
|
||||
void btPersistentManifold::RefreshContactPoints(const btTransform& trA,const btTransform& trB)
|
||||
void btPersistentManifold::refreshContactPoints(const btTransform& trA,const btTransform& trB)
|
||||
{
|
||||
int i;
|
||||
|
||||
/// first refresh worldspace positions and distance
|
||||
for (i=GetNumContacts()-1;i>=0;i--)
|
||||
for (i=getNumContacts()-1;i>=0;i--)
|
||||
{
|
||||
btManifoldPoint &manifoldPoint = m_pointCache[i];
|
||||
manifoldPoint.m_positionWorldOnA = trA( manifoldPoint.m_localPointA );
|
||||
@@ -215,23 +215,23 @@ void btPersistentManifold::RefreshContactPoints(const btTransform& trA,const btT
|
||||
/// then
|
||||
btScalar distance2d;
|
||||
btVector3 projectedDifference,projectedPoint;
|
||||
for (i=GetNumContacts()-1;i>=0;i--)
|
||||
for (i=getNumContacts()-1;i>=0;i--)
|
||||
{
|
||||
|
||||
btManifoldPoint &manifoldPoint = m_pointCache[i];
|
||||
//contact becomes invalid when signed distance exceeds margin (projected on contactnormal direction)
|
||||
if (!ValidContactDistance(manifoldPoint))
|
||||
if (!validContactDistance(manifoldPoint))
|
||||
{
|
||||
RemoveContactPoint(i);
|
||||
removeContactPoint(i);
|
||||
} else
|
||||
{
|
||||
//contact also becomes invalid when relative movement orthogonal to normal exceeds margin
|
||||
projectedPoint = manifoldPoint.m_positionWorldOnA - manifoldPoint.m_normalWorldOnB * manifoldPoint.m_distance1;
|
||||
projectedDifference = manifoldPoint.m_positionWorldOnB - projectedPoint;
|
||||
distance2d = projectedDifference.dot(projectedDifference);
|
||||
if (distance2d > GetContactBreakingTreshold()*GetContactBreakingTreshold() )
|
||||
if (distance2d > getContactBreakingTreshold()*getContactBreakingTreshold() )
|
||||
{
|
||||
RemoveContactPoint(i);
|
||||
removeContactPoint(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ class btPersistentManifold
|
||||
|
||||
|
||||
/// sort cached points so most isolated points come first
|
||||
int SortCachedPoints(const btManifoldPoint& pt);
|
||||
int sortCachedPoints(const btManifoldPoint& pt);
|
||||
|
||||
int FindContactPoint(const btManifoldPoint* unUsed, int numUnused,const btManifoldPoint& pt);
|
||||
int findContactPoint(const btManifoldPoint* unUsed, int numUnused,const btManifoldPoint& pt);
|
||||
|
||||
public:
|
||||
|
||||
@@ -64,72 +64,72 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
inline void* GetBody0() { return m_body0;}
|
||||
inline void* GetBody1() { return m_body1;}
|
||||
inline void* getBody0() { return m_body0;}
|
||||
inline void* getBody1() { return m_body1;}
|
||||
|
||||
inline const void* GetBody0() const { return m_body0;}
|
||||
inline const void* GetBody1() const { return m_body1;}
|
||||
inline const void* getBody0() const { return m_body0;}
|
||||
inline const void* getBody1() const { return m_body1;}
|
||||
|
||||
void SetBodies(void* body0,void* body1)
|
||||
void setBodies(void* body0,void* body1)
|
||||
{
|
||||
m_body0 = body0;
|
||||
m_body1 = body1;
|
||||
}
|
||||
|
||||
void ClearUserCache(btManifoldPoint& pt);
|
||||
void clearUserCache(btManifoldPoint& pt);
|
||||
|
||||
#ifdef DEBUG_PERSISTENCY
|
||||
void DebugPersistency();
|
||||
#endif //
|
||||
|
||||
inline int GetNumContacts() const { return m_cachedPoints;}
|
||||
inline int getNumContacts() const { return m_cachedPoints;}
|
||||
|
||||
inline const btManifoldPoint& GetContactPoint(int index) const
|
||||
inline const btManifoldPoint& getContactPoint(int index) const
|
||||
{
|
||||
ASSERT(index < m_cachedPoints);
|
||||
return m_pointCache[index];
|
||||
}
|
||||
|
||||
inline btManifoldPoint& GetContactPoint(int index)
|
||||
inline btManifoldPoint& getContactPoint(int index)
|
||||
{
|
||||
ASSERT(index < m_cachedPoints);
|
||||
return m_pointCache[index];
|
||||
}
|
||||
|
||||
/// todo: get this margin from the current physics / collision environment
|
||||
float GetContactBreakingTreshold() const;
|
||||
float getContactBreakingTreshold() const;
|
||||
|
||||
int GetCacheEntry(const btManifoldPoint& newPoint) const;
|
||||
int getCacheEntry(const btManifoldPoint& newPoint) const;
|
||||
|
||||
void AddManifoldPoint( const btManifoldPoint& newPoint);
|
||||
|
||||
void RemoveContactPoint (int index)
|
||||
void removeContactPoint (int index)
|
||||
{
|
||||
ClearUserCache(m_pointCache[index]);
|
||||
clearUserCache(m_pointCache[index]);
|
||||
|
||||
int lastUsedIndex = GetNumContacts() - 1;
|
||||
int lastUsedIndex = getNumContacts() - 1;
|
||||
m_pointCache[index] = m_pointCache[lastUsedIndex];
|
||||
//get rid of duplicated userPersistentData pointer
|
||||
m_pointCache[lastUsedIndex].m_userPersistentData = 0;
|
||||
m_cachedPoints--;
|
||||
}
|
||||
void ReplaceContactPoint(const btManifoldPoint& newPoint,int insertIndex)
|
||||
void replaceContactPoint(const btManifoldPoint& newPoint,int insertIndex)
|
||||
{
|
||||
assert(ValidContactDistance(newPoint));
|
||||
assert(validContactDistance(newPoint));
|
||||
|
||||
ClearUserCache(m_pointCache[insertIndex]);
|
||||
clearUserCache(m_pointCache[insertIndex]);
|
||||
|
||||
m_pointCache[insertIndex] = newPoint;
|
||||
}
|
||||
|
||||
bool ValidContactDistance(const btManifoldPoint& pt) const
|
||||
bool validContactDistance(const btManifoldPoint& pt) const
|
||||
{
|
||||
return pt.m_distance1 <= GetContactBreakingTreshold();
|
||||
return pt.m_distance1 <= getContactBreakingTreshold();
|
||||
}
|
||||
/// calculated new worldspace coordinates and depth, and reject points that exceed the collision margin
|
||||
void RefreshContactPoints( const btTransform& trA,const btTransform& trB);
|
||||
void refreshContactPoints( const btTransform& trA,const btTransform& trB);
|
||||
|
||||
void ClearManifold();
|
||||
void clearManifold();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@ struct btPointCollector : public btDiscreteCollisionDetectorInterface::Result
|
||||
{
|
||||
}
|
||||
|
||||
virtual void SetShapeIdentifiers(int partId0,int index0, int partId1,int index1)
|
||||
virtual void setShapeIdentifiers(int partId0,int index0, int partId1,int index1)
|
||||
{
|
||||
//??
|
||||
}
|
||||
|
||||
virtual void AddContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,float depth)
|
||||
{
|
||||
if (depth< m_distance)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ btTriangleRaycastCallback::btTriangleRaycastCallback(const btVector3& from,const
|
||||
|
||||
|
||||
|
||||
void btTriangleRaycastCallback::ProcessTriangle(btVector3* triangle,int partId, int triangleIndex)
|
||||
void btTriangleRaycastCallback::processTriangle(btVector3* triangle,int partId, int triangleIndex)
|
||||
{
|
||||
|
||||
|
||||
@@ -87,11 +87,11 @@ void btTriangleRaycastCallback::ProcessTriangle(btVector3* triangle,int partId,
|
||||
|
||||
if ( dist_a > 0 )
|
||||
{
|
||||
m_hitFraction = ReportHit(triangleNormal,distance,partId,triangleIndex);
|
||||
m_hitFraction = reportHit(triangleNormal,distance,partId,triangleIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hitFraction = ReportHit(-triangleNormal,distance,partId,triangleIndex);
|
||||
m_hitFraction = reportHit(-triangleNormal,distance,partId,triangleIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ public:
|
||||
|
||||
btTriangleRaycastCallback(const btVector3& from,const btVector3& to);
|
||||
|
||||
virtual void ProcessTriangle(btVector3* triangle, int partId, int triangleIndex);
|
||||
virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex);
|
||||
|
||||
virtual float ReportHit(const btVector3& hitNormalLocal, float hitFraction, int partId, int triangleIndex ) = 0;
|
||||
virtual float reportHit(const btVector3& hitNormalLocal, float hitFraction, int partId, int triangleIndex ) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ bool btSubsimplexConvexCast::calcTimeOfImpact(
|
||||
|
||||
m_simplexSolver->reset();
|
||||
|
||||
convex->SetTransformB(btTransform(rayFromLocalA.getBasis()));
|
||||
convex->setTransformB(btTransform(rayFromLocalA.getBasis()));
|
||||
|
||||
//float radius = 0.01f;
|
||||
|
||||
@@ -61,7 +61,7 @@ bool btSubsimplexConvexCast::calcTimeOfImpact(
|
||||
btVector3 r = -(rayToLocalA.getOrigin()-rayFromLocalA.getOrigin());
|
||||
btVector3 x = s;
|
||||
btVector3 v;
|
||||
btVector3 arbitraryPoint = convex->LocalGetSupportingVertex(r);
|
||||
btVector3 arbitraryPoint = convex->localGetSupportingVertex(r);
|
||||
|
||||
v = x - arbitraryPoint;
|
||||
|
||||
@@ -83,7 +83,7 @@ bool btSubsimplexConvexCast::calcTimeOfImpact(
|
||||
|
||||
while ( (dist2 > epsilon) && maxIter--)
|
||||
{
|
||||
p = convex->LocalGetSupportingVertex( v);
|
||||
p = convex->localGetSupportingVertex( v);
|
||||
w = x - p;
|
||||
|
||||
float VdotW = v.dot(w);
|
||||
|
||||
@@ -44,7 +44,7 @@ void btVoronoiSimplexSolver::removeVertex(int index)
|
||||
m_simplexPointsQ[index] = m_simplexPointsQ[m_numVertices];
|
||||
}
|
||||
|
||||
void btVoronoiSimplexSolver::ReduceVertices (const btUsageBitfield& usedVerts)
|
||||
void btVoronoiSimplexSolver::reduceVertices (const btUsageBitfield& usedVerts)
|
||||
{
|
||||
if ((numVertices() >= 4) && (!usedVerts.usedVertexD))
|
||||
removeVertex(3);
|
||||
@@ -71,7 +71,7 @@ void btVoronoiSimplexSolver::reset()
|
||||
m_numVertices = 0;
|
||||
m_needsUpdate = true;
|
||||
m_lastW = btVector3(1e30f,1e30f,1e30f);
|
||||
m_cachedBC.Reset();
|
||||
m_cachedBC.reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,12 +89,12 @@ void btVoronoiSimplexSolver::addVertex(const btVector3& w, const btPoint3& p, co
|
||||
m_numVertices++;
|
||||
}
|
||||
|
||||
bool btVoronoiSimplexSolver::UpdateClosestVectorAndPoints()
|
||||
bool btVoronoiSimplexSolver::updateClosestVectorAndPoints()
|
||||
{
|
||||
|
||||
if (m_needsUpdate)
|
||||
{
|
||||
m_cachedBC.Reset();
|
||||
m_cachedBC.reset();
|
||||
|
||||
m_needsUpdate = false;
|
||||
|
||||
@@ -108,9 +108,9 @@ bool btVoronoiSimplexSolver::UpdateClosestVectorAndPoints()
|
||||
m_cachedP1 = m_simplexPointsP[0];
|
||||
m_cachedP2 = m_simplexPointsQ[0];
|
||||
m_cachedV = m_cachedP1-m_cachedP2; //== m_simplexVectorW[0]
|
||||
m_cachedBC.Reset();
|
||||
m_cachedBC.SetBarycentricCoordinates(1.f,0.f,0.f,0.f);
|
||||
m_cachedValidClosest = m_cachedBC.IsValid();
|
||||
m_cachedBC.reset();
|
||||
m_cachedBC.setBarycentricCoordinates(1.f,0.f,0.f,0.f);
|
||||
m_cachedValidClosest = m_cachedBC.isValid();
|
||||
break;
|
||||
};
|
||||
case 2:
|
||||
@@ -144,16 +144,16 @@ bool btVoronoiSimplexSolver::UpdateClosestVectorAndPoints()
|
||||
//reduce to 1 point
|
||||
m_cachedBC.m_usedVertices.usedVertexA = true;
|
||||
}
|
||||
m_cachedBC.SetBarycentricCoordinates(1-t,t);
|
||||
m_cachedBC.setBarycentricCoordinates(1-t,t);
|
||||
nearest = from + t*v;
|
||||
|
||||
m_cachedP1 = m_simplexPointsP[0] + t * (m_simplexPointsP[1] - m_simplexPointsP[0]);
|
||||
m_cachedP2 = m_simplexPointsQ[0] + t * (m_simplexPointsQ[1] - m_simplexPointsQ[0]);
|
||||
m_cachedV = m_cachedP1 - m_cachedP2;
|
||||
|
||||
ReduceVertices(m_cachedBC.m_usedVertices);
|
||||
reduceVertices(m_cachedBC.m_usedVertices);
|
||||
|
||||
m_cachedValidClosest = m_cachedBC.IsValid();
|
||||
m_cachedValidClosest = m_cachedBC.isValid();
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
@@ -165,7 +165,7 @@ bool btVoronoiSimplexSolver::UpdateClosestVectorAndPoints()
|
||||
const btVector3& b = m_simplexVectorW[1];
|
||||
const btVector3& c = m_simplexVectorW[2];
|
||||
|
||||
ClosestPtPointTriangle(p,a,b,c,m_cachedBC);
|
||||
closestPtPointTriangle(p,a,b,c,m_cachedBC);
|
||||
m_cachedP1 = m_simplexPointsP[0] * m_cachedBC.m_barycentricCoords[0] +
|
||||
m_simplexPointsP[1] * m_cachedBC.m_barycentricCoords[1] +
|
||||
m_simplexPointsP[2] * m_cachedBC.m_barycentricCoords[2] +
|
||||
@@ -178,8 +178,8 @@ bool btVoronoiSimplexSolver::UpdateClosestVectorAndPoints()
|
||||
|
||||
m_cachedV = m_cachedP1-m_cachedP2;
|
||||
|
||||
ReduceVertices (m_cachedBC.m_usedVertices);
|
||||
m_cachedValidClosest = m_cachedBC.IsValid();
|
||||
reduceVertices (m_cachedBC.m_usedVertices);
|
||||
m_cachedValidClosest = m_cachedBC.isValid();
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ bool btVoronoiSimplexSolver::UpdateClosestVectorAndPoints()
|
||||
const btVector3& c = m_simplexVectorW[2];
|
||||
const btVector3& d = m_simplexVectorW[3];
|
||||
|
||||
bool hasSeperation = ClosestPtPointTetrahedron(p,a,b,c,d,m_cachedBC);
|
||||
bool hasSeperation = closestPtPointTetrahedron(p,a,b,c,d,m_cachedBC);
|
||||
|
||||
if (hasSeperation)
|
||||
{
|
||||
@@ -210,7 +210,7 @@ bool btVoronoiSimplexSolver::UpdateClosestVectorAndPoints()
|
||||
m_simplexPointsQ[3] * m_cachedBC.m_barycentricCoords[3];
|
||||
|
||||
m_cachedV = m_cachedP1-m_cachedP2;
|
||||
ReduceVertices (m_cachedBC.m_usedVertices);
|
||||
reduceVertices (m_cachedBC.m_usedVertices);
|
||||
} else
|
||||
{
|
||||
// printf("sub distance got penetration\n");
|
||||
@@ -227,7 +227,7 @@ bool btVoronoiSimplexSolver::UpdateClosestVectorAndPoints()
|
||||
break;
|
||||
}
|
||||
|
||||
m_cachedValidClosest = m_cachedBC.IsValid();
|
||||
m_cachedValidClosest = m_cachedBC.isValid();
|
||||
|
||||
//closest point origin from tetrahedron
|
||||
break;
|
||||
@@ -246,7 +246,7 @@ bool btVoronoiSimplexSolver::UpdateClosestVectorAndPoints()
|
||||
//return/calculate the closest vertex
|
||||
bool btVoronoiSimplexSolver::closest(btVector3& v)
|
||||
{
|
||||
bool succes = UpdateClosestVectorAndPoints();
|
||||
bool succes = updateClosestVectorAndPoints();
|
||||
v = m_cachedV;
|
||||
return succes;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ bool btVoronoiSimplexSolver::emptySimplex() const
|
||||
|
||||
void btVoronoiSimplexSolver::compute_points(btPoint3& p1, btPoint3& p2)
|
||||
{
|
||||
UpdateClosestVectorAndPoints();
|
||||
updateClosestVectorAndPoints();
|
||||
p1 = m_cachedP1;
|
||||
p2 = m_cachedP2;
|
||||
|
||||
@@ -327,7 +327,7 @@ void btVoronoiSimplexSolver::compute_points(btPoint3& p1, btPoint3& p2)
|
||||
|
||||
|
||||
|
||||
bool btVoronoiSimplexSolver::ClosestPtPointTriangle(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c,btSubSimplexClosestResult& result)
|
||||
bool btVoronoiSimplexSolver::closestPtPointTriangle(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c,btSubSimplexClosestResult& result)
|
||||
{
|
||||
result.m_usedVertices.reset();
|
||||
|
||||
@@ -341,7 +341,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTriangle(const btPoint3& p, const btP
|
||||
{
|
||||
result.m_closestPointOnSimplex = a;
|
||||
result.m_usedVertices.usedVertexA = true;
|
||||
result.SetBarycentricCoordinates(1,0,0);
|
||||
result.setBarycentricCoordinates(1,0,0);
|
||||
return true;// a; // barycentric coordinates (1,0,0)
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTriangle(const btPoint3& p, const btP
|
||||
{
|
||||
result.m_closestPointOnSimplex = b;
|
||||
result.m_usedVertices.usedVertexB = true;
|
||||
result.SetBarycentricCoordinates(0,1,0);
|
||||
result.setBarycentricCoordinates(0,1,0);
|
||||
|
||||
return true; // b; // barycentric coordinates (0,1,0)
|
||||
}
|
||||
@@ -364,7 +364,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTriangle(const btPoint3& p, const btP
|
||||
result.m_closestPointOnSimplex = a + v * ab;
|
||||
result.m_usedVertices.usedVertexA = true;
|
||||
result.m_usedVertices.usedVertexB = true;
|
||||
result.SetBarycentricCoordinates(1-v,v,0);
|
||||
result.setBarycentricCoordinates(1-v,v,0);
|
||||
return true;
|
||||
//return a + v * ab; // barycentric coordinates (1-v,v,0)
|
||||
}
|
||||
@@ -377,7 +377,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTriangle(const btPoint3& p, const btP
|
||||
{
|
||||
result.m_closestPointOnSimplex = c;
|
||||
result.m_usedVertices.usedVertexC = true;
|
||||
result.SetBarycentricCoordinates(0,0,1);
|
||||
result.setBarycentricCoordinates(0,0,1);
|
||||
return true;//c; // barycentric coordinates (0,0,1)
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTriangle(const btPoint3& p, const btP
|
||||
result.m_closestPointOnSimplex = a + w * ac;
|
||||
result.m_usedVertices.usedVertexA = true;
|
||||
result.m_usedVertices.usedVertexC = true;
|
||||
result.SetBarycentricCoordinates(1-w,0,w);
|
||||
result.setBarycentricCoordinates(1-w,0,w);
|
||||
return true;
|
||||
//return a + w * ac; // barycentric coordinates (1-w,0,w)
|
||||
}
|
||||
@@ -401,7 +401,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTriangle(const btPoint3& p, const btP
|
||||
result.m_closestPointOnSimplex = b + w * (c - b);
|
||||
result.m_usedVertices.usedVertexB = true;
|
||||
result.m_usedVertices.usedVertexC = true;
|
||||
result.SetBarycentricCoordinates(0,1-w,w);
|
||||
result.setBarycentricCoordinates(0,1-w,w);
|
||||
return true;
|
||||
// return b + w * (c - b); // barycentric coordinates (0,1-w,w)
|
||||
}
|
||||
@@ -415,7 +415,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTriangle(const btPoint3& p, const btP
|
||||
result.m_usedVertices.usedVertexA = true;
|
||||
result.m_usedVertices.usedVertexB = true;
|
||||
result.m_usedVertices.usedVertexC = true;
|
||||
result.SetBarycentricCoordinates(1-v-w,v,w);
|
||||
result.setBarycentricCoordinates(1-v-w,v,w);
|
||||
|
||||
return true;
|
||||
// return a + ab * v + ac * w; // = u*a + v*b + w*c, u = va * denom = 1.0f - v - w
|
||||
@@ -427,7 +427,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTriangle(const btPoint3& p, const btP
|
||||
|
||||
|
||||
/// Test if point p and d lie on opposite sides of plane through abc
|
||||
int btVoronoiSimplexSolver::PointOutsideOfPlane(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c, const btPoint3& d)
|
||||
int btVoronoiSimplexSolver::pointOutsideOfPlane(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c, const btPoint3& d)
|
||||
{
|
||||
btVector3 normal = (b-a).cross(c-a);
|
||||
|
||||
@@ -446,7 +446,7 @@ int btVoronoiSimplexSolver::PointOutsideOfPlane(const btPoint3& p, const btPoint
|
||||
}
|
||||
|
||||
|
||||
bool btVoronoiSimplexSolver::ClosestPtPointTetrahedron(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c, const btPoint3& d, btSubSimplexClosestResult& finalResult)
|
||||
bool btVoronoiSimplexSolver::closestPtPointTetrahedron(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c, const btPoint3& d, btSubSimplexClosestResult& finalResult)
|
||||
{
|
||||
btSubSimplexClosestResult tempResult;
|
||||
|
||||
@@ -458,10 +458,10 @@ bool btVoronoiSimplexSolver::ClosestPtPointTetrahedron(const btPoint3& p, const
|
||||
finalResult.m_usedVertices.usedVertexC = true;
|
||||
finalResult.m_usedVertices.usedVertexD = true;
|
||||
|
||||
int pointOutsideABC = PointOutsideOfPlane(p, a, b, c, d);
|
||||
int pointOutsideACD = PointOutsideOfPlane(p, a, c, d, b);
|
||||
int pointOutsideADB = PointOutsideOfPlane(p, a, d, b, c);
|
||||
int pointOutsideBDC = PointOutsideOfPlane(p, b, d, c, a);
|
||||
int pointOutsideABC = pointOutsideOfPlane(p, a, b, c, d);
|
||||
int pointOutsideACD = pointOutsideOfPlane(p, a, c, d, b);
|
||||
int pointOutsideADB = pointOutsideOfPlane(p, a, d, b, c);
|
||||
int pointOutsideBDC = pointOutsideOfPlane(p, b, d, c, a);
|
||||
|
||||
if (pointOutsideABC < 0 || pointOutsideACD < 0 || pointOutsideADB < 0 || pointOutsideBDC < 0)
|
||||
{
|
||||
@@ -479,7 +479,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTetrahedron(const btPoint3& p, const
|
||||
// If point outside face abc then compute closest point on abc
|
||||
if (pointOutsideABC)
|
||||
{
|
||||
ClosestPtPointTriangle(p, a, b, c,tempResult);
|
||||
closestPtPointTriangle(p, a, b, c,tempResult);
|
||||
btPoint3 q = tempResult.m_closestPointOnSimplex;
|
||||
|
||||
float sqDist = (q - p).dot( q - p);
|
||||
@@ -492,7 +492,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTetrahedron(const btPoint3& p, const
|
||||
finalResult.m_usedVertices.usedVertexA = tempResult.m_usedVertices.usedVertexA;
|
||||
finalResult.m_usedVertices.usedVertexB = tempResult.m_usedVertices.usedVertexB;
|
||||
finalResult.m_usedVertices.usedVertexC = tempResult.m_usedVertices.usedVertexC;
|
||||
finalResult.SetBarycentricCoordinates(
|
||||
finalResult.setBarycentricCoordinates(
|
||||
tempResult.m_barycentricCoords[VERTA],
|
||||
tempResult.m_barycentricCoords[VERTB],
|
||||
tempResult.m_barycentricCoords[VERTC],
|
||||
@@ -506,7 +506,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTetrahedron(const btPoint3& p, const
|
||||
// Repeat test for face acd
|
||||
if (pointOutsideACD)
|
||||
{
|
||||
ClosestPtPointTriangle(p, a, c, d,tempResult);
|
||||
closestPtPointTriangle(p, a, c, d,tempResult);
|
||||
btPoint3 q = tempResult.m_closestPointOnSimplex;
|
||||
//convert result bitmask!
|
||||
|
||||
@@ -519,7 +519,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTetrahedron(const btPoint3& p, const
|
||||
finalResult.m_usedVertices.usedVertexA = tempResult.m_usedVertices.usedVertexA;
|
||||
finalResult.m_usedVertices.usedVertexC = tempResult.m_usedVertices.usedVertexB;
|
||||
finalResult.m_usedVertices.usedVertexD = tempResult.m_usedVertices.usedVertexC;
|
||||
finalResult.SetBarycentricCoordinates(
|
||||
finalResult.setBarycentricCoordinates(
|
||||
tempResult.m_barycentricCoords[VERTA],
|
||||
0,
|
||||
tempResult.m_barycentricCoords[VERTB],
|
||||
@@ -533,7 +533,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTetrahedron(const btPoint3& p, const
|
||||
|
||||
if (pointOutsideADB)
|
||||
{
|
||||
ClosestPtPointTriangle(p, a, d, b,tempResult);
|
||||
closestPtPointTriangle(p, a, d, b,tempResult);
|
||||
btPoint3 q = tempResult.m_closestPointOnSimplex;
|
||||
//convert result bitmask!
|
||||
|
||||
@@ -546,7 +546,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTetrahedron(const btPoint3& p, const
|
||||
finalResult.m_usedVertices.usedVertexA = tempResult.m_usedVertices.usedVertexA;
|
||||
finalResult.m_usedVertices.usedVertexD = tempResult.m_usedVertices.usedVertexB;
|
||||
finalResult.m_usedVertices.usedVertexB = tempResult.m_usedVertices.usedVertexC;
|
||||
finalResult.SetBarycentricCoordinates(
|
||||
finalResult.setBarycentricCoordinates(
|
||||
tempResult.m_barycentricCoords[VERTA],
|
||||
tempResult.m_barycentricCoords[VERTC],
|
||||
0,
|
||||
@@ -560,7 +560,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTetrahedron(const btPoint3& p, const
|
||||
|
||||
if (pointOutsideBDC)
|
||||
{
|
||||
ClosestPtPointTriangle(p, b, d, c,tempResult);
|
||||
closestPtPointTriangle(p, b, d, c,tempResult);
|
||||
btPoint3 q = tempResult.m_closestPointOnSimplex;
|
||||
//convert result bitmask!
|
||||
float sqDist = (q - p).dot( q - p);
|
||||
@@ -573,7 +573,7 @@ bool btVoronoiSimplexSolver::ClosestPtPointTetrahedron(const btPoint3& p, const
|
||||
finalResult.m_usedVertices.usedVertexD = tempResult.m_usedVertices.usedVertexB;
|
||||
finalResult.m_usedVertices.usedVertexC = tempResult.m_usedVertices.usedVertexC;
|
||||
|
||||
finalResult.SetBarycentricCoordinates(
|
||||
finalResult.setBarycentricCoordinates(
|
||||
0,
|
||||
tempResult.m_barycentricCoords[VERTA],
|
||||
tempResult.m_barycentricCoords[VERTC],
|
||||
|
||||
@@ -58,13 +58,13 @@ struct btSubSimplexClosestResult
|
||||
float m_barycentricCoords[4];
|
||||
bool m_degenerate;
|
||||
|
||||
void Reset()
|
||||
void reset()
|
||||
{
|
||||
m_degenerate = false;
|
||||
SetBarycentricCoordinates();
|
||||
setBarycentricCoordinates();
|
||||
m_usedVertices.reset();
|
||||
}
|
||||
bool IsValid()
|
||||
bool isValid()
|
||||
{
|
||||
bool valid = (m_barycentricCoords[0] >= 0.f) &&
|
||||
(m_barycentricCoords[1] >= 0.f) &&
|
||||
@@ -74,7 +74,7 @@ struct btSubSimplexClosestResult
|
||||
|
||||
return valid;
|
||||
}
|
||||
void SetBarycentricCoordinates(float a=0.f,float b=0.f,float c=0.f,float d=0.f)
|
||||
void setBarycentricCoordinates(float a=0.f,float b=0.f,float c=0.f,float d=0.f)
|
||||
{
|
||||
m_barycentricCoords[0] = a;
|
||||
m_barycentricCoords[1] = b;
|
||||
@@ -113,12 +113,12 @@ public:
|
||||
bool m_needsUpdate;
|
||||
|
||||
void removeVertex(int index);
|
||||
void ReduceVertices (const btUsageBitfield& usedVerts);
|
||||
bool UpdateClosestVectorAndPoints();
|
||||
void reduceVertices (const btUsageBitfield& usedVerts);
|
||||
bool updateClosestVectorAndPoints();
|
||||
|
||||
bool ClosestPtPointTetrahedron(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c, const btPoint3& d, btSubSimplexClosestResult& finalResult);
|
||||
int PointOutsideOfPlane(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c, const btPoint3& d);
|
||||
bool ClosestPtPointTriangle(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c,btSubSimplexClosestResult& result);
|
||||
bool closestPtPointTetrahedron(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c, const btPoint3& d, btSubSimplexClosestResult& finalResult);
|
||||
int pointOutsideOfPlane(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c, const btPoint3& d);
|
||||
bool closestPtPointTriangle(const btPoint3& p, const btPoint3& a, const btPoint3& b, const btPoint3& c,btSubSimplexClosestResult& result);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
|
||||
virtual ~btConstraintSolver() {}
|
||||
|
||||
virtual float SolveGroup(btPersistentManifold** manifold,int numManifolds,const btContactSolverInfo& info,class btIDebugDraw* debugDrawer = 0) = 0;
|
||||
virtual float solveGroup(btPersistentManifold** manifold,int numManifolds,const btContactSolverInfo& info,class btIDebugDraw* debugDrawer = 0) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -100,8 +100,8 @@ float resolveSingleCollision(
|
||||
)
|
||||
{
|
||||
|
||||
const btVector3& pos1 = contactPoint.GetPositionWorldOnA();
|
||||
const btVector3& pos2 = contactPoint.GetPositionWorldOnB();
|
||||
const btVector3& pos1 = contactPoint.getPositionWorldOnA();
|
||||
const btVector3& pos2 = contactPoint.getPositionWorldOnB();
|
||||
|
||||
|
||||
// printf("distance=%f\n",distance);
|
||||
@@ -136,7 +136,7 @@ float resolveSingleCollision(
|
||||
btConstraintPersistentData* cpd = (btConstraintPersistentData*) contactPoint.m_userPersistentData;
|
||||
assert(cpd);
|
||||
|
||||
btScalar distance = cpd->m_penetration;//contactPoint.GetDistance();
|
||||
btScalar distance = cpd->m_penetration;//contactPoint.getDistance();
|
||||
|
||||
|
||||
//distance = 0.f;
|
||||
@@ -174,8 +174,8 @@ float resolveSingleFriction(
|
||||
)
|
||||
{
|
||||
|
||||
const btVector3& pos1 = contactPoint.GetPositionWorldOnA();
|
||||
const btVector3& pos2 = contactPoint.GetPositionWorldOnB();
|
||||
const btVector3& pos1 = contactPoint.getPositionWorldOnA();
|
||||
const btVector3& pos2 = contactPoint.getPositionWorldOnB();
|
||||
|
||||
btVector3 rel_pos1 = pos1 - body1.getCenterOfMassPosition();
|
||||
btVector3 rel_pos2 = pos2 - body2.getCenterOfMassPosition();
|
||||
|
||||
@@ -46,7 +46,7 @@ btGeneric6DofConstraint::btGeneric6DofConstraint(btRigidBody& rbA, btRigidBody&
|
||||
}
|
||||
|
||||
|
||||
void btGeneric6DofConstraint::BuildJacobian()
|
||||
void btGeneric6DofConstraint::buildJacobian()
|
||||
{
|
||||
btVector3 normal(0,0,0);
|
||||
|
||||
@@ -116,7 +116,7 @@ void btGeneric6DofConstraint::BuildJacobian()
|
||||
}
|
||||
}
|
||||
|
||||
void btGeneric6DofConstraint::SolveConstraint(btScalar timeStep)
|
||||
void btGeneric6DofConstraint::solveConstraint(btScalar timeStep)
|
||||
{
|
||||
btScalar tau = 0.1f;
|
||||
btScalar damping = 1.0f;
|
||||
@@ -194,12 +194,12 @@ void btGeneric6DofConstraint::SolveConstraint(btScalar timeStep)
|
||||
}
|
||||
}
|
||||
|
||||
void btGeneric6DofConstraint::UpdateRHS(btScalar timeStep)
|
||||
void btGeneric6DofConstraint::updateRHS(btScalar timeStep)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
btScalar btGeneric6DofConstraint::ComputeAngle(int axis) const
|
||||
btScalar btGeneric6DofConstraint::computeAngle(int axis) const
|
||||
{
|
||||
btScalar angle;
|
||||
|
||||
|
||||
@@ -47,13 +47,13 @@ public:
|
||||
|
||||
btGeneric6DofConstraint();
|
||||
|
||||
virtual void BuildJacobian();
|
||||
virtual void buildJacobian();
|
||||
|
||||
virtual void SolveConstraint(btScalar timeStep);
|
||||
virtual void solveConstraint(btScalar timeStep);
|
||||
|
||||
void UpdateRHS(btScalar timeStep);
|
||||
void updateRHS(btScalar timeStep);
|
||||
|
||||
btScalar ComputeAngle(int axis) const;
|
||||
btScalar computeAngle(int axis) const;
|
||||
|
||||
void setLinearLowerLimit(const btVector3& linearLower)
|
||||
{
|
||||
@@ -99,11 +99,11 @@ public:
|
||||
return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]);
|
||||
}
|
||||
|
||||
const btRigidBody& GetRigidBodyA() const
|
||||
const btRigidBody& getRigidBodyA() const
|
||||
{
|
||||
return m_rbA;
|
||||
}
|
||||
const btRigidBody& GetRigidBodyB() const
|
||||
const btRigidBody& getRigidBodyB() const
|
||||
{
|
||||
return m_rbB;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ m_angularOnly(false)
|
||||
|
||||
}
|
||||
|
||||
void btHingeConstraint::BuildJacobian()
|
||||
void btHingeConstraint::buildJacobian()
|
||||
{
|
||||
m_appliedImpulse = 0.f;
|
||||
|
||||
@@ -74,7 +74,7 @@ void btHingeConstraint::BuildJacobian()
|
||||
//these two jointAxis require equal angular velocities for both bodies
|
||||
|
||||
//this is unused for now, it's a todo
|
||||
btVector3 axisWorldA = GetRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA;
|
||||
btVector3 axisWorldA = getRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA;
|
||||
btVector3 jointAxis0;
|
||||
btVector3 jointAxis1;
|
||||
btPlaneSpace1(axisWorldA,jointAxis0,jointAxis1);
|
||||
@@ -94,7 +94,7 @@ void btHingeConstraint::BuildJacobian()
|
||||
|
||||
}
|
||||
|
||||
void btHingeConstraint::SolveConstraint(btScalar timeStep)
|
||||
void btHingeConstraint::solveConstraint(btScalar timeStep)
|
||||
{
|
||||
//#define NEW_IMPLEMENTATION
|
||||
|
||||
@@ -150,8 +150,8 @@ void btHingeConstraint::SolveConstraint(btScalar timeStep)
|
||||
///solve angular part
|
||||
|
||||
// get axes in world space
|
||||
btVector3 axisA = GetRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA;
|
||||
btVector3 axisB = GetRigidBodyB().getCenterOfMassTransform().getBasis() * m_axisInB;
|
||||
btVector3 axisA = getRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA;
|
||||
btVector3 axisB = getRigidBodyB().getCenterOfMassTransform().getBasis() * m_axisInB;
|
||||
|
||||
// constraint axes in world space
|
||||
btVector3 jointAxis0;
|
||||
@@ -230,11 +230,11 @@ void btHingeConstraint::SolveConstraint(btScalar timeStep)
|
||||
///solve angular part
|
||||
|
||||
// get axes in world space
|
||||
btVector3 axisA = GetRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA;
|
||||
btVector3 axisB = GetRigidBodyB().getCenterOfMassTransform().getBasis() * m_axisInB;
|
||||
btVector3 axisA = getRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA;
|
||||
btVector3 axisB = getRigidBodyB().getCenterOfMassTransform().getBasis() * m_axisInB;
|
||||
|
||||
const btVector3& angVelA = GetRigidBodyA().getAngularVelocity();
|
||||
const btVector3& angVelB = GetRigidBodyB().getAngularVelocity();
|
||||
const btVector3& angVelA = getRigidBodyA().getAngularVelocity();
|
||||
const btVector3& angVelB = getRigidBodyB().getAngularVelocity();
|
||||
btVector3 angA = angVelA - axisA * axisA.dot(angVelA);
|
||||
btVector3 angB = angVelB - axisB * axisB.dot(angVelB);
|
||||
btVector3 velrel = angA-angB;
|
||||
@@ -245,8 +245,8 @@ void btHingeConstraint::SolveConstraint(btScalar timeStep)
|
||||
if (len > 0.00001f)
|
||||
{
|
||||
btVector3 normal = velrel.normalized();
|
||||
float denom = GetRigidBodyA().ComputeAngularImpulseDenominator(normal) +
|
||||
GetRigidBodyB().ComputeAngularImpulseDenominator(normal);
|
||||
float denom = getRigidBodyA().computeAngularImpulseDenominator(normal) +
|
||||
getRigidBodyB().computeAngularImpulseDenominator(normal);
|
||||
// scale for mass and relaxation
|
||||
velrel *= (1.f/denom) * 0.9;
|
||||
}
|
||||
@@ -257,8 +257,8 @@ void btHingeConstraint::SolveConstraint(btScalar timeStep)
|
||||
if (len2>0.00001f)
|
||||
{
|
||||
btVector3 normal2 = angularError.normalized();
|
||||
float denom2 = GetRigidBodyA().ComputeAngularImpulseDenominator(normal2) +
|
||||
GetRigidBodyB().ComputeAngularImpulseDenominator(normal2);
|
||||
float denom2 = getRigidBodyA().computeAngularImpulseDenominator(normal2) +
|
||||
getRigidBodyB().computeAngularImpulseDenominator(normal2);
|
||||
angularError *= (1.f/denom2) * relaxation;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ void btHingeConstraint::SolveConstraint(btScalar timeStep)
|
||||
|
||||
}
|
||||
|
||||
void btHingeConstraint::UpdateRHS(btScalar timeStep)
|
||||
void btHingeConstraint::updateRHS(btScalar timeStep)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -46,17 +46,17 @@ public:
|
||||
|
||||
btHingeConstraint();
|
||||
|
||||
virtual void BuildJacobian();
|
||||
virtual void buildJacobian();
|
||||
|
||||
virtual void SolveConstraint(btScalar timeStep);
|
||||
virtual void solveConstraint(btScalar timeStep);
|
||||
|
||||
void UpdateRHS(btScalar timeStep);
|
||||
void updateRHS(btScalar timeStep);
|
||||
|
||||
const btRigidBody& GetRigidBodyA() const
|
||||
const btRigidBody& getRigidBodyA() const
|
||||
{
|
||||
return m_rbA;
|
||||
}
|
||||
const btRigidBody& GetRigidBodyB() const
|
||||
const btRigidBody& getRigidBodyB() const
|
||||
{
|
||||
return m_rbB;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ btPoint2PointConstraint::btPoint2PointConstraint(btRigidBody& rbA,const btVector
|
||||
|
||||
}
|
||||
|
||||
void btPoint2PointConstraint::BuildJacobian()
|
||||
void btPoint2PointConstraint::buildJacobian()
|
||||
{
|
||||
m_appliedImpulse = 0.f;
|
||||
|
||||
@@ -62,7 +62,7 @@ void btPoint2PointConstraint::BuildJacobian()
|
||||
|
||||
}
|
||||
|
||||
void btPoint2PointConstraint::SolveConstraint(btScalar timeStep)
|
||||
void btPoint2PointConstraint::solveConstraint(btScalar timeStep)
|
||||
{
|
||||
btVector3 pivotAInW = m_rbA.getCenterOfMassTransform()*m_pivotInA;
|
||||
btVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_pivotInB;
|
||||
@@ -109,7 +109,7 @@ void btPoint2PointConstraint::SolveConstraint(btScalar timeStep)
|
||||
}
|
||||
}
|
||||
|
||||
void btPoint2PointConstraint::UpdateRHS(btScalar timeStep)
|
||||
void btPoint2PointConstraint::updateRHS(btScalar timeStep)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user