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.
|
// Purge null blocks so we know that all blocks are used.
|
||||||
purgeNullPtrsFromAllBlocks();
|
purgeNullPtrsFromAllBlocks();
|
||||||
|
|
||||||
// We include the size of the LargeVolume class but it should be insignificant.
|
// Note: We disregard the size of the other class members as they are likely to be very small compared to the size of the
|
||||||
uint32_t uSizeInBytes = sizeof(LargeVolume);
|
// 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();
|
||||||
// Memory used by the blocks
|
|
||||||
uSizeInBytes += UncompressedBlock<VoxelType>::calculateSizeInBytes(m_uBlockSideLength) * m_pAllBlocks.size();
|
|
||||||
|
|
||||||
return uSizeInBytes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
|
@ -148,8 +148,9 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
uint32_t UncompressedBlock<VoxelType>::calculateSizeInBytes(uint32_t uSideLength)
|
uint32_t UncompressedBlock<VoxelType>::calculateSizeInBytes(uint32_t uSideLength)
|
||||||
{
|
{
|
||||||
// Returns the size of this class plus the size of the uncompressed data.
|
// Note: We disregard the size of the other class members as they are likely to be very small compared to the size of the
|
||||||
uint32_t uSizeInBytes = sizeof(UncompressedBlock<VoxelType>) + (uSideLength * uSideLength * uSideLength * sizeof(VoxelType));
|
// 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;
|
return uSizeInBytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user