text format serialization ?

User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

text format serialization ?

Post by majestik666 »

Since am debugging hard my determinism problems
I was wondering if it would be a good thing
to be able to serialize the scene to a text format.

The deserialization would be more complex obviously
but in a first time being able to serialize to a text format
to compare 2 scenes easily would be a really good debugging
tool.

Any thoughts ?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: text format serialization ?

Post by Erwin Coumans »

There is text output in the console for debugging in the btBulletWorldImporter, make sure to enable verbose mode, and make sure that the .bullet file matches the current platform.

Code: Select all

m_fileLoader->setVerboseMode(true);
m_fileLoader->loadFile("testFile.bullet");
If the .bullet file was exported on a different platform (endianness/32bit/64bit etc) you can just export the .bullet again right after loading, and load the native .bullet file with full verbose mode:

Code: Select all

{
		btDefaultSerializer*	serializer = new btDefaultSerializer(0);
		m_dynamicsWorld->serialize(serializer);
		FILE* f2 = fopen("testFile2.bullet","wb");
		fwrite(serializer->getBufferPointer(),serializer->getCurrentBufferSize(),1,f2);
		fclose(f2);
}

Thanks,
Erwin