Removed old code.

This commit is contained in:
Daviw Williams 2012-11-30 15:56:45 +01:00
parent b53fee2627
commit 256e289c8f
2 changed files with 2 additions and 29 deletions

View File

@ -113,7 +113,6 @@ namespace PolyVox
private: private:
VoxelType getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const; VoxelType getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const;
bool isCurrentPositionValid(void) const;
bool checkValidFlags(uint8_t uFlagsToCheck) const; bool checkValidFlags(uint8_t uFlagsToCheck) const;
void updateValidFlagsState(void); void updateValidFlagsState(void);
@ -121,12 +120,6 @@ namespace PolyVox
VoxelType* mCurrentVoxel; VoxelType* mCurrentVoxel;
uint8_t m_uValidFlags; uint8_t m_uValidFlags;
//Whether the current position is inside the volume
//FIXME - Replace these with flags
bool m_bIsCurrentPositionValidInX;
bool m_bIsCurrentPositionValidInY;
bool m_bIsCurrentPositionValidInZ;
}; };
#endif #endif

View File

@ -30,9 +30,6 @@ namespace PolyVox
:BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >(volume) :BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >(volume)
,mCurrentVoxel(0) ,mCurrentVoxel(0)
,m_uValidFlags(0) ,m_uValidFlags(0)
,m_bIsCurrentPositionValidInX(false)
,m_bIsCurrentPositionValidInY(false)
,m_bIsCurrentPositionValidInZ(false)
{ {
} }
@ -44,7 +41,7 @@ namespace PolyVox
template <typename VoxelType> template <typename VoxelType>
VoxelType RawVolume<VoxelType>::Sampler::getVoxel(void) const VoxelType RawVolume<VoxelType>::Sampler::getVoxel(void) const
{ {
if(isCurrentPositionValid()) if(checkValidFlags(Current))
{ {
return *mCurrentVoxel; return *mCurrentVoxel;
} }
@ -78,18 +75,13 @@ namespace PolyVox
mCurrentVoxel = this->mVolume->m_pData + uVoxelIndex; mCurrentVoxel = this->mVolume->m_pData + uVoxelIndex;
m_bIsCurrentPositionValidInX = this->mVolume->getEnclosingRegion().containsPointInX(xPos);
m_bIsCurrentPositionValidInY = this->mVolume->getEnclosingRegion().containsPointInY(yPos);
m_bIsCurrentPositionValidInZ = this->mVolume->getEnclosingRegion().containsPointInZ(zPos);
updateValidFlagsState(); updateValidFlagsState();
} }
template <typename VoxelType> template <typename VoxelType>
bool RawVolume<VoxelType>::Sampler::setVoxel(VoxelType tValue) bool RawVolume<VoxelType>::Sampler::setVoxel(VoxelType tValue)
{ {
//return m_bIsCurrentPositionValid ? *mCurrentVoxel : this->mVolume->getBorderValue(); if(checkValidFlags(Current))
if(m_bIsCurrentPositionValidInX && m_bIsCurrentPositionValidInY && m_bIsCurrentPositionValidInZ)
{ {
*mCurrentVoxel = tValue; *mCurrentVoxel = tValue;
return true; return true;
@ -105,7 +97,6 @@ namespace PolyVox
{ {
this->mXPosInVolume++; this->mXPosInVolume++;
++mCurrentVoxel; ++mCurrentVoxel;
m_bIsCurrentPositionValidInX = this->mVolume->getEnclosingRegion().containsPointInX(this->mXPosInVolume);
//FIXME - Can be faster by just 'shifting' the flags. //FIXME - Can be faster by just 'shifting' the flags.
updateValidFlagsState(); updateValidFlagsState();
@ -116,7 +107,6 @@ namespace PolyVox
{ {
this->mYPosInVolume++; this->mYPosInVolume++;
mCurrentVoxel += this->mVolume->getWidth(); mCurrentVoxel += this->mVolume->getWidth();
m_bIsCurrentPositionValidInY = this->mVolume->getEnclosingRegion().containsPointInY(this->mYPosInVolume);
//FIXME - Can be faster by just 'shifting' the flags. //FIXME - Can be faster by just 'shifting' the flags.
updateValidFlagsState(); updateValidFlagsState();
@ -127,7 +117,6 @@ namespace PolyVox
{ {
this->mZPosInVolume++; this->mZPosInVolume++;
mCurrentVoxel += this->mVolume->getWidth() * this->mVolume->getHeight(); mCurrentVoxel += this->mVolume->getWidth() * this->mVolume->getHeight();
m_bIsCurrentPositionValidInZ = this->mVolume->getEnclosingRegion().containsPointInZ(this->mZPosInVolume);
//FIXME - Can be faster by just 'shifting' the flags. //FIXME - Can be faster by just 'shifting' the flags.
updateValidFlagsState(); updateValidFlagsState();
@ -138,7 +127,6 @@ namespace PolyVox
{ {
this->mXPosInVolume--; this->mXPosInVolume--;
--mCurrentVoxel; --mCurrentVoxel;
m_bIsCurrentPositionValidInX = this->mVolume->getEnclosingRegion().containsPointInX(this->mXPosInVolume);
//FIXME - Can be faster by just 'shifting' the flags. //FIXME - Can be faster by just 'shifting' the flags.
updateValidFlagsState(); updateValidFlagsState();
@ -149,7 +137,6 @@ namespace PolyVox
{ {
this->mYPosInVolume--; this->mYPosInVolume--;
mCurrentVoxel -= this->mVolume->getWidth(); mCurrentVoxel -= this->mVolume->getWidth();
m_bIsCurrentPositionValidInY = this->mVolume->getEnclosingRegion().containsPointInY(this->mYPosInVolume);
//FIXME - Can be faster by just 'shifting' the flags. //FIXME - Can be faster by just 'shifting' the flags.
updateValidFlagsState(); updateValidFlagsState();
@ -160,7 +147,6 @@ namespace PolyVox
{ {
this->mZPosInVolume--; this->mZPosInVolume--;
mCurrentVoxel -= this->mVolume->getWidth() * this->mVolume->getHeight(); mCurrentVoxel -= this->mVolume->getWidth() * this->mVolume->getHeight();
m_bIsCurrentPositionValidInZ = this->mVolume->getEnclosingRegion().containsPointInZ(this->mZPosInVolume);
//FIXME - Can be faster by just 'shifting' the flags. //FIXME - Can be faster by just 'shifting' the flags.
updateValidFlagsState(); updateValidFlagsState();
@ -478,12 +464,6 @@ namespace PolyVox
} }
} }
template <typename VoxelType>
bool RawVolume<VoxelType>::Sampler::isCurrentPositionValid(void) const
{
return m_bIsCurrentPositionValidInX && m_bIsCurrentPositionValidInY && m_bIsCurrentPositionValidInZ;
}
template <typename VoxelType> template <typename VoxelType>
inline bool RawVolume<VoxelType>::Sampler::checkValidFlags(uint8_t uFlagsToCheck) const inline bool RawVolume<VoxelType>::Sampler::checkValidFlags(uint8_t uFlagsToCheck) const
{ {