@maptalks/3dtiles 0.12.7 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @maptalks/3dtiles v0.12.7
2
+ * @maptalks/3dtiles v0.13.0
3
3
  * LICENSE : UNLICENSED
4
4
  * (c) 2016-2022 maptalks.com
5
5
  */
@@ -199,7 +199,7 @@
199
199
  for (let t = 0; t < n; t++) r[t] = e.charCodeAt(t);
200
200
  return r.buffer;
201
201
  }
202
- const P = [], L = [], B = [], U = [ 0, 0, 0 ], C = function(t) {
202
+ const P = [], L = [], U = [], B = [ 0, 0, 0 ], C = function(t) {
203
203
  return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t;
204
204
  }([]), R = [ 1, 1, 1 ];
205
205
  function F(t, e, n, r, s, i, o) {
@@ -455,7 +455,7 @@
455
455
  return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0,
456
456
  t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = e[0], t[13] = e[1], t[14] = e[2],
457
457
  t[15] = 1, t;
458
- }(P, e.translation || U), s = function(t, e) {
458
+ }(P, e.translation || B), s = function(t, e) {
459
459
  var n = e[0], r = e[1], s = e[2], i = e[3], o = n + n, a = r + r, c = s + s, h = n * o, u = r * o, f = r * a, l = s * o, d = s * a, m = s * c, y = i * o, b = i * a, p = i * c;
460
460
  return t[0] = 1 - f - m, t[1] = u + p, t[2] = l - b, t[3] = 0, t[4] = u - p, t[5] = 1 - h - m,
461
461
  t[6] = d + y, t[7] = 0, t[8] = l + b, t[9] = d - y, t[10] = 1 - h - f, t[11] = 0,
@@ -464,7 +464,7 @@
464
464
  return t[0] = e[0], t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e[1], t[6] = 0,
465
465
  t[7] = 0, t[8] = 0, t[9] = 0, t[10] = e[2], t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0,
466
466
  t[15] = 1, t;
467
- }(B, e.scale || R);
467
+ }(U, e.scale || R);
468
468
  return r(i, s, i), r(t, n, i);
469
469
  }
470
470
  return n(t);
@@ -715,7 +715,7 @@
715
715
  const d = f.channelsMap[n];
716
716
  if (d) for (let t = 0; t < d.length; t++) {
717
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),
718
+ "translation" === e.target.path ? (this.L(s, f.samplers[e.sampler], r, 1), u.translation = a(W, s)) : "rotation" === e.target.path ? (this.U(i, f.samplers[e.sampler], r, 1),
719
719
  u.rotation = O(Z, i)) : "scale" === e.target.path ? (this.L(o, f.samplers[e.sampler], r, 1),
720
720
  u.scale = a(Q, o)) : "weights" === e.target.path && c && (this.L(c, f.samplers[e.sampler], r, c.length),
721
721
  u.weights = c);
@@ -727,7 +727,7 @@
727
727
  switch (e.interpolation) {
728
728
  case "LINEAR":
729
729
  {
730
- const s = this.U(tt, e, n, 1 * r);
730
+ const s = this.B(tt, e, n, 1 * r);
731
731
  s && (t = function(t, e, n, r) {
732
732
  for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
733
733
  return t;
@@ -737,7 +737,7 @@
737
737
 
738
738
  case "STEP":
739
739
  {
740
- const s = this.U(tt, e, n, 1 * r);
740
+ const s = this.B(tt, e, n, 1 * r);
741
741
  s && (t = function(t, e) {
742
742
  for (let n = 0; n < t.length; n++) t[n] = e[n];
743
743
  return t;
@@ -747,32 +747,32 @@
747
747
 
748
748
  case "CUBICSPLINE":
749
749
  {
750
- const s = this.U(tt, e, n, 3 * r);
750
+ const s = this.B(tt, e, n, 3 * r);
751
751
  s && (t = this.C(t, s, e.input.array, 3 * r));
752
752
  break;
753
753
  }
754
754
  }
755
755
  return t;
756
756
  },
757
- B(t, e, n) {
757
+ U(t, e, n) {
758
758
  switch (e.interpolation) {
759
759
  case "LINEAR":
760
760
  {
761
- const r = this.U(tt, e, n, 1);
761
+ const r = this.B(tt, e, n, 1);
762
762
  r && T(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
763
763
  break;
764
764
  }
765
765
 
766
766
  case "STEP":
767
767
  {
768
- const r = this.U(tt, e, n, 1);
768
+ const r = this.B(tt, e, n, 1);
769
769
  r && (t = _(t, ...r.PREVIOUS));
770
770
  break;
771
771
  }
772
772
 
773
773
  case "CUBICSPLINE":
774
774
  {
775
- const r = this.U(tt, e, n, 3);
775
+ const r = this.B(tt, e, n, 3);
776
776
  if (r) {
777
777
  for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
778
778
  r.NEXT[t] = Math.acos(r.NEXT[t]);
@@ -801,7 +801,7 @@
801
801
  }
802
802
  return null;
803
803
  },
804
- U(t, e, n, r) {
804
+ B(t, e, n, r) {
805
805
  const s = e.input.array, i = e.output.array, o = e.output.itemSize;
806
806
  (n < s[0] || n > s[s.length - 1]) && (n = Math.max(s[0], Math.min(s[s.length - 1], n))),
807
807
  n === s[s.length - 1] && (n = s[0]);
@@ -1179,12 +1179,12 @@
1179
1179
  if (y < s) return isFinite(b) ? p : void 0;
1180
1180
  const w = r[0], _ = r[1], g = r[2], T = At;
1181
1181
  T[0] = p[0] * w * 2, T[1] = p[1] * _ * 2, T[2] = p[2] * g * 2;
1182
- let A, O, v, M, S, x, I, N, E, P, L, B = (1 - b) * Ot(e) / (.5 * Ot(T)), U = 0;
1182
+ let A, O, v, M, S, x, I, N, E, P, L, U = (1 - b) * Ot(e) / (.5 * Ot(T)), B = 0;
1183
1183
  do {
1184
- B -= U, v = 1 / (1 + B * w), M = 1 / (1 + B * _), S = 1 / (1 + B * g), x = v * v,
1184
+ U -= B, v = 1 / (1 + U * w), M = 1 / (1 + U * _), S = 1 / (1 + U * g), x = v * v,
1185
1185
  I = M * M, N = S * S, E = x * v, P = I * M, L = N * S, A = l * x + d * I + m * N - 1,
1186
1186
  O = l * E * w + d * P * _ + m * L * g;
1187
- U = A / (-2 * O);
1187
+ B = A / (-2 * O);
1188
1188
  } while (Math.abs(A) > 1e-12);
1189
1189
  return t[0] = i * v, t[1] = o * M, t[2] = a * S, t;
1190
1190
  }(pt, e, yt, n, .1);
@@ -1295,11 +1295,11 @@
1295
1295
  name: "Float64Array"
1296
1296
  }
1297
1297
  };
1298
- function Bt(t) {
1298
+ function Ut(t) {
1299
1299
  for (let e in Lt) if (t === Lt[e].ctor) return Lt[e].type;
1300
1300
  throw new Error("unrecognized ctor:" + t);
1301
1301
  }
1302
- function Ut(t, e, n, r) {
1302
+ function Bt(t, e, n, r) {
1303
1303
  const s = t, i = e.length / 3;
1304
1304
  for (let t = 0; t < i; t++) s[3 * t] = e[3 * t] / 65535 * r[0] + n[0], s[3 * t + 1] = e[3 * t + 1] / 65535 * r[1] + n[1],
1305
1305
  s[3 * t + 2] = e[3 * t + 2] / 65535 * r[2] + n[2];
@@ -1699,7 +1699,7 @@
1699
1699
  return n;
1700
1700
  }
1701
1701
  at(t, e, n) {
1702
- return Ut(new Float32Array(t.length), t, e, n);
1702
+ return Bt(new Float32Array(t.length), t, e, n);
1703
1703
  }
1704
1704
  rt() {
1705
1705
  return null;
@@ -1779,7 +1779,7 @@
1779
1779
  byteOffset: 0,
1780
1780
  itemSize: 1,
1781
1781
  count: t.length,
1782
- componentType: Bt(t.constructor),
1782
+ componentType: Ut(t.constructor),
1783
1783
  array: t
1784
1784
  }, o.push(t.buffer);
1785
1785
  } else if (a.BATCH_ID || Object.keys(h).length) {
@@ -1928,7 +1928,7 @@
1928
1928
  return a;
1929
1929
  }
1930
1930
  at(t, e, n) {
1931
- return Ut(new Float32Array(t.length), t, e, n);
1931
+ return Bt(new Float32Array(t.length), t, e, n);
1932
1932
  }
1933
1933
  rt() {
1934
1934
  return null;
@@ -1944,7 +1944,7 @@
1944
1944
  byteOffset: 0,
1945
1945
  itemSize: 1,
1946
1946
  count: t,
1947
- componentType: Bt(e),
1947
+ componentType: Ut(e),
1948
1948
  array: r
1949
1949
  };
1950
1950
  }
@@ -2118,7 +2118,7 @@
2118
2118
  const r = this.options.services[t.rootIdx];
2119
2119
  let s = r.urlParams;
2120
2120
  s && (s = (n.indexOf("?") > 0 ? "&" : "?") + s);
2121
- let i = z.getArrayBuffer(n + (s || ""), r.ajaxOptions);
2121
+ let i = z.getArrayBuffer(n + (s || ""), r.fetchOptions);
2122
2122
  const o = i.xhr;
2123
2123
  i = i.then(r => {
2124
2124
  delete this.bt[n], r && r.status ? e(r) : (t.arraybuffer = r && r.data, this.loadTile(t, e));
@@ -2498,10 +2498,10 @@
2498
2498
  var r = new I(3);
2499
2499
  return r[0] = t, r[1] = e, r[2] = n, r;
2500
2500
  }
2501
- function B(t, e) {
2501
+ function U(t, e) {
2502
2502
  return t[0] = e[0], t[1] = e[1], t[2] = e[2], t;
2503
2503
  }
2504
- function U(t, e, n, r) {
2504
+ function B(t, e, n, r) {
2505
2505
  return t[0] = e, t[1] = n, t[2] = r, t;
2506
2506
  }
2507
2507
  function C(t, e, n) {
@@ -3123,9 +3123,9 @@
3123
3123
  const l = u.channelsMap[n];
3124
3124
  if (l) for (let t = 0; t < l.length; t++) {
3125
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),
3126
+ "translation" === e.target.path ? (this.L(s, u.samplers[e.sampler], r, 1), h.translation = U(Tt, s)) : "rotation" === e.target.path ? (this.U(i, u.samplers[e.sampler], r, 1),
3127
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),
3128
+ h.scale = U(Ot, o)) : "weights" === e.target.path && a && (this.L(a, u.samplers[e.sampler], r, a.length),
3129
3129
  h.weights = a);
3130
3130
  }
3131
3131
  }
@@ -3135,7 +3135,7 @@
3135
3135
  switch (e.interpolation) {
3136
3136
  case "LINEAR":
3137
3137
  {
3138
- const s = this.U(Mt, e, n, 1 * r);
3138
+ const s = this.B(Mt, e, n, 1 * r);
3139
3139
  s && (t = function(t, e, n, r) {
3140
3140
  for (let s = 0; s < t.length; s++) t[s] = e[s] + r * (n[s] - e[s]);
3141
3141
  return t;
@@ -3145,7 +3145,7 @@
3145
3145
 
3146
3146
  case "STEP":
3147
3147
  {
3148
- const s = this.U(Mt, e, n, 1 * r);
3148
+ const s = this.B(Mt, e, n, 1 * r);
3149
3149
  s && (t = function(t, e) {
3150
3150
  for (let n = 0; n < t.length; n++) t[n] = e[n];
3151
3151
  return t;
@@ -3155,32 +3155,32 @@
3155
3155
 
3156
3156
  case "CUBICSPLINE":
3157
3157
  {
3158
- const s = this.U(Mt, e, n, 3 * r);
3158
+ const s = this.B(Mt, e, n, 3 * r);
3159
3159
  s && (t = this.C(t, s, e.input.array, 3 * r));
3160
3160
  break;
3161
3161
  }
3162
3162
  }
3163
3163
  return t;
3164
3164
  },
3165
- B(t, e, n) {
3165
+ U(t, e, n) {
3166
3166
  switch (e.interpolation) {
3167
3167
  case "LINEAR":
3168
3168
  {
3169
- const r = this.U(Mt, e, n, 1);
3169
+ const r = this.B(Mt, e, n, 1);
3170
3170
  r && $(t, r.PREVIOUS, r.NEXT, r.INTERPOLATION);
3171
3171
  break;
3172
3172
  }
3173
3173
 
3174
3174
  case "STEP":
3175
3175
  {
3176
- const r = this.U(Mt, e, n, 1);
3176
+ const r = this.B(Mt, e, n, 1);
3177
3177
  r && (t = H(t, ...r.PREVIOUS));
3178
3178
  break;
3179
3179
  }
3180
3180
 
3181
3181
  case "CUBICSPLINE":
3182
3182
  {
3183
- const r = this.U(Mt, e, n, 3);
3183
+ const r = this.B(Mt, e, n, 3);
3184
3184
  if (r) {
3185
3185
  for (let t = 0; t < r.PREVIOUS.length; t++) r.PREVIOUS[t] = Math.acos(r.PREVIOUS[t]),
3186
3186
  r.NEXT[t] = Math.acos(r.NEXT[t]);
@@ -3209,7 +3209,7 @@
3209
3209
  }
3210
3210
  return null;
3211
3211
  },
3212
- U(t, e, n, r) {
3212
+ B(t, e, n, r) {
3213
3213
  const s = e.input.array, i = e.output.array, o = e.output.itemSize;
3214
3214
  (n < s[0] || n > s[s.length - 1]) && (n = Math.max(s[0], Math.min(s[s.length - 1], n))),
3215
3215
  n === s[s.length - 1] && (n = s[0]);
@@ -3231,7 +3231,7 @@
3231
3231
  },
3232
3232
  getAnimationClip(t, e, n, r) {
3233
3233
  const s = t.nodes[e] && t.nodes[e].weights;
3234
- return U(Tt, ...vt.TRANSLATION), H(At, ...vt.ROTATION), U(Ot, ...vt.SCALE), this.P(r, t, e, n, Tt, At, Ot, s);
3234
+ return B(Tt, ...vt.TRANSLATION), H(At, ...vt.ROTATION), B(Ot, ...vt.SCALE), this.P(r, t, e, n, Tt, At, Ot, s);
3235
3235
  },
3236
3236
  getTimeSpan(t) {
3237
3237
  if (!t.animations) return null;
@@ -3333,7 +3333,7 @@
3333
3333
  }
3334
3334
  F(t, e, n) {
3335
3335
  this.gltf = e, this.glbBuffer = n, this.version = e.asset ? +e.asset.version : 1,
3336
- this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = xt ? Bt : this.options.requestImage || Et,
3336
+ this.rootPath = t, this.buffers = {}, this.requests = {}, this.options.requestImage = xt ? Ut : this.options.requestImage || Et,
3337
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 || {}),
3338
3338
  this.adapter.iterate((t, e, n) => {
3339
3339
  e.id = "buffer_" + n;
@@ -3533,10 +3533,10 @@
3533
3533
  }, n.src = t;
3534
3534
  }
3535
3535
  let Pt, Lt;
3536
- function Bt(t, e) {
3536
+ function Ut(t, e) {
3537
3537
  Pt || (Pt = new OffscreenCanvas(2, 2), Lt = Pt.getContext("2d")), fetch(t).then(t => t.blob()).then(t => createImageBitmap(t)).then(t => {
3538
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),
3539
+ Bt(n) || (n = Ct(n)), Bt(r) || (r = Ct(r)), Pt.width = n, Pt.height = r, Lt.drawImage(t, 0, 0, n, r),
3540
3540
  t.close();
3541
3541
  const s = Lt.getImageData(0, 0, n, r);
3542
3542
  e(null, {
@@ -3548,7 +3548,7 @@
3548
3548
  console.warn(t), e(t);
3549
3549
  });
3550
3550
  }
3551
- function Ut(t) {
3551
+ function Bt(t) {
3552
3552
  return 0 == (t & t - 1) && 0 !== t;
3553
3553
  }
3554
3554
  function Ct(t) {
@@ -3775,12 +3775,12 @@
3775
3775
  if (m < s) return isFinite(y) ? b : void 0;
3776
3776
  const p = r[0], w = r[1], _ = r[2], g = ne;
3777
3777
  g[0] = b[0] * p * 2, g[1] = b[1] * w * 2, g[2] = b[2] * _ * 2;
3778
- let T, A, O, v, M, S, x, I, N, E, P, L = (1 - y) * re(e) / (.5 * re(g)), B = 0;
3778
+ let T, A, O, v, M, S, x, I, N, E, P, L = (1 - y) * re(e) / (.5 * re(g)), U = 0;
3779
3779
  do {
3780
- L -= B, O = 1 / (1 + L * p), v = 1 / (1 + L * w), M = 1 / (1 + L * _), S = O * O,
3780
+ L -= U, O = 1 / (1 + L * p), v = 1 / (1 + L * w), M = 1 / (1 + L * _), S = O * O,
3781
3781
  x = v * v, I = M * M, N = S * O, E = x * v, P = I * M, T = f * S + l * x + d * I - 1,
3782
3782
  A = f * N * p + l * E * w + d * P * _;
3783
- B = T / (-2 * A);
3783
+ U = T / (-2 * A);
3784
3784
  } while (Math.abs(T) > 1e-12);
3785
3785
  return t[0] = i * O, t[1] = o * v, t[2] = a * M, t;
3786
3786
  }(Zt, e, Xt, n, .1);
@@ -3993,14 +3993,14 @@
3993
3993
  north: "up",
3994
3994
  south: "down"
3995
3995
  }
3996
- }[Ne = "east"][Ee = "north"], ge[Be = Ne + Ee] ? Pe = ge[Be] : (Pe = function(t, e, n) {
3996
+ }[Ne = "east"][Ee = "north"], ge[Ue = Ne + Ee] ? Pe = ge[Ue] : (Pe = function(t, e, n) {
3997
3997
  if (function(t, e) {
3998
3998
  var n = t[0], r = t[1], s = t[2], i = e[0], o = e[1], a = e[2];
3999
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)) {
4000
+ }(t, Me)) U(Ae, _e[Ne]), U(Oe, _e[Ee]), U(ve, _e[Le]); else if (Se(t[0], 0, 1e-14) && Se(t[1], 0, 1e-14)) {
4001
4001
  var r = _(t[2]);
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),
4003
- B(ve, _e[Le]), "east" !== Le && "west" !== Le && F(ve, ve, r);
4002
+ U(Ae, _e[Ne]), "east" !== Ne && "west" !== Ne && F(Ae, Ae, r), U(Oe, _e[Ee]), "east" !== Ee && "west" !== Ee && F(Oe, Oe, r),
4003
+ U(ve, _e[Le]), "east" !== Le && "west" !== Le && F(ve, ve, r);
4004
4004
  } else {
4005
4005
  ie(t, Te.up);
4006
4006
  var s = Te.up, i = Te.east;
@@ -4010,9 +4010,9 @@
4010
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],
4011
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],
4012
4012
  n[13] = t[1], n[14] = t[2], n[15] = 1, n;
4013
- }, ge[Be] = Pe), Pe);
4014
- var Ne, Ee, Pe, Le, Be;
4015
- const Ue = [], Ce = [], Re = [], Fe = [], De = [], ke = [], ze = [], je = {
4013
+ }, ge[Ue] = Pe), Pe);
4014
+ var Ne, Ee, Pe, Le, Ue;
4015
+ const Be = [], Ce = [], Re = [], Fe = [], De = [], ke = [], ze = [], je = {
4016
4016
  x: 0,
4017
4017
  y: 0
4018
4018
  }, Ve = {
@@ -4036,7 +4036,7 @@
4036
4036
  class bn {
4037
4037
  constructor(t, e) {
4038
4038
  this.Nt = e, this.Et = e.getRenderer().canvas, this.Pt = new s.SpatialReference,
4039
- this.Lt = t, this.Bt = new n.reshader.Renderer(t), this.Ut = {}, this.Ct = {}, this.Rt = {},
4039
+ this.Lt = t, this.Ut = new n.reshader.Renderer(t), this.Bt = {}, this.Ct = {}, this.Rt = {},
4040
4040
  this.Ft = {}, this.Dt = {}, this.kt = {}, this.zt = {}, this.jt = new n.reshader.Scene,
4041
4041
  this.Vt = new n.reshader.Scene, this.Gt = new n.reshader.Scene, this.Ht = new n.reshader.Scene,
4042
4042
  this.qt = new n.reshader.ResourceLoader(t.texture(2)), this.$t = this.Jt.bind(this),
@@ -4090,16 +4090,16 @@
4090
4090
  for (const t in this.Ft) d.push(this.Ft[t]);
4091
4091
  this.Vt.setMeshes(d);
4092
4092
  const m = this.ie();
4093
- return f += this.Bt.render(this.oe, m, this.Vt, r && r.fbo), f;
4093
+ return f += this.Ut.render(this.oe, m, this.Vt, r && r.fbo), f;
4094
4094
  }
4095
4095
  ne(t, e, n, r, s, i) {
4096
4096
  t.filter = n.filter(t => !!t), e.debug = !1, this.jt.setMeshes(s), e.stencilEnable = !1,
4097
4097
  e.debug = !1, e.cullFace = "back", e.colorMask = un;
4098
4098
  let o = 0;
4099
- this.jt.setMeshes(i), o += this.Bt.render(t, e, this.jt, r && r.fbo), e.stencilEnable = !1;
4099
+ this.jt.setMeshes(i), o += this.Ut.render(t, e, this.jt, r && r.fbo), e.stencilEnable = !1;
4100
4100
  const a = [];
4101
4101
  for (const t in this.Dt) a.push(...this.Dt[t]);
4102
- return this.Gt.setMeshes(a), o += this.Bt.render(t, e, this.Gt, r && r.fbo), o;
4102
+ return this.Gt.setMeshes(a), o += this.Ut.render(t, e, this.Gt, r && r.fbo), o;
4103
4103
  }
4104
4104
  ae(t, e) {
4105
4105
  return e.ee.ce - t.ee.ce;
@@ -4114,7 +4114,7 @@
4114
4114
  }
4115
4115
  this.ue.filter = r, this.Ht.setMeshes(a);
4116
4116
  const h = this.fe(n);
4117
- this.Bt.render(this.ue, h, this.Ht, s && s.fbo);
4117
+ this.Ut.render(this.ue, h, this.Ht, s && s.fbo);
4118
4118
  }
4119
4119
  deleteTile(t) {
4120
4120
  const e = t.node.id;
@@ -4123,9 +4123,9 @@
4123
4123
  le(t) {
4124
4124
  const e = this.Ct[t];
4125
4125
  e && (e.geometry.dispose(), e.dispose(), delete this.Ct[t]);
4126
- let n = this.Rt[t] || this.Ft[t] || this.Dt[t] || this.kt[t] || this.Ut[t];
4126
+ let n = this.Rt[t] || this.Ft[t] || this.Dt[t] || this.kt[t] || this.Bt[t];
4127
4127
  this.kt[t] ? this.de(t) : n && (this.me(n), delete this.Rt[t], delete this.Ft[t],
4128
- delete this.Dt[t], delete this.Ut[t]);
4128
+ delete this.Dt[t], delete this.Bt[t]);
4129
4129
  }
4130
4130
  de(t) {
4131
4131
  let e = this.kt[t];
@@ -4158,8 +4158,8 @@
4158
4158
  this.Ft = {};
4159
4159
  for (const t in this.Dt) this.le(t);
4160
4160
  this.Dt = {};
4161
- for (const t in this.Ut) this.le(t);
4162
- this.Ut = {};
4161
+ for (const t in this.Bt) this.le(t);
4162
+ this.Bt = {};
4163
4163
  for (const t in this.Ct) this.le(t);
4164
4164
  this.Ct = {}, this.re && (this.re.dispose(), delete this.re), this.se && (this.se.dispose(),
4165
4165
  delete this.se), this.oe && (this.oe.dispose(), delete this.oe), this.ue && (this.ue.dispose(),
@@ -4187,7 +4187,7 @@
4187
4187
  return this.Rt[t.id];
4188
4188
  }
4189
4189
  has(t) {
4190
- return this.Yt(t) || this.Ft[t.id] || this.Dt[t.id] || this.kt[t.id] || this.Ut[t.id];
4190
+ return this.Yt(t) || this.Ft[t.id] || this.Dt[t.id] || this.kt[t.id] || this.Bt[t.id];
4191
4191
  }
4192
4192
  createPntsMesh(t, e, r, s) {
4193
4193
  if (this.Ft[e]) {
@@ -4235,7 +4235,7 @@
4235
4235
  createI3DMMesh(t, e, r, s) {
4236
4236
  if (this.Dt[e]) {
4237
4237
  const t = this.Dt[e];
4238
- return console.warn(`i3dm mesh with id(${e}) was already created.`), this.Ut[e] || s(null, {
4238
+ return console.warn(`i3dm mesh with id(${e}) was already created.`), this.Bt[e] || s(null, {
4239
4239
  id: e,
4240
4240
  mesh: t
4241
4241
  }), t;
@@ -4244,7 +4244,7 @@
4244
4244
  "instance_vectorA": new Float32Array(4 * l),
4245
4245
  "instance_vectorB": new Float32Array(4 * l),
4246
4246
  "instance_vectorC": new Float32Array(4 * l)
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);
4247
+ }, M = new Float32Array(3), S = new Float32Array(3), x = [], I = new Float32Array(1), N = new Float32Array(3), E = [], P = [], L = [], U = [], B = new Float32Array(9);
4248
4248
  !function(t, e) {
4249
4249
  let {componentType: n, byteOffset: r, byteStride: s, count: i, itemSize: o} = t;
4250
4250
  const a = t.array.buffer, c = n ? Nt.getTypedArrayCtor(n) : t.array.constructor;
@@ -4265,10 +4265,10 @@
4265
4265
  }
4266
4266
  }(p, (t, e) => {
4267
4267
  w ? (Gt(S, _, e), Gt(M, w, e), n.vec3.cross(x, S, M), n.vec3.normalize(x, x), A(E, S, 0),
4268
- A(E, M, 1), A(E, x, 2), n.quat.fromMat3(P, E)) : O ? (Gt(U, O, e), n.quat.fromMat3(P, U)) : n.quat.identity(P),
4268
+ A(E, M, 1), A(E, x, 2), n.quat.fromMat3(P, E)) : O ? (Gt(B, O, e), n.quat.fromMat3(P, B)) : n.quat.identity(P),
4269
4269
  g ? (Gt(I, g, e), n.vec3.set(L, I[0], I[0], I[0])) : T ? (Gt(N, T, e), n.vec3.set(L, ...N)) : n.vec3.set(L, 1, 1, 1),
4270
- n.mat4.fromRotationTranslationScale(B, P, t, L), Ht(v.instance_vectorA, e, B, 0),
4271
- Ht(v.instance_vectorB, e, B, 1), Ht(v.instance_vectorC, e, B, 2);
4270
+ n.mat4.fromRotationTranslationScale(U, P, t, L), Ht(v.instance_vectorA, e, U, 0),
4271
+ Ht(v.instance_vectorB, e, U, 1), Ht(v.instance_vectorC, e, U, 2);
4272
4272
  });
4273
4273
  const C = {};
4274
4274
  for (const t in v) C[t] = {
@@ -4297,15 +4297,15 @@
4297
4297
  }), D ? (this.Dt[e] = k, s(null, {
4298
4298
  id: e,
4299
4299
  mesh: k
4300
- })) : (this.Ut[e] = {
4300
+ })) : (this.Bt[e] = {
4301
4301
  meshes: k,
4302
4302
  count: F
4303
4303
  }, k.ve = s), k;
4304
4304
  }
4305
4305
  createB3DMMesh(t, e, r, i) {
4306
- if (this.Rt[e] || this.Ut[e]) {
4306
+ if (this.Rt[e] || this.Bt[e]) {
4307
4307
  const t = this.Rt[e];
4308
- return console.warn(`mesh with id(${e}) was already created.`), this.Ut[e] || i(null, {
4308
+ return console.warn(`mesh with id(${e}) was already created.`), this.Bt[e] || i(null, {
4309
4309
  id: e,
4310
4310
  mesh: t
4311
4311
  }), t;
@@ -4335,7 +4335,7 @@
4335
4335
  }), b ? (this.Rt[e] = m, i(null, {
4336
4336
  id: e,
4337
4337
  mesh: m
4338
- })) : (this.Ut[e] = {
4338
+ })) : (this.Bt[e] = {
4339
4339
  meshes: m,
4340
4340
  count: y
4341
4341
  }, m.ve = i), m;
@@ -4347,12 +4347,12 @@
4347
4347
  xe(h, n.vec3.transformMat4(fn, e, h), h);
4348
4348
  }
4349
4349
  const u = function(t, e, n, r, s, i, o) {
4350
- e = B(Ue, e);
4351
- const a = Kt(Ue, e[0] * Ge, e[1] * Ge, e[2]), c = function(t, e) {
4350
+ e = U(Be, e);
4351
+ const a = Kt(Be, e[0] * Ge, e[1] * Ge, e[2]), c = function(t, e) {
4352
4352
  return t[0] = e[12], t[1] = e[13], t[2] = e[14], t;
4353
4353
  }(Ce, n), h = r.ellipsoid;
4354
4354
  var u;
4355
- u = 0 === G(c) ? U(Re, 0, 0, -6378137) : te(Re, c), je.x = u[0], je.y = u[1];
4355
+ u = 0 === G(c) ? B(Re, 0, 0, -6378137) : te(Re, c), je.x = u[0], je.y = u[1];
4356
4356
  const f = r.project(je, Ve);
4357
4357
  Fe[0] = f.x / s, Fe[1] = f.y / s, Fe[2] = (u[2] + o) * i;
4358
4358
  const l = Ie(a, h, De), d = function(t, e, n) {
@@ -4374,7 +4374,7 @@
4374
4374
  }(ze, n), t);
4375
4375
  return xe(t, Fe, d), t;
4376
4376
  }(h, r, h, i.getProjection(), i.getGLRes(), c, o), f = function(t, e) {
4377
- return U(t, e[12], e[13], e[14]), t;
4377
+ return B(t, e[12], e[13], e[14]), t;
4378
4378
  }(mn, u);
4379
4379
  let l = this.Nt.options.offset;
4380
4380
  if (y(l)) {
@@ -4663,10 +4663,10 @@
4663
4663
  return n.createObjectURL(r);
4664
4664
  }
4665
4665
  Jt({target: t}) {
4666
- const e = t.Ne, n = this.Ut[e];
4666
+ const e = t.Ne, n = this.Bt[e];
4667
4667
  if (n.count--, !n.count) {
4668
4668
  const t = n.meshes;
4669
- this.Rt[e] = t, delete this.Ut[e];
4669
+ this.Rt[e] = t, delete this.Bt[e];
4670
4670
  const r = t.ve;
4671
4671
  delete t.ve, r(null, {
4672
4672
  mesh: n.meshes,
@@ -4712,11 +4712,11 @@
4712
4712
  if (n && !n.intersects(this.canvasExtent2D)) return void this.completeRender();
4713
4713
  const {root: r, tiles: s} = this.layer.getTiles(), i = s.length;
4714
4714
  if (!s || !i) return void this.completeRender();
4715
- this.Be();
4716
- const {selectedTiles: o, leaves: a, requests: c} = this.Ue(r, s);
4715
+ this.Ue();
4716
+ const {selectedTiles: o, leaves: a, requests: c} = this.Be(r, s);
4717
4717
  c.length && this.loadTiles(c), this.Ce(o, a, e), this.Re(), c.length || this.completeRender();
4718
4718
  }
4719
- Ue(t, e) {
4719
+ Be(t, e) {
4720
4720
  let n = [];
4721
4721
  this.Fe();
4722
4722
  let r = 0;
@@ -4848,7 +4848,7 @@
4848
4848
  if (n.ajaxInMainThread) {
4849
4849
  let r = n.urlParams;
4850
4850
  r && (r = (e.indexOf("?") > 0 ? "&" : "?") + r);
4851
- let s = ft.getArrayBuffer(e + (r || ""), n.ajaxOptions);
4851
+ let s = ft.getArrayBuffer(e + (r || ""), n.fetchOptions);
4852
4852
  const i = s.xhr;
4853
4853
  s = s.then(n => {
4854
4854
  delete this.bt[e], n ? this.Je(e, n.data, t) : this.onTileError(null, t);
@@ -4876,7 +4876,7 @@
4876
4876
  }) : this.onTilesetLoad(n, r, t);
4877
4877
  });
4878
4878
  }
4879
- Be() {
4879
+ Ue() {
4880
4880
  const t = this.getMap(), e = this.layer.options.meshLimitPerFrame;
4881
4881
  let n = 0;
4882
4882
  for (;this.Le.length && (n < e || !t.isInteracting()); ) {
@@ -5058,7 +5058,7 @@
5058
5058
  }(t, e, n));
5059
5059
  }
5060
5060
  const Tn = [], An = [], On = [], vn = [], Mn = [];
5061
- const Sn = s.projection.EPSG3857, xn = new s.Extent(0, 0, 0, 0), In = new s.Extent(0, 0, 0, 0), Nn = [], En = [], Pn = [], Ln = [], 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([]);
5061
+ const Sn = s.projection.EPSG3857, xn = new s.Extent(0, 0, 0, 0), In = new s.Extent(0, 0, 0, 0), Nn = [], En = [], Pn = [], Ln = [], Un = new s.Point(0, 0), Bn = new s.Coordinate(0, 0), Cn = new s.Coordinate(0, 0), Rn = [], Fn = new s.Coordinate(0, 0), Dn = n.mat4.identity([]);
5062
5062
  class kn extends s.Layer {
5063
5063
  constructor(t, e) {
5064
5064
  super(t, e), this.Ye(), this.bt = {}, this.tn = [];
@@ -5271,13 +5271,13 @@
5271
5271
  if (m) {
5272
5272
  e = xn.set(p(m[0]), p(m[1]), p(m[2]), p(m[3]));
5273
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] ] ],
5274
+ e = e.convertTo(t => this.ye(t, Un), In), i = m[4], r = m[5], a = this.tn[o] = [ [ e.xmin, e.ymin, i * n[2] ], [ e.xmax, e.ymax, r * n[2] ] ],
5275
5275
  a.center = t;
5276
5276
  } else if (d) {
5277
- const t = te(Nn, d), e = new s.Coordinate(t), n = this.ye(e, Bn).toArray(), r = this.On(e);
5277
+ const t = te(Nn, d), e = new s.Coordinate(t), n = this.ye(e, Un).toArray(), r = this.On(e);
5278
5278
  n.push(t[2] * r[2]), a = this.tn[o] = [ n, d[3] * r[2] ], a.center = e;
5279
5279
  } else if (y) {
5280
- const e = te(Nn, y), r = new s.Coordinate(e), i = this.ye(r, Bn).toArray(), c = this.On(r);
5280
+ const e = te(Nn, y), r = new s.Coordinate(e), i = this.ye(r, Un).toArray(), c = this.On(r);
5281
5281
  i.push(e[2] * c[2]);
5282
5282
  const h = y.slice(3);
5283
5283
  n.mat4.exactEquals(t.matrix, Dn) || n.mat3.multiply(h, n.mat3.fromMat4(Rn, t.matrix), h);
@@ -5371,7 +5371,7 @@
5371
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
5372
  }
5373
5373
  function Vn(t, e) {
5374
- return Un.x = p(t), Un.y = p(e), Sn.project(Un, Cn).toArray();
5374
+ return Bn.x = p(t), Bn.y = p(e), Sn.project(Bn, Cn).toArray();
5375
5375
  }
5376
5376
  kn.mergeOptions({
5377
5377
  "maxGPUMemory": 512,
@@ -5386,7 +5386,6 @@
5386
5386
  "debugOutline": [ 0, 1, 0 ],
5387
5387
  "meshLimitPerFrame": 1,
5388
5388
  "antialias": !1,
5389
- "sRGBTolinear": !1,
5390
5389
  "optionalExtensions": [ "ANGLE_instanced_arrays", "OES_element_index_uint", "OES_standard_derivatives", "OES_vertex_array_object", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_texture_float", "OES_texture_float_linear", "WEBGL_depth_texture", "EXT_shader_texture_lod", "WEBGL_compressed_texture_astc", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_compressed_texture_s3tc_srgb" ],
5391
5390
  "offset": [ 0, 0 ]
5392
5391
  }), kn.registerRenderer("gl", pn);
@@ -5986,5 +5985,5 @@
5986
5985
  t.Geo3DTransform = oe, Object.defineProperty(t, "t", {
5987
5986
  value: !0
5988
5987
  });
5989
- })), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.12.7");
5988
+ })), i.Map.VERSION, o.GroupGLLayer.VERSION, "undefined" != typeof console && console.log("@maptalks/3dtiles v0.13.0");
5990
5989
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptalks/3dtiles",
3
- "version": "0.12.7",
3
+ "version": "0.13.0",
4
4
  "description": "3d tiles layer for maptalks",
5
5
  "main": "dist/maptalks.3dtiles.js",
6
6
  "module": "dist/maptalks.3dtiles.es.js",