I'm sorry for you on-going frustration here. There are indeed some issues surrounding PolyVox such as the lack of (or outdated) documentation, seemingly strange design decisions, or incoming changes which break existing code. But you have to remember that it is primarily being used
by us as a basis for Cubiquity and so some of these other tasks take lower priority because we already know how it works.
It is currently undergoing a significant overhaul (see the 'incoming changes' thread), but this only started a couple of weeks ago and you can expect more disruption in the coming weeks. I do think it will get easier and more robust to use but it's never going to be a drop-in voxel solution - it's just a container for volume data and set of algorithms which can be used for processing such data.
But fundamentally
it does work. Regarding your problem with extracting a mesh, modifying the data, and then extracting the mesh again, the followng code (a modified BasicExample) works as expected:
Code:
//Create an empty volume and then place a sphere in it
SimpleVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)));
createSphereInVolume(volData, 30);
// Extract the surface for the specified region of the volume.
auto mesh = extractCubicSurface(&volData, volData.getEnclosingRegion());
// Print the number of vertices
std::cout << "No of verts: " << mesh.getNoOfVertices() << std::endl;
// Iterate over the volume and set half the voxels to be empty
int midpoint = 32;
for (int z = 0; z < midpoint; z++)
{
for (int y = 0; y < volData.getHeight(); y++)
{
for (int x = 0; x < volData.getWidth(); x++)
{
volData.setVoxelAt(x, y, z, 0);
}
}
}
// Extract the mesh again
mesh = extractCubicSurface(&volData, volData.getEnclosingRegion());
// Print the number of vertices again
std::cout << "No of verts: " << mesh.getNoOfVertices() << std::endl;
There is only one volume here. We create it, write some data into it (the sphere), and then extract the mesh. Then we write some more data (setting half the voxels to zero) and extract again.
The output is:
Quote:
No of verts: 8996
No of verts: 4718
You can see that after setting half the volume to empty there are roughly half as many vertices, and if I now draw the mesh I do see half a sphere. You already have the sphere working, so perhaps you can try dropping in the above code?
Midnight wrote:
Am I supposed to be using a volume resampler?
No, you have no use for the VolumeResampler (also ignore the SmoothLOD example for now, just look at BasicExample).