diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl index db604532..502ac706 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl @@ -223,9 +223,14 @@ namespace PolyVox const uint16_t yOffset = static_cast(uYPos - (blockY << m_uBlockSideLengthPower)); const uint16_t zOffset = static_cast(uZPos - (blockZ << m_uBlockSideLengthPower)); - Block* pUncompressedBlock = getUncompressedBlock(blockX, blockY, blockZ); + VoxelType* pUncompressedBlock = getUncompressedBlock(blockX, blockY, blockZ)->m_tUncompressedData; - return pUncompressedBlock->getVoxel(xOffset,yOffset,zOffset); + return pUncompressedBlock + [ + xOffset + + yOffset * m_uBlockSideLength + + zOffset * m_uBlockSideLength * m_uBlockSideLength + ]; } else { @@ -312,9 +317,14 @@ namespace PolyVox const uint16_t yOffset = static_cast(uYPos - (blockY << m_uBlockSideLengthPower)); const uint16_t zOffset = static_cast(uZPos - (blockZ << m_uBlockSideLengthPower)); - Block* pUncompressedBlock = getUncompressedBlock(blockX, blockY, blockZ); + VoxelType* pUncompressedBlock = getUncompressedBlock(blockX, blockY, blockZ)->m_tUncompressedData; - pUncompressedBlock->setVoxelAt(xOffset,yOffset,zOffset, tValue); + pUncompressedBlock + [ + xOffset + + yOffset * m_uBlockSideLength + + zOffset * m_uBlockSideLength * m_uBlockSideLength + ] = tValue; } //////////////////////////////////////////////////////////////////////////////// @@ -350,9 +360,14 @@ namespace PolyVox const uint16_t yOffset = static_cast(uYPos - (blockY << m_uBlockSideLengthPower)); const uint16_t zOffset = static_cast(uZPos - (blockZ << m_uBlockSideLengthPower)); - Block* pUncompressedBlock = getUncompressedBlock(blockX, blockY, blockZ); + VoxelType* pUncompressedBlock = getUncompressedBlock(blockX, blockY, blockZ)->m_tUncompressedData; - pUncompressedBlock->setVoxelAt(xOffset,yOffset,zOffset, tValue); + pUncompressedBlock + [ + xOffset + + yOffset * m_uBlockSideLength + + zOffset * m_uBlockSideLength * m_uBlockSideLength + ] = tValue; //Return true to indicate that we modified a voxel. return true; @@ -840,9 +855,14 @@ namespace PolyVox const uint16_t yOffset = static_cast(uYPos - (blockY << m_uBlockSideLengthPower)); const uint16_t zOffset = static_cast(uZPos - (blockZ << m_uBlockSideLengthPower)); - Block* pUncompressedBlock = getUncompressedBlock(blockX, blockY, blockZ); + VoxelType* pUncompressedBlock = getUncompressedBlock(blockX, blockY, blockZ)->m_tUncompressedData; - return pUncompressedBlock->getVoxel(xOffset,yOffset,zOffset); + return pUncompressedBlock + [ + xOffset + + yOffset * m_uBlockSideLength + + zOffset * m_uBlockSideLength * m_uBlockSideLength + ]; } } diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl index 0d71a68f..dd61fcf0 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl @@ -119,9 +119,9 @@ namespace PolyVox uYPosInBlock * this->mVolume->m_uBlockSideLength + uZPosInBlock * this->mVolume->m_uBlockSideLength * this->mVolume->m_uBlockSideLength; - Block* pUncompressedCurrentBlock = this->mVolume->getUncompressedBlock(uXBlock, uYBlock, uZBlock); + VoxelType* pUncompressedCurrentBlock = this->mVolume->getUncompressedBlock(uXBlock, uYBlock, uZBlock)->m_tUncompressedData; - mCurrentVoxel = pUncompressedCurrentBlock->m_tUncompressedData + uVoxelIndexInBlock; + mCurrentVoxel = pUncompressedCurrentBlock + uVoxelIndexInBlock; } else {