Added ability to check whether previousVoxel has been set.
This commit is contained in:
parent
f4c4bf984c
commit
9a71004b1e
@ -34,9 +34,10 @@ namespace PolyVox
|
||||
*/
|
||||
struct PickResult
|
||||
{
|
||||
PickResult() : didHit(false) {}
|
||||
PickResult() : didHit(false), hasPreviousVoxel(false) {}
|
||||
bool didHit; ///< Did the picking operation hit anything
|
||||
Vector3DInt32 hitVoxel; ///< The location of the solid voxel it hit
|
||||
bool hasPreviousVoxel; //< Whether there is a previous voxel (there may not be if the raycast started in a solid object).
|
||||
Vector3DInt32 previousVoxel; ///< The location of the voxel before the one it hit
|
||||
};
|
||||
|
||||
|
@ -56,6 +56,7 @@ namespace PolyVox
|
||||
return false;
|
||||
}
|
||||
|
||||
m_result.hasPreviousVoxel = true;
|
||||
m_result.previousVoxel = sampler.getPosition();
|
||||
|
||||
return true;
|
||||
|
@ -59,6 +59,7 @@ void TestPicking::testExecute()
|
||||
|
||||
QCOMPARE(resultHit.didHit, true);
|
||||
QCOMPARE(resultHit.hitVoxel, Vector3DInt32((uVolumeSideLength / 2) + 1, uVolumeSideLength / 2, uVolumeSideLength / 2));
|
||||
QCOMPARE(resultHit.hasPreviousVoxel, true);
|
||||
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), emptyVoxelExample);
|
||||
|
Loading…
x
Reference in New Issue
Block a user