drwbns wrote:
So smaller regions are the only answer? It seems as though 100MB is tiny when you have 8 GB of RAM. How can I avoid memory fragmentation?
You can read about memory fragmentation here:
http://stackoverflow.com/questions/3770 ... gmentationBasically, doing a small number of large allocations is more difficult than doing a large number of small allocations, even when the total amount of memory allocated is the same.
However, for PolyVox the more important consideration is allowing the terrain to be dynamic. I don't know how long it is taking you to run the surface extraction but I'd imagine it is a few seconds. If you have to regenerate the whole mesh when you change just one voxel then this won't be interactive. But if you have a large number of non-overlapping meshes then, when you modify a voxel, you only need to regenerate a small number of surrounding meshes.
drwbns wrote:
I'm going to try smaller regions and see if I can devise a solution for splitting everything into smaller regions, even for mesh extraction.
Yes, that is what you need to do.
drwbns wrote:
Also, what is the diffrence between shiftUpperCorner and setUpperCorner?
setUpperCorner() moves the corner to an absolute position, where shiftUpperCorner() moves it relative to it's current position (i.e. for adjusting it slightly).
drwbns wrote:
Are there any code snippets for handling voxel regions?
You can have a look at the VolumeChangeTracker in PolyVoxUtil for some ideas, though overall you should probably implement something yourself rather than using it directly. PolyVox is only concerned with giving you a mesh for the requested region. Deciding how to manage these, when to update then, etc is all left to the users code as it can vary for different applications.