diff --git a/src/BulletCollision/BroadphaseCollision/btDbvt.h b/src/BulletCollision/BroadphaseCollision/btDbvt.h index cc3ed95fb..071786530 100644 --- a/src/BulletCollision/BroadphaseCollision/btDbvt.h +++ b/src/BulletCollision/BroadphaseCollision/btDbvt.h @@ -61,8 +61,7 @@ subject to the following restrictions: // Specific methods implementation -//SSE gives errors on a MSVC 7.1 -#if (defined (WIN32) && (_MSC_VER) && _MSC_VER >= 1400) +#ifdef WIN32 #define DBVT_SELECT_IMPL DBVT_IMPL_SSE #define DBVT_MERGE_IMPL DBVT_IMPL_SSE #define DBVT_INT0_IMPL DBVT_IMPL_SSE @@ -498,7 +497,8 @@ DBVT_INLINE bool Intersect( const btDbvtAabbMm& a, #if DBVT_INT0_IMPL == DBVT_IMPL_SSE const __m128 rt(_mm_or_ps( _mm_cmplt_ps(_mm_load_ps(b.mx),_mm_load_ps(a.mi)), _mm_cmplt_ps(_mm_load_ps(a.mx),_mm_load_ps(b.mi)))); -return((rt.m128_u32[0]|rt.m128_u32[1]|rt.m128_u32[2])==0); +const __int32* pu((const __int32*)&rt); +return((pu[0]|pu[1]|pu[2])==0); #else return( (a.mi.x()<=b.mx.x())&& (a.mx.x()>=b.mi.x())&& diff --git a/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp b/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp index f97e95494..cafdf1847 100644 --- a/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp +++ b/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp @@ -91,6 +91,7 @@ value=zerodummy; struct btDbvtTreeCollider : btDbvt::ICollide { btDbvtBroadphase* pbp; +btDbvtProxy* proxy; btDbvtTreeCollider(btDbvtBroadphase* p) : pbp(p) {} void Process(const btDbvtNode* na,const btDbvtNode* nb) { @@ -105,6 +106,10 @@ void Process(const btDbvtNode* na,const btDbvtNode* nb) ++pbp->m_newpairs; } } +void Process(const btDbvtNode* n) + { + Process(n,proxy->leaf); + } }; // @@ -116,7 +121,6 @@ btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache) { m_initialize = true; m_deferedcollide = true; -m_predictedframes = 2; m_needcleanup = true; m_releasepaircache = (paircache!=0)?false:true; m_prediction = 1/(btScalar)2; @@ -198,9 +202,8 @@ void btDbvtBroadphase::setAabb( btBroadphaseProxy* absproxy, const btVector3& aabbMax, btDispatcher* /*dispatcher*/) { -btDbvtProxy* proxy=(btDbvtProxy*)absproxy; +btDbvtProxy* proxy=(btDbvtProxy*)absproxy; ATTRIBUTE_ALIGNED16(btDbvtVolume) aabb=btDbvtVolume::FromMM(aabbMin,aabbMax); - #if DBVT_BP_PREVENTFALSEUPDATE if(NotEqual(aabb,proxy->leaf->volume)) #endif @@ -305,7 +308,9 @@ if(current) btDbvtProxy* next=current->links[1]; listremove(current,m_stageRoots[current->stage]); listappend(current,m_stageRoots[STAGECOUNT]); - btDbvt::collideTT(m_sets[1].m_root,current->leaf,collider); + m_paircache->removeOverlappingPairsContainingProxy(current,dispatcher); + collider.proxy=current; + btDbvt::collideTV(m_sets[1].m_root,current->aabb,collider); m_sets[0].remove(current->leaf); current->leaf = m_sets[1].insert(current->aabb,current); current->stage = STAGECOUNT; diff --git a/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h b/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h index d0f214c05..8314a82ad 100644 --- a/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h +++ b/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h @@ -84,7 +84,6 @@ int m_cid; // Cleanup index int m_gid; // Gen id bool m_releasepaircache; // Release pair cache on delete bool m_deferedcollide; // Defere dynamic/static collision to collide call -int m_predictedframes; // Nathanael? bool m_needcleanup; // Need to run cleanup? bool m_initialize; // Initialization #if DBVT_BP_PROFILE