Added extra tests to move functions.

This commit is contained in:
Daviw Williams
2012-12-07 13:38:39 +01:00
parent fea429a79a
commit d0c9b7ba3d
4 changed files with 64 additions and 22 deletions

View File

@ -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;