Add support to serialize btOptimizedBvh/btQuantizedBvh for a btBvhTriangleMeshShape (using the new btSerializer). This is a new implementation, with full cross-platform support.

So it is different from the in-place method (btQuantizedBvh::serializeInPlace/deserializeInPlace).

It is also possible to serialize/deserialize just the bvh, using the btSerializer (needs some code snippet/helper)
See also http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=4770
This commit is contained in:
erwin.coumans
2010-02-23 09:03:46 +00:00
parent e4c3c2a1a2
commit 41e9115bca
15 changed files with 929 additions and 451 deletions

View File

@@ -83,32 +83,35 @@ public:
return m_useQuantizedAabbCompression;
}
//virtual int calculateSerializeBufferSize();
virtual int calculateSerializeBufferSize() const;
///fills the dataBuffer and returns the struct name (and 0 on failure)
//virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
};
#if 0
struct btBvhTriangleMeshShapeData
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
struct btTriangleMeshShapeData
{
btCollisionShapeData m_collisionShapeData;
btTriangleMeshShapeData m_trimeshData;
//btOptimizedBvhData m_bvh;
btStridingMeshInterfaceData m_meshInterface;
char m_useQuantizedAabbCompression;
char m_ownsBvh;
btQuantizedBvhFloatData *m_quantizedFloatBvh;
btQuantizedBvhDoubleData *m_quantizedDoubleBvh;
float m_collisionMargin;
char m_pad3[4];
};
SIMD_FORCE_INLINE int btBvhTriangleMeshShape::calculateSerializeBufferSize()
SIMD_FORCE_INLINE int btBvhTriangleMeshShape::calculateSerializeBufferSize() const
{
return sizeof(btBvhTriangleMeshShapeData);
return sizeof(btTriangleMeshShapeData);
}
#endif
#endif //BVH_TRIANGLE_MESH_SHAPE_H