namazu-ts 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6203,15 +6203,24 @@ var vf = class {
6203
6203
  }
6204
6204
  update(e42, t2, n2) {
6205
6205
  let { width: r2, height: i2 } = e42, a2 = (this.size?.[0] !== r2 || this.size[1] !== i2) && !n2, { context: o2 } = this, { gl: s2 } = o2;
6206
- this.useMipmap = !!t2?.useMipmap, s2.bindTexture(s2.TEXTURE_2D, this.texture), o2.pixelStoreUnpackFlipY.set(false), o2.pixelStoreUnpack.set(1);
6206
+ this.useMipmap = !!t2?.useMipmap, a2 && this.size && this.format === s2.RGBA && (s2.deleteTexture(this.texture), this.texture = s2.createTexture(), this._ownedHandle = this.texture), s2.bindTexture(s2.TEXTURE_2D, this.texture), o2.pixelStoreUnpackFlipY.set(false), o2.pixelStoreUnpack.set(1);
6207
6207
  let c2 = this.format === s2.RGBA && t2?.premultiply !== false;
6208
6208
  if (a2)
6209
- this.size = [r2, i2], _f(e42) ? (o2.pixelStoreUnpackPremultiplyAlpha.set(false), this._uploadRawData(e42, c2, r2, i2, s2)) : (o2.pixelStoreUnpackPremultiplyAlpha.set(c2), this._uploadDomImage(e42, s2));
6209
+ if (this.size = [r2, i2], this.format === s2.RGBA && r2 > 0 && i2 > 0) {
6210
+ let t3 = this.useMipmap ? Math.floor(Math.log2(Math.max(r2, i2))) + 1 : 1;
6211
+ if (s2.texStorage2D(s2.TEXTURE_2D, t3, s2.RGBA8, r2, i2), _f(e42)) {
6212
+ o2.pixelStoreUnpackPremultiplyAlpha.set(false);
6213
+ let { data: t4 } = e42;
6214
+ c2 && t4 && (t4 = rf(t4)), t4 && s2.texSubImage2D(s2.TEXTURE_2D, 0, 0, 0, r2, i2, s2.RGBA, s2.UNSIGNED_BYTE, t4);
6215
+ } else
6216
+ o2.pixelStoreUnpackPremultiplyAlpha.set(c2), s2.texSubImage2D(s2.TEXTURE_2D, 0, 0, 0, s2.RGBA, s2.UNSIGNED_BYTE, e42);
6217
+ } else
6218
+ _f(e42) ? (o2.pixelStoreUnpackPremultiplyAlpha.set(false), this._uploadRawData(e42, c2, r2, i2, s2)) : (o2.pixelStoreUnpackPremultiplyAlpha.set(c2), this._uploadDomImage(e42, s2));
6210
6219
  else {
6211
6220
  let { x: t3, y: a3 } = n2 || { x: 0, y: 0 };
6212
6221
  _f(e42) ? (o2.pixelStoreUnpackPremultiplyAlpha.set(false), this._updateRawData(e42, c2, t3, a3, r2, i2, s2)) : (o2.pixelStoreUnpackPremultiplyAlpha.set(c2), this._updateDomImage(e42, t3, a3, s2));
6213
6222
  }
6214
- this.useMipmap && this.isSizePowerOfTwo() && s2.generateMipmap(s2.TEXTURE_2D), o2.pixelStoreUnpackFlipY.setDefault(), o2.pixelStoreUnpack.setDefault(), o2.pixelStoreUnpackPremultiplyAlpha.setDefault();
6223
+ this.useMipmap && s2.generateMipmap(s2.TEXTURE_2D), o2.pixelStoreUnpackFlipY.setDefault(), o2.pixelStoreUnpack.setDefault(), o2.pixelStoreUnpackPremultiplyAlpha.setDefault();
6215
6224
  }
6216
6225
  _uploadDomImage(e42, t2) {
6217
6226
  t2.texImage2D(t2.TEXTURE_2D, 0, this.format, this.format, t2.UNSIGNED_BYTE, e42);
@@ -6229,10 +6238,7 @@ var vf = class {
6229
6238
  }
6230
6239
  bind(e42, t2, n2) {
6231
6240
  let { context: r2 } = this, { gl: i2 } = r2;
6232
- this.texture !== this._ownedHandle && (this.texture = this._ownedHandle), i2.bindTexture(i2.TEXTURE_2D, this.texture), n2 === i2.LINEAR_MIPMAP_NEAREST && !this.isSizePowerOfTwo() && (n2 = i2.LINEAR), e42 !== this.filter && (i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_MAG_FILTER, e42), i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_MIN_FILTER, n2 || e42), this.filter = e42), t2 !== this.wrap && (i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_WRAP_S, t2), i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_WRAP_T, t2), this.wrap = t2);
6233
- }
6234
- isSizePowerOfTwo() {
6235
- return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 == 0;
6241
+ this.texture !== this._ownedHandle && (this.texture = this._ownedHandle), i2.bindTexture(i2.TEXTURE_2D, this.texture), n2 === i2.LINEAR_MIPMAP_NEAREST && !this.useMipmap && (n2 = i2.LINEAR), e42 !== this.filter && (i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_MAG_FILTER, e42), i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_MIN_FILTER, n2 || e42), this.filter = e42), t2 !== this.wrap && (i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_WRAP_S, t2), i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_WRAP_T, t2), this.wrap = t2);
6236
6242
  }
6237
6243
  destroy() {
6238
6244
  let { gl: e42 } = this.context;
@@ -8377,7 +8383,7 @@ var $h = class {
8377
8383
  return t2.width = t2.height = e44, t2;
8378
8384
  }
8379
8385
  draw(e44) {
8380
- let { width: t2, actualBoundingBoxAscent: n2, actualBoundingBoxDescent: r2, actualBoundingBoxLeft: i2, actualBoundingBoxRight: a2 } = this.ctx.measureText(e44), o2 = Math.ceil(n2), s2 = Math.floor(i2), c2 = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(a2) - s2)), l = Math.max(0, Math.min(this.size - this.buffer, o2 + Math.ceil(r2))), u2 = c2 + 2 * this.buffer, d2 = l + 2 * this.buffer, f2 = Math.max(u2 * d2, 0), p2 = new Uint8ClampedArray(f2), m2 = { data: p2, width: u2, height: d2, glyphWidth: c2, glyphHeight: l, glyphTop: o2, glyphLeft: s2, glyphAdvance: t2 };
8386
+ let { width: t2, actualBoundingBoxAscent: n2, actualBoundingBoxDescent: r2, actualBoundingBoxLeft: i2, actualBoundingBoxRight: a2 } = this.ctx.measureText(e44), o2 = Math.ceil(n2), s2 = Math.floor(-i2), c2 = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(a2) - s2)), l = Math.max(0, Math.min(this.size - this.buffer, o2 + Math.ceil(r2))), u2 = c2 + 2 * this.buffer, d2 = l + 2 * this.buffer, f2 = Math.max(u2 * d2, 0), p2 = new Uint8ClampedArray(f2), m2 = { data: p2, width: u2, height: d2, glyphWidth: c2, glyphHeight: l, glyphTop: o2, glyphLeft: s2, glyphAdvance: t2 };
8381
8387
  if (c2 === 0 || l === 0)
8382
8388
  return m2;
8383
8389
  let { ctx: h2, buffer: g2, gridInner: _2, gridOuter: v2 } = this;
@@ -8395,11 +8401,13 @@ var $h = class {
8395
8401
  v2[t3] = Math.max(0, n3), _2[t3] = Math.max(0, -n3);
8396
8402
  }
8397
8403
  }
8398
- eg(v2, 0, 0, u2, d2, u2, this.f, this.v, this.z), eg(_2, g2, g2, c2, l, u2, this.f, this.v, this.z);
8399
- let x = 255 / this.radius, S2 = 255 * (1 - this.cutoff);
8404
+ eg(v2, 0, 0, u2, d2, u2, this.f, this.v, this.z);
8405
+ let x = Math.min(g2, 1);
8406
+ eg(_2, g2 - x, g2 - x, c2 + 2 * x, l + 2 * x, u2, this.f, this.v, this.z);
8407
+ let S2 = 255 / this.radius, C = 255 * (1 - this.cutoff);
8400
8408
  for (let e45 = 0;e45 < f2; e45++) {
8401
8409
  let t3 = Math.sqrt(v2[e45]) - Math.sqrt(_2[e45]);
8402
- p2[e45] = Math.round(S2 - x * t3);
8410
+ p2[e45] = Math.round(C - S2 * t3);
8403
8411
  }
8404
8412
  return m2;
8405
8413
  }
@@ -12379,7 +12387,7 @@ var Wx = class {
12379
12387
  releaseRTT(e51) {
12380
12388
  if (this.rttObjects.length !== 0) {
12381
12389
  for (let t2 of this.rttObjects)
12382
- e51.releaseRTT(t2);
12390
+ t2 && e51.releaseRTT(t2);
12383
12391
  this.rttObjects.length = 0;
12384
12392
  }
12385
12393
  }
@@ -13639,14 +13647,14 @@ var CC = `uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_
13639
13647
  fragColor=vec4(1.0);
13640
13648
  #endif
13641
13649
  }`;
13642
- var wC = `in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}`;
13650
+ var wC = `layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}`;
13643
13651
  var TC = `uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
13644
13652
  #ifdef OVERDRAW_INSPECTOR
13645
13653
  fragColor=vec4(1.0);
13646
13654
  #endif
13647
13655
  }`;
13648
- var EC = `uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}`;
13649
- var DC = `in vec3 v_data;in float v_visibility;
13656
+ var EC = `uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}`;
13657
+ var DC = `in vec3 v_data;flat in float v_visibility;
13650
13658
  #pragma mapbox: define highp vec4 color
13651
13659
  #pragma mapbox: define mediump float radius
13652
13660
  #pragma mapbox: define lowp float blur
@@ -13667,7 +13675,7 @@ vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_bl
13667
13675
  fragColor=vec4(1.0);
13668
13676
  #endif
13669
13677
  }`;
13670
- var OC = `uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
13678
+ var OC = `uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;layout(location=0) in vec2 a_pos;out vec3 v_data;flat out float v_visibility;
13671
13679
  #pragma mapbox: define highp vec4 color
13672
13680
  #pragma mapbox: define mediump float radius
13673
13681
  #pragma mapbox: define lowp float blur
@@ -13705,7 +13713,7 @@ var AC = { prelude: jC(xC, SC), projectionMercator: jC(``, `float projectLineThi
13705
13713
  uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
13706
13714
  );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
13707
13715
  if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
13708
- );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`), background: jC(CC, wC), backgroundPattern: jC(TC, EC), circle: jC(DC, OC), clippingMask: jC(kC, `in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}`), heatmap: jC(`uniform highp float u_intensity;in vec2 v_extrude;
13716
+ );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`), background: jC(CC, wC), backgroundPattern: jC(TC, EC), circle: jC(DC, OC), clippingMask: jC(kC, `layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}`), heatmap: jC(`uniform highp float u_intensity;in vec2 v_extrude;
13709
13717
  #pragma mapbox: define highp float weight
13710
13718
  #define GAUSS_COEF 0.3989422804014327
13711
13719
  void main() {
@@ -13714,7 +13722,7 @@ float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS
13714
13722
  #ifdef OVERDRAW_INSPECTOR
13715
13723
  fragColor=vec4(1.0);
13716
13724
  #endif
13717
- }`, `uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
13725
+ }`, `uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in vec2 a_pos;out vec2 v_extrude;
13718
13726
  #pragma mapbox: define highp float weight
13719
13727
  #pragma mapbox: define mediump float radius
13720
13728
  const highp float ZERO=1.0/255.0/16.0;
@@ -13732,7 +13740,7 @@ gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center))
13732
13740
  #ifdef OVERDRAW_INSPECTOR
13733
13741
  fragColor=vec4(0.0);
13734
13742
  #endif
13735
- }`, `uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}`), collisionBox: jC(`in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}`, `in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}`), collisionCircle: jC(`in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}`, `in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`), colorRelief: jC(`#ifdef GL_ES
13743
+ }`, `uniform mat4 u_matrix;uniform vec2 u_world;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}`), collisionBox: jC(`flat in float v_placed;flat in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}`, `layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;flat out float v_placed;flat out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}`), collisionCircle: jC(`flat in float v_radius;in vec2 v_extrude;flat in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}`, `layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;uniform vec2 u_viewport_size;flat out float v_radius;out vec2 v_extrude;flat out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`), colorRelief: jC(`#ifdef GL_ES
13736
13744
  precision highp float;
13737
13745
  #endif
13738
13746
  uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
@@ -13740,7 +13748,7 @@ uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_st
13740
13748
  #ifdef OVERDRAW_INSPECTOR
13741
13749
  fragColor=vec4(1.0);
13742
13750
  #endif
13743
- }`, `uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}`), debug: jC(`uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}`, `in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}`), depth: jC(kC, `in vec2 a_pos;void main() {
13751
+ }`, `uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}`), debug: jC(`uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}`, `layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}`), depth: jC(kC, `layout(location=0) in vec2 a_pos;void main() {
13744
13752
  #ifdef GLOBE
13745
13753
  gl_Position=projectTileFor3D(a_pos,0.0);
13746
13754
  #else
@@ -13755,7 +13763,7 @@ fragColor=color*opacity;
13755
13763
  #ifdef OVERDRAW_INSPECTOR
13756
13764
  fragColor=vec4(1.0);
13757
13765
  #endif
13758
- }`, `uniform vec2 u_fill_translate;in vec2 a_pos;
13766
+ }`, `uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;
13759
13767
  #pragma mapbox: define highp vec4 color
13760
13768
  #pragma mapbox: define lowp float opacity
13761
13769
  void main() {
@@ -13777,7 +13785,7 @@ if (v_depth > 1.0) {discard;}
13777
13785
  #ifdef OVERDRAW_INSPECTOR
13778
13786
  fragColor=vec4(1.0);
13779
13787
  #endif
13780
- }`, `uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
13788
+ }`, `uniform vec2 u_world;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;
13781
13789
  #ifdef GLOBE
13782
13790
  out float v_depth;
13783
13791
  #endif
@@ -13808,7 +13816,7 @@ if (v_depth > 1.0) {discard;}
13808
13816
  #ifdef OVERDRAW_INSPECTOR
13809
13817
  fragColor=vec4(1.0);
13810
13818
  #endif
13811
- }`, `uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
13819
+ }`, `uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
13812
13820
  #ifdef GLOBE
13813
13821
  out float v_depth;
13814
13822
  #endif
@@ -13842,7 +13850,7 @@ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern
13842
13850
  #ifdef OVERDRAW_INSPECTOR
13843
13851
  fragColor=vec4(1.0);
13844
13852
  #endif
13845
- }`, `uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
13853
+ }`, `uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
13846
13854
  #pragma mapbox: define lowp float opacity
13847
13855
  #pragma mapbox: define lowp vec4 pattern_from
13848
13856
  #pragma mapbox: define lowp vec4 pattern_to
@@ -13858,9 +13866,9 @@ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern
13858
13866
  #ifdef OVERDRAW_INSPECTOR
13859
13867
  fragColor=vec4(1.0);
13860
13868
  #endif
13861
- }`, `uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
13869
+ }`, `uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in vec4 a_normal_ed;
13862
13870
  #ifdef TERRAIN3D
13863
- in vec2 a_centroid;
13871
+ layout(location=2) in vec2 a_centroid;
13864
13872
  #endif
13865
13873
  out vec4 v_color;
13866
13874
  #pragma mapbox: define highp float base
@@ -13904,9 +13912,9 @@ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern
13904
13912
  #ifdef OVERDRAW_INSPECTOR
13905
13913
  fragColor=vec4(1.0);
13906
13914
  #endif
13907
- }`, `uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
13915
+ }`, `uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in vec4 a_normal_ed;
13908
13916
  #ifdef TERRAIN3D
13909
- in vec2 a_centroid;
13917
+ layout(location=2) in vec2 a_centroid;
13910
13918
  #endif
13911
13919
  #ifdef GLOBE
13912
13920
  out vec3 v_sphere_pos;
@@ -13946,7 +13954,7 @@ uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u
13946
13954
  #ifdef OVERDRAW_INSPECTOR
13947
13955
  fragColor=vec4(1.0);
13948
13956
  #endif
13949
- }`, `uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}`), hillshade: jC(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
13957
+ }`, `uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}`), hillshade: jC(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
13950
13958
  #define PI 3.141592653589793
13951
13959
  #define STANDARD 0
13952
13960
  #define COMBINED 1
@@ -13959,7 +13967,7 @@ float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/
13959
13967
  #ifdef OVERDRAW_INSPECTOR
13960
13968
  fragColor=vec4(1.0);
13961
13969
  #endif
13962
- }`, `uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}`), line: jC(`uniform lowp float u_device_pixel_ratio;uniform bool u_opacity_override;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
13970
+ }`, `uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}`), line: jC(`uniform lowp float u_device_pixel_ratio;uniform bool u_opacity_override;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
13963
13971
  #ifdef GLOBE
13964
13972
  in float v_depth;
13965
13973
  #endif
@@ -13979,7 +13987,7 @@ fragColor=vec4(1.0);
13979
13987
  #endif
13980
13988
  }`, `
13981
13989
  #define scale 0.015873016
13982
- in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
13990
+ layout(location=0) in vec2 a_pos_normal;layout(location=1) in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
13983
13991
  #ifdef GLOBE
13984
13992
  out float v_depth;
13985
13993
  #endif
@@ -14005,7 +14013,7 @@ v_gamma_scale=1.0;
14005
14013
  #else
14006
14014
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
14007
14015
  #endif
14008
- v_width2=vec2(outset,inset);}`), lineGradient: jC(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform bool u_opacity_override;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
14016
+ v_width2=vec2(outset,inset);}`), lineGradient: jC(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform bool u_opacity_override;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
14009
14017
  #ifdef GLOBE
14010
14018
  in float v_depth;
14011
14019
  #endif
@@ -14023,7 +14031,7 @@ fragColor=vec4(1.0);
14023
14031
  #endif
14024
14032
  }`, `
14025
14033
  #define scale 0.015873016
14026
- in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
14034
+ layout(location=0) in vec2 a_pos_normal;layout(location=1) in vec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
14027
14035
  #ifdef GLOBE
14028
14036
  out float v_depth;
14029
14037
  #endif
@@ -14050,7 +14058,7 @@ float extrude_length_without_perspective=length(dist);float extrude_length_with_
14050
14058
  v_width2=vec2(outset,inset);}`), linePattern: jC(`#ifdef GL_ES
14051
14059
  precision highp float;
14052
14060
  #endif
14053
- uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;uniform bool u_opacity_override;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
14061
+ uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;uniform bool u_opacity_override;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width;
14054
14062
  #ifdef GLOBE
14055
14063
  in float v_depth;
14056
14064
  #endif
@@ -14077,7 +14085,7 @@ fragColor=vec4(1.0);
14077
14085
  }`, `
14078
14086
  #define scale 0.015873016
14079
14087
  #define LINE_DISTANCE_SCALE 2.0
14080
- in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
14088
+ layout(location=0) in vec2 a_pos_normal;layout(location=1) in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width;
14081
14089
  #ifdef GLOBE
14082
14090
  out float v_depth;
14083
14091
  #endif
@@ -14111,7 +14119,7 @@ v_gamma_scale=1.0;
14111
14119
  #else
14112
14120
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
14113
14121
  #endif
14114
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`), lineSDF: jC(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;uniform bool u_opacity_override;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
14122
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`), lineSDF: jC(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;uniform bool u_opacity_override;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
14115
14123
  #ifdef GLOBE
14116
14124
  in float v_depth;
14117
14125
  #endif
@@ -14140,7 +14148,7 @@ fragColor=vec4(1.0);
14140
14148
  }`, `
14141
14149
  #define scale 0.015873016
14142
14150
  #define LINE_DISTANCE_SCALE 2.0
14143
- in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
14151
+ layout(location=0) in vec2 a_pos_normal;layout(location=1) in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
14144
14152
  #ifdef GLOBE
14145
14153
  out float v_depth;
14146
14154
  #endif
@@ -14172,7 +14180,7 @@ v_gamma_scale=1.0;
14172
14180
  #else
14173
14181
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
14174
14182
  #endif
14175
- float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`), lineGradientSDF: jC(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;uniform bool u_opacity_override;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
14183
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`), lineGradientSDF: jC(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;uniform bool u_opacity_override;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
14176
14184
  #ifdef GLOBE
14177
14185
  in float v_depth;
14178
14186
  #endif
@@ -14199,7 +14207,7 @@ fragColor=vec4(1.0);
14199
14207
  }`, `
14200
14208
  #define scale 0.015873016
14201
14209
  #define LINE_DISTANCE_SCALE 2.0
14202
- in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
14210
+ layout(location=0) in vec2 a_pos_normal;layout(location=1) in vec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
14203
14211
  #ifdef GLOBE
14204
14212
  out float v_depth;
14205
14213
  #endif
@@ -14233,19 +14241,19 @@ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_p
14233
14241
  #ifdef OVERDRAW_INSPECTOR
14234
14242
  fragColor=vec4(0.0);
14235
14243
  #endif
14236
- }`, `uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}`), raster: jC(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
14244
+ }`, `uniform mat4 u_matrix;uniform vec2 u_world;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}`), raster: jC(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
14237
14245
  #ifdef OVERDRAW_INSPECTOR
14238
14246
  fragColor=vec4(1.0);
14239
14247
  #endif
14240
- }`, `uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
14248
+ }`, `uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
14241
14249
  #ifdef GLOBE
14242
14250
  if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
14243
14251
  #endif
14244
- v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`), symbolIcon: jC(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
14252
+ v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`), symbolIcon: jC(`uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
14245
14253
  #ifdef OVERDRAW_INSPECTOR
14246
14254
  fragColor=vec4(1.0);
14247
14255
  #endif
14248
- }`, `in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_total_opacity;
14256
+ }`, `layout(location=0) in vec4 a_pos_offset;layout(location=1) in vec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;flat out float v_total_opacity;
14249
14257
  #pragma mapbox: define lowp float opacity
14250
14258
  void main() {
14251
14259
  #pragma mapbox: initialize lowp float opacity
@@ -14270,7 +14278,7 @@ float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scal
14270
14278
  #ifdef OVERDRAW_INSPECTOR
14271
14279
  fragColor=vec4(1.0);
14272
14280
  #endif
14273
- }`, `in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
14281
+ }`, `layout(location=0) in vec4 a_pos_offset;layout(location=1) in vec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
14274
14282
  #pragma mapbox: define highp vec4 fill_color
14275
14283
  #pragma mapbox: define highp vec4 halo_color
14276
14284
  #pragma mapbox: define lowp float opacity
@@ -14291,7 +14299,7 @@ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos
14291
14299
  vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`), symbolTextAndIcon: jC(`#define SDF_PX 8.0
14292
14300
  #define SDF 1.0
14293
14301
  #define ICON 0.0
14294
- uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
14302
+ uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf;
14295
14303
  #pragma mapbox: define highp vec4 fill_color
14296
14304
  #pragma mapbox: define highp vec4 halo_color
14297
14305
  #pragma mapbox: define lowp float halo_width
@@ -14301,7 +14309,7 @@ void main() {
14301
14309
  #pragma mapbox: initialize highp vec4 halo_color
14302
14310
  #pragma mapbox: initialize lowp float halo_width
14303
14311
  #pragma mapbox: initialize lowp float halo_blur
14304
- float total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
14312
+ float total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
14305
14313
  #ifdef OVERDRAW_INSPECTOR
14306
14314
  fragColor=vec4(1.0);
14307
14315
  #endif
@@ -14309,7 +14317,7 @@ return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float ga
14309
14317
  #ifdef OVERDRAW_INSPECTOR
14310
14318
  fragColor=vec4(1.0);
14311
14319
  #endif
14312
- }`, `in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
14320
+ }`, `layout(location=0) in vec4 a_pos_offset;layout(location=1) in vec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf;
14313
14321
  #pragma mapbox: define highp vec4 fill_color
14314
14322
  #pragma mapbox: define highp vec4 halo_color
14315
14323
  #pragma mapbox: define lowp float opacity
@@ -14327,14 +14335,14 @@ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ra
14327
14335
  #ifdef GLOBE
14328
14336
  if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
14329
14337
  #endif
14330
- vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}`), terrain: jC(`uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}`, `in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}`), terrainDepth: jC(`in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}`, `in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}`), terrainCoords: jC(`precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}`, `in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}`), projectionErrorMeasurement: jC(`in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}`, `in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}`), atmosphere: jC(`#ifdef GL_ES
14338
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}`), terrain: jC(`uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}`, `layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}`), terrainDepth: jC(`in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}`, `layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}`), terrainCoords: jC(`precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}`, `layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}`), projectionErrorMeasurement: jC(`flat in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}`, `layout(location=0) in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;flat out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}`), atmosphere: jC(`#ifdef GL_ES
14331
14339
  precision highp float;
14332
14340
  #endif
14333
14341
  in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
14334
- );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`, `in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}`), sky: jC(`uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}`, `in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}`) };
14342
+ );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`, `layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}`), sky: jC(`uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}`, `layout(location=0) in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}`) };
14335
14343
  function jC(e53, t2) {
14336
- let n2 = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, r2 = t2.match(/in ([\w]+) ([\w]+)/g), i2 = e53.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), a2 = t2.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), o2 = a2 ? a2.concat(i2) : i2, s2 = {};
14337
- return e53 = e53.replace(n2, (e54, t3, n3, r3, i3) => (s2[i3] = true, t3 === `define` ? `
14344
+ let n2 = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, r2 = t2.match(/in ([\w]+) ([\w]+)/g), i2 = e53.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), a2 = t2.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), o2 = a2 ? a2.concat(i2) : i2, s2 = r2 ? r2.length : 0, c2 = {};
14345
+ return e53 = e53.replace(n2, (e54, t3, n3, r3, i3) => (c2[i3] = true, t3 === `define` ? `
14338
14346
  #ifndef HAS_UNIFORM_u_${i3}
14339
14347
  in ${n3} ${r3} ${i3};
14340
14348
  #else
@@ -14346,10 +14354,10 @@ uniform ${n3} ${r3} u_${i3};
14346
14354
  #endif
14347
14355
  `)), t2 = t2.replace(n2, (e54, t3, n3, r3, i3) => {
14348
14356
  let a3 = r3 === `float` ? `vec2` : `vec4`, o3 = i3.match(/color/) ? `color` : a3;
14349
- return s2[i3] ? t3 === `define` ? `
14357
+ return c2[i3] ? t3 === `define` ? `
14350
14358
  #ifndef HAS_UNIFORM_u_${i3}
14351
14359
  uniform lowp float u_${i3}_t;
14352
- in ${n3} ${a3} a_${i3};
14360
+ layout(location = ${s2++}) in ${n3} ${a3} a_${i3};
14353
14361
  out ${n3} ${r3} ${i3};
14354
14362
  #else
14355
14363
  uniform ${n3} ${r3} u_${i3};
@@ -14369,7 +14377,7 @@ uniform ${n3} ${r3} u_${i3};
14369
14377
  ` : t3 === `define` ? `
14370
14378
  #ifndef HAS_UNIFORM_u_${i3}
14371
14379
  uniform lowp float u_${i3}_t;
14372
- in ${n3} ${a3} a_${i3};
14380
+ layout(location = ${s2++}) in ${n3} ${a3} a_${i3};
14373
14381
  #else
14374
14382
  uniform ${n3} ${r3} u_${i3};
14375
14383
  #endif
@@ -14508,8 +14516,13 @@ var rT = class {
14508
14516
  let w2 = {};
14509
14517
  this.numAttributes = f2.length;
14510
14518
  for (let e54 = 0;e54 < this.numAttributes; e54++)
14511
- f2[e54] && (l.bindAttribLocation(this.program, e54, f2[e54]), this.attributes[f2[e54]] = e54);
14512
- if (l.linkProgram(this.program), !l.getProgramParameter(this.program, l.LINK_STATUS))
14519
+ f2[e54] && (this.attributes[f2[e54]] = e54);
14520
+ l.linkProgram(this.program);
14521
+ for (let e54 in this.attributes) {
14522
+ let t3 = l.getAttribLocation(this.program, e54);
14523
+ t3 >= 0 && (this.attributes[e54] = t3);
14524
+ }
14525
+ if (!l.getProgramParameter(this.program, l.LINK_STATUS))
14513
14526
  throw Error(`Program failed to link: ${l.getProgramInfoLog(this.program)}`);
14514
14527
  l.deleteShader(C), l.deleteShader(S2);
14515
14528
  for (let e54 of v2)
@@ -15440,7 +15453,7 @@ function ED(e53, t2, n2) {
15440
15453
  }
15441
15454
  function DD(e53, t2, n2) {
15442
15455
  let r2 = e53.gl, i2 = r2.createTexture();
15443
- r2.bindTexture(r2.TEXTURE_2D, i2), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_WRAP_S, r2.CLAMP_TO_EDGE), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_WRAP_T, r2.CLAMP_TO_EDGE), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_MIN_FILTER, r2.LINEAR), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_MAG_FILTER, r2.LINEAR), r2.texImage2D(r2.TEXTURE_2D, 0, r2.RGBA16F, t2, n2, 0, r2.RGBA, r2.HALF_FLOAT, null);
15456
+ r2.bindTexture(r2.TEXTURE_2D, i2), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_WRAP_S, r2.CLAMP_TO_EDGE), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_WRAP_T, r2.CLAMP_TO_EDGE), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_MIN_FILTER, r2.LINEAR), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_MAG_FILTER, r2.LINEAR), r2.texStorage2D(r2.TEXTURE_2D, 1, r2.RGBA16F, t2, n2);
15444
15457
  let a2 = e53.createFramebuffer(t2, n2, false, false);
15445
15458
  return a2.colorAttachment.set(i2), a2;
15446
15459
  }
@@ -15529,7 +15542,7 @@ function LD(e53, t2, n2, r2, i2, a2, o2) {
15529
15542
  }
15530
15543
  function RD(e53, t2, n2) {
15531
15544
  let r2 = e53.gl, i2 = r2.createTexture();
15532
- r2.bindTexture(r2.TEXTURE_2D, i2), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_WRAP_S, r2.CLAMP_TO_EDGE), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_WRAP_T, r2.CLAMP_TO_EDGE), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_MIN_FILTER, r2.LINEAR), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_MAG_FILTER, r2.LINEAR), r2.texImage2D(r2.TEXTURE_2D, 0, r2.RGBA, t2, n2, 0, r2.RGBA, r2.UNSIGNED_BYTE, null);
15545
+ r2.bindTexture(r2.TEXTURE_2D, i2), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_WRAP_S, r2.CLAMP_TO_EDGE), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_WRAP_T, r2.CLAMP_TO_EDGE), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_MIN_FILTER, r2.LINEAR), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_MAG_FILTER, r2.LINEAR), r2.texStorage2D(r2.TEXTURE_2D, 1, r2.RGBA8, t2, n2);
15533
15546
  let a2 = e53.createFramebuffer(t2, n2, true, true);
15534
15547
  return a2.colorAttachment.set(i2), a2.depthAttachment.set(e53.createRenderbuffer(r2.DEPTH_STENCIL, t2, n2)), a2;
15535
15548
  }
@@ -15864,7 +15877,7 @@ function wO(e53, t2, n2) {
15864
15877
  var TO = { symbol: fD, circle: bD, heatmap: xD, line: PD, fill: BD, fillExtrusion: HD, hillshade: WD, colorRelief: qD, raster: ZD, background: nO, sky: SO, atmosphere: wO, custom: _O, debug: pO, debugPadding: cO, terrainDepth: vO, terrainCoords: yO };
15865
15878
  var EO = class e53 {
15866
15879
  constructor(e54, t2) {
15867
- this.drawFunctions = TO, this.context = new sD(e54), this.transform = t2, this._tileTextures = {}, this._rttObjectRecyclePool = [], this.terrainFacilitator = { depthDirty: true, coordsDirty: false, matrix: E(new Float64Array(16)), renderTime: 0 }, this.setup(), this.numSublayers = yS.maxOverzooming + yS.maxUnderzooming + 1, this.depthEpsilon = 1 / 2 ** 16, this.crossTileSymbolIndex = new bC;
15880
+ this.drawFunctions = TO, this.context = new sD(e54), this.transform = t2, this._tileTextures = {}, this._rttObjectRecyclePool = [], this._rttSharedFbo = null, this.terrainFacilitator = { depthDirty: true, coordsDirty: false, matrix: E(new Float64Array(16)), renderTime: 0 }, this.setup(), this.numSublayers = yS.maxOverzooming + yS.maxUnderzooming + 1, this.depthEpsilon = 1 / 2 ** 16, this.crossTileSymbolIndex = new bC;
15868
15881
  }
15869
15882
  resize(e54, t2, n2) {
15870
15883
  if (this.width = Math.floor(e54 * n2), this.height = Math.floor(t2 * n2), this.pixelRatio = n2, this.context.viewport.set([0, 0, this.width, this.height]), this.style)
@@ -16048,9 +16061,17 @@ var EO = class e53 {
16048
16061
  acquireRTT(e54) {
16049
16062
  let t2 = this.context.gl, n2 = this._rttObjectRecyclePool.pop();
16050
16063
  if (n2)
16051
- return n2.size !== e54 && (t2.bindTexture(t2.TEXTURE_2D, n2.texture.texture), t2.texImage2D(t2.TEXTURE_2D, 0, t2.RGBA, e54, e54, 0, t2.RGBA, t2.UNSIGNED_BYTE, null), n2.texture.size = [e54, e54], this.context.bindRenderbuffer.set(n2.fbo.depthAttachment.get()), t2.renderbufferStorage(t2.RENDERBUFFER, t2.DEPTH_STENCIL, e54, e54), this.context.bindRenderbuffer.set(null), n2.fbo.width = e54, n2.fbo.height = e54, n2.size = e54), n2;
16052
- let r2 = this.context.createFramebuffer(e54, e54, true, true), i2 = new vf(this.context, { width: e54, height: e54, data: null }, t2.RGBA);
16053
- return i2.bind(t2.LINEAR, t2.CLAMP_TO_EDGE), this.context.extTextureFilterAnisotropic && t2.texParameterf(t2.TEXTURE_2D, this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, this.context.extTextureFilterAnisotropicMax), r2.depthAttachment.set(this.context.createRenderbuffer(t2.DEPTH_STENCIL, e54, e54)), r2.colorAttachment.set(i2.texture), { fbo: r2, texture: i2, size: e54 };
16064
+ return n2.size !== e54 && (t2.bindTexture(t2.TEXTURE_2D, n2.texture.texture), t2.texImage2D(t2.TEXTURE_2D, 0, t2.RGBA, e54, e54, 0, t2.RGBA, t2.UNSIGNED_BYTE, null), n2.texture.size = [e54, e54], n2.size = e54), n2;
16065
+ let r2 = new vf(this.context, { width: e54, height: e54, data: null }, t2.RGBA);
16066
+ return r2.bind(t2.LINEAR, t2.CLAMP_TO_EDGE), this.context.extTextureFilterAnisotropic && t2.texParameterf(t2.TEXTURE_2D, this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, this.context.extTextureFilterAnisotropicMax), { texture: r2, size: e54 };
16067
+ }
16068
+ bindRTT(e54) {
16069
+ let t2 = this.context.gl, n2 = e54.size;
16070
+ if (!this._rttSharedFbo) {
16071
+ let e55 = this.context.createFramebuffer(n2, n2, true, true), r2 = this.context.createRenderbuffer(t2.DEPTH_STENCIL, n2, n2);
16072
+ e55.depthAttachment.set(r2), this._rttSharedFbo = { fbo: e55, depthRenderbuffer: r2, size: n2 };
16073
+ }
16074
+ this._rttSharedFbo.size !== n2 && (this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer), t2.renderbufferStorage(t2.RENDERBUFFER, t2.DEPTH_STENCIL, n2, n2), this.context.bindRenderbuffer.set(null), this._rttSharedFbo.fbo.width = n2, this._rttSharedFbo.fbo.height = n2, this._rttSharedFbo.size = n2), this._rttSharedFbo.fbo.colorAttachment.set(e54.texture.texture), this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer);
16054
16075
  }
16055
16076
  releaseRTT(e54) {
16056
16077
  this._rttObjectRecyclePool.push(e54);
@@ -16093,8 +16114,13 @@ var EO = class e53 {
16093
16114
  this._tileTextures = {};
16094
16115
  }
16095
16116
  for (let e54 of this._rttObjectRecyclePool)
16096
- e54.texture.destroy(), e54.fbo.destroy();
16097
- if (this._rttObjectRecyclePool = [], this.tileExtentBuffer && this.tileExtentBuffer.destroy(), this.debugBuffer && this.debugBuffer.destroy(), this.rasterBoundsBuffer && this.rasterBoundsBuffer.destroy(), this.rasterBoundsBufferPosOnly && this.rasterBoundsBufferPosOnly.destroy(), this.viewportBuffer && this.viewportBuffer.destroy(), this.tileBorderIndexBuffer && this.tileBorderIndexBuffer.destroy(), this.quadTriangleIndexBuffer && this.quadTriangleIndexBuffer.destroy(), this.tileExtentMesh && this.tileExtentMesh.vertexBuffer?.destroy(), this.tileExtentMesh && this.tileExtentMesh.indexBuffer?.destroy(), this.debugOverlayTexture && this.debugOverlayTexture.destroy(), this.cache) {
16117
+ e54.texture.destroy();
16118
+ if (this._rttObjectRecyclePool = [], this._rttSharedFbo) {
16119
+ this._rttSharedFbo.fbo.colorAttachment.set(null), this._rttSharedFbo.fbo.depthAttachment.set(null);
16120
+ let e54 = this.context.gl;
16121
+ e54.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer), e54.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer), this._rttSharedFbo = null;
16122
+ }
16123
+ if (this.tileExtentBuffer && this.tileExtentBuffer.destroy(), this.debugBuffer && this.debugBuffer.destroy(), this.rasterBoundsBuffer && this.rasterBoundsBuffer.destroy(), this.rasterBoundsBufferPosOnly && this.rasterBoundsBufferPosOnly.destroy(), this.viewportBuffer && this.viewportBuffer.destroy(), this.tileBorderIndexBuffer && this.tileBorderIndexBuffer.destroy(), this.quadTriangleIndexBuffer && this.quadTriangleIndexBuffer.destroy(), this.tileExtentMesh && this.tileExtentMesh.vertexBuffer?.destroy(), this.tileExtentMesh && this.tileExtentMesh.indexBuffer?.destroy(), this.debugOverlayTexture && this.debugOverlayTexture.destroy(), this.cache) {
16098
16124
  for (let e54 in this.cache) {
16099
16125
  let t2 = this.cache[e54];
16100
16126
  t2?.program && this.context.gl.deleteProgram(t2.program);
@@ -19889,15 +19915,15 @@ var IntensitiesColors = [
19889
19915
  var SortType;
19890
19916
  ((SortType2) => {
19891
19917
  SortType2["TIME"] = "time";
19892
- SortType2["TIME_ASC"] = "time_asc";
19918
+ SortType2["TIME_DESC"] = "time_desc";
19893
19919
  SortType2["MAGNITUDE"] = "magnitude";
19894
- SortType2["MAGNITUDE_ASC"] = "magnitude_asc";
19920
+ SortType2["MAGNITUDE_DESC"] = "magnitude_desc";
19895
19921
  })(SortType ||= {});
19896
19922
  var SortFilters = new Map([
19897
19923
  ["time", ["get", "timeMs"]],
19898
- ["time_asc", ["-", ["get", "timeMs"]]],
19924
+ ["time_desc", ["-", ["get", "timeMs"]]],
19899
19925
  ["magnitude", ["get", "magnitude"]],
19900
- ["magnitude_asc", ["-", ["get", "magnitude"]]]
19926
+ ["magnitude_desc", ["-", ["get", "magnitude"]]]
19901
19927
  ]);
19902
19928
  var Intervals = new Map([
19903
19929
  ["small", ["all", ["<", ["get", "magnitude"], 2.5]]],
@@ -21134,7 +21160,7 @@ class SismoMap {
21134
21160
  events,
21135
21161
  moveView = true,
21136
21162
  clear = true,
21137
- sortOrder,
21163
+ sortOrder = "time" /* TIME */,
21138
21164
  opacity = 0.8,
21139
21165
  minRadius
21140
21166
  }) {