Avoided double bounds check.
This commit is contained in:
		| @@ -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 | ||||||
| 				{ | 				{ | ||||||
|   | |||||||
| @@ -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 | ||||||
| 				{ | 				{ | ||||||
|   | |||||||
| @@ -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 | ||||||
| 				{ | 				{ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user