added serialization support for gimpact mesh

improved cmake build system for updating the serialization structures
This commit is contained in:
erwin.coumans
2010-01-29 02:50:34 +00:00
parent 701bc64ab7
commit 37f6df2c32
25 changed files with 721 additions and 459 deletions

View File

@@ -41,7 +41,7 @@ public:
const btVector3& getHalfExtentsWithoutMargin() const
{
return m_implicitShapeDimensions;//changed in Bullet 2.63: assume the scaling and margin are included
return m_implicitShapeDimensions;//scaling is included, margin is not
}

View File

@@ -181,3 +181,23 @@ void btGImpactMeshShape::processAllTriangles(btTriangleCallback* callback,const
m_mesh_parts[i]->processAllTriangles(callback,aabbMin,aabbMax);
}
}
///fills the dataBuffer and returns the struct name (and 0 on failure)
const char* btGImpactMeshShape::serialize(void* dataBuffer, btSerializer* serializer) const
{
btGImpactMeshShapeData* trimeshData = (btGImpactMeshShapeData*) dataBuffer;
btCollisionShape::serialize(&trimeshData->m_collisionShapeData,serializer);
m_meshInterface->serialize(&trimeshData->m_meshInterface, serializer);
trimeshData->m_collisionMargin = float(m_collisionMargin);
localScaling.serializeFloat(trimeshData->m_localScaling);
trimeshData->m_gimpactSubType = int(getGImpactShapeType());
return "btGImpactMeshShapeData";
}

View File

@@ -189,7 +189,7 @@ public:
//!@{
//! Base method for determinig which kind of GIMPACT shape we get
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() = 0;
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const = 0 ;
//! gets boxset
SIMD_FORCE_INLINE btGImpactBoxSet * getBoxSet()
@@ -502,7 +502,7 @@ public:
return "GImpactCompound";
}
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType()
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
{
return CONST_GIMPACT_COMPOUND_SHAPE;
}
@@ -816,7 +816,7 @@ public:
return "GImpactMeshShapePart";
}
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType()
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
{
return CONST_GIMPACT_TRIMESH_SHAPE_PART;
}
@@ -1122,7 +1122,7 @@ public:
}
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType()
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const
{
return CONST_GIMPACT_TRIMESH_SHAPE;
}
@@ -1140,7 +1140,32 @@ public:
It gives the triangles in local space
*/
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
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;
};
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
struct btGImpactMeshShapeData
{
btCollisionShapeData m_collisionShapeData;
btStridingMeshInterfaceData m_meshInterface;
btVector3FloatData m_localScaling;
float m_collisionMargin;
int m_gimpactSubType;
};
SIMD_FORCE_INLINE int btGImpactMeshShape::calculateSerializeBufferSize() const
{
return sizeof(btGImpactMeshShapeData);
}
#endif //GIMPACT_MESH_SHAPE_H