Code: Select all
btAssert(!btBroadphaseProxy::isCompound(childShape0.m_childShapeType));
After this check it just recursively calls the function handleCollisionPair() which can deal with 2 compound objects any way.
Code: Select all
else if (btBroadphaseProxy::isCompound(collisionPairInput.m_shapeType0) &&
btBroadphaseProxy::isCompound(collisionPairInput.m_shapeType1))
{
//snPause();
dmaCollisionShape (collisionShape0Loc, collisionShape0Ptr, 1, collisionPairInput.m_shapeType0);
dmaCollisionShape (collisionShape1Loc, collisionShape1Ptr, 2, collisionPairInput.m_shapeType1);
cellDmaWaitTagStatusAll(DMA_MASK(1) | DMA_MASK(2));
// Both are compounds, do N^2 CD for now
///@todo: add some AABB-based pruning (probably not -> slower)
btCompoundShape* spuCompoundShape0 = (btCompoundShape*)collisionShape0Loc;
btCompoundShape* spuCompoundShape1 = (btCompoundShape*)collisionShape1Loc;
dmaCompoundShapeInfo (&lsMem.compoundShapeData[0], spuCompoundShape0, 1);
dmaCompoundShapeInfo (&lsMem.compoundShapeData[1], spuCompoundShape1, 2);
cellDmaWaitTagStatusAll(DMA_MASK(1) | DMA_MASK(2));
dmaCompoundSubShapes (&lsMem.compoundShapeData[0], spuCompoundShape0, 1);
cellDmaWaitTagStatusAll(DMA_MASK(1));
dmaCompoundSubShapes (&lsMem.compoundShapeData[1], spuCompoundShape1, 1);
cellDmaWaitTagStatusAll(DMA_MASK(1));
int childShapeCount0 = spuCompoundShape0->getNumChildShapes();
btAssert(childShapeCount0< MAX_SPU_COMPOUND_SUBSHAPES);
int childShapeCount1 = spuCompoundShape1->getNumChildShapes();
btAssert(childShapeCount1< MAX_SPU_COMPOUND_SUBSHAPES);
// Start the N^2
for (int i = 0; i < childShapeCount0; ++i)
{
btCompoundShapeChild& childShape0 = lsMem.compoundShapeData[0].gSubshapes[i];
//btAssert(!btBroadphaseProxy::isCompound(childShape0.m_childShapeType));
for (int j = 0; j < childShapeCount1; ++j)
{
btCompoundShapeChild& childShape1 = lsMem.compoundShapeData[1].gSubshapes[j];
//btAssert(!btBroadphaseProxy::isCompound(childShape1.m_childShapeType));
/* Create a new collision pair input struct using the two child shapes */
SpuCollisionPairInput cinput (collisionPairInput);
cinput.m_worldTransform0 = collisionPairInput.m_worldTransform0 * childShape0.m_transform;
cinput.m_shapeType0 = childShape0.m_childShapeType;
cinput.m_collisionMargin0 = childShape0.m_childMargin;
cinput.m_worldTransform1 = collisionPairInput.m_worldTransform1 * childShape1.m_transform;
cinput.m_shapeType1 = childShape1.m_childShapeType;
cinput.m_collisionMargin1 = childShape1.m_childMargin;
/* Recursively call handleCollisionPair () with new collision pair input */
handleCollisionPair(cinput, lsMem, spuContacts,
(ppu_address_t)childShape0.m_childShape, lsMem.compoundShapeData[0].gSubshapeShape[i],
(ppu_address_t)childShape1.m_childShape, lsMem.compoundShapeData[1].gSubshapeShape[j], false);
}
}
}