@maptalks/vt 0.63.5 → 0.63.8
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.
- package/dist/maptalks.vt.js +352 -343
- package/dist/maptalks.vt.mjs +344 -335
- package/package.json +1 -1
package/dist/maptalks.vt.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/vt v0.63.
|
|
2
|
+
* @maptalks/vt v0.63.8
|
|
3
3
|
* LICENSE : undefined
|
|
4
4
|
* (c) 2016-2022 maptalks.org
|
|
5
5
|
*/
|
|
@@ -11,7 +11,7 @@ import { reshader as n, vec3 as i, mat4 as r, GroundPainter as s, createREGL as
|
|
|
11
11
|
|
|
12
12
|
import { compileStyle as d, createFilter as p } from "@maptalks/feature-filter";
|
|
13
13
|
|
|
14
|
-
import { loadFunctionTypes as
|
|
14
|
+
import { loadFunctionTypes as y, isFunctionDefinition as m, interpolated as g, piecewiseConstant as v } from "@maptalks/function-type";
|
|
15
15
|
|
|
16
16
|
import { IconRequestor as x, GlyphRequestor as b, PointPack as A, VectorPack as w, StyledPoint as _, LinePack as S, StyledVector as M, SYMBOLS_NEED_REBUILD_IN_VECTOR as P, PolygonPack as T, SYMBOLS_NEED_REBUILD_IN_VT as k } from "@maptalks/vector-packer";
|
|
17
17
|
|
|
@@ -999,6 +999,9 @@ class nt extends t.renderer.TileLayerCanvasRenderer {
|
|
|
999
999
|
dataConfig: {
|
|
1000
1000
|
type: "fill",
|
|
1001
1001
|
only2D: !0
|
|
1002
|
+
},
|
|
1003
|
+
sceneConfig: {
|
|
1004
|
+
antialias: !0
|
|
1002
1005
|
}
|
|
1003
1006
|
};
|
|
1004
1007
|
break;
|
|
@@ -1428,14 +1431,14 @@ class ct extends t.TileLayer {
|
|
|
1428
1431
|
pt(this.Bt, e, i), o = this.Bt[e].style[i].Yt;
|
|
1429
1432
|
const t = r[o].renderPlugin;
|
|
1430
1433
|
t.sceneConfig || (t.sceneConfig = {}), s = t.sceneConfig;
|
|
1431
|
-
} else
|
|
1434
|
+
} else yt(r, e), s = r[e].renderPlugin.sceneConfig;
|
|
1432
1435
|
if (R(s, n), Array.isArray(this.options.style)) {
|
|
1433
1436
|
const t = this.options.style[e].renderPlugin;
|
|
1434
1437
|
t.sceneConfig || (t.sceneConfig = {}), R(t.sceneConfig, n);
|
|
1435
1438
|
} else {
|
|
1436
1439
|
const r = this.Z(t, this.options.style);
|
|
1437
1440
|
let s;
|
|
1438
|
-
void 0 !== i ? (pt(r, e, i), s = r[e].style[i].renderPlugin) : (
|
|
1441
|
+
void 0 !== i ? (pt(r, e, i), s = r[e].style[i].renderPlugin) : (yt(r, e), s = r[e].renderPlugin),
|
|
1439
1442
|
s.sceneConfig || (s.sceneConfig = {}), R(s.sceneConfig, n);
|
|
1440
1443
|
}
|
|
1441
1444
|
const a = this.getRenderer();
|
|
@@ -1458,13 +1461,13 @@ class ct extends t.TileLayer {
|
|
|
1458
1461
|
const r = this.Z(t);
|
|
1459
1462
|
if (!r) return this;
|
|
1460
1463
|
let s, o = e;
|
|
1461
|
-
void 0 !== i ? (pt(this.Bt, e, i), o = this.Bt[e].style[i].Yt, s = r[o].renderPlugin.dataConfig) : (
|
|
1464
|
+
void 0 !== i ? (pt(this.Bt, e, i), o = this.Bt[e].style[i].Yt, s = r[o].renderPlugin.dataConfig) : (yt(r, e),
|
|
1462
1465
|
s = r[e].renderPlugin.dataConfig);
|
|
1463
1466
|
const a = R({}, s);
|
|
1464
1467
|
if (R(s, n), Array.isArray(this.options.style)) R(this.options.style[e].renderPlugin.dataConfig, n); else {
|
|
1465
1468
|
const r = this.Z(t, this.options.style);
|
|
1466
1469
|
let s;
|
|
1467
|
-
void 0 !== i ? (pt(r, e, i), s = r[e].style[i].renderPlugin) : (
|
|
1470
|
+
void 0 !== i ? (pt(r, e, i), s = r[e].style[i].renderPlugin) : (yt(r, e), s = r[e].renderPlugin),
|
|
1468
1471
|
s.dataConfig || (s.dataConfig = {}), R(s.dataConfig, n);
|
|
1469
1472
|
}
|
|
1470
1473
|
const l = this.getRenderer();
|
|
@@ -1508,7 +1511,7 @@ class ct extends t.TileLayer {
|
|
|
1508
1511
|
let f = l.options.style;
|
|
1509
1512
|
Array.isArray(f) || (f = l.Z(e, l.options.style));
|
|
1510
1513
|
const u = JSON.parse(JSON.stringify(s));
|
|
1511
|
-
return void 0 !== r ? (pt(f, n, r), void 0 === o ? f[n].style[r].symbol = u : f[n].style[r].symbol[o] = u) : (
|
|
1514
|
+
return void 0 !== r ? (pt(f, n, r), void 0 === o ? f[n].style[r].symbol = u : f[n].style[r].symbol[o] = u) : (yt(f, n),
|
|
1512
1515
|
void 0 === o ? f[n].symbol = u : f[n].symbol[o] = u), c;
|
|
1513
1516
|
}
|
|
1514
1517
|
const f = this.getRenderer();
|
|
@@ -1661,7 +1664,7 @@ function pt(t, e, n) {
|
|
|
1661
1664
|
if (!t[e] || !t[e].style || !t[e].style[n]) throw new Error(`No plugin defined at feature style of ${e} - ${n}`);
|
|
1662
1665
|
}
|
|
1663
1666
|
|
|
1664
|
-
function
|
|
1667
|
+
function yt(t, e) {
|
|
1665
1668
|
if (!t[e]) throw new Error("No plugin defined at style of " + e);
|
|
1666
1669
|
}
|
|
1667
1670
|
|
|
@@ -1670,7 +1673,7 @@ ct.prototype._getTileZoom = function(e) {
|
|
|
1670
1673
|
}, ct.registerJSONType("VectorTileLayer"), ct.mergeOptions(ht), ct.registerRenderer("gl", nt),
|
|
1671
1674
|
ct.registerRenderer("canvas", null);
|
|
1672
1675
|
|
|
1673
|
-
class
|
|
1676
|
+
class mt extends ct {
|
|
1674
1677
|
getTileUrl(t, e, n) {
|
|
1675
1678
|
const i = this.getMap().getResolution(n);
|
|
1676
1679
|
return super.getTileUrl(t, e, function(t) {
|
|
@@ -1678,11 +1681,11 @@ class yt extends ct {
|
|
|
1678
1681
|
}(i));
|
|
1679
1682
|
}
|
|
1680
1683
|
static fromJSON(t) {
|
|
1681
|
-
return t && "MapboxVectorTileLayer" === t.type ? new
|
|
1684
|
+
return t && "MapboxVectorTileLayer" === t.type ? new mt(t.id, t.options) : null;
|
|
1682
1685
|
}
|
|
1683
1686
|
}
|
|
1684
1687
|
|
|
1685
|
-
|
|
1688
|
+
mt.registerJSONType("MapboxVectorTileLayer");
|
|
1686
1689
|
|
|
1687
1690
|
const gt = 12756274 * Math.PI / (256 * Math.pow(2, 20));
|
|
1688
1691
|
|
|
@@ -1733,7 +1736,7 @@ class vt extends ct {
|
|
|
1733
1736
|
de(e) {
|
|
1734
1737
|
this.ue = new t.Extent(...e);
|
|
1735
1738
|
}
|
|
1736
|
-
|
|
1739
|
+
ye(t, e) {
|
|
1737
1740
|
N(t) ? lt.getJSON(t, e) : lt.getJSON(t.url, t, e);
|
|
1738
1741
|
}
|
|
1739
1742
|
getData() {
|
|
@@ -2269,7 +2272,7 @@ let Ct = new Float32Array(1);
|
|
|
2269
2272
|
|
|
2270
2273
|
class Ft extends t.renderer.CanvasRenderer {
|
|
2271
2274
|
constructor(...t) {
|
|
2272
|
-
super(...t), this.features = {}, this.
|
|
2275
|
+
super(...t), this.features = {}, this.me = {}, this.F = 1, this.ge = {}, this.ve = {},
|
|
2273
2276
|
this.xe = {}, this.be = {}, this.Ae = {}, this.we = !0, this._e = {
|
|
2274
2277
|
id: 0,
|
|
2275
2278
|
pickingId: 0
|
|
@@ -2512,7 +2515,7 @@ class Ft extends t.renderer.CanvasRenderer {
|
|
|
2512
2515
|
Array.isArray(r) || (r = [ r ]);
|
|
2513
2516
|
const s = [], o = [], a = this.getMap().getZoom();
|
|
2514
2517
|
let l, h;
|
|
2515
|
-
l = Array.isArray(e) ? e.map(t => t ?
|
|
2518
|
+
l = Array.isArray(e) ? e.map(t => t ? y(t, () => a) : t) : y(e, () => a), h = Array.isArray(e) ? e.map(t => t ? w.genFnTypes(t) : t) : w.genFnTypes(e);
|
|
2516
2519
|
for (let t = 0; t < r.length; t++) {
|
|
2517
2520
|
if (!r[t]) continue;
|
|
2518
2521
|
const i = Array.isArray(e) ? e[t] : e, s = Array.isArray(l) ? l[t] : l, o = Array.isArray(h) ? h[t] : h, a = new _(r, i, s, o, n).getIconAndGlyph();
|
|
@@ -2565,8 +2568,8 @@ class Ft extends t.renderer.CanvasRenderer {
|
|
|
2565
2568
|
if (n[0].geometry.properties.aFeaIds.indexOf(d) < 0) return this.tn(), this.setToRedraw(),
|
|
2566
2569
|
!1;
|
|
2567
2570
|
}
|
|
2568
|
-
const
|
|
2569
|
-
return Promise.all(
|
|
2571
|
+
const y = R({}, o), m = p.map(t => this.createVectorPacks(r, s, y, t, n[0], i));
|
|
2572
|
+
return Promise.all(m).then(t => {
|
|
2570
2573
|
for (let n = 0; n < t.length; n++) {
|
|
2571
2574
|
let i;
|
|
2572
2575
|
if (Array.isArray(e)) {
|
|
@@ -2651,7 +2654,7 @@ class Ft extends t.renderer.CanvasRenderer {
|
|
|
2651
2654
|
const e = t[_t];
|
|
2652
2655
|
this.features[e] && this.hn(e), this.features[e] = St(t, this._e, this.features[e]);
|
|
2653
2656
|
const n = this.features[e];
|
|
2654
|
-
return this.cn(n), this.features[e][_t] = e, this.
|
|
2657
|
+
return this.cn(n), this.features[e][_t] = e, this.me[e] = t, e;
|
|
2655
2658
|
}
|
|
2656
2659
|
cn(t) {
|
|
2657
2660
|
if (!t) return;
|
|
@@ -2690,7 +2693,7 @@ class Ft extends t.renderer.CanvasRenderer {
|
|
|
2690
2693
|
const s = r.pick(t, e, n.tolerance);
|
|
2691
2694
|
if (s && s.data && s.data.feature) {
|
|
2692
2695
|
const t = s.data.feature;
|
|
2693
|
-
i.push(this.
|
|
2696
|
+
i.push(this.me[t[_t]]);
|
|
2694
2697
|
}
|
|
2695
2698
|
}), i;
|
|
2696
2699
|
}
|
|
@@ -2727,7 +2730,7 @@ class Ft extends t.renderer.CanvasRenderer {
|
|
|
2727
2730
|
if (t && t.length) {
|
|
2728
2731
|
for (let e = 0; e < t.length; e++) {
|
|
2729
2732
|
const n = t[e][_t];
|
|
2730
|
-
void 0 !== n && (delete this.
|
|
2733
|
+
void 0 !== n && (delete this.me[n], this.hn(n), delete this.features[n]);
|
|
2731
2734
|
}
|
|
2732
2735
|
this.tn(), Et(this);
|
|
2733
2736
|
}
|
|
@@ -2767,12 +2770,12 @@ class Ft extends t.renderer.CanvasRenderer {
|
|
|
2767
2770
|
this.tn();
|
|
2768
2771
|
}
|
|
2769
2772
|
onGeometryShow(t) {
|
|
2770
|
-
this.
|
|
2773
|
+
this.yn(t);
|
|
2771
2774
|
}
|
|
2772
2775
|
onGeometryHide(t) {
|
|
2773
|
-
this.
|
|
2776
|
+
this.yn(t);
|
|
2774
2777
|
}
|
|
2775
|
-
|
|
2778
|
+
yn(t) {
|
|
2776
2779
|
const e = t.target, n = e[_t], i = this.features[n];
|
|
2777
2780
|
if (i) {
|
|
2778
2781
|
const t = e.isVisible();
|
|
@@ -2783,10 +2786,10 @@ class Ft extends t.renderer.CanvasRenderer {
|
|
|
2783
2786
|
if (t === i.visible) return;
|
|
2784
2787
|
i.visible = t;
|
|
2785
2788
|
}
|
|
2786
|
-
this.
|
|
2789
|
+
this.mn(), Et(this);
|
|
2787
2790
|
}
|
|
2788
2791
|
}
|
|
2789
|
-
|
|
2792
|
+
mn() {
|
|
2790
2793
|
this.Le = !0;
|
|
2791
2794
|
}
|
|
2792
2795
|
onGeometryPropertiesChange(t) {
|
|
@@ -2804,7 +2807,9 @@ class Ft extends t.renderer.CanvasRenderer {
|
|
|
2804
2807
|
this.prepareRequestors(), this.pickingFBO = this.canvas.pickingFBO || this.regl.framebuffer(this.canvas.width, this.canvas.height),
|
|
2805
2808
|
this.painter = this.createPainter();
|
|
2806
2809
|
const e = At.get3DPainterClass("icon"), n = R({}, Mt, Pt);
|
|
2807
|
-
this.Pe = new e(this.regl, this.layer, n, this.layer.options.sceneConfig, 0)
|
|
2810
|
+
this.Pe = new e(this.regl, this.layer, n, this.layer.options.sceneConfig, 0), this.Pe.setTextShaderDefines({
|
|
2811
|
+
REVERSE_MAP_ROTATION_ON_PITCH: 1
|
|
2812
|
+
});
|
|
2808
2813
|
const i = At.get3DPainterClass("line"), r = R({}, Tt);
|
|
2809
2814
|
this.Te = new i(this.regl, this.layer, r, this.layer.options.sceneConfig, 0), this.layer.getGeometries() && this.onGeometryAdd(this.layer.getGeometries());
|
|
2810
2815
|
}
|
|
@@ -2920,7 +2925,7 @@ function zt(t, e) {
|
|
|
2920
2925
|
if (Object.keys(t).sort().join() !== Object.keys(e.properties || {}).filter(t => 0 === t.indexOf(It)).map(t => t.substring(It.length)).sort().join()) return !1;
|
|
2921
2926
|
for (const n in t) if (B(t, n)) {
|
|
2922
2927
|
const i = (It + n).trim();
|
|
2923
|
-
if (
|
|
2928
|
+
if (m(t[n]) !== m(e.properties[i])) return !1;
|
|
2924
2929
|
}
|
|
2925
2930
|
return !0;
|
|
2926
2931
|
}
|
|
@@ -3366,7 +3371,7 @@ function ee(t, e, n, i, r, s) {
|
|
|
3366
3371
|
Object.defineProperty(t, e, {
|
|
3367
3372
|
enumerable: !0,
|
|
3368
3373
|
get: function() {
|
|
3369
|
-
const t = Qt(n[i]) ||
|
|
3374
|
+
const t = Qt(n[i]) || m(n[i]) ? r : n[i];
|
|
3370
3375
|
return s ? s(t) : t;
|
|
3371
3376
|
}
|
|
3372
3377
|
});
|
|
@@ -3444,20 +3449,20 @@ function pe(t, e, n) {
|
|
|
3444
3449
|
let h = t.data[s];
|
|
3445
3450
|
if (!h) {
|
|
3446
3451
|
if (_e(e[o])) {
|
|
3447
|
-
h = t.data[s] = new n.type(n.width * r.length),
|
|
3452
|
+
h = t.data[s] = new n.type(n.width * r.length), ye(t, e, n);
|
|
3448
3453
|
return Ae(s, t, t.properties[l], a), h;
|
|
3449
3454
|
}
|
|
3450
3455
|
return null;
|
|
3451
3456
|
}
|
|
3452
|
-
return _e(e[o]) ? (
|
|
3453
|
-
delete t.data[s],
|
|
3457
|
+
return _e(e[o]) ? (ye(t, e, n), h) : (h && h.buffer && h.buffer.destroy && h.buffer.destroy(),
|
|
3458
|
+
delete t.data[s], me(t, s), null);
|
|
3454
3459
|
}
|
|
3455
3460
|
|
|
3456
|
-
function
|
|
3461
|
+
function ye(t, e, n) {
|
|
3457
3462
|
const {attrName: i, symbolName: r} = n, s = function(t) {
|
|
3458
3463
|
if (!t) return be;
|
|
3459
3464
|
const e = [];
|
|
3460
|
-
for (let n = 0; n < t.length; n++)
|
|
3465
|
+
for (let n = 0; n < t.length; n++) m(t[n][1]) && !g(t[n][1]).isZoomConstant && e.push(t[n][0]);
|
|
3461
3466
|
return e;
|
|
3462
3467
|
}(e[r].stops), o = "identity" === e[r].type && function(t, e, n) {
|
|
3463
3468
|
let {features: i} = n.properties;
|
|
@@ -3470,11 +3475,11 @@ function me(t, e, n) {
|
|
|
3470
3475
|
const e = i[t] && i[t].feature;
|
|
3471
3476
|
if (!e) continue;
|
|
3472
3477
|
const n = e.properties && e.properties[s];
|
|
3473
|
-
if (n && (
|
|
3478
|
+
if (n && (m(n) && !g(n).isZoomConstant)) return !0;
|
|
3474
3479
|
}
|
|
3475
3480
|
return !1;
|
|
3476
3481
|
}(n, e[r], t);
|
|
3477
|
-
if (!o && !s.length) return void
|
|
3482
|
+
if (!o && !s.length) return void me(t, i);
|
|
3478
3483
|
const a = t.properties, {features: l, aPickingId: h} = a, c = function(t, e, n, i, r) {
|
|
3479
3484
|
const s = [];
|
|
3480
3485
|
let o = 0, a = e[0];
|
|
@@ -3482,12 +3487,12 @@ function me(t, e, n) {
|
|
|
3482
3487
|
a = e[l], o = l);
|
|
3483
3488
|
return s;
|
|
3484
3489
|
}(l, h, e[r].property, s, o);
|
|
3485
|
-
if (!c.length) return void
|
|
3490
|
+
if (!c.length) return void me(t, i);
|
|
3486
3491
|
const f = t.data[i], u = (fe + i + "Index").trim(), d = (fe + i).trim();
|
|
3487
3492
|
a[u] = c, a[d] = f.BYTES_PER_ELEMENT ? new f.constructor(f) : new n.type(f.length);
|
|
3488
3493
|
}
|
|
3489
3494
|
|
|
3490
|
-
function
|
|
3495
|
+
function me(t, e) {
|
|
3491
3496
|
const n = t.properties, i = (fe + e + "Index").trim(), r = (fe + e).trim();
|
|
3492
3497
|
delete n[i], delete n[r];
|
|
3493
3498
|
}
|
|
@@ -3582,7 +3587,7 @@ function we(t, e, n, i, r, s, o) {
|
|
|
3582
3587
|
}
|
|
3583
3588
|
|
|
3584
3589
|
function _e(t) {
|
|
3585
|
-
return t &&
|
|
3590
|
+
return t && m(t) && t.property;
|
|
3586
3591
|
}
|
|
3587
3592
|
|
|
3588
3593
|
const {loginIBLResOnCanvas: Se, logoutIBLResOnCanvas: Me, getIBLResOnCanvas: Pe} = n.pbr.PBRUtils, Te = [], ke = [], Ie = t => 0 === t.getUniform("level"), Oe = t => t.getUniform("level") > 0;
|
|
@@ -3844,7 +3849,7 @@ class Ce {
|
|
|
3844
3849
|
this.symbolDef[t] = te(n);
|
|
3845
3850
|
const r = this.Bn[t];
|
|
3846
3851
|
for (const t in r) delete r[t];
|
|
3847
|
-
const s = this.getMap(), o =
|
|
3852
|
+
const s = this.getMap(), o = y(this.symbolDef[t], () => [ s.getZoom() ]);
|
|
3848
3853
|
for (const t in o) {
|
|
3849
3854
|
const e = Object.getOwnPropertyDescriptor(o, t);
|
|
3850
3855
|
e.get ? Object.defineProperty(r, t, {
|
|
@@ -3854,7 +3859,7 @@ class Ce {
|
|
|
3854
3859
|
enumerable: !0
|
|
3855
3860
|
}) : r[t] = o[t];
|
|
3856
3861
|
}
|
|
3857
|
-
return
|
|
3862
|
+
return m(n.visible) && (this.Ln[t] = g(n.visible)), i;
|
|
3858
3863
|
}
|
|
3859
3864
|
getSymbolDef(t) {
|
|
3860
3865
|
return this.symbolDef[t.index];
|
|
@@ -3869,8 +3874,8 @@ class Ce {
|
|
|
3869
3874
|
Dn() {
|
|
3870
3875
|
const t = this.getMap(), e = () => [ t.getZoom() ];
|
|
3871
3876
|
this.Bn = [], this.Ln = [];
|
|
3872
|
-
for (let t = 0; t < this.symbolDef.length; t++) this.Bn[t] =
|
|
3873
|
-
this.symbolDef[t] &&
|
|
3877
|
+
for (let t = 0; t < this.symbolDef.length; t++) this.Bn[t] = y(Zt({}, this.symbolDef[t]), e),
|
|
3878
|
+
this.symbolDef[t] && m(this.symbolDef[t].visible) && (this.Ln[t] = g(this.symbolDef[t].visible));
|
|
3874
3879
|
}
|
|
3875
3880
|
getFnTypeConfig(t) {
|
|
3876
3881
|
this.Gn || (this.Gn = []);
|
|
@@ -4218,7 +4223,7 @@ class Ne extends He {
|
|
|
4218
4223
|
define: "HAS_COLOR",
|
|
4219
4224
|
evaluate: (e, i, r) => {
|
|
4220
4225
|
let s = n(t.getZoom(), e);
|
|
4221
|
-
return
|
|
4226
|
+
return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e, !0)), Array.isArray(s) || (s = this.colorCache[s] = this.colorCache[s] || O(s).unitArray()),
|
|
4222
4227
|
s = ie(s), s;
|
|
4223
4228
|
}
|
|
4224
4229
|
}, {
|
|
@@ -4229,7 +4234,7 @@ class Ne extends He {
|
|
|
4229
4234
|
define: "HAS_OPACITY",
|
|
4230
4235
|
evaluate: (e, n, r) => {
|
|
4231
4236
|
let s = i(t.getZoom(), e);
|
|
4232
|
-
return
|
|
4237
|
+
return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), o[0] = 255 * s, o[0];
|
|
4233
4238
|
}
|
|
4234
4239
|
}, {
|
|
4235
4240
|
attrName: "aUVScale",
|
|
@@ -4446,7 +4451,7 @@ class Ve extends He {
|
|
|
4446
4451
|
define: "HAS_COLOR",
|
|
4447
4452
|
evaluate: (e, i, r) => {
|
|
4448
4453
|
let s = n(t.getZoom(), e);
|
|
4449
|
-
return
|
|
4454
|
+
return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e, !0)), Array.isArray(s) || (s = this.colorCache[s] = this.colorCache[s] || O(s).unitArray()),
|
|
4450
4455
|
s = ie(s), s;
|
|
4451
4456
|
}
|
|
4452
4457
|
}, {
|
|
@@ -4482,7 +4487,7 @@ class Ve extends He {
|
|
|
4482
4487
|
define: "HAS_LINE_WIDTH",
|
|
4483
4488
|
evaluate: (e, i, r) => {
|
|
4484
4489
|
let s = n(t.getZoom(), e);
|
|
4485
|
-
return
|
|
4490
|
+
return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), a[0] = Math.round(2 * s),
|
|
4486
4491
|
a[0];
|
|
4487
4492
|
}
|
|
4488
4493
|
}, {
|
|
@@ -4523,7 +4528,7 @@ class Ve extends He {
|
|
|
4523
4528
|
define: "HAS_OPACITY",
|
|
4524
4529
|
evaluate: (e, n, r) => {
|
|
4525
4530
|
let s = i(t.getZoom(), e);
|
|
4526
|
-
return
|
|
4531
|
+
return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), a[0] = 255 * s, a[0];
|
|
4527
4532
|
}
|
|
4528
4533
|
} ];
|
|
4529
4534
|
}
|
|
@@ -4747,18 +4752,18 @@ class $e extends He {
|
|
|
4747
4752
|
const e = this.di.tags[t];
|
|
4748
4753
|
if (this.hi && e && this.fi) {
|
|
4749
4754
|
const t = this.getMap();
|
|
4750
|
-
e.anchor0 = t.containerPointToCoord(this.pi), e.anchor1 = t.containerPointToCoord(this.
|
|
4755
|
+
e.anchor0 = t.containerPointToCoord(this.pi), e.anchor1 = t.containerPointToCoord(this.yi),
|
|
4751
4756
|
e.anchor0.z = t.getZoom(), e.anchor0.width = t.width, e.anchor0.height = t.height;
|
|
4752
4757
|
}
|
|
4753
4758
|
this.getMap().collisionFrameTime += performance.now() - this.li;
|
|
4754
4759
|
}
|
|
4755
4760
|
ui(t) {
|
|
4756
|
-
const e = this.getMap(), n = e.getZoom(), [i, r] = this.
|
|
4757
|
-
return !i || !r || i.z !== n || i.width !== e.width || i.height !== e.height || i.distanceTo(this.pi) > 2 || r.distanceTo(this.
|
|
4761
|
+
const e = this.getMap(), n = e.getZoom(), [i, r] = this.mi(t);
|
|
4762
|
+
return !i || !r || i.z !== n || i.width !== e.width || i.height !== e.height || i.distanceTo(this.pi) > 2 || r.distanceTo(this.yi) > 2;
|
|
4758
4763
|
}
|
|
4759
4764
|
gi() {
|
|
4760
4765
|
const e = this.getMap();
|
|
4761
|
-
this.vi = {}, this.pi = new t.Point(e.width / 2, e.height / 3), this.
|
|
4766
|
+
this.vi = {}, this.pi = new t.Point(e.width / 2, e.height / 3), this.yi = new t.Point(e.width / 2, 2 * e.height / 3),
|
|
4762
4767
|
delete this.hi, this.di || (this.di = {
|
|
4763
4768
|
tags: {}
|
|
4764
4769
|
}), this.ai = {
|
|
@@ -4788,7 +4793,7 @@ class $e extends He {
|
|
|
4788
4793
|
const e = this.layer.options.collisionFrameLimit;
|
|
4789
4794
|
return t.collisionFrameTime <= e;
|
|
4790
4795
|
}
|
|
4791
|
-
|
|
4796
|
+
mi(t) {
|
|
4792
4797
|
const e = "__meshAnchorKey".trim(), n = this.di.tags[t];
|
|
4793
4798
|
if (n && n.anchor0) {
|
|
4794
4799
|
const {anchor0: t, anchor1: i} = n, r = t[e] = t[e] || t.x + "," + t.y, s = i[e] = i[e] || i.x + "," + i.y;
|
|
@@ -4807,9 +4812,9 @@ class $e extends He {
|
|
|
4807
4812
|
if (h && this._i(c, r)) return !1;
|
|
4808
4813
|
const u = n.length;
|
|
4809
4814
|
let d = l[c] && l[c][r];
|
|
4810
|
-
const p = d,
|
|
4811
|
-
if (!(
|
|
4812
|
-
const t =
|
|
4815
|
+
const p = d, y = this.Si && d;
|
|
4816
|
+
if (!(y && 0 !== d.collides) && t) {
|
|
4817
|
+
const t = y && 0 === d.collides;
|
|
4813
4818
|
if (this.hi || t) if ((this.fi || d && d.z !== a) && (d = null), d) {
|
|
4814
4819
|
if (d.boxes && d.boxes.length) {
|
|
4815
4820
|
const {boxes: t, isAllowOverlap: e} = d;
|
|
@@ -4840,12 +4845,12 @@ class $e extends He {
|
|
|
4840
4845
|
d.collides = t, this.wi(c, r, d);
|
|
4841
4846
|
}
|
|
4842
4847
|
}
|
|
4843
|
-
let
|
|
4848
|
+
let m = t && d && 0 === d.collides, g = 1, v = !1;
|
|
4844
4849
|
if (this.sceneConfig.fading) {
|
|
4845
4850
|
const t = this.Pi(e);
|
|
4846
|
-
if (this.Ti) t[r] =
|
|
4847
|
-
f ? (g > 0 && (
|
|
4848
|
-
g = 0),
|
|
4851
|
+
if (this.Ti) t[r] = m ? 1 : -1; else if (f && delete e.ki, g = this.Ii(f, m, t, r),
|
|
4852
|
+
f ? (g > 0 && (m = !0), v = this.isBoxFading(e, r), v && this.setToRedraw()) : m || (this.Oi(t, r),
|
|
4853
|
+
g = 0), m) {
|
|
4849
4854
|
const n = e.ki;
|
|
4850
4855
|
if (n && 1 === g && t[r] > 0) {
|
|
4851
4856
|
let {fadeOutDelay: t, fadingDuration: e} = this.sceneConfig;
|
|
@@ -4856,18 +4861,18 @@ class $e extends He {
|
|
|
4856
4861
|
}
|
|
4857
4862
|
}
|
|
4858
4863
|
if (d && s.options.debugCollision && this.addCollisionDebugBox(d.boxes, d.collides ? 0 : 1),
|
|
4859
|
-
|
|
4864
|
+
m || v) {
|
|
4860
4865
|
const {mesh: t, start: e} = n[0], i = this.getSymbol(t.properties.symbolIndex);
|
|
4861
4866
|
!this.Ci(i, t, e) && d && d.boxes && this.Fi(d.boxes, t);
|
|
4862
4867
|
}
|
|
4863
|
-
if (
|
|
4868
|
+
if (m) {
|
|
4864
4869
|
const t = qe[0] = 255 * g;
|
|
4865
4870
|
for (let e = 0; e < u; e++) {
|
|
4866
4871
|
const {mesh: i, allElements: r, start: s, end: o, boxIndex: a} = n[e];
|
|
4867
4872
|
this.setCollisionOpacity(i, r, t, s, o, a);
|
|
4868
4873
|
}
|
|
4869
4874
|
}
|
|
4870
|
-
return
|
|
4875
|
+
return m && g > 0;
|
|
4871
4876
|
}
|
|
4872
4877
|
isMeshIterable() {
|
|
4873
4878
|
return !0;
|
|
@@ -5221,7 +5226,7 @@ function rn(t, e, n, i, r) {
|
|
|
5221
5226
|
const sn = [], on = [], an = [], ln = [], hn = [], cn = [];
|
|
5222
5227
|
|
|
5223
5228
|
function fn(t, e, n, r, s, o, l, c, f, u, d, p) {
|
|
5224
|
-
const {tileRatio:
|
|
5229
|
+
const {tileRatio: y, tileResolution: m} = f, g = y / (m / u.getResolution()) * (d / u.cameraToCenterDistance) * p;
|
|
5225
5230
|
h.scale(n, n, g), h.scale(r, r, g), h.scale(s, s, g), h.scale(o, o, g), i.set(sn, n[0], n[1], 0),
|
|
5226
5231
|
i.set(on, r[0], r[1], 0), i.set(an, s[0], s[1], 0), i.set(ln, o[0], o[1], 0), i.add(sn, sn, e),
|
|
5227
5232
|
i.add(on, on, e), i.add(an, an, e), i.add(ln, ln, e), rn(n, sn, l, u.width, u.height),
|
|
@@ -5242,15 +5247,15 @@ function dn(t, e, n, i, r) {
|
|
|
5242
5247
|
return l.set(t, o, -s, s, o);
|
|
5243
5248
|
}
|
|
5244
5249
|
|
|
5245
|
-
const pn = [],
|
|
5250
|
+
const pn = [], yn = [], mn = [], gn = [], vn = [], xn = [], bn = [], An = [], wn = [ 1, -1 ], _n = [ 1, 1 ];
|
|
5246
5251
|
|
|
5247
5252
|
function Sn(t, e, n, r, s) {
|
|
5248
5253
|
const o = e.material.uniforms, a = s.cameraToCenterDistance, l = e.geometry.properties, c = this.getSymbol(l.symbolIndex), f = e.geometry.desc.positionSize, u = l.aAnchor, d = i.set(pn, u[n * f], u[n * f + 1], 2 === f ? 0 : u[n * f + 2]);
|
|
5249
|
-
let p = rn(
|
|
5250
|
-
const
|
|
5251
|
-
let
|
|
5254
|
+
let p = rn(yn, d, r, s.width, s.height);
|
|
5255
|
+
const y = p[2];
|
|
5256
|
+
let m = 1;
|
|
5252
5257
|
if (o.markerPerspectiveRatio) {
|
|
5253
|
-
|
|
5258
|
+
m = Kt(.5 + .5 * (1 - (1 - a / y) * o.markerPerspectiveRatio), 0, 4);
|
|
5254
5259
|
}
|
|
5255
5260
|
const {aShape: g, aMarkerDx: v, aMarkerDy: x, aMarkerWidth: b, aMarkerHeight: A, aPitchAlign: w, aRotationAlign: _, aRotation: S} = l, M = v ? v[n] : c.markerDx, P = x ? x[n] : c.markerDy, T = w ? w[n] : o.pitchWithMap, k = _ ? _[n] : o.rotateWithMap, I = h.set(An, M || 0, -(P || 0));
|
|
5256
5261
|
let O = h.set(gn, g[2 * n] / 10, g[2 * n + 1] / 10), C = h.set(vn, g[2 * n + 2] / 10, g[2 * n + 3] / 10), F = h.set(xn, g[2 * n + 4] / 10, g[2 * n + 5] / 10), E = h.set(bn, g[2 * n + 6] / 10, g[2 * n + 7] / 10);
|
|
@@ -5265,29 +5270,29 @@ function Sn(t, e, n, r, s) {
|
|
|
5265
5270
|
let R = S ? S[n] / 9362 : -(c.markerRotation || 0) * Math.PI / 180;
|
|
5266
5271
|
const N = s.getBearing() * Math.PI / 180;
|
|
5267
5272
|
if (N * k || R) {
|
|
5268
|
-
const t = dn(
|
|
5273
|
+
const t = dn(mn, R, N, k, T);
|
|
5269
5274
|
O = h.transformMat2(O, O, t), C = h.transformMat2(C, C, t), F = h.transformMat2(F, F, t),
|
|
5270
5275
|
E = h.transformMat2(E, E, t);
|
|
5271
5276
|
}
|
|
5272
|
-
return 1 === T ? fn(t, d, O, C, F, E, r, I, o, s,
|
|
5273
|
-
h.multiply(C, C, wn), h.multiply(F, F, wn), h.multiply(E, E, wn), un(t, p, O, C, F, E, I,
|
|
5277
|
+
return 1 === T ? fn(t, d, O, C, F, E, r, I, o, s, y, m) : (h.multiply(O, O, wn),
|
|
5278
|
+
h.multiply(C, C, wn), h.multiply(F, F, wn), h.multiply(E, E, wn), un(t, p, O, C, F, E, I, m)),
|
|
5274
5279
|
t;
|
|
5275
5280
|
}
|
|
5276
5281
|
|
|
5277
5282
|
const Mn = [], Pn = [], Tn = [], kn = [], In = [], On = [], Cn = [ 1, -1 ];
|
|
5278
5283
|
|
|
5279
5284
|
function Fn(t, e, n, i, r, s, o, a, l) {
|
|
5280
|
-
const c = i.material.uniforms, f = l.cameraToCenterDistance, u = i.geometry.properties, d = this.getSymbol(u.symbolIndex), p = "line" === d.textPlacement && !le(d),
|
|
5281
|
-
let
|
|
5285
|
+
const c = i.material.uniforms, f = l.cameraToCenterDistance, u = i.geometry.properties, d = this.getSymbol(u.symbolIndex), p = "line" === d.textPlacement && !le(d), y = n[2];
|
|
5286
|
+
let m = 1;
|
|
5282
5287
|
if (c.textPerspectiveRatio) {
|
|
5283
|
-
|
|
5288
|
+
m = Kt(.5 + .5 * (1 - (1 - f / y) * c.textPerspectiveRatio), 0, 4);
|
|
5284
5289
|
}
|
|
5285
5290
|
const {aTextDx: g, aTextDy: v, aPitchAlign: x, aRotationAlign: b, aRotation: A} = i.geometry.properties, w = g ? g[o] : d.textDx, _ = v ? v[o] : d.textDy, S = x ? x[o] : c.pitchWithMap, M = b ? b[o] : c.rotateWithMap, P = h.set(On, w || 0, -(_ || 0));
|
|
5286
5291
|
if (p) {
|
|
5287
5292
|
const {aOffset: i} = u;
|
|
5288
5293
|
let r = h.set(Pn, i[2 * o] / 10, i[2 * o + 1] / 10), s = h.set(Tn, i[2 * o + 2] / 10, i[2 * o + 3] / 10), f = h.set(kn, i[2 * o + 4] / 10, i[2 * o + 5] / 10), d = h.set(In, i[2 * o + 6] / 10, i[2 * o + 7] / 10);
|
|
5289
|
-
1 === S ? fn(t, e, r, s, f, d, a, P, c, l,
|
|
5290
|
-
h.multiply(f, f, Cn), h.multiply(d, d, Cn), un(t, n, r, s, f, d, P,
|
|
5294
|
+
1 === S ? fn(t, e, r, s, f, d, a, P, c, l, y, m) : (h.multiply(r, r, Cn), h.multiply(s, s, Cn),
|
|
5295
|
+
h.multiply(f, f, Cn), h.multiply(d, d, Cn), un(t, n, r, s, f, d, P, m));
|
|
5291
5296
|
} else {
|
|
5292
5297
|
const {aShape: i} = u;
|
|
5293
5298
|
let s = h.set(Pn, i[2 * o] / 10, i[2 * o + 1] / 10), f = h.set(Tn, i[2 * o + 2] / 10, i[2 * o + 3] / 10), g = h.set(kn, i[2 * o + 4] / 10, i[2 * o + 5] / 10), v = h.set(In, i[2 * o + 6] / 10, i[2 * o + 7] / 10);
|
|
@@ -5301,7 +5306,7 @@ function Fn(t, e, n, i, r, s, o, a, l) {
|
|
|
5301
5306
|
v = h.transformMat2(v, v, t);
|
|
5302
5307
|
}
|
|
5303
5308
|
const w = r / 24;
|
|
5304
|
-
h.scale(s, s, w), h.scale(f, f, w), h.scale(g, g, w), h.scale(v, v, w), 1 === S ? fn(t, e, s, f, g, v, a, P, c, l,
|
|
5309
|
+
h.scale(s, s, w), h.scale(f, f, w), h.scale(g, g, w), h.scale(v, v, w), 1 === S ? fn(t, e, s, f, g, v, a, P, c, l, y, m) : un(t, n, s, f, g, v, P, m);
|
|
5305
5310
|
}
|
|
5306
5311
|
return s = s || 0, t[0] -= s + 1, t[1] -= s + 1, t[2] += s + 1, t[3] += s + 1, t;
|
|
5307
5312
|
}
|
|
@@ -5377,15 +5382,15 @@ function Dn(t, e, i, r, s, o, a, l, h) {
|
|
|
5377
5382
|
s.textOpacity < 1 && (p = !0), e.properties.memorySize = e.getMemorySize(), e.generateBuffers(t, {
|
|
5378
5383
|
excludeElementsInVAO: !0
|
|
5379
5384
|
});
|
|
5380
|
-
const
|
|
5385
|
+
const y = new n.Material(d, Hn), m = new n.Mesh(e, y, {
|
|
5381
5386
|
disableVAO: !0,
|
|
5382
5387
|
transparent: p,
|
|
5383
5388
|
castShadow: !1,
|
|
5384
5389
|
picking: !0
|
|
5385
5390
|
});
|
|
5386
|
-
if (
|
|
5391
|
+
if (m.setLocalTransform(i), d.isHalo && (m.properties.isHalo = !0), a && m.setDefines({
|
|
5387
5392
|
ENABLE_COLLISION: 1
|
|
5388
|
-
}), c.push(
|
|
5393
|
+
}), c.push(m), d.isHalo) {
|
|
5389
5394
|
const t = {
|
|
5390
5395
|
flipY: 0,
|
|
5391
5396
|
tileResolution: e.properties.tileResolution,
|
|
@@ -5463,19 +5468,19 @@ function Rn(t, e, n) {
|
|
|
5463
5468
|
function Nn(t, e) {
|
|
5464
5469
|
const n = t.getRenderer().canvas;
|
|
5465
5470
|
return {
|
|
5466
|
-
uniforms: [
|
|
5471
|
+
uniforms: [ {
|
|
5467
5472
|
name: "projViewModelMatrix",
|
|
5468
5473
|
type: "function",
|
|
5469
5474
|
fn: function(t, e) {
|
|
5470
5475
|
return r.multiply([], e.projViewMatrix, e.modelMatrix);
|
|
5471
5476
|
}
|
|
5472
|
-
},
|
|
5477
|
+
}, {
|
|
5473
5478
|
name: "zoomScale",
|
|
5474
5479
|
type: "function",
|
|
5475
5480
|
fn: function(t, e) {
|
|
5476
5481
|
return e.tileResolution / e.resolution;
|
|
5477
5482
|
}
|
|
5478
|
-
}
|
|
5483
|
+
} ],
|
|
5479
5484
|
extraCommandProps: {
|
|
5480
5485
|
viewport: {
|
|
5481
5486
|
x: 0,
|
|
@@ -5520,7 +5525,7 @@ function Nn(t, e) {
|
|
|
5520
5525
|
}
|
|
5521
5526
|
|
|
5522
5527
|
function zn(t, e) {
|
|
5523
|
-
const n = g(e.textFill), i = g(e.textSize), r = g(e.textHaloFill), s = g(e.textHaloRadius), o = g(e.textHaloOpacity), a = g(e.textDx), l = g(e.textDy), h = g(e.textOpacity), c = v(e.textPitchAlignment), f = v(e.textRotationAlignment), u = g(e.textRotation), d = v(e.textAllowOverlapFn), p = v(e.textIgnorePlacement),
|
|
5528
|
+
const n = g(e.textFill), i = g(e.textSize), r = g(e.textHaloFill), s = g(e.textHaloRadius), o = g(e.textHaloOpacity), a = g(e.textDx), l = g(e.textDy), h = g(e.textOpacity), c = v(e.textPitchAlignment), f = v(e.textRotationAlignment), u = g(e.textRotation), d = v(e.textAllowOverlapFn), p = v(e.textIgnorePlacement), y = {}, x = new Int16Array(1), b = new Uint16Array(1);
|
|
5524
5529
|
return [ {
|
|
5525
5530
|
attrName: "aTextFill",
|
|
5526
5531
|
symbolName: "textFill",
|
|
@@ -5529,7 +5534,7 @@ function zn(t, e) {
|
|
|
5529
5534
|
width: 4,
|
|
5530
5535
|
evaluate: (e, i, r) => {
|
|
5531
5536
|
let s = n(t.getZoom(), e);
|
|
5532
|
-
return
|
|
5537
|
+
return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e, !0)), Array.isArray(s) || (s = y[s] = y[s] || O(s).unitArray()),
|
|
5533
5538
|
s = ie(s), s;
|
|
5534
5539
|
}
|
|
5535
5540
|
}, {
|
|
@@ -5540,7 +5545,7 @@ function zn(t, e) {
|
|
|
5540
5545
|
width: 1,
|
|
5541
5546
|
evaluate: (e, n, r) => {
|
|
5542
5547
|
let s = i(t.getZoom(), e) || Hn.textSize;
|
|
5543
|
-
return
|
|
5548
|
+
return m(s) && (s = this.evaluateInFnTypeConfig(s, r, t, e)), x[0] = s, x[0];
|
|
5544
5549
|
}
|
|
5545
5550
|
}, {
|
|
5546
5551
|
attrName: "aTextHaloFill",
|
|
@@ -5550,7 +5555,7 @@ function zn(t, e) {
|
|
|
5550
5555
|
width: 4,
|
|
5551
5556
|
evaluate: e => {
|
|
5552
5557
|
let n = r(t.getZoom(), e);
|
|
5553
|
-
return Array.isArray(n) || (n =
|
|
5558
|
+
return Array.isArray(n) || (n = y[n] = y[n] || O(n).array()), n = ie(n), n;
|
|
5554
5559
|
}
|
|
5555
5560
|
}, {
|
|
5556
5561
|
attrName: "aTextHaloRadius",
|
|
@@ -5600,7 +5605,7 @@ function zn(t, e) {
|
|
|
5600
5605
|
width: 1,
|
|
5601
5606
|
evaluate: (e, n, i) => {
|
|
5602
5607
|
let r = h(t.getZoom(), e);
|
|
5603
|
-
return
|
|
5608
|
+
return m(r) && (r = this.evaluateInFnTypeConfig(r, i, t, e)), x[0] = 255 * r, x[0];
|
|
5604
5609
|
}
|
|
5605
5610
|
}, {
|
|
5606
5611
|
attrName: "aPitchAlign",
|
|
@@ -5654,14 +5659,14 @@ function Wn(t, e, n, i, r, s, o) {
|
|
|
5654
5659
|
const a = this.getMap(), l = e.geometry.properties, h = this.getSymbol(l.symbolIndex), c = "line" === h.textPlacement && !le(h), {aTextSize: f, aTextHaloRadius: u, aShape: d} = l;
|
|
5655
5660
|
let p = f ? f[n[r]] : e.properties.textSize;
|
|
5656
5661
|
null == p && (p = Hn.textSize);
|
|
5657
|
-
const
|
|
5662
|
+
const y = u ? u[n[r]] : e.properties.textHaloRadius, m = En(Un, e, n[r]), g = rn(Gn, m, o, a.width, a.height), v = i, {boxes: x, collision: b} = this.rr(e, r);
|
|
5658
5663
|
let A = 0;
|
|
5659
5664
|
if (c || 1 === e.material.uniforms.rotateWithMap || h.textRotation) {
|
|
5660
5665
|
let i = 0;
|
|
5661
5666
|
for (let s = r; s < r + 6 * v; s += 6) {
|
|
5662
5667
|
const r = x[A] = x[A] || [];
|
|
5663
5668
|
A++;
|
|
5664
|
-
const l = Fn.call(this, r,
|
|
5669
|
+
const l = Fn.call(this, r, m, g, e, p, y, n[s], o, a);
|
|
5665
5670
|
if (!t) {
|
|
5666
5671
|
const e = this.isCollides(l);
|
|
5667
5672
|
1 === e ? t = 1 : -1 === e && i++;
|
|
@@ -5673,7 +5678,7 @@ function Wn(t, e, n, i, r, s, o) {
|
|
|
5673
5678
|
for (let h = r; h < s; h += 6) {
|
|
5674
5679
|
const r = d[2 * n[h] + 1];
|
|
5675
5680
|
if (l !== r || h === s - 6) {
|
|
5676
|
-
const c = n[h === s - 6 ? h : h - 6], f = Fn.call(this, Vn,
|
|
5681
|
+
const c = n[h === s - 6 ? h : h - 6], f = Fn.call(this, Vn, m, g, e, p, y, i, o, a), u = Fn.call(this, jn, m, g, e, p, y, c, o, a), d = x[A] = x[A] || [];
|
|
5677
5682
|
A++, d[0] = Math.min(f[0], u[0]), d[1] = Math.min(f[1], u[1]), d[2] = Math.max(f[2], u[2]),
|
|
5678
5683
|
d[3] = Math.max(f[3], u[3]), i = n[h], l = r, !t && this.isCollides(d) && (t = 1);
|
|
5679
5684
|
}
|
|
@@ -5700,7 +5705,7 @@ function Bn(t, e) {
|
|
|
5700
5705
|
|
|
5701
5706
|
const Xn = [], Yn = [];
|
|
5702
5707
|
|
|
5703
|
-
var Jn = "#define SHADER_NAME TEXT\n#define RAD 0.0174532925\nattribute vec3 aPosition;\nattribute vec2 aShape;\nattribute vec2 aTexCoord;\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 pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float rotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\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#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\nvoid main() {\n vec3 c = aPosition;\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 = pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = rotateWithMap;\n#endif\nvec2 j = aShape / 10.0;\n if(h == 1. && flipY == .0) {\n j = j * vec2(1., -1.);\n }\n vec2 k = aTexCoord;\n gl_Position = projViewModelMatrix * vec4(c, 1.);\n float l = gl_Position.w;\n float m = (1. - cameraToCenterDistance / l) * textPerspectiveRatio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n#ifdef HAS_ROTATION\nfloat o = aRotation / 9362. - mapRotation * i;\n#else\nfloat o = textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n
|
|
5708
|
+
var Jn = "#define SHADER_NAME TEXT\n#define RAD 0.0174532925\nattribute vec3 aPosition;\nattribute vec2 aShape;\nattribute vec2 aTexCoord;\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 pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float rotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\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#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\nvoid main() {\n vec3 c = aPosition;\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 = pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = rotateWithMap;\n#endif\nvec2 j = aShape / 10.0;\n if(h == 1. && flipY == .0) {\n j = j * vec2(1., -1.);\n }\n vec2 k = aTexCoord;\n gl_Position = projViewModelMatrix * vec4(c, 1.);\n float l = gl_Position.w;\n float m = (1. - cameraToCenterDistance / l) * textPerspectiveRatio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n#ifdef HAS_ROTATION\nfloat o = aRotation / 9362. - mapRotation * i;\n#else\nfloat o = textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n \n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\no += mapRotation;\n#else\no -= mapRotation;\n#endif\n }\n float u = sin(o);\n float v = cos(o);\n mat2 A = mat2(v, -1. * u, u, v);\n j = A * (j / glyphSize * d);\n float B = l / cameraToCenterDistance;\n if(h == .0) {\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * l;\n } else {\n vec2 C = j;\n gl_Position = projViewModelMatrix * vec4(c + vec3(C, .0) * tileRatio / zoomScale * B * n, 1.);\n }\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * l;\n#ifndef PICKING_MODE\nif(h == .0) {\n vGammaScale = mix(1., B, textPerspectiveRatio);\n } else {\n vGammaScale = B + mapPitch / 4.;\n }\n vTexCoord = k / texSize;\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = 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#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\n#else\n#ifdef ENABLE_COLLISION\nbool D = aOpacity == 255.;\n#else\nbool D = true;\n#endif\nfbo_picking_setData(gl_Position.w, D);\n#endif\n}", qn = "#define SHADER_NAME TEXT\n#define SDF_PX 8.0\n#define DEVICE_PIXEL_RATIO 1.0\n#define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\nprecision mediump float;\nuniform sampler2D texture;\nuniform float textOpacity;\nuniform highp float gammaScale;\nuniform int isHalo;\nuniform highp float textHaloBlur;\n#ifdef HAS_TEXT_HALO_OPACITY\nvarying float vTextHaloOpacity;\n#else\nuniform float textHaloOpacity;\n#endif\nvarying vec2 vTexCoord;\nvarying float vSize;\nvarying float vGammaScale;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nvarying vec4 vTextFill;\n#else\nuniform vec4 textFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvarying vec4 vTextHaloFill;\n#else\nuniform vec4 textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvarying float vTextHaloRadius;\n#else\nuniform highp float textHaloRadius;\n#endif\nvoid main() {\n \n#ifdef HAS_TEXT_FILL\nvec4 c = vTextFill;\n#else\nvec4 c = textFill;\n#endif\nfloat d = vSize / 24.;\n lowp vec4 e = c;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n if(isHalo == 1) {\n \n#ifdef HAS_TEXT_HALO_FILL\nvec4 i = vTextHaloFill;\n#else\nvec4 i = textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nfloat j = vTextHaloRadius;\n#else\nfloat j = textHaloRadius;\n#endif\ne = i;\n f = (textHaloBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (d * gammaScale);\n h = (6. - j / d) / SDF_PX;\n#ifdef HAS_TEXT_HALO_OPACITY\nfloat k = vTextHaloOpacity / 255.;\n#else\nfloat k = textHaloOpacity;\n#endif\ne *= k * 1.25;\n }\n float l = texture2D(texture, vTexCoord).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * textOpacity * vOpacity);\n}";
|
|
5704
5709
|
|
|
5705
5710
|
const Zn = new Uint16Array(1), Kn = new Int8Array(1);
|
|
5706
5711
|
|
|
@@ -5754,7 +5759,7 @@ function Qn(t, e) {
|
|
|
5754
5759
|
const o = e.markerTextFit, l = a ? a(t.getZoom(), i) : o;
|
|
5755
5760
|
if ("both" === l || "width" === l) return r;
|
|
5756
5761
|
let h = n(t.getZoom(), i);
|
|
5757
|
-
return
|
|
5762
|
+
return m(h) && (h = this.evaluateInFnTypeConfig(h, s, t, i)), d[0] = h, d[0];
|
|
5758
5763
|
}
|
|
5759
5764
|
}, {
|
|
5760
5765
|
attrName: "aMarkerHeight",
|
|
@@ -5766,7 +5771,7 @@ function Qn(t, e) {
|
|
|
5766
5771
|
const o = e.markerTextFit, l = a ? a(t.getZoom(), n) : o;
|
|
5767
5772
|
if ("both" === l || "height" === l) return r;
|
|
5768
5773
|
let h = i(t.getZoom(), n);
|
|
5769
|
-
return
|
|
5774
|
+
return m(h) && (h = this.evaluateInFnTypeConfig(h, s, t, n)), d[0] = h, d[0];
|
|
5770
5775
|
}
|
|
5771
5776
|
}, {
|
|
5772
5777
|
attrName: "aMarkerDx",
|
|
@@ -5776,7 +5781,7 @@ function Qn(t, e) {
|
|
|
5776
5781
|
define: "HAS_MARKER_DX",
|
|
5777
5782
|
evaluate: (e, n, i) => {
|
|
5778
5783
|
let s = r(t.getZoom(), e);
|
|
5779
|
-
return
|
|
5784
|
+
return m(s) && (s = this.evaluateInFnTypeConfig(s, i, t, e)), d[0] = s, d[0];
|
|
5780
5785
|
}
|
|
5781
5786
|
}, {
|
|
5782
5787
|
attrName: "aMarkerDy",
|
|
@@ -5786,7 +5791,7 @@ function Qn(t, e) {
|
|
|
5786
5791
|
define: "HAS_MARKER_DY",
|
|
5787
5792
|
evaluate: (e, n, i) => {
|
|
5788
5793
|
let r = s(t.getZoom(), e);
|
|
5789
|
-
return
|
|
5794
|
+
return m(r) && (r = this.evaluateInFnTypeConfig(r, i, t, e)), d[0] = r, d[0];
|
|
5790
5795
|
}
|
|
5791
5796
|
}, {
|
|
5792
5797
|
attrName: "aColorOpacity",
|
|
@@ -5796,7 +5801,7 @@ function Qn(t, e) {
|
|
|
5796
5801
|
define: "HAS_OPACITY",
|
|
5797
5802
|
evaluate: (e, n, i) => {
|
|
5798
5803
|
let r = o(t.getZoom(), e);
|
|
5799
|
-
return
|
|
5804
|
+
return m(r) && (r = this.evaluateInFnTypeConfig(r, i, t, e)), d[0] = 255 * r, d[0];
|
|
5800
5805
|
}
|
|
5801
5806
|
}, {
|
|
5802
5807
|
attrName: "aPitchAlign",
|
|
@@ -5847,7 +5852,7 @@ function ti(t, e, n, i) {
|
|
|
5847
5852
|
if (!n || !i || "none" === i) return;
|
|
5848
5853
|
const r = function(t, e, n) {
|
|
5849
5854
|
let i = t.properties.textFitFn;
|
|
5850
|
-
|
|
5855
|
+
m(n) && (i = t.properties.textFitFn = v(n));
|
|
5851
5856
|
const r = "none" !== n, s = [], o = t.getElements(), a = t.data.aPickingId;
|
|
5852
5857
|
let l, h, c;
|
|
5853
5858
|
e && (l = e.getElements(), h = e.data.aPickingId, c = e.data.aCount);
|
|
@@ -5861,27 +5866,27 @@ function ti(t, e, n, i) {
|
|
|
5861
5866
|
end: 6 * c[t]
|
|
5862
5867
|
};
|
|
5863
5868
|
}
|
|
5864
|
-
let d = !1, p = !1,
|
|
5869
|
+
let d = !1, p = !1, y = 0;
|
|
5865
5870
|
const g = [];
|
|
5866
5871
|
for (let t = 0; t < o.length; t += 6) {
|
|
5867
|
-
const e = o[t],
|
|
5868
|
-
if (!d && u) for (;u.pickingId <
|
|
5872
|
+
const e = o[t], m = a[e];
|
|
5873
|
+
if (!d && u) for (;u.pickingId < m && u.end < l.length; ) {
|
|
5869
5874
|
const t = u.end, e = l[t];
|
|
5870
5875
|
u.start = t, u.end = t + 6 * c[e], u.pickingId = h[e];
|
|
5871
5876
|
}
|
|
5872
|
-
if (!d && u && u.pickingId <
|
|
5877
|
+
if (!d && u && u.pickingId < m && (d = !0, !r)) {
|
|
5873
5878
|
if (!p) return [];
|
|
5874
|
-
for (let e = t; e < o.length; e += 6) s[
|
|
5879
|
+
for (let e = t; e < o.length; e += 6) s[y++] = [ -1, -1 ];
|
|
5875
5880
|
return s;
|
|
5876
5881
|
}
|
|
5877
|
-
const v = f[
|
|
5882
|
+
const v = f[m] && f[m].feature, x = v && v.properties || {};
|
|
5878
5883
|
x.$layer = v && v.layer, x.$type = v && v.type;
|
|
5879
5884
|
const b = i ? i(null, x) : n;
|
|
5880
|
-
if (delete x.$layer, delete x.$type, u &&
|
|
5881
|
-
s[
|
|
5885
|
+
if (delete x.$layer, delete x.$type, u && m === u.pickingId) {
|
|
5886
|
+
s[y++] = [ u.start, u.end ];
|
|
5882
5887
|
const t = u.end, e = l[t];
|
|
5883
5888
|
u.start = t, u.end = t + 6 * c[e], u.pickingId = h[e], p = !0;
|
|
5884
|
-
} else if (b && "none" !== b) for (let e = t; e < t + 6; e++) g.push(e); else s[
|
|
5889
|
+
} else if (b && "none" !== b) for (let e = t; e < t + 6; e++) g.push(e); else s[y++] = [ -1, -1 ];
|
|
5885
5890
|
}
|
|
5886
5891
|
if (g.length) if (g.length === o.length) t.setElements([]); else {
|
|
5887
5892
|
const e = [];
|
|
@@ -5922,7 +5927,7 @@ function ti(t, e, n, i) {
|
|
|
5922
5927
|
function ei(t, e) {
|
|
5923
5928
|
const n = this.getSymbolDef(e.properties.symbolIndex), i = n.markerTextFit, r = e.properties;
|
|
5924
5929
|
let s = "both" === i || "width" === i, o = "both" === i || "height" === i;
|
|
5925
|
-
if (
|
|
5930
|
+
if (m(n.markerTextFit)) {
|
|
5926
5931
|
let t = e.properties.textFitFn;
|
|
5927
5932
|
t || (t = e.properties.textFitFn = g(n.markerTextFit));
|
|
5928
5933
|
const {features: i} = e.properties, a = e.properties.elements || e.elements, {aPickingId: l} = e.data, h = [], c = [];
|
|
@@ -5931,7 +5936,7 @@ function ei(t, e) {
|
|
|
5931
5936
|
const n = i[l[a[e]]], r = n && n.feature || {}, s = r.properties || {};
|
|
5932
5937
|
s.$layer = r.layer, s.$type = r.type;
|
|
5933
5938
|
let o = t(null, s);
|
|
5934
|
-
if (
|
|
5939
|
+
if (m(o)) {
|
|
5935
5940
|
o = (s.textFitFn = s.textFitFn || g(o))(null, s);
|
|
5936
5941
|
}
|
|
5937
5942
|
delete s.$layer, delete s.$type, "both" === o ? (h.push(e / 6), c.push(e / 6)) : "width" === o ? (f = !1,
|
|
@@ -5963,7 +5968,7 @@ function ei(t, e) {
|
|
|
5963
5968
|
e.data.aMarkerHeight = new Uint16Array(c);
|
|
5964
5969
|
}
|
|
5965
5970
|
const f = this.getSymbolDef(e.properties.textGeo.properties.symbolIndex), u = g(f.textSize);
|
|
5966
|
-
ni.call(this, t, e), (!
|
|
5971
|
+
ni.call(this, t, e), (!m(f.textSize) || u.isZoomConstant && u.isFeatureConstant) && (r.isFitConstant = !0);
|
|
5967
5972
|
}
|
|
5968
5973
|
|
|
5969
5974
|
function ni(t, e) {
|
|
@@ -5973,22 +5978,22 @@ function ni(t, e) {
|
|
|
5973
5978
|
if (r.isFitConstant || !r.labelShape || !r.labelShape.length) return;
|
|
5974
5979
|
const s = this.getSymbolDef(e.properties.symbolIndex), o = this.getSymbolDef(n.properties.symbolIndex).textSize;
|
|
5975
5980
|
let a;
|
|
5976
|
-
|
|
5981
|
+
m(o) && (a = i.lr ? i.lr : i.lr = g(o));
|
|
5977
5982
|
const l = s.markerTextFitPadding || [ 0, 0, 0, 0 ];
|
|
5978
5983
|
let h;
|
|
5979
|
-
|
|
5980
|
-
const c = t.getZoom(), {fitIcons: f, fitWidthIcons: u, fitHeightIcons: d} = r, {aMarkerWidth: p, aMarkerHeight:
|
|
5984
|
+
m(l) && (h = r.hr ? r.hr : r.hr = v(l));
|
|
5985
|
+
const c = t.getZoom(), {fitIcons: f, fitWidthIcons: u, fitHeightIcons: d} = r, {aMarkerWidth: p, aMarkerHeight: y, labelShape: x} = r, b = r.elements || e.elements, {features: A, aPickingId: w} = r, _ = (t, e, n, i) => {
|
|
5981
5986
|
const s = x[4 * e], f = x[4 * e + 1], u = x[4 * e + 2], d = x[4 * e + 3];
|
|
5982
5987
|
if (!(s || f || u || d)) return;
|
|
5983
5988
|
const b = w[t], _ = A[b] && A[b].feature, S = _ && _.properties || {};
|
|
5984
5989
|
S.$layer = _ && _.layer, S.$type = _ && _.type;
|
|
5985
5990
|
let M = a ? a(c, S) : o;
|
|
5986
|
-
if (
|
|
5991
|
+
if (m(M)) {
|
|
5987
5992
|
M = (S.textSizeFn = S.textSizeFn || g(M))(c, S);
|
|
5988
5993
|
}
|
|
5989
5994
|
M /= 24;
|
|
5990
5995
|
let P, T, k = h ? h(c, S) : l;
|
|
5991
|
-
if (
|
|
5996
|
+
if (m(k)) {
|
|
5992
5997
|
k = (S.fitPaddingFn = S.fitPaddingFn || v(k))(c, S);
|
|
5993
5998
|
}
|
|
5994
5999
|
if (k[0] === k[2] && k[1] === k[3] || (P = r.aPadOffsetX, T = r.aPadOffsetY, P || (P = r.aPadOffsetX = new Int8Array(p.length),
|
|
@@ -6000,9 +6005,9 @@ function ni(t, e) {
|
|
|
6000
6005
|
Kn[0] = e, P[t] !== Kn[0] && (oe(P, e, t, t + 4), P.dirty = !0);
|
|
6001
6006
|
}
|
|
6002
6007
|
}
|
|
6003
|
-
if (
|
|
6008
|
+
if (y && i) {
|
|
6004
6009
|
const e = Math.abs((d - f) / 10 * M) + (k[0] + k[2] || 0);
|
|
6005
|
-
if (Zn[0] = e,
|
|
6010
|
+
if (Zn[0] = e, y[t] !== Zn[0] && (oe(y, Zn[0], t, t + 4), y.dirty = !0), T) {
|
|
6006
6011
|
const e = k[0] - (k[0] + k[2]) / 2;
|
|
6007
6012
|
Kn[0] = e, T[t] !== Kn[0] && (oe(T, e, t, t + 4), T.dirty = !0);
|
|
6008
6013
|
}
|
|
@@ -6050,7 +6055,10 @@ class hi extends $e {
|
|
|
6050
6055
|
constructor(t, e, n, i, r) {
|
|
6051
6056
|
super(t, e, n, i, r), this.propAllowOverlap = "markerAllowOverlap", this.propIgnorePlacement = "markerIgnorePlacement",
|
|
6052
6057
|
this.Gn = {}, this.isLabelCollides = Wn.bind(this), this.cr = ii.bind(this), this.ur = ri.bind(this),
|
|
6053
|
-
this.dr = si.bind(this), this.pr = oi.bind(this), this.
|
|
6058
|
+
this.dr = si.bind(this), this.pr = oi.bind(this), this.yr = [];
|
|
6059
|
+
}
|
|
6060
|
+
setTextShaderDefines(t) {
|
|
6061
|
+
this.mr = t;
|
|
6054
6062
|
}
|
|
6055
6063
|
createFnTypeConfig(t, e) {
|
|
6056
6064
|
return {
|
|
@@ -6059,7 +6067,7 @@ class hi extends $e {
|
|
|
6059
6067
|
};
|
|
6060
6068
|
}
|
|
6061
6069
|
startFrame(...t) {
|
|
6062
|
-
return this.
|
|
6070
|
+
return this.yr.length = 0, super.startFrame(...t);
|
|
6063
6071
|
}
|
|
6064
6072
|
createGeometry(t, e) {
|
|
6065
6073
|
return t && t.empty && (t.data = {
|
|
@@ -6069,8 +6077,8 @@ class hi extends $e {
|
|
|
6069
6077
|
}
|
|
6070
6078
|
postCreateGeometry(t, e) {
|
|
6071
6079
|
const {geometry: n, symbolIndex: i} = t, r = this.getSymbolDef(i), s = this.getFnTypeConfig(i);
|
|
6072
|
-
if (this.
|
|
6073
|
-
$n(n, r, s.icon); else if (this.
|
|
6080
|
+
if (this.gr(n)) n.properties.iconAtlas ? this.drawDebugAtlas(n.properties.iconAtlas) : n.properties.isEmpty = !0,
|
|
6081
|
+
$n(n, r, s.icon); else if (this.vr(n) && le(r)) {
|
|
6074
6082
|
const t = e[e.length - 1];
|
|
6075
6083
|
if (t) {
|
|
6076
6084
|
const {geometry: e, symbolIndex: s} = t;
|
|
@@ -6081,7 +6089,7 @@ class hi extends $e {
|
|
|
6081
6089
|
}
|
|
6082
6090
|
}
|
|
6083
6091
|
}
|
|
6084
|
-
|
|
6092
|
+
xr(t) {
|
|
6085
6093
|
if (!this.layer.options.collision) return;
|
|
6086
6094
|
const {collideIds: e, elements: n, aCount: i} = t.properties, r = e, s = {};
|
|
6087
6095
|
if (!n) return void (t.properties.collideBoxIndex = s);
|
|
@@ -6095,7 +6103,7 @@ class hi extends $e {
|
|
|
6095
6103
|
const s = this.isEnableCollision(), o = this.layer, {geometry: a, symbolIndex: l} = t;
|
|
6096
6104
|
a.properties.symbolIndex = l;
|
|
6097
6105
|
const h = this.getSymbolDef(l), c = this.getSymbol(l), f = this.getFnTypeConfig(l), u = [];
|
|
6098
|
-
if (this.
|
|
6106
|
+
if (this.gr(a)) {
|
|
6099
6107
|
const t = function(t, e, i, r, s, o, a, l, h) {
|
|
6100
6108
|
if (e.isDisposed() || 0 === e.data.aPosition.length) return null;
|
|
6101
6109
|
const c = e.properties.iconAtlas;
|
|
@@ -6138,25 +6146,25 @@ class hi extends $e {
|
|
|
6138
6146
|
d;
|
|
6139
6147
|
}(this.regl, a, e, 0, c, f.icon, o.options.collision, !s, this.isEnableUniquePlacement());
|
|
6140
6148
|
t && (delete t.geometry.properties.glyphAtlas, u.push(t));
|
|
6141
|
-
} else if (this.
|
|
6149
|
+
} else if (this.vr(a)) {
|
|
6142
6150
|
const t = Dn.call(this, this.regl, a, e, h, c, f.text, o.options.collision, !s, this.isEnableUniquePlacement());
|
|
6143
6151
|
t.length && (t.forEach(t => {
|
|
6144
6152
|
delete t.geometry.properties.iconAtlas;
|
|
6145
6153
|
}), u.push(...t));
|
|
6146
6154
|
}
|
|
6147
|
-
return "line" === h.markerPlacement && this.
|
|
6148
|
-
this.
|
|
6155
|
+
return "line" === h.markerPlacement && this.br(a, r), "line" !== h.markerPlacement && "line" !== h.textPlacement || u.forEach(t => t.properties.isLinePlacement = !0),
|
|
6156
|
+
this.xr(a), u;
|
|
6149
6157
|
}
|
|
6150
|
-
|
|
6158
|
+
br(t, e) {
|
|
6151
6159
|
const {collideIds: n} = t.properties, i = new Uint16Array(n.length);
|
|
6152
|
-
if (this.
|
|
6160
|
+
if (this.gr(t)) {
|
|
6153
6161
|
let r = 0;
|
|
6154
6162
|
for (let t = 0; t < n.length; t += 4) i.fill(r++, t, t + 4);
|
|
6155
6163
|
t.properties.collideIds = i, t.properties.uniqueCollideIds = ce(i), e.markerCollideMap = {
|
|
6156
6164
|
old: n,
|
|
6157
6165
|
new: i
|
|
6158
6166
|
};
|
|
6159
|
-
} else if (this.
|
|
6167
|
+
} else if (this.vr(t)) {
|
|
6160
6168
|
const {collideIds: n, aCount: i} = t.properties;
|
|
6161
6169
|
if (!i) return;
|
|
6162
6170
|
if (e.markerCollideMap) {
|
|
@@ -6183,7 +6191,7 @@ class hi extends $e {
|
|
|
6183
6191
|
if (this.Gi() && t.length > 0) {
|
|
6184
6192
|
const e = new Be(t);
|
|
6185
6193
|
e.properties.uniqueCollideIds = t[0].geometry.properties.uniqueCollideIds, e.properties.meshKey = t[0].properties.meshKey,
|
|
6186
|
-
e.properties.level = t[0].properties.level, this.
|
|
6194
|
+
e.properties.level = t[0].properties.level, this.yr.push(e);
|
|
6187
6195
|
}
|
|
6188
6196
|
for (let e = 0; e < t.length; e++) {
|
|
6189
6197
|
if (!this.isMeshIterable(t[e])) continue;
|
|
@@ -6206,31 +6214,31 @@ class hi extends $e {
|
|
|
6206
6214
|
if (!this.Gi()) return;
|
|
6207
6215
|
super.updateCollision(t);
|
|
6208
6216
|
const e = this.scene.getMeshes();
|
|
6209
|
-
e && e.length ? (this.
|
|
6217
|
+
e && e.length ? (this.Ar(t.timestamp), this.yr = [], this.xi()) : this.xi();
|
|
6210
6218
|
}
|
|
6211
6219
|
callCurrentTileShader(t, e) {
|
|
6212
6220
|
this.shader.filter = e.sceneFilter ? [ this.cr, e.sceneFilter ] : this.cr, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
|
|
6213
|
-
this.
|
|
6221
|
+
this.wr.filter = e.sceneFilter ? [ this.dr, e.sceneFilter ] : this.dr, this.renderer.render(this.wr, t, this.scene, this.getRenderFBO(e));
|
|
6214
6222
|
}
|
|
6215
6223
|
callBackgroundTileShader(t, e) {
|
|
6216
6224
|
this.shader.filter = e.sceneFilter ? [ this.ur, e.sceneFilter ] : this.ur, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
|
|
6217
|
-
this.
|
|
6225
|
+
this.wr.filter = e.sceneFilter ? [ this.pr, e.sceneFilter ] : this.pr, this.renderer.render(this.wr, t, this.scene, this.getRenderFBO(e));
|
|
6218
6226
|
}
|
|
6219
6227
|
isMeshIterable(t) {
|
|
6220
6228
|
return t && t.geometry && !t.geometry.properties.isEmpty && t.material && !t.material.get("isHalo") && this.isMeshVisible(t) && !(this.shouldIgnoreBackground() && !this.layer.getRenderer().isForeground(t));
|
|
6221
6229
|
}
|
|
6222
|
-
|
|
6230
|
+
Ar() {
|
|
6223
6231
|
if (!this.Gi()) return;
|
|
6224
|
-
let t = this.
|
|
6225
|
-
t && t.length && this.
|
|
6232
|
+
let t = this.yr;
|
|
6233
|
+
t && t.length && this._r(t);
|
|
6226
6234
|
}
|
|
6227
|
-
|
|
6235
|
+
Sr(t, e, n, i) {
|
|
6228
6236
|
return this.updateBoxCollisionFading(!0, t, e, n, i);
|
|
6229
6237
|
}
|
|
6230
6238
|
isEnableUniquePlacement() {
|
|
6231
6239
|
return this.isEnableCollision() && !0 === this.sceneConfig.uniquePlacement;
|
|
6232
6240
|
}
|
|
6233
|
-
|
|
6241
|
+
_r(t) {
|
|
6234
6242
|
const e = this.layer.getRenderer();
|
|
6235
6243
|
t = t.sort(ci);
|
|
6236
6244
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -6245,12 +6253,12 @@ class hi extends $e {
|
|
|
6245
6253
|
const s = e.isForeground(i.meshes[0]);
|
|
6246
6254
|
if (this.shouldIgnoreBackground() && !s) continue;
|
|
6247
6255
|
const o = i.properties.meshKey;
|
|
6248
|
-
this.startMeshCollision(i), this.
|
|
6256
|
+
this.startMeshCollision(i), this.Mr(i), this.forEachBox(i, this.Sr), this.Pr(i),
|
|
6249
6257
|
this.endMeshCollision(o);
|
|
6250
|
-
for (let t = 0; t < i.meshes.length; t++) this.
|
|
6258
|
+
for (let t = 0; t < i.meshes.length; t++) this.Tr(i.meshes[t]);
|
|
6251
6259
|
}
|
|
6252
6260
|
}
|
|
6253
|
-
|
|
6261
|
+
Tr(t) {
|
|
6254
6262
|
const e = t && t.geometry && t.geometry.properties.aOpacity;
|
|
6255
6263
|
e && e.dirty && (t.geometry.updateData("aOpacity", e), e.dirty = !1);
|
|
6256
6264
|
}
|
|
@@ -6260,11 +6268,11 @@ class hi extends $e {
|
|
|
6260
6268
|
const i = {
|
|
6261
6269
|
boxIndex: 0
|
|
6262
6270
|
}, r = n.length;
|
|
6263
|
-
for (let s = 0; s < r; s++) this.
|
|
6271
|
+
for (let s = 0; s < r; s++) this.kr(t, n[s], e, i);
|
|
6264
6272
|
}
|
|
6265
|
-
|
|
6273
|
+
kr(t, e, n, i) {
|
|
6266
6274
|
const s = this.getMap(), {collideBoxIndex: o} = t.meshes[0].geometry.properties;
|
|
6267
|
-
if (!o[e]) return !1;
|
|
6275
|
+
if (!(o && o[e])) return !1;
|
|
6268
6276
|
const a = r.multiply(ai, s.projViewMatrix, t.meshes[0].localTransform);
|
|
6269
6277
|
let l, h = !1;
|
|
6270
6278
|
const c = t.meshes;
|
|
@@ -6286,21 +6294,21 @@ class hi extends $e {
|
|
|
6286
6294
|
const [a, f, d] = o;
|
|
6287
6295
|
let p = 1;
|
|
6288
6296
|
r && (p = r[i[a]]);
|
|
6289
|
-
const
|
|
6290
|
-
l[u].mesh = c[t], l[u].start =
|
|
6297
|
+
const y = a + 0 * p * 6;
|
|
6298
|
+
l[u].mesh = c[t], l[u].start = y, l[u].end = f, l[u].boxCount = d, l[u].allElements = i,
|
|
6291
6299
|
u++;
|
|
6292
6300
|
}
|
|
6293
6301
|
if (!h) return !1;
|
|
6294
|
-
return n.call(this, t, l, a, i.boxIndex++) && this.
|
|
6302
|
+
return n.call(this, t, l, a, i.boxIndex++) && this.Ir(t, e), !0;
|
|
6295
6303
|
}
|
|
6296
|
-
|
|
6304
|
+
Mr(t) {
|
|
6297
6305
|
const e = t.meshes;
|
|
6298
6306
|
for (let t = 0; t < e.length; t++) {
|
|
6299
6307
|
const n = e[t], i = n && n.geometry;
|
|
6300
6308
|
i && (i.properties.visElemts.count = 0);
|
|
6301
6309
|
}
|
|
6302
6310
|
}
|
|
6303
|
-
|
|
6311
|
+
Ir(t, e) {
|
|
6304
6312
|
const n = t.meshes;
|
|
6305
6313
|
for (let t = 0; t < n.length; t++) {
|
|
6306
6314
|
const i = n[t];
|
|
@@ -6315,7 +6323,7 @@ class hi extends $e {
|
|
|
6315
6323
|
a.count = f;
|
|
6316
6324
|
}
|
|
6317
6325
|
}
|
|
6318
|
-
|
|
6326
|
+
Pr(t) {
|
|
6319
6327
|
const e = t.meshes;
|
|
6320
6328
|
for (let t = 0; t < e.length; t++) {
|
|
6321
6329
|
const n = e[t], i = n && n.geometry;
|
|
@@ -6325,7 +6333,7 @@ class hi extends $e {
|
|
|
6325
6333
|
}
|
|
6326
6334
|
}
|
|
6327
6335
|
isBoxCollides(t, e, n, i, r, s) {
|
|
6328
|
-
if (this.
|
|
6336
|
+
if (this.vr(t.geometry)) return Wn.call(this, 0, t, e, n, i, r, s);
|
|
6329
6337
|
if (t.geometry.properties.isEmpty) return li;
|
|
6330
6338
|
const o = this.getMap(), {boxes: a, collision: l} = this.rr(t, i);
|
|
6331
6339
|
let h = 0, c = 0, f = 0;
|
|
@@ -6361,13 +6369,13 @@ class hi extends $e {
|
|
|
6361
6369
|
this.shader = new n.MeshShader({
|
|
6362
6370
|
vert: en,
|
|
6363
6371
|
frag: "#define SHADER_NAME MARKER\nprecision mediump float;\nuniform sampler2D texture;\nuniform lowp float markerOpacity;\nuniform lowp float blendSrcIsOne;\nvarying vec2 vTexCoord;\nvarying float vOpacity;\nvoid main() {\n gl_FragColor = texture2D(texture, vTexCoord) * markerOpacity * vOpacity;\n if(blendSrcIsOne == 1.) {\n gl_FragColor *= gl_FragColor.a;\n }\n}",
|
|
6364
|
-
uniforms: [
|
|
6372
|
+
uniforms: [ {
|
|
6365
6373
|
name: "projViewModelMatrix",
|
|
6366
6374
|
type: "function",
|
|
6367
6375
|
fn: function(t, e) {
|
|
6368
6376
|
return r.multiply([], e.projViewMatrix, e.modelMatrix);
|
|
6369
6377
|
}
|
|
6370
|
-
},
|
|
6378
|
+
}, {
|
|
6371
6379
|
name: "zoomScale",
|
|
6372
6380
|
type: "function",
|
|
6373
6381
|
fn: function(t, e) {
|
|
@@ -6393,22 +6401,23 @@ class hi extends $e {
|
|
|
6393
6401
|
}
|
|
6394
6402
|
}
|
|
6395
6403
|
});
|
|
6396
|
-
const {uniforms: s, extraCommandProps: o} = Nn.call(this, this.layer, this.sceneConfig);
|
|
6397
|
-
if (this.
|
|
6404
|
+
const {uniforms: s, extraCommandProps: o} = Nn.call(this, this.layer, this.sceneConfig), a = this.mr || {};
|
|
6405
|
+
if (this.wr = new n.MeshShader({
|
|
6398
6406
|
vert: Jn,
|
|
6399
6407
|
frag: qn,
|
|
6400
6408
|
uniforms: s,
|
|
6401
|
-
extraCommandProps: o
|
|
6409
|
+
extraCommandProps: o,
|
|
6410
|
+
defines: a
|
|
6402
6411
|
}), this.pickingFBO) {
|
|
6403
6412
|
const t = new n.FBORayPicking(this.renderer, {
|
|
6404
6413
|
vert: "#define PICKING_MODE 1\n" + en,
|
|
6405
|
-
uniforms: [
|
|
6414
|
+
uniforms: [ {
|
|
6406
6415
|
name: "projViewModelMatrix",
|
|
6407
6416
|
type: "function",
|
|
6408
6417
|
fn: function(t, e) {
|
|
6409
6418
|
return r.multiply([], e.projViewMatrix, e.modelMatrix);
|
|
6410
6419
|
}
|
|
6411
|
-
},
|
|
6420
|
+
}, {
|
|
6412
6421
|
name: "zoomScale",
|
|
6413
6422
|
type: "function",
|
|
6414
6423
|
fn: function(t, e) {
|
|
@@ -6447,15 +6456,15 @@ class hi extends $e {
|
|
|
6447
6456
|
};
|
|
6448
6457
|
}
|
|
6449
6458
|
getUniqueEntryKey(t, e) {
|
|
6450
|
-
if (!this.
|
|
6459
|
+
if (!this.vr(t.geometry)) return null;
|
|
6451
6460
|
const {elements: n} = t.geometry.properties;
|
|
6452
6461
|
return Bn(t, n[e]);
|
|
6453
6462
|
}
|
|
6454
|
-
|
|
6463
|
+
gr(t) {
|
|
6455
6464
|
const {symbolIndex: e} = t.properties;
|
|
6456
6465
|
return 0 === e.type;
|
|
6457
6466
|
}
|
|
6458
|
-
|
|
6467
|
+
vr(t) {
|
|
6459
6468
|
const {symbolIndex: e} = t.properties;
|
|
6460
6469
|
return 1 === e.type;
|
|
6461
6470
|
}
|
|
@@ -6468,37 +6477,37 @@ function ci(t, e) {
|
|
|
6468
6477
|
const fi = [], ui = [], di = [];
|
|
6469
6478
|
|
|
6470
6479
|
function pi(t, e, n, r, s, o, a, l) {
|
|
6471
|
-
const {aGlyphOffset: c, aSegment: f, aTextDx: u, aTextDy: d, symbolIndex: p} = e.geometry.properties,
|
|
6480
|
+
const {aGlyphOffset: c, aSegment: f, aTextDx: u, aTextDy: d, symbolIndex: p} = e.geometry.properties, y = this.getSymbol(p), m = u ? u[s] : y.textDx, g = d ? d[s] : y.textDy, v = h.set(di, m || 0, g || 0), x = h.set(fi, c[2 * s], c[2 * s + 1]), b = i.set(ui, f[3 * s], f[3 * s + 1], f[3 * s + 2]);
|
|
6472
6481
|
return function(t, e, n, i, r, s, o, a, l, h, c, f) {
|
|
6473
6482
|
const u = i[0] * h, d = c ? u - r : u + r;
|
|
6474
|
-
let p = d > 0 ? 1 : -1,
|
|
6475
|
-
c && (p *= -1,
|
|
6476
|
-
const
|
|
6483
|
+
let p = d > 0 ? 1 : -1, y = 0;
|
|
6484
|
+
c && (p *= -1, y = Math.PI), p < 0 && (y += Math.PI);
|
|
6485
|
+
const m = a + l, g = Math.abs(d);
|
|
6477
6486
|
let v = p > 0 ? o : o + 1, x = E.convert(n), b = E.convert(n), A = 0, w = 0;
|
|
6478
6487
|
for (;A + w <= g; ) {
|
|
6479
|
-
if (v += p, v < a || v >=
|
|
6488
|
+
if (v += p, v < a || v >= m) return null;
|
|
6480
6489
|
b.x = x.x, b.y = x.y, x.x = e[3 * v], x.y = e[3 * v + 1], A += w, w = b.dist(x) / f;
|
|
6481
6490
|
}
|
|
6482
|
-
const _ = (g - A) / w, S = x.sub(b), M = S.mult(_).
|
|
6483
|
-
M.
|
|
6484
|
-
const P =
|
|
6491
|
+
const _ = (g - A) / w, S = x.sub(b), M = S.mult(_).Or(b);
|
|
6492
|
+
M.Or(S.Er().Fr().Cr(s * p));
|
|
6493
|
+
const P = y + Math.atan2(x.y - b.y, x.x - b.x);
|
|
6485
6494
|
return t[0] = (M.x - n[0]) / f, t[1] = (M.y - n[1]) / f, t[2] = P, t;
|
|
6486
6495
|
}(t, r, o, x, v[0], v[1], b[0], b[1], b[2], n / 24, l, a);
|
|
6487
6496
|
}
|
|
6488
6497
|
|
|
6489
|
-
const
|
|
6498
|
+
const yi = [], mi = [];
|
|
6490
6499
|
|
|
6491
6500
|
function gi(t, e, n, r, s, o, a, l, c, f, u) {
|
|
6492
6501
|
const {aVertical: d} = n.geometry.properties, p = d[o];
|
|
6493
|
-
let
|
|
6502
|
+
let y, m, g = pi.call(this, yi, n, r, s, o, l, c, !1);
|
|
6494
6503
|
if (!g) return null;
|
|
6495
|
-
if (i.copy(t, g), g = pi.call(this,
|
|
6496
|
-
if (i.copy(e, g), u && (h.transformMat2(
|
|
6504
|
+
if (i.copy(t, g), g = pi.call(this, mi, n, r, s, a, l, c, !1), !g) return null;
|
|
6505
|
+
if (i.copy(e, g), u && (h.transformMat2(yi, yi, u), h.transformMat2(mi, mi, u)),
|
|
6497
6506
|
p) {
|
|
6498
|
-
const t = Math.abs(
|
|
6499
|
-
|
|
6500
|
-
} else
|
|
6501
|
-
return 2 *
|
|
6507
|
+
const t = Math.abs(mi[1] - yi[1]), e = Math.abs(mi[0] - yi[0]) * f;
|
|
6508
|
+
m = yi[0] > mi[0] ? 1 : 0, t > e ? (y = 1, m = yi[1] < mi[1] ? 0 : 1) : y = 0;
|
|
6509
|
+
} else y = 0, m = yi[0] > mi[0] ? 1 : 0;
|
|
6510
|
+
return 2 * m + y;
|
|
6502
6511
|
}
|
|
6503
6512
|
|
|
6504
6513
|
var vi = "#define SHADER_NAME TEXT_LINE\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nattribute vec2 aOffset;\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 pitchWithMap;\n#endif\nuniform float zoomScale;\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform float mapPitch;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float tileRatio;\nuniform float layerScale;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\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#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\nvoid main() {\n vec3 c = aPosition;\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 = pitchWithMap;\n#endif\ngl_Position = projViewModelMatrix * vec4(c, 1.);\n float i = gl_Position.w;\n float j = i / cameraToCenterDistance;\n float k = (1. - cameraToCenterDistance / i) * textPerspectiveRatio;\n float l = clamp(.5 + .5 * (1. - k), .0, 4.);\n vec2 m = aOffset / 10.0;\n vec2 n = aTexCoord;\n if(h == 1.) {\n gl_Position = projViewModelMatrix * vec4(c + vec3(m, .0) * tileRatio / zoomScale * j * l, 1.);\n } else {\n gl_Position.xy += m * 2. / canvasSize * l * i;\n }\n gl_Position.xy += vec2(d, -e) * 2. / canvasSize * i;\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 / texSize;\n vSize = 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#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\n#else\n#ifdef ENABLE_COLLISION\nbool o = aOpacity == 255.;\n#else\nbool o = true;\n#endif\nfbo_picking_setData(gl_Position.w, o);\n#endif\n}";
|
|
@@ -6520,19 +6529,19 @@ const xi = function(t) {
|
|
|
6520
6529
|
class Li extends $e {
|
|
6521
6530
|
constructor(t, e, n, i, r) {
|
|
6522
6531
|
super(t, e, n, i, r), this.propAllowOverlap = "textAllowOverlap", this.propIgnorePlacement = "textIgnorePlacement",
|
|
6523
|
-
this.colorCache = {}, this.
|
|
6524
|
-
this.
|
|
6532
|
+
this.colorCache = {}, this.Hr = xi.bind(this), this.Dr = bi.bind(this), this.Lr = Ai.bind(this),
|
|
6533
|
+
this.Rr = wi.bind(this), this.isLabelCollides = Wn.bind(this), this.Nr();
|
|
6525
6534
|
}
|
|
6526
|
-
|
|
6527
|
-
this.
|
|
6535
|
+
Nr() {
|
|
6536
|
+
this.zr = [];
|
|
6528
6537
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
6529
6538
|
const e = this.symbolDef[t];
|
|
6530
|
-
|
|
6539
|
+
m(e.textName) && (this.zr[t] = g(e.textName));
|
|
6531
6540
|
}
|
|
6532
6541
|
}
|
|
6533
6542
|
updateSymbol(...t) {
|
|
6534
6543
|
const e = super.updateSymbol(...t);
|
|
6535
|
-
return this.
|
|
6544
|
+
return this.Nr(), e;
|
|
6536
6545
|
}
|
|
6537
6546
|
shouldDeleteMeshOnUpdateSymbol(t) {
|
|
6538
6547
|
if (!Array.isArray(t)) return (0 === t.textHaloRadius || 0 === this.symbolDef[0].textHaloRadius) && t.textHaloRadius !== this.symbolDef[0].textHaloRadius;
|
|
@@ -6560,24 +6569,24 @@ class Li extends $e {
|
|
|
6560
6569
|
r.properties.symbolIndex = s;
|
|
6561
6570
|
const o = this.getSymbol(s), a = this.getSymbolDef(s), l = this.getFnTypeConfig(s), h = Dn.call(this, this.regl, r, e, a, o, l, this.layer.options.collision, !n, i);
|
|
6562
6571
|
if (h.length) {
|
|
6563
|
-
"line" === o.textPlacement ? this.
|
|
6572
|
+
"line" === o.textPlacement ? this.Vr = !0 : this.jr = !0;
|
|
6564
6573
|
}
|
|
6565
6574
|
return h;
|
|
6566
6575
|
}
|
|
6567
6576
|
updateCollision(t) {
|
|
6568
6577
|
super.updateCollision(t);
|
|
6569
6578
|
const e = this.scene.getMeshes();
|
|
6570
|
-
e && e.length ? (this.
|
|
6579
|
+
e && e.length ? (this.Ur = {}, this.Gr(t.timestamp), this.xi()) : this.xi();
|
|
6571
6580
|
}
|
|
6572
6581
|
callCurrentTileShader(t, e) {
|
|
6573
|
-
this.shader.filter = e.sceneFilter ? [ this.
|
|
6574
|
-
this.
|
|
6582
|
+
this.shader.filter = e.sceneFilter ? [ this.Hr, e.sceneFilter ] : this.Hr, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
|
|
6583
|
+
this.Wr.filter = e.sceneFilter ? [ this.Lr, e.sceneFilter ] : this.Lr, this.renderer.render(this.Wr, t, this.scene, this.getRenderFBO(e));
|
|
6575
6584
|
}
|
|
6576
6585
|
callBackgroundTileShader(t, e) {
|
|
6577
|
-
this.shader.filter = e.sceneFilter ? [ this.
|
|
6578
|
-
this.
|
|
6586
|
+
this.shader.filter = e.sceneFilter ? [ this.Dr, e.sceneFilter ] : this.Dr, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
|
|
6587
|
+
this.Wr.filter = e.sceneFilter ? [ this.Rr, e.sceneFilter ] : this.Rr, this.renderer.render(this.Wr, t, this.scene, this.getRenderFBO(e));
|
|
6579
6588
|
}
|
|
6580
|
-
|
|
6589
|
+
Gr() {
|
|
6581
6590
|
let t = this.scene.getMeshes();
|
|
6582
6591
|
if (!t || !t.length) return;
|
|
6583
6592
|
const e = -this.getMap().getBearing() * Math.PI / 180, n = l.fromRotation(Mi, e), i = (t, e, n, i) => {
|
|
@@ -6599,7 +6608,7 @@ class Li extends $e {
|
|
|
6599
6608
|
const c = o.properties.meshKey;
|
|
6600
6609
|
if ("line" === h.textPlacement) {
|
|
6601
6610
|
if (!l.properties.line) continue;
|
|
6602
|
-
r && this.startMeshCollision(o), this.
|
|
6611
|
+
r && this.startMeshCollision(o), this.Br(o, n);
|
|
6603
6612
|
const {aOffset: t, aOpacity: e} = l.properties;
|
|
6604
6613
|
t.dirty && (l.updateData("aOffset", t), t.dirty = !1), e && e.dirty && (l.updateData("aOpacity", e),
|
|
6605
6614
|
e.dirty = !1), r && this.endMeshCollision(c);
|
|
@@ -6624,7 +6633,7 @@ class Li extends $e {
|
|
|
6624
6633
|
getUniqueEntryKey(t, e) {
|
|
6625
6634
|
return Bn(t, e);
|
|
6626
6635
|
}
|
|
6627
|
-
|
|
6636
|
+
Br(t, e) {
|
|
6628
6637
|
const n = this.getMap(), i = t.geometry, s = i.properties, o = this.layer.getRenderer().isForeground(t);
|
|
6629
6638
|
if (this.shouldIgnoreBackground() && !o) return;
|
|
6630
6639
|
let a = s.line;
|
|
@@ -6632,12 +6641,12 @@ class Li extends $e {
|
|
|
6632
6641
|
const l = 1 === t.material.uniforms.pitchWithMap, h = s.elements;
|
|
6633
6642
|
if (!l) {
|
|
6634
6643
|
const e = r.multiply(_i, n.projViewMatrix, t.localTransform), i = new Array(a.length);
|
|
6635
|
-
a = this.
|
|
6644
|
+
a = this.Xr(i, a, e, n.width, n.height);
|
|
6636
6645
|
}
|
|
6637
6646
|
const c = this.Gi(), f = i.properties.visElemts = i.properties.visElemts || new h.constructor(h.length);
|
|
6638
6647
|
c && (f.count = 0), this.forEachBox(t, (t, n, i, r) => {
|
|
6639
6648
|
const {start: s, end: o} = n[0];
|
|
6640
|
-
let u = this.
|
|
6649
|
+
let u = this.Yr(t, h, s, o, a, i, l ? e : null, r);
|
|
6641
6650
|
if (c && (u = this.updateBoxCollisionFading(u, t, n, i, r), u)) {
|
|
6642
6651
|
let t = f.count;
|
|
6643
6652
|
for (let e = s; e < o; e++) f[t++] = h[e];
|
|
@@ -6645,53 +6654,53 @@ class Li extends $e {
|
|
|
6645
6654
|
}
|
|
6646
6655
|
}), !c || f.count === h.length && i.count === f.count || i.setElements(f, f.count);
|
|
6647
6656
|
}
|
|
6648
|
-
|
|
6657
|
+
Xr(t, e, n, i, r) {
|
|
6649
6658
|
const s = e.id + "-" + n.join();
|
|
6650
|
-
if (this.
|
|
6659
|
+
if (this.Ur[s]) return this.Ur[s];
|
|
6651
6660
|
const o = function(t, e, n, i, r) {
|
|
6652
6661
|
const s = [];
|
|
6653
6662
|
for (let o = 0; o < e.length; o += 3) a.set(s, e[o], e[o + 1], e[o + 2], 1), rn(s, s, n, i, r),
|
|
6654
6663
|
t[o] = s[0], t[o + 1] = s[1], t[o + 2] = e[o + 2];
|
|
6655
6664
|
return t;
|
|
6656
6665
|
}(t, e, n, i, r);
|
|
6657
|
-
return this.
|
|
6666
|
+
return this.Ur[s] = o, o;
|
|
6658
6667
|
}
|
|
6659
6668
|
forEachBox(t, e) {
|
|
6660
6669
|
const n = this.getMap(), i = r.multiply(_i, n.projViewMatrix, t.localTransform), {collideIds: s, aCount: o, features: a, elements: l} = t.geometry.properties, h = s, c = this.isEnableUniquePlacement(), f = this.sr(1);
|
|
6661
6670
|
f[0].allElements = l, f[0].mesh = t;
|
|
6662
|
-
let u = 0, d = l[0], p = 0,
|
|
6663
|
-
for (let n = 0; n <= l.length; n += 6) if (d = l[n], h[d] !==
|
|
6664
|
-
const r = a[
|
|
6671
|
+
let u = 0, d = l[0], p = 0, y = h[d];
|
|
6672
|
+
for (let n = 0; n <= l.length; n += 6) if (d = l[n], h[d] !== y || n === l.length) {
|
|
6673
|
+
const r = a[y] && a[y].feature;
|
|
6665
6674
|
if (c && this.isMeshUniquePlaced(t) && r && !r.label) {
|
|
6666
6675
|
const e = r.properties || {};
|
|
6667
6676
|
e.$layer = r.layer, e.$type = r.type;
|
|
6668
|
-
const i = Ni(this.
|
|
6677
|
+
const i = Ni(this.zr[n] ? this.zr[n](null, e) : this.getSymbol(t.properties.symbolIndex).textName, e);
|
|
6669
6678
|
delete e.$layer, delete e.$type, r.label = i;
|
|
6670
6679
|
}
|
|
6671
|
-
const s = n,
|
|
6672
|
-
for (let n = p; n < s; n += 6 *
|
|
6680
|
+
const s = n, m = o[l[p]];
|
|
6681
|
+
for (let n = p; n < s; n += 6 * m) f[0].start = n, f[0].end = n + 6 * m, f[0].boxCount = m,
|
|
6673
6682
|
e.call(this, t, f, i, u++);
|
|
6674
|
-
|
|
6683
|
+
y = h[d], p = n;
|
|
6675
6684
|
}
|
|
6676
6685
|
}
|
|
6677
|
-
|
|
6678
|
-
const c = this.Gi(), f = this.getMap(), u = t.geometry, d = u.desc.positionSize, {aShape: p, aOffset:
|
|
6679
|
-
let b = i.set(Pi,
|
|
6686
|
+
Yr(t, e, n, r, s, o, l) {
|
|
6687
|
+
const c = this.Gi(), f = this.getMap(), u = t.geometry, d = u.desc.positionSize, {aShape: p, aOffset: y, aAnchor: m} = u.properties, g = u.properties.aTextSize, v = !l, x = e[n] * d;
|
|
6688
|
+
let b = i.set(Pi, m[x], m[x + 1], 2 === d ? 0 : m[x + 2]);
|
|
6680
6689
|
const A = rn(Ti, b, o, f.width, f.height);
|
|
6681
|
-
if (a.set(ki, A[0], A[1], A[0], A[1]), f.isOffscreen(ki)) return c || zi(
|
|
6690
|
+
if (a.set(ki, A[0], A[1], A[0], A[1]), f.isOffscreen(ki)) return c || zi(y, e, n, r),
|
|
6682
6691
|
!1;
|
|
6683
6692
|
v && (b = A);
|
|
6684
6693
|
const w = v ? 1 : u.properties.tileExtent / this.layer.options.tileSize[0];
|
|
6685
6694
|
let _ = !0;
|
|
6686
|
-
const S = e[n], M = e[r - 1], P = g ? g[S] : t.properties.textSize, T = this.
|
|
6687
|
-
if (null === T) return zi(
|
|
6695
|
+
const S = e[n], M = e[r - 1], P = g ? g[S] : t.properties.textSize, T = this.Jr(t, P, s, S, M, b, w, l);
|
|
6696
|
+
if (null === T) return zi(y, e, n, r), !1;
|
|
6688
6697
|
const k = M - S <= 3, I = t.material.uniforms, O = 1 === I.pitchWithMap, C = Math.floor(T / 2), F = T % 2;
|
|
6689
6698
|
for (let i = n; i < r; i += 6) {
|
|
6690
6699
|
const o = e[i];
|
|
6691
6700
|
let a;
|
|
6692
6701
|
if (a = C || i !== n || k ? C || i !== r - 6 || k ? pi.call(this, Si, t, P, s, o, b, w, C) : Di : Hi,
|
|
6693
6702
|
!a) {
|
|
6694
|
-
_ = !1, c || zi(
|
|
6703
|
+
_ = !1, c || zi(y, e, n, r);
|
|
6695
6704
|
break;
|
|
6696
6705
|
}
|
|
6697
6706
|
let l = a[2];
|
|
@@ -6700,12 +6709,12 @@ class Li extends $e {
|
|
|
6700
6709
|
for (let t = 0; t < 4; t++) h.set(Oi, p[2 * (o + t)] / 10, p[2 * (o + t) + 1] / 10),
|
|
6701
6710
|
h.scale(Oi, Oi, P / 24), h.transformMat2(Oi, Oi, f), O ? (h.multiply(Oi, Oi, Fi),
|
|
6702
6711
|
h.add(Ci, Oi, a)) : (h.multiply(Ci, a, Fi), h.add(Ci, Oi, Ci)), Ei[0] = 10 * Ci[0],
|
|
6703
|
-
Ei[1] = 10 * Ci[1],
|
|
6704
|
-
|
|
6712
|
+
Ei[1] = 10 * Ci[1], y[2 * (o + t)] === Ei[0] && y[2 * (o + t) + 1] === Ei[1] || (y.dirty = !0,
|
|
6713
|
+
y[2 * (o + t)] = Ei[0], y[2 * (o + t) + 1] = Ei[1]);
|
|
6705
6714
|
}
|
|
6706
6715
|
return _;
|
|
6707
6716
|
}
|
|
6708
|
-
|
|
6717
|
+
Jr(t, e, n, i, r, s, o, a) {
|
|
6709
6718
|
const l = r - i <= 3, h = this.getMap();
|
|
6710
6719
|
return l ? 0 : gi.call(this, Hi, Di, t, e, n, i, r, s, o, h.width / h.height, a);
|
|
6711
6720
|
}
|
|
@@ -6718,7 +6727,7 @@ class Li extends $e {
|
|
|
6718
6727
|
}) : t.material && delete t.material.uniforms.texture), super.deleteMesh(t, e));
|
|
6719
6728
|
}
|
|
6720
6729
|
delete() {
|
|
6721
|
-
super.delete(), this.
|
|
6730
|
+
super.delete(), this.Wr.dispose(), delete this.Ur, this.qr && this.qr.dispose();
|
|
6722
6731
|
}
|
|
6723
6732
|
needClearStencil() {
|
|
6724
6733
|
return !0;
|
|
@@ -6735,7 +6744,7 @@ class Li extends $e {
|
|
|
6735
6744
|
});
|
|
6736
6745
|
let r = i;
|
|
6737
6746
|
if (this.layer.getRenderer().isEnableWorkAround("win-intel-gpu-crash") && (r = Zt({}, i),
|
|
6738
|
-
r.stencil = Zt({}, i.stencil), r.stencil.enable = !0), this.
|
|
6747
|
+
r.stencil = Zt({}, i.stencil), r.stencil.enable = !0), this.Wr = new n.MeshShader({
|
|
6739
6748
|
vert: vi,
|
|
6740
6749
|
frag: qn,
|
|
6741
6750
|
uniforms: e,
|
|
@@ -6908,7 +6917,7 @@ var Wi = "#define SHADER_NAME NATIVE_LINE\nattribute vec3 aPosition;\nuniform ma
|
|
|
6908
6917
|
|
|
6909
6918
|
class Bi extends He {
|
|
6910
6919
|
constructor(t, e, n, i, r) {
|
|
6911
|
-
if (super(t, e, n, i, r), this.primitive = "lines",
|
|
6920
|
+
if (super(t, e, n, i, r), this.primitive = "lines", m(this.symbolDef.lineColor)) {
|
|
6912
6921
|
const t = e.getMap(), n = v(this.symbolDef.lineColor);
|
|
6913
6922
|
this.colorSymbol = e => n(t.getZoom(), e);
|
|
6914
6923
|
}
|
|
@@ -7048,7 +7057,7 @@ class qi extends Ce {
|
|
|
7048
7057
|
}
|
|
7049
7058
|
o.generateBuffers(this.regl), l.setDefines(u), l.setLocalTransform(e), (o.properties.maxAltitude <= 0 || l.getUniform("level") >= 3) && (l.castShadow = !1),
|
|
7050
7059
|
l.setUniform("maxAltitude", l.geometry.properties.maxAltitude);
|
|
7051
|
-
const p = this.getMap(),
|
|
7060
|
+
const p = this.getMap(), y = p.getGLRes(), m = this.layer.getSpatialReference && this.layer.getSpatialReference(), g = (m ? m.getResolution(s) : p.getResolution(s)) / y;
|
|
7052
7061
|
return Object.defineProperty(l.uniforms, "uvOrigin", {
|
|
7053
7062
|
enumerable: !0,
|
|
7054
7063
|
get: () => {
|
|
@@ -7065,7 +7074,7 @@ class qi extends Ce {
|
|
|
7065
7074
|
enumerable: !0,
|
|
7066
7075
|
get: () => {
|
|
7067
7076
|
const t = this.getSymbol(a);
|
|
7068
|
-
return o.properties.hasAlpha || t.polygonOpacity < 1;
|
|
7077
|
+
return o.properties.hasAlpha || t.polygonOpacity < 1 || t.lineOpacity < 1;
|
|
7069
7078
|
}
|
|
7070
7079
|
}), l.properties.symbolIndex = a, l;
|
|
7071
7080
|
}
|
|
@@ -7079,10 +7088,10 @@ class qi extends Ce {
|
|
|
7079
7088
|
r;
|
|
7080
7089
|
}
|
|
7081
7090
|
needPolygonOffset() {
|
|
7082
|
-
return this.
|
|
7091
|
+
return this.Zr;
|
|
7083
7092
|
}
|
|
7084
7093
|
startFrame(...t) {
|
|
7085
|
-
return delete this.
|
|
7094
|
+
return delete this.Zr, super.startFrame(...t);
|
|
7086
7095
|
}
|
|
7087
7096
|
addMesh(t, e) {
|
|
7088
7097
|
t.forEach(t => {
|
|
@@ -7095,7 +7104,7 @@ class qi extends Ce {
|
|
|
7095
7104
|
0 === e && (e = .01), Xi[2] = e, r.fromScaling(n, Xi), r.multiply(n, t.properties.tileTransform, n),
|
|
7096
7105
|
t.setLocalTransform(n);
|
|
7097
7106
|
} else t.setLocalTransform(t.properties.tileTransform);
|
|
7098
|
-
t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.
|
|
7107
|
+
t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.Zr = !0),
|
|
7099
7108
|
this.getSymbol(t.properties.symbolIndex).ssr ? t.ssr = 1 : t.ssr = 0;
|
|
7100
7109
|
}
|
|
7101
7110
|
deleteMesh(t, e) {
|
|
@@ -7147,7 +7156,7 @@ class qi extends Ce {
|
|
|
7147
7156
|
}
|
|
7148
7157
|
updateSymbol(t, e) {
|
|
7149
7158
|
const n = super.updateSymbol(t, e);
|
|
7150
|
-
return t.material && this.
|
|
7159
|
+
return t.material && this.Kr(t.material), n;
|
|
7151
7160
|
}
|
|
7152
7161
|
Wn(t, e) {
|
|
7153
7162
|
return Zi(t) !== Zi(e);
|
|
@@ -7189,14 +7198,14 @@ class Ki extends qi {
|
|
|
7189
7198
|
return this.shader;
|
|
7190
7199
|
}
|
|
7191
7200
|
delete(t) {
|
|
7192
|
-
this.getMap().off("updatelights", this
|
|
7201
|
+
this.getMap().off("updatelights", this.$r, this), super.delete(t), this.material.dispose();
|
|
7193
7202
|
}
|
|
7194
7203
|
init() {
|
|
7195
|
-
this.getMap().on("updatelights", this
|
|
7204
|
+
this.getMap().on("updatelights", this.$r, this);
|
|
7196
7205
|
const t = this.regl;
|
|
7197
7206
|
this.renderer = new n.Renderer(t);
|
|
7198
7207
|
const e = this.getShaderConfig();
|
|
7199
|
-
this.shader = new n.PhongShader(e), this.
|
|
7208
|
+
this.shader = new n.PhongShader(e), this.Kr();
|
|
7200
7209
|
const i = {
|
|
7201
7210
|
vert: this.getPickingVert(),
|
|
7202
7211
|
uniforms: [ "projViewMatrix", "modelMatrix", "positionMatrix", {
|
|
@@ -7212,7 +7221,7 @@ class Ki extends qi {
|
|
|
7212
7221
|
};
|
|
7213
7222
|
this.picking = [ new n.FBORayPicking(this.renderer, i, this.layer.getRenderer().pickingFBO) ];
|
|
7214
7223
|
}
|
|
7215
|
-
|
|
7224
|
+
$r() {
|
|
7216
7225
|
this.setToRedraw();
|
|
7217
7226
|
}
|
|
7218
7227
|
getShaderConfig() {
|
|
@@ -7261,14 +7270,14 @@ class Ki extends qi {
|
|
|
7261
7270
|
}
|
|
7262
7271
|
};
|
|
7263
7272
|
}
|
|
7264
|
-
|
|
7273
|
+
Kr() {
|
|
7265
7274
|
this.material && this.material.dispose();
|
|
7266
7275
|
const t = this.getSymbols()[0].material, e = {};
|
|
7267
7276
|
for (const n in t) he(t, n) && (e[n] = t[n]);
|
|
7268
7277
|
this.material = new n.PhongMaterial(e);
|
|
7269
7278
|
}
|
|
7270
7279
|
getUniformValues(t, e) {
|
|
7271
|
-
const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this
|
|
7280
|
+
const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.Qr(), o = Zt({
|
|
7272
7281
|
viewMatrix: n,
|
|
7273
7282
|
projMatrix: i,
|
|
7274
7283
|
cameraPosition: r,
|
|
@@ -7281,7 +7290,7 @@ class Ki extends qi {
|
|
|
7281
7290
|
getPickingVert() {
|
|
7282
7291
|
return "\n attribute vec3 aPosition;\n uniform mat4 projViewModelMatrix;\n uniform mat4 modelMatrix;\n uniform mat4 positionMatrix;\n //引入fbo picking的vert相关函数\n #include <fbo_picking_vert>\n #include <get_output>\n void main()\n {\n mat4 localPositionMatrix = getPositionMatrix();\n vec4 localPosition = getPosition(aPosition);\n\n gl_Position = projViewModelMatrix * localPositionMatrix * localPosition;\n //传入gl_Position的depth值\n fbo_picking_setData(gl_Position.w, true);\n }\n ";
|
|
7283
7292
|
}
|
|
7284
|
-
|
|
7293
|
+
Qr() {
|
|
7285
7294
|
const t = this.getMap().getLightManager(), e = t && t.getAmbientLight() || {}, n = t && t.getDirectionalLight() || {};
|
|
7286
7295
|
return {
|
|
7287
7296
|
ambientColor: e.color || [ .2, .2, .2 ],
|
|
@@ -7296,7 +7305,7 @@ const $i = [ 1, 1, 1 ];
|
|
|
7296
7305
|
|
|
7297
7306
|
class Qi extends Ce {
|
|
7298
7307
|
constructor(t, e, n, i, r) {
|
|
7299
|
-
if (super(t, e, n, i, r),
|
|
7308
|
+
if (super(t, e, n, i, r), m(this.symbolDef[0].lineColor)) {
|
|
7300
7309
|
const t = e.getMap(), n = v(this.symbolDef.lineColor);
|
|
7301
7310
|
this.colorSymbol = e => n(t.getZoom(), e);
|
|
7302
7311
|
} else this.colorSymbol = this.getSymbol({
|
|
@@ -7351,7 +7360,7 @@ class Qi extends Ce {
|
|
|
7351
7360
|
const n = [];
|
|
7352
7361
|
return r.multiply(n, e.projViewMatrix, e.modelMatrix), n;
|
|
7353
7362
|
}
|
|
7354
|
-
}
|
|
7363
|
+
} ],
|
|
7355
7364
|
extraCommandProps: {
|
|
7356
7365
|
stencil: {
|
|
7357
7366
|
enable: !0,
|
|
@@ -7389,20 +7398,20 @@ const {getPBRUniforms: tr} = n.pbr.PBRUtils, er = [];
|
|
|
7389
7398
|
|
|
7390
7399
|
class nr extends qi {
|
|
7391
7400
|
constructor(...t) {
|
|
7392
|
-
super(...t), this.
|
|
7401
|
+
super(...t), this.ts = new n.ResourceLoader, this.scene.sortFunction = this.sortByCommandKey;
|
|
7393
7402
|
}
|
|
7394
7403
|
supportRenderMode(t) {
|
|
7395
7404
|
return this.getSymbols()[0].ssr ? "fxaa" === t || "fxaaAfterTaa" === t : super.supportRenderMode(t);
|
|
7396
7405
|
}
|
|
7397
7406
|
isAnimating() {
|
|
7398
|
-
const t = this.
|
|
7407
|
+
const t = this.es();
|
|
7399
7408
|
if (t && (t[0] || t[1])) return !0;
|
|
7400
7409
|
}
|
|
7401
7410
|
needToRedraw() {
|
|
7402
|
-
const t = this.
|
|
7411
|
+
const t = this.es();
|
|
7403
7412
|
return !(!t || !t[0] && !t[1]) || super.needToRedraw();
|
|
7404
7413
|
}
|
|
7405
|
-
|
|
7414
|
+
es() {
|
|
7406
7415
|
const t = this.getSymbols()[0];
|
|
7407
7416
|
return t.material && t.material.uvOffsetAnim;
|
|
7408
7417
|
}
|
|
@@ -7428,18 +7437,18 @@ class nr extends qi {
|
|
|
7428
7437
|
const e = Zt({}, r, t.ssr.defines);
|
|
7429
7438
|
i.shaderDefines = e;
|
|
7430
7439
|
}
|
|
7431
|
-
if (t.onlyUpdateDepthInTaa && (this.shader = this.
|
|
7440
|
+
if (t.onlyUpdateDepthInTaa && (this.shader = this.ns, !n && this.rs && (this.shader = i,
|
|
7432
7441
|
this.setToRedraw(!0))), this.updateIBLDefines(i), super.paint(t), void 0 !== this.shadowCount && e) {
|
|
7433
7442
|
const t = this.scene.getMeshes().length;
|
|
7434
7443
|
this.shadowCount !== t && this.setToRedraw();
|
|
7435
7444
|
}
|
|
7436
7445
|
this.shader = i, n && (i.shaderDefines = r), delete this.shadowCount;
|
|
7437
|
-
const s = this.
|
|
7446
|
+
const s = this.es();
|
|
7438
7447
|
if (s && (s[0] || s[1])) this.material.set("uvOffset", [ 0, 0 ]); else {
|
|
7439
7448
|
const t = this.getUVOffset(s);
|
|
7440
7449
|
this.material.set("uvOffset", t);
|
|
7441
7450
|
}
|
|
7442
|
-
this.
|
|
7451
|
+
this.rs = n;
|
|
7443
7452
|
}
|
|
7444
7453
|
getShadowMeshes() {
|
|
7445
7454
|
if (!this.isVisible()) return er;
|
|
@@ -7455,15 +7464,15 @@ class nr extends qi {
|
|
|
7455
7464
|
Zt(this.sceneConfig, t), this.setToRedraw();
|
|
7456
7465
|
}
|
|
7457
7466
|
delete() {
|
|
7458
|
-
super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.
|
|
7459
|
-
this.shader && (this.shader.dispose(), delete this.shader), this.
|
|
7460
|
-
delete this.
|
|
7467
|
+
super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.ss && this.ss.dispose(),
|
|
7468
|
+
this.shader && (this.shader.dispose(), delete this.shader), this.ns && (this.ns.dispose(),
|
|
7469
|
+
delete this.ns);
|
|
7461
7470
|
}
|
|
7462
7471
|
init(t) {
|
|
7463
|
-
this.getMap().on("updatelights", this.
|
|
7472
|
+
this.getMap().on("updatelights", this.os, this), this.createIBLTextures(), this.oi = this.oi || t;
|
|
7464
7473
|
const e = this.regl;
|
|
7465
|
-
this.renderer = new n.Renderer(e), this.
|
|
7466
|
-
this.
|
|
7474
|
+
this.renderer = new n.Renderer(e), this.as = this.ls.bind(this), this.hs = this.disposeCachedTexture.bind(this),
|
|
7475
|
+
this.cs = this.fs.bind(this), this.Kr(), this.ni(t);
|
|
7467
7476
|
const i = {
|
|
7468
7477
|
vert: "\n attribute vec3 aPosition;\n uniform mat4 projViewModelMatrix;\n uniform mat4 positionMatrix;\n //引入fbo picking的vert相关函数\n #include <line_extrusion_vert>\n #include <get_output>\n #include <fbo_picking_vert>\n void main() {\n mat4 localPositionMatrix = getPositionMatrix();\n #ifdef IS_LINE_EXTRUSION\n vec3 linePosition = getLineExtrudePosition(aPosition);\n vec4 localVertex = getPosition(linePosition);\n #else\n vec4 localVertex = getPosition(aPosition);\n #endif\n\n gl_Position = projViewModelMatrix * localPositionMatrix * localVertex;\n fbo_picking_setData(gl_Position.w, true);\n }\n ",
|
|
7469
7478
|
uniforms: [ {
|
|
@@ -7519,20 +7528,20 @@ class nr extends qi {
|
|
|
7519
7528
|
polygonOffset: this.getPolygonOffset()
|
|
7520
7529
|
}, o = {
|
|
7521
7530
|
uniforms: r,
|
|
7522
|
-
defines: this.
|
|
7531
|
+
defines: this.us(i),
|
|
7523
7532
|
extraCommandProps: s
|
|
7524
7533
|
};
|
|
7525
7534
|
this.shader = new n.pbr.StandardShader(o), o.frag = "\n precision mediump float;\n #include <gl2_frag>\n void main() {\n glFragColor = vec4(0.0);\n #if __VERSION__ == 100\n gl_FragColor = glFragColor;\n #endif\n }\n ",
|
|
7526
|
-
this.
|
|
7535
|
+
this.ns = new n.pbr.StandardShader(o);
|
|
7527
7536
|
}
|
|
7528
|
-
|
|
7537
|
+
ls({resources: t}) {
|
|
7529
7538
|
for (let e = 0; e < t.length; e++) this.addCachedTexture(t[e].url, t[e].data);
|
|
7530
7539
|
this.setToRedraw(!0);
|
|
7531
7540
|
}
|
|
7532
|
-
|
|
7541
|
+
fs() {
|
|
7533
7542
|
this.setToRedraw(!0);
|
|
7534
7543
|
}
|
|
7535
|
-
|
|
7544
|
+
Kr(t) {
|
|
7536
7545
|
const e = t || this.getSymbols()[0].material, i = {};
|
|
7537
7546
|
let r = !1;
|
|
7538
7547
|
for (const t in e) if (he(e, t)) if (t.indexOf("Texture") > 0) {
|
|
@@ -7551,15 +7560,15 @@ class nr extends qi {
|
|
|
7551
7560
|
} : s.data = a : o === s && (s = {
|
|
7552
7561
|
url: o,
|
|
7553
7562
|
wrap: "repeat"
|
|
7554
|
-
}), s.flipY = !0, i[t] = new n.Texture2D(s, this.
|
|
7555
|
-
i[t].once("disposed", this.
|
|
7563
|
+
}), s.flipY = !0, i[t] = new n.Texture2D(s, this.ts), i[t].once("complete", this.as),
|
|
7564
|
+
i[t].once("disposed", this.hs), i[t].promise && this.addCachedTexture(o, i[t].promise),
|
|
7556
7565
|
r = !0;
|
|
7557
7566
|
} else i[t] = e[t];
|
|
7558
7567
|
if (this.material) {
|
|
7559
7568
|
for (let t in i) this.material.set(t, i[t]);
|
|
7560
7569
|
this.setToRedraw(!0);
|
|
7561
|
-
} else this.material = new n.pbr.StandardMaterial(i), this.material.once("complete", this.
|
|
7562
|
-
r || this.
|
|
7570
|
+
} else this.material = new n.pbr.StandardMaterial(i), this.material.once("complete", this.cs);
|
|
7571
|
+
r || this.fs();
|
|
7563
7572
|
}
|
|
7564
7573
|
getShader() {
|
|
7565
7574
|
return this.shader;
|
|
@@ -7568,30 +7577,30 @@ class nr extends qi {
|
|
|
7568
7577
|
const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = tr(t, n, i, e && e.ssr, e && e.jitter);
|
|
7569
7578
|
return this.setIncludeUniformValues(r, e), r;
|
|
7570
7579
|
}
|
|
7571
|
-
|
|
7580
|
+
us(t) {
|
|
7572
7581
|
return this.hasIBL() ? t.HAS_IBL_LIGHTING = 1 : delete t.HAS_IBL_LIGHTING, t;
|
|
7573
7582
|
}
|
|
7574
|
-
|
|
7583
|
+
os() {
|
|
7575
7584
|
if (!this.shader) return;
|
|
7576
7585
|
const t = this.shader.shaderDefines;
|
|
7577
|
-
this.
|
|
7586
|
+
this.us(t), this.shader.shaderDefines = t;
|
|
7578
7587
|
}
|
|
7579
7588
|
}
|
|
7580
7589
|
|
|
7581
7590
|
const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr = [], hr = [ 1, 1, 1, 1 ], cr = [], fr = t => class extends t {
|
|
7582
7591
|
constructor(t, e, n, i, r) {
|
|
7583
|
-
super(t, e, n, i, r), this.
|
|
7584
|
-
this.
|
|
7592
|
+
super(t, e, n, i, r), this.ds = !1, this.scene.sortFunction = this.sortByCommandKey,
|
|
7593
|
+
this.ps = [];
|
|
7585
7594
|
}
|
|
7586
7595
|
isAnimating() {
|
|
7587
7596
|
const t = this.getSymbols();
|
|
7588
7597
|
for (let e = 0; e < t.length; e++) {
|
|
7589
|
-
if (t[e] && this.
|
|
7598
|
+
if (t[e] && this.ys[e] && this.ms(e)) return !0;
|
|
7590
7599
|
}
|
|
7591
7600
|
return !1;
|
|
7592
7601
|
}
|
|
7593
7602
|
createGeometry(t, e) {
|
|
7594
|
-
if (this.
|
|
7603
|
+
if (this.gs(), !this.ds) return null;
|
|
7595
7604
|
const {data: n, positionSize: i} = t;
|
|
7596
7605
|
return {
|
|
7597
7606
|
geometry: {
|
|
@@ -7615,7 +7624,7 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
|
|
|
7615
7624
|
instance_vectorC: new Float32Array(4 * u),
|
|
7616
7625
|
aPickingId: []
|
|
7617
7626
|
};
|
|
7618
|
-
this.
|
|
7627
|
+
this.vs(d, s, o, l.properties.z, f, h);
|
|
7619
7628
|
const p = {};
|
|
7620
7629
|
for (const t in d) p[t] = {
|
|
7621
7630
|
buffer: this.regl.buffer({
|
|
@@ -7624,26 +7633,26 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
|
|
|
7624
7633
|
}),
|
|
7625
7634
|
divisor: 1
|
|
7626
7635
|
};
|
|
7627
|
-
const
|
|
7628
|
-
for (let t = 0; t <
|
|
7629
|
-
const e =
|
|
7636
|
+
const y = [], m = this.getSymbols();
|
|
7637
|
+
for (let t = 0; t < m.length; t++) {
|
|
7638
|
+
const e = m[t], o = this.ps[t];
|
|
7630
7639
|
if (!o) continue;
|
|
7631
|
-
const {translation: l, rotation: h, scale: f, fixSizeOnZoom: g} = e, v = this.
|
|
7640
|
+
const {translation: l, rotation: h, scale: f, fixSizeOnZoom: g} = e, v = this.xs([], l, h, f);
|
|
7632
7641
|
let x = 0;
|
|
7633
7642
|
o.forEach(t => {
|
|
7634
7643
|
const {geometry: n, nodeMatrix: i} = t, s = r.multiply(cr, v, i), o = n.boundingBox.copy();
|
|
7635
7644
|
o.transform(s);
|
|
7636
|
-
const a = this.
|
|
7645
|
+
const a = this.bs(o, e);
|
|
7637
7646
|
a > x && (x = a);
|
|
7638
7647
|
});
|
|
7639
7648
|
const b = [ 0, 0, x ], A = o.map(o => {
|
|
7640
|
-
const {geometry: l, nodeMatrix: h, materialInfo: f, skin:
|
|
7649
|
+
const {geometry: l, nodeMatrix: h, materialInfo: f, skin: y, morphWeights: m, extraInfo: x} = o, A = new (this.getMaterialClazz(f))(f), w = {}, _ = new n.InstancedMesh(p, u, l, A, {
|
|
7641
7650
|
transparent: !1,
|
|
7642
7651
|
picking: !0
|
|
7643
7652
|
});
|
|
7644
|
-
|
|
7645
|
-
_.setUniform("numJoints",
|
|
7646
|
-
|
|
7653
|
+
y && (_.setUniform("jointTexture", y.jointTexture), _.setUniform("jointTextureSize", y.jointTextureSize),
|
|
7654
|
+
_.setUniform("numJoints", y.numJoints), _.setUniform("skinAnimation", 0), w.HAS_SKIN = 1),
|
|
7655
|
+
m && (_.setUniform("morphWeights", m), w.HAS_MORPH = 1), _.setUniform("hasAlpha", x.alphaMode && "BLEND" === x.alphaMode.toUpperCase()),
|
|
7647
7656
|
ee(_.uniforms, "polygonFill", e, "polygonFill", hr, re(this.colorCache)), ee(_.uniforms, "polygonOpacity", e, "polygonOpacity", 1);
|
|
7648
7657
|
const S = r.multiply([], v, h), M = [];
|
|
7649
7658
|
return r.fromTranslation(M, b), r.multiply(S, M, S), _.setPositionMatrix(() => {
|
|
@@ -7659,17 +7668,17 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
|
|
|
7659
7668
|
index: t
|
|
7660
7669
|
}, _;
|
|
7661
7670
|
});
|
|
7662
|
-
|
|
7671
|
+
y.push(...A);
|
|
7663
7672
|
}
|
|
7664
|
-
return
|
|
7673
|
+
return y.insContext = {
|
|
7665
7674
|
instanceData: d,
|
|
7666
7675
|
tileTranslationMatrix: s,
|
|
7667
7676
|
tileExtent: o,
|
|
7668
7677
|
aPosition: f,
|
|
7669
7678
|
positionSize: h
|
|
7670
|
-
},
|
|
7679
|
+
}, y;
|
|
7671
7680
|
}
|
|
7672
|
-
|
|
7681
|
+
bs(t, e) {
|
|
7673
7682
|
const n = e.anchorZ || "bottom";
|
|
7674
7683
|
let i = 0;
|
|
7675
7684
|
return "bottom" === n ? i = -t.min[2] : "top" === n ? i = -t.max[2] : "center" === n && (i = -(t.min[2] + t.max[2]) / 2),
|
|
@@ -7690,12 +7699,12 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
|
|
|
7690
7699
|
let n = !1;
|
|
7691
7700
|
for (let i = 0; i < e.length; i++) {
|
|
7692
7701
|
const r = e[i];
|
|
7693
|
-
if (!r || !this.
|
|
7694
|
-
if (this.ms(i) && this.
|
|
7702
|
+
if (!r || !this.ys[i]) continue;
|
|
7703
|
+
if (this.ms(i) && this.ys[i]) {
|
|
7695
7704
|
n || (n = !0);
|
|
7696
7705
|
let e = r.speed;
|
|
7697
7706
|
const s = !!r.loop;
|
|
7698
|
-
Qt(e) && (e = 1), this.
|
|
7707
|
+
Qt(e) && (e = 1), this.ys[i].updateAnimation(t.timestamp, s, e);
|
|
7699
7708
|
}
|
|
7700
7709
|
}
|
|
7701
7710
|
n && this.setToRedraw(!0), super.prepareRender(t);
|
|
@@ -7707,9 +7716,9 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
|
|
|
7707
7716
|
}
|
|
7708
7717
|
ms(t) {
|
|
7709
7718
|
const e = this.getSymbols()[t];
|
|
7710
|
-
return e && e.animation && this.
|
|
7719
|
+
return e && e.animation && this.ys[t] && this.ys[t].hasSkinAnimation();
|
|
7711
7720
|
}
|
|
7712
|
-
|
|
7721
|
+
vs(t, e, n, s, o, a) {
|
|
7713
7722
|
function l(e, n, i, r) {
|
|
7714
7723
|
t[e][4 * n] = i[r], t[e][4 * n + 1] = i[r + 4], t[e][4 * n + 2] = i[r + 8], t[e][4 * n + 3] = i[r + 12];
|
|
7715
7724
|
}
|
|
@@ -7725,26 +7734,26 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
|
|
|
7725
7734
|
return t.positionAttribute = "POSITION", t.normalAttribute = "NORMAL", t;
|
|
7726
7735
|
}
|
|
7727
7736
|
init(t) {
|
|
7728
|
-
super.init(t), this.
|
|
7737
|
+
super.init(t), this.gs();
|
|
7729
7738
|
}
|
|
7730
|
-
|
|
7731
|
-
if (this.
|
|
7732
|
-
this.
|
|
7739
|
+
gs() {
|
|
7740
|
+
if (this.ys) return;
|
|
7741
|
+
this.ys = [];
|
|
7733
7742
|
const t = this.layer.getRenderer(), e = this.getSymbols();
|
|
7734
|
-
this.
|
|
7743
|
+
this.As = 0;
|
|
7735
7744
|
for (let i = 0; i < e.length; i++) {
|
|
7736
7745
|
const r = e[i].url;
|
|
7737
7746
|
if (t.isCachePlaced(r)) continue;
|
|
7738
7747
|
const s = t.fetchCache(r);
|
|
7739
|
-
s ? (this.
|
|
7748
|
+
s ? (this.ys[i] = [ s ], this.ps[i] = s.getMeshesInfo(), this.As++, t.addToCache(r)) : (t.placeCache(r),
|
|
7740
7749
|
n.GLTFHelper.load(r).then(s => {
|
|
7741
7750
|
const o = n.GLTFHelper.exportGLTFPack(s, this.regl);
|
|
7742
|
-
this.
|
|
7751
|
+
this.ys[i] = [ o ], this.ps[i] = o.getMeshesInfo(), t.addToCache(r, o, t => {
|
|
7743
7752
|
t.dispose();
|
|
7744
|
-
}), this.
|
|
7753
|
+
}), this.As++, this.As >= e.length && (this.ds = !0), this.setToRedraw(!0);
|
|
7745
7754
|
}));
|
|
7746
7755
|
}
|
|
7747
|
-
this.
|
|
7756
|
+
this.As >= e.length && (this.ds = !0);
|
|
7748
7757
|
}
|
|
7749
7758
|
getPickingVert() {
|
|
7750
7759
|
return "\n attribute vec3 aPosition;\n uniform mat4 projViewModelMatrix;\n uniform mat4 modelMatrix;\n uniform mat4 positionMatrix;\n //引入fbo picking的vert相关函数\n #include <fbo_picking_vert>\n #include <get_output>\n void main()\n {\n mat4 localPositionMatrix = getPositionMatrix();\n vec4 localPosition = getPosition(aPosition);\n\n gl_Position = projViewModelMatrix * localPositionMatrix * localPosition;\n //传入gl_Position的depth值\n fbo_picking_setData(gl_Position.w, true);\n }";
|
|
@@ -7758,15 +7767,15 @@ const ir = [], rr = [], sr = [ 0, 0, 0 ], or = [ 0, 0, 0 ], ar = [ 1, 1, 1 ], lr
|
|
|
7758
7767
|
delete() {
|
|
7759
7768
|
super.delete();
|
|
7760
7769
|
const t = this.getSymbols()[0].url;
|
|
7761
|
-
if (this.layer.getRenderer().removeCache(t), this.
|
|
7762
|
-
const e = this.
|
|
7770
|
+
if (this.layer.getRenderer().removeCache(t), this.ps) for (let t = 0; t < this.ps.length; t++) {
|
|
7771
|
+
const e = this.ps[t];
|
|
7763
7772
|
for (let n = 0; n < e.length; n++) {
|
|
7764
7773
|
const n = e[t], {geometry: i, materialInfo: r} = n;
|
|
7765
7774
|
if (i && i.dispose(), r) for (const t in r) r[t] && r[t].destroy && r[t].destroy();
|
|
7766
7775
|
}
|
|
7767
7776
|
}
|
|
7768
7777
|
}
|
|
7769
|
-
|
|
7778
|
+
xs(t, e, n, s) {
|
|
7770
7779
|
const o = i.set(ir, ...e || sr), a = n || or, l = s || ar, h = c.fromEuler(rr, a[0], a[1], a[2]);
|
|
7771
7780
|
return r.fromRotationTranslationScale(t, h, o, l);
|
|
7772
7781
|
}
|
|
@@ -7787,9 +7796,9 @@ class dr extends(fr(nr)){
|
|
|
7787
7796
|
const pr = {
|
|
7788
7797
|
color: [ 2.0303, 2.028, 2.028 ],
|
|
7789
7798
|
direction: [ 0, -.2717, -1 ]
|
|
7790
|
-
},
|
|
7799
|
+
}, yr = {
|
|
7791
7800
|
index: 0
|
|
7792
|
-
},
|
|
7801
|
+
}, mr = [ 0, 0, 0 ];
|
|
7793
7802
|
|
|
7794
7803
|
class gr extends He {
|
|
7795
7804
|
supportRenderMode(t) {
|
|
@@ -7799,7 +7808,7 @@ class gr extends He {
|
|
|
7799
7808
|
return !0;
|
|
7800
7809
|
}
|
|
7801
7810
|
needToRedraw() {
|
|
7802
|
-
return this.getSymbol(
|
|
7811
|
+
return this.getSymbol(yr).animation;
|
|
7803
7812
|
}
|
|
7804
7813
|
createMesh(t, e) {
|
|
7805
7814
|
const {geometry: i} = t;
|
|
@@ -7808,29 +7817,29 @@ class gr extends He {
|
|
|
7808
7817
|
castShadow: !1,
|
|
7809
7818
|
picking: !0
|
|
7810
7819
|
});
|
|
7811
|
-
return r.properties.symbolIndex =
|
|
7820
|
+
return r.properties.symbolIndex = yr, r.setLocalTransform(e), r;
|
|
7812
7821
|
}
|
|
7813
7822
|
callShader(t, e) {
|
|
7814
7823
|
super.callShader(t, e), this.transformWater();
|
|
7815
|
-
const n = this.
|
|
7816
|
-
this.renderer.render(this.
|
|
7824
|
+
const n = this.ws(this.getMap(), e);
|
|
7825
|
+
this.renderer.render(this._s, n, this.Ss, this.getRenderFBO(e));
|
|
7817
7826
|
}
|
|
7818
7827
|
addMesh(t, e) {
|
|
7819
7828
|
this.si(t, e), super.addMesh(...arguments);
|
|
7820
7829
|
}
|
|
7821
7830
|
si(t) {
|
|
7822
|
-
const e = this.getSymbol(
|
|
7831
|
+
const e = this.getSymbol(yr).ssr;
|
|
7823
7832
|
for (let n = 0; n < t.length; n++) t[n].ssr = e ? 1 : 0;
|
|
7824
7833
|
}
|
|
7825
7834
|
paint(t) {
|
|
7826
|
-
t.states && t.states.includesChanged && (this.shader.dispose(), this.
|
|
7835
|
+
t.states && t.states.includesChanged && (this.shader.dispose(), this._s.dispose(),
|
|
7827
7836
|
this.ni(t));
|
|
7828
|
-
const e = !!t.ssr && this.getSymbol(
|
|
7837
|
+
const e = !!t.ssr && this.getSymbol(yr).ssr, n = this._s, i = n.shaderDefines;
|
|
7829
7838
|
if (e) {
|
|
7830
7839
|
const e = Zt({}, i, t.ssr.defines);
|
|
7831
7840
|
n.shaderDefines = e;
|
|
7832
7841
|
}
|
|
7833
|
-
this.updateIBLDefines(n), this.
|
|
7842
|
+
this.updateIBLDefines(n), this.Ms.ssr = e ? 1 : 0, super.paint(t), e && (n.shaderDefines = i);
|
|
7834
7843
|
}
|
|
7835
7844
|
init(t) {
|
|
7836
7845
|
this.createIBLTextures();
|
|
@@ -7848,38 +7857,38 @@ class gr extends He {
|
|
|
7848
7857
|
extraCommandProps: {
|
|
7849
7858
|
viewport: this.pickingViewport
|
|
7850
7859
|
}
|
|
7851
|
-
}, this.pickingFBO) ]), this.
|
|
7860
|
+
}, this.pickingFBO) ]), this.Ps();
|
|
7852
7861
|
}
|
|
7853
|
-
|
|
7862
|
+
Ps() {
|
|
7854
7863
|
const t = this.regl;
|
|
7855
|
-
this.
|
|
7864
|
+
this.Ts = t.texture(2), this.ks = [ 2, 2 ];
|
|
7856
7865
|
const e = this.getSymbol({
|
|
7857
7866
|
index: 0
|
|
7858
7867
|
}), n = e.texWaveNormal, i = this.getCachedTexture(n), r = this;
|
|
7859
|
-
if (i) i.loading || (this.
|
|
7868
|
+
if (i) i.loading || (this.Is = this.Os(t, i)); else {
|
|
7860
7869
|
const e = new Image;
|
|
7861
7870
|
e.loading = !0, e.onload = function() {
|
|
7862
|
-
delete this.loading, r.
|
|
7871
|
+
delete this.loading, r.Is = r.Os(t, this), this.ks = [ this.width, this.height ],
|
|
7863
7872
|
r.setToRedraw();
|
|
7864
7873
|
}, e.onerror = () => {
|
|
7865
7874
|
console.error("invalid water wave normal texture:" + n);
|
|
7866
7875
|
}, this.addCachedTexture(n, e), e.src = n;
|
|
7867
7876
|
}
|
|
7868
7877
|
const s = e.texWavePerturbation, o = this.getCachedTexture(s);
|
|
7869
|
-
if (o) o.loading || (this.
|
|
7878
|
+
if (o) o.loading || (this.Cs = this.Os(t, o)); else {
|
|
7870
7879
|
const e = new Image;
|
|
7871
7880
|
e.loading = !0, e.onload = function() {
|
|
7872
|
-
delete this.loading, r.
|
|
7881
|
+
delete this.loading, r.Cs = r.Os(t, this), this.ks = [ this.width, this.height ],
|
|
7873
7882
|
r.setToRedraw();
|
|
7874
7883
|
}, e.onerror = () => {
|
|
7875
7884
|
console.error("invalid water wave perturbation texture:" + s);
|
|
7876
7885
|
}, this.addCachedTexture(s, e), e.src = s;
|
|
7877
7886
|
}
|
|
7878
7887
|
}
|
|
7879
|
-
|
|
7880
|
-
return this.
|
|
7881
|
-
width: this.
|
|
7882
|
-
height: this.
|
|
7888
|
+
Os(t, e) {
|
|
7889
|
+
return this.Ts ? t.texture({
|
|
7890
|
+
width: this.ks[0],
|
|
7891
|
+
height: this.ks[1],
|
|
7883
7892
|
mag: "linear",
|
|
7884
7893
|
min: "linear mipmap linear",
|
|
7885
7894
|
wrapS: "repeat",
|
|
@@ -7976,7 +7985,7 @@ class gr extends He {
|
|
|
7976
7985
|
enable: !1
|
|
7977
7986
|
}
|
|
7978
7987
|
};
|
|
7979
|
-
i.push(...n.SsrPass.getUniformDeclares()), this.
|
|
7988
|
+
i.push(...n.SsrPass.getUniformDeclares()), this._s = new n.MeshShader({
|
|
7980
7989
|
vert: "#define SHADER_NAME WATER\nuniform mat4 modelMatrix;\nuniform mat4 projViewModelMatrix;\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nuniform vec2 uvOffset;\nuniform vec2 noiseUvOffset;\nuniform vec2 uvScale;\nvarying vec2 vUv;\nvarying vec2 vNoiseUv;\nvarying vec3 vPos;\nvarying mat3 vTbnMatrix;\n#ifdef HAS_SSR\nuniform mat4 modelViewMatrix;\nvarying vec4 vViewVertex;\n#endif\nmat3 c(in vec3 d) {\n vec3 t = normalize(cross(d, vec3(.0, 1., .0)));\n vec3 e = normalize(cross(d, t));\n return mat3(t, e, d);\n}\n#if defined(HAS_SHADOWING)\n#include <vsm_shadow_vert>\n#endif\nconst vec3 f = vec3(0., 0., 1.);\nvoid main(void) {\n vec4 h = vec4(aPosition, 1.);\n vec4 i = modelMatrix * h;\n vPos = i.xyz;\n vTbnMatrix = c(f);\n gl_Position = projViewModelMatrix * h;\n vUv = aTexCoord * uvScale + uvOffset;\n vNoiseUv = aTexCoord * uvScale * TIME_NOISE_TEXTURE_REPEAT + noiseUvOffset;\n#ifdef HAS_SSR\nvec4 j = modelViewMatrix * h;\n vViewVertex = j;\n#endif\n#if defined(HAS_SHADOWING)\nshadow_computeShadowPars(h);\n#endif\n}",
|
|
7981
7990
|
frag: "#define SHADER_NAME WATER\nprecision highp float;\nprecision highp sampler2D;\n#include <hsv_frag>\nuniform vec3 hsv;\nuniform float contrast;\n#if defined(HAS_SHADOWING)\n#include <vsm_shadow_frag>\n#endif\n#if defined(HAS_IBL_LIGHTING)\nuniform vec3 hdrHsv;\nuniform samplerCube specularPBR;\nuniform float rgbmRange;\nuniform vec3 diffuseSPH[9];\n#else\nuniform vec3 ambientColor;\n#endif\nstruct PBRShadingWater {\n float NdotL;\n float NdotV;\n float NdotH;\n float VdotH;\n float LdotH;\n float VdotN;\n};\nvec3 c(const in vec4 d, const in float e) {\n if(e <= .0)\n return d.rgb;\n return e * d.rgb * d.a;\n}\n#ifdef HAS_SSR\nvarying vec4 vViewVertex;\nuniform mat3 modelViewNormalMatrix;\nuniform sampler2D TextureDepth;\nuniform highp vec2 outSize;\nuniform float ssrFactor;\nuniform float ssrQuality;\nuniform sampler2D TextureReflected;\nuniform highp mat4 projMatrix;\nuniform mat4 invProjMatrix;\nuniform vec4 outputFovInfo[2];\nuniform mat4 reprojViewProjMatrix;\nuniform vec2 cameraNearFar;\nfloat f(const in vec4 h) {\n return h.r + h.g / 255.;\n}\nfloat i(const in vec2 j, const in float k) {\n vec3 l = vec3(.06711056, .00583715, 52.9829189);\n return fract(l.z * fract(dot(j.xy + k * vec2(47., 17.) * .695, l.xy))) * .5;\n}\nvec3 m(const in float n, const in float o, const in vec2 u) {\n float v = min(o - .01, n);\n float A = floor(v);\n float B = min(o, A + 1.);\n float C = pow(2., B);\n vec2 D = 2. * C / u;\n if(v - A > .5)\n C *= 2.;\n return vec3(D, C);\n}\nvec2 E(const in vec2 F, const in vec3 G) {\n vec2 H = max(G.xy, min(1. - G.xy, F));\n return vec2(2. * H.x, G.z - 1. - H.y) / G.z;\n}\nvec3 I(const in mat4 J, const in vec3 K) {\n vec4 L = J * vec4(K, 1.);\n return vec3(.5 + .5 * L.xy / L.w, L.w);\n}\nvec3 M(const in float N, const in vec2 H) {\n return texture2D(TextureReflected, H).rgb;\n}\nfloat O(float P) {\n highp mat4 J = projMatrix;\n highp float z = P * 2. - 1.;\n return -J[3].z / (z + J[2].z);\n}\nfloat Q(const vec2 H) {\n float P = f(texture2D(TextureDepth, H));\n return P;\n}\nvec3 R(const in float k, const in vec3 S, const in vec3 T, const in vec3 U, const in vec3 V, const in float W) {\n vec2 X;\n X.x = i(gl_FragCoord.yx, k);\n X.y = fract(X.x * 52.9829189);\n X.y = mix(X.y, 1., .7);\n float Y = 2. * 3.14159 * X.x;\n float Z = pow(max(X.y, .000001), W / (2. - W));\n float ba = sqrt(1. - Z * Z);\n vec3 bb = vec3(ba * cos(Y), ba * sin(Y), Z);\n bb = bb.x * S + bb.y * T + bb.z * U;\n return normalize((2. * dot(V, bb)) * bb - V);\n}\nfloat bc(const in float k) {\n return (i(gl_FragCoord.xy, k) - .5);\n}\nvec3 bd(const in vec3 be, const in float bf, const in vec3 bg) {\n vec3 bh = I(projMatrix, vViewVertex.xyz + bg * bf);\n bh.z = 1. / bh.z;\n bh -= be;\n float bi = min(1., .99 * (1. - be.x) / max(1e-5, bh.x));\n float bj = min(1., .99 * (1. - be.y) / max(1e-5, bh.y));\n float bk = min(1., .99 * be.x / max(1e-5, -bh.x));\n float bl = min(1., .99 * be.y / max(1e-5, -bh.y));\n return bh * min(bi, bj) * min(bk, bl);\n}\nfloat bm(const in vec3 be, const in vec3 bh, inout float bn, inout float bo) {\n float bp = (bo + bn) * .5;\n vec3 bq = be + bh * bp;\n float z = Q(bq.xy);\n float P = O(z);\n float br = -1. / bq.z;\n bn = P > br ? bn : bp;\n bo = P > br ? bp : bo;\n return bp;\n}\nvec4 bs(const in vec3 be, const in float bf, in float bt, const in vec3 bg, const in float bu, const in float k) {\n const int bv = 20;\n float bw = 1. / float(bv);\n bt *= bw;\n vec3 bh = bd(be, bf, bg);\n float bx = bw;\n vec3 by = vec3(.0, bx, 1.);\n vec3 bq;\n float z, P, br, bz, bA, bB;\n bool bC;\n float bD = 1.;\n float bp;\n for(int bE = 0; bE < bv; bE++) {\n bq = be + bh * by.y;\n z = Q(bq.xy);\n P = O(z);\n br = -1. / bq.z;\n bz = br - P;\n bz *= clamp(sign(abs(bz) - bf * bw * bw), .0, 1.);\n bC = abs(bz + bt) < bt;\n bA = clamp(by.x / (by.x - bz), .0, 1.);\n bB = bC ? by.y + bA * bw - bw : 1.;\n by.z = min(by.z, bB);\n by.x = bz;\n if(bC) {\n float bn = by.y - bw;\n float bo = by.y;\n bp = bm(be, bh, bn, bo);\n bp = bm(be, bh, bn, bo);\n bp = bm(be, bh, bn, bo);\n bD = bp;\n break;\n }\n by.y += bw;\n }\n return vec4(be + bh * bD, 1. - bD);\n}\nvec3 bF(in vec4 bG, const in float bH, const in vec3 bI, const in vec3 bJ, const in float bu) {\n vec4 bK = mix(outputFovInfo[0], outputFovInfo[1], bG.x);\n bG.xyz = vec3(mix(bK.xy, bK.zw, bG.y), 1.) * -1. / bG.z;\n bG.xyz = (reprojViewProjMatrix * vec4(bG.xyz, 1.)).xyw;\n bG.xy /= bG.z;\n float bL = clamp(6. - 6. * max(abs(bG.x), abs(bG.y)), .0, 1.);\n bG.xy = .5 + .5 * bG.xy;\n return vec3(bG.xy, 1.);\n}\nvec3 ssr(const in vec3 bI, const in vec3 bJ, const in float bu, const in vec3 bM, const in vec3 V) {\n float bN = .0;\n vec4 bO = vec4(.0);\n float W = bu * bu;\n W = W * W;\n vec3 bP = abs(bM.z) < .999 ? vec3(.0, .0, 1.) : vec3(1., .0, .0);\n vec3 S = normalize(cross(bP, bM));\n vec3 T = cross(bM, S);\n float bH = ssrFactor * clamp(-4. * dot(V, bM) + 3.8, .0, 1.);\n bH *= clamp(4.7 - bu * 5., .0, 1.);\n vec3 be = I(projMatrix, vViewVertex.xyz);\n be.z = 1. / be.z;\n vec3 bg = R(bN, S, T, bM, V, W);\n float bf = mix(cameraNearFar.y + vViewVertex.z, -vViewVertex.z - cameraNearFar.x, bg.z * .5 + .5);\n float bt = .5 * bf;\n vec4 bG;\n if(dot(bg, bM) > .001 && bH > .0) {\n bG = bs(be, bf, bt, bg, bu, bN);\n if(bG.w > .0)\n return bF(bG, bH, bI, bJ, bu);\n \n }\n return vec3(.0);\n}\n#endif\nconst vec3 bQ = vec3(0., 0., 1.);\nuniform mat4 viewMatrix;\nuniform sampler2D normalTexture;\nuniform sampler2D heightTexture;\nuniform vec4 waveParams;\nuniform vec2 waterDir;\nuniform vec4 waterBaseColor;\nuniform vec3 lightDirection;\nuniform vec3 lightColor;\nuniform vec3 camPos;\nuniform float timeElapsed;\nvarying vec2 vUv;\nvarying vec2 vNoiseUv;\nvarying vec3 vPos;\nvarying mat3 vTbnMatrix;\nfloat bR(vec3 bS, float bT) {\n float bU = max(.015, bT);\n return max((bS.x + bS.y) * .3303545 / bU + .3303545, .0);\n}\nconst vec2 bV = vec2(6. / 25., 5. / 24.);\nvec2 bW(sampler2D bX, vec2 H) {\n return 2. * texture2D(bX, H).rg - 1.;\n}\nfloat bY(vec2 H) {\n return texture2D(heightTexture, H).b;\n}\nvec3 bZ(sampler2D bX, vec2 H) {\n return 2. * texture2D(bX, H).rgb - 1.;\n}\nfloat ca(vec2 H, float cb) {\n return fract(cb);\n}\nfloat cc(vec2 H, float cb) {\n float cd = ca(H, cb);\n return 1. - abs(1. - 2. * cd);\n}\nvec3 ce(sampler2D cf, vec2 H, float cb, float cg) {\n float ch = waveParams[2];\n float ci = waveParams[3];\n vec2 cj = bW(cf, H) * ch;\n float cd = ca(H, cb + cg);\n float ck = cc(H, cb + cg);\n vec2 bO = H;\n bO -= cj * (cd + ci);\n bO += cg;\n bO += (cb - cd) * bV;\n return vec3(bO, ck);\n}\nconst float cl = 7.77;\nvec3 cm(sampler2D cn, sampler2D co, vec2 cp, vec2 cq, float cb) {\n float bT = waveParams[0];\n vec2 cr = cb * -cq;\n float cs = bY(vNoiseUv) * cl;\n vec3 ct = ce(co, cp + cr, cb + cs, .0);\n vec3 cu = ce(co, cp + cr, cb + cs, .5);\n vec3 cv = bZ(cn, ct.xy) * ct.z;\n vec3 cw = bZ(cn, cu.xy) * cu.z;\n vec3 cx = normalize(cv + cw);\n cx.xy *= bT;\n cx.z = sqrt(1. - dot(cx.xy, cx.xy));\n return cx;\n}\nvec4 cy(vec2 cp, float cz) {\n float cA = waveParams[1];\n vec3 bM = cm(normalTexture, heightTexture, cp * cA, waterDir, cz);\n float cB = bR(bM, waveParams[0]);\n return vec4(bM, cB);\n}\nconst float cC = 3.141592653589793;\nconst float cD = 1. / cC;\nconst float cE = .3183098861837907;\nconst float cF = 1.570796326794897;\nconst float cG = .4;\nfloat cH = 2.2;\nvec3 cI(float cJ, vec3 cK, float cL) {\n return cK + (cL - cK) * pow(1. - cJ, 5.);\n}\nfloat cM(float cN, float bu) {\n float cO = bu * bu;\n float cP = cN * cN;\n float cQ = pow((cP * (cO - 1.) + 1.), cH) * cC;\n return cO / cQ;\n}\nfloat cR(float cS) {\n return .25 / (cS * cS);\n}\nvec3 cT(const vec3 x) {\n return (x * (2.51 * x + .03)) / (x * (2.43 * x + .59) + .14);\n}\nconst float cU = 2.2;\nconst float cV = .4545454545;\nvec4 cW(vec4 d) {\n return vec4(pow(d.rgb, vec3(cV)), d.w);\n}\nvec3 cX(vec3 d) {\n return pow(d, vec3(cU));\n}\nconst vec3 cY = vec3(.02, 1., 5.);\nconst vec2 cZ = vec2(.02, .1);\nconst float bu = .06;\nconst float da = 1.7;\nconst vec3 db = vec3(0, .6, .9);\nconst vec3 dc = vec3(.72, .92, 1.);\nconst float dd = .65;\nconst float de = 300000.0;\nconst float df = 500000.0;\nconst float dg = .775;\nconst float dh = .8;\nvec3 di(in vec3 bS, in vec3 dj) {\n \n#ifdef HAS_IBL_LIGHTING\nvec3 dk = reflect(-dj, bS);\n return c(textureCube(specularPBR, dk), rgbmRange);\n#else\nreturn ambientColor;\n#endif\n}\nPBRShadingWater dl;\nvec3 dm(in PBRShadingWater dn, float bu, vec3 dp, float dq) {\n vec3 dr = cI(dn.VdotH, dp, dq);\n float ds = cM(dn.NdotH, bu);\n float dt = cR(dn.LdotH);\n float du = mix(bu + .045, bu + .385, 1. - dn.VdotH);\n float dv = 1.2;\n float dw = cM(dn.NdotH, du) * dv;\n return ((ds + dw) * dt) * dr;\n}\nvec3 dx(float da, float dy, vec3 db, float dz) {\n return da * (.075 * db * pow(dy, 4.) + 50. * pow(dy, 23.)) * dz;\n}\nvec3 dA(in float Z, in vec3 dB, in vec3 dC) {\n float dD = pow((1. - Z), cY[2]);\n return mix(dC, dB, dD);\n}\nvec3 dE(in vec3 bS, in vec3 dj, in vec3 dF, vec3 d, in vec3 dG, in vec3 dH, in float dI, float dJ, vec3 dK) {\n float dL = 0.;\n vec3 dM = cX(d);\n vec3 bb = normalize(dF + dj);\n dl.NdotL = clamp(dot(bS, dF), .0, 1.);\n dl.NdotV = clamp(dot(bS, dj), .001, 1.);\n dl.VdotN = clamp(dot(dj, bS), .001, 1.);\n dl.NdotH = clamp(dot(bS, bb), .0, 1.);\n dl.VdotH = clamp(dot(dj, bb), .0, 1.);\n dl.LdotH = clamp(dot(dF, bb), .0, 1.);\n float dN = max(dot(dH, dj), .0);\n vec3 dO = cX(dc);\n vec3 dP = cX(db);\n vec3 dc = dA(dN, dO, dP);\n float dQ = max(dot(dH, dF), .0);\n float dR = .1 + dQ * .9;\n dc *= dR;\n float dS = clamp(dI, .8, 1.);\n vec3 dT = cI(dl.VdotN, vec3(cY[0]), cY[1]);\n vec3 dU = dT * dc * dS;\n vec3 dV = dM * mix(dc, dQ * dG * cD, 2. / 3.) * dS;\n vec3 dW = vec3(.0);\n if(dN > .0 && dQ > .0) {\n vec3 dX = dm(dl, bu, vec3(cZ[0]), cZ[1]);\n vec3 dY = dG * cD * dI;\n dW = dl.NdotL * dY * dX;\n }\n vec3 cB = vec3(.0);\n if(dN > .0) {\n cB = dx(da, dJ, db, dR);\n }\n vec3 dZ = vec3(.0);\n#ifdef HAS_SSR\nfloat ea = smoothstep(df, de, -dK.z);\n mat4 eb = viewMatrix;\n vec4 ec = vec4(dK.xyz, 1.);\n vec3 ed = normalize(ec.xyz);\n vec4 ee = eb * vec4(bS, .0);\n vec3 ef = normalize(ee.xyz);\n vec4 eg = eb * vec4(dH, .0);\n float eh = pow(max(dot(-ed, eg.xyz), .0), cG);\n vec3 ei = mix(eg.xyz, ef, eh);\n vec3 ej = ssr(vec3(.0), vec3(1.), bu, normalize(ei), -normalize(vViewVertex.xyz));\n if(ej.z > .0) {\n vec2 ek = smoothstep(.3, .6, abs(vec2(.5) - ej.xy));\n dL = dg * clamp(1. - 1.3 * ek.y, .0, 1.) * ea;\n vec3 el = M(.0, ej.xy);\n dZ = cX(el) * dL * dT.y * dd;\n }\n#endif\nfloat em = mix(dh, dh * .5, dL);\n return cT((1. - dL) * dU + dZ + dV * em + dW + cB);\n}\nvoid main() {\n vec3 dH = bQ;\n vec4 en = cy(vUv, timeElapsed);\n vec3 bS = normalize(vTbnMatrix * en.xyz);\n vec3 dj = -normalize(vPos - camPos);\n vec3 dF = normalize(-lightDirection);\n#if defined(HAS_SHADOWING)\nfloat dI = shadow_computeShadow();\n#else\nfloat dI = 1.;\n#endif\nvec4 eo = viewMatrix * vec4(vPos, 1.);\n vec4 ep = vec4(dE(bS, dj, dF, waterBaseColor.rgb, lightColor, dH, dI, en.w, eo.xyz), waterBaseColor.a);\n gl_FragColor = cW(ep);\n if(contrast != 1.) {\n gl_FragColor = contrastMatrix(contrast) * gl_FragColor;\n }\n if(length(hsv) > .0) {\n gl_FragColor = hsv_apply(gl_FragColor, hsv);\n }\n}",
|
|
7982
7991
|
defines: s,
|
|
@@ -7997,10 +8006,10 @@ class gr extends He {
|
|
|
7997
8006
|
};
|
|
7998
8007
|
return this.setIncludeUniformValues(i, e), i;
|
|
7999
8008
|
}
|
|
8000
|
-
|
|
8009
|
+
ws(t, e) {
|
|
8001
8010
|
const {iblTexes: n} = this.getIBLRes(), i = t.projViewMatrix, r = t.getLightManager();
|
|
8002
8011
|
let s = r && r.getDirectionalLight() || {};
|
|
8003
|
-
const o = r && r.getAmbientLight() || {}, a = this.getSymbol(
|
|
8012
|
+
const o = r && r.getAmbientLight() || {}, a = this.getSymbol(yr), l = this.Fs = this.Fs || [], h = {
|
|
8004
8013
|
hdrHsv: o.hsv || [ 0, 0, 0 ],
|
|
8005
8014
|
specularPBR: n && n.prefilterMap,
|
|
8006
8015
|
rgbmRange: n && n.rgbmRange,
|
|
@@ -8014,36 +8023,36 @@ class gr extends He {
|
|
|
8014
8023
|
lightColor: s.color || pr.color,
|
|
8015
8024
|
camPos: t.cameraPosition,
|
|
8016
8025
|
timeElapsed: a.animation ? (this.layer.getRenderer().getFrameTimestamp() || 0) / (1 / (a.waterSpeed || 1) * 1e4) : 0,
|
|
8017
|
-
normalTexture: this.
|
|
8018
|
-
heightTexture: this.
|
|
8026
|
+
normalTexture: this.Is || this.Ts,
|
|
8027
|
+
heightTexture: this.Cs || this.Ts,
|
|
8019
8028
|
waveParams: [ .09, a.uvScale || 3, .03, -.5 ],
|
|
8020
8029
|
waterDir: vr(l, a.waterDirection || 0),
|
|
8021
8030
|
waterBaseColor: a.waterBaseColor || [ .1451, .2588, .4863, 1 ],
|
|
8022
8031
|
contrast: a.contrast || 1,
|
|
8023
|
-
hsv: a.hsv ||
|
|
8032
|
+
hsv: a.hsv || mr
|
|
8024
8033
|
};
|
|
8025
8034
|
return this.setIncludeUniformValues(h, e), e && e.ssr && e.ssr.renderUniforms && Zt(h, e.ssr.renderUniforms),
|
|
8026
8035
|
h;
|
|
8027
8036
|
}
|
|
8028
8037
|
delete() {
|
|
8029
|
-
super.delete(), this.
|
|
8030
|
-
this.
|
|
8031
|
-
this.
|
|
8032
|
-
this.
|
|
8038
|
+
super.delete(), this.Ts && (this.Ts.destroy(), delete this.Ts), this.Is && this.Is.destroy(),
|
|
8039
|
+
this.Cs && this.Cs.destroy(), this.shader && this.shader.dispose(), this._s && this._s.dispose(),
|
|
8040
|
+
this.Ms && (this.Ms.geometry.dispose(), this.Ms.material && this.Ms.material.dispose(),
|
|
8041
|
+
this.Ms.dispose(), delete this.Ms), this.disposeIBLTextures();
|
|
8033
8042
|
}
|
|
8034
8043
|
createGround() {
|
|
8035
8044
|
const t = new n.Plane;
|
|
8036
8045
|
t.data.aTexCoord = new Uint8Array([ 0, 1, 1, 1, 0, 0, 1, 0 ]), t.generateBuffers(this.renderer.regl),
|
|
8037
|
-
this.
|
|
8046
|
+
this.Ms = new n.Mesh(t, null, {
|
|
8038
8047
|
castShadow: !1
|
|
8039
|
-
}), this.
|
|
8048
|
+
}), this.Ss = new n.Scene([ this.Ms ]);
|
|
8040
8049
|
}
|
|
8041
8050
|
transformWater() {
|
|
8042
|
-
const t = this.getMap(), e = s.getGroundTransform(this.
|
|
8043
|
-
this.
|
|
8044
|
-
const n = t._get2DExtentAtRes(t.getGLRes()), i = n.getWidth(), r = n.getHeight(), o = t.cameraLookAt, a = o[0] - i, l = o[1] + r, h = this.
|
|
8045
|
-
this.
|
|
8046
|
-
this.
|
|
8051
|
+
const t = this.getMap(), e = s.getGroundTransform(this.Ms.localTransform, t);
|
|
8052
|
+
this.Ms.setLocalTransform(e);
|
|
8053
|
+
const n = t._get2DExtentAtRes(t.getGLRes()), i = n.getWidth(), r = n.getHeight(), o = t.cameraLookAt, a = o[0] - i, l = o[1] + r, h = this.ks, c = a / h[0], f = l / h[1], u = c % 1, d = f % 1, p = .3737 * c % 1, y = .3737 * f % 1, m = n.getWidth() / h[0] * 2, g = n.getHeight() / h[1] * 2;
|
|
8054
|
+
this.Ms.setUniform("uvOffset", [ u, d ]), this.Ms.setUniform("noiseUvOffset", [ p, y ]),
|
|
8055
|
+
this.Ms.setUniform("uvScale", [ m, -g ]);
|
|
8047
8056
|
}
|
|
8048
8057
|
}
|
|
8049
8058
|
|
|
@@ -8139,7 +8148,7 @@ const Or = Jt("heatmap", class extends He {
|
|
|
8139
8148
|
o;
|
|
8140
8149
|
}
|
|
8141
8150
|
callRenderer(t, e) {
|
|
8142
|
-
this.
|
|
8151
|
+
this.Es.render(this.scene, t, this.getRenderFBO(e));
|
|
8143
8152
|
}
|
|
8144
8153
|
getUniformValues(t) {
|
|
8145
8154
|
const {projViewMatrix: e} = t;
|
|
@@ -8153,7 +8162,7 @@ const Or = Jt("heatmap", class extends He {
|
|
|
8153
8162
|
return this.scene.getMeshes();
|
|
8154
8163
|
}
|
|
8155
8164
|
delete() {
|
|
8156
|
-
super.delete(...arguments), this.
|
|
8165
|
+
super.delete(...arguments), this.Es.dispose(), delete this.Es;
|
|
8157
8166
|
}
|
|
8158
8167
|
init() {
|
|
8159
8168
|
const t = this.regl;
|
|
@@ -8172,7 +8181,7 @@ const Or = Jt("heatmap", class extends He {
|
|
|
8172
8181
|
zpass: "replace"
|
|
8173
8182
|
}
|
|
8174
8183
|
}, r = this.getPolygonOffset(), s = this.getSymbols()[0];
|
|
8175
|
-
this.
|
|
8184
|
+
this.Es = new f(this.regl, this.sceneConfig, this.layer, s.heatmapColor, i, r);
|
|
8176
8185
|
}
|
|
8177
8186
|
});
|
|
8178
8187
|
|
|
@@ -8182,7 +8191,7 @@ const Cr = Jt("water", gr);
|
|
|
8182
8191
|
|
|
8183
8192
|
Cr.registerAt(ct), At.registerPainter("lit", nr), At.registerPainter("icon", hi),
|
|
8184
8193
|
At.registerPainter("fill", Ne), At.registerPainter("line", Ve), At.registerPainter("line-gradient", je),
|
|
8185
|
-
At.registerPainter("water", gr), ct.VERSION = "0.63.
|
|
8194
|
+
At.registerPainter("water", gr), ct.VERSION = "0.63.8", At.VERSION = "0.63.8";
|
|
8186
8195
|
|
|
8187
8196
|
if (e.mat4.create(), e.transcoders) {
|
|
8188
8197
|
const n = t.Map.VERSION;
|
|
@@ -8194,6 +8203,6 @@ if (e.mat4.create(), e.transcoders) {
|
|
|
8194
8203
|
}));
|
|
8195
8204
|
} else t.registerWorkerAdapter("@maptalks/vt", H);
|
|
8196
8205
|
|
|
8197
|
-
export { Ne as FillPainter, xr as FillPlugin, kr as GLTFPhongPlugin, Ir as GLTFStandardPlugin, vt as GeoJSONVectorTileLayer, Or as HeatmapPlugin, hi as IconPainter, wr as IconPlugin, Ar as LineGradientPlugin, Ve as LinePainter, br as LinePlugin, Ut as LineStringLayer, Tr as LitPlugin,
|
|
8206
|
+
export { Ne as FillPainter, xr as FillPlugin, kr as GLTFPhongPlugin, Ir as GLTFStandardPlugin, vt as GeoJSONVectorTileLayer, Or as HeatmapPlugin, hi as IconPainter, wr as IconPlugin, Ar as LineGradientPlugin, Ve as LinePainter, br as LinePlugin, Ut as LineStringLayer, Tr as LitPlugin, mt as MapboxVectorTileLayer, Bi as NativeLinePainter, Sr as NativeLinePlugin, Gi as NativePointPainter, Ki as PhongPainter, Mr as PhongPlugin, jt as PointLayer, Gt as PolygonLayer, Li as TextPainter, _r as TextPlugin, At as Vector3DLayer, ct as VectorTileLayer, nt as VectorTileLayerRenderer, Cr as WaterPlugin, Qi as WireframePainter, Pr as WireframePlugin };
|
|
8198
8207
|
|
|
8199
|
-
"undefined" != typeof console && console.log("@maptalks/vt v0.63.
|
|
8208
|
+
"undefined" != typeof console && console.log("@maptalks/vt v0.63.8");
|