summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-06-03 17:29:27 +0200
committerKonstantin Käfer <mail@kkaefer.com>2014-06-03 17:29:27 +0200
commit7a4a833f39730d9676458e4ca5ee595329649aed (patch)
treeefc0d9d1847ec9fc3339ca9943ca3c9f1b672322
parent851f56fc5969f7a25b45e59a0da36908476b4380 (diff)
downloadqtlocation-mapboxgl-7a4a833f39730d9676458e4ca5ee595329649aed.tar.gz
Revert "background grid"
This reverts commit 1dd3fdfba3aef7ce93b2e2e11e56b5967f3cef8e.
-rw-r--r--include/llmr/map/source.hpp1
-rw-r--r--src/map/source.cpp13
-rw-r--r--src/renderer/painter_clipping.cpp62
3 files changed, 10 insertions, 66 deletions
diff --git a/include/llmr/map/source.hpp b/include/llmr/map/source.hpp
index 4a506ecacb..7ce6aa632e 100644
--- a/include/llmr/map/source.hpp
+++ b/include/llmr/map/source.hpp
@@ -37,7 +37,6 @@ public:
bool update();
void updateMatrices(const TransformState &transform);
- bool viewportTileParsed();
void drawClippingMasks();
size_t getTileCount() const;
void render(const LayerDescription& layer_desc, const BucketDescription &bucket_desc);
diff --git a/src/map/source.cpp b/src/map/source.cpp
index e8a2fb4a7f..2491e083e6 100644
--- a/src/map/source.cpp
+++ b/src/map/source.cpp
@@ -57,19 +57,6 @@ size_t Source::getTileCount() const {
return tiles.size();
}
-bool Source::viewportTileParsed() {
- bool parsed = false;
-
- for (auto &pair : tiles) {
- Tile::ID id = pair.first;
- if (hasTile(id) == TileData::State::parsed) {
- parsed = true;
- }
- }
-
- return parsed;
-}
-
void Source::drawClippingMasks() {
for (std::pair<const Tile::ID, std::unique_ptr<Tile>> &pair : tiles) {
Tile &tile = *pair.second;
diff --git a/src/renderer/painter_clipping.cpp b/src/renderer/painter_clipping.cpp
index 5a28befb67..3a4a24b11d 100644
--- a/src/renderer/painter_clipping.cpp
+++ b/src/renderer/painter_clipping.cpp
@@ -9,64 +9,22 @@ using namespace llmr;
void Painter::drawClippingMasks(const Sources &sources) {
gl::group group("clipping masks");
+ useProgram(plainShader->program);
glDisable(GL_DEPTH_TEST);
depthMask(false);
glDepthRange(1.0f, 1.0f);
glStencilMask(0xFF);
- bool ready = false;
+ const BackgroundProperties &properties = map.getStyle()->computed.background;
+ Color background = properties.color;
+ const float opacity = properties.opacity;
+ background[0] *= opacity;
+ background[1] *= opacity;
+ background[2] *= opacity;
+ background[3] *= opacity;
+ plainShader->setColor(background);
- for (const auto &pair : sources) {
- Source &source = *pair.second;
- if (source.viewportTileParsed()) {
- ready = true;
- }
- }
-
- if (ready) {
- // At least one viewport tile is parsed. Draw the background.
- useProgram(plainShader->program);
-
- const BackgroundProperties &properties = map.getStyle()->computed.background;
- Color background = properties.color;
- const float opacity = properties.opacity;
- background[0] *= opacity;
- background[1] *= opacity;
- background[2] *= opacity;
- background[3] *= opacity;
- plainShader->setColor(background);
-
- coveringPlainArray.bind(*plainShader, tileStencilBuffer, BUFFER_OFFSET(0));
- } else {
- // No viewport tiles are parsed. Draw the grid pattern.
- const std::shared_ptr<Sprite> &sprite = map.getStyle()->sprite;
- if (sprite) {
- SpriteAtlas &spriteAtlas = *map.getSpriteAtlas();
- Rect<uint16_t> imagePos = spriteAtlas.getImage("matte-256", *sprite);
-
- std::array<float, 2> imageSize = {{
- (float)(imagePos.w * 0.5),
- (float)(imagePos.h * 0.5)
- }
- };
-
- useProgram(patternShader->program);
- patternShader->setPatternSize(imageSize);
- patternShader->setPatternTopLeft({{
- float(imagePos.x) / spriteAtlas.getWidth(),
- float(imagePos.y) / spriteAtlas.getHeight(),
- }});
- patternShader->setPatternBottomRight({{
- float(imagePos.x + imagePos.w) / spriteAtlas.getWidth(),
- float(imagePos.y + imagePos.h) / spriteAtlas.getHeight(),
- }});
- std::array<float, 4> color = {{ 1, 1, 1, 1 }};
- patternShader->setColor(color);
- spriteAtlas.bind(true);
-
- coveringPatternArray.bind(*patternShader, tileStencilBuffer, BUFFER_OFFSET(0));
- }
- }
+ coveringPlainArray.bind(*plainShader, tileStencilBuffer, BUFFER_OFFSET(0));
for (const auto &pair : sources) {
Source &source = *pair.second;