Merge branch 'master' into outdoors-style

Conflicts:
	bin/style.js
	include/llmr/map/transform.hpp
	src/renderer/painter.cpp
	src/text/placement.cpp
This commit is contained in:
Konstantin Käfer
2014-05-14 17:42:10 +02:00
30 changed files with 176 additions and 169 deletions

View File

@@ -171,37 +171,29 @@ void Painter::renderTileLayer(const Tile& tile, const LayerDescription &layer_de
}
}
void Painter::translateLayer(const std::array<float, 2> &translation, const Tile::ID &id, bool reverse) {
if (translation[0] || translation[1]) {
const int direction = reverse ? -1 : 1;
// TODO: Get rid of the 8 (scaling from 4096 to tile size)
const double factor = direction * ((double)(1 << id.z)) / map.getState().getScale() * (4096.0 / util::tileSize);
matrix::translate(matrix, matrix, translation[0] * factor, translation[1] * factor, 0);
}
}
mat4 Painter::translatedMatrix(const std::array<float, 2> &translation, const Tile::ID &id, TranslateAnchor anchor) {
const mat4 &Painter::translatedMatrix(const std::array<float, 2> &translation, const Tile::ID &id, TranslateAnchor anchor) {
if (translation[0] == 0 && translation[1] == 0) {
return matrix;
} else {
// TODO: Get rid of the 8 (scaling from 4096 to tile size)
const double factor = ((double)(1 << id.z)) / map.getState().getScale() * (4096.0 / util::tileSize);
mat4 result;
if (anchor == TranslateAnchor::Viewport) {
const double sin_a = sin(-map.getState().getAngle());
const double cos_a = cos(-map.getState().getAngle());
matrix::translate(result, matrix,
const double sin_a = std::sin(-map.getState().getAngle());
const double cos_a = std::cos(-map.getState().getAngle());
matrix::translate(vtxMatrix, matrix,
factor * (translation[0] * cos_a - translation[1] * sin_a),
factor * (translation[0] * sin_a + translation[1] * cos_a),
0);
} else {
matrix::translate(result, matrix,
matrix::translate(vtxMatrix, matrix,
factor * translation[0],
factor * translation[1],
0);
}
return result;
return vtxMatrix;
}
}