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