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

@ -33,8 +33,8 @@ namespace PolyVox
template <typename VoxelType>
class Block
{
//Make BlockVolumeIterator a friend
friend class BlockVolumeIterator<VoxelType>;
//Make VolumeIterator a friend
friend class VolumeIterator<VoxelType>;
public:
Block(uint8 uSideLengthPower);
Block(const Block& rhs);

View File

@ -22,28 +22,28 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __PolyVox_GradientEstimators_H__
#define __PolyVox_GradientEstimators_H__
#include "BlockVolumeIterator.h"
#include "VolumeIterator.h"
#include <vector>
namespace PolyVox
{
template <typename VoxelType>
Vector3DFloat computeCentralDifferenceGradient(const BlockVolumeIterator<VoxelType>& volIter);
Vector3DFloat computeCentralDifferenceGradient(const VolumeIterator<VoxelType>& volIter);
template <typename VoxelType>
Vector3DFloat computeSmoothCentralDifferenceGradient(BlockVolumeIterator<VoxelType>& volIter);
Vector3DFloat computeSmoothCentralDifferenceGradient(VolumeIterator<VoxelType>& volIter);
template <typename VoxelType>
Vector3DFloat computeDecimatedCentralDifferenceGradient(BlockVolumeIterator<VoxelType>& volIter);
Vector3DFloat computeDecimatedCentralDifferenceGradient(VolumeIterator<VoxelType>& volIter);
template <typename VoxelType>
Vector3DFloat computeSobelGradient(const BlockVolumeIterator<VoxelType>& volIter);
Vector3DFloat computeSobelGradient(const VolumeIterator<VoxelType>& volIter);
template <typename VoxelType>
Vector3DFloat computeSmoothSobelGradient(BlockVolumeIterator<VoxelType>& volIter);
Vector3DFloat computeSmoothSobelGradient(VolumeIterator<VoxelType>& volIter);
POLYVOX_API void computeNormalsForVertices(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API Vector3DFloat computeNormal(BlockVolume<uint8>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API void computeNormalsForVertices(Volume<uint8>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API Vector3DFloat computeNormal(Volume<uint8>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
}
#include "GradientEstimators.inl"

View File

@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
template <typename VoxelType>
Vector3DFloat computeCentralDifferenceGradient(const BlockVolumeIterator<VoxelType>& volIter)
Vector3DFloat computeCentralDifferenceGradient(const VolumeIterator<VoxelType>& volIter)
{
//FIXME - bitwise way of doing this?
VoxelType voxel1nx = volIter.peekVoxel1nx0py0pz() > 0 ? 1: 0;
@ -45,7 +45,7 @@ namespace PolyVox
}
template <typename VoxelType>
Vector3DFloat computeDecimatedCentralDifferenceGradient(const BlockVolumeIterator<VoxelType>& volIter)
Vector3DFloat computeDecimatedCentralDifferenceGradient(const VolumeIterator<VoxelType>& volIter)
{
const uint16 x = volIter.getPosX();
const uint16 y = volIter.getPosY();
@ -70,7 +70,7 @@ namespace PolyVox
}
template <typename VoxelType>
Vector3DFloat computeSmoothCentralDifferenceGradient(BlockVolumeIterator<VoxelType>& volIter)
Vector3DFloat computeSmoothCentralDifferenceGradient(VolumeIterator<VoxelType>& volIter)
{
uint16 initialX = volIter.getPosX();
uint16 initialY = volIter.getPosY();
@ -101,7 +101,7 @@ namespace PolyVox
}
template <typename VoxelType>
Vector3DFloat computeSobelGradient(const BlockVolumeIterator<VoxelType>& volIter)
Vector3DFloat computeSobelGradient(const VolumeIterator<VoxelType>& volIter)
{
static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, {
{3,6,3}, {6,0,6}, {3,6,3} }, { {2,3,2}, {3,6,3}, {2,3,2} } };
@ -184,7 +184,7 @@ namespace PolyVox
}
template <typename VoxelType>
Vector3DFloat computeSmoothSobelGradient(BlockVolumeIterator<VoxelType>& volIter)
Vector3DFloat computeSmoothSobelGradient(VolumeIterator<VoxelType>& volIter)
{
static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, {
{3,6,3}, {6,0,6}, {3,6,3} }, { {2,3,2}, {3,6,3}, {2,3,2} } };

View File

@ -29,11 +29,11 @@ namespace PolyVox
{
template <typename VoxelType> class Block;
//---------- BlockVolume ----------
template <typename VoxelType> class BlockVolume;
typedef BlockVolume<float> FloatBlockVolume;
typedef BlockVolume<uint8> UInt8BlockVolume;
typedef BlockVolume<uint16> UInt16BlockVolume;
//---------- Volume ----------
template <typename VoxelType> class Volume;
typedef Volume<float> FloatVolume;
typedef Volume<uint8> UInt8Volume;
typedef Volume<uint16> UInt16Volume;
//---------------------------------
class IndexedSurfacePatch;
@ -53,7 +53,7 @@ namespace PolyVox
typedef Vector<3,uint32> Vector3DUint32;
//----------------------------
template <typename VoxelType> class BlockVolumeIterator;
template <typename VoxelType> class VolumeIterator;
}
#endif

View File

@ -34,11 +34,11 @@ namespace PolyVox
{
uint32 getDecimatedIndex(uint32 x, uint32 y);
void extractDecimatedSurfaceImpl(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
uint32 computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
uint32 computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
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 generateDecimatedVerticesForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
void extractDecimatedSurfaceImpl(Volume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
uint32 computeInitialDecimatedBitmaskForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
uint32 computeDecimatedBitmaskForSliceFromPrevious(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
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[]);
void generateDecimatedVerticesForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
}
#endif

View File

@ -32,12 +32,12 @@ 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);
uint32 getIndex(uint32 x, uint32 y);
uint32 computeInitialRoughBitmaskForSlice(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
uint32 computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
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 generateRoughVerticesForSlice(BlockVolumeIterator<uint8>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
uint32 computeInitialRoughBitmaskForSlice(VolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
uint32 computeRoughBitmaskForSliceFromPrevious(VolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
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[]);
void generateRoughVerticesForSlice(VolumeIterator<uint8>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
}
#endif

View File

@ -32,7 +32,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);
int32 getIndexFor(const Vector3DFloat& pos, int32 vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1]);
void setIndexFor(const Vector3DFloat& pos, int32 newIndex, int32 vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1]);
}

View File

@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
POLYVOX_API void smoothRegionGeometry(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp);
POLYVOX_API void adjustDecimatedGeometry(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp, uint8 val);
POLYVOX_API void smoothRegionGeometry(Volume<uint8>* volumeData, IndexedSurfacePatch& isp);
POLYVOX_API void adjustDecimatedGeometry(Volume<uint8>* volumeData, IndexedSurfacePatch& isp, uint8 val);
}
#endif

View File

@ -34,8 +34,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
POLYVOX_API void extractSurface(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
POLYVOX_API void extractReferenceSurface(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
POLYVOX_API void extractSurface(Volume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
POLYVOX_API void extractReferenceSurface(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
}
#endif

View File

@ -19,8 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
******************************************************************************/
#pragma endregion
#ifndef __PolyVox_BlockVolume_H__
#define __PolyVox_BlockVolume_H__
#ifndef __PolyVox_Volume_H__
#define __PolyVox_Volume_H__
#pragma region Headers
#include "PolyVoxForwardDeclarations.h"
@ -33,17 +33,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
template <typename VoxelType>
class BlockVolume
class Volume
{
//Make BlockVolumeIterator a friend
friend class BlockVolumeIterator<VoxelType>;
//Make VolumeIterator a friend
friend class VolumeIterator<VoxelType>;
public:
BlockVolume(uint8 uSideLengthPower, uint8 uBlockSideLengthPower = 5);
BlockVolume(const BlockVolume& rhs);
~BlockVolume();
Volume(uint8 uSideLengthPower, uint8 uBlockSideLengthPower = 5);
Volume(const Volume& rhs);
~Volume();
BlockVolume& operator=(const BlockVolume& rhs);
Volume& operator=(const Volume& rhs);
Region getEnclosingRegion(void) const;
uint16 getSideLength(void) const;
@ -55,10 +55,10 @@ namespace PolyVox
bool containsPoint(const Vector3DFloat& pos, float boundary) const;
bool containsPoint(const Vector3DInt32& pos, uint16 boundary) const;
BlockVolumeIterator<VoxelType> firstVoxel(void);
VolumeIterator<VoxelType> firstVoxel(void);
void idle(uint32 uAmount);
bool isRegionHomogenous(const Region& region);
BlockVolumeIterator<VoxelType> lastVoxel(void);
VolumeIterator<VoxelType> lastVoxel(void);
private:
Block<VoxelType>* getHomogenousBlock(VoxelType tHomogenousValue) const;
@ -80,11 +80,11 @@ namespace PolyVox
};
//Some handy typedefs
typedef BlockVolume<float> FloatBlockVolume;
typedef BlockVolume<uint8> UInt8BlockVolume;
typedef BlockVolume<uint16> UInt16BlockVolume;
typedef Volume<float> FloatVolume;
typedef Volume<uint8> UInt8Volume;
typedef Volume<uint16> UInt16Volume;
}
#include "BlockVolume.inl"
#include "Volume.inl"
#endif

View File

@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#pragma region Headers
#include "Block.h"
#include "BlockVolumeIterator.h"
#include "VolumeIterator.h"
#include "Region.h"
#include "Vector.h"
@ -33,7 +33,7 @@ namespace PolyVox
{
#pragma region Constructors/Destructors
template <typename VoxelType>
BlockVolume<VoxelType>::BlockVolume(uint8 uSideLengthPower, uint8 uBlockSideLengthPower)
Volume<VoxelType>::Volume(uint8 uSideLengthPower, uint8 uBlockSideLengthPower)
:m_pBlocks(0)
{
//Check the volume size is sensible. This corresponds to a side length of 65536 voxels
@ -71,13 +71,13 @@ namespace PolyVox
}
template <typename VoxelType>
BlockVolume<VoxelType>::BlockVolume(const BlockVolume<VoxelType>& rhs)
Volume<VoxelType>::Volume(const Volume<VoxelType>& rhs)
{
*this = rhs;
}
template <typename VoxelType>
BlockVolume<VoxelType>::~BlockVolume()
Volume<VoxelType>::~Volume()
{
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
{
@ -88,7 +88,7 @@ namespace PolyVox
#pragma region Operators
template <typename VoxelType>
BlockVolume<VoxelType>& BlockVolume<VoxelType>::operator=(const BlockVolume& rhs)
Volume<VoxelType>& Volume<VoxelType>::operator=(const Volume& rhs)
{
if (this == &rhs)
{
@ -122,19 +122,19 @@ namespace PolyVox
#pragma region Getters
template <typename VoxelType>
Region BlockVolume<VoxelType>::getEnclosingRegion(void) const
Region Volume<VoxelType>::getEnclosingRegion(void) const
{
return Region(Vector3DInt32(0,0,0), Vector3DInt32(m_uSideLength-1,m_uSideLength-1,m_uSideLength-1));
}
template <typename VoxelType>
uint16 BlockVolume<VoxelType>::getSideLength(void) const
uint16 Volume<VoxelType>::getSideLength(void) const
{
return m_uSideLength;
}
template <typename VoxelType>
VoxelType BlockVolume<VoxelType>::getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const
VoxelType Volume<VoxelType>::getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const
{
assert(uXPos < getSideLength());
assert(uYPos < getSideLength());
@ -159,7 +159,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolume<VoxelType>::getVoxelAt(const Vector3DUint16& v3dPos) const
VoxelType Volume<VoxelType>::getVoxelAt(const Vector3DUint16& v3dPos) const
{
assert(v3dPos.getX() < m_uSideLength);
assert(v3dPos.getY() < m_uSideLength);
@ -171,7 +171,7 @@ namespace PolyVox
#pragma region Setters
template <typename VoxelType>
void BlockVolume<VoxelType>::setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue)
void Volume<VoxelType>::setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue)
{
const uint16 blockX = uXPos >> m_uBlockSideLengthPower;
const uint16 blockY = uYPos >> m_uBlockSideLengthPower;
@ -207,7 +207,7 @@ namespace PolyVox
}
template <typename VoxelType>
void BlockVolume<VoxelType>::setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue)
void Volume<VoxelType>::setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue)
{
setVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue);
}
@ -215,7 +215,7 @@ namespace PolyVox
#pragma region Other
template <typename VoxelType>
bool BlockVolume<VoxelType>::containsPoint(const Vector3DFloat& pos, float boundary) const
bool Volume<VoxelType>::containsPoint(const Vector3DFloat& pos, float boundary) const
{
return (pos.getX() <= m_uSideLength - 1 - boundary)
&& (pos.getY() <= m_uSideLength - 1 - boundary)
@ -226,7 +226,7 @@ namespace PolyVox
}
template <typename VoxelType>
bool BlockVolume<VoxelType>::containsPoint(const Vector3DInt32& pos, uint16 boundary) const
bool Volume<VoxelType>::containsPoint(const Vector3DInt32& pos, uint16 boundary) const
{
return (pos.getX() <= m_uSideLength - 1 - boundary)
&& (pos.getY() <= m_uSideLength - 1 - boundary)
@ -237,22 +237,22 @@ namespace PolyVox
}
template <typename VoxelType>
BlockVolumeIterator<VoxelType> BlockVolume<VoxelType>::firstVoxel(void)
VolumeIterator<VoxelType> Volume<VoxelType>::firstVoxel(void)
{
BlockVolumeIterator<VoxelType> iter(*this);
VolumeIterator<VoxelType> iter(*this);
iter.setPosition(0,0,0);
return iter;
}
template <typename VoxelType>
void BlockVolume<VoxelType>::idle(uint32 uAmount)
void Volume<VoxelType>::idle(uint32 uAmount)
{
}
template <typename VoxelType>
bool BlockVolume<VoxelType>::isRegionHomogenous(const Region& region)
bool Volume<VoxelType>::isRegionHomogenous(const Region& region)
{
BlockVolumeIterator<VoxelType> iter(*this);
VolumeIterator<VoxelType> iter(*this);
iter.setValidRegion(region);
iter.setPosition(static_cast<Vector3DInt16>(region.getLowerCorner()));
@ -272,9 +272,9 @@ namespace PolyVox
}
template <typename VoxelType>
BlockVolumeIterator<VoxelType> BlockVolume<VoxelType>::lastVoxel(void)
VolumeIterator<VoxelType> Volume<VoxelType>::lastVoxel(void)
{
BlockVolumeIterator<VoxelType> iter(*this);
VolumeIterator<VoxelType> iter(*this);
iter.setPosition(m_uSideLength-1,m_uSideLength-1,m_uSideLength-1);
return iter;
}
@ -282,7 +282,7 @@ namespace PolyVox
#pragma region Private Implementation
template <typename VoxelType>
Block<VoxelType>* BlockVolume<VoxelType>::getHomogenousBlock(VoxelType tHomogenousValue) const
Block<VoxelType>* Volume<VoxelType>::getHomogenousBlock(VoxelType tHomogenousValue) const
{
typename std::map<VoxelType, Block<VoxelType>*>::iterator iterResult = m_pHomogenousBlocks.find(tHomogenousValue);
if(iterResult == m_pHomogenousBlocks.end())

View File

@ -31,23 +31,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
template <typename VoxelType>
class BlockVolumeIterator
class VolumeIterator
{
public:
BlockVolumeIterator(BlockVolume<VoxelType>& volume);
~BlockVolumeIterator();
VolumeIterator(Volume<VoxelType>& volume);
~VolumeIterator();
bool operator==(const BlockVolumeIterator& rhs);
bool operator<(const BlockVolumeIterator& rhs);
bool operator>(const BlockVolumeIterator& rhs);
bool operator<=(const BlockVolumeIterator& rhs);
bool operator>=(const BlockVolumeIterator& rhs);
bool operator==(const VolumeIterator& rhs);
bool operator<(const VolumeIterator& rhs);
bool operator>(const VolumeIterator& rhs);
bool operator<=(const VolumeIterator& rhs);
bool operator>=(const VolumeIterator& rhs);
uint16 getPosX(void) const;
uint16 getPosY(void) const;
uint16 getPosZ(void) const;
VoxelType getSubSampledVoxel(uint8 uLevel) const;
const BlockVolume<VoxelType>& getVolume(void) const;
const Volume<VoxelType>& getVolume(void) const;
VoxelType getVoxel(void) const;
void setPosition(const Vector3DInt16& v3dNewPos);
@ -92,7 +92,7 @@ namespace PolyVox
private:
//The current volume
BlockVolume<VoxelType>& mVolume;
Volume<VoxelType>& mVolume;
//The current position in the volume
uint16 mXPosInVolume;
@ -132,6 +132,6 @@ namespace PolyVox
};
}
#include "BlockVolumeIterator.inl"
#include "VolumeIterator.inl"
#endif

View File

@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#pragma region Headers
#include "Block.h"
#include "BlockVolume.h"
#include "Volume.h"
#include "Vector.h"
#include "Region.h"
@ -32,20 +32,20 @@ namespace PolyVox
{
#pragma region Constructors/Destructors
template <typename VoxelType>
BlockVolumeIterator<VoxelType>::BlockVolumeIterator(BlockVolume<VoxelType>& volume)
VolumeIterator<VoxelType>::VolumeIterator(Volume<VoxelType>& volume)
:mVolume(volume)
{
}
template <typename VoxelType>
BlockVolumeIterator<VoxelType>::~BlockVolumeIterator()
VolumeIterator<VoxelType>::~VolumeIterator()
{
}
#pragma endregion
#pragma region Operators
template <typename VoxelType>
bool BlockVolumeIterator<VoxelType>::operator==(const BlockVolumeIterator<VoxelType>& rhs)
bool VolumeIterator<VoxelType>::operator==(const VolumeIterator<VoxelType>& rhs)
{
//We could just check whether the two mCurrentVoxel pointers are equal, but this may not
//be safe in the future if we decide to allow blocks to be shared between volumes
@ -62,7 +62,7 @@ namespace PolyVox
}
template <typename VoxelType>
bool BlockVolumeIterator<VoxelType>::operator<(const BlockVolumeIterator<VoxelType>& rhs)
bool VolumeIterator<VoxelType>::operator<(const VolumeIterator<VoxelType>& rhs)
{
assert(&mVolume == &rhs.mVolume);
@ -85,21 +85,21 @@ namespace PolyVox
}
template <typename VoxelType>
bool BlockVolumeIterator<VoxelType>::operator>(const BlockVolumeIterator<VoxelType>& rhs)
bool VolumeIterator<VoxelType>::operator>(const VolumeIterator<VoxelType>& rhs)
{
assert(&mVolume == &rhs.mVolume);
return (rhs < *this);
}
template <typename VoxelType>
bool BlockVolumeIterator<VoxelType>::operator<=(const BlockVolumeIterator<VoxelType>& rhs)
bool VolumeIterator<VoxelType>::operator<=(const VolumeIterator<VoxelType>& rhs)
{
assert(&mVolume == &rhs.mVolume);
return (rhs > *this);
}
template <typename VoxelType>
bool BlockVolumeIterator<VoxelType>::operator>=(const BlockVolumeIterator<VoxelType>& rhs)
bool VolumeIterator<VoxelType>::operator>=(const VolumeIterator<VoxelType>& rhs)
{
assert(&mVolume == &rhs.mVolume);
return (rhs < *this);
@ -108,25 +108,25 @@ namespace PolyVox
#pragma region Getters
template <typename VoxelType>
uint16 BlockVolumeIterator<VoxelType>::getPosX(void) const
uint16 VolumeIterator<VoxelType>::getPosX(void) const
{
return mXPosInVolume;
}
template <typename VoxelType>
uint16 BlockVolumeIterator<VoxelType>::getPosY(void) const
uint16 VolumeIterator<VoxelType>::getPosY(void) const
{
return mYPosInVolume;
}
template <typename VoxelType>
uint16 BlockVolumeIterator<VoxelType>::getPosZ(void) const
uint16 VolumeIterator<VoxelType>::getPosZ(void) const
{
return mZPosInVolume;
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::getSubSampledVoxel(uint8 uLevel) const
VoxelType VolumeIterator<VoxelType>::getSubSampledVoxel(uint8 uLevel) const
{
if(uLevel == 0)
{
@ -164,13 +164,13 @@ namespace PolyVox
}
template <typename VoxelType>
const BlockVolume<VoxelType>& BlockVolumeIterator<VoxelType>::getVolume(void) const
const Volume<VoxelType>& VolumeIterator<VoxelType>::getVolume(void) const
{
return mVolume;
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::getVoxel(void) const
VoxelType VolumeIterator<VoxelType>::getVoxel(void) const
{
return *mCurrentVoxel;
}
@ -178,13 +178,13 @@ namespace PolyVox
#pragma region Setters
template <typename VoxelType>
void BlockVolumeIterator<VoxelType>::setPosition(const Vector3DInt16& v3dNewPos)
void VolumeIterator<VoxelType>::setPosition(const Vector3DInt16& v3dNewPos)
{
setPosition(v3dNewPos.getX(), v3dNewPos.getY(), v3dNewPos.getZ());
}
template <typename VoxelType>
void BlockVolumeIterator<VoxelType>::setPosition(uint16 xPos, uint16 yPos, uint16 zPos)
void VolumeIterator<VoxelType>::setPosition(uint16 xPos, uint16 yPos, uint16 zPos)
{
mXPosInVolume = xPos;
mYPosInVolume = yPos;
@ -211,13 +211,13 @@ namespace PolyVox
}
template <typename VoxelType>
void BlockVolumeIterator<VoxelType>::setValidRegion(const Region& region)
void VolumeIterator<VoxelType>::setValidRegion(const Region& region)
{
setValidRegion(region.getLowerCorner().getX(),region.getLowerCorner().getY(),region.getLowerCorner().getZ(),region.getUpperCorner().getX(),region.getUpperCorner().getY(),region.getUpperCorner().getZ());
}
template <typename VoxelType>
void BlockVolumeIterator<VoxelType>::setValidRegion(uint16 xFirst, uint16 yFirst, uint16 zFirst, uint16 xLast, uint16 yLast, uint16 zLast)
void VolumeIterator<VoxelType>::setValidRegion(uint16 xFirst, uint16 yFirst, uint16 zFirst, uint16 xLast, uint16 yLast, uint16 zLast)
{
mXRegionFirst = xFirst;
mYRegionFirst = yFirst;
@ -239,13 +239,13 @@ namespace PolyVox
#pragma region Other
template <typename VoxelType>
bool BlockVolumeIterator<VoxelType>::isValidForRegion(void) const
bool VolumeIterator<VoxelType>::isValidForRegion(void) const
{
return mIsValidForRegion;
}
template <typename VoxelType>
void BlockVolumeIterator<VoxelType>::moveForwardInRegionFast(void)
void VolumeIterator<VoxelType>::moveForwardInRegionFast(void)
{
mXPosInBlock++;
mCurrentVoxel++;
@ -331,7 +331,7 @@ namespace PolyVox
}
template <typename VoxelType>
bool BlockVolumeIterator<VoxelType>::moveForwardInRegionXYZ(void)
bool VolumeIterator<VoxelType>::moveForwardInRegionXYZ(void)
{
if(mXPosInVolume < mXRegionLast)
{
@ -386,7 +386,7 @@ namespace PolyVox
#pragma region Peekers
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1ny1nz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1ny1nz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -396,7 +396,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1ny0pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1ny0pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -406,7 +406,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1ny1pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1ny1pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -416,7 +416,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx0py1nz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx0py1nz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -426,7 +426,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx0py0pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx0py0pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -436,7 +436,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx0py1pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx0py1pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -446,7 +446,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1py1nz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1py1nz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -456,7 +456,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1py0pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1py0pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -466,7 +466,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1py1pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1py1pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -478,7 +478,7 @@ namespace PolyVox
//////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1ny1nz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1ny1nz(void) const
{
if((mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -488,7 +488,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1ny0pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1ny0pz(void) const
{
if((mYPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -498,7 +498,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1ny1pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1ny1pz(void) const
{
if((mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -508,7 +508,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px0py1nz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel0px0py1nz(void) const
{
if((mZPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -518,13 +518,13 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px0py0pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel0px0py0pz(void) const
{
return *mCurrentVoxel;
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px0py1pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel0px0py1pz(void) const
{
if((mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -534,7 +534,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1py1nz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1py1nz(void) const
{
if((mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -544,7 +544,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1py0pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1py0pz(void) const
{
if((mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -554,7 +554,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1py1pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1py1pz(void) const
{
if((mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -566,7 +566,7 @@ namespace PolyVox
//////////////////////////////////////////////////////////////////////////
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1ny1nz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1ny1nz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -576,7 +576,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1ny0pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1ny0pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -586,7 +586,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1ny1pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1ny1pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -596,7 +596,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px0py1nz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1px0py1nz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -606,7 +606,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px0py0pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1px0py0pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -616,7 +616,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px0py1pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1px0py1pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -626,7 +626,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1py1nz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1py1nz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
{
@ -636,7 +636,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1py0pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1py0pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{
@ -646,7 +646,7 @@ namespace PolyVox
}
template <typename VoxelType>
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1py1pz(void) const
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1py1pz(void) const
{
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
{

View File

@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
float computeSmoothedVoxel(BlockVolumeIterator<uint8>& volIter);
float computeSmoothedVoxel(VolumeIterator<uint8>& volIter);
}
#endif