Refactoring and optimising Marching Cubes algorithm.

This commit is contained in:
David Williams
2009-05-04 10:28:20 +00:00
parent 6da15633e6
commit 03163404df
7 changed files with 480 additions and 367 deletions

View File

@ -247,12 +247,27 @@ namespace PolyVox
template <typename VoxelType>
VoxelType Volume<VoxelType>::getVoxelAt(const Vector3DUint16& v3dPos) const
{
assert(v3dPos.getX() < m_uWidth);
assert(v3dPos.getY() < m_uHeight);
assert(v3dPos.getZ() < m_uDepth);
return getVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ());
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::getVoxelAtWithBoundCheck(int16_t uXPos, int16_t uYPos, int16_t uZPos) const
{
if((uXPos >=0) && (uXPos < m_uWidth) && (uYPos >= 0) && (uYPos < m_uHeight) && (uZPos >= 0) && (uZPos < m_uDepth))
{
return getVoxelAt(uXPos, uYPos, uZPos);
}
else
{
return 0;
}
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::getVoxelAtWithBoundCheck(const Vector3DInt16& v3dPos) const
{
return getVoxelAtWithBoundCheck(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ());
}
#pragma endregion
#pragma region Setters