Avoided double bounds check.

This commit is contained in:
Daviw Williams 2013-05-27 14:24:52 +02:00
parent 869f5f6c49
commit 0c7002a1ce
3 changed files with 6 additions and 6 deletions

View File

@ -224,14 +224,14 @@ namespace PolyVox
uZPos = (std::min)(uZPos, this->m_regValidRegion.getUpperZ()); uZPos = (std::min)(uZPos, this->m_regValidRegion.getUpperZ());
//Get the voxel value //Get the voxel value
return getVoxel(uXPos, uYPos, uZPos); return getVoxel(uXPos, uYPos, uZPos, BoundsChecks::None); // No bounds checks as we've just validated the position.
//No need to break as we've returned //No need to break as we've returned
} }
case WrapModes::Border: case WrapModes::Border:
{ {
if(this->m_regValidRegion.containsPoint(uXPos, uYPos, uZPos)) if(this->m_regValidRegion.containsPoint(uXPos, uYPos, uZPos))
{ {
return getVoxel(uXPos, uYPos, uZPos); return getVoxel(uXPos, uYPos, uZPos, BoundsChecks::None); // No bounds checks as we've just validated the position.
} }
else else
{ {

View File

@ -182,14 +182,14 @@ namespace PolyVox
uZPos = (std::min)(uZPos, this->m_regValidRegion.getUpperZ()); uZPos = (std::min)(uZPos, this->m_regValidRegion.getUpperZ());
//Get the voxel value //Get the voxel value
return getVoxel(uXPos, uYPos, uZPos); return getVoxel(uXPos, uYPos, uZPos, BoundsChecks::None); // No bounds checks as we've just validated the position.
//No need to break as we've returned //No need to break as we've returned
} }
case WrapModes::Border: case WrapModes::Border:
{ {
if(this->m_regValidRegion.containsPoint(uXPos, uYPos, uZPos)) if(this->m_regValidRegion.containsPoint(uXPos, uYPos, uZPos))
{ {
return getVoxel(uXPos, uYPos, uZPos); return getVoxel(uXPos, uYPos, uZPos, BoundsChecks::None); // No bounds checks as we've just validated the position.
} }
else else
{ {

View File

@ -182,14 +182,14 @@ namespace PolyVox
uZPos = (std::min)(uZPos, this->m_regValidRegion.getUpperZ()); uZPos = (std::min)(uZPos, this->m_regValidRegion.getUpperZ());
//Get the voxel value //Get the voxel value
return getVoxel(uXPos, uYPos, uZPos); return getVoxel(uXPos, uYPos, uZPos, BoundsChecks::None); // No bounds checks as we've just validated the position.
//No need to break as we've returned //No need to break as we've returned
} }
case WrapModes::Border: case WrapModes::Border:
{ {
if(this->m_regValidRegion.containsPoint(uXPos, uYPos, uZPos)) if(this->m_regValidRegion.containsPoint(uXPos, uYPos, uZPos))
{ {
return getVoxel(uXPos, uYPos, uZPos); return getVoxel(uXPos, uYPos, uZPos, BoundsChecks::None); // No bounds checks as we've just validated the position.
} }
else else
{ {