summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/buckets/line_bucket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/renderer/buckets/line_bucket.cpp')
-rw-r--r--src/mbgl/renderer/buckets/line_bucket.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/mbgl/renderer/buckets/line_bucket.cpp b/src/mbgl/renderer/buckets/line_bucket.cpp
index 9019e76d3b..f65c239968 100644
--- a/src/mbgl/renderer/buckets/line_bucket.cpp
+++ b/src/mbgl/renderer/buckets/line_bucket.cpp
@@ -30,10 +30,9 @@ LineBucket::LineBucket(const style::LineLayoutProperties::PossiblyEvaluated layo
LineBucket::~LineBucket() = default;
-void LineBucket::addFeature(const GeometryTileFeature& feature,
- const GeometryCollection& geometryCollection,
- const ImagePositions& patternPositions,
- const PatternLayerMap& patternDependencies) {
+void LineBucket::addFeature(const GeometryTileFeature& feature, const GeometryCollection& geometryCollection,
+ const ImagePositions& patternPositions, const PatternLayerMap& patternDependencies,
+ std::size_t index) {
for (auto& line : geometryCollection) {
addGeometry(line, feature);
}
@@ -41,14 +40,13 @@ void LineBucket::addFeature(const GeometryTileFeature& feature,
for (auto& pair : paintPropertyBinders) {
const auto it = patternDependencies.find(pair.first);
if (it != patternDependencies.end()){
- pair.second.populateVertexVectors(feature, vertices.elements(), patternPositions, it->second);
+ pair.second.populateVertexVectors(feature, vertices.elements(), index, patternPositions, it->second);
} else {
- pair.second.populateVertexVectors(feature, vertices.elements(), patternPositions, {});
+ pair.second.populateVertexVectors(feature, vertices.elements(), index, patternPositions, {});
}
}
}
-
/*
* Sharp corners cause dashed lines to tilt because the distance along the line
* is the same at both the inner and outer corners. To improve the appearance of
@@ -517,8 +515,10 @@ void LineBucket::addPieSliceVertex(const GeometryCoordinate& currentVertex,
}
void LineBucket::upload(gfx::UploadPass& uploadPass) {
- vertexBuffer = uploadPass.createVertexBuffer(std::move(vertices));
- indexBuffer = uploadPass.createIndexBuffer(std::move(triangles));
+ if (!uploaded) {
+ vertexBuffer = uploadPass.createVertexBuffer(std::move(vertices));
+ indexBuffer = uploadPass.createIndexBuffer(std::move(triangles));
+ }
for (auto& pair : paintPropertyBinders) {
pair.second.upload(uploadPass);
@@ -554,4 +554,13 @@ float LineBucket::getQueryRadius(const RenderLayer& layer) const {
return lineWidth / 2.0f + std::abs(offset) + util::length(translate[0], translate[1]);
}
+void LineBucket::update(const FeatureStates& states, const GeometryTileLayer& layer, const std::string& layerID,
+ const ImagePositions& imagePositions) {
+ auto it = paintPropertyBinders.find(layerID);
+ if (it != paintPropertyBinders.end()) {
+ it->second.updateVertexVectors(states, layer, imagePositions);
+ uploaded = false;
+ }
+}
+
} // namespace mbgl