summaryrefslogtreecommitdiff
path: root/src/mbgl/layout/symbol_projection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/layout/symbol_projection.cpp')
-rw-r--r--src/mbgl/layout/symbol_projection.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mbgl/layout/symbol_projection.cpp b/src/mbgl/layout/symbol_projection.cpp
index 745c1c1d77..4a48af3046 100644
--- a/src/mbgl/layout/symbol_projection.cpp
+++ b/src/mbgl/layout/symbol_projection.cpp
@@ -410,8 +410,16 @@ namespace mbgl {
const float pitchScaledFontSize = pitchWithMap ?
fontSize * perspectiveRatio :
fontSize / perspectiveRatio;
-
- const Point<float> anchorPoint = project(placedSymbol.anchorPoint, labelPlaneMatrix).first;
+
+ const auto transformedTileAnchor = project(placedSymbol.anchorPoint, labelPlaneMatrix);
+
+ // Skip labels behind the camera
+ if (transformedTileAnchor.second <= 0.0) {
+ hideGlyphs(placedSymbol.glyphOffsets.size(), dynamicVertexArray);
+ continue;
+ }
+
+ const Point<float> anchorPoint = transformedTileAnchor.first;
PlacementResult placeUnflipped = placeGlyphsAlongLine(placedSymbol, pitchScaledFontSize, false /*unflipped*/, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix, dynamicVertexArray, anchorPoint, state.getSize().aspectRatio());