Added extra tests to move functions.
This commit is contained in:
parent
fea429a79a
commit
d0c9b7ba3d
@ -145,7 +145,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::movePositiveX();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mXPosInVolume) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mXPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
++mCurrentVoxel;
|
||||
@ -164,7 +164,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::movePositiveY();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mYPosInVolume) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mYPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
mCurrentVoxel += this->mVolume->m_uBlockSideLength;
|
||||
@ -183,7 +183,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::movePositiveZ();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mZPosInVolume) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mZPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
mCurrentVoxel += this->mVolume->m_uBlockSideLength * this->mVolume->m_uBlockSideLength;
|
||||
@ -202,7 +202,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::moveNegativeX();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mXPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mXPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
--mCurrentVoxel;
|
||||
@ -221,7 +221,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::moveNegativeY();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mYPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mYPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
mCurrentVoxel -= this->mVolume->m_uBlockSideLength;
|
||||
@ -240,7 +240,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::moveNegativeZ();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mZPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mZPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
mCurrentVoxel -= this->mVolume->m_uBlockSideLength * this->mVolume->m_uBlockSideLength;
|
||||
|
@ -102,8 +102,15 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveX();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
++mCurrentVoxel;
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void RawVolume<VoxelType>::Sampler::movePositiveY(void)
|
||||
@ -112,8 +119,15 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveY();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
mCurrentVoxel += this->mVolume->getWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void RawVolume<VoxelType>::Sampler::movePositiveZ(void)
|
||||
@ -122,8 +136,15 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveZ();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
mCurrentVoxel += this->mVolume->getWidth() * this->mVolume->getHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void RawVolume<VoxelType>::Sampler::moveNegativeX(void)
|
||||
@ -132,8 +153,15 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeX();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
--mCurrentVoxel;
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void RawVolume<VoxelType>::Sampler::moveNegativeY(void)
|
||||
@ -142,8 +170,15 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeY();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
mCurrentVoxel -= this->mVolume->getWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void RawVolume<VoxelType>::Sampler::moveNegativeZ(void)
|
||||
@ -152,8 +187,15 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeZ();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
mCurrentVoxel -= this->mVolume->getWidth() * this->mVolume->getHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType RawVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
|
||||
|
@ -164,7 +164,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< SimpleVolume<VoxelType> >::movePositiveX();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mXPosInVolume) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mXPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
++mCurrentVoxel;
|
||||
@ -183,7 +183,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< SimpleVolume<VoxelType> >::movePositiveY();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mYPosInVolume) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mYPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
mCurrentVoxel += this->mVolume->m_uBlockSideLength;
|
||||
@ -202,7 +202,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< SimpleVolume<VoxelType> >::movePositiveZ();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mZPosInVolume) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mZPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
mCurrentVoxel += this->mVolume->m_uBlockSideLength * this->mVolume->m_uBlockSideLength;
|
||||
@ -221,7 +221,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< SimpleVolume<VoxelType> >::moveNegativeX();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mXPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mXPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
--mCurrentVoxel;
|
||||
@ -240,7 +240,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< SimpleVolume<VoxelType> >::moveNegativeY();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mYPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mYPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
mCurrentVoxel -= this->mVolume->m_uBlockSideLength;
|
||||
@ -259,7 +259,7 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< SimpleVolume<VoxelType> >::moveNegativeZ();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
if((this->mZPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0)
|
||||
if((this->isCurrentPositionValid()) && ((this->mZPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
{
|
||||
//No need to compute new block.
|
||||
mCurrentVoxel -= this->mVolume->m_uBlockSideLength * this->mVolume->m_uBlockSideLength;
|
||||
|
@ -116,11 +116,11 @@ int32_t complexVolumeTest(void)
|
||||
zSampler.setWrapMode(WrapModes::Border, 1);
|
||||
sampler.setWrapMode(WrapModes::Border, 1);
|
||||
|
||||
//zSampler.setPosition(testVolume.getEnclosingRegion().getLowerX() - 4, testVolume.getEnclosingRegion().getLowerY() - 1, testVolume.getEnclosingRegion().getLowerZ() - 2);
|
||||
zSampler.setPosition(testVolume.getEnclosingRegion().getLowerX() - 4, testVolume.getEnclosingRegion().getLowerY() - 1, testVolume.getEnclosingRegion().getLowerZ() - 2);
|
||||
for(int z = testVolume.getEnclosingRegion().getLowerZ() - 2; z <= testVolume.getEnclosingRegion().getUpperZ() + 1; z++)
|
||||
{
|
||||
//ySampler = zSampler;
|
||||
ySampler.setPosition(testVolume.getEnclosingRegion().getLowerX() - 4, testVolume.getEnclosingRegion().getLowerY() - 1, z);
|
||||
ySampler = zSampler;
|
||||
//ySampler.setPosition(testVolume.getEnclosingRegion().getLowerX() - 4, testVolume.getEnclosingRegion().getLowerY() - 1, z);
|
||||
for(int y = testVolume.getEnclosingRegion().getLowerY() - 1; y <= testVolume.getEnclosingRegion().getUpperY() + 3; y++)
|
||||
{
|
||||
xSampler = ySampler;
|
||||
@ -137,7 +137,7 @@ int32_t complexVolumeTest(void)
|
||||
}
|
||||
ySampler.movePositiveY();
|
||||
}
|
||||
//zSampler.movePositiveZ();
|
||||
zSampler.movePositiveZ();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user