Make argument to btDefaultSerializer optional, and use zero by default. This will dynamically allocate data, so there is no need to guess the maximum size anymore.

Remove some cached data from SoftBodyLinkData, to reduce serialization file size.
This commit is contained in:
erwin.coumans
2010-12-04 01:23:31 +00:00
parent 6173a30bce
commit ba5012973d
5 changed files with 519 additions and 486 deletions

View File

@@ -3102,10 +3102,6 @@ const char* btSoftBody::serialize(void* dataBuffer, class btSerializer* serializ
for (int i=0;i<numElem;i++,memPtr++)
{
memPtr->m_bbending = m_links[i].m_bbending;
memPtr->m_c0 = m_links[i].m_c0;
memPtr->m_c1 = m_links[i].m_c1;
memPtr->m_c2 = m_links[i].m_c2;
m_links[i].m_c3.serializeFloat(memPtr->m_c3);
memPtr->m_material = m_links[i].m_material? (SoftBodyMaterialData*)serializer->getUniquePointer((void*) m_links[i].m_material):0;
memPtr->m_nodeIndices[0] = m_links[i].m_n[0] ? m_links[i].m_n[0] - &m_nodes[0]: -1;
memPtr->m_nodeIndices[1] = m_links[i].m_n[1] ? m_links[i].m_n[1] - &m_nodes[0]: -1;

View File

@@ -46,13 +46,8 @@ struct SoftBodyLinkData
{
SoftBodyMaterialData *m_material;
int m_nodeIndices[2]; // Node pointers
btVector3FloatData m_c3; // gradient
float m_restLength; // Rest length
int m_bbending; // Bending link
float m_c0; // (ima+imb)*kLST
float m_c1; // rl^2
float m_c2; // |gradient|^2/c0
int m_pad;
};
struct SoftBodyFaceData