diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-03-16 15:47:41 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-03-22 11:13:49 +0000 |
commit | bf356670158e95e4ba7fbeea774964e535bf6886 (patch) | |
tree | aa958d92645d947cad89db8aad79a55b1ca7c9c9 /src/location/maps/qgeocameratiles.cpp | |
parent | e405d931678510d9f6f92d27a7834cb683665a5d (diff) | |
download | qtlocation-bf356670158e95e4ba7fbeea774964e535bf6886.tar.gz |
Fix for projection mismatch when aspect ratio < 1.0
This patch fixes an incorrect computation of the projection matrices and
thus a mismatch in projections between mbgl vs the other plugins when
the window A/R is less than 1.0.
Task-number: QTBUG-59417
Change-Id: Ib03eaa4c877a00c9281c335f859c854d6db632c0
Reviewed-by: Bruno de Oliveira Abinader <brunoabinader@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/location/maps/qgeocameratiles.cpp')
-rw-r--r-- | src/location/maps/qgeocameratiles.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/location/maps/qgeocameratiles.cpp b/src/location/maps/qgeocameratiles.cpp index 75d4512e..327d54b3 100644 --- a/src/location/maps/qgeocameratiles.cpp +++ b/src/location/maps/qgeocameratiles.cpp @@ -297,7 +297,7 @@ Frustum QGeoCameraTilesPrivate::createFrustum(double viewExpansion) const apertureSize = tan(QLocationUtils::radians(m_camera.fieldOfView()) * 0.5); QDoubleVector3D center = m_sideLength * QWebMercator::coordToMercator(m_camera.center()); - double f = qMin(m_screenSize.width(), m_screenSize.height()); + double f = m_screenSize.height(); double z = std::pow(2.0, m_camera.zoomLevel() - m_intZoomLevel) * m_tileSize; // between 1 and 2 * m_tileSize @@ -339,19 +339,12 @@ Frustum QGeoCameraTilesPrivate::createFrustum(double viewExpansion) const // This used to fix the (half) field of view at 45 degrees // half because this assumed that viewSize = 2*nearPlane x 2*nearPlane viewExpansion *= apertureSize; - if (aspectRatio > 1.0) { - hhn = viewExpansion * nearPlane; - hwn = hhn * aspectRatio; - hhf = viewExpansion * farPlane; - hwf = hhf * aspectRatio; - } else { - hwn = viewExpansion * nearPlane; - hhn = hwn / aspectRatio; + hhn = viewExpansion * nearPlane; + hwn = hhn * aspectRatio; - hwf = viewExpansion * farPlane; - hhf = hwf / aspectRatio; - } + hhf = viewExpansion * farPlane; + hwf = hhf * aspectRatio; QDoubleVector3D d = center - eye; d.normalize(); |