@takram/three-geospatial 0.0.1-alpha.6 → 0.0.1-alpha.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.
package/build/index.js CHANGED
@@ -1,216 +1,259 @@
1
- var k = Object.defineProperty;
2
- var Q = (s, t, e) => t in s ? k(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var l = (s, t, e) => Q(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { Loader as b, FileLoader as Y, BufferAttribute as F, Box3 as $, Vector3 as p, Sphere as J, BufferGeometry as K, UnsignedByteType as Z, ByteType as tt, FloatType as et, Data3DTexture as st, DataTexture as nt, RGBAFormat as it, ClampToEdgeWrapping as v, LinearFilter as _, MathUtils as d, Matrix4 as rt, Quaternion as ot, Ray as at, Vector2 as C } from "three";
5
- import { E as B, G as w } from "./shared.js";
6
- import { a as ce } from "./shared.js";
7
- var ht = process.env.NODE_ENV === "production", N = "Invariant failed";
8
- function R(s, t) {
9
- if (!s) {
10
- if (ht)
11
- throw new Error(N);
12
- var e = N;
1
+ var J = Object.defineProperty;
2
+ var Z = (n, t, e) => t in n ? J(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var d = (n, t, e) => Z(n, typeof t != "symbol" ? t + "" : t, e);
4
+ import { Loader as P, FileLoader as K, BufferGeometry as tt, BufferAttribute as B, Box3 as et, Vector3 as p, Sphere as nt, UnsignedByteType as st, ByteType as rt, FloatType as it, LinearFilter as N, ClampToEdgeWrapping as O, RGBAFormat as ot, Data3DTexture as at, DataTexture as ht, MathUtils as l, Quaternion as ct, Matrix4 as lt, Ray as dt, RepeatWrapping as D, NearestFilter as R, RedFormat as ut, Vector2 as H } from "three";
5
+ import { E as C, G as w } from "./shared.js";
6
+ import { a as xe } from "./shared.js";
7
+ var pt = process.env.NODE_ENV === "production", G = "Invariant failed";
8
+ function W(n, t) {
9
+ if (!n) {
10
+ if (pt)
11
+ throw new Error(G);
12
+ var e = G;
13
13
  throw new Error(e);
14
14
  }
15
15
  }
16
- class ct extends b {
17
- load(t, e, n, i) {
18
- const r = new Y(this.manager);
19
- r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
16
+ class ft extends P {
17
+ load(t, e, s, r) {
18
+ const i = new K(this.manager);
19
+ i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setPath(this.path), i.setWithCredentials(this.withCredentials), i.load(
20
20
  t,
21
21
  (o) => {
22
- R(o instanceof ArrayBuffer);
22
+ W(o instanceof ArrayBuffer);
23
23
  try {
24
24
  e(o);
25
25
  } catch (a) {
26
- i != null ? i(a) : console.error(a), this.manager.itemError(t);
26
+ r != null ? r(a) : console.error(a), this.manager.itemError(t);
27
27
  }
28
28
  },
29
- n,
30
- i
29
+ s,
30
+ r
31
31
  );
32
32
  }
33
33
  }
34
- function It(s) {
34
+ function Bt(n) {
35
35
  }
36
- function Dt(s) {
37
- var r;
38
- const { attributes: t, index: e, boundingBox: n, boundingSphere: i } = s;
36
+ function Nt(n) {
37
+ var i;
38
+ const { attributes: t, index: e, boundingBox: s, boundingSphere: r } = n;
39
39
  return [
40
- { attributes: t, index: e, boundingBox: n, boundingSphere: i },
40
+ { attributes: t, index: e, boundingBox: s, boundingSphere: r },
41
41
  [
42
- ...Object.values(s.attributes).map(
42
+ ...Object.values(n.attributes).map(
43
43
  (o) => o.array.buffer
44
44
  ),
45
- (r = s.index) == null ? void 0 : r.array.buffer
45
+ (i = n.index) == null ? void 0 : i.array.buffer
46
46
  ].filter((o) => o != null)
47
47
  ];
48
48
  }
49
- function zt(s, t = new K()) {
50
- for (const [e, n] of Object.entries(s.attributes))
49
+ function Ot(n, t = new tt()) {
50
+ for (const [e, s] of Object.entries(n.attributes))
51
51
  t.setAttribute(
52
52
  e,
53
- new F(
54
- n.array,
55
- n.itemSize,
56
- n.normalized
53
+ new B(
54
+ s.array,
55
+ s.itemSize,
56
+ s.normalized
57
57
  )
58
58
  );
59
- if (t.index = s.index != null ? new F(
60
- s.index.array,
61
- s.index.itemSize,
62
- s.index.normalized
63
- ) : null, s.boundingBox != null) {
64
- const { min: e, max: n } = s.boundingBox;
65
- t.boundingBox = new $(
59
+ if (t.index = n.index != null ? new B(
60
+ n.index.array,
61
+ n.index.itemSize,
62
+ n.index.normalized
63
+ ) : null, n.boundingBox != null) {
64
+ const { min: e, max: s } = n.boundingBox;
65
+ t.boundingBox = new et(
66
66
  new p(e.x, e.y, e.z),
67
- new p(n.x, n.y, n.z)
67
+ new p(s.x, s.y, s.z)
68
68
  );
69
69
  }
70
- if (s.boundingSphere != null) {
71
- const { center: e, radius: n } = s.boundingSphere;
72
- t.boundingSphere = new J(
70
+ if (n.boundingSphere != null) {
71
+ const { center: e, radius: s } = n.boundingSphere;
72
+ t.boundingSphere = new nt(
73
73
  new p(e.x, e.y, e.z),
74
- n
74
+ s
75
75
  );
76
76
  }
77
77
  return t;
78
78
  }
79
- const bt = 128, Ut = 128, Pt = 64;
80
- function lt(s) {
81
- const t = s instanceof Int8Array ? "int8" : s instanceof Uint8Array || s instanceof Uint8ClampedArray ? "uint8" : s instanceof Int16Array ? "int16" : s instanceof Uint16Array ? "uint16" : s instanceof Int32Array ? "int32" : s instanceof Uint32Array ? "uint32" : s instanceof Float32Array ? "float32" : s instanceof Float64Array ? "float64" : null;
82
- return R(t != null), t;
79
+ const yt = 128, gt = 128, wt = 64, Rt = "https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/9627216cc50057994c98a2118f3c4a23765d43b9/packages/core/assets/stbn.bin";
80
+ function mt(n) {
81
+ const t = n instanceof Int8Array ? "int8" : n instanceof Uint8Array || n instanceof Uint8ClampedArray ? "uint8" : n instanceof Int16Array ? "int16" : n instanceof Uint16Array ? "uint16" : n instanceof Int32Array ? "int32" : n instanceof Uint32Array ? "uint32" : n instanceof Float32Array ? "float32" : n instanceof Float64Array ? "float64" : null;
82
+ return W(t != null), t;
83
83
  }
84
- function y(s, t, e, n = !0) {
85
- const i = new DataView(s), r = new t(i.byteLength / t.BYTES_PER_ELEMENT);
86
- for (let o = 0, a = 0; o < r.length; ++o, a += t.BYTES_PER_ELEMENT)
87
- r[o] = i[e](a, n);
88
- return r;
84
+ let L;
85
+ function xt() {
86
+ if (L != null)
87
+ return L;
88
+ const n = new Uint32Array([268435456]);
89
+ return L = new Uint8Array(n.buffer, n.byteOffset, n.byteLength)[0] === 0, L;
89
90
  }
90
- const Ft = (s, t) => y(s, Uint8Array, "getUint8", t), vt = (s, t) => y(s, Int8Array, "getInt8", t), G = (s, t) => y(s, Uint16Array, "getUint16", t), q = (s, t) => y(s, Int16Array, "getInt16", t), _t = (s, t) => y(s, Int32Array, "getInt32", t), Bt = (s, t) => y(s, Uint32Array, "getUint32", t), U = (s, t) => y(s, Float32Array, "getFloat32", t), Nt = (s, t) => y(s, Float64Array, "getFloat64", t);
91
- class dt extends b {
92
- load(t, e, n, i) {
93
- const r = new ct(this.manager);
94
- r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
91
+ function g(n, t, e, s = !0) {
92
+ if (s === xt())
93
+ return new t(n);
94
+ const r = new DataView(n), i = new t(r.byteLength / t.BYTES_PER_ELEMENT);
95
+ for (let o = 0, a = 0; o < i.length; ++o, a += t.BYTES_PER_ELEMENT)
96
+ i[o] = r[e](a, s);
97
+ return i;
98
+ }
99
+ const Tt = (n) => new Uint8Array(n), Ct = (n) => new Int8Array(n), X = (n, t) => g(n, Uint16Array, "getUint16", t), k = (n, t) => g(n, Int16Array, "getInt16", t), Gt = (n, t) => g(n, Int32Array, "getInt32", t), qt = (n, t) => g(n, Uint32Array, "getUint32", t), F = (n, t) => g(n, Float32Array, "getFloat32", t), Ht = (n, t) => g(n, Float64Array, "getFloat64", t);
100
+ class At extends P {
101
+ load(t, e, s, r) {
102
+ const i = new ft(this.manager);
103
+ i.setRequestHeader(this.requestHeader), i.setPath(this.path), i.setWithCredentials(this.withCredentials), i.load(
95
104
  t,
96
105
  (o) => {
97
106
  try {
98
107
  e(this.parseTypedArray(o));
99
108
  } catch (a) {
100
- i != null ? i(a) : console.error(a), this.manager.itemError(t);
109
+ r != null ? r(a) : console.error(a), this.manager.itemError(t);
101
110
  }
102
111
  },
103
- n,
104
- i
112
+ s,
113
+ r
105
114
  );
106
115
  }
107
116
  }
108
- function A(s) {
109
- return class extends dt {
117
+ function A(n) {
118
+ return class extends At {
110
119
  constructor() {
111
120
  super(...arguments);
112
- l(this, "parseTypedArray", s);
121
+ d(this, "parseTypedArray", n);
113
122
  }
114
123
  };
115
124
  }
116
- function Ot(s) {
117
- return new (A(s))();
125
+ function Wt(n) {
126
+ return new (A(n))();
118
127
  }
119
- const Ct = /* @__PURE__ */ A(q), Rt = /* @__PURE__ */ A(G), Gt = /* @__PURE__ */ A(U), ut = {
120
- format: it,
121
- wrapS: v,
122
- wrapT: v,
123
- minFilter: _,
124
- magFilter: _
128
+ const Xt = /* @__PURE__ */ A(k), kt = /* @__PURE__ */ A(X), jt = /* @__PURE__ */ A(F), Lt = {
129
+ format: ot,
130
+ wrapS: O,
131
+ wrapT: O,
132
+ minFilter: N,
133
+ magFilter: N
125
134
  };
126
- class pt extends b {
135
+ class St extends P {
127
136
  constructor() {
128
137
  super(...arguments);
129
- l(this, "parameters", {});
138
+ d(this, "parameters", {});
130
139
  }
131
- load(e, n, i, r) {
140
+ load(e, s, r, i) {
132
141
  const o = new this.Texture(), a = new this.TypedArrayLoader(this.manager);
133
142
  a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(this.withCredentials), a.load(
134
143
  e,
135
144
  (h) => {
136
145
  o.image.data = h;
137
- const { width: c, height: f, depth: g, ...I } = this.parameters;
138
- c != null && (o.image.width = c), f != null && (o.image.height = f), "depth" in o.image && g != null && (o.image.depth = g);
139
- const P = lt(h);
140
- o.type = P === "uint8" ? Z : P === "int8" ? tt : et, Object.assign(o, I), o.needsUpdate = !0, n(o);
146
+ const { width: c, height: f, depth: y, ...I } = this.parameters;
147
+ c != null && (o.image.width = c), f != null && (o.image.height = f), "depth" in o.image && y != null && (o.image.depth = y);
148
+ const _ = mt(h);
149
+ o.type = _ === "uint8" ? st : _ === "int8" ? rt : it, Object.assign(o, I), o.needsUpdate = !0, s(o);
141
150
  },
142
- i,
143
- r
151
+ r,
152
+ i
144
153
  );
145
154
  }
146
155
  }
147
- function H(s, t, e) {
148
- return class extends pt {
156
+ function j(n, t, e) {
157
+ return class extends St {
149
158
  constructor() {
150
159
  super(...arguments);
151
- l(this, "Texture", s);
152
- l(this, "TypedArrayLoader", A(t));
153
- l(this, "parameters", {
154
- ...ut,
160
+ d(this, "Texture", n);
161
+ d(this, "TypedArrayLoader", A(t));
162
+ d(this, "parameters", {
163
+ ...Lt,
155
164
  ...e
156
165
  });
157
166
  }
158
167
  };
159
168
  }
160
- function X(s, t) {
161
- return H(st, s, t);
169
+ function v(n, t) {
170
+ return j(at, n, t);
162
171
  }
163
- function E(s, t) {
164
- return H(nt, s, t);
172
+ function E(n, t) {
173
+ return j(ht, n, t);
165
174
  }
166
- function qt(s, t) {
167
- return new (X(s, t))();
175
+ function Vt(n, t) {
176
+ return new (v(n, t))();
168
177
  }
169
- function Ht(s, t) {
170
- return new (E(s, t))();
178
+ function Qt(n, t) {
179
+ return new (E(n, t))();
171
180
  }
172
- const Xt = /* @__PURE__ */ E(q), Wt = /* @__PURE__ */ E(G), Vt = /* @__PURE__ */ E(U), jt = /* @__PURE__ */ X(U), yt = d.clamp, kt = d.euclideanModulo, Qt = d.inverseLerp, Yt = d.lerp, $t = d.degToRad, Jt = d.radToDeg, Kt = d.isPowerOfTwo, Zt = d.ceilPowerOfTwo, te = d.floorPowerOfTwo, ee = d.normalize, se = d.mapLinear;
173
- function ne(s, t, e) {
174
- return e <= s ? 0 : e >= t ? 1 : (e = (e - s) / (t - s), e * e * (3 - 2 * e));
181
+ const Yt = /* @__PURE__ */ E(k), $t = /* @__PURE__ */ E(X), Jt = /* @__PURE__ */ E(F), Zt = /* @__PURE__ */ v(F);
182
+ function Kt(n, ...t) {
183
+ const e = {};
184
+ for (let s = 0; s < t.length; s += 2) {
185
+ const r = t[s], i = t[s + 1];
186
+ for (const o of i)
187
+ e[o] = {
188
+ enumerable: !0,
189
+ get: () => r[o],
190
+ set: (a) => {
191
+ r[o] = a;
192
+ }
193
+ };
194
+ }
195
+ return Object.defineProperties(n, e), n;
196
+ }
197
+ function te(n, t, e) {
198
+ const s = {};
199
+ for (const r of e)
200
+ s[r] = {
201
+ enumerable: !0,
202
+ get: () => t.uniforms[r].value,
203
+ set: (i) => {
204
+ t.uniforms[r].value = i;
205
+ }
206
+ };
207
+ return Object.defineProperties(n, s), n;
208
+ }
209
+ const V = l.clamp, ee = l.euclideanModulo, ne = l.inverseLerp, se = l.lerp, re = l.degToRad, ie = l.radToDeg, oe = l.isPowerOfTwo, ae = l.ceilPowerOfTwo, he = l.floorPowerOfTwo, ce = l.normalize;
210
+ function le(n, t, e, s = 0, r = 1) {
211
+ return l.mapLinear(n, t, e, s, r);
212
+ }
213
+ function de(n, t, e, s = 0, r = 1) {
214
+ return V(l.mapLinear(n, t, e, s, r), s, r);
175
215
  }
176
- function ie(s) {
177
- return Math.min(Math.max(s, 0), 1);
216
+ function ue(n, t, e) {
217
+ return e <= n ? 0 : e >= t ? 1 : (e = (e - n) / (t - n), e * e * (3 - 2 * e));
178
218
  }
179
- function re(s, t, e, n = e) {
180
- const i = Math.abs(s - t);
181
- return i <= n || i <= e * Math.max(Math.abs(s), Math.abs(t));
219
+ function pe(n) {
220
+ return Math.min(Math.max(n, 0), 1);
182
221
  }
183
- const D = 1e-6, L = /* @__PURE__ */ new p(), S = /* @__PURE__ */ new p(), u = /* @__PURE__ */ new p(), m = /* @__PURE__ */ new p(), z = /* @__PURE__ */ new p(), ft = /* @__PURE__ */ new p(), gt = /* @__PURE__ */ new rt(), wt = /* @__PURE__ */ new ot(), mt = /* @__PURE__ */ new at();
184
- class W {
185
- constructor(t = 0, e = 0, n = 0, i = 0) {
222
+ function fe(n, t, e, s = e) {
223
+ const r = Math.abs(n - t);
224
+ return r <= s || r <= e * Math.max(Math.abs(n), Math.abs(t));
225
+ }
226
+ const U = 1e-6, S = /* @__PURE__ */ new p(), b = /* @__PURE__ */ new p(), u = /* @__PURE__ */ new p(), m = /* @__PURE__ */ new p(), z = /* @__PURE__ */ new p(), bt = /* @__PURE__ */ new p(), Mt = /* @__PURE__ */ new lt(), Et = /* @__PURE__ */ new ct(), It = /* @__PURE__ */ new dt();
227
+ class Q {
228
+ constructor(t = 0, e = 0, s = 0, r = 0) {
186
229
  // Distance from the target.
187
- l(this, "_distance");
230
+ d(this, "_distance");
188
231
  // Radians from the local east direction relative from true north, measured
189
232
  // clockwise (90 degrees is true north, and -90 is true south).
190
- l(this, "heading");
233
+ d(this, "heading");
191
234
  // Radians from the local horizon plane, measured with positive values looking
192
235
  // up (90 degrees is straight up, -90 is straight down).
193
- l(this, "_pitch");
194
- l(this, "roll");
195
- this.distance = t, this.heading = e, this.pitch = n, this.roll = i;
236
+ d(this, "_pitch");
237
+ d(this, "roll");
238
+ this.distance = t, this.heading = e, this.pitch = s, this.roll = r;
196
239
  }
197
240
  get distance() {
198
241
  return this._distance;
199
242
  }
200
243
  set distance(t) {
201
- this._distance = Math.max(t, D);
244
+ this._distance = Math.max(t, U);
202
245
  }
203
246
  get pitch() {
204
247
  return this._pitch;
205
248
  }
206
249
  set pitch(t) {
207
- this._pitch = yt(t, -Math.PI / 2 + D, Math.PI / 2 - D);
250
+ this._pitch = V(t, -Math.PI / 2 + U, Math.PI / 2 - U);
208
251
  }
209
- set(t, e, n, i) {
210
- return this.distance = t, this.heading = e, this.pitch = n, i != null && (this.roll = i), this;
252
+ set(t, e, s, r) {
253
+ return this.distance = t, this.heading = e, this.pitch = s, r != null && (this.roll = r), this;
211
254
  }
212
255
  clone() {
213
- return new W(this.distance, this.heading, this.pitch, this.roll);
256
+ return new Q(this.distance, this.heading, this.pitch, this.roll);
214
257
  }
215
258
  copy(t) {
216
259
  return this.distance = t.distance, this.heading = t.heading, this.pitch = t.pitch, this.roll = t.roll, this;
@@ -218,46 +261,46 @@ class W {
218
261
  equals(t) {
219
262
  return t.distance === this.distance && t.heading === this.heading && t.pitch === this.pitch && t.roll === this.roll;
220
263
  }
221
- decompose(t, e, n, i, r = B.WGS84) {
222
- r.getEastNorthUpVectors(
264
+ decompose(t, e, s, r, i = C.WGS84) {
265
+ i.getEastNorthUpVectors(
223
266
  t,
224
- L,
225
267
  S,
268
+ b,
226
269
  u
227
- ), i == null || i.copy(u);
228
- const o = m.copy(L).multiplyScalar(Math.cos(this.heading)).add(
229
- z.copy(S).multiplyScalar(Math.sin(this.heading))
270
+ ), r == null || r.copy(u);
271
+ const o = m.copy(S).multiplyScalar(Math.cos(this.heading)).add(
272
+ z.copy(b).multiplyScalar(Math.sin(this.heading))
230
273
  ).multiplyScalar(Math.cos(this.pitch)).add(z.copy(u).multiplyScalar(Math.sin(this.pitch))).normalize().multiplyScalar(this.distance);
231
274
  if (e.copy(t).sub(o), this.roll !== 0) {
232
275
  const a = m.copy(t).sub(e).normalize();
233
276
  u.applyQuaternion(
234
- wt.setFromAxisAngle(a, this.roll)
277
+ Et.setFromAxisAngle(a, this.roll)
235
278
  );
236
279
  }
237
- n.setFromRotationMatrix(
238
- gt.lookAt(e, t, u)
280
+ s.setFromRotationMatrix(
281
+ Mt.lookAt(e, t, u)
239
282
  );
240
283
  }
241
- setFromCamera(t, e = B.WGS84) {
242
- const n = m.setFromMatrixPosition(t.matrixWorld), i = z.set(0, 0, 0.5).unproject(t).sub(n).normalize(), r = e.getIntersection(mt.set(n, i));
243
- if (r == null)
284
+ setFromCamera(t, e = C.WGS84) {
285
+ const s = m.setFromMatrixPosition(t.matrixWorld), r = z.set(0, 0, 0.5).unproject(t).sub(s).normalize(), i = e.getIntersection(It.set(s, r));
286
+ if (i == null)
244
287
  return;
245
- this.distance = n.distanceTo(r), e.getEastNorthUpVectors(
246
- r,
247
- L,
288
+ this.distance = s.distanceTo(i), e.getEastNorthUpVectors(
289
+ i,
248
290
  S,
291
+ b,
249
292
  u
250
293
  ), this.heading = Math.atan2(
251
- S.dot(i),
252
- L.dot(i)
253
- ), this.pitch = Math.asin(u.dot(i));
254
- const o = m.copy(t.up).applyQuaternion(t.quaternion), a = ft.copy(i).multiplyScalar(-o.dot(i)).add(o).normalize(), h = m.copy(i).multiplyScalar(-u.dot(i)).add(u).normalize(), c = h.dot(a), f = i.dot(h.cross(a));
294
+ b.dot(r),
295
+ S.dot(r)
296
+ ), this.pitch = Math.asin(u.dot(r));
297
+ const o = m.copy(t.up).applyQuaternion(t.quaternion), a = bt.copy(r).multiplyScalar(-o.dot(r)).add(o).normalize(), h = m.copy(r).multiplyScalar(-u.dot(r)).add(u).normalize(), c = h.dot(a), f = r.dot(h.cross(a));
255
298
  return this.roll = Math.atan2(f, c), this;
256
299
  }
257
300
  }
258
301
  const x = class x {
259
- constructor(t = 0, e = 0, n = 0, i = 0) {
260
- this.west = t, this.south = e, this.east = n, this.north = i;
302
+ constructor(t = 0, e = 0, s = 0, r = 0) {
303
+ this.west = t, this.south = e, this.east = s, this.north = r;
261
304
  }
262
305
  get width() {
263
306
  let t = this.east;
@@ -266,8 +309,8 @@ const x = class x {
266
309
  get height() {
267
310
  return this.north - this.south;
268
311
  }
269
- set(t, e, n, i) {
270
- return this.west = t, this.south = e, this.east = n, this.north = i, this;
312
+ set(t, e, s, r) {
313
+ return this.west = t, this.south = e, this.east = s, this.north = r, this;
271
314
  }
272
315
  clone() {
273
316
  return new x(this.west, this.south, this.east, this.north);
@@ -278,8 +321,8 @@ const x = class x {
278
321
  equals(t) {
279
322
  return t.west === this.west && t.south === this.south && t.east === this.east && t.north === this.north;
280
323
  }
281
- at(t, e, n = new w()) {
282
- return n.set(
324
+ at(t, e, s = new w()) {
325
+ return s.set(
283
326
  this.west + (this.east - this.west) * t,
284
327
  this.north + (this.south - this.north) * e
285
328
  );
@@ -294,48 +337,59 @@ const x = class x {
294
337
  yield this.west, yield this.south, yield this.east, yield this.north;
295
338
  }
296
339
  };
297
- l(x, "MAX", /* @__PURE__ */ new x(
340
+ d(x, "MAX", /* @__PURE__ */ new x(
298
341
  w.MIN_LONGITUDE,
299
342
  w.MIN_LATITUDE,
300
343
  w.MAX_LONGITUDE,
301
344
  w.MAX_LATITUDE
302
345
  ));
303
346
  let M = x;
304
- const xt = /^[ \t]*#include +"([\w\d./]+)"/gm;
305
- function Tt(s, t) {
306
- return s.replace(xt, (e, n) => {
307
- const r = n.split("/").reduce(
347
+ const Dt = /^[ \t]*#include +"([\w\d./]+)"/gm;
348
+ function Ut(n, t) {
349
+ return n.replace(Dt, (e, s) => {
350
+ const i = s.split("/").reduce(
308
351
  (o, a) => typeof o != "string" && o != null ? o[a] : void 0,
309
352
  t
310
353
  );
311
- if (typeof r != "string")
312
- throw new Error(`Could not find include for ${n}.`);
313
- return Tt(r, t);
354
+ if (typeof i != "string")
355
+ throw new Error(`Could not find include for ${s}.`);
356
+ return Ut(i, t);
314
357
  });
315
358
  }
316
- function* V(s, t, e, n, i) {
317
- if (e >= n)
359
+ const ye = v(Tt, {
360
+ format: ut,
361
+ minFilter: R,
362
+ magFilter: R,
363
+ wrapS: D,
364
+ wrapT: D,
365
+ wrapR: D,
366
+ width: yt,
367
+ height: gt,
368
+ depth: wt
369
+ });
370
+ function* Y(n, t, e, s, r) {
371
+ if (e >= s)
318
372
  return;
319
- const r = 2 ** e, o = e + 1, a = 2 ** o, h = Math.floor(s / r * a), c = Math.floor(t / r * a), f = [
373
+ const i = 2 ** e, o = e + 1, a = 2 ** o, h = Math.floor(n / i * a), c = Math.floor(t / i * a), f = [
320
374
  [h, c, o],
321
375
  [h + 1, c, o],
322
376
  [h, c + 1, o],
323
377
  [h + 1, c + 1, o]
324
378
  ];
325
- if (o < n)
326
- for (const g of f)
327
- for (const I of V(...g, n, i))
379
+ if (o < s)
380
+ for (const y of f)
381
+ for (const I of Y(...y, s, r))
328
382
  yield I;
329
383
  else
330
- for (const g of f)
331
- yield (i ?? new T()).set(...g);
384
+ for (const y of f)
385
+ yield (r ?? new T()).set(...y);
332
386
  }
333
387
  class T {
334
- constructor(t = 0, e = 0, n = 0) {
335
- this.x = t, this.y = e, this.z = n;
388
+ constructor(t = 0, e = 0, s = 0) {
389
+ this.x = t, this.y = e, this.z = s;
336
390
  }
337
- set(t, e, n) {
338
- return this.x = t, this.y = e, n != null && (this.z = n), this;
391
+ set(t, e, s) {
392
+ return this.x = t, this.y = e, s != null && (this.z = s), this;
339
393
  }
340
394
  clone() {
341
395
  return new T(this.x, this.y, this.z);
@@ -347,12 +401,12 @@ class T {
347
401
  return t.x === this.x && t.y === this.y && t.z === this.z;
348
402
  }
349
403
  getParent(t = new T()) {
350
- const e = 2 ** this.z, n = this.x / e, i = this.y / e, r = this.z - 1, o = 2 ** r;
351
- return t.set(Math.floor(n * o), Math.floor(i * o), r);
404
+ const e = 2 ** this.z, s = this.x / e, r = this.y / e, i = this.z - 1, o = 2 ** i;
405
+ return t.set(Math.floor(s * o), Math.floor(r * o), i);
352
406
  }
353
407
  *traverseChildren(t, e) {
354
- const { x: n, y: i, z: r } = this;
355
- for (const o of V(n, i, r, r + t, e))
408
+ const { x: s, y: r, z: i } = this;
409
+ for (const o of Y(s, r, i, i + t, e))
356
410
  yield o;
357
411
  }
358
412
  fromArray(t, e = 0) {
@@ -365,100 +419,105 @@ class T {
365
419
  yield this.x, yield this.y, yield this.z;
366
420
  }
367
421
  }
368
- const O = /* @__PURE__ */ new C();
369
- class j {
370
- constructor(t = 2, e = 1, n = M.MAX) {
371
- this.width = t, this.height = e, this.rectangle = n;
422
+ const q = /* @__PURE__ */ new H();
423
+ class $ {
424
+ constructor(t = 2, e = 1, s = M.MAX) {
425
+ this.width = t, this.height = e, this.rectangle = s;
372
426
  }
373
427
  clone() {
374
- return new j(this.width, this.height, this.rectangle.clone());
428
+ return new $(this.width, this.height, this.rectangle.clone());
375
429
  }
376
430
  copy(t) {
377
431
  return this.width = t.width, this.height = t.height, this.rectangle.copy(t.rectangle), this;
378
432
  }
379
- getSize(t, e = new C()) {
433
+ getSize(t, e = new H()) {
380
434
  return e.set(this.width << t, this.height << t);
381
435
  }
382
436
  // Reference: https://github.com/CesiumGS/cesium/blob/1.122/packages/engine/Source/Core/GeographicTilingScheme.js#L210
383
- getTile(t, e, n = new T()) {
384
- const i = this.getSize(e, O), r = this.rectangle.width / i.x, o = this.rectangle.height / i.y;
437
+ getTile(t, e, s = new T()) {
438
+ const r = this.getSize(e, q), i = this.rectangle.width / r.x, o = this.rectangle.height / r.y;
385
439
  let a = t.longitude;
386
440
  this.rectangle.east < this.rectangle.west && (a += Math.PI * 2);
387
- let h = Math.floor((a - this.rectangle.west) / r);
388
- h >= i.x && (h = i.x - 1);
441
+ let h = Math.floor((a - this.rectangle.west) / i);
442
+ h >= r.x && (h = r.x - 1);
389
443
  let c = Math.floor((t.latitude - this.rectangle.south) / o);
390
- return c >= i.y && (c = i.y - 1), n.x = h, n.y = c, n.z = e, n;
444
+ return c >= r.y && (c = r.y - 1), s.x = h, s.y = c, s.z = e, s;
391
445
  }
392
446
  // Reference: https://github.com/CesiumGS/cesium/blob/1.122/packages/engine/Source/Core/GeographicTilingScheme.js#L169
393
447
  getRectangle(t, e = new M()) {
394
- const n = this.getSize(t.z, O), i = this.rectangle.width / n.x, r = this.rectangle.height / n.y;
395
- return e.west = t.x * i + this.rectangle.west, e.east = (t.x + 1) * i + this.rectangle.west, e.north = this.rectangle.north - (n.y - t.y - 1) * r, e.south = this.rectangle.north - (n.y - t.y) * r, e;
448
+ const s = this.getSize(t.z, q), r = this.rectangle.width / s.x, i = this.rectangle.height / s.y;
449
+ return e.west = t.x * r + this.rectangle.west, e.east = (t.x + 1) * r + this.rectangle.west, e.north = this.rectangle.north - (s.y - t.y - 1) * i, e.south = this.rectangle.north - (s.y - t.y) * i, e;
396
450
  }
397
451
  }
398
- const At = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*(?:i\s*\+\+|\+\+\s*i)\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
399
- function Lt(s, t, e, n) {
400
- let i = "";
401
- for (let r = parseInt(t); r < parseInt(e); ++r)
402
- i += n.replace(/\[\s*i\s*\]/g, "[" + r + "]").replace(/UNROLLED_LOOP_INDEX/g, `${r}`);
403
- return i;
452
+ const zt = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*(?:i\s*\+\+|\+\+\s*i)\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
453
+ function Pt(n, t, e, s) {
454
+ let r = "";
455
+ for (let i = parseInt(t); i < parseInt(e); ++i)
456
+ r += s.replace(/\[\s*i\s*\]/g, "[" + i + "]").replace(/UNROLLED_LOOP_INDEX/g, `${i}`);
457
+ return r;
404
458
  }
405
- function oe(s) {
406
- return s.replace(At, Lt);
459
+ function ge(n) {
460
+ return n.replace(zt, Pt);
407
461
  }
408
462
  export {
409
- ct as ArrayBufferLoader,
410
- pt as DataLoader,
411
- B as Ellipsoid,
412
- ce as EllipsoidGeometry,
413
- Gt as Float32ArrayLoader,
414
- Vt as Float32Data2DLoader,
415
- jt as Float32Data3DLoader,
463
+ ft as ArrayBufferLoader,
464
+ Rt as DEFAULT_STBN_URL,
465
+ St as DataLoader,
466
+ C as Ellipsoid,
467
+ xe as EllipsoidGeometry,
468
+ jt as Float32ArrayLoader,
469
+ Jt as Float32Data2DLoader,
470
+ Zt as Float32Data3DLoader,
416
471
  w as Geodetic,
417
- Ct as Int16ArrayLoader,
418
- Xt as Int16Data2DLoader,
419
- W as PointOfView,
472
+ Xt as Int16ArrayLoader,
473
+ Yt as Int16Data2DLoader,
474
+ Q as PointOfView,
420
475
  M as Rectangle,
421
- Pt as STBN_TEXTURE_DEPTH,
422
- Ut as STBN_TEXTURE_HEIGHT,
423
- bt as STBN_TEXTURE_WIDTH,
476
+ ye as STBNLoader,
477
+ wt as STBN_TEXTURE_DEPTH,
478
+ gt as STBN_TEXTURE_HEIGHT,
479
+ yt as STBN_TEXTURE_WIDTH,
424
480
  T as TileCoordinate,
425
- j as TilingScheme,
426
- dt as TypedArrayLoader,
427
- Rt as Uint16ArrayLoader,
428
- Wt as Uint16Data2DLoader,
429
- It as assertType,
430
- Zt as ceilPowerOfTwo,
431
- yt as clamp,
432
- re as closeTo,
433
- qt as createData3DTextureLoader,
434
- X as createData3DTextureLoaderClass,
435
- Ht as createDataTextureLoader,
481
+ $ as TilingScheme,
482
+ At as TypedArrayLoader,
483
+ kt as Uint16ArrayLoader,
484
+ $t as Uint16Data2DLoader,
485
+ Bt as assertType,
486
+ ae as ceilPowerOfTwo,
487
+ V as clamp,
488
+ fe as closeTo,
489
+ Vt as createData3DTextureLoader,
490
+ v as createData3DTextureLoaderClass,
491
+ Qt as createDataTextureLoader,
436
492
  E as createDataTextureLoaderClass,
437
- Ot as createTypedArrayLoader,
493
+ Wt as createTypedArrayLoader,
438
494
  A as createTypedArrayLoaderClass,
439
- Jt as degrees,
440
- kt as euclideanModulo,
441
- te as floorPowerOfTwo,
442
- zt as fromBufferGeometryLike,
443
- lt as getTypedArrayElementType,
444
- Qt as inverseLerp,
445
- Kt as isPowerOfTwo,
446
- Yt as lerp,
447
- ee as normalize,
448
- U as parseFloat32Array,
449
- Nt as parseFloat64Array,
450
- q as parseInt16Array,
451
- _t as parseInt32Array,
452
- vt as parseInt8Array,
453
- G as parseUint16Array,
454
- Bt as parseUint32Array,
455
- Ft as parseUint8Array,
456
- $t as radians,
457
- se as remap,
458
- Tt as resolveIncludes,
459
- ie as saturate,
460
- ne as smoothstep,
461
- Dt as toBufferGeometryLike,
462
- oe as unrollLoops
495
+ Kt as definePropertyShorthand,
496
+ te as defineUniformShorthand,
497
+ ie as degrees,
498
+ ee as euclideanModulo,
499
+ he as floorPowerOfTwo,
500
+ Ot as fromBufferGeometryLike,
501
+ mt as getTypedArrayElementType,
502
+ ne as inverseLerp,
503
+ oe as isPowerOfTwo,
504
+ se as lerp,
505
+ ce as normalize,
506
+ F as parseFloat32Array,
507
+ Ht as parseFloat64Array,
508
+ k as parseInt16Array,
509
+ Gt as parseInt32Array,
510
+ Ct as parseInt8Array,
511
+ X as parseUint16Array,
512
+ qt as parseUint32Array,
513
+ Tt as parseUint8Array,
514
+ re as radians,
515
+ le as remap,
516
+ de as remapClamped,
517
+ Ut as resolveIncludes,
518
+ pe as saturate,
519
+ ue as smoothstep,
520
+ Nt as toBufferGeometryLike,
521
+ ge as unrollLoops
463
522
  };
464
523
  //# sourceMappingURL=index.js.map