Make raycast benchmark default, to show improved raycasting performance.
Add rayTest to btBroadphaseInterface, and implement efficient version for btDbvtBroadphase to accelerate raycasting. btAxisSweep3, btSimpleBroadphase and btMultiSapBroadphase implement brute-force method (as before). For now, it is recommended to use btDbvtBroadphase for fastest world raycast.
This commit is contained in:
@@ -210,6 +210,37 @@ void btDbvtBroadphase::getAabb(btBroadphaseProxy* absproxy,btVector3& aabbMin, b
|
||||
aabbMax = proxy->m_aabbMax;
|
||||
}
|
||||
|
||||
void btDbvtBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback)
|
||||
{
|
||||
|
||||
struct BroadphaseRayTester : btDbvt::ICollide
|
||||
{
|
||||
btBroadphaseRayCallback& m_rayCallback;
|
||||
BroadphaseRayTester(btBroadphaseRayCallback& orgCallback)
|
||||
:m_rayCallback(orgCallback)
|
||||
{
|
||||
}
|
||||
void Process(const btDbvtNode* leaf)
|
||||
{
|
||||
btDbvtProxy* proxy=(btDbvtProxy*)leaf->data;
|
||||
m_rayCallback.process(proxy);
|
||||
}
|
||||
};
|
||||
|
||||
BroadphaseRayTester callback(rayCallback);
|
||||
|
||||
m_sets[0].collideRAY( m_sets[0].m_root,
|
||||
rayFrom,
|
||||
rayTo,
|
||||
callback);
|
||||
|
||||
m_sets[1].collideRAY( m_sets[1].m_root,
|
||||
rayFrom,
|
||||
rayTo,
|
||||
callback);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
void btDbvtBroadphase::setAabb( btBroadphaseProxy* absproxy,
|
||||
const btVector3& aabbMin,
|
||||
|
||||
Reference in New Issue
Block a user