Improved the logic of a few tests.

This commit is contained in:
David Williams
2012-12-08 10:42:59 +01:00
parent c49caa1511
commit b93ceca542
3 changed files with 72 additions and 18 deletions

View File

@ -148,11 +148,14 @@ namespace PolyVox
template <typename VoxelType>
void LargeVolume<VoxelType>::Sampler::movePositiveX(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::movePositiveX();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && mCurrentVoxel && ((this->mXPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mXPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
{
//No need to compute new block.
++mCurrentVoxel;
@ -167,11 +170,14 @@ namespace PolyVox
template <typename VoxelType>
void LargeVolume<VoxelType>::Sampler::movePositiveY(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::movePositiveY();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && mCurrentVoxel && ((this->mYPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mYPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
{
//No need to compute new block.
mCurrentVoxel += this->mVolume->m_uBlockSideLength;
@ -186,11 +192,14 @@ namespace PolyVox
template <typename VoxelType>
void LargeVolume<VoxelType>::Sampler::movePositiveZ(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::movePositiveZ();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && mCurrentVoxel && ((this->mZPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mZPosInVolume) % this->mVolume->m_uBlockSideLength != 0))
{
//No need to compute new block.
mCurrentVoxel += this->mVolume->m_uBlockSideLength * this->mVolume->m_uBlockSideLength;
@ -205,11 +214,14 @@ namespace PolyVox
template <typename VoxelType>
void LargeVolume<VoxelType>::Sampler::moveNegativeX(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::moveNegativeX();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && mCurrentVoxel && ((this->mXPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mXPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
{
//No need to compute new block.
--mCurrentVoxel;
@ -224,11 +236,14 @@ namespace PolyVox
template <typename VoxelType>
void LargeVolume<VoxelType>::Sampler::moveNegativeY(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::moveNegativeY();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && mCurrentVoxel && ((this->mYPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mYPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
{
//No need to compute new block.
mCurrentVoxel -= this->mVolume->m_uBlockSideLength;
@ -243,11 +258,14 @@ namespace PolyVox
template <typename VoxelType>
void LargeVolume<VoxelType>::Sampler::moveNegativeZ(void)
{
// We'll need this in a moment...
bool bIsOldPositionValid = this->isCurrentPositionValid();
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >::moveNegativeZ();
// Then we update the voxel pointer
if((this->isCurrentPositionValid()) && mCurrentVoxel && ((this->mZPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
if((this->isCurrentPositionValid()) && bIsOldPositionValid && ((this->mZPosInVolume + 1) % this->mVolume->m_uBlockSideLength != 0))
{
//No need to compute new block.
mCurrentVoxel -= this->mVolume->m_uBlockSideLength * this->mVolume->m_uBlockSideLength;