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,7 +102,14 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveX();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
++mCurrentVoxel;
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
++mCurrentVoxel;
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
@ -112,7 +119,14 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveY();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
mCurrentVoxel += this->mVolume->getWidth();
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
mCurrentVoxel += this->mVolume->getWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
@ -122,7 +136,14 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveZ();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
mCurrentVoxel += this->mVolume->getWidth() * this->mVolume->getHeight();
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
mCurrentVoxel += this->mVolume->getWidth() * this->mVolume->getHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
@ -132,7 +153,14 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeX();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
--mCurrentVoxel;
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
--mCurrentVoxel;
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
@ -142,7 +170,14 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeY();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
mCurrentVoxel -= this->mVolume->getWidth();
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
mCurrentVoxel -= this->mVolume->getWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
@ -152,7 +187,14 @@ namespace PolyVox
|
||||
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeZ();
|
||||
|
||||
// Then we update the voxel pointer
|
||||
mCurrentVoxel -= this->mVolume->getWidth() * this->mVolume->getHeight();
|
||||
if(this->isCurrentPositionValid())
|
||||
{
|
||||
mCurrentVoxel -= this->mVolume->getWidth() * this->mVolume->getHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
|
@ -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