From 12fdeb8e525ae922e717a0fb8eafbfaccd6f5cab Mon Sep 17 00:00:00 2001 From: David Williams Date: Mon, 13 Apr 2015 23:51:18 +0200 Subject: [PATCH] Removed old chunk map. Removed flush(Region) function as it's a bit trickier to implement with the new hash table, and it's not clear that we need it. --- examples/Paging/main.cpp | 6 +++--- include/PolyVox/PagedVolume.h | 4 +--- include/PolyVox/PagedVolume.inl | 9 ++++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/Paging/main.cpp b/examples/Paging/main.cpp index 3cb5415c..5b4bb191 100644 --- a/examples/Paging/main.cpp +++ b/examples/Paging/main.cpp @@ -164,9 +164,9 @@ protected: std::cout << "Memory usage: " << (volData.calculateSizeInBytes() / 1024.0 / 1024.0) << "MB" << std::endl; //std::cout << "Compression ratio: 1 to " << (1.0/(volData.calculateCompressionRatio())) << std::endl; PolyVox::Region reg2(Vector3DInt32(0, 0, 0), Vector3DInt32(255, 255, 255)); - std::cout << "Flushing region: " << reg2.getLowerCorner() << " -> " << reg2.getUpperCorner() << std::endl; - volData.flush(reg2); - std::cout << "Memory usage: " << (volData.calculateSizeInBytes() / 1024.0 / 1024.0) << "MB" << std::endl; + //std::cout << "Flushing region: " << reg2.getLowerCorner() << " -> " << reg2.getUpperCorner() << std::endl; + //volData.flush(reg2); + //std::cout << "Memory usage: " << (volData.calculateSizeInBytes() / 1024.0 / 1024.0) << "MB" << std::endl; //std::cout << "Compression ratio: 1 to " << (1.0/(volData.calculateCompressionRatio())) << std::endl; std::cout << "Flushing entire volume" << std::endl; volData.flushAll(); diff --git a/include/PolyVox/PagedVolume.h b/include/PolyVox/PagedVolume.h index 826f3b29..6c28a633 100644 --- a/include/PolyVox/PagedVolume.h +++ b/include/PolyVox/PagedVolume.h @@ -274,7 +274,7 @@ namespace PolyVox /// Tries to ensure that the voxels within the specified Region are loaded into memory. void prefetch(Region regPrefetch); /// Ensures that any voxels within the specified Region are removed from memory. - void flush(Region regFlush); + //void flush(Region regFlush); /// Removes all voxels from memory void flushAll(); @@ -301,8 +301,6 @@ namespace PolyVox mutable int32_t m_v3dLastAccessedChunkZ = 0; mutable Chunk* m_pLastAccessedChunk = nullptr; - mutable std::unordered_map > m_mapChunks; - mutable uint32_t m_uTimestamper = 0; uint32_t m_uChunkCountLimit = 0; diff --git a/include/PolyVox/PagedVolume.inl b/include/PolyVox/PagedVolume.inl index 93e4e51f..7c650e43 100644 --- a/include/PolyVox/PagedVolume.inl +++ b/include/PolyVox/PagedVolume.inl @@ -220,13 +220,16 @@ namespace PolyVox m_pLastAccessedChunk = nullptr; // Erase all the most recently used chunks. - m_mapChunks.clear(); + for (uint32_t uIndex = 0; uIndex < uChunkArraySize; uIndex++) + { + m_arrayChunks[uIndex] = nullptr; + } } //////////////////////////////////////////////////////////////////////////////// /// Removes all voxels in the specified Region from memory, and calls dataOverflowHandler() to ensure the application has a chance to store the data. It is possible that there are no voxels loaded in the Region, in which case the function will have no effect. //////////////////////////////////////////////////////////////////////////////// - template + /*template void PagedVolume::flush(Region regFlush) { // Clear this pointer in case the chunk it points at is flushed. @@ -256,7 +259,7 @@ namespace PolyVox } } } - } + }*/ template bool PagedVolume::canReuseLastAccessedChunk(int32_t iChunkX, int32_t iChunkY, int32_t iChunkZ) const