diff --git a/library/PolyVoxCore/include/PolyVoxCore/Picking.h b/library/PolyVoxCore/include/PolyVoxCore/Picking.h index 96322ac2..ee757ddb 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Picking.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Picking.h @@ -41,7 +41,7 @@ namespace PolyVox /// Pick the first solid voxel along a vector template - PickResult pickVoxel(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirectionAndLength, const typename VolumeType::VoxelType& emptyVoxelExample = typename VolumeType::VoxelType()); + PickResult pickVoxel(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirectionAndLength, const typename VolumeType::VoxelType& emptyVoxelExample); } #include "PolyVoxCore/Picking.inl" diff --git a/tests/TestPicking.cpp b/tests/TestPicking.cpp index 62fa8531..6271d004 100644 --- a/tests/TestPicking.cpp +++ b/tests/TestPicking.cpp @@ -52,14 +52,15 @@ void TestPicking::testExecute() } } } - - PickResult resultHit = pickVoxel(&volData, Vector3DFloat(0, uVolumeSideLength / 2, uVolumeSideLength / 2), Vector3DFloat(uVolumeSideLength, 0, 0)); + + const int8_t emptyVoxelExample = 0; //A voxel value of zero will represent empty space. + PickResult resultHit = pickVoxel(&volData, Vector3DFloat(0, uVolumeSideLength / 2, uVolumeSideLength / 2), Vector3DFloat(uVolumeSideLength, 0, 0), emptyVoxelExample); QCOMPARE(resultHit.didHit, true); QCOMPARE(resultHit.hitVoxel, Vector3DInt32((uVolumeSideLength / 2) + 1, uVolumeSideLength / 2, uVolumeSideLength / 2)); QCOMPARE(resultHit.previousVoxel, Vector3DInt32((uVolumeSideLength / 2), uVolumeSideLength / 2, uVolumeSideLength / 2)); - PickResult resultMiss = pickVoxel(&volData, Vector3DFloat(0, uVolumeSideLength / 2, uVolumeSideLength / 2), Vector3DFloat(uVolumeSideLength / 2, uVolumeSideLength, uVolumeSideLength)); + PickResult resultMiss = pickVoxel(&volData, Vector3DFloat(0, uVolumeSideLength / 2, uVolumeSideLength / 2), Vector3DFloat(uVolumeSideLength / 2, uVolumeSideLength, uVolumeSideLength), emptyVoxelExample); QCOMPARE(resultMiss.didHit, false); }