Work on LargeVolume refactoring - getting FilePager working.
This commit is contained in:
		| @@ -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)); | ||||
| 				} | ||||
| 			} | ||||
| 		}		 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user