medfall

A super great game engine
Log | Files | Refs

commit f2a1403ddd1978a96860c1f7ce87c953166db227
parent 3abebe1b8f077a106949da5a7520e16ca987d8a4
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat, 18 Nov 2017 13:13:23 +0200

Intersect vs xy plane outside the quadtree

Diffstat:
heightmap.cc | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/heightmap.cc b/heightmap.cc @@ -255,7 +255,12 @@ bool ray_vs_quadtree( const QuadTree & qt, const Ray3 & ray, float * t, v3 * xno if( xnormal == NULL ) xnormal = &dont_care_normal; - return ray_vs_quadtree_node( qt, 0, aabb, ray, t, xnormal, max_dist ); + bool hit_quadtree = ray_vs_quadtree_node( qt, 0, aabb, ray, t, xnormal, max_dist ); + if( hit_quadtree ) + return true; + + *xnormal = v3( 0, 0, 1 ); + return ray_vs_plane( ray.origin, ray.dir, *xnormal, 0, t ); } bool segment_vs_quadtree( const QuadTree & qt, const v3 & start, const v3 & end, float * t, v3 * xnormal ) {