@takram/three-geospatial 0.0.1-alpha.6 → 0.0.1-alpha.8

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