Stuff related to valid regions is being moved from BaseVolum to RawVolume, as PagedVolume is now infinite.

This commit is contained in:
David Williams
2015-03-04 22:42:14 +01:00
parent d3618ca688
commit bd6efe8c3c
11 changed files with 185 additions and 189 deletions

View File

@ -34,6 +34,9 @@ namespace PolyVox
RawVolume<VoxelType>::Sampler::Sampler(RawVolume<VoxelType>* volume)
:BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >(volume)
,mCurrentVoxel(0)
, m_bIsCurrentPositionValidInX(false)
, m_bIsCurrentPositionValidInY(false)
, m_bIsCurrentPositionValidInZ(false)
{
}
@ -55,6 +58,12 @@ namespace PolyVox
}
}
template <typename VoxelType>
bool inline RawVolume<VoxelType>::Sampler::isCurrentPositionValid(void) const
{
return m_bIsCurrentPositionValidInX && m_bIsCurrentPositionValidInY && m_bIsCurrentPositionValidInZ;
}
template <typename VoxelType>
void RawVolume<VoxelType>::Sampler::setPosition(const Vector3DInt32& v3dNewPos)
{
@ -67,6 +76,10 @@ namespace PolyVox
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::setPosition(xPos, yPos, zPos);
m_bIsCurrentPositionValidInX = mVolume->getEnclosingRegion().containsPointInX(xPos);
m_bIsCurrentPositionValidInY = mVolume->getEnclosingRegion().containsPointInY(yPos);
m_bIsCurrentPositionValidInZ = mVolume->getEnclosingRegion().containsPointInZ(zPos);
// Then we update the voxel pointer
if(this->isCurrentPositionValid())
{
@ -111,6 +124,8 @@ namespace PolyVox
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveX();
m_bIsCurrentPositionValidInX = mVolume->getEnclosingRegion().containsPointInX(mXPosInVolume);
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
@ -131,6 +146,8 @@ namespace PolyVox
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveY();
m_bIsCurrentPositionValidInY = mVolume->getEnclosingRegion().containsPointInY(mYPosInVolume);
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
@ -151,6 +168,8 @@ namespace PolyVox
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::movePositiveZ();
m_bIsCurrentPositionValidInZ = mVolume->getEnclosingRegion().containsPointInZ(mZPosInVolume);
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
@ -171,6 +190,8 @@ namespace PolyVox
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeX();
m_bIsCurrentPositionValidInX = mVolume->getEnclosingRegion().containsPointInX(mXPosInVolume);
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
@ -191,6 +212,8 @@ namespace PolyVox
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeY();
m_bIsCurrentPositionValidInY = mVolume->getEnclosingRegion().containsPointInY(mYPosInVolume);
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{
@ -211,6 +234,8 @@ namespace PolyVox
// Base version updates position and validity flags.
BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >::moveNegativeZ();
m_bIsCurrentPositionValidInZ = mVolume->getEnclosingRegion().containsPointInZ(mZPosInVolume);
// Then we update the voxel pointer
if(this->isCurrentPositionValid() && bIsOldPositionValid )
{