Hi all,
I'm integrating PolyVox into Ogre with a ManualObject and using the following code to fill in voxels with a max density.
Code:
for (int z = 1; z < volData.getWidth() - 1; z++)
{
for (int y = 1; y < volData.getHeight() - 1; y++)
{
for (int x = 1; x < volData.getDepth() - 1; x++)
{
// New density value.
uint8_t uDensity = PolyVox::MaterialDensityPair44::getMaxDensity();
// Get the old voxel.
PolyVox::MaterialDensityPair44 voxel = volData.getVoxelAt(x, y, z);
// Modify the density.
voxel.setDensity(uDensity);
// Write the voxel value into the volume.
volData.setVoxelAt(x, y, z, voxel);
}
}
}
However, as you can probably see, this skips the edges. This method renders perfectly, however, and all blocks can be seen. To fix the edge issue, I attempted to change the code to:
Code:
for (int z = 0; z < volData.getWidth(); z++)
{
for (int y = 0; y < volData.getHeight(); y++)
{
for (int x = 0; x < volData.getDepth(); x++)
{
// New density value.
uint8_t uDensity = PolyVox::MaterialDensityPair44::getMaxDensity();
// Get the old voxel.
PolyVox::MaterialDensityPair44 voxel = volData.getVoxelAt(x, y, z);
// Modify the density.
voxel.setDensity(uDensity);
// Write the voxel value into the volume.
volData.setVoxelAt(x, y, z, voxel);
}
}
}
However, now nothing is rendered at all. Am I attempting to do something stupid, or is this a bug? Any help is appreciated, thanks.