@maptalks/3dtiles 0.11.3 → 0.12.1
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.3dtiles.js +941 -937
- package/package.json +4 -2
package/dist/maptalks.3dtiles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/3dtiles v0.
|
|
2
|
+
* @maptalks/3dtiles v0.12.1
|
|
3
3
|
* LICENSE : UNLICENSED
|
|
4
4
|
* (c) 2016-2022 maptalks.com
|
|
5
5
|
*/
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
t;
|
|
44
44
|
}
|
|
45
45
|
function r(t, e, n) {
|
|
46
|
-
var r = e[0], s = e[1], i = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], f = e[8], l = e[9], d = e[10], m = e[11], y = e[12], b = e[13], p = e[14], w = e[15],
|
|
47
|
-
return t[0] =
|
|
48
|
-
t[2] =
|
|
49
|
-
|
|
50
|
-
t[6] =
|
|
51
|
-
|
|
52
|
-
t[10] =
|
|
53
|
-
|
|
54
|
-
t[14] =
|
|
46
|
+
var r = e[0], s = e[1], i = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], f = e[8], l = e[9], d = e[10], m = e[11], y = e[12], b = e[13], p = e[14], w = e[15], _ = n[0], g = n[1], T = n[2], A = n[3];
|
|
47
|
+
return t[0] = _ * r + g * a + T * f + A * y, t[1] = _ * s + g * c + T * l + A * b,
|
|
48
|
+
t[2] = _ * i + g * h + T * d + A * p, t[3] = _ * o + g * u + T * m + A * w, _ = n[4],
|
|
49
|
+
g = n[5], T = n[6], A = n[7], t[4] = _ * r + g * a + T * f + A * y, t[5] = _ * s + g * c + T * l + A * b,
|
|
50
|
+
t[6] = _ * i + g * h + T * d + A * p, t[7] = _ * o + g * u + T * m + A * w, _ = n[8],
|
|
51
|
+
g = n[9], T = n[10], A = n[11], t[8] = _ * r + g * a + T * f + A * y, t[9] = _ * s + g * c + T * l + A * b,
|
|
52
|
+
t[10] = _ * i + g * h + T * d + A * p, t[11] = _ * o + g * u + T * m + A * w, _ = n[12],
|
|
53
|
+
g = n[13], T = n[14], A = n[15], t[12] = _ * r + g * a + T * f + A * y, t[13] = _ * s + g * c + T * l + A * b,
|
|
54
|
+
t[14] = _ * i + g * h + T * d + A * p, t[15] = _ * o + g * u + T * m + A * w, t;
|
|
55
55
|
}
|
|
56
56
|
function s() {
|
|
57
57
|
var t = new e(3);
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
var b = function(t, e, n) {
|
|
101
101
|
return t[0] = e[0] - n[0], t[1] = e[1] - n[1], t[2] = e[2] - n[2], t;
|
|
102
102
|
}, p = u, w = i;
|
|
103
|
-
function
|
|
103
|
+
function _(t, e, n, r, s) {
|
|
104
104
|
return t[0] = e, t[1] = n, t[2] = r, t[3] = s, t;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function g() {
|
|
107
107
|
var t = new e(4);
|
|
108
108
|
return e != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t[3] = 1, t;
|
|
109
109
|
}
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
var A, v = function(t, e) {
|
|
122
122
|
return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t;
|
|
123
123
|
};
|
|
124
|
-
s(), o(1, 0, 0), o(0, 1, 0),
|
|
124
|
+
s(), o(1, 0, 0), o(0, 1, 0), g(), g(), A = new e(9), e != Float32Array && (A[1] = 0,
|
|
125
125
|
A[2] = 0, A[3] = 0, A[5] = 0, A[6] = 0, A[7] = 0), A[0] = 1, A[4] = 1, A[8] = 1;
|
|
126
126
|
/*!
|
|
127
|
-
* @maptalks/gltf-loader v0.
|
|
127
|
+
* @maptalks/gltf-loader v0.24.0
|
|
128
128
|
* LICENSE : UNLICENSED
|
|
129
129
|
* (c) 2016-2022 maptalks.org
|
|
130
130
|
*/
|
|
@@ -170,14 +170,14 @@
|
|
|
170
170
|
function N(t) {
|
|
171
171
|
return 0 === t.indexOf("data:") && t.indexOf("base64,") > 0;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function E(t) {
|
|
174
174
|
const e = function(t) {
|
|
175
175
|
return "undefined" != typeof self ? self.atob(t) : window.atob(t);
|
|
176
176
|
}(t.substring(t.indexOf(",") + 1)), n = e.length, r = new Uint8Array(n);
|
|
177
177
|
for (let t = 0; t < n; t++) r[t] = e.charCodeAt(t);
|
|
178
178
|
return r.buffer;
|
|
179
179
|
}
|
|
180
|
-
const
|
|
180
|
+
const P = [], L = [], B = [], U = [ 0, 0, 0 ], C = function(t) {
|
|
181
181
|
return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t;
|
|
182
182
|
}([]), R = [ 1, 1, 1 ];
|
|
183
183
|
function F(t, e, n, r, s, i, o) {
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
});
|
|
281
281
|
if ("binary_glTF" !== t.buffer && "KHR_binary_glTF" !== t.buffer && e.uri) {
|
|
282
282
|
if (N(e.uri)) {
|
|
283
|
-
const t = this.buffers[e.id] =
|
|
283
|
+
const t = this.buffers[e.id] = E(e.uri);
|
|
284
284
|
return Promise.resolve({
|
|
285
285
|
buffer: t,
|
|
286
286
|
byteOffset: 0
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
}
|
|
346
346
|
if (t.uri) {
|
|
347
347
|
if (N(t.uri)) {
|
|
348
|
-
const e =
|
|
348
|
+
const e = E(t.uri), n = k(e, 0, e.byteLength);
|
|
349
349
|
return t.content = n, Promise.resolve(t);
|
|
350
350
|
}
|
|
351
351
|
{
|
|
@@ -382,16 +382,16 @@
|
|
|
382
382
|
return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0,
|
|
383
383
|
t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = e[0], t[13] = e[1], t[14] = e[2],
|
|
384
384
|
t[15] = 1, t;
|
|
385
|
-
}(
|
|
385
|
+
}(P, e.translation || U), s = function(t, e) {
|
|
386
386
|
var n = e[0], r = e[1], s = e[2], i = e[3], o = n + n, a = r + r, c = s + s, h = n * o, u = r * o, f = r * a, l = s * o, d = s * a, m = s * c, y = i * o, b = i * a, p = i * c;
|
|
387
387
|
return t[0] = 1 - f - m, t[1] = u + p, t[2] = l - b, t[3] = 0, t[4] = u - p, t[5] = 1 - h - m,
|
|
388
388
|
t[6] = d + y, t[7] = 0, t[8] = l + b, t[9] = d - y, t[10] = 1 - h - f, t[11] = 0,
|
|
389
389
|
t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
|
|
390
|
-
}(
|
|
390
|
+
}(L, e.rotation || C), i = function(t, e) {
|
|
391
391
|
return t[0] = e[0], t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e[1], t[6] = 0,
|
|
392
392
|
t[7] = 0, t[8] = 0, t[9] = 0, t[10] = e[2], t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0,
|
|
393
393
|
t[15] = 1, t;
|
|
394
|
-
}(
|
|
394
|
+
}(B, e.scale || R);
|
|
395
395
|
return r(i, s, i), r(t, n, i);
|
|
396
396
|
}
|
|
397
397
|
return n(t);
|
|
@@ -400,7 +400,7 @@
|
|
|
400
400
|
}
|
|
401
401
|
return e;
|
|
402
402
|
}
|
|
403
|
-
|
|
403
|
+
_(t) {
|
|
404
404
|
const e = {};
|
|
405
405
|
for (const n in t) {
|
|
406
406
|
const r = t[n];
|
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
}
|
|
418
418
|
return e;
|
|
419
419
|
}
|
|
420
|
-
|
|
420
|
+
g(t) {
|
|
421
421
|
if (t.bufferView || t.extensions && (t.extensions.KHR_binary_glTF || t.extensions.binary_glTF)) {
|
|
422
422
|
const e = t.bufferView ? t : t.extensions.KHR_binary_glTF || t.extensions.binary_glTF;
|
|
423
423
|
if (t.extensions && (t.mimeType = e.mimeType, t.width = e.width, t.height = e.height),
|
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
const e = this.gltf.textures[t];
|
|
438
438
|
if (!e) return null;
|
|
439
439
|
const n = this.gltf.images[e.source];
|
|
440
|
-
return this.
|
|
440
|
+
return this.g(n).then(t => {
|
|
441
441
|
const r = this.gltf.samplers[e.sampler];
|
|
442
442
|
return {
|
|
443
443
|
image: {
|
|
@@ -481,9 +481,10 @@
|
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
class H {
|
|
484
|
-
constructor(t, e, n, r, s) {
|
|
484
|
+
constructor(t, e, n, r, s, i) {
|
|
485
485
|
this.rootPath = t, this.gltf = e, this.glbBuffer = n, this.images = {}, this.buffers = {},
|
|
486
|
-
this.requests = {}, this.A = r, this.accessor = new V(t, e, n), this.decoders = s
|
|
486
|
+
this.requests = {}, this.A = r, this.accessor = new V(t, e, n), this.decoders = s,
|
|
487
|
+
this.v = i;
|
|
487
488
|
}
|
|
488
489
|
iterate(t, e) {
|
|
489
490
|
const n = this.gltf[e];
|
|
@@ -498,11 +499,12 @@
|
|
|
498
499
|
const e = this.gltf.textures[t];
|
|
499
500
|
if (!e) return null;
|
|
500
501
|
const n = this.gltf.images[e.source];
|
|
501
|
-
return this.
|
|
502
|
+
return this.g(n).then(t => {
|
|
502
503
|
if (!t) return null;
|
|
503
504
|
const r = {
|
|
504
505
|
image: {
|
|
505
506
|
array: t.data,
|
|
507
|
+
mipmap: t.mipmap,
|
|
506
508
|
width: t.width,
|
|
507
509
|
height: t.height,
|
|
508
510
|
index: e.source,
|
|
@@ -517,68 +519,70 @@
|
|
|
517
519
|
return s && (r.sampler = s), t.format && (r.format = t.format), r;
|
|
518
520
|
});
|
|
519
521
|
}
|
|
520
|
-
|
|
521
|
-
if (!S(t.bufferView)) return this.
|
|
522
|
+
g(t) {
|
|
523
|
+
if (!S(t.bufferView)) return this.O(t);
|
|
522
524
|
{
|
|
523
525
|
const e = this.gltf.bufferViews[t.bufferView];
|
|
524
526
|
if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
|
|
525
527
|
const n = this.gltf.buffers[e.buffer];
|
|
526
|
-
if (n.uri) return this.
|
|
527
|
-
if (this.glbBuffer) return this.
|
|
528
|
+
if (n.uri) return this.M(n, e, t);
|
|
529
|
+
if (this.glbBuffer) return this.S(e, t);
|
|
528
530
|
}
|
|
529
531
|
return null;
|
|
530
532
|
}
|
|
531
|
-
|
|
533
|
+
O(t) {
|
|
532
534
|
const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
|
|
533
|
-
return this.requests[t.id] ? this.requests[t.id].then(() => this.images[t.id]) : this.requests[t.id] = this.
|
|
535
|
+
return this.requests[t.id] ? this.requests[t.id].then(() => this.images[t.id]) : this.requests[t.id] = this.I(t.id, e);
|
|
534
536
|
}
|
|
535
|
-
|
|
537
|
+
N(t, e) {
|
|
536
538
|
const n = this.decoders;
|
|
537
|
-
if (n[e.mimeType]) return n[e.mimeType](t
|
|
539
|
+
if (n[e.mimeType]) return n[e.mimeType](t, {
|
|
540
|
+
supportedFormats: this.v
|
|
541
|
+
});
|
|
538
542
|
if ("image/crn" === e.mimeType || "image/ktx2" === e.mimeType || "image/cttf" === e.mimeType) return console.warn("missing transcoder for " + e.mimeType, ", visit https://maptalks.com/docs/transcoders for details"),
|
|
539
543
|
Promise.resolve(null);
|
|
540
544
|
{
|
|
541
545
|
const n = new Blob([ t ], {
|
|
542
546
|
type: e.mimeType
|
|
543
547
|
}), r = URL.createObjectURL(n);
|
|
544
|
-
return this.
|
|
548
|
+
return this.I(e.id, r);
|
|
545
549
|
}
|
|
546
550
|
}
|
|
547
|
-
|
|
551
|
+
M(t, e, n) {
|
|
548
552
|
if (this.buffers[t.id]) {
|
|
549
|
-
const r = this.buffers[t.id], s = this.
|
|
550
|
-
return this.
|
|
553
|
+
const r = this.buffers[t.id], s = this.P(e, r);
|
|
554
|
+
return this.N(s, n);
|
|
551
555
|
}
|
|
552
556
|
if (this.requests[t.id]) return this.requests[t.id].then(() => {
|
|
553
|
-
const r = this.buffers[t.id], s = this.
|
|
554
|
-
return this.
|
|
557
|
+
const r = this.buffers[t.id], s = this.P(e, r);
|
|
558
|
+
return this.N(s, n);
|
|
555
559
|
});
|
|
556
560
|
if (N(t.uri)) {
|
|
557
|
-
const r = this.buffers[t.id] =
|
|
558
|
-
return this.
|
|
561
|
+
const r = this.buffers[t.id] = E(t.uri), s = this.P(e, r);
|
|
562
|
+
return this.N(s, n);
|
|
559
563
|
}
|
|
560
564
|
return this.requests[t.id] = j.getArrayBuffer(t.uri, null).then(r => {
|
|
561
|
-
const s = this.buffers[t.id] = r.data, i = this.
|
|
562
|
-
return this.
|
|
565
|
+
const s = this.buffers[t.id] = r.data, i = this.P(e, s);
|
|
566
|
+
return this.N(i, n);
|
|
563
567
|
});
|
|
564
568
|
}
|
|
565
|
-
M(t, e) {
|
|
566
|
-
const n = this.N(t, this.glbBuffer.buffer, this.glbBuffer.byteOffset);
|
|
567
|
-
return this.I(n, e);
|
|
568
|
-
}
|
|
569
569
|
S(t, e) {
|
|
570
|
+
const n = this.P(t, this.glbBuffer.buffer, this.glbBuffer.byteOffset);
|
|
571
|
+
return this.N(n, e);
|
|
572
|
+
}
|
|
573
|
+
I(t, e) {
|
|
570
574
|
return new Promise((n, r) => {
|
|
571
575
|
this.A(e, (s, i) => {
|
|
572
576
|
s ? r(s) : (URL.revokeObjectURL(e), this.images[t] = i, n(this.images[t]));
|
|
573
577
|
});
|
|
574
578
|
});
|
|
575
579
|
}
|
|
576
|
-
|
|
580
|
+
P(t, e, n) {
|
|
577
581
|
n = n || 0;
|
|
578
582
|
const r = t.byteOffset + n, s = t.byteLength;
|
|
579
583
|
return new Uint8Array(e, r, s);
|
|
580
584
|
}
|
|
581
|
-
|
|
585
|
+
L(t, e) {
|
|
582
586
|
const n = new Array(t.byteLength);
|
|
583
587
|
for (let e = 0; e < t.byteLength; e++) n[e] = String.fromCharCode(t[e]);
|
|
584
588
|
return n.join(""), "data:" + (e = e || "image/png") + ";base64," + function(t) {
|
|
@@ -675,7 +679,7 @@
|
|
|
675
679
|
return n;
|
|
676
680
|
}(new Uint8Array(t, e, n));
|
|
677
681
|
}
|
|
678
|
-
const K = [ 1, 1, 1, 1, 2, 2, 3, 0 ], X = [ 0, 0, 0 ],
|
|
682
|
+
const K = [ 1, 1, 1, 1, 2, 2, 3, 0 ], X = [ 0, 0, 0 ], W = [ 0, 0, 0, 1 ], Z = [ 1, 1, 1 ], Y = {
|
|
679
683
|
TRANSLATION: [ 0, 0, 0 ],
|
|
680
684
|
ROTATION: [ 0, 0, 0, 1 ],
|
|
681
685
|
SCALE: [ 1, 1, 1 ]
|
|
@@ -686,7 +690,7 @@
|
|
|
686
690
|
NEXTINDEX: null,
|
|
687
691
|
INTERPOLATION: null
|
|
688
692
|
}, tt = {
|
|
689
|
-
|
|
693
|
+
B(t, e, n, r, s, i, o, c) {
|
|
690
694
|
const h = S(t) ? e.animations : [ e.animations[0] ], u = {};
|
|
691
695
|
for (let e = 0; e < h.length; e++) {
|
|
692
696
|
const f = h[e];
|
|
@@ -694,9 +698,9 @@
|
|
|
694
698
|
const l = f.channelsMap[n];
|
|
695
699
|
if (l) for (let t = 0; t < l.length; t++) {
|
|
696
700
|
const e = l[t];
|
|
697
|
-
"translation" === e.target.path ? (this.U(s, f.samplers[e.sampler], r, 1), u.translation = a(X, s)) : "rotation" === e.target.path ? (this.
|
|
698
|
-
u.rotation = v(
|
|
699
|
-
u.scale = a(
|
|
701
|
+
"translation" === e.target.path ? (this.U(s, f.samplers[e.sampler], r, 1), u.translation = a(X, s)) : "rotation" === e.target.path ? (this.C(i, f.samplers[e.sampler], r, 1),
|
|
702
|
+
u.rotation = v(W, i)) : "scale" === e.target.path ? (this.U(o, f.samplers[e.sampler], r, 1),
|
|
703
|
+
u.scale = a(Z, o)) : "weights" === e.target.path && c && (this.U(c, f.samplers[e.sampler], r, c.length),
|
|
700
704
|
u.weights = c);
|
|
701
705
|
}
|
|
702
706
|
}
|
|
@@ -706,7 +710,7 @@
|
|
|
706
710
|
switch (e.interpolation) {
|
|
707
711
|
case "LINEAR":
|
|
708
712
|
{
|
|
709
|
-
const s = this.
|
|
713
|
+
const s = this.R(Q, e, n, 1 * r);
|
|
710
714
|
s && (t = function(t, e, n, r) {
|
|
711
715
|
for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
|
|
712
716
|
return t;
|
|
@@ -716,7 +720,7 @@
|
|
|
716
720
|
|
|
717
721
|
case "STEP":
|
|
718
722
|
{
|
|
719
|
-
const s = this.
|
|
723
|
+
const s = this.R(Q, e, n, 1 * r);
|
|
720
724
|
s && (t = function(t, e) {
|
|
721
725
|
for (let n = 0; n < t.length; n++) t[n] = e[n];
|
|
722
726
|
return t;
|
|
@@ -726,36 +730,36 @@
|
|
|
726
730
|
|
|
727
731
|
case "CUBICSPLINE":
|
|
728
732
|
{
|
|
729
|
-
const s = this.
|
|
730
|
-
s && (t = this.
|
|
733
|
+
const s = this.R(Q, e, n, 3 * r);
|
|
734
|
+
s && (t = this.F(t, s, e.input.array, 3 * r));
|
|
731
735
|
break;
|
|
732
736
|
}
|
|
733
737
|
}
|
|
734
738
|
return t;
|
|
735
739
|
},
|
|
736
|
-
|
|
740
|
+
C(t, e, n) {
|
|
737
741
|
switch (e.interpolation) {
|
|
738
742
|
case "LINEAR":
|
|
739
743
|
{
|
|
740
|
-
const r = this.
|
|
744
|
+
const r = this.R(Q, e, n, 1);
|
|
741
745
|
r && T(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
|
|
742
746
|
break;
|
|
743
747
|
}
|
|
744
748
|
|
|
745
749
|
case "STEP":
|
|
746
750
|
{
|
|
747
|
-
const r = this.
|
|
748
|
-
r && (t =
|
|
751
|
+
const r = this.R(Q, e, n, 1);
|
|
752
|
+
r && (t = _(t, ...r.PREVIOUS));
|
|
749
753
|
break;
|
|
750
754
|
}
|
|
751
755
|
|
|
752
756
|
case "CUBICSPLINE":
|
|
753
757
|
{
|
|
754
|
-
const r = this.
|
|
758
|
+
const r = this.R(Q, e, n, 3);
|
|
755
759
|
if (r) {
|
|
756
760
|
for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
|
|
757
761
|
r.NEXT[t] = Math.acos(r.NEXT[t]);
|
|
758
|
-
t = this.
|
|
762
|
+
t = this.F(t, r, e.input.array, 3);
|
|
759
763
|
for (let e = 0; e < t.length; e++) t[e] = Math.cos(t[e]);
|
|
760
764
|
}
|
|
761
765
|
break;
|
|
@@ -763,7 +767,7 @@
|
|
|
763
767
|
}
|
|
764
768
|
return t;
|
|
765
769
|
},
|
|
766
|
-
|
|
770
|
+
D(t, e) {
|
|
767
771
|
const n = t.length;
|
|
768
772
|
let r, s, i, o = 0, a = n - 1, c = Math.floor((o + a) / 2);
|
|
769
773
|
for (;o <= n - 1 && a >= 0; ) {
|
|
@@ -780,11 +784,11 @@
|
|
|
780
784
|
}
|
|
781
785
|
return null;
|
|
782
786
|
},
|
|
783
|
-
|
|
787
|
+
R(t, e, n, r) {
|
|
784
788
|
const s = e.input.array, i = e.output.array, o = e.output.itemSize;
|
|
785
789
|
(n < s[0] || n > s[s.length - 1]) && (n = Math.max(s[0], Math.min(s[s.length - 1], n))),
|
|
786
790
|
n === s[s.length - 1] && (n = s[0]);
|
|
787
|
-
const a = this.
|
|
791
|
+
const a = this.D(s, n);
|
|
788
792
|
if (!a || !a.nextIndex) return null;
|
|
789
793
|
const {preIndx: c, nextIndex: h, interpolation: u} = a;
|
|
790
794
|
t.PREINDEX = c, t.NEXTINDEX = h, t.INTERPOLATION = u;
|
|
@@ -792,7 +796,7 @@
|
|
|
792
796
|
return t.PREVIOUS = i.subarray(t.PREINDEX * f, (t.PREINDEX + 1) * f), t.NEXT = i.subarray(t.NEXTINDEX * f, (t.NEXTINDEX + 1) * f),
|
|
793
797
|
t;
|
|
794
798
|
},
|
|
795
|
-
|
|
799
|
+
F(t, e, n, r) {
|
|
796
800
|
const s = e.INTERPOLATION, i = n[e.PREINDEX], o = n[e.NEXTINDEX];
|
|
797
801
|
for (let n = 0; n < 3; n++) {
|
|
798
802
|
const a = e.PREVIOUS[r + n], c = (o - i) * e.PREVIOUS[2 * r + n], h = e.NEXT[3 + n], u = (o - i) * e.NEXT[n], f = (2 * Math.pow(s, 3) - 3 * Math.pow(s, 2) + 1) * a + (Math.pow(s, 3) - 2 * Math.pow(s, 2) + s) * c + (2 * -Math.pow(s, 3) + 3 * Math.pow(s, 2)) * h + (Math.pow(s, 3) - Math.pow(s, 2)) * u;
|
|
@@ -802,7 +806,7 @@
|
|
|
802
806
|
},
|
|
803
807
|
getAnimationClip(t, e, n, r) {
|
|
804
808
|
const s = t.nodes[e] && t.nodes[e].weights;
|
|
805
|
-
return c(X, ...Y.TRANSLATION),
|
|
809
|
+
return c(X, ...Y.TRANSLATION), _(W, ...Y.ROTATION), c(Z, ...Y.SCALE), this.B(r, t, e, n, X, W, Z, s);
|
|
806
810
|
},
|
|
807
811
|
getTimeSpan(t) {
|
|
808
812
|
if (!t.animations) return null;
|
|
@@ -841,25 +845,25 @@
|
|
|
841
845
|
if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
|
|
842
846
|
e.buffer instanceof ArrayBuffer) {
|
|
843
847
|
const {json: n, glbBuffer: r} = $.read(e.buffer, e.byteOffset, e.byteLength);
|
|
844
|
-
this.
|
|
845
|
-
} else this.
|
|
846
|
-
this.
|
|
848
|
+
this.k(t, n, r);
|
|
849
|
+
} else this.k(t, e);
|
|
850
|
+
this.j = new V(this.rootPath, this.gltf, this.glbBuffer), this.V();
|
|
847
851
|
}
|
|
848
|
-
|
|
852
|
+
V() {
|
|
849
853
|
const t = this.gltf.extensionsRequired;
|
|
850
854
|
if (t) {
|
|
851
855
|
if (t.indexOf("KHR_draco_mesh_compression") >= 0 && !this.options.decoders.draco) throw new Error("KHR_draco_mesh_compression is required but @maptalks/transcoders.draco is not loaded");
|
|
852
856
|
if (t.indexOf("KHR_texture_basisu") >= 0 && !this.options.decoders.ktx2) throw new Error("KHR_texture_basisu is required but @maptalks/transcoders.ktx2 is not loaded");
|
|
853
857
|
}
|
|
854
858
|
}
|
|
855
|
-
|
|
859
|
+
G() {
|
|
856
860
|
const t = this.gltf.extensions;
|
|
857
|
-
return t && t.KHR_techniques_webgl ? this.
|
|
861
|
+
return t && t.KHR_techniques_webgl ? this.j.requestKHRTechniquesWebgl(t.KHR_techniques_webgl).then(e => (t.KHR_techniques_webgl = e,
|
|
858
862
|
t)) : Promise.resolve(t);
|
|
859
863
|
}
|
|
860
864
|
load(t) {
|
|
861
865
|
t = t || {};
|
|
862
|
-
const e = this.
|
|
866
|
+
const e = this.H(t), n = this.q(), r = this.$(), s = this.G();
|
|
863
867
|
return Promise.all([ e, n, r, s ]).then(t => (t[0].animations = t[1], t[0].textures = t[2],
|
|
864
868
|
t[0].extensions = t[3], t[0].transferables = this.transferables || [], this.createChannelsMap(t[0]),
|
|
865
869
|
t[0]));
|
|
@@ -902,10 +906,10 @@
|
|
|
902
906
|
static readInterleavedArray(t, e, n, r, s, i, o) {
|
|
903
907
|
return F(t, e, n, r, s, i, o);
|
|
904
908
|
}
|
|
905
|
-
|
|
909
|
+
k(t, e, n) {
|
|
906
910
|
this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
|
|
907
911
|
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = et ? at : this.options.requestImage || st,
|
|
908
|
-
this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new H(t, e, n, this.options.requestImage, this.options.decoders || {}),
|
|
912
|
+
this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new H(t, e, n, this.options.requestImage, this.options.decoders || {}, this.options.supportedFormats || {}),
|
|
909
913
|
this.adapter.iterate((t, e, n) => {
|
|
910
914
|
e.id = "buffer_" + n;
|
|
911
915
|
}, "buffers"), this.adapter.iterate((t, e, n) => {
|
|
@@ -916,25 +920,25 @@
|
|
|
916
920
|
e.id = "accessor_" + n;
|
|
917
921
|
}, "accessors"));
|
|
918
922
|
}
|
|
919
|
-
|
|
923
|
+
J(t, e) {
|
|
920
924
|
if (t.children && t.children.length > 0) {
|
|
921
925
|
if (!("number" == typeof (n = t.children[0]) && isFinite(n) || function(t) {
|
|
922
926
|
return !M(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
|
|
923
927
|
}(t.children[0]))) return t;
|
|
924
928
|
const r = t.children.map(t => {
|
|
925
929
|
const n = e[t];
|
|
926
|
-
return n.nodeIndex = t, this
|
|
930
|
+
return n.nodeIndex = t, this.J(n, e);
|
|
927
931
|
});
|
|
928
932
|
t.children = r;
|
|
929
933
|
}
|
|
930
934
|
var n;
|
|
931
935
|
return t;
|
|
932
936
|
}
|
|
933
|
-
|
|
934
|
-
return this.
|
|
937
|
+
H(t) {
|
|
938
|
+
return this.K(t).then(t => {
|
|
935
939
|
const e = this.scenes = [];
|
|
936
940
|
let n;
|
|
937
|
-
for (const e in t) t[e] = this
|
|
941
|
+
for (const e in t) t[e] = this.J(t[e], t), t[e].nodeIndex = Number(e) ? Number(e) : e;
|
|
938
942
|
this.adapter.iterate((r, s, i) => {
|
|
939
943
|
const o = {};
|
|
940
944
|
s.name && (o.name = s.name), s.nodes && (o.nodes = s.nodes.map(e => t[e])), this.gltf.scene === r && (n = i),
|
|
@@ -950,14 +954,14 @@
|
|
|
950
954
|
skins: this.skins
|
|
951
955
|
};
|
|
952
956
|
if (this.gltf.extensions && (r.extensions = this.gltf.extensions), 1 === this.version) {
|
|
953
|
-
const t = this.adapter.
|
|
957
|
+
const t = this.adapter._(this.gltf.materials);
|
|
954
958
|
r.materials = t;
|
|
955
959
|
}
|
|
956
960
|
return r;
|
|
957
961
|
});
|
|
958
962
|
}
|
|
959
|
-
|
|
960
|
-
return this.
|
|
963
|
+
K(t) {
|
|
964
|
+
return this.X(t).then(() => {
|
|
961
965
|
const t = this.nodes = {};
|
|
962
966
|
return this.adapter.iterate((e, n) => {
|
|
963
967
|
const r = this.adapter.createNode(n, this.meshes, this.skins);
|
|
@@ -965,7 +969,7 @@
|
|
|
965
969
|
}, "nodes"), t;
|
|
966
970
|
});
|
|
967
971
|
}
|
|
968
|
-
|
|
972
|
+
W() {
|
|
969
973
|
this.skins = [];
|
|
970
974
|
const t = [];
|
|
971
975
|
return this.adapter.iterate((e, n, r) => {
|
|
@@ -980,27 +984,27 @@
|
|
|
980
984
|
e && e.buffer && this.transferables && this.transferables.indexOf(e.buffer) < 0 && this.transferables.push(e.buffer),
|
|
981
985
|
t));
|
|
982
986
|
}
|
|
983
|
-
|
|
987
|
+
q() {
|
|
984
988
|
const t = this.gltf.animations;
|
|
985
989
|
return S(t) ? this.adapter.getAnimations(t) : null;
|
|
986
990
|
}
|
|
987
|
-
|
|
991
|
+
X(t) {
|
|
988
992
|
this.meshes = {};
|
|
989
993
|
let e = [];
|
|
990
994
|
return this.adapter.iterate((n, r, s) => {
|
|
991
|
-
e.push(this.
|
|
995
|
+
e.push(this.Y(r, t).then(t => {
|
|
992
996
|
t.index = s, this.meshes[n] = t;
|
|
993
997
|
}));
|
|
994
|
-
}, "meshes"), e = e.concat(this.
|
|
998
|
+
}, "meshes"), e = e.concat(this.W()), Promise.all(e);
|
|
995
999
|
}
|
|
996
|
-
|
|
997
|
-
const n = t.primitives.map(t => this.
|
|
1000
|
+
Y(t, e) {
|
|
1001
|
+
const n = t.primitives.map(t => this.tt(t, e)).filter(t => !!t);
|
|
998
1002
|
return Promise.all(n).then(e => {
|
|
999
1003
|
const n = {};
|
|
1000
1004
|
return x(n, t), n.primitives = e, n;
|
|
1001
1005
|
});
|
|
1002
1006
|
}
|
|
1003
|
-
|
|
1007
|
+
$() {
|
|
1004
1008
|
const t = this.gltf.textures;
|
|
1005
1009
|
if (!t) return null;
|
|
1006
1010
|
const e = [];
|
|
@@ -1018,13 +1022,13 @@
|
|
|
1018
1022
|
return e;
|
|
1019
1023
|
});
|
|
1020
1024
|
}
|
|
1021
|
-
|
|
1025
|
+
tt(t, e) {
|
|
1022
1026
|
let n;
|
|
1023
1027
|
const r = t.extensions;
|
|
1024
1028
|
if (r && r.KHR_draco_mesh_compression) {
|
|
1025
1029
|
if (!this.options.decoders.draco && (!this.gltf.extensionsRequired || !this.gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression") < 0)) return null;
|
|
1026
1030
|
const t = this.options.decoders.draco, {bufferView: s, attributes: i} = r.KHR_draco_mesh_compression, o = this.gltf.bufferViews[s];
|
|
1027
|
-
n = this.
|
|
1031
|
+
n = this.j.l(o).then(n => {
|
|
1028
1032
|
const {buffer: r, byteOffset: s} = n;
|
|
1029
1033
|
let {byteOffset: a, byteLength: c} = o;
|
|
1030
1034
|
a || (a = 0);
|
|
@@ -1130,14 +1134,14 @@
|
|
|
1130
1134
|
const n = dt, r = function(t, e, n, r, s) {
|
|
1131
1135
|
const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], l = i * i * c * c, d = o * o * h * h, m = a * a * u * u, y = l + d + m, b = Math.sqrt(1 / y), p = f(wt, e, b);
|
|
1132
1136
|
if (y < s) return isFinite(b) ? p : void 0;
|
|
1133
|
-
const w = r[0],
|
|
1134
|
-
T[0] = p[0] * w * 2, T[1] = p[1] *
|
|
1135
|
-
let A, v, O, M, S, x, I, N,
|
|
1137
|
+
const w = r[0], _ = r[1], g = r[2], T = _t;
|
|
1138
|
+
T[0] = p[0] * w * 2, T[1] = p[1] * _ * 2, T[2] = p[2] * g * 2;
|
|
1139
|
+
let A, v, O, M, S, x, I, N, E, P, L, B = (1 - b) * gt(e) / (.5 * gt(T)), U = 0;
|
|
1136
1140
|
do {
|
|
1137
|
-
|
|
1138
|
-
I = M * M, N = S * S,
|
|
1139
|
-
v = l *
|
|
1140
|
-
|
|
1141
|
+
B -= U, O = 1 / (1 + B * w), M = 1 / (1 + B * _), S = 1 / (1 + B * g), x = O * O,
|
|
1142
|
+
I = M * M, N = S * S, E = x * O, P = I * M, L = N * S, A = l * x + d * I + m * N - 1,
|
|
1143
|
+
v = l * E * w + d * P * _ + m * L * g;
|
|
1144
|
+
U = A / (-2 * v);
|
|
1141
1145
|
} while (Math.abs(A) > 1e-12);
|
|
1142
1146
|
return t[0] = i * O, t[1] = o * M, t[2] = a * S, t;
|
|
1143
1147
|
}(mt, e, lt, n, .1);
|
|
@@ -1148,11 +1152,11 @@
|
|
|
1148
1152
|
i > 0 && (i = Math.sqrt(i), t[0] = e[0] / i, t[1] = e[1] / i, t[2] = e[2] / i);
|
|
1149
1153
|
return t;
|
|
1150
1154
|
}(s, s);
|
|
1151
|
-
const i = b(bt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = ht(d(i, e)) *
|
|
1155
|
+
const i = b(bt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = ht(d(i, e)) * gt(i);
|
|
1152
1156
|
return t[0] = ct(o), t[1] = ct(a), t[2] = c, t;
|
|
1153
1157
|
}
|
|
1154
|
-
const wt = new Array(3),
|
|
1155
|
-
function
|
|
1158
|
+
const wt = new Array(3), _t = new Array(3);
|
|
1159
|
+
function gt(t) {
|
|
1156
1160
|
return i(t);
|
|
1157
1161
|
}
|
|
1158
1162
|
function Tt(t, e) {
|
|
@@ -1195,6 +1199,7 @@
|
|
|
1195
1199
|
};
|
|
1196
1200
|
}
|
|
1197
1201
|
function xt(t, e, n, r) {
|
|
1202
|
+
t.componentType || (t.componentType = "UNSIGNED_SHORT");
|
|
1198
1203
|
const s = St(t, e, n, r);
|
|
1199
1204
|
return s.array.buffer.byteLength !== e.byteLength && (s.array = s.array.slice()),
|
|
1200
1205
|
s;
|
|
@@ -1247,17 +1252,17 @@
|
|
|
1247
1252
|
name: "Float64Array"
|
|
1248
1253
|
}
|
|
1249
1254
|
};
|
|
1250
|
-
function
|
|
1255
|
+
function Et(t) {
|
|
1251
1256
|
for (let e in Nt) if (t === Nt[e].ctor) return Nt[e].type;
|
|
1252
1257
|
throw new Error("unrecognized ctor:" + t);
|
|
1253
1258
|
}
|
|
1254
|
-
function
|
|
1259
|
+
function Pt(t, e, n, r) {
|
|
1255
1260
|
const s = t, i = e.length / 3;
|
|
1256
1261
|
for (let t = 0; t < i; t++) s[3 * t] = e[3 * t] / 65535 * r[0] + n[0], s[3 * t + 1] = e[3 * t + 1] / 65535 * r[1] + n[1],
|
|
1257
1262
|
s[3 * t + 2] = e[3 * t + 2] / 65535 * r[2] + n[2];
|
|
1258
1263
|
return s;
|
|
1259
1264
|
}
|
|
1260
|
-
function
|
|
1265
|
+
function Lt(t, e, n) {
|
|
1261
1266
|
let r = t.getUint32(12, !0), s = t.getUint32(16, !0), i = t.getUint32(20, !0), o = t.getUint32(24, !0);
|
|
1262
1267
|
const a = t.buffer;
|
|
1263
1268
|
let c, h, u = {}, f = {};
|
|
@@ -1275,14 +1280,14 @@
|
|
|
1275
1280
|
batchTableBin: h
|
|
1276
1281
|
};
|
|
1277
1282
|
}
|
|
1278
|
-
var
|
|
1283
|
+
var Bt = {
|
|
1279
1284
|
north: [ -1, 0, 0 ],
|
|
1280
1285
|
east: [ 0, 1, 0 ],
|
|
1281
1286
|
up: [ 0, 0, 1 ],
|
|
1282
1287
|
south: [ 1, 0, 0 ],
|
|
1283
1288
|
west: [ 0, -1, 0 ],
|
|
1284
1289
|
down: [ 0, 0, -1 ]
|
|
1285
|
-
},
|
|
1290
|
+
}, Ut = {}, Ct = {
|
|
1286
1291
|
east: [],
|
|
1287
1292
|
north: [],
|
|
1288
1293
|
up: [],
|
|
@@ -1333,28 +1338,28 @@
|
|
|
1333
1338
|
north: "up",
|
|
1334
1339
|
south: "down"
|
|
1335
1340
|
}
|
|
1336
|
-
}[Vt = "east"][Gt = "north"],
|
|
1341
|
+
}[Vt = "east"][Gt = "north"], Ut[$t = Vt + Gt] ? Ht = Ut[$t] : (Ht = function(t, e, n) {
|
|
1337
1342
|
if (function(t, e) {
|
|
1338
1343
|
var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
|
|
1339
1344
|
return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(r - o) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(o)) && Math.abs(s - a) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(a));
|
|
1340
|
-
}(t, kt)) a(Rt,
|
|
1345
|
+
}(t, kt)) a(Rt, Bt[Vt]), a(Ft, Bt[Gt]), a(Dt, Bt[qt]); else if (jt(t[0], 0, 1e-14) && jt(t[1], 0, 1e-14)) {
|
|
1341
1346
|
var r = ht(t[2]);
|
|
1342
|
-
a(Rt,
|
|
1343
|
-
a(Dt,
|
|
1347
|
+
a(Rt, Bt[Vt]), "east" !== Vt && "west" !== Vt && f(Rt, Rt, r), a(Ft, Bt[Gt]), "east" !== Gt && "west" !== Gt && f(Ft, Ft, r),
|
|
1348
|
+
a(Dt, Bt[qt]), "east" !== qt && "west" !== qt && f(Dt, Dt, r);
|
|
1344
1349
|
} else {
|
|
1345
1350
|
!function(t, e) {
|
|
1346
1351
|
u(e, t, dt), l(e, e);
|
|
1347
|
-
}(t,
|
|
1348
|
-
var s =
|
|
1349
|
-
i[0] = -t[1], i[1] = t[0], i[2] = 0, l(
|
|
1350
|
-
f(
|
|
1352
|
+
}(t, Ct.up);
|
|
1353
|
+
var s = Ct.up, i = Ct.east;
|
|
1354
|
+
i[0] = -t[1], i[1] = t[0], i[2] = 0, l(Ct.east, i), m(Ct.north, s, i), f(Ct.down, Ct.up, -1),
|
|
1355
|
+
f(Ct.west, Ct.east, -1), f(Ct.south, Ct.north, -1), Rt = Ct[Vt], Ft = Ct[Gt], Dt = Ct[qt];
|
|
1351
1356
|
}
|
|
1352
1357
|
return n[0] = Rt[0], n[1] = Rt[1], n[2] = Rt[2], n[3] = 0, n[4] = Ft[0], n[5] = Ft[1],
|
|
1353
1358
|
n[6] = Ft[2], n[7] = 0, n[8] = Dt[0], n[9] = Dt[1], n[10] = Dt[2], n[11] = 0, n[12] = t[0],
|
|
1354
1359
|
n[13] = t[1], n[14] = t[2], n[15] = 1, n;
|
|
1355
|
-
},
|
|
1360
|
+
}, Ut[$t] = Ht), Ht);
|
|
1356
1361
|
/*!
|
|
1357
|
-
* @maptalks/gl v0.
|
|
1362
|
+
* @maptalks/gl v0.65.0
|
|
1358
1363
|
* LICENSE : UNLICENSED
|
|
1359
1364
|
* (c) 2016-2022 maptalks.com
|
|
1360
1365
|
*/ var Vt, Gt, Ht, qt, $t;
|
|
@@ -1374,9 +1379,9 @@
|
|
|
1374
1379
|
}, Xt.getTranscoder = function(t) {
|
|
1375
1380
|
return Xt[t];
|
|
1376
1381
|
};
|
|
1377
|
-
class
|
|
1378
|
-
constructor(t, e) {
|
|
1379
|
-
this.A = t, this.
|
|
1382
|
+
class Wt {
|
|
1383
|
+
constructor(t, e, n) {
|
|
1384
|
+
this.A = t, this.et = e || rt, this.v = n, this.nt = {
|
|
1380
1385
|
"image/crn": Xt.crn && Xt.crn(),
|
|
1381
1386
|
"image/ktx2": Xt.ktx2 && Xt.ktx2(),
|
|
1382
1387
|
"image/cttf": Xt.ktx2 && Xt.ktx2(),
|
|
@@ -1391,18 +1396,19 @@
|
|
|
1391
1396
|
};
|
|
1392
1397
|
}
|
|
1393
1398
|
load(t, e, n = 0, r = 0) {
|
|
1394
|
-
return e ? (r || (r = e.byteLength), this.
|
|
1399
|
+
return e ? (r || (r = e.byteLength), this.rt(t, e, n, r)) : j.getArrayBuffer(t, {}).then(e => {
|
|
1395
1400
|
const s = e.data;
|
|
1396
|
-
return r || (r = s.byteLength), this.
|
|
1401
|
+
return r || (r = s.byteLength), this.rt(t, s, n, r);
|
|
1397
1402
|
});
|
|
1398
1403
|
}
|
|
1399
|
-
|
|
1400
|
-
const s = this.
|
|
1404
|
+
rt(t, e, n, r) {
|
|
1405
|
+
const s = this.st(e, n, r, t);
|
|
1401
1406
|
if (s.error) return Promise.resolve(s);
|
|
1402
|
-
const i = t.substring(0, t.lastIndexOf("/")), o = new this.
|
|
1407
|
+
const i = t.substring(0, t.lastIndexOf("/")), o = new this.et(i, s.glb, {
|
|
1403
1408
|
transferable: !0,
|
|
1404
1409
|
requestImage: this.A,
|
|
1405
|
-
decoders: this.
|
|
1410
|
+
decoders: this.nt,
|
|
1411
|
+
supportedFormats: this.v
|
|
1406
1412
|
});
|
|
1407
1413
|
return o.load().then(e => {
|
|
1408
1414
|
e.url = `${t}-${n}-${r}`;
|
|
@@ -1419,7 +1425,7 @@
|
|
|
1419
1425
|
};
|
|
1420
1426
|
});
|
|
1421
1427
|
}
|
|
1422
|
-
|
|
1428
|
+
st(t, e, n, r) {
|
|
1423
1429
|
const s = new DataView(t, e, n), i = s.getUint32(4, !0);
|
|
1424
1430
|
if (1 !== i) {
|
|
1425
1431
|
const t = "Unsupported b3dm version: " + i + ", url:" + r;
|
|
@@ -1460,17 +1466,17 @@
|
|
|
1460
1466
|
glb: {
|
|
1461
1467
|
buffer: t,
|
|
1462
1468
|
byteOffset: f,
|
|
1463
|
-
byteLength: s.byteLength - f
|
|
1469
|
+
byteLength: s.byteLength + s.byteOffset - f
|
|
1464
1470
|
}
|
|
1465
1471
|
};
|
|
1466
1472
|
}
|
|
1467
|
-
|
|
1473
|
+
it() {
|
|
1468
1474
|
return null;
|
|
1469
1475
|
}
|
|
1470
1476
|
}
|
|
1471
|
-
class
|
|
1472
|
-
constructor(t, e) {
|
|
1473
|
-
this.A = t, this.
|
|
1477
|
+
class Zt {
|
|
1478
|
+
constructor(t, e, n) {
|
|
1479
|
+
this.A = t, this.et = e || rt, this.v = n, this.nt = {
|
|
1474
1480
|
"image/crn": Xt.crn && Xt.crn(),
|
|
1475
1481
|
"image/ktx2": Xt.ktx2 && Xt.ktx2(),
|
|
1476
1482
|
"image/cttf": Xt.ktx2 && Xt.ktx2(),
|
|
@@ -1478,14 +1484,14 @@
|
|
|
1478
1484
|
};
|
|
1479
1485
|
}
|
|
1480
1486
|
load(t, e, n = 0, r = 0) {
|
|
1481
|
-
return e ? (r || (r = e.byteLength), this.
|
|
1487
|
+
return e ? (r || (r = e.byteLength), this.rt(t, e, n, r)) : j.getArrayBuffer(t, {}).then(e => {
|
|
1482
1488
|
const s = e.data;
|
|
1483
|
-
return r || (r = s.byteLength), this.
|
|
1489
|
+
return r || (r = s.byteLength), this.rt(t, s, n, r);
|
|
1484
1490
|
});
|
|
1485
1491
|
}
|
|
1486
|
-
|
|
1487
|
-
return this.
|
|
1488
|
-
const o = this.
|
|
1492
|
+
rt(t, e, n, r) {
|
|
1493
|
+
return this.ot(t, e, n, r).then(({gltf: s, transferables: i}) => {
|
|
1494
|
+
const o = this.at(e, n, r, t);
|
|
1489
1495
|
if (o.error) return Promise.resolve(o);
|
|
1490
1496
|
for (let t = 0; t < i.length; t++) -1 === o.transferables.indexOf(i[t]) && o.transferables.push(i[t]);
|
|
1491
1497
|
return delete s.transferables, Promise.resolve({
|
|
@@ -1500,19 +1506,20 @@
|
|
|
1500
1506
|
});
|
|
1501
1507
|
});
|
|
1502
1508
|
}
|
|
1503
|
-
|
|
1509
|
+
ot(t, e, n, r) {
|
|
1504
1510
|
const s = {
|
|
1505
1511
|
transferable: !0,
|
|
1506
1512
|
requestImage: this.A,
|
|
1507
|
-
decoders: this.
|
|
1513
|
+
decoders: this.nt,
|
|
1514
|
+
supportedFormats: this.v
|
|
1508
1515
|
}, i = new DataView(e, n, r), o = 32 + i.getUint32(12, !0) + i.getUint32(16, !0) + i.getUint32(20, !0) + i.getUint32(24, !0);
|
|
1509
1516
|
if (0 === i.getUint32(28, !0)) {
|
|
1510
1517
|
let r = ft(new Uint8Array(e, o + n, i.byteLength - o));
|
|
1511
1518
|
-1 == r.indexOf("://") && (r = t.substring(0, t.lastIndexOf("/")) + "/" + r);
|
|
1512
|
-
return r.indexOf(".glb") > 0 ? j.getArrayBuffer(r, {}).then(t => this.
|
|
1519
|
+
return r.indexOf(".glb") > 0 ? j.getArrayBuffer(r, {}).then(t => this.ct(r, {
|
|
1513
1520
|
buffer: t.data,
|
|
1514
1521
|
byteOffset: 0
|
|
1515
|
-
}, s)) : j.getJSON(r, {}).then(t => this.
|
|
1522
|
+
}, s)) : j.getJSON(r, {}).then(t => this.ct(r, t, s));
|
|
1516
1523
|
}
|
|
1517
1524
|
{
|
|
1518
1525
|
const r = {
|
|
@@ -1520,11 +1527,11 @@
|
|
|
1520
1527
|
byteOffset: o + n,
|
|
1521
1528
|
byteLength: i.byteLength - o
|
|
1522
1529
|
};
|
|
1523
|
-
return this.
|
|
1530
|
+
return this.ct(t, r, s);
|
|
1524
1531
|
}
|
|
1525
1532
|
}
|
|
1526
|
-
|
|
1527
|
-
const r = t.substring(0, t.lastIndexOf("/")), s = new this.
|
|
1533
|
+
ct(t, e, n) {
|
|
1534
|
+
const r = t.substring(0, t.lastIndexOf("/")), s = new this.et(r, e, n);
|
|
1528
1535
|
return s.load({
|
|
1529
1536
|
skipAttributeTransform: !0
|
|
1530
1537
|
}).then(n => {
|
|
@@ -1536,7 +1543,7 @@
|
|
|
1536
1543
|
};
|
|
1537
1544
|
});
|
|
1538
1545
|
}
|
|
1539
|
-
|
|
1546
|
+
at(t, e, n, r) {
|
|
1540
1547
|
const s = new DataView(t, e, n), i = s.getUint32(4, !0);
|
|
1541
1548
|
if (1 !== i) {
|
|
1542
1549
|
const t = "Unsupported pnts version: " + i + ", url:" + r;
|
|
@@ -1550,7 +1557,7 @@
|
|
|
1550
1557
|
error: t
|
|
1551
1558
|
};
|
|
1552
1559
|
}
|
|
1553
|
-
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} =
|
|
1560
|
+
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = Lt(s, 32 + e, o), f = {}, l = a.INSTANCES_LENGTH;
|
|
1554
1561
|
if (a.POSITION) {
|
|
1555
1562
|
const {byteOffset: e} = a.POSITION;
|
|
1556
1563
|
f.POSITION = {
|
|
@@ -1569,7 +1576,7 @@
|
|
|
1569
1576
|
itemSize: 3,
|
|
1570
1577
|
count: l,
|
|
1571
1578
|
componentType: 5126,
|
|
1572
|
-
array: this.
|
|
1579
|
+
array: this.ht(new Uint16Array(t, r + c.offset, 3 * l), e, n)
|
|
1573
1580
|
}, o.push(f.POSITION.array.buffer);
|
|
1574
1581
|
}
|
|
1575
1582
|
if (a.BATCH_ID) {
|
|
@@ -1602,14 +1609,14 @@
|
|
|
1602
1609
|
itemSize: 3,
|
|
1603
1610
|
count: l,
|
|
1604
1611
|
componentType: 5126,
|
|
1605
|
-
array: this.
|
|
1612
|
+
array: this.ut(new Uint16Array(t, e + c.offset, 2 * l))
|
|
1606
1613
|
}, o.push(f.NORMAL_UP.array.buffer), e = a.NORMAL_RIGHT_OCT32P.byteOffset, f.NORMAL_RIGHT = {
|
|
1607
1614
|
byteStride: 0,
|
|
1608
1615
|
byteOffset: 0,
|
|
1609
1616
|
itemSize: 3,
|
|
1610
1617
|
count: l,
|
|
1611
1618
|
componentType: 5126,
|
|
1612
|
-
array: this.
|
|
1619
|
+
array: this.ut(new Uint16Array(t, e + c.offset, 2 * l))
|
|
1613
1620
|
}, o.push(f.NORMAL_RIGHT.array.buffer);
|
|
1614
1621
|
}
|
|
1615
1622
|
if (a.SCALE) {
|
|
@@ -1642,16 +1649,16 @@
|
|
|
1642
1649
|
transferables: o
|
|
1643
1650
|
};
|
|
1644
1651
|
}
|
|
1645
|
-
|
|
1652
|
+
ut(t) {
|
|
1646
1653
|
const e = t.length / 2, n = new Float32Array(3 * e), r = [];
|
|
1647
1654
|
for (let s = 0; s < e; s++) Yt(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
|
|
1648
1655
|
n[3 * s + 1] = r[1], n[3 * s + 2] = r[2];
|
|
1649
1656
|
return n;
|
|
1650
1657
|
}
|
|
1651
|
-
|
|
1652
|
-
return
|
|
1658
|
+
ht(t, e, n) {
|
|
1659
|
+
return Pt(new Float32Array(t.length), t, e, n);
|
|
1653
1660
|
}
|
|
1654
|
-
|
|
1661
|
+
it() {
|
|
1655
1662
|
return null;
|
|
1656
1663
|
}
|
|
1657
1664
|
}
|
|
@@ -1677,13 +1684,13 @@
|
|
|
1677
1684
|
class ee {
|
|
1678
1685
|
constructor() {}
|
|
1679
1686
|
load(t, e, n = 0, r = 0) {
|
|
1680
|
-
return e ? (r || (r = e.byteLength), this.
|
|
1687
|
+
return e ? (r || (r = e.byteLength), this.rt(t, e, n, r)) : j.getArrayBuffer(t, {}).then(e => {
|
|
1681
1688
|
const s = e.data;
|
|
1682
|
-
return r || (r = s.byteLength), this.
|
|
1689
|
+
return r || (r = s.byteLength), this.rt(t, s, n, r);
|
|
1683
1690
|
});
|
|
1684
1691
|
}
|
|
1685
|
-
|
|
1686
|
-
return this.
|
|
1692
|
+
rt(t, e, n, r) {
|
|
1693
|
+
return this.ft(e, n, r, t).then(t => t.error ? t : {
|
|
1687
1694
|
magic: "pnts",
|
|
1688
1695
|
count: t.count,
|
|
1689
1696
|
transferables: t.transferables,
|
|
@@ -1693,7 +1700,7 @@
|
|
|
1693
1700
|
pnts: t.pnts
|
|
1694
1701
|
});
|
|
1695
1702
|
}
|
|
1696
|
-
|
|
1703
|
+
ft(t, e, n, r) {
|
|
1697
1704
|
const s = new DataView(t, e, n), i = s.getUint32(4, !0);
|
|
1698
1705
|
if (1 !== i) {
|
|
1699
1706
|
const t = "Unsupported pnts version: " + i + ", url:" + r;
|
|
@@ -1707,7 +1714,7 @@
|
|
|
1707
1714
|
error: t
|
|
1708
1715
|
};
|
|
1709
1716
|
}
|
|
1710
|
-
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} =
|
|
1717
|
+
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = Lt(s, e + 28, o), f = a.QUANTIZED_VOLUME_OFFSET, l = a.QUANTIZED_VOLUME_SCALE, d = a.POINTS_LENGTH;
|
|
1711
1718
|
let m, y = {};
|
|
1712
1719
|
if (a.extensions && a.extensions["3DTILES_draco_point_compression"]) {
|
|
1713
1720
|
y = a.extensions["3DTILES_draco_point_compression"], m = new DataView(t, y.byteOffset + c.offset, y.byteLength);
|
|
@@ -1715,13 +1722,13 @@
|
|
|
1715
1722
|
attributes: y.properties,
|
|
1716
1723
|
useUniqueIDs: !1
|
|
1717
1724
|
};
|
|
1718
|
-
return this.
|
|
1725
|
+
return this.lt || (this.lt = Xt.draco()), this.lt(m, e).then(e => {
|
|
1719
1726
|
const n = e.attributes;
|
|
1720
1727
|
!a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
|
|
1721
1728
|
n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
|
|
1722
1729
|
n.RGBA = a.RGBA, n.RGB565 = a.RGB565), !a.NORMAL && !a.NORMAL_OCT16P || n.NORMAL || n.NORMAL_OCT16P || (n.NORMAL = a.NORMAL,
|
|
1723
1730
|
n.NORMAL_OCT16P = a.NORMAL_OCT16P);
|
|
1724
|
-
const r = this.
|
|
1731
|
+
const r = this.dt(t, e.attributes, c.offset, d, o, f, l);
|
|
1725
1732
|
if (e.attributes.BATCH_ID) {
|
|
1726
1733
|
const t = e.attributes.BATCH_ID.array;
|
|
1727
1734
|
r.BATCH_ID = {
|
|
@@ -1729,7 +1736,7 @@
|
|
|
1729
1736
|
byteOffset: 0,
|
|
1730
1737
|
itemSize: 1,
|
|
1731
1738
|
count: t.length,
|
|
1732
|
-
componentType:
|
|
1739
|
+
componentType: Et(t.constructor),
|
|
1733
1740
|
array: t
|
|
1734
1741
|
}, o.push(t.buffer);
|
|
1735
1742
|
} else if (a.BATCH_ID || Object.keys(h).length) {
|
|
@@ -1747,7 +1754,7 @@
|
|
|
1747
1754
|
};
|
|
1748
1755
|
});
|
|
1749
1756
|
}
|
|
1750
|
-
const b = this.
|
|
1757
|
+
const b = this.dt(t, a, c.offset, d, o, f, l);
|
|
1751
1758
|
if (a.BATCH_ID || Object.keys(h).length) {
|
|
1752
1759
|
a.BATCH_ID ? b.BATCH_ID = xt(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = ne(d);
|
|
1753
1760
|
const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
|
|
@@ -1762,7 +1769,7 @@
|
|
|
1762
1769
|
transferables: o
|
|
1763
1770
|
});
|
|
1764
1771
|
}
|
|
1765
|
-
|
|
1772
|
+
dt(t, e, n, r, s, i, o) {
|
|
1766
1773
|
const a = {};
|
|
1767
1774
|
if (e.POSITION) {
|
|
1768
1775
|
let {byteOffset: i, array: o} = e.POSITION;
|
|
@@ -1790,7 +1797,7 @@
|
|
|
1790
1797
|
itemSize: 3,
|
|
1791
1798
|
count: r,
|
|
1792
1799
|
componentType: 5126,
|
|
1793
|
-
array: this.
|
|
1800
|
+
array: this.ht(h || new Uint16Array(t, c + u, 3 * r), i, o)
|
|
1794
1801
|
}, s.push(a.POSITION.array.buffer);
|
|
1795
1802
|
}
|
|
1796
1803
|
if (e.RGBA) {
|
|
@@ -1877,10 +1884,10 @@
|
|
|
1877
1884
|
}
|
|
1878
1885
|
return a;
|
|
1879
1886
|
}
|
|
1880
|
-
|
|
1881
|
-
return
|
|
1887
|
+
ht(t, e, n) {
|
|
1888
|
+
return Pt(new Float32Array(t.length), t, e, n);
|
|
1882
1889
|
}
|
|
1883
|
-
|
|
1890
|
+
it() {
|
|
1884
1891
|
return null;
|
|
1885
1892
|
}
|
|
1886
1893
|
}
|
|
@@ -1894,31 +1901,31 @@
|
|
|
1894
1901
|
byteOffset: 0,
|
|
1895
1902
|
itemSize: 1,
|
|
1896
1903
|
count: t,
|
|
1897
|
-
componentType:
|
|
1904
|
+
componentType: Et(e),
|
|
1898
1905
|
array: r
|
|
1899
1906
|
};
|
|
1900
1907
|
}
|
|
1901
1908
|
class re {
|
|
1902
1909
|
constructor(t, e) {
|
|
1903
|
-
this.A = t, this.
|
|
1910
|
+
this.A = t, this.et = e || rt;
|
|
1904
1911
|
}
|
|
1905
1912
|
load(t, e, n = 0, r = 0) {
|
|
1906
|
-
return e ? this.
|
|
1913
|
+
return e ? this.rt(t, e, n, r) : j.getArrayBuffer(t, {}).then(e => {
|
|
1907
1914
|
const s = e.data;
|
|
1908
|
-
return this.
|
|
1915
|
+
return this.rt(t, s, n, r);
|
|
1909
1916
|
});
|
|
1910
1917
|
}
|
|
1911
|
-
|
|
1918
|
+
rt(t, e, n, r) {
|
|
1912
1919
|
r || (r = e.byteLength);
|
|
1913
|
-
const s = this.
|
|
1920
|
+
const s = this.yt(e, t, n, r), i = [];
|
|
1914
1921
|
for (let n = 0; n < s.length; n++) {
|
|
1915
1922
|
let r;
|
|
1916
|
-
if ("b3dm" === s[n].magic) r = new
|
|
1923
|
+
if ("b3dm" === s[n].magic) r = new Wt(this.A, this.et); else if ("i3dm" === s[n].magic) r = new Zt(this.A, this.et); else if ("pnts" === s[n].magic) r = new ee; else {
|
|
1917
1924
|
if ("cmpt" !== s[n].magic) {
|
|
1918
1925
|
console.warn("Unsupported magic in CMPT tile:", s[n].magic);
|
|
1919
1926
|
continue;
|
|
1920
1927
|
}
|
|
1921
|
-
r = new re(this.A, this.
|
|
1928
|
+
r = new re(this.A, this.et);
|
|
1922
1929
|
}
|
|
1923
1930
|
i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
|
|
1924
1931
|
}
|
|
@@ -1927,7 +1934,7 @@
|
|
|
1927
1934
|
tiles: t
|
|
1928
1935
|
}));
|
|
1929
1936
|
}
|
|
1930
|
-
|
|
1937
|
+
yt(t, e, n, r) {
|
|
1931
1938
|
const s = new DataView(t, n, r), i = s.getUint32(4, !0);
|
|
1932
1939
|
if (1 !== i) {
|
|
1933
1940
|
const t = "Unsupported cmpt version: " + i + ", url:" + e;
|
|
@@ -1935,12 +1942,6 @@
|
|
|
1935
1942
|
error: t
|
|
1936
1943
|
};
|
|
1937
1944
|
}
|
|
1938
|
-
if (s.getUint32(8, !0) !== s.byteLength) {
|
|
1939
|
-
const t = "Length in cmpt header is inconsistent with cmpt's byte length, url: " + e;
|
|
1940
|
-
return console.warn(t), {
|
|
1941
|
-
error: t
|
|
1942
|
-
};
|
|
1943
|
-
}
|
|
1944
1945
|
if (16 === s.byteLength) return [];
|
|
1945
1946
|
const o = [], a = s.getUint32(12, !0);
|
|
1946
1947
|
let c = 16;
|
|
@@ -2008,9 +2009,11 @@
|
|
|
2008
2009
|
const le = n([]), de = [ 0, 0, 0 ], me = [], ye = [];
|
|
2009
2010
|
class be {
|
|
2010
2011
|
constructor(t, e, n, r) {
|
|
2011
|
-
this.id = t, this.options = e, this.
|
|
2012
|
-
this.
|
|
2013
|
-
|
|
2012
|
+
this.id = t, this.options = e, this.bt = this.requestImage.bind(this), this.pt = n,
|
|
2013
|
+
this.wt = {}, r(null, {}, []);
|
|
2014
|
+
}
|
|
2015
|
+
_t(t) {
|
|
2016
|
+
this.gt || (this.Tt = new ee, this.gt = new Wt(this.bt, rt, t), this.At = new Zt(this.bt, rt, t));
|
|
2014
2017
|
}
|
|
2015
2018
|
requestImage(t, e) {
|
|
2016
2019
|
fe ? fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
@@ -2021,14 +2024,15 @@
|
|
|
2021
2024
|
height: t.height,
|
|
2022
2025
|
data: new Uint8Array(n.data)
|
|
2023
2026
|
});
|
|
2024
|
-
}) : this.
|
|
2027
|
+
}) : this.pt("requestImage", {
|
|
2025
2028
|
url: t
|
|
2026
2029
|
}, null, e);
|
|
2027
2030
|
}
|
|
2028
2031
|
loadTile(t, e) {
|
|
2032
|
+
this._t(t.supportedFormats);
|
|
2029
2033
|
const n = t.url, r = t.arraybuffer;
|
|
2030
2034
|
if (r) {
|
|
2031
|
-
delete this.
|
|
2035
|
+
delete this.wt[n];
|
|
2032
2036
|
const s = Tt(new DataView(r), 0);
|
|
2033
2037
|
if ("{" === s[0] || " " === s[0]) {
|
|
2034
2038
|
const t = function(t, e, n) {
|
|
@@ -2040,28 +2044,28 @@
|
|
|
2040
2044
|
}(r, 0, r.byteLength), n = JSON.parse(t);
|
|
2041
2045
|
e(null, n);
|
|
2042
2046
|
} else if ("b3dm" === s) {
|
|
2043
|
-
this.
|
|
2047
|
+
this.gt.load(n, r).then(n => {
|
|
2044
2048
|
if (n.error) return void e(n);
|
|
2045
|
-
const {content: r, transferables: s} = this.
|
|
2049
|
+
const {content: r, transferables: s} = this.vt(n, t);
|
|
2046
2050
|
e(null, r, s);
|
|
2047
2051
|
}).catch(t => {
|
|
2048
2052
|
e(t);
|
|
2049
2053
|
});
|
|
2050
2054
|
} else if ("pnts" === s) {
|
|
2051
2055
|
const s = t.transform;
|
|
2052
|
-
this.
|
|
2053
|
-
const {content: r, transferables: i} = this.
|
|
2056
|
+
this.Tt.load(n, r).then(n => {
|
|
2057
|
+
const {content: r, transferables: i} = this.Ot(n, s, t.rootIdx);
|
|
2054
2058
|
e(null, r, i);
|
|
2055
2059
|
});
|
|
2056
2060
|
} else if ("i3dm" === s) {
|
|
2057
2061
|
const s = t.transform;
|
|
2058
|
-
this.
|
|
2059
|
-
const {content: r, transferables: i} = this.
|
|
2062
|
+
this.At.load(n, r).then(n => {
|
|
2063
|
+
const {content: r, transferables: i} = this.Ot(n, s, t.rootIdx);
|
|
2060
2064
|
e(null, r, i);
|
|
2061
2065
|
});
|
|
2062
2066
|
} else if ("cmpt" === s) {
|
|
2063
|
-
new re(this.
|
|
2064
|
-
const {content: r, transferables: s} = this.
|
|
2067
|
+
new re(this.bt, rt).load(n, r).then(n => {
|
|
2068
|
+
const {content: r, transferables: s} = this.Mt(n, t);
|
|
2065
2069
|
e(null, r, s);
|
|
2066
2070
|
}).catch(t => {
|
|
2067
2071
|
e(t);
|
|
@@ -2074,13 +2078,13 @@
|
|
|
2074
2078
|
let i = j.getArrayBuffer(n + (s || ""), r.ajaxOptions);
|
|
2075
2079
|
const o = i.xhr;
|
|
2076
2080
|
i = i.then(r => {
|
|
2077
|
-
delete this.
|
|
2081
|
+
delete this.wt[n], r && r.status ? e(r) : (t.arraybuffer = r && r.data, this.loadTile(t, e));
|
|
2078
2082
|
}).catch(t => {
|
|
2079
|
-
delete this.
|
|
2080
|
-
}), this.
|
|
2083
|
+
delete this.wt[n], e(t);
|
|
2084
|
+
}), this.wt[n] = o;
|
|
2081
2085
|
}
|
|
2082
2086
|
}
|
|
2083
|
-
|
|
2087
|
+
Mt(t, e) {
|
|
2084
2088
|
const {tiles: n} = t, r = {
|
|
2085
2089
|
magic: "cmpt",
|
|
2086
2090
|
content: []
|
|
@@ -2088,14 +2092,14 @@
|
|
|
2088
2092
|
for (let t = 0; t < n.length; t++) {
|
|
2089
2093
|
const {magic: i} = n[t];
|
|
2090
2094
|
if ("b3dm" === i) {
|
|
2091
|
-
const {content: i, transferables: o} = this.
|
|
2092
|
-
|
|
2095
|
+
const {content: i, transferables: o} = this.vt(n[t], e);
|
|
2096
|
+
_e(s, o), r.content.push(i);
|
|
2093
2097
|
} else if ("i3dm" === i || "pnts" === i) {
|
|
2094
|
-
const {transform: i, rootIdx: o} = e, {content: a, transferables: c} = this.
|
|
2095
|
-
|
|
2098
|
+
const {transform: i, rootIdx: o} = e, {content: a, transferables: c} = this.Ot(n[t], i, o);
|
|
2099
|
+
_e(s, c), r.content.push(a);
|
|
2096
2100
|
} else if ("cmpt" === i) {
|
|
2097
|
-
const {content: i, transferables: o} = this.
|
|
2098
|
-
|
|
2101
|
+
const {content: i, transferables: o} = this.Mt(n[t], e);
|
|
2102
|
+
_e(s, o), r.content.push(i);
|
|
2099
2103
|
}
|
|
2100
2104
|
}
|
|
2101
2105
|
return {
|
|
@@ -2103,15 +2107,15 @@
|
|
|
2103
2107
|
transferables: s
|
|
2104
2108
|
};
|
|
2105
2109
|
}
|
|
2106
|
-
|
|
2110
|
+
vt(t, e) {
|
|
2107
2111
|
const {gltf: n, transferables: r, featureTable: s} = t;
|
|
2108
|
-
return this.
|
|
2112
|
+
return this.St(t.gltf), this.convertCoordinates(n, s, e.upAxis, e.transform), delete t.transferables,
|
|
2109
2113
|
{
|
|
2110
2114
|
content: t,
|
|
2111
2115
|
transferables: r
|
|
2112
2116
|
};
|
|
2113
2117
|
}
|
|
2114
|
-
|
|
2118
|
+
Ot(t, e, n) {
|
|
2115
2119
|
const {featureTable: r} = t, s = t.pnts || t.i3dm;
|
|
2116
2120
|
let i = r && r.RTC_CENTER || [ 0, 0, 0 ];
|
|
2117
2121
|
if (r.EAST_NORTH_UP && !s.NORMAL_UP && !s.NORMAL_UP_OCT32P) {
|
|
@@ -2146,7 +2150,7 @@
|
|
|
2146
2150
|
oe(s.POSITION, t => {
|
|
2147
2151
|
t[0] = t[0] + i[0] - u[0], t[1] = t[1] + i[1] - u[1], t[2] = t[2] + i[2] - u[2];
|
|
2148
2152
|
}), e && y(c, c, e);
|
|
2149
|
-
const f = this.
|
|
2153
|
+
const f = this.xt(c);
|
|
2150
2154
|
t.rtcCenter = u, t.rtcCoord = f, t.rootIdx = n;
|
|
2151
2155
|
const l = t.transferables;
|
|
2152
2156
|
return delete t.transferables, {
|
|
@@ -2154,7 +2158,7 @@
|
|
|
2154
2158
|
transferables: l
|
|
2155
2159
|
};
|
|
2156
2160
|
}
|
|
2157
|
-
|
|
2161
|
+
St(t) {
|
|
2158
2162
|
if (!Array.isArray(t.textures)) return;
|
|
2159
2163
|
const e = t.textures;
|
|
2160
2164
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -2171,8 +2175,8 @@
|
|
|
2171
2175
|
}
|
|
2172
2176
|
}
|
|
2173
2177
|
abortTileLoading(t, e) {
|
|
2174
|
-
const n = this.
|
|
2175
|
-
n && n.abort(), delete this.
|
|
2178
|
+
const n = this.wt[t.url];
|
|
2179
|
+
n && n.abort(), delete this.wt[t.url], e(null);
|
|
2176
2180
|
}
|
|
2177
2181
|
convertCoordinates(t, e, s, i) {
|
|
2178
2182
|
let o = e && e.RTC_CENTER || t.extensions && t.extensions.CESIUM_RTC && t.extensions.CESIUM_RTC.center, c = ae;
|
|
@@ -2194,7 +2198,7 @@
|
|
|
2194
2198
|
r(e, c, e), pe(s, i, o || de, e, h);
|
|
2195
2199
|
});
|
|
2196
2200
|
const u = we(h), f = a([], u);
|
|
2197
|
-
i && y(u, u, i), t.extensions.CESIUM_RTC.coord = this.
|
|
2201
|
+
i && y(u, u, i), t.extensions.CESIUM_RTC.coord = this.xt(u), o || (se(t, t => {
|
|
2198
2202
|
if (t.attributes && t.attributes.POSITION) {
|
|
2199
2203
|
const e = t.attributes.POSITION;
|
|
2200
2204
|
if (e.array.buffer.projected && e.array.buffer.projected[e.byteOffset]) return;
|
|
@@ -2202,13 +2206,13 @@
|
|
|
2202
2206
|
if (t.matrices) for (let e = t.matrices.length - 1; e >= 0; e--) r(s, s, t.matrices[e]);
|
|
2203
2207
|
r(s, c, s);
|
|
2204
2208
|
const i = function(t, e) {
|
|
2205
|
-
var n = e[0], r = e[1], s = e[2], i = e[3], o = e[4], a = e[5], c = e[6], h = e[7], u = e[8], f = e[9], l = e[10], d = e[11], m = e[12], y = e[13], b = e[14], p = e[15], w = n * a - r * o,
|
|
2206
|
-
return
|
|
2207
|
-
t[2] = (y * v - b * A + p * T) *
|
|
2208
|
-
t[5] = (n * N - s * S + i * M) *
|
|
2209
|
-
t[8] = (o * I - a * S + h * O) *
|
|
2210
|
-
t[11] = (f *
|
|
2211
|
-
t[14] = (y *
|
|
2209
|
+
var n = e[0], r = e[1], s = e[2], i = e[3], o = e[4], a = e[5], c = e[6], h = e[7], u = e[8], f = e[9], l = e[10], d = e[11], m = e[12], y = e[13], b = e[14], p = e[15], w = n * a - r * o, _ = n * c - s * o, g = n * h - i * o, T = r * c - s * a, A = r * h - i * a, v = s * h - i * c, O = u * y - f * m, M = u * b - l * m, S = u * p - d * m, x = f * b - l * y, I = f * p - d * y, N = l * p - d * b, E = w * N - _ * I + g * x + T * S - A * M + v * O;
|
|
2210
|
+
return E ? (E = 1 / E, t[0] = (a * N - c * I + h * x) * E, t[1] = (s * I - r * N - i * x) * E,
|
|
2211
|
+
t[2] = (y * v - b * A + p * T) * E, t[3] = (l * A - f * v - d * T) * E, t[4] = (c * S - o * N - h * M) * E,
|
|
2212
|
+
t[5] = (n * N - s * S + i * M) * E, t[6] = (b * g - m * v - p * _) * E, t[7] = (u * v - l * g + d * _) * E,
|
|
2213
|
+
t[8] = (o * I - a * S + h * O) * E, t[9] = (r * S - n * I - i * O) * E, t[10] = (m * A - y * g + p * w) * E,
|
|
2214
|
+
t[11] = (f * g - u * A - d * w) * E, t[12] = (a * M - o * x - c * O) * E, t[13] = (n * x - r * M + s * O) * E,
|
|
2215
|
+
t[14] = (y * _ - m * T - b * w) * E, t[15] = (u * T - f * _ + l * w) * E, t) : null;
|
|
2212
2216
|
}(ye, s);
|
|
2213
2217
|
oe(e, t => {
|
|
2214
2218
|
y(t, t, s), t[0] = t[0] - f[0], t[1] = t[1] - f[1], t[2] = t[2] - f[2], y(t, t, i);
|
|
@@ -2216,7 +2220,7 @@
|
|
|
2216
2220
|
}
|
|
2217
2221
|
}), t.extensions.CESIUM_RTC.center = f);
|
|
2218
2222
|
}
|
|
2219
|
-
|
|
2223
|
+
xt(t) {
|
|
2220
2224
|
return 0 === w(t) ? c([], 0, 0, -6378137) : pt([], t);
|
|
2221
2225
|
}
|
|
2222
2226
|
onRemove() {}
|
|
@@ -2236,38 +2240,38 @@
|
|
|
2236
2240
|
return e === -1 / 0 && (a[0] = 0), n === -1 / 0 && (a[1] = 0), o === -1 / 0 && (a[2] = 0),
|
|
2237
2241
|
isNaN(a[2]) && (a[2] = 0), a;
|
|
2238
2242
|
}
|
|
2239
|
-
function
|
|
2243
|
+
function _e(t, e) {
|
|
2240
2244
|
for (let n = 0; n < e.length; n++) t.indexOf(e[n]) < 0 && t.push(e[n]);
|
|
2241
2245
|
}
|
|
2242
|
-
let
|
|
2246
|
+
let ge = 0;
|
|
2243
2247
|
class Te {
|
|
2244
2248
|
constructor(t) {
|
|
2245
|
-
this.workerId = t, this.workers = {}, this.
|
|
2249
|
+
this.workerId = t, this.workers = {}, this.It = {};
|
|
2246
2250
|
}
|
|
2247
2251
|
addLayer({actorId: t, mapId: e, layerId: n, params: r}, s) {
|
|
2248
|
-
if (this.
|
|
2249
|
-
const i = this.
|
|
2252
|
+
if (this.Nt(e, n)) return;
|
|
2253
|
+
const i = this.Et(e, n), o = r.options, a = this.send.bind(this, t);
|
|
2250
2254
|
this.workers[i] = new be(n, o, a, s);
|
|
2251
2255
|
}
|
|
2252
2256
|
removeLayer({mapId: t, layerId: e}, n) {
|
|
2253
|
-
const r = this.
|
|
2257
|
+
const r = this.Nt(t, e), s = this.Et(t, e);
|
|
2254
2258
|
delete this.workers[s], r && r.onRemove(n);
|
|
2255
2259
|
}
|
|
2256
2260
|
loadTile({mapId: t, layerId: e, params: n}, r) {
|
|
2257
|
-
const s = this.
|
|
2261
|
+
const s = this.Nt(t, e);
|
|
2258
2262
|
s && s.loadTile(n, r);
|
|
2259
2263
|
}
|
|
2260
2264
|
abortTileLoading({mapId: t, layerId: e, params: n}, r) {
|
|
2261
|
-
const s = this.
|
|
2265
|
+
const s = this.Nt(t, e);
|
|
2262
2266
|
s && s.abortTileLoading(n, r);
|
|
2263
2267
|
}
|
|
2264
2268
|
receive(t) {
|
|
2265
|
-
const e = t.callback, n = this.
|
|
2266
|
-
delete this.
|
|
2269
|
+
const e = t.callback, n = this.It[e];
|
|
2270
|
+
delete this.It[e], n && t.error ? n(new Error(t.error)) : n && n(null, t.data);
|
|
2267
2271
|
}
|
|
2268
2272
|
send(t, e, n, r, s) {
|
|
2269
|
-
const i = s ? `${t}-${
|
|
2270
|
-
s && (this.
|
|
2273
|
+
const i = s ? `${t}-${ge++}` : null;
|
|
2274
|
+
s && (this.It[i] = s), postMessage({
|
|
2271
2275
|
type: "<request>",
|
|
2272
2276
|
workerId: this.workerId,
|
|
2273
2277
|
actorId: t,
|
|
@@ -2276,11 +2280,11 @@
|
|
|
2276
2280
|
callback: String(i)
|
|
2277
2281
|
}, r || []);
|
|
2278
2282
|
}
|
|
2279
|
-
|
|
2283
|
+
Et(t, e) {
|
|
2280
2284
|
return `${t}-${e}`;
|
|
2281
2285
|
}
|
|
2282
|
-
|
|
2283
|
-
const n = this.
|
|
2286
|
+
Nt(t, e) {
|
|
2287
|
+
const n = this.Et(t, e);
|
|
2284
2288
|
return this.workers[n];
|
|
2285
2289
|
}
|
|
2286
2290
|
}
|
|
@@ -2334,9 +2338,9 @@
|
|
|
2334
2338
|
return !(h <= -c);
|
|
2335
2339
|
}
|
|
2336
2340
|
function u(t) {
|
|
2337
|
-
var e = t, n = e[0], r = e[1], s = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], l = e[8], d = e[9], m = e[10], y = e[11], b = e[12], p = e[13], w = e[14],
|
|
2338
|
-
f(i[0], o - n, u - a, y - l,
|
|
2339
|
-
f(i[3], o - r, u - c, y - d,
|
|
2341
|
+
var e = t, n = e[0], r = e[1], s = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], l = e[8], d = e[9], m = e[10], y = e[11], b = e[12], p = e[13], w = e[14], _ = e[15];
|
|
2342
|
+
f(i[0], o - n, u - a, y - l, _ - b), f(i[1], o + n, u + a, y + l, _ + b), f(i[2], o + r, u + c, y + d, _ + p),
|
|
2343
|
+
f(i[3], o - r, u - c, y - d, _ - p), f(i[4], o - s, u - h, y - m, _ - w), f(i[5], o + s, u + h, y + m, _ + w);
|
|
2340
2344
|
}
|
|
2341
2345
|
function f(t, e, n, r, s) {
|
|
2342
2346
|
return t[0] = e * (1 / 6), t[1] = n * (1 / 6), t[2] = r * (1 / 6), t[3] = s * (1 / 6),
|
|
@@ -2368,17 +2372,17 @@
|
|
|
2368
2372
|
let e = document.createElement("a");
|
|
2369
2373
|
return e.href = t, t = e.href, e = null, t;
|
|
2370
2374
|
}
|
|
2371
|
-
function
|
|
2375
|
+
function _(t) {
|
|
2372
2376
|
return Math.sign ? Math.sign(t) : 0 === (t = +t) || isNaN(t) ? Number(t) : t > 0 ? 1 : -1;
|
|
2373
2377
|
}
|
|
2374
|
-
const
|
|
2378
|
+
const g = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
|
|
2375
2379
|
function T(t) {
|
|
2376
2380
|
const e = t.length;
|
|
2377
2381
|
let n = "";
|
|
2378
2382
|
for (let r = 0; r < e; ) {
|
|
2379
2383
|
let s = t[r++];
|
|
2380
2384
|
if (128 & s) {
|
|
2381
|
-
let n =
|
|
2385
|
+
let n = g[s >> 3 & 7];
|
|
2382
2386
|
if (!(64 & s) || !n || r + n > e) return null;
|
|
2383
2387
|
for (s &= 63 >> n; n > 0; n -= 1) {
|
|
2384
2388
|
const e = t[r++];
|
|
@@ -2415,7 +2419,7 @@
|
|
|
2415
2419
|
toRadian: b,
|
|
2416
2420
|
toDegree: p,
|
|
2417
2421
|
getAbsoluteURL: w,
|
|
2418
|
-
sign:
|
|
2422
|
+
sign: _,
|
|
2419
2423
|
stringFromUTF8Array: T,
|
|
2420
2424
|
setColumn3: A,
|
|
2421
2425
|
flatArr: v,
|
|
@@ -2424,35 +2428,35 @@
|
|
|
2424
2428
|
base64URLToArrayBuffer: S
|
|
2425
2429
|
}), I = "undefined" != typeof Float32Array ? Float32Array : Array;
|
|
2426
2430
|
function N(t, e, n) {
|
|
2427
|
-
var r = e[0], s = e[1], i = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], f = e[8], l = e[9], d = e[10], m = e[11], y = e[12], b = e[13], p = e[14], w = e[15],
|
|
2428
|
-
return t[0] =
|
|
2429
|
-
t[2] =
|
|
2430
|
-
|
|
2431
|
-
t[6] =
|
|
2432
|
-
|
|
2433
|
-
t[10] =
|
|
2434
|
-
|
|
2435
|
-
t[14] =
|
|
2436
|
-
}
|
|
2437
|
-
function
|
|
2431
|
+
var r = e[0], s = e[1], i = e[2], o = e[3], a = e[4], c = e[5], h = e[6], u = e[7], f = e[8], l = e[9], d = e[10], m = e[11], y = e[12], b = e[13], p = e[14], w = e[15], _ = n[0], g = n[1], T = n[2], A = n[3];
|
|
2432
|
+
return t[0] = _ * r + g * a + T * f + A * y, t[1] = _ * s + g * c + T * l + A * b,
|
|
2433
|
+
t[2] = _ * i + g * h + T * d + A * p, t[3] = _ * o + g * u + T * m + A * w, _ = n[4],
|
|
2434
|
+
g = n[5], T = n[6], A = n[7], t[4] = _ * r + g * a + T * f + A * y, t[5] = _ * s + g * c + T * l + A * b,
|
|
2435
|
+
t[6] = _ * i + g * h + T * d + A * p, t[7] = _ * o + g * u + T * m + A * w, _ = n[8],
|
|
2436
|
+
g = n[9], T = n[10], A = n[11], t[8] = _ * r + g * a + T * f + A * y, t[9] = _ * s + g * c + T * l + A * b,
|
|
2437
|
+
t[10] = _ * i + g * h + T * d + A * p, t[11] = _ * o + g * u + T * m + A * w, _ = n[12],
|
|
2438
|
+
g = n[13], T = n[14], A = n[15], t[12] = _ * r + g * a + T * f + A * y, t[13] = _ * s + g * c + T * l + A * b,
|
|
2439
|
+
t[14] = _ * i + g * h + T * d + A * p, t[15] = _ * o + g * u + T * m + A * w, t;
|
|
2440
|
+
}
|
|
2441
|
+
function E() {
|
|
2438
2442
|
var t = new I(3);
|
|
2439
2443
|
return I != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t;
|
|
2440
2444
|
}
|
|
2441
|
-
function
|
|
2445
|
+
function P(t) {
|
|
2442
2446
|
var e = t[0], n = t[1], r = t[2];
|
|
2443
2447
|
return Math.sqrt(e * e + n * n + r * r);
|
|
2444
2448
|
}
|
|
2445
|
-
function
|
|
2449
|
+
function L(t, e, n) {
|
|
2446
2450
|
var r = new I(3);
|
|
2447
2451
|
return r[0] = t, r[1] = e, r[2] = n, r;
|
|
2448
2452
|
}
|
|
2449
|
-
function
|
|
2453
|
+
function B(t, e) {
|
|
2450
2454
|
return t[0] = e[0], t[1] = e[1], t[2] = e[2], t;
|
|
2451
2455
|
}
|
|
2452
|
-
function
|
|
2456
|
+
function U(t, e, n, r) {
|
|
2453
2457
|
return t[0] = e, t[1] = n, t[2] = r, t;
|
|
2454
2458
|
}
|
|
2455
|
-
function
|
|
2459
|
+
function C(t, e, n) {
|
|
2456
2460
|
return t[0] = e[0] - n[0], t[1] = e[1] - n[1], t[2] = e[2] - n[2], t;
|
|
2457
2461
|
}
|
|
2458
2462
|
function R(t, e, n) {
|
|
@@ -2473,7 +2477,7 @@
|
|
|
2473
2477
|
var r = e[0], s = e[1], i = e[2], o = n[0], a = n[1], c = n[2];
|
|
2474
2478
|
return t[0] = s * c - i * a, t[1] = i * o - r * c, t[2] = r * a - s * o, t;
|
|
2475
2479
|
}
|
|
2476
|
-
var z =
|
|
2480
|
+
var z = C, V = R, G = P;
|
|
2477
2481
|
function H(t, e, n, r, s) {
|
|
2478
2482
|
return t[0] = e, t[1] = n, t[2] = r, t[3] = s, t;
|
|
2479
2483
|
}
|
|
@@ -2488,26 +2492,26 @@
|
|
|
2488
2492
|
b = Math.sin(r * l) / m) : (y = 1 - r, b = r), t[0] = y * s + b * c, t[1] = y * i + b * h,
|
|
2489
2493
|
t[2] = y * o + b * u, t[3] = y * a + b * f, t;
|
|
2490
2494
|
}
|
|
2491
|
-
|
|
2495
|
+
E(), function() {
|
|
2492
2496
|
var t, e = (t = new I(4), I != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0),
|
|
2493
2497
|
t);
|
|
2494
2498
|
}();
|
|
2495
2499
|
var J, K = function(t, e) {
|
|
2496
2500
|
return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t;
|
|
2497
2501
|
};
|
|
2498
|
-
|
|
2502
|
+
E(), L(1, 0, 0), L(0, 1, 0), q(), q(), J = new I(9), I != Float32Array && (J[1] = 0,
|
|
2499
2503
|
J[2] = 0, J[3] = 0, J[5] = 0, J[6] = 0, J[7] = 0), J[0] = 1, J[4] = 1, J[8] = 1;
|
|
2500
2504
|
/*!
|
|
2501
|
-
* @maptalks/gltf-loader v0.
|
|
2505
|
+
* @maptalks/gltf-loader v0.24.0
|
|
2502
2506
|
* LICENSE : UNLICENSED
|
|
2503
2507
|
* (c) 2016-2022 maptalks.org
|
|
2504
2508
|
*/
|
|
2505
2509
|
let X = 0;
|
|
2506
|
-
function
|
|
2510
|
+
function W(t) {
|
|
2507
2511
|
return null == t;
|
|
2508
2512
|
}
|
|
2509
|
-
function
|
|
2510
|
-
return !
|
|
2513
|
+
function Z(t) {
|
|
2514
|
+
return !W(t);
|
|
2511
2515
|
}
|
|
2512
2516
|
function Y(t) {
|
|
2513
2517
|
for (let e = 1; e < arguments.length; e++) {
|
|
@@ -2582,8 +2586,8 @@
|
|
|
2582
2586
|
method: e.method || "GET",
|
|
2583
2587
|
referrerPolicy: "origin"
|
|
2584
2588
|
};
|
|
2585
|
-
"POST" === e.method && (
|
|
2586
|
-
|
|
2589
|
+
"POST" === e.method && (W(e.body) || (r.body = JSON.stringify(e.body))), W(e.headers) || (r.headers = e.headers),
|
|
2590
|
+
W(e.credentials) || (r.credentials = e.credentials);
|
|
2587
2591
|
const s = fetch(t, r).then(t => {
|
|
2588
2592
|
const n = this.s(t, e.responseType);
|
|
2589
2593
|
return n.message ? n : n.then(n => "arraybuffer" === e.responseType ? {
|
|
@@ -2745,10 +2749,10 @@
|
|
|
2745
2749
|
}
|
|
2746
2750
|
createNode(t) {
|
|
2747
2751
|
const e = {};
|
|
2748
|
-
if (
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
+
if (Z(t.name) && (e.name = t.name), Z(t.children) && (e.children = t.children),
|
|
2753
|
+
Z(t.jointName) && (e.jointName = t.jointName), Z(t.matrix) && (e.matrix = t.matrix),
|
|
2754
|
+
Z(t.rotation) && (e.rotation = t.rotation), Z(t.scale) && (e.scale = t.scale), Z(t.translation) && (e.translation = t.translation),
|
|
2755
|
+
Z(t.extras) && (e.extras = t.extras), Z(t.meshes) && (e.mesh = t.meshes[0]), e.translation || e.rotation || e.scale) {
|
|
2752
2756
|
const t = function(t, e) {
|
|
2753
2757
|
if (e.matrix) return e.matrix;
|
|
2754
2758
|
if (e.translation || e.scale || e.rotation) {
|
|
@@ -2778,7 +2782,7 @@
|
|
|
2778
2782
|
}
|
|
2779
2783
|
return e;
|
|
2780
2784
|
}
|
|
2781
|
-
|
|
2785
|
+
_(t) {
|
|
2782
2786
|
const e = {};
|
|
2783
2787
|
for (const n in t) {
|
|
2784
2788
|
const r = t[n];
|
|
@@ -2795,7 +2799,7 @@
|
|
|
2795
2799
|
}
|
|
2796
2800
|
return e;
|
|
2797
2801
|
}
|
|
2798
|
-
|
|
2802
|
+
g(t) {
|
|
2799
2803
|
if (t.bufferView || t.extensions && (t.extensions.KHR_binary_glTF || t.extensions.binary_glTF)) {
|
|
2800
2804
|
const e = t.bufferView ? t : t.extensions.KHR_binary_glTF || t.extensions.binary_glTF;
|
|
2801
2805
|
if (t.extensions && (t.mimeType = e.mimeType, t.width = e.width, t.height = e.height),
|
|
@@ -2815,7 +2819,7 @@
|
|
|
2815
2819
|
const e = this.gltf.textures[t];
|
|
2816
2820
|
if (!e) return null;
|
|
2817
2821
|
const n = this.gltf.images[e.source];
|
|
2818
|
-
return this.
|
|
2822
|
+
return this.g(n).then(t => {
|
|
2819
2823
|
const r = this.gltf.samplers[e.sampler];
|
|
2820
2824
|
return {
|
|
2821
2825
|
image: {
|
|
@@ -2859,9 +2863,10 @@
|
|
|
2859
2863
|
}
|
|
2860
2864
|
}
|
|
2861
2865
|
class yt {
|
|
2862
|
-
constructor(t, e, n, r, s) {
|
|
2866
|
+
constructor(t, e, n, r, s, i) {
|
|
2863
2867
|
this.rootPath = t, this.gltf = e, this.glbBuffer = n, this.images = {}, this.buffers = {},
|
|
2864
|
-
this.requests = {}, this.A = r, this.accessor = new dt(t, e, n), this.decoders = s
|
|
2868
|
+
this.requests = {}, this.A = r, this.accessor = new dt(t, e, n), this.decoders = s,
|
|
2869
|
+
this.v = i;
|
|
2865
2870
|
}
|
|
2866
2871
|
iterate(t, e) {
|
|
2867
2872
|
const n = this.gltf[e];
|
|
@@ -2869,18 +2874,19 @@
|
|
|
2869
2874
|
}
|
|
2870
2875
|
createNode(t) {
|
|
2871
2876
|
const e = {};
|
|
2872
|
-
return Y(e, t), !
|
|
2877
|
+
return Y(e, t), !Z(t.weights) && this.gltf.meshes && Z(e.mesh) ? e.weights = this.gltf.meshes[e.mesh].weights : t.weights && (e.weights = t.weights),
|
|
2873
2878
|
e;
|
|
2874
2879
|
}
|
|
2875
2880
|
T(t) {
|
|
2876
2881
|
const e = this.gltf.textures[t];
|
|
2877
2882
|
if (!e) return null;
|
|
2878
2883
|
const n = this.gltf.images[e.source];
|
|
2879
|
-
return this.
|
|
2884
|
+
return this.g(n).then(t => {
|
|
2880
2885
|
if (!t) return null;
|
|
2881
2886
|
const r = {
|
|
2882
2887
|
image: {
|
|
2883
2888
|
array: t.data,
|
|
2889
|
+
mipmap: t.mipmap,
|
|
2884
2890
|
width: t.width,
|
|
2885
2891
|
height: t.height,
|
|
2886
2892
|
index: e.source,
|
|
@@ -2891,72 +2897,74 @@
|
|
|
2891
2897
|
}
|
|
2892
2898
|
};
|
|
2893
2899
|
Y(r, e);
|
|
2894
|
-
const s =
|
|
2900
|
+
const s = Z(e.sampler) ? this.gltf.samplers[e.sampler] : void 0;
|
|
2895
2901
|
return s && (r.sampler = s), t.format && (r.format = t.format), r;
|
|
2896
2902
|
});
|
|
2897
2903
|
}
|
|
2898
|
-
|
|
2899
|
-
if (!
|
|
2904
|
+
g(t) {
|
|
2905
|
+
if (!Z(t.bufferView)) return this.O(t);
|
|
2900
2906
|
{
|
|
2901
2907
|
const e = this.gltf.bufferViews[t.bufferView];
|
|
2902
2908
|
if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
|
|
2903
2909
|
const n = this.gltf.buffers[e.buffer];
|
|
2904
|
-
if (n.uri) return this.
|
|
2905
|
-
if (this.glbBuffer) return this.
|
|
2910
|
+
if (n.uri) return this.M(n, e, t);
|
|
2911
|
+
if (this.glbBuffer) return this.S(e, t);
|
|
2906
2912
|
}
|
|
2907
2913
|
return null;
|
|
2908
2914
|
}
|
|
2909
|
-
|
|
2915
|
+
O(t) {
|
|
2910
2916
|
const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
|
|
2911
|
-
return this.requests[t.id] ? this.requests[t.id].then(() => this.images[t.id]) : this.requests[t.id] = this.
|
|
2917
|
+
return this.requests[t.id] ? this.requests[t.id].then(() => this.images[t.id]) : this.requests[t.id] = this.I(t.id, e);
|
|
2912
2918
|
}
|
|
2913
|
-
|
|
2919
|
+
N(t, e) {
|
|
2914
2920
|
const n = this.decoders;
|
|
2915
|
-
if (n[e.mimeType]) return n[e.mimeType](t
|
|
2921
|
+
if (n[e.mimeType]) return n[e.mimeType](t, {
|
|
2922
|
+
supportedFormats: this.v
|
|
2923
|
+
});
|
|
2916
2924
|
if ("image/crn" === e.mimeType || "image/ktx2" === e.mimeType || "image/cttf" === e.mimeType) return console.warn("missing transcoder for " + e.mimeType, ", visit https://maptalks.com/docs/transcoders for details"),
|
|
2917
2925
|
Promise.resolve(null);
|
|
2918
2926
|
{
|
|
2919
2927
|
const n = new Blob([ t ], {
|
|
2920
2928
|
type: e.mimeType
|
|
2921
2929
|
}), r = URL.createObjectURL(n);
|
|
2922
|
-
return this.
|
|
2930
|
+
return this.I(e.id, r);
|
|
2923
2931
|
}
|
|
2924
2932
|
}
|
|
2925
|
-
|
|
2933
|
+
M(t, e, n) {
|
|
2926
2934
|
if (this.buffers[t.id]) {
|
|
2927
|
-
const r = this.buffers[t.id], s = this.
|
|
2928
|
-
return this.
|
|
2935
|
+
const r = this.buffers[t.id], s = this.P(e, r);
|
|
2936
|
+
return this.N(s, n);
|
|
2929
2937
|
}
|
|
2930
2938
|
if (this.requests[t.id]) return this.requests[t.id].then(() => {
|
|
2931
|
-
const r = this.buffers[t.id], s = this.
|
|
2932
|
-
return this.
|
|
2939
|
+
const r = this.buffers[t.id], s = this.P(e, r);
|
|
2940
|
+
return this.N(s, n);
|
|
2933
2941
|
});
|
|
2934
2942
|
if (tt(t.uri)) {
|
|
2935
|
-
const r = this.buffers[t.id] = et(t.uri), s = this.
|
|
2936
|
-
return this.
|
|
2943
|
+
const r = this.buffers[t.id] = et(t.uri), s = this.P(e, r);
|
|
2944
|
+
return this.N(s, n);
|
|
2937
2945
|
}
|
|
2938
2946
|
return this.requests[t.id] = ft.getArrayBuffer(t.uri, null).then(r => {
|
|
2939
|
-
const s = this.buffers[t.id] = r.data, i = this.
|
|
2940
|
-
return this.
|
|
2947
|
+
const s = this.buffers[t.id] = r.data, i = this.P(e, s);
|
|
2948
|
+
return this.N(i, n);
|
|
2941
2949
|
});
|
|
2942
2950
|
}
|
|
2943
|
-
M(t, e) {
|
|
2944
|
-
const n = this.N(t, this.glbBuffer.buffer, this.glbBuffer.byteOffset);
|
|
2945
|
-
return this.I(n, e);
|
|
2946
|
-
}
|
|
2947
2951
|
S(t, e) {
|
|
2952
|
+
const n = this.P(t, this.glbBuffer.buffer, this.glbBuffer.byteOffset);
|
|
2953
|
+
return this.N(n, e);
|
|
2954
|
+
}
|
|
2955
|
+
I(t, e) {
|
|
2948
2956
|
return new Promise((n, r) => {
|
|
2949
2957
|
this.A(e, (s, i) => {
|
|
2950
2958
|
s ? r(s) : (URL.revokeObjectURL(e), this.images[t] = i, n(this.images[t]));
|
|
2951
2959
|
});
|
|
2952
2960
|
});
|
|
2953
2961
|
}
|
|
2954
|
-
|
|
2962
|
+
P(t, e, n) {
|
|
2955
2963
|
n = n || 0;
|
|
2956
2964
|
const r = t.byteOffset + n, s = t.byteLength;
|
|
2957
2965
|
return new Uint8Array(e, r, s);
|
|
2958
2966
|
}
|
|
2959
|
-
|
|
2967
|
+
L(t, e) {
|
|
2960
2968
|
const n = new Array(t.byteLength);
|
|
2961
2969
|
for (let e = 0; e < t.byteLength; e++) n[e] = String.fromCharCode(t[e]);
|
|
2962
2970
|
return n.join(""), "data:" + (e = e || "image/png") + ";base64," + function(t) {
|
|
@@ -2974,7 +2982,7 @@
|
|
|
2974
2982
|
}
|
|
2975
2983
|
getSamplers(t) {
|
|
2976
2984
|
const e = [];
|
|
2977
|
-
for (let n = 0; n < t.length; n++) (
|
|
2985
|
+
for (let n = 0; n < t.length; n++) (Z(t[n].input) || Z(t[n].output)) && (e.push(this.accessor.h("input", t[n].input)),
|
|
2978
2986
|
e.push(this.accessor.h("output", t[n].output)));
|
|
2979
2987
|
return Promise.all(e).then(e => {
|
|
2980
2988
|
for (let n = 0; n < e.length / 2; n++) t[n].input = e[2 * n], t[n].output = e[2 * n + 1],
|
|
@@ -3040,7 +3048,7 @@
|
|
|
3040
3048
|
for (let r = 0; r < e; ) {
|
|
3041
3049
|
let s = t[r++];
|
|
3042
3050
|
if (128 & s) {
|
|
3043
|
-
let n =
|
|
3051
|
+
let n = _t[s >> 3 & 7];
|
|
3044
3052
|
if (!(64 & s) || !n || r + n > e) return null;
|
|
3045
3053
|
for (s &= 63 >> n; n > 0; n -= 1) {
|
|
3046
3054
|
const e = t[r++];
|
|
@@ -3053,7 +3061,7 @@
|
|
|
3053
3061
|
return n;
|
|
3054
3062
|
}(new Uint8Array(t, e, n));
|
|
3055
3063
|
}
|
|
3056
|
-
const
|
|
3064
|
+
const _t = [ 1, 1, 1, 1, 2, 2, 3, 0 ], gt = [ 0, 0, 0 ], Tt = [ 0, 0, 0, 1 ], At = [ 1, 1, 1 ], vt = {
|
|
3057
3065
|
TRANSLATION: [ 0, 0, 0 ],
|
|
3058
3066
|
ROTATION: [ 0, 0, 0, 1 ],
|
|
3059
3067
|
SCALE: [ 1, 1, 1 ]
|
|
@@ -3064,17 +3072,17 @@
|
|
|
3064
3072
|
NEXTINDEX: null,
|
|
3065
3073
|
INTERPOLATION: null
|
|
3066
3074
|
}, Mt = {
|
|
3067
|
-
|
|
3068
|
-
const c =
|
|
3075
|
+
B(t, e, n, r, s, i, o, a) {
|
|
3076
|
+
const c = Z(t) ? e.animations : [ e.animations[0] ], h = {};
|
|
3069
3077
|
for (let e = 0; e < c.length; e++) {
|
|
3070
3078
|
const u = c[e];
|
|
3071
|
-
if (
|
|
3079
|
+
if (Z(t) && u.name !== t) continue;
|
|
3072
3080
|
const f = u.channelsMap[n];
|
|
3073
3081
|
if (f) for (let t = 0; t < f.length; t++) {
|
|
3074
3082
|
const e = f[t];
|
|
3075
|
-
"translation" === e.target.path ? (this.U(s, u.samplers[e.sampler], r, 1), h.translation =
|
|
3083
|
+
"translation" === e.target.path ? (this.U(s, u.samplers[e.sampler], r, 1), h.translation = B(gt, s)) : "rotation" === e.target.path ? (this.C(i, u.samplers[e.sampler], r, 1),
|
|
3076
3084
|
h.rotation = K(Tt, i)) : "scale" === e.target.path ? (this.U(o, u.samplers[e.sampler], r, 1),
|
|
3077
|
-
h.scale =
|
|
3085
|
+
h.scale = B(At, o)) : "weights" === e.target.path && a && (this.U(a, u.samplers[e.sampler], r, a.length),
|
|
3078
3086
|
h.weights = a);
|
|
3079
3087
|
}
|
|
3080
3088
|
}
|
|
@@ -3084,7 +3092,7 @@
|
|
|
3084
3092
|
switch (e.interpolation) {
|
|
3085
3093
|
case "LINEAR":
|
|
3086
3094
|
{
|
|
3087
|
-
const s = this.
|
|
3095
|
+
const s = this.R(Ot, e, n, 1 * r);
|
|
3088
3096
|
s && (t = function(t, e, n, r) {
|
|
3089
3097
|
for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
|
|
3090
3098
|
return t;
|
|
@@ -3094,7 +3102,7 @@
|
|
|
3094
3102
|
|
|
3095
3103
|
case "STEP":
|
|
3096
3104
|
{
|
|
3097
|
-
const s = this.
|
|
3105
|
+
const s = this.R(Ot, e, n, 1 * r);
|
|
3098
3106
|
s && (t = function(t, e) {
|
|
3099
3107
|
for (let n = 0; n < t.length; n++) t[n] = e[n];
|
|
3100
3108
|
return t;
|
|
@@ -3104,36 +3112,36 @@
|
|
|
3104
3112
|
|
|
3105
3113
|
case "CUBICSPLINE":
|
|
3106
3114
|
{
|
|
3107
|
-
const s = this.
|
|
3108
|
-
s && (t = this.
|
|
3115
|
+
const s = this.R(Ot, e, n, 3 * r);
|
|
3116
|
+
s && (t = this.F(t, s, e.input.array, 3 * r));
|
|
3109
3117
|
break;
|
|
3110
3118
|
}
|
|
3111
3119
|
}
|
|
3112
3120
|
return t;
|
|
3113
3121
|
},
|
|
3114
|
-
|
|
3122
|
+
C(t, e, n) {
|
|
3115
3123
|
switch (e.interpolation) {
|
|
3116
3124
|
case "LINEAR":
|
|
3117
3125
|
{
|
|
3118
|
-
const r = this.
|
|
3126
|
+
const r = this.R(Ot, e, n, 1);
|
|
3119
3127
|
r && $(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
|
|
3120
3128
|
break;
|
|
3121
3129
|
}
|
|
3122
3130
|
|
|
3123
3131
|
case "STEP":
|
|
3124
3132
|
{
|
|
3125
|
-
const r = this.
|
|
3133
|
+
const r = this.R(Ot, e, n, 1);
|
|
3126
3134
|
r && (t = H(t, ...r.PREVIOUS));
|
|
3127
3135
|
break;
|
|
3128
3136
|
}
|
|
3129
3137
|
|
|
3130
3138
|
case "CUBICSPLINE":
|
|
3131
3139
|
{
|
|
3132
|
-
const r = this.
|
|
3140
|
+
const r = this.R(Ot, e, n, 3);
|
|
3133
3141
|
if (r) {
|
|
3134
3142
|
for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
|
|
3135
3143
|
r.NEXT[t] = Math.acos(r.NEXT[t]);
|
|
3136
|
-
t = this.
|
|
3144
|
+
t = this.F(t, r, e.input.array, 3);
|
|
3137
3145
|
for (let e = 0; e < t.length; e++) t[e] = Math.cos(t[e]);
|
|
3138
3146
|
}
|
|
3139
3147
|
break;
|
|
@@ -3141,7 +3149,7 @@
|
|
|
3141
3149
|
}
|
|
3142
3150
|
return t;
|
|
3143
3151
|
},
|
|
3144
|
-
|
|
3152
|
+
D(t, e) {
|
|
3145
3153
|
const n = t.length;
|
|
3146
3154
|
let r, s, i, o = 0, a = n - 1, c = Math.floor((o + a) / 2);
|
|
3147
3155
|
for (;o <= n - 1 && a >= 0; ) {
|
|
@@ -3158,11 +3166,11 @@
|
|
|
3158
3166
|
}
|
|
3159
3167
|
return null;
|
|
3160
3168
|
},
|
|
3161
|
-
|
|
3169
|
+
R(t, e, n, r) {
|
|
3162
3170
|
const s = e.input.array, i = e.output.array, o = e.output.itemSize;
|
|
3163
3171
|
(n < s[0] || n > s[s.length - 1]) && (n = Math.max(s[0], Math.min(s[s.length - 1], n))),
|
|
3164
3172
|
n === s[s.length - 1] && (n = s[0]);
|
|
3165
|
-
const a = this.
|
|
3173
|
+
const a = this.D(s, n);
|
|
3166
3174
|
if (!a || !a.nextIndex) return null;
|
|
3167
3175
|
const {preIndx: c, nextIndex: h, interpolation: u} = a;
|
|
3168
3176
|
t.PREINDEX = c, t.NEXTINDEX = h, t.INTERPOLATION = u;
|
|
@@ -3170,7 +3178,7 @@
|
|
|
3170
3178
|
return t.PREVIOUS = i.subarray(t.PREINDEX * f, (t.PREINDEX + 1) * f), t.NEXT = i.subarray(t.NEXTINDEX * f, (t.NEXTINDEX + 1) * f),
|
|
3171
3179
|
t;
|
|
3172
3180
|
},
|
|
3173
|
-
|
|
3181
|
+
F(t, e, n, r) {
|
|
3174
3182
|
const s = e.INTERPOLATION, i = n[e.PREINDEX], o = n[e.NEXTINDEX];
|
|
3175
3183
|
for (let n = 0; n < 3; n++) {
|
|
3176
3184
|
const a = e.PREVIOUS[r + n], c = (o - i) * e.PREVIOUS[2 * r + n], h = e.NEXT[3 + n], u = (o - i) * e.NEXT[n], f = (2 * Math.pow(s, 3) - 3 * Math.pow(s, 2) + 1) * a + (Math.pow(s, 3) - 2 * Math.pow(s, 2) + s) * c + (2 * -Math.pow(s, 3) + 3 * Math.pow(s, 2)) * h + (Math.pow(s, 3) - Math.pow(s, 2)) * u;
|
|
@@ -3180,7 +3188,7 @@
|
|
|
3180
3188
|
},
|
|
3181
3189
|
getAnimationClip(t, e, n, r) {
|
|
3182
3190
|
const s = t.nodes[e] && t.nodes[e].weights;
|
|
3183
|
-
return
|
|
3191
|
+
return U(gt, ...vt.TRANSLATION), H(Tt, ...vt.ROTATION), U(At, ...vt.SCALE), this.B(r, t, e, n, gt, Tt, At, s);
|
|
3184
3192
|
},
|
|
3185
3193
|
getTimeSpan(t) {
|
|
3186
3194
|
if (!t.animations) return null;
|
|
@@ -3202,7 +3210,7 @@
|
|
|
3202
3210
|
},
|
|
3203
3211
|
getTimeSpanByName(t, e) {
|
|
3204
3212
|
const n = this.getTimeSpan(t);
|
|
3205
|
-
return n ?
|
|
3213
|
+
return n ? Z(e) ? n[e] : n[Object.keys(n)[0]] : null;
|
|
3206
3214
|
}
|
|
3207
3215
|
};
|
|
3208
3216
|
let St = !1;
|
|
@@ -3210,7 +3218,7 @@
|
|
|
3210
3218
|
let t;
|
|
3211
3219
|
try {
|
|
3212
3220
|
t = new OffscreenCanvas(2, 2).getContext("2d");
|
|
3213
|
-
} catch (
|
|
3221
|
+
} catch (kn) {}
|
|
3214
3222
|
t && "undefined" != typeof createImageBitmap && (St = !0);
|
|
3215
3223
|
}
|
|
3216
3224
|
const xt = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
@@ -3219,25 +3227,25 @@
|
|
|
3219
3227
|
if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
|
|
3220
3228
|
e.buffer instanceof ArrayBuffer) {
|
|
3221
3229
|
const {json: n, glbBuffer: r} = pt.read(e.buffer, e.byteOffset, e.byteLength);
|
|
3222
|
-
this.
|
|
3223
|
-
} else this.
|
|
3224
|
-
this.
|
|
3230
|
+
this.k(t, n, r);
|
|
3231
|
+
} else this.k(t, e);
|
|
3232
|
+
this.j = new dt(this.rootPath, this.gltf, this.glbBuffer), this.V();
|
|
3225
3233
|
}
|
|
3226
|
-
|
|
3234
|
+
V() {
|
|
3227
3235
|
const t = this.gltf.extensionsRequired;
|
|
3228
3236
|
if (t) {
|
|
3229
3237
|
if (t.indexOf("KHR_draco_mesh_compression") >= 0 && !this.options.decoders.draco) throw new Error("KHR_draco_mesh_compression is required but @maptalks/transcoders.draco is not loaded");
|
|
3230
3238
|
if (t.indexOf("KHR_texture_basisu") >= 0 && !this.options.decoders.ktx2) throw new Error("KHR_texture_basisu is required but @maptalks/transcoders.ktx2 is not loaded");
|
|
3231
3239
|
}
|
|
3232
3240
|
}
|
|
3233
|
-
|
|
3241
|
+
G() {
|
|
3234
3242
|
const t = this.gltf.extensions;
|
|
3235
|
-
return t && t.KHR_techniques_webgl ? this.
|
|
3243
|
+
return t && t.KHR_techniques_webgl ? this.j.requestKHRTechniquesWebgl(t.KHR_techniques_webgl).then(e => (t.KHR_techniques_webgl = e,
|
|
3236
3244
|
t)) : Promise.resolve(t);
|
|
3237
3245
|
}
|
|
3238
3246
|
load(t) {
|
|
3239
3247
|
t = t || {};
|
|
3240
|
-
const e = this.
|
|
3248
|
+
const e = this.H(t), n = this.q(), r = this.$(), s = this.G();
|
|
3241
3249
|
return Promise.all([ e, n, r, s ]).then(t => (t[0].animations = t[1], t[0].textures = t[2],
|
|
3242
3250
|
t[0].extensions = t[3], t[0].transferables = this.transferables || [], this.createChannelsMap(t[0]),
|
|
3243
3251
|
t[0]));
|
|
@@ -3280,10 +3288,10 @@
|
|
|
3280
3288
|
static readInterleavedArray(t, e, n, r, s, i, o) {
|
|
3281
3289
|
return ct(t, e, n, r, s, i, o);
|
|
3282
3290
|
}
|
|
3283
|
-
|
|
3291
|
+
k(t, e, n) {
|
|
3284
3292
|
this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
|
|
3285
|
-
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = St ?
|
|
3286
|
-
this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new yt(t, e, n, this.options.requestImage, this.options.decoders || {}),
|
|
3293
|
+
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = St ? Lt : this.options.requestImage || Nt,
|
|
3294
|
+
this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new yt(t, e, n, this.options.requestImage, this.options.decoders || {}, this.options.supportedFormats || {}),
|
|
3287
3295
|
this.adapter.iterate((t, e, n) => {
|
|
3288
3296
|
e.id = "buffer_" + n;
|
|
3289
3297
|
}, "buffers"), this.adapter.iterate((t, e, n) => {
|
|
@@ -3294,25 +3302,25 @@
|
|
|
3294
3302
|
e.id = "accessor_" + n;
|
|
3295
3303
|
}, "accessors"));
|
|
3296
3304
|
}
|
|
3297
|
-
|
|
3305
|
+
J(t, e) {
|
|
3298
3306
|
if (t.children && t.children.length > 0) {
|
|
3299
3307
|
if (!("number" == typeof (n = t.children[0]) && isFinite(n) || function(t) {
|
|
3300
|
-
return !
|
|
3308
|
+
return !W(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
|
|
3301
3309
|
}(t.children[0]))) return t;
|
|
3302
3310
|
const r = t.children.map(t => {
|
|
3303
3311
|
const n = e[t];
|
|
3304
|
-
return n.nodeIndex = t, this
|
|
3312
|
+
return n.nodeIndex = t, this.J(n, e);
|
|
3305
3313
|
});
|
|
3306
3314
|
t.children = r;
|
|
3307
3315
|
}
|
|
3308
3316
|
var n;
|
|
3309
3317
|
return t;
|
|
3310
3318
|
}
|
|
3311
|
-
|
|
3312
|
-
return this.
|
|
3319
|
+
H(t) {
|
|
3320
|
+
return this.K(t).then(t => {
|
|
3313
3321
|
const e = this.scenes = [];
|
|
3314
3322
|
let n;
|
|
3315
|
-
for (const e in t) t[e] = this
|
|
3323
|
+
for (const e in t) t[e] = this.J(t[e], t), t[e].nodeIndex = Number(e) ? Number(e) : e;
|
|
3316
3324
|
this.adapter.iterate((r, s, i) => {
|
|
3317
3325
|
const o = {};
|
|
3318
3326
|
s.name && (o.name = s.name), s.nodes && (o.nodes = s.nodes.map(e => t[e])), this.gltf.scene === r && (n = i),
|
|
@@ -3328,14 +3336,14 @@
|
|
|
3328
3336
|
skins: this.skins
|
|
3329
3337
|
};
|
|
3330
3338
|
if (this.gltf.extensions && (r.extensions = this.gltf.extensions), 1 === this.version) {
|
|
3331
|
-
const t = this.adapter.
|
|
3339
|
+
const t = this.adapter._(this.gltf.materials);
|
|
3332
3340
|
r.materials = t;
|
|
3333
3341
|
}
|
|
3334
3342
|
return r;
|
|
3335
3343
|
});
|
|
3336
3344
|
}
|
|
3337
|
-
|
|
3338
|
-
return this.
|
|
3345
|
+
K(t) {
|
|
3346
|
+
return this.X(t).then(() => {
|
|
3339
3347
|
const t = this.nodes = {};
|
|
3340
3348
|
return this.adapter.iterate((e, n) => {
|
|
3341
3349
|
const r = this.adapter.createNode(n, this.meshes, this.skins);
|
|
@@ -3343,7 +3351,7 @@
|
|
|
3343
3351
|
}, "nodes"), t;
|
|
3344
3352
|
});
|
|
3345
3353
|
}
|
|
3346
|
-
|
|
3354
|
+
W() {
|
|
3347
3355
|
this.skins = [];
|
|
3348
3356
|
const t = [];
|
|
3349
3357
|
return this.adapter.iterate((e, n, r) => {
|
|
@@ -3358,27 +3366,27 @@
|
|
|
3358
3366
|
e && e.buffer && this.transferables && this.transferables.indexOf(e.buffer) < 0 && this.transferables.push(e.buffer),
|
|
3359
3367
|
t));
|
|
3360
3368
|
}
|
|
3361
|
-
|
|
3369
|
+
q() {
|
|
3362
3370
|
const t = this.gltf.animations;
|
|
3363
|
-
return
|
|
3371
|
+
return Z(t) ? this.adapter.getAnimations(t) : null;
|
|
3364
3372
|
}
|
|
3365
|
-
|
|
3373
|
+
X(t) {
|
|
3366
3374
|
this.meshes = {};
|
|
3367
3375
|
let e = [];
|
|
3368
3376
|
return this.adapter.iterate((n, r, s) => {
|
|
3369
|
-
e.push(this.
|
|
3377
|
+
e.push(this.Y(r, t).then(t => {
|
|
3370
3378
|
t.index = s, this.meshes[n] = t;
|
|
3371
3379
|
}));
|
|
3372
|
-
}, "meshes"), e = e.concat(this.
|
|
3380
|
+
}, "meshes"), e = e.concat(this.W()), Promise.all(e);
|
|
3373
3381
|
}
|
|
3374
|
-
|
|
3375
|
-
const n = t.primitives.map(t => this.
|
|
3382
|
+
Y(t, e) {
|
|
3383
|
+
const n = t.primitives.map(t => this.tt(t, e)).filter(t => !!t);
|
|
3376
3384
|
return Promise.all(n).then(e => {
|
|
3377
3385
|
const n = {};
|
|
3378
3386
|
return Y(n, t), n.primitives = e, n;
|
|
3379
3387
|
});
|
|
3380
3388
|
}
|
|
3381
|
-
|
|
3389
|
+
$() {
|
|
3382
3390
|
const t = this.gltf.textures;
|
|
3383
3391
|
if (!t) return null;
|
|
3384
3392
|
const e = [];
|
|
@@ -3396,13 +3404,13 @@
|
|
|
3396
3404
|
return e;
|
|
3397
3405
|
});
|
|
3398
3406
|
}
|
|
3399
|
-
|
|
3407
|
+
tt(t, e) {
|
|
3400
3408
|
let n;
|
|
3401
3409
|
const r = t.extensions;
|
|
3402
3410
|
if (r && r.KHR_draco_mesh_compression) {
|
|
3403
3411
|
if (!this.options.decoders.draco && (!this.gltf.extensionsRequired || !this.gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression") < 0)) return null;
|
|
3404
3412
|
const t = this.options.decoders.draco, {bufferView: s, attributes: i} = r.KHR_draco_mesh_compression, o = this.gltf.bufferViews[s];
|
|
3405
|
-
n = this.
|
|
3413
|
+
n = this.j.l(o).then(n => {
|
|
3406
3414
|
const {buffer: r, byteOffset: s} = n;
|
|
3407
3415
|
let {byteOffset: a, byteLength: c} = o;
|
|
3408
3416
|
a || (a = 0);
|
|
@@ -3422,11 +3430,11 @@
|
|
|
3422
3430
|
const n = this.adapter.accessor.h(t, r[t]);
|
|
3423
3431
|
n && e.push(n);
|
|
3424
3432
|
}
|
|
3425
|
-
if (
|
|
3433
|
+
if (Z(t.indices)) {
|
|
3426
3434
|
const n = this.adapter.accessor.h("indices", t.indices);
|
|
3427
3435
|
n && e.push(n);
|
|
3428
3436
|
}
|
|
3429
|
-
if (
|
|
3437
|
+
if (Z(t.targets)) for (let n = 0; n < t.targets.length; n++) {
|
|
3430
3438
|
const r = t.targets[n];
|
|
3431
3439
|
for (const t in r) {
|
|
3432
3440
|
const s = this.adapter.accessor.h(`morphTargets_${t}_${n}`, r[t]);
|
|
@@ -3443,8 +3451,8 @@
|
|
|
3443
3451
|
t), {}),
|
|
3444
3452
|
material: t.material
|
|
3445
3453
|
};
|
|
3446
|
-
return n && (s.indices = n), r && (s.morphTargets = r), s.mode =
|
|
3447
|
-
|
|
3454
|
+
return n && (s.indices = n), r && (s.morphTargets = r), s.mode = Z(t.mode) ? t.mode : 4,
|
|
3455
|
+
Z(t.extras) && (s.extras = t.extras), s;
|
|
3448
3456
|
});
|
|
3449
3457
|
}
|
|
3450
3458
|
}
|
|
@@ -3465,11 +3473,11 @@
|
|
|
3465
3473
|
e(t);
|
|
3466
3474
|
}, n.src = t;
|
|
3467
3475
|
}
|
|
3468
|
-
let
|
|
3469
|
-
function
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
const n =
|
|
3476
|
+
let Et, Pt;
|
|
3477
|
+
function Lt(t, e) {
|
|
3478
|
+
Et || (Et = new OffscreenCanvas(2, 2), Pt = Et.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
3479
|
+
Et.width = t.width, Et.height = t.height, Pt.drawImage(t, 0, 0);
|
|
3480
|
+
const n = Pt.getImageData(0, 0, Et.width, Et.height);
|
|
3473
3481
|
e(null, {
|
|
3474
3482
|
width: t.width,
|
|
3475
3483
|
height: t.height,
|
|
@@ -3477,8 +3485,8 @@
|
|
|
3477
3485
|
});
|
|
3478
3486
|
});
|
|
3479
3487
|
}
|
|
3480
|
-
const
|
|
3481
|
-
class
|
|
3488
|
+
const Bt = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
3489
|
+
class Ut extends s.worker.Actor {
|
|
3482
3490
|
constructor(t, e) {
|
|
3483
3491
|
super(t), this.mapId = e;
|
|
3484
3492
|
}
|
|
@@ -3530,20 +3538,21 @@
|
|
|
3530
3538
|
requestImage({url: t}, e) {
|
|
3531
3539
|
const n = new Image;
|
|
3532
3540
|
n.onload = () => {
|
|
3533
|
-
if (!
|
|
3541
|
+
if (!this.isActive()) return;
|
|
3542
|
+
if (!Bt) return void e(new Error("There is no canvas to draw image!"));
|
|
3534
3543
|
const t = function(t) {
|
|
3535
|
-
if (
|
|
3544
|
+
if (Ct(t.width) && Ct(t.height)) return t;
|
|
3536
3545
|
let e = t.width, n = t.height;
|
|
3537
|
-
|
|
3538
|
-
|
|
3546
|
+
Ct(e) || (e = Rt(e));
|
|
3547
|
+
Ct(n) || (n = Rt(n));
|
|
3539
3548
|
const r = document.createElement("canvas");
|
|
3540
3549
|
r.width = e, r.height = n, r.getContext("2d").drawImage(t, 0, 0, e, n);
|
|
3541
3550
|
const s = t.src, i = s.lastIndexOf("/") + 1, o = s.substring(i);
|
|
3542
3551
|
return console.warn(`Texture(${o})'s size is not power of two, resize from (${t.width}, ${t.height}) to (${e}, ${n})`),
|
|
3543
3552
|
r;
|
|
3544
3553
|
}(n);
|
|
3545
|
-
|
|
3546
|
-
const r =
|
|
3554
|
+
Bt.width = t.width, Bt.height = t.height;
|
|
3555
|
+
const r = Bt.getContext("2d");
|
|
3547
3556
|
r.drawImage(t, 0, 0, t.width, t.height);
|
|
3548
3557
|
const s = r.getImageData(0, 0, t.width, t.height), i = {
|
|
3549
3558
|
width: t.width,
|
|
@@ -3556,7 +3565,7 @@
|
|
|
3556
3565
|
}, n.src = t;
|
|
3557
3566
|
}
|
|
3558
3567
|
}
|
|
3559
|
-
function
|
|
3568
|
+
function Ct(t) {
|
|
3560
3569
|
return 0 == (t & t - 1) && 0 !== t;
|
|
3561
3570
|
}
|
|
3562
3571
|
function Rt(t) {
|
|
@@ -3690,30 +3699,30 @@
|
|
|
3690
3699
|
return t[0] = e[0] + n[0], t[1] = e[1] + n[1], t[2] = e[2] + n[2], t;
|
|
3691
3700
|
}(t, Gt, Vt);
|
|
3692
3701
|
}
|
|
3693
|
-
const $t = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Jt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Kt = new Array(3), Xt = new Array(3),
|
|
3694
|
-
function
|
|
3702
|
+
const $t = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Jt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Kt = new Array(3), Xt = new Array(3), Wt = new Array(3);
|
|
3703
|
+
function Zt(t, e) {
|
|
3695
3704
|
const n = Jt, r = function(t, e, n, r, s) {
|
|
3696
3705
|
const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], f = i * i * c * c, l = o * o * h * h, d = a * a * u * u, m = f + l + d, y = Math.sqrt(1 / m), b = F(Yt, e, y);
|
|
3697
3706
|
if (m < s) return isFinite(y) ? b : void 0;
|
|
3698
|
-
const p = r[0], w = r[1],
|
|
3699
|
-
|
|
3700
|
-
let T, A, v, O, M, S, x, I, N,
|
|
3707
|
+
const p = r[0], w = r[1], _ = r[2], g = Qt;
|
|
3708
|
+
g[0] = b[0] * p * 2, g[1] = b[1] * w * 2, g[2] = b[2] * _ * 2;
|
|
3709
|
+
let T, A, v, O, M, S, x, I, N, E, P, L = (1 - y) * te(e) / (.5 * te(g)), B = 0;
|
|
3701
3710
|
do {
|
|
3702
|
-
|
|
3703
|
-
x = O * O, I = M * M, N = S * v,
|
|
3704
|
-
A = f * N * p + l *
|
|
3705
|
-
|
|
3711
|
+
L -= B, v = 1 / (1 + L * p), O = 1 / (1 + L * w), M = 1 / (1 + L * _), S = v * v,
|
|
3712
|
+
x = O * O, I = M * M, N = S * v, E = x * O, P = I * M, T = f * S + l * x + d * I - 1,
|
|
3713
|
+
A = f * N * p + l * E * w + d * P * _;
|
|
3714
|
+
B = T / (-2 * A);
|
|
3706
3715
|
} while (Math.abs(T) > 1e-12);
|
|
3707
3716
|
return t[0] = i * v, t[1] = o * O, t[2] = a * M, t;
|
|
3708
3717
|
}(Kt, e, $t, n, .1);
|
|
3709
3718
|
let s = V(Xt, r, n);
|
|
3710
3719
|
s = ee(s, s);
|
|
3711
|
-
const i = z(
|
|
3720
|
+
const i = z(Wt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = _(k(i, e)) * te(i);
|
|
3712
3721
|
return t[0] = p(o), t[1] = p(a), t[2] = c, t;
|
|
3713
3722
|
}
|
|
3714
3723
|
const Yt = new Array(3), Qt = new Array(3);
|
|
3715
3724
|
function te(t) {
|
|
3716
|
-
return
|
|
3725
|
+
return P(t);
|
|
3717
3726
|
}
|
|
3718
3727
|
function ee(t, e) {
|
|
3719
3728
|
const n = e[0], r = e[1], s = e[2];
|
|
@@ -3727,7 +3736,7 @@
|
|
|
3727
3736
|
var re = Object.freeze({
|
|
3728
3737
|
__proto__: null,
|
|
3729
3738
|
radianToCartesian3: qt,
|
|
3730
|
-
cartesian3ToDegree:
|
|
3739
|
+
cartesian3ToDegree: Zt,
|
|
3731
3740
|
normalizeCartesian: ee,
|
|
3732
3741
|
geodeticSurfaceNormal: ne
|
|
3733
3742
|
});
|
|
@@ -3771,6 +3780,7 @@
|
|
|
3771
3780
|
};
|
|
3772
3781
|
}
|
|
3773
3782
|
function ue(t, e, n, r) {
|
|
3783
|
+
t.componentType || (t.componentType = "UNSIGNED_SHORT");
|
|
3774
3784
|
const s = he(t, e, n, r);
|
|
3775
3785
|
return s.array.buffer.byteLength !== e.byteLength && (s.array = s.array.slice()),
|
|
3776
3786
|
s;
|
|
@@ -3865,7 +3875,7 @@
|
|
|
3865
3875
|
west: [],
|
|
3866
3876
|
south: [],
|
|
3867
3877
|
down: []
|
|
3868
|
-
},
|
|
3878
|
+
}, _e = [], ge = [], Te = [];
|
|
3869
3879
|
const Ae = [ 0, 0, 0 ];
|
|
3870
3880
|
function ve(t, e, n, r) {
|
|
3871
3881
|
n = n || 0, r = r || n;
|
|
@@ -3914,36 +3924,39 @@
|
|
|
3914
3924
|
north: "up",
|
|
3915
3925
|
south: "down"
|
|
3916
3926
|
}
|
|
3917
|
-
}[Se = "east"][xe = "north"], pe[
|
|
3927
|
+
}[Se = "east"][xe = "north"], pe[Ee = Se + xe] ? Ie = pe[Ee] : (Ie = function(t, e, n) {
|
|
3918
3928
|
if (function(t, e) {
|
|
3919
3929
|
var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
|
|
3920
3930
|
return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(r - o) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(o)) && Math.abs(s - a) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(a));
|
|
3921
|
-
}(t, Ae))
|
|
3922
|
-
var r =
|
|
3923
|
-
|
|
3924
|
-
|
|
3931
|
+
}(t, Ae)) B(_e, be[Se]), B(ge, be[xe]), B(Te, be[Ne]); else if (ve(t[0], 0, 1e-14) && ve(t[1], 0, 1e-14)) {
|
|
3932
|
+
var r = _(t[2]);
|
|
3933
|
+
B(_e, be[Se]), "east" !== Se && "west" !== Se && F(_e, _e, r), B(ge, be[xe]), "east" !== xe && "west" !== xe && F(ge, ge, r),
|
|
3934
|
+
B(Te, be[Ne]), "east" !== Ne && "west" !== Ne && F(Te, Te, r);
|
|
3925
3935
|
} else {
|
|
3926
3936
|
ne(t, we.up);
|
|
3927
3937
|
var s = we.up, i = we.east;
|
|
3928
3938
|
i[0] = -t[1], i[1] = t[0], i[2] = 0, D(we.east, i), j(we.north, s, i), F(we.down, we.up, -1),
|
|
3929
|
-
F(we.west, we.east, -1), F(we.south, we.north, -1),
|
|
3939
|
+
F(we.west, we.east, -1), F(we.south, we.north, -1), _e = we[Se], ge = we[xe], Te = we[Ne];
|
|
3930
3940
|
}
|
|
3931
|
-
return n[0] =
|
|
3932
|
-
n[6] =
|
|
3941
|
+
return n[0] = _e[0], n[1] = _e[1], n[2] = _e[2], n[3] = 0, n[4] = ge[0], n[5] = ge[1],
|
|
3942
|
+
n[6] = ge[2], n[7] = 0, n[8] = Te[0], n[9] = Te[1], n[10] = Te[2], n[11] = 0, n[12] = t[0],
|
|
3933
3943
|
n[13] = t[1], n[14] = t[2], n[15] = 1, n;
|
|
3934
|
-
}, pe[
|
|
3935
|
-
var Se, xe, Ie, Ne,
|
|
3936
|
-
const
|
|
3944
|
+
}, pe[Ee] = Ie), Ie);
|
|
3945
|
+
var Se, xe, Ie, Ne, Ee;
|
|
3946
|
+
const Pe = [], Le = [], Be = [], Ue = [], Ce = [], Re = [], Fe = [], De = {
|
|
3937
3947
|
x: 0,
|
|
3938
3948
|
y: 0
|
|
3939
3949
|
}, ke = {
|
|
3940
3950
|
x: 0,
|
|
3941
3951
|
y: 0
|
|
3942
3952
|
}, je = Math.PI / 180;
|
|
3943
|
-
const {getTextureMagFilter: ze, getTextureMinFilter: Ve, getTextureWrap: Ge, getMaterialType: He, getMaterialFormat: qe, getPrimitive: $e, getUniqueREGLBuffer: Je} = n.reshader.REGLHelper, Ke = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Xe = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], {loginIBLResOnCanvas:
|
|
3953
|
+
const {getTextureMagFilter: ze, getTextureMinFilter: Ve, getTextureWrap: Ge, getMaterialType: He, getMaterialFormat: qe, getPrimitive: $e, getUniqueREGLBuffer: Je} = n.reshader.REGLHelper, Ke = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Xe = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], {loginIBLResOnCanvas: We, logoutIBLResOnCanvas: Ze, getIBLResOnCanvas: Ye, getPBRUniforms: Qe} = n.reshader.pbr.PBRUtils, tn = {
|
|
3944
3954
|
factor: 0,
|
|
3945
3955
|
units: 0
|
|
3946
|
-
}, en =
|
|
3956
|
+
}, en = {
|
|
3957
|
+
specularStrength: 0,
|
|
3958
|
+
materialShininess: 1
|
|
3959
|
+
}, nn = [ 1, 1, 1 ], rn = n.mat4.identity([]), sn = t => t.material instanceof n.reshader.PhongMaterial, on = t => t.material instanceof n.reshader.pbr.StandardMaterial, an = [ !0, !0, !0, !0 ], cn = [], hn = new s.Coordinate(0, 0), un = [], fn = [], ln = {
|
|
3947
3960
|
"POSITION": "POSITION",
|
|
3948
3961
|
"NORMAL": "NORMAL",
|
|
3949
3962
|
"TEXCOORD_0": "TEXCOORD_0",
|
|
@@ -3953,164 +3966,163 @@
|
|
|
3953
3966
|
};
|
|
3954
3967
|
class dn {
|
|
3955
3968
|
constructor(t, e) {
|
|
3956
|
-
this.
|
|
3957
|
-
this.
|
|
3958
|
-
this.
|
|
3959
|
-
this.
|
|
3960
|
-
this.
|
|
3961
|
-
this.
|
|
3969
|
+
this.Pt = e, this.Lt = e.getRenderer().canvas, this.Bt = new s.SpatialReference,
|
|
3970
|
+
this.Ut = t, this.Ct = new n.reshader.Renderer(t), this.Rt = {}, this.Ft = {}, this.Dt = {},
|
|
3971
|
+
this.kt = {}, this.jt = {}, this.zt = {}, this.Vt = {}, this.Gt = new n.reshader.Scene,
|
|
3972
|
+
this.Ht = new n.reshader.Scene, this.qt = new n.reshader.Scene, this.$t = new n.reshader.Scene,
|
|
3973
|
+
this.Jt = new n.reshader.ResourceLoader(t.texture(2)), this.Kt = this.Xt.bind(this),
|
|
3974
|
+
this.Wt = new n.reshader.PhongMaterial({
|
|
3962
3975
|
"baseColorFactor": [ 1, 1, 1, 1 ]
|
|
3963
|
-
}), this.
|
|
3976
|
+
}), this.Zt(), this.Yt = new n.reshader.KHRTechniquesWebglManager(this.Ut, this.Qt(), this.Jt);
|
|
3964
3977
|
}
|
|
3965
3978
|
getI3DMMeshes() {
|
|
3966
|
-
return this.
|
|
3979
|
+
return this.jt;
|
|
3967
3980
|
}
|
|
3968
3981
|
getPNTSMeshes() {
|
|
3969
|
-
return this.
|
|
3982
|
+
return this.kt;
|
|
3970
3983
|
}
|
|
3971
3984
|
getB3DMMeshes() {
|
|
3972
|
-
return this.
|
|
3985
|
+
return this.Dt;
|
|
3973
3986
|
}
|
|
3974
3987
|
getMap() {
|
|
3975
|
-
return this.
|
|
3988
|
+
return this.Pt.getMap();
|
|
3976
3989
|
}
|
|
3977
3990
|
paint(t, e, n, r) {
|
|
3978
3991
|
const s = this.getMap();
|
|
3979
3992
|
if (!t.length || !s) return;
|
|
3980
|
-
const i = this.
|
|
3993
|
+
const i = this.te(), o = s.projViewMatrix, a = this.Pt.options.services, h = [];
|
|
3981
3994
|
let u = [];
|
|
3982
3995
|
for (let n = 0, r = t.length; n < r; n++) {
|
|
3983
|
-
let r = this.
|
|
3996
|
+
let r = this.ee(t[n].data.node);
|
|
3984
3997
|
if (!r) {
|
|
3985
|
-
if (r = this.
|
|
3998
|
+
if (r = this.zt[t[n].data.node.id], !r) continue;
|
|
3986
3999
|
r = v(r);
|
|
3987
4000
|
}
|
|
3988
4001
|
const s = t[n].node;
|
|
3989
|
-
let f = a[s.
|
|
4002
|
+
let f = a[s.ne].polygonOffset || tn;
|
|
3990
4003
|
y(f) && (f = f());
|
|
3991
|
-
const l = a[s.
|
|
4004
|
+
const l = a[s.ne].ambientLight;
|
|
3992
4005
|
for (let a = 0, d = r.length; a < d; a++) "b3dm" === r[a].properties.magic && (r[a].getBoundingBox && !c(o, r[a].getBoundingBox()) || (r[a].properties.level = t[n].selectionDepth,
|
|
3993
4006
|
r[a].properties.polygonOffset = f, Object.prototype.hasOwnProperty.call(r[a].uniforms, "ambientColor") || Object.defineProperty(r[a].uniforms, "ambientColor", {
|
|
3994
4007
|
enumerable: !0,
|
|
3995
4008
|
get: function() {
|
|
3996
4009
|
return l || i.ambientColor;
|
|
3997
4010
|
}
|
|
3998
|
-
}), r[a].
|
|
4011
|
+
}), r[a].re = s, e[s.id] || h.push(r[a]), u.push(r[a])));
|
|
3999
4012
|
}
|
|
4000
4013
|
let f = 0;
|
|
4001
|
-
const l = this.
|
|
4002
|
-
f += this.
|
|
4003
|
-
this.
|
|
4004
|
-
const i = this.
|
|
4005
|
-
f += this.
|
|
4014
|
+
const l = this.Yt.getExcludeFilter();
|
|
4015
|
+
f += this.se(this.ie, i, [ n, sn, l ], r, h, u), f += this.se(this.oe, i, [ n, on, l ], r, h, u),
|
|
4016
|
+
this.Yt.forEachShader((t, e, s) => {
|
|
4017
|
+
const i = this.te(s);
|
|
4018
|
+
f += this.se(t, i, [ n, e ], r, h, u);
|
|
4006
4019
|
});
|
|
4007
4020
|
const d = [];
|
|
4008
|
-
for (const t in this.
|
|
4009
|
-
this.
|
|
4010
|
-
const m = this.
|
|
4011
|
-
return f += this.
|
|
4012
|
-
}
|
|
4013
|
-
|
|
4014
|
-
t.filter = n.filter(t => !!t), e.debug = !1, this.
|
|
4015
|
-
e.
|
|
4016
|
-
e.stencilEnable = !0, e.debug = !1, e.cullFace = "back", e.colorMask = an;
|
|
4021
|
+
for (const t in this.kt) d.push(this.kt[t]);
|
|
4022
|
+
this.Ht.setMeshes(d);
|
|
4023
|
+
const m = this.ae();
|
|
4024
|
+
return f += this.Ct.render(this.ce, m, this.Ht, r && r.fbo), f;
|
|
4025
|
+
}
|
|
4026
|
+
se(t, e, n, r, s, i) {
|
|
4027
|
+
t.filter = n.filter(t => !!t), e.debug = !1, this.Gt.setMeshes(s), e.stencilEnable = !1,
|
|
4028
|
+
e.debug = !1, e.cullFace = "back", e.colorMask = an;
|
|
4017
4029
|
let o = 0;
|
|
4018
|
-
this.
|
|
4030
|
+
this.Gt.setMeshes(i), o += this.Ct.render(t, e, this.Gt, r && r.fbo), e.stencilEnable = !1;
|
|
4019
4031
|
const a = [];
|
|
4020
|
-
for (const t in this.
|
|
4021
|
-
return this.
|
|
4032
|
+
for (const t in this.jt) a.push(...this.jt[t]);
|
|
4033
|
+
return this.qt.setMeshes(a), o += this.Ct.render(t, e, this.qt, r && r.fbo), o;
|
|
4022
4034
|
}
|
|
4023
|
-
|
|
4024
|
-
return e.
|
|
4035
|
+
he(t, e) {
|
|
4036
|
+
return e.re.ue - t.re.ue;
|
|
4025
4037
|
}
|
|
4026
4038
|
paintRegion(t, e, n, r, s) {
|
|
4027
4039
|
const i = this.getMap();
|
|
4028
4040
|
if (!t.length && !e.length) return;
|
|
4029
4041
|
const o = i.projViewMatrix, a = [];
|
|
4030
4042
|
for (let n = 0, r = (t = t.concat(e)).length; n < r; n++) {
|
|
4031
|
-
const e = t[n].node, r = this.
|
|
4043
|
+
const e = t[n].node, r = this.fe(e);
|
|
4032
4044
|
r && (r.getBoundingBox && !c(o, r.getBoundingBox()) || a.push(r));
|
|
4033
4045
|
}
|
|
4034
|
-
this.
|
|
4035
|
-
const h = this.
|
|
4036
|
-
this.
|
|
4046
|
+
this.le.filter = r, this.$t.setMeshes(a);
|
|
4047
|
+
const h = this.de(n);
|
|
4048
|
+
this.Ct.render(this.le, h, this.$t, s && s.fbo);
|
|
4037
4049
|
}
|
|
4038
4050
|
deleteTile(t) {
|
|
4039
4051
|
const e = t.node.id;
|
|
4040
|
-
this.
|
|
4052
|
+
this.me(e);
|
|
4041
4053
|
}
|
|
4042
|
-
|
|
4043
|
-
const e = this.
|
|
4044
|
-
e && (e.geometry.dispose(), e.dispose(), delete this.
|
|
4045
|
-
let n = this.
|
|
4046
|
-
this.
|
|
4047
|
-
delete this.
|
|
4054
|
+
me(t) {
|
|
4055
|
+
const e = this.Ft[t];
|
|
4056
|
+
e && (e.geometry.dispose(), e.dispose(), delete this.Ft[t]);
|
|
4057
|
+
let n = this.Dt[t] || this.kt[t] || this.jt[t] || this.zt[t] || this.Rt[t];
|
|
4058
|
+
this.zt[t] ? this.ye(t) : n && (this.be(n), delete this.Dt[t], delete this.kt[t],
|
|
4059
|
+
delete this.jt[t], delete this.Rt[t]);
|
|
4048
4060
|
}
|
|
4049
|
-
|
|
4050
|
-
let e = this.
|
|
4061
|
+
ye(t) {
|
|
4062
|
+
let e = this.zt[t];
|
|
4051
4063
|
e = v(e);
|
|
4052
4064
|
for (let t = 0; t < e.length; t++) {
|
|
4053
4065
|
const {id: n} = e[t].properties;
|
|
4054
|
-
this.
|
|
4066
|
+
this.me(n);
|
|
4055
4067
|
}
|
|
4056
|
-
delete this.
|
|
4068
|
+
delete this.zt[t];
|
|
4057
4069
|
}
|
|
4058
|
-
|
|
4059
|
-
if (Array.isArray(t)) for (let e = 0, n = t.length; e < n; e++) this.
|
|
4070
|
+
be(t) {
|
|
4071
|
+
if (Array.isArray(t)) for (let e = 0, n = t.length; e < n; e++) this.be(t[e]); else {
|
|
4060
4072
|
const e = t.geometry.properties.url;
|
|
4061
4073
|
if (e) {
|
|
4062
|
-
const t = this.
|
|
4074
|
+
const t = this.Vt[e];
|
|
4063
4075
|
t && (t.refCount--, t.refCount <= 0 && (t.geometry.dispose(), t.material.dispose(),
|
|
4064
|
-
delete this.
|
|
4076
|
+
delete this.Vt[e]));
|
|
4065
4077
|
} else t.geometry.dispose(), t.material && t.material.dispose();
|
|
4066
4078
|
t.dispose();
|
|
4067
4079
|
}
|
|
4068
4080
|
}
|
|
4069
4081
|
remove() {
|
|
4070
|
-
const t = this.
|
|
4071
|
-
|
|
4072
|
-
for (const t in this.
|
|
4082
|
+
const t = this.Pt;
|
|
4083
|
+
Ze(t.getRenderer().canvas, t.getMap());
|
|
4084
|
+
for (const t in this.zt) this.ye(t);
|
|
4085
|
+
this.zt = {};
|
|
4086
|
+
for (const t in this.Dt) this.me(t);
|
|
4087
|
+
this.Dt = {};
|
|
4088
|
+
for (const t in this.kt) this.me(t);
|
|
4073
4089
|
this.kt = {};
|
|
4074
|
-
for (const t in this.
|
|
4090
|
+
for (const t in this.jt) this.me(t);
|
|
4091
|
+
this.jt = {};
|
|
4092
|
+
for (const t in this.Rt) this.me(t);
|
|
4075
4093
|
this.Rt = {};
|
|
4076
|
-
for (const t in this.Ft) this.
|
|
4077
|
-
this.Ft = {}
|
|
4078
|
-
|
|
4079
|
-
this.
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
for (const t in this.Lt) this.le(t);
|
|
4083
|
-
this.Lt = {}, this.re && (this.re.dispose(), delete this.re), this.se && (this.se.dispose(),
|
|
4084
|
-
delete this.se), this.oe && (this.oe.dispose(), delete this.oe), this.ue && (this.ue.dispose(),
|
|
4085
|
-
delete this.ue), this.Zt.dispose();
|
|
4086
|
-
}
|
|
4087
|
-
he(t) {
|
|
4094
|
+
for (const t in this.Ft) this.me(t);
|
|
4095
|
+
this.Ft = {}, this.ie && (this.ie.dispose(), delete this.ie), this.oe && (this.oe.dispose(),
|
|
4096
|
+
delete this.oe), this.ce && (this.ce.dispose(), delete this.ce), this.le && (this.le.dispose(),
|
|
4097
|
+
delete this.le), this.Yt.dispose();
|
|
4098
|
+
}
|
|
4099
|
+
fe(t) {
|
|
4088
4100
|
if (!t.boundingVolume || !t.boundingVolume.region) return null;
|
|
4089
|
-
if (this.
|
|
4101
|
+
if (this.Ft[t.id]) return this.Ft[t.id];
|
|
4090
4102
|
const e = t.boundingVolume.region;
|
|
4091
4103
|
let r = new s.Coordinate(p(e[0]), p(e[1])), i = new s.Coordinate(p(e[2]), p(e[3]));
|
|
4092
|
-
r = this.
|
|
4093
|
-
const o = r.add(i).
|
|
4104
|
+
r = this.pe(r), i = this.pe(i);
|
|
4105
|
+
const o = r.add(i).we(.5);
|
|
4094
4106
|
r._sub(o), i._sub(o);
|
|
4095
|
-
const a = this.
|
|
4107
|
+
const a = this._e(e[4], e[5]), c = a.x, h = a.y, u = [ r.x, r.y, h, i.x, r.y, h, i.x, i.y, h, r.x, i.y, h, r.x, r.y, c, i.x, r.y, c, i.x, i.y, c, r.x, i.y, c ], f = new n.reshader.Geometry({
|
|
4096
4108
|
aPosition: u
|
|
4097
4109
|
}, [ 0, 1, 1, 2, 2, 3, 3, 0, 0, 4, 1, 5, 2, 6, 3, 7, 4, 5, 5, 6, 6, 7, 7, 4 ], 0, {
|
|
4098
4110
|
primitive: "lines"
|
|
4099
4111
|
});
|
|
4100
|
-
f.generateBuffers(this.
|
|
4112
|
+
f.generateBuffers(this.Ut);
|
|
4101
4113
|
const l = new n.reshader.Mesh(f), d = n.mat4.identity([]);
|
|
4102
|
-
return l.setLocalTransform(n.mat4.translate(d, d, [ o.x, o.y, 0 ])), this.
|
|
4114
|
+
return l.setLocalTransform(n.mat4.translate(d, d, [ o.x, o.y, 0 ])), this.Ft[t.id] = l,
|
|
4103
4115
|
l;
|
|
4104
4116
|
}
|
|
4105
|
-
|
|
4106
|
-
return this.
|
|
4117
|
+
ee(t) {
|
|
4118
|
+
return this.Dt[t.id];
|
|
4107
4119
|
}
|
|
4108
4120
|
has(t) {
|
|
4109
|
-
return this.
|
|
4121
|
+
return this.ee(t) || this.kt[t.id] || this.jt[t.id] || this.zt[t.id] || this.Rt[t.id];
|
|
4110
4122
|
}
|
|
4111
4123
|
createPntsMesh(t, e, r, s) {
|
|
4112
|
-
if (this.
|
|
4113
|
-
const t = this.
|
|
4124
|
+
if (this.kt[e]) {
|
|
4125
|
+
const t = this.kt[e];
|
|
4114
4126
|
return console.warn(`pnts mesh with id(${e}) was already created.`), s(null, {
|
|
4115
4127
|
id: e,
|
|
4116
4128
|
mesh: t
|
|
@@ -4120,15 +4132,15 @@
|
|
|
4120
4132
|
primitive: "points",
|
|
4121
4133
|
positionAttribute: "POSITION"
|
|
4122
4134
|
});
|
|
4123
|
-
h.generateBuffers(this.
|
|
4135
|
+
h.generateBuffers(this.Ut);
|
|
4124
4136
|
const u = {};
|
|
4125
4137
|
i.POSITION ? u.HAS_POSITION = 1 : i.POSITION_QUANTIZED && (u.HAS_POSITION_QUANTIZED = 1),
|
|
4126
4138
|
i.RGB ? u.HAS_RGB = 1 : i.RGBA ? u.HAS_RGBA = 1 : i.RGB565 && (u.HAS_RGB565 = 1),
|
|
4127
4139
|
(i.NORMAL || i.NORMAL_OCT16P) && (u.HAS_NORMAL = 1, i.NORMAL_OCT16P && (u.HAS_NORMAL_OCT16P = 1)),
|
|
4128
4140
|
t.featureTable.CONSTANT_RGBA && (t.featureTable.CONSTANT_RGBA = t.featureTable.CONSTANT_RGBA.map(t => t / 255));
|
|
4129
|
-
const {rtcCenter: f, rtcCoord: l} = t, d = this.
|
|
4141
|
+
const {rtcCenter: f, rtcCoord: l} = t, d = this.ge(l), m = this.Te(r, f, l);
|
|
4130
4142
|
n.mat4.multiply(m, m, d);
|
|
4131
|
-
const y = this.
|
|
4143
|
+
const y = this.Pt.options.services[a], b = new n.reshader.Mesh(h);
|
|
4132
4144
|
return b.properties.magic = "pnts", b.properties.id = e, b.properties.count = c,
|
|
4133
4145
|
b.properties.batchTable = t.batchTable, b.properties.batchTableBin = t.batchTableBin,
|
|
4134
4146
|
b.setDefines(u), Object.defineProperty(b.uniforms, "pointColor", {
|
|
@@ -4146,24 +4158,24 @@
|
|
|
4146
4158
|
get: function() {
|
|
4147
4159
|
return y && y.pointOpacity || 1;
|
|
4148
4160
|
}
|
|
4149
|
-
}), b.setLocalTransform(m), this.
|
|
4161
|
+
}), b.setLocalTransform(m), this.kt[e] = b, s(null, {
|
|
4150
4162
|
id: e,
|
|
4151
4163
|
mesh: [ b ]
|
|
4152
4164
|
}), [ b ];
|
|
4153
4165
|
}
|
|
4154
4166
|
createI3DMMesh(t, e, r, s) {
|
|
4155
|
-
if (this.
|
|
4156
|
-
const t = this.
|
|
4157
|
-
return console.warn(`i3dm mesh with id(${e}) was already created.`), this.
|
|
4167
|
+
if (this.jt[e]) {
|
|
4168
|
+
const t = this.jt[e];
|
|
4169
|
+
return console.warn(`i3dm mesh with id(${e}) was already created.`), this.Rt[e] || s(null, {
|
|
4158
4170
|
id: e,
|
|
4159
4171
|
mesh: t
|
|
4160
4172
|
}), t;
|
|
4161
4173
|
}
|
|
4162
|
-
const i = this.
|
|
4174
|
+
const i = this.Ae(r.ve), {i3dm: o, featureTable: a, gltf: c, batchTable: h, batchTableBin: u, count: f} = t, l = a.INSTANCES_LENGTH, {rtcCenter: d, rtcCoord: m} = t, y = this.ge(m), b = this.Te(r, d, m), {POSITION: p, NORMAL_UP: w, NORMAL_RIGHT: _, SCALE: g, SCALE_NON_UNIFORM: T, INSTANCE_ROTATION: v} = o, O = {
|
|
4163
4175
|
"instance_vectorA": new Float32Array(4 * l),
|
|
4164
4176
|
"instance_vectorB": new Float32Array(4 * l),
|
|
4165
4177
|
"instance_vectorC": new Float32Array(4 * l)
|
|
4166
|
-
}, M = new Float32Array(3), S = new Float32Array(3), x = [], I = new Float32Array(1), N = new Float32Array(3),
|
|
4178
|
+
}, M = new Float32Array(3), S = new Float32Array(3), x = [], I = new Float32Array(1), N = new Float32Array(3), E = [], P = [], L = [], B = [], U = new Float32Array(9);
|
|
4167
4179
|
!function(t, e) {
|
|
4168
4180
|
let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
|
|
4169
4181
|
const a = t.array.buffer, c = n ? It.getTypedArrayCtor(n) : t.array.constructor;
|
|
@@ -4183,48 +4195,48 @@
|
|
|
4183
4195
|
e(new c(h.buffer), t), n.set(h);
|
|
4184
4196
|
}
|
|
4185
4197
|
}(p, (t, e) => {
|
|
4186
|
-
w ? (jt(S,
|
|
4187
|
-
A(
|
|
4188
|
-
|
|
4189
|
-
n.mat4.fromRotationTranslationScale(
|
|
4190
|
-
zt(O.instance_vectorB, e,
|
|
4198
|
+
w ? (jt(S, _, e), jt(M, w, e), n.vec3.cross(x, S, M), n.vec3.normalize(x, x), A(E, S, 0),
|
|
4199
|
+
A(E, M, 1), A(E, x, 2), n.quat.fromMat3(P, E)) : v ? (jt(U, v, e), n.quat.fromMat3(P, U)) : n.quat.identity(P),
|
|
4200
|
+
g ? (jt(I, g, e), n.vec3.set(L, I[0], I[0], I[0])) : T ? (jt(N, T, e), n.vec3.set(L, ...N)) : n.vec3.set(L, 1, 1, 1),
|
|
4201
|
+
n.mat4.fromRotationTranslationScale(B, P, t, L), zt(O.instance_vectorA, e, B, 0),
|
|
4202
|
+
zt(O.instance_vectorB, e, B, 1), zt(O.instance_vectorC, e, B, 2);
|
|
4191
4203
|
});
|
|
4192
|
-
const
|
|
4193
|
-
for (const t in O)
|
|
4194
|
-
buffer: this.
|
|
4204
|
+
const C = {};
|
|
4205
|
+
for (const t in O) C[t] = {
|
|
4206
|
+
buffer: this.Ut.buffer({
|
|
4195
4207
|
dimension: O[t].length / l,
|
|
4196
4208
|
data: O[t]
|
|
4197
4209
|
}),
|
|
4198
4210
|
divisor: 1
|
|
4199
4211
|
};
|
|
4200
|
-
const R = this.
|
|
4212
|
+
const R = this.Pt.options.services[r.ne].shader || "phong";
|
|
4201
4213
|
let F = 0, D = !0;
|
|
4202
4214
|
const k = [];
|
|
4203
4215
|
return Dt(c, (t, s, o, a) => {
|
|
4204
|
-
let {geometry: c, material: d} = this.
|
|
4216
|
+
let {geometry: c, material: d} = this.Oe(t, s, o, a, r, !0, R);
|
|
4205
4217
|
d && !d.isReady() && (D = !1, F++);
|
|
4206
|
-
const m = new n.reshader.InstancedMesh(
|
|
4218
|
+
const m = new n.reshader.InstancedMesh(C, l, c, d);
|
|
4207
4219
|
m.properties.magic = "i3dm", m.properties.id = e, m.properties.count = f, m.properties.batchTable = h,
|
|
4208
4220
|
m.properties.batchTableBin = u;
|
|
4209
|
-
const p = this.
|
|
4221
|
+
const p = this.Me(t, c, d, r.ne), w = n.mat4.identity([]);
|
|
4210
4222
|
if (t.matrices && t.matrices.length) for (let e = 0; e < t.matrices.length; e++) n.mat4.multiply(w, w, t.matrices[e]);
|
|
4211
4223
|
n.mat4.multiply(w, i, w), m.setPositionMatrix(w), n.mat4.multiply(y, b, y), m.setLocalTransform(y),
|
|
4212
4224
|
m.setDefines(p), m.properties.polygonOffset = {
|
|
4213
4225
|
offset: 0,
|
|
4214
4226
|
factor: 0
|
|
4215
4227
|
}, k.push(m);
|
|
4216
|
-
}), D ? (this.
|
|
4228
|
+
}), D ? (this.jt[e] = k, s(null, {
|
|
4217
4229
|
id: e,
|
|
4218
4230
|
mesh: k
|
|
4219
|
-
})) : (this.
|
|
4231
|
+
})) : (this.Rt[e] = {
|
|
4220
4232
|
meshes: k,
|
|
4221
4233
|
count: F
|
|
4222
|
-
}, k.
|
|
4234
|
+
}, k.Se = s), k;
|
|
4223
4235
|
}
|
|
4224
4236
|
createB3DMMesh(t, e, r, i) {
|
|
4225
|
-
if (this.
|
|
4226
|
-
const t = this.
|
|
4227
|
-
return console.warn(`mesh with id(${e}) was already created.`), this.
|
|
4237
|
+
if (this.Dt[e] || this.Rt[e]) {
|
|
4238
|
+
const t = this.Dt[e];
|
|
4239
|
+
return console.warn(`mesh with id(${e}) was already created.`), this.Rt[e] || i(null, {
|
|
4228
4240
|
id: e,
|
|
4229
4241
|
mesh: t
|
|
4230
4242
|
}), t;
|
|
@@ -4234,132 +4246,131 @@
|
|
|
4234
4246
|
const t = new s.Extent(r.maxExtent).convertTo(t => this._pointToPrj(t));
|
|
4235
4247
|
o = [ t.xmin, t.ymin, t.xmax, t.ymax ];
|
|
4236
4248
|
}
|
|
4237
|
-
const a = this.
|
|
4249
|
+
const a = this.Ae(r.ve), c = t.gltf, {center: h, coord: u} = c.extensions.CESIUM_RTC, f = this.Pt.options.services[r.ne].heightOffset || 0;
|
|
4238
4250
|
f && (u[2] += f);
|
|
4239
|
-
const l = this.
|
|
4251
|
+
const l = this.ge(u, r.ne), d = this.Pt.options.services[r.ne].shader || "phong", m = [];
|
|
4240
4252
|
let y = 0, b = !0;
|
|
4241
4253
|
return Dt(c, (s, i, c, f) => {
|
|
4242
|
-
let {geometry: p, material: w} = this.
|
|
4254
|
+
let {geometry: p, material: w} = this.Oe(s, i, c, f, r, !1, d);
|
|
4243
4255
|
w && !w.isReady() && (b = !1, y++);
|
|
4244
|
-
const
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
const
|
|
4248
|
-
|
|
4256
|
+
const _ = new n.reshader.Mesh(p, w);
|
|
4257
|
+
_.properties.magic = "b3dm", _.properties.id = e, _.properties.batchTable = t.batchTable,
|
|
4258
|
+
_.properties.batchTableBin = t.batchTableBin, _.properties.count = t.featureTable.BATCH_LENGTH;
|
|
4259
|
+
const g = this.Me(s, p, w, r.ne);
|
|
4260
|
+
_.setDefines(g), o && (g.USE_MAX_EXTENT = 1, _.setUniform("maxPrjExtent", o));
|
|
4249
4261
|
let T = n.mat4.identity([]);
|
|
4250
4262
|
if (s.matrices && s.matrices.length) for (let t = 0; t < s.matrices.length; t++) n.mat4.multiply(T, T, s.matrices[t]);
|
|
4251
|
-
const A = this.
|
|
4252
|
-
n.mat4.multiply(T, a, T), n.mat4.multiply(T, l, T), n.mat4.multiply(T, A, T),
|
|
4253
|
-
m.push(
|
|
4254
|
-
}), b ? (this.
|
|
4263
|
+
const A = this.Te(r, h, u);
|
|
4264
|
+
n.mat4.multiply(T, a, T), n.mat4.multiply(T, l, T), n.mat4.multiply(T, A, T), _.setLocalTransform(T),
|
|
4265
|
+
m.push(_);
|
|
4266
|
+
}), b ? (this.Dt[e] = m, i(null, {
|
|
4255
4267
|
id: e,
|
|
4256
4268
|
mesh: m
|
|
4257
|
-
})) : (this.
|
|
4269
|
+
})) : (this.Rt[e] = {
|
|
4258
4270
|
meshes: m,
|
|
4259
4271
|
count: y
|
|
4260
|
-
}, m.
|
|
4272
|
+
}, m.Se = i), m;
|
|
4261
4273
|
}
|
|
4262
|
-
|
|
4263
|
-
const i = this.getMap(), o = this.
|
|
4274
|
+
Te(t, e, r) {
|
|
4275
|
+
const i = this.getMap(), o = this.Pt.options.services[t.ne].heightOffset || 0, a = new s.Coordinate(r), c = i.distanceToPointAtRes(100, 0, i.getGLRes(), a).x / 100;
|
|
4264
4276
|
let h = t.matrix ? n.mat4.copy([], t.matrix) : n.mat4.identity([]);
|
|
4265
4277
|
if (e) {
|
|
4266
4278
|
Oe(h, n.vec3.transformMat4(cn, e, h), h);
|
|
4267
4279
|
}
|
|
4268
4280
|
const u = function(t, e, n, r, s, i, o) {
|
|
4269
|
-
e =
|
|
4270
|
-
const a = qt(
|
|
4281
|
+
e = B(Pe, e);
|
|
4282
|
+
const a = qt(Pe, e[0] * je, e[1] * je, e[2]), c = function(t, e) {
|
|
4271
4283
|
return t[0] = e[12], t[1] = e[13], t[2] = e[14], t;
|
|
4272
|
-
}(
|
|
4284
|
+
}(Le, n), h = r.ellipsoid;
|
|
4273
4285
|
var u;
|
|
4274
|
-
u = 0 === G(c) ?
|
|
4286
|
+
u = 0 === G(c) ? U(Be, 0, 0, -6378137) : Zt(Be, c), De.x = u[0], De.y = u[1];
|
|
4275
4287
|
const f = r.project(De, ke);
|
|
4276
|
-
|
|
4277
|
-
const l = Me(a, h,
|
|
4278
|
-
var r = t[0], s = t[1], i = t[2], o = t[4], a = t[5], c = t[6], h = t[8], u = t[9], f = t[10], l = e[0], d = e[1], m = e[2], y = e[3], b = e[4], p = e[5], w = e[6],
|
|
4288
|
+
Ue[0] = f.x / s, Ue[1] = f.y / s, Ue[2] = (u[2] + o) * i;
|
|
4289
|
+
const l = Me(a, h, Ce), d = function(t, e, n) {
|
|
4290
|
+
var r = t[0], s = t[1], i = t[2], o = t[4], a = t[5], c = t[6], h = t[8], u = t[9], f = t[10], l = e[0], d = e[1], m = e[2], y = e[3], b = e[4], p = e[5], w = e[6], _ = e[7], g = e[8], T = r * l + o * d + h * m, A = s * l + a * d + u * m, v = i * l + c * d + f * m, O = r * y + o * b + h * p, M = s * y + a * b + u * p, S = i * y + c * b + f * p, x = r * w + o * _ + h * g, I = s * w + a * _ + u * g, N = i * w + c * _ + f * g;
|
|
4279
4291
|
return n[0] = T, n[1] = A, n[2] = v, n[3] = 0, n[4] = O, n[5] = M, n[6] = S, n[7] = 0,
|
|
4280
4292
|
n[8] = x, n[9] = I, n[10] = N, n[11] = 0, n[12] = t[12], n[13] = t[13], n[14] = t[14],
|
|
4281
4293
|
n[15] = t[15], n;
|
|
4282
4294
|
}(function(t, e) {
|
|
4283
|
-
var n = e[0], r = e[1], s = e[2], i = e[3], o = e[4], a = e[5], c = e[6], h = e[7], u = e[8], f = e[9], l = e[10], d = e[11], m = e[12], y = e[13], b = e[14], p = e[15], w = n * a - r * o,
|
|
4284
|
-
return
|
|
4285
|
-
t[2] = (y * v - b * A + p * T) *
|
|
4286
|
-
t[5] = (n * N - s * S + i * M) *
|
|
4287
|
-
t[8] = (o * I - a * S + h * O) *
|
|
4288
|
-
t[11] = (f *
|
|
4289
|
-
t[14] = (y *
|
|
4295
|
+
var n = e[0], r = e[1], s = e[2], i = e[3], o = e[4], a = e[5], c = e[6], h = e[7], u = e[8], f = e[9], l = e[10], d = e[11], m = e[12], y = e[13], b = e[14], p = e[15], w = n * a - r * o, _ = n * c - s * o, g = n * h - i * o, T = r * c - s * a, A = r * h - i * a, v = s * h - i * c, O = u * y - f * m, M = u * b - l * m, S = u * p - d * m, x = f * b - l * y, I = f * p - d * y, N = l * p - d * b, E = w * N - _ * I + g * x + T * S - A * M + v * O;
|
|
4296
|
+
return E ? (E = 1 / E, t[0] = (a * N - c * I + h * x) * E, t[1] = (s * I - r * N - i * x) * E,
|
|
4297
|
+
t[2] = (y * v - b * A + p * T) * E, t[3] = (l * A - f * v - d * T) * E, t[4] = (c * S - o * N - h * M) * E,
|
|
4298
|
+
t[5] = (n * N - s * S + i * M) * E, t[6] = (b * g - m * v - p * _) * E, t[7] = (u * v - l * g + d * _) * E,
|
|
4299
|
+
t[8] = (o * I - a * S + h * O) * E, t[9] = (r * S - n * I - i * O) * E, t[10] = (m * A - y * g + p * w) * E,
|
|
4300
|
+
t[11] = (f * g - u * A - d * w) * E, t[12] = (a * M - o * x - c * O) * E, t[13] = (n * x - r * M + s * O) * E,
|
|
4301
|
+
t[14] = (y * _ - m * T - b * w) * E, t[15] = (u * T - f * _ + l * w) * E, t) : null;
|
|
4290
4302
|
}(Re, l), function(t, e) {
|
|
4291
4303
|
return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[4], t[4] = e[5], t[5] = e[6],
|
|
4292
4304
|
t[6] = e[8], t[7] = e[9], t[8] = e[10], t;
|
|
4293
4305
|
}(Fe, n), t);
|
|
4294
|
-
return Oe(t,
|
|
4306
|
+
return Oe(t, Ue, d), t;
|
|
4295
4307
|
}(h, r, h, i.getProjection(), i.getGLRes(), c, o), f = function(t, e) {
|
|
4296
|
-
return
|
|
4308
|
+
return U(t, e[12], e[13], e[14]), t;
|
|
4297
4309
|
}(fn, u);
|
|
4298
|
-
let l = this.
|
|
4310
|
+
let l = this.Pt.options.offset;
|
|
4299
4311
|
if (y(l)) {
|
|
4300
|
-
l = l(this.
|
|
4312
|
+
l = l(this.Pt.xe(t.id).center);
|
|
4301
4313
|
}
|
|
4302
4314
|
return n.vec3.set(un, l[0], l[1], 0), n.vec3.sub(f, f, un), Oe(u, f, u), u;
|
|
4303
4315
|
}
|
|
4304
|
-
createCMPTMesh(t, e,
|
|
4305
|
-
if (this.
|
|
4306
|
-
const t = this.
|
|
4307
|
-
return console.warn(`mesh with id(${e}) was already created.`),
|
|
4316
|
+
createCMPTMesh(t, e, n, r) {
|
|
4317
|
+
if (this.zt[e]) {
|
|
4318
|
+
const t = this.zt[e];
|
|
4319
|
+
return console.warn(`mesh with id(${e}) was already created.`), r(null, {
|
|
4308
4320
|
id: e,
|
|
4309
4321
|
mesh: t
|
|
4310
4322
|
}), t;
|
|
4311
4323
|
}
|
|
4312
|
-
const {content:
|
|
4313
|
-
let
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
e.boundingBox || (a = null), this.Se(a, e), o.push(e);
|
|
4324
|
+
const {content: s} = t, i = [];
|
|
4325
|
+
for (let t = 0; t < s.length; t++) {
|
|
4326
|
+
const {magic: r} = s[t], o = e + "." + t;
|
|
4327
|
+
"b3dm" === r ? this.createB3DMMesh(s[t], o, n, (t, {mesh: e}) => {
|
|
4328
|
+
i.push(e);
|
|
4329
|
+
}) : "i3dm" === r ? this.createI3DMMesh(s[t], o, n, (t, {mesh: e}) => {
|
|
4330
|
+
i.push(e);
|
|
4331
|
+
}) : "pnts" === r ? this.createPntsMesh(s[t], o, n, (t, {mesh: e}) => {
|
|
4332
|
+
i.push(e);
|
|
4333
|
+
}) : "cmpt" === r && this.createCMPTMesh(s[t], o, n, (t, {mesh: e}) => {
|
|
4334
|
+
i.push(e);
|
|
4324
4335
|
});
|
|
4325
4336
|
}
|
|
4326
|
-
return
|
|
4337
|
+
return this.zt[e] = i, r(null, {
|
|
4327
4338
|
id: e,
|
|
4328
|
-
mesh:
|
|
4329
|
-
}),
|
|
4330
|
-
}
|
|
4331
|
-
Se(t, e) {
|
|
4332
|
-
if (!t) return null;
|
|
4333
|
-
if (e.boundingBox) t.combine(e.boundingBox); else for (let n = 0; n < e.length; n++) e[n] && t.combine(e[n].getBoundingBox());
|
|
4339
|
+
mesh: i
|
|
4340
|
+
}), i;
|
|
4334
4341
|
}
|
|
4335
|
-
|
|
4336
|
-
return ("phong" === (this.
|
|
4342
|
+
Me(t, e, n, r) {
|
|
4343
|
+
return ("phong" === (this.Pt.options.services[r].shader || "phong") ? this.ie : this.oe).getGeometryDefines(e);
|
|
4337
4344
|
}
|
|
4338
|
-
|
|
4345
|
+
Oe(t, e, n, r, s, i, o) {
|
|
4339
4346
|
const a = r.url + "-" + e + "-" + n;
|
|
4340
|
-
if (this.
|
|
4347
|
+
if (this.Vt[a]) return this.Vt[a].refCount++, this.Vt[a];
|
|
4341
4348
|
let c, h;
|
|
4342
4349
|
const u = r.materials[t.material];
|
|
4343
4350
|
if (r.extensions && r.extensions.KHR_techniques_webgl && u.extensions && u.extensions.KHR_techniques_webgl) {
|
|
4344
|
-
const e = this.
|
|
4351
|
+
const e = this.Ie(t, r, i);
|
|
4345
4352
|
c = e.material, h = e.geometry;
|
|
4346
|
-
} else
|
|
4347
|
-
|
|
4353
|
+
} else {
|
|
4354
|
+
h = this.Ne(t, i, ln);
|
|
4355
|
+
const e = this.Pt.options.services[s.ne].material;
|
|
4356
|
+
c = this.Ee(t.material, r, o, e || en);
|
|
4357
|
+
}
|
|
4358
|
+
c && !c.isReady() ? c.Pe = s.id : c || (c = this.Wt);
|
|
4348
4359
|
const f = {
|
|
4349
4360
|
refCount: 1,
|
|
4350
4361
|
geometry: h,
|
|
4351
4362
|
material: c
|
|
4352
4363
|
};
|
|
4353
|
-
return h.properties.url = a, this.
|
|
4364
|
+
return h.properties.url = a, this.Vt[a] = f, f;
|
|
4354
4365
|
}
|
|
4355
|
-
|
|
4356
|
-
const {geometry: r, material: s} = this.
|
|
4366
|
+
Ie(t, e, n) {
|
|
4367
|
+
const {geometry: r, material: s} = this.Yt.createMesh(t, e, n);
|
|
4357
4368
|
return {
|
|
4358
4369
|
geometry: r,
|
|
4359
4370
|
material: s
|
|
4360
4371
|
};
|
|
4361
4372
|
}
|
|
4362
|
-
|
|
4373
|
+
Ne(t, e, r) {
|
|
4363
4374
|
const s = t.attributes, i = r.COLOR_0;
|
|
4364
4375
|
if (s[i] && s[i] instanceof Float32Array) {
|
|
4365
4376
|
const t = new Uint8Array(s[i].length);
|
|
@@ -4368,7 +4379,7 @@
|
|
|
4368
4379
|
}
|
|
4369
4380
|
const o = {};
|
|
4370
4381
|
for (const t in s) {
|
|
4371
|
-
const e = Je(this.
|
|
4382
|
+
const e = Je(this.Ut, s[t], {
|
|
4372
4383
|
dimension: s[t].itemSize
|
|
4373
4384
|
}), n = r[t] || t;
|
|
4374
4385
|
o[n] = {
|
|
@@ -4385,25 +4396,25 @@
|
|
|
4385
4396
|
tangentAttribute: r.TANGENT,
|
|
4386
4397
|
primitive: void 0 === t.mode ? "triangles" : $e(t.mode)
|
|
4387
4398
|
});
|
|
4388
|
-
return a.generateBuffers(this.
|
|
4399
|
+
return a.generateBuffers(this.Ut, {
|
|
4389
4400
|
excludeElementsInVAO: e
|
|
4390
4401
|
}), a;
|
|
4391
4402
|
}
|
|
4392
|
-
|
|
4393
|
-
const e = n.mat4.identity([]), r = this.getMap(), s = this.
|
|
4403
|
+
ge(t) {
|
|
4404
|
+
const e = n.mat4.identity([]), r = this.getMap(), s = this.Le();
|
|
4394
4405
|
hn.x = t[0], hn.y = t[1];
|
|
4395
4406
|
const i = r.distanceToPointAtRes(100, 100, r.getGLRes(), hn);
|
|
4396
4407
|
return n.vec3.set(s, i.x / 100 * 1.01, i.y / 100 * 1.01, i.y / 100), n.mat4.scale(e, e, s),
|
|
4397
4408
|
e;
|
|
4398
4409
|
}
|
|
4399
|
-
|
|
4410
|
+
Zt() {
|
|
4400
4411
|
const t = {
|
|
4401
4412
|
x: 0,
|
|
4402
4413
|
y: 0,
|
|
4403
|
-
width: () => this.
|
|
4404
|
-
height: () => this.
|
|
4414
|
+
width: () => this.Lt ? this.Lt.width : 1,
|
|
4415
|
+
height: () => this.Lt ? this.Lt.height : 1
|
|
4405
4416
|
};
|
|
4406
|
-
this.
|
|
4417
|
+
this.le = new n.reshader.MeshShader({
|
|
4407
4418
|
vert: "attribute vec3 aPosition;\n\nuniform mat4 projViewModelMatrix;\n\nvoid main() {\n gl_Position = projViewModelMatrix * vec4(aPosition, 1.0);\n}\n",
|
|
4408
4419
|
frag: "precision mediump float;\nuniform vec3 color;\nvoid main() {\n gl_FragColor = vec4(color, 1.0);\n}\n",
|
|
4409
4420
|
uniforms: [ "color", {
|
|
@@ -4416,7 +4427,7 @@
|
|
|
4416
4427
|
}
|
|
4417
4428
|
});
|
|
4418
4429
|
const e = [], r = [];
|
|
4419
|
-
this.
|
|
4430
|
+
this.ce = new n.reshader.MeshShader({
|
|
4420
4431
|
vert: "const float SHIFT_RIGHT_11 = 1.0 / 2048.0;\nconst float SHIFT_RIGHT_5 = 1.0 / 32.0;\nconst float SHIFT_LEFT_11 = 2048.0;\nconst float SHIFT_LEFT_5 = 32.0;\nconst float NORMALIZE_6 = 1.0 / 64.0;\nconst float NORMALIZE_5 = 1.0 / 32.0;\n\n#ifdef HAS_POSITION\n attribute vec3 POSITION;\n#endif\n\n#if defined(HAS_RGB)\n attribute vec3 RGB;\n#elif defined(HAS_RGBA)\n attribute vec4 RGBA;\n#elif defined(HAS_RGB565)\n attribute float RGB565;\n#endif\n\nuniform vec4 pointColor;\nuniform float pointSize;\n\nuniform mat4 projViewModelMatrix;\nuniform float pointOpacity;\n\nvarying vec4 vColor;\n\n#ifdef HAS_NORMAL\n #ifdef HAS_NORMAL_OCT16P\n attribute vec2 NORMAL_OCT16P;\n float signNotZero(float value) {\n return value >= 0.0 ? 1.0 : -1.0;\n }\n vec2 signNotZero(vec2 value) {\n return vec2(signNotZero(value.x), signNotZero(value.y));\n }\n vec3 octDecode(vec2 encoded, float range) {\n if (encoded.x == 0.0 && encoded.y == 0.0) {\n return vec3(0.0, 0.0, 0.0);\n }\n encoded = encoded / range * 2.0 - 1.0;\n vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\n if (v.z < 0.0) {\n v.xy = (1.0 - abs(v.yx)) * signNotZero(v.xy);\n }\n return normalize(v);\n }\n vec3 octDecode(vec2 encoded) {\n return octDecode(encoded, 255.0);\n }\n #else\n attribute vec3 NORMAL;\n #endif\n uniform vec3 lightDir;\n uniform mat3 modelNormalMatrix;\n uniform mat4 positionMatrix;\n float getLambertDiffuse(vec3 lightDir, vec3 normal) {\n return max(dot(-lightDir, normal), 0.0);\n }\n#endif\n\nvoid main() {\n #if defined(HAS_RGB)\n vColor = vec4(RGB / 255.0, 1.0) * pointOpacity;\n #elif defined(HAS_RGBA)\n vColor = RGBA / 255.0 * pointOpacity;\n #elif defined(HAS_RGB565)\n // from Cesium PointCloud.js\n // MIT License\n float compressed = RGB565;\n float r = floor(compressed * SHIFT_RIGHT_11);\n compressed -= r * SHIFT_LEFT_11;\n float g = floor(compressed * SHIFT_RIGHT_5);\n compressed -= g * SHIFT_LEFT_5;\n float b = compressed;\n vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5);\n vColor = vec4(rgb, 1.0);\n #else\n vColor = pointColor;\n #endif\n\n #ifdef HAS_POSITION\n vec3 localPos = POSITION;\n #endif\n\n #ifdef HAS_NORMAL\n mat3 positionNormalMatrix = mat3(positionMatrix);\n mat3 normalMatrix = modelNormalMatrix * positionNormalMatrix;\n #ifdef HAS_NORMAL_OCT16P\n vec3 localNormal = octDecode(NORMAL_OCT16P);\n #else\n vec3 localNormal = NORMAL;\n #endif\n vec3 normal = normalize(normalMatrix * localNormal);\n float colorStrength = getLambertDiffuse(lightDir, normal);\n colorStrength = max(colorStrength, 0.5);\n vColor *= colorStrength;\n #endif\n\n gl_Position = projViewModelMatrix * vec4(localPos, 1.0);\n gl_PointSize = pointSize;\n}\n",
|
|
4421
4432
|
frag: "#define SHADER_NAME PNTS\nprecision mediump float;\n\nvarying vec4 vColor;\n\nvoid main() {\n gl_FragColor = vColor;\n}\n",
|
|
4422
4433
|
uniforms: [ {
|
|
@@ -4445,22 +4456,22 @@
|
|
|
4445
4456
|
}
|
|
4446
4457
|
}
|
|
4447
4458
|
});
|
|
4448
|
-
const s = this.
|
|
4449
|
-
this.
|
|
4459
|
+
const s = this.Qt();
|
|
4460
|
+
this.ie = new n.reshader.PhongShader({
|
|
4450
4461
|
extraCommandProps: s
|
|
4451
|
-
}), this.
|
|
4462
|
+
}), this.oe = new n.reshader.pbr.StandardShader({
|
|
4452
4463
|
extraCommandProps: s
|
|
4453
4464
|
});
|
|
4454
|
-
const i = this.
|
|
4455
|
-
|
|
4465
|
+
const i = this.Pt;
|
|
4466
|
+
We(i.getRenderer().canvas, this.Ut, i.getMap());
|
|
4456
4467
|
}
|
|
4457
|
-
|
|
4468
|
+
Qt() {
|
|
4458
4469
|
return {
|
|
4459
4470
|
viewport: {
|
|
4460
4471
|
x: 0,
|
|
4461
4472
|
y: 0,
|
|
4462
|
-
width: () => this.
|
|
4463
|
-
height: () => this.
|
|
4473
|
+
width: () => this.Lt ? this.Lt.width : 1,
|
|
4474
|
+
height: () => this.Lt ? this.Lt.height : 1
|
|
4464
4475
|
},
|
|
4465
4476
|
colorMask: (t, e) => e.colorMask || an,
|
|
4466
4477
|
cull: {
|
|
@@ -4498,13 +4509,13 @@
|
|
|
4498
4509
|
}
|
|
4499
4510
|
};
|
|
4500
4511
|
}
|
|
4501
|
-
|
|
4512
|
+
de(t) {
|
|
4502
4513
|
return {
|
|
4503
4514
|
projViewMatrix: this.getMap().projViewMatrix,
|
|
4504
4515
|
color: t && t.color || [ 0, 1, 0 ]
|
|
4505
4516
|
};
|
|
4506
4517
|
}
|
|
4507
|
-
|
|
4518
|
+
ae(t) {
|
|
4508
4519
|
const e = this.getMap(), r = e.getLightManager(), s = (r && r.getDirectionalLight() || {}).direction || [ 1, 1, -1 ], i = t && t.pointOpacity || 1;
|
|
4509
4520
|
return {
|
|
4510
4521
|
projViewMatrix: e.projViewMatrix,
|
|
@@ -4512,8 +4523,8 @@
|
|
|
4512
4523
|
lightDir: n.vec3.normalize(s, s)
|
|
4513
4524
|
};
|
|
4514
4525
|
}
|
|
4515
|
-
|
|
4516
|
-
const t = this.getMap(), e = this.
|
|
4526
|
+
te() {
|
|
4527
|
+
const t = this.getMap(), e = this.Pt.getRenderer().canvas, {iblTexes: n, dfgLUT: r} = Ye(e), s = Qe(t, n, r);
|
|
4517
4528
|
return m(s, {
|
|
4518
4529
|
lightSpecular: [ 1, 1, 1 ],
|
|
4519
4530
|
viewMatrix: t.viewMatrix,
|
|
@@ -4524,46 +4535,45 @@
|
|
|
4524
4535
|
polygonOpacity: 1
|
|
4525
4536
|
}), s;
|
|
4526
4537
|
}
|
|
4527
|
-
|
|
4528
|
-
const
|
|
4529
|
-
if (!
|
|
4530
|
-
|
|
4531
|
-
if (
|
|
4532
|
-
const t = e.textures[
|
|
4538
|
+
Ee(t, e, r, s) {
|
|
4539
|
+
const i = e.materials[t];
|
|
4540
|
+
if (!i || !i.baseColorTexture && !i.pbrMetallicRoughness) return null;
|
|
4541
|
+
const o = m({}, s);
|
|
4542
|
+
if (i.baseColorTexture) {
|
|
4543
|
+
const t = e.textures[i.baseColorTexture.index];
|
|
4533
4544
|
let n;
|
|
4534
|
-
t && !t.image.color && (n = this.T(t,
|
|
4535
|
-
|
|
4536
|
-
}, n && (i.baseColorTexture = n);
|
|
4545
|
+
t && !t.image.color && (n = this.T(t, i)), o.baseColorFactor = t && t.image.color || i.baseColorFactor || [ 1, 1, 1, 1 ],
|
|
4546
|
+
n && (o.baseColorTexture = n);
|
|
4537
4547
|
} else {
|
|
4538
|
-
if (i
|
|
4539
|
-
const t = this.T(e.textures[
|
|
4540
|
-
|
|
4548
|
+
if (i.normalTexture) {
|
|
4549
|
+
const t = this.T(e.textures[i.normalTexture.index]), n = i.normalTexture.scale || 1;
|
|
4550
|
+
o.normalTexture = t, o.normalMapFactor = n;
|
|
4541
4551
|
}
|
|
4542
|
-
if (
|
|
4543
|
-
const t = this.T(e.textures[
|
|
4544
|
-
|
|
4552
|
+
if (i.occlusionTexture) {
|
|
4553
|
+
const t = this.T(e.textures[i.occlusionTexture.index]), n = i.occlusionTexture.strength || 1;
|
|
4554
|
+
o.occlusionTexture = t, o.occlusionFactor = n;
|
|
4545
4555
|
}
|
|
4546
|
-
if (
|
|
4547
|
-
const t = this.T(e.textures[
|
|
4548
|
-
|
|
4556
|
+
if (i.emissiveTexture) {
|
|
4557
|
+
const t = this.T(e.textures[i.emissiveTexture.index]);
|
|
4558
|
+
o.emissiveTexture = t;
|
|
4549
4559
|
}
|
|
4550
|
-
|
|
4551
|
-
const t =
|
|
4560
|
+
i.emissiveFactor;
|
|
4561
|
+
const t = i.pbrMetallicRoughness;
|
|
4552
4562
|
if (t) {
|
|
4553
|
-
if (t.baseColorFactor && (
|
|
4563
|
+
if (t.baseColorFactor && (o.baseColorFactor = t.baseColorFactor), t.baseColorTexture) {
|
|
4554
4564
|
const r = e.textures[t.baseColorTexture.index];
|
|
4555
|
-
r.image.color ?
|
|
4565
|
+
r.image.color ? o.baseColorFactor = o.baseColorFactor ? n.vec4.multiply(o.baseColorFactor, o.baseColorFactor, r.image.color) : r.image.color : o.baseColorTexture = this.T(r);
|
|
4556
4566
|
}
|
|
4557
|
-
if (d(t.metallicFactor) || (
|
|
4558
|
-
|
|
4559
|
-
const t = this.T(e.textures[
|
|
4560
|
-
|
|
4567
|
+
if (d(t.metallicFactor) || (o.metallicFactor = t.metallicFactor), d(t.roughnessFactor) || (o.roughnessFactor = t.roughnessFactor),
|
|
4568
|
+
i.metallicRoughnessTexture) {
|
|
4569
|
+
const t = this.T(e.textures[i.metallicRoughnessTexture.index]);
|
|
4570
|
+
o.metallicRoughnessTexture = t;
|
|
4561
4571
|
}
|
|
4562
4572
|
}
|
|
4563
4573
|
}
|
|
4564
|
-
let
|
|
4565
|
-
return "phong" === r && (
|
|
4566
|
-
|
|
4574
|
+
let a = new n.reshader.pbr.StandardMaterial(o);
|
|
4575
|
+
return "phong" === r && (a = n.reshader.PhongMaterial.convertFrom(a)), a.once("complete", this.Kt),
|
|
4576
|
+
a;
|
|
4567
4577
|
}
|
|
4568
4578
|
T(t, e) {
|
|
4569
4579
|
const r = {
|
|
@@ -4571,39 +4581,40 @@
|
|
|
4571
4581
|
format: t.format ? qe(t.format) : "rgba",
|
|
4572
4582
|
flipY: !1
|
|
4573
4583
|
};
|
|
4574
|
-
if (e && e.baseColorTexture) r.url = this.
|
|
4584
|
+
if (e && e.baseColorTexture) r.url = this.Be(t); else {
|
|
4575
4585
|
const e = t.image;
|
|
4576
|
-
r.data = e.array
|
|
4586
|
+
e.array ? r.data = e.array : e.mipmap && (r.mipmap = e.mipmap), r.width = e.width,
|
|
4587
|
+
r.height = e.height;
|
|
4577
4588
|
}
|
|
4578
4589
|
const s = t.sampler || t.texture.sampler;
|
|
4579
4590
|
return s && (s.magFilter && (r.mag = ze(s.magFilter)), s.minFilter && (r.min = Ve(s.minFilter)),
|
|
4580
|
-
s.wrapS && (r.wrapS = Ge(s.wrapS)), s.wrapT && (r.wrapT = Ge(s.wrapT))), new n.reshader.Texture2D(r, this.
|
|
4591
|
+
s.wrapS && (r.wrapS = Ge(s.wrapS)), s.wrapT && (r.wrapT = Ge(s.wrapT))), new n.reshader.Texture2D(r, this.Jt);
|
|
4581
4592
|
}
|
|
4582
|
-
|
|
4593
|
+
Be(t) {
|
|
4583
4594
|
const e = t.image, n = window.URL || window.webkitURL, r = new Blob([ e.array ], {
|
|
4584
4595
|
type: e.mimeType
|
|
4585
4596
|
});
|
|
4586
4597
|
return n.createObjectURL(r);
|
|
4587
4598
|
}
|
|
4588
|
-
|
|
4589
|
-
const e = t.Pe, n = this.
|
|
4599
|
+
Xt({target: t}) {
|
|
4600
|
+
const e = t.Pe, n = this.Rt[e];
|
|
4590
4601
|
if (n.count--, !n.count) {
|
|
4591
4602
|
const t = n.meshes;
|
|
4592
|
-
this.
|
|
4593
|
-
const r = t.
|
|
4594
|
-
delete t.
|
|
4603
|
+
this.Dt[e] = t, delete this.Rt[e];
|
|
4604
|
+
const r = t.Se;
|
|
4605
|
+
delete t.Se, r(null, {
|
|
4595
4606
|
mesh: n.meshes,
|
|
4596
4607
|
id: e
|
|
4597
4608
|
});
|
|
4598
4609
|
}
|
|
4599
4610
|
}
|
|
4600
|
-
|
|
4601
|
-
return
|
|
4611
|
+
Le() {
|
|
4612
|
+
return nn;
|
|
4602
4613
|
}
|
|
4603
|
-
|
|
4604
|
-
return this.
|
|
4614
|
+
pe(t) {
|
|
4615
|
+
return this.Pt.pe(t);
|
|
4605
4616
|
}
|
|
4606
|
-
|
|
4617
|
+
_e(t, e) {
|
|
4607
4618
|
const n = this.getMap();
|
|
4608
4619
|
return n.getGLZoom ? n.distanceToPoint(t, e, n.getGLZoom()) : n.distanceToPointAtRes(t, e, n.getGLRes());
|
|
4609
4620
|
}
|
|
@@ -4615,14 +4626,14 @@
|
|
|
4615
4626
|
const e = this.getMap();
|
|
4616
4627
|
return e.getGLZoom ? e._prjToPoint(t, e.getGLZoom()) : e._prjToPointAtRes(t, e.getGLRes());
|
|
4617
4628
|
}
|
|
4618
|
-
|
|
4619
|
-
return "Y" === t ? Ke : "X" === t ? Xe :
|
|
4629
|
+
Ae(t) {
|
|
4630
|
+
return "Y" === t ? Ke : "X" === t ? Xe : rn;
|
|
4620
4631
|
}
|
|
4621
4632
|
}
|
|
4622
4633
|
class mn extends s.renderer.CanvasRenderer {
|
|
4623
4634
|
constructor(t) {
|
|
4624
4635
|
super(t), this.prepareWorker(), this.tilesLoading = {}, this.tileCache = new Ft(1024 * t.options.maxGPUMemory * 1024, this.deleteTile.bind(this)),
|
|
4625
|
-
this.
|
|
4636
|
+
this.wt = {};
|
|
4626
4637
|
}
|
|
4627
4638
|
needToRedraw() {
|
|
4628
4639
|
return !!this.getMap().isInteracting() || super.needToRedraw();
|
|
@@ -4636,29 +4647,29 @@
|
|
|
4636
4647
|
const {root: r, tiles: s} = this.layer.getTiles(), i = s ? Object.keys(s).length : 0;
|
|
4637
4648
|
if (!s || !i) return void this.completeRender();
|
|
4638
4649
|
const {selectedTiles: o, leaves: a, requests: c} = this.Ue(r, s);
|
|
4639
|
-
this.
|
|
4650
|
+
this.Ce(o, a, e), this.Re(), c.length ? this.loadTiles(c) : this.completeRender();
|
|
4640
4651
|
}
|
|
4641
4652
|
Ue(t, e) {
|
|
4642
4653
|
let n = [];
|
|
4643
|
-
this.
|
|
4654
|
+
this.Fe();
|
|
4644
4655
|
let r = 0;
|
|
4645
|
-
const s = this.
|
|
4656
|
+
const s = this.De(), i = {};
|
|
4646
4657
|
let o = !1, a = !1;
|
|
4647
4658
|
for (const t in e) {
|
|
4648
4659
|
const s = e[t], c = s.node;
|
|
4649
4660
|
if (i[c.id]) continue;
|
|
4650
4661
|
i[c.id] = 1;
|
|
4651
4662
|
let h = !1;
|
|
4652
|
-
const u = this.
|
|
4653
|
-
if (this.
|
|
4663
|
+
const u = this.ke(c.id);
|
|
4664
|
+
if (this.je(c.id) ? (r++, h = a = !0, this.tilesLoading[c.id].current = !0) : u ? (this.getTileOpacity(u) < 1 && (h = a = !0),
|
|
4654
4665
|
o = !0, s.selected = !0, s.data = u) : this.painter.has(c) || (h = a = !0, n.push(c)),
|
|
4655
4666
|
!h) continue;
|
|
4656
|
-
if (this.
|
|
4657
|
-
this.
|
|
4667
|
+
if (this.ze(s)) o = !0; else {
|
|
4668
|
+
this.Ve(s).length && (o = !0);
|
|
4658
4669
|
}
|
|
4659
4670
|
}
|
|
4660
4671
|
let c = [], h = {};
|
|
4661
|
-
if (o && ({selectedTiles: c, leaves: h} = this.
|
|
4672
|
+
if (o && ({selectedTiles: c, leaves: h} = this.Ge(t)), n.length > 1 && (n.sort(bn),
|
|
4662
4673
|
s)) {
|
|
4663
4674
|
const t = s - r;
|
|
4664
4675
|
n = t > 0 ? n.slice(0, t) : [];
|
|
@@ -4670,14 +4681,14 @@
|
|
|
4670
4681
|
leaves: h
|
|
4671
4682
|
};
|
|
4672
4683
|
}
|
|
4673
|
-
|
|
4684
|
+
Ge(t) {
|
|
4674
4685
|
const e = [], n = {};
|
|
4675
4686
|
let r;
|
|
4676
4687
|
const s = [ t ], i = [];
|
|
4677
4688
|
for (;s.length > 0 || i.length > 0; ) {
|
|
4678
4689
|
if (i.length > 0) {
|
|
4679
4690
|
const t = i[i.length - 1];
|
|
4680
|
-
if (t.
|
|
4691
|
+
if (t.He === s.length) {
|
|
4681
4692
|
i.pop(), t === r && (t.leave = !0, n[t.node.id] = 1), e.push(t);
|
|
4682
4693
|
continue;
|
|
4683
4694
|
}
|
|
@@ -4689,7 +4700,7 @@
|
|
|
4689
4700
|
t.leave = !0, n[t.node.id] = 1, e.push(t);
|
|
4690
4701
|
continue;
|
|
4691
4702
|
}
|
|
4692
|
-
i.push(t), t.
|
|
4703
|
+
i.push(t), t.He = s.length;
|
|
4693
4704
|
}
|
|
4694
4705
|
o.length > 1 && o.sort(yn);
|
|
4695
4706
|
for (let t = 0; t < o.length; t++) s.push(o[t]);
|
|
@@ -4699,7 +4710,7 @@
|
|
|
4699
4710
|
leaves: n
|
|
4700
4711
|
};
|
|
4701
4712
|
}
|
|
4702
|
-
|
|
4713
|
+
ze(t) {
|
|
4703
4714
|
if (!t.parent) return null;
|
|
4704
4715
|
let e = t.parent;
|
|
4705
4716
|
for (;e && e.level >= 0; ) {
|
|
@@ -4710,27 +4721,27 @@
|
|
|
4710
4721
|
}
|
|
4711
4722
|
return null;
|
|
4712
4723
|
}
|
|
4713
|
-
|
|
4724
|
+
Ve(t) {
|
|
4714
4725
|
const e = [];
|
|
4715
4726
|
if (!t.node.children || !t.node.children.length) return e;
|
|
4716
|
-
const n = t.
|
|
4727
|
+
const n = t.qe + 1, r = [ t.node ];
|
|
4717
4728
|
for (;r.length > 0; ) {
|
|
4718
4729
|
const s = r.pop().children;
|
|
4719
4730
|
for (let i = 0, o = s.length; i < o; i++) {
|
|
4720
|
-
if (!this.layer
|
|
4731
|
+
if (!this.layer.$e(s[i]) && s[i].children && s[i].children.length) {
|
|
4721
4732
|
r.push(s[i]);
|
|
4722
4733
|
continue;
|
|
4723
4734
|
}
|
|
4724
4735
|
const o = s[i].id;
|
|
4725
4736
|
if (this.tileCache.has(o)) {
|
|
4726
|
-
const n = this.layer
|
|
4737
|
+
const n = this.layer.Je(s[i], t);
|
|
4727
4738
|
n.selected = !0, n.data = this.tileCache.get(o), t.children.push(n), e.push(n);
|
|
4728
|
-
} else s[i].
|
|
4739
|
+
} else s[i].qe <= n && r.push(s[i]);
|
|
4729
4740
|
}
|
|
4730
4741
|
}
|
|
4731
4742
|
return e;
|
|
4732
4743
|
}
|
|
4733
|
-
|
|
4744
|
+
Ce(t, e, n) {
|
|
4734
4745
|
this.tileCache.markAll(!1);
|
|
4735
4746
|
for (let e = 0, n = t.length; e < n; e++) {
|
|
4736
4747
|
const n = t[e].data;
|
|
@@ -4764,51 +4775,47 @@
|
|
|
4764
4775
|
let e = t.content.url;
|
|
4765
4776
|
if (M(e)) {
|
|
4766
4777
|
const n = S(e);
|
|
4767
|
-
return void this.
|
|
4778
|
+
return void this.Ke(e, n, t);
|
|
4768
4779
|
}
|
|
4769
4780
|
t && -1 === e.indexOf("http://") && -1 === e.indexOf("https://") && (e = t.baseUrl + e);
|
|
4770
|
-
const n = this.layer.options.services[t.
|
|
4781
|
+
const n = this.layer.options.services[t.ne];
|
|
4771
4782
|
if (n.ajaxInMainThread) {
|
|
4772
4783
|
let r = n.urlParams;
|
|
4773
4784
|
r && (r = (e.indexOf("?") > 0 ? "&" : "?") + r);
|
|
4774
4785
|
let s = ft.getArrayBuffer(e + (r || ""), n.ajaxOptions);
|
|
4775
4786
|
const i = s.xhr;
|
|
4776
4787
|
s = s.then(n => {
|
|
4777
|
-
delete this.
|
|
4788
|
+
delete this.wt[e], n ? this.Ke(e, n.data, t) : this.onTileError(null, t);
|
|
4778
4789
|
}).catch(n => {
|
|
4779
|
-
delete this.
|
|
4780
|
-
}), this.
|
|
4781
|
-
} else this.
|
|
4790
|
+
delete this.wt[e], this.onTileError(n, t);
|
|
4791
|
+
}), this.wt[e] = i;
|
|
4792
|
+
} else this.Ke(e, null, t);
|
|
4782
4793
|
}
|
|
4783
|
-
|
|
4794
|
+
Ke(t, e, r) {
|
|
4795
|
+
let s = this.v;
|
|
4796
|
+
s || (s = n.reshader.Util.getSupportedFormats(this.gl.gl || this.gl), this.v = s),
|
|
4784
4797
|
this.workerConn.loadTile(this.layer.getId(), {
|
|
4785
4798
|
url: t,
|
|
4786
4799
|
arraybuffer: e,
|
|
4787
|
-
rootIdx:
|
|
4788
|
-
upAxis:
|
|
4789
|
-
transform:
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4800
|
+
rootIdx: r.ne,
|
|
4801
|
+
upAxis: r.ve,
|
|
4802
|
+
transform: r.matrix,
|
|
4803
|
+
supportedFormats: s
|
|
4804
|
+
}, (e, n) => {
|
|
4805
|
+
if (e) return void this.onTileError(e, r);
|
|
4806
|
+
const {magic: s} = n;
|
|
4807
|
+
"b3dm" === s ? this.painter.createB3DMMesh(n, r.id, r, (t, {mesh: e}) => {
|
|
4808
|
+
this.Xe(n, r, t, e);
|
|
4809
|
+
}) : "pnts" === s ? this.painter.createPntsMesh(n, r.id, r, (t, {mesh: e}) => {
|
|
4810
|
+
this.Xe(n, r, t, e);
|
|
4811
|
+
}) : "i3dm" === s ? this.painter.createI3DMMesh(n, r.id, r, (t, {mesh: e}) => {
|
|
4812
|
+
this.Xe(n, r, t, e);
|
|
4813
|
+
}) : "cmpt" === s ? this.painter.createCMPTMesh(n, r.id, r, (t, {mesh: e}) => {
|
|
4814
|
+
this.Xe(n, r, t, e);
|
|
4815
|
+
}) : this.onTilesetLoad(n, r, t);
|
|
4802
4816
|
});
|
|
4803
4817
|
}
|
|
4804
|
-
Xe(t) {
|
|
4805
|
-
if (1 === t.length) return t[0].getBoundingBox();
|
|
4806
|
-
if (!n.reshader.BoundingBox) return null;
|
|
4807
|
-
const e = new n.reshader.BoundingBox;
|
|
4808
|
-
for (let n = 0; n < t.length; n++) t[n] && e.combine(t[n].getBoundingBox());
|
|
4809
|
-
return [ e.min, e.max ];
|
|
4810
|
-
}
|
|
4811
|
-
Ze(t, e, n, r) {
|
|
4818
|
+
Xe(t, e, n, r) {
|
|
4812
4819
|
if (n) this.onTileError(n, e); else {
|
|
4813
4820
|
const n = this.We(r);
|
|
4814
4821
|
e.memorySize = n, this.onTileLoad(t, e);
|
|
@@ -4820,7 +4827,7 @@
|
|
|
4820
4827
|
return e;
|
|
4821
4828
|
}
|
|
4822
4829
|
onTileLoad(t, e) {
|
|
4823
|
-
this.layer && (delete this.tilesLoading[e.id], this.
|
|
4830
|
+
this.layer && (delete this.tilesLoading[e.id], this.Ze(e), this.setToRedraw(), this.layer.fire("tileload", {
|
|
4824
4831
|
node: e
|
|
4825
4832
|
}));
|
|
4826
4833
|
}
|
|
@@ -4831,15 +4838,15 @@
|
|
|
4831
4838
|
if (!this.layer) return;
|
|
4832
4839
|
const n = e.content.url;
|
|
4833
4840
|
console.warn("failed to load 3d tile: " + n), console.warn(t), delete this.tilesLoading[e.id],
|
|
4834
|
-
this.
|
|
4841
|
+
this.Ze(e), this.setToRedraw(), this.layer.fire("tileerror", {
|
|
4835
4842
|
node: e,
|
|
4836
4843
|
error: t
|
|
4837
4844
|
});
|
|
4838
4845
|
}
|
|
4839
|
-
|
|
4846
|
+
ke(t) {
|
|
4840
4847
|
return this.tileCache.get(t);
|
|
4841
4848
|
}
|
|
4842
|
-
|
|
4849
|
+
Ze(t) {
|
|
4843
4850
|
const e = {
|
|
4844
4851
|
loadTime: s.Util.now(),
|
|
4845
4852
|
current: !0,
|
|
@@ -4850,13 +4857,13 @@
|
|
|
4850
4857
|
abortTileLoading(t) {
|
|
4851
4858
|
if (!t || !this.workerConn) return;
|
|
4852
4859
|
const e = t.node.content.url;
|
|
4853
|
-
if (this.layer.options.services[t.node.
|
|
4854
|
-
const t = this.
|
|
4860
|
+
if (this.layer.options.services[t.node.ne].ajaxInMainThread) {
|
|
4861
|
+
const t = this.wt[e];
|
|
4855
4862
|
t && t.abort();
|
|
4856
4863
|
} else this.workerConn.abortTileLoading(this.layer.getId(), e);
|
|
4857
|
-
delete this.
|
|
4864
|
+
delete this.wt[e];
|
|
4858
4865
|
}
|
|
4859
|
-
|
|
4866
|
+
Fe() {
|
|
4860
4867
|
if (this.tilesLoading) for (const t in this.tilesLoading) this.tilesLoading[t].current = !1;
|
|
4861
4868
|
}
|
|
4862
4869
|
deleteTile(t) {
|
|
@@ -4871,7 +4878,7 @@
|
|
|
4871
4878
|
antialias: t.options.antialias
|
|
4872
4879
|
};
|
|
4873
4880
|
this.canvas.gl && this.canvas.gl.wrap ? (this.gl = this.canvas.gl.wrap(), this.regl = this.canvas.gl.regl) : (this.glOptions = e,
|
|
4874
|
-
this.gl = this.
|
|
4881
|
+
this.gl = this.Ye(this.canvas, e)), this.regl = this.regl || n.createREGL({
|
|
4875
4882
|
gl: this.gl,
|
|
4876
4883
|
attributes: e,
|
|
4877
4884
|
extensions: [ "OES_element_index_uint", "WEBGL_compressed_texture_s3tc" ],
|
|
@@ -4880,7 +4887,7 @@
|
|
|
4880
4887
|
}
|
|
4881
4888
|
prepareWorker() {
|
|
4882
4889
|
const t = this.getMap();
|
|
4883
|
-
this.workerConn || (this.workerConn = new
|
|
4890
|
+
this.workerConn || (this.workerConn = new Ut("@maptalks/3dtiles", t.id));
|
|
4884
4891
|
const e = this.workerConn;
|
|
4885
4892
|
if (!e.isActive()) return;
|
|
4886
4893
|
let n = this.layer.options || {};
|
|
@@ -4898,7 +4905,7 @@
|
|
|
4898
4905
|
super.onRemove();
|
|
4899
4906
|
}
|
|
4900
4907
|
clear() {
|
|
4901
|
-
this.
|
|
4908
|
+
this.Re(!0), this.tileCache.reset(), this.tilesLoading = {}, super.clear();
|
|
4902
4909
|
}
|
|
4903
4910
|
clearCanvas() {
|
|
4904
4911
|
this.regl && this.regl.clear({
|
|
@@ -4913,11 +4920,11 @@
|
|
|
4913
4920
|
getStencilValue() {
|
|
4914
4921
|
return 0;
|
|
4915
4922
|
}
|
|
4916
|
-
|
|
4917
|
-
this.
|
|
4923
|
+
Re(t) {
|
|
4924
|
+
this.Qe || (this.Qe = Date.now());
|
|
4918
4925
|
const e = Date.now();
|
|
4919
|
-
if (t || !(e - this.
|
|
4920
|
-
this.
|
|
4926
|
+
if (t || !(e - this.Qe < this.layer.options.retireInterval)) {
|
|
4927
|
+
this.Qe = e;
|
|
4921
4928
|
for (const e in this.tilesLoading) {
|
|
4922
4929
|
const n = this.tilesLoading[e];
|
|
4923
4930
|
!t && n.current || (this.abortTileLoading(n), this.painter.has(n) && this.painter.deleteTile(n),
|
|
@@ -4925,10 +4932,10 @@
|
|
|
4925
4932
|
}
|
|
4926
4933
|
}
|
|
4927
4934
|
}
|
|
4928
|
-
|
|
4935
|
+
De() {
|
|
4929
4936
|
return this.getMap().isInteracting() ? this.layer.options.loadingLimitOnInteracting : this.layer.options.loadingLimit;
|
|
4930
4937
|
}
|
|
4931
|
-
|
|
4938
|
+
Ye(t, e) {
|
|
4932
4939
|
const n = [ "webgl", "experimental-webgl" ];
|
|
4933
4940
|
let r = null;
|
|
4934
4941
|
for (let s = 0; s < n.length; ++s) {
|
|
@@ -4939,7 +4946,7 @@
|
|
|
4939
4946
|
}
|
|
4940
4947
|
return r;
|
|
4941
4948
|
}
|
|
4942
|
-
|
|
4949
|
+
je(t) {
|
|
4943
4950
|
return !!this.tilesLoading[t];
|
|
4944
4951
|
}
|
|
4945
4952
|
getI3DMMeshes() {
|
|
@@ -4956,17 +4963,17 @@
|
|
|
4956
4963
|
}
|
|
4957
4964
|
}
|
|
4958
4965
|
function yn(t, e) {
|
|
4959
|
-
return 0 === t.node.
|
|
4966
|
+
return 0 === t.node.ue && 0 === e.node.ue ? e.node.tn - t.node.tn : e.node.ue - t.node.ue;
|
|
4960
4967
|
}
|
|
4961
4968
|
function bn(t, e) {
|
|
4962
|
-
return 0 === t.
|
|
4969
|
+
return 0 === t.ue && 0 === e.ue ? t.tn - e.tn : t.ue - e.ue;
|
|
4963
4970
|
}
|
|
4964
4971
|
function pn(t, e, n) {
|
|
4965
4972
|
return t[0] = e[n], t[1] = e[n + 3], t[2] = e[n + 6], t;
|
|
4966
4973
|
}
|
|
4967
4974
|
function wn(t, e, n) {
|
|
4968
4975
|
return Math.sqrt(function(t, e, n) {
|
|
4969
|
-
var r =
|
|
4976
|
+
var r = C(_n, n, t), s = pn(gn, e, 0), i = pn(Tn, e, 1), o = pn(An, e, 2), a = G(s), c = G(i), h = G(o);
|
|
4970
4977
|
D(s, s), D(i, i), D(o, o);
|
|
4971
4978
|
var u = vn;
|
|
4972
4979
|
u.x = k(r, s), u.y = k(r, i), u.z = k(r, o);
|
|
@@ -4977,15 +4984,15 @@
|
|
|
4977
4984
|
return l;
|
|
4978
4985
|
}(t, e, n));
|
|
4979
4986
|
}
|
|
4980
|
-
const
|
|
4981
|
-
const On = s.projection.EPSG3857, Mn = new s.Extent(0, 0, 0, 0), Sn = [], xn = [], In = new s.Coordinate(0, 0),
|
|
4987
|
+
const _n = [], gn = [], Tn = [], An = [], vn = [];
|
|
4988
|
+
const On = s.projection.EPSG3857, Mn = new s.Extent(0, 0, 0, 0), Sn = [], xn = [], In = [], Nn = new s.Coordinate(0, 0), En = n.mat4.identity([]);
|
|
4982
4989
|
class Pn extends s.Layer {
|
|
4983
4990
|
constructor(t, e) {
|
|
4984
|
-
super(t, e), this.
|
|
4991
|
+
super(t, e), this.en(), this.wt = {}, this.nn = {};
|
|
4985
4992
|
}
|
|
4986
|
-
|
|
4993
|
+
en() {
|
|
4987
4994
|
let t = this.options.services.map(t => t.url);
|
|
4988
|
-
this.
|
|
4995
|
+
this.rn = t.map((t, e) => function(t, e) {
|
|
4989
4996
|
t = w(t);
|
|
4990
4997
|
return {
|
|
4991
4998
|
baseUrl: t.substring(0, t.lastIndexOf("/")) + "/",
|
|
@@ -4994,36 +5001,36 @@
|
|
|
4994
5001
|
},
|
|
4995
5002
|
refine: "replace",
|
|
4996
5003
|
matrix: n.mat4.identity([]),
|
|
4997
|
-
|
|
4998
|
-
|
|
5004
|
+
ne: e,
|
|
5005
|
+
qe: 0
|
|
4999
5006
|
};
|
|
5000
5007
|
}(t, e)), this.fire("rootready", {
|
|
5001
|
-
roots: this.
|
|
5008
|
+
roots: this.rn.slice(0)
|
|
5002
5009
|
});
|
|
5003
5010
|
}
|
|
5004
5011
|
getExtent(t) {
|
|
5005
5012
|
if (!t && 0 !== t) {
|
|
5006
5013
|
const t = new s.Extent;
|
|
5007
|
-
for (let e = 0; e < this.
|
|
5008
|
-
const n = this.boundingVolumeToExtent(this.
|
|
5014
|
+
for (let e = 0; e < this.rn.length; e++) if (this.rn[e].boundingVolume) {
|
|
5015
|
+
const n = this.boundingVolumeToExtent(this.rn[e]);
|
|
5009
5016
|
t._combine(n);
|
|
5010
5017
|
}
|
|
5011
5018
|
return t;
|
|
5012
5019
|
}
|
|
5013
|
-
return this.
|
|
5020
|
+
return this.rn[t] && this.rn[t].boundingVolume ? this.boundingVolumeToExtent(this.rn[t]) : null;
|
|
5014
5021
|
}
|
|
5015
5022
|
boundingVolumeToExtent(t) {
|
|
5016
|
-
const e = t.boundingVolume.
|
|
5023
|
+
const e = t.boundingVolume.sn ? En : t.matrix, r = this.getMap();
|
|
5017
5024
|
if (t.boundingVolume.region) {
|
|
5018
5025
|
const e = t.boundingVolume.region;
|
|
5019
5026
|
return new s.Extent(p(e[0]), p(e[1]), p(e[2]), p(e[3]));
|
|
5020
5027
|
}
|
|
5021
5028
|
if (t.boundingVolume.sphere) {
|
|
5022
|
-
const i = t.boundingVolume.sphere, o =
|
|
5029
|
+
const i = t.boundingVolume.sphere, o = Zt([], n.vec3.transformMat4([], i, e)), a = i[3], c = r.locate(o, -a, a), h = r.locate(o, a, -a);
|
|
5023
5030
|
return new s.Extent(c, h);
|
|
5024
5031
|
}
|
|
5025
5032
|
if (t.boundingVolume.box) {
|
|
5026
|
-
const i = t.boundingVolume.box, o = n.vec3.transformMat4([], i, e), a = new s.Coordinate(
|
|
5033
|
+
const i = t.boundingVolume.box, o = n.vec3.transformMat4([], i, e), a = new s.Coordinate(Zt([], o)), c = i.slice(3);
|
|
5027
5034
|
n.mat3.multiply(c, n.mat3.fromMat4([], t.matrix), c);
|
|
5028
5035
|
const h = n.vec3.length(c.slice(0, 3)), u = n.vec3.length(c.slice(3, 6)), f = n.vec3.length(c.slice(6, 9)), l = Math.max(h, u, f), d = r.locate(a, -l, l), m = r.locate(a, l, -l);
|
|
5029
5036
|
return new s.Extent(d, m);
|
|
@@ -5031,53 +5038,53 @@
|
|
|
5031
5038
|
return null;
|
|
5032
5039
|
}
|
|
5033
5040
|
getRootTiles() {
|
|
5034
|
-
return this.
|
|
5041
|
+
return this.rn;
|
|
5035
5042
|
}
|
|
5036
5043
|
getTiles() {
|
|
5037
|
-
return this.getRenderer().ready ? this.
|
|
5044
|
+
return this.getRenderer().ready ? this.in() : (this.an(), {
|
|
5038
5045
|
tiles: null
|
|
5039
5046
|
});
|
|
5040
5047
|
}
|
|
5041
|
-
|
|
5048
|
+
in() {
|
|
5042
5049
|
const t = this.getMap(), e = t.cameraPosition;
|
|
5043
5050
|
let r, s;
|
|
5044
|
-
if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()),
|
|
5045
|
-
r = t.pointToCoord(
|
|
5051
|
+
if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), Nn.set(e[0], e[1]),
|
|
5052
|
+
r = t.pointToCoord(Nn, t.getGLZoom()); else {
|
|
5046
5053
|
const n = t.getGLRes();
|
|
5047
|
-
s = t.pointAtResToDistance(e[2], 0, n),
|
|
5054
|
+
s = t.pointAtResToDistance(e[2], 0, n), Nn.set(e[0], e[1]), r = t.pointAtResToCoord(Nn, n);
|
|
5048
5055
|
}
|
|
5049
|
-
this.
|
|
5050
|
-
this.
|
|
5056
|
+
this.cn = this.cn || [], n.vec3.set(this.cn, b(r.x), b(r.y), s), this.hn = qt(this.hn || [], this.cn[0], this.cn[1], this.cn[2]),
|
|
5057
|
+
this.un = 2 * Math.tan(.5 * b(t.getFov())), this.ln = On.project(r).toArray();
|
|
5051
5058
|
const i = t.projViewMatrix, o = {
|
|
5052
5059
|
children: [],
|
|
5053
5060
|
level: -1
|
|
5054
5061
|
};
|
|
5055
5062
|
let a = o;
|
|
5056
5063
|
const c = {};
|
|
5057
|
-
for (let t = 0; t < this.
|
|
5064
|
+
for (let t = 0; t < this.rn.length; t++) {
|
|
5058
5065
|
let e = 1 / 0;
|
|
5059
|
-
const n = [ this.
|
|
5066
|
+
const n = [ this.rn[t] ], r = this.dn(t);
|
|
5060
5067
|
for (;n.length > 0; ) {
|
|
5061
5068
|
const t = n.pop();
|
|
5062
|
-
for (this.
|
|
5063
|
-
const s = this.
|
|
5069
|
+
for (this.mn(t); a.level >= t.qe; ) a = a.parent;
|
|
5070
|
+
const s = this.yn(t, r, i);
|
|
5064
5071
|
if (s < 1) {
|
|
5065
5072
|
let n = a;
|
|
5066
5073
|
for (;n && !n.content; ) n = n.parent;
|
|
5067
|
-
n && n.content && (t.
|
|
5068
|
-
if (!1 === this.options.services[t.
|
|
5069
|
-
if (!(0 === s && t.
|
|
5070
|
-
t.content && (e = t.
|
|
5074
|
+
0 === s && n && n.content && (t.bn = n, this.pn(c, n));
|
|
5075
|
+
if (!1 === this.options.services[t.ne].alwaysShow) continue;
|
|
5076
|
+
if (!(0 === s && t.qe <= e)) continue;
|
|
5077
|
+
t.content && (e = t.qe);
|
|
5071
5078
|
}
|
|
5072
|
-
t.
|
|
5073
|
-
const o = this
|
|
5079
|
+
t.ue < 1 / 0 && this.wn(t);
|
|
5080
|
+
const o = this.Je(t, a);
|
|
5074
5081
|
a.children.push(o);
|
|
5075
5082
|
const h = t.children, u = h && h.length, f = o.content;
|
|
5076
|
-
if (!u && f && this.
|
|
5077
|
-
f && "add" === t.refine && this.
|
|
5083
|
+
if (!u && f && this.pn(c, o), u) {
|
|
5084
|
+
f && "add" === t.refine && this.pn(c, o), a = o;
|
|
5078
5085
|
for (let e = 0, r = h.length; e < r; e++) {
|
|
5079
5086
|
if (!h[e].parent) {
|
|
5080
|
-
h[e].parent = t, h[e].
|
|
5087
|
+
h[e].parent = t, h[e].ve = t.ve, h[e].baseUrl = t.baseUrl;
|
|
5081
5088
|
const n = h[e].content && (h[e].content.url || h[e].content.uri);
|
|
5082
5089
|
n && (M(n) ? h[e].baseUrl = t.baseUrl : -1 === n.indexOf("http://") && -1 === n.indexOf("https://") ? h[e].content.url = t.baseUrl + n : h[e].baseUrl = n.substring(0, n.lastIndexOf("/") + 1));
|
|
5083
5090
|
}
|
|
@@ -5091,154 +5098,155 @@
|
|
|
5091
5098
|
tiles: c
|
|
5092
5099
|
};
|
|
5093
5100
|
}
|
|
5094
|
-
|
|
5101
|
+
pn(t, e) {
|
|
5095
5102
|
e.node.viewerRequestVolume && !function(t, e, n) {
|
|
5096
5103
|
if (n.region) {
|
|
5097
5104
|
const e = n.region;
|
|
5098
5105
|
if (t[0] >= e[0] && t[0] <= e[2] && t[1] >= e[1] && t[1] <= e[3]) return !0;
|
|
5099
5106
|
} else {
|
|
5100
|
-
if (n.sphere) return
|
|
5101
|
-
if (n.box) return 0 ===
|
|
5107
|
+
if (n.sphere) return Ln(n, e);
|
|
5108
|
+
if (n.box) return 0 === Bn(n, e);
|
|
5102
5109
|
}
|
|
5103
5110
|
return !1;
|
|
5104
5111
|
}
|
|
5105
5112
|
/*!
|
|
5106
|
-
* @maptalks/gl v0.
|
|
5113
|
+
* @maptalks/gl v0.65.0
|
|
5107
5114
|
* LICENSE : UNLICENSED
|
|
5108
5115
|
* (c) 2016-2022 maptalks.com
|
|
5109
|
-
*/ (this.
|
|
5116
|
+
*/ (this.cn, this.hn, e.node.viewerRequestVolume) || (t[e.node.id] = e);
|
|
5110
5117
|
}
|
|
5111
|
-
|
|
5118
|
+
Je(t, e) {
|
|
5112
5119
|
return {
|
|
5113
5120
|
id: t.id,
|
|
5114
5121
|
node: t,
|
|
5115
5122
|
children: [],
|
|
5116
|
-
level: t.
|
|
5123
|
+
level: t.qe,
|
|
5117
5124
|
parent: e,
|
|
5118
|
-
content: this
|
|
5125
|
+
content: this.$e(t)
|
|
5119
5126
|
};
|
|
5120
5127
|
}
|
|
5121
|
-
|
|
5128
|
+
mn(t) {
|
|
5122
5129
|
void 0 === t.id && (t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]),
|
|
5123
|
-
t._n = this.
|
|
5124
|
-
t.
|
|
5130
|
+
t._n = this.gn(t), t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix),
|
|
5131
|
+
t.ne = t.parent.ne, void 0 === t.qe && (t.qe = t.parent.qe + 1), t.maxExtent = t.parent.maxExtent),
|
|
5125
5132
|
t.refine = t.refine && t.refine.toLowerCase() || "replace", t.content && !t.content.url && t.content.uri && (t.content.url = t.content.uri),
|
|
5126
|
-
this.
|
|
5133
|
+
this.Tn(t));
|
|
5127
5134
|
}
|
|
5128
|
-
|
|
5135
|
+
Tn(t) {
|
|
5129
5136
|
const e = t.boundingVolume;
|
|
5130
|
-
if (!e || e.
|
|
5131
|
-
const r = this.options.services[t.
|
|
5132
|
-
if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix,
|
|
5137
|
+
if (!e || e.sn) return;
|
|
5138
|
+
const r = this.options.services[t.ne].heightOffset || 0, s = this.options.offset, i = y(s) || s[0] || s[1];
|
|
5139
|
+
if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, En) && !i) return;
|
|
5133
5140
|
const {region: o, box: a, sphere: c} = e;
|
|
5134
5141
|
if (o) {
|
|
5135
|
-
const t = this.
|
|
5142
|
+
const t = this.An([ p(o[0]), p(o[1]) ]);
|
|
5136
5143
|
o[0] = b(t.x), o[1] = b(t.y);
|
|
5137
|
-
const e = this.
|
|
5144
|
+
const e = this.An([ p(o[2]), p(o[3]) ]);
|
|
5138
5145
|
o[2] = b(e.x), o[3] = b(e.y), o[4] += r, o[5] += r;
|
|
5139
5146
|
} else if (a || c) {
|
|
5140
|
-
const e = a || c, s = n.vec3.transformMat4(Sn, e, t.matrix), i =
|
|
5147
|
+
const e = a || c, s = n.vec3.transformMat4(Sn, e, t.matrix), i = Zt(xn, s), o = this.An([ i[0], i[1] ]);
|
|
5141
5148
|
i[0] = o.x, i[1] = o.y, i[2] += r, qt(e, b(i[0]), b(i[1]), i[2]);
|
|
5142
5149
|
}
|
|
5143
|
-
e.
|
|
5150
|
+
e.sn = !0;
|
|
5144
5151
|
}
|
|
5145
|
-
|
|
5152
|
+
gn(t) {
|
|
5146
5153
|
return void 0 === t.geometricError || !t.boundingVolume;
|
|
5147
5154
|
}
|
|
5148
|
-
|
|
5155
|
+
$e(t) {
|
|
5149
5156
|
return t.content && t.content.url;
|
|
5150
5157
|
}
|
|
5151
|
-
|
|
5158
|
+
wn(t) {
|
|
5152
5159
|
let e = t.parent;
|
|
5153
|
-
for (;e && e._n && !(e.
|
|
5160
|
+
for (;e && e._n && !(e.ue <= t.ue && e.tn <= t.tn); ) e.ue = t.ue, e.tn = t.tn,
|
|
5154
5161
|
e = t.parent;
|
|
5155
5162
|
}
|
|
5156
5163
|
onTilesetLoad(t, e, r) {
|
|
5157
5164
|
if (!t) return void console.warn("invalid tileset at : " + r);
|
|
5158
|
-
const s = (t.asset && t.asset.gltfUpAxis || e && e.
|
|
5159
|
-
if (t.root.baseUrl = r.substring(0, r.lastIndexOf("/") + 1), t.root.
|
|
5165
|
+
const s = (t.asset && t.asset.gltfUpAxis || e && e.ve || this.options.services[e.ne].upAxis || "Y").toUpperCase();
|
|
5166
|
+
if (t.root.baseUrl = r.substring(0, r.lastIndexOf("/") + 1), t.root.ve = s, e) {
|
|
5160
5167
|
const r = e.boundingVolume;
|
|
5161
5168
|
m(e, t.root), e.refine = e.refine && e.refine.toLowerCase() || "replace", r && (e.boundingVolume = r);
|
|
5162
5169
|
const s = t.root.transform;
|
|
5163
5170
|
s && (e.parent ? e.matrix = n.mat4.multiply([], e.parent.matrix, s) : e.matrix = s),
|
|
5164
|
-
this.
|
|
5165
|
-
t.root.content && (e.content = t.root.content)), e._n = this.
|
|
5171
|
+
this.Tn(e), e.children && e.children.length && (e.vn = e.content, delete e.content,
|
|
5172
|
+
t.root.content && (e.content = t.root.content)), e._n = this.gn(e);
|
|
5166
5173
|
const i = e.content && (e.content.url || e.content.uri);
|
|
5167
5174
|
i && e.content.uri && (e.content.url = e.content.uri, delete e.content.uri), i && !M(i) && -1 === i.indexOf("http://") && -1 === i.indexOf("https://") && (e.content.url = e.baseUrl + i);
|
|
5168
5175
|
}
|
|
5169
|
-
this.
|
|
5176
|
+
this.an(), this.fire("loadtileset", {
|
|
5170
5177
|
tileset: t,
|
|
5171
|
-
index: e.
|
|
5178
|
+
index: e.ne,
|
|
5172
5179
|
url: r
|
|
5173
5180
|
});
|
|
5174
5181
|
}
|
|
5175
|
-
|
|
5176
|
-
if (t.
|
|
5177
|
-
if (t.
|
|
5182
|
+
yn(t, e, n) {
|
|
5183
|
+
if (t.ue = 1 / 0, 0 === t.qe || t._n) return 1;
|
|
5184
|
+
if (t.On = 1 / 0, !this.Mn(t, e, n)) return -1;
|
|
5178
5185
|
if (0 === t.geometricError) return 1;
|
|
5179
|
-
let r = this.options.services[t.
|
|
5186
|
+
let r = this.options.services[t.ne].maximumScreenSpaceError;
|
|
5180
5187
|
null == r && (r = 8);
|
|
5181
|
-
let s = this.
|
|
5182
|
-
return 0 === s && t.parent && (s = .5 * (t.parent.
|
|
5188
|
+
let s = this.Sn(t);
|
|
5189
|
+
return 0 === s && t.parent && (s = .5 * (t.parent.On || 0)), s >= r ? 1 : 0;
|
|
5183
5190
|
}
|
|
5184
|
-
|
|
5191
|
+
pe(t) {
|
|
5185
5192
|
const e = this.getMap();
|
|
5186
5193
|
return e.getGLZoom ? e.coordToPoint(t, e.getGLZoom()) : e.coordToPointAtRes(t, e.getGLRes());
|
|
5187
5194
|
}
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
const a = t.id;
|
|
5193
|
-
let f = this.rn[a];
|
|
5195
|
+
Mn(t, e, r) {
|
|
5196
|
+
if (!this.getMap()) return !1;
|
|
5197
|
+
const o = t.id;
|
|
5198
|
+
let a = this.nn[o];
|
|
5194
5199
|
if (!t.boundingVolume) return !1;
|
|
5195
|
-
if (!
|
|
5200
|
+
if (!a && t.boundingVolume && !a) {
|
|
5196
5201
|
let e, r, i;
|
|
5197
|
-
const c = 1 / (o.getGLZoom ? o.getResolution(o.getGLZoom()) : o.getGLRes());
|
|
5198
5202
|
if (t.boundingVolume.region) {
|
|
5199
5203
|
const n = t.boundingVolume.region;
|
|
5200
5204
|
e = new s.Extent(p(n[0]), p(n[1]), p(n[2]), p(n[3]));
|
|
5201
|
-
const
|
|
5202
|
-
e = e.convertTo(t => this.
|
|
5203
|
-
|
|
5205
|
+
const c = e.getCenter(), h = this.xn(c);
|
|
5206
|
+
e = e.convertTo(t => this.pe(t)), i = n[4], r = n[5], a = this.nn[o] = [ [ e.xmin, e.ymin, i * h ], [ e.xmax, e.ymax, r * h ] ],
|
|
5207
|
+
a.center = c;
|
|
5204
5208
|
} else if (t.boundingVolume.sphere) {
|
|
5205
|
-
const e = t.boundingVolume.sphere, n =
|
|
5206
|
-
|
|
5209
|
+
const e = t.boundingVolume.sphere, n = Zt([], e), r = new s.Coordinate(n), i = this.pe(r).toArray(), c = this.xn(r);
|
|
5210
|
+
i.push(n[2] * c[2]), a = this.nn[o] = [ i, e[3] * c ], a.center = new s.Coordinate(n);
|
|
5207
5211
|
} else if (t.boundingVolume.box) {
|
|
5208
|
-
const e = t.boundingVolume.box, r =
|
|
5209
|
-
|
|
5210
|
-
const
|
|
5211
|
-
n.mat4.exactEquals(t.matrix,
|
|
5212
|
-
for (let t = 0; t <
|
|
5213
|
-
|
|
5212
|
+
const e = t.boundingVolume.box, r = Zt([], e), i = new s.Coordinate(r), c = this.pe(i).toArray(), h = this.xn(i);
|
|
5213
|
+
c.push(r[2] * h[2]);
|
|
5214
|
+
const u = e.slice(3);
|
|
5215
|
+
n.mat4.exactEquals(t.matrix, En) || n.mat3.multiply(u, n.mat3.fromMat4([], t.matrix), u);
|
|
5216
|
+
for (let t = 0; t < u.length; t++) u[t] *= h[t % 3], e[3 + t] = u[t];
|
|
5217
|
+
a = this.nn[o] = [ ...c, ...u ], a.center = new s.Coordinate(r);
|
|
5214
5218
|
}
|
|
5215
5219
|
}
|
|
5216
5220
|
if (e) {
|
|
5217
|
-
if (t.boundingVolume.region) Mn.xmin =
|
|
5218
|
-
Mn.ymax =
|
|
5219
|
-
const t =
|
|
5220
|
-
Mn.xmin =
|
|
5221
|
+
if (t.boundingVolume.region) Mn.xmin = a[0][0], Mn.ymin = a[0][1], Mn.xmax = a[1][0],
|
|
5222
|
+
Mn.ymax = a[1][1]; else if (t.boundingVolume.sphere) {
|
|
5223
|
+
const t = a[2];
|
|
5224
|
+
Mn.xmin = a[0][0] - t, Mn.ymin = a[0][1] - t, Mn.xmax = a[0][0] + t, Mn.ymax = a[0][1] + t;
|
|
5221
5225
|
} else if (t.boundingVolume.box) {
|
|
5222
|
-
const t =
|
|
5223
|
-
Mn.xmin =
|
|
5226
|
+
const t = a[1], e = a[2];
|
|
5227
|
+
Mn.xmin = a[0][0] - t, Mn.ymin = a[0][1] - e, Mn.xmax = a[0][0] + t, Mn.ymax = a[0][1] + e;
|
|
5224
5228
|
}
|
|
5225
5229
|
if (!e.intersects(Mn)) return !1;
|
|
5226
5230
|
}
|
|
5227
|
-
return t.boundingVolume.region ? c(r,
|
|
5231
|
+
return t.boundingVolume.region ? c(r, a) : t.boundingVolume.sphere ? function(t, e, n) {
|
|
5228
5232
|
u(t);
|
|
5229
5233
|
for (var r = e[0], s = -e[1], o = 0; o < 6; o++) {
|
|
5230
5234
|
if (!n || "0" !== n.charAt(o)) if (l(i[o], r) < s) return !1;
|
|
5231
5235
|
}
|
|
5232
5236
|
return !0;
|
|
5233
|
-
}(r,
|
|
5237
|
+
}(r, a) : !!t.boundingVolume.box && function(t, e, n) {
|
|
5234
5238
|
u(t);
|
|
5235
5239
|
for (var r = 0; r < 6; r++) {
|
|
5236
5240
|
if (!n || "0" !== n.charAt(r)) if (!h(i[r], e)) return !1;
|
|
5237
5241
|
}
|
|
5238
5242
|
return !0;
|
|
5239
|
-
}(r,
|
|
5243
|
+
}(r, a);
|
|
5240
5244
|
}
|
|
5241
|
-
|
|
5245
|
+
xn(t) {
|
|
5246
|
+
const e = this.getMap(), r = e.distanceToPointAtRes(100, 100, e.getGLRes(), t);
|
|
5247
|
+
return n.vec3.set(In, r.x / 100 * 1.01, r.y / 100 * 1.01, r.y / 100), In;
|
|
5248
|
+
}
|
|
5249
|
+
An(t) {
|
|
5242
5250
|
Array.isArray(t) && (t = new s.Coordinate(t));
|
|
5243
5251
|
let e = this.options.offset;
|
|
5244
5252
|
if (y(e) && (e = e(Array.isArray(t) ? new s.Coordinate(t) : t)), e[0] || e[1]) {
|
|
@@ -5247,60 +5255,60 @@
|
|
|
5247
5255
|
}
|
|
5248
5256
|
return t;
|
|
5249
5257
|
}
|
|
5250
|
-
|
|
5258
|
+
dn(t) {
|
|
5251
5259
|
const e = this.options.services[t].maxExtent;
|
|
5252
5260
|
if (!e) return null;
|
|
5253
|
-
const n = this.
|
|
5254
|
-
return n.maxExtent || (n.maxExtent = new s.Extent(e).convertTo(t => this.
|
|
5261
|
+
const n = this.rn[t];
|
|
5262
|
+
return n.maxExtent || (n.maxExtent = new s.Extent(e).convertTo(t => this.pe(t))),
|
|
5255
5263
|
n.maxExtent;
|
|
5256
5264
|
}
|
|
5257
|
-
|
|
5258
|
-
const e = this.
|
|
5265
|
+
Sn(t) {
|
|
5266
|
+
const e = this.un, r = t.geometricError;
|
|
5259
5267
|
if (0 === r) return 0;
|
|
5260
5268
|
const s = this.getMap();
|
|
5261
5269
|
let i, o;
|
|
5262
5270
|
if (t.boundingVolume.region) {
|
|
5263
|
-
const e = this.
|
|
5271
|
+
const e = this.nn[t.id].center, r = (s.getGLZoom ? s.distanceToPoint(100, 0, s.getGLZoom(), e) : s.distanceToPointAtRes(100, 0, s.getGLRes(), e)).x / 100;
|
|
5264
5272
|
i = function(t, e, n, r) {
|
|
5265
5273
|
const s = t.boundingVolume.region;
|
|
5266
5274
|
let i = t.In;
|
|
5267
|
-
i || (i = t.In = [
|
|
5275
|
+
i || (i = t.In = [ Rn(s[0], s[1]), Rn(s[0], s[3]), Rn(s[2], s[1]), Rn(s[2], s[3]), Rn(s[0], s[1]), Rn(s[0], s[3]), Rn(s[2], s[1]), Rn(s[2], s[3]) ],
|
|
5268
5276
|
t.Nn = [ Math.min.apply(Math, i.map(t => t[0])), Math.min.apply(Math, i.map(t => t[1])) ],
|
|
5269
|
-
t.
|
|
5277
|
+
t.En = [ Math.max.apply(Math, i.map(t => t[0])), Math.max.apply(Math, i.map(t => t[1])) ]);
|
|
5270
5278
|
if (n[0] >= s[0] && n[0] <= s[2] && n[1] >= s[1] && n[1] <= s[3]) return n[2] <= s[5] ? 0 : n[2] - s[5];
|
|
5271
|
-
const o = (a = t.Nn, c = t.
|
|
5279
|
+
const o = (a = t.Nn, c = t.En, h = e, u = Math.max(a[0] - h[0], 0, h[0] - c[0]),
|
|
5272
5280
|
f = Math.max(a[1] - h[1], 0, h[1] - c[1]), Math.sqrt(u * u + f * f) / r);
|
|
5273
5281
|
var a, c, h, u, f;
|
|
5274
5282
|
let l = 0;
|
|
5275
5283
|
n[2] > s[5] && (l = n[2] - s[5]);
|
|
5276
5284
|
return Math.sqrt(o * o + l * l);
|
|
5277
|
-
}(t, this.
|
|
5278
|
-
const r = t.boundingVolume.region, s = qt(Un, r[0], r[1], r[4]), i = qt(
|
|
5285
|
+
}(t, this.ln, this.cn, r), o = function(t, e) {
|
|
5286
|
+
const r = t.boundingVolume.region, s = qt(Un, r[0], r[1], r[4]), i = qt(Cn, r[2], r[3], r[5]), o = n.vec3.scale(s, n.vec3.add(s, s, i), .5);
|
|
5279
5287
|
return n.vec3.dist(o, e);
|
|
5280
|
-
}(t, this.
|
|
5281
|
-
} else t.boundingVolume.sphere ? (i =
|
|
5288
|
+
}(t, this.hn);
|
|
5289
|
+
} else t.boundingVolume.sphere ? (i = Ln(t.boundingVolume, this.hn), o = function(t, e) {
|
|
5282
5290
|
const r = t.boundingVolume.sphere;
|
|
5283
5291
|
return n.vec3.dist(r, e);
|
|
5284
|
-
}(t, this.
|
|
5292
|
+
}(t, this.hn)) : t.boundingVolume.box && (i = Bn(t.boundingVolume, this.hn), o = function(t, e) {
|
|
5285
5293
|
const r = t.boundingVolume.box;
|
|
5286
5294
|
return n.vec3.dist(r, e);
|
|
5287
|
-
}(t, this.
|
|
5295
|
+
}(t, this.hn));
|
|
5288
5296
|
const a = Math.max(Math.abs(i), 1e-7), c = r * s.height / (a * e);
|
|
5289
|
-
return t.
|
|
5297
|
+
return t.ue = i, t.tn = o, t.On = c, c;
|
|
5290
5298
|
}
|
|
5291
|
-
|
|
5299
|
+
an() {
|
|
5292
5300
|
const t = this.getRenderer();
|
|
5293
5301
|
t && t.setToRedraw();
|
|
5294
5302
|
}
|
|
5295
|
-
|
|
5296
|
-
return this.
|
|
5303
|
+
xe(t) {
|
|
5304
|
+
return this.nn[t];
|
|
5297
5305
|
}
|
|
5298
5306
|
}
|
|
5299
|
-
function
|
|
5307
|
+
function Ln(t, e) {
|
|
5300
5308
|
const r = t.sphere, s = n.vec3.dist(r, e), i = t.sphere[3];
|
|
5301
5309
|
return s < i ? 0 : s - i;
|
|
5302
5310
|
}
|
|
5303
|
-
function
|
|
5311
|
+
function Bn(t, e) {
|
|
5304
5312
|
const n = t.box;
|
|
5305
5313
|
return wn(n.slice(0, 3), n.slice(3), e);
|
|
5306
5314
|
}
|
|
@@ -5317,37 +5325,37 @@
|
|
|
5317
5325
|
"debugOutline": [ 0, 1, 0 ],
|
|
5318
5326
|
"antialias": !1,
|
|
5319
5327
|
"sRGBTolinear": !1,
|
|
5320
|
-
"optionalExtensions": [ "ANGLE_instanced_arrays", "OES_element_index_uint", "OES_standard_derivatives", "OES_vertex_array_object", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_texture_float", "OES_texture_float_linear", "WEBGL_depth_texture", "EXT_shader_texture_lod", "WEBGL_compressed_texture_s3tc" ],
|
|
5328
|
+
"optionalExtensions": [ "ANGLE_instanced_arrays", "OES_element_index_uint", "OES_standard_derivatives", "OES_vertex_array_object", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_texture_float", "OES_texture_float_linear", "WEBGL_depth_texture", "EXT_shader_texture_lod", "WEBGL_compressed_texture_astc", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_compressed_texture_s3tc_srgb" ],
|
|
5321
5329
|
"offset": [ 0, 0 ]
|
|
5322
5330
|
}), Pn.registerRenderer("gl", mn);
|
|
5323
|
-
const Un = [],
|
|
5324
|
-
function
|
|
5331
|
+
const Un = [], Cn = [];
|
|
5332
|
+
function Rn(t, e) {
|
|
5325
5333
|
const n = new s.Coordinate(p(t), p(e));
|
|
5326
5334
|
return On.project(n).toArray();
|
|
5327
5335
|
}
|
|
5328
|
-
const
|
|
5336
|
+
const Fn = function() {
|
|
5329
5337
|
if ("undefined" != typeof self) return self;
|
|
5330
5338
|
if ("undefined" != typeof window) return window;
|
|
5331
5339
|
if ("undefined" != typeof global) return global;
|
|
5332
5340
|
throw new Error("unable to locate global object");
|
|
5333
|
-
},
|
|
5334
|
-
|
|
5335
|
-
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s =
|
|
5336
|
-
let i = `${r}\n const _____getGlobal = ${
|
|
5341
|
+
}, Dn = Fn(), kn = Dn.gl_trans__coders = Dn.gl_trans__coders || {};
|
|
5342
|
+
kn.inject = function(t) {
|
|
5343
|
+
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = Dn.gl_trans__coders = Dn.gl_trans__coders || {};
|
|
5344
|
+
let i = `${r}\n const _____getGlobal = ${Fn.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
|
|
5337
5345
|
for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
|
|
5338
5346
|
return i += "\n" + e.substring(r.length), i;
|
|
5339
|
-
},
|
|
5340
|
-
|
|
5341
|
-
},
|
|
5342
|
-
return
|
|
5347
|
+
}, kn.registerTranscoder = function(t, e) {
|
|
5348
|
+
kn[t] = e;
|
|
5349
|
+
}, kn.getTranscoder = function(t) {
|
|
5350
|
+
return kn[t];
|
|
5343
5351
|
};
|
|
5344
|
-
class
|
|
5345
|
-
constructor(t, e) {
|
|
5346
|
-
this.A = t, this.
|
|
5347
|
-
"image/crn":
|
|
5348
|
-
"image/ktx2":
|
|
5349
|
-
"image/cttf":
|
|
5350
|
-
"draco":
|
|
5352
|
+
class jn {
|
|
5353
|
+
constructor(t, e, n) {
|
|
5354
|
+
this.A = t, this.et = e || It, this.v = n, this.nt = {
|
|
5355
|
+
"image/crn": kn.crn && kn.crn(),
|
|
5356
|
+
"image/ktx2": kn.ktx2 && kn.ktx2(),
|
|
5357
|
+
"image/cttf": kn.ktx2 && kn.ktx2(),
|
|
5358
|
+
"draco": kn.draco && kn.draco()
|
|
5351
5359
|
};
|
|
5352
5360
|
}
|
|
5353
5361
|
static createEmptyB3DM() {
|
|
@@ -5358,18 +5366,19 @@
|
|
|
5358
5366
|
};
|
|
5359
5367
|
}
|
|
5360
5368
|
load(t, e, n = 0, r = 0) {
|
|
5361
|
-
return e ? (r || (r = e.byteLength), this.
|
|
5369
|
+
return e ? (r || (r = e.byteLength), this.rt(t, e, n, r)) : ft.getArrayBuffer(t, {}).then(e => {
|
|
5362
5370
|
const s = e.data;
|
|
5363
|
-
return r || (r = s.byteLength), this.
|
|
5371
|
+
return r || (r = s.byteLength), this.rt(t, s, n, r);
|
|
5364
5372
|
});
|
|
5365
5373
|
}
|
|
5366
|
-
|
|
5367
|
-
const s = this.
|
|
5374
|
+
rt(t, e, n, r) {
|
|
5375
|
+
const s = this.st(e, n, r, t);
|
|
5368
5376
|
if (s.error) return Promise.resolve(s);
|
|
5369
|
-
const i = t.substring(0, t.lastIndexOf("/")), o = new this.
|
|
5377
|
+
const i = t.substring(0, t.lastIndexOf("/")), o = new this.et(i, s.glb, {
|
|
5370
5378
|
transferable: !0,
|
|
5371
5379
|
requestImage: this.A,
|
|
5372
|
-
decoders: this.
|
|
5380
|
+
decoders: this.nt,
|
|
5381
|
+
supportedFormats: this.v
|
|
5373
5382
|
});
|
|
5374
5383
|
return o.load().then(e => {
|
|
5375
5384
|
e.url = `${t}-${n}-${r}`;
|
|
@@ -5386,7 +5395,7 @@
|
|
|
5386
5395
|
};
|
|
5387
5396
|
});
|
|
5388
5397
|
}
|
|
5389
|
-
|
|
5398
|
+
st(t, e, n, r) {
|
|
5390
5399
|
const s = new DataView(t, e, n), i = s.getUint32(4, !0);
|
|
5391
5400
|
if (1 !== i) {
|
|
5392
5401
|
const t = "Unsupported b3dm version: " + i + ", url:" + r;
|
|
@@ -5427,32 +5436,32 @@
|
|
|
5427
5436
|
glb: {
|
|
5428
5437
|
buffer: t,
|
|
5429
5438
|
byteOffset: f,
|
|
5430
|
-
byteLength: s.byteLength - f
|
|
5439
|
+
byteLength: s.byteLength + s.byteOffset - f
|
|
5431
5440
|
}
|
|
5432
5441
|
};
|
|
5433
5442
|
}
|
|
5434
|
-
|
|
5443
|
+
it() {
|
|
5435
5444
|
return null;
|
|
5436
5445
|
}
|
|
5437
5446
|
}
|
|
5438
|
-
class
|
|
5439
|
-
constructor(t, e) {
|
|
5440
|
-
this.A = t, this.
|
|
5441
|
-
"image/crn":
|
|
5442
|
-
"image/ktx2":
|
|
5443
|
-
"image/cttf":
|
|
5444
|
-
"draco":
|
|
5447
|
+
class zn {
|
|
5448
|
+
constructor(t, e, n) {
|
|
5449
|
+
this.A = t, this.et = e || It, this.v = n, this.nt = {
|
|
5450
|
+
"image/crn": kn.crn && kn.crn(),
|
|
5451
|
+
"image/ktx2": kn.ktx2 && kn.ktx2(),
|
|
5452
|
+
"image/cttf": kn.ktx2 && kn.ktx2(),
|
|
5453
|
+
"draco": kn.draco && kn.draco()
|
|
5445
5454
|
};
|
|
5446
5455
|
}
|
|
5447
5456
|
load(t, e, n = 0, r = 0) {
|
|
5448
|
-
return e ? (r || (r = e.byteLength), this.
|
|
5457
|
+
return e ? (r || (r = e.byteLength), this.rt(t, e, n, r)) : ft.getArrayBuffer(t, {}).then(e => {
|
|
5449
5458
|
const s = e.data;
|
|
5450
|
-
return r || (r = s.byteLength), this.
|
|
5459
|
+
return r || (r = s.byteLength), this.rt(t, s, n, r);
|
|
5451
5460
|
});
|
|
5452
5461
|
}
|
|
5453
|
-
|
|
5454
|
-
return this.
|
|
5455
|
-
const o = this.
|
|
5462
|
+
rt(t, e, n, r) {
|
|
5463
|
+
return this.ot(t, e, n, r).then(({gltf: s, transferables: i}) => {
|
|
5464
|
+
const o = this.at(e, n, r, t);
|
|
5456
5465
|
if (o.error) return Promise.resolve(o);
|
|
5457
5466
|
for (let t = 0; t < i.length; t++) -1 === o.transferables.indexOf(i[t]) && o.transferables.push(i[t]);
|
|
5458
5467
|
return delete s.transferables, Promise.resolve({
|
|
@@ -5467,19 +5476,20 @@
|
|
|
5467
5476
|
});
|
|
5468
5477
|
});
|
|
5469
5478
|
}
|
|
5470
|
-
|
|
5479
|
+
ot(t, e, n, r) {
|
|
5471
5480
|
const s = {
|
|
5472
5481
|
transferable: !0,
|
|
5473
5482
|
requestImage: this.A,
|
|
5474
|
-
decoders: this.
|
|
5483
|
+
decoders: this.nt,
|
|
5484
|
+
supportedFormats: this.v
|
|
5475
5485
|
}, i = new DataView(e, n, r), o = 32 + i.getUint32(12, !0) + i.getUint32(16, !0) + i.getUint32(20, !0) + i.getUint32(24, !0);
|
|
5476
5486
|
if (0 === i.getUint32(28, !0)) {
|
|
5477
5487
|
let r = T(new Uint8Array(e, o + n, i.byteLength - o));
|
|
5478
5488
|
-1 == r.indexOf("://") && (r = t.substring(0, t.lastIndexOf("/")) + "/" + r);
|
|
5479
|
-
return r.indexOf(".glb") > 0 ? ft.getArrayBuffer(r, {}).then(t => this.
|
|
5489
|
+
return r.indexOf(".glb") > 0 ? ft.getArrayBuffer(r, {}).then(t => this.ct(r, {
|
|
5480
5490
|
buffer: t.data,
|
|
5481
5491
|
byteOffset: 0
|
|
5482
|
-
}, s)) : ft.getJSON(r, {}).then(t => this.
|
|
5492
|
+
}, s)) : ft.getJSON(r, {}).then(t => this.ct(r, t, s));
|
|
5483
5493
|
}
|
|
5484
5494
|
{
|
|
5485
5495
|
const r = {
|
|
@@ -5487,11 +5497,11 @@
|
|
|
5487
5497
|
byteOffset: o + n,
|
|
5488
5498
|
byteLength: i.byteLength - o
|
|
5489
5499
|
};
|
|
5490
|
-
return this.
|
|
5500
|
+
return this.ct(t, r, s);
|
|
5491
5501
|
}
|
|
5492
5502
|
}
|
|
5493
|
-
|
|
5494
|
-
const r = t.substring(0, t.lastIndexOf("/")), s = new this.
|
|
5503
|
+
ct(t, e, n) {
|
|
5504
|
+
const r = t.substring(0, t.lastIndexOf("/")), s = new this.et(r, e, n);
|
|
5495
5505
|
return s.load({
|
|
5496
5506
|
skipAttributeTransform: !0
|
|
5497
5507
|
}).then(n => {
|
|
@@ -5503,7 +5513,7 @@
|
|
|
5503
5513
|
};
|
|
5504
5514
|
});
|
|
5505
5515
|
}
|
|
5506
|
-
|
|
5516
|
+
at(t, e, n, r) {
|
|
5507
5517
|
const s = new DataView(t, e, n), i = s.getUint32(4, !0);
|
|
5508
5518
|
if (1 !== i) {
|
|
5509
5519
|
const t = "Unsupported pnts version: " + i + ", url:" + r;
|
|
@@ -5536,7 +5546,7 @@
|
|
|
5536
5546
|
itemSize: 3,
|
|
5537
5547
|
count: l,
|
|
5538
5548
|
componentType: 5126,
|
|
5539
|
-
array: this.
|
|
5549
|
+
array: this.ht(new Uint16Array(t, r + c.offset, 3 * l), e, n)
|
|
5540
5550
|
}, o.push(f.POSITION.array.buffer);
|
|
5541
5551
|
}
|
|
5542
5552
|
if (a.BATCH_ID) {
|
|
@@ -5569,14 +5579,14 @@
|
|
|
5569
5579
|
itemSize: 3,
|
|
5570
5580
|
count: l,
|
|
5571
5581
|
componentType: 5126,
|
|
5572
|
-
array: this.
|
|
5582
|
+
array: this.ut(new Uint16Array(t, e + c.offset, 2 * l))
|
|
5573
5583
|
}, o.push(f.NORMAL_UP.array.buffer), e = a.NORMAL_RIGHT_OCT32P.byteOffset, f.NORMAL_RIGHT = {
|
|
5574
5584
|
byteStride: 0,
|
|
5575
5585
|
byteOffset: 0,
|
|
5576
5586
|
itemSize: 3,
|
|
5577
5587
|
count: l,
|
|
5578
5588
|
componentType: 5126,
|
|
5579
|
-
array: this.
|
|
5589
|
+
array: this.ut(new Uint16Array(t, e + c.offset, 2 * l))
|
|
5580
5590
|
}, o.push(f.NORMAL_RIGHT.array.buffer);
|
|
5581
5591
|
}
|
|
5582
5592
|
if (a.SCALE) {
|
|
@@ -5609,28 +5619,28 @@
|
|
|
5609
5619
|
transferables: o
|
|
5610
5620
|
};
|
|
5611
5621
|
}
|
|
5612
|
-
|
|
5622
|
+
ut(t) {
|
|
5613
5623
|
const e = t.length / 2, n = new Float32Array(3 * e), r = [];
|
|
5614
|
-
for (let s = 0; s < e; s++)
|
|
5624
|
+
for (let s = 0; s < e; s++) Vn(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
|
|
5615
5625
|
n[3 * s + 1] = r[1], n[3 * s + 2] = r[2];
|
|
5616
5626
|
return n;
|
|
5617
5627
|
}
|
|
5618
|
-
|
|
5628
|
+
ht(t, e, n) {
|
|
5619
5629
|
return me(new Float32Array(t.length), t, e, n);
|
|
5620
5630
|
}
|
|
5621
|
-
|
|
5631
|
+
it() {
|
|
5622
5632
|
return null;
|
|
5623
5633
|
}
|
|
5624
5634
|
}
|
|
5625
|
-
function
|
|
5626
|
-
if (t[0] =
|
|
5635
|
+
function Vn(t, e, n, r) {
|
|
5636
|
+
if (t[0] = Gn(e, r), t[1] = Gn(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
|
|
5627
5637
|
t[2] < 0) {
|
|
5628
5638
|
const e = t[0];
|
|
5629
|
-
t[0] = (1 - Math.abs(t[1])) *
|
|
5639
|
+
t[0] = (1 - Math.abs(t[1])) * Hn(e), t[1] = (1 - Math.abs(e)) * Hn(t[1]);
|
|
5630
5640
|
}
|
|
5631
5641
|
return D(t, t);
|
|
5632
5642
|
}
|
|
5633
|
-
function
|
|
5643
|
+
function Gn(t, e) {
|
|
5634
5644
|
return function(t, e, n) {
|
|
5635
5645
|
return t < e ? e : t > n ? n : t;
|
|
5636
5646
|
}(t, 0, e = function(t, e) {
|
|
@@ -5638,19 +5648,19 @@
|
|
|
5638
5648
|
return e;
|
|
5639
5649
|
}(e, 255)) / e * 2 - 1;
|
|
5640
5650
|
}
|
|
5641
|
-
function
|
|
5651
|
+
function Hn(t) {
|
|
5642
5652
|
return t < 0 ? -1 : 1;
|
|
5643
5653
|
}
|
|
5644
|
-
class
|
|
5654
|
+
class qn {
|
|
5645
5655
|
constructor() {}
|
|
5646
5656
|
load(t, e, n = 0, r = 0) {
|
|
5647
|
-
return e ? (r || (r = e.byteLength), this.
|
|
5657
|
+
return e ? (r || (r = e.byteLength), this.rt(t, e, n, r)) : ft.getArrayBuffer(t, {}).then(e => {
|
|
5648
5658
|
const s = e.data;
|
|
5649
|
-
return r || (r = s.byteLength), this.
|
|
5659
|
+
return r || (r = s.byteLength), this.rt(t, s, n, r);
|
|
5650
5660
|
});
|
|
5651
5661
|
}
|
|
5652
|
-
|
|
5653
|
-
return this.
|
|
5662
|
+
rt(t, e, n, r) {
|
|
5663
|
+
return this.ft(e, n, r, t).then(t => t.error ? t : {
|
|
5654
5664
|
magic: "pnts",
|
|
5655
5665
|
count: t.count,
|
|
5656
5666
|
transferables: t.transferables,
|
|
@@ -5660,7 +5670,7 @@
|
|
|
5660
5670
|
pnts: t.pnts
|
|
5661
5671
|
});
|
|
5662
5672
|
}
|
|
5663
|
-
|
|
5673
|
+
ft(t, e, n, r) {
|
|
5664
5674
|
const s = new DataView(t, e, n), i = s.getUint32(4, !0);
|
|
5665
5675
|
if (1 !== i) {
|
|
5666
5676
|
const t = "Unsupported pnts version: " + i + ", url:" + r;
|
|
@@ -5682,13 +5692,13 @@
|
|
|
5682
5692
|
attributes: y.properties,
|
|
5683
5693
|
useUniqueIDs: !1
|
|
5684
5694
|
};
|
|
5685
|
-
return this.
|
|
5695
|
+
return this.lt || (this.lt = kn.draco()), this.lt(m, e).then(e => {
|
|
5686
5696
|
const n = e.attributes;
|
|
5687
5697
|
!a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
|
|
5688
5698
|
n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
|
|
5689
5699
|
n.RGBA = a.RGBA, n.RGB565 = a.RGB565), !a.NORMAL && !a.NORMAL_OCT16P || n.NORMAL || n.NORMAL_OCT16P || (n.NORMAL = a.NORMAL,
|
|
5690
5700
|
n.NORMAL_OCT16P = a.NORMAL_OCT16P);
|
|
5691
|
-
const r = this.
|
|
5701
|
+
const r = this.dt(t, e.attributes, c.offset, d, o, f, l);
|
|
5692
5702
|
if (e.attributes.BATCH_ID) {
|
|
5693
5703
|
const t = e.attributes.BATCH_ID.array;
|
|
5694
5704
|
r.BATCH_ID = {
|
|
@@ -5700,7 +5710,7 @@
|
|
|
5700
5710
|
array: t
|
|
5701
5711
|
}, o.push(t.buffer);
|
|
5702
5712
|
} else if (a.BATCH_ID || Object.keys(h).length) {
|
|
5703
|
-
a.BATCH_ID ? r.BATCH_ID = ue(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID =
|
|
5713
|
+
a.BATCH_ID ? r.BATCH_ID = ue(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = $n(d);
|
|
5704
5714
|
const e = r.BATCH_ID.array && r.BATCH_ID.array.buffer;
|
|
5705
5715
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5706
5716
|
}
|
|
@@ -5714,9 +5724,9 @@
|
|
|
5714
5724
|
};
|
|
5715
5725
|
});
|
|
5716
5726
|
}
|
|
5717
|
-
const b = this.
|
|
5727
|
+
const b = this.dt(t, a, c.offset, d, o, f, l);
|
|
5718
5728
|
if (a.BATCH_ID || Object.keys(h).length) {
|
|
5719
|
-
a.BATCH_ID ? b.BATCH_ID = ue(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID =
|
|
5729
|
+
a.BATCH_ID ? b.BATCH_ID = ue(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = $n(d);
|
|
5720
5730
|
const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
|
|
5721
5731
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5722
5732
|
}
|
|
@@ -5729,7 +5739,7 @@
|
|
|
5729
5739
|
transferables: o
|
|
5730
5740
|
});
|
|
5731
5741
|
}
|
|
5732
|
-
|
|
5742
|
+
dt(t, e, n, r, s, i, o) {
|
|
5733
5743
|
const a = {};
|
|
5734
5744
|
if (e.POSITION) {
|
|
5735
5745
|
let {byteOffset: i, array: o} = e.POSITION;
|
|
@@ -5757,7 +5767,7 @@
|
|
|
5757
5767
|
itemSize: 3,
|
|
5758
5768
|
count: r,
|
|
5759
5769
|
componentType: 5126,
|
|
5760
|
-
array: this.
|
|
5770
|
+
array: this.ht(h || new Uint16Array(t, c + u, 3 * r), i, o)
|
|
5761
5771
|
}, s.push(a.POSITION.array.buffer);
|
|
5762
5772
|
}
|
|
5763
5773
|
if (e.RGBA) {
|
|
@@ -5844,14 +5854,14 @@
|
|
|
5844
5854
|
}
|
|
5845
5855
|
return a;
|
|
5846
5856
|
}
|
|
5847
|
-
|
|
5857
|
+
ht(t, e, n) {
|
|
5848
5858
|
return me(new Float32Array(t.length), t, e, n);
|
|
5849
5859
|
}
|
|
5850
|
-
|
|
5860
|
+
it() {
|
|
5851
5861
|
return null;
|
|
5852
5862
|
}
|
|
5853
5863
|
}
|
|
5854
|
-
function
|
|
5864
|
+
function $n(t) {
|
|
5855
5865
|
const e = O(t), n = new e(t);
|
|
5856
5866
|
for (let e = 0; e < t; e++) n[e] = e;
|
|
5857
5867
|
return {
|
|
@@ -5863,27 +5873,27 @@
|
|
|
5863
5873
|
array: n
|
|
5864
5874
|
};
|
|
5865
5875
|
}
|
|
5866
|
-
class
|
|
5876
|
+
class Jn {
|
|
5867
5877
|
constructor(t, e) {
|
|
5868
|
-
this.A = t, this.
|
|
5878
|
+
this.A = t, this.et = e || It;
|
|
5869
5879
|
}
|
|
5870
5880
|
load(t, e, n = 0, r = 0) {
|
|
5871
|
-
return e ? this.
|
|
5881
|
+
return e ? this.rt(t, e, n, r) : ft.getArrayBuffer(t, {}).then(e => {
|
|
5872
5882
|
const s = e.data;
|
|
5873
|
-
return this.
|
|
5883
|
+
return this.rt(t, s, n, r);
|
|
5874
5884
|
});
|
|
5875
5885
|
}
|
|
5876
|
-
|
|
5886
|
+
rt(t, e, n, r) {
|
|
5877
5887
|
r || (r = e.byteLength);
|
|
5878
|
-
const s = this.
|
|
5888
|
+
const s = this.yt(e, t, n, r), i = [];
|
|
5879
5889
|
for (let n = 0; n < s.length; n++) {
|
|
5880
5890
|
let r;
|
|
5881
|
-
if ("b3dm" === s[n].magic) r = new
|
|
5891
|
+
if ("b3dm" === s[n].magic) r = new jn(this.A, this.et); else if ("i3dm" === s[n].magic) r = new zn(this.A, this.et); else if ("pnts" === s[n].magic) r = new qn; else {
|
|
5882
5892
|
if ("cmpt" !== s[n].magic) {
|
|
5883
5893
|
console.warn("Unsupported magic in CMPT tile:", s[n].magic);
|
|
5884
5894
|
continue;
|
|
5885
5895
|
}
|
|
5886
|
-
r = new
|
|
5896
|
+
r = new Jn(this.A, this.et);
|
|
5887
5897
|
}
|
|
5888
5898
|
i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
|
|
5889
5899
|
}
|
|
@@ -5892,7 +5902,7 @@
|
|
|
5892
5902
|
tiles: t
|
|
5893
5903
|
}));
|
|
5894
5904
|
}
|
|
5895
|
-
|
|
5905
|
+
yt(t, e, n, r) {
|
|
5896
5906
|
const s = new DataView(t, n, r), i = s.getUint32(4, !0);
|
|
5897
5907
|
if (1 !== i) {
|
|
5898
5908
|
const t = "Unsupported cmpt version: " + i + ", url:" + e;
|
|
@@ -5900,12 +5910,6 @@
|
|
|
5900
5910
|
error: t
|
|
5901
5911
|
};
|
|
5902
5912
|
}
|
|
5903
|
-
if (s.getUint32(8, !0) !== s.byteLength) {
|
|
5904
|
-
const t = "Length in cmpt header is inconsistent with cmpt's byte length, url: " + e;
|
|
5905
|
-
return console.warn(t), {
|
|
5906
|
-
error: t
|
|
5907
|
-
};
|
|
5908
|
-
}
|
|
5909
5913
|
if (16 === s.byteLength) return [];
|
|
5910
5914
|
const o = [], a = s.getUint32(12, !0);
|
|
5911
5915
|
let c = 16;
|
|
@@ -5921,9 +5925,9 @@
|
|
|
5921
5925
|
return o;
|
|
5922
5926
|
}
|
|
5923
5927
|
}
|
|
5924
|
-
t.B3DMLoader =
|
|
5928
|
+
t.B3DMLoader = jn, t.CMPTLoader = Jn, t.Geo3DTilesLayer = Pn, t.Geo3DTilesUtil = x,
|
|
5925
5929
|
t.Geo3DTransform = re, Object.defineProperty(t, "t", {
|
|
5926
5930
|
value: !0
|
|
5927
5931
|
});
|
|
5928
|
-
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.
|
|
5932
|
+
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.12.1");
|
|
5929
5933
|
}));
|