1 #pragma once
2 
3 #include <mbgl/tile/tile_id.hpp>
4 #include <mbgl/util/mat4.hpp>
5 #include <mbgl/util/clip_id.hpp>
6 #include <mbgl/style/types.hpp>
7 #include <mbgl/renderer/tile_mask.hpp>
8 
9 #include <array>
10 
11 namespace mbgl {
12 
13 class Tile;
14 class TransformState;
15 class PaintParameters;
16 
17 class RenderTile final {
18 public:
RenderTile(UnwrappedTileID id_,Tile & tile_)19     RenderTile(UnwrappedTileID id_, Tile& tile_) : id(std::move(id_)), tile(tile_) {}
20     RenderTile(const RenderTile&) = delete;
21     RenderTile(RenderTile&&) = default;
22     RenderTile& operator=(const RenderTile&) = delete;
23     RenderTile& operator=(RenderTile&&) = default;
24 
25     UnwrappedTileID id;
26     Tile& tile;
27     ClipID clip;
28     mat4 matrix;
29     mat4 nearClippedMatrix;
30     bool used = false;
31     bool needsClipping = false;
32 
33     mat4 translatedMatrix(const std::array<float, 2>& translate,
34                           style::TranslateAnchorType anchor,
35                           const TransformState&) const;
36 
37     mat4 translatedClipMatrix(const std::array<float, 2>& translate,
38                               style::TranslateAnchorType anchor,
39                               const TransformState&) const;
40 
41     void setMask(TileMask&&);
42     void startRender(PaintParameters&);
43     void finishRender(PaintParameters&);
44 
45     mat4 translateVtxMatrix(const mat4& tileMatrix,
46                             const std::array<float, 2>& translation,
47                             style::TranslateAnchorType anchor,
48                             const TransformState& state,
49                             const bool inViewportPixelUnits) const;
50 };
51 
52 } // namespace mbgl
53