Removed setVoxel() function from BlockVolumeIterator and added setVoxelAt() function to BlockVolume.h

Improved OpenGL example.
This commit is contained in:
David Williams
2009-03-12 21:48:14 +00:00
parent 7100e558f3
commit 0f4a4c0e2b
7 changed files with 148 additions and 114 deletions

View File

@ -235,35 +235,6 @@ namespace PolyVox
mYRegionLastBlock = mYRegionLast >> mVolume.m_uBlockSideLengthPower;
mZRegionLastBlock = mZRegionLast >> mVolume.m_uBlockSideLengthPower;
}
template <typename VoxelType>
void BlockVolumeIterator<VoxelType>::setVoxel(VoxelType tValue)
{
const uint32 uBlockIndex =
mXBlock +
mYBlock * mVolume.m_uSideLengthInBlocks +
mZBlock * mVolume.m_uSideLengthInBlocks * mVolume.m_uSideLengthInBlocks;
const bool bIsShared = mVolume.m_pIsShared[uBlockIndex];
const VoxelType tHomogenousValue = mVolume.m_pHomogenousValue[uBlockIndex];
if(bIsShared)
{
if(tHomogenousValue != tValue)
{
mVolume.m_pBlocks[uBlockIndex] = new Block<VoxelType>(mVolume.m_uBlockSideLengthPower);
mVolume.m_pIsShared[uBlockIndex] = false;
mVolume.m_pBlocks[uBlockIndex]->fill(tHomogenousValue);
mCurrentVoxel = mVolume.m_pBlocks[uBlockIndex]->m_tData + mVoxelIndexInBlock;
*mCurrentVoxel = tValue;
}
}
else
{
//There is a chance that setting this voxel makes the block homogenous and therefore shareable.
mVolume.m_pIsPotentiallySharable[uBlockIndex] = true;
*mCurrentVoxel = tValue;
}
}
#pragma endregion
#pragma region Other