diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-12 09:19:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-12 09:19:20 +0300 |
commit | 1813f00b94982727bf545cd4c49ec2d2fee86f7a (patch) | |
tree | 924c90d42cdf75530c45aff3e30f36a146436d37 /source/blender/blenlib | |
parent | be8add5d505b14fcdc5d2caf6dc4bb345f057a7c (diff) |
Fix missing fallback in recent aabb precalc func
Also comment unused vars
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 15 |
1 files changed, 13 insertions, 2 deletions
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); |