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

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.
Files changed (45) hide show
  1. package/build/index.cjs +1 -43
  2. package/build/index.cjs.map +1 -1
  3. package/build/index.js +315 -772
  4. package/build/index.js.map +1 -1
  5. package/build/shaders.cjs +276 -0
  6. package/build/shaders.cjs.map +1 -0
  7. package/build/shaders.js +286 -0
  8. package/build/shaders.js.map +1 -0
  9. package/package.json +7 -3
  10. package/src/DataLoader.ts +107 -49
  11. package/src/Texture3DLoader.ts +81 -0
  12. package/src/TypedArrayLoader.ts +25 -9
  13. package/src/bufferGeometry.ts +2 -2
  14. package/src/constants.ts +3 -0
  15. package/src/index.ts +4 -10
  16. package/src/math.ts +1 -0
  17. package/src/r3f/index.ts +1 -0
  18. package/src/r3f/types.ts +64 -0
  19. package/src/resolveIncludes.test.ts +21 -0
  20. package/src/resolveIncludes.ts +22 -0
  21. package/src/shaders/depth.glsl +3 -1
  22. package/src/shaders/generators.glsl +9 -0
  23. package/src/shaders/index.ts +17 -0
  24. package/src/shaders/math.glsl +52 -0
  25. package/src/shaders/poissonDisk.glsl +21 -0
  26. package/src/shaders/raySphereIntersection.glsl +134 -0
  27. package/src/shaders/turbo.glsl +9 -0
  28. package/src/typedArray.ts +29 -52
  29. package/src/typedArrayParsers.ts +77 -0
  30. package/src/types.ts +5 -51
  31. package/src/unrollLoops.ts +23 -0
  32. package/types/DataLoader.d.ts +30 -60
  33. package/types/Texture3DLoader.d.ts +5 -0
  34. package/types/TypedArrayLoader.d.ts +10 -10
  35. package/types/constants.d.ts +3 -0
  36. package/types/index.d.ts +4 -3
  37. package/types/math.d.ts +1 -0
  38. package/types/r3f/index.d.ts +1 -0
  39. package/types/r3f/types.d.ts +22 -0
  40. package/types/resolveIncludes.d.ts +5 -0
  41. package/types/shaders/index.d.ts +8 -0
  42. package/types/typedArray.d.ts +2 -8
  43. package/types/typedArrayParsers.d.ts +11 -0
  44. package/types/types.d.ts +5 -20
  45. package/types/unrollLoops.d.ts +1 -0
package/build/index.js CHANGED
@@ -1,708 +1,216 @@
1
- var Tt = Object.defineProperty;
2
- var St = (e, t, n) => t in e ? Tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var c = (e, t, n) => St(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { Loader as R, FileLoader as Pt, BufferAttribute as J, Box3 as Ot, Vector3 as f, Sphere as Mt, BufferGeometry as At, DataTexture as H, FloatType as I, Data3DTexture as zt, RGBAFormat as Et, ClampToEdgeWrapping as k, LinearFilter as tt, MathUtils as u, Matrix4 as It, Quaternion as Ct, Ray as Lt, Vector2 as ut } from "three";
5
- import { E as et, G as m } from "./shared.js";
6
- import { a as wr } from "./shared.js";
7
- var Nt = `float reverseLogDepth(const float depth, const float near, const float far) {
8
- #ifdef USE_LOGDEPTHBUF
9
- float d = pow(2.0, depth * log2(far + 1.0)) - 1.0;
10
- float a = far / (far - near);
11
- float b = far * near / (near - far);
12
- return a + b / d;
13
- #else
14
- return depth;
15
- #endif
16
- }
17
-
18
- float linearizeDepth(const float depth, const float near, const float far) {
19
- float ndc = depth * 2.0 - 1.0;
20
- return 2.0 * near * far / (far + near - ndc * (far - near));
21
- }`, Dt = `vec2 signNotZero(vec2 v) {
22
- return vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);
23
- }
24
-
25
- vec2 packNormalToVec2(vec3 v) {
26
- vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));
27
- return v.z <= 0.0
28
- ? (1.0 - abs(p.yx)) * signNotZero(p)
29
- : p;
30
- }
31
-
32
- vec3 unpackVec2ToNormal(vec2 e) {
33
- vec3 v = vec3(e.xy, 1.0 - abs(e.x) - abs(e.y));
34
- if (v.z < 0.0) {
35
- v.xy = (1.0 - abs(v.yx)) * signNotZero(v.xy);
36
- }
37
- return normalize(v);
38
- }`, Ft = `vec3 screenToView(
39
- const vec2 uv,
40
- const float depth,
41
- const float viewZ,
42
- const mat4 projectionMatrix,
43
- const mat4 inverseProjectionMatrix
44
- ) {
45
- vec4 clip = vec4(vec3(uv, depth) * 2.0 - 1.0, 1.0);
46
- float clipW = projectionMatrix[2][3] * viewZ + projectionMatrix[3][3];
47
- clip *= clipW;
48
- return (inverseProjectionMatrix * clip).xyz;
49
- }`, $t = process.env.NODE_ENV === "production", nt = "Invariant failed";
50
- function jt(e, t) {
51
- if (!e) {
52
- if ($t)
53
- throw new Error(nt);
54
- var n = nt;
55
- throw new Error(n);
56
- }
57
- }
58
- class Gt extends R {
59
- load(t, n, r, i) {
60
- const a = new Pt(this.manager);
61
- a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(this.withCredentials), a.load(
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;
13
+ throw new Error(e);
14
+ }
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(
62
20
  t,
63
- (s) => {
64
- jt(s instanceof ArrayBuffer);
21
+ (o) => {
22
+ R(o instanceof ArrayBuffer);
65
23
  try {
66
- n(s);
67
- } catch (o) {
68
- i != null ? i(o) : console.error(o), this.manager.itemError(t);
24
+ e(o);
25
+ } catch (a) {
26
+ i != null ? i(a) : console.error(a), this.manager.itemError(t);
69
27
  }
70
28
  },
71
- r,
29
+ n,
72
30
  i
73
31
  );
74
32
  }
75
33
  }
76
- function Xn(e) {
77
- }
78
- var Ut = typeof global == "object" && global && global.Object === Object && global, Rt = typeof self == "object" && self && self.Object === Object && self, B = Ut || Rt || Function("return this")(), p = B.Symbol, dt = Object.prototype, Ht = dt.hasOwnProperty, Bt = dt.toString, x = p ? p.toStringTag : void 0;
79
- function qt(e) {
80
- var t = Ht.call(e, x), n = e[x];
81
- try {
82
- e[x] = void 0;
83
- var r = !0;
84
- } catch {
85
- }
86
- var i = Bt.call(e);
87
- return r && (t ? e[x] = n : delete e[x]), i;
88
- }
89
- var Vt = Object.prototype, Wt = Vt.toString;
90
- function Xt(e) {
91
- return Wt.call(e);
92
- }
93
- var Zt = "[object Null]", Yt = "[object Undefined]", rt = p ? p.toStringTag : void 0;
94
- function q(e) {
95
- return e == null ? e === void 0 ? Yt : Zt : rt && rt in Object(e) ? qt(e) : Xt(e);
96
- }
97
- function V(e) {
98
- return e != null && typeof e == "object";
99
- }
100
- var Kt = "[object Symbol]";
101
- function W(e) {
102
- return typeof e == "symbol" || V(e) && q(e) == Kt;
103
- }
104
- function Qt(e, t) {
105
- for (var n = -1, r = e == null ? 0 : e.length, i = Array(r); ++n < r; )
106
- i[n] = t(e[n], n, e);
107
- return i;
108
- }
109
- var P = Array.isArray, Jt = 1 / 0, it = p ? p.prototype : void 0, at = it ? it.toString : void 0;
110
- function ft(e) {
111
- if (typeof e == "string")
112
- return e;
113
- if (P(e))
114
- return Qt(e, ft) + "";
115
- if (W(e))
116
- return at ? at.call(e) : "";
117
- var t = e + "";
118
- return t == "0" && 1 / e == -Jt ? "-0" : t;
119
- }
120
- function A(e) {
121
- var t = typeof e;
122
- return e != null && (t == "object" || t == "function");
123
- }
124
- function kt(e) {
125
- return e;
126
- }
127
- var te = "[object AsyncFunction]", ee = "[object Function]", ne = "[object GeneratorFunction]", re = "[object Proxy]";
128
- function ie(e) {
129
- if (!A(e))
130
- return !1;
131
- var t = q(e);
132
- return t == ee || t == ne || t == te || t == re;
133
- }
134
- var j = B["__core-js_shared__"], st = function() {
135
- var e = /[^.]+$/.exec(j && j.keys && j.keys.IE_PROTO || "");
136
- return e ? "Symbol(src)_1." + e : "";
137
- }();
138
- function ae(e) {
139
- return !!st && st in e;
140
- }
141
- var se = Function.prototype, oe = se.toString;
142
- function ce(e) {
143
- if (e != null) {
144
- try {
145
- return oe.call(e);
146
- } catch {
147
- }
148
- try {
149
- return e + "";
150
- } catch {
151
- }
152
- }
153
- return "";
154
- }
155
- var he = /[\\^$.*+?()[\]{}|]/g, le = /^\[object .+?Constructor\]$/, ue = Function.prototype, de = Object.prototype, fe = ue.toString, pe = de.hasOwnProperty, ye = RegExp(
156
- "^" + fe.call(pe).replace(he, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
157
- );
158
- function ge(e) {
159
- if (!A(e) || ae(e))
160
- return !1;
161
- var t = ie(e) ? ye : le;
162
- return t.test(ce(e));
163
- }
164
- function we(e, t) {
165
- return e == null ? void 0 : e[t];
166
- }
167
- function X(e, t) {
168
- var n = we(e, t);
169
- return ge(n) ? n : void 0;
170
- }
171
- function ve(e, t, n) {
172
- switch (n.length) {
173
- case 0:
174
- return e.call(t);
175
- case 1:
176
- return e.call(t, n[0]);
177
- case 2:
178
- return e.call(t, n[0], n[1]);
179
- case 3:
180
- return e.call(t, n[0], n[1], n[2]);
181
- }
182
- return e.apply(t, n);
183
- }
184
- var me = 800, xe = 16, _e = Date.now;
185
- function be(e) {
186
- var t = 0, n = 0;
187
- return function() {
188
- var r = _e(), i = xe - (r - n);
189
- if (n = r, i > 0) {
190
- if (++t >= me)
191
- return arguments[0];
192
- } else
193
- t = 0;
194
- return e.apply(void 0, arguments);
195
- };
196
- }
197
- function Te(e) {
198
- return function() {
199
- return e;
200
- };
201
- }
202
- var z = function() {
203
- try {
204
- var e = X(Object, "defineProperty");
205
- return e({}, "", {}), e;
206
- } catch {
207
- }
208
- }(), Se = z ? function(e, t) {
209
- return z(e, "toString", {
210
- configurable: !0,
211
- enumerable: !1,
212
- value: Te(t),
213
- writable: !0
214
- });
215
- } : kt, Pe = be(Se), Oe = 9007199254740991, Me = /^(?:0|[1-9]\d*)$/;
216
- function pt(e, t) {
217
- var n = typeof e;
218
- return t = t ?? Oe, !!t && (n == "number" || n != "symbol" && Me.test(e)) && e > -1 && e % 1 == 0 && e < t;
219
- }
220
- function Ae(e, t, n) {
221
- t == "__proto__" && z ? z(e, t, {
222
- configurable: !0,
223
- enumerable: !0,
224
- value: n,
225
- writable: !0
226
- }) : e[t] = n;
227
- }
228
- function yt(e, t) {
229
- return e === t || e !== e && t !== t;
34
+ function It(s) {
230
35
  }
231
- var ze = Object.prototype, Ee = ze.hasOwnProperty;
232
- function Ie(e, t, n) {
233
- var r = e[t];
234
- (!(Ee.call(e, t) && yt(r, n)) || n === void 0 && !(t in e)) && Ae(e, t, n);
235
- }
236
- var ot = Math.max;
237
- function Ce(e, t, n) {
238
- return t = ot(t === void 0 ? e.length - 1 : t, 0), function() {
239
- for (var r = arguments, i = -1, a = ot(r.length - t, 0), s = Array(a); ++i < a; )
240
- s[i] = r[t + i];
241
- i = -1;
242
- for (var o = Array(t + 1); ++i < t; )
243
- o[i] = r[i];
244
- return o[t] = n(s), ve(e, this, o);
245
- };
246
- }
247
- var Le = 9007199254740991;
248
- function Ne(e) {
249
- return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Le;
250
- }
251
- var De = "[object Arguments]";
252
- function ct(e) {
253
- return V(e) && q(e) == De;
254
- }
255
- var gt = Object.prototype, Fe = gt.hasOwnProperty, $e = gt.propertyIsEnumerable, wt = ct(/* @__PURE__ */ function() {
256
- return arguments;
257
- }()) ? ct : function(e) {
258
- return V(e) && Fe.call(e, "callee") && !$e.call(e, "callee");
259
- }, je = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Ge = /^\w*$/;
260
- function Ue(e, t) {
261
- if (P(e))
262
- return !1;
263
- var n = typeof e;
264
- return n == "number" || n == "symbol" || n == "boolean" || e == null || W(e) ? !0 : Ge.test(e) || !je.test(e) || t != null && e in Object(t);
265
- }
266
- var T = X(Object, "create");
267
- function Re() {
268
- this.__data__ = T ? T(null) : {}, this.size = 0;
269
- }
270
- function He(e) {
271
- var t = this.has(e) && delete this.__data__[e];
272
- return this.size -= t ? 1 : 0, t;
273
- }
274
- var Be = "__lodash_hash_undefined__", qe = Object.prototype, Ve = qe.hasOwnProperty;
275
- function We(e) {
276
- var t = this.__data__;
277
- if (T) {
278
- var n = t[e];
279
- return n === Be ? void 0 : n;
280
- }
281
- return Ve.call(t, e) ? t[e] : void 0;
282
- }
283
- var Xe = Object.prototype, Ze = Xe.hasOwnProperty;
284
- function Ye(e) {
285
- var t = this.__data__;
286
- return T ? t[e] !== void 0 : Ze.call(t, e);
287
- }
288
- var Ke = "__lodash_hash_undefined__";
289
- function Qe(e, t) {
290
- var n = this.__data__;
291
- return this.size += this.has(e) ? 0 : 1, n[e] = T && t === void 0 ? Ke : t, this;
292
- }
293
- function g(e) {
294
- var t = -1, n = e == null ? 0 : e.length;
295
- for (this.clear(); ++t < n; ) {
296
- var r = e[t];
297
- this.set(r[0], r[1]);
298
- }
299
- }
300
- g.prototype.clear = Re;
301
- g.prototype.delete = He;
302
- g.prototype.get = We;
303
- g.prototype.has = Ye;
304
- g.prototype.set = Qe;
305
- function Je() {
306
- this.__data__ = [], this.size = 0;
307
- }
308
- function C(e, t) {
309
- for (var n = e.length; n--; )
310
- if (yt(e[n][0], t))
311
- return n;
312
- return -1;
313
- }
314
- var ke = Array.prototype, tn = ke.splice;
315
- function en(e) {
316
- var t = this.__data__, n = C(t, e);
317
- if (n < 0)
318
- return !1;
319
- var r = t.length - 1;
320
- return n == r ? t.pop() : tn.call(t, n, 1), --this.size, !0;
321
- }
322
- function nn(e) {
323
- var t = this.__data__, n = C(t, e);
324
- return n < 0 ? void 0 : t[n][1];
325
- }
326
- function rn(e) {
327
- return C(this.__data__, e) > -1;
328
- }
329
- function an(e, t) {
330
- var n = this.__data__, r = C(n, e);
331
- return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this;
332
- }
333
- function v(e) {
334
- var t = -1, n = e == null ? 0 : e.length;
335
- for (this.clear(); ++t < n; ) {
336
- var r = e[t];
337
- this.set(r[0], r[1]);
338
- }
339
- }
340
- v.prototype.clear = Je;
341
- v.prototype.delete = en;
342
- v.prototype.get = nn;
343
- v.prototype.has = rn;
344
- v.prototype.set = an;
345
- var sn = X(B, "Map");
346
- function on() {
347
- this.size = 0, this.__data__ = {
348
- hash: new g(),
349
- map: new (sn || v)(),
350
- string: new g()
351
- };
352
- }
353
- function cn(e) {
354
- var t = typeof e;
355
- return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
356
- }
357
- function L(e, t) {
358
- var n = e.__data__;
359
- return cn(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
360
- }
361
- function hn(e) {
362
- var t = L(this, e).delete(e);
363
- return this.size -= t ? 1 : 0, t;
364
- }
365
- function ln(e) {
366
- return L(this, e).get(e);
367
- }
368
- function un(e) {
369
- return L(this, e).has(e);
370
- }
371
- function dn(e, t) {
372
- var n = L(this, e), r = n.size;
373
- return n.set(e, t), this.size += n.size == r ? 0 : 1, this;
374
- }
375
- function w(e) {
376
- var t = -1, n = e == null ? 0 : e.length;
377
- for (this.clear(); ++t < n; ) {
378
- var r = e[t];
379
- this.set(r[0], r[1]);
380
- }
381
- }
382
- w.prototype.clear = on;
383
- w.prototype.delete = hn;
384
- w.prototype.get = ln;
385
- w.prototype.has = un;
386
- w.prototype.set = dn;
387
- var fn = "Expected a function";
388
- function Z(e, t) {
389
- if (typeof e != "function" || t != null && typeof t != "function")
390
- throw new TypeError(fn);
391
- var n = function() {
392
- var r = arguments, i = t ? t.apply(this, r) : r[0], a = n.cache;
393
- if (a.has(i))
394
- return a.get(i);
395
- var s = e.apply(this, r);
396
- return n.cache = a.set(i, s) || a, s;
397
- };
398
- return n.cache = new (Z.Cache || w)(), n;
399
- }
400
- Z.Cache = w;
401
- var pn = 500;
402
- function yn(e) {
403
- var t = Z(e, function(r) {
404
- return n.size === pn && n.clear(), r;
405
- }), n = t.cache;
406
- return t;
407
- }
408
- var gn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, wn = /\\(\\)?/g, vn = yn(function(e) {
409
- var t = [];
410
- return e.charCodeAt(0) === 46 && t.push(""), e.replace(gn, function(n, r, i, a) {
411
- t.push(i ? a.replace(wn, "$1") : r || n);
412
- }), t;
413
- });
414
- function mn(e) {
415
- return e == null ? "" : ft(e);
416
- }
417
- function N(e, t) {
418
- return P(e) ? e : Ue(e, t) ? [e] : vn(mn(e));
419
- }
420
- var xn = 1 / 0;
421
- function Y(e) {
422
- if (typeof e == "string" || W(e))
423
- return e;
424
- var t = e + "";
425
- return t == "0" && 1 / e == -xn ? "-0" : t;
426
- }
427
- function _n(e, t) {
428
- t = N(t, e);
429
- for (var n = 0, r = t.length; e != null && n < r; )
430
- e = e[Y(t[n++])];
431
- return n && n == r ? e : void 0;
432
- }
433
- function bn(e, t) {
434
- for (var n = -1, r = t.length, i = e.length; ++n < r; )
435
- e[i + n] = t[n];
436
- return e;
437
- }
438
- var ht = p ? p.isConcatSpreadable : void 0;
439
- function Tn(e) {
440
- return P(e) || wt(e) || !!(ht && e && e[ht]);
441
- }
442
- function Sn(e, t, n, r, i) {
443
- var a = -1, s = e.length;
444
- for (n || (n = Tn), i || (i = []); ++a < s; ) {
445
- var o = e[a];
446
- n(o) ? bn(i, o) : i[i.length] = o;
447
- }
448
- return i;
449
- }
450
- function Pn(e) {
451
- var t = e == null ? 0 : e.length;
452
- return t ? Sn(e) : [];
453
- }
454
- function On(e) {
455
- return Pe(Ce(e, void 0, Pn), e + "");
456
- }
457
- function Mn(e, t) {
458
- return e != null && t in Object(e);
459
- }
460
- function An(e, t, n) {
461
- t = N(t, e);
462
- for (var r = -1, i = t.length, a = !1; ++r < i; ) {
463
- var s = Y(t[r]);
464
- if (!(a = e != null && n(e, s)))
465
- break;
466
- e = e[s];
467
- }
468
- return a || ++r != i ? a : (i = e == null ? 0 : e.length, !!i && Ne(i) && pt(s, i) && (P(e) || wt(e)));
469
- }
470
- function zn(e, t) {
471
- return e != null && An(e, t, Mn);
472
- }
473
- function En(e, t, n, r) {
474
- if (!A(e))
475
- return e;
476
- t = N(t, e);
477
- for (var i = -1, a = t.length, s = a - 1, o = e; o != null && ++i < a; ) {
478
- var h = Y(t[i]), l = n;
479
- if (h === "__proto__" || h === "constructor" || h === "prototype")
480
- return e;
481
- if (i != s) {
482
- var y = o[h];
483
- l = void 0, l === void 0 && (l = A(y) ? y : pt(t[i + 1]) ? [] : {});
484
- }
485
- Ie(o, h, l), o = o[h];
486
- }
487
- return e;
488
- }
489
- function In(e, t, n) {
490
- for (var r = -1, i = t.length, a = {}; ++r < i; ) {
491
- var s = t[r], o = _n(e, s);
492
- n(o, s) && En(a, N(s, e), o);
493
- }
494
- return a;
495
- }
496
- function Cn(e, t) {
497
- return In(e, t, function(n, r) {
498
- return zn(e, r);
499
- });
500
- }
501
- var Ln = On(function(e, t) {
502
- return e == null ? {} : Cn(e, t);
503
- });
504
- function Zn(e) {
505
- var t;
36
+ function Dt(s) {
37
+ var r;
38
+ const { attributes: t, index: e, boundingBox: n, boundingSphere: i } = s;
506
39
  return [
507
- Ln(e, ["attributes", "index", "boundingBox", "boundingSphere"]),
40
+ { attributes: t, index: e, boundingBox: n, boundingSphere: i },
508
41
  [
509
- ...Object.values(e.attributes).map(
510
- (n) => n.array.buffer
42
+ ...Object.values(s.attributes).map(
43
+ (o) => o.array.buffer
511
44
  ),
512
- (t = e.index) == null ? void 0 : t.array.buffer
513
- ].filter((n) => n != null)
45
+ (r = s.index) == null ? void 0 : r.array.buffer
46
+ ].filter((o) => o != null)
514
47
  ];
515
48
  }
516
- function Yn(e, t = new At()) {
517
- for (const [n, r] of Object.entries(e.attributes))
49
+ function zt(s, t = new K()) {
50
+ for (const [e, n] of Object.entries(s.attributes))
518
51
  t.setAttribute(
519
- n,
520
- new J(
521
- r.array,
522
- r.itemSize,
523
- r.normalized
52
+ e,
53
+ new F(
54
+ n.array,
55
+ n.itemSize,
56
+ n.normalized
524
57
  )
525
58
  );
526
- if (t.index = e.index != null ? new J(
527
- e.index.array,
528
- e.index.itemSize,
529
- e.index.normalized
530
- ) : null, e.boundingBox != null) {
531
- const { min: n, max: r } = e.boundingBox;
532
- t.boundingBox = new Ot(
533
- new f(n.x, n.y, n.z),
534
- new f(r.x, r.y, r.z)
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 $(
66
+ new p(e.x, e.y, e.z),
67
+ new p(n.x, n.y, n.z)
535
68
  );
536
69
  }
537
- if (e.boundingSphere != null) {
538
- const { center: n, radius: r } = e.boundingSphere;
539
- t.boundingSphere = new Mt(
540
- new f(n.x, n.y, n.z),
541
- r
70
+ if (s.boundingSphere != null) {
71
+ const { center: e, radius: n } = s.boundingSphere;
72
+ t.boundingSphere = new J(
73
+ new p(e.x, e.y, e.z),
74
+ n
542
75
  );
543
76
  }
544
77
  return t;
545
78
  }
546
- function K(e, t, n, r = !0) {
547
- const i = new DataView(e), a = new t(i.byteLength / t.BYTES_PER_ELEMENT);
548
- for (let s = 0, o = 0; s < a.length; ++s, o += t.BYTES_PER_ELEMENT)
549
- a[s] = i[n](o, r);
550
- return a;
551
- }
552
- function Nn(e, t) {
553
- return K(e, Int16Array, "getInt16", t);
554
- }
555
- function Dn(e, t) {
556
- return K(e, Uint16Array, "getUint16", t);
557
- }
558
- function Fn(e, t) {
559
- return K(e, Float32Array, "getFloat32", t);
560
- }
561
- class Q extends R {
562
- load(t, n, r, i) {
563
- const a = new Gt(this.manager);
564
- a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(this.withCredentials), a.load(
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;
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;
89
+ }
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(
565
95
  t,
566
- (s) => {
96
+ (o) => {
567
97
  try {
568
- n(this.parseTypedArray(s));
569
- } catch (o) {
570
- i != null ? i(o) : console.error(o), this.manager.itemError(t);
98
+ e(this.parseTypedArray(o));
99
+ } catch (a) {
100
+ i != null ? i(a) : console.error(a), this.manager.itemError(t);
571
101
  }
572
102
  },
573
- r,
103
+ n,
574
104
  i
575
105
  );
576
106
  }
577
107
  }
578
- class $n extends Q {
579
- constructor() {
580
- super(...arguments);
581
- c(this, "parseTypedArray", Nn);
582
- }
583
- }
584
- class jn extends Q {
585
- constructor() {
586
- super(...arguments);
587
- c(this, "parseTypedArray", Dn);
588
- }
108
+ function A(s) {
109
+ return class extends dt {
110
+ constructor() {
111
+ super(...arguments);
112
+ l(this, "parseTypedArray", s);
113
+ }
114
+ };
589
115
  }
590
- class vt extends Q {
591
- constructor() {
592
- super(...arguments);
593
- c(this, "parseTypedArray", Fn);
594
- }
116
+ function Ot(s) {
117
+ return new (A(s))();
595
118
  }
596
- const D = {
597
- format: Et,
598
- wrapS: k,
599
- wrapT: k,
600
- minFilter: tt,
601
- magFilter: tt
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: _
602
125
  };
603
- class F extends R {
126
+ class pt extends b {
604
127
  constructor() {
605
128
  super(...arguments);
606
- c(this, "parameters");
129
+ l(this, "parameters", {});
607
130
  }
608
- load(n, r, i, a) {
609
- const s = new this.Texture(), o = new this.TypedArrayLoader(this.manager);
610
- o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(this.withCredentials), o.load(
611
- n,
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,
612
135
  (h) => {
613
- s.image.data = h, Object.assign(s, this.parameters), s.needsUpdate = !0, r(s);
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);
614
141
  },
615
142
  i,
616
- a
143
+ r
617
144
  );
618
145
  }
619
146
  }
620
- class Kn extends F {
621
- constructor() {
622
- super(...arguments);
623
- c(this, "Texture", H);
624
- c(this, "TypedArrayLoader", $n);
625
- c(this, "parameters", {
626
- ...D,
627
- type: I
628
- });
629
- }
147
+ function H(s, t, e) {
148
+ return class extends pt {
149
+ constructor() {
150
+ super(...arguments);
151
+ l(this, "Texture", s);
152
+ l(this, "TypedArrayLoader", A(t));
153
+ l(this, "parameters", {
154
+ ...ut,
155
+ ...e
156
+ });
157
+ }
158
+ };
630
159
  }
631
- class Qn extends F {
632
- constructor() {
633
- super(...arguments);
634
- c(this, "Texture", H);
635
- c(this, "TypedArrayLoader", jn);
636
- c(this, "parameters", {
637
- ...D,
638
- type: I
639
- });
640
- }
160
+ function X(s, t) {
161
+ return H(st, s, t);
641
162
  }
642
- class Jn extends F {
643
- constructor() {
644
- super(...arguments);
645
- c(this, "Texture", H);
646
- c(this, "TypedArrayLoader", vt);
647
- c(this, "parameters", {
648
- ...D,
649
- type: I
650
- });
651
- }
163
+ function E(s, t) {
164
+ return H(nt, s, t);
652
165
  }
653
- class kn extends F {
654
- constructor() {
655
- super(...arguments);
656
- c(this, "Texture", zt);
657
- c(this, "TypedArrayLoader", vt);
658
- c(this, "parameters", {
659
- ...D,
660
- type: I
661
- });
662
- }
166
+ function qt(s, t) {
167
+ return new (X(s, t))();
663
168
  }
664
- const Gn = u.clamp, tr = u.euclideanModulo, er = u.inverseLerp, nr = u.lerp, rr = u.degToRad, ir = u.radToDeg, ar = u.isPowerOfTwo, sr = u.ceilPowerOfTwo, or = u.floorPowerOfTwo, cr = u.normalize;
665
- function hr(e, t, n) {
666
- return n <= e ? 0 : n >= t ? 1 : (n = (n - e) / (t - e), n * n * (3 - 2 * n));
169
+ function Ht(s, t) {
170
+ return new (E(s, t))();
667
171
  }
668
- function lr(e) {
669
- return Math.min(Math.max(e, 0), 1);
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));
670
175
  }
671
- function ur(e, t, n, r = n) {
672
- const i = Math.abs(e - t);
673
- return i <= r || i <= n * Math.max(Math.abs(e), Math.abs(t));
176
+ function ie(s) {
177
+ return Math.min(Math.max(s, 0), 1);
674
178
  }
675
- const G = 1e-6, O = /* @__PURE__ */ new f(), M = /* @__PURE__ */ new f(), d = /* @__PURE__ */ new f(), _ = /* @__PURE__ */ new f(), U = /* @__PURE__ */ new f(), Un = /* @__PURE__ */ new f(), Rn = /* @__PURE__ */ new It(), Hn = /* @__PURE__ */ new Ct(), Bn = /* @__PURE__ */ new Lt();
676
- class mt {
677
- constructor(t = 0, n = 0, r = 0, i = 0) {
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));
182
+ }
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) {
678
186
  // Distance from the target.
679
- c(this, "_distance");
187
+ l(this, "_distance");
680
188
  // Radians from the local east direction relative from true north, measured
681
189
  // clockwise (90 degrees is true north, and -90 is true south).
682
- c(this, "heading");
190
+ l(this, "heading");
683
191
  // Radians from the local horizon plane, measured with positive values looking
684
192
  // up (90 degrees is straight up, -90 is straight down).
685
- c(this, "_pitch");
686
- c(this, "roll");
687
- this.distance = t, this.heading = n, this.pitch = r, this.roll = i;
193
+ l(this, "_pitch");
194
+ l(this, "roll");
195
+ this.distance = t, this.heading = e, this.pitch = n, this.roll = i;
688
196
  }
689
197
  get distance() {
690
198
  return this._distance;
691
199
  }
692
200
  set distance(t) {
693
- this._distance = Math.max(t, G);
201
+ this._distance = Math.max(t, D);
694
202
  }
695
203
  get pitch() {
696
204
  return this._pitch;
697
205
  }
698
206
  set pitch(t) {
699
- this._pitch = Gn(t, -Math.PI / 2 + G, Math.PI / 2 - G);
207
+ this._pitch = yt(t, -Math.PI / 2 + D, Math.PI / 2 - D);
700
208
  }
701
- set(t, n, r, i) {
702
- return this.distance = t, this.heading = n, this.pitch = r, i != null && (this.roll = i), this;
209
+ set(t, e, n, i) {
210
+ return this.distance = t, this.heading = e, this.pitch = n, i != null && (this.roll = i), this;
703
211
  }
704
212
  clone() {
705
- return new mt(this.distance, this.heading, this.pitch, this.roll);
213
+ return new W(this.distance, this.heading, this.pitch, this.roll);
706
214
  }
707
215
  copy(t) {
708
216
  return this.distance = t.distance, this.heading = t.heading, this.pitch = t.pitch, this.roll = t.roll, this;
@@ -710,46 +218,46 @@ class mt {
710
218
  equals(t) {
711
219
  return t.distance === this.distance && t.heading === this.heading && t.pitch === this.pitch && t.roll === this.roll;
712
220
  }
713
- decompose(t, n, r, i, a = et.WGS84) {
714
- a.getEastNorthUpVectors(
221
+ decompose(t, e, n, i, r = B.WGS84) {
222
+ r.getEastNorthUpVectors(
715
223
  t,
716
- O,
717
- M,
718
- d
719
- ), i == null || i.copy(d);
720
- const s = _.copy(O).multiplyScalar(Math.cos(this.heading)).add(
721
- U.copy(M).multiplyScalar(Math.sin(this.heading))
722
- ).multiplyScalar(Math.cos(this.pitch)).add(U.copy(d).multiplyScalar(Math.sin(this.pitch))).normalize().multiplyScalar(this.distance);
723
- if (n.copy(t).sub(s), this.roll !== 0) {
724
- const o = _.copy(t).sub(n).normalize();
725
- d.applyQuaternion(
726
- Hn.setFromAxisAngle(o, this.roll)
224
+ L,
225
+ 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);
231
+ if (e.copy(t).sub(o), this.roll !== 0) {
232
+ const a = m.copy(t).sub(e).normalize();
233
+ u.applyQuaternion(
234
+ wt.setFromAxisAngle(a, this.roll)
727
235
  );
728
236
  }
729
- r.setFromRotationMatrix(
730
- Rn.lookAt(n, t, d)
237
+ n.setFromRotationMatrix(
238
+ gt.lookAt(e, t, u)
731
239
  );
732
240
  }
733
- setFromCamera(t, n = et.WGS84) {
734
- const r = _.setFromMatrixPosition(t.matrixWorld), i = U.set(0, 0, 0.5).unproject(t).sub(r).normalize(), a = n.getIntersection(Bn.set(r, i));
735
- if (a == null)
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)
736
244
  return;
737
- this.distance = r.distanceTo(a), n.getEastNorthUpVectors(
738
- a,
739
- O,
740
- M,
741
- d
245
+ this.distance = n.distanceTo(r), e.getEastNorthUpVectors(
246
+ r,
247
+ L,
248
+ S,
249
+ u
742
250
  ), this.heading = Math.atan2(
743
- M.dot(i),
744
- O.dot(i)
745
- ), this.pitch = Math.asin(d.dot(i));
746
- const s = _.copy(t.up).applyQuaternion(t.quaternion), o = Un.copy(i).multiplyScalar(-s.dot(i)).add(s).normalize(), h = _.copy(i).multiplyScalar(-d.dot(i)).add(d).normalize(), l = h.dot(o), y = i.dot(h.cross(o));
747
- return this.roll = Math.atan2(y, l), this;
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));
255
+ return this.roll = Math.atan2(f, c), this;
748
256
  }
749
257
  }
750
- const b = class b {
751
- constructor(t = 0, n = 0, r = 0, i = 0) {
752
- this.west = t, this.south = n, this.east = r, this.north = i;
258
+ 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;
753
261
  }
754
262
  get width() {
755
263
  let t = this.east;
@@ -758,11 +266,11 @@ const b = class b {
758
266
  get height() {
759
267
  return this.north - this.south;
760
268
  }
761
- set(t, n, r, i) {
762
- return this.west = t, this.south = n, this.east = r, this.north = i, this;
269
+ set(t, e, n, i) {
270
+ return this.west = t, this.south = e, this.east = n, this.north = i, this;
763
271
  }
764
272
  clone() {
765
- return new b(this.west, this.south, this.east, this.north);
273
+ return new x(this.west, this.south, this.east, this.north);
766
274
  }
767
275
  copy(t) {
768
276
  return this.west = t.west, this.south = t.south, this.east = t.east, this.north = t.north, this;
@@ -770,55 +278,67 @@ const b = class b {
770
278
  equals(t) {
771
279
  return t.west === this.west && t.south === this.south && t.east === this.east && t.north === this.north;
772
280
  }
773
- at(t, n, r = new m()) {
774
- return r.set(
281
+ at(t, e, n = new w()) {
282
+ return n.set(
775
283
  this.west + (this.east - this.west) * t,
776
- this.north + (this.south - this.north) * n
284
+ this.north + (this.south - this.north) * e
777
285
  );
778
286
  }
779
- fromArray(t, n = 0) {
780
- return this.west = t[n], this.south = t[n + 1], this.east = t[n + 2], this.north = t[n + 3], this;
287
+ fromArray(t, e = 0) {
288
+ return this.west = t[e], this.south = t[e + 1], this.east = t[e + 2], this.north = t[e + 3], this;
781
289
  }
782
- toArray(t = [], n = 0) {
783
- return t[n] = this.west, t[n + 1] = this.south, t[n + 2] = this.east, t[n + 3] = this.north, t;
290
+ toArray(t = [], e = 0) {
291
+ return t[e] = this.west, t[e + 1] = this.south, t[e + 2] = this.east, t[e + 3] = this.north, t;
784
292
  }
785
293
  *[Symbol.iterator]() {
786
294
  yield this.west, yield this.south, yield this.east, yield this.north;
787
295
  }
788
296
  };
789
- c(b, "MAX", /* @__PURE__ */ new b(
790
- m.MIN_LONGITUDE,
791
- m.MIN_LATITUDE,
792
- m.MAX_LONGITUDE,
793
- m.MAX_LATITUDE
297
+ l(x, "MAX", /* @__PURE__ */ new x(
298
+ w.MIN_LONGITUDE,
299
+ w.MIN_LATITUDE,
300
+ w.MAX_LONGITUDE,
301
+ w.MAX_LATITUDE
794
302
  ));
795
- let E = b;
796
- function* xt(e, t, n, r, i) {
797
- if (n >= r)
303
+ 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(
308
+ (o, a) => typeof o != "string" && o != null ? o[a] : void 0,
309
+ t
310
+ );
311
+ if (typeof r != "string")
312
+ throw new Error(`Could not find include for ${n}.`);
313
+ return Tt(r, t);
314
+ });
315
+ }
316
+ function* V(s, t, e, n, i) {
317
+ if (e >= n)
798
318
  return;
799
- const a = 2 ** n, s = n + 1, o = 2 ** s, h = Math.floor(e / a * o), l = Math.floor(t / a * o), y = [
800
- [h, l, s],
801
- [h + 1, l, s],
802
- [h, l + 1, s],
803
- [h + 1, l + 1, s]
319
+ const r = 2 ** e, o = e + 1, a = 2 ** o, h = Math.floor(s / r * a), c = Math.floor(t / r * a), f = [
320
+ [h, c, o],
321
+ [h + 1, c, o],
322
+ [h, c + 1, o],
323
+ [h + 1, c + 1, o]
804
324
  ];
805
- if (s < r)
806
- for (const $ of y)
807
- for (const bt of xt(...$, r, i))
808
- yield bt;
325
+ if (o < n)
326
+ for (const g of f)
327
+ for (const I of V(...g, n, i))
328
+ yield I;
809
329
  else
810
- for (const $ of y)
811
- yield (i ?? new S()).set(...$);
330
+ for (const g of f)
331
+ yield (i ?? new T()).set(...g);
812
332
  }
813
- class S {
814
- constructor(t = 0, n = 0, r = 0) {
815
- this.x = t, this.y = n, this.z = r;
333
+ class T {
334
+ constructor(t = 0, e = 0, n = 0) {
335
+ this.x = t, this.y = e, this.z = n;
816
336
  }
817
- set(t, n, r) {
818
- return this.x = t, this.y = n, r != null && (this.z = r), this;
337
+ set(t, e, n) {
338
+ return this.x = t, this.y = e, n != null && (this.z = n), this;
819
339
  }
820
340
  clone() {
821
- return new S(this.x, this.y, this.z);
341
+ return new T(this.x, this.y, this.z);
822
342
  }
823
343
  copy(t) {
824
344
  return this.x = t.x, this.y = t.y, this.z = t.z, this;
@@ -826,96 +346,119 @@ class S {
826
346
  equals(t) {
827
347
  return t.x === this.x && t.y === this.y && t.z === this.z;
828
348
  }
829
- getParent(t = new S()) {
830
- const n = 2 ** this.z, r = this.x / n, i = this.y / n, a = this.z - 1, s = 2 ** a;
831
- return t.set(Math.floor(r * s), Math.floor(i * s), a);
349
+ 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);
832
352
  }
833
- *traverseChildren(t, n) {
834
- const { x: r, y: i, z: a } = this;
835
- for (const s of xt(r, i, a, a + t, n))
836
- yield s;
353
+ *traverseChildren(t, e) {
354
+ const { x: n, y: i, z: r } = this;
355
+ for (const o of V(n, i, r, r + t, e))
356
+ yield o;
837
357
  }
838
- fromArray(t, n = 0) {
839
- return this.x = t[n], this.y = t[n + 1], this.z = t[n + 2], this;
358
+ fromArray(t, e = 0) {
359
+ return this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this;
840
360
  }
841
- toArray(t = [], n = 0) {
842
- return t[n] = this.x, t[n + 1] = this.y, t[n + 2] = this.z, t;
361
+ toArray(t = [], e = 0) {
362
+ return t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t;
843
363
  }
844
364
  *[Symbol.iterator]() {
845
365
  yield this.x, yield this.y, yield this.z;
846
366
  }
847
367
  }
848
- const lt = /* @__PURE__ */ new ut();
849
- class _t {
850
- constructor(t = 2, n = 1, r = E.MAX) {
851
- this.width = t, this.height = n, this.rectangle = r;
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;
852
372
  }
853
373
  clone() {
854
- return new _t(this.width, this.height, this.rectangle.clone());
374
+ return new j(this.width, this.height, this.rectangle.clone());
855
375
  }
856
376
  copy(t) {
857
377
  return this.width = t.width, this.height = t.height, this.rectangle.copy(t.rectangle), this;
858
378
  }
859
- getSize(t, n = new ut()) {
860
- return n.set(this.width << t, this.height << t);
379
+ getSize(t, e = new C()) {
380
+ return e.set(this.width << t, this.height << t);
861
381
  }
862
382
  // Reference: https://github.com/CesiumGS/cesium/blob/1.122/packages/engine/Source/Core/GeographicTilingScheme.js#L210
863
- getTile(t, n, r = new S()) {
864
- const i = this.getSize(n, lt), a = this.rectangle.width / i.x, s = this.rectangle.height / i.y;
865
- let o = t.longitude;
866
- this.rectangle.east < this.rectangle.west && (o += Math.PI * 2);
867
- let h = Math.floor((o - this.rectangle.west) / a);
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;
385
+ let a = t.longitude;
386
+ this.rectangle.east < this.rectangle.west && (a += Math.PI * 2);
387
+ let h = Math.floor((a - this.rectangle.west) / r);
868
388
  h >= i.x && (h = i.x - 1);
869
- let l = Math.floor((t.latitude - this.rectangle.south) / s);
870
- return l >= i.y && (l = i.y - 1), r.x = h, r.y = l, r.z = n, r;
389
+ 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;
871
391
  }
872
392
  // Reference: https://github.com/CesiumGS/cesium/blob/1.122/packages/engine/Source/Core/GeographicTilingScheme.js#L169
873
- getRectangle(t, n = new E()) {
874
- const r = this.getSize(t.z, lt), i = this.rectangle.width / r.x, a = this.rectangle.height / r.y;
875
- return n.west = t.x * i + this.rectangle.west, n.east = (t.x + 1) * i + this.rectangle.west, n.north = this.rectangle.north - (r.y - t.y - 1) * a, n.south = this.rectangle.north - (r.y - t.y) * a, n;
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;
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;
876
396
  }
877
397
  }
878
- const dr = Nt, fr = Dt, pr = Ft;
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;
404
+ }
405
+ function oe(s) {
406
+ return s.replace(At, Lt);
407
+ }
879
408
  export {
880
- Gt as ArrayBufferLoader,
881
- F as DataLoader,
882
- et as Ellipsoid,
883
- wr as EllipsoidGeometry,
884
- vt as Float32ArrayLoader,
885
- Jn as Float32Data2DLoader,
886
- kn as Float32Data3DLoader,
887
- m as Geodetic,
888
- $n as Int16ArrayLoader,
889
- Kn as Int16Data2DLoader,
890
- mt as PointOfView,
891
- E as Rectangle,
892
- S as TileCoordinate,
893
- _t as TilingScheme,
894
- Q as TypedArrayLoader,
895
- jn as Uint16ArrayLoader,
896
- Qn as Uint16Data2DLoader,
897
- Xn as assertType,
898
- sr as ceilPowerOfTwo,
899
- Gn as clamp,
900
- ur as closeTo,
901
- ir as degrees,
902
- dr as depthShader,
903
- tr as euclideanModulo,
904
- or as floorPowerOfTwo,
905
- Yn as fromBufferGeometryLike,
906
- er as inverseLerp,
907
- ar as isPowerOfTwo,
908
- nr as lerp,
909
- cr as normalize,
910
- fr as packingShader,
911
- Fn as parseFloat32Array,
912
- Nn as parseInt16Array,
913
- K as parseTypedArray,
914
- Dn as parseUint16Array,
915
- rr as radians,
916
- lr as saturate,
917
- hr as smoothstep,
918
- Zn as toBufferGeometryLike,
919
- pr as transformShader
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,
416
+ w as Geodetic,
417
+ Ct as Int16ArrayLoader,
418
+ 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,
424
+ 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,
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
920
463
  };
921
464
  //# sourceMappingURL=index.js.map