world.ts 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +326 -325
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,10 +30,10 @@ const Rt = (e, t) => {
|
|
|
30
30
|
}, a = (E) => c(E, (y, R) => e.uniform1f(y, R)), f = (E) => c(E, (y, R) => e.uniform1i(y, R)), l = (E) => c(
|
|
31
31
|
E,
|
|
32
32
|
(y, [R = 0, M = 0]) => e.uniform2f(y, R, M)
|
|
33
|
-
),
|
|
33
|
+
), h = (E) => c(
|
|
34
34
|
E,
|
|
35
35
|
(y, [R = 0, M = 0]) => e.uniform2i(y, R, M)
|
|
36
|
-
),
|
|
36
|
+
), u = (E) => c(
|
|
37
37
|
E,
|
|
38
38
|
(y, [R = 0, M = 0, b = 0]) => e.uniform3f(y, R, M, b)
|
|
39
39
|
), d = (E) => c(
|
|
@@ -48,7 +48,7 @@ const Rt = (e, t) => {
|
|
|
48
48
|
), w = (E) => c(
|
|
49
49
|
E,
|
|
50
50
|
(y, R) => e.uniformMatrix4fv(y, !1, R)
|
|
51
|
-
),
|
|
51
|
+
), x = ({
|
|
52
52
|
name: E,
|
|
53
53
|
buffer: y,
|
|
54
54
|
size: R,
|
|
@@ -81,16 +81,16 @@ const Rt = (e, t) => {
|
|
|
81
81
|
uniform1f: a,
|
|
82
82
|
uniform1i: f,
|
|
83
83
|
uniform2f: l,
|
|
84
|
-
uniform2i:
|
|
85
|
-
uniform3f:
|
|
84
|
+
uniform2i: h,
|
|
85
|
+
uniform3f: u,
|
|
86
86
|
uniform3i: d,
|
|
87
87
|
uniform4f: m,
|
|
88
88
|
uniform4i: _,
|
|
89
89
|
uniformMatrix4f: w,
|
|
90
|
-
attribute1f: (E, y, R = {}) =>
|
|
91
|
-
attribute2f: (E, y, R = {}) =>
|
|
92
|
-
attribute3f: (E, y, R = {}) =>
|
|
93
|
-
attribute3i: (E, y, R = {}) =>
|
|
90
|
+
attribute1f: (E, y, R = {}) => x({ name: E, buffer: y, size: 1, type: "f32", ...R }),
|
|
91
|
+
attribute2f: (E, y, R = {}) => x({ name: E, buffer: y, size: 2, type: "f32", ...R }),
|
|
92
|
+
attribute3f: (E, y, R = {}) => x({ name: E, buffer: y, size: 3, type: "f32", ...R }),
|
|
93
|
+
attribute3i: (E, y, R = {}) => x({ name: E, buffer: y, size: 3, type: "i32", ...R }),
|
|
94
94
|
dispose: () => {
|
|
95
95
|
e.deleteProgram(i), e.deleteShader(r), e.deleteShader(s);
|
|
96
96
|
}
|
|
@@ -144,32 +144,32 @@ 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],
|
|
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] = (_ * E - w * g +
|
|
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], h = t[9], u = t[10], d = t[11], m = t[12], _ = t[13], w = t[14], x = t[15], A = n * c - i * o, v = n * a - r * o, T = n * f - s * o, p = i * a - r * c, g = i * f - s * c, E = r * f - s * a, y = l * _ - h * m, R = l * w - u * m, M = l * x - d * m, b = h * w - u * _, P = h * x - d * _, U = u * x - d * w, S = A * U - v * P + T * b + p * M - g * R + E * y;
|
|
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] = (_ * E - w * g + x * p) * S, e[3] = (u * g - h * E - d * p) * S, e[4] = (a * M - o * U - f * R) * S, e[5] = (n * U - r * M + s * R) * S, e[6] = (w * T - m * E - x * v) * S, e[7] = (l * E - u * T + d * v) * S, e[8] = (o * P - c * M + f * y) * S, e[9] = (i * M - n * P - s * y) * S, e[10] = (m * g - _ * T + x * A) * S, e[11] = (h * T - l * g - d * A) * S, e[12] = (c * R - o * b - a * y) * S, e[13] = (n * b - i * R + r * y) * S, e[14] = (_ * v - m * p - w * A) * S, e[15] = (l * p - h * v + u * 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],
|
|
152
|
-
return e[0] = v * i + T * c +
|
|
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], h = t[8], u = t[9], d = t[10], m = t[11], _ = t[12], w = t[13], x = t[14], A = t[15], v = n[0], T = n[1], p = n[2], g = n[3];
|
|
152
|
+
return e[0] = v * i + T * c + p * h + g * _, e[1] = v * r + T * a + p * u + g * w, e[2] = v * s + T * f + p * d + g * x, e[3] = v * o + T * l + p * m + g * A, v = n[4], T = n[5], p = n[6], g = n[7], e[4] = v * i + T * c + p * h + g * _, e[5] = v * r + T * a + p * u + g * w, e[6] = v * s + T * f + p * d + g * x, e[7] = v * o + T * l + p * m + g * A, v = n[8], T = n[9], p = n[10], g = n[11], e[8] = v * i + T * c + p * h + g * _, e[9] = v * r + T * a + p * u + g * w, e[10] = v * s + T * f + p * d + g * x, e[11] = v * o + T * l + p * m + g * A, v = n[12], T = n[13], p = n[14], g = n[15], e[12] = v * i + T * c + p * h + g * _, e[13] = v * r + T * a + p * u + g * w, e[14] = v * s + T * f + p * d + g * x, e[15] = v * o + T * l + p * 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];
|
|
156
156
|
return e[0] = t[0] * i, e[1] = t[1] * i, e[2] = t[2] * i, e[3] = t[3] * i, e[4] = t[4] * r, e[5] = t[5] * r, e[6] = t[6] * r, e[7] = t[7] * r, e[8] = t[8] * s, e[9] = t[9] * s, e[10] = t[10] * s, e[11] = t[11] * s, e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e;
|
|
157
157
|
}
|
|
158
158
|
function Nt(e, t, n) {
|
|
159
|
-
var i = Math.sin(n), r = Math.cos(n), s = t[4], o = t[5], c = t[6], a = t[7], f = t[8], l = t[9],
|
|
160
|
-
return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = s * r + f * i, e[5] = o * r + l * i, e[6] = c * r +
|
|
159
|
+
var i = Math.sin(n), r = Math.cos(n), s = t[4], o = t[5], c = t[6], a = t[7], f = t[8], l = t[9], h = t[10], u = t[11];
|
|
160
|
+
return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = s * r + f * i, e[5] = o * r + l * i, e[6] = c * r + h * i, e[7] = a * r + u * i, e[8] = f * r - s * i, e[9] = l * r - o * i, e[10] = h * r - c * i, e[11] = u * r - a * i, e;
|
|
161
161
|
}
|
|
162
162
|
function Dt(e, t, n) {
|
|
163
|
-
var i = Math.sin(n), r = Math.cos(n), s = t[0], o = t[1], c = t[2], a = t[3], f = t[8], l = t[9],
|
|
164
|
-
return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], 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 -
|
|
163
|
+
var i = Math.sin(n), r = Math.cos(n), s = t[0], o = t[1], c = t[2], a = t[3], f = t[8], l = t[9], h = t[10], u = t[11];
|
|
164
|
+
return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], 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 - h * i, e[3] = a * r - u * i, e[8] = s * i + f * r, e[9] = o * i + l * r, e[10] = c * i + h * r, e[11] = a * i + u * r, e;
|
|
165
165
|
}
|
|
166
166
|
function It(e, t, n) {
|
|
167
|
-
var i = Math.sin(n), r = Math.cos(n), s = t[0], o = t[1], c = t[2], a = t[3], f = t[4], l = t[5],
|
|
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 +
|
|
167
|
+
var i = Math.sin(n), r = Math.cos(n), s = t[0], o = t[1], c = t[2], a = t[3], f = t[4], l = t[5], h = t[6], u = t[7];
|
|
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 + h * i, e[3] = a * r + u * i, e[4] = f * r - s * i, e[5] = l * r - o * i, e[6] = h * r - c * i, e[7] = u * 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,
|
|
172
|
-
return e[0] = 1 -
|
|
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, h = i * c, u = r * o, d = r * c, m = r * a, _ = s * o, w = s * c, x = s * a;
|
|
172
|
+
return e[0] = 1 - h - m, e[1] = l + x, e[2] = u - w, e[3] = 0, e[4] = l - x, e[5] = 1 - f - m, e[6] = d + _, e[7] = 0, e[8] = u + w, e[9] = d - _, e[10] = 1 - f - h, 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],
|
|
294
|
-
return d = r * a + s * f + o * l + c *
|
|
293
|
+
var r = t[0], s = t[1], o = t[2], c = t[3], a = n[0], f = n[1], l = n[2], h = n[3], u, d, m, _, w;
|
|
294
|
+
return d = r * a + s * f + o * l + c * h, d < 0 && (d = -d, a = -a, f = -f, l = -l, h = -h), 1 - d > St ? (u = Math.acos(d), m = Math.sin(u), _ = Math.sin((1 - i) * u) / m, w = Math.sin(i * u) / m) : (_ = 1 - i, w = i), e[0] = _ * r + w * a, e[1] = _ * s + w * f, e[2] = _ * o + w * l, e[3] = _ * c + w * h, e;
|
|
295
295
|
}
|
|
296
296
|
function nn(e, t) {
|
|
297
297
|
var n = t[0] + t[4] + t[8], i;
|
|
@@ -305,12 +305,12 @@ function nn(e, t) {
|
|
|
305
305
|
}
|
|
306
306
|
return e;
|
|
307
307
|
}
|
|
308
|
-
var rn = qt,
|
|
308
|
+
var rn = qt, ut = Qt;
|
|
309
309
|
(function() {
|
|
310
310
|
var e = z(), t = st(1, 0, 0), n = st(0, 1, 0);
|
|
311
311
|
return function(i, r, s) {
|
|
312
312
|
var o = Vt(r, s);
|
|
313
|
-
return o < -0.999999 ? (Ve(e, t, r), $t(e) < 1e-6 && Ve(e, n, r), Zt(e, e), en(i, e, Math.PI), i) : o > 0.999999 ? (i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 1, i) : (Ve(e, r, s), i[0] = e[0], i[1] = e[1], i[2] = e[2], i[3] = 1 + o,
|
|
313
|
+
return o < -0.999999 ? (Ve(e, t, r), $t(e) < 1e-6 && Ve(e, n, r), Zt(e, e), en(i, e, Math.PI), i) : o > 0.999999 ? (i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 1, i) : (Ve(e, r, s), i[0] = e[0], i[1] = e[1], i[2] = e[2], i[3] = 1 + o, ut(i, i));
|
|
314
314
|
};
|
|
315
315
|
})();
|
|
316
316
|
(function() {
|
|
@@ -322,7 +322,7 @@ var rn = qt, ht = Qt;
|
|
|
322
322
|
(function() {
|
|
323
323
|
var e = Ut();
|
|
324
324
|
return function(t, n, i, r) {
|
|
325
|
-
return e[0] = i[0], e[3] = i[1], e[6] = i[2], e[1] = r[0], e[4] = r[1], e[7] = r[2], e[2] = -n[0], e[5] = -n[1], e[8] = -n[2],
|
|
325
|
+
return e[0] = i[0], e[3] = i[1], e[6] = i[2], e[1] = r[0], e[4] = r[1], e[7] = r[2], e[2] = -n[0], e[5] = -n[1], e[8] = -n[2], ut(t, nn(t, e));
|
|
326
326
|
};
|
|
327
327
|
})();
|
|
328
328
|
function de() {
|
|
@@ -348,11 +348,11 @@ function ln(e, t) {
|
|
|
348
348
|
var n = t[0] - e[0], i = t[1] - e[1];
|
|
349
349
|
return Math.hypot(n, i);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function un(e, t) {
|
|
352
352
|
var n = t[0] - e[0], i = t[1] - e[1];
|
|
353
353
|
return n * n + i * i;
|
|
354
354
|
}
|
|
355
|
-
var
|
|
355
|
+
var hn = cn;
|
|
356
356
|
(function() {
|
|
357
357
|
var e = de();
|
|
358
358
|
return function(t, n, i, r, s, o) {
|
|
@@ -379,12 +379,12 @@ const H = 40075017, De = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
|
|
|
379
379
|
const r = 2 ** -n;
|
|
380
380
|
return we(i, e * r, t * r, 0);
|
|
381
381
|
}, be = ([e = 0, t = 0, n = 0]) => {
|
|
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,
|
|
383
|
-
return [l,
|
|
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, h = c * o * i + a * s * r, u = c * s * r - a * o * i;
|
|
383
|
+
return [l, h, u, 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
|
+
}, ht = {
|
|
388
388
|
target: [0, 0, 0],
|
|
389
389
|
offset: [0, 0],
|
|
390
390
|
distance: H,
|
|
@@ -392,20 +392,20 @@ const H = 40075017, De = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
|
|
|
392
392
|
fieldOfView: 45
|
|
393
393
|
}, xn = xe(), En = ee(), J = (e, t) => {
|
|
394
394
|
const { target: n, offset: i, distance: r, orientation: s, fieldOfView: o } = {
|
|
395
|
-
...
|
|
395
|
+
...ht,
|
|
396
396
|
...e
|
|
397
|
-
}, [c = 0, a = 0] = t, [f = 0, l = 0] = i, [
|
|
398
|
-
rt(A), Xt(A, De(o), c / a, w,
|
|
397
|
+
}, [c = 0, a = 0] = t, [f = 0, l = 0] = i, [h = 0, u = 0, d = 0] = s, m = Math.tan(De(45) / 2) / Math.tan(De(o) / 2), _ = r / H * m, w = _ / 100, x = _ * 1e6, A = xe();
|
|
398
|
+
rt(A), Xt(A, De(o), c / a, w, x), Lt(A, A, [1, -1, 1]);
|
|
399
399
|
const v = xe();
|
|
400
|
-
rt(v), Nt(v, v,
|
|
401
|
-
const T = zt(xn, A, v),
|
|
400
|
+
rt(v), Nt(v, v, h), Dt(v, v, u), It(v, v, d);
|
|
401
|
+
const T = zt(xn, A, v), p = Pt(xe(), T), g = (O) => {
|
|
402
402
|
const W = [c * O, a * O], k = [f * O, l * O];
|
|
403
403
|
return J({ ...e, offset: k }, W);
|
|
404
404
|
}, E = ([O = 0, W = 0], k = ee()) => {
|
|
405
405
|
const K = 2 * O / c - 1, ve = -(2 * W / a - 1);
|
|
406
406
|
return ot(k, K, ve, 0, 1);
|
|
407
407
|
}, y = ([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, ve = 0, pe = 0] = at(En, O,
|
|
408
|
+
const [k = 0, K = 0, ve = 0, pe = 0] = at(En, O, p);
|
|
409
409
|
return we(W, k / pe, K / pe, ve / pe);
|
|
410
410
|
}, M = ([O = 0, W = 0, k = 0], K = ee()) => at(K, ot(K, O, W, k, 1), T), [b = 0, P = 0] = E([f + c / 2, l + a / 2]), [U = 0, S = 0, N = 0] = R([b, P, -1, 1]), [I = 0, j = 0, X = 0] = R([b, P, 1.00001, 1]), [C = 0] = mn(
|
|
411
411
|
(I - U) * (I - U) + (j - S) * (j - S) + (X - N) * (X - N),
|
|
@@ -446,34 +446,34 @@ const H = 40075017, De = (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 = ([
|
|
449
|
+
const { view: f } = n, l = ([p = 0, g = 0]) => {
|
|
450
450
|
const [E, y] = [
|
|
451
451
|
e.width / devicePixelRatio,
|
|
452
452
|
e.height / devicePixelRatio
|
|
453
|
-
], { camera: R, fieldScale: M } = J(f(), [E, y]), { position: b, layer: P } = t.pick([
|
|
453
|
+
], { camera: R, fieldScale: M } = J(f(), [E, y]), { position: b, layer: P } = t.pick([p, g]);
|
|
454
454
|
if (!P)
|
|
455
455
|
return;
|
|
456
|
-
const U = Te(L(b), R) * H / M, S = [
|
|
456
|
+
const U = Te(L(b), R) * H / M, S = [p - E / 2, g - y / 2];
|
|
457
457
|
o({
|
|
458
458
|
offset: S,
|
|
459
459
|
target: b,
|
|
460
460
|
distance: U
|
|
461
461
|
});
|
|
462
|
-
},
|
|
462
|
+
}, h = (p, g) => {
|
|
463
463
|
if (!r())
|
|
464
464
|
return;
|
|
465
|
-
a || (l([
|
|
465
|
+
a || (l([p, g]), a = !0);
|
|
466
466
|
const [E, y] = [
|
|
467
467
|
e.width / devicePixelRatio,
|
|
468
468
|
e.height / devicePixelRatio
|
|
469
469
|
];
|
|
470
470
|
o({
|
|
471
|
-
offset: [
|
|
471
|
+
offset: [p - E / 2, g - y / 2]
|
|
472
472
|
});
|
|
473
|
-
},
|
|
473
|
+
}, u = (p, g, E, y) => {
|
|
474
474
|
if (!s())
|
|
475
475
|
return;
|
|
476
|
-
r() && !a && (l([
|
|
476
|
+
r() && !a && (l([p, g]), a = !0);
|
|
477
477
|
const [R, M] = [
|
|
478
478
|
e.width / devicePixelRatio,
|
|
479
479
|
e.height / devicePixelRatio
|
|
@@ -488,29 +488,30 @@ const H = 40075017, De = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
|
|
|
488
488
|
o({
|
|
489
489
|
orientation: S
|
|
490
490
|
});
|
|
491
|
-
}, d = (
|
|
492
|
-
a = !1;
|
|
493
|
-
}, m = ({ buttons:
|
|
494
|
-
!i() || !
|
|
495
|
-
}, _ = (
|
|
496
|
-
|
|
491
|
+
}, d = (p) => {
|
|
492
|
+
p.preventDefault(), a = !1;
|
|
493
|
+
}, m = ({ buttons: p, movementX: g, movementY: E, x: y, y: R }) => {
|
|
494
|
+
!i() || !p || (p === 1 && r() ? h(y, R) : p === 2 && s() && u(y, R, g, E));
|
|
495
|
+
}, _ = (p) => {
|
|
496
|
+
p.preventDefault();
|
|
497
|
+
const g = p.touches.item(0);
|
|
497
498
|
if (!g)
|
|
498
499
|
return;
|
|
499
500
|
const { clientX: E, clientY: y } = g;
|
|
500
|
-
|
|
501
|
-
}, w = Rt(() => c = !1, 100),
|
|
501
|
+
h(E, y);
|
|
502
|
+
}, w = Rt(() => c = !1, 100), x = ({ x: p, y: g, deltaY: E }) => {
|
|
502
503
|
if (!i())
|
|
503
504
|
return;
|
|
504
|
-
c || (r() && l([
|
|
505
|
-
let { distance: y } = { ...
|
|
505
|
+
c || (r() && l([p, g]), c = !0);
|
|
506
|
+
let { distance: y } = { ...ht, ...f() };
|
|
506
507
|
y = Math.min(
|
|
507
508
|
Math.max(y * Math.exp(E * 1e-3), _n),
|
|
508
509
|
H
|
|
509
510
|
), o({ distance: y }), w();
|
|
510
|
-
}, A = (
|
|
511
|
-
return e.addEventListener("mousedown", d), e.addEventListener("mousemove", m), e.addEventListener("touchstart", d, { passive: !1 }), e.addEventListener("touchmove", _, { passive: !1 }), e.addEventListener("gesturestart", A), e.addEventListener("wheel",
|
|
511
|
+
}, A = (p) => p.preventDefault(), v = (p) => p.preventDefault();
|
|
512
|
+
return e.addEventListener("mousedown", d), e.addEventListener("mousemove", m), e.addEventListener("touchstart", d, { passive: !1 }), e.addEventListener("touchmove", _, { passive: !1 }), e.addEventListener("gesturestart", A), e.addEventListener("wheel", x, { passive: !0 }), e.addEventListener("contextmenu", v), {
|
|
512
513
|
dispose: () => {
|
|
513
|
-
e.removeEventListener("mousedown", d), e.removeEventListener("mousemove", m), e.removeEventListener("touchstart", d), e.removeEventListener("touchmove", _), e.removeEventListener("gesturestart", A), e.removeEventListener("wheel",
|
|
514
|
+
e.removeEventListener("mousedown", d), e.removeEventListener("mousemove", m), e.removeEventListener("touchstart", d), e.removeEventListener("touchmove", _), e.removeEventListener("gesturestart", A), e.removeEventListener("wheel", x), e.removeEventListener("contextmenu", v);
|
|
514
515
|
}
|
|
515
516
|
};
|
|
516
517
|
}, V = ({
|
|
@@ -735,8 +736,8 @@ const gi = (e, t = {}) => {
|
|
|
735
736
|
const _ = vt({
|
|
736
737
|
gl: n,
|
|
737
738
|
url: m,
|
|
738
|
-
onLoad: ({ width: w, height:
|
|
739
|
-
r = [w,
|
|
739
|
+
onLoad: ({ width: w, height: x }) => {
|
|
740
|
+
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 = _;
|
|
740
741
|
}
|
|
741
742
|
});
|
|
742
743
|
}
|
|
@@ -744,34 +745,34 @@ const gi = (e, t = {}) => {
|
|
|
744
745
|
cornerBuffer: s,
|
|
745
746
|
uvBuffer: o,
|
|
746
747
|
indexBuffer: c
|
|
747
|
-
}),
|
|
748
|
-
viewport: { projection: m, modelView: _, camera: w, screen:
|
|
748
|
+
}), h = ({
|
|
749
|
+
viewport: { projection: m, modelView: _, camera: w, screen: x },
|
|
749
750
|
depth: A = !1,
|
|
750
751
|
index: v = 0
|
|
751
752
|
}) => {
|
|
752
|
-
const T = t.position?.() ?? [0, 0, 0],
|
|
753
|
+
const T = t.position?.() ?? [0, 0, 0], p = t.color?.() ?? [1, 1, 1, 1], g = t.size?.() ?? 100, E = t.minSizePixels?.() ?? 0, y = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
753
754
|
if (a(), !i || ge(n, A, t))
|
|
754
755
|
return;
|
|
755
756
|
(A ? l : f).execute({
|
|
756
757
|
projection: m,
|
|
757
758
|
modelView: _,
|
|
758
759
|
camera: Q(w),
|
|
759
|
-
screen:
|
|
760
|
+
screen: x,
|
|
760
761
|
image: i,
|
|
761
762
|
imageSize: r,
|
|
762
763
|
position: Q(L(T)),
|
|
763
|
-
color:
|
|
764
|
+
color: p,
|
|
764
765
|
size: g,
|
|
765
766
|
minSizePixels: E,
|
|
766
767
|
maxSizePixels: y,
|
|
767
768
|
index: v
|
|
768
769
|
});
|
|
769
|
-
},
|
|
770
|
+
}, u = () => {
|
|
770
771
|
s.dispose(), o.dispose(), c.dispose(), i?.dispose();
|
|
771
772
|
}, d = Ae(t);
|
|
772
773
|
return {
|
|
773
|
-
render:
|
|
774
|
-
dispose:
|
|
774
|
+
render: h,
|
|
775
|
+
dispose: u,
|
|
775
776
|
...d
|
|
776
777
|
};
|
|
777
778
|
}, An = ({ gl: e, programs: t }, {
|
|
@@ -785,9 +786,9 @@ const gi = (e, t = {}) => {
|
|
|
785
786
|
fragmentSource: a ? Re : gn
|
|
786
787
|
}), l = f.attribute2f("corner", n, {
|
|
787
788
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
788
|
-
}),
|
|
789
|
+
}), h = f.attribute2f("uv", i, {
|
|
789
790
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
790
|
-
}),
|
|
791
|
+
}), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), _ = f.uniform2f("screen"), w = f.uniform1i("image"), x = f.uniform2f("image_size"), A = f.uniform3i("position"), v = f.uniform4f("color"), T = f.uniform1i("index"), p = f.uniform1f("size"), g = f.uniform1f("min_size_pixels"), E = f.uniform1f("max_size_pixels");
|
|
791
792
|
return { execute: ({
|
|
792
793
|
projection: R,
|
|
793
794
|
modelView: M,
|
|
@@ -802,7 +803,7 @@ const gi = (e, t = {}) => {
|
|
|
802
803
|
maxSizePixels: C,
|
|
803
804
|
index: G
|
|
804
805
|
}) => {
|
|
805
|
-
f.use(), l.use(),
|
|
806
|
+
f.use(), l.use(), h.use(), u.set(R), d.set(M), m.set(b), _.set(P), x.set(S), A.set(N), v.set(I), p.set(j), g.set(X), E.set(C), T.set(G), e.activeTexture(e.TEXTURE0), w.set(0), U.use(), r.use(), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0);
|
|
806
807
|
} };
|
|
807
808
|
}, o = s(), c = s(!0);
|
|
808
809
|
return { renderProgram: o, depthProgram: c };
|
|
@@ -925,18 +926,18 @@ const bi = (e, t = {}) => {
|
|
|
925
926
|
distanceBuffer: c
|
|
926
927
|
}), l = mt(n);
|
|
927
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);
|
|
928
|
-
const
|
|
929
|
-
viewport: { projection: w, modelView:
|
|
929
|
+
const h = ({
|
|
930
|
+
viewport: { projection: w, modelView: x, camera: A, screen: v },
|
|
930
931
|
depth: T = !1,
|
|
931
|
-
index:
|
|
932
|
+
index: p = 0
|
|
932
933
|
}) => {
|
|
933
|
-
|
|
934
|
+
u(), d();
|
|
934
935
|
const g = t.color?.() ?? [1, 1, 1, 1], E = t.width?.() ?? 1, y = t.minWidthPixels?.() ?? 0, R = t.maxWidthPixels?.() ?? Number.MAX_VALUE, M = t.depthWidthPixels?.(), b = t.dashSize?.() ?? 1e3, P = t.dashOffset?.() ?? 0;
|
|
935
936
|
if (ge(n, T, t))
|
|
936
937
|
return;
|
|
937
938
|
(T ? f : a).execute({
|
|
938
939
|
projection: w,
|
|
939
|
-
modelView:
|
|
940
|
+
modelView: x,
|
|
940
941
|
camera: Q(A),
|
|
941
942
|
screen: v,
|
|
942
943
|
count: i,
|
|
@@ -944,21 +945,21 @@ const bi = (e, t = {}) => {
|
|
|
944
945
|
width: E,
|
|
945
946
|
minWidthPixels: T && M !== void 0 ? Math.max(y, M) : y,
|
|
946
947
|
maxWidthPixels: T && M !== void 0 ? Math.max(R, M) : R,
|
|
947
|
-
index:
|
|
948
|
+
index: p,
|
|
948
949
|
dash: l,
|
|
949
950
|
dashSize: b,
|
|
950
951
|
dashOffset: P
|
|
951
952
|
});
|
|
952
|
-
},
|
|
953
|
+
}, u = me(
|
|
953
954
|
() => t.points?.() ?? [],
|
|
954
955
|
(w) => {
|
|
955
|
-
const
|
|
956
|
-
const [g] =
|
|
957
|
-
return !g || !E ? [] : [g, ...
|
|
956
|
+
const x = w.flatMap((p) => {
|
|
957
|
+
const [g] = p, [E] = p.slice(-1);
|
|
958
|
+
return !g || !E ? [] : [g, ...p, E].map((y) => Q(L(y))).flatMap((y) => [...y, ...y, ...y, ...y]);
|
|
958
959
|
}), { indexData: A } = w.reduce(
|
|
959
|
-
({ indexData:
|
|
960
|
+
({ indexData: p, count: g }, E) => {
|
|
960
961
|
if (E.length === 0)
|
|
961
|
-
return { indexData:
|
|
962
|
+
return { indexData: p, count: g };
|
|
962
963
|
const y = ie(0, (E.length - 1) * 2).flatMap((R) => {
|
|
963
964
|
const [M = 0, b = 0, P = 0, U = 0] = ie(0, 4).map(
|
|
964
965
|
(S) => S + R * 2 + g
|
|
@@ -968,13 +969,13 @@ const bi = (e, t = {}) => {
|
|
|
968
969
|
[M, U, P]
|
|
969
970
|
].flat();
|
|
970
971
|
});
|
|
971
|
-
return g += (E.length + 2) * 4,
|
|
972
|
+
return g += (E.length + 2) * 4, p = p.concat(y), { indexData: p, count: g };
|
|
972
973
|
},
|
|
973
974
|
{ indexData: [], count: 0 }
|
|
974
975
|
);
|
|
975
976
|
i = A.length;
|
|
976
977
|
const v = w.flatMap(
|
|
977
|
-
(
|
|
978
|
+
(p) => p.length === 0 ? [] : ie(0, (p.length + 1) * 2).flatMap(
|
|
978
979
|
() => [
|
|
979
980
|
[-1, -1],
|
|
980
981
|
[-1, 1],
|
|
@@ -982,16 +983,16 @@ const bi = (e, t = {}) => {
|
|
|
982
983
|
[1, 1]
|
|
983
984
|
].flat()
|
|
984
985
|
)
|
|
985
|
-
), T = w.flatMap((
|
|
986
|
-
const E =
|
|
987
|
-
(M, b) => Te(L(M), L(
|
|
986
|
+
), T = w.flatMap((p) => {
|
|
987
|
+
const E = p.map(
|
|
988
|
+
(M, b) => Te(L(M), L(p[b - 1] ?? M)) * H
|
|
988
989
|
).reduce(
|
|
989
990
|
({ current: M, result: b }, P) => (M += P, b.push(M), { current: M, result: b }),
|
|
990
991
|
{ current: 0, result: [] }
|
|
991
992
|
).result, [y] = E, [R] = E.slice(-1);
|
|
992
993
|
return y === void 0 || R === void 0 ? [] : [y, ...E, R].flatMap((M) => [M, M, M, M]);
|
|
993
994
|
});
|
|
994
|
-
r.set(
|
|
995
|
+
r.set(x), s.set(A), o.set(v), c.set(T);
|
|
995
996
|
}
|
|
996
997
|
), d = me(
|
|
997
998
|
() => t.dashPattern?.(),
|
|
@@ -1005,14 +1006,14 @@ const bi = (e, t = {}) => {
|
|
|
1005
1006
|
0,
|
|
1006
1007
|
n.RGBA,
|
|
1007
1008
|
n.UNSIGNED_BYTE,
|
|
1008
|
-
new Uint8Array(w.flatMap((
|
|
1009
|
+
new Uint8Array(w.flatMap((x) => [...x.map((A) => A * 255)]))
|
|
1009
1010
|
);
|
|
1010
1011
|
}
|
|
1011
1012
|
), m = () => {
|
|
1012
1013
|
r.dispose(), s.dispose(), o.dispose(), c.dispose();
|
|
1013
1014
|
}, _ = Ae(t);
|
|
1014
1015
|
return {
|
|
1015
|
-
render:
|
|
1016
|
+
render: h,
|
|
1016
1017
|
dispose: m,
|
|
1017
1018
|
..._
|
|
1018
1019
|
};
|
|
@@ -1026,20 +1027,20 @@ const bi = (e, t = {}) => {
|
|
|
1026
1027
|
const l = t.get({
|
|
1027
1028
|
vertexSource: Sn,
|
|
1028
1029
|
fragmentSource: f ? Re : Mn
|
|
1029
|
-
}),
|
|
1030
|
-
stride:
|
|
1030
|
+
}), h = Float32Array.BYTES_PER_ELEMENT, u = Int32Array.BYTES_PER_ELEMENT, d = l.attribute3i("previous", n, {
|
|
1031
|
+
stride: u * 3
|
|
1031
1032
|
}), m = l.attribute3i("current", n, {
|
|
1032
|
-
stride:
|
|
1033
|
-
offset:
|
|
1033
|
+
stride: u * 3,
|
|
1034
|
+
offset: u * 3 * 4
|
|
1034
1035
|
}), _ = l.attribute3i("next", n, {
|
|
1035
|
-
stride:
|
|
1036
|
-
offset:
|
|
1036
|
+
stride: u * 3,
|
|
1037
|
+
offset: u * 3 * 4 * 2
|
|
1037
1038
|
}), w = l.attribute2f("corner", r, {
|
|
1038
|
-
stride:
|
|
1039
|
-
}),
|
|
1040
|
-
stride:
|
|
1041
|
-
offset:
|
|
1042
|
-
}), A = l.uniformMatrix4f("projection"), v = l.uniformMatrix4f("model_view"), T = l.uniform3i("camera"),
|
|
1039
|
+
stride: h * 2
|
|
1040
|
+
}), x = l.attribute1f("distance", s, {
|
|
1041
|
+
stride: h,
|
|
1042
|
+
offset: h * 1 * 4
|
|
1043
|
+
}), A = l.uniformMatrix4f("projection"), v = l.uniformMatrix4f("model_view"), T = l.uniform3i("camera"), p = l.uniform2f("screen"), g = l.uniform4f("color"), E = l.uniform1f("width"), y = 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");
|
|
1043
1044
|
return { execute: ({
|
|
1044
1045
|
projection: N,
|
|
1045
1046
|
modelView: I,
|
|
@@ -1055,7 +1056,7 @@ const bi = (e, t = {}) => {
|
|
|
1055
1056
|
dashSize: O,
|
|
1056
1057
|
dashOffset: W
|
|
1057
1058
|
}) => {
|
|
1058
|
-
C !== 0 && (l.use(), d.use(), m.use(), _.use(), w.use(),
|
|
1059
|
+
C !== 0 && (l.use(), d.use(), m.use(), _.use(), w.use(), x.use(), A.set(N), v.set(I), T.set(j), p.set(X), g.set(G), E.set(Z), R.set($), y.set(Se), 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));
|
|
1059
1060
|
} };
|
|
1060
1061
|
}, c = o(), a = o(!0);
|
|
1061
1062
|
return { renderProgram: c, depthProgram: a };
|
|
@@ -1119,13 +1120,13 @@ const Ui = (e, t = {}) => {
|
|
|
1119
1120
|
normalBuffer: o
|
|
1120
1121
|
}), f = ({
|
|
1121
1122
|
viewport: { projection: d, modelView: m, camera: _, screen: w },
|
|
1122
|
-
depth:
|
|
1123
|
+
depth: x = !1,
|
|
1123
1124
|
index: A = 0
|
|
1124
1125
|
}) => {
|
|
1125
|
-
const v = t.position?.() ?? [0, 0, 0], T = t.orientation?.() ?? [0, 0, 0, 1],
|
|
1126
|
-
if (l(), ge(n,
|
|
1126
|
+
const v = t.position?.() ?? [0, 0, 0], T = t.orientation?.() ?? [0, 0, 0, 1], p = t.color?.() ?? [1, 1, 1, 1], g = t.diffuse?.() ?? [0, 0, 0, 0], E = t.size?.() ?? 1, y = t.minSizePixels?.() ?? 0, R = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
1127
|
+
if (l(), ge(n, x, t))
|
|
1127
1128
|
return;
|
|
1128
|
-
(
|
|
1129
|
+
(x ? a : c).execute({
|
|
1129
1130
|
projection: d,
|
|
1130
1131
|
modelView: m,
|
|
1131
1132
|
camera: Q(_),
|
|
@@ -1133,7 +1134,7 @@ const Ui = (e, t = {}) => {
|
|
|
1133
1134
|
count: i,
|
|
1134
1135
|
position: Q(L(v)),
|
|
1135
1136
|
orientation: Ot(xe(), T),
|
|
1136
|
-
color:
|
|
1137
|
+
color: p,
|
|
1137
1138
|
diffuse: g,
|
|
1138
1139
|
size: E,
|
|
1139
1140
|
minSizePixels: y,
|
|
@@ -1144,17 +1145,17 @@ const Ui = (e, t = {}) => {
|
|
|
1144
1145
|
() => t.mesh?.(),
|
|
1145
1146
|
(d) => {
|
|
1146
1147
|
const { vertices: m = [], indices: _ = [], normals: w = [] } = d ?? {};
|
|
1147
|
-
r.set(m.flatMap((
|
|
1148
|
-
w.length === 0 ? m.flatMap(() => [0, 0, 0]) : w.flatMap((
|
|
1148
|
+
r.set(m.flatMap((x) => [...x])), s.set(_.flatMap((x) => [...x])), o.set(
|
|
1149
|
+
w.length === 0 ? m.flatMap(() => [0, 0, 0]) : w.flatMap((x) => [...x])
|
|
1149
1150
|
), i = _.length * 3;
|
|
1150
1151
|
}
|
|
1151
|
-
),
|
|
1152
|
+
), h = () => {
|
|
1152
1153
|
r.dispose(), s.dispose(), o.dispose();
|
|
1153
|
-
},
|
|
1154
|
+
}, u = Ae(t);
|
|
1154
1155
|
return {
|
|
1155
1156
|
render: f,
|
|
1156
|
-
dispose:
|
|
1157
|
-
...
|
|
1157
|
+
dispose: h,
|
|
1158
|
+
...u
|
|
1158
1159
|
};
|
|
1159
1160
|
}, zn = ({ gl: e, programs: t }, {
|
|
1160
1161
|
vertexBuffer: n,
|
|
@@ -1165,7 +1166,7 @@ const Ui = (e, t = {}) => {
|
|
|
1165
1166
|
const f = t.get({
|
|
1166
1167
|
vertexSource: Pn,
|
|
1167
1168
|
fragmentSource: a ? Re : Un
|
|
1168
|
-
}), l = f.attribute3f("vertex", n),
|
|
1169
|
+
}), l = f.attribute3f("vertex", n), h = f.attribute3f("normal", r), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), _ = f.uniform3i("position"), w = f.uniformMatrix4f("orientation"), x = f.uniform2f("screen"), A = f.uniform4f("color"), v = f.uniform4f("diffuse"), T = f.uniform1f("size"), p = f.uniform1f("min_size_pixels"), g = f.uniform1f("max_size_pixels"), E = f.uniform1i("index");
|
|
1169
1170
|
return { execute: ({
|
|
1170
1171
|
projection: R,
|
|
1171
1172
|
modelView: M,
|
|
@@ -1181,7 +1182,7 @@ const Ui = (e, t = {}) => {
|
|
|
1181
1182
|
maxSizePixels: G,
|
|
1182
1183
|
index: Z
|
|
1183
1184
|
}) => {
|
|
1184
|
-
f.use(), l.use(),
|
|
1185
|
+
f.use(), l.use(), h.use(), u.set(R), d.set(M), m.set(b), x.set(P), _.set(S), w.set(N), A.set(I), v.set(j), T.set(X), p.set(C), g.set(G), E.set(Z), i.use(), e.drawElements(e.TRIANGLES, U, e.UNSIGNED_SHORT, 0);
|
|
1185
1186
|
} };
|
|
1186
1187
|
}, o = s(), c = s(!0);
|
|
1187
1188
|
return { renderProgram: o, depthProgram: c };
|
|
@@ -1228,7 +1229,7 @@ var pt = function(e, t, n, i, r) {
|
|
|
1228
1229
|
return !1;
|
|
1229
1230
|
let r = e.next.next;
|
|
1230
1231
|
for (; r !== e.prev; ) {
|
|
1231
|
-
if (
|
|
1232
|
+
if (ue(t.x, t.y, n.x, n.y, i.x, i.y, r.x, r.y) && D(r.prev, r, r.next) >= 0)
|
|
1232
1233
|
return !1;
|
|
1233
1234
|
r = r.next;
|
|
1234
1235
|
}
|
|
@@ -1237,20 +1238,20 @@ var pt = function(e, t, n, i, r) {
|
|
|
1237
1238
|
const r = e.prev, s = e, o = e.next;
|
|
1238
1239
|
if (D(r, s, o) >= 0)
|
|
1239
1240
|
return !1;
|
|
1240
|
-
const c = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, a = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, f = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, l = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y,
|
|
1241
|
+
const c = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, a = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, f = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, l = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y, h = Ge(c, a, t, n, i), u = Ge(f, l, t, n, i);
|
|
1241
1242
|
let { prevZ: d, nextZ: m } = e;
|
|
1242
|
-
for (; d !== null && m !== null && d.z >=
|
|
1243
|
-
if (d !== e.prev && d !== e.next &&
|
|
1243
|
+
for (; d !== null && m !== null && d.z >= h && m.z <= u; ) {
|
|
1244
|
+
if (d !== e.prev && d !== e.next && ue(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && D(d.prev, d, d.next) >= 0 || (d = d.prevZ, m !== e.prev && m !== e.next && ue(r.x, r.y, s.x, s.y, o.x, o.y, m.x, m.y) && D(m.prev, m, m.next) >= 0))
|
|
1244
1245
|
return !1;
|
|
1245
1246
|
m = m.nextZ;
|
|
1246
1247
|
}
|
|
1247
|
-
for (; d !== null && d.z >=
|
|
1248
|
-
if (d !== e.prev && d !== e.next &&
|
|
1248
|
+
for (; d !== null && d.z >= h; ) {
|
|
1249
|
+
if (d !== e.prev && d !== e.next && ue(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && D(d.prev, d, d.next) >= 0)
|
|
1249
1250
|
return !1;
|
|
1250
1251
|
d = d.prevZ;
|
|
1251
1252
|
}
|
|
1252
|
-
for (; m !== null && m.z <=
|
|
1253
|
-
if (m !== e.prev && m !== e.next &&
|
|
1253
|
+
for (; m !== null && m.z <= u; ) {
|
|
1254
|
+
if (m !== e.prev && m !== e.next && ue(r.x, r.y, s.x, s.y, o.x, o.y, m.x, m.y) && D(m.prev, m, m.next) >= 0)
|
|
1254
1255
|
return !1;
|
|
1255
1256
|
m = m.nextZ;
|
|
1256
1257
|
}
|
|
@@ -1300,9 +1301,9 @@ var pt = function(e, t, n, i, r) {
|
|
|
1300
1301
|
let s = -1 / 0, o;
|
|
1301
1302
|
do {
|
|
1302
1303
|
if (r <= n.y && r >= n.next.y && n.next.y !== n.y) {
|
|
1303
|
-
const
|
|
1304
|
-
if (
|
|
1305
|
-
if (s =
|
|
1304
|
+
const u = n.x + (r - n.y) * (n.next.x - n.x) / (n.next.y - n.y);
|
|
1305
|
+
if (u <= i && u > s) {
|
|
1306
|
+
if (s = u, u === i) {
|
|
1306
1307
|
if (r === n.y)
|
|
1307
1308
|
return n;
|
|
1308
1309
|
if (r === n.next.y)
|
|
@@ -1318,10 +1319,10 @@ var pt = function(e, t, n, i, r) {
|
|
|
1318
1319
|
if (i === s)
|
|
1319
1320
|
return o;
|
|
1320
1321
|
const c = o, a = o.x, f = o.y;
|
|
1321
|
-
let l = 1 / 0,
|
|
1322
|
+
let l = 1 / 0, h;
|
|
1322
1323
|
n = o;
|
|
1323
1324
|
do
|
|
1324
|
-
i >= n.x && n.x >= a && i !== n.x &&
|
|
1325
|
+
i >= n.x && n.x >= a && i !== n.x && ue(r < f ? i : s, r, a, f, r < f ? s : i, r, n.x, n.y) && (h = Math.abs(r - n.y) / (i - n.x), _e(n, e) && (h < l || h === l && (n.x > o.x || n.x === o.x && D(o.prev, o, n.prev) < 0 && D(n.next, o, o.next) < 0)) && (o = n, l = h)), n = n.next;
|
|
1325
1326
|
while (n !== c);
|
|
1326
1327
|
return o;
|
|
1327
1328
|
}, jn = function(e, t, n, i) {
|
|
@@ -1351,7 +1352,7 @@ var pt = function(e, t, n, i, r) {
|
|
|
1351
1352
|
(t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next;
|
|
1352
1353
|
while (t !== e);
|
|
1353
1354
|
return n;
|
|
1354
|
-
},
|
|
1355
|
+
}, ue = function(e, t, n, i, r, s, o, c) {
|
|
1355
1356
|
return (r - o) * (t - c) - (e - o) * (s - c) >= 0 && (e - o) * (i - c) - (n - o) * (t - c) >= 0 && (n - o) * (s - c) - (r - o) * (i - c) >= 0;
|
|
1356
1357
|
}, Vn = function(e, t) {
|
|
1357
1358
|
return e.next.i !== t.i && e.prev.i !== t.i && !Yn(e, t) && (_e(e, t) && _e(t, e) && $n(e, t) && (D(e.prev, e, t.prev) !== 0 || D(e, t.prev, t) !== 0) || je(e, t) && D(e.prev, e, e.next) > 0 && D(t.prev, t, t.next) > 0);
|
|
@@ -1414,14 +1415,14 @@ function Hn(e, t = [], n = 2) {
|
|
|
1414
1415
|
const o = [];
|
|
1415
1416
|
if (s === null || s.next === s.prev)
|
|
1416
1417
|
return o;
|
|
1417
|
-
let c = 1 / 0, a = 1 / 0, f = -1 / 0, l = -1 / 0,
|
|
1418
|
+
let c = 1 / 0, a = 1 / 0, f = -1 / 0, l = -1 / 0, h = 0, u, d;
|
|
1418
1419
|
if (i && (s = On(e, t, s, n)), e.length > 80 * n) {
|
|
1419
1420
|
c = f = e[0], a = l = e[1];
|
|
1420
1421
|
for (let m = n; m < r; m += n)
|
|
1421
|
-
|
|
1422
|
-
|
|
1422
|
+
u = e[m], d = e[m + 1], u < c && (c = u), d < a && (a = d), u > f && (f = u), d > l && (l = d);
|
|
1423
|
+
h = Math.max(f - c, l - a), h = h !== 0 ? 1 / h : 0;
|
|
1423
1424
|
}
|
|
1424
|
-
return Ee(s, o, n, c, a,
|
|
1425
|
+
return Ee(s, o, n, c, a, h, 0), o;
|
|
1425
1426
|
}
|
|
1426
1427
|
function Gn(e, t = 1 / 0, n = 0) {
|
|
1427
1428
|
const { vertices: i, holeIndices: r, dim: s } = Qn(e), o = Hn(i, r, s);
|
|
@@ -1439,65 +1440,65 @@ function Fn(e, t, n, i) {
|
|
|
1439
1440
|
var Kn = function(e, t, n, i, r, s, o, c) {
|
|
1440
1441
|
const a = i[e * s + o], f = i[t * s + o], l = i[n * s + o];
|
|
1441
1442
|
if (a < f && a < l) {
|
|
1442
|
-
const
|
|
1443
|
-
if (
|
|
1444
|
-
return $e(
|
|
1443
|
+
const h = a + c - ce(a, c);
|
|
1444
|
+
if (h > a && h <= f && h <= l && (f !== h || f !== h))
|
|
1445
|
+
return $e(h, e, t, n, a, f, l, i, r, s, o, c);
|
|
1445
1446
|
} else if (a > f && a > l) {
|
|
1446
|
-
let
|
|
1447
|
-
|
|
1448
|
-
const
|
|
1449
|
-
if (
|
|
1450
|
-
return ke(
|
|
1447
|
+
let h = ce(a, c);
|
|
1448
|
+
h === 0 && (h = c);
|
|
1449
|
+
const u = a - h;
|
|
1450
|
+
if (u < a && u >= f && u >= l && (f !== u || f !== u))
|
|
1451
|
+
return ke(u, e, t, n, a, f, l, i, r, s, o, c);
|
|
1451
1452
|
}
|
|
1452
1453
|
if (f < a && f < l) {
|
|
1453
|
-
const
|
|
1454
|
-
if (
|
|
1455
|
-
return $e(
|
|
1454
|
+
const h = f + c - ce(f, c);
|
|
1455
|
+
if (h > f && h <= l && h <= a && (a !== h || l !== h))
|
|
1456
|
+
return $e(h, t, n, e, f, l, a, i, r, s, o, c);
|
|
1456
1457
|
} else if (f > a && f > l) {
|
|
1457
|
-
let
|
|
1458
|
-
|
|
1459
|
-
const
|
|
1460
|
-
if (
|
|
1461
|
-
return ke(
|
|
1458
|
+
let h = ce(f, c);
|
|
1459
|
+
h === 0 && (h = c);
|
|
1460
|
+
const u = f - h;
|
|
1461
|
+
if (u < f && u >= l && u >= a && (a !== u || l !== u))
|
|
1462
|
+
return ke(u, t, n, e, f, l, a, i, r, s, o, c);
|
|
1462
1463
|
}
|
|
1463
1464
|
if (l < a && l < f) {
|
|
1464
|
-
const
|
|
1465
|
-
if (
|
|
1466
|
-
return $e(
|
|
1465
|
+
const h = l + c - ce(l, c);
|
|
1466
|
+
if (h > l && h <= a && h <= f && (a !== h || f !== h))
|
|
1467
|
+
return $e(h, n, e, t, l, a, f, i, r, s, o, c);
|
|
1467
1468
|
} else if (l > a && l > f) {
|
|
1468
|
-
let
|
|
1469
|
-
|
|
1470
|
-
const
|
|
1471
|
-
if (
|
|
1472
|
-
return ke(
|
|
1469
|
+
let h = ce(l, c);
|
|
1470
|
+
h === 0 && (h = c);
|
|
1471
|
+
const u = l - h;
|
|
1472
|
+
if (u < l && u >= a && u >= f && (a !== u || f !== u))
|
|
1473
|
+
return ke(u, n, e, t, l, a, f, i, r, s, o, c);
|
|
1473
1474
|
}
|
|
1474
1475
|
}, F = function(e, t, n, i, r, s, o, c) {
|
|
1475
1476
|
const a = s.length / o, f = (r - i) / (e - i);
|
|
1476
|
-
let l,
|
|
1477
|
-
for (let
|
|
1478
|
-
l = s[t * o +
|
|
1477
|
+
let l, h;
|
|
1478
|
+
for (let u = 0; u < o; u++)
|
|
1479
|
+
l = s[t * o + u], h = s[n * o + u], u !== c ? s.push(l + (h - l) / f) : s.push(e);
|
|
1479
1480
|
return a;
|
|
1480
|
-
}, $e = function(e, t, n, i, r, s, o, c, a, f, l,
|
|
1481
|
-
let
|
|
1482
|
-
if (a.push(t,
|
|
1481
|
+
}, $e = function(e, t, n, i, r, s, o, c, a, f, l, h) {
|
|
1482
|
+
let u = F(e, t, n, r, s, c, f, l), d = F(e, t, i, r, o, c, f, l);
|
|
1483
|
+
if (a.push(t, u, d), e += h, s < o) {
|
|
1483
1484
|
for (; e < s; )
|
|
1484
|
-
a.push(d,
|
|
1485
|
-
return a.push(d,
|
|
1485
|
+
a.push(d, u), d = F(e, t, i, r, o, c, f, l), a.push(d, d, u), u = F(e, t, n, r, s, c, f, l), a.push(u), e += h;
|
|
1486
|
+
return a.push(d, u, n), [d, n, i];
|
|
1486
1487
|
} else {
|
|
1487
1488
|
for (; e < o; )
|
|
1488
|
-
a.push(d,
|
|
1489
|
-
return a.push(d,
|
|
1489
|
+
a.push(d, u), d = F(e, t, i, r, o, c, f, l), a.push(d, d, u), u = F(e, t, n, r, s, c, f, l), a.push(u), e += h;
|
|
1490
|
+
return a.push(d, u, i), [i, u, n];
|
|
1490
1491
|
}
|
|
1491
|
-
}, ke = function(e, t, n, i, r, s, o, c, a, f, l,
|
|
1492
|
-
let
|
|
1493
|
-
if (a.push(t,
|
|
1492
|
+
}, ke = function(e, t, n, i, r, s, o, c, a, f, l, h) {
|
|
1493
|
+
let u = F(e, t, n, r, s, c, f, l), d = F(e, t, i, r, o, c, f, l);
|
|
1494
|
+
if (a.push(t, u, d), e -= h, s > o) {
|
|
1494
1495
|
for (; e > s; )
|
|
1495
|
-
a.push(d,
|
|
1496
|
-
return a.push(d,
|
|
1496
|
+
a.push(d, u), d = F(e, t, i, r, o, c, f, l), a.push(d, d, u), u = F(e, t, n, r, s, c, f, l), a.push(u), e -= h;
|
|
1497
|
+
return a.push(d, u, n), [d, n, i];
|
|
1497
1498
|
} else {
|
|
1498
1499
|
for (; e > o; )
|
|
1499
|
-
a.push(d,
|
|
1500
|
-
return a.push(d,
|
|
1500
|
+
a.push(d, u), d = F(e, t, i, r, o, c, f, l), a.push(d, d, u), u = F(e, t, n, r, s, c, f, l), a.push(u), e -= h;
|
|
1501
|
+
return a.push(d, u, i), [i, u, n];
|
|
1501
1502
|
}
|
|
1502
1503
|
}, ce = function(e, t) {
|
|
1503
1504
|
return (e % t + t) % t;
|
|
@@ -1553,35 +1554,35 @@ const Pi = (e, t = {}) => {
|
|
|
1553
1554
|
positionBuffer: r,
|
|
1554
1555
|
indexBuffer: s
|
|
1555
1556
|
}), a = ({
|
|
1556
|
-
viewport: { projection:
|
|
1557
|
+
viewport: { projection: u, modelView: d, camera: m, screen: _ },
|
|
1557
1558
|
depth: w = !1,
|
|
1558
|
-
index:
|
|
1559
|
+
index: x = 0
|
|
1559
1560
|
}) => {
|
|
1560
1561
|
const A = t.color?.() ?? [1, 1, 1, 1];
|
|
1561
1562
|
if (f(), ge(n, w, t))
|
|
1562
1563
|
return;
|
|
1563
1564
|
(w ? c : o).execute({
|
|
1564
|
-
projection:
|
|
1565
|
+
projection: u,
|
|
1565
1566
|
modelView: d,
|
|
1566
1567
|
camera: Q(m),
|
|
1567
1568
|
screen: _,
|
|
1568
1569
|
count: i,
|
|
1569
1570
|
color: A,
|
|
1570
|
-
index:
|
|
1571
|
+
index: x
|
|
1571
1572
|
});
|
|
1572
1573
|
}, f = me(
|
|
1573
1574
|
() => t.points?.() ?? [],
|
|
1574
|
-
(
|
|
1575
|
-
const { vertices: d, indices: m } =
|
|
1575
|
+
(u) => {
|
|
1576
|
+
const { vertices: d, indices: m } = u.length > 0 ? Gn(u.map((_) => _.map((w) => [...Q(L(w))]))) : { vertices: [], indices: [] };
|
|
1576
1577
|
r.set(d), s.set(m), i = m.length;
|
|
1577
1578
|
}
|
|
1578
1579
|
), l = () => {
|
|
1579
1580
|
r.dispose(), s.dispose();
|
|
1580
|
-
},
|
|
1581
|
+
}, h = Ae(t);
|
|
1581
1582
|
return {
|
|
1582
1583
|
render: a,
|
|
1583
1584
|
dispose: l,
|
|
1584
|
-
...
|
|
1585
|
+
...h
|
|
1585
1586
|
};
|
|
1586
1587
|
}, ei = ({ gl: e, programs: t }, {
|
|
1587
1588
|
positionBuffer: n,
|
|
@@ -1593,17 +1594,17 @@ const Pi = (e, t = {}) => {
|
|
|
1593
1594
|
fragmentSource: c ? Re : qn
|
|
1594
1595
|
}), f = a.attribute3i("position", n, {
|
|
1595
1596
|
stride: 3 * Int32Array.BYTES_PER_ELEMENT
|
|
1596
|
-
}), l = a.uniformMatrix4f("projection"),
|
|
1597
|
+
}), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform3i("camera"), d = a.uniform2f("screen"), m = a.uniform4f("color"), _ = a.uniform1i("index");
|
|
1597
1598
|
return { execute: ({
|
|
1598
|
-
projection:
|
|
1599
|
+
projection: x,
|
|
1599
1600
|
modelView: A,
|
|
1600
1601
|
camera: v,
|
|
1601
1602
|
screen: T,
|
|
1602
|
-
count:
|
|
1603
|
+
count: p,
|
|
1603
1604
|
color: g,
|
|
1604
1605
|
index: E
|
|
1605
1606
|
}) => {
|
|
1606
|
-
|
|
1607
|
+
p !== 0 && (a.use(), f.use(), l.set(x), h.set(A), u.set(v), d.set(T), m.set(g), _.set(E), i.use(), e.drawElements(e.TRIANGLES, p, e.UNSIGNED_SHORT, 0));
|
|
1607
1608
|
} };
|
|
1608
1609
|
}, s = r(), o = r(!0);
|
|
1609
1610
|
return { renderProgram: s, depthProgram: o };
|
|
@@ -1657,7 +1658,7 @@ class Ie extends Array {
|
|
|
1657
1658
|
super(t), this.fill(0);
|
|
1658
1659
|
}
|
|
1659
1660
|
}
|
|
1660
|
-
class
|
|
1661
|
+
class he {
|
|
1661
1662
|
heap;
|
|
1662
1663
|
length;
|
|
1663
1664
|
// private constructor
|
|
@@ -1666,12 +1667,12 @@ class ue {
|
|
|
1666
1667
|
const n = wt(t);
|
|
1667
1668
|
if (!n)
|
|
1668
1669
|
return [];
|
|
1669
|
-
|
|
1670
|
-
const i = new
|
|
1671
|
-
return
|
|
1670
|
+
he.#c = !0;
|
|
1671
|
+
const i = new he(t, n);
|
|
1672
|
+
return he.#c = !1, i;
|
|
1672
1673
|
}
|
|
1673
1674
|
constructor(t, n) {
|
|
1674
|
-
if (!
|
|
1675
|
+
if (!he.#c)
|
|
1675
1676
|
throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
1676
1677
|
this.heap = new n(t), this.length = 0;
|
|
1677
1678
|
}
|
|
@@ -1687,7 +1688,7 @@ class Qe {
|
|
|
1687
1688
|
// really *need* to be protected. The rest can be modified, as they just
|
|
1688
1689
|
// set defaults for various methods.
|
|
1689
1690
|
#c;
|
|
1690
|
-
#
|
|
1691
|
+
#u;
|
|
1691
1692
|
#v;
|
|
1692
1693
|
#p;
|
|
1693
1694
|
#U;
|
|
@@ -1758,7 +1759,7 @@ class Qe {
|
|
|
1758
1759
|
#n;
|
|
1759
1760
|
#e;
|
|
1760
1761
|
#f;
|
|
1761
|
-
#
|
|
1762
|
+
#h;
|
|
1762
1763
|
#a;
|
|
1763
1764
|
#s;
|
|
1764
1765
|
#E;
|
|
@@ -1788,7 +1789,7 @@ class Qe {
|
|
|
1788
1789
|
keyList: t.#n,
|
|
1789
1790
|
valList: t.#e,
|
|
1790
1791
|
next: t.#f,
|
|
1791
|
-
prev: t.#
|
|
1792
|
+
prev: t.#h,
|
|
1792
1793
|
get head() {
|
|
1793
1794
|
return t.#a;
|
|
1794
1795
|
},
|
|
@@ -1816,7 +1817,7 @@ class Qe {
|
|
|
1816
1817
|
* {@link LRUCache.OptionsBase.maxSize} (read-only)
|
|
1817
1818
|
*/
|
|
1818
1819
|
get maxSize() {
|
|
1819
|
-
return this.#
|
|
1820
|
+
return this.#u;
|
|
1820
1821
|
}
|
|
1821
1822
|
/**
|
|
1822
1823
|
* The total computed size of items in the cache (read-only)
|
|
@@ -1849,22 +1850,22 @@ class Qe {
|
|
|
1849
1850
|
return this.#p;
|
|
1850
1851
|
}
|
|
1851
1852
|
constructor(t) {
|
|
1852
|
-
const { max: n = 0, ttl: i, ttlResolution: r = 1, ttlAutopurge: s, updateAgeOnGet: o, updateAgeOnHas: c, allowStale: a, dispose: f, disposeAfter: l, noDisposeOnSet:
|
|
1853
|
+
const { max: n = 0, ttl: i, ttlResolution: r = 1, ttlAutopurge: s, updateAgeOnGet: o, updateAgeOnHas: c, allowStale: a, dispose: f, disposeAfter: l, noDisposeOnSet: h, noUpdateTTL: u, maxSize: d = 0, maxEntrySize: m = 0, sizeCalculation: _, fetchMethod: w, noDeleteOnFetchRejection: x, noDeleteOnStaleGet: A, allowStaleOnFetchRejection: v, allowStaleOnFetchAbort: T, ignoreFetchAbort: p } = t;
|
|
1853
1854
|
if (n !== 0 && !q(n))
|
|
1854
1855
|
throw new TypeError("max option must be a nonnegative integer");
|
|
1855
1856
|
const g = n ? wt(n) : Array;
|
|
1856
1857
|
if (!g)
|
|
1857
1858
|
throw new Error("invalid max value: " + n);
|
|
1858
|
-
if (this.#c = n, this.#
|
|
1859
|
-
if (!this.#
|
|
1859
|
+
if (this.#c = n, this.#u = d, this.maxEntrySize = m || this.#u, this.sizeCalculation = _, this.sizeCalculation) {
|
|
1860
|
+
if (!this.#u && !this.maxEntrySize)
|
|
1860
1861
|
throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
1861
1862
|
if (typeof this.sizeCalculation != "function")
|
|
1862
1863
|
throw new TypeError("sizeCalculation set to non-function");
|
|
1863
1864
|
}
|
|
1864
1865
|
if (w !== void 0 && typeof w != "function")
|
|
1865
1866
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
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.#
|
|
1867
|
-
if (this.#
|
|
1867
|
+
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.#h = new g(n), this.#a = 0, this.#s = 0, this.#E = he.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 = !!h, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!x, this.allowStaleOnFetchRejection = !!v, this.allowStaleOnFetchAbort = !!T, this.ignoreFetchAbort = !!p, this.maxEntrySize !== 0) {
|
|
1868
|
+
if (this.#u !== 0 && !q(this.#u))
|
|
1868
1869
|
throw new TypeError("maxSize must be a positive integer if specified");
|
|
1869
1870
|
if (!q(this.maxEntrySize))
|
|
1870
1871
|
throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
@@ -1875,9 +1876,9 @@ class Qe {
|
|
|
1875
1876
|
throw new TypeError("ttl must be a positive integer if specified");
|
|
1876
1877
|
this.#N();
|
|
1877
1878
|
}
|
|
1878
|
-
if (this.#c === 0 && this.ttl === 0 && this.#
|
|
1879
|
+
if (this.#c === 0 && this.ttl === 0 && this.#u === 0)
|
|
1879
1880
|
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
1880
|
-
if (!this.ttlAutopurge && !this.#c && !this.#
|
|
1881
|
+
if (!this.ttlAutopurge && !this.#c && !this.#u) {
|
|
1881
1882
|
const E = "LRU_CACHE_UNBOUNDED";
|
|
1882
1883
|
ti(E) && (_t.add(E), yt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E, Qe));
|
|
1883
1884
|
}
|
|
@@ -1959,8 +1960,8 @@ class Qe {
|
|
|
1959
1960
|
throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
1960
1961
|
return r;
|
|
1961
1962
|
}, this.#P = (n, i, r) => {
|
|
1962
|
-
if (t[n] = i, this.#
|
|
1963
|
-
const s = this.#
|
|
1963
|
+
if (t[n] = i, this.#u) {
|
|
1964
|
+
const s = this.#u - t[n];
|
|
1964
1965
|
for (; this.#x > s; )
|
|
1965
1966
|
this.#z(!0);
|
|
1966
1967
|
}
|
|
@@ -1979,7 +1980,7 @@ class Qe {
|
|
|
1979
1980
|
*#T({ allowStale: t = this.allowStale } = {}) {
|
|
1980
1981
|
if (this.#r)
|
|
1981
1982
|
for (let n = this.#s; !(!this.#O(n) || ((t || !this.#m(n)) && (yield n), n === this.#a)); )
|
|
1982
|
-
n = this.#
|
|
1983
|
+
n = this.#h[n];
|
|
1983
1984
|
}
|
|
1984
1985
|
*#g({ allowStale: t = this.allowStale } = {}) {
|
|
1985
1986
|
if (this.#r)
|
|
@@ -2174,31 +2175,31 @@ class Qe {
|
|
|
2174
2175
|
const l = this.#I(t, n, i.size || 0, c);
|
|
2175
2176
|
if (this.maxEntrySize && l > this.maxEntrySize)
|
|
2176
2177
|
return a && (a.set = "miss", a.maxEntrySizeExceeded = !0), this.delete(t), this;
|
|
2177
|
-
let
|
|
2178
|
-
if (
|
|
2179
|
-
|
|
2178
|
+
let h = this.#r === 0 ? void 0 : this.#i.get(t);
|
|
2179
|
+
if (h === void 0)
|
|
2180
|
+
h = this.#r === 0 ? this.#s : this.#E.length !== 0 ? this.#E.pop() : this.#r === this.#c ? this.#z(!1) : this.#r, this.#n[h] = t, this.#e[h] = n, this.#i.set(t, h), this.#f[this.#s] = h, this.#h[h] = this.#s, this.#s = h, this.#r++, this.#P(h, l, a), a && (a.set = "add"), f = !1;
|
|
2180
2181
|
else {
|
|
2181
|
-
this.#b(
|
|
2182
|
-
const
|
|
2183
|
-
if (n !==
|
|
2184
|
-
if (this.#A && this.#t(
|
|
2185
|
-
|
|
2186
|
-
const { __staleWhileFetching: d } =
|
|
2182
|
+
this.#b(h);
|
|
2183
|
+
const u = this.#e[h];
|
|
2184
|
+
if (n !== u) {
|
|
2185
|
+
if (this.#A && this.#t(u)) {
|
|
2186
|
+
u.__abortController.abort(new Error("replaced"));
|
|
2187
|
+
const { __staleWhileFetching: d } = u;
|
|
2187
2188
|
d !== void 0 && !o && (this.#w && this.#v?.(d, t, "set"), this.#l && this.#o?.push([d, t, "set"]));
|
|
2188
2189
|
} else
|
|
2189
|
-
o || (this.#w && this.#v?.(
|
|
2190
|
-
if (this.#S(
|
|
2190
|
+
o || (this.#w && this.#v?.(u, t, "set"), this.#l && this.#o?.push([u, t, "set"]));
|
|
2191
|
+
if (this.#S(h), this.#P(h, l, a), this.#e[h] = n, a) {
|
|
2191
2192
|
a.set = "replace";
|
|
2192
|
-
const d =
|
|
2193
|
+
const d = u && this.#t(u) ? u.__staleWhileFetching : u;
|
|
2193
2194
|
d !== void 0 && (a.oldValue = d);
|
|
2194
2195
|
}
|
|
2195
2196
|
} else
|
|
2196
2197
|
a && (a.set = "update");
|
|
2197
2198
|
}
|
|
2198
|
-
if (r !== 0 && !this.#d && this.#N(), this.#d && (f || this.#D(
|
|
2199
|
-
const
|
|
2199
|
+
if (r !== 0 && !this.#d && this.#N(), this.#d && (f || this.#D(h, r, s), a && this.#R(a, h)), !o && this.#l && this.#o) {
|
|
2200
|
+
const u = this.#o;
|
|
2200
2201
|
let d;
|
|
2201
|
-
for (; d =
|
|
2202
|
+
for (; d = u?.shift(); )
|
|
2202
2203
|
this.#p?.(...d);
|
|
2203
2204
|
}
|
|
2204
2205
|
return this;
|
|
@@ -2279,25 +2280,25 @@ class Qe {
|
|
|
2279
2280
|
options: i,
|
|
2280
2281
|
context: r
|
|
2281
2282
|
}, f = (_, w = !1) => {
|
|
2282
|
-
const { aborted:
|
|
2283
|
-
if (i.status && (
|
|
2284
|
-
return
|
|
2283
|
+
const { aborted: x } = o.signal, A = i.ignoreFetchAbort && _ !== void 0;
|
|
2284
|
+
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)
|
|
2285
|
+
return h(o.signal.reason);
|
|
2285
2286
|
const v = d;
|
|
2286
2287
|
return this.#e[n] === d && (_ === void 0 ? v.__staleWhileFetching ? this.#e[n] = v.__staleWhileFetching : this.delete(t) : (i.status && (i.status.fetchUpdated = !0), this.set(t, _, a.options))), _;
|
|
2287
|
-
}, l = (_) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = _),
|
|
2288
|
-
const { aborted: w } = o.signal,
|
|
2289
|
-
if (this.#e[n] === d && (!v || T.__staleWhileFetching === void 0 ? this.delete(t) :
|
|
2288
|
+
}, l = (_) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = _), h(_)), h = (_) => {
|
|
2289
|
+
const { aborted: w } = o.signal, x = w && i.allowStaleOnFetchAbort, A = x || i.allowStaleOnFetchRejection, v = A || i.noDeleteOnFetchRejection, T = d;
|
|
2290
|
+
if (this.#e[n] === d && (!v || T.__staleWhileFetching === void 0 ? this.delete(t) : x || (this.#e[n] = T.__staleWhileFetching)), A)
|
|
2290
2291
|
return i.status && T.__staleWhileFetching !== void 0 && (i.status.returnedStale = !0), T.__staleWhileFetching;
|
|
2291
2292
|
if (T.__returned === T)
|
|
2292
2293
|
throw _;
|
|
2293
|
-
},
|
|
2294
|
-
const
|
|
2295
|
-
|
|
2294
|
+
}, u = (_, w) => {
|
|
2295
|
+
const x = this.#U?.(t, s, a);
|
|
2296
|
+
x && x instanceof Promise && x.then((A) => _(A === void 0 ? void 0 : A), w), o.signal.addEventListener("abort", () => {
|
|
2296
2297
|
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (_(void 0), i.allowStaleOnFetchAbort && (_ = (A) => f(A, !0)));
|
|
2297
2298
|
});
|
|
2298
2299
|
};
|
|
2299
2300
|
i.status && (i.status.fetchDispatched = !0);
|
|
2300
|
-
const d = new Promise(
|
|
2301
|
+
const d = new Promise(u).then(f, l), m = Object.assign(d, {
|
|
2301
2302
|
__abortController: o,
|
|
2302
2303
|
__staleWhileFetching: s,
|
|
2303
2304
|
__returned: void 0
|
|
@@ -2323,21 +2324,21 @@ class Qe {
|
|
|
2323
2324
|
sizeCalculation: f = this.sizeCalculation,
|
|
2324
2325
|
noUpdateTTL: l = this.noUpdateTTL,
|
|
2325
2326
|
// fetch exclusive options
|
|
2326
|
-
noDeleteOnFetchRejection:
|
|
2327
|
-
allowStaleOnFetchRejection:
|
|
2327
|
+
noDeleteOnFetchRejection: h = this.noDeleteOnFetchRejection,
|
|
2328
|
+
allowStaleOnFetchRejection: u = this.allowStaleOnFetchRejection,
|
|
2328
2329
|
ignoreFetchAbort: d = this.ignoreFetchAbort,
|
|
2329
2330
|
allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort,
|
|
2330
2331
|
context: _,
|
|
2331
2332
|
forceRefresh: w = !1,
|
|
2332
|
-
status:
|
|
2333
|
+
status: x,
|
|
2333
2334
|
signal: A
|
|
2334
2335
|
} = n;
|
|
2335
2336
|
if (!this.#A)
|
|
2336
|
-
return
|
|
2337
|
+
return x && (x.fetch = "get"), this.get(t, {
|
|
2337
2338
|
allowStale: i,
|
|
2338
2339
|
updateAgeOnGet: r,
|
|
2339
2340
|
noDeleteOnStaleGet: s,
|
|
2340
|
-
status:
|
|
2341
|
+
status: x
|
|
2341
2342
|
});
|
|
2342
2343
|
const v = {
|
|
2343
2344
|
allowStale: i,
|
|
@@ -2348,29 +2349,29 @@ class Qe {
|
|
|
2348
2349
|
size: a,
|
|
2349
2350
|
sizeCalculation: f,
|
|
2350
2351
|
noUpdateTTL: l,
|
|
2351
|
-
noDeleteOnFetchRejection:
|
|
2352
|
-
allowStaleOnFetchRejection:
|
|
2352
|
+
noDeleteOnFetchRejection: h,
|
|
2353
|
+
allowStaleOnFetchRejection: u,
|
|
2353
2354
|
allowStaleOnFetchAbort: m,
|
|
2354
2355
|
ignoreFetchAbort: d,
|
|
2355
|
-
status:
|
|
2356
|
+
status: x,
|
|
2356
2357
|
signal: A
|
|
2357
2358
|
};
|
|
2358
2359
|
let T = this.#i.get(t);
|
|
2359
2360
|
if (T === void 0) {
|
|
2360
|
-
|
|
2361
|
-
const
|
|
2362
|
-
return
|
|
2361
|
+
x && (x.fetch = "miss");
|
|
2362
|
+
const p = this.#L(t, T, v, _);
|
|
2363
|
+
return p.__returned = p;
|
|
2363
2364
|
} else {
|
|
2364
|
-
const
|
|
2365
|
-
if (this.#t(
|
|
2366
|
-
const M = i &&
|
|
2367
|
-
return
|
|
2365
|
+
const p = this.#e[T];
|
|
2366
|
+
if (this.#t(p)) {
|
|
2367
|
+
const M = i && p.__staleWhileFetching !== void 0;
|
|
2368
|
+
return x && (x.fetch = "inflight", M && (x.returnedStale = !0)), M ? p.__staleWhileFetching : p.__returned = p;
|
|
2368
2369
|
}
|
|
2369
2370
|
const g = this.#m(T);
|
|
2370
2371
|
if (!w && !g)
|
|
2371
|
-
return
|
|
2372
|
+
return x && (x.fetch = "hit"), this.#b(T), r && this.#M(T), x && this.#R(x, T), p;
|
|
2372
2373
|
const E = this.#L(t, T, v, _), R = E.__staleWhileFetching !== void 0 && i;
|
|
2373
|
-
return
|
|
2374
|
+
return x && (x.fetch = g ? "stale" : "refresh", R && g && (x.returnedStale = !0)), R ? E.__staleWhileFetching : E.__returned = E;
|
|
2374
2375
|
}
|
|
2375
2376
|
}
|
|
2376
2377
|
/**
|
|
@@ -2388,10 +2389,10 @@ class Qe {
|
|
|
2388
2389
|
o && (o.get = "miss");
|
|
2389
2390
|
}
|
|
2390
2391
|
#C(t, n) {
|
|
2391
|
-
this.#
|
|
2392
|
+
this.#h[n] = t, this.#f[t] = n;
|
|
2392
2393
|
}
|
|
2393
2394
|
#b(t) {
|
|
2394
|
-
t !== this.#s && (t === this.#a ? this.#a = this.#f[t] : this.#C(this.#
|
|
2395
|
+
t !== this.#s && (t === this.#a ? this.#a = this.#f[t] : this.#C(this.#h[t], this.#f[t]), this.#C(this.#s, t), this.#s = t);
|
|
2395
2396
|
}
|
|
2396
2397
|
/**
|
|
2397
2398
|
* Deletes a key out of the cache.
|
|
@@ -2408,14 +2409,14 @@ class Qe {
|
|
|
2408
2409
|
this.#S(i);
|
|
2409
2410
|
const r = this.#e[i];
|
|
2410
2411
|
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)
|
|
2411
|
-
this.#s = this.#
|
|
2412
|
+
this.#s = this.#h[i];
|
|
2412
2413
|
else if (i === this.#a)
|
|
2413
2414
|
this.#a = this.#f[i];
|
|
2414
2415
|
else {
|
|
2415
|
-
const s = this.#
|
|
2416
|
+
const s = this.#h[i];
|
|
2416
2417
|
this.#f[s] = this.#f[i];
|
|
2417
2418
|
const o = this.#f[i];
|
|
2418
|
-
this.#
|
|
2419
|
+
this.#h[o] = this.#h[i];
|
|
2419
2420
|
}
|
|
2420
2421
|
this.#r--, this.#E.push(i);
|
|
2421
2422
|
}
|
|
@@ -2477,24 +2478,24 @@ const We = (e) => {
|
|
|
2477
2478
|
if (!r)
|
|
2478
2479
|
throw new Error("Framebuffer creation failed");
|
|
2479
2480
|
const s = ([a = 0, f = 0, l = 0]) => {
|
|
2480
|
-
const
|
|
2481
|
-
if (!
|
|
2481
|
+
const h = i.get([a, f, l]);
|
|
2482
|
+
if (!h)
|
|
2482
2483
|
return;
|
|
2483
|
-
const { texture:
|
|
2484
|
+
const { texture: u, downsample: d } = h, m = 2 ** d, _ = [Math.floor(a / m), Math.floor(f / m), l - d], w = n.get(_);
|
|
2484
2485
|
if (w)
|
|
2485
2486
|
return { buffer: w, downsample: d };
|
|
2486
|
-
const
|
|
2487
|
-
return e.bindFramebuffer(e.FRAMEBUFFER, r),
|
|
2487
|
+
const x = new Uint8Array(4 * te * te);
|
|
2488
|
+
return e.bindFramebuffer(e.FRAMEBUFFER, r), u.attach(), e.readPixels(0, 0, te, te, e.RGBA, e.UNSIGNED_BYTE, x), e.bindFramebuffer(e.FRAMEBUFFER, null), n.set(_, x), { buffer: x, downsample: d };
|
|
2488
2489
|
};
|
|
2489
2490
|
return { get: ([a = 0, f = 0], l = ni) => {
|
|
2490
|
-
const
|
|
2491
|
-
let [_ = 0, w = 0] =
|
|
2492
|
-
const
|
|
2493
|
-
if (!
|
|
2491
|
+
const h = 2 ** l, u = L([a, f, 0]).map((M) => M * h), [d = 0, m = 0] = u.map((M) => Math.floor(M % h));
|
|
2492
|
+
let [_ = 0, w = 0] = u.map((M) => M % 1);
|
|
2493
|
+
const x = s([d, m, l]);
|
|
2494
|
+
if (!x)
|
|
2494
2495
|
return 0;
|
|
2495
|
-
const { buffer: A, downsample: v } =
|
|
2496
|
+
const { buffer: A, downsample: v } = x, T = 2 ** v;
|
|
2496
2497
|
[_, w] = [(d % T + _) / T, (m % T + w) / T];
|
|
2497
|
-
const
|
|
2498
|
+
const p = 4 * te * Math.floor(w * te) + 4 * Math.floor(_ * te), [g = 0, E = 0, y = 0] = A.slice(p, p + 4);
|
|
2498
2499
|
return (g * 65536 + E * 256 + y) / 10 - 1e4;
|
|
2499
2500
|
}, dispose: () => {
|
|
2500
2501
|
e.deleteFramebuffer(r);
|
|
@@ -2534,7 +2535,7 @@ const lt = ({
|
|
|
2534
2535
|
return r.delete(a), f;
|
|
2535
2536
|
r.set(a, !0);
|
|
2536
2537
|
} else {
|
|
2537
|
-
const [l,
|
|
2538
|
+
const [l, h, u] = a, d = t.replace("{x}", `${l}`).replace("{y}", `${h}`).replace("{z}", `${u}`), m = vt({
|
|
2538
2539
|
gl: e,
|
|
2539
2540
|
url: d,
|
|
2540
2541
|
onLoad: () => {
|
|
@@ -2561,10 +2562,10 @@ const lt = ({
|
|
|
2561
2562
|
const s = t.get(r);
|
|
2562
2563
|
if (s)
|
|
2563
2564
|
return s;
|
|
2564
|
-
const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0,
|
|
2565
|
-
const [
|
|
2565
|
+
const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0, h = 0]) => [o + l, c + h, a]).map((l) => vn(l, l)).map((l) => se(l, l)).map((l) => {
|
|
2566
|
+
const [h = 0, u = 0] = l, d = Math.max(a - 5, 0);
|
|
2566
2567
|
return L(
|
|
2567
|
-
we(l,
|
|
2568
|
+
we(l, h, u, e.get([h, u], d)),
|
|
2568
2569
|
l
|
|
2569
2570
|
);
|
|
2570
2571
|
});
|
|
@@ -2657,20 +2658,20 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2657
2658
|
onLoad: () => {
|
|
2658
2659
|
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);
|
|
2659
2660
|
}
|
|
2660
|
-
}), a = Fe(c, 3), f = ii({ gl: n, terrainCache: c }), l = si(f),
|
|
2661
|
-
|
|
2662
|
-
const
|
|
2663
|
-
|
|
2661
|
+
}), a = Fe(c, 3), f = ii({ gl: n, terrainCache: c }), l = si(f), h = V({ gl: n, type: "f32", target: "array" });
|
|
2662
|
+
h.set(fi.flatMap(([E = 0, y = 0, R = 0]) => [E, y, R]));
|
|
2663
|
+
const u = V({ gl: n, type: "u16", target: "element" });
|
|
2664
|
+
u.set(ci);
|
|
2664
2665
|
const { renderProgram: d, depthProgram: m } = li(e, {
|
|
2665
|
-
uvwBuffer:
|
|
2666
|
-
indexBuffer:
|
|
2667
|
-
}), _ = [0, 1, 2, 3], w = _.map(z),
|
|
2666
|
+
uvwBuffer: h,
|
|
2667
|
+
indexBuffer: u
|
|
2668
|
+
}), _ = [0, 1, 2, 3], w = _.map(z), x = _.map(ee), A = _.map(de), v = (E) => {
|
|
2668
2669
|
const { camera: y, worldToLocal: R, localToClip: M, clipToScreen: b } = E, P = (U) => {
|
|
2669
2670
|
const [S = 0, N = 0, I = 0] = U, j = l.get(U);
|
|
2670
|
-
let X =
|
|
2671
|
+
let X = ui(y, j);
|
|
2671
2672
|
if (!X) {
|
|
2672
|
-
const C = j.map((Z, $) => R(Z, w[$])).map((Z, $) => M(Z,
|
|
2673
|
-
if (
|
|
2673
|
+
const C = j.map((Z, $) => R(Z, w[$])).map((Z, $) => M(Z, x[$]));
|
|
2674
|
+
if (hi(C))
|
|
2674
2675
|
return [];
|
|
2675
2676
|
X = di(C.map((Z, $) => b(Z, A[$]))) > 512 / devicePixelRatio;
|
|
2676
2677
|
}
|
|
@@ -2709,12 +2710,12 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2709
2710
|
index: R
|
|
2710
2711
|
});
|
|
2711
2712
|
}
|
|
2712
|
-
},
|
|
2713
|
+
}, p = () => {
|
|
2713
2714
|
i?.dispose(), c.dispose(), f.dispose();
|
|
2714
2715
|
}, g = Ae(t);
|
|
2715
2716
|
return {
|
|
2716
2717
|
render: T,
|
|
2717
|
-
dispose:
|
|
2718
|
+
dispose: p,
|
|
2718
2719
|
...g
|
|
2719
2720
|
};
|
|
2720
2721
|
}, li = ({ gl: e, programs: t }, { uvwBuffer: n, indexBuffer: i }) => {
|
|
@@ -2722,9 +2723,9 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2722
2723
|
const a = t.get({
|
|
2723
2724
|
vertexSource: oi,
|
|
2724
2725
|
fragmentSource: c ? Re : ri
|
|
2725
|
-
}), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"),
|
|
2726
|
+
}), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform1i("imagery"), d = a.uniform1i("terrain"), m = a.uniform1i("downsample_imagery"), _ = a.uniform1i("downsample_terrain"), w = a.uniform4f("color"), x = a.uniform3i("xyz"), A = a.uniform3i("camera"), v = a.uniform1i("index");
|
|
2726
2727
|
return { execute: ({
|
|
2727
|
-
projection:
|
|
2728
|
+
projection: p,
|
|
2728
2729
|
modelView: g,
|
|
2729
2730
|
camera: E,
|
|
2730
2731
|
xyz: y,
|
|
@@ -2735,24 +2736,24 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2735
2736
|
color: U,
|
|
2736
2737
|
index: S
|
|
2737
2738
|
}) => {
|
|
2738
|
-
a.use(), f.use(), l.set(
|
|
2739
|
+
a.use(), f.use(), l.set(p), h.set(g), x.set(y), A.set(E), m.set(b), _.set(P), w.set(U), v.set(S), e.activeTexture(e.TEXTURE0), u.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);
|
|
2739
2740
|
} };
|
|
2740
2741
|
}, s = r(), o = r(!0);
|
|
2741
2742
|
return { renderProgram: s, depthProgram: o };
|
|
2742
|
-
},
|
|
2743
|
+
}, ui = (e, t) => {
|
|
2743
2744
|
const [n, i, r, s] = t.reduce(
|
|
2744
|
-
([f, l,
|
|
2745
|
+
([f, l, h, u], [d = 0, m = 0]) => [
|
|
2745
2746
|
Math.min(d, f),
|
|
2746
2747
|
Math.max(d, l),
|
|
2747
|
-
Math.min(m,
|
|
2748
|
-
Math.max(m,
|
|
2748
|
+
Math.min(m, h),
|
|
2749
|
+
Math.max(m, u)
|
|
2749
2750
|
],
|
|
2750
2751
|
[1, 0, 1, 0]
|
|
2751
2752
|
), [o = 0, c = 0, a = 0] = e;
|
|
2752
2753
|
return o > n && o < i && c > r && c < s && a > 0 && a < i - n;
|
|
2753
|
-
},
|
|
2754
|
+
}, hi = (e) => e.every(([t = 0, , , n = 0]) => t > n) || e.every(([t = 0, , , n = 0]) => t < -n) || e.every(([, t = 0, , n = 0]) => t > n) || e.every(([, t = 0, , n = 0]) => t < -n) || e.every(([, , t = 0, n = 0]) => t > n) || e.every(([, , t = 0, n = 0]) => t < -n) || e.every(([, , , t = 0]) => t < 0), di = (e) => Math.sqrt(
|
|
2754
2755
|
e.map(
|
|
2755
|
-
(t, n) =>
|
|
2756
|
+
(t, n) => un(
|
|
2756
2757
|
e[n] ?? [0, 0],
|
|
2757
2758
|
e[(n + 1) % e.length] ?? [0, 0]
|
|
2758
2759
|
)
|
|
@@ -2811,7 +2812,7 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2811
2812
|
t,
|
|
2812
2813
|
fn(
|
|
2813
2814
|
de(),
|
|
2814
|
-
|
|
2815
|
+
hn(de(), n, t),
|
|
2815
2816
|
1 - Math.exp(-Be * e)
|
|
2816
2817
|
)
|
|
2817
2818
|
), t)
|
|
@@ -2891,9 +2892,9 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2891
2892
|
), Ei = 10, Xi = (e) => {
|
|
2892
2893
|
const t = xi(() => e().orientation), n = pi(() => e().offset), i = vi(() => e().fieldOfView);
|
|
2893
2894
|
return ae(({ time: s, current: o, target: c }) => {
|
|
2894
|
-
const a = Te(L(o.target), L(c.target)) * H, f = Math.max(c.distance, a), l = 1 - Math.exp(-Ei * s),
|
|
2895
|
+
const a = Te(L(o.target), L(c.target)) * H, f = Math.max(c.distance, a), l = 1 - Math.exp(-Ei * s), h = Math.exp(
|
|
2895
2896
|
Math.log(o.distance) + (Math.log(f) - Math.log(o.distance)) * l
|
|
2896
|
-
),
|
|
2897
|
+
), u = o.distance > a ? 1 : o.distance / a, d = se(
|
|
2897
2898
|
ne(
|
|
2898
2899
|
z(),
|
|
2899
2900
|
L(o.target),
|
|
@@ -2904,14 +2905,14 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2904
2905
|
L(c.target),
|
|
2905
2906
|
L(o.target)
|
|
2906
2907
|
),
|
|
2907
|
-
l *
|
|
2908
|
+
l * u
|
|
2908
2909
|
)
|
|
2909
2910
|
)
|
|
2910
2911
|
);
|
|
2911
2912
|
return {
|
|
2912
2913
|
...o,
|
|
2913
2914
|
target: d,
|
|
2914
|
-
distance:
|
|
2915
|
+
distance: h,
|
|
2915
2916
|
orientation: t(),
|
|
2916
2917
|
offset: n(),
|
|
2917
2918
|
fieldOfView: i()
|
|
@@ -2936,8 +2937,8 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2936
2937
|
n
|
|
2937
2938
|
), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
2938
2939
|
let s = 0;
|
|
2939
|
-
const o = ([l = 0,
|
|
2940
|
-
s =
|
|
2940
|
+
const o = ([l = 0, h = 0]) => {
|
|
2941
|
+
s = h, e.bindTexture(e.TEXTURE_2D, t), e.texImage2D(
|
|
2941
2942
|
e.TEXTURE_2D,
|
|
2942
2943
|
0,
|
|
2943
2944
|
e.RGBA,
|
|
@@ -2957,10 +2958,10 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2957
2958
|
return {
|
|
2958
2959
|
use: r,
|
|
2959
2960
|
resize: o,
|
|
2960
|
-
read: ([l = 0,
|
|
2961
|
-
r(), e.readPixels(l, s -
|
|
2962
|
-
const [
|
|
2963
|
-
return [
|
|
2961
|
+
read: ([l = 0, h = 0]) => {
|
|
2962
|
+
r(), e.readPixels(l, s - h, 1, 1, e.RGBA, e.UNSIGNED_BYTE, c), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
2963
|
+
const [u = 0, d = 0, m = 0, _ = 0] = c, x = 2 * ((u * 256 + d) / (256 * 256 - 1)) - 1, A = m * 256 + _;
|
|
2964
|
+
return [x, A];
|
|
2964
2965
|
},
|
|
2965
2966
|
dispose: () => {
|
|
2966
2967
|
e.deleteTexture(t), e.deleteFramebuffer(i), e.deleteRenderbuffer(n);
|
|
@@ -2975,7 +2976,7 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2975
2976
|
let s = !1, o, c;
|
|
2976
2977
|
const a = () => {
|
|
2977
2978
|
s = !0;
|
|
2978
|
-
}, f = ({ x: m, y: _, movementX: w, movementY:
|
|
2979
|
+
}, f = ({ x: m, y: _, movementX: w, movementY: x }) => {
|
|
2979
2980
|
if (o) {
|
|
2980
2981
|
if (o.onDrag) {
|
|
2981
2982
|
const { point: A, position: v, layer: T } = i([m, _], { terrain: !0 });
|
|
@@ -2987,30 +2988,30 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2987
2988
|
}
|
|
2988
2989
|
return;
|
|
2989
2990
|
}
|
|
2990
|
-
if (s && (Math.abs(w) > 1 || Math.abs(
|
|
2991
|
+
if (s && (Math.abs(w) > 1 || Math.abs(x) > 1)) {
|
|
2991
2992
|
s = !1;
|
|
2992
2993
|
const { point: A, position: v, layer: T } = i([m, _]);
|
|
2993
2994
|
(T?.onDrag || T?.onDragFlat) && (o = T, o.onDragStart?.({ point: A, position: v, layer: T }), [, , c] = v);
|
|
2994
2995
|
}
|
|
2995
2996
|
}, l = (m) => {
|
|
2996
|
-
if (s &&
|
|
2997
|
-
const { x: _, y: w } = m, { point:
|
|
2998
|
-
o.onDragEnd?.({ point:
|
|
2997
|
+
if (s && h(m), s = !1, o) {
|
|
2998
|
+
const { x: _, y: w } = m, { point: x, position: A, layer: v } = i([_, w]);
|
|
2999
|
+
o.onDragEnd?.({ point: x, position: A, layer: v });
|
|
2999
3000
|
}
|
|
3000
3001
|
o = void 0;
|
|
3001
|
-
},
|
|
3002
|
-
const { point:
|
|
3002
|
+
}, h = ({ x: m, y: _, button: w }) => {
|
|
3003
|
+
const { point: x, position: A, layer: v } = i([m, _]);
|
|
3003
3004
|
(w === 2 ? v?.onRightClick : v?.onClick)?.({
|
|
3004
|
-
point:
|
|
3005
|
+
point: x,
|
|
3005
3006
|
position: A,
|
|
3006
3007
|
layer: v
|
|
3007
3008
|
});
|
|
3008
|
-
},
|
|
3009
|
-
const { point: w, position:
|
|
3010
|
-
A?.onDoubleClick?.({ point: w, position:
|
|
3009
|
+
}, u = ({ x: m, y: _ }) => {
|
|
3010
|
+
const { point: w, position: x, layer: A } = i([m, _]);
|
|
3011
|
+
A?.onDoubleClick?.({ point: w, position: x, layer: A });
|
|
3011
3012
|
};
|
|
3012
|
-
return r?.addEventListener("mousedown", a), r?.addEventListener("mousemove", f), r?.addEventListener("dblclick",
|
|
3013
|
-
r?.removeEventListener("mousedown", a), r?.removeEventListener("mousemove", f), r?.removeEventListener("dblclick",
|
|
3013
|
+
return r?.addEventListener("mousedown", a), r?.addEventListener("mousemove", f), r?.addEventListener("dblclick", u), window.addEventListener("mouseup", l), { dispose: () => {
|
|
3014
|
+
r?.removeEventListener("mousedown", a), r?.removeEventListener("mousemove", f), r?.removeEventListener("dblclick", u), window.removeEventListener("mouseup", l);
|
|
3014
3015
|
} };
|
|
3015
3016
|
};
|
|
3016
3017
|
bt(Array);
|
|
@@ -3025,38 +3026,38 @@ const Wi = ({ gl: e }, t) => {
|
|
|
3025
3026
|
const f = new ResizeObserver(([v]) => {
|
|
3026
3027
|
if (!v)
|
|
3027
3028
|
return;
|
|
3028
|
-
const { contentRect: T } = v, { width:
|
|
3029
|
-
a([
|
|
3029
|
+
const { contentRect: T } = v, { width: p, height: g } = T;
|
|
3030
|
+
a([p, g]);
|
|
3030
3031
|
});
|
|
3031
3032
|
c instanceof HTMLCanvasElement && f.observe(c);
|
|
3032
3033
|
const l = ([v = 0, T = 0]) => {
|
|
3033
3034
|
e.viewport(0, 0, v * devicePixelRatio, T * devicePixelRatio), e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT);
|
|
3034
|
-
},
|
|
3035
|
+
}, h = () => {
|
|
3035
3036
|
const v = J(n(), s);
|
|
3036
3037
|
l(s), Oe(i()).forEach((T) => T.render?.({ viewport: v }));
|
|
3037
|
-
},
|
|
3038
|
+
}, u = (v) => {
|
|
3038
3039
|
const T = J(n(), s);
|
|
3039
3040
|
l(s), (v ? [v] : Oe(i())).forEach(
|
|
3040
|
-
(
|
|
3041
|
+
(p, g) => p.render?.({ viewport: T, depth: !0, index: g + 1 })
|
|
3041
3042
|
);
|
|
3042
3043
|
}, d = () => {
|
|
3043
|
-
r && (
|
|
3044
|
+
r && (h(), requestAnimationFrame(d));
|
|
3044
3045
|
};
|
|
3045
3046
|
requestAnimationFrame(d);
|
|
3046
3047
|
const m = (v) => J(n(), s).project(v), _ = (v) => J(n(), s).unproject(v), w = (v, { terrain: T } = {}) => {
|
|
3047
|
-
const { screenToClip:
|
|
3048
|
+
const { screenToClip: p, clipToLocal: g, localToWorld: E } = J(
|
|
3048
3049
|
n(),
|
|
3049
3050
|
s
|
|
3050
3051
|
);
|
|
3051
3052
|
o.use();
|
|
3052
3053
|
const [y] = T ? i() : [];
|
|
3053
|
-
|
|
3054
|
+
u(y);
|
|
3054
3055
|
const [R = 0, M = 0] = v, [b, P] = o.read([
|
|
3055
3056
|
R * devicePixelRatio,
|
|
3056
3057
|
M * devicePixelRatio
|
|
3057
|
-
]), [U = 0, S = 0] =
|
|
3058
|
+
]), [U = 0, S = 0] = p(v), N = se(E(g([U, S, b, 1]))), I = P === 0 ? void 0 : y ?? Oe(i())[P - 1];
|
|
3058
3059
|
return { point: v, position: N, layer: I };
|
|
3059
|
-
},
|
|
3060
|
+
}, x = yi(e, {
|
|
3060
3061
|
view: n,
|
|
3061
3062
|
screen: () => s,
|
|
3062
3063
|
pick: w
|
|
@@ -3066,7 +3067,7 @@ const Wi = ({ gl: e }, t) => {
|
|
|
3066
3067
|
unproject: _,
|
|
3067
3068
|
pick: w,
|
|
3068
3069
|
dispose: () => {
|
|
3069
|
-
r = !1,
|
|
3070
|
+
r = !1, x.dispose(), o.dispose(), c instanceof HTMLCanvasElement && f.unobserve(c);
|
|
3070
3071
|
}
|
|
3071
3072
|
};
|
|
3072
3073
|
}, Oe = (e) => e.flatMap((t) => [...Oe(t.children ?? []), t]);
|
|
@@ -3097,7 +3098,7 @@ export {
|
|
|
3097
3098
|
Wi as createWorld,
|
|
3098
3099
|
Rt as debounce,
|
|
3099
3100
|
Di as defaultLayerOptions,
|
|
3100
|
-
|
|
3101
|
+
ht as defaultView,
|
|
3101
3102
|
dn as degrees,
|
|
3102
3103
|
se as geodetic,
|
|
3103
3104
|
L as mercator,
|