make text layers respect the translate-anchor

you can now specify "translate-anchor": "viewport" to have the text translated
in screen coordinates rather than relative to the tile. The default value
remains "translate-anchor": "map"

refs #189
This commit is contained in:
Konstantin Käfer
2014-05-13 19:02:22 +02:00
parent 2135f855d1
commit c8a3b916b3
3 changed files with 33 additions and 7 deletions

View File

@@ -7,6 +7,7 @@
#include <llmr/util/mat4.hpp>
#include <llmr/util/noncopyable.hpp>
#include <llmr/renderer/frame_history.hpp>
#include <llmr/style/properties.hpp>
#include <llmr/shader/plain_shader.hpp>
#include <llmr/shader/outline_shader.hpp>
@@ -88,7 +89,8 @@ public:
bool needsAnimation() const;
private:
void setupShaders();
void translateLayer(std::array<float, 2> translation, const Tile::ID &id, bool reverse = false);
void translateLayer(const std::array<float, 2> &translation, const Tile::ID &id, bool reverse = false);
mat4 translatedMatrix(const std::array<float, 2> &translation, const Tile::ID &id, TranslateAnchor anchor = TranslateAnchor::Map);
void prepareTile(const Tile& tile);
void useProgram(uint32_t program);