@maptalks/3dtiles 0.12.4 → 0.12.5

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,8 +1,30 @@
1
1
  /*!
2
- * @maptalks/3dtiles v0.12.4
2
+ * @maptalks/3dtiles v0.12.5
3
3
  * LICENSE : UNLICENSED
4
4
  * (c) 2016-2022 maptalks.com
5
5
  */
6
+ /*!
7
+ * Cesium - https://github.com/AnalyticalGraphicsInc/cesium
8
+ *
9
+ * Copyright 2011-2017 Cesium Contributors
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ *
23
+ * Columbus View (Pat. Pend.)
24
+ *
25
+ * Portions licensed separately.
26
+ * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
27
+ */
6
28
  !function(t, e) {
7
29
  "object" == typeof exports && "undefined" != typeof module ? e(require("maptalks"), require("@maptalks/gl")) : "function" == typeof define && define.amd ? define([ "maptalks", "@maptalks/gl" ], e) : e((t = "undefined" != typeof globalThis ? globalThis : t || self).maptalks, t.maptalksgl);
8
30
  }(this, (function(t, e) {
@@ -250,6 +272,12 @@
250
272
  constructor(t, e, n) {
251
273
  this.i = t, this.decoders = e, this.o = n, this.images = {}, this.h = {};
252
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
+ }
253
281
  requestImageFromBufferURI(t, e, n) {
254
282
  if (this.buffers[t.id]) {
255
283
  const r = this.buffers[t.id], s = this.u(e, r);
@@ -678,7 +706,7 @@
678
706
  }(new Uint8Array(t, e, n));
679
707
  }
680
708
  const Z = [ 1, 1, 1, 1, 2, 2, 3, 0 ];
681
- const Y = [ 0, 0, 0 ], Q = [ 0, 0, 0, 1 ], tt = [ 1, 1, 1 ], et = {
709
+ const Q = [ 0, 0, 0 ], Y = [ 0, 0, 0, 1 ], tt = [ 1, 1, 1 ], et = {
682
710
  TRANSLATION: [ 0, 0, 0 ],
683
711
  ROTATION: [ 0, 0, 0, 1 ],
684
712
  SCALE: [ 1, 1, 1 ]
@@ -697,8 +725,8 @@
697
725
  const l = f.channelsMap[n];
698
726
  if (l) for (let t = 0; t < l.length; t++) {
699
727
  const e = l[t];
700
- "translation" === e.target.path ? (this.L(s, f.samplers[e.sampler], r, 1), u.translation = a(Y, s)) : "rotation" === e.target.path ? (this.B(i, f.samplers[e.sampler], r, 1),
701
- u.rotation = O(Q, i)) : "scale" === e.target.path ? (this.L(o, f.samplers[e.sampler], r, 1),
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),
702
730
  u.scale = a(tt, o)) : "weights" === e.target.path && c && (this.L(c, f.samplers[e.sampler], r, c.length),
703
731
  u.weights = c);
704
732
  }
@@ -805,8 +833,8 @@
805
833
  },
806
834
  getAnimationClip(t, e, n, r) {
807
835
  const s = t.nodes[e] && t.nodes[e].weights;
808
- c(Y, ...et.TRANSLATION), _(Q, ...et.ROTATION), c(tt, ...et.SCALE);
809
- return this.P(r, t, e, n, Y, Q, tt, s);
836
+ c(Q, ...et.TRANSLATION), _(Y, ...et.ROTATION), c(tt, ...et.SCALE);
837
+ return this.P(r, t, e, n, Q, Y, tt, s);
810
838
  },
811
839
  getTimeSpan(t) {
812
840
  if (!t.animations) return null;
@@ -849,6 +877,9 @@
849
877
  } else this.F(t, e);
850
878
  this.D = new G(this.rootPath, this.gltf, this.glbBuffer), this.k();
851
879
  }
880
+ abort() {
881
+ this.adapter && this.adapter.abortRequests();
882
+ }
852
883
  k() {
853
884
  const t = this.gltf.extensionsRequired;
854
885
  if (t) {
@@ -1070,13 +1101,11 @@
1070
1101
  attributes: e.reduce((t, e) => {
1071
1102
  if ("indices" === e.name) n = e; else if (e.name.indexOf("morphTargets_") > -1) r = r || {},
1072
1103
  r[e.name.slice(13)] = e; else {
1073
- if ("POSITION" === e.name) {
1074
- const t = [ 1 / 0, 1 / 0, 1 / 0 ], n = [ -1 / 0, -1 / 0, -1 / 0 ], {itemSize: r, array: s} = e;
1075
- s.length, c(t, s[0], s[1], s[2]), c(n, s[0], s[1], s[2]);
1076
- for (let e = 3; e < s.length; ) {
1077
- const r = s[e++], i = s[e++], o = s[e++];
1078
- r < t[0] && (t[0] = r), i < t[1] && (t[1] = i), o < t[2] && (t[2] = o), r > n[0] && (n[0] = r),
1079
- i > n[1] && (n[1] = i), o > n[2] && (n[2] = o);
1104
+ if (!("POSITION" !== e.name || e.min && e.max)) {
1105
+ const t = [ 1 / 0, 1 / 0, 1 / 0 ], n = [ -1 / 0, -1 / 0, -1 / 0 ], {itemSize: r, array: s} = e, i = s.length / r;
1106
+ for (let e = 0; e < i; e++) for (let i = 0; i < r; i++) {
1107
+ const o = e * r + i;
1108
+ s[o] < t[i] && (t[i] = s[o]), s[o] > n[i] && (n[i] = s[o]);
1080
1109
  }
1081
1110
  e.min = t, e.max = n;
1082
1111
  }
@@ -1388,24 +1417,24 @@
1388
1417
  if ("undefined" != typeof window) return window;
1389
1418
  if ("undefined" != typeof global) return global;
1390
1419
  throw new Error("unable to locate global object");
1391
- }, Zt = Wt(), Yt = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
1392
- Yt.inject = function(t) {
1420
+ }, Zt = Wt(), Qt = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
1421
+ Qt.inject = function(t) {
1393
1422
  const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = Zt.gl_trans__coders = Zt.gl_trans__coders || {};
1394
1423
  let i = `${r}\n const _____getGlobal = ${Wt.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
1395
1424
  for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
1396
1425
  return i += "\n" + e.substring(r.length), i;
1397
- }, Yt.registerTranscoder = function(t, e) {
1398
- Yt[t] = e;
1399
- }, Yt.getTranscoder = function(t) {
1400
- return Yt[t];
1426
+ }, Qt.registerTranscoder = function(t, e) {
1427
+ Qt[t] = e;
1428
+ }, Qt.getTranscoder = function(t) {
1429
+ return Qt[t];
1401
1430
  };
1402
- class Qt {
1431
+ class Yt {
1403
1432
  constructor(t, e, n) {
1404
1433
  this.i = t, this.Y = e || ot, this.o = n, this.tt = {
1405
- "image/crn": Yt.crn && Yt.crn(),
1406
- "image/ktx2": Yt.ktx2 && Yt.ktx2(),
1407
- "image/cttf": Yt.ktx2 && Yt.ktx2(),
1408
- "draco": Yt.draco && Yt.draco()
1434
+ "image/crn": Qt.crn && Qt.crn(),
1435
+ "image/ktx2": Qt.ktx2 && Qt.ktx2(),
1436
+ "image/cttf": Qt.ktx2 && Qt.ktx2(),
1437
+ "draco": Qt.draco && Qt.draco()
1409
1438
  };
1410
1439
  }
1411
1440
  static createEmptyB3DM() {
@@ -1497,10 +1526,10 @@
1497
1526
  class te {
1498
1527
  constructor(t, e, n) {
1499
1528
  this.i = t, this.Y = e || ot, this.o = n, this.tt = {
1500
- "image/crn": Yt.crn && Yt.crn(),
1501
- "image/ktx2": Yt.ktx2 && Yt.ktx2(),
1502
- "image/cttf": Yt.ktx2 && Yt.ktx2(),
1503
- "draco": Yt.draco && Yt.draco()
1529
+ "image/crn": Qt.crn && Qt.crn(),
1530
+ "image/ktx2": Qt.ktx2 && Qt.ktx2(),
1531
+ "image/cttf": Qt.ktx2 && Qt.ktx2(),
1532
+ "draco": Qt.draco && Qt.draco()
1504
1533
  };
1505
1534
  }
1506
1535
  load(t, e, n = 0, r = 0) {
@@ -1742,7 +1771,7 @@
1742
1771
  attributes: y.properties,
1743
1772
  useUniqueIDs: !1
1744
1773
  };
1745
- return this.ut || (this.ut = Yt.draco()), this.ut(m, e).then(e => {
1774
+ return this.ut || (this.ut = Qt.draco()), this.ut(m, e).then(e => {
1746
1775
  const n = e.attributes;
1747
1776
  !a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
1748
1777
  n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
@@ -1940,7 +1969,7 @@
1940
1969
  const s = this.lt(e, t, n, r), i = [];
1941
1970
  for (let n = 0; n < s.length; n++) {
1942
1971
  let r;
1943
- if ("b3dm" === s[n].magic) r = new Qt(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new te(this.i, this.Y); else if ("pnts" === s[n].magic) r = new se; else {
1972
+ if ("b3dm" === s[n].magic) r = new Yt(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new te(this.i, this.Y); else if ("pnts" === s[n].magic) r = new se; else {
1944
1973
  if ("cmpt" !== s[n].magic) {
1945
1974
  console.warn("Unsupported magic in CMPT tile:", s[n].magic);
1946
1975
  continue;
@@ -2033,7 +2062,7 @@
2033
2062
  this.bt = {}, r(null, {}, []);
2034
2063
  }
2035
2064
  pt(t) {
2036
- this.wt || (this._t = new se, this.wt = new Qt(this.dt, ot, t), this.gt = new te(this.dt, ot, t));
2065
+ this.wt || (this._t = new se, this.wt = new Yt(this.dt, ot, t), this.gt = new te(this.dt, ot, t));
2037
2066
  }
2038
2067
  requestImage(t, e) {
2039
2068
  me ? fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
@@ -2538,14 +2567,14 @@
2538
2567
  function Z(t) {
2539
2568
  return !W(t);
2540
2569
  }
2541
- function Y(t) {
2570
+ function Q(t) {
2542
2571
  for (let e = 1; e < arguments.length; e++) {
2543
2572
  const n = arguments[e];
2544
2573
  for (const e in n) t[e] = n[e];
2545
2574
  }
2546
2575
  return t;
2547
2576
  }
2548
- function Q(t) {
2577
+ function Y(t) {
2549
2578
  switch (t) {
2550
2579
  case 5120:
2551
2580
  return Int8Array;
@@ -2584,7 +2613,7 @@
2584
2613
  return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t;
2585
2614
  }([]), at = [ 1, 1, 1 ];
2586
2615
  function ct(t, e, n, r, s, i, o) {
2587
- const a = Q(o);
2616
+ const a = Y(o);
2588
2617
  if ((0 === s || s === r * a.BYTES_PER_ELEMENT) && i % a.BYTES_PER_ELEMENT == 0) {
2589
2618
  const s = new a(e, i, n * r);
2590
2619
  return t.set(s), t;
@@ -2653,6 +2682,12 @@
2653
2682
  constructor(t, e, n) {
2654
2683
  this.i = t, this.decoders = e, this.o = n, this.images = {}, this.h = {};
2655
2684
  }
2685
+ abortRequests() {
2686
+ for (const t in this.h) {
2687
+ const e = this.h[t];
2688
+ e && e.xhr && e.xhr.abort();
2689
+ }
2690
+ }
2656
2691
  requestImageFromBufferURI(t, e, n) {
2657
2692
  if (this.buffers[t.id]) {
2658
2693
  const r = this.buffers[t.id], s = this.u(e, r);
@@ -2753,7 +2788,7 @@
2753
2788
  });
2754
2789
  }
2755
2790
  g(t, e, n, r = 0) {
2756
- const s = this.gltf, i = s.accessors[e], o = void 0 !== i.bufferView ? s.bufferViews[i.bufferView] : {}, a = (o.byteOffset || 0) + r, c = this.A(i.type), h = Q(i.componentType), u = o.byteStride || 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;
2757
2792
  const f = {
2758
2793
  array: void 0,
2759
2794
  name: t,
@@ -2941,7 +2976,7 @@
2941
2976
  }
2942
2977
  createNode(t) {
2943
2978
  const e = {};
2944
- 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),
2979
+ return Q(e, t), !Z(t.weights) && this.gltf.meshes && Z(e.mesh) ? e.weights = this.gltf.meshes[e.mesh].weights : t.weights && (e.weights = t.weights),
2945
2980
  e;
2946
2981
  }
2947
2982
  S(t) {
@@ -2963,7 +2998,7 @@
2963
2998
  extras: n.extras
2964
2999
  }
2965
3000
  };
2966
- Y(r, e);
3001
+ Q(r, e);
2967
3002
  const s = Z(e.sampler) ? this.gltf.samplers[e.sampler] : void 0;
2968
3003
  return s && (r.sampler = s), t.format && (r.format = t.format), r;
2969
3004
  });
@@ -3256,6 +3291,9 @@
3256
3291
  } else this.F(t, e);
3257
3292
  this.D = new mt(this.rootPath, this.gltf, this.glbBuffer), this.k();
3258
3293
  }
3294
+ abort() {
3295
+ this.adapter && this.adapter.abortRequests();
3296
+ }
3259
3297
  k() {
3260
3298
  const t = this.gltf.extensionsRequired;
3261
3299
  if (t) {
@@ -3308,7 +3346,7 @@
3308
3346
  return It.getTimeSpanByName(t, e);
3309
3347
  }
3310
3348
  static getTypedArrayCtor(t) {
3311
- return Q(t);
3349
+ return Y(t);
3312
3350
  }
3313
3351
  static readInterleavedArray(t, e, n, r, s, i, o) {
3314
3352
  return ct(t, e, n, r, s, i, o);
@@ -3411,7 +3449,7 @@
3411
3449
  const n = t.primitives.map(t => this.Z(t, e)).filter(t => !!t);
3412
3450
  return Promise.all(n).then(e => {
3413
3451
  const n = {};
3414
- return Y(n, t), n.primitives = e, n;
3452
+ return Q(n, t), n.primitives = e, n;
3415
3453
  });
3416
3454
  }
3417
3455
  H() {
@@ -3477,13 +3515,11 @@
3477
3515
  attributes: e.reduce((t, e) => {
3478
3516
  if ("indices" === e.name) n = e; else if (e.name.indexOf("morphTargets_") > -1) r = r || {},
3479
3517
  r[e.name.slice(13)] = e; else {
3480
- if ("POSITION" === e.name) {
3481
- const t = [ 1 / 0, 1 / 0, 1 / 0 ], n = [ -1 / 0, -1 / 0, -1 / 0 ], {itemSize: r, array: s} = e;
3482
- s.length, U(t, s[0], s[1], s[2]), U(n, s[0], s[1], s[2]);
3483
- for (let e = 3; e < s.length; ) {
3484
- const r = s[e++], i = s[e++], o = s[e++];
3485
- r < t[0] && (t[0] = r), i < t[1] && (t[1] = i), o < t[2] && (t[2] = o), r > n[0] && (n[0] = r),
3486
- i > n[1] && (n[1] = i), o > n[2] && (n[2] = o);
3518
+ if (!("POSITION" !== e.name || e.min && e.max)) {
3519
+ const t = [ 1 / 0, 1 / 0, 1 / 0 ], n = [ -1 / 0, -1 / 0, -1 / 0 ], {itemSize: r, array: s} = e, i = s.length / r;
3520
+ for (let e = 0; e < i; e++) for (let i = 0; i < r; i++) {
3521
+ const o = e * r + i;
3522
+ s[o] < t[i] && (t[i] = s[o]), s[o] > n[i] && (n[i] = s[o]);
3487
3523
  }
3488
3524
  e.min = t, e.max = n;
3489
3525
  }
@@ -3745,7 +3781,7 @@
3745
3781
  return t[0] = e[0] + n[0], t[1] = e[1] + n[1], t[2] = e[2] + n[2], t;
3746
3782
  }(t, $t, qt);
3747
3783
  }
3748
- const Xt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Wt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Zt = new Array(3), Yt = new Array(3), Qt = new Array(3);
3784
+ const Xt = [ 1 / 6378137, 1 / 6378137, 1 / 6356752.314245179 ], Wt = [ 1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445 ], Zt = new Array(3), Qt = new Array(3), Yt = new Array(3);
3749
3785
  function te(t, e) {
3750
3786
  const n = Wt, r = function(t, e, n, r, s) {
3751
3787
  const i = e[0], o = e[1], a = e[2], c = n[0], h = n[1], u = n[2], f = i * i * c * c, l = o * o * h * h, d = a * a * u * u, m = f + l + d, y = Math.sqrt(1 / m), b = F(ee, e, y);
@@ -3761,9 +3797,9 @@
3761
3797
  } while (Math.abs(T) > 1e-12);
3762
3798
  return t[0] = i * O, t[1] = o * v, t[2] = a * M, t;
3763
3799
  }(Zt, e, Xt, n, .1);
3764
- let s = V(Yt, r, n);
3800
+ let s = V(Qt, r, n);
3765
3801
  s = se(s, s);
3766
- const i = j(Qt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = _(k(i, e)) * re(i);
3802
+ const i = j(Yt, e, r), o = Math.atan2(s[1], s[0]), a = Math.asin(s[2]), c = _(k(i, e)) * re(i);
3767
3803
  return t[0] = p(o), t[1] = p(a), t[2] = c, t;
3768
3804
  }
3769
3805
  const ee = new Array(3), ne = new Array(3);
@@ -3995,7 +4031,7 @@
3995
4031
  x: 0,
3996
4032
  y: 0
3997
4033
  }, Ge = Math.PI / 180;
3998
- const {getTextureMagFilter: He, getTextureMinFilter: qe, getTextureWrap: $e, getMaterialType: Je, getMaterialFormat: Ke, getPrimitive: Xe, getUniqueREGLBuffer: We} = n.reshader.REGLHelper, Ze = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Ye = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], {loginIBLResOnCanvas: Qe, logoutIBLResOnCanvas: tn, getIBLResOnCanvas: en, getPBRUniforms: nn} = n.reshader.pbr.PBRUtils, rn = {
4034
+ const {getTextureMagFilter: He, getTextureMinFilter: qe, getTextureWrap: $e, getMaterialType: Je, getMaterialFormat: Ke, getPrimitive: Xe, getUniqueREGLBuffer: We} = n.reshader.REGLHelper, Ze = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Qe = [ 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1 ], {loginIBLResOnCanvas: Ye, logoutIBLResOnCanvas: tn, getIBLResOnCanvas: en, getPBRUniforms: nn} = n.reshader.pbr.PBRUtils, rn = {
3999
4035
  factor: 0,
4000
4036
  units: 0
4001
4037
  }, sn = {
@@ -4035,10 +4071,10 @@
4035
4071
  paint(t, e, n, r) {
4036
4072
  const s = this.getMap();
4037
4073
  if (!t.length || !s) return;
4038
- const i = this.Yt(), o = s.projViewMatrix, a = this.Nt.options.services, h = [];
4074
+ const i = this.Qt(), o = s.projViewMatrix, a = this.Nt.options.services, h = [];
4039
4075
  let u = [];
4040
4076
  for (let n = 0, r = t.length; n < r; n++) {
4041
- let r = this.Qt(t[n].data.node);
4077
+ let r = this.Yt(t[n].data.node);
4042
4078
  if (!r) {
4043
4079
  if (r = this.kt[t[n].data.node.id], !r) continue;
4044
4080
  r = O(r);
@@ -4059,7 +4095,7 @@
4059
4095
  const l = this.Wt.getExcludeFilter();
4060
4096
  f += this.ne(this.re, i, [ n, cn, l ], r, h, u), f += this.ne(this.se, i, [ n, hn, l ], r, h, u),
4061
4097
  this.Wt.forEachShader((t, e, s) => {
4062
- const i = this.Yt(s);
4098
+ const i = this.Qt(s);
4063
4099
  f += this.ne(t, i, [ n, e ], r, h, u);
4064
4100
  });
4065
4101
  const d = [];
@@ -4159,11 +4195,11 @@
4159
4195
  return l.setLocalTransform(n.mat4.translate(d, d, [ o.x, o.y, 0 ])), this.Ct[t.id] = l,
4160
4196
  l;
4161
4197
  }
4162
- Qt(t) {
4198
+ Yt(t) {
4163
4199
  return this.Rt[t.id];
4164
4200
  }
4165
4201
  has(t) {
4166
- return this.Qt(t) || this.Ft[t.id] || this.Dt[t.id] || this.kt[t.id] || this.Ut[t.id];
4202
+ return this.Yt(t) || this.Ft[t.id] || this.Dt[t.id] || this.kt[t.id] || this.Ut[t.id];
4167
4203
  }
4168
4204
  createPntsMesh(t, e, r, s) {
4169
4205
  if (this.Ft[e]) {
@@ -4508,7 +4544,7 @@
4508
4544
  extraCommandProps: s
4509
4545
  });
4510
4546
  const i = this.Nt;
4511
- Qe(i.getRenderer().canvas, this.Lt, i.getMap());
4547
+ Ye(i.getRenderer().canvas, this.Lt, i.getMap());
4512
4548
  }
4513
4549
  Zt() {
4514
4550
  return {
@@ -4568,7 +4604,7 @@
4568
4604
  lightDir: n.vec3.normalize(s, s)
4569
4605
  };
4570
4606
  }
4571
- Yt() {
4607
+ Qt() {
4572
4608
  const t = this.getMap(), e = this.Nt.getRenderer().canvas, {iblTexes: n, dfgLUT: r} = en(e), s = nn(t, n, r);
4573
4609
  return m(s, {
4574
4610
  lightSpecular: [ 1, 1, 1 ],
@@ -4669,16 +4705,16 @@
4669
4705
  return e.getGLZoom ? e._prjToPoint(t, e.getGLZoom()) : e._prjToPointAtRes(t, e.getGLRes());
4670
4706
  }
4671
4707
  ge(t) {
4672
- return "Y" === t ? Ze : "X" === t ? Ye : an;
4708
+ return "Y" === t ? Ze : "X" === t ? Qe : an;
4673
4709
  }
4674
4710
  }
4675
4711
  class pn extends s.renderer.CanvasRenderer {
4676
4712
  constructor(t) {
4677
4713
  super(t), this.prepareWorker(), this.tilesLoading = {}, this.tileCache = new zt(1024 * t.options.maxGPUMemory * 1024, this.deleteTile.bind(this)),
4678
- this.bt = {};
4714
+ this.bt = {}, this.Le = [];
4679
4715
  }
4680
4716
  needToRedraw() {
4681
- return !!this.getMap().isInteracting() || super.needToRedraw();
4717
+ return !!this.getMap().isInteracting() || (!!this.Le.length || super.needToRedraw());
4682
4718
  }
4683
4719
  drawOnInteracting(t, e, n) {
4684
4720
  this.draw(e, n);
@@ -4688,30 +4724,31 @@
4688
4724
  if (n && !n.intersects(this.canvasExtent2D)) return void this.completeRender();
4689
4725
  const {root: r, tiles: s} = this.layer.getTiles(), i = s ? Object.keys(s).length : 0;
4690
4726
  if (!s || !i) return void this.completeRender();
4691
- const {selectedTiles: o, leaves: a, requests: c} = this.Le(r, s);
4692
- this.Be(o, a, e), this.Ue(), c.length ? this.loadTiles(c) : this.completeRender();
4727
+ this.Be();
4728
+ const {selectedTiles: o, leaves: a, requests: c} = this.Ue(r, s);
4729
+ c.length && this.loadTiles(c), this.Ce(o, a, e), this.Re(), c.length || this.completeRender();
4693
4730
  }
4694
- Le(t, e) {
4731
+ Ue(t, e) {
4695
4732
  let n = [];
4696
- this.Ce();
4733
+ this.Fe();
4697
4734
  let r = 0;
4698
- const s = this.Re(), i = {};
4735
+ const s = this.De(), i = {};
4699
4736
  let o = !1, a = !1;
4700
4737
  for (const t in e) {
4701
4738
  const s = e[t], c = s.node;
4702
4739
  if (i[c.id]) continue;
4703
4740
  i[c.id] = 1;
4704
4741
  let h = !1;
4705
- const u = this.Fe(c.id);
4706
- if (this.De(c.id) ? (r++, h = a = !0, this.tilesLoading[c.id].current = !0) : u ? (this.getTileOpacity(u) < 1 && (h = a = !0),
4742
+ const u = this.ke(c.id);
4743
+ if (this.ze(c.id) ? (r++, h = a = !0, this.tilesLoading[c.id].current = !0) : u ? (this.getTileOpacity(u) < 1 && (h = a = !0),
4707
4744
  o = !0, s.selected = !0, s.data = u) : this.painter.has(c) || (h = a = !0, n.push(c)),
4708
4745
  !h) continue;
4709
- if (this.ke(s)) o = !0; else {
4710
- this.ze(s).length && (o = !0);
4746
+ if (this.je(s)) o = !0; else {
4747
+ this.Ve(s).length && (o = !0);
4711
4748
  }
4712
4749
  }
4713
4750
  let c = [], h = {};
4714
- if (o && ({selectedTiles: c, leaves: h} = this.je(t)), n.length > 1 && (n.sort(_n),
4751
+ if (o && ({selectedTiles: c, leaves: h} = this.Ge(t)), n.length > 1 && (n.sort(wn),
4715
4752
  s)) {
4716
4753
  const t = s - r;
4717
4754
  n = t > 0 ? n.slice(0, t) : [];
@@ -4723,14 +4760,14 @@
4723
4760
  leaves: h
4724
4761
  };
4725
4762
  }
4726
- je(t) {
4763
+ Ge(t) {
4727
4764
  const e = [], n = {};
4728
4765
  let r;
4729
4766
  const s = [ t ], i = [];
4730
4767
  for (;s.length > 0 || i.length > 0; ) {
4731
4768
  if (i.length > 0) {
4732
4769
  const t = i[i.length - 1];
4733
- if (t.Ve === s.length) {
4770
+ if (t.He === s.length) {
4734
4771
  i.pop(), t === r && (t.leave = !0, n[t.node.id] = 1), e.push(t);
4735
4772
  continue;
4736
4773
  }
@@ -4742,9 +4779,8 @@
4742
4779
  t.leave = !0, n[t.node.id] = 1, e.push(t);
4743
4780
  continue;
4744
4781
  }
4745
- i.push(t), t.Ve = s.length;
4782
+ i.push(t), t.He = s.length;
4746
4783
  }
4747
- o.length > 1 && o.sort(wn);
4748
4784
  for (let t = 0; t < o.length; t++) s.push(o[t]);
4749
4785
  }
4750
4786
  return {
@@ -4752,7 +4788,7 @@
4752
4788
  leaves: n
4753
4789
  };
4754
4790
  }
4755
- ke(t) {
4791
+ je(t) {
4756
4792
  if (!t.parent) return null;
4757
4793
  let e = t.parent;
4758
4794
  for (;e && e.level >= 0; ) {
@@ -4763,27 +4799,27 @@
4763
4799
  }
4764
4800
  return null;
4765
4801
  }
4766
- ze(t) {
4802
+ Ve(t) {
4767
4803
  const e = [];
4768
4804
  if (!t.node.children || !t.node.children.length) return e;
4769
- const n = t.Ge + 1, r = [ t.node ];
4805
+ const n = t.qe + 1, r = [ t.node ];
4770
4806
  for (;r.length > 0; ) {
4771
4807
  const s = r.pop().children;
4772
4808
  for (let i = 0, o = s.length; i < o; i++) {
4773
- if (!this.layer.He(s[i]) && s[i].children && s[i].children.length) {
4809
+ if (!this.layer.$e(s[i]) && s[i].children && s[i].children.length) {
4774
4810
  r.push(s[i]);
4775
4811
  continue;
4776
4812
  }
4777
4813
  const o = s[i].id;
4778
4814
  if (this.tileCache.has(o)) {
4779
- const n = this.layer.qe(s[i], t);
4815
+ const n = this.layer.Je(s[i], t);
4780
4816
  n.selected = !0, n.data = this.tileCache.get(o), t.children.push(n), e.push(n);
4781
- } else s[i].Ge <= n && r.push(s[i]);
4817
+ } else s[i].qe <= n && r.push(s[i]);
4782
4818
  }
4783
4819
  }
4784
4820
  return e;
4785
4821
  }
4786
- Be(t, e, n) {
4822
+ Ce(t, e, n) {
4787
4823
  this.tileCache.markAll(!1);
4788
4824
  for (let e = 0, n = t.length; e < n; e++) {
4789
4825
  const n = t[e].data;
@@ -4817,7 +4853,7 @@
4817
4853
  let e = t.content.url;
4818
4854
  if (M(e)) {
4819
4855
  const n = S(e);
4820
- return void this.$e(e, n, t);
4856
+ return void this.Ke(e, n, t);
4821
4857
  }
4822
4858
  t && -1 === e.indexOf("http://") && -1 === e.indexOf("https://") && (e = t.baseUrl + e);
4823
4859
  const n = this.layer.options.services[t.te];
@@ -4827,13 +4863,13 @@
4827
4863
  let s = ft.getArrayBuffer(e + (r || ""), n.ajaxOptions);
4828
4864
  const i = s.xhr;
4829
4865
  s = s.then(n => {
4830
- delete this.bt[e], n ? this.$e(e, n.data, t) : this.onTileError(null, t);
4866
+ delete this.bt[e], n ? this.Ke(e, n.data, t) : this.onTileError(null, t);
4831
4867
  }).catch(n => {
4832
4868
  delete this.bt[e], this.onTileError(n, t);
4833
4869
  }), this.bt[e] = i;
4834
- } else this.$e(e, null, t);
4870
+ } else this.Ke(e, null, t);
4835
4871
  }
4836
- $e(t, e, r) {
4872
+ Ke(t, e, r) {
4837
4873
  let s = this.o;
4838
4874
  s || (s = n.reshader.Util.getSupportedFormats(this.gl.gl || this.gl), this.o = s),
4839
4875
  this.workerConn.loadTile(this.layer.getId(), {
@@ -4846,30 +4882,41 @@
4846
4882
  }, (e, n) => {
4847
4883
  if (e) return void this.onTileError(e, r);
4848
4884
  const {magic: s} = n;
4849
- "b3dm" === s ? this.painter.createB3DMMesh(n, r.id, r, (t, {mesh: e}) => {
4850
- this.Je(n, r, t, e);
4851
- }) : "pnts" === s ? this.painter.createPntsMesh(n, r.id, r, (t, {mesh: e}) => {
4852
- this.Je(n, r, t, e);
4853
- }) : "i3dm" === s ? this.painter.createI3DMMesh(n, r.id, r, (t, {mesh: e}) => {
4854
- this.Je(n, r, t, e);
4855
- }) : "cmpt" === s ? this.painter.createCMPTMesh(n, r.id, r, (t, {mesh: e}) => {
4856
- this.Je(n, r, t, e);
4885
+ "b3dm" === s || "pnts" === s || "i3dm" === s || "cmpt" === s ? this.Le.push({
4886
+ data: n,
4887
+ tile: r
4857
4888
  }) : this.onTilesetLoad(n, r, t);
4858
4889
  });
4859
4890
  }
4860
- Je(t, e, n, r) {
4891
+ Be() {
4892
+ const t = this.getMap(), e = this.layer.options.meshLimitPerFrame;
4893
+ let n = 0;
4894
+ for (;this.Le.length && (n < e || !t.isInteracting()); ) {
4895
+ const {data: t, tile: e} = this.Le.shift(), {magic: r} = t;
4896
+ "b3dm" === r ? this.painter.createB3DMMesh(t, e.id, e, (n, {mesh: r}) => {
4897
+ this.Xe(t, e, n, r);
4898
+ }) : "pnts" === r ? this.painter.createPntsMesh(t, e.id, e, (n, {mesh: r}) => {
4899
+ this.Xe(t, e, n, r);
4900
+ }) : "i3dm" === r ? this.painter.createI3DMMesh(t, e.id, e, (n, {mesh: r}) => {
4901
+ this.Xe(t, e, n, r);
4902
+ }) : "cmpt" === r && this.painter.createCMPTMesh(t, e.id, e, (n, {mesh: r}) => {
4903
+ this.Xe(t, e, n, r);
4904
+ }), n++;
4905
+ }
4906
+ }
4907
+ Xe(t, e, n, r) {
4861
4908
  if (n) this.onTileError(n, e); else {
4862
- const n = this.Ke(r);
4909
+ const n = this.We(r);
4863
4910
  e.memorySize = n, this.onTileLoad(t, e);
4864
4911
  }
4865
4912
  }
4866
- Ke(t) {
4913
+ We(t) {
4867
4914
  let e = 0;
4868
- if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.Ke(t[n])); else t && (e += t.getMemorySize());
4915
+ if (Array.isArray(t)) for (let n = 0; n < t.length; n++) t[n] && (e += this.We(t[n])); else t && (e += t.getMemorySize());
4869
4916
  return e;
4870
4917
  }
4871
4918
  onTileLoad(t, e) {
4872
- this.layer && (delete this.tilesLoading[e.id], this.Xe(e), this.setToRedraw(), this.layer.fire("tileload", {
4919
+ this.layer && (delete this.tilesLoading[e.id], this.Ze(e), this.setToRedraw(), this.layer.fire("tileload", {
4873
4920
  node: e
4874
4921
  }));
4875
4922
  }
@@ -4880,15 +4927,15 @@
4880
4927
  if (!this.layer) return;
4881
4928
  const n = e.content.url;
4882
4929
  console.warn("failed to load 3d tile: " + n), console.warn(t), delete this.tilesLoading[e.id],
4883
- this.Xe(e), this.setToRedraw(), this.layer.fire("tileerror", {
4930
+ this.Ze(e), this.setToRedraw(), this.layer.fire("tileerror", {
4884
4931
  node: e,
4885
4932
  error: t
4886
4933
  });
4887
4934
  }
4888
- Fe(t) {
4935
+ ke(t) {
4889
4936
  return this.tileCache.get(t);
4890
4937
  }
4891
- Xe(t) {
4938
+ Ze(t) {
4892
4939
  const e = {
4893
4940
  loadTime: s.Util.now(),
4894
4941
  current: !0,
@@ -4905,7 +4952,7 @@
4905
4952
  } else this.workerConn.abortTileLoading(this.layer.getId(), e);
4906
4953
  delete this.bt[e];
4907
4954
  }
4908
- Ce() {
4955
+ Fe() {
4909
4956
  if (this.tilesLoading) for (const t in this.tilesLoading) this.tilesLoading[t].current = !1;
4910
4957
  }
4911
4958
  deleteTile(t) {
@@ -4920,7 +4967,7 @@
4920
4967
  antialias: t.options.antialias
4921
4968
  };
4922
4969
  this.canvas.gl && this.canvas.gl.wrap ? (this.gl = this.canvas.gl.wrap(), this.regl = this.canvas.gl.regl) : (this.glOptions = e,
4923
- this.gl = this.We(this.canvas, e)), this.regl = this.regl || n.createREGL({
4970
+ this.gl = this.Qe(this.canvas, e)), this.regl = this.regl || n.createREGL({
4924
4971
  gl: this.gl,
4925
4972
  attributes: e,
4926
4973
  extensions: [ "OES_element_index_uint", "WEBGL_compressed_texture_s3tc" ],
@@ -4947,7 +4994,7 @@
4947
4994
  super.onRemove();
4948
4995
  }
4949
4996
  clear() {
4950
- this.Ue(!0), this.tileCache.reset(), this.tilesLoading = {}, super.clear();
4997
+ this.Re(!0), this.tileCache.reset(), this.tilesLoading = {}, super.clear();
4951
4998
  }
4952
4999
  clearCanvas() {
4953
5000
  this.regl && this.regl.clear({
@@ -4962,22 +5009,21 @@
4962
5009
  getStencilValue() {
4963
5010
  return 0;
4964
5011
  }
4965
- Ue(t) {
4966
- this.Ze || (this.Ze = Date.now());
5012
+ Re(t) {
5013
+ this.Ye || (this.Ye = Date.now());
4967
5014
  const e = Date.now();
4968
- if (t || !(e - this.Ze < this.layer.options.retireInterval)) {
4969
- this.Ze = e;
5015
+ if (t || !(e - this.Ye < this.layer.options.retireInterval)) {
5016
+ this.Ye = e;
4970
5017
  for (const e in this.tilesLoading) {
4971
5018
  const n = this.tilesLoading[e];
4972
- !t && n.current || (this.abortTileLoading(n), this.painter.has(n) && this.painter.deleteTile(n),
4973
- delete this.tilesLoading[e]);
5019
+ !t && n.current || this.abortTileLoading(n);
4974
5020
  }
4975
5021
  }
4976
5022
  }
4977
- Re() {
5023
+ De() {
4978
5024
  return this.getMap().isInteracting() ? this.layer.options.loadingLimitOnInteracting : this.layer.options.loadingLimit;
4979
5025
  }
4980
- We(t, e) {
5026
+ Qe(t, e) {
4981
5027
  const n = [ "webgl", "experimental-webgl" ];
4982
5028
  let r = null;
4983
5029
  for (let s = 0; s < n.length; ++s) {
@@ -4988,7 +5034,7 @@
4988
5034
  }
4989
5035
  return r;
4990
5036
  }
4991
- De(t) {
5037
+ ze(t) {
4992
5038
  return !!this.tilesLoading[t];
4993
5039
  }
4994
5040
  getI3DMMeshes() {
@@ -5005,19 +5051,16 @@
5005
5051
  }
5006
5052
  }
5007
5053
  function wn(t, e) {
5008
- return 0 === t.node.ce && 0 === e.node.ce ? e.node.Ye - t.node.Ye : e.node.ce - t.node.ce;
5054
+ return 0 === t.ce && 0 === e.ce ? t.tn - e.tn : t.ce - e.ce;
5009
5055
  }
5010
- function _n(t, e) {
5011
- return 0 === t.ce && 0 === e.ce ? t.Ye - e.Ye : t.ce - e.ce;
5012
- }
5013
- function gn(t, e, n) {
5056
+ function _n(t, e, n) {
5014
5057
  return t[0] = e[n], t[1] = e[n + 3], t[2] = e[n + 6], t;
5015
5058
  }
5016
- function Tn(t, e, n) {
5059
+ function gn(t, e, n) {
5017
5060
  return Math.sqrt(function(t, e, n) {
5018
- var r = C(An, n, t), s = gn(On, e, 0), i = gn(vn, e, 1), o = gn(Mn, e, 2), a = G(s), c = G(i), h = G(o);
5061
+ var r = C(Tn, n, t), s = _n(An, e, 0), i = _n(On, e, 1), o = _n(vn, e, 2), a = G(s), c = G(i), h = G(o);
5019
5062
  D(s, s), D(i, i), D(o, o);
5020
- var u = Sn;
5063
+ var u = Mn;
5021
5064
  u.x = k(r, s), u.y = k(r, i), u.z = k(r, o);
5022
5065
  var f, l = 0;
5023
5066
  u.x < -a ? (f = u.x + a, l += f * f) : u.x > a && (f = u.x - a, l += f * f);
@@ -5026,15 +5069,15 @@
5026
5069
  return l;
5027
5070
  }(t, e, n));
5028
5071
  }
5029
- const An = [], On = [], vn = [], Mn = [], Sn = [];
5030
- const xn = s.projection.EPSG3857, In = new s.Extent(0, 0, 0, 0), Nn = [], En = [], Pn = [], Ln = new s.Coordinate(0, 0), Bn = n.mat4.identity([]);
5031
- class Un extends s.Layer {
5072
+ const Tn = [], An = [], On = [], vn = [], Mn = [];
5073
+ const Sn = s.projection.EPSG3857, xn = new s.Extent(0, 0, 0, 0), In = [], Nn = [], En = [], Pn = new s.Coordinate(0, 0), Ln = n.mat4.identity([]);
5074
+ class Bn extends s.Layer {
5032
5075
  constructor(t, e) {
5033
- super(t, e), this.Qe(), this.bt = {}, this.tn = {};
5076
+ super(t, e), this.en(), this.bt = {}, this.nn = {};
5034
5077
  }
5035
- Qe() {
5078
+ en() {
5036
5079
  let t = this.options.services.map(t => t.url);
5037
- this.en = t.map((t, e) => function(t, e) {
5080
+ this.rn = t.map((t, e) => function(t, e) {
5038
5081
  t = w(t);
5039
5082
  return {
5040
5083
  baseUrl: t.substring(0, t.lastIndexOf("/")) + "/",
@@ -5044,25 +5087,25 @@
5044
5087
  refine: "replace",
5045
5088
  matrix: n.mat4.identity([]),
5046
5089
  te: e,
5047
- Ge: 0
5090
+ qe: 0
5048
5091
  };
5049
5092
  }(t, e)), this.fire("rootready", {
5050
- roots: this.en.slice(0)
5093
+ roots: this.rn.slice(0)
5051
5094
  });
5052
5095
  }
5053
5096
  getExtent(t) {
5054
5097
  if (!t && 0 !== t) {
5055
5098
  const t = new s.Extent;
5056
- for (let e = 0; e < this.en.length; e++) if (this.en[e].boundingVolume) {
5057
- const n = this.boundingVolumeToExtent(this.en[e]);
5099
+ for (let e = 0; e < this.rn.length; e++) if (this.rn[e].boundingVolume) {
5100
+ const n = this.boundingVolumeToExtent(this.rn[e]);
5058
5101
  t._combine(n);
5059
5102
  }
5060
5103
  return t;
5061
5104
  }
5062
- return this.en[t] && this.en[t].boundingVolume ? this.boundingVolumeToExtent(this.en[t]) : null;
5105
+ return this.rn[t] && this.rn[t].boundingVolume ? this.boundingVolumeToExtent(this.rn[t]) : null;
5063
5106
  }
5064
5107
  boundingVolumeToExtent(t) {
5065
- const e = t.boundingVolume.nn ? Bn : t.matrix, r = this.getMap();
5108
+ const e = t.boundingVolume.sn ? Ln : t.matrix, r = this.getMap();
5066
5109
  if (t.boundingVolume.region) {
5067
5110
  const e = t.boundingVolume.region;
5068
5111
  return new s.Extent(p(e[0]), p(e[1]), p(e[2]), p(e[3]));
@@ -5080,50 +5123,50 @@
5080
5123
  return null;
5081
5124
  }
5082
5125
  getRootTiles() {
5083
- return this.en;
5126
+ return this.rn;
5084
5127
  }
5085
5128
  getTiles() {
5086
- return this.getRenderer().ready ? this.rn() : (this.sn(), {
5129
+ return this.getRenderer().ready ? this.in() : (this.an(), {
5087
5130
  tiles: null
5088
5131
  });
5089
5132
  }
5090
- rn() {
5133
+ in() {
5091
5134
  const t = this.getMap(), e = t.cameraPosition;
5092
5135
  let r, s;
5093
- if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), Ln.set(e[0], e[1]),
5094
- r = t.pointToCoord(Ln, t.getGLZoom()); else {
5136
+ if (t.getGLZoom) s = t.pointToDistance(e[2], 0, t.getGLZoom()), Pn.set(e[0], e[1]),
5137
+ r = t.pointToCoord(Pn, t.getGLZoom()); else {
5095
5138
  const n = t.getGLRes();
5096
- s = t.pointAtResToDistance(e[2], 0, n), Ln.set(e[0], e[1]), r = t.pointAtResToCoord(Ln, n);
5139
+ s = t.pointAtResToDistance(e[2], 0, n), Pn.set(e[0], e[1]), r = t.pointAtResToCoord(Pn, n);
5097
5140
  }
5098
- this.in = this.in || [], n.vec3.set(this.in, b(r.x), b(r.y), s), this.an = Kt(this.an || [], this.in[0], this.in[1], this.in[2]),
5099
- this.cn = 2 * Math.tan(.5 * b(t.getFov())), this.hn = xn.project(r).toArray();
5141
+ this.cn = this.cn || [], n.vec3.set(this.cn, b(r.x), b(r.y), s), this.hn = Kt(this.hn || [], this.cn[0], this.cn[1], this.cn[2]),
5142
+ this.un = 2 * Math.tan(.5 * b(t.getFov())), this.ln = Sn.project(r).toArray();
5100
5143
  const i = t.projViewMatrix, o = {
5101
5144
  children: [],
5102
5145
  level: -1
5103
5146
  };
5104
5147
  let a = o;
5105
5148
  const c = {};
5106
- for (let t = 0; t < this.en.length; t++) {
5149
+ for (let t = 0; t < this.rn.length; t++) {
5107
5150
  let e = 1 / 0;
5108
- const n = [ this.en[t] ], r = this.un(t);
5151
+ const n = [ this.rn[t] ], r = this.dn(t);
5109
5152
  for (;n.length > 0; ) {
5110
5153
  const t = n.pop();
5111
- for (this.ln(t); a.level >= t.Ge; ) a = a.parent;
5112
- const s = this.dn(t, r, i);
5154
+ for (this.mn(t); a.level >= t.qe; ) a = a.parent;
5155
+ const s = this.yn(t, r, i);
5113
5156
  if (s < 1) {
5114
5157
  let n = a;
5115
5158
  for (;n && !n.content; ) n = n.parent;
5116
- 0 === s && n && n.content && (t.mn = n, this.yn(c, n));
5159
+ 0 === s && n && n.content && (t.bn = n, this.pn(c, n));
5117
5160
  if (!1 === this.options.services[t.te].alwaysShow) continue;
5118
- if (!(0 === s && t.Ge <= e)) continue;
5119
- t.content && (e = t.Ge);
5161
+ if (!(0 === s && t.qe <= e)) continue;
5162
+ t.content && (e = t.qe);
5120
5163
  }
5121
- t.ce < 1 / 0 && this.bn(t);
5122
- const o = this.qe(t, a);
5164
+ t.ce < 1 / 0 && this.wn(t);
5165
+ const o = this.Je(t, a);
5123
5166
  a.children.push(o);
5124
5167
  const h = t.children, u = h && h.length, f = o.content;
5125
- if (!u && f && this.yn(c, o), u) {
5126
- f && "add" === t.refine && this.yn(c, o), a = o;
5168
+ if (!u && f && this.pn(c, o), u) {
5169
+ f && "add" === t.refine && this.pn(c, o), a = o;
5127
5170
  for (let e = 0, r = h.length; e < r; e++) {
5128
5171
  if (!h[e].parent) {
5129
5172
  h[e].parent = t, h[e].Te = t.Te, h[e].baseUrl = t.baseUrl;
@@ -5140,14 +5183,14 @@
5140
5183
  tiles: c
5141
5184
  };
5142
5185
  }
5143
- yn(t, e) {
5186
+ pn(t, e) {
5144
5187
  e.node.viewerRequestVolume && !function(t, e, n) {
5145
5188
  if (n.region) {
5146
5189
  const e = n.region;
5147
5190
  if (t[0] >= e[0] && t[0] <= e[2] && t[1] >= e[1] && t[1] <= e[3]) return !0;
5148
5191
  } else {
5149
- if (n.sphere) return Cn(n, e);
5150
- if (n.box) return 0 === Rn(n, e);
5192
+ if (n.sphere) return Un(n, e);
5193
+ if (n.box) return 0 === Cn(n, e);
5151
5194
  }
5152
5195
  return !1;
5153
5196
  }
@@ -5155,51 +5198,51 @@
5155
5198
  * @maptalks/gl v0.65.0
5156
5199
  * LICENSE : UNLICENSED
5157
5200
  * (c) 2016-2022 maptalks.com
5158
- */ (this.in, this.an, e.node.viewerRequestVolume) || (t[e.node.id] = e);
5201
+ */ (this.cn, this.hn, e.node.viewerRequestVolume) || (t[e.node.id] = e);
5159
5202
  }
5160
- qe(t, e) {
5203
+ Je(t, e) {
5161
5204
  return {
5162
5205
  id: t.id,
5163
5206
  node: t,
5164
5207
  children: [],
5165
- level: t.Ge,
5208
+ level: t.qe,
5166
5209
  parent: e,
5167
- content: this.He(t)
5210
+ content: this.$e(t)
5168
5211
  };
5169
5212
  }
5170
- ln(t) {
5213
+ mn(t) {
5171
5214
  void 0 === t.id && (t.id = s.Util.GUID(), t.matrix = t.transform || n.mat4.identity([]),
5172
- t.pn = this.wn(t), t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix),
5173
- t.te = t.parent.te, void 0 === t.Ge && (t.Ge = t.parent.Ge + 1), t.maxExtent = t.parent.maxExtent),
5215
+ t._n = this.gn(t), t.parent && (t.matrix = n.mat4.multiply(t.matrix, t.parent.matrix, t.matrix),
5216
+ t.te = t.parent.te, void 0 === t.qe && (t.qe = t.parent.qe + 1), t.maxExtent = t.parent.maxExtent),
5174
5217
  t.refine = t.refine && t.refine.toLowerCase() || "replace", t.content && !t.content.url && t.content.uri && (t.content.url = t.content.uri),
5175
- this._n(t));
5218
+ this.Tn(t));
5176
5219
  }
5177
- _n(t) {
5220
+ Tn(t) {
5178
5221
  const e = t.boundingVolume;
5179
- if (!e || e.nn) return;
5222
+ if (!e || e.sn) return;
5180
5223
  const r = this.options.services[t.te].heightOffset || 0, s = this.options.offset, i = y(s) || s[0] || s[1];
5181
- if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, Bn) && !i) return;
5224
+ if (!t.boundingVolume || !r && n.mat4.exactEquals(t.matrix, Ln) && !i) return;
5182
5225
  const {region: o, box: a, sphere: c} = e;
5183
5226
  if (o) {
5184
- const t = this.gn([ p(o[0]), p(o[1]) ]);
5227
+ const t = this.An([ p(o[0]), p(o[1]) ]);
5185
5228
  o[0] = b(t.x), o[1] = b(t.y);
5186
- const e = this.gn([ p(o[2]), p(o[3]) ]);
5229
+ const e = this.An([ p(o[2]), p(o[3]) ]);
5187
5230
  o[2] = b(e.x), o[3] = b(e.y), o[4] += r, o[5] += r;
5188
5231
  } else if (a || c) {
5189
- const e = a || c, s = n.vec3.transformMat4(Nn, e, t.matrix), i = te(En, s), o = this.gn([ i[0], i[1] ]);
5232
+ const e = a || c, s = n.vec3.transformMat4(In, e, t.matrix), i = te(Nn, s), o = this.An([ i[0], i[1] ]);
5190
5233
  i[0] = o.x, i[1] = o.y, i[2] += r, Kt(e, b(i[0]), b(i[1]), i[2]);
5191
5234
  }
5192
- e.nn = !0;
5235
+ e.sn = !0;
5193
5236
  }
5194
- wn(t) {
5237
+ gn(t) {
5195
5238
  return void 0 === t.geometricError || !t.boundingVolume;
5196
5239
  }
5197
- He(t) {
5240
+ $e(t) {
5198
5241
  return t.content && t.content.url;
5199
5242
  }
5200
- bn(t) {
5243
+ wn(t) {
5201
5244
  let e = t.parent;
5202
- for (;e && e.pn && !(e.ce <= t.ce && e.Ye <= t.Ye); ) e.ce = t.ce, e.Ye = t.Ye,
5245
+ for (;e && e._n && !(e.ce <= t.ce && e.tn <= t.tn); ) e.ce = t.ce, e.tn = t.tn,
5203
5246
  e = t.parent;
5204
5247
  }
5205
5248
  onTilesetLoad(t, e, r) {
@@ -5210,73 +5253,73 @@
5210
5253
  m(e, t.root), e.refine = e.refine && e.refine.toLowerCase() || "replace", r && (e.boundingVolume = r);
5211
5254
  const s = t.root.transform;
5212
5255
  s && (e.parent ? e.matrix = n.mat4.multiply([], e.parent.matrix, s) : e.matrix = s),
5213
- this._n(e), e.children && e.children.length && (e.Tn = e.content, delete e.content,
5214
- t.root.content && (e.content = t.root.content)), e.pn = this.wn(e);
5256
+ this.Tn(e), e.On = e.content, delete e.content, t.root.content && (e.content = t.root.content),
5257
+ e._n = this.gn(e);
5215
5258
  const i = e.content && (e.content.url || e.content.uri);
5216
5259
  i && e.content.uri && (e.content.url = e.content.uri, delete e.content.uri), i && !M(i) && -1 === i.indexOf("http://") && -1 === i.indexOf("https://") && (e.content.url = e.baseUrl + i);
5217
5260
  }
5218
- this.sn(), this.fire("loadtileset", {
5261
+ this.an(), this.fire("loadtileset", {
5219
5262
  tileset: t,
5220
5263
  index: e.te,
5221
5264
  url: r
5222
5265
  });
5223
5266
  }
5224
- dn(t, e, n) {
5225
- if (t.ce = 1 / 0, 0 === t.Ge || t.pn) return 1;
5226
- if (t.An = 1 / 0, !this.On(t, e, n)) return -1;
5267
+ yn(t, e, n) {
5268
+ if (t.ce = 1 / 0, 0 === t.qe || t._n) return 1;
5269
+ if (t.vn = 1 / 0, !this.Mn(t, e, n)) return -1;
5227
5270
  if (0 === t.geometricError) return 1;
5228
5271
  let r = this.options.services[t.te].maximumScreenSpaceError;
5229
5272
  null == r && (r = 8);
5230
- let s = this.vn(t);
5231
- return 0 === s && t.parent && (s = .5 * (t.parent.An || 0)), s >= r ? 1 : 0;
5273
+ let s = this.Sn(t);
5274
+ return 0 === s && t.parent && (s = .5 * (t.parent.vn || 0)), s >= r ? 1 : 0;
5232
5275
  }
5233
5276
  ye(t) {
5234
5277
  const e = this.getMap();
5235
5278
  return e.getGLZoom ? e.coordToPoint(t, e.getGLZoom()) : e.coordToPointAtRes(t, e.getGLRes());
5236
5279
  }
5237
- On(t, e, r) {
5280
+ Mn(t, e, r) {
5238
5281
  if (!this.getMap()) return !1;
5239
5282
  const o = t.id;
5240
- let a = this.tn[o];
5241
- if (!t.boundingVolume) return !1;
5242
- if (!a && t.boundingVolume && !a) {
5283
+ let a = this.nn[o];
5284
+ const {boundingVolume: f} = t;
5285
+ if (!f) return !1;
5286
+ const {sphere: d, region: m, box: y} = f;
5287
+ if (!a) {
5243
5288
  let e, r, i;
5244
- if (t.boundingVolume.region) {
5245
- const n = t.boundingVolume.region;
5246
- e = new s.Extent(p(n[0]), p(n[1]), p(n[2]), p(n[3]));
5247
- const c = e.getCenter(), h = this.Mn(c);
5248
- e = e.convertTo(t => this.ye(t)), i = n[4], r = n[5], a = this.tn[o] = [ [ e.xmin, e.ymin, i * h ], [ e.xmax, e.ymax, r * h ] ],
5249
- a.center = c;
5250
- } else if (t.boundingVolume.sphere) {
5251
- const e = t.boundingVolume.sphere, n = te([], e), r = new s.Coordinate(n), i = this.ye(r).toArray(), c = this.Mn(r);
5252
- i.push(n[2] * c[2]), a = this.tn[o] = [ i, e[3] * c ], a.center = new s.Coordinate(n);
5253
- } else if (t.boundingVolume.box) {
5254
- const e = t.boundingVolume.box, r = te([], e), i = new s.Coordinate(r), c = this.ye(i).toArray(), h = this.Mn(i);
5255
- c.push(r[2] * h[2]);
5256
- const u = e.slice(3);
5257
- n.mat4.exactEquals(t.matrix, Bn) || n.mat3.multiply(u, n.mat3.fromMat4([], t.matrix), u);
5258
- for (let t = 0; t < u.length; t++) u[t] *= h[t % 3], e[3 + t] = u[t];
5259
- a = this.tn[o] = [ ...c, ...u ], a.center = new s.Coordinate(r);
5289
+ if (m) {
5290
+ e = new s.Extent(p(m[0]), p(m[1]), p(m[2]), p(m[3]));
5291
+ const t = e.getCenter(), n = this.xn(t);
5292
+ e = e.convertTo(t => this.ye(t)), i = m[4], r = m[5], a = this.nn[o] = [ [ e.xmin, e.ymin, i * n[2] ], [ e.xmax, e.ymax, r * n[2] ] ],
5293
+ a.center = t;
5294
+ } else if (d) {
5295
+ const t = te([], d), e = new s.Coordinate(t), n = this.ye(e).toArray(), r = this.xn(e);
5296
+ n.push(t[2] * r[2]), a = this.nn[o] = [ n, d[3] * r[2] ], a.center = new s.Coordinate(t);
5297
+ } else if (y) {
5298
+ const e = te([], y), r = new s.Coordinate(e), i = this.ye(r).toArray(), c = this.xn(r);
5299
+ i.push(e[2] * c[2]);
5300
+ const h = y.slice(3);
5301
+ n.mat4.exactEquals(t.matrix, Ln) || n.mat3.multiply(h, n.mat3.fromMat4([], t.matrix), h);
5302
+ for (let t = 0; t < h.length; t++) h[t] *= c[t % 3], y[3 + t] = h[t];
5303
+ a = this.nn[o] = [ ...i, ...h ], a.center = new s.Coordinate(e);
5260
5304
  }
5261
5305
  }
5262
5306
  if (e) {
5263
- if (t.boundingVolume.region) In.xmin = a[0][0], In.ymin = a[0][1], In.xmax = a[1][0],
5264
- In.ymax = a[1][1]; else if (t.boundingVolume.sphere) {
5307
+ if (m) xn.xmin = a[0][0], xn.ymin = a[0][1], xn.xmax = a[1][0], xn.ymax = a[1][1]; else if (d) {
5265
5308
  const t = a[2];
5266
- In.xmin = a[0][0] - t, In.ymin = a[0][1] - t, In.xmax = a[0][0] + t, In.ymax = a[0][1] + t;
5267
- } else if (t.boundingVolume.box) {
5309
+ xn.xmin = a[0][0] - t, xn.ymin = a[0][1] - t, xn.xmax = a[0][0] + t, xn.ymax = a[0][1] + t;
5310
+ } else if (y) {
5268
5311
  const t = a[1], e = a[2];
5269
- In.xmin = a[0][0] - t, In.ymin = a[0][1] - e, In.xmax = a[0][0] + t, In.ymax = a[0][1] + e;
5312
+ xn.xmin = a[0][0] - t, xn.ymin = a[0][1] - e, xn.xmax = a[0][0] + t, xn.ymax = a[0][1] + e;
5270
5313
  }
5271
- if (!e.intersects(In)) return !1;
5314
+ if (!e.intersects(xn)) return !1;
5272
5315
  }
5273
- return t.boundingVolume.region ? c(r, a) : t.boundingVolume.sphere ? function(t, e, n) {
5316
+ return m ? c(r, a) : d ? function(t, e, n) {
5274
5317
  u(t);
5275
5318
  for (var r = e[0], s = -e[1], o = 0; o < 6; o++) {
5276
5319
  if (!n || "0" !== n.charAt(o)) if (l(i[o], r) < s) return !1;
5277
5320
  }
5278
5321
  return !0;
5279
- }(r, a) : !!t.boundingVolume.box && function(t, e, n) {
5322
+ }(r, a) : !!y && function(t, e, n) {
5280
5323
  u(t);
5281
5324
  for (var r = 0; r < 6; r++) {
5282
5325
  if (!n || "0" !== n.charAt(r)) if (!h(i[r], e)) return !1;
@@ -5284,11 +5327,11 @@
5284
5327
  return !0;
5285
5328
  }(r, a);
5286
5329
  }
5287
- Mn(t) {
5330
+ xn(t) {
5288
5331
  const e = this.getMap(), r = e.distanceToPointAtRes(100, 100, e.getGLRes(), t);
5289
- return n.vec3.set(Pn, r.x / 100 * 1.01, r.y / 100 * 1.01, r.y / 100), Pn;
5332
+ return n.vec3.set(En, r.x / 100 * 1.01, r.y / 100 * 1.01, r.y / 100), En;
5290
5333
  }
5291
- gn(t) {
5334
+ An(t) {
5292
5335
  Array.isArray(t) && (t = new s.Coordinate(t));
5293
5336
  let e = this.options.offset;
5294
5337
  if (y(e) && (e = e(Array.isArray(t) ? new s.Coordinate(t) : t)), e[0] || e[1]) {
@@ -5297,64 +5340,64 @@
5297
5340
  }
5298
5341
  return t;
5299
5342
  }
5300
- un(t) {
5343
+ dn(t) {
5301
5344
  const e = this.options.services[t].maxExtent;
5302
5345
  if (!e) return null;
5303
- const n = this.en[t];
5346
+ const n = this.rn[t];
5304
5347
  return n.maxExtent || (n.maxExtent = new s.Extent(e).convertTo(t => this.ye(t))),
5305
5348
  n.maxExtent;
5306
5349
  }
5307
- vn(t) {
5308
- const e = this.cn, r = t.geometricError;
5350
+ Sn(t) {
5351
+ const e = this.un, r = t.geometricError;
5309
5352
  if (0 === r) return 0;
5310
5353
  const s = this.getMap();
5311
5354
  let i, o;
5312
5355
  if (t.boundingVolume.region) {
5313
- const e = this.tn[t.id].center, r = (s.getGLZoom ? s.distanceToPoint(100, 0, s.getGLZoom(), e) : s.distanceToPointAtRes(100, 0, s.getGLRes(), e)).x / 100;
5356
+ 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;
5314
5357
  i = function(t, e, n, r) {
5315
5358
  const s = t.boundingVolume.region;
5316
- let i = t.Sn;
5317
- i || (i = t.Sn = [ kn(s[0], s[1]), kn(s[0], s[3]), kn(s[2], s[1]), kn(s[2], s[3]), kn(s[0], s[1]), kn(s[0], s[3]), kn(s[2], s[1]), kn(s[2], s[3]) ],
5318
- t.xn = [ Math.min.apply(Math, i.map(t => t[0])), Math.min.apply(Math, i.map(t => t[1])) ],
5319
- t.In = [ Math.max.apply(Math, i.map(t => t[0])), Math.max.apply(Math, i.map(t => t[1])) ]);
5359
+ let i = t.In;
5360
+ i || (i = t.In = [ Dn(s[0], s[1]), Dn(s[0], s[3]), Dn(s[2], s[1]), Dn(s[2], s[3]), Dn(s[0], s[1]), Dn(s[0], s[3]), Dn(s[2], s[1]), Dn(s[2], s[3]) ],
5361
+ t.Nn = [ Math.min.apply(Math, i.map(t => t[0])), Math.min.apply(Math, i.map(t => t[1])) ],
5362
+ t.En = [ Math.max.apply(Math, i.map(t => t[0])), Math.max.apply(Math, i.map(t => t[1])) ]);
5320
5363
  if (n[0] >= s[0] && n[0] <= s[2] && n[1] >= s[1] && n[1] <= s[3]) return n[2] <= s[5] ? 0 : n[2] - s[5];
5321
- const o = (a = t.xn, c = t.In, h = e, u = Math.max(a[0] - h[0], 0, h[0] - c[0]),
5364
+ const o = (a = t.Nn, c = t.En, h = e, u = Math.max(a[0] - h[0], 0, h[0] - c[0]),
5322
5365
  f = Math.max(a[1] - h[1], 0, h[1] - c[1]), Math.sqrt(u * u + f * f) / r);
5323
5366
  var a, c, h, u, f;
5324
5367
  let l = 0;
5325
5368
  n[2] > s[5] && (l = n[2] - s[5]);
5326
5369
  return Math.sqrt(o * o + l * l);
5327
- }(t, this.hn, this.in, r), o = function(t, e) {
5328
- const r = t.boundingVolume.region, s = Kt(Fn, r[0], r[1], r[4]), i = Kt(Dn, r[2], r[3], r[5]), o = n.vec3.scale(s, n.vec3.add(s, s, i), .5);
5370
+ }(t, this.ln, this.cn, r), o = function(t, e) {
5371
+ const r = t.boundingVolume.region, s = Kt(Rn, r[0], r[1], r[4]), i = Kt(Fn, r[2], r[3], r[5]), o = n.vec3.scale(s, n.vec3.add(s, s, i), .5);
5329
5372
  return n.vec3.dist(o, e);
5330
- }(t, this.an);
5331
- } else t.boundingVolume.sphere ? (i = Cn(t.boundingVolume, this.an), o = function(t, e) {
5373
+ }(t, this.hn);
5374
+ } else t.boundingVolume.sphere ? (i = Un(t.boundingVolume, this.hn), o = function(t, e) {
5332
5375
  const r = t.boundingVolume.sphere;
5333
5376
  return n.vec3.dist(r, e);
5334
- }(t, this.an)) : t.boundingVolume.box && (i = Rn(t.boundingVolume, this.an), o = function(t, e) {
5377
+ }(t, this.hn)) : t.boundingVolume.box && (i = Cn(t.boundingVolume, this.hn), o = function(t, e) {
5335
5378
  const r = t.boundingVolume.box;
5336
5379
  return n.vec3.dist(r, e);
5337
- }(t, this.an));
5380
+ }(t, this.hn));
5338
5381
  const a = Math.max(Math.abs(i), 1e-7), c = r * s.height / (a * e);
5339
- return t.ce = i, t.Ye = o, t.An = c, c;
5382
+ return t.ce = i, t.tn = o, t.vn = c, c;
5340
5383
  }
5341
- sn() {
5384
+ an() {
5342
5385
  const t = this.getRenderer();
5343
5386
  t && t.setToRedraw();
5344
5387
  }
5345
5388
  Me(t) {
5346
- return this.tn[t];
5389
+ return this.nn[t];
5347
5390
  }
5348
5391
  }
5349
- function Cn(t, e) {
5392
+ function Un(t, e) {
5350
5393
  const r = t.sphere, s = n.vec3.dist(r, e), i = t.sphere[3];
5351
5394
  return s < i ? 0 : s - i;
5352
5395
  }
5353
- function Rn(t, e) {
5396
+ function Cn(t, e) {
5354
5397
  const n = t.box;
5355
- return Tn(n.slice(0, 3), n.slice(3), e);
5398
+ return gn(n.slice(0, 3), n.slice(3), e);
5356
5399
  }
5357
- Un.mergeOptions({
5400
+ Bn.mergeOptions({
5358
5401
  "maxGPUMemory": 512,
5359
5402
  "retireInterval": 2e3,
5360
5403
  "loadingLimitOnInteracting": 5,
@@ -5365,39 +5408,40 @@
5365
5408
  "forceRenderOnMoving": !0,
5366
5409
  "debug": !1,
5367
5410
  "debugOutline": [ 0, 1, 0 ],
5411
+ "meshLimitPerFrame": 1,
5368
5412
  "antialias": !1,
5369
5413
  "sRGBTolinear": !1,
5370
5414
  "optionalExtensions": [ "ANGLE_instanced_arrays", "OES_element_index_uint", "OES_standard_derivatives", "OES_vertex_array_object", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_texture_float", "OES_texture_float_linear", "WEBGL_depth_texture", "EXT_shader_texture_lod", "WEBGL_compressed_texture_astc", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_compressed_texture_s3tc_srgb" ],
5371
5415
  "offset": [ 0, 0 ]
5372
- }), Un.registerRenderer("gl", pn);
5373
- const Fn = [], Dn = [];
5374
- function kn(t, e) {
5416
+ }), Bn.registerRenderer("gl", pn);
5417
+ const Rn = [], Fn = [];
5418
+ function Dn(t, e) {
5375
5419
  const n = new s.Coordinate(p(t), p(e));
5376
- return xn.project(n).toArray();
5420
+ return Sn.project(n).toArray();
5377
5421
  }
5378
- const zn = function() {
5422
+ const kn = function() {
5379
5423
  if ("undefined" != typeof self) return self;
5380
5424
  if ("undefined" != typeof window) return window;
5381
5425
  if ("undefined" != typeof global) return global;
5382
5426
  throw new Error("unable to locate global object");
5383
- }, jn = zn(), Vn = jn.gl_trans__coders = jn.gl_trans__coders || {};
5384
- Vn.inject = function(t) {
5385
- const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = jn.gl_trans__coders = jn.gl_trans__coders || {};
5386
- let i = `${r}\n const _____getGlobal = ${zn.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
5427
+ }, zn = kn(), jn = zn.gl_trans__coders = zn.gl_trans__coders || {};
5428
+ jn.inject = function(t) {
5429
+ const e = t.toString(), n = e.indexOf("{") + 1, r = e.substring(0, n), s = zn.gl_trans__coders = zn.gl_trans__coders || {};
5430
+ let i = `${r}\n const _____getGlobal = ${kn.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
5387
5431
  for (const t in s) "inject" !== t && "getTranscoder" !== t && "registerTranscoder" !== t && (i += 'tran_____scoders["' + t + '"] =' + s[t].toString() + "\n;");
5388
5432
  return i += "\n" + e.substring(r.length), i;
5389
- }, Vn.registerTranscoder = function(t, e) {
5390
- Vn[t] = e;
5391
- }, Vn.getTranscoder = function(t) {
5392
- return Vn[t];
5433
+ }, jn.registerTranscoder = function(t, e) {
5434
+ jn[t] = e;
5435
+ }, jn.getTranscoder = function(t) {
5436
+ return jn[t];
5393
5437
  };
5394
- class Gn {
5438
+ class Vn {
5395
5439
  constructor(t, e, n) {
5396
5440
  this.i = t, this.Y = e || Pt, this.o = n, this.tt = {
5397
- "image/crn": Vn.crn && Vn.crn(),
5398
- "image/ktx2": Vn.ktx2 && Vn.ktx2(),
5399
- "image/cttf": Vn.ktx2 && Vn.ktx2(),
5400
- "draco": Vn.draco && Vn.draco()
5441
+ "image/crn": jn.crn && jn.crn(),
5442
+ "image/ktx2": jn.ktx2 && jn.ktx2(),
5443
+ "image/cttf": jn.ktx2 && jn.ktx2(),
5444
+ "draco": jn.draco && jn.draco()
5401
5445
  };
5402
5446
  }
5403
5447
  static createEmptyB3DM() {
@@ -5486,13 +5530,13 @@
5486
5530
  return null;
5487
5531
  }
5488
5532
  }
5489
- class Hn {
5533
+ class Gn {
5490
5534
  constructor(t, e, n) {
5491
5535
  this.i = t, this.Y = e || Pt, this.o = n, this.tt = {
5492
- "image/crn": Vn.crn && Vn.crn(),
5493
- "image/ktx2": Vn.ktx2 && Vn.ktx2(),
5494
- "image/cttf": Vn.ktx2 && Vn.ktx2(),
5495
- "draco": Vn.draco && Vn.draco()
5536
+ "image/crn": jn.crn && jn.crn(),
5537
+ "image/ktx2": jn.ktx2 && jn.ktx2(),
5538
+ "image/cttf": jn.ktx2 && jn.ktx2(),
5539
+ "draco": jn.draco && jn.draco()
5496
5540
  };
5497
5541
  }
5498
5542
  load(t, e, n = 0, r = 0) {
@@ -5663,7 +5707,7 @@
5663
5707
  }
5664
5708
  ct(t) {
5665
5709
  const e = t.length / 2, n = new Float32Array(3 * e), r = [];
5666
- for (let s = 0; s < e; s++) qn(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
5710
+ for (let s = 0; s < e; s++) Hn(r, t[2 * s], t[2 * s + 1], 65535), n[3 * s] = r[0],
5667
5711
  n[3 * s + 1] = r[1], n[3 * s + 2] = r[2];
5668
5712
  return n;
5669
5713
  }
@@ -5674,15 +5718,15 @@
5674
5718
  return null;
5675
5719
  }
5676
5720
  }
5677
- function qn(t, e, n, r) {
5678
- if (t[0] = $n(e, r), t[1] = $n(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
5721
+ function Hn(t, e, n, r) {
5722
+ if (t[0] = qn(e, r), t[1] = qn(n, r), t[2] = 1 - (Math.abs(t[0]) + Math.abs(t[1])),
5679
5723
  t[2] < 0) {
5680
5724
  const e = t[0];
5681
- t[0] = (1 - Math.abs(t[1])) * Jn(e), t[1] = (1 - Math.abs(e)) * Jn(t[1]);
5725
+ t[0] = (1 - Math.abs(t[1])) * $n(e), t[1] = (1 - Math.abs(e)) * $n(t[1]);
5682
5726
  }
5683
5727
  return D(t, t);
5684
5728
  }
5685
- function $n(t, e) {
5729
+ function qn(t, e) {
5686
5730
  return function(t, e, n) {
5687
5731
  return t < e ? e : t > n ? n : t;
5688
5732
  }(t, 0, e = function(t, e) {
@@ -5690,10 +5734,10 @@
5690
5734
  return e;
5691
5735
  }(e, 255)) / e * 2 - 1;
5692
5736
  }
5693
- function Jn(t) {
5737
+ function $n(t) {
5694
5738
  return t < 0 ? -1 : 1;
5695
5739
  }
5696
- class Kn {
5740
+ class Jn {
5697
5741
  constructor() {}
5698
5742
  load(t, e, n = 0, r = 0) {
5699
5743
  return e ? (r || (r = e.byteLength), this.et(t, e, n, r)) : ft.getArrayBuffer(t, {}).then(e => {
@@ -5734,7 +5778,7 @@
5734
5778
  attributes: y.properties,
5735
5779
  useUniqueIDs: !1
5736
5780
  };
5737
- return this.ut || (this.ut = Vn.draco()), this.ut(m, e).then(e => {
5781
+ return this.ut || (this.ut = jn.draco()), this.ut(m, e).then(e => {
5738
5782
  const n = e.attributes;
5739
5783
  !a.POSITION && !a.POSITION_QUANTIZED || n.POSITION || n.POSITION_QUANTIZED || (n.POSITION = a.POSITION,
5740
5784
  n.POSITION_QUANTIZED = a.POSITION_QUANTIZED), !(a.RGB || a.RGBA || a.RGB565) || n.RGB || n.RGBA || n.RGB565 || (n.RGB = a.RGB,
@@ -5752,7 +5796,7 @@
5752
5796
  array: t
5753
5797
  }, o.push(t.buffer);
5754
5798
  } else if (a.BATCH_ID || Object.keys(h).length) {
5755
- a.BATCH_ID ? r.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = Xn(d);
5799
+ a.BATCH_ID ? r.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : r.BATCH_ID = Kn(d);
5756
5800
  const e = r.BATCH_ID.array && r.BATCH_ID.array.buffer;
5757
5801
  e && o.indexOf(e) < 0 && o.push(e);
5758
5802
  }
@@ -5768,7 +5812,7 @@
5768
5812
  }
5769
5813
  const b = this.ft(t, a, c.offset, d, o, f, l);
5770
5814
  if (a.BATCH_ID || Object.keys(h).length) {
5771
- a.BATCH_ID ? b.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = Xn(d);
5815
+ a.BATCH_ID ? b.BATCH_ID = de(a.BATCH_ID, t, c.offset, d) : b.BATCH_ID = Kn(d);
5772
5816
  const e = b.BATCH_ID.array && b.BATCH_ID.array.buffer;
5773
5817
  e && o.indexOf(e) < 0 && o.push(e);
5774
5818
  }
@@ -5903,7 +5947,7 @@
5903
5947
  return null;
5904
5948
  }
5905
5949
  }
5906
- function Xn(t) {
5950
+ function Kn(t) {
5907
5951
  const e = v(t), n = new e(t);
5908
5952
  for (let e = 0; e < t; e++) n[e] = e;
5909
5953
  return {
@@ -5915,7 +5959,7 @@
5915
5959
  array: n
5916
5960
  };
5917
5961
  }
5918
- class Wn {
5962
+ class Xn {
5919
5963
  constructor(t, e) {
5920
5964
  this.i = t, this.Y = e || Pt;
5921
5965
  }
@@ -5930,12 +5974,12 @@
5930
5974
  const s = this.lt(e, t, n, r), i = [];
5931
5975
  for (let n = 0; n < s.length; n++) {
5932
5976
  let r;
5933
- if ("b3dm" === s[n].magic) r = new Gn(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new Hn(this.i, this.Y); else if ("pnts" === s[n].magic) r = new Kn; else {
5977
+ if ("b3dm" === s[n].magic) r = new Vn(this.i, this.Y); else if ("i3dm" === s[n].magic) r = new Gn(this.i, this.Y); else if ("pnts" === s[n].magic) r = new Jn; else {
5934
5978
  if ("cmpt" !== s[n].magic) {
5935
5979
  console.warn("Unsupported magic in CMPT tile:", s[n].magic);
5936
5980
  continue;
5937
5981
  }
5938
- r = new Wn(this.i, this.Y);
5982
+ r = new Xn(this.i, this.Y);
5939
5983
  }
5940
5984
  i.push(r.load(t, e, s[n].offset, s[n].byteLength).then(t => t));
5941
5985
  }
@@ -5967,9 +6011,9 @@
5967
6011
  return o;
5968
6012
  }
5969
6013
  }
5970
- t.B3DMLoader = Gn, t.CMPTLoader = Wn, t.Geo3DTilesLayer = Un, t.Geo3DTilesUtil = x,
6014
+ t.B3DMLoader = Vn, t.CMPTLoader = Xn, t.Geo3DTilesLayer = Bn, t.Geo3DTilesUtil = x,
5971
6015
  t.Geo3DTransform = oe, Object.defineProperty(t, "t", {
5972
6016
  value: !0
5973
6017
  });
5974
- })), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.12.4");
6018
+ })), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.12.5");
5975
6019
  }));