Skip to content

Commit a6e8598

Browse files
authored
Fix for issue #9327 (#9333)
Revert "Hide glyphs behind the camera (#9229)" This reverts commit 1eed2ae.
1 parent f8d0a66 commit a6e8598

File tree

3 files changed

+1
-17
lines changed

3 files changed

+1
-17
lines changed

src/shaders/symbol_icon.vertex.glsl

-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ void main() {
8787
vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);
8888
gl_Position = u_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * max(a_minFontScale, fontScale) + a_pxoffset / 16.0), 0.0, 1.0);
8989

90-
// Symbols might end up being behind the camera. Modify z-value to be out of visible bounds
91-
// if this is the case, otherwise ignore depth. -1.1 is safely out of the visible depth range [-1, 1]
92-
gl_Position.z = mix(-1.1 * gl_Position.w, gl_Position.z, float(projected_pos.w > 0.0));
93-
9490
v_tex = a_tex / u_texsize;
9591
vec2 fade_opacity = unpack_opacity(a_fade_opacity);
9692
float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;

src/shaders/symbol_sdf.vertex.glsl

-4
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ void main() {
106106
gl_Position = u_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale + a_pxoffset), 0.0, 1.0);
107107
float gamma_scale = gl_Position.w;
108108

109-
// Symbols might end up being behind the camera. Modify z-value to be out of visible bounds
110-
// if this is the case, otherwise ignore depth. -1.1 is safely out of the visible depth range [-1, 1]
111-
gl_Position.z = mix(-1.1 * gl_Position.w, gl_Position.z, float(projected_pos.w > 0.0));
112-
113109
vec2 fade_opacity = unpack_opacity(a_fade_opacity);
114110
float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;
115111
float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));

src/symbol/projection.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,7 @@ function updateLineLabels(bucket: SymbolBucket,
185185
fontSize / perspectiveRatio;
186186

187187
const tileAnchorPoint = new Point(symbol.anchorX, symbol.anchorY);
188-
const transformedTileAnchor = project(tileAnchorPoint, labelPlaneMatrix);
189-
190-
// Skip labels behind the camera
191-
if (transformedTileAnchor.signedDistanceFromCamera <= 0.0) {
192-
hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);
193-
continue;
194-
}
195-
196-
const anchorPoint = transformedTileAnchor.point;
188+
const anchorPoint = project(tileAnchorPoint, labelPlaneMatrix).point;
197189
const projectionCache = {};
198190

199191
const placeUnflipped: any = placeGlyphsAlongLine(symbol, pitchScaledFontSize, false /*unflipped*/, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix,

0 commit comments

Comments
 (0)