More work on removing wrap modes.

This commit is contained in:
David Williams 2015-02-27 15:12:11 +01:00
parent 3ace735619
commit 6817899e6a
5 changed files with 113 additions and 235 deletions

View File

@ -127,12 +127,6 @@ namespace PolyVox
WrapMode m_eWrapMode;
VoxelType m_tBorder;
//Whether the current position is inside the volume
//FIXME - Replace these with flags
bool m_bIsCurrentPositionValidInX;
bool m_bIsCurrentPositionValidInY;
bool m_bIsCurrentPositionValidInZ;
};
#endif

View File

@ -34,9 +34,6 @@ namespace PolyVox
,mZPosInVolume(0)
,m_eWrapMode(WrapModes::Border)
,m_tBorder()
,m_bIsCurrentPositionValidInX(false)
,m_bIsCurrentPositionValidInY(false)
,m_bIsCurrentPositionValidInZ(false)
{
}
@ -64,7 +61,8 @@ namespace PolyVox
template <typename DerivedVolumeType>
bool inline BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::isCurrentPositionValid(void) const
{
return m_bIsCurrentPositionValidInX && m_bIsCurrentPositionValidInY && m_bIsCurrentPositionValidInZ;
//return m_bIsCurrentPositionValidInX && m_bIsCurrentPositionValidInY && m_bIsCurrentPositionValidInZ;
return mVolume->getEnclosingRegion().containsPoint(mXPosInVolume, mYPosInVolume, mZPosInVolume);
}
template <typename VoxelType>
@ -81,10 +79,6 @@ namespace PolyVox
mXPosInVolume = xPos;
mYPosInVolume = yPos;
mZPosInVolume = zPos;
m_bIsCurrentPositionValidInX = mVolume->getEnclosingRegion().containsPointInX(xPos);
m_bIsCurrentPositionValidInY = mVolume->getEnclosingRegion().containsPointInY(yPos);
m_bIsCurrentPositionValidInZ = mVolume->getEnclosingRegion().containsPointInZ(zPos);
}
template <typename VoxelType>
@ -107,7 +101,6 @@ namespace PolyVox
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveX(void)
{
mXPosInVolume++;
m_bIsCurrentPositionValidInX = mVolume->getEnclosingRegion().containsPointInX(mXPosInVolume);
}
template <typename VoxelType>
@ -115,7 +108,6 @@ namespace PolyVox
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveY(void)
{
mYPosInVolume++;
m_bIsCurrentPositionValidInY = mVolume->getEnclosingRegion().containsPointInY(mYPosInVolume);
}
template <typename VoxelType>
@ -123,7 +115,6 @@ namespace PolyVox
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveZ(void)
{
mZPosInVolume++;
m_bIsCurrentPositionValidInZ = mVolume->getEnclosingRegion().containsPointInZ(mZPosInVolume);
}
template <typename VoxelType>
@ -131,7 +122,6 @@ namespace PolyVox
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeX(void)
{
mXPosInVolume--;
m_bIsCurrentPositionValidInX = mVolume->getEnclosingRegion().containsPointInX(mXPosInVolume);
}
template <typename VoxelType>
@ -139,7 +129,6 @@ namespace PolyVox
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeY(void)
{
mYPosInVolume--;
m_bIsCurrentPositionValidInY = mVolume->getEnclosingRegion().containsPointInY(mYPosInVolume);
}
template <typename VoxelType>
@ -147,7 +136,6 @@ namespace PolyVox
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeZ(void)
{
mZPosInVolume--;
m_bIsCurrentPositionValidInZ = mVolume->getEnclosingRegion().containsPointInZ(mZPosInVolume);
}
template <typename VoxelType>

View File

@ -146,7 +146,7 @@ namespace PolyVox
}
}
typename RawVolume<AccumulationType>::Sampler satVolumeIter(&satVolume);
/*typename RawVolume<AccumulationType>::Sampler satVolumeIter(&satVolume);
IteratorController<typename RawVolume<AccumulationType>::Sampler> satIterCont;
satIterCont.m_regValid = Region(satLowerCorner, satUpperCorner);
@ -169,7 +169,27 @@ namespace PolyVox
srcIterCont.moveForward();
}while(satIterCont.moveForward());
}while(satIterCont.moveForward());*/
for (int32_t z = satLowerCorner.getZ(); z <= satUpperCorner.getZ(); z++)
{
for (int32_t y = satLowerCorner.getY(); y <= satUpperCorner.getY(); y++)
{
for (int32_t x = satLowerCorner.getX(); x <= satUpperCorner.getX(); x++)
{
AccumulationType previousSum = static_cast<AccumulationType>(satVolume.getVoxel(x - 1, y, z));
AccumulationType currentVal = static_cast<AccumulationType>(m_pVolSrc->getVoxel(x, y, z));
satVolume.setVoxel(x, y, z, previousSum + currentVal);
}
}
}
//Build SAT in three passes
/*for(int32_t z = satLowerCorner.getZ(); z <= satUpperCorner.getZ(); z++)

View File

@ -82,14 +82,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::getVoxel(void) const
{
if(this->isCurrentPositionValid())
{
return *mCurrentVoxel;
}
else
{
return this->getVoxelImpl(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
}
return *mCurrentVoxel;
}
template <typename VoxelType>
@ -104,29 +97,21 @@ namespace PolyVox
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::setPosition(xPos, yPos, zPos);
// Then we update the voxel pointer
if(this->isCurrentPositionValid())
{
const int32_t uXChunk = this->mXPosInVolume >> this->mVolume->m_uChunkSideLengthPower;
const int32_t uYChunk = this->mYPosInVolume >> this->mVolume->m_uChunkSideLengthPower;
const int32_t uZChunk = this->mZPosInVolume >> this->mVolume->m_uChunkSideLengthPower;
const int32_t uXChunk = this->mXPosInVolume >> this->mVolume->m_uChunkSideLengthPower;
const int32_t uYChunk = this->mYPosInVolume >> this->mVolume->m_uChunkSideLengthPower;
const int32_t uZChunk = this->mZPosInVolume >> this->mVolume->m_uChunkSideLengthPower;
const uint16_t uXPosInChunk = static_cast<uint16_t>(this->mXPosInVolume - (uXChunk << this->mVolume->m_uChunkSideLengthPower));
const uint16_t uYPosInChunk = static_cast<uint16_t>(this->mYPosInVolume - (uYChunk << this->mVolume->m_uChunkSideLengthPower));
const uint16_t uZPosInChunk = static_cast<uint16_t>(this->mZPosInVolume - (uZChunk << this->mVolume->m_uChunkSideLengthPower));
const uint16_t uXPosInChunk = static_cast<uint16_t>(this->mXPosInVolume - (uXChunk << this->mVolume->m_uChunkSideLengthPower));
const uint16_t uYPosInChunk = static_cast<uint16_t>(this->mYPosInVolume - (uYChunk << this->mVolume->m_uChunkSideLengthPower));
const uint16_t uZPosInChunk = static_cast<uint16_t>(this->mZPosInVolume - (uZChunk << this->mVolume->m_uChunkSideLengthPower));
const uint32_t uVoxelIndexInChunk = uXPosInChunk +
uYPosInChunk * this->mVolume->m_uChunkSideLength +
uZPosInChunk * this->mVolume->m_uChunkSideLength * this->mVolume->m_uChunkSideLength;
const uint32_t uVoxelIndexInChunk = uXPosInChunk +
uYPosInChunk * this->mVolume->m_uChunkSideLength +
uZPosInChunk * this->mVolume->m_uChunkSideLength * this->mVolume->m_uChunkSideLength;
auto pCurrentChunk = this->mVolume->getChunk(uXChunk, uYChunk, uZChunk);
auto pCurrentChunk = this->mVolume->getChunk(uXChunk, uYChunk, uZChunk);
mCurrentVoxel = pCurrentChunk->m_tData + uVoxelIndexInChunk;
}
else
{
mCurrentVoxel = 0;
}
mCurrentVoxel = pCurrentChunk->m_tData + uVoxelIndexInChunk;
}
template <typename VoxelType>
@ -150,14 +135,11 @@ namespace PolyVox
template <typename VoxelType>
void PagedVolume<VoxelType>::Sampler::movePositiveX(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::movePositiveX();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mXPosInVolume) % this->mVolume->m_uChunkSideLength != 0))
if((this->mXPosInVolume) % this->mVolume->m_uChunkSideLength != 0)
{
//No need to compute new chunk.
++mCurrentVoxel;
@ -172,14 +154,11 @@ namespace PolyVox
template <typename VoxelType>
void PagedVolume<VoxelType>::Sampler::movePositiveY(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::movePositiveY();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mYPosInVolume) % this->mVolume->m_uChunkSideLength != 0))
if((this->mYPosInVolume) % this->mVolume->m_uChunkSideLength != 0)
{
//No need to compute new chunk.
mCurrentVoxel += this->mVolume->m_uChunkSideLength;
@ -194,14 +173,11 @@ namespace PolyVox
template <typename VoxelType>
void PagedVolume<VoxelType>::Sampler::movePositiveZ(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::movePositiveZ();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mZPosInVolume) % this->mVolume->m_uChunkSideLength != 0))
if((this->mZPosInVolume) % this->mVolume->m_uChunkSideLength != 0)
{
//No need to compute new chunk.
mCurrentVoxel += this->mVolume->m_uChunkSideLength * this->mVolume->m_uChunkSideLength;
@ -216,14 +192,11 @@ namespace PolyVox
template <typename VoxelType>
void PagedVolume<VoxelType>::Sampler::moveNegativeX(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::moveNegativeX();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mXPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0))
if((this->mXPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0)
{
//No need to compute new chunk.
--mCurrentVoxel;
@ -238,14 +211,11 @@ namespace PolyVox
template <typename VoxelType>
void PagedVolume<VoxelType>::Sampler::moveNegativeY(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::moveNegativeY();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mYPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0))
if((this->mYPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0)
{
//No need to compute new chunk.
mCurrentVoxel -= this->mVolume->m_uChunkSideLength;
@ -260,14 +230,11 @@ namespace PolyVox
template <typename VoxelType>
void PagedVolume<VoxelType>::Sampler::moveNegativeZ(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::moveNegativeZ();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mZPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0))
if((this->mZPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0)
{
//No need to compute new chunk.
mCurrentVoxel -= this->mVolume->m_uChunkSideLength * this->mVolume->m_uChunkSideLength;
@ -282,7 +249,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 - this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -292,7 +259,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel - 1 - this->mVolume->m_uChunkSideLength);
}
@ -302,7 +269,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 - this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -312,7 +279,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -322,7 +289,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) )
{
return *(mCurrentVoxel - 1);
}
@ -332,7 +299,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -342,7 +309,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 + this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -352,7 +319,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel - 1 + this->mVolume->m_uChunkSideLength);
}
@ -362,7 +329,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 + this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -374,7 +341,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -384,7 +351,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) )
if( CAN_GO_NEG_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel - this->mVolume->m_uChunkSideLength);
}
@ -394,7 +361,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -404,7 +371,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -414,17 +381,13 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px0py0pz(void) const
{
if((this->isCurrentPositionValid()))
{
return *mCurrentVoxel;
}
return this->mVolume->getVoxel(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
return *mCurrentVoxel;
}
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -434,7 +397,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -444,7 +407,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) )
if( CAN_GO_POS_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel + this->mVolume->m_uChunkSideLength);
}
@ -454,7 +417,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -466,7 +429,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 - this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -476,7 +439,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel + 1 - this->mVolume->m_uChunkSideLength);
}
@ -486,7 +449,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 - this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -496,7 +459,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -506,7 +469,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) )
{
return *(mCurrentVoxel + 1);
}
@ -516,7 +479,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -526,7 +489,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 + this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}
@ -536,7 +499,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel + 1 + this->mVolume->m_uChunkSideLength);
}
@ -546,7 +509,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 + this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
}

View File

@ -45,14 +45,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::getVoxel(void) const
{
if(this->isCurrentPositionValid())
{
return *mCurrentVoxel;
}
else
{
return this->getVoxelImpl(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
}
return *mCurrentVoxel;
}
template <typename VoxelType>
@ -67,165 +60,89 @@ namespace PolyVox
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::setPosition(xPos, yPos, zPos);
// Then we update the voxel pointer
if(this->isCurrentPositionValid())
{
const Vector3DInt32& v3dLowerCorner = this->mVolume->m_regValidRegion.getLowerCorner();
int32_t iLocalXPos = xPos - v3dLowerCorner.getX();
int32_t iLocalYPos = yPos - v3dLowerCorner.getY();
int32_t iLocalZPos = zPos - v3dLowerCorner.getZ();
const Vector3DInt32& v3dLowerCorner = this->mVolume->m_regValidRegion.getLowerCorner();
int32_t iLocalXPos = xPos - v3dLowerCorner.getX();
int32_t iLocalYPos = yPos - v3dLowerCorner.getY();
int32_t iLocalZPos = zPos - v3dLowerCorner.getZ();
const int32_t uVoxelIndex = iLocalXPos +
iLocalYPos * this->mVolume->getWidth() +
iLocalZPos * this->mVolume->getWidth() * this->mVolume->getHeight();
const int32_t uVoxelIndex = iLocalXPos +
iLocalYPos * this->mVolume->getWidth() +
iLocalZPos * this->mVolume->getWidth() * this->mVolume->getHeight();
mCurrentVoxel = this->mVolume->m_pData + uVoxelIndex;
}
else
{
mCurrentVoxel = 0;
}
mCurrentVoxel = this->mVolume->m_pData + uVoxelIndex;
}
template <typename VoxelType>
bool RawVolume<VoxelType>::Sampler::setVoxel(VoxelType tValue)
{
//return m_bIsCurrentPositionValid ? *mCurrentVoxel : this->mVolume->getBorderValue();
if(this->m_bIsCurrentPositionValidInX && this->m_bIsCurrentPositionValidInY && this->m_bIsCurrentPositionValidInZ)
{
*mCurrentVoxel = tValue;
return true;
}
else
{
return false;
}
*mCurrentVoxel = tValue;
return true;
}
template <typename VoxelType>
void RawVolume<VoxelType>::Sampler::movePositiveX(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveX();
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
++mCurrentVoxel;
}
else
{
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
}
++mCurrentVoxel;
}
template <typename VoxelType>
void RawVolume<VoxelType>::Sampler::movePositiveY(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveY();
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
mCurrentVoxel += this->mVolume->getWidth();
}
else
{
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
}
mCurrentVoxel += this->mVolume->getWidth();
}
template <typename VoxelType>
void RawVolume<VoxelType>::Sampler::movePositiveZ(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveZ();
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
mCurrentVoxel += this->mVolume->getWidth() * this->mVolume->getHeight();
}
else
{
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
}
mCurrentVoxel += this->mVolume->getWidth() * this->mVolume->getHeight();
}
template <typename VoxelType>
void RawVolume<VoxelType>::Sampler::moveNegativeX(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeX();
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
--mCurrentVoxel;
}
else
{
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
}
--mCurrentVoxel;
}
template <typename VoxelType>
void RawVolume<VoxelType>::Sampler::moveNegativeY(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeY();
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
mCurrentVoxel -= this->mVolume->getWidth();
}
else
{
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
}
mCurrentVoxel -= this->mVolume->getWidth();
}
template <typename VoxelType>
void RawVolume<VoxelType>::Sampler::moveNegativeZ(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeZ();
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
mCurrentVoxel -= this->mVolume->getWidth() * this->mVolume->getHeight();
}
else
{
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
}
mCurrentVoxel -= this->mVolume->getWidth() * this->mVolume->getHeight();
}
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -235,7 +152,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel - 1 - this->mVolume->getWidth());
}
@ -245,7 +162,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 - this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -255,7 +172,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 - this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -265,7 +182,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) )
{
return *(mCurrentVoxel - 1);
}
@ -275,7 +192,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 + this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -285,7 +202,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 + this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -295,7 +212,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel - 1 + this->mVolume->getWidth());
}
@ -305,7 +222,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - 1 + this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -317,7 +234,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -327,7 +244,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) )
if( CAN_GO_NEG_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel - this->mVolume->getWidth());
}
@ -337,7 +254,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -347,7 +264,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel - this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -357,17 +274,13 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py0pz(void) const
{
if((this->isCurrentPositionValid()))
{
return *mCurrentVoxel;
}
return this->mVolume->getVoxel(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
return *mCurrentVoxel;
}
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -377,7 +290,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -387,7 +300,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) )
if( CAN_GO_POS_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel + this->mVolume->getWidth());
}
@ -397,7 +310,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -409,7 +322,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -419,7 +332,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel + 1 - this->mVolume->getWidth());
}
@ -429,7 +342,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 - this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -439,7 +352,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 - this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -449,7 +362,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) )
{
return *(mCurrentVoxel + 1);
}
@ -459,7 +372,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 + this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -469,7 +382,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 + this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
}
@ -479,7 +392,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
{
return *(mCurrentVoxel + 1 + this->mVolume->getWidth());
}
@ -489,7 +402,7 @@ namespace PolyVox
template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const
{
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
{
return *(mCurrentVoxel + 1 + this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
}