|
|
|
@ -27,13 +27,23 @@ freely, subject to the following restrictions:
|
|
|
|
|
#include "PolyVoxCore/Region.h"
|
|
|
|
|
|
|
|
|
|
#include <limits>
|
|
|
|
|
|
|
|
|
|
#define BORDER_LOWX(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getX())
|
|
|
|
|
#define BORDER_HIGHX(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getX())
|
|
|
|
|
#define BORDER_LOWY(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getY())
|
|
|
|
|
#define BORDER_HIGHY(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getY())
|
|
|
|
|
#define BORDER_LOWZ(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getZ())
|
|
|
|
|
#define BORDER_HIGHZ(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getZ())
|
|
|
|
|
|
|
|
|
|
namespace PolyVox
|
|
|
|
|
{
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
RawVolume<VoxelType>::Sampler::Sampler(RawVolume<VoxelType>* volume)
|
|
|
|
|
:Volume<VoxelType>::template Sampler< RawVolume<VoxelType> >(volume)
|
|
|
|
|
,mCurrentVoxel(0)
|
|
|
|
|
,m_bIsCurrentPositionValid(false)
|
|
|
|
|
,m_bIsCurrentPositionValidInX(false)
|
|
|
|
|
,m_bIsCurrentPositionValidInY(false)
|
|
|
|
|
,m_bIsCurrentPositionValidInZ(false)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -63,7 +73,7 @@ namespace PolyVox
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::getVoxel(void) const
|
|
|
|
|
{
|
|
|
|
|
return m_bIsCurrentPositionValid ? *mCurrentVoxel : this->mVolume->getBorderValue();
|
|
|
|
|
return (m_bIsCurrentPositionValidInX && m_bIsCurrentPositionValidInY && m_bIsCurrentPositionValidInZ) ? *mCurrentVoxel : this->mVolume->getBorderValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
@ -79,25 +89,34 @@ namespace PolyVox
|
|
|
|
|
this->mYPosInVolume = yPos;
|
|
|
|
|
this->mZPosInVolume = zPos;
|
|
|
|
|
|
|
|
|
|
if(this->mVolume->getEnclosingRegion().containsPoint(Vector3DInt32(xPos, yPos, zPos)))
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
mCurrentVoxel = this->mVolume->m_pData + uVoxelIndex;
|
|
|
|
|
|
|
|
|
|
m_bIsCurrentPositionValidInX = mVolume->getEnclosingRegion().containsPointInX(xPos);
|
|
|
|
|
m_bIsCurrentPositionValidInY = mVolume->getEnclosingRegion().containsPointInY(yPos);
|
|
|
|
|
m_bIsCurrentPositionValidInZ = mVolume->getEnclosingRegion().containsPointInZ(zPos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
bool RawVolume<VoxelType>::Sampler::setVoxel(VoxelType tValue)
|
|
|
|
|
{
|
|
|
|
|
//return m_bIsCurrentPositionValid ? *mCurrentVoxel : this->mVolume->getBorderValue();
|
|
|
|
|
if(m_bIsCurrentPositionValidInX && m_bIsCurrentPositionValidInY && m_bIsCurrentPositionValidInZ)
|
|
|
|
|
{
|
|
|
|
|
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 uint32_t uVoxelIndex = iLocalXPos +
|
|
|
|
|
iLocalYPos * this->mVolume->getWidth() +
|
|
|
|
|
iLocalZPos * this->mVolume->getWidth() * this->mVolume->getHeight();
|
|
|
|
|
|
|
|
|
|
mCurrentVoxel = this->mVolume->m_pData + uVoxelIndex;
|
|
|
|
|
|
|
|
|
|
m_bIsCurrentPositionValid = true;
|
|
|
|
|
*mCurrentVoxel = tValue;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mCurrentVoxel = 0;
|
|
|
|
|
m_bIsCurrentPositionValid = false;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -106,7 +125,7 @@ namespace PolyVox
|
|
|
|
|
{
|
|
|
|
|
this->mXPosInVolume++;
|
|
|
|
|
++mCurrentVoxel;
|
|
|
|
|
m_bIsCurrentPositionValid = this->mXPosInVolume <= this->mVolume->getEnclosingRegion().getUpperCorner().getX();
|
|
|
|
|
m_bIsCurrentPositionValidInX = this->mVolume->getEnclosingRegion().containsPointInX(this->mXPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
@ -114,7 +133,7 @@ namespace PolyVox
|
|
|
|
|
{
|
|
|
|
|
this->mYPosInVolume++;
|
|
|
|
|
mCurrentVoxel += this->mVolume->getWidth();
|
|
|
|
|
m_bIsCurrentPositionValid = this->mYPosInVolume <= this->mVolume->getEnclosingRegion().getUpperCorner().getY();
|
|
|
|
|
m_bIsCurrentPositionValidInY = this->mVolume->getEnclosingRegion().containsPointInY(this->mYPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
@ -122,7 +141,7 @@ namespace PolyVox
|
|
|
|
|
{
|
|
|
|
|
this->mZPosInVolume++;
|
|
|
|
|
mCurrentVoxel += this->mVolume->getWidth() * this->mVolume->getHeight();
|
|
|
|
|
m_bIsCurrentPositionValid = this->mZPosInVolume <= this->mVolume->getEnclosingRegion().getUpperCorner().getZ();
|
|
|
|
|
m_bIsCurrentPositionValidInZ = this->mVolume->getEnclosingRegion().containsPointInZ(this->mZPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
@ -130,7 +149,7 @@ namespace PolyVox
|
|
|
|
|
{
|
|
|
|
|
this->mXPosInVolume--;
|
|
|
|
|
--mCurrentVoxel;
|
|
|
|
|
m_bIsCurrentPositionValid = this->mXPosInVolume >= this->mVolume->getEnclosingRegion().getLowerCorner().getX();
|
|
|
|
|
m_bIsCurrentPositionValidInX = this->mVolume->getEnclosingRegion().containsPointInX(this->mXPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
@ -138,7 +157,7 @@ namespace PolyVox
|
|
|
|
|
{
|
|
|
|
|
this->mYPosInVolume--;
|
|
|
|
|
mCurrentVoxel -= this->mVolume->getWidth();
|
|
|
|
|
m_bIsCurrentPositionValid = this->mYPosInVolume >= this->mVolume->getEnclosingRegion().getLowerCorner().getY();
|
|
|
|
|
m_bIsCurrentPositionValidInY = this->mVolume->getEnclosingRegion().containsPointInY(this->mYPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
@ -146,60 +165,96 @@ namespace PolyVox
|
|
|
|
|
{
|
|
|
|
|
this->mZPosInVolume--;
|
|
|
|
|
mCurrentVoxel -= this->mVolume->getWidth() * this->mVolume->getHeight();
|
|
|
|
|
m_bIsCurrentPositionValid =this->mZPosInVolume >= this->mVolume->getEnclosingRegion().getLowerCorner().getZ();
|
|
|
|
|
m_bIsCurrentPositionValidInZ = this->mVolume->getEnclosingRegion().containsPointInZ(this->mZPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - 1 - this->mVolume->getWidth() - this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume-1,this->mZPosInVolume-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - 1 - this->mVolume->getWidth());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume-1,this->mZPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - 1 - this->mVolume->getWidth() + this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume-1,this->mZPosInVolume+1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWX(this->mXPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - 1 - this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume,this->mZPosInVolume-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWX(this->mXPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - 1);
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume,this->mZPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWX(this->mXPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - 1 + this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume,this->mZPosInVolume+1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) && BORDER_LOWZ(this->mYPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - 1 + this->mVolume->getWidth() - this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume+1,this->mZPosInVolume-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - 1 + this->mVolume->getWidth());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume+1,this->mZPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - 1 + this->mVolume->getWidth() + this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume+1,this->mZPosInVolume+1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -208,24 +263,40 @@ namespace PolyVox
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWX(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - this->mVolume->getWidth() - this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume-1,this->mZPosInVolume-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWY(this->mYPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - this->mVolume->getWidth());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume-1,this->mZPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - this->mVolume->getWidth() + this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume-1,this->mZPosInVolume+1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_LOWZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel - this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume,this->mZPosInVolume-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -238,24 +309,40 @@ namespace PolyVox
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume,this->mZPosInVolume+1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + this->mVolume->getWidth() - this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume+1,this->mZPosInVolume-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHY(this->mYPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + this->mVolume->getWidth());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume+1,this->mZPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + this->mVolume->getWidth() + this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume+1,this->mZPosInVolume+1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -264,54 +351,97 @@ namespace PolyVox
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + 1 - this->mVolume->getWidth() - this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume-1,this->mZPosInVolume-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + 1 - this->mVolume->getWidth());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume-1,this->mZPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + 1 - this->mVolume->getWidth() + this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume-1,this->mZPosInVolume+1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHX(this->mXPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + 1 - this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume,this->mZPosInVolume-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHX(this->mXPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + 1);
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume,this->mZPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHX(this->mXPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + 1 + this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume,this->mZPosInVolume+1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + 1 + this->mVolume->getWidth() - this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume+1,this->mZPosInVolume-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + 1 + this->mVolume->getWidth());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume+1,this->mZPosInVolume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename VoxelType>
|
|
|
|
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const
|
|
|
|
|
{
|
|
|
|
|
if( BORDER_HIGHX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) )
|
|
|
|
|
{
|
|
|
|
|
return *(mCurrentVoxel + 1 + this->mVolume->getWidth() + this->mVolume->getHeight() * this->mVolume->getHeight());
|
|
|
|
|
}
|
|
|
|
|
return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume+1,this->mZPosInVolume+1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef BORDER_LOWX
|
|
|
|
|
#undef BORDER_HIGHX
|
|
|
|
|
#undef BORDER_LOWY
|
|
|
|
|
#undef BORDER_HIGHY
|
|
|
|
|
#undef BORDER_LOWZ
|
|
|
|
|
#undef BORDER_HIGHZ
|