blob: 74bf4a75c54e2d4344a64d26369e0b9d0872a722 (
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
|
#pragma once
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/vertex_array.hpp>
#include <mbgl/util/optional.hpp>
#include <cstddef>
#include <vector>
#include <map>
namespace mbgl {
template <class Attributes>
class Segment {
public:
Segment(std::size_t vertexOffset_,
std::size_t indexOffset_,
std::size_t vertexLength_ = 0,
std::size_t indexLength_ = 0)
: vertexOffset(vertexOffset_),
indexOffset(indexOffset_),
vertexLength(vertexLength_),
indexLength(indexLength_) {}
const std::size_t vertexOffset;
const std::size_t indexOffset;
std::size_t vertexLength;
std::size_t indexLength;
// One VertexArray per layer ID. This minimizes rebinding in cases where
// several layers share buckets but have different sets of active attributes.
// This can happen:
// * when two layers have the same layout properties, but differing
// data-driven paint properties
// * when two fill layers have the same layout properties, but one
// uses fill-color and the other uses fill-pattern
mutable std::map<std::string, optional<gl::VertexArray>> vertexArrays;
};
template <class Attributes>
class SegmentVector : public std::vector<Segment<Attributes>> {
public:
SegmentVector() = default;
};
} // namespace mbgl
|