diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-05-21 18:34:41 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-05-21 18:34:41 +0200 |
commit | 53a6992728ec2f200b67123dd212b16e5e341a80 (patch) | |
tree | bb8e9571318f2a76fb9cddd91f12d125121eed3e /include | |
parent | 16a79b42ca6c9aa6d631d4e2226aa5f9798d5955 (diff) | |
download | qtlocation-mapboxgl-53a6992728ec2f200b67123dd212b16e5e341a80.tar.gz |
fix alpha blending + add depth/stencil buffers
Diffstat (limited to 'include')
-rw-r--r-- | include/llmr/map/map.hpp | 16 | ||||
-rw-r--r-- | include/llmr/map/source.hpp | 4 | ||||
-rw-r--r-- | include/llmr/renderer/painter.hpp | 26 |
3 files changed, 29 insertions, 17 deletions
diff --git a/include/llmr/map/map.hpp b/include/llmr/map/map.hpp index 3f294cf8c1..8dc1e0f71f 100644 --- a/include/llmr/map/map.hpp +++ b/include/llmr/map/map.hpp @@ -22,6 +22,8 @@ namespace llmr { class Source; +typedef std::map<std::string, const std::unique_ptr<Source>> Sources; + class Map : private util::noncopyable { public: explicit Map(View &view); @@ -96,6 +98,7 @@ public: inline uv_loop_t *getLoop() { return loop; } inline time getAnimationTime() const { return animationTime; } inline Texturepool &getTexturepool() { return texturepool; } + inline const Sources &getSources() { return sources; } private: // uv async callbacks @@ -108,7 +111,7 @@ private: void loadStyle(const uint8_t *const data, uint32_t bytes); void updateTiles(); - void updateClippingIDs(); + void updateRenderState(); size_t countLayers(const std::vector<LayerDescription>& layers); @@ -123,11 +126,6 @@ private: void renderLayers(const std::vector<LayerDescription>& layers); void renderLayer(const LayerDescription& layer_desc, RenderPass pass); - void clearFramebuffers(); - void bindFramebuffer(); - void pushFramebuffer(); - GLuint popFramebuffer(); - private: // If cleared, the next time the render thread attempts to render the map, it will *actually* // render the map. @@ -152,17 +150,13 @@ private: SpriteAtlas spriteAtlas; Painter painter; - std::map<std::string, const std::unique_ptr<Source>> sources; + Sources sources; bool debug = false; time animationTime = 0; int indent = 0; - std::vector<GLuint> fbos; - std::vector<GLuint> fbos_color; - int fbo_level = -1; - private: bool async = false; uv_loop_t *loop = nullptr; diff --git a/include/llmr/map/source.hpp b/include/llmr/map/source.hpp index 40b3bf4cff..7ce6aa632e 100644 --- a/include/llmr/map/source.hpp +++ b/include/llmr/map/source.hpp @@ -36,7 +36,9 @@ public: bool update(); - size_t prepareRender(const TransformState &transform); + void updateMatrices(const TransformState &transform); + void drawClippingMasks(); + size_t getTileCount() const; void render(const LayerDescription& layer_desc, const BucketDescription &bucket_desc); void finishRender(); diff --git a/include/llmr/renderer/painter.hpp b/include/llmr/renderer/painter.hpp index 1adc32be19..585958648c 100644 --- a/include/llmr/renderer/painter.hpp +++ b/include/llmr/renderer/painter.hpp @@ -22,12 +22,15 @@ #include <llmr/map/transform_state.hpp> +#include <map> + namespace llmr { class Transform; class Style; class Tile; class GlyphAtlas; +class Source; class FillBucket; class LineBucket; @@ -38,9 +41,12 @@ class RasterBucket; class LayerDescription; class RasterTileData; +typedef std::map<std::string, const std::unique_ptr<Source>> Sources; + class Painter : private util::noncopyable { public: Painter(Map &map); + ~Painter(); void setup(); @@ -76,17 +82,20 @@ public: void setDebug(bool enabled); // Opaque/Translucent pass setting - void startOpaquePass(); - void startTranslucentPass(); - void endPass(); + void setOpaque(); + void setTranslucent(); // Configures the painter strata that is used for early z-culling of fragments. void setStrata(float strata); - void prepareClippingMask(); + void drawClippingMasks(const Sources &sources); void drawClippingMask(const mat4& matrix, const ClipID& clip); - void finishClippingMask(); + void clearFramebuffers(); + void resetFramebuffer(); + void bindFramebuffer(); + void pushFramebuffer(); + GLuint popFramebuffer(); void drawComposite(GLuint texture, const CompositeProperties &properties); bool needsAnimation() const; @@ -163,6 +172,13 @@ private: VertexArrayObject tileBorderArray; + // Framebuffer management + std::vector<GLuint> fbos; + std::vector<GLuint> fbos_color; + GLuint fbo_depth_stencil; + int fbo_level = -1; + bool fbo_depth_stencil_valid = false; + }; } |