Small tweaks.

This commit is contained in:
David Williams 2009-04-20 19:23:11 +00:00
parent c627c90cd0
commit 0b847eb271
3 changed files with 21 additions and 9 deletions

View File

@ -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<uint32_t>::max);
void tidyUpMemory(uint32_t uNoOfBlocksToProcess = (std::numeric_limits<uint32_t>::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;
};

View File

@ -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<float>(m_uWidth * m_uWidth + m_uHeight * m_uHeight + m_uDepth * m_uDepth));
}
/*template <typename VoxelType>
@ -140,7 +145,7 @@ namespace PolyVox
template <typename VoxelType>
float Volume<VoxelType>::getDiagonalLength(void) const
{
return sqrtf(static_cast<float>(m_uWidth * m_uWidth + m_uHeight * m_uHeight + m_uDepth * m_uDepth));
return m_fDiagonalLength;
}
template <typename VoxelType>
@ -152,7 +157,13 @@ namespace PolyVox
template <typename VoxelType>
uint16_t Volume<VoxelType>::getLongestSideLength(void) const
{
return (std::max)((std::max)(m_uWidth,m_uHeight),m_uDepth);
return m_uLongestSideLength;
}
template <typename VoxelType>
uint16_t Volume<VoxelType>::getShortestSideLength(void) const
{
return m_uShortestSideLength;
}
template <typename VoxelType>

View File

@ -148,7 +148,7 @@ namespace PolyVox
{
const uint8_t uSize = 1 << uLevel;
VoxelType tValue = std::numeric_limits<VoxelType>::max();
VoxelType tValue = (std::numeric_limits<VoxelType>::max)();
for(uint8_t z = 0; z < uSize; ++z)
{
for(uint8_t y = 0; y < uSize; ++y)