From 53a6992728ec2f200b67123dd212b16e5e341a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 21 May 2014 18:34:41 +0200 Subject: fix alpha blending + add depth/stencil buffers --- include/llmr/map/map.hpp | 16 +++++----------- include/llmr/map/source.hpp | 4 +++- include/llmr/renderer/painter.hpp | 26 +++++++++++++++++++++----- 3 files changed, 29 insertions(+), 17 deletions(-) (limited to 'include') 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> 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& layers); @@ -123,11 +126,6 @@ private: void renderLayers(const std::vector& 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> sources; + Sources sources; bool debug = false; time animationTime = 0; int indent = 0; - std::vector fbos; - std::vector 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 +#include + 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> 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 fbos; + std::vector fbos_color; + GLuint fbo_depth_stencil; + int fbo_level = -1; + bool fbo_depth_stencil_valid = false; + }; } -- cgit v1.2.1