Renamed BlockVolume to Volume.

Renamed BlockVolumeIterator to VolumeIterator.
This commit is contained in:
David Williams
2009-03-19 22:04:34 +00:00
parent 1dcec5bd3b
commit d951f4d3b0
29 changed files with 202 additions and 202 deletions

View File

@ -8,7 +8,7 @@ using namespace std;
namespace PolyVox
{
POLYVOX_API void computeNormalsForVertices(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod)
POLYVOX_API void computeNormalsForVertices(Volume<uint8>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod)
{
std::vector<SurfaceVertex>& vecVertices = isp.getRawVertexData();
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
@ -17,7 +17,7 @@ namespace PolyVox
const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(isp.m_v3dRegionPosition);
const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
BlockVolumeIterator<uint8> volIter(*volumeData);
VolumeIterator<uint8> volIter(*volumeData);
//Check all corners are within the volume, allowing a boundary for gradient estimation
bool lowerCornerInside = volumeData->containsPoint(v3dFloor,2);
@ -39,11 +39,11 @@ namespace PolyVox
}
}
Vector3DFloat computeNormal(BlockVolume<uint8>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod)
Vector3DFloat computeNormal(Volume<uint8>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod)
{
Vector3DFloat v3dGradient; //To store the result
BlockVolumeIterator<uint8> volIter(*volumeData);
VolumeIterator<uint8> volIter(*volumeData);
const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);

View File

@ -21,12 +21,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "PolyVoxCore/PolyVoxImpl/DecimatedSurfaceExtractor.h"
#include "PolyVoxCore/BlockVolume.h"
#include "PolyVoxCore/Volume.h"
#include "PolyVoxCore/GradientEstimators.h"
#include "PolyVoxCore/IndexedSurfacePatch.h"
#include "PolyVoxCore/MarchingCubesTables.h"
#include "PolyVoxCore/Region.h"
#include "PolyVoxCore/BlockVolumeIterator.h"
#include "PolyVoxCore/VolumeIterator.h"
#include <algorithm>
@ -39,7 +39,7 @@ namespace PolyVox
return x + (y * (POLYVOX_REGION_SIDE_LENGTH+1));
}
void extractDecimatedSurfaceImpl(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
void extractDecimatedSurfaceImpl(Volume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
{
singleMaterialPatch->clear();
@ -73,7 +73,7 @@ namespace PolyVox
regSlice0.setUpperCorner(v3dUpperCorner);
//Iterator to access the volume data
BlockVolumeIterator<uint8> volIter(*volumeData);
VolumeIterator<uint8> volIter(*volumeData);
//Compute bitmask for initial slice
uint32 uNoOfNonEmptyCellsForSlice0 = computeInitialDecimatedBitmaskForSlice(volIter, uLevel, regSlice0, offset, bitmask0);
@ -128,7 +128,7 @@ namespace PolyVox
}*/
}
uint32 computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask)
uint32 computeInitialDecimatedBitmaskForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask)
{
const uint8 uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
uint32 uNoOfNonEmptyCells = 0;
@ -297,7 +297,7 @@ namespace PolyVox
return uNoOfNonEmptyCells;
}
uint32 computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, uint8* previousBitmask)
uint32 computeDecimatedBitmaskForSliceFromPrevious(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, uint8* previousBitmask)
{
const uint8 uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
uint32 uNoOfNonEmptyCells = 0;
@ -423,7 +423,7 @@ namespace PolyVox
return uNoOfNonEmptyCells;
}
void generateDecimatedVerticesForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[])
void generateDecimatedVerticesForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[])
{
const uint8 uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
@ -494,7 +494,7 @@ namespace PolyVox
}
}
void generateDecimatedIndicesForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[])
void generateDecimatedIndicesForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[])
{
const uint8 uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
uint32 indlist[12];

View File

@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "PolyVoxCore/PolyVoxImpl/FastSurfaceExtractor.h"
#include "PolyVoxCore/BlockVolumeIterator.h"
#include "PolyVoxCore/VolumeIterator.h"
#include "PolyVoxCore/IndexedSurfacePatch.h"
#include "PolyVoxCore/MarchingCubesTables.h"
#include "PolyVoxCore/SurfaceVertex.h"
@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
void extractFastSurfaceImpl(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
void extractFastSurfaceImpl(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
{
singleMaterialPatch->clear();
@ -59,7 +59,7 @@ namespace PolyVox
regSlice0.setUpperCorner(Vector3DInt32(regSlice0.getUpperCorner().getX(),regSlice0.getUpperCorner().getY(),regSlice0.getLowerCorner().getZ()));
//Iterator to access the volume data
BlockVolumeIterator<uint8> volIter(*volumeData);
VolumeIterator<uint8> volIter(*volumeData);
//Compute bitmask for initial slice
uint32 uNoOfNonEmptyCellsForSlice0 = computeInitialRoughBitmaskForSlice(volIter, regSlice0, offset, bitmask0);
@ -110,7 +110,7 @@ namespace PolyVox
return x + (y * (POLYVOX_REGION_SIDE_LENGTH+1));
}
uint32 computeInitialRoughBitmaskForSlice(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask)
uint32 computeInitialRoughBitmaskForSlice(VolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask)
{
uint32 uNoOfNonEmptyCells = 0;
@ -260,7 +260,7 @@ namespace PolyVox
return uNoOfNonEmptyCells;
}
uint32 computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, uint8* previousBitmask)
uint32 computeRoughBitmaskForSliceFromPrevious(VolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, uint8* previousBitmask)
{
uint32 uNoOfNonEmptyCells = 0;
@ -376,7 +376,7 @@ namespace PolyVox
return uNoOfNonEmptyCells;
}
void generateRoughVerticesForSlice(BlockVolumeIterator<uint8>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[])
void generateRoughVerticesForSlice(VolumeIterator<uint8>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[])
{
//Iterate over each cell in the region
volIter.setPosition(regSlice.getLowerCorner().getX(),regSlice.getLowerCorner().getY(), regSlice.getLowerCorner().getZ());
@ -443,7 +443,7 @@ namespace PolyVox
}while(volIter.moveForwardInRegionXYZ());//For each cell
}
void generateRoughIndicesForSlice(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[])
void generateRoughIndicesForSlice(VolumeIterator<uint8>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[])
{
uint32 indlist[12];

View File

@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "PolyVoxCore/PolyVoxImpl/ReferenceSurfaceExtractor.h"
#include "PolyVoxCore/BlockVolume.h"
#include "PolyVoxCore/BlockVolumeIterator.h"
#include "PolyVoxCore/Volume.h"
#include "PolyVoxCore/VolumeIterator.h"
#include "PolyVoxCore/IndexedSurfacePatch.h"
#include "PolyVoxCore/MarchingCubesTables.h"
#include "PolyVoxCore/Region.h"
@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
void extractReferenceSurfaceImpl(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
void extractReferenceSurfaceImpl(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
{
static int32 vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
static int32 vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
@ -54,7 +54,7 @@ namespace PolyVox
Vector3DFloat vertlist[12];
Vector3DFloat normlist[12];
uint8 vertMaterials[12];
BlockVolumeIterator<uint8> volIter(*volumeData);
VolumeIterator<uint8> volIter(*volumeData);
volIter.setValidRegion(region);
//////////////////////////////////////////////////////////////////////////

View File

@ -1,6 +1,6 @@
#include "PolyVoxCore/SurfaceAdjusters.h"
#include "PolyVoxCore/BlockVolumeIterator.h"
#include "PolyVoxCore/VolumeIterator.h"
#include "PolyVoxCore/GradientEstimators.h"
#include "PolyVoxCore/IndexedSurfacePatch.h"
#include "PolyVoxCore/Utility.h"
@ -12,12 +12,12 @@ using namespace std;
namespace PolyVox
{
void smoothRegionGeometry(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp)
void smoothRegionGeometry(Volume<uint8>* volumeData, IndexedSurfacePatch& isp)
{
const uint8 uSmoothingFactor = 2;
const float fThreshold = 0.5f;
BlockVolumeIterator<uint8> volIter(*volumeData);
VolumeIterator<uint8> volIter(*volumeData);
std::vector<SurfaceVertex>& vecVertices = isp.getRawVertexData();
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
@ -76,9 +76,9 @@ namespace PolyVox
} //while(iterSurfaceVertex != vecVertices.end())
}
void adjustDecimatedGeometry(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp, uint8 val)
void adjustDecimatedGeometry(Volume<uint8>* volumeData, IndexedSurfacePatch& isp, uint8 val)
{
BlockVolumeIterator<uint8> volIter(*volumeData);
VolumeIterator<uint8> volIter(*volumeData);
std::vector<SurfaceVertex>& vecVertices = isp.getRawVertexData();
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
@ -87,7 +87,7 @@ namespace PolyVox
Vector3DFloat v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(isp.m_v3dRegionPosition);
Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
BlockVolumeIterator<uint8> volIter(*volumeData);
VolumeIterator<uint8> volIter(*volumeData);
//Check all corners are within the volume, allowing a boundary for gradient estimation
bool lowerCornerInside = volumeData->containsPoint(v3dFloor,1);

View File

@ -1,12 +1,12 @@
#include "PolyVoxCore/SurfaceExtractors.h"
#include "PolyVoxCore/BlockVolume.h"
#include "PolyVoxCore/Volume.h"
#include "PolyVoxCore/GradientEstimators.h"
#include "PolyVoxCore/IndexedSurfacePatch.h"
#include "PolyVoxCore/MarchingCubesTables.h"
#include "PolyVoxCore/Region.h"
#include "PolyVoxCore/SurfaceAdjusters.h"
#include "PolyVoxCore/BlockVolumeIterator.h"
#include "PolyVoxCore/VolumeIterator.h"
#include "PolyVoxCore/PolyVoxImpl/DecimatedSurfaceExtractor.h"
#include "PolyVoxCore/PolyVoxImpl/FastSurfaceExtractor.h"
@ -18,7 +18,7 @@ using namespace std;
namespace PolyVox
{
void extractSurface(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
void extractSurface(Volume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
{
if(uLevel == 0)
{
@ -32,7 +32,7 @@ namespace PolyVox
singleMaterialPatch->m_v3dRegionPosition = region.getLowerCorner();
}
void extractReferenceSurface(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
void extractReferenceSurface(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
{
extractReferenceSurfaceImpl(volumeData, region, singleMaterialPatch);

View File

@ -1,10 +1,10 @@
#include "PolyVoxCore/VoxelFilters.h"
#include "PolyVoxCore/BlockVolumeIterator.h"
#include "PolyVoxCore/VolumeIterator.h"
namespace PolyVox
{
float computeSmoothedVoxel(BlockVolumeIterator<uint8>& volIter)
float computeSmoothedVoxel(VolumeIterator<uint8>& volIter)
{
assert(volIter.getPosX() >= 1);
assert(volIter.getPosY() >= 1);

View File

@ -1,7 +1,7 @@
#include "PolyVoxUtil/Serialization.h"
#include "PolyVoxCore/BlockVolume.h"
#include "PolyVoxCore/BlockVolumeIterator.h"
#include "PolyVoxCore/Volume.h"
#include "PolyVoxCore/VolumeIterator.h"
#include "PolyVoxCore/Utility.h"
using namespace std;
@ -10,7 +10,7 @@ namespace PolyVox
{
//Note: we don't do much error handling in here - exceptions will simply be propergated up to the caller.
//FIXME - think about pointer ownership issues. Or could return volume by value if the copy constructor is shallow
BlockVolume<uint8>* loadVolumeRaw(istream& stream)
Volume<uint8>* loadVolumeRaw(istream& stream)
{
//Read volume dimensions
uint8 volumeWidthPower = 0;
@ -21,7 +21,7 @@ namespace PolyVox
stream.read(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
//FIXME - need to support non cubic volumes
BlockVolume<uint8>* volume = new BlockVolume<uint8>(volumeWidthPower);
Volume<uint8>* volume = new Volume<uint8>(volumeWidthPower);
uint16 volumeWidth = 0x0001 << volumeWidthPower;
uint16 volumeHeight = 0x0001 << volumeHeightPower;
@ -45,7 +45,7 @@ namespace PolyVox
return volume;
}
void saveVolumeRaw(std::ostream& stream, BlockVolume<uint8>& volume)
void saveVolumeRaw(std::ostream& stream, Volume<uint8>& volume)
{
//Write volume dimensions
uint16 volumeWidth = volume.getSideLength();
@ -61,7 +61,7 @@ namespace PolyVox
stream.write(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
//Write data
BlockVolumeIterator<uint8> volIter(volume);
VolumeIterator<uint8> volIter(volume);
for(uint16 z = 0; z < volumeDepth; ++z)
{
for(uint16 y = 0; y < volumeHeight; ++y)
@ -78,7 +78,7 @@ namespace PolyVox
//Note: we don't do much error handling in here - exceptions will simply be propergated up to the caller.
//FIXME - think about pointer ownership issues. Or could return volume by value if the copy constructor is shallow
BlockVolume<uint8>* loadVolumeRle(istream& stream)
Volume<uint8>* loadVolumeRle(istream& stream)
{
//Read volume dimensions
uint8 volumeWidthPower = 0;
@ -89,7 +89,7 @@ namespace PolyVox
stream.read(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
//FIXME - need to support non cubic volumes
BlockVolume<uint8>* volume = new BlockVolume<uint8>(volumeWidthPower);
Volume<uint8>* volume = new Volume<uint8>(volumeWidthPower);
uint16 volumeWidth = 0x0001 << volumeWidthPower;
uint16 volumeHeight = 0x0001 << volumeHeightPower;
@ -127,7 +127,7 @@ namespace PolyVox
return volume;
}
void saveVolumeRle(std::ostream& stream, BlockVolume<uint8>& volume)
void saveVolumeRle(std::ostream& stream, Volume<uint8>& volume)
{
//Write volume dimensions
uint16 volumeWidth = volume.getSideLength();
@ -143,7 +143,7 @@ namespace PolyVox
stream.write(reinterpret_cast<char*>(&volumeDepthPower), sizeof(volumeDepthPower));
//Write data
BlockVolumeIterator<uint8> volIter(volume);
VolumeIterator<uint8> volIter(volume);
uint8 current = 0;
uint32 runLength = 0;
bool firstTime = true;

View File

@ -28,8 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "PolyVoxCore/SurfaceVertex.h"
#include "PolyVoxCore/Utility.h"
#include "PolyVoxCore/Vector.h"
#include "PolyVoxCore/BlockVolume.h"
#include "PolyVoxCore/BlockVolumeIterator.h"
#include "PolyVoxCore/Volume.h"
#include "PolyVoxCore/VolumeIterator.h"
using namespace std;
@ -50,7 +50,7 @@ namespace PolyVox
{
}
void VolumeChangeTracker::setVolumeData(BlockVolume<uint8>* volumeDataToSet)
void VolumeChangeTracker::setVolumeData(Volume<uint8>* volumeDataToSet)
{
volumeData = volumeDataToSet;
volRegionLastModified = new Block<int32>(PolyVox::logBase2(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS));
@ -102,12 +102,12 @@ namespace PolyVox
assert(uY < volumeData->getSideLength());
assert(uZ < volumeData->getSideLength());
BlockVolumeIterator<uint8> volIter(*volumeData);
VolumeIterator<uint8> volIter(*volumeData);
volIter.setPosition(uX,uY,uZ);
return volIter.getVoxel();
}
BlockVolume<uint8>* VolumeChangeTracker::getVolumeData(void) const
Volume<uint8>* VolumeChangeTracker::getVolumeData(void) const
{
return volumeData;
}
@ -117,7 +117,7 @@ namespace PolyVox
{
++m_iCurrentTime;
//FIXME - rather than creating a iterator each time we should have one stored
//BlockVolumeIterator<uint8> iterVol(*volumeData);
//VolumeIterator<uint8> iterVol(*volumeData);
/*iterVol.setPosition(x,y,z);
iterVol.setVoxel(value);*/
@ -166,7 +166,7 @@ namespace PolyVox
assert(m_bIsLocked);
//FIXME - rather than creating a iterator each time we should have one stored
/*BlockVolumeIterator<uint8> iterVol(*volumeData);
/*VolumeIterator<uint8> iterVol(*volumeData);
iterVol.setPosition(x,y,z);
iterVol.setVoxel(value);*/
volumeData->setVoxelAt(x,y,z,value);