[core] move Painter and dependents to new *TileID classes

This commit is contained in:
Konstantin Käfer
2016-03-08 17:18:57 +01:00
parent 5b640fb446
commit dde59eaf76
30 changed files with 138 additions and 670 deletions

View File

@@ -31,6 +31,9 @@
#include <mbgl/shader/box_shader.hpp>
#include <mbgl/shader/circle_shader.hpp>
#include <mbgl/algorithm/generate_clip_ids.hpp>
#include <mbgl/algorithm/generate_clip_ids_impl.hpp>
#include <mbgl/util/constants.hpp>
#if defined(DEBUG)
@@ -144,11 +147,12 @@ void Painter::render(const Style& style, const FrameData& frame_, SpriteAtlas& a
MBGL_DEBUG_GROUP("clip");
// Update all clipping IDs.
ClipIDGenerator generator;
algorithm::ClipIDGenerator generator;
for (const auto& source : sources) {
if (source->type == SourceType::Vector || source->type == SourceType::GeoJSON ||
source->type == SourceType::Annotations) {
generator.update(source->getLoadedTiles());
auto renderables = source->getRenderables();
generator.update(renderables);
}
source->updateMatrices(projMatrix, state);
}
@@ -251,7 +255,8 @@ void Painter::renderPass(RenderPass pass_,
if (item.bucket->needsClipping()) {
setClipping(item.tile->clip);
}
item.bucket->render(*this, layer, item.tile->id, item.tile->matrix);
const UnwrappedTileID tileID{ item.tile->id.sourceZ, item.tile->id.x, item.tile->id.y };
item.bucket->render(*this, layer, tileID, item.tile->matrix);
}
}
@@ -260,11 +265,13 @@ void Painter::renderPass(RenderPass pass_,
}
}
mat4 Painter::translatedMatrix(const mat4& matrix, const std::array<float, 2> &translation, const TileID &id, TranslateAnchorType anchor) {
mat4 Painter::translatedMatrix(const mat4& matrix,
const std::array<float, 2>& translation,
const UnwrappedTileID& id,
TranslateAnchorType anchor) {
if (translation[0] == 0 && translation[1] == 0) {
return matrix;
} else {
mat4 vtxMatrix;
if (anchor == TranslateAnchorType::Viewport) {
const double sin_a = std::sin(-state.getAngle());