28 template <
typename VoxelType>
30 :m_tUncompressedData(0)
32 ,m_uSideLengthPower(0)
40 template <
typename VoxelType>
43 delete[] m_tUncompressedData;
46 template <
typename VoxelType>
52 template <
typename VoxelType>
55 POLYVOX_ASSERT(uXPos < m_uSideLength,
"Position is outside of the block.");
56 POLYVOX_ASSERT(uYPos < m_uSideLength,
"Position is outside of the block.");
57 POLYVOX_ASSERT(uZPos < m_uSideLength,
"Position is outside of the block.");
59 POLYVOX_ASSERT(m_tUncompressedData,
"No uncompressed data available");
61 return m_tUncompressedData
64 uYPos * m_uSideLength +
65 uZPos * m_uSideLength * m_uSideLength
69 template <
typename VoxelType>
75 template <
typename VoxelType>
78 POLYVOX_ASSERT(uXPos < m_uSideLength,
"Position is outside of the block.");
79 POLYVOX_ASSERT(uYPos < m_uSideLength,
"Position is outside of the block.");
80 POLYVOX_ASSERT(uZPos < m_uSideLength,
"Position is outside of the block.");
82 POLYVOX_ASSERT(m_tUncompressedData,
"No uncompressed data available");
87 uYPos * m_uSideLength +
88 uZPos * m_uSideLength * m_uSideLength
92 template <
typename VoxelType>
98 template <
typename VoxelType>
101 const uint32_t uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength;
102 std::fill(m_tUncompressedData, m_tUncompressedData + uNoOfVoxels, tValue);
105 template <
typename VoxelType>
114 POLYVOX_THROW(std::invalid_argument,
"Block side length must be a power of two.");
118 m_uSideLength = uSideLength;
119 m_uSideLengthPower =
logBase2(uSideLength);
121 m_tUncompressedData =
new VoxelType[m_uSideLength * m_uSideLength * m_uSideLength];
126 template <
typename VoxelType>
130 uSizeInBytes +=
sizeof(
VoxelType) * m_uSideLength * m_uSideLength * m_uSideLength;