world.ts 0.1.2 → 0.1.4
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 +425 -404
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/assets/image-load-worker-nFfjtK8d.js +0 -2
- package/dist/index.js.js +0 -1535
- package/dist/index.js.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var X = typeof Float32Array < "u" ? Float32Array : Array;
|
|
2
|
-
function
|
|
2
|
+
function Ne(e) {
|
|
3
3
|
X = e;
|
|
4
4
|
}
|
|
5
5
|
Math.hypot || (Math.hypot = function() {
|
|
@@ -7,46 +7,46 @@ Math.hypot || (Math.hypot = function() {
|
|
|
7
7
|
e += arguments[t] * arguments[t];
|
|
8
8
|
return Math.sqrt(e);
|
|
9
9
|
});
|
|
10
|
-
function
|
|
10
|
+
function Q() {
|
|
11
11
|
var e = new X(16);
|
|
12
12
|
return X != Float32Array && (e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0), e[0] = 1, e[5] = 1, e[10] = 1, e[15] = 1, e;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Me(e) {
|
|
15
15
|
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;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
var r = t[0], n = t[1], i = t[2], s = t[3], c = t[4], a = t[5], o = t[6],
|
|
19
|
-
return U ? (U = 1 / U, e[0] = (a * P - o *
|
|
20
|
-
}
|
|
21
|
-
function Ne(e, t, r) {
|
|
22
|
-
var n = t[0], i = t[1], s = t[2], c = t[3], a = t[4], o = t[5], d = t[6], f = t[7], m = t[8], E = t[9], _ = t[10], M = t[11], R = t[12], w = t[13], v = t[14], L = t[15], T = r[0], h = r[1], l = r[2], u = r[3];
|
|
23
|
-
return e[0] = T * n + h * a + l * m + u * R, e[1] = T * i + h * o + l * E + u * w, e[2] = T * s + h * d + l * _ + u * v, e[3] = T * c + h * f + l * M + u * L, T = r[4], h = r[5], l = r[6], u = r[7], e[4] = T * n + h * a + l * m + u * R, e[5] = T * i + h * o + l * E + u * w, e[6] = T * s + h * d + l * _ + u * v, e[7] = T * c + h * f + l * M + u * L, T = r[8], h = r[9], l = r[10], u = r[11], e[8] = T * n + h * a + l * m + u * R, e[9] = T * i + h * o + l * E + u * w, e[10] = T * s + h * d + l * _ + u * v, e[11] = T * c + h * f + l * M + u * L, T = r[12], h = r[13], l = r[14], u = r[15], e[12] = T * n + h * a + l * m + u * R, e[13] = T * i + h * o + l * E + u * w, e[14] = T * s + h * d + l * _ + u * v, e[15] = T * c + h * f + l * M + u * L, e;
|
|
17
|
+
function Ie(e, t) {
|
|
18
|
+
var r = t[0], n = t[1], i = t[2], s = t[3], c = t[4], a = t[5], o = t[6], l = t[7], f = t[8], m = t[9], y = t[10], w = t[11], R = t[12], M = t[13], _ = t[14], v = t[15], S = r * a - n * c, T = r * o - i * c, h = r * l - s * c, d = n * o - i * a, u = n * l - s * a, E = i * l - s * o, b = f * M - m * R, A = f * _ - y * R, L = f * v - w * R, p = m * _ - y * M, x = m * v - w * M, P = y * v - w * _, U = S * P - T * x + h * p + d * L - u * A + E * b;
|
|
19
|
+
return U ? (U = 1 / U, e[0] = (a * P - o * x + l * p) * U, e[1] = (i * x - n * P - s * p) * U, e[2] = (M * E - _ * u + v * d) * U, e[3] = (y * u - m * E - w * d) * U, e[4] = (o * L - c * P - l * A) * U, e[5] = (r * P - i * L + s * A) * U, e[6] = (_ * h - R * E - v * T) * U, e[7] = (f * E - y * h + w * T) * U, e[8] = (c * x - a * L + l * b) * U, e[9] = (n * L - r * x - s * b) * U, e[10] = (R * u - M * h + v * S) * U, e[11] = (m * h - f * u - w * S) * U, e[12] = (a * A - c * p - o * b) * U, e[13] = (r * p - n * A + i * b) * U, e[14] = (M * T - R * d - _ * S) * U, e[15] = (f * d - m * T + y * S) * U, e) : null;
|
|
24
20
|
}
|
|
25
21
|
function De(e, t, r) {
|
|
22
|
+
var n = t[0], i = t[1], s = t[2], c = t[3], a = t[4], o = t[5], l = t[6], f = t[7], m = t[8], y = t[9], w = t[10], R = t[11], M = t[12], _ = t[13], v = t[14], S = t[15], T = r[0], h = r[1], d = r[2], u = r[3];
|
|
23
|
+
return e[0] = T * n + h * a + d * m + u * M, e[1] = T * i + h * o + d * y + u * _, e[2] = T * s + h * l + d * w + u * v, e[3] = T * c + h * f + d * R + u * S, T = r[4], h = r[5], d = r[6], u = r[7], e[4] = T * n + h * a + d * m + u * M, e[5] = T * i + h * o + d * y + u * _, e[6] = T * s + h * l + d * w + u * v, e[7] = T * c + h * f + d * R + u * S, T = r[8], h = r[9], d = r[10], u = r[11], e[8] = T * n + h * a + d * m + u * M, e[9] = T * i + h * o + d * y + u * _, e[10] = T * s + h * l + d * w + u * v, e[11] = T * c + h * f + d * R + u * S, T = r[12], h = r[13], d = r[14], u = r[15], e[12] = T * n + h * a + d * m + u * M, e[13] = T * i + h * o + d * y + u * _, e[14] = T * s + h * l + d * w + u * v, e[15] = T * c + h * f + d * R + u * S, e;
|
|
24
|
+
}
|
|
25
|
+
function ke(e, t, r) {
|
|
26
26
|
var n = r[0], i = r[1], s = r[2];
|
|
27
27
|
return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e[4] = t[4] * i, e[5] = t[5] * i, e[6] = t[6] * i, e[7] = t[7] * i, 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;
|
|
28
28
|
}
|
|
29
|
-
function Ie(e, t, r) {
|
|
30
|
-
var n = Math.sin(r), i = Math.cos(r), s = t[4], c = t[5], a = t[6], o = t[7], d = t[8], f = t[9], m = t[10], E = t[11];
|
|
31
|
-
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 * i + d * n, e[5] = c * i + f * n, e[6] = a * i + m * n, e[7] = o * i + E * n, e[8] = d * i - s * n, e[9] = f * i - c * n, e[10] = m * i - a * n, e[11] = E * i - o * n, e;
|
|
32
|
-
}
|
|
33
29
|
function ge(e, t, r) {
|
|
34
|
-
var n = Math.sin(r), i = Math.cos(r), s = t[
|
|
35
|
-
return t !== e && (e[
|
|
30
|
+
var n = Math.sin(r), i = Math.cos(r), s = t[4], c = t[5], a = t[6], o = t[7], l = t[8], f = t[9], m = t[10], y = t[11];
|
|
31
|
+
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 * i + l * n, e[5] = c * i + f * n, e[6] = a * i + m * n, e[7] = o * i + y * n, e[8] = l * i - s * n, e[9] = f * i - c * n, e[10] = m * i - a * n, e[11] = y * i - o * n, e;
|
|
36
32
|
}
|
|
37
|
-
function
|
|
38
|
-
var n = Math.sin(r), i = Math.cos(r), s = t[0], c = t[1], a = t[2], o = t[3],
|
|
39
|
-
return t !== e && (e[
|
|
33
|
+
function Oe(e, t, r) {
|
|
34
|
+
var n = Math.sin(r), i = Math.cos(r), s = t[0], c = t[1], a = t[2], o = t[3], l = t[8], f = t[9], m = t[10], y = t[11];
|
|
35
|
+
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 * i - l * n, e[1] = c * i - f * n, e[2] = a * i - m * n, e[3] = o * i - y * n, e[8] = s * n + l * i, e[9] = c * n + f * i, e[10] = a * n + m * i, e[11] = o * n + y * i, e;
|
|
40
36
|
}
|
|
41
|
-
function
|
|
42
|
-
var
|
|
43
|
-
return e[
|
|
37
|
+
function Ce(e, t, r) {
|
|
38
|
+
var n = Math.sin(r), i = Math.cos(r), s = t[0], c = t[1], a = t[2], o = t[3], l = t[4], f = t[5], m = t[6], y = t[7];
|
|
39
|
+
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 * i + l * n, e[1] = c * i + f * n, e[2] = a * i + m * n, e[3] = o * i + y * n, e[4] = l * i - s * n, e[5] = f * i - c * n, e[6] = m * i - a * n, e[7] = y * i - o * n, e;
|
|
44
40
|
}
|
|
45
|
-
function
|
|
41
|
+
function We(e, t) {
|
|
42
|
+
var r = t[0], n = t[1], i = t[2], s = t[3], c = r + r, a = n + n, o = i + i, l = r * c, f = n * c, m = n * a, y = i * c, w = i * a, R = i * o, M = s * c, _ = s * a, v = s * o;
|
|
43
|
+
return e[0] = 1 - m - R, e[1] = f + v, e[2] = y - _, e[3] = 0, e[4] = f - v, e[5] = 1 - l - R, e[6] = w + M, e[7] = 0, e[8] = y + _, e[9] = w - M, e[10] = 1 - l - m, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;
|
|
44
|
+
}
|
|
45
|
+
function Be(e, t, r, n, i) {
|
|
46
46
|
var s = 1 / Math.tan(t / 2), c;
|
|
47
47
|
return e[0] = s / r, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = s, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, i != null && i !== 1 / 0 ? (c = 1 / (n - i), e[10] = (i + n) * c, e[14] = 2 * i * n * c) : (e[10] = -1, e[14] = -2 * n), e;
|
|
48
48
|
}
|
|
49
|
-
var
|
|
49
|
+
var Xe = Be;
|
|
50
50
|
function O() {
|
|
51
51
|
var e = new X(3);
|
|
52
52
|
return X != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e;
|
|
@@ -57,14 +57,14 @@ function re(e, t, r, n) {
|
|
|
57
57
|
function je(e, t, r) {
|
|
58
58
|
return e[0] = t[0] + r[0], e[1] = t[1] + r[1], e[2] = t[2] + r[2], e;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Ge(e, t, r) {
|
|
61
61
|
return e[0] = t[0] - r[0], e[1] = t[1] - r[1], e[2] = t[2] - r[2], e;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Ve(e, t) {
|
|
64
64
|
var r = t[0] - e[0], n = t[1] - e[1], i = t[2] - e[2];
|
|
65
65
|
return Math.hypot(r, n, i);
|
|
66
66
|
}
|
|
67
|
-
var ve =
|
|
67
|
+
var ve = Ge;
|
|
68
68
|
(function() {
|
|
69
69
|
var e = O();
|
|
70
70
|
return function(t, r, n, i, s, c) {
|
|
@@ -78,10 +78,10 @@ function ee() {
|
|
|
78
78
|
var e = new X(4);
|
|
79
79
|
return X != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0), e;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function be(e, t, r, n, i) {
|
|
82
82
|
return e[0] = t, e[1] = r, e[2] = n, e[3] = i, e;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function Le(e, t, r) {
|
|
85
85
|
var n = t[0], i = t[1], s = t[2], c = t[3];
|
|
86
86
|
return e[0] = r[0] * n + r[4] * i + r[8] * s + r[12] * c, e[1] = r[1] * n + r[5] * i + r[9] * s + r[13] * c, e[2] = r[2] * n + r[6] * i + r[10] * s + r[14] * c, e[3] = r[3] * n + r[7] * i + r[11] * s + r[15] * c, e;
|
|
87
87
|
}
|
|
@@ -94,19 +94,19 @@ function Se(e, t, r) {
|
|
|
94
94
|
return t;
|
|
95
95
|
};
|
|
96
96
|
})();
|
|
97
|
-
function
|
|
97
|
+
function Ee() {
|
|
98
98
|
var e = new X(2);
|
|
99
99
|
return X != Float32Array && (e[0] = 0, e[1] = 0), e;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function Ye(e, t, r) {
|
|
102
102
|
return e[0] = t, e[1] = r, e;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function Ze(e, t) {
|
|
105
105
|
var r = t[0] - e[0], n = t[1] - e[1];
|
|
106
106
|
return r * r + n * n;
|
|
107
107
|
}
|
|
108
108
|
(function() {
|
|
109
|
-
var e =
|
|
109
|
+
var e = Ee();
|
|
110
110
|
return function(t, r, n, i, s, c) {
|
|
111
111
|
var a, o;
|
|
112
112
|
for (r || (r = 2), n || (n = 0), i ? o = Math.min(i * r + n, t.length) : o = t.length, a = n; a < o; a += r)
|
|
@@ -156,14 +156,14 @@ const C = 40075017, He = (e) => {
|
|
|
156
156
|
resize: c,
|
|
157
157
|
read: ([f = 0, m = 0]) => {
|
|
158
158
|
i(), e.readPixels(f, s - m, 1, 1, e.RGBA, e.UNSIGNED_BYTE, a), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
159
|
-
const [
|
|
160
|
-
return [v,
|
|
159
|
+
const [y = 0, w = 0, R = 0, M = 0] = a, v = 2 * ((y * 256 + w) / (256 * 256 - 1)) - 1, S = R * 256 + M;
|
|
160
|
+
return [v, S];
|
|
161
161
|
},
|
|
162
162
|
destroy: () => {
|
|
163
163
|
e.deleteTexture(t), e.deleteFramebuffer(n), e.deleteRenderbuffer(r);
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
|
-
},
|
|
166
|
+
}, Y = ({
|
|
167
167
|
gl: e,
|
|
168
168
|
type: t,
|
|
169
169
|
target: r
|
|
@@ -183,28 +183,28 @@ const C = 40075017, He = (e) => {
|
|
|
183
183
|
use: s,
|
|
184
184
|
destroy: () => e.deleteBuffer(n)
|
|
185
185
|
};
|
|
186
|
-
},
|
|
186
|
+
}, $e = (e, t) => {
|
|
187
187
|
let r;
|
|
188
188
|
return (...n) => {
|
|
189
189
|
clearTimeout(r), r = setTimeout(() => e(n), t);
|
|
190
190
|
};
|
|
191
|
-
},
|
|
191
|
+
}, Z = (e, t) => Array.from({ length: t - e }, (r, n) => n + e), se = (e) => e / 180 * Math.PI, qe = (e) => e * 180 / Math.PI, Ke = (e, t, r) => {
|
|
192
192
|
const n = Math.sqrt(t * t - 4 * e * r);
|
|
193
193
|
return [(-t - n) / (2 * e), (-t + n) / (2 * e)];
|
|
194
|
-
},
|
|
194
|
+
}, H = ([e = 0, t = 0, r = 0], n = O()) => re(
|
|
195
195
|
n,
|
|
196
196
|
e / 360 + 0.5,
|
|
197
197
|
-Math.asinh(Math.tan(se(t))) / (2 * Math.PI) + 0.5,
|
|
198
198
|
r / C
|
|
199
|
-
),
|
|
199
|
+
), Ue = ([e = 0, t = 0, r = 0], n = O()) => re(
|
|
200
200
|
n,
|
|
201
201
|
(e - 0.5) * 360,
|
|
202
202
|
qe(Math.atan(Math.sinh(-(t - 0.5) * (2 * Math.PI)))),
|
|
203
203
|
r * C
|
|
204
|
-
),
|
|
204
|
+
), Je = ([e = 0, t = 0, r = 0], n = O()) => {
|
|
205
205
|
const i = 2 ** -r;
|
|
206
206
|
return re(n, e * i, t * i, 0);
|
|
207
|
-
},
|
|
207
|
+
}, xe = ({
|
|
208
208
|
gl: e,
|
|
209
209
|
vertexSource: t,
|
|
210
210
|
fragmentSource: r
|
|
@@ -212,84 +212,84 @@ const C = 40075017, He = (e) => {
|
|
|
212
212
|
const n = e.createProgram();
|
|
213
213
|
if (!n)
|
|
214
214
|
throw new Error("Program creation failed");
|
|
215
|
-
const i =
|
|
215
|
+
const i = Se(
|
|
216
216
|
e,
|
|
217
217
|
e.createShader(e.VERTEX_SHADER),
|
|
218
218
|
t
|
|
219
|
-
), s =
|
|
219
|
+
), s = Se(
|
|
220
220
|
e,
|
|
221
221
|
e.createShader(e.FRAGMENT_SHADER),
|
|
222
222
|
r
|
|
223
223
|
);
|
|
224
224
|
if (e.attachShader(n, i), e.attachShader(n, s), e.linkProgram(n), !e.getProgramParameter(n, e.LINK_STATUS))
|
|
225
225
|
throw console.error("Link failure", e.getProgramInfoLog(n)), new Error("Link failure");
|
|
226
|
-
const c = () => e.useProgram(n), a = (
|
|
227
|
-
const
|
|
228
|
-
let
|
|
229
|
-
return { set: (
|
|
230
|
-
|
|
226
|
+
const c = () => e.useProgram(n), a = (d, u) => {
|
|
227
|
+
const E = e.getUniformLocation(n, d);
|
|
228
|
+
let b;
|
|
229
|
+
return { set: (L) => {
|
|
230
|
+
L !== b && (E && u(E, L), b = L);
|
|
231
231
|
} };
|
|
232
|
-
}, o = (
|
|
233
|
-
|
|
234
|
-
(u, [
|
|
235
|
-
), m = (
|
|
236
|
-
|
|
237
|
-
(u, [
|
|
238
|
-
),
|
|
239
|
-
|
|
240
|
-
(u, [
|
|
241
|
-
),
|
|
242
|
-
|
|
243
|
-
(u, [
|
|
244
|
-
),
|
|
245
|
-
|
|
246
|
-
(u, [
|
|
247
|
-
),
|
|
248
|
-
|
|
249
|
-
(u, [
|
|
250
|
-
),
|
|
251
|
-
|
|
252
|
-
(u,
|
|
232
|
+
}, o = (d) => a(d, (u, E) => e.uniform1f(u, E)), l = (d) => a(d, (u, E) => e.uniform1i(u, E)), f = (d) => a(
|
|
233
|
+
d,
|
|
234
|
+
(u, [E = 0, b = 0]) => e.uniform2f(u, E, b)
|
|
235
|
+
), m = (d) => a(
|
|
236
|
+
d,
|
|
237
|
+
(u, [E = 0, b = 0]) => e.uniform2i(u, E, b)
|
|
238
|
+
), y = (d) => a(
|
|
239
|
+
d,
|
|
240
|
+
(u, [E = 0, b = 0, A = 0]) => e.uniform3f(u, E, b, A)
|
|
241
|
+
), w = (d) => a(
|
|
242
|
+
d,
|
|
243
|
+
(u, [E = 0, b = 0, A = 0]) => e.uniform3i(u, E, b, A)
|
|
244
|
+
), R = (d) => a(
|
|
245
|
+
d,
|
|
246
|
+
(u, [E = 0, b = 0, A = 0, L = 0]) => e.uniform4f(u, E, b, A, L)
|
|
247
|
+
), M = (d) => a(
|
|
248
|
+
d,
|
|
249
|
+
(u, [E = 0, b = 0, A = 0, L = 0]) => e.uniform4i(u, E, b, A, L)
|
|
250
|
+
), _ = (d) => a(
|
|
251
|
+
d,
|
|
252
|
+
(u, E) => e.uniformMatrix4fv(u, !1, E)
|
|
253
253
|
), v = ({
|
|
254
|
-
name:
|
|
254
|
+
name: d,
|
|
255
255
|
buffer: u,
|
|
256
|
-
size:
|
|
257
|
-
type:
|
|
258
|
-
stride:
|
|
259
|
-
offset:
|
|
256
|
+
size: E,
|
|
257
|
+
type: b,
|
|
258
|
+
stride: A,
|
|
259
|
+
offset: L
|
|
260
260
|
}) => {
|
|
261
|
-
const p = e.getAttribLocation(n,
|
|
261
|
+
const p = e.getAttribLocation(n, d);
|
|
262
262
|
if (p === -1)
|
|
263
|
-
throw new Error(`Missing attribute: ${
|
|
263
|
+
throw new Error(`Missing attribute: ${d}`);
|
|
264
264
|
return { use: () => {
|
|
265
265
|
u.use(), e.enableVertexAttribArray(p), e.vertexAttribPointer(
|
|
266
266
|
p,
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
E,
|
|
268
|
+
b === "u16" ? e.UNSIGNED_SHORT : e.FLOAT,
|
|
269
269
|
!1,
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
A || 0,
|
|
271
|
+
L || 0
|
|
272
272
|
);
|
|
273
273
|
} };
|
|
274
274
|
};
|
|
275
275
|
return {
|
|
276
276
|
use: c,
|
|
277
277
|
uniform1f: o,
|
|
278
|
-
uniform1i:
|
|
278
|
+
uniform1i: l,
|
|
279
279
|
uniform2f: f,
|
|
280
280
|
uniform2i: m,
|
|
281
|
-
uniform3f:
|
|
282
|
-
uniform3i:
|
|
283
|
-
uniform4f:
|
|
284
|
-
uniform4i:
|
|
285
|
-
uniformMatrix4f:
|
|
286
|
-
attribute2f: (
|
|
287
|
-
attribute3f: (
|
|
281
|
+
uniform3f: y,
|
|
282
|
+
uniform3i: w,
|
|
283
|
+
uniform4f: R,
|
|
284
|
+
uniform4i: M,
|
|
285
|
+
uniformMatrix4f: _,
|
|
286
|
+
attribute2f: (d, u, E = {}) => v({ name: d, buffer: u, size: 2, type: "f32", ...E }),
|
|
287
|
+
attribute3f: (d, u, E = {}) => v({ name: d, buffer: u, size: 3, type: "f32", ...E }),
|
|
288
288
|
destroy: () => {
|
|
289
289
|
e.deleteProgram(n), e.deleteShader(i), e.deleteShader(s);
|
|
290
290
|
}
|
|
291
291
|
};
|
|
292
|
-
},
|
|
292
|
+
}, Se = (e, t, r) => {
|
|
293
293
|
if (!t)
|
|
294
294
|
throw new Error("Shader creation failed");
|
|
295
295
|
if (e.shaderSource(t, r), e.compileShader(t), !e.getShaderParameter(t, e.COMPILE_STATUS))
|
|
@@ -318,8 +318,8 @@ vec2 pack_index(in int index) {
|
|
|
318
318
|
void main(void) {
|
|
319
319
|
result = vec4(pack_depth(gl_FragCoord.z), pack_index(index));
|
|
320
320
|
}`;
|
|
321
|
-
const
|
|
322
|
-
var
|
|
321
|
+
const de = 2 ** 30, te = ([e = 0, t = 0, r = 0]) => [Math.floor(e * de), Math.floor(t * de), Math.floor(r * de)];
|
|
322
|
+
var Qe = `#version 300 es
|
|
323
323
|
|
|
324
324
|
precision highp float;
|
|
325
325
|
|
|
@@ -328,7 +328,7 @@ out vec4 result;
|
|
|
328
328
|
|
|
329
329
|
void main() {
|
|
330
330
|
result = color_out;
|
|
331
|
-
}`,
|
|
331
|
+
}`, et = `#version 300 es
|
|
332
332
|
|
|
333
333
|
precision highp float;
|
|
334
334
|
|
|
@@ -391,24 +391,24 @@ void main(void) {
|
|
|
391
391
|
|
|
392
392
|
color_out = color;
|
|
393
393
|
}`;
|
|
394
|
-
const
|
|
394
|
+
const tt = (e, t) => {
|
|
395
395
|
let { points: r, color: n, width: i, minWidthPixels: s, maxWidthPixels: c } = {
|
|
396
396
|
points: [],
|
|
397
397
|
color: [1, 1, 1, 1],
|
|
398
398
|
width: 1,
|
|
399
399
|
...t
|
|
400
400
|
}, a = 0, o = [0, 0, 0];
|
|
401
|
-
const
|
|
402
|
-
positionBuffer:
|
|
401
|
+
const l = Y({ gl: e, type: "f32", target: "array" }), f = Y({ gl: e, type: "u16", target: "element" }), m = Y({ gl: e, type: "f32", target: "array" }), { renderProgram: y, depthProgram: w } = rt(e, {
|
|
402
|
+
positionBuffer: l,
|
|
403
403
|
indexBuffer: f,
|
|
404
404
|
cornerBuffer: m
|
|
405
|
-
}),
|
|
406
|
-
viewport: { projection: v, modelView:
|
|
407
|
-
depth:
|
|
405
|
+
}), R = ({
|
|
406
|
+
viewport: { projection: v, modelView: S, camera: T, screen: h },
|
|
407
|
+
depth: d = !1,
|
|
408
408
|
index: u = 0
|
|
409
|
-
}) => (
|
|
409
|
+
}) => (d ? w : y).execute({
|
|
410
410
|
projection: v,
|
|
411
|
-
modelView:
|
|
411
|
+
modelView: S,
|
|
412
412
|
camera: te(T),
|
|
413
413
|
center: te(o),
|
|
414
414
|
screen: h,
|
|
@@ -418,21 +418,21 @@ const Je = (e, t) => {
|
|
|
418
418
|
minWidthPixels: s || 0,
|
|
419
419
|
maxWidthPixels: c || Number.MAX_VALUE,
|
|
420
420
|
index: u
|
|
421
|
-
}),
|
|
422
|
-
|
|
423
|
-
},
|
|
421
|
+
}), M = () => {
|
|
422
|
+
l.destroy(), f.destroy(), m.destroy(), y.destroy(), w.destroy();
|
|
423
|
+
}, _ = (v) => {
|
|
424
424
|
r = v, a = v.length;
|
|
425
|
-
const [
|
|
426
|
-
if (!
|
|
425
|
+
const [S] = v, [T] = v.slice(-1);
|
|
426
|
+
if (!S || !T)
|
|
427
427
|
return;
|
|
428
|
-
o =
|
|
429
|
-
const h = [
|
|
430
|
-
const [
|
|
428
|
+
o = H(S);
|
|
429
|
+
const h = [S, ...v, T].map((E) => ve(O(), H(E), o)).flatMap((E) => [...E, ...E, ...E, ...E]), d = Z(0, a * 2).flatMap((E) => {
|
|
430
|
+
const [b = 0, A = 0, L = 0, p = 0] = Z(E * 2, E * 2 + 4);
|
|
431
431
|
return [
|
|
432
|
-
[
|
|
433
|
-
[
|
|
432
|
+
[b, A, L],
|
|
433
|
+
[b, L, p]
|
|
434
434
|
].flat();
|
|
435
|
-
}), u =
|
|
435
|
+
}), u = Z(0, a + 1).flatMap(
|
|
436
436
|
() => [
|
|
437
437
|
[-1, -1],
|
|
438
438
|
[-1, 1],
|
|
@@ -440,16 +440,16 @@ const Je = (e, t) => {
|
|
|
440
440
|
[1, -1]
|
|
441
441
|
].flat()
|
|
442
442
|
);
|
|
443
|
-
|
|
443
|
+
l.set(h), f.set(d), m.set(u);
|
|
444
444
|
};
|
|
445
|
-
return
|
|
446
|
-
render:
|
|
447
|
-
destroy:
|
|
445
|
+
return _(r), {
|
|
446
|
+
render: R,
|
|
447
|
+
destroy: M,
|
|
448
448
|
get points() {
|
|
449
449
|
return r;
|
|
450
450
|
},
|
|
451
451
|
set points(v) {
|
|
452
|
-
|
|
452
|
+
_(v);
|
|
453
453
|
},
|
|
454
454
|
get color() {
|
|
455
455
|
return n;
|
|
@@ -476,46 +476,46 @@ const Je = (e, t) => {
|
|
|
476
476
|
c = v;
|
|
477
477
|
}
|
|
478
478
|
};
|
|
479
|
-
},
|
|
479
|
+
}, rt = (e, {
|
|
480
480
|
positionBuffer: t,
|
|
481
481
|
indexBuffer: r,
|
|
482
482
|
cornerBuffer: n
|
|
483
483
|
}) => {
|
|
484
484
|
const i = (a = !1) => {
|
|
485
|
-
const o =
|
|
485
|
+
const o = xe({
|
|
486
486
|
gl: e,
|
|
487
|
-
vertexSource:
|
|
488
|
-
fragmentSource: a ? Te :
|
|
489
|
-
}),
|
|
490
|
-
stride: 3 *
|
|
487
|
+
vertexSource: et,
|
|
488
|
+
fragmentSource: a ? Te : Qe
|
|
489
|
+
}), l = Float32Array.BYTES_PER_ELEMENT, f = o.attribute3f("previous", t, {
|
|
490
|
+
stride: 3 * l
|
|
491
491
|
}), m = o.attribute3f("current", t, {
|
|
492
|
-
stride: 3 *
|
|
493
|
-
offset:
|
|
494
|
-
}),
|
|
495
|
-
stride: 3 *
|
|
496
|
-
offset:
|
|
497
|
-
}),
|
|
498
|
-
stride:
|
|
499
|
-
}),
|
|
492
|
+
stride: 3 * l,
|
|
493
|
+
offset: l * 3 * 4
|
|
494
|
+
}), y = o.attribute3f("next", t, {
|
|
495
|
+
stride: 3 * l,
|
|
496
|
+
offset: l * 3 * 4 * 2
|
|
497
|
+
}), w = o.attribute2f("corner", n, {
|
|
498
|
+
stride: l * 2
|
|
499
|
+
}), R = o.uniformMatrix4f("projection"), M = o.uniformMatrix4f("model_view"), _ = o.uniform3i("camera"), v = o.uniform3i("center"), S = o.uniform2f("screen"), T = o.uniform4f("color"), h = o.uniform1f("width"), d = o.uniform1f("max_width_pixels"), u = o.uniform1f("min_width_pixels"), E = o.uniform1i("index");
|
|
500
500
|
return { execute: ({
|
|
501
|
-
projection:
|
|
501
|
+
projection: L,
|
|
502
502
|
modelView: p,
|
|
503
|
-
camera:
|
|
503
|
+
camera: x,
|
|
504
504
|
center: P,
|
|
505
505
|
screen: U,
|
|
506
506
|
count: z,
|
|
507
507
|
color: F,
|
|
508
|
-
width:
|
|
509
|
-
minWidthPixels:
|
|
510
|
-
maxWidthPixels:
|
|
508
|
+
width: W,
|
|
509
|
+
minWidthPixels: k,
|
|
510
|
+
maxWidthPixels: q,
|
|
511
511
|
index: G
|
|
512
512
|
}) => {
|
|
513
|
-
z !== 0 && (e.enable(e.DEPTH_TEST), a ? e.disable(e.BLEND) : (e.enable(e.BLEND), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA)), o.use(), f.use(), m.use(),
|
|
513
|
+
z !== 0 && (e.enable(e.DEPTH_TEST), a ? e.disable(e.BLEND) : (e.enable(e.BLEND), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA)), o.use(), f.use(), m.use(), y.use(), w.use(), R.set(L), M.set(p), _.set(x), v.set(P), S.set(U), T.set(F), h.set(W), u.set(k), d.set(q), E.set(G), r.use(), e.drawElements(e.TRIANGLES, z * 3 * 4 - 4, e.UNSIGNED_SHORT, 0));
|
|
514
514
|
}, destroy: () => o.destroy() };
|
|
515
515
|
}, s = i(), c = i(!0);
|
|
516
516
|
return { renderProgram: s, depthProgram: c };
|
|
517
517
|
};
|
|
518
|
-
var
|
|
518
|
+
var nt = `#version 300 es
|
|
519
519
|
|
|
520
520
|
precision highp float;
|
|
521
521
|
|
|
@@ -524,7 +524,7 @@ out vec4 result;
|
|
|
524
524
|
|
|
525
525
|
void main() {
|
|
526
526
|
result = color_out;
|
|
527
|
-
}`,
|
|
527
|
+
}`, it = `#version 300 es
|
|
528
528
|
|
|
529
529
|
precision highp float;
|
|
530
530
|
|
|
@@ -559,7 +559,7 @@ void main(void) {
|
|
|
559
559
|
|
|
560
560
|
color_out = color;
|
|
561
561
|
}`;
|
|
562
|
-
const
|
|
562
|
+
const st = (e, t) => {
|
|
563
563
|
let {
|
|
564
564
|
vertices: r,
|
|
565
565
|
indices: n,
|
|
@@ -568,7 +568,7 @@ const nt = (e, t) => {
|
|
|
568
568
|
color: c,
|
|
569
569
|
size: a,
|
|
570
570
|
minSizePixels: o,
|
|
571
|
-
maxSizePixels:
|
|
571
|
+
maxSizePixels: l,
|
|
572
572
|
pickable: f
|
|
573
573
|
} = {
|
|
574
574
|
vertices: [],
|
|
@@ -580,42 +580,42 @@ const nt = (e, t) => {
|
|
|
580
580
|
pickable: !0,
|
|
581
581
|
...t
|
|
582
582
|
}, m = 0;
|
|
583
|
-
const
|
|
584
|
-
vertexBuffer:
|
|
585
|
-
indexBuffer:
|
|
586
|
-
}),
|
|
587
|
-
viewport: { projection: h, modelView:
|
|
588
|
-
depth:
|
|
589
|
-
index:
|
|
590
|
-
}) => (
|
|
583
|
+
const y = Y({ gl: e, type: "f32", target: "array" }), w = Y({ gl: e, type: "u16", target: "element" }), { renderProgram: R, depthProgram: M } = ot(e, {
|
|
584
|
+
vertexBuffer: y,
|
|
585
|
+
indexBuffer: w
|
|
586
|
+
}), _ = ({
|
|
587
|
+
viewport: { projection: h, modelView: d, camera: u, screen: E },
|
|
588
|
+
depth: b = !1,
|
|
589
|
+
index: A = 0
|
|
590
|
+
}) => (b ? M : R).execute({
|
|
591
591
|
projection: h,
|
|
592
|
-
modelView:
|
|
592
|
+
modelView: d,
|
|
593
593
|
camera: te(u),
|
|
594
|
-
screen:
|
|
594
|
+
screen: E,
|
|
595
595
|
count: m,
|
|
596
|
-
position: te(
|
|
597
|
-
orientation:
|
|
596
|
+
position: te(H(i)),
|
|
597
|
+
orientation: We(Q(), s),
|
|
598
598
|
color: c,
|
|
599
599
|
size: a / C,
|
|
600
600
|
minSizePixels: o || 0,
|
|
601
|
-
maxSizePixels:
|
|
601
|
+
maxSizePixels: l || Number.MAX_VALUE,
|
|
602
602
|
pickable: f,
|
|
603
|
-
index:
|
|
603
|
+
index: A
|
|
604
604
|
}), v = () => {
|
|
605
|
-
|
|
606
|
-
},
|
|
607
|
-
r = h,
|
|
605
|
+
y.destroy(), w.destroy(), R.destroy(), M.destroy();
|
|
606
|
+
}, S = (h) => {
|
|
607
|
+
r = h, y.set(h.flatMap((d) => [...d]));
|
|
608
608
|
}, T = (h) => {
|
|
609
|
-
n = h,
|
|
609
|
+
n = h, w.set(h.flatMap((d) => [...d])), m = h.length;
|
|
610
610
|
};
|
|
611
|
-
return
|
|
612
|
-
render:
|
|
611
|
+
return S(r), T(n), {
|
|
612
|
+
render: _,
|
|
613
613
|
destroy: v,
|
|
614
614
|
get vertices() {
|
|
615
615
|
return r;
|
|
616
616
|
},
|
|
617
617
|
set vertices(h) {
|
|
618
|
-
|
|
618
|
+
S(h);
|
|
619
619
|
},
|
|
620
620
|
get indices() {
|
|
621
621
|
return n;
|
|
@@ -654,10 +654,10 @@ const nt = (e, t) => {
|
|
|
654
654
|
o = h;
|
|
655
655
|
},
|
|
656
656
|
get maxSizePixels() {
|
|
657
|
-
return
|
|
657
|
+
return l;
|
|
658
658
|
},
|
|
659
659
|
set maxSizePixels(h) {
|
|
660
|
-
|
|
660
|
+
l = h;
|
|
661
661
|
},
|
|
662
662
|
get pickable() {
|
|
663
663
|
return f;
|
|
@@ -666,41 +666,41 @@ const nt = (e, t) => {
|
|
|
666
666
|
f = h;
|
|
667
667
|
}
|
|
668
668
|
};
|
|
669
|
-
},
|
|
669
|
+
}, ot = (e, {
|
|
670
670
|
vertexBuffer: t,
|
|
671
671
|
indexBuffer: r
|
|
672
672
|
}) => {
|
|
673
673
|
const n = (c = !1) => {
|
|
674
|
-
const a =
|
|
674
|
+
const a = xe({
|
|
675
675
|
gl: e,
|
|
676
|
-
vertexSource:
|
|
677
|
-
fragmentSource: c ? Te :
|
|
678
|
-
}), o = a.attribute3f("vertex", t),
|
|
676
|
+
vertexSource: it,
|
|
677
|
+
fragmentSource: c ? Te : nt
|
|
678
|
+
}), o = a.attribute3f("vertex", t), l = a.uniformMatrix4f("projection"), f = a.uniformMatrix4f("model_view"), m = a.uniform3i("camera"), y = a.uniform3i("position"), w = a.uniformMatrix4f("orientation"), R = a.uniform2f("screen"), M = a.uniform4f("color"), _ = a.uniform1f("size"), v = a.uniform1f("min_size_pixels"), S = a.uniform1f("max_size_pixels"), T = a.uniform1i("index");
|
|
679
679
|
return { execute: ({
|
|
680
680
|
projection: u,
|
|
681
|
-
modelView:
|
|
682
|
-
camera:
|
|
683
|
-
screen:
|
|
684
|
-
count:
|
|
681
|
+
modelView: E,
|
|
682
|
+
camera: b,
|
|
683
|
+
screen: A,
|
|
684
|
+
count: L,
|
|
685
685
|
position: p,
|
|
686
|
-
orientation:
|
|
686
|
+
orientation: x,
|
|
687
687
|
color: P,
|
|
688
688
|
size: U,
|
|
689
689
|
minSizePixels: z,
|
|
690
690
|
maxSizePixels: F,
|
|
691
|
-
pickable:
|
|
692
|
-
index:
|
|
691
|
+
pickable: W,
|
|
692
|
+
index: k
|
|
693
693
|
}) => {
|
|
694
694
|
if (c) {
|
|
695
|
-
if (e.disable(e.BLEND), !
|
|
695
|
+
if (e.disable(e.BLEND), !W)
|
|
696
696
|
return;
|
|
697
697
|
} else
|
|
698
698
|
e.enable(e.BLEND), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA);
|
|
699
|
-
e.enable(e.DEPTH_TEST), a.use(), o.use(),
|
|
699
|
+
e.enable(e.DEPTH_TEST), a.use(), o.use(), l.set(u), f.set(E), m.set(b), R.set(A), y.set(p), w.set(x), M.set(P), _.set(U), v.set(z), S.set(F), T.set(k), r.use(), e.drawElements(e.TRIANGLES, L * 3, e.UNSIGNED_SHORT, 0);
|
|
700
700
|
}, destroy: () => a.destroy() };
|
|
701
701
|
}, i = n(), s = n(!0);
|
|
702
702
|
return { renderProgram: i, depthProgram: s };
|
|
703
|
-
},
|
|
703
|
+
}, ye = (e, t = 0) => ({
|
|
704
704
|
get: ([r = 0, n = 0, i = 0]) => {
|
|
705
705
|
for (let s = Math.min(i, t); s <= i; s++) {
|
|
706
706
|
const c = 2 ** s, a = [
|
|
@@ -713,37 +713,37 @@ const nt = (e, t) => {
|
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
});
|
|
716
|
-
function
|
|
716
|
+
function at(e) {
|
|
717
717
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
718
718
|
}
|
|
719
|
-
const
|
|
719
|
+
const le = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, we = /* @__PURE__ */ new Set(), ue = (e, t) => {
|
|
720
720
|
const r = `LRU_CACHE_OPTION_${e}`;
|
|
721
|
-
ce(r) &&
|
|
721
|
+
ce(r) && _e(r, `${e} option`, `options.${t}`, B);
|
|
722
722
|
}, me = (e, t) => {
|
|
723
723
|
const r = `LRU_CACHE_METHOD_${e}`;
|
|
724
724
|
if (ce(r)) {
|
|
725
|
-
const { prototype: n } =
|
|
726
|
-
|
|
725
|
+
const { prototype: n } = B, { get: i } = Object.getOwnPropertyDescriptor(n, e);
|
|
726
|
+
_e(r, `${e} method`, `cache.${t}()`, i);
|
|
727
727
|
}
|
|
728
|
-
},
|
|
728
|
+
}, ct = (e, t) => {
|
|
729
729
|
const r = `LRU_CACHE_PROPERTY_${e}`;
|
|
730
730
|
if (ce(r)) {
|
|
731
|
-
const { prototype: n } =
|
|
732
|
-
|
|
731
|
+
const { prototype: n } = B, { get: i } = Object.getOwnPropertyDescriptor(n, e);
|
|
732
|
+
_e(r, `${e} property`, `cache.${t}`, i);
|
|
733
733
|
}
|
|
734
|
-
}, ce = (e) => typeof process == "object" && process && !
|
|
735
|
-
|
|
734
|
+
}, ce = (e) => typeof process == "object" && process && !we.has(e), _e = (e, t, r, n) => {
|
|
735
|
+
we.add(e);
|
|
736
736
|
const i = `The ${t} is deprecated. Please use ${r} instead.`;
|
|
737
737
|
process.emitWarning(i, "DeprecationWarning", e, n);
|
|
738
|
-
},
|
|
738
|
+
}, $ = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e), Pe = (e) => $(e) ? e <= Math.pow(2, 8) ? Uint8Array : e <= Math.pow(2, 16) ? Uint16Array : e <= Math.pow(2, 32) ? Uint32Array : e <= Number.MAX_SAFE_INTEGER ? oe : null : null;
|
|
739
739
|
class oe extends Array {
|
|
740
740
|
constructor(t) {
|
|
741
741
|
super(t), this.fill(0);
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
|
-
class
|
|
744
|
+
class ft {
|
|
745
745
|
constructor(t) {
|
|
746
|
-
const r = t ?
|
|
746
|
+
const r = t ? Pe(t) : Array;
|
|
747
747
|
this.heap = new r(t), this.length = 0;
|
|
748
748
|
}
|
|
749
749
|
push(t) {
|
|
@@ -753,7 +753,7 @@ class at {
|
|
|
753
753
|
return this.heap[--this.length];
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
|
-
class
|
|
756
|
+
class B {
|
|
757
757
|
constructor(t = {}) {
|
|
758
758
|
const {
|
|
759
759
|
max: r = 0,
|
|
@@ -763,37 +763,37 @@ class j {
|
|
|
763
763
|
updateAgeOnGet: c,
|
|
764
764
|
allowStale: a,
|
|
765
765
|
dispose: o,
|
|
766
|
-
disposeAfter:
|
|
766
|
+
disposeAfter: l,
|
|
767
767
|
noDisposeOnSet: f,
|
|
768
768
|
noUpdateTTL: m,
|
|
769
|
-
maxSize:
|
|
770
|
-
sizeCalculation:
|
|
771
|
-
fetchMethod:
|
|
769
|
+
maxSize: y = 0,
|
|
770
|
+
sizeCalculation: w,
|
|
771
|
+
fetchMethod: R
|
|
772
772
|
} = t, {
|
|
773
|
-
length:
|
|
774
|
-
maxAge:
|
|
773
|
+
length: M,
|
|
774
|
+
maxAge: _,
|
|
775
775
|
stale: v
|
|
776
|
-
} = t instanceof
|
|
777
|
-
if (r !== 0 &&
|
|
776
|
+
} = t instanceof B ? {} : t;
|
|
777
|
+
if (r !== 0 && !$(r))
|
|
778
778
|
throw new TypeError("max option must be a nonnegative integer");
|
|
779
|
-
const
|
|
780
|
-
if (!
|
|
779
|
+
const S = r ? Pe(r) : Array;
|
|
780
|
+
if (!S)
|
|
781
781
|
throw new Error("invalid max value: " + r);
|
|
782
|
-
if (this.max = r, this.maxSize =
|
|
782
|
+
if (this.max = r, this.maxSize = y, this.sizeCalculation = w || M, this.sizeCalculation) {
|
|
783
783
|
if (!this.maxSize)
|
|
784
784
|
throw new TypeError("cannot set sizeCalculation without setting maxSize");
|
|
785
785
|
if (typeof this.sizeCalculation != "function")
|
|
786
786
|
throw new TypeError("sizeCalculating set to non-function");
|
|
787
787
|
}
|
|
788
|
-
if (this.fetchMethod =
|
|
788
|
+
if (this.fetchMethod = R || null, this.fetchMethod && typeof this.fetchMethod != "function")
|
|
789
789
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
790
|
-
if (this.keyMap = /* @__PURE__ */ new Map(), this.keyList = new Array(r).fill(null), this.valList = new Array(r).fill(null), this.next = new
|
|
791
|
-
if (
|
|
790
|
+
if (this.keyMap = /* @__PURE__ */ new Map(), this.keyList = new Array(r).fill(null), this.valList = new Array(r).fill(null), this.next = new S(r), this.prev = new S(r), this.head = 0, this.tail = 0, this.free = new ft(r), this.initialFill = 1, this.size = 0, typeof o == "function" && (this.dispose = o), typeof l == "function" ? (this.disposeAfter = l, this.disposed = []) : (this.disposeAfter = null, this.disposed = null), this.noDisposeOnSet = !!f, this.noUpdateTTL = !!m, this.maxSize !== 0) {
|
|
791
|
+
if (!$(this.maxSize))
|
|
792
792
|
throw new TypeError("maxSize must be a positive integer if specified");
|
|
793
793
|
this.initializeSizeTracking();
|
|
794
794
|
}
|
|
795
|
-
if (this.allowStale = !!a || !!v, this.updateAgeOnGet = !!c, this.ttlResolution =
|
|
796
|
-
if (
|
|
795
|
+
if (this.allowStale = !!a || !!v, this.updateAgeOnGet = !!c, this.ttlResolution = $(i) || i === 0 ? i : 1, this.ttlAutopurge = !!s, this.ttl = n || _ || 0, this.ttl) {
|
|
796
|
+
if (!$(this.ttl))
|
|
797
797
|
throw new TypeError("ttl must be a positive integer if specified");
|
|
798
798
|
this.initializeTTLTracking();
|
|
799
799
|
}
|
|
@@ -801,27 +801,27 @@ class j {
|
|
|
801
801
|
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
802
802
|
if (!this.ttlAutopurge && !this.max && !this.maxSize) {
|
|
803
803
|
const T = "LRU_CACHE_UNBOUNDED";
|
|
804
|
-
ce(T) && (
|
|
804
|
+
ce(T) && (we.add(T), process.emitWarning("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", T, B));
|
|
805
805
|
}
|
|
806
|
-
v && ue("stale", "allowStale"),
|
|
806
|
+
v && ue("stale", "allowStale"), _ && ue("maxAge", "ttl"), M && ue("length", "sizeCalculation");
|
|
807
807
|
}
|
|
808
808
|
getRemainingTTL(t) {
|
|
809
809
|
return this.has(t) ? 1 / 0 : 0;
|
|
810
810
|
}
|
|
811
811
|
initializeTTLTracking() {
|
|
812
812
|
this.ttls = new oe(this.max), this.starts = new oe(this.max), this.setItemTTL = (n, i) => {
|
|
813
|
-
if (this.starts[n] = i !== 0 ?
|
|
813
|
+
if (this.starts[n] = i !== 0 ? le.now() : 0, this.ttls[n] = i, i !== 0 && this.ttlAutopurge) {
|
|
814
814
|
const s = setTimeout(() => {
|
|
815
815
|
this.isStale(n) && this.delete(this.keyList[n]);
|
|
816
816
|
}, i + 1);
|
|
817
817
|
s.unref && s.unref();
|
|
818
818
|
}
|
|
819
819
|
}, this.updateItemAge = (n) => {
|
|
820
|
-
this.starts[n] = this.ttls[n] !== 0 ?
|
|
820
|
+
this.starts[n] = this.ttls[n] !== 0 ? le.now() : 0;
|
|
821
821
|
};
|
|
822
822
|
let t = 0;
|
|
823
823
|
const r = () => {
|
|
824
|
-
const n =
|
|
824
|
+
const n = le.now();
|
|
825
825
|
if (this.ttlResolution > 0) {
|
|
826
826
|
t = n;
|
|
827
827
|
const i = setTimeout(() => t = 0, this.ttlResolution);
|
|
@@ -843,7 +843,7 @@ class j {
|
|
|
843
843
|
}
|
|
844
844
|
initializeSizeTracking() {
|
|
845
845
|
this.calculatedSize = 0, this.sizes = new oe(this.max), this.removeItemSize = (t) => this.calculatedSize -= this.sizes[t], this.requireSize = (t, r, n, i) => {
|
|
846
|
-
if (i && !n && (n = i(r, t)),
|
|
846
|
+
if (i && !n && (n = i(r, t)), !$(n))
|
|
847
847
|
throw new TypeError("size must be positive integer");
|
|
848
848
|
return n;
|
|
849
849
|
}, this.addItemSize = (t, r, n, i) => {
|
|
@@ -857,7 +857,7 @@ class j {
|
|
|
857
857
|
const r = this.keyMap.get(t);
|
|
858
858
|
r !== void 0 && (this.calculatedSize -= this.sizes[r]);
|
|
859
859
|
}
|
|
860
|
-
return
|
|
860
|
+
return B.prototype.delete.call(this, t);
|
|
861
861
|
};
|
|
862
862
|
}
|
|
863
863
|
removeItemSize(t) {
|
|
@@ -957,8 +957,8 @@ class j {
|
|
|
957
957
|
if (o === void 0)
|
|
958
958
|
o = this.newIndex(), this.keyList[o] = t, this.valList[o] = r, this.keyMap.set(t, o), this.next[this.tail] = o, this.prev[o] = this.tail, this.tail = o, this.size++, this.addItemSize(o, r, t, s), a = !1;
|
|
959
959
|
else {
|
|
960
|
-
const
|
|
961
|
-
r !==
|
|
960
|
+
const l = this.valList[o];
|
|
961
|
+
r !== l && (i || (this.dispose(l, t, "set"), this.disposeAfter && this.disposed.push([l, t, "set"])), this.removeItemSize(o), this.valList[o] = r, this.addItemSize(o, r, t, s)), this.moveToTail(o);
|
|
962
962
|
}
|
|
963
963
|
if (n !== 0 && this.ttl === 0 && !this.ttls && this.initializeTTLTracking(), a || this.setItemTTL(o, n), this.disposeAfter)
|
|
964
964
|
for (; this.disposed.length; )
|
|
@@ -1047,7 +1047,7 @@ class j {
|
|
|
1047
1047
|
return r;
|
|
1048
1048
|
}
|
|
1049
1049
|
clear() {
|
|
1050
|
-
if (this.dispose !==
|
|
1050
|
+
if (this.dispose !== B.prototype.dispose)
|
|
1051
1051
|
for (const t of this.rindexes({ allowStale: !0 }))
|
|
1052
1052
|
this.dispose(this.valList[t], this.keyList[t], "delete");
|
|
1053
1053
|
if (this.disposeAfter)
|
|
@@ -1061,12 +1061,12 @@ class j {
|
|
|
1061
1061
|
return me("reset", "clear"), this.clear;
|
|
1062
1062
|
}
|
|
1063
1063
|
get length() {
|
|
1064
|
-
return
|
|
1064
|
+
return ct("length", "size"), this.size;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
|
-
var
|
|
1068
|
-
const
|
|
1069
|
-
const t = new
|
|
1067
|
+
var ht = B;
|
|
1068
|
+
const dt = /* @__PURE__ */ at(ht), ae = (e) => {
|
|
1069
|
+
const t = new dt({
|
|
1070
1070
|
...e,
|
|
1071
1071
|
ttlResolution: 0,
|
|
1072
1072
|
dispose: (i, s) => e.dispose?.(i, n(s))
|
|
@@ -1083,40 +1083,40 @@ const ft = /* @__PURE__ */ st(ct), ae = (e) => {
|
|
|
1083
1083
|
clear: () => t.clear(),
|
|
1084
1084
|
purgeStale: () => t.purgeStale()
|
|
1085
1085
|
};
|
|
1086
|
-
},
|
|
1086
|
+
}, lt = 15, V = 256, ut = ({
|
|
1087
1087
|
gl: e,
|
|
1088
1088
|
terrainCache: t
|
|
1089
1089
|
}) => {
|
|
1090
1090
|
const r = ae({
|
|
1091
1091
|
max: 1e3
|
|
1092
|
-
}), n =
|
|
1092
|
+
}), n = ye(t), i = e.createFramebuffer();
|
|
1093
1093
|
if (!i)
|
|
1094
1094
|
throw new Error("Framebuffer creation failed");
|
|
1095
|
-
const s = ([o = 0,
|
|
1096
|
-
const m = n.get([o,
|
|
1095
|
+
const s = ([o = 0, l = 0, f = 0]) => {
|
|
1096
|
+
const m = n.get([o, l, f]);
|
|
1097
1097
|
if (!m)
|
|
1098
1098
|
return;
|
|
1099
|
-
const { texture:
|
|
1100
|
-
if (
|
|
1101
|
-
return { buffer:
|
|
1102
|
-
const v = new Uint8Array(4 *
|
|
1103
|
-
return e.bindFramebuffer(e.FRAMEBUFFER, i),
|
|
1099
|
+
const { texture: y, downsample: w } = m, R = 2 ** w, M = [Math.floor(o / R), Math.floor(l / R), f - w], _ = r.get(M);
|
|
1100
|
+
if (_)
|
|
1101
|
+
return { buffer: _, downsample: w };
|
|
1102
|
+
const v = new Uint8Array(4 * V * V);
|
|
1103
|
+
return e.bindFramebuffer(e.FRAMEBUFFER, i), y.attach(), e.readPixels(0, 0, V, V, e.RGBA, e.UNSIGNED_BYTE, v), e.bindFramebuffer(e.FRAMEBUFFER, null), r.set(M, v), { buffer: v, downsample: w };
|
|
1104
1104
|
};
|
|
1105
|
-
return { get: ([o = 0,
|
|
1106
|
-
const m = 2 ** f,
|
|
1107
|
-
let [
|
|
1108
|
-
const v = s([
|
|
1105
|
+
return { get: ([o = 0, l = 0], f = lt) => {
|
|
1106
|
+
const m = 2 ** f, y = H([o, l, 0]).map((L) => L * m), [w = 0, R = 0] = y.map((L) => Math.floor(L % m));
|
|
1107
|
+
let [M = 0, _ = 0] = y.map((L) => L % 1);
|
|
1108
|
+
const v = s([w, R, f]);
|
|
1109
1109
|
if (!v)
|
|
1110
1110
|
return 0;
|
|
1111
|
-
const { buffer:
|
|
1112
|
-
[
|
|
1113
|
-
const
|
|
1114
|
-
return (u * 65536 +
|
|
1111
|
+
const { buffer: S, downsample: T } = v, h = 2 ** T;
|
|
1112
|
+
[M, _] = [(w % h + M) / h, (R % h + _) / h];
|
|
1113
|
+
const d = 4 * V * Math.floor(_ * V) + 4 * Math.floor(M * V), [u = 0, E = 0, b = 0] = S.slice(d, d + 4);
|
|
1114
|
+
return (u * 65536 + E * 256 + b) / 10 - 1e4;
|
|
1115
1115
|
}, destroy: () => {
|
|
1116
1116
|
e.deleteFramebuffer(i);
|
|
1117
1117
|
} };
|
|
1118
1118
|
};
|
|
1119
|
-
var
|
|
1119
|
+
var mt = `#version 300 es
|
|
1120
1120
|
|
|
1121
1121
|
precision highp float;
|
|
1122
1122
|
|
|
@@ -1127,9 +1127,30 @@ out vec4 result;
|
|
|
1127
1127
|
void main(void) {
|
|
1128
1128
|
result = texture(imagery, uv);
|
|
1129
1129
|
}`;
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1132
|
-
|
|
1130
|
+
const Fe = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2FkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGFzeW5jIG49Pntjb25zdFtpLHRdPW4uZGF0YTtpZihpIT09ImxvYWQiKXJldHVybjtjb25zdCBvPW5ldyBBYm9ydENvbnRyb2xsZXIse3NpZ25hbDpjfT1vLHI9ZT0+e2NvbnN0W2Esc109ZS5kYXRhO2E9PT0iY2FuY2VsIiYmcz09PXQmJm8uYWJvcnQoKX07YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIscik7dHJ5e2NvbnN0IGU9YXdhaXQgZmV0Y2godCx7bW9kZToiY29ycyIsc2lnbmFsOmN9KTtpZighZS5vayl7cG9zdE1lc3NhZ2Uoe3VybDp0LGltYWdlOnZvaWQgMH0pO3JldHVybn1jb25zdCBhPWF3YWl0IGUuYmxvYigpLHM9YXdhaXQgY3JlYXRlSW1hZ2VCaXRtYXAoYSk7cG9zdE1lc3NhZ2Uoe3VybDp0LGltYWdlOnN9KX1jYXRjaChlKXtpZighKGUgaW5zdGFuY2VvZiBFcnJvciYmZS5tZXNzYWdlPT09IlRoZSB1c2VyIGFib3J0ZWQgYSByZXF1ZXN0LiIpKXRocm93IGV9ZmluYWxseXtyZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixyKX19KX0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPWltYWdlLWxvYWQtd29ya2VyLW5GZmp0SzhkLmpzLm1hcAo=", ze = typeof window < "u" && window.Blob && new Blob([atob(Fe)], { type: "text/javascript;charset=utf-8" });
|
|
1131
|
+
function pt(e) {
|
|
1132
|
+
let t;
|
|
1133
|
+
try {
|
|
1134
|
+
if (t = ze && (window.URL || window.webkitURL).createObjectURL(ze), !t)
|
|
1135
|
+
throw "";
|
|
1136
|
+
const r = new Worker(t, {
|
|
1137
|
+
name: e?.name
|
|
1138
|
+
});
|
|
1139
|
+
return r.addEventListener("error", () => {
|
|
1140
|
+
(window.URL || window.webkitURL).revokeObjectURL(t);
|
|
1141
|
+
}), r;
|
|
1142
|
+
} catch {
|
|
1143
|
+
return new Worker(
|
|
1144
|
+
"data:text/javascript;base64," + Fe,
|
|
1145
|
+
{
|
|
1146
|
+
name: e?.name
|
|
1147
|
+
}
|
|
1148
|
+
);
|
|
1149
|
+
} finally {
|
|
1150
|
+
t && (window.URL || window.webkitURL).revokeObjectURL(t);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
const ne = new Worker(pt), vt = ({
|
|
1133
1154
|
url: e,
|
|
1134
1155
|
onLoad: t
|
|
1135
1156
|
}) => {
|
|
@@ -1148,7 +1169,7 @@ const ne = new Worker(new URL("/assets/image-load-worker-nFfjtK8d.js", import.me
|
|
|
1148
1169
|
},
|
|
1149
1170
|
cancel: s
|
|
1150
1171
|
};
|
|
1151
|
-
},
|
|
1172
|
+
}, yt = (e) => {
|
|
1152
1173
|
const t = e.createTexture();
|
|
1153
1174
|
if (!t)
|
|
1154
1175
|
throw new Error("Texture creation failed");
|
|
@@ -1162,8 +1183,8 @@ const ne = new Worker(new URL("/assets/image-load-worker-nFfjtK8d.js", import.me
|
|
|
1162
1183
|
0
|
|
1163
1184
|
);
|
|
1164
1185
|
}, destroy: () => e.deleteTexture(t) };
|
|
1165
|
-
},
|
|
1166
|
-
const n =
|
|
1186
|
+
}, Et = ({ gl: e, url: t, onLoad: r }) => {
|
|
1187
|
+
const n = yt(e), i = vt({
|
|
1167
1188
|
url: t,
|
|
1168
1189
|
onLoad: (o) => {
|
|
1169
1190
|
o && (n.use(), e.texImage2D(
|
|
@@ -1186,7 +1207,7 @@ const ne = new Worker(new URL("/assets/image-load-worker-nFfjtK8d.js", import.me
|
|
|
1186
1207
|
i.cancel(), n.destroy();
|
|
1187
1208
|
}
|
|
1188
1209
|
};
|
|
1189
|
-
},
|
|
1210
|
+
}, Ae = ({
|
|
1190
1211
|
gl: e,
|
|
1191
1212
|
urlPattern: t,
|
|
1192
1213
|
onLoad: r
|
|
@@ -1197,31 +1218,31 @@ const ne = new Worker(new URL("/assets/image-load-worker-nFfjtK8d.js", import.me
|
|
|
1197
1218
|
}), i = ae({
|
|
1198
1219
|
max: 1e4,
|
|
1199
1220
|
ttl: 2e3,
|
|
1200
|
-
dispose: (o,
|
|
1201
|
-
const f = n.get(
|
|
1202
|
-
f && !f.loaded && (console.log("Cancel",
|
|
1221
|
+
dispose: (o, l) => {
|
|
1222
|
+
const f = n.get(l);
|
|
1223
|
+
f && !f.loaded && (console.log("Cancel", l), n.delete(l));
|
|
1203
1224
|
}
|
|
1204
1225
|
}), s = (o) => {
|
|
1205
|
-
const
|
|
1206
|
-
if (
|
|
1207
|
-
if (
|
|
1208
|
-
return i.delete(o),
|
|
1226
|
+
const l = n.get(o);
|
|
1227
|
+
if (l) {
|
|
1228
|
+
if (l.loaded)
|
|
1229
|
+
return i.delete(o), l;
|
|
1209
1230
|
i.set(o, !0);
|
|
1210
1231
|
} else {
|
|
1211
|
-
const [f, m,
|
|
1232
|
+
const [f, m, y] = o, w = t.replace("{x}", `${f}`).replace("{y}", `${m}`).replace("{z}", `${y}`), R = Et({
|
|
1212
1233
|
gl: e,
|
|
1213
|
-
url:
|
|
1234
|
+
url: w,
|
|
1214
1235
|
onLoad: () => {
|
|
1215
1236
|
i.delete(o), r?.();
|
|
1216
1237
|
}
|
|
1217
1238
|
});
|
|
1218
|
-
n.set(o,
|
|
1239
|
+
n.set(o, R), i.set(o, !0);
|
|
1219
1240
|
}
|
|
1220
1241
|
}, c = setInterval(() => i.purgeStale(), 200);
|
|
1221
1242
|
return { get: s, destroy: () => {
|
|
1222
1243
|
clearInterval(c), n.clear();
|
|
1223
1244
|
} };
|
|
1224
|
-
},
|
|
1245
|
+
}, xt = (e) => {
|
|
1225
1246
|
const t = ae({
|
|
1226
1247
|
max: 1e4,
|
|
1227
1248
|
ttl: 1e3
|
|
@@ -1235,17 +1256,17 @@ const ne = new Worker(new URL("/assets/image-load-worker-nFfjtK8d.js", import.me
|
|
|
1235
1256
|
const s = t.get(i);
|
|
1236
1257
|
if (s)
|
|
1237
1258
|
return s;
|
|
1238
|
-
const [c = 0, a = 0, o = 0] = i,
|
|
1239
|
-
const [m = 0,
|
|
1240
|
-
return
|
|
1241
|
-
re(f, m,
|
|
1259
|
+
const [c = 0, a = 0, o = 0] = i, l = r.map(([f = 0, m = 0]) => [c + f, a + m, o]).map((f) => Je(f, f)).map((f) => Ue(f, f)).map((f) => {
|
|
1260
|
+
const [m = 0, y = 0] = f, w = Math.max(o - 5, 0);
|
|
1261
|
+
return H(
|
|
1262
|
+
re(f, m, y, e.get([m, y], w)),
|
|
1242
1263
|
f
|
|
1243
1264
|
);
|
|
1244
1265
|
});
|
|
1245
|
-
return t.set(i,
|
|
1266
|
+
return t.set(i, l), l;
|
|
1246
1267
|
} };
|
|
1247
1268
|
};
|
|
1248
|
-
var
|
|
1269
|
+
var Tt = `#version 300 es
|
|
1249
1270
|
|
|
1250
1271
|
precision highp float;
|
|
1251
1272
|
|
|
@@ -1279,26 +1300,26 @@ void main(void) {
|
|
|
1279
1300
|
|
|
1280
1301
|
uv = downsample(downsample_imagery);
|
|
1281
1302
|
}`;
|
|
1282
|
-
const
|
|
1283
|
-
(e) =>
|
|
1284
|
-
e * (
|
|
1285
|
-
(e + 1) * (
|
|
1286
|
-
e * (
|
|
1287
|
-
e * (
|
|
1288
|
-
(e + 1) * (
|
|
1289
|
-
(e + 1) * (
|
|
1303
|
+
const I = 34, wt = 22, _t = Z(0, I).flatMap(
|
|
1304
|
+
(e) => Z(0, I).flatMap((t) => [
|
|
1305
|
+
e * (I + 1) + t,
|
|
1306
|
+
(e + 1) * (I + 1) + t + 1,
|
|
1307
|
+
e * (I + 1) + t + 1,
|
|
1308
|
+
e * (I + 1) + t,
|
|
1309
|
+
(e + 1) * (I + 1) + t,
|
|
1310
|
+
(e + 1) * (I + 1) + t + 1
|
|
1290
1311
|
])
|
|
1291
|
-
), ie = 0.5,
|
|
1292
|
-
(e) =>
|
|
1293
|
-
let r = (t - 1) / (
|
|
1294
|
-
return t === 0 && (r = 0, i = -ie), t ===
|
|
1312
|
+
), ie = 0.5, Rt = Z(0, I + 1).flatMap(
|
|
1313
|
+
(e) => Z(0, I + 1).map((t) => {
|
|
1314
|
+
let r = (t - 1) / (I - 2), n = (e - 1) / (I - 2), i = 0;
|
|
1315
|
+
return t === 0 && (r = 0, i = -ie), t === I && (r = 1, i = -ie), e === 0 && (n = 0, i = -ie), e === I && (n = 1, i = -ie), [r, n, i];
|
|
1295
1316
|
})
|
|
1296
|
-
),
|
|
1317
|
+
), Mt = (e, t) => {
|
|
1297
1318
|
const { terrainUrl: r, imageryUrl: n } = {
|
|
1298
1319
|
terrainUrl: "",
|
|
1299
1320
|
imageryUrl: "",
|
|
1300
1321
|
...t
|
|
1301
|
-
}, i =
|
|
1322
|
+
}, i = Ae({
|
|
1302
1323
|
gl: e,
|
|
1303
1324
|
urlPattern: n,
|
|
1304
1325
|
onLoad: () => {
|
|
@@ -1308,33 +1329,33 @@ const D = 34, xt = 22, yt = V(0, D).flatMap(
|
|
|
1308
1329
|
e.LINEAR_MIPMAP_LINEAR
|
|
1309
1330
|
), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.generateMipmap(e.TEXTURE_2D);
|
|
1310
1331
|
}
|
|
1311
|
-
}), s =
|
|
1332
|
+
}), s = Ae({
|
|
1312
1333
|
gl: e,
|
|
1313
1334
|
urlPattern: r,
|
|
1314
1335
|
onLoad: () => {
|
|
1315
1336
|
e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE);
|
|
1316
1337
|
}
|
|
1317
|
-
}), c =
|
|
1318
|
-
const { worldToLocal: h, localToClip:
|
|
1319
|
-
const [
|
|
1320
|
-
if (
|
|
1338
|
+
}), c = ye(i), a = ye(s, 3), o = ut({ gl: e, terrainCache: s }), l = xt(o), { renderProgram: f, depthProgram: m } = bt(e), y = [0, 1, 2, 3], w = y.map(O), R = y.map(ee), M = y.map(Ee), _ = (T) => {
|
|
1339
|
+
const { worldToLocal: h, localToClip: d, clipToScreen: u } = T, E = (b) => {
|
|
1340
|
+
const [A = 0, L = 0, p = 0] = b, x = l.get(b).map((z, F) => h(z, w[F])).map((z, F) => d(z, R[F]));
|
|
1341
|
+
if (x.every(([z = 0, , , F = 0]) => z > F) || x.every(([z = 0, , , F = 0]) => z < -F) || x.every(([, z = 0, , F = 0]) => z > F) || x.every(([, z = 0, , F = 0]) => z < -F) || x.every(([, , z = 0, F = 0]) => z > F) || x.every(([, , z = 0, F = 0]) => z < -F) || x.every(([, , , z = 0]) => z < 0))
|
|
1321
1342
|
return [];
|
|
1322
|
-
const P =
|
|
1343
|
+
const P = x.map((z, F) => u(z, M[F]));
|
|
1323
1344
|
return Math.sqrt(
|
|
1324
|
-
|
|
1325
|
-
(z) =>
|
|
1345
|
+
y.map(
|
|
1346
|
+
(z) => Ze(
|
|
1326
1347
|
P[z] ?? [0, 0],
|
|
1327
1348
|
P[(z + 1) % P.length] ?? [0, 0]
|
|
1328
1349
|
)
|
|
1329
1350
|
).reduce((z, F) => z + F, 0) / 4
|
|
1330
|
-
) > 512 && p <
|
|
1331
|
-
[2 *
|
|
1332
|
-
[2 *
|
|
1333
|
-
[2 *
|
|
1334
|
-
[2 *
|
|
1335
|
-
].flatMap((F) =>
|
|
1351
|
+
) > 512 && p < wt ? [
|
|
1352
|
+
[2 * A, 2 * L, p + 1],
|
|
1353
|
+
[2 * A + 1, 2 * L, p + 1],
|
|
1354
|
+
[2 * A, 2 * L + 1, p + 1],
|
|
1355
|
+
[2 * A + 1, 2 * L + 1, p + 1]
|
|
1356
|
+
].flatMap((F) => E(F)) : [b];
|
|
1336
1357
|
};
|
|
1337
|
-
return
|
|
1358
|
+
return E([0, 0, 0]);
|
|
1338
1359
|
};
|
|
1339
1360
|
return {
|
|
1340
1361
|
terrainUrl: r,
|
|
@@ -1342,24 +1363,24 @@ const D = 34, xt = 22, yt = V(0, D).flatMap(
|
|
|
1342
1363
|
render: ({
|
|
1343
1364
|
viewport: T,
|
|
1344
1365
|
depth: h = !1,
|
|
1345
|
-
index:
|
|
1366
|
+
index: d = 0
|
|
1346
1367
|
}) => {
|
|
1347
|
-
const { projection: u, modelView:
|
|
1348
|
-
for (const
|
|
1349
|
-
const p = h ? void 0 : c.get(
|
|
1350
|
-
if (!h && !p || !
|
|
1368
|
+
const { projection: u, modelView: E, camera: b } = T, A = _(T);
|
|
1369
|
+
for (const L of A) {
|
|
1370
|
+
const p = h ? void 0 : c.get(L), x = a.get(L);
|
|
1371
|
+
if (!h && !p || !x)
|
|
1351
1372
|
continue;
|
|
1352
|
-
const { texture: P, downsample: U } =
|
|
1373
|
+
const { texture: P, downsample: U } = x, { texture: z = P, downsample: F = 0 } = p ?? {};
|
|
1353
1374
|
(h ? m : f).execute({
|
|
1354
1375
|
projection: u,
|
|
1355
|
-
modelView:
|
|
1356
|
-
camera: te(
|
|
1357
|
-
xyz:
|
|
1376
|
+
modelView: E,
|
|
1377
|
+
camera: te(b),
|
|
1378
|
+
xyz: L,
|
|
1358
1379
|
imagery: z,
|
|
1359
1380
|
terrain: P,
|
|
1360
1381
|
downsampleImagery: F,
|
|
1361
1382
|
downsampleTerrain: U,
|
|
1362
|
-
index:
|
|
1383
|
+
index: d
|
|
1363
1384
|
});
|
|
1364
1385
|
}
|
|
1365
1386
|
},
|
|
@@ -1367,29 +1388,29 @@ const D = 34, xt = 22, yt = V(0, D).flatMap(
|
|
|
1367
1388
|
m.destroy(), f.destroy(), i.destroy(), s.destroy(), o.destroy();
|
|
1368
1389
|
}
|
|
1369
1390
|
};
|
|
1370
|
-
},
|
|
1391
|
+
}, bt = (e) => {
|
|
1371
1392
|
const t = (i = !1) => {
|
|
1372
|
-
const s =
|
|
1393
|
+
const s = xe({
|
|
1373
1394
|
gl: e,
|
|
1374
|
-
vertexSource:
|
|
1375
|
-
fragmentSource: i ? Te :
|
|
1376
|
-
}), c =
|
|
1377
|
-
c.set(
|
|
1378
|
-
const a =
|
|
1379
|
-
a.set(
|
|
1380
|
-
const o = s.attribute3f("uvw", c),
|
|
1395
|
+
vertexSource: Tt,
|
|
1396
|
+
fragmentSource: i ? Te : mt
|
|
1397
|
+
}), c = Y({ gl: e, type: "f32", target: "array" });
|
|
1398
|
+
c.set(Rt.flatMap(([h = 0, d = 0, u = 0]) => [h, d, u]));
|
|
1399
|
+
const a = Y({ gl: e, type: "u16", target: "element" });
|
|
1400
|
+
a.set(_t);
|
|
1401
|
+
const o = s.attribute3f("uvw", c), l = s.uniformMatrix4f("projection"), f = s.uniformMatrix4f("model_view"), m = s.uniform1i("imagery"), y = s.uniform1i("terrain"), w = s.uniform1i("downsample_imagery"), R = s.uniform1i("downsample_terrain"), M = s.uniform3i("xyz"), _ = s.uniform3i("camera"), v = s.uniform1i("index");
|
|
1381
1402
|
return { execute: ({
|
|
1382
1403
|
projection: h,
|
|
1383
|
-
modelView:
|
|
1404
|
+
modelView: d,
|
|
1384
1405
|
camera: u,
|
|
1385
|
-
xyz:
|
|
1386
|
-
imagery:
|
|
1387
|
-
terrain:
|
|
1388
|
-
downsampleImagery:
|
|
1406
|
+
xyz: E,
|
|
1407
|
+
imagery: b,
|
|
1408
|
+
terrain: A,
|
|
1409
|
+
downsampleImagery: L,
|
|
1389
1410
|
downsampleTerrain: p,
|
|
1390
|
-
index:
|
|
1411
|
+
index: x
|
|
1391
1412
|
}) => {
|
|
1392
|
-
e.enable(e.DEPTH_TEST), i ? e.disable(e.BLEND) : (e.enable(e.BLEND), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA)), s.use(), o.use(),
|
|
1413
|
+
e.enable(e.DEPTH_TEST), i ? e.disable(e.BLEND) : (e.enable(e.BLEND), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA)), s.use(), o.use(), l.set(h), f.set(d), M.set(E), _.set(u), w.set(L), R.set(p), v.set(x), e.activeTexture(e.TEXTURE0), m.set(0), b.use(), e.activeTexture(e.TEXTURE1), y.set(1), A.use(), a.use(), e.drawElements(e.TRIANGLES, I * I * 2 * 3, e.UNSIGNED_SHORT, 0);
|
|
1393
1414
|
}, destroy: () => {
|
|
1394
1415
|
c.destroy(), a.destroy(), s.destroy();
|
|
1395
1416
|
} };
|
|
@@ -1401,53 +1422,53 @@ const D = 34, xt = 22, yt = V(0, D).flatMap(
|
|
|
1401
1422
|
const i = e.indexOf(n);
|
|
1402
1423
|
i !== -1 && e.splice(i, 1);
|
|
1403
1424
|
}), (n) => e.forEach((i) => i(n))];
|
|
1404
|
-
},
|
|
1425
|
+
}, Lt = Q(), St = ee(), J = (e) => {
|
|
1405
1426
|
const {
|
|
1406
1427
|
target: t,
|
|
1407
1428
|
screen: r,
|
|
1408
1429
|
distance: n,
|
|
1409
1430
|
orientation: [i, s, c]
|
|
1410
|
-
} = e, [a = 0, o = 0] = r, [
|
|
1411
|
-
|
|
1412
|
-
const v =
|
|
1413
|
-
|
|
1414
|
-
const
|
|
1415
|
-
const
|
|
1416
|
-
return
|
|
1417
|
-
},
|
|
1418
|
-
const
|
|
1419
|
-
return
|
|
1420
|
-
}, u = ([N = 0,
|
|
1421
|
-
const [
|
|
1422
|
-
return re(
|
|
1423
|
-
},
|
|
1424
|
-
(U - p) * (U - p) + (z -
|
|
1425
|
-
p * (U - p) +
|
|
1426
|
-
p * p +
|
|
1431
|
+
} = e, [a = 0, o = 0] = r, [l = 0, f = 0] = e.center ?? [a / 2, o / 2], m = n / C, y = m / 1e3, w = m * 1e3, R = 45, M = e.fieldOfView ?? R, _ = Q();
|
|
1432
|
+
Me(_), Xe(_, se(M), a / o, y, w), ke(_, _, [1, -1, 1]);
|
|
1433
|
+
const v = Q();
|
|
1434
|
+
Me(v), ge(v, v, i), Oe(v, v, s), Ce(v, v, c);
|
|
1435
|
+
const S = De(Lt, _, v), T = Ie(Q(), S), h = (N) => {
|
|
1436
|
+
const D = [a * N, o * N], g = [l * N, f * N];
|
|
1437
|
+
return J({ ...e, center: g, screen: D });
|
|
1438
|
+
}, d = ([N = 0, D = 0], g = ee()) => {
|
|
1439
|
+
const j = 2 * N / a - 1, fe = -(2 * D / o - 1);
|
|
1440
|
+
return be(g, j, fe, 0, 1);
|
|
1441
|
+
}, u = ([N = 0, D = 0, , g = 0], j = Ee()) => Ye(j, (N / g + 1) * a * 0.5, (1 - D / g) * o * 0.5), E = (N, D = O()) => {
|
|
1442
|
+
const [g = 0, j = 0, fe = 0, he = 0] = Le(St, N, T);
|
|
1443
|
+
return re(D, g / he, j / he, fe / he);
|
|
1444
|
+
}, b = ([N = 0, D = 0, g = 0], j = ee()) => Le(j, be(j, N, D, g, 1), S), [A = 0, L = 0] = d([l, f]), [p = 0, x = 0, P = 0] = E([A, L, -1, 1]), [U = 0, z = 0, F = 0] = E([A, L, 1.00001, 1]), W = n * Math.tan(se(R) / 2) / Math.tan(se(M) / 2), [k = 0] = Ke(
|
|
1445
|
+
(U - p) * (U - p) + (z - x) * (z - x) + (F - P) * (F - P),
|
|
1446
|
+
p * (U - p) + x * (z - x) + P * (F - P),
|
|
1447
|
+
p * p + x * x + P * P - W * W / C / C
|
|
1427
1448
|
);
|
|
1428
|
-
if (isNaN(
|
|
1449
|
+
if (isNaN(k))
|
|
1429
1450
|
throw new Error("Unexpected");
|
|
1430
|
-
const
|
|
1431
|
-
p +
|
|
1432
|
-
|
|
1433
|
-
P +
|
|
1434
|
-
], G = ve(O(),
|
|
1451
|
+
const q = [
|
|
1452
|
+
p + k * (U - p),
|
|
1453
|
+
x + k * (z - x),
|
|
1454
|
+
P + k * (F - P)
|
|
1455
|
+
], G = ve(O(), H(t), q);
|
|
1435
1456
|
return {
|
|
1436
1457
|
camera: G,
|
|
1437
1458
|
screen: r,
|
|
1438
|
-
projection:
|
|
1459
|
+
projection: _,
|
|
1439
1460
|
modelView: v,
|
|
1440
1461
|
scale: h,
|
|
1441
|
-
screenToClip:
|
|
1462
|
+
screenToClip: d,
|
|
1442
1463
|
clipToScreen: u,
|
|
1443
|
-
clipToLocal:
|
|
1444
|
-
localToClip:
|
|
1445
|
-
localToWorld: (N,
|
|
1446
|
-
worldToLocal: (N,
|
|
1464
|
+
clipToLocal: E,
|
|
1465
|
+
localToClip: b,
|
|
1466
|
+
localToWorld: (N, D = O()) => je(D, N, G),
|
|
1467
|
+
worldToLocal: (N, D = O()) => ve(D, N, G)
|
|
1447
1468
|
};
|
|
1448
1469
|
};
|
|
1449
|
-
|
|
1450
|
-
const K = 0.25,
|
|
1470
|
+
Ne(Array);
|
|
1471
|
+
const K = 0.25, Ut = (e) => {
|
|
1451
1472
|
let t = !0, r = {
|
|
1452
1473
|
target: [0, 0, 0],
|
|
1453
1474
|
screen: [0, 0],
|
|
@@ -1462,96 +1483,96 @@ const K = 0.25, Lt = (e) => {
|
|
|
1462
1483
|
let i = [];
|
|
1463
1484
|
const s = He(n), c = (p) => {
|
|
1464
1485
|
r.screen = p;
|
|
1465
|
-
const [
|
|
1466
|
-
e.width =
|
|
1486
|
+
const [x = 0, P = 0] = p;
|
|
1487
|
+
e.width = x * devicePixelRatio, e.height = P * devicePixelRatio, s.resize([e.width * K, e.height * K]);
|
|
1467
1488
|
};
|
|
1468
1489
|
c([e.clientWidth, e.clientHeight]);
|
|
1469
1490
|
const a = new ResizeObserver(([p]) => {
|
|
1470
1491
|
if (!p)
|
|
1471
1492
|
return;
|
|
1472
|
-
const { contentRect:
|
|
1493
|
+
const { contentRect: x } = p, { width: P, height: U } = x;
|
|
1473
1494
|
c([P, U]);
|
|
1474
1495
|
});
|
|
1475
1496
|
a.observe(e);
|
|
1476
|
-
const o = ([p = 0,
|
|
1477
|
-
n.viewport(0, 0, p,
|
|
1478
|
-
},
|
|
1479
|
-
const p =
|
|
1480
|
-
o(p.screen), i.forEach((
|
|
1497
|
+
const o = ([p = 0, x = 0]) => {
|
|
1498
|
+
n.viewport(0, 0, p, x), n.clear(n.COLOR_BUFFER_BIT | n.DEPTH_BUFFER_BIT);
|
|
1499
|
+
}, l = () => {
|
|
1500
|
+
const p = J(r).scale(devicePixelRatio);
|
|
1501
|
+
o(p.screen), i.forEach((x) => x.render({ viewport: p }));
|
|
1481
1502
|
}, f = () => {
|
|
1482
|
-
const p =
|
|
1483
|
-
o(p.screen), i.forEach((
|
|
1503
|
+
const p = J(r).scale(K * devicePixelRatio);
|
|
1504
|
+
o(p.screen), i.forEach((x, P) => x.render({ viewport: p, depth: !0, index: P + 1 }));
|
|
1484
1505
|
}, m = () => {
|
|
1485
|
-
t && (
|
|
1506
|
+
t && (l(), requestAnimationFrame(m));
|
|
1486
1507
|
};
|
|
1487
1508
|
requestAnimationFrame(m);
|
|
1488
|
-
const
|
|
1489
|
-
const { screenToClip: P, clipToLocal: U, localToWorld: z } =
|
|
1509
|
+
const y = ([p = 0, x = 0]) => {
|
|
1510
|
+
const { screenToClip: P, clipToLocal: U, localToWorld: z } = J(r);
|
|
1490
1511
|
s.use(), f();
|
|
1491
|
-
const [F,
|
|
1512
|
+
const [F, W] = s.read([
|
|
1492
1513
|
p * K * devicePixelRatio,
|
|
1493
|
-
|
|
1494
|
-
]), [
|
|
1495
|
-
return { position: G, layer:
|
|
1496
|
-
},
|
|
1497
|
-
const { camera:
|
|
1514
|
+
x * K * devicePixelRatio
|
|
1515
|
+
]), [k = 0, q = 0] = P([p, x]), G = Ue(z(U([k, q, F, 1]))), Re = W === 0 ? void 0 : i[W - 1];
|
|
1516
|
+
return { position: G, layer: Re };
|
|
1517
|
+
}, w = (p) => {
|
|
1518
|
+
const { camera: x } = J(r), { position: P, layer: U } = y(p);
|
|
1498
1519
|
if (!U)
|
|
1499
1520
|
return;
|
|
1500
|
-
const z =
|
|
1521
|
+
const z = Ve(H(P), x) * C;
|
|
1501
1522
|
r = {
|
|
1502
1523
|
...r,
|
|
1503
1524
|
center: p,
|
|
1504
1525
|
target: P,
|
|
1505
1526
|
distance: z
|
|
1506
1527
|
};
|
|
1507
|
-
}, [
|
|
1508
|
-
const
|
|
1509
|
-
return i.push(
|
|
1510
|
-
}, A = (p) => {
|
|
1511
|
-
const y = nt(n, p);
|
|
1512
|
-
return i.push(y), y;
|
|
1528
|
+
}, [R, M] = pe(), [_, v] = pe(), [S, T] = pe(), h = ({ x: p, y: x }) => M(y([p, x])), d = ({ x: p, y: x }) => v(y([p, x])), u = ({ x: p, y: x }) => T(y([p, x])), E = (p) => {
|
|
1529
|
+
const x = Mt(n, p);
|
|
1530
|
+
return i.push(x), x;
|
|
1513
1531
|
}, b = (p) => {
|
|
1514
|
-
const
|
|
1515
|
-
return i.push(
|
|
1532
|
+
const x = st(n, p);
|
|
1533
|
+
return i.push(x), x;
|
|
1534
|
+
}, A = (p) => {
|
|
1535
|
+
const x = tt(n, p);
|
|
1536
|
+
return i.push(x), x;
|
|
1516
1537
|
};
|
|
1517
|
-
return e.addEventListener("mousedown", h), e.addEventListener("mouseup",
|
|
1538
|
+
return e.addEventListener("mousedown", h), e.addEventListener("mouseup", d), e.addEventListener("mousemove", u), {
|
|
1518
1539
|
get view() {
|
|
1519
1540
|
return r;
|
|
1520
1541
|
},
|
|
1521
1542
|
set view(p) {
|
|
1522
1543
|
r = p;
|
|
1523
1544
|
},
|
|
1524
|
-
addTerrain:
|
|
1525
|
-
addMesh:
|
|
1526
|
-
addLine:
|
|
1527
|
-
recenter:
|
|
1528
|
-
pick:
|
|
1529
|
-
onMouseDown:
|
|
1530
|
-
onMouseUp:
|
|
1531
|
-
onMouseMove:
|
|
1545
|
+
addTerrain: E,
|
|
1546
|
+
addMesh: b,
|
|
1547
|
+
addLine: A,
|
|
1548
|
+
recenter: w,
|
|
1549
|
+
pick: y,
|
|
1550
|
+
onMouseDown: R,
|
|
1551
|
+
onMouseUp: _,
|
|
1552
|
+
onMouseMove: S,
|
|
1532
1553
|
destroy: () => {
|
|
1533
|
-
t = !1, a.unobserve(e), i.forEach((p) => p.destroy()), i = [], s.destroy(), e.removeEventListener("mousedown", h), e.removeEventListener("mouseup",
|
|
1554
|
+
t = !1, a.unobserve(e), i.forEach((p) => p.destroy()), i = [], s.destroy(), e.removeEventListener("mousedown", h), e.removeEventListener("mouseup", d), e.removeEventListener("mousemove", u);
|
|
1534
1555
|
}
|
|
1535
1556
|
};
|
|
1536
|
-
},
|
|
1557
|
+
}, zt = 2, Pt = (e, t) => {
|
|
1537
1558
|
let r = !0, n = !1;
|
|
1538
1559
|
const i = ({ x: f, y: m }) => {
|
|
1539
1560
|
r && t.recenter([f, m]);
|
|
1540
|
-
}, s = ({ buttons: f, movementX: m, movementY:
|
|
1561
|
+
}, s = ({ buttons: f, movementX: m, movementY: y, x: w, y: R }) => {
|
|
1541
1562
|
if (r) {
|
|
1542
1563
|
if (f === 1)
|
|
1543
1564
|
t.view = {
|
|
1544
1565
|
...t.view,
|
|
1545
|
-
center: [
|
|
1566
|
+
center: [w, R]
|
|
1546
1567
|
};
|
|
1547
1568
|
else if (f === 2) {
|
|
1548
1569
|
const {
|
|
1549
|
-
screen: [
|
|
1550
|
-
orientation: [v,
|
|
1570
|
+
screen: [M = 0, _ = 0],
|
|
1571
|
+
orientation: [v, S, T]
|
|
1551
1572
|
} = t.view, h = [
|
|
1552
|
-
v -
|
|
1553
|
-
|
|
1554
|
-
T - m /
|
|
1573
|
+
v - y / _ * Math.PI,
|
|
1574
|
+
S,
|
|
1575
|
+
T - m / M * Math.PI
|
|
1555
1576
|
];
|
|
1556
1577
|
t.view = {
|
|
1557
1578
|
...t.view,
|
|
@@ -1559,17 +1580,17 @@ const K = 0.25, Lt = (e) => {
|
|
|
1559
1580
|
};
|
|
1560
1581
|
}
|
|
1561
1582
|
}
|
|
1562
|
-
}, c =
|
|
1583
|
+
}, c = $e(() => n = !1, 100), a = ({ x: f, y: m, deltaY: y }) => {
|
|
1563
1584
|
if (!r)
|
|
1564
1585
|
return;
|
|
1565
1586
|
n || (t.recenter([f, m]), n = !0);
|
|
1566
|
-
const
|
|
1567
|
-
Math.max(t.view.distance * Math.exp(
|
|
1587
|
+
const w = Math.min(
|
|
1588
|
+
Math.max(t.view.distance * Math.exp(y * 1e-3), zt),
|
|
1568
1589
|
C
|
|
1569
1590
|
);
|
|
1570
1591
|
t.view = {
|
|
1571
1592
|
...t.view,
|
|
1572
|
-
distance:
|
|
1593
|
+
distance: w
|
|
1573
1594
|
}, c();
|
|
1574
1595
|
}, o = (f) => f.preventDefault();
|
|
1575
1596
|
return e.addEventListener("mousedown", i), e.addEventListener("mousemove", s), e.addEventListener("wheel", a, { passive: !0 }), e.addEventListener("contextmenu", o), {
|
|
@@ -1585,7 +1606,7 @@ const K = 0.25, Lt = (e) => {
|
|
|
1585
1606
|
};
|
|
1586
1607
|
};
|
|
1587
1608
|
export {
|
|
1588
|
-
|
|
1589
|
-
|
|
1609
|
+
Pt as createMouseControl,
|
|
1610
|
+
Ut as createWorld
|
|
1590
1611
|
};
|
|
1591
1612
|
//# sourceMappingURL=index.js.map
|