Added setVoxel() funtion to volume iterators.

Fixed bugs with RawVolume iterator movement funtions.
Proper implementation of RawVolume peek...() functions.
This commit is contained in:
David Williams
2011-08-15 21:10:09 +01:00
parent c73b45b721
commit 90063354bd
11 changed files with 254 additions and 31 deletions

View File

@ -143,7 +143,7 @@ namespace PolyVox
{
/*Block<VoxelType>* pUncompressedBorderBlock = getUncompressedBlock(&m_pBorderBlock);
return pUncompressedBorderBlock->fill(tBorder);*/
std::fill(m_pUncompressedBorderData, m_pUncompressedBorderData + m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength, tBorder);
std::fill(m_pUncompressedBorderData, m_pUncompressedBorderData + m_uNoOfVoxelsPerBlock, tBorder);
}
////////////////////////////////////////////////////////////////////////////////
@ -205,6 +205,7 @@ namespace PolyVox
}
m_uBlockSideLength = uBlockSideLength;
m_uNoOfVoxelsPerBlock = m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength;
m_pUncompressedBorderData = 0;
this->m_regValidRegion = regValidRegion;
@ -230,8 +231,8 @@ namespace PolyVox
}
//Create the border block
m_pUncompressedBorderData = new VoxelType[m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength];
std::fill(m_pUncompressedBorderData, m_pUncompressedBorderData + m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength, VoxelType());
m_pUncompressedBorderData = new VoxelType[m_uNoOfVoxelsPerBlock];
std::fill(m_pUncompressedBorderData, m_pUncompressedBorderData + m_uNoOfVoxelsPerBlock, VoxelType());
//Other properties we might find useful later
this->m_uLongestSideLength = (std::max)((std::max)(this->getWidth(),this->getHeight()),this->getDepth());
@ -266,7 +267,7 @@ namespace PolyVox
{
uint32_t uSizeInBytes = sizeof(SimpleVolume);
uint32_t uSizeOfBlockInBytes = m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength * sizeof(VoxelType);
uint32_t uSizeOfBlockInBytes = m_uNoOfVoxelsPerBlock * sizeof(VoxelType);
//Memory used by the blocks ( + 1 is for border)
uSizeInBytes += uSizeOfBlockInBytes * (m_uNoOfBlocksInVolume + 1);