Renamed VolumeIterator to BlockVolumeIterator
This commit is contained in:
parent
ebeebee126
commit
c8d632b554
@ -23,6 +23,8 @@ SET(INC_FILES
|
||||
include/Block.inl
|
||||
include/BlockVolume.h
|
||||
include/BlockVolume.inl
|
||||
include/BlockVolumeIterator.h
|
||||
include/BlockVolumeIterator.inl
|
||||
include/Constants.h
|
||||
include/Enums.h
|
||||
include/GradientEstimators.h
|
||||
@ -41,8 +43,6 @@ SET(INC_FILES
|
||||
include/Vector.h
|
||||
include/Vector.inl
|
||||
include/VolumeChangeTracker.h
|
||||
include/VolumeIterator.h
|
||||
include/VolumeIterator.inl
|
||||
)
|
||||
|
||||
FIND_PACKAGE(Boost REQUIRED)
|
||||
|
@ -33,8 +33,8 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
class Block
|
||||
{
|
||||
//Make VolumeIterator a friend
|
||||
friend class VolumeIterator<VoxelType>;
|
||||
//Make BlockVolumeIterator a friend
|
||||
friend class BlockVolumeIterator<VoxelType>;
|
||||
public:
|
||||
Block(boost::uint8_t uSideLengthPower);
|
||||
Block(const Block& rhs);
|
||||
|
@ -35,8 +35,8 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
class BlockVolume
|
||||
{
|
||||
//Make VolumeIterator a friend
|
||||
friend class VolumeIterator<VoxelType>;
|
||||
//Make BlockVolumeIterator a friend
|
||||
friend class BlockVolumeIterator<VoxelType>;
|
||||
|
||||
public:
|
||||
BlockVolume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower = 5);
|
||||
@ -52,9 +52,9 @@ namespace PolyVox
|
||||
|
||||
bool containsPoint(const Vector3DFloat& pos, float boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, boost::uint16_t boundary) const;
|
||||
VolumeIterator<VoxelType> firstVoxel(void);
|
||||
BlockVolumeIterator<VoxelType> firstVoxel(void);
|
||||
void idle(boost::uint32_t uAmount);
|
||||
VolumeIterator<VoxelType> lastVoxel(void);
|
||||
BlockVolumeIterator<VoxelType> lastVoxel(void);
|
||||
|
||||
private:
|
||||
Block<VoxelType>* getHomogenousBlock(VoxelType tHomogenousValue) const;
|
||||
|
@ -192,9 +192,9 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VolumeIterator<VoxelType> BlockVolume<VoxelType>::firstVoxel(void)
|
||||
BlockVolumeIterator<VoxelType> BlockVolume<VoxelType>::firstVoxel(void)
|
||||
{
|
||||
VolumeIterator<VoxelType> iter(*this);
|
||||
BlockVolumeIterator<VoxelType> iter(*this);
|
||||
iter.setPosition(0,0,0);
|
||||
return iter;
|
||||
}
|
||||
@ -205,9 +205,9 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VolumeIterator<VoxelType> BlockVolume<VoxelType>::lastVoxel(void)
|
||||
BlockVolumeIterator<VoxelType> BlockVolume<VoxelType>::lastVoxel(void)
|
||||
{
|
||||
VolumeIterator<VoxelType> iter(*this);
|
||||
BlockVolumeIterator<VoxelType> iter(*this);
|
||||
iter.setPosition(m_uSideLength-1,m_uSideLength-1,m_uSideLength-1);
|
||||
return iter;
|
||||
}
|
||||
|
@ -31,17 +31,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType>
|
||||
class VolumeIterator
|
||||
class BlockVolumeIterator
|
||||
{
|
||||
public:
|
||||
VolumeIterator(BlockVolume<VoxelType>& volume);
|
||||
~VolumeIterator();
|
||||
BlockVolumeIterator(BlockVolume<VoxelType>& volume);
|
||||
~BlockVolumeIterator();
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
float getAveragedVoxel(boost::uint16_t size) const;
|
||||
boost::uint16_t getPosX(void) const;
|
||||
@ -130,6 +130,6 @@ namespace PolyVox
|
||||
};
|
||||
}
|
||||
|
||||
#include "VolumeIterator.inl"
|
||||
#include "BlockVolumeIterator.inl"
|
||||
|
||||
#endif
|
@ -29,20 +29,20 @@ namespace PolyVox
|
||||
{
|
||||
#pragma region Constructors/Destructors
|
||||
template <typename VoxelType>
|
||||
VolumeIterator<VoxelType>::VolumeIterator(BlockVolume<VoxelType>& volume)
|
||||
BlockVolumeIterator<VoxelType>::BlockVolumeIterator(BlockVolume<VoxelType>& volume)
|
||||
:mVolume(volume)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VolumeIterator<VoxelType>::~VolumeIterator()
|
||||
BlockVolumeIterator<VoxelType>::~BlockVolumeIterator()
|
||||
{
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Operators
|
||||
template <typename VoxelType>
|
||||
bool VolumeIterator<VoxelType>::operator==(const VolumeIterator<VoxelType>& rhs)
|
||||
bool BlockVolumeIterator<VoxelType>::operator==(const BlockVolumeIterator<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
|
||||
@ -59,7 +59,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool VolumeIterator<VoxelType>::operator<(const VolumeIterator<VoxelType>& rhs)
|
||||
bool BlockVolumeIterator<VoxelType>::operator<(const BlockVolumeIterator<VoxelType>& rhs)
|
||||
{
|
||||
assert(&mVolume == &rhs.mVolume);
|
||||
|
||||
@ -82,21 +82,21 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool VolumeIterator<VoxelType>::operator>(const VolumeIterator<VoxelType>& rhs)
|
||||
bool BlockVolumeIterator<VoxelType>::operator>(const BlockVolumeIterator<VoxelType>& rhs)
|
||||
{
|
||||
assert(&mVolume == &rhs.mVolume);
|
||||
return (rhs < *this);
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool VolumeIterator<VoxelType>::operator<=(const VolumeIterator<VoxelType>& rhs)
|
||||
bool BlockVolumeIterator<VoxelType>::operator<=(const BlockVolumeIterator<VoxelType>& rhs)
|
||||
{
|
||||
assert(&mVolume == &rhs.mVolume);
|
||||
return (rhs > *this);
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool VolumeIterator<VoxelType>::operator>=(const VolumeIterator<VoxelType>& rhs)
|
||||
bool BlockVolumeIterator<VoxelType>::operator>=(const BlockVolumeIterator<VoxelType>& rhs)
|
||||
{
|
||||
assert(&mVolume == &rhs.mVolume);
|
||||
return (rhs < *this);
|
||||
@ -105,7 +105,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Getters
|
||||
template <typename VoxelType>
|
||||
float VolumeIterator<VoxelType>::getAveragedVoxel(boost::uint16_t size) const
|
||||
float BlockVolumeIterator<VoxelType>::getAveragedVoxel(boost::uint16_t size) const
|
||||
{
|
||||
assert(mXPosInVolume >= size);
|
||||
assert(mYPosInVolume >= size);
|
||||
@ -137,25 +137,25 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
boost::uint16_t VolumeIterator<VoxelType>::getPosX(void) const
|
||||
boost::uint16_t BlockVolumeIterator<VoxelType>::getPosX(void) const
|
||||
{
|
||||
return mXPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
boost::uint16_t VolumeIterator<VoxelType>::getPosY(void) const
|
||||
boost::uint16_t BlockVolumeIterator<VoxelType>::getPosY(void) const
|
||||
{
|
||||
return mYPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
boost::uint16_t VolumeIterator<VoxelType>::getPosZ(void) const
|
||||
boost::uint16_t BlockVolumeIterator<VoxelType>::getPosZ(void) const
|
||||
{
|
||||
return mZPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::getVoxel(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::getVoxel(void) const
|
||||
{
|
||||
return *mCurrentVoxel;
|
||||
}
|
||||
@ -163,7 +163,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Setters
|
||||
template <typename VoxelType>
|
||||
void VolumeIterator<VoxelType>::setPosition(boost::uint16_t xPos, boost::uint16_t yPos, boost::uint16_t zPos)
|
||||
void BlockVolumeIterator<VoxelType>::setPosition(boost::uint16_t xPos, boost::uint16_t yPos, boost::uint16_t zPos)
|
||||
{
|
||||
mXPosInVolume = xPos;
|
||||
mYPosInVolume = yPos;
|
||||
@ -190,13 +190,13 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void VolumeIterator<VoxelType>::setValidRegion(const Region& region)
|
||||
void BlockVolumeIterator<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 VolumeIterator<VoxelType>::setValidRegion(boost::uint16_t xFirst, boost::uint16_t yFirst, boost::uint16_t zFirst, boost::uint16_t xLast, boost::uint16_t yLast, boost::uint16_t zLast)
|
||||
void BlockVolumeIterator<VoxelType>::setValidRegion(boost::uint16_t xFirst, boost::uint16_t yFirst, boost::uint16_t zFirst, boost::uint16_t xLast, boost::uint16_t yLast, boost::uint16_t zLast)
|
||||
{
|
||||
mXRegionFirst = xFirst;
|
||||
mYRegionFirst = yFirst;
|
||||
@ -216,7 +216,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void VolumeIterator<VoxelType>::setVoxel(VoxelType tValue)
|
||||
void BlockVolumeIterator<VoxelType>::setVoxel(VoxelType tValue)
|
||||
{
|
||||
const boost::uint32_t uBlockIndex =
|
||||
mXBlock +
|
||||
@ -247,13 +247,13 @@ namespace PolyVox
|
||||
|
||||
#pragma region Other
|
||||
template <typename VoxelType>
|
||||
bool VolumeIterator<VoxelType>::isValidForRegion(void) const
|
||||
bool BlockVolumeIterator<VoxelType>::isValidForRegion(void) const
|
||||
{
|
||||
return mIsValidForRegion;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void VolumeIterator<VoxelType>::moveForwardInRegion(void)
|
||||
void BlockVolumeIterator<VoxelType>::moveForwardInRegion(void)
|
||||
{
|
||||
mXPosInBlock++;
|
||||
mCurrentVoxel++;
|
||||
@ -341,7 +341,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Peekers
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1ny1nz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1ny1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -351,7 +351,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1ny0pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1ny0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -361,7 +361,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1ny1pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1ny1pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -371,7 +371,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx0py1nz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx0py1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -381,7 +381,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx0py0pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx0py0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -391,7 +391,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx0py1pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx0py1pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -401,7 +401,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1py1nz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1py1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -411,7 +411,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1py0pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1nx1py0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != 0) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -421,7 +421,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1nx1py1pz(void) const
|
||||
VoxelType BlockVolumeIterator<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))
|
||||
{
|
||||
@ -433,7 +433,7 @@ namespace PolyVox
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1ny1nz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1ny1nz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -443,7 +443,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1ny0pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1ny0pz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -453,7 +453,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1ny1pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1ny1pz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -463,7 +463,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px0py1nz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px0py1nz(void) const
|
||||
{
|
||||
if((mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -473,13 +473,13 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px0py0pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px0py0pz(void) const
|
||||
{
|
||||
return *mCurrentVoxel;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px0py1pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px0py1pz(void) const
|
||||
{
|
||||
if((mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -489,7 +489,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1py1nz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1py1nz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -499,7 +499,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1py0pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1py0pz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -509,7 +509,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel0px1py1pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel0px1py1pz(void) const
|
||||
{
|
||||
if((mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -521,7 +521,7 @@ namespace PolyVox
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1ny1nz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1ny1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -531,7 +531,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1ny0pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1ny0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -541,7 +541,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1ny1pz(void) const
|
||||
VoxelType BlockVolumeIterator<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))
|
||||
{
|
||||
@ -551,7 +551,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px0py1nz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px0py1nz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != 0))
|
||||
{
|
||||
@ -561,7 +561,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px0py0pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px0py0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -571,7 +571,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px0py1pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px0py1pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mZPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -581,7 +581,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1py1nz(void) const
|
||||
VoxelType BlockVolumeIterator<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))
|
||||
{
|
||||
@ -591,7 +591,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1py0pz(void) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::peekVoxel1px1py0pz(void) const
|
||||
{
|
||||
if((mXPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1) && (mYPosInVolume%mVolume.m_uBlockSideLength != mVolume.m_uBlockSideLength-1))
|
||||
{
|
||||
@ -601,7 +601,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::peekVoxel1px1py1pz(void) const
|
||||
VoxelType BlockVolumeIterator<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))
|
||||
{
|
@ -22,18 +22,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#ifndef __PolyVox_GradientEstimators_H__
|
||||
#define __PolyVox_GradientEstimators_H__
|
||||
|
||||
#include "VolumeIterator.h"
|
||||
#include "BlockVolumeIterator.h"
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeCentralDifferenceGradient(const VolumeIterator<VoxelType>& volIter);
|
||||
Vector3DFloat computeCentralDifferenceGradient(const BlockVolumeIterator<VoxelType>& volIter);
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSmoothCentralDifferenceGradient(VolumeIterator<VoxelType>& volIter);
|
||||
Vector3DFloat computeSmoothCentralDifferenceGradient(BlockVolumeIterator<VoxelType>& volIter);
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSobelGradient(const VolumeIterator<VoxelType>& volIter);
|
||||
Vector3DFloat computeSobelGradient(const BlockVolumeIterator<VoxelType>& volIter);
|
||||
}
|
||||
|
||||
#include "GradientEstimators.inl"
|
||||
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
namespace PolyVox
|
||||
{
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeCentralDifferenceGradient(const VolumeIterator<VoxelType>& volIter)
|
||||
Vector3DFloat computeCentralDifferenceGradient(const BlockVolumeIterator<VoxelType>& volIter)
|
||||
{
|
||||
//FIXME - bitwise way of doing this?
|
||||
VoxelType voxel1nx = volIter.peekVoxel1nx0py0pz() > 0 ? 1: 0;
|
||||
@ -43,7 +43,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSmoothCentralDifferenceGradient(VolumeIterator<VoxelType>& volIter)
|
||||
Vector3DFloat computeSmoothCentralDifferenceGradient(BlockVolumeIterator<VoxelType>& volIter)
|
||||
{
|
||||
boost::uint16_t initialX = volIter.getPosX();
|
||||
boost::uint16_t initialY = volIter.getPosY();
|
||||
@ -74,7 +74,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSobelGradient(const VolumeIterator<VoxelType>& volIter)
|
||||
Vector3DFloat computeSobelGradient(const BlockVolumeIterator<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} } };
|
||||
|
@ -57,7 +57,7 @@ namespace PolyVox
|
||||
//----------------------------
|
||||
|
||||
class VolumeChangeTracker;
|
||||
template <typename VoxelType> class VolumeIterator;
|
||||
template <typename VoxelType> class BlockVolumeIterator;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "Region.h"
|
||||
#include "RegionGeometry.h"
|
||||
#include "VolumeChangeTracker.h"
|
||||
#include "VolumeIterator.h"
|
||||
#include "BlockVolumeIterator.h"
|
||||
|
||||
using namespace boost;
|
||||
|
||||
@ -52,7 +52,7 @@ namespace PolyVox
|
||||
|
||||
Vector3DFloat vertlist[12];
|
||||
uint8_t vertMaterials[12];
|
||||
VolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
volIter.setValidRegion(region);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -363,7 +363,7 @@ namespace PolyVox
|
||||
|
||||
Vector3DFloat result;
|
||||
|
||||
VolumeIterator<boost::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create?
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create?
|
||||
|
||||
|
||||
if(normalGenerationMethod == SOBEL)
|
||||
@ -450,7 +450,7 @@ namespace PolyVox
|
||||
|
||||
Vector3DFloat vertlist[12];
|
||||
uint8_t vertMaterials[12];
|
||||
VolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
volIter.setValidRegion(region);
|
||||
|
||||
const float threshold = 0.5f;
|
||||
@ -468,7 +468,7 @@ namespace PolyVox
|
||||
const uint16_t z = volIter.getPosZ();
|
||||
|
||||
//Voxels values
|
||||
VolumeIterator<boost::uint8_t> tempVolIter(*volumeData);
|
||||
BlockVolumeIterator<boost::uint8_t> tempVolIter(*volumeData);
|
||||
tempVolIter.setPosition(x,y,z);
|
||||
const float v000 = tempVolIter.getAveragedVoxel(1);
|
||||
tempVolIter.setPosition(x+1,y,z);
|
||||
@ -765,7 +765,7 @@ namespace PolyVox
|
||||
|
||||
Vector3DFloat result;
|
||||
|
||||
VolumeIterator<boost::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create?
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create?
|
||||
|
||||
|
||||
if(normalGenerationMethod == SOBEL)
|
||||
|
@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "Utility.h"
|
||||
#include "Vector.h"
|
||||
#include "BlockVolume.h"
|
||||
#include "VolumeIterator.h"
|
||||
#include "BlockVolumeIterator.h"
|
||||
|
||||
using namespace boost;
|
||||
|
||||
@ -124,7 +124,7 @@ namespace PolyVox
|
||||
assert(uY < volumeData->getSideLength());
|
||||
assert(uZ < volumeData->getSideLength());
|
||||
|
||||
VolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
volIter.setPosition(uX,uY,uZ);
|
||||
return volIter.getVoxel();
|
||||
}
|
||||
@ -137,7 +137,7 @@ namespace PolyVox
|
||||
void VolumeChangeTracker::setVoxelAt(boost::uint16_t x, boost::uint16_t y, boost::uint16_t z, boost::uint8_t value)
|
||||
{
|
||||
//FIXME - rather than creating a iterator each time we should have one stored
|
||||
VolumeIterator<boost::uint8_t> iterVol(*volumeData);
|
||||
BlockVolumeIterator<boost::uint8_t> iterVol(*volumeData);
|
||||
iterVol.setPosition(x,y,z);
|
||||
iterVol.setVoxel(value);
|
||||
|
||||
@ -183,7 +183,7 @@ namespace PolyVox
|
||||
assert(m_bIsLocked);
|
||||
|
||||
//FIXME - rather than creating a iterator each time we should have one stored
|
||||
VolumeIterator<boost::uint8_t> iterVol(*volumeData);
|
||||
BlockVolumeIterator<boost::uint8_t> iterVol(*volumeData);
|
||||
iterVol.setPosition(x,y,z);
|
||||
iterVol.setVoxel(value);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user