From 74e5ac5cb9a8a5ba0b0aa9d84dfb17d410610373 Mon Sep 17 00:00:00 2001 From: Daria Volvenkova Date: Mon, 20 Jun 2016 20:04:01 +0300 Subject: [PATCH] GUI rendering fixed in perspective mode. --- drape_frontend/frontend_renderer.cpp | 2 -- geometry/screenbase.cpp | 21 ++++++++------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index 7260363d4e..565b4d4505 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -827,8 +827,6 @@ void FrontendRenderer::OnResize(ScreenBase const & screen) RefreshProjection(screen); RefreshPivotTransform(screen); - - } void FrontendRenderer::AddToRenderGroup(dp::GLState const & state, diff --git a/geometry/screenbase.cpp b/geometry/screenbase.cpp index fb462fe11c..01e55db869 100644 --- a/geometry/screenbase.cpp +++ b/geometry/screenbase.cpp @@ -378,17 +378,17 @@ void ScreenBase::ApplyPerspective(double currentRotationAngle, double maxRotatio ASSERT_GREATER_OR_EQUAL(maxRotationAngle, 0.0, ()); ASSERT_LESS(maxRotationAngle, math::pi2, ()); -// if (m_isPerspective) -// ResetPerspective(); - m_isPerspective = true; + m_isAutoPerspective = false; m_3dMaxAngleX = maxRotationAngle; + m_3dAngleX = currentRotationAngle; m_3dFOV = angleFOV; double const old_dy = m_ViewportRect.SizeY() * (m_3dScale - 1.0); + m_3dScale = CalculateScale3d(m_3dMaxAngleX); - double const new_dy = m_ViewportRect.SizeY() * (CalculateScale3d(m_3dMaxAngleX) - 1.0); + double const new_dy = m_ViewportRect.SizeY() * (m_3dScale - 1.0); SetRotationAngle(currentRotationAngle); @@ -444,18 +444,13 @@ void ScreenBase::SetRotationAngle(double rotationAngle) void ScreenBase::ResetPerspective() { m_isPerspective = false; + m_isAutoPerspective = false; - double const dy = m_PixelRect.SizeY() * (1.0 - 1.0 / m_3dScale); - - m_PixelRect.setMaxX(m_PixelRect.maxX() / m_3dScale); - m_PixelRect.setMaxY(m_PixelRect.maxY() / m_3dScale); - - Move(0, -dy / 2.0); - - m_3dScale = 1.0; m_3dAngleX = 0.0; m_3dMaxAngleX = 0.0; - m_3dFOV = 0.0; + + double const old_dy = m_ViewportRect.SizeY() * (m_3dScale - 1.0); + Move(0.0, -old_dy / 2.0); } m2::PointD ScreenBase::PtoP3d(m2::PointD const & pt) const