Added code to determine how much memory a volume is using.

Also map of homogenous regions is no longer static.
This commit is contained in:
David Williams
2009-10-17 20:39:38 +00:00
parent cacde3e01a
commit 5eb538e925
4 changed files with 63 additions and 10 deletions

View File

@ -51,6 +51,7 @@ namespace PolyVox
void fill(VoxelType tValue);
bool isHomogeneous(void);
uint32_t sizeInChars(void);
private:
uint16_t m_uSideLength;

View File

@ -169,5 +169,19 @@ namespace PolyVox
}
return true;
}
template <typename VoxelType>
uint32_t Block<VoxelType>::sizeInChars(void)
{
uint32_t uSizeInChars = sizeof(Block<VoxelType>);
if(m_tData != 0)
{
const uint32_t uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength;
uSizeInChars += uNoOfVoxels * sizeof(VoxelType);
}
return uSizeInChars;
}
#pragma endregion
}