increase precision for coordinate conversions

This fixes the earthquakes while panning at high zoom levels.

Cherry-picked from 9607171612c4a40e41eddaff5230ad571571a5b9 on the perspective-improved-gestures branch.
This commit is contained in:
Ansis Brammanis
2015-08-26 11:14:08 -04:00
committed by Justin R. Miller
parent 7782802f37
commit b4b56c951e
5 changed files with 27 additions and 28 deletions

View File

@@ -46,7 +46,7 @@ void matrix::identity(mat4& out) {
}
bool matrix::invert(mat4& out, mat4& a) {
float a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
double a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],

View File

@@ -6,15 +6,15 @@
namespace mbgl {
struct TileCoordinate {
float column;
float row;
float zoom;
double column;
double row;
double zoom;
TileCoordinate(float column_, float row_, float zoom_) :
TileCoordinate(double column_, double row_, double zoom_) :
column(column_), row(row_), zoom(zoom_) {}
TileCoordinate zoomTo(float targetZoom) {
float scale = std::pow(2, targetZoom - zoom);
TileCoordinate zoomTo(double targetZoom) {
double scale = std::pow(2, targetZoom - zoom);
return { column * scale, row * scale, targetZoom };
}

View File

@@ -25,7 +25,7 @@
using namespace mbgl;
void matrix::transformMat4(vec4& out, vec4& a, mat4& m) {
float x = a[0], y = a[1], z = a[2], w = a[3];
double x = a[0], y = a[1], z = a[2], w = a[3];
out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;
out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;
out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;