diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.h index 53e0dd4b..3c253186 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.h @@ -56,7 +56,6 @@ namespace PolyVox void setVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos, VoxelType tValue); void setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue); - void fill(VoxelType tValue); void initialise(uint16_t uSideLength); uint32_t calculateSizeInBytes(void); diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.inl b/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.inl index 4cdef746..2849b838 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/Block.inl @@ -105,29 +105,6 @@ namespace PolyVox setVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue); } - template - void Block::fill(VoxelType tValue) - { - if(!m_bIsCompressed) - { - //The memset *may* be faster than the std::fill(), but it doesn't compile nicely - //in 64-bit mode as casting the pointer to an int causes a loss of precision. - const uint32_t uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength; - std::fill(m_tUncompressedData, m_tUncompressedData + uNoOfVoxels, tValue); - - m_bIsUncompressedDataModified = true; - } - else - { - POLYVOX_ASSERT(false, "Not implemented"); - RunlengthEntry rle; - rle.length = m_uSideLength*m_uSideLength*m_uSideLength; - rle.value = tValue; - m_vecCompressedData.clear(); - m_vecCompressedData.push_back(rle); - } - } - template void Block::initialise(uint16_t uSideLength) { @@ -144,10 +121,15 @@ namespace PolyVox m_uSideLength = uSideLength; m_uSideLengthPower = logBase2(uSideLength); + //Create the block data m_tUncompressedData = new VoxelType[m_uSideLength * m_uSideLength * m_uSideLength]; - Block::fill(VoxelType()); + //Clear it (should we bother?) + const uint32_t uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength; + std::fill(m_tUncompressedData, m_tUncompressedData + uNoOfVoxels, VoxelType()); + m_bIsUncompressedDataModified = true; + //For some reason blocks start out compressed. We should probably change this. compress(); }