summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/bucket.hpp
blob: 147895a099b851e14c3a7ad6c9cecf524e870986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef MBGL_RENDERER_BUCKET
#define MBGL_RENDERER_BUCKET

#include <mbgl/renderer/render_pass.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/mat4.hpp>

namespace mbgl {

class Painter;
class StyleLayer;
class TileID;

class Bucket : private util::noncopyable {
public:
    // As long as this bucket has a Prepare render pass, this function is getting called. Typically,
    // this only happens once when the bucket is being rendered for the first time.
    virtual void upload() = 0;

    // Every time this bucket is getting rendered, this function is called. This happens either
    // once or twice (for Opaque and Transparent render passes).
    virtual void render(Painter&, const StyleLayer&, const TileID&, const mat4&) = 0;

    virtual ~Bucket() {}

    inline bool needsUpload() const {
        return !uploaded;
    }

    virtual void placeFeatures() {}
    virtual void swapRenderData() {}

protected:
    bool uploaded = false;

};

}

#endif