@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.cjs +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.js +400 -298
- package/build/index.js.map +1 -1
- package/build/shaders.cjs +17 -26
- package/build/shaders.cjs.map +1 -1
- package/build/shaders.js +27 -35
- 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/bufferGeometry.ts +5 -4
- package/src/decorators.ts +207 -0
- package/src/index.ts +1 -0
- package/src/r3f/types.ts +3 -1
- package/src/shaders/index.ts +4 -2
- package/src/shaders/interleavedGradientNoise.glsl +6 -0
- package/src/shaders/vogelDisk.glsl +8 -0
- package/types/DataLoader.d.ts +4 -4
- package/types/bufferGeometry.d.ts +2 -1
- package/types/decorators.d.ts +22 -0
- package/types/index.d.ts +1 -0
- package/types/r3f/types.d.ts +1 -1
- package/types/shaders/index.d.ts +2 -1
- package/src/shaders/poissonDisk.glsl +0 -23
package/build/index.js
CHANGED
@@ -1,259 +1,357 @@
|
|
1
|
-
|
2
|
-
|
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
|
8
|
-
function
|
9
|
-
if (!
|
10
|
-
if (
|
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
|
17
|
-
load(t, e,
|
18
|
-
const
|
19
|
-
|
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
|
-
|
19
|
+
H(o instanceof ArrayBuffer);
|
23
20
|
try {
|
24
21
|
e(o);
|
25
22
|
} catch (a) {
|
26
|
-
|
23
|
+
i != null ? i(a) : console.error(a), this.manager.itemError(t);
|
27
24
|
}
|
28
25
|
},
|
29
|
-
|
30
|
-
|
26
|
+
n,
|
27
|
+
i
|
31
28
|
);
|
32
29
|
}
|
33
30
|
}
|
34
|
-
function
|
31
|
+
function Dt(s) {
|
35
32
|
}
|
36
|
-
function
|
37
|
-
var
|
38
|
-
const { attributes: t, index: e, boundingBox:
|
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:
|
37
|
+
{ attributes: t, index: e, boundingBox: n, boundingSphere: i },
|
41
38
|
[
|
42
|
-
...Object.values(
|
39
|
+
...Object.values(s.attributes).map(
|
43
40
|
(o) => o.array.buffer
|
44
41
|
),
|
45
|
-
(
|
42
|
+
(r = s.index) == null ? void 0 : r.array.buffer
|
46
43
|
].filter((o) => o != null)
|
47
44
|
];
|
48
45
|
}
|
49
|
-
function Ot(
|
50
|
-
for (const [e,
|
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
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
new _(
|
51
|
+
n.array,
|
52
|
+
n.itemSize,
|
53
|
+
n.normalized
|
57
54
|
)
|
58
55
|
);
|
59
|
-
if (t.index =
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
) : null,
|
64
|
-
const { min: e, max:
|
65
|
-
t.boundingBox = new
|
66
|
-
new
|
67
|
-
new
|
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 (
|
71
|
-
const { center: e, radius:
|
72
|
-
t.boundingSphere = new
|
73
|
-
new
|
74
|
-
|
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
|
80
|
-
function
|
81
|
-
const t =
|
82
|
-
return
|
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
|
82
|
+
function yt() {
|
86
83
|
if (L != null)
|
87
84
|
return L;
|
88
|
-
const
|
89
|
-
return L = new Uint8Array(
|
90
|
-
}
|
91
|
-
function g(
|
92
|
-
if (
|
93
|
-
return new t(
|
94
|
-
const
|
95
|
-
for (let o = 0, a = 0; o <
|
96
|
-
|
97
|
-
return
|
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
|
100
|
-
class
|
101
|
-
load(t, e,
|
102
|
-
const
|
103
|
-
|
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
|
-
|
106
|
+
i != null ? i(a) : console.error(a), this.manager.itemError(t);
|
110
107
|
}
|
111
108
|
},
|
112
|
-
|
113
|
-
|
109
|
+
n,
|
110
|
+
i
|
114
111
|
);
|
115
112
|
}
|
116
113
|
}
|
117
|
-
function
|
118
|
-
return class extends
|
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
|
126
|
-
return new (
|
121
|
+
function jt(s) {
|
122
|
+
return new (b(s))();
|
127
123
|
}
|
128
|
-
const
|
129
|
-
format:
|
130
|
-
wrapS:
|
131
|
-
wrapT:
|
132
|
-
minFilter:
|
133
|
-
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
|
134
130
|
};
|
135
|
-
class
|
131
|
+
class Tt extends z {
|
136
132
|
constructor() {
|
137
|
-
super(...arguments);
|
138
|
-
d(this, "parameters", {});
|
133
|
+
super(...arguments), this.parameters = {};
|
139
134
|
}
|
140
|
-
load(
|
141
|
-
const
|
142
|
-
|
143
|
-
|
144
|
-
(
|
145
|
-
|
146
|
-
const { width:
|
147
|
-
|
148
|
-
const
|
149
|
-
|
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
|
-
|
146
|
+
n,
|
152
147
|
i
|
153
148
|
);
|
154
149
|
}
|
155
150
|
}
|
156
|
-
function
|
157
|
-
return class extends
|
151
|
+
function W(s, t, e) {
|
152
|
+
return class extends Tt {
|
158
153
|
constructor() {
|
159
|
-
super(...arguments)
|
160
|
-
|
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
|
170
|
-
return
|
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
|
173
|
-
return
|
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
|
176
|
-
|
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
|
179
|
-
return
|
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
|
-
|
182
|
-
function Kt(n, ...t) {
|
306
|
+
function fe(s, ...t) {
|
183
307
|
const e = {};
|
184
|
-
for (let
|
185
|
-
const
|
186
|
-
for (const o of
|
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: () =>
|
313
|
+
get: () => i[o],
|
190
314
|
set: (a) => {
|
191
|
-
|
315
|
+
i[o] = a;
|
192
316
|
}
|
193
317
|
};
|
194
318
|
}
|
195
|
-
return Object.defineProperties(
|
319
|
+
return Object.defineProperties(s, e), s;
|
196
320
|
}
|
197
|
-
function
|
198
|
-
const
|
199
|
-
for (const
|
200
|
-
|
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[
|
203
|
-
set: (
|
204
|
-
t.uniforms[
|
326
|
+
get: () => t.uniforms[i].value,
|
327
|
+
set: (r) => {
|
328
|
+
t.uniforms[i].value = r;
|
205
329
|
}
|
206
330
|
};
|
207
|
-
return Object.defineProperties(
|
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
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
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,
|
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 =
|
348
|
+
this._pitch = p(t, -Math.PI / 2 + P, Math.PI / 2 - P);
|
251
349
|
}
|
252
|
-
set(t, e,
|
253
|
-
return this.distance = t, this.heading = e, this.pitch =
|
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
|
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,
|
265
|
-
|
362
|
+
decompose(t, e, n, i, r = j.WGS84) {
|
363
|
+
r.getEastNorthUpVectors(
|
266
364
|
t,
|
267
365
|
S,
|
268
|
-
|
269
|
-
|
270
|
-
),
|
366
|
+
E,
|
367
|
+
d
|
368
|
+
), i == null || i.copy(d);
|
271
369
|
const o = m.copy(S).multiplyScalar(Math.cos(this.heading)).add(
|
272
|
-
|
273
|
-
).multiplyScalar(Math.cos(this.pitch)).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);
|
274
372
|
if (e.copy(t).sub(o), this.roll !== 0) {
|
275
373
|
const a = m.copy(t).sub(e).normalize();
|
276
|
-
|
277
|
-
|
374
|
+
d.applyQuaternion(
|
375
|
+
Lt.setFromAxisAngle(a, this.roll)
|
278
376
|
);
|
279
377
|
}
|
280
|
-
|
281
|
-
|
378
|
+
n.setFromRotationMatrix(
|
379
|
+
At.lookAt(e, t, d)
|
282
380
|
);
|
283
381
|
}
|
284
|
-
setFromCamera(t, e =
|
285
|
-
const
|
286
|
-
if (
|
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 =
|
289
|
-
|
386
|
+
this.distance = n.distanceTo(r), e.getEastNorthUpVectors(
|
387
|
+
r,
|
290
388
|
S,
|
291
|
-
|
292
|
-
|
389
|
+
E,
|
390
|
+
d
|
293
391
|
), this.heading = Math.atan2(
|
294
|
-
|
295
|
-
S.dot(
|
296
|
-
), this.pitch = Math.asin(
|
297
|
-
const o = m.copy(t.up).applyQuaternion(t.quaternion), a = bt.copy(
|
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,
|
303
|
-
this.west = t, this.south = e, this.east =
|
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,
|
313
|
-
return this.west = t, this.south = e, this.east =
|
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,
|
325
|
-
return
|
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
|
-
|
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
|
347
|
-
const
|
348
|
-
function
|
349
|
-
return
|
350
|
-
const
|
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
|
355
|
-
throw new Error(`Could not find include for ${
|
356
|
-
return
|
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
|
360
|
-
format:
|
457
|
+
const ge = N(wt, {
|
458
|
+
format: ct,
|
361
459
|
minFilter: R,
|
362
460
|
magFilter: R,
|
363
|
-
wrapS:
|
364
|
-
wrapT:
|
365
|
-
wrapR:
|
366
|
-
width:
|
367
|
-
height:
|
368
|
-
depth:
|
461
|
+
wrapS: F,
|
462
|
+
wrapT: F,
|
463
|
+
wrapR: F,
|
464
|
+
width: ut,
|
465
|
+
height: ft,
|
466
|
+
depth: pt
|
369
467
|
});
|
370
|
-
function*
|
371
|
-
if (e >=
|
468
|
+
function* $(s, t, e, n, i) {
|
469
|
+
if (e >= n)
|
372
470
|
return;
|
373
|
-
const
|
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 <
|
477
|
+
if (o < n)
|
380
478
|
for (const y of f)
|
381
|
-
for (const
|
382
|
-
yield
|
479
|
+
for (const A of $(...y, n, i))
|
480
|
+
yield A;
|
383
481
|
else
|
384
482
|
for (const y of f)
|
385
|
-
yield (
|
483
|
+
yield (i ?? new T()).set(...y);
|
386
484
|
}
|
387
485
|
class T {
|
388
|
-
constructor(t = 0, e = 0,
|
389
|
-
this.x = t, this.y = e, this.z =
|
486
|
+
constructor(t = 0, e = 0, n = 0) {
|
487
|
+
this.x = t, this.y = e, this.z = n;
|
390
488
|
}
|
391
|
-
set(t, e,
|
392
|
-
return this.x = t, this.y = e,
|
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,
|
405
|
-
return t.set(Math.floor(
|
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:
|
409
|
-
for (const o of
|
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
|
423
|
-
class
|
424
|
-
constructor(t = 2, e = 1,
|
425
|
-
this.width = t, this.height = e, this.rectangle =
|
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
|
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
|
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,
|
438
|
-
const
|
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) /
|
442
|
-
h >=
|
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 >=
|
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
|
448
|
-
const
|
449
|
-
return e.west = t.x *
|
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
|
453
|
-
function
|
454
|
-
let
|
455
|
-
for (let
|
456
|
-
|
457
|
-
return
|
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
|
460
|
-
return
|
557
|
+
function ye(s) {
|
558
|
+
return s.replace(Mt, Ut);
|
461
559
|
}
|
462
560
|
export {
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
561
|
+
dt as ArrayBufferLoader,
|
562
|
+
Nt as DEFAULT_STBN_URL,
|
563
|
+
Tt as DataLoader,
|
564
|
+
j as Ellipsoid,
|
467
565
|
xe as EllipsoidGeometry,
|
468
|
-
|
469
|
-
|
470
|
-
|
566
|
+
vt as Float32ArrayLoader,
|
567
|
+
kt as Float32Data2DLoader,
|
568
|
+
$t as Float32Data3DLoader,
|
471
569
|
w as Geodetic,
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
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
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
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
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
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
|