@maptalks/vt 0.124.3 → 0.124.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @maptalks/vt v0.124.3
2
+ * @maptalks/vt v0.124.4
3
3
  * LICENSE : undefined
4
4
  * (c) 2016-2026 maptalks.org
5
5
  */
@@ -13964,25 +13964,25 @@
13964
13964
  isBloom(e) {
13965
13965
  return !!this.getSymbol(e.properties.symbolIndex).bloom;
13966
13966
  }
13967
- addMesh(e, t, n) {
13968
- const i = n.isRenderingTerrain && this.isTerrainVector(), r = this.getRenderFBO(n);
13969
- e = e.filter((e => this.isMeshVisible(e))), i && (e = e.filter((e => e.geometry && e.geometry.data.aTerrainAltitude)));
13970
- const o = void 0 === this.sceneConfig.castShadow || !!this.sceneConfig.castShadow, s = !(!n || !n.bloom);
13971
- for (let t = 0, a = e.length; t < a; t++) {
13972
- const a = e[t], l = this.isBloom(a) && s;
13973
- a.bloom = l, a.castShadow = o;
13967
+ addMesh(e, t, i) {
13968
+ const r = i.isRenderingTerrain && this.isTerrainVector(), o = this.getRenderFBO(i);
13969
+ e = e.filter((e => this.isMeshVisible(e))), r && (e = e.filter((e => e.geometry && e.geometry.data.aTerrainAltitude || e instanceof n.reshader.InstancedMesh && e.instancedData.aTerrainAltitude)));
13970
+ const s = void 0 === this.sceneConfig.castShadow || !!this.sceneConfig.castShadow, a = !(!i || !i.bloom);
13971
+ for (let t = 0, n = e.length; t < n; t++) {
13972
+ const n = e[t], l = this.isBloom(n) && a;
13973
+ n.bloom = l, n.castShadow = s;
13974
13974
  let h = !1;
13975
- const c = a.defines || {};
13976
- if (!!c.HAS_BLOOM !== l && (h = !0, l ? c.HAS_BLOOM = 1 : delete c.HAS_BLOOM), i) {
13977
- if (a.geometry.data.aTerrainAltitude) {
13978
- const e = a.geometry;
13979
- this._updateTerrainAltitude(e, e.data, e.properties, e.desc.positionSize, n);
13975
+ const c = n.defines || {};
13976
+ if (!!c.HAS_BLOOM !== l && (h = !0, l ? c.HAS_BLOOM = 1 : delete c.HAS_BLOOM), r) {
13977
+ if (n.geometry.data.aTerrainAltitude) {
13978
+ const e = n.geometry;
13979
+ this._updateTerrainAltitude(e, e.data, e.properties, e.desc.positionSize, i);
13980
13980
  }
13981
- a.geometry.data.aTerrainAltitude && !c.HAS_TERRAIN_ALTITUDE && (c.HAS_TERRAIN_ALTITUDE = 1,
13981
+ n.geometry.data.aTerrainAltitude && !c.HAS_TERRAIN_ALTITUDE && (c.HAS_TERRAIN_ALTITUDE = 1,
13982
13982
  h = !0);
13983
13983
  } else c.HAS_TERRAIN_ALTITUDE && (delete c.HAS_TERRAIN_ALTITUDE, h = !0);
13984
- h && a.setDefines(c), r ? a.setUniform("targetFramebuffer", r) : a.uniforms.targetFramebuffer && (a.uniforms.targetFramebuffer = null),
13985
- this._highlightMesh(a);
13984
+ h && n.setDefines(c), o ? n.setUniform("targetFramebuffer", o) : n.uniforms.targetFramebuffer && (n.uniforms.targetFramebuffer = null),
13985
+ this._highlightMesh(n);
13986
13986
  }
13987
13987
  this.scene.addMesh(e);
13988
13988
  }
@@ -15227,7 +15227,7 @@
15227
15227
  i.LINESOFAR_TYPE = o ? "u32" : "f32", this.shader = new n.reshader.MeshShader({
15228
15228
  name: "vt-line",
15229
15229
  vert: ur,
15230
- frag: "#define SHADER_NAME LINE\n#define DEVICE_PIXEL_RATIO 1.0\nprecision highp float;\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\n#include <vsm_shadow_frag>\n#endif\nuniform lowp float blendSrcIsOne;\nuniform lowp float lineBlur;\nuniform float isRenderingTerrain;\n#ifdef HAS_COLOR\nvarying vec4 vColor;\n#else\nuniform lowp vec4 lineColor;\n#endif\n#include <highlight_frag>\n#ifdef HAS_STROKE_COLOR\nvarying vec4 vStrokeColor;\n#else\nuniform lowp vec4 lineStrokeColor;\n#endif\n#ifdef HAS_OPACITY\nvarying float vOpacity;\n#else\nuniform lowp float lineOpacity;\n#endif\nuniform float layerOpacity;\n#ifdef HAS_PATTERN\nuniform sampler2D linePatternFile;\nuniform vec2 atlasSize;\nuniform float flipY;\n#ifdef HAS_PATTERN_ANIM\nvarying float vLinePatternAnimSpeed;\n#else\nuniform float linePatternAnimSpeed;\n#endif\n#ifdef HAS_PATTERN_GAP\nvarying float vLinePatternGap;\n#else\nuniform float linePatternGap;\n#endif\nuniform vec4 linePatterGapColor;\nvarying vec4 vTexInfo;\nvec2 c(vec2 d) {\n vec2 e = mod(d, 1.);\n vec2 f = vTexInfo.xy;\n vec2 h = vTexInfo.zw;\n return (f + e * h) / atlasSize;\n}\n#endif\nvarying vec2 vNormal;\nvarying vec2 vWidth;\nvarying float vGammaScale;\n#ifndef ENABLE_TILE_STENCIL\nvarying vec2 vPosition;\n#endif\nuniform float tileExtent;\n#ifdef HAS_DASHARRAY\n#ifdef HAS_DASHARRAY_ATTR\nvarying vec4 vDasharray;\n#else\nuniform vec4 lineDasharray;\n#endif\n#ifdef HAS_DASHARRAY_COLOR\nvarying vec4 vDashColor;\n#else\nuniform vec4 lineDashColor;\n#endif\n#endif\n#if defined(HAS_PATTERN) || defined(HAS_DASHARRAY) || defined(HAS_GRADIENT) || defined(HAS_TRAIL)\nvarying highp float vLinesofar;\n#endif\n#ifdef HAS_TRAIL\nuniform float trailSpeed;\nuniform float trailLength;\nuniform float trailCircle;\n#endif\n#if defined(HAS_TRAIL) || defined(HAS_PATTERN)\nuniform float currentTime;\n#endif\nfloat i(float j, float k) {\n float l = k / 2.;\n float m = abs(j - l);\n float n = (.1 + 1. / DEVICE_PIXEL_RATIO) * vGammaScale;\n return clamp(min(m + n, l - m) / n, .0, 1.);\n}\nvarying vec3 vVertex;\nuniform vec3 cameraPosition;\nuniform float cameraToCenterDistance;\nuniform float fogFactor;\nvoid main() {\n \n#ifndef ENABLE_TILE_STENCIL\nfloat o = sign(tileExtent - min(tileExtent, abs(vPosition.x))) * sign(1. + sign(vPosition.x)) * sign(tileExtent - min(tileExtent, abs(vPosition.y))) * sign(1. + sign(vPosition.y));\n if(o == .0) {\n discard;\n }\n#endif\n#if defined(HAS_PATTERN) || defined(HAS_DASHARRAY) || defined(HAS_GRADIENT) || defined(HAS_TRAIL)\nfloat u = vLinesofar;\n#endif\nfloat v = length(vNormal) * vWidth.s;\n#ifdef HAS_PATTERN\nvec2 h = vTexInfo.zw;\n float A = sign(h.x * h.y);\n float B = mix(lineBlur, .0, A);\n#else\nfloat B = lineBlur;\n#endif\nfloat n = (B + 1. / DEVICE_PIXEL_RATIO) * vGammaScale;\n float C = clamp(min(v - (vWidth.t - n), vWidth.s - v) / n, .0, 1.);\n#ifdef HAS_COLOR\nvec4 D = vColor / 255.;\n#else\nvec4 D = lineColor;\n#endif\n#ifdef HAS_PATTERN\nif(A == 1.) {\n \n#ifdef HAS_PATTERN_GAP\nfloat E = vLinePatternGap;\n#else\nfloat E = linePatternGap;\n#endif\n#ifdef HAS_PATTERN_ANIM\nfloat F = vLinePatternAnimSpeed;\n#else\nfloat F = linePatternAnimSpeed;\n#endif\nfloat G = h.x * vWidth.s * 2. / h.y;\n float H = G * (1. + E);\n u += mod(currentTime * -F * .2, H);\n float I = mod(u / H, 1.);\n float J = mod((flipY * vNormal.y + 1.) / 2., 1.);\n vec4 K = texture2D(linePatternFile, c(vec2(I * (1. + E), J)));\n float L = clamp(sign(1. / (1. + E) - I) + .000001, .0, 1.);\n K = mix(linePatterGapColor, K, L);\n D *= K;\n }\n#endif\n#ifdef HAS_DASHARRAY\n#ifdef HAS_DASHARRAY_ATTR\nvec4 M = vDasharray;\n#else\nvec4 M = lineDasharray;\n#endif\n#ifdef HAS_DASHARRAY_COLOR\nvec4 N = vDashColor;\n#else\nvec4 N = lineDashColor;\n#endif\nfloat k = M[0] + M[1] + M[2] + M[3];\n float j = mod(u, k);\n float O = max(sign(M[0] - j), .0);\n float P = j - M[0] - M[1];\n float Q = max(sign(P), .0) * max(sign(M[2] - P), .0);\n float R = O + Q;\n float S = i(j, M[0]);\n float T = i(P, M[2]);\n float U = S * O + T * Q;\n D = D * (1. - U) + N * U;\n#endif\n#ifdef HAS_STROKE_COLOR\nvec4 V = vStrokeColor / 255.;\n#else\nvec4 V = lineStrokeColor;\n#endif\nV = mix(D, V, sign(vWidth.t));\n D = V * C + max(sign(vWidth.t - v), .0) * D * (1. - C);\n#ifdef HAS_TRAIL\nfloat W = mod(u - currentTime * trailSpeed * .1, trailCircle);\n float X = W < trailLength ? mix(.0, 1., W / trailLength) : .0;\n D *= X;\n#endif\n#ifdef HAS_OPACITY\nfloat Y = vOpacity;\n#else\nfloat Y = lineOpacity;\n#endif\ngl_FragColor = D * Y * layerOpacity;\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\nfloat Z = shadow_computeShadow();\n gl_FragColor.rgb = shadow_blend(gl_FragColor.rgb, Z);\n#endif\nfloat ba;\n if(isRenderingTerrain == 1.) {\n ba = 1.;\n } else {\n ba = clamp(cameraToCenterDistance * 1.5 / distance(vVertex, cameraPosition), .0, 1.);\n }\n gl_FragColor *= ba;\n gl_FragColor = highlight_blendColor(gl_FragColor);\n if(fogFactor > .0) {\n vec3 bb = vec3(vVertex[0] - cameraPosition[0], vVertex[1] - cameraPosition[1], vVertex[2] - cameraPosition[2]);\n float bc = length(bb);\n float bd = clamp(1. - (bc * 1.2) / fogFactor, .0, 1.);\n gl_FragColor *= bd;\n }\n}",
15230
+ frag: "#define SHADER_NAME LINE\n#define DEVICE_PIXEL_RATIO 1.0\nprecision highp float;\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\n#include <vsm_shadow_frag>\n#endif\nuniform lowp float blendSrcIsOne;\nuniform lowp float lineBlur;\nuniform float isRenderingTerrain;\n#ifdef HAS_COLOR\nvarying vec4 vColor;\n#else\nuniform lowp vec4 lineColor;\n#endif\n#include <highlight_frag>\n#ifdef HAS_STROKE_COLOR\nvarying vec4 vStrokeColor;\n#else\nuniform lowp vec4 lineStrokeColor;\n#endif\n#ifdef HAS_OPACITY\nvarying float vOpacity;\n#else\nuniform lowp float lineOpacity;\n#endif\nuniform float layerOpacity;\n#ifdef HAS_PATTERN\nuniform sampler2D linePatternFile;\nuniform vec2 atlasSize;\nuniform float flipY;\n#ifdef HAS_PATTERN_ANIM\nvarying float vLinePatternAnimSpeed;\n#else\nuniform float linePatternAnimSpeed;\n#endif\n#ifdef HAS_PATTERN_GAP\nvarying float vLinePatternGap;\n#else\nuniform float linePatternGap;\n#endif\nuniform vec4 linePatterGapColor;\nvarying vec4 vTexInfo;\nvec2 c(vec2 d) {\n vec2 e = mod(d, 1.);\n vec2 f = vTexInfo.xy;\n vec2 h = vTexInfo.zw;\n return (f + e * h) / atlasSize;\n}\n#endif\nvarying vec2 vNormal;\nvarying vec2 vWidth;\nvarying float vGammaScale;\n#ifndef ENABLE_TILE_STENCIL\nvarying vec2 vPosition;\n#endif\nuniform float tileExtent;\n#ifdef HAS_DASHARRAY\n#ifdef HAS_DASHARRAY_ATTR\nvarying vec4 vDasharray;\n#else\nuniform vec4 lineDasharray;\n#endif\n#ifdef HAS_DASHARRAY_COLOR\nvarying vec4 vDashColor;\n#else\nuniform vec4 lineDashColor;\n#endif\n#endif\n#if defined(HAS_PATTERN) || defined(HAS_DASHARRAY) || defined(HAS_GRADIENT) || defined(HAS_TRAIL)\nvarying highp float vLinesofar;\n#endif\n#ifdef HAS_TRAIL\nuniform float trailSpeed;\nuniform float trailLength;\nuniform float trailCircle;\n#endif\n#if defined(HAS_TRAIL) || defined(HAS_PATTERN)\nuniform float currentTime;\n#endif\nfloat i(float j, float k) {\n float l = k / 2.;\n float m = abs(j - l);\n float n = (.1 + 1. / DEVICE_PIXEL_RATIO) * vGammaScale;\n return clamp(min(m + n, l - m) / n, .0, 1.);\n}\nvarying vec3 vVertex;\nuniform vec3 cameraPosition;\nuniform float cameraToCenterDistance;\nuniform float fogFactor;\nvoid main() {\n \n#ifndef ENABLE_TILE_STENCIL\nfloat o = sign(tileExtent - min(tileExtent, abs(vPosition.x))) * sign(1. + sign(vPosition.x)) * sign(tileExtent - min(tileExtent, abs(vPosition.y))) * sign(1. + sign(vPosition.y));\n if(o == .0) {\n discard;\n }\n#endif\n#if defined(HAS_PATTERN) || defined(HAS_DASHARRAY) || defined(HAS_GRADIENT) || defined(HAS_TRAIL)\nfloat u = vLinesofar;\n#endif\nfloat v = length(vNormal) * vWidth.s;\n#ifdef HAS_PATTERN\nvec2 h = vTexInfo.zw;\n float A = sign(h.x * h.y);\n float B = mix(lineBlur, .0, A);\n#else\nfloat B = lineBlur;\n#endif\nfloat n = (B + 1. / DEVICE_PIXEL_RATIO) * vGammaScale;\n float C = clamp(min(v - (vWidth.t - n), vWidth.s - v) / n, .0, 1.);\n if(lineBlur == .0) {\n C = 1.;\n }\n#ifdef HAS_COLOR\nvec4 D = vColor / 255.;\n#else\nvec4 D = lineColor;\n#endif\n#ifdef HAS_PATTERN\nif(A == 1.) {\n \n#ifdef HAS_PATTERN_GAP\nfloat E = vLinePatternGap;\n#else\nfloat E = linePatternGap;\n#endif\n#ifdef HAS_PATTERN_ANIM\nfloat F = vLinePatternAnimSpeed;\n#else\nfloat F = linePatternAnimSpeed;\n#endif\nfloat G = h.x * vWidth.s * 2. / h.y;\n float H = G * (1. + E);\n u += mod(currentTime * -F * .2, H);\n float I = mod(u / H, 1.);\n float J = mod((flipY * vNormal.y + 1.) / 2., 1.);\n vec4 K = texture2D(linePatternFile, c(vec2(I * (1. + E), J)));\n float L = clamp(sign(1. / (1. + E) - I) + .000001, .0, 1.);\n K = mix(linePatterGapColor, K, L);\n D *= K;\n }\n#endif\n#ifdef HAS_DASHARRAY\n#ifdef HAS_DASHARRAY_ATTR\nvec4 M = vDasharray;\n#else\nvec4 M = lineDasharray;\n#endif\n#ifdef HAS_DASHARRAY_COLOR\nvec4 N = vDashColor;\n#else\nvec4 N = lineDashColor;\n#endif\nfloat k = M[0] + M[1] + M[2] + M[3];\n float j = mod(u, k);\n float O = max(sign(M[0] - j), .0);\n float P = j - M[0] - M[1];\n float Q = max(sign(P), .0) * max(sign(M[2] - P), .0);\n float R = O + Q;\n float S = i(j, M[0]);\n float T = i(P, M[2]);\n float U = S * O + T * Q;\n D = D * (1. - U) + N * U;\n#endif\n#ifdef HAS_STROKE_COLOR\nvec4 V = vStrokeColor / 255.;\n#else\nvec4 V = lineStrokeColor;\n#endif\nV = mix(D, V, sign(vWidth.t));\n D = V * C + max(sign(vWidth.t - v), .0) * D * (1. - C);\n#ifdef HAS_TRAIL\nfloat W = mod(u - currentTime * trailSpeed * .1, trailCircle);\n float X = W < trailLength ? mix(.0, 1., W / trailLength) : .0;\n D *= X;\n#endif\n#ifdef HAS_OPACITY\nfloat Y = vOpacity;\n#else\nfloat Y = lineOpacity;\n#endif\ngl_FragColor = D * Y * layerOpacity;\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\nfloat Z = shadow_computeShadow();\n gl_FragColor.rgb = shadow_blend(gl_FragColor.rgb, Z);\n#endif\nfloat ba;\n if(isRenderingTerrain == 1.) {\n ba = 1.;\n } else {\n ba = clamp(cameraToCenterDistance * 1.5 / distance(vVertex, cameraPosition), .0, 1.);\n }\n gl_FragColor *= ba;\n gl_FragColor = highlight_blendColor(gl_FragColor);\n if(fogFactor > .0) {\n vec3 bb = vec3(vVertex[0] - cameraPosition[0], vVertex[1] - cameraPosition[1], vVertex[2] - cameraPosition[2]);\n float bc = length(bb);\n float bd = clamp(1. - (bc * 1.2) / fogFactor, .0, 1.);\n gl_FragColor *= bd;\n }\n}",
15231
15231
  wgslVert: n.getWGSLSource("vt_line_vert"),
15232
15232
  wgslFrag: n.getWGSLSource("vt_line_frag"),
15233
15233
  uniforms: t,
@@ -17888,16 +17888,18 @@
17888
17888
  const ms = [], ys = [];
17889
17889
  function xs(e, t, i, r, o, s, a, l, h, c, u, f, d) {
17890
17890
  const {aVertical: p} = i.geometry.properties, g = p[s];
17891
- let m, y, x = gs.call(this, ms, i, r, o, s, l, h, c, !1);
17892
- if (!x) return null;
17893
- if (n.vec3.copy(e, x), x = gs.call(this, ys, i, r, o, a, l, h, c, !1), d = Math.PI * d / 180,
17894
- !x || Math.abs(x[2]) > d) return null;
17895
- if (n.vec3.copy(t, x), f && (n.vec2.transformMat2(ms, ms, f), n.vec2.transformMat2(ys, ys, f)),
17891
+ let m = gs.call(this, ms, i, r, o, s, l, h, c, !1);
17892
+ if (!m) return null;
17893
+ if (n.vec3.copy(e, m), m = gs.call(this, ys, i, r, o, a, l, h, c, !1), d = Math.PI * d / 180,
17894
+ !m) return null;
17895
+ let y, x, _ = Math.abs(m[2] - e[2]);
17896
+ if (_ > Math.PI && (_ = 2 * Math.PI - _), _ > d) return null;
17897
+ if (n.vec3.copy(t, m), f && (n.vec2.transformMat2(ms, ms, f), n.vec2.transformMat2(ys, ys, f)),
17896
17898
  g) {
17897
17899
  const e = Math.abs(ys[1] - ms[1]), t = Math.abs(ys[0] - ms[0]) * u;
17898
- y = ms[0] > ys[0] ? 1 : 0, e > t ? (m = 1, y = ms[1] < ys[1] ? 0 : 1) : m = 0;
17899
- } else m = 0, y = ms[0] > ys[0] ? 1 : 0;
17900
- return 2 * y + m;
17900
+ x = ms[0] > ys[0] ? 1 : 0, e > t ? (y = 1, x = ms[1] < ys[1] ? 0 : 1) : y = 0;
17901
+ } else y = 0, x = ms[0] > ys[0] ? 1 : 0;
17902
+ return 2 * x + y;
17901
17903
  }
17902
17904
  var _s = "#define SHADER_NAME TEXT_VERT\n#define RAD 0.0174532925\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec4 aShape;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float textPitchWithMap;\n#endif\n#if defined(HAS_TEXT_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float textRotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_TEXT_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 glyphTexSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vTextSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nattribute vec2 aTextHalo;\nvarying vec2 vTextHalo;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_SIZE\nfloat d = aTextSize * layerScale;\n#else\nfloat d = textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\nfloat e = aTextDx;\n#else\nfloat e = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat f = aTextDy;\n#else\nfloat f = textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nfloat h = aPitchAlign;\n#else\nfloat h = textPitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = textRotateWithMap;\n#endif\ngl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n float j = gl_Position.w;\n float k;\n if(isRenderingTerrain == 1. && h == 1.) {\n k = 1.;\n } else {\n float l = (1. - cameraToCenterDistance / j) * textPerspectiveRatio;\n k = clamp(.5 + .5 * (1. - l), .0, 4.);\n }\n#ifdef HAS_TEXT_ROTATION\nfloat m = -aRotation / 9362. - mapRotation * i;\n#else\nfloat m = -textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n \n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\nm += mapRotation;\n#else\nm -= mapRotation;\n#endif\n }\n float n = sin(m);\n float o = cos(m);\n mat2 u = mat2(o, -1. * n, n, o);\n vec2 v = aShape.xy / 10.0;\n if(h == 1. && flipY == .0) {\n v = v * vec2(1., -1.);\n }\n vec2 A = aShape.zw;\n v = u * (v / glyphSize * d);\n float B;\n if(isRenderingTerrain == 1.) {\n B = 1.;\n } else {\n B = j / cameraToCenterDistance;\n }\n if(h == .0) {\n vec2 C = v * 2. / canvasSize;\n gl_Position.xy += C * k * j;\n } else {\n float D;\n if(isRenderingTerrain == 1.) {\n D = tileRatio / zoomScale;\n } else {\n D = tileRatio / zoomScale * B * k;\n }\n vec2 C = v;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c + vec3(C, .0) * D, 1.);\n }\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * j;\n#ifndef PICKING_MODE\nif(h == .0) {\n vGammaScale = mix(1., B, textPerspectiveRatio);\n } else {\n vGammaScale = B + mapPitch / 4.;\n }\n vTexCoord = A / glyphTexSize;\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vTextSize = d;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nvTextHalo = aTextHalo;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool E = aOpacity == 255.;\n#else\nbool E = true;\n#endif\nfbo_picking_setData(gl_Position.w, E);\n#endif\n}", vs = "#define SHADER_NAME TEXT_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aTexCoord;\n#ifdef HAS_OFFSET_Z\nattribute vec3 aOffset;\nuniform float altitudeScale;\n#else\nattribute vec2 aOffset;\n#endif\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float textPitchWithMap;\n#endif\nuniform float zoomScale;\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform float mapPitch;\nuniform vec2 glyphTexSize;\nuniform vec2 canvasSize;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\nuniform float textPitchFilter;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vTextSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nattribute vec2 aTextHalo;\nvarying vec2 vTextHalo;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_DX\nfloat d = aTextDx;\n#else\nfloat d = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat e = aTextDy;\n#else\nfloat e = textDy;\n#endif\n#ifdef HAS_TEXT_SIZE\nfloat f = aTextSize * layerScale;\n#else\nfloat f = textSize * layerScale;\n#endif\n#ifdef HAS_PITCH_ALIGN\nfloat h = aPitchAlign;\n#else\nfloat h = textPitchWithMap;\n#endif\ngl_Position = projViewModelMatrix * vec4(c, 1.);\n float i = gl_Position.w;\n float j = i / cameraToCenterDistance;\n float k;\n if(isRenderingTerrain == 1.) {\n k = 1.;\n } else {\n float l = (1. - cameraToCenterDistance / i) * textPerspectiveRatio;\n k = clamp(.5 + .5 * (1. - l), .0, 4.);\n }\n#ifdef HAS_OFFSET_Z\nvec3 m = aOffset / 10.0;\n m[2] /= altitudeScale;\n#else\nvec3 m = vec3(aOffset / 10.0, .0);\n#endif\nvec2 n = aTexCoord;\n if(h == 1.) {\n float o;\n if(isRenderingTerrain == 1.) {\n o = tileRatio;\n } else {\n o = tileRatio / zoomScale * j * k;\n }\n m.xy *= o;\n gl_Position = projViewModelMatrix * vec4(c + m, 1.);\n } else {\n gl_Position.xy += m.xy * 2. / canvasSize * k * i;\n }\n gl_Position.xy += vec2(d, -e) * 2. / canvasSize * i;\n if(textPitchFilter > .0) {\n if(textPitchFilter == 1. && h == .0 || textPitchFilter == 2. && h == 1.) {\n gl_Position = vec4(-9999., -9999., .0, 1.);\n }\n }\n#ifndef PICKING_MODE\nif(h == 1.) {\n vGammaScale = j + mapPitch / 4.;\n } else {\n vGammaScale = mix(1., j, textPerspectiveRatio);\n }\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vTexCoord = n / glyphTexSize;\n vTextSize = f;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nvTextHalo = aTextHalo;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool u = aOpacity == 255.;\n#else\nbool u = true;\n#endif\nfbo_picking_setData(gl_Position.w, u);\n#endif\n}", bs = "#define SHADER_NAME TEXT_FRAG\nprecision mediump float;\nuniform float layerOpacity;\nvarying vec2 vTexCoord;\nvarying float vOpacity;\nuniform float alphaTest;\n#include <text_render_frag>\n#include <highlight_frag>\nvoid main() {\n gl_FragColor = renderText(vTexCoord) * vOpacity * layerOpacity;\n if(gl_FragColor.a < alphaTest) {\n discard;\n }\n gl_FragColor = highlight_blendColor(gl_FragColor);\n}";
17903
17905
  const {TextUtil: As, PackUtil: Ts, FilterUtil: ws, TEXT_MAX_ANGLE: Ss} = h(), Ms = function(e) {
@@ -18345,18 +18347,21 @@
18345
18347
  };
18346
18348
  let c;
18347
18349
  if (this.isWebGPU()) {
18348
- const {aPosition: e, aAltitude: t, aColor: r, aPickingId: o} = i.data, s = new Int16Array([ -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1 ]), a = new n.reshader.Geometry({
18349
- pointPosition: s
18350
+ const {aPosition: e, aAltitude: t, aColor: r, aPickingId: o, aTerrainAltitude: s} = i.data, a = new Int16Array([ -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1 ]), u = new n.reshader.Geometry({
18351
+ pointPosition: a
18350
18352
  }, 6, 0, {
18351
18353
  positionSize: 2,
18352
18354
  positionAttribute: "pointPosition"
18353
18355
  });
18354
- bt(a.properties, i.properties), a.generateBuffers(this.regl), c = new n.reshader.InstancedMesh({
18356
+ bt(u.properties, i.properties), u.generateBuffers(this.regl);
18357
+ const f = {
18355
18358
  instancePosition: e,
18356
18359
  instanceAltitude: t,
18357
18360
  aColor: r,
18358
18361
  aPickingId: o
18359
- }, i.getVertexCount(), a, l, h), c.generateInstancedBuffers(this.regl);
18362
+ };
18363
+ s && (f.aTerrainAltitude = s), c = new n.reshader.InstancedMesh(f, i.getVertexCount(), u, l, h),
18364
+ c.generateInstancedBuffers(this.regl);
18360
18365
  } else c = new n.reshader.Mesh(i, l, h);
18361
18366
  const u = {};
18362
18367
  return c.geometry.data.aAltitude && (u.HAS_ALTITUDE = 1), i.data.aColor && (u.HAS_COLOR = 1),
@@ -23557,6 +23562,6 @@
23557
23562
  e.SYMBOLS_NEED_REBUILD_IN_VT = bf, e.TerrainFlatMaskPainter = Ml, e.TerrainFlatMaskPlugin = Ul,
23558
23563
  e.TextPainter = ta, e.TextPlugin = Fl, e.TubePlugin = Ll, e.Vector3DLayer = mn,
23559
23564
  e.VectorTileLayer = ln, e.VectorTileLayerRenderer = qt, e.WaterPlugin = Vl, e.WireframePainter = Pa,
23560
- e.WireframePlugin = El, e.getVectorPacker = h, "undefined" != typeof console && console.log("@maptalks/vt v0.124.3");
23565
+ e.WireframePlugin = El, e.getVectorPacker = h, "undefined" != typeof console && console.log("@maptalks/vt v0.124.4");
23561
23566
  }));
23562
23567
  //# sourceMappingURL=maptalks.vt.js.map