@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.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
|
*/
|
|
@@ -10533,7 +10533,8 @@
|
|
|
10533
10533
|
});
|
|
10534
10534
|
}
|
|
10535
10535
|
Hi() {
|
|
10536
|
-
if (this.Ri && (this.ir(this.Ri[0], this.wi), this.ir(this.Ri[1], this.Ai)
|
|
10536
|
+
if (this.Ri && (this.ir(this.Ri[0], this.wi), this.ir(this.Ri[1], this.Ai), this.Ri[0] && this.Pi.prepareCollideIndex(this.Ri[0].geometry),
|
|
10537
|
+
this.Ri[1] && this.Pi.prepareCollideIndex(this.Ri[1].geometry)), this.Li) for (let t = 0; t < this.Li.length; t++) this.ir(this.Li[t], this.Mi);
|
|
10537
10538
|
if (this.meshes) for (let t = 0; t < this.meshes.length; t++) this.ir(this.meshes[t], this.xi);
|
|
10538
10539
|
}
|
|
10539
10540
|
ir(t, e) {
|
|
@@ -14078,6 +14079,10 @@
|
|
|
14078
14079
|
paint(t) {
|
|
14079
14080
|
this.isShadowIncludeChanged(t) && (this.shader.dispose(), this.Ys(t)), super.paint(t);
|
|
14080
14081
|
}
|
|
14082
|
+
isEnableStencil(t) {
|
|
14083
|
+
const e = this.layer.getRenderer();
|
|
14084
|
+
return !(!!(t && t.isRenderingTerrain && this.isTerrainSkin()) || !e.isEnableTileStencil || !e.isEnableTileStencil()) && "VectorTileLayer" === this.layer.getJSONType();
|
|
14085
|
+
}
|
|
14081
14086
|
init(t) {
|
|
14082
14087
|
const e = this.regl, i = this.canvas, r = {
|
|
14083
14088
|
x: (t, e) => e.viewport ? e.viewport.x : 0,
|
|
@@ -14086,18 +14091,18 @@
|
|
|
14086
14091
|
height: (t, e) => e.viewport ? e.viewport.height : i ? i.height : 1
|
|
14087
14092
|
};
|
|
14088
14093
|
this.renderer = new n.reshader.Renderer(e);
|
|
14089
|
-
const s =
|
|
14094
|
+
const s = this.layer.getRenderer(), o = {
|
|
14090
14095
|
viewport: r,
|
|
14091
14096
|
stencil: {
|
|
14092
|
-
enable: () =>
|
|
14097
|
+
enable: () => this.isEnableStencil(t),
|
|
14093
14098
|
func: {
|
|
14094
|
-
cmp: () =>
|
|
14095
|
-
ref: (t, e) =>
|
|
14099
|
+
cmp: () => s.isEnableTileStencil && s.isEnableTileStencil() ? "=" : "<=",
|
|
14100
|
+
ref: (t, e) => s.isEnableTileStencil && s.isEnableTileStencil() ? e.stencilRef : e.level
|
|
14096
14101
|
},
|
|
14097
14102
|
op: {
|
|
14098
14103
|
fail: "keep",
|
|
14099
14104
|
zfail: "keep",
|
|
14100
|
-
zpass: () =>
|
|
14105
|
+
zpass: () => s.isEnableTileStencil && s.isEnableTileStencil() ? "zero" : "replace"
|
|
14101
14106
|
}
|
|
14102
14107
|
},
|
|
14103
14108
|
depth: {
|
|
@@ -14122,7 +14127,7 @@
|
|
|
14122
14127
|
offset: this.getPolygonOffset()
|
|
14123
14128
|
}
|
|
14124
14129
|
};
|
|
14125
|
-
if (this.Ys(t,
|
|
14130
|
+
if (this.Ys(t, o), this.pickingFBO) {
|
|
14126
14131
|
const t = [];
|
|
14127
14132
|
this.picking = [ new n.reshader.FBORayPicking(this.renderer, {
|
|
14128
14133
|
vert: Nf,
|
|
@@ -14133,7 +14138,7 @@
|
|
|
14133
14138
|
return n.mat4.multiply(t, i.projViewMatrix, i.modelMatrix), t;
|
|
14134
14139
|
}
|
|
14135
14140
|
} ],
|
|
14136
|
-
extraCommandProps:
|
|
14141
|
+
extraCommandProps: o
|
|
14137
14142
|
}, this.pickingFBO, this.getMap()) ];
|
|
14138
14143
|
}
|
|
14139
14144
|
}
|
|
@@ -15938,7 +15943,7 @@
|
|
|
15938
15943
|
}
|
|
15939
15944
|
}
|
|
15940
15945
|
}
|
|
15941
|
-
|
|
15946
|
+
prepareCollideIndex(t) {
|
|
15942
15947
|
const {collideIds: e, elements: n, aCount: i} = t.properties;
|
|
15943
15948
|
if (!e) return;
|
|
15944
15949
|
const r = e, s = {};
|
|
@@ -16004,10 +16009,10 @@
|
|
|
16004
16009
|
t.positionMatrix = this.getAltitudeOffsetMatrix(), delete t.geometry.properties.iconAtlas;
|
|
16005
16010
|
}), f.push(...t));
|
|
16006
16011
|
}
|
|
16007
|
-
return "line" === a.properties.markerPlacement && this.
|
|
16008
|
-
this.
|
|
16012
|
+
return "line" === a.properties.markerPlacement && this.fa(a, r), "line" === a.properties.markerPlacement && f.forEach(t => t.properties.isLinePlacement = !0),
|
|
16013
|
+
this.prepareCollideIndex(a), f;
|
|
16009
16014
|
}
|
|
16010
|
-
|
|
16015
|
+
fa(t, e) {
|
|
16011
16016
|
const {collideIds: n} = t.properties, i = new Uint16Array(n.length);
|
|
16012
16017
|
if (this.ua(t)) {
|
|
16013
16018
|
let r = 0;
|
|
@@ -16066,31 +16071,31 @@
|
|
|
16066
16071
|
if (!this.isEnableCollision()) return;
|
|
16067
16072
|
super.updateCollision(t);
|
|
16068
16073
|
const e = this.scene.getMeshes();
|
|
16069
|
-
e && e.length ? (this.
|
|
16074
|
+
e && e.length ? (this.da(t.timestamp), this.la = [], this.po()) : this.po();
|
|
16070
16075
|
}
|
|
16071
16076
|
callCurrentTileShader(t, e) {
|
|
16072
16077
|
this.shader.filter = e.sceneFilter ? [ this.ra, e.sceneFilter ] : this.ra, this.callRenderer(this.shader, t, e),
|
|
16073
|
-
this.
|
|
16078
|
+
this.pa.filter = e.sceneFilter ? [ this.oa, e.sceneFilter ] : this.oa, this.callRenderer(this.pa, t, e);
|
|
16074
16079
|
}
|
|
16075
16080
|
callBackgroundTileShader(t, e) {
|
|
16076
16081
|
this.shader.filter = e.sceneFilter ? [ this.sa, e.sceneFilter ] : this.sa, this.callRenderer(this.shader, t, e),
|
|
16077
|
-
this.
|
|
16082
|
+
this.pa.filter = e.sceneFilter ? [ this.aa, e.sceneFilter ] : this.aa, this.callRenderer(this.pa, t, e);
|
|
16078
16083
|
}
|
|
16079
16084
|
isMeshIterable(t) {
|
|
16080
16085
|
return t && t.geometry && !t.geometry.properties.isEmpty && t.material && !t.material.get("isHalo") && this.isMeshVisible(t) && !(this.shouldIgnoreBackground() && !this.layer.getRenderer().isForeground(t));
|
|
16081
16086
|
}
|
|
16082
|
-
|
|
16087
|
+
da() {
|
|
16083
16088
|
if (!this.isEnableCollision()) return;
|
|
16084
16089
|
let t = this.la;
|
|
16085
|
-
t && t.length && this.
|
|
16090
|
+
t && t.length && this.ya(t);
|
|
16086
16091
|
}
|
|
16087
|
-
|
|
16092
|
+
ma(t, e, n, i) {
|
|
16088
16093
|
return this.updateBoxCollisionFading(!0, t, e, n, i);
|
|
16089
16094
|
}
|
|
16090
16095
|
isEnableUniquePlacement() {
|
|
16091
16096
|
return this.isEnableCollision() && !0 === this.sceneConfig.uniquePlacement;
|
|
16092
16097
|
}
|
|
16093
|
-
|
|
16098
|
+
ya(t) {
|
|
16094
16099
|
const e = this.layer.getRenderer();
|
|
16095
16100
|
t = t.sort(_p);
|
|
16096
16101
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -16105,12 +16110,12 @@
|
|
|
16105
16110
|
const s = e.isForeground(i.meshes[0]);
|
|
16106
16111
|
if (this.shouldIgnoreBackground() && !s) continue;
|
|
16107
16112
|
const o = i.properties.meshKey;
|
|
16108
|
-
this.startMeshCollision(i), this.
|
|
16113
|
+
this.startMeshCollision(i), this.ga(i), this.forEachBox(i, this.ma), this.va(i),
|
|
16109
16114
|
this.endMeshCollision(o);
|
|
16110
|
-
for (let t = 0; t < i.meshes.length; t++) this.
|
|
16115
|
+
for (let t = 0; t < i.meshes.length; t++) this.xa(i.meshes[t]);
|
|
16111
16116
|
}
|
|
16112
16117
|
}
|
|
16113
|
-
|
|
16118
|
+
xa(t) {
|
|
16114
16119
|
const e = t && t.geometry && t.geometry.properties.aOpacity;
|
|
16115
16120
|
e && e.dirty && (t.geometry.updateData("aOpacity", e), e.dirty = !1);
|
|
16116
16121
|
}
|
|
@@ -16120,9 +16125,9 @@
|
|
|
16120
16125
|
const i = {
|
|
16121
16126
|
boxIndex: 0
|
|
16122
16127
|
}, r = n.length;
|
|
16123
|
-
for (let s = 0; s < r; s++) this.
|
|
16128
|
+
for (let s = 0; s < r; s++) this.ba(t, n[s], e, i);
|
|
16124
16129
|
}
|
|
16125
|
-
|
|
16130
|
+
ba(t, e, i, r) {
|
|
16126
16131
|
const s = this.getMap(), {collideBoxIndex: o} = t.meshes[0].geometry.properties;
|
|
16127
16132
|
if (!(o && o[e])) return !1;
|
|
16128
16133
|
const a = n.mat4.multiply(vp, s.projViewMatrix, t.meshes[0].localTransform);
|
|
@@ -16151,16 +16156,16 @@
|
|
|
16151
16156
|
l[f].allElements = r, f++;
|
|
16152
16157
|
}
|
|
16153
16158
|
if (!h) return !1;
|
|
16154
|
-
return i.call(this, t, l, a, r.boxIndex++) && this.
|
|
16159
|
+
return i.call(this, t, l, a, r.boxIndex++) && this.wa(t, e), !0;
|
|
16155
16160
|
}
|
|
16156
|
-
|
|
16161
|
+
ga(t) {
|
|
16157
16162
|
const e = t.meshes;
|
|
16158
16163
|
for (let t = 0; t < e.length; t++) {
|
|
16159
16164
|
const n = e[t], i = n && n.geometry;
|
|
16160
16165
|
i && (i.properties.visElemts.count = 0);
|
|
16161
16166
|
}
|
|
16162
16167
|
}
|
|
16163
|
-
|
|
16168
|
+
wa(t, e) {
|
|
16164
16169
|
const n = t.meshes;
|
|
16165
16170
|
for (let t = 0; t < n.length; t++) {
|
|
16166
16171
|
const i = n[t];
|
|
@@ -16175,7 +16180,7 @@
|
|
|
16175
16180
|
a.count = c;
|
|
16176
16181
|
}
|
|
16177
16182
|
}
|
|
16178
|
-
|
|
16183
|
+
va(t) {
|
|
16179
16184
|
const e = t.meshes;
|
|
16180
16185
|
for (let t = 0; t < e.length; t++) {
|
|
16181
16186
|
const n = e[t], i = n && n.geometry;
|
|
@@ -16258,7 +16263,7 @@
|
|
|
16258
16263
|
extraCommandProps: i
|
|
16259
16264
|
}), this.shader.version = 300;
|
|
16260
16265
|
const {uniforms: r, extraCommandProps: s} = Yd.call(this, e, this.sceneConfig), o = this.ha || {};
|
|
16261
|
-
if (this.
|
|
16266
|
+
if (this.pa = new n.reshader.MeshShader({
|
|
16262
16267
|
vert: rp,
|
|
16263
16268
|
frag: sp,
|
|
16264
16269
|
uniforms: r,
|
|
@@ -16390,8 +16395,8 @@
|
|
|
16390
16395
|
}
|
|
16391
16396
|
constructor(t, e, n, i, r, s) {
|
|
16392
16397
|
super(t, e, n, i, r, s), this.propAllowOverlap = "textAllowOverlap", this.propIgnorePlacement = "textIgnorePlacement",
|
|
16393
|
-
this.colorCache = {}, this.
|
|
16394
|
-
this.
|
|
16398
|
+
this.colorCache = {}, this.Aa = Ep.bind(this), this.Ma = Dp.bind(this), this._a = Np.bind(this),
|
|
16399
|
+
this.Sa = Rp.bind(this), this.isLabelCollides = tp.bind(this), this.ka();
|
|
16395
16400
|
}
|
|
16396
16401
|
prepareRender(...t) {
|
|
16397
16402
|
super.prepareRender(...t);
|
|
@@ -16403,34 +16408,34 @@
|
|
|
16403
16408
|
}
|
|
16404
16409
|
}
|
|
16405
16410
|
updateSymbol(...t) {
|
|
16406
|
-
this.
|
|
16411
|
+
this.Pa = void 0, this.Ta = void 0;
|
|
16407
16412
|
const e = super.updateSymbol(...t);
|
|
16408
|
-
return this.
|
|
16413
|
+
return this.ka(), e;
|
|
16409
16414
|
}
|
|
16410
16415
|
isTerrainVector() {
|
|
16411
16416
|
if (!super.isTerrainSkin()) return !1;
|
|
16412
|
-
if (void 0 !== this.
|
|
16417
|
+
if (void 0 !== this.Pa) return this.Pa;
|
|
16413
16418
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
16414
|
-
if ("map" !== this.symbolDef[t].textPitchAlignment) return this.
|
|
16419
|
+
if ("map" !== this.symbolDef[t].textPitchAlignment) return this.Pa = !0, !0;
|
|
16415
16420
|
}
|
|
16416
|
-
return this.
|
|
16421
|
+
return this.Pa = !1, !1;
|
|
16417
16422
|
}
|
|
16418
16423
|
isTerrainSkin() {
|
|
16419
16424
|
if (!super.isTerrainSkin()) return !1;
|
|
16420
|
-
if (void 0 !== this.
|
|
16425
|
+
if (void 0 !== this.Ta) return this.Ta;
|
|
16421
16426
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
16422
16427
|
const e = this.symbolDef[t].textPitchAlignment;
|
|
16423
|
-
if ("map" === e || x(e) || ho.isExpression(e)) return this.
|
|
16428
|
+
if ("map" === e || x(e) || ho.isExpression(e)) return this.Ta = !0, !0;
|
|
16424
16429
|
}
|
|
16425
|
-
return this.
|
|
16430
|
+
return this.Ta = !1, !1;
|
|
16426
16431
|
}
|
|
16427
|
-
|
|
16428
|
-
this.
|
|
16432
|
+
ka() {
|
|
16433
|
+
this.Fa = [];
|
|
16429
16434
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
16430
16435
|
const e = this.symbolDef[t];
|
|
16431
16436
|
if (ho.isExpression(e.textName)) {
|
|
16432
16437
|
const n = ho.createExpression(e.textName, "string");
|
|
16433
|
-
this.
|
|
16438
|
+
this.Fa[t] = (t, e) => {
|
|
16434
16439
|
let i;
|
|
16435
16440
|
ey.zoom = t, ny.properties = e;
|
|
16436
16441
|
try {
|
|
@@ -16440,7 +16445,7 @@
|
|
|
16440
16445
|
}
|
|
16441
16446
|
return i;
|
|
16442
16447
|
};
|
|
16443
|
-
} else x(e.textName) && (this.
|
|
16448
|
+
} else x(e.textName) && (this.Fa[t] = b(e.textName));
|
|
16444
16449
|
}
|
|
16445
16450
|
}
|
|
16446
16451
|
shouldDeleteMeshOnUpdateSymbol(t) {
|
|
@@ -16469,7 +16474,7 @@
|
|
|
16469
16474
|
s.properties.symbolIndex = o;
|
|
16470
16475
|
const a = this.getSymbol(o), l = this.getSymbolDef(o), h = this.getFnTypeConfig(o), u = Wd.call(this, this.regl, s, e, l, a, h, this.layer.options.collision, !i, r);
|
|
16471
16476
|
if (u.length) {
|
|
16472
|
-
"line" === s.properties.textPlacement ? this.
|
|
16477
|
+
"line" === s.properties.textPlacement ? this.Oa = !0 : this.Ia = !0;
|
|
16473
16478
|
}
|
|
16474
16479
|
return u.forEach(t => {
|
|
16475
16480
|
t.positionMatrix = this.getAltitudeOffsetMatrix(), t.properties.tileVectorTransform = n;
|
|
@@ -16478,21 +16483,21 @@
|
|
|
16478
16483
|
updateCollision(t) {
|
|
16479
16484
|
super.updateCollision(t);
|
|
16480
16485
|
const e = this.scene.getMeshes();
|
|
16481
|
-
e && e.length ? (this.
|
|
16486
|
+
e && e.length ? (this.Ca = {}, this.Ea(t.timestamp), this.po()) : this.po();
|
|
16482
16487
|
}
|
|
16483
16488
|
callCurrentTileShader(t, e) {
|
|
16484
|
-
this.shader.filter = e.sceneFilter ? [ this.
|
|
16485
|
-
this.
|
|
16489
|
+
this.shader.filter = e.sceneFilter ? [ this.Aa, e.sceneFilter ] : this.Aa, this.callRenderer(this.shader, t, e),
|
|
16490
|
+
this.Da.filter = e.sceneFilter ? [ this._a, e.sceneFilter ] : this._a, this.callRenderer(this.Da, t, e);
|
|
16486
16491
|
}
|
|
16487
16492
|
callBackgroundTileShader(t, e) {
|
|
16488
|
-
this.shader.filter = e.sceneFilter ? [ this.
|
|
16489
|
-
this.
|
|
16493
|
+
this.shader.filter = e.sceneFilter ? [ this.Ma, e.sceneFilter ] : this.Ma, this.callRenderer(this.shader, t, e),
|
|
16494
|
+
this.Da.filter = e.sceneFilter ? [ this.Sa, e.sceneFilter ] : this.Sa, this.callRenderer(this.Da, t, e);
|
|
16490
16495
|
}
|
|
16491
16496
|
callRenderer(t, e, n) {
|
|
16492
16497
|
n && n.isRenderingTerrain && x(this.symbolDef.textPitchAlignment) && (n.isRenderingTerrainSkin ? e.textPitchFilter = 1 : e.textPitchFilter = 2),
|
|
16493
16498
|
super.callRenderer(t, e, n);
|
|
16494
16499
|
}
|
|
16495
|
-
|
|
16500
|
+
Ea() {
|
|
16496
16501
|
let t = this.scene.getMeshes();
|
|
16497
16502
|
if (!t || !t.length) return;
|
|
16498
16503
|
const e = -this.getMap().getBearing() * Math.PI / 180, i = n.mat2.fromRotation(Up, e), r = (t, e, n, i) => {
|
|
@@ -16517,7 +16522,7 @@
|
|
|
16517
16522
|
const h = n.properties.meshKey;
|
|
16518
16523
|
if ("line" === a.properties.textPlacement) {
|
|
16519
16524
|
if (!a.properties.line) continue;
|
|
16520
|
-
s && this.startMeshCollision(n), this.
|
|
16525
|
+
s && this.startMeshCollision(n), this.Na(n, i);
|
|
16521
16526
|
const {aOffset: t, aOpacity: e} = a.properties;
|
|
16522
16527
|
t.dirty && (a.updateData("aOffset", t), t.dirty = !1), e && e.dirty && (a.updateData("aOpacity", e),
|
|
16523
16528
|
e.dirty = !1), s && this.endMeshCollision(h);
|
|
@@ -16542,7 +16547,7 @@
|
|
|
16542
16547
|
getUniqueEntryKey(t, e) {
|
|
16543
16548
|
return ep(t, e);
|
|
16544
16549
|
}
|
|
16545
|
-
|
|
16550
|
+
Na(t, e) {
|
|
16546
16551
|
const i = this.getMap(), r = t.geometry, s = r.properties;
|
|
16547
16552
|
let o = s.line;
|
|
16548
16553
|
if (!o) return;
|
|
@@ -16550,8 +16555,8 @@
|
|
|
16550
16555
|
if (!c) {
|
|
16551
16556
|
const e = n.mat4.multiply(zp, i.projViewMatrix, t.localTransform), r = o.id + "-" + e.join();
|
|
16552
16557
|
let a;
|
|
16553
|
-
this.
|
|
16554
|
-
o = this.
|
|
16558
|
+
this.Ca[r] ? o = this.Ca[r] : (a = s.projectedLine = s.projectedLine || new Array(o.length),
|
|
16559
|
+
o = this.Ra(a, o, e, i.width, i.height), this.Ca[r] = a);
|
|
16555
16560
|
}
|
|
16556
16561
|
const d = this.isEnableCollision(), p = r.properties.visElemts = r.properties.visElemts || new f.constructor(f.length), y = r.properties.visCache = r.properties.visCache || [];
|
|
16557
16562
|
d && (p.count = 0);
|
|
@@ -16559,7 +16564,7 @@
|
|
|
16559
16564
|
this.forEachBox(t, (t, n, i, r) => {
|
|
16560
16565
|
const {start: s, end: a} = n[0];
|
|
16561
16566
|
let l = y[r];
|
|
16562
|
-
if ((void 0 === l || m) && (l = this.
|
|
16567
|
+
if ((void 0 === l || m) && (l = this.La(t, f, s, a, o, i, c ? e : null, r)), y[r] = l,
|
|
16563
16568
|
d && (l = this.updateBoxCollisionFading(l, t, n, i, r), l)) {
|
|
16564
16569
|
let t = p.count;
|
|
16565
16570
|
for (let e = s; e < a; e++) p[t++] = f[e];
|
|
@@ -16569,7 +16574,7 @@
|
|
|
16569
16574
|
const g = t.geometry.properties.aAltitude;
|
|
16570
16575
|
g && g.dirty && (r.updateData("aAltitude", g), g.dirty = !1), !d || p.count === f.length && r.count === p.count || r.setElements(p, p.count);
|
|
16571
16576
|
}
|
|
16572
|
-
|
|
16577
|
+
Ra(t, e, i, r, s) {
|
|
16573
16578
|
return function(t, e, i, r, s) {
|
|
16574
16579
|
for (let o = 0; o < e.length; o += 3) n.vec4.set(uf, e[o], e[o + 1], e[o + 2], 1),
|
|
16575
16580
|
cf(uf, uf, i, r, s), t[o] = uf[0], t[o + 1] = uf[1], t[o + 2] = e[o + 2];
|
|
@@ -16585,7 +16590,7 @@
|
|
|
16585
16590
|
for (let n = 0; n <= l.length; n += 6) if (d = l[n], h[d] !== y || n === l.length) {
|
|
16586
16591
|
const i = a[y] && a[y].feature;
|
|
16587
16592
|
if (u && this.isMeshUniquePlaced(t) && i && !i.label) {
|
|
16588
|
-
const e = i.properties || {}, {symbolIndex: n} = t.properties, r = n && this.
|
|
16593
|
+
const e = i.properties || {}, {symbolIndex: n} = t.properties, r = n && this.Fa[n.index] ? this.Fa[n.index](t.properties.z, e) : this.getSymbol(t.properties.symbolIndex).textName, s = Io.resolveText(r, e);
|
|
16589
16594
|
i.label = s;
|
|
16590
16595
|
}
|
|
16591
16596
|
const s = n, m = o[l[p]];
|
|
@@ -16594,7 +16599,7 @@
|
|
|
16594
16599
|
y = h[d], p = n;
|
|
16595
16600
|
}
|
|
16596
16601
|
}
|
|
16597
|
-
|
|
16602
|
+
La(t, e, i, r, s, o, a) {
|
|
16598
16603
|
const l = this.layer.getRenderer(), h = t.material.uniforms, u = 1 === h.pitchWithMap, c = !u && l.getTerrainHelper && l.getTerrainHelper(), f = this.isEnableCollision(), d = this.getMap(), p = t.geometry, y = p.desc.positionSize, {aShape: m, aOffset: g, aAnchor: v, aAltitude: x, aPitchRotation: b} = p.properties;
|
|
16599
16604
|
let {aProjectedAnchor: w} = p.properties;
|
|
16600
16605
|
w || (w = p.properties.aProjectedAnchor = new Array(v.length / y * 3));
|
|
@@ -16615,7 +16620,7 @@
|
|
|
16615
16620
|
M && (k = P), w[3 * _] = F[0], w[3 * _ + 1] = F[1], w[3 * _ + 2] = F[2];
|
|
16616
16621
|
const I = M ? 1 : p.properties.tileExtent / this.layer.getTileSize().width;
|
|
16617
16622
|
let C = !0;
|
|
16618
|
-
const E = e[i], D = e[r - 1], N = A ? A[E] : t.properties.textSize, R = this.
|
|
16623
|
+
const E = e[i], D = e[r - 1], N = A ? A[E] : t.properties.textSize, R = this.za(t, N, s, E, D, k, Vp, I, a);
|
|
16619
16624
|
if (null === R) return hy(g, e, i, r), !1;
|
|
16620
16625
|
const L = D - E <= 3, z = Math.floor(R / 2), H = R % 2;
|
|
16621
16626
|
for (let a = i; a < r; a += 6) {
|
|
@@ -16650,7 +16655,7 @@
|
|
|
16650
16655
|
}
|
|
16651
16656
|
return C;
|
|
16652
16657
|
}
|
|
16653
|
-
|
|
16658
|
+
za(t, e, n, i, r, s, o, a, l) {
|
|
16654
16659
|
const h = r - i <= 3, u = this.getMap();
|
|
16655
16660
|
return h ? 0 : Ip.call(this, Qp, ty, t, e, n, i, r, s, o, a, u.width / u.height, l);
|
|
16656
16661
|
}
|
|
@@ -16663,7 +16668,7 @@
|
|
|
16663
16668
|
}) : t.material && delete t.material.uniforms.texture), super.deleteMesh(t, e));
|
|
16664
16669
|
}
|
|
16665
16670
|
delete() {
|
|
16666
|
-
super.delete(), this.
|
|
16671
|
+
super.delete(), this.Da.dispose(), delete this.Ca, this.Ha && this.Ha.dispose();
|
|
16667
16672
|
}
|
|
16668
16673
|
needClearStencil() {
|
|
16669
16674
|
return !0;
|
|
@@ -16685,7 +16690,7 @@
|
|
|
16685
16690
|
});
|
|
16686
16691
|
let o = i;
|
|
16687
16692
|
if (this.layer.getRenderer().isEnableWorkAround("win-intel-gpu-crash") && (o = zl({}, i),
|
|
16688
|
-
o.stencil = zl({}, i.stencil), o.stencil.enable = !0), this.
|
|
16693
|
+
o.stencil = zl({}, i.stencil), o.stencil.enable = !0), this.Da = new n.reshader.MeshShader({
|
|
16689
16694
|
vert: Cp,
|
|
16690
16695
|
frag: sp,
|
|
16691
16696
|
uniforms: e,
|
|
@@ -17042,7 +17047,7 @@
|
|
|
17042
17047
|
Object.defineProperty(l.uniforms, "uvOrigin", {
|
|
17043
17048
|
enumerable: !0,
|
|
17044
17049
|
get: () => {
|
|
17045
|
-
const t = this.
|
|
17050
|
+
const t = this.Ua(w, o, i, y, x, a);
|
|
17046
17051
|
return n.vec2.set(b, t[0] - t[0] % 1, t[1] - t[1] % 1);
|
|
17047
17052
|
}
|
|
17048
17053
|
});
|
|
@@ -17050,7 +17055,7 @@
|
|
|
17050
17055
|
Object.defineProperty(l.uniforms, "uvOffset", {
|
|
17051
17056
|
enumerable: !0,
|
|
17052
17057
|
get: () => {
|
|
17053
|
-
const t = this.
|
|
17058
|
+
const t = this.Ua(w, o, i, y, x, a);
|
|
17054
17059
|
return n.vec2.set(b, t[0] % 1, t[1] % 1);
|
|
17055
17060
|
}
|
|
17056
17061
|
}), Object.defineProperty(l.uniforms, "hasAlpha", {
|
|
@@ -17066,7 +17071,7 @@
|
|
|
17066
17071
|
get: () => g.isForeground(l) ? 0 : A - l.properties.tile.z
|
|
17067
17072
|
}), l.properties.symbolIndex = o, l;
|
|
17068
17073
|
}
|
|
17069
|
-
|
|
17074
|
+
Ua(t, e, i, r, s, o) {
|
|
17070
17075
|
if (1 === this.dataConfig.topUVMode) return gy;
|
|
17071
17076
|
const a = this.getMap(), l = this.getSymbol(e).material;
|
|
17072
17077
|
let h = i;
|
|
@@ -17107,10 +17112,10 @@
|
|
|
17107
17112
|
return o[0] = s * t[0], o[1] = s * t[0], r || (o[0] %= 1, o[1] %= 1), o;
|
|
17108
17113
|
}
|
|
17109
17114
|
needPolygonOffset() {
|
|
17110
|
-
return this.
|
|
17115
|
+
return this.Va;
|
|
17111
17116
|
}
|
|
17112
17117
|
startFrame(...t) {
|
|
17113
|
-
return delete this.
|
|
17118
|
+
return delete this.Va, super.startFrame(...t);
|
|
17114
17119
|
}
|
|
17115
17120
|
addMesh(t, e) {
|
|
17116
17121
|
t.forEach(t => {
|
|
@@ -17123,7 +17128,7 @@
|
|
|
17123
17128
|
0 === e && (e = .01), vy[2] = e, n.mat4.fromScaling(i, vy), n.mat4.multiply(i, t.properties.tileTransform, i),
|
|
17124
17129
|
t.setLocalTransform(i);
|
|
17125
17130
|
} else t.setLocalTransform(t.properties.tileTransform);
|
|
17126
|
-
t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.
|
|
17131
|
+
t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.Va = !0),
|
|
17127
17132
|
this.getSymbol(t.properties.symbolIndex).ssr ? t.ssr = 1 : t.ssr = 0;
|
|
17128
17133
|
}
|
|
17129
17134
|
deleteMaterial() {
|
|
@@ -17223,10 +17228,10 @@
|
|
|
17223
17228
|
return this.shader;
|
|
17224
17229
|
}
|
|
17225
17230
|
delete(t) {
|
|
17226
|
-
this.getMap().off("updatelights", this.
|
|
17231
|
+
this.getMap().off("updatelights", this.ja, this), super.delete(t), this.material.dispose();
|
|
17227
17232
|
}
|
|
17228
17233
|
init() {
|
|
17229
|
-
this.getMap().on("updatelights", this.
|
|
17234
|
+
this.getMap().on("updatelights", this.ja, this);
|
|
17230
17235
|
const t = this.regl;
|
|
17231
17236
|
this.renderer = new n.reshader.Renderer(t);
|
|
17232
17237
|
const e = this.getShaderConfig();
|
|
@@ -17246,7 +17251,7 @@
|
|
|
17246
17251
|
};
|
|
17247
17252
|
this.picking = [ new n.reshader.FBORayPicking(this.renderer, i, this.layer.getRenderer().pickingFBO, this.getMap()) ];
|
|
17248
17253
|
}
|
|
17249
|
-
|
|
17254
|
+
ja() {
|
|
17250
17255
|
this.setToRedraw();
|
|
17251
17256
|
}
|
|
17252
17257
|
getShaderConfig() {
|
|
@@ -17302,7 +17307,7 @@
|
|
|
17302
17307
|
this.material = new n.reshader.PhongMaterial(e);
|
|
17303
17308
|
}
|
|
17304
17309
|
getUniformValues(t, e) {
|
|
17305
|
-
const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.
|
|
17310
|
+
const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.Ba(), o = zl({
|
|
17306
17311
|
viewMatrix: n,
|
|
17307
17312
|
projMatrix: i,
|
|
17308
17313
|
cameraPosition: r,
|
|
@@ -17315,7 +17320,7 @@
|
|
|
17315
17320
|
getPickingVert() {
|
|
17316
17321
|
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 ";
|
|
17317
17322
|
}
|
|
17318
|
-
|
|
17323
|
+
Ba() {
|
|
17319
17324
|
const t = this.getMap().getLightManager(), e = t && t.getAmbientLight() || {}, n = t && t.getDirectionalLight() || {};
|
|
17320
17325
|
return {
|
|
17321
17326
|
ambientColor: e.color || [ .2, .2, .2 ],
|
|
@@ -17411,20 +17416,20 @@
|
|
|
17411
17416
|
const {getPBRUniforms: Ey} = n.reshader.pbr.PBRUtils;
|
|
17412
17417
|
class Dy extends Py {
|
|
17413
17418
|
constructor(...t) {
|
|
17414
|
-
super(...t), this.
|
|
17419
|
+
super(...t), this.Ga = new n.reshader.ResourceLoader, this.scene.sortFunction = this.sortByCommandKey;
|
|
17415
17420
|
}
|
|
17416
17421
|
supportRenderMode(t) {
|
|
17417
17422
|
return this.getSymbols()[0].ssr ? "fxaa" === t || "fxaaAfterTaa" === t : super.supportRenderMode(t);
|
|
17418
17423
|
}
|
|
17419
17424
|
isAnimating() {
|
|
17420
|
-
const t = this
|
|
17425
|
+
const t = this.Wa();
|
|
17421
17426
|
if (t && (t[0] || t[1])) return !0;
|
|
17422
17427
|
}
|
|
17423
17428
|
needToRedraw() {
|
|
17424
|
-
const t = this
|
|
17429
|
+
const t = this.Wa();
|
|
17425
17430
|
return !(!t || !t[0] && !t[1]) || super.needToRedraw();
|
|
17426
17431
|
}
|
|
17427
|
-
|
|
17432
|
+
Wa() {
|
|
17428
17433
|
const t = this.getSymbols()[0];
|
|
17429
17434
|
return t.material && t.material.uvOffsetAnim;
|
|
17430
17435
|
}
|
|
@@ -17447,32 +17452,32 @@
|
|
|
17447
17452
|
paint(t) {
|
|
17448
17453
|
const e = !!t.shadow;
|
|
17449
17454
|
t.states && t.states.includesChanged && (this.shader.dispose(), delete this.shader,
|
|
17450
|
-
this.
|
|
17455
|
+
this.$a.dispose(), delete this.$a, this.Ys(t));
|
|
17451
17456
|
let n = !!t.ssr && this.getSymbols()[0].ssr;
|
|
17452
17457
|
const i = this.shader, r = i.shaderDefines;
|
|
17453
17458
|
if (n) {
|
|
17454
17459
|
const e = zl({}, r, t.ssr.defines);
|
|
17455
17460
|
i.shaderDefines = e;
|
|
17456
17461
|
}
|
|
17457
|
-
if (t.onlyUpdateDepthInTaa && (this.shader = this
|
|
17462
|
+
if (t.onlyUpdateDepthInTaa && (this.shader = this.$a, !n && this.Xa && (this.shader = i,
|
|
17458
17463
|
this.setToRedraw(!0))), this.updateIBLDefines(i), super.paint(t), void 0 !== this.shadowCount && e) {
|
|
17459
17464
|
const t = this.scene.getMeshes().length;
|
|
17460
17465
|
this.shadowCount !== t && this.setToRedraw();
|
|
17461
17466
|
}
|
|
17462
|
-
this.shader = i, n && (i.shaderDefines = r), delete this.shadowCount, this.
|
|
17467
|
+
this.shader = i, n && (i.shaderDefines = r), delete this.shadowCount, this.Xa = n;
|
|
17463
17468
|
}
|
|
17464
17469
|
updateSceneConfig(t) {
|
|
17465
17470
|
zl(this.sceneConfig, t), this.setToRedraw();
|
|
17466
17471
|
}
|
|
17467
17472
|
delete() {
|
|
17468
|
-
super.delete(), this.disposeIBLTextures(), this.material.dispose(), this
|
|
17469
|
-
delete this
|
|
17473
|
+
super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.$a && (this.$a.dispose(),
|
|
17474
|
+
delete this.$a);
|
|
17470
17475
|
}
|
|
17471
17476
|
init(t) {
|
|
17472
|
-
this.getMap().on("updatelights", this.
|
|
17477
|
+
this.getMap().on("updatelights", this.Ya, this), this.createIBLTextures(), this.Zs = this.Zs || t;
|
|
17473
17478
|
const e = this.regl;
|
|
17474
|
-
this.renderer = new n.reshader.Renderer(e), this.
|
|
17475
|
-
this.
|
|
17479
|
+
this.renderer = new n.reshader.Renderer(e), this.qa = this.Ja.bind(this), this.Ka = this.disposeCachedTexture.bind(this),
|
|
17480
|
+
this.Za = this.Qa.bind(this), this.Wr(), this.Ys(t);
|
|
17476
17481
|
const i = {
|
|
17477
17482
|
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 ",
|
|
17478
17483
|
uniforms: [ {
|
|
@@ -17534,17 +17539,17 @@
|
|
|
17534
17539
|
}
|
|
17535
17540
|
}, o = {
|
|
17536
17541
|
uniforms: r,
|
|
17537
|
-
defines: this.
|
|
17542
|
+
defines: this.el(i),
|
|
17538
17543
|
extraCommandProps: s
|
|
17539
17544
|
};
|
|
17540
17545
|
this.shader = new n.reshader.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 ",
|
|
17541
|
-
this
|
|
17546
|
+
this.$a = new n.reshader.pbr.StandardShader(o);
|
|
17542
17547
|
}
|
|
17543
|
-
|
|
17548
|
+
Ja({resources: t}) {
|
|
17544
17549
|
for (let e = 0; e < t.length; e++) this.addCachedTexture(t[e].url, t[e].data);
|
|
17545
17550
|
this.setToRedraw(!0);
|
|
17546
17551
|
}
|
|
17547
|
-
|
|
17552
|
+
Qa() {
|
|
17548
17553
|
this.setToRedraw(!0);
|
|
17549
17554
|
}
|
|
17550
17555
|
Wr(t) {
|
|
@@ -17571,14 +17576,14 @@
|
|
|
17571
17576
|
url: a,
|
|
17572
17577
|
wrap: "repeat"
|
|
17573
17578
|
}), o.flipY = !e.upsideUpTexture, o.min = "linear mipmap linear", o.mag = "linear",
|
|
17574
|
-
r[t] = new n.reshader.Texture2D(o, this.
|
|
17579
|
+
r[t] = new n.reshader.Texture2D(o, this.Ga), r[t].once("complete", this.qa), r[t].once("disposed", this.Ka),
|
|
17575
17580
|
r[t].promise && this.addCachedTexture(a, r[t].promise), s = !0;
|
|
17576
17581
|
} else r[t] = i[t];
|
|
17577
17582
|
if (void 0 === r.alphaTest && this.getMaterialClazz && (r.alphaTest = .05), this.material) {
|
|
17578
17583
|
for (let t in r) this.material.set(t, r[t]);
|
|
17579
17584
|
this.setToRedraw(!0);
|
|
17580
|
-
} else this.material = new n.reshader.pbr.StandardMaterial(r), this.material.once("complete", this.
|
|
17581
|
-
s || this.
|
|
17585
|
+
} else this.material = new n.reshader.pbr.StandardMaterial(r), this.material.once("complete", this.Za);
|
|
17586
|
+
s || this.Qa();
|
|
17582
17587
|
}
|
|
17583
17588
|
getShader() {
|
|
17584
17589
|
return this.shader;
|
|
@@ -17587,13 +17592,13 @@
|
|
|
17587
17592
|
const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = Ey(t, n, i, e && e.ssr, e && e.jitter);
|
|
17588
17593
|
return this.setIncludeUniformValues(r, e), r;
|
|
17589
17594
|
}
|
|
17590
|
-
|
|
17595
|
+
el(t) {
|
|
17591
17596
|
return this.hasIBL() ? t.HAS_IBL_LIGHTING = 1 : delete t.HAS_IBL_LIGHTING, t;
|
|
17592
17597
|
}
|
|
17593
|
-
|
|
17598
|
+
Ya() {
|
|
17594
17599
|
if (!this.shader) return;
|
|
17595
17600
|
const t = this.shader.shaderDefines;
|
|
17596
|
-
this.
|
|
17601
|
+
this.el(t), this.shader.shaderDefines = t;
|
|
17597
17602
|
}
|
|
17598
17603
|
}
|
|
17599
17604
|
var Ny = "#include <gl2_vert>\n#define EXTRUDE_SCALE 63.0\n#define EXTRUDE_MOD 64.0\n#define MAX_LINE_DISTANCE 65535.0\nuniform mat4 projViewModelMatrix;\nuniform vec2 centiMeterToLocal;\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec4 aTubeNormal;\n#ifdef HAS_LINE_WIDTH\nattribute float aLineWidth;\n#else\nuniform float lineWidth;\n#endif\n#include <vt_position_vert>\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#else\nuniform mat4 modelViewMatrix;\nuniform mat3 modelNormalMatrix;\nuniform mat4 modelMatrix;\n#if defined(HAS_PATTERN)\nuniform float resolution;\nuniform float tileResolution;\nuniform float tileRatio;\nattribute float aLinesofar;\nvarying highp float vLinesofar;\nattribute vec4 aTexInfo;\nvarying vec4 vTexInfo;\nvarying float vNormalY;\nvarying float vPatternHeight;\nattribute float aNormalDistance;\n#if defined(HAS_PATTERN_ANIM)\nattribute float aLinePatternAnimSpeed;\nvarying float vLinePatternAnimSpeed;\n#endif\n#if defined(HAS_PATTERN_GAP)\nattribute float aLinePatternGap;\nvarying float vLinePatternGap;\n#endif\n#endif\n#ifdef HAS_COLOR\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\n#ifdef HAS_OPACITY\nattribute float aOpacity;\n#endif\nvarying float vOpacity;\nvarying vec3 vModelNormal;\nvarying vec4 vViewVertex;\nvarying vec3 vModelVertex;\n#endif\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\n#include <vsm_shadow_vert>\n#endif\n#include <highlight_vert>\nvoid main() {\n \n#ifdef HAS_LINE_WIDTH\nfloat c = aLineWidth;\n#else\nfloat c = lineWidth;\n#endif\nfloat d = c / 2.;\n vec3 e = aTubeNormal.xyz / EXTRUDE_SCALE;\n vec3 f = unpackVTPosition();\n vec4 h = vec4(f, 1.);\n h.xy += e.xy * d * centiMeterToLocal;\n h.z += e.z * d;\n gl_Position = projViewModelMatrix * h;\n#ifdef PICKING_MODE\nfbo_picking_setData(gl_Position.w, true);\n#else\nvViewVertex = modelViewMatrix * h;\n vec3 i = normalize(e);\n vModelNormal = modelNormalMatrix * i;\n vModelVertex = (modelMatrix * h).xyz;\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\nshadow_computeShadowPars(h);\n#endif\n#ifdef HAS_COLOR\nvColor = aColor / 255.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_PATTERN\nfloat j = tileResolution / resolution;\n float k = aLinesofar - d * centiMeterToLocal.y * aNormalDistance / EXTRUDE_SCALE;\n vLinesofar = k / tileRatio * j;\n vTexInfo = vec4(aTexInfo.xy, aTexInfo.zw + 1.);\n vPatternHeight = c * centiMeterToLocal.x / tileRatio * j;\n vNormalY = aTubeNormal.w / EXTRUDE_SCALE;\n#if defined(HAS_PATTERN_ANIM)\nvLinePatternAnimSpeed = aLinePatternAnimSpeed / 127.;\n#endif\n#if defined(HAS_PATTERN_GAP)\nvLinePatternGap = aLinePatternGap / 10.0;\n#endif\n#endif\nhighlight_setVarying();\n#endif\n}";
|
|
@@ -17664,7 +17669,7 @@
|
|
|
17664
17669
|
super.paint(t);
|
|
17665
17670
|
}
|
|
17666
17671
|
init(t) {
|
|
17667
|
-
this.getMap().on("updatelights", this.
|
|
17672
|
+
this.getMap().on("updatelights", this.Ya, this), this.createIBLTextures();
|
|
17668
17673
|
const e = this.regl;
|
|
17669
17674
|
if (this.renderer = new n.reshader.Renderer(e), this.createShader(t), this.pickingFBO) {
|
|
17670
17675
|
const t = [];
|
|
@@ -17699,7 +17704,7 @@
|
|
|
17699
17704
|
}), this.shader = new n.reshader.pbr.StandardShader({
|
|
17700
17705
|
vert: Ny,
|
|
17701
17706
|
uniforms: e,
|
|
17702
|
-
defines: this.
|
|
17707
|
+
defines: this.el(i),
|
|
17703
17708
|
extraCommandProps: this.getExtraCommandProps()
|
|
17704
17709
|
});
|
|
17705
17710
|
}
|
|
@@ -17814,13 +17819,13 @@
|
|
|
17814
17819
|
}
|
|
17815
17820
|
} ];
|
|
17816
17821
|
}
|
|
17817
|
-
|
|
17822
|
+
el(t) {
|
|
17818
17823
|
return this.hasIBL() ? t.HAS_IBL_LIGHTING = 1 : delete t.HAS_IBL_LIGHTING, t;
|
|
17819
17824
|
}
|
|
17820
|
-
|
|
17825
|
+
Ya() {
|
|
17821
17826
|
if (!this.shader) return;
|
|
17822
17827
|
const t = this.shader.shaderDefines;
|
|
17823
|
-
this.
|
|
17828
|
+
this.el(t), this.shader.shaderDefines = t;
|
|
17824
17829
|
}
|
|
17825
17830
|
delete() {
|
|
17826
17831
|
super.delete(), this.disposeIBLTextures(), this.shader && (this.shader.dispose(),
|
|
@@ -17829,13 +17834,13 @@
|
|
|
17829
17834
|
}
|
|
17830
17835
|
const zy = [], Hy = [], Uy = [], Vy = [], jy = [], By = [ 0, 0, 0 ], Gy = [ 0, 0, 0 ], Wy = [ 1, 1, 1 ], $y = [], Xy = [ 1, 1, 1, 1 ], Yy = [], qy = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Jy = t => class extends t {
|
|
17831
17836
|
constructor(t, e, i, r, s, o) {
|
|
17832
|
-
super(t, e, i, r, s, o), this.
|
|
17833
|
-
this.
|
|
17837
|
+
super(t, e, i, r, s, o), this.nl = !1, this.scene.sortFunction = this.sortByCommandKey,
|
|
17838
|
+
this.il = new n.reshader.GLTFManager(t), this.rl(), this.sl();
|
|
17834
17839
|
}
|
|
17835
17840
|
isAnimating() {
|
|
17836
17841
|
const t = this.getSymbols();
|
|
17837
17842
|
for (let e = 0; e < t.length; e++) {
|
|
17838
|
-
if (t[e] && this.
|
|
17843
|
+
if (t[e] && this.ol[e] && this.al(e)) return !0;
|
|
17839
17844
|
}
|
|
17840
17845
|
return !1;
|
|
17841
17846
|
}
|
|
@@ -17855,7 +17860,7 @@
|
|
|
17855
17860
|
return $y;
|
|
17856
17861
|
}
|
|
17857
17862
|
createMesh(t, e, {tileTranslationMatrix: i, tileExtent: r}, {timestamp: s}) {
|
|
17858
|
-
if (!this.
|
|
17863
|
+
if (!this.nl) return null;
|
|
17859
17864
|
const o = this.getMap(), {geometry: a} = t, {positionSize: l, features: h} = a, {aPosition: u, aPickingId: c, aXYRotation: f, aZRotation: d, aAltitude: p} = a.data, y = u.length / l;
|
|
17860
17865
|
if (0 === y) return null;
|
|
17861
17866
|
const m = {
|
|
@@ -17863,7 +17868,7 @@
|
|
|
17863
17868
|
instance_vectorB: new Float32Array(4 * y),
|
|
17864
17869
|
instance_vectorC: new Float32Array(4 * y),
|
|
17865
17870
|
aPickingId: []
|
|
17866
|
-
}, g = this.
|
|
17871
|
+
}, g = this.ll(m, i, r, a.properties.z, u, p, f, d, l, c, h);
|
|
17867
17872
|
a.data.aTerrainAltitude && (m.aTerrainAltitude = a.data.aTerrainAltitude);
|
|
17868
17873
|
const v = {};
|
|
17869
17874
|
for (const t in m) v[t] = {
|
|
@@ -17873,22 +17878,22 @@
|
|
|
17873
17878
|
}),
|
|
17874
17879
|
divisor: 1
|
|
17875
17880
|
};
|
|
17876
|
-
const x = this.
|
|
17881
|
+
const x = this.hl(), b = this.ul(), w = n.mat4.identity([]);
|
|
17877
17882
|
n.mat4.scale(w, w, [ b, b, b ]);
|
|
17878
17883
|
const A = [], M = this.getSymbols();
|
|
17879
17884
|
for (let t = 0; t < M.length; t++) {
|
|
17880
|
-
const e = M[t], r = this.
|
|
17885
|
+
const e = M[t], r = this.cl[t];
|
|
17881
17886
|
if (!r) continue;
|
|
17882
|
-
const l = this.
|
|
17887
|
+
const l = this.ol[t][0], {fixSizeOnZoom: h} = e;
|
|
17883
17888
|
let u = n.mat4.identity([]);
|
|
17884
|
-
x || (u = this.
|
|
17889
|
+
x || (u = this.fl(u));
|
|
17885
17890
|
let c = 0;
|
|
17886
17891
|
r.forEach(t => {
|
|
17887
17892
|
const {geometry: i, nodeMatrix: r} = t;
|
|
17888
17893
|
n.mat4.multiply(Yy, qy, r), n.mat4.multiply(Yy, u, Yy);
|
|
17889
17894
|
const s = n.mat4.multiply(Yy, w, Yy), o = i.boundingBox.copy();
|
|
17890
17895
|
o.transform(s);
|
|
17891
|
-
const a = this.
|
|
17896
|
+
const a = this.dl(o, e);
|
|
17892
17897
|
Math.abs(a) > Math.abs(c) && (c = a);
|
|
17893
17898
|
});
|
|
17894
17899
|
const f = [ 0, 0, c ], d = r.map((r, d) => {
|
|
@@ -17899,17 +17904,17 @@
|
|
|
17899
17904
|
picking: !0
|
|
17900
17905
|
});
|
|
17901
17906
|
if (l.hasSkinAnimation()) {
|
|
17902
|
-
const e = this.
|
|
17907
|
+
const e = this.pl(k, t, 0)[M];
|
|
17903
17908
|
k.setUniform("jointTexture", e.jointTexture), k.setUniform("jointTextureSize", e.jointTextureSize),
|
|
17904
|
-
k.setUniform("numJoints", e.numJoints), k.setUniform("skinAnimation", +this.
|
|
17909
|
+
k.setUniform("numJoints", e.numJoints), k.setUniform("skinAnimation", +this.al(t)),
|
|
17905
17910
|
k.properties.startTime = s, S.HAS_SKIN = 1;
|
|
17906
17911
|
}
|
|
17907
17912
|
b && (k.setUniform("morphWeights", b), S.HAS_MORPH = 1), k.setUniform("hasAlpha", A.alphaMode && "BLEND" === A.alphaMode.toUpperCase()),
|
|
17908
17913
|
Bl(k.uniforms, "polygonFill", e, "markerFill", Xy, $l(this.colorCache)), Bl(k.uniforms, "polygonOpacity", e, "markerOpacity", 1);
|
|
17909
17914
|
const P = [];
|
|
17910
17915
|
k.setPositionMatrix(() => {
|
|
17911
|
-
const e = this.
|
|
17912
|
-
n.mat4.multiply(P, qy, e), this.
|
|
17916
|
+
const e = this.yl(t, d, M);
|
|
17917
|
+
n.mat4.multiply(P, qy, e), this.fl(u), n.mat4.multiply(P, u, P), n.mat4.multiply(P, w, P);
|
|
17913
17918
|
const i = n.mat4.identity(Yy);
|
|
17914
17919
|
if (0 !== c && (n.mat4.fromTranslation(i, f), n.mat4.multiply(P, i, P)), ql(h)) {
|
|
17915
17920
|
const t = o.getGLScale() / o.getGLScale(h);
|
|
@@ -17939,19 +17944,19 @@
|
|
|
17939
17944
|
positionSize: l
|
|
17940
17945
|
}, A;
|
|
17941
17946
|
}
|
|
17942
|
-
ml(t, e, n) {
|
|
17943
|
-
const i = t, r = this.fl[i][e];
|
|
17944
|
-
return this.ll(t) && this.vl && this.vl[n] || r.nodeMatrix;
|
|
17945
|
-
}
|
|
17946
17947
|
yl(t, e, n) {
|
|
17947
|
-
|
|
17948
|
-
|
|
17949
|
-
|
|
17950
|
-
|
|
17951
|
-
|
|
17952
|
-
this.
|
|
17953
|
-
|
|
17954
|
-
|
|
17948
|
+
const i = t, r = this.cl[i][e];
|
|
17949
|
+
return this.al(t) && this.ml && this.ml[n] || r.nodeMatrix;
|
|
17950
|
+
}
|
|
17951
|
+
pl(t, e, n) {
|
|
17952
|
+
if (!this.ol) return;
|
|
17953
|
+
const i = this.ol[e][0];
|
|
17954
|
+
this.vl || (this.vl = {}), this.ml = {}, this.vl[t.uuid] || (this.vl[t.uuid] = {});
|
|
17955
|
+
const r = this.getSymbols()[e], s = this.xl[e], {loop: o, speed: a, animationName: l} = r, h = l || s.animations[0].name;
|
|
17956
|
+
return i.updateAnimation(n, o || !1, a || 1, h, t.properties.startTime || 0, this.ml, this.vl[t.uuid]),
|
|
17957
|
+
this.vl[t.uuid];
|
|
17958
|
+
}
|
|
17959
|
+
dl(t, e) {
|
|
17955
17960
|
const n = e.anchorZ || "center";
|
|
17956
17961
|
let i = 0;
|
|
17957
17962
|
const r = t.max[2] - t.min[2];
|
|
@@ -17964,8 +17969,8 @@
|
|
|
17964
17969
|
for (let e = 0; e < t.length; e++) {
|
|
17965
17970
|
if (!t[e] || !t[e].geometry) continue;
|
|
17966
17971
|
t[e].instancedData.aTerrainAltitude && this.gs(t[e], t[e].instancedData, t[e].properties, 3, n);
|
|
17967
|
-
const r = t[e].properties.symbolIndex.index, s = this.
|
|
17968
|
-
s && this.
|
|
17972
|
+
const r = t[e].properties.symbolIndex.index, s = this.al(r);
|
|
17973
|
+
s && this.pl(t[e], r, i), t[e].setUniform("skinAnimation", +s);
|
|
17969
17974
|
}
|
|
17970
17975
|
return this.scene.addMesh(t), this;
|
|
17971
17976
|
}
|
|
@@ -17976,8 +17981,8 @@
|
|
|
17976
17981
|
const e = this.getSymbols();
|
|
17977
17982
|
let n = !1;
|
|
17978
17983
|
for (let t = 0; t < e.length; t++) {
|
|
17979
|
-
if (!e[t] || !this.
|
|
17980
|
-
if (this.
|
|
17984
|
+
if (!e[t] || !this.ol[t]) continue;
|
|
17985
|
+
if (this.al(t) && this.ol[t] && !n) {
|
|
17981
17986
|
n = !0;
|
|
17982
17987
|
break;
|
|
17983
17988
|
}
|
|
@@ -17989,11 +17994,11 @@
|
|
|
17989
17994
|
this.shadowCount = this.scene.getMeshes().length;
|
|
17990
17995
|
return this.scene.getMeshes().filter(t => 0 === t.properties.level);
|
|
17991
17996
|
}
|
|
17992
|
-
|
|
17997
|
+
al(t) {
|
|
17993
17998
|
const e = this.getSymbols()[t];
|
|
17994
|
-
return !!(e && e.animation && this.
|
|
17999
|
+
return !!(e && e.animation && this.ol[t] && this.ol[t][0] && this.ol[t][0].hasSkinAnimation());
|
|
17995
18000
|
}
|
|
17996
|
-
|
|
18001
|
+
ll(t, e, i, r, s, o, a, l, h, u, c) {
|
|
17997
18002
|
function f(e, n, i, r) {
|
|
17998
18003
|
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];
|
|
17999
18004
|
}
|
|
@@ -18006,7 +18011,7 @@
|
|
|
18006
18011
|
e[0] < g && (g = e[0]), e[0] > b && (b = e[0]), e[1] < v && (v = e[1]), e[1] > w && (w = e[1]),
|
|
18007
18012
|
e[2] < x && (x = e[2]), e[2] > A && (A = e[2]);
|
|
18008
18013
|
}
|
|
18009
|
-
const S = (g + b) / 2, k = (v + w) / 2, P = (x + A) / 2, T = [], F = this.
|
|
18014
|
+
const S = (g + b) / 2, k = (v + w) / 2, P = (x + A) / 2, T = [], F = this.hl(), O = [ 0, 0, 1 ];
|
|
18010
18015
|
for (let e = 0; e < d; e++) {
|
|
18011
18016
|
o ? n.vec3.set(_, s[e * h], s[e * h + 1], o[e]) : fl.unpackPosition(_, s[e * h], s[e * h + 1], s[e * h + 2]);
|
|
18012
18017
|
const i = _[0], r = _[1], d = n.vec3.set(M, i * p - S, -r * p - k, (_[2] + m) * y - P), g = a && a[e] || 0, v = l && l[e] || 0;
|
|
@@ -18018,7 +18023,7 @@
|
|
|
18018
18023
|
n.mat4.multiply(T, s, T);
|
|
18019
18024
|
} else n.mat4.fromTranslation(T, d);
|
|
18020
18025
|
if (F) {
|
|
18021
|
-
const t = this.
|
|
18026
|
+
const t = this.fl(Yy, c, u, e);
|
|
18022
18027
|
n.mat4.multiply(T, T, t);
|
|
18023
18028
|
}
|
|
18024
18029
|
f("instance_vectorA", e, T, 0), f("instance_vectorB", e, T, 1), f("instance_vectorC", e, T, 2),
|
|
@@ -18026,30 +18031,30 @@
|
|
|
18026
18031
|
}
|
|
18027
18032
|
return n.vec3.set(M, S, k, P), M;
|
|
18028
18033
|
}
|
|
18029
|
-
|
|
18030
|
-
if (!this.
|
|
18034
|
+
ul() {
|
|
18035
|
+
if (!this.wl) {
|
|
18031
18036
|
const t = this.getMap();
|
|
18032
|
-
this.
|
|
18037
|
+
this.wl = 100 * R(t.getGLRes(), t);
|
|
18033
18038
|
}
|
|
18034
|
-
return this.
|
|
18039
|
+
return this.wl;
|
|
18035
18040
|
}
|
|
18036
|
-
|
|
18037
|
-
const s = this.getMap(), o = this.symbolDef[0], a = this.
|
|
18041
|
+
fl(t, e, i, r) {
|
|
18042
|
+
const s = this.getMap(), o = this.symbolDef[0], a = this.ul();
|
|
18038
18043
|
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, y = o.scaleY || 1, m = o.scaleZ || 1;
|
|
18039
|
-
const g = i && i[r], v = e && e[g], x = s.getZoom(), b = v && v.feature && v.feature.properties, w = this.
|
|
18040
|
-
this.
|
|
18044
|
+
const g = i && i[r], v = e && e[g], x = s.getZoom(), b = v && v.feature && v.feature.properties, w = this.Al(x, b);
|
|
18045
|
+
this.Ml && (l = this.Ml(x, b)), this._l && (h = this._l(x, b)), this.Sl && (u = this.Sl(x, b));
|
|
18041
18046
|
const A = n.vec3.set(Hy, l * a, h * a, u * a);
|
|
18042
|
-
this.
|
|
18047
|
+
this.kl && (c = this.kl(x, b)), this.Pl && (f = this.Pl(x, b)), this.Tl && (d = this.Tl(x, b));
|
|
18043
18048
|
const M = n.vec3.set(Uy, c, f, d);
|
|
18044
|
-
this.
|
|
18049
|
+
this.Fl && (p = this.Fl(x, b)), this.Ol && (y = this.Ol(x, b)), this.Il && (m = this.Il(x, b));
|
|
18045
18050
|
const _ = n.vec3.set(Vy, p * w, y * w, m * w);
|
|
18046
|
-
return this.
|
|
18051
|
+
return this.Cl(t, A, M, _);
|
|
18047
18052
|
}
|
|
18048
|
-
|
|
18053
|
+
Al(t, e) {
|
|
18049
18054
|
const n = this.symbolDef[0];
|
|
18050
|
-
let i = this.
|
|
18055
|
+
let i = this.El ? this.El(t, e) : n.modelHeight;
|
|
18051
18056
|
if (C(i)) return 1;
|
|
18052
|
-
const r = this.
|
|
18057
|
+
const r = this.Dl[0];
|
|
18053
18058
|
return i / Math.abs(r.max[1] - r.min[1]);
|
|
18054
18059
|
}
|
|
18055
18060
|
getShaderConfig() {
|
|
@@ -18057,40 +18062,40 @@
|
|
|
18057
18062
|
return t.positionAttribute = "POSITION", t.normalAttribute = "NORMAL", t;
|
|
18058
18063
|
}
|
|
18059
18064
|
init(t) {
|
|
18060
|
-
super.init(t), this.
|
|
18065
|
+
super.init(t), this.sl();
|
|
18061
18066
|
}
|
|
18062
|
-
|
|
18067
|
+
rl() {
|
|
18063
18068
|
const t = this.symbolDef[0];
|
|
18064
|
-
x(t.modelHeight) && (this.
|
|
18065
|
-
x(t.translationY) && (this.
|
|
18066
|
-
x(t.rotationX) && (this.
|
|
18067
|
-
x(t.rotationZ) && (this.
|
|
18068
|
-
x(t.scaleY) && (this.
|
|
18069
|
+
x(t.modelHeight) && (this.El = b(t.modelHeight)), x(t.translationX) && (this.Ml = b(t.translationX)),
|
|
18070
|
+
x(t.translationY) && (this._l = b(t.translationY)), x(t.translationZ) && (this.Sl = b(t.translationZ)),
|
|
18071
|
+
x(t.rotationX) && (this.kl = b(t.rotationX)), x(t.rotationY) && (this.Pl = b(t.rotationY)),
|
|
18072
|
+
x(t.rotationZ) && (this.Tl = b(t.rotationZ)), x(t.scaleX) && (this.Fl = b(t.scaleX)),
|
|
18073
|
+
x(t.scaleY) && (this.Ol = b(t.scaleY)), x(t.scaleZ) && (this.Il = b(t.scaleZ));
|
|
18069
18074
|
}
|
|
18070
|
-
|
|
18071
|
-
return !!(this.
|
|
18075
|
+
hl() {
|
|
18076
|
+
return !!(this.El && !this.El.isFeatureConstant || this.Ml && !this.Ml.isFeatureConstant || this._l && !this._l.isFeatureConstant || this.Sl && !this.Sl.isFeatureConstant || this.kl && !this.kl.isFeatureConstant || this.Pl && !this.Pl.isFeatureConstant || this.Tl && !this.Tl.isFeatureConstant || this.Fl && !this.Fl.isFeatureConstant || this.Ol && !this.Ol.isFeatureConstant || this.Il && !this.Il.isFeatureConstant);
|
|
18072
18077
|
}
|
|
18073
|
-
|
|
18074
|
-
if (this.
|
|
18075
|
-
this.
|
|
18078
|
+
sl() {
|
|
18079
|
+
if (this.ol) return;
|
|
18080
|
+
this.ol = [], this.xl = [], this.Dl = [], this.cl = [];
|
|
18076
18081
|
const t = this.getSymbols();
|
|
18077
|
-
this.
|
|
18082
|
+
this.Nl = 0;
|
|
18078
18083
|
for (let e = 0; e < t.length; e++) {
|
|
18079
18084
|
const n = t[e].url || "pyramid";
|
|
18080
|
-
this.
|
|
18081
|
-
const i = this.
|
|
18085
|
+
this.il.loginGLTF(n);
|
|
18086
|
+
const i = this.il.getGLTF(n);
|
|
18082
18087
|
if (i.then) i.then(n => {
|
|
18083
|
-
if (!n.gltfPack) return this.
|
|
18088
|
+
if (!n.gltfPack) return this.Nl++, void (this.Nl >= t.length && (this.nl = !0, this.setToRedraw(!0)));
|
|
18084
18089
|
const {gltfPack: i, json: r, bbox: s} = n;
|
|
18085
|
-
this.
|
|
18086
|
-
this.
|
|
18090
|
+
this.ol[e] = [ i ], this.cl[e] = i.getMeshesInfo(), this.xl[e] = r, this.Dl[e] = s,
|
|
18091
|
+
this.Nl++, this.Nl >= t.length && (this.nl = !0), this.setToRedraw(!0);
|
|
18087
18092
|
}); else {
|
|
18088
18093
|
const {gltfPack: t, json: n, bbox: r} = i;
|
|
18089
|
-
t && (this.
|
|
18090
|
-
this.
|
|
18094
|
+
t && (this.ol[e] = [ t ], this.cl[e] = t.getMeshesInfo(), this.xl[e] = n, this.Dl[e] = r,
|
|
18095
|
+
this.Nl++);
|
|
18091
18096
|
}
|
|
18092
18097
|
}
|
|
18093
|
-
this.
|
|
18098
|
+
this.Nl >= t.length && (this.nl = !0);
|
|
18094
18099
|
}
|
|
18095
18100
|
getPickingVert() {
|
|
18096
18101
|
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 }";
|
|
@@ -18099,10 +18104,10 @@
|
|
|
18099
18104
|
if (t) {
|
|
18100
18105
|
this.scene.removeMesh(t);
|
|
18101
18106
|
for (let e = 0; e < t.length; e++) {
|
|
18102
|
-
const n = this.
|
|
18107
|
+
const n = this.vl && this.vl[t[e].uuid];
|
|
18103
18108
|
if (n) {
|
|
18104
18109
|
for (const t in n) n[t].jointTexture && n[t].jointTexture.destroy();
|
|
18105
|
-
delete this.
|
|
18110
|
+
delete this.vl[t[e].uuid];
|
|
18106
18111
|
}
|
|
18107
18112
|
t[e].disposeInstanceData(), t[e].dispose();
|
|
18108
18113
|
}
|
|
@@ -18113,18 +18118,18 @@
|
|
|
18113
18118
|
const t = this.getSymbols();
|
|
18114
18119
|
for (let e = 0; e < t.length; e++) {
|
|
18115
18120
|
const n = t[e].url || "pyramid";
|
|
18116
|
-
this.
|
|
18121
|
+
this.il.logoutGLTF(n);
|
|
18117
18122
|
}
|
|
18118
|
-
if (this.
|
|
18119
|
-
for (const t in this.
|
|
18120
|
-
const e = this.
|
|
18123
|
+
if (this.vl) {
|
|
18124
|
+
for (const t in this.vl) {
|
|
18125
|
+
const e = this.vl[t];
|
|
18121
18126
|
for (const t in e) e[t].jointTexture && e[t].jointTexture.destroy();
|
|
18122
18127
|
}
|
|
18123
|
-
delete this.
|
|
18128
|
+
delete this.vl;
|
|
18124
18129
|
}
|
|
18125
|
-
delete this.
|
|
18130
|
+
delete this.ml;
|
|
18126
18131
|
}
|
|
18127
|
-
|
|
18132
|
+
Cl(t, e, i, r) {
|
|
18128
18133
|
const s = n.vec3.set(zy, ...e || By), o = i || Gy, a = r || Wy, l = n.quat.fromEuler(jy, o[0], o[1], o[2]);
|
|
18129
18134
|
return n.mat4.fromRotationTranslationScale(t, l, s, a);
|
|
18130
18135
|
}
|
|
@@ -18173,8 +18178,8 @@
|
|
|
18173
18178
|
}
|
|
18174
18179
|
callShader(t, e) {
|
|
18175
18180
|
super.callShader(t, e), this.transformWater();
|
|
18176
|
-
const n = this.
|
|
18177
|
-
this.xs += this.renderer.render(this.
|
|
18181
|
+
const n = this.Rl(this.getMap(), e);
|
|
18182
|
+
this.xs += this.renderer.render(this.Ll, n, this.zl, this.getRenderFBO(e));
|
|
18178
18183
|
}
|
|
18179
18184
|
addMesh(t, e) {
|
|
18180
18185
|
this.Ks(t, e), super.addMesh(...arguments);
|
|
@@ -18184,14 +18189,14 @@
|
|
|
18184
18189
|
for (let n = 0; n < t.length; n++) t[n].ssr = e ? 1 : 0;
|
|
18185
18190
|
}
|
|
18186
18191
|
paint(t) {
|
|
18187
|
-
t.states && t.states.includesChanged && (this.shader.dispose(), this.
|
|
18192
|
+
t.states && t.states.includesChanged && (this.shader.dispose(), this.Ll.dispose(),
|
|
18188
18193
|
this.Ys(t));
|
|
18189
|
-
const e = !!t.ssr && this.getSymbol(em).ssr, n = this.
|
|
18194
|
+
const e = !!t.ssr && this.getSymbol(em).ssr, n = this.Ll, i = n.shaderDefines;
|
|
18190
18195
|
if (e) {
|
|
18191
18196
|
const e = zl({}, i, t.ssr.defines);
|
|
18192
18197
|
n.shaderDefines = e;
|
|
18193
18198
|
}
|
|
18194
|
-
this.updateIBLDefines(n), this.
|
|
18199
|
+
this.updateIBLDefines(n), this.Hl.ssr = e ? 1 : 0, super.paint(t), e && (n.shaderDefines = i);
|
|
18195
18200
|
}
|
|
18196
18201
|
init(t) {
|
|
18197
18202
|
this.createIBLTextures();
|
|
@@ -18209,38 +18214,38 @@
|
|
|
18209
18214
|
extraCommandProps: {
|
|
18210
18215
|
viewport: this.pickingViewport
|
|
18211
18216
|
}
|
|
18212
|
-
}, this.pickingFBO, this.getMap()) ]), this.
|
|
18217
|
+
}, this.pickingFBO, this.getMap()) ]), this.Ul();
|
|
18213
18218
|
}
|
|
18214
|
-
|
|
18219
|
+
Ul() {
|
|
18215
18220
|
const t = this.regl;
|
|
18216
|
-
this.
|
|
18221
|
+
this.Vl || (this.Vl = t.texture(2));
|
|
18217
18222
|
const e = this.getSymbol({
|
|
18218
18223
|
index: 0
|
|
18219
18224
|
}), n = e.texWaveNormal, i = this.getCachedTexture(n), r = this;
|
|
18220
|
-
if (i) this.
|
|
18221
|
-
this.shader && this.
|
|
18222
|
-
}, 20) : this.
|
|
18225
|
+
if (i) this.jl || (i.isLoading ? setTimeout(() => {
|
|
18226
|
+
this.shader && this.Ul();
|
|
18227
|
+
}, 20) : this.jl = this.Bl(t, i)); else {
|
|
18223
18228
|
const e = new Image;
|
|
18224
18229
|
e.isLoading = !0, e.onload = function() {
|
|
18225
|
-
delete this.isLoading, r.
|
|
18230
|
+
delete this.isLoading, r.jl = r.Bl(t, this), r.setToRedraw();
|
|
18226
18231
|
}, e.onerror = () => {
|
|
18227
18232
|
console.error("invalid water wave normal texture:" + n);
|
|
18228
18233
|
}, this.addCachedTexture(n, e), e.src = n;
|
|
18229
18234
|
}
|
|
18230
18235
|
const s = e.texWavePerturbation, o = this.getCachedTexture(s);
|
|
18231
|
-
if (o) this.
|
|
18232
|
-
this.
|
|
18233
|
-
}, 20) : this.
|
|
18236
|
+
if (o) this.Gl || (o.isLoading ? setTimeout(() => {
|
|
18237
|
+
this.Ul(), this.shader;
|
|
18238
|
+
}, 20) : this.Gl = this.Bl(t, o)); else {
|
|
18234
18239
|
const e = new Image;
|
|
18235
18240
|
e.isLoading = !0, e.onload = function() {
|
|
18236
|
-
delete this.isLoading, r.
|
|
18241
|
+
delete this.isLoading, r.Gl = r.Bl(t, this), r.setToRedraw();
|
|
18237
18242
|
}, e.onerror = () => {
|
|
18238
18243
|
console.error("invalid water wave perturbation texture:" + s);
|
|
18239
18244
|
}, this.addCachedTexture(s, e), e.src = s;
|
|
18240
18245
|
}
|
|
18241
18246
|
}
|
|
18242
|
-
|
|
18243
|
-
return this.
|
|
18247
|
+
Bl(t, e) {
|
|
18248
|
+
return this.Vl ? t.texture({
|
|
18244
18249
|
width: e.width,
|
|
18245
18250
|
height: e.height,
|
|
18246
18251
|
mag: "linear",
|
|
@@ -18346,7 +18351,7 @@
|
|
|
18346
18351
|
enable: !1
|
|
18347
18352
|
}
|
|
18348
18353
|
};
|
|
18349
|
-
r.push(...n.reshader.SsrPass.getUniformDeclares()), this.
|
|
18354
|
+
r.push(...n.reshader.SsrPass.getUniformDeclares()), this.Ll = new n.reshader.MeshShader({
|
|
18350
18355
|
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}",
|
|
18351
18356
|
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}",
|
|
18352
18357
|
defines: s,
|
|
@@ -18362,10 +18367,10 @@
|
|
|
18362
18367
|
projViewMatrix: t.projViewMatrix
|
|
18363
18368
|
};
|
|
18364
18369
|
}
|
|
18365
|
-
|
|
18370
|
+
Rl(t, e) {
|
|
18366
18371
|
const {iblTexes: i, dfgLUT: r} = this.getIBLRes(), s = Qy(t, i, r, e && e.ssr, e && e.jitter), o = t.getLightManager();
|
|
18367
18372
|
let a = o && o.getDirectionalLight() || {};
|
|
18368
|
-
const l = o && o.getAmbientLight() || {}, h = this.getSymbol(em), u = this
|
|
18373
|
+
const l = o && o.getAmbientLight() || {}, h = this.getSymbol(em), u = this.Wl = this.Wl || [], c = this.$l = this.$l || [];
|
|
18369
18374
|
n.vec4.set(c, .09, h.uvScale || 3, .03, -.5);
|
|
18370
18375
|
zl(s, {
|
|
18371
18376
|
ambientColor: l.color || [ .2, .2, .2 ],
|
|
@@ -18374,8 +18379,8 @@
|
|
|
18374
18379
|
lightColor: a.color || tm.color,
|
|
18375
18380
|
camPos: t.cameraPosition,
|
|
18376
18381
|
timeElapsed: h.animation ? (this.layer.getRenderer().getFrameTimestamp() || 0) / (1 / (h.waterSpeed || 1) * 1e4) : 0,
|
|
18377
|
-
normalTexture: this.
|
|
18378
|
-
heightTexture: this.
|
|
18382
|
+
normalTexture: this.jl || this.Vl,
|
|
18383
|
+
heightTexture: this.Gl || this.Vl,
|
|
18379
18384
|
waveParams: c,
|
|
18380
18385
|
waterDir: sm(u, h.waterDirection || 0),
|
|
18381
18386
|
waterBaseColor: h.waterBaseColor || [ .1451, .2588, .4863, 1 ],
|
|
@@ -18387,24 +18392,24 @@
|
|
|
18387
18392
|
s;
|
|
18388
18393
|
}
|
|
18389
18394
|
delete() {
|
|
18390
|
-
super.delete(), this.
|
|
18391
|
-
this.
|
|
18392
|
-
this.
|
|
18393
|
-
this.
|
|
18395
|
+
super.delete(), this.Vl && (this.Vl.destroy(), delete this.Vl), this.jl && this.jl.destroy(),
|
|
18396
|
+
this.Gl && this.Gl.destroy(), this.shader && (this.shader.dispose(), delete this.shader),
|
|
18397
|
+
this.Ll && this.Ll.dispose(), this.Hl && (this.Hl.geometry.dispose(), this.Hl.material && this.Hl.material.dispose(),
|
|
18398
|
+
this.Hl.dispose(), delete this.Hl), this.disposeIBLTextures();
|
|
18394
18399
|
}
|
|
18395
18400
|
createGround() {
|
|
18396
18401
|
const t = new n.reshader.Plane;
|
|
18397
18402
|
t.data.aTexCoord = new Uint8Array([ 0, 1, 1, 1, 0, 0, 1, 0 ]), t.generateBuffers(this.renderer.regl),
|
|
18398
|
-
this.
|
|
18403
|
+
this.Hl = new n.reshader.Mesh(t, null, {
|
|
18399
18404
|
castShadow: !1
|
|
18400
|
-
}), this.
|
|
18405
|
+
}), this.zl = new n.reshader.Scene([ this.Hl ]);
|
|
18401
18406
|
}
|
|
18402
18407
|
transformWater() {
|
|
18403
|
-
const t = this.getMap(), e = n.GroundPainter.getGroundTransform(this.
|
|
18404
|
-
this.
|
|
18408
|
+
const t = this.getMap(), e = n.GroundPainter.getGroundTransform(this.Hl.localTransform, t);
|
|
18409
|
+
this.Hl.setLocalTransform(e);
|
|
18405
18410
|
const i = t._get2DExtentAtRes(t.getGLRes()), r = i.getWidth(), s = i.getHeight(), o = t.cameraLookAt, a = o[0] - r, l = o[1] + s, h = a / im[0], u = l / im[1], c = h % 1, f = u % 1, d = .3737 * h % 1, p = .3737 * u % 1, y = r / im[0] * 2, m = s / im[1] * 2;
|
|
18406
|
-
this.
|
|
18407
|
-
this.
|
|
18411
|
+
this.Hl.setUniform("uvOffset", [ c, f ]), this.Hl.setUniform("noiseUvOffset", [ d, p ]),
|
|
18412
|
+
this.Hl.setUniform("uvScale", [ y, -m ]);
|
|
18408
18413
|
}
|
|
18409
18414
|
}
|
|
18410
18415
|
function sm(t, e) {
|
|
@@ -18474,7 +18479,7 @@
|
|
|
18474
18479
|
}
|
|
18475
18480
|
callRenderer(t, e, n) {
|
|
18476
18481
|
const i = this.getRenderFBO(n);
|
|
18477
|
-
this.xs += this.
|
|
18482
|
+
this.xs += this.Xl.render(this.scene, e, i);
|
|
18478
18483
|
}
|
|
18479
18484
|
getUniformValues(t) {
|
|
18480
18485
|
const e = this.getSymbol({
|
|
@@ -18491,13 +18496,13 @@
|
|
|
18491
18496
|
return this.scene.getMeshes();
|
|
18492
18497
|
}
|
|
18493
18498
|
delete() {
|
|
18494
|
-
super.delete(...arguments), this.
|
|
18499
|
+
super.delete(...arguments), this.Xl.dispose(), delete this.Xl;
|
|
18495
18500
|
}
|
|
18496
18501
|
init() {
|
|
18497
18502
|
const t = this.regl;
|
|
18498
18503
|
this.renderer = new n.reshader.Renderer(t);
|
|
18499
18504
|
const e = this.getPolygonOffset(), i = this.getSymbols()[0];
|
|
18500
|
-
this.
|
|
18505
|
+
this.Xl = new n.HeatmapProcess(this.regl, this.sceneConfig, this.layer, i.heatmapColor, null, e);
|
|
18501
18506
|
}
|
|
18502
18507
|
});
|
|
18503
18508
|
vm.registerAt(_h);
|
|
@@ -18505,7 +18510,7 @@
|
|
|
18505
18510
|
xm.registerAt(_h), Lh.registerPainter("lit", Dy), Lh.registerPainter("icon", Mp),
|
|
18506
18511
|
Lh.registerPainter("fill", Xf), Lh.registerPainter("line", Kf), Lh.registerPainter("line-gradient", Zf),
|
|
18507
18512
|
Lh.registerPainter("water", rm), Lh.registerPainter("tube", Ly), n.reshader.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"),
|
|
18508
|
-
_h.VERSION = "0.92.
|
|
18513
|
+
_h.VERSION = "0.92.2", Lh.VERSION = "0.92.2";
|
|
18509
18514
|
if (s.mat4.create(), s.transcoders) {
|
|
18510
18515
|
const t = r.Map.VERSION;
|
|
18511
18516
|
if (t.indexOf("1.0.0-beta") >= 0 || t.indexOf("1.0.0-alpha") >= 0) {
|
|
@@ -18526,5 +18531,5 @@
|
|
|
18526
18531
|
t.VectorTileLayer = _h, t.VectorTileLayerRenderer = ah, t.WaterPlugin = xm, t.WireframePainter = Cy,
|
|
18527
18532
|
t.WireframePlugin = dm, Object.defineProperty(t, "t", {
|
|
18528
18533
|
value: !0
|
|
18529
|
-
}), "undefined" != typeof console && console.log("@maptalks/vt v0.92.
|
|
18534
|
+
}), "undefined" != typeof console && console.log("@maptalks/vt v0.92.2");
|
|
18530
18535
|
}));
|