diff --git a/library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl index 6177aaf2..fa8d4895 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl @@ -57,7 +57,7 @@ namespace PolyVox template VoxelType BaseVolume::Sampler::getVoxel(void) const { - return mVolume->getVoxel(mXPosInVolume, mYPosInVolume, mZPosInVolume); + return mVolume->getVoxel(mXPosInVolume, mYPosInVolume, mZPosInVolume, WrapModes::None); // FIXME - Use templatised version instead but watch for Linux compile errors. } template @@ -350,13 +350,13 @@ namespace PolyVox switch(m_eWrapMode) { case WrapModes::None: - return mVolume->getVoxel(uXPos, uYPos, uZPos, m_tBorder); + return mVolume->getVoxel(uXPos, uYPos, uZPos, WrapModes::None, m_tBorder); case WrapModes::Clamp: - return mVolume->getVoxel(uXPos, uYPos, uZPos, m_tBorder); + return mVolume->getVoxel(uXPos, uYPos, uZPos, WrapModes::Clamp, m_tBorder); case WrapModes::Border: - return mVolume->getVoxel(uXPos, uYPos, uZPos, m_tBorder); + return mVolume->getVoxel(uXPos, uYPos, uZPos, WrapModes::Border, m_tBorder); case WrapModes::DontCheck: - return mVolume->getVoxel(uXPos, uYPos, uZPos, m_tBorder); + return mVolume->getVoxel(uXPos, uYPos, uZPos, WrapModes::DontCheck, m_tBorder); default: // Should never happen POLYVOX_ASSERT(false, "Invalid wrap mode"); diff --git a/tests/TestVolumeSubclass.cpp b/tests/TestVolumeSubclass.cpp index c37e4702..704d8ced 100644 --- a/tests/TestVolumeSubclass.cpp +++ b/tests/TestVolumeSubclass.cpp @@ -71,6 +71,22 @@ public: /// Gets a voxel at the position given by x,y,z coordinates template VoxelType getVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tBorder = VoxelType()) const + { + // FIXME: This templatised version is implemented in terms of the not template version. This is strange + // from a peformance point of view but it's just because we were encountering some compile issues on GCC. + return getVoxel(uXPos, uYPos, uZPos, eWrapMode, tBorder); + } + + /// Gets a voxel at the position given by a 3D vector + template + VoxelType getVoxel(const Vector3DInt32& v3dPos, VoxelType tBorder = VoxelType()) const + { + // Simply call through to the real implementation + return getVoxel(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tBorder); + } + + /// Gets a voxel at the position given by x,y,z coordinates + VoxelType getVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, WrapMode eWrapMode = WrapModes::None, VoxelType tBorder = VoxelType()) const { switch(eWrapMode) { @@ -118,34 +134,6 @@ public: } } - /// Gets a voxel at the position given by a 3D vector - template - VoxelType getVoxel(const Vector3DInt32& v3dPos, VoxelType tBorder = VoxelType()) const - { - // Simply call through to the real implementation - return getVoxel(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tBorder); - } - - /// Gets a voxel at the position given by x,y,z coordinates - VoxelType getVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, WrapMode eWrapMode = WrapModes::None, VoxelType tBorder = VoxelType()) const - { - switch(eWrapMode) - { - case WrapModes::None: - return getVoxel(uXPos, uYPos, uZPos, WrapModes::None, tBorder); - case WrapModes::Clamp: - return getVoxel(uXPos, uYPos, uZPos, WrapModes::Clamp, tBorder); - case WrapModes::Border: - return getVoxel(uXPos, uYPos, uZPos, WrapModes::Border, tBorder); - case WrapModes::DontCheck: - return getVoxel(uXPos, uYPos, uZPos, WrapModes::DontCheck, tBorder); - default: - // Should never happen - POLYVOX_ASSERT(false, "Invalid wrap mode"); - return VoxelType(); - } - } - /// Gets a voxel at the position given by a 3D vector VoxelType getVoxel(const Vector3DInt32& v3dPos, WrapMode eWrapMode = WrapModes::None, VoxelType tBorder = VoxelType()) const {