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

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