diff --git a/library/PolyVoxCore/include/SimpleVolume.h b/library/PolyVoxCore/include/SimpleVolume.h index ed00833f..e8c1f98d 100644 --- a/library/PolyVoxCore/include/SimpleVolume.h +++ b/library/PolyVoxCore/include/SimpleVolume.h @@ -176,37 +176,18 @@ namespace PolyVox /// Sets the voxel at the position given by a 3D vector bool setVoxelAt(const Vector3DInt32& v3dPos, VoxelType tValue); - /// Empties the cache of uncompressed blocks - void clearBlockCache(void); - /// Calculates the approximate compression ratio of the store volume data - float calculateCompressionRatio(void); /// Calculates approximatly how many bytes of memory the volume is currently using. uint32_t calculateSizeInBytes(void); /// Deprecated - I don't think we should expose this function? Let us know if you disagree... void resize(const Region& regValidRegion, uint16_t uBlockSideLength); -private: - /// gets called when a new region is allocated and needs to be filled - /// NOTE: accessing ANY voxels outside this region during the process of this function - /// is absolutely unsafe - polyvox_function&, const Region&)> m_funcDataRequiredHandler; - /// gets called when a Region needs to be stored by the user, because SimpleVolume will erase it right after - /// this function returns - /// NOTE: accessing ANY voxels outside this region during the process of this function - /// is absolutely unsafe - polyvox_function&, const Region&)> m_funcDataOverflowHandler; - +private: Block* getUncompressedBlock(int32_t uBlockX, int32_t uBlockY, int32_t uBlockZ) const; - /// this function can be called by m_funcDataRequiredHandler without causing any weird effects - bool setVoxelAtConst(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) const; //The block data mutable std::map m_pBlocks; - mutable Vector3DInt32 m_v3dLastAccessedBlockPos; - mutable Block* m_pLastAccessedBlock; - //We don't store an actual Block for the border, just the uncompressed data. This is partly because the border //block does not have a position (so can't be passed to getUncompressedBlock()) and partly because there's a //good chance we'll often hit it anyway. It's a chunk of homogenous data (rather than a single value) so that diff --git a/library/PolyVoxCore/include/SimpleVolume.inl b/library/PolyVoxCore/include/SimpleVolume.inl index e0294879..eb4ff2fa 100644 --- a/library/PolyVoxCore/include/SimpleVolume.inl +++ b/library/PolyVoxCore/include/SimpleVolume.inl @@ -257,14 +257,6 @@ namespace PolyVox return setVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue); } - //////////////////////////////////////////////////////////////////////////////// - /// - //////////////////////////////////////////////////////////////////////////////// - template - void SimpleVolume::clearBlockCache(void) - { - } - //////////////////////////////////////////////////////////////////////////////// /// This function should probably be made internal... //////////////////////////////////////////////////////////////////////////////// @@ -312,30 +304,6 @@ namespace PolyVox m_fDiagonalLength = sqrtf(static_cast(getWidth() * getWidth() + getHeight() * getHeight() + getDepth() * getDepth())); } - template - bool SimpleVolume::setVoxelAtConst(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) const - { - //We don't have any range checks in this function because it - //is a private function only called by the ConstVolumeProxy. The - //ConstVolumeProxy takes care of ensuring the range is appropriate. - - const int32_t blockX = uXPos >> m_uBlockSideLengthPower; - const int32_t blockY = uYPos >> m_uBlockSideLengthPower; - const int32_t blockZ = uZPos >> m_uBlockSideLengthPower; - - const uint16_t xOffset = uXPos - (blockX << m_uBlockSideLengthPower); - const uint16_t yOffset = uYPos - (blockY << m_uBlockSideLengthPower); - const uint16_t zOffset = uZPos - (blockZ << m_uBlockSideLengthPower); - - Block* pUncompressedBlock = getUncompressedBlock(blockX, blockY, blockZ); - - pUncompressedBlock->setVoxelAt(xOffset,yOffset,zOffset, tValue); - - //Return true to indicate that we modified a voxel. - return true; - } - - template typename SimpleVolume::Block* SimpleVolume::getUncompressedBlock(int32_t uBlockX, int32_t uBlockY, int32_t uBlockZ) const { @@ -354,17 +322,6 @@ namespace PolyVox return █ } - //////////////////////////////////////////////////////////////////////////////// - /// Note: This function needs reviewing for accuracy... - //////////////////////////////////////////////////////////////////////////////// - template - float SimpleVolume::calculateCompressionRatio(void) - { - float fRawSize = m_pBlocks.size() * m_uBlockSideLength * m_uBlockSideLength* m_uBlockSideLength * sizeof(VoxelType); - float fCompressedSize = calculateSizeInBytes(); - return fCompressedSize/fRawSize; - } - //////////////////////////////////////////////////////////////////////////////// /// Note: This function needs reviewing for accuracy... ////////////////////////////////////////////////////////////////////////////////