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.
@@ -17999,15 +17999,24 @@ var vf = class {
17999
17999
  }
18000
18000
  update(e42, t2, n2) {
18001
18001
  let { width: r2, height: i2 } = e42, a2 = (this.size?.[0] !== r2 || this.size[1] !== i2) && !n2, { context: o2 } = this, { gl: s2 } = o2;
18002
- this.useMipmap = !!t2?.useMipmap, s2.bindTexture(s2.TEXTURE_2D, this.texture), o2.pixelStoreUnpackFlipY.set(false), o2.pixelStoreUnpack.set(1);
18002
+ 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);
18003
18003
  let c2 = this.format === s2.RGBA && t2?.premultiply !== false;
18004
18004
  if (a2)
18005
- 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));
18005
+ if (this.size = [r2, i2], this.format === s2.RGBA && r2 > 0 && i2 > 0) {
18006
+ let t3 = this.useMipmap ? Math.floor(Math.log2(Math.max(r2, i2))) + 1 : 1;
18007
+ if (s2.texStorage2D(s2.TEXTURE_2D, t3, s2.RGBA8, r2, i2), _f(e42)) {
18008
+ o2.pixelStoreUnpackPremultiplyAlpha.set(false);
18009
+ let { data: t4 } = e42;
18010
+ c2 && t4 && (t4 = rf(t4)), t4 && s2.texSubImage2D(s2.TEXTURE_2D, 0, 0, 0, r2, i2, s2.RGBA, s2.UNSIGNED_BYTE, t4);
18011
+ } else
18012
+ o2.pixelStoreUnpackPremultiplyAlpha.set(c2), s2.texSubImage2D(s2.TEXTURE_2D, 0, 0, 0, s2.RGBA, s2.UNSIGNED_BYTE, e42);
18013
+ } else
18014
+ _f(e42) ? (o2.pixelStoreUnpackPremultiplyAlpha.set(false), this._uploadRawData(e42, c2, r2, i2, s2)) : (o2.pixelStoreUnpackPremultiplyAlpha.set(c2), this._uploadDomImage(e42, s2));
18006
18015
  else {
18007
18016
  let { x: t3, y: a3 } = n2 || { x: 0, y: 0 };
18008
18017
  _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));
18009
18018
  }
18010
- this.useMipmap && this.isSizePowerOfTwo() && s2.generateMipmap(s2.TEXTURE_2D), o2.pixelStoreUnpackFlipY.setDefault(), o2.pixelStoreUnpack.setDefault(), o2.pixelStoreUnpackPremultiplyAlpha.setDefault();
18019
+ this.useMipmap && s2.generateMipmap(s2.TEXTURE_2D), o2.pixelStoreUnpackFlipY.setDefault(), o2.pixelStoreUnpack.setDefault(), o2.pixelStoreUnpackPremultiplyAlpha.setDefault();
18011
18020
  }
18012
18021
  _uploadDomImage(e42, t2) {
18013
18022
  t2.texImage2D(t2.TEXTURE_2D, 0, this.format, this.format, t2.UNSIGNED_BYTE, e42);
@@ -18025,10 +18034,7 @@ var vf = class {
18025
18034
  }
18026
18035
  bind(e42, t2, n2) {
18027
18036
  let { context: r2 } = this, { gl: i2 } = r2;
18028
- 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);
18029
- }
18030
- isSizePowerOfTwo() {
18031
- return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 == 0;
18037
+ 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);
18032
18038
  }
18033
18039
  destroy() {
18034
18040
  let { gl: e42 } = this.context;
@@ -20173,7 +20179,7 @@ var $h = class {
20173
20179
  return t2.width = t2.height = e44, t2;
20174
20180
  }
20175
20181
  draw(e44) {
20176
- 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 };
20182
+ 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 };
20177
20183
  if (c2 === 0 || l === 0)
20178
20184
  return m2;
20179
20185
  let { ctx: h2, buffer: g2, gridInner: _2, gridOuter: v2 } = this;
@@ -20191,11 +20197,13 @@ var $h = class {
20191
20197
  v2[t3] = Math.max(0, n3), _2[t3] = Math.max(0, -n3);
20192
20198
  }
20193
20199
  }
20194
- 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);
20195
- let x = 255 / this.radius, S2 = 255 * (1 - this.cutoff);
20200
+ eg(v2, 0, 0, u2, d2, u2, this.f, this.v, this.z);
20201
+ let x = Math.min(g2, 1);
20202
+ eg(_2, g2 - x, g2 - x, c2 + 2 * x, l + 2 * x, u2, this.f, this.v, this.z);
20203
+ let S2 = 255 / this.radius, C = 255 * (1 - this.cutoff);
20196
20204
  for (let e45 = 0;e45 < f2; e45++) {
20197
20205
  let t3 = Math.sqrt(v2[e45]) - Math.sqrt(_2[e45]);
20198
- p2[e45] = Math.round(S2 - x * t3);
20206
+ p2[e45] = Math.round(C - S2 * t3);
20199
20207
  }
20200
20208
  return m2;
20201
20209
  }
@@ -24175,7 +24183,7 @@ var Wx = class {
24175
24183
  releaseRTT(e51) {
24176
24184
  if (this.rttObjects.length !== 0) {
24177
24185
  for (let t2 of this.rttObjects)
24178
- e51.releaseRTT(t2);
24186
+ t2 && e51.releaseRTT(t2);
24179
24187
  this.rttObjects.length = 0;
24180
24188
  }
24181
24189
  }
@@ -25435,14 +25443,14 @@ var CC = `uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_
25435
25443
  fragColor=vec4(1.0);
25436
25444
  #endif
25437
25445
  }`;
25438
- var wC = `in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}`;
25446
+ var wC = `layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}`;
25439
25447
  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;
25440
25448
  #ifdef OVERDRAW_INSPECTOR
25441
25449
  fragColor=vec4(1.0);
25442
25450
  #endif
25443
25451
  }`;
25444
- 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);}`;
25445
- var DC = `in vec3 v_data;in float v_visibility;
25452
+ 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);}`;
25453
+ var DC = `in vec3 v_data;flat in float v_visibility;
25446
25454
  #pragma mapbox: define highp vec4 color
25447
25455
  #pragma mapbox: define mediump float radius
25448
25456
  #pragma mapbox: define lowp float blur
@@ -25463,7 +25471,7 @@ vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_bl
25463
25471
  fragColor=vec4(1.0);
25464
25472
  #endif
25465
25473
  }`;
25466
- 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;
25474
+ 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;
25467
25475
  #pragma mapbox: define highp vec4 color
25468
25476
  #pragma mapbox: define mediump float radius
25469
25477
  #pragma mapbox: define lowp float blur
@@ -25501,7 +25509,7 @@ var AC = { prelude: jC(xC, SC), projectionMercator: jC(``, `float projectLineThi
25501
25509
  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
25502
25510
  );}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);
25503
25511
  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
25504
- );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;
25512
+ );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;
25505
25513
  #pragma mapbox: define highp float weight
25506
25514
  #define GAUSS_COEF 0.3989422804014327
25507
25515
  void main() {
@@ -25510,7 +25518,7 @@ float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS
25510
25518
  #ifdef OVERDRAW_INSPECTOR
25511
25519
  fragColor=vec4(1.0);
25512
25520
  #endif
25513
- }`, `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;
25521
+ }`, `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;
25514
25522
  #pragma mapbox: define highp float weight
25515
25523
  #pragma mapbox: define mediump float radius
25516
25524
  const highp float ZERO=1.0/255.0/16.0;
@@ -25528,7 +25536,7 @@ gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center))
25528
25536
  #ifdef OVERDRAW_INSPECTOR
25529
25537
  fragColor=vec4(0.0);
25530
25538
  #endif
25531
- }`, `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
25539
+ }`, `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
25532
25540
  precision highp float;
25533
25541
  #endif
25534
25542
  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
@@ -25536,7 +25544,7 @@ uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_st
25536
25544
  #ifdef OVERDRAW_INSPECTOR
25537
25545
  fragColor=vec4(1.0);
25538
25546
  #endif
25539
- }`, `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() {
25547
+ }`, `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() {
25540
25548
  #ifdef GLOBE
25541
25549
  gl_Position=projectTileFor3D(a_pos,0.0);
25542
25550
  #else
@@ -25551,7 +25559,7 @@ fragColor=color*opacity;
25551
25559
  #ifdef OVERDRAW_INSPECTOR
25552
25560
  fragColor=vec4(1.0);
25553
25561
  #endif
25554
- }`, `uniform vec2 u_fill_translate;in vec2 a_pos;
25562
+ }`, `uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;
25555
25563
  #pragma mapbox: define highp vec4 color
25556
25564
  #pragma mapbox: define lowp float opacity
25557
25565
  void main() {
@@ -25573,7 +25581,7 @@ if (v_depth > 1.0) {discard;}
25573
25581
  #ifdef OVERDRAW_INSPECTOR
25574
25582
  fragColor=vec4(1.0);
25575
25583
  #endif
25576
- }`, `uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
25584
+ }`, `uniform vec2 u_world;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;
25577
25585
  #ifdef GLOBE
25578
25586
  out float v_depth;
25579
25587
  #endif
@@ -25604,7 +25612,7 @@ if (v_depth > 1.0) {discard;}
25604
25612
  #ifdef OVERDRAW_INSPECTOR
25605
25613
  fragColor=vec4(1.0);
25606
25614
  #endif
25607
- }`, `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;
25615
+ }`, `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;
25608
25616
  #ifdef GLOBE
25609
25617
  out float v_depth;
25610
25618
  #endif
@@ -25638,7 +25646,7 @@ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern
25638
25646
  #ifdef OVERDRAW_INSPECTOR
25639
25647
  fragColor=vec4(1.0);
25640
25648
  #endif
25641
- }`, `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;
25649
+ }`, `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;
25642
25650
  #pragma mapbox: define lowp float opacity
25643
25651
  #pragma mapbox: define lowp vec4 pattern_from
25644
25652
  #pragma mapbox: define lowp vec4 pattern_to
@@ -25654,9 +25662,9 @@ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern
25654
25662
  #ifdef OVERDRAW_INSPECTOR
25655
25663
  fragColor=vec4(1.0);
25656
25664
  #endif
25657
- }`, `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;
25665
+ }`, `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;
25658
25666
  #ifdef TERRAIN3D
25659
- in vec2 a_centroid;
25667
+ layout(location=2) in vec2 a_centroid;
25660
25668
  #endif
25661
25669
  out vec4 v_color;
25662
25670
  #pragma mapbox: define highp float base
@@ -25700,9 +25708,9 @@ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern
25700
25708
  #ifdef OVERDRAW_INSPECTOR
25701
25709
  fragColor=vec4(1.0);
25702
25710
  #endif
25703
- }`, `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;
25711
+ }`, `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;
25704
25712
  #ifdef TERRAIN3D
25705
- in vec2 a_centroid;
25713
+ layout(location=2) in vec2 a_centroid;
25706
25714
  #endif
25707
25715
  #ifdef GLOBE
25708
25716
  out vec3 v_sphere_pos;
@@ -25742,7 +25750,7 @@ uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u
25742
25750
  #ifdef OVERDRAW_INSPECTOR
25743
25751
  fragColor=vec4(1.0);
25744
25752
  #endif
25745
- }`, `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];
25753
+ }`, `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];
25746
25754
  #define PI 3.141592653589793
25747
25755
  #define STANDARD 0
25748
25756
  #define COMBINED 1
@@ -25755,7 +25763,7 @@ float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/
25755
25763
  #ifdef OVERDRAW_INSPECTOR
25756
25764
  fragColor=vec4(1.0);
25757
25765
  #endif
25758
- }`, `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;
25766
+ }`, `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;
25759
25767
  #ifdef GLOBE
25760
25768
  in float v_depth;
25761
25769
  #endif
@@ -25775,7 +25783,7 @@ fragColor=vec4(1.0);
25775
25783
  #endif
25776
25784
  }`, `
25777
25785
  #define scale 0.015873016
25778
- 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;
25786
+ 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;
25779
25787
  #ifdef GLOBE
25780
25788
  out float v_depth;
25781
25789
  #endif
@@ -25801,7 +25809,7 @@ v_gamma_scale=1.0;
25801
25809
  #else
25802
25810
  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;
25803
25811
  #endif
25804
- 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;
25812
+ 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;
25805
25813
  #ifdef GLOBE
25806
25814
  in float v_depth;
25807
25815
  #endif
@@ -25819,7 +25827,7 @@ fragColor=vec4(1.0);
25819
25827
  #endif
25820
25828
  }`, `
25821
25829
  #define scale 0.015873016
25822
- 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;
25830
+ 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;
25823
25831
  #ifdef GLOBE
25824
25832
  out float v_depth;
25825
25833
  #endif
@@ -25846,7 +25854,7 @@ float extrude_length_without_perspective=length(dist);float extrude_length_with_
25846
25854
  v_width2=vec2(outset,inset);}`), linePattern: jC(`#ifdef GL_ES
25847
25855
  precision highp float;
25848
25856
  #endif
25849
- 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;
25857
+ 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;
25850
25858
  #ifdef GLOBE
25851
25859
  in float v_depth;
25852
25860
  #endif
@@ -25873,7 +25881,7 @@ fragColor=vec4(1.0);
25873
25881
  }`, `
25874
25882
  #define scale 0.015873016
25875
25883
  #define LINE_DISTANCE_SCALE 2.0
25876
- 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;
25884
+ 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;
25877
25885
  #ifdef GLOBE
25878
25886
  out float v_depth;
25879
25887
  #endif
@@ -25907,7 +25915,7 @@ v_gamma_scale=1.0;
25907
25915
  #else
25908
25916
  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;
25909
25917
  #endif
25910
- 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;
25918
+ 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;
25911
25919
  #ifdef GLOBE
25912
25920
  in float v_depth;
25913
25921
  #endif
@@ -25936,7 +25944,7 @@ fragColor=vec4(1.0);
25936
25944
  }`, `
25937
25945
  #define scale 0.015873016
25938
25946
  #define LINE_DISTANCE_SCALE 2.0
25939
- 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;
25947
+ 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;
25940
25948
  #ifdef GLOBE
25941
25949
  out float v_depth;
25942
25950
  #endif
@@ -25968,7 +25976,7 @@ v_gamma_scale=1.0;
25968
25976
  #else
25969
25977
  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;
25970
25978
  #endif
25971
- 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;
25979
+ 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;
25972
25980
  #ifdef GLOBE
25973
25981
  in float v_depth;
25974
25982
  #endif
@@ -25995,7 +26003,7 @@ fragColor=vec4(1.0);
25995
26003
  }`, `
25996
26004
  #define scale 0.015873016
25997
26005
  #define LINE_DISTANCE_SCALE 2.0
25998
- 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;
26006
+ 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;
25999
26007
  #ifdef GLOBE
26000
26008
  out float v_depth;
26001
26009
  #endif
@@ -26029,19 +26037,19 @@ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_p
26029
26037
  #ifdef OVERDRAW_INSPECTOR
26030
26038
  fragColor=vec4(0.0);
26031
26039
  #endif
26032
- }`, `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);
26040
+ }`, `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);
26033
26041
  #ifdef OVERDRAW_INSPECTOR
26034
26042
  fragColor=vec4(1.0);
26035
26043
  #endif
26036
- }`, `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;
26044
+ }`, `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;
26037
26045
  #ifdef GLOBE
26038
26046
  if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
26039
26047
  #endif
26040
- 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;
26048
+ 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;
26041
26049
  #ifdef OVERDRAW_INSPECTOR
26042
26050
  fragColor=vec4(1.0);
26043
26051
  #endif
26044
- }`, `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;
26052
+ }`, `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;
26045
26053
  #pragma mapbox: define lowp float opacity
26046
26054
  void main() {
26047
26055
  #pragma mapbox: initialize lowp float opacity
@@ -26066,7 +26074,7 @@ float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scal
26066
26074
  #ifdef OVERDRAW_INSPECTOR
26067
26075
  fragColor=vec4(1.0);
26068
26076
  #endif
26069
- }`, `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;
26077
+ }`, `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;
26070
26078
  #pragma mapbox: define highp vec4 fill_color
26071
26079
  #pragma mapbox: define highp vec4 halo_color
26072
26080
  #pragma mapbox: define lowp float opacity
@@ -26087,7 +26095,7 @@ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos
26087
26095
  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
26088
26096
  #define SDF 1.0
26089
26097
  #define ICON 0.0
26090
- 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;
26098
+ 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;
26091
26099
  #pragma mapbox: define highp vec4 fill_color
26092
26100
  #pragma mapbox: define highp vec4 halo_color
26093
26101
  #pragma mapbox: define lowp float halo_width
@@ -26097,7 +26105,7 @@ void main() {
26097
26105
  #pragma mapbox: initialize highp vec4 halo_color
26098
26106
  #pragma mapbox: initialize lowp float halo_width
26099
26107
  #pragma mapbox: initialize lowp float halo_blur
26100
- 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;
26108
+ 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;
26101
26109
  #ifdef OVERDRAW_INSPECTOR
26102
26110
  fragColor=vec4(1.0);
26103
26111
  #endif
@@ -26105,7 +26113,7 @@ return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float ga
26105
26113
  #ifdef OVERDRAW_INSPECTOR
26106
26114
  fragColor=vec4(1.0);
26107
26115
  #endif
26108
- }`, `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;
26116
+ }`, `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;
26109
26117
  #pragma mapbox: define highp vec4 fill_color
26110
26118
  #pragma mapbox: define highp vec4 halo_color
26111
26119
  #pragma mapbox: define lowp float opacity
@@ -26123,14 +26131,14 @@ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ra
26123
26131
  #ifdef GLOBE
26124
26132
  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);}
26125
26133
  #endif
26126
- 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
26134
+ 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
26127
26135
  precision highp float;
26128
26136
  #endif
26129
26137
  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
26130
- );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);}`) };
26138
+ );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);}`) };
26131
26139
  function jC(e53, t2) {
26132
- 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 = {};
26133
- return e53 = e53.replace(n2, (e54, t3, n3, r3, i3) => (s2[i3] = true, t3 === `define` ? `
26140
+ 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 = {};
26141
+ return e53 = e53.replace(n2, (e54, t3, n3, r3, i3) => (c2[i3] = true, t3 === `define` ? `
26134
26142
  #ifndef HAS_UNIFORM_u_${i3}
26135
26143
  in ${n3} ${r3} ${i3};
26136
26144
  #else
@@ -26142,10 +26150,10 @@ uniform ${n3} ${r3} u_${i3};
26142
26150
  #endif
26143
26151
  `)), t2 = t2.replace(n2, (e54, t3, n3, r3, i3) => {
26144
26152
  let a3 = r3 === `float` ? `vec2` : `vec4`, o3 = i3.match(/color/) ? `color` : a3;
26145
- return s2[i3] ? t3 === `define` ? `
26153
+ return c2[i3] ? t3 === `define` ? `
26146
26154
  #ifndef HAS_UNIFORM_u_${i3}
26147
26155
  uniform lowp float u_${i3}_t;
26148
- in ${n3} ${a3} a_${i3};
26156
+ layout(location = ${s2++}) in ${n3} ${a3} a_${i3};
26149
26157
  out ${n3} ${r3} ${i3};
26150
26158
  #else
26151
26159
  uniform ${n3} ${r3} u_${i3};
@@ -26165,7 +26173,7 @@ uniform ${n3} ${r3} u_${i3};
26165
26173
  ` : t3 === `define` ? `
26166
26174
  #ifndef HAS_UNIFORM_u_${i3}
26167
26175
  uniform lowp float u_${i3}_t;
26168
- in ${n3} ${a3} a_${i3};
26176
+ layout(location = ${s2++}) in ${n3} ${a3} a_${i3};
26169
26177
  #else
26170
26178
  uniform ${n3} ${r3} u_${i3};
26171
26179
  #endif
@@ -26304,8 +26312,13 @@ var rT = class {
26304
26312
  let w2 = {};
26305
26313
  this.numAttributes = f2.length;
26306
26314
  for (let e54 = 0;e54 < this.numAttributes; e54++)
26307
- f2[e54] && (l.bindAttribLocation(this.program, e54, f2[e54]), this.attributes[f2[e54]] = e54);
26308
- if (l.linkProgram(this.program), !l.getProgramParameter(this.program, l.LINK_STATUS))
26315
+ f2[e54] && (this.attributes[f2[e54]] = e54);
26316
+ l.linkProgram(this.program);
26317
+ for (let e54 in this.attributes) {
26318
+ let t3 = l.getAttribLocation(this.program, e54);
26319
+ t3 >= 0 && (this.attributes[e54] = t3);
26320
+ }
26321
+ if (!l.getProgramParameter(this.program, l.LINK_STATUS))
26309
26322
  throw Error(`Program failed to link: ${l.getProgramInfoLog(this.program)}`);
26310
26323
  l.deleteShader(C), l.deleteShader(S2);
26311
26324
  for (let e54 of v2)
@@ -27236,7 +27249,7 @@ function ED(e53, t2, n2) {
27236
27249
  }
27237
27250
  function DD(e53, t2, n2) {
27238
27251
  let r2 = e53.gl, i2 = r2.createTexture();
27239
- 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);
27252
+ 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);
27240
27253
  let a2 = e53.createFramebuffer(t2, n2, false, false);
27241
27254
  return a2.colorAttachment.set(i2), a2;
27242
27255
  }
@@ -27325,7 +27338,7 @@ function LD(e53, t2, n2, r2, i2, a2, o2) {
27325
27338
  }
27326
27339
  function RD(e53, t2, n2) {
27327
27340
  let r2 = e53.gl, i2 = r2.createTexture();
27328
- 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);
27341
+ 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);
27329
27342
  let a2 = e53.createFramebuffer(t2, n2, true, true);
27330
27343
  return a2.colorAttachment.set(i2), a2.depthAttachment.set(e53.createRenderbuffer(r2.DEPTH_STENCIL, t2, n2)), a2;
27331
27344
  }
@@ -27660,7 +27673,7 @@ function wO(e53, t2, n2) {
27660
27673
  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 };
27661
27674
  var EO = class e53 {
27662
27675
  constructor(e54, t2) {
27663
- 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;
27676
+ 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;
27664
27677
  }
27665
27678
  resize(e54, t2, n2) {
27666
27679
  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)
@@ -27844,9 +27857,17 @@ var EO = class e53 {
27844
27857
  acquireRTT(e54) {
27845
27858
  let t2 = this.context.gl, n2 = this._rttObjectRecyclePool.pop();
27846
27859
  if (n2)
27847
- 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;
27848
- let r2 = this.context.createFramebuffer(e54, e54, true, true), i2 = new vf(this.context, { width: e54, height: e54, data: null }, t2.RGBA);
27849
- 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 };
27860
+ 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;
27861
+ let r2 = new vf(this.context, { width: e54, height: e54, data: null }, t2.RGBA);
27862
+ 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 };
27863
+ }
27864
+ bindRTT(e54) {
27865
+ let t2 = this.context.gl, n2 = e54.size;
27866
+ if (!this._rttSharedFbo) {
27867
+ let e55 = this.context.createFramebuffer(n2, n2, true, true), r2 = this.context.createRenderbuffer(t2.DEPTH_STENCIL, n2, n2);
27868
+ e55.depthAttachment.set(r2), this._rttSharedFbo = { fbo: e55, depthRenderbuffer: r2, size: n2 };
27869
+ }
27870
+ 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);
27850
27871
  }
27851
27872
  releaseRTT(e54) {
27852
27873
  this._rttObjectRecyclePool.push(e54);
@@ -27889,8 +27910,13 @@ var EO = class e53 {
27889
27910
  this._tileTextures = {};
27890
27911
  }
27891
27912
  for (let e54 of this._rttObjectRecyclePool)
27892
- e54.texture.destroy(), e54.fbo.destroy();
27893
- 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) {
27913
+ e54.texture.destroy();
27914
+ if (this._rttObjectRecyclePool = [], this._rttSharedFbo) {
27915
+ this._rttSharedFbo.fbo.colorAttachment.set(null), this._rttSharedFbo.fbo.depthAttachment.set(null);
27916
+ let e54 = this.context.gl;
27917
+ e54.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer), e54.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer), this._rttSharedFbo = null;
27918
+ }
27919
+ 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) {
27894
27920
  for (let e54 in this.cache) {
27895
27921
  let t2 = this.cache[e54];
27896
27922
  t2?.program && this.context.gl.deleteProgram(t2.program);
@@ -32997,15 +33023,15 @@ var IntensitiesColors = [
32997
33023
  var SortType;
32998
33024
  ((SortType2) => {
32999
33025
  SortType2["TIME"] = "time";
33000
- SortType2["TIME_ASC"] = "time_asc";
33026
+ SortType2["TIME_DESC"] = "time_desc";
33001
33027
  SortType2["MAGNITUDE"] = "magnitude";
33002
- SortType2["MAGNITUDE_ASC"] = "magnitude_asc";
33028
+ SortType2["MAGNITUDE_DESC"] = "magnitude_desc";
33003
33029
  })(SortType ||= {});
33004
33030
  var SortFilters = new Map([
33005
33031
  ["time", ["get", "timeMs"]],
33006
- ["time_asc", ["-", ["get", "timeMs"]]],
33032
+ ["time_desc", ["-", ["get", "timeMs"]]],
33007
33033
  ["magnitude", ["get", "magnitude"]],
33008
- ["magnitude_asc", ["-", ["get", "magnitude"]]]
33034
+ ["magnitude_desc", ["-", ["get", "magnitude"]]]
33009
33035
  ]);
33010
33036
  var Intervals = new Map([
33011
33037
  ["small", ["all", ["<", ["get", "magnitude"], 2.5]]],
@@ -34242,7 +34268,7 @@ class SismoMap {
34242
34268
  events,
34243
34269
  moveView = true,
34244
34270
  clear = true,
34245
- sortOrder,
34271
+ sortOrder = "time" /* TIME */,
34246
34272
  opacity = 0.8,
34247
34273
  minRadius
34248
34274
  }) {
@@ -1,6 +1,6 @@
1
1
  import 'maplibre-gl/dist/maplibre-gl.css';
2
2
  import * as maplibregl from 'maplibre-gl';
3
- import type { EventGeoJSON, NamazuEvent, GeoJSON, Station, StationGeoJSON, Phase, FilterQuery, EventTestimonyGeoJSON, IntensityGeoJSON, SortType, ContourGeoJSON } from './types';
3
+ import { EventGeoJSON, NamazuEvent, GeoJSON, Station, StationGeoJSON, Phase, FilterQuery, EventTestimonyGeoJSON, IntensityGeoJSON, SortType, ContourGeoJSON } from './types';
4
4
  import { NamazuSource, ContourType } from './types';
5
5
  import { type Result } from 'neverthrow';
6
6
  export declare class SismoMap {
package/dist/types.d.ts CHANGED
@@ -400,9 +400,9 @@ export declare const MagnitudesColors: (string | number | string[])[];
400
400
  export declare const IntensitiesColors: (string | number | string[])[];
401
401
  export declare enum SortType {
402
402
  TIME = "time",
403
- TIME_ASC = "time_asc",
403
+ TIME_DESC = "time_desc",
404
404
  MAGNITUDE = "magnitude",
405
- MAGNITUDE_ASC = "magnitude_asc"
405
+ MAGNITUDE_DESC = "magnitude_desc"
406
406
  }
407
407
  export declare const SortFilters: Map<string, DataDrivenPropertyValueSpecification<number>>;
408
408
  export declare const Intervals: Map<string, (string | (string | number | string[])[])[]>;