world.ts 0.3.2 → 0.3.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 +585 -572
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const At = (e, t) => {
|
|
2
2
|
let n;
|
|
3
3
|
return (...i) => {
|
|
4
4
|
clearTimeout(n), n = setTimeout(() => e(i), t);
|
|
5
5
|
};
|
|
6
|
-
}, ie = (e, t) => Array.from({ length: t - e }, (n, i) => i + e),
|
|
6
|
+
}, ie = (e, t) => Array.from({ length: t - e }, (n, i) => i + e), bt = ({
|
|
7
7
|
gl: e,
|
|
8
8
|
vertexSource: t,
|
|
9
9
|
fragmentSource: n
|
|
@@ -22,56 +22,56 @@ const Rt = (e, t) => {
|
|
|
22
22
|
);
|
|
23
23
|
if (e.attachShader(i, r), e.attachShader(i, s), e.linkProgram(i), !e.getProgramParameter(i, e.LINK_STATUS))
|
|
24
24
|
throw console.error("Link failure", e.getProgramInfoLog(i)), new Error("Link failure");
|
|
25
|
-
const o = () => e.useProgram(i), c = (
|
|
26
|
-
const R = e.getUniformLocation(i,
|
|
27
|
-
return { set: (
|
|
28
|
-
R &&
|
|
25
|
+
const o = () => e.useProgram(i), c = (x, _) => {
|
|
26
|
+
const R = e.getUniformLocation(i, x);
|
|
27
|
+
return { set: (S) => {
|
|
28
|
+
R && _(R, S);
|
|
29
29
|
} };
|
|
30
|
-
}, a = (
|
|
31
|
-
|
|
32
|
-
(
|
|
33
|
-
),
|
|
34
|
-
|
|
35
|
-
(
|
|
36
|
-
),
|
|
37
|
-
|
|
38
|
-
(
|
|
39
|
-
), d = (
|
|
40
|
-
|
|
41
|
-
(
|
|
42
|
-
), m = (
|
|
43
|
-
|
|
44
|
-
(
|
|
45
|
-
),
|
|
46
|
-
|
|
47
|
-
(
|
|
48
|
-
), w = (
|
|
49
|
-
|
|
50
|
-
(
|
|
51
|
-
),
|
|
52
|
-
name:
|
|
53
|
-
buffer:
|
|
30
|
+
}, a = (x) => c(x, (_, R) => e.uniform1f(_, R)), f = (x) => c(x, (_, R) => e.uniform1i(_, R)), l = (x) => c(
|
|
31
|
+
x,
|
|
32
|
+
(_, [R = 0, b = 0]) => e.uniform2f(_, R, b)
|
|
33
|
+
), h = (x) => c(
|
|
34
|
+
x,
|
|
35
|
+
(_, [R = 0, b = 0]) => e.uniform2i(_, R, b)
|
|
36
|
+
), u = (x) => c(
|
|
37
|
+
x,
|
|
38
|
+
(_, [R = 0, b = 0, S = 0]) => e.uniform3f(_, R, b, S)
|
|
39
|
+
), d = (x) => c(
|
|
40
|
+
x,
|
|
41
|
+
(_, [R = 0, b = 0, S = 0]) => e.uniform3i(_, R, b, S)
|
|
42
|
+
), m = (x) => c(
|
|
43
|
+
x,
|
|
44
|
+
(_, [R = 0, b = 0, S = 0, P = 0]) => e.uniform4f(_, R, b, S, P)
|
|
45
|
+
), y = (x) => c(
|
|
46
|
+
x,
|
|
47
|
+
(_, [R = 0, b = 0, S = 0, P = 0]) => e.uniform4i(_, R, b, S, P)
|
|
48
|
+
), w = (x) => c(
|
|
49
|
+
x,
|
|
50
|
+
(_, R) => e.uniformMatrix4fv(_, !1, R)
|
|
51
|
+
), E = ({
|
|
52
|
+
name: x,
|
|
53
|
+
buffer: _,
|
|
54
54
|
size: R,
|
|
55
|
-
type:
|
|
56
|
-
stride:
|
|
55
|
+
type: b,
|
|
56
|
+
stride: S,
|
|
57
57
|
offset: P
|
|
58
58
|
}) => {
|
|
59
|
-
const U = e.getAttribLocation(i,
|
|
59
|
+
const U = e.getAttribLocation(i, x);
|
|
60
60
|
if (U === -1)
|
|
61
|
-
throw new Error(`Missing attribute: ${
|
|
61
|
+
throw new Error(`Missing attribute: ${x}`);
|
|
62
62
|
return { use: () => {
|
|
63
|
-
|
|
63
|
+
_.use(), e.enableVertexAttribArray(U), ["u16", "i32"].includes(b) ? e.vertexAttribIPointer(
|
|
64
64
|
U,
|
|
65
65
|
R,
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
b === "u16" ? e.UNSIGNED_SHORT : e.INT,
|
|
67
|
+
S || 0,
|
|
68
68
|
P || 0
|
|
69
69
|
) : e.vertexAttribPointer(
|
|
70
70
|
U,
|
|
71
71
|
R,
|
|
72
72
|
e.FLOAT,
|
|
73
73
|
!1,
|
|
74
|
-
|
|
74
|
+
S || 0,
|
|
75
75
|
P || 0
|
|
76
76
|
);
|
|
77
77
|
} };
|
|
@@ -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
|
-
uniform4i:
|
|
88
|
+
uniform4i: y,
|
|
89
89
|
uniformMatrix4f: w,
|
|
90
|
-
attribute1f: (
|
|
91
|
-
attribute2f: (
|
|
92
|
-
attribute3f: (
|
|
93
|
-
attribute3i: (
|
|
90
|
+
attribute1f: (x, _, R = {}) => E({ name: x, buffer: _, size: 1, type: "f32", ...R }),
|
|
91
|
+
attribute2f: (x, _, R = {}) => E({ name: x, buffer: _, size: 2, type: "f32", ...R }),
|
|
92
|
+
attribute3f: (x, _, R = {}) => E({ name: x, buffer: _, size: 3, type: "f32", ...R }),
|
|
93
|
+
attribute3i: (x, _, R = {}) => E({ name: x, buffer: _, size: 3, type: "i32", ...R }),
|
|
94
94
|
dispose: () => {
|
|
95
95
|
e.deleteProgram(i), e.deleteShader(r), e.deleteShader(s);
|
|
96
96
|
}
|
|
@@ -111,7 +111,7 @@ const Rt = (e, t) => {
|
|
|
111
111
|
const o = r + s, c = t.get(o);
|
|
112
112
|
if (c)
|
|
113
113
|
return c;
|
|
114
|
-
const a =
|
|
114
|
+
const a = bt({ gl: e, vertexSource: r, fragmentSource: s });
|
|
115
115
|
return t.set(o, a), a;
|
|
116
116
|
},
|
|
117
117
|
dispose: () => [...t.values()].forEach((r) => r.dispose())
|
|
@@ -124,7 +124,7 @@ const Rt = (e, t) => {
|
|
|
124
124
|
return { gl: t, programs: n, dispose: i };
|
|
125
125
|
};
|
|
126
126
|
var St = 1e-6, Y = typeof Float32Array < "u" ? Float32Array : Array;
|
|
127
|
-
function
|
|
127
|
+
function Ut(e) {
|
|
128
128
|
Y = e;
|
|
129
129
|
}
|
|
130
130
|
Math.hypot || (Math.hypot = function() {
|
|
@@ -132,7 +132,7 @@ Math.hypot || (Math.hypot = function() {
|
|
|
132
132
|
e += arguments[t] * arguments[t];
|
|
133
133
|
return Math.sqrt(e);
|
|
134
134
|
});
|
|
135
|
-
function
|
|
135
|
+
function Pt() {
|
|
136
136
|
var e = new Y(9);
|
|
137
137
|
return Y != Float32Array && (e[1] = 0, e[2] = 0, e[3] = 0, e[5] = 0, e[6] = 0, e[7] = 0), e[0] = 1, e[4] = 1, e[8] = 1, e;
|
|
138
138
|
}
|
|
@@ -143,44 +143,44 @@ function xe() {
|
|
|
143
143
|
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
|
-
function
|
|
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
|
|
149
|
-
}
|
|
150
|
-
function zt(e, t, n) {
|
|
151
|
-
var i = t[0], r = t[1], s = t[2], o = t[3], c = t[4], a = t[5], f = t[6], l = t[7], u = t[8], h = t[9], d = t[10], m = t[11], _ = t[12], w = t[13], p = t[14], A = t[15], v = n[0], T = n[1], x = n[2], g = n[3];
|
|
152
|
-
return e[0] = v * i + T * c + x * u + g * _, e[1] = v * r + T * a + x * h + g * w, e[2] = v * s + T * f + x * d + g * p, e[3] = v * o + T * l + x * m + g * A, v = n[4], T = n[5], x = n[6], g = n[7], e[4] = v * i + T * c + x * u + g * _, e[5] = v * r + T * a + x * h + g * w, e[6] = v * s + T * f + x * d + g * p, e[7] = v * o + T * l + x * m + g * A, v = n[8], T = n[9], x = n[10], g = n[11], e[8] = v * i + T * c + x * u + g * _, e[9] = v * r + T * a + x * h + g * w, e[10] = v * s + T * f + x * d + g * p, e[11] = v * o + T * l + x * m + g * A, v = n[12], T = n[13], x = n[14], g = n[15], e[12] = v * i + T * c + x * u + g * _, e[13] = v * r + T * a + x * h + g * w, e[14] = v * s + T * f + x * d + g * p, e[15] = v * o + T * l + x * m + g * A, e;
|
|
146
|
+
function zt(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], h = t[9], u = t[10], d = t[11], m = t[12], y = t[13], w = t[14], E = 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, x = r * f - s * a, _ = l * y - h * m, R = l * w - u * m, b = l * E - d * m, S = h * w - u * y, P = h * E - d * y, U = u * E - d * w, M = A * U - v * P + T * S + p * b - g * R + x * _;
|
|
148
|
+
return M ? (M = 1 / M, e[0] = (c * U - a * P + f * S) * M, e[1] = (r * P - i * U - s * S) * M, e[2] = (y * x - w * g + E * p) * M, e[3] = (u * g - h * x - d * p) * M, e[4] = (a * b - o * U - f * R) * M, e[5] = (n * U - r * b + s * R) * M, e[6] = (w * T - m * x - E * v) * M, e[7] = (l * x - u * T + d * v) * M, e[8] = (o * P - c * b + f * _) * M, e[9] = (i * b - n * P - s * _) * M, e[10] = (m * g - y * T + E * A) * M, e[11] = (h * T - l * g - d * A) * M, e[12] = (c * R - o * S - a * _) * M, e[13] = (n * S - i * R + r * _) * M, e[14] = (y * v - m * p - w * A) * M, e[15] = (l * p - h * v + u * A) * M, e) : null;
|
|
153
149
|
}
|
|
154
150
|
function Lt(e, t, n) {
|
|
155
|
-
var i =
|
|
156
|
-
return e[0] =
|
|
151
|
+
var i = t[0], r = t[1], s = t[2], o = t[3], c = t[4], a = t[5], f = t[6], l = t[7], h = t[8], u = t[9], d = t[10], m = t[11], y = t[12], w = t[13], E = 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 * y, e[1] = v * r + T * a + p * u + g * w, e[2] = v * s + T * f + p * d + g * E, 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 * y, e[5] = v * r + T * a + p * u + g * w, e[6] = v * s + T * f + p * d + g * E, 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 * y, e[9] = v * r + T * a + p * u + g * w, e[10] = v * s + T * f + p * d + g * E, 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 * y, e[13] = v * r + T * a + p * u + g * w, e[14] = v * s + T * f + p * d + g * E, e[15] = v * o + T * l + p * m + g * A, e;
|
|
157
153
|
}
|
|
158
154
|
function Nt(e, t, n) {
|
|
159
|
-
var i =
|
|
160
|
-
return
|
|
155
|
+
var i = n[0], r = n[1], s = n[2];
|
|
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;
|
|
161
157
|
}
|
|
162
158
|
function Dt(e, t, n) {
|
|
163
|
-
var i = Math.sin(n), r = Math.cos(n), s = t[
|
|
164
|
-
return t !== e && (e[
|
|
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;
|
|
165
161
|
}
|
|
166
162
|
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[
|
|
168
|
-
return t !== e && (e[
|
|
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
|
+
}
|
|
166
|
+
function Ot(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], 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
|
-
function
|
|
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 -
|
|
170
|
+
function Ct(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, h = i * c, u = r * o, d = r * c, m = r * a, y = s * o, w = s * c, E = s * a;
|
|
172
|
+
return e[0] = 1 - h - m, e[1] = l + E, e[2] = u - w, e[3] = 0, e[4] = l - E, e[5] = 1 - f - m, e[6] = d + y, e[7] = 0, e[8] = u + w, e[9] = d - y, e[10] = 1 - f - h, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function Xt(e, t, n, i, r) {
|
|
175
175
|
var s = 1 / Math.tan(t / 2), o;
|
|
176
176
|
return e[0] = s / n, 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, r != null && r !== 1 / 0 ? (o = 1 / (i - r), e[10] = (r + i) * o, e[14] = 2 * r * i * o) : (e[10] = -1, e[14] = -2 * i), e;
|
|
177
177
|
}
|
|
178
|
-
var
|
|
178
|
+
var Wt = Xt;
|
|
179
179
|
function z() {
|
|
180
180
|
var e = new Y(3);
|
|
181
181
|
return Y != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function jt(e) {
|
|
184
184
|
var t = e[0], n = e[1], i = e[2];
|
|
185
185
|
return Math.hypot(t, n, i);
|
|
186
186
|
}
|
|
@@ -188,7 +188,7 @@ function st(e, t, n) {
|
|
|
188
188
|
var i = new Y(3);
|
|
189
189
|
return i[0] = e, i[1] = t, i[2] = n, i;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function Bt(e, t) {
|
|
192
192
|
return e[0] = t[0], e[1] = t[1], e[2] = t[2], e;
|
|
193
193
|
}
|
|
194
194
|
function we(e, t, n, i) {
|
|
@@ -197,7 +197,7 @@ function we(e, t, n, i) {
|
|
|
197
197
|
function ne(e, t, n) {
|
|
198
198
|
return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e;
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function Zt(e, t, n) {
|
|
201
201
|
return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e;
|
|
202
202
|
}
|
|
203
203
|
function le(e, t, n) {
|
|
@@ -207,22 +207,22 @@ function Te(e, t) {
|
|
|
207
207
|
var n = t[0] - e[0], i = t[1] - e[1], r = t[2] - e[2];
|
|
208
208
|
return Math.hypot(n, i, r);
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function Vt(e, t) {
|
|
211
211
|
var n = t[0], i = t[1], r = t[2], s = n * n + i * i + r * r;
|
|
212
212
|
return s > 0 && (s = 1 / Math.sqrt(s)), e[0] = t[0] * s, e[1] = t[1] * s, e[2] = t[2] * s, e;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function Yt(e, t) {
|
|
215
215
|
return e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
|
|
216
216
|
}
|
|
217
217
|
function Ve(e, t, n) {
|
|
218
218
|
var i = t[0], r = t[1], s = t[2], o = n[0], c = n[1], a = n[2];
|
|
219
219
|
return e[0] = r * a - s * c, e[1] = s * o - i * a, e[2] = i * c - r * o, e;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function $t(e, t, n, i) {
|
|
222
222
|
var r = t[0], s = t[1], o = t[2];
|
|
223
223
|
return e[0] = r + i * (n[0] - r), e[1] = s + i * (n[1] - s), e[2] = o + i * (n[2] - o), e;
|
|
224
224
|
}
|
|
225
|
-
var re =
|
|
225
|
+
var re = Zt, kt = jt;
|
|
226
226
|
(function() {
|
|
227
227
|
var e = z();
|
|
228
228
|
return function(t, n, i, r, s, o) {
|
|
@@ -236,37 +236,37 @@ function ee() {
|
|
|
236
236
|
var e = new Y(4);
|
|
237
237
|
return Y != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0), e;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function Ht(e, t) {
|
|
240
240
|
return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e;
|
|
241
241
|
}
|
|
242
242
|
function ot(e, t, n, i, r) {
|
|
243
243
|
return e[0] = t, e[1] = n, e[2] = i, e[3] = r, e;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function Gt(e, t, n) {
|
|
246
246
|
return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function Ft(e, t, n) {
|
|
249
249
|
return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function Kt(e, t, n) {
|
|
252
252
|
return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e;
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function Qt(e, t) {
|
|
255
255
|
var n = t[0] - e[0], i = t[1] - e[1], r = t[2] - e[2], s = t[3] - e[3];
|
|
256
256
|
return Math.hypot(n, i, r, s);
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function qt(e, t) {
|
|
259
259
|
var n = t[0], i = t[1], r = t[2], s = t[3], o = n * n + i * i + r * r + s * s;
|
|
260
260
|
return o > 0 && (o = 1 / Math.sqrt(o)), e[0] = n * o, e[1] = i * o, e[2] = r * o, e[3] = s * o, e;
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function Jt(e, t) {
|
|
263
263
|
return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3];
|
|
264
264
|
}
|
|
265
265
|
function at(e, t, n) {
|
|
266
266
|
var i = t[0], r = t[1], s = t[2], o = t[3];
|
|
267
267
|
return e[0] = n[0] * i + n[4] * r + n[8] * s + n[12] * o, e[1] = n[1] * i + n[5] * r + n[9] * s + n[13] * o, e[2] = n[2] * i + n[6] * r + n[10] * s + n[14] * o, e[3] = n[3] * i + n[7] * r + n[11] * s + n[15] * o, e;
|
|
268
268
|
}
|
|
269
|
-
var
|
|
269
|
+
var en = Ft;
|
|
270
270
|
(function() {
|
|
271
271
|
var e = ee();
|
|
272
272
|
return function(t, n, i, r, s, o) {
|
|
@@ -280,20 +280,20 @@ function He() {
|
|
|
280
280
|
var e = new Y(4);
|
|
281
281
|
return Y != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e[3] = 1, e;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function tn(e, t, n) {
|
|
284
284
|
n = n * 0.5;
|
|
285
285
|
var i = Math.sin(n);
|
|
286
286
|
return e[0] = i * t[0], e[1] = i * t[1], e[2] = i * t[2], e[3] = Math.cos(n), e;
|
|
287
287
|
}
|
|
288
|
-
function
|
|
289
|
-
var n =
|
|
288
|
+
function nn(e, t) {
|
|
289
|
+
var n = sn(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, y, 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), y = Math.sin((1 - i) * u) / m, w = Math.sin(i * u) / m) : (y = 1 - i, w = i), e[0] = y * r + w * a, e[1] = y * s + w * f, e[2] = y * o + w * l, e[3] = y * c + w * h, e;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function rn(e, t) {
|
|
297
297
|
var n = t[0] + t[4] + t[8], i;
|
|
298
298
|
if (n > 0)
|
|
299
299
|
i = Math.sqrt(n + 1), e[3] = 0.5 * i, i = 0.5 / i, e[0] = (t[5] - t[7]) * i, e[1] = (t[6] - t[2]) * i, e[2] = (t[1] - t[3]) * i;
|
|
@@ -305,12 +305,12 @@ function nn(e, t) {
|
|
|
305
305
|
}
|
|
306
306
|
return e;
|
|
307
307
|
}
|
|
308
|
-
var
|
|
308
|
+
var sn = Jt, 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
|
-
var o =
|
|
313
|
-
return o < -0.999999 ? (Ve(e, t, r),
|
|
312
|
+
var o = Yt(r, s);
|
|
313
|
+
return o < -0.999999 ? (Ve(e, t, r), kt(e) < 1e-6 && Ve(e, n, r), Vt(e, e), tn(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() {
|
|
@@ -320,31 +320,31 @@ var rn = qt, ht = Qt;
|
|
|
320
320
|
};
|
|
321
321
|
})();
|
|
322
322
|
(function() {
|
|
323
|
-
var e =
|
|
323
|
+
var e = Pt();
|
|
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, rn(t, e));
|
|
326
326
|
};
|
|
327
327
|
})();
|
|
328
328
|
function de() {
|
|
329
329
|
var e = new Y(2);
|
|
330
330
|
return Y != Float32Array && (e[0] = 0, e[1] = 0), e;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function on(e, t) {
|
|
333
333
|
return e[0] = t[0], e[1] = t[1], e;
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function an(e, t, n) {
|
|
336
336
|
return e[0] = t, e[1] = n, e;
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function cn(e, t, n) {
|
|
339
339
|
return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function fn(e, t, n) {
|
|
342
342
|
return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e;
|
|
343
343
|
}
|
|
344
|
-
function
|
|
344
|
+
function ln(e, t, n) {
|
|
345
345
|
return e[0] = t[0] * n, e[1] = t[1] * n, e;
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function un(e, t) {
|
|
348
348
|
var n = t[0] - e[0], i = t[1] - e[1];
|
|
349
349
|
return Math.hypot(n, i);
|
|
350
350
|
}
|
|
@@ -352,7 +352,7 @@ function hn(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 dn = fn;
|
|
356
356
|
(function() {
|
|
357
357
|
var e = de();
|
|
358
358
|
return function(t, n, i, r, s, o) {
|
|
@@ -362,7 +362,7 @@ var un = cn;
|
|
|
362
362
|
return t;
|
|
363
363
|
};
|
|
364
364
|
})();
|
|
365
|
-
const H = 40075017, De = (e) => e / 180 * Math.PI,
|
|
365
|
+
const H = 40075017, De = (e) => e / 180 * Math.PI, mn = (e) => e * 180 / Math.PI, vn = (e, t, n) => {
|
|
366
366
|
const i = Math.sqrt(t * t - 4 * e * n);
|
|
367
367
|
return [(-t - i) / (2 * e), (-t + i) / (2 * e)];
|
|
368
368
|
}, L = ([e = 0, t = 0, n = 0], i = z()) => we(
|
|
@@ -373,18 +373,18 @@ const H = 40075017, De = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
|
|
|
373
373
|
), se = ([e = 0, t = 0, n = 0], i = z()) => we(
|
|
374
374
|
i,
|
|
375
375
|
(e - 0.5) * 360,
|
|
376
|
-
|
|
376
|
+
mn(Math.atan(Math.sinh(-(t - 0.5) * (2 * Math.PI)))),
|
|
377
377
|
n * H
|
|
378
|
-
),
|
|
378
|
+
), ht = ([e = 0, t = 0, n = 0], i = z()) => {
|
|
379
379
|
const r = 2 ** -n;
|
|
380
380
|
return we(i, e * r, t * r, 0);
|
|
381
|
-
},
|
|
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,
|
|
381
|
+
}, Se = ([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, 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
|
+
}, dt = {
|
|
388
388
|
target: [0, 0, 0],
|
|
389
389
|
offset: [0, 0],
|
|
390
390
|
distance: H,
|
|
@@ -392,33 +392,33 @@ 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
|
+
...dt,
|
|
396
396
|
...e
|
|
397
|
-
}, [c = 0, a = 0] = t, [f = 0, l = 0] = i, [
|
|
398
|
-
rt(A),
|
|
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), y = r / H * m, w = y / 100, E = y * 1e6, A = xe();
|
|
398
|
+
rt(A), Wt(A, De(o), c / a, w, E), Nt(A, A, [1, -1, 1]);
|
|
399
399
|
const v = xe();
|
|
400
|
-
rt(v),
|
|
401
|
-
const T =
|
|
400
|
+
rt(v), Dt(v, v, h), It(v, v, u), Ot(v, v, d);
|
|
401
|
+
const T = Lt(xn, A, v), p = zt(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
|
+
}, x = ([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
|
-
},
|
|
408
|
-
const [k = 0, K = 0, ve = 0, pe = 0] = at(En, O,
|
|
407
|
+
}, _ = ([O = 0, W = 0, , k = 0], K = de()) => an(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, p);
|
|
409
409
|
return we(W, k / pe, K / pe, ve / pe);
|
|
410
|
-
},
|
|
411
|
-
(I - U) * (I - U) + (j -
|
|
412
|
-
U * (I - U) +
|
|
413
|
-
U * U +
|
|
410
|
+
}, b = ([O = 0, W = 0, k = 0], K = ee()) => at(K, ot(K, O, W, k, 1), T), [S = 0, P = 0] = x([f + c / 2, l + a / 2]), [U = 0, M = 0, N = 0] = R([S, P, -1, 1]), [I = 0, j = 0, X = 0] = R([S, P, 1.00001, 1]), [C = 0] = vn(
|
|
411
|
+
(I - U) * (I - U) + (j - M) * (j - M) + (X - N) * (X - N),
|
|
412
|
+
U * (I - U) + M * (j - M) + N * (X - N),
|
|
413
|
+
U * U + M * M + N * N - r * r / H / H * m * m
|
|
414
414
|
);
|
|
415
415
|
if (isNaN(C))
|
|
416
416
|
throw new Error("Unexpected");
|
|
417
417
|
const G = [
|
|
418
418
|
U + C * (I - U),
|
|
419
|
-
|
|
419
|
+
M + C * (j - M),
|
|
420
420
|
N + C * (X - N)
|
|
421
|
-
], Z = re(z(), L(n), G), $ = (O, W = z()) => ne(W, O, Z),
|
|
421
|
+
], Z = re(z(), L(n), G), $ = (O, W = z()) => ne(W, O, Z), Me = (O, W = z()) => re(W, O, Z);
|
|
422
422
|
return {
|
|
423
423
|
camera: Z,
|
|
424
424
|
screen: t,
|
|
@@ -426,16 +426,16 @@ const H = 40075017, De = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
|
|
|
426
426
|
modelView: v,
|
|
427
427
|
fieldScale: m,
|
|
428
428
|
scale: g,
|
|
429
|
-
screenToClip:
|
|
430
|
-
clipToScreen:
|
|
429
|
+
screenToClip: x,
|
|
430
|
+
clipToScreen: _,
|
|
431
431
|
clipToLocal: R,
|
|
432
|
-
localToClip:
|
|
432
|
+
localToClip: b,
|
|
433
433
|
localToWorld: $,
|
|
434
|
-
worldToLocal:
|
|
435
|
-
project: (O) =>
|
|
434
|
+
worldToLocal: Me,
|
|
435
|
+
project: (O) => _(b(Me(L(O)))),
|
|
436
436
|
unproject: (O, { targetZ: W = 0 } = {}) => {
|
|
437
|
-
const k =
|
|
438
|
-
return
|
|
437
|
+
const k = x(O), [K = 0, ve = 0, , pe = 0] = k, gt = [K, ve, -1, pe], et = se($(R(k))), tt = se($(R(gt))), [, , Ze = 0] = et, [, , nt = 0] = tt, Rt = Ze === nt ? 0 : (W - Ze) / (nt - Ze);
|
|
438
|
+
return $t(z(), et, tt, Rt);
|
|
439
439
|
}
|
|
440
440
|
};
|
|
441
441
|
}, _n = 100, Ti = (e, t, n) => {
|
|
@@ -446,71 +446,72 @@ 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 = ([
|
|
450
|
-
const [
|
|
449
|
+
const { view: f } = n, l = ([p = 0, g = 0]) => {
|
|
450
|
+
const [x, _] = [
|
|
451
451
|
e.width / devicePixelRatio,
|
|
452
452
|
e.height / devicePixelRatio
|
|
453
|
-
], { camera: R, fieldScale:
|
|
453
|
+
], { camera: R, fieldScale: b } = J(f(), [x, _]), { position: S, layer: P } = t.pick([p, g]);
|
|
454
454
|
if (!P)
|
|
455
455
|
return;
|
|
456
|
-
const U = Te(L(
|
|
456
|
+
const U = Te(L(S), R) * H / b, M = [p - x / 2, g - _ / 2];
|
|
457
457
|
o({
|
|
458
|
-
offset:
|
|
459
|
-
target:
|
|
458
|
+
offset: M,
|
|
459
|
+
target: S,
|
|
460
460
|
distance: U
|
|
461
461
|
});
|
|
462
|
-
},
|
|
462
|
+
}, h = (p, g) => {
|
|
463
463
|
if (!r())
|
|
464
464
|
return;
|
|
465
|
-
a || (l([
|
|
466
|
-
const [
|
|
465
|
+
a || (l([p, g]), a = !0);
|
|
466
|
+
const [x, _] = [
|
|
467
467
|
e.width / devicePixelRatio,
|
|
468
468
|
e.height / devicePixelRatio
|
|
469
469
|
];
|
|
470
470
|
o({
|
|
471
|
-
offset: [
|
|
471
|
+
offset: [p - x / 2, g - _ / 2]
|
|
472
472
|
});
|
|
473
|
-
},
|
|
473
|
+
}, u = (p, g, x, _) => {
|
|
474
474
|
if (!s())
|
|
475
475
|
return;
|
|
476
|
-
r() && !a && (l([
|
|
477
|
-
const [R,
|
|
476
|
+
r() && !a && (l([p, g]), a = !0);
|
|
477
|
+
const [R, b] = [
|
|
478
478
|
e.width / devicePixelRatio,
|
|
479
479
|
e.height / devicePixelRatio
|
|
480
|
-
], { orientation: [
|
|
480
|
+
], { orientation: [S = 0, P = 0, U = 0] = [] } = f(), M = [
|
|
481
481
|
Math.min(
|
|
482
482
|
Math.PI / 2 - 0.1,
|
|
483
|
-
Math.max(0.1,
|
|
483
|
+
Math.max(0.1, S - _ / b * Math.PI)
|
|
484
484
|
),
|
|
485
485
|
P,
|
|
486
|
-
U -
|
|
486
|
+
U - x / R * Math.PI
|
|
487
487
|
];
|
|
488
488
|
o({
|
|
489
|
-
orientation:
|
|
489
|
+
orientation: M
|
|
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: x, x: _, y: R }) => {
|
|
494
|
+
!i() || !p || (p === 1 && r() ? h(_, R) : p === 2 && s() && u(_, R, g, x));
|
|
495
|
+
}, y = (p) => {
|
|
496
|
+
p.preventDefault();
|
|
497
|
+
const g = p.touches.item(0);
|
|
497
498
|
if (!g)
|
|
498
499
|
return;
|
|
499
|
-
const { clientX:
|
|
500
|
-
|
|
501
|
-
}, w =
|
|
500
|
+
const { clientX: x, clientY: _ } = g;
|
|
501
|
+
h(x, _);
|
|
502
|
+
}, w = At(() => c = !1, 100), E = ({ x: p, y: g, deltaY: x }) => {
|
|
502
503
|
if (!i())
|
|
503
504
|
return;
|
|
504
|
-
c || (r() && l([
|
|
505
|
-
let { distance:
|
|
506
|
-
|
|
507
|
-
Math.max(
|
|
505
|
+
c || (r() && l([p, g]), c = !0);
|
|
506
|
+
let { distance: _ } = { ...dt, ...f() };
|
|
507
|
+
_ = Math.min(
|
|
508
|
+
Math.max(_ * Math.exp(x * 1e-3), _n),
|
|
508
509
|
H
|
|
509
|
-
), o({ distance:
|
|
510
|
-
}, A = (
|
|
511
|
-
return e.addEventListener("mousedown", d), e.addEventListener("mousemove", m), e.addEventListener("touchstart", d, { passive: !1 }), e.addEventListener("touchmove",
|
|
510
|
+
), o({ distance: _ }), w();
|
|
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", y, { passive: !1 }), e.addEventListener("gesturestart", A), e.addEventListener("wheel", E, { 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",
|
|
514
|
+
e.removeEventListener("mousedown", d), e.removeEventListener("mousemove", m), e.removeEventListener("touchstart", d), e.removeEventListener("touchmove", y), e.removeEventListener("gesturestart", A), e.removeEventListener("wheel", E), e.removeEventListener("contextmenu", v);
|
|
514
515
|
}
|
|
515
516
|
};
|
|
516
517
|
}, V = ({
|
|
@@ -573,7 +574,7 @@ vec2 pack_index(in int index) {
|
|
|
573
574
|
void main(void) {
|
|
574
575
|
result = vec4(pack_depth(gl_FragCoord.z), pack_index(index));
|
|
575
576
|
}`;
|
|
576
|
-
const
|
|
577
|
+
const mt = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2FkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGFzeW5jIG49Pntjb25zdFtpLHRdPW4uZGF0YTtpZihpIT09ImxvYWQiKXJldHVybjtjb25zdCBvPW5ldyBBYm9ydENvbnRyb2xsZXIse3NpZ25hbDpjfT1vLHI9ZT0+e2NvbnN0W2Esc109ZS5kYXRhO2E9PT0iY2FuY2VsIiYmcz09PXQmJm8uYWJvcnQoKX07YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIscik7dHJ5e2NvbnN0IGU9YXdhaXQgZmV0Y2godCx7bW9kZToiY29ycyIsc2lnbmFsOmN9KTtpZighZS5vayl7cG9zdE1lc3NhZ2Uoe3VybDp0LGltYWdlOnZvaWQgMH0pO3JldHVybn1jb25zdCBhPWF3YWl0IGUuYmxvYigpLHM9YXdhaXQgY3JlYXRlSW1hZ2VCaXRtYXAoYSk7cG9zdE1lc3NhZ2Uoe3VybDp0LGltYWdlOnN9KX1jYXRjaChlKXtpZighKGUgaW5zdGFuY2VvZiBFcnJvciYmZS5tZXNzYWdlPT09IlRoZSB1c2VyIGFib3J0ZWQgYSByZXF1ZXN0LiIpKXRocm93IGV9ZmluYWxseXtyZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixyKX19KX0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPWltYWdlLWxvYWQtd29ya2VyLUJfWjJxRGl1LmpzLm1hcAo=", yn = (e) => Uint8Array.from(atob(e), (t) => t.charCodeAt(0)), ct = typeof window < "u" && window.Blob && new Blob([yn(mt)], { type: "text/javascript;charset=utf-8" });
|
|
577
578
|
function wn(e) {
|
|
578
579
|
let t;
|
|
579
580
|
try {
|
|
@@ -587,7 +588,7 @@ function wn(e) {
|
|
|
587
588
|
}), n;
|
|
588
589
|
} catch {
|
|
589
590
|
return new Worker(
|
|
590
|
-
"data:text/javascript;base64," +
|
|
591
|
+
"data:text/javascript;base64," + mt,
|
|
591
592
|
{
|
|
592
593
|
name: e?.name
|
|
593
594
|
}
|
|
@@ -615,7 +616,7 @@ const Ue = wn(), Tn = ({
|
|
|
615
616
|
},
|
|
616
617
|
cancel: s
|
|
617
618
|
};
|
|
618
|
-
},
|
|
619
|
+
}, vt = (e) => {
|
|
619
620
|
const t = e.createTexture();
|
|
620
621
|
if (!t)
|
|
621
622
|
throw new Error("Texture creation failed");
|
|
@@ -629,12 +630,12 @@ const Ue = wn(), Tn = ({
|
|
|
629
630
|
0
|
|
630
631
|
);
|
|
631
632
|
}, dispose: () => e.deleteTexture(t) };
|
|
632
|
-
},
|
|
633
|
+
}, pt = ({
|
|
633
634
|
gl: e,
|
|
634
635
|
url: t,
|
|
635
636
|
onLoad: n
|
|
636
637
|
}) => {
|
|
637
|
-
const i =
|
|
638
|
+
const i = vt(e), r = Tn({
|
|
638
639
|
url: t,
|
|
639
640
|
onLoad: (a) => {
|
|
640
641
|
a && (i.use(), e.texImage2D(
|
|
@@ -732,11 +733,11 @@ const gi = (e, t = {}) => {
|
|
|
732
733
|
const a = me(
|
|
733
734
|
() => t.url?.() ?? "",
|
|
734
735
|
(m) => {
|
|
735
|
-
const
|
|
736
|
+
const y = pt({
|
|
736
737
|
gl: n,
|
|
737
738
|
url: m,
|
|
738
|
-
onLoad: ({ width: w, height:
|
|
739
|
-
r = [w,
|
|
739
|
+
onLoad: ({ width: w, height: E }) => {
|
|
740
|
+
r = [w, E], n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE), i?.dispose(), i = y;
|
|
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:
|
|
748
|
+
}), h = ({
|
|
749
|
+
viewport: { projection: m, modelView: y, camera: w, screen: E },
|
|
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, x = t.minSizePixels?.() ?? 0, _ = 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
|
-
modelView:
|
|
758
|
+
modelView: y,
|
|
758
759
|
camera: Q(w),
|
|
759
|
-
screen:
|
|
760
|
+
screen: E,
|
|
760
761
|
image: i,
|
|
761
762
|
imageSize: r,
|
|
762
763
|
position: Q(L(T)),
|
|
763
|
-
color:
|
|
764
|
+
color: p,
|
|
764
765
|
size: g,
|
|
765
|
-
minSizePixels:
|
|
766
|
-
maxSizePixels:
|
|
766
|
+
minSizePixels: x,
|
|
767
|
+
maxSizePixels: _,
|
|
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,16 +786,16 @@ 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"), y = f.uniform2f("screen"), w = f.uniform1i("image"), E = 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"), x = f.uniform1f("max_size_pixels");
|
|
791
792
|
return { execute: ({
|
|
792
793
|
projection: R,
|
|
793
|
-
modelView:
|
|
794
|
-
camera:
|
|
794
|
+
modelView: b,
|
|
795
|
+
camera: S,
|
|
795
796
|
screen: P,
|
|
796
797
|
image: U,
|
|
797
|
-
imageSize:
|
|
798
|
+
imageSize: M,
|
|
798
799
|
position: N,
|
|
799
800
|
color: I,
|
|
800
801
|
size: j,
|
|
@@ -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(b), m.set(S), y.set(P), E.set(M), A.set(N), v.set(I), p.set(j), g.set(X), x.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 };
|
|
@@ -825,13 +826,13 @@ const gi = (e, t = {}) => {
|
|
|
825
826
|
},
|
|
826
827
|
dispose: () => Object.values(i).forEach((o) => o.dispose())
|
|
827
828
|
};
|
|
828
|
-
},
|
|
829
|
+
}, bi = (e) => ({
|
|
829
830
|
render: e,
|
|
830
831
|
dispose: () => {
|
|
831
832
|
}
|
|
832
|
-
}),
|
|
833
|
+
}), Mi = () => ({ dispose: () => {
|
|
833
834
|
} });
|
|
834
|
-
var
|
|
835
|
+
var bn = `#version 300 es
|
|
835
836
|
|
|
836
837
|
precision highp float;
|
|
837
838
|
|
|
@@ -848,7 +849,7 @@ void main() {
|
|
|
848
849
|
result = color_out * texture(
|
|
849
850
|
dash,
|
|
850
851
|
vec2(fract((distance_out / dash_size) - dash_offset), 0.0));;
|
|
851
|
-
}`,
|
|
852
|
+
}`, Mn = `#version 300 es
|
|
852
853
|
|
|
853
854
|
precision highp float;
|
|
854
855
|
|
|
@@ -915,66 +916,66 @@ void main(void) {
|
|
|
915
916
|
color_out = color;
|
|
916
917
|
distance_out = distance;
|
|
917
918
|
}`;
|
|
918
|
-
const
|
|
919
|
+
const Si = (e, t = {}) => {
|
|
919
920
|
const { gl: n } = e;
|
|
920
921
|
let i = 0;
|
|
921
|
-
const r = V({ gl: n, type: "i32", target: "array" }), s = V({ gl: n, type: "u16", target: "element" }), o = V({ gl: n, type: "f32", target: "array" }), c = V({ gl: n, type: "f32", target: "array" }), { renderProgram: a, depthProgram: f } =
|
|
922
|
+
const r = V({ gl: n, type: "i32", target: "array" }), s = V({ gl: n, type: "u16", target: "element" }), o = V({ gl: n, type: "f32", target: "array" }), c = V({ gl: n, type: "f32", target: "array" }), { renderProgram: a, depthProgram: f } = Sn(e, {
|
|
922
923
|
positionBuffer: r,
|
|
923
924
|
indexBuffer: s,
|
|
924
925
|
cornerBuffer: o,
|
|
925
926
|
distanceBuffer: c
|
|
926
|
-
}), l =
|
|
927
|
+
}), l = vt(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: E, camera: A, screen: v },
|
|
930
931
|
depth: T = !1,
|
|
931
|
-
index:
|
|
932
|
+
index: p = 0
|
|
932
933
|
}) => {
|
|
933
|
-
|
|
934
|
-
const g = t.color?.() ?? [1, 1, 1, 1],
|
|
934
|
+
u(), d();
|
|
935
|
+
const g = t.color?.() ?? [1, 1, 1, 1], x = t.width?.() ?? 1, _ = t.minWidthPixels?.() ?? 0, R = t.maxWidthPixels?.() ?? Number.MAX_VALUE, b = t.depthWidthPixels?.(), S = 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: E,
|
|
940
941
|
camera: Q(A),
|
|
941
942
|
screen: v,
|
|
942
943
|
count: i,
|
|
943
944
|
color: g,
|
|
944
|
-
width:
|
|
945
|
-
minWidthPixels: T &&
|
|
946
|
-
maxWidthPixels: T &&
|
|
947
|
-
index:
|
|
945
|
+
width: x,
|
|
946
|
+
minWidthPixels: T && b !== void 0 ? Math.max(_, b) : _,
|
|
947
|
+
maxWidthPixels: T && b !== void 0 ? Math.max(R, b) : R,
|
|
948
|
+
index: p,
|
|
948
949
|
dash: l,
|
|
949
|
-
dashSize:
|
|
950
|
+
dashSize: S,
|
|
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 || !
|
|
956
|
+
const E = w.flatMap((p) => {
|
|
957
|
+
const [g] = p, [x] = p.slice(-1);
|
|
958
|
+
return !g || !x ? [] : [g, ...p, x].map((_) => Q(L(_))).flatMap((_) => [..._, ..._, ..._, ..._]);
|
|
958
959
|
}), { indexData: A } = w.reduce(
|
|
959
|
-
({ indexData:
|
|
960
|
-
if (
|
|
961
|
-
return { indexData:
|
|
962
|
-
const
|
|
963
|
-
const [
|
|
964
|
-
(
|
|
960
|
+
({ indexData: p, count: g }, x) => {
|
|
961
|
+
if (x.length === 0)
|
|
962
|
+
return { indexData: p, count: g };
|
|
963
|
+
const _ = ie(0, (x.length - 1) * 2).flatMap((R) => {
|
|
964
|
+
const [b = 0, S = 0, P = 0, U = 0] = ie(0, 4).map(
|
|
965
|
+
(M) => M + R * 2 + g
|
|
965
966
|
);
|
|
966
967
|
return [
|
|
967
|
-
[
|
|
968
|
-
[
|
|
968
|
+
[b, S, U],
|
|
969
|
+
[b, U, P]
|
|
969
970
|
].flat();
|
|
970
971
|
});
|
|
971
|
-
return g += (
|
|
972
|
+
return g += (x.length + 2) * 4, p = p.concat(_), { 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
|
|
987
|
-
(
|
|
986
|
+
), T = w.flatMap((p) => {
|
|
987
|
+
const x = p.map(
|
|
988
|
+
(b, S) => Te(L(b), L(p[S - 1] ?? b)) * H
|
|
988
989
|
).reduce(
|
|
989
|
-
({ current:
|
|
990
|
+
({ current: b, result: S }, P) => (b += P, S.push(b), { current: b, result: S }),
|
|
990
991
|
{ current: 0, result: [] }
|
|
991
|
-
).result, [
|
|
992
|
-
return
|
|
992
|
+
).result, [_] = x, [R] = x.slice(-1);
|
|
993
|
+
return _ === void 0 || R === void 0 ? [] : [_, ...x, R].flatMap((b) => [b, b, b, b]);
|
|
993
994
|
});
|
|
994
|
-
r.set(
|
|
995
|
+
r.set(E), s.set(A), o.set(v), c.set(T);
|
|
995
996
|
}
|
|
996
997
|
), d = me(
|
|
997
998
|
() => t.dashPattern?.(),
|
|
@@ -1005,18 +1006,18 @@ 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((E) => [...E.map((A) => A * 255)]))
|
|
1009
1010
|
);
|
|
1010
1011
|
}
|
|
1011
1012
|
), m = () => {
|
|
1012
1013
|
r.dispose(), s.dispose(), o.dispose(), c.dispose();
|
|
1013
|
-
},
|
|
1014
|
+
}, y = Ae(t);
|
|
1014
1015
|
return {
|
|
1015
|
-
render:
|
|
1016
|
+
render: h,
|
|
1016
1017
|
dispose: m,
|
|
1017
|
-
...
|
|
1018
|
+
...y
|
|
1018
1019
|
};
|
|
1019
|
-
},
|
|
1020
|
+
}, Sn = ({ gl: e, programs: t }, {
|
|
1020
1021
|
positionBuffer: n,
|
|
1021
1022
|
indexBuffer: i,
|
|
1022
1023
|
cornerBuffer: r,
|
|
@@ -1024,22 +1025,22 @@ const bi = (e, t = {}) => {
|
|
|
1024
1025
|
}) => {
|
|
1025
1026
|
const o = (f = !1) => {
|
|
1026
1027
|
const l = t.get({
|
|
1027
|
-
vertexSource:
|
|
1028
|
-
fragmentSource: f ? Re :
|
|
1029
|
-
}),
|
|
1030
|
-
stride:
|
|
1028
|
+
vertexSource: Mn,
|
|
1029
|
+
fragmentSource: f ? Re : bn
|
|
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:
|
|
1034
|
-
}),
|
|
1035
|
-
stride:
|
|
1036
|
-
offset:
|
|
1033
|
+
stride: u * 3,
|
|
1034
|
+
offset: u * 3 * 4
|
|
1035
|
+
}), y = l.attribute3i("next", n, {
|
|
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
|
+
}), E = 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"), x = l.uniform1f("width"), _ = l.uniform1f("max_width_pixels"), R = l.uniform1f("min_width_pixels"), b = l.uniform1i("index"), S = 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,
|
|
@@ -1049,13 +1050,13 @@ const bi = (e, t = {}) => {
|
|
|
1049
1050
|
color: G,
|
|
1050
1051
|
width: Z,
|
|
1051
1052
|
minWidthPixels: $,
|
|
1052
|
-
maxWidthPixels:
|
|
1053
|
+
maxWidthPixels: Me,
|
|
1053
1054
|
index: qe,
|
|
1054
1055
|
dash: Je,
|
|
1055
1056
|
dashSize: O,
|
|
1056
1057
|
dashOffset: W
|
|
1057
1058
|
}) => {
|
|
1058
|
-
C !== 0 && (l.use(), d.use(), m.use(),
|
|
1059
|
+
C !== 0 && (l.use(), d.use(), m.use(), y.use(), w.use(), E.use(), A.set(N), v.set(I), T.set(j), p.set(X), g.set(G), x.set(Z), R.set($), _.set(Me), b.set(qe), P.set(O), U.set(W), e.activeTexture(e.TEXTURE0), S.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 };
|
|
@@ -1118,43 +1119,43 @@ const Ui = (e, t = {}) => {
|
|
|
1118
1119
|
indexBuffer: s,
|
|
1119
1120
|
normalBuffer: o
|
|
1120
1121
|
}), f = ({
|
|
1121
|
-
viewport: { projection: d, modelView: m, camera:
|
|
1122
|
-
depth:
|
|
1122
|
+
viewport: { projection: d, modelView: m, camera: y, screen: w },
|
|
1123
|
+
depth: E = !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], x = t.size?.() ?? 1, _ = t.minSizePixels?.() ?? 0, R = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
1127
|
+
if (l(), ge(n, E, t))
|
|
1127
1128
|
return;
|
|
1128
|
-
(
|
|
1129
|
+
(E ? a : c).execute({
|
|
1129
1130
|
projection: d,
|
|
1130
1131
|
modelView: m,
|
|
1131
|
-
camera: Q(
|
|
1132
|
+
camera: Q(y),
|
|
1132
1133
|
screen: w,
|
|
1133
1134
|
count: i,
|
|
1134
1135
|
position: Q(L(v)),
|
|
1135
|
-
orientation:
|
|
1136
|
-
color:
|
|
1136
|
+
orientation: Ct(xe(), T),
|
|
1137
|
+
color: p,
|
|
1137
1138
|
diffuse: g,
|
|
1138
|
-
size:
|
|
1139
|
-
minSizePixels:
|
|
1139
|
+
size: x,
|
|
1140
|
+
minSizePixels: _,
|
|
1140
1141
|
maxSizePixels: R,
|
|
1141
1142
|
index: A
|
|
1142
1143
|
});
|
|
1143
1144
|
}, l = me(
|
|
1144
1145
|
() => t.mesh?.(),
|
|
1145
1146
|
(d) => {
|
|
1146
|
-
const { vertices: m = [], indices:
|
|
1147
|
-
r.set(m.flatMap((
|
|
1148
|
-
w.length === 0 ? m.flatMap(() => [0, 0, 0]) : w.flatMap((
|
|
1149
|
-
), i =
|
|
1147
|
+
const { vertices: m = [], indices: y = [], normals: w = [] } = d ?? {};
|
|
1148
|
+
r.set(m.flatMap((E) => [...E])), s.set(y.flatMap((E) => [...E])), o.set(
|
|
1149
|
+
w.length === 0 ? m.flatMap(() => [0, 0, 0]) : w.flatMap((E) => [...E])
|
|
1150
|
+
), i = y.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,14 +1166,14 @@ 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"), y = f.uniform3i("position"), w = f.uniformMatrix4f("orientation"), E = 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"), x = f.uniform1i("index");
|
|
1169
1170
|
return { execute: ({
|
|
1170
1171
|
projection: R,
|
|
1171
|
-
modelView:
|
|
1172
|
-
camera:
|
|
1172
|
+
modelView: b,
|
|
1173
|
+
camera: S,
|
|
1173
1174
|
screen: P,
|
|
1174
1175
|
count: U,
|
|
1175
|
-
position:
|
|
1176
|
+
position: M,
|
|
1176
1177
|
orientation: N,
|
|
1177
1178
|
color: I,
|
|
1178
1179
|
diffuse: j,
|
|
@@ -1181,12 +1182,12 @@ 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(b), m.set(S), E.set(P), y.set(M), w.set(N), A.set(I), v.set(j), T.set(X), p.set(C), g.set(G), x.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 };
|
|
1188
1189
|
};
|
|
1189
|
-
var
|
|
1190
|
+
var xt = function(e, t, n, i, r) {
|
|
1190
1191
|
let s, o = null;
|
|
1191
1192
|
if (r === kn(e, t, n, i) > 0)
|
|
1192
1193
|
for (s = t; s < n; s += i)
|
|
@@ -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
|
}
|
|
@@ -1259,7 +1260,7 @@ var pt = function(e, t, n, i, r) {
|
|
|
1259
1260
|
let i = e;
|
|
1260
1261
|
do {
|
|
1261
1262
|
const r = i.prev, s = i.next.next;
|
|
1262
|
-
!je(r, s) &&
|
|
1263
|
+
!je(r, s) && Et(r, i, i.next, s) && _e(r, s) && _e(s, r) && (t.push(r.i / n), t.push(i.i / n), t.push(s.i / n), ye(i), ye(i.next), i = e = s), i = i.next;
|
|
1263
1264
|
} while (i !== e);
|
|
1264
1265
|
return i;
|
|
1265
1266
|
}, In = function(e, t, n, i, r, s) {
|
|
@@ -1268,7 +1269,7 @@ var pt = function(e, t, n, i, r) {
|
|
|
1268
1269
|
let c = o.next.next;
|
|
1269
1270
|
for (; c !== o.prev; ) {
|
|
1270
1271
|
if (o.i !== c.i && Vn(o, c)) {
|
|
1271
|
-
let a =
|
|
1272
|
+
let a = _t(o, c);
|
|
1272
1273
|
o = oe(o, o.next), a = oe(a, a.next), Ee(o, t, n, i, r, s, 0), Ee(a, t, n, i, r, s, 0);
|
|
1273
1274
|
return;
|
|
1274
1275
|
}
|
|
@@ -1280,7 +1281,7 @@ var pt = function(e, t, n, i, r) {
|
|
|
1280
1281
|
const r = [];
|
|
1281
1282
|
let s, o, c, a, f;
|
|
1282
1283
|
for (s = 0, o = t.length; s < o; s++)
|
|
1283
|
-
c = t[s] * i, a = s < o - 1 ? t[s + 1] * i : e.length, f =
|
|
1284
|
+
c = t[s] * i, a = s < o - 1 ? t[s + 1] * i : e.length, f = xt(e, c, a, i, !1), f === f.next && (f.steiner = !0), r.push(Zn(f));
|
|
1284
1285
|
for (r.sort(Cn), s = 0; s < r.length; s++)
|
|
1285
1286
|
n = Xn(r[s], n), n = oe(n, n.next);
|
|
1286
1287
|
return n;
|
|
@@ -1291,7 +1292,7 @@ var pt = function(e, t, n, i, r) {
|
|
|
1291
1292
|
if (n === null)
|
|
1292
1293
|
return t;
|
|
1293
1294
|
{
|
|
1294
|
-
const i =
|
|
1295
|
+
const i = _t(n, e), r = oe(n, n.next);
|
|
1295
1296
|
return oe(i, i.next), t === n ? r : t;
|
|
1296
1297
|
}
|
|
1297
1298
|
}, Wn = function(e, t) {
|
|
@@ -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);
|
|
@@ -1359,7 +1360,7 @@ var pt = function(e, t, n, i, r) {
|
|
|
1359
1360
|
return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y);
|
|
1360
1361
|
}, je = function(e, t) {
|
|
1361
1362
|
return e.x === t.x && e.y === t.y;
|
|
1362
|
-
},
|
|
1363
|
+
}, Et = function(e, t, n, i) {
|
|
1363
1364
|
const r = Pe(D(e, t, n)), s = Pe(D(e, t, i)), o = Pe(D(n, i, e)), c = Pe(D(n, i, t));
|
|
1364
1365
|
return !!(r !== s && o !== c || r === 0 && ze(e, n, t) || s === 0 && ze(e, i, t) || o === 0 && ze(n, e, i) || c === 0 && ze(n, t, i));
|
|
1365
1366
|
}, Pe = function(e) {
|
|
@@ -1369,7 +1370,7 @@ var pt = function(e, t, n, i, r) {
|
|
|
1369
1370
|
}, Yn = function(e, t) {
|
|
1370
1371
|
let n = e;
|
|
1371
1372
|
do {
|
|
1372
|
-
if (n.i !== e.i && n.next?.i !== e.i && n.i !== t.i && n.next?.i !== t.i &&
|
|
1373
|
+
if (n.i !== e.i && n.next?.i !== e.i && n.i !== t.i && n.next?.i !== t.i && Et(n, n.next, e, t))
|
|
1373
1374
|
return !0;
|
|
1374
1375
|
n = n.next;
|
|
1375
1376
|
} while (n !== e);
|
|
@@ -1383,7 +1384,7 @@ var pt = function(e, t, n, i, r) {
|
|
|
1383
1384
|
r.y > i != r.next.y > i && r.next.y !== r.y && n < (r.next.x - r.x) * (i - r.y) / (r.next.y - r.y) + r.x && (s = !s), r = r.next;
|
|
1384
1385
|
while (r !== e);
|
|
1385
1386
|
return s;
|
|
1386
|
-
},
|
|
1387
|
+
}, _t = function(e, t) {
|
|
1387
1388
|
const n = new Ce(e.i, e.x, e.y), i = new Ce(t.i, t.x, t.y), r = e.next, s = t.prev;
|
|
1388
1389
|
return e.next = t, t.prev = e, n.next = r, r.prev = n, i.next = n, n.prev = i, s.next = i, i.prev = s, i;
|
|
1389
1390
|
}, ye = function(e) {
|
|
@@ -1410,18 +1411,18 @@ class Ce {
|
|
|
1410
1411
|
}
|
|
1411
1412
|
function Hn(e, t = [], n = 2) {
|
|
1412
1413
|
const i = t.length > 0, r = i ? t[0] * n : e.length;
|
|
1413
|
-
let s =
|
|
1414
|
+
let s = xt(e, 0, r, n, !0);
|
|
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: y },
|
|
1557
1558
|
depth: w = !1,
|
|
1558
|
-
index:
|
|
1559
|
+
index: E = 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
|
-
screen:
|
|
1568
|
+
screen: y,
|
|
1568
1569
|
count: i,
|
|
1569
1570
|
color: A,
|
|
1570
|
-
index:
|
|
1571
|
+
index: E
|
|
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((y) => y.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"), y = a.uniform1i("index");
|
|
1597
1598
|
return { execute: ({
|
|
1598
|
-
projection:
|
|
1599
|
+
projection: E,
|
|
1599
1600
|
modelView: A,
|
|
1600
1601
|
camera: v,
|
|
1601
1602
|
screen: T,
|
|
1602
|
-
count:
|
|
1603
|
+
count: p,
|
|
1603
1604
|
color: g,
|
|
1604
|
-
index:
|
|
1605
|
+
index: x
|
|
1605
1606
|
}) => {
|
|
1606
|
-
|
|
1607
|
+
p !== 0 && (a.use(), f.use(), l.set(E), h.set(A), u.set(v), d.set(T), m.set(g), y.set(x), 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 };
|
|
@@ -1619,7 +1620,7 @@ const Pi = (e, t = {}) => {
|
|
|
1619
1620
|
return { texture: a, downsample: s };
|
|
1620
1621
|
}
|
|
1621
1622
|
}
|
|
1622
|
-
}), fe = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date,
|
|
1623
|
+
}), fe = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, yt = /* @__PURE__ */ new Set(), Ke = typeof process == "object" && process ? process : {}, wt = (e, t, n, i) => {
|
|
1623
1624
|
typeof Ke.emitWarning == "function" ? Ke.emitWarning(e, t, n, i) : console.error(`[${n}] ${t}: ${e}`);
|
|
1624
1625
|
};
|
|
1625
1626
|
let Xe = globalThis.AbortController, ft = globalThis.AbortSignal;
|
|
@@ -1648,30 +1649,30 @@ if (typeof Xe > "u") {
|
|
|
1648
1649
|
};
|
|
1649
1650
|
let e = Ke.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
|
|
1650
1651
|
const t = () => {
|
|
1651
|
-
e && (e = !1,
|
|
1652
|
+
e && (e = !1, wt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
1652
1653
|
};
|
|
1653
1654
|
}
|
|
1654
|
-
const ti = (e) => !
|
|
1655
|
+
const ti = (e) => !yt.has(e), q = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e), Tt = (e) => q(e) ? e <= Math.pow(2, 8) ? Uint8Array : e <= Math.pow(2, 16) ? Uint16Array : e <= Math.pow(2, 32) ? Uint32Array : e <= Number.MAX_SAFE_INTEGER ? Ie : null : null;
|
|
1655
1656
|
class Ie extends Array {
|
|
1656
1657
|
constructor(t) {
|
|
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
|
|
1664
1665
|
static #c = !1;
|
|
1665
1666
|
static create(t) {
|
|
1666
|
-
const n =
|
|
1667
|
+
const n = Tt(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
|
},
|
|
@@ -1799,7 +1800,7 @@ class Qe {
|
|
|
1799
1800
|
// methods
|
|
1800
1801
|
isBackgroundFetch: (n) => t.#t(n),
|
|
1801
1802
|
backgroundFetch: (n, i, r, s) => t.#L(n, i, r, s),
|
|
1802
|
-
moveToTail: (n) => t.#
|
|
1803
|
+
moveToTail: (n) => t.#S(n),
|
|
1803
1804
|
indexes: (n) => t.#T(n),
|
|
1804
1805
|
rindexes: (n) => t.#g(n),
|
|
1805
1806
|
isStale: (n) => t.#m(n)
|
|
@@ -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: y, fetchMethod: w, noDeleteOnFetchRejection: E, 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
|
-
const g = n ?
|
|
1856
|
+
const g = n ? Tt(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 = y, 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 = !!E, 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,11 +1876,11 @@ 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
|
-
const
|
|
1882
|
-
ti(
|
|
1881
|
+
if (!this.ttlAutopurge && !this.#c && !this.#u) {
|
|
1882
|
+
const x = "LRU_CACHE_UNBOUNDED";
|
|
1883
|
+
ti(x) && (yt.add(x), wt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", x, Qe));
|
|
1883
1884
|
}
|
|
1884
1885
|
}
|
|
1885
1886
|
/**
|
|
@@ -1897,7 +1898,7 @@ class Qe {
|
|
|
1897
1898
|
}, o + 1);
|
|
1898
1899
|
a.unref && a.unref();
|
|
1899
1900
|
}
|
|
1900
|
-
}, this.#
|
|
1901
|
+
}, this.#b = (s) => {
|
|
1901
1902
|
n[s] = t[s] !== 0 ? fe.now() : 0;
|
|
1902
1903
|
}, this.#R = (s, o) => {
|
|
1903
1904
|
if (t[o]) {
|
|
@@ -1934,7 +1935,7 @@ class Qe {
|
|
|
1934
1935
|
};
|
|
1935
1936
|
}
|
|
1936
1937
|
// conditionally set private methods related to TTL
|
|
1937
|
-
#
|
|
1938
|
+
#b = () => {
|
|
1938
1939
|
};
|
|
1939
1940
|
#R = () => {
|
|
1940
1941
|
};
|
|
@@ -1944,7 +1945,7 @@ class Qe {
|
|
|
1944
1945
|
#m = () => !1;
|
|
1945
1946
|
#X() {
|
|
1946
1947
|
const t = new Ie(this.#c);
|
|
1947
|
-
this.#x = 0, this.#_ = t, this.#
|
|
1948
|
+
this.#x = 0, this.#_ = t, this.#M = (n) => {
|
|
1948
1949
|
this.#x -= t[n], t[n] = 0;
|
|
1949
1950
|
}, this.#I = (n, i, r, s) => {
|
|
1950
1951
|
if (this.#t(i))
|
|
@@ -1959,15 +1960,15 @@ 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
|
}
|
|
1967
1968
|
this.#x += t[n], r && (r.entrySize = i, r.totalCalculatedSize = this.#x);
|
|
1968
1969
|
};
|
|
1969
1970
|
}
|
|
1970
|
-
#
|
|
1971
|
+
#M = (t) => {
|
|
1971
1972
|
};
|
|
1972
1973
|
#P = (t, n, i) => {
|
|
1973
1974
|
};
|
|
@@ -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.#
|
|
2182
|
-
const
|
|
2183
|
-
if (n !==
|
|
2184
|
-
if (this.#A && this.#t(
|
|
2185
|
-
|
|
2186
|
-
const { __staleWhileFetching: d } =
|
|
2182
|
+
this.#S(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.#
|
|
2190
|
+
o || (this.#w && this.#v?.(u, t, "set"), this.#l && this.#o?.push([u, t, "set"]));
|
|
2191
|
+
if (this.#M(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;
|
|
@@ -2228,7 +2229,7 @@ class Qe {
|
|
|
2228
2229
|
}
|
|
2229
2230
|
#z(t) {
|
|
2230
2231
|
const n = this.#a, i = this.#n[n], r = this.#e[n];
|
|
2231
|
-
return this.#A && this.#t(r) ? r.__abortController.abort(new Error("evicted")) : (this.#w || this.#l) && (this.#w && this.#v?.(r, i, "evict"), this.#l && this.#o?.push([r, i, "evict"])), this.#
|
|
2232
|
+
return this.#A && this.#t(r) ? r.__abortController.abort(new Error("evicted")) : (this.#w || this.#l) && (this.#w && this.#v?.(r, i, "evict"), this.#l && this.#o?.push([r, i, "evict"])), this.#M(n), t && (this.#n[n] = void 0, this.#e[n] = void 0, this.#E.push(n)), this.#r === 1 ? (this.#a = this.#s = 0, this.#E.length = 0) : this.#a = this.#f[n], this.#i.delete(i), this.#r--, n;
|
|
2232
2233
|
}
|
|
2233
2234
|
/**
|
|
2234
2235
|
* Check if a key is in the cache, without updating the recency of use.
|
|
@@ -2247,7 +2248,7 @@ class Qe {
|
|
|
2247
2248
|
if (this.#m(s))
|
|
2248
2249
|
r && (r.has = "stale", this.#R(r, s));
|
|
2249
2250
|
else
|
|
2250
|
-
return i && this.#
|
|
2251
|
+
return i && this.#b(s), r && (r.has = "hit", this.#R(r, s)), !0;
|
|
2251
2252
|
} else
|
|
2252
2253
|
r && (r.has = "miss");
|
|
2253
2254
|
return !1;
|
|
@@ -2278,26 +2279,26 @@ class Qe {
|
|
|
2278
2279
|
signal: o.signal,
|
|
2279
2280
|
options: i,
|
|
2280
2281
|
context: r
|
|
2281
|
-
}, f = (
|
|
2282
|
-
const { aborted:
|
|
2283
|
-
if (i.status && (
|
|
2284
|
-
return
|
|
2282
|
+
}, f = (y, w = !1) => {
|
|
2283
|
+
const { aborted: E } = o.signal, A = i.ignoreFetchAbort && y !== void 0;
|
|
2284
|
+
if (i.status && (E && !w ? (i.status.fetchAborted = !0, i.status.fetchError = o.signal.reason, A && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), E && !A && !w)
|
|
2285
|
+
return h(o.signal.reason);
|
|
2285
2286
|
const v = d;
|
|
2286
|
-
return this.#e[n] === d && (
|
|
2287
|
-
}, l = (
|
|
2288
|
-
const { aborted: w } = o.signal,
|
|
2289
|
-
if (this.#e[n] === d && (!v || T.__staleWhileFetching === void 0 ? this.delete(t) :
|
|
2287
|
+
return this.#e[n] === d && (y === void 0 ? v.__staleWhileFetching ? this.#e[n] = v.__staleWhileFetching : this.delete(t) : (i.status && (i.status.fetchUpdated = !0), this.set(t, y, a.options))), y;
|
|
2288
|
+
}, l = (y) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = y), h(y)), h = (y) => {
|
|
2289
|
+
const { aborted: w } = o.signal, E = w && i.allowStaleOnFetchAbort, A = E || i.allowStaleOnFetchRejection, v = A || i.noDeleteOnFetchRejection, T = d;
|
|
2290
|
+
if (this.#e[n] === d && (!v || T.__staleWhileFetching === void 0 ? this.delete(t) : E || (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
|
-
throw
|
|
2293
|
-
},
|
|
2294
|
-
const
|
|
2295
|
-
|
|
2296
|
-
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (
|
|
2293
|
+
throw y;
|
|
2294
|
+
}, u = (y, w) => {
|
|
2295
|
+
const E = this.#U?.(t, s, a);
|
|
2296
|
+
E && E instanceof Promise && E.then((A) => y(A === void 0 ? void 0 : A), w), o.signal.addEventListener("abort", () => {
|
|
2297
|
+
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (y(void 0), i.allowStaleOnFetchAbort && (y = (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
|
-
context:
|
|
2331
|
+
context: y,
|
|
2331
2332
|
forceRefresh: w = !1,
|
|
2332
|
-
status:
|
|
2333
|
+
status: E,
|
|
2333
2334
|
signal: A
|
|
2334
2335
|
} = n;
|
|
2335
2336
|
if (!this.#A)
|
|
2336
|
-
return
|
|
2337
|
+
return E && (E.fetch = "get"), this.get(t, {
|
|
2337
2338
|
allowStale: i,
|
|
2338
2339
|
updateAgeOnGet: r,
|
|
2339
2340
|
noDeleteOnStaleGet: s,
|
|
2340
|
-
status:
|
|
2341
|
+
status: E
|
|
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: E,
|
|
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
|
+
E && (E.fetch = "miss");
|
|
2362
|
+
const p = this.#L(t, T, v, y);
|
|
2363
|
+
return p.__returned = p;
|
|
2363
2364
|
} else {
|
|
2364
|
-
const
|
|
2365
|
-
if (this.#t(
|
|
2366
|
-
const
|
|
2367
|
-
return
|
|
2365
|
+
const p = this.#e[T];
|
|
2366
|
+
if (this.#t(p)) {
|
|
2367
|
+
const b = i && p.__staleWhileFetching !== void 0;
|
|
2368
|
+
return E && (E.fetch = "inflight", b && (E.returnedStale = !0)), b ? p.__staleWhileFetching : p.__returned = p;
|
|
2368
2369
|
}
|
|
2369
2370
|
const g = this.#m(T);
|
|
2370
2371
|
if (!w && !g)
|
|
2371
|
-
return
|
|
2372
|
-
const
|
|
2373
|
-
return
|
|
2372
|
+
return E && (E.fetch = "hit"), this.#S(T), r && this.#b(T), E && this.#R(E, T), p;
|
|
2373
|
+
const x = this.#L(t, T, v, y), R = x.__staleWhileFetching !== void 0 && i;
|
|
2374
|
+
return E && (E.fetch = g ? "stale" : "refresh", R && g && (E.returnedStale = !0)), R ? x.__staleWhileFetching : x.__returned = x;
|
|
2374
2375
|
}
|
|
2375
2376
|
}
|
|
2376
2377
|
/**
|
|
@@ -2383,15 +2384,15 @@ class Qe {
|
|
|
2383
2384
|
const { allowStale: i = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: s = this.noDeleteOnStaleGet, status: o } = n, c = this.#i.get(t);
|
|
2384
2385
|
if (c !== void 0) {
|
|
2385
2386
|
const a = this.#e[c], f = this.#t(a);
|
|
2386
|
-
return o && this.#R(o, c), this.#m(c) ? (o && (o.get = "stale"), f ? (o && i && a.__staleWhileFetching !== void 0 && (o.returnedStale = !0), i ? a.__staleWhileFetching : void 0) : (s || this.delete(t), o && i && (o.returnedStale = !0), i ? a : void 0)) : (o && (o.get = "hit"), f ? a.__staleWhileFetching : (this.#
|
|
2387
|
+
return o && this.#R(o, c), this.#m(c) ? (o && (o.get = "stale"), f ? (o && i && a.__staleWhileFetching !== void 0 && (o.returnedStale = !0), i ? a.__staleWhileFetching : void 0) : (s || this.delete(t), o && i && (o.returnedStale = !0), i ? a : void 0)) : (o && (o.get = "hit"), f ? a.__staleWhileFetching : (this.#S(c), r && this.#b(c), a));
|
|
2387
2388
|
} else
|
|
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
|
-
t !== this.#s && (t === this.#a ? this.#a = this.#f[t] : this.#C(this.#
|
|
2394
|
+
#S(t) {
|
|
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.
|
|
@@ -2405,17 +2406,17 @@ class Qe {
|
|
|
2405
2406
|
if (n = !0, this.#r === 1)
|
|
2406
2407
|
this.clear();
|
|
2407
2408
|
else {
|
|
2408
|
-
this.#
|
|
2409
|
+
this.#M(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,25 +2478,25 @@ 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, y = [Math.floor(a / m), Math.floor(f / m), l - d], w = n.get(y);
|
|
2484
2485
|
if (w)
|
|
2485
2486
|
return { buffer: w, downsample: d };
|
|
2486
|
-
const
|
|
2487
|
-
return e.bindFramebuffer(e.FRAMEBUFFER, r),
|
|
2487
|
+
const E = 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, E), e.bindFramebuffer(e.FRAMEBUFFER, null), n.set(y, E), { buffer: E, downsample: d };
|
|
2488
2489
|
};
|
|
2489
2490
|
return { get: ([a = 0, f = 0], l = ni) => {
|
|
2490
|
-
const
|
|
2491
|
-
let [
|
|
2492
|
-
const
|
|
2493
|
-
if (!
|
|
2491
|
+
const h = 2 ** l, u = L([a, f, 0]).map((b) => b * h), [d = 0, m = 0] = u.map((b) => Math.floor(b % h));
|
|
2492
|
+
let [y = 0, w = 0] = u.map((b) => b % 1);
|
|
2493
|
+
const E = s([d, m, l]);
|
|
2494
|
+
if (!E)
|
|
2494
2495
|
return 0;
|
|
2495
|
-
const { buffer: A, downsample: v } =
|
|
2496
|
-
[
|
|
2497
|
-
const
|
|
2498
|
-
return (g * 65536 +
|
|
2496
|
+
const { buffer: A, downsample: v } = E, T = 2 ** v;
|
|
2497
|
+
[y, w] = [(d % T + y) / T, (m % T + w) / T];
|
|
2498
|
+
const p = 4 * te * Math.floor(w * te) + 4 * Math.floor(y * te), [g = 0, x = 0, _ = 0] = A.slice(p, p + 4);
|
|
2499
|
+
return (g * 65536 + x * 256 + _) / 10 - 1e4;
|
|
2499
2500
|
}, dispose: () => {
|
|
2500
2501
|
e.deleteFramebuffer(r);
|
|
2501
2502
|
} };
|
|
@@ -2534,7 +2535,19 @@ const lt = ({
|
|
|
2534
2535
|
return r.delete(a), f;
|
|
2535
2536
|
r.set(a, !0);
|
|
2536
2537
|
} else {
|
|
2537
|
-
const [l
|
|
2538
|
+
const [l = 0, h = 0, u = 0] = a;
|
|
2539
|
+
let d = t.replace("{x}", `${l}`).replace("{y}", `${h}`).replace("{z}", `${u}`);
|
|
2540
|
+
if (d.includes("{bbox}")) {
|
|
2541
|
+
const [y = 0, w = 0, E = 0] = a, A = 2 ** E - w - 1, [[v, T] = [], [p, g] = []] = [
|
|
2542
|
+
[0, 0],
|
|
2543
|
+
[1, 1]
|
|
2544
|
+
].map(([x = 0, _ = 0]) => [y + x, A + _, E]).map((x) => ht(x, x)).map(([x = 0, _ = 0]) => [
|
|
2545
|
+
(x - 0.5) * 2 * Math.PI * 6378137,
|
|
2546
|
+
(_ - 0.5) * 2 * Math.PI * 6378137
|
|
2547
|
+
]);
|
|
2548
|
+
d = d.replace("{bbox}", [v, T, p, g].join(","));
|
|
2549
|
+
}
|
|
2550
|
+
const m = pt({
|
|
2538
2551
|
gl: e,
|
|
2539
2552
|
url: d,
|
|
2540
2553
|
onLoad: () => {
|
|
@@ -2561,10 +2574,10 @@ const lt = ({
|
|
|
2561
2574
|
const s = t.get(r);
|
|
2562
2575
|
if (s)
|
|
2563
2576
|
return s;
|
|
2564
|
-
const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0,
|
|
2565
|
-
const [
|
|
2577
|
+
const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0, h = 0]) => [o + l, c + h, a]).map((l) => ht(l, l)).map((l) => se(l, l)).map((l) => {
|
|
2578
|
+
const [h = 0, u = 0] = l, d = Math.max(a - 5, 0);
|
|
2566
2579
|
return L(
|
|
2567
|
-
we(l,
|
|
2580
|
+
we(l, h, u, e.get([h, u], d)),
|
|
2568
2581
|
l
|
|
2569
2582
|
);
|
|
2570
2583
|
});
|
|
@@ -2627,19 +2640,19 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2627
2640
|
let i, r;
|
|
2628
2641
|
const s = me(
|
|
2629
2642
|
() => t.imageryUrl?.() ?? "",
|
|
2630
|
-
(
|
|
2643
|
+
(x) => {
|
|
2631
2644
|
i?.dispose(), i = lt({
|
|
2632
2645
|
gl: n,
|
|
2633
|
-
urlPattern:
|
|
2646
|
+
urlPattern: x,
|
|
2634
2647
|
onLoad: () => {
|
|
2635
|
-
const
|
|
2636
|
-
if (
|
|
2648
|
+
const _ = n.getExtension("EXT_texture_filter_anisotropic");
|
|
2649
|
+
if (_) {
|
|
2637
2650
|
const R = n.getParameter(
|
|
2638
|
-
|
|
2651
|
+
_.MAX_TEXTURE_MAX_ANISOTROPY_EXT
|
|
2639
2652
|
);
|
|
2640
2653
|
n.texParameterf(
|
|
2641
2654
|
n.TEXTURE_2D,
|
|
2642
|
-
|
|
2655
|
+
_.TEXTURE_MAX_ANISOTROPY_EXT,
|
|
2643
2656
|
R
|
|
2644
2657
|
);
|
|
2645
2658
|
}
|
|
@@ -2657,64 +2670,64 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2657
2670
|
onLoad: () => {
|
|
2658
2671
|
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
2672
|
}
|
|
2660
|
-
}), a = Fe(c, 3), f = ii({ gl: n, terrainCache: c }), l = si(f),
|
|
2661
|
-
|
|
2662
|
-
const
|
|
2663
|
-
|
|
2673
|
+
}), a = Fe(c, 3), f = ii({ gl: n, terrainCache: c }), l = si(f), h = V({ gl: n, type: "f32", target: "array" });
|
|
2674
|
+
h.set(fi.flatMap(([x = 0, _ = 0, R = 0]) => [x, _, R]));
|
|
2675
|
+
const u = V({ gl: n, type: "u16", target: "element" });
|
|
2676
|
+
u.set(ci);
|
|
2664
2677
|
const { renderProgram: d, depthProgram: m } = li(e, {
|
|
2665
|
-
uvwBuffer:
|
|
2666
|
-
indexBuffer:
|
|
2667
|
-
}),
|
|
2668
|
-
const { camera:
|
|
2669
|
-
const [
|
|
2670
|
-
let X =
|
|
2678
|
+
uvwBuffer: h,
|
|
2679
|
+
indexBuffer: u
|
|
2680
|
+
}), y = [0, 1, 2, 3], w = y.map(z), E = y.map(ee), A = y.map(de), v = (x) => {
|
|
2681
|
+
const { camera: _, worldToLocal: R, localToClip: b, clipToScreen: S } = x, P = (U) => {
|
|
2682
|
+
const [M = 0, N = 0, I = 0] = U, j = l.get(U);
|
|
2683
|
+
let X = ui(_, j);
|
|
2671
2684
|
if (!X) {
|
|
2672
|
-
const C = j.map((Z, $) => R(Z, w[$])).map((Z, $) =>
|
|
2673
|
-
if (
|
|
2685
|
+
const C = j.map((Z, $) => R(Z, w[$])).map((Z, $) => b(Z, E[$]));
|
|
2686
|
+
if (hi(C))
|
|
2674
2687
|
return [];
|
|
2675
|
-
X = di(C.map((Z, $) =>
|
|
2688
|
+
X = di(C.map((Z, $) => S(Z, A[$]))) > 512 / devicePixelRatio;
|
|
2676
2689
|
}
|
|
2677
2690
|
return X && I < ai ? [
|
|
2678
|
-
[2 *
|
|
2679
|
-
[2 *
|
|
2680
|
-
[2 *
|
|
2681
|
-
[2 *
|
|
2691
|
+
[2 * M, 2 * N, I + 1],
|
|
2692
|
+
[2 * M + 1, 2 * N, I + 1],
|
|
2693
|
+
[2 * M, 2 * N + 1, I + 1],
|
|
2694
|
+
[2 * M + 1, 2 * N + 1, I + 1]
|
|
2682
2695
|
].flatMap((G) => P(G)) : [U];
|
|
2683
2696
|
};
|
|
2684
2697
|
return P([0, 0, 0]);
|
|
2685
2698
|
}, T = ({
|
|
2686
|
-
viewport:
|
|
2687
|
-
depth:
|
|
2699
|
+
viewport: x,
|
|
2700
|
+
depth: _ = !1,
|
|
2688
2701
|
index: R = 0
|
|
2689
2702
|
}) => {
|
|
2690
|
-
const
|
|
2691
|
-
if (s(), ge(n,
|
|
2703
|
+
const b = t.color?.() ?? [1, 1, 1, 1];
|
|
2704
|
+
if (s(), ge(n, _, t))
|
|
2692
2705
|
return;
|
|
2693
|
-
const
|
|
2706
|
+
const S = _ ? m : d, { projection: P, modelView: U, camera: M } = x, N = v(x);
|
|
2694
2707
|
for (const I of N) {
|
|
2695
|
-
const j =
|
|
2696
|
-
if (!
|
|
2708
|
+
const j = _ ? void 0 : r?.get(I), X = a.get(I);
|
|
2709
|
+
if (!_ && !j || !X)
|
|
2697
2710
|
continue;
|
|
2698
2711
|
const { texture: C, downsample: G } = X, { texture: Z = C, downsample: $ = 0 } = j ?? {};
|
|
2699
|
-
|
|
2712
|
+
S.execute({
|
|
2700
2713
|
projection: P,
|
|
2701
2714
|
modelView: U,
|
|
2702
|
-
camera: Q(
|
|
2715
|
+
camera: Q(M),
|
|
2703
2716
|
xyz: I,
|
|
2704
2717
|
imagery: Z,
|
|
2705
2718
|
terrain: C,
|
|
2706
2719
|
downsampleImagery: $,
|
|
2707
2720
|
downsampleTerrain: G,
|
|
2708
|
-
color:
|
|
2721
|
+
color: b,
|
|
2709
2722
|
index: R
|
|
2710
2723
|
});
|
|
2711
2724
|
}
|
|
2712
|
-
},
|
|
2725
|
+
}, p = () => {
|
|
2713
2726
|
i?.dispose(), c.dispose(), f.dispose();
|
|
2714
2727
|
}, g = Ae(t);
|
|
2715
2728
|
return {
|
|
2716
2729
|
render: T,
|
|
2717
|
-
dispose:
|
|
2730
|
+
dispose: p,
|
|
2718
2731
|
...g
|
|
2719
2732
|
};
|
|
2720
2733
|
}, li = ({ gl: e, programs: t }, { uvwBuffer: n, indexBuffer: i }) => {
|
|
@@ -2722,35 +2735,35 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2722
2735
|
const a = t.get({
|
|
2723
2736
|
vertexSource: oi,
|
|
2724
2737
|
fragmentSource: c ? Re : ri
|
|
2725
|
-
}), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"),
|
|
2738
|
+
}), 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"), y = a.uniform1i("downsample_terrain"), w = a.uniform4f("color"), E = a.uniform3i("xyz"), A = a.uniform3i("camera"), v = a.uniform1i("index");
|
|
2726
2739
|
return { execute: ({
|
|
2727
|
-
projection:
|
|
2740
|
+
projection: p,
|
|
2728
2741
|
modelView: g,
|
|
2729
|
-
camera:
|
|
2730
|
-
xyz:
|
|
2742
|
+
camera: x,
|
|
2743
|
+
xyz: _,
|
|
2731
2744
|
imagery: R,
|
|
2732
|
-
terrain:
|
|
2733
|
-
downsampleImagery:
|
|
2745
|
+
terrain: b,
|
|
2746
|
+
downsampleImagery: S,
|
|
2734
2747
|
downsampleTerrain: P,
|
|
2735
2748
|
color: U,
|
|
2736
|
-
index:
|
|
2749
|
+
index: M
|
|
2737
2750
|
}) => {
|
|
2738
|
-
a.use(), f.use(), l.set(
|
|
2751
|
+
a.use(), f.use(), l.set(p), h.set(g), E.set(_), A.set(x), m.set(S), y.set(P), w.set(U), v.set(M), e.activeTexture(e.TEXTURE0), u.set(0), R.use(), e.activeTexture(e.TEXTURE1), d.set(1), b.use(), i.use(), e.drawElements(e.TRIANGLES, B * B * 2 * 3, e.UNSIGNED_SHORT, 0);
|
|
2739
2752
|
} };
|
|
2740
2753
|
}, s = r(), o = r(!0);
|
|
2741
2754
|
return { renderProgram: s, depthProgram: o };
|
|
2742
|
-
},
|
|
2755
|
+
}, ui = (e, t) => {
|
|
2743
2756
|
const [n, i, r, s] = t.reduce(
|
|
2744
|
-
([f, l,
|
|
2757
|
+
([f, l, h, u], [d = 0, m = 0]) => [
|
|
2745
2758
|
Math.min(d, f),
|
|
2746
2759
|
Math.max(d, l),
|
|
2747
|
-
Math.min(m,
|
|
2748
|
-
Math.max(m,
|
|
2760
|
+
Math.min(m, h),
|
|
2761
|
+
Math.max(m, u)
|
|
2749
2762
|
],
|
|
2750
2763
|
[1, 0, 1, 0]
|
|
2751
2764
|
), [o = 0, c = 0, a = 0] = e;
|
|
2752
2765
|
return o > n && o < i && c > r && c < s && a > 0 && a < i - n;
|
|
2753
|
-
},
|
|
2766
|
+
}, 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
2767
|
e.map(
|
|
2755
2768
|
(t, n) => hn(
|
|
2756
2769
|
e[n] ?? [0, 0],
|
|
@@ -2795,7 +2808,7 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2795
2808
|
onDragStart: o,
|
|
2796
2809
|
onDragEnd: c
|
|
2797
2810
|
};
|
|
2798
|
-
}, Be = 10,
|
|
2811
|
+
}, Be = 10, be = 1e-3, ae = (e) => (t) => {
|
|
2799
2812
|
let n, i;
|
|
2800
2813
|
return () => {
|
|
2801
2814
|
const r = performance.now(), s = (r - (i ?? r)) / 1e3;
|
|
@@ -2804,31 +2817,31 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2804
2817
|
return n = n ?? o, n = e({ time: s, current: n, target: o }), n;
|
|
2805
2818
|
};
|
|
2806
2819
|
}, vi = ae(
|
|
2807
|
-
({ time: e, current: t, target: n }) => (Math.abs(n - t) <
|
|
2820
|
+
({ time: e, current: t, target: n }) => (Math.abs(n - t) < be ? t = n : t = t + (n - t) * (1 - Math.exp(-Be * e)), t)
|
|
2808
2821
|
), pi = ae(
|
|
2809
|
-
({ time: e, current: t, target: n }) => (
|
|
2822
|
+
({ time: e, current: t, target: n }) => (un(t, n) < be ? on(t, n) : t = cn(
|
|
2810
2823
|
de(),
|
|
2811
2824
|
t,
|
|
2812
|
-
|
|
2825
|
+
ln(
|
|
2813
2826
|
de(),
|
|
2814
|
-
|
|
2827
|
+
dn(de(), n, t),
|
|
2815
2828
|
1 - Math.exp(-Be * e)
|
|
2816
2829
|
)
|
|
2817
2830
|
), t)
|
|
2818
2831
|
), Ii = ae(
|
|
2819
|
-
({ time: e, current: t, target: n }) => (
|
|
2832
|
+
({ time: e, current: t, target: n }) => (Qt(t, n) < be ? Ht(t, n) : t = Gt(
|
|
2820
2833
|
ee(),
|
|
2821
2834
|
t,
|
|
2822
|
-
|
|
2835
|
+
Kt(
|
|
2823
2836
|
ee(),
|
|
2824
|
-
|
|
2837
|
+
en(ee(), n, t),
|
|
2825
2838
|
1 - Math.exp(-Be * e)
|
|
2826
2839
|
)
|
|
2827
2840
|
), t)
|
|
2828
2841
|
), Oi = ae(
|
|
2829
2842
|
({ time: e, current: t, target: n }) => {
|
|
2830
2843
|
const i = Te(L(t), L(n));
|
|
2831
|
-
return i * H <
|
|
2844
|
+
return i * H < be || i > 1e5 / H ? Bt(t, n) : t = se(
|
|
2832
2845
|
ne(
|
|
2833
2846
|
z(),
|
|
2834
2847
|
L(t),
|
|
@@ -2883,17 +2896,17 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2883
2896
|
({ time: e, current: t, target: n }) => (t = pn(
|
|
2884
2897
|
Ne(
|
|
2885
2898
|
He(),
|
|
2886
|
-
|
|
2887
|
-
|
|
2899
|
+
Se(t),
|
|
2900
|
+
Se(n),
|
|
2888
2901
|
Math.PI * e
|
|
2889
2902
|
)
|
|
2890
|
-
),
|
|
2903
|
+
), nn(Se(t), Se(n)) < be && (n = t), t)
|
|
2891
2904
|
), Ei = 10, Xi = (e) => {
|
|
2892
2905
|
const t = xi(() => e().orientation), n = pi(() => e().offset), i = vi(() => e().fieldOfView);
|
|
2893
2906
|
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),
|
|
2907
|
+
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
2908
|
Math.log(o.distance) + (Math.log(f) - Math.log(o.distance)) * l
|
|
2896
|
-
),
|
|
2909
|
+
), u = o.distance > a ? 1 : o.distance / a, d = se(
|
|
2897
2910
|
ne(
|
|
2898
2911
|
z(),
|
|
2899
2912
|
L(o.target),
|
|
@@ -2904,14 +2917,14 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2904
2917
|
L(c.target),
|
|
2905
2918
|
L(o.target)
|
|
2906
2919
|
),
|
|
2907
|
-
l *
|
|
2920
|
+
l * u
|
|
2908
2921
|
)
|
|
2909
2922
|
)
|
|
2910
2923
|
);
|
|
2911
2924
|
return {
|
|
2912
2925
|
...o,
|
|
2913
2926
|
target: d,
|
|
2914
|
-
distance:
|
|
2927
|
+
distance: h,
|
|
2915
2928
|
orientation: t(),
|
|
2916
2929
|
offset: n(),
|
|
2917
2930
|
fieldOfView: i()
|
|
@@ -2936,8 +2949,8 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2936
2949
|
n
|
|
2937
2950
|
), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
2938
2951
|
let s = 0;
|
|
2939
|
-
const o = ([l = 0,
|
|
2940
|
-
s =
|
|
2952
|
+
const o = ([l = 0, h = 0]) => {
|
|
2953
|
+
s = h, e.bindTexture(e.TEXTURE_2D, t), e.texImage2D(
|
|
2941
2954
|
e.TEXTURE_2D,
|
|
2942
2955
|
0,
|
|
2943
2956
|
e.RGBA,
|
|
@@ -2957,10 +2970,10 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2957
2970
|
return {
|
|
2958
2971
|
use: r,
|
|
2959
2972
|
resize: o,
|
|
2960
|
-
read: ([l = 0,
|
|
2961
|
-
r(), e.readPixels(l, s -
|
|
2962
|
-
const [
|
|
2963
|
-
return [
|
|
2973
|
+
read: ([l = 0, h = 0]) => {
|
|
2974
|
+
r(), e.readPixels(l, s - h, 1, 1, e.RGBA, e.UNSIGNED_BYTE, c), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
2975
|
+
const [u = 0, d = 0, m = 0, y = 0] = c, E = 2 * ((u * 256 + d) / (256 * 256 - 1)) - 1, A = m * 256 + y;
|
|
2976
|
+
return [E, A];
|
|
2964
2977
|
},
|
|
2965
2978
|
dispose: () => {
|
|
2966
2979
|
e.deleteTexture(t), e.deleteFramebuffer(i), e.deleteRenderbuffer(n);
|
|
@@ -2975,45 +2988,45 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
|
|
|
2975
2988
|
let s = !1, o, c;
|
|
2976
2989
|
const a = () => {
|
|
2977
2990
|
s = !0;
|
|
2978
|
-
}, f = ({ x: m, y
|
|
2991
|
+
}, f = ({ x: m, y, movementX: w, movementY: E }) => {
|
|
2979
2992
|
if (o) {
|
|
2980
2993
|
if (o.onDrag) {
|
|
2981
|
-
const { point: A, position: v, layer: T } = i([m,
|
|
2994
|
+
const { point: A, position: v, layer: T } = i([m, y], { terrain: !0 });
|
|
2982
2995
|
o.onDrag({ point: A, position: v, layer: T });
|
|
2983
2996
|
}
|
|
2984
2997
|
if (o.onDragFlat) {
|
|
2985
|
-
const v = J(t(), n()).unproject([m,
|
|
2986
|
-
o.onDragFlat({ point: [m,
|
|
2998
|
+
const v = J(t(), n()).unproject([m, y], { targetZ: c });
|
|
2999
|
+
o.onDragFlat({ point: [m, y], position: v, layer: void 0 });
|
|
2987
3000
|
}
|
|
2988
3001
|
return;
|
|
2989
3002
|
}
|
|
2990
|
-
if (s && (Math.abs(w) > 1 || Math.abs(
|
|
3003
|
+
if (s && (Math.abs(w) > 1 || Math.abs(E) > 1)) {
|
|
2991
3004
|
s = !1;
|
|
2992
|
-
const { point: A, position: v, layer: T } = i([m,
|
|
3005
|
+
const { point: A, position: v, layer: T } = i([m, y]);
|
|
2993
3006
|
(T?.onDrag || T?.onDragFlat) && (o = T, o.onDragStart?.({ point: A, position: v, layer: T }), [, , c] = v);
|
|
2994
3007
|
}
|
|
2995
3008
|
}, l = (m) => {
|
|
2996
|
-
if (s &&
|
|
2997
|
-
const { x:
|
|
2998
|
-
o.onDragEnd?.({ point:
|
|
3009
|
+
if (s && h(m), s = !1, o) {
|
|
3010
|
+
const { x: y, y: w } = m, { point: E, position: A, layer: v } = i([y, w]);
|
|
3011
|
+
o.onDragEnd?.({ point: E, position: A, layer: v });
|
|
2999
3012
|
}
|
|
3000
3013
|
o = void 0;
|
|
3001
|
-
},
|
|
3002
|
-
const { point:
|
|
3014
|
+
}, h = ({ x: m, y, button: w }) => {
|
|
3015
|
+
const { point: E, position: A, layer: v } = i([m, y]);
|
|
3003
3016
|
(w === 2 ? v?.onRightClick : v?.onClick)?.({
|
|
3004
|
-
point:
|
|
3017
|
+
point: E,
|
|
3005
3018
|
position: A,
|
|
3006
3019
|
layer: v
|
|
3007
3020
|
});
|
|
3008
|
-
},
|
|
3009
|
-
const { point: w, position:
|
|
3010
|
-
A?.onDoubleClick?.({ point: w, position:
|
|
3021
|
+
}, u = ({ x: m, y }) => {
|
|
3022
|
+
const { point: w, position: E, layer: A } = i([m, y]);
|
|
3023
|
+
A?.onDoubleClick?.({ point: w, position: E, layer: A });
|
|
3011
3024
|
};
|
|
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",
|
|
3025
|
+
return r?.addEventListener("mousedown", a), r?.addEventListener("mousemove", f), r?.addEventListener("dblclick", u), window.addEventListener("mouseup", l), { dispose: () => {
|
|
3026
|
+
r?.removeEventListener("mousedown", a), r?.removeEventListener("mousemove", f), r?.removeEventListener("dblclick", u), window.removeEventListener("mouseup", l);
|
|
3014
3027
|
} };
|
|
3015
3028
|
};
|
|
3016
|
-
|
|
3029
|
+
Ut(Array);
|
|
3017
3030
|
const Wi = ({ gl: e }, t) => {
|
|
3018
3031
|
const { view: n, layers: i } = t;
|
|
3019
3032
|
let r = !0, s = [0, 0];
|
|
@@ -3025,48 +3038,48 @@ const Wi = ({ gl: e }, t) => {
|
|
|
3025
3038
|
const f = new ResizeObserver(([v]) => {
|
|
3026
3039
|
if (!v)
|
|
3027
3040
|
return;
|
|
3028
|
-
const { contentRect: T } = v, { width:
|
|
3029
|
-
a([
|
|
3041
|
+
const { contentRect: T } = v, { width: p, height: g } = T;
|
|
3042
|
+
a([p, g]);
|
|
3030
3043
|
});
|
|
3031
3044
|
c instanceof HTMLCanvasElement && f.observe(c);
|
|
3032
3045
|
const l = ([v = 0, T = 0]) => {
|
|
3033
3046
|
e.viewport(0, 0, v * devicePixelRatio, T * devicePixelRatio), e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT);
|
|
3034
|
-
},
|
|
3047
|
+
}, h = () => {
|
|
3035
3048
|
const v = J(n(), s);
|
|
3036
3049
|
l(s), Oe(i()).forEach((T) => T.render?.({ viewport: v }));
|
|
3037
|
-
},
|
|
3050
|
+
}, u = (v) => {
|
|
3038
3051
|
const T = J(n(), s);
|
|
3039
3052
|
l(s), (v ? [v] : Oe(i())).forEach(
|
|
3040
|
-
(
|
|
3053
|
+
(p, g) => p.render?.({ viewport: T, depth: !0, index: g + 1 })
|
|
3041
3054
|
);
|
|
3042
3055
|
}, d = () => {
|
|
3043
|
-
r && (
|
|
3056
|
+
r && (h(), requestAnimationFrame(d));
|
|
3044
3057
|
};
|
|
3045
3058
|
requestAnimationFrame(d);
|
|
3046
|
-
const m = (v) => J(n(), s).project(v),
|
|
3047
|
-
const { screenToClip:
|
|
3059
|
+
const m = (v) => J(n(), s).project(v), y = (v) => J(n(), s).unproject(v), w = (v, { terrain: T } = {}) => {
|
|
3060
|
+
const { screenToClip: p, clipToLocal: g, localToWorld: x } = J(
|
|
3048
3061
|
n(),
|
|
3049
3062
|
s
|
|
3050
3063
|
);
|
|
3051
3064
|
o.use();
|
|
3052
|
-
const [
|
|
3053
|
-
|
|
3054
|
-
const [R = 0,
|
|
3065
|
+
const [_] = T ? i() : [];
|
|
3066
|
+
u(_);
|
|
3067
|
+
const [R = 0, b = 0] = v, [S, P] = o.read([
|
|
3055
3068
|
R * devicePixelRatio,
|
|
3056
|
-
|
|
3057
|
-
]), [U = 0,
|
|
3069
|
+
b * devicePixelRatio
|
|
3070
|
+
]), [U = 0, M = 0] = p(v), N = se(x(g([U, M, S, 1]))), I = P === 0 ? void 0 : _ ?? Oe(i())[P - 1];
|
|
3058
3071
|
return { point: v, position: N, layer: I };
|
|
3059
|
-
},
|
|
3072
|
+
}, E = yi(e, {
|
|
3060
3073
|
view: n,
|
|
3061
3074
|
screen: () => s,
|
|
3062
3075
|
pick: w
|
|
3063
3076
|
});
|
|
3064
3077
|
return {
|
|
3065
3078
|
project: m,
|
|
3066
|
-
unproject:
|
|
3079
|
+
unproject: y,
|
|
3067
3080
|
pick: w,
|
|
3068
3081
|
dispose: () => {
|
|
3069
|
-
r = !1,
|
|
3082
|
+
r = !1, E.dispose(), o.dispose(), c instanceof HTMLCanvasElement && f.unobserve(c);
|
|
3070
3083
|
}
|
|
3071
3084
|
};
|
|
3072
3085
|
}, Oe = (e) => e.flatMap((t) => [...Oe(t.children ?? []), t]);
|
|
@@ -3078,8 +3091,8 @@ export {
|
|
|
3078
3091
|
Ri as createContainer,
|
|
3079
3092
|
wi as createContext,
|
|
3080
3093
|
Ai as createDynamicContainer,
|
|
3081
|
-
|
|
3082
|
-
|
|
3094
|
+
Mi as createEmptyLayer,
|
|
3095
|
+
Si as createLineLayer,
|
|
3083
3096
|
Ti as createMouseControl,
|
|
3084
3097
|
Ae as createMouseEvents,
|
|
3085
3098
|
vi as createNumberTransition,
|
|
@@ -3088,24 +3101,24 @@ export {
|
|
|
3088
3101
|
Pi as createPolygonLayer,
|
|
3089
3102
|
Oi as createPositionTransition,
|
|
3090
3103
|
Ci as createPositionVelocityTransition,
|
|
3091
|
-
|
|
3104
|
+
bi as createRenderLayer,
|
|
3092
3105
|
Ni as createTerrainLayer,
|
|
3093
3106
|
ae as createTransition,
|
|
3094
3107
|
pi as createVec2Transition,
|
|
3095
3108
|
Ii as createVec4Transition,
|
|
3096
3109
|
Xi as createViewTransition,
|
|
3097
3110
|
Wi as createWorld,
|
|
3098
|
-
|
|
3111
|
+
At as debounce,
|
|
3099
3112
|
Di as defaultLayerOptions,
|
|
3100
|
-
|
|
3101
|
-
|
|
3113
|
+
dt as defaultView,
|
|
3114
|
+
mn as degrees,
|
|
3102
3115
|
se as geodetic,
|
|
3103
3116
|
L as mercator,
|
|
3104
|
-
|
|
3117
|
+
vn as quadratic,
|
|
3105
3118
|
De as radians,
|
|
3106
3119
|
ie as range,
|
|
3107
|
-
|
|
3120
|
+
ht as tileToMercator,
|
|
3108
3121
|
pn as toOrientation,
|
|
3109
|
-
|
|
3122
|
+
Se as toQuaternion
|
|
3110
3123
|
};
|
|
3111
3124
|
//# sourceMappingURL=index.js.map
|