Added btDbvtBroadphase::setAabbForceUpdate to always update the aabb (skip optimizations), to address this issue (helps with occlusion culling)
///http://code.google.com/p/bullet/issues/detail?id=223 Also added a few missing 'virtual' keywords (the functions were virtual already because of the base class)
This commit is contained in:
@@ -251,6 +251,7 @@ void btDbvtBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
void btDbvtBroadphase::setAabb( btBroadphaseProxy* absproxy,
|
void btDbvtBroadphase::setAabb( btBroadphaseProxy* absproxy,
|
||||||
const btVector3& aabbMin,
|
const btVector3& aabbMin,
|
||||||
@@ -318,6 +319,47 @@ void btDbvtBroadphase::setAabb( btBroadphaseProxy* absproxy,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
void btDbvtBroadphase::setAabbForceUpdate( btBroadphaseProxy* absproxy,
|
||||||
|
const btVector3& aabbMin,
|
||||||
|
const btVector3& aabbMax,
|
||||||
|
btDispatcher* /*dispatcher*/)
|
||||||
|
{
|
||||||
|
btDbvtProxy* proxy=(btDbvtProxy*)absproxy;
|
||||||
|
ATTRIBUTE_ALIGNED16(btDbvtVolume) aabb=btDbvtVolume::FromMM(aabbMin,aabbMax);
|
||||||
|
bool docollide=false;
|
||||||
|
if(proxy->stage==STAGECOUNT)
|
||||||
|
{/* fixed -> dynamic set */
|
||||||
|
m_sets[1].remove(proxy->leaf);
|
||||||
|
proxy->leaf=m_sets[0].insert(aabb,proxy);
|
||||||
|
docollide=true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{/* dynamic set */
|
||||||
|
++m_updates_call;
|
||||||
|
/* Teleporting */
|
||||||
|
m_sets[0].update(proxy->leaf,aabb);
|
||||||
|
++m_updates_done;
|
||||||
|
docollide=true;
|
||||||
|
}
|
||||||
|
listremove(proxy,m_stageRoots[proxy->stage]);
|
||||||
|
proxy->m_aabbMin = aabbMin;
|
||||||
|
proxy->m_aabbMax = aabbMax;
|
||||||
|
proxy->stage = m_stageCurrent;
|
||||||
|
listappend(proxy,m_stageRoots[m_stageCurrent]);
|
||||||
|
if(docollide)
|
||||||
|
{
|
||||||
|
m_needcleanup=true;
|
||||||
|
if(!m_deferedcollide)
|
||||||
|
{
|
||||||
|
btDbvtTreeCollider collider(this);
|
||||||
|
m_sets[1].collideTTpersistentStack(m_sets[1].m_root,proxy->leaf,collider);
|
||||||
|
m_sets[0].collideTTpersistentStack(m_sets[0].m_root,proxy->leaf,collider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void btDbvtBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
|
void btDbvtBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -102,19 +102,25 @@ struct btDbvtBroadphase : btBroadphaseInterface
|
|||||||
~btDbvtBroadphase();
|
~btDbvtBroadphase();
|
||||||
void collide(btDispatcher* dispatcher);
|
void collide(btDispatcher* dispatcher);
|
||||||
void optimize();
|
void optimize();
|
||||||
|
|
||||||
/* btBroadphaseInterface Implementation */
|
/* btBroadphaseInterface Implementation */
|
||||||
btBroadphaseProxy* createProxy(const btVector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy);
|
btBroadphaseProxy* createProxy(const btVector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy);
|
||||||
void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
|
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
|
||||||
void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher);
|
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher);
|
||||||
virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0));
|
virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0));
|
||||||
|
|
||||||
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
|
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
|
||||||
void calculateOverlappingPairs(btDispatcher* dispatcher);
|
virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
|
||||||
btOverlappingPairCache* getOverlappingPairCache();
|
virtual btOverlappingPairCache* getOverlappingPairCache();
|
||||||
const btOverlappingPairCache* getOverlappingPairCache() const;
|
virtual const btOverlappingPairCache* getOverlappingPairCache() const;
|
||||||
void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const;
|
virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const;
|
||||||
void printStats();
|
virtual void printStats();
|
||||||
static void benchmark(btBroadphaseInterface*);
|
|
||||||
|
|
||||||
|
///reset broadphase internal structures, to ensure determinism/reproducability
|
||||||
|
virtual void resetPool(btDispatcher* dispatcher);
|
||||||
|
|
||||||
|
void performDeferredRemoval(btDispatcher* dispatcher);
|
||||||
|
|
||||||
void setVelocityPrediction(btScalar prediction)
|
void setVelocityPrediction(btScalar prediction)
|
||||||
{
|
{
|
||||||
@@ -125,10 +131,14 @@ struct btDbvtBroadphase : btBroadphaseInterface
|
|||||||
return m_prediction;
|
return m_prediction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void performDeferredRemoval(btDispatcher* dispatcher);
|
///this setAabbForceUpdate is similar to setAabb but always forces the aabb update.
|
||||||
|
///it is not part of the btBroadphaseInterface but specific to btDbvtBroadphase.
|
||||||
|
///it bypasses certain optimizations that prevent aabb updates (when the aabb shrinks), see
|
||||||
|
///http://code.google.com/p/bullet/issues/detail?id=223
|
||||||
|
void setAabbForceUpdate( btBroadphaseProxy* absproxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* /*dispatcher*/);
|
||||||
|
|
||||||
|
static void benchmark(btBroadphaseInterface*);
|
||||||
|
|
||||||
///reset broadphase internal structures, to ensure determinism/reproducability
|
|
||||||
virtual void resetPool(btDispatcher* dispatcher);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user