From 4ea281c750c5afcc68f2832bb42d98a1cbce6735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 16 Jul 2014 18:53:56 -0700 Subject: rename llmr => mbgl --- include/mbgl/renderer/fill_bucket.hpp | 88 +++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 include/mbgl/renderer/fill_bucket.hpp (limited to 'include/mbgl/renderer/fill_bucket.hpp') diff --git a/include/mbgl/renderer/fill_bucket.hpp b/include/mbgl/renderer/fill_bucket.hpp new file mode 100644 index 0000000000..9193b09149 --- /dev/null +++ b/include/mbgl/renderer/fill_bucket.hpp @@ -0,0 +1,88 @@ +#ifndef MBGL_RENDERER_FILLBUCKET +#define MBGL_RENDERER_FILLBUCKET + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#ifndef BUFFER_OFFSET +#define BUFFER_OFFSET(i) ((char *)nullptr + (i)) +#endif + +namespace mbgl { + +class Style; +class FillVertexBuffer; +class TriangleElementsBuffer; +class LineElementsBuffer; +class BucketDescription; +class OutlineShader; +class PlainShader; +class PatternShader; +struct pbf; + +class FillBucket : public Bucket { + + static void *alloc(void *data, unsigned int size); + static void *realloc(void *data, void *ptr, unsigned int size); + static void free(void *userData, void *ptr); + + + typedef ElementGroup triangle_group_type; + typedef ElementGroup line_group_type; +public: + FillBucket(FillVertexBuffer& vertexBuffer, + TriangleElementsBuffer& triangleElementsBuffer, + LineElementsBuffer& lineElementsBuffer, + const StyleBucketFill& properties); + ~FillBucket(); + + virtual void render(Painter& painter, std::shared_ptr layer_desc, const Tile::ID& id); + virtual bool hasData() const; + + void addGeometry(pbf& data); + void tessellate(); + + void drawElements(PlainShader& shader); + void drawElements(PatternShader& shader); + void drawVertices(OutlineShader& shader); + +public: + const StyleBucketFill &properties; + +private: + TESSalloc *allocator; + TESStesselator *tesselator; + ClipperLib::Clipper clipper; + + FillVertexBuffer& vertexBuffer; + TriangleElementsBuffer& triangleElementsBuffer; + LineElementsBuffer& lineElementsBuffer; + + // hold information on where the vertices are located in the FillBuffer + const size_t vertex_start; + const size_t triangle_elements_start; + const size_t line_elements_start; + VertexArrayObject array; + + std::vector triangleGroups; + std::vector lineGroups; + + std::vector line; + bool hasVertices = false; + + static const int vertexSize = 2; + static const int stride = sizeof(TESSreal) * vertexSize; + static const int vertices_per_group = 3; +}; + +} + +#endif -- cgit v1.2.1