Mesh decimation now works for levels 0,1,2 and 3.

This commit is contained in:
David Williams 2008-06-13 21:05:45 +00:00
parent 0751ff2fad
commit 5eb5d33aa1
3 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ namespace PolyVox
regionGeometry.m_patchSingleMaterial = new IndexedSurfacePatch(false);
regionGeometry.m_v3dRegionPosition = iterChangedRegions->getLowerCorner();
generateDecimatedMeshDataForRegion(volume.getVolumeData(), 1, *iterChangedRegions, regionGeometry.m_patchSingleMaterial);
generateDecimatedMeshDataForRegion(volume.getVolumeData(), 0, *iterChangedRegions, regionGeometry.m_patchSingleMaterial);
//genMultiFromSingle(regionGeometry.m_patchSingleMaterial, regionGeometry.m_patchMultiMaterial);

View File

@ -39,10 +39,10 @@ namespace PolyVox
const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
//When generating the mesh for a region we actually look one voxel outside it in the
//When generating the mesh for a region we actually look outside it in the
// back, bottom, right direction. Protect against access violations by cropping region here
Region regVolume = volumeData->getEnclosingRegion();
regVolume.setUpperCorner(regVolume.getUpperCorner() - Vector3DInt32(uLevel+uStepSize,uLevel+uStepSize,uLevel+uStepSize));
regVolume.setUpperCorner(regVolume.getUpperCorner() - Vector3DInt32(2*uStepSize-1,2*uStepSize-1,2*uStepSize-1));
region.cropTo(regVolume);
//Offset from volume corner

View File

@ -64,7 +64,7 @@ namespace PolyVox
listToFill.clear();
//Regenerate meshes.
for(uint16_t regionZ = 0; regionZ < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS-1; ++regionZ)
for(uint16_t regionZ = 0; regionZ < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionZ)
//for(uint16_t regionZ = 0; regionZ < 1; ++regionZ)
{
for(uint16_t regionY = 0; regionY < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionY)