More work on serialization and BulletFileLoader

This commit is contained in:
erwin.coumans
2010-01-22 00:15:33 +00:00
parent 50aa82a240
commit 26a056e629
49 changed files with 6714 additions and 160 deletions

View File

@@ -310,43 +310,9 @@ public:
}
}
virtual int calculateSerializeBufferSize();
///fills the dataBuffer and returns the struct name (and 0 on failure)
virtual const char* serialize(void* dataBuffer) const;
};
struct btBoxShapeData
{
btCollisionShapeData m_collisionShapeData;
btVector3Data m_halfExtents;
btVector3Data m_localScaling;
};
SIMD_FORCE_INLINE int btBoxShape::calculateSerializeBufferSize()
{
return sizeof(btBoxShapeData);
}
///fills the dataBuffer and returns the struct name (and 0 on failure)
SIMD_FORCE_INLINE const char* btBoxShape::serialize(void* dataBuffer) const
{
btBoxShapeData* boxData = (btBoxShapeData*) dataBuffer;
btCollisionShape::serialize(&boxData->m_collisionShapeData);
m_implicitShapeDimensions.serialize(boxData->m_halfExtents);
m_localScaling.serialize(boxData->m_localScaling);
return "btBoxShapeData";
}
#endif //OBB_BOX_MINKOWSKI_H

View File

@@ -109,11 +109,54 @@ public:
btAssert(0);
}
virtual int calculateSerializeBufferSize();
///fills the dataBuffer and returns the struct name (and 0 on failure)
virtual const char* serialize(void* dataBuffer) const;
};
struct btConvexInternalShapeData
{
btCollisionShapeData m_collisionShapeData;
btVector3Data m_localScaling;
btVector3Data m_implicitShapeDimensions;
btScalar m_collisionMargin;
char m_padding[4];
};
SIMD_FORCE_INLINE int btConvexInternalShape::calculateSerializeBufferSize()
{
return sizeof(btConvexInternalShapeData);
}
///fills the dataBuffer and returns the struct name (and 0 on failure)
SIMD_FORCE_INLINE const char* btConvexInternalShape::serialize(void* dataBuffer) const
{
btConvexInternalShapeData* shapeData = (btConvexInternalShapeData*) dataBuffer;
btCollisionShape::serialize(&shapeData->m_collisionShapeData);
m_implicitShapeDimensions.serialize(shapeData->m_implicitShapeDimensions);
m_localScaling.serialize(shapeData->m_localScaling);
shapeData->m_collisionMargin = m_collisionMargin;
return "btConvexInternalShapeData";
}
///btConvexInternalAabbCachingShape adds local aabb caching for convex shapes, to avoid expensive bounding box calculations
class btConvexInternalAabbCachingShape : public btConvexInternalShape
{