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

#include <mbgl/gl/object.hpp>

namespace mbgl {
namespace gl {

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

    uint16_t a;
    uint16_t b;

    static constexpr std::size_t IndexCount = 2;
};

class Triangle {
public:
    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;

    static constexpr std::size_t IndexCount = 3;
};

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