Added ability to check whether previousVoxel has been set.

This commit is contained in:
David Williams
2016-05-21 08:34:13 +01:00
parent f4c4bf984c
commit 9a71004b1e
3 changed files with 4 additions and 1 deletions

View File

@ -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
};

View File

@ -56,6 +56,7 @@ namespace PolyVox
return false;
}
m_result.hasPreviousVoxel = true;
m_result.previousVoxel = sampler.getPosition();
return true;