From 1813f00b94982727bf545cd4c49ec2d2fee86f7a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 12 May 2018 08:19:20 +0200 Subject: Fix missing fallback in recent aabb precalc func Also comment unused vars --- source/blender/blenlib/intern/math_geom.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 582ecb92274..7419d65bdee 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -806,10 +806,21 @@ void dist_squared_to_projected_aabb_precalc( //normalize_v3(neasrest_precalc->ray_direction); } #else - isect_plane_plane_v3( + if (!isect_plane_plane_v3( px, py, neasrest_precalc->ray_origin, - neasrest_precalc->ray_direction); + neasrest_precalc->ray_direction)) + { + if (projmat[3][3] == 0.0f) { + /* Perspective projection. */ + cross_v3_v3v3(neasrest_precalc->ray_direction, py, px); + } + else { + /* Orthographic projection. */ + cross_v3_v3v3(neasrest_precalc->ray_direction, py, px); + //normalize_v3(neasrest_precalc->ray_direction); + } + } #endif float win_half[2]; mul_v2_v2fl(win_half, winsize, 0.5f); -- cgit v1.2.3