blob: 9255337cb5c84408c13ceb66473f9ca16059b780 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#ifndef MBGL_GEOMETRY_TRIANGLE_ELEMENTS_BUFFER
#define MBGL_GEOMETRY_TRIANGLE_ELEMENTS_BUFFER
#include <mbgl/geometry/buffer.hpp>
#include <mbgl/geometry/vao.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <array>
namespace mbgl {
template <int count>
struct ElementGroup : public util::noncopyable {
std::array<VertexArrayObject, count> array;
uint32_t vertex_length;
uint32_t elements_length;
ElementGroup() : vertex_length(0), elements_length(0) {}
ElementGroup(uint32_t vertex_length_, uint32_t elements_length_)
: vertex_length(vertex_length_),
elements_length(elements_length_) {
}
ElementGroup(ElementGroup &&rhs) noexcept
: array(std::move(rhs.array)),
vertex_length(rhs.vertex_length),
elements_length(rhs.elements_length) {};
};
class TriangleElementsBuffer : public Buffer<
6, // bytes per triangle (3 * unsigned short == 6 bytes)
GL_ELEMENT_ARRAY_BUFFER
> {
public:
typedef uint16_t element_type;
void add(element_type a, element_type b, element_type c);
};
class LineElementsBuffer : public Buffer<
4, // bytes per triangle (2 * unsigned short == 6 bytes)
GL_ELEMENT_ARRAY_BUFFER
> {
public:
typedef uint16_t element_type;
void add(element_type a, element_type b);
};
class PointElementsBuffer : public Buffer<
2, // bytes per point (1 unsigned short)
GL_ELEMENT_ARRAY_BUFFER
> {
public:
typedef uint16_t element_type;
void add(element_type a);
};
}
#endif
|