Added better support for btUniformScalingShape, by moving some data that is not shared from btConvexShape to btConvexInternalShape. This reduces the sizeof btUniformScalingShape to 16 bytes (from 64).

This is good when having lots of re-used shapes with different sizes.

Convex shapes will need to derive from btConvexInternalShape (which is a subclass of btConvexShape). We could have renamed btConvexShape to 'btConvexShapeInterface' (can still do that later)
This commit is contained in:
ejcoumans
2007-07-28 21:10:21 +00:00
parent 177b6f5ce2
commit 38b7f474c3
14 changed files with 294 additions and 146 deletions

View File

@@ -306,7 +306,7 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT
//recalc aabbs
btTransform convexInTriangleSpace;
convexInTriangleSpace = wuInput->m_worldTransform1.inverse() * wuInput->m_worldTransform0;
btConvexShape* convexShape = (btConvexShape*)wuInput->m_spuCollisionShapes[0];
btConvexInternalShape* convexShape = (btConvexInternalShape*)wuInput->m_spuCollisionShapes[0];
//calculate the aabb, given the types...
switch (wuInput->m_shapeType0)
{
@@ -878,8 +878,8 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
cellDmaWaitTagStatusAll(DMA_MASK(2));
}
btConvexShape* spuConvexShape0 = (btConvexShape*)lsMem.gCollisionShape0;
btConvexShape* spuConvexShape1 = (btConvexShape*)lsMem.gCollisionShape1;
btConvexInternalShape* spuConvexShape0 = (btConvexInternalShape*)lsMem.gCollisionShape0;
btConvexInternalShape* spuConvexShape1 = (btConvexInternalShape*)lsMem.gCollisionShape1;
btVector3 dim0 = spuConvexShape0->getImplicitShapeDimensions();
btVector3 dim1 = spuConvexShape1->getImplicitShapeDimensions();
@@ -943,7 +943,7 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
cellDmaGet(lsMem.gCollisionShape1, dmaPpuAddress2 , dmaSize, DMA_TAG(2), 0, 0);
cellDmaWaitTagStatusAll(DMA_MASK(2));
}
btConvexShape* spuConvexShape0 = (btConvexShape*)lsMem.gCollisionShape0;
btConvexInternalShape* spuConvexShape0 = (btConvexInternalShape*)lsMem.gCollisionShape0;
btBvhTriangleMeshShape* trimeshShape = (btBvhTriangleMeshShape*)lsMem.gCollisionShape1;
btVector3 dim0 = spuConvexShape0->getImplicitShapeDimensions();

View File

@@ -17,7 +17,7 @@ subject to the following restrictions:
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/CollisionShapes/btConvexInternalShape.h"
#include "BulletCollision/CollisionShapes/btCylinderShape.h"
#define MAX_NUM_SPU_CONVEX_POINTS 128
@@ -47,7 +47,7 @@ inline btPoint3 localGetSupportingVertexWithoutMargin(int shapeType, void* shape
case BOX_SHAPE_PROXYTYPE:
{
// spu_printf("SPU: getSupport BOX_SHAPE_PROXYTYPE\n");
btConvexShape* convexShape = (btConvexShape*)shape;
btConvexInternalShape* convexShape = (btConvexInternalShape*)shape;
btVector3 halfExtents = convexShape->getImplicitShapeDimensions();
float margin = convexShape->getMarginNV();
halfExtents -= btVector3(margin,margin,margin);
@@ -137,7 +137,7 @@ inline btPoint3 localGetSupportingVertexWithoutMargin(int shapeType, void* shape
//spu_printf("SPU: todo: getSupport CAPSULE_SHAPE_PROXYTYPE\n");
btVector3 vec0(localDir.getX(),localDir.getY(),localDir.getZ());
btConvexShape* cnvxShape = (btConvexShape*)shape;
btConvexInternalShape* cnvxShape = (btConvexInternalShape*)shape;
btVector3 halfExtents = cnvxShape->getImplicitShapeDimensions();
btScalar halfHeight = halfExtents.getY();
btScalar radius = halfExtents.getX();