Simplifying code.
This commit is contained in:
parent
b08974c197
commit
2602b00103
@ -614,13 +614,9 @@ namespace PolyVox
|
||||
// Purge null blocks so we know that all blocks are used.
|
||||
purgeNullPtrsFromAllBlocks();
|
||||
|
||||
// We include the size of the LargeVolume class but it should be insignificant.
|
||||
uint32_t uSizeInBytes = sizeof(LargeVolume);
|
||||
|
||||
// Memory used by the blocks
|
||||
uSizeInBytes += UncompressedBlock<VoxelType>::calculateSizeInBytes(m_uBlockSideLength) * m_pAllBlocks.size();
|
||||
|
||||
return uSizeInBytes;
|
||||
// Note: We disregard the size of the other class members as they are likely to be very small compared to the size of the
|
||||
// allocated voxel data. This also keeps the reported size as a power of two, which makes other memory calculations easier.
|
||||
return UncompressedBlock<VoxelType>::calculateSizeInBytes(m_uBlockSideLength) * m_pAllBlocks.size();
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
|
@ -148,8 +148,9 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
uint32_t UncompressedBlock<VoxelType>::calculateSizeInBytes(uint32_t uSideLength)
|
||||
{
|
||||
// Returns the size of this class plus the size of the uncompressed data.
|
||||
uint32_t uSizeInBytes = sizeof(UncompressedBlock<VoxelType>) + (uSideLength * uSideLength * uSideLength * sizeof(VoxelType));
|
||||
// Note: We disregard the size of the other class members as they are likely to be very small compared to the size of the
|
||||
// allocated voxel data. This also keeps the reported size as a power of two, which makes other memory calculations easier.
|
||||
uint32_t uSizeInBytes = uSideLength * uSideLength * uSideLength * sizeof(VoxelType);
|
||||
return uSizeInBytes;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user