summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/index_buffer.hpp
blob: 5d8630b902d3857b33ffa6ed77f1c52f8736bebb (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
41
42
#pragma once

#include <mbgl/gl/object.hpp>
#include <mbgl/gl/draw_mode.hpp>

namespace mbgl {
namespace gl {

class Line {
public:
    using DrawMode = Lines;

    Line(uint16_t a_, uint16_t b_)
        : a(a_), b(b_) {}

    uint16_t a;
    uint16_t b;
};

class Triangle {
public:
    using DrawMode = Triangles;

    Triangle(uint16_t a_, uint16_t b_, uint16_t c_)
        : a(a_), b(b_), c(c_) {}

    uint16_t a;
    uint16_t b;
    uint16_t c;
};

template <class Primitive>
class IndexBuffer {
public:
    static_assert(std::is_same<Primitive, Line>::value || std::is_same<Primitive, Triangle>::value,
                  "primitive must be Line or Triangle");
    static constexpr std::size_t primitiveSize = sizeof(Primitive);
    UniqueBuffer buffer;
};

} // namespace gl
} // namespace mbgl