Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Endian swap
PostPosted: Mon Jun 11, 2012 10:45 am 
Offline

Joined: Mon Jun 11, 2012 10:30 am
Posts: 1
i am currently looking at a way of endian swapping .bullet files for an xbox360 project. currently files exported from Maya on my pc are saved as little endian and converted to big endian at load time. i was wondering if there is a export option to control the endian type that a file is exported as? or any other helpful endian swapping tool for .bullet files?

thanks in advance and i apologise if this question has already been answered.


Top
 Profile  
 
 Post subject: Re: Endian swap
PostPosted: Fri Jun 29, 2012 1:30 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
I haven't tried this yet, but it would be a useful feature.

One idea is to use the BulletFileLoader using the in-memory buffer, and forcing a endian swap, before you write the data to disk.
Can you let us know if you have a solution?
Thanks,
Erwin


Top
 Profile  
 
 Post subject: Re: Endian swap
PostPosted: Wed Oct 31, 2012 1:06 am 
Offline

Joined: Wed Oct 10, 2012 12:38 am
Posts: 6
has no one done this yet? I think I'm going to have to do it; we export from the PC to various platforms, so it'd be a lot nicer to pre-swap.
I also notice that the 'extras' folder source-files aren't as careful as the 'src' folders regarding use of the btAllocators. There are several calls to operator new[], and I bet there are corresponding operator delete[]s I haven't found yet.
Two more things: the DNA seems wasteful when building for a console. It looks like it'll abort the read with ""Failed to find DNA1+SDNA pair\n"" if I strip the DNA sections out of the platform-specific game builds, unless I modify bFile.cpp.
And finally, if I want to leave the bullet file's image in memory, re-using the data (load-in-place) wherever possible, I'd have to add that functionality as well, right? For example, the shape-data objects that hold the triangle data have perfectly valid arrays that are duplicated when the shapes themselves are made. It'd be nice to save that data too.

It seems like I'm proposing some major changes to bFile/btBulletFile. It seems to me that these are common features, though, so I hope that I can avoid re-inventing any wheels!


Top
 Profile  
 
 Post subject: Re: Endian swap
PostPosted: Wed Oct 31, 2012 7:28 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
I just had a look, and added a endianness swap to btBulletWorldImporter and bFile.

https://code.google.com/p/bullet/source/detail?r=2618

Can you test it and let us know if that works for you?
Quote:
the DNA seems wasteful when building for a console.

Indeed. One option to reduce the DNA size a lot for small files that only contain few Bullet structures is to only save DNA structures that are actually used.
Right now, the full DNA is always attached.

Quote:
And finally, if I want to leave the bullet file's image in memory, re-using the data (load-in-place) wherever possible, I'd have to add that functionality as well, right?

Indeed, it should be possibly to avoid further duplication of data and use the Bullet file data in-place. It needs some work.
If you have time to work on it please consider sharing it.

Thanks!
Erwin


Top
 Profile  
 
 Post subject: Re: Endian swap
PostPosted: Wed Oct 31, 2012 8:39 pm 
Offline

Joined: Wed Oct 10, 2012 12:38 am
Posts: 6
Erwin Coumans wrote:
I just had a look, and added a endianness swap to btBulletWorldImporter and bFile.

https://code.google.com/p/bullet/source/detail?r=2618

Can you test it and let us know if that works for you?


I'm building with it now, and I'll hook it up to our toolchain. Thanks for the quick response!

Soon I'll see if replacing "new char[]" with btAlignedAlloc calls will force every allocation to go through my library's allocation code, and see if I can come up with a simple way to handle in-place loading. I think the key there will be to distinquish between delete()able pointers and ones that point to in-place data. I have some potentially cunning ideas.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group