From 1dab468e20724a9705c94267d8e57d486c49e63c Mon Sep 17 00:00:00 2001 From: Mario Luzeiro Date: Mon, 13 May 2019 23:14:15 +0200 Subject: [PATCH] Add some epsilon value to ray dir on orthographic mode so they will not be zero when viewing the board com the top/bot. This was causing problems with BBox intersect function that was using invDir values. Fixes lp:1828747 https://bugs.launchpad.net/kicad/+bug/1828747 --- 3d-viewer/3d_rendering/ccamera.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/3d-viewer/3d_rendering/ccamera.cpp b/3d-viewer/3d_rendering/ccamera.cpp index ae442ae505..e18faea6c9 100644 --- a/3d-viewer/3d_rendering/ccamera.cpp +++ b/3d-viewer/3d_rendering/ccamera.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015-2016 Mario Luzeiro - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -310,7 +310,7 @@ void CCAMERA::MakeRay( const SFVEC2I &aWindowPos, case PROJECTION_ORTHO: aOutOrigin = up_plus_right * 0.5f + m_frustum.nc; - aOutDirection = -m_dir; + aOutDirection = -m_dir + SFVEC3F( FLT_EPSILON ); break; } } @@ -341,7 +341,7 @@ void CCAMERA::MakeRay( const SFVEC2F &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F & case PROJECTION_ORTHO: aOutOrigin = up_plus_right * 0.5f + m_frustum.nc; - aOutDirection = -m_dir; + aOutDirection = -m_dir + SFVEC3F( FLT_EPSILON ); break; } }