world.ts 0.3.11 → 0.3.12
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 +278 -278
- package/dist/index.js.map +1 -1
- package/dist/layers/billboard/index.d.ts +2 -2
- package/dist/layers/index.d.ts +4 -4
- package/dist/layers/line/index.d.ts +2 -2
- package/dist/layers/object/index.d.ts +2 -2
- package/dist/layers/polygon/index.d.ts +2 -2
- package/dist/layers/terrain/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,43 +22,43 @@ const At = (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,
|
|
25
|
+
const o = () => e.useProgram(i), c = (y, T) => {
|
|
26
|
+
const R = e.getUniformLocation(i, y);
|
|
27
27
|
return { set: (M) => {
|
|
28
28
|
R && T(R, M);
|
|
29
29
|
} };
|
|
30
|
-
}, a = (
|
|
31
|
-
|
|
30
|
+
}, a = (y) => c(y, (T, R) => e.uniform1f(T, R)), f = (y) => c(y, (T, R) => e.uniform1i(T, R)), l = (y) => c(
|
|
31
|
+
y,
|
|
32
32
|
(T, [R = 0, A = 0]) => e.uniform2f(T, R, A)
|
|
33
|
-
), u = (
|
|
34
|
-
|
|
33
|
+
), u = (y) => c(
|
|
34
|
+
y,
|
|
35
35
|
(T, [R = 0, A = 0]) => e.uniform2i(T, R, A)
|
|
36
|
-
), h = (
|
|
37
|
-
|
|
36
|
+
), h = (y) => c(
|
|
37
|
+
y,
|
|
38
38
|
(T, [R = 0, A = 0, M = 0]) => e.uniform3f(T, R, A, M)
|
|
39
|
-
), d = (
|
|
40
|
-
|
|
39
|
+
), d = (y) => c(
|
|
40
|
+
y,
|
|
41
41
|
(T, [R = 0, A = 0, M = 0]) => e.uniform3i(T, R, A, M)
|
|
42
|
-
), m = (
|
|
43
|
-
|
|
42
|
+
), m = (y) => c(
|
|
43
|
+
y,
|
|
44
44
|
(T, [R = 0, A = 0, M = 0, P = 0]) => e.uniform4f(T, R, A, M, P)
|
|
45
|
-
),
|
|
46
|
-
|
|
45
|
+
), w = (y) => c(
|
|
46
|
+
y,
|
|
47
47
|
(T, [R = 0, A = 0, M = 0, P = 0]) => e.uniform4i(T, R, A, M, P)
|
|
48
|
-
),
|
|
49
|
-
|
|
48
|
+
), _ = (y) => c(
|
|
49
|
+
y,
|
|
50
50
|
(T, R) => e.uniformMatrix4fv(T, !1, R)
|
|
51
|
-
),
|
|
52
|
-
name:
|
|
51
|
+
), v = ({
|
|
52
|
+
name: y,
|
|
53
53
|
buffer: T,
|
|
54
54
|
size: R,
|
|
55
55
|
type: A,
|
|
56
56
|
stride: M,
|
|
57
57
|
offset: P
|
|
58
58
|
}) => {
|
|
59
|
-
const U = e.getAttribLocation(i,
|
|
59
|
+
const U = e.getAttribLocation(i, y);
|
|
60
60
|
if (U === -1)
|
|
61
|
-
throw new Error(`Missing attribute: ${
|
|
61
|
+
throw new Error(`Missing attribute: ${y}`);
|
|
62
62
|
return { use: () => {
|
|
63
63
|
T.use(), e.enableVertexAttribArray(U), ["u16", "i32"].includes(A) ? e.vertexAttribIPointer(
|
|
64
64
|
U,
|
|
@@ -85,12 +85,12 @@ const At = (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: w,
|
|
89
|
+
uniformMatrix4f: _,
|
|
90
|
+
attribute1f: (y, T, R = {}) => v({ name: y, buffer: T, size: 1, type: "f32", ...R }),
|
|
91
|
+
attribute2f: (y, T, R = {}) => v({ name: y, buffer: T, size: 2, type: "f32", ...R }),
|
|
92
|
+
attribute3f: (y, T, R = {}) => v({ name: y, buffer: T, size: 3, type: "f32", ...R }),
|
|
93
|
+
attribute3i: (y, T, R = {}) => v({ name: y, buffer: T, size: 3, type: "i32", ...R }),
|
|
94
94
|
dispose: () => {
|
|
95
95
|
e.deleteProgram(i), e.deleteShader(r), e.deleteShader(s);
|
|
96
96
|
}
|
|
@@ -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 Lt(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 S ? (S = 1 / S, e[0] = (c * U - a * P + f * M) * S, e[1] = (r * P - i * U - s * M) * S, e[2] = (
|
|
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], w = t[13], _ = t[14], v = t[15], b = n * c - i * o, x = n * a - r * o, E = n * f - s * o, p = i * a - r * c, g = i * f - s * c, y = r * f - s * a, T = l * w - u * m, R = l * _ - h * m, A = l * v - d * m, M = u * _ - h * w, P = u * v - d * w, U = h * v - d * _, S = b * U - x * P + E * M + p * A - g * R + y * T;
|
|
148
|
+
return S ? (S = 1 / S, e[0] = (c * U - a * P + f * M) * S, e[1] = (r * P - i * U - s * M) * S, e[2] = (w * y - _ * g + v * p) * S, e[3] = (h * g - u * y - d * p) * S, e[4] = (a * A - o * U - f * R) * S, e[5] = (n * U - r * A + s * R) * S, e[6] = (_ * E - m * y - v * x) * S, e[7] = (l * y - h * E + d * x) * S, e[8] = (o * P - c * A + f * T) * S, e[9] = (i * A - n * P - s * T) * S, e[10] = (m * g - w * E + v * b) * S, e[11] = (u * E - l * g - d * b) * S, e[12] = (c * R - o * M - a * T) * S, e[13] = (n * M - i * R + r * T) * S, e[14] = (w * x - m * p - _ * b) * S, e[15] = (l * p - u * x + h * b) * S, e) : null;
|
|
149
149
|
}
|
|
150
150
|
function Nt(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], w = t[12], _ = t[13], v = t[14], b = t[15], x = n[0], E = n[1], p = n[2], g = n[3];
|
|
152
|
+
return e[0] = x * i + E * c + p * u + g * w, e[1] = x * r + E * a + p * h + g * _, e[2] = x * s + E * f + p * d + g * v, e[3] = x * o + E * l + p * m + g * b, x = n[4], E = n[5], p = n[6], g = n[7], e[4] = x * i + E * c + p * u + g * w, e[5] = x * r + E * a + p * h + g * _, e[6] = x * s + E * f + p * d + g * v, e[7] = x * o + E * l + p * m + g * b, x = n[8], E = n[9], p = n[10], g = n[11], e[8] = x * i + E * c + p * u + g * w, e[9] = x * r + E * a + p * h + g * _, e[10] = x * s + E * f + p * d + g * v, e[11] = x * o + E * l + p * m + g * b, x = n[12], E = n[13], p = n[14], g = n[15], e[12] = x * i + E * c + p * u + g * w, e[13] = x * r + E * a + p * h + g * _, e[14] = x * s + E * f + p * d + g * v, e[15] = x * o + E * l + p * m + g * b, e;
|
|
153
153
|
}
|
|
154
154
|
function It(e, t, n) {
|
|
155
155
|
var i = n[0], r = n[1], s = n[2];
|
|
@@ -168,8 +168,8 @@ function Ct(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 Xt(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, w = s * o, _ = s * c, v = s * a;
|
|
172
|
+
return e[0] = 1 - u - m, e[1] = l + v, e[2] = h - _, e[3] = 0, e[4] = l - v, e[5] = 1 - f - m, e[6] = d + w, e[7] = 0, e[8] = h + _, e[9] = d - w, 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 Wt(e, t, n, i, r) {
|
|
175
175
|
var s = 1 / Math.tan(t / 2), o;
|
|
@@ -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], 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 > Ut ? (h = Math.acos(d), m = Math.sin(h),
|
|
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, 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 > Ut ? (h = Math.acos(d), m = Math.sin(h), w = Math.sin((1 - i) * h) / m, _ = Math.sin(i * h) / m) : (w = 1 - i, _ = i), e[0] = w * r + _ * a, e[1] = w * s + _ * f, e[2] = w * o + _ * l, e[3] = w * c + _ * u, e;
|
|
295
295
|
}
|
|
296
296
|
function sn(e, t) {
|
|
297
297
|
var n = t[0] + t[4] + t[8], i;
|
|
@@ -394,20 +394,20 @@ const H = 40075017, De = (e) => e / 180 * Math.PI, pn = (e) => e * 180 / Math.PI
|
|
|
394
394
|
const { target: n, offset: i, distance: r, orientation: s, fieldOfView: o } = {
|
|
395
395
|
...mt,
|
|
396
396
|
...e
|
|
397
|
-
}, [c = 0, a = 0] = t, [f = 0, l = 0] = i, [u = 0, h = 0, d = 0] = s, m = Math.tan(De(45) / 2) / Math.tan(De(o) / 2),
|
|
398
|
-
rt(b), jt(b, De(o), c / a,
|
|
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(De(45) / 2) / Math.tan(De(o) / 2), w = r / H * m, _ = w / 100, v = w * 1e6, b = _e();
|
|
398
|
+
rt(b), jt(b, De(o), c / a, _, v), It(b, b, [1, -1, 1]);
|
|
399
|
+
const x = _e();
|
|
400
|
+
rt(x), Dt(x, x, u), Ot(x, x, h), Ct(x, x, d);
|
|
401
|
+
const E = Nt(_n, b, x), p = Lt(_e(), E), g = (D) => {
|
|
402
402
|
const j = [c * D, a * D], Y = [f * D, l * D];
|
|
403
403
|
return te({ ...e, offset: Y }, j);
|
|
404
|
-
},
|
|
404
|
+
}, y = ([D = 0, j = 0], Y = ne()) => {
|
|
405
405
|
const K = 2 * D / c - 1, xe = -(2 * j / a - 1);
|
|
406
406
|
return ot(Y, K, xe, 0, 1);
|
|
407
407
|
}, T = ([D = 0, j = 0, , Y = 0], K = pe()) => Y < 0 ? K : cn(K, (1 + D / Y) * c * 0.5, (1 - j / Y) * a * 0.5), R = (D, j = z()) => {
|
|
408
|
-
const [Y = 0, K = 0, xe = 0, Ee = 0] = at(yn, D,
|
|
408
|
+
const [Y = 0, K = 0, xe = 0, Ee = 0] = at(yn, D, p);
|
|
409
409
|
return ge(j, Y / Ee, K / Ee, xe / Ee);
|
|
410
|
-
}, A = ([D = 0, j = 0, Y = 0], K = ne()) => at(K, ot(K, D, j, Y, 1),
|
|
410
|
+
}, A = ([D = 0, j = 0, Y = 0], K = ne()) => at(K, ot(K, D, j, Y, 1), E), [M = 0, P = 0] = y([f + c / 2, l + a / 2]), [U = 0, S = 0, I = 0] = R([M, P, -1, 1]), [C = 0, X = 0, O = 0] = R([M, P, 1.00001, 1]), [W = 0] = vn(
|
|
411
411
|
(C - U) * (C - U) + (X - S) * (X - S) + (O - I) * (O - I),
|
|
412
412
|
U * (C - U) + S * (X - S) + I * (O - I),
|
|
413
413
|
U * U + S * S + I * I - r * r / H / H * m * m
|
|
@@ -423,10 +423,10 @@ const H = 40075017, De = (e) => e / 180 * Math.PI, pn = (e) => e * 180 / Math.PI
|
|
|
423
423
|
camera: V,
|
|
424
424
|
screen: t,
|
|
425
425
|
projection: b,
|
|
426
|
-
modelView:
|
|
426
|
+
modelView: x,
|
|
427
427
|
fieldScale: m,
|
|
428
428
|
scale: g,
|
|
429
|
-
screenToClip:
|
|
429
|
+
screenToClip: y,
|
|
430
430
|
clipToScreen: T,
|
|
431
431
|
clipToLocal: R,
|
|
432
432
|
localToClip: A,
|
|
@@ -434,7 +434,7 @@ const H = 40075017, De = (e) => e / 180 * Math.PI, pn = (e) => e * 180 / Math.PI
|
|
|
434
434
|
worldToLocal: G,
|
|
435
435
|
project: (D) => T(A(G(L(D)))),
|
|
436
436
|
unproject: (D, { targetZ: j = 0 } = {}) => {
|
|
437
|
-
const Y =
|
|
437
|
+
const Y = y(D), [K = 0, xe = 0, , Ee = 0] = Y, Rt = [K, xe, -1, Ee], et = ae(Q(R(Y))), tt = ae(Q(R(Rt))), [, , Ve = 0] = et, [, , nt = 0] = tt, bt = Ve === nt ? 0 : (j - Ve) / (nt - Ve);
|
|
438
438
|
return kt(z(), et, tt, bt);
|
|
439
439
|
}
|
|
440
440
|
};
|
|
@@ -446,34 +446,34 @@ const H = 40075017, De = (e) => e / 180 * Math.PI, pn = (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 = ([p = 0, g = 0]) => {
|
|
450
|
+
const [y, T] = [
|
|
451
451
|
e.width / devicePixelRatio,
|
|
452
452
|
e.height / devicePixelRatio
|
|
453
|
-
], { camera: R, fieldScale: A } = te(f(), [
|
|
453
|
+
], { camera: R, fieldScale: A } = te(f(), [y, T]), { position: M, layer: P } = t.pick([p, g]);
|
|
454
454
|
if (!P)
|
|
455
455
|
return;
|
|
456
|
-
const U = Re(L(M), R) * H / A, S = [
|
|
456
|
+
const U = Re(L(M), R) * H / A, S = [p - y / 2, g - T / 2];
|
|
457
457
|
o({
|
|
458
458
|
offset: S,
|
|
459
459
|
target: M,
|
|
460
460
|
distance: U
|
|
461
461
|
});
|
|
462
|
-
}, u = (
|
|
462
|
+
}, u = (p, g) => {
|
|
463
463
|
if (!r())
|
|
464
464
|
return;
|
|
465
|
-
a || (l([
|
|
466
|
-
const [
|
|
465
|
+
a || (l([p, g]), a = !0);
|
|
466
|
+
const [y, T] = [
|
|
467
467
|
e.width / devicePixelRatio,
|
|
468
468
|
e.height / devicePixelRatio
|
|
469
469
|
];
|
|
470
470
|
o({
|
|
471
|
-
offset: [
|
|
471
|
+
offset: [p - y / 2, g - T / 2]
|
|
472
472
|
});
|
|
473
|
-
}, h = (
|
|
473
|
+
}, h = (p, g, y, T) => {
|
|
474
474
|
if (!s())
|
|
475
475
|
return;
|
|
476
|
-
r() && !a && (l([
|
|
476
|
+
r() && !a && (l([p, g]), a = !0);
|
|
477
477
|
const [R, A] = [
|
|
478
478
|
e.width / devicePixelRatio,
|
|
479
479
|
e.height / devicePixelRatio
|
|
@@ -483,35 +483,35 @@ const H = 40075017, De = (e) => e / 180 * Math.PI, pn = (e) => e * 180 / Math.PI
|
|
|
483
483
|
Math.max(0.1, M - T / A * Math.PI)
|
|
484
484
|
),
|
|
485
485
|
P,
|
|
486
|
-
U -
|
|
486
|
+
U - y / R * Math.PI
|
|
487
487
|
];
|
|
488
488
|
o({
|
|
489
489
|
orientation: S
|
|
490
490
|
});
|
|
491
|
-
}, d = (
|
|
492
|
-
|
|
493
|
-
}, m = ({ buttons:
|
|
494
|
-
!i() || !
|
|
495
|
-
},
|
|
496
|
-
|
|
497
|
-
const g =
|
|
491
|
+
}, d = (p) => {
|
|
492
|
+
p.preventDefault(), a = !1;
|
|
493
|
+
}, m = ({ buttons: p, movementX: g, movementY: y, x: T, y: R }) => {
|
|
494
|
+
!i() || !p || (p === 1 && r() ? u(T, R) : p === 2 && s() && h(T, R, g, y));
|
|
495
|
+
}, w = (p) => {
|
|
496
|
+
p.preventDefault();
|
|
497
|
+
const g = p.touches.item(0);
|
|
498
498
|
if (!g)
|
|
499
499
|
return;
|
|
500
|
-
const { clientX:
|
|
501
|
-
u(
|
|
502
|
-
},
|
|
500
|
+
const { clientX: y, clientY: T } = g;
|
|
501
|
+
u(y, T);
|
|
502
|
+
}, _ = At(() => c = !1, 100), v = ({ x: p, y: g, deltaY: y }) => {
|
|
503
503
|
if (!i())
|
|
504
504
|
return;
|
|
505
|
-
c || (r() && l([
|
|
505
|
+
c || (r() && l([p, g]), c = !0);
|
|
506
506
|
let { distance: T } = { ...mt, ...f() };
|
|
507
507
|
T = Math.min(
|
|
508
|
-
Math.max(T * Math.exp(
|
|
508
|
+
Math.max(T * Math.exp(y * 1e-3), wn),
|
|
509
509
|
H
|
|
510
|
-
), o({ distance: T }),
|
|
511
|
-
}, b = (
|
|
512
|
-
return e.addEventListener("mousedown", d), e.addEventListener("mousemove", m), e.addEventListener("touchstart", d, { passive: !1 }), e.addEventListener("touchmove",
|
|
510
|
+
), o({ distance: T }), _();
|
|
511
|
+
}, b = (p) => p.preventDefault(), x = (p) => p.preventDefault();
|
|
512
|
+
return e.addEventListener("mousedown", d), e.addEventListener("mousemove", m), e.addEventListener("touchstart", d, { passive: !1 }), e.addEventListener("touchmove", w, { passive: !1 }), e.addEventListener("gesturestart", b), e.addEventListener("wheel", v, { passive: !0 }), e.addEventListener("contextmenu", x), {
|
|
513
513
|
dispose: () => {
|
|
514
|
-
e.removeEventListener("mousedown", d), e.removeEventListener("mousemove", m), e.removeEventListener("touchstart", d), e.removeEventListener("touchmove",
|
|
514
|
+
e.removeEventListener("mousedown", d), e.removeEventListener("mousemove", m), e.removeEventListener("touchstart", d), e.removeEventListener("touchmove", w), e.removeEventListener("gesturestart", b), e.removeEventListener("wheel", v), e.removeEventListener("contextmenu", x);
|
|
515
515
|
}
|
|
516
516
|
};
|
|
517
517
|
}, $ = ({
|
|
@@ -603,7 +603,7 @@ const Pe = Tn(), gn = ({
|
|
|
603
603
|
}) => {
|
|
604
604
|
let n = !1;
|
|
605
605
|
const i = ({ data: o }) => {
|
|
606
|
-
r || e !== o.url || (Pe.removeEventListener("message", i), n = !0, t(o.image));
|
|
606
|
+
r || e !== o.url || (Pe.removeEventListener("message", i), o.image && (n = !0, t(o.image)));
|
|
607
607
|
};
|
|
608
608
|
Pe.addEventListener("message", i);
|
|
609
609
|
let r = !1;
|
|
@@ -733,11 +733,11 @@ const Ri = (e, t = {}) => {
|
|
|
733
733
|
const a = ve(
|
|
734
734
|
() => t.url?.() ?? "",
|
|
735
735
|
(m) => {
|
|
736
|
-
const
|
|
736
|
+
const w = xt({
|
|
737
737
|
gl: n,
|
|
738
738
|
url: m,
|
|
739
|
-
onLoad: ({ width:
|
|
740
|
-
r = [
|
|
739
|
+
onLoad: ({ width: _, height: v }) => {
|
|
740
|
+
r = [_, v], 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 = w;
|
|
741
741
|
}
|
|
742
742
|
});
|
|
743
743
|
}
|
|
@@ -746,26 +746,26 @@ const Ri = (e, t = {}) => {
|
|
|
746
746
|
uvBuffer: o,
|
|
747
747
|
indexBuffer: c
|
|
748
748
|
}), u = ({
|
|
749
|
-
viewport: { projection: m, modelView:
|
|
749
|
+
viewport: { projection: m, modelView: w, camera: _, screen: v },
|
|
750
750
|
depth: b = !1,
|
|
751
|
-
index:
|
|
751
|
+
index: x = 0
|
|
752
752
|
}) => {
|
|
753
|
-
const
|
|
753
|
+
const E = t.position?.() ?? [0, 0, 0], p = t.color?.() ?? [1, 1, 1, 1], g = t.size?.() ?? 100, y = t.minSizePixels?.() ?? 0, T = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
754
754
|
if (a(), !i || be(n, b, t))
|
|
755
755
|
return;
|
|
756
756
|
(b ? l : f).execute({
|
|
757
757
|
projection: m,
|
|
758
|
-
modelView:
|
|
759
|
-
camera: J(
|
|
760
|
-
screen:
|
|
758
|
+
modelView: w,
|
|
759
|
+
camera: J(_),
|
|
760
|
+
screen: v,
|
|
761
761
|
image: i,
|
|
762
762
|
imageSize: r,
|
|
763
|
-
position: J(L(
|
|
764
|
-
color:
|
|
763
|
+
position: J(L(E)),
|
|
764
|
+
color: p,
|
|
765
765
|
size: g,
|
|
766
|
-
minSizePixels:
|
|
766
|
+
minSizePixels: y,
|
|
767
767
|
maxSizePixels: T,
|
|
768
|
-
index:
|
|
768
|
+
index: x
|
|
769
769
|
});
|
|
770
770
|
}, h = () => {
|
|
771
771
|
s.dispose(), o.dispose(), c.dispose(), i?.dispose();
|
|
@@ -788,7 +788,7 @@ const Ri = (e, t = {}) => {
|
|
|
788
788
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
789
789
|
}), u = f.attribute2f("uv", i, {
|
|
790
790
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
791
|
-
}), h = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"),
|
|
791
|
+
}), h = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), w = f.uniform2f("screen"), _ = f.uniform1i("image"), v = f.uniform2f("image_size"), b = f.uniform3i("position"), x = f.uniform4f("color"), E = f.uniform1i("index"), p = f.uniform1f("size"), g = f.uniform1f("min_size_pixels"), y = f.uniform1f("max_size_pixels");
|
|
792
792
|
return { execute: ({
|
|
793
793
|
projection: R,
|
|
794
794
|
modelView: A,
|
|
@@ -803,7 +803,7 @@ const Ri = (e, t = {}) => {
|
|
|
803
803
|
maxSizePixels: W,
|
|
804
804
|
index: B
|
|
805
805
|
}) => {
|
|
806
|
-
f.use(), l.use(), u.use(), h.set(R), d.set(A), m.set(M),
|
|
806
|
+
f.use(), l.use(), u.use(), h.set(R), d.set(A), m.set(M), w.set(P), v.set(S), b.set(I), x.set(C), p.set(X), g.set(O), y.set(W), E.set(B), e.activeTexture(e.TEXTURE0), _.set(0), U.use(), r.use(), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0);
|
|
807
807
|
} };
|
|
808
808
|
}, o = s(), c = s(!0);
|
|
809
809
|
return { renderProgram: o, depthProgram: c };
|
|
@@ -927,40 +927,40 @@ const Ui = (e, t = {}) => {
|
|
|
927
927
|
}), l = vt(n);
|
|
928
928
|
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);
|
|
929
929
|
const u = ({
|
|
930
|
-
viewport: { projection:
|
|
931
|
-
depth:
|
|
932
|
-
index:
|
|
930
|
+
viewport: { projection: _, modelView: v, camera: b, screen: x },
|
|
931
|
+
depth: E = !1,
|
|
932
|
+
index: p = 0
|
|
933
933
|
}) => {
|
|
934
934
|
h(), d();
|
|
935
|
-
const g = t.color?.() ?? [1, 1, 1, 1],
|
|
936
|
-
if (be(n,
|
|
935
|
+
const g = t.color?.() ?? [1, 1, 1, 1], y = t.width?.() ?? 1, T = t.minWidthPixels?.() ?? 0, R = t.maxWidthPixels?.() ?? Number.MAX_VALUE, A = t.depthWidthPixels?.(), M = t.dashSize?.() ?? 1e3, P = t.dashOffset?.() ?? 0;
|
|
936
|
+
if (be(n, E, t))
|
|
937
937
|
return;
|
|
938
|
-
(
|
|
939
|
-
projection:
|
|
940
|
-
modelView:
|
|
938
|
+
(E ? f : a).execute({
|
|
939
|
+
projection: _,
|
|
940
|
+
modelView: v,
|
|
941
941
|
camera: J(b),
|
|
942
|
-
screen:
|
|
942
|
+
screen: x,
|
|
943
943
|
count: i,
|
|
944
944
|
color: g,
|
|
945
|
-
width:
|
|
946
|
-
minWidthPixels:
|
|
947
|
-
maxWidthPixels:
|
|
948
|
-
index:
|
|
945
|
+
width: y,
|
|
946
|
+
minWidthPixels: E && A !== void 0 ? Math.max(T, A) : T,
|
|
947
|
+
maxWidthPixels: E && A !== void 0 ? Math.max(R, A) : R,
|
|
948
|
+
index: p,
|
|
949
949
|
dash: l,
|
|
950
950
|
dashSize: M,
|
|
951
951
|
dashOffset: P
|
|
952
952
|
});
|
|
953
953
|
}, h = ve(
|
|
954
954
|
() => t.points?.() ?? [],
|
|
955
|
-
(
|
|
956
|
-
const
|
|
957
|
-
const [g] =
|
|
958
|
-
return !g || !
|
|
959
|
-
}), { indexData: b } =
|
|
960
|
-
({ indexData:
|
|
961
|
-
if (
|
|
962
|
-
return { indexData:
|
|
963
|
-
const T = se(0, (
|
|
955
|
+
(_) => {
|
|
956
|
+
const v = _.flatMap((p) => {
|
|
957
|
+
const [g] = p, [y] = p.slice(-1);
|
|
958
|
+
return !g || !y ? [] : [g, ...p, y].map((T) => J(L(T))).flatMap((T) => [...T, ...T, ...T, ...T]);
|
|
959
|
+
}), { indexData: b } = _.reduce(
|
|
960
|
+
({ indexData: p, count: g }, y) => {
|
|
961
|
+
if (y.length === 0)
|
|
962
|
+
return { indexData: p, count: g };
|
|
963
|
+
const T = se(0, (y.length - 1) * 2).flatMap((R) => {
|
|
964
964
|
const [A = 0, M = 0, P = 0, U = 0] = se(0, 4).map(
|
|
965
965
|
(S) => S + R * 2 + g
|
|
966
966
|
);
|
|
@@ -969,13 +969,13 @@ const Ui = (e, t = {}) => {
|
|
|
969
969
|
[A, U, P]
|
|
970
970
|
].flat();
|
|
971
971
|
});
|
|
972
|
-
return g += (
|
|
972
|
+
return g += (y.length + 2) * 4, p = p.concat(T), { indexData: p, count: g };
|
|
973
973
|
},
|
|
974
974
|
{ indexData: [], count: 0 }
|
|
975
975
|
);
|
|
976
976
|
i = b.length;
|
|
977
|
-
const
|
|
978
|
-
(
|
|
977
|
+
const x = _.flatMap(
|
|
978
|
+
(p) => p.length === 0 ? [] : se(0, (p.length + 1) * 2).flatMap(
|
|
979
979
|
() => [
|
|
980
980
|
[-1, -1],
|
|
981
981
|
[-1, 1],
|
|
@@ -983,39 +983,39 @@ const Ui = (e, t = {}) => {
|
|
|
983
983
|
[1, 1]
|
|
984
984
|
].flat()
|
|
985
985
|
)
|
|
986
|
-
),
|
|
987
|
-
const
|
|
988
|
-
(A, M) => Re(L(A), L(
|
|
986
|
+
), E = _.flatMap((p) => {
|
|
987
|
+
const y = p.map(
|
|
988
|
+
(A, M) => Re(L(A), L(p[M - 1] ?? A)) * H
|
|
989
989
|
).reduce(
|
|
990
990
|
({ current: A, result: M }, P) => (A += P, M.push(A), { current: A, result: M }),
|
|
991
991
|
{ current: 0, result: [] }
|
|
992
|
-
).result, [T] =
|
|
993
|
-
return T === void 0 || R === void 0 ? [] : [T, ...
|
|
992
|
+
).result, [T] = y, [R] = y.slice(-1);
|
|
993
|
+
return T === void 0 || R === void 0 ? [] : [T, ...y, R].flatMap((A) => [A, A, A, A]);
|
|
994
994
|
});
|
|
995
|
-
r.set(
|
|
995
|
+
r.set(v), s.set(b), o.set(x), c.set(E);
|
|
996
996
|
}
|
|
997
997
|
), d = ve(
|
|
998
998
|
() => t.dashPattern?.(),
|
|
999
|
-
(
|
|
1000
|
-
|
|
999
|
+
(_) => {
|
|
1000
|
+
_ = _ ?? [[1, 1, 1, 1]], l.use(), n.texImage2D(
|
|
1001
1001
|
n.TEXTURE_2D,
|
|
1002
1002
|
0,
|
|
1003
1003
|
n.RGBA,
|
|
1004
|
-
|
|
1004
|
+
_.length,
|
|
1005
1005
|
1,
|
|
1006
1006
|
0,
|
|
1007
1007
|
n.RGBA,
|
|
1008
1008
|
n.UNSIGNED_BYTE,
|
|
1009
|
-
new Uint8Array(
|
|
1009
|
+
new Uint8Array(_.flatMap((v) => [...v.map((b) => b * 255)]))
|
|
1010
1010
|
);
|
|
1011
1011
|
}
|
|
1012
1012
|
), m = () => {
|
|
1013
1013
|
r.dispose(), s.dispose(), o.dispose(), c.dispose();
|
|
1014
|
-
},
|
|
1014
|
+
}, w = Me(t);
|
|
1015
1015
|
return {
|
|
1016
1016
|
render: u,
|
|
1017
1017
|
dispose: m,
|
|
1018
|
-
...
|
|
1018
|
+
...w
|
|
1019
1019
|
};
|
|
1020
1020
|
}, Un = ({ gl: e, programs: t }, {
|
|
1021
1021
|
positionBuffer: n,
|
|
@@ -1032,15 +1032,15 @@ const Ui = (e, t = {}) => {
|
|
|
1032
1032
|
}), m = l.attribute3i("current", n, {
|
|
1033
1033
|
stride: h * 3,
|
|
1034
1034
|
offset: h * 3 * 4
|
|
1035
|
-
}),
|
|
1035
|
+
}), w = l.attribute3i("next", n, {
|
|
1036
1036
|
stride: h * 3,
|
|
1037
1037
|
offset: h * 3 * 4 * 2
|
|
1038
|
-
}),
|
|
1038
|
+
}), _ = l.attribute2f("corner", r, {
|
|
1039
1039
|
stride: u * 2
|
|
1040
|
-
}),
|
|
1040
|
+
}), v = l.attribute1f("distance", s, {
|
|
1041
1041
|
stride: u,
|
|
1042
1042
|
offset: u * 1 * 4
|
|
1043
|
-
}), b = l.uniformMatrix4f("projection"),
|
|
1043
|
+
}), b = l.uniformMatrix4f("projection"), x = l.uniformMatrix4f("model_view"), E = l.uniform3i("camera"), p = l.uniform2f("screen"), g = l.uniform4f("color"), y = l.uniform1f("width"), T = l.uniform1f("max_width_pixels"), R = l.uniform1f("min_width_pixels"), A = l.uniform1i("index"), M = l.uniform1i("dash"), P = l.uniform1f("dash_size"), U = l.uniform1f("dash_offset");
|
|
1044
1044
|
return { execute: ({
|
|
1045
1045
|
projection: I,
|
|
1046
1046
|
modelView: C,
|
|
@@ -1056,7 +1056,7 @@ const Ui = (e, t = {}) => {
|
|
|
1056
1056
|
dashSize: D,
|
|
1057
1057
|
dashOffset: j
|
|
1058
1058
|
}) => {
|
|
1059
|
-
W !== 0 && (l.use(), d.use(), m.use(),
|
|
1059
|
+
W !== 0 && (l.use(), d.use(), m.use(), w.use(), _.use(), v.use(), b.set(I), x.set(C), E.set(X), p.set(O), g.set(B), y.set(V), R.set(Q), T.set(G), A.set(q), P.set(D), U.set(j), e.activeTexture(e.TEXTURE0), M.set(0), Je.use(), i.use(), e.drawElements(e.TRIANGLES, W, e.UNSIGNED_SHORT, 0));
|
|
1060
1060
|
} };
|
|
1061
1061
|
}, c = o(), a = o(!0);
|
|
1062
1062
|
return { renderProgram: c, depthProgram: a };
|
|
@@ -1119,24 +1119,24 @@ const Pi = (e, t = {}) => {
|
|
|
1119
1119
|
indexBuffer: s,
|
|
1120
1120
|
normalBuffer: o
|
|
1121
1121
|
}), f = ({
|
|
1122
|
-
viewport: { projection: d, modelView: m, camera:
|
|
1123
|
-
depth:
|
|
1122
|
+
viewport: { projection: d, modelView: m, camera: w, screen: _ },
|
|
1123
|
+
depth: v = !1,
|
|
1124
1124
|
index: b = 0
|
|
1125
1125
|
}) => {
|
|
1126
|
-
const
|
|
1127
|
-
if (l(), be(n,
|
|
1126
|
+
const x = t.position?.() ?? [0, 0, 0], E = t.orientation?.() ?? [0, 0, 0, 1], p = t.color?.() ?? [1, 1, 1, 1], g = t.diffuse?.() ?? [0, 0, 0, 0], y = t.size?.() ?? 1, T = t.minSizePixels?.() ?? 0, R = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
1127
|
+
if (l(), be(n, v, t))
|
|
1128
1128
|
return;
|
|
1129
|
-
(
|
|
1129
|
+
(v ? a : c).execute({
|
|
1130
1130
|
projection: d,
|
|
1131
1131
|
modelView: m,
|
|
1132
|
-
camera: J(
|
|
1133
|
-
screen:
|
|
1132
|
+
camera: J(w),
|
|
1133
|
+
screen: _,
|
|
1134
1134
|
count: i,
|
|
1135
|
-
position: J(L(
|
|
1136
|
-
orientation: Xt(_e(),
|
|
1137
|
-
color:
|
|
1135
|
+
position: J(L(x)),
|
|
1136
|
+
orientation: Xt(_e(), E),
|
|
1137
|
+
color: p,
|
|
1138
1138
|
diffuse: g,
|
|
1139
|
-
size:
|
|
1139
|
+
size: y,
|
|
1140
1140
|
minSizePixels: T,
|
|
1141
1141
|
maxSizePixels: R,
|
|
1142
1142
|
index: b
|
|
@@ -1144,10 +1144,10 @@ const Pi = (e, t = {}) => {
|
|
|
1144
1144
|
}, l = ve(
|
|
1145
1145
|
() => t.mesh?.(),
|
|
1146
1146
|
(d) => {
|
|
1147
|
-
const { vertices: m = [], indices:
|
|
1148
|
-
r.set(m.flatMap((
|
|
1149
|
-
|
|
1150
|
-
), i =
|
|
1147
|
+
const { vertices: m = [], indices: w = [], normals: _ = [] } = d ?? {};
|
|
1148
|
+
r.set(m.flatMap((v) => [...v])), s.set(w.flatMap((v) => [...v])), o.set(
|
|
1149
|
+
_.length === 0 ? m.flatMap(() => [0, 0, 0]) : _.flatMap((v) => [...v])
|
|
1150
|
+
), i = w.length * 3;
|
|
1151
1151
|
}
|
|
1152
1152
|
), u = () => {
|
|
1153
1153
|
r.dispose(), s.dispose(), o.dispose();
|
|
@@ -1166,7 +1166,7 @@ const Pi = (e, t = {}) => {
|
|
|
1166
1166
|
const f = t.get({
|
|
1167
1167
|
vertexSource: zn,
|
|
1168
1168
|
fragmentSource: a ? Ae : Pn
|
|
1169
|
-
}), l = f.attribute3f("vertex", n), u = f.attribute3f("normal", r), h = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"),
|
|
1169
|
+
}), l = f.attribute3f("vertex", n), u = f.attribute3f("normal", r), h = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), w = f.uniform3i("position"), _ = f.uniformMatrix4f("orientation"), v = f.uniform2f("screen"), b = f.uniform4f("color"), x = f.uniform4f("diffuse"), E = f.uniform1f("size"), p = f.uniform1f("min_size_pixels"), g = f.uniform1f("max_size_pixels"), y = f.uniform1i("index");
|
|
1170
1170
|
return { execute: ({
|
|
1171
1171
|
projection: R,
|
|
1172
1172
|
modelView: A,
|
|
@@ -1182,7 +1182,7 @@ const Pi = (e, t = {}) => {
|
|
|
1182
1182
|
maxSizePixels: B,
|
|
1183
1183
|
index: V
|
|
1184
1184
|
}) => {
|
|
1185
|
-
f.use(), l.use(), u.use(), h.set(R), d.set(A), m.set(M),
|
|
1185
|
+
f.use(), l.use(), u.use(), h.set(R), d.set(A), m.set(M), v.set(P), w.set(S), _.set(I), b.set(C), x.set(X), E.set(O), p.set(W), g.set(B), y.set(V), i.use(), e.drawElements(e.TRIANGLES, U, e.UNSIGNED_SHORT, 0);
|
|
1186
1186
|
} };
|
|
1187
1187
|
}, o = s(), c = s(!0);
|
|
1188
1188
|
return { renderProgram: o, depthProgram: c };
|
|
@@ -1554,26 +1554,26 @@ const zi = (e, t = {}) => {
|
|
|
1554
1554
|
positionBuffer: r,
|
|
1555
1555
|
indexBuffer: s
|
|
1556
1556
|
}), a = ({
|
|
1557
|
-
viewport: { projection: h, modelView: d, camera: m, screen:
|
|
1558
|
-
depth:
|
|
1559
|
-
index:
|
|
1557
|
+
viewport: { projection: h, modelView: d, camera: m, screen: w },
|
|
1558
|
+
depth: _ = !1,
|
|
1559
|
+
index: v = 0
|
|
1560
1560
|
}) => {
|
|
1561
1561
|
const b = t.color?.() ?? [1, 1, 1, 1];
|
|
1562
|
-
if (f(), be(n,
|
|
1562
|
+
if (f(), be(n, _, t))
|
|
1563
1563
|
return;
|
|
1564
|
-
(
|
|
1564
|
+
(_ ? c : o).execute({
|
|
1565
1565
|
projection: h,
|
|
1566
1566
|
modelView: d,
|
|
1567
1567
|
camera: J(m),
|
|
1568
|
-
screen:
|
|
1568
|
+
screen: w,
|
|
1569
1569
|
count: i,
|
|
1570
1570
|
color: b,
|
|
1571
|
-
index:
|
|
1571
|
+
index: v
|
|
1572
1572
|
});
|
|
1573
1573
|
}, f = ve(
|
|
1574
1574
|
() => t.points?.() ?? [],
|
|
1575
1575
|
(h) => {
|
|
1576
|
-
const { vertices: d, indices: m } = h.length > 0 ? Fn(h.map((
|
|
1576
|
+
const { vertices: d, indices: m } = h.length > 0 ? Fn(h.map((w) => w.map((_) => [...J(L(_))]))) : { vertices: [], indices: [] };
|
|
1577
1577
|
r.set(d), s.set(m), i = m.length;
|
|
1578
1578
|
}
|
|
1579
1579
|
), l = () => {
|
|
@@ -1594,17 +1594,17 @@ const zi = (e, t = {}) => {
|
|
|
1594
1594
|
fragmentSource: c ? Ae : Jn
|
|
1595
1595
|
}), f = a.attribute3i("position", n, {
|
|
1596
1596
|
stride: 3 * Int32Array.BYTES_PER_ELEMENT
|
|
1597
|
-
}), l = a.uniformMatrix4f("projection"), u = a.uniformMatrix4f("model_view"), h = a.uniform3i("camera"), d = a.uniform2f("screen"), m = a.uniform4f("color"),
|
|
1597
|
+
}), l = a.uniformMatrix4f("projection"), u = a.uniformMatrix4f("model_view"), h = a.uniform3i("camera"), d = a.uniform2f("screen"), m = a.uniform4f("color"), w = a.uniform1i("index");
|
|
1598
1598
|
return { execute: ({
|
|
1599
|
-
projection:
|
|
1599
|
+
projection: v,
|
|
1600
1600
|
modelView: b,
|
|
1601
|
-
camera:
|
|
1602
|
-
screen:
|
|
1603
|
-
count:
|
|
1601
|
+
camera: x,
|
|
1602
|
+
screen: E,
|
|
1603
|
+
count: p,
|
|
1604
1604
|
color: g,
|
|
1605
|
-
index:
|
|
1605
|
+
index: y
|
|
1606
1606
|
}) => {
|
|
1607
|
-
|
|
1607
|
+
p !== 0 && (a.use(), f.use(), l.set(v), u.set(b), h.set(x), d.set(E), m.set(g), w.set(y), i.use(), e.drawElements(e.TRIANGLES, p, e.UNSIGNED_SHORT, 0));
|
|
1608
1608
|
} };
|
|
1609
1609
|
}, s = r(), o = r(!0);
|
|
1610
1610
|
return { renderProgram: s, depthProgram: o };
|
|
@@ -1850,21 +1850,21 @@ class qe {
|
|
|
1850
1850
|
return this.#v;
|
|
1851
1851
|
}
|
|
1852
1852
|
constructor(t) {
|
|
1853
|
-
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:
|
|
1853
|
+
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: w, fetchMethod: _, noDeleteOnFetchRejection: v, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: x, allowStaleOnFetchAbort: E, ignoreFetchAbort: p } = t;
|
|
1854
1854
|
if (n !== 0 && !ee(n))
|
|
1855
1855
|
throw new TypeError("max option must be a nonnegative integer");
|
|
1856
1856
|
const g = n ? gt(n) : Array;
|
|
1857
1857
|
if (!g)
|
|
1858
1858
|
throw new Error("invalid max value: " + n);
|
|
1859
|
-
if (this.#c = n, this.#h = d, this.maxEntrySize = m || this.#h, this.sizeCalculation =
|
|
1859
|
+
if (this.#c = n, this.#h = d, this.maxEntrySize = m || this.#h, this.sizeCalculation = w, this.sizeCalculation) {
|
|
1860
1860
|
if (!this.#h && !this.maxEntrySize)
|
|
1861
1861
|
throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
1862
1862
|
if (typeof this.sizeCalculation != "function")
|
|
1863
1863
|
throw new TypeError("sizeCalculation set to non-function");
|
|
1864
1864
|
}
|
|
1865
|
-
if (
|
|
1865
|
+
if (_ !== void 0 && typeof _ != "function")
|
|
1866
1866
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
1867
|
-
if (this.#U =
|
|
1867
|
+
if (this.#U = _, this.#b = !!_, 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 = me.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.#w = !!this.#p, this.#l = !!this.#v, this.noDisposeOnSet = !!u, this.noUpdateTTL = !!h, this.noDeleteOnFetchRejection = !!v, this.allowStaleOnFetchRejection = !!x, this.allowStaleOnFetchAbort = !!E, this.ignoreFetchAbort = !!p, this.maxEntrySize !== 0) {
|
|
1868
1868
|
if (this.#h !== 0 && !ee(this.#h))
|
|
1869
1869
|
throw new TypeError("maxSize must be a positive integer if specified");
|
|
1870
1870
|
if (!ee(this.maxEntrySize))
|
|
@@ -1879,8 +1879,8 @@ class qe {
|
|
|
1879
1879
|
if (this.#c === 0 && this.ttl === 0 && this.#h === 0)
|
|
1880
1880
|
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
1881
1881
|
if (!this.ttlAutopurge && !this.#c && !this.#h) {
|
|
1882
|
-
const
|
|
1883
|
-
ni(
|
|
1882
|
+
const y = "LRU_CACHE_UNBOUNDED";
|
|
1883
|
+
ni(y) && (wt.add(y), Tt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", y, qe));
|
|
1884
1884
|
}
|
|
1885
1885
|
}
|
|
1886
1886
|
/**
|
|
@@ -2279,22 +2279,22 @@ class qe {
|
|
|
2279
2279
|
signal: o.signal,
|
|
2280
2280
|
options: i,
|
|
2281
2281
|
context: r
|
|
2282
|
-
}, f = (
|
|
2283
|
-
const { aborted:
|
|
2284
|
-
if (i.status && (
|
|
2282
|
+
}, f = (w, _ = !1) => {
|
|
2283
|
+
const { aborted: v } = o.signal, b = i.ignoreFetchAbort && w !== void 0;
|
|
2284
|
+
if (i.status && (v && !_ ? (i.status.fetchAborted = !0, i.status.fetchError = o.signal.reason, b && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), v && !b && !_)
|
|
2285
2285
|
return u(o.signal.reason);
|
|
2286
|
-
const
|
|
2287
|
-
return this.#e[n] === d && (
|
|
2288
|
-
}, l = (
|
|
2289
|
-
const { aborted:
|
|
2290
|
-
if (this.#e[n] === d && (!
|
|
2291
|
-
return i.status &&
|
|
2292
|
-
if (
|
|
2293
|
-
throw
|
|
2294
|
-
}, h = (
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (
|
|
2286
|
+
const x = d;
|
|
2287
|
+
return this.#e[n] === d && (w === void 0 ? x.__staleWhileFetching ? this.#e[n] = x.__staleWhileFetching : this.delete(t) : (i.status && (i.status.fetchUpdated = !0), this.set(t, w, a.options))), w;
|
|
2288
|
+
}, l = (w) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = w), u(w)), u = (w) => {
|
|
2289
|
+
const { aborted: _ } = o.signal, v = _ && i.allowStaleOnFetchAbort, b = v || i.allowStaleOnFetchRejection, x = b || i.noDeleteOnFetchRejection, E = d;
|
|
2290
|
+
if (this.#e[n] === d && (!x || E.__staleWhileFetching === void 0 ? this.delete(t) : v || (this.#e[n] = E.__staleWhileFetching)), b)
|
|
2291
|
+
return i.status && E.__staleWhileFetching !== void 0 && (i.status.returnedStale = !0), E.__staleWhileFetching;
|
|
2292
|
+
if (E.__returned === E)
|
|
2293
|
+
throw w;
|
|
2294
|
+
}, h = (w, _) => {
|
|
2295
|
+
const v = this.#U?.(t, s, a);
|
|
2296
|
+
v && v instanceof Promise && v.then((b) => w(b === void 0 ? void 0 : b), _), o.signal.addEventListener("abort", () => {
|
|
2297
|
+
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (w(void 0), i.allowStaleOnFetchAbort && (w = (b) => f(b, !0)));
|
|
2298
2298
|
});
|
|
2299
2299
|
};
|
|
2300
2300
|
i.status && (i.status.fetchDispatched = !0);
|
|
@@ -2328,19 +2328,19 @@ class qe {
|
|
|
2328
2328
|
allowStaleOnFetchRejection: h = this.allowStaleOnFetchRejection,
|
|
2329
2329
|
ignoreFetchAbort: d = this.ignoreFetchAbort,
|
|
2330
2330
|
allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort,
|
|
2331
|
-
context:
|
|
2332
|
-
forceRefresh:
|
|
2333
|
-
status:
|
|
2331
|
+
context: w,
|
|
2332
|
+
forceRefresh: _ = !1,
|
|
2333
|
+
status: v,
|
|
2334
2334
|
signal: b
|
|
2335
2335
|
} = n;
|
|
2336
2336
|
if (!this.#b)
|
|
2337
|
-
return
|
|
2337
|
+
return v && (v.fetch = "get"), this.get(t, {
|
|
2338
2338
|
allowStale: i,
|
|
2339
2339
|
updateAgeOnGet: r,
|
|
2340
2340
|
noDeleteOnStaleGet: s,
|
|
2341
|
-
status:
|
|
2341
|
+
status: v
|
|
2342
2342
|
});
|
|
2343
|
-
const
|
|
2343
|
+
const x = {
|
|
2344
2344
|
allowStale: i,
|
|
2345
2345
|
updateAgeOnGet: r,
|
|
2346
2346
|
noDeleteOnStaleGet: s,
|
|
@@ -2353,25 +2353,25 @@ class qe {
|
|
|
2353
2353
|
allowStaleOnFetchRejection: h,
|
|
2354
2354
|
allowStaleOnFetchAbort: m,
|
|
2355
2355
|
ignoreFetchAbort: d,
|
|
2356
|
-
status:
|
|
2356
|
+
status: v,
|
|
2357
2357
|
signal: b
|
|
2358
2358
|
};
|
|
2359
|
-
let
|
|
2360
|
-
if (
|
|
2361
|
-
|
|
2362
|
-
const
|
|
2363
|
-
return
|
|
2359
|
+
let E = this.#i.get(t);
|
|
2360
|
+
if (E === void 0) {
|
|
2361
|
+
v && (v.fetch = "miss");
|
|
2362
|
+
const p = this.#L(t, E, x, w);
|
|
2363
|
+
return p.__returned = p;
|
|
2364
2364
|
} else {
|
|
2365
|
-
const
|
|
2366
|
-
if (this.#t(
|
|
2367
|
-
const A = i &&
|
|
2368
|
-
return
|
|
2365
|
+
const p = this.#e[E];
|
|
2366
|
+
if (this.#t(p)) {
|
|
2367
|
+
const A = i && p.__staleWhileFetching !== void 0;
|
|
2368
|
+
return v && (v.fetch = "inflight", A && (v.returnedStale = !0)), A ? p.__staleWhileFetching : p.__returned = p;
|
|
2369
2369
|
}
|
|
2370
|
-
const g = this.#m(
|
|
2371
|
-
if (!
|
|
2372
|
-
return
|
|
2373
|
-
const
|
|
2374
|
-
return
|
|
2370
|
+
const g = this.#m(E);
|
|
2371
|
+
if (!_ && !g)
|
|
2372
|
+
return v && (v.fetch = "hit"), this.#S(E), r && this.#A(E), v && this.#R(v, E), p;
|
|
2373
|
+
const y = this.#L(t, E, x, w), R = y.__staleWhileFetching !== void 0 && i;
|
|
2374
|
+
return v && (v.fetch = g ? "stale" : "refresh", R && g && (v.returnedStale = !0)), R ? y.__staleWhileFetching : y.__returned = y;
|
|
2375
2375
|
}
|
|
2376
2376
|
}
|
|
2377
2377
|
/**
|
|
@@ -2481,22 +2481,22 @@ const je = (e) => {
|
|
|
2481
2481
|
const u = i.get([a, f, l]);
|
|
2482
2482
|
if (!u)
|
|
2483
2483
|
return;
|
|
2484
|
-
const { texture: h, downsample: d } = u, m = 2 ** d,
|
|
2485
|
-
if (
|
|
2486
|
-
return { buffer:
|
|
2487
|
-
const
|
|
2488
|
-
return e.bindFramebuffer(e.FRAMEBUFFER, r), h.attach(), e.readPixels(0, 0, ie, ie, e.RGBA, e.UNSIGNED_BYTE,
|
|
2484
|
+
const { texture: h, downsample: d } = u, m = 2 ** d, w = [Math.floor(a / m), Math.floor(f / m), l - d], _ = n.get(w);
|
|
2485
|
+
if (_)
|
|
2486
|
+
return { buffer: _, downsample: d };
|
|
2487
|
+
const v = new Uint8Array(4 * ie * ie);
|
|
2488
|
+
return e.bindFramebuffer(e.FRAMEBUFFER, r), h.attach(), e.readPixels(0, 0, ie, ie, e.RGBA, e.UNSIGNED_BYTE, v), e.bindFramebuffer(e.FRAMEBUFFER, null), n.set(w, v), { buffer: v, downsample: d };
|
|
2489
2489
|
};
|
|
2490
2490
|
return { get: ([a = 0, f = 0], l = ii) => {
|
|
2491
2491
|
const u = 2 ** l, h = L([a, f, 0]).map((A) => A * u), [d = 0, m = 0] = h.map((A) => Math.floor(A % u));
|
|
2492
|
-
let [
|
|
2493
|
-
const
|
|
2494
|
-
if (!
|
|
2492
|
+
let [w = 0, _ = 0] = h.map((A) => A % 1);
|
|
2493
|
+
const v = s([d, m, l]);
|
|
2494
|
+
if (!v)
|
|
2495
2495
|
return 0;
|
|
2496
|
-
const { buffer: b, downsample:
|
|
2497
|
-
[
|
|
2498
|
-
const
|
|
2499
|
-
return (g * 65536 +
|
|
2496
|
+
const { buffer: b, downsample: x } = v, E = 2 ** x;
|
|
2497
|
+
[w, _] = [(d % E + w) / E, (m % E + _) / E];
|
|
2498
|
+
const p = 4 * ie * Math.floor(_ * ie) + 4 * Math.floor(w * ie), [g = 0, y = 0, T = 0] = b.slice(p, p + 4);
|
|
2499
|
+
return (g * 65536 + y * 256 + T) / 10 - 1e4;
|
|
2500
2500
|
}, dispose: () => {
|
|
2501
2501
|
e.deleteFramebuffer(r);
|
|
2502
2502
|
} };
|
|
@@ -2538,14 +2538,14 @@ const ht = ({
|
|
|
2538
2538
|
const [l = 0, u = 0, h = 0] = a;
|
|
2539
2539
|
let d = t.replace("{x}", `${l}`).replace("{y}", `${u}`).replace("{z}", `${h}`);
|
|
2540
2540
|
if (d.includes("{bbox}")) {
|
|
2541
|
-
const [
|
|
2541
|
+
const [w = 0, _ = 0, v = 0] = a, b = 2 ** v - _ - 1, [[x, E] = [], [p, g] = []] = [
|
|
2542
2542
|
[0, 0],
|
|
2543
2543
|
[1, 1]
|
|
2544
|
-
].map(([
|
|
2545
|
-
(
|
|
2544
|
+
].map(([y = 0, T = 0]) => [w + y, b + T, v]).map((y) => dt(y, y)).map(([y = 0, T = 0]) => [
|
|
2545
|
+
(y - 0.5) * 2 * Math.PI * 6378137,
|
|
2546
2546
|
(T - 0.5) * 2 * Math.PI * 6378137
|
|
2547
2547
|
]);
|
|
2548
|
-
d = d.replace("{bbox}", [
|
|
2548
|
+
d = d.replace("{bbox}", [x, E, p, g].join(","));
|
|
2549
2549
|
}
|
|
2550
2550
|
const m = xt({
|
|
2551
2551
|
gl: e,
|
|
@@ -2669,18 +2669,18 @@ const Z = 34, ci = 22, fi = se(0, Z).flatMap(
|
|
|
2669
2669
|
d.set(li.flatMap(([R = 0, A = 0, M = 0]) => [R, A, M]));
|
|
2670
2670
|
const m = $({ gl: n, type: "u16", target: "element" });
|
|
2671
2671
|
m.set(fi);
|
|
2672
|
-
const { renderProgram:
|
|
2672
|
+
const { renderProgram: w, depthProgram: _ } = hi(e, {
|
|
2673
2673
|
uvwBuffer: d,
|
|
2674
2674
|
indexBuffer: m
|
|
2675
|
-
}),
|
|
2675
|
+
}), v = [0, 1, 2, 3], b = v.map(z), x = v.map(ne), E = v.map(pe), p = (R) => {
|
|
2676
2676
|
const { camera: A, worldToLocal: M, localToClip: P, clipToScreen: U } = R, S = (I) => {
|
|
2677
2677
|
const [C = 0, X = 0, O = 0] = I, W = h.get(I);
|
|
2678
2678
|
let B = ui(A, W);
|
|
2679
2679
|
if (!B) {
|
|
2680
|
-
const V = W.map((G, q) => M(G, b[q])).map((G, q) => P(G,
|
|
2680
|
+
const V = W.map((G, q) => M(G, b[q])).map((G, q) => P(G, x[q]));
|
|
2681
2681
|
if (di(V))
|
|
2682
2682
|
return [];
|
|
2683
|
-
B = mi(V.map((G, q) => U(G,
|
|
2683
|
+
B = mi(V.map((G, q) => U(G, E[q]))) > 512 / devicePixelRatio;
|
|
2684
2684
|
}
|
|
2685
2685
|
return B && O < ci ? [
|
|
2686
2686
|
[2 * C, 2 * X, O + 1],
|
|
@@ -2698,7 +2698,7 @@ const Z = 34, ci = 22, fi = se(0, Z).flatMap(
|
|
|
2698
2698
|
const P = t.color?.() ?? [1, 1, 1, 1];
|
|
2699
2699
|
if (c(), be(n, A, t))
|
|
2700
2700
|
return;
|
|
2701
|
-
const U = A ?
|
|
2701
|
+
const U = A ? _ : w, { projection: S, modelView: I, camera: C } = R, X = p(R);
|
|
2702
2702
|
for (const O of X) {
|
|
2703
2703
|
const W = A ? void 0 : r?.get(O), B = l.get(O);
|
|
2704
2704
|
if (!A && !W || !B)
|
|
@@ -2717,12 +2717,12 @@ const Z = 34, ci = 22, fi = se(0, Z).flatMap(
|
|
|
2717
2717
|
index: M
|
|
2718
2718
|
});
|
|
2719
2719
|
}
|
|
2720
|
-
},
|
|
2720
|
+
}, y = () => {
|
|
2721
2721
|
i?.dispose(), f.dispose(), u.dispose();
|
|
2722
2722
|
}, T = Me(t);
|
|
2723
2723
|
return {
|
|
2724
2724
|
render: g,
|
|
2725
|
-
dispose:
|
|
2725
|
+
dispose: y,
|
|
2726
2726
|
...T
|
|
2727
2727
|
};
|
|
2728
2728
|
}, hi = ({ gl: e, programs: t }, { uvwBuffer: n, indexBuffer: i }) => {
|
|
@@ -2730,11 +2730,11 @@ const Z = 34, ci = 22, fi = se(0, Z).flatMap(
|
|
|
2730
2730
|
const a = t.get({
|
|
2731
2731
|
vertexSource: ai,
|
|
2732
2732
|
fragmentSource: c ? Ae : si
|
|
2733
|
-
}), 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"),
|
|
2733
|
+
}), 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"), w = a.uniform1i("downsample_terrain"), _ = a.uniform4f("color"), v = a.uniform3i("xyz"), b = a.uniform3i("camera"), x = a.uniform1i("index");
|
|
2734
2734
|
return { execute: ({
|
|
2735
|
-
projection:
|
|
2735
|
+
projection: p,
|
|
2736
2736
|
modelView: g,
|
|
2737
|
-
camera:
|
|
2737
|
+
camera: y,
|
|
2738
2738
|
xyz: T,
|
|
2739
2739
|
imagery: R,
|
|
2740
2740
|
terrain: A,
|
|
@@ -2743,7 +2743,7 @@ const Z = 34, ci = 22, fi = se(0, Z).flatMap(
|
|
|
2743
2743
|
color: U,
|
|
2744
2744
|
index: S
|
|
2745
2745
|
}) => {
|
|
2746
|
-
a.use(), f.use(), l.set(
|
|
2746
|
+
a.use(), f.use(), l.set(p), u.set(g), v.set(T), b.set(y), m.set(M), w.set(P), _.set(U), x.set(S), e.activeTexture(e.TEXTURE0), h.set(0), R.use(), e.activeTexture(e.TEXTURE1), d.set(1), A.use(), i.use(), e.drawElements(e.TRIANGLES, Z * Z * 2 * 3, e.UNSIGNED_SHORT, 0);
|
|
2747
2747
|
} };
|
|
2748
2748
|
}, s = r(), o = r(!0);
|
|
2749
2749
|
return { renderProgram: s, depthProgram: o };
|
|
@@ -2967,8 +2967,8 @@ const Z = 34, ci = 22, fi = se(0, Z).flatMap(
|
|
|
2967
2967
|
resize: o,
|
|
2968
2968
|
read: ([l = 0, u = 0]) => {
|
|
2969
2969
|
r(), e.readPixels(l, s - u, 1, 1, e.RGBA, e.UNSIGNED_BYTE, c), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
2970
|
-
const [h = 0, d = 0, m = 0,
|
|
2971
|
-
return [
|
|
2970
|
+
const [h = 0, d = 0, m = 0, w = 0] = c, v = 2 * ((h * 256 + d) / (256 * 256 - 1)) - 1, b = m * 256 + w;
|
|
2971
|
+
return [v, b];
|
|
2972
2972
|
},
|
|
2973
2973
|
dispose: () => {
|
|
2974
2974
|
e.deleteTexture(t), e.deleteFramebuffer(i), e.deleteRenderbuffer(n);
|
|
@@ -2983,39 +2983,39 @@ const Z = 34, ci = 22, fi = se(0, Z).flatMap(
|
|
|
2983
2983
|
let s = !1, o, c;
|
|
2984
2984
|
const a = () => {
|
|
2985
2985
|
s = !0;
|
|
2986
|
-
}, f = (
|
|
2986
|
+
}, f = (m) => {
|
|
2987
|
+
const { x: w, y: _, movementX: v, movementY: b } = m;
|
|
2987
2988
|
if (o) {
|
|
2988
2989
|
if (o.onDrag) {
|
|
2989
|
-
const { point:
|
|
2990
|
-
o.onDrag({ point:
|
|
2990
|
+
const { point: x, position: E, layer: p } = i([w, _], { terrain: !0 });
|
|
2991
|
+
o.onDrag({ point: x, position: E, layer: p });
|
|
2991
2992
|
}
|
|
2992
2993
|
if (o.onDragFlat) {
|
|
2993
|
-
const
|
|
2994
|
-
o.onDragFlat({ point: [
|
|
2994
|
+
const E = te(t(), n()).unproject([w, _], { targetZ: c });
|
|
2995
|
+
o.onDragFlat({ point: [w, _], position: E, layer: void 0 });
|
|
2995
2996
|
}
|
|
2996
2997
|
return;
|
|
2997
2998
|
}
|
|
2998
|
-
if (s && (Math.abs(
|
|
2999
|
+
if (s && (Math.abs(v) > 1 || Math.abs(b) > 1)) {
|
|
2999
3000
|
s = !1;
|
|
3000
|
-
const { point:
|
|
3001
|
-
(
|
|
3001
|
+
const { point: x, position: E, layer: p } = i([w, _]);
|
|
3002
|
+
(p?.onDrag || p?.onDragFlat) && (o = p, o.onDragStart?.({ point: x, position: E, layer: p }), [, , c] = E);
|
|
3002
3003
|
}
|
|
3003
3004
|
}, l = (m) => {
|
|
3004
3005
|
if (s && u(m), s = !1, o) {
|
|
3005
|
-
const { x:
|
|
3006
|
-
o.onDragEnd?.({ point:
|
|
3006
|
+
const { x: w, y: _ } = m, { point: v, position: b, layer: x } = i([w, _]);
|
|
3007
|
+
o.onDragEnd?.({ point: v, position: b, layer: x });
|
|
3007
3008
|
}
|
|
3008
3009
|
o = void 0;
|
|
3009
|
-
}, u = (
|
|
3010
|
-
const { point:
|
|
3011
|
-
(
|
|
3012
|
-
point:
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
b?.onDoubleClick?.({ point: y, position: p, layer: b });
|
|
3010
|
+
}, u = (m) => {
|
|
3011
|
+
const { x: w, y: _, button: v } = m, { point: b, position: x, layer: E } = i([w, _]);
|
|
3012
|
+
(v === 2 ? E?.onRightClick : E?.onClick)?.(
|
|
3013
|
+
{ point: b, position: x, layer: E },
|
|
3014
|
+
m
|
|
3015
|
+
);
|
|
3016
|
+
}, h = ({ x: m, y: w }) => {
|
|
3017
|
+
const { point: _, position: v, layer: b } = i([m, w]);
|
|
3018
|
+
b?.onDoubleClick?.({ point: _, position: v, layer: b });
|
|
3019
3019
|
};
|
|
3020
3020
|
return r?.addEventListener("mousedown", a), r?.addEventListener("mousemove", f), r?.addEventListener("dblclick", h), window.addEventListener("mouseup", l), { dispose: () => {
|
|
3021
3021
|
r?.removeEventListener("mousedown", a), r?.removeEventListener("mousemove", f), r?.removeEventListener("dblclick", h), window.removeEventListener("mouseup", l);
|
|
@@ -3026,55 +3026,55 @@ const ji = ({ gl: e }, t) => {
|
|
|
3026
3026
|
const { view: n, layers: i } = t;
|
|
3027
3027
|
let r = !0, s = [0, 0];
|
|
3028
3028
|
e.enable(e.CULL_FACE), e.cullFace(e.FRONT), e.depthFunc(e.LEQUAL);
|
|
3029
|
-
const o = yi(e), { canvas: c } = e, a = ([
|
|
3030
|
-
|
|
3029
|
+
const o = yi(e), { canvas: c } = e, a = ([x = 0, E = 0]) => {
|
|
3030
|
+
x = x || 1, E = E || 1, s = [x, E], c.width = x * devicePixelRatio, c.height = E * devicePixelRatio, o.resize([c.width, c.height]);
|
|
3031
3031
|
};
|
|
3032
3032
|
a([c.width, c.height]);
|
|
3033
|
-
const f = new ResizeObserver(([
|
|
3034
|
-
if (!
|
|
3033
|
+
const f = new ResizeObserver(([x]) => {
|
|
3034
|
+
if (!x)
|
|
3035
3035
|
return;
|
|
3036
|
-
const { contentRect:
|
|
3037
|
-
a([
|
|
3036
|
+
const { contentRect: E } = x, { width: p, height: g } = E;
|
|
3037
|
+
a([p, g]);
|
|
3038
3038
|
});
|
|
3039
3039
|
c instanceof HTMLCanvasElement && f.observe(c);
|
|
3040
|
-
const l = ([
|
|
3041
|
-
e.viewport(0, 0,
|
|
3040
|
+
const l = ([x = 0, E = 0]) => {
|
|
3041
|
+
e.viewport(0, 0, x * devicePixelRatio, E * devicePixelRatio), e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT);
|
|
3042
3042
|
}, u = () => {
|
|
3043
|
-
const
|
|
3044
|
-
l(s), Ce(i()).forEach((
|
|
3045
|
-
}, h = (
|
|
3046
|
-
const
|
|
3047
|
-
l(s), (
|
|
3048
|
-
(
|
|
3043
|
+
const x = te(n(), s);
|
|
3044
|
+
l(s), Ce(i()).forEach((E) => E.render?.({ viewport: x }));
|
|
3045
|
+
}, h = (x) => {
|
|
3046
|
+
const E = te(n(), s);
|
|
3047
|
+
l(s), (x ? [x] : Ce(i())).forEach(
|
|
3048
|
+
(p, g) => p.render?.({ viewport: E, depth: !0, index: g + 1 })
|
|
3049
3049
|
);
|
|
3050
3050
|
}, d = () => {
|
|
3051
3051
|
r && (u(), requestAnimationFrame(d));
|
|
3052
3052
|
};
|
|
3053
3053
|
requestAnimationFrame(d);
|
|
3054
|
-
const m = (
|
|
3055
|
-
const { screenToClip:
|
|
3054
|
+
const m = (x) => te(n(), s).project(x), w = (x) => te(n(), s).unproject(x), _ = (x, { terrain: E } = {}) => {
|
|
3055
|
+
const { screenToClip: p, clipToLocal: g, localToWorld: y } = te(
|
|
3056
3056
|
n(),
|
|
3057
3057
|
s
|
|
3058
3058
|
);
|
|
3059
3059
|
o.use();
|
|
3060
|
-
const [T] =
|
|
3060
|
+
const [T] = E ? i() : [];
|
|
3061
3061
|
h(T);
|
|
3062
|
-
const [R = 0, A = 0] =
|
|
3062
|
+
const [R = 0, A = 0] = x, [M, P] = o.read([
|
|
3063
3063
|
R * devicePixelRatio,
|
|
3064
3064
|
A * devicePixelRatio
|
|
3065
|
-
]), [U = 0, S = 0] = x
|
|
3066
|
-
return { point:
|
|
3067
|
-
},
|
|
3065
|
+
]), [U = 0, S = 0] = p(x), I = ae(y(g([U, S, M, 1]))), C = P === 0 ? void 0 : T ?? Ce(i())[P - 1];
|
|
3066
|
+
return { point: x, position: I, layer: C };
|
|
3067
|
+
}, v = wi(e, {
|
|
3068
3068
|
view: n,
|
|
3069
3069
|
screen: () => s,
|
|
3070
|
-
pick:
|
|
3070
|
+
pick: _
|
|
3071
3071
|
});
|
|
3072
3072
|
return {
|
|
3073
3073
|
project: m,
|
|
3074
|
-
unproject:
|
|
3075
|
-
pick:
|
|
3074
|
+
unproject: w,
|
|
3075
|
+
pick: _,
|
|
3076
3076
|
dispose: () => {
|
|
3077
|
-
r = !1,
|
|
3077
|
+
r = !1, v.dispose(), o.dispose(), c instanceof HTMLCanvasElement && f.unobserve(c);
|
|
3078
3078
|
}
|
|
3079
3079
|
};
|
|
3080
3080
|
}, Ce = (e) => e.flatMap((t) => [...Ce(t.children ?? []), t]);
|