world.ts 0.5.1 → 0.5.3
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/dist/index.js +368 -362
- package/dist/index.js.map +1 -1
- package/dist/layers/billboard/index.d.ts +1 -0
- package/dist/layers/index.d.ts +2 -0
- package/dist/layers/line/index.d.ts +1 -0
- package/dist/layers/object/index.d.ts +1 -0
- package/dist/layers/polygon/index.d.ts +1 -0
- package/dist/layers/radar/index.d.ts +1 -0
- package/dist/layers/terrain/index.d.ts +1 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -25,38 +25,38 @@ const Ut = (e, t) => {
|
|
|
25
25
|
const o = () => e.useProgram(i), c = {}, a = (y, g) => {
|
|
26
26
|
if (c[y])
|
|
27
27
|
return c[y];
|
|
28
|
-
const
|
|
29
|
-
let
|
|
28
|
+
const w = e.getUniformLocation(i, y);
|
|
29
|
+
let b;
|
|
30
30
|
const S = (U) => {
|
|
31
|
-
|
|
31
|
+
w && U !== b && (g(w, U), b = U);
|
|
32
32
|
};
|
|
33
33
|
return c[y] = { set: S }, { set: S };
|
|
34
|
-
}, f = (y) => a(y, (g,
|
|
34
|
+
}, f = (y) => a(y, (g, w) => e.uniform1f(g, w)), l = (y) => a(y, (g, w) => e.uniform1i(g, w)), h = (y) => a(
|
|
35
35
|
y,
|
|
36
|
-
(g, [
|
|
36
|
+
(g, [w = 0, b = 0]) => e.uniform2f(g, w, b)
|
|
37
37
|
), u = (y) => a(
|
|
38
38
|
y,
|
|
39
|
-
(g, [
|
|
39
|
+
(g, [w = 0, b = 0]) => e.uniform2i(g, w, b)
|
|
40
40
|
), d = (y) => a(
|
|
41
41
|
y,
|
|
42
|
-
(g, [
|
|
43
|
-
),
|
|
42
|
+
(g, [w = 0, b = 0, S = 0]) => e.uniform3f(g, w, b, S)
|
|
43
|
+
), p = (y) => a(
|
|
44
44
|
y,
|
|
45
|
-
(g, [
|
|
45
|
+
(g, [w = 0, b = 0, S = 0]) => e.uniform3i(g, w, b, S)
|
|
46
46
|
), _ = (y) => a(
|
|
47
47
|
y,
|
|
48
|
-
(g, [
|
|
48
|
+
(g, [w = 0, b = 0, S = 0, U = 0]) => e.uniform4f(g, w, b, S, U)
|
|
49
49
|
), E = (y) => a(
|
|
50
50
|
y,
|
|
51
|
-
(g, [
|
|
51
|
+
(g, [w = 0, b = 0, S = 0, U = 0]) => e.uniform4i(g, w, b, S, U)
|
|
52
52
|
), x = (y) => a(
|
|
53
53
|
y,
|
|
54
|
-
(g,
|
|
54
|
+
(g, w) => e.uniformMatrix4fv(g, !1, w)
|
|
55
55
|
), A = ({
|
|
56
56
|
name: y,
|
|
57
57
|
buffer: g,
|
|
58
|
-
size:
|
|
59
|
-
type:
|
|
58
|
+
size: w,
|
|
59
|
+
type: b,
|
|
60
60
|
stride: S,
|
|
61
61
|
offset: U
|
|
62
62
|
}) => {
|
|
@@ -64,15 +64,15 @@ const Ut = (e, t) => {
|
|
|
64
64
|
if (P === -1)
|
|
65
65
|
throw new Error(`Missing attribute: ${y}`);
|
|
66
66
|
return { use: () => {
|
|
67
|
-
g.use(), e.enableVertexAttribArray(P), ["u16", "i32"].includes(
|
|
67
|
+
g.use(), e.enableVertexAttribArray(P), ["u16", "i32"].includes(b) ? e.vertexAttribIPointer(
|
|
68
68
|
P,
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
w,
|
|
70
|
+
b === "u16" ? e.UNSIGNED_SHORT : e.INT,
|
|
71
71
|
S || 0,
|
|
72
72
|
U || 0
|
|
73
73
|
) : e.vertexAttribPointer(
|
|
74
74
|
P,
|
|
75
|
-
|
|
75
|
+
w,
|
|
76
76
|
e.FLOAT,
|
|
77
77
|
!1,
|
|
78
78
|
S || 0,
|
|
@@ -87,14 +87,14 @@ const Ut = (e, t) => {
|
|
|
87
87
|
uniform2f: h,
|
|
88
88
|
uniform2i: u,
|
|
89
89
|
uniform3f: d,
|
|
90
|
-
uniform3i:
|
|
90
|
+
uniform3i: p,
|
|
91
91
|
uniform4f: _,
|
|
92
92
|
uniform4i: E,
|
|
93
93
|
uniformMatrix4f: x,
|
|
94
|
-
attribute1f: (y, g,
|
|
95
|
-
attribute2f: (y, g,
|
|
96
|
-
attribute3f: (y, g,
|
|
97
|
-
attribute3i: (y, g,
|
|
94
|
+
attribute1f: (y, g, w = {}) => A({ name: y, buffer: g, size: 1, type: "f32", ...w }),
|
|
95
|
+
attribute2f: (y, g, w = {}) => A({ name: y, buffer: g, size: 2, type: "f32", ...w }),
|
|
96
|
+
attribute3f: (y, g, w = {}) => A({ name: y, buffer: g, size: 3, type: "f32", ...w }),
|
|
97
|
+
attribute3i: (y, g, w = {}) => A({ name: y, buffer: g, size: 3, type: "i32", ...w }),
|
|
98
98
|
dispose: () => {
|
|
99
99
|
e.deleteProgram(i), e.deleteShader(r), e.deleteShader(s);
|
|
100
100
|
}
|
|
@@ -120,7 +120,7 @@ const Ut = (e, t) => {
|
|
|
120
120
|
},
|
|
121
121
|
dispose: () => [...t.values()].forEach((r) => r.dispose())
|
|
122
122
|
};
|
|
123
|
-
},
|
|
123
|
+
}, Mi = (e) => {
|
|
124
124
|
const t = e.getContext("webgl2");
|
|
125
125
|
if (!t)
|
|
126
126
|
throw new Error("No WebGL2");
|
|
@@ -148,20 +148,20 @@ function Dt(e) {
|
|
|
148
148
|
return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;
|
|
149
149
|
}
|
|
150
150
|
function Ot(e, t) {
|
|
151
|
-
var n = t[0], i = t[1], r = t[2], s = t[3], o = t[4], c = t[5], a = t[6], f = t[7], l = t[8], h = t[9], u = t[10], d = t[11],
|
|
152
|
-
return P ? (P = 1 / P, e[0] = (c * U - a * S + f *
|
|
151
|
+
var n = t[0], i = t[1], r = t[2], s = t[3], o = t[4], c = t[5], a = t[6], f = t[7], l = t[8], h = t[9], u = t[10], d = t[11], p = t[12], _ = t[13], E = t[14], x = t[15], A = n * c - i * o, M = n * a - r * o, v = n * f - s * o, m = i * a - r * c, T = i * f - s * c, R = r * f - s * a, y = l * _ - h * p, g = l * E - u * p, w = l * x - d * p, b = h * E - u * _, S = h * x - d * _, U = u * x - d * E, P = A * U - M * S + v * b + m * w - T * g + R * y;
|
|
152
|
+
return P ? (P = 1 / P, e[0] = (c * U - a * S + f * b) * P, e[1] = (r * S - i * U - s * b) * P, e[2] = (_ * R - E * T + x * m) * P, e[3] = (u * T - h * R - d * m) * P, e[4] = (a * w - o * U - f * g) * P, e[5] = (n * U - r * w + s * g) * P, e[6] = (E * v - p * R - x * M) * P, e[7] = (l * R - u * v + d * M) * P, e[8] = (o * S - c * w + f * y) * P, e[9] = (i * w - n * S - s * y) * P, e[10] = (p * T - _ * v + x * A) * P, e[11] = (h * v - l * T - d * A) * P, e[12] = (c * g - o * b - a * y) * P, e[13] = (n * b - i * g + r * y) * P, e[14] = (_ * M - p * m - E * A) * P, e[15] = (l * m - h * M + u * A) * P, e) : null;
|
|
153
153
|
}
|
|
154
154
|
function Ct(e, t, n) {
|
|
155
|
-
var i = t[0], r = t[1], s = t[2], o = t[3], c = t[4], a = t[5], f = t[6], l = t[7], h = t[8], u = t[9], d = t[10],
|
|
156
|
-
return e[0] =
|
|
155
|
+
var i = t[0], r = t[1], s = t[2], o = t[3], c = t[4], a = t[5], f = t[6], l = t[7], h = t[8], u = t[9], d = t[10], p = t[11], _ = t[12], E = t[13], x = t[14], A = t[15], M = n[0], v = n[1], m = n[2], T = n[3];
|
|
156
|
+
return e[0] = M * i + v * c + m * h + T * _, e[1] = M * r + v * a + m * u + T * E, e[2] = M * s + v * f + m * d + T * x, e[3] = M * o + v * l + m * p + T * A, M = n[4], v = n[5], m = n[6], T = n[7], e[4] = M * i + v * c + m * h + T * _, e[5] = M * r + v * a + m * u + T * E, e[6] = M * s + v * f + m * d + T * x, e[7] = M * o + v * l + m * p + T * A, M = n[8], v = n[9], m = n[10], T = n[11], e[8] = M * i + v * c + m * h + T * _, e[9] = M * r + v * a + m * u + T * E, e[10] = M * s + v * f + m * d + T * x, e[11] = M * o + v * l + m * p + T * A, M = n[12], v = n[13], m = n[14], T = n[15], e[12] = M * i + v * c + m * h + T * _, e[13] = M * r + v * a + m * u + T * E, e[14] = M * s + v * f + m * d + T * x, e[15] = M * o + v * l + m * p + T * A, e;
|
|
157
157
|
}
|
|
158
158
|
function Xt(e, t, n) {
|
|
159
159
|
var i = n[0], r = n[1], s = n[2];
|
|
160
160
|
return e[0] = t[0] * i, e[1] = t[1] * i, e[2] = t[2] * i, e[3] = t[3] * i, e[4] = t[4] * r, e[5] = t[5] * r, e[6] = t[6] * r, e[7] = t[7] * r, e[8] = t[8] * s, e[9] = t[9] * s, e[10] = t[10] * s, e[11] = t[11] * s, e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e;
|
|
161
161
|
}
|
|
162
162
|
function Ke(e, t) {
|
|
163
|
-
var n = t[0], i = t[1], r = t[2], s = t[3], o = n + n, c = i + i, a = r + r, f = n * o, l = i * o, h = i * c, u = r * o, d = r * c,
|
|
164
|
-
return e[0] = 1 - h -
|
|
163
|
+
var n = t[0], i = t[1], r = t[2], s = t[3], o = n + n, c = i + i, a = r + r, f = n * o, l = i * o, h = i * c, u = r * o, d = r * c, p = r * a, _ = s * o, E = s * c, x = s * a;
|
|
164
|
+
return e[0] = 1 - h - p, e[1] = l + x, e[2] = u - E, e[3] = 0, e[4] = l - x, e[5] = 1 - f - p, e[6] = d + _, e[7] = 0, e[8] = u + E, e[9] = d - _, e[10] = 1 - f - h, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;
|
|
165
165
|
}
|
|
166
166
|
function Wt(e, t, n, i, r) {
|
|
167
167
|
var s = 1 / Math.tan(t / 2), o;
|
|
@@ -187,7 +187,7 @@ function st(e, t, n) {
|
|
|
187
187
|
function Vt(e, t) {
|
|
188
188
|
return e[0] = t[0], e[1] = t[1], e[2] = t[2], e;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function Me(e, t, n, i) {
|
|
191
191
|
return e[0] = t, e[1] = n, e[2] = i, e;
|
|
192
192
|
}
|
|
193
193
|
function re(e, t, n) {
|
|
@@ -199,7 +199,7 @@ function Zt(e, t, n) {
|
|
|
199
199
|
function de(e, t, n) {
|
|
200
200
|
return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function be(e, t) {
|
|
203
203
|
var n = t[0] - e[0], i = t[1] - e[1], r = t[2] - e[2];
|
|
204
204
|
return Math.hypot(n, i, r);
|
|
205
205
|
}
|
|
@@ -290,8 +290,8 @@ function rn(e, t) {
|
|
|
290
290
|
return Math.acos(2 * n * n - 1);
|
|
291
291
|
}
|
|
292
292
|
function Ie(e, t, n, i) {
|
|
293
|
-
var r = t[0], s = t[1], o = t[2], c = t[3], a = n[0], f = n[1], l = n[2], h = n[3], u, d,
|
|
294
|
-
return d = r * a + s * f + o * l + c * h, d < 0 && (d = -d, a = -a, f = -f, l = -l, h = -h), 1 - d > Lt ? (u = Math.acos(d),
|
|
293
|
+
var r = t[0], s = t[1], o = t[2], c = t[3], a = n[0], f = n[1], l = n[2], h = n[3], u, d, p, _, E;
|
|
294
|
+
return d = r * a + s * f + o * l + c * h, d < 0 && (d = -d, a = -a, f = -f, l = -l, h = -h), 1 - d > Lt ? (u = Math.acos(d), p = Math.sin(u), _ = Math.sin((1 - i) * u) / p, E = Math.sin(i * u) / p) : (_ = 1 - i, E = i), e[0] = _ * r + E * a, e[1] = _ * s + E * f, e[2] = _ * o + E * l, e[3] = _ * c + E * h, e;
|
|
295
295
|
}
|
|
296
296
|
function sn(e, t) {
|
|
297
297
|
var n = t[0] + t[4] + t[8], i;
|
|
@@ -325,7 +325,7 @@ var on = dt, an = en, mt = Jt;
|
|
|
325
325
|
return e[0] = i[0], e[3] = i[1], e[6] = i[2], e[1] = r[0], e[4] = r[1], e[7] = r[2], e[2] = -n[0], e[5] = -n[1], e[8] = -n[2], mt(t, sn(t, e));
|
|
326
326
|
};
|
|
327
327
|
})();
|
|
328
|
-
function
|
|
328
|
+
function ve() {
|
|
329
329
|
var e = new j(2);
|
|
330
330
|
return j != Float32Array && (e[0] = 0, e[1] = 0), e;
|
|
331
331
|
}
|
|
@@ -352,13 +352,13 @@ function mn(e, t) {
|
|
|
352
352
|
var n = t[0] - e[0], i = t[1] - e[1];
|
|
353
353
|
return Math.hypot(n, i);
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function pn(e, t) {
|
|
356
356
|
var n = t[0] - e[0], i = t[1] - e[1];
|
|
357
357
|
return n * n + i * i;
|
|
358
358
|
}
|
|
359
|
-
var
|
|
359
|
+
var vn = hn;
|
|
360
360
|
(function() {
|
|
361
|
-
var e =
|
|
361
|
+
var e = ve();
|
|
362
362
|
return function(t, n, i, r, s, o) {
|
|
363
363
|
var c, a;
|
|
364
364
|
for (n || (n = 2), i || (i = 0), r ? a = Math.min(r * n + i, t.length) : a = t.length, c = i; c < a; c += n)
|
|
@@ -369,22 +369,22 @@ var pn = hn;
|
|
|
369
369
|
const Q = 40075017, De = (e) => e / 180 * Math.PI, xn = (e) => e * 180 / Math.PI, En = (e, t, n) => {
|
|
370
370
|
const i = Math.sqrt(t * t - 4 * e * n);
|
|
371
371
|
return [(-t - i) / (2 * e), (-t + i) / (2 * e)];
|
|
372
|
-
}, _n = (e, t, n) => Math.min(Math.max(e, t), n), ct = Math.atan(Math.sinh(Math.PI)), z = ([e = 0, t = 0, n = 0], i = L()) =>
|
|
372
|
+
}, _n = (e, t, n) => Math.min(Math.max(e, t), n), ct = Math.atan(Math.sinh(Math.PI)), z = ([e = 0, t = 0, n = 0], i = L()) => Me(
|
|
373
373
|
i,
|
|
374
374
|
e / 360 + 0.5,
|
|
375
375
|
-Math.asinh(Math.tan(_n(De(t), -ct, ct))) / (2 * Math.PI) + 0.5,
|
|
376
376
|
n / Q
|
|
377
|
-
), oe = ([e = 0, t = 0, n = 0], i = L()) =>
|
|
377
|
+
), oe = ([e = 0, t = 0, n = 0], i = L()) => Me(
|
|
378
378
|
i,
|
|
379
379
|
(e - 0.5) * 360,
|
|
380
380
|
xn(Math.atan(Math.sinh(-(t - 0.5) * (2 * Math.PI)))),
|
|
381
381
|
n * Q
|
|
382
|
-
),
|
|
382
|
+
), pt = ([e = 0, t = 0, n = 0], i = L()) => {
|
|
383
383
|
const r = 2 ** -n;
|
|
384
|
-
return
|
|
385
|
-
},
|
|
386
|
-
const i = Math.cos(e * 0.5), r = Math.sin(e * 0.5), s = Math.cos(t * 0.5), o = Math.sin(t * 0.5), c = Math.cos(n * 0.5), a = Math.sin(n * 0.5), f =
|
|
387
|
-
return [l, h, u
|
|
384
|
+
return Me(i, e * r, t * r, 0);
|
|
385
|
+
}, vt = ([e = 0, t = 0, n = 0]) => {
|
|
386
|
+
const i = Math.cos(e * 0.5), r = Math.sin(e * 0.5), s = Math.cos(t * 0.5), o = Math.sin(t * 0.5), c = Math.cos(n * 0.5), a = Math.sin(n * 0.5), f = r * s * c + i * o * a, l = i * o * c - r * s * a, h = i * s * a + r * o * c, u = i * s * c - r * o * a;
|
|
387
|
+
return [f, l, h, u];
|
|
388
388
|
}, yn = ([e = 0, t = 0, n = 0, i = 0]) => {
|
|
389
389
|
const r = (a, f, l) => Math.max(f, Math.min(a, l)), s = Math.atan2(2 * (i * e - t * n), 1 - 2 * (e * e + t * t)), o = Math.asin(r(2 * (i * t + n * e), -1, 1)), c = Math.atan2(2 * (i * n - e * t), 1 - 2 * (t * t + n * n));
|
|
390
390
|
return [s, o, c];
|
|
@@ -398,23 +398,23 @@ const Q = 40075017, De = (e) => e / 180 * Math.PI, xn = (e) => e * 180 / Math.PI
|
|
|
398
398
|
const { target: n, offset: i, distance: r, orientation: s, fieldOfView: o } = {
|
|
399
399
|
...xt,
|
|
400
400
|
...e
|
|
401
|
-
}, [c = 0, a = 0] = t, [f = 0, l = 0] = i, h = Math.tan(De(45) / 2) / Math.tan(De(o) / 2), u = r / Q, d = Math.max(1e3 / Q, u),
|
|
402
|
-
Dt(
|
|
403
|
-
const
|
|
404
|
-
Ke(
|
|
405
|
-
const m = Ct(he(),
|
|
406
|
-
if (!
|
|
401
|
+
}, [c = 0, a = 0] = t, [f = 0, l = 0] = i, h = Math.tan(De(45) / 2) / Math.tan(De(o) / 2), u = r / Q, d = Math.max(1e3 / Q, u), p = 1e3, _ = 1e-3, E = d * p * h, x = d * _ * h, A = ne(), M = he();
|
|
402
|
+
Dt(M), jt(M, De(o), c / a, x, E), Xt(M, M, [1, -1, 1]);
|
|
403
|
+
const v = he();
|
|
404
|
+
Ke(v, vt(s));
|
|
405
|
+
const m = Ct(he(), M, v), T = Ot(he(), m);
|
|
406
|
+
if (!T)
|
|
407
407
|
throw new Error("No inverse");
|
|
408
|
-
const
|
|
408
|
+
const R = (O) => {
|
|
409
409
|
const Y = [c * O, a * O], $ = [f * O, l * O];
|
|
410
410
|
return te({ ...e, offset: $ }, Y);
|
|
411
411
|
}, y = ([O = 0, Y = 0], $ = ne()) => {
|
|
412
412
|
const K = 2 * O / c - 1, Te = -(2 * Y / a - 1);
|
|
413
413
|
return ot($, K, Te, 0, 1);
|
|
414
|
-
}, g = ([O = 0, Y = 0, , $ = 0], K =
|
|
415
|
-
const [$ = 0, K = 0, Te = 0, we = 0] = at(A, O,
|
|
416
|
-
return
|
|
417
|
-
},
|
|
414
|
+
}, g = ([O = 0, Y = 0, , $ = 0], K = ve()) => $ < 0 ? K : ln(K, (1 + O / $) * c * 0.5, (1 - Y / $) * a * 0.5), w = (O, Y = L()) => {
|
|
415
|
+
const [$ = 0, K = 0, Te = 0, we = 0] = at(A, O, T);
|
|
416
|
+
return Me(Y, $ / we, K / we, Te / we);
|
|
417
|
+
}, b = ([O = 0, Y = 0, $ = 0], K = ne()) => at(K, ot(K, O, Y, $, 1), m), [S = 0, U = 0] = y([f + c / 2, l + a / 2]), [P = 0, N = 0, I = 0] = w([S, U, -1, 1]), [X = 0, C = 0, B = 0] = w([S, U, 1.00001, 1]), [W = 0] = En(
|
|
418
418
|
(X - P) ** 2 + (C - N) ** 2 + (B - I) ** 2,
|
|
419
419
|
2 * (P * (X - P) + N * (C - N) + I * (B - I)),
|
|
420
420
|
P ** 2 + N ** 2 + I ** 2 - (u * h) ** 2
|
|
@@ -429,23 +429,23 @@ const Q = 40075017, De = (e) => e / 180 * Math.PI, xn = (e) => e * 180 / Math.PI
|
|
|
429
429
|
return {
|
|
430
430
|
camera: J,
|
|
431
431
|
screen: t,
|
|
432
|
-
projection:
|
|
433
|
-
modelView:
|
|
432
|
+
projection: M,
|
|
433
|
+
modelView: v,
|
|
434
434
|
fieldScale: h,
|
|
435
|
-
scale:
|
|
435
|
+
scale: R,
|
|
436
436
|
screenToClip: y,
|
|
437
437
|
clipToScreen: g,
|
|
438
|
-
clipToLocal:
|
|
439
|
-
localToClip:
|
|
438
|
+
clipToLocal: w,
|
|
439
|
+
localToClip: b,
|
|
440
440
|
localToWorld: k,
|
|
441
441
|
worldToLocal: G,
|
|
442
|
-
project: (O) => g(
|
|
442
|
+
project: (O) => g(b(G(z(O)))),
|
|
443
443
|
unproject: (O, { targetZ: Y = 0 } = {}) => {
|
|
444
|
-
const $ = y(O), [K = 0, Te = 0, , we = 0] = $,
|
|
444
|
+
const $ = y(O), [K = 0, Te = 0, , we = 0] = $, bt = [K, Te, -1, we], tt = oe(k(w($))), nt = oe(k(w(bt))), [, , Ve = 0] = tt, [, , it = 0] = nt, St = Ve === it ? 0 : (Y - Ve) / (it - Ve);
|
|
445
445
|
return kt(L(), tt, nt, St);
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
|
-
}, Tn = 100,
|
|
448
|
+
}, Tn = 100, bi = (e, t, n) => {
|
|
449
449
|
const {
|
|
450
450
|
enabled: i = () => !0,
|
|
451
451
|
draggable: r = () => !0,
|
|
@@ -453,72 +453,72 @@ const Q = 40075017, De = (e) => e / 180 * Math.PI, xn = (e) => e * 180 / Math.PI
|
|
|
453
453
|
onChangeView: o
|
|
454
454
|
} = n;
|
|
455
455
|
let c = !1, a = !1;
|
|
456
|
-
const { view: f } = n, l = ([m = 0,
|
|
457
|
-
const [
|
|
456
|
+
const { view: f } = n, l = ([m = 0, T = 0]) => {
|
|
457
|
+
const [R, y] = [
|
|
458
458
|
e.width / devicePixelRatio,
|
|
459
459
|
e.height / devicePixelRatio
|
|
460
|
-
], { camera: g, fieldScale:
|
|
460
|
+
], { camera: g, fieldScale: w } = te(f(), [R, y]), { position: b, layer: S } = t.pick([m, T]);
|
|
461
461
|
if (!S)
|
|
462
462
|
return;
|
|
463
|
-
const U =
|
|
463
|
+
const U = be(z(b), g) * Q / w, P = [m - R / 2, T - y / 2];
|
|
464
464
|
o({
|
|
465
465
|
offset: P,
|
|
466
|
-
target:
|
|
466
|
+
target: b,
|
|
467
467
|
distance: U
|
|
468
468
|
});
|
|
469
|
-
}, h = (m,
|
|
469
|
+
}, h = (m, T) => {
|
|
470
470
|
if (!r())
|
|
471
471
|
return;
|
|
472
|
-
a || (l([m,
|
|
473
|
-
const [
|
|
472
|
+
a || (l([m, T]), a = !0);
|
|
473
|
+
const [R, y] = [
|
|
474
474
|
e.width / devicePixelRatio,
|
|
475
475
|
e.height / devicePixelRatio
|
|
476
476
|
];
|
|
477
477
|
o({
|
|
478
|
-
offset: [m -
|
|
478
|
+
offset: [m - R / 2, T - y / 2]
|
|
479
479
|
});
|
|
480
|
-
}, u = (m,
|
|
480
|
+
}, u = (m, T, R, y) => {
|
|
481
481
|
if (!s())
|
|
482
482
|
return;
|
|
483
|
-
r() && !a && (l([m,
|
|
484
|
-
const [g,
|
|
483
|
+
r() && !a && (l([m, T]), a = !0);
|
|
484
|
+
const [g, w] = [
|
|
485
485
|
e.width / devicePixelRatio,
|
|
486
486
|
e.height / devicePixelRatio
|
|
487
|
-
], [
|
|
487
|
+
], [b = 0, S = 0, U = 0] = f().orientation ?? [], P = [
|
|
488
488
|
Math.min(
|
|
489
489
|
Math.PI / 2 - 0.1,
|
|
490
|
-
Math.max(0.1,
|
|
490
|
+
Math.max(0.1, b - y / w * Math.PI)
|
|
491
491
|
),
|
|
492
492
|
S,
|
|
493
|
-
U -
|
|
493
|
+
U - R / g * Math.PI
|
|
494
494
|
];
|
|
495
495
|
o({
|
|
496
496
|
orientation: P
|
|
497
497
|
});
|
|
498
498
|
}, d = (m) => {
|
|
499
499
|
m.preventDefault(), a = !1;
|
|
500
|
-
},
|
|
501
|
-
!i() || !m || (m === 1 && r() ? h(y, g) : m === 2 && s() && u(y, g,
|
|
500
|
+
}, p = ({ buttons: m, movementX: T, movementY: R, x: y, y: g }) => {
|
|
501
|
+
!i() || !m || (m === 1 && r() ? h(y, g) : m === 2 && s() && u(y, g, T, R));
|
|
502
502
|
}, _ = (m) => {
|
|
503
503
|
m.preventDefault();
|
|
504
|
-
const
|
|
505
|
-
if (!
|
|
504
|
+
const T = m.touches.item(0);
|
|
505
|
+
if (!T)
|
|
506
506
|
return;
|
|
507
|
-
const { clientX:
|
|
508
|
-
h(
|
|
509
|
-
}, E = Ut(() => c = !1, 100), x = ({ x: m, y:
|
|
507
|
+
const { clientX: R, clientY: y } = T;
|
|
508
|
+
h(R, y);
|
|
509
|
+
}, E = Ut(() => c = !1, 100), x = ({ x: m, y: T, deltaY: R }) => {
|
|
510
510
|
if (!i())
|
|
511
511
|
return;
|
|
512
|
-
c || (r() && l([m,
|
|
512
|
+
c || (r() && l([m, T]), c = !0);
|
|
513
513
|
let { distance: y } = { ...xt, ...f() };
|
|
514
514
|
y = Math.min(
|
|
515
|
-
Math.max(y * Math.exp(
|
|
515
|
+
Math.max(y * Math.exp(R * 1e-3), Tn),
|
|
516
516
|
Q
|
|
517
517
|
), o({ distance: y }), E();
|
|
518
|
-
}, A = (m) => m.preventDefault(),
|
|
519
|
-
return e.addEventListener("mousedown", d), e.addEventListener("mousemove",
|
|
518
|
+
}, A = (m) => m.preventDefault(), M = (m) => m.preventDefault();
|
|
519
|
+
return e.addEventListener("mousedown", d), e.addEventListener("mousemove", p), e.addEventListener("touchstart", d, { passive: !1 }), e.addEventListener("touchmove", _, { passive: !1 }), e.addEventListener("gesturestart", A), e.addEventListener("wheel", x, { passive: !0 }), e.addEventListener("contextmenu", M), {
|
|
520
520
|
dispose: () => {
|
|
521
|
-
e.removeEventListener("mousedown", d), e.removeEventListener("mousemove",
|
|
521
|
+
e.removeEventListener("mousedown", d), e.removeEventListener("mousemove", p), e.removeEventListener("touchstart", d), e.removeEventListener("touchmove", _), e.removeEventListener("gesturestart", A), e.removeEventListener("wheel", x), e.removeEventListener("contextmenu", M);
|
|
522
522
|
}
|
|
523
523
|
};
|
|
524
524
|
}, Z = ({
|
|
@@ -739,40 +739,40 @@ const Si = (e, t = {}) => {
|
|
|
739
739
|
);
|
|
740
740
|
const a = ce(
|
|
741
741
|
() => t.url?.() ?? "",
|
|
742
|
-
(
|
|
742
|
+
(p) => {
|
|
743
743
|
const _ = yt({
|
|
744
744
|
gl: n,
|
|
745
|
-
url:
|
|
745
|
+
url: p,
|
|
746
746
|
onLoad: ({ width: E, height: x }) => {
|
|
747
747
|
r = [E, x], n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE), i?.dispose(), i = _;
|
|
748
748
|
}
|
|
749
749
|
});
|
|
750
750
|
}
|
|
751
|
-
), { renderProgram: f, depthProgram: l } =
|
|
751
|
+
), { renderProgram: f, depthProgram: l } = Mn(e, {
|
|
752
752
|
cornerBuffer: s,
|
|
753
753
|
uvBuffer: o,
|
|
754
754
|
indexBuffer: c
|
|
755
755
|
}), h = ({
|
|
756
|
-
viewport: { projection:
|
|
756
|
+
viewport: { projection: p, modelView: _, camera: E, screen: x },
|
|
757
757
|
depth: A = !1,
|
|
758
|
-
index:
|
|
758
|
+
index: M = 0
|
|
759
759
|
}) => {
|
|
760
|
-
const
|
|
760
|
+
const v = t.position?.() ?? [0, 0, 0], m = t.color?.() ?? [1, 1, 1, 1], T = t.size?.() ?? 100, R = t.minSizePixels?.() ?? 0, y = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
761
761
|
if (a(), !i || Ee(n, A, t))
|
|
762
762
|
return;
|
|
763
763
|
(A ? l : f).execute({
|
|
764
|
-
projection:
|
|
764
|
+
projection: p,
|
|
765
765
|
modelView: _,
|
|
766
766
|
camera: q(E),
|
|
767
767
|
screen: x,
|
|
768
768
|
image: i,
|
|
769
769
|
imageSize: r,
|
|
770
|
-
position: q(z(
|
|
770
|
+
position: q(z(v)),
|
|
771
771
|
color: m,
|
|
772
|
-
size:
|
|
773
|
-
minSizePixels:
|
|
772
|
+
size: T,
|
|
773
|
+
minSizePixels: R,
|
|
774
774
|
maxSizePixels: y,
|
|
775
|
-
index:
|
|
775
|
+
index: M
|
|
776
776
|
});
|
|
777
777
|
}, u = () => {
|
|
778
778
|
s.dispose(), o.dispose(), c.dispose(), i?.dispose();
|
|
@@ -782,7 +782,7 @@ const Si = (e, t = {}) => {
|
|
|
782
782
|
dispose: u,
|
|
783
783
|
...d
|
|
784
784
|
};
|
|
785
|
-
},
|
|
785
|
+
}, Mn = ({ gl: e, programs: t }, {
|
|
786
786
|
cornerBuffer: n,
|
|
787
787
|
uvBuffer: i,
|
|
788
788
|
indexBuffer: r
|
|
@@ -795,11 +795,11 @@ const Si = (e, t = {}) => {
|
|
|
795
795
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
796
796
|
}), h = f.attribute2f("uv", i, {
|
|
797
797
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
798
|
-
}), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"),
|
|
798
|
+
}), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), p = f.uniform3i("camera"), _ = f.uniform2f("screen"), E = f.uniform1i("image"), x = f.uniform2f("image_size"), A = f.uniform3i("position"), M = f.uniform4f("color"), v = f.uniform1i("index"), m = f.uniform1f("size"), T = f.uniform1f("min_size_pixels"), R = f.uniform1f("max_size_pixels");
|
|
799
799
|
return { execute: ({
|
|
800
800
|
projection: g,
|
|
801
|
-
modelView:
|
|
802
|
-
camera:
|
|
801
|
+
modelView: w,
|
|
802
|
+
camera: b,
|
|
803
803
|
screen: S,
|
|
804
804
|
image: U,
|
|
805
805
|
imageSize: P,
|
|
@@ -810,7 +810,7 @@ const Si = (e, t = {}) => {
|
|
|
810
810
|
maxSizePixels: B,
|
|
811
811
|
index: W
|
|
812
812
|
}) => {
|
|
813
|
-
f.use(), l.use(), h.use(), u.set(g), d.set(
|
|
813
|
+
f.use(), l.use(), h.use(), u.set(g), d.set(w), p.set(b), _.set(S), x.set(P), A.set(N), M.set(I), m.set(X), T.set(C), R.set(B), v.set(W), e.activeTexture(e.TEXTURE0), E.set(0), U.use(), r.use(), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0);
|
|
814
814
|
} };
|
|
815
815
|
}, o = s(), c = s(!0);
|
|
816
816
|
return { renderProgram: o, depthProgram: c };
|
|
@@ -839,7 +839,7 @@ const Si = (e, t = {}) => {
|
|
|
839
839
|
}
|
|
840
840
|
}), Li = () => ({ dispose: () => {
|
|
841
841
|
} });
|
|
842
|
-
var
|
|
842
|
+
var bn = `#version 300 es
|
|
843
843
|
|
|
844
844
|
precision highp float;
|
|
845
845
|
|
|
@@ -934,69 +934,69 @@ const Ni = (e, t = {}) => {
|
|
|
934
934
|
}), l = _t(n);
|
|
935
935
|
l.use(), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.REPEAT);
|
|
936
936
|
const h = ({
|
|
937
|
-
viewport: { projection: E, modelView: x, camera: A, screen:
|
|
938
|
-
depth:
|
|
937
|
+
viewport: { projection: E, modelView: x, camera: A, screen: M },
|
|
938
|
+
depth: v = !1,
|
|
939
939
|
index: m = 0
|
|
940
940
|
}) => {
|
|
941
941
|
u(), d();
|
|
942
|
-
const
|
|
943
|
-
if (Ee(n,
|
|
942
|
+
const T = t.color?.() ?? [1, 1, 1, 1], R = t.width?.() ?? 1, y = t.minWidthPixels?.() ?? 0, g = t.maxWidthPixels?.() ?? Number.MAX_VALUE, w = t.depthWidthPixels?.(), b = t.dashSize?.() ?? 1e3, S = t.dashOffset?.() ?? 0;
|
|
943
|
+
if (Ee(n, v, t))
|
|
944
944
|
return;
|
|
945
|
-
(
|
|
945
|
+
(v ? f : a).execute({
|
|
946
946
|
projection: E,
|
|
947
947
|
modelView: x,
|
|
948
948
|
camera: q(A),
|
|
949
|
-
screen:
|
|
949
|
+
screen: M,
|
|
950
950
|
count: i,
|
|
951
|
-
color:
|
|
952
|
-
width:
|
|
953
|
-
minWidthPixels:
|
|
954
|
-
maxWidthPixels:
|
|
951
|
+
color: T,
|
|
952
|
+
width: R,
|
|
953
|
+
minWidthPixels: v && w !== void 0 ? Math.max(y, w) : y,
|
|
954
|
+
maxWidthPixels: v && w !== void 0 ? Math.max(g, w) : g,
|
|
955
955
|
index: m,
|
|
956
956
|
dash: l,
|
|
957
|
-
dashSize:
|
|
957
|
+
dashSize: b,
|
|
958
958
|
dashOffset: S
|
|
959
959
|
});
|
|
960
960
|
}, u = ce(
|
|
961
961
|
() => t.points?.() ?? [],
|
|
962
962
|
(E) => {
|
|
963
963
|
const x = E.flatMap((m) => {
|
|
964
|
-
const [
|
|
965
|
-
return !
|
|
966
|
-
const
|
|
967
|
-
for (let
|
|
968
|
-
const [S = 0, U = 0, P = 0] = g[
|
|
964
|
+
const [T] = m, [R] = m.slice(-1);
|
|
965
|
+
return !T || !R ? [] : ((g) => {
|
|
966
|
+
const w = new Array(g.length * 3 * 4);
|
|
967
|
+
for (let b = 0; b < g.length; b++) {
|
|
968
|
+
const [S = 0, U = 0, P = 0] = g[b] ?? [];
|
|
969
969
|
for (let N = 0; N < 4; N++) {
|
|
970
|
-
const I =
|
|
971
|
-
|
|
970
|
+
const I = b * 3 * 4 + N * 3;
|
|
971
|
+
w[I + 0] = S, w[I + 1] = U, w[I + 2] = P;
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
|
-
return
|
|
975
|
-
})([
|
|
974
|
+
return w;
|
|
975
|
+
})([T, ...m, R].map((g) => q(z(g))));
|
|
976
976
|
}), { indexData: A } = E.reduce(
|
|
977
|
-
({ indexData: m, count:
|
|
978
|
-
if (
|
|
979
|
-
return { indexData: m, count:
|
|
980
|
-
const y = xe(0, (
|
|
981
|
-
const [
|
|
982
|
-
(P) => P + g * 2 +
|
|
977
|
+
({ indexData: m, count: T }, R) => {
|
|
978
|
+
if (R.length === 0)
|
|
979
|
+
return { indexData: m, count: T };
|
|
980
|
+
const y = xe(0, (R.length - 1) * 2).flatMap((g) => {
|
|
981
|
+
const [w = 0, b = 0, S = 0, U = 0] = [0, 1, 2, 3].map(
|
|
982
|
+
(P) => P + g * 2 + T
|
|
983
983
|
);
|
|
984
984
|
return [
|
|
985
|
-
|
|
986
|
-
|
|
985
|
+
w,
|
|
986
|
+
b,
|
|
987
987
|
U,
|
|
988
988
|
/**/
|
|
989
|
-
|
|
989
|
+
w,
|
|
990
990
|
U,
|
|
991
991
|
S
|
|
992
992
|
];
|
|
993
993
|
});
|
|
994
|
-
return
|
|
994
|
+
return T += (R.length + 2) * 4, m = m.concat(y), { indexData: m, count: T };
|
|
995
995
|
},
|
|
996
996
|
{ indexData: [], count: 0 }
|
|
997
997
|
);
|
|
998
998
|
i = A.length;
|
|
999
|
-
const
|
|
999
|
+
const M = E.flatMap(
|
|
1000
1000
|
(m) => m.length === 0 ? [] : xe(0, (m.length + 1) * 2).flatMap(() => [
|
|
1001
1001
|
-1,
|
|
1002
1002
|
-1,
|
|
@@ -1010,21 +1010,21 @@ const Ni = (e, t = {}) => {
|
|
|
1010
1010
|
1,
|
|
1011
1011
|
1
|
|
1012
1012
|
])
|
|
1013
|
-
),
|
|
1014
|
-
const
|
|
1015
|
-
(
|
|
1013
|
+
), v = E.flatMap((m) => {
|
|
1014
|
+
const R = m.map(
|
|
1015
|
+
(b, S) => be(z(b), z(m[S - 1] ?? b)) * Q
|
|
1016
1016
|
).reduce(
|
|
1017
|
-
({ current:
|
|
1017
|
+
({ current: b, result: S }, U) => (b += U, S.push(b), { current: b, result: S }),
|
|
1018
1018
|
{ current: 0, result: [] }
|
|
1019
|
-
).result, [y] =
|
|
1020
|
-
return y === void 0 || g === void 0 ? [] : ((
|
|
1021
|
-
const S = new Array(
|
|
1022
|
-
for (let U = 0; U <
|
|
1023
|
-
S[U * 4 + 0] =
|
|
1019
|
+
).result, [y] = R, [g] = R.slice(-1);
|
|
1020
|
+
return y === void 0 || g === void 0 ? [] : ((b) => {
|
|
1021
|
+
const S = new Array(b.length * 4);
|
|
1022
|
+
for (let U = 0; U < b.length; U++)
|
|
1023
|
+
S[U * 4 + 0] = b[U], S[U * 4 + 1] = b[U], S[U * 4 + 2] = b[U], S[U * 4 + 3] = b[U];
|
|
1024
1024
|
return S;
|
|
1025
|
-
})([y, ...
|
|
1025
|
+
})([y, ...R, g]);
|
|
1026
1026
|
});
|
|
1027
|
-
r.set(x), s.set(A), o.set(
|
|
1027
|
+
r.set(x), s.set(A), o.set(M), c.set(v);
|
|
1028
1028
|
}
|
|
1029
1029
|
), d = ce(
|
|
1030
1030
|
() => t.dashPattern?.(),
|
|
@@ -1041,12 +1041,12 @@ const Ni = (e, t = {}) => {
|
|
|
1041
1041
|
new Uint8Array(E.flatMap((x) => [...x.map((A) => A * 255)]))
|
|
1042
1042
|
);
|
|
1043
1043
|
}
|
|
1044
|
-
),
|
|
1044
|
+
), p = () => {
|
|
1045
1045
|
l.dispose(), r.dispose(), s.dispose(), o.dispose(), c.dispose();
|
|
1046
1046
|
}, _ = ye(t);
|
|
1047
1047
|
return {
|
|
1048
1048
|
render: h,
|
|
1049
|
-
dispose:
|
|
1049
|
+
dispose: p,
|
|
1050
1050
|
..._
|
|
1051
1051
|
};
|
|
1052
1052
|
}, Un = ({ gl: e, programs: t }, {
|
|
@@ -1058,10 +1058,10 @@ const Ni = (e, t = {}) => {
|
|
|
1058
1058
|
const o = (f = !1) => {
|
|
1059
1059
|
const l = t.get({
|
|
1060
1060
|
vertexSource: Sn,
|
|
1061
|
-
fragmentSource: f ? _e :
|
|
1061
|
+
fragmentSource: f ? _e : bn
|
|
1062
1062
|
}), h = Float32Array.BYTES_PER_ELEMENT, u = Int32Array.BYTES_PER_ELEMENT, d = l.attribute3i("previous", n, {
|
|
1063
1063
|
stride: u * 3
|
|
1064
|
-
}),
|
|
1064
|
+
}), p = l.attribute3i("current", n, {
|
|
1065
1065
|
stride: u * 3,
|
|
1066
1066
|
offset: u * 3 * 4
|
|
1067
1067
|
}), _ = l.attribute3i("next", n, {
|
|
@@ -1072,7 +1072,7 @@ const Ni = (e, t = {}) => {
|
|
|
1072
1072
|
}), x = l.attribute1f("distance", s, {
|
|
1073
1073
|
stride: h,
|
|
1074
1074
|
offset: h * 1 * 4
|
|
1075
|
-
}), A = l.uniformMatrix4f("projection"),
|
|
1075
|
+
}), A = l.uniformMatrix4f("projection"), M = l.uniformMatrix4f("model_view"), v = l.uniform3i("camera"), m = l.uniform2f("screen"), T = l.uniform4f("color"), R = l.uniform1f("width"), y = l.uniform1f("max_width_pixels"), g = l.uniform1f("min_width_pixels"), w = l.uniform1i("index"), b = l.uniform1i("dash"), S = l.uniform1f("dash_size"), U = l.uniform1f("dash_offset");
|
|
1076
1076
|
return { execute: ({
|
|
1077
1077
|
projection: N,
|
|
1078
1078
|
modelView: I,
|
|
@@ -1088,7 +1088,7 @@ const Ni = (e, t = {}) => {
|
|
|
1088
1088
|
dashSize: et,
|
|
1089
1089
|
dashOffset: O
|
|
1090
1090
|
}) => {
|
|
1091
|
-
B !== 0 && (l.use(), d.use(),
|
|
1091
|
+
B !== 0 && (l.use(), d.use(), p.use(), _.use(), E.use(), x.use(), A.set(N), M.set(I), v.set(X), m.set(C), T.set(W), R.set(H), g.set(J), y.set(k), w.set(G), S.set(et), U.set(O), e.activeTexture(e.TEXTURE0), b.set(0), Je.use(), i.use(), e.drawElements(e.TRIANGLES, B, e.UNSIGNED_SHORT, 0));
|
|
1092
1092
|
} };
|
|
1093
1093
|
}, c = o(), a = o(!0);
|
|
1094
1094
|
return { renderProgram: c, depthProgram: a };
|
|
@@ -1151,24 +1151,25 @@ const Ii = (e, t = {}) => {
|
|
|
1151
1151
|
indexBuffer: s,
|
|
1152
1152
|
normalBuffer: o
|
|
1153
1153
|
}), f = ({
|
|
1154
|
-
viewport: { projection: d, modelView:
|
|
1154
|
+
viewport: { projection: d, modelView: p, camera: _, screen: E },
|
|
1155
1155
|
depth: x = !1,
|
|
1156
1156
|
index: A = 0
|
|
1157
1157
|
}) => {
|
|
1158
|
-
const
|
|
1158
|
+
const M = t.position?.() ?? [0, 0, 0], v = t.orientation?.() ?? [0, 0, 0, 1], m = t.color?.() ?? [1, 1, 1, 1], T = t.diffuse?.() ?? [0, 0, 0, 0], R = t.size?.() ?? 1, y = t.minSizePixels?.() ?? 0, g = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
1159
1159
|
if (l(), Ee(n, x, t))
|
|
1160
1160
|
return;
|
|
1161
|
+
const w = ([S = 0, U = 0, P = 0, N = 0]) => [-S, U, P, N];
|
|
1161
1162
|
(x ? a : c).execute({
|
|
1162
1163
|
projection: d,
|
|
1163
|
-
modelView:
|
|
1164
|
+
modelView: p,
|
|
1164
1165
|
camera: q(_),
|
|
1165
1166
|
screen: E,
|
|
1166
1167
|
count: i,
|
|
1167
|
-
position: q(z(
|
|
1168
|
-
orientation: Ke(he(),
|
|
1168
|
+
position: q(z(M)),
|
|
1169
|
+
orientation: Ke(he(), w(v)),
|
|
1169
1170
|
color: m,
|
|
1170
|
-
diffuse:
|
|
1171
|
-
size:
|
|
1171
|
+
diffuse: T,
|
|
1172
|
+
size: R,
|
|
1172
1173
|
minSizePixels: y,
|
|
1173
1174
|
maxSizePixels: g,
|
|
1174
1175
|
index: A
|
|
@@ -1176,9 +1177,9 @@ const Ii = (e, t = {}) => {
|
|
|
1176
1177
|
}, l = ce(
|
|
1177
1178
|
() => t.mesh?.(),
|
|
1178
1179
|
(d) => {
|
|
1179
|
-
const { vertices:
|
|
1180
|
-
r.set(
|
|
1181
|
-
E.length === 0 ?
|
|
1180
|
+
const { vertices: p = [], indices: _ = [], normals: E = [] } = d ?? {};
|
|
1181
|
+
r.set(p.flatMap((x) => [...x])), s.set(_.flatMap((x) => [...x])), o.set(
|
|
1182
|
+
E.length === 0 ? p.flatMap(() => [0, 0, 0]) : E.flatMap((x) => [...x])
|
|
1182
1183
|
), i = _.length * 3;
|
|
1183
1184
|
}
|
|
1184
1185
|
), h = () => {
|
|
@@ -1198,11 +1199,11 @@ const Ii = (e, t = {}) => {
|
|
|
1198
1199
|
const f = t.get({
|
|
1199
1200
|
vertexSource: zn,
|
|
1200
1201
|
fragmentSource: a ? _e : Pn
|
|
1201
|
-
}), l = f.attribute3f("vertex", n), h = f.attribute3f("normal", r), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"),
|
|
1202
|
+
}), l = f.attribute3f("vertex", n), h = f.attribute3f("normal", r), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), p = f.uniform3i("camera"), _ = f.uniform3i("position"), E = f.uniformMatrix4f("orientation"), x = f.uniform2f("screen"), A = f.uniform4f("color"), M = f.uniform4f("diffuse"), v = f.uniform1f("size"), m = f.uniform1f("min_size_pixels"), T = f.uniform1f("max_size_pixels"), R = f.uniform1i("index");
|
|
1202
1203
|
return { execute: ({
|
|
1203
1204
|
projection: g,
|
|
1204
|
-
modelView:
|
|
1205
|
-
camera:
|
|
1205
|
+
modelView: w,
|
|
1206
|
+
camera: b,
|
|
1206
1207
|
screen: S,
|
|
1207
1208
|
count: U,
|
|
1208
1209
|
position: P,
|
|
@@ -1214,7 +1215,7 @@ const Ii = (e, t = {}) => {
|
|
|
1214
1215
|
maxSizePixels: W,
|
|
1215
1216
|
index: H
|
|
1216
1217
|
}) => {
|
|
1217
|
-
f.use(), l.use(), h.use(), u.set(g), d.set(
|
|
1218
|
+
f.use(), l.use(), h.use(), u.set(g), d.set(w), p.set(b), x.set(S), _.set(P), E.set(N), A.set(I), M.set(X), v.set(C), m.set(B), T.set(W), R.set(H), i.use(), e.drawElements(e.TRIANGLES, U, e.UNSIGNED_SHORT, 0);
|
|
1218
1219
|
} };
|
|
1219
1220
|
}, o = s(), c = s(!0);
|
|
1220
1221
|
return { renderProgram: o, depthProgram: c };
|
|
@@ -1271,21 +1272,21 @@ var Tt = function(e, t, n, i, r) {
|
|
|
1271
1272
|
if (D(r, s, o) >= 0)
|
|
1272
1273
|
return !1;
|
|
1273
1274
|
const c = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, a = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, f = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, l = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y, h = Ge(c, a, t, n, i), u = Ge(f, l, t, n, i);
|
|
1274
|
-
let { prevZ: d, nextZ:
|
|
1275
|
-
for (; d !== null &&
|
|
1276
|
-
if (d !== e.prev && d !== e.next && me(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && D(d.prev, d, d.next) >= 0 || (d = d.prevZ,
|
|
1275
|
+
let { prevZ: d, nextZ: p } = e;
|
|
1276
|
+
for (; d !== null && p !== null && d.z >= h && p.z <= u; ) {
|
|
1277
|
+
if (d !== e.prev && d !== e.next && me(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && D(d.prev, d, d.next) >= 0 || (d = d.prevZ, p !== e.prev && p !== e.next && me(r.x, r.y, s.x, s.y, o.x, o.y, p.x, p.y) && D(p.prev, p, p.next) >= 0))
|
|
1277
1278
|
return !1;
|
|
1278
|
-
|
|
1279
|
+
p = p.nextZ;
|
|
1279
1280
|
}
|
|
1280
1281
|
for (; d !== null && d.z >= h; ) {
|
|
1281
1282
|
if (d !== e.prev && d !== e.next && me(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && D(d.prev, d, d.next) >= 0)
|
|
1282
1283
|
return !1;
|
|
1283
1284
|
d = d.prevZ;
|
|
1284
1285
|
}
|
|
1285
|
-
for (;
|
|
1286
|
-
if (
|
|
1286
|
+
for (; p !== null && p.z <= u; ) {
|
|
1287
|
+
if (p !== e.prev && p !== e.next && me(r.x, r.y, s.x, s.y, o.x, o.y, p.x, p.y) && D(p.prev, p, p.next) >= 0)
|
|
1287
1288
|
return !1;
|
|
1288
|
-
|
|
1289
|
+
p = p.nextZ;
|
|
1289
1290
|
}
|
|
1290
1291
|
return !0;
|
|
1291
1292
|
}, Dn = function(e, t, n) {
|
|
@@ -1450,8 +1451,8 @@ function Gn(e, t = [], n = 2) {
|
|
|
1450
1451
|
let c = 1 / 0, a = 1 / 0, f = -1 / 0, l = -1 / 0, h = 0, u, d;
|
|
1451
1452
|
if (i && (s = Cn(e, t, s, n)), e.length > 80 * n) {
|
|
1452
1453
|
c = f = e[0], a = l = e[1];
|
|
1453
|
-
for (let
|
|
1454
|
-
u = e[
|
|
1454
|
+
for (let p = n; p < r; p += n)
|
|
1455
|
+
u = e[p], d = e[p + 1], u < c && (c = u), d < a && (a = d), u > f && (f = u), d > l && (l = d);
|
|
1455
1456
|
h = Math.max(f - c, l - a), h = h !== 0 ? 1 / h : 0;
|
|
1456
1457
|
}
|
|
1457
1458
|
return ge(s, o, n, c, a, h, 0), o;
|
|
@@ -1586,7 +1587,7 @@ const Di = (e, t = {}) => {
|
|
|
1586
1587
|
positionBuffer: r,
|
|
1587
1588
|
indexBuffer: s
|
|
1588
1589
|
}), a = ({
|
|
1589
|
-
viewport: { projection: u, modelView: d, camera:
|
|
1590
|
+
viewport: { projection: u, modelView: d, camera: p, screen: _ },
|
|
1590
1591
|
depth: E = !1,
|
|
1591
1592
|
index: x = 0
|
|
1592
1593
|
}) => {
|
|
@@ -1596,7 +1597,7 @@ const Di = (e, t = {}) => {
|
|
|
1596
1597
|
(E ? c : o).execute({
|
|
1597
1598
|
projection: u,
|
|
1598
1599
|
modelView: d,
|
|
1599
|
-
camera: q(
|
|
1600
|
+
camera: q(p),
|
|
1600
1601
|
screen: _,
|
|
1601
1602
|
count: i,
|
|
1602
1603
|
color: A,
|
|
@@ -1605,8 +1606,8 @@ const Di = (e, t = {}) => {
|
|
|
1605
1606
|
}, f = ce(
|
|
1606
1607
|
() => t.points?.() ?? [],
|
|
1607
1608
|
(u) => {
|
|
1608
|
-
const { vertices: d, indices:
|
|
1609
|
-
r.set(d), s.set(
|
|
1609
|
+
const { vertices: d, indices: p } = u.length > 0 ? Fn(u.map((_) => _.map((E) => [...q(z(E))]))) : { vertices: [], indices: [] };
|
|
1610
|
+
r.set(d), s.set(p), i = p.length;
|
|
1610
1611
|
}
|
|
1611
1612
|
), l = () => {
|
|
1612
1613
|
r.dispose(), s.dispose();
|
|
@@ -1626,17 +1627,17 @@ const Di = (e, t = {}) => {
|
|
|
1626
1627
|
fragmentSource: c ? _e : Jn
|
|
1627
1628
|
}), f = a.attribute3i("position", n, {
|
|
1628
1629
|
stride: 3 * Int32Array.BYTES_PER_ELEMENT
|
|
1629
|
-
}), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform3i("camera"), d = a.uniform2f("screen"),
|
|
1630
|
+
}), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform3i("camera"), d = a.uniform2f("screen"), p = a.uniform4f("color"), _ = a.uniform1i("index");
|
|
1630
1631
|
return { execute: ({
|
|
1631
1632
|
projection: x,
|
|
1632
1633
|
modelView: A,
|
|
1633
|
-
camera:
|
|
1634
|
-
screen:
|
|
1634
|
+
camera: M,
|
|
1635
|
+
screen: v,
|
|
1635
1636
|
count: m,
|
|
1636
|
-
color:
|
|
1637
|
-
index:
|
|
1637
|
+
color: T,
|
|
1638
|
+
index: R
|
|
1638
1639
|
}) => {
|
|
1639
|
-
m !== 0 && (a.use(), f.use(), l.set(x), h.set(A), u.set(
|
|
1640
|
+
m !== 0 && (a.use(), f.use(), l.set(x), h.set(A), u.set(M), d.set(v), p.set(T), _.set(R), i.use(), e.drawElements(e.TRIANGLES, m, e.UNSIGNED_SHORT, 0));
|
|
1640
1641
|
} };
|
|
1641
1642
|
}, s = r(), o = r(!0);
|
|
1642
1643
|
return { renderProgram: s, depthProgram: o };
|
|
@@ -1707,22 +1708,22 @@ const Oi = (e, t = {}) => {
|
|
|
1707
1708
|
uvBuffer: r,
|
|
1708
1709
|
indexBuffer: s
|
|
1709
1710
|
}), f = ({
|
|
1710
|
-
viewport: { projection: u, modelView: d, camera:
|
|
1711
|
+
viewport: { projection: u, modelView: d, camera: p, screen: _ },
|
|
1711
1712
|
depth: E = !1,
|
|
1712
1713
|
index: x = 0
|
|
1713
1714
|
}) => {
|
|
1714
|
-
const A = t.position?.() ?? [0, 0, 0],
|
|
1715
|
+
const A = t.position?.() ?? [0, 0, 0], M = t.orientation?.() ?? [0, 0, 0, 1], v = t.range?.() ?? 1e3;
|
|
1715
1716
|
if (o(), Ee(n, E, t))
|
|
1716
1717
|
return;
|
|
1717
1718
|
(E ? a : c).execute({
|
|
1718
1719
|
projection: u,
|
|
1719
1720
|
modelView: d,
|
|
1720
|
-
camera: q(
|
|
1721
|
+
camera: q(p),
|
|
1721
1722
|
screen: _,
|
|
1722
1723
|
image: i,
|
|
1723
|
-
range:
|
|
1724
|
+
range: v,
|
|
1724
1725
|
position: q(z(A)),
|
|
1725
|
-
orientation: Ke(he(),
|
|
1726
|
+
orientation: Ke(he(), M),
|
|
1726
1727
|
index: x
|
|
1727
1728
|
});
|
|
1728
1729
|
}, l = () => {
|
|
@@ -1743,19 +1744,19 @@ const Oi = (e, t = {}) => {
|
|
|
1743
1744
|
fragmentSource: c ? _e : ni
|
|
1744
1745
|
}), f = a.attribute2f("uv", n, {
|
|
1745
1746
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
1746
|
-
}), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform3i("camera"), d = a.uniform2f("screen"),
|
|
1747
|
+
}), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform3i("camera"), d = a.uniform2f("screen"), p = a.uniform1i("image"), _ = a.uniform1f("range"), E = a.uniform3i("position"), x = a.uniformMatrix4f("orientation"), A = a.uniform1i("index");
|
|
1747
1748
|
return { execute: ({
|
|
1748
|
-
projection:
|
|
1749
|
+
projection: v,
|
|
1749
1750
|
modelView: m,
|
|
1750
|
-
camera:
|
|
1751
|
-
screen:
|
|
1751
|
+
camera: T,
|
|
1752
|
+
screen: R,
|
|
1752
1753
|
image: y,
|
|
1753
1754
|
range: g,
|
|
1754
|
-
position:
|
|
1755
|
-
orientation:
|
|
1755
|
+
position: w,
|
|
1756
|
+
orientation: b,
|
|
1756
1757
|
index: S
|
|
1757
1758
|
}) => {
|
|
1758
|
-
a.use(), f.use(), l.set(
|
|
1759
|
+
a.use(), f.use(), l.set(v), h.set(m), u.set(T), d.set(R), _.set(g), E.set(w), x.set(b), A.set(S), e.activeTexture(e.TEXTURE0), p.set(0), y.use(), i.use(), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0);
|
|
1759
1760
|
} };
|
|
1760
1761
|
}, s = r(), o = r(!0);
|
|
1761
1762
|
return { renderProgram: s, depthProgram: o };
|
|
@@ -1815,27 +1816,27 @@ if (typeof We > "u") {
|
|
|
1815
1816
|
e && (e = !1, At("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
1816
1817
|
};
|
|
1817
1818
|
}
|
|
1818
|
-
const oi = (e) => !Rt.has(e), ee = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e),
|
|
1819
|
+
const oi = (e) => !Rt.has(e), ee = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e), Mt = (e) => ee(e) ? e <= Math.pow(2, 8) ? Uint8Array : e <= Math.pow(2, 16) ? Uint16Array : e <= Math.pow(2, 32) ? Uint32Array : e <= Number.MAX_SAFE_INTEGER ? Oe : null : null;
|
|
1819
1820
|
class Oe extends Array {
|
|
1820
1821
|
constructor(t) {
|
|
1821
1822
|
super(t), this.fill(0);
|
|
1822
1823
|
}
|
|
1823
1824
|
}
|
|
1824
|
-
class
|
|
1825
|
+
class pe {
|
|
1825
1826
|
heap;
|
|
1826
1827
|
length;
|
|
1827
1828
|
// private constructor
|
|
1828
1829
|
static #c = !1;
|
|
1829
1830
|
static create(t) {
|
|
1830
|
-
const n =
|
|
1831
|
+
const n = Mt(t);
|
|
1831
1832
|
if (!n)
|
|
1832
1833
|
return [];
|
|
1833
|
-
|
|
1834
|
-
const i = new
|
|
1835
|
-
return
|
|
1834
|
+
pe.#c = !0;
|
|
1835
|
+
const i = new pe(t, n);
|
|
1836
|
+
return pe.#c = !1, i;
|
|
1836
1837
|
}
|
|
1837
1838
|
constructor(t, n) {
|
|
1838
|
-
if (!
|
|
1839
|
+
if (!pe.#c)
|
|
1839
1840
|
throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
1840
1841
|
this.heap = new n(t), this.length = 0;
|
|
1841
1842
|
}
|
|
@@ -1852,8 +1853,8 @@ class qe {
|
|
|
1852
1853
|
// set defaults for various methods.
|
|
1853
1854
|
#c;
|
|
1854
1855
|
#u;
|
|
1855
|
-
#v;
|
|
1856
1856
|
#p;
|
|
1857
|
+
#v;
|
|
1857
1858
|
#U;
|
|
1858
1859
|
/**
|
|
1859
1860
|
* {@link LRUCache.OptionsBase.ttl}
|
|
@@ -2004,22 +2005,22 @@ class qe {
|
|
|
2004
2005
|
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
|
2005
2006
|
*/
|
|
2006
2007
|
get dispose() {
|
|
2007
|
-
return this.#
|
|
2008
|
+
return this.#p;
|
|
2008
2009
|
}
|
|
2009
2010
|
/**
|
|
2010
2011
|
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
2011
2012
|
*/
|
|
2012
2013
|
get disposeAfter() {
|
|
2013
|
-
return this.#
|
|
2014
|
+
return this.#v;
|
|
2014
2015
|
}
|
|
2015
2016
|
constructor(t) {
|
|
2016
|
-
const { max: n = 0, ttl: i, ttlResolution: r = 1, ttlAutopurge: s, updateAgeOnGet: o, updateAgeOnHas: c, allowStale: a, dispose: f, disposeAfter: l, noDisposeOnSet: h, noUpdateTTL: u, maxSize: d = 0, maxEntrySize:
|
|
2017
|
+
const { max: n = 0, ttl: i, ttlResolution: r = 1, ttlAutopurge: s, updateAgeOnGet: o, updateAgeOnHas: c, allowStale: a, dispose: f, disposeAfter: l, noDisposeOnSet: h, noUpdateTTL: u, maxSize: d = 0, maxEntrySize: p = 0, sizeCalculation: _, fetchMethod: E, noDeleteOnFetchRejection: x, noDeleteOnStaleGet: A, allowStaleOnFetchRejection: M, allowStaleOnFetchAbort: v, ignoreFetchAbort: m } = t;
|
|
2017
2018
|
if (n !== 0 && !ee(n))
|
|
2018
2019
|
throw new TypeError("max option must be a nonnegative integer");
|
|
2019
|
-
const
|
|
2020
|
-
if (!
|
|
2020
|
+
const T = n ? Mt(n) : Array;
|
|
2021
|
+
if (!T)
|
|
2021
2022
|
throw new Error("invalid max value: " + n);
|
|
2022
|
-
if (this.#c = n, this.#u = d, this.maxEntrySize =
|
|
2023
|
+
if (this.#c = n, this.#u = d, this.maxEntrySize = p || this.#u, this.sizeCalculation = _, this.sizeCalculation) {
|
|
2023
2024
|
if (!this.#u && !this.maxEntrySize)
|
|
2024
2025
|
throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
2025
2026
|
if (typeof this.sizeCalculation != "function")
|
|
@@ -2027,7 +2028,7 @@ class qe {
|
|
|
2027
2028
|
}
|
|
2028
2029
|
if (E !== void 0 && typeof E != "function")
|
|
2029
2030
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
2030
|
-
if (this.#U = E, this.#A = !!E, this.#i = /* @__PURE__ */ new Map(), this.#n = new Array(n).fill(void 0), this.#e = new Array(n).fill(void 0), this.#f = new
|
|
2031
|
+
if (this.#U = E, this.#A = !!E, this.#i = /* @__PURE__ */ new Map(), this.#n = new Array(n).fill(void 0), this.#e = new Array(n).fill(void 0), this.#f = new T(n), this.#h = new T(n), this.#a = 0, this.#s = 0, this.#E = pe.create(n), this.#r = 0, this.#x = 0, typeof f == "function" && (this.#p = f), typeof l == "function" ? (this.#v = l, this.#o = []) : (this.#v = void 0, this.#o = void 0), this.#T = !!this.#p, this.#l = !!this.#v, this.noDisposeOnSet = !!h, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!x, this.allowStaleOnFetchRejection = !!M, this.allowStaleOnFetchAbort = !!v, this.ignoreFetchAbort = !!m, this.maxEntrySize !== 0) {
|
|
2031
2032
|
if (this.#u !== 0 && !ee(this.#u))
|
|
2032
2033
|
throw new TypeError("maxSize must be a positive integer if specified");
|
|
2033
2034
|
if (!ee(this.maxEntrySize))
|
|
@@ -2042,8 +2043,8 @@ class qe {
|
|
|
2042
2043
|
if (this.#c === 0 && this.ttl === 0 && this.#u === 0)
|
|
2043
2044
|
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
2044
2045
|
if (!this.ttlAutopurge && !this.#c && !this.#u) {
|
|
2045
|
-
const
|
|
2046
|
-
oi(
|
|
2046
|
+
const R = "LRU_CACHE_UNBOUNDED";
|
|
2047
|
+
oi(R) && (Rt.add(R), At("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", R, qe));
|
|
2047
2048
|
}
|
|
2048
2049
|
}
|
|
2049
2050
|
/**
|
|
@@ -2061,7 +2062,7 @@ class qe {
|
|
|
2061
2062
|
}, o + 1);
|
|
2062
2063
|
a.unref && a.unref();
|
|
2063
2064
|
}
|
|
2064
|
-
}, this.#
|
|
2065
|
+
}, this.#M = (s) => {
|
|
2065
2066
|
n[s] = t[s] !== 0 ? ue.now() : 0;
|
|
2066
2067
|
}, this.#R = (s, o) => {
|
|
2067
2068
|
if (t[o]) {
|
|
@@ -2098,7 +2099,7 @@ class qe {
|
|
|
2098
2099
|
};
|
|
2099
2100
|
}
|
|
2100
2101
|
// conditionally set private methods related to TTL
|
|
2101
|
-
#
|
|
2102
|
+
#M = () => {
|
|
2102
2103
|
};
|
|
2103
2104
|
#R = () => {
|
|
2104
2105
|
};
|
|
@@ -2108,7 +2109,7 @@ class qe {
|
|
|
2108
2109
|
#m = () => !1;
|
|
2109
2110
|
#X() {
|
|
2110
2111
|
const t = new Oe(this.#c);
|
|
2111
|
-
this.#x = 0, this.#_ = t, this.#
|
|
2112
|
+
this.#x = 0, this.#_ = t, this.#b = (n) => {
|
|
2112
2113
|
this.#x -= t[n], t[n] = 0;
|
|
2113
2114
|
}, this.#D = (n, i, r, s) => {
|
|
2114
2115
|
if (this.#t(i))
|
|
@@ -2131,7 +2132,7 @@ class qe {
|
|
|
2131
2132
|
this.#x += t[n], r && (r.entrySize = i, r.totalCalculatedSize = this.#x);
|
|
2132
2133
|
};
|
|
2133
2134
|
}
|
|
2134
|
-
#
|
|
2135
|
+
#b = (t) => {
|
|
2135
2136
|
};
|
|
2136
2137
|
#P = (t, n, i) => {
|
|
2137
2138
|
};
|
|
@@ -2348,10 +2349,10 @@ class qe {
|
|
|
2348
2349
|
if (this.#A && this.#t(u)) {
|
|
2349
2350
|
u.__abortController.abort(new Error("replaced"));
|
|
2350
2351
|
const { __staleWhileFetching: d } = u;
|
|
2351
|
-
d !== void 0 && !o && (this.#T && this.#
|
|
2352
|
+
d !== void 0 && !o && (this.#T && this.#p?.(d, t, "set"), this.#l && this.#o?.push([d, t, "set"]));
|
|
2352
2353
|
} else
|
|
2353
|
-
o || (this.#T && this.#
|
|
2354
|
-
if (this.#
|
|
2354
|
+
o || (this.#T && this.#p?.(u, t, "set"), this.#l && this.#o?.push([u, t, "set"]));
|
|
2355
|
+
if (this.#b(h), this.#P(h, l, a), this.#e[h] = n, a) {
|
|
2355
2356
|
a.set = "replace";
|
|
2356
2357
|
const d = u && this.#t(u) ? u.__staleWhileFetching : u;
|
|
2357
2358
|
d !== void 0 && (a.oldValue = d);
|
|
@@ -2363,7 +2364,7 @@ class qe {
|
|
|
2363
2364
|
const u = this.#o;
|
|
2364
2365
|
let d;
|
|
2365
2366
|
for (; d = u?.shift(); )
|
|
2366
|
-
this.#
|
|
2367
|
+
this.#v?.(...d);
|
|
2367
2368
|
}
|
|
2368
2369
|
return this;
|
|
2369
2370
|
}
|
|
@@ -2386,13 +2387,13 @@ class qe {
|
|
|
2386
2387
|
const t = this.#o;
|
|
2387
2388
|
let n;
|
|
2388
2389
|
for (; n = t?.shift(); )
|
|
2389
|
-
this.#
|
|
2390
|
+
this.#v?.(...n);
|
|
2390
2391
|
}
|
|
2391
2392
|
}
|
|
2392
2393
|
}
|
|
2393
2394
|
#z(t) {
|
|
2394
2395
|
const n = this.#a, i = this.#n[n], r = this.#e[n];
|
|
2395
|
-
return this.#A && this.#t(r) ? r.__abortController.abort(new Error("evicted")) : (this.#T || this.#l) && (this.#T && this.#
|
|
2396
|
+
return this.#A && this.#t(r) ? r.__abortController.abort(new Error("evicted")) : (this.#T || this.#l) && (this.#T && this.#p?.(r, i, "evict"), this.#l && this.#o?.push([r, i, "evict"])), this.#b(n), t && (this.#n[n] = void 0, this.#e[n] = void 0, this.#E.push(n)), this.#r === 1 ? (this.#a = this.#s = 0, this.#E.length = 0) : this.#a = this.#f[n], this.#i.delete(i), this.#r--, n;
|
|
2396
2397
|
}
|
|
2397
2398
|
/**
|
|
2398
2399
|
* Check if a key is in the cache, without updating the recency of use.
|
|
@@ -2411,7 +2412,7 @@ class qe {
|
|
|
2411
2412
|
if (this.#m(s))
|
|
2412
2413
|
r && (r.has = "stale", this.#R(r, s));
|
|
2413
2414
|
else
|
|
2414
|
-
return i && this.#
|
|
2415
|
+
return i && this.#M(s), r && (r.has = "hit", this.#R(r, s)), !0;
|
|
2415
2416
|
} else
|
|
2416
2417
|
r && (r.has = "miss");
|
|
2417
2418
|
return !1;
|
|
@@ -2446,13 +2447,13 @@ class qe {
|
|
|
2446
2447
|
const { aborted: x } = o.signal, A = i.ignoreFetchAbort && _ !== void 0;
|
|
2447
2448
|
if (i.status && (x && !E ? (i.status.fetchAborted = !0, i.status.fetchError = o.signal.reason, A && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), x && !A && !E)
|
|
2448
2449
|
return h(o.signal.reason);
|
|
2449
|
-
const
|
|
2450
|
-
return this.#e[n] === d && (_ === void 0 ?
|
|
2450
|
+
const M = d;
|
|
2451
|
+
return this.#e[n] === d && (_ === void 0 ? M.__staleWhileFetching ? this.#e[n] = M.__staleWhileFetching : this.delete(t) : (i.status && (i.status.fetchUpdated = !0), this.set(t, _, a.options))), _;
|
|
2451
2452
|
}, l = (_) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = _), h(_)), h = (_) => {
|
|
2452
|
-
const { aborted: E } = o.signal, x = E && i.allowStaleOnFetchAbort, A = x || i.allowStaleOnFetchRejection,
|
|
2453
|
-
if (this.#e[n] === d && (!
|
|
2454
|
-
return i.status &&
|
|
2455
|
-
if (
|
|
2453
|
+
const { aborted: E } = o.signal, x = E && i.allowStaleOnFetchAbort, A = x || i.allowStaleOnFetchRejection, M = A || i.noDeleteOnFetchRejection, v = d;
|
|
2454
|
+
if (this.#e[n] === d && (!M || v.__staleWhileFetching === void 0 ? this.delete(t) : x || (this.#e[n] = v.__staleWhileFetching)), A)
|
|
2455
|
+
return i.status && v.__staleWhileFetching !== void 0 && (i.status.returnedStale = !0), v.__staleWhileFetching;
|
|
2456
|
+
if (v.__returned === v)
|
|
2456
2457
|
throw _;
|
|
2457
2458
|
}, u = (_, E) => {
|
|
2458
2459
|
const x = this.#U?.(t, s, a);
|
|
@@ -2461,12 +2462,12 @@ class qe {
|
|
|
2461
2462
|
});
|
|
2462
2463
|
};
|
|
2463
2464
|
i.status && (i.status.fetchDispatched = !0);
|
|
2464
|
-
const d = new Promise(u).then(f, l),
|
|
2465
|
+
const d = new Promise(u).then(f, l), p = Object.assign(d, {
|
|
2465
2466
|
__abortController: o,
|
|
2466
2467
|
__staleWhileFetching: s,
|
|
2467
2468
|
__returned: void 0
|
|
2468
2469
|
});
|
|
2469
|
-
return n === void 0 ? (this.set(t,
|
|
2470
|
+
return n === void 0 ? (this.set(t, p, { ...a.options, status: void 0 }), n = this.#i.get(t)) : this.#e[n] = p, p;
|
|
2470
2471
|
}
|
|
2471
2472
|
#t(t) {
|
|
2472
2473
|
if (!this.#A)
|
|
@@ -2490,7 +2491,7 @@ class qe {
|
|
|
2490
2491
|
noDeleteOnFetchRejection: h = this.noDeleteOnFetchRejection,
|
|
2491
2492
|
allowStaleOnFetchRejection: u = this.allowStaleOnFetchRejection,
|
|
2492
2493
|
ignoreFetchAbort: d = this.ignoreFetchAbort,
|
|
2493
|
-
allowStaleOnFetchAbort:
|
|
2494
|
+
allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort,
|
|
2494
2495
|
context: _,
|
|
2495
2496
|
forceRefresh: E = !1,
|
|
2496
2497
|
status: x,
|
|
@@ -2503,7 +2504,7 @@ class qe {
|
|
|
2503
2504
|
noDeleteOnStaleGet: s,
|
|
2504
2505
|
status: x
|
|
2505
2506
|
});
|
|
2506
|
-
const
|
|
2507
|
+
const M = {
|
|
2507
2508
|
allowStale: i,
|
|
2508
2509
|
updateAgeOnGet: r,
|
|
2509
2510
|
noDeleteOnStaleGet: s,
|
|
@@ -2514,27 +2515,27 @@ class qe {
|
|
|
2514
2515
|
noUpdateTTL: l,
|
|
2515
2516
|
noDeleteOnFetchRejection: h,
|
|
2516
2517
|
allowStaleOnFetchRejection: u,
|
|
2517
|
-
allowStaleOnFetchAbort:
|
|
2518
|
+
allowStaleOnFetchAbort: p,
|
|
2518
2519
|
ignoreFetchAbort: d,
|
|
2519
2520
|
status: x,
|
|
2520
2521
|
signal: A
|
|
2521
2522
|
};
|
|
2522
|
-
let
|
|
2523
|
-
if (
|
|
2523
|
+
let v = this.#i.get(t);
|
|
2524
|
+
if (v === void 0) {
|
|
2524
2525
|
x && (x.fetch = "miss");
|
|
2525
|
-
const m = this.#L(t,
|
|
2526
|
+
const m = this.#L(t, v, M, _);
|
|
2526
2527
|
return m.__returned = m;
|
|
2527
2528
|
} else {
|
|
2528
|
-
const m = this.#e[
|
|
2529
|
+
const m = this.#e[v];
|
|
2529
2530
|
if (this.#t(m)) {
|
|
2530
|
-
const
|
|
2531
|
-
return x && (x.fetch = "inflight",
|
|
2531
|
+
const w = i && m.__staleWhileFetching !== void 0;
|
|
2532
|
+
return x && (x.fetch = "inflight", w && (x.returnedStale = !0)), w ? m.__staleWhileFetching : m.__returned = m;
|
|
2532
2533
|
}
|
|
2533
|
-
const
|
|
2534
|
-
if (!E && !
|
|
2535
|
-
return x && (x.fetch = "hit"), this.#S(
|
|
2536
|
-
const
|
|
2537
|
-
return x && (x.fetch =
|
|
2534
|
+
const T = this.#m(v);
|
|
2535
|
+
if (!E && !T)
|
|
2536
|
+
return x && (x.fetch = "hit"), this.#S(v), r && this.#M(v), x && this.#R(x, v), m;
|
|
2537
|
+
const R = this.#L(t, v, M, _), g = R.__staleWhileFetching !== void 0 && i;
|
|
2538
|
+
return x && (x.fetch = T ? "stale" : "refresh", g && T && (x.returnedStale = !0)), g ? R.__staleWhileFetching : R.__returned = R;
|
|
2538
2539
|
}
|
|
2539
2540
|
}
|
|
2540
2541
|
/**
|
|
@@ -2547,7 +2548,7 @@ class qe {
|
|
|
2547
2548
|
const { allowStale: i = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: s = this.noDeleteOnStaleGet, status: o } = n, c = this.#i.get(t);
|
|
2548
2549
|
if (c !== void 0) {
|
|
2549
2550
|
const a = this.#e[c], f = this.#t(a);
|
|
2550
|
-
return o && this.#R(o, c), this.#m(c) ? (o && (o.get = "stale"), f ? (o && i && a.__staleWhileFetching !== void 0 && (o.returnedStale = !0), i ? a.__staleWhileFetching : void 0) : (s || this.delete(t), o && i && (o.returnedStale = !0), i ? a : void 0)) : (o && (o.get = "hit"), f ? a.__staleWhileFetching : (this.#S(c), r && this.#
|
|
2551
|
+
return o && this.#R(o, c), this.#m(c) ? (o && (o.get = "stale"), f ? (o && i && a.__staleWhileFetching !== void 0 && (o.returnedStale = !0), i ? a.__staleWhileFetching : void 0) : (s || this.delete(t), o && i && (o.returnedStale = !0), i ? a : void 0)) : (o && (o.get = "hit"), f ? a.__staleWhileFetching : (this.#S(c), r && this.#M(c), a));
|
|
2551
2552
|
} else
|
|
2552
2553
|
o && (o.get = "miss");
|
|
2553
2554
|
}
|
|
@@ -2569,9 +2570,9 @@ class qe {
|
|
|
2569
2570
|
if (n = !0, this.#r === 1)
|
|
2570
2571
|
this.clear();
|
|
2571
2572
|
else {
|
|
2572
|
-
this.#
|
|
2573
|
+
this.#b(i);
|
|
2573
2574
|
const r = this.#e[i];
|
|
2574
|
-
if (this.#t(r) ? r.__abortController.abort(new Error("deleted")) : (this.#T || this.#l) && (this.#T && this.#
|
|
2575
|
+
if (this.#t(r) ? r.__abortController.abort(new Error("deleted")) : (this.#T || this.#l) && (this.#T && this.#p?.(r, t, "delete"), this.#l && this.#o?.push([r, t, "delete"])), this.#i.delete(t), this.#n[i] = void 0, this.#e[i] = void 0, i === this.#s)
|
|
2575
2576
|
this.#s = this.#h[i];
|
|
2576
2577
|
else if (i === this.#a)
|
|
2577
2578
|
this.#a = this.#f[i];
|
|
@@ -2588,7 +2589,7 @@ class qe {
|
|
|
2588
2589
|
const i = this.#o;
|
|
2589
2590
|
let r;
|
|
2590
2591
|
for (; r = i?.shift(); )
|
|
2591
|
-
this.#
|
|
2592
|
+
this.#v?.(...r);
|
|
2592
2593
|
}
|
|
2593
2594
|
return n;
|
|
2594
2595
|
}
|
|
@@ -2602,14 +2603,14 @@ class qe {
|
|
|
2602
2603
|
n.__abortController.abort(new Error("deleted"));
|
|
2603
2604
|
else {
|
|
2604
2605
|
const i = this.#n[t];
|
|
2605
|
-
this.#T && this.#
|
|
2606
|
+
this.#T && this.#p?.(n, i, "delete"), this.#l && this.#o?.push([n, i, "delete"]);
|
|
2606
2607
|
}
|
|
2607
2608
|
}
|
|
2608
2609
|
if (this.#i.clear(), this.#e.fill(void 0), this.#n.fill(void 0), this.#d && this.#y && (this.#d.fill(0), this.#y.fill(0)), this.#_ && this.#_.fill(0), this.#a = 0, this.#s = 0, this.#E.length = 0, this.#x = 0, this.#r = 0, this.#l && this.#o) {
|
|
2609
2610
|
const t = this.#o;
|
|
2610
2611
|
let n;
|
|
2611
2612
|
for (; n = t?.shift(); )
|
|
2612
|
-
this.#
|
|
2613
|
+
this.#v?.(...n);
|
|
2613
2614
|
}
|
|
2614
2615
|
}
|
|
2615
2616
|
}
|
|
@@ -2644,22 +2645,22 @@ const je = (e) => {
|
|
|
2644
2645
|
const h = i.get([a, f, l]);
|
|
2645
2646
|
if (!h)
|
|
2646
2647
|
return;
|
|
2647
|
-
const { texture: u, downsample: d } = h,
|
|
2648
|
+
const { texture: u, downsample: d } = h, p = 2 ** d, _ = [Math.floor(a / p), Math.floor(f / p), l - d], E = n.get(_);
|
|
2648
2649
|
if (E)
|
|
2649
2650
|
return { buffer: E, downsample: d };
|
|
2650
2651
|
const x = new Uint8Array(4 * ie * ie);
|
|
2651
2652
|
return e.bindFramebuffer(e.FRAMEBUFFER, r), u.attach(), e.readPixels(0, 0, ie, ie, e.RGBA, e.UNSIGNED_BYTE, x), e.bindFramebuffer(e.FRAMEBUFFER, null), n.set(_, x), { buffer: x, downsample: d };
|
|
2652
2653
|
};
|
|
2653
2654
|
return { get: ([a = 0, f = 0], l = ai) => {
|
|
2654
|
-
const h = 2 ** l, u = z([a, f, 0]).map((
|
|
2655
|
-
let [_ = 0, E = 0] = u.map((
|
|
2656
|
-
const x = s([d,
|
|
2655
|
+
const h = 2 ** l, u = z([a, f, 0]).map((w) => w * h), [d = 0, p = 0] = u.map((w) => Math.floor(w % h));
|
|
2656
|
+
let [_ = 0, E = 0] = u.map((w) => w % 1);
|
|
2657
|
+
const x = s([d, p, l]);
|
|
2657
2658
|
if (!x)
|
|
2658
2659
|
return 0;
|
|
2659
|
-
const { buffer: A, downsample:
|
|
2660
|
-
[_, E] = [(d %
|
|
2661
|
-
const m = 4 * ie * Math.floor(E * ie) + 4 * Math.floor(_ * ie), [
|
|
2662
|
-
return (
|
|
2660
|
+
const { buffer: A, downsample: M } = x, v = 2 ** M;
|
|
2661
|
+
[_, E] = [(d % v + _) / v, (p % v + E) / v];
|
|
2662
|
+
const m = 4 * ie * Math.floor(E * ie) + 4 * Math.floor(_ * ie), [T = 0, R = 0, y = 0] = A.slice(m, m + 4);
|
|
2663
|
+
return (T * 65536 + R * 256 + y) / 10 - 1e4;
|
|
2663
2664
|
}, dispose: () => {
|
|
2664
2665
|
e.deleteFramebuffer(r);
|
|
2665
2666
|
} };
|
|
@@ -2701,23 +2702,23 @@ const ut = ({
|
|
|
2701
2702
|
const [l = 0, h = 0, u = 0] = a;
|
|
2702
2703
|
let d = t.replace("{x}", `${l}`).replace("{y}", `${h}`).replace("{z}", `${u}`);
|
|
2703
2704
|
if (d.includes("{bbox}")) {
|
|
2704
|
-
const [_ = 0, E = 0, x = 0] = a, A = 2 ** x - E - 1, [[
|
|
2705
|
+
const [_ = 0, E = 0, x = 0] = a, A = 2 ** x - E - 1, [[M, v] = [], [m, T] = []] = [
|
|
2705
2706
|
[0, 0],
|
|
2706
2707
|
[1, 1]
|
|
2707
|
-
].map(([
|
|
2708
|
-
(
|
|
2708
|
+
].map(([R = 0, y = 0]) => [_ + R, A + y, x]).map((R) => pt(R, R)).map(([R = 0, y = 0]) => [
|
|
2709
|
+
(R - 0.5) * 2 * Math.PI * 6378137,
|
|
2709
2710
|
(y - 0.5) * 2 * Math.PI * 6378137
|
|
2710
2711
|
]);
|
|
2711
|
-
d = d.replace("{bbox}", [
|
|
2712
|
+
d = d.replace("{bbox}", [M, v, m, T].join(","));
|
|
2712
2713
|
}
|
|
2713
|
-
const
|
|
2714
|
+
const p = yt({
|
|
2714
2715
|
gl: e,
|
|
2715
2716
|
url: d,
|
|
2716
2717
|
onLoad: () => {
|
|
2717
2718
|
r.delete(a), n?.();
|
|
2718
2719
|
}
|
|
2719
2720
|
});
|
|
2720
|
-
i.set(a,
|
|
2721
|
+
i.set(a, p), r.set(a, !0);
|
|
2721
2722
|
}
|
|
2722
2723
|
}, o = setInterval(() => r.purgeStale(), 200);
|
|
2723
2724
|
return { get: s, dispose: () => {
|
|
@@ -2737,10 +2738,10 @@ const ut = ({
|
|
|
2737
2738
|
const s = t.get(r);
|
|
2738
2739
|
if (s)
|
|
2739
2740
|
return s;
|
|
2740
|
-
const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0, h = 0]) => [o + l, c + h, a]).map((l) =>
|
|
2741
|
+
const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0, h = 0]) => [o + l, c + h, a]).map((l) => pt(l, l)).map((l) => oe(l, l)).map((l) => {
|
|
2741
2742
|
const [h = 0, u = 0] = l, d = Math.max(a - 5, 0);
|
|
2742
2743
|
return z(
|
|
2743
|
-
|
|
2744
|
+
Me(l, h, u, e.get([h, u], d)),
|
|
2744
2745
|
l
|
|
2745
2746
|
);
|
|
2746
2747
|
});
|
|
@@ -2829,21 +2830,21 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
2829
2830
|
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.NEAREST), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.NEAREST), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE);
|
|
2830
2831
|
}
|
|
2831
2832
|
}), l = Fe(f, 3), h = ci({ gl: n, terrainCache: f }), u = li(h), d = Z({ gl: n, type: "f32", target: "array" });
|
|
2832
|
-
d.set(mi.flatMap(([g = 0,
|
|
2833
|
-
const
|
|
2834
|
-
|
|
2835
|
-
const { renderProgram: _, depthProgram: E } =
|
|
2833
|
+
d.set(mi.flatMap(([g = 0, w = 0, b = 0]) => [g, w, b]));
|
|
2834
|
+
const p = Z({ gl: n, type: "u16", target: "element" });
|
|
2835
|
+
p.set(di);
|
|
2836
|
+
const { renderProgram: _, depthProgram: E } = pi(e, {
|
|
2836
2837
|
uvwBuffer: d,
|
|
2837
|
-
indexBuffer:
|
|
2838
|
-
}), x = [0, 1, 2, 3], A = x.map(L),
|
|
2839
|
-
const { camera:
|
|
2838
|
+
indexBuffer: p
|
|
2839
|
+
}), x = [0, 1, 2, 3], A = x.map(L), M = x.map(ne), v = x.map(ve), m = (g) => {
|
|
2840
|
+
const { camera: w, worldToLocal: b, localToClip: S, clipToScreen: U } = g, P = (N) => {
|
|
2840
2841
|
const [I = 0, X = 0, C = 0] = N, B = u.get(N);
|
|
2841
|
-
let W =
|
|
2842
|
+
let W = vi(w, B);
|
|
2842
2843
|
if (!W) {
|
|
2843
|
-
const H = B.map((k, G) =>
|
|
2844
|
+
const H = B.map((k, G) => b(k, A[G])).map((k, G) => S(k, M[G]));
|
|
2844
2845
|
if (xi(H))
|
|
2845
2846
|
return [];
|
|
2846
|
-
W = Ei(H.map((k, G) => U(k,
|
|
2847
|
+
W = Ei(H.map((k, G) => U(k, v[G]))) > 512 / devicePixelRatio;
|
|
2847
2848
|
}
|
|
2848
2849
|
return W && C < hi ? [
|
|
2849
2850
|
[2 * I, 2 * X, C + 1],
|
|
@@ -2853,18 +2854,18 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
2853
2854
|
].flatMap((J) => P(J)) : [N];
|
|
2854
2855
|
};
|
|
2855
2856
|
return P([0, 0, 0]);
|
|
2856
|
-
},
|
|
2857
|
+
}, T = ({
|
|
2857
2858
|
viewport: g,
|
|
2858
|
-
depth:
|
|
2859
|
-
index:
|
|
2859
|
+
depth: w = !1,
|
|
2860
|
+
index: b = 0
|
|
2860
2861
|
}) => {
|
|
2861
2862
|
const S = t.color?.() ?? [1, 1, 1, 1];
|
|
2862
|
-
if (c(), Ee(n,
|
|
2863
|
+
if (c(), Ee(n, w, t))
|
|
2863
2864
|
return;
|
|
2864
|
-
const U =
|
|
2865
|
+
const U = w ? E : _, { projection: P, modelView: N, camera: I } = g, X = m(g);
|
|
2865
2866
|
for (const C of X) {
|
|
2866
|
-
const B =
|
|
2867
|
-
if (!
|
|
2867
|
+
const B = w ? void 0 : r?.get(C), W = l.get(C);
|
|
2868
|
+
if (!w && !B || !W)
|
|
2868
2869
|
continue;
|
|
2869
2870
|
const { texture: H, downsample: J } = W, { texture: k = H, downsample: G = 0 } = B ?? {};
|
|
2870
2871
|
U.execute({
|
|
@@ -2877,54 +2878,54 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
2877
2878
|
downsampleImagery: G,
|
|
2878
2879
|
downsampleTerrain: J,
|
|
2879
2880
|
color: S,
|
|
2880
|
-
index:
|
|
2881
|
+
index: b
|
|
2881
2882
|
});
|
|
2882
2883
|
}
|
|
2883
|
-
},
|
|
2884
|
+
}, R = () => {
|
|
2884
2885
|
i?.dispose(), f.dispose(), h.dispose();
|
|
2885
2886
|
}, y = ye(t);
|
|
2886
2887
|
return {
|
|
2887
|
-
render:
|
|
2888
|
-
dispose:
|
|
2888
|
+
render: T,
|
|
2889
|
+
dispose: R,
|
|
2889
2890
|
...y,
|
|
2890
2891
|
elevation: h.get
|
|
2891
2892
|
};
|
|
2892
|
-
},
|
|
2893
|
+
}, pi = ({ gl: e, programs: t }, { uvwBuffer: n, indexBuffer: i }) => {
|
|
2893
2894
|
const r = (c = !1) => {
|
|
2894
2895
|
const a = t.get({
|
|
2895
2896
|
vertexSource: ui,
|
|
2896
2897
|
fragmentSource: c ? _e : fi
|
|
2897
|
-
}), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform1i("imagery"), d = a.uniform1i("terrain"),
|
|
2898
|
+
}), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform1i("imagery"), d = a.uniform1i("terrain"), p = a.uniform1i("downsample_imagery"), _ = a.uniform1i("downsample_terrain"), E = a.uniform4f("color"), x = a.uniform3i("xyz"), A = a.uniform3i("camera"), M = a.uniform1i("index");
|
|
2898
2899
|
return { execute: ({
|
|
2899
2900
|
projection: m,
|
|
2900
|
-
modelView:
|
|
2901
|
-
camera:
|
|
2901
|
+
modelView: T,
|
|
2902
|
+
camera: R,
|
|
2902
2903
|
xyz: y,
|
|
2903
2904
|
imagery: g,
|
|
2904
|
-
terrain:
|
|
2905
|
-
downsampleImagery:
|
|
2905
|
+
terrain: w,
|
|
2906
|
+
downsampleImagery: b,
|
|
2906
2907
|
downsampleTerrain: S,
|
|
2907
2908
|
color: U,
|
|
2908
2909
|
index: P
|
|
2909
2910
|
}) => {
|
|
2910
|
-
a.use(), f.use(), l.set(m), h.set(
|
|
2911
|
+
a.use(), f.use(), l.set(m), h.set(T), x.set(y), A.set(R), p.set(b), _.set(S), E.set(U), M.set(P), e.activeTexture(e.TEXTURE0), u.set(0), g.use(), e.activeTexture(e.TEXTURE1), d.set(1), w.use(), i.use(), e.drawElements(e.TRIANGLES, V * V * 2 * 3, e.UNSIGNED_SHORT, 0);
|
|
2911
2912
|
} };
|
|
2912
2913
|
}, s = r(), o = r(!0);
|
|
2913
2914
|
return { renderProgram: s, depthProgram: o };
|
|
2914
|
-
},
|
|
2915
|
+
}, vi = (e, t) => {
|
|
2915
2916
|
const [n, i, r, s] = t.reduce(
|
|
2916
|
-
([f, l, h, u], [d = 0,
|
|
2917
|
+
([f, l, h, u], [d = 0, p = 0]) => [
|
|
2917
2918
|
Math.min(d, f),
|
|
2918
2919
|
Math.max(d, l),
|
|
2919
|
-
Math.min(
|
|
2920
|
-
Math.max(
|
|
2920
|
+
Math.min(p, h),
|
|
2921
|
+
Math.max(p, u)
|
|
2921
2922
|
],
|
|
2922
2923
|
[1, 0, 1, 0]
|
|
2923
2924
|
), [o = 0, c = 0, a = 0] = e;
|
|
2924
2925
|
return o > n && o < i && c > r && c < s && a > 0 && a < i - n;
|
|
2925
2926
|
}, xi = (e) => e.every(([t = 0, , , n = 0]) => t > n) || e.every(([t = 0, , , n = 0]) => t < -n) || e.every(([, t = 0, , n = 0]) => t > n) || e.every(([, t = 0, , n = 0]) => t < -n) || e.every(([, , t = 0, n = 0]) => t > n) || e.every(([, , t = 0, n = 0]) => t < -n) || e.every(([, , , t = 0]) => t < 0), Ei = (e) => Math.sqrt(
|
|
2926
2927
|
e.map(
|
|
2927
|
-
(t, n) =>
|
|
2928
|
+
(t, n) => pn(
|
|
2928
2929
|
e[n] ?? [0, 0],
|
|
2929
2930
|
e[(n + 1) % e.length] ?? [0, 0]
|
|
2930
2931
|
)
|
|
@@ -2965,7 +2966,8 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
2965
2966
|
onDrag: r,
|
|
2966
2967
|
onDragFlat: s,
|
|
2967
2968
|
onDragStart: o,
|
|
2968
|
-
onDragEnd: c
|
|
2969
|
+
onDragEnd: c,
|
|
2970
|
+
onMouseMove: a
|
|
2969
2971
|
} = e;
|
|
2970
2972
|
return {
|
|
2971
2973
|
onClick: t,
|
|
@@ -2974,7 +2976,8 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
2974
2976
|
onDrag: r,
|
|
2975
2977
|
onDragFlat: s,
|
|
2976
2978
|
onDragStart: o,
|
|
2977
|
-
onDragEnd: c
|
|
2979
|
+
onDragEnd: c,
|
|
2980
|
+
onMouseMove: a
|
|
2978
2981
|
};
|
|
2979
2982
|
}, Se = 8, Ue = 1e-3, fe = (e) => (t) => {
|
|
2980
2983
|
let n, i;
|
|
@@ -2987,11 +2990,11 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
2987
2990
|
}, _i = fe(
|
|
2988
2991
|
({ time: e, current: t, target: n }) => (Math.abs(n - t) < Ue ? t = n : t = t + (n - t) * (1 - Math.exp(-Se * e)), t)
|
|
2989
2992
|
), yi = (e) => fe(({ time: t, current: n, target: i }) => (mn(n, i) < Ue ? fn(n, i) : n = un(
|
|
2990
|
-
|
|
2993
|
+
ve(),
|
|
2991
2994
|
n,
|
|
2992
2995
|
dn(
|
|
2993
|
-
|
|
2994
|
-
|
|
2996
|
+
ve(),
|
|
2997
|
+
vn(ve(), i, n),
|
|
2995
2998
|
1 - Math.exp(-Se * t)
|
|
2996
2999
|
)
|
|
2997
3000
|
), n))(() => cn(e())), Vi = (e) => fe(({ time: t, current: n, target: i }) => (qt(n, i) < Ue ? Gt(n, i) : n = Ft(
|
|
@@ -3003,7 +3006,7 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
3003
3006
|
1 - Math.exp(-Se * t)
|
|
3004
3007
|
)
|
|
3005
3008
|
), n))(() => dt(e())), Zi = (e) => fe(({ time: t, current: n, target: i }) => {
|
|
3006
|
-
const r =
|
|
3009
|
+
const r = be(z(n), z(i));
|
|
3007
3010
|
return r * Q < Ue || r > 1e5 / Q ? Vt(n, i) : n = oe(
|
|
3008
3011
|
re(
|
|
3009
3012
|
L(),
|
|
@@ -3018,7 +3021,7 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
3018
3021
|
})(() => ht(e())), Yi = (e) => {
|
|
3019
3022
|
let t = [0, 0, 0], n = [0, 0, 0], i, r;
|
|
3020
3023
|
return fe(({ time: o, current: c, target: a }) => {
|
|
3021
|
-
if (a === c || o > 1 ||
|
|
3024
|
+
if (a === c || o > 1 || be(z(a), z(c)) > 1e3 / Q)
|
|
3022
3025
|
return i = void 0, t = [0, 0, 0], n = [0, 0, 0], a;
|
|
3023
3026
|
const f = performance.now();
|
|
3024
3027
|
i ? a !== i && r !== void 0 && f - r > 1 && (n = de(
|
|
@@ -3056,7 +3059,7 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
3056
3059
|
), t = l, c;
|
|
3057
3060
|
})(() => ht(e()));
|
|
3058
3061
|
}, Ti = (e) => {
|
|
3059
|
-
const t = wi(() =>
|
|
3062
|
+
const t = wi(() => vt(e()));
|
|
3060
3063
|
return () => yn(t());
|
|
3061
3064
|
}, wi = (e) => fe(({ time: t, current: n, target: i }) => {
|
|
3062
3065
|
let r = rn(n, i);
|
|
@@ -3069,7 +3072,7 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
3069
3072
|
})(() => on(e())), gi = 8, $i = (e) => {
|
|
3070
3073
|
const t = Ti(() => e().orientation), n = yi(() => e().offset), i = _i(() => e().fieldOfView);
|
|
3071
3074
|
return fe(({ time: s, current: o, target: c }) => {
|
|
3072
|
-
let a =
|
|
3075
|
+
let a = be(z(o.target), z(c.target)) * Q;
|
|
3073
3076
|
a < 1e3 && (a = 0);
|
|
3074
3077
|
const f = Math.max(c.distance, a), l = 1 - Math.exp(-gi * s), h = Math.exp(
|
|
3075
3078
|
Math.log(o.distance) + (Math.log(f) - Math.log(o.distance)) * l
|
|
@@ -3139,7 +3142,7 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
3139
3142
|
resize: o,
|
|
3140
3143
|
read: ([l = 0, h = 0]) => {
|
|
3141
3144
|
r(), e.readPixels(l, s - h, 1, 1, e.RGBA, e.UNSIGNED_BYTE, c), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
3142
|
-
const [u = 0, d = 0,
|
|
3145
|
+
const [u = 0, d = 0, p = 0, _ = 0] = c, x = 2 * ((u * 256 + d) / (256 * 256 - 1)) - 1, A = p * 256 + _;
|
|
3143
3146
|
return [x, A];
|
|
3144
3147
|
},
|
|
3145
3148
|
dispose: () => {
|
|
@@ -3155,38 +3158,41 @@ const V = 34, hi = 22, di = xe(0, V).flatMap(
|
|
|
3155
3158
|
let s = !1, o, c;
|
|
3156
3159
|
const a = () => {
|
|
3157
3160
|
s = !0;
|
|
3158
|
-
}, f = (
|
|
3159
|
-
const { x: _, y: E, movementX: x, movementY: A } =
|
|
3161
|
+
}, f = (p) => {
|
|
3162
|
+
const { x: _, y: E, movementX: x, movementY: A } = p;
|
|
3160
3163
|
if (o) {
|
|
3161
3164
|
if (o.onDrag) {
|
|
3162
|
-
const { point:
|
|
3163
|
-
o.onDrag({ point:
|
|
3165
|
+
const { point: T, position: R, layer: y } = i([_, E], { terrain: !0 });
|
|
3166
|
+
o.onDrag({ point: T, position: R, layer: y });
|
|
3164
3167
|
}
|
|
3165
3168
|
if (o.onDragFlat) {
|
|
3166
|
-
const
|
|
3167
|
-
o.onDragFlat({ point: [_, E], position:
|
|
3169
|
+
const R = te(t(), n()).unproject([_, E], { targetZ: c });
|
|
3170
|
+
o.onDragFlat({ point: [_, E], position: R, layer: void 0 });
|
|
3168
3171
|
}
|
|
3169
3172
|
return;
|
|
3170
3173
|
}
|
|
3171
3174
|
if (s && (Math.abs(x) > 1 || Math.abs(A) > 1)) {
|
|
3172
3175
|
s = !1;
|
|
3173
|
-
const { point:
|
|
3174
|
-
(
|
|
3176
|
+
const { point: T, position: R, layer: y } = i([_, E]);
|
|
3177
|
+
(y?.onDrag || y?.onDragFlat) && (o = y, o.onDragStart?.({ point: T, position: R, layer: y }), [, , c] = R);
|
|
3178
|
+
return;
|
|
3175
3179
|
}
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
+
const { point: M, position: v, layer: m } = i([_, E]);
|
|
3181
|
+
m?.onMouseMove?.({ point: M, position: v, layer: m });
|
|
3182
|
+
}, l = (p) => {
|
|
3183
|
+
if (s && h(p), s = !1, o) {
|
|
3184
|
+
const { x: _, y: E } = p, { point: x, position: A, layer: M } = i([_, E]);
|
|
3185
|
+
o.onDragEnd?.({ point: x, position: A, layer: M });
|
|
3180
3186
|
}
|
|
3181
3187
|
o = void 0;
|
|
3182
|
-
}, h = (
|
|
3183
|
-
const { x: _, y: E, button: x } =
|
|
3184
|
-
(x === 2 ?
|
|
3185
|
-
{ point: A, position:
|
|
3186
|
-
|
|
3188
|
+
}, h = (p) => {
|
|
3189
|
+
const { x: _, y: E, button: x } = p, { point: A, position: M, layer: v } = i([_, E]);
|
|
3190
|
+
(x === 2 ? v?.onRightClick : v?.onClick)?.(
|
|
3191
|
+
{ point: A, position: M, layer: v },
|
|
3192
|
+
p
|
|
3187
3193
|
);
|
|
3188
|
-
}, u = ({ x:
|
|
3189
|
-
const { point: E, position: x, layer: A } = i([
|
|
3194
|
+
}, u = ({ x: p, y: _ }) => {
|
|
3195
|
+
const { point: E, position: x, layer: A } = i([p, _]);
|
|
3190
3196
|
A?.onDoubleClick?.({ point: E, position: x, layer: A });
|
|
3191
3197
|
};
|
|
3192
3198
|
return r?.addEventListener("mousedown", a), r?.addEventListener("mousemove", f), r?.addEventListener("dblclick", u), window.addEventListener("mouseup", l), { dispose: () => {
|
|
@@ -3198,56 +3204,56 @@ const ki = ({ gl: e }, t) => {
|
|
|
3198
3204
|
const { view: n, layers: i } = t;
|
|
3199
3205
|
let r = !0, s = [0, 0];
|
|
3200
3206
|
e.enable(e.CULL_FACE), e.cullFace(e.FRONT), e.depthFunc(e.LEQUAL);
|
|
3201
|
-
const o = Ri(e), { canvas: c } = e, a = ([
|
|
3202
|
-
|
|
3207
|
+
const o = Ri(e), { canvas: c } = e, a = ([v = 0, m = 0]) => {
|
|
3208
|
+
v = v || 1, m = m || 1, s = [v, m], c.width = v * devicePixelRatio, c.height = m * devicePixelRatio, o.resize([c.width, c.height]);
|
|
3203
3209
|
};
|
|
3204
3210
|
a([c.width, c.height]);
|
|
3205
|
-
const f = new ResizeObserver(([
|
|
3206
|
-
if (!
|
|
3211
|
+
const f = new ResizeObserver(([v]) => {
|
|
3212
|
+
if (!v)
|
|
3207
3213
|
return;
|
|
3208
|
-
const { contentRect: m } =
|
|
3209
|
-
a([
|
|
3214
|
+
const { contentRect: m } = v, { width: T, height: R } = m;
|
|
3215
|
+
a([T, R]);
|
|
3210
3216
|
});
|
|
3211
3217
|
c instanceof HTMLCanvasElement && f.observe(c);
|
|
3212
|
-
const l = ([
|
|
3213
|
-
e.viewport(0, 0,
|
|
3218
|
+
const l = ([v = 0, m = 0]) => {
|
|
3219
|
+
e.viewport(0, 0, v * devicePixelRatio, m * devicePixelRatio), e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT);
|
|
3214
3220
|
}, h = () => {
|
|
3215
|
-
const
|
|
3216
|
-
l(s), Ce(i()).forEach((m) => m.render?.({ viewport:
|
|
3217
|
-
}, u = (
|
|
3221
|
+
const v = te(n(), s);
|
|
3222
|
+
l(s), Ce(i()).forEach((m) => m.render?.({ viewport: v }));
|
|
3223
|
+
}, u = (v) => {
|
|
3218
3224
|
const m = te(n(), s);
|
|
3219
|
-
l(s), (
|
|
3220
|
-
(
|
|
3225
|
+
l(s), (v ? [v] : Ce(i())).forEach(
|
|
3226
|
+
(T, R) => T.render?.({ viewport: m, depth: !0, index: R + 1 })
|
|
3221
3227
|
);
|
|
3222
3228
|
}, d = () => {
|
|
3223
3229
|
r && (h(), requestAnimationFrame(d));
|
|
3224
3230
|
};
|
|
3225
3231
|
requestAnimationFrame(d);
|
|
3226
|
-
const
|
|
3227
|
-
const { screenToClip:
|
|
3232
|
+
const p = (v) => te(n(), s).project(v), _ = (v) => te(n(), s).unproject(v), E = (v, { terrain: m } = {}) => {
|
|
3233
|
+
const { screenToClip: T, clipToLocal: R, localToWorld: y } = te(
|
|
3228
3234
|
n(),
|
|
3229
3235
|
s
|
|
3230
3236
|
);
|
|
3231
3237
|
o.use();
|
|
3232
3238
|
const [g] = m ? i() : [];
|
|
3233
3239
|
u(g);
|
|
3234
|
-
const [
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
]), [P = 0, N = 0] =
|
|
3238
|
-
return { point:
|
|
3240
|
+
const [w = 0, b = 0] = v, [S, U] = o.read([
|
|
3241
|
+
w * devicePixelRatio,
|
|
3242
|
+
b * devicePixelRatio
|
|
3243
|
+
]), [P = 0, N = 0] = T(v), I = oe(y(R([P, N, S, 1]))), X = U === 0 ? void 0 : g ?? Ce(i())[U - 1];
|
|
3244
|
+
return { point: v, position: I, layer: X };
|
|
3239
3245
|
}, x = Ai(e, {
|
|
3240
3246
|
view: n,
|
|
3241
3247
|
screen: () => s,
|
|
3242
3248
|
pick: E
|
|
3243
3249
|
});
|
|
3244
3250
|
return {
|
|
3245
|
-
project:
|
|
3251
|
+
project: p,
|
|
3246
3252
|
unproject: _,
|
|
3247
3253
|
pick: E,
|
|
3248
|
-
elevation: (
|
|
3254
|
+
elevation: (v) => {
|
|
3249
3255
|
const [m] = i();
|
|
3250
|
-
return m.elevation(
|
|
3256
|
+
return m.elevation(v);
|
|
3251
3257
|
},
|
|
3252
3258
|
dispose: () => {
|
|
3253
3259
|
r = !1, x.dispose(), o.dispose(), c instanceof HTMLCanvasElement && f.unobserve(c);
|
|
@@ -3260,12 +3266,12 @@ export {
|
|
|
3260
3266
|
Q as circumference,
|
|
3261
3267
|
Si as createBillboardLayer,
|
|
3262
3268
|
Ui as createContainer,
|
|
3263
|
-
|
|
3269
|
+
Mi as createContext,
|
|
3264
3270
|
Pi as createDynamicContainer,
|
|
3265
3271
|
Li as createEmptyLayer,
|
|
3266
3272
|
Ni as createLineLayer,
|
|
3267
3273
|
si as createMemoryTexture,
|
|
3268
|
-
|
|
3274
|
+
bi as createMouseControl,
|
|
3269
3275
|
ye as createMouseEvents,
|
|
3270
3276
|
_i as createNumberTransition,
|
|
3271
3277
|
Ii as createObjectLayer,
|
|
@@ -3291,8 +3297,8 @@ export {
|
|
|
3291
3297
|
En as quadratic,
|
|
3292
3298
|
De as radians,
|
|
3293
3299
|
xe as range,
|
|
3294
|
-
|
|
3300
|
+
pt as tileToMercator,
|
|
3295
3301
|
yn as toOrientation,
|
|
3296
|
-
|
|
3302
|
+
vt as toQuaternion
|
|
3297
3303
|
};
|
|
3298
3304
|
//# sourceMappingURL=index.js.map
|