Work on tidying LargeVolume...
This commit is contained in:
parent
44d525f591
commit
938eea7c8e
@ -82,7 +82,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//Create an empty volume and then place a sphere in it
|
//Create an empty volume and then place a sphere in it
|
||||||
RLECompressor<uint8_t, uint16_t>* pCompressor = new RLECompressor<uint8_t, uint16_t>();
|
RLECompressor<uint8_t, uint16_t>* pCompressor = new RLECompressor<uint8_t, uint16_t>();
|
||||||
FilePager<uint8_t>* pFilePager = new FilePager<uint8_t>("C:/temp/voldata/");
|
FilePager<uint8_t>* pFilePager = new FilePager<uint8_t>("D:/temp/voldata/");
|
||||||
|
|
||||||
LargeVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)), pCompressor, pFilePager, 32);
|
LargeVolume<uint8_t> volData(PolyVox::Region(Vector3DInt32(0,0,0), Vector3DInt32(63, 63, 63)), pCompressor, pFilePager, 32);
|
||||||
volData.setMaxNumberOfUncompressedBlocks(2);
|
volData.setMaxNumberOfUncompressedBlocks(2);
|
||||||
|
@ -546,6 +546,11 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void LargeVolume<VoxelType>::eraseBlock(typename std::map<Vector3DInt32, Block<VoxelType>, BlockPositionCompare>::iterator itBlock) const
|
void LargeVolume<VoxelType>::eraseBlock(typename std::map<Vector3DInt32, Block<VoxelType>, BlockPositionCompare>::iterator itBlock) const
|
||||||
{
|
{
|
||||||
|
if(itBlock->second.hasUncompressedData())
|
||||||
|
{
|
||||||
|
itBlock->second.destroyUncompressedData();
|
||||||
|
}
|
||||||
|
|
||||||
if(m_pPager)
|
if(m_pPager)
|
||||||
{
|
{
|
||||||
Vector3DInt32 v3dPos = itBlock->first;
|
Vector3DInt32 v3dPos = itBlock->first;
|
||||||
@ -565,8 +570,6 @@ namespace PolyVox
|
|||||||
// find the block in the uncompressed cache
|
// find the block in the uncompressed cache
|
||||||
if(m_vecBlocksWithUncompressedData[ct] == &(itBlock->second))
|
if(m_vecBlocksWithUncompressedData[ct] == &(itBlock->second))
|
||||||
{
|
{
|
||||||
// TODO: compression is unneccessary? or will not compressing this cause a memleak?
|
|
||||||
itBlock->second.destroyUncompressedData();
|
|
||||||
// put last object in cache here
|
// put last object in cache here
|
||||||
m_vecBlocksWithUncompressedData[ct] = m_vecBlocksWithUncompressedData.back();
|
m_vecBlocksWithUncompressedData[ct] = m_vecBlocksWithUncompressedData.back();
|
||||||
// decrease cache size by one since last element is now in here twice
|
// decrease cache size by one since last element is now in here twice
|
||||||
|
Loading…
x
Reference in New Issue
Block a user