+ Fix btSubsimplexConvexCast
Thanks to Nacho, http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=2422) Fix in rendering, GL_STENCIL + btTriangleIndexVertexArray indices should be unsigned int/unsigned short int, + Made InternalProcessAllTriangles virtual, thanks to Both thank to Fullmetalcoder, http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=2401 +clamp impulse for btPoint2PointConstraint Thanks to Martijn Reuvers, http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=2418 + Free memory of bvh, pass in scaling factor (optional) Thanks to Roy Eltham, http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=2375
This commit is contained in:
@@ -181,19 +181,23 @@ void SpuGatheringCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPai
|
||||
{
|
||||
btCollisionObject* colObj0 = (btCollisionObject*)collisionPair.m_pProxy0->m_clientObject;
|
||||
btCollisionObject* colObj1 = (btCollisionObject*)collisionPair.m_pProxy1->m_clientObject;
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,20 +270,20 @@ public:
|
||||
// ugly solution to support both 16bit and 32bit indices
|
||||
if (m_lsMemPtr->bvhShapeData.gIndexMesh.m_indexType == PHY_SHORT)
|
||||
{
|
||||
short int* indexBasePtr = (short int*)(m_lsMemPtr->bvhShapeData.gIndexMesh.m_triangleIndexBase+triangleIndex*m_lsMemPtr->bvhShapeData.gIndexMesh.m_triangleIndexStride);
|
||||
ATTRIBUTE_ALIGNED16(short int tmpIndices[3]);
|
||||
unsigned short int* indexBasePtr = (unsigned short int*)(m_lsMemPtr->bvhShapeData.gIndexMesh.m_triangleIndexBase+triangleIndex*m_lsMemPtr->bvhShapeData.gIndexMesh.m_triangleIndexStride);
|
||||
ATTRIBUTE_ALIGNED16(unsigned short int tmpIndices[3]);
|
||||
|
||||
small_cache_read_triple(&tmpIndices[0],(ppu_address_t)&indexBasePtr[0],
|
||||
&tmpIndices[1],(ppu_address_t)&indexBasePtr[1],
|
||||
&tmpIndices[2],(ppu_address_t)&indexBasePtr[2],
|
||||
sizeof(short int));
|
||||
sizeof(unsigned short int));
|
||||
|
||||
m_lsMemPtr->spuIndices[0] = int(tmpIndices[0]);
|
||||
m_lsMemPtr->spuIndices[1] = int(tmpIndices[1]);
|
||||
m_lsMemPtr->spuIndices[2] = int(tmpIndices[2]);
|
||||
} else
|
||||
{
|
||||
int* indexBasePtr = (int*)(m_lsMemPtr->bvhShapeData.gIndexMesh.m_triangleIndexBase+triangleIndex*m_lsMemPtr->bvhShapeData.gIndexMesh.m_triangleIndexStride);
|
||||
unsigned int* indexBasePtr = (unsigned int*)(m_lsMemPtr->bvhShapeData.gIndexMesh.m_triangleIndexBase+triangleIndex*m_lsMemPtr->bvhShapeData.gIndexMesh.m_triangleIndexStride);
|
||||
|
||||
small_cache_read_triple(&m_lsMemPtr->spuIndices[0],(ppu_address_t)&indexBasePtr[0],
|
||||
&m_lsMemPtr->spuIndices[1],(ppu_address_t)&indexBasePtr[1],
|
||||
@@ -978,9 +978,12 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
|
||||
// Get the collision objects
|
||||
dmaAndSetupCollisionObjects(collisionPairInput, lsMem);
|
||||
|
||||
handleCollisionPair(collisionPairInput, lsMem, spuContacts,
|
||||
(ppu_address_t)lsMem.getColObj0()->getCollisionShape(), &lsMem.gCollisionShapes[0].collisionShape,
|
||||
(ppu_address_t)lsMem.getColObj1()->getCollisionShape(), &lsMem.gCollisionShapes[1].collisionShape);
|
||||
if (lsMem.getColObj0()->isActive() || lsMem.getColObj1()->isActive())
|
||||
{
|
||||
handleCollisionPair(collisionPairInput, lsMem, spuContacts,
|
||||
(ppu_address_t)lsMem.getColObj0()->getCollisionShape(), &lsMem.gCollisionShapes[0].collisionShape,
|
||||
(ppu_address_t)lsMem.getColObj1()->getCollisionShape(), &lsMem.gCollisionShapes[1].collisionShape);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,9 +404,9 @@ void spuWalkStacklessQuantizedTreeAgainstRays(RaycastTask_LocalStoreMemory* lsMe
|
||||
|
||||
#define RAYAABB2
|
||||
#ifdef RAYAABB2
|
||||
unsigned int sign[numWorkUnits][3];
|
||||
btVector3 rayInvDirection[numWorkUnits];
|
||||
btScalar lambda_max[numWorkUnits];
|
||||
unsigned int sign[SPU_RAYCAST_WORK_UNITS_PER_TASK][3];
|
||||
btVector3 rayInvDirection[SPU_RAYCAST_WORK_UNITS_PER_TASK];
|
||||
btScalar lambda_max[SPU_RAYCAST_WORK_UNITS_PER_TASK];
|
||||
for (int i = 0; i < numWorkUnits; i++)
|
||||
{
|
||||
btVector3 rayDirection = (rayTo[i]-rayFrom[i]);
|
||||
@@ -512,10 +512,10 @@ void performRaycastAgainstConcave (RaycastGatheredObjectData* gatheredObjectData
|
||||
//need the mesh interface, for access to triangle vertices
|
||||
dmaBvhShapeData (&(lsMemPtr->bvhShapeData), trimeshShape);
|
||||
|
||||
unsigned short int quantizedQueryAabbMin[numWorkUnits][3];
|
||||
unsigned short int quantizedQueryAabbMax[numWorkUnits][3];
|
||||
btVector3 rayFromInTriangleSpace[numWorkUnits];
|
||||
btVector3 rayToInTriangleSpace[numWorkUnits];
|
||||
unsigned short int quantizedQueryAabbMin[SPU_RAYCAST_WORK_UNITS_PER_TASK][3];
|
||||
unsigned short int quantizedQueryAabbMax[SPU_RAYCAST_WORK_UNITS_PER_TASK][3];
|
||||
btVector3 rayFromInTriangleSpace[SPU_RAYCAST_WORK_UNITS_PER_TASK];
|
||||
btVector3 rayToInTriangleSpace[SPU_RAYCAST_WORK_UNITS_PER_TASK];
|
||||
|
||||
/* Calculate the AABB for the ray in the triangle mesh shape */
|
||||
btTransform rayInTriangleSpace;
|
||||
@@ -781,4 +781,4 @@ void processRaycastTask(void* userPtr, void* lsMemory)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user