Estimating buffer size for btDefaultSerializer

Post Reply
User avatar
riotnrrd
Posts: 3
Joined: Thu Jul 12, 2012 11:41 pm

Estimating buffer size for btDefaultSerializer

Post by riotnrrd »

According to earlier posts (dating back to 2010 or before), "there is no method to pre-calculate the buffer size" for the btDefaultSerializer. Is this still the case? Is there a way to at least get an overestimate, so we can safely allocate the buffer for writing? I'm currently doing something like:

Code: Select all

size_t totalBytes = 0;
for (size_t ii=0; ii<_myCollisionShapes.size(); ++ii
{
    totalBytes += _myCollisionShapes[ii]->calculateSerializeBufferSize();
}
totalBytes *= 1024; // Fudge factor
But I realize that if "calculateSerializeBufferSize" isn't accurate, even this crude estimate could be wrong.
Post Reply