Work on LargeVolume refactoring - getting FilePager working.
This commit is contained in:
parent
0cf3de4e76
commit
8ab6d73f0a
@ -85,8 +85,8 @@ int main(int argc, char *argv[])
|
||||
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);
|
||||
//volData.setMaxNumberOfUncompressedBlocks(6);
|
||||
//volData.setMaxNumberOfBlocksInMemory(7);
|
||||
volData.setMaxNumberOfUncompressedBlocks(6);
|
||||
volData.setMaxNumberOfBlocksInMemory(7);
|
||||
|
||||
|
||||
createSphereInVolume(volData, 30);
|
||||
|
@ -54,6 +54,7 @@ namespace PolyVox
|
||||
virtual void pageIn(const Region& region, Block<VoxelType>* pBlockData)
|
||||
{
|
||||
POLYVOX_ASSERT(pBlockData, "Attempting to page in NULL block");
|
||||
POLYVOX_ASSERT(pBlockData->hasUncompressedData() == false, "Block should not have uncompressed data");
|
||||
|
||||
std::stringstream ss;
|
||||
ss << region.getLowerX() << "_" << region.getLowerY() << "_" << region.getLowerZ() << "_"
|
||||
@ -94,6 +95,7 @@ namespace PolyVox
|
||||
virtual void pageOut(const Region& region, Block<VoxelType>* pBlockData)
|
||||
{
|
||||
POLYVOX_ASSERT(pBlockData, "Attempting to page out NULL block");
|
||||
POLYVOX_ASSERT(pBlockData->hasUncompressedData() == false, "Block should not have uncompressed data");
|
||||
|
||||
logTrace() << "Paging out data for " << region;
|
||||
|
||||
|
@ -64,11 +64,14 @@ namespace PolyVox
|
||||
m_uSideLength = uSideLength;
|
||||
m_uSideLengthPower = logBase2(uSideLength);
|
||||
|
||||
//Create the block data
|
||||
//Temporarily create the block data. This is just so we can compress it an discard it.
|
||||
// FIXME - this is a temporary solution.
|
||||
const uint32_t uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength;
|
||||
m_tUncompressedData = new VoxelType[uNoOfVoxels];
|
||||
std::fill(m_tUncompressedData, m_tUncompressedData + uNoOfVoxels, VoxelType());
|
||||
m_bIsUncompressedDataModified = true;
|
||||
|
||||
destroyUncompressedData();
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
|
@ -540,9 +540,11 @@ namespace PolyVox
|
||||
Vector3DInt32 v3dUpper = v3dLower + Vector3DInt32(m_uBlockSideLength-1, m_uBlockSideLength-1, m_uBlockSideLength-1);
|
||||
|
||||
Region reg(v3dLower, v3dUpper);
|
||||
ConstVolumeProxy<VoxelType> ConstVolumeProxy(*this, reg);
|
||||
/*ConstVolumeProxy<VoxelType> ConstVolumeProxy(*this, reg);
|
||||
|
||||
m_pPager->dataOverflowHandler(ConstVolumeProxy, reg);
|
||||
m_pPager->dataOverflowHandler(ConstVolumeProxy, reg);*/
|
||||
|
||||
m_pPager->pageOut(reg, &(itBlock->second));
|
||||
}
|
||||
|
||||
for(uint32_t ct = 0; ct < m_vecBlocksWithUncompressedData.size(); ct++)
|
||||
@ -631,7 +633,9 @@ namespace PolyVox
|
||||
// create the new block
|
||||
Block<VoxelType> newBlock(m_uBlockSideLength, m_pCompressor);
|
||||
|
||||
itBlock = m_pBlocks.insert(std::make_pair(v3dBlockPos, newBlock)).first;
|
||||
auto retVal = m_pBlocks.insert(std::make_pair(v3dBlockPos, newBlock));
|
||||
itBlock = retVal.first;
|
||||
POLYVOX_ASSERT(retVal.second == true, "Element was not supposed to exist!");
|
||||
|
||||
//We have created the new block. If paging is enabled it should be used to
|
||||
//fill in the required data. Otherwise it is just left in the default state.
|
||||
@ -645,8 +649,10 @@ namespace PolyVox
|
||||
Vector3DInt32 v3dLower(v3dBlockPos.getX() << m_uBlockSideLengthPower, v3dBlockPos.getY() << m_uBlockSideLengthPower, v3dBlockPos.getZ() << m_uBlockSideLengthPower);
|
||||
Vector3DInt32 v3dUpper = v3dLower + Vector3DInt32(m_uBlockSideLength-1, m_uBlockSideLength-1, m_uBlockSideLength-1);
|
||||
Region reg(v3dLower, v3dUpper);
|
||||
ConstVolumeProxy<VoxelType> ConstVolumeProxy(*this, reg);
|
||||
m_pPager->dataRequiredHandler(ConstVolumeProxy, reg);
|
||||
/*ConstVolumeProxy<VoxelType> ConstVolumeProxy(*this, reg);
|
||||
m_pPager->dataRequiredHandler(ConstVolumeProxy, reg);*/
|
||||
|
||||
m_pPager->pageIn(reg, &(itBlock->second));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user