@maptalks/vt 0.92.1 → 0.92.2
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.es.js +223 -218
- package/dist/maptalks.vt.js +223 -218
- package/package.json +3 -3
package/dist/maptalks.vt.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/vt v0.92.
|
|
2
|
+
* @maptalks/vt v0.92.2
|
|
3
3
|
* LICENSE : undefined
|
|
4
4
|
* (c) 2016-2024 maptalks.org
|
|
5
5
|
*/
|
|
@@ -3244,7 +3244,8 @@ class Le extends t.renderer.CanvasRenderer {
|
|
|
3244
3244
|
});
|
|
3245
3245
|
}
|
|
3246
3246
|
cn() {
|
|
3247
|
-
if (this.ln && (this.On(this.ln[0], this.Xe), this.On(this.ln[1], this.Ye)
|
|
3247
|
+
if (this.ln && (this.On(this.ln[0], this.Xe), this.On(this.ln[1], this.Ye), this.ln[0] && this.Ze.prepareCollideIndex(this.ln[0].geometry),
|
|
3248
|
+
this.ln[1] && this.Ze.prepareCollideIndex(this.ln[1].geometry)), this.hn) for (let t = 0; t < this.hn.length; t++) this.On(this.hn[t], this.$e);
|
|
3248
3249
|
if (this.meshes) for (let t = 0; t < this.meshes.length; t++) this.On(this.meshes[t], this.Ge);
|
|
3249
3250
|
}
|
|
3250
3251
|
On(t, e) {
|
|
@@ -6521,6 +6522,10 @@ class nr extends Bi {
|
|
|
6521
6522
|
paint(t) {
|
|
6522
6523
|
this.isShadowIncludeChanged(t) && (this.shader.dispose(), this.br(t)), super.paint(t);
|
|
6523
6524
|
}
|
|
6525
|
+
isEnableStencil(t) {
|
|
6526
|
+
const e = this.layer.getRenderer();
|
|
6527
|
+
return !(!!(t && t.isRenderingTerrain && this.isTerrainSkin()) || !e.isEnableTileStencil || !e.isEnableTileStencil()) && "VectorTileLayer" === this.layer.getJSONType();
|
|
6528
|
+
}
|
|
6524
6529
|
init(t) {
|
|
6525
6530
|
const e = this.regl, i = this.canvas, s = {
|
|
6526
6531
|
x: (t, e) => e.viewport ? e.viewport.x : 0,
|
|
@@ -6529,18 +6534,18 @@ class nr extends Bi {
|
|
|
6529
6534
|
height: (t, e) => e.viewport ? e.viewport.height : i ? i.height : 1
|
|
6530
6535
|
};
|
|
6531
6536
|
this.renderer = new n.Renderer(e);
|
|
6532
|
-
const o =
|
|
6537
|
+
const o = this.layer.getRenderer(), a = {
|
|
6533
6538
|
viewport: s,
|
|
6534
6539
|
stencil: {
|
|
6535
|
-
enable: () =>
|
|
6540
|
+
enable: () => this.isEnableStencil(t),
|
|
6536
6541
|
func: {
|
|
6537
|
-
cmp: () =>
|
|
6538
|
-
ref: (t, e) =>
|
|
6542
|
+
cmp: () => o.isEnableTileStencil && o.isEnableTileStencil() ? "=" : "<=",
|
|
6543
|
+
ref: (t, e) => o.isEnableTileStencil && o.isEnableTileStencil() ? e.stencilRef : e.level
|
|
6539
6544
|
},
|
|
6540
6545
|
op: {
|
|
6541
6546
|
fail: "keep",
|
|
6542
6547
|
zfail: "keep",
|
|
6543
|
-
zpass: () =>
|
|
6548
|
+
zpass: () => o.isEnableTileStencil && o.isEnableTileStencil() ? "zero" : "replace"
|
|
6544
6549
|
}
|
|
6545
6550
|
},
|
|
6546
6551
|
depth: {
|
|
@@ -6565,7 +6570,7 @@ class nr extends Bi {
|
|
|
6565
6570
|
offset: this.getPolygonOffset()
|
|
6566
6571
|
}
|
|
6567
6572
|
};
|
|
6568
|
-
if (this.br(t,
|
|
6573
|
+
if (this.br(t, a), this.pickingFBO) {
|
|
6569
6574
|
const t = [];
|
|
6570
6575
|
this.picking = [ new n.FBORayPicking(this.renderer, {
|
|
6571
6576
|
vert: Gi,
|
|
@@ -6576,7 +6581,7 @@ class nr extends Bi {
|
|
|
6576
6581
|
return r.multiply(t, n.projViewMatrix, n.modelMatrix), t;
|
|
6577
6582
|
}
|
|
6578
6583
|
} ],
|
|
6579
|
-
extraCommandProps:
|
|
6584
|
+
extraCommandProps: a
|
|
6580
6585
|
}, this.pickingFBO, this.getMap()) ];
|
|
6581
6586
|
}
|
|
6582
6587
|
}
|
|
@@ -8418,7 +8423,7 @@ class Cs extends br {
|
|
|
8418
8423
|
}
|
|
8419
8424
|
}
|
|
8420
8425
|
}
|
|
8421
|
-
|
|
8426
|
+
prepareCollideIndex(t) {
|
|
8422
8427
|
const {collideIds: e, elements: n, aCount: i} = t.properties;
|
|
8423
8428
|
if (!e) return;
|
|
8424
8429
|
const r = e, s = {};
|
|
@@ -8484,10 +8489,10 @@ class Cs extends br {
|
|
|
8484
8489
|
t.positionMatrix = this.getAltitudeOffsetMatrix(), delete t.geometry.properties.iconAtlas;
|
|
8485
8490
|
}), f.push(...t));
|
|
8486
8491
|
}
|
|
8487
|
-
return "line" === a.properties.markerPlacement && this.
|
|
8488
|
-
this.
|
|
8492
|
+
return "line" === a.properties.markerPlacement && this.Ns(a, r), "line" === a.properties.markerPlacement && f.forEach(t => t.properties.isLinePlacement = !0),
|
|
8493
|
+
this.prepareCollideIndex(a), f;
|
|
8489
8494
|
}
|
|
8490
|
-
|
|
8495
|
+
Ns(t, e) {
|
|
8491
8496
|
const {collideIds: n} = t.properties, i = new Uint16Array(n.length);
|
|
8492
8497
|
if (this.Rs(t)) {
|
|
8493
8498
|
let r = 0;
|
|
@@ -8546,31 +8551,31 @@ class Cs extends br {
|
|
|
8546
8551
|
if (!this.isEnableCollision()) return;
|
|
8547
8552
|
super.updateCollision(t);
|
|
8548
8553
|
const e = this.scene.getMeshes();
|
|
8549
|
-
e && e.length ? (this.
|
|
8554
|
+
e && e.length ? (this.Hs(t.timestamp), this.Es = [], this.zr()) : this.zr();
|
|
8550
8555
|
}
|
|
8551
8556
|
callCurrentTileShader(t, e) {
|
|
8552
8557
|
this.shader.filter = e.sceneFilter ? [ this.Os, e.sceneFilter ] : this.Os, this.callRenderer(this.shader, t, e),
|
|
8553
|
-
this.
|
|
8558
|
+
this.zs.filter = e.sceneFilter ? [ this.Fs, e.sceneFilter ] : this.Fs, this.callRenderer(this.zs, t, e);
|
|
8554
8559
|
}
|
|
8555
8560
|
callBackgroundTileShader(t, e) {
|
|
8556
8561
|
this.shader.filter = e.sceneFilter ? [ this.Is, e.sceneFilter ] : this.Is, this.callRenderer(this.shader, t, e),
|
|
8557
|
-
this.
|
|
8562
|
+
this.zs.filter = e.sceneFilter ? [ this.Cs, e.sceneFilter ] : this.Cs, this.callRenderer(this.zs, t, e);
|
|
8558
8563
|
}
|
|
8559
8564
|
isMeshIterable(t) {
|
|
8560
8565
|
return t && t.geometry && !t.geometry.properties.isEmpty && t.material && !t.material.get("isHalo") && this.isMeshVisible(t) && !(this.shouldIgnoreBackground() && !this.layer.getRenderer().isForeground(t));
|
|
8561
8566
|
}
|
|
8562
|
-
|
|
8567
|
+
Hs() {
|
|
8563
8568
|
if (!this.isEnableCollision()) return;
|
|
8564
8569
|
let t = this.Es;
|
|
8565
|
-
t && t.length && this.
|
|
8570
|
+
t && t.length && this.Vs(t);
|
|
8566
8571
|
}
|
|
8567
|
-
|
|
8572
|
+
Us(t, e, n, i) {
|
|
8568
8573
|
return this.updateBoxCollisionFading(!0, t, e, n, i);
|
|
8569
8574
|
}
|
|
8570
8575
|
isEnableUniquePlacement() {
|
|
8571
8576
|
return this.isEnableCollision() && !0 === this.sceneConfig.uniquePlacement;
|
|
8572
8577
|
}
|
|
8573
|
-
|
|
8578
|
+
Vs(t) {
|
|
8574
8579
|
const e = this.layer.getRenderer();
|
|
8575
8580
|
t = t.sort(Es);
|
|
8576
8581
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -8585,12 +8590,12 @@ class Cs extends br {
|
|
|
8585
8590
|
const s = e.isForeground(i.meshes[0]);
|
|
8586
8591
|
if (this.shouldIgnoreBackground() && !s) continue;
|
|
8587
8592
|
const o = i.properties.meshKey;
|
|
8588
|
-
this.startMeshCollision(i), this.
|
|
8593
|
+
this.startMeshCollision(i), this.js(i), this.forEachBox(i, this.Us), this.Bs(i),
|
|
8589
8594
|
this.endMeshCollision(o);
|
|
8590
|
-
for (let t = 0; t < i.meshes.length; t++) this.
|
|
8595
|
+
for (let t = 0; t < i.meshes.length; t++) this.Gs(i.meshes[t]);
|
|
8591
8596
|
}
|
|
8592
8597
|
}
|
|
8593
|
-
|
|
8598
|
+
Gs(t) {
|
|
8594
8599
|
const e = t && t.geometry && t.geometry.properties.aOpacity;
|
|
8595
8600
|
e && e.dirty && (t.geometry.updateData("aOpacity", e), e.dirty = !1);
|
|
8596
8601
|
}
|
|
@@ -8600,9 +8605,9 @@ class Cs extends br {
|
|
|
8600
8605
|
const i = {
|
|
8601
8606
|
boxIndex: 0
|
|
8602
8607
|
}, r = n.length;
|
|
8603
|
-
for (let s = 0; s < r; s++) this.
|
|
8608
|
+
for (let s = 0; s < r; s++) this.Ws(t, n[s], e, i);
|
|
8604
8609
|
}
|
|
8605
|
-
|
|
8610
|
+
Ws(t, e, n, i) {
|
|
8606
8611
|
const s = this.getMap(), {collideBoxIndex: o} = t.meshes[0].geometry.properties;
|
|
8607
8612
|
if (!(o && o[e])) return !1;
|
|
8608
8613
|
const a = r.multiply(Ts, s.projViewMatrix, t.meshes[0].localTransform);
|
|
@@ -8631,16 +8636,16 @@ class Cs extends br {
|
|
|
8631
8636
|
l[f].allElements = r, f++;
|
|
8632
8637
|
}
|
|
8633
8638
|
if (!h) return !1;
|
|
8634
|
-
return n.call(this, t, l, a, i.boxIndex++) && this.
|
|
8639
|
+
return n.call(this, t, l, a, i.boxIndex++) && this.Xs(t, e), !0;
|
|
8635
8640
|
}
|
|
8636
|
-
|
|
8641
|
+
js(t) {
|
|
8637
8642
|
const e = t.meshes;
|
|
8638
8643
|
for (let t = 0; t < e.length; t++) {
|
|
8639
8644
|
const n = e[t], i = n && n.geometry;
|
|
8640
8645
|
i && (i.properties.visElemts.count = 0);
|
|
8641
8646
|
}
|
|
8642
8647
|
}
|
|
8643
|
-
|
|
8648
|
+
Xs(t, e) {
|
|
8644
8649
|
const n = t.meshes;
|
|
8645
8650
|
for (let t = 0; t < n.length; t++) {
|
|
8646
8651
|
const i = n[t];
|
|
@@ -8655,7 +8660,7 @@ class Cs extends br {
|
|
|
8655
8660
|
a.count = c;
|
|
8656
8661
|
}
|
|
8657
8662
|
}
|
|
8658
|
-
|
|
8663
|
+
Bs(t) {
|
|
8659
8664
|
const e = t.meshes;
|
|
8660
8665
|
for (let t = 0; t < e.length; t++) {
|
|
8661
8666
|
const n = e[t], i = n && n.geometry;
|
|
@@ -8738,7 +8743,7 @@ class Cs extends br {
|
|
|
8738
8743
|
extraCommandProps: i
|
|
8739
8744
|
}), this.shader.version = 300;
|
|
8740
8745
|
const {uniforms: s, extraCommandProps: o} = is.call(this, e, this.sceneConfig), a = this.Ds || {};
|
|
8741
|
-
if (this.
|
|
8746
|
+
if (this.zs = new n.MeshShader({
|
|
8742
8747
|
vert: ds,
|
|
8743
8748
|
frag: ps,
|
|
8744
8749
|
uniforms: s,
|
|
@@ -8878,8 +8883,8 @@ class vo extends br {
|
|
|
8878
8883
|
}
|
|
8879
8884
|
constructor(t, e, n, i, r, s) {
|
|
8880
8885
|
super(t, e, n, i, r, s), this.propAllowOverlap = "textAllowOverlap", this.propIgnorePlacement = "textIgnorePlacement",
|
|
8881
|
-
this.colorCache = {}, this
|
|
8882
|
-
this.
|
|
8886
|
+
this.colorCache = {}, this.Ys = js.bind(this), this.$s = Bs.bind(this), this.qs = Gs.bind(this),
|
|
8887
|
+
this.Js = Ws.bind(this), this.isLabelCollides = hs.bind(this), this.Ks();
|
|
8883
8888
|
}
|
|
8884
8889
|
prepareRender(...t) {
|
|
8885
8890
|
super.prepareRender(...t);
|
|
@@ -8891,34 +8896,34 @@ class vo extends br {
|
|
|
8891
8896
|
}
|
|
8892
8897
|
}
|
|
8893
8898
|
updateSymbol(...t) {
|
|
8894
|
-
this.
|
|
8899
|
+
this.Zs = void 0, this.Qs = void 0;
|
|
8895
8900
|
const e = super.updateSymbol(...t);
|
|
8896
|
-
return this.
|
|
8901
|
+
return this.Ks(), e;
|
|
8897
8902
|
}
|
|
8898
8903
|
isTerrainVector() {
|
|
8899
8904
|
if (!super.isTerrainSkin()) return !1;
|
|
8900
|
-
if (void 0 !== this.
|
|
8905
|
+
if (void 0 !== this.Zs) return this.Zs;
|
|
8901
8906
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
8902
|
-
if ("map" !== this.symbolDef[t].textPitchAlignment) return this.
|
|
8907
|
+
if ("map" !== this.symbolDef[t].textPitchAlignment) return this.Zs = !0, !0;
|
|
8903
8908
|
}
|
|
8904
|
-
return this.
|
|
8909
|
+
return this.Zs = !1, !1;
|
|
8905
8910
|
}
|
|
8906
8911
|
isTerrainSkin() {
|
|
8907
8912
|
if (!super.isTerrainSkin()) return !1;
|
|
8908
|
-
if (void 0 !== this.
|
|
8913
|
+
if (void 0 !== this.Qs) return this.Qs;
|
|
8909
8914
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
8910
8915
|
const e = this.symbolDef[t].textPitchAlignment;
|
|
8911
|
-
if ("map" === e || p(e) || b.isExpression(e)) return this.
|
|
8916
|
+
if ("map" === e || p(e) || b.isExpression(e)) return this.Qs = !0, !0;
|
|
8912
8917
|
}
|
|
8913
|
-
return this.
|
|
8918
|
+
return this.Qs = !1, !1;
|
|
8914
8919
|
}
|
|
8915
|
-
|
|
8916
|
-
this.
|
|
8920
|
+
Ks() {
|
|
8921
|
+
this.to = [];
|
|
8917
8922
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
8918
8923
|
const e = this.symbolDef[t];
|
|
8919
8924
|
if (b.isExpression(e.textName)) {
|
|
8920
8925
|
const n = b.createExpression(e.textName, "string");
|
|
8921
|
-
this.
|
|
8926
|
+
this.to[t] = (t, e) => {
|
|
8922
8927
|
let i;
|
|
8923
8928
|
uo.zoom = t, co.properties = e;
|
|
8924
8929
|
try {
|
|
@@ -8928,7 +8933,7 @@ class vo extends br {
|
|
|
8928
8933
|
}
|
|
8929
8934
|
return i;
|
|
8930
8935
|
};
|
|
8931
|
-
} else p(e.textName) && (this.
|
|
8936
|
+
} else p(e.textName) && (this.to[t] = g(e.textName));
|
|
8932
8937
|
}
|
|
8933
8938
|
}
|
|
8934
8939
|
shouldDeleteMeshOnUpdateSymbol(t) {
|
|
@@ -8957,7 +8962,7 @@ class vo extends br {
|
|
|
8957
8962
|
s.properties.symbolIndex = o;
|
|
8958
8963
|
const a = this.getSymbol(o), l = this.getSymbolDef(o), h = this.getFnTypeConfig(o), u = ts.call(this, this.regl, s, e, l, a, h, this.layer.options.collision, !i, r);
|
|
8959
8964
|
if (u.length) {
|
|
8960
|
-
"line" === s.properties.textPlacement ? this.
|
|
8965
|
+
"line" === s.properties.textPlacement ? this.eo = !0 : this.no = !0;
|
|
8961
8966
|
}
|
|
8962
8967
|
return u.forEach(t => {
|
|
8963
8968
|
t.positionMatrix = this.getAltitudeOffsetMatrix(), t.properties.tileVectorTransform = n;
|
|
@@ -8966,21 +8971,21 @@ class vo extends br {
|
|
|
8966
8971
|
updateCollision(t) {
|
|
8967
8972
|
super.updateCollision(t);
|
|
8968
8973
|
const e = this.scene.getMeshes();
|
|
8969
|
-
e && e.length ? (this.
|
|
8974
|
+
e && e.length ? (this.io = {}, this.ro(t.timestamp), this.zr()) : this.zr();
|
|
8970
8975
|
}
|
|
8971
8976
|
callCurrentTileShader(t, e) {
|
|
8972
|
-
this.shader.filter = e.sceneFilter ? [ this
|
|
8973
|
-
this.
|
|
8977
|
+
this.shader.filter = e.sceneFilter ? [ this.Ys, e.sceneFilter ] : this.Ys, this.callRenderer(this.shader, t, e),
|
|
8978
|
+
this.so.filter = e.sceneFilter ? [ this.qs, e.sceneFilter ] : this.qs, this.callRenderer(this.so, t, e);
|
|
8974
8979
|
}
|
|
8975
8980
|
callBackgroundTileShader(t, e) {
|
|
8976
|
-
this.shader.filter = e.sceneFilter ? [ this
|
|
8977
|
-
this.
|
|
8981
|
+
this.shader.filter = e.sceneFilter ? [ this.$s, e.sceneFilter ] : this.$s, this.callRenderer(this.shader, t, e),
|
|
8982
|
+
this.so.filter = e.sceneFilter ? [ this.Js, e.sceneFilter ] : this.Js, this.callRenderer(this.so, t, e);
|
|
8978
8983
|
}
|
|
8979
8984
|
callRenderer(t, e, n) {
|
|
8980
8985
|
n && n.isRenderingTerrain && p(this.symbolDef.textPitchAlignment) && (n.isRenderingTerrainSkin ? e.textPitchFilter = 1 : e.textPitchFilter = 2),
|
|
8981
8986
|
super.callRenderer(t, e, n);
|
|
8982
8987
|
}
|
|
8983
|
-
|
|
8988
|
+
ro() {
|
|
8984
8989
|
let t = this.scene.getMeshes();
|
|
8985
8990
|
if (!t || !t.length) return;
|
|
8986
8991
|
const e = -this.getMap().getBearing() * Math.PI / 180, n = u.fromRotation(qs, e), i = (t, e, n, i) => {
|
|
@@ -9005,7 +9010,7 @@ class vo extends br {
|
|
|
9005
9010
|
const h = o.properties.meshKey;
|
|
9006
9011
|
if ("line" === a.properties.textPlacement) {
|
|
9007
9012
|
if (!a.properties.line) continue;
|
|
9008
|
-
r && this.startMeshCollision(o), this.
|
|
9013
|
+
r && this.startMeshCollision(o), this.oo(o, n);
|
|
9009
9014
|
const {aOffset: t, aOpacity: e} = a.properties;
|
|
9010
9015
|
t.dirty && (a.updateData("aOffset", t), t.dirty = !1), e && e.dirty && (a.updateData("aOpacity", e),
|
|
9011
9016
|
e.dirty = !1), r && this.endMeshCollision(h);
|
|
@@ -9030,7 +9035,7 @@ class vo extends br {
|
|
|
9030
9035
|
getUniqueEntryKey(t, e) {
|
|
9031
9036
|
return us(t, e);
|
|
9032
9037
|
}
|
|
9033
|
-
|
|
9038
|
+
oo(t, e) {
|
|
9034
9039
|
const n = this.getMap(), i = t.geometry, s = i.properties;
|
|
9035
9040
|
let o = s.line;
|
|
9036
9041
|
if (!o) return;
|
|
@@ -9038,8 +9043,8 @@ class vo extends br {
|
|
|
9038
9043
|
if (!c) {
|
|
9039
9044
|
const e = r.multiply(Ys, n.projViewMatrix, t.localTransform), i = o.id + "-" + e.join();
|
|
9040
9045
|
let a;
|
|
9041
|
-
this.
|
|
9042
|
-
o = this.
|
|
9046
|
+
this.io[i] ? o = this.io[i] : (a = s.projectedLine = s.projectedLine || new Array(o.length),
|
|
9047
|
+
o = this.ao(a, o, e, n.width, n.height), this.io[i] = a);
|
|
9043
9048
|
}
|
|
9044
9049
|
const d = this.isEnableCollision(), p = i.properties.visElemts = i.properties.visElemts || new f.constructor(f.length), m = i.properties.visCache = i.properties.visCache || [];
|
|
9045
9050
|
d && (p.count = 0);
|
|
@@ -9047,7 +9052,7 @@ class vo extends br {
|
|
|
9047
9052
|
this.forEachBox(t, (t, n, i, r) => {
|
|
9048
9053
|
const {start: s, end: a} = n[0];
|
|
9049
9054
|
let l = m[r];
|
|
9050
|
-
if ((void 0 === l || y) && (l = this.
|
|
9055
|
+
if ((void 0 === l || y) && (l = this.lo(t, f, s, a, o, i, c ? e : null, r)), m[r] = l,
|
|
9051
9056
|
d && (l = this.updateBoxCollisionFading(l, t, n, i, r), l)) {
|
|
9052
9057
|
let t = p.count;
|
|
9053
9058
|
for (let e = s; e < a; e++) p[t++] = f[e];
|
|
@@ -9057,7 +9062,7 @@ class vo extends br {
|
|
|
9057
9062
|
const g = t.geometry.properties.aAltitude;
|
|
9058
9063
|
g && g.dirty && (i.updateData("aAltitude", g), g.dirty = !1), !d || p.count === f.length && i.count === p.count || i.setElements(p, p.count);
|
|
9059
9064
|
}
|
|
9060
|
-
|
|
9065
|
+
ao(t, e, n, i, r) {
|
|
9061
9066
|
return function(t, e, n, i, r) {
|
|
9062
9067
|
for (let s = 0; s < e.length; s += 3) a.set(xi, e[s], e[s + 1], e[s + 2], 1), bi(xi, xi, n, i, r),
|
|
9063
9068
|
t[s] = xi[0], t[s + 1] = xi[1], t[s + 2] = e[s + 2];
|
|
@@ -9073,7 +9078,7 @@ class vo extends br {
|
|
|
9073
9078
|
for (let n = 0; n <= l.length; n += 6) if (d = l[n], h[d] !== m || n === l.length) {
|
|
9074
9079
|
const r = a[m] && a[m].feature;
|
|
9075
9080
|
if (u && this.isMeshUniquePlaced(t) && r && !r.label) {
|
|
9076
|
-
const e = r.properties || {}, {symbolIndex: n} = t.properties, i = n && this.
|
|
9081
|
+
const e = r.properties || {}, {symbolIndex: n} = t.properties, i = n && this.to[n.index] ? this.to[n.index](t.properties.z, e) : this.getSymbol(t.properties.symbolIndex).textName, s = R.resolveText(i, e);
|
|
9077
9082
|
r.label = s;
|
|
9078
9083
|
}
|
|
9079
9084
|
const s = n, y = o[l[p]];
|
|
@@ -9082,7 +9087,7 @@ class vo extends br {
|
|
|
9082
9087
|
m = h[d], p = n;
|
|
9083
9088
|
}
|
|
9084
9089
|
}
|
|
9085
|
-
|
|
9090
|
+
lo(t, e, n, s, o, l, u) {
|
|
9086
9091
|
const f = this.layer.getRenderer(), d = t.material.uniforms, p = 1 === d.pitchWithMap, m = !p && f.getTerrainHelper && f.getTerrainHelper(), y = this.isEnableCollision(), g = this.getMap(), v = t.geometry, x = v.desc.positionSize, {aShape: b, aOffset: w, aAnchor: _, aAltitude: S, aPitchRotation: M} = v.properties;
|
|
9087
9092
|
let {aProjectedAnchor: P} = v.properties;
|
|
9088
9093
|
P || (P = v.properties.aProjectedAnchor = new Array(_.length / x * 3));
|
|
@@ -9103,7 +9108,7 @@ class vo extends br {
|
|
|
9103
9108
|
k && (F = C), P[3 * O] = D[0], P[3 * O + 1] = D[1], P[3 * O + 2] = D[2];
|
|
9104
9109
|
const L = k ? 1 : v.properties.tileExtent / this.layer.getTileSize().width;
|
|
9105
9110
|
let N = !0;
|
|
9106
|
-
const H = e[n], z = e[s - 1], V = T ? T[H] : t.properties.textSize, U = this.
|
|
9111
|
+
const H = e[n], z = e[s - 1], V = T ? T[H] : t.properties.textSize, U = this.ho(t, V, o, H, z, F, Js, L, u);
|
|
9107
9112
|
if (null === U) return xo(w, e, n, s), !1;
|
|
9108
9113
|
const j = z - H <= 3, B = Math.floor(U / 2), G = U % 2;
|
|
9109
9114
|
for (let a = n; a < s; a += 6) {
|
|
@@ -9138,7 +9143,7 @@ class vo extends br {
|
|
|
9138
9143
|
}
|
|
9139
9144
|
return N;
|
|
9140
9145
|
}
|
|
9141
|
-
|
|
9146
|
+
ho(t, e, n, i, r, s, o, a, l) {
|
|
9142
9147
|
const h = r - i <= 3, u = this.getMap();
|
|
9143
9148
|
return h ? 0 : Vs.call(this, lo, ho, t, e, n, i, r, s, o, a, u.width / u.height, l);
|
|
9144
9149
|
}
|
|
@@ -9151,7 +9156,7 @@ class vo extends br {
|
|
|
9151
9156
|
}) : t.material && delete t.material.uniforms.texture), super.deleteMesh(t, e));
|
|
9152
9157
|
}
|
|
9153
9158
|
delete() {
|
|
9154
|
-
super.delete(), this.
|
|
9159
|
+
super.delete(), this.so.dispose(), delete this.io, this.uo && this.uo.dispose();
|
|
9155
9160
|
}
|
|
9156
9161
|
needClearStencil() {
|
|
9157
9162
|
return !0;
|
|
@@ -9173,7 +9178,7 @@ class vo extends br {
|
|
|
9173
9178
|
});
|
|
9174
9179
|
let o = i;
|
|
9175
9180
|
if (this.layer.getRenderer().isEnableWorkAround("win-intel-gpu-crash") && (o = Tt({}, i),
|
|
9176
|
-
o.stencil = Tt({}, i.stencil), o.stencil.enable = !0), this.
|
|
9181
|
+
o.stencil = Tt({}, i.stencil), o.stencil.enable = !0), this.so = new n.MeshShader({
|
|
9177
9182
|
vert: Us,
|
|
9178
9183
|
frag: ps,
|
|
9179
9184
|
uniforms: e,
|
|
@@ -9540,7 +9545,7 @@ class No extends Vi {
|
|
|
9540
9545
|
Object.defineProperty(u.uniforms, "uvOrigin", {
|
|
9541
9546
|
enumerable: !0,
|
|
9542
9547
|
get: () => {
|
|
9543
|
-
const t = this.
|
|
9548
|
+
const t = this.co(_, a, s, g, A, l);
|
|
9544
9549
|
return h.set(w, t[0] - t[0] % 1, t[1] - t[1] % 1);
|
|
9545
9550
|
}
|
|
9546
9551
|
});
|
|
@@ -9548,7 +9553,7 @@ class No extends Vi {
|
|
|
9548
9553
|
Object.defineProperty(u.uniforms, "uvOffset", {
|
|
9549
9554
|
enumerable: !0,
|
|
9550
9555
|
get: () => {
|
|
9551
|
-
const t = this.
|
|
9556
|
+
const t = this.co(_, a, s, g, A, l);
|
|
9552
9557
|
return h.set(w, t[0] % 1, t[1] % 1);
|
|
9553
9558
|
}
|
|
9554
9559
|
}), Object.defineProperty(u.uniforms, "hasAlpha", {
|
|
@@ -9564,7 +9569,7 @@ class No extends Vi {
|
|
|
9564
9569
|
get: () => x.isForeground(u) ? 0 : S - u.properties.tile.z
|
|
9565
9570
|
}), u.properties.symbolIndex = a, u;
|
|
9566
9571
|
}
|
|
9567
|
-
|
|
9572
|
+
co(t, e, n, i, r, s) {
|
|
9568
9573
|
if (1 === this.dataConfig.topUVMode) return To;
|
|
9569
9574
|
const o = this.getMap(), a = this.getSymbol(e).material;
|
|
9570
9575
|
let l = n;
|
|
@@ -9605,10 +9610,10 @@ class No extends Vi {
|
|
|
9605
9610
|
return s[0] = r * t[0], s[1] = r * t[0], i || (s[0] %= 1, s[1] %= 1), s;
|
|
9606
9611
|
}
|
|
9607
9612
|
needPolygonOffset() {
|
|
9608
|
-
return this.
|
|
9613
|
+
return this.fo;
|
|
9609
9614
|
}
|
|
9610
9615
|
startFrame(...t) {
|
|
9611
|
-
return delete this.
|
|
9616
|
+
return delete this.fo, super.startFrame(...t);
|
|
9612
9617
|
}
|
|
9613
9618
|
addMesh(t, e) {
|
|
9614
9619
|
t.forEach(t => {
|
|
@@ -9621,7 +9626,7 @@ class No extends Vi {
|
|
|
9621
9626
|
0 === e && (e = .01), ko[2] = e, r.fromScaling(n, ko), r.multiply(n, t.properties.tileTransform, n),
|
|
9622
9627
|
t.setLocalTransform(n);
|
|
9623
9628
|
} else t.setLocalTransform(t.properties.tileTransform);
|
|
9624
|
-
t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.
|
|
9629
|
+
t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.fo = !0),
|
|
9625
9630
|
this.getSymbol(t.properties.symbolIndex).ssr ? t.ssr = 1 : t.ssr = 0;
|
|
9626
9631
|
}
|
|
9627
9632
|
deleteMaterial() {
|
|
@@ -9724,10 +9729,10 @@ class Vo extends No {
|
|
|
9724
9729
|
return this.shader;
|
|
9725
9730
|
}
|
|
9726
9731
|
delete(t) {
|
|
9727
|
-
this.getMap().off("updatelights", this.
|
|
9732
|
+
this.getMap().off("updatelights", this.do, this), super.delete(t), this.material.dispose();
|
|
9728
9733
|
}
|
|
9729
9734
|
init() {
|
|
9730
|
-
this.getMap().on("updatelights", this.
|
|
9735
|
+
this.getMap().on("updatelights", this.do, this);
|
|
9731
9736
|
const t = this.regl;
|
|
9732
9737
|
this.renderer = new n.Renderer(t);
|
|
9733
9738
|
const e = this.getShaderConfig();
|
|
@@ -9747,7 +9752,7 @@ class Vo extends No {
|
|
|
9747
9752
|
};
|
|
9748
9753
|
this.picking = [ new n.FBORayPicking(this.renderer, i, this.layer.getRenderer().pickingFBO, this.getMap()) ];
|
|
9749
9754
|
}
|
|
9750
|
-
|
|
9755
|
+
do() {
|
|
9751
9756
|
this.setToRedraw();
|
|
9752
9757
|
}
|
|
9753
9758
|
getShaderConfig() {
|
|
@@ -9803,7 +9808,7 @@ class Vo extends No {
|
|
|
9803
9808
|
this.material = new n.PhongMaterial(e);
|
|
9804
9809
|
}
|
|
9805
9810
|
getUniformValues(t, e) {
|
|
9806
|
-
const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.
|
|
9811
|
+
const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.po(), o = Tt({
|
|
9807
9812
|
viewMatrix: n,
|
|
9808
9813
|
projMatrix: i,
|
|
9809
9814
|
cameraPosition: r,
|
|
@@ -9816,7 +9821,7 @@ class Vo extends No {
|
|
|
9816
9821
|
getPickingVert() {
|
|
9817
9822
|
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 ";
|
|
9818
9823
|
}
|
|
9819
|
-
|
|
9824
|
+
po() {
|
|
9820
9825
|
const t = this.getMap().getLightManager(), e = t && t.getAmbientLight() || {}, n = t && t.getDirectionalLight() || {};
|
|
9821
9826
|
return {
|
|
9822
9827
|
ambientColor: e.color || [ .2, .2, .2 ],
|
|
@@ -9916,20 +9921,20 @@ const {getPBRUniforms: Bo} = n.pbr.PBRUtils;
|
|
|
9916
9921
|
|
|
9917
9922
|
class Go extends No {
|
|
9918
9923
|
constructor(...t) {
|
|
9919
|
-
super(...t), this.
|
|
9924
|
+
super(...t), this.mo = new n.ResourceLoader, this.scene.sortFunction = this.sortByCommandKey;
|
|
9920
9925
|
}
|
|
9921
9926
|
supportRenderMode(t) {
|
|
9922
9927
|
return this.getSymbols()[0].ssr ? "fxaa" === t || "fxaaAfterTaa" === t : super.supportRenderMode(t);
|
|
9923
9928
|
}
|
|
9924
9929
|
isAnimating() {
|
|
9925
|
-
const t = this.
|
|
9930
|
+
const t = this.yo();
|
|
9926
9931
|
if (t && (t[0] || t[1])) return !0;
|
|
9927
9932
|
}
|
|
9928
9933
|
needToRedraw() {
|
|
9929
|
-
const t = this.
|
|
9934
|
+
const t = this.yo();
|
|
9930
9935
|
return !(!t || !t[0] && !t[1]) || super.needToRedraw();
|
|
9931
9936
|
}
|
|
9932
|
-
|
|
9937
|
+
yo() {
|
|
9933
9938
|
const t = this.getSymbols()[0];
|
|
9934
9939
|
return t.material && t.material.uvOffsetAnim;
|
|
9935
9940
|
}
|
|
@@ -9952,32 +9957,32 @@ class Go extends No {
|
|
|
9952
9957
|
paint(t) {
|
|
9953
9958
|
const e = !!t.shadow;
|
|
9954
9959
|
t.states && t.states.includesChanged && (this.shader.dispose(), delete this.shader,
|
|
9955
|
-
this.
|
|
9960
|
+
this.vo.dispose(), delete this.vo, this.br(t));
|
|
9956
9961
|
let n = !!t.ssr && this.getSymbols()[0].ssr;
|
|
9957
9962
|
const i = this.shader, r = i.shaderDefines;
|
|
9958
9963
|
if (n) {
|
|
9959
9964
|
const e = Tt({}, r, t.ssr.defines);
|
|
9960
9965
|
i.shaderDefines = e;
|
|
9961
9966
|
}
|
|
9962
|
-
if (t.onlyUpdateDepthInTaa && (this.shader = this.
|
|
9967
|
+
if (t.onlyUpdateDepthInTaa && (this.shader = this.vo, !n && this.xo && (this.shader = i,
|
|
9963
9968
|
this.setToRedraw(!0))), this.updateIBLDefines(i), super.paint(t), void 0 !== this.shadowCount && e) {
|
|
9964
9969
|
const t = this.scene.getMeshes().length;
|
|
9965
9970
|
this.shadowCount !== t && this.setToRedraw();
|
|
9966
9971
|
}
|
|
9967
|
-
this.shader = i, n && (i.shaderDefines = r), delete this.shadowCount, this.
|
|
9972
|
+
this.shader = i, n && (i.shaderDefines = r), delete this.shadowCount, this.xo = n;
|
|
9968
9973
|
}
|
|
9969
9974
|
updateSceneConfig(t) {
|
|
9970
9975
|
Tt(this.sceneConfig, t), this.setToRedraw();
|
|
9971
9976
|
}
|
|
9972
9977
|
delete() {
|
|
9973
|
-
super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.
|
|
9974
|
-
delete this.
|
|
9978
|
+
super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.vo && (this.vo.dispose(),
|
|
9979
|
+
delete this.vo);
|
|
9975
9980
|
}
|
|
9976
9981
|
init(t) {
|
|
9977
|
-
this.getMap().on("updatelights", this.
|
|
9982
|
+
this.getMap().on("updatelights", this.bo, this), this.createIBLTextures(), this.Sr = this.Sr || t;
|
|
9978
9983
|
const e = this.regl;
|
|
9979
|
-
this.renderer = new n.Renderer(e), this.
|
|
9980
|
-
this.
|
|
9984
|
+
this.renderer = new n.Renderer(e), this.Ao = this.wo.bind(this), this._o = this.disposeCachedTexture.bind(this),
|
|
9985
|
+
this.So = this.Mo.bind(this), this.ri(), this.br(t);
|
|
9981
9986
|
const i = {
|
|
9982
9987
|
vert: "\n #include <gl2_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 ",
|
|
9983
9988
|
uniforms: [ {
|
|
@@ -10039,17 +10044,17 @@ class Go extends No {
|
|
|
10039
10044
|
}
|
|
10040
10045
|
}, o = {
|
|
10041
10046
|
uniforms: r,
|
|
10042
|
-
defines: this.
|
|
10047
|
+
defines: this.Po(i),
|
|
10043
10048
|
extraCommandProps: s
|
|
10044
10049
|
};
|
|
10045
10050
|
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 ",
|
|
10046
|
-
this.
|
|
10051
|
+
this.vo = new n.pbr.StandardShader(o);
|
|
10047
10052
|
}
|
|
10048
|
-
|
|
10053
|
+
wo({resources: t}) {
|
|
10049
10054
|
for (let e = 0; e < t.length; e++) this.addCachedTexture(t[e].url, t[e].data);
|
|
10050
10055
|
this.setToRedraw(!0);
|
|
10051
10056
|
}
|
|
10052
|
-
|
|
10057
|
+
Mo() {
|
|
10053
10058
|
this.setToRedraw(!0);
|
|
10054
10059
|
}
|
|
10055
10060
|
ri(t) {
|
|
@@ -10076,14 +10081,14 @@ class Go extends No {
|
|
|
10076
10081
|
url: a,
|
|
10077
10082
|
wrap: "repeat"
|
|
10078
10083
|
}), o.flipY = !e.upsideUpTexture, o.min = "linear mipmap linear", o.mag = "linear",
|
|
10079
|
-
r[t] = new n.Texture2D(o, this.
|
|
10084
|
+
r[t] = new n.Texture2D(o, this.mo), r[t].once("complete", this.Ao), r[t].once("disposed", this._o),
|
|
10080
10085
|
r[t].promise && this.addCachedTexture(a, r[t].promise), s = !0;
|
|
10081
10086
|
} else r[t] = i[t];
|
|
10082
10087
|
if (void 0 === r.alphaTest && this.getMaterialClazz && (r.alphaTest = .05), this.material) {
|
|
10083
10088
|
for (let t in r) this.material.set(t, r[t]);
|
|
10084
10089
|
this.setToRedraw(!0);
|
|
10085
|
-
} else this.material = new n.pbr.StandardMaterial(r), this.material.once("complete", this.
|
|
10086
|
-
s || this.
|
|
10090
|
+
} else this.material = new n.pbr.StandardMaterial(r), this.material.once("complete", this.So);
|
|
10091
|
+
s || this.Mo();
|
|
10087
10092
|
}
|
|
10088
10093
|
getShader() {
|
|
10089
10094
|
return this.shader;
|
|
@@ -10092,13 +10097,13 @@ class Go extends No {
|
|
|
10092
10097
|
const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = Bo(t, n, i, e && e.ssr, e && e.jitter);
|
|
10093
10098
|
return this.setIncludeUniformValues(r, e), r;
|
|
10094
10099
|
}
|
|
10095
|
-
|
|
10100
|
+
Po(t) {
|
|
10096
10101
|
return this.hasIBL() ? t.HAS_IBL_LIGHTING = 1 : delete t.HAS_IBL_LIGHTING, t;
|
|
10097
10102
|
}
|
|
10098
|
-
|
|
10103
|
+
bo() {
|
|
10099
10104
|
if (!this.shader) return;
|
|
10100
10105
|
const t = this.shader.shaderDefines;
|
|
10101
|
-
this.
|
|
10106
|
+
this.Po(t), this.shader.shaderDefines = t;
|
|
10102
10107
|
}
|
|
10103
10108
|
}
|
|
10104
10109
|
|
|
@@ -10172,7 +10177,7 @@ class Yo extends Bi {
|
|
|
10172
10177
|
super.paint(t);
|
|
10173
10178
|
}
|
|
10174
10179
|
init(t) {
|
|
10175
|
-
this.getMap().on("updatelights", this.
|
|
10180
|
+
this.getMap().on("updatelights", this.bo, this), this.createIBLTextures();
|
|
10176
10181
|
const e = this.regl;
|
|
10177
10182
|
if (this.renderer = new n.Renderer(e), this.createShader(t), this.pickingFBO) {
|
|
10178
10183
|
const t = [];
|
|
@@ -10207,7 +10212,7 @@ class Yo extends Bi {
|
|
|
10207
10212
|
}), this.shader = new n.pbr.StandardShader({
|
|
10208
10213
|
vert: Wo,
|
|
10209
10214
|
uniforms: e,
|
|
10210
|
-
defines: this.
|
|
10215
|
+
defines: this.Po(i),
|
|
10211
10216
|
extraCommandProps: this.getExtraCommandProps()
|
|
10212
10217
|
});
|
|
10213
10218
|
}
|
|
@@ -10322,13 +10327,13 @@ class Yo extends Bi {
|
|
|
10322
10327
|
}
|
|
10323
10328
|
} ];
|
|
10324
10329
|
}
|
|
10325
|
-
|
|
10330
|
+
Po(t) {
|
|
10326
10331
|
return this.hasIBL() ? t.HAS_IBL_LIGHTING = 1 : delete t.HAS_IBL_LIGHTING, t;
|
|
10327
10332
|
}
|
|
10328
|
-
|
|
10333
|
+
bo() {
|
|
10329
10334
|
if (!this.shader) return;
|
|
10330
10335
|
const t = this.shader.shaderDefines;
|
|
10331
|
-
this.
|
|
10336
|
+
this.Po(t), this.shader.shaderDefines = t;
|
|
10332
10337
|
}
|
|
10333
10338
|
delete() {
|
|
10334
10339
|
super.delete(), this.disposeIBLTextures(), this.shader && (this.shader.dispose(),
|
|
@@ -10338,13 +10343,13 @@ class Yo extends Bi {
|
|
|
10338
10343
|
|
|
10339
10344
|
const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0, 0 ], ea = [ 1, 1, 1 ], na = [], ia = [ 1, 1, 1, 1 ], ra = [], sa = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], oa = t => class extends t {
|
|
10340
10345
|
constructor(t, e, i, r, s, o) {
|
|
10341
|
-
super(t, e, i, r, s, o), this.
|
|
10342
|
-
this.
|
|
10346
|
+
super(t, e, i, r, s, o), this.To = !1, this.scene.sortFunction = this.sortByCommandKey,
|
|
10347
|
+
this.ko = new n.GLTFManager(t), this.Oo(), this.Io();
|
|
10343
10348
|
}
|
|
10344
10349
|
isAnimating() {
|
|
10345
10350
|
const t = this.getSymbols();
|
|
10346
10351
|
for (let e = 0; e < t.length; e++) {
|
|
10347
|
-
if (t[e] && this.
|
|
10352
|
+
if (t[e] && this.Fo[e] && this.Co(e)) return !0;
|
|
10348
10353
|
}
|
|
10349
10354
|
return !1;
|
|
10350
10355
|
}
|
|
@@ -10364,7 +10369,7 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10364
10369
|
return na;
|
|
10365
10370
|
}
|
|
10366
10371
|
createMesh(t, e, {tileTranslationMatrix: s, tileExtent: o}, {timestamp: a}) {
|
|
10367
|
-
if (!this.
|
|
10372
|
+
if (!this.To) return null;
|
|
10368
10373
|
const l = this.getMap(), {geometry: h} = t, {positionSize: u, features: c} = h, {aPosition: f, aPickingId: d, aXYRotation: p, aZRotation: m, aAltitude: y} = h.data, g = f.length / u;
|
|
10369
10374
|
if (0 === g) return null;
|
|
10370
10375
|
const v = {
|
|
@@ -10372,7 +10377,7 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10372
10377
|
instance_vectorB: new Float32Array(4 * g),
|
|
10373
10378
|
instance_vectorC: new Float32Array(4 * g),
|
|
10374
10379
|
aPickingId: []
|
|
10375
|
-
}, x = this.
|
|
10380
|
+
}, x = this.Eo(v, s, o, h.properties.z, f, y, p, m, u, d, c);
|
|
10376
10381
|
h.data.aTerrainAltitude && (v.aTerrainAltitude = h.data.aTerrainAltitude);
|
|
10377
10382
|
const b = {};
|
|
10378
10383
|
for (const t in v) b[t] = {
|
|
@@ -10382,22 +10387,22 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10382
10387
|
}),
|
|
10383
10388
|
divisor: 1
|
|
10384
10389
|
};
|
|
10385
|
-
const A = this.
|
|
10390
|
+
const A = this.Do(), w = this.Ro(), _ = r.identity([]);
|
|
10386
10391
|
r.scale(_, _, [ w, w, w ]);
|
|
10387
10392
|
const S = [], M = this.getSymbols();
|
|
10388
10393
|
for (let t = 0; t < M.length; t++) {
|
|
10389
|
-
const e = M[t], o = this.
|
|
10394
|
+
const e = M[t], o = this.Lo[t];
|
|
10390
10395
|
if (!o) continue;
|
|
10391
|
-
const u = this.
|
|
10396
|
+
const u = this.Fo[t][0], {fixSizeOnZoom: c} = e;
|
|
10392
10397
|
let f = r.identity([]);
|
|
10393
|
-
A || (f = this.
|
|
10398
|
+
A || (f = this.No(f));
|
|
10394
10399
|
let d = 0;
|
|
10395
10400
|
o.forEach(t => {
|
|
10396
10401
|
const {geometry: n, nodeMatrix: i} = t;
|
|
10397
10402
|
r.multiply(ra, sa, i), r.multiply(ra, f, ra);
|
|
10398
10403
|
const s = r.multiply(ra, _, ra), o = n.boundingBox.copy();
|
|
10399
10404
|
o.transform(s);
|
|
10400
|
-
const a = this.
|
|
10405
|
+
const a = this.Ho(o, e);
|
|
10401
10406
|
Math.abs(a) > Math.abs(d) && (d = a);
|
|
10402
10407
|
});
|
|
10403
10408
|
const p = [ 0, 0, d ], m = o.map((o, m) => {
|
|
@@ -10408,17 +10413,17 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10408
10413
|
picking: !0
|
|
10409
10414
|
});
|
|
10410
10415
|
if (u.hasSkinAnimation()) {
|
|
10411
|
-
const e = this.
|
|
10416
|
+
const e = this.zo(k, t, 0)[M];
|
|
10412
10417
|
k.setUniform("jointTexture", e.jointTexture), k.setUniform("jointTextureSize", e.jointTextureSize),
|
|
10413
|
-
k.setUniform("numJoints", e.numJoints), k.setUniform("skinAnimation", +this.
|
|
10418
|
+
k.setUniform("numJoints", e.numJoints), k.setUniform("skinAnimation", +this.Co(t)),
|
|
10414
10419
|
k.properties.startTime = a, T.HAS_SKIN = 1;
|
|
10415
10420
|
}
|
|
10416
10421
|
w && (k.setUniform("morphWeights", w), T.HAS_MORPH = 1), k.setUniform("hasAlpha", S.alphaMode && "BLEND" === S.alphaMode.toUpperCase()),
|
|
10417
10422
|
Ct(k.uniforms, "polygonFill", e, "markerFill", ia, Rt(this.colorCache)), Ct(k.uniforms, "polygonOpacity", e, "markerOpacity", 1);
|
|
10418
10423
|
const O = [];
|
|
10419
10424
|
k.setPositionMatrix(() => {
|
|
10420
|
-
const e = this.
|
|
10421
|
-
r.multiply(O, sa, e), this.
|
|
10425
|
+
const e = this.Vo(t, m, M);
|
|
10426
|
+
r.multiply(O, sa, e), this.No(f), r.multiply(O, f, O), r.multiply(O, _, O);
|
|
10422
10427
|
const n = r.identity(ra);
|
|
10423
10428
|
if (0 !== d && (r.fromTranslation(n, p), r.multiply(O, n, O)), Ht(c)) {
|
|
10424
10429
|
const t = l.getGLScale() / l.getGLScale(c);
|
|
@@ -10448,19 +10453,19 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10448
10453
|
positionSize: u
|
|
10449
10454
|
}, S;
|
|
10450
10455
|
}
|
|
10451
|
-
Uo(t, e, n) {
|
|
10452
|
-
const i = t, r = this.No[i][e];
|
|
10453
|
-
return this.Eo(t) && this.jo && this.jo[n] || r.nodeMatrix;
|
|
10454
|
-
}
|
|
10455
10456
|
Vo(t, e, n) {
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
this.
|
|
10462
|
-
|
|
10463
|
-
|
|
10457
|
+
const i = t, r = this.Lo[i][e];
|
|
10458
|
+
return this.Co(t) && this.Uo && this.Uo[n] || r.nodeMatrix;
|
|
10459
|
+
}
|
|
10460
|
+
zo(t, e, n) {
|
|
10461
|
+
if (!this.Fo) return;
|
|
10462
|
+
const i = this.Fo[e][0];
|
|
10463
|
+
this.jo || (this.jo = {}), this.Uo = {}, this.jo[t.uuid] || (this.jo[t.uuid] = {});
|
|
10464
|
+
const r = this.getSymbols()[e], s = this.Bo[e], {loop: o, speed: a, animationName: l} = r, h = l || s.animations[0].name;
|
|
10465
|
+
return i.updateAnimation(n, o || !1, a || 1, h, t.properties.startTime || 0, this.Uo, this.jo[t.uuid]),
|
|
10466
|
+
this.jo[t.uuid];
|
|
10467
|
+
}
|
|
10468
|
+
Ho(t, e) {
|
|
10464
10469
|
const n = e.anchorZ || "center";
|
|
10465
10470
|
let i = 0;
|
|
10466
10471
|
const r = t.max[2] - t.min[2];
|
|
@@ -10473,8 +10478,8 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10473
10478
|
for (let e = 0; e < t.length; e++) {
|
|
10474
10479
|
if (!t[e] || !t[e].geometry) continue;
|
|
10475
10480
|
t[e].instancedData.aTerrainAltitude && this.ji(t[e], t[e].instancedData, t[e].properties, 3, n);
|
|
10476
|
-
const r = t[e].properties.symbolIndex.index, s = this.
|
|
10477
|
-
s && this.
|
|
10481
|
+
const r = t[e].properties.symbolIndex.index, s = this.Co(r);
|
|
10482
|
+
s && this.zo(t[e], r, i), t[e].setUniform("skinAnimation", +s);
|
|
10478
10483
|
}
|
|
10479
10484
|
return this.scene.addMesh(t), this;
|
|
10480
10485
|
}
|
|
@@ -10485,8 +10490,8 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10485
10490
|
const e = this.getSymbols();
|
|
10486
10491
|
let n = !1;
|
|
10487
10492
|
for (let t = 0; t < e.length; t++) {
|
|
10488
|
-
if (!e[t] || !this.
|
|
10489
|
-
if (this.
|
|
10493
|
+
if (!e[t] || !this.Fo[t]) continue;
|
|
10494
|
+
if (this.Co(t) && this.Fo[t] && !n) {
|
|
10490
10495
|
n = !0;
|
|
10491
10496
|
break;
|
|
10492
10497
|
}
|
|
@@ -10498,11 +10503,11 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10498
10503
|
this.shadowCount = this.scene.getMeshes().length;
|
|
10499
10504
|
return this.scene.getMeshes().filter(t => 0 === t.properties.level);
|
|
10500
10505
|
}
|
|
10501
|
-
|
|
10506
|
+
Co(t) {
|
|
10502
10507
|
const e = this.getSymbols()[t];
|
|
10503
|
-
return !!(e && e.animation && this.
|
|
10508
|
+
return !!(e && e.animation && this.Fo[t] && this.Fo[t][0] && this.Fo[t][0].hasSkinAnimation());
|
|
10504
10509
|
}
|
|
10505
|
-
|
|
10510
|
+
Eo(t, e, n, s, o, a, l, h, u, c, f) {
|
|
10506
10511
|
function d(e, n, i, r) {
|
|
10507
10512
|
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];
|
|
10508
10513
|
}
|
|
@@ -10515,7 +10520,7 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10515
10520
|
e[0] < v && (v = e[0]), e[0] > w && (w = e[0]), e[1] < x && (x = e[1]), e[1] > _ && (_ = e[1]),
|
|
10516
10521
|
e[2] < b && (b = e[2]), e[2] > S && (S = e[2]);
|
|
10517
10522
|
}
|
|
10518
|
-
const T = (v + w) / 2, k = (x + _) / 2, O = (b + S) / 2, I = [], F = this.
|
|
10523
|
+
const T = (v + w) / 2, k = (x + _) / 2, O = (b + S) / 2, I = [], F = this.Do(), C = [ 0, 0, 1 ];
|
|
10519
10524
|
for (let e = 0; e < p; e++) {
|
|
10520
10525
|
a ? i.set(P, o[e * u], o[e * u + 1], a[e]) : A.unpackPosition(P, o[e * u], o[e * u + 1], o[e * u + 2]);
|
|
10521
10526
|
const n = P[0], s = P[1], p = i.set(M, n * m - T, -s * m - k, (P[2] + g) * y - O), v = l && l[e] || 0, x = h && h[e] || 0;
|
|
@@ -10527,7 +10532,7 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10527
10532
|
r.multiply(I, o, I);
|
|
10528
10533
|
} else r.fromTranslation(I, p);
|
|
10529
10534
|
if (F) {
|
|
10530
|
-
const t = this.
|
|
10535
|
+
const t = this.No(ra, f, c, e);
|
|
10531
10536
|
r.multiply(I, I, t);
|
|
10532
10537
|
}
|
|
10533
10538
|
d("instance_vectorA", e, I, 0), d("instance_vectorB", e, I, 1), d("instance_vectorC", e, I, 2),
|
|
@@ -10535,30 +10540,30 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10535
10540
|
}
|
|
10536
10541
|
return i.set(M, T, k, O), M;
|
|
10537
10542
|
}
|
|
10538
|
-
|
|
10539
|
-
if (!this.
|
|
10543
|
+
Ro() {
|
|
10544
|
+
if (!this.Go) {
|
|
10540
10545
|
const t = this.getMap();
|
|
10541
|
-
this.
|
|
10546
|
+
this.Go = 100 * lt(t.getGLRes(), t);
|
|
10542
10547
|
}
|
|
10543
|
-
return this.
|
|
10548
|
+
return this.Go;
|
|
10544
10549
|
}
|
|
10545
|
-
|
|
10546
|
-
const s = this.getMap(), o = this.symbolDef[0], a = this.
|
|
10550
|
+
No(t, e, n, r) {
|
|
10551
|
+
const s = this.getMap(), o = this.symbolDef[0], a = this.Ro();
|
|
10547
10552
|
let l = o.translationX || 0, h = o.translationY || 0, u = o.translationZ || 0, c = o.rotationX || 0, f = o.rotationY || 0, d = o.rotationZ || 0, p = o.scaleX || 1, m = o.scaleY || 1, y = o.scaleZ || 1;
|
|
10548
|
-
const g = n && n[r], v = e && e[g], x = s.getZoom(), b = v && v.feature && v.feature.properties, A = this.
|
|
10549
|
-
this.
|
|
10553
|
+
const g = n && n[r], v = e && e[g], x = s.getZoom(), b = v && v.feature && v.feature.properties, A = this.Wo(x, b);
|
|
10554
|
+
this.Xo && (l = this.Xo(x, b)), this.Yo && (h = this.Yo(x, b)), this.$o && (u = this.$o(x, b));
|
|
10550
10555
|
const w = i.set(qo, l * a, h * a, u * a);
|
|
10551
|
-
this.
|
|
10556
|
+
this.qo && (c = this.qo(x, b)), this.Jo && (f = this.Jo(x, b)), this.Ko && (d = this.Ko(x, b));
|
|
10552
10557
|
const _ = i.set(Jo, c, f, d);
|
|
10553
|
-
this.
|
|
10558
|
+
this.Zo && (p = this.Zo(x, b)), this.Qo && (m = this.Qo(x, b)), this.ta && (y = this.ta(x, b));
|
|
10554
10559
|
const S = i.set(Ko, p * A, m * A, y * A);
|
|
10555
|
-
return this.
|
|
10560
|
+
return this.ea(t, w, _, S);
|
|
10556
10561
|
}
|
|
10557
|
-
|
|
10562
|
+
Wo(t, e) {
|
|
10558
10563
|
const n = this.symbolDef[0];
|
|
10559
|
-
let i = this.
|
|
10564
|
+
let i = this.na ? this.na(t, e) : n.modelHeight;
|
|
10560
10565
|
if (rt(i)) return 1;
|
|
10561
|
-
const r = this.
|
|
10566
|
+
const r = this.ia[0];
|
|
10562
10567
|
return i / Math.abs(r.max[1] - r.min[1]);
|
|
10563
10568
|
}
|
|
10564
10569
|
getShaderConfig() {
|
|
@@ -10566,40 +10571,40 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10566
10571
|
return t.positionAttribute = "POSITION", t.normalAttribute = "NORMAL", t;
|
|
10567
10572
|
}
|
|
10568
10573
|
init(t) {
|
|
10569
|
-
super.init(t), this.
|
|
10574
|
+
super.init(t), this.Io();
|
|
10570
10575
|
}
|
|
10571
|
-
|
|
10576
|
+
Oo() {
|
|
10572
10577
|
const t = this.symbolDef[0];
|
|
10573
|
-
p(t.modelHeight) && (this.
|
|
10574
|
-
p(t.translationY) && (this
|
|
10575
|
-
p(t.rotationX) && (this.
|
|
10576
|
-
p(t.rotationZ) && (this.
|
|
10577
|
-
p(t.scaleY) && (this.
|
|
10578
|
+
p(t.modelHeight) && (this.na = g(t.modelHeight)), p(t.translationX) && (this.Xo = g(t.translationX)),
|
|
10579
|
+
p(t.translationY) && (this.Yo = g(t.translationY)), p(t.translationZ) && (this.$o = g(t.translationZ)),
|
|
10580
|
+
p(t.rotationX) && (this.qo = g(t.rotationX)), p(t.rotationY) && (this.Jo = g(t.rotationY)),
|
|
10581
|
+
p(t.rotationZ) && (this.Ko = g(t.rotationZ)), p(t.scaleX) && (this.Zo = g(t.scaleX)),
|
|
10582
|
+
p(t.scaleY) && (this.Qo = g(t.scaleY)), p(t.scaleZ) && (this.ta = g(t.scaleZ));
|
|
10578
10583
|
}
|
|
10579
|
-
|
|
10580
|
-
return !!(this.
|
|
10584
|
+
Do() {
|
|
10585
|
+
return !!(this.na && !this.na.isFeatureConstant || this.Xo && !this.Xo.isFeatureConstant || this.Yo && !this.Yo.isFeatureConstant || this.$o && !this.$o.isFeatureConstant || this.qo && !this.qo.isFeatureConstant || this.Jo && !this.Jo.isFeatureConstant || this.Ko && !this.Ko.isFeatureConstant || this.Zo && !this.Zo.isFeatureConstant || this.Qo && !this.Qo.isFeatureConstant || this.ta && !this.ta.isFeatureConstant);
|
|
10581
10586
|
}
|
|
10582
|
-
|
|
10583
|
-
if (this.
|
|
10584
|
-
this.
|
|
10587
|
+
Io() {
|
|
10588
|
+
if (this.Fo) return;
|
|
10589
|
+
this.Fo = [], this.Bo = [], this.ia = [], this.Lo = [];
|
|
10585
10590
|
const t = this.getSymbols();
|
|
10586
|
-
this.
|
|
10591
|
+
this.ra = 0;
|
|
10587
10592
|
for (let e = 0; e < t.length; e++) {
|
|
10588
10593
|
const n = t[e].url || "pyramid";
|
|
10589
|
-
this.
|
|
10590
|
-
const i = this.
|
|
10594
|
+
this.ko.loginGLTF(n);
|
|
10595
|
+
const i = this.ko.getGLTF(n);
|
|
10591
10596
|
if (i.then) i.then(n => {
|
|
10592
|
-
if (!n.gltfPack) return this.
|
|
10597
|
+
if (!n.gltfPack) return this.ra++, void (this.ra >= t.length && (this.To = !0, this.setToRedraw(!0)));
|
|
10593
10598
|
const {gltfPack: i, json: r, bbox: s} = n;
|
|
10594
|
-
this.
|
|
10595
|
-
this.
|
|
10599
|
+
this.Fo[e] = [ i ], this.Lo[e] = i.getMeshesInfo(), this.Bo[e] = r, this.ia[e] = s,
|
|
10600
|
+
this.ra++, this.ra >= t.length && (this.To = !0), this.setToRedraw(!0);
|
|
10596
10601
|
}); else {
|
|
10597
10602
|
const {gltfPack: t, json: n, bbox: r} = i;
|
|
10598
|
-
t && (this.
|
|
10599
|
-
this.
|
|
10603
|
+
t && (this.Fo[e] = [ t ], this.Lo[e] = t.getMeshesInfo(), this.Bo[e] = n, this.ia[e] = r,
|
|
10604
|
+
this.ra++);
|
|
10600
10605
|
}
|
|
10601
10606
|
}
|
|
10602
|
-
this.
|
|
10607
|
+
this.ra >= t.length && (this.To = !0);
|
|
10603
10608
|
}
|
|
10604
10609
|
getPickingVert() {
|
|
10605
10610
|
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 }";
|
|
@@ -10608,10 +10613,10 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10608
10613
|
if (t) {
|
|
10609
10614
|
this.scene.removeMesh(t);
|
|
10610
10615
|
for (let e = 0; e < t.length; e++) {
|
|
10611
|
-
const n = this.
|
|
10616
|
+
const n = this.jo && this.jo[t[e].uuid];
|
|
10612
10617
|
if (n) {
|
|
10613
10618
|
for (const t in n) n[t].jointTexture && n[t].jointTexture.destroy();
|
|
10614
|
-
delete this.
|
|
10619
|
+
delete this.jo[t[e].uuid];
|
|
10615
10620
|
}
|
|
10616
10621
|
t[e].disposeInstanceData(), t[e].dispose();
|
|
10617
10622
|
}
|
|
@@ -10622,18 +10627,18 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10622
10627
|
const t = this.getSymbols();
|
|
10623
10628
|
for (let e = 0; e < t.length; e++) {
|
|
10624
10629
|
const n = t[e].url || "pyramid";
|
|
10625
|
-
this.
|
|
10630
|
+
this.ko.logoutGLTF(n);
|
|
10626
10631
|
}
|
|
10627
|
-
if (this.
|
|
10628
|
-
for (const t in this.
|
|
10629
|
-
const e = this.
|
|
10632
|
+
if (this.jo) {
|
|
10633
|
+
for (const t in this.jo) {
|
|
10634
|
+
const e = this.jo[t];
|
|
10630
10635
|
for (const t in e) e[t].jointTexture && e[t].jointTexture.destroy();
|
|
10631
10636
|
}
|
|
10632
|
-
delete this.
|
|
10637
|
+
delete this.jo;
|
|
10633
10638
|
}
|
|
10634
|
-
delete this.
|
|
10639
|
+
delete this.Uo;
|
|
10635
10640
|
}
|
|
10636
|
-
|
|
10641
|
+
ea(t, e, n, s) {
|
|
10637
10642
|
const o = i.set($o, ...e || Qo), a = n || ta, l = s || ea, h = c.fromEuler(Zo, a[0], a[1], a[2]);
|
|
10638
10643
|
return r.fromRotationTranslationScale(t, h, o, l);
|
|
10639
10644
|
}
|
|
@@ -10686,8 +10691,8 @@ class pa extends Bi {
|
|
|
10686
10691
|
}
|
|
10687
10692
|
callShader(t, e) {
|
|
10688
10693
|
super.callShader(t, e), this.transformWater();
|
|
10689
|
-
const n = this.
|
|
10690
|
-
this.Gi += this.renderer.render(this.
|
|
10694
|
+
const n = this.sa(this.getMap(), e);
|
|
10695
|
+
this.Gi += this.renderer.render(this.oa, n, this.aa, this.getRenderFBO(e));
|
|
10691
10696
|
}
|
|
10692
10697
|
addMesh(t, e) {
|
|
10693
10698
|
this._r(t, e), super.addMesh(...arguments);
|
|
@@ -10697,14 +10702,14 @@ class pa extends Bi {
|
|
|
10697
10702
|
for (let n = 0; n < t.length; n++) t[n].ssr = e ? 1 : 0;
|
|
10698
10703
|
}
|
|
10699
10704
|
paint(t) {
|
|
10700
|
-
t.states && t.states.includesChanged && (this.shader.dispose(), this.
|
|
10705
|
+
t.states && t.states.includesChanged && (this.shader.dispose(), this.oa.dispose(),
|
|
10701
10706
|
this.br(t));
|
|
10702
|
-
const e = !!t.ssr && this.getSymbol(ca).ssr, n = this.
|
|
10707
|
+
const e = !!t.ssr && this.getSymbol(ca).ssr, n = this.oa, i = n.shaderDefines;
|
|
10703
10708
|
if (e) {
|
|
10704
10709
|
const e = Tt({}, i, t.ssr.defines);
|
|
10705
10710
|
n.shaderDefines = e;
|
|
10706
10711
|
}
|
|
10707
|
-
this.updateIBLDefines(n), this.
|
|
10712
|
+
this.updateIBLDefines(n), this.la.ssr = e ? 1 : 0, super.paint(t), e && (n.shaderDefines = i);
|
|
10708
10713
|
}
|
|
10709
10714
|
init(t) {
|
|
10710
10715
|
this.createIBLTextures();
|
|
@@ -10722,38 +10727,38 @@ class pa extends Bi {
|
|
|
10722
10727
|
extraCommandProps: {
|
|
10723
10728
|
viewport: this.pickingViewport
|
|
10724
10729
|
}
|
|
10725
|
-
}, this.pickingFBO, this.getMap()) ]), this.
|
|
10730
|
+
}, this.pickingFBO, this.getMap()) ]), this.ha();
|
|
10726
10731
|
}
|
|
10727
|
-
|
|
10732
|
+
ha() {
|
|
10728
10733
|
const t = this.regl;
|
|
10729
|
-
this.
|
|
10734
|
+
this.ua || (this.ua = t.texture(2));
|
|
10730
10735
|
const e = this.getSymbol({
|
|
10731
10736
|
index: 0
|
|
10732
10737
|
}), n = e.texWaveNormal, i = this.getCachedTexture(n), r = this;
|
|
10733
|
-
if (i) this.
|
|
10734
|
-
this.shader && this.
|
|
10735
|
-
}, 20) : this.
|
|
10738
|
+
if (i) this.ca || (i.isLoading ? setTimeout(() => {
|
|
10739
|
+
this.shader && this.ha();
|
|
10740
|
+
}, 20) : this.ca = this.fa(t, i)); else {
|
|
10736
10741
|
const e = new Image;
|
|
10737
10742
|
e.isLoading = !0, e.onload = function() {
|
|
10738
|
-
delete this.isLoading, r.
|
|
10743
|
+
delete this.isLoading, r.ca = r.fa(t, this), r.setToRedraw();
|
|
10739
10744
|
}, e.onerror = () => {
|
|
10740
10745
|
console.error("invalid water wave normal texture:" + n);
|
|
10741
10746
|
}, this.addCachedTexture(n, e), e.src = n;
|
|
10742
10747
|
}
|
|
10743
10748
|
const s = e.texWavePerturbation, o = this.getCachedTexture(s);
|
|
10744
|
-
if (o) this.
|
|
10745
|
-
this.
|
|
10746
|
-
}, 20) : this.
|
|
10749
|
+
if (o) this.da || (o.isLoading ? setTimeout(() => {
|
|
10750
|
+
this.ha(), this.shader;
|
|
10751
|
+
}, 20) : this.da = this.fa(t, o)); else {
|
|
10747
10752
|
const e = new Image;
|
|
10748
10753
|
e.isLoading = !0, e.onload = function() {
|
|
10749
|
-
delete this.isLoading, r.
|
|
10754
|
+
delete this.isLoading, r.da = r.fa(t, this), r.setToRedraw();
|
|
10750
10755
|
}, e.onerror = () => {
|
|
10751
10756
|
console.error("invalid water wave perturbation texture:" + s);
|
|
10752
10757
|
}, this.addCachedTexture(s, e), e.src = s;
|
|
10753
10758
|
}
|
|
10754
10759
|
}
|
|
10755
|
-
|
|
10756
|
-
return this.
|
|
10760
|
+
fa(t, e) {
|
|
10761
|
+
return this.ua ? t.texture({
|
|
10757
10762
|
width: e.width,
|
|
10758
10763
|
height: e.height,
|
|
10759
10764
|
mag: "linear",
|
|
@@ -10859,7 +10864,7 @@ class pa extends Bi {
|
|
|
10859
10864
|
enable: !1
|
|
10860
10865
|
}
|
|
10861
10866
|
};
|
|
10862
|
-
s.push(...n.SsrPass.getUniformDeclares()), this.
|
|
10867
|
+
s.push(...n.SsrPass.getUniformDeclares()), this.oa = new n.MeshShader({
|
|
10863
10868
|
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\n#include <highlight_vert>\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\nhighlight_setVarying();\n}",
|
|
10864
10869
|
frag: "#define SHADER_NAME WATER\nprecision highp float;\nprecision highp sampler2D;\n#include <hsv_frag>\nuniform vec3 hsv;\nuniform float contrast;\nuniform float layerOpacity;\n#if defined(HAS_SHADOWING)\n#include <vsm_shadow_frag>\n#endif\n#include <highlight_frag>\n#if defined(HAS_IBL_LIGHTING)\nuniform vec3 hdrHSV;\nuniform samplerCube prefilterMap;\nuniform sampler2D brdfLUT;\nuniform float rgbmRange;\nuniform mat3 uEnvironmentTransform;\nuniform vec3 diffuseSPH[9];\nvec3 c(const in vec3 d) {\n vec3 e = uEnvironmentTransform * d;\n float x = e.x;\n float y = e.y;\n float z = e.z;\n vec3 f = (diffuseSPH[0] + diffuseSPH[1] * x + diffuseSPH[2] * y + diffuseSPH[3] * z + diffuseSPH[4] * z * x + diffuseSPH[5] * y * z + diffuseSPH[6] * y * x + diffuseSPH[7] * (3. * z * z - 1.) + diffuseSPH[8] * (x * x - y * y));\n if(length(hdrHSV) > .0) {\n f = hsv_apply(f, hdrHSV);\n }\n return max(f, vec3(.0));\n}\nvec3 h(const in vec3 i, const in float j, const in float k, const in float l) {\n vec4 rgba = texture2D(brdfLUT, vec2(k, j));\n float b = (rgba[3] * 65280.0 + rgba[2] * 255.);\n float a = (rgba[1] * 65280.0 + rgba[0] * 255.);\n const float m = 1. / 65535.;\n return (i * a + b * l) * m;\n}\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 o(const in vec4 u, const in float v) {\n if(v <= .0)\n return u.rgb;\n return v * u.rgb * u.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 A(const in vec4 B) {\n return B.r + B.g / 255.;\n}\nfloat C(const in vec2 D, const in float E) {\n vec3 F = vec3(.06711056, .00583715, 52.9829189);\n return fract(F.z * fract(dot(D.xy + E * vec2(47., 17.) * .695, F.xy))) * .5;\n}\nvec3 G(const in float H, const in float I, const in vec2 J) {\n float K = min(I - .01, H);\n float L = floor(K);\n float M = min(I, L + 1.);\n float N = pow(2., M);\n vec2 O = 2. * N / J;\n if(K - L > .5)\n N *= 2.;\n return vec3(O, N);\n}\nvec2 P(const in vec2 Q, const in vec3 R) {\n vec2 S = max(R.xy, min(1. - R.xy, Q));\n return vec2(2. * S.x, R.z - 1. - S.y) / R.z;\n}\nvec3 T(const in mat4 U, const in vec3 V) {\n vec4 W = U * vec4(V, 1.);\n return vec3(.5 + .5 * W.xy / W.w, W.w);\n}\nvec3 X(const in float Y, const in vec2 S) {\n return texture2D(TextureReflected, S).rgb;\n}\nfloat Z(float ba) {\n highp mat4 U = projMatrix;\n highp float z = ba * 2. - 1.;\n return -U[3].z / (z + U[2].z);\n}\nfloat bb(const vec2 S) {\n float ba = A(texture2D(TextureDepth, S));\n return ba;\n}\nvec3 bc(const in float E, const in vec3 bd, const in vec3 be, const in vec3 bf, const in vec3 bg, const in float bh) {\n vec2 bi;\n bi.x = C(gl_FragCoord.yx, E);\n bi.y = fract(bi.x * 52.9829189);\n bi.y = mix(bi.y, 1., .7);\n float bj = 2. * 3.14159 * bi.x;\n float bk = pow(max(bi.y, .000001), bh / (2. - bh));\n float bl = sqrt(1. - bk * bk);\n vec3 bm = vec3(bl * cos(bj), bl * sin(bj), bk);\n bm = bm.x * bd + bm.y * be + bm.z * bf;\n return normalize((2. * dot(bg, bm)) * bm - bg);\n}\nfloat bn(const in float E) {\n return (C(gl_FragCoord.xy, E) - .5);\n}\nvec3 bo(const in vec3 bp, const in float bq, const in vec3 br) {\n vec3 bs = T(projMatrix, vViewVertex.xyz + br * bq);\n bs.z = 1. / bs.z;\n bs -= bp;\n float bt = min(1., .99 * (1. - bp.x) / max(1e-5, bs.x));\n float bu = min(1., .99 * (1. - bp.y) / max(1e-5, bs.y));\n float bv = min(1., .99 * bp.x / max(1e-5, -bs.x));\n float bw = min(1., .99 * bp.y / max(1e-5, -bs.y));\n return bs * min(bt, bu) * min(bv, bw);\n}\nfloat bx(const in vec3 bp, const in vec3 bs, inout float by, inout float bz) {\n float bA = (bz + by) * .5;\n vec3 bB = bp + bs * bA;\n float z = bb(bB.xy);\n float ba = Z(z);\n float bC = -1. / bB.z;\n by = ba > bC ? by : bA;\n bz = ba > bC ? bA : bz;\n return bA;\n}\nvec4 bD(const in vec3 bp, const in float bq, in float bE, const in vec3 br, const in float j, const in float E) {\n const int bF = 20;\n float bG = 1. / float(bF);\n bE *= bG;\n vec3 bs = bo(bp, bq, br);\n float bH = bG;\n vec3 bI = vec3(.0, bH, 1.);\n vec3 bB;\n float z, ba, bC, bJ, bK, bL;\n bool bM;\n float bN = 1.;\n float bA;\n for(int bO = 0; bO < bF; bO++) {\n bB = bp + bs * bI.y;\n z = bb(bB.xy);\n ba = Z(z);\n bC = -1. / bB.z;\n bJ = bC - ba;\n bJ *= clamp(sign(abs(bJ) - bq * bG * bG), .0, 1.);\n bM = abs(bJ + bE) < bE;\n bK = clamp(bI.x / (bI.x - bJ), .0, 1.);\n bL = bM ? bI.y + bK * bG - bG : 1.;\n bI.z = min(bI.z, bL);\n bI.x = bJ;\n if(bM) {\n float by = bI.y - bG;\n float bz = bI.y;\n bA = bx(bp, bs, by, bz);\n bA = bx(bp, bs, by, bz);\n bA = bx(bp, bs, by, bz);\n bN = bA;\n break;\n }\n bI.y += bG;\n }\n return vec4(bp + bs * bN, 1. - bN);\n}\nvec3 bP(in vec4 bQ, const in float bR, const in vec3 bS, const in vec3 bT, const in float j) {\n vec4 bU = mix(outputFovInfo[0], outputFovInfo[1], bQ.x);\n bQ.xyz = vec3(mix(bU.xy, bU.zw, bQ.y), 1.) * -1. / bQ.z;\n bQ.xyz = (reprojViewProjMatrix * vec4(bQ.xyz, 1.)).xyw;\n bQ.xy /= bQ.z;\n float bV = clamp(6. - 6. * max(abs(bQ.x), abs(bQ.y)), .0, 1.);\n bQ.xy = .5 + .5 * bQ.xy;\n return vec3(bQ.xy, 1.);\n}\nvec3 ssr(const in vec3 bS, const in vec3 bT, const in float j, const in vec3 d, const in vec3 bg) {\n float bW = .0;\n vec4 f = vec4(.0);\n float bh = j * j;\n bh = bh * bh;\n vec3 bX = abs(d.z) < .999 ? vec3(.0, .0, 1.) : vec3(1., .0, .0);\n vec3 bd = normalize(cross(bX, d));\n vec3 be = cross(d, bd);\n float bR = ssrFactor * clamp(-4. * dot(bg, d) + 3.8, .0, 1.);\n bR *= clamp(4.7 - j * 5., .0, 1.);\n vec3 bp = T(projMatrix, vViewVertex.xyz);\n bp.z = 1. / bp.z;\n vec3 br = bc(bW, bd, be, d, bg, bh);\n float bq = mix(cameraNearFar.y + vViewVertex.z, -vViewVertex.z - cameraNearFar.x, br.z * .5 + .5);\n float bE = .5 * bq;\n vec4 bQ;\n if(dot(br, d) > .001 && bR > .0) {\n bQ = bD(bp, bq, bE, br, j, bW);\n if(bQ.w > .0)\n return bP(bQ, bR, bS, bT, j);\n \n }\n return vec3(.0);\n}\n#endif\nconst vec3 bY = 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 bZ(vec3 e, float ca) {\n float cb = max(.015, ca);\n return max((e.x + e.y) * .3303545 / cb + .3303545, .0);\n}\nconst vec2 cc = vec2(6. / 25., 5. / 24.);\nvec2 cd(sampler2D ce, vec2 S) {\n return 2. * texture2D(ce, S).rg - 1.;\n}\nfloat cf(vec2 S) {\n return texture2D(heightTexture, S).b;\n}\nvec3 cg(sampler2D ce, vec2 S) {\n return 2. * texture2D(ce, S).rgb - 1.;\n}\nfloat ch(vec2 S, float ci) {\n return fract(ci);\n}\nfloat cj(vec2 S, float ci) {\n float ck = ch(S, ci);\n return 1. - abs(1. - 2. * ck);\n}\nvec3 cl(sampler2D cm, vec2 S, float ci, float cn) {\n float co = waveParams[2];\n float cp = waveParams[3];\n vec2 cq = cd(cm, S) * co;\n float ck = ch(S, ci + cn);\n float cr = cj(S, ci + cn);\n vec2 f = S;\n f -= cq * (ck + cp);\n f += cn;\n f += (ci - ck) * cc;\n return vec3(f, cr);\n}\nconst float cs = 7.77;\nvec3 ct(sampler2D cu, sampler2D cv, vec2 cw, vec2 cx, float ci) {\n float ca = waveParams[0];\n vec2 cy = ci * -cx;\n float cz = cf(vNoiseUv) * cs;\n vec3 cA = cl(cv, cw + cy, ci + cz, .0);\n vec3 cB = cl(cv, cw + cy, ci + cz, .5);\n vec3 cC = cg(cu, cA.xy) * cA.z;\n vec3 cD = cg(cu, cB.xy) * cB.z;\n vec3 cE = normalize(cC + cD);\n cE.xy *= ca;\n cE.z = sqrt(1. - dot(cE.xy, cE.xy));\n return cE;\n}\nvec4 cF(vec2 cw, float cG) {\n float cH = waveParams[1];\n vec3 d = ct(normalTexture, heightTexture, cw * cH, waterDir, cG);\n float cI = bZ(d, waveParams[0]);\n return vec4(d, cI);\n}\nconst float cJ = 3.141592653589793;\nconst float cK = 1. / cJ;\nconst float cL = .3183098861837907;\nconst float cM = 1.570796326794897;\nconst float cN = .4;\nfloat cO = 2.2;\nvec3 cP(float cQ, vec3 cR, float l) {\n return cR + (l - cR) * pow(1. - cQ, 5.);\n}\nfloat cS(float cT, float j) {\n float cU = j * j;\n float cV = cT * cT;\n float cW = pow((cV * (cU - 1.) + 1.), cO) * cJ;\n return cU / cW;\n}\nfloat cX(float cY) {\n return .25 / (cY * cY);\n}\nvec3 cZ(const vec3 x) {\n return (x * (2.51 * x + .03)) / (x * (2.43 * x + .59) + .14);\n}\nconst float da = 2.2;\nconst float db = .4545454545;\nvec4 dc(vec4 u) {\n return vec4(pow(u.rgb, vec3(db)), u.w);\n}\nvec3 dd(vec3 u) {\n return pow(u, vec3(da));\n}\nconst vec3 de = vec3(.02, 1., 5.);\nconst vec2 df = vec2(.02, .1);\nconst float j = .06;\nconst float dg = 1.7;\nconst vec3 dh = vec3(0, .6, .9);\nconst vec3 di = vec3(.72, .92, 1.);\nconst float dj = .65;\nconst float dk = 300000.0;\nconst float dl = 500000.0;\nconst float dm = .775;\nconst float dn = .8;\nPBRShadingWater dp;\nvec3 dq(in PBRShadingWater dr, float j, vec3 ds, float dt) {\n vec3 du = cP(dr.VdotH, ds, dt);\n float dv = cS(dr.NdotH, j);\n float dw = cX(dr.LdotH);\n float dx = mix(j + .045, j + .385, 1. - dr.VdotH);\n float dy = 1.2;\n float dz = cS(dr.NdotH, dx) * dy;\n return ((dv + dz) * dw) * du;\n}\nvec3 dA(float dg, float dB, vec3 dh, float dC) {\n return dg * (.075 * dh * pow(dB, 4.) + 50. * pow(dB, 23.)) * dC;\n}\nvec3 dD(in float bk, in vec3 dE, in vec3 dF) {\n float dG = pow((1. - bk), de[2]);\n return mix(dF, dE, dG);\n}\nvec3 dH(in vec3 e, in vec3 dI, in float dJ, in float j) {\n \n#ifdef HAS_IBL_LIGHTING\nvec3 dK = reflect(-dI, e);\n vec4 dL = textureCube(prefilterMap, uEnvironmentTransform * dK);\n float dM = clamp(1. + dot(dK, e), .0, 1.);\n dL *= dM * dM;\n vec3 i = o(dL, rgbmRange);\n vec3 dN = c(e);\n float l = clamp(50.0 * waterBaseColor.g, .0, 1.);\n vec3 dO = h(waterBaseColor.rgb, j, dot(e, dI), l);\n return i * dO + dN;\n#else\nvec3 dP = dd(di);\n vec3 dQ = dd(dh);\n vec3 di = dD(dJ, dP, dQ);\n return di;\n#endif\n}\nvec3 dR(in vec3 e, in vec3 dI, in vec3 dS, vec3 u, in vec3 dT, in vec3 dU, in float dV, float dW, vec3 dX) {\n float dY = 0.;\n vec3 dZ = dd(u);\n vec3 bm = normalize(dS + dI);\n dp.NdotL = clamp(dot(e, dS), .0, 1.);\n dp.NdotV = clamp(dot(e, dI), .001, 1.);\n dp.VdotN = clamp(dot(dI, e), .001, 1.);\n dp.NdotH = clamp(dot(e, bm), .0, 1.);\n dp.VdotH = clamp(dot(dI, bm), .0, 1.);\n dp.LdotH = clamp(dot(dS, bm), .0, 1.);\n float dJ = max(dot(dU, dI), .0);\n vec3 di = dH(e, dI, dJ, j);\n float ea = max(dot(dU, dS), .0);\n float eb = .1 + ea * .9;\n di *= eb;\n float ec = clamp(dV, .8, 1.);\n vec3 ed = cP(dp.VdotN, vec3(de[0]), de[1]);\n vec3 ee = ed * di * ec;\n vec3 ef = dZ * mix(di, ea * dT * cK, 2. / 3.) * ec;\n vec3 i = vec3(.0);\n if(dJ > .0 && ea > .0) {\n vec3 eg = dq(dp, j, vec3(df[0]), df[1]);\n vec3 eh = dT * cK * dV;\n i = dp.NdotL * eh * eg;\n }\n vec3 cI = vec3(.0);\n if(dJ > .0) {\n cI = dA(dg, dW, dh, eb);\n }\n vec3 ei = vec3(.0);\n#ifdef HAS_SSR\nfloat ej = smoothstep(dl, dk, -dX.z);\n mat4 ek = viewMatrix;\n vec4 el = vec4(dX.xyz, 1.);\n vec3 em = normalize(el.xyz);\n vec4 en = ek * vec4(e, .0);\n vec3 eo = normalize(en.xyz);\n vec4 ep = ek * vec4(dU, .0);\n float eq = pow(max(dot(-em, ep.xyz), .0), cN);\n vec3 er = mix(ep.xyz, eo, eq);\n vec3 es = ssr(vec3(.0), vec3(1.), j, normalize(er), -normalize(vViewVertex.xyz));\n if(es.z > .0) {\n vec2 et = smoothstep(.3, .6, abs(vec2(.5) - es.xy));\n dY = dm * clamp(1. - 1.3 * et.y, .0, 1.) * ej;\n vec3 eu = X(.0, es.xy);\n ei = dd(eu) * dY * ed.y * dj;\n }\n#endif\nfloat ev = mix(dn, dn * .5, dY);\n return cZ((1. - dY) * ee + ei + ef * ev + i + cI);\n}\nvoid main() {\n vec3 dU = bY;\n vec4 ew = cF(vUv, timeElapsed);\n vec3 e = normalize(vTbnMatrix * ew.xyz);\n vec3 dI = -normalize(vPos - camPos);\n vec3 dS = normalize(-lightDirection);\n#if defined(HAS_SHADOWING)\nfloat dV = shadow_computeShadow();\n#else\nfloat dV = 1.;\n#endif\nvec4 ex = viewMatrix * vec4(vPos, 1.);\n vec4 ey = vec4(dR(e, dI, dS, waterBaseColor.rgb, lightColor, dU, dV, ew.w, ex.xyz), waterBaseColor.a);\n gl_FragColor = dc(ey);\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 gl_FragColor = highlight_blendColor(gl_FragColor) * layerOpacity;\n}",
|
|
10865
10870
|
defines: o,
|
|
@@ -10875,10 +10880,10 @@ class pa extends Bi {
|
|
|
10875
10880
|
projViewMatrix: t.projViewMatrix
|
|
10876
10881
|
};
|
|
10877
10882
|
}
|
|
10878
|
-
|
|
10883
|
+
sa(t, e) {
|
|
10879
10884
|
const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = ha(t, n, i, e && e.ssr, e && e.jitter), s = t.getLightManager();
|
|
10880
10885
|
let o = s && s.getDirectionalLight() || {};
|
|
10881
|
-
const l = s && s.getAmbientLight() || {}, h = this.getSymbol(ca), u = this.
|
|
10886
|
+
const l = s && s.getAmbientLight() || {}, h = this.getSymbol(ca), u = this.pa = this.pa || [], c = this.ma = this.ma || [];
|
|
10882
10887
|
a.set(c, .09, h.uvScale || 3, .03, -.5);
|
|
10883
10888
|
Tt(r, {
|
|
10884
10889
|
ambientColor: l.color || [ .2, .2, .2 ],
|
|
@@ -10887,8 +10892,8 @@ class pa extends Bi {
|
|
|
10887
10892
|
lightColor: o.color || ua.color,
|
|
10888
10893
|
camPos: t.cameraPosition,
|
|
10889
10894
|
timeElapsed: h.animation ? (this.layer.getRenderer().getFrameTimestamp() || 0) / (1 / (h.waterSpeed || 1) * 1e4) : 0,
|
|
10890
|
-
normalTexture: this.
|
|
10891
|
-
heightTexture: this.
|
|
10895
|
+
normalTexture: this.ca || this.ua,
|
|
10896
|
+
heightTexture: this.da || this.ua,
|
|
10892
10897
|
waveParams: c,
|
|
10893
10898
|
waterDir: ma(u, h.waterDirection || 0),
|
|
10894
10899
|
waterBaseColor: h.waterBaseColor || [ .1451, .2588, .4863, 1 ],
|
|
@@ -10900,24 +10905,24 @@ class pa extends Bi {
|
|
|
10900
10905
|
r;
|
|
10901
10906
|
}
|
|
10902
10907
|
delete() {
|
|
10903
|
-
super.delete(), this.
|
|
10904
|
-
this.
|
|
10905
|
-
this.
|
|
10906
|
-
this.
|
|
10908
|
+
super.delete(), this.ua && (this.ua.destroy(), delete this.ua), this.ca && this.ca.destroy(),
|
|
10909
|
+
this.da && this.da.destroy(), this.shader && (this.shader.dispose(), delete this.shader),
|
|
10910
|
+
this.oa && this.oa.dispose(), this.la && (this.la.geometry.dispose(), this.la.material && this.la.material.dispose(),
|
|
10911
|
+
this.la.dispose(), delete this.la), this.disposeIBLTextures();
|
|
10907
10912
|
}
|
|
10908
10913
|
createGround() {
|
|
10909
10914
|
const t = new n.Plane;
|
|
10910
10915
|
t.data.aTexCoord = new Uint8Array([ 0, 1, 1, 1, 0, 0, 1, 0 ]), t.generateBuffers(this.renderer.regl),
|
|
10911
|
-
this.
|
|
10916
|
+
this.la = new n.Mesh(t, null, {
|
|
10912
10917
|
castShadow: !1
|
|
10913
|
-
}), this.
|
|
10918
|
+
}), this.aa = new n.Scene([ this.la ]);
|
|
10914
10919
|
}
|
|
10915
10920
|
transformWater() {
|
|
10916
|
-
const t = this.getMap(), e = s.getGroundTransform(this.
|
|
10917
|
-
this.
|
|
10921
|
+
const t = this.getMap(), e = s.getGroundTransform(this.la.localTransform, t);
|
|
10922
|
+
this.la.setLocalTransform(e);
|
|
10918
10923
|
const n = t._get2DExtentAtRes(t.getGLRes()), i = n.getWidth(), r = n.getHeight(), o = t.cameraLookAt, a = o[0] - i, l = o[1] + r, h = a / da[0], u = l / da[1], c = h % 1, f = u % 1, d = .3737 * h % 1, p = .3737 * u % 1, m = i / da[0] * 2, y = r / da[1] * 2;
|
|
10919
|
-
this.
|
|
10920
|
-
this.
|
|
10924
|
+
this.la.setUniform("uvOffset", [ c, f ]), this.la.setUniform("noiseUvOffset", [ d, p ]),
|
|
10925
|
+
this.la.setUniform("uvScale", [ m, -y ]);
|
|
10921
10926
|
}
|
|
10922
10927
|
}
|
|
10923
10928
|
|
|
@@ -11013,7 +11018,7 @@ const ka = ei("heatmap", class extends Bi {
|
|
|
11013
11018
|
}
|
|
11014
11019
|
callRenderer(t, e, n) {
|
|
11015
11020
|
const i = this.getRenderFBO(n);
|
|
11016
|
-
this.Gi += this.
|
|
11021
|
+
this.Gi += this.ya.render(this.scene, e, i);
|
|
11017
11022
|
}
|
|
11018
11023
|
getUniformValues(t) {
|
|
11019
11024
|
const e = this.getSymbol({
|
|
@@ -11030,13 +11035,13 @@ const ka = ei("heatmap", class extends Bi {
|
|
|
11030
11035
|
return this.scene.getMeshes();
|
|
11031
11036
|
}
|
|
11032
11037
|
delete() {
|
|
11033
|
-
super.delete(...arguments), this.
|
|
11038
|
+
super.delete(...arguments), this.ya.dispose(), delete this.ya;
|
|
11034
11039
|
}
|
|
11035
11040
|
init() {
|
|
11036
11041
|
const t = this.regl;
|
|
11037
11042
|
this.renderer = new n.Renderer(t);
|
|
11038
11043
|
const e = this.getPolygonOffset(), i = this.getSymbols()[0];
|
|
11039
|
-
this.
|
|
11044
|
+
this.ya = new d(this.regl, this.sceneConfig, this.layer, i.heatmapColor, null, e);
|
|
11040
11045
|
}
|
|
11041
11046
|
});
|
|
11042
11047
|
|
|
@@ -11047,7 +11052,7 @@ const Oa = ei("water", pa);
|
|
|
11047
11052
|
Oa.registerAt(he), we.registerPainter("lit", Go), we.registerPainter("icon", Cs),
|
|
11048
11053
|
we.registerPainter("fill", nr), we.registerPainter("line", or), we.registerPainter("line-gradient", ar),
|
|
11049
11054
|
we.registerPainter("water", pa), we.registerPainter("tube", Yo), n.ShaderLib.register("vt_position_vert", "#ifdef HAS_TERRAIN_ALTITUDE\n attribute float aTerrainAltitude;\n#endif\nuniform float minAltitude;\n#ifdef HAS_ALTITUDE\n vec3 unpackVTPosition() {\n float altitude = aAltitude;\n #ifdef HAS_TERRAIN_ALTITUDE\n altitude += aTerrainAltitude * 100.0;\n #endif\n altitude += minAltitude * 100.0;\n return vec3(aPosition, altitude);\n }\n#else\n float position_modValue = 16384.0;\n float position_delta = 0.00001;\n vec3 unpackVTPosition() {\n float z = aPosition.z;\n vec2 pos = sign(aPosition.xy + position_delta) * mod(abs(aPosition.xy), position_modValue);\n vec2 highs = floor(abs(aPosition.xy) / position_modValue);\n float altitude = sign(z + position_delta) * (highs.x * 2.0 + highs.y) * pow(2.0, 15.0) + z;\n #ifdef HAS_TERRAIN_ALTITUDE\n altitude += aTerrainAltitude * 100.0;\n #endif\n altitude += minAltitude * 100.0;\n return vec3(pos, altitude);\n }\n#endif"),
|
|
11050
|
-
he.VERSION = "0.92.
|
|
11055
|
+
he.VERSION = "0.92.2", we.VERSION = "0.92.2";
|
|
11051
11056
|
|
|
11052
11057
|
if (e.mat4.create(), e.transcoders) {
|
|
11053
11058
|
const n = t.Map.VERSION;
|
|
@@ -11061,4 +11066,4 @@ if (e.mat4.create(), e.transcoders) {
|
|
|
11061
11066
|
|
|
11062
11067
|
export { $n as ExtrudePolygonLayer, nr as FillPainter, ya as FillPlugin, Pa as GLTFPhongPlugin, Ta as GLTFStandardPlugin, ve as GeoJSONVectorTileLayer, ka as HeatmapPlugin, Cs as IconPainter, xa as IconPlugin, va as LineGradientPlugin, or as LinePainter, ga as LinePlugin, $e as LineStringLayer, Sa as LitPlugin, ye as MapboxVectorTileLayer, Po as NativeLinePainter, Aa as NativeLinePlugin, _o as NativePointPainter, Vo as PhongPainter, wa as PhongPlugin, Ye as PointLayer, Je as PolygonLayer, vo as TextPainter, ba as TextPlugin, Ma as TubePlugin, we as Vector3DLayer, he as VectorTileLayer, Jt as VectorTileLayerRenderer, Oa as WaterPlugin, jo as WireframePainter, _a as WireframePlugin };
|
|
11063
11068
|
|
|
11064
|
-
"undefined" != typeof console && console.log("@maptalks/vt v0.92.
|
|
11069
|
+
"undefined" != typeof console && console.log("@maptalks/vt v0.92.2");
|