blob: 13e206aa2ac24a75bb48598a6d16ce7ef3394cc5 (
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
|
#pragma once
#include <mbgl/gfx/draw_scope.hpp>
#include <cstddef>
#include <vector>
#include <map>
namespace mbgl {
template <class AttributeList>
class Segment {
public:
Segment(std::size_t vertexOffset_,
std::size_t indexOffset_,
std::size_t vertexLength_ = 0,
std::size_t indexLength_ = 0,
float sortKey_ = 0.0f)
: vertexOffset(vertexOffset_),
indexOffset(indexOffset_),
vertexLength(vertexLength_),
indexLength(indexLength_),
sortKey(sortKey_) {}
Segment(Segment&&) = default;
const std::size_t vertexOffset;
const std::size_t indexOffset;
std::size_t vertexLength;
std::size_t indexLength;
// One DrawScope 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, gfx::DrawScope> drawScopes;
float sortKey;
};
template <class AttributeList>
using SegmentVector = std::vector<Segment<AttributeList>>;
} // namespace mbgl
|