diff --git a/library/PolyVoxCore/include/PolyVoxCore/FilePager.h b/library/PolyVoxCore/include/PolyVoxCore/FilePager.h index 1f3115ab..7fb79f1c 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/FilePager.h +++ b/library/PolyVoxCore/include/PolyVoxCore/FilePager.h @@ -55,7 +55,7 @@ namespace PolyVox virtual void pageIn(const Region& region, Block* pBlockData) { POLYVOX_ASSERT(pBlockData, "Attempting to page in NULL block"); - POLYVOX_ASSERT(pBlockData->hasUncompressedData() == false, "Block should not have uncompressed data"); + //POLYVOX_ASSERT(pBlockData->hasUncompressedData() == false, "Block should not have uncompressed data"); std::stringstream ss; ss << region.getLowerX() << "_" << region.getLowerY() << "_" << region.getLowerZ() << "_" @@ -96,7 +96,7 @@ namespace PolyVox virtual void pageOut(const Region& region, Block* pBlockData) { POLYVOX_ASSERT(pBlockData, "Attempting to page out NULL block"); - POLYVOX_ASSERT(pBlockData->hasUncompressedData() == false, "Block should not have uncompressed data"); + //POLYVOX_ASSERT(pBlockData->hasUncompressedData() == false, "Block should not have uncompressed data"); logTrace() << "Paging out data for " << region; diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.h index 509b2dce..86d6d08b 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.h @@ -42,27 +42,14 @@ namespace PolyVox const uint8_t* getCompressedData(void) const; uint32_t getCompressedDataLength(void) const; - uint16_t getSideLength(void) const; - VoxelType getVoxel(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos) const; - VoxelType getVoxel(const Vector3DUint16& v3dPos) const; - - bool hasUncompressedData(void) const; void setCompressedData(const uint8_t* const data, uint32_t dataLength); - void setVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos, VoxelType tValue); - void setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue); uint32_t calculateSizeInBytes(void); public: - Compressor* m_pCompressor; uint8_t* m_pCompressedData; uint32_t m_uCompressedDataLength; - VoxelType* m_tUncompressedData; - uint16_t m_uSideLength; - uint8_t m_uSideLengthPower; - bool m_bIsUncompressedDataModified; - uint32_t timestamp; }; } diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.inl b/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.inl index bdba78f9..3f311e0d 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.inl @@ -37,13 +37,8 @@ namespace PolyVox { template Block::Block(uint16_t uSideLength, Compressor* pCompressor) - :m_pCompressor(pCompressor) - ,m_pCompressedData(0) + :m_pCompressedData(0) ,m_uCompressedDataLength(0) - ,m_tUncompressedData(0) - ,m_uSideLength(0) - ,m_uSideLengthPower(0) - ,m_bIsUncompressedDataModified(true) { if(uSideLength == 0) { @@ -60,18 +55,6 @@ namespace PolyVox POLYVOX_THROW(std::invalid_argument, "Block must be provided with a valid compressor."); } - //Compute the side length - m_uSideLength = uSideLength; - m_uSideLengthPower = logBase2(uSideLength); - - //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 @@ -88,42 +71,6 @@ namespace PolyVox return m_uCompressedDataLength; } - template - uint16_t Block::getSideLength(void) const - { - return m_uSideLength; - } - - template - VoxelType Block::getVoxel(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos) const - { - // This is internal code not directly called by the user. For efficiency we assert rather than throwing. - POLYVOX_ASSERT(uXPos < m_uSideLength, "Supplied position is outside of the block"); - POLYVOX_ASSERT(uYPos < m_uSideLength, "Supplied position is outside of the block"); - POLYVOX_ASSERT(uZPos < m_uSideLength, "Supplied position is outside of the block"); - POLYVOX_ASSERT(hasUncompressedData(), "The block must have uncompressed data to call getVoxel()"); - POLYVOX_ASSERT(m_tUncompressedData, "No uncompressed data - block must be decompressed before accessing voxels."); - - return m_tUncompressedData - [ - uXPos + - uYPos * m_uSideLength + - uZPos * m_uSideLength * m_uSideLength - ]; - } - - template - VoxelType Block::getVoxel(const Vector3DUint16& v3dPos) const - { - return getVoxel(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ()); - } - - template - bool Block::hasUncompressedData(void) const - { - return m_tUncompressedData != 0; - } - template void Block::setCompressedData(const uint8_t* const data, uint32_t dataLength) { @@ -137,32 +84,6 @@ namespace PolyVox memcpy(m_pCompressedData, data, dataLength); } - template - void Block::setVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos, VoxelType tValue) - { - // This is internal code not directly called by the user. For efficiency we assert rather than throwing. - POLYVOX_ASSERT(uXPos < m_uSideLength, "Supplied position is outside of the block"); - POLYVOX_ASSERT(uYPos < m_uSideLength, "Supplied position is outside of the block"); - POLYVOX_ASSERT(uZPos < m_uSideLength, "Supplied position is outside of the block"); - POLYVOX_ASSERT(hasUncompressedData(), "The block must have uncompressed data to call setVoxelAt()"); - POLYVOX_ASSERT(m_tUncompressedData, "No uncompressed data - block must be decompressed before accessing voxels."); - - m_tUncompressedData - [ - uXPos + - uYPos * m_uSideLength + - uZPos * m_uSideLength * m_uSideLength - ] = tValue; - - m_bIsUncompressedDataModified = true; - } - - template - void Block::setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue) - { - setVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue); - } - template uint32_t Block::calculateSizeInBytes(void) { diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl index 770c94ee..46b89c36 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl @@ -746,7 +746,7 @@ namespace PolyVox } } - POLYVOX_ASSERT(itUnloadBlock->second.hasUncompressedData() == false, "This function should never flush blocks with uncompressed data."); + //POLYVOX_ASSERT(itUnloadBlock->second.hasUncompressedData() == false, "This function should never flush blocks with uncompressed data."); uMemoryToReclaim -= itUnloadBlock->second.calculateSizeInBytes();