world.ts 0.4.2 → 0.4.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 +597 -596
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26,29 +26,29 @@ const Ut = (e, t) => {
|
|
|
26
26
|
if (c[w])
|
|
27
27
|
return c[w];
|
|
28
28
|
const g = e.getUniformLocation(i, w);
|
|
29
|
-
let
|
|
29
|
+
let b;
|
|
30
30
|
const S = (U) => {
|
|
31
|
-
g && U !==
|
|
31
|
+
g && U !== b && (R(g, U), b = U);
|
|
32
32
|
};
|
|
33
33
|
return c[w] = { set: S }, { set: S };
|
|
34
34
|
}, f = (w) => a(w, (R, g) => e.uniform1f(R, g)), l = (w) => a(w, (R, g) => e.uniform1i(R, g)), h = (w) => a(
|
|
35
35
|
w,
|
|
36
|
-
(R, [g = 0,
|
|
36
|
+
(R, [g = 0, b = 0]) => e.uniform2f(R, g, b)
|
|
37
37
|
), u = (w) => a(
|
|
38
38
|
w,
|
|
39
|
-
(R, [g = 0,
|
|
39
|
+
(R, [g = 0, b = 0]) => e.uniform2i(R, g, b)
|
|
40
40
|
), d = (w) => a(
|
|
41
41
|
w,
|
|
42
|
-
(R, [g = 0,
|
|
43
|
-
),
|
|
42
|
+
(R, [g = 0, b = 0, S = 0]) => e.uniform3f(R, g, b, S)
|
|
43
|
+
), m = (w) => a(
|
|
44
44
|
w,
|
|
45
|
-
(R, [g = 0,
|
|
45
|
+
(R, [g = 0, b = 0, S = 0]) => e.uniform3i(R, g, b, S)
|
|
46
46
|
), _ = (w) => a(
|
|
47
47
|
w,
|
|
48
|
-
(R, [g = 0,
|
|
49
|
-
),
|
|
48
|
+
(R, [g = 0, b = 0, S = 0, U = 0]) => e.uniform4f(R, g, b, S, U)
|
|
49
|
+
), x = (w) => a(
|
|
50
50
|
w,
|
|
51
|
-
(R, [g = 0,
|
|
51
|
+
(R, [g = 0, b = 0, S = 0, U = 0]) => e.uniform4i(R, g, b, S, U)
|
|
52
52
|
), p = (w) => a(
|
|
53
53
|
w,
|
|
54
54
|
(R, g) => e.uniformMatrix4fv(R, !1, g)
|
|
@@ -56,7 +56,7 @@ const Ut = (e, t) => {
|
|
|
56
56
|
name: w,
|
|
57
57
|
buffer: R,
|
|
58
58
|
size: g,
|
|
59
|
-
type:
|
|
59
|
+
type: b,
|
|
60
60
|
stride: S,
|
|
61
61
|
offset: U
|
|
62
62
|
}) => {
|
|
@@ -64,10 +64,10 @@ const Ut = (e, t) => {
|
|
|
64
64
|
if (P === -1)
|
|
65
65
|
throw new Error(`Missing attribute: ${w}`);
|
|
66
66
|
return { use: () => {
|
|
67
|
-
R.use(), e.enableVertexAttribArray(P), ["u16", "i32"].includes(
|
|
67
|
+
R.use(), e.enableVertexAttribArray(P), ["u16", "i32"].includes(b) ? e.vertexAttribIPointer(
|
|
68
68
|
P,
|
|
69
69
|
g,
|
|
70
|
-
|
|
70
|
+
b === "u16" ? e.UNSIGNED_SHORT : e.INT,
|
|
71
71
|
S || 0,
|
|
72
72
|
U || 0
|
|
73
73
|
) : e.vertexAttribPointer(
|
|
@@ -87,9 +87,9 @@ const Ut = (e, t) => {
|
|
|
87
87
|
uniform2f: h,
|
|
88
88
|
uniform2i: u,
|
|
89
89
|
uniform3f: d,
|
|
90
|
-
uniform3i:
|
|
90
|
+
uniform3i: m,
|
|
91
91
|
uniform4f: _,
|
|
92
|
-
uniform4i:
|
|
92
|
+
uniform4i: x,
|
|
93
93
|
uniformMatrix4f: p,
|
|
94
94
|
attribute1f: (w, R, g = {}) => A({ name: w, buffer: R, size: 1, type: "f32", ...g }),
|
|
95
95
|
attribute2f: (w, R, g = {}) => A({ name: w, buffer: R, size: 2, type: "f32", ...g }),
|
|
@@ -127,9 +127,9 @@ const Ut = (e, t) => {
|
|
|
127
127
|
const n = zt(t), { dispose: i } = n;
|
|
128
128
|
return { gl: t, programs: n, dispose: i };
|
|
129
129
|
};
|
|
130
|
-
var Lt = 1e-6,
|
|
130
|
+
var Lt = 1e-6, H = typeof Float32Array < "u" ? Float32Array : Array;
|
|
131
131
|
function Nt(e) {
|
|
132
|
-
|
|
132
|
+
H = e;
|
|
133
133
|
}
|
|
134
134
|
Math.hypot || (Math.hypot = function() {
|
|
135
135
|
for (var e = 0, t = arguments.length; t--; )
|
|
@@ -137,23 +137,23 @@ Math.hypot || (Math.hypot = function() {
|
|
|
137
137
|
return Math.sqrt(e);
|
|
138
138
|
});
|
|
139
139
|
function It() {
|
|
140
|
-
var e = new
|
|
141
|
-
return
|
|
140
|
+
var e = new H(9);
|
|
141
|
+
return H != 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;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
var e = new
|
|
145
|
-
return
|
|
143
|
+
function he() {
|
|
144
|
+
var e = new H(16);
|
|
145
|
+
return H != Float32Array && (e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0), e[0] = 1, e[5] = 1, e[10] = 1, e[15] = 1, e;
|
|
146
146
|
}
|
|
147
147
|
function ot(e) {
|
|
148
148
|
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;
|
|
149
149
|
}
|
|
150
150
|
function Dt(e, t) {
|
|
151
|
-
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],
|
|
152
|
-
return P ? (P = 1 / P, e[0] = (c * U - a * S + f *
|
|
151
|
+
var n = t[0], i = t[1], r = t[2], s = t[3], o = t[4], c = t[5], a = t[6], f = t[7], l = t[8], h = t[9], u = t[10], d = t[11], m = t[12], _ = t[13], x = t[14], p = t[15], A = n * c - i * o, y = n * a - r * o, E = n * f - s * o, v = i * a - r * c, T = i * f - s * c, M = r * f - s * a, w = l * _ - h * m, R = l * x - u * m, g = l * p - d * m, b = h * x - u * _, S = h * p - d * _, U = u * p - d * x, P = A * U - y * S + E * b + v * g - T * R + M * w;
|
|
152
|
+
return P ? (P = 1 / P, e[0] = (c * U - a * S + f * b) * P, e[1] = (r * S - i * U - s * b) * P, e[2] = (_ * M - x * T + p * v) * P, e[3] = (u * T - h * M - d * v) * P, e[4] = (a * g - o * U - f * R) * P, e[5] = (n * U - r * g + s * R) * P, e[6] = (x * E - m * M - p * y) * P, e[7] = (l * M - u * E + d * y) * P, e[8] = (o * S - c * g + f * w) * P, e[9] = (i * g - n * S - s * w) * P, e[10] = (m * T - _ * E + p * A) * P, e[11] = (h * E - l * T - d * A) * P, e[12] = (c * R - o * b - a * w) * P, e[13] = (n * b - i * R + r * w) * P, e[14] = (_ * y - m * v - x * A) * P, e[15] = (l * v - h * y + u * A) * P, e) : null;
|
|
153
153
|
}
|
|
154
154
|
function Ot(e, t, n) {
|
|
155
|
-
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],
|
|
156
|
-
return e[0] = y * i +
|
|
155
|
+
var i = t[0], r = t[1], s = t[2], o = t[3], c = t[4], a = t[5], f = t[6], l = t[7], h = t[8], u = t[9], d = t[10], m = t[11], _ = t[12], x = t[13], p = t[14], A = t[15], y = n[0], E = n[1], v = n[2], T = n[3];
|
|
156
|
+
return e[0] = y * i + E * c + v * h + T * _, e[1] = y * r + E * a + v * u + T * x, e[2] = y * s + E * f + v * d + T * p, e[3] = y * o + E * l + v * m + T * A, y = n[4], E = n[5], v = n[6], T = n[7], e[4] = y * i + E * c + v * h + T * _, e[5] = y * r + E * a + v * u + T * x, e[6] = y * s + E * f + v * d + T * p, e[7] = y * o + E * l + v * m + T * A, y = n[8], E = n[9], v = n[10], T = n[11], e[8] = y * i + E * c + v * h + T * _, e[9] = y * r + E * a + v * u + T * x, e[10] = y * s + E * f + v * d + T * p, e[11] = y * o + E * l + v * m + T * A, y = n[12], E = n[13], v = n[14], T = n[15], e[12] = y * i + E * c + v * h + T * _, e[13] = y * r + E * a + v * u + T * x, e[14] = y * s + E * f + v * d + T * p, e[15] = y * o + E * l + v * m + T * A, e;
|
|
157
157
|
}
|
|
158
158
|
function Ct(e, t, n) {
|
|
159
159
|
var i = n[0], r = n[1], s = n[2];
|
|
@@ -172,8 +172,8 @@ function jt(e, t, n) {
|
|
|
172
172
|
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;
|
|
173
173
|
}
|
|
174
174
|
function mt(e, t) {
|
|
175
|
-
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,
|
|
176
|
-
return e[0] = 1 - h -
|
|
175
|
+
var n = t[0], i = t[1], r = t[2], s = t[3], o = n + n, c = i + i, a = r + r, f = n * o, l = i * o, h = i * c, u = r * o, d = r * c, m = r * a, _ = s * o, x = s * c, p = s * a;
|
|
176
|
+
return e[0] = 1 - h - m, e[1] = l + p, e[2] = u - x, e[3] = 0, e[4] = l - p, e[5] = 1 - f - m, e[6] = d + _, e[7] = 0, e[8] = u + x, e[9] = d - _, e[10] = 1 - f - h, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;
|
|
177
177
|
}
|
|
178
178
|
function Bt(e, t, n, i, r) {
|
|
179
179
|
var s = 1 / Math.tan(t / 2), o;
|
|
@@ -181,21 +181,21 @@ function Bt(e, t, n, i, r) {
|
|
|
181
181
|
}
|
|
182
182
|
var Vt = Bt;
|
|
183
183
|
function L() {
|
|
184
|
-
var e = new
|
|
185
|
-
return
|
|
184
|
+
var e = new H(3);
|
|
185
|
+
return H != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e;
|
|
186
186
|
}
|
|
187
187
|
function Zt(e) {
|
|
188
188
|
var t = e[0], n = e[1], i = e[2];
|
|
189
189
|
return Math.hypot(t, n, i);
|
|
190
190
|
}
|
|
191
191
|
function at(e, t, n) {
|
|
192
|
-
var i = new
|
|
192
|
+
var i = new H(3);
|
|
193
193
|
return i[0] = e, i[1] = t, i[2] = n, i;
|
|
194
194
|
}
|
|
195
195
|
function Yt(e, t) {
|
|
196
196
|
return e[0] = t[0], e[1] = t[1], e[2] = t[2], e;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function Se(e, t, n, i) {
|
|
199
199
|
return e[0] = t, e[1] = n, e[2] = i, e;
|
|
200
200
|
}
|
|
201
201
|
function re(e, t, n) {
|
|
@@ -204,10 +204,10 @@ function re(e, t, n) {
|
|
|
204
204
|
function $t(e, t, n) {
|
|
205
205
|
return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function de(e, t, n) {
|
|
208
208
|
return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function Ue(e, t) {
|
|
211
211
|
var n = t[0] - e[0], i = t[1] - e[1], r = t[2] - e[2];
|
|
212
212
|
return Math.hypot(n, i, r);
|
|
213
213
|
}
|
|
@@ -218,7 +218,7 @@ function kt(e, t) {
|
|
|
218
218
|
function Ht(e, t) {
|
|
219
219
|
return e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function He(e, t, n) {
|
|
222
222
|
var i = t[0], r = t[1], s = t[2], o = n[0], c = n[1], a = n[2];
|
|
223
223
|
return e[0] = r * a - s * c, e[1] = s * o - i * a, e[2] = i * c - r * o, e;
|
|
224
224
|
}
|
|
@@ -237,8 +237,8 @@ var se = $t, Ft = Zt;
|
|
|
237
237
|
};
|
|
238
238
|
})();
|
|
239
239
|
function ne() {
|
|
240
|
-
var e = new
|
|
241
|
-
return
|
|
240
|
+
var e = new H(4);
|
|
241
|
+
return H != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0), e;
|
|
242
242
|
}
|
|
243
243
|
function Qt(e, t) {
|
|
244
244
|
return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e;
|
|
@@ -280,9 +280,9 @@ var rn = qt;
|
|
|
280
280
|
return t;
|
|
281
281
|
};
|
|
282
282
|
})();
|
|
283
|
-
function
|
|
284
|
-
var e = new
|
|
285
|
-
return
|
|
283
|
+
function Ke() {
|
|
284
|
+
var e = new H(4);
|
|
285
|
+
return H != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e[3] = 1, e;
|
|
286
286
|
}
|
|
287
287
|
function sn(e, t, n) {
|
|
288
288
|
n = n * 0.5;
|
|
@@ -293,9 +293,9 @@ function on(e, t) {
|
|
|
293
293
|
var n = cn(e, t);
|
|
294
294
|
return Math.acos(2 * n * n - 1);
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
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,
|
|
298
|
-
return d = r * a + s * f + o * l + c * h, d < 0 && (d = -d, a = -a, f = -f, l = -l, h = -h), 1 - d > Lt ? (u = Math.acos(d),
|
|
296
|
+
function Ce(e, t, n, i) {
|
|
297
|
+
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, _, x;
|
|
298
|
+
return d = r * a + s * f + o * l + c * h, d < 0 && (d = -d, a = -a, f = -f, l = -l, h = -h), 1 - d > Lt ? (u = Math.acos(d), m = Math.sin(u), _ = Math.sin((1 - i) * u) / m, x = Math.sin(i * u) / m) : (_ = 1 - i, x = i), e[0] = _ * r + x * a, e[1] = _ * s + x * f, e[2] = _ * o + x * l, e[3] = _ * c + x * h, e;
|
|
299
299
|
}
|
|
300
300
|
function an(e, t) {
|
|
301
301
|
var n = t[0] + t[4] + t[8], i;
|
|
@@ -314,13 +314,13 @@ var cn = nn, vt = tn;
|
|
|
314
314
|
var e = L(), t = at(1, 0, 0), n = at(0, 1, 0);
|
|
315
315
|
return function(i, r, s) {
|
|
316
316
|
var o = Ht(r, s);
|
|
317
|
-
return o < -0.999999 ? (
|
|
317
|
+
return o < -0.999999 ? (He(e, t, r), Ft(e) < 1e-6 && He(e, n, r), kt(e, e), sn(i, e, Math.PI), i) : o > 0.999999 ? (i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 1, i) : (He(e, r, s), i[0] = e[0], i[1] = e[1], i[2] = e[2], i[3] = 1 + o, vt(i, i));
|
|
318
318
|
};
|
|
319
319
|
})();
|
|
320
320
|
(function() {
|
|
321
|
-
var e =
|
|
321
|
+
var e = Ke(), t = Ke();
|
|
322
322
|
return function(n, i, r, s, o, c) {
|
|
323
|
-
return
|
|
323
|
+
return Ce(e, i, o, c), Ce(t, r, s, c), Ce(n, e, t, 2 * c * (1 - c)), n;
|
|
324
324
|
};
|
|
325
325
|
})();
|
|
326
326
|
(function() {
|
|
@@ -330,8 +330,8 @@ var cn = nn, vt = tn;
|
|
|
330
330
|
};
|
|
331
331
|
})();
|
|
332
332
|
function pe() {
|
|
333
|
-
var e = new
|
|
334
|
-
return
|
|
333
|
+
var e = new H(2);
|
|
334
|
+
return H != Float32Array && (e[0] = 0, e[1] = 0), e;
|
|
335
335
|
}
|
|
336
336
|
function fn(e, t) {
|
|
337
337
|
return e[0] = t[0], e[1] = t[1], e;
|
|
@@ -366,23 +366,23 @@ var pn = hn;
|
|
|
366
366
|
return t;
|
|
367
367
|
};
|
|
368
368
|
})();
|
|
369
|
-
const
|
|
369
|
+
const F = 40075017, Xe = (e) => e / 180 * Math.PI, xn = (e) => e * 180 / Math.PI, En = (e, t, n) => {
|
|
370
370
|
const i = Math.sqrt(t * t - 4 * e * n);
|
|
371
371
|
return [(-t - i) / (2 * e), (-t + i) / (2 * e)];
|
|
372
|
-
}, _n = (e, t, n) => Math.min(Math.max(e, t), n), lt = Math.atan(Math.sinh(Math.PI)), z = ([e = 0, t = 0, n = 0], i = L()) =>
|
|
372
|
+
}, _n = (e, t, n) => Math.min(Math.max(e, t), n), lt = Math.atan(Math.sinh(Math.PI)), z = ([e = 0, t = 0, n = 0], i = L()) => Se(
|
|
373
373
|
i,
|
|
374
374
|
e / 360 + 0.5,
|
|
375
|
-
-Math.asinh(Math.tan(_n(
|
|
376
|
-
n /
|
|
377
|
-
), oe = ([e = 0, t = 0, n = 0], i = L()) =>
|
|
375
|
+
-Math.asinh(Math.tan(_n(Xe(t), -lt, lt))) / (2 * Math.PI) + 0.5,
|
|
376
|
+
n / F
|
|
377
|
+
), oe = ([e = 0, t = 0, n = 0], i = L()) => Se(
|
|
378
378
|
i,
|
|
379
379
|
(e - 0.5) * 360,
|
|
380
380
|
xn(Math.atan(Math.sinh(-(t - 0.5) * (2 * Math.PI)))),
|
|
381
|
-
n *
|
|
381
|
+
n * F
|
|
382
382
|
), pt = ([e = 0, t = 0, n = 0], i = L()) => {
|
|
383
383
|
const r = 2 ** -n;
|
|
384
|
-
return
|
|
385
|
-
},
|
|
384
|
+
return Se(i, e * r, t * r, 0);
|
|
385
|
+
}, Le = ([e = 0, t = 0, n = 0]) => {
|
|
386
386
|
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;
|
|
387
387
|
return [l, h, u, f];
|
|
388
388
|
}, yn = ([e = 0, t = 0, n = 0, i = 0]) => {
|
|
@@ -391,61 +391,61 @@ const K = 40075017, Oe = (e) => e / 180 * Math.PI, xn = (e) => e * 180 / Math.PI
|
|
|
391
391
|
}, xt = {
|
|
392
392
|
target: [0, 0, 0],
|
|
393
393
|
offset: [0, 0],
|
|
394
|
-
distance:
|
|
394
|
+
distance: F,
|
|
395
395
|
orientation: [0, 0, 0],
|
|
396
396
|
fieldOfView: 45
|
|
397
|
-
},
|
|
397
|
+
}, te = (e, t) => {
|
|
398
398
|
const { target: n, offset: i, distance: r, orientation: s, fieldOfView: o } = {
|
|
399
399
|
...xt,
|
|
400
400
|
...e
|
|
401
|
-
}, [c = 0, a = 0] = t, [f = 0, l = 0] = i, [h = 0, u = 0, d = 0] = s,
|
|
402
|
-
ot(
|
|
403
|
-
const
|
|
404
|
-
ot(
|
|
405
|
-
const
|
|
406
|
-
if (!
|
|
401
|
+
}, [c = 0, a = 0] = t, [f = 0, l = 0] = i, [h = 0, u = 0, d = 0] = s, m = Math.tan(Xe(45) / 2) / Math.tan(Xe(o) / 2), _ = r / F, x = Math.max(1e3 / F, _), p = 1e3, A = 1e-3, y = x * p * m, E = x * A * m, v = ne(), T = he();
|
|
402
|
+
ot(T), Vt(T, Xe(o), c / a, E, y), Ct(T, T, [1, -1, 1]);
|
|
403
|
+
const M = he();
|
|
404
|
+
ot(M), Xt(M, M, h), Wt(M, M, u), jt(M, M, d);
|
|
405
|
+
const w = Ot(he(), T, M), R = Dt(he(), w);
|
|
406
|
+
if (!R)
|
|
407
407
|
throw new Error("No inverse");
|
|
408
|
-
const
|
|
409
|
-
const
|
|
410
|
-
return te({ ...e, offset:
|
|
411
|
-
},
|
|
412
|
-
const
|
|
413
|
-
return ct(
|
|
414
|
-
},
|
|
415
|
-
const [
|
|
416
|
-
return
|
|
417
|
-
},
|
|
418
|
-
(
|
|
419
|
-
2 * (
|
|
420
|
-
|
|
408
|
+
const g = (C) => {
|
|
409
|
+
const Z = [c * C, a * C], k = [f * C, l * C];
|
|
410
|
+
return te({ ...e, offset: k }, Z);
|
|
411
|
+
}, b = ([C = 0, Z = 0], k = ne()) => {
|
|
412
|
+
const K = 2 * C / c - 1, ge = -(2 * Z / a - 1);
|
|
413
|
+
return ct(k, K, ge, 0, 1);
|
|
414
|
+
}, S = ([C = 0, Z = 0, , k = 0], K = pe()) => k < 0 ? K : ln(K, (1 + C / k) * c * 0.5, (1 - Z / k) * a * 0.5), U = (C, Z = L()) => {
|
|
415
|
+
const [k = 0, K = 0, ge = 0, Re = 0] = ft(v, C, R);
|
|
416
|
+
return Se(Z, k / Re, K / Re, ge / Re);
|
|
417
|
+
}, P = ([C = 0, Z = 0, k = 0], K = ne()) => ft(K, ct(K, C, Z, k, 1), w), [D = 0, O = 0] = b([f + c / 2, l + a / 2]), [X = 0, I = 0, W = 0] = U([D, O, -1, 1]), [j = 0, Y = 0, J = 0] = U([D, O, 1.00001, 1]), [$ = 0] = En(
|
|
418
|
+
(j - X) ** 2 + (Y - I) ** 2 + (J - W) ** 2,
|
|
419
|
+
2 * (X * (j - X) + I * (Y - I) + W * (J - W)),
|
|
420
|
+
X ** 2 + I ** 2 + W ** 2 - (_ * m) ** 2
|
|
421
421
|
);
|
|
422
|
-
if (isNaN(
|
|
422
|
+
if (isNaN($))
|
|
423
423
|
throw new Error("Unexpected");
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
I +
|
|
427
|
-
|
|
428
|
-
],
|
|
424
|
+
const Q = [
|
|
425
|
+
X + $ * (j - X),
|
|
426
|
+
I + $ * (Y - I),
|
|
427
|
+
W + $ * (J - W)
|
|
428
|
+
], Te = se(L(), z(n), Q), we = (C, Z = L()) => re(Z, C, Te), ze = (C, Z = L()) => se(Z, C, Te);
|
|
429
429
|
return {
|
|
430
|
-
camera:
|
|
430
|
+
camera: Te,
|
|
431
431
|
screen: t,
|
|
432
|
-
projection:
|
|
433
|
-
modelView:
|
|
434
|
-
fieldScale:
|
|
435
|
-
scale:
|
|
436
|
-
screenToClip:
|
|
437
|
-
clipToScreen:
|
|
438
|
-
clipToLocal:
|
|
439
|
-
localToClip:
|
|
440
|
-
localToWorld:
|
|
441
|
-
worldToLocal:
|
|
442
|
-
project: (
|
|
443
|
-
unproject: (
|
|
444
|
-
const
|
|
432
|
+
projection: T,
|
|
433
|
+
modelView: M,
|
|
434
|
+
fieldScale: m,
|
|
435
|
+
scale: g,
|
|
436
|
+
screenToClip: b,
|
|
437
|
+
clipToScreen: S,
|
|
438
|
+
clipToLocal: U,
|
|
439
|
+
localToClip: P,
|
|
440
|
+
localToWorld: we,
|
|
441
|
+
worldToLocal: ze,
|
|
442
|
+
project: (C) => S(P(ze(z(C)))),
|
|
443
|
+
unproject: (C, { targetZ: Z = 0 } = {}) => {
|
|
444
|
+
const k = b(C), [K = 0, ge = 0, , Re = 0] = k, bt = [K, ge, -1, Re], nt = oe(we(U(k))), it = oe(we(U(bt))), [, , ke = 0] = nt, [, , rt = 0] = it, St = ke === rt ? 0 : (Z - ke) / (rt - ke);
|
|
445
445
|
return Gt(L(), nt, it, St);
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
|
-
},
|
|
448
|
+
}, Tn = 100, Si = (e, t, n) => {
|
|
449
449
|
const {
|
|
450
450
|
enabled: i = () => !0,
|
|
451
451
|
draggable: r = () => !0,
|
|
@@ -453,72 +453,72 @@ const K = 40075017, Oe = (e) => e / 180 * Math.PI, xn = (e) => e * 180 / Math.PI
|
|
|
453
453
|
onChangeView: o
|
|
454
454
|
} = n;
|
|
455
455
|
let c = !1, a = !1;
|
|
456
|
-
const { view: f } = n, l = ([
|
|
457
|
-
const [
|
|
456
|
+
const { view: f } = n, l = ([v = 0, T = 0]) => {
|
|
457
|
+
const [M, w] = [
|
|
458
458
|
e.width / devicePixelRatio,
|
|
459
459
|
e.height / devicePixelRatio
|
|
460
|
-
], { camera: R, fieldScale: g } = te(f(), [
|
|
460
|
+
], { camera: R, fieldScale: g } = te(f(), [M, w]), { position: b, layer: S } = t.pick([v, T]);
|
|
461
461
|
if (!S)
|
|
462
462
|
return;
|
|
463
|
-
const U =
|
|
463
|
+
const U = Ue(z(b), R) * F / g, P = [v - M / 2, T - w / 2];
|
|
464
464
|
o({
|
|
465
465
|
offset: P,
|
|
466
|
-
target:
|
|
466
|
+
target: b,
|
|
467
467
|
distance: U
|
|
468
468
|
});
|
|
469
|
-
}, h = (
|
|
469
|
+
}, h = (v, T) => {
|
|
470
470
|
if (!r())
|
|
471
471
|
return;
|
|
472
|
-
a || (l([
|
|
473
|
-
const [
|
|
472
|
+
a || (l([v, T]), a = !0);
|
|
473
|
+
const [M, w] = [
|
|
474
474
|
e.width / devicePixelRatio,
|
|
475
475
|
e.height / devicePixelRatio
|
|
476
476
|
];
|
|
477
477
|
o({
|
|
478
|
-
offset: [
|
|
478
|
+
offset: [v - M / 2, T - w / 2]
|
|
479
479
|
});
|
|
480
|
-
}, u = (
|
|
480
|
+
}, u = (v, T, M, w) => {
|
|
481
481
|
if (!s())
|
|
482
482
|
return;
|
|
483
|
-
r() && !a && (l([
|
|
483
|
+
r() && !a && (l([v, T]), a = !0);
|
|
484
484
|
const [R, g] = [
|
|
485
485
|
e.width / devicePixelRatio,
|
|
486
486
|
e.height / devicePixelRatio
|
|
487
|
-
], { orientation: [
|
|
487
|
+
], { orientation: [b = 0, S = 0, U = 0] = [] } = f(), P = [
|
|
488
488
|
Math.min(
|
|
489
489
|
Math.PI / 2 - 0.1,
|
|
490
|
-
Math.max(0.1,
|
|
490
|
+
Math.max(0.1, b - w / g * Math.PI)
|
|
491
491
|
),
|
|
492
492
|
S,
|
|
493
|
-
U -
|
|
493
|
+
U - M / R * Math.PI
|
|
494
494
|
];
|
|
495
495
|
o({
|
|
496
496
|
orientation: P
|
|
497
497
|
});
|
|
498
|
-
}, d = (
|
|
499
|
-
|
|
500
|
-
},
|
|
501
|
-
!i() || !
|
|
502
|
-
}, _ = (
|
|
503
|
-
|
|
504
|
-
const T =
|
|
498
|
+
}, d = (v) => {
|
|
499
|
+
v.preventDefault(), a = !1;
|
|
500
|
+
}, m = ({ buttons: v, movementX: T, movementY: M, x: w, y: R }) => {
|
|
501
|
+
!i() || !v || (v === 1 && r() ? h(w, R) : v === 2 && s() && u(w, R, T, M));
|
|
502
|
+
}, _ = (v) => {
|
|
503
|
+
v.preventDefault();
|
|
504
|
+
const T = v.touches.item(0);
|
|
505
505
|
if (!T)
|
|
506
506
|
return;
|
|
507
|
-
const { clientX:
|
|
508
|
-
h(
|
|
509
|
-
},
|
|
507
|
+
const { clientX: M, clientY: w } = T;
|
|
508
|
+
h(M, w);
|
|
509
|
+
}, x = Ut(() => c = !1, 100), p = ({ x: v, y: T, deltaY: M }) => {
|
|
510
510
|
if (!i())
|
|
511
511
|
return;
|
|
512
|
-
c || (r() && l([
|
|
512
|
+
c || (r() && l([v, T]), c = !0);
|
|
513
513
|
let { distance: w } = { ...xt, ...f() };
|
|
514
514
|
w = Math.min(
|
|
515
|
-
Math.max(w * Math.exp(
|
|
516
|
-
|
|
517
|
-
), o({ distance: w }),
|
|
518
|
-
}, A = (
|
|
519
|
-
return e.addEventListener("mousedown", d), e.addEventListener("mousemove",
|
|
515
|
+
Math.max(w * Math.exp(M * 1e-3), Tn),
|
|
516
|
+
F
|
|
517
|
+
), o({ distance: w }), x();
|
|
518
|
+
}, A = (v) => v.preventDefault(), y = (v) => v.preventDefault();
|
|
519
|
+
return e.addEventListener("mousedown", d), e.addEventListener("mousemove", m), e.addEventListener("touchstart", d, { passive: !1 }), e.addEventListener("touchmove", _, { passive: !1 }), e.addEventListener("gesturestart", A), e.addEventListener("wheel", p, { passive: !0 }), e.addEventListener("contextmenu", y), {
|
|
520
520
|
dispose: () => {
|
|
521
|
-
e.removeEventListener("mousedown", d), e.removeEventListener("mousemove",
|
|
521
|
+
e.removeEventListener("mousedown", d), e.removeEventListener("mousemove", m), e.removeEventListener("touchstart", d), e.removeEventListener("touchmove", _), e.removeEventListener("gesturestart", A), e.removeEventListener("wheel", p), e.removeEventListener("contextmenu", y);
|
|
522
522
|
}
|
|
523
523
|
};
|
|
524
524
|
}, V = ({
|
|
@@ -541,7 +541,7 @@ const K = 40075017, Oe = (e) => e / 180 * Math.PI, xn = (e) => e * 180 / Math.PI
|
|
|
541
541
|
use: s,
|
|
542
542
|
dispose: () => e.deleteBuffer(i)
|
|
543
543
|
};
|
|
544
|
-
},
|
|
544
|
+
}, Ge = 2 ** 30, q = ([e = 0, t = 0, n = 0]) => [Math.floor(e * Ge), Math.floor(t * Ge), Math.floor(n * Ge)], Ee = (e, t, n) => {
|
|
545
545
|
const { pickable: i, depth: r, polygonOffset: s } = {
|
|
546
546
|
pickable: () => !0,
|
|
547
547
|
depth: () => !0,
|
|
@@ -582,7 +582,7 @@ void main(void) {
|
|
|
582
582
|
result = vec4(pack_depth(gl_FragCoord.z), pack_index(index));
|
|
583
583
|
}`;
|
|
584
584
|
const Et = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2FkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGFzeW5jIG49Pntjb25zdFtpLHRdPW4uZGF0YTtpZihpIT09ImxvYWQiKXJldHVybjtjb25zdCBvPW5ldyBBYm9ydENvbnRyb2xsZXIse3NpZ25hbDpjfT1vLHI9ZT0+e2NvbnN0W3MsYV09ZS5kYXRhO3M9PT0iY2FuY2VsIiYmYT09PXQmJm8uYWJvcnQoKX07YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIscik7dHJ5e2NvbnN0IGU9YXdhaXQgZmV0Y2godCx7bW9kZToiY29ycyIsc2lnbmFsOmN9KTtpZighZS5vayl7cG9zdE1lc3NhZ2Uoe3VybDp0LGltYWdlOnZvaWQgMH0pO3JldHVybn1jb25zdCBzPWF3YWl0IGUuYmxvYigpLGE9YXdhaXQgY3JlYXRlSW1hZ2VCaXRtYXAocyk7cG9zdE1lc3NhZ2Uoe3VybDp0LGltYWdlOmF9KX1jYXRjaChlKXtpZighKGUgaW5zdGFuY2VvZiBFcnJvcikpdGhyb3cgZTtpZihlLm1lc3NhZ2U9PT0iVGhlIHVzZXIgYWJvcnRlZCBhIHJlcXVlc3QuInx8ZS5tZXNzYWdlLnN0YXJ0c1dpdGgoInNpZ25hbCBpcyBhYm9ydGVkIHdpdGhvdXQgcmVhc29uIikpcmV0dXJuO2lmKGUubWVzc2FnZT09PSJGYWlsZWQgdG8gZmV0Y2giKXtwb3N0TWVzc2FnZSh7dXJsOnQsaW1hZ2U6dm9pZCAwfSk7cmV0dXJufXRocm93IGV9ZmluYWxseXtyZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixyKX19KX0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPWltYWdlLWxvYWQtd29ya2VyLWR6cmprQ3RLLmpzLm1hcAo=", ut = typeof window < "u" && window.Blob && new Blob([atob(Et)], { type: "text/javascript;charset=utf-8" });
|
|
585
|
-
function
|
|
585
|
+
function wn(e) {
|
|
586
586
|
let t;
|
|
587
587
|
try {
|
|
588
588
|
if (t = ut && (window.URL || window.webkitURL).createObjectURL(ut), !t)
|
|
@@ -604,20 +604,20 @@ function Rn(e) {
|
|
|
604
604
|
t && (window.URL || window.webkitURL).revokeObjectURL(t);
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
|
-
const
|
|
607
|
+
const Ne = wn(), gn = ({
|
|
608
608
|
url: e,
|
|
609
609
|
onLoad: t
|
|
610
610
|
}) => {
|
|
611
611
|
let n = !1;
|
|
612
612
|
const i = ({ data: o }) => {
|
|
613
|
-
r || e !== o.url || (
|
|
613
|
+
r || e !== o.url || (Ne.removeEventListener("message", i), o.image && (n = !0, t(o.image)));
|
|
614
614
|
};
|
|
615
|
-
|
|
615
|
+
Ne.addEventListener("message", i);
|
|
616
616
|
let r = !1;
|
|
617
617
|
const s = () => {
|
|
618
|
-
n || (r = !0,
|
|
618
|
+
n || (r = !0, Ne.postMessage(["cancel", e]));
|
|
619
619
|
};
|
|
620
|
-
return
|
|
620
|
+
return Ne.postMessage(["load", e]), {
|
|
621
621
|
get loaded() {
|
|
622
622
|
return n;
|
|
623
623
|
},
|
|
@@ -642,7 +642,7 @@ const ze = Rn(), An = ({
|
|
|
642
642
|
url: t,
|
|
643
643
|
onLoad: n
|
|
644
644
|
}) => {
|
|
645
|
-
const i = _t(e), r =
|
|
645
|
+
const i = _t(e), r = gn({
|
|
646
646
|
url: t,
|
|
647
647
|
onLoad: (a) => {
|
|
648
648
|
a && (i.use(), e.texImage2D(
|
|
@@ -666,7 +666,7 @@ const ze = Rn(), An = ({
|
|
|
666
666
|
}
|
|
667
667
|
};
|
|
668
668
|
};
|
|
669
|
-
var
|
|
669
|
+
var Rn = `#version 300 es
|
|
670
670
|
|
|
671
671
|
precision highp float;
|
|
672
672
|
|
|
@@ -678,7 +678,7 @@ out vec4 result;
|
|
|
678
678
|
void main() {
|
|
679
679
|
result = texture(image, uv_out) * color_out;
|
|
680
680
|
if (result.a == 0.f) discard;
|
|
681
|
-
}`,
|
|
681
|
+
}`, An = `#version 300 es
|
|
682
682
|
|
|
683
683
|
precision highp float;
|
|
684
684
|
|
|
@@ -739,38 +739,38 @@ const Ui = (e, t = {}) => {
|
|
|
739
739
|
);
|
|
740
740
|
const a = ce(
|
|
741
741
|
() => t.url?.() ?? "",
|
|
742
|
-
(
|
|
742
|
+
(m) => {
|
|
743
743
|
const _ = yt({
|
|
744
744
|
gl: n,
|
|
745
|
-
url:
|
|
746
|
-
onLoad: ({ width:
|
|
747
|
-
r = [
|
|
745
|
+
url: m,
|
|
746
|
+
onLoad: ({ width: x, height: p }) => {
|
|
747
|
+
r = [x, p], 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 = _;
|
|
748
748
|
}
|
|
749
749
|
});
|
|
750
750
|
}
|
|
751
|
-
), { renderProgram: f, depthProgram: l } =
|
|
751
|
+
), { renderProgram: f, depthProgram: l } = Mn(e, {
|
|
752
752
|
cornerBuffer: s,
|
|
753
753
|
uvBuffer: o,
|
|
754
754
|
indexBuffer: c
|
|
755
755
|
}), h = ({
|
|
756
|
-
viewport: { projection:
|
|
756
|
+
viewport: { projection: m, modelView: _, camera: x, screen: p },
|
|
757
757
|
depth: A = !1,
|
|
758
758
|
index: y = 0
|
|
759
759
|
}) => {
|
|
760
|
-
const
|
|
760
|
+
const E = t.position?.() ?? [0, 0, 0], v = t.color?.() ?? [1, 1, 1, 1], T = t.size?.() ?? 100, M = t.minSizePixels?.() ?? 0, w = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
761
761
|
if (a(), !i || Ee(n, A, t))
|
|
762
762
|
return;
|
|
763
763
|
(A ? l : f).execute({
|
|
764
|
-
projection:
|
|
764
|
+
projection: m,
|
|
765
765
|
modelView: _,
|
|
766
|
-
camera: q(
|
|
766
|
+
camera: q(x),
|
|
767
767
|
screen: p,
|
|
768
768
|
image: i,
|
|
769
769
|
imageSize: r,
|
|
770
|
-
position: q(z(
|
|
771
|
-
color:
|
|
770
|
+
position: q(z(E)),
|
|
771
|
+
color: v,
|
|
772
772
|
size: T,
|
|
773
|
-
minSizePixels:
|
|
773
|
+
minSizePixels: M,
|
|
774
774
|
maxSizePixels: w,
|
|
775
775
|
index: y
|
|
776
776
|
});
|
|
@@ -782,35 +782,35 @@ const Ui = (e, t = {}) => {
|
|
|
782
782
|
dispose: u,
|
|
783
783
|
...d
|
|
784
784
|
};
|
|
785
|
-
},
|
|
785
|
+
}, Mn = ({ gl: e, programs: t }, {
|
|
786
786
|
cornerBuffer: n,
|
|
787
787
|
uvBuffer: i,
|
|
788
788
|
indexBuffer: r
|
|
789
789
|
}) => {
|
|
790
790
|
const s = (a = !1) => {
|
|
791
791
|
const f = t.get({
|
|
792
|
-
vertexSource:
|
|
793
|
-
fragmentSource: a ? _e :
|
|
792
|
+
vertexSource: An,
|
|
793
|
+
fragmentSource: a ? _e : Rn
|
|
794
794
|
}), l = f.attribute2f("corner", n, {
|
|
795
795
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
796
796
|
}), h = f.attribute2f("uv", i, {
|
|
797
797
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
798
|
-
}), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"),
|
|
798
|
+
}), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), _ = f.uniform2f("screen"), x = f.uniform1i("image"), p = f.uniform2f("image_size"), A = f.uniform3i("position"), y = f.uniform4f("color"), E = f.uniform1i("index"), v = f.uniform1f("size"), T = f.uniform1f("min_size_pixels"), M = f.uniform1f("max_size_pixels");
|
|
799
799
|
return { execute: ({
|
|
800
800
|
projection: R,
|
|
801
801
|
modelView: g,
|
|
802
|
-
camera:
|
|
802
|
+
camera: b,
|
|
803
803
|
screen: S,
|
|
804
804
|
image: U,
|
|
805
805
|
imageSize: P,
|
|
806
|
-
position:
|
|
807
|
-
color:
|
|
808
|
-
size:
|
|
809
|
-
minSizePixels:
|
|
806
|
+
position: D,
|
|
807
|
+
color: O,
|
|
808
|
+
size: X,
|
|
809
|
+
minSizePixels: I,
|
|
810
810
|
maxSizePixels: W,
|
|
811
811
|
index: j
|
|
812
812
|
}) => {
|
|
813
|
-
f.use(), l.use(), h.use(), u.set(R), d.set(g),
|
|
813
|
+
f.use(), l.use(), h.use(), u.set(R), d.set(g), m.set(b), _.set(S), p.set(P), A.set(D), y.set(O), v.set(X), T.set(I), M.set(W), E.set(j), e.activeTexture(e.TEXTURE0), x.set(0), U.use(), r.use(), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0);
|
|
814
814
|
} };
|
|
815
815
|
}, o = s(), c = s(!0);
|
|
816
816
|
return { renderProgram: o, depthProgram: c };
|
|
@@ -839,7 +839,7 @@ const Ui = (e, t = {}) => {
|
|
|
839
839
|
}
|
|
840
840
|
}), Ni = () => ({ dispose: () => {
|
|
841
841
|
} });
|
|
842
|
-
var
|
|
842
|
+
var bn = `#version 300 es
|
|
843
843
|
|
|
844
844
|
precision highp float;
|
|
845
845
|
|
|
@@ -856,7 +856,7 @@ void main() {
|
|
|
856
856
|
result = color_out * texture(
|
|
857
857
|
dash,
|
|
858
858
|
vec2(fract((distance_out / dash_size) - dash_offset), 0.0));;
|
|
859
|
-
}`,
|
|
859
|
+
}`, Sn = `#version 300 es
|
|
860
860
|
|
|
861
861
|
precision highp float;
|
|
862
862
|
|
|
@@ -926,7 +926,7 @@ void main(void) {
|
|
|
926
926
|
const Ii = (e, t = {}) => {
|
|
927
927
|
const { gl: n } = e;
|
|
928
928
|
let i = 0;
|
|
929
|
-
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 } =
|
|
929
|
+
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 } = Un(e, {
|
|
930
930
|
positionBuffer: r,
|
|
931
931
|
indexBuffer: s,
|
|
932
932
|
cornerBuffer: o,
|
|
@@ -934,56 +934,56 @@ const Ii = (e, t = {}) => {
|
|
|
934
934
|
}), l = _t(n);
|
|
935
935
|
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);
|
|
936
936
|
const h = ({
|
|
937
|
-
viewport: { projection:
|
|
938
|
-
depth:
|
|
939
|
-
index:
|
|
937
|
+
viewport: { projection: x, modelView: p, camera: A, screen: y },
|
|
938
|
+
depth: E = !1,
|
|
939
|
+
index: v = 0
|
|
940
940
|
}) => {
|
|
941
941
|
u(), d();
|
|
942
|
-
const T = t.color?.() ?? [1, 1, 1, 1],
|
|
943
|
-
if (Ee(n,
|
|
942
|
+
const T = t.color?.() ?? [1, 1, 1, 1], M = t.width?.() ?? 1, w = t.minWidthPixels?.() ?? 0, R = t.maxWidthPixels?.() ?? Number.MAX_VALUE, g = t.depthWidthPixels?.(), b = t.dashSize?.() ?? 1e3, S = t.dashOffset?.() ?? 0;
|
|
943
|
+
if (Ee(n, E, t))
|
|
944
944
|
return;
|
|
945
|
-
(
|
|
946
|
-
projection:
|
|
945
|
+
(E ? f : a).execute({
|
|
946
|
+
projection: x,
|
|
947
947
|
modelView: p,
|
|
948
948
|
camera: q(A),
|
|
949
949
|
screen: y,
|
|
950
950
|
count: i,
|
|
951
951
|
color: T,
|
|
952
|
-
width:
|
|
953
|
-
minWidthPixels:
|
|
954
|
-
maxWidthPixels:
|
|
955
|
-
index:
|
|
952
|
+
width: M,
|
|
953
|
+
minWidthPixels: E && g !== void 0 ? Math.max(w, g) : w,
|
|
954
|
+
maxWidthPixels: E && g !== void 0 ? Math.max(R, g) : R,
|
|
955
|
+
index: v,
|
|
956
956
|
dash: l,
|
|
957
|
-
dashSize:
|
|
957
|
+
dashSize: b,
|
|
958
958
|
dashOffset: S
|
|
959
959
|
});
|
|
960
960
|
}, u = ce(
|
|
961
961
|
() => t.points?.() ?? [],
|
|
962
|
-
(
|
|
963
|
-
const p =
|
|
964
|
-
const [T] =
|
|
965
|
-
return !T || !
|
|
962
|
+
(x) => {
|
|
963
|
+
const p = x.flatMap((v) => {
|
|
964
|
+
const [T] = v, [M] = v.slice(-1);
|
|
965
|
+
return !T || !M ? [] : ((R) => {
|
|
966
966
|
const g = new Array(R.length * 3 * 4);
|
|
967
|
-
for (let
|
|
968
|
-
const [S = 0, U = 0, P = 0] = R[
|
|
969
|
-
for (let
|
|
970
|
-
const
|
|
971
|
-
g[
|
|
967
|
+
for (let b = 0; b < R.length; b++) {
|
|
968
|
+
const [S = 0, U = 0, P = 0] = R[b] ?? [];
|
|
969
|
+
for (let D = 0; D < 4; D++) {
|
|
970
|
+
const O = b * 3 * 4 + D * 3;
|
|
971
|
+
g[O + 0] = S, g[O + 1] = U, g[O + 2] = P;
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
974
|
return g;
|
|
975
|
-
})([T, ...
|
|
976
|
-
}), { indexData: A } =
|
|
977
|
-
({ indexData:
|
|
978
|
-
if (
|
|
979
|
-
return { indexData:
|
|
980
|
-
const w = xe(0, (
|
|
981
|
-
const [g = 0,
|
|
975
|
+
})([T, ...v, M].map((R) => q(z(R))));
|
|
976
|
+
}), { indexData: A } = x.reduce(
|
|
977
|
+
({ indexData: v, count: T }, M) => {
|
|
978
|
+
if (M.length === 0)
|
|
979
|
+
return { indexData: v, count: T };
|
|
980
|
+
const w = xe(0, (M.length - 1) * 2).flatMap((R) => {
|
|
981
|
+
const [g = 0, b = 0, S = 0, U = 0] = [0, 1, 2, 3].map(
|
|
982
982
|
(P) => P + R * 2 + T
|
|
983
983
|
);
|
|
984
984
|
return [
|
|
985
985
|
g,
|
|
986
|
-
|
|
986
|
+
b,
|
|
987
987
|
U,
|
|
988
988
|
/**/
|
|
989
989
|
g,
|
|
@@ -991,13 +991,13 @@ const Ii = (e, t = {}) => {
|
|
|
991
991
|
S
|
|
992
992
|
];
|
|
993
993
|
});
|
|
994
|
-
return T += (
|
|
994
|
+
return T += (M.length + 2) * 4, v = v.concat(w), { indexData: v, count: T };
|
|
995
995
|
},
|
|
996
996
|
{ indexData: [], count: 0 }
|
|
997
997
|
);
|
|
998
998
|
i = A.length;
|
|
999
|
-
const y =
|
|
1000
|
-
(
|
|
999
|
+
const y = x.flatMap(
|
|
1000
|
+
(v) => v.length === 0 ? [] : xe(0, (v.length + 1) * 2).flatMap(() => [
|
|
1001
1001
|
-1,
|
|
1002
1002
|
-1,
|
|
1003
1003
|
//
|
|
@@ -1010,46 +1010,46 @@ const Ii = (e, t = {}) => {
|
|
|
1010
1010
|
1,
|
|
1011
1011
|
1
|
|
1012
1012
|
])
|
|
1013
|
-
),
|
|
1014
|
-
const
|
|
1015
|
-
(
|
|
1013
|
+
), E = x.flatMap((v) => {
|
|
1014
|
+
const M = v.map(
|
|
1015
|
+
(b, S) => Ue(z(b), z(v[S - 1] ?? b)) * F
|
|
1016
1016
|
).reduce(
|
|
1017
|
-
({ current:
|
|
1017
|
+
({ current: b, result: S }, U) => (b += U, S.push(b), { current: b, result: S }),
|
|
1018
1018
|
{ current: 0, result: [] }
|
|
1019
|
-
).result, [w] =
|
|
1020
|
-
return w === void 0 || R === void 0 ? [] : ((
|
|
1021
|
-
const S = new Array(
|
|
1022
|
-
for (let U = 0; U <
|
|
1023
|
-
S[U * 4 + 0] =
|
|
1019
|
+
).result, [w] = M, [R] = M.slice(-1);
|
|
1020
|
+
return w === void 0 || R === void 0 ? [] : ((b) => {
|
|
1021
|
+
const S = new Array(b.length * 4);
|
|
1022
|
+
for (let U = 0; U < b.length; U++)
|
|
1023
|
+
S[U * 4 + 0] = b[U], S[U * 4 + 1] = b[U], S[U * 4 + 2] = b[U], S[U * 4 + 3] = b[U];
|
|
1024
1024
|
return S;
|
|
1025
|
-
})([w, ...
|
|
1025
|
+
})([w, ...M, R]);
|
|
1026
1026
|
});
|
|
1027
|
-
r.set(p), s.set(A), o.set(y), c.set(
|
|
1027
|
+
r.set(p), s.set(A), o.set(y), c.set(E);
|
|
1028
1028
|
}
|
|
1029
1029
|
), d = ce(
|
|
1030
1030
|
() => t.dashPattern?.(),
|
|
1031
|
-
(
|
|
1032
|
-
|
|
1031
|
+
(x) => {
|
|
1032
|
+
x = x ?? [[1, 1, 1, 1]], l.use(), n.texImage2D(
|
|
1033
1033
|
n.TEXTURE_2D,
|
|
1034
1034
|
0,
|
|
1035
1035
|
n.RGBA,
|
|
1036
|
-
|
|
1036
|
+
x.length,
|
|
1037
1037
|
1,
|
|
1038
1038
|
0,
|
|
1039
1039
|
n.RGBA,
|
|
1040
1040
|
n.UNSIGNED_BYTE,
|
|
1041
|
-
new Uint8Array(
|
|
1041
|
+
new Uint8Array(x.flatMap((p) => [...p.map((A) => A * 255)]))
|
|
1042
1042
|
);
|
|
1043
1043
|
}
|
|
1044
|
-
),
|
|
1044
|
+
), m = () => {
|
|
1045
1045
|
l.dispose(), r.dispose(), s.dispose(), o.dispose(), c.dispose();
|
|
1046
1046
|
}, _ = ye(t);
|
|
1047
1047
|
return {
|
|
1048
1048
|
render: h,
|
|
1049
|
-
dispose:
|
|
1049
|
+
dispose: m,
|
|
1050
1050
|
..._
|
|
1051
1051
|
};
|
|
1052
|
-
},
|
|
1052
|
+
}, Un = ({ gl: e, programs: t }, {
|
|
1053
1053
|
positionBuffer: n,
|
|
1054
1054
|
indexBuffer: i,
|
|
1055
1055
|
cornerBuffer: r,
|
|
@@ -1057,43 +1057,43 @@ const Ii = (e, t = {}) => {
|
|
|
1057
1057
|
}) => {
|
|
1058
1058
|
const o = (f = !1) => {
|
|
1059
1059
|
const l = t.get({
|
|
1060
|
-
vertexSource:
|
|
1061
|
-
fragmentSource: f ? _e :
|
|
1060
|
+
vertexSource: Sn,
|
|
1061
|
+
fragmentSource: f ? _e : bn
|
|
1062
1062
|
}), h = Float32Array.BYTES_PER_ELEMENT, u = Int32Array.BYTES_PER_ELEMENT, d = l.attribute3i("previous", n, {
|
|
1063
1063
|
stride: u * 3
|
|
1064
|
-
}),
|
|
1064
|
+
}), m = l.attribute3i("current", n, {
|
|
1065
1065
|
stride: u * 3,
|
|
1066
1066
|
offset: u * 3 * 4
|
|
1067
1067
|
}), _ = l.attribute3i("next", n, {
|
|
1068
1068
|
stride: u * 3,
|
|
1069
1069
|
offset: u * 3 * 4 * 2
|
|
1070
|
-
}),
|
|
1070
|
+
}), x = l.attribute2f("corner", r, {
|
|
1071
1071
|
stride: h * 2
|
|
1072
1072
|
}), p = l.attribute1f("distance", s, {
|
|
1073
1073
|
stride: h,
|
|
1074
1074
|
offset: h * 1 * 4
|
|
1075
|
-
}), A = l.uniformMatrix4f("projection"), y = l.uniformMatrix4f("model_view"),
|
|
1075
|
+
}), A = l.uniformMatrix4f("projection"), y = l.uniformMatrix4f("model_view"), E = l.uniform3i("camera"), v = l.uniform2f("screen"), T = l.uniform4f("color"), M = l.uniform1f("width"), w = l.uniform1f("max_width_pixels"), R = l.uniform1f("min_width_pixels"), g = l.uniform1i("index"), b = l.uniform1i("dash"), S = l.uniform1f("dash_size"), U = l.uniform1f("dash_offset");
|
|
1076
1076
|
return { execute: ({
|
|
1077
|
-
projection:
|
|
1078
|
-
modelView:
|
|
1079
|
-
camera:
|
|
1080
|
-
screen:
|
|
1077
|
+
projection: D,
|
|
1078
|
+
modelView: O,
|
|
1079
|
+
camera: X,
|
|
1080
|
+
screen: I,
|
|
1081
1081
|
count: W,
|
|
1082
1082
|
color: j,
|
|
1083
|
-
width:
|
|
1083
|
+
width: Y,
|
|
1084
1084
|
minWidthPixels: J,
|
|
1085
|
-
maxWidthPixels:
|
|
1086
|
-
index:
|
|
1087
|
-
dash:
|
|
1088
|
-
dashSize:
|
|
1089
|
-
dashOffset:
|
|
1085
|
+
maxWidthPixels: $,
|
|
1086
|
+
index: Q,
|
|
1087
|
+
dash: Te,
|
|
1088
|
+
dashSize: we,
|
|
1089
|
+
dashOffset: ze
|
|
1090
1090
|
}) => {
|
|
1091
|
-
W !== 0 && (l.use(), d.use(),
|
|
1091
|
+
W !== 0 && (l.use(), d.use(), m.use(), _.use(), x.use(), p.use(), A.set(D), y.set(O), E.set(X), v.set(I), T.set(j), M.set(Y), R.set(J), w.set($), g.set(Q), S.set(we), U.set(ze), e.activeTexture(e.TEXTURE0), b.set(0), Te.use(), i.use(), e.drawElements(e.TRIANGLES, W, e.UNSIGNED_SHORT, 0));
|
|
1092
1092
|
} };
|
|
1093
1093
|
}, c = o(), a = o(!0);
|
|
1094
1094
|
return { renderProgram: c, depthProgram: a };
|
|
1095
1095
|
};
|
|
1096
|
-
var
|
|
1096
|
+
var Pn = `#version 300 es
|
|
1097
1097
|
|
|
1098
1098
|
precision highp float;
|
|
1099
1099
|
|
|
@@ -1103,7 +1103,7 @@ out vec4 result;
|
|
|
1103
1103
|
void main() {
|
|
1104
1104
|
if (color_out.a == 0.f) discard;
|
|
1105
1105
|
result = color_out;
|
|
1106
|
-
}`,
|
|
1106
|
+
}`, zn = `#version 300 es
|
|
1107
1107
|
|
|
1108
1108
|
precision highp float;
|
|
1109
1109
|
|
|
@@ -1146,29 +1146,29 @@ void main(void) {
|
|
|
1146
1146
|
const Di = (e, t = {}) => {
|
|
1147
1147
|
const { gl: n } = e;
|
|
1148
1148
|
let i = 0;
|
|
1149
|
-
const r = V({ gl: n, type: "f32", target: "array" }), s = V({ gl: n, type: "u16", target: "element" }), o = V({ gl: n, type: "f32", target: "array" }), { renderProgram: c, depthProgram: a } =
|
|
1149
|
+
const r = V({ gl: n, type: "f32", target: "array" }), s = V({ gl: n, type: "u16", target: "element" }), o = V({ gl: n, type: "f32", target: "array" }), { renderProgram: c, depthProgram: a } = Ln(e, {
|
|
1150
1150
|
vertexBuffer: r,
|
|
1151
1151
|
indexBuffer: s,
|
|
1152
1152
|
normalBuffer: o
|
|
1153
1153
|
}), f = ({
|
|
1154
|
-
viewport: { projection: d, modelView:
|
|
1154
|
+
viewport: { projection: d, modelView: m, camera: _, screen: x },
|
|
1155
1155
|
depth: p = !1,
|
|
1156
1156
|
index: A = 0
|
|
1157
1157
|
}) => {
|
|
1158
|
-
const y = t.position?.() ?? [0, 0, 0],
|
|
1158
|
+
const y = t.position?.() ?? [0, 0, 0], E = t.orientation?.() ?? [0, 0, 0, 1], v = t.color?.() ?? [1, 1, 1, 1], T = t.diffuse?.() ?? [0, 0, 0, 0], M = t.size?.() ?? 1, w = t.minSizePixels?.() ?? 0, R = t.maxSizePixels?.() ?? Number.MAX_VALUE;
|
|
1159
1159
|
if (l(), Ee(n, p, t))
|
|
1160
1160
|
return;
|
|
1161
1161
|
(p ? a : c).execute({
|
|
1162
1162
|
projection: d,
|
|
1163
|
-
modelView:
|
|
1163
|
+
modelView: m,
|
|
1164
1164
|
camera: q(_),
|
|
1165
|
-
screen:
|
|
1165
|
+
screen: x,
|
|
1166
1166
|
count: i,
|
|
1167
1167
|
position: q(z(y)),
|
|
1168
|
-
orientation: mt(
|
|
1169
|
-
color:
|
|
1168
|
+
orientation: mt(he(), E),
|
|
1169
|
+
color: v,
|
|
1170
1170
|
diffuse: T,
|
|
1171
|
-
size:
|
|
1171
|
+
size: M,
|
|
1172
1172
|
minSizePixels: w,
|
|
1173
1173
|
maxSizePixels: R,
|
|
1174
1174
|
index: A
|
|
@@ -1176,9 +1176,9 @@ const Di = (e, t = {}) => {
|
|
|
1176
1176
|
}, l = ce(
|
|
1177
1177
|
() => t.mesh?.(),
|
|
1178
1178
|
(d) => {
|
|
1179
|
-
const { vertices:
|
|
1180
|
-
r.set(
|
|
1181
|
-
|
|
1179
|
+
const { vertices: m = [], indices: _ = [], normals: x = [] } = d ?? {};
|
|
1180
|
+
r.set(m.flatMap((p) => [...p])), s.set(_.flatMap((p) => [...p])), o.set(
|
|
1181
|
+
x.length === 0 ? m.flatMap(() => [0, 0, 0]) : x.flatMap((p) => [...p])
|
|
1182
1182
|
), i = _.length * 3;
|
|
1183
1183
|
}
|
|
1184
1184
|
), h = () => {
|
|
@@ -1189,145 +1189,145 @@ const Di = (e, t = {}) => {
|
|
|
1189
1189
|
dispose: h,
|
|
1190
1190
|
...u
|
|
1191
1191
|
};
|
|
1192
|
-
},
|
|
1192
|
+
}, Ln = ({ gl: e, programs: t }, {
|
|
1193
1193
|
vertexBuffer: n,
|
|
1194
1194
|
indexBuffer: i,
|
|
1195
1195
|
normalBuffer: r
|
|
1196
1196
|
}) => {
|
|
1197
1197
|
const s = (a = !1) => {
|
|
1198
1198
|
const f = t.get({
|
|
1199
|
-
vertexSource:
|
|
1200
|
-
fragmentSource: a ? _e :
|
|
1201
|
-
}), l = f.attribute3f("vertex", n), h = f.attribute3f("normal", r), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"),
|
|
1199
|
+
vertexSource: zn,
|
|
1200
|
+
fragmentSource: a ? _e : Pn
|
|
1201
|
+
}), l = f.attribute3f("vertex", n), h = f.attribute3f("normal", r), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), _ = f.uniform3i("position"), x = f.uniformMatrix4f("orientation"), p = f.uniform2f("screen"), A = f.uniform4f("color"), y = f.uniform4f("diffuse"), E = f.uniform1f("size"), v = f.uniform1f("min_size_pixels"), T = f.uniform1f("max_size_pixels"), M = f.uniform1i("index");
|
|
1202
1202
|
return { execute: ({
|
|
1203
1203
|
projection: R,
|
|
1204
1204
|
modelView: g,
|
|
1205
|
-
camera:
|
|
1205
|
+
camera: b,
|
|
1206
1206
|
screen: S,
|
|
1207
1207
|
count: U,
|
|
1208
1208
|
position: P,
|
|
1209
|
-
orientation:
|
|
1210
|
-
color:
|
|
1211
|
-
diffuse:
|
|
1212
|
-
size:
|
|
1209
|
+
orientation: D,
|
|
1210
|
+
color: O,
|
|
1211
|
+
diffuse: X,
|
|
1212
|
+
size: I,
|
|
1213
1213
|
minSizePixels: W,
|
|
1214
1214
|
maxSizePixels: j,
|
|
1215
|
-
index:
|
|
1215
|
+
index: Y
|
|
1216
1216
|
}) => {
|
|
1217
|
-
f.use(), l.use(), h.use(), u.set(R), d.set(g),
|
|
1217
|
+
f.use(), l.use(), h.use(), u.set(R), d.set(g), m.set(b), p.set(S), _.set(P), x.set(D), A.set(O), y.set(X), E.set(I), v.set(W), T.set(j), M.set(Y), i.use(), e.drawElements(e.TRIANGLES, U, e.UNSIGNED_SHORT, 0);
|
|
1218
1218
|
} };
|
|
1219
1219
|
}, o = s(), c = s(!0);
|
|
1220
1220
|
return { renderProgram: o, depthProgram: c };
|
|
1221
1221
|
};
|
|
1222
1222
|
var Tt = function(e, t, n, i, r) {
|
|
1223
1223
|
let s, o = null;
|
|
1224
|
-
if (r ===
|
|
1224
|
+
if (r === Hn(e, t, n, i) > 0)
|
|
1225
1225
|
for (s = t; s < n; s += i)
|
|
1226
|
-
o = new
|
|
1226
|
+
o = new Be(s, e[s], e[s + 1], o);
|
|
1227
1227
|
else
|
|
1228
1228
|
for (s = n - i; s >= t; s -= i)
|
|
1229
|
-
o = new
|
|
1230
|
-
return o !== null &&
|
|
1229
|
+
o = new Be(s, e[s], e[s + 1], o);
|
|
1230
|
+
return o !== null && Ye(o, o.next) && (be(o), o = o.next), o;
|
|
1231
1231
|
}, ae = function(e, t) {
|
|
1232
1232
|
t === void 0 && (t = e);
|
|
1233
1233
|
let n = e, i;
|
|
1234
1234
|
do
|
|
1235
|
-
if (i = !1, !n.steiner && (
|
|
1236
|
-
if (
|
|
1235
|
+
if (i = !1, !n.steiner && (Ye(n, n.next) || N(n.prev, n, n.next) === 0)) {
|
|
1236
|
+
if (be(n), n = t = n.prev, n === n.next)
|
|
1237
1237
|
break;
|
|
1238
1238
|
i = !0;
|
|
1239
1239
|
} else
|
|
1240
1240
|
n = n.next;
|
|
1241
1241
|
while (i || n !== t);
|
|
1242
1242
|
return t;
|
|
1243
|
-
},
|
|
1243
|
+
}, Ae = function(e, t, n, i, r, s, o) {
|
|
1244
1244
|
if (e === null)
|
|
1245
1245
|
return;
|
|
1246
|
-
o === 0 && s !== 0 &&
|
|
1246
|
+
o === 0 && s !== 0 && Bn(e, i, r, s);
|
|
1247
1247
|
let c = e, a, f;
|
|
1248
1248
|
for (; e.prev !== e.next; ) {
|
|
1249
|
-
if (a = e.prev, f = e.next, s !== 0 ?
|
|
1250
|
-
t.push(a.i / n), t.push(e.i / n), t.push(f.i / n),
|
|
1249
|
+
if (a = e.prev, f = e.next, s !== 0 ? In(e, i, r, s) : Nn(e)) {
|
|
1250
|
+
t.push(a.i / n), t.push(e.i / n), t.push(f.i / n), be(e), e = f.next, c = f.next;
|
|
1251
1251
|
continue;
|
|
1252
1252
|
}
|
|
1253
1253
|
if (e = f, e === c) {
|
|
1254
|
-
o === 0 ?
|
|
1254
|
+
o === 0 ? Ae(ae(e), t, n, i, r, s, 1) : o === 1 ? (e = Dn(ae(e), t, n), Ae(e, t, n, i, r, s, 2)) : o === 2 && On(e, t, n, i, r, s);
|
|
1255
1255
|
break;
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
|
-
},
|
|
1258
|
+
}, Nn = function(e) {
|
|
1259
1259
|
const t = e.prev, n = e, i = e.next;
|
|
1260
|
-
if (
|
|
1260
|
+
if (N(t, n, i) >= 0)
|
|
1261
1261
|
return !1;
|
|
1262
1262
|
let r = e.next.next;
|
|
1263
1263
|
for (; r !== e.prev; ) {
|
|
1264
|
-
if (
|
|
1264
|
+
if (me(t.x, t.y, n.x, n.y, i.x, i.y, r.x, r.y) && N(r.prev, r, r.next) >= 0)
|
|
1265
1265
|
return !1;
|
|
1266
1266
|
r = r.next;
|
|
1267
1267
|
}
|
|
1268
1268
|
return !0;
|
|
1269
|
-
},
|
|
1269
|
+
}, In = function(e, t, n, i) {
|
|
1270
1270
|
const r = e.prev, s = e, o = e.next;
|
|
1271
|
-
if (
|
|
1271
|
+
if (N(r, s, o) >= 0)
|
|
1272
1272
|
return !1;
|
|
1273
|
-
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 =
|
|
1274
|
-
let { prevZ: d, nextZ:
|
|
1275
|
-
for (; d !== null &&
|
|
1276
|
-
if (d !== e.prev && d !== e.next &&
|
|
1273
|
+
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 = qe(c, a, t, n, i), u = qe(f, l, t, n, i);
|
|
1274
|
+
let { prevZ: d, nextZ: m } = e;
|
|
1275
|
+
for (; d !== null && m !== null && d.z >= h && m.z <= u; ) {
|
|
1276
|
+
if (d !== e.prev && d !== e.next && me(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && N(d.prev, d, d.next) >= 0 || (d = d.prevZ, m !== e.prev && m !== e.next && me(r.x, r.y, s.x, s.y, o.x, o.y, m.x, m.y) && N(m.prev, m, m.next) >= 0))
|
|
1277
1277
|
return !1;
|
|
1278
|
-
|
|
1278
|
+
m = m.nextZ;
|
|
1279
1279
|
}
|
|
1280
1280
|
for (; d !== null && d.z >= h; ) {
|
|
1281
|
-
if (d !== e.prev && d !== e.next &&
|
|
1281
|
+
if (d !== e.prev && d !== e.next && me(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && N(d.prev, d, d.next) >= 0)
|
|
1282
1282
|
return !1;
|
|
1283
1283
|
d = d.prevZ;
|
|
1284
1284
|
}
|
|
1285
|
-
for (;
|
|
1286
|
-
if (
|
|
1285
|
+
for (; m !== null && m.z <= u; ) {
|
|
1286
|
+
if (m !== e.prev && m !== e.next && me(r.x, r.y, s.x, s.y, o.x, o.y, m.x, m.y) && N(m.prev, m, m.next) >= 0)
|
|
1287
1287
|
return !1;
|
|
1288
|
-
|
|
1288
|
+
m = m.nextZ;
|
|
1289
1289
|
}
|
|
1290
1290
|
return !0;
|
|
1291
|
-
},
|
|
1291
|
+
}, Dn = function(e, t, n) {
|
|
1292
1292
|
let i = e;
|
|
1293
1293
|
do {
|
|
1294
1294
|
const r = i.prev, s = i.next.next;
|
|
1295
|
-
!
|
|
1295
|
+
!Ye(r, s) && wt(r, i, i.next, s) && Me(r, s) && Me(s, r) && (t.push(r.i / n), t.push(i.i / n), t.push(s.i / n), be(i), be(i.next), i = e = s), i = i.next;
|
|
1296
1296
|
} while (i !== e);
|
|
1297
1297
|
return i;
|
|
1298
|
-
},
|
|
1298
|
+
}, On = function(e, t, n, i, r, s) {
|
|
1299
1299
|
let o = e;
|
|
1300
1300
|
do {
|
|
1301
1301
|
let c = o.next.next;
|
|
1302
1302
|
for (; c !== o.prev; ) {
|
|
1303
|
-
if (o.i !== c.i &&
|
|
1303
|
+
if (o.i !== c.i && Yn(o, c)) {
|
|
1304
1304
|
let a = gt(o, c);
|
|
1305
|
-
o = ae(o, o.next), a = ae(a, a.next),
|
|
1305
|
+
o = ae(o, o.next), a = ae(a, a.next), Ae(o, t, n, i, r, s, 0), Ae(a, t, n, i, r, s, 0);
|
|
1306
1306
|
return;
|
|
1307
1307
|
}
|
|
1308
1308
|
c = c.next;
|
|
1309
1309
|
}
|
|
1310
1310
|
o = o.next;
|
|
1311
1311
|
} while (o !== e);
|
|
1312
|
-
},
|
|
1312
|
+
}, Cn = function(e, t, n, i) {
|
|
1313
1313
|
const r = [];
|
|
1314
1314
|
let s, o, c, a, f;
|
|
1315
1315
|
for (s = 0, o = t.length; s < o; s++)
|
|
1316
|
-
c = t[s] * i, a = s < o - 1 ? t[s + 1] * i : e.length, f = Tt(e, c, a, i, !1), f === f.next && (f.steiner = !0), r.push(
|
|
1317
|
-
for (r.sort(
|
|
1318
|
-
n =
|
|
1316
|
+
c = t[s] * i, a = s < o - 1 ? t[s + 1] * i : e.length, f = Tt(e, c, a, i, !1), f === f.next && (f.steiner = !0), r.push(Zn(f));
|
|
1317
|
+
for (r.sort(Xn), s = 0; s < r.length; s++)
|
|
1318
|
+
n = Wn(r[s], n), n = ae(n, n.next);
|
|
1319
1319
|
return n;
|
|
1320
|
-
},
|
|
1320
|
+
}, Xn = function(e, t) {
|
|
1321
1321
|
return e.x - t.x;
|
|
1322
|
-
},
|
|
1323
|
-
const n =
|
|
1322
|
+
}, Wn = function(e, t) {
|
|
1323
|
+
const n = jn(e, t);
|
|
1324
1324
|
if (n === null)
|
|
1325
1325
|
return t;
|
|
1326
1326
|
{
|
|
1327
1327
|
const i = gt(n, e), r = ae(n, n.next);
|
|
1328
1328
|
return ae(i, i.next), t === n ? r : t;
|
|
1329
1329
|
}
|
|
1330
|
-
},
|
|
1330
|
+
}, jn = function(e, t) {
|
|
1331
1331
|
let n = t;
|
|
1332
1332
|
const { x: i, y: r } = e;
|
|
1333
1333
|
let s = -1 / 0, o;
|
|
@@ -1354,16 +1354,16 @@ var Tt = function(e, t, n, i, r) {
|
|
|
1354
1354
|
let l = 1 / 0, h;
|
|
1355
1355
|
n = o;
|
|
1356
1356
|
do
|
|
1357
|
-
i >= n.x && n.x >= a && i !== n.x &&
|
|
1357
|
+
i >= n.x && n.x >= a && i !== n.x && me(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), Me(n, e) && (h < l || h === l && (n.x > o.x || n.x === o.x && N(o.prev, o, n.prev) < 0 && N(n.next, o, o.next) < 0)) && (o = n, l = h)), n = n.next;
|
|
1358
1358
|
while (n !== c);
|
|
1359
1359
|
return o;
|
|
1360
|
-
},
|
|
1360
|
+
}, Bn = function(e, t, n, i) {
|
|
1361
1361
|
let r = e;
|
|
1362
1362
|
do
|
|
1363
|
-
r.z === void 0 && (r.z =
|
|
1363
|
+
r.z === void 0 && (r.z = qe(r.x, r.y, t, n, i)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next;
|
|
1364
1364
|
while (r !== e);
|
|
1365
|
-
r.prevZ !== null && (r.prevZ.nextZ = null), r.prevZ = null,
|
|
1366
|
-
},
|
|
1365
|
+
r.prevZ !== null && (r.prevZ.nextZ = null), r.prevZ = null, Vn(r);
|
|
1366
|
+
}, Vn = function(e) {
|
|
1367
1367
|
let t, n, i, r, s, o, c, a, f = 1;
|
|
1368
1368
|
do {
|
|
1369
1369
|
for (n = e, e = null, s = null, o = 0; n !== null; ) {
|
|
@@ -1376,30 +1376,30 @@ var Tt = function(e, t, n, i, r) {
|
|
|
1376
1376
|
s !== null && (s.nextZ = null), f *= 2;
|
|
1377
1377
|
} while (o > 1);
|
|
1378
1378
|
return e;
|
|
1379
|
-
},
|
|
1379
|
+
}, qe = function(e, t, n, i, r) {
|
|
1380
1380
|
return e = 32767 * (e - n) * r, t = 32767 * (t - i) * r, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, t = (t | t << 8) & 16711935, t = (t | t << 4) & 252645135, t = (t | t << 2) & 858993459, t = (t | t << 1) & 1431655765, e | t << 1;
|
|
1381
|
-
},
|
|
1381
|
+
}, Zn = function(e) {
|
|
1382
1382
|
let t = e, n = e;
|
|
1383
1383
|
do
|
|
1384
1384
|
(t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next;
|
|
1385
1385
|
while (t !== e);
|
|
1386
1386
|
return n;
|
|
1387
|
-
},
|
|
1387
|
+
}, me = function(e, t, n, i, r, s, o, c) {
|
|
1388
1388
|
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;
|
|
1389
|
-
},
|
|
1390
|
-
return e.next.i !== t.i && e.prev.i !== t.i &&
|
|
1391
|
-
},
|
|
1389
|
+
}, Yn = function(e, t) {
|
|
1390
|
+
return e.next.i !== t.i && e.prev.i !== t.i && !$n(e, t) && (Me(e, t) && Me(t, e) && kn(e, t) && (N(e.prev, e, t.prev) !== 0 || N(e, t.prev, t) !== 0) || Ye(e, t) && N(e.prev, e, e.next) > 0 && N(t.prev, t, t.next) > 0);
|
|
1391
|
+
}, N = function(e, t, n) {
|
|
1392
1392
|
return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y);
|
|
1393
|
-
},
|
|
1393
|
+
}, Ye = function(e, t) {
|
|
1394
1394
|
return e.x === t.x && e.y === t.y;
|
|
1395
1395
|
}, wt = function(e, t, n, i) {
|
|
1396
|
-
const r =
|
|
1397
|
-
return !!(r !== s && o !== c || r === 0 &&
|
|
1398
|
-
},
|
|
1396
|
+
const r = Ie(N(e, t, n)), s = Ie(N(e, t, i)), o = Ie(N(n, i, e)), c = Ie(N(n, i, t));
|
|
1397
|
+
return !!(r !== s && o !== c || r === 0 && De(e, n, t) || s === 0 && De(e, i, t) || o === 0 && De(n, e, i) || c === 0 && De(n, t, i));
|
|
1398
|
+
}, Ie = function(e) {
|
|
1399
1399
|
return e > 0 ? 1 : e < 0 ? -1 : 0;
|
|
1400
|
-
},
|
|
1400
|
+
}, De = function(e, t, n) {
|
|
1401
1401
|
return t.x <= Math.max(e.x, n.x) && t.x >= Math.min(e.x, n.x) && t.y <= Math.max(e.y, n.y) && t.y >= Math.min(e.y, n.y);
|
|
1402
|
-
},
|
|
1402
|
+
}, $n = function(e, t) {
|
|
1403
1403
|
let n = e;
|
|
1404
1404
|
do {
|
|
1405
1405
|
if (n.i !== e.i && n.next?.i !== e.i && n.i !== t.i && n.next?.i !== t.i && wt(n, n.next, e, t))
|
|
@@ -1407,9 +1407,9 @@ var Tt = function(e, t, n, i, r) {
|
|
|
1407
1407
|
n = n.next;
|
|
1408
1408
|
} while (n !== e);
|
|
1409
1409
|
return !1;
|
|
1410
|
-
},
|
|
1411
|
-
return
|
|
1412
|
-
},
|
|
1410
|
+
}, Me = function(e, t) {
|
|
1411
|
+
return N(e.prev, e, e.next) < 0 ? N(e, t, e.next) >= 0 && N(e, e.prev, t) >= 0 : N(e, t, e.prev) < 0 || N(e, e.next, t) < 0;
|
|
1412
|
+
}, kn = function(e, t) {
|
|
1413
1413
|
const n = (e.x + t.x) / 2, i = (e.y + t.y) / 2;
|
|
1414
1414
|
let r = e, s = !1;
|
|
1415
1415
|
do
|
|
@@ -1417,17 +1417,17 @@ var Tt = function(e, t, n, i, r) {
|
|
|
1417
1417
|
while (r !== e);
|
|
1418
1418
|
return s;
|
|
1419
1419
|
}, gt = function(e, t) {
|
|
1420
|
-
const n = new
|
|
1420
|
+
const n = new Be(e.i, e.x, e.y), i = new Be(t.i, t.x, t.y), r = e.next, s = t.prev;
|
|
1421
1421
|
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;
|
|
1422
|
-
},
|
|
1422
|
+
}, be = function(e) {
|
|
1423
1423
|
e.next.prev = e.prev, e.prev.next = e.next, e.prevZ !== null && (e.prevZ.nextZ = e.nextZ), e.nextZ !== null && (e.nextZ.prevZ = e.prevZ);
|
|
1424
|
-
},
|
|
1424
|
+
}, Hn = function(e, t, n, i) {
|
|
1425
1425
|
let r = 0;
|
|
1426
1426
|
for (let s = t, o = n - i; s < n; s += i)
|
|
1427
1427
|
r += (e[o] - e[s]) * (e[s + 1] + e[o + 1]), o = s;
|
|
1428
1428
|
return r;
|
|
1429
1429
|
};
|
|
1430
|
-
class
|
|
1430
|
+
class Be {
|
|
1431
1431
|
i;
|
|
1432
1432
|
x;
|
|
1433
1433
|
y;
|
|
@@ -1441,101 +1441,101 @@ class We {
|
|
|
1441
1441
|
this.i = t, this.x = n, this.y = i, r === null ? (this.prev = this, this.next = this) : (this.next = r.next, this.prev = r, r.next.prev = this, r.next = this);
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function Gn(e, t = [], n = 2) {
|
|
1445
1445
|
const i = t.length > 0, r = i ? t[0] * n : e.length;
|
|
1446
1446
|
let s = Tt(e, 0, r, n, !0);
|
|
1447
1447
|
const o = [];
|
|
1448
1448
|
if (s === null || s.next === s.prev)
|
|
1449
1449
|
return o;
|
|
1450
1450
|
let c = 1 / 0, a = 1 / 0, f = -1 / 0, l = -1 / 0, h = 0, u, d;
|
|
1451
|
-
if (i && (s =
|
|
1451
|
+
if (i && (s = Cn(e, t, s, n)), e.length > 80 * n) {
|
|
1452
1452
|
c = f = e[0], a = l = e[1];
|
|
1453
|
-
for (let
|
|
1454
|
-
u = e[
|
|
1453
|
+
for (let m = n; m < r; m += n)
|
|
1454
|
+
u = e[m], d = e[m + 1], u < c && (c = u), d < a && (a = d), u > f && (f = u), d > l && (l = d);
|
|
1455
1455
|
h = Math.max(f - c, l - a), h = h !== 0 ? 1 / h : 0;
|
|
1456
1456
|
}
|
|
1457
|
-
return
|
|
1457
|
+
return Ae(s, o, n, c, a, h, 0), o;
|
|
1458
1458
|
}
|
|
1459
|
-
function
|
|
1460
|
-
const { vertices: i, holeIndices: r, dim: s } =
|
|
1461
|
-
return t !== 1 / 0 &&
|
|
1459
|
+
function Fn(e, t = 1 / 0, n = 0) {
|
|
1460
|
+
const { vertices: i, holeIndices: r, dim: s } = qn(e), o = Gn(i, r, s);
|
|
1461
|
+
return t !== 1 / 0 && Qn(i, o, t, s), { vertices: i, indices: o.map((c) => c + n) };
|
|
1462
1462
|
}
|
|
1463
|
-
function
|
|
1463
|
+
function Qn(e, t, n, i) {
|
|
1464
1464
|
let r, s, o;
|
|
1465
1465
|
for (let c = 0; c < i; c++)
|
|
1466
1466
|
for (let a = 0; a < t.length; a += 3) {
|
|
1467
1467
|
r = t[a], s = t[a + 1], o = t[a + 2];
|
|
1468
|
-
const f =
|
|
1468
|
+
const f = Kn(r, s, o, e, t, i, c, n);
|
|
1469
1469
|
f !== void 0 && (t[a] = f[0], t[a + 1] = f[1], t[a + 2] = f[2], a -= 3);
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
-
var
|
|
1472
|
+
var Kn = function(e, t, n, i, r, s, o, c) {
|
|
1473
1473
|
const a = i[e * s + o], f = i[t * s + o], l = i[n * s + o];
|
|
1474
1474
|
if (a < f && a < l) {
|
|
1475
1475
|
const h = a + c - le(a, c);
|
|
1476
1476
|
if (h > a && h <= f && h <= l && (f !== h || f !== h))
|
|
1477
|
-
return
|
|
1477
|
+
return Fe(h, e, t, n, a, f, l, i, r, s, o, c);
|
|
1478
1478
|
} else if (a > f && a > l) {
|
|
1479
1479
|
let h = le(a, c);
|
|
1480
1480
|
h === 0 && (h = c);
|
|
1481
1481
|
const u = a - h;
|
|
1482
1482
|
if (u < a && u >= f && u >= l && (f !== u || f !== u))
|
|
1483
|
-
return
|
|
1483
|
+
return Qe(u, e, t, n, a, f, l, i, r, s, o, c);
|
|
1484
1484
|
}
|
|
1485
1485
|
if (f < a && f < l) {
|
|
1486
1486
|
const h = f + c - le(f, c);
|
|
1487
1487
|
if (h > f && h <= l && h <= a && (a !== h || l !== h))
|
|
1488
|
-
return
|
|
1488
|
+
return Fe(h, t, n, e, f, l, a, i, r, s, o, c);
|
|
1489
1489
|
} else if (f > a && f > l) {
|
|
1490
1490
|
let h = le(f, c);
|
|
1491
1491
|
h === 0 && (h = c);
|
|
1492
1492
|
const u = f - h;
|
|
1493
1493
|
if (u < f && u >= l && u >= a && (a !== u || l !== u))
|
|
1494
|
-
return
|
|
1494
|
+
return Qe(u, t, n, e, f, l, a, i, r, s, o, c);
|
|
1495
1495
|
}
|
|
1496
1496
|
if (l < a && l < f) {
|
|
1497
1497
|
const h = l + c - le(l, c);
|
|
1498
1498
|
if (h > l && h <= a && h <= f && (a !== h || f !== h))
|
|
1499
|
-
return
|
|
1499
|
+
return Fe(h, n, e, t, l, a, f, i, r, s, o, c);
|
|
1500
1500
|
} else if (l > a && l > f) {
|
|
1501
1501
|
let h = le(l, c);
|
|
1502
1502
|
h === 0 && (h = c);
|
|
1503
1503
|
const u = l - h;
|
|
1504
1504
|
if (u < l && u >= a && u >= f && (a !== u || f !== u))
|
|
1505
|
-
return
|
|
1505
|
+
return Qe(u, n, e, t, l, a, f, i, r, s, o, c);
|
|
1506
1506
|
}
|
|
1507
|
-
},
|
|
1507
|
+
}, G = function(e, t, n, i, r, s, o, c) {
|
|
1508
1508
|
const a = s.length / o, f = (r - i) / (e - i);
|
|
1509
1509
|
let l, h;
|
|
1510
1510
|
for (let u = 0; u < o; u++)
|
|
1511
1511
|
l = s[t * o + u], h = s[n * o + u], u !== c ? s.push(l + (h - l) / f) : s.push(e);
|
|
1512
1512
|
return a;
|
|
1513
|
-
},
|
|
1514
|
-
let u =
|
|
1513
|
+
}, Fe = function(e, t, n, i, r, s, o, c, a, f, l, h) {
|
|
1514
|
+
let u = G(e, t, n, r, s, c, f, l), d = G(e, t, i, r, o, c, f, l);
|
|
1515
1515
|
if (a.push(t, u, d), e += h, s < o) {
|
|
1516
1516
|
for (; e < s; )
|
|
1517
|
-
a.push(d, u), d =
|
|
1517
|
+
a.push(d, u), d = G(e, t, i, r, o, c, f, l), a.push(d, d, u), u = G(e, t, n, r, s, c, f, l), a.push(u), e += h;
|
|
1518
1518
|
return a.push(d, u, n), [d, n, i];
|
|
1519
1519
|
} else {
|
|
1520
1520
|
for (; e < o; )
|
|
1521
|
-
a.push(d, u), d =
|
|
1521
|
+
a.push(d, u), d = G(e, t, i, r, o, c, f, l), a.push(d, d, u), u = G(e, t, n, r, s, c, f, l), a.push(u), e += h;
|
|
1522
1522
|
return a.push(d, u, i), [i, u, n];
|
|
1523
1523
|
}
|
|
1524
|
-
},
|
|
1525
|
-
let u =
|
|
1524
|
+
}, Qe = function(e, t, n, i, r, s, o, c, a, f, l, h) {
|
|
1525
|
+
let u = G(e, t, n, r, s, c, f, l), d = G(e, t, i, r, o, c, f, l);
|
|
1526
1526
|
if (a.push(t, u, d), e -= h, s > o) {
|
|
1527
1527
|
for (; e > s; )
|
|
1528
|
-
a.push(d, u), d =
|
|
1528
|
+
a.push(d, u), d = G(e, t, i, r, o, c, f, l), a.push(d, d, u), u = G(e, t, n, r, s, c, f, l), a.push(u), e -= h;
|
|
1529
1529
|
return a.push(d, u, n), [d, n, i];
|
|
1530
1530
|
} else {
|
|
1531
1531
|
for (; e > o; )
|
|
1532
|
-
a.push(d, u), d =
|
|
1532
|
+
a.push(d, u), d = G(e, t, i, r, o, c, f, l), a.push(d, d, u), u = G(e, t, n, r, s, c, f, l), a.push(u), e -= h;
|
|
1533
1533
|
return a.push(d, u, i), [i, u, n];
|
|
1534
1534
|
}
|
|
1535
1535
|
}, le = function(e, t) {
|
|
1536
1536
|
return (e % t + t) % t;
|
|
1537
1537
|
};
|
|
1538
|
-
function
|
|
1538
|
+
function qn(e) {
|
|
1539
1539
|
let t = 0;
|
|
1540
1540
|
const n = e[0][0].length, i = [], r = [];
|
|
1541
1541
|
for (let s = 0, o = e.length; s < o; s++) {
|
|
@@ -1546,7 +1546,7 @@ function ei(e) {
|
|
|
1546
1546
|
}
|
|
1547
1547
|
return { vertices: i, holeIndices: r, dim: n };
|
|
1548
1548
|
}
|
|
1549
|
-
var
|
|
1549
|
+
var Jn = `#version 300 es
|
|
1550
1550
|
|
|
1551
1551
|
precision highp float;
|
|
1552
1552
|
|
|
@@ -1555,7 +1555,7 @@ out vec4 result;
|
|
|
1555
1555
|
|
|
1556
1556
|
void main() {
|
|
1557
1557
|
result = color_out;
|
|
1558
|
-
}`,
|
|
1558
|
+
}`, ei = `#version 300 es
|
|
1559
1559
|
|
|
1560
1560
|
precision highp float;
|
|
1561
1561
|
|
|
@@ -1582,21 +1582,21 @@ void main(void) {
|
|
|
1582
1582
|
const Oi = (e, t = {}) => {
|
|
1583
1583
|
const { gl: n } = e;
|
|
1584
1584
|
let i = 0;
|
|
1585
|
-
const r = V({ gl: n, type: "i32", target: "array" }), s = V({ gl: n, type: "u16", target: "element" }), { renderProgram: o, depthProgram: c } =
|
|
1585
|
+
const r = V({ gl: n, type: "i32", target: "array" }), s = V({ gl: n, type: "u16", target: "element" }), { renderProgram: o, depthProgram: c } = ti(e, {
|
|
1586
1586
|
positionBuffer: r,
|
|
1587
1587
|
indexBuffer: s
|
|
1588
1588
|
}), a = ({
|
|
1589
|
-
viewport: { projection: u, modelView: d, camera:
|
|
1590
|
-
depth:
|
|
1589
|
+
viewport: { projection: u, modelView: d, camera: m, screen: _ },
|
|
1590
|
+
depth: x = !1,
|
|
1591
1591
|
index: p = 0
|
|
1592
1592
|
}) => {
|
|
1593
1593
|
const A = t.color?.() ?? [1, 1, 1, 1];
|
|
1594
|
-
if (f(), Ee(n,
|
|
1594
|
+
if (f(), Ee(n, x, t))
|
|
1595
1595
|
return;
|
|
1596
|
-
(
|
|
1596
|
+
(x ? c : o).execute({
|
|
1597
1597
|
projection: u,
|
|
1598
1598
|
modelView: d,
|
|
1599
|
-
camera: q(
|
|
1599
|
+
camera: q(m),
|
|
1600
1600
|
screen: _,
|
|
1601
1601
|
count: i,
|
|
1602
1602
|
color: A,
|
|
@@ -1605,8 +1605,8 @@ const Oi = (e, t = {}) => {
|
|
|
1605
1605
|
}, f = ce(
|
|
1606
1606
|
() => t.points?.() ?? [],
|
|
1607
1607
|
(u) => {
|
|
1608
|
-
const { vertices: d, indices:
|
|
1609
|
-
r.set(d), s.set(
|
|
1608
|
+
const { vertices: d, indices: m } = u.length > 0 ? Fn(u.map((_) => _.map((x) => [...q(z(x))]))) : { vertices: [], indices: [] };
|
|
1609
|
+
r.set(d), s.set(m), i = m.length;
|
|
1610
1610
|
}
|
|
1611
1611
|
), l = () => {
|
|
1612
1612
|
r.dispose(), s.dispose();
|
|
@@ -1616,32 +1616,32 @@ const Oi = (e, t = {}) => {
|
|
|
1616
1616
|
dispose: l,
|
|
1617
1617
|
...h
|
|
1618
1618
|
};
|
|
1619
|
-
},
|
|
1619
|
+
}, ti = ({ gl: e, programs: t }, {
|
|
1620
1620
|
positionBuffer: n,
|
|
1621
1621
|
indexBuffer: i
|
|
1622
1622
|
}) => {
|
|
1623
1623
|
const r = (c = !1) => {
|
|
1624
1624
|
const a = t.get({
|
|
1625
|
-
vertexSource:
|
|
1626
|
-
fragmentSource: c ? _e :
|
|
1625
|
+
vertexSource: ei,
|
|
1626
|
+
fragmentSource: c ? _e : Jn
|
|
1627
1627
|
}), f = a.attribute3i("position", n, {
|
|
1628
1628
|
stride: 3 * Int32Array.BYTES_PER_ELEMENT
|
|
1629
|
-
}), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform3i("camera"), d = a.uniform2f("screen"),
|
|
1629
|
+
}), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform3i("camera"), d = a.uniform2f("screen"), m = a.uniform4f("color"), _ = a.uniform1i("index");
|
|
1630
1630
|
return { execute: ({
|
|
1631
1631
|
projection: p,
|
|
1632
1632
|
modelView: A,
|
|
1633
1633
|
camera: y,
|
|
1634
|
-
screen:
|
|
1635
|
-
count:
|
|
1634
|
+
screen: E,
|
|
1635
|
+
count: v,
|
|
1636
1636
|
color: T,
|
|
1637
|
-
index:
|
|
1637
|
+
index: M
|
|
1638
1638
|
}) => {
|
|
1639
|
-
|
|
1639
|
+
v !== 0 && (a.use(), f.use(), l.set(p), h.set(A), u.set(y), d.set(E), m.set(T), _.set(M), i.use(), e.drawElements(e.TRIANGLES, v, e.UNSIGNED_SHORT, 0));
|
|
1640
1640
|
} };
|
|
1641
1641
|
}, s = r(), o = r(!0);
|
|
1642
1642
|
return { renderProgram: s, depthProgram: o };
|
|
1643
1643
|
};
|
|
1644
|
-
var
|
|
1644
|
+
var ni = `#version 300 es
|
|
1645
1645
|
|
|
1646
1646
|
precision highp float;
|
|
1647
1647
|
|
|
@@ -1656,7 +1656,7 @@ void main() {
|
|
|
1656
1656
|
vec4 value = texture(image, vec2(d, a));
|
|
1657
1657
|
if (value.r == 0.f) discard;
|
|
1658
1658
|
result = vec4(0, 1., 0, value.r);
|
|
1659
|
-
}`,
|
|
1659
|
+
}`, ii = `#version 300 es
|
|
1660
1660
|
|
|
1661
1661
|
precision highp float;
|
|
1662
1662
|
|
|
@@ -1684,7 +1684,7 @@ void main(void) {
|
|
|
1684
1684
|
uv_out = uv;
|
|
1685
1685
|
}`;
|
|
1686
1686
|
const Ci = (e, t = {}) => {
|
|
1687
|
-
const { gl: n } = e, i =
|
|
1687
|
+
const { gl: n } = e, i = si(n), r = V({ gl: n, type: "f32", target: "array" }), s = V({ gl: n, type: "u16", target: "element" });
|
|
1688
1688
|
r.set(
|
|
1689
1689
|
[
|
|
1690
1690
|
[-1, -1],
|
|
@@ -1703,26 +1703,26 @@ const Ci = (e, t = {}) => {
|
|
|
1703
1703
|
(u) => {
|
|
1704
1704
|
u && i.set(u);
|
|
1705
1705
|
}
|
|
1706
|
-
), { renderProgram: c, depthProgram: a } =
|
|
1706
|
+
), { renderProgram: c, depthProgram: a } = ri(e, {
|
|
1707
1707
|
uvBuffer: r,
|
|
1708
1708
|
indexBuffer: s
|
|
1709
1709
|
}), f = ({
|
|
1710
|
-
viewport: { projection: u, modelView: d, camera:
|
|
1711
|
-
depth:
|
|
1710
|
+
viewport: { projection: u, modelView: d, camera: m, screen: _ },
|
|
1711
|
+
depth: x = !1,
|
|
1712
1712
|
index: p = 0
|
|
1713
1713
|
}) => {
|
|
1714
|
-
const A = t.position?.() ?? [0, 0, 0], y = t.orientation?.() ?? [0, 0, 0, 1],
|
|
1715
|
-
if (o(), Ee(n,
|
|
1714
|
+
const A = t.position?.() ?? [0, 0, 0], y = t.orientation?.() ?? [0, 0, 0, 1], E = t.range?.() ?? 1e3;
|
|
1715
|
+
if (o(), Ee(n, x, t))
|
|
1716
1716
|
return;
|
|
1717
|
-
(
|
|
1717
|
+
(x ? a : c).execute({
|
|
1718
1718
|
projection: u,
|
|
1719
1719
|
modelView: d,
|
|
1720
|
-
camera: q(
|
|
1720
|
+
camera: q(m),
|
|
1721
1721
|
screen: _,
|
|
1722
1722
|
image: i,
|
|
1723
|
-
range:
|
|
1723
|
+
range: E,
|
|
1724
1724
|
position: q(z(A)),
|
|
1725
|
-
orientation: mt(
|
|
1725
|
+
orientation: mt(he(), y),
|
|
1726
1726
|
index: p
|
|
1727
1727
|
});
|
|
1728
1728
|
}, l = () => {
|
|
@@ -1733,33 +1733,33 @@ const Ci = (e, t = {}) => {
|
|
|
1733
1733
|
dispose: l,
|
|
1734
1734
|
...h
|
|
1735
1735
|
};
|
|
1736
|
-
},
|
|
1736
|
+
}, ri = ({ gl: e, programs: t }, {
|
|
1737
1737
|
uvBuffer: n,
|
|
1738
1738
|
indexBuffer: i
|
|
1739
1739
|
}) => {
|
|
1740
1740
|
const r = (c = !1) => {
|
|
1741
1741
|
const a = t.get({
|
|
1742
|
-
vertexSource:
|
|
1743
|
-
fragmentSource: c ? _e :
|
|
1742
|
+
vertexSource: ii,
|
|
1743
|
+
fragmentSource: c ? _e : ni
|
|
1744
1744
|
}), f = a.attribute2f("uv", n, {
|
|
1745
1745
|
stride: 2 * Float32Array.BYTES_PER_ELEMENT
|
|
1746
|
-
}), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform3i("camera"), d = a.uniform2f("screen"),
|
|
1746
|
+
}), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform3i("camera"), d = a.uniform2f("screen"), m = a.uniform1i("image"), _ = a.uniform1f("range"), x = a.uniform3i("position"), p = a.uniformMatrix4f("orientation"), A = a.uniform1i("index");
|
|
1747
1747
|
return { execute: ({
|
|
1748
|
-
projection:
|
|
1749
|
-
modelView:
|
|
1748
|
+
projection: E,
|
|
1749
|
+
modelView: v,
|
|
1750
1750
|
camera: T,
|
|
1751
|
-
screen:
|
|
1751
|
+
screen: M,
|
|
1752
1752
|
image: w,
|
|
1753
1753
|
range: R,
|
|
1754
1754
|
position: g,
|
|
1755
|
-
orientation:
|
|
1755
|
+
orientation: b,
|
|
1756
1756
|
index: S
|
|
1757
1757
|
}) => {
|
|
1758
|
-
a.use(), f.use(), l.set(
|
|
1758
|
+
a.use(), f.use(), l.set(E), h.set(v), u.set(T), d.set(M), _.set(R), x.set(g), p.set(b), A.set(S), e.activeTexture(e.TEXTURE0), m.set(0), w.use(), i.use(), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0);
|
|
1759
1759
|
} };
|
|
1760
1760
|
}, s = r(), o = r(!0);
|
|
1761
1761
|
return { renderProgram: s, depthProgram: o };
|
|
1762
|
-
},
|
|
1762
|
+
}, si = (e) => {
|
|
1763
1763
|
const t = e.createTexture();
|
|
1764
1764
|
if (!t)
|
|
1765
1765
|
throw new Error("Texture creation failed");
|
|
@@ -1771,7 +1771,7 @@ const Ci = (e, t = {}) => {
|
|
|
1771
1771
|
use: n,
|
|
1772
1772
|
dispose: () => e.deleteTexture(t)
|
|
1773
1773
|
};
|
|
1774
|
-
},
|
|
1774
|
+
}, Je = (e, t = 0) => ({
|
|
1775
1775
|
get: ([n = 0, i = 0, r = 0]) => {
|
|
1776
1776
|
for (let s = Math.min(r, t); s <= r; s++) {
|
|
1777
1777
|
const o = 2 ** s, c = [
|
|
@@ -1783,11 +1783,11 @@ const Ci = (e, t = {}) => {
|
|
|
1783
1783
|
return { texture: a, downsample: s };
|
|
1784
1784
|
}
|
|
1785
1785
|
}
|
|
1786
|
-
}), ue = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, Rt = /* @__PURE__ */ new Set(),
|
|
1787
|
-
typeof
|
|
1786
|
+
}), ue = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, Rt = /* @__PURE__ */ new Set(), et = typeof process == "object" && process ? process : {}, At = (e, t, n, i) => {
|
|
1787
|
+
typeof et.emitWarning == "function" ? et.emitWarning(e, t, n, i) : console.error(`[${n}] ${t}: ${e}`);
|
|
1788
1788
|
};
|
|
1789
|
-
let
|
|
1790
|
-
if (typeof
|
|
1789
|
+
let Ve = globalThis.AbortController, ht = globalThis.AbortSignal;
|
|
1790
|
+
if (typeof Ve > "u") {
|
|
1791
1791
|
ht = class {
|
|
1792
1792
|
onabort;
|
|
1793
1793
|
_onabort = [];
|
|
@@ -1796,7 +1796,7 @@ if (typeof je > "u") {
|
|
|
1796
1796
|
addEventListener(i, r) {
|
|
1797
1797
|
this._onabort.push(r);
|
|
1798
1798
|
}
|
|
1799
|
-
},
|
|
1799
|
+
}, Ve = class {
|
|
1800
1800
|
constructor() {
|
|
1801
1801
|
t();
|
|
1802
1802
|
}
|
|
@@ -1810,18 +1810,18 @@ if (typeof je > "u") {
|
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
1812
1812
|
};
|
|
1813
|
-
let e =
|
|
1813
|
+
let e = et.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
|
|
1814
1814
|
const t = () => {
|
|
1815
1815
|
e && (e = !1, At("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));
|
|
1816
1816
|
};
|
|
1817
1817
|
}
|
|
1818
|
-
const
|
|
1819
|
-
class
|
|
1818
|
+
const oi = (e) => !Rt.has(e), ee = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e), Mt = (e) => ee(e) ? e <= Math.pow(2, 8) ? Uint8Array : e <= Math.pow(2, 16) ? Uint16Array : e <= Math.pow(2, 32) ? Uint32Array : e <= Number.MAX_SAFE_INTEGER ? We : null : null;
|
|
1819
|
+
class We extends Array {
|
|
1820
1820
|
constructor(t) {
|
|
1821
1821
|
super(t), this.fill(0);
|
|
1822
1822
|
}
|
|
1823
1823
|
}
|
|
1824
|
-
class
|
|
1824
|
+
class ve {
|
|
1825
1825
|
heap;
|
|
1826
1826
|
length;
|
|
1827
1827
|
// private constructor
|
|
@@ -1830,12 +1830,12 @@ class me {
|
|
|
1830
1830
|
const n = Mt(t);
|
|
1831
1831
|
if (!n)
|
|
1832
1832
|
return [];
|
|
1833
|
-
|
|
1834
|
-
const i = new
|
|
1835
|
-
return
|
|
1833
|
+
ve.#c = !0;
|
|
1834
|
+
const i = new ve(t, n);
|
|
1835
|
+
return ve.#c = !1, i;
|
|
1836
1836
|
}
|
|
1837
1837
|
constructor(t, n) {
|
|
1838
|
-
if (!
|
|
1838
|
+
if (!ve.#c)
|
|
1839
1839
|
throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
1840
1840
|
this.heap = new n(t), this.length = 0;
|
|
1841
1841
|
}
|
|
@@ -1846,7 +1846,7 @@ class me {
|
|
|
1846
1846
|
return this.heap[--this.length];
|
|
1847
1847
|
}
|
|
1848
1848
|
}
|
|
1849
|
-
class
|
|
1849
|
+
class tt {
|
|
1850
1850
|
// properties coming in from the options of these, only max and maxSize
|
|
1851
1851
|
// really *need* to be protected. The rest can be modified, as they just
|
|
1852
1852
|
// set defaults for various methods.
|
|
@@ -2013,21 +2013,21 @@ class Je {
|
|
|
2013
2013
|
return this.#p;
|
|
2014
2014
|
}
|
|
2015
2015
|
constructor(t) {
|
|
2016
|
-
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:
|
|
2016
|
+
const { max: n = 0, ttl: i, ttlResolution: r = 1, ttlAutopurge: s, updateAgeOnGet: o, updateAgeOnHas: c, allowStale: a, dispose: f, disposeAfter: l, noDisposeOnSet: h, noUpdateTTL: u, maxSize: d = 0, maxEntrySize: m = 0, sizeCalculation: _, fetchMethod: x, noDeleteOnFetchRejection: p, noDeleteOnStaleGet: A, allowStaleOnFetchRejection: y, allowStaleOnFetchAbort: E, ignoreFetchAbort: v } = t;
|
|
2017
2017
|
if (n !== 0 && !ee(n))
|
|
2018
2018
|
throw new TypeError("max option must be a nonnegative integer");
|
|
2019
2019
|
const T = n ? Mt(n) : Array;
|
|
2020
2020
|
if (!T)
|
|
2021
2021
|
throw new Error("invalid max value: " + n);
|
|
2022
|
-
if (this.#c = n, this.#u = d, this.maxEntrySize =
|
|
2022
|
+
if (this.#c = n, this.#u = d, this.maxEntrySize = m || this.#u, this.sizeCalculation = _, this.sizeCalculation) {
|
|
2023
2023
|
if (!this.#u && !this.maxEntrySize)
|
|
2024
2024
|
throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
2025
2025
|
if (typeof this.sizeCalculation != "function")
|
|
2026
2026
|
throw new TypeError("sizeCalculation set to non-function");
|
|
2027
2027
|
}
|
|
2028
|
-
if (
|
|
2028
|
+
if (x !== void 0 && typeof x != "function")
|
|
2029
2029
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
2030
|
-
if (this.#U =
|
|
2030
|
+
if (this.#U = x, this.#A = !!x, this.#i = /* @__PURE__ */ new Map(), this.#n = new Array(n).fill(void 0), this.#e = new Array(n).fill(void 0), this.#f = new T(n), this.#h = new T(n), this.#a = 0, this.#s = 0, this.#E = ve.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.#T = !!this.#v, this.#l = !!this.#p, this.noDisposeOnSet = !!h, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!p, this.allowStaleOnFetchRejection = !!y, this.allowStaleOnFetchAbort = !!E, this.ignoreFetchAbort = !!v, this.maxEntrySize !== 0) {
|
|
2031
2031
|
if (this.#u !== 0 && !ee(this.#u))
|
|
2032
2032
|
throw new TypeError("maxSize must be a positive integer if specified");
|
|
2033
2033
|
if (!ee(this.maxEntrySize))
|
|
@@ -2042,8 +2042,8 @@ class Je {
|
|
|
2042
2042
|
if (this.#c === 0 && this.ttl === 0 && this.#u === 0)
|
|
2043
2043
|
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
2044
2044
|
if (!this.ttlAutopurge && !this.#c && !this.#u) {
|
|
2045
|
-
const
|
|
2046
|
-
|
|
2045
|
+
const M = "LRU_CACHE_UNBOUNDED";
|
|
2046
|
+
oi(M) && (Rt.add(M), At("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", M, tt));
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
2049
|
/**
|
|
@@ -2053,7 +2053,7 @@ class Je {
|
|
|
2053
2053
|
return this.#i.has(t) ? 1 / 0 : 0;
|
|
2054
2054
|
}
|
|
2055
2055
|
#N() {
|
|
2056
|
-
const t = new
|
|
2056
|
+
const t = new We(this.#c), n = new We(this.#c);
|
|
2057
2057
|
this.#d = t, this.#y = n, this.#I = (s, o, c = ue.now()) => {
|
|
2058
2058
|
if (n[s] = o !== 0 ? c : 0, t[s] = o, o !== 0 && this.ttlAutopurge) {
|
|
2059
2059
|
const a = setTimeout(() => {
|
|
@@ -2107,7 +2107,7 @@ class Je {
|
|
|
2107
2107
|
/* c8 ignore stop */
|
|
2108
2108
|
#m = () => !1;
|
|
2109
2109
|
#X() {
|
|
2110
|
-
const t = new
|
|
2110
|
+
const t = new We(this.#c);
|
|
2111
2111
|
this.#x = 0, this.#_ = t, this.#b = (n) => {
|
|
2112
2112
|
this.#x -= t[n], t[n] = 0;
|
|
2113
2113
|
}, this.#D = (n, i, r, s) => {
|
|
@@ -2434,7 +2434,7 @@ class Je {
|
|
|
2434
2434
|
const s = n === void 0 ? void 0 : this.#e[n];
|
|
2435
2435
|
if (this.#t(s))
|
|
2436
2436
|
return s;
|
|
2437
|
-
const o = new
|
|
2437
|
+
const o = new Ve(), { signal: c } = i;
|
|
2438
2438
|
c?.addEventListener("abort", () => o.abort(c.reason), {
|
|
2439
2439
|
signal: o.signal
|
|
2440
2440
|
});
|
|
@@ -2442,37 +2442,37 @@ class Je {
|
|
|
2442
2442
|
signal: o.signal,
|
|
2443
2443
|
options: i,
|
|
2444
2444
|
context: r
|
|
2445
|
-
}, f = (_,
|
|
2445
|
+
}, f = (_, x = !1) => {
|
|
2446
2446
|
const { aborted: p } = o.signal, A = i.ignoreFetchAbort && _ !== void 0;
|
|
2447
|
-
if (i.status && (p && !
|
|
2447
|
+
if (i.status && (p && !x ? (i.status.fetchAborted = !0, i.status.fetchError = o.signal.reason, A && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), p && !A && !x)
|
|
2448
2448
|
return h(o.signal.reason);
|
|
2449
2449
|
const y = d;
|
|
2450
2450
|
return this.#e[n] === d && (_ === void 0 ? y.__staleWhileFetching ? this.#e[n] = y.__staleWhileFetching : this.delete(t) : (i.status && (i.status.fetchUpdated = !0), this.set(t, _, a.options))), _;
|
|
2451
2451
|
}, l = (_) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = _), h(_)), h = (_) => {
|
|
2452
|
-
const { aborted:
|
|
2453
|
-
if (this.#e[n] === d && (!y ||
|
|
2454
|
-
return i.status &&
|
|
2455
|
-
if (
|
|
2452
|
+
const { aborted: x } = o.signal, p = x && i.allowStaleOnFetchAbort, A = p || i.allowStaleOnFetchRejection, y = A || i.noDeleteOnFetchRejection, E = d;
|
|
2453
|
+
if (this.#e[n] === d && (!y || E.__staleWhileFetching === void 0 ? this.delete(t) : p || (this.#e[n] = E.__staleWhileFetching)), A)
|
|
2454
|
+
return i.status && E.__staleWhileFetching !== void 0 && (i.status.returnedStale = !0), E.__staleWhileFetching;
|
|
2455
|
+
if (E.__returned === E)
|
|
2456
2456
|
throw _;
|
|
2457
|
-
}, u = (_,
|
|
2457
|
+
}, u = (_, x) => {
|
|
2458
2458
|
const p = this.#U?.(t, s, a);
|
|
2459
|
-
p && p instanceof Promise && p.then((A) => _(A === void 0 ? void 0 : A),
|
|
2459
|
+
p && p instanceof Promise && p.then((A) => _(A === void 0 ? void 0 : A), x), o.signal.addEventListener("abort", () => {
|
|
2460
2460
|
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (_(void 0), i.allowStaleOnFetchAbort && (_ = (A) => f(A, !0)));
|
|
2461
2461
|
});
|
|
2462
2462
|
};
|
|
2463
2463
|
i.status && (i.status.fetchDispatched = !0);
|
|
2464
|
-
const d = new Promise(u).then(f, l),
|
|
2464
|
+
const d = new Promise(u).then(f, l), m = Object.assign(d, {
|
|
2465
2465
|
__abortController: o,
|
|
2466
2466
|
__staleWhileFetching: s,
|
|
2467
2467
|
__returned: void 0
|
|
2468
2468
|
});
|
|
2469
|
-
return n === void 0 ? (this.set(t,
|
|
2469
|
+
return n === void 0 ? (this.set(t, m, { ...a.options, status: void 0 }), n = this.#i.get(t)) : this.#e[n] = m, m;
|
|
2470
2470
|
}
|
|
2471
2471
|
#t(t) {
|
|
2472
2472
|
if (!this.#A)
|
|
2473
2473
|
return !1;
|
|
2474
2474
|
const n = t;
|
|
2475
|
-
return !!n && n instanceof Promise && n.hasOwnProperty("__staleWhileFetching") && n.__abortController instanceof
|
|
2475
|
+
return !!n && n instanceof Promise && n.hasOwnProperty("__staleWhileFetching") && n.__abortController instanceof Ve;
|
|
2476
2476
|
}
|
|
2477
2477
|
async fetch(t, n = {}) {
|
|
2478
2478
|
const {
|
|
@@ -2490,9 +2490,9 @@ class Je {
|
|
|
2490
2490
|
noDeleteOnFetchRejection: h = this.noDeleteOnFetchRejection,
|
|
2491
2491
|
allowStaleOnFetchRejection: u = this.allowStaleOnFetchRejection,
|
|
2492
2492
|
ignoreFetchAbort: d = this.ignoreFetchAbort,
|
|
2493
|
-
allowStaleOnFetchAbort:
|
|
2493
|
+
allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort,
|
|
2494
2494
|
context: _,
|
|
2495
|
-
forceRefresh:
|
|
2495
|
+
forceRefresh: x = !1,
|
|
2496
2496
|
status: p,
|
|
2497
2497
|
signal: A
|
|
2498
2498
|
} = n;
|
|
@@ -2514,27 +2514,27 @@ class Je {
|
|
|
2514
2514
|
noUpdateTTL: l,
|
|
2515
2515
|
noDeleteOnFetchRejection: h,
|
|
2516
2516
|
allowStaleOnFetchRejection: u,
|
|
2517
|
-
allowStaleOnFetchAbort:
|
|
2517
|
+
allowStaleOnFetchAbort: m,
|
|
2518
2518
|
ignoreFetchAbort: d,
|
|
2519
2519
|
status: p,
|
|
2520
2520
|
signal: A
|
|
2521
2521
|
};
|
|
2522
|
-
let
|
|
2523
|
-
if (
|
|
2522
|
+
let E = this.#i.get(t);
|
|
2523
|
+
if (E === void 0) {
|
|
2524
2524
|
p && (p.fetch = "miss");
|
|
2525
|
-
const
|
|
2526
|
-
return
|
|
2525
|
+
const v = this.#L(t, E, y, _);
|
|
2526
|
+
return v.__returned = v;
|
|
2527
2527
|
} else {
|
|
2528
|
-
const
|
|
2529
|
-
if (this.#t(
|
|
2530
|
-
const g = i &&
|
|
2531
|
-
return p && (p.fetch = "inflight", g && (p.returnedStale = !0)), g ?
|
|
2528
|
+
const v = this.#e[E];
|
|
2529
|
+
if (this.#t(v)) {
|
|
2530
|
+
const g = i && v.__staleWhileFetching !== void 0;
|
|
2531
|
+
return p && (p.fetch = "inflight", g && (p.returnedStale = !0)), g ? v.__staleWhileFetching : v.__returned = v;
|
|
2532
2532
|
}
|
|
2533
|
-
const T = this.#m(
|
|
2534
|
-
if (!
|
|
2535
|
-
return p && (p.fetch = "hit"), this.#S(
|
|
2536
|
-
const
|
|
2537
|
-
return p && (p.fetch = T ? "stale" : "refresh", R && T && (p.returnedStale = !0)), R ?
|
|
2533
|
+
const T = this.#m(E);
|
|
2534
|
+
if (!x && !T)
|
|
2535
|
+
return p && (p.fetch = "hit"), this.#S(E), r && this.#M(E), p && this.#R(p, E), v;
|
|
2536
|
+
const M = this.#L(t, E, y, _), R = M.__staleWhileFetching !== void 0 && i;
|
|
2537
|
+
return p && (p.fetch = T ? "stale" : "refresh", R && T && (p.returnedStale = !0)), R ? M.__staleWhileFetching : M.__returned = M;
|
|
2538
2538
|
}
|
|
2539
2539
|
}
|
|
2540
2540
|
/**
|
|
@@ -2613,8 +2613,8 @@ class Je {
|
|
|
2613
2613
|
}
|
|
2614
2614
|
}
|
|
2615
2615
|
}
|
|
2616
|
-
const
|
|
2617
|
-
const t = new
|
|
2616
|
+
const Ze = (e) => {
|
|
2617
|
+
const t = new tt({
|
|
2618
2618
|
...e,
|
|
2619
2619
|
ttlResolution: 0,
|
|
2620
2620
|
dispose: (r, s) => e.dispose?.(r, i(s))
|
|
@@ -2631,40 +2631,40 @@ const Be = (e) => {
|
|
|
2631
2631
|
clear: () => t.clear(),
|
|
2632
2632
|
purgeStale: () => t.purgeStale()
|
|
2633
2633
|
};
|
|
2634
|
-
},
|
|
2634
|
+
}, ai = 15, ie = 256, ci = ({
|
|
2635
2635
|
gl: e,
|
|
2636
2636
|
terrainCache: t
|
|
2637
2637
|
}) => {
|
|
2638
|
-
const n =
|
|
2638
|
+
const n = Ze({
|
|
2639
2639
|
max: 1e3
|
|
2640
|
-
}), i =
|
|
2640
|
+
}), i = Je(t), r = e.createFramebuffer();
|
|
2641
2641
|
if (!r)
|
|
2642
2642
|
throw new Error("Framebuffer creation failed");
|
|
2643
2643
|
const s = ([a = 0, f = 0, l = 0]) => {
|
|
2644
2644
|
const h = i.get([a, f, l]);
|
|
2645
2645
|
if (!h)
|
|
2646
2646
|
return;
|
|
2647
|
-
const { texture: u, downsample: d } = h,
|
|
2648
|
-
if (
|
|
2649
|
-
return { buffer:
|
|
2647
|
+
const { texture: u, downsample: d } = h, m = 2 ** d, _ = [Math.floor(a / m), Math.floor(f / m), l - d], x = n.get(_);
|
|
2648
|
+
if (x)
|
|
2649
|
+
return { buffer: x, downsample: d };
|
|
2650
2650
|
const p = new Uint8Array(4 * ie * ie);
|
|
2651
2651
|
return e.bindFramebuffer(e.FRAMEBUFFER, r), u.attach(), e.readPixels(0, 0, ie, ie, e.RGBA, e.UNSIGNED_BYTE, p), e.bindFramebuffer(e.FRAMEBUFFER, null), n.set(_, p), { buffer: p, downsample: d };
|
|
2652
2652
|
};
|
|
2653
|
-
return { get: ([a = 0, f = 0], l =
|
|
2654
|
-
const h = 2 ** l, u = z([a, f, 0]).map((g) => g * h), [d = 0,
|
|
2655
|
-
let [_ = 0,
|
|
2656
|
-
const p = s([d,
|
|
2653
|
+
return { get: ([a = 0, f = 0], l = ai) => {
|
|
2654
|
+
const h = 2 ** l, u = z([a, f, 0]).map((g) => g * h), [d = 0, m = 0] = u.map((g) => Math.floor(g % h));
|
|
2655
|
+
let [_ = 0, x = 0] = u.map((g) => g % 1);
|
|
2656
|
+
const p = s([d, m, l]);
|
|
2657
2657
|
if (!p)
|
|
2658
2658
|
return 0;
|
|
2659
|
-
const { buffer: A, downsample: y } = p,
|
|
2660
|
-
[_,
|
|
2661
|
-
const
|
|
2662
|
-
return (T * 65536 +
|
|
2659
|
+
const { buffer: A, downsample: y } = p, E = 2 ** y;
|
|
2660
|
+
[_, x] = [(d % E + _) / E, (m % E + x) / E];
|
|
2661
|
+
const v = 4 * ie * Math.floor(x * ie) + 4 * Math.floor(_ * ie), [T = 0, M = 0, w = 0] = A.slice(v, v + 4);
|
|
2662
|
+
return (T * 65536 + M * 256 + w) / 10 - 1e4;
|
|
2663
2663
|
}, dispose: () => {
|
|
2664
2664
|
e.deleteFramebuffer(r);
|
|
2665
2665
|
} };
|
|
2666
2666
|
};
|
|
2667
|
-
var
|
|
2667
|
+
var fi = `#version 300 es
|
|
2668
2668
|
|
|
2669
2669
|
precision highp float;
|
|
2670
2670
|
|
|
@@ -2681,10 +2681,10 @@ const dt = ({
|
|
|
2681
2681
|
urlPattern: t,
|
|
2682
2682
|
onLoad: n
|
|
2683
2683
|
}) => {
|
|
2684
|
-
const i =
|
|
2684
|
+
const i = Ze({
|
|
2685
2685
|
max: 2e3,
|
|
2686
2686
|
dispose: (a) => a.dispose()
|
|
2687
|
-
}), r =
|
|
2687
|
+
}), r = Ze({
|
|
2688
2688
|
max: 1e4,
|
|
2689
2689
|
ttl: 200,
|
|
2690
2690
|
dispose: (a, f) => {
|
|
@@ -2701,30 +2701,30 @@ const dt = ({
|
|
|
2701
2701
|
const [l = 0, h = 0, u = 0] = a;
|
|
2702
2702
|
let d = t.replace("{x}", `${l}`).replace("{y}", `${h}`).replace("{z}", `${u}`);
|
|
2703
2703
|
if (d.includes("{bbox}")) {
|
|
2704
|
-
const [_ = 0,
|
|
2704
|
+
const [_ = 0, x = 0, p = 0] = a, A = 2 ** p - x - 1, [[y, E] = [], [v, T] = []] = [
|
|
2705
2705
|
[0, 0],
|
|
2706
2706
|
[1, 1]
|
|
2707
|
-
].map(([
|
|
2708
|
-
(
|
|
2707
|
+
].map(([M = 0, w = 0]) => [_ + M, A + w, p]).map((M) => pt(M, M)).map(([M = 0, w = 0]) => [
|
|
2708
|
+
(M - 0.5) * 2 * Math.PI * 6378137,
|
|
2709
2709
|
(w - 0.5) * 2 * Math.PI * 6378137
|
|
2710
2710
|
]);
|
|
2711
|
-
d = d.replace("{bbox}", [y,
|
|
2711
|
+
d = d.replace("{bbox}", [y, E, v, T].join(","));
|
|
2712
2712
|
}
|
|
2713
|
-
const
|
|
2713
|
+
const m = yt({
|
|
2714
2714
|
gl: e,
|
|
2715
2715
|
url: d,
|
|
2716
2716
|
onLoad: () => {
|
|
2717
2717
|
r.delete(a), n?.();
|
|
2718
2718
|
}
|
|
2719
2719
|
});
|
|
2720
|
-
i.set(a,
|
|
2720
|
+
i.set(a, m), r.set(a, !0);
|
|
2721
2721
|
}
|
|
2722
2722
|
}, o = setInterval(() => r.purgeStale(), 200);
|
|
2723
2723
|
return { get: s, dispose: () => {
|
|
2724
2724
|
clearInterval(o), i.clear();
|
|
2725
2725
|
} };
|
|
2726
|
-
},
|
|
2727
|
-
const t =
|
|
2726
|
+
}, li = (e) => {
|
|
2727
|
+
const t = Ze({
|
|
2728
2728
|
max: 1e4,
|
|
2729
2729
|
ttl: 1e3
|
|
2730
2730
|
}), n = [
|
|
@@ -2740,14 +2740,14 @@ const dt = ({
|
|
|
2740
2740
|
const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0, h = 0]) => [o + l, c + h, a]).map((l) => pt(l, l)).map((l) => oe(l, l)).map((l) => {
|
|
2741
2741
|
const [h = 0, u = 0] = l, d = Math.max(a - 5, 0);
|
|
2742
2742
|
return z(
|
|
2743
|
-
|
|
2743
|
+
Se(l, h, u, e.get([h, u], d)),
|
|
2744
2744
|
l
|
|
2745
2745
|
);
|
|
2746
2746
|
});
|
|
2747
2747
|
return t.set(r, f), f;
|
|
2748
2748
|
} };
|
|
2749
2749
|
};
|
|
2750
|
-
var
|
|
2750
|
+
var ui = `#version 300 es
|
|
2751
2751
|
|
|
2752
2752
|
precision highp float;
|
|
2753
2753
|
|
|
@@ -2784,7 +2784,7 @@ void main(void) {
|
|
|
2784
2784
|
uv = downsample(downsample_imagery);
|
|
2785
2785
|
color_out = color;
|
|
2786
2786
|
}`;
|
|
2787
|
-
const B = 34,
|
|
2787
|
+
const B = 34, hi = 22, di = xe(0, B).flatMap(
|
|
2788
2788
|
(e) => xe(0, B).flatMap((t) => [
|
|
2789
2789
|
e * (B + 1) + t,
|
|
2790
2790
|
e * (B + 1) + t + 1,
|
|
@@ -2793,10 +2793,10 @@ const B = 34, mi = 22, vi = xe(0, B).flatMap(
|
|
|
2793
2793
|
(e + 1) * (B + 1) + t + 1,
|
|
2794
2794
|
(e + 1) * (B + 1) + t
|
|
2795
2795
|
])
|
|
2796
|
-
),
|
|
2796
|
+
), Oe = 0.1, mi = xe(0, B + 1).flatMap(
|
|
2797
2797
|
(e) => xe(0, B + 1).map((t) => {
|
|
2798
2798
|
let n = (t - 1) / (B - 2), i = (e - 1) / (B - 2), r = 0;
|
|
2799
|
-
return t === 0 && (n = 0, r = -
|
|
2799
|
+
return t === 0 && (n = 0, r = -Oe), t === B && (n = 1, r = -Oe), e === 0 && (i = 0, r = -Oe), e === B && (i = 1, r = -Oe), [n, i, r];
|
|
2800
2800
|
})
|
|
2801
2801
|
), ji = (e, t = {}) => {
|
|
2802
2802
|
const { gl: n } = e;
|
|
@@ -2820,7 +2820,7 @@ const B = 34, mi = 22, vi = xe(0, B).flatMap(
|
|
|
2820
2820
|
n.LINEAR_MIPMAP_LINEAR
|
|
2821
2821
|
), 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), n.generateMipmap(n.TEXTURE_2D);
|
|
2822
2822
|
}
|
|
2823
|
-
}), r =
|
|
2823
|
+
}), r = Je(i);
|
|
2824
2824
|
}
|
|
2825
2825
|
), a = t.terrainUrl?.() ?? "", f = dt({
|
|
2826
2826
|
gl: n,
|
|
@@ -2828,100 +2828,100 @@ const B = 34, mi = 22, vi = xe(0, B).flatMap(
|
|
|
2828
2828
|
onLoad: () => {
|
|
2829
2829
|
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);
|
|
2830
2830
|
}
|
|
2831
|
-
}), l =
|
|
2832
|
-
d.set(
|
|
2833
|
-
const
|
|
2834
|
-
|
|
2835
|
-
const { renderProgram: _, depthProgram:
|
|
2831
|
+
}), l = Je(f, 3), h = ci({ gl: n, terrainCache: f }), u = li(h), d = V({ gl: n, type: "f32", target: "array" });
|
|
2832
|
+
d.set(mi.flatMap(([R = 0, g = 0, b = 0]) => [R, g, b]));
|
|
2833
|
+
const m = V({ gl: n, type: "u16", target: "element" });
|
|
2834
|
+
m.set(di);
|
|
2835
|
+
const { renderProgram: _, depthProgram: x } = vi(e, {
|
|
2836
2836
|
uvwBuffer: d,
|
|
2837
|
-
indexBuffer:
|
|
2838
|
-
}), p = [0, 1, 2, 3], A = p.map(L), y = p.map(ne),
|
|
2839
|
-
const { camera: g, worldToLocal:
|
|
2840
|
-
const [
|
|
2841
|
-
let j =
|
|
2837
|
+
indexBuffer: m
|
|
2838
|
+
}), p = [0, 1, 2, 3], A = p.map(L), y = p.map(ne), E = p.map(pe), v = (R) => {
|
|
2839
|
+
const { camera: g, worldToLocal: b, localToClip: S, clipToScreen: U } = R, P = (D) => {
|
|
2840
|
+
const [O = 0, X = 0, I = 0] = D, W = u.get(D);
|
|
2841
|
+
let j = pi(g, W);
|
|
2842
2842
|
if (!j) {
|
|
2843
|
-
const
|
|
2844
|
-
if (
|
|
2843
|
+
const Y = W.map(($, Q) => b($, A[Q])).map(($, Q) => S($, y[Q]));
|
|
2844
|
+
if (xi(Y))
|
|
2845
2845
|
return [];
|
|
2846
|
-
j =
|
|
2846
|
+
j = Ei(Y.map(($, Q) => U($, E[Q]))) > 512 / devicePixelRatio;
|
|
2847
2847
|
}
|
|
2848
|
-
return j &&
|
|
2849
|
-
[2 *
|
|
2850
|
-
[2 *
|
|
2851
|
-
[2 *
|
|
2852
|
-
[2 *
|
|
2853
|
-
].flatMap((J) => P(J)) : [
|
|
2848
|
+
return j && I < hi ? [
|
|
2849
|
+
[2 * O, 2 * X, I + 1],
|
|
2850
|
+
[2 * O + 1, 2 * X, I + 1],
|
|
2851
|
+
[2 * O, 2 * X + 1, I + 1],
|
|
2852
|
+
[2 * O + 1, 2 * X + 1, I + 1]
|
|
2853
|
+
].flatMap((J) => P(J)) : [D];
|
|
2854
2854
|
};
|
|
2855
2855
|
return P([0, 0, 0]);
|
|
2856
2856
|
}, T = ({
|
|
2857
2857
|
viewport: R,
|
|
2858
2858
|
depth: g = !1,
|
|
2859
|
-
index:
|
|
2859
|
+
index: b = 0
|
|
2860
2860
|
}) => {
|
|
2861
2861
|
const S = t.color?.() ?? [1, 1, 1, 1];
|
|
2862
2862
|
if (c(), Ee(n, g, t))
|
|
2863
2863
|
return;
|
|
2864
|
-
const U = g ?
|
|
2865
|
-
for (const
|
|
2866
|
-
const W = g ? void 0 : r?.get(
|
|
2864
|
+
const U = g ? x : _, { projection: P, modelView: D, camera: O } = R, X = v(R);
|
|
2865
|
+
for (const I of X) {
|
|
2866
|
+
const W = g ? void 0 : r?.get(I), j = l.get(I);
|
|
2867
2867
|
if (!g && !W || !j)
|
|
2868
2868
|
continue;
|
|
2869
|
-
const { texture:
|
|
2869
|
+
const { texture: Y, downsample: J } = j, { texture: $ = Y, downsample: Q = 0 } = W ?? {};
|
|
2870
2870
|
U.execute({
|
|
2871
2871
|
projection: P,
|
|
2872
|
-
modelView:
|
|
2873
|
-
camera: q(
|
|
2874
|
-
xyz:
|
|
2875
|
-
imagery:
|
|
2876
|
-
terrain:
|
|
2877
|
-
downsampleImagery:
|
|
2872
|
+
modelView: D,
|
|
2873
|
+
camera: q(O),
|
|
2874
|
+
xyz: I,
|
|
2875
|
+
imagery: $,
|
|
2876
|
+
terrain: Y,
|
|
2877
|
+
downsampleImagery: Q,
|
|
2878
2878
|
downsampleTerrain: J,
|
|
2879
2879
|
color: S,
|
|
2880
|
-
index:
|
|
2880
|
+
index: b
|
|
2881
2881
|
});
|
|
2882
2882
|
}
|
|
2883
|
-
},
|
|
2883
|
+
}, M = () => {
|
|
2884
2884
|
i?.dispose(), f.dispose(), h.dispose();
|
|
2885
2885
|
}, w = ye(t);
|
|
2886
2886
|
return {
|
|
2887
2887
|
render: T,
|
|
2888
|
-
dispose:
|
|
2888
|
+
dispose: M,
|
|
2889
2889
|
...w
|
|
2890
2890
|
};
|
|
2891
|
-
},
|
|
2891
|
+
}, vi = ({ gl: e, programs: t }, { uvwBuffer: n, indexBuffer: i }) => {
|
|
2892
2892
|
const r = (c = !1) => {
|
|
2893
2893
|
const a = t.get({
|
|
2894
|
-
vertexSource:
|
|
2895
|
-
fragmentSource: c ? _e :
|
|
2896
|
-
}), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform1i("imagery"), d = a.uniform1i("terrain"),
|
|
2894
|
+
vertexSource: ui,
|
|
2895
|
+
fragmentSource: c ? _e : fi
|
|
2896
|
+
}), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform1i("imagery"), d = a.uniform1i("terrain"), m = a.uniform1i("downsample_imagery"), _ = a.uniform1i("downsample_terrain"), x = a.uniform4f("color"), p = a.uniform3i("xyz"), A = a.uniform3i("camera"), y = a.uniform1i("index");
|
|
2897
2897
|
return { execute: ({
|
|
2898
|
-
projection:
|
|
2898
|
+
projection: v,
|
|
2899
2899
|
modelView: T,
|
|
2900
|
-
camera:
|
|
2900
|
+
camera: M,
|
|
2901
2901
|
xyz: w,
|
|
2902
2902
|
imagery: R,
|
|
2903
2903
|
terrain: g,
|
|
2904
|
-
downsampleImagery:
|
|
2904
|
+
downsampleImagery: b,
|
|
2905
2905
|
downsampleTerrain: S,
|
|
2906
2906
|
color: U,
|
|
2907
2907
|
index: P
|
|
2908
2908
|
}) => {
|
|
2909
|
-
a.use(), f.use(), l.set(
|
|
2909
|
+
a.use(), f.use(), l.set(v), h.set(T), p.set(w), A.set(M), m.set(b), _.set(S), x.set(U), y.set(P), e.activeTexture(e.TEXTURE0), u.set(0), R.use(), e.activeTexture(e.TEXTURE1), d.set(1), g.use(), i.use(), e.drawElements(e.TRIANGLES, B * B * 2 * 3, e.UNSIGNED_SHORT, 0);
|
|
2910
2910
|
} };
|
|
2911
2911
|
}, s = r(), o = r(!0);
|
|
2912
2912
|
return { renderProgram: s, depthProgram: o };
|
|
2913
|
-
},
|
|
2913
|
+
}, pi = (e, t) => {
|
|
2914
2914
|
const [n, i, r, s] = t.reduce(
|
|
2915
|
-
([f, l, h, u], [d = 0,
|
|
2915
|
+
([f, l, h, u], [d = 0, m = 0]) => [
|
|
2916
2916
|
Math.min(d, f),
|
|
2917
2917
|
Math.max(d, l),
|
|
2918
|
-
Math.min(
|
|
2919
|
-
Math.max(
|
|
2918
|
+
Math.min(m, h),
|
|
2919
|
+
Math.max(m, u)
|
|
2920
2920
|
],
|
|
2921
2921
|
[1, 0, 1, 0]
|
|
2922
2922
|
), [o = 0, c = 0, a = 0] = e;
|
|
2923
2923
|
return o > n && o < i && c > r && c < s && a > 0 && a < i - n;
|
|
2924
|
-
},
|
|
2924
|
+
}, xi = (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), Ei = (e) => Math.sqrt(
|
|
2925
2925
|
e.map(
|
|
2926
2926
|
(t, n) => vn(
|
|
2927
2927
|
e[n] ?? [0, 0],
|
|
@@ -2975,7 +2975,7 @@ const B = 34, mi = 22, vi = xe(0, B).flatMap(
|
|
|
2975
2975
|
onDragStart: o,
|
|
2976
2976
|
onDragEnd: c
|
|
2977
2977
|
};
|
|
2978
|
-
},
|
|
2978
|
+
}, $e = 10, Pe = 1e-3, fe = (e) => (t) => {
|
|
2979
2979
|
let n, i;
|
|
2980
2980
|
return () => {
|
|
2981
2981
|
const r = performance.now(), s = (r - (i ?? r)) / 1e3;
|
|
@@ -2983,39 +2983,39 @@ const B = 34, mi = 22, vi = xe(0, B).flatMap(
|
|
|
2983
2983
|
const o = t();
|
|
2984
2984
|
return n = n ?? o, n = e({ time: s, current: n, target: o }), n;
|
|
2985
2985
|
};
|
|
2986
|
-
},
|
|
2987
|
-
({ time: e, current: t, target: n }) => (Math.abs(n - t) <
|
|
2988
|
-
),
|
|
2989
|
-
({ time: e, current: t, target: n }) => (mn(t, n) <
|
|
2986
|
+
}, _i = fe(
|
|
2987
|
+
({ time: e, current: t, target: n }) => (Math.abs(n - t) < Pe ? t = n : t = t + (n - t) * (1 - Math.exp(-$e * e)), t)
|
|
2988
|
+
), yi = fe(
|
|
2989
|
+
({ time: e, current: t, target: n }) => (mn(t, n) < Pe ? fn(t, n) : t = un(
|
|
2990
2990
|
pe(),
|
|
2991
2991
|
t,
|
|
2992
2992
|
dn(
|
|
2993
2993
|
pe(),
|
|
2994
2994
|
pn(pe(), n, t),
|
|
2995
|
-
1 - Math.exp(
|
|
2995
|
+
1 - Math.exp(-$e * e)
|
|
2996
2996
|
)
|
|
2997
2997
|
), t)
|
|
2998
2998
|
), Zi = fe(
|
|
2999
|
-
({ time: e, current: t, target: n }) => (en(t, n) <
|
|
2999
|
+
({ time: e, current: t, target: n }) => (en(t, n) < Pe ? Qt(t, n) : t = Kt(
|
|
3000
3000
|
ne(),
|
|
3001
3001
|
t,
|
|
3002
3002
|
Jt(
|
|
3003
3003
|
ne(),
|
|
3004
3004
|
rn(ne(), n, t),
|
|
3005
|
-
1 - Math.exp(
|
|
3005
|
+
1 - Math.exp(-$e * e)
|
|
3006
3006
|
)
|
|
3007
3007
|
), t)
|
|
3008
3008
|
), Yi = fe(
|
|
3009
3009
|
({ time: e, current: t, target: n }) => {
|
|
3010
|
-
const i =
|
|
3011
|
-
return i *
|
|
3010
|
+
const i = Ue(z(t), z(n));
|
|
3011
|
+
return i * F < Pe || i > 1e5 / F ? Yt(t, n) : t = oe(
|
|
3012
3012
|
re(
|
|
3013
3013
|
L(),
|
|
3014
3014
|
z(t),
|
|
3015
|
-
|
|
3015
|
+
de(
|
|
3016
3016
|
L(),
|
|
3017
3017
|
se(L(), z(n), z(t)),
|
|
3018
|
-
1 - Math.exp(
|
|
3018
|
+
1 - Math.exp(-$e * e)
|
|
3019
3019
|
)
|
|
3020
3020
|
)
|
|
3021
3021
|
), t;
|
|
@@ -3023,17 +3023,18 @@ const B = 34, mi = 22, vi = xe(0, B).flatMap(
|
|
|
3023
3023
|
), $i = (e) => {
|
|
3024
3024
|
let t = [0, 0, 0], n = [0, 0, 0], i, r;
|
|
3025
3025
|
return fe(({ time: o, current: c, target: a }) => {
|
|
3026
|
-
if (a === c || o > 1 ||
|
|
3026
|
+
if (a === c || o > 1 || Ue(z(a), z(c)) > 1e3 / F)
|
|
3027
3027
|
return i = void 0, t = [0, 0, 0], n = [0, 0, 0], a;
|
|
3028
|
-
|
|
3028
|
+
const f = performance.now();
|
|
3029
|
+
i ? a !== i && r !== void 0 && f - r > 1 && (n = de(
|
|
3029
3030
|
L(),
|
|
3030
3031
|
se(L(), z(a), z(i)),
|
|
3031
|
-
1e3 / (
|
|
3032
|
-
), i = a, r =
|
|
3033
|
-
const
|
|
3032
|
+
1e3 / (f - r)
|
|
3033
|
+
), i = a, r = f) : (i = a, r = o);
|
|
3034
|
+
const l = re(
|
|
3034
3035
|
L(),
|
|
3035
3036
|
t,
|
|
3036
|
-
|
|
3037
|
+
de(
|
|
3037
3038
|
L(),
|
|
3038
3039
|
se(L(), n, t),
|
|
3039
3040
|
2 * o
|
|
@@ -3045,39 +3046,39 @@ const B = 34, mi = 22, vi = xe(0, B).flatMap(
|
|
|
3045
3046
|
z(c),
|
|
3046
3047
|
re(
|
|
3047
3048
|
L(),
|
|
3048
|
-
|
|
3049
|
+
de(
|
|
3049
3050
|
L(),
|
|
3050
|
-
re(L(), t,
|
|
3051
|
+
re(L(), t, l),
|
|
3051
3052
|
0.5 * o
|
|
3052
3053
|
),
|
|
3053
|
-
|
|
3054
|
+
de(
|
|
3054
3055
|
L(),
|
|
3055
3056
|
se(L(), z(a), z(c)),
|
|
3056
3057
|
o
|
|
3057
3058
|
)
|
|
3058
3059
|
)
|
|
3059
3060
|
)
|
|
3060
|
-
), t =
|
|
3061
|
+
), t = l, c;
|
|
3061
3062
|
})(e);
|
|
3062
|
-
},
|
|
3063
|
+
}, Ti = fe(
|
|
3063
3064
|
({ time: e, current: t, target: n }) => (t = yn(
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3065
|
+
Ce(
|
|
3066
|
+
Ke(),
|
|
3067
|
+
Le(t),
|
|
3068
|
+
Le(n),
|
|
3069
|
+
2 * e
|
|
3069
3070
|
)
|
|
3070
|
-
), on(
|
|
3071
|
-
),
|
|
3072
|
-
const t =
|
|
3071
|
+
), on(Le(t), Le(n)) < Pe && (n = t), t)
|
|
3072
|
+
), wi = 10, ki = (e) => {
|
|
3073
|
+
const t = Ti(() => e().orientation), n = yi(() => e().offset), i = _i(() => e().fieldOfView);
|
|
3073
3074
|
return fe(({ time: s, current: o, target: c }) => {
|
|
3074
|
-
const a =
|
|
3075
|
+
const a = Ue(z(o.target), z(c.target)) * F, f = Math.max(c.distance, a), l = 1 - Math.exp(-wi * s), h = Math.exp(
|
|
3075
3076
|
Math.log(o.distance) + (Math.log(f) - Math.log(o.distance)) * l
|
|
3076
3077
|
), u = o.distance > a ? 1 : o.distance / a, d = oe(
|
|
3077
3078
|
re(
|
|
3078
3079
|
L(),
|
|
3079
3080
|
z(o.target),
|
|
3080
|
-
|
|
3081
|
+
de(
|
|
3081
3082
|
L(),
|
|
3082
3083
|
se(
|
|
3083
3084
|
L(),
|
|
@@ -3097,7 +3098,7 @@ const B = 34, mi = 22, vi = xe(0, B).flatMap(
|
|
|
3097
3098
|
fieldOfView: i()
|
|
3098
3099
|
};
|
|
3099
3100
|
})(e);
|
|
3100
|
-
},
|
|
3101
|
+
}, gi = (e) => {
|
|
3101
3102
|
const t = e.createTexture();
|
|
3102
3103
|
e.bindTexture(e.TEXTURE_2D, t), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE);
|
|
3103
3104
|
const n = e.createRenderbuffer();
|
|
@@ -3139,14 +3140,14 @@ const B = 34, mi = 22, vi = xe(0, B).flatMap(
|
|
|
3139
3140
|
resize: o,
|
|
3140
3141
|
read: ([l = 0, h = 0]) => {
|
|
3141
3142
|
r(), e.readPixels(l, s - h, 1, 1, e.RGBA, e.UNSIGNED_BYTE, c), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
3142
|
-
const [u = 0, d = 0,
|
|
3143
|
+
const [u = 0, d = 0, m = 0, _ = 0] = c, p = 2 * ((u * 256 + d) / (256 * 256 - 1)) - 1, A = m * 256 + _;
|
|
3143
3144
|
return [p, A];
|
|
3144
3145
|
},
|
|
3145
3146
|
dispose: () => {
|
|
3146
3147
|
e.deleteTexture(t), e.deleteFramebuffer(i), e.deleteRenderbuffer(n);
|
|
3147
3148
|
}
|
|
3148
3149
|
};
|
|
3149
|
-
},
|
|
3150
|
+
}, Ri = (e, {
|
|
3150
3151
|
view: t,
|
|
3151
3152
|
screen: n,
|
|
3152
3153
|
pick: i
|
|
@@ -3155,39 +3156,39 @@ const B = 34, mi = 22, vi = xe(0, B).flatMap(
|
|
|
3155
3156
|
let s = !1, o, c;
|
|
3156
3157
|
const a = () => {
|
|
3157
3158
|
s = !0;
|
|
3158
|
-
}, f = (
|
|
3159
|
-
const { x: _, y:
|
|
3159
|
+
}, f = (m) => {
|
|
3160
|
+
const { x: _, y: x, movementX: p, movementY: A } = m;
|
|
3160
3161
|
if (o) {
|
|
3161
3162
|
if (o.onDrag) {
|
|
3162
|
-
const { point: y, position:
|
|
3163
|
-
o.onDrag({ point: y, position:
|
|
3163
|
+
const { point: y, position: E, layer: v } = i([_, x], { terrain: !0 });
|
|
3164
|
+
o.onDrag({ point: y, position: E, layer: v });
|
|
3164
3165
|
}
|
|
3165
3166
|
if (o.onDragFlat) {
|
|
3166
|
-
const
|
|
3167
|
-
o.onDragFlat({ point: [_,
|
|
3167
|
+
const E = te(t(), n()).unproject([_, x], { targetZ: c });
|
|
3168
|
+
o.onDragFlat({ point: [_, x], position: E, layer: void 0 });
|
|
3168
3169
|
}
|
|
3169
3170
|
return;
|
|
3170
3171
|
}
|
|
3171
3172
|
if (s && (Math.abs(p) > 1 || Math.abs(A) > 1)) {
|
|
3172
3173
|
s = !1;
|
|
3173
|
-
const { point: y, position:
|
|
3174
|
-
(
|
|
3174
|
+
const { point: y, position: E, layer: v } = i([_, x]);
|
|
3175
|
+
(v?.onDrag || v?.onDragFlat) && (o = v, o.onDragStart?.({ point: y, position: E, layer: v }), [, , c] = E);
|
|
3175
3176
|
}
|
|
3176
|
-
}, l = (
|
|
3177
|
-
if (s && h(
|
|
3178
|
-
const { x: _, y:
|
|
3177
|
+
}, l = (m) => {
|
|
3178
|
+
if (s && h(m), s = !1, o) {
|
|
3179
|
+
const { x: _, y: x } = m, { point: p, position: A, layer: y } = i([_, x]);
|
|
3179
3180
|
o.onDragEnd?.({ point: p, position: A, layer: y });
|
|
3180
3181
|
}
|
|
3181
3182
|
o = void 0;
|
|
3182
|
-
}, h = (
|
|
3183
|
-
const { x: _, y:
|
|
3184
|
-
(p === 2 ?
|
|
3185
|
-
{ point: A, position: y, layer:
|
|
3186
|
-
|
|
3183
|
+
}, h = (m) => {
|
|
3184
|
+
const { x: _, y: x, button: p } = m, { point: A, position: y, layer: E } = i([_, x]);
|
|
3185
|
+
(p === 2 ? E?.onRightClick : E?.onClick)?.(
|
|
3186
|
+
{ point: A, position: y, layer: E },
|
|
3187
|
+
m
|
|
3187
3188
|
);
|
|
3188
|
-
}, u = ({ x:
|
|
3189
|
-
const { point:
|
|
3190
|
-
A?.onDoubleClick?.({ point:
|
|
3189
|
+
}, u = ({ x: m, y: _ }) => {
|
|
3190
|
+
const { point: x, position: p, layer: A } = i([m, _]);
|
|
3191
|
+
A?.onDoubleClick?.({ point: x, position: p, layer: A });
|
|
3191
3192
|
};
|
|
3192
3193
|
return r?.addEventListener("mousedown", a), r?.addEventListener("mousemove", f), r?.addEventListener("dblclick", u), window.addEventListener("mouseup", l), { dispose: () => {
|
|
3193
3194
|
r?.removeEventListener("mousedown", a), r?.removeEventListener("mousemove", f), r?.removeEventListener("dblclick", u), window.removeEventListener("mouseup", l);
|
|
@@ -3198,74 +3199,74 @@ const Hi = ({ gl: e }, t) => {
|
|
|
3198
3199
|
const { view: n, layers: i } = t;
|
|
3199
3200
|
let r = !0, s = [0, 0];
|
|
3200
3201
|
e.enable(e.CULL_FACE), e.cullFace(e.FRONT), e.depthFunc(e.LEQUAL);
|
|
3201
|
-
const o =
|
|
3202
|
-
y = y || 1,
|
|
3202
|
+
const o = gi(e), { canvas: c } = e, a = ([y = 0, E = 0]) => {
|
|
3203
|
+
y = y || 1, E = E || 1, s = [y, E], c.width = y * devicePixelRatio, c.height = E * devicePixelRatio, o.resize([c.width, c.height]);
|
|
3203
3204
|
};
|
|
3204
3205
|
a([c.width, c.height]);
|
|
3205
3206
|
const f = new ResizeObserver(([y]) => {
|
|
3206
3207
|
if (!y)
|
|
3207
3208
|
return;
|
|
3208
|
-
const { contentRect:
|
|
3209
|
-
a([
|
|
3209
|
+
const { contentRect: E } = y, { width: v, height: T } = E;
|
|
3210
|
+
a([v, T]);
|
|
3210
3211
|
});
|
|
3211
3212
|
c instanceof HTMLCanvasElement && f.observe(c);
|
|
3212
|
-
const l = ([y = 0,
|
|
3213
|
-
e.viewport(0, 0, y * devicePixelRatio,
|
|
3213
|
+
const l = ([y = 0, E = 0]) => {
|
|
3214
|
+
e.viewport(0, 0, y * devicePixelRatio, E * devicePixelRatio), e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT);
|
|
3214
3215
|
}, h = () => {
|
|
3215
3216
|
const y = te(n(), s);
|
|
3216
|
-
l(s),
|
|
3217
|
+
l(s), je(i()).forEach((E) => E.render?.({ viewport: y }));
|
|
3217
3218
|
}, u = (y) => {
|
|
3218
|
-
const
|
|
3219
|
-
l(s), (y ? [y] :
|
|
3220
|
-
(
|
|
3219
|
+
const E = te(n(), s);
|
|
3220
|
+
l(s), (y ? [y] : je(i())).forEach(
|
|
3221
|
+
(v, T) => v.render?.({ viewport: E, depth: !0, index: T + 1 })
|
|
3221
3222
|
);
|
|
3222
3223
|
}, d = () => {
|
|
3223
3224
|
r && (h(), requestAnimationFrame(d));
|
|
3224
3225
|
};
|
|
3225
3226
|
requestAnimationFrame(d);
|
|
3226
|
-
const
|
|
3227
|
-
const { screenToClip:
|
|
3227
|
+
const m = (y) => te(n(), s).project(y), _ = (y) => te(n(), s).unproject(y), x = (y, { terrain: E } = {}) => {
|
|
3228
|
+
const { screenToClip: v, clipToLocal: T, localToWorld: M } = te(
|
|
3228
3229
|
n(),
|
|
3229
3230
|
s
|
|
3230
3231
|
);
|
|
3231
3232
|
o.use();
|
|
3232
|
-
const [w] =
|
|
3233
|
+
const [w] = E ? i() : [];
|
|
3233
3234
|
u(w);
|
|
3234
|
-
const [R = 0, g = 0] = y, [
|
|
3235
|
+
const [R = 0, g = 0] = y, [b, S] = o.read([
|
|
3235
3236
|
R * devicePixelRatio,
|
|
3236
3237
|
g * devicePixelRatio
|
|
3237
|
-
]), [U = 0, P = 0] =
|
|
3238
|
-
return { point: y, position:
|
|
3239
|
-
}, p =
|
|
3238
|
+
]), [U = 0, P = 0] = v(y), D = oe(M(T([U, P, b, 1]))), O = S === 0 ? void 0 : w ?? je(i())[S - 1];
|
|
3239
|
+
return { point: y, position: D, layer: O };
|
|
3240
|
+
}, p = Ri(e, {
|
|
3240
3241
|
view: n,
|
|
3241
3242
|
screen: () => s,
|
|
3242
|
-
pick:
|
|
3243
|
+
pick: x
|
|
3243
3244
|
});
|
|
3244
3245
|
return {
|
|
3245
|
-
project:
|
|
3246
|
+
project: m,
|
|
3246
3247
|
unproject: _,
|
|
3247
|
-
pick:
|
|
3248
|
+
pick: x,
|
|
3248
3249
|
dispose: () => {
|
|
3249
3250
|
r = !1, p.dispose(), o.dispose(), c instanceof HTMLCanvasElement && f.unobserve(c);
|
|
3250
3251
|
}
|
|
3251
3252
|
};
|
|
3252
|
-
},
|
|
3253
|
+
}, je = (e) => e.flatMap((t) => [...je(t.children ?? []), t]);
|
|
3253
3254
|
export {
|
|
3254
3255
|
ce as cache,
|
|
3255
3256
|
Vi as cacheAll,
|
|
3256
|
-
|
|
3257
|
+
F as circumference,
|
|
3257
3258
|
Ui as createBillboardLayer,
|
|
3258
3259
|
Pi as createContainer,
|
|
3259
3260
|
bi as createContext,
|
|
3260
3261
|
zi as createDynamicContainer,
|
|
3261
3262
|
Ni as createEmptyLayer,
|
|
3262
3263
|
Ii as createLineLayer,
|
|
3263
|
-
|
|
3264
|
+
si as createMemoryTexture,
|
|
3264
3265
|
Si as createMouseControl,
|
|
3265
3266
|
ye as createMouseEvents,
|
|
3266
|
-
|
|
3267
|
+
_i as createNumberTransition,
|
|
3267
3268
|
Di as createObjectLayer,
|
|
3268
|
-
|
|
3269
|
+
Ti as createOrientationTransition,
|
|
3269
3270
|
Oi as createPolygonLayer,
|
|
3270
3271
|
Yi as createPositionTransition,
|
|
3271
3272
|
$i as createPositionVelocityTransition,
|
|
@@ -3273,7 +3274,7 @@ export {
|
|
|
3273
3274
|
Li as createRenderLayer,
|
|
3274
3275
|
ji as createTerrainLayer,
|
|
3275
3276
|
fe as createTransition,
|
|
3276
|
-
|
|
3277
|
+
yi as createVec2Transition,
|
|
3277
3278
|
Zi as createVec4Transition,
|
|
3278
3279
|
ki as createViewTransition,
|
|
3279
3280
|
Hi as createWorld,
|
|
@@ -3284,10 +3285,10 @@ export {
|
|
|
3284
3285
|
oe as geodetic,
|
|
3285
3286
|
z as mercator,
|
|
3286
3287
|
En as quadratic,
|
|
3287
|
-
|
|
3288
|
+
Xe as radians,
|
|
3288
3289
|
xe as range,
|
|
3289
3290
|
pt as tileToMercator,
|
|
3290
3291
|
yn as toOrientation,
|
|
3291
|
-
|
|
3292
|
+
Le as toQuaternion
|
|
3292
3293
|
};
|
|
3293
3294
|
//# sourceMappingURL=index.js.map
|