- added 'init' function for DoubleBuffer, in case constructor is not called.

- use proper transform for concave case
thanks Marten for the patch
This commit is contained in:
ejcoumans
2007-08-15 04:16:25 +00:00
parent 635632acf9
commit b43b8f0f75
2 changed files with 17 additions and 7 deletions

View File

@@ -25,6 +25,8 @@ public:
bool isPending() const { return m_dmaPending;}
DoubleBuffer();
void init ();
// dma get and put commands
void backBufferDmaGet(uint64_t ea, unsigned int numBytes, unsigned int tag);
void backBufferDmaPut(uint64_t ea, unsigned int numBytes, unsigned int tag);
@@ -41,9 +43,15 @@ public:
template<class T, int size>
DoubleBuffer<T,size>::DoubleBuffer()
{
m_dmaPending = false;
m_frontBuffer = &m_buffer0[0];
m_backBuffer = &m_buffer1[0];
init ();
}
template<class T, int size>
void DoubleBuffer<T,size>::init()
{
this->m_dmaPending = false;
this->m_frontBuffer = &this->m_buffer0[0];
this->m_backBuffer = &this->m_buffer1[0];
}
template<class T, int size>

View File

@@ -324,7 +324,7 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT
{
float margin=convexShape->getMarginNV();
btVector3 halfExtents = convexShape->getImplicitShapeDimensions();
btTransform& t = wuInput->m_worldTransform0;
btTransform& t = convexInTriangleSpace;
btMatrix3x3 abs_b = t.getBasis().absolute();
btPoint3 center = t.getOrigin();
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),
@@ -343,7 +343,7 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT
//add the radius to y-axis to get full height
btScalar radius = halfExtents[0];
halfExtents[1] += radius;
btTransform& t = wuInput->m_worldTransform0;
btTransform& t = convexInTriangleSpace;
btMatrix3x3 abs_b = t.getBasis().absolute();
btPoint3 center = t.getOrigin();
btVector3 extent = btVector3(abs_b[0].dot(halfExtents),
@@ -360,7 +360,7 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT
{
float radius = convexShape->getImplicitShapeDimensions().getX();// * convexShape->getLocalScaling().getX();
float margin = radius + convexShape->getMarginNV();
btTransform& t = wuInput->m_worldTransform0;
btTransform& t = convexInTriangleSpace;
const btVector3& center = t.getOrigin();
btVector3 extent(margin,margin,margin);
aabbMin = center - extent;
@@ -377,7 +377,7 @@ void ProcessConvexConcaveSpuCollision(SpuCollisionPairInput* wuInput, CollisionT
cellDmaGet(&convexHullShape0, dmaPpuAddress2 , dmaSize, DMA_TAG(1), 0, 0);
cellDmaWaitTagStatusAll(DMA_MASK(1));
btConvexHullShape* localPtr = (btConvexHullShape*)&convexHullShape0;
btTransform& t = wuInput->m_worldTransform0;
btTransform& t = convexInTriangleSpace;
btScalar margin = convexShape->getMarginNV();
@@ -1042,6 +1042,8 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
unsigned int numOnLastPage = taskDesc.numOnLastPage;
// prefetch first set of inputs and wait
lsMem.g_workUnitTaskBuffers.init();
unsigned int nextNumOnPage = (numPages > 1)? MIDPHASE_NUM_WORKUNITS_PER_PAGE : numOnLastPage;
lsMem.g_workUnitTaskBuffers.backBufferDmaGet(dmaInPtr, nextNumOnPage*sizeof(SpuGatherAndProcessWorkUnitInput), DMA_TAG(3));
dmaInPtr += MIDPHASE_WORKUNIT_PAGE_SIZE;