Revert "More work on removing wrap modes."
This reverts commit 6817899e6a9f18d708597f6cdabfffed7d4f671f.
This commit is contained in:
parent
6817899e6a
commit
1853a0fc4e
@ -127,6 +127,12 @@ namespace PolyVox
|
|||||||
|
|
||||||
WrapMode m_eWrapMode;
|
WrapMode m_eWrapMode;
|
||||||
VoxelType m_tBorder;
|
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
|
#endif
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@ namespace PolyVox
|
|||||||
,mZPosInVolume(0)
|
,mZPosInVolume(0)
|
||||||
,m_eWrapMode(WrapModes::Border)
|
,m_eWrapMode(WrapModes::Border)
|
||||||
,m_tBorder()
|
,m_tBorder()
|
||||||
|
,m_bIsCurrentPositionValidInX(false)
|
||||||
|
,m_bIsCurrentPositionValidInY(false)
|
||||||
|
,m_bIsCurrentPositionValidInZ(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,8 +64,7 @@ namespace PolyVox
|
|||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
bool inline BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::isCurrentPositionValid(void) const
|
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>
|
template <typename VoxelType>
|
||||||
@ -79,6 +81,10 @@ namespace PolyVox
|
|||||||
mXPosInVolume = xPos;
|
mXPosInVolume = xPos;
|
||||||
mYPosInVolume = yPos;
|
mYPosInVolume = yPos;
|
||||||
mZPosInVolume = zPos;
|
mZPosInVolume = zPos;
|
||||||
|
|
||||||
|
m_bIsCurrentPositionValidInX = mVolume->getEnclosingRegion().containsPointInX(xPos);
|
||||||
|
m_bIsCurrentPositionValidInY = mVolume->getEnclosingRegion().containsPointInY(yPos);
|
||||||
|
m_bIsCurrentPositionValidInZ = mVolume->getEnclosingRegion().containsPointInZ(zPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
@ -101,6 +107,7 @@ namespace PolyVox
|
|||||||
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveX(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveX(void)
|
||||||
{
|
{
|
||||||
mXPosInVolume++;
|
mXPosInVolume++;
|
||||||
|
m_bIsCurrentPositionValidInX = mVolume->getEnclosingRegion().containsPointInX(mXPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
@ -108,6 +115,7 @@ namespace PolyVox
|
|||||||
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveY(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveY(void)
|
||||||
{
|
{
|
||||||
mYPosInVolume++;
|
mYPosInVolume++;
|
||||||
|
m_bIsCurrentPositionValidInY = mVolume->getEnclosingRegion().containsPointInY(mYPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
@ -115,6 +123,7 @@ namespace PolyVox
|
|||||||
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveZ(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveZ(void)
|
||||||
{
|
{
|
||||||
mZPosInVolume++;
|
mZPosInVolume++;
|
||||||
|
m_bIsCurrentPositionValidInZ = mVolume->getEnclosingRegion().containsPointInZ(mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
@ -122,6 +131,7 @@ namespace PolyVox
|
|||||||
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeX(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeX(void)
|
||||||
{
|
{
|
||||||
mXPosInVolume--;
|
mXPosInVolume--;
|
||||||
|
m_bIsCurrentPositionValidInX = mVolume->getEnclosingRegion().containsPointInX(mXPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
@ -129,6 +139,7 @@ namespace PolyVox
|
|||||||
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeY(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeY(void)
|
||||||
{
|
{
|
||||||
mYPosInVolume--;
|
mYPosInVolume--;
|
||||||
|
m_bIsCurrentPositionValidInY = mVolume->getEnclosingRegion().containsPointInY(mYPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
@ -136,6 +147,7 @@ namespace PolyVox
|
|||||||
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeZ(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeZ(void)
|
||||||
{
|
{
|
||||||
mZPosInVolume--;
|
mZPosInVolume--;
|
||||||
|
m_bIsCurrentPositionValidInZ = mVolume->getEnclosingRegion().containsPointInZ(mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
|
@ -146,7 +146,7 @@ namespace PolyVox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*typename RawVolume<AccumulationType>::Sampler satVolumeIter(&satVolume);
|
typename RawVolume<AccumulationType>::Sampler satVolumeIter(&satVolume);
|
||||||
|
|
||||||
IteratorController<typename RawVolume<AccumulationType>::Sampler> satIterCont;
|
IteratorController<typename RawVolume<AccumulationType>::Sampler> satIterCont;
|
||||||
satIterCont.m_regValid = Region(satLowerCorner, satUpperCorner);
|
satIterCont.m_regValid = Region(satLowerCorner, satUpperCorner);
|
||||||
@ -169,27 +169,7 @@ namespace PolyVox
|
|||||||
|
|
||||||
srcIterCont.moveForward();
|
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
|
//Build SAT in three passes
|
||||||
/*for(int32_t z = satLowerCorner.getZ(); z <= satUpperCorner.getZ(); z++)
|
/*for(int32_t z = satLowerCorner.getZ(); z <= satUpperCorner.getZ(); z++)
|
||||||
|
@ -82,7 +82,14 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::getVoxel(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::getVoxel(void) const
|
||||||
{
|
{
|
||||||
return *mCurrentVoxel;
|
if(this->isCurrentPositionValid())
|
||||||
|
{
|
||||||
|
return *mCurrentVoxel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return this->getVoxelImpl(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
@ -97,21 +104,29 @@ namespace PolyVox
|
|||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::setPosition(xPos, yPos, zPos);
|
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::setPosition(xPos, yPos, zPos);
|
||||||
|
|
||||||
const int32_t uXChunk = this->mXPosInVolume >> this->mVolume->m_uChunkSideLengthPower;
|
// Then we update the voxel pointer
|
||||||
const int32_t uYChunk = this->mYPosInVolume >> this->mVolume->m_uChunkSideLengthPower;
|
if(this->isCurrentPositionValid())
|
||||||
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 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 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 uZPosInChunk = static_cast<uint16_t>(this->mZPosInVolume - (uZChunk << this->mVolume->m_uChunkSideLengthPower));
|
||||||
|
|
||||||
const uint32_t uVoxelIndexInChunk = uXPosInChunk +
|
const uint32_t uVoxelIndexInChunk = uXPosInChunk +
|
||||||
uYPosInChunk * this->mVolume->m_uChunkSideLength +
|
uYPosInChunk * this->mVolume->m_uChunkSideLength +
|
||||||
uZPosInChunk * this->mVolume->m_uChunkSideLength * 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;
|
mCurrentVoxel = pCurrentChunk->m_tData + uVoxelIndexInChunk;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCurrentVoxel = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
@ -135,11 +150,14 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void PagedVolume<VoxelType>::Sampler::movePositiveX(void)
|
void PagedVolume<VoxelType>::Sampler::movePositiveX(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::movePositiveX();
|
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::movePositiveX();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
if((this->mXPosInVolume) % this->mVolume->m_uChunkSideLength != 0)
|
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mXPosInVolume) % this->mVolume->m_uChunkSideLength != 0))
|
||||||
{
|
{
|
||||||
//No need to compute new chunk.
|
//No need to compute new chunk.
|
||||||
++mCurrentVoxel;
|
++mCurrentVoxel;
|
||||||
@ -154,11 +172,14 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void PagedVolume<VoxelType>::Sampler::movePositiveY(void)
|
void PagedVolume<VoxelType>::Sampler::movePositiveY(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::movePositiveY();
|
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::movePositiveY();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
if((this->mYPosInVolume) % this->mVolume->m_uChunkSideLength != 0)
|
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mYPosInVolume) % this->mVolume->m_uChunkSideLength != 0))
|
||||||
{
|
{
|
||||||
//No need to compute new chunk.
|
//No need to compute new chunk.
|
||||||
mCurrentVoxel += this->mVolume->m_uChunkSideLength;
|
mCurrentVoxel += this->mVolume->m_uChunkSideLength;
|
||||||
@ -173,11 +194,14 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void PagedVolume<VoxelType>::Sampler::movePositiveZ(void)
|
void PagedVolume<VoxelType>::Sampler::movePositiveZ(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::movePositiveZ();
|
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::movePositiveZ();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
if((this->mZPosInVolume) % this->mVolume->m_uChunkSideLength != 0)
|
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mZPosInVolume) % this->mVolume->m_uChunkSideLength != 0))
|
||||||
{
|
{
|
||||||
//No need to compute new chunk.
|
//No need to compute new chunk.
|
||||||
mCurrentVoxel += this->mVolume->m_uChunkSideLength * this->mVolume->m_uChunkSideLength;
|
mCurrentVoxel += this->mVolume->m_uChunkSideLength * this->mVolume->m_uChunkSideLength;
|
||||||
@ -192,11 +216,14 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void PagedVolume<VoxelType>::Sampler::moveNegativeX(void)
|
void PagedVolume<VoxelType>::Sampler::moveNegativeX(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::moveNegativeX();
|
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::moveNegativeX();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
if((this->mXPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0)
|
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mXPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0))
|
||||||
{
|
{
|
||||||
//No need to compute new chunk.
|
//No need to compute new chunk.
|
||||||
--mCurrentVoxel;
|
--mCurrentVoxel;
|
||||||
@ -211,11 +238,14 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void PagedVolume<VoxelType>::Sampler::moveNegativeY(void)
|
void PagedVolume<VoxelType>::Sampler::moveNegativeY(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::moveNegativeY();
|
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::moveNegativeY();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
if((this->mYPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0)
|
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mYPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0))
|
||||||
{
|
{
|
||||||
//No need to compute new chunk.
|
//No need to compute new chunk.
|
||||||
mCurrentVoxel -= this->mVolume->m_uChunkSideLength;
|
mCurrentVoxel -= this->mVolume->m_uChunkSideLength;
|
||||||
@ -230,11 +260,14 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void PagedVolume<VoxelType>::Sampler::moveNegativeZ(void)
|
void PagedVolume<VoxelType>::Sampler::moveNegativeZ(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::moveNegativeZ();
|
BaseVolume<VoxelType>::template Sampler< PagedVolume<VoxelType> >::moveNegativeZ();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
if((this->mZPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0)
|
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mZPosInVolume + 1) % this->mVolume->m_uChunkSideLength != 0))
|
||||||
{
|
{
|
||||||
//No need to compute new chunk.
|
//No need to compute new chunk.
|
||||||
mCurrentVoxel -= this->mVolume->m_uChunkSideLength * this->mVolume->m_uChunkSideLength;
|
mCurrentVoxel -= this->mVolume->m_uChunkSideLength * this->mVolume->m_uChunkSideLength;
|
||||||
@ -249,7 +282,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel - 1 - this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -259,7 +292,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 - this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel - 1 - this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -269,7 +302,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel - 1 - this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -279,7 +312,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel - 1 - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -289,7 +322,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1);
|
return *(mCurrentVoxel - 1);
|
||||||
}
|
}
|
||||||
@ -299,7 +332,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel - 1 + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -309,7 +342,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel - 1 + this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -319,7 +352,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 + this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel - 1 + this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -329,7 +362,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel - 1 + this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -341,7 +374,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel - this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -351,7 +384,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel - this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -361,7 +394,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel - this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -371,7 +404,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -381,13 +414,17 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px0py0pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px0py0pz(void) const
|
||||||
{
|
{
|
||||||
return *mCurrentVoxel;
|
if((this->isCurrentPositionValid()))
|
||||||
|
{
|
||||||
|
return *mCurrentVoxel;
|
||||||
|
}
|
||||||
|
return this->mVolume->getVoxel(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -397,7 +434,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel + this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -407,7 +444,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel + this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -417,7 +454,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel + this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -429,7 +466,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel + 1 - this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -439,7 +476,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 - this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel + 1 - this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -449,7 +486,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel + 1 - this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -459,7 +496,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel + 1 - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -469,7 +506,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1);
|
return *(mCurrentVoxel + 1);
|
||||||
}
|
}
|
||||||
@ -479,7 +516,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel + 1 + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -489,7 +526,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel + 1 + this->mVolume->m_uChunkSideLength - this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -499,7 +536,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 + this->mVolume->m_uChunkSideLength);
|
return *(mCurrentVoxel + 1 + this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
@ -509,7 +546,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const
|
VoxelType PagedVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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);
|
return *(mCurrentVoxel + 1 + this->mVolume->m_uChunkSideLength + this->mVolume->m_uChunkSideLength*this->mVolume->m_uChunkSideLength);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,14 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::getVoxel(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::getVoxel(void) const
|
||||||
{
|
{
|
||||||
return *mCurrentVoxel;
|
if(this->isCurrentPositionValid())
|
||||||
|
{
|
||||||
|
return *mCurrentVoxel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return this->getVoxelImpl(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
@ -60,89 +67,165 @@ namespace PolyVox
|
|||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::setPosition(xPos, yPos, zPos);
|
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::setPosition(xPos, yPos, zPos);
|
||||||
|
|
||||||
const Vector3DInt32& v3dLowerCorner = this->mVolume->m_regValidRegion.getLowerCorner();
|
// Then we update the voxel pointer
|
||||||
int32_t iLocalXPos = xPos - v3dLowerCorner.getX();
|
if(this->isCurrentPositionValid())
|
||||||
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 +
|
const int32_t uVoxelIndex = iLocalXPos +
|
||||||
iLocalYPos * this->mVolume->getWidth() +
|
iLocalYPos * this->mVolume->getWidth() +
|
||||||
iLocalZPos * this->mVolume->getWidth() * this->mVolume->getHeight();
|
iLocalZPos * this->mVolume->getWidth() * this->mVolume->getHeight();
|
||||||
|
|
||||||
mCurrentVoxel = this->mVolume->m_pData + uVoxelIndex;
|
mCurrentVoxel = this->mVolume->m_pData + uVoxelIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCurrentVoxel = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
bool RawVolume<VoxelType>::Sampler::setVoxel(VoxelType tValue)
|
bool RawVolume<VoxelType>::Sampler::setVoxel(VoxelType tValue)
|
||||||
{
|
{
|
||||||
*mCurrentVoxel = tValue;
|
//return m_bIsCurrentPositionValid ? *mCurrentVoxel : this->mVolume->getBorderValue();
|
||||||
return true;
|
if(this->m_bIsCurrentPositionValidInX && this->m_bIsCurrentPositionValidInY && this->m_bIsCurrentPositionValidInZ)
|
||||||
|
{
|
||||||
|
*mCurrentVoxel = tValue;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void RawVolume<VoxelType>::Sampler::movePositiveX(void)
|
void RawVolume<VoxelType>::Sampler::movePositiveX(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveX();
|
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveX();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
++mCurrentVoxel;
|
if(this->isCurrentPositionValid() && bIsOldPositionValid )
|
||||||
|
{
|
||||||
|
++mCurrentVoxel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void RawVolume<VoxelType>::Sampler::movePositiveY(void)
|
void RawVolume<VoxelType>::Sampler::movePositiveY(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveY();
|
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveY();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
mCurrentVoxel += this->mVolume->getWidth();
|
if(this->isCurrentPositionValid() && bIsOldPositionValid )
|
||||||
|
{
|
||||||
|
mCurrentVoxel += this->mVolume->getWidth();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void RawVolume<VoxelType>::Sampler::movePositiveZ(void)
|
void RawVolume<VoxelType>::Sampler::movePositiveZ(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveZ();
|
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveZ();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
mCurrentVoxel += this->mVolume->getWidth() * this->mVolume->getHeight();
|
if(this->isCurrentPositionValid() && bIsOldPositionValid )
|
||||||
|
{
|
||||||
|
mCurrentVoxel += this->mVolume->getWidth() * this->mVolume->getHeight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void RawVolume<VoxelType>::Sampler::moveNegativeX(void)
|
void RawVolume<VoxelType>::Sampler::moveNegativeX(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeX();
|
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeX();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
--mCurrentVoxel;
|
if(this->isCurrentPositionValid() && bIsOldPositionValid )
|
||||||
|
{
|
||||||
|
--mCurrentVoxel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void RawVolume<VoxelType>::Sampler::moveNegativeY(void)
|
void RawVolume<VoxelType>::Sampler::moveNegativeY(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeY();
|
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeY();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
mCurrentVoxel -= this->mVolume->getWidth();
|
if(this->isCurrentPositionValid() && bIsOldPositionValid )
|
||||||
|
{
|
||||||
|
mCurrentVoxel -= this->mVolume->getWidth();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void RawVolume<VoxelType>::Sampler::moveNegativeZ(void)
|
void RawVolume<VoxelType>::Sampler::moveNegativeZ(void)
|
||||||
{
|
{
|
||||||
|
// We'll need this in a moment...
|
||||||
|
bool bIsOldPositionValid = this->isCurrentPositionValid();
|
||||||
|
|
||||||
// Base version updates position and validity flags.
|
// Base version updates position and validity flags.
|
||||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeZ();
|
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeZ();
|
||||||
|
|
||||||
// Then we update the voxel pointer
|
// Then we update the voxel pointer
|
||||||
mCurrentVoxel -= this->mVolume->getWidth() * this->mVolume->getHeight();
|
if(this->isCurrentPositionValid() && bIsOldPositionValid )
|
||||||
|
{
|
||||||
|
mCurrentVoxel -= this->mVolume->getWidth() * this->mVolume->getHeight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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());
|
return *(mCurrentVoxel - 1 - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -152,7 +235,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 - this->mVolume->getWidth());
|
return *(mCurrentVoxel - 1 - this->mVolume->getWidth());
|
||||||
}
|
}
|
||||||
@ -162,7 +245,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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());
|
return *(mCurrentVoxel - 1 - this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -172,7 +255,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 - this->mVolume->getWidth() * this->mVolume->getHeight());
|
return *(mCurrentVoxel - 1 - this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -182,7 +265,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1);
|
return *(mCurrentVoxel - 1);
|
||||||
}
|
}
|
||||||
@ -192,7 +275,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 + this->mVolume->getWidth() * this->mVolume->getHeight());
|
return *(mCurrentVoxel - 1 + this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -202,7 +285,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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());
|
return *(mCurrentVoxel - 1 + this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -212,7 +295,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 + this->mVolume->getWidth());
|
return *(mCurrentVoxel - 1 + this->mVolume->getWidth());
|
||||||
}
|
}
|
||||||
@ -222,7 +305,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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());
|
return *(mCurrentVoxel - 1 + this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -234,7 +317,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
|
return *(mCurrentVoxel - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -244,7 +327,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - this->mVolume->getWidth());
|
return *(mCurrentVoxel - this->mVolume->getWidth());
|
||||||
}
|
}
|
||||||
@ -254,7 +337,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
|
return *(mCurrentVoxel - this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -264,7 +347,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - this->mVolume->getWidth() * this->mVolume->getHeight());
|
return *(mCurrentVoxel - this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -274,13 +357,17 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py0pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py0pz(void) const
|
||||||
{
|
{
|
||||||
return *mCurrentVoxel;
|
if((this->isCurrentPositionValid()))
|
||||||
|
{
|
||||||
|
return *mCurrentVoxel;
|
||||||
|
}
|
||||||
|
return this->mVolume->getVoxel(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + this->mVolume->getWidth() * this->mVolume->getHeight());
|
return *(mCurrentVoxel + this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -290,7 +377,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
|
return *(mCurrentVoxel + this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -300,7 +387,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + this->mVolume->getWidth());
|
return *(mCurrentVoxel + this->mVolume->getWidth());
|
||||||
}
|
}
|
||||||
@ -310,7 +397,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
|
return *(mCurrentVoxel + this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -322,7 +409,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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());
|
return *(mCurrentVoxel + 1 - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -332,7 +419,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 - this->mVolume->getWidth());
|
return *(mCurrentVoxel + 1 - this->mVolume->getWidth());
|
||||||
}
|
}
|
||||||
@ -342,7 +429,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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());
|
return *(mCurrentVoxel + 1 - this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -352,7 +439,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 - this->mVolume->getWidth() * this->mVolume->getHeight());
|
return *(mCurrentVoxel + 1 - this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -362,7 +449,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1);
|
return *(mCurrentVoxel + 1);
|
||||||
}
|
}
|
||||||
@ -372,7 +459,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 + this->mVolume->getWidth() * this->mVolume->getHeight());
|
return *(mCurrentVoxel + 1 + this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -382,7 +469,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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());
|
return *(mCurrentVoxel + 1 + this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
@ -392,7 +479,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
|
if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) )
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 + this->mVolume->getWidth());
|
return *(mCurrentVoxel + 1 + this->mVolume->getWidth());
|
||||||
}
|
}
|
||||||
@ -402,7 +489,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const
|
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const
|
||||||
{
|
{
|
||||||
if( CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) )
|
if((this->isCurrentPositionValid()) && 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());
|
return *(mCurrentVoxel + 1 + this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user