diff options
Diffstat (limited to 'src/mbgl/renderer/buckets')
-rw-r--r-- | src/mbgl/renderer/buckets/line_bucket.cpp | 14 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/line_bucket.hpp | 3 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/mbgl/renderer/buckets/line_bucket.cpp b/src/mbgl/renderer/buckets/line_bucket.cpp index d1771d484a..194b012eee 100644 --- a/src/mbgl/renderer/buckets/line_bucket.cpp +++ b/src/mbgl/renderer/buckets/line_bucket.cpp @@ -15,7 +15,8 @@ LineBucket::LineBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers, const style::LineLayoutProperties::Unevaluated& layout_) : layout(layout_.evaluate(PropertyEvaluationParameters(parameters.tileID.overscaledZ))), - overscaling(parameters.tileID.overscaleFactor()) { + overscaling(parameters.tileID.overscaleFactor()), + zoom(parameters.tileID.overscaledZ) { for (const auto& layer : layers) { paintPropertyBinders.emplace( std::piecewise_construct, @@ -29,7 +30,7 @@ LineBucket::LineBucket(const BucketParameters& parameters, void LineBucket::addFeature(const GeometryTileFeature& feature, const GeometryCollection& geometryCollection) { for (auto& line : geometryCollection) { - addGeometry(line, feature.getType()); + addGeometry(line, feature); } for (auto& pair : paintPropertyBinders) { @@ -62,7 +63,8 @@ const float LINE_DISTANCE_SCALE = 1.0 / 2.0; // The maximum line distance, in tile units, that fits in the buffer. const float MAX_LINE_DISTANCE = std::pow(2, LINE_DISTANCE_BUFFER_BITS) / LINE_DISTANCE_SCALE; -void LineBucket::addGeometry(const GeometryCoordinates& coordinates, FeatureType type) { +void LineBucket::addGeometry(const GeometryCoordinates& coordinates, const GeometryTileFeature& feature) { + const FeatureType type = feature.getType(); const std::size_t len = [&coordinates] { std::size_t l = coordinates.size(); // If the line has duplicate vertices at the end, adjust length to remove them. @@ -86,7 +88,9 @@ void LineBucket::addGeometry(const GeometryCoordinates& coordinates, FeatureType return; } - const float miterLimit = layout.get<LineJoin>() == LineJoinType::Bevel ? 1.05f : float(layout.get<LineMiterLimit>()); + const LineJoinType joinType = layout.evaluate<LineJoin>(zoom, feature); + + const float miterLimit = joinType == LineJoinType::Bevel ? 1.05f : float(layout.get<LineMiterLimit>()); const double sharpCornerOffset = SHARP_CORNER_OFFSET * (float(util::EXTENT) / (util::tileSize * overscaling)); @@ -193,7 +197,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& coordinates, FeatureType // The join if a middle vertex, otherwise the cap const bool middleVertex = prevCoordinate && nextCoordinate; - LineJoinType currentJoin = layout.get<LineJoin>(); + LineJoinType currentJoin = joinType; const LineCapType currentCap = nextCoordinate ? beginCap : endCap; if (middleVertex) { diff --git a/src/mbgl/renderer/buckets/line_bucket.hpp b/src/mbgl/renderer/buckets/line_bucket.hpp index 8ef25b02ec..4fb77c377e 100644 --- a/src/mbgl/renderer/buckets/line_bucket.hpp +++ b/src/mbgl/renderer/buckets/line_bucket.hpp @@ -41,7 +41,7 @@ public: std::map<std::string, LineProgram::PaintPropertyBinders> paintPropertyBinders; private: - void addGeometry(const GeometryCoordinates&, FeatureType); + void addGeometry(const GeometryCoordinates&, const GeometryTileFeature&); struct TriangleElement { TriangleElement(uint16_t a_, uint16_t b_, uint16_t c_) : a(a_), b(b_), c(c_) {} @@ -59,6 +59,7 @@ private: std::ptrdiff_t e3; const uint32_t overscaling; + const float zoom; float getLineWidth(const RenderLineLayer& layer) const; }; |