diff --git a/library/PolyVoxCore/include/Volume.h b/library/PolyVoxCore/include/Volume.h index 17d9391a..b5d3fd34 100644 --- a/library/PolyVoxCore/include/Volume.h +++ b/library/PolyVoxCore/include/Volume.h @@ -50,11 +50,11 @@ namespace PolyVox //Volume& operator=(const Volume& rhs); Region getEnclosingRegion(void) const; - //uint16_t getSideLength(void) const; uint16_t getWidth(void) const; uint16_t getHeight(void) const; uint16_t getDepth(void) const; uint16_t getLongestSideLength(void) const; + uint16_t getShortestSideLength(void) const; float getDiagonalLength(void) const; VoxelType getVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos) const; VoxelType getVoxelAt(const Vector3DUint16& v3dPos) const; @@ -62,7 +62,7 @@ namespace PolyVox void setVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos, VoxelType tValue); void setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue); - void tidyUpMemory(uint32_t uNoOfBlocksToProcess = std::numeric_limits::max); + void tidyUpMemory(uint32_t uNoOfBlocksToProcess = (std::numeric_limits::max)()); bool isRegionHomogenous(const Region& region); private: @@ -80,14 +80,10 @@ namespace PolyVox uint32_t m_uNoOfBlocksInVolume; - //uint16_t m_uSideLengthInBlocks; uint16_t m_uWidthInBlocks; uint16_t m_uHeightInBlocks; uint16_t m_uDepthInBlocks; - //uint8_t m_uSideLengthPower; - //uint16_t m_uSideLength; - uint16_t m_uWidth; uint8_t m_uWidthPower; @@ -100,6 +96,11 @@ namespace PolyVox uint8_t m_uBlockSideLengthPower; uint16_t m_uBlockSideLength; + uint16_t m_uLongestSideLength; + uint16_t m_uShortestSideLength; + + float m_fDiagonalLength; + uint32_t m_uCurrentBlockForTidying; }; diff --git a/library/PolyVoxCore/include/Volume.inl b/library/PolyVoxCore/include/Volume.inl index 469981a1..a39a4437 100644 --- a/library/PolyVoxCore/include/Volume.inl +++ b/library/PolyVoxCore/include/Volume.inl @@ -102,6 +102,11 @@ namespace PolyVox m_pBlocks[i] = getHomogenousBlockData(0); m_vecBlockIsPotentiallyHomogenous[i] = false; } + + //Other properties we might find useful later + m_uLongestSideLength = (std::max)((std::max)(m_uWidth,m_uHeight),m_uDepth); + m_uShortestSideLength = (std::min)((std::min)(m_uWidth,m_uHeight),m_uDepth); + m_fDiagonalLength = sqrtf(static_cast(m_uWidth * m_uWidth + m_uHeight * m_uHeight + m_uDepth * m_uDepth)); } /*template @@ -140,7 +145,7 @@ namespace PolyVox template float Volume::getDiagonalLength(void) const { - return sqrtf(static_cast(m_uWidth * m_uWidth + m_uHeight * m_uHeight + m_uDepth * m_uDepth)); + return m_fDiagonalLength; } template @@ -152,7 +157,13 @@ namespace PolyVox template uint16_t Volume::getLongestSideLength(void) const { - return (std::max)((std::max)(m_uWidth,m_uHeight),m_uDepth); + return m_uLongestSideLength; + } + + template + uint16_t Volume::getShortestSideLength(void) const + { + return m_uShortestSideLength; } template diff --git a/library/PolyVoxCore/include/VolumeIterator.inl b/library/PolyVoxCore/include/VolumeIterator.inl index 8316b6f0..46f2e4f8 100644 --- a/library/PolyVoxCore/include/VolumeIterator.inl +++ b/library/PolyVoxCore/include/VolumeIterator.inl @@ -148,7 +148,7 @@ namespace PolyVox { const uint8_t uSize = 1 << uLevel; - VoxelType tValue = std::numeric_limits::max(); + VoxelType tValue = (std::numeric_limits::max)(); for(uint8_t z = 0; z < uSize; ++z) { for(uint8_t y = 0; y < uSize; ++y)