@@ -505,8 +505,7 @@ void main(void) {
505
505
} else {
506
506
offsetPx += halfSizePx * vec2(-1., 1.);
507
507
}
508
- float angle = ${ this . symbolRotationExpression_ } ;
509
- ${ this . symbolRotateWithView_ ? 'angle += u_rotation;' : '' }
508
+ float angle = ${ this . symbolRotationExpression_ } ${ this . symbolRotateWithView_ ? ' + u_rotation' : '' } ;
510
509
float c = cos(-angle);
511
510
float s = sin(-angle);
512
511
offsetPx = vec2(c * offsetPx.x - s * offsetPx.y, s * offsetPx.x + c * offsetPx.y);
@@ -520,7 +519,7 @@ void main(void) {
520
519
v_angle = angle;
521
520
c = cos(-v_angle);
522
521
s = sin(-v_angle);
523
- centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y);
522
+ centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y);
524
523
v_centerPx = screenToPx(center.xy) + centerOffsetPx;
525
524
${ this . attributes_
526
525
. map (
@@ -662,7 +661,7 @@ void main(void) {
662
661
vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);
663
662
segmentStartPx = getOffsetPoint(segmentStartPx, normalPx, v_angleStart, lineOffsetPx),
664
663
segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);
665
-
664
+
666
665
// compute current vertex position
667
666
float normalDir = vertexNumber < 0.5 || (vertexNumber > 1.5 && vertexNumber < 2.5) ? 1.0 : -1.0;
668
667
float tangentDir = vertexNumber < 1.5 ? 1.0 : -1.0;
@@ -820,7 +819,7 @@ ${this.attributes_
820
819
` ${ attribute . varyingType } ${ attribute . name } = ${ attribute . varyingName } ; // assign to original attribute name` ,
821
820
)
822
821
. join ( '\n' ) }
823
-
822
+
824
823
vec2 currentPoint = gl_FragCoord.xy / u_pixelRatio;
825
824
#ifdef GL_FRAGMENT_PRECISION_HIGH
826
825
vec2 worldPos = pxToWorld(currentPoint);
@@ -844,7 +843,11 @@ ${this.attributes_
844
843
float currentLengthPx = lengthToPoint + v_distanceOffsetPx;
845
844
float currentRadiusPx = distanceFromSegment(currentPoint, v_segmentStart, v_segmentEnd);
846
845
float currentRadiusRatio = dot(segmentNormal, startToPoint) * 2. / v_width;
847
- currentLineMetric = mix(v_measureStart, v_measureEnd, lengthToPoint / segmentLength);
846
+ currentLineMetric = mix(
847
+ v_measureStart,
848
+ v_measureEnd,
849
+ lengthToPoint / max(segmentLength, 1.17549429e-38)
850
+ );
848
851
849
852
if (${ this . discardExpression_ } ) { discard; }
850
853
0 commit comments