Eliminated dome calls to getVoxelAt.

This commit is contained in:
Daviw Williams 2013-06-12 15:22:21 +02:00
parent 45af7a4246
commit efb6d12fc8
2 changed files with 7 additions and 18 deletions

View File

@ -40,7 +40,7 @@ bool testVoxelValidator(const VolumeType* volData, const Vector3DInt32& v3dPos)
return false;
}
typename VolumeType::VoxelType voxel = volData->getVoxelAt(v3dPos);
typename VolumeType::VoxelType voxel = volData->getVoxel<WrapModes::None>(v3dPos);
if(voxel != 0)
{
return false;

View File

@ -109,6 +109,12 @@ public:
{
return mVolumeData[uXPos][uYPos][uZPos];
}
default:
{
// Should never happen
POLYVOX_ASSERT(false, "Invalid wrap mode");
return VoxelType();
}
}
}
@ -146,23 +152,6 @@ public:
return getVoxel(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), eWrapMode, tBorder);
}
/// Gets the value used for voxels which are outside the volume
VoxelType getBorderValue(void) const { return 0; }
/// Gets a voxel at the position given by <tt>x,y,z</tt> coordinates
VoxelType getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const
{
if(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)))
{
return mVolumeData[uXPos][uYPos][uZPos];
}
else
{
return getBorderValue();
}
}
/// Gets a voxel at the position given by a 3D vector
VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const { return getVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ()); }
/// Sets the value used for voxels which are outside the volume
void setBorderValue(const VoxelType& tBorder) { }
/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates