summaryrefslogtreecommitdiff
path: root/src/mbgl/shader/raster_vertex.hpp
blob: 889405d6cd63976f7b8abf528ffb51c4c7be4df0 (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
#pragma once

#include <mbgl/gl/attribute.hpp>

#include <vector>
#include <cstdint>

namespace mbgl {

class RasterVertex {
public:
    RasterVertex(int16_t x, int16_t y, uint16_t tx, uint16_t ty)
        : a_pos {
              x,
              y
          },
          a_texture_pos {
              tx,
              ty
          } {}

    const int16_t a_pos[2];
    const uint16_t a_texture_pos[2];
};

namespace gl {

template <class Shader>
struct AttributeBindings<Shader, RasterVertex> {
    std::vector<AttributeBinding> operator()(const Shader& shader) {
        return {{
            MBGL_MAKE_ATTRIBUTE_BINDING(RasterVertex, shader, a_pos),
            MBGL_MAKE_ATTRIBUTE_BINDING(RasterVertex, shader, a_texture_pos)
        }};
    };
};

} // namespace gl
} // namespace mbgl