allow the Bullet world importer to save a copy with swapped endianness

See http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=8191
This commit is contained in:
erwin.coumans
2012-10-31 07:25:54 +00:00
parent ff38230704
commit 595dab2337
5 changed files with 315 additions and 21 deletions

View File

@@ -37,12 +37,18 @@ btBulletWorldImporter::~btBulletWorldImporter()
}
bool btBulletWorldImporter::loadFile( const char* fileName)
bool btBulletWorldImporter::loadFile( const char* fileName, const char* preSwapFilenameOut)
{
bParse::btBulletFile* bulletFile2 = new bParse::btBulletFile(fileName);
bool result = loadFileFromMemory(bulletFile2);
if (preSwapFilenameOut)
bulletFile2->preSwap(preSwapFilenameOut);
delete bulletFile2;
return result;

View File

@@ -47,7 +47,9 @@ public:
virtual ~btBulletWorldImporter();
bool loadFile(const char* fileName);
///if you pass a valid preSwapFilenameOut, it will save a new file with a different endianness
///this pre-swapped file can be loaded without swapping on a target platform of different endianness
bool loadFile(const char* fileName, const char* preSwapFilenameOut=0);
///the memoryBuffer might be modified (for example if endian swaps are necessary)
bool loadFileFromMemory(char *memoryBuffer, int len);