@maptalks/3dtiles 0.12.6 → 0.12.7

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.12.6
2
+ * @maptalks/3dtiles v0.12.7
3
3
  * LICENSE : UNLICENSED
4
4
  * (c) 2016-2022 maptalks.com
5
5
  */
@@ -146,7 +146,7 @@
146
146
  s(), o(1, 0, 0), o(0, 1, 0), g(), g(), A = new e(9), e != Float32Array && (A[1] = 0,
147
147
  A[2] = 0, A[3] = 0, A[5] = 0, A[6] = 0, A[7] = 0), A[0] = 1, A[4] = 1, A[8] = 1;
148
148
  /*!
149
- * @maptalks/gltf-loader v0.25.3
149
+ * @maptalks/gltf-loader v0.25.5
150
150
  * LICENSE : UNLICENSED
151
151
  * (c) 2016-2022 maptalks.org
152
152
  */
@@ -255,29 +255,23 @@
255
255
  getArrayBuffer: (t, e = {}) => (e || (e = {}), e.responseType = "arraybuffer", z.get(t, e)),
256
256
  getJSON: function(t, e = {}) {
257
257
  return e && e.jsonp ? z.jsonp(t) : ((e = e || {}).responseType = "json", z.get(t, e));
258
+ },
259
+ jsonp: function(t) {
260
+ const e = "_maptalks_jsonp_" + v++;
261
+ t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
262
+ let n = document.createElement("script");
263
+ return n.type = "text/javascript", n.src = t, new Promise(t => {
264
+ window[e] = function(r) {
265
+ document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
266
+ t(r);
267
+ }, document.getElementsByTagName("head")[0].appendChild(n);
268
+ });
258
269
  }
259
270
  };
260
- z.jsonp = function(t) {
261
- const e = "_maptalks_jsonp_" + v++;
262
- t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
263
- let n = document.createElement("script");
264
- return n.type = "text/javascript", n.src = t, new Promise(t => {
265
- window[e] = function(r) {
266
- document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
267
- t(r);
268
- }, document.getElementsByTagName("head")[0].appendChild(n);
269
- });
270
- };
271
271
  class j {
272
272
  constructor(t, e, n) {
273
273
  this.i = t, this.decoders = e, this.o = n, this.images = {}, this.h = {};
274
274
  }
275
- abortRequests() {
276
- for (const t in this.h) {
277
- const e = this.h[t];
278
- e && e.xhr && e.xhr.abort();
279
- }
280
- }
281
275
  requestImageFromBufferURI(t, e, n) {
282
276
  if (this.buffers[t.id]) {
283
277
  const r = this.buffers[t.id], s = this.u(e, r);
@@ -314,8 +308,7 @@
314
308
  requestExternalImage(t) {
315
309
  if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
316
310
  const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
317
- if (this.h[t.id]) return this.h[t.id].then(() => this.images[t.id]);
318
- return this.h[t.id] = this.l(t.id, e);
311
+ return this.h[t.id] ? this.h[t.id].then(() => this.images[t.id]) : this.h[t.id] = this.l(t.id, e);
319
312
  }
320
313
  l(t, e) {
321
314
  return new Promise((n, r) => {
@@ -378,8 +371,7 @@
378
371
  });
379
372
  }
380
373
  g(t, e, n, r = 0) {
381
- const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = I(i.componentType), u = o.byteStride || 0;
382
- const f = {
374
+ const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = I(i.componentType), u = o.byteStride || 0, f = {
383
375
  array: void 0,
384
376
  name: t,
385
377
  accessorName: e,
@@ -489,7 +481,7 @@
489
481
  r.instanceTechnique && r.instanceTechnique.values ? (s = r.instanceTechnique, i = s.values.diffuse) : (s = r,
490
482
  i = s.values.tex || s.values.diffuseTex || s.values.diffuse);
491
483
  const o = {
492
- "baseColorTexture": {
484
+ baseColorTexture: {
493
485
  index: i
494
486
  }
495
487
  };
@@ -610,8 +602,7 @@
610
602
  N(t, e) {
611
603
  const n = new Array(t.byteLength);
612
604
  for (let e = 0; e < t.byteLength; e++) n[e] = String.fromCharCode(t[e]);
613
- n.join("");
614
- return "data:" + (e = e || "image/png") + ";base64," + function(t) {
605
+ return n.join(""), "data:" + (e = e || "image/png") + ";base64," + function(t) {
615
606
  return "undefined" != typeof self ? self.btoa(t) : window.btoa(t);
616
607
  }(unescape(encodeURIComponent(n)));
617
608
  }
@@ -635,19 +626,19 @@
635
626
  });
636
627
  }
637
628
  }
638
- const $ = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null, J = 1313821514, K = 5130562;
639
- class X {
629
+ const $ = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
630
+ class J {
640
631
  static read(t, e = 0, n = 0) {
641
632
  n || (n = t.byteLength);
642
633
  const r = new DataView(t, e, n), s = r.getUint32(4, !0);
643
- if (1 === s) return X.readV1(r, e);
644
- if (2 === s) return X.readV2(t, e);
634
+ if (1 === s) return J.readV1(r, e);
635
+ if (2 === s) return J.readV2(t, e);
645
636
  throw new Error("Unsupported glb version : " + s);
646
637
  }
647
638
  static readV1(t, e) {
648
639
  const n = t.getUint32(8, !0), r = t.getUint32(12, !0);
649
640
  if (n !== t.byteLength) throw new Error("Length in GLB header is inconsistent with glb's byte length.");
650
- const s = W(t.buffer, 20 + e, r);
641
+ const s = K(t.buffer, 20 + e, r);
651
642
  return {
652
643
  json: JSON.parse(s),
653
644
  glbBuffer: {
@@ -665,7 +656,7 @@
665
656
  const a = i.getUint32(o, !0);
666
657
  o += 4;
667
658
  const c = i.getUint32(o, !0);
668
- if (o += 4, c === J) n = W(t, e + 12 + o, a); else if (c === K) {
659
+ if (o += 4, 1313821514 === c) n = K(t, e + 12 + o, a); else if (5130562 === c) {
669
660
  s = e + 12 + o, r = a;
670
661
  break;
671
662
  }
@@ -681,7 +672,7 @@
681
672
  };
682
673
  }
683
674
  }
684
- function W(t, e, n) {
675
+ function K(t, e, n) {
685
676
  if ($) {
686
677
  const r = new Uint8Array(t, e, n);
687
678
  return $.decode(r);
@@ -692,7 +683,7 @@
692
683
  for (let r = 0; r < e; ) {
693
684
  let s = t[r++];
694
685
  if (128 & s) {
695
- let n = Z[s >> 3 & 7];
686
+ let n = X[s >> 3 & 7];
696
687
  if (!(64 & s) || !n || r + n > e) return null;
697
688
  for (s &= 63 >> n; n > 0; n -= 1) {
698
689
  const e = t[r++];
@@ -705,29 +696,28 @@
705
696
  return n;
706
697
  }(new Uint8Array(t, e, n));
707
698
  }
708
- const Z = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
709
- const Q = [ 0, 0, 0 ], Y = [ 0, 0, 0, 1 ], tt = [ 1, 1, 1 ], et = {
699
+ const X = [ 1, 1, 1, 1, 2, 2, 3, 0 ], W = [ 0, 0, 0 ], Z = [ 0, 0, 0, 1 ], Q = [ 1, 1, 1 ], Y = {
710
700
  TRANSLATION: [ 0, 0, 0 ],
711
701
  ROTATION: [ 0, 0, 0, 1 ],
712
702
  SCALE: [ 1, 1, 1 ]
713
- }, nt = {
703
+ }, tt = {
714
704
  PREVIOUS: null,
715
705
  NEXT: null,
716
706
  PREINDEX: null,
717
707
  NEXTINDEX: null,
718
708
  INTERPOLATION: null
719
- }, rt = {
709
+ }, et = {
720
710
  P(t, e, n, r, s, i, o, c) {
721
711
  const h = S(t) ? e.animations : [ e.animations[0] ], u = {};
722
712
  for (let e = 0; e < h.length; e++) {
723
- const f = h[e];
724
- if (S(t) && f.name !== t) continue;
725
- const l = f.channelsMap[n];
726
- if (l) for (let t = 0; t < l.length; t++) {
727
- const e = l[t];
728
- "translation" === e.target.path ? (this.L(s, f.samplers[e.sampler], r, 1), u.translation = a(Q, s)) : "rotation" === e.target.path ? (this.B(i, f.samplers[e.sampler], r, 1),
729
- u.rotation = O(Y, i)) : "scale" === e.target.path ? (this.L(o, f.samplers[e.sampler], r, 1),
730
- u.scale = a(tt, o)) : "weights" === e.target.path && c && (this.L(c, f.samplers[e.sampler], r, c.length),
713
+ const f = h[e], l = f.name || e;
714
+ if (S(t) && l !== t) continue;
715
+ const d = f.channelsMap[n];
716
+ if (d) for (let t = 0; t < d.length; t++) {
717
+ const e = d[t];
718
+ "translation" === e.target.path ? (this.L(s, f.samplers[e.sampler], r, 1), u.translation = a(W, s)) : "rotation" === e.target.path ? (this.B(i, f.samplers[e.sampler], r, 1),
719
+ u.rotation = O(Z, i)) : "scale" === e.target.path ? (this.L(o, f.samplers[e.sampler], r, 1),
720
+ u.scale = a(Q, o)) : "weights" === e.target.path && c && (this.L(c, f.samplers[e.sampler], r, c.length),
731
721
  u.weights = c);
732
722
  }
733
723
  }
@@ -737,7 +727,7 @@
737
727
  switch (e.interpolation) {
738
728
  case "LINEAR":
739
729
  {
740
- const s = this.U(nt, e, n, 1 * r);
730
+ const s = this.U(tt, e, n, 1 * r);
741
731
  s && (t = function(t, e, n, r) {
742
732
  for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
743
733
  return t;
@@ -747,7 +737,7 @@
747
737
 
748
738
  case "STEP":
749
739
  {
750
- const s = this.U(nt, e, n, 1 * r);
740
+ const s = this.U(tt, e, n, 1 * r);
751
741
  s && (t = function(t, e) {
752
742
  for (let n = 0; n < t.length; n++) t[n] = e[n];
753
743
  return t;
@@ -757,7 +747,7 @@
757
747
 
758
748
  case "CUBICSPLINE":
759
749
  {
760
- const s = this.U(nt, e, n, 3 * r);
750
+ const s = this.U(tt, e, n, 3 * r);
761
751
  s && (t = this.C(t, s, e.input.array, 3 * r));
762
752
  break;
763
753
  }
@@ -768,21 +758,21 @@
768
758
  switch (e.interpolation) {
769
759
  case "LINEAR":
770
760
  {
771
- const r = this.U(nt, e, n, 1);
761
+ const r = this.U(tt, e, n, 1);
772
762
  r && T(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
773
763
  break;
774
764
  }
775
765
 
776
766
  case "STEP":
777
767
  {
778
- const r = this.U(nt, e, n, 1);
768
+ const r = this.U(tt, e, n, 1);
779
769
  r && (t = _(t, ...r.PREVIOUS));
780
770
  break;
781
771
  }
782
772
 
783
773
  case "CUBICSPLINE":
784
774
  {
785
- const r = this.U(nt, e, n, 3);
775
+ const r = this.U(tt, e, n, 3);
786
776
  if (r) {
787
777
  for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
788
778
  r.NEXT[t] = Math.acos(r.NEXT[t]);
@@ -833,8 +823,7 @@
833
823
  },
834
824
  getAnimationClip(t, e, n, r) {
835
825
  const s = t.nodes[e] && t.nodes[e].weights;
836
- c(Q, ...et.TRANSLATION), _(Y, ...et.ROTATION), c(tt, ...et.SCALE);
837
- return this.P(r, t, e, n, Q, Y, tt, s);
826
+ return c(W, ...Y.TRANSLATION), _(Z, ...Y.ROTATION), c(Q, ...Y.SCALE), this.P(r, t, e, n, W, Z, Q, s);
838
827
  },
839
828
  getTimeSpan(t) {
840
829
  if (!t.animations) return null;
@@ -859,27 +848,24 @@
859
848
  return n ? S(e) ? n[e] : n[Object.keys(n)[0]] : null;
860
849
  }
861
850
  };
862
- let st = !1;
851
+ let nt = !1;
863
852
  if ("undefined" != typeof OffscreenCanvas) {
864
853
  let t;
865
854
  try {
866
855
  t = new OffscreenCanvas(2, 2).getContext("2d");
867
- } catch (t) {}
868
- t && "undefined" != typeof createImageBitmap && (st = !0);
856
+ } catch (Qt) {}
857
+ t && "undefined" != typeof createImageBitmap && (nt = !0);
869
858
  }
870
- const it = "undefined" == typeof document ? null : document.createElement("canvas");
871
- class ot {
859
+ const rt = "undefined" == typeof document ? null : document.createElement("canvas");
860
+ class st {
872
861
  constructor(t, e, n) {
873
862
  if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
874
863
  e.buffer instanceof ArrayBuffer) {
875
- const {json: n, glbBuffer: r} = X.read(e.buffer, e.byteOffset, e.byteLength);
864
+ const {json: n, glbBuffer: r} = J.read(e.buffer, e.byteOffset, e.byteLength);
876
865
  this.F(t, n, r);
877
866
  } else this.F(t, e);
878
867
  this.D = new G(this.rootPath, this.gltf, this.glbBuffer), this.k();
879
868
  }
880
- abort() {
881
- this.adapter && this.adapter.abortRequests();
882
- }
883
869
  k() {
884
870
  const t = this.gltf.extensionsRequired;
885
871
  if (t) {
@@ -926,10 +912,10 @@
926
912
  return t;
927
913
  }
928
914
  static getAnimationClip(t, e, n, r) {
929
- return rt.getAnimationClip(t, e, n, r);
915
+ return et.getAnimationClip(t, e, n, r);
930
916
  }
931
917
  static getAnimationTimeSpan(t, e) {
932
- return rt.getTimeSpanByName(t, e);
918
+ return et.getTimeSpanByName(t, e);
933
919
  }
934
920
  static getTypedArrayCtor(t) {
935
921
  return I(t);
@@ -939,7 +925,7 @@
939
925
  }
940
926
  F(t, e, n) {
941
927
  this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
942
- this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = st ? ut : this.options.requestImage || at,
928
+ this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = nt ? ct : this.options.requestImage || it,
943
929
  this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new q(t, e, n, this.options.requestImage, this.options.decoders || {}, this.options.supportedFormats || {}),
944
930
  this.adapter.iterate((t, e, n) => {
945
931
  e.id = "buffer_" + n;
@@ -956,7 +942,7 @@
956
942
  }
957
943
  q(t, e) {
958
944
  if (t.children && t.children.length > 0) {
959
- if (!(n = t.children[0], "number" == typeof n && isFinite(n) || function(t) {
945
+ if (!("number" == typeof (n = t.children[0]) && isFinite(n) || function(t) {
960
946
  return !M(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
961
947
  }(t.children[0]))) return t;
962
948
  const r = t.children.map(t => {
@@ -1121,12 +1107,12 @@
1121
1107
  });
1122
1108
  }
1123
1109
  }
1124
- function at(t, e) {
1110
+ function it(t, e) {
1125
1111
  const n = new Image;
1126
1112
  n.crossOrigin = "", n.onload = () => {
1127
- if (!it) return void e(new Error("There is no canvas to draw image!"));
1128
- it.width = n.width, it.height = n.height;
1129
- const t = it.getContext("2d");
1113
+ if (!rt) return void e(new Error("There is no canvas to draw image!"));
1114
+ rt.width = n.width, rt.height = n.height;
1115
+ const t = rt.getContext("2d");
1130
1116
  t.drawImage(n, 0, 0, n.width, n.height);
1131
1117
  const r = t.getImageData(0, 0, n.width, n.height), s = {
1132
1118
  width: n.width,
@@ -1138,12 +1124,13 @@
1138
1124
  e(t);
1139
1125
  }, n.src = t;
1140
1126
  }
1141
- let ct, ht;
1142
- function ut(t, e) {
1143
- ct || (ct = new OffscreenCanvas(2, 2), ht = ct.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
1144
- const {width: n, height: r} = t;
1145
- ct.width = n, ct.height = r, ht.drawImage(t, 0, 0), t.close();
1146
- const s = ht.getImageData(0, 0, n, r);
1127
+ let ot, at;
1128
+ function ct(t, e) {
1129
+ ot || (ot = new OffscreenCanvas(2, 2), at = ot.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
1130
+ let {width: n, height: r} = t;
1131
+ ht(n) || (n = ut(n)), ht(r) || (r = ut(r)), ot.width = n, ot.height = r, at.drawImage(t, 0, 0, n, r),
1132
+ t.close();
1133
+ const s = at.getImageData(0, 0, n, r);
1147
1134
  e(null, {
1148
1135
  width: n,
1149
1136
  height: r,
@@ -1153,6 +1140,12 @@
1153
1140
  console.warn(t), e(t);
1154
1141
  });
1155
1142
  }
1143
+ function ht(t) {
1144
+ return 0 == (t & t - 1) && 0 !== t;
1145
+ }
1146
+ function ut(t) {
1147
+ return Math.pow(2, Math.floor(Math.log(t) / Math.LN2));
1148
+ }
1156
1149
  function ft(t) {
1157
1150
  return t / Math.PI * 180;
1158
1151
  }
@@ -1389,8 +1382,10 @@
1389
1382
  south: "down"
1390
1383
  }
1391
1384
  }[qt = "east"][$t = "north"], Ft[Xt = qt + $t] ? Jt = Ft[Xt] : (Jt = function(t, e, n) {
1392
- if (c = Vt, h = (o = t)[0], d = o[1], y = o[2], b = c[0], p = c[1], w = c[2], Math.abs(h - b) <= 1e-6 * Math.max(1, Math.abs(h), Math.abs(b)) && Math.abs(d - p) <= 1e-6 * Math.max(1, Math.abs(d), Math.abs(p)) && Math.abs(y - w) <= 1e-6 * Math.max(1, Math.abs(y), Math.abs(w))) a(kt, Rt[qt]),
1393
- a(zt, Rt[$t]), a(jt, Rt[Kt]); else if (Gt(t[0], 0, 1e-14) && Gt(t[1], 0, 1e-14)) {
1385
+ if (function(t, e) {
1386
+ var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
1387
+ return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(r - o) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(o)) && Math.abs(s - a) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(a));
1388
+ }(t, Vt)) a(kt, Rt[qt]), a(zt, Rt[$t]), a(jt, Rt[Kt]); else if (Gt(t[0], 0, 1e-14) && Gt(t[1], 0, 1e-14)) {
1394
1389
  var r = lt(t[2]);
1395
1390
  a(kt, Rt[qt]), "east" !== qt && "west" !== qt && f(kt, kt, r), a(zt, Rt[$t]), "east" !== $t && "west" !== $t && f(zt, zt, r),
1396
1391
  a(jt, Rt[Kt]), "east" !== Kt && "west" !== Kt && f(jt, jt, r);
@@ -1402,7 +1397,6 @@
1402
1397
  i[0] = -t[1], i[1] = t[0], i[2] = 0, l(Dt.east, i), m(Dt.north, s, i), f(Dt.down, Dt.up, -1),
1403
1398
  f(Dt.west, Dt.east, -1), f(Dt.south, Dt.north, -1), kt = Dt[qt], zt = Dt[$t], jt = Dt[Kt];
1404
1399
  }
1405
- var o, c, h, d, y, b, p, w;
1406
1400
  return n[0] = kt[0], n[1] = kt[1], n[2] = kt[2], n[3] = 0, n[4] = zt[0], n[5] = zt[1],
1407
1401
  n[6] = zt[2], n[7] = 0, n[8] = jt[0], n[9] = jt[1], n[10] = jt[2], n[11] = 0, n[12] = t[0],
1408
1402
  n[13] = t[1], n[14] = t[2], n[15] = 1, n;
@@ -1430,7 +1424,7 @@
1430
1424
  };
1431
1425
  class Yt {
1432
1426
  constructor(t, e, n) {
1433
- this.i = t, this.Y = e || ot, this.o = n, this.tt = {
1427
+ this.i = t, this.Y = e || st, this.o = n, this.tt = {
1434
1428
  "image/crn": Qt.crn && Qt.crn(),
1435
1429
  "image/ktx2": Qt.ktx2 && Qt.ktx2(),
1436
1430
  "image/cttf": Qt.ktx2 && Qt.ktx2(),
@@ -1525,7 +1519,7 @@
1525
1519
  }
1526
1520
  class te {
1527
1521
  constructor(t, e, n) {
1528
- this.i = t, this.Y = e || ot, this.o = n, this.tt = {
1522
+ this.i = t, this.Y = e || st, this.o = n, this.tt = {
1529
1523
  "image/crn": Qt.crn && Qt.crn(),
1530
1524
  "image/ktx2": Qt.ktx2 && Qt.ktx2(),
1531
1525
  "image/cttf": Qt.ktx2 && Qt.ktx2(),
@@ -1956,7 +1950,7 @@
1956
1950
  }
1957
1951
  class oe {
1958
1952
  constructor(t, e) {
1959
- this.i = t, this.Y = e || ot;
1953
+ this.i = t, this.Y = e || st;
1960
1954
  }
1961
1955
  load(t, e, n = 0, r = 0) {
1962
1956
  return e ? this.et(t, e, n, r) : z.getArrayBuffer(t, {}).then(e => {
@@ -2030,7 +2024,7 @@
2030
2024
  }
2031
2025
  function he(t, e) {
2032
2026
  let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
2033
- const a = t.array.buffer, c = n ? ot.getTypedArrayCtor(n) : t.array.constructor;
2027
+ const a = t.array.buffer, c = n ? st.getTypedArrayCtor(n) : t.array.constructor;
2034
2028
  if (r = void 0 === r ? t.array.byteOffset : r, s = s || 0, i = i || t.array.length / o,
2035
2029
  (!s || s === o * c.BYTES_PER_ELEMENT) && r % c.BYTES_PER_ELEMENT == 0) {
2036
2030
  const t = new c(a, r, i * o);
@@ -2062,7 +2056,7 @@
2062
2056
  this.bt = {}, r(null, {}, []);
2063
2057
  }
2064
2058
  pt(t) {
2065
- this.wt || (this._t = new se, this.wt = new Yt(this.dt, ot, t), this.gt = new te(this.dt, ot, t));
2059
+ this.wt || (this._t = new se, this.wt = new Yt(this.dt, st, t), this.gt = new te(this.dt, st, t));
2066
2060
  }
2067
2061
  requestImage(t, e) {
2068
2062
  me ? fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
@@ -2113,7 +2107,7 @@
2113
2107
  e(null, r, i);
2114
2108
  });
2115
2109
  } else if ("cmpt" === s) {
2116
- new oe(this.dt, ot).load(n, r).then(n => {
2110
+ new oe(this.dt, st).load(n, r).then(n => {
2117
2111
  const {content: r, transferables: s} = this.Ot(n, t);
2118
2112
  e(null, r, s);
2119
2113
  }).catch(t => {
@@ -2388,7 +2382,7 @@
2388
2382
  return !0;
2389
2383
  }
2390
2384
  function h(t, e) {
2391
- var n = e.slice(0, 3), r = t, s = e.slice(3), i = r[0], o = r[1], a = r[2], c = Math.abs(i * s[0] + o * s[3] + a * s[6]) + Math.abs(i * s[1] + o * s[4] + a * s[7]) + Math.abs(i * s[2] + o * s[5] + a * s[8]), h = l(t, n);
2385
+ var n = e, r = t, s = e, i = r[0], o = r[1], a = r[2], c = Math.abs(i * s[3] + o * s[6] + a * s[9]) + Math.abs(i * s[4] + o * s[7] + a * s[10]) + Math.abs(i * s[5] + o * s[8] + a * s[11]), h = l(t, n);
2392
2386
  return !(h <= -c);
2393
2387
  }
2394
2388
  function u(t) {
@@ -2397,8 +2391,8 @@
2397
2391
  f(i[3], o - r, u - c, y - d, _ - p), f(i[4], o - s, u - h, y - m, _ - w), f(i[5], o + s, u + h, y + m, _ + w);
2398
2392
  }
2399
2393
  function f(t, e, n, r, s) {
2400
- return t[0] = e * (1 / 6), t[1] = n * (1 / 6), t[2] = r * (1 / 6), t[3] = s * (1 / 6),
2401
- t;
2394
+ var i = 1 / Math.sqrt(e * e + n * n + r * r);
2395
+ return t[0] = e * i, t[1] = n * i, t[2] = r * i, t[3] = s * i, t;
2402
2396
  }
2403
2397
  function l(t, e) {
2404
2398
  return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] + t[3];
@@ -2556,7 +2550,7 @@
2556
2550
  E(), L(1, 0, 0), L(0, 1, 0), q(), q(), J = new I(9), I != Float32Array && (J[1] = 0,
2557
2551
  J[2] = 0, J[3] = 0, J[5] = 0, J[6] = 0, J[7] = 0), J[0] = 1, J[4] = 1, J[8] = 1;
2558
2552
  /*!
2559
- * @maptalks/gltf-loader v0.25.3
2553
+ * @maptalks/gltf-loader v0.25.5
2560
2554
  * LICENSE : UNLICENSED
2561
2555
  * (c) 2016-2022 maptalks.org
2562
2556
  */
@@ -2665,29 +2659,23 @@
2665
2659
  getArrayBuffer: (t, e = {}) => (e || (e = {}), e.responseType = "arraybuffer", ft.get(t, e)),
2666
2660
  getJSON: function(t, e = {}) {
2667
2661
  return e && e.jsonp ? ft.jsonp(t) : ((e = e || {}).responseType = "json", ft.get(t, e));
2662
+ },
2663
+ jsonp: function(t) {
2664
+ const e = "_maptalks_jsonp_" + X++;
2665
+ t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
2666
+ let n = document.createElement("script");
2667
+ return n.type = "text/javascript", n.src = t, new Promise(t => {
2668
+ window[e] = function(r) {
2669
+ document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
2670
+ t(r);
2671
+ }, document.getElementsByTagName("head")[0].appendChild(n);
2672
+ });
2668
2673
  }
2669
2674
  };
2670
- ft.jsonp = function(t) {
2671
- const e = "_maptalks_jsonp_" + X++;
2672
- t.match(/\?/) ? t += "&callback=" + e : t += "?callback=" + e;
2673
- let n = document.createElement("script");
2674
- return n.type = "text/javascript", n.src = t, new Promise(t => {
2675
- window[e] = function(r) {
2676
- document.getElementsByTagName("head")[0].removeChild(n), n = null, delete window[e],
2677
- t(r);
2678
- }, document.getElementsByTagName("head")[0].appendChild(n);
2679
- });
2680
- };
2681
2675
  class lt {
2682
2676
  constructor(t, e, n) {
2683
2677
  this.i = t, this.decoders = e, this.o = n, this.images = {}, this.h = {};
2684
2678
  }
2685
- abortRequests() {
2686
- for (const t in this.h) {
2687
- const e = this.h[t];
2688
- e && e.xhr && e.xhr.abort();
2689
- }
2690
- }
2691
2679
  requestImageFromBufferURI(t, e, n) {
2692
2680
  if (this.buffers[t.id]) {
2693
2681
  const r = this.buffers[t.id], s = this.u(e, r);
@@ -2724,8 +2712,7 @@
2724
2712
  requestExternalImage(t) {
2725
2713
  if (this.images[t.id]) return Promise.resolve(this.images[t.id]);
2726
2714
  const e = 0 === t.uri.indexOf("data:image/") ? t.uri : this.rootPath + "/" + t.uri;
2727
- if (this.h[t.id]) return this.h[t.id].then(() => this.images[t.id]);
2728
- return this.h[t.id] = this.l(t.id, e);
2715
+ return this.h[t.id] ? this.h[t.id].then(() => this.images[t.id]) : this.h[t.id] = this.l(t.id, e);
2729
2716
  }
2730
2717
  l(t, e) {
2731
2718
  return new Promise((n, r) => {
@@ -2788,8 +2775,7 @@
2788
2775
  });
2789
2776
  }
2790
2777
  g(t, e, n, r = 0) {
2791
- const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = Y(i.componentType), u = o.byteStride || 0;
2792
- const f = {
2778
+ const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = Y(i.componentType), u = o.byteStride || 0, f = {
2793
2779
  array: void 0,
2794
2780
  name: t,
2795
2781
  accessorName: e,
@@ -2903,7 +2889,7 @@
2903
2889
  r.instanceTechnique && r.instanceTechnique.values ? (s = r.instanceTechnique, i = s.values.diffuse) : (s = r,
2904
2890
  i = s.values.tex || s.values.diffuseTex || s.values.diffuse);
2905
2891
  const o = {
2906
- "baseColorTexture": {
2892
+ baseColorTexture: {
2907
2893
  index: i
2908
2894
  }
2909
2895
  };
@@ -3024,8 +3010,7 @@
3024
3010
  N(t, e) {
3025
3011
  const n = new Array(t.byteLength);
3026
3012
  for (let e = 0; e < t.byteLength; e++) n[e] = String.fromCharCode(t[e]);
3027
- n.join("");
3028
- return "data:" + (e = e || "image/png") + ";base64," + function(t) {
3013
+ return n.join(""), "data:" + (e = e || "image/png") + ";base64," + function(t) {
3029
3014
  return "undefined" != typeof self ? self.btoa(t) : window.btoa(t);
3030
3015
  }(unescape(encodeURIComponent(n)));
3031
3016
  }
@@ -3049,19 +3034,19 @@
3049
3034
  });
3050
3035
  }
3051
3036
  }
3052
- const pt = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null, wt = 1313821514, _t = 5130562;
3053
- class gt {
3037
+ const pt = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : null;
3038
+ class wt {
3054
3039
  static read(t, e = 0, n = 0) {
3055
3040
  n || (n = t.byteLength);
3056
3041
  const r = new DataView(t, e, n), s = r.getUint32(4, !0);
3057
- if (1 === s) return gt.readV1(r, e);
3058
- if (2 === s) return gt.readV2(t, e);
3042
+ if (1 === s) return wt.readV1(r, e);
3043
+ if (2 === s) return wt.readV2(t, e);
3059
3044
  throw new Error("Unsupported glb version : " + s);
3060
3045
  }
3061
3046
  static readV1(t, e) {
3062
3047
  const n = t.getUint32(8, !0), r = t.getUint32(12, !0);
3063
3048
  if (n !== t.byteLength) throw new Error("Length in GLB header is inconsistent with glb's byte length.");
3064
- const s = Tt(t.buffer, 20 + e, r);
3049
+ const s = _t(t.buffer, 20 + e, r);
3065
3050
  return {
3066
3051
  json: JSON.parse(s),
3067
3052
  glbBuffer: {
@@ -3079,7 +3064,7 @@
3079
3064
  const a = i.getUint32(o, !0);
3080
3065
  o += 4;
3081
3066
  const c = i.getUint32(o, !0);
3082
- if (o += 4, c === wt) n = Tt(t, e + 12 + o, a); else if (c === _t) {
3067
+ if (o += 4, 1313821514 === c) n = _t(t, e + 12 + o, a); else if (5130562 === c) {
3083
3068
  s = e + 12 + o, r = a;
3084
3069
  break;
3085
3070
  }
@@ -3095,7 +3080,7 @@
3095
3080
  };
3096
3081
  }
3097
3082
  }
3098
- function Tt(t, e, n) {
3083
+ function _t(t, e, n) {
3099
3084
  if (pt) {
3100
3085
  const r = new Uint8Array(t, e, n);
3101
3086
  return pt.decode(r);
@@ -3106,7 +3091,7 @@
3106
3091
  for (let r = 0; r < e; ) {
3107
3092
  let s = t[r++];
3108
3093
  if (128 & s) {
3109
- let n = At[s >> 3 & 7];
3094
+ let n = gt[s >> 3 & 7];
3110
3095
  if (!(64 & s) || !n || r + n > e) return null;
3111
3096
  for (s &= 63 >> n; n > 0; n -= 1) {
3112
3097
  const e = t[r++];
@@ -3119,29 +3104,28 @@
3119
3104
  return n;
3120
3105
  }(new Uint8Array(t, e, n));
3121
3106
  }
3122
- const At = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
3123
- const Ot = [ 0, 0, 0 ], vt = [ 0, 0, 0, 1 ], Mt = [ 1, 1, 1 ], St = {
3107
+ const gt = [ 1, 1, 1, 1, 2, 2, 3, 0 ], Tt = [ 0, 0, 0 ], At = [ 0, 0, 0, 1 ], Ot = [ 1, 1, 1 ], vt = {
3124
3108
  TRANSLATION: [ 0, 0, 0 ],
3125
3109
  ROTATION: [ 0, 0, 0, 1 ],
3126
3110
  SCALE: [ 1, 1, 1 ]
3127
- }, xt = {
3111
+ }, Mt = {
3128
3112
  PREVIOUS: null,
3129
3113
  NEXT: null,
3130
3114
  PREINDEX: null,
3131
3115
  NEXTINDEX: null,
3132
3116
  INTERPOLATION: null
3133
- }, It = {
3117
+ }, St = {
3134
3118
  P(t, e, n, r, s, i, o, a) {
3135
3119
  const c = Z(t) ? e.animations : [ e.animations[0] ], h = {};
3136
3120
  for (let e = 0; e < c.length; e++) {
3137
- const u = c[e];
3138
- if (Z(t) && u.name !== t) continue;
3139
- const f = u.channelsMap[n];
3140
- if (f) for (let t = 0; t < f.length; t++) {
3141
- const e = f[t];
3142
- "translation" === e.target.path ? (this.L(s, u.samplers[e.sampler], r, 1), h.translation = B(Ot, s)) : "rotation" === e.target.path ? (this.B(i, u.samplers[e.sampler], r, 1),
3143
- h.rotation = K(vt, i)) : "scale" === e.target.path ? (this.L(o, u.samplers[e.sampler], r, 1),
3144
- h.scale = B(Mt, o)) : "weights" === e.target.path && a && (this.L(a, u.samplers[e.sampler], r, a.length),
3121
+ const u = c[e], f = u.name || e;
3122
+ if (Z(t) && f !== t) continue;
3123
+ const l = u.channelsMap[n];
3124
+ if (l) for (let t = 0; t < l.length; t++) {
3125
+ const e = l[t];
3126
+ "translation" === e.target.path ? (this.L(s, u.samplers[e.sampler], r, 1), h.translation = B(Tt, s)) : "rotation" === e.target.path ? (this.B(i, u.samplers[e.sampler], r, 1),
3127
+ h.rotation = K(At, i)) : "scale" === e.target.path ? (this.L(o, u.samplers[e.sampler], r, 1),
3128
+ h.scale = B(Ot, o)) : "weights" === e.target.path && a && (this.L(a, u.samplers[e.sampler], r, a.length),
3145
3129
  h.weights = a);
3146
3130
  }
3147
3131
  }
@@ -3151,7 +3135,7 @@
3151
3135
  switch (e.interpolation) {
3152
3136
  case "LINEAR":
3153
3137
  {
3154
- const s = this.U(xt, e, n, 1 * r);
3138
+ const s = this.U(Mt, e, n, 1 * r);
3155
3139
  s && (t = function(t, e, n, r) {
3156
3140
  for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
3157
3141
  return t;
@@ -3161,7 +3145,7 @@
3161
3145
 
3162
3146
  case "STEP":
3163
3147
  {
3164
- const s = this.U(xt, e, n, 1 * r);
3148
+ const s = this.U(Mt, e, n, 1 * r);
3165
3149
  s && (t = function(t, e) {
3166
3150
  for (let n = 0; n < t.length; n++) t[n] = e[n];
3167
3151
  return t;
@@ -3171,7 +3155,7 @@
3171
3155
 
3172
3156
  case "CUBICSPLINE":
3173
3157
  {
3174
- const s = this.U(xt, e, n, 3 * r);
3158
+ const s = this.U(Mt, e, n, 3 * r);
3175
3159
  s && (t = this.C(t, s, e.input.array, 3 * r));
3176
3160
  break;
3177
3161
  }
@@ -3182,21 +3166,21 @@
3182
3166
  switch (e.interpolation) {
3183
3167
  case "LINEAR":
3184
3168
  {
3185
- const r = this.U(xt, e, n, 1);
3169
+ const r = this.U(Mt, e, n, 1);
3186
3170
  r && $(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
3187
3171
  break;
3188
3172
  }
3189
3173
 
3190
3174
  case "STEP":
3191
3175
  {
3192
- const r = this.U(xt, e, n, 1);
3176
+ const r = this.U(Mt, e, n, 1);
3193
3177
  r && (t = H(t, ...r.PREVIOUS));
3194
3178
  break;
3195
3179
  }
3196
3180
 
3197
3181
  case "CUBICSPLINE":
3198
3182
  {
3199
- const r = this.U(xt, e, n, 3);
3183
+ const r = this.U(Mt, e, n, 3);
3200
3184
  if (r) {
3201
3185
  for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
3202
3186
  r.NEXT[t] = Math.acos(r.NEXT[t]);
@@ -3247,8 +3231,7 @@
3247
3231
  },
3248
3232
  getAnimationClip(t, e, n, r) {
3249
3233
  const s = t.nodes[e] && t.nodes[e].weights;
3250
- U(Ot, ...St.TRANSLATION), H(vt, ...St.ROTATION), U(Mt, ...St.SCALE);
3251
- return this.P(r, t, e, n, Ot, vt, Mt, s);
3234
+ return U(Tt, ...vt.TRANSLATION), H(At, ...vt.ROTATION), U(Ot, ...vt.SCALE), this.P(r, t, e, n, Tt, At, Ot, s);
3252
3235
  },
3253
3236
  getTimeSpan(t) {
3254
3237
  if (!t.animations) return null;
@@ -3273,27 +3256,24 @@
3273
3256
  return n ? Z(e) ? n[e] : n[Object.keys(n)[0]] : null;
3274
3257
  }
3275
3258
  };
3276
- let Nt = !1;
3259
+ let xt = !1;
3277
3260
  if ("undefined" != typeof OffscreenCanvas) {
3278
3261
  let t;
3279
3262
  try {
3280
3263
  t = new OffscreenCanvas(2, 2).getContext("2d");
3281
- } catch (t) {}
3282
- t && "undefined" != typeof createImageBitmap && (Nt = !0);
3264
+ } catch (qn) {}
3265
+ t && "undefined" != typeof createImageBitmap && (xt = !0);
3283
3266
  }
3284
- const Et = "undefined" == typeof document ? null : document.createElement("canvas");
3285
- class Pt {
3267
+ const It = "undefined" == typeof document ? null : document.createElement("canvas");
3268
+ class Nt {
3286
3269
  constructor(t, e, n) {
3287
3270
  if (this.options = n || {}, this.options.decoders || (this.options.decoders = {}),
3288
3271
  e.buffer instanceof ArrayBuffer) {
3289
- const {json: n, glbBuffer: r} = gt.read(e.buffer, e.byteOffset, e.byteLength);
3272
+ const {json: n, glbBuffer: r} = wt.read(e.buffer, e.byteOffset, e.byteLength);
3290
3273
  this.F(t, n, r);
3291
3274
  } else this.F(t, e);
3292
3275
  this.D = new mt(this.rootPath, this.gltf, this.glbBuffer), this.k();
3293
3276
  }
3294
- abort() {
3295
- this.adapter && this.adapter.abortRequests();
3296
- }
3297
3277
  k() {
3298
3278
  const t = this.gltf.extensionsRequired;
3299
3279
  if (t) {
@@ -3340,10 +3320,10 @@
3340
3320
  return t;
3341
3321
  }
3342
3322
  static getAnimationClip(t, e, n, r) {
3343
- return It.getAnimationClip(t, e, n, r);
3323
+ return St.getAnimationClip(t, e, n, r);
3344
3324
  }
3345
3325
  static getAnimationTimeSpan(t, e) {
3346
- return It.getTimeSpanByName(t, e);
3326
+ return St.getTimeSpanByName(t, e);
3347
3327
  }
3348
3328
  static getTypedArrayCtor(t) {
3349
3329
  return Y(t);
@@ -3353,7 +3333,7 @@
3353
3333
  }
3354
3334
  F(t, e, n) {
3355
3335
  this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
3356
- this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = Nt ? Ct : this.options.requestImage || Lt,
3336
+ this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = xt ? Bt : this.options.requestImage || Et,
3357
3337
  this.options.transferable && (this.transferables = []), 2 === this.version ? (this.adapter = new bt(t, e, n, this.options.requestImage, this.options.decoders || {}, this.options.supportedFormats || {}),
3358
3338
  this.adapter.iterate((t, e, n) => {
3359
3339
  e.id = "buffer_" + n;
@@ -3370,7 +3350,7 @@
3370
3350
  }
3371
3351
  q(t, e) {
3372
3352
  if (t.children && t.children.length > 0) {
3373
- if (!(n = t.children[0], "number" == typeof n && isFinite(n) || function(t) {
3353
+ if (!("number" == typeof (n = t.children[0]) && isFinite(n) || function(t) {
3374
3354
  return !W(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
3375
3355
  }(t.children[0]))) return t;
3376
3356
  const r = t.children.map(t => {
@@ -3535,12 +3515,12 @@
3535
3515
  });
3536
3516
  }
3537
3517
  }
3538
- function Lt(t, e) {
3518
+ function Et(t, e) {
3539
3519
  const n = new Image;
3540
3520
  n.crossOrigin = "", n.onload = () => {
3541
- if (!Et) return void e(new Error("There is no canvas to draw image!"));
3542
- Et.width = n.width, Et.height = n.height;
3543
- const t = Et.getContext("2d");
3521
+ if (!It) return void e(new Error("There is no canvas to draw image!"));
3522
+ It.width = n.width, It.height = n.height;
3523
+ const t = It.getContext("2d");
3544
3524
  t.drawImage(n, 0, 0, n.width, n.height);
3545
3525
  const r = t.getImageData(0, 0, n.width, n.height), s = {
3546
3526
  width: n.width,
@@ -3552,12 +3532,13 @@
3552
3532
  e(t);
3553
3533
  }, n.src = t;
3554
3534
  }
3555
- let Bt, Ut;
3556
- function Ct(t, e) {
3557
- Bt || (Bt = new OffscreenCanvas(2, 2), Ut = Bt.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
3558
- const {width: n, height: r} = t;
3559
- Bt.width = n, Bt.height = r, Ut.drawImage(t, 0, 0), t.close();
3560
- const s = Ut.getImageData(0, 0, n, r);
3535
+ let Pt, Lt;
3536
+ function Bt(t, e) {
3537
+ Pt || (Pt = new OffscreenCanvas(2, 2), Lt = Pt.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
3538
+ let {width: n, height: r} = t;
3539
+ Ut(n) || (n = Ct(n)), Ut(r) || (r = Ct(r)), Pt.width = n, Pt.height = r, Lt.drawImage(t, 0, 0, n, r),
3540
+ t.close();
3541
+ const s = Lt.getImageData(0, 0, n, r);
3561
3542
  e(null, {
3562
3543
  width: n,
3563
3544
  height: r,
@@ -3567,6 +3548,12 @@
3567
3548
  console.warn(t), e(t);
3568
3549
  });
3569
3550
  }
3551
+ function Ut(t) {
3552
+ return 0 == (t & t - 1) && 0 !== t;
3553
+ }
3554
+ function Ct(t) {
3555
+ return Math.pow(2, Math.floor(Math.log(t) / Math.LN2));
3556
+ }
3570
3557
  const Rt = "undefined" == typeof document ? null : document.createElement("canvas");
3571
3558
  class Ft extends s.worker.Actor {
3572
3559
  constructor(t, e) {
@@ -3757,7 +3744,7 @@
3757
3744
  }
3758
3745
  function Gt(t, e, n) {
3759
3746
  let {componentType: r, byteOffset: s, byteStride: i, itemSize: o} = e;
3760
- const a = e.array.buffer, c = r ? Pt.getTypedArrayCtor(r) : e.array.constructor;
3747
+ const a = e.array.buffer, c = r ? Nt.getTypedArrayCtor(r) : e.array.constructor;
3761
3748
  if (s = void 0 === s ? e.array.byteOffset : s, i = i || 0, !i || i === o * c.BYTES_PER_ELEMENT && s % c.BYTES_PER_ELEMENT == 0) {
3762
3749
  const e = new c(a, s + n * o * c.BYTES_PER_ELEMENT, o);
3763
3750
  return t.set(e), t;
@@ -4007,8 +3994,10 @@
4007
3994
  south: "down"
4008
3995
  }
4009
3996
  }[Ne = "east"][Ee = "north"], ge[Be = Ne + Ee] ? Pe = ge[Be] : (Pe = function(t, e, n) {
4010
- if (a = Me, c = (o = t)[0], h = o[1], u = o[2], f = a[0], l = a[1], d = a[2], Math.abs(c - f) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(f)) && Math.abs(h - l) <= 1e-6 * Math.max(1, Math.abs(h), Math.abs(l)) && Math.abs(u - d) <= 1e-6 * Math.max(1, Math.abs(u), Math.abs(d))) B(Ae, _e[Ne]),
4011
- B(Oe, _e[Ee]), B(ve, _e[Le]); else if (Se(t[0], 0, 1e-14) && Se(t[1], 0, 1e-14)) {
3997
+ if (function(t, e) {
3998
+ var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
3999
+ return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(r - o) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(o)) && Math.abs(s - a) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(a));
4000
+ }(t, Me)) B(Ae, _e[Ne]), B(Oe, _e[Ee]), B(ve, _e[Le]); else if (Se(t[0], 0, 1e-14) && Se(t[1], 0, 1e-14)) {
4012
4001
  var r = _(t[2]);
4013
4002
  B(Ae, _e[Ne]), "east" !== Ne && "west" !== Ne && F(Ae, Ae, r), B(Oe, _e[Ee]), "east" !== Ee && "west" !== Ee && F(Oe, Oe, r),
4014
4003
  B(ve, _e[Le]), "east" !== Le && "west" !== Le && F(ve, ve, r);
@@ -4018,7 +4007,6 @@
4018
4007
  i[0] = -t[1], i[1] = t[0], i[2] = 0, D(Te.east, i), z(Te.north, s, i), F(Te.down, Te.up, -1),
4019
4008
  F(Te.west, Te.east, -1), F(Te.south, Te.north, -1), Ae = Te[Ne], Oe = Te[Ee], ve = Te[Le];
4020
4009
  }
4021
- var o, a, c, h, u, f, l, d;
4022
4010
  return n[0] = Ae[0], n[1] = Ae[1], n[2] = Ae[2], n[3] = 0, n[4] = Oe[0], n[5] = Oe[1],
4023
4011
  n[6] = Oe[2], n[7] = 0, n[8] = ve[0], n[9] = ve[1], n[10] = ve[2], n[11] = 0, n[12] = t[0],
4024
4012
  n[13] = t[1], n[14] = t[2], n[15] = 1, n;
@@ -4259,7 +4247,7 @@
4259
4247
  }, 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);
4260
4248
  !function(t, e) {
4261
4249
  let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
4262
- const a = t.array.buffer, c = n ? Pt.getTypedArrayCtor(n) : t.array.constructor;
4250
+ const a = t.array.buffer, c = n ? Nt.getTypedArrayCtor(n) : t.array.constructor;
4263
4251
  if (r = void 0 === r ? t.array.byteOffset : r, s = s || 0, i = i || t.array.length / o,
4264
4252
  (!s || s === o * c.BYTES_PER_ELEMENT) && r % c.BYTES_PER_ELEMENT == 0) {
4265
4253
  const t = new c(a, r, i * o);
@@ -5051,7 +5039,7 @@
5051
5039
  }
5052
5040
  }
5053
5041
  function wn(t, e) {
5054
- return 0 === t.ce && 0 === e.ce ? t.Ye - e.Ye : t.ce - e.ce;
5042
+ return t.ce - e.ce;
5055
5043
  }
5056
5044
  function _n(t, e, n) {
5057
5045
  return t[0] = e[n], t[1] = e[n + 3], t[2] = e[n + 6], t;
@@ -5061,23 +5049,23 @@
5061
5049
  var r = C(Tn, n, t), s = _n(An, e, 0), i = _n(On, e, 1), o = _n(vn, e, 2), a = G(s), c = G(i), h = G(o);
5062
5050
  D(s, s), D(i, i), D(o, o);
5063
5051
  var u = Mn;
5064
- u.x = k(r, s), u.y = k(r, i), u.z = k(r, o);
5052
+ u[0] = k(r, s), u[1] = k(r, i), u[2] = k(r, o);
5065
5053
  var f, l = 0;
5066
- u.x < -a ? (f = u.x + a, l += f * f) : u.x > a && (f = u.x - a, l += f * f);
5067
- u.y < -c ? (f = u.y + c, l += f * f) : u.y > c && (f = u.y - c, l += f * f);
5068
- u.z < -h ? (f = u.z + h, l += f * f) : u.z > h && (f = u.z - h, l += f * f);
5054
+ u[0] < -a ? (f = u[0] + a, l += f * f) : u[0] > a && (f = u[0] - a, l += f * f);
5055
+ u[1] < -c ? (f = u[1] + c, l += f * f) : u[1] > c && (f = u[1] - c, l += f * f);
5056
+ u[2] < -h ? (f = u[2] + h, l += f * f) : u[2] > h && (f = u[2] - h, l += f * f);
5069
5057
  return l;
5070
5058
  }(t, e, n));
5071
5059
  }
5072
5060
  const Tn = [], An = [], On = [], vn = [], Mn = [];
5073
- const Sn = s.projection.EPSG3857, xn = new s.Extent(0, 0, 0, 0), In = new s.Extent(0, 0, 0, 0), Nn = [], En = [], Pn = [], Ln = [], Bn = new s.Point(0, 0), Un = [], Cn = new s.Coordinate(0, 0), Rn = n.mat4.identity([]);
5074
- class Fn extends s.Layer {
5061
+ const Sn = s.projection.EPSG3857, xn = new s.Extent(0, 0, 0, 0), In = new s.Extent(0, 0, 0, 0), Nn = [], En = [], Pn = [], Ln = [], Bn = new s.Point(0, 0), Un = new s.Coordinate(0, 0), Cn = new s.Coordinate(0, 0), Rn = [], Fn = new s.Coordinate(0, 0), Dn = n.mat4.identity([]);
5062
+ class kn extends s.Layer {
5075
5063
  constructor(t, e) {
5076
- super(t, e), this.tn(), this.bt = {}, this.en = {};
5064
+ super(t, e), this.Ye(), this.bt = {}, this.tn = [];
5077
5065
  }
5078
- tn() {
5066
+ Ye() {
5079
5067
  let t = this.options.services.map(t => t.url);
5080
- this.nn = t.map((t, e) => function(t, e) {
5068
+ this.en = t.map((t, e) => function(t, e) {
5081
5069
  t = w(t);
5082
5070
  return {
5083
5071
  baseUrl: t.substring(0, t.lastIndexOf("/")) + "/",
@@ -5090,22 +5078,22 @@
5090
5078
  qe: 0
5091
5079
  };
5092
5080
  }(t, e)), this.fire("rootready", {
5093
- roots: this.nn.slice(0)
5081
+ roots: this.en.slice(0)
5094
5082
  });
5095
5083
  }
5096
5084
  getExtent(t) {
5097
5085
  if (!t && 0 !== t) {
5098
5086
  const t = new s.Extent;
5099
- for (let e = 0; e < this.nn.length; e++) if (this.nn[e].boundingVolume) {
5100
- const n = this.boundingVolumeToExtent(this.nn[e]);
5087
+ for (let e = 0; e < this.en.length; e++) if (this.en[e].boundingVolume) {
5088
+ const n = this.boundingVolumeToExtent(this.en[e]);
5101
5089
  t._combine(n);
5102
5090
  }
5103
5091
  return t;
5104
5092
  }
5105
- return this.nn[t] && this.nn[t].boundingVolume ? this.boundingVolumeToExtent(this.nn[t]) : null;
5093
+ return this.en[t] && this.en[t].boundingVolume ? this.boundingVolumeToExtent(this.en[t]) : null;
5106
5094
  }
5107
5095
  boundingVolumeToExtent(t) {
5108
- const e = t.boundingVolume.rn ? Rn : t.matrix, r = this.getMap();
5096
+ const e = t.boundingVolume.nn ? Dn : t.matrix, r = this.getMap();
5109
5097
  if (t.boundingVolume.region) {
5110
5098
  const e = t.boundingVolume.region;
5111
5099
  return new s.Extent(p(e[0]), p(e[1]), p(e[2]), p(e[3]));
@@ -5123,50 +5111,48 @@
5123
5111
  return null;
5124
5112
  }
5125
5113
  getRootTiles() {
5126
- return this.nn;
5114
+ return this.en;
5127
5115
  }
5128
5116
  getTiles() {
5129
- return this.getRenderer().ready ? this.sn() : (this.in(), {
5117
+ if (!this.getRenderer().ready) return this.rn(), {
5130
5118
  tiles: Ln
5131
- });
5132
- }
5133
- sn() {
5119
+ };
5134
5120
  const t = this.getMap(), e = t.cameraPosition;
5135
5121
  let r, s;
5136
- if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), Cn.set(e[0], e[1]),
5137
- r = t.pointToCoord(Cn, t.getGLZoom()); else {
5122
+ if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), Fn.set(e[0], e[1]),
5123
+ r = t.pointToCoord(Fn, t.getGLZoom()); else {
5138
5124
  const n = t.getGLRes();
5139
- s = t.pointAtResToDistance(e[2], 0, n), Cn.set(e[0], e[1]), r = t.pointAtResToCoord(Cn, n);
5125
+ s = t.pointAtResToDistance(e[2], 0, n), Fn.set(e[0], e[1]), r = t.pointAtResToCoord(Fn, n);
5140
5126
  }
5141
- this.an = this.an || [], n.vec3.set(this.an, b(r.x), b(r.y), s), this.cn = Kt(this.cn || [], this.an[0], this.an[1], this.an[2]),
5142
- this.hn = 2 * Math.tan(.5 * b(t.getFov())), this.un = Sn.project(r).toArray();
5127
+ this.sn = this.sn || [], n.vec3.set(this.sn, b(r.x), b(r.y), s), this.in = Kt(this.in || [], this.sn[0], this.sn[1], this.sn[2]),
5128
+ this.an = 2 * Math.tan(.5 * b(t.getFov())), this.cn = Sn.project(r).toArray();
5143
5129
  const i = t.projViewMatrix, o = {
5144
5130
  children: [],
5145
5131
  level: -1
5146
5132
  };
5147
5133
  let a = o;
5148
5134
  const c = [];
5149
- for (let t = 0; t < this.nn.length; t++) {
5135
+ for (let t = 0; t < this.en.length; t++) {
5150
5136
  let e = 1 / 0;
5151
- const n = [ this.nn[t] ], r = this.ln(t);
5137
+ const n = [ this.en[t] ], r = this.hn(t);
5152
5138
  for (;n.length > 0; ) {
5153
5139
  const t = n.pop();
5154
- for (t.id || this.dn(t); a.level >= t.qe; ) a = a.parent;
5155
- const s = this.mn(t, r, i);
5140
+ for (t.id || this.un(t); a.level >= t.qe; ) a = a.parent;
5141
+ const s = this.ln(t, r, i);
5156
5142
  if (s < 1) {
5157
5143
  let n = a;
5158
5144
  for (;n && !n.content; ) n = n.parent;
5159
- 0 === s && n && n.content && this.yn(c, n);
5145
+ 0 === s && n && n.content && this.dn(c, n);
5160
5146
  if (!1 === this.options.services[t.te].alwaysShow) continue;
5161
5147
  if (!(0 === s && t.qe <= e)) continue;
5162
5148
  t.content && (e = t.qe);
5163
5149
  }
5164
- t.ce < 1 / 0 && this.bn(t);
5150
+ t.ce < 1 / 0 && this.mn(t);
5165
5151
  const o = this.$e(t, a);
5166
5152
  a.children.push(o);
5167
5153
  const h = t.children, u = h && h.length, f = o.content;
5168
- if (!u && f && this.yn(c, o), u) {
5169
- f && "add" === t.refine && this.yn(c, o), a = o;
5154
+ if (!u && f && this.dn(c, o), u) {
5155
+ f && "add" === t.refine && this.dn(c, o), a = o;
5170
5156
  const e = h[0].parent;
5171
5157
  for (let r = 0, s = h.length; r < s; r++) {
5172
5158
  if (!e) {
@@ -5184,15 +5170,15 @@
5184
5170
  tiles: c
5185
5171
  };
5186
5172
  }
5187
- yn(t, e) {
5173
+ dn(t, e) {
5188
5174
  const {viewerRequestVolume: n} = e.node;
5189
5175
  n && !function(t, e, n) {
5190
5176
  if (n.region) {
5191
5177
  const e = n.region;
5192
5178
  if (t[0] >= e[0] && t[0] <= e[2] && t[1] >= e[1] && t[1] <= e[3]) return !0;
5193
5179
  } else {
5194
- if (n.sphere) return Dn(n, e);
5195
- if (n.box) return 0 === kn(n, e);
5180
+ if (n.sphere) return zn(n, e);
5181
+ if (n.box) return 0 === jn(n, e);
5196
5182
  }
5197
5183
  return !1;
5198
5184
  }
@@ -5200,7 +5186,7 @@
5200
5186
  * @maptalks/gl v0.65.0
5201
5187
  * LICENSE : UNLICENSED
5202
5188
  * (c) 2016-2022 maptalks.com
5203
- */ (this.an, this.cn, n) || t.push(e);
5189
+ */ (this.sn, this.in, n) || t.push(e);
5204
5190
  }
5205
5191
  $e(t, e) {
5206
5192
  return {
@@ -5212,37 +5198,36 @@
5212
5198
  content: t.content && t.content.url
5213
5199
  };
5214
5200
  }
5215
- dn(t) {
5216
- t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]), t.pn = this.wn(t),
5201
+ un(t) {
5202
+ t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]), t.yn = this.bn(t),
5217
5203
  t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix), t.te = t.parent.te,
5218
5204
  void 0 === t.qe && (t.qe = t.parent.qe + 1), t.maxExtent = t.parent.maxExtent),
5219
5205
  t.refine = t.refine && t.refine.toLowerCase() || "replace", t.content && !t.content.url && t.content.uri && (t.content.url = t.content.uri),
5220
- this._n(t);
5206
+ this.pn(t);
5221
5207
  }
5222
- _n(t) {
5208
+ pn(t) {
5223
5209
  const e = t.boundingVolume;
5224
- if (!e || e.rn) return;
5210
+ if (!e || e.nn) return;
5225
5211
  const r = this.options.services[t.te].heightOffset || 0, s = this.options.offset, i = y(s) || s[0] || s[1];
5226
- if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, Rn) && !i) return;
5212
+ if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, Dn) && !i) return;
5227
5213
  const {region: o, box: a, sphere: c} = e;
5228
5214
  if (o) {
5229
- const t = this.gn([ p(o[0]), p(o[1]) ]);
5215
+ const t = this.wn([ p(o[0]), p(o[1]) ]);
5230
5216
  o[0] = b(t.x), o[1] = b(t.y);
5231
- const e = this.gn([ p(o[2]), p(o[3]) ]);
5217
+ const e = this.wn([ p(o[2]), p(o[3]) ]);
5232
5218
  o[2] = b(e.x), o[3] = b(e.y), o[4] += r, o[5] += r;
5233
5219
  } else if (a || c) {
5234
- const e = a || c, s = n.vec3.transformMat4(Nn, e, t.matrix), i = te(En, s), o = this.gn([ i[0], i[1] ]);
5220
+ const e = a || c, s = n.vec3.transformMat4(Nn, e, t.matrix), i = te(En, s), o = this.wn([ i[0], i[1] ]);
5235
5221
  i[0] = o.x, i[1] = o.y, i[2] += r, Kt(e, b(i[0]), b(i[1]), i[2]);
5236
5222
  }
5237
- e.rn = !0;
5223
+ e.nn = !0;
5238
5224
  }
5239
- wn(t) {
5225
+ bn(t) {
5240
5226
  return void 0 === t.geometricError || !t.boundingVolume;
5241
5227
  }
5242
- bn(t) {
5228
+ mn(t) {
5243
5229
  let e = t.parent;
5244
- for (;e && e.pn && !(e.ce <= t.ce && e.Ye <= t.Ye); ) e.ce = t.ce, e.Ye = t.Ye,
5245
- e = t.parent;
5230
+ for (;e && e.yn && !(e.ce <= t.ce); ) e.ce = t.ce, e = t.parent;
5246
5231
  }
5247
5232
  onTilesetLoad(t, e, r) {
5248
5233
  if (!t) return void console.warn("invalid tileset at : " + r);
@@ -5252,55 +5237,52 @@
5252
5237
  m(e, t.root), e.refine = e.refine && e.refine.toLowerCase() || "replace", r && (e.boundingVolume = r);
5253
5238
  const s = t.root.transform;
5254
5239
  s && (e.parent ? e.matrix = n.mat4.multiply([], e.parent.matrix, s) : e.matrix = s),
5255
- this._n(e), e.Tn = e.content, delete e.content, t.root.content && (e.content = t.root.content),
5256
- e.pn = this.wn(e);
5240
+ this.pn(e), e._n = e.content, delete e.content, t.root.content && (e.content = t.root.content),
5241
+ e.yn = this.bn(e);
5257
5242
  const i = e.content && (e.content.url || e.content.uri);
5258
5243
  i && e.content.uri && (e.content.url = e.content.uri, delete e.content.uri), i && !M(i) && -1 === i.indexOf("http://") && -1 === i.indexOf("https://") && (e.content.url = e.baseUrl + i);
5259
5244
  }
5260
- this.in(), this.fire("loadtileset", {
5245
+ this.rn(), this.fire("loadtileset", {
5261
5246
  tileset: t,
5262
5247
  index: e.te,
5263
5248
  url: r
5264
5249
  });
5265
5250
  }
5266
- mn(t, e, n) {
5267
- if (t.ce = 1 / 0, 0 === t.qe || t.pn) return 1;
5268
- if (!this.An(t, e, n)) return -1;
5251
+ ln(t, e, n) {
5252
+ if (t.ce = 1 / 0, 0 === t.qe || t.yn) return 1;
5253
+ if (!this.gn(t, e, n)) return -1;
5269
5254
  if (0 === t.geometricError) return 1;
5270
5255
  let r = this.options.services[t.te].maximumScreenSpaceError;
5271
5256
  null == r && (r = 8);
5272
- let s = this.On(t);
5273
- return 0 === s && t.parent && (s = .5 * (t.parent.vn || 0)), s >= r ? 1 : 0;
5257
+ let s = this.Tn(t);
5258
+ return 0 === s && t.parent && (s = .5 * (t.parent.An || 0)), s >= r ? 1 : 0;
5274
5259
  }
5275
5260
  ye(t, e) {
5276
5261
  e || (e = new s.Point(0, 0));
5277
5262
  const n = this.getMap();
5278
5263
  return n.getGLZoom ? n.coordToPoint(t, n.getGLZoom(), e) : n.coordToPointAtRes(t, n.getGLRes(), e);
5279
5264
  }
5280
- An(t, e, r) {
5281
- if (!this.getMap()) return !1;
5265
+ gn(t, e, r) {
5282
5266
  const o = t.id;
5283
- let a = this.en[o];
5284
- const {boundingVolume: f} = t;
5285
- if (!f) return !1;
5286
- const {sphere: d, region: m, box: y} = f;
5267
+ let a = this.tn[o];
5268
+ const {boundingVolume: f} = t, d = f.sphere, m = f.region, y = f.box;
5287
5269
  if (!a) {
5288
5270
  let e, r, i;
5289
5271
  if (m) {
5290
5272
  e = xn.set(p(m[0]), p(m[1]), p(m[2]), p(m[3]));
5291
- const t = e.getCenter(), n = this.Mn(t);
5292
- e = e.convertTo(t => this.ye(t, Bn), In), i = m[4], r = m[5], a = this.en[o] = [ [ e.xmin, e.ymin, i * n[2] ], [ e.xmax, e.ymax, r * n[2] ] ],
5273
+ const t = e.getCenter(), n = this.On(t);
5274
+ e = e.convertTo(t => this.ye(t, Bn), In), i = m[4], r = m[5], a = this.tn[o] = [ [ e.xmin, e.ymin, i * n[2] ], [ e.xmax, e.ymax, r * n[2] ] ],
5293
5275
  a.center = t;
5294
5276
  } else if (d) {
5295
- const t = te(Nn, d), e = new s.Coordinate(t), n = this.ye(e, Bn).toArray(), r = this.Mn(e);
5296
- n.push(t[2] * r[2]), a = this.en[o] = [ n, d[3] * r[2] ], a.center = e;
5277
+ const t = te(Nn, d), e = new s.Coordinate(t), n = this.ye(e, Bn).toArray(), r = this.On(e);
5278
+ n.push(t[2] * r[2]), a = this.tn[o] = [ n, d[3] * r[2] ], a.center = e;
5297
5279
  } else if (y) {
5298
- const e = te(Nn, y), r = new s.Coordinate(e), i = this.ye(r, Bn).toArray(), c = this.Mn(r);
5280
+ const e = te(Nn, y), r = new s.Coordinate(e), i = this.ye(r, Bn).toArray(), c = this.On(r);
5299
5281
  i.push(e[2] * c[2]);
5300
5282
  const h = y.slice(3);
5301
- n.mat4.exactEquals(t.matrix, Rn) || n.mat3.multiply(h, n.mat3.fromMat4(Un, t.matrix), h);
5283
+ n.mat4.exactEquals(t.matrix, Dn) || n.mat3.multiply(h, n.mat3.fromMat4(Rn, t.matrix), h);
5302
5284
  for (let t = 0; t < h.length; t++) h[t] *= c[t % 3], y[3 + t] = h[t];
5303
- a = this.en[o] = [ ...i, ...h ], a.center = r;
5285
+ a = this.tn[o] = [ ...i, ...h ], a.center = r;
5304
5286
  }
5305
5287
  }
5306
5288
  if (e) {
@@ -5327,11 +5309,11 @@
5327
5309
  return !0;
5328
5310
  }(r, a);
5329
5311
  }
5330
- Mn(t) {
5312
+ On(t) {
5331
5313
  const e = this.getMap(), r = e.distanceToPointAtRes(100, 100, e.getGLRes(), t);
5332
5314
  return n.vec3.set(Pn, r.x / 100 * 1.01, r.y / 100 * 1.01, r.y / 100), Pn;
5333
5315
  }
5334
- gn(t) {
5316
+ wn(t) {
5335
5317
  Array.isArray(t) && (t = new s.Coordinate(t));
5336
5318
  let e = this.options.offset;
5337
5319
  if (y(e) && (e = e(Array.isArray(t) ? new s.Coordinate(t) : t)), e[0] || e[1]) {
@@ -5340,64 +5322,58 @@
5340
5322
  }
5341
5323
  return t;
5342
5324
  }
5343
- ln(t) {
5325
+ hn(t) {
5344
5326
  const e = this.options.services[t].maxExtent;
5345
5327
  if (!e) return null;
5346
- const n = this.nn[t];
5328
+ const n = this.en[t];
5347
5329
  return n.maxExtent || (n.maxExtent = new s.Extent(e).convertTo(t => this.ye(t))),
5348
5330
  n.maxExtent;
5349
5331
  }
5350
- On(t) {
5351
- const e = this.hn, r = t.geometricError;
5352
- if (0 === r) return 0;
5353
- const s = this.getMap();
5354
- let i, o;
5332
+ Tn(t) {
5333
+ const e = this.an, n = t.geometricError;
5334
+ if (0 === n) return 0;
5335
+ const r = this.getMap();
5336
+ let s;
5355
5337
  if (t.boundingVolume.region) {
5356
- const e = this.en[t.id].center, r = (s.getGLZoom ? s.distanceToPoint(100, 0, s.getGLZoom(), e) : s.distanceToPointAtRes(100, 0, s.getGLRes(), e)).x / 100;
5357
- i = function(t, e, n, r) {
5338
+ const e = this.tn[t.id].center, n = (r.getGLZoom ? r.distanceToPoint(100, 0, r.getGLZoom(), e) : r.distanceToPointAtRes(100, 0, r.getGLRes(), e)).x / 100;
5339
+ s = function(t, e, n, r) {
5358
5340
  const s = t.boundingVolume.region;
5359
- let i = t.Sn;
5360
- i || (i = t.Sn = [ Vn(s[0], s[1]), Vn(s[0], s[3]), Vn(s[2], s[1]), Vn(s[2], s[3]), Vn(s[0], s[1]), Vn(s[0], s[3]), Vn(s[2], s[1]), Vn(s[2], s[3]) ],
5361
- t.xn = [ Math.min.apply(Math, i.map(t => t[0])), Math.min.apply(Math, i.map(t => t[1])) ],
5362
- t.In = [ Math.max.apply(Math, i.map(t => t[0])), Math.max.apply(Math, i.map(t => t[1])) ]);
5341
+ let i = t.vn;
5342
+ i || (i = t.vn = [ Vn(s[0], s[1]), Vn(s[0], s[3]), Vn(s[2], s[1]), Vn(s[2], s[3]), Vn(s[0], s[1]), Vn(s[0], s[3]), Vn(s[2], s[1]), Vn(s[2], s[3]) ],
5343
+ t.Mn = [ Math.min.apply(Math, i.map(t => t[0])), Math.min.apply(Math, i.map(t => t[1])) ],
5344
+ t.Sn = [ Math.max.apply(Math, i.map(t => t[0])), Math.max.apply(Math, i.map(t => t[1])) ]);
5363
5345
  if (n[0] >= s[0] && n[0] <= s[2] && n[1] >= s[1] && n[1] <= s[3]) return n[2] <= s[5] ? 0 : n[2] - s[5];
5364
- const o = (a = t.xn, c = t.In, h = e, u = Math.max(a[0] - h[0], 0, h[0] - c[0]),
5346
+ const o = (a = t.Mn, c = t.Sn, h = e, u = Math.max(a[0] - h[0], 0, h[0] - c[0]),
5365
5347
  f = Math.max(a[1] - h[1], 0, h[1] - c[1]), Math.sqrt(u * u + f * f) / r);
5366
5348
  var a, c, h, u, f;
5367
5349
  let l = 0;
5368
5350
  n[2] > s[5] && (l = n[2] - s[5]);
5369
5351
  return Math.sqrt(o * o + l * l);
5370
- }(t, this.un, this.an, r), o = function(t, e) {
5371
- const r = t.boundingVolume.region, s = Kt(zn, r[0], r[1], r[4]), i = Kt(jn, r[2], r[3], r[5]), o = n.vec3.scale(s, n.vec3.add(s, s, i), .5);
5372
- return n.vec3.dist(o, e);
5373
- }(t, this.cn);
5374
- } else t.boundingVolume.sphere ? (i = Dn(t.boundingVolume, this.cn), o = function(t, e) {
5375
- const r = t.boundingVolume.sphere;
5376
- return n.vec3.dist(r, e);
5377
- }(t, this.cn)) : t.boundingVolume.box && (i = kn(t.boundingVolume, this.cn), o = function(t, e) {
5378
- const r = t.boundingVolume.box;
5379
- return n.vec3.dist(r, e);
5380
- }(t, this.cn));
5381
- const a = Math.max(Math.abs(i), 1e-7), c = r * s.height / (a * e);
5382
- return t.ce = i, t.Ye = o, t.vn = c, c;
5383
- }
5384
- in() {
5352
+ }(t, this.cn, this.sn, n);
5353
+ } else t.boundingVolume.sphere ? s = zn(t.boundingVolume, this.in) : t.boundingVolume.box && (s = jn(t.boundingVolume, this.in));
5354
+ const i = Math.max(Math.abs(s), 1e-7), o = n * r.height / (i * e);
5355
+ return t.ce = s, t.An = o, o;
5356
+ }
5357
+ rn() {
5385
5358
  const t = this.getRenderer();
5386
5359
  t && t.setToRedraw();
5387
5360
  }
5388
5361
  Me(t) {
5389
- return this.en[t];
5362
+ return this.tn[t];
5390
5363
  }
5391
5364
  }
5392
- function Dn(t, e) {
5365
+ function zn(t, e) {
5393
5366
  const r = t.sphere, s = n.vec3.dist(r, e), i = t.sphere[3];
5394
5367
  return s < i ? 0 : s - i;
5395
5368
  }
5396
- function kn(t, e) {
5397
- const n = t.box;
5398
- return gn(n.slice(0, 3), n.slice(3), e);
5369
+ function jn(t, e) {
5370
+ const r = t.box;
5371
+ return gn(n.vec3.set(Nn, r[0], r[1], r[2]), n.mat3.set(Rn, r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11]), e);
5372
+ }
5373
+ function Vn(t, e) {
5374
+ return Un.x = p(t), Un.y = p(e), Sn.project(Un, Cn).toArray();
5399
5375
  }
5400
- Fn.mergeOptions({
5376
+ kn.mergeOptions({
5401
5377
  "maxGPUMemory": 512,
5402
5378
  "retireInterval": 2e3,
5403
5379
  "loadingLimitOnInteracting": 5,
@@ -5413,12 +5389,7 @@
5413
5389
  "sRGBTolinear": !1,
5414
5390
  "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" ],
5415
5391
  "offset": [ 0, 0 ]
5416
- }), Fn.registerRenderer("gl", pn);
5417
- const zn = [], jn = [];
5418
- function Vn(t, e) {
5419
- const n = new s.Coordinate(p(t), p(e));
5420
- return Sn.project(n).toArray();
5421
- }
5392
+ }), kn.registerRenderer("gl", pn);
5422
5393
  const Gn = function() {
5423
5394
  if ("undefined" != typeof self) return self;
5424
5395
  if ("undefined" != typeof window) return window;
@@ -5437,7 +5408,7 @@
5437
5408
  };
5438
5409
  class $n {
5439
5410
  constructor(t, e, n) {
5440
- this.i = t, this.Y = e || Pt, this.o = n, this.tt = {
5411
+ this.i = t, this.Y = e || Nt, this.o = n, this.tt = {
5441
5412
  "image/crn": qn.crn && qn.crn(),
5442
5413
  "image/ktx2": qn.ktx2 && qn.ktx2(),
5443
5414
  "image/cttf": qn.ktx2 && qn.ktx2(),
@@ -5532,7 +5503,7 @@
5532
5503
  }
5533
5504
  class Jn {
5534
5505
  constructor(t, e, n) {
5535
- this.i = t, this.Y = e || Pt, this.o = n, this.tt = {
5506
+ this.i = t, this.Y = e || Nt, this.o = n, this.tt = {
5536
5507
  "image/crn": qn.crn && qn.crn(),
5537
5508
  "image/ktx2": qn.ktx2 && qn.ktx2(),
5538
5509
  "image/cttf": qn.ktx2 && qn.ktx2(),
@@ -5961,7 +5932,7 @@
5961
5932
  }
5962
5933
  class Yn {
5963
5934
  constructor(t, e) {
5964
- this.i = t, this.Y = e || Pt;
5935
+ this.i = t, this.Y = e || Nt;
5965
5936
  }
5966
5937
  load(t, e, n = 0, r = 0) {
5967
5938
  return e ? this.et(t, e, n, r) : ft.getArrayBuffer(t, {}).then(e => {
@@ -6011,9 +5982,9 @@
6011
5982
  return o;
6012
5983
  }
6013
5984
  }
6014
- t.B3DMLoader = $n, t.CMPTLoader = Yn, t.Geo3DTilesLayer = Fn, t.Geo3DTilesUtil = x,
5985
+ t.B3DMLoader = $n, t.CMPTLoader = Yn, t.Geo3DTilesLayer = kn, t.Geo3DTilesUtil = x,
6015
5986
  t.Geo3DTransform = oe, Object.defineProperty(t, "t", {
6016
5987
  value: !0
6017
5988
  });
6018
- })), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.12.6");
5989
+ })), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.12.7");
6019
5990
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptalks/3dtiles",
3
- "version": "0.12.6",
3
+ "version": "0.12.7",
4
4
  "description": "3d tiles layer for maptalks",
5
5
  "main": "dist/maptalks.3dtiles.js",
6
6
  "module": "dist/maptalks.3dtiles.es.js",
@@ -35,8 +35,8 @@
35
35
  },
36
36
  "homepage": "https://github.com/fuzhenn/3dtiles-issues/",
37
37
  "dependencies": {
38
- "@maptalks/gltf-loader": "^0.25.3",
39
- "frustum-intersects": "^0.2.0",
38
+ "@maptalks/gltf-loader": "^0.25.5",
39
+ "frustum-intersects": "^0.2.2",
40
40
  "gl-matrix": "^2.6.1"
41
41
  },
42
42
  "devDependencies": {