Sounds logic to me. But I get an error trieing to do so.
For example we take the code from the Tutorial with a few changes:
Code:
PolyVox::Region region(Vector3DInt32(0,0,0), Vector3DInt32(200,200,200));
SimpleVolume<uint8_t> volData(region);
SurfaceMesh<PositionMaterialNormal> mesh;
We define our global Volume because i just need one and so I dont have to pass it as parameter. Inside of createSphere I create a new region where I want to set Voxels and where I want to create a mesh.
Code:
SimpleMesh createSphereInVolume()
{
PolyVox::Region mRegion(Vector3DInt32(10,10,10), Vector3DInt32(20,20,20));
Vector3DFloat v3dVolCenter(15, 15, 15);
float fRadius = 3.0f;
for (int z = 10; z < 20; z++)
{
for (int y = 10; y < 20; y++)
{
for (int x = 10; x < 20; x++)
{
Vector3DFloat v3dCurrentPos(x,y,z);
float fDistToCenter = (v3dCurrentPos - v3dVolCenter).length();
uint8_t uVoxelValue = 0;
if(fDistToCenter <= fRadius)
{
uVoxelValue = 255;
}
volData.setVoxelAt(x, y, z, uVoxelValue);
}
}
}
CubicSurfaceExtractorWithNormals< SimpleVolume<uint8_t> > surfaceExtractor(&volData, mRegion, &mesh);
surfaceExtractor.execute();
return mesh;
}
(Sorry if I miss some pointers or things I normally program in C# with PolyVox. So but I think the idea behind this is clear
)
The Problem is after execute(), there are no datas stored in mesh (no vertices, no indices)