summaryrefslogtreecommitdiff
path: root/test/map
diff options
context:
space:
mode:
authorAleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com>2019-07-23 17:19:52 +0300
committerAleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com>2019-08-01 09:28:36 +0300
commit73d9f26d03810854c36a96b252885353f8ba81ce (patch)
treef7ed24fc8677192075fda78724c1a1a83da86acd /test/map
parent375c3131afcdcedb5a2dfbb19eec29625c44494d (diff)
downloadqtlocation-mapboxgl-73d9f26d03810854c36a96b252885353f8ba81ce.tar.gz
[core] Limit pitch based on edge insets. Fix max Z calculation in getProjMatrix.
Patch partly fixes #15163 in a way that it doesn't allow loading tens of thousands of tiles and attempt to show area above horizon: Limit pitch based on edge insets. It is not too bad - current limit of 60 degrees stays active until center of perspective is moved towards the bottom, to 84% of screen height. The plan is to split removal of 60 degrees limit to follow up patch. Fix max Z calculation in getProjMatrix. TransformState::getProjMatrix calculation of farZ was complex with possibility to lead to negative z values. Replacing it with simpler, precise calculation: furthestDistance = cameraToCenterDistance / (1 - tanFovAboveCenter * std::tan(getPitch())); TransformState::getProjMatrix calculation of farZ was an aproximation. Replacing it with simpler, but precise calculation. Related to: #15163
Diffstat (limited to 'test/map')
-rw-r--r--test/map/transform.test.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp
index 3d37312b17..84fdb06b21 100644
--- a/test/map/transform.test.cpp
+++ b/test/map/transform.test.cpp
@@ -9,6 +9,7 @@ using namespace mbgl;
TEST(Transform, InvalidZoom) {
Transform transform;
+ transform.resize({1, 1});
ASSERT_DOUBLE_EQ(0, transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(0, transform.getLatLng().longitude());
@@ -56,6 +57,7 @@ TEST(Transform, InvalidZoom) {
TEST(Transform, InvalidBearing) {
Transform transform;
+ transform.resize({1, 1});
ASSERT_DOUBLE_EQ(0, transform.getLatLng().latitude());
ASSERT_DOUBLE_EQ(0, transform.getLatLng().longitude());
@@ -78,6 +80,7 @@ TEST(Transform, InvalidBearing) {
TEST(Transform, IntegerZoom) {
Transform transform;
+ transform.resize({1, 1});
auto checkIntegerZoom = [&transform](uint8_t zoomInt, double zoom) {
transform.jumpTo(CameraOptions().withZoom(zoom));