From efb6d12fc84624fcaf4a437858e4469b3e8acb42 Mon Sep 17 00:00:00 2001 From: Daviw Williams Date: Wed, 12 Jun 2013 15:22:21 +0200 Subject: [PATCH] Eliminated dome calls to getVoxelAt. --- tests/TestAStarPathfinder.cpp | 2 +- tests/TestVolumeSubclass.cpp | 23 ++++++----------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/tests/TestAStarPathfinder.cpp b/tests/TestAStarPathfinder.cpp index 870b88e1..a061bd40 100644 --- a/tests/TestAStarPathfinder.cpp +++ b/tests/TestAStarPathfinder.cpp @@ -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(v3dPos); if(voxel != 0) { return false; diff --git a/tests/TestVolumeSubclass.cpp b/tests/TestVolumeSubclass.cpp index 275dd3b1..c37e4702 100644 --- a/tests/TestVolumeSubclass.cpp +++ b/tests/TestVolumeSubclass.cpp @@ -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 x,y,z 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 x,y,z coordinates