diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl index ea060ddb..b041685c 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl @@ -135,7 +135,7 @@ namespace PolyVox template VoxelType LargeVolume::getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const { - if(Volume::m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))) + if(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))) { const int32_t blockX = uXPos >> m_uBlockSideLengthPower; const int32_t blockY = uYPos >> m_uBlockSideLengthPower; @@ -238,7 +238,7 @@ namespace PolyVox template bool LargeVolume::setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) { - assert(Volume::m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))); + assert(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))); const int32_t blockX = uXPos >> m_uBlockSideLengthPower; const int32_t blockY = uYPos >> m_uBlockSideLengthPower; @@ -424,10 +424,10 @@ namespace PolyVox m_pLastAccessedBlock = 0; m_bCompressionEnabled = true; - Volume::m_regValidRegion = regValidRegion; + this->m_regValidRegion = regValidRegion; - m_regValidRegionInBlocks.setLowerCorner(Volume::m_regValidRegion.getLowerCorner() / static_cast(uBlockSideLength)); - m_regValidRegionInBlocks.setUpperCorner(Volume::m_regValidRegion.getUpperCorner() / static_cast(uBlockSideLength)); + m_regValidRegionInBlocks.setLowerCorner(this->m_regValidRegion.getLowerCorner() / static_cast(uBlockSideLength)); + m_regValidRegionInBlocks.setUpperCorner(this->m_regValidRegion.getUpperCorner() / static_cast(uBlockSideLength)); setMaxNumberOfUncompressedBlocks(m_uMaxNumberOfUncompressedBlocks); @@ -446,9 +446,9 @@ namespace PolyVox std::fill(m_pUncompressedBorderData, m_pUncompressedBorderData + m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength, VoxelType()); //Other properties we might find useful later - Volume::m_uLongestSideLength = (std::max)((std::max)(Volume::getWidth(),Volume::getHeight()),Volume::getDepth()); - Volume::m_uShortestSideLength = (std::min)((std::min)(Volume::getWidth(),Volume::getHeight()),Volume::getDepth()); - Volume::m_fDiagonalLength = sqrtf(static_cast(Volume::getWidth() * Volume::getWidth() + Volume::getHeight() * Volume::getHeight() + Volume::getDepth() * Volume::getDepth())); + this->m_uLongestSideLength = (std::max)((std::max)(this->getWidth(),this->getHeight()),this->getDepth()); + this->m_uShortestSideLength = (std::min)((std::min)(this->getWidth(),this->getHeight()),this->getDepth()); + this->m_fDiagonalLength = sqrtf(static_cast(this->getWidth() * this->getWidth() + this->getHeight() * this->getHeight() + this->getDepth() * this->getDepth())); } template diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl index 97798d80..a4db69d1 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl @@ -39,7 +39,7 @@ namespace PolyVox //:mVolume(volume) { //Dodgy doing this - need to find how to call base constructor - mVolume = volume; + this->mVolume = volume; } template diff --git a/library/PolyVoxCore/include/PolyVoxCore/RawVolume.inl b/library/PolyVoxCore/include/PolyVoxCore/RawVolume.inl index 51d0ee6f..cbbdbec9 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/RawVolume.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/RawVolume.inl @@ -83,18 +83,18 @@ namespace PolyVox template VoxelType RawVolume::getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const { - if(Volume::m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))) + if(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))) { return m_pData [ uXPos + - uYPos * Volume::getWidth() + - uZPos * Volume::getWidth() * Volume::getHeight() + uYPos * this->getWidth() + + uZPos * this->getWidth() * this->getHeight() ]; } else { - return Volume::getBorderValue(); + return this->getBorderValue(); } } @@ -127,13 +127,13 @@ namespace PolyVox template bool RawVolume::setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) { - assert(Volume::m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))); + assert(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))); m_pData [ uXPos + - uYPos * Volume::getWidth() + - uZPos * Volume::getWidth() * Volume::getHeight() + uYPos * this->getWidth() + + uZPos * this->getWidth() * this->getHeight() ] = tValue; //Return true to indicate that we modified a voxel. @@ -157,20 +157,20 @@ namespace PolyVox template void RawVolume::resize(const Region& regValidRegion) { - Volume::m_regValidRegion = regValidRegion; + this->m_regValidRegion = regValidRegion; //Ensure dimensions of the specified Region are valid - assert(Volume::getWidth() > 0); - assert(Volume::getHeight() > 0); - assert(Volume::getDepth() > 0); + assert(this->getWidth() > 0); + assert(this->getHeight() > 0); + assert(this->getDepth() > 0); //Create the data - m_pData = new VoxelType[Volume::getWidth() * Volume::getHeight()* Volume::getDepth()]; + m_pData = new VoxelType[this->getWidth() * this->getHeight()* this->getDepth()]; //Other properties we might find useful later - Volume::m_uLongestSideLength = (std::max)((std::max)(Volume::getWidth(),Volume::getHeight()),Volume::getDepth()); - Volume::m_uShortestSideLength = (std::min)((std::min)(Volume::getWidth(),Volume::getHeight()),Volume::getDepth()); - Volume::m_fDiagonalLength = sqrtf(static_cast(Volume::getWidth() * Volume::getWidth() + Volume::getHeight() * Volume::getHeight() + Volume::getDepth() * Volume::getDepth())); + this->m_uLongestSideLength = (std::max)((std::max)(this->getWidth(),this->getHeight()),this->getDepth()); + this->m_uShortestSideLength = (std::min)((std::min)(this->getWidth(),this->getHeight()),this->getDepth()); + this->m_fDiagonalLength = sqrtf(static_cast(this->getWidth() * this->getWidth() + this->getHeight() * this->getHeight() + this->getDepth() * this->getDepth())); } //////////////////////////////////////////////////////////////////////////////// @@ -179,7 +179,7 @@ namespace PolyVox template uint32_t RawVolume::calculateSizeInBytes(void) { - return Volume::getWidth() * Volume::getHeight() * Volume::getDepth() * sizeof(VoxelType); + return this->getWidth() * this->getHeight() * this->getDepth() * sizeof(VoxelType); } } diff --git a/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl index 99c4bc6a..d1b9d736 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl @@ -39,7 +39,7 @@ namespace PolyVox ,m_bIsCurrentPositionValid(false) { //Dodgy doing this - need to find how to call base constructor - mVolume = volume; + this->mVolume = volume; } template diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl index 0ba7d854..a401ec95 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl @@ -105,7 +105,7 @@ namespace PolyVox template VoxelType SimpleVolume::getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const { - if(Volume::m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))) + if(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))) { const int32_t blockX = uXPos >> m_uBlockSideLengthPower; const int32_t blockY = uYPos >> m_uBlockSideLengthPower; @@ -156,7 +156,7 @@ namespace PolyVox template bool SimpleVolume::setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) { - assert(Volume::m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))); + assert(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos))); const int32_t blockX = uXPos >> m_uBlockSideLengthPower; const int32_t blockY = uYPos >> m_uBlockSideLengthPower; @@ -207,10 +207,10 @@ namespace PolyVox m_uBlockSideLength = uBlockSideLength; m_pUncompressedBorderData = 0; - Volume::m_regValidRegion = regValidRegion; + this->m_regValidRegion = regValidRegion; - m_regValidRegionInBlocks.setLowerCorner(Volume::m_regValidRegion.getLowerCorner() / static_cast(uBlockSideLength)); - m_regValidRegionInBlocks.setUpperCorner(Volume::m_regValidRegion.getUpperCorner() / static_cast(uBlockSideLength)); + m_regValidRegionInBlocks.setLowerCorner(this->m_regValidRegion.getLowerCorner() / static_cast(uBlockSideLength)); + m_regValidRegionInBlocks.setUpperCorner(this->m_regValidRegion.getUpperCorner() / static_cast(uBlockSideLength)); //Compute the block side length m_uBlockSideLength = uBlockSideLength; @@ -234,9 +234,9 @@ namespace PolyVox std::fill(m_pUncompressedBorderData, m_pUncompressedBorderData + m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength, VoxelType()); //Other properties we might find useful later - Volume::m_uLongestSideLength = (std::max)((std::max)(Volume::getWidth(),Volume::getHeight()),Volume::getDepth()); - Volume::m_uShortestSideLength = (std::min)((std::min)(Volume::getWidth(),Volume::getHeight()),Volume::getDepth()); - Volume::m_fDiagonalLength = sqrtf(static_cast(Volume::getWidth() * Volume::getWidth() + Volume::getHeight() * Volume::getHeight() + Volume::getDepth() * Volume::getDepth())); + this->m_uLongestSideLength = (std::max)((std::max)(this->getWidth(),this->getHeight()),this->getDepth()); + this->m_uShortestSideLength = (std::min)((std::min)(this->getWidth(),this->getHeight()),this->getDepth()); + this->m_fDiagonalLength = sqrtf(static_cast(this->getWidth() * this->getWidth() + this->getHeight() * this->getHeight() + this->getDepth() * this->getDepth())); } template diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl index 54161735..12d2366c 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl @@ -39,7 +39,7 @@ namespace PolyVox //:mVolume(volume) { //Dodgy doing this - need to find how to call base constructor - mVolume = volume; + this->mVolume = volume; } template diff --git a/library/PolyVoxCore/include/PolyVoxCore/Volume.h b/library/PolyVoxCore/include/PolyVoxCore/Volume.h index b85eb701..780db379 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Volume.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Volume.h @@ -89,6 +89,10 @@ namespace PolyVox protected: DerivedVolumeType* mVolume; + + int32_t mXPos; + int32_t mYPos; + int32_t mZPos; }; #endif diff --git a/library/PolyVoxCore/include/PolyVoxCore/VolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/VolumeSampler.inl index 6085d7a7..25d6014d 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/VolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/VolumeSampler.inl @@ -33,160 +33,151 @@ namespace PolyVox template int32_t Volume::Sampler::getPosX(void) const { - assert(false); - return 0; + return mXPos; } template template int32_t Volume::Sampler::getPosY(void) const { - assert(false); - return 0; + return mYPos; } template template int32_t Volume::Sampler::getPosZ(void) const { - assert(false); - return 0; + return mZPos; } template template VoxelType Volume::Sampler::getVoxel(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos, mYPos, mZPos); } template template void Volume::Sampler::setPosition(const Vector3DInt32& v3dNewPos) { - assert(false); + mXPos = v3dNewPos.getX(); + mYPos = v3dNewPos.getY(); + mZPos = v3dNewPos.getZ(); } template template void Volume::Sampler::setPosition(int32_t xPos, int32_t yPos, int32_t zPos) { - assert(false); + mXPos = xPos; + mYPos = yPos; + mZPos = zPos; } template template void Volume::Sampler::movePositiveX(void) { - assert(false); + mXPos++; } template template void Volume::Sampler::movePositiveY(void) { - assert(false); + mYPos++; } template template void Volume::Sampler::movePositiveZ(void) { - assert(false); + mZPos++; } template template void Volume::Sampler::moveNegativeX(void) { - assert(false); + mXPos--; } template template void Volume::Sampler::moveNegativeY(void) { - assert(false); + mYPos--; } template template void Volume::Sampler::moveNegativeZ(void) { - assert(false); + mZPos--; } template template VoxelType Volume::Sampler::peekVoxel1nx1ny1nz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos - 1, mYPos - 1, mZPos - 1); } template template VoxelType Volume::Sampler::peekVoxel1nx1ny0pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos - 1, mYPos - 1, mZPos ); } template template VoxelType Volume::Sampler::peekVoxel1nx1ny1pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos - 1, mYPos - 1, mZPos + 1); } template template VoxelType Volume::Sampler::peekVoxel1nx0py1nz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos - 1, mYPos , mZPos - 1); } template template VoxelType Volume::Sampler::peekVoxel1nx0py0pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos - 1, mYPos , mZPos ); } template template VoxelType Volume::Sampler::peekVoxel1nx0py1pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos - 1, mYPos , mZPos + 1); } template template VoxelType Volume::Sampler::peekVoxel1nx1py1nz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos - 1, mYPos + 1, mZPos - 1); } template template VoxelType Volume::Sampler::peekVoxel1nx1py0pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos - 1, mYPos + 1, mZPos ); } template template VoxelType Volume::Sampler::peekVoxel1nx1py1pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos - 1, mYPos + 1, mZPos + 1); } ////////////////////////////////////////////////////////////////////////// @@ -195,72 +186,63 @@ namespace PolyVox template VoxelType Volume::Sampler::peekVoxel0px1ny1nz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos , mYPos - 1, mZPos - 1); } template template VoxelType Volume::Sampler::peekVoxel0px1ny0pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos , mYPos - 1, mZPos ); } template template VoxelType Volume::Sampler::peekVoxel0px1ny1pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos , mYPos - 1, mZPos + 1); } template template VoxelType Volume::Sampler::peekVoxel0px0py1nz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos , mYPos , mZPos - 1); } template template VoxelType Volume::Sampler::peekVoxel0px0py0pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos , mYPos , mZPos ); } template template VoxelType Volume::Sampler::peekVoxel0px0py1pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos , mYPos , mZPos + 1); } template template VoxelType Volume::Sampler::peekVoxel0px1py1nz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos , mYPos + 1, mZPos - 1); } template template VoxelType Volume::Sampler::peekVoxel0px1py0pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos , mYPos + 1, mZPos ); } template template VoxelType Volume::Sampler::peekVoxel0px1py1pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos , mYPos + 1, mZPos + 1); } ////////////////////////////////////////////////////////////////////////// @@ -269,71 +251,62 @@ namespace PolyVox template VoxelType Volume::Sampler::peekVoxel1px1ny1nz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos + 1, mYPos - 1, mZPos - 1); } template template VoxelType Volume::Sampler::peekVoxel1px1ny0pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos + 1, mYPos - 1, mZPos ); } template template VoxelType Volume::Sampler::peekVoxel1px1ny1pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos + 1, mYPos - 1, mZPos + 1); } template template VoxelType Volume::Sampler::peekVoxel1px0py1nz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos + 1, mYPos , mZPos - 1); } template template VoxelType Volume::Sampler::peekVoxel1px0py0pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos + 1, mYPos , mZPos ); } template template VoxelType Volume::Sampler::peekVoxel1px0py1pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos + 1, mYPos , mZPos + 1); } template template VoxelType Volume::Sampler::peekVoxel1px1py1nz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos + 1, mYPos + 1, mZPos - 1); } template template VoxelType Volume::Sampler::peekVoxel1px1py0pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos + 1, mYPos + 1, mZPos ); } template template VoxelType Volume::Sampler::peekVoxel1px1py1pz(void) const { - assert(false); - return VoxelType(); + mVolume->getVoxelAt(mXPos + 1, mYPos + 1, mZPos + 1); } }