Added some improvements on Bullet serialization:

Introduced generated unique id's, instead of the pointer address to avoid 64bit->32bit truncation issues
Use serializer->getUniquePointer instead of directly using a pointer

moved  ChunkUtils::getNextBlock to bFile::getNextBlock.
Moved 'TEST_BACKWARD_FORWARD_COMPATIBILITY' to bDNA.cpp. Enable the define for further testing of .bullet format
Removed duplicate definitions and use the one in LinearMath/btSerialization.h
This commit is contained in:
erwin.coumans
2010-02-28 20:50:50 +00:00
parent d5ea1d569f
commit 9acb3d1805
19 changed files with 266 additions and 185 deletions

View File

@@ -299,12 +299,12 @@ const char* btCompoundShape::serialize(void* dataBuffer, btSerializer* serialize
{
btChunk* chunk = serializer->allocate(sizeof(btCompoundShapeChildData),shapeData->m_numChildShapes);
btCompoundShapeChildData* memPtr = (btCompoundShapeChildData*)chunk->m_oldPtr;
shapeData->m_childShapePtr = memPtr;
shapeData->m_childShapePtr = (btCompoundShapeChildData*)serializer->getUniquePointer(memPtr);
for (int i=0;i<shapeData->m_numChildShapes;i++,memPtr++)
{
memPtr->m_childMargin = float(m_children[i].m_childMargin);
memPtr->m_childShape = (btCollisionShapeData*)m_children[i].m_childShape;
memPtr->m_childShape = (btCollisionShapeData*)serializer->getUniquePointer(m_children[i].m_childShape);
//don't serialize shapes that already have been serialized
if (!serializer->findPointer(memPtr->m_childShape))
{