Replaced sampler getPosX, etc, with general getPosition().

This commit is contained in:
unknown 2012-03-09 16:03:46 +01:00
parent 4658e8026e
commit af04b96105
11 changed files with 15 additions and 94 deletions

View File

@ -50,9 +50,7 @@ namespace PolyVox
Sampler(DerivedVolumeType* volume); Sampler(DerivedVolumeType* volume);
~Sampler(); ~Sampler();
int32_t getPosX(void) const; Vector3DInt32 getPosition(void) const;
int32_t getPosY(void) const;
int32_t getPosZ(void) const;
inline VoxelType getVoxel(void) const; inline VoxelType getVoxel(void) const;
void setPosition(const Vector3DInt32& v3dNewPos); void setPosition(const Vector3DInt32& v3dNewPos);

View File

@ -41,23 +41,9 @@ namespace PolyVox
template <typename VoxelType> template <typename VoxelType>
template <typename DerivedVolumeType> template <typename DerivedVolumeType>
int32_t BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::getPosX(void) const Vector3DInt32 BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::getPosition(void) const
{ {
return mXPosInVolume; return Vector3DInt32(mXPosInVolume, mYPosInVolume, mZPosInVolume);
}
template <typename VoxelType>
template <typename DerivedVolumeType>
int32_t BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::getPosY(void) const
{
return mYPosInVolume;
}
template <typename VoxelType>
template <typename DerivedVolumeType>
int32_t BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::getPosZ(void) const
{
return mZPosInVolume;
} }
template <typename VoxelType> template <typename VoxelType>

View File

@ -47,9 +47,9 @@ namespace PolyVox
template< template<typename> class VolumeType, typename VoxelType> template< template<typename> class VolumeType, typename VoxelType>
Vector3DFloat computeDecimatedCentralDifferenceGradient(const typename VolumeType<VoxelType>::Sampler& volIter) Vector3DFloat computeDecimatedCentralDifferenceGradient(const typename VolumeType<VoxelType>::Sampler& volIter)
{ {
const int32_t x = volIter.getPosX(); const int32_t x = volIter.getPosition().getX();
const int32_t y = volIter.getPosY(); const int32_t y = volIter.getPosition().getY();
const int32_t z = volIter.getPosZ(); const int32_t z = volIter.getPosition().getZ();
//FIXME - bitwise way of doing this? //FIXME - bitwise way of doing this?
VoxelType voxel1nx = volIter.getVoxelAt(x-2, y ,z ) > 0 ? 1: 0; VoxelType voxel1nx = volIter.getVoxelAt(x-2, y ,z ) > 0 ? 1: 0;
@ -72,9 +72,9 @@ namespace PolyVox
template< template<typename> class VolumeType, typename VoxelType> template< template<typename> class VolumeType, typename VoxelType>
Vector3DFloat computeSmoothCentralDifferenceGradient(typename VolumeType<VoxelType>::Sampler& volIter) Vector3DFloat computeSmoothCentralDifferenceGradient(typename VolumeType<VoxelType>::Sampler& volIter)
{ {
int32_t initialX = volIter.getPosX(); int32_t initialX = volIter.getPosition().getX();
int32_t initialY = volIter.getPosY(); int32_t initialY = volIter.getPosition().getY();
int32_t initialZ = volIter.getPosZ(); int32_t initialZ = volIter.getPosition().getZ();
//FIXME - bitwise way of doing this? //FIXME - bitwise way of doing this?
volIter.setPosition(initialX-1, initialY, initialZ); 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} }, { 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} } }; {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 initialX = volIter.getPosition().getX();
int32_t initialY = volIter.getPosY(); int32_t initialY = volIter.getPosition().getY();
int32_t initialZ = volIter.getPosZ(); 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-1); const float pVoxel1nx1ny1nz = computeSmoothedVoxel(volIter);
volIter.setPosition(initialX-1, initialY-1, initialZ ); const float pVoxel1nx1ny0pz = computeSmoothedVoxel(volIter); volIter.setPosition(initialX-1, initialY-1, initialZ ); const float pVoxel1nx1ny0pz = computeSmoothedVoxel(volIter);

View File

@ -32,7 +32,7 @@ namespace PolyVox
template <typename IteratorType> template <typename IteratorType>
bool IteratorController<IteratorType>::moveForward(void) bool IteratorController<IteratorType>::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()) if(v3dInitialPosition.getX() < m_regValid.getUpperCorner().getX())
{ {

View File

@ -172,9 +172,6 @@ namespace PolyVox
Sampler& operator=(const Sampler& rhs) throw(); 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; VoxelType getSubSampledVoxel(uint8_t uLevel) const;
inline VoxelType getVoxel(void) const; inline VoxelType getVoxel(void) const;

View File

@ -54,24 +54,6 @@ namespace PolyVox
return *this; return *this;
} }
template <typename VoxelType>
int32_t LargeVolume<VoxelType>::Sampler::getPosX(void) const
{
return this->mXPosInVolume;
}
template <typename VoxelType>
int32_t LargeVolume<VoxelType>::Sampler::getPosY(void) const
{
return this->mYPosInVolume;
}
template <typename VoxelType>
int32_t LargeVolume<VoxelType>::Sampler::getPosZ(void) const
{
return this->mZPosInVolume;
}
template <typename VoxelType> template <typename VoxelType>
VoxelType LargeVolume<VoxelType>::Sampler::getSubSampledVoxel(uint8_t uLevel) const VoxelType LargeVolume<VoxelType>::Sampler::getSubSampledVoxel(uint8_t uLevel) const
{ {

View File

@ -59,9 +59,6 @@ namespace PolyVox
Sampler(RawVolume<VoxelType>* volume); Sampler(RawVolume<VoxelType>* volume);
~Sampler(); ~Sampler();
int32_t getPosX(void) const;
int32_t getPosY(void) const;
int32_t getPosZ(void) const;
inline VoxelType getVoxel(void) const; inline VoxelType getVoxel(void) const;
void setPosition(const Vector3DInt32& v3dNewPos); void setPosition(const Vector3DInt32& v3dNewPos);

View File

@ -45,24 +45,6 @@ namespace PolyVox
{ {
} }
template <typename VoxelType>
int32_t RawVolume<VoxelType>::Sampler::getPosX(void) const
{
return this->mXPosInVolume;
}
template <typename VoxelType>
int32_t RawVolume<VoxelType>::Sampler::getPosY(void) const
{
return this->mYPosInVolume;
}
template <typename VoxelType>
int32_t RawVolume<VoxelType>::Sampler::getPosZ(void) const
{
return this->mZPosInVolume;
}
template <typename VoxelType> template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::getVoxel(void) const VoxelType RawVolume<VoxelType>::Sampler::getVoxel(void) const
{ {

View File

@ -87,9 +87,6 @@ namespace PolyVox
Sampler& operator=(const Sampler& rhs) throw(); 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; VoxelType getSubSampledVoxel(uint8_t uLevel) const;
inline VoxelType getVoxel(void) const; inline VoxelType getVoxel(void) const;

View File

@ -54,24 +54,6 @@ namespace PolyVox
return *this; return *this;
} }
template <typename VoxelType>
int32_t SimpleVolume<VoxelType>::Sampler::getPosX(void) const
{
return this->mXPosInVolume;
}
template <typename VoxelType>
int32_t SimpleVolume<VoxelType>::Sampler::getPosY(void) const
{
return this->mYPosInVolume;
}
template <typename VoxelType>
int32_t SimpleVolume<VoxelType>::Sampler::getPosZ(void) const
{
return this->mZPosInVolume;
}
template <typename VoxelType> template <typename VoxelType>
VoxelType SimpleVolume<VoxelType>::Sampler::getSubSampledVoxel(uint8_t uLevel) const VoxelType SimpleVolume<VoxelType>::Sampler::getSubSampledVoxel(uint8_t uLevel) const
{ {

View File

@ -531,8 +531,8 @@ namespace PolyVox
m_sampVolume.setPosition(iXVolSpace,iYVolSpace,iZVolSpace); m_sampVolume.setPosition(iXVolSpace,iYVolSpace,iZVolSpace);
//Current position //Current position
const uint32_t uXRegSpace = m_sampVolume.getPosX() - m_regSizeInVoxels.getLowerCorner().getX(); const uint32_t uXRegSpace = m_sampVolume.getPosition().getX() - m_regSizeInVoxels.getLowerCorner().getX();
const uint32_t uYRegSpace = m_sampVolume.getPosY() - m_regSizeInVoxels.getLowerCorner().getY(); 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 //Determine the index into the edge table which tells us which vertices are inside of the surface
uint8_t iCubeIndex = pPreviousBitmask[uXRegSpace][uYRegSpace]; uint8_t iCubeIndex = pPreviousBitmask[uXRegSpace][uYRegSpace];