summaryrefslogtreecommitdiff
path: root/src/mbgl/util/constants.cpp
diff options
context:
space:
mode:
authorAnsis Brammanis <brammanis@gmail.com>2016-01-28 21:41:20 -0800
committerAnsis Brammanis <brammanis@gmail.com>2016-02-02 14:49:03 -0800
commit4e0d1070f623811513e6800e4ac906d69958d66a (patch)
treefa10d0d169a26f680cd6dd2ead69e42bd541ce85 /src/mbgl/util/constants.cpp
parentf1f53c36d0d392f83cf99859d993d70676048bdf (diff)
downloadqtlocation-mapboxgl-4e0d1070f623811513e6800e4ac906d69958d66a.tar.gz
[core] support tiles with non-4096 extents
Convert all geometries to the maximum extent supported by our buffers and then use that constant extent everywhere else.
Diffstat (limited to 'src/mbgl/util/constants.cpp')
-rw-r--r--src/mbgl/util/constants.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mbgl/util/constants.cpp b/src/mbgl/util/constants.cpp
index 9a5282d5e0..1921e29610 100644
--- a/src/mbgl/util/constants.cpp
+++ b/src/mbgl/util/constants.cpp
@@ -2,6 +2,18 @@
const float mbgl::util::tileSize = 512.0f;
+/*
+ * The maximum extent of a feature that can be safely stored in the buffer.
+ * In practice, all features are converted to this extent before being added.
+ *
+ * Positions are stored as signed 16bit integers.
+ * One bit is lost for signedness to support featuers extending past the left edge of the tile.
+ * One bit is lost because the line vertex buffer packs 1 bit of other data into the int.
+ * One bit is lost to support features extending past the extent on the right edge of the tile.
+ * This leaves us with 2^13 = 8192
+ */
+const int32_t mbgl::util::EXTENT = 8192;
+
const double mbgl::util::DEG2RAD = M_PI / 180.0;
const double mbgl::util::RAD2DEG = 180.0 / M_PI;
const double mbgl::util::M2PI = 2 * M_PI;