@maptalks/3dtiles 0.11.0 → 0.11.4
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 +809 -785
- package/package.json +2 -2
package/dist/maptalks.3dtiles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/3dtiles v0.11.
|
|
2
|
+
* @maptalks/3dtiles v0.11.4
|
|
3
3
|
* LICENSE : UNLICENSED
|
|
4
4
|
* (c) 2016-2022 maptalks.com
|
|
5
5
|
*/
|
|
@@ -118,17 +118,17 @@
|
|
|
118
118
|
var t, n = (t = new e(4), e != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0),
|
|
119
119
|
t);
|
|
120
120
|
}();
|
|
121
|
-
var A,
|
|
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
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.23.
|
|
127
|
+
* @maptalks/gltf-loader v0.23.1
|
|
128
128
|
* LICENSE : UNLICENSED
|
|
129
129
|
* (c) 2016-2022 maptalks.org
|
|
130
130
|
*/
|
|
131
|
-
let
|
|
131
|
+
let O = 0;
|
|
132
132
|
function M(t) {
|
|
133
133
|
return null == t;
|
|
134
134
|
}
|
|
@@ -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 = [], C = [], U = [], B = [ 0, 0, 0 ], L = 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) {
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
const r = new Uint8Array(t, e, n);
|
|
201
201
|
return D.decode(r);
|
|
202
202
|
}
|
|
203
|
-
const
|
|
203
|
+
const z = {
|
|
204
204
|
get: function(t, e = {}) {
|
|
205
205
|
e || (e = {});
|
|
206
206
|
const n = new AbortController, r = {
|
|
@@ -230,22 +230,23 @@
|
|
|
230
230
|
statusText: t.statusText,
|
|
231
231
|
message: `incorrect http request with status code(${t.status}): ${t.statusText}`
|
|
232
232
|
} : "arraybuffer" === e ? t.arrayBuffer() : "json" === e ? t.json() : t.text(),
|
|
233
|
-
getArrayBuffer: (t, e = {}) => (e || (e = {}), e.responseType = "arraybuffer",
|
|
233
|
+
getArrayBuffer: (t, e = {}) => (e || (e = {}), e.responseType = "arraybuffer", z.get(t, e)),
|
|
234
234
|
getJSON: function(t, e = {}) {
|
|
235
|
-
return e && e.jsonp ?
|
|
236
|
-
},
|
|
237
|
-
jsonp: function(t) {
|
|
238
|
-
const e = "_maptalks_jsonp_" + v++;
|
|
239
|
-
t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
|
|
240
|
-
let n = document.createElement("script");
|
|
241
|
-
return n.type = "text/javascript", n.src = t, new Promise(t => {
|
|
242
|
-
window[e] = function(r) {
|
|
243
|
-
document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
|
|
244
|
-
t(r);
|
|
245
|
-
}, document.getElementsByTagName("head")[0].appendChild(n);
|
|
246
|
-
});
|
|
235
|
+
return e && e.jsonp ? z.jsonp(t) : ((e = e || {}).responseType = "json", z.get(t, e));
|
|
247
236
|
}
|
|
248
|
-
}
|
|
237
|
+
};
|
|
238
|
+
z.jsonp = function(t) {
|
|
239
|
+
const e = "_maptalks_jsonp_" + O++;
|
|
240
|
+
t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
|
|
241
|
+
let n = document.createElement("script");
|
|
242
|
+
return n.type = "text/javascript", n.src = t, new Promise(t => {
|
|
243
|
+
window[e] = function(r) {
|
|
244
|
+
document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
|
|
245
|
+
t(r);
|
|
246
|
+
}, document.getElementsByTagName("head")[0].appendChild(n);
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
const j = [ "SCALAR", 1, "VEC2", 2, "VEC3", 3, "VEC4", 4, "MAT2", 4, "MAT3", 9, "MAT4", 16 ];
|
|
249
250
|
class V {
|
|
250
251
|
constructor(t, e, n) {
|
|
251
252
|
this.rootPath = t, this.gltf = e, this.i = !1, this.glbBuffer = n, this.buffers = {},
|
|
@@ -280,14 +281,14 @@
|
|
|
280
281
|
});
|
|
281
282
|
if ("binary_glTF" !== t.buffer && "KHR_binary_glTF" !== t.buffer && e.uri) {
|
|
282
283
|
if (N(e.uri)) {
|
|
283
|
-
const t = this.buffers[e.id] =
|
|
284
|
+
const t = this.buffers[e.id] = E(e.uri);
|
|
284
285
|
return Promise.resolve({
|
|
285
286
|
buffer: t,
|
|
286
287
|
byteOffset: 0
|
|
287
288
|
});
|
|
288
289
|
}
|
|
289
290
|
const t = this.rootPath + "/" + e.uri;
|
|
290
|
-
return this.requests[e.id] =
|
|
291
|
+
return this.requests[e.id] = z.getArrayBuffer(t, null).then(t => ({
|
|
291
292
|
buffer: this.buffers[e.id] = t.data,
|
|
292
293
|
byteOffset: 0
|
|
293
294
|
}));
|
|
@@ -298,7 +299,8 @@
|
|
|
298
299
|
});
|
|
299
300
|
}
|
|
300
301
|
u(t, e, n, r = 0) {
|
|
301
|
-
const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.m(i.type), h = I(i.componentType), u = o.byteStride || 0
|
|
302
|
+
const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.m(i.type), h = I(i.componentType), u = o.byteStride || 0;
|
|
303
|
+
const f = {
|
|
302
304
|
array: void 0,
|
|
303
305
|
name: t,
|
|
304
306
|
accessorName: e,
|
|
@@ -331,8 +333,8 @@
|
|
|
331
333
|
r = 0), new s(t, r, n * e);
|
|
332
334
|
}
|
|
333
335
|
m(t) {
|
|
334
|
-
const e =
|
|
335
|
-
return
|
|
336
|
+
const e = j.indexOf(t);
|
|
337
|
+
return j[e + 1];
|
|
336
338
|
}
|
|
337
339
|
requestKHRTechniquesWebgl(t) {
|
|
338
340
|
const {shaders: e} = t, n = e.map(t => {
|
|
@@ -345,12 +347,12 @@
|
|
|
345
347
|
}
|
|
346
348
|
if (t.uri) {
|
|
347
349
|
if (N(t.uri)) {
|
|
348
|
-
const e =
|
|
350
|
+
const e = E(t.uri), n = k(e, 0, e.byteLength);
|
|
349
351
|
return t.content = n, Promise.resolve(t);
|
|
350
352
|
}
|
|
351
353
|
{
|
|
352
354
|
const e = this.rootPath + "/" + t.uri;
|
|
353
|
-
return
|
|
355
|
+
return z.get(e).then(e => (t.content = e, t));
|
|
354
356
|
}
|
|
355
357
|
}
|
|
356
358
|
return Promise.resolve(t);
|
|
@@ -382,7 +384,7 @@
|
|
|
382
384
|
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
385
|
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
386
|
t[15] = 1, t;
|
|
385
|
-
}(
|
|
387
|
+
}(P, e.translation || B), s = function(t, e) {
|
|
386
388
|
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
389
|
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
390
|
t[6] = d + y, t[7] = 0, t[8] = l + b, t[9] = d - y, t[10] = 1 - h - f, t[11] = 0,
|
|
@@ -408,7 +410,7 @@
|
|
|
408
410
|
r.instanceTechnique && r.instanceTechnique.values ? (s = r.instanceTechnique, i = s.values.diffuse) : (s = r,
|
|
409
411
|
i = s.values.tex || s.values.diffuseTex || s.values.diffuse);
|
|
410
412
|
const o = {
|
|
411
|
-
baseColorTexture: {
|
|
413
|
+
"baseColorTexture": {
|
|
412
414
|
index: i
|
|
413
415
|
}
|
|
414
416
|
};
|
|
@@ -427,7 +429,8 @@
|
|
|
427
429
|
}
|
|
428
430
|
{
|
|
429
431
|
const e = t.uri, n = this.rootPath + "/" + e;
|
|
430
|
-
|
|
432
|
+
if (this.requests[n]) return this.requests[n].then(() => this.buffers[n]);
|
|
433
|
+
return this.requests[n] = z.getArrayBuffer(n, null).then(t => {
|
|
431
434
|
const e = t.data;
|
|
432
435
|
return this.buffers[n] = e, new Uint8Array(e);
|
|
433
436
|
});
|
|
@@ -518,19 +521,20 @@
|
|
|
518
521
|
});
|
|
519
522
|
}
|
|
520
523
|
g(t) {
|
|
521
|
-
if (!S(t.bufferView)) return this.
|
|
524
|
+
if (!S(t.bufferView)) return this.v(t);
|
|
522
525
|
{
|
|
523
526
|
const e = this.gltf.bufferViews[t.bufferView];
|
|
524
527
|
if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
|
|
525
528
|
const n = this.gltf.buffers[e.buffer];
|
|
526
|
-
if (n.uri) return this.
|
|
529
|
+
if (n.uri) return this.O(n, e, t);
|
|
527
530
|
if (this.glbBuffer) return this.M(e, t);
|
|
528
531
|
}
|
|
529
532
|
return null;
|
|
530
533
|
}
|
|
531
|
-
|
|
534
|
+
v(t) {
|
|
532
535
|
const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
|
|
533
|
-
|
|
536
|
+
if (this.requests[t.id]) return this.requests[t.id].then(() => this.images[t.id]);
|
|
537
|
+
return this.requests[t.id] = this.S(t.id, e);
|
|
534
538
|
}
|
|
535
539
|
I(t, e) {
|
|
536
540
|
const n = this.decoders;
|
|
@@ -544,7 +548,7 @@
|
|
|
544
548
|
return this.S(e.id, r);
|
|
545
549
|
}
|
|
546
550
|
}
|
|
547
|
-
|
|
551
|
+
O(t, e, n) {
|
|
548
552
|
if (this.buffers[t.id]) {
|
|
549
553
|
const r = this.buffers[t.id], s = this.N(e, r);
|
|
550
554
|
return this.I(s, n);
|
|
@@ -554,10 +558,10 @@
|
|
|
554
558
|
return this.I(s, n);
|
|
555
559
|
});
|
|
556
560
|
if (N(t.uri)) {
|
|
557
|
-
const r = this.buffers[t.id] =
|
|
561
|
+
const r = this.buffers[t.id] = E(t.uri), s = this.N(e, r);
|
|
558
562
|
return this.I(s, n);
|
|
559
563
|
}
|
|
560
|
-
return this.requests[t.id] =
|
|
564
|
+
return this.requests[t.id] = z.getArrayBuffer(t.uri, null).then(r => {
|
|
561
565
|
const s = this.buffers[t.id] = r.data, i = this.N(e, s);
|
|
562
566
|
return this.I(i, n);
|
|
563
567
|
});
|
|
@@ -581,7 +585,8 @@
|
|
|
581
585
|
P(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
|
+
n.join("");
|
|
589
|
+
return "data:" + (e = e || "image/png") + ";base64," + function(t) {
|
|
585
590
|
return "undefined" != typeof self ? self.btoa(t) : window.btoa(t);
|
|
586
591
|
}(unescape(encodeURIComponent(n)));
|
|
587
592
|
}
|
|
@@ -605,19 +610,19 @@
|
|
|
605
610
|
});
|
|
606
611
|
}
|
|
607
612
|
}
|
|
608
|
-
const
|
|
609
|
-
class
|
|
613
|
+
const q = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null, $ = 1313821514, J = 5130562;
|
|
614
|
+
class K {
|
|
610
615
|
static read(t, e = 0, n = 0) {
|
|
611
616
|
n || (n = t.byteLength);
|
|
612
617
|
const r = new DataView(t, e, n), s = r.getUint32(4, !0);
|
|
613
|
-
if (1 === s) return
|
|
614
|
-
if (2 === s) return
|
|
618
|
+
if (1 === s) return K.readV1(r, e);
|
|
619
|
+
if (2 === s) return K.readV2(t, e);
|
|
615
620
|
throw new Error("Unsupported glb version : " + s);
|
|
616
621
|
}
|
|
617
622
|
static readV1(t, e) {
|
|
618
623
|
const n = t.getUint32(8, !0), r = t.getUint32(12, !0);
|
|
619
624
|
if (n !== t.byteLength) throw new Error("Length in GLB header is inconsistent with glb's byte length.");
|
|
620
|
-
const s =
|
|
625
|
+
const s = X(t.buffer, 20 + e, r);
|
|
621
626
|
return {
|
|
622
627
|
json: JSON.parse(s),
|
|
623
628
|
glbBuffer: {
|
|
@@ -635,7 +640,7 @@
|
|
|
635
640
|
const a = i.getUint32(o, !0);
|
|
636
641
|
o += 4;
|
|
637
642
|
const c = i.getUint32(o, !0);
|
|
638
|
-
if (o += 4,
|
|
643
|
+
if (o += 4, c === $) n = X(t, e + 12 + o, a); else if (c === J) {
|
|
639
644
|
s = e + 12 + o, r = a;
|
|
640
645
|
break;
|
|
641
646
|
}
|
|
@@ -651,10 +656,10 @@
|
|
|
651
656
|
};
|
|
652
657
|
}
|
|
653
658
|
}
|
|
654
|
-
function
|
|
655
|
-
if (
|
|
659
|
+
function X(t, e, n) {
|
|
660
|
+
if (q) {
|
|
656
661
|
const r = new Uint8Array(t, e, n);
|
|
657
|
-
return
|
|
662
|
+
return q.decode(r);
|
|
658
663
|
}
|
|
659
664
|
return function(t) {
|
|
660
665
|
const e = t.length;
|
|
@@ -662,7 +667,7 @@
|
|
|
662
667
|
for (let r = 0; r < e; ) {
|
|
663
668
|
let s = t[r++];
|
|
664
669
|
if (128 & s) {
|
|
665
|
-
let n =
|
|
670
|
+
let n = Z[s >> 3 & 7];
|
|
666
671
|
if (!(64 & s) || !n || r + n > e) return null;
|
|
667
672
|
for (s &= 63 >> n; n > 0; n -= 1) {
|
|
668
673
|
const e = t[r++];
|
|
@@ -675,17 +680,18 @@
|
|
|
675
680
|
return n;
|
|
676
681
|
}(new Uint8Array(t, e, n));
|
|
677
682
|
}
|
|
678
|
-
const
|
|
683
|
+
const Z = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
|
|
684
|
+
const W = [ 0, 0, 0 ], Y = [ 0, 0, 0, 1 ], Q = [ 1, 1, 1 ], tt = {
|
|
679
685
|
TRANSLATION: [ 0, 0, 0 ],
|
|
680
686
|
ROTATION: [ 0, 0, 0, 1 ],
|
|
681
687
|
SCALE: [ 1, 1, 1 ]
|
|
682
|
-
},
|
|
688
|
+
}, et = {
|
|
683
689
|
PREVIOUS: null,
|
|
684
690
|
NEXT: null,
|
|
685
691
|
PREINDEX: null,
|
|
686
692
|
NEXTINDEX: null,
|
|
687
693
|
INTERPOLATION: null
|
|
688
|
-
},
|
|
694
|
+
}, nt = {
|
|
689
695
|
C(t, e, n, r, s, i, o, c) {
|
|
690
696
|
const h = S(t) ? e.animations : [ e.animations[0] ], u = {};
|
|
691
697
|
for (let e = 0; e < h.length; e++) {
|
|
@@ -694,9 +700,9 @@
|
|
|
694
700
|
const l = f.channelsMap[n];
|
|
695
701
|
if (l) for (let t = 0; t < l.length; t++) {
|
|
696
702
|
const e = l[t];
|
|
697
|
-
"translation" === e.target.path ? (this.U(s, f.samplers[e.sampler], r, 1), u.translation = a(
|
|
698
|
-
u.rotation =
|
|
699
|
-
u.scale = a(
|
|
703
|
+
"translation" === e.target.path ? (this.U(s, f.samplers[e.sampler], r, 1), u.translation = a(W, s)) : "rotation" === e.target.path ? (this.B(i, f.samplers[e.sampler], r, 1),
|
|
704
|
+
u.rotation = v(Y, i)) : "scale" === e.target.path ? (this.U(o, f.samplers[e.sampler], r, 1),
|
|
705
|
+
u.scale = a(Q, o)) : "weights" === e.target.path && c && (this.U(c, f.samplers[e.sampler], r, c.length),
|
|
700
706
|
u.weights = c);
|
|
701
707
|
}
|
|
702
708
|
}
|
|
@@ -706,7 +712,7 @@
|
|
|
706
712
|
switch (e.interpolation) {
|
|
707
713
|
case "LINEAR":
|
|
708
714
|
{
|
|
709
|
-
const s = this.L(
|
|
715
|
+
const s = this.L(et, e, n, 1 * r);
|
|
710
716
|
s && (t = function(t, e, n, r) {
|
|
711
717
|
for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
|
|
712
718
|
return t;
|
|
@@ -716,7 +722,7 @@
|
|
|
716
722
|
|
|
717
723
|
case "STEP":
|
|
718
724
|
{
|
|
719
|
-
const s = this.L(
|
|
725
|
+
const s = this.L(et, e, n, 1 * r);
|
|
720
726
|
s && (t = function(t, e) {
|
|
721
727
|
for (let n = 0; n < t.length; n++) t[n] = e[n];
|
|
722
728
|
return t;
|
|
@@ -726,7 +732,7 @@
|
|
|
726
732
|
|
|
727
733
|
case "CUBICSPLINE":
|
|
728
734
|
{
|
|
729
|
-
const s = this.L(
|
|
735
|
+
const s = this.L(et, e, n, 3 * r);
|
|
730
736
|
s && (t = this.R(t, s, e.input.array, 3 * r));
|
|
731
737
|
break;
|
|
732
738
|
}
|
|
@@ -737,21 +743,21 @@
|
|
|
737
743
|
switch (e.interpolation) {
|
|
738
744
|
case "LINEAR":
|
|
739
745
|
{
|
|
740
|
-
const r = this.L(
|
|
746
|
+
const r = this.L(et, e, n, 1);
|
|
741
747
|
r && T(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
|
|
742
748
|
break;
|
|
743
749
|
}
|
|
744
750
|
|
|
745
751
|
case "STEP":
|
|
746
752
|
{
|
|
747
|
-
const r = this.L(
|
|
753
|
+
const r = this.L(et, e, n, 1);
|
|
748
754
|
r && (t = _(t, ...r.PREVIOUS));
|
|
749
755
|
break;
|
|
750
756
|
}
|
|
751
757
|
|
|
752
758
|
case "CUBICSPLINE":
|
|
753
759
|
{
|
|
754
|
-
const r = this.L(
|
|
760
|
+
const r = this.L(et, e, n, 3);
|
|
755
761
|
if (r) {
|
|
756
762
|
for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
|
|
757
763
|
r.NEXT[t] = Math.acos(r.NEXT[t]);
|
|
@@ -802,7 +808,8 @@
|
|
|
802
808
|
},
|
|
803
809
|
getAnimationClip(t, e, n, r) {
|
|
804
810
|
const s = t.nodes[e] && t.nodes[e].weights;
|
|
805
|
-
|
|
811
|
+
c(W, ...tt.TRANSLATION), _(Y, ...tt.ROTATION), c(Q, ...tt.SCALE);
|
|
812
|
+
return this.C(r, t, e, n, W, Y, Q, s);
|
|
806
813
|
},
|
|
807
814
|
getTimeSpan(t) {
|
|
808
815
|
if (!t.animations) return null;
|
|
@@ -827,14 +834,20 @@
|
|
|
827
834
|
return n ? S(e) ? n[e] : n[Object.keys(n)[0]] : null;
|
|
828
835
|
}
|
|
829
836
|
};
|
|
830
|
-
let
|
|
831
|
-
"undefined" != typeof OffscreenCanvas
|
|
832
|
-
|
|
833
|
-
|
|
837
|
+
let rt = !1;
|
|
838
|
+
if ("undefined" != typeof OffscreenCanvas) {
|
|
839
|
+
let t;
|
|
840
|
+
try {
|
|
841
|
+
t = new OffscreenCanvas(2, 2).getContext("2d");
|
|
842
|
+
} catch (t) {}
|
|
843
|
+
t && "undefined" != typeof createImageBitmap && (rt = !0);
|
|
844
|
+
}
|
|
845
|
+
const st = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
846
|
+
class it {
|
|
834
847
|
constructor(t, e, n) {
|
|
835
848
|
if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
|
|
836
849
|
e.buffer instanceof ArrayBuffer) {
|
|
837
|
-
const {json: n, glbBuffer: r} =
|
|
850
|
+
const {json: n, glbBuffer: r} = K.read(e.buffer, e.byteOffset, e.byteLength);
|
|
838
851
|
this.D(t, n, r);
|
|
839
852
|
} else this.D(t, e);
|
|
840
853
|
this.k = new V(this.rootPath, this.gltf, this.glbBuffer), this.j();
|
|
@@ -853,7 +866,7 @@
|
|
|
853
866
|
}
|
|
854
867
|
load(t) {
|
|
855
868
|
t = t || {};
|
|
856
|
-
const e = this.G(t), n = this.H(), r = this
|
|
869
|
+
const e = this.G(t), n = this.H(), r = this.q(), s = this.V();
|
|
857
870
|
return Promise.all([ e, n, r, s ]).then(t => (t[0].animations = t[1], t[0].textures = t[2],
|
|
858
871
|
t[0].extensions = t[3], t[0].transferables = this.transferables || [], this.createChannelsMap(t[0]),
|
|
859
872
|
t[0]));
|
|
@@ -885,10 +898,10 @@
|
|
|
885
898
|
return t;
|
|
886
899
|
}
|
|
887
900
|
static getAnimationClip(t, e, n, r) {
|
|
888
|
-
return
|
|
901
|
+
return nt.getAnimationClip(t, e, n, r);
|
|
889
902
|
}
|
|
890
903
|
static getAnimationTimeSpan(t, e) {
|
|
891
|
-
return
|
|
904
|
+
return nt.getTimeSpanByName(t, e);
|
|
892
905
|
}
|
|
893
906
|
static getTypedArrayCtor(t) {
|
|
894
907
|
return I(t);
|
|
@@ -898,7 +911,7 @@
|
|
|
898
911
|
}
|
|
899
912
|
D(t, e, n) {
|
|
900
913
|
this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
|
|
901
|
-
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = this.options.requestImage ||
|
|
914
|
+
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = rt ? ht : this.options.requestImage || ot,
|
|
902
915
|
this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new H(t, e, n, this.options.requestImage, this.options.decoders || {}),
|
|
903
916
|
this.adapter.iterate((t, e, n) => {
|
|
904
917
|
e.id = "buffer_" + n;
|
|
@@ -910,14 +923,14 @@
|
|
|
910
923
|
e.id = "accessor_" + n;
|
|
911
924
|
}, "accessors"));
|
|
912
925
|
}
|
|
913
|
-
|
|
926
|
+
$(t, e) {
|
|
914
927
|
if (t.children && t.children.length > 0) {
|
|
915
|
-
if (!(
|
|
928
|
+
if (!(n = t.children[0], "number" == typeof n && isFinite(n) || function(t) {
|
|
916
929
|
return !M(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
|
|
917
930
|
}(t.children[0]))) return t;
|
|
918
931
|
const r = t.children.map(t => {
|
|
919
932
|
const n = e[t];
|
|
920
|
-
return n.nodeIndex = t, this
|
|
933
|
+
return n.nodeIndex = t, this.$(n, e);
|
|
921
934
|
});
|
|
922
935
|
t.children = r;
|
|
923
936
|
}
|
|
@@ -928,7 +941,7 @@
|
|
|
928
941
|
return this.J(t).then(t => {
|
|
929
942
|
const e = this.scenes = [];
|
|
930
943
|
let n;
|
|
931
|
-
for (const e in t) t[e] = this
|
|
944
|
+
for (const e in t) t[e] = this.$(t[e], t), t[e].nodeIndex = Number(e) ? Number(e) : e;
|
|
932
945
|
this.adapter.iterate((r, s, i) => {
|
|
933
946
|
const o = {};
|
|
934
947
|
s.name && (o.name = s.name), s.nodes && (o.nodes = s.nodes.map(e => t[e])), this.gltf.scene === r && (n = i),
|
|
@@ -994,7 +1007,7 @@
|
|
|
994
1007
|
return x(n, t), n.primitives = e, n;
|
|
995
1008
|
});
|
|
996
1009
|
}
|
|
997
|
-
|
|
1010
|
+
q() {
|
|
998
1011
|
const t = this.gltf.textures;
|
|
999
1012
|
if (!t) return null;
|
|
1000
1013
|
const e = [];
|
|
@@ -1064,12 +1077,12 @@
|
|
|
1064
1077
|
});
|
|
1065
1078
|
}
|
|
1066
1079
|
}
|
|
1067
|
-
function
|
|
1080
|
+
function ot(t, e) {
|
|
1068
1081
|
const n = new Image;
|
|
1069
1082
|
n.crossOrigin = "", n.onload = () => {
|
|
1070
|
-
if (!
|
|
1071
|
-
|
|
1072
|
-
const t =
|
|
1083
|
+
if (!st) return void e(new Error("There is no canvas to draw image!"));
|
|
1084
|
+
st.width = n.width, st.height = n.height;
|
|
1085
|
+
const t = st.getContext("2d");
|
|
1073
1086
|
t.drawImage(n, 0, 0, n.width, n.height);
|
|
1074
1087
|
const r = t.getImageData(0, 0, n.width, n.height), s = {
|
|
1075
1088
|
width: n.width,
|
|
@@ -1081,11 +1094,11 @@
|
|
|
1081
1094
|
e(t);
|
|
1082
1095
|
}, n.src = t;
|
|
1083
1096
|
}
|
|
1084
|
-
let
|
|
1085
|
-
function
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
const n =
|
|
1097
|
+
let at, ct;
|
|
1098
|
+
function ht(t, e) {
|
|
1099
|
+
at || (at = new OffscreenCanvas(2, 2), ct = at.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
1100
|
+
at.width = t.width, at.height = t.height, ct.drawImage(t, 0, 0);
|
|
1101
|
+
const n = ct.getImageData(0, 0, at.width, at.height);
|
|
1089
1102
|
e(null, {
|
|
1090
1103
|
width: t.width,
|
|
1091
1104
|
height: t.height,
|
|
@@ -1093,20 +1106,20 @@
|
|
|
1093
1106
|
});
|
|
1094
1107
|
});
|
|
1095
1108
|
}
|
|
1096
|
-
function
|
|
1109
|
+
function ut(t) {
|
|
1097
1110
|
return t / Math.PI * 180;
|
|
1098
1111
|
}
|
|
1099
|
-
function
|
|
1112
|
+
function ft(t) {
|
|
1100
1113
|
return Math.sign ? Math.sign(t) : 0 === (t = +t) || isNaN(t) ? Number(t) : t > 0 ? 1 : -1;
|
|
1101
1114
|
}
|
|
1102
|
-
const
|
|
1103
|
-
function
|
|
1115
|
+
const lt = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
|
|
1116
|
+
function dt(t) {
|
|
1104
1117
|
const e = t.length;
|
|
1105
1118
|
let n = "";
|
|
1106
1119
|
for (let r = 0; r < e; ) {
|
|
1107
1120
|
let s = t[r++];
|
|
1108
1121
|
if (128 & s) {
|
|
1109
|
-
let n =
|
|
1122
|
+
let n = lt[s >> 3 & 7];
|
|
1110
1123
|
if (!(64 & s) || !n || r + n > e) return null;
|
|
1111
1124
|
for (s &= 63 >> n; n > 0; n -= 1) {
|
|
1112
1125
|
const e = t[r++];
|
|
@@ -1119,37 +1132,37 @@
|
|
|
1119
1132
|
return n;
|
|
1120
1133
|
}
|
|
1121
1134
|
new Array(3), new Array(3);
|
|
1122
|
-
const
|
|
1123
|
-
function
|
|
1124
|
-
const n =
|
|
1125
|
-
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(
|
|
1135
|
+
const mt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], yt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], bt = new Array(3), pt = new Array(3), wt = new Array(3);
|
|
1136
|
+
function _t(t, e) {
|
|
1137
|
+
const n = yt, r = function(t, e, n, r, s) {
|
|
1138
|
+
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(gt, e, b);
|
|
1126
1139
|
if (y < s) return isFinite(b) ? p : void 0;
|
|
1127
|
-
const w = r[0], _ = r[1], g = r[2], T =
|
|
1140
|
+
const w = r[0], _ = r[1], g = r[2], T = Tt;
|
|
1128
1141
|
T[0] = p[0] * w * 2, T[1] = p[1] * _ * 2, T[2] = p[2] * g * 2;
|
|
1129
|
-
let A,
|
|
1142
|
+
let A, v, O, M, S, x, I, N, E, P, C, U = (1 - b) * At(e) / (.5 * At(T)), B = 0;
|
|
1130
1143
|
do {
|
|
1131
|
-
U -= B,
|
|
1132
|
-
I = M * M, N = S * S,
|
|
1133
|
-
|
|
1134
|
-
B = A / (-2 *
|
|
1144
|
+
U -= B, O = 1 / (1 + U * w), M = 1 / (1 + U * _), S = 1 / (1 + U * g), x = O * O,
|
|
1145
|
+
I = M * M, N = S * S, E = x * O, P = I * M, C = N * S, A = l * x + d * I + m * N - 1,
|
|
1146
|
+
v = l * E * w + d * P * _ + m * C * g;
|
|
1147
|
+
B = A / (-2 * v);
|
|
1135
1148
|
} while (Math.abs(A) > 1e-12);
|
|
1136
|
-
return t[0] = i *
|
|
1137
|
-
}(
|
|
1138
|
-
let s = p(
|
|
1149
|
+
return t[0] = i * O, t[1] = o * M, t[2] = a * S, t;
|
|
1150
|
+
}(bt, e, mt, n, .1);
|
|
1151
|
+
let s = p(pt, r, n);
|
|
1139
1152
|
s = function(t, e) {
|
|
1140
1153
|
const n = e[0], r = e[1], s = e[2];
|
|
1141
1154
|
let i = n * n + r * r + s * s;
|
|
1142
1155
|
i > 0 && (i = Math.sqrt(i), t[0] = e[0] / i, t[1] = e[1] / i, t[2] = e[2] / i);
|
|
1143
1156
|
return t;
|
|
1144
1157
|
}(s, s);
|
|
1145
|
-
const i = b(
|
|
1146
|
-
return t[0] =
|
|
1158
|
+
const i = b(wt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = ft(d(i, e)) * At(i);
|
|
1159
|
+
return t[0] = ut(o), t[1] = ut(a), t[2] = c, t;
|
|
1147
1160
|
}
|
|
1148
|
-
const
|
|
1149
|
-
function
|
|
1161
|
+
const gt = new Array(3), Tt = new Array(3);
|
|
1162
|
+
function At(t) {
|
|
1150
1163
|
return i(t);
|
|
1151
1164
|
}
|
|
1152
|
-
function
|
|
1165
|
+
function vt(t, e) {
|
|
1153
1166
|
let n = "";
|
|
1154
1167
|
for (let r = 0; r < 4; r++) {
|
|
1155
1168
|
const s = t.getUint8(e + r);
|
|
@@ -1157,27 +1170,27 @@
|
|
|
1157
1170
|
}
|
|
1158
1171
|
return n;
|
|
1159
1172
|
}
|
|
1160
|
-
const
|
|
1161
|
-
function
|
|
1173
|
+
const Ot = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
1174
|
+
function Mt(t, e, n) {
|
|
1162
1175
|
const r = new Uint8Array(t, e, n);
|
|
1163
|
-
return
|
|
1176
|
+
return Ot ? JSON.parse(Ot.decode(r)) : JSON.parse(dt(r));
|
|
1164
1177
|
}
|
|
1165
|
-
function
|
|
1178
|
+
function St(t, e, n) {
|
|
1166
1179
|
const r = new Uint8Array(t, e, n);
|
|
1167
|
-
return
|
|
1180
|
+
return Ot ? JSON.parse(Ot.decode(r)) : JSON.parse(dt(r));
|
|
1168
1181
|
}
|
|
1169
|
-
function
|
|
1182
|
+
function xt(t, e, n) {
|
|
1170
1183
|
return {
|
|
1171
1184
|
offset: e,
|
|
1172
1185
|
byteLength: n
|
|
1173
1186
|
};
|
|
1174
1187
|
}
|
|
1175
|
-
function
|
|
1188
|
+
function It(t, e, n, r) {
|
|
1176
1189
|
const {byteOffset: s, componentType: i, type: o} = t, {ctor: a, type: c} = function(t) {
|
|
1177
|
-
return
|
|
1190
|
+
return Pt[t];
|
|
1178
1191
|
}(i), h = function(t) {
|
|
1179
1192
|
if (!t) return 1;
|
|
1180
|
-
return
|
|
1193
|
+
return Et[t];
|
|
1181
1194
|
}(o);
|
|
1182
1195
|
return {
|
|
1183
1196
|
byteStride: 0,
|
|
@@ -1188,18 +1201,19 @@
|
|
|
1188
1201
|
array: new a(e, n + s, r * h)
|
|
1189
1202
|
};
|
|
1190
1203
|
}
|
|
1191
|
-
function
|
|
1192
|
-
|
|
1204
|
+
function Nt(t, e, n, r) {
|
|
1205
|
+
t.componentType || (t.componentType = "UNSIGNED_SHORT");
|
|
1206
|
+
const s = It(t, e, n, r);
|
|
1193
1207
|
return s.array.buffer.byteLength !== e.byteLength && (s.array = s.array.slice()),
|
|
1194
1208
|
s;
|
|
1195
1209
|
}
|
|
1196
|
-
const
|
|
1210
|
+
const Et = {
|
|
1197
1211
|
"SCALAR": 1,
|
|
1198
1212
|
"VEC2": 2,
|
|
1199
1213
|
"VEC3": 3,
|
|
1200
1214
|
"VEC4": 4
|
|
1201
1215
|
};
|
|
1202
|
-
const
|
|
1216
|
+
const Pt = {
|
|
1203
1217
|
"BYTE": {
|
|
1204
1218
|
ctor: Int8Array,
|
|
1205
1219
|
type: 5120,
|
|
@@ -1241,27 +1255,27 @@
|
|
|
1241
1255
|
name: "Float64Array"
|
|
1242
1256
|
}
|
|
1243
1257
|
};
|
|
1244
|
-
function
|
|
1245
|
-
for (let e in
|
|
1258
|
+
function Ct(t) {
|
|
1259
|
+
for (let e in Pt) if (t === Pt[e].ctor) return Pt[e].type;
|
|
1246
1260
|
throw new Error("unrecognized ctor:" + t);
|
|
1247
1261
|
}
|
|
1248
|
-
function
|
|
1262
|
+
function Ut(t, e, n, r) {
|
|
1249
1263
|
const s = t, i = e.length / 3;
|
|
1250
1264
|
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],
|
|
1251
1265
|
s[3 * t + 2] = e[3 * t + 2] / 65535 * r[2] + n[2];
|
|
1252
1266
|
return s;
|
|
1253
1267
|
}
|
|
1254
|
-
function
|
|
1268
|
+
function Bt(t, e, n) {
|
|
1255
1269
|
let r = t.getUint32(12, !0), s = t.getUint32(16, !0), i = t.getUint32(20, !0), o = t.getUint32(24, !0);
|
|
1256
1270
|
const a = t.buffer;
|
|
1257
1271
|
let c, h, u = {}, f = {};
|
|
1258
|
-
r > 0 && (u =
|
|
1272
|
+
r > 0 && (u = Mt(a, e, r), e += r), s > 0 && (c = function(t, e, n) {
|
|
1259
1273
|
return {
|
|
1260
1274
|
offset: e,
|
|
1261
1275
|
byteLength: n
|
|
1262
1276
|
};
|
|
1263
|
-
}(0, e, s), e += s), i > 0 && (f =
|
|
1264
|
-
const l =
|
|
1277
|
+
}(0, e, s), e += s), i > 0 && (f = St(a, e, i), e += i);
|
|
1278
|
+
const l = xt(0, e, o);
|
|
1265
1279
|
return h = a.slice(l.offset, l.offset + l.byteLength), n.push(h), {
|
|
1266
1280
|
featureTable: u,
|
|
1267
1281
|
featureTableBin: c,
|
|
@@ -1269,28 +1283,28 @@
|
|
|
1269
1283
|
batchTableBin: h
|
|
1270
1284
|
};
|
|
1271
1285
|
}
|
|
1272
|
-
var
|
|
1286
|
+
var Lt = {
|
|
1273
1287
|
north: [ -1, 0, 0 ],
|
|
1274
1288
|
east: [ 0, 1, 0 ],
|
|
1275
1289
|
up: [ 0, 0, 1 ],
|
|
1276
1290
|
south: [ 1, 0, 0 ],
|
|
1277
1291
|
west: [ 0, -1, 0 ],
|
|
1278
1292
|
down: [ 0, 0, -1 ]
|
|
1279
|
-
},
|
|
1293
|
+
}, Rt = {}, Ft = {
|
|
1280
1294
|
east: [],
|
|
1281
1295
|
north: [],
|
|
1282
1296
|
up: [],
|
|
1283
1297
|
west: [],
|
|
1284
1298
|
south: [],
|
|
1285
1299
|
down: []
|
|
1286
|
-
},
|
|
1287
|
-
const
|
|
1288
|
-
function
|
|
1300
|
+
}, Dt = [], kt = [], zt = [];
|
|
1301
|
+
const jt = [ 0, 0, 0 ];
|
|
1302
|
+
function Vt(t, e, n, r) {
|
|
1289
1303
|
n = n || 0, r = r || n;
|
|
1290
1304
|
var s = Math.abs(t - e);
|
|
1291
1305
|
return s <= r || s <= n * Math.max(Math.abs(t), Math.abs(e));
|
|
1292
1306
|
}
|
|
1293
|
-
const
|
|
1307
|
+
const Gt = (Jt = {
|
|
1294
1308
|
up: {
|
|
1295
1309
|
south: "east",
|
|
1296
1310
|
north: "west",
|
|
@@ -1327,54 +1341,53 @@
|
|
|
1327
1341
|
north: "up",
|
|
1328
1342
|
south: "down"
|
|
1329
1343
|
}
|
|
1330
|
-
}[
|
|
1331
|
-
if (
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
a(Rt, Ut[Vt]), "east" !== Vt && "west" !== Vt && f(Rt, Rt, r), a(Ft, Ut[Gt]), "east" !== Gt && "west" !== Gt && f(Ft, Ft, r),
|
|
1337
|
-
a(Dt, Ut[$t]), "east" !== $t && "west" !== $t && f(Dt, Dt, r);
|
|
1344
|
+
}[Ht = "east"][qt = "north"], Rt[Kt = Ht + qt] ? $t = Rt[Kt] : ($t = function(t, e, n) {
|
|
1345
|
+
if (c = jt, h = (o = t)[0], d = o[1], y = o[2], b = c[0], p = c[1], w = c[2], Math.abs(h - b) <= 1e-6 * Math.max(1, Math.abs(h), Math.abs(b)) && Math.abs(d - p) <= 1e-6 * Math.max(1, Math.abs(d), Math.abs(p)) && Math.abs(y - w) <= 1e-6 * Math.max(1, Math.abs(y), Math.abs(w))) a(Dt, Lt[Ht]),
|
|
1346
|
+
a(kt, Lt[qt]), a(zt, Lt[Jt]); else if (Vt(t[0], 0, 1e-14) && Vt(t[1], 0, 1e-14)) {
|
|
1347
|
+
var r = ft(t[2]);
|
|
1348
|
+
a(Dt, Lt[Ht]), "east" !== Ht && "west" !== Ht && f(Dt, Dt, r), a(kt, Lt[qt]), "east" !== qt && "west" !== qt && f(kt, kt, r),
|
|
1349
|
+
a(zt, Lt[Jt]), "east" !== Jt && "west" !== Jt && f(zt, zt, r);
|
|
1338
1350
|
} else {
|
|
1339
1351
|
!function(t, e) {
|
|
1340
|
-
u(e, t,
|
|
1341
|
-
}(t,
|
|
1342
|
-
var s =
|
|
1343
|
-
i[0] = -t[1], i[1] = t[0], i[2] = 0, l(
|
|
1344
|
-
f(
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
n[
|
|
1352
|
+
u(e, t, yt), l(e, e);
|
|
1353
|
+
}(t, Ft.up);
|
|
1354
|
+
var s = Ft.up, i = Ft.east;
|
|
1355
|
+
i[0] = -t[1], i[1] = t[0], i[2] = 0, l(Ft.east, i), m(Ft.north, s, i), f(Ft.down, Ft.up, -1),
|
|
1356
|
+
f(Ft.west, Ft.east, -1), f(Ft.south, Ft.north, -1), Dt = Ft[Ht], kt = Ft[qt], zt = Ft[Jt];
|
|
1357
|
+
}
|
|
1358
|
+
var o, c, h, d, y, b, p, w;
|
|
1359
|
+
return n[0] = Dt[0], n[1] = Dt[1], n[2] = Dt[2], n[3] = 0, n[4] = kt[0], n[5] = kt[1],
|
|
1360
|
+
n[6] = kt[2], n[7] = 0, n[8] = zt[0], n[9] = zt[1], n[10] = zt[2], n[11] = 0, n[12] = t[0],
|
|
1348
1361
|
n[13] = t[1], n[14] = t[2], n[15] = 1, n;
|
|
1349
|
-
},
|
|
1362
|
+
}, Rt[Kt] = $t), $t);
|
|
1350
1363
|
/*!
|
|
1351
1364
|
* @maptalks/gl v0.64.0
|
|
1352
1365
|
* LICENSE : UNLICENSED
|
|
1353
1366
|
* (c) 2016-2022 maptalks.com
|
|
1354
|
-
*/ var
|
|
1355
|
-
const
|
|
1367
|
+
*/ var Ht, qt, $t, Jt, Kt;
|
|
1368
|
+
const Xt = function() {
|
|
1356
1369
|
if ("undefined" != typeof self) return self;
|
|
1357
1370
|
if ("undefined" != typeof window) return window;
|
|
1358
1371
|
if ("undefined" != typeof global) return global;
|
|
1359
1372
|
throw new Error("unable to locate global object");
|
|
1360
|
-
},
|
|
1361
|
-
|
|
1362
|
-
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s =
|
|
1363
|
-
let i = `${r}\n const _____getGlobal = ${
|
|
1373
|
+
}, Zt = Xt(), Wt = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
|
|
1374
|
+
Wt.inject = function(t) {
|
|
1375
|
+
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
|
|
1376
|
+
let i = `${r}\n const _____getGlobal = ${Xt.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
|
|
1364
1377
|
for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
|
|
1365
1378
|
return i += "\n" + e.substring(r.length), i;
|
|
1366
|
-
},
|
|
1367
|
-
|
|
1368
|
-
},
|
|
1369
|
-
return
|
|
1379
|
+
}, Wt.registerTranscoder = function(t, e) {
|
|
1380
|
+
Wt[t] = e;
|
|
1381
|
+
}, Wt.getTranscoder = function(t) {
|
|
1382
|
+
return Wt[t];
|
|
1370
1383
|
};
|
|
1371
|
-
class
|
|
1384
|
+
class Yt {
|
|
1372
1385
|
constructor(t, e) {
|
|
1373
|
-
this.A = t, this.tt = e ||
|
|
1374
|
-
"image/crn":
|
|
1375
|
-
"image/ktx2":
|
|
1376
|
-
"image/cttf":
|
|
1377
|
-
"draco":
|
|
1386
|
+
this.A = t, this.tt = e || it, this.et = {
|
|
1387
|
+
"image/crn": Wt.crn && Wt.crn(),
|
|
1388
|
+
"image/ktx2": Wt.ktx2 && Wt.ktx2(),
|
|
1389
|
+
"image/cttf": Wt.ktx2 && Wt.ktx2(),
|
|
1390
|
+
"draco": Wt.draco && Wt.draco()
|
|
1378
1391
|
};
|
|
1379
1392
|
}
|
|
1380
1393
|
static createEmptyB3DM() {
|
|
@@ -1385,7 +1398,7 @@
|
|
|
1385
1398
|
};
|
|
1386
1399
|
}
|
|
1387
1400
|
load(t, e, n = 0, r = 0) {
|
|
1388
|
-
return e ? (r || (r = e.byteLength), this.nt(t, e, n, r)) :
|
|
1401
|
+
return e ? (r || (r = e.byteLength), this.nt(t, e, n, r)) : z.getArrayBuffer(t, {}).then(e => {
|
|
1389
1402
|
const s = e.data;
|
|
1390
1403
|
return r || (r = s.byteLength), this.nt(t, s, n, r);
|
|
1391
1404
|
});
|
|
@@ -1395,6 +1408,7 @@
|
|
|
1395
1408
|
if (s.error) return Promise.resolve(s);
|
|
1396
1409
|
const i = t.substring(0, t.lastIndexOf("/")), o = new this.tt(i, s.glb, {
|
|
1397
1410
|
transferable: !0,
|
|
1411
|
+
requestImage: this.A,
|
|
1398
1412
|
decoders: this.et
|
|
1399
1413
|
});
|
|
1400
1414
|
return o.load().then(e => {
|
|
@@ -1431,15 +1445,15 @@
|
|
|
1431
1445
|
o = h, h = a, u = c, a = 0, c = 0);
|
|
1432
1446
|
const l = [ t ];
|
|
1433
1447
|
let d, m, y;
|
|
1434
|
-
if (a > 0 ? (d =
|
|
1448
|
+
if (a > 0 ? (d = Mt(t, f, a), f += a, o = d.BATCH_LENGTH) : d = {
|
|
1435
1449
|
"BATCH_LENGTH": o
|
|
1436
|
-
}, c > 0 && (f += c), h > 0 && (m =
|
|
1437
|
-
const e =
|
|
1450
|
+
}, c > 0 && (f += c), h > 0 && (m = St(t, f, h), f += h, u > 0)) {
|
|
1451
|
+
const e = xt(0, f, u);
|
|
1438
1452
|
y = t.slice(e.offset, e.offset + e.byteLength), f += u, l.push(y);
|
|
1439
1453
|
}
|
|
1440
1454
|
const b = d.BATCH_LENGTH, p = {};
|
|
1441
1455
|
if (d && d.BATCH_ID) {
|
|
1442
|
-
p.BATCH_ID =
|
|
1456
|
+
p.BATCH_ID = Nt(d.BATCH_ID, t, (void 0).offset, b);
|
|
1443
1457
|
const e = p.BATCH_ID.array && p.BATCH_ID.array.buffer;
|
|
1444
1458
|
e && l.indexOf(e) < 0 && l.push(e);
|
|
1445
1459
|
}
|
|
@@ -1453,7 +1467,7 @@
|
|
|
1453
1467
|
glb: {
|
|
1454
1468
|
buffer: t,
|
|
1455
1469
|
byteOffset: f,
|
|
1456
|
-
byteLength: s.byteLength - f
|
|
1470
|
+
byteLength: s.byteLength + s.byteOffset - f
|
|
1457
1471
|
}
|
|
1458
1472
|
};
|
|
1459
1473
|
}
|
|
@@ -1461,17 +1475,17 @@
|
|
|
1461
1475
|
return null;
|
|
1462
1476
|
}
|
|
1463
1477
|
}
|
|
1464
|
-
class
|
|
1478
|
+
class Qt {
|
|
1465
1479
|
constructor(t, e) {
|
|
1466
|
-
this.A = t, this.tt = e ||
|
|
1467
|
-
"image/crn":
|
|
1468
|
-
"image/ktx2":
|
|
1469
|
-
"image/cttf":
|
|
1470
|
-
"draco":
|
|
1480
|
+
this.A = t, this.tt = e || it, this.et = {
|
|
1481
|
+
"image/crn": Wt.crn && Wt.crn(),
|
|
1482
|
+
"image/ktx2": Wt.ktx2 && Wt.ktx2(),
|
|
1483
|
+
"image/cttf": Wt.ktx2 && Wt.ktx2(),
|
|
1484
|
+
"draco": Wt.draco && Wt.draco()
|
|
1471
1485
|
};
|
|
1472
1486
|
}
|
|
1473
1487
|
load(t, e, n = 0, r = 0) {
|
|
1474
|
-
return e ? (r || (r = e.byteLength), this.nt(t, e, n, r)) :
|
|
1488
|
+
return e ? (r || (r = e.byteLength), this.nt(t, e, n, r)) : z.getArrayBuffer(t, {}).then(e => {
|
|
1475
1489
|
const s = e.data;
|
|
1476
1490
|
return r || (r = s.byteLength), this.nt(t, s, n, r);
|
|
1477
1491
|
});
|
|
@@ -1496,15 +1510,16 @@
|
|
|
1496
1510
|
it(t, e, n, r) {
|
|
1497
1511
|
const s = {
|
|
1498
1512
|
transferable: !0,
|
|
1513
|
+
requestImage: this.A,
|
|
1499
1514
|
decoders: this.et
|
|
1500
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);
|
|
1501
1516
|
if (0 === i.getUint32(28, !0)) {
|
|
1502
|
-
let r =
|
|
1517
|
+
let r = dt(new Uint8Array(e, o + n, i.byteLength - o));
|
|
1503
1518
|
-1 == r.indexOf("://") && (r = t.substring(0, t.lastIndexOf("/")) + "/" + r);
|
|
1504
|
-
return r.indexOf(".glb") > 0 ?
|
|
1519
|
+
return r.indexOf(".glb") > 0 ? z.getArrayBuffer(r, {}).then(t => this.at(r, {
|
|
1505
1520
|
buffer: t.data,
|
|
1506
1521
|
byteOffset: 0
|
|
1507
|
-
}, s)) :
|
|
1522
|
+
}, s)) : z.getJSON(r, {}).then(t => this.at(r, t, s));
|
|
1508
1523
|
}
|
|
1509
1524
|
{
|
|
1510
1525
|
const r = {
|
|
@@ -1542,7 +1557,7 @@
|
|
|
1542
1557
|
error: t
|
|
1543
1558
|
};
|
|
1544
1559
|
}
|
|
1545
|
-
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} =
|
|
1560
|
+
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = Bt(s, 32 + e, o), f = {}, l = a.INSTANCES_LENGTH;
|
|
1546
1561
|
if (a.POSITION) {
|
|
1547
1562
|
const {byteOffset: e} = a.POSITION;
|
|
1548
1563
|
f.POSITION = {
|
|
@@ -1565,7 +1580,7 @@
|
|
|
1565
1580
|
}, o.push(f.POSITION.array.buffer);
|
|
1566
1581
|
}
|
|
1567
1582
|
if (a.BATCH_ID) {
|
|
1568
|
-
f.BATCH_ID =
|
|
1583
|
+
f.BATCH_ID = Nt(a.BATCH_ID, t, c.offset, l);
|
|
1569
1584
|
const e = f.BATCH_ID.array && f.BATCH_ID.array.buffer;
|
|
1570
1585
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
1571
1586
|
}
|
|
@@ -1636,26 +1651,26 @@
|
|
|
1636
1651
|
}
|
|
1637
1652
|
ht(t) {
|
|
1638
1653
|
const e = t.length / 2, n = new Float32Array(3 * e), r = [];
|
|
1639
|
-
for (let s = 0; s < e; s++)
|
|
1654
|
+
for (let s = 0; s < e; s++) te(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
|
|
1640
1655
|
n[3 * s + 1] = r[1], n[3 * s + 2] = r[2];
|
|
1641
1656
|
return n;
|
|
1642
1657
|
}
|
|
1643
1658
|
ct(t, e, n) {
|
|
1644
|
-
return
|
|
1659
|
+
return Ut(new Float32Array(t.length), t, e, n);
|
|
1645
1660
|
}
|
|
1646
1661
|
st() {
|
|
1647
1662
|
return null;
|
|
1648
1663
|
}
|
|
1649
1664
|
}
|
|
1650
|
-
function
|
|
1651
|
-
if (t[0] =
|
|
1665
|
+
function te(t, e, n, r) {
|
|
1666
|
+
if (t[0] = ee(e, r), t[1] = ee(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
|
|
1652
1667
|
t[2] < 0) {
|
|
1653
1668
|
const e = t[0];
|
|
1654
|
-
t[0] = (1 - Math.abs(t[1])) *
|
|
1669
|
+
t[0] = (1 - Math.abs(t[1])) * ne(e), t[1] = (1 - Math.abs(e)) * ne(t[1]);
|
|
1655
1670
|
}
|
|
1656
1671
|
return l(t, t);
|
|
1657
1672
|
}
|
|
1658
|
-
function
|
|
1673
|
+
function ee(t, e) {
|
|
1659
1674
|
return function(t, e, n) {
|
|
1660
1675
|
return t < e ? e : t > n ? n : t;
|
|
1661
1676
|
}(t, 0, e = function(t, e) {
|
|
@@ -1663,13 +1678,13 @@
|
|
|
1663
1678
|
return e;
|
|
1664
1679
|
}(e, 255)) / e * 2 - 1;
|
|
1665
1680
|
}
|
|
1666
|
-
function
|
|
1681
|
+
function ne(t) {
|
|
1667
1682
|
return t < 0 ? -1 : 1;
|
|
1668
1683
|
}
|
|
1669
|
-
class
|
|
1684
|
+
class re {
|
|
1670
1685
|
constructor() {}
|
|
1671
1686
|
load(t, e, n = 0, r = 0) {
|
|
1672
|
-
return e ? (r || (r = e.byteLength), this.nt(t, e, n, r)) :
|
|
1687
|
+
return e ? (r || (r = e.byteLength), this.nt(t, e, n, r)) : z.getArrayBuffer(t, {}).then(e => {
|
|
1673
1688
|
const s = e.data;
|
|
1674
1689
|
return r || (r = s.byteLength), this.nt(t, s, n, r);
|
|
1675
1690
|
});
|
|
@@ -1699,7 +1714,7 @@
|
|
|
1699
1714
|
error: t
|
|
1700
1715
|
};
|
|
1701
1716
|
}
|
|
1702
|
-
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} =
|
|
1717
|
+
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = Bt(s, e + 28, o), f = a.QUANTIZED_VOLUME_OFFSET, l = a.QUANTIZED_VOLUME_SCALE, d = a.POINTS_LENGTH;
|
|
1703
1718
|
let m, y = {};
|
|
1704
1719
|
if (a.extensions && a.extensions["3DTILES_draco_point_compression"]) {
|
|
1705
1720
|
y = a.extensions["3DTILES_draco_point_compression"], m = new DataView(t, y.byteOffset + c.offset, y.byteLength);
|
|
@@ -1707,7 +1722,7 @@
|
|
|
1707
1722
|
attributes: y.properties,
|
|
1708
1723
|
useUniqueIDs: !1
|
|
1709
1724
|
};
|
|
1710
|
-
return this.ft || (this.ft =
|
|
1725
|
+
return this.ft || (this.ft = Wt.draco()), this.ft(m, e).then(e => {
|
|
1711
1726
|
const n = e.attributes;
|
|
1712
1727
|
!a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
|
|
1713
1728
|
n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
|
|
@@ -1721,11 +1736,11 @@
|
|
|
1721
1736
|
byteOffset: 0,
|
|
1722
1737
|
itemSize: 1,
|
|
1723
1738
|
count: t.length,
|
|
1724
|
-
componentType:
|
|
1739
|
+
componentType: Ct(t.constructor),
|
|
1725
1740
|
array: t
|
|
1726
1741
|
}, o.push(t.buffer);
|
|
1727
1742
|
} else if (a.BATCH_ID || Object.keys(h).length) {
|
|
1728
|
-
a.BATCH_ID ? r.BATCH_ID =
|
|
1743
|
+
a.BATCH_ID ? r.BATCH_ID = Nt(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = se(d);
|
|
1729
1744
|
const e = r.BATCH_ID.array && r.BATCH_ID.array.buffer;
|
|
1730
1745
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
1731
1746
|
}
|
|
@@ -1741,7 +1756,7 @@
|
|
|
1741
1756
|
}
|
|
1742
1757
|
const b = this.lt(t, a, c.offset, d, o, f, l);
|
|
1743
1758
|
if (a.BATCH_ID || Object.keys(h).length) {
|
|
1744
|
-
a.BATCH_ID ? b.BATCH_ID =
|
|
1759
|
+
a.BATCH_ID ? b.BATCH_ID = Nt(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = se(d);
|
|
1745
1760
|
const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
|
|
1746
1761
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
1747
1762
|
}
|
|
@@ -1870,13 +1885,13 @@
|
|
|
1870
1885
|
return a;
|
|
1871
1886
|
}
|
|
1872
1887
|
ct(t, e, n) {
|
|
1873
|
-
return
|
|
1888
|
+
return Ut(new Float32Array(t.length), t, e, n);
|
|
1874
1889
|
}
|
|
1875
1890
|
st() {
|
|
1876
1891
|
return null;
|
|
1877
1892
|
}
|
|
1878
1893
|
}
|
|
1879
|
-
function
|
|
1894
|
+
function se(t) {
|
|
1880
1895
|
const e = (n = t) < 256 ? Uint8Array : n < 65536 ? Uint16Array : Uint32Array;
|
|
1881
1896
|
var n;
|
|
1882
1897
|
const r = new e(t);
|
|
@@ -1886,16 +1901,16 @@
|
|
|
1886
1901
|
byteOffset: 0,
|
|
1887
1902
|
itemSize: 1,
|
|
1888
1903
|
count: t,
|
|
1889
|
-
componentType:
|
|
1904
|
+
componentType: Ct(e),
|
|
1890
1905
|
array: r
|
|
1891
1906
|
};
|
|
1892
1907
|
}
|
|
1893
|
-
class
|
|
1908
|
+
class ie {
|
|
1894
1909
|
constructor(t, e) {
|
|
1895
|
-
this.A = t, this.tt = e ||
|
|
1910
|
+
this.A = t, this.tt = e || it;
|
|
1896
1911
|
}
|
|
1897
1912
|
load(t, e, n = 0, r = 0) {
|
|
1898
|
-
return e ? this.nt(t, e, n, r) :
|
|
1913
|
+
return e ? this.nt(t, e, n, r) : z.getArrayBuffer(t, {}).then(e => {
|
|
1899
1914
|
const s = e.data;
|
|
1900
1915
|
return this.nt(t, s, n, r);
|
|
1901
1916
|
});
|
|
@@ -1905,12 +1920,12 @@
|
|
|
1905
1920
|
const s = this.dt(e, t, n, r), i = [];
|
|
1906
1921
|
for (let n = 0; n < s.length; n++) {
|
|
1907
1922
|
let r;
|
|
1908
|
-
if ("b3dm" === s[n].magic) r = new
|
|
1923
|
+
if ("b3dm" === s[n].magic) r = new Yt(this.A, this.tt); else if ("i3dm" === s[n].magic) r = new Qt(this.A, this.tt); else if ("pnts" === s[n].magic) r = new re; else {
|
|
1909
1924
|
if ("cmpt" !== s[n].magic) {
|
|
1910
1925
|
console.warn("Unsupported magic in CMPT tile:", s[n].magic);
|
|
1911
1926
|
continue;
|
|
1912
1927
|
}
|
|
1913
|
-
r = new
|
|
1928
|
+
r = new ie(this.A, this.tt);
|
|
1914
1929
|
}
|
|
1915
1930
|
i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
|
|
1916
1931
|
}
|
|
@@ -1927,17 +1942,11 @@
|
|
|
1927
1942
|
error: t
|
|
1928
1943
|
};
|
|
1929
1944
|
}
|
|
1930
|
-
if (s.getUint32(8, !0) !== s.byteLength) {
|
|
1931
|
-
const t = "Length in cmpt header is inconsistent with cmpt's byte length, url: " + e;
|
|
1932
|
-
return console.warn(t), {
|
|
1933
|
-
error: t
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
1945
|
if (16 === s.byteLength) return [];
|
|
1937
1946
|
const o = [], a = s.getUint32(12, !0);
|
|
1938
1947
|
let c = 16;
|
|
1939
1948
|
for (let e = 0; e < a; e++) {
|
|
1940
|
-
const e =
|
|
1949
|
+
const e = vt(s, c), r = s.getUint32(c + 8, !0);
|
|
1941
1950
|
o.push({
|
|
1942
1951
|
magic: e,
|
|
1943
1952
|
buffer: t,
|
|
@@ -1948,17 +1957,17 @@
|
|
|
1948
1957
|
return o;
|
|
1949
1958
|
}
|
|
1950
1959
|
}
|
|
1951
|
-
function
|
|
1960
|
+
function oe(t, e) {
|
|
1952
1961
|
if (t.scenes && t.scenes.length) for (let n = 0, r = t.scenes.length; n < r; n++) {
|
|
1953
1962
|
const r = t.scenes[n].nodes;
|
|
1954
1963
|
for (let n = 0, s = r.length; n < s; n++) {
|
|
1955
1964
|
const s = [];
|
|
1956
|
-
|
|
1965
|
+
ae(r[n], s, t, e);
|
|
1957
1966
|
}
|
|
1958
1967
|
}
|
|
1959
1968
|
}
|
|
1960
|
-
function
|
|
1961
|
-
if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++)
|
|
1969
|
+
function ae(t, e, n, r) {
|
|
1970
|
+
if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++) ae(t.children[s], e, n, r);
|
|
1962
1971
|
if (void 0 !== t.mesh) {
|
|
1963
1972
|
const s = t.mesh, i = n.meshes[s];
|
|
1964
1973
|
if (i) {
|
|
@@ -1970,9 +1979,9 @@
|
|
|
1970
1979
|
}
|
|
1971
1980
|
}
|
|
1972
1981
|
}
|
|
1973
|
-
function
|
|
1982
|
+
function ce(t, e) {
|
|
1974
1983
|
let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
|
|
1975
|
-
const a = t.array.buffer, c = n ?
|
|
1984
|
+
const a = t.array.buffer, c = n ? it.getTypedArrayCtor(n) : t.array.constructor;
|
|
1976
1985
|
if (r = void 0 === r ? t.array.byteOffset : r, s = s || 0, i = i || t.array.length / o,
|
|
1977
1986
|
(!s || s === o * c.BYTES_PER_ELEMENT) && r % c.BYTES_PER_ELEMENT == 0) {
|
|
1978
1987
|
const t = new c(a, r, i * o);
|
|
@@ -1989,21 +1998,25 @@
|
|
|
1989
1998
|
e(new c(h.buffer), t), n.set(h);
|
|
1990
1999
|
}
|
|
1991
2000
|
}
|
|
1992
|
-
const
|
|
1993
|
-
let
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2001
|
+
const he = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], ue = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], fe = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
2002
|
+
let le, de = !1;
|
|
2003
|
+
if ("undefined" != typeof OffscreenCanvas) {
|
|
2004
|
+
try {
|
|
2005
|
+
le = new OffscreenCanvas(2, 2).getContext("2d");
|
|
2006
|
+
} catch (t) {}
|
|
2007
|
+
le && "undefined" != typeof createImageBitmap && (de = !0);
|
|
2008
|
+
}
|
|
2009
|
+
const me = n([]), ye = [ 0, 0, 0 ], be = [], pe = [];
|
|
2010
|
+
class we {
|
|
1998
2011
|
constructor(t, e, n, r) {
|
|
1999
|
-
this.id = t, this.options = e, this.yt = this.requestImage.bind(this), this.bt = new
|
|
2000
|
-
this.pt = new
|
|
2001
|
-
r();
|
|
2012
|
+
this.id = t, this.options = e, this.yt = this.requestImage.bind(this), this.bt = new re,
|
|
2013
|
+
this.pt = new Yt(this.yt, it), this.wt = new Qt(this.yt, it), this._t = n, this.gt = {},
|
|
2014
|
+
r(null, {}, []);
|
|
2002
2015
|
}
|
|
2003
2016
|
requestImage(t, e) {
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
const n =
|
|
2017
|
+
de ? fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
2018
|
+
(void 0).width = t.width, (void 0).height = t.height, le.drawImage(t, 0, 0);
|
|
2019
|
+
const n = le.getImageData(0, 0, (void 0).width, (void 0).height);
|
|
2007
2020
|
e(null, {
|
|
2008
2021
|
width: t.width,
|
|
2009
2022
|
height: t.height,
|
|
@@ -2017,14 +2030,14 @@
|
|
|
2017
2030
|
const n = t.url, r = t.arraybuffer;
|
|
2018
2031
|
if (r) {
|
|
2019
2032
|
delete this.gt[n];
|
|
2020
|
-
const s =
|
|
2033
|
+
const s = vt(new DataView(r), 0);
|
|
2021
2034
|
if ("{" === s[0] || " " === s[0]) {
|
|
2022
2035
|
const t = function(t, e, n) {
|
|
2023
|
-
if (
|
|
2036
|
+
if (fe) {
|
|
2024
2037
|
const r = new Uint8Array(t, e, n);
|
|
2025
|
-
return
|
|
2038
|
+
return fe.decode(r);
|
|
2026
2039
|
}
|
|
2027
|
-
return
|
|
2040
|
+
return dt(new Uint8Array(t, e, n));
|
|
2028
2041
|
}(r, 0, r.byteLength), n = JSON.parse(t);
|
|
2029
2042
|
e(null, n);
|
|
2030
2043
|
} else if ("b3dm" === s) {
|
|
@@ -2048,8 +2061,8 @@
|
|
|
2048
2061
|
e(null, r, i);
|
|
2049
2062
|
});
|
|
2050
2063
|
} else if ("cmpt" === s) {
|
|
2051
|
-
new
|
|
2052
|
-
const {content: r, transferables: s} = this.
|
|
2064
|
+
new ie(this.yt, it).load(n, r).then(n => {
|
|
2065
|
+
const {content: r, transferables: s} = this.vt(n, t);
|
|
2053
2066
|
e(null, r, s);
|
|
2054
2067
|
}).catch(t => {
|
|
2055
2068
|
e(t);
|
|
@@ -2059,7 +2072,7 @@
|
|
|
2059
2072
|
const r = this.options.services[t.rootIdx];
|
|
2060
2073
|
let s = r.urlParams;
|
|
2061
2074
|
s && (s = (n.indexOf("?") > 0 ? "&" : "?") + s);
|
|
2062
|
-
let i =
|
|
2075
|
+
let i = z.getArrayBuffer(n + (s || ""), r.ajaxOptions);
|
|
2063
2076
|
const o = i.xhr;
|
|
2064
2077
|
i = i.then(r => {
|
|
2065
2078
|
delete this.gt[n], t.arraybuffer = r && r.data, this.loadTile(t, e);
|
|
@@ -2068,7 +2081,7 @@
|
|
|
2068
2081
|
}), this.gt[n] = o;
|
|
2069
2082
|
}
|
|
2070
2083
|
}
|
|
2071
|
-
|
|
2084
|
+
vt(t, e) {
|
|
2072
2085
|
const {tiles: n} = t, r = {
|
|
2073
2086
|
magic: "cmpt",
|
|
2074
2087
|
content: []
|
|
@@ -2077,13 +2090,13 @@
|
|
|
2077
2090
|
const {magic: i} = n[t];
|
|
2078
2091
|
if ("b3dm" === i) {
|
|
2079
2092
|
const {content: i, transferables: o} = this.Tt(n[t], e);
|
|
2080
|
-
|
|
2093
|
+
Te(s, o), r.content.push(i);
|
|
2081
2094
|
} else if ("i3dm" === i || "pnts" === i) {
|
|
2082
2095
|
const {transform: i, rootIdx: o} = e, {content: a, transferables: c} = this.At(n[t], i, o);
|
|
2083
|
-
|
|
2096
|
+
Te(s, c), r.content.push(a);
|
|
2084
2097
|
} else if ("cmpt" === i) {
|
|
2085
|
-
const {content: i, transferables: o} = this.
|
|
2086
|
-
|
|
2098
|
+
const {content: i, transferables: o} = this.vt(n[t], e);
|
|
2099
|
+
Te(s, o), r.content.push(i);
|
|
2087
2100
|
}
|
|
2088
2101
|
}
|
|
2089
2102
|
return {
|
|
@@ -2093,7 +2106,7 @@
|
|
|
2093
2106
|
}
|
|
2094
2107
|
Tt(t, e) {
|
|
2095
2108
|
const {gltf: n, transferables: r, featureTable: s} = t;
|
|
2096
|
-
return this.
|
|
2109
|
+
return this.Ot(t.gltf), this.convertCoordinates(n, s, e.upAxis, e.transform), delete t.transferables,
|
|
2097
2110
|
{
|
|
2098
2111
|
content: t,
|
|
2099
2112
|
transferables: r
|
|
@@ -2104,8 +2117,8 @@
|
|
|
2104
2117
|
let i = r && r.RTC_CENTER || [ 0, 0, 0 ];
|
|
2105
2118
|
if (r.EAST_NORTH_UP && !s.NORMAL_UP && !s.NORMAL_UP_OCT32P) {
|
|
2106
2119
|
const e = new Float32Array(3 * s.POSITION.array.length), n = [], r = [], o = [];
|
|
2107
|
-
|
|
2108
|
-
h(o, t, i),
|
|
2120
|
+
ce(s.POSITION, (t, s) => {
|
|
2121
|
+
h(o, t, i), Gt(o, null, n), function(t, e) {
|
|
2109
2122
|
t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[4], t[4] = e[5], t[5] = e[6], t[6] = e[8],
|
|
2110
2123
|
t[7] = e[9], t[8] = e[10];
|
|
2111
2124
|
}(r, n);
|
|
@@ -2129,9 +2142,9 @@
|
|
|
2129
2142
|
hmin: 1 / 0,
|
|
2130
2143
|
hmax: -1 / 0
|
|
2131
2144
|
};
|
|
2132
|
-
|
|
2133
|
-
const c =
|
|
2134
|
-
|
|
2145
|
+
_e(s.POSITION.array, 3, i, me, o);
|
|
2146
|
+
const c = ge(o), u = a([], c);
|
|
2147
|
+
ce(s.POSITION, t => {
|
|
2135
2148
|
t[0] = t[0] + i[0] - u[0], t[1] = t[1] + i[1] - u[1], t[2] = t[2] + i[2] - u[2];
|
|
2136
2149
|
}), e && y(c, c, e);
|
|
2137
2150
|
const f = this.Mt(c);
|
|
@@ -2142,7 +2155,7 @@
|
|
|
2142
2155
|
transferables: l
|
|
2143
2156
|
};
|
|
2144
2157
|
}
|
|
2145
|
-
|
|
2158
|
+
Ot(t) {
|
|
2146
2159
|
if (!Array.isArray(t.textures)) return;
|
|
2147
2160
|
const e = t.textures;
|
|
2148
2161
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -2163,8 +2176,8 @@
|
|
|
2163
2176
|
n && n.abort(), delete this.gt[t.url], e(null);
|
|
2164
2177
|
}
|
|
2165
2178
|
convertCoordinates(t, e, s, i) {
|
|
2166
|
-
let o = e && e.RTC_CENTER || t.extensions && t.extensions.CESIUM_RTC && t.extensions.CESIUM_RTC.center, c =
|
|
2167
|
-
"X" === (s = s && s.toUpperCase()) ? c =
|
|
2179
|
+
let o = e && e.RTC_CENTER || t.extensions && t.extensions.CESIUM_RTC && t.extensions.CESIUM_RTC.center, c = he;
|
|
2180
|
+
"X" === (s = s && s.toUpperCase()) ? c = ue : "Z" === s && (c = me), t.extensions = t.extensions || {},
|
|
2168
2181
|
t.extensions.CESIUM_RTC || (t.extensions.CESIUM_RTC = {}), o && (t.extensions.CESIUM_RTC.center = o);
|
|
2169
2182
|
const h = {
|
|
2170
2183
|
xmin: 1 / 0,
|
|
@@ -2174,42 +2187,42 @@
|
|
|
2174
2187
|
hmin: 1 / 0,
|
|
2175
2188
|
hmax: -1 / 0
|
|
2176
2189
|
};
|
|
2177
|
-
|
|
2190
|
+
oe(t, t => {
|
|
2178
2191
|
if (!(t.attributes && t.attributes.POSITION)) return;
|
|
2179
|
-
const e = n(
|
|
2192
|
+
const e = n(be);
|
|
2180
2193
|
if (t.matrices) for (let n = t.matrices.length - 1; n >= 0; n--) r(e, e, t.matrices[n]);
|
|
2181
2194
|
const s = t.attributes.POSITION.array, i = t.attributes.POSITION.itemSize;
|
|
2182
|
-
r(e, c, e),
|
|
2195
|
+
r(e, c, e), _e(s, i, o || ye, e, h);
|
|
2183
2196
|
});
|
|
2184
|
-
const u =
|
|
2185
|
-
i && y(u, u, i), t.extensions.CESIUM_RTC.coord = this.Mt(u), o || (
|
|
2197
|
+
const u = ge(h), f = a([], u);
|
|
2198
|
+
i && y(u, u, i), t.extensions.CESIUM_RTC.coord = this.Mt(u), o || (oe(t, t => {
|
|
2186
2199
|
if (t.attributes && t.attributes.POSITION) {
|
|
2187
2200
|
const e = t.attributes.POSITION;
|
|
2188
2201
|
if (e.array.buffer.projected && e.array.buffer.projected[e.byteOffset]) return;
|
|
2189
|
-
const s = n(
|
|
2202
|
+
const s = n(be);
|
|
2190
2203
|
if (t.matrices) for (let e = t.matrices.length - 1; e >= 0; e--) r(s, s, t.matrices[e]);
|
|
2191
2204
|
r(s, c, s);
|
|
2192
2205
|
const i = function(t, e) {
|
|
2193
|
-
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,
|
|
2194
|
-
return
|
|
2195
|
-
t[2] = (y *
|
|
2196
|
-
t[5] = (n * N - s * S + i * M) *
|
|
2197
|
-
t[8] = (o * I - a * S + h *
|
|
2198
|
-
t[11] = (f * g - u * A - d * w) *
|
|
2199
|
-
t[14] = (y * _ - m * T - b * w) *
|
|
2200
|
-
}(
|
|
2201
|
-
|
|
2206
|
+
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;
|
|
2207
|
+
return E ? (E = 1 / E, t[0] = (a * N - c * I + h * x) * E, t[1] = (s * I - r * N - i * x) * E,
|
|
2208
|
+
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,
|
|
2209
|
+
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,
|
|
2210
|
+
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,
|
|
2211
|
+
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,
|
|
2212
|
+
t[14] = (y * _ - m * T - b * w) * E, t[15] = (u * T - f * _ + l * w) * E, t) : null;
|
|
2213
|
+
}(pe, s);
|
|
2214
|
+
ce(e, t => {
|
|
2202
2215
|
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);
|
|
2203
2216
|
}), e.array.buffer.projected || (e.array.buffer.projected = {}), e.array.buffer.projected[e.byteOffset] = 1;
|
|
2204
2217
|
}
|
|
2205
2218
|
}), t.extensions.CESIUM_RTC.center = f);
|
|
2206
2219
|
}
|
|
2207
2220
|
Mt(t) {
|
|
2208
|
-
return 0 === w(t) ? c([], 0, 0, -6378137) :
|
|
2221
|
+
return 0 === w(t) ? c([], 0, 0, -6378137) : _t([], t);
|
|
2209
2222
|
}
|
|
2210
2223
|
onRemove() {}
|
|
2211
2224
|
}
|
|
2212
|
-
function
|
|
2225
|
+
function _e(t, e, n, r, s) {
|
|
2213
2226
|
const i = [];
|
|
2214
2227
|
for (let o = 0, a = t.length; o < a; o += e) {
|
|
2215
2228
|
const {xmin: a, ymin: u, xmax: f, ymax: l, hmin: d, hmax: m} = s;
|
|
@@ -2219,23 +2232,23 @@
|
|
|
2219
2232
|
b[1] > l && (s.ymax = b[1]), e > 2 && (b[2] < d && (s.hmin = b[2]), b[2] > m && (s.hmax = b[2]));
|
|
2220
2233
|
}
|
|
2221
2234
|
}
|
|
2222
|
-
function
|
|
2235
|
+
function ge(t) {
|
|
2223
2236
|
const {xmax: e, ymax: n, xmin: r, ymin: s, hmin: i, hmax: o} = t, a = [ (r + e) / 2, (s + n) / 2, (i + o) / 2 ];
|
|
2224
2237
|
return e === -1 / 0 && (a[0] = 0), n === -1 / 0 && (a[1] = 0), o === -1 / 0 && (a[2] = 0),
|
|
2225
2238
|
isNaN(a[2]) && (a[2] = 0), a;
|
|
2226
2239
|
}
|
|
2227
|
-
function
|
|
2240
|
+
function Te(t, e) {
|
|
2228
2241
|
for (let n = 0; n < e.length; n++) t.indexOf(e[n]) < 0 && t.push(e[n]);
|
|
2229
2242
|
}
|
|
2230
|
-
let
|
|
2231
|
-
class
|
|
2243
|
+
let Ae = 0;
|
|
2244
|
+
class ve {
|
|
2232
2245
|
constructor(t) {
|
|
2233
2246
|
this.workerId = t, this.workers = {}, this.St = {};
|
|
2234
2247
|
}
|
|
2235
2248
|
addLayer({actorId: t, mapId: e, layerId: n, params: r}, s) {
|
|
2236
2249
|
if (this.xt(e, n)) return;
|
|
2237
2250
|
const i = this.It(e, n), o = r.options, a = this.send.bind(this, t);
|
|
2238
|
-
this.workers[i] = new
|
|
2251
|
+
this.workers[i] = new we(n, o, a, s);
|
|
2239
2252
|
}
|
|
2240
2253
|
removeLayer({mapId: t, layerId: e}, n) {
|
|
2241
2254
|
const r = this.xt(t, e), s = this.It(t, e);
|
|
@@ -2254,7 +2267,7 @@
|
|
|
2254
2267
|
delete this.St[e], n && t.error ? n(new Error(t.error)) : n && n(null, t.data);
|
|
2255
2268
|
}
|
|
2256
2269
|
send(t, e, n, r, s) {
|
|
2257
|
-
const i = s ? `${t}-${
|
|
2270
|
+
const i = s ? `${t}-${Ae++}` : null;
|
|
2258
2271
|
s && (this.St[i] = s), postMessage({
|
|
2259
2272
|
type: "<request>",
|
|
2260
2273
|
workerId: this.workerId,
|
|
@@ -2274,7 +2287,7 @@
|
|
|
2274
2287
|
}
|
|
2275
2288
|
t.initialize = function() {}, t.onmessage = function(t, e) {
|
|
2276
2289
|
const n = t.data;
|
|
2277
|
-
this.dispatcher || (this.dispatcher = new
|
|
2290
|
+
this.dispatcher || (this.dispatcher = new ve(t.workerId)), "<response>" === t.type ? this.dispatcher.workerId === t.workerId && this.dispatcher.receive(t) : this.dispatcher[n.command]({
|
|
2278
2291
|
actorId: n.actorId,
|
|
2279
2292
|
mapId: n.mapId,
|
|
2280
2293
|
layerId: n.layerId,
|
|
@@ -2381,10 +2394,10 @@
|
|
|
2381
2394
|
function A(t, e, n) {
|
|
2382
2395
|
return t[3 * n] = e[0], t[3 * n + 1] = e[1], t[3 * n + 2] = e[2], t;
|
|
2383
2396
|
}
|
|
2384
|
-
function
|
|
2397
|
+
function v(t) {
|
|
2385
2398
|
return t.flat ? t.flat(1 / 0) : t.reduce((t, e) => t.concat(e), []);
|
|
2386
2399
|
}
|
|
2387
|
-
function
|
|
2400
|
+
function O(t) {
|
|
2388
2401
|
return t < 256 ? Uint8Array : t < 65536 ? Uint16Array : Uint32Array;
|
|
2389
2402
|
}
|
|
2390
2403
|
function M(t) {
|
|
@@ -2406,8 +2419,8 @@
|
|
|
2406
2419
|
sign: _,
|
|
2407
2420
|
stringFromUTF8Array: T,
|
|
2408
2421
|
setColumn3: A,
|
|
2409
|
-
flatArr:
|
|
2410
|
-
getBatchIdArrayType:
|
|
2422
|
+
flatArr: v,
|
|
2423
|
+
getBatchIdArrayType: O,
|
|
2411
2424
|
isBase64: M,
|
|
2412
2425
|
base64URLToArrayBuffer: S
|
|
2413
2426
|
}), I = "undefined" != typeof Float32Array ? Float32Array : Array;
|
|
@@ -2422,11 +2435,11 @@
|
|
|
2422
2435
|
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,
|
|
2423
2436
|
t[14] = _ * i + g * h + T * d + A * p, t[15] = _ * o + g * u + T * m + A * w, t;
|
|
2424
2437
|
}
|
|
2425
|
-
function
|
|
2438
|
+
function E() {
|
|
2426
2439
|
var t = new I(3);
|
|
2427
2440
|
return I != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t;
|
|
2428
2441
|
}
|
|
2429
|
-
function
|
|
2442
|
+
function P(t) {
|
|
2430
2443
|
var e = t[0], n = t[1], r = t[2];
|
|
2431
2444
|
return Math.sqrt(e * e + n * n + r * r);
|
|
2432
2445
|
}
|
|
@@ -2457,36 +2470,36 @@
|
|
|
2457
2470
|
function k(t, e) {
|
|
2458
2471
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2];
|
|
2459
2472
|
}
|
|
2460
|
-
function
|
|
2473
|
+
function z(t, e, n) {
|
|
2461
2474
|
var r = e[0], s = e[1], i = e[2], o = n[0], a = n[1], c = n[2];
|
|
2462
2475
|
return t[0] = s * c - i * a, t[1] = i * o - r * c, t[2] = r * a - s * o, t;
|
|
2463
2476
|
}
|
|
2464
|
-
var
|
|
2477
|
+
var j = L, V = R, G = P;
|
|
2465
2478
|
function H(t, e, n, r, s) {
|
|
2466
2479
|
return t[0] = e, t[1] = n, t[2] = r, t[3] = s, t;
|
|
2467
2480
|
}
|
|
2468
|
-
function
|
|
2481
|
+
function q() {
|
|
2469
2482
|
var t = new I(4);
|
|
2470
2483
|
return I != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t[3] = 1, t;
|
|
2471
2484
|
}
|
|
2472
|
-
function
|
|
2485
|
+
function $(t, e, n, r) {
|
|
2473
2486
|
var s = e[0], i = e[1], o = e[2], a = e[3], c = n[0], h = n[1], u = n[2], f = n[3], l = void 0, d = void 0, m = void 0, y = void 0, b = void 0;
|
|
2474
2487
|
return (d = s * c + i * h + o * u + a * f) < 0 && (d = -d, c = -c, h = -h, u = -u,
|
|
2475
2488
|
f = -f), 1 - d > 1e-6 ? (l = Math.acos(d), m = Math.sin(l), y = Math.sin((1 - r) * l) / m,
|
|
2476
2489
|
b = Math.sin(r * l) / m) : (y = 1 - r, b = r), t[0] = y * s + b * c, t[1] = y * i + b * h,
|
|
2477
2490
|
t[2] = y * o + b * u, t[3] = y * a + b * f, t;
|
|
2478
2491
|
}
|
|
2479
|
-
|
|
2492
|
+
E(), function() {
|
|
2480
2493
|
var t, e = (t = new I(4), I != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0),
|
|
2481
2494
|
t);
|
|
2482
2495
|
}();
|
|
2483
2496
|
var J, K = function(t, e) {
|
|
2484
2497
|
return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t;
|
|
2485
2498
|
};
|
|
2486
|
-
|
|
2499
|
+
E(), C(1, 0, 0), C(0, 1, 0), q(), q(), J = new I(9), I != Float32Array && (J[1] = 0,
|
|
2487
2500
|
J[2] = 0, J[3] = 0, J[5] = 0, J[6] = 0, J[7] = 0), J[0] = 1, J[4] = 1, J[8] = 1;
|
|
2488
2501
|
/*!
|
|
2489
|
-
* @maptalks/gltf-loader v0.23.
|
|
2502
|
+
* @maptalks/gltf-loader v0.23.1
|
|
2490
2503
|
* LICENSE : UNLICENSED
|
|
2491
2504
|
* (c) 2016-2022 maptalks.org
|
|
2492
2505
|
*/
|
|
@@ -2595,19 +2608,20 @@
|
|
|
2595
2608
|
getArrayBuffer: (t, e = {}) => (e || (e = {}), e.responseType = "arraybuffer", ft.get(t, e)),
|
|
2596
2609
|
getJSON: function(t, e = {}) {
|
|
2597
2610
|
return e && e.jsonp ? ft.jsonp(t) : ((e = e || {}).responseType = "json", ft.get(t, e));
|
|
2598
|
-
},
|
|
2599
|
-
jsonp: function(t) {
|
|
2600
|
-
const e = "_maptalks_jsonp_" + X++;
|
|
2601
|
-
t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
|
|
2602
|
-
let n = document.createElement("script");
|
|
2603
|
-
return n.type = "text/javascript", n.src = t, new Promise(t => {
|
|
2604
|
-
window[e] = function(r) {
|
|
2605
|
-
document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
|
|
2606
|
-
t(r);
|
|
2607
|
-
}, document.getElementsByTagName("head")[0].appendChild(n);
|
|
2608
|
-
});
|
|
2609
2611
|
}
|
|
2610
|
-
}
|
|
2612
|
+
};
|
|
2613
|
+
ft.jsonp = function(t) {
|
|
2614
|
+
const e = "_maptalks_jsonp_" + X++;
|
|
2615
|
+
t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
|
|
2616
|
+
let n = document.createElement("script");
|
|
2617
|
+
return n.type = "text/javascript", n.src = t, new Promise(t => {
|
|
2618
|
+
window[e] = function(r) {
|
|
2619
|
+
document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
|
|
2620
|
+
t(r);
|
|
2621
|
+
}, document.getElementsByTagName("head")[0].appendChild(n);
|
|
2622
|
+
});
|
|
2623
|
+
};
|
|
2624
|
+
const lt = [ "SCALAR", 1, "VEC2", 2, "VEC3", 3, "VEC4", 4, "MAT2", 4, "MAT3", 9, "MAT4", 16 ];
|
|
2611
2625
|
class dt {
|
|
2612
2626
|
constructor(t, e, n) {
|
|
2613
2627
|
this.rootPath = t, this.gltf = e, this.i = !1, this.glbBuffer = n, this.buffers = {},
|
|
@@ -2660,7 +2674,8 @@
|
|
|
2660
2674
|
});
|
|
2661
2675
|
}
|
|
2662
2676
|
u(t, e, n, r = 0) {
|
|
2663
|
-
const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.m(i.type), h = Q(i.componentType), u = o.byteStride || 0
|
|
2677
|
+
const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.m(i.type), h = Q(i.componentType), u = o.byteStride || 0;
|
|
2678
|
+
const f = {
|
|
2664
2679
|
array: void 0,
|
|
2665
2680
|
name: t,
|
|
2666
2681
|
accessorName: e,
|
|
@@ -2774,7 +2789,7 @@
|
|
|
2774
2789
|
r.instanceTechnique && r.instanceTechnique.values ? (s = r.instanceTechnique, i = s.values.diffuse) : (s = r,
|
|
2775
2790
|
i = s.values.tex || s.values.diffuseTex || s.values.diffuse);
|
|
2776
2791
|
const o = {
|
|
2777
|
-
baseColorTexture: {
|
|
2792
|
+
"baseColorTexture": {
|
|
2778
2793
|
index: i
|
|
2779
2794
|
}
|
|
2780
2795
|
};
|
|
@@ -2793,7 +2808,8 @@
|
|
|
2793
2808
|
}
|
|
2794
2809
|
{
|
|
2795
2810
|
const e = t.uri, n = this.rootPath + "/" + e;
|
|
2796
|
-
|
|
2811
|
+
if (this.requests[n]) return this.requests[n].then(() => this.buffers[n]);
|
|
2812
|
+
return this.requests[n] = ft.getArrayBuffer(n, null).then(t => {
|
|
2797
2813
|
const e = t.data;
|
|
2798
2814
|
return this.buffers[n] = e, new Uint8Array(e);
|
|
2799
2815
|
});
|
|
@@ -2884,19 +2900,20 @@
|
|
|
2884
2900
|
});
|
|
2885
2901
|
}
|
|
2886
2902
|
g(t) {
|
|
2887
|
-
if (!W(t.bufferView)) return this.
|
|
2903
|
+
if (!W(t.bufferView)) return this.v(t);
|
|
2888
2904
|
{
|
|
2889
2905
|
const e = this.gltf.bufferViews[t.bufferView];
|
|
2890
2906
|
if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
|
|
2891
2907
|
const n = this.gltf.buffers[e.buffer];
|
|
2892
|
-
if (n.uri) return this.
|
|
2908
|
+
if (n.uri) return this.O(n, e, t);
|
|
2893
2909
|
if (this.glbBuffer) return this.M(e, t);
|
|
2894
2910
|
}
|
|
2895
2911
|
return null;
|
|
2896
2912
|
}
|
|
2897
|
-
|
|
2913
|
+
v(t) {
|
|
2898
2914
|
const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
|
|
2899
|
-
|
|
2915
|
+
if (this.requests[t.id]) return this.requests[t.id].then(() => this.images[t.id]);
|
|
2916
|
+
return this.requests[t.id] = this.S(t.id, e);
|
|
2900
2917
|
}
|
|
2901
2918
|
I(t, e) {
|
|
2902
2919
|
const n = this.decoders;
|
|
@@ -2910,7 +2927,7 @@
|
|
|
2910
2927
|
return this.S(e.id, r);
|
|
2911
2928
|
}
|
|
2912
2929
|
}
|
|
2913
|
-
|
|
2930
|
+
O(t, e, n) {
|
|
2914
2931
|
if (this.buffers[t.id]) {
|
|
2915
2932
|
const r = this.buffers[t.id], s = this.N(e, r);
|
|
2916
2933
|
return this.I(s, n);
|
|
@@ -2947,7 +2964,8 @@
|
|
|
2947
2964
|
P(t, e) {
|
|
2948
2965
|
const n = new Array(t.byteLength);
|
|
2949
2966
|
for (let e = 0; e < t.byteLength; e++) n[e] = String.fromCharCode(t[e]);
|
|
2950
|
-
|
|
2967
|
+
n.join("");
|
|
2968
|
+
return "data:" + (e = e || "image/png") + ";base64," + function(t) {
|
|
2951
2969
|
return "undefined" != typeof self ? self.btoa(t) : window.btoa(t);
|
|
2952
2970
|
}(unescape(encodeURIComponent(n)));
|
|
2953
2971
|
}
|
|
@@ -2971,19 +2989,19 @@
|
|
|
2971
2989
|
});
|
|
2972
2990
|
}
|
|
2973
2991
|
}
|
|
2974
|
-
const bt = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
2975
|
-
class
|
|
2992
|
+
const bt = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null, pt = 1313821514, wt = 5130562;
|
|
2993
|
+
class _t {
|
|
2976
2994
|
static read(t, e = 0, n = 0) {
|
|
2977
2995
|
n || (n = t.byteLength);
|
|
2978
2996
|
const r = new DataView(t, e, n), s = r.getUint32(4, !0);
|
|
2979
|
-
if (1 === s) return
|
|
2980
|
-
if (2 === s) return
|
|
2997
|
+
if (1 === s) return _t.readV1(r, e);
|
|
2998
|
+
if (2 === s) return _t.readV2(t, e);
|
|
2981
2999
|
throw new Error("Unsupported glb version : " + s);
|
|
2982
3000
|
}
|
|
2983
3001
|
static readV1(t, e) {
|
|
2984
3002
|
const n = t.getUint32(8, !0), r = t.getUint32(12, !0);
|
|
2985
3003
|
if (n !== t.byteLength) throw new Error("Length in GLB header is inconsistent with glb's byte length.");
|
|
2986
|
-
const s =
|
|
3004
|
+
const s = gt(t.buffer, 20 + e, r);
|
|
2987
3005
|
return {
|
|
2988
3006
|
json: JSON.parse(s),
|
|
2989
3007
|
glbBuffer: {
|
|
@@ -3001,7 +3019,7 @@
|
|
|
3001
3019
|
const a = i.getUint32(o, !0);
|
|
3002
3020
|
o += 4;
|
|
3003
3021
|
const c = i.getUint32(o, !0);
|
|
3004
|
-
if (o += 4,
|
|
3022
|
+
if (o += 4, c === pt) n = gt(t, e + 12 + o, a); else if (c === wt) {
|
|
3005
3023
|
s = e + 12 + o, r = a;
|
|
3006
3024
|
break;
|
|
3007
3025
|
}
|
|
@@ -3017,7 +3035,7 @@
|
|
|
3017
3035
|
};
|
|
3018
3036
|
}
|
|
3019
3037
|
}
|
|
3020
|
-
function
|
|
3038
|
+
function gt(t, e, n) {
|
|
3021
3039
|
if (bt) {
|
|
3022
3040
|
const r = new Uint8Array(t, e, n);
|
|
3023
3041
|
return bt.decode(r);
|
|
@@ -3028,7 +3046,7 @@
|
|
|
3028
3046
|
for (let r = 0; r < e; ) {
|
|
3029
3047
|
let s = t[r++];
|
|
3030
3048
|
if (128 & s) {
|
|
3031
|
-
let n =
|
|
3049
|
+
let n = Tt[s >> 3 & 7];
|
|
3032
3050
|
if (!(64 & s) || !n || r + n > e) return null;
|
|
3033
3051
|
for (s &= 63 >> n; n > 0; n -= 1) {
|
|
3034
3052
|
const e = t[r++];
|
|
@@ -3041,17 +3059,18 @@
|
|
|
3041
3059
|
return n;
|
|
3042
3060
|
}(new Uint8Array(t, e, n));
|
|
3043
3061
|
}
|
|
3044
|
-
const
|
|
3062
|
+
const Tt = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
|
|
3063
|
+
const At = [ 0, 0, 0 ], vt = [ 0, 0, 0, 1 ], Ot = [ 1, 1, 1 ], Mt = {
|
|
3045
3064
|
TRANSLATION: [ 0, 0, 0 ],
|
|
3046
3065
|
ROTATION: [ 0, 0, 0, 1 ],
|
|
3047
3066
|
SCALE: [ 1, 1, 1 ]
|
|
3048
|
-
},
|
|
3067
|
+
}, St = {
|
|
3049
3068
|
PREVIOUS: null,
|
|
3050
3069
|
NEXT: null,
|
|
3051
3070
|
PREINDEX: null,
|
|
3052
3071
|
NEXTINDEX: null,
|
|
3053
3072
|
INTERPOLATION: null
|
|
3054
|
-
},
|
|
3073
|
+
}, xt = {
|
|
3055
3074
|
C(t, e, n, r, s, i, o, a) {
|
|
3056
3075
|
const c = W(t) ? e.animations : [ e.animations[0] ], h = {};
|
|
3057
3076
|
for (let e = 0; e < c.length; e++) {
|
|
@@ -3060,9 +3079,9 @@
|
|
|
3060
3079
|
const f = u.channelsMap[n];
|
|
3061
3080
|
if (f) for (let t = 0; t < f.length; t++) {
|
|
3062
3081
|
const e = f[t];
|
|
3063
|
-
"translation" === e.target.path ? (this.U(s, u.samplers[e.sampler], r, 1), h.translation = U(
|
|
3064
|
-
h.rotation = K(
|
|
3065
|
-
h.scale = U(
|
|
3082
|
+
"translation" === e.target.path ? (this.U(s, u.samplers[e.sampler], r, 1), h.translation = U(At, s)) : "rotation" === e.target.path ? (this.B(i, u.samplers[e.sampler], r, 1),
|
|
3083
|
+
h.rotation = K(vt, i)) : "scale" === e.target.path ? (this.U(o, u.samplers[e.sampler], r, 1),
|
|
3084
|
+
h.scale = U(Ot, o)) : "weights" === e.target.path && a && (this.U(a, u.samplers[e.sampler], r, a.length),
|
|
3066
3085
|
h.weights = a);
|
|
3067
3086
|
}
|
|
3068
3087
|
}
|
|
@@ -3072,7 +3091,7 @@
|
|
|
3072
3091
|
switch (e.interpolation) {
|
|
3073
3092
|
case "LINEAR":
|
|
3074
3093
|
{
|
|
3075
|
-
const s = this.L(
|
|
3094
|
+
const s = this.L(St, e, n, 1 * r);
|
|
3076
3095
|
s && (t = function(t, e, n, r) {
|
|
3077
3096
|
for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
|
|
3078
3097
|
return t;
|
|
@@ -3082,7 +3101,7 @@
|
|
|
3082
3101
|
|
|
3083
3102
|
case "STEP":
|
|
3084
3103
|
{
|
|
3085
|
-
const s = this.L(
|
|
3104
|
+
const s = this.L(St, e, n, 1 * r);
|
|
3086
3105
|
s && (t = function(t, e) {
|
|
3087
3106
|
for (let n = 0; n < t.length; n++) t[n] = e[n];
|
|
3088
3107
|
return t;
|
|
@@ -3092,7 +3111,7 @@
|
|
|
3092
3111
|
|
|
3093
3112
|
case "CUBICSPLINE":
|
|
3094
3113
|
{
|
|
3095
|
-
const s = this.L(
|
|
3114
|
+
const s = this.L(St, e, n, 3 * r);
|
|
3096
3115
|
s && (t = this.R(t, s, e.input.array, 3 * r));
|
|
3097
3116
|
break;
|
|
3098
3117
|
}
|
|
@@ -3103,21 +3122,21 @@
|
|
|
3103
3122
|
switch (e.interpolation) {
|
|
3104
3123
|
case "LINEAR":
|
|
3105
3124
|
{
|
|
3106
|
-
const r = this.L(
|
|
3107
|
-
r &&
|
|
3125
|
+
const r = this.L(St, e, n, 1);
|
|
3126
|
+
r && $(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
|
|
3108
3127
|
break;
|
|
3109
3128
|
}
|
|
3110
3129
|
|
|
3111
3130
|
case "STEP":
|
|
3112
3131
|
{
|
|
3113
|
-
const r = this.L(
|
|
3132
|
+
const r = this.L(St, e, n, 1);
|
|
3114
3133
|
r && (t = H(t, ...r.PREVIOUS));
|
|
3115
3134
|
break;
|
|
3116
3135
|
}
|
|
3117
3136
|
|
|
3118
3137
|
case "CUBICSPLINE":
|
|
3119
3138
|
{
|
|
3120
|
-
const r = this.L(
|
|
3139
|
+
const r = this.L(St, e, n, 3);
|
|
3121
3140
|
if (r) {
|
|
3122
3141
|
for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
|
|
3123
3142
|
r.NEXT[t] = Math.acos(r.NEXT[t]);
|
|
@@ -3168,7 +3187,8 @@
|
|
|
3168
3187
|
},
|
|
3169
3188
|
getAnimationClip(t, e, n, r) {
|
|
3170
3189
|
const s = t.nodes[e] && t.nodes[e].weights;
|
|
3171
|
-
|
|
3190
|
+
B(At, ...Mt.TRANSLATION), H(vt, ...Mt.ROTATION), B(Ot, ...Mt.SCALE);
|
|
3191
|
+
return this.C(r, t, e, n, At, vt, Ot, s);
|
|
3172
3192
|
},
|
|
3173
3193
|
getTimeSpan(t) {
|
|
3174
3194
|
if (!t.animations) return null;
|
|
@@ -3193,14 +3213,20 @@
|
|
|
3193
3213
|
return n ? W(e) ? n[e] : n[Object.keys(n)[0]] : null;
|
|
3194
3214
|
}
|
|
3195
3215
|
};
|
|
3196
|
-
let
|
|
3197
|
-
"undefined" != typeof OffscreenCanvas
|
|
3198
|
-
|
|
3199
|
-
|
|
3216
|
+
let It = !1;
|
|
3217
|
+
if ("undefined" != typeof OffscreenCanvas) {
|
|
3218
|
+
let t;
|
|
3219
|
+
try {
|
|
3220
|
+
t = new OffscreenCanvas(2, 2).getContext("2d");
|
|
3221
|
+
} catch (t) {}
|
|
3222
|
+
t && "undefined" != typeof createImageBitmap && (It = !0);
|
|
3223
|
+
}
|
|
3224
|
+
const Nt = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
3225
|
+
class Et {
|
|
3200
3226
|
constructor(t, e, n) {
|
|
3201
3227
|
if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
|
|
3202
3228
|
e.buffer instanceof ArrayBuffer) {
|
|
3203
|
-
const {json: n, glbBuffer: r} =
|
|
3229
|
+
const {json: n, glbBuffer: r} = _t.read(e.buffer, e.byteOffset, e.byteLength);
|
|
3204
3230
|
this.D(t, n, r);
|
|
3205
3231
|
} else this.D(t, e);
|
|
3206
3232
|
this.k = new dt(this.rootPath, this.gltf, this.glbBuffer), this.j();
|
|
@@ -3219,7 +3245,7 @@
|
|
|
3219
3245
|
}
|
|
3220
3246
|
load(t) {
|
|
3221
3247
|
t = t || {};
|
|
3222
|
-
const e = this.G(t), n = this.H(), r = this
|
|
3248
|
+
const e = this.G(t), n = this.H(), r = this.q(), s = this.V();
|
|
3223
3249
|
return Promise.all([ e, n, r, s ]).then(t => (t[0].animations = t[1], t[0].textures = t[2],
|
|
3224
3250
|
t[0].extensions = t[3], t[0].transferables = this.transferables || [], this.createChannelsMap(t[0]),
|
|
3225
3251
|
t[0]));
|
|
@@ -3251,10 +3277,10 @@
|
|
|
3251
3277
|
return t;
|
|
3252
3278
|
}
|
|
3253
3279
|
static getAnimationClip(t, e, n, r) {
|
|
3254
|
-
return
|
|
3280
|
+
return xt.getAnimationClip(t, e, n, r);
|
|
3255
3281
|
}
|
|
3256
3282
|
static getAnimationTimeSpan(t, e) {
|
|
3257
|
-
return
|
|
3283
|
+
return xt.getTimeSpanByName(t, e);
|
|
3258
3284
|
}
|
|
3259
3285
|
static getTypedArrayCtor(t) {
|
|
3260
3286
|
return Q(t);
|
|
@@ -3264,7 +3290,7 @@
|
|
|
3264
3290
|
}
|
|
3265
3291
|
D(t, e, n) {
|
|
3266
3292
|
this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
|
|
3267
|
-
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = this.options.requestImage ||
|
|
3293
|
+
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = It ? Bt : this.options.requestImage || Pt,
|
|
3268
3294
|
this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new yt(t, e, n, this.options.requestImage, this.options.decoders || {}),
|
|
3269
3295
|
this.adapter.iterate((t, e, n) => {
|
|
3270
3296
|
e.id = "buffer_" + n;
|
|
@@ -3276,14 +3302,14 @@
|
|
|
3276
3302
|
e.id = "accessor_" + n;
|
|
3277
3303
|
}, "accessors"));
|
|
3278
3304
|
}
|
|
3279
|
-
|
|
3305
|
+
$(t, e) {
|
|
3280
3306
|
if (t.children && t.children.length > 0) {
|
|
3281
|
-
if (!(
|
|
3307
|
+
if (!(n = t.children[0], "number" == typeof n && isFinite(n) || function(t) {
|
|
3282
3308
|
return !Z(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
|
|
3283
3309
|
}(t.children[0]))) return t;
|
|
3284
3310
|
const r = t.children.map(t => {
|
|
3285
3311
|
const n = e[t];
|
|
3286
|
-
return n.nodeIndex = t, this
|
|
3312
|
+
return n.nodeIndex = t, this.$(n, e);
|
|
3287
3313
|
});
|
|
3288
3314
|
t.children = r;
|
|
3289
3315
|
}
|
|
@@ -3294,7 +3320,7 @@
|
|
|
3294
3320
|
return this.J(t).then(t => {
|
|
3295
3321
|
const e = this.scenes = [];
|
|
3296
3322
|
let n;
|
|
3297
|
-
for (const e in t) t[e] = this
|
|
3323
|
+
for (const e in t) t[e] = this.$(t[e], t), t[e].nodeIndex = Number(e) ? Number(e) : e;
|
|
3298
3324
|
this.adapter.iterate((r, s, i) => {
|
|
3299
3325
|
const o = {};
|
|
3300
3326
|
s.name && (o.name = s.name), s.nodes && (o.nodes = s.nodes.map(e => t[e])), this.gltf.scene === r && (n = i),
|
|
@@ -3360,7 +3386,7 @@
|
|
|
3360
3386
|
return Y(n, t), n.primitives = e, n;
|
|
3361
3387
|
});
|
|
3362
3388
|
}
|
|
3363
|
-
|
|
3389
|
+
q() {
|
|
3364
3390
|
const t = this.gltf.textures;
|
|
3365
3391
|
if (!t) return null;
|
|
3366
3392
|
const e = [];
|
|
@@ -3430,12 +3456,12 @@
|
|
|
3430
3456
|
});
|
|
3431
3457
|
}
|
|
3432
3458
|
}
|
|
3433
|
-
function
|
|
3459
|
+
function Pt(t, e) {
|
|
3434
3460
|
const n = new Image;
|
|
3435
3461
|
n.crossOrigin = "", n.onload = () => {
|
|
3436
|
-
if (!
|
|
3437
|
-
|
|
3438
|
-
const t =
|
|
3462
|
+
if (!Nt) return void e(new Error("There is no canvas to draw image!"));
|
|
3463
|
+
Nt.width = n.width, Nt.height = n.height;
|
|
3464
|
+
const t = Nt.getContext("2d");
|
|
3439
3465
|
t.drawImage(n, 0, 0, n.width, n.height);
|
|
3440
3466
|
const r = t.getImageData(0, 0, n.width, n.height), s = {
|
|
3441
3467
|
width: n.width,
|
|
@@ -3447,11 +3473,11 @@
|
|
|
3447
3473
|
e(t);
|
|
3448
3474
|
}, n.src = t;
|
|
3449
3475
|
}
|
|
3450
|
-
let
|
|
3451
|
-
function
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
const n =
|
|
3476
|
+
let Ct, Ut;
|
|
3477
|
+
function Bt(t, e) {
|
|
3478
|
+
Ct || (Ct = new OffscreenCanvas(2, 2), Ut = Ct.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
3479
|
+
Ct.width = t.width, Ct.height = t.height, Ut.drawImage(t, 0, 0);
|
|
3480
|
+
const n = Ut.getImageData(0, 0, Ct.width, Ct.height);
|
|
3455
3481
|
e(null, {
|
|
3456
3482
|
width: t.width,
|
|
3457
3483
|
height: t.height,
|
|
@@ -3459,8 +3485,8 @@
|
|
|
3459
3485
|
});
|
|
3460
3486
|
});
|
|
3461
3487
|
}
|
|
3462
|
-
const
|
|
3463
|
-
class
|
|
3488
|
+
const Lt = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
3489
|
+
class Rt extends s.worker.Actor {
|
|
3464
3490
|
constructor(t, e) {
|
|
3465
3491
|
super(t), this.mapId = e;
|
|
3466
3492
|
}
|
|
@@ -3512,20 +3538,20 @@
|
|
|
3512
3538
|
requestImage({url: t}, e) {
|
|
3513
3539
|
const n = new Image;
|
|
3514
3540
|
n.onload = () => {
|
|
3515
|
-
if (!
|
|
3541
|
+
if (!Lt) return void e(new Error("There is no canvas to draw image!"));
|
|
3516
3542
|
const t = function(t) {
|
|
3517
|
-
if (
|
|
3543
|
+
if (Ft(t.width) && Ft(t.height)) return t;
|
|
3518
3544
|
let e = t.width, n = t.height;
|
|
3519
|
-
|
|
3520
|
-
|
|
3545
|
+
Ft(e) || (e = Dt(e));
|
|
3546
|
+
Ft(n) || (n = Dt(n));
|
|
3521
3547
|
const r = document.createElement("canvas");
|
|
3522
3548
|
r.width = e, r.height = n, r.getContext("2d").drawImage(t, 0, 0, e, n);
|
|
3523
3549
|
const s = t.src, i = s.lastIndexOf("/") + 1, o = s.substring(i);
|
|
3524
3550
|
return console.warn(`Texture(${o})'s size is not power of two, resize from (${t.width}, ${t.height}) to (${e}, ${n})`),
|
|
3525
3551
|
r;
|
|
3526
3552
|
}(n);
|
|
3527
|
-
|
|
3528
|
-
const r =
|
|
3553
|
+
Lt.width = t.width, Lt.height = t.height;
|
|
3554
|
+
const r = Lt.getContext("2d");
|
|
3529
3555
|
r.drawImage(t, 0, 0, t.width, t.height);
|
|
3530
3556
|
const s = r.getImageData(0, 0, t.width, t.height), i = {
|
|
3531
3557
|
width: t.width,
|
|
@@ -3538,13 +3564,13 @@
|
|
|
3538
3564
|
}, n.src = t;
|
|
3539
3565
|
}
|
|
3540
3566
|
}
|
|
3541
|
-
function
|
|
3567
|
+
function Ft(t) {
|
|
3542
3568
|
return 0 == (t & t - 1) && 0 !== t;
|
|
3543
3569
|
}
|
|
3544
|
-
function
|
|
3570
|
+
function Dt(t) {
|
|
3545
3571
|
return Math.pow(2, Math.floor(Math.log(t) / Math.LN2));
|
|
3546
3572
|
}
|
|
3547
|
-
class
|
|
3573
|
+
class kt {
|
|
3548
3574
|
constructor(t, e) {
|
|
3549
3575
|
this.max = t, this.currentSize = 0, this.onRemove = e, this.reset();
|
|
3550
3576
|
}
|
|
@@ -3624,17 +3650,17 @@
|
|
|
3624
3650
|
for (const n of e) n.current = t;
|
|
3625
3651
|
}
|
|
3626
3652
|
}
|
|
3627
|
-
function
|
|
3653
|
+
function zt(t, e) {
|
|
3628
3654
|
if (t.scenes && t.scenes.length) for (let n = 0, r = t.scenes.length; n < r; n++) {
|
|
3629
3655
|
const r = t.scenes[n].nodes;
|
|
3630
3656
|
for (let n = 0, s = r.length; n < s; n++) {
|
|
3631
3657
|
const s = [];
|
|
3632
|
-
|
|
3658
|
+
jt(r[n], s, t, e);
|
|
3633
3659
|
}
|
|
3634
3660
|
}
|
|
3635
3661
|
}
|
|
3636
|
-
function
|
|
3637
|
-
if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++)
|
|
3662
|
+
function jt(t, e, n, r) {
|
|
3663
|
+
if (t.matrix && e.push(t.matrix), t.children && t.children.length) for (let s = 0, i = t.children.length; s < i; s++) jt(t.children[s], e, n, r);
|
|
3638
3664
|
if (void 0 !== t.mesh) {
|
|
3639
3665
|
const s = t.mesh, i = n.meshes[s];
|
|
3640
3666
|
if (i) {
|
|
@@ -3646,9 +3672,9 @@
|
|
|
3646
3672
|
}
|
|
3647
3673
|
}
|
|
3648
3674
|
}
|
|
3649
|
-
function
|
|
3675
|
+
function Vt(t, e, n) {
|
|
3650
3676
|
let {componentType: r, byteOffset: s, byteStride: i, itemSize: o} = e;
|
|
3651
|
-
const a = e.array.buffer, c = r ?
|
|
3677
|
+
const a = e.array.buffer, c = r ? Et.getTypedArrayCtor(r) : e.array.constructor;
|
|
3652
3678
|
if (s = void 0 === s ? e.array.byteOffset : s, i = i || 0, !i || i === o * c.BYTES_PER_ELEMENT && s % c.BYTES_PER_ELEMENT == 0) {
|
|
3653
3679
|
const e = new c(a, s + n * o * c.BYTES_PER_ELEMENT, o);
|
|
3654
3680
|
return t.set(e), t;
|
|
@@ -3657,63 +3683,63 @@
|
|
|
3657
3683
|
const h = new Uint8Array(a, i * n + s, o * c.BYTES_PER_ELEMENT);
|
|
3658
3684
|
return new Uint8Array(t.buffer).set(h), t;
|
|
3659
3685
|
}
|
|
3660
|
-
function
|
|
3686
|
+
function Gt(t, e, n, r) {
|
|
3661
3687
|
t[4 * e] = n[r], t[4 * e + 1] = n[r + 4], t[4 * e + 2] = n[r + 8], t[4 * e + 3] = n[r + 12];
|
|
3662
3688
|
}
|
|
3663
|
-
const
|
|
3664
|
-
function
|
|
3665
|
-
const s =
|
|
3666
|
-
|
|
3667
|
-
R(
|
|
3668
|
-
const o = Math.sqrt(k(
|
|
3689
|
+
const Ht = new Array(3), qt = new Array(3), $t = [ 40680631590769, 40680631590769, 40408299984661.445 ];
|
|
3690
|
+
function Jt(t, e, n, r) {
|
|
3691
|
+
const s = $t, i = Math.cos(n);
|
|
3692
|
+
Ht[0] = i * Math.cos(e), Ht[1] = i * Math.sin(e), Ht[2] = Math.sin(n), re(Ht, Ht),
|
|
3693
|
+
R(qt, s, Ht);
|
|
3694
|
+
const o = Math.sqrt(k(Ht, qt));
|
|
3669
3695
|
var a, c, h;
|
|
3670
|
-
return c =
|
|
3671
|
-
F(
|
|
3696
|
+
return c = qt, h = o, (a = qt)[0] = c[0] / h, a[1] = c[1] / h, a[2] = c[2] / h,
|
|
3697
|
+
F(Ht, Ht, r), function(t, e, n) {
|
|
3672
3698
|
return t[0] = e[0] + n[0], t[1] = e[1] + n[1], t[2] = e[2] + n[2], t;
|
|
3673
|
-
}(t,
|
|
3699
|
+
}(t, qt, Ht);
|
|
3674
3700
|
}
|
|
3675
|
-
const
|
|
3676
|
-
function
|
|
3677
|
-
const n =
|
|
3678
|
-
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(
|
|
3701
|
+
const Kt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Xt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Zt = new Array(3), Wt = new Array(3), Yt = new Array(3);
|
|
3702
|
+
function Qt(t, e) {
|
|
3703
|
+
const n = Xt, r = function(t, e, n, r, s) {
|
|
3704
|
+
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(te, e, y);
|
|
3679
3705
|
if (m < s) return isFinite(y) ? b : void 0;
|
|
3680
|
-
const p = r[0], w = r[1], _ = r[2], g =
|
|
3706
|
+
const p = r[0], w = r[1], _ = r[2], g = ee;
|
|
3681
3707
|
g[0] = b[0] * p * 2, g[1] = b[1] * w * 2, g[2] = b[2] * _ * 2;
|
|
3682
|
-
let T, A,
|
|
3708
|
+
let T, A, v, O, M, S, x, I, N, E, P, C = (1 - y) * ne(e) / (.5 * ne(g)), U = 0;
|
|
3683
3709
|
do {
|
|
3684
|
-
C -= U,
|
|
3685
|
-
x =
|
|
3686
|
-
A = f * N * p + l *
|
|
3710
|
+
C -= U, v = 1 / (1 + C * p), O = 1 / (1 + C * w), M = 1 / (1 + C * _), S = v * v,
|
|
3711
|
+
x = O * O, I = M * M, N = S * v, E = x * O, P = I * M, T = f * S + l * x + d * I - 1,
|
|
3712
|
+
A = f * N * p + l * E * w + d * P * _;
|
|
3687
3713
|
U = T / (-2 * A);
|
|
3688
3714
|
} while (Math.abs(T) > 1e-12);
|
|
3689
|
-
return t[0] = i *
|
|
3690
|
-
}(
|
|
3691
|
-
let s = V(
|
|
3692
|
-
s =
|
|
3693
|
-
const i =
|
|
3715
|
+
return t[0] = i * v, t[1] = o * O, t[2] = a * M, t;
|
|
3716
|
+
}(Zt, e, Kt, n, .1);
|
|
3717
|
+
let s = V(Wt, r, n);
|
|
3718
|
+
s = re(s, s);
|
|
3719
|
+
const i = j(Yt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = _(k(i, e)) * ne(i);
|
|
3694
3720
|
return t[0] = p(o), t[1] = p(a), t[2] = c, t;
|
|
3695
3721
|
}
|
|
3696
|
-
const
|
|
3697
|
-
function
|
|
3698
|
-
return
|
|
3722
|
+
const te = new Array(3), ee = new Array(3);
|
|
3723
|
+
function ne(t) {
|
|
3724
|
+
return P(t);
|
|
3699
3725
|
}
|
|
3700
|
-
function
|
|
3726
|
+
function re(t, e) {
|
|
3701
3727
|
const n = e[0], r = e[1], s = e[2];
|
|
3702
3728
|
let i = n * n + r * r + s * s;
|
|
3703
3729
|
return i > 0 && (i = Math.sqrt(i), t[0] = e[0] / i, t[1] = e[1] / i, t[2] = e[2] / i),
|
|
3704
3730
|
t;
|
|
3705
3731
|
}
|
|
3706
|
-
function
|
|
3707
|
-
return R(e, t,
|
|
3732
|
+
function se(t, e) {
|
|
3733
|
+
return R(e, t, Xt), D(e, e);
|
|
3708
3734
|
}
|
|
3709
|
-
var
|
|
3735
|
+
var ie = Object.freeze({
|
|
3710
3736
|
__proto__: null,
|
|
3711
|
-
radianToCartesian3:
|
|
3712
|
-
cartesian3ToDegree:
|
|
3713
|
-
normalizeCartesian:
|
|
3714
|
-
geodeticSurfaceNormal:
|
|
3737
|
+
radianToCartesian3: Jt,
|
|
3738
|
+
cartesian3ToDegree: Qt,
|
|
3739
|
+
normalizeCartesian: re,
|
|
3740
|
+
geodeticSurfaceNormal: se
|
|
3715
3741
|
});
|
|
3716
|
-
function
|
|
3742
|
+
function oe(t, e) {
|
|
3717
3743
|
let n = "";
|
|
3718
3744
|
for (let r = 0; r < 4; r++) {
|
|
3719
3745
|
const s = t.getUint8(e + r);
|
|
@@ -3721,27 +3747,27 @@
|
|
|
3721
3747
|
}
|
|
3722
3748
|
return n;
|
|
3723
3749
|
}
|
|
3724
|
-
const
|
|
3725
|
-
function
|
|
3750
|
+
const ae = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
3751
|
+
function ce(t, e, n) {
|
|
3726
3752
|
const r = new Uint8Array(t, e, n);
|
|
3727
|
-
return
|
|
3753
|
+
return ae ? JSON.parse(ae.decode(r)) : JSON.parse(T(r));
|
|
3728
3754
|
}
|
|
3729
|
-
function
|
|
3755
|
+
function he(t, e, n) {
|
|
3730
3756
|
const r = new Uint8Array(t, e, n);
|
|
3731
|
-
return
|
|
3757
|
+
return ae ? JSON.parse(ae.decode(r)) : JSON.parse(T(r));
|
|
3732
3758
|
}
|
|
3733
|
-
function
|
|
3759
|
+
function ue(t, e, n) {
|
|
3734
3760
|
return {
|
|
3735
3761
|
offset: e,
|
|
3736
3762
|
byteLength: n
|
|
3737
3763
|
};
|
|
3738
3764
|
}
|
|
3739
|
-
function
|
|
3765
|
+
function fe(t, e, n, r) {
|
|
3740
3766
|
const {byteOffset: s, componentType: i, type: o} = t, {ctor: a, type: c} = function(t) {
|
|
3741
|
-
return
|
|
3767
|
+
return me[t];
|
|
3742
3768
|
}(i), h = function(t) {
|
|
3743
3769
|
if (!t) return 1;
|
|
3744
|
-
return
|
|
3770
|
+
return de[t];
|
|
3745
3771
|
}(o);
|
|
3746
3772
|
return {
|
|
3747
3773
|
byteStride: 0,
|
|
@@ -3752,18 +3778,19 @@
|
|
|
3752
3778
|
array: new a(e, n + s, r * h)
|
|
3753
3779
|
};
|
|
3754
3780
|
}
|
|
3755
|
-
function
|
|
3756
|
-
|
|
3781
|
+
function le(t, e, n, r) {
|
|
3782
|
+
t.componentType || (t.componentType = "UNSIGNED_SHORT");
|
|
3783
|
+
const s = fe(t, e, n, r);
|
|
3757
3784
|
return s.array.buffer.byteLength !== e.byteLength && (s.array = s.array.slice()),
|
|
3758
3785
|
s;
|
|
3759
3786
|
}
|
|
3760
|
-
const
|
|
3787
|
+
const de = {
|
|
3761
3788
|
"SCALAR": 1,
|
|
3762
3789
|
"VEC2": 2,
|
|
3763
3790
|
"VEC3": 3,
|
|
3764
3791
|
"VEC4": 4
|
|
3765
3792
|
};
|
|
3766
|
-
const
|
|
3793
|
+
const me = {
|
|
3767
3794
|
"BYTE": {
|
|
3768
3795
|
ctor: Int8Array,
|
|
3769
3796
|
type: 5120,
|
|
@@ -3805,27 +3832,27 @@
|
|
|
3805
3832
|
name: "Float64Array"
|
|
3806
3833
|
}
|
|
3807
3834
|
};
|
|
3808
|
-
function
|
|
3809
|
-
for (let e in
|
|
3835
|
+
function ye(t) {
|
|
3836
|
+
for (let e in me) if (t === me[e].ctor) return me[e].type;
|
|
3810
3837
|
throw new Error("unrecognized ctor:" + t);
|
|
3811
3838
|
}
|
|
3812
|
-
function
|
|
3839
|
+
function be(t, e, n, r) {
|
|
3813
3840
|
const s = t, i = e.length / 3;
|
|
3814
3841
|
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],
|
|
3815
3842
|
s[3 * t + 2] = e[3 * t + 2] / 65535 * r[2] + n[2];
|
|
3816
3843
|
return s;
|
|
3817
3844
|
}
|
|
3818
|
-
function
|
|
3845
|
+
function pe(t, e, n) {
|
|
3819
3846
|
let r = t.getUint32(12, !0), s = t.getUint32(16, !0), i = t.getUint32(20, !0), o = t.getUint32(24, !0);
|
|
3820
3847
|
const a = t.buffer;
|
|
3821
3848
|
let c, h, u = {}, f = {};
|
|
3822
|
-
r > 0 && (u =
|
|
3849
|
+
r > 0 && (u = ce(a, e, r), e += r), s > 0 && (c = function(t, e, n) {
|
|
3823
3850
|
return {
|
|
3824
3851
|
offset: e,
|
|
3825
3852
|
byteLength: n
|
|
3826
3853
|
};
|
|
3827
|
-
}(0, e, s), e += s), i > 0 && (f =
|
|
3828
|
-
const l =
|
|
3854
|
+
}(0, e, s), e += s), i > 0 && (f = he(a, e, i), e += i);
|
|
3855
|
+
const l = ue(0, e, o);
|
|
3829
3856
|
return h = a.slice(l.offset, l.offset + l.byteLength), n.push(h), {
|
|
3830
3857
|
featureTable: u,
|
|
3831
3858
|
featureTableBin: c,
|
|
@@ -3833,33 +3860,33 @@
|
|
|
3833
3860
|
batchTableBin: h
|
|
3834
3861
|
};
|
|
3835
3862
|
}
|
|
3836
|
-
var
|
|
3863
|
+
var we = {
|
|
3837
3864
|
north: [ -1, 0, 0 ],
|
|
3838
3865
|
east: [ 0, 1, 0 ],
|
|
3839
3866
|
up: [ 0, 0, 1 ],
|
|
3840
3867
|
south: [ 1, 0, 0 ],
|
|
3841
3868
|
west: [ 0, -1, 0 ],
|
|
3842
3869
|
down: [ 0, 0, -1 ]
|
|
3843
|
-
},
|
|
3870
|
+
}, _e = {}, ge = {
|
|
3844
3871
|
east: [],
|
|
3845
3872
|
north: [],
|
|
3846
3873
|
up: [],
|
|
3847
3874
|
west: [],
|
|
3848
3875
|
south: [],
|
|
3849
3876
|
down: []
|
|
3850
|
-
},
|
|
3851
|
-
const
|
|
3852
|
-
function
|
|
3877
|
+
}, Te = [], Ae = [], ve = [];
|
|
3878
|
+
const Oe = [ 0, 0, 0 ];
|
|
3879
|
+
function Me(t, e, n, r) {
|
|
3853
3880
|
n = n || 0, r = r || n;
|
|
3854
3881
|
var s = Math.abs(t - e);
|
|
3855
3882
|
return s <= r || s <= n * Math.max(Math.abs(t), Math.abs(e));
|
|
3856
3883
|
}
|
|
3857
|
-
function
|
|
3884
|
+
function Se(t, e, n) {
|
|
3858
3885
|
return n[0] = t[0], n[1] = t[1], n[2] = t[2], n[3] = t[3], n[4] = t[4], n[5] = t[5],
|
|
3859
3886
|
n[6] = t[6], n[7] = t[7], n[8] = t[8], n[9] = t[9], n[10] = t[10], n[11] = t[11],
|
|
3860
3887
|
n[12] = e[0], n[13] = e[1], n[14] = e[2], n[15] = t[15], n;
|
|
3861
3888
|
}
|
|
3862
|
-
const
|
|
3889
|
+
const xe = (Pe = {
|
|
3863
3890
|
up: {
|
|
3864
3891
|
south: "east",
|
|
3865
3892
|
north: "west",
|
|
@@ -3896,36 +3923,35 @@
|
|
|
3896
3923
|
north: "up",
|
|
3897
3924
|
south: "down"
|
|
3898
3925
|
}
|
|
3899
|
-
}[
|
|
3900
|
-
if (
|
|
3901
|
-
|
|
3902
|
-
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));
|
|
3903
|
-
}(t, Ae)) U(_e, be[Se]), U(ge, be[xe]), U(Te, be[Ne]); else if (Oe(t[0], 0, 1e-14) && Oe(t[1], 0, 1e-14)) {
|
|
3926
|
+
}[Ie = "east"][Ne = "north"], _e[Ce = Ie + Ne] ? Ee = _e[Ce] : (Ee = function(t, e, n) {
|
|
3927
|
+
if (a = Oe, c = (o = t)[0], h = o[1], u = o[2], f = a[0], l = a[1], d = a[2], Math.abs(c - f) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(f)) && Math.abs(h - l) <= 1e-6 * Math.max(1, Math.abs(h), Math.abs(l)) && Math.abs(u - d) <= 1e-6 * Math.max(1, Math.abs(u), Math.abs(d))) U(Te, we[Ie]),
|
|
3928
|
+
U(Ae, we[Ne]), U(ve, we[Pe]); else if (Me(t[0], 0, 1e-14) && Me(t[1], 0, 1e-14)) {
|
|
3904
3929
|
var r = _(t[2]);
|
|
3905
|
-
U(
|
|
3906
|
-
U(
|
|
3930
|
+
U(Te, we[Ie]), "east" !== Ie && "west" !== Ie && F(Te, Te, r), U(Ae, we[Ne]), "east" !== Ne && "west" !== Ne && F(Ae, Ae, r),
|
|
3931
|
+
U(ve, we[Pe]), "east" !== Pe && "west" !== Pe && F(ve, ve, r);
|
|
3907
3932
|
} else {
|
|
3908
|
-
|
|
3909
|
-
var s =
|
|
3910
|
-
i[0] = -t[1], i[1] = t[0], i[2] = 0, D(
|
|
3911
|
-
F(
|
|
3912
|
-
}
|
|
3913
|
-
|
|
3914
|
-
n[
|
|
3933
|
+
se(t, ge.up);
|
|
3934
|
+
var s = ge.up, i = ge.east;
|
|
3935
|
+
i[0] = -t[1], i[1] = t[0], i[2] = 0, D(ge.east, i), z(ge.north, s, i), F(ge.down, ge.up, -1),
|
|
3936
|
+
F(ge.west, ge.east, -1), F(ge.south, ge.north, -1), Te = ge[Ie], Ae = ge[Ne], ve = ge[Pe];
|
|
3937
|
+
}
|
|
3938
|
+
var o, a, c, h, u, f, l, d;
|
|
3939
|
+
return n[0] = Te[0], n[1] = Te[1], n[2] = Te[2], n[3] = 0, n[4] = Ae[0], n[5] = Ae[1],
|
|
3940
|
+
n[6] = Ae[2], n[7] = 0, n[8] = ve[0], n[9] = ve[1], n[10] = ve[2], n[11] = 0, n[12] = t[0],
|
|
3915
3941
|
n[13] = t[1], n[14] = t[2], n[15] = 1, n;
|
|
3916
|
-
},
|
|
3917
|
-
var
|
|
3918
|
-
const
|
|
3942
|
+
}, _e[Ce] = Ee), Ee);
|
|
3943
|
+
var Ie, Ne, Ee, Pe, Ce;
|
|
3944
|
+
const Ue = [], Be = [], Le = [], Re = [], Fe = [], De = [], ke = [], ze = {
|
|
3919
3945
|
x: 0,
|
|
3920
3946
|
y: 0
|
|
3921
|
-
},
|
|
3947
|
+
}, je = {
|
|
3922
3948
|
x: 0,
|
|
3923
3949
|
y: 0
|
|
3924
|
-
},
|
|
3925
|
-
const {getTextureMagFilter:
|
|
3950
|
+
}, Ve = Math.PI / 180;
|
|
3951
|
+
const {getTextureMagFilter: Ge, getTextureMinFilter: He, getTextureWrap: qe, getMaterialType: $e, getMaterialFormat: Je, getPrimitive: Ke, getUniqueREGLBuffer: Xe} = n.reshader.REGLHelper, Ze = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], We = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], {loginIBLResOnCanvas: Ye, logoutIBLResOnCanvas: Qe, getIBLResOnCanvas: tn, getPBRUniforms: en} = n.reshader.pbr.PBRUtils, nn = {
|
|
3926
3952
|
factor: 0,
|
|
3927
3953
|
units: 0
|
|
3928
|
-
},
|
|
3954
|
+
}, rn = [ 1, 1, 1 ], sn = n.mat4.identity([]), on = t => t.material instanceof n.reshader.PhongMaterial, an = t => t.material instanceof n.reshader.pbr.StandardMaterial, cn = [ !1, !1, !1, !1 ], hn = [ !0, !0, !0, !0 ], un = [], fn = new s.Coordinate(0, 0), ln = [], dn = [], mn = {
|
|
3929
3955
|
"POSITION": "POSITION",
|
|
3930
3956
|
"NORMAL": "NORMAL",
|
|
3931
3957
|
"TEXCOORD_0": "TEXCOORD_0",
|
|
@@ -3933,16 +3959,16 @@
|
|
|
3933
3959
|
"COLOR_0": "COLOR_0",
|
|
3934
3960
|
"TANGENT": "TANGENT"
|
|
3935
3961
|
};
|
|
3936
|
-
class
|
|
3962
|
+
class yn {
|
|
3937
3963
|
constructor(t, e) {
|
|
3938
|
-
this.Nt = e, this.
|
|
3964
|
+
this.Nt = e, this.Et = e.getRenderer().canvas, this.Pt = new s.SpatialReference,
|
|
3939
3965
|
this.Ct = t, this.Ut = new n.reshader.Renderer(t), this.Bt = {}, this.Lt = {}, this.Rt = {},
|
|
3940
|
-
this.Ft = {}, this.Dt = {}, this.kt = {}, this.
|
|
3966
|
+
this.Ft = {}, this.Dt = {}, this.kt = {}, this.zt = {}, this.jt = new n.reshader.Scene,
|
|
3941
3967
|
this.Vt = new n.reshader.Scene, this.Gt = new n.reshader.Scene, this.Ht = new n.reshader.Scene,
|
|
3942
|
-
this
|
|
3968
|
+
this.qt = new n.reshader.ResourceLoader(t.texture(2)), this.$t = this.Jt.bind(this),
|
|
3943
3969
|
this.Kt = new n.reshader.PhongMaterial({
|
|
3944
3970
|
"baseColorFactor": [ 1, 1, 1, 1 ]
|
|
3945
|
-
}), this.Xt(), this.Zt = new n.reshader.KHRTechniquesWebglManager(this.Ct, this.Wt(), this
|
|
3971
|
+
}), this.Xt(), this.Zt = new n.reshader.KHRTechniquesWebglManager(this.Ct, this.Wt(), this.qt);
|
|
3946
3972
|
}
|
|
3947
3973
|
getI3DMMeshes() {
|
|
3948
3974
|
return this.Dt;
|
|
@@ -3965,10 +3991,10 @@
|
|
|
3965
3991
|
let r = this.Qt(t[n].data.node);
|
|
3966
3992
|
if (!r) {
|
|
3967
3993
|
if (r = this.kt[t[n].data.node.id], !r) continue;
|
|
3968
|
-
r =
|
|
3994
|
+
r = v(r);
|
|
3969
3995
|
}
|
|
3970
3996
|
const s = t[n].node;
|
|
3971
|
-
let f = a[s.te].polygonOffset ||
|
|
3997
|
+
let f = a[s.te].polygonOffset || nn;
|
|
3972
3998
|
y(f) && (f = f());
|
|
3973
3999
|
const l = a[s.te].ambientLight;
|
|
3974
4000
|
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,
|
|
@@ -3981,7 +4007,7 @@
|
|
|
3981
4007
|
}
|
|
3982
4008
|
let f = 0;
|
|
3983
4009
|
const l = this.Zt.getExcludeFilter();
|
|
3984
|
-
f += this.ne(this.re, i, [ n,
|
|
4010
|
+
f += this.ne(this.re, i, [ n, on, l ], r, h, u), f += this.ne(this.se, i, [ n, an, l ], r, h, u),
|
|
3985
4011
|
this.Zt.forEachShader((t, e, s) => {
|
|
3986
4012
|
const i = this.Yt(s);
|
|
3987
4013
|
f += this.ne(t, i, [ n, e ], r, h, u);
|
|
@@ -3993,11 +4019,11 @@
|
|
|
3993
4019
|
return f += this.Ut.render(this.oe, m, this.Vt, r && r.fbo), f;
|
|
3994
4020
|
}
|
|
3995
4021
|
ne(t, e, n, r, s, i) {
|
|
3996
|
-
t.filter = n.filter(t => !!t), e.debug = !1, this.
|
|
3997
|
-
e.cullFace = "front", e.colorMask =
|
|
3998
|
-
e.stencilEnable = !0, e.debug = !1, e.cullFace = "back", e.colorMask =
|
|
4022
|
+
t.filter = n.filter(t => !!t), e.debug = !1, this.jt.setMeshes(s), e.stencilEnable = !1,
|
|
4023
|
+
e.cullFace = "front", e.colorMask = cn, this.Ut.render(t, e, this.jt, r && r.fbo),
|
|
4024
|
+
e.stencilEnable = !0, e.debug = !1, e.cullFace = "back", e.colorMask = hn;
|
|
3999
4025
|
let o = 0;
|
|
4000
|
-
this.
|
|
4026
|
+
this.jt.setMeshes(i), o += this.Ut.render(t, e, this.jt, r && r.fbo), e.stencilEnable = !0;
|
|
4001
4027
|
const a = [];
|
|
4002
4028
|
for (const t in this.Dt) a.push(...this.Dt[t]);
|
|
4003
4029
|
return this.Gt.setMeshes(a), o += this.Ut.render(t, e, this.Gt, r && r.fbo), o;
|
|
@@ -4030,7 +4056,7 @@
|
|
|
4030
4056
|
}
|
|
4031
4057
|
de(t) {
|
|
4032
4058
|
let e = this.kt[t];
|
|
4033
|
-
e =
|
|
4059
|
+
e = v(e);
|
|
4034
4060
|
for (let t = 0; t < e.length; t++) {
|
|
4035
4061
|
const {id: n} = e[t].properties;
|
|
4036
4062
|
this.le(n);
|
|
@@ -4041,16 +4067,16 @@
|
|
|
4041
4067
|
if (Array.isArray(t)) for (let e = 0, n = t.length; e < n; e++) this.me(t[e]); else {
|
|
4042
4068
|
const e = t.geometry.properties.url;
|
|
4043
4069
|
if (e) {
|
|
4044
|
-
const t = this.
|
|
4070
|
+
const t = this.zt[e];
|
|
4045
4071
|
t && (t.refCount--, t.refCount <= 0 && (t.geometry.dispose(), t.material.dispose(),
|
|
4046
|
-
delete this.
|
|
4072
|
+
delete this.zt[e]));
|
|
4047
4073
|
} else t.geometry.dispose(), t.material && t.material.dispose();
|
|
4048
4074
|
t.dispose();
|
|
4049
4075
|
}
|
|
4050
4076
|
}
|
|
4051
4077
|
remove() {
|
|
4052
4078
|
const t = this.Nt;
|
|
4053
|
-
|
|
4079
|
+
Qe(t.getRenderer().canvas, t.getMap());
|
|
4054
4080
|
for (const t in this.kt) this.de(t);
|
|
4055
4081
|
this.kt = {};
|
|
4056
4082
|
for (const t in this.Rt) this.le(t);
|
|
@@ -4073,8 +4099,8 @@
|
|
|
4073
4099
|
let r = new s.Coordinate(p(e[0]), p(e[1])), i = new s.Coordinate(p(e[2]), p(e[3]));
|
|
4074
4100
|
r = this.ye(r), i = this.ye(i);
|
|
4075
4101
|
const o = r.add(i).be(.5);
|
|
4076
|
-
r.
|
|
4077
|
-
const a = this.
|
|
4102
|
+
r._sub(o), i._sub(o);
|
|
4103
|
+
const a = this.pe(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({
|
|
4078
4104
|
aPosition: u
|
|
4079
4105
|
}, [ 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, {
|
|
4080
4106
|
primitive: "lines"
|
|
@@ -4108,7 +4134,7 @@
|
|
|
4108
4134
|
i.RGB ? u.HAS_RGB = 1 : i.RGBA ? u.HAS_RGBA = 1 : i.RGB565 && (u.HAS_RGB565 = 1),
|
|
4109
4135
|
(i.NORMAL || i.NORMAL_OCT16P) && (u.HAS_NORMAL = 1, i.NORMAL_OCT16P && (u.HAS_NORMAL_OCT16P = 1)),
|
|
4110
4136
|
t.featureTable.CONSTANT_RGBA && (t.featureTable.CONSTANT_RGBA = t.featureTable.CONSTANT_RGBA.map(t => t / 255));
|
|
4111
|
-
const {rtcCenter: f, rtcCoord: l} = t, d = this.
|
|
4137
|
+
const {rtcCenter: f, rtcCoord: l} = t, d = this.we(l), m = this._e(r, f, l);
|
|
4112
4138
|
n.mat4.multiply(m, m, d);
|
|
4113
4139
|
const y = this.Nt.options.services[a], b = new n.reshader.Mesh(h);
|
|
4114
4140
|
return b.properties.magic = "pnts", b.properties.id = e, b.properties.count = c,
|
|
@@ -4141,14 +4167,14 @@
|
|
|
4141
4167
|
mesh: t
|
|
4142
4168
|
}), t;
|
|
4143
4169
|
}
|
|
4144
|
-
const i = this.
|
|
4170
|
+
const i = this.ge(r.Te), {i3dm: o, featureTable: a, gltf: c, batchTable: h, batchTableBin: u, count: f} = t, l = a.INSTANCES_LENGTH, {rtcCenter: d, rtcCoord: m} = t, y = this.we(m), b = this._e(r, d, m), {POSITION: p, NORMAL_UP: w, NORMAL_RIGHT: _, SCALE: g, SCALE_NON_UNIFORM: T, INSTANCE_ROTATION: v} = o, O = {
|
|
4145
4171
|
"instance_vectorA": new Float32Array(4 * l),
|
|
4146
4172
|
"instance_vectorB": new Float32Array(4 * l),
|
|
4147
4173
|
"instance_vectorC": new Float32Array(4 * l)
|
|
4148
|
-
}, M = new Float32Array(3), S = new Float32Array(3), x = [], I = new Float32Array(1), N = new Float32Array(3),
|
|
4174
|
+
}, M = new Float32Array(3), S = new Float32Array(3), x = [], I = new Float32Array(1), N = new Float32Array(3), E = [], P = [], C = [], U = [], B = new Float32Array(9);
|
|
4149
4175
|
!function(t, e) {
|
|
4150
4176
|
let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
|
|
4151
|
-
const a = t.array.buffer, c = n ?
|
|
4177
|
+
const a = t.array.buffer, c = n ? Et.getTypedArrayCtor(n) : t.array.constructor;
|
|
4152
4178
|
if (r = void 0 === r ? t.array.byteOffset : r, s = s || 0, i = i || t.array.length / o,
|
|
4153
4179
|
(!s || s === o * c.BYTES_PER_ELEMENT) && r % c.BYTES_PER_ELEMENT == 0) {
|
|
4154
4180
|
const t = new c(a, r, i * o);
|
|
@@ -4165,25 +4191,25 @@
|
|
|
4165
4191
|
e(new c(h.buffer), t), n.set(h);
|
|
4166
4192
|
}
|
|
4167
4193
|
}(p, (t, e) => {
|
|
4168
|
-
w ? (
|
|
4169
|
-
A(
|
|
4170
|
-
g ? (
|
|
4171
|
-
n.mat4.fromRotationTranslationScale(U,
|
|
4172
|
-
|
|
4194
|
+
w ? (Vt(S, _, e), Vt(M, w, e), n.vec3.cross(x, S, M), n.vec3.normalize(x, x), A(E, S, 0),
|
|
4195
|
+
A(E, M, 1), A(E, x, 2), n.quat.fromMat3(P, E)) : v ? (Vt(B, v, e), n.quat.fromMat3(P, B)) : n.quat.identity(P),
|
|
4196
|
+
g ? (Vt(I, g, e), n.vec3.set(C, I[0], I[0], I[0])) : T ? (Vt(N, T, e), n.vec3.set(C, ...N)) : n.vec3.set(C, 1, 1, 1),
|
|
4197
|
+
n.mat4.fromRotationTranslationScale(U, P, t, C), Gt(O.instance_vectorA, e, U, 0),
|
|
4198
|
+
Gt(O.instance_vectorB, e, U, 1), Gt(O.instance_vectorC, e, U, 2);
|
|
4173
4199
|
});
|
|
4174
4200
|
const L = {};
|
|
4175
|
-
for (const t in
|
|
4201
|
+
for (const t in O) L[t] = {
|
|
4176
4202
|
buffer: this.Ct.buffer({
|
|
4177
|
-
dimension:
|
|
4178
|
-
data:
|
|
4203
|
+
dimension: O[t].length / l,
|
|
4204
|
+
data: O[t]
|
|
4179
4205
|
}),
|
|
4180
4206
|
divisor: 1
|
|
4181
4207
|
};
|
|
4182
4208
|
const R = this.Nt.options.services[r.te].shader || "phong";
|
|
4183
4209
|
let F = 0, D = !0;
|
|
4184
4210
|
const k = [];
|
|
4185
|
-
return
|
|
4186
|
-
let {geometry: c, material: d} = this.
|
|
4211
|
+
return zt(c, (t, s, o, a) => {
|
|
4212
|
+
let {geometry: c, material: d} = this.Ae(t, s, o, a, r, !0, R);
|
|
4187
4213
|
d && !d.isReady() && (D = !1, F++);
|
|
4188
4214
|
const m = new n.reshader.InstancedMesh(L, l, c, d);
|
|
4189
4215
|
m.properties.magic = "i3dm", m.properties.id = e, m.properties.count = f, m.properties.batchTable = h,
|
|
@@ -4201,7 +4227,7 @@
|
|
|
4201
4227
|
})) : (this.Bt[e] = {
|
|
4202
4228
|
meshes: k,
|
|
4203
4229
|
count: F
|
|
4204
|
-
}, k.
|
|
4230
|
+
}, k.Oe = s), k;
|
|
4205
4231
|
}
|
|
4206
4232
|
createB3DMMesh(t, e, r, i) {
|
|
4207
4233
|
if (this.Rt[e] || this.Bt[e]) {
|
|
@@ -4216,12 +4242,12 @@
|
|
|
4216
4242
|
const t = new s.Extent(r.maxExtent).convertTo(t => this._pointToPrj(t));
|
|
4217
4243
|
o = [ t.xmin, t.ymin, t.xmax, t.ymax ];
|
|
4218
4244
|
}
|
|
4219
|
-
const a = this.
|
|
4245
|
+
const a = this.ge(r.Te), c = t.gltf, {center: h, coord: u} = c.extensions.CESIUM_RTC, f = this.Nt.options.services[r.te].heightOffset || 0;
|
|
4220
4246
|
f && (u[2] += f);
|
|
4221
|
-
const l = this.
|
|
4247
|
+
const l = this.we(u, r.te), d = this.Nt.options.services[r.te].shader || "phong", m = [];
|
|
4222
4248
|
let y = 0, b = !0;
|
|
4223
|
-
return
|
|
4224
|
-
let {geometry: p, material: w} = this.
|
|
4249
|
+
return zt(c, (s, i, c, f) => {
|
|
4250
|
+
let {geometry: p, material: w} = this.Ae(s, i, c, f, r, !1, d);
|
|
4225
4251
|
w && !w.isReady() && (b = !1, y++);
|
|
4226
4252
|
const _ = new n.reshader.Mesh(p, w);
|
|
4227
4253
|
_.properties.magic = "b3dm", _.properties.id = e, _.properties.batchTable = t.batchTable,
|
|
@@ -4230,7 +4256,7 @@
|
|
|
4230
4256
|
_.setDefines(g), o && (g.USE_MAX_EXTENT = 1, _.setUniform("maxPrjExtent", o));
|
|
4231
4257
|
let T = n.mat4.identity([]);
|
|
4232
4258
|
if (s.matrices && s.matrices.length) for (let t = 0; t < s.matrices.length; t++) n.mat4.multiply(T, T, s.matrices[t]);
|
|
4233
|
-
const A = this.
|
|
4259
|
+
const A = this._e(r, h, u);
|
|
4234
4260
|
n.mat4.multiply(T, a, T), n.mat4.multiply(T, l, T), n.mat4.multiply(T, A, T), _.setLocalTransform(T),
|
|
4235
4261
|
m.push(_);
|
|
4236
4262
|
}), b ? (this.Rt[e] = m, i(null, {
|
|
@@ -4239,49 +4265,49 @@
|
|
|
4239
4265
|
})) : (this.Bt[e] = {
|
|
4240
4266
|
meshes: m,
|
|
4241
4267
|
count: y
|
|
4242
|
-
}, m.
|
|
4268
|
+
}, m.Oe = i), m;
|
|
4243
4269
|
}
|
|
4244
|
-
|
|
4270
|
+
_e(t, e, r) {
|
|
4245
4271
|
const i = this.getMap(), o = this.Nt.options.services[t.te].heightOffset || 0, a = new s.Coordinate(r), c = i.distanceToPointAtRes(100, 0, i.getGLRes(), a).x / 100;
|
|
4246
4272
|
let h = t.matrix ? n.mat4.copy([], t.matrix) : n.mat4.identity([]);
|
|
4247
4273
|
if (e) {
|
|
4248
|
-
|
|
4274
|
+
Se(h, n.vec3.transformMat4(un, e, h), h);
|
|
4249
4275
|
}
|
|
4250
4276
|
const u = function(t, e, n, r, s, i, o) {
|
|
4251
|
-
e = U(
|
|
4252
|
-
const a =
|
|
4277
|
+
e = U(Ue, e);
|
|
4278
|
+
const a = Jt(Ue, e[0] * Ve, e[1] * Ve, e[2]), c = function(t, e) {
|
|
4253
4279
|
return t[0] = e[12], t[1] = e[13], t[2] = e[14], t;
|
|
4254
|
-
}(
|
|
4280
|
+
}(Be, n), h = r.ellipsoid;
|
|
4255
4281
|
var u;
|
|
4256
|
-
u = 0 === G(c) ? B(
|
|
4257
|
-
const f = r.project(
|
|
4258
|
-
|
|
4259
|
-
const l =
|
|
4260
|
-
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,
|
|
4261
|
-
return n[0] = T, n[1] = A, n[2] =
|
|
4282
|
+
u = 0 === G(c) ? B(Le, 0, 0, -6378137) : Qt(Le, c), ze.x = u[0], ze.y = u[1];
|
|
4283
|
+
const f = r.project(ze, je);
|
|
4284
|
+
Re[0] = f.x / s, Re[1] = f.y / s, Re[2] = (u[2] + o) * i;
|
|
4285
|
+
const l = xe(a, h, Fe), d = function(t, e, n) {
|
|
4286
|
+
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;
|
|
4287
|
+
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,
|
|
4262
4288
|
n[8] = x, n[9] = I, n[10] = N, n[11] = 0, n[12] = t[12], n[13] = t[13], n[14] = t[14],
|
|
4263
4289
|
n[15] = t[15], n;
|
|
4264
4290
|
}(function(t, e) {
|
|
4265
|
-
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,
|
|
4266
|
-
return
|
|
4267
|
-
t[2] = (y *
|
|
4268
|
-
t[5] = (n * N - s * S + i * M) *
|
|
4269
|
-
t[8] = (o * I - a * S + h *
|
|
4270
|
-
t[11] = (f * g - u * A - d * w) *
|
|
4271
|
-
t[14] = (y * _ - m * T - b * w) *
|
|
4272
|
-
}(
|
|
4291
|
+
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;
|
|
4292
|
+
return E ? (E = 1 / E, t[0] = (a * N - c * I + h * x) * E, t[1] = (s * I - r * N - i * x) * E,
|
|
4293
|
+
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,
|
|
4294
|
+
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,
|
|
4295
|
+
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,
|
|
4296
|
+
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,
|
|
4297
|
+
t[14] = (y * _ - m * T - b * w) * E, t[15] = (u * T - f * _ + l * w) * E, t) : null;
|
|
4298
|
+
}(De, l), function(t, e) {
|
|
4273
4299
|
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],
|
|
4274
4300
|
t[6] = e[8], t[7] = e[9], t[8] = e[10], t;
|
|
4275
|
-
}(
|
|
4276
|
-
return
|
|
4301
|
+
}(ke, n), t);
|
|
4302
|
+
return Se(t, Re, d), t;
|
|
4277
4303
|
}(h, r, h, i.getProjection(), i.getGLRes(), c, o), f = function(t, e) {
|
|
4278
4304
|
return B(t, e[12], e[13], e[14]), t;
|
|
4279
|
-
}(
|
|
4305
|
+
}(dn, u);
|
|
4280
4306
|
let l = this.Nt.options.offset;
|
|
4281
4307
|
if (y(l)) {
|
|
4282
|
-
l = l(this.Nt.
|
|
4308
|
+
l = l(this.Nt.Me(t.id).center);
|
|
4283
4309
|
}
|
|
4284
|
-
return n.vec3.set(
|
|
4310
|
+
return n.vec3.set(ln, l[0], l[1], 0), n.vec3.sub(f, f, ln), Se(u, f, u), u;
|
|
4285
4311
|
}
|
|
4286
4312
|
createCMPTMesh(t, e, r, s) {
|
|
4287
4313
|
if (this.kt[e]) {
|
|
@@ -4296,13 +4322,13 @@
|
|
|
4296
4322
|
for (let t = 0; t < i.length; t++) {
|
|
4297
4323
|
const {magic: n} = i[t], s = e + "." + t;
|
|
4298
4324
|
"b3dm" === n ? this.createB3DMMesh(i[t], s, r, (t, {mesh: e}) => {
|
|
4299
|
-
this.
|
|
4325
|
+
this.Se(a, e), o.push(e);
|
|
4300
4326
|
}) : "i3dm" === n ? this.createI3DMMesh(i[t], s, r, (t, {mesh: e}) => {
|
|
4301
4327
|
a = null, o.push(e);
|
|
4302
4328
|
}) : "pnts" === n ? this.createPntsMesh(i[t], s, r, (t, {mesh: e}) => {
|
|
4303
|
-
this.
|
|
4329
|
+
this.Se(a, e), o.push(e);
|
|
4304
4330
|
}) : "cmpt" === n && this.createCMPTMesh(i[t], s, r, (t, {mesh: e}) => {
|
|
4305
|
-
e.boundingBox || (a = null), this.
|
|
4331
|
+
e.boundingBox || (a = null), this.Se(a, e), o.push(e);
|
|
4306
4332
|
});
|
|
4307
4333
|
}
|
|
4308
4334
|
return a && (o.boundingBox = [ a.min, a.max ]), this.kt[e] = o, s(null, {
|
|
@@ -4310,38 +4336,38 @@
|
|
|
4310
4336
|
mesh: o
|
|
4311
4337
|
}), o;
|
|
4312
4338
|
}
|
|
4313
|
-
|
|
4339
|
+
Se(t, e) {
|
|
4314
4340
|
if (!t) return null;
|
|
4315
4341
|
if (e.boundingBox) t.combine(e.boundingBox); else for (let n = 0; n < e.length; n++) e[n] && t.combine(e[n].getBoundingBox());
|
|
4316
4342
|
}
|
|
4317
4343
|
ve(t, e, n, r) {
|
|
4318
4344
|
return ("phong" === (this.Nt.options.services[r].shader || "phong") ? this.re : this.se).getGeometryDefines(e);
|
|
4319
4345
|
}
|
|
4320
|
-
|
|
4346
|
+
Ae(t, e, n, r, s, i, o) {
|
|
4321
4347
|
const a = r.url + "-" + e + "-" + n;
|
|
4322
|
-
if (this.
|
|
4348
|
+
if (this.zt[a]) return this.zt[a].refCount++, this.zt[a];
|
|
4323
4349
|
let c, h;
|
|
4324
4350
|
const u = r.materials[t.material];
|
|
4325
4351
|
if (r.extensions && r.extensions.KHR_techniques_webgl && u.extensions && u.extensions.KHR_techniques_webgl) {
|
|
4326
|
-
const e = this.
|
|
4352
|
+
const e = this.xe(t, r, i);
|
|
4327
4353
|
c = e.material, h = e.geometry;
|
|
4328
|
-
} else h = this.
|
|
4354
|
+
} else h = this.Ie(t, i, mn), c = this.Ne(t.material, r, o);
|
|
4329
4355
|
c && !c.isReady() ? c.Ee = s.id : c || (c = this.Kt);
|
|
4330
4356
|
const f = {
|
|
4331
4357
|
refCount: 1,
|
|
4332
4358
|
geometry: h,
|
|
4333
4359
|
material: c
|
|
4334
4360
|
};
|
|
4335
|
-
return h.properties.url = a, this.
|
|
4361
|
+
return h.properties.url = a, this.zt[a] = f, f;
|
|
4336
4362
|
}
|
|
4337
|
-
|
|
4363
|
+
xe(t, e, n) {
|
|
4338
4364
|
const {geometry: r, material: s} = this.Zt.createMesh(t, e, n);
|
|
4339
4365
|
return {
|
|
4340
4366
|
geometry: r,
|
|
4341
4367
|
material: s
|
|
4342
4368
|
};
|
|
4343
4369
|
}
|
|
4344
|
-
|
|
4370
|
+
Ie(t, e, r) {
|
|
4345
4371
|
const s = t.attributes, i = r.COLOR_0;
|
|
4346
4372
|
if (s[i] && s[i] instanceof Float32Array) {
|
|
4347
4373
|
const t = new Uint8Array(s[i].length);
|
|
@@ -4350,7 +4376,7 @@
|
|
|
4350
4376
|
}
|
|
4351
4377
|
const o = {};
|
|
4352
4378
|
for (const t in s) {
|
|
4353
|
-
const e =
|
|
4379
|
+
const e = Xe(this.Ct, s[t], {
|
|
4354
4380
|
dimension: s[t].itemSize
|
|
4355
4381
|
}), n = r[t] || t;
|
|
4356
4382
|
o[n] = {
|
|
@@ -4365,16 +4391,16 @@
|
|
|
4365
4391
|
uv1Attribute: r.TEXCOORD_1,
|
|
4366
4392
|
color0Attribute: r.COLOR_0,
|
|
4367
4393
|
tangentAttribute: r.TANGENT,
|
|
4368
|
-
primitive: void 0 === t.mode ? "triangles" :
|
|
4394
|
+
primitive: void 0 === t.mode ? "triangles" : Ke(t.mode)
|
|
4369
4395
|
});
|
|
4370
4396
|
return a.generateBuffers(this.Ct, {
|
|
4371
4397
|
excludeElementsInVAO: e
|
|
4372
4398
|
}), a;
|
|
4373
4399
|
}
|
|
4374
|
-
|
|
4375
|
-
const e = n.mat4.identity([]), r = this.getMap(), s = this.
|
|
4376
|
-
|
|
4377
|
-
const i = r.distanceToPointAtRes(100, 100, r.getGLRes(),
|
|
4400
|
+
we(t) {
|
|
4401
|
+
const e = n.mat4.identity([]), r = this.getMap(), s = this.Pe();
|
|
4402
|
+
fn.x = t[0], fn.y = t[1];
|
|
4403
|
+
const i = r.distanceToPointAtRes(100, 100, r.getGLRes(), fn);
|
|
4378
4404
|
return n.vec3.set(s, i.x / 100 * 1.01, i.y / 100 * 1.01, i.y / 100), n.mat4.scale(e, e, s),
|
|
4379
4405
|
e;
|
|
4380
4406
|
}
|
|
@@ -4382,8 +4408,8 @@
|
|
|
4382
4408
|
const t = {
|
|
4383
4409
|
x: 0,
|
|
4384
4410
|
y: 0,
|
|
4385
|
-
width: () => this.
|
|
4386
|
-
height: () => this.
|
|
4411
|
+
width: () => this.Et ? this.Et.width : 1,
|
|
4412
|
+
height: () => this.Et ? this.Et.height : 1
|
|
4387
4413
|
};
|
|
4388
4414
|
this.ue = new n.reshader.MeshShader({
|
|
4389
4415
|
vert: "attribute vec3 aPosition;\n\nuniform mat4 projViewModelMatrix;\n\nvoid main() {\n gl_Position = projViewModelMatrix * vec4(aPosition, 1.0);\n}\n",
|
|
@@ -4434,17 +4460,17 @@
|
|
|
4434
4460
|
extraCommandProps: s
|
|
4435
4461
|
});
|
|
4436
4462
|
const i = this.Nt;
|
|
4437
|
-
|
|
4463
|
+
Ye(i.getRenderer().canvas, this.Ct, i.getMap());
|
|
4438
4464
|
}
|
|
4439
4465
|
Wt() {
|
|
4440
4466
|
return {
|
|
4441
4467
|
viewport: {
|
|
4442
4468
|
x: 0,
|
|
4443
4469
|
y: 0,
|
|
4444
|
-
width: () => this.
|
|
4445
|
-
height: () => this.
|
|
4470
|
+
width: () => this.Et ? this.Et.width : 1,
|
|
4471
|
+
height: () => this.Et ? this.Et.height : 1
|
|
4446
4472
|
},
|
|
4447
|
-
colorMask: (t, e) => e.colorMask ||
|
|
4473
|
+
colorMask: (t, e) => e.colorMask || hn,
|
|
4448
4474
|
cull: {
|
|
4449
4475
|
enable: !0,
|
|
4450
4476
|
face: (t, e) => e.cullFace
|
|
@@ -4495,7 +4521,7 @@
|
|
|
4495
4521
|
};
|
|
4496
4522
|
}
|
|
4497
4523
|
Yt() {
|
|
4498
|
-
const t = this.getMap(), e = this.Nt.getRenderer().canvas, {iblTexes: n, dfgLUT: r} =
|
|
4524
|
+
const t = this.getMap(), e = this.Nt.getRenderer().canvas, {iblTexes: n, dfgLUT: r} = tn(e), s = en(t, n, r);
|
|
4499
4525
|
return m(s, {
|
|
4500
4526
|
lightSpecular: [ 1, 1, 1 ],
|
|
4501
4527
|
viewMatrix: t.viewMatrix,
|
|
@@ -4506,7 +4532,7 @@
|
|
|
4506
4532
|
polygonOpacity: 1
|
|
4507
4533
|
}), s;
|
|
4508
4534
|
}
|
|
4509
|
-
|
|
4535
|
+
Ne(t, e, r) {
|
|
4510
4536
|
const s = e.materials[t];
|
|
4511
4537
|
if (!s || !s.baseColorTexture && !s.pbrMetallicRoughness) return null;
|
|
4512
4538
|
let i;
|
|
@@ -4544,24 +4570,24 @@
|
|
|
4544
4570
|
}
|
|
4545
4571
|
}
|
|
4546
4572
|
let o = new n.reshader.pbr.StandardMaterial(i);
|
|
4547
|
-
return "phong" === r && (o = n.reshader.PhongMaterial.convertFrom(o)), o.once("complete", this
|
|
4573
|
+
return "phong" === r && (o = n.reshader.PhongMaterial.convertFrom(o)), o.once("complete", this.$t),
|
|
4548
4574
|
o;
|
|
4549
4575
|
}
|
|
4550
4576
|
T(t, e) {
|
|
4551
4577
|
const r = {
|
|
4552
|
-
type: t.type ?
|
|
4553
|
-
format: t.format ?
|
|
4578
|
+
type: t.type ? $e(t.type) : "uint8",
|
|
4579
|
+
format: t.format ? Je(t.format) : "rgba",
|
|
4554
4580
|
flipY: !1
|
|
4555
4581
|
};
|
|
4556
|
-
if (e && e.baseColorTexture) r.url = this.
|
|
4582
|
+
if (e && e.baseColorTexture) r.url = this.Ce(t); else {
|
|
4557
4583
|
const e = t.image;
|
|
4558
4584
|
r.data = e.array, r.width = e.width, r.height = e.height;
|
|
4559
4585
|
}
|
|
4560
4586
|
const s = t.sampler || t.texture.sampler;
|
|
4561
|
-
return s && (s.magFilter && (r.mag =
|
|
4562
|
-
s.wrapS && (r.wrapS =
|
|
4587
|
+
return s && (s.magFilter && (r.mag = Ge(s.magFilter)), s.minFilter && (r.min = He(s.minFilter)),
|
|
4588
|
+
s.wrapS && (r.wrapS = qe(s.wrapS)), s.wrapT && (r.wrapT = qe(s.wrapT))), new n.reshader.Texture2D(r, this.qt);
|
|
4563
4589
|
}
|
|
4564
|
-
|
|
4590
|
+
Ce(t) {
|
|
4565
4591
|
const e = t.image, n = window.URL || window.webkitURL, r = new Blob([ e.array ], {
|
|
4566
4592
|
type: e.mimeType
|
|
4567
4593
|
});
|
|
@@ -4572,20 +4598,20 @@
|
|
|
4572
4598
|
if (n.count--, !n.count) {
|
|
4573
4599
|
const t = n.meshes;
|
|
4574
4600
|
this.Rt[e] = t, delete this.Bt[e];
|
|
4575
|
-
const r = t.
|
|
4576
|
-
delete t.
|
|
4601
|
+
const r = t.Oe;
|
|
4602
|
+
delete t.Oe, r(null, {
|
|
4577
4603
|
mesh: n.meshes,
|
|
4578
4604
|
id: e
|
|
4579
4605
|
});
|
|
4580
4606
|
}
|
|
4581
4607
|
}
|
|
4582
|
-
|
|
4583
|
-
return
|
|
4608
|
+
Pe() {
|
|
4609
|
+
return rn;
|
|
4584
4610
|
}
|
|
4585
4611
|
ye(t) {
|
|
4586
4612
|
return this.Nt.ye(t);
|
|
4587
4613
|
}
|
|
4588
|
-
|
|
4614
|
+
pe(t, e) {
|
|
4589
4615
|
const n = this.getMap();
|
|
4590
4616
|
return n.getGLZoom ? n.distanceToPoint(t, e, n.getGLZoom()) : n.distanceToPointAtRes(t, e, n.getGLRes());
|
|
4591
4617
|
}
|
|
@@ -4597,13 +4623,13 @@
|
|
|
4597
4623
|
const e = this.getMap();
|
|
4598
4624
|
return e.getGLZoom ? e._prjToPoint(t, e.getGLZoom()) : e._prjToPointAtRes(t, e.getGLRes());
|
|
4599
4625
|
}
|
|
4600
|
-
|
|
4601
|
-
return "Y" === t ?
|
|
4626
|
+
ge(t) {
|
|
4627
|
+
return "Y" === t ? Ze : "X" === t ? We : sn;
|
|
4602
4628
|
}
|
|
4603
4629
|
}
|
|
4604
|
-
class
|
|
4630
|
+
class bn extends s.renderer.CanvasRenderer {
|
|
4605
4631
|
constructor(t) {
|
|
4606
|
-
super(t), this.prepareWorker(), this.tilesLoading = {}, this.tileCache = new
|
|
4632
|
+
super(t), this.prepareWorker(), this.tilesLoading = {}, this.tileCache = new kt(1024 * t.options.maxGPUMemory * 1024, this.deleteTile.bind(this)),
|
|
4607
4633
|
this.gt = {};
|
|
4608
4634
|
}
|
|
4609
4635
|
needToRedraw() {
|
|
@@ -4617,30 +4643,30 @@
|
|
|
4617
4643
|
if (n && !n.intersects(this.canvasExtent2D)) return void this.completeRender();
|
|
4618
4644
|
const {root: r, tiles: s} = this.layer.getTiles(), i = s ? Object.keys(s).length : 0;
|
|
4619
4645
|
if (!s || !i) return void this.completeRender();
|
|
4620
|
-
const {selectedTiles: o, leaves: a, requests: c} = this.
|
|
4621
|
-
this.
|
|
4646
|
+
const {selectedTiles: o, leaves: a, requests: c} = this.Ue(r, s);
|
|
4647
|
+
this.Be(o, a, e), this.Le(), c.length ? this.loadTiles(c) : this.completeRender();
|
|
4622
4648
|
}
|
|
4623
|
-
|
|
4649
|
+
Ue(t, e) {
|
|
4624
4650
|
let n = [];
|
|
4625
|
-
this.
|
|
4651
|
+
this.Re();
|
|
4626
4652
|
let r = 0;
|
|
4627
|
-
const s = this.
|
|
4653
|
+
const s = this.Fe(), i = {};
|
|
4628
4654
|
let o = !1, a = !1;
|
|
4629
4655
|
for (const t in e) {
|
|
4630
4656
|
const s = e[t], c = s.node;
|
|
4631
4657
|
if (i[c.id]) continue;
|
|
4632
4658
|
i[c.id] = 1;
|
|
4633
4659
|
let h = !1;
|
|
4634
|
-
const u = this.
|
|
4635
|
-
if (this.
|
|
4660
|
+
const u = this.De(c.id);
|
|
4661
|
+
if (this.ke(c.id) ? (r++, h = a = !0, this.tilesLoading[c.id].current = !0) : u ? (this.getTileOpacity(u) < 1 && (h = a = !0),
|
|
4636
4662
|
o = !0, s.selected = !0, s.data = u) : this.painter.has(c) || (h = a = !0, n.push(c)),
|
|
4637
4663
|
!h) continue;
|
|
4638
4664
|
if (this.ze(s)) o = !0; else {
|
|
4639
|
-
this.
|
|
4665
|
+
this.je(s).length && (o = !0);
|
|
4640
4666
|
}
|
|
4641
4667
|
}
|
|
4642
4668
|
let c = [], h = {};
|
|
4643
|
-
if (o && ({selectedTiles: c, leaves: h} = this.
|
|
4669
|
+
if (o && ({selectedTiles: c, leaves: h} = this.Ve(t)), n.length > 1 && (n.sort(wn),
|
|
4644
4670
|
s)) {
|
|
4645
4671
|
const t = s - r;
|
|
4646
4672
|
n = t > 0 ? n.slice(0, t) : [];
|
|
@@ -4652,14 +4678,14 @@
|
|
|
4652
4678
|
leaves: h
|
|
4653
4679
|
};
|
|
4654
4680
|
}
|
|
4655
|
-
|
|
4681
|
+
Ve(t) {
|
|
4656
4682
|
const e = [], n = {};
|
|
4657
4683
|
let r;
|
|
4658
4684
|
const s = [ t ], i = [];
|
|
4659
4685
|
for (;s.length > 0 || i.length > 0; ) {
|
|
4660
4686
|
if (i.length > 0) {
|
|
4661
4687
|
const t = i[i.length - 1];
|
|
4662
|
-
if (t.
|
|
4688
|
+
if (t.Ge === s.length) {
|
|
4663
4689
|
i.pop(), t === r && (t.leave = !0, n[t.node.id] = 1), e.push(t);
|
|
4664
4690
|
continue;
|
|
4665
4691
|
}
|
|
@@ -4671,9 +4697,9 @@
|
|
|
4671
4697
|
t.leave = !0, n[t.node.id] = 1, e.push(t);
|
|
4672
4698
|
continue;
|
|
4673
4699
|
}
|
|
4674
|
-
i.push(t), t.
|
|
4700
|
+
i.push(t), t.Ge = s.length;
|
|
4675
4701
|
}
|
|
4676
|
-
o.length > 1 && o.sort(
|
|
4702
|
+
o.length > 1 && o.sort(pn);
|
|
4677
4703
|
for (let t = 0; t < o.length; t++) s.push(o[t]);
|
|
4678
4704
|
}
|
|
4679
4705
|
return {
|
|
@@ -4692,10 +4718,10 @@
|
|
|
4692
4718
|
}
|
|
4693
4719
|
return null;
|
|
4694
4720
|
}
|
|
4695
|
-
|
|
4721
|
+
je(t) {
|
|
4696
4722
|
const e = [];
|
|
4697
4723
|
if (!t.node.children || !t.node.children.length) return e;
|
|
4698
|
-
const n = t
|
|
4724
|
+
const n = t.He + 1, r = [ t.node ];
|
|
4699
4725
|
for (;r.length > 0; ) {
|
|
4700
4726
|
const s = r.pop().children;
|
|
4701
4727
|
for (let i = 0, o = s.length; i < o; i++) {
|
|
@@ -4705,14 +4731,14 @@
|
|
|
4705
4731
|
}
|
|
4706
4732
|
const o = s[i].id;
|
|
4707
4733
|
if (this.tileCache.has(o)) {
|
|
4708
|
-
const n = this.layer
|
|
4734
|
+
const n = this.layer.$e(s[i], t);
|
|
4709
4735
|
n.selected = !0, n.data = this.tileCache.get(o), t.children.push(n), e.push(n);
|
|
4710
|
-
} else s[i]
|
|
4736
|
+
} else s[i].He <= n && r.push(s[i]);
|
|
4711
4737
|
}
|
|
4712
4738
|
}
|
|
4713
4739
|
return e;
|
|
4714
4740
|
}
|
|
4715
|
-
|
|
4741
|
+
Be(t, e, n) {
|
|
4716
4742
|
this.tileCache.markAll(!1);
|
|
4717
4743
|
for (let e = 0, n = t.length; e < n; e++) {
|
|
4718
4744
|
const n = t[e].data;
|
|
@@ -4746,7 +4772,7 @@
|
|
|
4746
4772
|
let e = t.content.url;
|
|
4747
4773
|
if (M(e)) {
|
|
4748
4774
|
const n = S(e);
|
|
4749
|
-
return void this.
|
|
4775
|
+
return void this.Je(e, n, t);
|
|
4750
4776
|
}
|
|
4751
4777
|
t && -1 === e.indexOf("http://") && -1 === e.indexOf("https://") && (e = t.baseUrl + e);
|
|
4752
4778
|
const n = this.layer.options.services[t.te];
|
|
@@ -4756,53 +4782,53 @@
|
|
|
4756
4782
|
let s = ft.getArrayBuffer(e + (r || ""), n.ajaxOptions);
|
|
4757
4783
|
const i = s.xhr;
|
|
4758
4784
|
s = s.then(n => {
|
|
4759
|
-
delete this.gt[e], n ? this.
|
|
4785
|
+
delete this.gt[e], n ? this.Je(e, n.data, t) : this.onTileError(null, t);
|
|
4760
4786
|
}).catch(n => {
|
|
4761
4787
|
delete this.gt[e], this.onTileError(n, t);
|
|
4762
4788
|
}), this.gt[e] = i;
|
|
4763
|
-
} else this.
|
|
4789
|
+
} else this.Je(e, null, t);
|
|
4764
4790
|
}
|
|
4765
|
-
|
|
4791
|
+
Je(t, e, n) {
|
|
4766
4792
|
this.workerConn.loadTile(this.layer.getId(), {
|
|
4767
4793
|
url: t,
|
|
4768
4794
|
arraybuffer: e,
|
|
4769
4795
|
rootIdx: n.te,
|
|
4770
|
-
upAxis: n.
|
|
4796
|
+
upAxis: n.Te,
|
|
4771
4797
|
transform: n.matrix
|
|
4772
4798
|
}, (e, r) => {
|
|
4773
4799
|
if (e) return void this.onTileError(e, n);
|
|
4774
4800
|
const {magic: s} = r;
|
|
4775
4801
|
"b3dm" === s ? this.painter.createB3DMMesh(r, n.id, n, (t, {mesh: e}) => {
|
|
4776
|
-
n.
|
|
4802
|
+
n.Ke = this.Xe(e), this.Ze(r, n, t, e);
|
|
4777
4803
|
}) : "pnts" === s ? this.painter.createPntsMesh(r, n.id, n, (t, {mesh: e}) => {
|
|
4778
|
-
n.
|
|
4804
|
+
n.Ke = this.Xe(e), this.Ze(r, n, t, e);
|
|
4779
4805
|
}) : "i3dm" === s ? this.painter.createI3DMMesh(r, n.id, n, (t, {mesh: e}) => {
|
|
4780
|
-
this.
|
|
4806
|
+
this.Ze(r, n, t, e);
|
|
4781
4807
|
}) : "cmpt" === s ? this.painter.createCMPTMesh(r, n.id, n, (t, {mesh: e}) => {
|
|
4782
|
-
e.boundingBox && (n.
|
|
4808
|
+
e.boundingBox && (n.Ke = e.boundingBox), this.Ze(r, n, t, e);
|
|
4783
4809
|
}) : this.onTilesetLoad(r, n, t);
|
|
4784
4810
|
});
|
|
4785
4811
|
}
|
|
4786
|
-
|
|
4812
|
+
Xe(t) {
|
|
4787
4813
|
if (1 === t.length) return t[0].getBoundingBox();
|
|
4788
4814
|
if (!n.reshader.BoundingBox) return null;
|
|
4789
4815
|
const e = new n.reshader.BoundingBox;
|
|
4790
4816
|
for (let n = 0; n < t.length; n++) t[n] && e.combine(t[n].getBoundingBox());
|
|
4791
4817
|
return [ e.min, e.max ];
|
|
4792
4818
|
}
|
|
4793
|
-
|
|
4819
|
+
Ze(t, e, n, r) {
|
|
4794
4820
|
if (n) this.onTileError(n, e); else {
|
|
4795
|
-
const n = this.
|
|
4821
|
+
const n = this.We(r);
|
|
4796
4822
|
e.memorySize = n, this.onTileLoad(t, e);
|
|
4797
4823
|
}
|
|
4798
4824
|
}
|
|
4799
|
-
|
|
4825
|
+
We(t) {
|
|
4800
4826
|
let e = 0;
|
|
4801
|
-
if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.
|
|
4827
|
+
if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.We(t[n])); else t && (e += t.getMemorySize());
|
|
4802
4828
|
return e;
|
|
4803
4829
|
}
|
|
4804
4830
|
onTileLoad(t, e) {
|
|
4805
|
-
this.layer && (delete this.tilesLoading[e.id], this.
|
|
4831
|
+
this.layer && (delete this.tilesLoading[e.id], this.Ye(e), this.setToRedraw(), this.layer.fire("tileload", {
|
|
4806
4832
|
node: e
|
|
4807
4833
|
}));
|
|
4808
4834
|
}
|
|
@@ -4813,15 +4839,15 @@
|
|
|
4813
4839
|
if (!this.layer) return;
|
|
4814
4840
|
const n = e.content.url;
|
|
4815
4841
|
console.warn("failed to load 3d tile: " + n), console.warn(t), delete this.tilesLoading[e.id],
|
|
4816
|
-
this.
|
|
4842
|
+
this.Ye(e), this.setToRedraw(), this.layer.fire("tileerror", {
|
|
4817
4843
|
node: e,
|
|
4818
4844
|
error: t
|
|
4819
4845
|
});
|
|
4820
4846
|
}
|
|
4821
|
-
|
|
4847
|
+
De(t) {
|
|
4822
4848
|
return this.tileCache.get(t);
|
|
4823
4849
|
}
|
|
4824
|
-
|
|
4850
|
+
Ye(t) {
|
|
4825
4851
|
const e = {
|
|
4826
4852
|
loadTime: s.Util.now(),
|
|
4827
4853
|
current: !0,
|
|
@@ -4838,7 +4864,7 @@
|
|
|
4838
4864
|
} else this.workerConn.abortTileLoading(this.layer.getId(), e);
|
|
4839
4865
|
delete this.gt[e];
|
|
4840
4866
|
}
|
|
4841
|
-
|
|
4867
|
+
Re() {
|
|
4842
4868
|
if (this.tilesLoading) for (const t in this.tilesLoading) this.tilesLoading[t].current = !1;
|
|
4843
4869
|
}
|
|
4844
4870
|
deleteTile(t) {
|
|
@@ -4853,16 +4879,16 @@
|
|
|
4853
4879
|
antialias: t.options.antialias
|
|
4854
4880
|
};
|
|
4855
4881
|
this.canvas.gl && this.canvas.gl.wrap ? (this.gl = this.canvas.gl.wrap(), this.regl = this.canvas.gl.regl) : (this.glOptions = e,
|
|
4856
|
-
this.gl = this.
|
|
4882
|
+
this.gl = this.Qe(this.canvas, e)), this.regl = this.regl || n.createREGL({
|
|
4857
4883
|
gl: this.gl,
|
|
4858
4884
|
attributes: e,
|
|
4859
4885
|
extensions: [ "OES_element_index_uint", "WEBGL_compressed_texture_s3tc" ],
|
|
4860
4886
|
optionalExtensions: t.options.optionalExtensions || []
|
|
4861
|
-
}), this.painter = new
|
|
4887
|
+
}), this.painter = new yn(this.regl, t);
|
|
4862
4888
|
}
|
|
4863
4889
|
prepareWorker() {
|
|
4864
4890
|
const t = this.getMap();
|
|
4865
|
-
this.workerConn || (this.workerConn = new
|
|
4891
|
+
this.workerConn || (this.workerConn = new Rt("@maptalks/3dtiles", t.id));
|
|
4866
4892
|
const e = this.workerConn;
|
|
4867
4893
|
if (!e.isActive()) return;
|
|
4868
4894
|
let n = this.layer.options || {};
|
|
@@ -4880,7 +4906,7 @@
|
|
|
4880
4906
|
super.onRemove();
|
|
4881
4907
|
}
|
|
4882
4908
|
clear() {
|
|
4883
|
-
this.
|
|
4909
|
+
this.Le(!0), this.tileCache.reset(), this.tilesLoading = {}, super.clear();
|
|
4884
4910
|
}
|
|
4885
4911
|
clearCanvas() {
|
|
4886
4912
|
this.regl && this.regl.clear({
|
|
@@ -4895,11 +4921,11 @@
|
|
|
4895
4921
|
getStencilValue() {
|
|
4896
4922
|
return 0;
|
|
4897
4923
|
}
|
|
4898
|
-
|
|
4899
|
-
this.
|
|
4924
|
+
Le(t) {
|
|
4925
|
+
this.tn || (this.tn = Date.now());
|
|
4900
4926
|
const e = Date.now();
|
|
4901
|
-
if (t || !(e - this.
|
|
4902
|
-
this.
|
|
4927
|
+
if (t || !(e - this.tn < this.layer.options.retireInterval)) {
|
|
4928
|
+
this.tn = e;
|
|
4903
4929
|
for (const e in this.tilesLoading) {
|
|
4904
4930
|
const n = this.tilesLoading[e];
|
|
4905
4931
|
!t && n.current || (this.abortTileLoading(n), this.painter.has(n) && this.painter.deleteTile(n),
|
|
@@ -4907,10 +4933,10 @@
|
|
|
4907
4933
|
}
|
|
4908
4934
|
}
|
|
4909
4935
|
}
|
|
4910
|
-
|
|
4936
|
+
Fe() {
|
|
4911
4937
|
return this.getMap().isInteracting() ? this.layer.options.loadingLimitOnInteracting : this.layer.options.loadingLimit;
|
|
4912
4938
|
}
|
|
4913
|
-
|
|
4939
|
+
Qe(t, e) {
|
|
4914
4940
|
const n = [ "webgl", "experimental-webgl" ];
|
|
4915
4941
|
let r = null;
|
|
4916
4942
|
for (let s = 0; s < n.length; ++s) {
|
|
@@ -4921,7 +4947,7 @@
|
|
|
4921
4947
|
}
|
|
4922
4948
|
return r;
|
|
4923
4949
|
}
|
|
4924
|
-
|
|
4950
|
+
ke(t) {
|
|
4925
4951
|
return !!this.tilesLoading[t];
|
|
4926
4952
|
}
|
|
4927
4953
|
getI3DMMeshes() {
|
|
@@ -4934,23 +4960,23 @@
|
|
|
4934
4960
|
return this.painter.getB3DMMeshes();
|
|
4935
4961
|
}
|
|
4936
4962
|
readBatchData(t, e, n) {
|
|
4937
|
-
return
|
|
4963
|
+
return fe(t, e, 0, n);
|
|
4938
4964
|
}
|
|
4939
4965
|
}
|
|
4940
|
-
function
|
|
4941
|
-
return 0 === t.node.ce && 0 === e.node.ce ? e.node.
|
|
4966
|
+
function pn(t, e) {
|
|
4967
|
+
return 0 === t.node.ce && 0 === e.node.ce ? e.node.en - t.node.en : e.node.ce - t.node.ce;
|
|
4942
4968
|
}
|
|
4943
|
-
function
|
|
4944
|
-
return 0 === t.ce && 0 === e.ce ? t.
|
|
4969
|
+
function wn(t, e) {
|
|
4970
|
+
return 0 === t.ce && 0 === e.ce ? t.en - e.en : t.ce - e.ce;
|
|
4945
4971
|
}
|
|
4946
|
-
function
|
|
4972
|
+
function _n(t, e, n) {
|
|
4947
4973
|
return t[0] = e[n], t[1] = e[n + 3], t[2] = e[n + 6], t;
|
|
4948
4974
|
}
|
|
4949
|
-
function
|
|
4975
|
+
function gn(t, e, n) {
|
|
4950
4976
|
return Math.sqrt(function(t, e, n) {
|
|
4951
|
-
var r = L(
|
|
4977
|
+
var r = L(Tn, n, t), s = _n(An, e, 0), i = _n(vn, e, 1), o = _n(On, e, 2), a = G(s), c = G(i), h = G(o);
|
|
4952
4978
|
D(s, s), D(i, i), D(o, o);
|
|
4953
|
-
var u =
|
|
4979
|
+
var u = Mn;
|
|
4954
4980
|
u.x = k(r, s), u.y = k(r, i), u.z = k(r, o);
|
|
4955
4981
|
var f, l = 0;
|
|
4956
4982
|
u.x < -a ? (f = u.x + a, l += f * f) : u.x > a && (f = u.x - a, l += f * f);
|
|
@@ -4959,15 +4985,15 @@
|
|
|
4959
4985
|
return l;
|
|
4960
4986
|
}(t, e, n));
|
|
4961
4987
|
}
|
|
4962
|
-
const
|
|
4963
|
-
const
|
|
4964
|
-
class
|
|
4988
|
+
const Tn = [], An = [], vn = [], On = [], Mn = [];
|
|
4989
|
+
const Sn = s.projection.EPSG3857, xn = new s.Extent(0, 0, 0, 0), In = [], Nn = [], En = new s.Coordinate(0, 0), Pn = n.mat4.identity([]);
|
|
4990
|
+
class Cn extends s.Layer {
|
|
4965
4991
|
constructor(t, e) {
|
|
4966
|
-
super(t, e), this.
|
|
4992
|
+
super(t, e), this.nn(), this.gt = {}, this.rn = {};
|
|
4967
4993
|
}
|
|
4968
|
-
|
|
4994
|
+
nn() {
|
|
4969
4995
|
let t = this.options.services.map(t => t.url);
|
|
4970
|
-
this.
|
|
4996
|
+
this.sn = t.map((t, e) => function(t, e) {
|
|
4971
4997
|
t = w(t);
|
|
4972
4998
|
return {
|
|
4973
4999
|
baseUrl: t.substring(0, t.lastIndexOf("/")) + "/",
|
|
@@ -4977,35 +5003,35 @@
|
|
|
4977
5003
|
refine: "replace",
|
|
4978
5004
|
matrix: n.mat4.identity([]),
|
|
4979
5005
|
te: e,
|
|
4980
|
-
|
|
5006
|
+
He: 0
|
|
4981
5007
|
};
|
|
4982
5008
|
}(t, e)), this.fire("rootready", {
|
|
4983
|
-
roots: this.
|
|
5009
|
+
roots: this.sn.slice(0)
|
|
4984
5010
|
});
|
|
4985
5011
|
}
|
|
4986
5012
|
getExtent(t) {
|
|
4987
5013
|
if (!t && 0 !== t) {
|
|
4988
5014
|
const t = new s.Extent;
|
|
4989
|
-
for (let e = 0; e < this.
|
|
4990
|
-
const n = this.boundingVolumeToExtent(this.
|
|
5015
|
+
for (let e = 0; e < this.sn.length; e++) if (this.sn[e].boundingVolume) {
|
|
5016
|
+
const n = this.boundingVolumeToExtent(this.sn[e]);
|
|
4991
5017
|
t._combine(n);
|
|
4992
5018
|
}
|
|
4993
5019
|
return t;
|
|
4994
5020
|
}
|
|
4995
|
-
return this.
|
|
5021
|
+
return this.sn[t] && this.sn[t].boundingVolume ? this.boundingVolumeToExtent(this.sn[t]) : null;
|
|
4996
5022
|
}
|
|
4997
5023
|
boundingVolumeToExtent(t) {
|
|
4998
|
-
const e = t.boundingVolume.
|
|
5024
|
+
const e = t.boundingVolume.in ? Pn : t.matrix, r = this.getMap();
|
|
4999
5025
|
if (t.boundingVolume.region) {
|
|
5000
5026
|
const e = t.boundingVolume.region;
|
|
5001
5027
|
return new s.Extent(p(e[0]), p(e[1]), p(e[2]), p(e[3]));
|
|
5002
5028
|
}
|
|
5003
5029
|
if (t.boundingVolume.sphere) {
|
|
5004
|
-
const i = t.boundingVolume.sphere, o =
|
|
5030
|
+
const i = t.boundingVolume.sphere, o = Qt([], n.vec3.transformMat4([], i, e)), a = i[3], c = r.locate(o, -a, a), h = r.locate(o, a, -a);
|
|
5005
5031
|
return new s.Extent(c, h);
|
|
5006
5032
|
}
|
|
5007
5033
|
if (t.boundingVolume.box) {
|
|
5008
|
-
const i = t.boundingVolume.box, o = n.vec3.transformMat4([], i, e), a = new s.Coordinate(
|
|
5034
|
+
const i = t.boundingVolume.box, o = n.vec3.transformMat4([], i, e), a = new s.Coordinate(Qt([], o)), c = i.slice(3);
|
|
5009
5035
|
n.mat3.multiply(c, n.mat3.fromMat4([], t.matrix), c);
|
|
5010
5036
|
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);
|
|
5011
5037
|
return new s.Extent(d, m);
|
|
@@ -5013,53 +5039,53 @@
|
|
|
5013
5039
|
return null;
|
|
5014
5040
|
}
|
|
5015
5041
|
getRootTiles() {
|
|
5016
|
-
return this.
|
|
5042
|
+
return this.sn;
|
|
5017
5043
|
}
|
|
5018
5044
|
getTiles() {
|
|
5019
|
-
return this.getRenderer().ready ? this.
|
|
5045
|
+
return this.getRenderer().ready ? this.an() : (this.cn(), {
|
|
5020
5046
|
tiles: null
|
|
5021
5047
|
});
|
|
5022
5048
|
}
|
|
5023
|
-
|
|
5049
|
+
an() {
|
|
5024
5050
|
const t = this.getMap(), e = t.cameraPosition;
|
|
5025
5051
|
let r, s;
|
|
5026
|
-
if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()),
|
|
5027
|
-
r = t.pointToCoord(
|
|
5052
|
+
if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), En.set(e[0], e[1]),
|
|
5053
|
+
r = t.pointToCoord(En, t.getGLZoom()); else {
|
|
5028
5054
|
const n = t.getGLRes();
|
|
5029
|
-
s = t.pointAtResToDistance(e[2], 0, n),
|
|
5055
|
+
s = t.pointAtResToDistance(e[2], 0, n), En.set(e[0], e[1]), r = t.pointAtResToCoord(En, n);
|
|
5030
5056
|
}
|
|
5031
|
-
this.
|
|
5032
|
-
this.
|
|
5057
|
+
this.hn = this.hn || [], n.vec3.set(this.hn, b(r.x), b(r.y), s), this.un = Jt(this.un || [], this.hn[0], this.hn[1], this.hn[2]),
|
|
5058
|
+
this.ln = 2 * Math.tan(.5 * b(t.getFov())), this.dn = Sn.project(r).toArray();
|
|
5033
5059
|
const i = t.projViewMatrix, o = {
|
|
5034
5060
|
children: [],
|
|
5035
5061
|
level: -1
|
|
5036
5062
|
};
|
|
5037
5063
|
let a = o;
|
|
5038
5064
|
const c = {};
|
|
5039
|
-
for (let t = 0; t < this.
|
|
5065
|
+
for (let t = 0; t < this.sn.length; t++) {
|
|
5040
5066
|
let e = 1 / 0;
|
|
5041
|
-
const n = [ this.
|
|
5067
|
+
const n = [ this.sn[t] ], r = this.mn(t);
|
|
5042
5068
|
for (;n.length > 0; ) {
|
|
5043
5069
|
const t = n.pop();
|
|
5044
|
-
for (this.
|
|
5045
|
-
const s = this.
|
|
5070
|
+
for (this.yn(t); a.level >= t.He; ) a = a.parent;
|
|
5071
|
+
const s = this.bn(t, r, i);
|
|
5046
5072
|
if (s < 1) {
|
|
5047
5073
|
let n = a;
|
|
5048
5074
|
for (;n && !n.content; ) n = n.parent;
|
|
5049
|
-
n && n.content && (t.
|
|
5075
|
+
n && n.content && (t.pn = n, this.wn(c, n));
|
|
5050
5076
|
if (!1 === this.options.services[t.te].alwaysShow) continue;
|
|
5051
|
-
if (!(0 === s && t
|
|
5052
|
-
t.content && (e = t
|
|
5077
|
+
if (!(0 === s && t.He <= e)) continue;
|
|
5078
|
+
t.content && (e = t.He);
|
|
5053
5079
|
}
|
|
5054
|
-
t.ce < 1 / 0 && this.
|
|
5055
|
-
const o = this
|
|
5080
|
+
t.ce < 1 / 0 && this._n(t);
|
|
5081
|
+
const o = this.$e(t, a);
|
|
5056
5082
|
a.children.push(o);
|
|
5057
5083
|
const h = t.children, u = h && h.length, f = o.content;
|
|
5058
|
-
if (!u && f && this.
|
|
5059
|
-
f && "add" === t.refine && this.
|
|
5084
|
+
if (!u && f && this.wn(c, o), u) {
|
|
5085
|
+
f && "add" === t.refine && this.wn(c, o), a = o;
|
|
5060
5086
|
for (let e = 0, r = h.length; e < r; e++) {
|
|
5061
5087
|
if (!h[e].parent) {
|
|
5062
|
-
h[e].parent = t, h[e].
|
|
5088
|
+
h[e].parent = t, h[e].Te = t.Te, h[e].baseUrl = t.baseUrl;
|
|
5063
5089
|
const n = h[e].content && (h[e].content.url || h[e].content.uri);
|
|
5064
5090
|
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));
|
|
5065
5091
|
}
|
|
@@ -5073,14 +5099,14 @@
|
|
|
5073
5099
|
tiles: c
|
|
5074
5100
|
};
|
|
5075
5101
|
}
|
|
5076
|
-
|
|
5102
|
+
wn(t, e) {
|
|
5077
5103
|
e.node.viewerRequestVolume && !function(t, e, n) {
|
|
5078
5104
|
if (n.region) {
|
|
5079
5105
|
const e = n.region;
|
|
5080
5106
|
if (t[0] >= e[0] && t[0] <= e[2] && t[1] >= e[1] && t[1] <= e[3]) return !0;
|
|
5081
5107
|
} else {
|
|
5082
|
-
if (n.sphere) return
|
|
5083
|
-
if (n.box) return 0 ===
|
|
5108
|
+
if (n.sphere) return Un(n, e);
|
|
5109
|
+
if (n.box) return 0 === Bn(n, e);
|
|
5084
5110
|
}
|
|
5085
5111
|
return !1;
|
|
5086
5112
|
}
|
|
@@ -5088,89 +5114,91 @@
|
|
|
5088
5114
|
* @maptalks/gl v0.64.0
|
|
5089
5115
|
* LICENSE : UNLICENSED
|
|
5090
5116
|
* (c) 2016-2022 maptalks.com
|
|
5091
|
-
*/ (this.
|
|
5117
|
+
*/ (this.hn, this.un, e.node.viewerRequestVolume) || (t[e.node.id] = e);
|
|
5092
5118
|
}
|
|
5093
|
-
|
|
5119
|
+
$e(t, e) {
|
|
5094
5120
|
return {
|
|
5095
5121
|
id: t.id,
|
|
5096
5122
|
node: t,
|
|
5097
5123
|
children: [],
|
|
5098
|
-
level: t
|
|
5124
|
+
level: t.He,
|
|
5099
5125
|
parent: e,
|
|
5100
5126
|
content: this.qe(t)
|
|
5101
5127
|
};
|
|
5102
5128
|
}
|
|
5103
|
-
|
|
5129
|
+
yn(t) {
|
|
5104
5130
|
void 0 === t.id && (t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]),
|
|
5105
|
-
t.
|
|
5106
|
-
t.te = t.parent.te, void 0 === t
|
|
5131
|
+
t.gn = this.Tn(t), t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix),
|
|
5132
|
+
t.te = t.parent.te, void 0 === t.He && (t.He = t.parent.He + 1), t.maxExtent = t.parent.maxExtent),
|
|
5107
5133
|
t.refine = t.refine && t.refine.toLowerCase() || "replace", t.content && !t.content.url && t.content.uri && (t.content.url = t.content.uri),
|
|
5108
|
-
this.
|
|
5134
|
+
this.An(t));
|
|
5109
5135
|
}
|
|
5110
|
-
|
|
5111
|
-
const e =
|
|
5112
|
-
if (!
|
|
5113
|
-
const
|
|
5136
|
+
An(t) {
|
|
5137
|
+
const e = t.boundingVolume;
|
|
5138
|
+
if (!e || e.in) return;
|
|
5139
|
+
const r = this.options.services[t.te].heightOffset || 0, s = this.options.offset, i = y(s) || s[0] || s[1];
|
|
5140
|
+
if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, Pn) && !i) return;
|
|
5141
|
+
const {region: o, box: a, sphere: c} = e;
|
|
5114
5142
|
if (o) {
|
|
5115
5143
|
const t = this.vn([ p(o[0]), p(o[1]) ]);
|
|
5116
5144
|
o[0] = b(t.x), o[1] = b(t.y);
|
|
5117
|
-
const
|
|
5118
|
-
o[2] = b(
|
|
5145
|
+
const e = this.vn([ p(o[2]), p(o[3]) ]);
|
|
5146
|
+
o[2] = b(e.x), o[3] = b(e.y), o[4] += r, o[5] += r;
|
|
5119
5147
|
} else if (a || c) {
|
|
5120
|
-
const
|
|
5121
|
-
i[0] = o.x, i[1] = o.y, i[2] +=
|
|
5148
|
+
const e = a || c, s = n.vec3.transformMat4(In, e, t.matrix), i = Qt(Nn, s), o = this.vn([ i[0], i[1] ]);
|
|
5149
|
+
i[0] = o.x, i[1] = o.y, i[2] += r, Jt(e, b(i[0]), b(i[1]), i[2]);
|
|
5122
5150
|
}
|
|
5123
|
-
|
|
5151
|
+
e.in = !0;
|
|
5124
5152
|
}
|
|
5125
|
-
|
|
5153
|
+
Tn(t) {
|
|
5126
5154
|
return void 0 === t.geometricError || !t.boundingVolume;
|
|
5127
5155
|
}
|
|
5128
5156
|
qe(t) {
|
|
5129
5157
|
return t.content && t.content.url;
|
|
5130
5158
|
}
|
|
5131
|
-
|
|
5159
|
+
_n(t) {
|
|
5132
5160
|
let e = t.parent;
|
|
5133
|
-
for (;e && e.
|
|
5161
|
+
for (;e && e.gn && !(e.ce <= t.ce && e.en <= t.en); ) e.ce = t.ce, e.en = t.en,
|
|
5134
5162
|
e = t.parent;
|
|
5135
5163
|
}
|
|
5136
5164
|
onTilesetLoad(t, e, r) {
|
|
5137
5165
|
if (!t) return void console.warn("invalid tileset at : " + r);
|
|
5138
|
-
const s = (t.asset && t.asset.gltfUpAxis || e && e.
|
|
5139
|
-
if (t.root.baseUrl = r.substring(0, r.lastIndexOf("/") + 1), t.root.
|
|
5166
|
+
const s = (t.asset && t.asset.gltfUpAxis || e && e.Te || this.options.services[e.te].upAxis || "Y").toUpperCase();
|
|
5167
|
+
if (t.root.baseUrl = r.substring(0, r.lastIndexOf("/") + 1), t.root.Te = s, e) {
|
|
5140
5168
|
const r = e.boundingVolume;
|
|
5141
5169
|
m(e, t.root), e.refine = e.refine && e.refine.toLowerCase() || "replace", r && (e.boundingVolume = r);
|
|
5142
5170
|
const s = t.root.transform;
|
|
5143
5171
|
s && (e.parent ? e.matrix = n.mat4.multiply([], e.parent.matrix, s) : e.matrix = s),
|
|
5144
|
-
this.
|
|
5145
|
-
t.root.content && (e.content = t.root.content)), e.
|
|
5172
|
+
this.An(e), e.children && e.children.length && (e.On = e.content, delete e.content,
|
|
5173
|
+
t.root.content && (e.content = t.root.content)), e.gn = this.Tn(e);
|
|
5146
5174
|
const i = e.content && (e.content.url || e.content.uri);
|
|
5147
5175
|
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);
|
|
5148
5176
|
}
|
|
5149
|
-
this.
|
|
5177
|
+
this.cn(), this.fire("loadtileset", {
|
|
5150
5178
|
tileset: t,
|
|
5151
5179
|
index: e.te,
|
|
5152
5180
|
url: r
|
|
5153
5181
|
});
|
|
5154
5182
|
}
|
|
5155
|
-
|
|
5156
|
-
if (t.ce = 1 / 0, 0 === t
|
|
5157
|
-
if (t.
|
|
5183
|
+
bn(t, e, n) {
|
|
5184
|
+
if (t.ce = 1 / 0, 0 === t.He || t.gn) return 1;
|
|
5185
|
+
if (t.Mn = 1 / 0, !this.Sn(t, e, n)) return -1;
|
|
5158
5186
|
if (0 === t.geometricError) return 1;
|
|
5159
5187
|
let r = this.options.services[t.te].maximumScreenSpaceError;
|
|
5160
5188
|
null == r && (r = 8);
|
|
5161
|
-
let s = this.
|
|
5162
|
-
return 0 === s && t.parent && (s = .5 * (t.parent.
|
|
5189
|
+
let s = this.xn(t);
|
|
5190
|
+
return 0 === s && t.parent && (s = .5 * (t.parent.Mn || 0)), s >= r ? 1 : 0;
|
|
5163
5191
|
}
|
|
5164
5192
|
ye(t) {
|
|
5165
5193
|
const e = this.getMap();
|
|
5166
5194
|
return e.getGLZoom ? e.coordToPoint(t, e.getGLZoom()) : e.coordToPointAtRes(t, e.getGLRes());
|
|
5167
5195
|
}
|
|
5168
|
-
|
|
5196
|
+
Sn(t, e, r) {
|
|
5169
5197
|
const o = this.getMap();
|
|
5170
5198
|
if (!o) return !1;
|
|
5171
|
-
if (t.
|
|
5199
|
+
if (t.Ke) return c(r, t.Ke);
|
|
5172
5200
|
const a = t.id;
|
|
5173
|
-
let f = this.
|
|
5201
|
+
let f = this.rn[a];
|
|
5174
5202
|
if (!t.boundingVolume) return !1;
|
|
5175
5203
|
if (!f && t.boundingVolume && !f) {
|
|
5176
5204
|
let e, r, i;
|
|
@@ -5179,30 +5207,30 @@
|
|
|
5179
5207
|
const n = t.boundingVolume.region;
|
|
5180
5208
|
e = new s.Extent(p(n[0]), p(n[1]), p(n[2]), p(n[3]));
|
|
5181
5209
|
const o = e.getCenter();
|
|
5182
|
-
e = e.convertTo(t => this.ye(t)), i = n[4], r = n[5], f = this.
|
|
5210
|
+
e = e.convertTo(t => this.ye(t)), i = n[4], r = n[5], f = this.rn[a] = [ [ e.xmin, e.ymin, i * c ], [ e.xmax, e.ymax, r * c ] ],
|
|
5183
5211
|
f.center = o;
|
|
5184
5212
|
} else if (t.boundingVolume.sphere) {
|
|
5185
|
-
const e = t.boundingVolume.sphere, n =
|
|
5186
|
-
r.push(n[2] * c), f = this.
|
|
5213
|
+
const e = t.boundingVolume.sphere, n = Qt([], e), r = this.ye(new s.Coordinate(n)).toArray();
|
|
5214
|
+
r.push(n[2] * c), f = this.rn[a] = [ r, e[3] * c ], f.center = new s.Coordinate(n);
|
|
5187
5215
|
} else if (t.boundingVolume.box) {
|
|
5188
|
-
const e = t.boundingVolume.box, r =
|
|
5216
|
+
const e = t.boundingVolume.box, r = Qt([], e), i = this.ye(new s.Coordinate(r)).toArray();
|
|
5189
5217
|
i.push(r[2] * c);
|
|
5190
5218
|
const o = e.slice(3);
|
|
5191
|
-
n.mat4.exactEquals(t.matrix,
|
|
5219
|
+
n.mat4.exactEquals(t.matrix, Pn) || n.mat3.multiply(o, n.mat3.fromMat4([], t.matrix), o);
|
|
5192
5220
|
for (let t = 0; t < o.length; t++) o[t] *= c, e[3 + t] = o[t];
|
|
5193
|
-
f = this.
|
|
5221
|
+
f = this.rn[a] = [ ...i, ...o ], f.center = new s.Coordinate(r);
|
|
5194
5222
|
}
|
|
5195
5223
|
}
|
|
5196
5224
|
if (e) {
|
|
5197
|
-
if (t.boundingVolume.region)
|
|
5198
|
-
|
|
5225
|
+
if (t.boundingVolume.region) xn.xmin = f[0][0], xn.ymin = f[0][1], xn.xmax = f[1][0],
|
|
5226
|
+
xn.ymax = f[1][1]; else if (t.boundingVolume.sphere) {
|
|
5199
5227
|
const t = f[2];
|
|
5200
|
-
|
|
5228
|
+
xn.xmin = f[0][0] - t, xn.ymin = f[0][1] - t, xn.xmax = f[0][0] + t, xn.ymax = f[0][1] + t;
|
|
5201
5229
|
} else if (t.boundingVolume.box) {
|
|
5202
5230
|
const t = f[1], e = f[2];
|
|
5203
|
-
|
|
5231
|
+
xn.xmin = f[0][0] - t, xn.ymin = f[0][1] - e, xn.xmax = f[0][0] + t, xn.ymax = f[0][1] + e;
|
|
5204
5232
|
}
|
|
5205
|
-
if (!e.intersects(
|
|
5233
|
+
if (!e.intersects(xn)) return !1;
|
|
5206
5234
|
}
|
|
5207
5235
|
return t.boundingVolume.region ? c(r, f) : t.boundingVolume.sphere ? function(t, e, n) {
|
|
5208
5236
|
u(t);
|
|
@@ -5223,68 +5251,68 @@
|
|
|
5223
5251
|
let e = this.options.offset;
|
|
5224
5252
|
if (y(e) && (e = e(Array.isArray(t) ? new s.Coordinate(t) : t)), e[0] || e[1]) {
|
|
5225
5253
|
const n = this.getMap(), r = n.getGLRes(), s = n.coordToPointAtRes(t, r);
|
|
5226
|
-
return s.
|
|
5254
|
+
return s._sub(e), n.pointAtResToCoord(s, r);
|
|
5227
5255
|
}
|
|
5228
5256
|
return t;
|
|
5229
5257
|
}
|
|
5230
|
-
|
|
5258
|
+
mn(t) {
|
|
5231
5259
|
const e = this.options.services[t].maxExtent;
|
|
5232
5260
|
if (!e) return null;
|
|
5233
|
-
const n = this.
|
|
5261
|
+
const n = this.sn[t];
|
|
5234
5262
|
return n.maxExtent || (n.maxExtent = new s.Extent(e).convertTo(t => this.ye(t))),
|
|
5235
5263
|
n.maxExtent;
|
|
5236
5264
|
}
|
|
5237
|
-
|
|
5238
|
-
const e = this.
|
|
5265
|
+
xn(t) {
|
|
5266
|
+
const e = this.ln, r = t.geometricError;
|
|
5239
5267
|
if (0 === r) return 0;
|
|
5240
5268
|
const s = this.getMap();
|
|
5241
5269
|
let i, o;
|
|
5242
5270
|
if (t.boundingVolume.region) {
|
|
5243
|
-
const e = this.
|
|
5271
|
+
const e = this.rn[t.id].center, r = (s.getGLZoom ? s.distanceToPoint(100, 0, s.getGLZoom(), e) : s.distanceToPointAtRes(100, 0, s.getGLRes(), e)).x / 100;
|
|
5244
5272
|
i = function(t, e, n, r) {
|
|
5245
5273
|
const s = t.boundingVolume.region;
|
|
5246
|
-
let i = t.
|
|
5247
|
-
i || (i = t.
|
|
5248
|
-
t.
|
|
5274
|
+
let i = t.In;
|
|
5275
|
+
i || (i = t.In = [ Fn(s[0], s[1]), Fn(s[0], s[3]), Fn(s[2], s[1]), Fn(s[2], s[3]), Fn(s[0], s[1]), Fn(s[0], s[3]), Fn(s[2], s[1]), Fn(s[2], s[3]) ],
|
|
5276
|
+
t.Nn = [ Math.min.apply(Math, i.map(t => t[0])), Math.min.apply(Math, i.map(t => t[1])) ],
|
|
5249
5277
|
t.En = [ Math.max.apply(Math, i.map(t => t[0])), Math.max.apply(Math, i.map(t => t[1])) ]);
|
|
5250
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];
|
|
5251
|
-
const o = (a = t.
|
|
5279
|
+
const o = (a = t.Nn, c = t.En, h = e, u = Math.max(a[0] - h[0], 0, h[0] - c[0]),
|
|
5252
5280
|
f = Math.max(a[1] - h[1], 0, h[1] - c[1]), Math.sqrt(u * u + f * f) / r);
|
|
5253
5281
|
var a, c, h, u, f;
|
|
5254
5282
|
let l = 0;
|
|
5255
5283
|
n[2] > s[5] && (l = n[2] - s[5]);
|
|
5256
5284
|
return Math.sqrt(o * o + l * l);
|
|
5257
|
-
}(t, this.
|
|
5258
|
-
const r = t.boundingVolume.region, s =
|
|
5285
|
+
}(t, this.dn, this.hn, r), o = function(t, e) {
|
|
5286
|
+
const r = t.boundingVolume.region, s = Jt(Ln, r[0], r[1], r[4]), i = Jt(Rn, r[2], r[3], r[5]), o = n.vec3.scale(s, n.vec3.add(s, s, i), .5);
|
|
5259
5287
|
return n.vec3.dist(o, e);
|
|
5260
|
-
}(t, this.
|
|
5261
|
-
} else t.boundingVolume.sphere ? (i =
|
|
5288
|
+
}(t, this.un);
|
|
5289
|
+
} else t.boundingVolume.sphere ? (i = Un(t.boundingVolume, this.un), o = function(t, e) {
|
|
5262
5290
|
const r = t.boundingVolume.sphere;
|
|
5263
5291
|
return n.vec3.dist(r, e);
|
|
5264
|
-
}(t, this.
|
|
5292
|
+
}(t, this.un)) : t.boundingVolume.box && (i = Bn(t.boundingVolume, this.un), o = function(t, e) {
|
|
5265
5293
|
const r = t.boundingVolume.box;
|
|
5266
5294
|
return n.vec3.dist(r, e);
|
|
5267
|
-
}(t, this.
|
|
5295
|
+
}(t, this.un));
|
|
5268
5296
|
const a = Math.max(Math.abs(i), 1e-7), c = r * s.height / (a * e);
|
|
5269
|
-
return t.ce = i, t.
|
|
5297
|
+
return t.ce = i, t.en = o, t.Mn = c, c;
|
|
5270
5298
|
}
|
|
5271
|
-
|
|
5299
|
+
cn() {
|
|
5272
5300
|
const t = this.getRenderer();
|
|
5273
5301
|
t && t.setToRedraw();
|
|
5274
5302
|
}
|
|
5275
|
-
|
|
5276
|
-
return this.
|
|
5303
|
+
Me(t) {
|
|
5304
|
+
return this.rn[t];
|
|
5277
5305
|
}
|
|
5278
5306
|
}
|
|
5279
|
-
function
|
|
5307
|
+
function Un(t, e) {
|
|
5280
5308
|
const r = t.sphere, s = n.vec3.dist(r, e), i = t.sphere[3];
|
|
5281
5309
|
return s < i ? 0 : s - i;
|
|
5282
5310
|
}
|
|
5283
|
-
function
|
|
5311
|
+
function Bn(t, e) {
|
|
5284
5312
|
const n = t.box;
|
|
5285
|
-
return
|
|
5313
|
+
return gn(n.slice(0, 3), n.slice(3), e);
|
|
5286
5314
|
}
|
|
5287
|
-
|
|
5315
|
+
Cn.mergeOptions({
|
|
5288
5316
|
"maxGPUMemory": 512,
|
|
5289
5317
|
"retireInterval": 2e3,
|
|
5290
5318
|
"loadingLimitOnInteracting": 5,
|
|
@@ -5299,35 +5327,35 @@
|
|
|
5299
5327
|
"sRGBTolinear": !1,
|
|
5300
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_s3tc" ],
|
|
5301
5329
|
"offset": [ 0, 0 ]
|
|
5302
|
-
}),
|
|
5303
|
-
const
|
|
5304
|
-
function
|
|
5330
|
+
}), Cn.registerRenderer("gl", bn);
|
|
5331
|
+
const Ln = [], Rn = [];
|
|
5332
|
+
function Fn(t, e) {
|
|
5305
5333
|
const n = new s.Coordinate(p(t), p(e));
|
|
5306
|
-
return
|
|
5334
|
+
return Sn.project(n).toArray();
|
|
5307
5335
|
}
|
|
5308
|
-
const
|
|
5336
|
+
const Dn = function() {
|
|
5309
5337
|
if ("undefined" != typeof self) return self;
|
|
5310
5338
|
if ("undefined" != typeof window) return window;
|
|
5311
5339
|
if ("undefined" != typeof global) return global;
|
|
5312
5340
|
throw new Error("unable to locate global object");
|
|
5313
|
-
},
|
|
5314
|
-
|
|
5315
|
-
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s =
|
|
5316
|
-
let i = `${r}\n const _____getGlobal = ${
|
|
5341
|
+
}, kn = Dn(), zn = kn.gl_trans__coders = kn.gl_trans__coders || {};
|
|
5342
|
+
zn.inject = function(t) {
|
|
5343
|
+
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = kn.gl_trans__coders = kn.gl_trans__coders || {};
|
|
5344
|
+
let i = `${r}\n const _____getGlobal = ${Dn.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
|
|
5317
5345
|
for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
|
|
5318
5346
|
return i += "\n" + e.substring(r.length), i;
|
|
5319
|
-
},
|
|
5320
|
-
|
|
5321
|
-
},
|
|
5322
|
-
return
|
|
5347
|
+
}, zn.registerTranscoder = function(t, e) {
|
|
5348
|
+
zn[t] = e;
|
|
5349
|
+
}, zn.getTranscoder = function(t) {
|
|
5350
|
+
return zn[t];
|
|
5323
5351
|
};
|
|
5324
|
-
class
|
|
5352
|
+
class jn {
|
|
5325
5353
|
constructor(t, e) {
|
|
5326
|
-
this.A = t, this.tt = e ||
|
|
5327
|
-
"image/crn":
|
|
5328
|
-
"image/ktx2":
|
|
5329
|
-
"image/cttf":
|
|
5330
|
-
"draco":
|
|
5354
|
+
this.A = t, this.tt = e || Et, this.et = {
|
|
5355
|
+
"image/crn": zn.crn && zn.crn(),
|
|
5356
|
+
"image/ktx2": zn.ktx2 && zn.ktx2(),
|
|
5357
|
+
"image/cttf": zn.ktx2 && zn.ktx2(),
|
|
5358
|
+
"draco": zn.draco && zn.draco()
|
|
5331
5359
|
};
|
|
5332
5360
|
}
|
|
5333
5361
|
static createEmptyB3DM() {
|
|
@@ -5348,6 +5376,7 @@
|
|
|
5348
5376
|
if (s.error) return Promise.resolve(s);
|
|
5349
5377
|
const i = t.substring(0, t.lastIndexOf("/")), o = new this.tt(i, s.glb, {
|
|
5350
5378
|
transferable: !0,
|
|
5379
|
+
requestImage: this.A,
|
|
5351
5380
|
decoders: this.et
|
|
5352
5381
|
});
|
|
5353
5382
|
return o.load().then(e => {
|
|
@@ -5384,15 +5413,15 @@
|
|
|
5384
5413
|
o = h, h = a, u = c, a = 0, c = 0);
|
|
5385
5414
|
const l = [ t ];
|
|
5386
5415
|
let d, m, y;
|
|
5387
|
-
if (a > 0 ? (d =
|
|
5416
|
+
if (a > 0 ? (d = ce(t, f, a), f += a, o = d.BATCH_LENGTH) : d = {
|
|
5388
5417
|
"BATCH_LENGTH": o
|
|
5389
|
-
}, c > 0 && (f += c), h > 0 && (m =
|
|
5390
|
-
const e =
|
|
5418
|
+
}, c > 0 && (f += c), h > 0 && (m = he(t, f, h), f += h, u > 0)) {
|
|
5419
|
+
const e = ue(0, f, u);
|
|
5391
5420
|
y = t.slice(e.offset, e.offset + e.byteLength), f += u, l.push(y);
|
|
5392
5421
|
}
|
|
5393
5422
|
const b = d.BATCH_LENGTH, p = {};
|
|
5394
5423
|
if (d && d.BATCH_ID) {
|
|
5395
|
-
p.BATCH_ID =
|
|
5424
|
+
p.BATCH_ID = le(d.BATCH_ID, t, (void 0).offset, b);
|
|
5396
5425
|
const e = p.BATCH_ID.array && p.BATCH_ID.array.buffer;
|
|
5397
5426
|
e && l.indexOf(e) < 0 && l.push(e);
|
|
5398
5427
|
}
|
|
@@ -5406,7 +5435,7 @@
|
|
|
5406
5435
|
glb: {
|
|
5407
5436
|
buffer: t,
|
|
5408
5437
|
byteOffset: f,
|
|
5409
|
-
byteLength: s.byteLength - f
|
|
5438
|
+
byteLength: s.byteLength + s.byteOffset - f
|
|
5410
5439
|
}
|
|
5411
5440
|
};
|
|
5412
5441
|
}
|
|
@@ -5414,13 +5443,13 @@
|
|
|
5414
5443
|
return null;
|
|
5415
5444
|
}
|
|
5416
5445
|
}
|
|
5417
|
-
class
|
|
5446
|
+
class Vn {
|
|
5418
5447
|
constructor(t, e) {
|
|
5419
|
-
this.A = t, this.tt = e ||
|
|
5420
|
-
"image/crn":
|
|
5421
|
-
"image/ktx2":
|
|
5422
|
-
"image/cttf":
|
|
5423
|
-
"draco":
|
|
5448
|
+
this.A = t, this.tt = e || Et, this.et = {
|
|
5449
|
+
"image/crn": zn.crn && zn.crn(),
|
|
5450
|
+
"image/ktx2": zn.ktx2 && zn.ktx2(),
|
|
5451
|
+
"image/cttf": zn.ktx2 && zn.ktx2(),
|
|
5452
|
+
"draco": zn.draco && zn.draco()
|
|
5424
5453
|
};
|
|
5425
5454
|
}
|
|
5426
5455
|
load(t, e, n = 0, r = 0) {
|
|
@@ -5449,6 +5478,7 @@
|
|
|
5449
5478
|
it(t, e, n, r) {
|
|
5450
5479
|
const s = {
|
|
5451
5480
|
transferable: !0,
|
|
5481
|
+
requestImage: this.A,
|
|
5452
5482
|
decoders: this.et
|
|
5453
5483
|
}, i = new DataView(e, n, r), o = 32 + i.getUint32(12, !0) + i.getUint32(16, !0) + i.getUint32(20, !0) + i.getUint32(24, !0);
|
|
5454
5484
|
if (0 === i.getUint32(28, !0)) {
|
|
@@ -5495,7 +5525,7 @@
|
|
|
5495
5525
|
error: t
|
|
5496
5526
|
};
|
|
5497
5527
|
}
|
|
5498
|
-
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} =
|
|
5528
|
+
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = pe(s, 32 + e, o), f = {}, l = a.INSTANCES_LENGTH;
|
|
5499
5529
|
if (a.POSITION) {
|
|
5500
5530
|
const {byteOffset: e} = a.POSITION;
|
|
5501
5531
|
f.POSITION = {
|
|
@@ -5518,7 +5548,7 @@
|
|
|
5518
5548
|
}, o.push(f.POSITION.array.buffer);
|
|
5519
5549
|
}
|
|
5520
5550
|
if (a.BATCH_ID) {
|
|
5521
|
-
f.BATCH_ID =
|
|
5551
|
+
f.BATCH_ID = le(a.BATCH_ID, t, c.offset, l);
|
|
5522
5552
|
const e = f.BATCH_ID.array && f.BATCH_ID.array.buffer;
|
|
5523
5553
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5524
5554
|
}
|
|
@@ -5589,26 +5619,26 @@
|
|
|
5589
5619
|
}
|
|
5590
5620
|
ht(t) {
|
|
5591
5621
|
const e = t.length / 2, n = new Float32Array(3 * e), r = [];
|
|
5592
|
-
for (let s = 0; s < e; s++)
|
|
5622
|
+
for (let s = 0; s < e; s++) Gn(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
|
|
5593
5623
|
n[3 * s + 1] = r[1], n[3 * s + 2] = r[2];
|
|
5594
5624
|
return n;
|
|
5595
5625
|
}
|
|
5596
5626
|
ct(t, e, n) {
|
|
5597
|
-
return
|
|
5627
|
+
return be(new Float32Array(t.length), t, e, n);
|
|
5598
5628
|
}
|
|
5599
5629
|
st() {
|
|
5600
5630
|
return null;
|
|
5601
5631
|
}
|
|
5602
5632
|
}
|
|
5603
|
-
function
|
|
5604
|
-
if (t[0] =
|
|
5633
|
+
function Gn(t, e, n, r) {
|
|
5634
|
+
if (t[0] = Hn(e, r), t[1] = Hn(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
|
|
5605
5635
|
t[2] < 0) {
|
|
5606
5636
|
const e = t[0];
|
|
5607
|
-
t[0] = (1 - Math.abs(t[1])) *
|
|
5637
|
+
t[0] = (1 - Math.abs(t[1])) * qn(e), t[1] = (1 - Math.abs(e)) * qn(t[1]);
|
|
5608
5638
|
}
|
|
5609
5639
|
return D(t, t);
|
|
5610
5640
|
}
|
|
5611
|
-
function
|
|
5641
|
+
function Hn(t, e) {
|
|
5612
5642
|
return function(t, e, n) {
|
|
5613
5643
|
return t < e ? e : t > n ? n : t;
|
|
5614
5644
|
}(t, 0, e = function(t, e) {
|
|
@@ -5616,10 +5646,10 @@
|
|
|
5616
5646
|
return e;
|
|
5617
5647
|
}(e, 255)) / e * 2 - 1;
|
|
5618
5648
|
}
|
|
5619
|
-
function
|
|
5649
|
+
function qn(t) {
|
|
5620
5650
|
return t < 0 ? -1 : 1;
|
|
5621
5651
|
}
|
|
5622
|
-
class
|
|
5652
|
+
class $n {
|
|
5623
5653
|
constructor() {}
|
|
5624
5654
|
load(t, e, n = 0, r = 0) {
|
|
5625
5655
|
return e ? (r || (r = e.byteLength), this.nt(t, e, n, r)) : ft.getArrayBuffer(t, {}).then(e => {
|
|
@@ -5652,7 +5682,7 @@
|
|
|
5652
5682
|
error: t
|
|
5653
5683
|
};
|
|
5654
5684
|
}
|
|
5655
|
-
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} =
|
|
5685
|
+
const o = [ t ], {featureTable: a, featureTableBin: c, batchTable: h, batchTableBin: u} = pe(s, e + 28, o), f = a.QUANTIZED_VOLUME_OFFSET, l = a.QUANTIZED_VOLUME_SCALE, d = a.POINTS_LENGTH;
|
|
5656
5686
|
let m, y = {};
|
|
5657
5687
|
if (a.extensions && a.extensions["3DTILES_draco_point_compression"]) {
|
|
5658
5688
|
y = a.extensions["3DTILES_draco_point_compression"], m = new DataView(t, y.byteOffset + c.offset, y.byteLength);
|
|
@@ -5660,7 +5690,7 @@
|
|
|
5660
5690
|
attributes: y.properties,
|
|
5661
5691
|
useUniqueIDs: !1
|
|
5662
5692
|
};
|
|
5663
|
-
return this.ft || (this.ft =
|
|
5693
|
+
return this.ft || (this.ft = zn.draco()), this.ft(m, e).then(e => {
|
|
5664
5694
|
const n = e.attributes;
|
|
5665
5695
|
!a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
|
|
5666
5696
|
n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
|
|
@@ -5674,11 +5704,11 @@
|
|
|
5674
5704
|
byteOffset: 0,
|
|
5675
5705
|
itemSize: 1,
|
|
5676
5706
|
count: t.length,
|
|
5677
|
-
componentType:
|
|
5707
|
+
componentType: ye(t.constructor),
|
|
5678
5708
|
array: t
|
|
5679
5709
|
}, o.push(t.buffer);
|
|
5680
5710
|
} else if (a.BATCH_ID || Object.keys(h).length) {
|
|
5681
|
-
a.BATCH_ID ? r.BATCH_ID =
|
|
5711
|
+
a.BATCH_ID ? r.BATCH_ID = le(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = Jn(d);
|
|
5682
5712
|
const e = r.BATCH_ID.array && r.BATCH_ID.array.buffer;
|
|
5683
5713
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5684
5714
|
}
|
|
@@ -5694,7 +5724,7 @@
|
|
|
5694
5724
|
}
|
|
5695
5725
|
const b = this.lt(t, a, c.offset, d, o, f, l);
|
|
5696
5726
|
if (a.BATCH_ID || Object.keys(h).length) {
|
|
5697
|
-
a.BATCH_ID ? b.BATCH_ID =
|
|
5727
|
+
a.BATCH_ID ? b.BATCH_ID = le(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = Jn(d);
|
|
5698
5728
|
const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
|
|
5699
5729
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5700
5730
|
}
|
|
@@ -5823,27 +5853,27 @@
|
|
|
5823
5853
|
return a;
|
|
5824
5854
|
}
|
|
5825
5855
|
ct(t, e, n) {
|
|
5826
|
-
return
|
|
5856
|
+
return be(new Float32Array(t.length), t, e, n);
|
|
5827
5857
|
}
|
|
5828
5858
|
st() {
|
|
5829
5859
|
return null;
|
|
5830
5860
|
}
|
|
5831
5861
|
}
|
|
5832
|
-
function
|
|
5833
|
-
const e =
|
|
5862
|
+
function Jn(t) {
|
|
5863
|
+
const e = O(t), n = new e(t);
|
|
5834
5864
|
for (let e = 0; e < t; e++) n[e] = e;
|
|
5835
5865
|
return {
|
|
5836
5866
|
byteStride: 0,
|
|
5837
5867
|
byteOffset: 0,
|
|
5838
5868
|
itemSize: 1,
|
|
5839
5869
|
count: t,
|
|
5840
|
-
componentType:
|
|
5870
|
+
componentType: ye(e),
|
|
5841
5871
|
array: n
|
|
5842
5872
|
};
|
|
5843
5873
|
}
|
|
5844
|
-
class
|
|
5874
|
+
class Kn {
|
|
5845
5875
|
constructor(t, e) {
|
|
5846
|
-
this.A = t, this.tt = e ||
|
|
5876
|
+
this.A = t, this.tt = e || Et;
|
|
5847
5877
|
}
|
|
5848
5878
|
load(t, e, n = 0, r = 0) {
|
|
5849
5879
|
return e ? this.nt(t, e, n, r) : ft.getArrayBuffer(t, {}).then(e => {
|
|
@@ -5856,12 +5886,12 @@
|
|
|
5856
5886
|
const s = this.dt(e, t, n, r), i = [];
|
|
5857
5887
|
for (let n = 0; n < s.length; n++) {
|
|
5858
5888
|
let r;
|
|
5859
|
-
if ("b3dm" === s[n].magic) r = new
|
|
5889
|
+
if ("b3dm" === s[n].magic) r = new jn(this.A, this.tt); else if ("i3dm" === s[n].magic) r = new Vn(this.A, this.tt); else if ("pnts" === s[n].magic) r = new $n; else {
|
|
5860
5890
|
if ("cmpt" !== s[n].magic) {
|
|
5861
5891
|
console.warn("Unsupported magic in CMPT tile:", s[n].magic);
|
|
5862
5892
|
continue;
|
|
5863
5893
|
}
|
|
5864
|
-
r = new
|
|
5894
|
+
r = new Kn(this.A, this.tt);
|
|
5865
5895
|
}
|
|
5866
5896
|
i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
|
|
5867
5897
|
}
|
|
@@ -5878,17 +5908,11 @@
|
|
|
5878
5908
|
error: t
|
|
5879
5909
|
};
|
|
5880
5910
|
}
|
|
5881
|
-
if (s.getUint32(8, !0) !== s.byteLength) {
|
|
5882
|
-
const t = "Length in cmpt header is inconsistent with cmpt's byte length, url: " + e;
|
|
5883
|
-
return console.warn(t), {
|
|
5884
|
-
error: t
|
|
5885
|
-
};
|
|
5886
|
-
}
|
|
5887
5911
|
if (16 === s.byteLength) return [];
|
|
5888
5912
|
const o = [], a = s.getUint32(12, !0);
|
|
5889
5913
|
let c = 16;
|
|
5890
5914
|
for (let e = 0; e < a; e++) {
|
|
5891
|
-
const e =
|
|
5915
|
+
const e = oe(s, c), r = s.getUint32(c + 8, !0);
|
|
5892
5916
|
o.push({
|
|
5893
5917
|
magic: e,
|
|
5894
5918
|
buffer: t,
|
|
@@ -5899,9 +5923,9 @@
|
|
|
5899
5923
|
return o;
|
|
5900
5924
|
}
|
|
5901
5925
|
}
|
|
5902
|
-
t.B3DMLoader =
|
|
5903
|
-
t.Geo3DTransform =
|
|
5926
|
+
t.B3DMLoader = jn, t.CMPTLoader = Kn, t.Geo3DTilesLayer = Cn, t.Geo3DTilesUtil = x,
|
|
5927
|
+
t.Geo3DTransform = ie, Object.defineProperty(t, "t", {
|
|
5904
5928
|
value: !0
|
|
5905
5929
|
});
|
|
5906
|
-
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.11.
|
|
5930
|
+
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.11.4");
|
|
5907
5931
|
}));
|