From e4535b1255d85b4d13b8dc54e98632fb1e7d096c Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Wed, 21 Sep 2011 00:19:35 +0200 Subject: [PATCH] Add previousVoxel to raycast result. Thanks to Sceptrix for the patch http://thermite3d.org/phpBB3/viewtopic.php?t=243 --- library/PolyVoxCore/include/PolyVoxCore/Raycast.h | 1 + library/PolyVoxCore/include/PolyVoxCore/Raycast.inl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/library/PolyVoxCore/include/PolyVoxCore/Raycast.h b/library/PolyVoxCore/include/PolyVoxCore/Raycast.h index b94cf5f8..860f4efb 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Raycast.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Raycast.h @@ -41,6 +41,7 @@ namespace PolyVox bool foundIntersection; ///If an intersection was found then this field holds the intersecting voxel, otherwise it is undefined. Vector3DInt32 intersectionVoxel; + Vector3DInt32 previousVoxel; }; /// The Raycast class can be used to find the fist filled voxel along a given path. diff --git a/library/PolyVoxCore/include/PolyVoxCore/Raycast.inl b/library/PolyVoxCore/include/PolyVoxCore/Raycast.inl index fb0f99ef..2c051073 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Raycast.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/Raycast.inl @@ -143,6 +143,7 @@ namespace PolyVox m_result.intersectionVoxel = Vector3DInt32(i,j,k); return; } + m_result.previousVoxel = Vector3DInt32(i,j,k); if(tx <= ty && tx <= tz) { @@ -174,5 +175,6 @@ namespace PolyVox //Didn't hit anything m_result.foundIntersection = false; m_result.intersectionVoxel = Vector3DInt32(0,0,0); + m_result.previousVoxel = Vector3DInt32(0,0,0); } } \ No newline at end of file