Over the last week or so I've been working to allow different volume representations to be used in PolyVox. The idea is that rather than there being a single volume class (currently called Volume) it will be possible to have more than one, and for people to choose the class which is most appropriate for their needs.
So far I have renamed the existing 'Volume' class to 'LargeVolume' and have added a new class called 'SimpleVolume'. LargeVolume continues to support compression and paging, and currently stores its blocks in an std::map. SimpleVolume is, well, simpler. It uses fixed size blocks stored in a fixed size array and avoids any STL containers.
Hopefully SimpleVolume will address some of the problems people have had with the new Volume class, particularly with speed and threading. It also provides a simpler example of how volumes should work and a basis for people to create their own if they need to. People have also been talking about copying data from one volume to another to allow multithreaded surface extraction, and the SimpleVolume might be useful for this.
However, to implement this I've had to break the interface to PolyVox. In particular, algorithms such as surface extractors are now templatised on VolumeType as well as VoxelType.
So instead of something like:
Code:
SurfaceExtractor<MaterialDensityPair44 > surfaceExtractor(...);
You will need to use something like:
Code:
SurfaceExtractor<SimpleVolume, MaterialDensityPair44 > surfaceExtractor(...);
I'm not yet certain exactly which algorithms this is going to affect. Also, the VolumeSampler has been moved to be a nested class inside whichever volume you are using. So if you want to create a volume sampler then instead of:
Code:
VolumeSampler<Material8> mySampler;
you now have to use something like:
Code:
LargeVolume<Material8>::Sampler mySampler;
This may change further in the future.
Anyway, do the class names make sense? I was also thinking 'AdvancedVolume' vs 'BasicVolume', 'LargeVolume' vs 'SmallVolume', etc? Any thoughts are welcome. I guess in the future I could imagine ThreadSafeVolume, OctreeVolume, RawVolume, etc?
It's not finished but in princple seems to be working out ok. But I'm not going to get a chance to do any coding for the next week or so, so will pick it up after that. In the meantime I would not recommend you get latest from Git as it's a little messy at the moment