diff --git a/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp b/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp index a2cf96cc0..59c10cfe0 100644 --- a/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp +++ b/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp @@ -88,6 +88,8 @@ btCollisionWorld::~btCollisionWorld() void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup,short int collisionFilterMask) { + btAssert(collisionObject); + //check that the object isn't already added btAssert( m_collisionObjects.findLinearSearch(collisionObject) == m_collisionObjects.size()); @@ -705,7 +707,7 @@ struct btSingleRayCallback : public btBroadphaseRayCallback void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const { - BT_PROFILE("rayTest"); + //BT_PROFILE("rayTest"); /// use the broadphase to accelerate the search for objects, based on their aabb /// and for each object with ray-aabb overlap, perform an exact ray test btSingleRayCallback rayCB(rayFromWorld,rayToWorld,this,resultCallback); diff --git a/src/BulletCollision/CollisionShapes/btTriangleShape.h b/src/BulletCollision/CollisionShapes/btTriangleShape.h index 69b7dbbb7..847147cf6 100644 --- a/src/BulletCollision/CollisionShapes/btTriangleShape.h +++ b/src/BulletCollision/CollisionShapes/btTriangleShape.h @@ -32,6 +32,11 @@ public: return 3; } + btVector3& getVertexPtr(int index) + { + return m_vertices1[index]; + } + const btVector3& getVertexPtr(int index) const { return m_vertices1[index]; @@ -77,7 +82,10 @@ public: } - + btTriangleShape() : btPolyhedralConvexShape () + { + m_shapeType = TRIANGLE_SHAPE_PROXYTYPE; + } btTriangleShape(const btVector3& p0,const btVector3& p1,const btVector3& p2) : btPolyhedralConvexShape () { diff --git a/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp b/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp index 9dd731d1a..b9376507f 100644 --- a/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp +++ b/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp @@ -421,6 +421,11 @@ btVector3 btDiscreteDynamicsWorld::getGravity () const return m_gravity; } +void btDiscreteDynamicsWorld::addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup,short int collisionFilterMask) +{ + btCollisionWorld::addCollisionObject(collisionObject,collisionFilterGroup,collisionFilterMask); +} + void btDiscreteDynamicsWorld::removeCollisionObject(btCollisionObject* collisionObject) { btRigidBody* body = btRigidBody::upcast(collisionObject); @@ -436,6 +441,7 @@ void btDiscreteDynamicsWorld::removeRigidBody(btRigidBody* body) btCollisionWorld::removeCollisionObject(body); } + void btDiscreteDynamicsWorld::addRigidBody(btRigidBody* body) { if (!body->isStaticOrKinematicObject()) diff --git a/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h b/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h index caa3e73c3..23284a9b7 100644 --- a/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h +++ b/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h @@ -124,6 +124,8 @@ public: virtual btVector3 getGravity () const; + virtual void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=btBroadphaseProxy::StaticFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); + virtual void addRigidBody(btRigidBody* body); virtual void addRigidBody(btRigidBody* body, short group, short mask); diff --git a/src/BulletMultiThreaded/SpuCollisionObjectWrapper.h b/src/BulletMultiThreaded/SpuCollisionObjectWrapper.h index 840c0e4b3..36ea49209 100644 --- a/src/BulletMultiThreaded/SpuCollisionObjectWrapper.h +++ b/src/BulletMultiThreaded/SpuCollisionObjectWrapper.h @@ -13,6 +13,9 @@ subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ +#ifndef SPU_COLLISION_OBJECT_WRAPPER_H +#define SPU_COLLISION_OBJECT_WRAPPER_H + #include "PlatformDefinitions.h" #include "BulletCollision/CollisionDispatch/btCollisionObject.h" @@ -33,3 +36,5 @@ public: ppu_address_t getCollisionObjectPtr () const; }; + +#endif //SPU_COLLISION_OBJECT_WRAPPER_H diff --git a/src/BulletMultiThreaded/SpuCollisionTaskProcess.cpp b/src/BulletMultiThreaded/SpuCollisionTaskProcess.cpp index 8d77240ba..44922a499 100644 --- a/src/BulletMultiThreaded/SpuCollisionTaskProcess.cpp +++ b/src/BulletMultiThreaded/SpuCollisionTaskProcess.cpp @@ -26,31 +26,34 @@ subject to the following restrictions: void SpuCollisionTaskProcess::setNumTasks(int maxNumTasks) { - m_maxNumOutstandingTasks = maxNumTasks; - m_taskBusy.resize(m_maxNumOutstandingTasks); - m_spuGatherTaskDesc.resize(m_maxNumOutstandingTasks); - - for (int i = 0; i < m_taskBusy.size(); i++) + if (m_maxNumOutstandingTasks != maxNumTasks) { - m_taskBusy[i] = false; - } + m_maxNumOutstandingTasks = maxNumTasks; + m_taskBusy.resize(m_maxNumOutstandingTasks); + m_spuGatherTaskDesc.resize(m_maxNumOutstandingTasks); - ///re-allocate task memory buffers - if (m_workUnitTaskBuffers != 0) - { - btAlignedFree(m_workUnitTaskBuffers); + for (int i = 0; i < m_taskBusy.size(); i++) + { + m_taskBusy[i] = false; + } + + ///re-allocate task memory buffers + if (m_workUnitTaskBuffers != 0) + { + btAlignedFree(m_workUnitTaskBuffers); + } + + m_workUnitTaskBuffers = (unsigned char *)btAlignedAlloc(MIDPHASE_WORKUNIT_TASK_SIZE*m_maxNumOutstandingTasks, 128); + m_workUnitTaskBuffers = (unsigned char *)btAlignedAlloc(MIDPHASE_WORKUNIT_TASK_SIZE*6, 128); } - m_workUnitTaskBuffers = (unsigned char *)btAlignedAlloc(MIDPHASE_WORKUNIT_TASK_SIZE*m_maxNumOutstandingTasks, 128); - m_workUnitTaskBuffers = (unsigned char *)btAlignedAlloc(MIDPHASE_WORKUNIT_TASK_SIZE*6, 128); - } SpuCollisionTaskProcess::SpuCollisionTaskProcess(class btThreadSupportInterface* threadInterface, unsigned int maxNumOutstandingTasks) :m_threadInterface(threadInterface), -m_maxNumOutstandingTasks(maxNumOutstandingTasks) +m_maxNumOutstandingTasks(0) { m_workUnitTaskBuffers = (unsigned char *)0; setNumTasks(maxNumOutstandingTasks); @@ -130,7 +133,7 @@ void SpuCollisionTaskProcess::issueTask2() // no error checking here... // but, currently, event queue can be no larger than NUM_WORKUNIT_TASKS. - taskDesc.inPtr = reinterpret_cast(MIDPHASE_TASK_PTR(m_currentTask)); + taskDesc.m_inPairPtr = reinterpret_cast(MIDPHASE_TASK_PTR(m_currentTask)); taskDesc.taskId = m_currentTask; taskDesc.numPages = m_currentPage+1; diff --git a/src/BulletMultiThreaded/SpuCollisionTaskProcess.h b/src/BulletMultiThreaded/SpuCollisionTaskProcess.h index a39f4c778..a9ffde1a5 100644 --- a/src/BulletMultiThreaded/SpuCollisionTaskProcess.h +++ b/src/BulletMultiThreaded/SpuCollisionTaskProcess.h @@ -74,7 +74,7 @@ class btDispatcher; ///MidphaseWorkUnitInput stores individual primitive versus mesh collision detection input, to be processed by the SPU. -struct SpuGatherAndProcessWorkUnitInput +ATTRIBUTE_ALIGNED16(struct) SpuGatherAndProcessWorkUnitInput { uint64_t m_pairArrayPtr; int m_startIndex; @@ -151,6 +151,7 @@ public: #define MIDPHASE_WORKUNIT_PAGE_SIZE (16) +//#define MIDPHASE_WORKUNIT_PAGE_SIZE (128) #define MIDPHASE_NUM_WORKUNIT_PAGES 1 #define MIDPHASE_WORKUNIT_TASK_SIZE (MIDPHASE_WORKUNIT_PAGE_SIZE*MIDPHASE_NUM_WORKUNIT_PAGES) diff --git a/src/BulletMultiThreaded/SpuDoubleBuffer.h b/src/BulletMultiThreaded/SpuDoubleBuffer.h index 875748c55..801c86080 100644 --- a/src/BulletMultiThreaded/SpuDoubleBuffer.h +++ b/src/BulletMultiThreaded/SpuDoubleBuffer.h @@ -61,7 +61,10 @@ DoubleBuffer::backBufferDmaGet(uint64_t ea, unsigned int numBytes, unsig { m_dmaPending = true; m_dmaTag = tag; - m_backBuffer = (T*)cellDmaLargeGetReadOnly(m_backBuffer, ea, numBytes, tag, 0, 0); + if (numBytes) + { + m_backBuffer = (T*)cellDmaLargeGetReadOnly(m_backBuffer, ea, numBytes, tag, 0, 0); + } } template diff --git a/src/BulletMultiThreaded/SpuGatheringCollisionDispatcher.cpp b/src/BulletMultiThreaded/SpuGatheringCollisionDispatcher.cpp index 4f1e6d1ec..f81f75190 100644 --- a/src/BulletMultiThreaded/SpuGatheringCollisionDispatcher.cpp +++ b/src/BulletMultiThreaded/SpuGatheringCollisionDispatcher.cpp @@ -22,6 +22,7 @@ subject to the following restrictions: #include "SpuContactManifoldCollisionAlgorithm.h" #include "BulletCollision/CollisionDispatch/btCollisionObject.h" #include "BulletCollision/CollisionShapes/btCollisionShape.h" +#include "LinearMath/btQuickprof.h" @@ -152,69 +153,81 @@ void SpuGatheringCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPai { m_maxNumOutstandingTasks = m_threadInterface->getNumTasks(); - if (!m_spuCollisionTaskProcess) - m_spuCollisionTaskProcess = new SpuCollisionTaskProcess(m_threadInterface,m_maxNumOutstandingTasks); - - m_spuCollisionTaskProcess->setNumTasks(m_maxNumOutstandingTasks); -// printf("m_maxNumOutstandingTasks =%d\n",m_maxNumOutstandingTasks); - - m_spuCollisionTaskProcess->initialize2(dispatchInfo.m_useEpa); - - - ///modified version of btCollisionDispatcher::dispatchAllCollisionPairs: { - btSpuCollisionPairCallback collisionCallback(dispatchInfo,this); + BT_PROFILE("processAllOverlappingPairs"); - pairCache->processAllOverlappingPairs(&collisionCallback,dispatcher); + if (!m_spuCollisionTaskProcess) + m_spuCollisionTaskProcess = new SpuCollisionTaskProcess(m_threadInterface,m_maxNumOutstandingTasks); + + m_spuCollisionTaskProcess->setNumTasks(m_maxNumOutstandingTasks); + // printf("m_maxNumOutstandingTasks =%d\n",m_maxNumOutstandingTasks); + + m_spuCollisionTaskProcess->initialize2(dispatchInfo.m_useEpa); + + + ///modified version of btCollisionDispatcher::dispatchAllCollisionPairs: + { + btSpuCollisionPairCallback collisionCallback(dispatchInfo,this); + + pairCache->processAllOverlappingPairs(&collisionCallback,dispatcher); + } } //send one big batch int numTotalPairs = pairCache->getNumOverlappingPairs(); btBroadphasePair* pairPtr = pairCache->getOverlappingPairArrayPtr(); int i; - for (i=0;iaddWorkToTask(pairPtr,i,endIndex); - i = endIndex; + BT_PROFILE("addWorkToTask"); + for (i=0;iaddWorkToTask(pairPtr,i,endIndex); + i = endIndex; + } } - //handle PPU fallback pairs - for (i=0;im_clientObject; - btCollisionObject* colObj1 = (btCollisionObject*)collisionPair.m_pProxy1->m_clientObject; - - if (dispatcher->needsCollision(colObj0,colObj1)) + if (collisionPair.m_algorithm) { - btManifoldResult contactPointResult(colObj0,colObj1); - - if (dispatchInfo.m_dispatchFunc == btDispatcherInfo::DISPATCH_DISCRETE) - { - //discrete collision detection query - collisionPair.m_algorithm->processCollision(colObj0,colObj1,dispatchInfo,&contactPointResult); - } else - { - //continuous collision detection query, time of impact (toi) - btScalar toi = collisionPair.m_algorithm->calculateTimeOfImpact(colObj0,colObj1,dispatchInfo,&contactPointResult); - if (dispatchInfo.m_timeOfImpact > toi) - dispatchInfo.m_timeOfImpact = toi; + btCollisionObject* colObj0 = (btCollisionObject*)collisionPair.m_pProxy0->m_clientObject; + btCollisionObject* colObj1 = (btCollisionObject*)collisionPair.m_pProxy1->m_clientObject; + if (dispatcher->needsCollision(colObj0,colObj1)) + { + btManifoldResult contactPointResult(colObj0,colObj1); + + if (dispatchInfo.m_dispatchFunc == btDispatcherInfo::DISPATCH_DISCRETE) + { + //discrete collision detection query + collisionPair.m_algorithm->processCollision(colObj0,colObj1,dispatchInfo,&contactPointResult); + } else + { + //continuous collision detection query, time of impact (toi) + btScalar toi = collisionPair.m_algorithm->calculateTimeOfImpact(colObj0,colObj1,dispatchInfo,&contactPointResult); + if (dispatchInfo.m_timeOfImpact > toi) + dispatchInfo.m_timeOfImpact = toi; + + } } } } } } - - //make sure all SPU work is done - m_spuCollisionTaskProcess->flush2(); + { + BT_PROFILE("flush2"); + //make sure all SPU work is done + m_spuCollisionTaskProcess->flush2(); + } } else { diff --git a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/Box.h b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/Box.h index 63fdfebc9..c5b68743c 100644 --- a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/Box.h +++ b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/Box.h @@ -23,8 +23,10 @@ subject to the following restrictions: #endif #include -#include "BulletMultiThreaded/vectormath/scalar/cpp/vectormath_aos.h" -// + +//#include "BulletMultiThreaded/vectormath/scalar/cpp/vectormath_aos.h" +#include + using namespace Vectormath::Aos; diff --git a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h index bb41772f6..bc2159260 100644 --- a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h +++ b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h @@ -34,22 +34,23 @@ subject to the following restrictions: #define MAX_NUM_SPU_CONVEX_POINTS 128 -struct SpuConvexPolyhedronVertexData +ATTRIBUTE_ALIGNED16(struct) SpuConvexPolyhedronVertexData { void* gSpuConvexShapePtr; btVector3* gConvexPoints; int gNumConvexPoints; + int unused; ATTRIBUTE_ALIGNED16(btVector3 g_convexPointBuffer[MAX_NUM_SPU_CONVEX_POINTS]); }; #define MAX_SHAPE_SIZE 256 -struct CollisionShape_LocalStoreMemory +ATTRIBUTE_ALIGNED16(struct) CollisionShape_LocalStoreMemory { ATTRIBUTE_ALIGNED16(char collisionShape[MAX_SHAPE_SIZE]); }; -struct CompoundShape_LocalStoreMemory +ATTRIBUTE_ALIGNED16(struct) CompoundShape_LocalStoreMemory { // Compound data #define MAX_SPU_COMPOUND_SUBSHAPES 16 @@ -57,7 +58,7 @@ struct CompoundShape_LocalStoreMemory ATTRIBUTE_ALIGNED16(char gSubshapeShape[MAX_SPU_COMPOUND_SUBSHAPES][MAX_SHAPE_SIZE]); }; -struct bvhMeshShape_LocalStoreMemory +ATTRIBUTE_ALIGNED16(struct) bvhMeshShape_LocalStoreMemory { //ATTRIBUTE_ALIGNED16(btOptimizedBvh gOptimizedBvh); ATTRIBUTE_ALIGNED16(char gOptimizedBvh[sizeof(btOptimizedBvh)+16]); diff --git a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuConvexPenetrationDepthSolver.h b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuConvexPenetrationDepthSolver.h index bdbab5e53..5e4cc2881 100644 --- a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuConvexPenetrationDepthSolver.h +++ b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuConvexPenetrationDepthSolver.h @@ -22,13 +22,13 @@ subject to the following restrictions: class btStackAlloc; class btIDebugDraw; -class SpuVoronoiSimplexSolver; +#include "BulletCollision/NarrowphaseCollision/btConvexPenetrationDepthSolver.h" #include ///ConvexPenetrationDepthSolver provides an interface for penetration depth calculation. -class SpuConvexPenetrationDepthSolver +class SpuConvexPenetrationDepthSolver : public btConvexPenetrationDepthSolver { public: diff --git a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp index 4c90b983d..754fd5d90 100644 --- a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp +++ b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp @@ -273,11 +273,13 @@ SIMD_FORCE_INLINE void small_cache_read_triple( void* ls0, ppu_address_t ea0, + class spuNodeCallback : public btNodeOverlapCallback { SpuCollisionPairInput* m_wuInput; SpuContactResult& m_spuContacts; CollisionTask_LocalStoreMemory* m_lsMemPtr; + ATTRIBUTE_ALIGNED16(btTriangleShape) m_tmpTriangleShape; ATTRIBUTE_ALIGNED16(btVector3 spuTriangleVertices[3]); ATTRIBUTE_ALIGNED16(btScalar spuUnscaledVertex[4]); @@ -345,8 +347,7 @@ public: &spuUnscaledVertex[2],(ppu_address_t)&graphicsbasePtr[2], sizeof(btScalar)); - spuTriangleVertices[j] = btVector3( - spuUnscaledVertex[0]*meshScaling.getX(), + m_tmpTriangleShape.getVertexPtr(j).setValue(spuUnscaledVertex[0]*meshScaling.getX(), spuUnscaledVertex[1]*meshScaling.getY(), spuUnscaledVertex[2]*meshScaling.getZ()); @@ -354,13 +355,9 @@ public: } - - ATTRIBUTE_ALIGNED16(btTriangleShape) tmpTriangleShape(spuTriangleVertices[0],spuTriangleVertices[1],spuTriangleVertices[2]); - - SpuCollisionPairInput triangleConcaveInput(*m_wuInput); // triangleConcaveInput.m_spuCollisionShapes[1] = &spuTriangleVertices[0]; - triangleConcaveInput.m_spuCollisionShapes[1] = &tmpTriangleShape; + triangleConcaveInput.m_spuCollisionShapes[1] = &m_tmpTriangleShape; triangleConcaveInput.m_shapeType1 = TRIANGLE_SHAPE_PROXYTYPE; m_spuContacts.setShapeIdentifiersB(subPart,triangleIndex); @@ -479,6 +476,9 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT } +int stats[11]={0,0,0,0,0,0,0,0,0,0,0}; +int degenerateStats[11]={0,0,0,0,0,0,0,0,0,0,0}; + //////////////////////// /// Convex versus Convex collision detection (handles collision between sphere, box, cylinder, triangle, cone, convex polyhedron etc) @@ -507,22 +507,19 @@ void ProcessSpuConvexConvexCollision(SpuCollisionPairInput* wuInput, CollisionTa btVoronoiSimplexSolver simplexSolver; btGjkEpaPenetrationDepthSolver epaPenetrationSolver2; - btConvexPenetrationDepthSolver* penetrationSolver = (btConvexPenetrationDepthSolver*)&epaPenetrationSolver2; - -#if 0 - SpuVoronoiSimplexSolver vsSolver; - SpuMinkowskiPenetrationDepthSolver minkowskiPenetrationSolver; + btConvexPenetrationDepthSolver* penetrationSolver = &epaPenetrationSolver2; + + //SpuMinkowskiPenetrationDepthSolver minkowskiPenetrationSolver; #ifdef ENABLE_EPA - SpuEpaPenetrationDepthSolver epaPenetrationSolver; if (gUseEpa) { - penetrationSolver = &epaPenetrationSolver; + penetrationSolver = &epaPenetrationSolver2; } else #endif { - penetrationSolver = &minkowskiPenetrationSolver; + //penetrationSolver = &minkowskiPenetrationSolver; } -#endif + ///DMA in the vertices for convex shapes ATTRIBUTE_ALIGNED16(char convexHullShape0[sizeof(btConvexHullShape)]); @@ -616,6 +613,10 @@ void ProcessSpuConvexConvexCollision(SpuCollisionPairInput* wuInput, CollisionTa { btGjkPairDetector gjk(shape0Ptr,shape1Ptr,shapeType0,shapeType1,marginA,marginB,&simplexSolver,penetrationSolver);//&vsSolver,penetrationSolver); gjk.getClosestPoints(cpInput,spuContacts,0);//,debugDraw); + + stats[gjk.m_lastUsedMethod]++; + degenerateStats[gjk.m_degenerateSimplex]++; + #ifdef USE_SEPDISTANCE_UTIL btScalar sepDist = gjk.getCachedSeparatingDistance()+spuManifold->getContactBreakingThreshold(); lsMemPtr->getlocalCollisionAlgorithm()->m_sepDistance.initSeparatingDistance(gjk.getCachedSeparatingAxis(),sepDist,wuInput->m_worldTransform0,wuInput->m_worldTransform1); @@ -880,7 +881,7 @@ void processCollisionTask(void* userPtr, void* lsMemPtr) //////////////////// - ppu_address_t dmaInPtr = taskDesc.inPtr; + ppu_address_t dmaInPtr = taskDesc.m_inPairPtr; unsigned int numPages = taskDesc.numPages; unsigned int numOnLastPage = taskDesc.numOnLastPage; @@ -1036,7 +1037,6 @@ void processCollisionTask(void* userPtr, void* lsMemPtr) btVector3 normalInB; - if (//!gUseEpa && #ifdef USE_SEPDISTANCE_UTIL lsMem.getlocalCollisionAlgorithm()->m_sepDistance.getConservativeSeparatingDistance()<=0.f @@ -1045,7 +1045,7 @@ void processCollisionTask(void* userPtr, void* lsMemPtr) #endif ) { -#define USE_PE_BOX_BOX 1 +//#define USE_PE_BOX_BOX 1 #ifdef USE_PE_BOX_BOX { @@ -1163,9 +1163,7 @@ void processCollisionTask(void* userPtr, void* lsMemPtr) #endif //USE_SEPDISTANCE_UTIL ) { - handleCollisionPair(collisionPairInput, lsMem, spuContacts, - (ppu_address_t)lsMem.getColObj0()->getCollisionShape(), &lsMem.gCollisionShapes[0].collisionShape, - (ppu_address_t)lsMem.getColObj1()->getCollisionShape(), &lsMem.gCollisionShapes[1].collisionShape); + handleCollisionPair(collisionPairInput, lsMem, spuContacts, (ppu_address_t)lsMem.getColObj0()->getCollisionShape(), &lsMem.gCollisionShapes[0].collisionShape, (ppu_address_t)lsMem.getColObj1()->getCollisionShape(), &lsMem.gCollisionShapes[1].collisionShape); } else { //spu_printf("boxbox dist = %f\n",distance); diff --git a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h index 752a60fae..bbaa555ee 100644 --- a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h +++ b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h @@ -23,7 +23,7 @@ subject to the following restrictions: ///Task Description for SPU collision detection struct SpuGatherAndProcessPairsTaskDesc { - ppu_address_t inPtr;//m_pairArrayPtr; + ppu_address_t m_inPairPtr;//m_pairArrayPtr; //mutex variable uint32_t m_someMutexVariableInMainMemory; diff --git a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.cpp b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.cpp index 0e011680e..9f7e64dd1 100644 --- a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.cpp +++ b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.cpp @@ -67,16 +67,14 @@ btVector3(btScalar(-0.425323) , btScalar(0.309011),btScalar(0.850654)), btVector3(btScalar(0.162456) , btScalar(0.499995),btScalar(0.850654)) }; -bool SpuMinkowskiPenetrationDepthSolver::calcPenDepth( btVoronoiSimplexSolver& simplexSolver, - btConvexShape* convexA,btConvexShape* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB, - btTransform& transA,const btTransform& transB, - btVector3& v, btVector3& pa, btVector3& pb, - class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc, - struct SpuConvexPolyhedronVertexData* convexVertexDataA, - struct SpuConvexPolyhedronVertexData* convexVertexDataB - ) const -{ +bool SpuMinkowskiPenetrationDepthSolver::calcPenDepth( btSimplexSolverInterface& simplexSolver, + const btConvexShape* convexA,const btConvexShape* convexB, + const btTransform& transA,const btTransform& transB, + btVector3& v, btVector3& pa, btVector3& pb, + class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc) +{ +#if 0 (void)stackAlloc; (void)v; @@ -342,6 +340,8 @@ bool SpuMinkowskiPenetrationDepthSolver::calcPenDepth( btVoronoiSimplexSolver& s //btAssert (false); } return res.m_hasResult; +#endif + return false; } diff --git a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.h b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.h index 3d6822920..18ad223ed 100644 --- a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.h +++ b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.h @@ -18,7 +18,7 @@ subject to the following restrictions: #define MINKOWSKI_PENETRATION_DEPTH_SOLVER_H -#include "SpuConvexPenetrationDepthSolver.h" +#include "BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h" class btStackAlloc; class btIDebugDraw; @@ -27,18 +27,18 @@ class btConvexShape; ///MinkowskiPenetrationDepthSolver implements bruteforce penetration depth estimation. ///Implementation is based on sampling the depth using support mapping, and using GJK step to get the witness points. -class SpuMinkowskiPenetrationDepthSolver : public SpuConvexPenetrationDepthSolver +class SpuMinkowskiPenetrationDepthSolver : public btConvexPenetrationDepthSolver { public: + SpuMinkowskiPenetrationDepthSolver() {} + virtual ~SpuMinkowskiPenetrationDepthSolver() {}; - virtual bool calcPenDepth( btVoronoiSimplexSolver& simplexSolver, - btConvexShape* convexA,btConvexShape* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB, - btTransform& transA,const btTransform& transB, - btVector3& v, btVector3& pa, btVector3& pb, - class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc, - struct SpuConvexPolyhedronVertexData* convexVertexDataA, - struct SpuConvexPolyhedronVertexData* convexVertexDataB - ) const; + virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver, + const btConvexShape* convexA,const btConvexShape* convexB, + const btTransform& transA,const btTransform& transB, + btVector3& v, btVector3& pa, btVector3& pb, + class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc + ); }; diff --git a/src/BulletMultiThreaded/vectormath2bullet.h b/src/BulletMultiThreaded/vectormath2bullet.h index e75af5b11..efc7a3c92 100644 --- a/src/BulletMultiThreaded/vectormath2bullet.h +++ b/src/BulletMultiThreaded/vectormath2bullet.h @@ -30,8 +30,9 @@ #ifndef AOS_VECTORMATH_BULLET_CONVERT_H #define AOS_VECTORMATH_BULLET_CONVERT_H -//#include -#include "BulletMultiThreaded/vectormath/scalar/cpp/vectormath_aos.h" +#include +//#include "BulletMultiThreaded/vectormath/scalar/cpp/vectormath_aos.h" + #include "LinearMath/btVector3.h" #include "LinearMath/btQuaternion.h" #include "LinearMath/btMatrix3x3.h"