summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2014-10-21 15:00:44 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2014-10-29 09:58:56 -0400
commitda8aa391d0a1079bbc697207803a48fce8ab916f (patch)
tree4fbf6a2dcc594860aa43517e6d78c542c7eff115 /include
parent4f7bc80664c29d7f15598392946ff0ac73dd520c (diff)
downloadqtlocation-mapboxgl-da8aa391d0a1079bbc697207803a48fce8ab916f.tar.gz
Render map with a copy of TransformState
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/map/map.hpp8
-rw-r--r--include/mbgl/map/transform_state.hpp3
-rw-r--r--include/mbgl/renderer/painter.hpp20
3 files changed, 19 insertions, 12 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index bc67e5b35b..8378b27376 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -55,8 +55,6 @@ public:
// Triggers a lazy rerender: only performs a render when the map is not clean.
void rerender();
- void renderLayer(util::ptr<StyleLayer> layer_desc, RenderPass pass, const Tile::ID* id = nullptr, const mat4* matrix = nullptr);
-
// Forces a map update: always triggers a rerender.
void update();
@@ -156,18 +154,14 @@ private:
void updateSources();
void updateSources(const util::ptr<StyleLayerGroup> &group);
- void updateRenderState();
-
size_t countLayers(const std::vector<LayerDescription>& layers);
// Prepares a map render by updating the tiles we need for the current view, as well as updating
// the stylesheet.
void prepare();
-
// Unconditionally performs a render with the current map state.
void render();
- void renderLayers(util::ptr<StyleLayerGroup> group);
private:
bool async = false;
@@ -224,8 +218,6 @@ private:
bool debug = false;
timestamp animationTime = 0;
- int indent = 0;
-
std::set<util::ptr<StyleSource>> activeSources;
};
diff --git a/include/mbgl/map/transform_state.hpp b/include/mbgl/map/transform_state.hpp
index ed49dc3e99..bb330c1019 100644
--- a/include/mbgl/map/transform_state.hpp
+++ b/include/mbgl/map/transform_state.hpp
@@ -33,6 +33,7 @@ public:
float lngX(float lon) const;
float latY(float lat) const;
std::array<float, 2> locationCoordinate(float lon, float lat) const;
+ void getLonLat(double &lon, double &lat) const;
// Zoom
float getNormalizedZoom() const;
@@ -69,7 +70,7 @@ private:
// map position
double x = 0, y = 0;
double angle = 0;
- double scale = std::numeric_limits<double>::infinity();
+ double scale = 1;
};
}
diff --git a/include/mbgl/renderer/painter.hpp b/include/mbgl/renderer/painter.hpp
index a8229a0978..2b0ac070f7 100644
--- a/include/mbgl/renderer/painter.hpp
+++ b/include/mbgl/renderer/painter.hpp
@@ -35,9 +35,12 @@ enum class RenderPass : bool { Opaque, Translucent };
class Transform;
class Style;
class Tile;
+class Sprite;
+class SpriteAtlas;
class GlyphAtlas;
class Source;
class StyleSource;
+class StyleLayerGroup;
class FillBucket;
class LineBucket;
@@ -53,10 +56,9 @@ class RasterTileData;
class Painter : private util::noncopyable {
public:
- Painter(Map &map);
+ Painter(SpriteAtlas&, GlyphAtlas&);
~Painter();
-
void setup();
// Perform cleanup tasks that prepare shutting down the app. This doesn't mean that the
@@ -73,6 +75,14 @@ public:
// Updates the default matrices to the current viewport dimensions.
void changeMatrix();
+ void render(const Style& style,
+ const std::set<util::ptr<StyleSource>>& sources,
+ TransformState state,
+ timestamp time);
+
+ void renderLayers(util::ptr<StyleLayerGroup> group);
+ void renderLayer(util::ptr<StyleLayer> layer_desc, RenderPass pass, const Tile::ID* id = nullptr, const mat4* matrix = nullptr);
+
// Renders a particular layer from a tile.
void renderTileLayer(const Tile& tile, util::ptr<StyleLayer> layer_desc, const mat4 &matrix);
@@ -167,9 +177,10 @@ public:
}();
private:
- Map& map;
+ TransformState state;
bool debug = false;
+ int indent = 0;
uint32_t gl_program = 0;
float gl_lineWidth = 0;
@@ -183,6 +194,9 @@ private:
public:
FrameHistory frameHistory;
+ SpriteAtlas& spriteAtlas;
+ GlyphAtlas& glyphAtlas;
+
std::unique_ptr<PlainShader> plainShader;
std::unique_ptr<OutlineShader> outlineShader;
std::unique_ptr<LineShader> lineShader;