In my pursuit of simulating soil digging, I started to evaluate the PolyVox library. This is a report on that evaluation.
Building on MacOSX is tricky. With LLVM version 4.2 (clang-425.0.28) installed, this error comes up when compiling the very first file: fatal error: 'cstdint' file not found. According to this StackOverflow thread this should be solved by invoking with: /usr/bin/clang++ -std=c++11 but I found this not to be the case. So instead I decided to just drag in the source files into a new XCode project.
After dragging in sources and headers, you need to set the project's header include path. It needs to find its way to polyvox/library/PolyVoxCore/include/ e.g.
In PolyVoxCore two warnings are issued by the compiler for SurfaceMesh::addVertex() and SurfaceMesh::getNoOfIndices() because they return 32 bit ints, and vector::size() returns 64 bit ints. Other than this, the code is very clean. Even LLVM's Analyzer does not find anything else on it.
PolyVox can store the volume as a series of 32x32x32 blocks. It would make sense to do the surface extraction on a per-block basis. That way, if voxels change, you only have to create new OpenGL VBOs for the blocks that are affected. It's not entirely clear how to do this. It may be enough to create multiple extractors on 32/32/32 boundaries, and then only execute extractors for blocks that have changed.