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