blob: aedf93d0d3bdea4ad33335e0dc819259314c1675 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#pragma once
#include <mbgl/gfx/types.hpp>
#include <cassert>
namespace mbgl {
namespace gfx {
class DrawMode {
protected:
DrawMode(DrawModeType type_, float value_)
: type(type_), value(value_) {
}
public:
const DrawModeType type;
const float value;
};
class Points : public DrawMode {
public:
explicit Points(float pointSize_) : DrawMode(DrawModeType::Points, pointSize_), pointSize(pointSize_) {
assert(size > 0);
}
static constexpr PrimitiveType primitive = PrimitiveType::Point;
static constexpr std::size_t bufferGroupSize = 1;
float pointSize;
};
class Lines : public DrawMode {
public:
explicit Lines(float lineWidth_) : DrawMode(DrawModeType::Lines, lineWidth_), lineWidth(lineWidth_) {
assert(size > 0);
}
static constexpr PrimitiveType primitive = PrimitiveType::Line;
static constexpr std::size_t bufferGroupSize = 2;
float lineWidth;
};
class LineStrip : public DrawMode {
public:
explicit LineStrip(float lineWidth_) : DrawMode(DrawModeType::LineStrip, lineWidth_), lineWidth(lineWidth_) {
assert(size > 0);
}
// LineStrip is a form of "Line" rendering, but the element buffer
// cannot be grouped into logical elements beyond a single Point.
static constexpr PrimitiveType primitive = PrimitiveType::Line;
static constexpr std::size_t bufferGroupSize = 1;
float lineWidth;
};
class Triangles : public DrawMode {
public:
explicit Triangles() : DrawMode(DrawModeType::Triangles, 0) {
}
static constexpr PrimitiveType primitive = PrimitiveType::Triangle;
static constexpr std::size_t bufferGroupSize = 3;
};
class TriangleStrip : public DrawMode {
public:
explicit TriangleStrip() : DrawMode(DrawModeType::TriangleStrip, 0) {
}
// TriangleStrip is a form of "Triangle" rendering, but the element buffer
// cannot be grouped into logical elements beyond a single Point.
static constexpr PrimitiveType primitive = PrimitiveType::Triangle;
static constexpr std::size_t bufferGroupSize = 1;
};
} // namespace gfx
} // namespace mbgl
|