Disable TEST_NON_VIRTUAL debugging for btGjkPairDetector

Reverted BulletMultiThreaded, there are some performance issues to be resolved.
This commit is contained in:
erwin.coumans
2008-10-08 20:59:26 +00:00
parent e499a13572
commit 10d103b50e
15 changed files with 641 additions and 987 deletions

View File

@@ -16,155 +16,6 @@ subject to the following restrictions:
#include "SpuCollisionShapes.h" #include "SpuCollisionShapes.h"
#if 0
int SpuInternalShape::dmaShapeTypeIntoShapeStorage (ppu_address_t ppuAddress, uint32_t dmaTag)
{
m_ppuConvexShapePtr = ppuAddress;
/* This assumes that m_shapeType is the first entry in the struct */
cellDmaSmallGet (m_collisionShape, m_ppuConvexShapePtr, 4, DMA_TAG(dmaTag), 0, 0);
cellDmaWaitTagStatusAll(DMA_MASK(dmaTag));
return m_collisionShape->getShapeType ();
}
#endif
void SpuInternalShape::dmaShapeData (ppu_address_t ppuAddress, int shapeType, uint32_t dmaTag)
{
m_ppuConvexShapePtr = ppuAddress;
uint32_t shapeSize = getShapeTypeSize (shapeType);
cellDmaGet (m_collisionShape, m_ppuConvexShapePtr, shapeSize, DMA_TAG(dmaTag), 0, 0);
}
void SpuInternalConvexHull::dmaPointsData (const SpuInternalShape& shape, uint32_t dmaTag)
{
btAssert (shape.m_collisionShape->getShapeType () == CONVEX_HULL_SHAPE_PROXYTYPE);
btConvexHullShape* convexHullShape = (btConvexHullShape*)shape.m_collisionShape;
ppu_address_t ppuPointsAddress = (ppu_address_t)convexHullShape->getPoints();
int numPoints = convexHullShape->getNumPoints ();
dmaPointsData (ppuPointsAddress, numPoints, dmaTag);
}
void SpuInternalConvexHull::dmaPointsData (ppu_address_t ppuPointsAddress, int numPoints, uint32_t dmaTag)
{
m_ppuPointsPtr = ppuPointsAddress;
m_numPoints = numPoints;
cellDmaGet (m_points, m_ppuPointsPtr, sizeof(btVector3)*numPoints, DMA_TAG(dmaTag), 0, 0);
}
void SpuCompoundShape::dmaChildShapeInfo (btCompoundShape* compoundShape, uint32_t dmaTag)
{
register int dmaSize;
register ppu_address_t dmaPpuAddress;
int childShapeCount = compoundShape->getNumChildShapes();
dmaSize = childShapeCount * sizeof(btCompoundShapeChild);
dmaPpuAddress = (ppu_address_t)compoundShape->getChildList();
cellDmaGet(&m_subshapes[0], dmaPpuAddress, dmaSize, DMA_TAG(dmaTag), 0, 0);
}
void SpuCompoundShape::dmaChildShape (int childShape,
SpuInternalShape* localShape,
SpuInternalConvexHull* localShapeHull,
uint32_t dmaTag)
{
btCompoundShapeChild& compoundChildShape = m_subshapes[childShape];
localShape->dmaShapeData ((ppu_address_t)compoundChildShape.m_childShape, compoundChildShape.m_childShapeType, dmaTag);
cellDmaWaitTagStatusAll (DMA_MASK(dmaTag));
if (compoundChildShape.m_childShapeType == CONVEX_HULL_SHAPE_PROXYTYPE)
{
localShapeHull->dmaPointsData (*localShape, dmaTag);
}
}
void dmaBvhShapeData (bvhMeshShape_LocalStoreMemory* bvhMeshShape, btBvhTriangleMeshShape* triMeshShape)
{
register int dmaSize;
register ppu_address_t dmaPpuAddress2;
dmaSize = sizeof(btTriangleIndexVertexArray);
dmaPpuAddress2 = reinterpret_cast<ppu_address_t>(triMeshShape->getMeshInterface());
// spu_printf("trimeshShape->getMeshInterface() == %llx\n",dmaPpuAddress2);
#ifdef __SPU__
cellDmaGet(&bvhMeshShape->gTriangleMeshInterfaceStorage, dmaPpuAddress2 , dmaSize, DMA_TAG(1), 0, 0);
bvhMeshShape->gTriangleMeshInterfacePtr = &bvhMeshShape->gTriangleMeshInterfaceStorage;
#else
bvhMeshShape->gTriangleMeshInterfacePtr = (btTriangleIndexVertexArray*)cellDmaGetReadOnly(&bvhMeshShape->gTriangleMeshInterfaceStorage, dmaPpuAddress2 , dmaSize, DMA_TAG(1), 0, 0);
#endif
//cellDmaWaitTagStatusAll(DMA_MASK(1));
///now DMA over the BVH
dmaSize = sizeof(btOptimizedBvh);
dmaPpuAddress2 = reinterpret_cast<ppu_address_t>(triMeshShape->getOptimizedBvh());
//spu_printf("trimeshShape->getOptimizedBvh() == %llx\n",dmaPpuAddress2);
cellDmaGet(&bvhMeshShape->gOptimizedBvh, dmaPpuAddress2 , dmaSize, DMA_TAG(2), 0, 0);
//cellDmaWaitTagStatusAll(DMA_MASK(2));
cellDmaWaitTagStatusAll(DMA_MASK(1) | DMA_MASK(2));
}
void dmaBvhIndexedMesh (btIndexedMesh* IndexMesh, IndexedMeshArray& indexArray, int index, uint32_t dmaTag)
{
cellDmaGet(IndexMesh, (ppu_address_t)&indexArray[index] , sizeof(btIndexedMesh), DMA_TAG(dmaTag), 0, 0);
}
void dmaBvhSubTreeHeaders (btBvhSubtreeInfo* subTreeHeaders, ppu_address_t subTreePtr, int batchSize, uint32_t dmaTag)
{
cellDmaGet(subTreeHeaders, subTreePtr, batchSize * sizeof(btBvhSubtreeInfo), DMA_TAG(dmaTag), 0, 0);
}
void dmaBvhSubTreeNodes (btQuantizedBvhNode* nodes, const btBvhSubtreeInfo& subtree, QuantizedNodeArray& nodeArray, int dmaTag)
{
cellDmaGet(nodes, reinterpret_cast<ppu_address_t>(&nodeArray[subtree.m_rootNodeIndex]) , subtree.m_subtreeSize* sizeof(btQuantizedBvhNode), DMA_TAG(2), 0, 0);
}
void SpuBvhMeshShape::dmaMeshInterfaceAndOptimizedBvh (const SpuInternalShape& triangleMeshShape, uint32_t dmaTag1, uint32_t dmaTag2)
{
register int dmaSize;
register ppu_address_t dmaPpuAddress;
btBvhTriangleMeshShape* triMeshShape = (btBvhTriangleMeshShape*)triangleMeshShape.m_collisionShape;
// DMA: triangle mesh interface
dmaSize = sizeof(btTriangleIndexVertexArray);
dmaPpuAddress = reinterpret_cast<ppu_address_t>(triMeshShape->getMeshInterface());
#ifdef __SPU__
cellDmaGet(&m_triangleMeshInterfaceBuffer, dmaPpuAddress, dmaSize, DMA_TAG(dmaTag1), 0, 0);
#else
m_triangleMeshInterface = (btTriangleIndexVertexArray*)cellDmaGetReadOnly(&m_triangleMeshInterfaceBuffer, dmaPpuAddress, dmaSize, DMA_TAG(dmaTag1), 0, 0);
#endif
//cellDmaWaitTagStatusAll(DMA_MASK(dmaTag1));
// DMA: btOptimizedBvh
dmaSize = sizeof(btOptimizedBvh);
dmaPpuAddress = reinterpret_cast<ppu_address_t>(triMeshShape->getOptimizedBvh());
cellDmaGet(m_optimizedBvh, dmaPpuAddress , dmaSize, DMA_TAG(dmaTag2), 0, 0);
//cellDmaWaitTagStatusAll(DMA_MASK(dmaTag2));
// wait for both triangle mesh interface and optimized bvh
cellDmaWaitTagStatusAll(DMA_MASK(dmaTag1) | DMA_MASK(dmaTag2));
}
void SpuBvhMeshShape::dmaIndexedMesh (int index, uint32_t dmaTag)
{
cellDmaGet(&m_indexMesh, (ppu_address_t)&m_triangleMeshInterface->getIndexedMeshArray()[index] , sizeof(btIndexedMesh), DMA_TAG(dmaTag), 0, 0);
}
void SpuBvhMeshShape::dmaSubTreeHeaders (ppu_address_t subTreePtr, int numHeaders, uint32_t dmaTag)
{
cellDmaGet(&m_subtreeHeaders[0], subTreePtr, numHeaders * sizeof(btBvhSubtreeInfo), DMA_TAG(dmaTag), 0, 0);
}
void SpuBvhMeshShape::dmaSubTreeNodes (const btBvhSubtreeInfo& subtree, QuantizedNodeArray& nodeArray, int dmaTag)
{
cellDmaGet(&m_subtreeNodes[0], reinterpret_cast<ppu_address_t>(&nodeArray[subtree.m_rootNodeIndex]) , subtree.m_subtreeSize* sizeof(btQuantizedBvhNode), DMA_TAG(dmaTag), 0, 0);
}
btPoint3 localGetSupportingVertexWithoutMargin(int shapeType, void* shape, const btVector3& localDir,struct SpuConvexPolyhedronVertexData* convexVertexData)//, int *featureIndex) btPoint3 localGetSupportingVertexWithoutMargin(int shapeType, void* shape, const btVector3& localDir,struct SpuConvexPolyhedronVertexData* convexVertexData)//, int *featureIndex)
{ {
switch (shapeType) switch (shapeType)
@@ -447,6 +298,49 @@ void computeAabb (btVector3& aabbMin, btVector3& aabbMax, btConvexInternalShape*
}; };
} }
void dmaBvhShapeData (bvhMeshShape_LocalStoreMemory* bvhMeshShape, btBvhTriangleMeshShape* triMeshShape)
{
register int dmaSize;
register ppu_address_t dmaPpuAddress2;
dmaSize = sizeof(btTriangleIndexVertexArray);
dmaPpuAddress2 = reinterpret_cast<ppu_address_t>(triMeshShape->getMeshInterface());
// spu_printf("trimeshShape->getMeshInterface() == %llx\n",dmaPpuAddress2);
#ifdef __SPU__
cellDmaGet(&bvhMeshShape->gTriangleMeshInterfaceStorage, dmaPpuAddress2 , dmaSize, DMA_TAG(1), 0, 0);
bvhMeshShape->gTriangleMeshInterfacePtr = &bvhMeshShape->gTriangleMeshInterfaceStorage;
#else
bvhMeshShape->gTriangleMeshInterfacePtr = (btTriangleIndexVertexArray*)cellDmaGetReadOnly(&bvhMeshShape->gTriangleMeshInterfaceStorage, dmaPpuAddress2 , dmaSize, DMA_TAG(1), 0, 0);
#endif
//cellDmaWaitTagStatusAll(DMA_MASK(1));
///now DMA over the BVH
dmaSize = sizeof(btOptimizedBvh);
dmaPpuAddress2 = reinterpret_cast<ppu_address_t>(triMeshShape->getOptimizedBvh());
//spu_printf("trimeshShape->getOptimizedBvh() == %llx\n",dmaPpuAddress2);
cellDmaGet(&bvhMeshShape->gOptimizedBvh, dmaPpuAddress2 , dmaSize, DMA_TAG(2), 0, 0);
//cellDmaWaitTagStatusAll(DMA_MASK(2));
cellDmaWaitTagStatusAll(DMA_MASK(1) | DMA_MASK(2));
}
void dmaBvhIndexedMesh (btIndexedMesh* IndexMesh, IndexedMeshArray& indexArray, int index, uint32_t dmaTag)
{
cellDmaGet(IndexMesh, (ppu_address_t)&indexArray[index] , sizeof(btIndexedMesh), DMA_TAG(dmaTag), 0, 0);
}
void dmaBvhSubTreeHeaders (btBvhSubtreeInfo* subTreeHeaders, ppu_address_t subTreePtr, int batchSize, uint32_t dmaTag)
{
cellDmaGet(subTreeHeaders, subTreePtr, batchSize * sizeof(btBvhSubtreeInfo), DMA_TAG(dmaTag), 0, 0);
}
void dmaBvhSubTreeNodes (btQuantizedBvhNode* nodes, const btBvhSubtreeInfo& subtree, QuantizedNodeArray& nodeArray, int dmaTag)
{
cellDmaGet(nodes, reinterpret_cast<ppu_address_t>(&nodeArray[subtree.m_rootNodeIndex]) , subtree.m_subtreeSize* sizeof(btQuantizedBvhNode), DMA_TAG(2), 0, 0);
}
///getShapeTypeSize could easily be optimized, but it is not likely a bottleneck ///getShapeTypeSize could easily be optimized, but it is not likely a bottleneck
int getShapeTypeSize(int shapeType) int getShapeTypeSize(int shapeType)
{ {

View File

@@ -4,7 +4,6 @@
#include "../SpuDoubleBuffer.h" #include "../SpuDoubleBuffer.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollision/CollisionShapes/btConvexInternalShape.h" #include "BulletCollision/CollisionShapes/btConvexInternalShape.h"
#include "BulletCollision/CollisionShapes/btCylinderShape.h" #include "BulletCollision/CollisionShapes/btCylinderShape.h"
@@ -19,69 +18,8 @@
#include "BulletCollision/CollisionShapes/btConvexHullShape.h" #include "BulletCollision/CollisionShapes/btConvexHullShape.h"
#include "BulletCollision/CollisionShapes/btCompoundShape.h" #include "BulletCollision/CollisionShapes/btCompoundShape.h"
#define MAX_SHAPE_SIZE 256
#define MAX_NUM_SPU_CONVEX_POINTS 128 #define MAX_NUM_SPU_CONVEX_POINTS 128
struct SpuInternalShape
{
ATTRIBUTE_ALIGNED16(char m_collisionShapeStorage[MAX_SHAPE_SIZE]);
btConvexShape* m_convexShape;
btCollisionShape* m_collisionShape;
ppu_address_t m_ppuConvexShapePtr;
SpuInternalShape ()
{
m_convexShape = (btConvexShape*)&m_collisionShapeStorage[0];
m_collisionShape = (btCollisionShape*)&m_collisionShapeStorage[0];
m_ppuConvexShapePtr = 0;
}
void dmaShapeData (ppu_address_t ppuAddress, int shapeType, uint32_t dmaTag);
};
struct SpuInternalConvexHull
{
ATTRIBUTE_ALIGNED16(btVector3 m_pointsBuffer[MAX_NUM_SPU_CONVEX_POINTS]);
int m_numPoints;
btVector3* m_points;
ppu_address_t m_ppuPointsPtr;
SpuInternalConvexHull ()
{
m_points = (btVector3*)&m_pointsBuffer[0];
m_numPoints = 0;
m_ppuPointsPtr = 0;
}
void dmaPointsData (const SpuInternalShape& shape, uint32_t dmaTag);
void dmaPointsData (ppu_address_t ppuPointsAddress, int numPoints, uint32_t dmaTag);
};
struct SpuBvhMeshShape
{
ATTRIBUTE_ALIGNED16(char m_optimizedBvhBuffer[sizeof(btOptimizedBvh)+16]);
ATTRIBUTE_ALIGNED16(btTriangleIndexVertexArray m_triangleMeshInterfaceBuffer);
#define MAX_SPU_SUBTREE_HEADERS 32
///only a single mesh part for now, we can add support for multiple parts, but quantized trees don't support this at the moment
ATTRIBUTE_ALIGNED16(btIndexedMesh m_indexMesh);
ATTRIBUTE_ALIGNED16(btBvhSubtreeInfo m_subtreeHeaders[MAX_SPU_SUBTREE_HEADERS]);
ATTRIBUTE_ALIGNED16(btQuantizedBvhNode m_subtreeNodes[MAX_SUBTREE_SIZE_IN_BYTES/sizeof(btQuantizedBvhNode)]);
btOptimizedBvh* m_optimizedBvh;
btTriangleIndexVertexArray* m_triangleMeshInterface;
SpuBvhMeshShape ()
{
m_optimizedBvh = (btOptimizedBvh*)&m_optimizedBvhBuffer[0];
m_triangleMeshInterface = (btTriangleIndexVertexArray*)&m_triangleMeshInterfaceBuffer;
}
void dmaMeshInterfaceAndOptimizedBvh (const SpuInternalShape& triangleMeshShape, uint32_t dmaTag1, uint32_t dmaTag2);
void dmaIndexedMesh (int index, uint32_t dmaTag);
void dmaSubTreeHeaders (ppu_address_t subTreePtr, int numHeaders, uint32_t dmaTag);
void dmaSubTreeNodes (const btBvhSubtreeInfo& subtree, QuantizedNodeArray& nodeArray, int dmaTag);
};
struct SpuConvexPolyhedronVertexData struct SpuConvexPolyhedronVertexData
{ {
void* gSpuConvexShapePtr; void* gSpuConvexShapePtr;
@@ -90,19 +28,7 @@ struct SpuConvexPolyhedronVertexData
ATTRIBUTE_ALIGNED16(btPoint3 g_convexPointBuffer[MAX_NUM_SPU_CONVEX_POINTS]); ATTRIBUTE_ALIGNED16(btPoint3 g_convexPointBuffer[MAX_NUM_SPU_CONVEX_POINTS]);
}; };
struct SpuCompoundShape #define MAX_SHAPE_SIZE 256
{
#define MAX_SPU_COMPOUND_SUBSHAPES 16
ATTRIBUTE_ALIGNED16(btCompoundShapeChild m_subshapes[MAX_SPU_COMPOUND_SUBSHAPES]);
void dmaChildShapeInfo (btCompoundShape* compoundShape, uint32_t dmaTag);
void dmaChildShape (int childShape,
SpuInternalShape* localShape,
SpuInternalConvexHull* localShapeHull,
uint32_t dmaTag);
};
struct CollisionShape_LocalStoreMemory struct CollisionShape_LocalStoreMemory
{ {

View File

@@ -170,7 +170,7 @@ void SpuContactResult::writeDoubleBufferedManifold(btPersistentManifold* lsManif
//no, the swapBuffers does the wait //no, the swapBuffers does the wait
} }
void SpuContactResult::addContactPoint(const btVector3& normalOnBInWorld,const btPoint3& pointInWorld,btScalar depth) void SpuContactResult::addContactPoint(const btVector3& normalOnBInWorld,const btPoint3& pointInWorld,float depth)
{ {
//spu_printf("*** SpuContactResult::addContactPoint: depth = %f\n",depth); //spu_printf("*** SpuContactResult::addContactPoint: depth = %f\n",depth);

View File

@@ -31,7 +31,7 @@ subject to the following restrictions:
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
struct SpuCollisionPairInput struct SpuCollisionPairInput
{ {
@@ -53,6 +53,7 @@ struct SpuCollisionPairInput
bool m_useEpa; bool m_useEpa;
}; };
struct SpuClosestPointInput struct SpuClosestPointInput
{ {
SpuClosestPointInput() SpuClosestPointInput()
@@ -68,10 +69,9 @@ struct SpuClosestPointInput
struct SpuConvexPolyhedronVertexData* m_convexVertexData[2]; struct SpuConvexPolyhedronVertexData* m_convexVertexData[2];
}; };
///SpuContactResult exports the contact points using double-buffered DMA transfers, only when needed ///SpuContactResult exports the contact points using double-buffered DMA transfers, only when needed
///So when an existing contact point is duplicated, no transfer/refresh is performed. ///So when an existing contact point is duplicated, no transfer/refresh is performed.
class SpuContactResult : public btDiscreteCollisionDetectorInterface::Result class SpuContactResult
{ {
btTransform m_rootWorldTransform0; btTransform m_rootWorldTransform0;
btTransform m_rootWorldTransform1; btTransform m_rootWorldTransform1;
@@ -102,7 +102,7 @@ class SpuContactResult : public btDiscreteCollisionDetectorInterface::Result
void writeDoubleBufferedManifold(btPersistentManifold* lsManifold, btPersistentManifold* mmManifold); void writeDoubleBufferedManifold(btPersistentManifold* lsManifold, btPersistentManifold* mmManifold);
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btPoint3& pointInWorld,btScalar depth); virtual void addContactPoint(const btVector3& normalOnBInWorld,const btPoint3& pointInWorld,float depth);
void flush(); void flush();
}; };

View File

@@ -22,7 +22,7 @@ subject to the following restrictions:
class btStackAlloc; class btStackAlloc;
class btIDebugDraw; class btIDebugDraw;
class btVoronoiSimplexSolver; class SpuVoronoiSimplexSolver;
#include <LinearMath/btTransform.h> #include <LinearMath/btTransform.h>
#include <LinearMath/btPoint3.h> #include <LinearMath/btPoint3.h>
@@ -34,7 +34,7 @@ class SpuConvexPenetrationDepthSolver
public: public:
virtual ~SpuConvexPenetrationDepthSolver() {}; virtual ~SpuConvexPenetrationDepthSolver() {};
virtual bool calcPenDepth( btVoronoiSimplexSolver& simplexSolver, virtual bool calcPenDepth( SpuVoronoiSimplexSolver& simplexSolver,
void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB, void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB,
btTransform& transA,const btTransform& transB, btTransform& transA,const btTransform& transB,
btVector3& v, btPoint3& pa, btPoint3& pb, btVector3& v, btPoint3& pa, btPoint3& pb,

View File

@@ -13,14 +13,13 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
#include "SpuEpaPenetrationDepthSolver.h" #include "SpuEpaPenetrationDepthSolver.h"
#include "SpuVoronoiSimplexSolver.h"
#include "SpuGjkPairDetector.h"
#include "SpuContactResult.h" #include "SpuContactResult.h"
#include "SpuGjkEpa2.h" #include "SpuGjkEpa2.h"
bool SpuEpaPenetrationDepthSolver::calcPenDepth( btVoronoiSimplexSolver& simplexSolver, bool SpuEpaPenetrationDepthSolver::calcPenDepth( SpuVoronoiSimplexSolver& simplexSolver,
void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB, void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB,
btTransform& transA,const btTransform& transB, btTransform& transA,const btTransform& transB,
btVector3& v, btPoint3& pa, btPoint3& pb, btVector3& v, btPoint3& pa, btPoint3& pb,

View File

@@ -22,7 +22,7 @@ subject to the following restrictions:
class btStackAlloc; class btStackAlloc;
class btIDebugDraw; class btIDebugDraw;
class btVoronoiSimplexSolver; class SpuVoronoiSimplexSolver;
///MinkowskiPenetrationDepthSolver implements bruteforce penetration depth estimation. ///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. ///Implementation is based on sampling the depth using support mapping, and using GJK step to get the witness points.
@@ -30,7 +30,7 @@ class SpuEpaPenetrationDepthSolver : public SpuConvexPenetrationDepthSolver
{ {
public: public:
virtual bool calcPenDepth( btVoronoiSimplexSolver& simplexSolver, virtual bool calcPenDepth( SpuVoronoiSimplexSolver& simplexSolver,
void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB, void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB,
btTransform& transA,const btTransform& transB, btTransform& transA,const btTransform& transB,
btVector3& v, btPoint3& pa, btPoint3& pb, btVector3& v, btPoint3& pa, btPoint3& pb,

View File

@@ -36,7 +36,7 @@ int gSpuNumGjkChecks = 0;
SpuGjkPairDetector::SpuGjkPairDetector(void* objectA,void* objectB,int shapeTypeA, int shapeTypeB, float marginA,float marginB,btVoronoiSimplexSolver* simplexSolver, const SpuConvexPenetrationDepthSolver* penetrationDepthSolver) SpuGjkPairDetector::SpuGjkPairDetector(void* objectA,void* objectB,int shapeTypeA, int shapeTypeB, float marginA,float marginB,SpuVoronoiSimplexSolver* simplexSolver, const SpuConvexPenetrationDepthSolver* penetrationDepthSolver)
:m_cachedSeparatingAxis(float(0.),float(0.),float(1.)), :m_cachedSeparatingAxis(float(0.),float(0.),float(1.)),
m_penetrationDepthSolver(penetrationDepthSolver), m_penetrationDepthSolver(penetrationDepthSolver),
m_simplexSolver(simplexSolver), m_simplexSolver(simplexSolver),

View File

@@ -24,15 +24,18 @@ subject to the following restrictions:
#include "SpuContactResult.h" #include "SpuContactResult.h"
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "SpuVoronoiSimplexSolver.h"
class SpuConvexPenetrationDepthSolver; class SpuConvexPenetrationDepthSolver;
/// btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface /// btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
class SpuGjkPairDetector class SpuGjkPairDetector
{ {
btVector3 m_cachedSeparatingAxis; btVector3 m_cachedSeparatingAxis;
const SpuConvexPenetrationDepthSolver* m_penetrationDepthSolver; const SpuConvexPenetrationDepthSolver* m_penetrationDepthSolver;
btVoronoiSimplexSolver* m_simplexSolver; SpuVoronoiSimplexSolver* m_simplexSolver;
void* m_minkowskiA; void* m_minkowskiA;
void* m_minkowskiB; void* m_minkowskiB;
int m_shapeTypeA; int m_shapeTypeA;
@@ -51,7 +54,7 @@ public:
int m_catchDegeneracies; int m_catchDegeneracies;
SpuGjkPairDetector(void* objectA,void* objectB,int m_shapeTypeA, int m_shapeTypeB, float marginA, float marginB, btVoronoiSimplexSolver* simplexSolver, const SpuConvexPenetrationDepthSolver* penetrationDepthSolver); SpuGjkPairDetector(void* objectA,void* objectB,int m_shapeTypeA, int m_shapeTypeB, float marginA, float marginB, SpuVoronoiSimplexSolver* simplexSolver, const SpuConvexPenetrationDepthSolver* penetrationDepthSolver);
virtual ~SpuGjkPairDetector() {}; virtual ~SpuGjkPairDetector() {};
virtual void getClosestPoints(const SpuClosestPointInput& input,SpuContactResult& output); virtual void getClosestPoints(const SpuClosestPointInput& input,SpuContactResult& output);

View File

@@ -13,15 +13,15 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
#include "SpuCollisionShapes.h"
#include "SpuMinkowskiPenetrationDepthSolver.h" #include "SpuMinkowskiPenetrationDepthSolver.h"
#include "SpuVoronoiSimplexSolver.h"
#include "SpuGjkPairDetector.h"
#include "SpuContactResult.h" #include "SpuContactResult.h"
#include "SpuPreferredPenetrationDirections.h" #include "SpuPreferredPenetrationDirections.h"
#include "SpuCollisionShapes.h"
#define NUM_UNITSPHERE_POINTS 42 #define NUM_UNITSPHERE_POINTS 42
static btVector3 sPenetrationDirections[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2] = static btVector3 sPenetrationDirections[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2] =
{ {
@@ -69,7 +69,7 @@ btVector3(btScalar(-0.425323) , btScalar(0.309011),btScalar(0.850654)),
btVector3(btScalar(0.162456) , btScalar(0.499995),btScalar(0.850654)) btVector3(btScalar(0.162456) , btScalar(0.499995),btScalar(0.850654))
}; };
bool SpuMinkowskiPenetrationDepthSolver::calcPenDepth( btVoronoiSimplexSolver& simplexSolver, bool SpuMinkowskiPenetrationDepthSolver::calcPenDepth( SpuVoronoiSimplexSolver& simplexSolver,
void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB, void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB,
btTransform& transA,const btTransform& transB, btTransform& transA,const btTransform& transB,
btVector3& v, btPoint3& pa, btPoint3& pb, btVector3& v, btPoint3& pa, btPoint3& pb,
@@ -113,7 +113,7 @@ bool SpuMinkowskiPenetrationDepthSolver::calcPenDepth( btVoronoiSimplexSolver& s
//just take fixed number of orientation, and sample the penetration depth in that direction //just take fixed number of orientation, and sample the penetration depth in that direction
btScalar minProj = btScalar(1e30); btScalar minProj = btScalar(1e30);
btVector3 minNorm = btVector3(btScalar(0.0f), btScalar(0.0f), btScalar(0.0f)); btVector3 minNorm;
btVector3 minVertex; btVector3 minVertex;
btVector3 minA,minB; btVector3 minA,minB;
btVector3 seperatingAxisInA,seperatingAxisInB; btVector3 seperatingAxisInA,seperatingAxisInB;
@@ -291,8 +291,7 @@ bool SpuMinkowskiPenetrationDepthSolver::calcPenDepth( btVoronoiSimplexSolver& s
} }
#endif //DEBUG_DRAW #endif //DEBUG_DRAW
return false;
#if 0 //FIXME
SpuGjkPairDetector gjkdet(convexA,convexB,shapeTypeA,shapeTypeB,marginA,marginB,&simplexSolver,0); SpuGjkPairDetector gjkdet(convexA,convexB,shapeTypeA,shapeTypeB,marginA,marginB,&simplexSolver,0);
@@ -342,7 +341,6 @@ bool SpuMinkowskiPenetrationDepthSolver::calcPenDepth( btVoronoiSimplexSolver& s
btAssert (false); btAssert (false);
} }
return res.m_hasResult; return res.m_hasResult;
#endif
} }

View File

@@ -22,7 +22,7 @@ subject to the following restrictions:
class btStackAlloc; class btStackAlloc;
class btIDebugDraw; class btIDebugDraw;
class btVoronoiSimplexSolver; class SpuVoronoiSimplexSolver;
///MinkowskiPenetrationDepthSolver implements bruteforce penetration depth estimation. ///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. ///Implementation is based on sampling the depth using support mapping, and using GJK step to get the witness points.
@@ -30,7 +30,7 @@ class SpuMinkowskiPenetrationDepthSolver : public SpuConvexPenetrationDepthSolve
{ {
public: public:
virtual bool calcPenDepth( btVoronoiSimplexSolver& simplexSolver, virtual bool calcPenDepth( SpuVoronoiSimplexSolver& simplexSolver,
void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB, void* convexA,void* convexB,int shapeTypeA, int shapeTypeB, float marginA, float marginB,
btTransform& transA,const btTransform& transB, btTransform& transA,const btTransform& transB,
btVector3& v, btPoint3& pa, btPoint3& pb, btVector3& v, btPoint3& pa, btPoint3& pb,

View File

@@ -632,7 +632,7 @@ void performRaycastAgainstCompound (RaycastGatheredObjectData* gatheredObjectDat
void void
performRaycastAgainstConvex (RaycastGatheredObjectData* gatheredObjectData, const SpuRaycastTaskWorkUnit& workUnit, SpuRaycastTaskWorkUnitOut* workUnitOut, RaycastTask_LocalStoreMemory* lsMemPtr) performRaycastAgainstConvex (RaycastGatheredObjectData* gatheredObjectData, const SpuRaycastTaskWorkUnit& workUnit, SpuRaycastTaskWorkUnitOut* workUnitOut, RaycastTask_LocalStoreMemory* lsMemPtr)
{ {
btVoronoiSimplexSolver simplexSolver; SpuVoronoiSimplexSolver simplexSolver;
btTransform rayFromTrans, rayToTrans; btTransform rayFromTrans, rayToTrans;
rayFromTrans.setIdentity (); rayFromTrans.setIdentity ();

View File

@@ -22,7 +22,7 @@ subject to the following restrictions:
SpuSubsimplexRayCast::SpuSubsimplexRayCast (void* shapeB, SpuConvexPolyhedronVertexData* convexDataB, int shapeTypeB, float marginB, SpuSubsimplexRayCast::SpuSubsimplexRayCast (void* shapeB, SpuConvexPolyhedronVertexData* convexDataB, int shapeTypeB, float marginB,
btVoronoiSimplexSolver* simplexSolver) SpuVoronoiSimplexSolver* simplexSolver)
:m_simplexSolver(simplexSolver), m_shapeB(shapeB), m_convexDataB(convexDataB), m_shapeTypeB(shapeTypeB), m_marginB(marginB) :m_simplexSolver(simplexSolver), m_shapeB(shapeB), m_convexDataB(convexDataB), m_shapeTypeB(shapeTypeB), m_marginB(marginB)
{ {
} }

View File

@@ -17,7 +17,7 @@ subject to the following restrictions:
#ifndef SPU_SUBSIMPLEX_RAY_CAST_H #ifndef SPU_SUBSIMPLEX_RAY_CAST_H
#define SPU_SUBSIMPLEX_RAY_CAST_H #define SPU_SUBSIMPLEX_RAY_CAST_H
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h" #include "../SpuNarrowPhaseCollisionTask/SpuVoronoiSimplexSolver.h"
#include "../SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h" #include "../SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h"
#include "SpuRaycastTask.h" #include "SpuRaycastTask.h"
@@ -35,7 +35,7 @@ struct SpuCastResult
/// Objects should not start in overlap, otherwise results are not defined. /// Objects should not start in overlap, otherwise results are not defined.
class SpuSubsimplexRayCast class SpuSubsimplexRayCast
{ {
btVoronoiSimplexSolver* m_simplexSolver; SpuVoronoiSimplexSolver* m_simplexSolver;
void* m_shapeB; void* m_shapeB;
SpuConvexPolyhedronVertexData* m_convexDataB; SpuConvexPolyhedronVertexData* m_convexDataB;
int m_shapeTypeB; int m_shapeTypeB;
@@ -43,7 +43,7 @@ class SpuSubsimplexRayCast
public: public:
SpuSubsimplexRayCast (void* shapeB, SpuConvexPolyhedronVertexData* convexDataB, int shapeTypeB, float marginB, SpuSubsimplexRayCast (void* shapeB, SpuConvexPolyhedronVertexData* convexDataB, int shapeTypeB, float marginB,
btVoronoiSimplexSolver* simplexSolver); SpuVoronoiSimplexSolver* simplexSolver);
//virtual ~btSubsimplexConvexCast(); //virtual ~btSubsimplexConvexCast();