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