Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

Serialization question
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=604
Page 1 of 1

Author:  decev [ Fri Aug 01, 2014 11:49 am ]
Post subject:  Serialization question

Hi,

Thanks for working on PolyVox. The more recent versions of PolyVox removed built in serialization, asking us to do it ourselves. That's fine, but the only public way I can find to access the voxel data is through getVoxel(). That would work fine for small Volumes, but for something large it won't work very well. Is there a way to access compressed blocks in a LargeVolume so that I can directly read and write the compressed blocks to/from disk?

Thanks!

Author:  David Williams [ Fri Aug 01, 2014 1:34 pm ]
Post subject:  Re: Serialization question

decev wrote:
...the only public way I can find to access the voxel data is through getVoxel(). That would work fine for small Volumes, but for something large it won't work very well. Is there a way to access compressed blocks in a LargeVolume so that I can directly read and write the compressed blocks to/from disk? Thanks!


As I recall, getVoxel()/setVoxel() is currently the only correct way to get/set the data, and you are correct that this is probably sub-optimal from a performance point of view. I think there's some unnecessary compression/decompression going on there as well.

It might well make sense to expose a pointer to the underlying data, or to overload '<<' to allow steaming of all the data at once. But actually the internal ordering of the voxels could change in the future, for example to store them in Z-Curve order rather than linear order. A streaming operator might be able to handle this though.

Actually, the plan is top replace LargeVolume with a 'PagedVolume' which removes the two-level hierarchy (compressed and uncompressed blocks) and stores/pages only uncompressed blocks, leaving compression to the user. This should make everything a bit simpler and more direct.

Practically speaking, you might just want to expose a pointer to the raw data in the mean time.

Author:  petersvp [ Fri Aug 01, 2014 11:31 pm ]
Post subject:  Re: Serialization question

As all of Polyvox is open-source, just hack the Large Volume yourself, expose this nasty private pointer to the entire universe and dump it's pointee as you like. It seems to work but if you upgrade polyvox, your map format might become useless. I tried this approach but ... cancelled my wish, and implemented own file-per-chunk approach with boost::serialization::binary_*archive and get/setVoxelAt().

Author:  decev [ Mon Aug 04, 2014 12:46 am ]
Post subject:  Re: Serialization question

Makes sense, thanks guys. I just wanted to check to make sure there wasn't another way before doing the pointer approach.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/