15 #ifndef __SPU_COLLISION_SHAPES_H
16 #define __SPU_COLLISION_SHAPES_H
18 #include "../SpuDoubleBuffer.h"
36 #define MAX_NUM_SPU_CONVEX_POINTS 128 //@fallback to PPU if a btConvexHullShape has more than MAX_NUM_SPU_CONVEX_POINTS points
37 #define MAX_SPU_COMPOUND_SUBSHAPES 16 //@fallback on PPU if compound has more than MAX_SPU_COMPOUND_SUBSHAPES child shapes
38 #define MAX_SHAPE_SIZE 256 //@todo: assert on this
77 #define MAX_SPU_SUBTREE_HEADERS 32
97 #define USE_BRANCHFREE_TEST 1
98 #ifdef USE_BRANCHFREE_TEST
101 #if defined(__CELLOS_LV2__) && defined (__SPU__)
102 vec_ushort8 vecMin = {aabbMin1[0],aabbMin2[0],aabbMin1[2],aabbMin2[2],aabbMin1[1],aabbMin2[1],0,0};
103 vec_ushort8 vecMax = {aabbMax2[0],aabbMax1[0],aabbMax2[2],aabbMax1[2],aabbMax2[1],aabbMax1[1],0,0};
105 return spu_extract(spu_gather(isGt),0)==0;
108 return btSelect((
unsigned)((aabbMin1[0] <= aabbMax2[0]) & (aabbMax1[0] >= aabbMin2[0])
109 & (aabbMin1[2] <= aabbMax2[2]) & (aabbMax1[2] >= aabbMin2[2])
110 & (aabbMin1[1] <= aabbMax2[1]) & (aabbMax1[1] >= aabbMin2[1])),
118 unsigned int overlap = 1;
119 overlap = (aabbMin1[0] > aabbMax2[0] || aabbMax1[0] < aabbMin2[0]) ? 0 : overlap;
120 overlap = (aabbMin1[2] > aabbMax2[2] || aabbMax1[2] < aabbMin2[2]) ? 0 : overlap;
121 overlap = (aabbMin1[1] > aabbMax2[1] || aabbMax1[1] < aabbMin2[1]) ? 0 : overlap;
unsigned btSelect(unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero)
btSelect avoids branches, which makes performance much better for consoles like Playstation 3 and XBo...
void dmaBvhIndexedMesh(btIndexedMesh *IndexMesh, IndexedMeshArray &indexArray, int index, uint32_t dmaTag)
The btIndexedMesh indexes a single vertex and index array.
void computeAabb(btVector3 &aabbMin, btVector3 &aabbMax, btConvexInternalShape *convexShape, ppu_address_t convexShapePtr, int shapeType, const btTransform &xform)
not supported on IBM SDK, until we fix the alignment of btVector3
The btConvexInternalShape is an internal base class, shared by most convex shape implementations.
#define SIMD_FORCE_INLINE
void dmaCompoundSubShapes(CompoundShape_LocalStoreMemory *compoundShapeLocation, btCompoundShape *spuCompoundShape, uint32_t dmaTag)
void dmaCompoundShapeInfo(CompoundShape_LocalStoreMemory *compoundShapeLocation, btCompoundShape *spuCompoundShape, uint32_t dmaTag)
btBvhSubtreeInfo provides info to gather a subtree of limited size
void spuWalkStacklessQuantizedTree(btNodeOverlapCallback *nodeCallback, unsigned short int *quantizedQueryAabbMin, unsigned short int *quantizedQueryAabbMax, const btQuantizedBvhNode *rootNode, int startNodeIndex, int endNodeIndex)
The btBvhTriangleMeshShape is a static-triangle mesh shape, it can only be used for fixed/non-moving ...
void dmaBvhSubTreeHeaders(btBvhSubtreeInfo *subTreeHeaders, ppu_address_t subTreePtr, int batchSize, uint32_t dmaTag)
The btTriangleIndexVertexArray allows to access multiple triangle meshes, by indexing into existing t...
The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes, through the btStridingMeshInterface.
void dmaBvhSubTreeNodes(btQuantizedBvhNode *nodes, const btBvhSubtreeInfo &subtree, QuantizedNodeArray &nodeArray, int dmaTag)
btQuantizedBvhNode is a compressed aabb node, 16 bytes.
void dmaBvhShapeData(bvhMeshShape_LocalStoreMemory *bvhMeshShape, btBvhTriangleMeshShape *triMeshShape)
btVector3 can be used to represent 3D points and vectors.
#define ATTRIBUTE_ALIGNED16(a)
btVector3 * gConvexPoints
void dmaConvexVertexData(SpuConvexPolyhedronVertexData *convexVertexData, btConvexHullShape *convexShapeSPU)
#define MAX_SUBTREE_SIZE_IN_BYTES
int getShapeTypeSize(int shapeType)
getShapeTypeSize could easily be optimized, but it is not likely a bottleneck
The btConvexHullShape implements an implicit convex hull of an array of vertices. ...
btTriangleIndexVertexArray * gTriangleMeshInterfacePtr
void dmaCollisionShape(void *collisionShapeLocation, ppu_address_t collisionShapePtr, uint32_t dmaTag, int shapeType)
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
#define MAX_SPU_COMPOUND_SUBSHAPES
#define MAX_NUM_SPU_CONVEX_POINTS
unsigned int spuTestQuantizedAabbAgainstQuantizedAabb(unsigned short int *aabbMin1, unsigned short int *aabbMax1, const unsigned short int *aabbMin2, const unsigned short int *aabbMax2)
#define MAX_SPU_SUBTREE_HEADERS
btOptimizedBvh * getOptimizedBvh()
void * gSpuConvexShapePtr