@maptalks/vt 0.92.2 → 0.92.3
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 +570 -559
- package/dist/maptalks.vt.js +802 -792
- package/package.json +4 -4
package/dist/maptalks.vt.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/vt v0.92.
|
|
2
|
+
* @maptalks/vt v0.92.3
|
|
3
3
|
* LICENSE : undefined
|
|
4
4
|
* (c) 2016-2024 maptalks.org
|
|
5
5
|
*/
|
|
@@ -2276,13 +2276,14 @@ he.prototype._getTileZoom = function(e) {
|
|
|
2276
2276
|
schema: !1,
|
|
2277
2277
|
cascadeTiles: !0,
|
|
2278
2278
|
collision: !0,
|
|
2279
|
+
collisionBuffserSize: 0,
|
|
2279
2280
|
picking: !0,
|
|
2280
2281
|
pickingPoint: !0,
|
|
2281
2282
|
pickingGeometry: !1,
|
|
2282
2283
|
glyphSdfLimitPerFrame: 15,
|
|
2283
2284
|
tileLimitPerFrame: 1,
|
|
2284
|
-
loadingLimitOnInteracting:
|
|
2285
|
-
loadingLimit:
|
|
2285
|
+
loadingLimitOnInteracting: 5,
|
|
2286
|
+
loadingLimit: 0,
|
|
2286
2287
|
antialias: !1,
|
|
2287
2288
|
iconErrorUrl: null,
|
|
2288
2289
|
collisionFrameLimit: 1.5,
|
|
@@ -2549,6 +2550,7 @@ we.mergeOptions({
|
|
|
2549
2550
|
pickingPoint: !0,
|
|
2550
2551
|
renderer: "gl",
|
|
2551
2552
|
collision: !1,
|
|
2553
|
+
collisionBufferSize: 0,
|
|
2552
2554
|
textGamma: 1,
|
|
2553
2555
|
geometryEvents: !0,
|
|
2554
2556
|
styleScale: 1,
|
|
@@ -7286,59 +7288,64 @@ class br extends Bi {
|
|
|
7286
7288
|
isCollides(t) {
|
|
7287
7289
|
const e = this.layer, n = e.getMap(), i = n.getDevicePixelRatio();
|
|
7288
7290
|
if (a.scale(xr, t, 1 / i), n.isOffscreen(xr)) return -1;
|
|
7289
|
-
|
|
7291
|
+
const r = e.getCollisionIndex(), s = this.sceneConfig.collisionBufferSize || e.options.collisionBufferSize || 0;
|
|
7292
|
+
return s && (t = _r(xr, t, s)), +r.collides(t);
|
|
7290
7293
|
}
|
|
7291
7294
|
insertCollisionBox(t) {
|
|
7292
|
-
this.layer.getCollisionIndex().
|
|
7295
|
+
const e = this.layer, n = e.getCollisionIndex(), i = this.sceneConfig.collisionBufferSize || e.options.collisionBufferSize || 0;
|
|
7296
|
+
let r = t;
|
|
7297
|
+
i && (r = t.as = t.as || [], t = _r(r, t, i)), n.insertBox(r);
|
|
7293
7298
|
}
|
|
7294
7299
|
addCollisionDebugBox(t, e) {
|
|
7295
7300
|
if (t && t.length) if (Array.isArray(t[0])) for (let n = 0; n < t.length; n++) {
|
|
7296
7301
|
const i = t[n];
|
|
7297
|
-
this.
|
|
7298
|
-
} else this.
|
|
7302
|
+
this.ls(i, e);
|
|
7303
|
+
} else this.ls(t, e);
|
|
7299
7304
|
}
|
|
7300
|
-
|
|
7305
|
+
ls(t, e) {
|
|
7301
7306
|
if (!t) return;
|
|
7302
|
-
const n = this.
|
|
7307
|
+
const n = this.hs = this.hs || {
|
|
7303
7308
|
aPosition: [],
|
|
7304
7309
|
aVisible: [],
|
|
7305
7310
|
indices: []
|
|
7306
|
-
}, i = this.
|
|
7307
|
-
|
|
7308
|
-
const
|
|
7311
|
+
}, i = this.sceneConfig.collisionBufferSize || this.layer.options.collisionBufferSize || 0;
|
|
7312
|
+
i && (t = _r(xr, t, i));
|
|
7313
|
+
const r = this.getMap(), s = r.getDevicePixelRatio();
|
|
7314
|
+
if (a.scale(xr, t, 1 / s), r.isOffscreen(xr)) return;
|
|
7315
|
+
const o = n.aPosition.length / 2;
|
|
7309
7316
|
n.aPosition.push(t[0], t[1], t[2], t[1], t[2], t[3], t[0], t[3]), n.aVisible.push(e, e, e, e),
|
|
7310
|
-
n.indices.push(
|
|
7317
|
+
n.indices.push(o, o + 1, o + 1, o + 2, o + 2, o + 3, o + 3, o);
|
|
7311
7318
|
}
|
|
7312
7319
|
updateCollision(t) {
|
|
7313
|
-
super.updateCollision(t), this.Nr(), this.
|
|
7314
|
-
this.
|
|
7315
|
-
(this.getMap().isZooming() || this.
|
|
7320
|
+
super.updateCollision(t), this.Nr(), this.us(), this.cs && this.cs.length && (this.fs(),
|
|
7321
|
+
this.cs && (this.setToRedraw(), this.scene.addMesh(this.cs)));
|
|
7322
|
+
(this.getMap().isZooming() || this.cs && this.cs.length) && (this.ds(), this.ps(this.scene.getMeshes()));
|
|
7316
7323
|
}
|
|
7317
7324
|
paint(t) {
|
|
7318
7325
|
const e = super.paint(t);
|
|
7319
|
-
return this.
|
|
7326
|
+
return this.ms(t), !1 === this.Tr && this.setToRedraw(), e;
|
|
7320
7327
|
}
|
|
7321
7328
|
shouldIgnoreBackground() {
|
|
7322
|
-
return !this.getMap().isZooming() && !this.
|
|
7329
|
+
return !this.getMap().isZooming() && !this.cs;
|
|
7323
7330
|
}
|
|
7324
|
-
|
|
7331
|
+
us() {
|
|
7325
7332
|
const t = this.getMap(), e = t.isZooming();
|
|
7326
7333
|
if (!e && this.Br) {
|
|
7327
7334
|
const t = this.layer.getRenderer();
|
|
7328
|
-
this.
|
|
7329
|
-
} else e && !this.Br && (this.
|
|
7330
|
-
if (e) this.
|
|
7335
|
+
this.cs = this.scene.getMeshes().filter(e => !t.isForeground(e) && !e.properties.isLinePlacement);
|
|
7336
|
+
} else e && !this.Br && (this.ys = t.getResolution());
|
|
7337
|
+
if (e) this.gs && (clearTimeout(this.gs), delete this.Xr, delete this.gs), this.Xr = this.ys && t.getResolution() > this.ys; else if (this.Br && !this.gs) {
|
|
7331
7338
|
let {fadeOutDelay: t, fadingDuration: e} = this.sceneConfig;
|
|
7332
|
-
It(t) && (t = pr), It(e) && (e = fr), this.
|
|
7333
|
-
delete this.Xr, delete this.
|
|
7339
|
+
It(t) && (t = pr), It(e) && (e = fr), this.gs = setTimeout(() => {
|
|
7340
|
+
delete this.Xr, delete this.gs;
|
|
7334
7341
|
}, t + e + 1);
|
|
7335
7342
|
}
|
|
7336
7343
|
this.Br = e;
|
|
7337
7344
|
}
|
|
7338
|
-
|
|
7339
|
-
if (!this.
|
|
7340
|
-
this.os || this.
|
|
7341
|
-
const {aPosition: e, aVisible: i, indices: r} = this.
|
|
7345
|
+
ms(t) {
|
|
7346
|
+
if (!this.hs || !this.layer.options.debugCollision) return;
|
|
7347
|
+
this.os || this.vs();
|
|
7348
|
+
const {aPosition: e, aVisible: i, indices: r} = this.hs;
|
|
7342
7349
|
if (!this.rs) {
|
|
7343
7350
|
const t = new n.Geometry({
|
|
7344
7351
|
aPosition: [],
|
|
@@ -7347,15 +7354,15 @@ class br extends Bi {
|
|
|
7347
7354
|
positionSize: 2,
|
|
7348
7355
|
primitive: "lines"
|
|
7349
7356
|
});
|
|
7350
|
-
this.rs = new n.Mesh(t), this.
|
|
7357
|
+
this.rs = new n.Mesh(t), this.xs = new n.Scene, this.xs.addMesh(this.rs);
|
|
7351
7358
|
}
|
|
7352
7359
|
const s = this.rs.geometry;
|
|
7353
7360
|
s.updateData("aPosition", new Float32Array(e)), s.updateData("aVisible", new Uint8Array(i)),
|
|
7354
7361
|
s.setElements(r), this.os.render(this.ss, {
|
|
7355
7362
|
size: [ this.canvas.width, this.canvas.height ]
|
|
7356
|
-
}, this.
|
|
7363
|
+
}, this.xs, this.getRenderFBO(t)), delete this.hs;
|
|
7357
7364
|
}
|
|
7358
|
-
|
|
7365
|
+
vs() {
|
|
7359
7366
|
const t = this.regl;
|
|
7360
7367
|
this.os = new n.Renderer(t);
|
|
7361
7368
|
const e = this.canvas, i = {
|
|
@@ -7384,17 +7391,17 @@ class br extends Bi {
|
|
|
7384
7391
|
}
|
|
7385
7392
|
});
|
|
7386
7393
|
}
|
|
7387
|
-
|
|
7394
|
+
fs() {
|
|
7388
7395
|
let {fadeOutDelay: t, fadingDuration: e} = this.sceneConfig;
|
|
7389
7396
|
It(t) && (t = pr), It(e) && (e = fr);
|
|
7390
7397
|
const n = this.layer.getRenderer(), i = n.getCurrentTileZoom(), r = n.getFrameTimestamp(), s = [];
|
|
7391
|
-
for (let o = 0; o < this.
|
|
7392
|
-
const a = this.
|
|
7398
|
+
for (let o = 0; o < this.cs.length; o++) {
|
|
7399
|
+
const a = this.cs[o], l = a.properties.tile;
|
|
7393
7400
|
!a.Yr && n.isBackTile(l.id) && (a.Yr = r);
|
|
7394
7401
|
const h = l.z - i > 0 ? 2 * (l.z - i) - 1 : 2 * (i - l.z);
|
|
7395
7402
|
a.properties.level = h, n.isForeground(a) || a.Yr && r - a.Yr > t + e ? delete a.Yr : s.push(a);
|
|
7396
7403
|
}
|
|
7397
|
-
delete this.
|
|
7404
|
+
delete this.cs, s.length && (this.cs = s);
|
|
7398
7405
|
}
|
|
7399
7406
|
isEnableCollision() {
|
|
7400
7407
|
return this.layer.options.collision && !!this.sceneConfig.collision;
|
|
@@ -7405,7 +7412,7 @@ class br extends Bi {
|
|
|
7405
7412
|
isMeshUniquePlaced(t) {
|
|
7406
7413
|
return this.isMeshIterable(t);
|
|
7407
7414
|
}
|
|
7408
|
-
|
|
7415
|
+
ds() {
|
|
7409
7416
|
if (!this.isEnableUniquePlacement()) return;
|
|
7410
7417
|
const t = this.scene.getMeshes(), e = (t, e, n, i) => {
|
|
7411
7418
|
const {start: r, end: s} = e[0], o = t.geometry.properties, a = o.elements;
|
|
@@ -7425,29 +7432,29 @@ class br extends Bi {
|
|
|
7425
7432
|
this.isMeshUniquePlaced(i) && this.forEachBox(i, e);
|
|
7426
7433
|
}
|
|
7427
7434
|
}
|
|
7428
|
-
|
|
7435
|
+
ps(t) {
|
|
7429
7436
|
if (!this.isEnableUniquePlacement()) return;
|
|
7430
7437
|
const e = this.getMap().getZoom();
|
|
7431
|
-
let n = !this.
|
|
7432
|
-
if (!n) for (let e = 0; e < t.length; e++) if (!this.
|
|
7438
|
+
let n = !this.bs || this.As !== e;
|
|
7439
|
+
if (!n) for (let e = 0; e < t.length; e++) if (!this.bs[t[e].properties.meshKey]) {
|
|
7433
7440
|
n = !0;
|
|
7434
7441
|
break;
|
|
7435
7442
|
}
|
|
7436
7443
|
if (!n) return;
|
|
7437
|
-
this.
|
|
7444
|
+
this.As = e, this.ws = {}, this.bs = {}, t = t.sort(wr);
|
|
7438
7445
|
const i = this.getMap().getGLScale(), r = {};
|
|
7439
7446
|
for (let e = 0; e < t.length; e++) {
|
|
7440
7447
|
const n = t[e];
|
|
7441
7448
|
if (!n.geometry) continue;
|
|
7442
7449
|
const {meshKey: s} = n.properties;
|
|
7443
|
-
this.
|
|
7450
|
+
this.bs[s] = 1;
|
|
7444
7451
|
const {uniquePlacements: o} = n.geometry.properties;
|
|
7445
7452
|
if (o) for (let t = 0; t < o.length; t++) {
|
|
7446
7453
|
if (!o[t]) continue;
|
|
7447
7454
|
const {key: e, index: s} = o[t], a = this.Wr(n), l = Ar(e, i), h = r[l];
|
|
7448
7455
|
if (h) {
|
|
7449
7456
|
const t = h.length, e = h[t - 3].properties.meshKey, i = h[t - 2], r = h[t - 1];
|
|
7450
|
-
this.
|
|
7457
|
+
this.ws[e] = this.ws[e] || {}, this.ws[e][r] = 1, this._s(a, s, i, r), h.push(n, a, s);
|
|
7451
7458
|
} else r[l] = [ n, a, s ];
|
|
7452
7459
|
}
|
|
7453
7460
|
}
|
|
@@ -7460,16 +7467,16 @@ class br extends Bi {
|
|
|
7460
7467
|
}
|
|
7461
7468
|
}
|
|
7462
7469
|
}
|
|
7463
|
-
|
|
7470
|
+
_s(t, e, n, i) {
|
|
7464
7471
|
if (void 0 !== n[i]) if (void 0 === t[e]) t[e] = n[i]; else {
|
|
7465
7472
|
let r = t[e];
|
|
7466
7473
|
Math.abs(n[i]) > Math.abs(r) ? t[e] = n[i] : n[i] = t[e];
|
|
7467
7474
|
} else void 0 !== t[e] && (n[i] = t[e]);
|
|
7468
7475
|
}
|
|
7469
7476
|
jr(t, e) {
|
|
7470
|
-
return this.
|
|
7477
|
+
return this.ws && this.ws[t] && this.ws[t][e];
|
|
7471
7478
|
}
|
|
7472
|
-
|
|
7479
|
+
Ss(t, e) {
|
|
7473
7480
|
const {symbolIndex: n} = t.properties, i = n.type || 0;
|
|
7474
7481
|
let r = t.properties._collidesBoxes;
|
|
7475
7482
|
r || (r = t.properties._collidesBoxes = []);
|
|
@@ -7487,15 +7494,15 @@ class br extends Bi {
|
|
|
7487
7494
|
}
|
|
7488
7495
|
return s[o];
|
|
7489
7496
|
}
|
|
7490
|
-
|
|
7491
|
-
let e = this.
|
|
7492
|
-
if (e || (e = this.
|
|
7497
|
+
Ms(t) {
|
|
7498
|
+
let e = this.Ps;
|
|
7499
|
+
if (e || (e = this.Ps = []), !e[t]) {
|
|
7493
7500
|
e[t] = [];
|
|
7494
7501
|
for (let n = 0; n < t; n++) e[t][n] = {};
|
|
7495
7502
|
}
|
|
7496
7503
|
return e[t];
|
|
7497
7504
|
}
|
|
7498
|
-
|
|
7505
|
+
Ts(t) {
|
|
7499
7506
|
if (!t || !t.geometry) return !0;
|
|
7500
7507
|
if (!t.geometry.properties.glyphAtlas || !t.material.get("isHalo") || t.geometry.data.aTextHaloRadius && t.geometry.properties.hasHalo) return !1;
|
|
7501
7508
|
if (t.geometry.data.aTextHaloRadius && !t.geometry.properties.hasHalo) return !0;
|
|
@@ -7512,109 +7519,113 @@ function wr(t, e) {
|
|
|
7512
7519
|
return 0 === n ? t.properties.meshKey - e.properties.meshKey : n;
|
|
7513
7520
|
}
|
|
7514
7521
|
|
|
7515
|
-
|
|
7522
|
+
function _r(t, e, n) {
|
|
7523
|
+
return t[0] = e[0] - n, t[1] = e[1] - n, t[2] = e[2] + n, t[3] = e[3] + n, t;
|
|
7524
|
+
}
|
|
7525
|
+
|
|
7526
|
+
var Sr = "#include <gl2_vert>\n#define SHADER_NAME MARKER\n#define RAD 0.0174532925\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aShape;\nattribute vec2 aTexCoord;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_MARKER_WIDTH\nattribute float aMarkerWidth;\n#else\nuniform float markerWidth;\n#endif\n#ifdef HAS_MARKER_HEIGHT\nattribute float aMarkerHeight;\n#else\nuniform float markerHeight;\n#endif\n#ifdef HAS_MARKER_DX\nattribute float aMarkerDx;\n#else\nuniform float markerDx;\n#endif\n#ifdef HAS_MARKER_DY\nattribute float aMarkerDy;\n#else\nuniform float markerDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float rotateWithMap;\n#endif\nuniform float flipY;\n#ifdef HAS_ROTATION\nattribute float aRotation;\n#else\nuniform float markerRotation;\n#endif\n#ifdef HAS_PAD_OFFSET\nattribute float aPadOffsetX;\nattribute float aPadOffsetY;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float markerPerspectiveRatio;\nuniform vec2 iconSize;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\n#include <vt_position_vert>\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vOpacity;\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_MARKER_WIDTH\nfloat d = aMarkerWidth;\n#else\nfloat d = markerWidth;\n#endif\n#ifdef HAS_MARKER_HEIGHT\nfloat e = aMarkerHeight;\n#else\nfloat e = markerHeight;\n#endif\n#ifdef HAS_MARKER_DX\nfloat f = aMarkerDx;\n#else\nfloat f = markerDx;\n#endif\n#ifdef HAS_MARKER_DY\nfloat h = aMarkerDy;\n#else\nfloat h = markerDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nfloat i = aPitchAlign;\n#else\nfloat i = pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat j = aRotationAlign;\n#else\nfloat j = rotateWithMap;\n#endif\ngl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n float k = gl_Position.w;\n float l;\n if(isRenderingTerrain == 1. && i == 1.) {\n l = 1.;\n } else {\n float m = (1. - cameraToCenterDistance / k) * markerPerspectiveRatio;\n l = clamp(.5 + .5 * (1. - m), .0, 4.);\n }\n#ifdef HAS_ROTATION\nfloat n = -aRotation / 9362. - mapRotation * j;\n#else\nfloat n = -markerRotation - mapRotation * j;\n#endif\nif(i == 1.) {\n n += mapRotation;\n }\n float o = sin(n);\n float u = cos(n);\n mat2 v = mat2(u, -1. * o, o, u);\n vec2 A = (aShape / 10.0);\n if(i == 1. && flipY == .0) {\n A *= vec2(1., -1.);\n }\n#ifdef HAS_PAD_OFFSET\nA = (A / iconSize * vec2(d, e) + vec2(aPadOffsetX - 1., aPadOffsetY)) * layerScale;\n#else\nA = A / iconSize * vec2(d, e) * layerScale;\n#endif\nA = v * A;\n if(i == .0) {\n vec2 B = A * 2. / canvasSize;\n gl_Position.xy += B * l * k;\n } else {\n float C;\n if(isRenderingTerrain == 1.) {\n C = 1.;\n } else {\n C = k / cameraToCenterDistance;\n }\n vec2 B = A;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c + vec3(B, .0) * tileRatio / zoomScale * C * l, 1.);\n }\n gl_Position.xy += vec2(f, -h) * 2. / canvasSize * k;\n#ifndef PICKING_MODE\nvTexCoord = aTexCoord / texSize;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool D = aOpacity == 255.;\n#else\nbool D = true;\n#endif\nfbo_picking_setData(gl_Position.w, D);\n#endif\n}";
|
|
7516
7527
|
|
|
7517
|
-
const
|
|
7528
|
+
const Mr = [], Pr = [], Tr = [], kr = [], Or = [], Ir = [];
|
|
7518
7529
|
|
|
7519
|
-
function
|
|
7530
|
+
function Fr(t, e, n, r, s, o, l, u, c, f, d, p, m, y) {
|
|
7520
7531
|
const {tileRatio: g, tileResolution: v} = c, x = g / (v / f.getResolution()) * (d / f.cameraToCenterDistance) * p;
|
|
7521
|
-
h.scale(n, n, x), h.scale(r, r, x), h.scale(s, s, x), h.scale(o, o, x), i.set(
|
|
7522
|
-
i.set(
|
|
7523
|
-
i.set(
|
|
7524
|
-
i.add(
|
|
7525
|
-
bi(s,
|
|
7526
|
-
h.set(
|
|
7532
|
+
h.scale(n, n, x), h.scale(r, r, x), h.scale(s, s, x), h.scale(o, o, x), i.set(Mr, n[0], n[1], m ? n[2] / y : 0),
|
|
7533
|
+
i.set(Pr, r[0], r[1], m ? r[2] / y : 0), i.set(Tr, s[0], s[1], m ? s[2] / y : 0),
|
|
7534
|
+
i.set(kr, o[0], o[1], m ? o[2] / y : 0), i.add(Mr, Mr, e), i.add(Pr, Pr, e), i.add(Tr, Tr, e),
|
|
7535
|
+
i.add(kr, kr, e), bi(n, Mr, l, f.width, f.height), bi(r, Pr, l, f.width, f.height),
|
|
7536
|
+
bi(s, Tr, l, f.width, f.height), bi(o, kr, l, f.width, f.height), h.set(Or, Math.min(n[0], r[0], s[0], o[0]), Math.min(n[1], r[1], s[1], o[1])),
|
|
7537
|
+
h.set(Ir, Math.max(n[0], r[0], s[0], o[0]), Math.max(n[1], r[1], s[1], o[1])), a.set(t, Or[0] + u[0], Or[1] + u[1], Ir[0] + u[0], Ir[1] + u[1]);
|
|
7527
7538
|
}
|
|
7528
7539
|
|
|
7529
|
-
function
|
|
7540
|
+
function Cr(t, e, n, i, r, s, o, l) {
|
|
7530
7541
|
1 !== l && (h.scale(n, n, l), h.scale(i, i, l), h.scale(r, r, l), h.scale(s, s, l)),
|
|
7531
|
-
h.set(
|
|
7532
|
-
a.set(t, e[0] +
|
|
7542
|
+
h.set(Or, Math.min(n[0], i[0], r[0], s[0]), Math.min(n[1], i[1], r[1], s[1])), h.set(Ir, Math.max(n[0], i[0], r[0], s[0]), Math.max(n[1], i[1], r[1], s[1])),
|
|
7543
|
+
a.set(t, e[0] + Or[0] + o[0], e[1] + Or[1] - o[1], e[0] + Ir[0] + o[0], e[1] + Ir[1] - o[1]);
|
|
7533
7544
|
}
|
|
7534
7545
|
|
|
7535
|
-
function
|
|
7546
|
+
function Er(t, e, n, i, r) {
|
|
7536
7547
|
e -= n * i, 1 === r && (e += n);
|
|
7537
7548
|
const s = Math.sin(e), o = Math.cos(e);
|
|
7538
7549
|
return u.set(t, o, -s, s, o);
|
|
7539
7550
|
}
|
|
7540
7551
|
|
|
7541
|
-
const
|
|
7552
|
+
const Dr = [], Rr = [], Lr = [], Nr = [], Hr = [], zr = [], Vr = [], Ur = [], jr = [ 1, -1 ], Br = [ 1, 1 ];
|
|
7542
7553
|
|
|
7543
|
-
function
|
|
7544
|
-
const o = e.material.uniforms, a = s.cameraToCenterDistance, l = e.geometry.properties, u = this.getSymbol(l.symbolIndex), c = e.geometry.desc.positionSize, f = l.aAnchor, d = i.set(
|
|
7554
|
+
function Gr(t, e, n, r, s) {
|
|
7555
|
+
const o = e.material.uniforms, a = s.cameraToCenterDistance, l = e.geometry.properties, u = this.getSymbol(l.symbolIndex), c = e.geometry.desc.positionSize, f = l.aAnchor, d = i.set(Dr, f[n * c], f[n * c + 1], 2 === c ? 0 : f[n * c + 2]), {aTerrainAltitude: p} = l;
|
|
7545
7556
|
if (p) {
|
|
7546
7557
|
const t = 100 * p[2 * n];
|
|
7547
7558
|
t && (d[2] += t);
|
|
7548
7559
|
}
|
|
7549
|
-
let m = bi(
|
|
7560
|
+
let m = bi(Rr, d, r, s.width, s.height);
|
|
7550
7561
|
const y = m[2];
|
|
7551
7562
|
let g = 1;
|
|
7552
7563
|
if (o.markerPerspectiveRatio) {
|
|
7553
7564
|
g = kt(.5 + .5 * (1 - (1 - a / y) * o.markerPerspectiveRatio), 0, 4);
|
|
7554
7565
|
}
|
|
7555
|
-
const {aShape: v, aMarkerDx: x, aMarkerDy: b, aMarkerWidth: A, aMarkerHeight: w, aPitchAlign: _, aRotationAlign: S, aRotation: M} = l, P = x ? x[n] : u.markerDx, T = b ? b[n] : u.markerDy, k = _ ? _[n] : o.pitchWithMap, O = S ? S[n] : o.rotateWithMap, I = h.set(
|
|
7556
|
-
let F = h.set(
|
|
7557
|
-
0 === o.flipY && 1 === k && (h.multiply(F, F,
|
|
7558
|
-
h.multiply(D, D,
|
|
7566
|
+
const {aShape: v, aMarkerDx: x, aMarkerDy: b, aMarkerWidth: A, aMarkerHeight: w, aPitchAlign: _, aRotationAlign: S, aRotation: M} = l, P = x ? x[n] : u.markerDx, T = b ? b[n] : u.markerDy, k = _ ? _[n] : o.pitchWithMap, O = S ? S[n] : o.rotateWithMap, I = h.set(Ur, P || 0, -(T || 0));
|
|
7567
|
+
let F = h.set(Nr, v[2 * n] / 10, v[2 * n + 1] / 10), C = h.set(Hr, v[2 * n + 2] / 10, v[2 * n + 3] / 10), E = h.set(zr, v[2 * n + 4] / 10, v[2 * n + 5] / 10), D = h.set(Vr, v[2 * n + 6] / 10, v[2 * n + 7] / 10);
|
|
7568
|
+
0 === o.flipY && 1 === k && (h.multiply(F, F, jr), h.multiply(C, C, jr), h.multiply(E, E, jr),
|
|
7569
|
+
h.multiply(D, D, jr));
|
|
7559
7570
|
const [R, L] = $i(e.geometry);
|
|
7560
7571
|
let N = A ? A[n] : u.markerWidth;
|
|
7561
7572
|
It(N) && (N = R || 15);
|
|
7562
7573
|
let H = w ? w[n] : u.markerHeight;
|
|
7563
7574
|
It(H) && (H = L || 15);
|
|
7564
|
-
const z = h.set(
|
|
7575
|
+
const z = h.set(Br, N / 2048, H / 2048);
|
|
7565
7576
|
h.mul(F, F, z), h.mul(C, C, z), h.mul(E, E, z), h.mul(D, D, z);
|
|
7566
7577
|
const V = -(M ? M[n] / 9362 : -(u.markerRotation || 0) * Math.PI / 180), U = s.getBearing() * Math.PI / 180;
|
|
7567
7578
|
if (U * O || V) {
|
|
7568
|
-
const t =
|
|
7579
|
+
const t = Er(Lr, V, U, O, k);
|
|
7569
7580
|
F = h.transformMat2(F, F, t), C = h.transformMat2(C, C, t), E = h.transformMat2(E, E, t),
|
|
7570
7581
|
D = h.transformMat2(D, D, t);
|
|
7571
7582
|
}
|
|
7572
|
-
1 === k ?
|
|
7573
|
-
h.multiply(E, E,
|
|
7583
|
+
1 === k ? Fr(t, d, F, C, E, D, r, I, o, s, y, g) : (h.multiply(F, F, jr), h.multiply(C, C, jr),
|
|
7584
|
+
h.multiply(E, E, jr), h.multiply(D, D, jr), Cr(t, m, F, C, E, D, I, g));
|
|
7574
7585
|
const j = this.getMap().getDevicePixelRatio();
|
|
7575
7586
|
return 1 !== j && (t[0] *= j, t[1] *= j, t[2] *= j, t[3] *= j), t;
|
|
7576
7587
|
}
|
|
7577
7588
|
|
|
7578
|
-
const
|
|
7589
|
+
const Wr = [], Xr = [], Yr = [], $r = [], qr = [], Jr = [], Kr = [ 1, -1 ];
|
|
7579
7590
|
|
|
7580
|
-
function
|
|
7591
|
+
function Zr(t, e, n, r, s, o, a, l, u) {
|
|
7581
7592
|
const c = r.material.uniforms, f = u.cameraToCenterDistance, d = r.geometry.properties, p = this.getSymbol(d.symbolIndex), m = "line" === p.textPlacement && !zt(p), y = n[2];
|
|
7582
7593
|
let g = 1;
|
|
7583
7594
|
if (c.textPerspectiveRatio) {
|
|
7584
7595
|
g = kt(.5 + .5 * (1 - (1 - f / y) * c.textPerspectiveRatio), 0, 4);
|
|
7585
7596
|
}
|
|
7586
|
-
const {aTextDx: v, aTextDy: x, aPitchAlign: b, aRotationAlign: A, aRotation: w} = r.geometry.properties, _ = v ? v[a] : p.textDx, S = x ? x[a] : p.textDy, M = b ? b[a] : c.pitchWithMap, P = A ? A[a] : c.rotateWithMap, T = h.set(
|
|
7597
|
+
const {aTextDx: v, aTextDy: x, aPitchAlign: b, aRotationAlign: A, aRotation: w} = r.geometry.properties, _ = v ? v[a] : p.textDx, S = x ? x[a] : p.textDy, M = b ? b[a] : c.pitchWithMap, P = A ? A[a] : c.rotateWithMap, T = h.set(Jr, _ || 0, -(S || 0));
|
|
7587
7598
|
if (m) {
|
|
7588
7599
|
const {aOffset: r, aShape: s} = d, o = r.length !== s.length;
|
|
7589
7600
|
let f, p, m, v;
|
|
7590
|
-
if (o ? (f = i.set(
|
|
7591
|
-
m = i.set(
|
|
7592
|
-
p = h.set(
|
|
7593
|
-
v = h.set(
|
|
7601
|
+
if (o ? (f = i.set(Xr, r[3 * a] / 10, r[3 * a + 1] / 10, r[3 * a + 2] / 10), p = i.set(Yr, r[3 * a + 3] / 10, r[3 * a + 4] / 10, r[3 * a + 5] / 10),
|
|
7602
|
+
m = i.set($r, r[3 * a + 6] / 10, r[3 * a + 7] / 10, r[3 * a + 8] / 10), v = i.set(qr, r[3 * a + 9] / 10, r[3 * a + 10] / 10, r[3 * a + 11] / 10)) : (f = h.set(Xr, r[2 * a] / 10, r[2 * a + 1] / 10),
|
|
7603
|
+
p = h.set(Yr, r[2 * a + 2] / 10, r[2 * a + 3] / 10), m = h.set($r, r[2 * a + 4] / 10, r[2 * a + 5] / 10),
|
|
7604
|
+
v = h.set(qr, r[2 * a + 6] / 10, r[2 * a + 7] / 10)), 1 === M) {
|
|
7594
7605
|
const n = lt(u.getResolution(), u);
|
|
7595
|
-
|
|
7596
|
-
} else h.multiply(f, f,
|
|
7597
|
-
|
|
7606
|
+
Fr(t, e, f, p, m, v, l, T, c, u, y, g, o, n);
|
|
7607
|
+
} else h.multiply(f, f, Kr), h.multiply(p, p, Kr), h.multiply(m, m, Kr), h.multiply(v, v, Kr),
|
|
7608
|
+
Cr(t, n, f, p, m, v, T, g);
|
|
7598
7609
|
} else {
|
|
7599
7610
|
const {aShape: i} = d;
|
|
7600
|
-
let r = h.set(
|
|
7601
|
-
0 === c.flipY && 1 === M && (h.multiply(r, r,
|
|
7602
|
-
h.multiply(v, v,
|
|
7611
|
+
let r = h.set(Xr, i[2 * a] / 10, -i[2 * a + 1] / 10), o = h.set(Yr, i[2 * a + 2] / 10, -i[2 * a + 3] / 10), f = h.set($r, i[2 * a + 4] / 10, -i[2 * a + 5] / 10), v = h.set(qr, i[2 * a + 6] / 10, -i[2 * a + 7] / 10);
|
|
7612
|
+
0 === c.flipY && 1 === M && (h.multiply(r, r, Kr), h.multiply(o, o, Kr), h.multiply(f, f, Kr),
|
|
7613
|
+
h.multiply(v, v, Kr));
|
|
7603
7614
|
const x = w ? w[a] / 9362 : (p.textRotation || 0) * Math.PI / 180, b = m ? 0 : u.getBearing() * Math.PI / 180;
|
|
7604
7615
|
if (x || b) {
|
|
7605
|
-
const t =
|
|
7616
|
+
const t = Er(Wr, x, b, P, M);
|
|
7606
7617
|
r = h.transformMat2(r, r, t), o = h.transformMat2(o, o, t), f = h.transformMat2(f, f, t),
|
|
7607
7618
|
v = h.transformMat2(v, v, t);
|
|
7608
7619
|
}
|
|
7609
7620
|
const A = s / 24;
|
|
7610
|
-
h.scale(r, r, A), h.scale(o, o, A), h.scale(f, f, A), h.scale(v, v, A), 1 === M ?
|
|
7621
|
+
h.scale(r, r, A), h.scale(o, o, A), h.scale(f, f, A), h.scale(v, v, A), 1 === M ? Fr(t, e, r, o, f, v, l, T, c, u, y, g) : Cr(t, n, r, o, f, v, T, g);
|
|
7611
7622
|
}
|
|
7612
7623
|
o = o || 0, t[0] -= o + 1, t[1] -= o + 1, t[2] += o + 1, t[3] += o + 1;
|
|
7613
7624
|
const k = this.getMap().getDevicePixelRatio();
|
|
7614
7625
|
return 1 !== k && (t[0] *= k, t[1] *= k, t[2] *= k, t[3] *= k), t;
|
|
7615
7626
|
}
|
|
7616
7627
|
|
|
7617
|
-
function
|
|
7628
|
+
function Qr(t, e, n) {
|
|
7618
7629
|
const r = e.geometry.desc.positionSize, {aAnchor: s, aAltitude: o, aTerrainAltitude: a} = e.geometry.properties, l = n * r;
|
|
7619
7630
|
if (o ? i.set(t, s[l], s[l + 1], o[n]) : 3 === r ? A.unpackPosition(t, s[l], s[l + 1], s[l + 2]) : i.set(t, s[l], s[l + 1], 0),
|
|
7620
7631
|
a) {
|
|
@@ -7624,7 +7635,7 @@ function Zr(t, e, n) {
|
|
|
7624
7635
|
return t;
|
|
7625
7636
|
}
|
|
7626
7637
|
|
|
7627
|
-
const
|
|
7638
|
+
const ts = {
|
|
7628
7639
|
textFill: [ 0, 0, 0, 1 ],
|
|
7629
7640
|
textOpacity: 1,
|
|
7630
7641
|
textPitchAlignment: 0,
|
|
@@ -7640,14 +7651,14 @@ const Qr = {
|
|
|
7640
7651
|
textRotation: 0
|
|
7641
7652
|
};
|
|
7642
7653
|
|
|
7643
|
-
function
|
|
7654
|
+
function es(t, e, i, r, s, o, a, l, h) {
|
|
7644
7655
|
const u = [];
|
|
7645
7656
|
if (e.isDisposed() || 0 === e.data.aPosition.length) return u;
|
|
7646
7657
|
const c = e.properties.glyphAtlas;
|
|
7647
7658
|
if (!c) return u;
|
|
7648
7659
|
if (0 === r.textSize || 0 === r.textOpacity) return u;
|
|
7649
7660
|
if (si(e, r, o), !e.properties.aCount) {
|
|
7650
|
-
|
|
7661
|
+
ns.call(this, e, a || h, l);
|
|
7651
7662
|
const {aTextSize: t, aTextDx: n, aTextDy: i, aPitchAlign: r, aRotationAlign: s, aRotation: o, aOverlap: u, aAltitude: c} = e.data;
|
|
7652
7663
|
if (t) {
|
|
7653
7664
|
const n = (ri + "aTextSize").trim();
|
|
@@ -7689,12 +7700,12 @@ function ts(t, e, i, r, s, o, a, l, h) {
|
|
|
7689
7700
|
texture: f,
|
|
7690
7701
|
texSize: [ c.width, c.height ]
|
|
7691
7702
|
};
|
|
7692
|
-
|
|
7703
|
+
is(e, d, s);
|
|
7693
7704
|
let p = !1;
|
|
7694
7705
|
s.textOpacity < 1 && (p = !0), e.properties.memorySize = e.getMemorySize(), e.generateBuffers(t, {
|
|
7695
7706
|
excludeElementsInVAO: !0
|
|
7696
7707
|
});
|
|
7697
|
-
const m = new n.Material(d,
|
|
7708
|
+
const m = new n.Material(d, ts), y = new n.Mesh(e, m, {
|
|
7698
7709
|
disableVAO: !0,
|
|
7699
7710
|
transparent: p,
|
|
7700
7711
|
castShadow: !1,
|
|
@@ -7712,8 +7723,8 @@ function ts(t, e, i, r, s, o, a, l, h) {
|
|
|
7712
7723
|
texSize: [ c.width, c.height ],
|
|
7713
7724
|
isHalo: 0
|
|
7714
7725
|
};
|
|
7715
|
-
|
|
7716
|
-
const r = new n.Material(t,
|
|
7726
|
+
is(e, t, s);
|
|
7727
|
+
const r = new n.Material(t, ts), o = new n.Mesh(e, r, {
|
|
7717
7728
|
disableVAO: !0,
|
|
7718
7729
|
transparent: p,
|
|
7719
7730
|
castShadow: !1,
|
|
@@ -7741,7 +7752,7 @@ function ts(t, e, i, r, s, o, a, l, h) {
|
|
|
7741
7752
|
}), u;
|
|
7742
7753
|
}
|
|
7743
7754
|
|
|
7744
|
-
function
|
|
7755
|
+
function ns(t, e, n) {
|
|
7745
7756
|
const i = this.getSymbol(t.properties.symbolIndex), r = "line" === t.properties.textPlacement && !zt(i), {aPosition: s, aShape: o} = t.data, a = s.length / t.desc.positionSize;
|
|
7746
7757
|
if (t.properties.aPickingId = t.data.aPickingId, t.properties.aCount = t.data.aCount,
|
|
7747
7758
|
delete t.data.aCount, (e || r) && (t.properties.aAnchor = s, t.properties.aShape = o),
|
|
@@ -7771,18 +7782,18 @@ function es(t, e, n) {
|
|
|
7771
7782
|
}
|
|
7772
7783
|
}
|
|
7773
7784
|
|
|
7774
|
-
function
|
|
7775
|
-
void 0 === e.isHalo && (e.isHalo = 1), Ct(e, "textOpacity", n, "textOpacity",
|
|
7776
|
-
Ct(e, "textFill", n, "textFill",
|
|
7777
|
-
Ct(e, "textHaloBlur", n, "textHaloBlur",
|
|
7778
|
-
Ct(e, "textHaloOpacity", n, "textHaloOpacity",
|
|
7779
|
-
Ct(e, "rotateWithMap", n, "textRotationAlignment",
|
|
7780
|
-
Ct(e, "pitchWithMap", n, "textPitchAlignment",
|
|
7781
|
-
Ct(e, "textSize", n, "textSize",
|
|
7782
|
-
Ct(e, "textDy", n, "textDy",
|
|
7785
|
+
function is(t, e, n) {
|
|
7786
|
+
void 0 === e.isHalo && (e.isHalo = 1), Ct(e, "textOpacity", n, "textOpacity", ts.textOpacity),
|
|
7787
|
+
Ct(e, "textFill", n, "textFill", ts.textFill, Rt()), Ct(e, "textHaloFill", n, "textHaloFill", ts.textHaloFill, Rt()),
|
|
7788
|
+
Ct(e, "textHaloBlur", n, "textHaloBlur", ts.textHaloBlur), Ct(e, "textHaloRadius", n, "textHaloRadius", ts.textHaloRadius),
|
|
7789
|
+
Ct(e, "textHaloOpacity", n, "textHaloOpacity", ts.textHaloOpacity), Ct(e, "textPerspectiveRatio", n, "textPerspectiveRatio", ts.textPerspectiveRatio, e => "line" === t.properties.textPlacement ? 1 : e),
|
|
7790
|
+
Ct(e, "rotateWithMap", n, "textRotationAlignment", ts.textRotationAlignment, t => +("map" === t)),
|
|
7791
|
+
Ct(e, "pitchWithMap", n, "textPitchAlignment", ts.textPitchAlignment, t => +("map" === t)),
|
|
7792
|
+
Ct(e, "textSize", n, "textSize", ts.textSize), Ct(e, "textDx", n, "textDx", ts.textDx),
|
|
7793
|
+
Ct(e, "textDy", n, "textDy", ts.textDy), Ct(e, "textRotation", n, "textRotation", ts.textRotation, t => t * Math.PI / 180);
|
|
7783
7794
|
}
|
|
7784
7795
|
|
|
7785
|
-
function
|
|
7796
|
+
function rs(t, e) {
|
|
7786
7797
|
const n = [];
|
|
7787
7798
|
return {
|
|
7788
7799
|
uniforms: [ {
|
|
@@ -7841,7 +7852,7 @@ function is(t, e) {
|
|
|
7841
7852
|
};
|
|
7842
7853
|
}
|
|
7843
7854
|
|
|
7844
|
-
function
|
|
7855
|
+
function ss(t, e) {
|
|
7845
7856
|
const n = g(e.textFill), i = g(e.textSize), r = g(e.textHaloFill), s = g(e.textHaloRadius), o = g(e.textHaloOpacity), a = g(e.textDx), l = g(e.textDy), h = g(e.textOpacity), u = y(e.textPitchAlignment), c = y(e.textRotationAlignment), f = g(e.textRotation), d = y(e.textAllowOverlapFn), m = y(e.textIgnorePlacement), v = {}, x = new Int16Array(1), b = new Uint16Array(1);
|
|
7846
7857
|
return [ {
|
|
7847
7858
|
attrName: "aTextFill",
|
|
@@ -7861,7 +7872,7 @@ function rs(t, e) {
|
|
|
7861
7872
|
type: Uint8Array,
|
|
7862
7873
|
width: 1,
|
|
7863
7874
|
evaluate: (e, n) => {
|
|
7864
|
-
let r = i(t.getZoom(), e) ||
|
|
7875
|
+
let r = i(t.getZoom(), e) || ts.textSize;
|
|
7865
7876
|
return p(r) && (r = this.evaluateInFnTypeConfig(r, n, t, e)), x[0] = r, x[0];
|
|
7866
7877
|
}
|
|
7867
7878
|
}, {
|
|
@@ -7969,25 +7980,25 @@ function rs(t, e) {
|
|
|
7969
7980
|
} ];
|
|
7970
7981
|
}
|
|
7971
7982
|
|
|
7972
|
-
const
|
|
7983
|
+
const os = [], as = [], ls = [], hs = [];
|
|
7973
7984
|
|
|
7974
|
-
function
|
|
7985
|
+
function us(t, e, n, i, r, s, o) {
|
|
7975
7986
|
t = 1 === t ? 1 : 0;
|
|
7976
7987
|
const a = this.getMap(), l = e.geometry.properties, h = this.getSymbol(l.symbolIndex), u = "line" === l.textPlacement && !zt(h), {aTextSize: c, aTextHaloRadius: f, aShape: d} = l;
|
|
7977
7988
|
let p = c ? c[n[r]] : e.properties.textSize;
|
|
7978
|
-
null == p && (p =
|
|
7979
|
-
const m = f ? f[n[r]] : e.properties.textHaloRadius, y =
|
|
7980
|
-
let v =
|
|
7989
|
+
null == p && (p = ts.textSize);
|
|
7990
|
+
const m = f ? f[n[r]] : e.properties.textHaloRadius, y = Qr(ls, e, n[r]), {aProjectedAnchor: g} = e.geometry.properties;
|
|
7991
|
+
let v = hs;
|
|
7981
7992
|
const x = 3 * n[r];
|
|
7982
|
-
g && -999999 !== g[x] ? (
|
|
7983
|
-
const b = i, {boxes: A, collision: w} = this.
|
|
7993
|
+
g && -999999 !== g[x] ? (hs[0] = g[x], hs[1] = g[x + 1], hs[2] = g[x + 2]) : v = bi(hs, y, o, a.width, a.height);
|
|
7994
|
+
const b = i, {boxes: A, collision: w} = this.Ss(e, r);
|
|
7984
7995
|
let _ = 0;
|
|
7985
7996
|
if (u || 1 === e.material.uniforms.rotateWithMap || h.textRotation) {
|
|
7986
7997
|
let i = 0;
|
|
7987
7998
|
for (let s = r; s < r + 6 * b; s += 6) {
|
|
7988
7999
|
const r = A[_] = A[_] || [];
|
|
7989
8000
|
_++;
|
|
7990
|
-
const l =
|
|
8001
|
+
const l = Zr.call(this, r, y, v, e, p, m, n[s], o, a);
|
|
7991
8002
|
if (!t) {
|
|
7992
8003
|
const e = this.isCollides(l);
|
|
7993
8004
|
1 === e ? t = 1 : -1 === e && i++;
|
|
@@ -7999,7 +8010,7 @@ function hs(t, e, n, i, r, s, o) {
|
|
|
7999
8010
|
for (let h = r; h < s; h += 6) {
|
|
8000
8011
|
const r = d[2 * n[h] + 1];
|
|
8001
8012
|
if (l !== r || h === s - 6) {
|
|
8002
|
-
const u = n[h === s - 6 ? h : h - 6], c =
|
|
8013
|
+
const u = n[h === s - 6 ? h : h - 6], c = Zr.call(this, os, y, v, e, p, m, i, o, a), f = Zr.call(this, as, y, v, e, p, m, u, o, a), d = A[_] = A[_] || [];
|
|
8003
8014
|
_++, d[0] = Math.min(c[0], f[0]), d[1] = Math.min(c[1], f[1]), d[2] = Math.max(c[2], f[2]),
|
|
8004
8015
|
d[3] = Math.max(c[3], f[3]), i = n[h], l = r, !t && this.isCollides(d) && (t = 1);
|
|
8005
8016
|
}
|
|
@@ -8008,29 +8019,29 @@ function hs(t, e, n, i, r, s, o) {
|
|
|
8008
8019
|
return w.collides = t, w;
|
|
8009
8020
|
}
|
|
8010
8021
|
|
|
8011
|
-
function
|
|
8022
|
+
function cs(t, e) {
|
|
8012
8023
|
const n = function(t, e) {
|
|
8013
8024
|
const {aPickingId: n, features: i} = t.geometry.properties, r = n[e];
|
|
8014
8025
|
return (i && i[r] && i[r].feature).label;
|
|
8015
8026
|
}(t, e);
|
|
8016
8027
|
return n ? function(t, e, n) {
|
|
8017
8028
|
if (!n) return null;
|
|
8018
|
-
const i = t.localTransform, r =
|
|
8019
|
-
a.set(
|
|
8020
|
-
const s = a.transformMat4(
|
|
8029
|
+
const i = t.localTransform, r = Qr(fs, t, e);
|
|
8030
|
+
a.set(ds, r[0], r[1], r[2], 1);
|
|
8031
|
+
const s = a.transformMat4(ds, ds, i);
|
|
8021
8032
|
let o = 0;
|
|
8022
8033
|
for (let t = 0; t < n.length; t++) o += n.charCodeAt(t);
|
|
8023
8034
|
return [ Math.floor(s[0]), Math.floor(s[1]), Math.floor(s[2]), o ];
|
|
8024
8035
|
}(t, e, n) : null;
|
|
8025
8036
|
}
|
|
8026
8037
|
|
|
8027
|
-
const
|
|
8038
|
+
const fs = [], ds = [];
|
|
8028
8039
|
|
|
8029
|
-
var
|
|
8040
|
+
var ps = "#define SHADER_NAME TEXT_VERT\n#define RAD 0.0174532925\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aShape;\nattribute vec2 aTexCoord;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float rotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_SIZE\nfloat d = aTextSize * layerScale;\n#else\nfloat d = textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\nfloat e = aTextDx;\n#else\nfloat e = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat f = aTextDy;\n#else\nfloat f = textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nfloat h = aPitchAlign;\n#else\nfloat h = pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = rotateWithMap;\n#endif\nvec2 j = aShape / 10.0;\n if(h == 1. && flipY == .0) {\n j = j * vec2(1., -1.);\n }\n vec2 k = aTexCoord;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n float l = gl_Position.w;\n float m;\n if(isRenderingTerrain == 1. && h == 1.) {\n m = 1.;\n } else {\n float n = (1. - cameraToCenterDistance / l) * textPerspectiveRatio;\n m = clamp(.5 + .5 * (1. - n), .0, 4.);\n }\n#ifdef HAS_ROTATION\nfloat o = -aRotation / 9362. - mapRotation * i;\n#else\nfloat o = -textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n \n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\no += mapRotation;\n#else\no -= mapRotation;\n#endif\n }\n float u = sin(o);\n float v = cos(o);\n mat2 A = mat2(v, -1. * u, u, v);\n j = A * (j / glyphSize * d);\n float B;\n if(isRenderingTerrain == 1.) {\n B = 1.;\n } else {\n B = l / cameraToCenterDistance;\n }\n if(h == .0) {\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * m * l;\n } else {\n float D;\n if(isRenderingTerrain == 1.) {\n D = tileRatio / zoomScale;\n } else {\n D = tileRatio / zoomScale * B * m;\n }\n vec2 C = j;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c + vec3(C, .0) * D, 1.);\n }\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * l;\n#ifndef PICKING_MODE\nif(h == .0) {\n vGammaScale = mix(1., B, textPerspectiveRatio);\n } else {\n vGammaScale = B + mapPitch / 4.;\n }\n vTexCoord = k / texSize;\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = d;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool E = aOpacity == 255.;\n#else\nbool E = true;\n#endif\nfbo_picking_setData(gl_Position.w, E);\n#endif\n}", ms = "#define SHADER_NAME TEXT_FRAG\n#define HAS_HIGHLIGHT_COLOR_POINT 1\n#define SDF_PX 8.0\n#define DEVICE_PIXEL_RATIO 1.0\n#define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\nprecision mediump float;\nuniform sampler2D texture;\nuniform float textOpacity;\nuniform highp float gammaScale;\nuniform int isHalo;\nuniform highp float textHaloBlur;\nuniform float alphaTest;\n#ifdef HAS_TEXT_HALO_OPACITY\nvarying float vTextHaloOpacity;\n#else\nuniform float textHaloOpacity;\n#endif\nuniform float layerOpacity;\nvarying vec2 vTexCoord;\nvarying float vSize;\nvarying float vGammaScale;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nvarying vec4 vTextFill;\n#else\nuniform vec4 textFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvarying vec4 vTextHaloFill;\n#else\nuniform vec4 textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvarying float vTextHaloRadius;\n#else\nuniform highp float textHaloRadius;\n#endif\n#include <highlight_frag>\nvoid main() {\n \n#ifdef HAS_TEXT_FILL\nvec4 c = vTextFill;\n#else\nvec4 c = textFill;\n#endif\nfloat d = vSize / 24.;\n lowp vec4 e = c;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n if(isHalo == 1) {\n \n#ifdef HAS_TEXT_HALO_FILL\nvec4 i = vTextHaloFill;\n#else\nvec4 i = textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nfloat j = vTextHaloRadius;\n#else\nfloat j = textHaloRadius;\n#endif\ne = i;\n f = (textHaloBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (d * gammaScale);\n h = (6. - j / d) / SDF_PX;\n#ifdef HAS_TEXT_HALO_OPACITY\nfloat k = vTextHaloOpacity / 255.;\n#else\nfloat k = textHaloOpacity;\n#endif\ne *= k * 1.25;\n }\n float l = texture2D(texture, vTexCoord).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * textOpacity * vOpacity * layerOpacity);\n if(gl_FragColor.a < alphaTest) {\n discard;\n }\n gl_FragColor = highlight_blendColor(gl_FragColor);\n}";
|
|
8030
8041
|
|
|
8031
|
-
const
|
|
8042
|
+
const ys = new Uint16Array(1), gs = new Int8Array(1);
|
|
8032
8043
|
|
|
8033
|
-
function
|
|
8044
|
+
function vs(t, e, n) {
|
|
8034
8045
|
si(t, e, n), function(t) {
|
|
8035
8046
|
const {aMarkerWidth: e, aMarkerHeight: n, aMarkerDx: i, aMarkerDy: r, aPitchAlign: s, aRotationAlign: o, aRotation: a, aOverlap: l} = t.data;
|
|
8036
8047
|
if (e) {
|
|
@@ -8068,7 +8079,7 @@ function gs(t, e, n) {
|
|
|
8068
8079
|
}(t);
|
|
8069
8080
|
}
|
|
8070
8081
|
|
|
8071
|
-
function
|
|
8082
|
+
function xs(t, e) {
|
|
8072
8083
|
const n = g(e.markerWidth), i = g(e.markerHeight), r = g(e.markerDx), s = g(e.markerDy), o = g(e.markerOpacity), a = g(e.markerTextFit), l = y(e.markerPitchAlignment), h = y(e.markerRotationAlignment), u = g(e.markerRotation), c = y(e.markerAllowOverlapFn), f = y(e.markerIgnorePlacement), d = new Int16Array(1), m = new Uint16Array(1);
|
|
8073
8084
|
return [ {
|
|
8074
8085
|
attrName: "aMarkerWidth",
|
|
@@ -8169,7 +8180,7 @@ function vs(t, e) {
|
|
|
8169
8180
|
} ];
|
|
8170
8181
|
}
|
|
8171
8182
|
|
|
8172
|
-
function
|
|
8183
|
+
function bs(t, e, n, i) {
|
|
8173
8184
|
if (!n || !i || "none" === i) return;
|
|
8174
8185
|
const r = function(t, e, n) {
|
|
8175
8186
|
let i = t.properties.textFitFn;
|
|
@@ -8238,11 +8249,11 @@ function xs(t, e, n, i) {
|
|
|
8238
8249
|
if (!s) return [];
|
|
8239
8250
|
return n;
|
|
8240
8251
|
}(e, n);
|
|
8241
|
-
i.length && (e.properties.labelShape = i,
|
|
8252
|
+
i.length && (e.properties.labelShape = i, As.call(this, t, e, n));
|
|
8242
8253
|
}
|
|
8243
8254
|
}
|
|
8244
8255
|
|
|
8245
|
-
function
|
|
8256
|
+
function As(t, e) {
|
|
8246
8257
|
const n = this.getSymbolDef(e.properties.symbolIndex), i = n.markerTextFit, r = e.properties;
|
|
8247
8258
|
let s = "both" === i || "width" === i, o = "both" === i || "height" === i;
|
|
8248
8259
|
if (p(n.markerTextFit)) {
|
|
@@ -8285,22 +8296,22 @@ function bs(t, e) {
|
|
|
8285
8296
|
e.data.aMarkerHeight = new Uint16Array(u);
|
|
8286
8297
|
}
|
|
8287
8298
|
const c = this.getSymbolDef(e.properties.textGeo.properties.symbolIndex), f = g(c.textSize);
|
|
8288
|
-
|
|
8299
|
+
_s.call(this, t, e), (!p(c.textSize) || f.isZoomConstant && f.isFeatureConstant) && (r.isFitConstant = !0);
|
|
8289
8300
|
}
|
|
8290
8301
|
|
|
8291
|
-
const
|
|
8302
|
+
const ws = [ 0, 0, 0, 0 ];
|
|
8292
8303
|
|
|
8293
|
-
function
|
|
8304
|
+
function _s(t, e) {
|
|
8294
8305
|
const n = e.properties.textGeo;
|
|
8295
8306
|
if (!n) return;
|
|
8296
8307
|
const i = n.properties, r = e.properties;
|
|
8297
8308
|
if (r.isFitConstant || !r.labelShape || !r.labelShape.length) return;
|
|
8298
8309
|
const s = this.getSymbolDef(e.properties.symbolIndex), o = this.getSymbolDef(n.properties.symbolIndex).textSize;
|
|
8299
8310
|
let a;
|
|
8300
|
-
p(o) && (a = i.
|
|
8301
|
-
const l = s.markerTextFitPadding ||
|
|
8311
|
+
p(o) && (a = i.ks ? i.ks : i.ks = g(o));
|
|
8312
|
+
const l = s.markerTextFitPadding || ws;
|
|
8302
8313
|
let h;
|
|
8303
|
-
p(l) && (h = r.
|
|
8314
|
+
p(l) && (h = r.Os ? r.Os : r.Os = y(l));
|
|
8304
8315
|
const u = t.getZoom(), {fitIcons: c, fitWidthIcons: f, fitHeightIcons: d} = r, {aMarkerWidth: m, aMarkerHeight: v, labelShape: x} = r, b = r.elements || e.elements, {features: A, aPickingId: w} = r, _ = (t, e, n, i) => {
|
|
8305
8316
|
const s = x[4 * e], c = x[4 * e + 1], f = x[4 * e + 2], d = x[4 * e + 3];
|
|
8306
8317
|
if (!(s || c || f || d)) return;
|
|
@@ -8314,20 +8325,20 @@ function ws(t, e) {
|
|
|
8314
8325
|
if (p(k)) {
|
|
8315
8326
|
k = (S.fitPaddingFn = S.fitPaddingFn || y(k))(u, S);
|
|
8316
8327
|
}
|
|
8317
|
-
if (k = k ||
|
|
8328
|
+
if (k = k || ws, k[0] === k[2] && k[1] === k[3] || (P = r.aPadOffsetX, T = r.aPadOffsetY,
|
|
8318
8329
|
P || (P = r.aPadOffsetX = new Int8Array(m.length), T = r.aPadOffsetY = new Int8Array(m.length))),
|
|
8319
8330
|
m && n) {
|
|
8320
8331
|
const e = Math.abs((f - s) / 10 * M) + (k[1] + k[3] || 0);
|
|
8321
|
-
if (
|
|
8332
|
+
if (ys[0] = e, m[t] !== ys[0] && (Nt(m, ys[0], t, t + 4), m.dirty = !0), P) {
|
|
8322
8333
|
const e = (k[1] + k[3]) / 2 - k[3];
|
|
8323
|
-
|
|
8334
|
+
gs[0] = e, P[t] !== gs[0] && (Nt(P, e, t, t + 4), P.dirty = !0);
|
|
8324
8335
|
}
|
|
8325
8336
|
}
|
|
8326
8337
|
if (v && i) {
|
|
8327
8338
|
const e = Math.abs((d - c) / 10 * M) + (k[0] + k[2] || 0);
|
|
8328
|
-
if (
|
|
8339
|
+
if (ys[0] = e, v[t] !== ys[0] && (Nt(v, ys[0], t, t + 4), v.dirty = !0), T) {
|
|
8329
8340
|
const e = k[0] - (k[0] + k[2]) / 2;
|
|
8330
|
-
|
|
8341
|
+
gs[0] = e, T[t] !== gs[0] && (Nt(T, e, t, t + 4), T.dirty = !0);
|
|
8331
8342
|
}
|
|
8332
8343
|
}
|
|
8333
8344
|
};
|
|
@@ -8353,30 +8364,30 @@ function ws(t, e) {
|
|
|
8353
8364
|
S && (e.data.aPadOffsetX = S, e.data.aPadOffsetY = M);
|
|
8354
8365
|
}
|
|
8355
8366
|
|
|
8356
|
-
const
|
|
8357
|
-
const e = this.layer.getRenderer();
|
|
8358
|
-
return !this.Ps(t) && e.isForeground(t) && !!t.geometry.properties.iconAtlas && !t.geometry.properties.isEmpty;
|
|
8359
|
-
}, Ss = function(t) {
|
|
8367
|
+
const Ss = function(t) {
|
|
8360
8368
|
const e = this.layer.getRenderer();
|
|
8361
|
-
return !
|
|
8369
|
+
return !this.Ts(t) && e.isForeground(t) && !!t.geometry.properties.iconAtlas && !t.geometry.properties.isEmpty;
|
|
8362
8370
|
}, Ms = function(t) {
|
|
8363
8371
|
const e = this.layer.getRenderer();
|
|
8364
|
-
return !this.
|
|
8372
|
+
return !(this.Ts(t) || e.isForeground(t) || !t.geometry.properties.iconAtlas || t.geometry.properties.isEmpty);
|
|
8365
8373
|
}, Ps = function(t) {
|
|
8366
8374
|
const e = this.layer.getRenderer();
|
|
8367
|
-
return !this.
|
|
8368
|
-
}, Ts =
|
|
8375
|
+
return !this.Ts(t) && e.isForeground(t) && !!t.geometry.properties.glyphAtlas;
|
|
8376
|
+
}, Ts = function(t) {
|
|
8377
|
+
const e = this.layer.getRenderer();
|
|
8378
|
+
return !this.Ts(t) && !e.isForeground(t) && !!t.geometry.properties.glyphAtlas;
|
|
8379
|
+
}, ks = [], Os = {
|
|
8369
8380
|
collides: -1
|
|
8370
|
-
},
|
|
8381
|
+
}, Is = [ 2048, 2048 ], Fs = r.identity([]), Cs = [];
|
|
8371
8382
|
|
|
8372
|
-
class
|
|
8383
|
+
class Es extends br {
|
|
8373
8384
|
static getBloomSymbol() {
|
|
8374
8385
|
return [ "markerBloom", "textBloom" ];
|
|
8375
8386
|
}
|
|
8376
8387
|
constructor(t, e, n, i, r, s) {
|
|
8377
8388
|
super(t, e, n, i, r, s), this.propAllowOverlap = "markerAllowOverlap", this.propIgnorePlacement = "markerIgnorePlacement",
|
|
8378
|
-
this.Zi = {}, this.isLabelCollides =
|
|
8379
|
-
this.
|
|
8389
|
+
this.Zi = {}, this.isLabelCollides = us.bind(this), this.Is = Ss.bind(this), this.Fs = Ms.bind(this),
|
|
8390
|
+
this.Cs = Ps.bind(this), this.Es = Ts.bind(this), this.Ds = [];
|
|
8380
8391
|
}
|
|
8381
8392
|
needToRefreshTerrainTileOnZooming() {
|
|
8382
8393
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
@@ -8392,16 +8403,16 @@ class Cs extends br {
|
|
|
8392
8403
|
return super.isTerrainSkin() && this.needToRefreshTerrainTileOnZooming();
|
|
8393
8404
|
}
|
|
8394
8405
|
setTextShaderDefines(t) {
|
|
8395
|
-
this.
|
|
8406
|
+
this.Rs = t;
|
|
8396
8407
|
}
|
|
8397
8408
|
createFnTypeConfig(t, e) {
|
|
8398
8409
|
return {
|
|
8399
|
-
icon:
|
|
8400
|
-
text:
|
|
8410
|
+
icon: xs.call(this, t, e),
|
|
8411
|
+
text: ss.call(this, t, e)
|
|
8401
8412
|
};
|
|
8402
8413
|
}
|
|
8403
8414
|
startFrame(...t) {
|
|
8404
|
-
return this.
|
|
8415
|
+
return this.Ds.length = 0, super.startFrame(...t);
|
|
8405
8416
|
}
|
|
8406
8417
|
createGeometry(t, e) {
|
|
8407
8418
|
return t && t.empty && (t.data = {
|
|
@@ -8411,14 +8422,14 @@ class Cs extends br {
|
|
|
8411
8422
|
}
|
|
8412
8423
|
postCreateGeometry(t, e) {
|
|
8413
8424
|
const {geometry: n, symbolIndex: i} = t, r = this.getSymbolDef(i), s = this.getFnTypeConfig(i);
|
|
8414
|
-
if (this.
|
|
8415
|
-
|
|
8425
|
+
if (this.Ls(n)) n.properties.iconAtlas ? this.drawDebugAtlas(n.properties.iconAtlas) : n.properties.isEmpty = !0,
|
|
8426
|
+
vs(n, r, s.icon); else if (this.Ns(n) && zt(r)) {
|
|
8416
8427
|
const t = e[e.length - 1];
|
|
8417
8428
|
if (t) {
|
|
8418
8429
|
const {geometry: e, symbolIndex: s} = t;
|
|
8419
8430
|
if (e && s.index === i.index) {
|
|
8420
8431
|
const t = this.getMap(), i = r.markerTextFit;
|
|
8421
|
-
e.properties.textGeo = n,
|
|
8432
|
+
e.properties.textGeo = n, bs.call(this, t, e, n, i);
|
|
8422
8433
|
}
|
|
8423
8434
|
}
|
|
8424
8435
|
}
|
|
@@ -8438,7 +8449,7 @@ class Cs extends br {
|
|
|
8438
8449
|
const s = this.isEnableCollision(), o = this.layer, {geometry: a, symbolIndex: l} = t;
|
|
8439
8450
|
a.properties.symbolIndex = l;
|
|
8440
8451
|
const h = this.getSymbolDef(l), u = this.getSymbol(l), c = this.getFnTypeConfig(l), f = [];
|
|
8441
|
-
if (this.
|
|
8452
|
+
if (this.Ls(a)) {
|
|
8442
8453
|
const t = function(t, e, i, r, s, o, a, l) {
|
|
8443
8454
|
if (e.isDisposed() || 0 === e.data.aPosition.length) return null;
|
|
8444
8455
|
const h = e.properties.iconAtlas;
|
|
@@ -8483,25 +8494,25 @@ class Cs extends br {
|
|
|
8483
8494
|
}(this.regl, a, e, 0, u, c.icon, o.options.collision, !s, this.isEnableUniquePlacement());
|
|
8484
8495
|
t && (t.positionMatrix = this.getAltitudeOffsetMatrix(), delete t.geometry.properties.glyphAtlas,
|
|
8485
8496
|
f.push(t));
|
|
8486
|
-
} else if (this.
|
|
8487
|
-
const t =
|
|
8497
|
+
} else if (this.Ns(a)) {
|
|
8498
|
+
const t = es.call(this, this.regl, a, e, h, u, c.text, o.options.collision, !s, this.isEnableUniquePlacement());
|
|
8488
8499
|
t.length && (t.forEach(t => {
|
|
8489
8500
|
t.positionMatrix = this.getAltitudeOffsetMatrix(), delete t.geometry.properties.iconAtlas;
|
|
8490
8501
|
}), f.push(...t));
|
|
8491
8502
|
}
|
|
8492
|
-
return "line" === a.properties.markerPlacement && this.
|
|
8503
|
+
return "line" === a.properties.markerPlacement && this.Hs(a, r), "line" === a.properties.markerPlacement && f.forEach(t => t.properties.isLinePlacement = !0),
|
|
8493
8504
|
this.prepareCollideIndex(a), f;
|
|
8494
8505
|
}
|
|
8495
|
-
|
|
8506
|
+
Hs(t, e) {
|
|
8496
8507
|
const {collideIds: n} = t.properties, i = new Uint16Array(n.length);
|
|
8497
|
-
if (this.
|
|
8508
|
+
if (this.Ls(t)) {
|
|
8498
8509
|
let r = 0;
|
|
8499
8510
|
for (let t = 0; t < n.length; t += 4) i.fill(r++, t, t + 4);
|
|
8500
8511
|
t.properties.collideIds = i, t.properties.uniqueCollideIds = Ut(i), e.markerCollideMap = {
|
|
8501
8512
|
old: n,
|
|
8502
8513
|
new: i
|
|
8503
8514
|
};
|
|
8504
|
-
} else if (this.
|
|
8515
|
+
} else if (this.Ns(t)) {
|
|
8505
8516
|
const {collideIds: n, aCount: i} = t.properties;
|
|
8506
8517
|
if (!i) return;
|
|
8507
8518
|
if (e.markerCollideMap) {
|
|
@@ -8528,12 +8539,12 @@ class Cs extends br {
|
|
|
8528
8539
|
if (this.isEnableCollision() && t.length > 0) {
|
|
8529
8540
|
const e = new cr(t);
|
|
8530
8541
|
e.properties.uniqueCollideIds = t[0].geometry.properties.uniqueCollideIds, e.properties.meshKey = t[0].properties.meshKey,
|
|
8531
|
-
e.properties.level = t[0].properties.level, this.
|
|
8542
|
+
e.properties.level = t[0].properties.level, this.Ds.push(e);
|
|
8532
8543
|
}
|
|
8533
8544
|
for (let e = 0; e < t.length; e++) {
|
|
8534
8545
|
if (!this.isMeshIterable(t[e])) continue;
|
|
8535
8546
|
const n = t[e].geometry, {symbolIndex: i} = n.properties;
|
|
8536
|
-
zt(this.getSymbolDef(i)) &&
|
|
8547
|
+
zt(this.getSymbolDef(i)) && _s.call(this, this.getMap(), n);
|
|
8537
8548
|
}
|
|
8538
8549
|
const e = this.getMap().getZoom();
|
|
8539
8550
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -8551,33 +8562,33 @@ class Cs extends br {
|
|
|
8551
8562
|
if (!this.isEnableCollision()) return;
|
|
8552
8563
|
super.updateCollision(t);
|
|
8553
8564
|
const e = this.scene.getMeshes();
|
|
8554
|
-
e && e.length ? (this.
|
|
8565
|
+
e && e.length ? (this.zs(t.timestamp), this.Ds = [], this.zr()) : this.zr();
|
|
8555
8566
|
}
|
|
8556
8567
|
callCurrentTileShader(t, e) {
|
|
8557
|
-
this.shader.filter = e.sceneFilter ? [ this.
|
|
8558
|
-
this.
|
|
8568
|
+
this.shader.filter = e.sceneFilter ? [ this.Is, e.sceneFilter ] : this.Is, this.callRenderer(this.shader, t, e),
|
|
8569
|
+
this.Vs.filter = e.sceneFilter ? [ this.Cs, e.sceneFilter ] : this.Cs, this.callRenderer(this.Vs, t, e);
|
|
8559
8570
|
}
|
|
8560
8571
|
callBackgroundTileShader(t, e) {
|
|
8561
|
-
this.shader.filter = e.sceneFilter ? [ this.
|
|
8562
|
-
this.
|
|
8572
|
+
this.shader.filter = e.sceneFilter ? [ this.Fs, e.sceneFilter ] : this.Fs, this.callRenderer(this.shader, t, e),
|
|
8573
|
+
this.Vs.filter = e.sceneFilter ? [ this.Es, e.sceneFilter ] : this.Es, this.callRenderer(this.Vs, t, e);
|
|
8563
8574
|
}
|
|
8564
8575
|
isMeshIterable(t) {
|
|
8565
8576
|
return t && t.geometry && !t.geometry.properties.isEmpty && t.material && !t.material.get("isHalo") && this.isMeshVisible(t) && !(this.shouldIgnoreBackground() && !this.layer.getRenderer().isForeground(t));
|
|
8566
8577
|
}
|
|
8567
|
-
|
|
8578
|
+
zs() {
|
|
8568
8579
|
if (!this.isEnableCollision()) return;
|
|
8569
|
-
let t = this.
|
|
8570
|
-
t && t.length && this.
|
|
8580
|
+
let t = this.Ds;
|
|
8581
|
+
t && t.length && this.Us(t);
|
|
8571
8582
|
}
|
|
8572
|
-
|
|
8583
|
+
js(t, e, n, i) {
|
|
8573
8584
|
return this.updateBoxCollisionFading(!0, t, e, n, i);
|
|
8574
8585
|
}
|
|
8575
8586
|
isEnableUniquePlacement() {
|
|
8576
8587
|
return this.isEnableCollision() && !0 === this.sceneConfig.uniquePlacement;
|
|
8577
8588
|
}
|
|
8578
|
-
|
|
8589
|
+
Us(t) {
|
|
8579
8590
|
const e = this.layer.getRenderer();
|
|
8580
|
-
t = t.sort(
|
|
8591
|
+
t = t.sort(Ds);
|
|
8581
8592
|
for (let n = 0; n < t.length; n++) {
|
|
8582
8593
|
const i = t[n];
|
|
8583
8594
|
if (!i || !i.meshes.length) continue;
|
|
@@ -8590,12 +8601,12 @@ class Cs extends br {
|
|
|
8590
8601
|
const s = e.isForeground(i.meshes[0]);
|
|
8591
8602
|
if (this.shouldIgnoreBackground() && !s) continue;
|
|
8592
8603
|
const o = i.properties.meshKey;
|
|
8593
|
-
this.startMeshCollision(i), this.
|
|
8604
|
+
this.startMeshCollision(i), this.Bs(i), this.forEachBox(i, this.js), this.Gs(i),
|
|
8594
8605
|
this.endMeshCollision(o);
|
|
8595
|
-
for (let t = 0; t < i.meshes.length; t++) this.
|
|
8606
|
+
for (let t = 0; t < i.meshes.length; t++) this.Ws(i.meshes[t]);
|
|
8596
8607
|
}
|
|
8597
8608
|
}
|
|
8598
|
-
|
|
8609
|
+
Ws(t) {
|
|
8599
8610
|
const e = t && t.geometry && t.geometry.properties.aOpacity;
|
|
8600
8611
|
e && e.dirty && (t.geometry.updateData("aOpacity", e), e.dirty = !1);
|
|
8601
8612
|
}
|
|
@@ -8605,12 +8616,12 @@ class Cs extends br {
|
|
|
8605
8616
|
const i = {
|
|
8606
8617
|
boxIndex: 0
|
|
8607
8618
|
}, r = n.length;
|
|
8608
|
-
for (let s = 0; s < r; s++) this.
|
|
8619
|
+
for (let s = 0; s < r; s++) this.Xs(t, n[s], e, i);
|
|
8609
8620
|
}
|
|
8610
|
-
|
|
8621
|
+
Xs(t, e, n, i) {
|
|
8611
8622
|
const s = this.getMap(), {collideBoxIndex: o} = t.meshes[0].geometry.properties;
|
|
8612
8623
|
if (!(o && o[e])) return !1;
|
|
8613
|
-
const a = r.multiply(
|
|
8624
|
+
const a = r.multiply(ks, s.projViewMatrix, t.meshes[0].localTransform);
|
|
8614
8625
|
let l, h = !1;
|
|
8615
8626
|
const u = t.meshes;
|
|
8616
8627
|
let c = 0;
|
|
@@ -8620,7 +8631,7 @@ class Cs extends br {
|
|
|
8620
8631
|
n[e] && c++;
|
|
8621
8632
|
}
|
|
8622
8633
|
if (!c) return !1;
|
|
8623
|
-
l = this.
|
|
8634
|
+
l = this.Ms(c);
|
|
8624
8635
|
let f = 0;
|
|
8625
8636
|
for (let t = 0; t < u.length; t++) {
|
|
8626
8637
|
const n = u[t];
|
|
@@ -8636,16 +8647,16 @@ class Cs extends br {
|
|
|
8636
8647
|
l[f].allElements = r, f++;
|
|
8637
8648
|
}
|
|
8638
8649
|
if (!h) return !1;
|
|
8639
|
-
return n.call(this, t, l, a, i.boxIndex++) && this.
|
|
8650
|
+
return n.call(this, t, l, a, i.boxIndex++) && this.Ys(t, e), !0;
|
|
8640
8651
|
}
|
|
8641
|
-
|
|
8652
|
+
Bs(t) {
|
|
8642
8653
|
const e = t.meshes;
|
|
8643
8654
|
for (let t = 0; t < e.length; t++) {
|
|
8644
8655
|
const n = e[t], i = n && n.geometry;
|
|
8645
8656
|
i && (i.properties.visElemts.count = 0);
|
|
8646
8657
|
}
|
|
8647
8658
|
}
|
|
8648
|
-
|
|
8659
|
+
Ys(t, e) {
|
|
8649
8660
|
const n = t.meshes;
|
|
8650
8661
|
for (let t = 0; t < n.length; t++) {
|
|
8651
8662
|
const i = n[t];
|
|
@@ -8660,7 +8671,7 @@ class Cs extends br {
|
|
|
8660
8671
|
a.count = c;
|
|
8661
8672
|
}
|
|
8662
8673
|
}
|
|
8663
|
-
|
|
8674
|
+
Gs(t) {
|
|
8664
8675
|
const e = t.meshes;
|
|
8665
8676
|
for (let t = 0; t < e.length; t++) {
|
|
8666
8677
|
const n = e[t], i = n && n.geometry;
|
|
@@ -8670,18 +8681,18 @@ class Cs extends br {
|
|
|
8670
8681
|
}
|
|
8671
8682
|
}
|
|
8672
8683
|
isBoxCollides(t, e, n, i, r, s) {
|
|
8673
|
-
if (this.
|
|
8674
|
-
if (t.geometry.properties.isEmpty) return
|
|
8684
|
+
if (this.Ns(t.geometry)) return us.call(this, 0, t, e, n, i, r, s);
|
|
8685
|
+
if (t.geometry.properties.isEmpty) return Os;
|
|
8675
8686
|
const {aTerrainAltitude: o} = t.geometry.properties;
|
|
8676
8687
|
if (o) {
|
|
8677
|
-
if (o[2 * e[i]] === xt) return
|
|
8688
|
+
if (o[2 * e[i]] === xt) return Os;
|
|
8678
8689
|
}
|
|
8679
|
-
const a = this.getMap(), {boxes: l, collision: h} = this.
|
|
8690
|
+
const a = this.getMap(), {boxes: l, collision: h} = this.Ss(t, i);
|
|
8680
8691
|
let u = 0, c = 0, f = 0;
|
|
8681
8692
|
for (let n = i; n < r; n += 6) {
|
|
8682
8693
|
const i = l[f] = l[f] || [];
|
|
8683
8694
|
f++;
|
|
8684
|
-
const r =
|
|
8695
|
+
const r = Gr.call(this, i, t, e[n], s, a);
|
|
8685
8696
|
if (!u) {
|
|
8686
8697
|
const t = this.isCollides(r);
|
|
8687
8698
|
1 === t ? u = 1 : -1 === t && c++;
|
|
@@ -8725,7 +8736,7 @@ class Cs extends br {
|
|
|
8725
8736
|
}
|
|
8726
8737
|
};
|
|
8727
8738
|
this.shader = new n.MeshShader({
|
|
8728
|
-
vert:
|
|
8739
|
+
vert: Sr,
|
|
8729
8740
|
frag: "#define SHADER_NAME MARKER\n#define HAS_HIGHLIGHT_COLOR_POINT 1\nprecision mediump float;\n#include <gl2_frag>\nuniform float alphaTest;\nuniform sampler2D iconTex;\nuniform lowp float markerOpacity;\nuniform lowp float blendSrcIsOne;\nuniform float layerOpacity;\n#include <highlight_frag>\nvarying vec2 vTexCoord;\nvarying float vOpacity;\nvoid main() {\n vec4 c = texture2D(iconTex, vTexCoord) * markerOpacity * vOpacity * layerOpacity;\n if(c.a < .05) {\n discard;\n }\n glFragColor = c;\n glFragColor = highlight_blendColor(glFragColor);\n if(glFragColor.a < alphaTest) {\n discard;\n }\n glFragColor = highlight_blendColor(glFragColor);\n#if __VERSION__ == 100\ngl_FragColor = glFragColor;\n#endif\n}",
|
|
8730
8741
|
uniforms: [ {
|
|
8731
8742
|
name: "projViewModelMatrix",
|
|
@@ -8742,16 +8753,16 @@ class Cs extends br {
|
|
|
8742
8753
|
} ],
|
|
8743
8754
|
extraCommandProps: i
|
|
8744
8755
|
}), this.shader.version = 300;
|
|
8745
|
-
const {uniforms: s, extraCommandProps: o} =
|
|
8746
|
-
if (this.
|
|
8747
|
-
vert:
|
|
8748
|
-
frag:
|
|
8756
|
+
const {uniforms: s, extraCommandProps: o} = rs.call(this, e, this.sceneConfig), a = this.Rs || {};
|
|
8757
|
+
if (this.Vs = new n.MeshShader({
|
|
8758
|
+
vert: ps,
|
|
8759
|
+
frag: ms,
|
|
8749
8760
|
uniforms: s,
|
|
8750
8761
|
extraCommandProps: o,
|
|
8751
8762
|
defines: a
|
|
8752
8763
|
}), this.pickingFBO) {
|
|
8753
8764
|
const t = new n.FBORayPicking(this.renderer, {
|
|
8754
|
-
vert: "#define PICKING_MODE 1\n" +
|
|
8765
|
+
vert: "#define PICKING_MODE 1\n" + Sr,
|
|
8755
8766
|
uniforms: [ {
|
|
8756
8767
|
name: "projViewModelMatrix",
|
|
8757
8768
|
type: "function",
|
|
@@ -8769,7 +8780,7 @@ class Cs extends br {
|
|
|
8769
8780
|
}, this.pickingFBO, this.getMap());
|
|
8770
8781
|
t.filter = t => !!t.geometry.properties.iconAtlas;
|
|
8771
8782
|
const e = new n.FBORayPicking(this.renderer, {
|
|
8772
|
-
vert: "#define PICKING_MODE 1\n" +
|
|
8783
|
+
vert: "#define PICKING_MODE 1\n" + ps,
|
|
8773
8784
|
uniforms: s,
|
|
8774
8785
|
extraCommandProps: o
|
|
8775
8786
|
}, this.pickingFBO, this.getMap());
|
|
@@ -8777,7 +8788,7 @@ class Cs extends br {
|
|
|
8777
8788
|
}
|
|
8778
8789
|
}
|
|
8779
8790
|
getUniformValues(e, n) {
|
|
8780
|
-
const i = n && n.isRenderingTerrainSkin, r = this.layer.getTileSize().width, s = i ?
|
|
8791
|
+
const i = n && n.isRenderingTerrainSkin, r = this.layer.getTileSize().width, s = i ? Fs : e.projViewMatrix, o = e.cameraToCenterDistance, a = h.set(Cs, e.width, e.height);
|
|
8781
8792
|
i && h.set(a, r, r);
|
|
8782
8793
|
const l = this.getBlendFunc(), u = t.Util.isFunction(l.src) ? l.src() : l.src;
|
|
8783
8794
|
return {
|
|
@@ -8787,7 +8798,7 @@ class Cs extends br {
|
|
|
8787
8798
|
projViewMatrix: s,
|
|
8788
8799
|
cameraToCenterDistance: o,
|
|
8789
8800
|
canvasSize: a,
|
|
8790
|
-
iconSize:
|
|
8801
|
+
iconSize: Is,
|
|
8791
8802
|
resolution: e.getResolution(),
|
|
8792
8803
|
glyphSize: 24,
|
|
8793
8804
|
gammaScale: 1,
|
|
@@ -8797,28 +8808,28 @@ class Cs extends br {
|
|
|
8797
8808
|
};
|
|
8798
8809
|
}
|
|
8799
8810
|
getUniqueEntryKey(t, e) {
|
|
8800
|
-
if (!this.
|
|
8811
|
+
if (!this.Ns(t.geometry)) return null;
|
|
8801
8812
|
const {elements: n} = t.geometry.properties;
|
|
8802
|
-
return
|
|
8813
|
+
return cs(t, n[e]);
|
|
8803
8814
|
}
|
|
8804
|
-
|
|
8815
|
+
Ls(t) {
|
|
8805
8816
|
const {symbolIndex: e} = t.properties;
|
|
8806
8817
|
return 0 === e.type;
|
|
8807
8818
|
}
|
|
8808
|
-
|
|
8819
|
+
Ns(t) {
|
|
8809
8820
|
const {symbolIndex: e} = t.properties;
|
|
8810
8821
|
return 1 === e.type;
|
|
8811
8822
|
}
|
|
8812
8823
|
}
|
|
8813
8824
|
|
|
8814
|
-
function
|
|
8825
|
+
function Ds(t, e) {
|
|
8815
8826
|
return t.properties.level - e.properties.level || t.properties.meshKey - e.properties.meshKey;
|
|
8816
8827
|
}
|
|
8817
8828
|
|
|
8818
|
-
const
|
|
8829
|
+
const Rs = [], Ls = [], Ns = [];
|
|
8819
8830
|
|
|
8820
|
-
function
|
|
8821
|
-
const {aGlyphOffset: m, aSegment: y, aTextDx: g, aTextDy: v, symbolIndex: x} = e.geometry.properties, b = this.getSymbol(x), A = g ? g[s] : b.textDx, w = v ? v[s] : b.textDy, _ = h.set(
|
|
8831
|
+
function Hs(t, e, n, r, s, o, a, l, u, c, f, d, p) {
|
|
8832
|
+
const {aGlyphOffset: m, aSegment: y, aTextDx: g, aTextDy: v, symbolIndex: x} = e.geometry.properties, b = this.getSymbol(x), A = g ? g[s] : b.textDx, w = v ? v[s] : b.textDy, _ = h.set(Ns, A || 0, w || 0), S = h.set(Rs, m[2 * s], m[2 * s + 1]), M = i.set(Ls, y[3 * s], y[3 * s + 1], y[3 * s + 2]);
|
|
8822
8833
|
return function(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, m, y, g) {
|
|
8823
8834
|
p || (p = i);
|
|
8824
8835
|
const v = e.geometry.properties.line, x = s[0] * c, b = f ? x - o : x + o;
|
|
@@ -8846,45 +8857,45 @@ function Ns(t, e, n, r, s, o, a, l, u, c, f, d, p) {
|
|
|
8846
8857
|
}(t, e, r, o, a, S, _[0], _[1], M[0], M[1], M[2], n / 24, u, l, c, f, d, p);
|
|
8847
8858
|
}
|
|
8848
8859
|
|
|
8849
|
-
const
|
|
8860
|
+
const zs = [], Vs = [];
|
|
8850
8861
|
|
|
8851
|
-
function
|
|
8862
|
+
function Us(t, e, n, r, s, o, a, l, u, c, f, d) {
|
|
8852
8863
|
const {aVertical: p} = n.geometry.properties, m = p[o];
|
|
8853
|
-
let y, g, v =
|
|
8864
|
+
let y, g, v = Hs.call(this, zs, n, r, s, o, l, u, c, !1);
|
|
8854
8865
|
if (!v) return null;
|
|
8855
|
-
if (i.copy(t, v), v =
|
|
8856
|
-
if (i.copy(e, v), d && (h.transformMat2(
|
|
8866
|
+
if (i.copy(t, v), v = Hs.call(this, Vs, n, r, s, a, l, u, c, !1), !v) return null;
|
|
8867
|
+
if (i.copy(e, v), d && (h.transformMat2(zs, zs, d), h.transformMat2(Vs, Vs, d)),
|
|
8857
8868
|
m) {
|
|
8858
|
-
const t = Math.abs(
|
|
8859
|
-
g =
|
|
8860
|
-
} else y = 0, g =
|
|
8869
|
+
const t = Math.abs(Vs[1] - zs[1]), e = Math.abs(Vs[0] - zs[0]) * f;
|
|
8870
|
+
g = zs[0] > Vs[0] ? 1 : 0, t > e ? (y = 1, g = zs[1] < Vs[1] ? 0 : 1) : y = 0;
|
|
8871
|
+
} else y = 0, g = zs[0] > Vs[0] ? 1 : 0;
|
|
8861
8872
|
return 2 * g + y;
|
|
8862
8873
|
}
|
|
8863
8874
|
|
|
8864
|
-
var
|
|
8875
|
+
var js = "#define SHADER_NAME TEXT_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aTexCoord;\n#ifdef HAS_OFFSET_Z\nattribute vec3 aOffset;\nuniform float altitudeScale;\n#else\nattribute vec2 aOffset;\n#endif\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\nuniform float zoomScale;\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform float mapPitch;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\nuniform float textPitchFilter;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_DX\nfloat d = aTextDx;\n#else\nfloat d = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat e = aTextDy;\n#else\nfloat e = textDy;\n#endif\n#ifdef HAS_TEXT_SIZE\nfloat f = aTextSize * layerScale;\n#else\nfloat f = textSize * layerScale;\n#endif\n#ifdef HAS_PITCH_ALIGN\nfloat h = aPitchAlign;\n#else\nfloat h = pitchWithMap;\n#endif\ngl_Position = projViewModelMatrix * vec4(c, 1.);\n float i = gl_Position.w;\n float j = i / cameraToCenterDistance;\n float k;\n if(isRenderingTerrain == 1.) {\n k = 1.;\n } else {\n float l = (1. - cameraToCenterDistance / i) * textPerspectiveRatio;\n k = clamp(.5 + .5 * (1. - l), .0, 4.);\n }\n#ifdef HAS_OFFSET_Z\nvec3 m = aOffset / 10.0;\n m[2] /= altitudeScale;\n#else\nvec3 m = vec3(aOffset / 10.0, .0);\n#endif\nvec2 n = aTexCoord;\n if(h == 1.) {\n float o;\n if(isRenderingTerrain == 1.) {\n o = tileRatio;\n } else {\n o = tileRatio / zoomScale * j * k;\n }\n m.xy *= o;\n gl_Position = projViewModelMatrix * vec4(c + m, 1.);\n } else {\n gl_Position.xy += m.xy * 2. / canvasSize * k * i;\n }\n gl_Position.xy += vec2(d, -e) * 2. / canvasSize * i;\n if(textPitchFilter > .0) {\n if(textPitchFilter == 1. && h == .0 || textPitchFilter == 2. && h == 1.) {\n gl_Position = vec4(-9999., -9999., .0, 1.);\n }\n }\n#ifndef PICKING_MODE\nif(h == 1.) {\n vGammaScale = j + mapPitch / 4.;\n } else {\n vGammaScale = mix(1., j, textPerspectiveRatio);\n }\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vTexCoord = n / texSize;\n vSize = f;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool u = aOpacity == 255.;\n#else\nbool u = true;\n#endif\nfbo_picking_setData(gl_Position.w, u);\n#endif\n}";
|
|
8865
8876
|
|
|
8866
|
-
const
|
|
8877
|
+
const Bs = function(t) {
|
|
8867
8878
|
const e = this.layer.getRenderer();
|
|
8868
|
-
return !this.
|
|
8869
|
-
}, Bs = function(t) {
|
|
8870
|
-
const e = this.layer.getRenderer();
|
|
8871
|
-
return !this.Ps(t) && !e.isForeground(t) && "line" !== t.geometry.properties.textPlacement;
|
|
8879
|
+
return !this.Ts(t) && e.isTileNearCamera(t) && "line" !== t.geometry.properties.textPlacement;
|
|
8872
8880
|
}, Gs = function(t) {
|
|
8873
8881
|
const e = this.layer.getRenderer();
|
|
8874
|
-
return !this.
|
|
8882
|
+
return !this.Ts(t) && !e.isForeground(t) && "line" !== t.geometry.properties.textPlacement;
|
|
8875
8883
|
}, Ws = function(t) {
|
|
8884
|
+
const e = this.layer.getRenderer();
|
|
8885
|
+
return !this.Ts(t) && e.isTileNearCamera(t) && "line" === t.geometry.properties.textPlacement;
|
|
8886
|
+
}, Xs = function(t) {
|
|
8876
8887
|
const e = this.layer.getRenderer(), n = t.properties.tile.z, i = e.getCurrentTileZoom();
|
|
8877
|
-
return !this.
|
|
8878
|
-
},
|
|
8888
|
+
return !this.Ts(t) && !e.isForeground(t) && "line" === t.geometry.properties.textPlacement && n < i;
|
|
8889
|
+
}, Ys = [ 0, 0, 3 ], $s = [], qs = [], Js = [], Ks = [], Zs = [], Qs = [], to = [], eo = [], no = [ 1, -1 ], io = new Int16Array(3), ro = [], so = [], oo = [], ao = [], lo = [], ho = [], uo = [], co = {}, fo = {}, po = {}, mo = [], yo = [], go = r.identity([]), vo = [];
|
|
8879
8890
|
|
|
8880
|
-
class
|
|
8891
|
+
class xo extends br {
|
|
8881
8892
|
static getBloomSymbol() {
|
|
8882
8893
|
return [ "textBloom" ];
|
|
8883
8894
|
}
|
|
8884
8895
|
constructor(t, e, n, i, r, s) {
|
|
8885
8896
|
super(t, e, n, i, r, s), this.propAllowOverlap = "textAllowOverlap", this.propIgnorePlacement = "textIgnorePlacement",
|
|
8886
|
-
this.colorCache = {}, this
|
|
8887
|
-
this.
|
|
8897
|
+
this.colorCache = {}, this.$s = Bs.bind(this), this.qs = Gs.bind(this), this.Js = Ws.bind(this),
|
|
8898
|
+
this.Ks = Xs.bind(this), this.isLabelCollides = us.bind(this), this.Zs();
|
|
8888
8899
|
}
|
|
8889
8900
|
prepareRender(...t) {
|
|
8890
8901
|
super.prepareRender(...t);
|
|
@@ -8896,44 +8907,44 @@ class vo extends br {
|
|
|
8896
8907
|
}
|
|
8897
8908
|
}
|
|
8898
8909
|
updateSymbol(...t) {
|
|
8899
|
-
this.
|
|
8910
|
+
this.Qs = void 0, this.to = void 0;
|
|
8900
8911
|
const e = super.updateSymbol(...t);
|
|
8901
|
-
return this.
|
|
8912
|
+
return this.Zs(), e;
|
|
8902
8913
|
}
|
|
8903
8914
|
isTerrainVector() {
|
|
8904
8915
|
if (!super.isTerrainSkin()) return !1;
|
|
8905
|
-
if (void 0 !== this.
|
|
8916
|
+
if (void 0 !== this.Qs) return this.Qs;
|
|
8906
8917
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
8907
|
-
if ("map" !== this.symbolDef[t].textPitchAlignment) return this.
|
|
8918
|
+
if ("map" !== this.symbolDef[t].textPitchAlignment) return this.Qs = !0, !0;
|
|
8908
8919
|
}
|
|
8909
|
-
return this.
|
|
8920
|
+
return this.Qs = !1, !1;
|
|
8910
8921
|
}
|
|
8911
8922
|
isTerrainSkin() {
|
|
8912
8923
|
if (!super.isTerrainSkin()) return !1;
|
|
8913
|
-
if (void 0 !== this.
|
|
8924
|
+
if (void 0 !== this.to) return this.to;
|
|
8914
8925
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
8915
8926
|
const e = this.symbolDef[t].textPitchAlignment;
|
|
8916
|
-
if ("map" === e || p(e) || b.isExpression(e)) return this.
|
|
8927
|
+
if ("map" === e || p(e) || b.isExpression(e)) return this.to = !0, !0;
|
|
8917
8928
|
}
|
|
8918
|
-
return this.
|
|
8929
|
+
return this.to = !1, !1;
|
|
8919
8930
|
}
|
|
8920
|
-
|
|
8921
|
-
this.
|
|
8931
|
+
Zs() {
|
|
8932
|
+
this.eo = [];
|
|
8922
8933
|
for (let t = 0; t < this.symbolDef.length; t++) {
|
|
8923
8934
|
const e = this.symbolDef[t];
|
|
8924
8935
|
if (b.isExpression(e.textName)) {
|
|
8925
8936
|
const n = b.createExpression(e.textName, "string");
|
|
8926
|
-
this.
|
|
8937
|
+
this.eo[t] = (t, e) => {
|
|
8927
8938
|
let i;
|
|
8928
|
-
|
|
8939
|
+
co.zoom = t, fo.properties = e;
|
|
8929
8940
|
try {
|
|
8930
|
-
i = n.evaluateWithoutErrorHandling(
|
|
8941
|
+
i = n.evaluateWithoutErrorHandling(co, fo, po, null, mo);
|
|
8931
8942
|
} catch (t) {
|
|
8932
8943
|
i = null;
|
|
8933
8944
|
}
|
|
8934
8945
|
return i;
|
|
8935
8946
|
};
|
|
8936
|
-
} else p(e.textName) && (this.
|
|
8947
|
+
} else p(e.textName) && (this.eo[t] = g(e.textName));
|
|
8937
8948
|
}
|
|
8938
8949
|
}
|
|
8939
8950
|
shouldDeleteMeshOnUpdateSymbol(t) {
|
|
@@ -8942,10 +8953,10 @@ class vo extends br {
|
|
|
8942
8953
|
return !1;
|
|
8943
8954
|
}
|
|
8944
8955
|
createFnTypeConfig(t, e) {
|
|
8945
|
-
return
|
|
8956
|
+
return ss(t, e);
|
|
8946
8957
|
}
|
|
8947
8958
|
isBloom(t) {
|
|
8948
|
-
return !!this.getSymbol(t.properties.symbolIndex)[
|
|
8959
|
+
return !!this.getSymbol(t.properties.symbolIndex)[xo.getBloomSymbol()[0]];
|
|
8949
8960
|
}
|
|
8950
8961
|
createGeometry(t, e, n) {
|
|
8951
8962
|
const i = t;
|
|
@@ -8960,9 +8971,9 @@ class vo extends br {
|
|
|
8960
8971
|
createMesh(t, e, {tileVectorTransform: n}) {
|
|
8961
8972
|
const i = this.isEnableCollision(), r = this.isEnableUniquePlacement(), {geometry: s, symbolIndex: o} = t;
|
|
8962
8973
|
s.properties.symbolIndex = o;
|
|
8963
|
-
const a = this.getSymbol(o), l = this.getSymbolDef(o), h = this.getFnTypeConfig(o), u =
|
|
8974
|
+
const a = this.getSymbol(o), l = this.getSymbolDef(o), h = this.getFnTypeConfig(o), u = es.call(this, this.regl, s, e, l, a, h, this.layer.options.collision, !i, r);
|
|
8964
8975
|
if (u.length) {
|
|
8965
|
-
"line" === s.properties.textPlacement ? this.
|
|
8976
|
+
"line" === s.properties.textPlacement ? this.no = !0 : this.io = !0;
|
|
8966
8977
|
}
|
|
8967
8978
|
return u.forEach(t => {
|
|
8968
8979
|
t.positionMatrix = this.getAltitudeOffsetMatrix(), t.properties.tileVectorTransform = n;
|
|
@@ -8971,24 +8982,24 @@ class vo extends br {
|
|
|
8971
8982
|
updateCollision(t) {
|
|
8972
8983
|
super.updateCollision(t);
|
|
8973
8984
|
const e = this.scene.getMeshes();
|
|
8974
|
-
e && e.length ? (this.
|
|
8985
|
+
e && e.length ? (this.ro = {}, this.so(t.timestamp), this.zr()) : this.zr();
|
|
8975
8986
|
}
|
|
8976
8987
|
callCurrentTileShader(t, e) {
|
|
8977
|
-
this.shader.filter = e.sceneFilter ? [ this
|
|
8978
|
-
this.
|
|
8988
|
+
this.shader.filter = e.sceneFilter ? [ this.$s, e.sceneFilter ] : this.$s, this.callRenderer(this.shader, t, e),
|
|
8989
|
+
this.oo.filter = e.sceneFilter ? [ this.Js, e.sceneFilter ] : this.Js, this.callRenderer(this.oo, t, e);
|
|
8979
8990
|
}
|
|
8980
8991
|
callBackgroundTileShader(t, e) {
|
|
8981
|
-
this.shader.filter = e.sceneFilter ? [ this
|
|
8982
|
-
this.
|
|
8992
|
+
this.shader.filter = e.sceneFilter ? [ this.qs, e.sceneFilter ] : this.qs, this.callRenderer(this.shader, t, e),
|
|
8993
|
+
this.oo.filter = e.sceneFilter ? [ this.Ks, e.sceneFilter ] : this.Ks, this.callRenderer(this.oo, t, e);
|
|
8983
8994
|
}
|
|
8984
8995
|
callRenderer(t, e, n) {
|
|
8985
8996
|
n && n.isRenderingTerrain && p(this.symbolDef.textPitchAlignment) && (n.isRenderingTerrainSkin ? e.textPitchFilter = 1 : e.textPitchFilter = 2),
|
|
8986
8997
|
super.callRenderer(t, e, n);
|
|
8987
8998
|
}
|
|
8988
|
-
|
|
8999
|
+
so() {
|
|
8989
9000
|
let t = this.scene.getMeshes();
|
|
8990
9001
|
if (!t || !t.length) return;
|
|
8991
|
-
const e = -this.getMap().getBearing() * Math.PI / 180, n = u.fromRotation(
|
|
9002
|
+
const e = -this.getMap().getBearing() * Math.PI / 180, n = u.fromRotation(Js, e), i = (t, e, n, i) => {
|
|
8992
9003
|
const {start: r, end: s, mesh: o, allElements: a} = e[0];
|
|
8993
9004
|
if (this.updateBoxCollisionFading(!0, o, e, n, i)) {
|
|
8994
9005
|
let e = t.count;
|
|
@@ -8996,7 +9007,7 @@ class vo extends br {
|
|
|
8996
9007
|
t.count = e;
|
|
8997
9008
|
}
|
|
8998
9009
|
}, r = this.isEnableCollision(), s = this.layer.getRenderer();
|
|
8999
|
-
t = t.sort(
|
|
9010
|
+
t = t.sort(Ao);
|
|
9000
9011
|
for (let e = 0; e < t.length; e++) {
|
|
9001
9012
|
const o = t[e];
|
|
9002
9013
|
if (!this.isMeshIterable(o)) continue;
|
|
@@ -9006,11 +9017,11 @@ class vo extends br {
|
|
|
9006
9017
|
continue;
|
|
9007
9018
|
}
|
|
9008
9019
|
const a = o.geometry, l = this.getSymbol(o.properties.symbolIndex);
|
|
9009
|
-
o.properties.textHaloRadius = It(l.textHaloRadius) ?
|
|
9020
|
+
o.properties.textHaloRadius = It(l.textHaloRadius) ? ts.textHaloRadius : l.textHaloRadius;
|
|
9010
9021
|
const h = o.properties.meshKey;
|
|
9011
9022
|
if ("line" === a.properties.textPlacement) {
|
|
9012
9023
|
if (!a.properties.line) continue;
|
|
9013
|
-
r && this.startMeshCollision(o), this.
|
|
9024
|
+
r && this.startMeshCollision(o), this.ao(o, n);
|
|
9014
9025
|
const {aOffset: t, aOpacity: e} = a.properties;
|
|
9015
9026
|
t.dirty && (a.updateData("aOffset", t), t.dirty = !1), e && e.dirty && (a.updateData("aOpacity", e),
|
|
9016
9027
|
e.dirty = !1), r && this.endMeshCollision(h);
|
|
@@ -9033,18 +9044,18 @@ class vo extends br {
|
|
|
9033
9044
|
return "line" !== this.getSymbol(t.properties.symbolIndex).textPlacement;
|
|
9034
9045
|
}
|
|
9035
9046
|
getUniqueEntryKey(t, e) {
|
|
9036
|
-
return
|
|
9047
|
+
return cs(t, e);
|
|
9037
9048
|
}
|
|
9038
|
-
|
|
9049
|
+
ao(t, e) {
|
|
9039
9050
|
const n = this.getMap(), i = t.geometry, s = i.properties;
|
|
9040
9051
|
let o = s.line;
|
|
9041
9052
|
if (!o) return;
|
|
9042
9053
|
const a = n.getPitch(), l = n.getBearing(), {lineTextPitch: h, lineTextBearing: u} = t.properties, c = 1 === t.material.uniforms.pitchWithMap, f = s.elements;
|
|
9043
9054
|
if (!c) {
|
|
9044
|
-
const e = r.multiply(
|
|
9055
|
+
const e = r.multiply($s, n.projViewMatrix, t.localTransform), i = o.id + "-" + e.join();
|
|
9045
9056
|
let a;
|
|
9046
|
-
this.
|
|
9047
|
-
o = this.
|
|
9057
|
+
this.ro[i] ? o = this.ro[i] : (a = s.projectedLine = s.projectedLine || new Array(o.length),
|
|
9058
|
+
o = this.lo(a, o, e, n.width, n.height), this.ro[i] = a);
|
|
9048
9059
|
}
|
|
9049
9060
|
const d = this.isEnableCollision(), p = i.properties.visElemts = i.properties.visElemts || new f.constructor(f.length), m = i.properties.visCache = i.properties.visCache || [];
|
|
9050
9061
|
d && (p.count = 0);
|
|
@@ -9052,7 +9063,7 @@ class vo extends br {
|
|
|
9052
9063
|
this.forEachBox(t, (t, n, i, r) => {
|
|
9053
9064
|
const {start: s, end: a} = n[0];
|
|
9054
9065
|
let l = m[r];
|
|
9055
|
-
if ((void 0 === l || y) && (l = this.
|
|
9066
|
+
if ((void 0 === l || y) && (l = this.ho(t, f, s, a, o, i, c ? e : null, r)), m[r] = l,
|
|
9056
9067
|
d && (l = this.updateBoxCollisionFading(l, t, n, i, r), l)) {
|
|
9057
9068
|
let t = p.count;
|
|
9058
9069
|
for (let e = s; e < a; e++) p[t++] = f[e];
|
|
@@ -9062,7 +9073,7 @@ class vo extends br {
|
|
|
9062
9073
|
const g = t.geometry.properties.aAltitude;
|
|
9063
9074
|
g && g.dirty && (i.updateData("aAltitude", g), g.dirty = !1), !d || p.count === f.length && i.count === p.count || i.setElements(p, p.count);
|
|
9064
9075
|
}
|
|
9065
|
-
|
|
9076
|
+
lo(t, e, n, i, r) {
|
|
9066
9077
|
return function(t, e, n, i, r) {
|
|
9067
9078
|
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),
|
|
9068
9079
|
t[s] = xi[0], t[s + 1] = xi[1], t[s + 2] = e[s + 2];
|
|
@@ -9070,15 +9081,15 @@ class vo extends br {
|
|
|
9070
9081
|
}(t, e, n, i, r);
|
|
9071
9082
|
}
|
|
9072
9083
|
forEachBox(t, e) {
|
|
9073
|
-
const n = this.getMap(), i = r.multiply(
|
|
9084
|
+
const n = this.getMap(), i = r.multiply($s, n.projViewMatrix, t.properties.tileVectorTransform), {collideIds: s, aCount: o, features: a, elements: l} = t.geometry.properties, h = s;
|
|
9074
9085
|
if (!h) return;
|
|
9075
|
-
const u = this.isEnableUniquePlacement(), c = this.
|
|
9086
|
+
const u = this.isEnableUniquePlacement(), c = this.Ms(1);
|
|
9076
9087
|
c[0].allElements = l, c[0].mesh = t;
|
|
9077
9088
|
let f = 0, d = l[0], p = 0, m = h[d];
|
|
9078
9089
|
for (let n = 0; n <= l.length; n += 6) if (d = l[n], h[d] !== m || n === l.length) {
|
|
9079
9090
|
const r = a[m] && a[m].feature;
|
|
9080
9091
|
if (u && this.isMeshUniquePlaced(t) && r && !r.label) {
|
|
9081
|
-
const e = r.properties || {}, {symbolIndex: n} = t.properties, i = n && this.
|
|
9092
|
+
const e = r.properties || {}, {symbolIndex: n} = t.properties, i = n && this.eo[n.index] ? this.eo[n.index](t.properties.z, e) : this.getSymbol(t.properties.symbolIndex).textName, s = R.resolveText(i, e);
|
|
9082
9093
|
r.label = s;
|
|
9083
9094
|
}
|
|
9084
9095
|
const s = n, y = o[l[p]];
|
|
@@ -9087,65 +9098,65 @@ class vo extends br {
|
|
|
9087
9098
|
m = h[d], p = n;
|
|
9088
9099
|
}
|
|
9089
9100
|
}
|
|
9090
|
-
|
|
9101
|
+
ho(t, e, n, s, o, l, u) {
|
|
9091
9102
|
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;
|
|
9092
9103
|
let {aProjectedAnchor: P} = v.properties;
|
|
9093
9104
|
P || (P = v.properties.aProjectedAnchor = new Array(_.length / x * 3));
|
|
9094
9105
|
const T = v.properties.aTextSize, k = !u, O = e[n], I = O * x;
|
|
9095
9106
|
let F;
|
|
9096
|
-
F = v.data.aAltitude ? i.set(
|
|
9097
|
-
const C = bi(
|
|
9107
|
+
F = v.data.aAltitude ? i.set(Ks, _[I], _[I + 1], S[O]) : A.unpackPosition(Ks, _[I], _[I + 1], _[I + 2]);
|
|
9108
|
+
const C = bi(Zs, F, l, g.width, g.height), E = v.properties.aTerrainAltitude;
|
|
9098
9109
|
let D;
|
|
9099
9110
|
if (E) {
|
|
9100
9111
|
const t = E[O];
|
|
9101
9112
|
if (t === xt) return P[3 * O] = -999999, P[3 * O + 1] = -999999, P[3 * O + 2] = -999999,
|
|
9102
9113
|
!1;
|
|
9103
|
-
t ? (D = i.set(
|
|
9114
|
+
t ? (D = i.set(yo, ...F), D[2] = 100 * t, D = bi(D, D, l, g.width, g.height)) : D = C;
|
|
9104
9115
|
} else D = C;
|
|
9105
9116
|
const R = g.getDevicePixelRatio();
|
|
9106
|
-
if (a.scale(
|
|
9117
|
+
if (a.scale(vo, D, 1 / R), g.isOffscreen(vo)) return y || bo(w, e, n, s), P[3 * O] = -999999,
|
|
9107
9118
|
P[3 * O + 1] = -999999, P[3 * O + 2] = -999999, !1;
|
|
9108
9119
|
k && (F = C), P[3 * O] = D[0], P[3 * O + 1] = D[1], P[3 * O + 2] = D[2];
|
|
9109
9120
|
const L = k ? 1 : v.properties.tileExtent / this.layer.getTileSize().width;
|
|
9110
9121
|
let N = !0;
|
|
9111
|
-
const H = e[n], z = e[s - 1], V = T ? T[H] : t.properties.textSize, U = this.
|
|
9112
|
-
if (null === U) return
|
|
9122
|
+
const H = e[n], z = e[s - 1], V = T ? T[H] : t.properties.textSize, U = this.uo(t, V, o, H, z, F, Ks, L, u);
|
|
9123
|
+
if (null === U) return bo(w, e, n, s), !1;
|
|
9113
9124
|
const j = z - H <= 3, B = Math.floor(U / 2), G = U % 2;
|
|
9114
9125
|
for (let a = n; a < s; a += 6) {
|
|
9115
9126
|
const u = e[a];
|
|
9116
9127
|
let f;
|
|
9117
|
-
if (f = B || a !== n || j || m ? B || a !== s - 6 || j || m ?
|
|
9128
|
+
if (f = B || a !== n || j || m ? B || a !== s - 6 || j || m ? Hs.call(this, qs, t, V, o, u, F, Ks, L, B, D, this.layer, l, p) : uo : ho,
|
|
9118
9129
|
!f) {
|
|
9119
|
-
N = !1, y ||
|
|
9130
|
+
N = !1, y || bo(w, e, n, s);
|
|
9120
9131
|
break;
|
|
9121
9132
|
}
|
|
9122
9133
|
let g = f[2];
|
|
9123
9134
|
G && (g -= Math.PI / 2);
|
|
9124
|
-
const v =
|
|
9135
|
+
const v = Er(Qs, g, 0, d.rotateWithMap, d.pitchWithMap), x = w.length > b.length;
|
|
9125
9136
|
let A;
|
|
9126
9137
|
if (x) {
|
|
9127
|
-
i.set(
|
|
9128
|
-
const t = i.normalize(
|
|
9138
|
+
i.set(ao, M[3 * u], M[3 * u + 1], 0);
|
|
9139
|
+
const t = i.normalize(ao, ao), e = -M[3 * u + 2];
|
|
9129
9140
|
if (e) {
|
|
9130
|
-
const n = c.setAxisAngle(
|
|
9131
|
-
r.fromTranslation(
|
|
9141
|
+
const n = c.setAxisAngle(ro, t, e);
|
|
9142
|
+
r.fromTranslation(so, Ys), r.fromQuat(oo, n), A = r.multiply(oo, oo, so);
|
|
9132
9143
|
}
|
|
9133
9144
|
}
|
|
9134
9145
|
for (let t = 0; t < 4; t++) {
|
|
9135
9146
|
const e = 2 * (u + t);
|
|
9136
|
-
h.set(
|
|
9137
|
-
p ? (h.multiply(
|
|
9138
|
-
h.add(
|
|
9147
|
+
h.set(to, b[e] / 10, b[e + 1] / 10), h.scale(to, to, V / 24), h.transformMat2(to, to, v),
|
|
9148
|
+
p ? (h.multiply(to, to, no), h.add(eo, to, f), x && (eo[2] = 0, A && i.transformMat4(eo, eo, A))) : (h.multiply(eo, f, no),
|
|
9149
|
+
h.add(eo, to, eo)), io[0] = 10 * eo[0], io[1] = 10 * eo[1], x && (io[2] = 10 * eo[2]);
|
|
9139
9150
|
const n = (x ? 3 : 2) * (u + t);
|
|
9140
|
-
(w[n] !==
|
|
9141
|
-
w[n] =
|
|
9151
|
+
(w[n] !== io[0] || w[n + 1] !== io[1] || x && w[n + 2] !== io[2]) && (w.dirty = !0,
|
|
9152
|
+
w[n] = io[0], w[n + 1] = io[1], x && (w[n + 2] = io[2]));
|
|
9142
9153
|
}
|
|
9143
9154
|
}
|
|
9144
9155
|
return N;
|
|
9145
9156
|
}
|
|
9146
|
-
|
|
9157
|
+
uo(t, e, n, i, r, s, o, a, l) {
|
|
9147
9158
|
const h = r - i <= 3, u = this.getMap();
|
|
9148
|
-
return h ? 0 :
|
|
9159
|
+
return h ? 0 : Us.call(this, ho, uo, t, e, n, i, r, s, o, a, u.width / u.height, l);
|
|
9149
9160
|
}
|
|
9150
9161
|
isBoxCollides(t, e, n, i, r, s) {
|
|
9151
9162
|
return this.isLabelCollides(0, t, e, n, i, r, s);
|
|
@@ -9156,7 +9167,7 @@ class vo extends br {
|
|
|
9156
9167
|
}) : t.material && delete t.material.uniforms.texture), super.deleteMesh(t, e));
|
|
9157
9168
|
}
|
|
9158
9169
|
delete() {
|
|
9159
|
-
super.delete(), this.
|
|
9170
|
+
super.delete(), this.oo.dispose(), delete this.ro, this.co && this.co.dispose();
|
|
9160
9171
|
}
|
|
9161
9172
|
needClearStencil() {
|
|
9162
9173
|
return !0;
|
|
@@ -9164,28 +9175,28 @@ class vo extends br {
|
|
|
9164
9175
|
init() {
|
|
9165
9176
|
const t = this.regl;
|
|
9166
9177
|
this.renderer = new n.Renderer(t);
|
|
9167
|
-
const {uniforms: e, extraCommandProps: i} =
|
|
9178
|
+
const {uniforms: e, extraCommandProps: i} = rs.call(this, this.canvas, this.sceneConfig), r = this.canvas, s = {
|
|
9168
9179
|
x: (t, e) => e.viewport ? e.viewport.x : 0,
|
|
9169
9180
|
y: (t, e) => e.viewport ? e.viewport.y : 0,
|
|
9170
9181
|
width: (t, e) => e.viewport ? e.viewport.width : r ? r.width : 1,
|
|
9171
9182
|
height: (t, e) => e.viewport ? e.viewport.height : r ? r.height : 1
|
|
9172
9183
|
};
|
|
9173
9184
|
i.viewport = s, this.shader = new n.MeshShader({
|
|
9174
|
-
vert:
|
|
9175
|
-
frag:
|
|
9185
|
+
vert: ps,
|
|
9186
|
+
frag: ms,
|
|
9176
9187
|
uniforms: e,
|
|
9177
9188
|
extraCommandProps: i
|
|
9178
9189
|
});
|
|
9179
9190
|
let o = i;
|
|
9180
9191
|
if (this.layer.getRenderer().isEnableWorkAround("win-intel-gpu-crash") && (o = Tt({}, i),
|
|
9181
|
-
o.stencil = Tt({}, i.stencil), o.stencil.enable = !0), this.
|
|
9182
|
-
vert:
|
|
9183
|
-
frag:
|
|
9192
|
+
o.stencil = Tt({}, i.stencil), o.stencil.enable = !0), this.oo = new n.MeshShader({
|
|
9193
|
+
vert: js,
|
|
9194
|
+
frag: ms,
|
|
9184
9195
|
uniforms: e,
|
|
9185
9196
|
extraCommandProps: o
|
|
9186
9197
|
}), this.pickingFBO) {
|
|
9187
9198
|
const t = new n.FBORayPicking(this.renderer, {
|
|
9188
|
-
vert: "#define PICKING_MODE 1\n" +
|
|
9199
|
+
vert: "#define PICKING_MODE 1\n" + ps,
|
|
9189
9200
|
uniforms: e,
|
|
9190
9201
|
extraCommandProps: {
|
|
9191
9202
|
viewport: this.pickingViewport
|
|
@@ -9196,7 +9207,7 @@ class vo extends br {
|
|
|
9196
9207
|
return "line" !== this.getSymbol(e).textPlacement;
|
|
9197
9208
|
};
|
|
9198
9209
|
const i = new n.FBORayPicking(this.renderer, {
|
|
9199
|
-
vert: "#define PICKING_MODE 1\n" +
|
|
9210
|
+
vert: "#define PICKING_MODE 1\n" + js,
|
|
9200
9211
|
uniforms: e,
|
|
9201
9212
|
extraCommandProps: {
|
|
9202
9213
|
viewport: this.pickingViewport
|
|
@@ -9206,7 +9217,7 @@ class vo extends br {
|
|
|
9206
9217
|
}
|
|
9207
9218
|
}
|
|
9208
9219
|
getUniformValues(t, e) {
|
|
9209
|
-
const n = e && e.isRenderingTerrainSkin, i = this.layer.getTileSize().width, r = n ?
|
|
9220
|
+
const n = e && e.isRenderingTerrainSkin, i = this.layer.getTileSize().width, r = n ? go : t.projViewMatrix, s = t.cameraToCenterDistance, o = h.set(lo, t.width, t.height);
|
|
9210
9221
|
n && h.set(o, i, i);
|
|
9211
9222
|
const a = lt(t.getResolution(), t);
|
|
9212
9223
|
return {
|
|
@@ -9228,7 +9239,7 @@ class vo extends br {
|
|
|
9228
9239
|
}
|
|
9229
9240
|
}
|
|
9230
9241
|
|
|
9231
|
-
function
|
|
9242
|
+
function bo(t, e, n, i) {
|
|
9232
9243
|
for (let r = n; r < i; r += 6) {
|
|
9233
9244
|
const n = e[r];
|
|
9234
9245
|
for (let e = 0; e < 4; e++) {
|
|
@@ -9238,20 +9249,20 @@ function xo(t, e, n, i) {
|
|
|
9238
9249
|
}
|
|
9239
9250
|
}
|
|
9240
9251
|
|
|
9241
|
-
function
|
|
9252
|
+
function Ao(t, e) {
|
|
9242
9253
|
const n = t.properties.level - e.properties.level;
|
|
9243
9254
|
return 0 === n ? t.properties.meshKey - e.properties.meshKey : n;
|
|
9244
9255
|
}
|
|
9245
9256
|
|
|
9246
|
-
var
|
|
9257
|
+
var wo = "#define SHADER_NAME NATIVE_POINT\n#include <gl2_vert>\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\n#ifdef HAS_COLOR\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float markerSize;\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n gl_PointSize = markerSize;\n#ifdef HAS_COLOR\nvColor = aColor / 255.;\n#endif\n#ifdef PICKING_MODE\nfbo_picking_setData(gl_Position.w, true);\n#endif\n}";
|
|
9247
9258
|
|
|
9248
|
-
const
|
|
9259
|
+
const _o = {
|
|
9249
9260
|
markerFill: [ 0, 0, 0 ],
|
|
9250
9261
|
markerOpacity: 1,
|
|
9251
9262
|
markerSize: 10
|
|
9252
9263
|
};
|
|
9253
9264
|
|
|
9254
|
-
class
|
|
9265
|
+
class So extends Bi {
|
|
9255
9266
|
getPrimitive() {
|
|
9256
9267
|
return "points";
|
|
9257
9268
|
}
|
|
@@ -9269,7 +9280,7 @@ class _o extends Bi {
|
|
|
9269
9280
|
const a = {};
|
|
9270
9281
|
Ct(a, "markerOpacity", o, "markerOpacity", 1), Ct(a, "markerSize", o, "markerSize", 10),
|
|
9271
9282
|
Ct(a, "markerFill", o, "markerFill", "#000", Rt(this.colorCache, 3));
|
|
9272
|
-
const l = new n.Material(a,
|
|
9283
|
+
const l = new n.Material(a, _o);
|
|
9273
9284
|
l.createDefines = () => "square" !== o.markerType ? {
|
|
9274
9285
|
USE_CIRCLE: 1
|
|
9275
9286
|
} : null, l.appendDefines = t => ("square" !== o.markerType && (t.USE_CIRCLE = 1),
|
|
@@ -9301,7 +9312,7 @@ class _o extends Bi {
|
|
|
9301
9312
|
const t = this.regl;
|
|
9302
9313
|
this.renderer = new n.Renderer(t);
|
|
9303
9314
|
const e = [], i = {
|
|
9304
|
-
vert:
|
|
9315
|
+
vert: wo,
|
|
9305
9316
|
frag: "#define SHADER_NAME NATIVE_POINT\nprecision mediump float;\n#include <gl2_frag>\n#ifdef USE_CIRCLE\n#if __VERSION__ == 100\n#ifdef GL_OES_standard_derivatives\n#define STANDARD_DERIVATIVES_ENABLED 1\n#extension GL_OES_standard_derivatives : enable\n#endif\n#else\n#define STANDARD_DERIVATIVES_ENABLED 1\n#endif\n#endif\n#ifdef HAS_COLOR\nvarying vec4 vColor;\n#else\nuniform vec3 markerFill;\n#endif\nuniform float markerOpacity;\nuniform float layerOpacity;\nvoid main() {\n float c = 1.;\n#ifdef USE_CIRCLE\nfloat r = .0, d = .0;\n vec2 e = 2. * gl_PointCoord - 1.;\n r = dot(e, e);\n if(r > 1.) {\n discard;\n }\n#ifdef STANDARD_DERIVATIVES_ENABLED\nd = fwidth(r);\n c = 1. - smoothstep(1. - d, 1. + d, r);\n#endif\n#endif\n#ifdef HAS_COLOR\nvec4 f = vColor;\n#else\nvec4 f = vec4(markerFill, 1.);\n#endif\nglFragColor = f * markerOpacity * c * layerOpacity;\n#if __VERSION__ == 100\ngl_FragColor = glFragColor;\n#endif\n}",
|
|
9306
9317
|
uniforms: [ {
|
|
9307
9318
|
name: "projViewModelMatrix",
|
|
@@ -9334,7 +9345,7 @@ class _o extends Bi {
|
|
|
9334
9345
|
if (this.shader = new n.MeshShader(i), this.shader.version = 300, this.pickingFBO) {
|
|
9335
9346
|
const t = [];
|
|
9336
9347
|
this.picking = [ new n.FBORayPicking(this.renderer, {
|
|
9337
|
-
vert: "#define PICKING_MODE 1\n" +
|
|
9348
|
+
vert: "#define PICKING_MODE 1\n" + wo,
|
|
9338
9349
|
uniforms: [ {
|
|
9339
9350
|
name: "projViewModelMatrix",
|
|
9340
9351
|
type: "function",
|
|
@@ -9355,11 +9366,11 @@ class _o extends Bi {
|
|
|
9355
9366
|
}
|
|
9356
9367
|
}
|
|
9357
9368
|
|
|
9358
|
-
var
|
|
9369
|
+
var Mo = "#define SHADER_NAME NATIVE_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nuniform mat4 projViewModelMatrix;\n#ifndef PICKING_MODE\n#if defined(HAS_COLOR)\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n gl_Position = projViewModelMatrix * vec4(c, 1.);\n#ifndef PICKING_MODE\n#if defined(HAS_COLOR)\nvColor = aColor / 255.;\n#endif\n#else\nfbo_picking_setData(gl_Position.w, true);\n#endif\n}";
|
|
9359
9370
|
|
|
9360
|
-
const
|
|
9371
|
+
const Po = r.identity([]);
|
|
9361
9372
|
|
|
9362
|
-
class
|
|
9373
|
+
class To extends Bi {
|
|
9363
9374
|
constructor(t, e, n, i, r, s) {
|
|
9364
9375
|
if (super(t, e, n, i, r, s), this.primitive = "lines", p(this.symbolDef.lineColor)) {
|
|
9365
9376
|
const t = e.getMap(), n = y(this.symbolDef.lineColor);
|
|
@@ -9401,7 +9412,7 @@ class Po extends Bi {
|
|
|
9401
9412
|
return r.multiply(n, e.projViewMatrix, e.modelMatrix), n;
|
|
9402
9413
|
}
|
|
9403
9414
|
} ], l = this.sceneConfig.depthRange, h = {
|
|
9404
|
-
vert:
|
|
9415
|
+
vert: Mo,
|
|
9405
9416
|
frag: "#define SHADER_NAME NATIVE_LINE\nprecision mediump float;\nuniform float lineOpacity;\nuniform vec4 lineColor;\nuniform float layerOpacity;\n#if defined(HAS_COLOR)\nvarying vec4 vColor;\n#endif\nvoid main() {\n gl_FragColor = lineColor * lineOpacity;\n#if defined(HAS_COLOR)\ngl_FragColor *= vColor;\n#endif\ngl_FragColor *= layerOpacity;\n}",
|
|
9406
9417
|
uniforms: a,
|
|
9407
9418
|
defines: null,
|
|
@@ -9438,7 +9449,7 @@ class Po extends Bi {
|
|
|
9438
9449
|
}
|
|
9439
9450
|
};
|
|
9440
9451
|
this.shader = new n.MeshShader(h), this.pickingFBO && (this.picking = [ new n.FBORayPicking(this.renderer, {
|
|
9441
|
-
vert: "#define PICKING_MODE 1\n" +
|
|
9452
|
+
vert: "#define PICKING_MODE 1\n" + Mo,
|
|
9442
9453
|
uniforms: a,
|
|
9443
9454
|
extraCommandProps: {
|
|
9444
9455
|
viewport: this.pickingViewport
|
|
@@ -9448,7 +9459,7 @@ class Po extends Bi {
|
|
|
9448
9459
|
getUniformValues(t, e) {
|
|
9449
9460
|
const n = e && e.isRenderingTerrainSkin;
|
|
9450
9461
|
return {
|
|
9451
|
-
projViewMatrix: n ?
|
|
9462
|
+
projViewMatrix: n ? Po : t.projViewMatrix,
|
|
9452
9463
|
viewport: n && e && e.viewport
|
|
9453
9464
|
};
|
|
9454
9465
|
}
|
|
@@ -9457,9 +9468,9 @@ class Po extends Bi {
|
|
|
9457
9468
|
}
|
|
9458
9469
|
}
|
|
9459
9470
|
|
|
9460
|
-
const
|
|
9471
|
+
const ko = [ 0, 0 ], Oo = [ 1, 1, 1 ], Io = [ 1, 1, 1, 1 ], Fo = [ 0, 0 ], Co = [ 1, 1 ], Eo = [], Do = new t.Coordinate(0, 0), Ro = new t.Coordinate(0, 0), Lo = [], No = [];
|
|
9461
9472
|
|
|
9462
|
-
class
|
|
9473
|
+
class Ho extends Vi {
|
|
9463
9474
|
supportRenderMode(t) {
|
|
9464
9475
|
return this.isAnimating() ? "fxaa" === t || "fxaaAfterTaa" === t : "taa" === t || "fxaa" === t;
|
|
9465
9476
|
}
|
|
@@ -9476,9 +9487,9 @@ class No extends Vi {
|
|
|
9476
9487
|
if (!this.material) return this.setToRedraw(), null;
|
|
9477
9488
|
const {geometry: o, symbolIndex: a} = e, l = this.layer instanceof t.TileLayer, u = new n.Mesh(o, this.material);
|
|
9478
9489
|
if (this.sceneConfig.animation) {
|
|
9479
|
-
|
|
9490
|
+
Oo[2] = .01;
|
|
9480
9491
|
const t = [];
|
|
9481
|
-
r.fromScaling(t,
|
|
9492
|
+
r.fromScaling(t, Oo), r.multiply(t, i, t), i = t;
|
|
9482
9493
|
}
|
|
9483
9494
|
const c = this.getSymbolDef(a), f = this.getFnTypeConfig(a);
|
|
9484
9495
|
si(o, c, f);
|
|
@@ -9500,12 +9511,12 @@ class No extends Vi {
|
|
|
9500
9511
|
}
|
|
9501
9512
|
});
|
|
9502
9513
|
} else {
|
|
9503
|
-
Ct(u.uniforms, "polygonFill", m, "polygonFill",
|
|
9514
|
+
Ct(u.uniforms, "polygonFill", m, "polygonFill", Io, y), Ct(u.uniforms, "polygonOpacity", m, "polygonOpacity", 1);
|
|
9504
9515
|
const t = [];
|
|
9505
9516
|
Object.defineProperty(u.uniforms, "vertexColorsOfType", {
|
|
9506
9517
|
enumerable: !0,
|
|
9507
9518
|
get: () => {
|
|
9508
|
-
const e = y(m.bottomPolygonFill ||
|
|
9519
|
+
const e = y(m.bottomPolygonFill || Io), n = y(m.topPolygonFill || Io);
|
|
9509
9520
|
t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = n[0], t[5] = n[1], t[6] = n[2],
|
|
9510
9521
|
t[7] = n[3];
|
|
9511
9522
|
const i = u.geometry.properties.vertexColors;
|
|
@@ -9545,7 +9556,7 @@ class No extends Vi {
|
|
|
9545
9556
|
Object.defineProperty(u.uniforms, "uvOrigin", {
|
|
9546
9557
|
enumerable: !0,
|
|
9547
9558
|
get: () => {
|
|
9548
|
-
const t = this.
|
|
9559
|
+
const t = this.fo(_, a, s, g, A, l);
|
|
9549
9560
|
return h.set(w, t[0] - t[0] % 1, t[1] - t[1] % 1);
|
|
9550
9561
|
}
|
|
9551
9562
|
});
|
|
@@ -9553,7 +9564,7 @@ class No extends Vi {
|
|
|
9553
9564
|
Object.defineProperty(u.uniforms, "uvOffset", {
|
|
9554
9565
|
enumerable: !0,
|
|
9555
9566
|
get: () => {
|
|
9556
|
-
const t = this.
|
|
9567
|
+
const t = this.fo(_, a, s, g, A, l);
|
|
9557
9568
|
return h.set(w, t[0] % 1, t[1] % 1);
|
|
9558
9569
|
}
|
|
9559
9570
|
}), Object.defineProperty(u.uniforms, "hasAlpha", {
|
|
@@ -9569,17 +9580,17 @@ class No extends Vi {
|
|
|
9569
9580
|
get: () => x.isForeground(u) ? 0 : S - u.properties.tile.z
|
|
9570
9581
|
}), u.properties.symbolIndex = a, u;
|
|
9571
9582
|
}
|
|
9572
|
-
|
|
9573
|
-
if (1 === this.dataConfig.topUVMode) return
|
|
9583
|
+
fo(t, e, n, i, r, s) {
|
|
9584
|
+
if (1 === this.dataConfig.topUVMode) return ko;
|
|
9574
9585
|
const o = this.getMap(), a = this.getSymbol(e).material;
|
|
9575
9586
|
let l = n;
|
|
9576
|
-
!this.dataConfig.side && a && a.textureOrigin && (
|
|
9577
|
-
o.coordToPointAtRes(
|
|
9587
|
+
!this.dataConfig.side && a && a.textureOrigin && (Do.set(a.textureOrigin[0], a.textureOrigin[1]),
|
|
9588
|
+
o.coordToPointAtRes(Do, i, Ro), l = h.set(Lo, n[0] - Ro.x, n[1] - Ro.y));
|
|
9578
9589
|
const u = !!a && a.uvOffsetInMeter;
|
|
9579
|
-
let c = a && a.uvOffset ||
|
|
9590
|
+
let c = a && a.uvOffset || Fo;
|
|
9580
9591
|
const f = this.getUVOffsetAnim();
|
|
9581
9592
|
f && (c = this.getUVOffset(f));
|
|
9582
|
-
const d = a && a.uvScale ||
|
|
9593
|
+
const d = a && a.uvScale || Co;
|
|
9583
9594
|
let p = this.dataConfig.side ? 0 : l[0], m = this.dataConfig.side ? 0 : l[1];
|
|
9584
9595
|
const y = a && a.textureWidth || F, g = y * d[1] / d[0];
|
|
9585
9596
|
u && (p += c[0] / r, m += c[1] / r);
|
|
@@ -9592,7 +9603,7 @@ class No extends Vi {
|
|
|
9592
9603
|
super.callShader(t, e);
|
|
9593
9604
|
}
|
|
9594
9605
|
getShadowMeshes() {
|
|
9595
|
-
if (!this.isVisible()) return
|
|
9606
|
+
if (!this.isVisible()) return Eo;
|
|
9596
9607
|
this.shadowCount = this.scene.getMeshes().length;
|
|
9597
9608
|
const t = this.scene.getMeshes().filter(t => 0 === t.properties.level);
|
|
9598
9609
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -9606,14 +9617,14 @@ class No extends Vi {
|
|
|
9606
9617
|
return t.material && t.material.uvOffsetAnim;
|
|
9607
9618
|
}
|
|
9608
9619
|
getUVOffset(t) {
|
|
9609
|
-
const e = this.getSymbols()[0], n = e.material && e.material.uvOffset ||
|
|
9620
|
+
const e = this.getSymbols()[0], n = e.material && e.material.uvOffset || Fo, i = !!e.material && e.material.uvOffsetInMeter, r = performance.now() / 1e3, s = h.set(No, n[0], n[1]);
|
|
9610
9621
|
return s[0] = r * t[0], s[1] = r * t[0], i || (s[0] %= 1, s[1] %= 1), s;
|
|
9611
9622
|
}
|
|
9612
9623
|
needPolygonOffset() {
|
|
9613
|
-
return this.
|
|
9624
|
+
return this.do;
|
|
9614
9625
|
}
|
|
9615
9626
|
startFrame(...t) {
|
|
9616
|
-
return delete this.
|
|
9627
|
+
return delete this.do, super.startFrame(...t);
|
|
9617
9628
|
}
|
|
9618
9629
|
addMesh(t, e) {
|
|
9619
9630
|
t.forEach(t => {
|
|
@@ -9623,10 +9634,10 @@ class No extends Vi {
|
|
|
9623
9634
|
_r(t, e) {
|
|
9624
9635
|
if (null !== e) {
|
|
9625
9636
|
const n = t.localTransform;
|
|
9626
|
-
0 === e && (e = .01),
|
|
9637
|
+
0 === e && (e = .01), Oo[2] = e, r.fromScaling(n, Oo), r.multiply(n, t.properties.tileTransform, n),
|
|
9627
9638
|
t.setLocalTransform(n);
|
|
9628
9639
|
} else t.setLocalTransform(t.properties.tileTransform);
|
|
9629
|
-
t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.
|
|
9640
|
+
t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.do = !0),
|
|
9630
9641
|
this.getSymbol(t.properties.symbolIndex).ssr ? t.ssr = 1 : t.ssr = 0;
|
|
9631
9642
|
}
|
|
9632
9643
|
deleteMaterial() {
|
|
@@ -9678,29 +9689,29 @@ class No extends Vi {
|
|
|
9678
9689
|
updateSymbol(t, e) {
|
|
9679
9690
|
let n = !1;
|
|
9680
9691
|
t && t.material && (n = function(t, e) {
|
|
9681
|
-
for (const n in e) if (
|
|
9692
|
+
for (const n in e) if (Vo[n] && e[n] !== t[n] && (!t[n] || !e[n])) return !0;
|
|
9682
9693
|
return !1;
|
|
9683
9694
|
}(this.symbolDef[0].material || {}, t.material));
|
|
9684
9695
|
const i = super.updateSymbol(t, e);
|
|
9685
9696
|
return t && t.material && this.ri(t.material), n || i;
|
|
9686
9697
|
}
|
|
9687
9698
|
Qi(t, e) {
|
|
9688
|
-
return
|
|
9699
|
+
return zo(t) !== zo(e);
|
|
9689
9700
|
}
|
|
9690
9701
|
}
|
|
9691
9702
|
|
|
9692
|
-
function
|
|
9703
|
+
function zo(t) {
|
|
9693
9704
|
if (!t || !t.material) return !1;
|
|
9694
9705
|
for (const e in t.material) if (e.indexOf("Texture") > 0 && t.material[e]) return !0;
|
|
9695
9706
|
return !1;
|
|
9696
9707
|
}
|
|
9697
9708
|
|
|
9698
|
-
const
|
|
9709
|
+
const Vo = {
|
|
9699
9710
|
normalTexture: 1,
|
|
9700
9711
|
bumpTexture: 1
|
|
9701
9712
|
};
|
|
9702
9713
|
|
|
9703
|
-
class
|
|
9714
|
+
class Uo extends Ho {
|
|
9704
9715
|
createGeometry(t) {
|
|
9705
9716
|
const e = t.data, i = this.getSymbols()[0];
|
|
9706
9717
|
if (i.material && i.material.extrusionOpacity) {
|
|
@@ -9729,10 +9740,10 @@ class Vo extends No {
|
|
|
9729
9740
|
return this.shader;
|
|
9730
9741
|
}
|
|
9731
9742
|
delete(t) {
|
|
9732
|
-
this.getMap().off("updatelights", this.
|
|
9743
|
+
this.getMap().off("updatelights", this.po, this), super.delete(t), this.material.dispose();
|
|
9733
9744
|
}
|
|
9734
9745
|
init() {
|
|
9735
|
-
this.getMap().on("updatelights", this.
|
|
9746
|
+
this.getMap().on("updatelights", this.po, this);
|
|
9736
9747
|
const t = this.regl;
|
|
9737
9748
|
this.renderer = new n.Renderer(t);
|
|
9738
9749
|
const e = this.getShaderConfig();
|
|
@@ -9752,7 +9763,7 @@ class Vo extends No {
|
|
|
9752
9763
|
};
|
|
9753
9764
|
this.picking = [ new n.FBORayPicking(this.renderer, i, this.layer.getRenderer().pickingFBO, this.getMap()) ];
|
|
9754
9765
|
}
|
|
9755
|
-
|
|
9766
|
+
po() {
|
|
9756
9767
|
this.setToRedraw();
|
|
9757
9768
|
}
|
|
9758
9769
|
getShaderConfig() {
|
|
@@ -9808,7 +9819,7 @@ class Vo extends No {
|
|
|
9808
9819
|
this.material = new n.PhongMaterial(e);
|
|
9809
9820
|
}
|
|
9810
9821
|
getUniformValues(t, e) {
|
|
9811
|
-
const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.
|
|
9822
|
+
const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.mo(), o = Tt({
|
|
9812
9823
|
viewMatrix: n,
|
|
9813
9824
|
projMatrix: i,
|
|
9814
9825
|
cameraPosition: r,
|
|
@@ -9821,7 +9832,7 @@ class Vo extends No {
|
|
|
9821
9832
|
getPickingVert() {
|
|
9822
9833
|
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 ";
|
|
9823
9834
|
}
|
|
9824
|
-
|
|
9835
|
+
mo() {
|
|
9825
9836
|
const t = this.getMap().getLightManager(), e = t && t.getAmbientLight() || {}, n = t && t.getDirectionalLight() || {};
|
|
9826
9837
|
return {
|
|
9827
9838
|
ambientColor: e.color || [ .2, .2, .2 ],
|
|
@@ -9832,9 +9843,9 @@ class Vo extends No {
|
|
|
9832
9843
|
}
|
|
9833
9844
|
}
|
|
9834
9845
|
|
|
9835
|
-
const
|
|
9846
|
+
const jo = [ 1, 1, 1 ];
|
|
9836
9847
|
|
|
9837
|
-
class
|
|
9848
|
+
class Bo extends Vi {
|
|
9838
9849
|
createGeometry(t) {
|
|
9839
9850
|
const {data: e, indices: i} = t, r = new n.Geometry(e, i, 0, {
|
|
9840
9851
|
primitive: "lines"
|
|
@@ -9849,9 +9860,9 @@ class jo extends Vi {
|
|
|
9849
9860
|
createMesh(t, e) {
|
|
9850
9861
|
const {geometry: i} = t, s = new n.Mesh(i);
|
|
9851
9862
|
if (s.castShadow = !1, this.sceneConfig.animation) {
|
|
9852
|
-
|
|
9863
|
+
jo[2] = .01;
|
|
9853
9864
|
const t = [];
|
|
9854
|
-
r.fromScaling(t,
|
|
9865
|
+
r.fromScaling(t, jo), r.multiply(t, e, t), e = t;
|
|
9855
9866
|
}
|
|
9856
9867
|
return s.setLocalTransform(e), s.properties.symbolIndex = {
|
|
9857
9868
|
index: 0
|
|
@@ -9860,7 +9871,7 @@ class jo extends Vi {
|
|
|
9860
9871
|
addMesh(t, e) {
|
|
9861
9872
|
if (!t.length) return this;
|
|
9862
9873
|
let n;
|
|
9863
|
-
null !== e ? (0 === e && (e = .01), n = t[0].localTransform,
|
|
9874
|
+
null !== e ? (0 === e && (e = .01), n = t[0].localTransform, jo[2] = e, r.fromScaling(n, jo),
|
|
9864
9875
|
r.multiply(n, t[0].properties.tileTransform, n)) : n = t[0].properties.tileTransform;
|
|
9865
9876
|
for (let e = 0; e < t.length; e++) t[e].setLocalTransform(n);
|
|
9866
9877
|
return this.scene.addMesh(t), this;
|
|
@@ -9917,24 +9928,24 @@ class jo extends Vi {
|
|
|
9917
9928
|
}
|
|
9918
9929
|
}
|
|
9919
9930
|
|
|
9920
|
-
const {getPBRUniforms:
|
|
9931
|
+
const {getPBRUniforms: Go} = n.pbr.PBRUtils;
|
|
9921
9932
|
|
|
9922
|
-
class
|
|
9933
|
+
class Wo extends Ho {
|
|
9923
9934
|
constructor(...t) {
|
|
9924
|
-
super(...t), this.
|
|
9935
|
+
super(...t), this.yo = new n.ResourceLoader, this.scene.sortFunction = this.sortByCommandKey;
|
|
9925
9936
|
}
|
|
9926
9937
|
supportRenderMode(t) {
|
|
9927
9938
|
return this.getSymbols()[0].ssr ? "fxaa" === t || "fxaaAfterTaa" === t : super.supportRenderMode(t);
|
|
9928
9939
|
}
|
|
9929
9940
|
isAnimating() {
|
|
9930
|
-
const t = this.
|
|
9941
|
+
const t = this.vo();
|
|
9931
9942
|
if (t && (t[0] || t[1])) return !0;
|
|
9932
9943
|
}
|
|
9933
9944
|
needToRedraw() {
|
|
9934
|
-
const t = this.
|
|
9945
|
+
const t = this.vo();
|
|
9935
9946
|
return !(!t || !t[0] && !t[1]) || super.needToRedraw();
|
|
9936
9947
|
}
|
|
9937
|
-
|
|
9948
|
+
vo() {
|
|
9938
9949
|
const t = this.getSymbols()[0];
|
|
9939
9950
|
return t.material && t.material.uvOffsetAnim;
|
|
9940
9951
|
}
|
|
@@ -9957,32 +9968,32 @@ class Go extends No {
|
|
|
9957
9968
|
paint(t) {
|
|
9958
9969
|
const e = !!t.shadow;
|
|
9959
9970
|
t.states && t.states.includesChanged && (this.shader.dispose(), delete this.shader,
|
|
9960
|
-
this.
|
|
9971
|
+
this.xo.dispose(), delete this.xo, this.br(t));
|
|
9961
9972
|
let n = !!t.ssr && this.getSymbols()[0].ssr;
|
|
9962
9973
|
const i = this.shader, r = i.shaderDefines;
|
|
9963
9974
|
if (n) {
|
|
9964
9975
|
const e = Tt({}, r, t.ssr.defines);
|
|
9965
9976
|
i.shaderDefines = e;
|
|
9966
9977
|
}
|
|
9967
|
-
if (t.onlyUpdateDepthInTaa && (this.shader = this.
|
|
9978
|
+
if (t.onlyUpdateDepthInTaa && (this.shader = this.xo, !n && this.bo && (this.shader = i,
|
|
9968
9979
|
this.setToRedraw(!0))), this.updateIBLDefines(i), super.paint(t), void 0 !== this.shadowCount && e) {
|
|
9969
9980
|
const t = this.scene.getMeshes().length;
|
|
9970
9981
|
this.shadowCount !== t && this.setToRedraw();
|
|
9971
9982
|
}
|
|
9972
|
-
this.shader = i, n && (i.shaderDefines = r), delete this.shadowCount, this.
|
|
9983
|
+
this.shader = i, n && (i.shaderDefines = r), delete this.shadowCount, this.bo = n;
|
|
9973
9984
|
}
|
|
9974
9985
|
updateSceneConfig(t) {
|
|
9975
9986
|
Tt(this.sceneConfig, t), this.setToRedraw();
|
|
9976
9987
|
}
|
|
9977
9988
|
delete() {
|
|
9978
|
-
super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.
|
|
9979
|
-
delete this.
|
|
9989
|
+
super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.xo && (this.xo.dispose(),
|
|
9990
|
+
delete this.xo);
|
|
9980
9991
|
}
|
|
9981
9992
|
init(t) {
|
|
9982
|
-
this.getMap().on("updatelights", this.
|
|
9993
|
+
this.getMap().on("updatelights", this.Ao, this), this.createIBLTextures(), this.Sr = this.Sr || t;
|
|
9983
9994
|
const e = this.regl;
|
|
9984
|
-
this.renderer = new n.Renderer(e), this.
|
|
9985
|
-
this.
|
|
9995
|
+
this.renderer = new n.Renderer(e), this.wo = this._o.bind(this), this.So = this.disposeCachedTexture.bind(this),
|
|
9996
|
+
this.Mo = this.Po.bind(this), this.ri(), this.br(t);
|
|
9986
9997
|
const i = {
|
|
9987
9998
|
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 ",
|
|
9988
9999
|
uniforms: [ {
|
|
@@ -10044,17 +10055,17 @@ class Go extends No {
|
|
|
10044
10055
|
}
|
|
10045
10056
|
}, o = {
|
|
10046
10057
|
uniforms: r,
|
|
10047
|
-
defines: this.
|
|
10058
|
+
defines: this.To(i),
|
|
10048
10059
|
extraCommandProps: s
|
|
10049
10060
|
};
|
|
10050
10061
|
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 ",
|
|
10051
|
-
this.
|
|
10062
|
+
this.xo = new n.pbr.StandardShader(o);
|
|
10052
10063
|
}
|
|
10053
|
-
|
|
10064
|
+
_o({resources: t}) {
|
|
10054
10065
|
for (let e = 0; e < t.length; e++) this.addCachedTexture(t[e].url, t[e].data);
|
|
10055
10066
|
this.setToRedraw(!0);
|
|
10056
10067
|
}
|
|
10057
|
-
|
|
10068
|
+
Po() {
|
|
10058
10069
|
this.setToRedraw(!0);
|
|
10059
10070
|
}
|
|
10060
10071
|
ri(t) {
|
|
@@ -10081,37 +10092,37 @@ class Go extends No {
|
|
|
10081
10092
|
url: a,
|
|
10082
10093
|
wrap: "repeat"
|
|
10083
10094
|
}), o.flipY = !e.upsideUpTexture, o.min = "linear mipmap linear", o.mag = "linear",
|
|
10084
|
-
r[t] = new n.Texture2D(o, this.
|
|
10095
|
+
r[t] = new n.Texture2D(o, this.yo), r[t].once("complete", this.wo), r[t].once("disposed", this.So),
|
|
10085
10096
|
r[t].promise && this.addCachedTexture(a, r[t].promise), s = !0;
|
|
10086
10097
|
} else r[t] = i[t];
|
|
10087
10098
|
if (void 0 === r.alphaTest && this.getMaterialClazz && (r.alphaTest = .05), this.material) {
|
|
10088
10099
|
for (let t in r) this.material.set(t, r[t]);
|
|
10089
10100
|
this.setToRedraw(!0);
|
|
10090
|
-
} else this.material = new n.pbr.StandardMaterial(r), this.material.once("complete", this.
|
|
10091
|
-
s || this.
|
|
10101
|
+
} else this.material = new n.pbr.StandardMaterial(r), this.material.once("complete", this.Mo);
|
|
10102
|
+
s || this.Po();
|
|
10092
10103
|
}
|
|
10093
10104
|
getShader() {
|
|
10094
10105
|
return this.shader;
|
|
10095
10106
|
}
|
|
10096
10107
|
getUniformValues(t, e) {
|
|
10097
|
-
const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r =
|
|
10108
|
+
const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = Go(t, n, i, e && e.ssr, e && e.jitter);
|
|
10098
10109
|
return this.setIncludeUniformValues(r, e), r;
|
|
10099
10110
|
}
|
|
10100
|
-
|
|
10111
|
+
To(t) {
|
|
10101
10112
|
return this.hasIBL() ? t.HAS_IBL_LIGHTING = 1 : delete t.HAS_IBL_LIGHTING, t;
|
|
10102
10113
|
}
|
|
10103
|
-
|
|
10114
|
+
Ao() {
|
|
10104
10115
|
if (!this.shader) return;
|
|
10105
10116
|
const t = this.shader.shaderDefines;
|
|
10106
|
-
this.
|
|
10117
|
+
this.To(t), this.shader.shaderDefines = t;
|
|
10107
10118
|
}
|
|
10108
10119
|
}
|
|
10109
10120
|
|
|
10110
|
-
var
|
|
10121
|
+
var Xo = "#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}";
|
|
10111
10122
|
|
|
10112
|
-
const {getPBRUniforms:
|
|
10123
|
+
const {getPBRUniforms: Yo} = n.pbr.PBRUtils;
|
|
10113
10124
|
|
|
10114
|
-
class
|
|
10125
|
+
class $o extends Bi {
|
|
10115
10126
|
needToRedraw() {
|
|
10116
10127
|
return super.needToRedraw() || this.isAnimating();
|
|
10117
10128
|
}
|
|
@@ -10177,12 +10188,12 @@ class Yo extends Bi {
|
|
|
10177
10188
|
super.paint(t);
|
|
10178
10189
|
}
|
|
10179
10190
|
init(t) {
|
|
10180
|
-
this.getMap().on("updatelights", this.
|
|
10191
|
+
this.getMap().on("updatelights", this.Ao, this), this.createIBLTextures();
|
|
10181
10192
|
const e = this.regl;
|
|
10182
10193
|
if (this.renderer = new n.Renderer(e), this.createShader(t), this.pickingFBO) {
|
|
10183
10194
|
const t = [];
|
|
10184
10195
|
this.picking = [ new n.FBORayPicking(this.renderer, {
|
|
10185
|
-
vert: "#define PICKING_MODE 1\n" +
|
|
10196
|
+
vert: "#define PICKING_MODE 1\n" + Xo,
|
|
10186
10197
|
uniforms: [ {
|
|
10187
10198
|
name: "projViewModelMatrix",
|
|
10188
10199
|
type: "function",
|
|
@@ -10210,9 +10221,9 @@ class Yo extends Bi {
|
|
|
10210
10221
|
return r.multiply(n, e.projViewMatrix, e.modelMatrix), n;
|
|
10211
10222
|
}
|
|
10212
10223
|
}), this.shader = new n.pbr.StandardShader({
|
|
10213
|
-
vert:
|
|
10224
|
+
vert: Xo,
|
|
10214
10225
|
uniforms: e,
|
|
10215
|
-
defines: this.
|
|
10226
|
+
defines: this.To(i),
|
|
10216
10227
|
extraCommandProps: this.getExtraCommandProps()
|
|
10217
10228
|
});
|
|
10218
10229
|
}
|
|
@@ -10259,7 +10270,7 @@ class Yo extends Bi {
|
|
|
10259
10270
|
};
|
|
10260
10271
|
}
|
|
10261
10272
|
getUniformValues(t, e) {
|
|
10262
|
-
const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r =
|
|
10273
|
+
const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = Yo(t, n, i, null, e && e.jitter), s = t.projViewMatrix, o = t.viewMatrix;
|
|
10263
10274
|
return r.projViewMatrix = s, r.viewMatrix = o, r.resolution = t.getResolution(),
|
|
10264
10275
|
r.currentTime = this.layer.getRenderer().getFrameTimestamp() || 0, this.setIncludeUniformValues(r, e),
|
|
10265
10276
|
r;
|
|
@@ -10327,13 +10338,13 @@ class Yo extends Bi {
|
|
|
10327
10338
|
}
|
|
10328
10339
|
} ];
|
|
10329
10340
|
}
|
|
10330
|
-
|
|
10341
|
+
To(t) {
|
|
10331
10342
|
return this.hasIBL() ? t.HAS_IBL_LIGHTING = 1 : delete t.HAS_IBL_LIGHTING, t;
|
|
10332
10343
|
}
|
|
10333
|
-
|
|
10344
|
+
Ao() {
|
|
10334
10345
|
if (!this.shader) return;
|
|
10335
10346
|
const t = this.shader.shaderDefines;
|
|
10336
|
-
this.
|
|
10347
|
+
this.To(t), this.shader.shaderDefines = t;
|
|
10337
10348
|
}
|
|
10338
10349
|
delete() {
|
|
10339
10350
|
super.delete(), this.disposeIBLTextures(), this.shader && (this.shader.dispose(),
|
|
@@ -10341,15 +10352,15 @@ class Yo extends Bi {
|
|
|
10341
10352
|
}
|
|
10342
10353
|
}
|
|
10343
10354
|
|
|
10344
|
-
const
|
|
10355
|
+
const qo = [], Jo = [], Ko = [], Zo = [], Qo = [], ta = [ 0, 0, 0 ], ea = [ 0, 0, 0 ], na = [ 1, 1, 1 ], ia = [], ra = [ 1, 1, 1, 1 ], sa = [], oa = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], aa = t => class extends t {
|
|
10345
10356
|
constructor(t, e, i, r, s, o) {
|
|
10346
|
-
super(t, e, i, r, s, o), this.
|
|
10347
|
-
this.
|
|
10357
|
+
super(t, e, i, r, s, o), this.ko = !1, this.scene.sortFunction = this.sortByCommandKey,
|
|
10358
|
+
this.Oo = new n.GLTFManager(t), this.Io(), this.Fo();
|
|
10348
10359
|
}
|
|
10349
10360
|
isAnimating() {
|
|
10350
10361
|
const t = this.getSymbols();
|
|
10351
10362
|
for (let e = 0; e < t.length; e++) {
|
|
10352
|
-
if (t[e] && this.
|
|
10363
|
+
if (t[e] && this.Co[e] && this.Eo(e)) return !0;
|
|
10353
10364
|
}
|
|
10354
10365
|
return !1;
|
|
10355
10366
|
}
|
|
@@ -10366,10 +10377,10 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10366
10377
|
};
|
|
10367
10378
|
}
|
|
10368
10379
|
getFnTypeConfig() {
|
|
10369
|
-
return
|
|
10380
|
+
return ia;
|
|
10370
10381
|
}
|
|
10371
10382
|
createMesh(t, e, {tileTranslationMatrix: s, tileExtent: o}, {timestamp: a}) {
|
|
10372
|
-
if (!this.
|
|
10383
|
+
if (!this.ko) return null;
|
|
10373
10384
|
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;
|
|
10374
10385
|
if (0 === g) return null;
|
|
10375
10386
|
const v = {
|
|
@@ -10377,7 +10388,7 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10377
10388
|
instance_vectorB: new Float32Array(4 * g),
|
|
10378
10389
|
instance_vectorC: new Float32Array(4 * g),
|
|
10379
10390
|
aPickingId: []
|
|
10380
|
-
}, x = this.
|
|
10391
|
+
}, x = this.Do(v, s, o, h.properties.z, f, y, p, m, u, d, c);
|
|
10381
10392
|
h.data.aTerrainAltitude && (v.aTerrainAltitude = h.data.aTerrainAltitude);
|
|
10382
10393
|
const b = {};
|
|
10383
10394
|
for (const t in v) b[t] = {
|
|
@@ -10387,22 +10398,22 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10387
10398
|
}),
|
|
10388
10399
|
divisor: 1
|
|
10389
10400
|
};
|
|
10390
|
-
const A = this.
|
|
10401
|
+
const A = this.Ro(), w = this.Lo(), _ = r.identity([]);
|
|
10391
10402
|
r.scale(_, _, [ w, w, w ]);
|
|
10392
10403
|
const S = [], M = this.getSymbols();
|
|
10393
10404
|
for (let t = 0; t < M.length; t++) {
|
|
10394
|
-
const e = M[t], o = this.
|
|
10405
|
+
const e = M[t], o = this.No[t];
|
|
10395
10406
|
if (!o) continue;
|
|
10396
|
-
const u = this.
|
|
10407
|
+
const u = this.Co[t][0], {fixSizeOnZoom: c} = e;
|
|
10397
10408
|
let f = r.identity([]);
|
|
10398
|
-
A || (f = this.
|
|
10409
|
+
A || (f = this.Ho(f));
|
|
10399
10410
|
let d = 0;
|
|
10400
10411
|
o.forEach(t => {
|
|
10401
10412
|
const {geometry: n, nodeMatrix: i} = t;
|
|
10402
|
-
r.multiply(
|
|
10403
|
-
const s = r.multiply(
|
|
10413
|
+
r.multiply(sa, oa, i), r.multiply(sa, f, sa);
|
|
10414
|
+
const s = r.multiply(sa, _, sa), o = n.boundingBox.copy();
|
|
10404
10415
|
o.transform(s);
|
|
10405
|
-
const a = this.
|
|
10416
|
+
const a = this.zo(o, e);
|
|
10406
10417
|
Math.abs(a) > Math.abs(d) && (d = a);
|
|
10407
10418
|
});
|
|
10408
10419
|
const p = [ 0, 0, d ], m = o.map((o, m) => {
|
|
@@ -10413,21 +10424,21 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10413
10424
|
picking: !0
|
|
10414
10425
|
});
|
|
10415
10426
|
if (u.hasSkinAnimation()) {
|
|
10416
|
-
const e = this.
|
|
10427
|
+
const e = this.Vo(k, t, 0)[M];
|
|
10417
10428
|
k.setUniform("jointTexture", e.jointTexture), k.setUniform("jointTextureSize", e.jointTextureSize),
|
|
10418
|
-
k.setUniform("numJoints", e.numJoints), k.setUniform("skinAnimation", +this.
|
|
10429
|
+
k.setUniform("numJoints", e.numJoints), k.setUniform("skinAnimation", +this.Eo(t)),
|
|
10419
10430
|
k.properties.startTime = a, T.HAS_SKIN = 1;
|
|
10420
10431
|
}
|
|
10421
10432
|
w && (k.setUniform("morphWeights", w), T.HAS_MORPH = 1), k.setUniform("hasAlpha", S.alphaMode && "BLEND" === S.alphaMode.toUpperCase()),
|
|
10422
|
-
Ct(k.uniforms, "polygonFill", e, "markerFill",
|
|
10433
|
+
Ct(k.uniforms, "polygonFill", e, "markerFill", ra, Rt(this.colorCache)), Ct(k.uniforms, "polygonOpacity", e, "markerOpacity", 1);
|
|
10423
10434
|
const O = [];
|
|
10424
10435
|
k.setPositionMatrix(() => {
|
|
10425
|
-
const e = this.
|
|
10426
|
-
r.multiply(O,
|
|
10427
|
-
const n = r.identity(
|
|
10436
|
+
const e = this.Uo(t, m, M);
|
|
10437
|
+
r.multiply(O, oa, e), this.Ho(f), r.multiply(O, f, O), r.multiply(O, _, O);
|
|
10438
|
+
const n = r.identity(sa);
|
|
10428
10439
|
if (0 !== d && (r.fromTranslation(n, p), r.multiply(O, n, O)), Ht(c)) {
|
|
10429
10440
|
const t = l.getGLScale() / l.getGLScale(c);
|
|
10430
|
-
return i.set(
|
|
10441
|
+
return i.set(qo, t, t, t), r.fromScaling(n, qo), r.multiply(n, n, O);
|
|
10431
10442
|
}
|
|
10432
10443
|
return O;
|
|
10433
10444
|
});
|
|
@@ -10453,19 +10464,19 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10453
10464
|
positionSize: u
|
|
10454
10465
|
}, S;
|
|
10455
10466
|
}
|
|
10467
|
+
Uo(t, e, n) {
|
|
10468
|
+
const i = t, r = this.No[i][e];
|
|
10469
|
+
return this.Eo(t) && this.jo && this.jo[n] || r.nodeMatrix;
|
|
10470
|
+
}
|
|
10456
10471
|
Vo(t, e, n) {
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
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) {
|
|
10472
|
+
if (!this.Co) return;
|
|
10473
|
+
const i = this.Co[e][0];
|
|
10474
|
+
this.Bo || (this.Bo = {}), this.jo = {}, this.Bo[t.uuid] || (this.Bo[t.uuid] = {});
|
|
10475
|
+
const r = this.getSymbols()[e], s = this.Go[e], {loop: o, speed: a, animationName: l} = r, h = l || s.animations[0].name;
|
|
10476
|
+
return i.updateAnimation(n, o || !1, a || 1, h, t.properties.startTime || 0, this.jo, this.Bo[t.uuid]),
|
|
10477
|
+
this.Bo[t.uuid];
|
|
10478
|
+
}
|
|
10479
|
+
zo(t, e) {
|
|
10469
10480
|
const n = e.anchorZ || "center";
|
|
10470
10481
|
let i = 0;
|
|
10471
10482
|
const r = t.max[2] - t.min[2];
|
|
@@ -10478,8 +10489,8 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10478
10489
|
for (let e = 0; e < t.length; e++) {
|
|
10479
10490
|
if (!t[e] || !t[e].geometry) continue;
|
|
10480
10491
|
t[e].instancedData.aTerrainAltitude && this.ji(t[e], t[e].instancedData, t[e].properties, 3, n);
|
|
10481
|
-
const r = t[e].properties.symbolIndex.index, s = this.
|
|
10482
|
-
s && this.
|
|
10492
|
+
const r = t[e].properties.symbolIndex.index, s = this.Eo(r);
|
|
10493
|
+
s && this.Vo(t[e], r, i), t[e].setUniform("skinAnimation", +s);
|
|
10483
10494
|
}
|
|
10484
10495
|
return this.scene.addMesh(t), this;
|
|
10485
10496
|
}
|
|
@@ -10490,8 +10501,8 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10490
10501
|
const e = this.getSymbols();
|
|
10491
10502
|
let n = !1;
|
|
10492
10503
|
for (let t = 0; t < e.length; t++) {
|
|
10493
|
-
if (!e[t] || !this.
|
|
10494
|
-
if (this.
|
|
10504
|
+
if (!e[t] || !this.Co[t]) continue;
|
|
10505
|
+
if (this.Eo(t) && this.Co[t] && !n) {
|
|
10495
10506
|
n = !0;
|
|
10496
10507
|
break;
|
|
10497
10508
|
}
|
|
@@ -10499,15 +10510,15 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10499
10510
|
n && this.setToRedraw(!0), super.prepareRender(t);
|
|
10500
10511
|
}
|
|
10501
10512
|
getShadowMeshes() {
|
|
10502
|
-
if (!this.isVisible()) return
|
|
10513
|
+
if (!this.isVisible()) return ia;
|
|
10503
10514
|
this.shadowCount = this.scene.getMeshes().length;
|
|
10504
10515
|
return this.scene.getMeshes().filter(t => 0 === t.properties.level);
|
|
10505
10516
|
}
|
|
10506
|
-
|
|
10517
|
+
Eo(t) {
|
|
10507
10518
|
const e = this.getSymbols()[t];
|
|
10508
|
-
return !!(e && e.animation && this.
|
|
10519
|
+
return !!(e && e.animation && this.Co[t] && this.Co[t][0] && this.Co[t][0].hasSkinAnimation());
|
|
10509
10520
|
}
|
|
10510
|
-
|
|
10521
|
+
Do(t, e, n, s, o, a, l, h, u, c, f) {
|
|
10511
10522
|
function d(e, n, i, r) {
|
|
10512
10523
|
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];
|
|
10513
10524
|
}
|
|
@@ -10520,19 +10531,19 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10520
10531
|
e[0] < v && (v = e[0]), e[0] > w && (w = e[0]), e[1] < x && (x = e[1]), e[1] > _ && (_ = e[1]),
|
|
10521
10532
|
e[2] < b && (b = e[2]), e[2] > S && (S = e[2]);
|
|
10522
10533
|
}
|
|
10523
|
-
const T = (v + w) / 2, k = (x + _) / 2, O = (b + S) / 2, I = [], F = this.
|
|
10534
|
+
const T = (v + w) / 2, k = (x + _) / 2, O = (b + S) / 2, I = [], F = this.Ro(), C = [ 0, 0, 1 ];
|
|
10524
10535
|
for (let e = 0; e < p; e++) {
|
|
10525
10536
|
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]);
|
|
10526
10537
|
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
10538
|
if (v || x) {
|
|
10528
10539
|
r.fromRotation(I, x, C);
|
|
10529
|
-
const t = i.set(
|
|
10540
|
+
const t = i.set(qo, n, s, 0), e = i.normalize(t, i.cross(t, t, C));
|
|
10530
10541
|
r.rotate(I, I, v, e);
|
|
10531
|
-
const o = r.fromTranslation(
|
|
10542
|
+
const o = r.fromTranslation(sa, p);
|
|
10532
10543
|
r.multiply(I, o, I);
|
|
10533
10544
|
} else r.fromTranslation(I, p);
|
|
10534
10545
|
if (F) {
|
|
10535
|
-
const t = this.
|
|
10546
|
+
const t = this.Ho(sa, f, c, e);
|
|
10536
10547
|
r.multiply(I, I, t);
|
|
10537
10548
|
}
|
|
10538
10549
|
d("instance_vectorA", e, I, 0), d("instance_vectorB", e, I, 1), d("instance_vectorC", e, I, 2),
|
|
@@ -10540,30 +10551,30 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10540
10551
|
}
|
|
10541
10552
|
return i.set(M, T, k, O), M;
|
|
10542
10553
|
}
|
|
10543
|
-
|
|
10544
|
-
if (!this.
|
|
10554
|
+
Lo() {
|
|
10555
|
+
if (!this.Wo) {
|
|
10545
10556
|
const t = this.getMap();
|
|
10546
|
-
this.
|
|
10557
|
+
this.Wo = 100 * lt(t.getGLRes(), t);
|
|
10547
10558
|
}
|
|
10548
|
-
return this.
|
|
10559
|
+
return this.Wo;
|
|
10549
10560
|
}
|
|
10550
|
-
|
|
10551
|
-
const s = this.getMap(), o = this.symbolDef[0], a = this.
|
|
10561
|
+
Ho(t, e, n, r) {
|
|
10562
|
+
const s = this.getMap(), o = this.symbolDef[0], a = this.Lo();
|
|
10552
10563
|
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;
|
|
10553
|
-
const g = n && n[r], v = e && e[g], x = s.getZoom(), b = v && v.feature && v.feature.properties, A = this.
|
|
10554
|
-
this.
|
|
10555
|
-
const w = i.set(
|
|
10556
|
-
this.
|
|
10557
|
-
const _ = i.set(
|
|
10558
|
-
this.
|
|
10559
|
-
const S = i.set(
|
|
10560
|
-
return this.
|
|
10561
|
-
}
|
|
10562
|
-
|
|
10564
|
+
const g = n && n[r], v = e && e[g], x = s.getZoom(), b = v && v.feature && v.feature.properties, A = this.Xo(x, b);
|
|
10565
|
+
this.Yo && (l = this.Yo(x, b)), this.$o && (h = this.$o(x, b)), this.qo && (u = this.qo(x, b));
|
|
10566
|
+
const w = i.set(Jo, l * a, h * a, u * a);
|
|
10567
|
+
this.Jo && (c = this.Jo(x, b)), this.Ko && (f = this.Ko(x, b)), this.Zo && (d = this.Zo(x, b));
|
|
10568
|
+
const _ = i.set(Ko, c, f, d);
|
|
10569
|
+
this.Qo && (p = this.Qo(x, b)), this.ta && (m = this.ta(x, b)), this.ea && (y = this.ea(x, b));
|
|
10570
|
+
const S = i.set(Zo, p * A, m * A, y * A);
|
|
10571
|
+
return this.na(t, w, _, S);
|
|
10572
|
+
}
|
|
10573
|
+
Xo(t, e) {
|
|
10563
10574
|
const n = this.symbolDef[0];
|
|
10564
|
-
let i = this.
|
|
10575
|
+
let i = this.ia ? this.ia(t, e) : n.modelHeight;
|
|
10565
10576
|
if (rt(i)) return 1;
|
|
10566
|
-
const r = this.
|
|
10577
|
+
const r = this.ra[0];
|
|
10567
10578
|
return i / Math.abs(r.max[1] - r.min[1]);
|
|
10568
10579
|
}
|
|
10569
10580
|
getShaderConfig() {
|
|
@@ -10571,40 +10582,40 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10571
10582
|
return t.positionAttribute = "POSITION", t.normalAttribute = "NORMAL", t;
|
|
10572
10583
|
}
|
|
10573
10584
|
init(t) {
|
|
10574
|
-
super.init(t), this.
|
|
10585
|
+
super.init(t), this.Fo();
|
|
10575
10586
|
}
|
|
10576
|
-
|
|
10587
|
+
Io() {
|
|
10577
10588
|
const t = this.symbolDef[0];
|
|
10578
|
-
p(t.modelHeight) && (this.
|
|
10579
|
-
p(t.translationY) && (this
|
|
10580
|
-
p(t.rotationX) && (this.
|
|
10581
|
-
p(t.rotationZ) && (this.
|
|
10582
|
-
p(t.scaleY) && (this.
|
|
10589
|
+
p(t.modelHeight) && (this.ia = g(t.modelHeight)), p(t.translationX) && (this.Yo = g(t.translationX)),
|
|
10590
|
+
p(t.translationY) && (this.$o = g(t.translationY)), p(t.translationZ) && (this.qo = g(t.translationZ)),
|
|
10591
|
+
p(t.rotationX) && (this.Jo = g(t.rotationX)), p(t.rotationY) && (this.Ko = g(t.rotationY)),
|
|
10592
|
+
p(t.rotationZ) && (this.Zo = g(t.rotationZ)), p(t.scaleX) && (this.Qo = g(t.scaleX)),
|
|
10593
|
+
p(t.scaleY) && (this.ta = g(t.scaleY)), p(t.scaleZ) && (this.ea = g(t.scaleZ));
|
|
10583
10594
|
}
|
|
10584
|
-
|
|
10585
|
-
return !!(this.
|
|
10595
|
+
Ro() {
|
|
10596
|
+
return !!(this.ia && !this.ia.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 || this.ea && !this.ea.isFeatureConstant);
|
|
10586
10597
|
}
|
|
10587
|
-
|
|
10588
|
-
if (this.
|
|
10589
|
-
this.
|
|
10598
|
+
Fo() {
|
|
10599
|
+
if (this.Co) return;
|
|
10600
|
+
this.Co = [], this.Go = [], this.ra = [], this.No = [];
|
|
10590
10601
|
const t = this.getSymbols();
|
|
10591
|
-
this.
|
|
10602
|
+
this.sa = 0;
|
|
10592
10603
|
for (let e = 0; e < t.length; e++) {
|
|
10593
10604
|
const n = t[e].url || "pyramid";
|
|
10594
|
-
this.
|
|
10595
|
-
const i = this.
|
|
10605
|
+
this.Oo.loginGLTF(n);
|
|
10606
|
+
const i = this.Oo.getGLTF(n);
|
|
10596
10607
|
if (i.then) i.then(n => {
|
|
10597
|
-
if (!n.gltfPack) return this.
|
|
10608
|
+
if (!n.gltfPack) return this.sa++, void (this.sa >= t.length && (this.ko = !0, this.setToRedraw(!0)));
|
|
10598
10609
|
const {gltfPack: i, json: r, bbox: s} = n;
|
|
10599
|
-
this.
|
|
10600
|
-
this.
|
|
10610
|
+
this.Co[e] = [ i ], this.No[e] = i.getMeshesInfo(), this.Go[e] = r, this.ra[e] = s,
|
|
10611
|
+
this.sa++, this.sa >= t.length && (this.ko = !0), this.setToRedraw(!0);
|
|
10601
10612
|
}); else {
|
|
10602
10613
|
const {gltfPack: t, json: n, bbox: r} = i;
|
|
10603
|
-
t && (this.
|
|
10604
|
-
this.
|
|
10614
|
+
t && (this.Co[e] = [ t ], this.No[e] = t.getMeshesInfo(), this.Go[e] = n, this.ra[e] = r,
|
|
10615
|
+
this.sa++);
|
|
10605
10616
|
}
|
|
10606
10617
|
}
|
|
10607
|
-
this.
|
|
10618
|
+
this.sa >= t.length && (this.ko = !0);
|
|
10608
10619
|
}
|
|
10609
10620
|
getPickingVert() {
|
|
10610
10621
|
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 }";
|
|
@@ -10613,10 +10624,10 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10613
10624
|
if (t) {
|
|
10614
10625
|
this.scene.removeMesh(t);
|
|
10615
10626
|
for (let e = 0; e < t.length; e++) {
|
|
10616
|
-
const n = this.
|
|
10627
|
+
const n = this.Bo && this.Bo[t[e].uuid];
|
|
10617
10628
|
if (n) {
|
|
10618
10629
|
for (const t in n) n[t].jointTexture && n[t].jointTexture.destroy();
|
|
10619
|
-
delete this.
|
|
10630
|
+
delete this.Bo[t[e].uuid];
|
|
10620
10631
|
}
|
|
10621
10632
|
t[e].disposeInstanceData(), t[e].dispose();
|
|
10622
10633
|
}
|
|
@@ -10627,43 +10638,43 @@ const $o = [], qo = [], Jo = [], Ko = [], Zo = [], Qo = [ 0, 0, 0 ], ta = [ 0, 0
|
|
|
10627
10638
|
const t = this.getSymbols();
|
|
10628
10639
|
for (let e = 0; e < t.length; e++) {
|
|
10629
10640
|
const n = t[e].url || "pyramid";
|
|
10630
|
-
this.
|
|
10641
|
+
this.Oo.logoutGLTF(n);
|
|
10631
10642
|
}
|
|
10632
|
-
if (this.
|
|
10633
|
-
for (const t in this.
|
|
10634
|
-
const e = this.
|
|
10643
|
+
if (this.Bo) {
|
|
10644
|
+
for (const t in this.Bo) {
|
|
10645
|
+
const e = this.Bo[t];
|
|
10635
10646
|
for (const t in e) e[t].jointTexture && e[t].jointTexture.destroy();
|
|
10636
10647
|
}
|
|
10637
|
-
delete this.
|
|
10648
|
+
delete this.Bo;
|
|
10638
10649
|
}
|
|
10639
|
-
delete this.
|
|
10650
|
+
delete this.jo;
|
|
10640
10651
|
}
|
|
10641
|
-
|
|
10642
|
-
const o = i.set(
|
|
10652
|
+
na(t, e, n, s) {
|
|
10653
|
+
const o = i.set(qo, ...e || ta), a = n || ea, l = s || na, h = c.fromEuler(Qo, a[0], a[1], a[2]);
|
|
10643
10654
|
return r.fromRotationTranslationScale(t, h, o, l);
|
|
10644
10655
|
}
|
|
10645
10656
|
};
|
|
10646
10657
|
|
|
10647
|
-
class
|
|
10658
|
+
class la extends(aa(Uo)){
|
|
10648
10659
|
getMaterialClazz(t) {
|
|
10649
10660
|
return t.diffuseFactor ? n.PhongSpecularGlossinessMaterial : n.PhongMaterial;
|
|
10650
10661
|
}
|
|
10651
10662
|
}
|
|
10652
10663
|
|
|
10653
|
-
class
|
|
10664
|
+
class ha extends(aa(Wo)){
|
|
10654
10665
|
getMaterialClazz(t) {
|
|
10655
10666
|
return t.specularGlossinessTexture || t.diffuseTexture ? n.pbr.StandardSpecularGlossinessMaterial : n.pbr.StandardMaterial;
|
|
10656
10667
|
}
|
|
10657
10668
|
}
|
|
10658
10669
|
|
|
10659
|
-
const {getPBRUniforms:
|
|
10670
|
+
const {getPBRUniforms: ua} = n.pbr.PBRUtils, ca = {
|
|
10660
10671
|
color: [ 2.0303, 2.028, 2.028 ],
|
|
10661
10672
|
direction: [ 0, -.2717, -1 ]
|
|
10662
|
-
},
|
|
10673
|
+
}, fa = {
|
|
10663
10674
|
index: 0
|
|
10664
|
-
},
|
|
10675
|
+
}, da = [ 0, 0, 0 ], pa = [ 2, 2 ];
|
|
10665
10676
|
|
|
10666
|
-
class
|
|
10677
|
+
class ma extends Bi {
|
|
10667
10678
|
supportRenderMode(t) {
|
|
10668
10679
|
return "fxaa" === t || "fxaaBeforeTaa" === t;
|
|
10669
10680
|
}
|
|
@@ -10678,7 +10689,7 @@ class pa extends Bi {
|
|
|
10678
10689
|
}
|
|
10679
10690
|
needToRedraw() {
|
|
10680
10691
|
if (super.needToRedraw()) return !0;
|
|
10681
|
-
return this.getSymbol(
|
|
10692
|
+
return this.getSymbol(fa).animation;
|
|
10682
10693
|
}
|
|
10683
10694
|
createMesh(t, e) {
|
|
10684
10695
|
const {geometry: i} = t;
|
|
@@ -10687,29 +10698,29 @@ class pa extends Bi {
|
|
|
10687
10698
|
castShadow: !1,
|
|
10688
10699
|
picking: !0
|
|
10689
10700
|
});
|
|
10690
|
-
return r.properties.symbolIndex =
|
|
10701
|
+
return r.properties.symbolIndex = fa, r.setLocalTransform(e), r;
|
|
10691
10702
|
}
|
|
10692
10703
|
callShader(t, e) {
|
|
10693
10704
|
super.callShader(t, e), this.transformWater();
|
|
10694
|
-
const n = this.
|
|
10695
|
-
this.Gi += this.renderer.render(this.
|
|
10705
|
+
const n = this.oa(this.getMap(), e);
|
|
10706
|
+
this.Gi += this.renderer.render(this.aa, n, this.la, this.getRenderFBO(e));
|
|
10696
10707
|
}
|
|
10697
10708
|
addMesh(t, e) {
|
|
10698
10709
|
this._r(t, e), super.addMesh(...arguments);
|
|
10699
10710
|
}
|
|
10700
10711
|
_r(t) {
|
|
10701
|
-
const e = this.getSymbol(
|
|
10712
|
+
const e = this.getSymbol(fa).ssr;
|
|
10702
10713
|
for (let n = 0; n < t.length; n++) t[n].ssr = e ? 1 : 0;
|
|
10703
10714
|
}
|
|
10704
10715
|
paint(t) {
|
|
10705
|
-
t.states && t.states.includesChanged && (this.shader.dispose(), this.
|
|
10716
|
+
t.states && t.states.includesChanged && (this.shader.dispose(), this.aa.dispose(),
|
|
10706
10717
|
this.br(t));
|
|
10707
|
-
const e = !!t.ssr && this.getSymbol(
|
|
10718
|
+
const e = !!t.ssr && this.getSymbol(fa).ssr, n = this.aa, i = n.shaderDefines;
|
|
10708
10719
|
if (e) {
|
|
10709
10720
|
const e = Tt({}, i, t.ssr.defines);
|
|
10710
10721
|
n.shaderDefines = e;
|
|
10711
10722
|
}
|
|
10712
|
-
this.updateIBLDefines(n), this.
|
|
10723
|
+
this.updateIBLDefines(n), this.ha.ssr = e ? 1 : 0, super.paint(t), e && (n.shaderDefines = i);
|
|
10713
10724
|
}
|
|
10714
10725
|
init(t) {
|
|
10715
10726
|
this.createIBLTextures();
|
|
@@ -10727,38 +10738,38 @@ class pa extends Bi {
|
|
|
10727
10738
|
extraCommandProps: {
|
|
10728
10739
|
viewport: this.pickingViewport
|
|
10729
10740
|
}
|
|
10730
|
-
}, this.pickingFBO, this.getMap()) ]), this.
|
|
10741
|
+
}, this.pickingFBO, this.getMap()) ]), this.ua();
|
|
10731
10742
|
}
|
|
10732
|
-
|
|
10743
|
+
ua() {
|
|
10733
10744
|
const t = this.regl;
|
|
10734
|
-
this.
|
|
10745
|
+
this.ca || (this.ca = t.texture(2));
|
|
10735
10746
|
const e = this.getSymbol({
|
|
10736
10747
|
index: 0
|
|
10737
10748
|
}), n = e.texWaveNormal, i = this.getCachedTexture(n), r = this;
|
|
10738
|
-
if (i) this.
|
|
10739
|
-
this.shader && this.
|
|
10740
|
-
}, 20) : this.
|
|
10749
|
+
if (i) this.fa || (i.isLoading ? setTimeout(() => {
|
|
10750
|
+
this.shader && this.ua();
|
|
10751
|
+
}, 20) : this.fa = this.da(t, i)); else {
|
|
10741
10752
|
const e = new Image;
|
|
10742
10753
|
e.isLoading = !0, e.onload = function() {
|
|
10743
|
-
delete this.isLoading, r.
|
|
10754
|
+
delete this.isLoading, r.fa = r.da(t, this), r.setToRedraw();
|
|
10744
10755
|
}, e.onerror = () => {
|
|
10745
10756
|
console.error("invalid water wave normal texture:" + n);
|
|
10746
10757
|
}, this.addCachedTexture(n, e), e.src = n;
|
|
10747
10758
|
}
|
|
10748
10759
|
const s = e.texWavePerturbation, o = this.getCachedTexture(s);
|
|
10749
|
-
if (o) this.
|
|
10750
|
-
this.
|
|
10751
|
-
}, 20) : this.
|
|
10760
|
+
if (o) this.pa || (o.isLoading ? setTimeout(() => {
|
|
10761
|
+
this.ua(), this.shader;
|
|
10762
|
+
}, 20) : this.pa = this.da(t, o)); else {
|
|
10752
10763
|
const e = new Image;
|
|
10753
10764
|
e.isLoading = !0, e.onload = function() {
|
|
10754
|
-
delete this.isLoading, r.
|
|
10765
|
+
delete this.isLoading, r.pa = r.da(t, this), r.setToRedraw();
|
|
10755
10766
|
}, e.onerror = () => {
|
|
10756
10767
|
console.error("invalid water wave perturbation texture:" + s);
|
|
10757
10768
|
}, this.addCachedTexture(s, e), e.src = s;
|
|
10758
10769
|
}
|
|
10759
10770
|
}
|
|
10760
|
-
|
|
10761
|
-
return this.
|
|
10771
|
+
da(t, e) {
|
|
10772
|
+
return this.ca ? t.texture({
|
|
10762
10773
|
width: e.width,
|
|
10763
10774
|
height: e.height,
|
|
10764
10775
|
mag: "linear",
|
|
@@ -10864,7 +10875,7 @@ class pa extends Bi {
|
|
|
10864
10875
|
enable: !1
|
|
10865
10876
|
}
|
|
10866
10877
|
};
|
|
10867
|
-
s.push(...n.SsrPass.getUniformDeclares()), this.
|
|
10878
|
+
s.push(...n.SsrPass.getUniformDeclares()), this.aa = new n.MeshShader({
|
|
10868
10879
|
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}",
|
|
10869
10880
|
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}",
|
|
10870
10881
|
defines: o,
|
|
@@ -10880,108 +10891,108 @@ class pa extends Bi {
|
|
|
10880
10891
|
projViewMatrix: t.projViewMatrix
|
|
10881
10892
|
};
|
|
10882
10893
|
}
|
|
10883
|
-
|
|
10884
|
-
const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r =
|
|
10894
|
+
oa(t, e) {
|
|
10895
|
+
const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = ua(t, n, i, e && e.ssr, e && e.jitter), s = t.getLightManager();
|
|
10885
10896
|
let o = s && s.getDirectionalLight() || {};
|
|
10886
|
-
const l = s && s.getAmbientLight() || {}, h = this.getSymbol(
|
|
10897
|
+
const l = s && s.getAmbientLight() || {}, h = this.getSymbol(fa), u = this.ma = this.ma || [], c = this.ya = this.ya || [];
|
|
10887
10898
|
a.set(c, .09, h.uvScale || 3, .03, -.5);
|
|
10888
10899
|
Tt(r, {
|
|
10889
10900
|
ambientColor: l.color || [ .2, .2, .2 ],
|
|
10890
10901
|
viewMatrix: t.viewMatrix,
|
|
10891
|
-
lightDirection: o.direction ||
|
|
10892
|
-
lightColor: o.color ||
|
|
10902
|
+
lightDirection: o.direction || ca.direction,
|
|
10903
|
+
lightColor: o.color || ca.color,
|
|
10893
10904
|
camPos: t.cameraPosition,
|
|
10894
10905
|
timeElapsed: h.animation ? (this.layer.getRenderer().getFrameTimestamp() || 0) / (1 / (h.waterSpeed || 1) * 1e4) : 0,
|
|
10895
|
-
normalTexture: this.
|
|
10896
|
-
heightTexture: this.
|
|
10906
|
+
normalTexture: this.fa || this.ca,
|
|
10907
|
+
heightTexture: this.pa || this.ca,
|
|
10897
10908
|
waveParams: c,
|
|
10898
|
-
waterDir:
|
|
10909
|
+
waterDir: ya(u, h.waterDirection || 0),
|
|
10899
10910
|
waterBaseColor: h.waterBaseColor || [ .1451, .2588, .4863, 1 ],
|
|
10900
10911
|
contrast: h.contrast || 1,
|
|
10901
|
-
hsv: h.hsv ||
|
|
10912
|
+
hsv: h.hsv || da
|
|
10902
10913
|
});
|
|
10903
10914
|
const f = this.layer.getRenderer();
|
|
10904
10915
|
return r.layerOpacity = f.ne(), this.setIncludeUniformValues(r, e), e && e.ssr && e.ssr.renderUniforms && Tt(r, e.ssr.renderUniforms),
|
|
10905
10916
|
r;
|
|
10906
10917
|
}
|
|
10907
10918
|
delete() {
|
|
10908
|
-
super.delete(), this.
|
|
10909
|
-
this.
|
|
10910
|
-
this.
|
|
10911
|
-
this.
|
|
10919
|
+
super.delete(), this.ca && (this.ca.destroy(), delete this.ca), this.fa && this.fa.destroy(),
|
|
10920
|
+
this.pa && this.pa.destroy(), this.shader && (this.shader.dispose(), delete this.shader),
|
|
10921
|
+
this.aa && this.aa.dispose(), this.ha && (this.ha.geometry.dispose(), this.ha.material && this.ha.material.dispose(),
|
|
10922
|
+
this.ha.dispose(), delete this.ha), this.disposeIBLTextures();
|
|
10912
10923
|
}
|
|
10913
10924
|
createGround() {
|
|
10914
10925
|
const t = new n.Plane;
|
|
10915
10926
|
t.data.aTexCoord = new Uint8Array([ 0, 1, 1, 1, 0, 0, 1, 0 ]), t.generateBuffers(this.renderer.regl),
|
|
10916
|
-
this.
|
|
10927
|
+
this.ha = new n.Mesh(t, null, {
|
|
10917
10928
|
castShadow: !1
|
|
10918
|
-
}), this.
|
|
10929
|
+
}), this.la = new n.Scene([ this.ha ]);
|
|
10919
10930
|
}
|
|
10920
10931
|
transformWater() {
|
|
10921
|
-
const t = this.getMap(), e = s.getGroundTransform(this.
|
|
10922
|
-
this.
|
|
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 /
|
|
10924
|
-
this.
|
|
10925
|
-
this.
|
|
10932
|
+
const t = this.getMap(), e = s.getGroundTransform(this.ha.localTransform, t);
|
|
10933
|
+
this.ha.setLocalTransform(e);
|
|
10934
|
+
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 / pa[0], u = l / pa[1], c = h % 1, f = u % 1, d = .3737 * h % 1, p = .3737 * u % 1, m = i / pa[0] * 2, y = r / pa[1] * 2;
|
|
10935
|
+
this.ha.setUniform("uvOffset", [ c, f ]), this.ha.setUniform("noiseUvOffset", [ d, p ]),
|
|
10936
|
+
this.ha.setUniform("uvScale", [ m, -y ]);
|
|
10926
10937
|
}
|
|
10927
10938
|
}
|
|
10928
10939
|
|
|
10929
|
-
function
|
|
10940
|
+
function ya(t, e) {
|
|
10930
10941
|
var n;
|
|
10931
10942
|
return n = e, e = Math.PI * n / 180, t[0] = Math.sin(e), t[1] = Math.cos(e), t;
|
|
10932
10943
|
}
|
|
10933
10944
|
|
|
10934
|
-
const
|
|
10935
|
-
|
|
10936
|
-
ya.registerAt(he);
|
|
10937
|
-
|
|
10938
|
-
const ga = ei("line", or);
|
|
10945
|
+
const ga = ei("fill", nr);
|
|
10939
10946
|
|
|
10940
10947
|
ga.registerAt(he);
|
|
10941
10948
|
|
|
10942
|
-
const va = ei("line
|
|
10949
|
+
const va = ei("line", or);
|
|
10943
10950
|
|
|
10944
10951
|
va.registerAt(he);
|
|
10945
10952
|
|
|
10946
|
-
const xa = ei("
|
|
10953
|
+
const xa = ei("line-gradient", ar);
|
|
10947
10954
|
|
|
10948
10955
|
xa.registerAt(he);
|
|
10949
10956
|
|
|
10950
|
-
const ba = ei("
|
|
10957
|
+
const ba = ei("icon", Es);
|
|
10951
10958
|
|
|
10952
10959
|
ba.registerAt(he);
|
|
10953
10960
|
|
|
10954
|
-
const Aa = ei("
|
|
10961
|
+
const Aa = ei("text", xo);
|
|
10955
10962
|
|
|
10956
10963
|
Aa.registerAt(he);
|
|
10957
10964
|
|
|
10958
|
-
ei("native-
|
|
10959
|
-
|
|
10960
|
-
const wa = ei("phong", Vo);
|
|
10965
|
+
const wa = ei("native-line", To);
|
|
10961
10966
|
|
|
10962
10967
|
wa.registerAt(he);
|
|
10963
10968
|
|
|
10964
|
-
|
|
10969
|
+
ei("native-point", So).registerAt(he);
|
|
10970
|
+
|
|
10971
|
+
const _a = ei("phong", Uo);
|
|
10965
10972
|
|
|
10966
10973
|
_a.registerAt(he);
|
|
10967
10974
|
|
|
10968
|
-
const Sa = ei("
|
|
10975
|
+
const Sa = ei("wireframe", Bo);
|
|
10969
10976
|
|
|
10970
10977
|
Sa.registerAt(he);
|
|
10971
10978
|
|
|
10972
|
-
const Ma = ei("
|
|
10979
|
+
const Ma = ei("lit", Wo);
|
|
10973
10980
|
|
|
10974
10981
|
Ma.registerAt(he);
|
|
10975
10982
|
|
|
10976
|
-
const Pa = ei("
|
|
10983
|
+
const Pa = ei("tube", $o);
|
|
10977
10984
|
|
|
10978
10985
|
Pa.registerAt(he);
|
|
10979
10986
|
|
|
10980
|
-
const Ta = ei("gltf-
|
|
10987
|
+
const Ta = ei("gltf-phong", la);
|
|
10981
10988
|
|
|
10982
10989
|
Ta.registerAt(he);
|
|
10983
10990
|
|
|
10984
|
-
const ka = ei("
|
|
10991
|
+
const ka = ei("gltf-lit", ha);
|
|
10992
|
+
|
|
10993
|
+
ka.registerAt(he);
|
|
10994
|
+
|
|
10995
|
+
const Oa = ei("heatmap", class extends Bi {
|
|
10985
10996
|
createFnTypeConfig(t, e) {
|
|
10986
10997
|
const n = g(e.heatmapWeight), i = new Int16Array(1);
|
|
10987
10998
|
return [ {
|
|
@@ -11018,7 +11029,7 @@ const ka = ei("heatmap", class extends Bi {
|
|
|
11018
11029
|
}
|
|
11019
11030
|
callRenderer(t, e, n) {
|
|
11020
11031
|
const i = this.getRenderFBO(n);
|
|
11021
|
-
this.Gi += this.
|
|
11032
|
+
this.Gi += this.ga.render(this.scene, e, i);
|
|
11022
11033
|
}
|
|
11023
11034
|
getUniformValues(t) {
|
|
11024
11035
|
const e = this.getSymbol({
|
|
@@ -11035,24 +11046,24 @@ const ka = ei("heatmap", class extends Bi {
|
|
|
11035
11046
|
return this.scene.getMeshes();
|
|
11036
11047
|
}
|
|
11037
11048
|
delete() {
|
|
11038
|
-
super.delete(...arguments), this.
|
|
11049
|
+
super.delete(...arguments), this.ga.dispose(), delete this.ga;
|
|
11039
11050
|
}
|
|
11040
11051
|
init() {
|
|
11041
11052
|
const t = this.regl;
|
|
11042
11053
|
this.renderer = new n.Renderer(t);
|
|
11043
11054
|
const e = this.getPolygonOffset(), i = this.getSymbols()[0];
|
|
11044
|
-
this.
|
|
11055
|
+
this.ga = new d(this.regl, this.sceneConfig, this.layer, i.heatmapColor, null, e);
|
|
11045
11056
|
}
|
|
11046
11057
|
});
|
|
11047
11058
|
|
|
11048
|
-
|
|
11059
|
+
Oa.registerAt(he);
|
|
11049
11060
|
|
|
11050
|
-
const
|
|
11061
|
+
const Ia = ei("water", ma);
|
|
11051
11062
|
|
|
11052
|
-
|
|
11063
|
+
Ia.registerAt(he), we.registerPainter("lit", Wo), we.registerPainter("icon", Es),
|
|
11053
11064
|
we.registerPainter("fill", nr), we.registerPainter("line", or), we.registerPainter("line-gradient", ar),
|
|
11054
|
-
we.registerPainter("water",
|
|
11055
|
-
he.VERSION = "0.92.
|
|
11065
|
+
we.registerPainter("water", ma), we.registerPainter("tube", $o), 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"),
|
|
11066
|
+
he.VERSION = "0.92.3", we.VERSION = "0.92.3";
|
|
11056
11067
|
|
|
11057
11068
|
if (e.mat4.create(), e.transcoders) {
|
|
11058
11069
|
const n = t.Map.VERSION;
|
|
@@ -11064,6 +11075,6 @@ if (e.mat4.create(), e.transcoders) {
|
|
|
11064
11075
|
}));
|
|
11065
11076
|
} else t.registerWorkerAdapter("@maptalks/vt", q);
|
|
11066
11077
|
|
|
11067
|
-
export { $n as ExtrudePolygonLayer, nr as FillPainter,
|
|
11078
|
+
export { $n as ExtrudePolygonLayer, nr as FillPainter, ga as FillPlugin, Ta as GLTFPhongPlugin, ka as GLTFStandardPlugin, ve as GeoJSONVectorTileLayer, Oa as HeatmapPlugin, Es as IconPainter, ba as IconPlugin, xa as LineGradientPlugin, or as LinePainter, va as LinePlugin, $e as LineStringLayer, Ma as LitPlugin, ye as MapboxVectorTileLayer, To as NativeLinePainter, wa as NativeLinePlugin, So as NativePointPainter, Uo as PhongPainter, _a as PhongPlugin, Ye as PointLayer, Je as PolygonLayer, xo as TextPainter, Aa as TextPlugin, Pa as TubePlugin, we as Vector3DLayer, he as VectorTileLayer, Jt as VectorTileLayerRenderer, Ia as WaterPlugin, Bo as WireframePainter, Sa as WireframePlugin };
|
|
11068
11079
|
|
|
11069
|
-
"undefined" != typeof console && console.log("@maptalks/vt v0.92.
|
|
11080
|
+
"undefined" != typeof console && console.log("@maptalks/vt v0.92.3");
|