@maptalks/3dtiles 0.12.4 → 0.13.0
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 +515 -501
- package/package.json +3 -3
package/dist/maptalks.3dtiles.js
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/3dtiles v0.
|
|
2
|
+
* @maptalks/3dtiles v0.13.0
|
|
3
3
|
* LICENSE : UNLICENSED
|
|
4
4
|
* (c) 2016-2022 maptalks.com
|
|
5
5
|
*/
|
|
6
|
+
/*!
|
|
7
|
+
* Cesium - https://github.com/AnalyticalGraphicsInc/cesium
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2011-2017 Cesium Contributors
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*
|
|
23
|
+
* Columbus View (Pat. Pend.)
|
|
24
|
+
*
|
|
25
|
+
* Portions licensed separately.
|
|
26
|
+
* See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
|
|
27
|
+
*/
|
|
6
28
|
!function(t, e) {
|
|
7
29
|
"object" == typeof exports && "undefined" != typeof module ? e(require("maptalks"), require("@maptalks/gl")) : "function" == typeof define && define.amd ? define([ "maptalks", "@maptalks/gl" ], e) : e((t = "undefined" != typeof globalThis ? globalThis : t || self).maptalks, t.maptalksgl);
|
|
8
30
|
}(this, (function(t, e) {
|
|
@@ -124,7 +146,7 @@
|
|
|
124
146
|
s(), o(1, 0, 0), o(0, 1, 0), g(), g(), A = new e(9), e != Float32Array && (A[1] = 0,
|
|
125
147
|
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
148
|
/*!
|
|
127
|
-
* @maptalks/gltf-loader v0.25.
|
|
149
|
+
* @maptalks/gltf-loader v0.25.5
|
|
128
150
|
* LICENSE : UNLICENSED
|
|
129
151
|
* (c) 2016-2022 maptalks.org
|
|
130
152
|
*/
|
|
@@ -177,7 +199,7 @@
|
|
|
177
199
|
for (let t = 0; t < n; t++) r[t] = e.charCodeAt(t);
|
|
178
200
|
return r.buffer;
|
|
179
201
|
}
|
|
180
|
-
const P = [], L = [],
|
|
202
|
+
const P = [], L = [], U = [], B = [ 0, 0, 0 ], C = function(t) {
|
|
181
203
|
return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t;
|
|
182
204
|
}([]), R = [ 1, 1, 1 ];
|
|
183
205
|
function F(t, e, n, r, s, i, o) {
|
|
@@ -233,19 +255,19 @@
|
|
|
233
255
|
getArrayBuffer: (t, e = {}) => (e || (e = {}), e.responseType = "arraybuffer", z.get(t, e)),
|
|
234
256
|
getJSON: function(t, e = {}) {
|
|
235
257
|
return e && e.jsonp ? z.jsonp(t) : ((e = e || {}).responseType = "json", z.get(t, e));
|
|
258
|
+
},
|
|
259
|
+
jsonp: function(t) {
|
|
260
|
+
const e = "_maptalks_jsonp_" + v++;
|
|
261
|
+
t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
|
|
262
|
+
let n = document.createElement("script");
|
|
263
|
+
return n.type = "text/javascript", n.src = t, new Promise(t => {
|
|
264
|
+
window[e] = function(r) {
|
|
265
|
+
document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
|
|
266
|
+
t(r);
|
|
267
|
+
}, document.getElementsByTagName("head")[0].appendChild(n);
|
|
268
|
+
});
|
|
236
269
|
}
|
|
237
270
|
};
|
|
238
|
-
z.jsonp = function(t) {
|
|
239
|
-
const e = "_maptalks_jsonp_" + v++;
|
|
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
271
|
class j {
|
|
250
272
|
constructor(t, e, n) {
|
|
251
273
|
this.i = t, this.decoders = e, this.o = n, this.images = {}, this.h = {};
|
|
@@ -286,8 +308,7 @@
|
|
|
286
308
|
requestExternalImage(t) {
|
|
287
309
|
if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
|
|
288
310
|
const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
|
|
289
|
-
|
|
290
|
-
return this.h[t.id] = this.l(t.id, e);
|
|
311
|
+
return this.h[t.id] ? this.h[t.id].then(() => this.images[t.id]) : this.h[t.id] = this.l(t.id, e);
|
|
291
312
|
}
|
|
292
313
|
l(t, e) {
|
|
293
314
|
return new Promise((n, r) => {
|
|
@@ -350,8 +371,7 @@
|
|
|
350
371
|
});
|
|
351
372
|
}
|
|
352
373
|
g(t, e, n, r = 0) {
|
|
353
|
-
const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = I(i.componentType), u = o.byteStride || 0
|
|
354
|
-
const f = {
|
|
374
|
+
const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = I(i.componentType), u = o.byteStride || 0, f = {
|
|
355
375
|
array: void 0,
|
|
356
376
|
name: t,
|
|
357
377
|
accessorName: e,
|
|
@@ -435,7 +455,7 @@
|
|
|
435
455
|
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,
|
|
436
456
|
t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = e[0], t[13] = e[1], t[14] = e[2],
|
|
437
457
|
t[15] = 1, t;
|
|
438
|
-
}(P, e.translation ||
|
|
458
|
+
}(P, e.translation || B), s = function(t, e) {
|
|
439
459
|
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;
|
|
440
460
|
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,
|
|
441
461
|
t[6] = d + y, t[7] = 0, t[8] = l + b, t[9] = d - y, t[10] = 1 - h - f, t[11] = 0,
|
|
@@ -444,7 +464,7 @@
|
|
|
444
464
|
return t[0] = e[0], t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e[1], t[6] = 0,
|
|
445
465
|
t[7] = 0, t[8] = 0, t[9] = 0, t[10] = e[2], t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0,
|
|
446
466
|
t[15] = 1, t;
|
|
447
|
-
}(
|
|
467
|
+
}(U, e.scale || R);
|
|
448
468
|
return r(i, s, i), r(t, n, i);
|
|
449
469
|
}
|
|
450
470
|
return n(t);
|
|
@@ -461,7 +481,7 @@
|
|
|
461
481
|
r.instanceTechnique && r.instanceTechnique.values ? (s = r.instanceTechnique, i = s.values.diffuse) : (s = r,
|
|
462
482
|
i = s.values.tex || s.values.diffuseTex || s.values.diffuse);
|
|
463
483
|
const o = {
|
|
464
|
-
|
|
484
|
+
baseColorTexture: {
|
|
465
485
|
index: i
|
|
466
486
|
}
|
|
467
487
|
};
|
|
@@ -582,8 +602,7 @@
|
|
|
582
602
|
N(t, e) {
|
|
583
603
|
const n = new Array(t.byteLength);
|
|
584
604
|
for (let e = 0; e < t.byteLength; e++) n[e] = String.fromCharCode(t[e]);
|
|
585
|
-
n.join("");
|
|
586
|
-
return "data:" + (e = e || "image/png") + ";base64," + function(t) {
|
|
605
|
+
return n.join(""), "data:" + (e = e || "image/png") + ";base64," + function(t) {
|
|
587
606
|
return "undefined" != typeof self ? self.btoa(t) : window.btoa(t);
|
|
588
607
|
}(unescape(encodeURIComponent(n)));
|
|
589
608
|
}
|
|
@@ -607,19 +626,19 @@
|
|
|
607
626
|
});
|
|
608
627
|
}
|
|
609
628
|
}
|
|
610
|
-
const $ = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null
|
|
611
|
-
class
|
|
629
|
+
const $ = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
630
|
+
class J {
|
|
612
631
|
static read(t, e = 0, n = 0) {
|
|
613
632
|
n || (n = t.byteLength);
|
|
614
633
|
const r = new DataView(t, e, n), s = r.getUint32(4, !0);
|
|
615
|
-
if (1 === s) return
|
|
616
|
-
if (2 === s) return
|
|
634
|
+
if (1 === s) return J.readV1(r, e);
|
|
635
|
+
if (2 === s) return J.readV2(t, e);
|
|
617
636
|
throw new Error("Unsupported glb version : " + s);
|
|
618
637
|
}
|
|
619
638
|
static readV1(t, e) {
|
|
620
639
|
const n = t.getUint32(8, !0), r = t.getUint32(12, !0);
|
|
621
640
|
if (n !== t.byteLength) throw new Error("Length in GLB header is inconsistent with glb's byte length.");
|
|
622
|
-
const s =
|
|
641
|
+
const s = K(t.buffer, 20 + e, r);
|
|
623
642
|
return {
|
|
624
643
|
json: JSON.parse(s),
|
|
625
644
|
glbBuffer: {
|
|
@@ -637,7 +656,7 @@
|
|
|
637
656
|
const a = i.getUint32(o, !0);
|
|
638
657
|
o += 4;
|
|
639
658
|
const c = i.getUint32(o, !0);
|
|
640
|
-
if (o += 4,
|
|
659
|
+
if (o += 4, 1313821514 === c) n = K(t, e + 12 + o, a); else if (5130562 === c) {
|
|
641
660
|
s = e + 12 + o, r = a;
|
|
642
661
|
break;
|
|
643
662
|
}
|
|
@@ -653,7 +672,7 @@
|
|
|
653
672
|
};
|
|
654
673
|
}
|
|
655
674
|
}
|
|
656
|
-
function
|
|
675
|
+
function K(t, e, n) {
|
|
657
676
|
if ($) {
|
|
658
677
|
const r = new Uint8Array(t, e, n);
|
|
659
678
|
return $.decode(r);
|
|
@@ -664,7 +683,7 @@
|
|
|
664
683
|
for (let r = 0; r < e; ) {
|
|
665
684
|
let s = t[r++];
|
|
666
685
|
if (128 & s) {
|
|
667
|
-
let n =
|
|
686
|
+
let n = X[s >> 3 & 7];
|
|
668
687
|
if (!(64 & s) || !n || r + n > e) return null;
|
|
669
688
|
for (s &= 63 >> n; n > 0; n -= 1) {
|
|
670
689
|
const e = t[r++];
|
|
@@ -677,29 +696,28 @@
|
|
|
677
696
|
return n;
|
|
678
697
|
}(new Uint8Array(t, e, n));
|
|
679
698
|
}
|
|
680
|
-
const
|
|
681
|
-
const Y = [ 0, 0, 0 ], Q = [ 0, 0, 0, 1 ], tt = [ 1, 1, 1 ], et = {
|
|
699
|
+
const X = [ 1, 1, 1, 1, 2, 2, 3, 0 ], W = [ 0, 0, 0 ], Z = [ 0, 0, 0, 1 ], Q = [ 1, 1, 1 ], Y = {
|
|
682
700
|
TRANSLATION: [ 0, 0, 0 ],
|
|
683
701
|
ROTATION: [ 0, 0, 0, 1 ],
|
|
684
702
|
SCALE: [ 1, 1, 1 ]
|
|
685
|
-
},
|
|
703
|
+
}, tt = {
|
|
686
704
|
PREVIOUS: null,
|
|
687
705
|
NEXT: null,
|
|
688
706
|
PREINDEX: null,
|
|
689
707
|
NEXTINDEX: null,
|
|
690
708
|
INTERPOLATION: null
|
|
691
|
-
},
|
|
709
|
+
}, et = {
|
|
692
710
|
P(t, e, n, r, s, i, o, c) {
|
|
693
711
|
const h = S(t) ? e.animations : [ e.animations[0] ], u = {};
|
|
694
712
|
for (let e = 0; e < h.length; e++) {
|
|
695
|
-
const f = h[e];
|
|
696
|
-
if (S(t) &&
|
|
697
|
-
const
|
|
698
|
-
if (
|
|
699
|
-
const e =
|
|
700
|
-
"translation" === e.target.path ? (this.L(s, f.samplers[e.sampler], r, 1), u.translation = a(
|
|
701
|
-
u.rotation = O(
|
|
702
|
-
u.scale = a(
|
|
713
|
+
const f = h[e], l = f.name || e;
|
|
714
|
+
if (S(t) && l !== t) continue;
|
|
715
|
+
const d = f.channelsMap[n];
|
|
716
|
+
if (d) for (let t = 0; t < d.length; t++) {
|
|
717
|
+
const e = d[t];
|
|
718
|
+
"translation" === e.target.path ? (this.L(s, f.samplers[e.sampler], r, 1), u.translation = a(W, s)) : "rotation" === e.target.path ? (this.U(i, f.samplers[e.sampler], r, 1),
|
|
719
|
+
u.rotation = O(Z, i)) : "scale" === e.target.path ? (this.L(o, f.samplers[e.sampler], r, 1),
|
|
720
|
+
u.scale = a(Q, o)) : "weights" === e.target.path && c && (this.L(c, f.samplers[e.sampler], r, c.length),
|
|
703
721
|
u.weights = c);
|
|
704
722
|
}
|
|
705
723
|
}
|
|
@@ -709,7 +727,7 @@
|
|
|
709
727
|
switch (e.interpolation) {
|
|
710
728
|
case "LINEAR":
|
|
711
729
|
{
|
|
712
|
-
const s = this.
|
|
730
|
+
const s = this.B(tt, e, n, 1 * r);
|
|
713
731
|
s && (t = function(t, e, n, r) {
|
|
714
732
|
for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
|
|
715
733
|
return t;
|
|
@@ -719,7 +737,7 @@
|
|
|
719
737
|
|
|
720
738
|
case "STEP":
|
|
721
739
|
{
|
|
722
|
-
const s = this.
|
|
740
|
+
const s = this.B(tt, e, n, 1 * r);
|
|
723
741
|
s && (t = function(t, e) {
|
|
724
742
|
for (let n = 0; n < t.length; n++) t[n] = e[n];
|
|
725
743
|
return t;
|
|
@@ -729,32 +747,32 @@
|
|
|
729
747
|
|
|
730
748
|
case "CUBICSPLINE":
|
|
731
749
|
{
|
|
732
|
-
const s = this.
|
|
750
|
+
const s = this.B(tt, e, n, 3 * r);
|
|
733
751
|
s && (t = this.C(t, s, e.input.array, 3 * r));
|
|
734
752
|
break;
|
|
735
753
|
}
|
|
736
754
|
}
|
|
737
755
|
return t;
|
|
738
756
|
},
|
|
739
|
-
|
|
757
|
+
U(t, e, n) {
|
|
740
758
|
switch (e.interpolation) {
|
|
741
759
|
case "LINEAR":
|
|
742
760
|
{
|
|
743
|
-
const r = this.
|
|
761
|
+
const r = this.B(tt, e, n, 1);
|
|
744
762
|
r && T(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
|
|
745
763
|
break;
|
|
746
764
|
}
|
|
747
765
|
|
|
748
766
|
case "STEP":
|
|
749
767
|
{
|
|
750
|
-
const r = this.
|
|
768
|
+
const r = this.B(tt, e, n, 1);
|
|
751
769
|
r && (t = _(t, ...r.PREVIOUS));
|
|
752
770
|
break;
|
|
753
771
|
}
|
|
754
772
|
|
|
755
773
|
case "CUBICSPLINE":
|
|
756
774
|
{
|
|
757
|
-
const r = this.
|
|
775
|
+
const r = this.B(tt, e, n, 3);
|
|
758
776
|
if (r) {
|
|
759
777
|
for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
|
|
760
778
|
r.NEXT[t] = Math.acos(r.NEXT[t]);
|
|
@@ -783,7 +801,7 @@
|
|
|
783
801
|
}
|
|
784
802
|
return null;
|
|
785
803
|
},
|
|
786
|
-
|
|
804
|
+
B(t, e, n, r) {
|
|
787
805
|
const s = e.input.array, i = e.output.array, o = e.output.itemSize;
|
|
788
806
|
(n < s[0] || n > s[s.length - 1]) && (n = Math.max(s[0], Math.min(s[s.length - 1], n))),
|
|
789
807
|
n === s[s.length - 1] && (n = s[0]);
|
|
@@ -805,8 +823,7 @@
|
|
|
805
823
|
},
|
|
806
824
|
getAnimationClip(t, e, n, r) {
|
|
807
825
|
const s = t.nodes[e] && t.nodes[e].weights;
|
|
808
|
-
c(
|
|
809
|
-
return this.P(r, t, e, n, Y, Q, tt, s);
|
|
826
|
+
return c(W, ...Y.TRANSLATION), _(Z, ...Y.ROTATION), c(Q, ...Y.SCALE), this.P(r, t, e, n, W, Z, Q, s);
|
|
810
827
|
},
|
|
811
828
|
getTimeSpan(t) {
|
|
812
829
|
if (!t.animations) return null;
|
|
@@ -831,20 +848,20 @@
|
|
|
831
848
|
return n ? S(e) ? n[e] : n[Object.keys(n)[0]] : null;
|
|
832
849
|
}
|
|
833
850
|
};
|
|
834
|
-
let
|
|
851
|
+
let nt = !1;
|
|
835
852
|
if ("undefined" != typeof OffscreenCanvas) {
|
|
836
853
|
let t;
|
|
837
854
|
try {
|
|
838
855
|
t = new OffscreenCanvas(2, 2).getContext("2d");
|
|
839
|
-
} catch (
|
|
840
|
-
t && "undefined" != typeof createImageBitmap && (
|
|
856
|
+
} catch (Qt) {}
|
|
857
|
+
t && "undefined" != typeof createImageBitmap && (nt = !0);
|
|
841
858
|
}
|
|
842
|
-
const
|
|
843
|
-
class
|
|
859
|
+
const rt = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
860
|
+
class st {
|
|
844
861
|
constructor(t, e, n) {
|
|
845
862
|
if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
|
|
846
863
|
e.buffer instanceof ArrayBuffer) {
|
|
847
|
-
const {json: n, glbBuffer: r} =
|
|
864
|
+
const {json: n, glbBuffer: r} = J.read(e.buffer, e.byteOffset, e.byteLength);
|
|
848
865
|
this.F(t, n, r);
|
|
849
866
|
} else this.F(t, e);
|
|
850
867
|
this.D = new G(this.rootPath, this.gltf, this.glbBuffer), this.k();
|
|
@@ -895,10 +912,10 @@
|
|
|
895
912
|
return t;
|
|
896
913
|
}
|
|
897
914
|
static getAnimationClip(t, e, n, r) {
|
|
898
|
-
return
|
|
915
|
+
return et.getAnimationClip(t, e, n, r);
|
|
899
916
|
}
|
|
900
917
|
static getAnimationTimeSpan(t, e) {
|
|
901
|
-
return
|
|
918
|
+
return et.getTimeSpanByName(t, e);
|
|
902
919
|
}
|
|
903
920
|
static getTypedArrayCtor(t) {
|
|
904
921
|
return I(t);
|
|
@@ -908,7 +925,7 @@
|
|
|
908
925
|
}
|
|
909
926
|
F(t, e, n) {
|
|
910
927
|
this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
|
|
911
|
-
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage =
|
|
928
|
+
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = nt ? ct : this.options.requestImage || it,
|
|
912
929
|
this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new q(t, e, n, this.options.requestImage, this.options.decoders || {}, this.options.supportedFormats || {}),
|
|
913
930
|
this.adapter.iterate((t, e, n) => {
|
|
914
931
|
e.id = "buffer_" + n;
|
|
@@ -925,7 +942,7 @@
|
|
|
925
942
|
}
|
|
926
943
|
q(t, e) {
|
|
927
944
|
if (t.children && t.children.length > 0) {
|
|
928
|
-
if (!(n = t.children[0]
|
|
945
|
+
if (!("number" == typeof (n = t.children[0]) && isFinite(n) || function(t) {
|
|
929
946
|
return !M(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
|
|
930
947
|
}(t.children[0]))) return t;
|
|
931
948
|
const r = t.children.map(t => {
|
|
@@ -1070,13 +1087,11 @@
|
|
|
1070
1087
|
attributes: e.reduce((t, e) => {
|
|
1071
1088
|
if ("indices" === e.name) n = e; else if (e.name.indexOf("morphTargets_") > -1) r = r || {},
|
|
1072
1089
|
r[e.name.slice(13)] = e; else {
|
|
1073
|
-
if ("POSITION"
|
|
1074
|
-
const t = [ 1 / 0, 1 / 0, 1 / 0 ], n = [ -1 / 0, -1 / 0, -1 / 0 ], {itemSize: r, array: s} = e;
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
r < t[0] && (t[0] = r), i < t[1] && (t[1] = i), o < t[2] && (t[2] = o), r > n[0] && (n[0] = r),
|
|
1079
|
-
i > n[1] && (n[1] = i), o > n[2] && (n[2] = o);
|
|
1090
|
+
if (!("POSITION" !== e.name || e.min && e.max)) {
|
|
1091
|
+
const t = [ 1 / 0, 1 / 0, 1 / 0 ], n = [ -1 / 0, -1 / 0, -1 / 0 ], {itemSize: r, array: s} = e, i = s.length / r;
|
|
1092
|
+
for (let e = 0; e < i; e++) for (let i = 0; i < r; i++) {
|
|
1093
|
+
const o = e * r + i;
|
|
1094
|
+
s[o] < t[i] && (t[i] = s[o]), s[o] > n[i] && (n[i] = s[o]);
|
|
1080
1095
|
}
|
|
1081
1096
|
e.min = t, e.max = n;
|
|
1082
1097
|
}
|
|
@@ -1092,12 +1107,12 @@
|
|
|
1092
1107
|
});
|
|
1093
1108
|
}
|
|
1094
1109
|
}
|
|
1095
|
-
function
|
|
1110
|
+
function it(t, e) {
|
|
1096
1111
|
const n = new Image;
|
|
1097
1112
|
n.crossOrigin = "", n.onload = () => {
|
|
1098
|
-
if (!
|
|
1099
|
-
|
|
1100
|
-
const t =
|
|
1113
|
+
if (!rt) return void e(new Error("There is no canvas to draw image!"));
|
|
1114
|
+
rt.width = n.width, rt.height = n.height;
|
|
1115
|
+
const t = rt.getContext("2d");
|
|
1101
1116
|
t.drawImage(n, 0, 0, n.width, n.height);
|
|
1102
1117
|
const r = t.getImageData(0, 0, n.width, n.height), s = {
|
|
1103
1118
|
width: n.width,
|
|
@@ -1109,12 +1124,13 @@
|
|
|
1109
1124
|
e(t);
|
|
1110
1125
|
}, n.src = t;
|
|
1111
1126
|
}
|
|
1112
|
-
let
|
|
1113
|
-
function
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1127
|
+
let ot, at;
|
|
1128
|
+
function ct(t, e) {
|
|
1129
|
+
ot || (ot = new OffscreenCanvas(2, 2), at = ot.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
1130
|
+
let {width: n, height: r} = t;
|
|
1131
|
+
ht(n) || (n = ut(n)), ht(r) || (r = ut(r)), ot.width = n, ot.height = r, at.drawImage(t, 0, 0, n, r),
|
|
1132
|
+
t.close();
|
|
1133
|
+
const s = at.getImageData(0, 0, n, r);
|
|
1118
1134
|
e(null, {
|
|
1119
1135
|
width: n,
|
|
1120
1136
|
height: r,
|
|
@@ -1124,6 +1140,12 @@
|
|
|
1124
1140
|
console.warn(t), e(t);
|
|
1125
1141
|
});
|
|
1126
1142
|
}
|
|
1143
|
+
function ht(t) {
|
|
1144
|
+
return 0 == (t & t - 1) && 0 !== t;
|
|
1145
|
+
}
|
|
1146
|
+
function ut(t) {
|
|
1147
|
+
return Math.pow(2, Math.floor(Math.log(t) / Math.LN2));
|
|
1148
|
+
}
|
|
1127
1149
|
function ft(t) {
|
|
1128
1150
|
return t / Math.PI * 180;
|
|
1129
1151
|
}
|
|
@@ -1157,12 +1179,12 @@
|
|
|
1157
1179
|
if (y < s) return isFinite(b) ? p : void 0;
|
|
1158
1180
|
const w = r[0], _ = r[1], g = r[2], T = At;
|
|
1159
1181
|
T[0] = p[0] * w * 2, T[1] = p[1] * _ * 2, T[2] = p[2] * g * 2;
|
|
1160
|
-
let A, O, v, M, S, x, I, N, E, P, L,
|
|
1182
|
+
let A, O, v, M, S, x, I, N, E, P, L, U = (1 - b) * Ot(e) / (.5 * Ot(T)), B = 0;
|
|
1161
1183
|
do {
|
|
1162
|
-
|
|
1184
|
+
U -= B, v = 1 / (1 + U * w), M = 1 / (1 + U * _), S = 1 / (1 + U * g), x = v * v,
|
|
1163
1185
|
I = M * M, N = S * S, E = x * v, P = I * M, L = N * S, A = l * x + d * I + m * N - 1,
|
|
1164
1186
|
O = l * E * w + d * P * _ + m * L * g;
|
|
1165
|
-
|
|
1187
|
+
B = A / (-2 * O);
|
|
1166
1188
|
} while (Math.abs(A) > 1e-12);
|
|
1167
1189
|
return t[0] = i * v, t[1] = o * M, t[2] = a * S, t;
|
|
1168
1190
|
}(pt, e, yt, n, .1);
|
|
@@ -1273,11 +1295,11 @@
|
|
|
1273
1295
|
name: "Float64Array"
|
|
1274
1296
|
}
|
|
1275
1297
|
};
|
|
1276
|
-
function
|
|
1298
|
+
function Ut(t) {
|
|
1277
1299
|
for (let e in Lt) if (t === Lt[e].ctor) return Lt[e].type;
|
|
1278
1300
|
throw new Error("unrecognized ctor:" + t);
|
|
1279
1301
|
}
|
|
1280
|
-
function
|
|
1302
|
+
function Bt(t, e, n, r) {
|
|
1281
1303
|
const s = t, i = e.length / 3;
|
|
1282
1304
|
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],
|
|
1283
1305
|
s[3 * t + 2] = e[3 * t + 2] / 65535 * r[2] + n[2];
|
|
@@ -1360,8 +1382,10 @@
|
|
|
1360
1382
|
south: "down"
|
|
1361
1383
|
}
|
|
1362
1384
|
}[qt = "east"][$t = "north"], Ft[Xt = qt + $t] ? Jt = Ft[Xt] : (Jt = function(t, e, n) {
|
|
1363
|
-
if (
|
|
1364
|
-
|
|
1385
|
+
if (function(t, e) {
|
|
1386
|
+
var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
|
|
1387
|
+
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));
|
|
1388
|
+
}(t, Vt)) a(kt, Rt[qt]), a(zt, Rt[$t]), a(jt, Rt[Kt]); else if (Gt(t[0], 0, 1e-14) && Gt(t[1], 0, 1e-14)) {
|
|
1365
1389
|
var r = lt(t[2]);
|
|
1366
1390
|
a(kt, Rt[qt]), "east" !== qt && "west" !== qt && f(kt, kt, r), a(zt, Rt[$t]), "east" !== $t && "west" !== $t && f(zt, zt, r),
|
|
1367
1391
|
a(jt, Rt[Kt]), "east" !== Kt && "west" !== Kt && f(jt, jt, r);
|
|
@@ -1373,7 +1397,6 @@
|
|
|
1373
1397
|
i[0] = -t[1], i[1] = t[0], i[2] = 0, l(Dt.east, i), m(Dt.north, s, i), f(Dt.down, Dt.up, -1),
|
|
1374
1398
|
f(Dt.west, Dt.east, -1), f(Dt.south, Dt.north, -1), kt = Dt[qt], zt = Dt[$t], jt = Dt[Kt];
|
|
1375
1399
|
}
|
|
1376
|
-
var o, c, h, d, y, b, p, w;
|
|
1377
1400
|
return n[0] = kt[0], n[1] = kt[1], n[2] = kt[2], n[3] = 0, n[4] = zt[0], n[5] = zt[1],
|
|
1378
1401
|
n[6] = zt[2], n[7] = 0, n[8] = jt[0], n[9] = jt[1], n[10] = jt[2], n[11] = 0, n[12] = t[0],
|
|
1379
1402
|
n[13] = t[1], n[14] = t[2], n[15] = 1, n;
|
|
@@ -1388,24 +1411,24 @@
|
|
|
1388
1411
|
if ("undefined" != typeof window) return window;
|
|
1389
1412
|
if ("undefined" != typeof global) return global;
|
|
1390
1413
|
throw new Error("unable to locate global object");
|
|
1391
|
-
}, Zt = Wt(),
|
|
1392
|
-
|
|
1414
|
+
}, Zt = Wt(), Qt = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
|
|
1415
|
+
Qt.inject = function(t) {
|
|
1393
1416
|
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
|
|
1394
1417
|
let i = `${r}\n const _____getGlobal = ${Wt.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
|
|
1395
1418
|
for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
|
|
1396
1419
|
return i += "\n" + e.substring(r.length), i;
|
|
1397
|
-
},
|
|
1398
|
-
|
|
1399
|
-
},
|
|
1400
|
-
return
|
|
1420
|
+
}, Qt.registerTranscoder = function(t, e) {
|
|
1421
|
+
Qt[t] = e;
|
|
1422
|
+
}, Qt.getTranscoder = function(t) {
|
|
1423
|
+
return Qt[t];
|
|
1401
1424
|
};
|
|
1402
|
-
class
|
|
1425
|
+
class Yt {
|
|
1403
1426
|
constructor(t, e, n) {
|
|
1404
|
-
this.i = t, this.Y = e ||
|
|
1405
|
-
"image/crn":
|
|
1406
|
-
"image/ktx2":
|
|
1407
|
-
"image/cttf":
|
|
1408
|
-
"draco":
|
|
1427
|
+
this.i = t, this.Y = e || st, this.o = n, this.tt = {
|
|
1428
|
+
"image/crn": Qt.crn && Qt.crn(),
|
|
1429
|
+
"image/ktx2": Qt.ktx2 && Qt.ktx2(),
|
|
1430
|
+
"image/cttf": Qt.ktx2 && Qt.ktx2(),
|
|
1431
|
+
"draco": Qt.draco && Qt.draco()
|
|
1409
1432
|
};
|
|
1410
1433
|
}
|
|
1411
1434
|
static createEmptyB3DM() {
|
|
@@ -1496,11 +1519,11 @@
|
|
|
1496
1519
|
}
|
|
1497
1520
|
class te {
|
|
1498
1521
|
constructor(t, e, n) {
|
|
1499
|
-
this.i = t, this.Y = e ||
|
|
1500
|
-
"image/crn":
|
|
1501
|
-
"image/ktx2":
|
|
1502
|
-
"image/cttf":
|
|
1503
|
-
"draco":
|
|
1522
|
+
this.i = t, this.Y = e || st, this.o = n, this.tt = {
|
|
1523
|
+
"image/crn": Qt.crn && Qt.crn(),
|
|
1524
|
+
"image/ktx2": Qt.ktx2 && Qt.ktx2(),
|
|
1525
|
+
"image/cttf": Qt.ktx2 && Qt.ktx2(),
|
|
1526
|
+
"draco": Qt.draco && Qt.draco()
|
|
1504
1527
|
};
|
|
1505
1528
|
}
|
|
1506
1529
|
load(t, e, n = 0, r = 0) {
|
|
@@ -1676,7 +1699,7 @@
|
|
|
1676
1699
|
return n;
|
|
1677
1700
|
}
|
|
1678
1701
|
at(t, e, n) {
|
|
1679
|
-
return
|
|
1702
|
+
return Bt(new Float32Array(t.length), t, e, n);
|
|
1680
1703
|
}
|
|
1681
1704
|
rt() {
|
|
1682
1705
|
return null;
|
|
@@ -1742,7 +1765,7 @@
|
|
|
1742
1765
|
attributes: y.properties,
|
|
1743
1766
|
useUniqueIDs: !1
|
|
1744
1767
|
};
|
|
1745
|
-
return this.ut || (this.ut =
|
|
1768
|
+
return this.ut || (this.ut = Qt.draco()), this.ut(m, e).then(e => {
|
|
1746
1769
|
const n = e.attributes;
|
|
1747
1770
|
!a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
|
|
1748
1771
|
n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
|
|
@@ -1756,7 +1779,7 @@
|
|
|
1756
1779
|
byteOffset: 0,
|
|
1757
1780
|
itemSize: 1,
|
|
1758
1781
|
count: t.length,
|
|
1759
|
-
componentType:
|
|
1782
|
+
componentType: Ut(t.constructor),
|
|
1760
1783
|
array: t
|
|
1761
1784
|
}, o.push(t.buffer);
|
|
1762
1785
|
} else if (a.BATCH_ID || Object.keys(h).length) {
|
|
@@ -1905,7 +1928,7 @@
|
|
|
1905
1928
|
return a;
|
|
1906
1929
|
}
|
|
1907
1930
|
at(t, e, n) {
|
|
1908
|
-
return
|
|
1931
|
+
return Bt(new Float32Array(t.length), t, e, n);
|
|
1909
1932
|
}
|
|
1910
1933
|
rt() {
|
|
1911
1934
|
return null;
|
|
@@ -1921,13 +1944,13 @@
|
|
|
1921
1944
|
byteOffset: 0,
|
|
1922
1945
|
itemSize: 1,
|
|
1923
1946
|
count: t,
|
|
1924
|
-
componentType:
|
|
1947
|
+
componentType: Ut(e),
|
|
1925
1948
|
array: r
|
|
1926
1949
|
};
|
|
1927
1950
|
}
|
|
1928
1951
|
class oe {
|
|
1929
1952
|
constructor(t, e) {
|
|
1930
|
-
this.i = t, this.Y = e ||
|
|
1953
|
+
this.i = t, this.Y = e || st;
|
|
1931
1954
|
}
|
|
1932
1955
|
load(t, e, n = 0, r = 0) {
|
|
1933
1956
|
return e ? this.et(t, e, n, r) : z.getArrayBuffer(t, {}).then(e => {
|
|
@@ -1940,7 +1963,7 @@
|
|
|
1940
1963
|
const s = this.lt(e, t, n, r), i = [];
|
|
1941
1964
|
for (let n = 0; n < s.length; n++) {
|
|
1942
1965
|
let r;
|
|
1943
|
-
if ("b3dm" === s[n].magic) r = new
|
|
1966
|
+
if ("b3dm" === s[n].magic) r = new Yt(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new te(this.i, this.Y); else if ("pnts" === s[n].magic) r = new se; else {
|
|
1944
1967
|
if ("cmpt" !== s[n].magic) {
|
|
1945
1968
|
console.warn("Unsupported magic in CMPT tile:", s[n].magic);
|
|
1946
1969
|
continue;
|
|
@@ -2001,7 +2024,7 @@
|
|
|
2001
2024
|
}
|
|
2002
2025
|
function he(t, e) {
|
|
2003
2026
|
let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
|
|
2004
|
-
const a = t.array.buffer, c = n ?
|
|
2027
|
+
const a = t.array.buffer, c = n ? st.getTypedArrayCtor(n) : t.array.constructor;
|
|
2005
2028
|
if (r = void 0 === r ? t.array.byteOffset : r, s = s || 0, i = i || t.array.length / o,
|
|
2006
2029
|
(!s || s === o * c.BYTES_PER_ELEMENT) && r % c.BYTES_PER_ELEMENT == 0) {
|
|
2007
2030
|
const t = new c(a, r, i * o);
|
|
@@ -2033,7 +2056,7 @@
|
|
|
2033
2056
|
this.bt = {}, r(null, {}, []);
|
|
2034
2057
|
}
|
|
2035
2058
|
pt(t) {
|
|
2036
|
-
this.wt || (this._t = new se, this.wt = new
|
|
2059
|
+
this.wt || (this._t = new se, this.wt = new Yt(this.dt, st, t), this.gt = new te(this.dt, st, t));
|
|
2037
2060
|
}
|
|
2038
2061
|
requestImage(t, e) {
|
|
2039
2062
|
me ? fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
@@ -2084,7 +2107,7 @@
|
|
|
2084
2107
|
e(null, r, i);
|
|
2085
2108
|
});
|
|
2086
2109
|
} else if ("cmpt" === s) {
|
|
2087
|
-
new oe(this.dt,
|
|
2110
|
+
new oe(this.dt, st).load(n, r).then(n => {
|
|
2088
2111
|
const {content: r, transferables: s} = this.Ot(n, t);
|
|
2089
2112
|
e(null, r, s);
|
|
2090
2113
|
}).catch(t => {
|
|
@@ -2095,7 +2118,7 @@
|
|
|
2095
2118
|
const r = this.options.services[t.rootIdx];
|
|
2096
2119
|
let s = r.urlParams;
|
|
2097
2120
|
s && (s = (n.indexOf("?") > 0 ? "&" : "?") + s);
|
|
2098
|
-
let i = z.getArrayBuffer(n + (s || ""), r.
|
|
2121
|
+
let i = z.getArrayBuffer(n + (s || ""), r.fetchOptions);
|
|
2099
2122
|
const o = i.xhr;
|
|
2100
2123
|
i = i.then(r => {
|
|
2101
2124
|
delete this.bt[n], r && r.status ? e(r) : (t.arraybuffer = r && r.data, this.loadTile(t, e));
|
|
@@ -2359,7 +2382,7 @@
|
|
|
2359
2382
|
return !0;
|
|
2360
2383
|
}
|
|
2361
2384
|
function h(t, e) {
|
|
2362
|
-
var n = e
|
|
2385
|
+
var n = e, r = t, s = e, i = r[0], o = r[1], a = r[2], c = Math.abs(i * s[3] + o * s[6] + a * s[9]) + Math.abs(i * s[4] + o * s[7] + a * s[10]) + Math.abs(i * s[5] + o * s[8] + a * s[11]), h = l(t, n);
|
|
2363
2386
|
return !(h <= -c);
|
|
2364
2387
|
}
|
|
2365
2388
|
function u(t) {
|
|
@@ -2368,8 +2391,8 @@
|
|
|
2368
2391
|
f(i[3], o - r, u - c, y - d, _ - p), f(i[4], o - s, u - h, y - m, _ - w), f(i[5], o + s, u + h, y + m, _ + w);
|
|
2369
2392
|
}
|
|
2370
2393
|
function f(t, e, n, r, s) {
|
|
2371
|
-
|
|
2372
|
-
t;
|
|
2394
|
+
var i = 1 / Math.sqrt(e * e + n * n + r * r);
|
|
2395
|
+
return t[0] = e * i, t[1] = n * i, t[2] = r * i, t[3] = s * i, t;
|
|
2373
2396
|
}
|
|
2374
2397
|
function l(t, e) {
|
|
2375
2398
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] + t[3];
|
|
@@ -2475,10 +2498,10 @@
|
|
|
2475
2498
|
var r = new I(3);
|
|
2476
2499
|
return r[0] = t, r[1] = e, r[2] = n, r;
|
|
2477
2500
|
}
|
|
2478
|
-
function
|
|
2501
|
+
function U(t, e) {
|
|
2479
2502
|
return t[0] = e[0], t[1] = e[1], t[2] = e[2], t;
|
|
2480
2503
|
}
|
|
2481
|
-
function
|
|
2504
|
+
function B(t, e, n, r) {
|
|
2482
2505
|
return t[0] = e, t[1] = n, t[2] = r, t;
|
|
2483
2506
|
}
|
|
2484
2507
|
function C(t, e, n) {
|
|
@@ -2527,7 +2550,7 @@
|
|
|
2527
2550
|
E(), L(1, 0, 0), L(0, 1, 0), q(), q(), J = new I(9), I != Float32Array && (J[1] = 0,
|
|
2528
2551
|
J[2] = 0, J[3] = 0, J[5] = 0, J[6] = 0, J[7] = 0), J[0] = 1, J[4] = 1, J[8] = 1;
|
|
2529
2552
|
/*!
|
|
2530
|
-
* @maptalks/gltf-loader v0.25.
|
|
2553
|
+
* @maptalks/gltf-loader v0.25.5
|
|
2531
2554
|
* LICENSE : UNLICENSED
|
|
2532
2555
|
* (c) 2016-2022 maptalks.org
|
|
2533
2556
|
*/
|
|
@@ -2538,14 +2561,14 @@
|
|
|
2538
2561
|
function Z(t) {
|
|
2539
2562
|
return !W(t);
|
|
2540
2563
|
}
|
|
2541
|
-
function
|
|
2564
|
+
function Q(t) {
|
|
2542
2565
|
for (let e = 1; e < arguments.length; e++) {
|
|
2543
2566
|
const n = arguments[e];
|
|
2544
2567
|
for (const e in n) t[e] = n[e];
|
|
2545
2568
|
}
|
|
2546
2569
|
return t;
|
|
2547
2570
|
}
|
|
2548
|
-
function
|
|
2571
|
+
function Y(t) {
|
|
2549
2572
|
switch (t) {
|
|
2550
2573
|
case 5120:
|
|
2551
2574
|
return Int8Array;
|
|
@@ -2584,7 +2607,7 @@
|
|
|
2584
2607
|
return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t;
|
|
2585
2608
|
}([]), at = [ 1, 1, 1 ];
|
|
2586
2609
|
function ct(t, e, n, r, s, i, o) {
|
|
2587
|
-
const a =
|
|
2610
|
+
const a = Y(o);
|
|
2588
2611
|
if ((0 === s || s === r * a.BYTES_PER_ELEMENT) && i % a.BYTES_PER_ELEMENT == 0) {
|
|
2589
2612
|
const s = new a(e, i, n * r);
|
|
2590
2613
|
return t.set(s), t;
|
|
@@ -2636,19 +2659,19 @@
|
|
|
2636
2659
|
getArrayBuffer: (t, e = {}) => (e || (e = {}), e.responseType = "arraybuffer", ft.get(t, e)),
|
|
2637
2660
|
getJSON: function(t, e = {}) {
|
|
2638
2661
|
return e && e.jsonp ? ft.jsonp(t) : ((e = e || {}).responseType = "json", ft.get(t, e));
|
|
2662
|
+
},
|
|
2663
|
+
jsonp: function(t) {
|
|
2664
|
+
const e = "_maptalks_jsonp_" + X++;
|
|
2665
|
+
t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
|
|
2666
|
+
let n = document.createElement("script");
|
|
2667
|
+
return n.type = "text/javascript", n.src = t, new Promise(t => {
|
|
2668
|
+
window[e] = function(r) {
|
|
2669
|
+
document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
|
|
2670
|
+
t(r);
|
|
2671
|
+
}, document.getElementsByTagName("head")[0].appendChild(n);
|
|
2672
|
+
});
|
|
2639
2673
|
}
|
|
2640
2674
|
};
|
|
2641
|
-
ft.jsonp = function(t) {
|
|
2642
|
-
const e = "_maptalks_jsonp_" + X++;
|
|
2643
|
-
t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
|
|
2644
|
-
let n = document.createElement("script");
|
|
2645
|
-
return n.type = "text/javascript", n.src = t, new Promise(t => {
|
|
2646
|
-
window[e] = function(r) {
|
|
2647
|
-
document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
|
|
2648
|
-
t(r);
|
|
2649
|
-
}, document.getElementsByTagName("head")[0].appendChild(n);
|
|
2650
|
-
});
|
|
2651
|
-
};
|
|
2652
2675
|
class lt {
|
|
2653
2676
|
constructor(t, e, n) {
|
|
2654
2677
|
this.i = t, this.decoders = e, this.o = n, this.images = {}, this.h = {};
|
|
@@ -2689,8 +2712,7 @@
|
|
|
2689
2712
|
requestExternalImage(t) {
|
|
2690
2713
|
if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
|
|
2691
2714
|
const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
|
|
2692
|
-
|
|
2693
|
-
return this.h[t.id] = this.l(t.id, e);
|
|
2715
|
+
return this.h[t.id] ? this.h[t.id].then(() => this.images[t.id]) : this.h[t.id] = this.l(t.id, e);
|
|
2694
2716
|
}
|
|
2695
2717
|
l(t, e) {
|
|
2696
2718
|
return new Promise((n, r) => {
|
|
@@ -2753,8 +2775,7 @@
|
|
|
2753
2775
|
});
|
|
2754
2776
|
}
|
|
2755
2777
|
g(t, e, n, r = 0) {
|
|
2756
|
-
const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h =
|
|
2757
|
-
const f = {
|
|
2778
|
+
const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = Y(i.componentType), u = o.byteStride || 0, f = {
|
|
2758
2779
|
array: void 0,
|
|
2759
2780
|
name: t,
|
|
2760
2781
|
accessorName: e,
|
|
@@ -2868,7 +2889,7 @@
|
|
|
2868
2889
|
r.instanceTechnique && r.instanceTechnique.values ? (s = r.instanceTechnique, i = s.values.diffuse) : (s = r,
|
|
2869
2890
|
i = s.values.tex || s.values.diffuseTex || s.values.diffuse);
|
|
2870
2891
|
const o = {
|
|
2871
|
-
|
|
2892
|
+
baseColorTexture: {
|
|
2872
2893
|
index: i
|
|
2873
2894
|
}
|
|
2874
2895
|
};
|
|
@@ -2941,7 +2962,7 @@
|
|
|
2941
2962
|
}
|
|
2942
2963
|
createNode(t) {
|
|
2943
2964
|
const e = {};
|
|
2944
|
-
return
|
|
2965
|
+
return Q(e, t), !Z(t.weights) && this.gltf.meshes && Z(e.mesh) ? e.weights = this.gltf.meshes[e.mesh].weights : t.weights && (e.weights = t.weights),
|
|
2945
2966
|
e;
|
|
2946
2967
|
}
|
|
2947
2968
|
S(t) {
|
|
@@ -2963,7 +2984,7 @@
|
|
|
2963
2984
|
extras: n.extras
|
|
2964
2985
|
}
|
|
2965
2986
|
};
|
|
2966
|
-
|
|
2987
|
+
Q(r, e);
|
|
2967
2988
|
const s = Z(e.sampler) ? this.gltf.samplers[e.sampler] : void 0;
|
|
2968
2989
|
return s && (r.sampler = s), t.format && (r.format = t.format), r;
|
|
2969
2990
|
});
|
|
@@ -2989,8 +3010,7 @@
|
|
|
2989
3010
|
N(t, e) {
|
|
2990
3011
|
const n = new Array(t.byteLength);
|
|
2991
3012
|
for (let e = 0; e < t.byteLength; e++) n[e] = String.fromCharCode(t[e]);
|
|
2992
|
-
n.join("");
|
|
2993
|
-
return "data:" + (e = e || "image/png") + ";base64," + function(t) {
|
|
3013
|
+
return n.join(""), "data:" + (e = e || "image/png") + ";base64," + function(t) {
|
|
2994
3014
|
return "undefined" != typeof self ? self.btoa(t) : window.btoa(t);
|
|
2995
3015
|
}(unescape(encodeURIComponent(n)));
|
|
2996
3016
|
}
|
|
@@ -3014,19 +3034,19 @@
|
|
|
3014
3034
|
});
|
|
3015
3035
|
}
|
|
3016
3036
|
}
|
|
3017
|
-
const pt = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null
|
|
3018
|
-
class
|
|
3037
|
+
const pt = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
|
|
3038
|
+
class wt {
|
|
3019
3039
|
static read(t, e = 0, n = 0) {
|
|
3020
3040
|
n || (n = t.byteLength);
|
|
3021
3041
|
const r = new DataView(t, e, n), s = r.getUint32(4, !0);
|
|
3022
|
-
if (1 === s) return
|
|
3023
|
-
if (2 === s) return
|
|
3042
|
+
if (1 === s) return wt.readV1(r, e);
|
|
3043
|
+
if (2 === s) return wt.readV2(t, e);
|
|
3024
3044
|
throw new Error("Unsupported glb version : " + s);
|
|
3025
3045
|
}
|
|
3026
3046
|
static readV1(t, e) {
|
|
3027
3047
|
const n = t.getUint32(8, !0), r = t.getUint32(12, !0);
|
|
3028
3048
|
if (n !== t.byteLength) throw new Error("Length in GLB header is inconsistent with glb's byte length.");
|
|
3029
|
-
const s =
|
|
3049
|
+
const s = _t(t.buffer, 20 + e, r);
|
|
3030
3050
|
return {
|
|
3031
3051
|
json: JSON.parse(s),
|
|
3032
3052
|
glbBuffer: {
|
|
@@ -3044,7 +3064,7 @@
|
|
|
3044
3064
|
const a = i.getUint32(o, !0);
|
|
3045
3065
|
o += 4;
|
|
3046
3066
|
const c = i.getUint32(o, !0);
|
|
3047
|
-
if (o += 4,
|
|
3067
|
+
if (o += 4, 1313821514 === c) n = _t(t, e + 12 + o, a); else if (5130562 === c) {
|
|
3048
3068
|
s = e + 12 + o, r = a;
|
|
3049
3069
|
break;
|
|
3050
3070
|
}
|
|
@@ -3060,7 +3080,7 @@
|
|
|
3060
3080
|
};
|
|
3061
3081
|
}
|
|
3062
3082
|
}
|
|
3063
|
-
function
|
|
3083
|
+
function _t(t, e, n) {
|
|
3064
3084
|
if (pt) {
|
|
3065
3085
|
const r = new Uint8Array(t, e, n);
|
|
3066
3086
|
return pt.decode(r);
|
|
@@ -3071,7 +3091,7 @@
|
|
|
3071
3091
|
for (let r = 0; r < e; ) {
|
|
3072
3092
|
let s = t[r++];
|
|
3073
3093
|
if (128 & s) {
|
|
3074
|
-
let n =
|
|
3094
|
+
let n = gt[s >> 3 & 7];
|
|
3075
3095
|
if (!(64 & s) || !n || r + n > e) return null;
|
|
3076
3096
|
for (s &= 63 >> n; n > 0; n -= 1) {
|
|
3077
3097
|
const e = t[r++];
|
|
@@ -3084,29 +3104,28 @@
|
|
|
3084
3104
|
return n;
|
|
3085
3105
|
}(new Uint8Array(t, e, n));
|
|
3086
3106
|
}
|
|
3087
|
-
const
|
|
3088
|
-
const Ot = [ 0, 0, 0 ], vt = [ 0, 0, 0, 1 ], Mt = [ 1, 1, 1 ], St = {
|
|
3107
|
+
const gt = [ 1, 1, 1, 1, 2, 2, 3, 0 ], Tt = [ 0, 0, 0 ], At = [ 0, 0, 0, 1 ], Ot = [ 1, 1, 1 ], vt = {
|
|
3089
3108
|
TRANSLATION: [ 0, 0, 0 ],
|
|
3090
3109
|
ROTATION: [ 0, 0, 0, 1 ],
|
|
3091
3110
|
SCALE: [ 1, 1, 1 ]
|
|
3092
|
-
},
|
|
3111
|
+
}, Mt = {
|
|
3093
3112
|
PREVIOUS: null,
|
|
3094
3113
|
NEXT: null,
|
|
3095
3114
|
PREINDEX: null,
|
|
3096
3115
|
NEXTINDEX: null,
|
|
3097
3116
|
INTERPOLATION: null
|
|
3098
|
-
},
|
|
3117
|
+
}, St = {
|
|
3099
3118
|
P(t, e, n, r, s, i, o, a) {
|
|
3100
3119
|
const c = Z(t) ? e.animations : [ e.animations[0] ], h = {};
|
|
3101
3120
|
for (let e = 0; e < c.length; e++) {
|
|
3102
|
-
const u = c[e];
|
|
3103
|
-
if (Z(t) &&
|
|
3104
|
-
const
|
|
3105
|
-
if (
|
|
3106
|
-
const e =
|
|
3107
|
-
"translation" === e.target.path ? (this.L(s, u.samplers[e.sampler], r, 1), h.translation =
|
|
3108
|
-
h.rotation = K(
|
|
3109
|
-
h.scale =
|
|
3121
|
+
const u = c[e], f = u.name || e;
|
|
3122
|
+
if (Z(t) && f !== t) continue;
|
|
3123
|
+
const l = u.channelsMap[n];
|
|
3124
|
+
if (l) for (let t = 0; t < l.length; t++) {
|
|
3125
|
+
const e = l[t];
|
|
3126
|
+
"translation" === e.target.path ? (this.L(s, u.samplers[e.sampler], r, 1), h.translation = U(Tt, s)) : "rotation" === e.target.path ? (this.U(i, u.samplers[e.sampler], r, 1),
|
|
3127
|
+
h.rotation = K(At, i)) : "scale" === e.target.path ? (this.L(o, u.samplers[e.sampler], r, 1),
|
|
3128
|
+
h.scale = U(Ot, o)) : "weights" === e.target.path && a && (this.L(a, u.samplers[e.sampler], r, a.length),
|
|
3110
3129
|
h.weights = a);
|
|
3111
3130
|
}
|
|
3112
3131
|
}
|
|
@@ -3116,7 +3135,7 @@
|
|
|
3116
3135
|
switch (e.interpolation) {
|
|
3117
3136
|
case "LINEAR":
|
|
3118
3137
|
{
|
|
3119
|
-
const s = this.
|
|
3138
|
+
const s = this.B(Mt, e, n, 1 * r);
|
|
3120
3139
|
s && (t = function(t, e, n, r) {
|
|
3121
3140
|
for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
|
|
3122
3141
|
return t;
|
|
@@ -3126,7 +3145,7 @@
|
|
|
3126
3145
|
|
|
3127
3146
|
case "STEP":
|
|
3128
3147
|
{
|
|
3129
|
-
const s = this.
|
|
3148
|
+
const s = this.B(Mt, e, n, 1 * r);
|
|
3130
3149
|
s && (t = function(t, e) {
|
|
3131
3150
|
for (let n = 0; n < t.length; n++) t[n] = e[n];
|
|
3132
3151
|
return t;
|
|
@@ -3136,32 +3155,32 @@
|
|
|
3136
3155
|
|
|
3137
3156
|
case "CUBICSPLINE":
|
|
3138
3157
|
{
|
|
3139
|
-
const s = this.
|
|
3158
|
+
const s = this.B(Mt, e, n, 3 * r);
|
|
3140
3159
|
s && (t = this.C(t, s, e.input.array, 3 * r));
|
|
3141
3160
|
break;
|
|
3142
3161
|
}
|
|
3143
3162
|
}
|
|
3144
3163
|
return t;
|
|
3145
3164
|
},
|
|
3146
|
-
|
|
3165
|
+
U(t, e, n) {
|
|
3147
3166
|
switch (e.interpolation) {
|
|
3148
3167
|
case "LINEAR":
|
|
3149
3168
|
{
|
|
3150
|
-
const r = this.
|
|
3169
|
+
const r = this.B(Mt, e, n, 1);
|
|
3151
3170
|
r && $(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
|
|
3152
3171
|
break;
|
|
3153
3172
|
}
|
|
3154
3173
|
|
|
3155
3174
|
case "STEP":
|
|
3156
3175
|
{
|
|
3157
|
-
const r = this.
|
|
3176
|
+
const r = this.B(Mt, e, n, 1);
|
|
3158
3177
|
r && (t = H(t, ...r.PREVIOUS));
|
|
3159
3178
|
break;
|
|
3160
3179
|
}
|
|
3161
3180
|
|
|
3162
3181
|
case "CUBICSPLINE":
|
|
3163
3182
|
{
|
|
3164
|
-
const r = this.
|
|
3183
|
+
const r = this.B(Mt, e, n, 3);
|
|
3165
3184
|
if (r) {
|
|
3166
3185
|
for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
|
|
3167
3186
|
r.NEXT[t] = Math.acos(r.NEXT[t]);
|
|
@@ -3190,7 +3209,7 @@
|
|
|
3190
3209
|
}
|
|
3191
3210
|
return null;
|
|
3192
3211
|
},
|
|
3193
|
-
|
|
3212
|
+
B(t, e, n, r) {
|
|
3194
3213
|
const s = e.input.array, i = e.output.array, o = e.output.itemSize;
|
|
3195
3214
|
(n < s[0] || n > s[s.length - 1]) && (n = Math.max(s[0], Math.min(s[s.length - 1], n))),
|
|
3196
3215
|
n === s[s.length - 1] && (n = s[0]);
|
|
@@ -3212,8 +3231,7 @@
|
|
|
3212
3231
|
},
|
|
3213
3232
|
getAnimationClip(t, e, n, r) {
|
|
3214
3233
|
const s = t.nodes[e] && t.nodes[e].weights;
|
|
3215
|
-
|
|
3216
|
-
return this.P(r, t, e, n, Ot, vt, Mt, s);
|
|
3234
|
+
return B(Tt, ...vt.TRANSLATION), H(At, ...vt.ROTATION), B(Ot, ...vt.SCALE), this.P(r, t, e, n, Tt, At, Ot, s);
|
|
3217
3235
|
},
|
|
3218
3236
|
getTimeSpan(t) {
|
|
3219
3237
|
if (!t.animations) return null;
|
|
@@ -3238,20 +3256,20 @@
|
|
|
3238
3256
|
return n ? Z(e) ? n[e] : n[Object.keys(n)[0]] : null;
|
|
3239
3257
|
}
|
|
3240
3258
|
};
|
|
3241
|
-
let
|
|
3259
|
+
let xt = !1;
|
|
3242
3260
|
if ("undefined" != typeof OffscreenCanvas) {
|
|
3243
3261
|
let t;
|
|
3244
3262
|
try {
|
|
3245
3263
|
t = new OffscreenCanvas(2, 2).getContext("2d");
|
|
3246
|
-
} catch (
|
|
3247
|
-
t && "undefined" != typeof createImageBitmap && (
|
|
3264
|
+
} catch (qn) {}
|
|
3265
|
+
t && "undefined" != typeof createImageBitmap && (xt = !0);
|
|
3248
3266
|
}
|
|
3249
|
-
const
|
|
3250
|
-
class
|
|
3267
|
+
const It = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
3268
|
+
class Nt {
|
|
3251
3269
|
constructor(t, e, n) {
|
|
3252
3270
|
if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
|
|
3253
3271
|
e.buffer instanceof ArrayBuffer) {
|
|
3254
|
-
const {json: n, glbBuffer: r} =
|
|
3272
|
+
const {json: n, glbBuffer: r} = wt.read(e.buffer, e.byteOffset, e.byteLength);
|
|
3255
3273
|
this.F(t, n, r);
|
|
3256
3274
|
} else this.F(t, e);
|
|
3257
3275
|
this.D = new mt(this.rootPath, this.gltf, this.glbBuffer), this.k();
|
|
@@ -3302,20 +3320,20 @@
|
|
|
3302
3320
|
return t;
|
|
3303
3321
|
}
|
|
3304
3322
|
static getAnimationClip(t, e, n, r) {
|
|
3305
|
-
return
|
|
3323
|
+
return St.getAnimationClip(t, e, n, r);
|
|
3306
3324
|
}
|
|
3307
3325
|
static getAnimationTimeSpan(t, e) {
|
|
3308
|
-
return
|
|
3326
|
+
return St.getTimeSpanByName(t, e);
|
|
3309
3327
|
}
|
|
3310
3328
|
static getTypedArrayCtor(t) {
|
|
3311
|
-
return
|
|
3329
|
+
return Y(t);
|
|
3312
3330
|
}
|
|
3313
3331
|
static readInterleavedArray(t, e, n, r, s, i, o) {
|
|
3314
3332
|
return ct(t, e, n, r, s, i, o);
|
|
3315
3333
|
}
|
|
3316
3334
|
F(t, e, n) {
|
|
3317
3335
|
this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
|
|
3318
|
-
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage =
|
|
3336
|
+
this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = xt ? Ut : this.options.requestImage || Et,
|
|
3319
3337
|
this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new bt(t, e, n, this.options.requestImage, this.options.decoders || {}, this.options.supportedFormats || {}),
|
|
3320
3338
|
this.adapter.iterate((t, e, n) => {
|
|
3321
3339
|
e.id = "buffer_" + n;
|
|
@@ -3332,7 +3350,7 @@
|
|
|
3332
3350
|
}
|
|
3333
3351
|
q(t, e) {
|
|
3334
3352
|
if (t.children && t.children.length > 0) {
|
|
3335
|
-
if (!(n = t.children[0]
|
|
3353
|
+
if (!("number" == typeof (n = t.children[0]) && isFinite(n) || function(t) {
|
|
3336
3354
|
return !W(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
|
|
3337
3355
|
}(t.children[0]))) return t;
|
|
3338
3356
|
const r = t.children.map(t => {
|
|
@@ -3411,7 +3429,7 @@
|
|
|
3411
3429
|
const n = t.primitives.map(t => this.Z(t, e)).filter(t => !!t);
|
|
3412
3430
|
return Promise.all(n).then(e => {
|
|
3413
3431
|
const n = {};
|
|
3414
|
-
return
|
|
3432
|
+
return Q(n, t), n.primitives = e, n;
|
|
3415
3433
|
});
|
|
3416
3434
|
}
|
|
3417
3435
|
H() {
|
|
@@ -3477,13 +3495,11 @@
|
|
|
3477
3495
|
attributes: e.reduce((t, e) => {
|
|
3478
3496
|
if ("indices" === e.name) n = e; else if (e.name.indexOf("morphTargets_") > -1) r = r || {},
|
|
3479
3497
|
r[e.name.slice(13)] = e; else {
|
|
3480
|
-
if ("POSITION"
|
|
3481
|
-
const t = [ 1 / 0, 1 / 0, 1 / 0 ], n = [ -1 / 0, -1 / 0, -1 / 0 ], {itemSize: r, array: s} = e;
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
r < t[0] && (t[0] = r), i < t[1] && (t[1] = i), o < t[2] && (t[2] = o), r > n[0] && (n[0] = r),
|
|
3486
|
-
i > n[1] && (n[1] = i), o > n[2] && (n[2] = o);
|
|
3498
|
+
if (!("POSITION" !== e.name || e.min && e.max)) {
|
|
3499
|
+
const t = [ 1 / 0, 1 / 0, 1 / 0 ], n = [ -1 / 0, -1 / 0, -1 / 0 ], {itemSize: r, array: s} = e, i = s.length / r;
|
|
3500
|
+
for (let e = 0; e < i; e++) for (let i = 0; i < r; i++) {
|
|
3501
|
+
const o = e * r + i;
|
|
3502
|
+
s[o] < t[i] && (t[i] = s[o]), s[o] > n[i] && (n[i] = s[o]);
|
|
3487
3503
|
}
|
|
3488
3504
|
e.min = t, e.max = n;
|
|
3489
3505
|
}
|
|
@@ -3499,12 +3515,12 @@
|
|
|
3499
3515
|
});
|
|
3500
3516
|
}
|
|
3501
3517
|
}
|
|
3502
|
-
function
|
|
3518
|
+
function Et(t, e) {
|
|
3503
3519
|
const n = new Image;
|
|
3504
3520
|
n.crossOrigin = "", n.onload = () => {
|
|
3505
|
-
if (!
|
|
3506
|
-
|
|
3507
|
-
const t =
|
|
3521
|
+
if (!It) return void e(new Error("There is no canvas to draw image!"));
|
|
3522
|
+
It.width = n.width, It.height = n.height;
|
|
3523
|
+
const t = It.getContext("2d");
|
|
3508
3524
|
t.drawImage(n, 0, 0, n.width, n.height);
|
|
3509
3525
|
const r = t.getImageData(0, 0, n.width, n.height), s = {
|
|
3510
3526
|
width: n.width,
|
|
@@ -3516,12 +3532,13 @@
|
|
|
3516
3532
|
e(t);
|
|
3517
3533
|
}, n.src = t;
|
|
3518
3534
|
}
|
|
3519
|
-
let
|
|
3520
|
-
function
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
Bt.width = n,
|
|
3524
|
-
|
|
3535
|
+
let Pt, Lt;
|
|
3536
|
+
function Ut(t, e) {
|
|
3537
|
+
Pt || (Pt = new OffscreenCanvas(2, 2), Lt = Pt.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
|
|
3538
|
+
let {width: n, height: r} = t;
|
|
3539
|
+
Bt(n) || (n = Ct(n)), Bt(r) || (r = Ct(r)), Pt.width = n, Pt.height = r, Lt.drawImage(t, 0, 0, n, r),
|
|
3540
|
+
t.close();
|
|
3541
|
+
const s = Lt.getImageData(0, 0, n, r);
|
|
3525
3542
|
e(null, {
|
|
3526
3543
|
width: n,
|
|
3527
3544
|
height: r,
|
|
@@ -3531,6 +3548,12 @@
|
|
|
3531
3548
|
console.warn(t), e(t);
|
|
3532
3549
|
});
|
|
3533
3550
|
}
|
|
3551
|
+
function Bt(t) {
|
|
3552
|
+
return 0 == (t & t - 1) && 0 !== t;
|
|
3553
|
+
}
|
|
3554
|
+
function Ct(t) {
|
|
3555
|
+
return Math.pow(2, Math.floor(Math.log(t) / Math.LN2));
|
|
3556
|
+
}
|
|
3534
3557
|
const Rt = "undefined" == typeof document ? null : document.createElement("canvas");
|
|
3535
3558
|
class Ft extends s.worker.Actor {
|
|
3536
3559
|
constructor(t, e) {
|
|
@@ -3721,7 +3744,7 @@
|
|
|
3721
3744
|
}
|
|
3722
3745
|
function Gt(t, e, n) {
|
|
3723
3746
|
let {componentType: r, byteOffset: s, byteStride: i, itemSize: o} = e;
|
|
3724
|
-
const a = e.array.buffer, c = r ?
|
|
3747
|
+
const a = e.array.buffer, c = r ? Nt.getTypedArrayCtor(r) : e.array.constructor;
|
|
3725
3748
|
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) {
|
|
3726
3749
|
const e = new c(a, s + n * o * c.BYTES_PER_ELEMENT, o);
|
|
3727
3750
|
return t.set(e), t;
|
|
@@ -3745,25 +3768,25 @@
|
|
|
3745
3768
|
return t[0] = e[0] + n[0], t[1] = e[1] + n[1], t[2] = e[2] + n[2], t;
|
|
3746
3769
|
}(t, $t, qt);
|
|
3747
3770
|
}
|
|
3748
|
-
const Xt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Wt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Zt = new Array(3),
|
|
3771
|
+
const Xt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Wt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Zt = new Array(3), Qt = new Array(3), Yt = new Array(3);
|
|
3749
3772
|
function te(t, e) {
|
|
3750
3773
|
const n = Wt, r = function(t, e, n, r, s) {
|
|
3751
3774
|
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(ee, e, y);
|
|
3752
3775
|
if (m < s) return isFinite(y) ? b : void 0;
|
|
3753
3776
|
const p = r[0], w = r[1], _ = r[2], g = ne;
|
|
3754
3777
|
g[0] = b[0] * p * 2, g[1] = b[1] * w * 2, g[2] = b[2] * _ * 2;
|
|
3755
|
-
let T, A, O, v, M, S, x, I, N, E, P, L = (1 - y) * re(e) / (.5 * re(g)),
|
|
3778
|
+
let T, A, O, v, M, S, x, I, N, E, P, L = (1 - y) * re(e) / (.5 * re(g)), U = 0;
|
|
3756
3779
|
do {
|
|
3757
|
-
L -=
|
|
3780
|
+
L -= U, O = 1 / (1 + L * p), v = 1 / (1 + L * w), M = 1 / (1 + L * _), S = O * O,
|
|
3758
3781
|
x = v * v, I = M * M, N = S * O, E = x * v, P = I * M, T = f * S + l * x + d * I - 1,
|
|
3759
3782
|
A = f * N * p + l * E * w + d * P * _;
|
|
3760
|
-
|
|
3783
|
+
U = T / (-2 * A);
|
|
3761
3784
|
} while (Math.abs(T) > 1e-12);
|
|
3762
3785
|
return t[0] = i * O, t[1] = o * v, t[2] = a * M, t;
|
|
3763
3786
|
}(Zt, e, Xt, n, .1);
|
|
3764
|
-
let s = V(
|
|
3787
|
+
let s = V(Qt, r, n);
|
|
3765
3788
|
s = se(s, s);
|
|
3766
|
-
const i = j(
|
|
3789
|
+
const i = j(Yt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = _(k(i, e)) * re(i);
|
|
3767
3790
|
return t[0] = p(o), t[1] = p(a), t[2] = c, t;
|
|
3768
3791
|
}
|
|
3769
3792
|
const ee = new Array(3), ne = new Array(3);
|
|
@@ -3970,32 +3993,33 @@
|
|
|
3970
3993
|
north: "up",
|
|
3971
3994
|
south: "down"
|
|
3972
3995
|
}
|
|
3973
|
-
}[Ne = "east"][Ee = "north"], ge[
|
|
3974
|
-
if (
|
|
3975
|
-
|
|
3996
|
+
}[Ne = "east"][Ee = "north"], ge[Ue = Ne + Ee] ? Pe = ge[Ue] : (Pe = function(t, e, n) {
|
|
3997
|
+
if (function(t, e) {
|
|
3998
|
+
var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
|
|
3999
|
+
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));
|
|
4000
|
+
}(t, Me)) U(Ae, _e[Ne]), U(Oe, _e[Ee]), U(ve, _e[Le]); else if (Se(t[0], 0, 1e-14) && Se(t[1], 0, 1e-14)) {
|
|
3976
4001
|
var r = _(t[2]);
|
|
3977
|
-
|
|
3978
|
-
|
|
4002
|
+
U(Ae, _e[Ne]), "east" !== Ne && "west" !== Ne && F(Ae, Ae, r), U(Oe, _e[Ee]), "east" !== Ee && "west" !== Ee && F(Oe, Oe, r),
|
|
4003
|
+
U(ve, _e[Le]), "east" !== Le && "west" !== Le && F(ve, ve, r);
|
|
3979
4004
|
} else {
|
|
3980
4005
|
ie(t, Te.up);
|
|
3981
4006
|
var s = Te.up, i = Te.east;
|
|
3982
4007
|
i[0] = -t[1], i[1] = t[0], i[2] = 0, D(Te.east, i), z(Te.north, s, i), F(Te.down, Te.up, -1),
|
|
3983
4008
|
F(Te.west, Te.east, -1), F(Te.south, Te.north, -1), Ae = Te[Ne], Oe = Te[Ee], ve = Te[Le];
|
|
3984
4009
|
}
|
|
3985
|
-
var o, a, c, h, u, f, l, d;
|
|
3986
4010
|
return n[0] = Ae[0], n[1] = Ae[1], n[2] = Ae[2], n[3] = 0, n[4] = Oe[0], n[5] = Oe[1],
|
|
3987
4011
|
n[6] = Oe[2], n[7] = 0, n[8] = ve[0], n[9] = ve[1], n[10] = ve[2], n[11] = 0, n[12] = t[0],
|
|
3988
4012
|
n[13] = t[1], n[14] = t[2], n[15] = 1, n;
|
|
3989
|
-
}, ge[
|
|
3990
|
-
var Ne, Ee, Pe, Le,
|
|
3991
|
-
const
|
|
4013
|
+
}, ge[Ue] = Pe), Pe);
|
|
4014
|
+
var Ne, Ee, Pe, Le, Ue;
|
|
4015
|
+
const Be = [], Ce = [], Re = [], Fe = [], De = [], ke = [], ze = [], je = {
|
|
3992
4016
|
x: 0,
|
|
3993
4017
|
y: 0
|
|
3994
4018
|
}, Ve = {
|
|
3995
4019
|
x: 0,
|
|
3996
4020
|
y: 0
|
|
3997
4021
|
}, Ge = Math.PI / 180;
|
|
3998
|
-
const {getTextureMagFilter: He, getTextureMinFilter: qe, getTextureWrap: $e, getMaterialType: Je, getMaterialFormat: Ke, getPrimitive: Xe, getUniqueREGLBuffer: We} = n.reshader.REGLHelper, Ze = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ],
|
|
4022
|
+
const {getTextureMagFilter: He, getTextureMinFilter: qe, getTextureWrap: $e, getMaterialType: Je, getMaterialFormat: Ke, getPrimitive: Xe, getUniqueREGLBuffer: We} = n.reshader.REGLHelper, Ze = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Qe = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], {loginIBLResOnCanvas: Ye, logoutIBLResOnCanvas: tn, getIBLResOnCanvas: en, getPBRUniforms: nn} = n.reshader.pbr.PBRUtils, rn = {
|
|
3999
4023
|
factor: 0,
|
|
4000
4024
|
units: 0
|
|
4001
4025
|
}, sn = {
|
|
@@ -4012,7 +4036,7 @@
|
|
|
4012
4036
|
class bn {
|
|
4013
4037
|
constructor(t, e) {
|
|
4014
4038
|
this.Nt = e, this.Et = e.getRenderer().canvas, this.Pt = new s.SpatialReference,
|
|
4015
|
-
this.Lt = t, this.
|
|
4039
|
+
this.Lt = t, this.Ut = new n.reshader.Renderer(t), this.Bt = {}, this.Ct = {}, this.Rt = {},
|
|
4016
4040
|
this.Ft = {}, this.Dt = {}, this.kt = {}, this.zt = {}, this.jt = new n.reshader.Scene,
|
|
4017
4041
|
this.Vt = new n.reshader.Scene, this.Gt = new n.reshader.Scene, this.Ht = new n.reshader.Scene,
|
|
4018
4042
|
this.qt = new n.reshader.ResourceLoader(t.texture(2)), this.$t = this.Jt.bind(this),
|
|
@@ -4035,10 +4059,10 @@
|
|
|
4035
4059
|
paint(t, e, n, r) {
|
|
4036
4060
|
const s = this.getMap();
|
|
4037
4061
|
if (!t.length || !s) return;
|
|
4038
|
-
const i = this.
|
|
4062
|
+
const i = this.Qt(), o = s.projViewMatrix, a = this.Nt.options.services, h = [];
|
|
4039
4063
|
let u = [];
|
|
4040
4064
|
for (let n = 0, r = t.length; n < r; n++) {
|
|
4041
|
-
let r = this.
|
|
4065
|
+
let r = this.Yt(t[n].data.node);
|
|
4042
4066
|
if (!r) {
|
|
4043
4067
|
if (r = this.kt[t[n].data.node.id], !r) continue;
|
|
4044
4068
|
r = O(r);
|
|
@@ -4059,23 +4083,23 @@
|
|
|
4059
4083
|
const l = this.Wt.getExcludeFilter();
|
|
4060
4084
|
f += this.ne(this.re, i, [ n, cn, l ], r, h, u), f += this.ne(this.se, i, [ n, hn, l ], r, h, u),
|
|
4061
4085
|
this.Wt.forEachShader((t, e, s) => {
|
|
4062
|
-
const i = this.
|
|
4086
|
+
const i = this.Qt(s);
|
|
4063
4087
|
f += this.ne(t, i, [ n, e ], r, h, u);
|
|
4064
4088
|
});
|
|
4065
4089
|
const d = [];
|
|
4066
4090
|
for (const t in this.Ft) d.push(this.Ft[t]);
|
|
4067
4091
|
this.Vt.setMeshes(d);
|
|
4068
4092
|
const m = this.ie();
|
|
4069
|
-
return f += this.
|
|
4093
|
+
return f += this.Ut.render(this.oe, m, this.Vt, r && r.fbo), f;
|
|
4070
4094
|
}
|
|
4071
4095
|
ne(t, e, n, r, s, i) {
|
|
4072
4096
|
t.filter = n.filter(t => !!t), e.debug = !1, this.jt.setMeshes(s), e.stencilEnable = !1,
|
|
4073
4097
|
e.debug = !1, e.cullFace = "back", e.colorMask = un;
|
|
4074
4098
|
let o = 0;
|
|
4075
|
-
this.jt.setMeshes(i), o += this.
|
|
4099
|
+
this.jt.setMeshes(i), o += this.Ut.render(t, e, this.jt, r && r.fbo), e.stencilEnable = !1;
|
|
4076
4100
|
const a = [];
|
|
4077
4101
|
for (const t in this.Dt) a.push(...this.Dt[t]);
|
|
4078
|
-
return this.Gt.setMeshes(a), o += this.
|
|
4102
|
+
return this.Gt.setMeshes(a), o += this.Ut.render(t, e, this.Gt, r && r.fbo), o;
|
|
4079
4103
|
}
|
|
4080
4104
|
ae(t, e) {
|
|
4081
4105
|
return e.ee.ce - t.ee.ce;
|
|
@@ -4090,7 +4114,7 @@
|
|
|
4090
4114
|
}
|
|
4091
4115
|
this.ue.filter = r, this.Ht.setMeshes(a);
|
|
4092
4116
|
const h = this.fe(n);
|
|
4093
|
-
this.
|
|
4117
|
+
this.Ut.render(this.ue, h, this.Ht, s && s.fbo);
|
|
4094
4118
|
}
|
|
4095
4119
|
deleteTile(t) {
|
|
4096
4120
|
const e = t.node.id;
|
|
@@ -4099,9 +4123,9 @@
|
|
|
4099
4123
|
le(t) {
|
|
4100
4124
|
const e = this.Ct[t];
|
|
4101
4125
|
e && (e.geometry.dispose(), e.dispose(), delete this.Ct[t]);
|
|
4102
|
-
let n = this.Rt[t] || this.Ft[t] || this.Dt[t] || this.kt[t] || this.
|
|
4126
|
+
let n = this.Rt[t] || this.Ft[t] || this.Dt[t] || this.kt[t] || this.Bt[t];
|
|
4103
4127
|
this.kt[t] ? this.de(t) : n && (this.me(n), delete this.Rt[t], delete this.Ft[t],
|
|
4104
|
-
delete this.Dt[t], delete this.
|
|
4128
|
+
delete this.Dt[t], delete this.Bt[t]);
|
|
4105
4129
|
}
|
|
4106
4130
|
de(t) {
|
|
4107
4131
|
let e = this.kt[t];
|
|
@@ -4134,8 +4158,8 @@
|
|
|
4134
4158
|
this.Ft = {};
|
|
4135
4159
|
for (const t in this.Dt) this.le(t);
|
|
4136
4160
|
this.Dt = {};
|
|
4137
|
-
for (const t in this.
|
|
4138
|
-
this.
|
|
4161
|
+
for (const t in this.Bt) this.le(t);
|
|
4162
|
+
this.Bt = {};
|
|
4139
4163
|
for (const t in this.Ct) this.le(t);
|
|
4140
4164
|
this.Ct = {}, this.re && (this.re.dispose(), delete this.re), this.se && (this.se.dispose(),
|
|
4141
4165
|
delete this.se), this.oe && (this.oe.dispose(), delete this.oe), this.ue && (this.ue.dispose(),
|
|
@@ -4159,11 +4183,11 @@
|
|
|
4159
4183
|
return l.setLocalTransform(n.mat4.translate(d, d, [ o.x, o.y, 0 ])), this.Ct[t.id] = l,
|
|
4160
4184
|
l;
|
|
4161
4185
|
}
|
|
4162
|
-
|
|
4186
|
+
Yt(t) {
|
|
4163
4187
|
return this.Rt[t.id];
|
|
4164
4188
|
}
|
|
4165
4189
|
has(t) {
|
|
4166
|
-
return this.
|
|
4190
|
+
return this.Yt(t) || this.Ft[t.id] || this.Dt[t.id] || this.kt[t.id] || this.Bt[t.id];
|
|
4167
4191
|
}
|
|
4168
4192
|
createPntsMesh(t, e, r, s) {
|
|
4169
4193
|
if (this.Ft[e]) {
|
|
@@ -4211,7 +4235,7 @@
|
|
|
4211
4235
|
createI3DMMesh(t, e, r, s) {
|
|
4212
4236
|
if (this.Dt[e]) {
|
|
4213
4237
|
const t = this.Dt[e];
|
|
4214
|
-
return console.warn(`i3dm mesh with id(${e}) was already created.`), this.
|
|
4238
|
+
return console.warn(`i3dm mesh with id(${e}) was already created.`), this.Bt[e] || s(null, {
|
|
4215
4239
|
id: e,
|
|
4216
4240
|
mesh: t
|
|
4217
4241
|
}), t;
|
|
@@ -4220,10 +4244,10 @@
|
|
|
4220
4244
|
"instance_vectorA": new Float32Array(4 * l),
|
|
4221
4245
|
"instance_vectorB": new Float32Array(4 * l),
|
|
4222
4246
|
"instance_vectorC": new Float32Array(4 * l)
|
|
4223
|
-
}, M = new Float32Array(3), S = new Float32Array(3), x = [], I = new Float32Array(1), N = new Float32Array(3), E = [], P = [], L = [],
|
|
4247
|
+
}, M = new Float32Array(3), S = new Float32Array(3), x = [], I = new Float32Array(1), N = new Float32Array(3), E = [], P = [], L = [], U = [], B = new Float32Array(9);
|
|
4224
4248
|
!function(t, e) {
|
|
4225
4249
|
let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
|
|
4226
|
-
const a = t.array.buffer, c = n ?
|
|
4250
|
+
const a = t.array.buffer, c = n ? Nt.getTypedArrayCtor(n) : t.array.constructor;
|
|
4227
4251
|
if (r = void 0 === r ? t.array.byteOffset : r, s = s || 0, i = i || t.array.length / o,
|
|
4228
4252
|
(!s || s === o * c.BYTES_PER_ELEMENT) && r % c.BYTES_PER_ELEMENT == 0) {
|
|
4229
4253
|
const t = new c(a, r, i * o);
|
|
@@ -4241,10 +4265,10 @@
|
|
|
4241
4265
|
}
|
|
4242
4266
|
}(p, (t, e) => {
|
|
4243
4267
|
w ? (Gt(S, _, e), Gt(M, w, e), n.vec3.cross(x, S, M), n.vec3.normalize(x, x), A(E, S, 0),
|
|
4244
|
-
A(E, M, 1), A(E, x, 2), n.quat.fromMat3(P, E)) : O ? (Gt(
|
|
4268
|
+
A(E, M, 1), A(E, x, 2), n.quat.fromMat3(P, E)) : O ? (Gt(B, O, e), n.quat.fromMat3(P, B)) : n.quat.identity(P),
|
|
4245
4269
|
g ? (Gt(I, g, e), n.vec3.set(L, I[0], I[0], I[0])) : T ? (Gt(N, T, e), n.vec3.set(L, ...N)) : n.vec3.set(L, 1, 1, 1),
|
|
4246
|
-
n.mat4.fromRotationTranslationScale(
|
|
4247
|
-
Ht(v.instance_vectorB, e,
|
|
4270
|
+
n.mat4.fromRotationTranslationScale(U, P, t, L), Ht(v.instance_vectorA, e, U, 0),
|
|
4271
|
+
Ht(v.instance_vectorB, e, U, 1), Ht(v.instance_vectorC, e, U, 2);
|
|
4248
4272
|
});
|
|
4249
4273
|
const C = {};
|
|
4250
4274
|
for (const t in v) C[t] = {
|
|
@@ -4273,15 +4297,15 @@
|
|
|
4273
4297
|
}), D ? (this.Dt[e] = k, s(null, {
|
|
4274
4298
|
id: e,
|
|
4275
4299
|
mesh: k
|
|
4276
|
-
})) : (this.
|
|
4300
|
+
})) : (this.Bt[e] = {
|
|
4277
4301
|
meshes: k,
|
|
4278
4302
|
count: F
|
|
4279
4303
|
}, k.ve = s), k;
|
|
4280
4304
|
}
|
|
4281
4305
|
createB3DMMesh(t, e, r, i) {
|
|
4282
|
-
if (this.Rt[e] || this.
|
|
4306
|
+
if (this.Rt[e] || this.Bt[e]) {
|
|
4283
4307
|
const t = this.Rt[e];
|
|
4284
|
-
return console.warn(`mesh with id(${e}) was already created.`), this.
|
|
4308
|
+
return console.warn(`mesh with id(${e}) was already created.`), this.Bt[e] || i(null, {
|
|
4285
4309
|
id: e,
|
|
4286
4310
|
mesh: t
|
|
4287
4311
|
}), t;
|
|
@@ -4311,7 +4335,7 @@
|
|
|
4311
4335
|
}), b ? (this.Rt[e] = m, i(null, {
|
|
4312
4336
|
id: e,
|
|
4313
4337
|
mesh: m
|
|
4314
|
-
})) : (this.
|
|
4338
|
+
})) : (this.Bt[e] = {
|
|
4315
4339
|
meshes: m,
|
|
4316
4340
|
count: y
|
|
4317
4341
|
}, m.ve = i), m;
|
|
@@ -4323,12 +4347,12 @@
|
|
|
4323
4347
|
xe(h, n.vec3.transformMat4(fn, e, h), h);
|
|
4324
4348
|
}
|
|
4325
4349
|
const u = function(t, e, n, r, s, i, o) {
|
|
4326
|
-
e =
|
|
4327
|
-
const a = Kt(
|
|
4350
|
+
e = U(Be, e);
|
|
4351
|
+
const a = Kt(Be, e[0] * Ge, e[1] * Ge, e[2]), c = function(t, e) {
|
|
4328
4352
|
return t[0] = e[12], t[1] = e[13], t[2] = e[14], t;
|
|
4329
4353
|
}(Ce, n), h = r.ellipsoid;
|
|
4330
4354
|
var u;
|
|
4331
|
-
u = 0 === G(c) ?
|
|
4355
|
+
u = 0 === G(c) ? B(Re, 0, 0, -6378137) : te(Re, c), je.x = u[0], je.y = u[1];
|
|
4332
4356
|
const f = r.project(je, Ve);
|
|
4333
4357
|
Fe[0] = f.x / s, Fe[1] = f.y / s, Fe[2] = (u[2] + o) * i;
|
|
4334
4358
|
const l = Ie(a, h, De), d = function(t, e, n) {
|
|
@@ -4350,7 +4374,7 @@
|
|
|
4350
4374
|
}(ze, n), t);
|
|
4351
4375
|
return xe(t, Fe, d), t;
|
|
4352
4376
|
}(h, r, h, i.getProjection(), i.getGLRes(), c, o), f = function(t, e) {
|
|
4353
|
-
return
|
|
4377
|
+
return B(t, e[12], e[13], e[14]), t;
|
|
4354
4378
|
}(mn, u);
|
|
4355
4379
|
let l = this.Nt.options.offset;
|
|
4356
4380
|
if (y(l)) {
|
|
@@ -4508,7 +4532,7 @@
|
|
|
4508
4532
|
extraCommandProps: s
|
|
4509
4533
|
});
|
|
4510
4534
|
const i = this.Nt;
|
|
4511
|
-
|
|
4535
|
+
Ye(i.getRenderer().canvas, this.Lt, i.getMap());
|
|
4512
4536
|
}
|
|
4513
4537
|
Zt() {
|
|
4514
4538
|
return {
|
|
@@ -4568,7 +4592,7 @@
|
|
|
4568
4592
|
lightDir: n.vec3.normalize(s, s)
|
|
4569
4593
|
};
|
|
4570
4594
|
}
|
|
4571
|
-
|
|
4595
|
+
Qt() {
|
|
4572
4596
|
const t = this.getMap(), e = this.Nt.getRenderer().canvas, {iblTexes: n, dfgLUT: r} = en(e), s = nn(t, n, r);
|
|
4573
4597
|
return m(s, {
|
|
4574
4598
|
lightSpecular: [ 1, 1, 1 ],
|
|
@@ -4639,10 +4663,10 @@
|
|
|
4639
4663
|
return n.createObjectURL(r);
|
|
4640
4664
|
}
|
|
4641
4665
|
Jt({target: t}) {
|
|
4642
|
-
const e = t.Ne, n = this.
|
|
4666
|
+
const e = t.Ne, n = this.Bt[e];
|
|
4643
4667
|
if (n.count--, !n.count) {
|
|
4644
4668
|
const t = n.meshes;
|
|
4645
|
-
this.Rt[e] = t, delete this.
|
|
4669
|
+
this.Rt[e] = t, delete this.Bt[e];
|
|
4646
4670
|
const r = t.ve;
|
|
4647
4671
|
delete t.ve, r(null, {
|
|
4648
4672
|
mesh: n.meshes,
|
|
@@ -4669,16 +4693,16 @@
|
|
|
4669
4693
|
return e.getGLZoom ? e._prjToPoint(t, e.getGLZoom()) : e._prjToPointAtRes(t, e.getGLRes());
|
|
4670
4694
|
}
|
|
4671
4695
|
ge(t) {
|
|
4672
|
-
return "Y" === t ? Ze : "X" === t ?
|
|
4696
|
+
return "Y" === t ? Ze : "X" === t ? Qe : an;
|
|
4673
4697
|
}
|
|
4674
4698
|
}
|
|
4675
4699
|
class pn extends s.renderer.CanvasRenderer {
|
|
4676
4700
|
constructor(t) {
|
|
4677
4701
|
super(t), this.prepareWorker(), this.tilesLoading = {}, this.tileCache = new zt(1024 * t.options.maxGPUMemory * 1024, this.deleteTile.bind(this)),
|
|
4678
|
-
this.bt = {};
|
|
4702
|
+
this.bt = {}, this.Le = [];
|
|
4679
4703
|
}
|
|
4680
4704
|
needToRedraw() {
|
|
4681
|
-
return !!this.getMap().isInteracting() || super.needToRedraw();
|
|
4705
|
+
return !!this.getMap().isInteracting() || (!!this.Le.length || super.needToRedraw());
|
|
4682
4706
|
}
|
|
4683
4707
|
drawOnInteracting(t, e, n) {
|
|
4684
4708
|
this.draw(e, n);
|
|
@@ -4686,32 +4710,33 @@
|
|
|
4686
4710
|
draw(t, e) {
|
|
4687
4711
|
const n = this.prepareCanvas();
|
|
4688
4712
|
if (n && !n.intersects(this.canvasExtent2D)) return void this.completeRender();
|
|
4689
|
-
const {root: r, tiles: s} = this.layer.getTiles(), i = s
|
|
4713
|
+
const {root: r, tiles: s} = this.layer.getTiles(), i = s.length;
|
|
4690
4714
|
if (!s || !i) return void this.completeRender();
|
|
4691
|
-
|
|
4692
|
-
|
|
4715
|
+
this.Ue();
|
|
4716
|
+
const {selectedTiles: o, leaves: a, requests: c} = this.Be(r, s);
|
|
4717
|
+
c.length && this.loadTiles(c), this.Ce(o, a, e), this.Re(), c.length || this.completeRender();
|
|
4693
4718
|
}
|
|
4694
|
-
|
|
4719
|
+
Be(t, e) {
|
|
4695
4720
|
let n = [];
|
|
4696
|
-
this.
|
|
4721
|
+
this.Fe();
|
|
4697
4722
|
let r = 0;
|
|
4698
|
-
const s = this.
|
|
4723
|
+
const s = this.De(), i = {};
|
|
4699
4724
|
let o = !1, a = !1;
|
|
4700
|
-
for (
|
|
4725
|
+
for (let t = 0; t < e.length; t++) {
|
|
4701
4726
|
const s = e[t], c = s.node;
|
|
4702
4727
|
if (i[c.id]) continue;
|
|
4703
4728
|
i[c.id] = 1;
|
|
4704
4729
|
let h = !1;
|
|
4705
|
-
const u = this.
|
|
4706
|
-
if (this.
|
|
4730
|
+
const u = this.ke(c.id);
|
|
4731
|
+
if (this.ze(c.id) ? (r++, h = a = !0, this.tilesLoading[c.id].current = !0) : u ? (this.getTileOpacity(u) < 1 && (h = a = !0),
|
|
4707
4732
|
o = !0, s.selected = !0, s.data = u) : this.painter.has(c) || (h = a = !0, n.push(c)),
|
|
4708
4733
|
!h) continue;
|
|
4709
|
-
if (this.
|
|
4710
|
-
this.
|
|
4734
|
+
if (this.je(s)) o = !0; else {
|
|
4735
|
+
this.Ve(s).length && (o = !0);
|
|
4711
4736
|
}
|
|
4712
4737
|
}
|
|
4713
4738
|
let c = [], h = {};
|
|
4714
|
-
if (o && ({selectedTiles: c, leaves: h} = this.
|
|
4739
|
+
if (o && ({selectedTiles: c, leaves: h} = this.Ge(t)), n.length > 1 && (n.sort(wn),
|
|
4715
4740
|
s)) {
|
|
4716
4741
|
const t = s - r;
|
|
4717
4742
|
n = t > 0 ? n.slice(0, t) : [];
|
|
@@ -4723,14 +4748,14 @@
|
|
|
4723
4748
|
leaves: h
|
|
4724
4749
|
};
|
|
4725
4750
|
}
|
|
4726
|
-
|
|
4751
|
+
Ge(t) {
|
|
4727
4752
|
const e = [], n = {};
|
|
4728
4753
|
let r;
|
|
4729
4754
|
const s = [ t ], i = [];
|
|
4730
4755
|
for (;s.length > 0 || i.length > 0; ) {
|
|
4731
4756
|
if (i.length > 0) {
|
|
4732
4757
|
const t = i[i.length - 1];
|
|
4733
|
-
if (t.
|
|
4758
|
+
if (t.He === s.length) {
|
|
4734
4759
|
i.pop(), t === r && (t.leave = !0, n[t.node.id] = 1), e.push(t);
|
|
4735
4760
|
continue;
|
|
4736
4761
|
}
|
|
@@ -4742,9 +4767,8 @@
|
|
|
4742
4767
|
t.leave = !0, n[t.node.id] = 1, e.push(t);
|
|
4743
4768
|
continue;
|
|
4744
4769
|
}
|
|
4745
|
-
i.push(t), t.
|
|
4770
|
+
i.push(t), t.He = s.length;
|
|
4746
4771
|
}
|
|
4747
|
-
o.length > 1 && o.sort(wn);
|
|
4748
4772
|
for (let t = 0; t < o.length; t++) s.push(o[t]);
|
|
4749
4773
|
}
|
|
4750
4774
|
return {
|
|
@@ -4752,7 +4776,7 @@
|
|
|
4752
4776
|
leaves: n
|
|
4753
4777
|
};
|
|
4754
4778
|
}
|
|
4755
|
-
|
|
4779
|
+
je(t) {
|
|
4756
4780
|
if (!t.parent) return null;
|
|
4757
4781
|
let e = t.parent;
|
|
4758
4782
|
for (;e && e.level >= 0; ) {
|
|
@@ -4763,27 +4787,27 @@
|
|
|
4763
4787
|
}
|
|
4764
4788
|
return null;
|
|
4765
4789
|
}
|
|
4766
|
-
|
|
4790
|
+
Ve(t) {
|
|
4767
4791
|
const e = [];
|
|
4768
4792
|
if (!t.node.children || !t.node.children.length) return e;
|
|
4769
|
-
const n = t.
|
|
4793
|
+
const n = t.qe + 1, r = [ t.node ];
|
|
4770
4794
|
for (;r.length > 0; ) {
|
|
4771
4795
|
const s = r.pop().children;
|
|
4772
4796
|
for (let i = 0, o = s.length; i < o; i++) {
|
|
4773
|
-
if (!
|
|
4797
|
+
if ((!s[i].content || !s[i].content.url) && s[i].children && s[i].children.length) {
|
|
4774
4798
|
r.push(s[i]);
|
|
4775
4799
|
continue;
|
|
4776
4800
|
}
|
|
4777
4801
|
const o = s[i].id;
|
|
4778
4802
|
if (this.tileCache.has(o)) {
|
|
4779
|
-
const n = this.layer
|
|
4803
|
+
const n = this.layer.$e(s[i], t);
|
|
4780
4804
|
n.selected = !0, n.data = this.tileCache.get(o), t.children.push(n), e.push(n);
|
|
4781
|
-
} else s[i].
|
|
4805
|
+
} else s[i].qe <= n && r.push(s[i]);
|
|
4782
4806
|
}
|
|
4783
4807
|
}
|
|
4784
4808
|
return e;
|
|
4785
4809
|
}
|
|
4786
|
-
|
|
4810
|
+
Ce(t, e, n) {
|
|
4787
4811
|
this.tileCache.markAll(!1);
|
|
4788
4812
|
for (let e = 0, n = t.length; e < n; e++) {
|
|
4789
4813
|
const n = t[e].data;
|
|
@@ -4817,23 +4841,23 @@
|
|
|
4817
4841
|
let e = t.content.url;
|
|
4818
4842
|
if (M(e)) {
|
|
4819
4843
|
const n = S(e);
|
|
4820
|
-
return void this
|
|
4844
|
+
return void this.Je(e, n, t);
|
|
4821
4845
|
}
|
|
4822
4846
|
t && -1 === e.indexOf("http://") && -1 === e.indexOf("https://") && (e = t.baseUrl + e);
|
|
4823
4847
|
const n = this.layer.options.services[t.te];
|
|
4824
4848
|
if (n.ajaxInMainThread) {
|
|
4825
4849
|
let r = n.urlParams;
|
|
4826
4850
|
r && (r = (e.indexOf("?") > 0 ? "&" : "?") + r);
|
|
4827
|
-
let s = ft.getArrayBuffer(e + (r || ""), n.
|
|
4851
|
+
let s = ft.getArrayBuffer(e + (r || ""), n.fetchOptions);
|
|
4828
4852
|
const i = s.xhr;
|
|
4829
4853
|
s = s.then(n => {
|
|
4830
|
-
delete this.bt[e], n ? this
|
|
4854
|
+
delete this.bt[e], n ? this.Je(e, n.data, t) : this.onTileError(null, t);
|
|
4831
4855
|
}).catch(n => {
|
|
4832
4856
|
delete this.bt[e], this.onTileError(n, t);
|
|
4833
4857
|
}), this.bt[e] = i;
|
|
4834
|
-
} else this
|
|
4858
|
+
} else this.Je(e, null, t);
|
|
4835
4859
|
}
|
|
4836
|
-
|
|
4860
|
+
Je(t, e, r) {
|
|
4837
4861
|
let s = this.o;
|
|
4838
4862
|
s || (s = n.reshader.Util.getSupportedFormats(this.gl.gl || this.gl), this.o = s),
|
|
4839
4863
|
this.workerConn.loadTile(this.layer.getId(), {
|
|
@@ -4846,30 +4870,41 @@
|
|
|
4846
4870
|
}, (e, n) => {
|
|
4847
4871
|
if (e) return void this.onTileError(e, r);
|
|
4848
4872
|
const {magic: s} = n;
|
|
4849
|
-
"b3dm" === s
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
this.Je(n, r, t, e);
|
|
4853
|
-
}) : "i3dm" === s ? this.painter.createI3DMMesh(n, r.id, r, (t, {mesh: e}) => {
|
|
4854
|
-
this.Je(n, r, t, e);
|
|
4855
|
-
}) : "cmpt" === s ? this.painter.createCMPTMesh(n, r.id, r, (t, {mesh: e}) => {
|
|
4856
|
-
this.Je(n, r, t, e);
|
|
4873
|
+
"b3dm" === s || "pnts" === s || "i3dm" === s || "cmpt" === s ? this.Le.push({
|
|
4874
|
+
data: n,
|
|
4875
|
+
tile: r
|
|
4857
4876
|
}) : this.onTilesetLoad(n, r, t);
|
|
4858
4877
|
});
|
|
4859
4878
|
}
|
|
4860
|
-
|
|
4879
|
+
Ue() {
|
|
4880
|
+
const t = this.getMap(), e = this.layer.options.meshLimitPerFrame;
|
|
4881
|
+
let n = 0;
|
|
4882
|
+
for (;this.Le.length && (n < e || !t.isInteracting()); ) {
|
|
4883
|
+
const {data: t, tile: e} = this.Le.shift(), {magic: r} = t;
|
|
4884
|
+
"b3dm" === r ? this.painter.createB3DMMesh(t, e.id, e, (n, {mesh: r}) => {
|
|
4885
|
+
this.Ke(t, e, n, r);
|
|
4886
|
+
}) : "pnts" === r ? this.painter.createPntsMesh(t, e.id, e, (n, {mesh: r}) => {
|
|
4887
|
+
this.Ke(t, e, n, r);
|
|
4888
|
+
}) : "i3dm" === r ? this.painter.createI3DMMesh(t, e.id, e, (n, {mesh: r}) => {
|
|
4889
|
+
this.Ke(t, e, n, r);
|
|
4890
|
+
}) : "cmpt" === r && this.painter.createCMPTMesh(t, e.id, e, (n, {mesh: r}) => {
|
|
4891
|
+
this.Ke(t, e, n, r);
|
|
4892
|
+
}), n++;
|
|
4893
|
+
}
|
|
4894
|
+
}
|
|
4895
|
+
Ke(t, e, n, r) {
|
|
4861
4896
|
if (n) this.onTileError(n, e); else {
|
|
4862
|
-
const n = this.
|
|
4897
|
+
const n = this.Xe(r);
|
|
4863
4898
|
e.memorySize = n, this.onTileLoad(t, e);
|
|
4864
4899
|
}
|
|
4865
4900
|
}
|
|
4866
|
-
|
|
4901
|
+
Xe(t) {
|
|
4867
4902
|
let e = 0;
|
|
4868
|
-
if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.
|
|
4903
|
+
if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.Xe(t[n])); else t && (e += t.getMemorySize());
|
|
4869
4904
|
return e;
|
|
4870
4905
|
}
|
|
4871
4906
|
onTileLoad(t, e) {
|
|
4872
|
-
this.layer && (delete this.tilesLoading[e.id], this.
|
|
4907
|
+
this.layer && (delete this.tilesLoading[e.id], this.We(e), this.setToRedraw(), this.layer.fire("tileload", {
|
|
4873
4908
|
node: e
|
|
4874
4909
|
}));
|
|
4875
4910
|
}
|
|
@@ -4880,15 +4915,15 @@
|
|
|
4880
4915
|
if (!this.layer) return;
|
|
4881
4916
|
const n = e.content.url;
|
|
4882
4917
|
console.warn("failed to load 3d tile: " + n), console.warn(t), delete this.tilesLoading[e.id],
|
|
4883
|
-
this.
|
|
4918
|
+
this.We(e), this.setToRedraw(), this.layer.fire("tileerror", {
|
|
4884
4919
|
node: e,
|
|
4885
4920
|
error: t
|
|
4886
4921
|
});
|
|
4887
4922
|
}
|
|
4888
|
-
|
|
4923
|
+
ke(t) {
|
|
4889
4924
|
return this.tileCache.get(t);
|
|
4890
4925
|
}
|
|
4891
|
-
|
|
4926
|
+
We(t) {
|
|
4892
4927
|
const e = {
|
|
4893
4928
|
loadTime: s.Util.now(),
|
|
4894
4929
|
current: !0,
|
|
@@ -4905,7 +4940,7 @@
|
|
|
4905
4940
|
} else this.workerConn.abortTileLoading(this.layer.getId(), e);
|
|
4906
4941
|
delete this.bt[e];
|
|
4907
4942
|
}
|
|
4908
|
-
|
|
4943
|
+
Fe() {
|
|
4909
4944
|
if (this.tilesLoading) for (const t in this.tilesLoading) this.tilesLoading[t].current = !1;
|
|
4910
4945
|
}
|
|
4911
4946
|
deleteTile(t) {
|
|
@@ -4920,7 +4955,7 @@
|
|
|
4920
4955
|
antialias: t.options.antialias
|
|
4921
4956
|
};
|
|
4922
4957
|
this.canvas.gl && this.canvas.gl.wrap ? (this.gl = this.canvas.gl.wrap(), this.regl = this.canvas.gl.regl) : (this.glOptions = e,
|
|
4923
|
-
this.gl = this.
|
|
4958
|
+
this.gl = this.Ze(this.canvas, e)), this.regl = this.regl || n.createREGL({
|
|
4924
4959
|
gl: this.gl,
|
|
4925
4960
|
attributes: e,
|
|
4926
4961
|
extensions: [ "OES_element_index_uint", "WEBGL_compressed_texture_s3tc" ],
|
|
@@ -4947,7 +4982,7 @@
|
|
|
4947
4982
|
super.onRemove();
|
|
4948
4983
|
}
|
|
4949
4984
|
clear() {
|
|
4950
|
-
this.
|
|
4985
|
+
this.Re(!0), this.tileCache.reset(), this.tilesLoading = {}, super.clear();
|
|
4951
4986
|
}
|
|
4952
4987
|
clearCanvas() {
|
|
4953
4988
|
this.regl && this.regl.clear({
|
|
@@ -4962,22 +4997,21 @@
|
|
|
4962
4997
|
getStencilValue() {
|
|
4963
4998
|
return 0;
|
|
4964
4999
|
}
|
|
4965
|
-
|
|
4966
|
-
this.
|
|
5000
|
+
Re(t) {
|
|
5001
|
+
this.Qe || (this.Qe = Date.now());
|
|
4967
5002
|
const e = Date.now();
|
|
4968
|
-
if (t || !(e - this.
|
|
4969
|
-
this.
|
|
5003
|
+
if (t || !(e - this.Qe < this.layer.options.retireInterval)) {
|
|
5004
|
+
this.Qe = e;
|
|
4970
5005
|
for (const e in this.tilesLoading) {
|
|
4971
5006
|
const n = this.tilesLoading[e];
|
|
4972
|
-
!t && n.current ||
|
|
4973
|
-
delete this.tilesLoading[e]);
|
|
5007
|
+
!t && n.current || this.abortTileLoading(n);
|
|
4974
5008
|
}
|
|
4975
5009
|
}
|
|
4976
5010
|
}
|
|
4977
|
-
|
|
5011
|
+
De() {
|
|
4978
5012
|
return this.getMap().isInteracting() ? this.layer.options.loadingLimitOnInteracting : this.layer.options.loadingLimit;
|
|
4979
5013
|
}
|
|
4980
|
-
|
|
5014
|
+
Ze(t, e) {
|
|
4981
5015
|
const n = [ "webgl", "experimental-webgl" ];
|
|
4982
5016
|
let r = null;
|
|
4983
5017
|
for (let s = 0; s < n.length; ++s) {
|
|
@@ -4988,7 +5022,7 @@
|
|
|
4988
5022
|
}
|
|
4989
5023
|
return r;
|
|
4990
5024
|
}
|
|
4991
|
-
|
|
5025
|
+
ze(t) {
|
|
4992
5026
|
return !!this.tilesLoading[t];
|
|
4993
5027
|
}
|
|
4994
5028
|
getI3DMMeshes() {
|
|
@@ -5005,34 +5039,31 @@
|
|
|
5005
5039
|
}
|
|
5006
5040
|
}
|
|
5007
5041
|
function wn(t, e) {
|
|
5008
|
-
return
|
|
5042
|
+
return t.ce - e.ce;
|
|
5009
5043
|
}
|
|
5010
|
-
function _n(t, e) {
|
|
5011
|
-
return 0 === t.ce && 0 === e.ce ? t.Ye - e.Ye : t.ce - e.ce;
|
|
5012
|
-
}
|
|
5013
|
-
function gn(t, e, n) {
|
|
5044
|
+
function _n(t, e, n) {
|
|
5014
5045
|
return t[0] = e[n], t[1] = e[n + 3], t[2] = e[n + 6], t;
|
|
5015
5046
|
}
|
|
5016
|
-
function
|
|
5047
|
+
function gn(t, e, n) {
|
|
5017
5048
|
return Math.sqrt(function(t, e, n) {
|
|
5018
|
-
var r = C(
|
|
5049
|
+
var r = C(Tn, n, t), s = _n(An, e, 0), i = _n(On, e, 1), o = _n(vn, e, 2), a = G(s), c = G(i), h = G(o);
|
|
5019
5050
|
D(s, s), D(i, i), D(o, o);
|
|
5020
|
-
var u =
|
|
5021
|
-
u
|
|
5051
|
+
var u = Mn;
|
|
5052
|
+
u[0] = k(r, s), u[1] = k(r, i), u[2] = k(r, o);
|
|
5022
5053
|
var f, l = 0;
|
|
5023
|
-
u
|
|
5024
|
-
u
|
|
5025
|
-
u
|
|
5054
|
+
u[0] < -a ? (f = u[0] + a, l += f * f) : u[0] > a && (f = u[0] - a, l += f * f);
|
|
5055
|
+
u[1] < -c ? (f = u[1] + c, l += f * f) : u[1] > c && (f = u[1] - c, l += f * f);
|
|
5056
|
+
u[2] < -h ? (f = u[2] + h, l += f * f) : u[2] > h && (f = u[2] - h, l += f * f);
|
|
5026
5057
|
return l;
|
|
5027
5058
|
}(t, e, n));
|
|
5028
5059
|
}
|
|
5029
|
-
const
|
|
5030
|
-
const
|
|
5031
|
-
class
|
|
5060
|
+
const Tn = [], An = [], On = [], vn = [], Mn = [];
|
|
5061
|
+
const Sn = s.projection.EPSG3857, xn = new s.Extent(0, 0, 0, 0), In = new s.Extent(0, 0, 0, 0), Nn = [], En = [], Pn = [], Ln = [], Un = new s.Point(0, 0), Bn = new s.Coordinate(0, 0), Cn = new s.Coordinate(0, 0), Rn = [], Fn = new s.Coordinate(0, 0), Dn = n.mat4.identity([]);
|
|
5062
|
+
class kn extends s.Layer {
|
|
5032
5063
|
constructor(t, e) {
|
|
5033
|
-
super(t, e), this.
|
|
5064
|
+
super(t, e), this.Ye(), this.bt = {}, this.tn = [];
|
|
5034
5065
|
}
|
|
5035
|
-
|
|
5066
|
+
Ye() {
|
|
5036
5067
|
let t = this.options.services.map(t => t.url);
|
|
5037
5068
|
this.en = t.map((t, e) => function(t, e) {
|
|
5038
5069
|
t = w(t);
|
|
@@ -5044,7 +5075,7 @@
|
|
|
5044
5075
|
refine: "replace",
|
|
5045
5076
|
matrix: n.mat4.identity([]),
|
|
5046
5077
|
te: e,
|
|
5047
|
-
|
|
5078
|
+
qe: 0
|
|
5048
5079
|
};
|
|
5049
5080
|
}(t, e)), this.fire("rootready", {
|
|
5050
5081
|
roots: this.en.slice(0)
|
|
@@ -5062,7 +5093,7 @@
|
|
|
5062
5093
|
return this.en[t] && this.en[t].boundingVolume ? this.boundingVolumeToExtent(this.en[t]) : null;
|
|
5063
5094
|
}
|
|
5064
5095
|
boundingVolumeToExtent(t) {
|
|
5065
|
-
const e = t.boundingVolume.nn ?
|
|
5096
|
+
const e = t.boundingVolume.nn ? Dn : t.matrix, r = this.getMap();
|
|
5066
5097
|
if (t.boundingVolume.region) {
|
|
5067
5098
|
const e = t.boundingVolume.region;
|
|
5068
5099
|
return new s.Extent(p(e[0]), p(e[1]), p(e[2]), p(e[3]));
|
|
@@ -5083,54 +5114,53 @@
|
|
|
5083
5114
|
return this.en;
|
|
5084
5115
|
}
|
|
5085
5116
|
getTiles() {
|
|
5086
|
-
|
|
5087
|
-
tiles:
|
|
5088
|
-
}
|
|
5089
|
-
}
|
|
5090
|
-
rn() {
|
|
5117
|
+
if (!this.getRenderer().ready) return this.rn(), {
|
|
5118
|
+
tiles: Ln
|
|
5119
|
+
};
|
|
5091
5120
|
const t = this.getMap(), e = t.cameraPosition;
|
|
5092
5121
|
let r, s;
|
|
5093
|
-
if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()),
|
|
5094
|
-
r = t.pointToCoord(
|
|
5122
|
+
if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), Fn.set(e[0], e[1]),
|
|
5123
|
+
r = t.pointToCoord(Fn, t.getGLZoom()); else {
|
|
5095
5124
|
const n = t.getGLRes();
|
|
5096
|
-
s = t.pointAtResToDistance(e[2], 0, n),
|
|
5125
|
+
s = t.pointAtResToDistance(e[2], 0, n), Fn.set(e[0], e[1]), r = t.pointAtResToCoord(Fn, n);
|
|
5097
5126
|
}
|
|
5098
|
-
this.
|
|
5099
|
-
this.
|
|
5127
|
+
this.sn = this.sn || [], n.vec3.set(this.sn, b(r.x), b(r.y), s), this.in = Kt(this.in || [], this.sn[0], this.sn[1], this.sn[2]),
|
|
5128
|
+
this.an = 2 * Math.tan(.5 * b(t.getFov())), this.cn = Sn.project(r).toArray();
|
|
5100
5129
|
const i = t.projViewMatrix, o = {
|
|
5101
5130
|
children: [],
|
|
5102
5131
|
level: -1
|
|
5103
5132
|
};
|
|
5104
5133
|
let a = o;
|
|
5105
|
-
const c =
|
|
5134
|
+
const c = [];
|
|
5106
5135
|
for (let t = 0; t < this.en.length; t++) {
|
|
5107
5136
|
let e = 1 / 0;
|
|
5108
|
-
const n = [ this.en[t] ], r = this.
|
|
5137
|
+
const n = [ this.en[t] ], r = this.hn(t);
|
|
5109
5138
|
for (;n.length > 0; ) {
|
|
5110
5139
|
const t = n.pop();
|
|
5111
|
-
for (this.
|
|
5112
|
-
const s = this.
|
|
5140
|
+
for (t.id || this.un(t); a.level >= t.qe; ) a = a.parent;
|
|
5141
|
+
const s = this.ln(t, r, i);
|
|
5113
5142
|
if (s < 1) {
|
|
5114
5143
|
let n = a;
|
|
5115
5144
|
for (;n && !n.content; ) n = n.parent;
|
|
5116
|
-
0 === s && n && n.content &&
|
|
5145
|
+
0 === s && n && n.content && this.dn(c, n);
|
|
5117
5146
|
if (!1 === this.options.services[t.te].alwaysShow) continue;
|
|
5118
|
-
if (!(0 === s && t.
|
|
5119
|
-
t.content && (e = t.
|
|
5147
|
+
if (!(0 === s && t.qe <= e)) continue;
|
|
5148
|
+
t.content && (e = t.qe);
|
|
5120
5149
|
}
|
|
5121
|
-
t.ce < 1 / 0 && this.
|
|
5122
|
-
const o = this
|
|
5150
|
+
t.ce < 1 / 0 && this.mn(t);
|
|
5151
|
+
const o = this.$e(t, a);
|
|
5123
5152
|
a.children.push(o);
|
|
5124
5153
|
const h = t.children, u = h && h.length, f = o.content;
|
|
5125
|
-
if (!u && f && this.
|
|
5126
|
-
f && "add" === t.refine && this.
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5154
|
+
if (!u && f && this.dn(c, o), u) {
|
|
5155
|
+
f && "add" === t.refine && this.dn(c, o), a = o;
|
|
5156
|
+
const e = h[0].parent;
|
|
5157
|
+
for (let r = 0, s = h.length; r < s; r++) {
|
|
5158
|
+
if (!e) {
|
|
5159
|
+
h[r].parent = t, h[r].Te = t.Te, h[r].baseUrl = t.baseUrl;
|
|
5160
|
+
const e = h[r].content && (h[r].content.url || h[r].content.uri);
|
|
5161
|
+
e && (M(e) ? h[r].baseUrl = t.baseUrl : -1 === e.indexOf("http://") && -1 === e.indexOf("https://") ? h[r].content.url = t.baseUrl + e : h[r].baseUrl = e.substring(0, e.lastIndexOf("/") + 1));
|
|
5132
5162
|
}
|
|
5133
|
-
n.push(h[
|
|
5163
|
+
n.push(h[r]);
|
|
5134
5164
|
}
|
|
5135
5165
|
}
|
|
5136
5166
|
}
|
|
@@ -5140,14 +5170,15 @@
|
|
|
5140
5170
|
tiles: c
|
|
5141
5171
|
};
|
|
5142
5172
|
}
|
|
5143
|
-
|
|
5144
|
-
|
|
5173
|
+
dn(t, e) {
|
|
5174
|
+
const {viewerRequestVolume: n} = e.node;
|
|
5175
|
+
n && !function(t, e, n) {
|
|
5145
5176
|
if (n.region) {
|
|
5146
5177
|
const e = n.region;
|
|
5147
5178
|
if (t[0] >= e[0] && t[0] <= e[2] && t[1] >= e[1] && t[1] <= e[3]) return !0;
|
|
5148
5179
|
} else {
|
|
5149
|
-
if (n.sphere) return
|
|
5150
|
-
if (n.box) return 0 ===
|
|
5180
|
+
if (n.sphere) return zn(n, e);
|
|
5181
|
+
if (n.box) return 0 === jn(n, e);
|
|
5151
5182
|
}
|
|
5152
5183
|
return !1;
|
|
5153
5184
|
}
|
|
@@ -5155,52 +5186,48 @@
|
|
|
5155
5186
|
* @maptalks/gl v0.65.0
|
|
5156
5187
|
* LICENSE : UNLICENSED
|
|
5157
5188
|
* (c) 2016-2022 maptalks.com
|
|
5158
|
-
*/ (this.
|
|
5189
|
+
*/ (this.sn, this.in, n) || t.push(e);
|
|
5159
5190
|
}
|
|
5160
|
-
|
|
5191
|
+
$e(t, e) {
|
|
5161
5192
|
return {
|
|
5162
5193
|
id: t.id,
|
|
5163
5194
|
node: t,
|
|
5164
5195
|
children: [],
|
|
5165
|
-
level: t.
|
|
5196
|
+
level: t.qe,
|
|
5166
5197
|
parent: e,
|
|
5167
|
-
content:
|
|
5198
|
+
content: t.content && t.content.url
|
|
5168
5199
|
};
|
|
5169
5200
|
}
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
t.
|
|
5173
|
-
|
|
5201
|
+
un(t) {
|
|
5202
|
+
t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]), t.yn = this.bn(t),
|
|
5203
|
+
t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix), t.te = t.parent.te,
|
|
5204
|
+
void 0 === t.qe && (t.qe = t.parent.qe + 1), t.maxExtent = t.parent.maxExtent),
|
|
5174
5205
|
t.refine = t.refine && t.refine.toLowerCase() || "replace", t.content && !t.content.url && t.content.uri && (t.content.url = t.content.uri),
|
|
5175
|
-
this.
|
|
5206
|
+
this.pn(t);
|
|
5176
5207
|
}
|
|
5177
|
-
|
|
5208
|
+
pn(t) {
|
|
5178
5209
|
const e = t.boundingVolume;
|
|
5179
5210
|
if (!e || e.nn) return;
|
|
5180
5211
|
const r = this.options.services[t.te].heightOffset || 0, s = this.options.offset, i = y(s) || s[0] || s[1];
|
|
5181
|
-
if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix,
|
|
5212
|
+
if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, Dn) && !i) return;
|
|
5182
5213
|
const {region: o, box: a, sphere: c} = e;
|
|
5183
5214
|
if (o) {
|
|
5184
|
-
const t = this.
|
|
5215
|
+
const t = this.wn([ p(o[0]), p(o[1]) ]);
|
|
5185
5216
|
o[0] = b(t.x), o[1] = b(t.y);
|
|
5186
|
-
const e = this.
|
|
5217
|
+
const e = this.wn([ p(o[2]), p(o[3]) ]);
|
|
5187
5218
|
o[2] = b(e.x), o[3] = b(e.y), o[4] += r, o[5] += r;
|
|
5188
5219
|
} else if (a || c) {
|
|
5189
|
-
const e = a || c, s = n.vec3.transformMat4(Nn, e, t.matrix), i = te(En, s), o = this.
|
|
5220
|
+
const e = a || c, s = n.vec3.transformMat4(Nn, e, t.matrix), i = te(En, s), o = this.wn([ i[0], i[1] ]);
|
|
5190
5221
|
i[0] = o.x, i[1] = o.y, i[2] += r, Kt(e, b(i[0]), b(i[1]), i[2]);
|
|
5191
5222
|
}
|
|
5192
5223
|
e.nn = !0;
|
|
5193
5224
|
}
|
|
5194
|
-
|
|
5225
|
+
bn(t) {
|
|
5195
5226
|
return void 0 === t.geometricError || !t.boundingVolume;
|
|
5196
5227
|
}
|
|
5197
|
-
|
|
5198
|
-
return t.content && t.content.url;
|
|
5199
|
-
}
|
|
5200
|
-
bn(t) {
|
|
5228
|
+
mn(t) {
|
|
5201
5229
|
let e = t.parent;
|
|
5202
|
-
for (;e && e.
|
|
5203
|
-
e = t.parent;
|
|
5230
|
+
for (;e && e.yn && !(e.ce <= t.ce); ) e.ce = t.ce, e = t.parent;
|
|
5204
5231
|
}
|
|
5205
5232
|
onTilesetLoad(t, e, r) {
|
|
5206
5233
|
if (!t) return void console.warn("invalid tileset at : " + r);
|
|
@@ -5210,73 +5237,71 @@
|
|
|
5210
5237
|
m(e, t.root), e.refine = e.refine && e.refine.toLowerCase() || "replace", r && (e.boundingVolume = r);
|
|
5211
5238
|
const s = t.root.transform;
|
|
5212
5239
|
s && (e.parent ? e.matrix = n.mat4.multiply([], e.parent.matrix, s) : e.matrix = s),
|
|
5213
|
-
this.
|
|
5214
|
-
|
|
5240
|
+
this.pn(e), e._n = e.content, delete e.content, t.root.content && (e.content = t.root.content),
|
|
5241
|
+
e.yn = this.bn(e);
|
|
5215
5242
|
const i = e.content && (e.content.url || e.content.uri);
|
|
5216
5243
|
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);
|
|
5217
5244
|
}
|
|
5218
|
-
this.
|
|
5245
|
+
this.rn(), this.fire("loadtileset", {
|
|
5219
5246
|
tileset: t,
|
|
5220
5247
|
index: e.te,
|
|
5221
5248
|
url: r
|
|
5222
5249
|
});
|
|
5223
5250
|
}
|
|
5224
|
-
|
|
5225
|
-
if (t.ce = 1 / 0, 0 === t.
|
|
5226
|
-
if (
|
|
5251
|
+
ln(t, e, n) {
|
|
5252
|
+
if (t.ce = 1 / 0, 0 === t.qe || t.yn) return 1;
|
|
5253
|
+
if (!this.gn(t, e, n)) return -1;
|
|
5227
5254
|
if (0 === t.geometricError) return 1;
|
|
5228
5255
|
let r = this.options.services[t.te].maximumScreenSpaceError;
|
|
5229
5256
|
null == r && (r = 8);
|
|
5230
|
-
let s = this.
|
|
5257
|
+
let s = this.Tn(t);
|
|
5231
5258
|
return 0 === s && t.parent && (s = .5 * (t.parent.An || 0)), s >= r ? 1 : 0;
|
|
5232
5259
|
}
|
|
5233
|
-
ye(t) {
|
|
5234
|
-
|
|
5235
|
-
|
|
5260
|
+
ye(t, e) {
|
|
5261
|
+
e || (e = new s.Point(0, 0));
|
|
5262
|
+
const n = this.getMap();
|
|
5263
|
+
return n.getGLZoom ? n.coordToPoint(t, n.getGLZoom(), e) : n.coordToPointAtRes(t, n.getGLRes(), e);
|
|
5236
5264
|
}
|
|
5237
|
-
|
|
5238
|
-
if (!this.getMap()) return !1;
|
|
5265
|
+
gn(t, e, r) {
|
|
5239
5266
|
const o = t.id;
|
|
5240
5267
|
let a = this.tn[o];
|
|
5241
|
-
|
|
5242
|
-
if (!a
|
|
5268
|
+
const {boundingVolume: f} = t, d = f.sphere, m = f.region, y = f.box;
|
|
5269
|
+
if (!a) {
|
|
5243
5270
|
let e, r, i;
|
|
5244
|
-
if (
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
a = this.tn[o] = [ ...c, ...u ], a.center = new s.Coordinate(r);
|
|
5271
|
+
if (m) {
|
|
5272
|
+
e = xn.set(p(m[0]), p(m[1]), p(m[2]), p(m[3]));
|
|
5273
|
+
const t = e.getCenter(), n = this.On(t);
|
|
5274
|
+
e = e.convertTo(t => this.ye(t, Un), In), i = m[4], r = m[5], a = this.tn[o] = [ [ e.xmin, e.ymin, i * n[2] ], [ e.xmax, e.ymax, r * n[2] ] ],
|
|
5275
|
+
a.center = t;
|
|
5276
|
+
} else if (d) {
|
|
5277
|
+
const t = te(Nn, d), e = new s.Coordinate(t), n = this.ye(e, Un).toArray(), r = this.On(e);
|
|
5278
|
+
n.push(t[2] * r[2]), a = this.tn[o] = [ n, d[3] * r[2] ], a.center = e;
|
|
5279
|
+
} else if (y) {
|
|
5280
|
+
const e = te(Nn, y), r = new s.Coordinate(e), i = this.ye(r, Un).toArray(), c = this.On(r);
|
|
5281
|
+
i.push(e[2] * c[2]);
|
|
5282
|
+
const h = y.slice(3);
|
|
5283
|
+
n.mat4.exactEquals(t.matrix, Dn) || n.mat3.multiply(h, n.mat3.fromMat4(Rn, t.matrix), h);
|
|
5284
|
+
for (let t = 0; t < h.length; t++) h[t] *= c[t % 3], y[3 + t] = h[t];
|
|
5285
|
+
a = this.tn[o] = [ ...i, ...h ], a.center = r;
|
|
5260
5286
|
}
|
|
5261
5287
|
}
|
|
5262
5288
|
if (e) {
|
|
5263
|
-
if (
|
|
5264
|
-
In.ymax = a[1][1]; else if (t.boundingVolume.sphere) {
|
|
5289
|
+
if (m) xn.xmin = a[0][0], xn.ymin = a[0][1], xn.xmax = a[1][0], xn.ymax = a[1][1]; else if (d) {
|
|
5265
5290
|
const t = a[2];
|
|
5266
|
-
|
|
5267
|
-
} else if (
|
|
5291
|
+
xn.xmin = a[0][0] - t, xn.ymin = a[0][1] - t, xn.xmax = a[0][0] + t, xn.ymax = a[0][1] + t;
|
|
5292
|
+
} else if (y) {
|
|
5268
5293
|
const t = a[1], e = a[2];
|
|
5269
|
-
|
|
5294
|
+
xn.xmin = a[0][0] - t, xn.ymin = a[0][1] - e, xn.xmax = a[0][0] + t, xn.ymax = a[0][1] + e;
|
|
5270
5295
|
}
|
|
5271
|
-
if (!e.intersects(
|
|
5296
|
+
if (!e.intersects(xn)) return !1;
|
|
5272
5297
|
}
|
|
5273
|
-
return
|
|
5298
|
+
return m ? c(r, a) : d ? function(t, e, n) {
|
|
5274
5299
|
u(t);
|
|
5275
5300
|
for (var r = e[0], s = -e[1], o = 0; o < 6; o++) {
|
|
5276
5301
|
if (!n || "0" !== n.charAt(o)) if (l(i[o], r) < s) return !1;
|
|
5277
5302
|
}
|
|
5278
5303
|
return !0;
|
|
5279
|
-
}(r, a) : !!
|
|
5304
|
+
}(r, a) : !!y && function(t, e, n) {
|
|
5280
5305
|
u(t);
|
|
5281
5306
|
for (var r = 0; r < 6; r++) {
|
|
5282
5307
|
if (!n || "0" !== n.charAt(r)) if (!h(i[r], e)) return !1;
|
|
@@ -5284,11 +5309,11 @@
|
|
|
5284
5309
|
return !0;
|
|
5285
5310
|
}(r, a);
|
|
5286
5311
|
}
|
|
5287
|
-
|
|
5312
|
+
On(t) {
|
|
5288
5313
|
const e = this.getMap(), r = e.distanceToPointAtRes(100, 100, e.getGLRes(), t);
|
|
5289
5314
|
return n.vec3.set(Pn, r.x / 100 * 1.01, r.y / 100 * 1.01, r.y / 100), Pn;
|
|
5290
5315
|
}
|
|
5291
|
-
|
|
5316
|
+
wn(t) {
|
|
5292
5317
|
Array.isArray(t) && (t = new s.Coordinate(t));
|
|
5293
5318
|
let e = this.options.offset;
|
|
5294
5319
|
if (y(e) && (e = e(Array.isArray(t) ? new s.Coordinate(t) : t)), e[0] || e[1]) {
|
|
@@ -5297,48 +5322,39 @@
|
|
|
5297
5322
|
}
|
|
5298
5323
|
return t;
|
|
5299
5324
|
}
|
|
5300
|
-
|
|
5325
|
+
hn(t) {
|
|
5301
5326
|
const e = this.options.services[t].maxExtent;
|
|
5302
5327
|
if (!e) return null;
|
|
5303
5328
|
const n = this.en[t];
|
|
5304
5329
|
return n.maxExtent || (n.maxExtent = new s.Extent(e).convertTo(t => this.ye(t))),
|
|
5305
5330
|
n.maxExtent;
|
|
5306
5331
|
}
|
|
5307
|
-
|
|
5308
|
-
const e = this.
|
|
5309
|
-
if (0 ===
|
|
5310
|
-
const
|
|
5311
|
-
let
|
|
5332
|
+
Tn(t) {
|
|
5333
|
+
const e = this.an, n = t.geometricError;
|
|
5334
|
+
if (0 === n) return 0;
|
|
5335
|
+
const r = this.getMap();
|
|
5336
|
+
let s;
|
|
5312
5337
|
if (t.boundingVolume.region) {
|
|
5313
|
-
const e = this.tn[t.id].center,
|
|
5314
|
-
|
|
5338
|
+
const e = this.tn[t.id].center, n = (r.getGLZoom ? r.distanceToPoint(100, 0, r.getGLZoom(), e) : r.distanceToPointAtRes(100, 0, r.getGLRes(), e)).x / 100;
|
|
5339
|
+
s = function(t, e, n, r) {
|
|
5315
5340
|
const s = t.boundingVolume.region;
|
|
5316
|
-
let i = t.
|
|
5317
|
-
i || (i = t.
|
|
5318
|
-
t.
|
|
5319
|
-
t.
|
|
5341
|
+
let i = t.vn;
|
|
5342
|
+
i || (i = t.vn = [ Vn(s[0], s[1]), Vn(s[0], s[3]), Vn(s[2], s[1]), Vn(s[2], s[3]), Vn(s[0], s[1]), Vn(s[0], s[3]), Vn(s[2], s[1]), Vn(s[2], s[3]) ],
|
|
5343
|
+
t.Mn = [ Math.min.apply(Math, i.map(t => t[0])), Math.min.apply(Math, i.map(t => t[1])) ],
|
|
5344
|
+
t.Sn = [ Math.max.apply(Math, i.map(t => t[0])), Math.max.apply(Math, i.map(t => t[1])) ]);
|
|
5320
5345
|
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];
|
|
5321
|
-
const o = (a = t.
|
|
5346
|
+
const o = (a = t.Mn, c = t.Sn, h = e, u = Math.max(a[0] - h[0], 0, h[0] - c[0]),
|
|
5322
5347
|
f = Math.max(a[1] - h[1], 0, h[1] - c[1]), Math.sqrt(u * u + f * f) / r);
|
|
5323
5348
|
var a, c, h, u, f;
|
|
5324
5349
|
let l = 0;
|
|
5325
5350
|
n[2] > s[5] && (l = n[2] - s[5]);
|
|
5326
5351
|
return Math.sqrt(o * o + l * l);
|
|
5327
|
-
}(t, this.
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
return n.vec3.dist(r, e);
|
|
5334
|
-
}(t, this.an)) : t.boundingVolume.box && (i = Rn(t.boundingVolume, this.an), o = function(t, e) {
|
|
5335
|
-
const r = t.boundingVolume.box;
|
|
5336
|
-
return n.vec3.dist(r, e);
|
|
5337
|
-
}(t, this.an));
|
|
5338
|
-
const a = Math.max(Math.abs(i), 1e-7), c = r * s.height / (a * e);
|
|
5339
|
-
return t.ce = i, t.Ye = o, t.An = c, c;
|
|
5340
|
-
}
|
|
5341
|
-
sn() {
|
|
5352
|
+
}(t, this.cn, this.sn, n);
|
|
5353
|
+
} else t.boundingVolume.sphere ? s = zn(t.boundingVolume, this.in) : t.boundingVolume.box && (s = jn(t.boundingVolume, this.in));
|
|
5354
|
+
const i = Math.max(Math.abs(s), 1e-7), o = n * r.height / (i * e);
|
|
5355
|
+
return t.ce = s, t.An = o, o;
|
|
5356
|
+
}
|
|
5357
|
+
rn() {
|
|
5342
5358
|
const t = this.getRenderer();
|
|
5343
5359
|
t && t.setToRedraw();
|
|
5344
5360
|
}
|
|
@@ -5346,15 +5362,18 @@
|
|
|
5346
5362
|
return this.tn[t];
|
|
5347
5363
|
}
|
|
5348
5364
|
}
|
|
5349
|
-
function
|
|
5365
|
+
function zn(t, e) {
|
|
5350
5366
|
const r = t.sphere, s = n.vec3.dist(r, e), i = t.sphere[3];
|
|
5351
5367
|
return s < i ? 0 : s - i;
|
|
5352
5368
|
}
|
|
5353
|
-
function
|
|
5354
|
-
const
|
|
5355
|
-
return
|
|
5369
|
+
function jn(t, e) {
|
|
5370
|
+
const r = t.box;
|
|
5371
|
+
return gn(n.vec3.set(Nn, r[0], r[1], r[2]), n.mat3.set(Rn, r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11]), e);
|
|
5356
5372
|
}
|
|
5357
|
-
|
|
5373
|
+
function Vn(t, e) {
|
|
5374
|
+
return Bn.x = p(t), Bn.y = p(e), Sn.project(Bn, Cn).toArray();
|
|
5375
|
+
}
|
|
5376
|
+
kn.mergeOptions({
|
|
5358
5377
|
"maxGPUMemory": 512,
|
|
5359
5378
|
"retireInterval": 2e3,
|
|
5360
5379
|
"loadingLimitOnInteracting": 5,
|
|
@@ -5365,39 +5384,34 @@
|
|
|
5365
5384
|
"forceRenderOnMoving": !0,
|
|
5366
5385
|
"debug": !1,
|
|
5367
5386
|
"debugOutline": [ 0, 1, 0 ],
|
|
5387
|
+
"meshLimitPerFrame": 1,
|
|
5368
5388
|
"antialias": !1,
|
|
5369
|
-
"sRGBTolinear": !1,
|
|
5370
5389
|
"optionalExtensions": [ "ANGLE_instanced_arrays", "OES_element_index_uint", "OES_standard_derivatives", "OES_vertex_array_object", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_texture_float", "OES_texture_float_linear", "WEBGL_depth_texture", "EXT_shader_texture_lod", "WEBGL_compressed_texture_astc", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_compressed_texture_s3tc_srgb" ],
|
|
5371
5390
|
"offset": [ 0, 0 ]
|
|
5372
|
-
}),
|
|
5373
|
-
const
|
|
5374
|
-
function kn(t, e) {
|
|
5375
|
-
const n = new s.Coordinate(p(t), p(e));
|
|
5376
|
-
return xn.project(n).toArray();
|
|
5377
|
-
}
|
|
5378
|
-
const zn = function() {
|
|
5391
|
+
}), kn.registerRenderer("gl", pn);
|
|
5392
|
+
const Gn = function() {
|
|
5379
5393
|
if ("undefined" != typeof self) return self;
|
|
5380
5394
|
if ("undefined" != typeof window) return window;
|
|
5381
5395
|
if ("undefined" != typeof global) return global;
|
|
5382
5396
|
throw new Error("unable to locate global object");
|
|
5383
|
-
},
|
|
5384
|
-
|
|
5385
|
-
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s =
|
|
5386
|
-
let i = `${r}\n const _____getGlobal = ${
|
|
5397
|
+
}, Hn = Gn(), qn = Hn.gl_trans__coders = Hn.gl_trans__coders || {};
|
|
5398
|
+
qn.inject = function(t) {
|
|
5399
|
+
const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = Hn.gl_trans__coders = Hn.gl_trans__coders || {};
|
|
5400
|
+
let i = `${r}\n const _____getGlobal = ${Gn.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
|
|
5387
5401
|
for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
|
|
5388
5402
|
return i += "\n" + e.substring(r.length), i;
|
|
5389
|
-
},
|
|
5390
|
-
|
|
5391
|
-
},
|
|
5392
|
-
return
|
|
5403
|
+
}, qn.registerTranscoder = function(t, e) {
|
|
5404
|
+
qn[t] = e;
|
|
5405
|
+
}, qn.getTranscoder = function(t) {
|
|
5406
|
+
return qn[t];
|
|
5393
5407
|
};
|
|
5394
|
-
class
|
|
5408
|
+
class $n {
|
|
5395
5409
|
constructor(t, e, n) {
|
|
5396
|
-
this.i = t, this.Y = e ||
|
|
5397
|
-
"image/crn":
|
|
5398
|
-
"image/ktx2":
|
|
5399
|
-
"image/cttf":
|
|
5400
|
-
"draco":
|
|
5410
|
+
this.i = t, this.Y = e || Nt, this.o = n, this.tt = {
|
|
5411
|
+
"image/crn": qn.crn && qn.crn(),
|
|
5412
|
+
"image/ktx2": qn.ktx2 && qn.ktx2(),
|
|
5413
|
+
"image/cttf": qn.ktx2 && qn.ktx2(),
|
|
5414
|
+
"draco": qn.draco && qn.draco()
|
|
5401
5415
|
};
|
|
5402
5416
|
}
|
|
5403
5417
|
static createEmptyB3DM() {
|
|
@@ -5486,13 +5500,13 @@
|
|
|
5486
5500
|
return null;
|
|
5487
5501
|
}
|
|
5488
5502
|
}
|
|
5489
|
-
class
|
|
5503
|
+
class Jn {
|
|
5490
5504
|
constructor(t, e, n) {
|
|
5491
|
-
this.i = t, this.Y = e ||
|
|
5492
|
-
"image/crn":
|
|
5493
|
-
"image/ktx2":
|
|
5494
|
-
"image/cttf":
|
|
5495
|
-
"draco":
|
|
5505
|
+
this.i = t, this.Y = e || Nt, this.o = n, this.tt = {
|
|
5506
|
+
"image/crn": qn.crn && qn.crn(),
|
|
5507
|
+
"image/ktx2": qn.ktx2 && qn.ktx2(),
|
|
5508
|
+
"image/cttf": qn.ktx2 && qn.ktx2(),
|
|
5509
|
+
"draco": qn.draco && qn.draco()
|
|
5496
5510
|
};
|
|
5497
5511
|
}
|
|
5498
5512
|
load(t, e, n = 0, r = 0) {
|
|
@@ -5663,7 +5677,7 @@
|
|
|
5663
5677
|
}
|
|
5664
5678
|
ct(t) {
|
|
5665
5679
|
const e = t.length / 2, n = new Float32Array(3 * e), r = [];
|
|
5666
|
-
for (let s = 0; s < e; s++)
|
|
5680
|
+
for (let s = 0; s < e; s++) Kn(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
|
|
5667
5681
|
n[3 * s + 1] = r[1], n[3 * s + 2] = r[2];
|
|
5668
5682
|
return n;
|
|
5669
5683
|
}
|
|
@@ -5674,15 +5688,15 @@
|
|
|
5674
5688
|
return null;
|
|
5675
5689
|
}
|
|
5676
5690
|
}
|
|
5677
|
-
function
|
|
5678
|
-
if (t[0] =
|
|
5691
|
+
function Kn(t, e, n, r) {
|
|
5692
|
+
if (t[0] = Xn(e, r), t[1] = Xn(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
|
|
5679
5693
|
t[2] < 0) {
|
|
5680
5694
|
const e = t[0];
|
|
5681
|
-
t[0] = (1 - Math.abs(t[1])) *
|
|
5695
|
+
t[0] = (1 - Math.abs(t[1])) * Wn(e), t[1] = (1 - Math.abs(e)) * Wn(t[1]);
|
|
5682
5696
|
}
|
|
5683
5697
|
return D(t, t);
|
|
5684
5698
|
}
|
|
5685
|
-
function
|
|
5699
|
+
function Xn(t, e) {
|
|
5686
5700
|
return function(t, e, n) {
|
|
5687
5701
|
return t < e ? e : t > n ? n : t;
|
|
5688
5702
|
}(t, 0, e = function(t, e) {
|
|
@@ -5690,10 +5704,10 @@
|
|
|
5690
5704
|
return e;
|
|
5691
5705
|
}(e, 255)) / e * 2 - 1;
|
|
5692
5706
|
}
|
|
5693
|
-
function
|
|
5707
|
+
function Wn(t) {
|
|
5694
5708
|
return t < 0 ? -1 : 1;
|
|
5695
5709
|
}
|
|
5696
|
-
class
|
|
5710
|
+
class Zn {
|
|
5697
5711
|
constructor() {}
|
|
5698
5712
|
load(t, e, n = 0, r = 0) {
|
|
5699
5713
|
return e ? (r || (r = e.byteLength), this.et(t, e, n, r)) : ft.getArrayBuffer(t, {}).then(e => {
|
|
@@ -5734,7 +5748,7 @@
|
|
|
5734
5748
|
attributes: y.properties,
|
|
5735
5749
|
useUniqueIDs: !1
|
|
5736
5750
|
};
|
|
5737
|
-
return this.ut || (this.ut =
|
|
5751
|
+
return this.ut || (this.ut = qn.draco()), this.ut(m, e).then(e => {
|
|
5738
5752
|
const n = e.attributes;
|
|
5739
5753
|
!a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
|
|
5740
5754
|
n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
|
|
@@ -5752,7 +5766,7 @@
|
|
|
5752
5766
|
array: t
|
|
5753
5767
|
}, o.push(t.buffer);
|
|
5754
5768
|
} else if (a.BATCH_ID || Object.keys(h).length) {
|
|
5755
|
-
a.BATCH_ID ? r.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID =
|
|
5769
|
+
a.BATCH_ID ? r.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = Qn(d);
|
|
5756
5770
|
const e = r.BATCH_ID.array && r.BATCH_ID.array.buffer;
|
|
5757
5771
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5758
5772
|
}
|
|
@@ -5768,7 +5782,7 @@
|
|
|
5768
5782
|
}
|
|
5769
5783
|
const b = this.ft(t, a, c.offset, d, o, f, l);
|
|
5770
5784
|
if (a.BATCH_ID || Object.keys(h).length) {
|
|
5771
|
-
a.BATCH_ID ? b.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID =
|
|
5785
|
+
a.BATCH_ID ? b.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = Qn(d);
|
|
5772
5786
|
const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
|
|
5773
5787
|
e && o.indexOf(e) < 0 && o.push(e);
|
|
5774
5788
|
}
|
|
@@ -5903,7 +5917,7 @@
|
|
|
5903
5917
|
return null;
|
|
5904
5918
|
}
|
|
5905
5919
|
}
|
|
5906
|
-
function
|
|
5920
|
+
function Qn(t) {
|
|
5907
5921
|
const e = v(t), n = new e(t);
|
|
5908
5922
|
for (let e = 0; e < t; e++) n[e] = e;
|
|
5909
5923
|
return {
|
|
@@ -5915,9 +5929,9 @@
|
|
|
5915
5929
|
array: n
|
|
5916
5930
|
};
|
|
5917
5931
|
}
|
|
5918
|
-
class
|
|
5932
|
+
class Yn {
|
|
5919
5933
|
constructor(t, e) {
|
|
5920
|
-
this.i = t, this.Y = e ||
|
|
5934
|
+
this.i = t, this.Y = e || Nt;
|
|
5921
5935
|
}
|
|
5922
5936
|
load(t, e, n = 0, r = 0) {
|
|
5923
5937
|
return e ? this.et(t, e, n, r) : ft.getArrayBuffer(t, {}).then(e => {
|
|
@@ -5930,12 +5944,12 @@
|
|
|
5930
5944
|
const s = this.lt(e, t, n, r), i = [];
|
|
5931
5945
|
for (let n = 0; n < s.length; n++) {
|
|
5932
5946
|
let r;
|
|
5933
|
-
if ("b3dm" === s[n].magic) r = new
|
|
5947
|
+
if ("b3dm" === s[n].magic) r = new $n(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new Jn(this.i, this.Y); else if ("pnts" === s[n].magic) r = new Zn; else {
|
|
5934
5948
|
if ("cmpt" !== s[n].magic) {
|
|
5935
5949
|
console.warn("Unsupported magic in CMPT tile:", s[n].magic);
|
|
5936
5950
|
continue;
|
|
5937
5951
|
}
|
|
5938
|
-
r = new
|
|
5952
|
+
r = new Yn(this.i, this.Y);
|
|
5939
5953
|
}
|
|
5940
5954
|
i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
|
|
5941
5955
|
}
|
|
@@ -5967,9 +5981,9 @@
|
|
|
5967
5981
|
return o;
|
|
5968
5982
|
}
|
|
5969
5983
|
}
|
|
5970
|
-
t.B3DMLoader =
|
|
5984
|
+
t.B3DMLoader = $n, t.CMPTLoader = Yn, t.Geo3DTilesLayer = kn, t.Geo3DTilesUtil = x,
|
|
5971
5985
|
t.Geo3DTransform = oe, Object.defineProperty(t, "t", {
|
|
5972
5986
|
value: !0
|
|
5973
5987
|
});
|
|
5974
|
-
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.
|
|
5988
|
+
})), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.13.0");
|
|
5975
5989
|
}));
|