From af04b961051894e00d15d80c96d346b0dd770f67 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 9 Mar 2012 16:03:46 +0100 Subject: [PATCH] Replaced sampler getPosX, etc, with general getPosition(). --- .../include/PolyVoxCore/BaseVolume.h | 4 +--- .../include/PolyVoxCore/BaseVolumeSampler.inl | 18 ++---------------- .../include/PolyVoxCore/GradientEstimators.inl | 18 +++++++++--------- .../include/PolyVoxCore/IteratorController.inl | 2 +- .../include/PolyVoxCore/LargeVolume.h | 3 --- .../include/PolyVoxCore/LargeVolumeSampler.inl | 18 ------------------ .../include/PolyVoxCore/RawVolume.h | 3 --- .../include/PolyVoxCore/RawVolumeSampler.inl | 18 ------------------ .../include/PolyVoxCore/SimpleVolume.h | 3 --- .../PolyVoxCore/SimpleVolumeSampler.inl | 18 ------------------ .../include/PolyVoxCore/SurfaceExtractor.inl | 4 ++-- 11 files changed, 15 insertions(+), 94 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h b/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h index 46ea2567..7b016988 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h +++ b/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h @@ -50,9 +50,7 @@ namespace PolyVox Sampler(DerivedVolumeType* volume); ~Sampler(); - int32_t getPosX(void) const; - int32_t getPosY(void) const; - int32_t getPosZ(void) const; + Vector3DInt32 getPosition(void) const; inline VoxelType getVoxel(void) const; void setPosition(const Vector3DInt32& v3dNewPos); diff --git a/library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl index 01fcca4a..d1a12a77 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl @@ -41,23 +41,9 @@ namespace PolyVox template template - int32_t BaseVolume::Sampler::getPosX(void) const + Vector3DInt32 BaseVolume::Sampler::getPosition(void) const { - return mXPosInVolume; - } - - template - template - int32_t BaseVolume::Sampler::getPosY(void) const - { - return mYPosInVolume; - } - - template - template - int32_t BaseVolume::Sampler::getPosZ(void) const - { - return mZPosInVolume; + return Vector3DInt32(mXPosInVolume, mYPosInVolume, mZPosInVolume); } template diff --git a/library/PolyVoxCore/include/PolyVoxCore/GradientEstimators.inl b/library/PolyVoxCore/include/PolyVoxCore/GradientEstimators.inl index eec70eca..0c92275d 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/GradientEstimators.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/GradientEstimators.inl @@ -47,9 +47,9 @@ namespace PolyVox template< template class VolumeType, typename VoxelType> Vector3DFloat computeDecimatedCentralDifferenceGradient(const typename VolumeType::Sampler& volIter) { - const int32_t x = volIter.getPosX(); - const int32_t y = volIter.getPosY(); - const int32_t z = volIter.getPosZ(); + const int32_t x = volIter.getPosition().getX(); + const int32_t y = volIter.getPosition().getY(); + const int32_t z = volIter.getPosition().getZ(); //FIXME - bitwise way of doing this? VoxelType voxel1nx = volIter.getVoxelAt(x-2, y ,z ) > 0 ? 1: 0; @@ -72,9 +72,9 @@ namespace PolyVox template< template class VolumeType, typename VoxelType> Vector3DFloat computeSmoothCentralDifferenceGradient(typename VolumeType::Sampler& volIter) { - int32_t initialX = volIter.getPosX(); - int32_t initialY = volIter.getPosY(); - int32_t initialZ = volIter.getPosZ(); + int32_t initialX = volIter.getPosition().getX(); + int32_t initialY = volIter.getPosition().getY(); + int32_t initialZ = volIter.getPosition().getZ(); //FIXME - bitwise way of doing this? volIter.setPosition(initialX-1, initialY, initialZ); @@ -189,9 +189,9 @@ namespace PolyVox static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, { {3,6,3}, {6,0,6}, {3,6,3} }, { {2,3,2}, {3,6,3}, {2,3,2} } }; - int32_t initialX = volIter.getPosX(); - int32_t initialY = volIter.getPosY(); - int32_t initialZ = volIter.getPosZ(); + int32_t initialX = volIter.getPosition().getX(); + int32_t initialY = volIter.getPosition().getY(); + int32_t initialZ = volIter.getPosition().getZ(); volIter.setPosition(initialX-1, initialY-1, initialZ-1); const float pVoxel1nx1ny1nz = computeSmoothedVoxel(volIter); volIter.setPosition(initialX-1, initialY-1, initialZ ); const float pVoxel1nx1ny0pz = computeSmoothedVoxel(volIter); diff --git a/library/PolyVoxCore/include/PolyVoxCore/IteratorController.inl b/library/PolyVoxCore/include/PolyVoxCore/IteratorController.inl index 82fbdd08..d5aef352 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/IteratorController.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/IteratorController.inl @@ -32,7 +32,7 @@ namespace PolyVox template bool IteratorController::moveForward(void) { - Vector3DInt32 v3dInitialPosition(m_Iter->getPosX(), m_Iter->getPosY(), m_Iter->getPosZ()); + Vector3DInt32 v3dInitialPosition(m_Iter->getPosition().getX(), m_Iter->getPosition().getY(), m_Iter->getPosition().getZ()); if(v3dInitialPosition.getX() < m_regValid.getUpperCorner().getX()) { diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h index 40bfd437..d6a7ecd2 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h @@ -172,9 +172,6 @@ namespace PolyVox Sampler& operator=(const Sampler& rhs) throw(); - int32_t getPosX(void) const; - int32_t getPosY(void) const; - int32_t getPosZ(void) const; VoxelType getSubSampledVoxel(uint8_t uLevel) const; inline VoxelType getVoxel(void) const; diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl index 70f2791f..73c36d84 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl @@ -54,24 +54,6 @@ namespace PolyVox return *this; } - template - int32_t LargeVolume::Sampler::getPosX(void) const - { - return this->mXPosInVolume; - } - - template - int32_t LargeVolume::Sampler::getPosY(void) const - { - return this->mYPosInVolume; - } - - template - int32_t LargeVolume::Sampler::getPosZ(void) const - { - return this->mZPosInVolume; - } - template VoxelType LargeVolume::Sampler::getSubSampledVoxel(uint8_t uLevel) const { diff --git a/library/PolyVoxCore/include/PolyVoxCore/RawVolume.h b/library/PolyVoxCore/include/PolyVoxCore/RawVolume.h index 87be81d4..dd799ea4 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/RawVolume.h +++ b/library/PolyVoxCore/include/PolyVoxCore/RawVolume.h @@ -59,9 +59,6 @@ namespace PolyVox Sampler(RawVolume* volume); ~Sampler(); - int32_t getPosX(void) const; - int32_t getPosY(void) const; - int32_t getPosZ(void) const; inline VoxelType getVoxel(void) const; void setPosition(const Vector3DInt32& v3dNewPos); diff --git a/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl index a967e728..05d23f3c 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl @@ -45,24 +45,6 @@ namespace PolyVox { } - template - int32_t RawVolume::Sampler::getPosX(void) const - { - return this->mXPosInVolume; - } - - template - int32_t RawVolume::Sampler::getPosY(void) const - { - return this->mYPosInVolume; - } - - template - int32_t RawVolume::Sampler::getPosZ(void) const - { - return this->mZPosInVolume; - } - template VoxelType RawVolume::Sampler::getVoxel(void) const { diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h index 57c18647..f6c4c48c 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h @@ -87,9 +87,6 @@ namespace PolyVox Sampler& operator=(const Sampler& rhs) throw(); - int32_t getPosX(void) const; - int32_t getPosY(void) const; - int32_t getPosZ(void) const; VoxelType getSubSampledVoxel(uint8_t uLevel) const; inline VoxelType getVoxel(void) const; diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl index aaf69b88..987912d2 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl @@ -54,24 +54,6 @@ namespace PolyVox return *this; } - template - int32_t SimpleVolume::Sampler::getPosX(void) const - { - return this->mXPosInVolume; - } - - template - int32_t SimpleVolume::Sampler::getPosY(void) const - { - return this->mYPosInVolume; - } - - template - int32_t SimpleVolume::Sampler::getPosZ(void) const - { - return this->mZPosInVolume; - } - template VoxelType SimpleVolume::Sampler::getSubSampledVoxel(uint8_t uLevel) const { diff --git a/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl index 29302aa0..e4c975bd 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl @@ -531,8 +531,8 @@ namespace PolyVox m_sampVolume.setPosition(iXVolSpace,iYVolSpace,iZVolSpace); //Current position - const uint32_t uXRegSpace = m_sampVolume.getPosX() - m_regSizeInVoxels.getLowerCorner().getX(); - const uint32_t uYRegSpace = m_sampVolume.getPosY() - m_regSizeInVoxels.getLowerCorner().getY(); + const uint32_t uXRegSpace = m_sampVolume.getPosition().getX() - m_regSizeInVoxels.getLowerCorner().getX(); + const uint32_t uYRegSpace = m_sampVolume.getPosition().getY() - m_regSizeInVoxels.getLowerCorner().getY(); //Determine the index into the edge table which tells us which vertices are inside of the surface uint8_t iCubeIndex = pPreviousBitmask[uXRegSpace][uYRegSpace];