diff --git a/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h b/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h index 3ddacd7cf..cce1e6c37 100644 --- a/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h +++ b/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h @@ -21,7 +21,6 @@ subject to the following restrictions: struct btDispatcherInfo; class btDispatcher; #include "btBroadphaseProxy.h" -#include "LinearMath/btAabbUtil2.h"//for fast ray-slope algorithm class btOverlappingPairCache; @@ -30,10 +29,6 @@ class btOverlappingPairCache; struct btBroadphaseRayCallback { ///added some cached data to accelerate ray-AABB tests - ///m_ray is used to accerate ray-AABB tests, see btDbvt.h, when TEST_RAY_SLOPES is enabled in LinearMath/btAabbUtil2.h - btRaySlope m_ray; - - ///otherwise this data is used to accelerate ray-AABB tests btVector3 m_rayDirectionInverse; unsigned int m_signs[3]; btScalar m_lambda_max; diff --git a/src/BulletCollision/BroadphaseCollision/btDbvt.h b/src/BulletCollision/BroadphaseCollision/btDbvt.h index a7f8869a3..ae765e32e 100644 --- a/src/BulletCollision/BroadphaseCollision/btDbvt.h +++ b/src/BulletCollision/BroadphaseCollision/btDbvt.h @@ -333,7 +333,6 @@ struct btDbvt const btVector3& rayDirectionInverse, unsigned int signs[3], btScalar lambda_max, - const btRaySlope& raySlope, DBVT_IPOLICY) const; DBVT_PREFIX @@ -872,7 +871,6 @@ inline void btDbvt::rayTestInternal( const btDbvtNode* root, const btVector3& rayDirectionInverse, unsigned int signs[3], btScalar lambda_max, - const btRaySlope& raySlope, DBVT_IPOLICY) const { DBVT_CHECKTYPE @@ -889,66 +887,11 @@ inline void btDbvt::rayTestInternal( const btDbvtNode* root, do { const btDbvtNode* node=m_stack[--depth]; - //m_stack.pop_back(); - bounds[0] = node->volume.Mins(); bounds[1] = node->volume.Maxs(); - btScalar tmin=1.f,lambda_min=0.f; unsigned int result1=false; - -/// A comparison test for ray-AABB test: -/// "Fast Ray/Axis-Aligned Bounding Box Overlap Tests using Ray Slopes" -/// http://jgt.akpeters.com/papers/EisemannEtAl07/ -/// The algorithm seems indeed a bit faster, but the code complexity doesn't make it attractive for future optimizations. -/// -/// Enable/disable #define TEST_RAY_SLOPES in btBroadphaseInterface.h -/// -#ifndef TEST_RAY_SLOPES result1 = btRayAabb2(rayFrom,rayDirectionInverse,signs,bounds,tmin,lambda_min,lambda_max); -#else - btScalar t=1.f; - btAaboxSlope aabbSlope; - aabbSlope.x0 = node->volume.Mins().getX(); - aabbSlope.y0 = node->volume.Mins().getY(); - aabbSlope.z0 = node->volume.Mins().getZ(); - - aabbSlope.x1 = node->volume.Maxs().getX(); - aabbSlope.y1 = node->volume.Maxs().getY(); - aabbSlope.z1 = node->volume.Maxs().getZ(); - - - //ray starts or ends within AABB - -// if (!result1) -// if (TestPointAgainstAabb2(node->volume.Mins(),node->volume.Maxs(),rayTo)) -// result1=true; -// if (!result1) - - result1 = btRaySlopeAabb(&raySlope,&aabbSlope,&t); - - if (result1) - { - //if fromRay is inside the AABB, t can still be negative, so we need an additional check. - if (t>1.0) - continue; - - if (t<0.) - { - if (!TestPointAgainstAabb2(node->volume.Mins(),node->volume.Maxs(),rayFrom)) - continue; - } - } -#endif //USE_ORIGINAL_RAY_AABB - - #ifdef COMPARE_BTRAY_AABB2//slower version using in/outcodes - btScalar param=1.f; - bool result2 = btRayAabb(rayFrom,rayTo,node->volume.Mins(),node->volume.Maxs(),param,resultNormal); - btAssert(result1 == result2); - #endif //TEST_BTRAY_AABB2 - - - if(result1) { if(node->isinternal()) @@ -1004,7 +947,6 @@ inline void btDbvt::rayTest( const btDbvtNode* root, btVector3 bounds[2]; do { const btDbvtNode* node=stack[--depth]; - //m_stack.pop_back(); bounds[0] = node->volume.Mins(); bounds[1] = node->volume.Maxs(); @@ -1012,11 +954,11 @@ inline void btDbvt::rayTest( const btDbvtNode* root, btScalar tmin=1.f,lambda_min=0.f; unsigned int result1 = btRayAabb2(rayFrom,rayDirectionInverse,signs,bounds,tmin,lambda_min,lambda_max); - #ifdef COMPARE_BTRAY_AABB2 +#ifdef COMPARE_BTRAY_AABB2 btScalar param=1.f; bool result2 = btRayAabb(rayFrom,rayTo,node->volume.Mins(),node->volume.Maxs(),param,resultNormal); btAssert(result1 == result2); - #endif //TEST_BTRAY_AABB2 +#endif //TEST_BTRAY_AABB2 if(result1) { diff --git a/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp b/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp index 7d9c66fac..21271d51e 100644 --- a/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp +++ b/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp @@ -235,7 +235,6 @@ void btDbvtBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, rayCallback.m_rayDirectionInverse, rayCallback.m_signs, rayCallback.m_lambda_max, - rayCallback.m_ray, callback); m_sets[1].rayTestInternal( m_sets[1].m_root, @@ -244,7 +243,6 @@ void btDbvtBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, rayCallback.m_rayDirectionInverse, rayCallback.m_signs, rayCallback.m_lambda_max, - rayCallback.m_ray, callback); }