Tidying up.

This commit is contained in:
David Williams 2014-09-17 23:53:14 +02:00
parent 916fe310ad
commit 277b6c7b9b

View File

@ -400,17 +400,19 @@ namespace PolyVox
template <typename VoxelType> template <typename VoxelType>
void LargeVolume<VoxelType>::flushAll() void LargeVolume<VoxelType>::flushAll()
{ {
POLYVOX_THROW_IF(!m_pPager, invalid_operation, "You cannot flush data out of the volume because it was created without a pager attached."); POLYVOX_LOG_WARNING_IF(!m_pPager, "Data discarded by flush operation as no pager is attached.");
// Flushing will remove the most accessed block, so invalidate the pointer. // Clear this pointer so it doesn't hang on to any blocks.
m_pLastAccessedBlock = 0; m_pLastAccessedBlock = nullptr;
//Replaced the for loop here as the call to // Erase all the most recently used blocks.
//eraseBlock was invalidating the iterator. m_pRecentlyUsedBlocks.clear();
/*while (m_pRecentlyUsedBlocks.size() > 0)
{ // Remove deleted blocks from the list of all loaded blocks.
eraseBlock(m_pRecentlyUsedBlocks.begin()); purgeNullPtrsFromAllBlocks();
}*/
// If there are still some blocks left then this is a cause for concern. Perhaps samplers are holding on to them?
POLYVOX_LOG_WARNING_IF(m_pAllBlocks.size() > 0, "Blocks still exist after performing flushAll()! Perhaps you have samplers attached?");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -419,7 +421,10 @@ namespace PolyVox
template <typename VoxelType> template <typename VoxelType>
void LargeVolume<VoxelType>::flush(Region regFlush) void LargeVolume<VoxelType>::flush(Region regFlush)
{ {
/*POLYVOX_THROW_IF(!m_pPager, invalid_operation, "You cannot flush data out of the volume because it was created without a pager attached."); /*POLYVOX_LOG_WARNING_IF(!m_pPager, "Data discarded by flush operation as no pager is attached.");
// Clear this pointer so it doesn't hang on to any blocks.
m_pLastAccessedBlock = nullptr;
Vector3DInt32 v3dStart; Vector3DInt32 v3dStart;
for(int i = 0; i < 3; i++) for(int i = 0; i < 3; i++)