some pair management changes, allow to choose pair cache at run-time.
This commit is contained in:
@@ -227,7 +227,7 @@ m_invalidPair(0)
|
|||||||
if (!m_pairCache)
|
if (!m_pairCache)
|
||||||
{
|
{
|
||||||
void* ptr = btAlignedAlloc(sizeof(btOverlappingPairCache),16);
|
void* ptr = btAlignedAlloc(sizeof(btOverlappingPairCache),16);
|
||||||
m_pairCache = new(ptr) btOverlappingPairCache();
|
m_pairCache = new(ptr) btHashedOverlappingPairCache();
|
||||||
m_ownsPairCache = true;
|
m_ownsPairCache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ m_invalidPair(0)
|
|||||||
{
|
{
|
||||||
m_ownsPairCache = true;
|
m_ownsPairCache = true;
|
||||||
void* mem = btAlignedAlloc(sizeof(btOverlappingPairCache),16);
|
void* mem = btAlignedAlloc(sizeof(btOverlappingPairCache),16);
|
||||||
m_overlappingPairs = new (mem)btOverlappingPairCache();
|
m_overlappingPairs = new (mem)btHashedOverlappingPairCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct btMultiSapOverlapFilterCallback : public btOverlapFilterCallback
|
struct btMultiSapOverlapFilterCallback : public btOverlapFilterCallback
|
||||||
|
|||||||
@@ -27,24 +27,51 @@ int gRemovePairs =0;
|
|||||||
int gAddedPairs =0;
|
int gAddedPairs =0;
|
||||||
int gFindPairs =0;
|
int gFindPairs =0;
|
||||||
|
|
||||||
btOverlappingPairCache::btOverlappingPairCache():
|
|
||||||
|
|
||||||
|
|
||||||
|
btHashedOverlappingPairCache::btHashedOverlappingPairCache():
|
||||||
m_overlapFilterCallback(0),
|
m_overlapFilterCallback(0),
|
||||||
m_blockedForChanges(false)
|
m_blockedForChanges(false)
|
||||||
{
|
{
|
||||||
int initialAllocatedSize= 2;
|
int initialAllocatedSize= 2;
|
||||||
m_overlappingPairArray.reserve(initialAllocatedSize);
|
m_overlappingPairArray.reserve(initialAllocatedSize);
|
||||||
#ifdef USE_HASH_PAIRCACHE
|
|
||||||
growTables();
|
growTables();
|
||||||
#endif //USE_HASH_PAIRCACHE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
btOverlappingPairCache::~btOverlappingPairCache()
|
btSortedOverlappingPairCache::btSortedOverlappingPairCache():
|
||||||
|
m_overlapFilterCallback(0),
|
||||||
|
m_blockedForChanges(false)
|
||||||
|
{
|
||||||
|
int initialAllocatedSize= 2;
|
||||||
|
m_overlappingPairArray.reserve(initialAllocatedSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
btHashedOverlappingPairCache::~btHashedOverlappingPairCache()
|
||||||
{
|
{
|
||||||
//todo/test: show we erase/delete data, or is it automatic
|
//todo/test: show we erase/delete data, or is it automatic
|
||||||
}
|
}
|
||||||
|
|
||||||
void btOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair,btDispatcher* dispatcher)
|
btSortedOverlappingPairCache::~btSortedOverlappingPairCache()
|
||||||
|
{
|
||||||
|
//todo/test: show we erase/delete data, or is it automatic
|
||||||
|
}
|
||||||
|
|
||||||
|
void btHashedOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair,btDispatcher* dispatcher)
|
||||||
|
{
|
||||||
|
if (pair.m_algorithm)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
pair.m_algorithm->~btCollisionAlgorithm();
|
||||||
|
dispatcher->freeCollisionAlgorithm(pair.m_algorithm);
|
||||||
|
pair.m_algorithm=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void btSortedOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair,btDispatcher* dispatcher)
|
||||||
{
|
{
|
||||||
if (pair.m_algorithm)
|
if (pair.m_algorithm)
|
||||||
{
|
{
|
||||||
@@ -57,7 +84,7 @@ void btOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair,btDispa
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void btOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
|
void btHashedOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
|
||||||
{
|
{
|
||||||
|
|
||||||
class CleanPairCallback : public btOverlapCallback
|
class CleanPairCallback : public btOverlapCallback
|
||||||
@@ -91,7 +118,42 @@ void btOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy,btDisp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void btOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
|
|
||||||
|
void btSortedOverlappingPairCache::cleanProxyFromPairs(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
|
||||||
|
{
|
||||||
|
|
||||||
|
class CleanPairCallback : public btOverlapCallback
|
||||||
|
{
|
||||||
|
btBroadphaseProxy* m_cleanProxy;
|
||||||
|
btOverlappingPairCache* m_pairCache;
|
||||||
|
btDispatcher* m_dispatcher;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CleanPairCallback(btBroadphaseProxy* cleanProxy,btOverlappingPairCache* pairCache,btDispatcher* dispatcher)
|
||||||
|
:m_cleanProxy(cleanProxy),
|
||||||
|
m_pairCache(pairCache),
|
||||||
|
m_dispatcher(dispatcher)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual bool processOverlap(btBroadphasePair& pair)
|
||||||
|
{
|
||||||
|
if ((pair.m_pProxy0 == m_cleanProxy) ||
|
||||||
|
(pair.m_pProxy1 == m_cleanProxy))
|
||||||
|
{
|
||||||
|
m_pairCache->cleanOverlappingPair(pair,m_dispatcher);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
CleanPairCallback cleanPairs(proxy,this,dispatcher);
|
||||||
|
|
||||||
|
processAllOverlappingPairs(&cleanPairs,dispatcher);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void btHashedOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
|
||||||
{
|
{
|
||||||
|
|
||||||
class RemovePairCallback : public btOverlapCallback
|
class RemovePairCallback : public btOverlapCallback
|
||||||
@@ -118,15 +180,34 @@ void btOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseP
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_HASH_PAIRCACHE
|
void btSortedOverlappingPairCache::removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)
|
||||||
|
{
|
||||||
|
|
||||||
|
class RemovePairCallback : public btOverlapCallback
|
||||||
|
{
|
||||||
|
btBroadphaseProxy* m_obsoleteProxy;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RemovePairCallback(btBroadphaseProxy* obsoleteProxy)
|
||||||
|
:m_obsoleteProxy(obsoleteProxy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual bool processOverlap(btBroadphasePair& pair)
|
||||||
|
{
|
||||||
|
return ((pair.m_pProxy0 == m_obsoleteProxy) ||
|
||||||
|
(pair.m_pProxy1 == m_obsoleteProxy));
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
RemovePairCallback removeCallback(proxy);
|
||||||
|
|
||||||
|
processAllOverlappingPairs(&removeCallback,dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
btBroadphasePair* btHashedOverlappingPairCache::findPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
|
||||||
|
|
||||||
|
|
||||||
btBroadphasePair* btOverlappingPairCache::findPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
|
|
||||||
{
|
{
|
||||||
gFindPairs++;
|
gFindPairs++;
|
||||||
|
|
||||||
@@ -161,7 +242,7 @@ btBroadphasePair* btOverlappingPairCache::findPair(btBroadphaseProxy* proxy0, bt
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void btOverlappingPairCache::growTables()
|
void btHashedOverlappingPairCache::growTables()
|
||||||
{
|
{
|
||||||
|
|
||||||
int newCapacity = m_overlappingPairArray.capacity();
|
int newCapacity = m_overlappingPairArray.capacity();
|
||||||
@@ -203,7 +284,7 @@ void btOverlappingPairCache::growTables()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
btBroadphasePair* btOverlappingPairCache::internalAddPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
|
btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
|
||||||
{
|
{
|
||||||
int proxyId1 = proxy0->getUid();
|
int proxyId1 = proxy0->getUid();
|
||||||
int proxyId2 = proxy1->getUid();
|
int proxyId2 = proxy1->getUid();
|
||||||
@@ -248,7 +329,7 @@ btBroadphasePair* btOverlappingPairCache::internalAddPair(btBroadphaseProxy* pro
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void* btOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1,btDispatcher* dispatcher)
|
void* btHashedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1,btDispatcher* dispatcher)
|
||||||
{
|
{
|
||||||
gRemovePairs++;
|
gRemovePairs++;
|
||||||
|
|
||||||
@@ -347,7 +428,7 @@ void* btOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0, b
|
|||||||
}
|
}
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void btOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callback,btDispatcher* dispatcher)
|
void btHashedOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callback,btDispatcher* dispatcher)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@@ -369,12 +450,9 @@ void btOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
|
|
||||||
|
void* btSortedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1, btDispatcher* dispatcher )
|
||||||
|
|
||||||
void* btOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1, btDispatcher* dispatcher )
|
|
||||||
{
|
{
|
||||||
#ifndef USE_LAZY_REMOVAL
|
#ifndef USE_LAZY_REMOVAL
|
||||||
|
|
||||||
@@ -404,7 +482,7 @@ void* btOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* proxy0,bt
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
btBroadphasePair* btOverlappingPairCache::addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
btBroadphasePair* btSortedOverlappingPairCache::addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
||||||
{
|
{
|
||||||
//don't add overlap with own
|
//don't add overlap with own
|
||||||
assert(proxy0 != proxy1);
|
assert(proxy0 != proxy1);
|
||||||
@@ -423,7 +501,7 @@ btBroadphasePair* btOverlappingPairCache::addOverlappingPair(btBroadphaseProxy*
|
|||||||
///use a different solution. It is mainly used for Removing overlapping pairs. Removal could be delayed.
|
///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)
|
///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
|
///Also we can use a 2D bitmap, which can be useful for a future GPU implementation
|
||||||
btBroadphasePair* btOverlappingPairCache::findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
btBroadphasePair* btSortedOverlappingPairCache::findPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
||||||
{
|
{
|
||||||
if (!needsBroadphaseCollision(proxy0,proxy1))
|
if (!needsBroadphaseCollision(proxy0,proxy1))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -451,7 +529,7 @@ btBroadphasePair* btOverlappingPairCache::addOverlappingPair(btBroadphaseProxy*
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void btOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callback,btDispatcher* dispatcher)
|
void btSortedOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callback,btDispatcher* dispatcher)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@@ -476,4 +554,3 @@ void btOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback* callb
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //USE_HASH_PAIRCACHE
|
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
#include "btBroadphaseInterface.h"
|
#include "btBroadphaseInterface.h"
|
||||||
#include "btBroadphaseProxy.h"
|
#include "btBroadphaseProxy.h"
|
||||||
|
#include "btOverlappingPairCallback.h"
|
||||||
|
|
||||||
#include "LinearMath/btPoint3.h"
|
#include "LinearMath/btPoint3.h"
|
||||||
#include "LinearMath/btAlignedObjectArray.h"
|
#include "LinearMath/btAlignedObjectArray.h"
|
||||||
class btDispatcher;
|
class btDispatcher;
|
||||||
|
|
||||||
///disable the USE_HASH_PAIRCACHE define to use a pair manager that sorts the pairs to find duplicates/non-overlap
|
typedef btAlignedObjectArray<btBroadphasePair> btBroadphasePairArray;
|
||||||
#define USE_HASH_PAIRCACHE 1
|
|
||||||
|
|
||||||
|
|
||||||
struct btOverlapCallback
|
struct btOverlapCallback
|
||||||
{
|
{
|
||||||
@@ -34,6 +34,7 @@ struct btOverlapCallback
|
|||||||
{}
|
{}
|
||||||
//return true for deletion of the pair
|
//return true for deletion of the pair
|
||||||
virtual bool processOverlap(btBroadphasePair& pair) = 0;
|
virtual bool processOverlap(btBroadphasePair& pair) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct btOverlapFilterCallback
|
struct btOverlapFilterCallback
|
||||||
@@ -44,9 +45,9 @@ struct btOverlapFilterCallback
|
|||||||
virtual bool needBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const = 0;
|
virtual bool needBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef btAlignedObjectArray<btBroadphasePair> btBroadphasePairArray;
|
|
||||||
|
|
||||||
#ifdef USE_HASH_PAIRCACHE
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.box2d.org, and Pierre Terdiman, Codercorner, http://codercorner.com
|
/// Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.box2d.org, and Pierre Terdiman, Codercorner, http://codercorner.com
|
||||||
@@ -57,7 +58,31 @@ extern int gFindPairs;
|
|||||||
|
|
||||||
const int BT_NULL_PAIR=0xffffffff;
|
const int BT_NULL_PAIR=0xffffffff;
|
||||||
|
|
||||||
class btOverlappingPairCache
|
class btOverlappingPairCache : public btOverlappingPairCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual btBroadphasePair* getOverlappingPairArrayPtr() = 0;
|
||||||
|
|
||||||
|
virtual const btBroadphasePair* getOverlappingPairArrayPtr() const = 0;
|
||||||
|
|
||||||
|
virtual btBroadphasePairArray& getOverlappingPairArray() = 0;
|
||||||
|
|
||||||
|
virtual void cleanOverlappingPair(btBroadphasePair& pair,btDispatcher* dispatcher) = 0;
|
||||||
|
|
||||||
|
virtual int getNumOverlappingPairs() const = 0;
|
||||||
|
|
||||||
|
virtual void cleanProxyFromPairs(btBroadphaseProxy* proxy,btDispatcher* dispatcher) = 0;
|
||||||
|
|
||||||
|
virtual void setOverlapFilterCallback(btOverlapFilterCallback* callback) = 0;
|
||||||
|
|
||||||
|
virtual void processAllOverlappingPairs(btOverlapCallback*,btDispatcher* dispatcher) = 0;
|
||||||
|
|
||||||
|
virtual btBroadphasePair* findPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class btHashedOverlappingPairCache : public btOverlappingPairCache
|
||||||
{
|
{
|
||||||
btBroadphasePairArray m_overlappingPairArray;
|
btBroadphasePairArray m_overlappingPairArray;
|
||||||
btOverlapFilterCallback* m_overlapFilterCallback;
|
btOverlapFilterCallback* m_overlapFilterCallback;
|
||||||
@@ -65,13 +90,13 @@ class btOverlappingPairCache
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
btOverlappingPairCache();
|
btHashedOverlappingPairCache();
|
||||||
virtual ~btOverlappingPairCache();
|
virtual ~btHashedOverlappingPairCache();
|
||||||
|
|
||||||
|
|
||||||
void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
|
void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
|
||||||
|
|
||||||
void* removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,btDispatcher* dispatcher);
|
virtual void* removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,btDispatcher* dispatcher);
|
||||||
|
|
||||||
SIMD_FORCE_INLINE bool needsBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const
|
SIMD_FORCE_INLINE bool needsBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const
|
||||||
{
|
{
|
||||||
@@ -86,7 +111,7 @@ public:
|
|||||||
|
|
||||||
// Add a pair and return the new pair. If the pair already exists,
|
// Add a pair and return the new pair. If the pair already exists,
|
||||||
// no new pair is created and the old one is returned.
|
// no new pair is created and the old one is returned.
|
||||||
SIMD_FORCE_INLINE btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1)
|
||||||
{
|
{
|
||||||
gAddedPairs++;
|
gAddedPairs++;
|
||||||
|
|
||||||
@@ -103,7 +128,7 @@ public:
|
|||||||
|
|
||||||
virtual void processAllOverlappingPairs(btOverlapCallback*,btDispatcher* dispatcher);
|
virtual void processAllOverlappingPairs(btOverlapCallback*,btDispatcher* dispatcher);
|
||||||
|
|
||||||
btBroadphasePair* getOverlappingPairArrayPtr()
|
virtual btBroadphasePair* getOverlappingPairArrayPtr()
|
||||||
{
|
{
|
||||||
return &m_overlappingPairArray[0];
|
return &m_overlappingPairArray[0];
|
||||||
}
|
}
|
||||||
@@ -227,13 +252,13 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else//USE_HASH_PAIRCACHE
|
|
||||||
|
|
||||||
#define USE_LAZY_REMOVAL 1
|
#define USE_LAZY_REMOVAL 1
|
||||||
|
|
||||||
///btOverlappingPairCache maintains the objects with overlapping AABB
|
///btOverlappingPairCache maintains the objects with overlapping AABB
|
||||||
///Typically managed by the Broadphase, Axis3Sweep or btSimpleBroadphase
|
///Typically managed by the Broadphase, Axis3Sweep or btSimpleBroadphase
|
||||||
class btOverlappingPairCache
|
class btSortedOverlappingPairCache : public btOverlappingPairCache
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
//avoid brute-force finding all the time
|
//avoid brute-force finding all the time
|
||||||
@@ -247,8 +272,8 @@ class btOverlappingPairCache
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
btOverlappingPairCache();
|
btSortedOverlappingPairCache();
|
||||||
virtual ~btOverlappingPairCache();
|
virtual ~btSortedOverlappingPairCache();
|
||||||
|
|
||||||
virtual void processAllOverlappingPairs(btOverlapCallback*,btDispatcher* dispatcher);
|
virtual void processAllOverlappingPairs(btOverlapCallback*,btDispatcher* dispatcher);
|
||||||
|
|
||||||
@@ -316,7 +341,6 @@ class btOverlappingPairCache
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif //USE_HASH_PAIRCACHE
|
|
||||||
|
|
||||||
#endif //OVERLAPPING_PAIR_CACHE_H
|
#endif //OVERLAPPING_PAIR_CACHE_H
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ subject to the following restrictions:
|
|||||||
#ifndef OVERLAPPING_PAIR_CALLBACK_H
|
#ifndef OVERLAPPING_PAIR_CALLBACK_H
|
||||||
#define OVERLAPPING_PAIR_CALLBACK_H
|
#define OVERLAPPING_PAIR_CALLBACK_H
|
||||||
|
|
||||||
|
class btDispatcher;
|
||||||
|
struct btBroadphasePair;
|
||||||
|
|
||||||
///btOverlappingPairCallback provides user callback to keep track of overlap between objects, like a collision sensor
|
///btOverlappingPairCallback provides user callback to keep track of overlap between objects, like a collision sensor
|
||||||
class btOverlappingPairCallback
|
class btOverlappingPairCallback
|
||||||
{
|
{
|
||||||
@@ -26,11 +29,11 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) = 0;
|
virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) = 0;
|
||||||
|
|
||||||
virtual void removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) = 0;
|
virtual void* removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,btDispatcher* dispatcher) = 0;
|
||||||
|
|
||||||
virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy0) = 0;
|
virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy0,btDispatcher* dispatcher) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ btSimpleBroadphase::btSimpleBroadphase(int maxProxies, btOverlappingPairCache* o
|
|||||||
if (!overlappingPairCache)
|
if (!overlappingPairCache)
|
||||||
{
|
{
|
||||||
void* mem = btAlignedAlloc(sizeof(btOverlappingPairCache),16);
|
void* mem = btAlignedAlloc(sizeof(btOverlappingPairCache),16);
|
||||||
m_pairCache = new (mem)btOverlappingPairCache();
|
m_pairCache = new (mem)btHashedOverlappingPairCache();
|
||||||
m_ownsPairCache = true;
|
m_ownsPairCache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user