summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer
diff options
context:
space:
mode:
authorMikko Pulkki <mikko.pulkki@mapbox.com>2020-03-23 18:21:13 +0200
committerMikko Pulkki <55925868+mpulkki-mapbox@users.noreply.github.com>2020-04-06 12:10:21 +0300
commitd0c103fa8f0bade2be56d50a745f16b4e9ed6b29 (patch)
treee41956f80cfd63d7ab4e154c9785b39e7e6c99d4 /src/mbgl/renderer
parent69dc210598ff8319de53bb603438ba89d47d6229 (diff)
downloadqtlocation-mapboxgl-d0c103fa8f0bade2be56d50a745f16b4e9ed6b29.tar.gz
Refactor tileCover to support lod tiles
Diffstat (limited to 'src/mbgl/renderer')
-rw-r--r--src/mbgl/renderer/layers/render_background_layer.cpp7
-rw-r--r--src/mbgl/renderer/tile_pyramid.cpp17
2 files changed, 9 insertions, 15 deletions
diff --git a/src/mbgl/renderer/layers/render_background_layer.cpp b/src/mbgl/renderer/layers/render_background_layer.cpp
index 3e12b74db9..c791a394a1 100644
--- a/src/mbgl/renderer/layers/render_background_layer.cpp
+++ b/src/mbgl/renderer/layers/render_background_layer.cpp
@@ -116,14 +116,15 @@ void RenderBackgroundLayer::render(PaintParameters& parameters) {
uint32_t i = 0;
for (const auto& tileID : util::tileCover(parameters.state, parameters.state.getIntegerZoom())) {
+ const UnwrappedTileID unwrappedTileID = tileID.toUnwrapped();
draw(parameters.programs.getBackgroundLayerPrograms().backgroundPattern,
- BackgroundPatternProgram::layoutUniformValues(parameters.matrixForTile(tileID),
+ BackgroundPatternProgram::layoutUniformValues(parameters.matrixForTile(unwrappedTileID),
evaluated.get<BackgroundOpacity>(),
parameters.patternAtlas.getPixelSize(),
*imagePosA,
*imagePosB,
crossfade,
- tileID,
+ unwrappedTileID,
parameters.state),
BackgroundPatternProgram::TextureBindings{
textures::image::Value{parameters.patternAtlas.textureBinding()},
@@ -141,7 +142,7 @@ void RenderBackgroundLayer::render(PaintParameters& parameters) {
for (const auto& tileID : util::tileCover(parameters.state, parameters.state.getIntegerZoom())) {
draw(parameters.programs.getBackgroundLayerPrograms().background,
BackgroundProgram::LayoutUniformValues{
- uniforms::matrix::Value(parameters.matrixForTile(tileID)),
+ uniforms::matrix::Value(parameters.matrixForTile(tileID.toUnwrapped())),
uniforms::color::Value(evaluated.get<BackgroundColor>()),
uniforms::opacity::Value(evaluated.get<BackgroundOpacity>()),
},
diff --git a/src/mbgl/renderer/tile_pyramid.cpp b/src/mbgl/renderer/tile_pyramid.cpp
index c456bf6e24..57086cb915 100644
--- a/src/mbgl/renderer/tile_pyramid.cpp
+++ b/src/mbgl/renderer/tile_pyramid.cpp
@@ -91,8 +91,8 @@ void TilePyramid::update(const std::vector<Immutable<style::LayerProperties>>& l
int32_t tileZoom = overscaledZoom;
int32_t panZoom = zoomRange.max;
- std::vector<UnwrappedTileID> idealTiles;
- std::vector<UnwrappedTileID> panTiles;
+ std::vector<OverscaledTileID> idealTiles;
+ std::vector<OverscaledTileID> panTiles;
if (overscaledZoom >= zoomRange.min) {
int32_t idealZoom = std::min<int32_t>(zoomRange.max, overscaledZoom);
@@ -118,7 +118,7 @@ void TilePyramid::update(const std::vector<Immutable<style::LayerProperties>>& l
}
}
- idealTiles = util::tileCover(parameters.transformState, idealZoom);
+ idealTiles = util::tileCover(parameters.transformState, idealZoom, tileZoom);
}
// Stores a list of all the tiles that we're definitely going to retain. There are two
@@ -185,18 +185,11 @@ void TilePyramid::update(const std::vector<Immutable<style::LayerProperties>>& l
[](const UnwrappedTileID&, Tile&) {},
panTiles,
zoomRange,
- panZoom,
maxParentTileOverscaleFactor);
}
- algorithm::updateRenderables(getTileFn,
- createTileFn,
- retainTileFn,
- renderTileFn,
- idealTiles,
- zoomRange,
- tileZoom,
- maxParentTileOverscaleFactor);
+ algorithm::updateRenderables(
+ getTileFn, createTileFn, retainTileFn, renderTileFn, idealTiles, zoomRange, maxParentTileOverscaleFactor);
for (auto previouslyRenderedTile : previouslyRenderedTiles) {
Tile& tile = previouslyRenderedTile.second;