world.ts 0.2.8 → 0.3.0
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 +431 -419
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,56 +22,56 @@ const Rt = (e, t) => {
|
|
|
22
22
|
);
|
|
23
23
|
if (e.attachShader(i, r), e.attachShader(i, s), e.linkProgram(i), !e.getProgramParameter(i, e.LINK_STATUS))
|
|
24
24
|
throw console.error("Link failure", e.getProgramInfoLog(i)), new Error("Link failure");
|
|
25
|
-
const o = () => e.useProgram(i), c = (
|
|
26
|
-
const R = e.getUniformLocation(i,
|
|
27
|
-
return { set: (
|
|
28
|
-
R && T(R,
|
|
25
|
+
const o = () => e.useProgram(i), c = (E, T) => {
|
|
26
|
+
const R = e.getUniformLocation(i, E);
|
|
27
|
+
return { set: (b) => {
|
|
28
|
+
R && T(R, b);
|
|
29
29
|
} };
|
|
30
|
-
}, a = (
|
|
31
|
-
|
|
32
|
-
(T, [R = 0,
|
|
33
|
-
), u = (
|
|
34
|
-
|
|
35
|
-
(T, [R = 0,
|
|
36
|
-
), h = (
|
|
37
|
-
|
|
38
|
-
(T, [R = 0,
|
|
39
|
-
), d = (
|
|
40
|
-
|
|
41
|
-
(T, [R = 0,
|
|
42
|
-
), m = (
|
|
43
|
-
|
|
44
|
-
(T, [R = 0,
|
|
45
|
-
),
|
|
46
|
-
|
|
47
|
-
(T, [R = 0,
|
|
48
|
-
),
|
|
49
|
-
|
|
30
|
+
}, a = (E) => c(E, (T, R) => e.uniform1f(T, R)), f = (E) => c(E, (T, R) => e.uniform1i(T, R)), l = (E) => c(
|
|
31
|
+
E,
|
|
32
|
+
(T, [R = 0, M = 0]) => e.uniform2f(T, R, M)
|
|
33
|
+
), u = (E) => c(
|
|
34
|
+
E,
|
|
35
|
+
(T, [R = 0, M = 0]) => e.uniform2i(T, R, M)
|
|
36
|
+
), h = (E) => c(
|
|
37
|
+
E,
|
|
38
|
+
(T, [R = 0, M = 0, b = 0]) => e.uniform3f(T, R, M, b)
|
|
39
|
+
), d = (E) => c(
|
|
40
|
+
E,
|
|
41
|
+
(T, [R = 0, M = 0, b = 0]) => e.uniform3i(T, R, M, b)
|
|
42
|
+
), m = (E) => c(
|
|
43
|
+
E,
|
|
44
|
+
(T, [R = 0, M = 0, b = 0, P = 0]) => e.uniform4f(T, R, M, b, P)
|
|
45
|
+
), y = (E) => c(
|
|
46
|
+
E,
|
|
47
|
+
(T, [R = 0, M = 0, b = 0, P = 0]) => e.uniform4i(T, R, M, b, P)
|
|
48
|
+
), w = (E) => c(
|
|
49
|
+
E,
|
|
50
50
|
(T, R) => e.uniformMatrix4fv(T, !1, R)
|
|
51
|
-
),
|
|
52
|
-
name:
|
|
51
|
+
), x = ({
|
|
52
|
+
name: E,
|
|
53
53
|
buffer: T,
|
|
54
54
|
size: R,
|
|
55
|
-
type:
|
|
56
|
-
stride:
|
|
55
|
+
type: M,
|
|
56
|
+
stride: b,
|
|
57
57
|
offset: P
|
|
58
58
|
}) => {
|
|
59
|
-
const U = e.getAttribLocation(i,
|
|
59
|
+
const U = e.getAttribLocation(i, E);
|
|
60
60
|
if (U === -1)
|
|
61
|
-
throw new Error(`Missing attribute: ${
|
|
61
|
+
throw new Error(`Missing attribute: ${E}`);
|
|
62
62
|
return { use: () => {
|
|
63
|
-
T.use(), e.enableVertexAttribArray(U), ["u16", "i32"].includes(
|
|
63
|
+
T.use(), e.enableVertexAttribArray(U), ["u16", "i32"].includes(M) ? e.vertexAttribIPointer(
|
|
64
64
|
U,
|
|
65
65
|
R,
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
M === "u16" ? e.UNSIGNED_SHORT : e.INT,
|
|
67
|
+
b || 0,
|
|
68
68
|
P || 0
|
|
69
69
|
) : e.vertexAttribPointer(
|
|
70
70
|
U,
|
|
71
71
|
R,
|
|
72
72
|
e.FLOAT,
|
|
73
73
|
!1,
|
|
74
|
-
|
|
74
|
+
b || 0,
|
|
75
75
|
P || 0
|
|
76
76
|
);
|
|
77
77
|
} };
|
|
@@ -85,12 +85,12 @@ const Rt = (e, t) => {
|
|
|
85
85
|
uniform3f: h,
|
|
86
86
|
uniform3i: d,
|
|
87
87
|
uniform4f: m,
|
|
88
|
-
uniform4i:
|
|
89
|
-
uniformMatrix4f:
|
|
90
|
-
attribute1f: (
|
|
91
|
-
attribute2f: (
|
|
92
|
-
attribute3f: (
|
|
93
|
-
attribute3i: (
|
|
88
|
+
uniform4i: y,
|
|
89
|
+
uniformMatrix4f: w,
|
|
90
|
+
attribute1f: (E, T, R = {}) => x({ name: E, buffer: T, size: 1, type: "f32", ...R }),
|
|
91
|
+
attribute2f: (E, T, R = {}) => x({ name: E, buffer: T, size: 2, type: "f32", ...R }),
|
|
92
|
+
attribute3f: (E, T, R = {}) => x({ name: E, buffer: T, size: 3, type: "f32", ...R }),
|
|
93
|
+
attribute3i: (E, T, R = {}) => x({ name: E, buffer: T, size: 3, type: "i32", ...R }),
|
|
94
94
|
dispose: () => {
|
|
95
95
|
e.deleteProgram(i), e.deleteShader(r), e.deleteShader(s);
|
|
96
96
|
}
|
|
@@ -101,7 +101,7 @@ const Rt = (e, t) => {
|
|
|
101
101
|
if (e.shaderSource(t, n), e.compileShader(t), !e.getShaderParameter(t, e.COMPILE_STATUS))
|
|
102
102
|
throw console.error("Compilation failed", e.getShaderInfoLog(t)), new Error("Compilation failure");
|
|
103
103
|
return t;
|
|
104
|
-
},
|
|
104
|
+
}, Mt = (e) => {
|
|
105
105
|
const t = /* @__PURE__ */ new Map();
|
|
106
106
|
return {
|
|
107
107
|
get: ({
|
|
@@ -120,10 +120,10 @@ const Rt = (e, t) => {
|
|
|
120
120
|
const t = e.getContext("webgl2");
|
|
121
121
|
if (!t)
|
|
122
122
|
throw new Error("No WebGL2");
|
|
123
|
-
const n =
|
|
123
|
+
const n = Mt(t), { dispose: i } = n;
|
|
124
124
|
return { gl: t, programs: n, dispose: i };
|
|
125
125
|
};
|
|
126
|
-
var
|
|
126
|
+
var bt = 1e-6, Y = typeof Float32Array < "u" ? Float32Array : Array;
|
|
127
127
|
function St(e) {
|
|
128
128
|
Y = e;
|
|
129
129
|
}
|
|
@@ -144,12 +144,12 @@ function rt(e) {
|
|
|
144
144
|
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;
|
|
145
145
|
}
|
|
146
146
|
function Pt(e, t) {
|
|
147
|
-
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], u = t[9], h = t[10], d = t[11], m = t[12],
|
|
148
|
-
return
|
|
147
|
+
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], u = t[9], h = t[10], d = t[11], m = t[12], y = t[13], w = t[14], x = t[15], A = n * c - i * o, p = n * a - r * o, v = n * f - s * o, _ = i * a - r * c, g = i * f - s * c, E = r * f - s * a, T = l * y - u * m, R = l * w - h * m, M = l * x - d * m, b = u * w - h * y, P = u * x - d * y, U = h * x - d * w, S = A * U - p * P + v * b + _ * M - g * R + E * T;
|
|
148
|
+
return S ? (S = 1 / S, e[0] = (c * U - a * P + f * b) * S, e[1] = (r * P - i * U - s * b) * S, e[2] = (y * E - w * g + x * _) * S, e[3] = (h * g - u * E - d * _) * S, e[4] = (a * M - o * U - f * R) * S, e[5] = (n * U - r * M + s * R) * S, e[6] = (w * v - m * E - x * p) * S, e[7] = (l * E - h * v + d * p) * S, e[8] = (o * P - c * M + f * T) * S, e[9] = (i * M - n * P - s * T) * S, e[10] = (m * g - y * v + x * A) * S, e[11] = (u * v - l * g - d * A) * S, e[12] = (c * R - o * b - a * T) * S, e[13] = (n * b - i * R + r * T) * S, e[14] = (y * p - m * _ - w * A) * S, e[15] = (l * _ - u * p + h * A) * S, e) : null;
|
|
149
149
|
}
|
|
150
150
|
function zt(e, t, n) {
|
|
151
|
-
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], u = t[8], h = t[9], d = t[10], m = t[11],
|
|
152
|
-
return e[0] =
|
|
151
|
+
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], u = t[8], h = t[9], d = t[10], m = t[11], y = t[12], w = t[13], x = t[14], A = t[15], p = n[0], v = n[1], _ = n[2], g = n[3];
|
|
152
|
+
return e[0] = p * i + v * c + _ * u + g * y, e[1] = p * r + v * a + _ * h + g * w, e[2] = p * s + v * f + _ * d + g * x, e[3] = p * o + v * l + _ * m + g * A, p = n[4], v = n[5], _ = n[6], g = n[7], e[4] = p * i + v * c + _ * u + g * y, e[5] = p * r + v * a + _ * h + g * w, e[6] = p * s + v * f + _ * d + g * x, e[7] = p * o + v * l + _ * m + g * A, p = n[8], v = n[9], _ = n[10], g = n[11], e[8] = p * i + v * c + _ * u + g * y, e[9] = p * r + v * a + _ * h + g * w, e[10] = p * s + v * f + _ * d + g * x, e[11] = p * o + v * l + _ * m + g * A, p = n[12], v = n[13], _ = n[14], g = n[15], e[12] = p * i + v * c + _ * u + g * y, e[13] = p * r + v * a + _ * h + g * w, e[14] = p * s + v * f + _ * d + g * x, e[15] = p * o + v * l + _ * m + g * A, e;
|
|
153
153
|
}
|
|
154
154
|
function Lt(e, t, n) {
|
|
155
155
|
var i = n[0], r = n[1], s = n[2];
|
|
@@ -168,8 +168,8 @@ function Dt(e, t, n) {
|
|
|
168
168
|
return t !== e && (e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = s * r + f * i, e[1] = o * r + l * i, e[2] = c * r + u * i, e[3] = a * r + h * i, e[4] = f * r - s * i, e[5] = l * r - o * i, e[6] = u * r - c * i, e[7] = h * r - a * i, e;
|
|
169
169
|
}
|
|
170
170
|
function Ot(e, t) {
|
|
171
|
-
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, u = i * c, h = r * o, d = r * c, m = r * a,
|
|
172
|
-
return e[0] = 1 - u - m, e[1] = l +
|
|
171
|
+
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, u = i * c, h = r * o, d = r * c, m = r * a, y = s * o, w = s * c, x = s * a;
|
|
172
|
+
return e[0] = 1 - u - m, e[1] = l + x, e[2] = h - w, e[3] = 0, e[4] = l - x, e[5] = 1 - f - m, e[6] = d + y, e[7] = 0, e[8] = h + w, e[9] = d - y, e[10] = 1 - f - u, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;
|
|
173
173
|
}
|
|
174
174
|
function Ct(e, t, n, i, r) {
|
|
175
175
|
var s = 1 / Math.tan(t / 2), o;
|
|
@@ -290,8 +290,8 @@ function tn(e, t) {
|
|
|
290
290
|
return Math.acos(2 * n * n - 1);
|
|
291
291
|
}
|
|
292
292
|
function Ne(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], u = n[3], h, d, m,
|
|
294
|
-
return d = r * a + s * f + o * l + c * u, d < 0 && (d = -d, a = -a, f = -f, l = -l, u = -u), 1 - d >
|
|
293
|
+
var r = t[0], s = t[1], o = t[2], c = t[3], a = n[0], f = n[1], l = n[2], u = n[3], h, d, m, y, w;
|
|
294
|
+
return d = r * a + s * f + o * l + c * u, d < 0 && (d = -d, a = -a, f = -f, l = -l, u = -u), 1 - d > bt ? (h = Math.acos(d), m = Math.sin(h), y = Math.sin((1 - i) * h) / m, w = Math.sin(i * h) / m) : (y = 1 - i, w = i), e[0] = y * r + w * a, e[1] = y * s + w * f, e[2] = y * o + w * l, e[3] = y * c + w * u, e;
|
|
295
295
|
}
|
|
296
296
|
function nn(e, t) {
|
|
297
297
|
var n = t[0] + t[4] + t[8], i;
|
|
@@ -375,13 +375,13 @@ const H = 40075017, Ie = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
|
|
|
375
375
|
(e - 0.5) * 360,
|
|
376
376
|
dn(Math.atan(Math.sinh(-(t - 0.5) * (2 * Math.PI)))),
|
|
377
377
|
n * H
|
|
378
|
-
),
|
|
378
|
+
), vn = ([e = 0, t = 0, n = 0], i = z()) => {
|
|
379
379
|
const r = 2 ** -n;
|
|
380
380
|
return we(i, e * r, t * r, 0);
|
|
381
381
|
}, Se = ([e = 0, t = 0, n = 0]) => {
|
|
382
382
|
const i = Math.cos(t * 0.5), r = Math.sin(t * 0.5), s = Math.cos(e * 0.5), o = Math.sin(e * 0.5), c = Math.cos(n * 0.5), a = Math.sin(n * 0.5), f = c * s * i + a * o * r, l = a * s * i - c * o * r, u = c * o * i + a * s * r, h = c * s * r - a * o * i;
|
|
383
383
|
return [l, u, h, f];
|
|
384
|
-
},
|
|
384
|
+
}, pn = ([e = 0, t = 0, n = 0, i = 0]) => {
|
|
385
385
|
const r = Math.atan2(2 * (i * e + t * n), 1 - 2 * (e * e + t * t)), s = Math.asin(Math.min(1, 2 * (i * t - n * e))), o = Math.atan2(2 * (i * n + e * t), 1 - 2 * (t * t + n * n));
|
|
386
386
|
return [s, o, r];
|
|
387
387
|
}, ut = {
|
|
@@ -394,47 +394,47 @@ const H = 40075017, Ie = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
|
|
|
394
394
|
const { target: n, offset: i, distance: r, orientation: s, fieldOfView: o } = {
|
|
395
395
|
...ut,
|
|
396
396
|
...e
|
|
397
|
-
}, [c = 0, a = 0] = t, [f = 0, l = 0] = i, [u = 0, h = 0, d = 0] = s, m = Math.tan(Ie(45) / 2) / Math.tan(Ie(o) / 2),
|
|
398
|
-
rt(
|
|
399
|
-
const
|
|
400
|
-
rt(
|
|
401
|
-
const
|
|
397
|
+
}, [c = 0, a = 0] = t, [f = 0, l = 0] = i, [u = 0, h = 0, d = 0] = s, m = Math.tan(Ie(45) / 2) / Math.tan(Ie(o) / 2), y = r / H * m, w = y / 100, x = y * 1e6, A = xe();
|
|
398
|
+
rt(A), Xt(A, Ie(o), c / a, w, x), Lt(A, A, [1, -1, 1]);
|
|
399
|
+
const p = xe();
|
|
400
|
+
rt(p), Nt(p, p, u), It(p, p, h), Dt(p, p, d);
|
|
401
|
+
const v = zt(xn, A, p), _ = Pt(xe(), v), g = (O) => {
|
|
402
402
|
const W = [c * O, a * O], k = [f * O, l * O];
|
|
403
403
|
return J({ ...e, offset: k }, W);
|
|
404
|
-
},
|
|
405
|
-
const K = 2 * O / c - 1,
|
|
406
|
-
return ot(k, K,
|
|
404
|
+
}, E = ([O = 0, W = 0], k = ee()) => {
|
|
405
|
+
const K = 2 * O / c - 1, ve = -(2 * W / a - 1);
|
|
406
|
+
return ot(k, K, ve, 0, 1);
|
|
407
407
|
}, T = ([O = 0, W = 0, , k = 0], K = de()) => on(K, (1 + O / k) * c * 0.5, (1 - W / k) * a * 0.5), R = (O, W = z()) => {
|
|
408
|
-
const [k = 0, K = 0,
|
|
409
|
-
return we(W, k /
|
|
410
|
-
},
|
|
411
|
-
(D - U) * (D - U) + (j -
|
|
412
|
-
U * (D - U) +
|
|
413
|
-
U * U +
|
|
408
|
+
const [k = 0, K = 0, ve = 0, pe = 0] = at(En, O, _);
|
|
409
|
+
return we(W, k / pe, K / pe, ve / pe);
|
|
410
|
+
}, M = ([O = 0, W = 0, k = 0], K = ee()) => at(K, ot(K, O, W, k, 1), v), [b = 0, P = 0] = E([f + c / 2, l + a / 2]), [U = 0, S = 0, N = 0] = R([b, P, -1, 1]), [D = 0, j = 0, X = 0] = R([b, P, 1.00001, 1]), [C = 0] = mn(
|
|
411
|
+
(D - U) * (D - U) + (j - S) * (j - S) + (X - N) * (X - N),
|
|
412
|
+
U * (D - U) + S * (j - S) + N * (X - N),
|
|
413
|
+
U * U + S * S + N * N - r * r / H / H * m * m
|
|
414
414
|
);
|
|
415
415
|
if (isNaN(C))
|
|
416
416
|
throw new Error("Unexpected");
|
|
417
417
|
const G = [
|
|
418
418
|
U + C * (D - U),
|
|
419
|
-
|
|
419
|
+
S + C * (j - S),
|
|
420
420
|
N + C * (X - N)
|
|
421
|
-
], Z = re(z(), L(n), G), $ = (O, W = z()) => ne(W, O, Z),
|
|
421
|
+
], Z = re(z(), L(n), G), $ = (O, W = z()) => ne(W, O, Z), be = (O, W = z()) => re(W, O, Z);
|
|
422
422
|
return {
|
|
423
423
|
camera: Z,
|
|
424
424
|
screen: t,
|
|
425
|
-
projection:
|
|
426
|
-
modelView:
|
|
425
|
+
projection: A,
|
|
426
|
+
modelView: p,
|
|
427
427
|
fieldScale: m,
|
|
428
|
-
scale:
|
|
429
|
-
screenToClip:
|
|
428
|
+
scale: g,
|
|
429
|
+
screenToClip: E,
|
|
430
430
|
clipToScreen: T,
|
|
431
431
|
clipToLocal: R,
|
|
432
|
-
localToClip:
|
|
432
|
+
localToClip: M,
|
|
433
433
|
localToWorld: $,
|
|
434
|
-
worldToLocal:
|
|
435
|
-
project: (O) => T(
|
|
434
|
+
worldToLocal: be,
|
|
435
|
+
project: (O) => T(M(be(L(O)))),
|
|
436
436
|
unproject: (O, { targetZ: W = 0 } = {}) => {
|
|
437
|
-
const k =
|
|
437
|
+
const k = E(O), [K = 0, ve = 0, , pe = 0] = k, Tt = [K, ve, -1, pe], et = se($(R(k))), tt = se($(R(Tt))), [, , Ze = 0] = et, [, , nt = 0] = tt, gt = Ze === nt ? 0 : (W - Ze) / (nt - Ze);
|
|
438
438
|
return Yt(z(), et, tt, gt);
|
|
439
439
|
}
|
|
440
440
|
};
|
|
@@ -446,59 +446,71 @@ const H = 40075017, Ie = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
|
|
|
446
446
|
onChangeView: o
|
|
447
447
|
} = n;
|
|
448
448
|
let c = !1, a = !1;
|
|
449
|
-
const { view: f } = n, l = ([
|
|
450
|
-
const [
|
|
449
|
+
const { view: f } = n, l = ([v = 0, _ = 0]) => {
|
|
450
|
+
const [g, E] = [
|
|
451
451
|
e.width / devicePixelRatio,
|
|
452
452
|
e.height / devicePixelRatio
|
|
453
|
-
], { camera:
|
|
454
|
-
if (!
|
|
453
|
+
], { camera: T, fieldScale: R } = J(f(), [g, E]), { position: M, layer: b } = t.pick([v, _]);
|
|
454
|
+
if (!b)
|
|
455
455
|
return;
|
|
456
|
-
const
|
|
456
|
+
const P = Te(L(M), T) * H / R, U = [v - g / 2, _ - E / 2];
|
|
457
457
|
o({
|
|
458
|
-
offset:
|
|
459
|
-
target:
|
|
460
|
-
distance:
|
|
458
|
+
offset: U,
|
|
459
|
+
target: M,
|
|
460
|
+
distance: P
|
|
461
461
|
});
|
|
462
|
-
}, u = () => {
|
|
463
|
-
|
|
464
|
-
}, h = ({ buttons: p, movementX: g, movementY: v, x, y: w }) => {
|
|
465
|
-
if (!i() || !p)
|
|
462
|
+
}, u = (v, _) => {
|
|
463
|
+
if (!r())
|
|
466
464
|
return;
|
|
467
|
-
|
|
468
|
-
const [
|
|
465
|
+
a || (l([v, _]), a = !0);
|
|
466
|
+
const [g, E] = [
|
|
469
467
|
e.width / devicePixelRatio,
|
|
470
468
|
e.height / devicePixelRatio
|
|
471
469
|
];
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
470
|
+
o({
|
|
471
|
+
offset: [v - g / 2, _ - E / 2]
|
|
472
|
+
});
|
|
473
|
+
}, h = (v, _, g, E) => {
|
|
474
|
+
if (!s())
|
|
475
|
+
return;
|
|
476
|
+
r() && !a && (l([v, _]), a = !0);
|
|
477
|
+
const [T, R] = [
|
|
478
|
+
e.width / devicePixelRatio,
|
|
479
|
+
e.height / devicePixelRatio
|
|
480
|
+
], { orientation: [M = 0, b = 0, P = 0] = [] } = f(), U = [
|
|
481
|
+
Math.min(
|
|
482
|
+
Math.PI / 2 - 0.1,
|
|
483
|
+
Math.max(0.1, M - E / R * Math.PI)
|
|
484
|
+
),
|
|
485
|
+
b,
|
|
486
|
+
P - g / T * Math.PI
|
|
487
|
+
];
|
|
488
|
+
o({
|
|
489
|
+
orientation: U
|
|
490
|
+
});
|
|
491
|
+
}, d = (v) => {
|
|
492
|
+
a = !1;
|
|
493
|
+
}, m = ({ buttons: v, movementX: _, movementY: g, x: E, y: T }) => {
|
|
494
|
+
!i() || !v || (v === 1 && r() ? u(E, T) : v === 2 && s() && h(E, T, _, g));
|
|
495
|
+
}, y = ({ touches: v }) => {
|
|
496
|
+
const _ = v.item(0);
|
|
497
|
+
if (!_)
|
|
498
|
+
return;
|
|
499
|
+
const { clientX: g, clientY: E } = _;
|
|
500
|
+
u(g, E);
|
|
501
|
+
}, w = Rt(() => c = !1, 100), x = ({ x: v, y: _, deltaY: g }) => {
|
|
490
502
|
if (!i())
|
|
491
503
|
return;
|
|
492
|
-
c || (r() && l([
|
|
493
|
-
let { distance:
|
|
494
|
-
|
|
495
|
-
Math.max(
|
|
504
|
+
c || (r() && l([v, _]), c = !0);
|
|
505
|
+
let { distance: E } = { ...ut, ...f() };
|
|
506
|
+
E = Math.min(
|
|
507
|
+
Math.max(E * Math.exp(g * 1e-3), _n),
|
|
496
508
|
H
|
|
497
|
-
), o({ distance:
|
|
498
|
-
},
|
|
499
|
-
return e.addEventListener("mousedown",
|
|
509
|
+
), o({ distance: E }), w();
|
|
510
|
+
}, A = (v) => v.preventDefault();
|
|
511
|
+
return e.addEventListener("touchstart", d), e.addEventListener("mousedown", d), e.addEventListener("mousemove", m), e.addEventListener("touchmove", y), e.addEventListener("wheel", x, { passive: !0 }), e.addEventListener("contextmenu", A), {
|
|
500
512
|
dispose: () => {
|
|
501
|
-
e.removeEventListener("mousedown",
|
|
513
|
+
e.removeEventListener("mousedown", d), e.removeEventListener("mousemove", m), e.removeEventListener("wheel", x), e.removeEventListener("contextmenu", A);
|
|
502
514
|
}
|
|
503
515
|
};
|
|
504
516
|
}, V = ({
|
|
@@ -617,7 +629,7 @@ const Ue = wn(), Tn = ({
|
|
|
617
629
|
0
|
|
618
630
|
);
|
|
619
631
|
}, dispose: () => e.deleteTexture(t) };
|
|
620
|
-
},
|
|
632
|
+
}, vt = ({
|
|
621
633
|
gl: e,
|
|
622
634
|
url: t,
|
|
623
635
|
onLoad: n
|
|
@@ -720,11 +732,11 @@ const gi = (e, t = {}) => {
|
|
|
720
732
|
const a = me(
|
|
721
733
|
() => t.url?.() ?? "",
|
|
722
734
|
(m) => {
|
|
723
|
-
const
|
|
735
|
+
const y = vt({
|
|
724
736
|
gl: n,
|
|
725
737
|
url: m,
|
|
726
|
-
onLoad: ({ width:
|
|
727
|
-
r = [
|
|
738
|
+
onLoad: ({ width: w, height: x }) => {
|
|
739
|
+
r = [w, 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 = y;
|
|
728
740
|
}
|
|
729
741
|
});
|
|
730
742
|
}
|
|
@@ -733,26 +745,26 @@ const gi = (e, t = {}) => {
|
|
|
733
745
|
uvBuffer: o,
|
|
734
746
|
indexBuffer: c
|
|
735
747
|
}), u = ({
|
|
736
|
-
viewport: { projection: m, modelView:
|
|
737
|
-
depth:
|
|
738
|
-
index:
|
|
748
|
+
viewport: { projection: m, modelView: y, camera: w, screen: x },
|
|
749
|
+
depth: A = !1,
|
|
750
|
+
index: p = 0
|
|
739
751
|
}) => {
|
|
740
|
-
const
|
|
741
|
-
if (a(), !i || ge(n,
|
|
752
|
+
const v = t.position?.() ?? [0, 0, 0], _ = t.color?.() ?? [1, 1, 1, 1], g = t.size?.() ?? 100, E = t.minSizePixels?.() ?? 0, T = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
753
|
+
if (a(), !i || ge(n, A, t))
|
|
742
754
|
return;
|
|
743
|
-
(
|
|
755
|
+
(A ? l : f).execute({
|
|
744
756
|
projection: m,
|
|
745
|
-
modelView:
|
|
746
|
-
camera: Q(
|
|
747
|
-
screen:
|
|
757
|
+
modelView: y,
|
|
758
|
+
camera: Q(w),
|
|
759
|
+
screen: x,
|
|
748
760
|
image: i,
|
|
749
761
|
imageSize: r,
|
|
750
|
-
position: Q(L(
|
|
751
|
-
color:
|
|
752
|
-
size:
|
|
753
|
-
minSizePixels:
|
|
762
|
+
position: Q(L(v)),
|
|
763
|
+
color: _,
|
|
764
|
+
size: g,
|
|
765
|
+
minSizePixels: E,
|
|
754
766
|
maxSizePixels: T,
|
|
755
|
-
index:
|
|
767
|
+
index: p
|
|
756
768
|
});
|
|
757
769
|
}, h = () => {
|
|
758
770
|
s.dispose(), o.dispose(), c.dispose(), i?.dispose();
|
|
@@ -775,14 +787,14 @@ const gi = (e, t = {}) => {
|
|
|
775
787
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
776
788
|
}), u = f.attribute2f("uv", i, {
|
|
777
789
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
778
|
-
}), h = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"),
|
|
790
|
+
}), h = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), y = f.uniform2f("screen"), w = f.uniform1i("image"), x = f.uniform2f("image_size"), A = f.uniform3i("position"), p = f.uniform4f("color"), v = f.uniform1i("index"), _ = f.uniform1f("size"), g = f.uniform1f("min_size_pixels"), E = f.uniform1f("max_size_pixels");
|
|
779
791
|
return { execute: ({
|
|
780
792
|
projection: R,
|
|
781
|
-
modelView:
|
|
782
|
-
camera:
|
|
793
|
+
modelView: M,
|
|
794
|
+
camera: b,
|
|
783
795
|
screen: P,
|
|
784
796
|
image: U,
|
|
785
|
-
imageSize:
|
|
797
|
+
imageSize: S,
|
|
786
798
|
position: N,
|
|
787
799
|
color: D,
|
|
788
800
|
size: j,
|
|
@@ -790,7 +802,7 @@ const gi = (e, t = {}) => {
|
|
|
790
802
|
maxSizePixels: C,
|
|
791
803
|
index: G
|
|
792
804
|
}) => {
|
|
793
|
-
f.use(), l.use(), u.use(), h.set(R), d.set(
|
|
805
|
+
f.use(), l.use(), u.use(), h.set(R), d.set(M), m.set(b), y.set(P), x.set(S), A.set(N), p.set(D), _.set(j), g.set(X), E.set(C), v.set(G), e.activeTexture(e.TEXTURE0), w.set(0), U.use(), r.use(), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0);
|
|
794
806
|
} };
|
|
795
807
|
}, o = s(), c = s(!0);
|
|
796
808
|
return { renderProgram: o, depthProgram: c };
|
|
@@ -813,13 +825,13 @@ const gi = (e, t = {}) => {
|
|
|
813
825
|
},
|
|
814
826
|
dispose: () => Object.values(i).forEach((o) => o.dispose())
|
|
815
827
|
};
|
|
816
|
-
},
|
|
828
|
+
}, Mi = (e) => ({
|
|
817
829
|
render: e,
|
|
818
830
|
dispose: () => {
|
|
819
831
|
}
|
|
820
|
-
}),
|
|
832
|
+
}), bi = () => ({ dispose: () => {
|
|
821
833
|
} });
|
|
822
|
-
var
|
|
834
|
+
var Mn = `#version 300 es
|
|
823
835
|
|
|
824
836
|
precision highp float;
|
|
825
837
|
|
|
@@ -836,7 +848,7 @@ void main() {
|
|
|
836
848
|
result = color_out * texture(
|
|
837
849
|
dash,
|
|
838
850
|
vec2(fract((distance_out / dash_size) - dash_offset), 0.0));;
|
|
839
|
-
}`,
|
|
851
|
+
}`, bn = `#version 300 es
|
|
840
852
|
|
|
841
853
|
precision highp float;
|
|
842
854
|
|
|
@@ -914,55 +926,55 @@ const Si = (e, t = {}) => {
|
|
|
914
926
|
}), l = mt(n);
|
|
915
927
|
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);
|
|
916
928
|
const u = ({
|
|
917
|
-
viewport: { projection:
|
|
918
|
-
depth:
|
|
919
|
-
index:
|
|
929
|
+
viewport: { projection: w, modelView: x, camera: A, screen: p },
|
|
930
|
+
depth: v = !1,
|
|
931
|
+
index: _ = 0
|
|
920
932
|
}) => {
|
|
921
933
|
h(), d();
|
|
922
|
-
const
|
|
923
|
-
if (ge(n,
|
|
934
|
+
const g = t.color?.() ?? [1, 1, 1, 1], E = t.width?.() ?? 1, T = t.minWidthPixels?.() ?? 0, R = t.maxWidthPixels?.() ?? Number.MAX_VALUE, M = t.depthWidthPixels?.(), b = t.dashSize?.() ?? 1e3, P = t.dashOffset?.() ?? 0;
|
|
935
|
+
if (ge(n, v, t))
|
|
924
936
|
return;
|
|
925
|
-
(
|
|
926
|
-
projection:
|
|
927
|
-
modelView:
|
|
928
|
-
camera: Q(
|
|
929
|
-
screen:
|
|
937
|
+
(v ? f : a).execute({
|
|
938
|
+
projection: w,
|
|
939
|
+
modelView: x,
|
|
940
|
+
camera: Q(A),
|
|
941
|
+
screen: p,
|
|
930
942
|
count: i,
|
|
931
|
-
color:
|
|
932
|
-
width:
|
|
933
|
-
minWidthPixels:
|
|
934
|
-
maxWidthPixels:
|
|
935
|
-
index:
|
|
943
|
+
color: g,
|
|
944
|
+
width: E,
|
|
945
|
+
minWidthPixels: v && M !== void 0 ? Math.max(T, M) : T,
|
|
946
|
+
maxWidthPixels: v && M !== void 0 ? Math.max(R, M) : R,
|
|
947
|
+
index: _,
|
|
936
948
|
dash: l,
|
|
937
|
-
dashSize:
|
|
949
|
+
dashSize: b,
|
|
938
950
|
dashOffset: P
|
|
939
951
|
});
|
|
940
952
|
}, h = me(
|
|
941
953
|
() => t.points?.() ?? [],
|
|
942
|
-
(
|
|
943
|
-
const
|
|
944
|
-
const [
|
|
945
|
-
return !
|
|
946
|
-
}), { indexData:
|
|
947
|
-
({ indexData:
|
|
948
|
-
if (
|
|
949
|
-
return { indexData:
|
|
950
|
-
const T = ie(0, (
|
|
951
|
-
const [
|
|
952
|
-
(
|
|
954
|
+
(w) => {
|
|
955
|
+
const x = w.flatMap((_) => {
|
|
956
|
+
const [g] = _, [E] = _.slice(-1);
|
|
957
|
+
return !g || !E ? [] : [g, ..._, E].map((T) => Q(L(T))).flatMap((T) => [...T, ...T, ...T, ...T]);
|
|
958
|
+
}), { indexData: A } = w.reduce(
|
|
959
|
+
({ indexData: _, count: g }, E) => {
|
|
960
|
+
if (E.length === 0)
|
|
961
|
+
return { indexData: _, count: g };
|
|
962
|
+
const T = ie(0, (E.length - 1) * 2).flatMap((R) => {
|
|
963
|
+
const [M = 0, b = 0, P = 0, U = 0] = ie(0, 4).map(
|
|
964
|
+
(S) => S + R * 2 + g
|
|
953
965
|
);
|
|
954
966
|
return [
|
|
955
|
-
[
|
|
956
|
-
[
|
|
967
|
+
[M, b, U],
|
|
968
|
+
[M, U, P]
|
|
957
969
|
].flat();
|
|
958
970
|
});
|
|
959
|
-
return
|
|
971
|
+
return g += (E.length + 2) * 4, _ = _.concat(T), { indexData: _, count: g };
|
|
960
972
|
},
|
|
961
973
|
{ indexData: [], count: 0 }
|
|
962
974
|
);
|
|
963
|
-
i =
|
|
964
|
-
const
|
|
965
|
-
(
|
|
975
|
+
i = A.length;
|
|
976
|
+
const p = w.flatMap(
|
|
977
|
+
(_) => _.length === 0 ? [] : ie(0, (_.length + 1) * 2).flatMap(
|
|
966
978
|
() => [
|
|
967
979
|
[-1, -1],
|
|
968
980
|
[-1, 1],
|
|
@@ -970,39 +982,39 @@ const Si = (e, t = {}) => {
|
|
|
970
982
|
[1, 1]
|
|
971
983
|
].flat()
|
|
972
984
|
)
|
|
973
|
-
),
|
|
974
|
-
const
|
|
975
|
-
(
|
|
985
|
+
), v = w.flatMap((_) => {
|
|
986
|
+
const E = _.map(
|
|
987
|
+
(M, b) => Te(L(M), L(_[b - 1] ?? M)) * H
|
|
976
988
|
).reduce(
|
|
977
|
-
({ current:
|
|
989
|
+
({ current: M, result: b }, P) => (M += P, b.push(M), { current: M, result: b }),
|
|
978
990
|
{ current: 0, result: [] }
|
|
979
|
-
).result, [T] =
|
|
980
|
-
return T === void 0 || R === void 0 ? [] : [T, ...
|
|
991
|
+
).result, [T] = E, [R] = E.slice(-1);
|
|
992
|
+
return T === void 0 || R === void 0 ? [] : [T, ...E, R].flatMap((M) => [M, M, M, M]);
|
|
981
993
|
});
|
|
982
|
-
r.set(
|
|
994
|
+
r.set(x), s.set(A), o.set(p), c.set(v);
|
|
983
995
|
}
|
|
984
996
|
), d = me(
|
|
985
997
|
() => t.dashPattern?.(),
|
|
986
|
-
(
|
|
987
|
-
|
|
998
|
+
(w) => {
|
|
999
|
+
w = w ?? [[1, 1, 1, 1]], l.use(), n.texImage2D(
|
|
988
1000
|
n.TEXTURE_2D,
|
|
989
1001
|
0,
|
|
990
1002
|
n.RGBA,
|
|
991
|
-
|
|
1003
|
+
w.length,
|
|
992
1004
|
1,
|
|
993
1005
|
0,
|
|
994
1006
|
n.RGBA,
|
|
995
1007
|
n.UNSIGNED_BYTE,
|
|
996
|
-
new Uint8Array(
|
|
1008
|
+
new Uint8Array(w.flatMap((x) => [...x.map((A) => A * 255)]))
|
|
997
1009
|
);
|
|
998
1010
|
}
|
|
999
1011
|
), m = () => {
|
|
1000
1012
|
r.dispose(), s.dispose(), o.dispose(), c.dispose();
|
|
1001
|
-
},
|
|
1013
|
+
}, y = Ae(t);
|
|
1002
1014
|
return {
|
|
1003
1015
|
render: u,
|
|
1004
1016
|
dispose: m,
|
|
1005
|
-
...
|
|
1017
|
+
...y
|
|
1006
1018
|
};
|
|
1007
1019
|
}, Sn = ({ gl: e, programs: t }, {
|
|
1008
1020
|
positionBuffer: n,
|
|
@@ -1012,22 +1024,22 @@ const Si = (e, t = {}) => {
|
|
|
1012
1024
|
}) => {
|
|
1013
1025
|
const o = (f = !1) => {
|
|
1014
1026
|
const l = t.get({
|
|
1015
|
-
vertexSource:
|
|
1016
|
-
fragmentSource: f ? Re :
|
|
1027
|
+
vertexSource: bn,
|
|
1028
|
+
fragmentSource: f ? Re : Mn
|
|
1017
1029
|
}), u = Float32Array.BYTES_PER_ELEMENT, h = Int32Array.BYTES_PER_ELEMENT, d = l.attribute3i("previous", n, {
|
|
1018
1030
|
stride: h * 3
|
|
1019
1031
|
}), m = l.attribute3i("current", n, {
|
|
1020
1032
|
stride: h * 3,
|
|
1021
1033
|
offset: h * 3 * 4
|
|
1022
|
-
}),
|
|
1034
|
+
}), y = l.attribute3i("next", n, {
|
|
1023
1035
|
stride: h * 3,
|
|
1024
1036
|
offset: h * 3 * 4 * 2
|
|
1025
|
-
}),
|
|
1037
|
+
}), w = l.attribute2f("corner", r, {
|
|
1026
1038
|
stride: u * 2
|
|
1027
|
-
}),
|
|
1039
|
+
}), x = l.attribute1f("distance", s, {
|
|
1028
1040
|
stride: u,
|
|
1029
1041
|
offset: u * 1 * 4
|
|
1030
|
-
}),
|
|
1042
|
+
}), A = l.uniformMatrix4f("projection"), p = l.uniformMatrix4f("model_view"), v = l.uniform3i("camera"), _ = l.uniform2f("screen"), g = l.uniform4f("color"), E = l.uniform1f("width"), T = l.uniform1f("max_width_pixels"), R = l.uniform1f("min_width_pixels"), M = l.uniform1i("index"), b = l.uniform1i("dash"), P = l.uniform1f("dash_size"), U = l.uniform1f("dash_offset");
|
|
1031
1043
|
return { execute: ({
|
|
1032
1044
|
projection: N,
|
|
1033
1045
|
modelView: D,
|
|
@@ -1037,13 +1049,13 @@ const Si = (e, t = {}) => {
|
|
|
1037
1049
|
color: G,
|
|
1038
1050
|
width: Z,
|
|
1039
1051
|
minWidthPixels: $,
|
|
1040
|
-
maxWidthPixels:
|
|
1052
|
+
maxWidthPixels: be,
|
|
1041
1053
|
index: qe,
|
|
1042
1054
|
dash: Je,
|
|
1043
1055
|
dashSize: O,
|
|
1044
1056
|
dashOffset: W
|
|
1045
1057
|
}) => {
|
|
1046
|
-
C !== 0 && (l.use(), d.use(), m.use(),
|
|
1058
|
+
C !== 0 && (l.use(), d.use(), m.use(), y.use(), w.use(), x.use(), A.set(N), p.set(D), v.set(j), _.set(X), g.set(G), E.set(Z), R.set($), T.set(be), M.set(qe), P.set(O), U.set(W), e.activeTexture(e.TEXTURE0), b.set(0), Je.use(), i.use(), e.drawElements(e.TRIANGLES, C, e.UNSIGNED_SHORT, 0));
|
|
1047
1059
|
} };
|
|
1048
1060
|
}, c = o(), a = o(!0);
|
|
1049
1061
|
return { renderProgram: c, depthProgram: a };
|
|
@@ -1106,35 +1118,35 @@ const Ui = (e, t = {}) => {
|
|
|
1106
1118
|
indexBuffer: s,
|
|
1107
1119
|
normalBuffer: o
|
|
1108
1120
|
}), f = ({
|
|
1109
|
-
viewport: { projection: d, modelView: m, camera:
|
|
1110
|
-
depth:
|
|
1111
|
-
index:
|
|
1121
|
+
viewport: { projection: d, modelView: m, camera: y, screen: w },
|
|
1122
|
+
depth: x = !1,
|
|
1123
|
+
index: A = 0
|
|
1112
1124
|
}) => {
|
|
1113
|
-
const
|
|
1114
|
-
if (l(), ge(n,
|
|
1125
|
+
const p = t.position?.() ?? [0, 0, 0], v = t.orientation?.() ?? [0, 0, 0, 1], _ = t.color?.() ?? [1, 1, 1, 1], g = t.diffuse?.() ?? [0, 0, 0, 0], E = t.size?.() ?? 1, T = t.minSizePixels?.() ?? 0, R = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
1126
|
+
if (l(), ge(n, x, t))
|
|
1115
1127
|
return;
|
|
1116
|
-
(
|
|
1128
|
+
(x ? a : c).execute({
|
|
1117
1129
|
projection: d,
|
|
1118
1130
|
modelView: m,
|
|
1119
|
-
camera: Q(
|
|
1120
|
-
screen:
|
|
1131
|
+
camera: Q(y),
|
|
1132
|
+
screen: w,
|
|
1121
1133
|
count: i,
|
|
1122
|
-
position: Q(L(
|
|
1123
|
-
orientation: Ot(xe(),
|
|
1124
|
-
color:
|
|
1125
|
-
diffuse:
|
|
1126
|
-
size:
|
|
1134
|
+
position: Q(L(p)),
|
|
1135
|
+
orientation: Ot(xe(), v),
|
|
1136
|
+
color: _,
|
|
1137
|
+
diffuse: g,
|
|
1138
|
+
size: E,
|
|
1127
1139
|
minSizePixels: T,
|
|
1128
1140
|
maxSizePixels: R,
|
|
1129
|
-
index:
|
|
1141
|
+
index: A
|
|
1130
1142
|
});
|
|
1131
1143
|
}, l = me(
|
|
1132
1144
|
() => t.mesh?.(),
|
|
1133
1145
|
(d) => {
|
|
1134
|
-
const { vertices: m = [], indices:
|
|
1135
|
-
r.set(m.flatMap((
|
|
1136
|
-
|
|
1137
|
-
), i =
|
|
1146
|
+
const { vertices: m = [], indices: y = [], normals: w = [] } = d ?? {};
|
|
1147
|
+
r.set(m.flatMap((x) => [...x])), s.set(y.flatMap((x) => [...x])), o.set(
|
|
1148
|
+
w.length === 0 ? m.flatMap(() => [0, 0, 0]) : w.flatMap((x) => [...x])
|
|
1149
|
+
), i = y.length * 3;
|
|
1138
1150
|
}
|
|
1139
1151
|
), u = () => {
|
|
1140
1152
|
r.dispose(), s.dispose(), o.dispose();
|
|
@@ -1153,14 +1165,14 @@ const Ui = (e, t = {}) => {
|
|
|
1153
1165
|
const f = t.get({
|
|
1154
1166
|
vertexSource: Pn,
|
|
1155
1167
|
fragmentSource: a ? Re : Un
|
|
1156
|
-
}), l = f.attribute3f("vertex", n), u = f.attribute3f("normal", r), h = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"),
|
|
1168
|
+
}), l = f.attribute3f("vertex", n), u = f.attribute3f("normal", r), h = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), y = f.uniform3i("position"), w = f.uniformMatrix4f("orientation"), x = f.uniform2f("screen"), A = f.uniform4f("color"), p = f.uniform4f("diffuse"), v = f.uniform1f("size"), _ = f.uniform1f("min_size_pixels"), g = f.uniform1f("max_size_pixels"), E = f.uniform1i("index");
|
|
1157
1169
|
return { execute: ({
|
|
1158
1170
|
projection: R,
|
|
1159
|
-
modelView:
|
|
1160
|
-
camera:
|
|
1171
|
+
modelView: M,
|
|
1172
|
+
camera: b,
|
|
1161
1173
|
screen: P,
|
|
1162
1174
|
count: U,
|
|
1163
|
-
position:
|
|
1175
|
+
position: S,
|
|
1164
1176
|
orientation: N,
|
|
1165
1177
|
color: D,
|
|
1166
1178
|
diffuse: j,
|
|
@@ -1169,12 +1181,12 @@ const Ui = (e, t = {}) => {
|
|
|
1169
1181
|
maxSizePixels: G,
|
|
1170
1182
|
index: Z
|
|
1171
1183
|
}) => {
|
|
1172
|
-
f.use(), l.use(), u.use(), h.set(R), d.set(
|
|
1184
|
+
f.use(), l.use(), u.use(), h.set(R), d.set(M), m.set(b), x.set(P), y.set(S), w.set(N), A.set(D), p.set(j), v.set(X), _.set(C), g.set(G), E.set(Z), i.use(), e.drawElements(e.TRIANGLES, U, e.UNSIGNED_SHORT, 0);
|
|
1173
1185
|
} };
|
|
1174
1186
|
}, o = s(), c = s(!0);
|
|
1175
1187
|
return { renderProgram: o, depthProgram: c };
|
|
1176
1188
|
};
|
|
1177
|
-
var
|
|
1189
|
+
var pt = function(e, t, n, i, r) {
|
|
1178
1190
|
let s, o = null;
|
|
1179
1191
|
if (r === kn(e, t, n, i) > 0)
|
|
1180
1192
|
for (s = t; s < n; s += i)
|
|
@@ -1268,7 +1280,7 @@ var vt = function(e, t, n, i, r) {
|
|
|
1268
1280
|
const r = [];
|
|
1269
1281
|
let s, o, c, a, f;
|
|
1270
1282
|
for (s = 0, o = t.length; s < o; s++)
|
|
1271
|
-
c = t[s] * i, a = s < o - 1 ? t[s + 1] * i : e.length, f =
|
|
1283
|
+
c = t[s] * i, a = s < o - 1 ? t[s + 1] * i : e.length, f = pt(e, c, a, i, !1), f === f.next && (f.steiner = !0), r.push(Zn(f));
|
|
1272
1284
|
for (r.sort(Cn), s = 0; s < r.length; s++)
|
|
1273
1285
|
n = Xn(r[s], n), n = oe(n, n.next);
|
|
1274
1286
|
return n;
|
|
@@ -1398,7 +1410,7 @@ class Ce {
|
|
|
1398
1410
|
}
|
|
1399
1411
|
function Hn(e, t = [], n = 2) {
|
|
1400
1412
|
const i = t.length > 0, r = i ? t[0] * n : e.length;
|
|
1401
|
-
let s =
|
|
1413
|
+
let s = pt(e, 0, r, n, !0);
|
|
1402
1414
|
const o = [];
|
|
1403
1415
|
if (s === null || s.next === s.prev)
|
|
1404
1416
|
return o;
|
|
@@ -1541,26 +1553,26 @@ const Pi = (e, t = {}) => {
|
|
|
1541
1553
|
positionBuffer: r,
|
|
1542
1554
|
indexBuffer: s
|
|
1543
1555
|
}), a = ({
|
|
1544
|
-
viewport: { projection: h, modelView: d, camera: m, screen:
|
|
1545
|
-
depth:
|
|
1546
|
-
index:
|
|
1556
|
+
viewport: { projection: h, modelView: d, camera: m, screen: y },
|
|
1557
|
+
depth: w = !1,
|
|
1558
|
+
index: x = 0
|
|
1547
1559
|
}) => {
|
|
1548
|
-
const
|
|
1549
|
-
if (f(), ge(n,
|
|
1560
|
+
const A = t.color?.() ?? [1, 1, 1, 1];
|
|
1561
|
+
if (f(), ge(n, w, t))
|
|
1550
1562
|
return;
|
|
1551
|
-
(
|
|
1563
|
+
(w ? c : o).execute({
|
|
1552
1564
|
projection: h,
|
|
1553
1565
|
modelView: d,
|
|
1554
1566
|
camera: Q(m),
|
|
1555
|
-
screen:
|
|
1567
|
+
screen: y,
|
|
1556
1568
|
count: i,
|
|
1557
|
-
color:
|
|
1558
|
-
index:
|
|
1569
|
+
color: A,
|
|
1570
|
+
index: x
|
|
1559
1571
|
});
|
|
1560
1572
|
}, f = me(
|
|
1561
1573
|
() => t.points?.() ?? [],
|
|
1562
1574
|
(h) => {
|
|
1563
|
-
const { vertices: d, indices: m } = h.length > 0 ? Gn(h.map((
|
|
1575
|
+
const { vertices: d, indices: m } = h.length > 0 ? Gn(h.map((y) => y.map((w) => [...Q(L(w))]))) : { vertices: [], indices: [] };
|
|
1564
1576
|
r.set(d), s.set(m), i = m.length;
|
|
1565
1577
|
}
|
|
1566
1578
|
), l = () => {
|
|
@@ -1581,17 +1593,17 @@ const Pi = (e, t = {}) => {
|
|
|
1581
1593
|
fragmentSource: c ? Re : qn
|
|
1582
1594
|
}), f = a.attribute3i("position", n, {
|
|
1583
1595
|
stride: 3 * Int32Array.BYTES_PER_ELEMENT
|
|
1584
|
-
}), l = a.uniformMatrix4f("projection"), u = a.uniformMatrix4f("model_view"), h = a.uniform3i("camera"), d = a.uniform2f("screen"), m = a.uniform4f("color"),
|
|
1596
|
+
}), l = a.uniformMatrix4f("projection"), u = a.uniformMatrix4f("model_view"), h = a.uniform3i("camera"), d = a.uniform2f("screen"), m = a.uniform4f("color"), y = a.uniform1i("index");
|
|
1585
1597
|
return { execute: ({
|
|
1586
|
-
projection:
|
|
1587
|
-
modelView:
|
|
1588
|
-
camera:
|
|
1589
|
-
screen:
|
|
1590
|
-
count:
|
|
1591
|
-
color:
|
|
1592
|
-
index:
|
|
1598
|
+
projection: x,
|
|
1599
|
+
modelView: A,
|
|
1600
|
+
camera: p,
|
|
1601
|
+
screen: v,
|
|
1602
|
+
count: _,
|
|
1603
|
+
color: g,
|
|
1604
|
+
index: E
|
|
1593
1605
|
}) => {
|
|
1594
|
-
|
|
1606
|
+
_ !== 0 && (a.use(), f.use(), l.set(x), u.set(A), h.set(p), d.set(v), m.set(g), y.set(E), i.use(), e.drawElements(e.TRIANGLES, _, e.UNSIGNED_SHORT, 0));
|
|
1595
1607
|
} };
|
|
1596
1608
|
}, s = r(), o = r(!0);
|
|
1597
1609
|
return { renderProgram: s, depthProgram: o };
|
|
@@ -1676,8 +1688,8 @@ class Qe {
|
|
|
1676
1688
|
// set defaults for various methods.
|
|
1677
1689
|
#c;
|
|
1678
1690
|
#h;
|
|
1679
|
-
#p;
|
|
1680
1691
|
#v;
|
|
1692
|
+
#p;
|
|
1681
1693
|
#U;
|
|
1682
1694
|
/**
|
|
1683
1695
|
* {@link LRUCache.OptionsBase.ttl}
|
|
@@ -1828,37 +1840,37 @@ class Qe {
|
|
|
1828
1840
|
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
|
1829
1841
|
*/
|
|
1830
1842
|
get dispose() {
|
|
1831
|
-
return this.#
|
|
1843
|
+
return this.#v;
|
|
1832
1844
|
}
|
|
1833
1845
|
/**
|
|
1834
1846
|
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
1835
1847
|
*/
|
|
1836
1848
|
get disposeAfter() {
|
|
1837
|
-
return this.#
|
|
1849
|
+
return this.#p;
|
|
1838
1850
|
}
|
|
1839
1851
|
constructor(t) {
|
|
1840
|
-
const { max: n = 0, ttl: i, ttlResolution: r = 1, ttlAutopurge: s, updateAgeOnGet: o, updateAgeOnHas: c, allowStale: a, dispose: f, disposeAfter: l, noDisposeOnSet: u, noUpdateTTL: h, maxSize: d = 0, maxEntrySize: m = 0, sizeCalculation:
|
|
1852
|
+
const { max: n = 0, ttl: i, ttlResolution: r = 1, ttlAutopurge: s, updateAgeOnGet: o, updateAgeOnHas: c, allowStale: a, dispose: f, disposeAfter: l, noDisposeOnSet: u, noUpdateTTL: h, maxSize: d = 0, maxEntrySize: m = 0, sizeCalculation: y, fetchMethod: w, noDeleteOnFetchRejection: x, noDeleteOnStaleGet: A, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: v, ignoreFetchAbort: _ } = t;
|
|
1841
1853
|
if (n !== 0 && !q(n))
|
|
1842
1854
|
throw new TypeError("max option must be a nonnegative integer");
|
|
1843
|
-
const
|
|
1844
|
-
if (!
|
|
1855
|
+
const g = n ? wt(n) : Array;
|
|
1856
|
+
if (!g)
|
|
1845
1857
|
throw new Error("invalid max value: " + n);
|
|
1846
|
-
if (this.#c = n, this.#h = d, this.maxEntrySize = m || this.#h, this.sizeCalculation =
|
|
1858
|
+
if (this.#c = n, this.#h = d, this.maxEntrySize = m || this.#h, this.sizeCalculation = y, this.sizeCalculation) {
|
|
1847
1859
|
if (!this.#h && !this.maxEntrySize)
|
|
1848
1860
|
throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
1849
1861
|
if (typeof this.sizeCalculation != "function")
|
|
1850
1862
|
throw new TypeError("sizeCalculation set to non-function");
|
|
1851
1863
|
}
|
|
1852
|
-
if (
|
|
1864
|
+
if (w !== void 0 && typeof w != "function")
|
|
1853
1865
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
1854
|
-
if (this.#U =
|
|
1866
|
+
if (this.#U = w, this.#A = !!w, this.#i = /* @__PURE__ */ new Map(), this.#n = new Array(n).fill(void 0), this.#e = new Array(n).fill(void 0), this.#f = new g(n), this.#u = new g(n), this.#a = 0, this.#s = 0, this.#E = ue.create(n), this.#r = 0, this.#x = 0, typeof f == "function" && (this.#v = f), typeof l == "function" ? (this.#p = l, this.#o = []) : (this.#p = void 0, this.#o = void 0), this.#w = !!this.#v, this.#l = !!this.#p, this.noDisposeOnSet = !!u, this.noUpdateTTL = !!h, this.noDeleteOnFetchRejection = !!x, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!v, this.ignoreFetchAbort = !!_, this.maxEntrySize !== 0) {
|
|
1855
1867
|
if (this.#h !== 0 && !q(this.#h))
|
|
1856
1868
|
throw new TypeError("maxSize must be a positive integer if specified");
|
|
1857
1869
|
if (!q(this.maxEntrySize))
|
|
1858
1870
|
throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
1859
1871
|
this.#X();
|
|
1860
1872
|
}
|
|
1861
|
-
if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!
|
|
1873
|
+
if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!A, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!c, this.ttlResolution = q(r) || r === 0 ? r : 1, this.ttlAutopurge = !!s, this.ttl = i || 0, this.ttl) {
|
|
1862
1874
|
if (!q(this.ttl))
|
|
1863
1875
|
throw new TypeError("ttl must be a positive integer if specified");
|
|
1864
1876
|
this.#N();
|
|
@@ -1866,8 +1878,8 @@ class Qe {
|
|
|
1866
1878
|
if (this.#c === 0 && this.ttl === 0 && this.#h === 0)
|
|
1867
1879
|
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
1868
1880
|
if (!this.ttlAutopurge && !this.#c && !this.#h) {
|
|
1869
|
-
const
|
|
1870
|
-
ti(
|
|
1881
|
+
const E = "LRU_CACHE_UNBOUNDED";
|
|
1882
|
+
ti(E) && (_t.add(E), yt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E, Qe));
|
|
1871
1883
|
}
|
|
1872
1884
|
}
|
|
1873
1885
|
/**
|
|
@@ -1885,7 +1897,7 @@ class Qe {
|
|
|
1885
1897
|
}, o + 1);
|
|
1886
1898
|
a.unref && a.unref();
|
|
1887
1899
|
}
|
|
1888
|
-
}, this.#
|
|
1900
|
+
}, this.#M = (s) => {
|
|
1889
1901
|
n[s] = t[s] !== 0 ? fe.now() : 0;
|
|
1890
1902
|
}, this.#R = (s, o) => {
|
|
1891
1903
|
if (t[o]) {
|
|
@@ -1922,7 +1934,7 @@ class Qe {
|
|
|
1922
1934
|
};
|
|
1923
1935
|
}
|
|
1924
1936
|
// conditionally set private methods related to TTL
|
|
1925
|
-
#
|
|
1937
|
+
#M = () => {
|
|
1926
1938
|
};
|
|
1927
1939
|
#R = () => {
|
|
1928
1940
|
};
|
|
@@ -1932,7 +1944,7 @@ class Qe {
|
|
|
1932
1944
|
#m = () => !1;
|
|
1933
1945
|
#X() {
|
|
1934
1946
|
const t = new De(this.#c);
|
|
1935
|
-
this.#x = 0, this.#_ = t, this.#
|
|
1947
|
+
this.#x = 0, this.#_ = t, this.#b = (n) => {
|
|
1936
1948
|
this.#x -= t[n], t[n] = 0;
|
|
1937
1949
|
}, this.#D = (n, i, r, s) => {
|
|
1938
1950
|
if (this.#t(i))
|
|
@@ -1955,7 +1967,7 @@ class Qe {
|
|
|
1955
1967
|
this.#x += t[n], r && (r.entrySize = i, r.totalCalculatedSize = this.#x);
|
|
1956
1968
|
};
|
|
1957
1969
|
}
|
|
1958
|
-
#
|
|
1970
|
+
#b = (t) => {
|
|
1959
1971
|
};
|
|
1960
1972
|
#P = (t, n, i) => {
|
|
1961
1973
|
};
|
|
@@ -2172,10 +2184,10 @@ class Qe {
|
|
|
2172
2184
|
if (this.#A && this.#t(h)) {
|
|
2173
2185
|
h.__abortController.abort(new Error("replaced"));
|
|
2174
2186
|
const { __staleWhileFetching: d } = h;
|
|
2175
|
-
d !== void 0 && !o && (this.#w && this.#
|
|
2187
|
+
d !== void 0 && !o && (this.#w && this.#v?.(d, t, "set"), this.#l && this.#o?.push([d, t, "set"]));
|
|
2176
2188
|
} else
|
|
2177
|
-
o || (this.#w && this.#
|
|
2178
|
-
if (this.#
|
|
2189
|
+
o || (this.#w && this.#v?.(h, t, "set"), this.#l && this.#o?.push([h, t, "set"]));
|
|
2190
|
+
if (this.#b(u), this.#P(u, l, a), this.#e[u] = n, a) {
|
|
2179
2191
|
a.set = "replace";
|
|
2180
2192
|
const d = h && this.#t(h) ? h.__staleWhileFetching : h;
|
|
2181
2193
|
d !== void 0 && (a.oldValue = d);
|
|
@@ -2187,7 +2199,7 @@ class Qe {
|
|
|
2187
2199
|
const h = this.#o;
|
|
2188
2200
|
let d;
|
|
2189
2201
|
for (; d = h?.shift(); )
|
|
2190
|
-
this.#
|
|
2202
|
+
this.#p?.(...d);
|
|
2191
2203
|
}
|
|
2192
2204
|
return this;
|
|
2193
2205
|
}
|
|
@@ -2210,13 +2222,13 @@ class Qe {
|
|
|
2210
2222
|
const t = this.#o;
|
|
2211
2223
|
let n;
|
|
2212
2224
|
for (; n = t?.shift(); )
|
|
2213
|
-
this.#
|
|
2225
|
+
this.#p?.(...n);
|
|
2214
2226
|
}
|
|
2215
2227
|
}
|
|
2216
2228
|
}
|
|
2217
2229
|
#z(t) {
|
|
2218
2230
|
const n = this.#a, i = this.#n[n], r = this.#e[n];
|
|
2219
|
-
return this.#A && this.#t(r) ? r.__abortController.abort(new Error("evicted")) : (this.#w || this.#l) && (this.#w && this.#
|
|
2231
|
+
return this.#A && this.#t(r) ? r.__abortController.abort(new Error("evicted")) : (this.#w || this.#l) && (this.#w && this.#v?.(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;
|
|
2220
2232
|
}
|
|
2221
2233
|
/**
|
|
2222
2234
|
* Check if a key is in the cache, without updating the recency of use.
|
|
@@ -2235,7 +2247,7 @@ class Qe {
|
|
|
2235
2247
|
if (this.#m(s))
|
|
2236
2248
|
r && (r.has = "stale", this.#R(r, s));
|
|
2237
2249
|
else
|
|
2238
|
-
return i && this.#
|
|
2250
|
+
return i && this.#M(s), r && (r.has = "hit", this.#R(r, s)), !0;
|
|
2239
2251
|
} else
|
|
2240
2252
|
r && (r.has = "miss");
|
|
2241
2253
|
return !1;
|
|
@@ -2266,22 +2278,22 @@ class Qe {
|
|
|
2266
2278
|
signal: o.signal,
|
|
2267
2279
|
options: i,
|
|
2268
2280
|
context: r
|
|
2269
|
-
}, f = (
|
|
2270
|
-
const { aborted:
|
|
2271
|
-
if (i.status && (
|
|
2281
|
+
}, f = (y, w = !1) => {
|
|
2282
|
+
const { aborted: x } = o.signal, A = i.ignoreFetchAbort && y !== void 0;
|
|
2283
|
+
if (i.status && (x && !w ? (i.status.fetchAborted = !0, i.status.fetchError = o.signal.reason, A && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), x && !A && !w)
|
|
2272
2284
|
return u(o.signal.reason);
|
|
2273
|
-
const
|
|
2274
|
-
return this.#e[n] === d && (
|
|
2275
|
-
}, l = (
|
|
2276
|
-
const { aborted:
|
|
2277
|
-
if (this.#e[n] === d && (!
|
|
2278
|
-
return i.status &&
|
|
2279
|
-
if (
|
|
2280
|
-
throw
|
|
2281
|
-
}, h = (
|
|
2282
|
-
const
|
|
2283
|
-
|
|
2284
|
-
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (
|
|
2285
|
+
const p = d;
|
|
2286
|
+
return this.#e[n] === d && (y === void 0 ? p.__staleWhileFetching ? this.#e[n] = p.__staleWhileFetching : this.delete(t) : (i.status && (i.status.fetchUpdated = !0), this.set(t, y, a.options))), y;
|
|
2287
|
+
}, l = (y) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = y), u(y)), u = (y) => {
|
|
2288
|
+
const { aborted: w } = o.signal, x = w && i.allowStaleOnFetchAbort, A = x || i.allowStaleOnFetchRejection, p = A || i.noDeleteOnFetchRejection, v = d;
|
|
2289
|
+
if (this.#e[n] === d && (!p || v.__staleWhileFetching === void 0 ? this.delete(t) : x || (this.#e[n] = v.__staleWhileFetching)), A)
|
|
2290
|
+
return i.status && v.__staleWhileFetching !== void 0 && (i.status.returnedStale = !0), v.__staleWhileFetching;
|
|
2291
|
+
if (v.__returned === v)
|
|
2292
|
+
throw y;
|
|
2293
|
+
}, h = (y, w) => {
|
|
2294
|
+
const x = this.#U?.(t, s, a);
|
|
2295
|
+
x && x instanceof Promise && x.then((A) => y(A === void 0 ? void 0 : A), w), o.signal.addEventListener("abort", () => {
|
|
2296
|
+
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (y(void 0), i.allowStaleOnFetchAbort && (y = (A) => f(A, !0)));
|
|
2285
2297
|
});
|
|
2286
2298
|
};
|
|
2287
2299
|
i.status && (i.status.fetchDispatched = !0);
|
|
@@ -2315,19 +2327,19 @@ class Qe {
|
|
|
2315
2327
|
allowStaleOnFetchRejection: h = this.allowStaleOnFetchRejection,
|
|
2316
2328
|
ignoreFetchAbort: d = this.ignoreFetchAbort,
|
|
2317
2329
|
allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort,
|
|
2318
|
-
context:
|
|
2319
|
-
forceRefresh:
|
|
2320
|
-
status:
|
|
2321
|
-
signal:
|
|
2330
|
+
context: y,
|
|
2331
|
+
forceRefresh: w = !1,
|
|
2332
|
+
status: x,
|
|
2333
|
+
signal: A
|
|
2322
2334
|
} = n;
|
|
2323
2335
|
if (!this.#A)
|
|
2324
|
-
return
|
|
2336
|
+
return x && (x.fetch = "get"), this.get(t, {
|
|
2325
2337
|
allowStale: i,
|
|
2326
2338
|
updateAgeOnGet: r,
|
|
2327
2339
|
noDeleteOnStaleGet: s,
|
|
2328
|
-
status:
|
|
2340
|
+
status: x
|
|
2329
2341
|
});
|
|
2330
|
-
const
|
|
2342
|
+
const p = {
|
|
2331
2343
|
allowStale: i,
|
|
2332
2344
|
updateAgeOnGet: r,
|
|
2333
2345
|
noDeleteOnStaleGet: s,
|
|
@@ -2340,25 +2352,25 @@ class Qe {
|
|
|
2340
2352
|
allowStaleOnFetchRejection: h,
|
|
2341
2353
|
allowStaleOnFetchAbort: m,
|
|
2342
2354
|
ignoreFetchAbort: d,
|
|
2343
|
-
status:
|
|
2344
|
-
signal:
|
|
2355
|
+
status: x,
|
|
2356
|
+
signal: A
|
|
2345
2357
|
};
|
|
2346
|
-
let
|
|
2347
|
-
if (
|
|
2348
|
-
|
|
2349
|
-
const
|
|
2350
|
-
return
|
|
2358
|
+
let v = this.#i.get(t);
|
|
2359
|
+
if (v === void 0) {
|
|
2360
|
+
x && (x.fetch = "miss");
|
|
2361
|
+
const _ = this.#L(t, v, p, y);
|
|
2362
|
+
return _.__returned = _;
|
|
2351
2363
|
} else {
|
|
2352
|
-
const
|
|
2353
|
-
if (this.#t(
|
|
2354
|
-
const
|
|
2355
|
-
return
|
|
2364
|
+
const _ = this.#e[v];
|
|
2365
|
+
if (this.#t(_)) {
|
|
2366
|
+
const M = i && _.__staleWhileFetching !== void 0;
|
|
2367
|
+
return x && (x.fetch = "inflight", M && (x.returnedStale = !0)), M ? _.__staleWhileFetching : _.__returned = _;
|
|
2356
2368
|
}
|
|
2357
|
-
const
|
|
2358
|
-
if (!
|
|
2359
|
-
return
|
|
2360
|
-
const
|
|
2361
|
-
return
|
|
2369
|
+
const g = this.#m(v);
|
|
2370
|
+
if (!w && !g)
|
|
2371
|
+
return x && (x.fetch = "hit"), this.#S(v), r && this.#M(v), x && this.#R(x, v), _;
|
|
2372
|
+
const E = this.#L(t, v, p, y), R = E.__staleWhileFetching !== void 0 && i;
|
|
2373
|
+
return x && (x.fetch = g ? "stale" : "refresh", R && g && (x.returnedStale = !0)), R ? E.__staleWhileFetching : E.__returned = E;
|
|
2362
2374
|
}
|
|
2363
2375
|
}
|
|
2364
2376
|
/**
|
|
@@ -2371,7 +2383,7 @@ class Qe {
|
|
|
2371
2383
|
const { allowStale: i = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: s = this.noDeleteOnStaleGet, status: o } = n, c = this.#i.get(t);
|
|
2372
2384
|
if (c !== void 0) {
|
|
2373
2385
|
const a = this.#e[c], f = this.#t(a);
|
|
2374
|
-
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.#
|
|
2386
|
+
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));
|
|
2375
2387
|
} else
|
|
2376
2388
|
o && (o.get = "miss");
|
|
2377
2389
|
}
|
|
@@ -2393,9 +2405,9 @@ class Qe {
|
|
|
2393
2405
|
if (n = !0, this.#r === 1)
|
|
2394
2406
|
this.clear();
|
|
2395
2407
|
else {
|
|
2396
|
-
this.#
|
|
2408
|
+
this.#b(i);
|
|
2397
2409
|
const r = this.#e[i];
|
|
2398
|
-
if (this.#t(r) ? r.__abortController.abort(new Error("deleted")) : (this.#w || this.#l) && (this.#w && this.#
|
|
2410
|
+
if (this.#t(r) ? r.__abortController.abort(new Error("deleted")) : (this.#w || this.#l) && (this.#w && this.#v?.(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)
|
|
2399
2411
|
this.#s = this.#u[i];
|
|
2400
2412
|
else if (i === this.#a)
|
|
2401
2413
|
this.#a = this.#f[i];
|
|
@@ -2412,7 +2424,7 @@ class Qe {
|
|
|
2412
2424
|
const i = this.#o;
|
|
2413
2425
|
let r;
|
|
2414
2426
|
for (; r = i?.shift(); )
|
|
2415
|
-
this.#
|
|
2427
|
+
this.#p?.(...r);
|
|
2416
2428
|
}
|
|
2417
2429
|
return n;
|
|
2418
2430
|
}
|
|
@@ -2426,14 +2438,14 @@ class Qe {
|
|
|
2426
2438
|
n.__abortController.abort(new Error("deleted"));
|
|
2427
2439
|
else {
|
|
2428
2440
|
const i = this.#n[t];
|
|
2429
|
-
this.#w && this.#
|
|
2441
|
+
this.#w && this.#v?.(n, i, "delete"), this.#l && this.#o?.push([n, i, "delete"]);
|
|
2430
2442
|
}
|
|
2431
2443
|
}
|
|
2432
2444
|
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) {
|
|
2433
2445
|
const t = this.#o;
|
|
2434
2446
|
let n;
|
|
2435
2447
|
for (; n = t?.shift(); )
|
|
2436
|
-
this.#
|
|
2448
|
+
this.#p?.(...n);
|
|
2437
2449
|
}
|
|
2438
2450
|
}
|
|
2439
2451
|
}
|
|
@@ -2468,22 +2480,22 @@ const We = (e) => {
|
|
|
2468
2480
|
const u = i.get([a, f, l]);
|
|
2469
2481
|
if (!u)
|
|
2470
2482
|
return;
|
|
2471
|
-
const { texture: h, downsample: d } = u, m = 2 ** d,
|
|
2472
|
-
if (
|
|
2473
|
-
return { buffer:
|
|
2474
|
-
const
|
|
2475
|
-
return e.bindFramebuffer(e.FRAMEBUFFER, r), h.attach(), e.readPixels(0, 0, te, te, e.RGBA, e.UNSIGNED_BYTE,
|
|
2483
|
+
const { texture: h, downsample: d } = u, m = 2 ** d, y = [Math.floor(a / m), Math.floor(f / m), l - d], w = n.get(y);
|
|
2484
|
+
if (w)
|
|
2485
|
+
return { buffer: w, downsample: d };
|
|
2486
|
+
const x = new Uint8Array(4 * te * te);
|
|
2487
|
+
return e.bindFramebuffer(e.FRAMEBUFFER, r), h.attach(), e.readPixels(0, 0, te, te, e.RGBA, e.UNSIGNED_BYTE, x), e.bindFramebuffer(e.FRAMEBUFFER, null), n.set(y, x), { buffer: x, downsample: d };
|
|
2476
2488
|
};
|
|
2477
2489
|
return { get: ([a = 0, f = 0], l = ni) => {
|
|
2478
|
-
const u = 2 ** l, h = L([a, f, 0]).map((
|
|
2479
|
-
let [
|
|
2480
|
-
const
|
|
2481
|
-
if (!
|
|
2490
|
+
const u = 2 ** l, h = L([a, f, 0]).map((M) => M * u), [d = 0, m = 0] = h.map((M) => Math.floor(M % u));
|
|
2491
|
+
let [y = 0, w = 0] = h.map((M) => M % 1);
|
|
2492
|
+
const x = s([d, m, l]);
|
|
2493
|
+
if (!x)
|
|
2482
2494
|
return 0;
|
|
2483
|
-
const { buffer:
|
|
2484
|
-
[
|
|
2485
|
-
const
|
|
2486
|
-
return (
|
|
2495
|
+
const { buffer: A, downsample: p } = x, v = 2 ** p;
|
|
2496
|
+
[y, w] = [(d % v + y) / v, (m % v + w) / v];
|
|
2497
|
+
const _ = 4 * te * Math.floor(w * te) + 4 * Math.floor(y * te), [g = 0, E = 0, T = 0] = A.slice(_, _ + 4);
|
|
2498
|
+
return (g * 65536 + E * 256 + T) / 10 - 1e4;
|
|
2487
2499
|
}, dispose: () => {
|
|
2488
2500
|
e.deleteFramebuffer(r);
|
|
2489
2501
|
} };
|
|
@@ -2522,7 +2534,7 @@ const lt = ({
|
|
|
2522
2534
|
return r.delete(a), f;
|
|
2523
2535
|
r.set(a, !0);
|
|
2524
2536
|
} else {
|
|
2525
|
-
const [l, u, h] = a, d = t.replace("{x}", `${l}`).replace("{y}", `${u}`).replace("{z}", `${h}`), m =
|
|
2537
|
+
const [l, u, h] = a, d = t.replace("{x}", `${l}`).replace("{y}", `${u}`).replace("{z}", `${h}`), m = vt({
|
|
2526
2538
|
gl: e,
|
|
2527
2539
|
url: d,
|
|
2528
2540
|
onLoad: () => {
|
|
@@ -2549,7 +2561,7 @@ const lt = ({
|
|
|
2549
2561
|
const s = t.get(r);
|
|
2550
2562
|
if (s)
|
|
2551
2563
|
return s;
|
|
2552
|
-
const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0, u = 0]) => [o + l, c + u, a]).map((l) =>
|
|
2564
|
+
const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0, u = 0]) => [o + l, c + u, a]).map((l) => vn(l, l)).map((l) => se(l, l)).map((l) => {
|
|
2553
2565
|
const [u = 0, h = 0] = l, d = Math.max(a - 5, 0);
|
|
2554
2566
|
return L(
|
|
2555
2567
|
we(l, u, h, e.get([u, h], d)),
|
|
@@ -2615,10 +2627,10 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2615
2627
|
let i, r;
|
|
2616
2628
|
const s = me(
|
|
2617
2629
|
() => t.imageryUrl?.() ?? "",
|
|
2618
|
-
(
|
|
2630
|
+
(E) => {
|
|
2619
2631
|
i?.dispose(), i = lt({
|
|
2620
2632
|
gl: n,
|
|
2621
|
-
urlPattern:
|
|
2633
|
+
urlPattern: E,
|
|
2622
2634
|
onLoad: () => {
|
|
2623
2635
|
const T = n.getExtension("EXT_texture_filter_anisotropic");
|
|
2624
2636
|
if (T) {
|
|
@@ -2646,84 +2658,84 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2646
2658
|
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);
|
|
2647
2659
|
}
|
|
2648
2660
|
}), a = Fe(c, 3), f = ii({ gl: n, terrainCache: c }), l = si(f), u = V({ gl: n, type: "f32", target: "array" });
|
|
2649
|
-
u.set(fi.flatMap(([
|
|
2661
|
+
u.set(fi.flatMap(([E = 0, T = 0, R = 0]) => [E, T, R]));
|
|
2650
2662
|
const h = V({ gl: n, type: "u16", target: "element" });
|
|
2651
2663
|
h.set(ci);
|
|
2652
2664
|
const { renderProgram: d, depthProgram: m } = li(e, {
|
|
2653
2665
|
uvwBuffer: u,
|
|
2654
2666
|
indexBuffer: h
|
|
2655
|
-
}),
|
|
2656
|
-
const { camera: T, worldToLocal: R, localToClip:
|
|
2657
|
-
const [
|
|
2667
|
+
}), y = [0, 1, 2, 3], w = y.map(z), x = y.map(ee), A = y.map(de), p = (E) => {
|
|
2668
|
+
const { camera: T, worldToLocal: R, localToClip: M, clipToScreen: b } = E, P = (U) => {
|
|
2669
|
+
const [S = 0, N = 0, D = 0] = U, j = l.get(U);
|
|
2658
2670
|
let X = hi(T, j);
|
|
2659
2671
|
if (!X) {
|
|
2660
|
-
const C = j.map((Z, $) => R(Z,
|
|
2672
|
+
const C = j.map((Z, $) => R(Z, w[$])).map((Z, $) => M(Z, x[$]));
|
|
2661
2673
|
if (ui(C))
|
|
2662
2674
|
return [];
|
|
2663
|
-
X = di(C.map((Z, $) =>
|
|
2675
|
+
X = di(C.map((Z, $) => b(Z, A[$]))) > 512 / devicePixelRatio;
|
|
2664
2676
|
}
|
|
2665
2677
|
return X && D < ai ? [
|
|
2666
|
-
[2 *
|
|
2667
|
-
[2 *
|
|
2668
|
-
[2 *
|
|
2669
|
-
[2 *
|
|
2678
|
+
[2 * S, 2 * N, D + 1],
|
|
2679
|
+
[2 * S + 1, 2 * N, D + 1],
|
|
2680
|
+
[2 * S, 2 * N + 1, D + 1],
|
|
2681
|
+
[2 * S + 1, 2 * N + 1, D + 1]
|
|
2670
2682
|
].flatMap((G) => P(G)) : [U];
|
|
2671
2683
|
};
|
|
2672
2684
|
return P([0, 0, 0]);
|
|
2673
|
-
},
|
|
2674
|
-
viewport:
|
|
2685
|
+
}, v = ({
|
|
2686
|
+
viewport: E,
|
|
2675
2687
|
depth: T = !1,
|
|
2676
2688
|
index: R = 0
|
|
2677
2689
|
}) => {
|
|
2678
|
-
const
|
|
2690
|
+
const M = t.color?.() ?? [1, 1, 1, 1];
|
|
2679
2691
|
if (s(), ge(n, T, t))
|
|
2680
2692
|
return;
|
|
2681
|
-
const
|
|
2693
|
+
const b = T ? m : d, { projection: P, modelView: U, camera: S } = E, N = p(E);
|
|
2682
2694
|
for (const D of N) {
|
|
2683
2695
|
const j = T ? void 0 : r?.get(D), X = a.get(D);
|
|
2684
2696
|
if (!T && !j || !X)
|
|
2685
2697
|
continue;
|
|
2686
2698
|
const { texture: C, downsample: G } = X, { texture: Z = C, downsample: $ = 0 } = j ?? {};
|
|
2687
|
-
|
|
2699
|
+
b.execute({
|
|
2688
2700
|
projection: P,
|
|
2689
2701
|
modelView: U,
|
|
2690
|
-
camera: Q(
|
|
2702
|
+
camera: Q(S),
|
|
2691
2703
|
xyz: D,
|
|
2692
2704
|
imagery: Z,
|
|
2693
2705
|
terrain: C,
|
|
2694
2706
|
downsampleImagery: $,
|
|
2695
2707
|
downsampleTerrain: G,
|
|
2696
|
-
color:
|
|
2708
|
+
color: M,
|
|
2697
2709
|
index: R
|
|
2698
2710
|
});
|
|
2699
2711
|
}
|
|
2700
|
-
},
|
|
2712
|
+
}, _ = () => {
|
|
2701
2713
|
i?.dispose(), c.dispose(), f.dispose();
|
|
2702
|
-
},
|
|
2714
|
+
}, g = Ae(t);
|
|
2703
2715
|
return {
|
|
2704
|
-
render:
|
|
2705
|
-
dispose:
|
|
2706
|
-
...
|
|
2716
|
+
render: v,
|
|
2717
|
+
dispose: _,
|
|
2718
|
+
...g
|
|
2707
2719
|
};
|
|
2708
2720
|
}, li = ({ gl: e, programs: t }, { uvwBuffer: n, indexBuffer: i }) => {
|
|
2709
2721
|
const r = (c = !1) => {
|
|
2710
2722
|
const a = t.get({
|
|
2711
2723
|
vertexSource: oi,
|
|
2712
2724
|
fragmentSource: c ? Re : ri
|
|
2713
|
-
}), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"), u = a.uniformMatrix4f("model_view"), h = a.uniform1i("imagery"), d = a.uniform1i("terrain"), m = a.uniform1i("downsample_imagery"),
|
|
2725
|
+
}), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"), u = a.uniformMatrix4f("model_view"), h = a.uniform1i("imagery"), d = a.uniform1i("terrain"), m = a.uniform1i("downsample_imagery"), y = a.uniform1i("downsample_terrain"), w = a.uniform4f("color"), x = a.uniform3i("xyz"), A = a.uniform3i("camera"), p = a.uniform1i("index");
|
|
2714
2726
|
return { execute: ({
|
|
2715
|
-
projection:
|
|
2716
|
-
modelView:
|
|
2717
|
-
camera:
|
|
2727
|
+
projection: _,
|
|
2728
|
+
modelView: g,
|
|
2729
|
+
camera: E,
|
|
2718
2730
|
xyz: T,
|
|
2719
2731
|
imagery: R,
|
|
2720
|
-
terrain:
|
|
2721
|
-
downsampleImagery:
|
|
2732
|
+
terrain: M,
|
|
2733
|
+
downsampleImagery: b,
|
|
2722
2734
|
downsampleTerrain: P,
|
|
2723
2735
|
color: U,
|
|
2724
|
-
index:
|
|
2736
|
+
index: S
|
|
2725
2737
|
}) => {
|
|
2726
|
-
a.use(), f.use(), l.set(
|
|
2738
|
+
a.use(), f.use(), l.set(_), u.set(g), x.set(T), A.set(E), m.set(b), y.set(P), w.set(U), p.set(S), e.activeTexture(e.TEXTURE0), h.set(0), R.use(), e.activeTexture(e.TEXTURE1), d.set(1), M.use(), i.use(), e.drawElements(e.TRIANGLES, B * B * 2 * 3, e.UNSIGNED_SHORT, 0);
|
|
2727
2739
|
} };
|
|
2728
2740
|
}, s = r(), o = r(!0);
|
|
2729
2741
|
return { renderProgram: s, depthProgram: o };
|
|
@@ -2783,7 +2795,7 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2783
2795
|
onDragStart: o,
|
|
2784
2796
|
onDragEnd: c
|
|
2785
2797
|
};
|
|
2786
|
-
}, Be = 10,
|
|
2798
|
+
}, Be = 10, Me = 1e-3, ae = (e) => (t) => {
|
|
2787
2799
|
let n, i;
|
|
2788
2800
|
return () => {
|
|
2789
2801
|
const r = performance.now(), s = (r - (i ?? r)) / 1e3;
|
|
@@ -2791,10 +2803,10 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2791
2803
|
const o = t();
|
|
2792
2804
|
return n = n ?? o, n = e({ time: s, current: n, target: o }), n;
|
|
2793
2805
|
};
|
|
2794
|
-
},
|
|
2795
|
-
({ time: e, current: t, target: n }) => (Math.abs(n - t) <
|
|
2796
|
-
),
|
|
2797
|
-
({ time: e, current: t, target: n }) => (ln(t, n) <
|
|
2806
|
+
}, vi = ae(
|
|
2807
|
+
({ time: e, current: t, target: n }) => (Math.abs(n - t) < Me ? t = n : t = t + (n - t) * (1 - Math.exp(-Be * e)), t)
|
|
2808
|
+
), pi = ae(
|
|
2809
|
+
({ time: e, current: t, target: n }) => (ln(t, n) < Me ? sn(t, n) : t = an(
|
|
2798
2810
|
de(),
|
|
2799
2811
|
t,
|
|
2800
2812
|
fn(
|
|
@@ -2804,7 +2816,7 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2804
2816
|
)
|
|
2805
2817
|
), t)
|
|
2806
2818
|
), Di = ae(
|
|
2807
|
-
({ time: e, current: t, target: n }) => (Kt(t, n) <
|
|
2819
|
+
({ time: e, current: t, target: n }) => (Kt(t, n) < Me ? kt(t, n) : t = Ht(
|
|
2808
2820
|
ee(),
|
|
2809
2821
|
t,
|
|
2810
2822
|
Ft(
|
|
@@ -2816,7 +2828,7 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2816
2828
|
), Oi = ae(
|
|
2817
2829
|
({ time: e, current: t, target: n }) => {
|
|
2818
2830
|
const i = Te(L(t), L(n));
|
|
2819
|
-
return i * H <
|
|
2831
|
+
return i * H < Me || i > 1e5 / H ? jt(t, n) : t = se(
|
|
2820
2832
|
ne(
|
|
2821
2833
|
z(),
|
|
2822
2834
|
L(t),
|
|
@@ -2868,16 +2880,16 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2868
2880
|
), t = f, c;
|
|
2869
2881
|
})(e);
|
|
2870
2882
|
}, xi = ae(
|
|
2871
|
-
({ time: e, current: t, target: n }) => (t =
|
|
2883
|
+
({ time: e, current: t, target: n }) => (t = pn(
|
|
2872
2884
|
Ne(
|
|
2873
2885
|
He(),
|
|
2874
2886
|
Se(t),
|
|
2875
2887
|
Se(n),
|
|
2876
2888
|
Math.PI * e
|
|
2877
2889
|
)
|
|
2878
|
-
), tn(Se(t), Se(n)) <
|
|
2890
|
+
), tn(Se(t), Se(n)) < Me && (n = t), t)
|
|
2879
2891
|
), Ei = 10, Xi = (e) => {
|
|
2880
|
-
const t = xi(() => e().orientation), n =
|
|
2892
|
+
const t = xi(() => e().orientation), n = pi(() => e().offset), i = vi(() => e().fieldOfView);
|
|
2881
2893
|
return ae(({ time: s, current: o, target: c }) => {
|
|
2882
2894
|
const a = Te(L(o.target), L(c.target)) * H, f = Math.max(c.distance, a), l = 1 - Math.exp(-Ei * s), u = Math.exp(
|
|
2883
2895
|
Math.log(o.distance) + (Math.log(f) - Math.log(o.distance)) * l
|
|
@@ -2947,8 +2959,8 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2947
2959
|
resize: o,
|
|
2948
2960
|
read: ([l = 0, u = 0]) => {
|
|
2949
2961
|
r(), e.readPixels(l, s - u, 1, 1, e.RGBA, e.UNSIGNED_BYTE, c), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
2950
|
-
const [h = 0, d = 0, m = 0,
|
|
2951
|
-
return [
|
|
2962
|
+
const [h = 0, d = 0, m = 0, y = 0] = c, x = 2 * ((h * 256 + d) / (256 * 256 - 1)) - 1, A = m * 256 + y;
|
|
2963
|
+
return [x, A];
|
|
2952
2964
|
},
|
|
2953
2965
|
dispose: () => {
|
|
2954
2966
|
e.deleteTexture(t), e.deleteFramebuffer(i), e.deleteRenderbuffer(n);
|
|
@@ -2963,39 +2975,39 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2963
2975
|
let s = !1, o, c;
|
|
2964
2976
|
const a = () => {
|
|
2965
2977
|
s = !0;
|
|
2966
|
-
}, f = ({ x: m, y
|
|
2978
|
+
}, f = ({ x: m, y, movementX: w, movementY: x }) => {
|
|
2967
2979
|
if (o) {
|
|
2968
2980
|
if (o.onDrag) {
|
|
2969
|
-
const { point:
|
|
2970
|
-
o.onDrag({ point:
|
|
2981
|
+
const { point: A, position: p, layer: v } = i([m, y], { terrain: !0 });
|
|
2982
|
+
o.onDrag({ point: A, position: p, layer: v });
|
|
2971
2983
|
}
|
|
2972
2984
|
if (o.onDragFlat) {
|
|
2973
|
-
const
|
|
2974
|
-
o.onDragFlat({ point: [m,
|
|
2985
|
+
const p = J(t(), n()).unproject([m, y], { targetZ: c });
|
|
2986
|
+
o.onDragFlat({ point: [m, y], position: p, layer: void 0 });
|
|
2975
2987
|
}
|
|
2976
2988
|
return;
|
|
2977
2989
|
}
|
|
2978
|
-
if (s && (Math.abs(
|
|
2990
|
+
if (s && (Math.abs(w) > 1 || Math.abs(x) > 1)) {
|
|
2979
2991
|
s = !1;
|
|
2980
|
-
const { point:
|
|
2981
|
-
(
|
|
2992
|
+
const { point: A, position: p, layer: v } = i([m, y]);
|
|
2993
|
+
(v?.onDrag || v?.onDragFlat) && (o = v, o.onDragStart?.({ point: A, position: p, layer: v }), [, , c] = p);
|
|
2982
2994
|
}
|
|
2983
2995
|
}, l = (m) => {
|
|
2984
2996
|
if (s && u(m), s = !1, o) {
|
|
2985
|
-
const { x:
|
|
2986
|
-
o.onDragEnd?.({ point:
|
|
2997
|
+
const { x: y, y: w } = m, { point: x, position: A, layer: p } = i([y, w]);
|
|
2998
|
+
o.onDragEnd?.({ point: x, position: A, layer: p });
|
|
2987
2999
|
}
|
|
2988
3000
|
o = void 0;
|
|
2989
|
-
}, u = ({ x: m, y
|
|
2990
|
-
const { point:
|
|
2991
|
-
(
|
|
2992
|
-
point:
|
|
2993
|
-
position:
|
|
2994
|
-
layer:
|
|
3001
|
+
}, u = ({ x: m, y, button: w }) => {
|
|
3002
|
+
const { point: x, position: A, layer: p } = i([m, y]);
|
|
3003
|
+
(w === 2 ? p?.onRightClick : p?.onClick)?.({
|
|
3004
|
+
point: x,
|
|
3005
|
+
position: A,
|
|
3006
|
+
layer: p
|
|
2995
3007
|
});
|
|
2996
|
-
}, h = ({ x: m, y
|
|
2997
|
-
const { point:
|
|
2998
|
-
|
|
3008
|
+
}, h = ({ x: m, y }) => {
|
|
3009
|
+
const { point: w, position: x, layer: A } = i([m, y]);
|
|
3010
|
+
A?.onDoubleClick?.({ point: w, position: x, layer: A });
|
|
2999
3011
|
};
|
|
3000
3012
|
return r?.addEventListener("mousedown", a), r?.addEventListener("mousemove", f), r?.addEventListener("dblclick", h), window.addEventListener("mouseup", l), { dispose: () => {
|
|
3001
3013
|
r?.removeEventListener("mousedown", a), r?.removeEventListener("mousemove", f), r?.removeEventListener("dblclick", h), window.removeEventListener("mouseup", l);
|
|
@@ -3006,55 +3018,55 @@ const Wi = ({ gl: e }, t) => {
|
|
|
3006
3018
|
const { view: n, layers: i } = t;
|
|
3007
3019
|
let r = !0, s = [0, 0];
|
|
3008
3020
|
e.enable(e.CULL_FACE), e.cullFace(e.FRONT), e.depthFunc(e.LEQUAL);
|
|
3009
|
-
const o = _i(e), { canvas: c } = e, a = ([
|
|
3010
|
-
|
|
3021
|
+
const o = _i(e), { canvas: c } = e, a = ([p = 0, v = 0]) => {
|
|
3022
|
+
p = p || 1, v = v || 1, s = [p, v], c.width = p * devicePixelRatio, c.height = v * devicePixelRatio, o.resize([c.width, c.height]);
|
|
3011
3023
|
};
|
|
3012
3024
|
a([c.width, c.height]);
|
|
3013
|
-
const f = new ResizeObserver(([
|
|
3014
|
-
if (!
|
|
3025
|
+
const f = new ResizeObserver(([p]) => {
|
|
3026
|
+
if (!p)
|
|
3015
3027
|
return;
|
|
3016
|
-
const { contentRect:
|
|
3017
|
-
a([
|
|
3028
|
+
const { contentRect: v } = p, { width: _, height: g } = v;
|
|
3029
|
+
a([_, g]);
|
|
3018
3030
|
});
|
|
3019
3031
|
c instanceof HTMLCanvasElement && f.observe(c);
|
|
3020
|
-
const l = ([
|
|
3021
|
-
e.viewport(0, 0,
|
|
3032
|
+
const l = ([p = 0, v = 0]) => {
|
|
3033
|
+
e.viewport(0, 0, p * devicePixelRatio, v * devicePixelRatio), e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT);
|
|
3022
3034
|
}, u = () => {
|
|
3035
|
+
const p = J(n(), s);
|
|
3036
|
+
l(s), Oe(i()).forEach((v) => v.render?.({ viewport: p }));
|
|
3037
|
+
}, h = (p) => {
|
|
3023
3038
|
const v = J(n(), s);
|
|
3024
|
-
l(s), Oe(i()).forEach(
|
|
3025
|
-
|
|
3026
|
-
const x = J(n(), s);
|
|
3027
|
-
l(s), (v ? [v] : Oe(i())).forEach(
|
|
3028
|
-
(w, A) => w.render?.({ viewport: x, depth: !0, index: A + 1 })
|
|
3039
|
+
l(s), (p ? [p] : Oe(i())).forEach(
|
|
3040
|
+
(_, g) => _.render?.({ viewport: v, depth: !0, index: g + 1 })
|
|
3029
3041
|
);
|
|
3030
3042
|
}, d = () => {
|
|
3031
3043
|
r && (u(), requestAnimationFrame(d));
|
|
3032
3044
|
};
|
|
3033
3045
|
requestAnimationFrame(d);
|
|
3034
|
-
const m = (
|
|
3035
|
-
const { screenToClip:
|
|
3046
|
+
const m = (p) => J(n(), s).project(p), y = (p) => J(n(), s).unproject(p), w = (p, { terrain: v } = {}) => {
|
|
3047
|
+
const { screenToClip: _, clipToLocal: g, localToWorld: E } = J(
|
|
3036
3048
|
n(),
|
|
3037
3049
|
s
|
|
3038
3050
|
);
|
|
3039
3051
|
o.use();
|
|
3040
|
-
const [T] =
|
|
3052
|
+
const [T] = v ? i() : [];
|
|
3041
3053
|
h(T);
|
|
3042
|
-
const [R = 0,
|
|
3054
|
+
const [R = 0, M = 0] = p, [b, P] = o.read([
|
|
3043
3055
|
R * devicePixelRatio,
|
|
3044
|
-
|
|
3045
|
-
]), [U = 0,
|
|
3046
|
-
return { point:
|
|
3047
|
-
},
|
|
3056
|
+
M * devicePixelRatio
|
|
3057
|
+
]), [U = 0, S = 0] = _(p), N = se(E(g([U, S, b, 1]))), D = P === 0 ? void 0 : T ?? Oe(i())[P - 1];
|
|
3058
|
+
return { point: p, position: N, layer: D };
|
|
3059
|
+
}, x = yi(e, {
|
|
3048
3060
|
view: n,
|
|
3049
3061
|
screen: () => s,
|
|
3050
|
-
pick:
|
|
3062
|
+
pick: w
|
|
3051
3063
|
});
|
|
3052
3064
|
return {
|
|
3053
3065
|
project: m,
|
|
3054
|
-
unproject:
|
|
3055
|
-
pick:
|
|
3066
|
+
unproject: y,
|
|
3067
|
+
pick: w,
|
|
3056
3068
|
dispose: () => {
|
|
3057
|
-
r = !1,
|
|
3069
|
+
r = !1, x.dispose(), o.dispose(), c instanceof HTMLCanvasElement && f.unobserve(c);
|
|
3058
3070
|
}
|
|
3059
3071
|
};
|
|
3060
3072
|
}, Oe = (e) => e.flatMap((t) => [...Oe(t.children ?? []), t]);
|
|
@@ -3066,20 +3078,20 @@ export {
|
|
|
3066
3078
|
Ri as createContainer,
|
|
3067
3079
|
wi as createContext,
|
|
3068
3080
|
Ai as createDynamicContainer,
|
|
3069
|
-
|
|
3081
|
+
bi as createEmptyLayer,
|
|
3070
3082
|
Si as createLineLayer,
|
|
3071
3083
|
Ti as createMouseControl,
|
|
3072
3084
|
Ae as createMouseEvents,
|
|
3073
|
-
|
|
3085
|
+
vi as createNumberTransition,
|
|
3074
3086
|
Ui as createObjectLayer,
|
|
3075
3087
|
xi as createOrientationTransition,
|
|
3076
3088
|
Pi as createPolygonLayer,
|
|
3077
3089
|
Oi as createPositionTransition,
|
|
3078
3090
|
Ci as createPositionVelocityTransition,
|
|
3079
|
-
|
|
3091
|
+
Mi as createRenderLayer,
|
|
3080
3092
|
Ni as createTerrainLayer,
|
|
3081
3093
|
ae as createTransition,
|
|
3082
|
-
|
|
3094
|
+
pi as createVec2Transition,
|
|
3083
3095
|
Di as createVec4Transition,
|
|
3084
3096
|
Xi as createViewTransition,
|
|
3085
3097
|
Wi as createWorld,
|
|
@@ -3092,8 +3104,8 @@ export {
|
|
|
3092
3104
|
mn as quadratic,
|
|
3093
3105
|
Ie as radians,
|
|
3094
3106
|
ie as range,
|
|
3095
|
-
|
|
3096
|
-
|
|
3107
|
+
vn as tileToMercator,
|
|
3108
|
+
pn as toOrientation,
|
|
3097
3109
|
Se as toQuaternion
|
|
3098
3110
|
};
|
|
3099
3111
|
//# sourceMappingURL=index.js.map
|