26 template <
typename VoxelType>
28 :m_tUncompressedData(0)
30 ,m_uSideLengthPower(0)
38 template <
typename VoxelType>
41 delete[] m_tUncompressedData;
44 template <
typename VoxelType>
50 template <
typename VoxelType>
53 assert(uXPos < m_uSideLength);
54 assert(uYPos < m_uSideLength);
55 assert(uZPos < m_uSideLength);
57 assert(m_tUncompressedData);
59 return m_tUncompressedData
62 uYPos * m_uSideLength +
63 uZPos * m_uSideLength * m_uSideLength
67 template <
typename VoxelType>
73 template <
typename VoxelType>
76 assert(uXPos < m_uSideLength);
77 assert(uYPos < m_uSideLength);
78 assert(uZPos < m_uSideLength);
80 assert(m_tUncompressedData);
85 uYPos * m_uSideLength +
86 uZPos * m_uSideLength * m_uSideLength
90 template <
typename VoxelType>
96 template <
typename VoxelType>
99 const uint32_t uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength;
100 std::fill(m_tUncompressedData, m_tUncompressedData + uNoOfVoxels, tValue);
103 template <
typename VoxelType>
112 throw std::invalid_argument(
"Block side length must be a power of two.");
116 m_uSideLength = uSideLength;
117 m_uSideLengthPower =
logBase2(uSideLength);
119 m_tUncompressedData =
new VoxelType[m_uSideLength * m_uSideLength * m_uSideLength];
124 template <
typename VoxelType>
127 uint32_t uSizeInBytes =
sizeof(
Block);
128 uSizeInBytes +=
sizeof(
VoxelType) * m_uSideLength * m_uSideLength * m_uSideLength;