@navaramap/font 0.0.0
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/LICENSE +8 -0
- package/README.md +3 -0
- package/dist/index.d.ts +556 -0
- package/dist/index.js +3517 -0
- package/dist/index.umd.cjs +1 -0
- package/package.json +51 -0
- package/src/FontManager.test.ts +2087 -0
- package/src/FontManager.ts +1064 -0
- package/src/FontWorkerClient.ts +183 -0
- package/src/LRUMap.test.ts +124 -0
- package/src/LRUMap.ts +57 -0
- package/src/cssFontFamily.test.ts +230 -0
- package/src/cssFontFamily.ts +286 -0
- package/src/fontWorker.ts +255 -0
- package/src/index.ts +28 -0
- package/src/types.ts +150 -0
- package/src/vite-env.d.ts +1 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3517 @@
|
|
|
1
|
+
//#region src/cssFontFamily.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = [];
|
|
4
|
+
for (let n of e.split(",")) {
|
|
5
|
+
let e = n.trim();
|
|
6
|
+
if (!e) continue;
|
|
7
|
+
let r = /^u\+([0-9a-f?]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(e);
|
|
8
|
+
if (!r) throw Error(`Invalid unicode-range token: "${e}"`);
|
|
9
|
+
let [, i, a] = r, o;
|
|
10
|
+
if (i.includes("?")) {
|
|
11
|
+
if (a !== void 0) throw Error(`Invalid unicode-range token: "${e}"`);
|
|
12
|
+
o = {
|
|
13
|
+
from: parseInt(i.replace(/\?/g, "0"), 16),
|
|
14
|
+
to: parseInt(i.replace(/\?/g, "f"), 16)
|
|
15
|
+
};
|
|
16
|
+
} else {
|
|
17
|
+
let e = parseInt(i, 16);
|
|
18
|
+
o = {
|
|
19
|
+
from: e,
|
|
20
|
+
to: a === void 0 ? e : parseInt(a, 16)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (o.from > o.to || o.to > 1114111) throw Error(`Invalid unicode-range token: "${e}"`);
|
|
24
|
+
t.push(o);
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
var t = [{
|
|
29
|
+
from: 0,
|
|
30
|
+
to: 1114111
|
|
31
|
+
}];
|
|
32
|
+
function n(e) {
|
|
33
|
+
let t = e[0];
|
|
34
|
+
return (t === "\"" || t === "'") && e.endsWith(t) ? e.slice(1, -1) : e;
|
|
35
|
+
}
|
|
36
|
+
function r(e) {
|
|
37
|
+
let t = [...e.matchAll(/url\(\s*("[^"]*"|'[^']*'|[^)]*?)\s*\)(\s*format\(\s*("[^"]*"|'[^']*'|[^)]*?)\s*\))?/gi)];
|
|
38
|
+
if (t.length !== 0) return n((t.find((e) => e[3] && n(e[3]).toLowerCase() === "woff2") ?? t[0])[1].trim());
|
|
39
|
+
}
|
|
40
|
+
function i(e) {
|
|
41
|
+
let t = e.replace(/\/\*[\s\S]*?\*\//g, ""), r = [];
|
|
42
|
+
for (let [, e] of t.matchAll(/@font-face\s*\{([^}]*)\}/gi)) {
|
|
43
|
+
let t = {};
|
|
44
|
+
for (let r of e.split(";")) {
|
|
45
|
+
let e = r.indexOf(":");
|
|
46
|
+
if (e < 0) continue;
|
|
47
|
+
let i = r.slice(0, e).trim().toLowerCase(), a = r.slice(e + 1).trim();
|
|
48
|
+
i === "font-family" ? t.fontFamily = n(a) : i === "font-style" ? t.fontStyle = a : i === "font-weight" ? t.fontWeight = a : i === "src" ? t.src = a : i === "unicode-range" && (t.unicodeRange = a);
|
|
49
|
+
}
|
|
50
|
+
r.push(t);
|
|
51
|
+
}
|
|
52
|
+
return r;
|
|
53
|
+
}
|
|
54
|
+
function a(e) {
|
|
55
|
+
return e.trim().replace(/\s+/g, " ").toLowerCase();
|
|
56
|
+
}
|
|
57
|
+
function o(e, t) {
|
|
58
|
+
if (t.fontFamily !== void 0) {
|
|
59
|
+
let n = Array.isArray(t.fontFamily) ? t.fontFamily : [t.fontFamily], r = e.fontFamily?.toLowerCase();
|
|
60
|
+
if (!n.some((e) => e.toLowerCase() === r)) return !1;
|
|
61
|
+
}
|
|
62
|
+
return !(t.fontWeight !== void 0 && a(e.fontWeight ?? "") !== a(String(t.fontWeight)) || t.fontStyle !== void 0 && a(e.fontStyle ?? "") !== a(t.fontStyle));
|
|
63
|
+
}
|
|
64
|
+
function s(n, a, s = {}) {
|
|
65
|
+
let c = [];
|
|
66
|
+
for (let n of i(a)) {
|
|
67
|
+
if (!o(n, s) || n.src === void 0) continue;
|
|
68
|
+
let i = r(n.src);
|
|
69
|
+
if (i === void 0) continue;
|
|
70
|
+
let a = s.baseUrl ? new URL(i, s.baseUrl).toString() : i, l = n.unicodeRange ? e(n.unicodeRange) : t;
|
|
71
|
+
c.push({
|
|
72
|
+
face: {
|
|
73
|
+
url: a,
|
|
74
|
+
unicodeRanges: l
|
|
75
|
+
},
|
|
76
|
+
cssFamily: n.fontFamily?.toLowerCase() ?? ""
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (c.length === 0) throw Error(`parseFontFamilyFromCss: no @font-face rules matched for family "${n}"`);
|
|
80
|
+
if (c.reverse(), Array.isArray(s.fontFamily)) {
|
|
81
|
+
let e = s.fontFamily.map((e) => e.toLowerCase()), t = (t) => {
|
|
82
|
+
let n = e.indexOf(t);
|
|
83
|
+
return n === -1 ? e.length : n;
|
|
84
|
+
};
|
|
85
|
+
c.sort((e, n) => t(e.cssFamily) - t(n.cssFamily));
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
family: n,
|
|
89
|
+
faces: c.map(({ face: e }) => e)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async function c(e, t, n = {}) {
|
|
93
|
+
let r = Array.isArray(t) ? t : [t], { requestInit: i, ...a } = n, o = [], c = await Promise.all(r.map(async (e) => {
|
|
94
|
+
let t = await fetch(e, i);
|
|
95
|
+
if (!t.ok) throw Error(`fetchFontFamilyFromCss: failed to fetch "${e}" (${t.status})`);
|
|
96
|
+
return {
|
|
97
|
+
text: await t.text(),
|
|
98
|
+
baseUrl: t.url || e
|
|
99
|
+
};
|
|
100
|
+
}));
|
|
101
|
+
for (let { text: t, baseUrl: n } of c) o.push(...s(e, t, {
|
|
102
|
+
...a,
|
|
103
|
+
baseUrl: n
|
|
104
|
+
}).faces);
|
|
105
|
+
return {
|
|
106
|
+
family: e,
|
|
107
|
+
faces: o
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
var l = 1e3, u = 1001, d = 1002, f = 1003, p = 1006, m = 1008, h = 1009, g = 1023, _ = 1028, v = 2300, y = 2301, b = 2302, x = 2303, S = 2400, C = 2401, w = 2402, T = "srgb", E = "srgb-linear", D = "linear", O = "srgb", k = 2e3;
|
|
111
|
+
function A(e) {
|
|
112
|
+
return ArrayBuffer.isView(e) && !(e instanceof DataView);
|
|
113
|
+
}
|
|
114
|
+
function j(e) {
|
|
115
|
+
return document.createElementNS("http://www.w3.org/1999/xhtml", e);
|
|
116
|
+
}
|
|
117
|
+
var M = {}, N = null;
|
|
118
|
+
function P(e) {
|
|
119
|
+
let t = e[0];
|
|
120
|
+
if (typeof t == "string" && t.startsWith("TSL:")) {
|
|
121
|
+
let t = e[1];
|
|
122
|
+
t && t.isStackTrace ? e[0] += " " + t.getLocation() : e[1] = "Stack trace not available. Enable \"THREE.Node.captureStackTrace\" to capture stack traces.";
|
|
123
|
+
}
|
|
124
|
+
return e;
|
|
125
|
+
}
|
|
126
|
+
function F(...e) {
|
|
127
|
+
e = P(e);
|
|
128
|
+
let t = "THREE." + e.shift();
|
|
129
|
+
if (N) N("warn", t, ...e);
|
|
130
|
+
else {
|
|
131
|
+
let n = e[0];
|
|
132
|
+
n && n.isStackTrace ? console.warn(n.getError(t)) : console.warn(t, ...e);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function I(...e) {
|
|
136
|
+
e = P(e);
|
|
137
|
+
let t = "THREE." + e.shift();
|
|
138
|
+
if (N) N("error", t, ...e);
|
|
139
|
+
else {
|
|
140
|
+
let n = e[0];
|
|
141
|
+
n && n.isStackTrace ? console.error(n.getError(t)) : console.error(t, ...e);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function ee(...e) {
|
|
145
|
+
let t = e.join(" ");
|
|
146
|
+
t in M || (M[t] = !0, F(...e));
|
|
147
|
+
}
|
|
148
|
+
var te = class {
|
|
149
|
+
addEventListener(e, t) {
|
|
150
|
+
this._listeners === void 0 && (this._listeners = {});
|
|
151
|
+
let n = this._listeners;
|
|
152
|
+
n[e] === void 0 && (n[e] = []), n[e].indexOf(t) === -1 && n[e].push(t);
|
|
153
|
+
}
|
|
154
|
+
hasEventListener(e, t) {
|
|
155
|
+
let n = this._listeners;
|
|
156
|
+
return n === void 0 ? !1 : n[e] !== void 0 && n[e].indexOf(t) !== -1;
|
|
157
|
+
}
|
|
158
|
+
removeEventListener(e, t) {
|
|
159
|
+
let n = this._listeners;
|
|
160
|
+
if (n === void 0) return;
|
|
161
|
+
let r = n[e];
|
|
162
|
+
if (r !== void 0) {
|
|
163
|
+
let e = r.indexOf(t);
|
|
164
|
+
e !== -1 && r.splice(e, 1);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
dispatchEvent(e) {
|
|
168
|
+
let t = this._listeners;
|
|
169
|
+
if (t === void 0) return;
|
|
170
|
+
let n = t[e.type];
|
|
171
|
+
if (n !== void 0) {
|
|
172
|
+
e.target = this;
|
|
173
|
+
let t = n.slice(0);
|
|
174
|
+
for (let n = 0, r = t.length; n < r; n++) t[n].call(this, e);
|
|
175
|
+
e.target = null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, L = /* @__PURE__ */ "00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff".split(".");
|
|
179
|
+
Math.PI / 180, 180 / Math.PI;
|
|
180
|
+
function ne() {
|
|
181
|
+
let e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0, r = Math.random() * 4294967295 | 0;
|
|
182
|
+
return (L[e & 255] + L[e >> 8 & 255] + L[e >> 16 & 255] + L[e >> 24 & 255] + "-" + L[t & 255] + L[t >> 8 & 255] + "-" + L[t >> 16 & 15 | 64] + L[t >> 24 & 255] + "-" + L[n & 63 | 128] + L[n >> 8 & 255] + "-" + L[n >> 16 & 255] + L[n >> 24 & 255] + L[r & 255] + L[r >> 8 & 255] + L[r >> 16 & 255] + L[r >> 24 & 255]).toLowerCase();
|
|
183
|
+
}
|
|
184
|
+
function R(e, t, n) {
|
|
185
|
+
return Math.max(t, Math.min(n, e));
|
|
186
|
+
}
|
|
187
|
+
function re(e, t) {
|
|
188
|
+
return (e % t + t) % t;
|
|
189
|
+
}
|
|
190
|
+
function ie(e, t, n) {
|
|
191
|
+
return (1 - n) * e + n * t;
|
|
192
|
+
}
|
|
193
|
+
var ae = class e {
|
|
194
|
+
static {
|
|
195
|
+
e.prototype.isVector2 = !0;
|
|
196
|
+
}
|
|
197
|
+
constructor(e = 0, t = 0) {
|
|
198
|
+
this.x = e, this.y = t;
|
|
199
|
+
}
|
|
200
|
+
get width() {
|
|
201
|
+
return this.x;
|
|
202
|
+
}
|
|
203
|
+
set width(e) {
|
|
204
|
+
this.x = e;
|
|
205
|
+
}
|
|
206
|
+
get height() {
|
|
207
|
+
return this.y;
|
|
208
|
+
}
|
|
209
|
+
set height(e) {
|
|
210
|
+
this.y = e;
|
|
211
|
+
}
|
|
212
|
+
set(e, t) {
|
|
213
|
+
return this.x = e, this.y = t, this;
|
|
214
|
+
}
|
|
215
|
+
setScalar(e) {
|
|
216
|
+
return this.x = e, this.y = e, this;
|
|
217
|
+
}
|
|
218
|
+
setX(e) {
|
|
219
|
+
return this.x = e, this;
|
|
220
|
+
}
|
|
221
|
+
setY(e) {
|
|
222
|
+
return this.y = e, this;
|
|
223
|
+
}
|
|
224
|
+
setComponent(e, t) {
|
|
225
|
+
switch (e) {
|
|
226
|
+
case 0:
|
|
227
|
+
this.x = t;
|
|
228
|
+
break;
|
|
229
|
+
case 1:
|
|
230
|
+
this.y = t;
|
|
231
|
+
break;
|
|
232
|
+
default: throw Error("index is out of range: " + e);
|
|
233
|
+
}
|
|
234
|
+
return this;
|
|
235
|
+
}
|
|
236
|
+
getComponent(e) {
|
|
237
|
+
switch (e) {
|
|
238
|
+
case 0: return this.x;
|
|
239
|
+
case 1: return this.y;
|
|
240
|
+
default: throw Error("index is out of range: " + e);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
clone() {
|
|
244
|
+
return new this.constructor(this.x, this.y);
|
|
245
|
+
}
|
|
246
|
+
copy(e) {
|
|
247
|
+
return this.x = e.x, this.y = e.y, this;
|
|
248
|
+
}
|
|
249
|
+
add(e) {
|
|
250
|
+
return this.x += e.x, this.y += e.y, this;
|
|
251
|
+
}
|
|
252
|
+
addScalar(e) {
|
|
253
|
+
return this.x += e, this.y += e, this;
|
|
254
|
+
}
|
|
255
|
+
addVectors(e, t) {
|
|
256
|
+
return this.x = e.x + t.x, this.y = e.y + t.y, this;
|
|
257
|
+
}
|
|
258
|
+
addScaledVector(e, t) {
|
|
259
|
+
return this.x += e.x * t, this.y += e.y * t, this;
|
|
260
|
+
}
|
|
261
|
+
sub(e) {
|
|
262
|
+
return this.x -= e.x, this.y -= e.y, this;
|
|
263
|
+
}
|
|
264
|
+
subScalar(e) {
|
|
265
|
+
return this.x -= e, this.y -= e, this;
|
|
266
|
+
}
|
|
267
|
+
subVectors(e, t) {
|
|
268
|
+
return this.x = e.x - t.x, this.y = e.y - t.y, this;
|
|
269
|
+
}
|
|
270
|
+
multiply(e) {
|
|
271
|
+
return this.x *= e.x, this.y *= e.y, this;
|
|
272
|
+
}
|
|
273
|
+
multiplyScalar(e) {
|
|
274
|
+
return this.x *= e, this.y *= e, this;
|
|
275
|
+
}
|
|
276
|
+
divide(e) {
|
|
277
|
+
return this.x /= e.x, this.y /= e.y, this;
|
|
278
|
+
}
|
|
279
|
+
divideScalar(e) {
|
|
280
|
+
return this.multiplyScalar(1 / e);
|
|
281
|
+
}
|
|
282
|
+
applyMatrix3(e) {
|
|
283
|
+
let t = this.x, n = this.y, r = e.elements;
|
|
284
|
+
return this.x = r[0] * t + r[3] * n + r[6], this.y = r[1] * t + r[4] * n + r[7], this;
|
|
285
|
+
}
|
|
286
|
+
min(e) {
|
|
287
|
+
return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this;
|
|
288
|
+
}
|
|
289
|
+
max(e) {
|
|
290
|
+
return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this;
|
|
291
|
+
}
|
|
292
|
+
clamp(e, t) {
|
|
293
|
+
return this.x = R(this.x, e.x, t.x), this.y = R(this.y, e.y, t.y), this;
|
|
294
|
+
}
|
|
295
|
+
clampScalar(e, t) {
|
|
296
|
+
return this.x = R(this.x, e, t), this.y = R(this.y, e, t), this;
|
|
297
|
+
}
|
|
298
|
+
clampLength(e, t) {
|
|
299
|
+
let n = this.length();
|
|
300
|
+
return this.divideScalar(n || 1).multiplyScalar(R(n, e, t));
|
|
301
|
+
}
|
|
302
|
+
floor() {
|
|
303
|
+
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this;
|
|
304
|
+
}
|
|
305
|
+
ceil() {
|
|
306
|
+
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this;
|
|
307
|
+
}
|
|
308
|
+
round() {
|
|
309
|
+
return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
|
|
310
|
+
}
|
|
311
|
+
roundToZero() {
|
|
312
|
+
return this.x = Math.trunc(this.x), this.y = Math.trunc(this.y), this;
|
|
313
|
+
}
|
|
314
|
+
negate() {
|
|
315
|
+
return this.x = -this.x, this.y = -this.y, this;
|
|
316
|
+
}
|
|
317
|
+
dot(e) {
|
|
318
|
+
return this.x * e.x + this.y * e.y;
|
|
319
|
+
}
|
|
320
|
+
cross(e) {
|
|
321
|
+
return this.x * e.y - this.y * e.x;
|
|
322
|
+
}
|
|
323
|
+
lengthSq() {
|
|
324
|
+
return this.x * this.x + this.y * this.y;
|
|
325
|
+
}
|
|
326
|
+
length() {
|
|
327
|
+
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
328
|
+
}
|
|
329
|
+
manhattanLength() {
|
|
330
|
+
return Math.abs(this.x) + Math.abs(this.y);
|
|
331
|
+
}
|
|
332
|
+
normalize() {
|
|
333
|
+
return this.divideScalar(this.length() || 1);
|
|
334
|
+
}
|
|
335
|
+
angle() {
|
|
336
|
+
return Math.atan2(-this.y, -this.x) + Math.PI;
|
|
337
|
+
}
|
|
338
|
+
angleTo(e) {
|
|
339
|
+
let t = Math.sqrt(this.lengthSq() * e.lengthSq());
|
|
340
|
+
if (t === 0) return Math.PI / 2;
|
|
341
|
+
let n = this.dot(e) / t;
|
|
342
|
+
return Math.acos(R(n, -1, 1));
|
|
343
|
+
}
|
|
344
|
+
distanceTo(e) {
|
|
345
|
+
return Math.sqrt(this.distanceToSquared(e));
|
|
346
|
+
}
|
|
347
|
+
distanceToSquared(e) {
|
|
348
|
+
let t = this.x - e.x, n = this.y - e.y;
|
|
349
|
+
return t * t + n * n;
|
|
350
|
+
}
|
|
351
|
+
manhattanDistanceTo(e) {
|
|
352
|
+
return Math.abs(this.x - e.x) + Math.abs(this.y - e.y);
|
|
353
|
+
}
|
|
354
|
+
setLength(e) {
|
|
355
|
+
return this.normalize().multiplyScalar(e);
|
|
356
|
+
}
|
|
357
|
+
lerp(e, t) {
|
|
358
|
+
return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this;
|
|
359
|
+
}
|
|
360
|
+
lerpVectors(e, t, n) {
|
|
361
|
+
return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this;
|
|
362
|
+
}
|
|
363
|
+
equals(e) {
|
|
364
|
+
return e.x === this.x && e.y === this.y;
|
|
365
|
+
}
|
|
366
|
+
fromArray(e, t = 0) {
|
|
367
|
+
return this.x = e[t], this.y = e[t + 1], this;
|
|
368
|
+
}
|
|
369
|
+
toArray(e = [], t = 0) {
|
|
370
|
+
return e[t] = this.x, e[t + 1] = this.y, e;
|
|
371
|
+
}
|
|
372
|
+
fromBufferAttribute(e, t) {
|
|
373
|
+
return this.x = e.getX(t), this.y = e.getY(t), this;
|
|
374
|
+
}
|
|
375
|
+
rotateAround(e, t) {
|
|
376
|
+
let n = Math.cos(t), r = Math.sin(t), i = this.x - e.x, a = this.y - e.y;
|
|
377
|
+
return this.x = i * n - a * r + e.x, this.y = i * r + a * n + e.y, this;
|
|
378
|
+
}
|
|
379
|
+
random() {
|
|
380
|
+
return this.x = Math.random(), this.y = Math.random(), this;
|
|
381
|
+
}
|
|
382
|
+
*[Symbol.iterator]() {
|
|
383
|
+
yield this.x, yield this.y;
|
|
384
|
+
}
|
|
385
|
+
}, z = class {
|
|
386
|
+
constructor(e = 0, t = 0, n = 0, r = 1) {
|
|
387
|
+
this.isQuaternion = !0, this._x = e, this._y = t, this._z = n, this._w = r;
|
|
388
|
+
}
|
|
389
|
+
static slerpFlat(e, t, n, r, i, a, o) {
|
|
390
|
+
let s = n[r + 0], c = n[r + 1], l = n[r + 2], u = n[r + 3], d = i[a + 0], f = i[a + 1], p = i[a + 2], m = i[a + 3];
|
|
391
|
+
if (u !== m || s !== d || c !== f || l !== p) {
|
|
392
|
+
let e = s * d + c * f + l * p + u * m;
|
|
393
|
+
e < 0 && (d = -d, f = -f, p = -p, m = -m, e = -e);
|
|
394
|
+
let t = 1 - o;
|
|
395
|
+
if (e < .9995) {
|
|
396
|
+
let n = Math.acos(e), r = Math.sin(n);
|
|
397
|
+
t = Math.sin(t * n) / r, o = Math.sin(o * n) / r, s = s * t + d * o, c = c * t + f * o, l = l * t + p * o, u = u * t + m * o;
|
|
398
|
+
} else {
|
|
399
|
+
s = s * t + d * o, c = c * t + f * o, l = l * t + p * o, u = u * t + m * o;
|
|
400
|
+
let e = 1 / Math.sqrt(s * s + c * c + l * l + u * u);
|
|
401
|
+
s *= e, c *= e, l *= e, u *= e;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
e[t] = s, e[t + 1] = c, e[t + 2] = l, e[t + 3] = u;
|
|
405
|
+
}
|
|
406
|
+
static multiplyQuaternionsFlat(e, t, n, r, i, a) {
|
|
407
|
+
let o = n[r], s = n[r + 1], c = n[r + 2], l = n[r + 3], u = i[a], d = i[a + 1], f = i[a + 2], p = i[a + 3];
|
|
408
|
+
return e[t] = o * p + l * u + s * f - c * d, e[t + 1] = s * p + l * d + c * u - o * f, e[t + 2] = c * p + l * f + o * d - s * u, e[t + 3] = l * p - o * u - s * d - c * f, e;
|
|
409
|
+
}
|
|
410
|
+
get x() {
|
|
411
|
+
return this._x;
|
|
412
|
+
}
|
|
413
|
+
set x(e) {
|
|
414
|
+
this._x = e, this._onChangeCallback();
|
|
415
|
+
}
|
|
416
|
+
get y() {
|
|
417
|
+
return this._y;
|
|
418
|
+
}
|
|
419
|
+
set y(e) {
|
|
420
|
+
this._y = e, this._onChangeCallback();
|
|
421
|
+
}
|
|
422
|
+
get z() {
|
|
423
|
+
return this._z;
|
|
424
|
+
}
|
|
425
|
+
set z(e) {
|
|
426
|
+
this._z = e, this._onChangeCallback();
|
|
427
|
+
}
|
|
428
|
+
get w() {
|
|
429
|
+
return this._w;
|
|
430
|
+
}
|
|
431
|
+
set w(e) {
|
|
432
|
+
this._w = e, this._onChangeCallback();
|
|
433
|
+
}
|
|
434
|
+
set(e, t, n, r) {
|
|
435
|
+
return this._x = e, this._y = t, this._z = n, this._w = r, this._onChangeCallback(), this;
|
|
436
|
+
}
|
|
437
|
+
clone() {
|
|
438
|
+
return new this.constructor(this._x, this._y, this._z, this._w);
|
|
439
|
+
}
|
|
440
|
+
copy(e) {
|
|
441
|
+
return this._x = e.x, this._y = e.y, this._z = e.z, this._w = e.w, this._onChangeCallback(), this;
|
|
442
|
+
}
|
|
443
|
+
setFromEuler(e, t = !0) {
|
|
444
|
+
let n = e._x, r = e._y, i = e._z, a = e._order, o = Math.cos, s = Math.sin, c = o(n / 2), l = o(r / 2), u = o(i / 2), d = s(n / 2), f = s(r / 2), p = s(i / 2);
|
|
445
|
+
switch (a) {
|
|
446
|
+
case "XYZ":
|
|
447
|
+
this._x = d * l * u + c * f * p, this._y = c * f * u - d * l * p, this._z = c * l * p + d * f * u, this._w = c * l * u - d * f * p;
|
|
448
|
+
break;
|
|
449
|
+
case "YXZ":
|
|
450
|
+
this._x = d * l * u + c * f * p, this._y = c * f * u - d * l * p, this._z = c * l * p - d * f * u, this._w = c * l * u + d * f * p;
|
|
451
|
+
break;
|
|
452
|
+
case "ZXY":
|
|
453
|
+
this._x = d * l * u - c * f * p, this._y = c * f * u + d * l * p, this._z = c * l * p + d * f * u, this._w = c * l * u - d * f * p;
|
|
454
|
+
break;
|
|
455
|
+
case "ZYX":
|
|
456
|
+
this._x = d * l * u - c * f * p, this._y = c * f * u + d * l * p, this._z = c * l * p - d * f * u, this._w = c * l * u + d * f * p;
|
|
457
|
+
break;
|
|
458
|
+
case "YZX":
|
|
459
|
+
this._x = d * l * u + c * f * p, this._y = c * f * u + d * l * p, this._z = c * l * p - d * f * u, this._w = c * l * u - d * f * p;
|
|
460
|
+
break;
|
|
461
|
+
case "XZY":
|
|
462
|
+
this._x = d * l * u - c * f * p, this._y = c * f * u - d * l * p, this._z = c * l * p + d * f * u, this._w = c * l * u + d * f * p;
|
|
463
|
+
break;
|
|
464
|
+
default: F("Quaternion: .setFromEuler() encountered an unknown order: " + a);
|
|
465
|
+
}
|
|
466
|
+
return t === !0 && this._onChangeCallback(), this;
|
|
467
|
+
}
|
|
468
|
+
setFromAxisAngle(e, t) {
|
|
469
|
+
let n = t / 2, r = Math.sin(n);
|
|
470
|
+
return this._x = e.x * r, this._y = e.y * r, this._z = e.z * r, this._w = Math.cos(n), this._onChangeCallback(), this;
|
|
471
|
+
}
|
|
472
|
+
setFromRotationMatrix(e) {
|
|
473
|
+
let t = e.elements, n = t[0], r = t[4], i = t[8], a = t[1], o = t[5], s = t[9], c = t[2], l = t[6], u = t[10], d = n + o + u;
|
|
474
|
+
if (d > 0) {
|
|
475
|
+
let e = .5 / Math.sqrt(d + 1);
|
|
476
|
+
this._w = .25 / e, this._x = (l - s) * e, this._y = (i - c) * e, this._z = (a - r) * e;
|
|
477
|
+
} else if (n > o && n > u) {
|
|
478
|
+
let e = 2 * Math.sqrt(1 + n - o - u);
|
|
479
|
+
this._w = (l - s) / e, this._x = .25 * e, this._y = (r + a) / e, this._z = (i + c) / e;
|
|
480
|
+
} else if (o > u) {
|
|
481
|
+
let e = 2 * Math.sqrt(1 + o - n - u);
|
|
482
|
+
this._w = (i - c) / e, this._x = (r + a) / e, this._y = .25 * e, this._z = (s + l) / e;
|
|
483
|
+
} else {
|
|
484
|
+
let e = 2 * Math.sqrt(1 + u - n - o);
|
|
485
|
+
this._w = (a - r) / e, this._x = (i + c) / e, this._y = (s + l) / e, this._z = .25 * e;
|
|
486
|
+
}
|
|
487
|
+
return this._onChangeCallback(), this;
|
|
488
|
+
}
|
|
489
|
+
setFromUnitVectors(e, t) {
|
|
490
|
+
let n = e.dot(t) + 1;
|
|
491
|
+
return n < 1e-8 ? (n = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0, this._w = n) : (this._x = 0, this._y = -e.z, this._z = e.y, this._w = n)) : (this._x = e.y * t.z - e.z * t.y, this._y = e.z * t.x - e.x * t.z, this._z = e.x * t.y - e.y * t.x, this._w = n), this.normalize();
|
|
492
|
+
}
|
|
493
|
+
angleTo(e) {
|
|
494
|
+
return 2 * Math.acos(Math.abs(R(this.dot(e), -1, 1)));
|
|
495
|
+
}
|
|
496
|
+
rotateTowards(e, t) {
|
|
497
|
+
let n = this.angleTo(e);
|
|
498
|
+
if (n === 0) return this;
|
|
499
|
+
let r = Math.min(1, t / n);
|
|
500
|
+
return this.slerp(e, r), this;
|
|
501
|
+
}
|
|
502
|
+
identity() {
|
|
503
|
+
return this.set(0, 0, 0, 1);
|
|
504
|
+
}
|
|
505
|
+
invert() {
|
|
506
|
+
return this.conjugate();
|
|
507
|
+
}
|
|
508
|
+
conjugate() {
|
|
509
|
+
return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this;
|
|
510
|
+
}
|
|
511
|
+
dot(e) {
|
|
512
|
+
return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w;
|
|
513
|
+
}
|
|
514
|
+
lengthSq() {
|
|
515
|
+
return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
|
|
516
|
+
}
|
|
517
|
+
length() {
|
|
518
|
+
return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);
|
|
519
|
+
}
|
|
520
|
+
normalize() {
|
|
521
|
+
let e = this.length();
|
|
522
|
+
return e === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (e = 1 / e, this._x *= e, this._y *= e, this._z *= e, this._w *= e), this._onChangeCallback(), this;
|
|
523
|
+
}
|
|
524
|
+
multiply(e) {
|
|
525
|
+
return this.multiplyQuaternions(this, e);
|
|
526
|
+
}
|
|
527
|
+
premultiply(e) {
|
|
528
|
+
return this.multiplyQuaternions(e, this);
|
|
529
|
+
}
|
|
530
|
+
multiplyQuaternions(e, t) {
|
|
531
|
+
let n = e._x, r = e._y, i = e._z, a = e._w, o = t._x, s = t._y, c = t._z, l = t._w;
|
|
532
|
+
return this._x = n * l + a * o + r * c - i * s, this._y = r * l + a * s + i * o - n * c, this._z = i * l + a * c + n * s - r * o, this._w = a * l - n * o - r * s - i * c, this._onChangeCallback(), this;
|
|
533
|
+
}
|
|
534
|
+
slerp(e, t) {
|
|
535
|
+
let n = e._x, r = e._y, i = e._z, a = e._w, o = this.dot(e);
|
|
536
|
+
o < 0 && (n = -n, r = -r, i = -i, a = -a, o = -o);
|
|
537
|
+
let s = 1 - t;
|
|
538
|
+
if (o < .9995) {
|
|
539
|
+
let e = Math.acos(o), c = Math.sin(e);
|
|
540
|
+
s = Math.sin(s * e) / c, t = Math.sin(t * e) / c, this._x = this._x * s + n * t, this._y = this._y * s + r * t, this._z = this._z * s + i * t, this._w = this._w * s + a * t, this._onChangeCallback();
|
|
541
|
+
} else this._x = this._x * s + n * t, this._y = this._y * s + r * t, this._z = this._z * s + i * t, this._w = this._w * s + a * t, this.normalize();
|
|
542
|
+
return this;
|
|
543
|
+
}
|
|
544
|
+
slerpQuaternions(e, t, n) {
|
|
545
|
+
return this.copy(e).slerp(t, n);
|
|
546
|
+
}
|
|
547
|
+
random() {
|
|
548
|
+
let e = 2 * Math.PI * Math.random(), t = 2 * Math.PI * Math.random(), n = Math.random(), r = Math.sqrt(1 - n), i = Math.sqrt(n);
|
|
549
|
+
return this.set(r * Math.sin(e), r * Math.cos(e), i * Math.sin(t), i * Math.cos(t));
|
|
550
|
+
}
|
|
551
|
+
equals(e) {
|
|
552
|
+
return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w;
|
|
553
|
+
}
|
|
554
|
+
fromArray(e, t = 0) {
|
|
555
|
+
return this._x = e[t], this._y = e[t + 1], this._z = e[t + 2], this._w = e[t + 3], this._onChangeCallback(), this;
|
|
556
|
+
}
|
|
557
|
+
toArray(e = [], t = 0) {
|
|
558
|
+
return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._w, e;
|
|
559
|
+
}
|
|
560
|
+
fromBufferAttribute(e, t) {
|
|
561
|
+
return this._x = e.getX(t), this._y = e.getY(t), this._z = e.getZ(t), this._w = e.getW(t), this._onChangeCallback(), this;
|
|
562
|
+
}
|
|
563
|
+
toJSON() {
|
|
564
|
+
return this.toArray();
|
|
565
|
+
}
|
|
566
|
+
_onChange(e) {
|
|
567
|
+
return this._onChangeCallback = e, this;
|
|
568
|
+
}
|
|
569
|
+
_onChangeCallback() {}
|
|
570
|
+
*[Symbol.iterator]() {
|
|
571
|
+
yield this._x, yield this._y, yield this._z, yield this._w;
|
|
572
|
+
}
|
|
573
|
+
}, B = class e {
|
|
574
|
+
static {
|
|
575
|
+
e.prototype.isVector3 = !0;
|
|
576
|
+
}
|
|
577
|
+
constructor(e = 0, t = 0, n = 0) {
|
|
578
|
+
this.x = e, this.y = t, this.z = n;
|
|
579
|
+
}
|
|
580
|
+
set(e, t, n) {
|
|
581
|
+
return n === void 0 && (n = this.z), this.x = e, this.y = t, this.z = n, this;
|
|
582
|
+
}
|
|
583
|
+
setScalar(e) {
|
|
584
|
+
return this.x = e, this.y = e, this.z = e, this;
|
|
585
|
+
}
|
|
586
|
+
setX(e) {
|
|
587
|
+
return this.x = e, this;
|
|
588
|
+
}
|
|
589
|
+
setY(e) {
|
|
590
|
+
return this.y = e, this;
|
|
591
|
+
}
|
|
592
|
+
setZ(e) {
|
|
593
|
+
return this.z = e, this;
|
|
594
|
+
}
|
|
595
|
+
setComponent(e, t) {
|
|
596
|
+
switch (e) {
|
|
597
|
+
case 0:
|
|
598
|
+
this.x = t;
|
|
599
|
+
break;
|
|
600
|
+
case 1:
|
|
601
|
+
this.y = t;
|
|
602
|
+
break;
|
|
603
|
+
case 2:
|
|
604
|
+
this.z = t;
|
|
605
|
+
break;
|
|
606
|
+
default: throw Error("index is out of range: " + e);
|
|
607
|
+
}
|
|
608
|
+
return this;
|
|
609
|
+
}
|
|
610
|
+
getComponent(e) {
|
|
611
|
+
switch (e) {
|
|
612
|
+
case 0: return this.x;
|
|
613
|
+
case 1: return this.y;
|
|
614
|
+
case 2: return this.z;
|
|
615
|
+
default: throw Error("index is out of range: " + e);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
clone() {
|
|
619
|
+
return new this.constructor(this.x, this.y, this.z);
|
|
620
|
+
}
|
|
621
|
+
copy(e) {
|
|
622
|
+
return this.x = e.x, this.y = e.y, this.z = e.z, this;
|
|
623
|
+
}
|
|
624
|
+
add(e) {
|
|
625
|
+
return this.x += e.x, this.y += e.y, this.z += e.z, this;
|
|
626
|
+
}
|
|
627
|
+
addScalar(e) {
|
|
628
|
+
return this.x += e, this.y += e, this.z += e, this;
|
|
629
|
+
}
|
|
630
|
+
addVectors(e, t) {
|
|
631
|
+
return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this;
|
|
632
|
+
}
|
|
633
|
+
addScaledVector(e, t) {
|
|
634
|
+
return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this;
|
|
635
|
+
}
|
|
636
|
+
sub(e) {
|
|
637
|
+
return this.x -= e.x, this.y -= e.y, this.z -= e.z, this;
|
|
638
|
+
}
|
|
639
|
+
subScalar(e) {
|
|
640
|
+
return this.x -= e, this.y -= e, this.z -= e, this;
|
|
641
|
+
}
|
|
642
|
+
subVectors(e, t) {
|
|
643
|
+
return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this;
|
|
644
|
+
}
|
|
645
|
+
multiply(e) {
|
|
646
|
+
return this.x *= e.x, this.y *= e.y, this.z *= e.z, this;
|
|
647
|
+
}
|
|
648
|
+
multiplyScalar(e) {
|
|
649
|
+
return this.x *= e, this.y *= e, this.z *= e, this;
|
|
650
|
+
}
|
|
651
|
+
multiplyVectors(e, t) {
|
|
652
|
+
return this.x = e.x * t.x, this.y = e.y * t.y, this.z = e.z * t.z, this;
|
|
653
|
+
}
|
|
654
|
+
applyEuler(e) {
|
|
655
|
+
return this.applyQuaternion(se.setFromEuler(e));
|
|
656
|
+
}
|
|
657
|
+
applyAxisAngle(e, t) {
|
|
658
|
+
return this.applyQuaternion(se.setFromAxisAngle(e, t));
|
|
659
|
+
}
|
|
660
|
+
applyMatrix3(e) {
|
|
661
|
+
let t = this.x, n = this.y, r = this.z, i = e.elements;
|
|
662
|
+
return this.x = i[0] * t + i[3] * n + i[6] * r, this.y = i[1] * t + i[4] * n + i[7] * r, this.z = i[2] * t + i[5] * n + i[8] * r, this;
|
|
663
|
+
}
|
|
664
|
+
applyNormalMatrix(e) {
|
|
665
|
+
return this.applyMatrix3(e).normalize();
|
|
666
|
+
}
|
|
667
|
+
applyMatrix4(e) {
|
|
668
|
+
let t = this.x, n = this.y, r = this.z, i = e.elements, a = 1 / (i[3] * t + i[7] * n + i[11] * r + i[15]);
|
|
669
|
+
return this.x = (i[0] * t + i[4] * n + i[8] * r + i[12]) * a, this.y = (i[1] * t + i[5] * n + i[9] * r + i[13]) * a, this.z = (i[2] * t + i[6] * n + i[10] * r + i[14]) * a, this;
|
|
670
|
+
}
|
|
671
|
+
applyQuaternion(e) {
|
|
672
|
+
let t = this.x, n = this.y, r = this.z, i = e.x, a = e.y, o = e.z, s = e.w, c = 2 * (a * r - o * n), l = 2 * (o * t - i * r), u = 2 * (i * n - a * t);
|
|
673
|
+
return this.x = t + s * c + a * u - o * l, this.y = n + s * l + o * c - i * u, this.z = r + s * u + i * l - a * c, this;
|
|
674
|
+
}
|
|
675
|
+
project(e) {
|
|
676
|
+
return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix);
|
|
677
|
+
}
|
|
678
|
+
unproject(e) {
|
|
679
|
+
return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld);
|
|
680
|
+
}
|
|
681
|
+
transformDirection(e) {
|
|
682
|
+
let t = this.x, n = this.y, r = this.z, i = e.elements;
|
|
683
|
+
return this.x = i[0] * t + i[4] * n + i[8] * r, this.y = i[1] * t + i[5] * n + i[9] * r, this.z = i[2] * t + i[6] * n + i[10] * r, this.normalize();
|
|
684
|
+
}
|
|
685
|
+
divide(e) {
|
|
686
|
+
return this.x /= e.x, this.y /= e.y, this.z /= e.z, this;
|
|
687
|
+
}
|
|
688
|
+
divideScalar(e) {
|
|
689
|
+
return this.multiplyScalar(1 / e);
|
|
690
|
+
}
|
|
691
|
+
min(e) {
|
|
692
|
+
return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this;
|
|
693
|
+
}
|
|
694
|
+
max(e) {
|
|
695
|
+
return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this;
|
|
696
|
+
}
|
|
697
|
+
clamp(e, t) {
|
|
698
|
+
return this.x = R(this.x, e.x, t.x), this.y = R(this.y, e.y, t.y), this.z = R(this.z, e.z, t.z), this;
|
|
699
|
+
}
|
|
700
|
+
clampScalar(e, t) {
|
|
701
|
+
return this.x = R(this.x, e, t), this.y = R(this.y, e, t), this.z = R(this.z, e, t), this;
|
|
702
|
+
}
|
|
703
|
+
clampLength(e, t) {
|
|
704
|
+
let n = this.length();
|
|
705
|
+
return this.divideScalar(n || 1).multiplyScalar(R(n, e, t));
|
|
706
|
+
}
|
|
707
|
+
floor() {
|
|
708
|
+
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this;
|
|
709
|
+
}
|
|
710
|
+
ceil() {
|
|
711
|
+
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this;
|
|
712
|
+
}
|
|
713
|
+
round() {
|
|
714
|
+
return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this;
|
|
715
|
+
}
|
|
716
|
+
roundToZero() {
|
|
717
|
+
return this.x = Math.trunc(this.x), this.y = Math.trunc(this.y), this.z = Math.trunc(this.z), this;
|
|
718
|
+
}
|
|
719
|
+
negate() {
|
|
720
|
+
return this.x = -this.x, this.y = -this.y, this.z = -this.z, this;
|
|
721
|
+
}
|
|
722
|
+
dot(e) {
|
|
723
|
+
return this.x * e.x + this.y * e.y + this.z * e.z;
|
|
724
|
+
}
|
|
725
|
+
lengthSq() {
|
|
726
|
+
return this.x * this.x + this.y * this.y + this.z * this.z;
|
|
727
|
+
}
|
|
728
|
+
length() {
|
|
729
|
+
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
|
730
|
+
}
|
|
731
|
+
manhattanLength() {
|
|
732
|
+
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);
|
|
733
|
+
}
|
|
734
|
+
normalize() {
|
|
735
|
+
return this.divideScalar(this.length() || 1);
|
|
736
|
+
}
|
|
737
|
+
setLength(e) {
|
|
738
|
+
return this.normalize().multiplyScalar(e);
|
|
739
|
+
}
|
|
740
|
+
lerp(e, t) {
|
|
741
|
+
return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this;
|
|
742
|
+
}
|
|
743
|
+
lerpVectors(e, t, n) {
|
|
744
|
+
return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this.z = e.z + (t.z - e.z) * n, this;
|
|
745
|
+
}
|
|
746
|
+
cross(e) {
|
|
747
|
+
return this.crossVectors(this, e);
|
|
748
|
+
}
|
|
749
|
+
crossVectors(e, t) {
|
|
750
|
+
let n = e.x, r = e.y, i = e.z, a = t.x, o = t.y, s = t.z;
|
|
751
|
+
return this.x = r * s - i * o, this.y = i * a - n * s, this.z = n * o - r * a, this;
|
|
752
|
+
}
|
|
753
|
+
projectOnVector(e) {
|
|
754
|
+
let t = e.lengthSq();
|
|
755
|
+
if (t === 0) return this.set(0, 0, 0);
|
|
756
|
+
let n = e.dot(this) / t;
|
|
757
|
+
return this.copy(e).multiplyScalar(n);
|
|
758
|
+
}
|
|
759
|
+
projectOnPlane(e) {
|
|
760
|
+
return oe.copy(this).projectOnVector(e), this.sub(oe);
|
|
761
|
+
}
|
|
762
|
+
reflect(e) {
|
|
763
|
+
return this.sub(oe.copy(e).multiplyScalar(2 * this.dot(e)));
|
|
764
|
+
}
|
|
765
|
+
angleTo(e) {
|
|
766
|
+
let t = Math.sqrt(this.lengthSq() * e.lengthSq());
|
|
767
|
+
if (t === 0) return Math.PI / 2;
|
|
768
|
+
let n = this.dot(e) / t;
|
|
769
|
+
return Math.acos(R(n, -1, 1));
|
|
770
|
+
}
|
|
771
|
+
distanceTo(e) {
|
|
772
|
+
return Math.sqrt(this.distanceToSquared(e));
|
|
773
|
+
}
|
|
774
|
+
distanceToSquared(e) {
|
|
775
|
+
let t = this.x - e.x, n = this.y - e.y, r = this.z - e.z;
|
|
776
|
+
return t * t + n * n + r * r;
|
|
777
|
+
}
|
|
778
|
+
manhattanDistanceTo(e) {
|
|
779
|
+
return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) + Math.abs(this.z - e.z);
|
|
780
|
+
}
|
|
781
|
+
setFromSpherical(e) {
|
|
782
|
+
return this.setFromSphericalCoords(e.radius, e.phi, e.theta);
|
|
783
|
+
}
|
|
784
|
+
setFromSphericalCoords(e, t, n) {
|
|
785
|
+
let r = Math.sin(t) * e;
|
|
786
|
+
return this.x = r * Math.sin(n), this.y = Math.cos(t) * e, this.z = r * Math.cos(n), this;
|
|
787
|
+
}
|
|
788
|
+
setFromCylindrical(e) {
|
|
789
|
+
return this.setFromCylindricalCoords(e.radius, e.theta, e.y);
|
|
790
|
+
}
|
|
791
|
+
setFromCylindricalCoords(e, t, n) {
|
|
792
|
+
return this.x = e * Math.sin(t), this.y = n, this.z = e * Math.cos(t), this;
|
|
793
|
+
}
|
|
794
|
+
setFromMatrixPosition(e) {
|
|
795
|
+
let t = e.elements;
|
|
796
|
+
return this.x = t[12], this.y = t[13], this.z = t[14], this;
|
|
797
|
+
}
|
|
798
|
+
setFromMatrixScale(e) {
|
|
799
|
+
let t = this.setFromMatrixColumn(e, 0).length(), n = this.setFromMatrixColumn(e, 1).length(), r = this.setFromMatrixColumn(e, 2).length();
|
|
800
|
+
return this.x = t, this.y = n, this.z = r, this;
|
|
801
|
+
}
|
|
802
|
+
setFromMatrixColumn(e, t) {
|
|
803
|
+
return this.fromArray(e.elements, t * 4);
|
|
804
|
+
}
|
|
805
|
+
setFromMatrix3Column(e, t) {
|
|
806
|
+
return this.fromArray(e.elements, t * 3);
|
|
807
|
+
}
|
|
808
|
+
setFromEuler(e) {
|
|
809
|
+
return this.x = e._x, this.y = e._y, this.z = e._z, this;
|
|
810
|
+
}
|
|
811
|
+
setFromColor(e) {
|
|
812
|
+
return this.x = e.r, this.y = e.g, this.z = e.b, this;
|
|
813
|
+
}
|
|
814
|
+
equals(e) {
|
|
815
|
+
return e.x === this.x && e.y === this.y && e.z === this.z;
|
|
816
|
+
}
|
|
817
|
+
fromArray(e, t = 0) {
|
|
818
|
+
return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this;
|
|
819
|
+
}
|
|
820
|
+
toArray(e = [], t = 0) {
|
|
821
|
+
return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e;
|
|
822
|
+
}
|
|
823
|
+
fromBufferAttribute(e, t) {
|
|
824
|
+
return this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this;
|
|
825
|
+
}
|
|
826
|
+
random() {
|
|
827
|
+
return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this;
|
|
828
|
+
}
|
|
829
|
+
randomDirection() {
|
|
830
|
+
let e = Math.random() * Math.PI * 2, t = Math.random() * 2 - 1, n = Math.sqrt(1 - t * t);
|
|
831
|
+
return this.x = n * Math.cos(e), this.y = t, this.z = n * Math.sin(e), this;
|
|
832
|
+
}
|
|
833
|
+
*[Symbol.iterator]() {
|
|
834
|
+
yield this.x, yield this.y, yield this.z;
|
|
835
|
+
}
|
|
836
|
+
}, oe = /* @__PURE__ */ new B(), se = /* @__PURE__ */ new z(), ce = class e {
|
|
837
|
+
static {
|
|
838
|
+
e.prototype.isMatrix3 = !0;
|
|
839
|
+
}
|
|
840
|
+
constructor(e, t, n, r, i, a, o, s, c) {
|
|
841
|
+
this.elements = [
|
|
842
|
+
1,
|
|
843
|
+
0,
|
|
844
|
+
0,
|
|
845
|
+
0,
|
|
846
|
+
1,
|
|
847
|
+
0,
|
|
848
|
+
0,
|
|
849
|
+
0,
|
|
850
|
+
1
|
|
851
|
+
], e !== void 0 && this.set(e, t, n, r, i, a, o, s, c);
|
|
852
|
+
}
|
|
853
|
+
set(e, t, n, r, i, a, o, s, c) {
|
|
854
|
+
let l = this.elements;
|
|
855
|
+
return l[0] = e, l[1] = r, l[2] = o, l[3] = t, l[4] = i, l[5] = s, l[6] = n, l[7] = a, l[8] = c, this;
|
|
856
|
+
}
|
|
857
|
+
identity() {
|
|
858
|
+
return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this;
|
|
859
|
+
}
|
|
860
|
+
copy(e) {
|
|
861
|
+
let t = this.elements, n = e.elements;
|
|
862
|
+
return t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t[4] = n[4], t[5] = n[5], t[6] = n[6], t[7] = n[7], t[8] = n[8], this;
|
|
863
|
+
}
|
|
864
|
+
extractBasis(e, t, n) {
|
|
865
|
+
return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), n.setFromMatrix3Column(this, 2), this;
|
|
866
|
+
}
|
|
867
|
+
setFromMatrix4(e) {
|
|
868
|
+
let t = e.elements;
|
|
869
|
+
return this.set(t[0], t[4], t[8], t[1], t[5], t[9], t[2], t[6], t[10]), this;
|
|
870
|
+
}
|
|
871
|
+
multiply(e) {
|
|
872
|
+
return this.multiplyMatrices(this, e);
|
|
873
|
+
}
|
|
874
|
+
premultiply(e) {
|
|
875
|
+
return this.multiplyMatrices(e, this);
|
|
876
|
+
}
|
|
877
|
+
multiplyMatrices(e, t) {
|
|
878
|
+
let n = e.elements, r = t.elements, i = this.elements, a = n[0], o = n[3], s = n[6], c = n[1], l = n[4], u = n[7], d = n[2], f = n[5], p = n[8], m = r[0], h = r[3], g = r[6], _ = r[1], v = r[4], y = r[7], b = r[2], x = r[5], S = r[8];
|
|
879
|
+
return i[0] = a * m + o * _ + s * b, i[3] = a * h + o * v + s * x, i[6] = a * g + o * y + s * S, i[1] = c * m + l * _ + u * b, i[4] = c * h + l * v + u * x, i[7] = c * g + l * y + u * S, i[2] = d * m + f * _ + p * b, i[5] = d * h + f * v + p * x, i[8] = d * g + f * y + p * S, this;
|
|
880
|
+
}
|
|
881
|
+
multiplyScalar(e) {
|
|
882
|
+
let t = this.elements;
|
|
883
|
+
return t[0] *= e, t[3] *= e, t[6] *= e, t[1] *= e, t[4] *= e, t[7] *= e, t[2] *= e, t[5] *= e, t[8] *= e, this;
|
|
884
|
+
}
|
|
885
|
+
determinant() {
|
|
886
|
+
let e = this.elements, t = e[0], n = e[1], r = e[2], i = e[3], a = e[4], o = e[5], s = e[6], c = e[7], l = e[8];
|
|
887
|
+
return t * a * l - t * o * c - n * i * l + n * o * s + r * i * c - r * a * s;
|
|
888
|
+
}
|
|
889
|
+
invert() {
|
|
890
|
+
let e = this.elements, t = e[0], n = e[1], r = e[2], i = e[3], a = e[4], o = e[5], s = e[6], c = e[7], l = e[8], u = l * a - o * c, d = o * s - l * i, f = c * i - a * s, p = t * u + n * d + r * f;
|
|
891
|
+
if (p === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
892
|
+
let m = 1 / p;
|
|
893
|
+
return e[0] = u * m, e[1] = (r * c - l * n) * m, e[2] = (o * n - r * a) * m, e[3] = d * m, e[4] = (l * t - r * s) * m, e[5] = (r * i - o * t) * m, e[6] = f * m, e[7] = (n * s - c * t) * m, e[8] = (a * t - n * i) * m, this;
|
|
894
|
+
}
|
|
895
|
+
transpose() {
|
|
896
|
+
let e, t = this.elements;
|
|
897
|
+
return e = t[1], t[1] = t[3], t[3] = e, e = t[2], t[2] = t[6], t[6] = e, e = t[5], t[5] = t[7], t[7] = e, this;
|
|
898
|
+
}
|
|
899
|
+
getNormalMatrix(e) {
|
|
900
|
+
return this.setFromMatrix4(e).invert().transpose();
|
|
901
|
+
}
|
|
902
|
+
transposeIntoArray(e) {
|
|
903
|
+
let t = this.elements;
|
|
904
|
+
return e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8], this;
|
|
905
|
+
}
|
|
906
|
+
setUvTransform(e, t, n, r, i, a, o) {
|
|
907
|
+
let s = Math.cos(i), c = Math.sin(i);
|
|
908
|
+
return this.set(n * s, n * c, -n * (s * a + c * o) + a + e, -r * c, r * s, -r * (-c * a + s * o) + o + t, 0, 0, 1), this;
|
|
909
|
+
}
|
|
910
|
+
scale(e, t) {
|
|
911
|
+
return this.premultiply(le.makeScale(e, t)), this;
|
|
912
|
+
}
|
|
913
|
+
rotate(e) {
|
|
914
|
+
return this.premultiply(le.makeRotation(-e)), this;
|
|
915
|
+
}
|
|
916
|
+
translate(e, t) {
|
|
917
|
+
return this.premultiply(le.makeTranslation(e, t)), this;
|
|
918
|
+
}
|
|
919
|
+
makeTranslation(e, t) {
|
|
920
|
+
return e.isVector2 ? this.set(1, 0, e.x, 0, 1, e.y, 0, 0, 1) : this.set(1, 0, e, 0, 1, t, 0, 0, 1), this;
|
|
921
|
+
}
|
|
922
|
+
makeRotation(e) {
|
|
923
|
+
let t = Math.cos(e), n = Math.sin(e);
|
|
924
|
+
return this.set(t, -n, 0, n, t, 0, 0, 0, 1), this;
|
|
925
|
+
}
|
|
926
|
+
makeScale(e, t) {
|
|
927
|
+
return this.set(e, 0, 0, 0, t, 0, 0, 0, 1), this;
|
|
928
|
+
}
|
|
929
|
+
equals(e) {
|
|
930
|
+
let t = this.elements, n = e.elements;
|
|
931
|
+
for (let e = 0; e < 9; e++) if (t[e] !== n[e]) return !1;
|
|
932
|
+
return !0;
|
|
933
|
+
}
|
|
934
|
+
fromArray(e, t = 0) {
|
|
935
|
+
for (let n = 0; n < 9; n++) this.elements[n] = e[n + t];
|
|
936
|
+
return this;
|
|
937
|
+
}
|
|
938
|
+
toArray(e = [], t = 0) {
|
|
939
|
+
let n = this.elements;
|
|
940
|
+
return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e;
|
|
941
|
+
}
|
|
942
|
+
clone() {
|
|
943
|
+
return new this.constructor().fromArray(this.elements);
|
|
944
|
+
}
|
|
945
|
+
}, le = /* @__PURE__ */ new ce(), ue = /* @__PURE__ */ new ce().set(.4123908, .3575843, .1804808, .212639, .7151687, .0721923, .0193308, .1191948, .9505322), de = /* @__PURE__ */ new ce().set(3.2409699, -1.5373832, -.4986108, -.9692436, 1.8759675, .0415551, .0556301, -.203977, 1.0569715);
|
|
946
|
+
function fe() {
|
|
947
|
+
let e = {
|
|
948
|
+
enabled: !0,
|
|
949
|
+
workingColorSpace: E,
|
|
950
|
+
spaces: {},
|
|
951
|
+
convert: function(e, t, n) {
|
|
952
|
+
return this.enabled === !1 || t === n || !t || !n ? e : (this.spaces[t].transfer === "srgb" && (e.r = H(e.r), e.g = H(e.g), e.b = H(e.b)), this.spaces[t].primaries !== this.spaces[n].primaries && (e.applyMatrix3(this.spaces[t].toXYZ), e.applyMatrix3(this.spaces[n].fromXYZ)), this.spaces[n].transfer === "srgb" && (e.r = U(e.r), e.g = U(e.g), e.b = U(e.b)), e);
|
|
953
|
+
},
|
|
954
|
+
workingToColorSpace: function(e, t) {
|
|
955
|
+
return this.convert(e, this.workingColorSpace, t);
|
|
956
|
+
},
|
|
957
|
+
colorSpaceToWorking: function(e, t) {
|
|
958
|
+
return this.convert(e, t, this.workingColorSpace);
|
|
959
|
+
},
|
|
960
|
+
getPrimaries: function(e) {
|
|
961
|
+
return this.spaces[e].primaries;
|
|
962
|
+
},
|
|
963
|
+
getTransfer: function(e) {
|
|
964
|
+
return e === "" ? D : this.spaces[e].transfer;
|
|
965
|
+
},
|
|
966
|
+
getToneMappingMode: function(e) {
|
|
967
|
+
return this.spaces[e].outputColorSpaceConfig.toneMappingMode || "standard";
|
|
968
|
+
},
|
|
969
|
+
getLuminanceCoefficients: function(e, t = this.workingColorSpace) {
|
|
970
|
+
return e.fromArray(this.spaces[t].luminanceCoefficients);
|
|
971
|
+
},
|
|
972
|
+
define: function(e) {
|
|
973
|
+
Object.assign(this.spaces, e);
|
|
974
|
+
},
|
|
975
|
+
_getMatrix: function(e, t, n) {
|
|
976
|
+
return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ);
|
|
977
|
+
},
|
|
978
|
+
_getDrawingBufferColorSpace: function(e) {
|
|
979
|
+
return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace;
|
|
980
|
+
},
|
|
981
|
+
_getUnpackColorSpace: function(e = this.workingColorSpace) {
|
|
982
|
+
return this.spaces[e].workingColorSpaceConfig.unpackColorSpace;
|
|
983
|
+
},
|
|
984
|
+
fromWorkingColorSpace: function(t, n) {
|
|
985
|
+
return ee("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."), e.workingToColorSpace(t, n);
|
|
986
|
+
},
|
|
987
|
+
toWorkingColorSpace: function(t, n) {
|
|
988
|
+
return ee("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."), e.colorSpaceToWorking(t, n);
|
|
989
|
+
}
|
|
990
|
+
}, t = [
|
|
991
|
+
.64,
|
|
992
|
+
.33,
|
|
993
|
+
.3,
|
|
994
|
+
.6,
|
|
995
|
+
.15,
|
|
996
|
+
.06
|
|
997
|
+
], n = [
|
|
998
|
+
.2126,
|
|
999
|
+
.7152,
|
|
1000
|
+
.0722
|
|
1001
|
+
], r = [.3127, .329];
|
|
1002
|
+
return e.define({
|
|
1003
|
+
[E]: {
|
|
1004
|
+
primaries: t,
|
|
1005
|
+
whitePoint: r,
|
|
1006
|
+
transfer: D,
|
|
1007
|
+
toXYZ: ue,
|
|
1008
|
+
fromXYZ: de,
|
|
1009
|
+
luminanceCoefficients: n,
|
|
1010
|
+
workingColorSpaceConfig: { unpackColorSpace: T },
|
|
1011
|
+
outputColorSpaceConfig: { drawingBufferColorSpace: T }
|
|
1012
|
+
},
|
|
1013
|
+
[T]: {
|
|
1014
|
+
primaries: t,
|
|
1015
|
+
whitePoint: r,
|
|
1016
|
+
transfer: O,
|
|
1017
|
+
toXYZ: ue,
|
|
1018
|
+
fromXYZ: de,
|
|
1019
|
+
luminanceCoefficients: n,
|
|
1020
|
+
outputColorSpaceConfig: { drawingBufferColorSpace: T }
|
|
1021
|
+
}
|
|
1022
|
+
}), e;
|
|
1023
|
+
}
|
|
1024
|
+
var V = /* @__PURE__ */ fe();
|
|
1025
|
+
function H(e) {
|
|
1026
|
+
return e < .04045 ? e * .0773993808 : (e * .9478672986 + .0521327014) ** 2.4;
|
|
1027
|
+
}
|
|
1028
|
+
function U(e) {
|
|
1029
|
+
return e < .0031308 ? e * 12.92 : 1.055 * e ** .41666 - .055;
|
|
1030
|
+
}
|
|
1031
|
+
var W, pe = class {
|
|
1032
|
+
static getDataURL(e, t = "image/png") {
|
|
1033
|
+
if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u") return e.src;
|
|
1034
|
+
let n;
|
|
1035
|
+
if (e instanceof HTMLCanvasElement) n = e;
|
|
1036
|
+
else {
|
|
1037
|
+
W === void 0 && (W = j("canvas")), W.width = e.width, W.height = e.height;
|
|
1038
|
+
let t = W.getContext("2d");
|
|
1039
|
+
e instanceof ImageData ? t.putImageData(e, 0, 0) : t.drawImage(e, 0, 0, e.width, e.height), n = W;
|
|
1040
|
+
}
|
|
1041
|
+
return n.toDataURL(t);
|
|
1042
|
+
}
|
|
1043
|
+
static sRGBToLinear(e) {
|
|
1044
|
+
if (typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap) {
|
|
1045
|
+
let t = j("canvas");
|
|
1046
|
+
t.width = e.width, t.height = e.height;
|
|
1047
|
+
let n = t.getContext("2d");
|
|
1048
|
+
n.drawImage(e, 0, 0, e.width, e.height);
|
|
1049
|
+
let r = n.getImageData(0, 0, e.width, e.height), i = r.data;
|
|
1050
|
+
for (let e = 0; e < i.length; e++) i[e] = H(i[e] / 255) * 255;
|
|
1051
|
+
return n.putImageData(r, 0, 0), t;
|
|
1052
|
+
} else if (e.data) {
|
|
1053
|
+
let t = e.data.slice(0);
|
|
1054
|
+
for (let e = 0; e < t.length; e++) t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[e] = Math.floor(H(t[e] / 255) * 255) : t[e] = H(t[e]);
|
|
1055
|
+
return {
|
|
1056
|
+
data: t,
|
|
1057
|
+
width: e.width,
|
|
1058
|
+
height: e.height
|
|
1059
|
+
};
|
|
1060
|
+
} else return F("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e;
|
|
1061
|
+
}
|
|
1062
|
+
}, me = 0, he = class {
|
|
1063
|
+
constructor(e = null) {
|
|
1064
|
+
this.isSource = !0, Object.defineProperty(this, "id", { value: me++ }), this.uuid = ne(), this.data = e, this.dataReady = !0, this.version = 0;
|
|
1065
|
+
}
|
|
1066
|
+
getSize(e) {
|
|
1067
|
+
let t = this.data;
|
|
1068
|
+
return typeof HTMLVideoElement < "u" && t instanceof HTMLVideoElement ? e.set(t.videoWidth, t.videoHeight, 0) : typeof VideoFrame < "u" && t instanceof VideoFrame ? e.set(t.displayWidth, t.displayHeight, 0) : t === null ? e.set(0, 0, 0) : e.set(t.width, t.height, t.depth || 0), e;
|
|
1069
|
+
}
|
|
1070
|
+
set needsUpdate(e) {
|
|
1071
|
+
e === !0 && this.version++;
|
|
1072
|
+
}
|
|
1073
|
+
toJSON(e) {
|
|
1074
|
+
let t = e === void 0 || typeof e == "string";
|
|
1075
|
+
if (!t && e.images[this.uuid] !== void 0) return e.images[this.uuid];
|
|
1076
|
+
let n = {
|
|
1077
|
+
uuid: this.uuid,
|
|
1078
|
+
url: ""
|
|
1079
|
+
}, r = this.data;
|
|
1080
|
+
if (r !== null) {
|
|
1081
|
+
let e;
|
|
1082
|
+
if (Array.isArray(r)) {
|
|
1083
|
+
e = [];
|
|
1084
|
+
for (let t = 0, n = r.length; t < n; t++) r[t].isDataTexture ? e.push(ge(r[t].image)) : e.push(ge(r[t]));
|
|
1085
|
+
} else e = ge(r);
|
|
1086
|
+
n.url = e;
|
|
1087
|
+
}
|
|
1088
|
+
return t || (e.images[this.uuid] = n), n;
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
function ge(e) {
|
|
1092
|
+
return typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap ? pe.getDataURL(e) : e.data ? {
|
|
1093
|
+
data: Array.from(e.data),
|
|
1094
|
+
width: e.width,
|
|
1095
|
+
height: e.height,
|
|
1096
|
+
type: e.data.constructor.name
|
|
1097
|
+
} : (F("Texture: Unable to serialize Texture."), {});
|
|
1098
|
+
}
|
|
1099
|
+
var _e = 0, ve = /* @__PURE__ */ new B(), ye = class e extends te {
|
|
1100
|
+
constructor(t = e.DEFAULT_IMAGE, n = e.DEFAULT_MAPPING, r = u, i = u, a = p, o = m, s = g, c = h, l = e.DEFAULT_ANISOTROPY, d = "") {
|
|
1101
|
+
super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: _e++ }), this.uuid = ne(), this.name = "", this.source = new he(t), this.mipmaps = [], this.mapping = n, this.channel = 0, this.wrapS = r, this.wrapT = i, this.magFilter = a, this.minFilter = o, this.anisotropy = l, this.format = s, this.internalFormat = null, this.type = c, this.offset = new ae(0, 0), this.repeat = new ae(1, 1), this.center = new ae(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new ce(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = d, this.userData = {}, this.updateRanges = [], this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.isArrayTexture = !!(t && t.depth && t.depth > 1), this.pmremVersion = 0, this.normalized = !1;
|
|
1102
|
+
}
|
|
1103
|
+
get width() {
|
|
1104
|
+
return this.source.getSize(ve).x;
|
|
1105
|
+
}
|
|
1106
|
+
get height() {
|
|
1107
|
+
return this.source.getSize(ve).y;
|
|
1108
|
+
}
|
|
1109
|
+
get depth() {
|
|
1110
|
+
return this.source.getSize(ve).z;
|
|
1111
|
+
}
|
|
1112
|
+
get image() {
|
|
1113
|
+
return this.source.data;
|
|
1114
|
+
}
|
|
1115
|
+
set image(e) {
|
|
1116
|
+
this.source.data = e;
|
|
1117
|
+
}
|
|
1118
|
+
updateMatrix() {
|
|
1119
|
+
this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y);
|
|
1120
|
+
}
|
|
1121
|
+
addUpdateRange(e, t) {
|
|
1122
|
+
this.updateRanges.push({
|
|
1123
|
+
start: e,
|
|
1124
|
+
count: t
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
clearUpdateRanges() {
|
|
1128
|
+
this.updateRanges.length = 0;
|
|
1129
|
+
}
|
|
1130
|
+
clone() {
|
|
1131
|
+
return new this.constructor().copy(this);
|
|
1132
|
+
}
|
|
1133
|
+
copy(e) {
|
|
1134
|
+
return this.name = e.name, this.source = e.source, this.mipmaps = e.mipmaps.slice(0), this.mapping = e.mapping, this.channel = e.channel, this.wrapS = e.wrapS, this.wrapT = e.wrapT, this.magFilter = e.magFilter, this.minFilter = e.minFilter, this.anisotropy = e.anisotropy, this.format = e.format, this.internalFormat = e.internalFormat, this.type = e.type, this.normalized = e.normalized, this.offset.copy(e.offset), this.repeat.copy(e.repeat), this.center.copy(e.center), this.rotation = e.rotation, this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrix.copy(e.matrix), this.generateMipmaps = e.generateMipmaps, this.premultiplyAlpha = e.premultiplyAlpha, this.flipY = e.flipY, this.unpackAlignment = e.unpackAlignment, this.colorSpace = e.colorSpace, this.renderTarget = e.renderTarget, this.isRenderTargetTexture = e.isRenderTargetTexture, this.isArrayTexture = e.isArrayTexture, this.userData = JSON.parse(JSON.stringify(e.userData)), this.needsUpdate = !0, this;
|
|
1135
|
+
}
|
|
1136
|
+
setValues(e) {
|
|
1137
|
+
for (let t in e) {
|
|
1138
|
+
let n = e[t];
|
|
1139
|
+
if (n === void 0) {
|
|
1140
|
+
F(`Texture.setValues(): parameter '${t}' has value of undefined.`);
|
|
1141
|
+
continue;
|
|
1142
|
+
}
|
|
1143
|
+
let r = this[t];
|
|
1144
|
+
if (r === void 0) {
|
|
1145
|
+
F(`Texture.setValues(): property '${t}' does not exist.`);
|
|
1146
|
+
continue;
|
|
1147
|
+
}
|
|
1148
|
+
r && n && r.isVector2 && n.isVector2 || r && n && r.isVector3 && n.isVector3 || r && n && r.isMatrix3 && n.isMatrix3 ? r.copy(n) : this[t] = n;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
toJSON(e) {
|
|
1152
|
+
let t = e === void 0 || typeof e == "string";
|
|
1153
|
+
if (!t && e.textures[this.uuid] !== void 0) return e.textures[this.uuid];
|
|
1154
|
+
let n = {
|
|
1155
|
+
metadata: {
|
|
1156
|
+
version: 4.7,
|
|
1157
|
+
type: "Texture",
|
|
1158
|
+
generator: "Texture.toJSON"
|
|
1159
|
+
},
|
|
1160
|
+
uuid: this.uuid,
|
|
1161
|
+
name: this.name,
|
|
1162
|
+
image: this.source.toJSON(e).uuid,
|
|
1163
|
+
mapping: this.mapping,
|
|
1164
|
+
channel: this.channel,
|
|
1165
|
+
repeat: [this.repeat.x, this.repeat.y],
|
|
1166
|
+
offset: [this.offset.x, this.offset.y],
|
|
1167
|
+
center: [this.center.x, this.center.y],
|
|
1168
|
+
rotation: this.rotation,
|
|
1169
|
+
wrap: [this.wrapS, this.wrapT],
|
|
1170
|
+
format: this.format,
|
|
1171
|
+
internalFormat: this.internalFormat,
|
|
1172
|
+
type: this.type,
|
|
1173
|
+
normalized: this.normalized,
|
|
1174
|
+
colorSpace: this.colorSpace,
|
|
1175
|
+
minFilter: this.minFilter,
|
|
1176
|
+
magFilter: this.magFilter,
|
|
1177
|
+
anisotropy: this.anisotropy,
|
|
1178
|
+
flipY: this.flipY,
|
|
1179
|
+
generateMipmaps: this.generateMipmaps,
|
|
1180
|
+
premultiplyAlpha: this.premultiplyAlpha,
|
|
1181
|
+
unpackAlignment: this.unpackAlignment
|
|
1182
|
+
};
|
|
1183
|
+
return Object.keys(this.userData).length > 0 && (n.userData = this.userData), t || (e.textures[this.uuid] = n), n;
|
|
1184
|
+
}
|
|
1185
|
+
dispose() {
|
|
1186
|
+
this.dispatchEvent({ type: "dispose" });
|
|
1187
|
+
}
|
|
1188
|
+
transformUv(e) {
|
|
1189
|
+
if (this.mapping !== 300) return e;
|
|
1190
|
+
if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1) switch (this.wrapS) {
|
|
1191
|
+
case l:
|
|
1192
|
+
e.x -= Math.floor(e.x);
|
|
1193
|
+
break;
|
|
1194
|
+
case u:
|
|
1195
|
+
e.x = e.x < 0 ? 0 : 1;
|
|
1196
|
+
break;
|
|
1197
|
+
case d:
|
|
1198
|
+
Math.abs(Math.floor(e.x) % 2) === 1 ? e.x = Math.ceil(e.x) - e.x : e.x -= Math.floor(e.x);
|
|
1199
|
+
break;
|
|
1200
|
+
}
|
|
1201
|
+
if (e.y < 0 || e.y > 1) switch (this.wrapT) {
|
|
1202
|
+
case l:
|
|
1203
|
+
e.y -= Math.floor(e.y);
|
|
1204
|
+
break;
|
|
1205
|
+
case u:
|
|
1206
|
+
e.y = e.y < 0 ? 0 : 1;
|
|
1207
|
+
break;
|
|
1208
|
+
case d:
|
|
1209
|
+
Math.abs(Math.floor(e.y) % 2) === 1 ? e.y = Math.ceil(e.y) - e.y : e.y -= Math.floor(e.y);
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
return this.flipY && (e.y = 1 - e.y), e;
|
|
1213
|
+
}
|
|
1214
|
+
set needsUpdate(e) {
|
|
1215
|
+
e === !0 && (this.version++, this.source.needsUpdate = !0);
|
|
1216
|
+
}
|
|
1217
|
+
set needsPMREMUpdate(e) {
|
|
1218
|
+
e === !0 && this.pmremVersion++;
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
ye.DEFAULT_IMAGE = null, ye.DEFAULT_MAPPING = 300, ye.DEFAULT_ANISOTROPY = 1, class e {
|
|
1222
|
+
static {
|
|
1223
|
+
e.prototype.isVector4 = !0;
|
|
1224
|
+
}
|
|
1225
|
+
constructor(e = 0, t = 0, n = 0, r = 1) {
|
|
1226
|
+
this.x = e, this.y = t, this.z = n, this.w = r;
|
|
1227
|
+
}
|
|
1228
|
+
get width() {
|
|
1229
|
+
return this.z;
|
|
1230
|
+
}
|
|
1231
|
+
set width(e) {
|
|
1232
|
+
this.z = e;
|
|
1233
|
+
}
|
|
1234
|
+
get height() {
|
|
1235
|
+
return this.w;
|
|
1236
|
+
}
|
|
1237
|
+
set height(e) {
|
|
1238
|
+
this.w = e;
|
|
1239
|
+
}
|
|
1240
|
+
set(e, t, n, r) {
|
|
1241
|
+
return this.x = e, this.y = t, this.z = n, this.w = r, this;
|
|
1242
|
+
}
|
|
1243
|
+
setScalar(e) {
|
|
1244
|
+
return this.x = e, this.y = e, this.z = e, this.w = e, this;
|
|
1245
|
+
}
|
|
1246
|
+
setX(e) {
|
|
1247
|
+
return this.x = e, this;
|
|
1248
|
+
}
|
|
1249
|
+
setY(e) {
|
|
1250
|
+
return this.y = e, this;
|
|
1251
|
+
}
|
|
1252
|
+
setZ(e) {
|
|
1253
|
+
return this.z = e, this;
|
|
1254
|
+
}
|
|
1255
|
+
setW(e) {
|
|
1256
|
+
return this.w = e, this;
|
|
1257
|
+
}
|
|
1258
|
+
setComponent(e, t) {
|
|
1259
|
+
switch (e) {
|
|
1260
|
+
case 0:
|
|
1261
|
+
this.x = t;
|
|
1262
|
+
break;
|
|
1263
|
+
case 1:
|
|
1264
|
+
this.y = t;
|
|
1265
|
+
break;
|
|
1266
|
+
case 2:
|
|
1267
|
+
this.z = t;
|
|
1268
|
+
break;
|
|
1269
|
+
case 3:
|
|
1270
|
+
this.w = t;
|
|
1271
|
+
break;
|
|
1272
|
+
default: throw Error("index is out of range: " + e);
|
|
1273
|
+
}
|
|
1274
|
+
return this;
|
|
1275
|
+
}
|
|
1276
|
+
getComponent(e) {
|
|
1277
|
+
switch (e) {
|
|
1278
|
+
case 0: return this.x;
|
|
1279
|
+
case 1: return this.y;
|
|
1280
|
+
case 2: return this.z;
|
|
1281
|
+
case 3: return this.w;
|
|
1282
|
+
default: throw Error("index is out of range: " + e);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
clone() {
|
|
1286
|
+
return new this.constructor(this.x, this.y, this.z, this.w);
|
|
1287
|
+
}
|
|
1288
|
+
copy(e) {
|
|
1289
|
+
return this.x = e.x, this.y = e.y, this.z = e.z, this.w = e.w === void 0 ? 1 : e.w, this;
|
|
1290
|
+
}
|
|
1291
|
+
add(e) {
|
|
1292
|
+
return this.x += e.x, this.y += e.y, this.z += e.z, this.w += e.w, this;
|
|
1293
|
+
}
|
|
1294
|
+
addScalar(e) {
|
|
1295
|
+
return this.x += e, this.y += e, this.z += e, this.w += e, this;
|
|
1296
|
+
}
|
|
1297
|
+
addVectors(e, t) {
|
|
1298
|
+
return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this.w = e.w + t.w, this;
|
|
1299
|
+
}
|
|
1300
|
+
addScaledVector(e, t) {
|
|
1301
|
+
return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this.w += e.w * t, this;
|
|
1302
|
+
}
|
|
1303
|
+
sub(e) {
|
|
1304
|
+
return this.x -= e.x, this.y -= e.y, this.z -= e.z, this.w -= e.w, this;
|
|
1305
|
+
}
|
|
1306
|
+
subScalar(e) {
|
|
1307
|
+
return this.x -= e, this.y -= e, this.z -= e, this.w -= e, this;
|
|
1308
|
+
}
|
|
1309
|
+
subVectors(e, t) {
|
|
1310
|
+
return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this.w = e.w - t.w, this;
|
|
1311
|
+
}
|
|
1312
|
+
multiply(e) {
|
|
1313
|
+
return this.x *= e.x, this.y *= e.y, this.z *= e.z, this.w *= e.w, this;
|
|
1314
|
+
}
|
|
1315
|
+
multiplyScalar(e) {
|
|
1316
|
+
return this.x *= e, this.y *= e, this.z *= e, this.w *= e, this;
|
|
1317
|
+
}
|
|
1318
|
+
applyMatrix4(e) {
|
|
1319
|
+
let t = this.x, n = this.y, r = this.z, i = this.w, a = e.elements;
|
|
1320
|
+
return this.x = a[0] * t + a[4] * n + a[8] * r + a[12] * i, this.y = a[1] * t + a[5] * n + a[9] * r + a[13] * i, this.z = a[2] * t + a[6] * n + a[10] * r + a[14] * i, this.w = a[3] * t + a[7] * n + a[11] * r + a[15] * i, this;
|
|
1321
|
+
}
|
|
1322
|
+
divide(e) {
|
|
1323
|
+
return this.x /= e.x, this.y /= e.y, this.z /= e.z, this.w /= e.w, this;
|
|
1324
|
+
}
|
|
1325
|
+
divideScalar(e) {
|
|
1326
|
+
return this.multiplyScalar(1 / e);
|
|
1327
|
+
}
|
|
1328
|
+
setAxisAngleFromQuaternion(e) {
|
|
1329
|
+
this.w = 2 * Math.acos(e.w);
|
|
1330
|
+
let t = Math.sqrt(1 - e.w * e.w);
|
|
1331
|
+
return t < 1e-4 ? (this.x = 1, this.y = 0, this.z = 0) : (this.x = e.x / t, this.y = e.y / t, this.z = e.z / t), this;
|
|
1332
|
+
}
|
|
1333
|
+
setAxisAngleFromRotationMatrix(e) {
|
|
1334
|
+
let t, n, r, i, a = .01, o = .1, s = e.elements, c = s[0], l = s[4], u = s[8], d = s[1], f = s[5], p = s[9], m = s[2], h = s[6], g = s[10];
|
|
1335
|
+
if (Math.abs(l - d) < a && Math.abs(u - m) < a && Math.abs(p - h) < a) {
|
|
1336
|
+
if (Math.abs(l + d) < o && Math.abs(u + m) < o && Math.abs(p + h) < o && Math.abs(c + f + g - 3) < o) return this.set(1, 0, 0, 0), this;
|
|
1337
|
+
t = Math.PI;
|
|
1338
|
+
let e = (c + 1) / 2, s = (f + 1) / 2, _ = (g + 1) / 2, v = (l + d) / 4, y = (u + m) / 4, b = (p + h) / 4;
|
|
1339
|
+
return e > s && e > _ ? e < a ? (n = 0, r = .707106781, i = .707106781) : (n = Math.sqrt(e), r = v / n, i = y / n) : s > _ ? s < a ? (n = .707106781, r = 0, i = .707106781) : (r = Math.sqrt(s), n = v / r, i = b / r) : _ < a ? (n = .707106781, r = .707106781, i = 0) : (i = Math.sqrt(_), n = y / i, r = b / i), this.set(n, r, i, t), this;
|
|
1340
|
+
}
|
|
1341
|
+
let _ = Math.sqrt((h - p) * (h - p) + (u - m) * (u - m) + (d - l) * (d - l));
|
|
1342
|
+
return Math.abs(_) < .001 && (_ = 1), this.x = (h - p) / _, this.y = (u - m) / _, this.z = (d - l) / _, this.w = Math.acos((c + f + g - 1) / 2), this;
|
|
1343
|
+
}
|
|
1344
|
+
setFromMatrixPosition(e) {
|
|
1345
|
+
let t = e.elements;
|
|
1346
|
+
return this.x = t[12], this.y = t[13], this.z = t[14], this.w = t[15], this;
|
|
1347
|
+
}
|
|
1348
|
+
min(e) {
|
|
1349
|
+
return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this.w = Math.min(this.w, e.w), this;
|
|
1350
|
+
}
|
|
1351
|
+
max(e) {
|
|
1352
|
+
return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this.w = Math.max(this.w, e.w), this;
|
|
1353
|
+
}
|
|
1354
|
+
clamp(e, t) {
|
|
1355
|
+
return this.x = R(this.x, e.x, t.x), this.y = R(this.y, e.y, t.y), this.z = R(this.z, e.z, t.z), this.w = R(this.w, e.w, t.w), this;
|
|
1356
|
+
}
|
|
1357
|
+
clampScalar(e, t) {
|
|
1358
|
+
return this.x = R(this.x, e, t), this.y = R(this.y, e, t), this.z = R(this.z, e, t), this.w = R(this.w, e, t), this;
|
|
1359
|
+
}
|
|
1360
|
+
clampLength(e, t) {
|
|
1361
|
+
let n = this.length();
|
|
1362
|
+
return this.divideScalar(n || 1).multiplyScalar(R(n, e, t));
|
|
1363
|
+
}
|
|
1364
|
+
floor() {
|
|
1365
|
+
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this.w = Math.floor(this.w), this;
|
|
1366
|
+
}
|
|
1367
|
+
ceil() {
|
|
1368
|
+
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this.w = Math.ceil(this.w), this;
|
|
1369
|
+
}
|
|
1370
|
+
round() {
|
|
1371
|
+
return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this.w = Math.round(this.w), this;
|
|
1372
|
+
}
|
|
1373
|
+
roundToZero() {
|
|
1374
|
+
return this.x = Math.trunc(this.x), this.y = Math.trunc(this.y), this.z = Math.trunc(this.z), this.w = Math.trunc(this.w), this;
|
|
1375
|
+
}
|
|
1376
|
+
negate() {
|
|
1377
|
+
return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, this;
|
|
1378
|
+
}
|
|
1379
|
+
dot(e) {
|
|
1380
|
+
return this.x * e.x + this.y * e.y + this.z * e.z + this.w * e.w;
|
|
1381
|
+
}
|
|
1382
|
+
lengthSq() {
|
|
1383
|
+
return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
|
|
1384
|
+
}
|
|
1385
|
+
length() {
|
|
1386
|
+
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
|
|
1387
|
+
}
|
|
1388
|
+
manhattanLength() {
|
|
1389
|
+
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w);
|
|
1390
|
+
}
|
|
1391
|
+
normalize() {
|
|
1392
|
+
return this.divideScalar(this.length() || 1);
|
|
1393
|
+
}
|
|
1394
|
+
setLength(e) {
|
|
1395
|
+
return this.normalize().multiplyScalar(e);
|
|
1396
|
+
}
|
|
1397
|
+
lerp(e, t) {
|
|
1398
|
+
return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this.w += (e.w - this.w) * t, this;
|
|
1399
|
+
}
|
|
1400
|
+
lerpVectors(e, t, n) {
|
|
1401
|
+
return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this.z = e.z + (t.z - e.z) * n, this.w = e.w + (t.w - e.w) * n, this;
|
|
1402
|
+
}
|
|
1403
|
+
equals(e) {
|
|
1404
|
+
return e.x === this.x && e.y === this.y && e.z === this.z && e.w === this.w;
|
|
1405
|
+
}
|
|
1406
|
+
fromArray(e, t = 0) {
|
|
1407
|
+
return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this.w = e[t + 3], this;
|
|
1408
|
+
}
|
|
1409
|
+
toArray(e = [], t = 0) {
|
|
1410
|
+
return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e[t + 3] = this.w, e;
|
|
1411
|
+
}
|
|
1412
|
+
fromBufferAttribute(e, t) {
|
|
1413
|
+
return this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this.w = e.getW(t), this;
|
|
1414
|
+
}
|
|
1415
|
+
random() {
|
|
1416
|
+
return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this.w = Math.random(), this;
|
|
1417
|
+
}
|
|
1418
|
+
*[Symbol.iterator]() {
|
|
1419
|
+
yield this.x, yield this.y, yield this.z, yield this.w;
|
|
1420
|
+
}
|
|
1421
|
+
};
|
|
1422
|
+
var be = class e {
|
|
1423
|
+
static {
|
|
1424
|
+
e.prototype.isMatrix4 = !0;
|
|
1425
|
+
}
|
|
1426
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
|
|
1427
|
+
this.elements = [
|
|
1428
|
+
1,
|
|
1429
|
+
0,
|
|
1430
|
+
0,
|
|
1431
|
+
0,
|
|
1432
|
+
0,
|
|
1433
|
+
1,
|
|
1434
|
+
0,
|
|
1435
|
+
0,
|
|
1436
|
+
0,
|
|
1437
|
+
0,
|
|
1438
|
+
1,
|
|
1439
|
+
0,
|
|
1440
|
+
0,
|
|
1441
|
+
0,
|
|
1442
|
+
0,
|
|
1443
|
+
1
|
|
1444
|
+
], e !== void 0 && this.set(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h);
|
|
1445
|
+
}
|
|
1446
|
+
set(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
|
|
1447
|
+
let g = this.elements;
|
|
1448
|
+
return g[0] = e, g[4] = t, g[8] = n, g[12] = r, g[1] = i, g[5] = a, g[9] = o, g[13] = s, g[2] = c, g[6] = l, g[10] = u, g[14] = d, g[3] = f, g[7] = p, g[11] = m, g[15] = h, this;
|
|
1449
|
+
}
|
|
1450
|
+
identity() {
|
|
1451
|
+
return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
|
|
1452
|
+
}
|
|
1453
|
+
clone() {
|
|
1454
|
+
return new e().fromArray(this.elements);
|
|
1455
|
+
}
|
|
1456
|
+
copy(e) {
|
|
1457
|
+
let t = this.elements, n = e.elements;
|
|
1458
|
+
return t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t[4] = n[4], t[5] = n[5], t[6] = n[6], t[7] = n[7], t[8] = n[8], t[9] = n[9], t[10] = n[10], t[11] = n[11], t[12] = n[12], t[13] = n[13], t[14] = n[14], t[15] = n[15], this;
|
|
1459
|
+
}
|
|
1460
|
+
copyPosition(e) {
|
|
1461
|
+
let t = this.elements, n = e.elements;
|
|
1462
|
+
return t[12] = n[12], t[13] = n[13], t[14] = n[14], this;
|
|
1463
|
+
}
|
|
1464
|
+
setFromMatrix3(e) {
|
|
1465
|
+
let t = e.elements;
|
|
1466
|
+
return this.set(t[0], t[3], t[6], 0, t[1], t[4], t[7], 0, t[2], t[5], t[8], 0, 0, 0, 0, 1), this;
|
|
1467
|
+
}
|
|
1468
|
+
extractBasis(e, t, n) {
|
|
1469
|
+
return this.determinant() === 0 ? (e.set(1, 0, 0), t.set(0, 1, 0), n.set(0, 0, 1), this) : (e.setFromMatrixColumn(this, 0), t.setFromMatrixColumn(this, 1), n.setFromMatrixColumn(this, 2), this);
|
|
1470
|
+
}
|
|
1471
|
+
makeBasis(e, t, n) {
|
|
1472
|
+
return this.set(e.x, t.x, n.x, 0, e.y, t.y, n.y, 0, e.z, t.z, n.z, 0, 0, 0, 0, 1), this;
|
|
1473
|
+
}
|
|
1474
|
+
extractRotation(e) {
|
|
1475
|
+
if (e.determinant() === 0) return this.identity();
|
|
1476
|
+
let t = this.elements, n = e.elements, r = 1 / xe.setFromMatrixColumn(e, 0).length(), i = 1 / xe.setFromMatrixColumn(e, 1).length(), a = 1 / xe.setFromMatrixColumn(e, 2).length();
|
|
1477
|
+
return t[0] = n[0] * r, t[1] = n[1] * r, t[2] = n[2] * r, t[3] = 0, t[4] = n[4] * i, t[5] = n[5] * i, t[6] = n[6] * i, t[7] = 0, t[8] = n[8] * a, t[9] = n[9] * a, t[10] = n[10] * a, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;
|
|
1478
|
+
}
|
|
1479
|
+
makeRotationFromEuler(e) {
|
|
1480
|
+
let t = this.elements, n = e.x, r = e.y, i = e.z, a = Math.cos(n), o = Math.sin(n), s = Math.cos(r), c = Math.sin(r), l = Math.cos(i), u = Math.sin(i);
|
|
1481
|
+
if (e.order === "XYZ") {
|
|
1482
|
+
let e = a * l, n = a * u, r = o * l, i = o * u;
|
|
1483
|
+
t[0] = s * l, t[4] = -s * u, t[8] = c, t[1] = n + r * c, t[5] = e - i * c, t[9] = -o * s, t[2] = i - e * c, t[6] = r + n * c, t[10] = a * s;
|
|
1484
|
+
} else if (e.order === "YXZ") {
|
|
1485
|
+
let e = s * l, n = s * u, r = c * l, i = c * u;
|
|
1486
|
+
t[0] = e + i * o, t[4] = r * o - n, t[8] = a * c, t[1] = a * u, t[5] = a * l, t[9] = -o, t[2] = n * o - r, t[6] = i + e * o, t[10] = a * s;
|
|
1487
|
+
} else if (e.order === "ZXY") {
|
|
1488
|
+
let e = s * l, n = s * u, r = c * l, i = c * u;
|
|
1489
|
+
t[0] = e - i * o, t[4] = -a * u, t[8] = r + n * o, t[1] = n + r * o, t[5] = a * l, t[9] = i - e * o, t[2] = -a * c, t[6] = o, t[10] = a * s;
|
|
1490
|
+
} else if (e.order === "ZYX") {
|
|
1491
|
+
let e = a * l, n = a * u, r = o * l, i = o * u;
|
|
1492
|
+
t[0] = s * l, t[4] = r * c - n, t[8] = e * c + i, t[1] = s * u, t[5] = i * c + e, t[9] = n * c - r, t[2] = -c, t[6] = o * s, t[10] = a * s;
|
|
1493
|
+
} else if (e.order === "YZX") {
|
|
1494
|
+
let e = a * s, n = a * c, r = o * s, i = o * c;
|
|
1495
|
+
t[0] = s * l, t[4] = i - e * u, t[8] = r * u + n, t[1] = u, t[5] = a * l, t[9] = -o * l, t[2] = -c * l, t[6] = n * u + r, t[10] = e - i * u;
|
|
1496
|
+
} else if (e.order === "XZY") {
|
|
1497
|
+
let e = a * s, n = a * c, r = o * s, i = o * c;
|
|
1498
|
+
t[0] = s * l, t[4] = -u, t[8] = c * l, t[1] = e * u + i, t[5] = a * l, t[9] = n * u - r, t[2] = r * u - n, t[6] = o * l, t[10] = i * u + e;
|
|
1499
|
+
}
|
|
1500
|
+
return t[3] = 0, t[7] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;
|
|
1501
|
+
}
|
|
1502
|
+
makeRotationFromQuaternion(e) {
|
|
1503
|
+
return this.compose(Se, e, Ce);
|
|
1504
|
+
}
|
|
1505
|
+
lookAt(e, t, n) {
|
|
1506
|
+
let r = this.elements;
|
|
1507
|
+
return q.subVectors(e, t), q.lengthSq() === 0 && (q.z = 1), q.normalize(), K.crossVectors(n, q), K.lengthSq() === 0 && (Math.abs(n.z) === 1 ? q.x += 1e-4 : q.z += 1e-4, q.normalize(), K.crossVectors(n, q)), K.normalize(), we.crossVectors(q, K), r[0] = K.x, r[4] = we.x, r[8] = q.x, r[1] = K.y, r[5] = we.y, r[9] = q.y, r[2] = K.z, r[6] = we.z, r[10] = q.z, this;
|
|
1508
|
+
}
|
|
1509
|
+
multiply(e) {
|
|
1510
|
+
return this.multiplyMatrices(this, e);
|
|
1511
|
+
}
|
|
1512
|
+
premultiply(e) {
|
|
1513
|
+
return this.multiplyMatrices(e, this);
|
|
1514
|
+
}
|
|
1515
|
+
multiplyMatrices(e, t) {
|
|
1516
|
+
let n = e.elements, r = t.elements, i = this.elements, a = n[0], o = n[4], s = n[8], c = n[12], l = n[1], u = n[5], d = n[9], f = n[13], p = n[2], m = n[6], h = n[10], g = n[14], _ = n[3], v = n[7], y = n[11], b = n[15], x = r[0], S = r[4], C = r[8], w = r[12], T = r[1], E = r[5], D = r[9], O = r[13], k = r[2], A = r[6], j = r[10], M = r[14], N = r[3], P = r[7], F = r[11], I = r[15];
|
|
1517
|
+
return i[0] = a * x + o * T + s * k + c * N, i[4] = a * S + o * E + s * A + c * P, i[8] = a * C + o * D + s * j + c * F, i[12] = a * w + o * O + s * M + c * I, i[1] = l * x + u * T + d * k + f * N, i[5] = l * S + u * E + d * A + f * P, i[9] = l * C + u * D + d * j + f * F, i[13] = l * w + u * O + d * M + f * I, i[2] = p * x + m * T + h * k + g * N, i[6] = p * S + m * E + h * A + g * P, i[10] = p * C + m * D + h * j + g * F, i[14] = p * w + m * O + h * M + g * I, i[3] = _ * x + v * T + y * k + b * N, i[7] = _ * S + v * E + y * A + b * P, i[11] = _ * C + v * D + y * j + b * F, i[15] = _ * w + v * O + y * M + b * I, this;
|
|
1518
|
+
}
|
|
1519
|
+
multiplyScalar(e) {
|
|
1520
|
+
let t = this.elements;
|
|
1521
|
+
return t[0] *= e, t[4] *= e, t[8] *= e, t[12] *= e, t[1] *= e, t[5] *= e, t[9] *= e, t[13] *= e, t[2] *= e, t[6] *= e, t[10] *= e, t[14] *= e, t[3] *= e, t[7] *= e, t[11] *= e, t[15] *= e, this;
|
|
1522
|
+
}
|
|
1523
|
+
determinant() {
|
|
1524
|
+
let e = this.elements, t = e[0], n = e[4], r = e[8], i = e[12], a = e[1], o = e[5], s = e[9], c = e[13], l = e[2], u = e[6], d = e[10], f = e[14], p = e[3], m = e[7], h = e[11], g = e[15], _ = s * f - c * d, v = o * f - c * u, y = o * d - s * u, b = a * f - c * l, x = a * d - s * l, S = a * u - o * l;
|
|
1525
|
+
return t * (m * _ - h * v + g * y) - n * (p * _ - h * b + g * x) + r * (p * v - m * b + g * S) - i * (p * y - m * x + h * S);
|
|
1526
|
+
}
|
|
1527
|
+
transpose() {
|
|
1528
|
+
let e = this.elements, t;
|
|
1529
|
+
return t = e[1], e[1] = e[4], e[4] = t, t = e[2], e[2] = e[8], e[8] = t, t = e[6], e[6] = e[9], e[9] = t, t = e[3], e[3] = e[12], e[12] = t, t = e[7], e[7] = e[13], e[13] = t, t = e[11], e[11] = e[14], e[14] = t, this;
|
|
1530
|
+
}
|
|
1531
|
+
setPosition(e, t, n) {
|
|
1532
|
+
let r = this.elements;
|
|
1533
|
+
return e.isVector3 ? (r[12] = e.x, r[13] = e.y, r[14] = e.z) : (r[12] = e, r[13] = t, r[14] = n), this;
|
|
1534
|
+
}
|
|
1535
|
+
invert() {
|
|
1536
|
+
let e = this.elements, t = e[0], n = e[1], r = e[2], i = e[3], a = e[4], o = e[5], s = e[6], c = e[7], l = e[8], u = e[9], d = e[10], f = e[11], p = e[12], m = e[13], h = e[14], g = e[15], _ = t * o - n * a, v = t * s - r * a, y = t * c - i * a, b = n * s - r * o, x = n * c - i * o, S = r * c - i * s, C = l * m - u * p, w = l * h - d * p, T = l * g - f * p, E = u * h - d * m, D = u * g - f * m, O = d * g - f * h, k = _ * O - v * D + y * E + b * T - x * w + S * C;
|
|
1537
|
+
if (k === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1538
|
+
let A = 1 / k;
|
|
1539
|
+
return e[0] = (o * O - s * D + c * E) * A, e[1] = (r * D - n * O - i * E) * A, e[2] = (m * S - h * x + g * b) * A, e[3] = (d * x - u * S - f * b) * A, e[4] = (s * T - a * O - c * w) * A, e[5] = (t * O - r * T + i * w) * A, e[6] = (h * y - p * S - g * v) * A, e[7] = (l * S - d * y + f * v) * A, e[8] = (a * D - o * T + c * C) * A, e[9] = (n * T - t * D - i * C) * A, e[10] = (p * x - m * y + g * _) * A, e[11] = (u * y - l * x - f * _) * A, e[12] = (o * w - a * E - s * C) * A, e[13] = (t * E - n * w + r * C) * A, e[14] = (m * v - p * b - h * _) * A, e[15] = (l * b - u * v + d * _) * A, this;
|
|
1540
|
+
}
|
|
1541
|
+
scale(e) {
|
|
1542
|
+
let t = this.elements, n = e.x, r = e.y, i = e.z;
|
|
1543
|
+
return t[0] *= n, t[4] *= r, t[8] *= i, t[1] *= n, t[5] *= r, t[9] *= i, t[2] *= n, t[6] *= r, t[10] *= i, t[3] *= n, t[7] *= r, t[11] *= i, this;
|
|
1544
|
+
}
|
|
1545
|
+
getMaxScaleOnAxis() {
|
|
1546
|
+
let e = this.elements, t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2], n = e[4] * e[4] + e[5] * e[5] + e[6] * e[6], r = e[8] * e[8] + e[9] * e[9] + e[10] * e[10];
|
|
1547
|
+
return Math.sqrt(Math.max(t, n, r));
|
|
1548
|
+
}
|
|
1549
|
+
makeTranslation(e, t, n) {
|
|
1550
|
+
return e.isVector3 ? this.set(1, 0, 0, e.x, 0, 1, 0, e.y, 0, 0, 1, e.z, 0, 0, 0, 1) : this.set(1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, n, 0, 0, 0, 1), this;
|
|
1551
|
+
}
|
|
1552
|
+
makeRotationX(e) {
|
|
1553
|
+
let t = Math.cos(e), n = Math.sin(e);
|
|
1554
|
+
return this.set(1, 0, 0, 0, 0, t, -n, 0, 0, n, t, 0, 0, 0, 0, 1), this;
|
|
1555
|
+
}
|
|
1556
|
+
makeRotationY(e) {
|
|
1557
|
+
let t = Math.cos(e), n = Math.sin(e);
|
|
1558
|
+
return this.set(t, 0, n, 0, 0, 1, 0, 0, -n, 0, t, 0, 0, 0, 0, 1), this;
|
|
1559
|
+
}
|
|
1560
|
+
makeRotationZ(e) {
|
|
1561
|
+
let t = Math.cos(e), n = Math.sin(e);
|
|
1562
|
+
return this.set(t, -n, 0, 0, n, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
|
|
1563
|
+
}
|
|
1564
|
+
makeRotationAxis(e, t) {
|
|
1565
|
+
let n = Math.cos(t), r = Math.sin(t), i = 1 - n, a = e.x, o = e.y, s = e.z, c = i * a, l = i * o;
|
|
1566
|
+
return this.set(c * a + n, c * o - r * s, c * s + r * o, 0, c * o + r * s, l * o + n, l * s - r * a, 0, c * s - r * o, l * s + r * a, i * s * s + n, 0, 0, 0, 0, 1), this;
|
|
1567
|
+
}
|
|
1568
|
+
makeScale(e, t, n) {
|
|
1569
|
+
return this.set(e, 0, 0, 0, 0, t, 0, 0, 0, 0, n, 0, 0, 0, 0, 1), this;
|
|
1570
|
+
}
|
|
1571
|
+
makeShear(e, t, n, r, i, a) {
|
|
1572
|
+
return this.set(1, n, i, 0, e, 1, a, 0, t, r, 1, 0, 0, 0, 0, 1), this;
|
|
1573
|
+
}
|
|
1574
|
+
compose(e, t, n) {
|
|
1575
|
+
let r = this.elements, i = t._x, a = t._y, o = t._z, s = t._w, c = i + i, l = a + a, u = o + o, d = i * c, f = i * l, p = i * u, m = a * l, h = a * u, g = o * u, _ = s * c, v = s * l, y = s * u, b = n.x, x = n.y, S = n.z;
|
|
1576
|
+
return r[0] = (1 - (m + g)) * b, r[1] = (f + y) * b, r[2] = (p - v) * b, r[3] = 0, r[4] = (f - y) * x, r[5] = (1 - (d + g)) * x, r[6] = (h + _) * x, r[7] = 0, r[8] = (p + v) * S, r[9] = (h - _) * S, r[10] = (1 - (d + m)) * S, r[11] = 0, r[12] = e.x, r[13] = e.y, r[14] = e.z, r[15] = 1, this;
|
|
1577
|
+
}
|
|
1578
|
+
decompose(e, t, n) {
|
|
1579
|
+
let r = this.elements;
|
|
1580
|
+
e.x = r[12], e.y = r[13], e.z = r[14];
|
|
1581
|
+
let i = this.determinant();
|
|
1582
|
+
if (i === 0) return n.set(1, 1, 1), t.identity(), this;
|
|
1583
|
+
let a = xe.set(r[0], r[1], r[2]).length(), o = xe.set(r[4], r[5], r[6]).length(), s = xe.set(r[8], r[9], r[10]).length();
|
|
1584
|
+
i < 0 && (a = -a), G.copy(this);
|
|
1585
|
+
let c = 1 / a, l = 1 / o, u = 1 / s;
|
|
1586
|
+
return G.elements[0] *= c, G.elements[1] *= c, G.elements[2] *= c, G.elements[4] *= l, G.elements[5] *= l, G.elements[6] *= l, G.elements[8] *= u, G.elements[9] *= u, G.elements[10] *= u, t.setFromRotationMatrix(G), n.x = a, n.y = o, n.z = s, this;
|
|
1587
|
+
}
|
|
1588
|
+
makePerspective(e, t, n, r, i, a, o = k, s = !1) {
|
|
1589
|
+
let c = this.elements, l = 2 * i / (t - e), u = 2 * i / (n - r), d = (t + e) / (t - e), f = (n + r) / (n - r), p, m;
|
|
1590
|
+
if (s) p = i / (a - i), m = a * i / (a - i);
|
|
1591
|
+
else if (o === 2e3) p = -(a + i) / (a - i), m = -2 * a * i / (a - i);
|
|
1592
|
+
else if (o === 2001) p = -a / (a - i), m = -a * i / (a - i);
|
|
1593
|
+
else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: " + o);
|
|
1594
|
+
return c[0] = l, c[4] = 0, c[8] = d, c[12] = 0, c[1] = 0, c[5] = u, c[9] = f, c[13] = 0, c[2] = 0, c[6] = 0, c[10] = p, c[14] = m, c[3] = 0, c[7] = 0, c[11] = -1, c[15] = 0, this;
|
|
1595
|
+
}
|
|
1596
|
+
makeOrthographic(e, t, n, r, i, a, o = k, s = !1) {
|
|
1597
|
+
let c = this.elements, l = 2 / (t - e), u = 2 / (n - r), d = -(t + e) / (t - e), f = -(n + r) / (n - r), p, m;
|
|
1598
|
+
if (s) p = 1 / (a - i), m = a / (a - i);
|
|
1599
|
+
else if (o === 2e3) p = -2 / (a - i), m = -(a + i) / (a - i);
|
|
1600
|
+
else if (o === 2001) p = -1 / (a - i), m = -i / (a - i);
|
|
1601
|
+
else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: " + o);
|
|
1602
|
+
return c[0] = l, c[4] = 0, c[8] = 0, c[12] = d, c[1] = 0, c[5] = u, c[9] = 0, c[13] = f, c[2] = 0, c[6] = 0, c[10] = p, c[14] = m, c[3] = 0, c[7] = 0, c[11] = 0, c[15] = 1, this;
|
|
1603
|
+
}
|
|
1604
|
+
equals(e) {
|
|
1605
|
+
let t = this.elements, n = e.elements;
|
|
1606
|
+
for (let e = 0; e < 16; e++) if (t[e] !== n[e]) return !1;
|
|
1607
|
+
return !0;
|
|
1608
|
+
}
|
|
1609
|
+
fromArray(e, t = 0) {
|
|
1610
|
+
for (let n = 0; n < 16; n++) this.elements[n] = e[n + t];
|
|
1611
|
+
return this;
|
|
1612
|
+
}
|
|
1613
|
+
toArray(e = [], t = 0) {
|
|
1614
|
+
let n = this.elements;
|
|
1615
|
+
return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e[t + 9] = n[9], e[t + 10] = n[10], e[t + 11] = n[11], e[t + 12] = n[12], e[t + 13] = n[13], e[t + 14] = n[14], e[t + 15] = n[15], e;
|
|
1616
|
+
}
|
|
1617
|
+
}, xe = /* @__PURE__ */ new B(), G = /* @__PURE__ */ new be(), Se = /* @__PURE__ */ new B(0, 0, 0), Ce = /* @__PURE__ */ new B(1, 1, 1), K = /* @__PURE__ */ new B(), we = /* @__PURE__ */ new B(), q = /* @__PURE__ */ new B(), Te = /* @__PURE__ */ new be(), Ee = /* @__PURE__ */ new z(), De = class e {
|
|
1618
|
+
constructor(t = 0, n = 0, r = 0, i = e.DEFAULT_ORDER) {
|
|
1619
|
+
this.isEuler = !0, this._x = t, this._y = n, this._z = r, this._order = i;
|
|
1620
|
+
}
|
|
1621
|
+
get x() {
|
|
1622
|
+
return this._x;
|
|
1623
|
+
}
|
|
1624
|
+
set x(e) {
|
|
1625
|
+
this._x = e, this._onChangeCallback();
|
|
1626
|
+
}
|
|
1627
|
+
get y() {
|
|
1628
|
+
return this._y;
|
|
1629
|
+
}
|
|
1630
|
+
set y(e) {
|
|
1631
|
+
this._y = e, this._onChangeCallback();
|
|
1632
|
+
}
|
|
1633
|
+
get z() {
|
|
1634
|
+
return this._z;
|
|
1635
|
+
}
|
|
1636
|
+
set z(e) {
|
|
1637
|
+
this._z = e, this._onChangeCallback();
|
|
1638
|
+
}
|
|
1639
|
+
get order() {
|
|
1640
|
+
return this._order;
|
|
1641
|
+
}
|
|
1642
|
+
set order(e) {
|
|
1643
|
+
this._order = e, this._onChangeCallback();
|
|
1644
|
+
}
|
|
1645
|
+
set(e, t, n, r = this._order) {
|
|
1646
|
+
return this._x = e, this._y = t, this._z = n, this._order = r, this._onChangeCallback(), this;
|
|
1647
|
+
}
|
|
1648
|
+
clone() {
|
|
1649
|
+
return new this.constructor(this._x, this._y, this._z, this._order);
|
|
1650
|
+
}
|
|
1651
|
+
copy(e) {
|
|
1652
|
+
return this._x = e._x, this._y = e._y, this._z = e._z, this._order = e._order, this._onChangeCallback(), this;
|
|
1653
|
+
}
|
|
1654
|
+
setFromRotationMatrix(e, t = this._order, n = !0) {
|
|
1655
|
+
let r = e.elements, i = r[0], a = r[4], o = r[8], s = r[1], c = r[5], l = r[9], u = r[2], d = r[6], f = r[10];
|
|
1656
|
+
switch (t) {
|
|
1657
|
+
case "XYZ":
|
|
1658
|
+
this._y = Math.asin(R(o, -1, 1)), Math.abs(o) < .9999999 ? (this._x = Math.atan2(-l, f), this._z = Math.atan2(-a, i)) : (this._x = Math.atan2(d, c), this._z = 0);
|
|
1659
|
+
break;
|
|
1660
|
+
case "YXZ":
|
|
1661
|
+
this._x = Math.asin(-R(l, -1, 1)), Math.abs(l) < .9999999 ? (this._y = Math.atan2(o, f), this._z = Math.atan2(s, c)) : (this._y = Math.atan2(-u, i), this._z = 0);
|
|
1662
|
+
break;
|
|
1663
|
+
case "ZXY":
|
|
1664
|
+
this._x = Math.asin(R(d, -1, 1)), Math.abs(d) < .9999999 ? (this._y = Math.atan2(-u, f), this._z = Math.atan2(-a, c)) : (this._y = 0, this._z = Math.atan2(s, i));
|
|
1665
|
+
break;
|
|
1666
|
+
case "ZYX":
|
|
1667
|
+
this._y = Math.asin(-R(u, -1, 1)), Math.abs(u) < .9999999 ? (this._x = Math.atan2(d, f), this._z = Math.atan2(s, i)) : (this._x = 0, this._z = Math.atan2(-a, c));
|
|
1668
|
+
break;
|
|
1669
|
+
case "YZX":
|
|
1670
|
+
this._z = Math.asin(R(s, -1, 1)), Math.abs(s) < .9999999 ? (this._x = Math.atan2(-l, c), this._y = Math.atan2(-u, i)) : (this._x = 0, this._y = Math.atan2(o, f));
|
|
1671
|
+
break;
|
|
1672
|
+
case "XZY":
|
|
1673
|
+
this._z = Math.asin(-R(a, -1, 1)), Math.abs(a) < .9999999 ? (this._x = Math.atan2(d, c), this._y = Math.atan2(o, i)) : (this._x = Math.atan2(-l, f), this._y = 0);
|
|
1674
|
+
break;
|
|
1675
|
+
default: F("Euler: .setFromRotationMatrix() encountered an unknown order: " + t);
|
|
1676
|
+
}
|
|
1677
|
+
return this._order = t, n === !0 && this._onChangeCallback(), this;
|
|
1678
|
+
}
|
|
1679
|
+
setFromQuaternion(e, t, n) {
|
|
1680
|
+
return Te.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Te, t, n);
|
|
1681
|
+
}
|
|
1682
|
+
setFromVector3(e, t = this._order) {
|
|
1683
|
+
return this.set(e.x, e.y, e.z, t);
|
|
1684
|
+
}
|
|
1685
|
+
reorder(e) {
|
|
1686
|
+
return Ee.setFromEuler(this), this.setFromQuaternion(Ee, e);
|
|
1687
|
+
}
|
|
1688
|
+
equals(e) {
|
|
1689
|
+
return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order;
|
|
1690
|
+
}
|
|
1691
|
+
fromArray(e) {
|
|
1692
|
+
return this._x = e[0], this._y = e[1], this._z = e[2], e[3] !== void 0 && (this._order = e[3]), this._onChangeCallback(), this;
|
|
1693
|
+
}
|
|
1694
|
+
toArray(e = [], t = 0) {
|
|
1695
|
+
return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._order, e;
|
|
1696
|
+
}
|
|
1697
|
+
_onChange(e) {
|
|
1698
|
+
return this._onChangeCallback = e, this;
|
|
1699
|
+
}
|
|
1700
|
+
_onChangeCallback() {}
|
|
1701
|
+
*[Symbol.iterator]() {
|
|
1702
|
+
yield this._x, yield this._y, yield this._z, yield this._order;
|
|
1703
|
+
}
|
|
1704
|
+
};
|
|
1705
|
+
De.DEFAULT_ORDER = "XYZ";
|
|
1706
|
+
var Oe = class {
|
|
1707
|
+
constructor() {
|
|
1708
|
+
this.mask = 1;
|
|
1709
|
+
}
|
|
1710
|
+
set(e) {
|
|
1711
|
+
this.mask = (1 << e | 0) >>> 0;
|
|
1712
|
+
}
|
|
1713
|
+
enable(e) {
|
|
1714
|
+
this.mask |= 1 << e | 0;
|
|
1715
|
+
}
|
|
1716
|
+
enableAll() {
|
|
1717
|
+
this.mask = -1;
|
|
1718
|
+
}
|
|
1719
|
+
toggle(e) {
|
|
1720
|
+
this.mask ^= 1 << e | 0;
|
|
1721
|
+
}
|
|
1722
|
+
disable(e) {
|
|
1723
|
+
this.mask &= ~(1 << e | 0);
|
|
1724
|
+
}
|
|
1725
|
+
disableAll() {
|
|
1726
|
+
this.mask = 0;
|
|
1727
|
+
}
|
|
1728
|
+
test(e) {
|
|
1729
|
+
return (this.mask & e.mask) !== 0;
|
|
1730
|
+
}
|
|
1731
|
+
isEnabled(e) {
|
|
1732
|
+
return (this.mask & (1 << e | 0)) != 0;
|
|
1733
|
+
}
|
|
1734
|
+
}, ke = 0, Ae = /* @__PURE__ */ new B(), je = /* @__PURE__ */ new z(), J = /* @__PURE__ */ new be(), Me = /* @__PURE__ */ new B(), Ne = /* @__PURE__ */ new B(), Pe = /* @__PURE__ */ new B(), Fe = /* @__PURE__ */ new z(), Ie = /* @__PURE__ */ new B(1, 0, 0), Le = /* @__PURE__ */ new B(0, 1, 0), Re = /* @__PURE__ */ new B(0, 0, 1), ze = { type: "added" }, Be = { type: "removed" }, Ve = {
|
|
1735
|
+
type: "childadded",
|
|
1736
|
+
child: null
|
|
1737
|
+
}, He = {
|
|
1738
|
+
type: "childremoved",
|
|
1739
|
+
child: null
|
|
1740
|
+
}, Ue = class e extends te {
|
|
1741
|
+
constructor() {
|
|
1742
|
+
super(), this.isObject3D = !0, Object.defineProperty(this, "id", { value: ke++ }), this.uuid = ne(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = e.DEFAULT_UP.clone();
|
|
1743
|
+
let t = new B(), n = new De(), r = new z(), i = new B(1, 1, 1);
|
|
1744
|
+
function a() {
|
|
1745
|
+
r.setFromEuler(n, !1);
|
|
1746
|
+
}
|
|
1747
|
+
function o() {
|
|
1748
|
+
n.setFromQuaternion(r, void 0, !1);
|
|
1749
|
+
}
|
|
1750
|
+
n._onChange(a), r._onChange(o), Object.defineProperties(this, {
|
|
1751
|
+
position: {
|
|
1752
|
+
configurable: !0,
|
|
1753
|
+
enumerable: !0,
|
|
1754
|
+
value: t
|
|
1755
|
+
},
|
|
1756
|
+
rotation: {
|
|
1757
|
+
configurable: !0,
|
|
1758
|
+
enumerable: !0,
|
|
1759
|
+
value: n
|
|
1760
|
+
},
|
|
1761
|
+
quaternion: {
|
|
1762
|
+
configurable: !0,
|
|
1763
|
+
enumerable: !0,
|
|
1764
|
+
value: r
|
|
1765
|
+
},
|
|
1766
|
+
scale: {
|
|
1767
|
+
configurable: !0,
|
|
1768
|
+
enumerable: !0,
|
|
1769
|
+
value: i
|
|
1770
|
+
},
|
|
1771
|
+
modelViewMatrix: { value: new be() },
|
|
1772
|
+
normalMatrix: { value: new ce() }
|
|
1773
|
+
}), this.matrix = new be(), this.matrixWorld = new be(), this.matrixAutoUpdate = e.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldAutoUpdate = e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.layers = new Oe(), this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.customDepthMaterial = void 0, this.customDistanceMaterial = void 0, this.static = !1, this.userData = {}, this.pivot = null;
|
|
1774
|
+
}
|
|
1775
|
+
onBeforeShadow() {}
|
|
1776
|
+
onAfterShadow() {}
|
|
1777
|
+
onBeforeRender() {}
|
|
1778
|
+
onAfterRender() {}
|
|
1779
|
+
applyMatrix4(e) {
|
|
1780
|
+
this.matrixAutoUpdate && this.updateMatrix(), this.matrix.premultiply(e), this.matrix.decompose(this.position, this.quaternion, this.scale);
|
|
1781
|
+
}
|
|
1782
|
+
applyQuaternion(e) {
|
|
1783
|
+
return this.quaternion.premultiply(e), this;
|
|
1784
|
+
}
|
|
1785
|
+
setRotationFromAxisAngle(e, t) {
|
|
1786
|
+
this.quaternion.setFromAxisAngle(e, t);
|
|
1787
|
+
}
|
|
1788
|
+
setRotationFromEuler(e) {
|
|
1789
|
+
this.quaternion.setFromEuler(e, !0);
|
|
1790
|
+
}
|
|
1791
|
+
setRotationFromMatrix(e) {
|
|
1792
|
+
this.quaternion.setFromRotationMatrix(e);
|
|
1793
|
+
}
|
|
1794
|
+
setRotationFromQuaternion(e) {
|
|
1795
|
+
this.quaternion.copy(e);
|
|
1796
|
+
}
|
|
1797
|
+
rotateOnAxis(e, t) {
|
|
1798
|
+
return je.setFromAxisAngle(e, t), this.quaternion.multiply(je), this;
|
|
1799
|
+
}
|
|
1800
|
+
rotateOnWorldAxis(e, t) {
|
|
1801
|
+
return je.setFromAxisAngle(e, t), this.quaternion.premultiply(je), this;
|
|
1802
|
+
}
|
|
1803
|
+
rotateX(e) {
|
|
1804
|
+
return this.rotateOnAxis(Ie, e);
|
|
1805
|
+
}
|
|
1806
|
+
rotateY(e) {
|
|
1807
|
+
return this.rotateOnAxis(Le, e);
|
|
1808
|
+
}
|
|
1809
|
+
rotateZ(e) {
|
|
1810
|
+
return this.rotateOnAxis(Re, e);
|
|
1811
|
+
}
|
|
1812
|
+
translateOnAxis(e, t) {
|
|
1813
|
+
return Ae.copy(e).applyQuaternion(this.quaternion), this.position.add(Ae.multiplyScalar(t)), this;
|
|
1814
|
+
}
|
|
1815
|
+
translateX(e) {
|
|
1816
|
+
return this.translateOnAxis(Ie, e);
|
|
1817
|
+
}
|
|
1818
|
+
translateY(e) {
|
|
1819
|
+
return this.translateOnAxis(Le, e);
|
|
1820
|
+
}
|
|
1821
|
+
translateZ(e) {
|
|
1822
|
+
return this.translateOnAxis(Re, e);
|
|
1823
|
+
}
|
|
1824
|
+
localToWorld(e) {
|
|
1825
|
+
return this.updateWorldMatrix(!0, !1), e.applyMatrix4(this.matrixWorld);
|
|
1826
|
+
}
|
|
1827
|
+
worldToLocal(e) {
|
|
1828
|
+
return this.updateWorldMatrix(!0, !1), e.applyMatrix4(J.copy(this.matrixWorld).invert());
|
|
1829
|
+
}
|
|
1830
|
+
lookAt(e, t, n) {
|
|
1831
|
+
e.isVector3 ? Me.copy(e) : Me.set(e, t, n);
|
|
1832
|
+
let r = this.parent;
|
|
1833
|
+
this.updateWorldMatrix(!0, !1), Ne.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? J.lookAt(Ne, Me, this.up) : J.lookAt(Me, Ne, this.up), this.quaternion.setFromRotationMatrix(J), r && (J.extractRotation(r.matrixWorld), je.setFromRotationMatrix(J), this.quaternion.premultiply(je.invert()));
|
|
1834
|
+
}
|
|
1835
|
+
add(e) {
|
|
1836
|
+
if (arguments.length > 1) {
|
|
1837
|
+
for (let e = 0; e < arguments.length; e++) this.add(arguments[e]);
|
|
1838
|
+
return this;
|
|
1839
|
+
}
|
|
1840
|
+
return e === this ? (I("Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (e.removeFromParent(), e.parent = this, this.children.push(e), e.dispatchEvent(ze), Ve.child = e, this.dispatchEvent(Ve), Ve.child = null) : I("Object3D.add: object not an instance of THREE.Object3D.", e), this);
|
|
1841
|
+
}
|
|
1842
|
+
remove(e) {
|
|
1843
|
+
if (arguments.length > 1) {
|
|
1844
|
+
for (let e = 0; e < arguments.length; e++) this.remove(arguments[e]);
|
|
1845
|
+
return this;
|
|
1846
|
+
}
|
|
1847
|
+
let t = this.children.indexOf(e);
|
|
1848
|
+
return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(Be), He.child = e, this.dispatchEvent(He), He.child = null), this;
|
|
1849
|
+
}
|
|
1850
|
+
removeFromParent() {
|
|
1851
|
+
let e = this.parent;
|
|
1852
|
+
return e !== null && e.remove(this), this;
|
|
1853
|
+
}
|
|
1854
|
+
clear() {
|
|
1855
|
+
return this.remove(...this.children);
|
|
1856
|
+
}
|
|
1857
|
+
attach(e) {
|
|
1858
|
+
return this.updateWorldMatrix(!0, !1), J.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), J.multiply(e.parent.matrixWorld)), e.applyMatrix4(J), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent(ze), Ve.child = e, this.dispatchEvent(Ve), Ve.child = null, this;
|
|
1859
|
+
}
|
|
1860
|
+
getObjectById(e) {
|
|
1861
|
+
return this.getObjectByProperty("id", e);
|
|
1862
|
+
}
|
|
1863
|
+
getObjectByName(e) {
|
|
1864
|
+
return this.getObjectByProperty("name", e);
|
|
1865
|
+
}
|
|
1866
|
+
getObjectByProperty(e, t) {
|
|
1867
|
+
if (this[e] === t) return this;
|
|
1868
|
+
for (let n = 0, r = this.children.length; n < r; n++) {
|
|
1869
|
+
let r = this.children[n].getObjectByProperty(e, t);
|
|
1870
|
+
if (r !== void 0) return r;
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
getObjectsByProperty(e, t, n = []) {
|
|
1874
|
+
this[e] === t && n.push(this);
|
|
1875
|
+
let r = this.children;
|
|
1876
|
+
for (let i = 0, a = r.length; i < a; i++) r[i].getObjectsByProperty(e, t, n);
|
|
1877
|
+
return n;
|
|
1878
|
+
}
|
|
1879
|
+
getWorldPosition(e) {
|
|
1880
|
+
return this.updateWorldMatrix(!0, !1), e.setFromMatrixPosition(this.matrixWorld);
|
|
1881
|
+
}
|
|
1882
|
+
getWorldQuaternion(e) {
|
|
1883
|
+
return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(Ne, e, Pe), e;
|
|
1884
|
+
}
|
|
1885
|
+
getWorldScale(e) {
|
|
1886
|
+
return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(Ne, Fe, e), e;
|
|
1887
|
+
}
|
|
1888
|
+
getWorldDirection(e) {
|
|
1889
|
+
this.updateWorldMatrix(!0, !1);
|
|
1890
|
+
let t = this.matrixWorld.elements;
|
|
1891
|
+
return e.set(t[8], t[9], t[10]).normalize();
|
|
1892
|
+
}
|
|
1893
|
+
raycast() {}
|
|
1894
|
+
traverse(e) {
|
|
1895
|
+
e(this);
|
|
1896
|
+
let t = this.children;
|
|
1897
|
+
for (let n = 0, r = t.length; n < r; n++) t[n].traverse(e);
|
|
1898
|
+
}
|
|
1899
|
+
traverseVisible(e) {
|
|
1900
|
+
if (this.visible === !1) return;
|
|
1901
|
+
e(this);
|
|
1902
|
+
let t = this.children;
|
|
1903
|
+
for (let n = 0, r = t.length; n < r; n++) t[n].traverseVisible(e);
|
|
1904
|
+
}
|
|
1905
|
+
traverseAncestors(e) {
|
|
1906
|
+
let t = this.parent;
|
|
1907
|
+
t !== null && (e(t), t.traverseAncestors(e));
|
|
1908
|
+
}
|
|
1909
|
+
updateMatrix() {
|
|
1910
|
+
this.matrix.compose(this.position, this.quaternion, this.scale);
|
|
1911
|
+
let e = this.pivot;
|
|
1912
|
+
if (e !== null) {
|
|
1913
|
+
let t = e.x, n = e.y, r = e.z, i = this.matrix.elements;
|
|
1914
|
+
i[12] += t - i[0] * t - i[4] * n - i[8] * r, i[13] += n - i[1] * t - i[5] * n - i[9] * r, i[14] += r - i[2] * t - i[6] * n - i[10] * r;
|
|
1915
|
+
}
|
|
1916
|
+
this.matrixWorldNeedsUpdate = !0;
|
|
1917
|
+
}
|
|
1918
|
+
updateMatrixWorld(e) {
|
|
1919
|
+
this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || e) && (this.matrixWorldAutoUpdate === !0 && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), this.matrixWorldNeedsUpdate = !1, e = !0);
|
|
1920
|
+
let t = this.children;
|
|
1921
|
+
for (let n = 0, r = t.length; n < r; n++) t[n].updateMatrixWorld(e);
|
|
1922
|
+
}
|
|
1923
|
+
updateWorldMatrix(e, t) {
|
|
1924
|
+
let n = this.parent;
|
|
1925
|
+
if (e === !0 && n !== null && n.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), this.matrixWorldAutoUpdate === !0 && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), t === !0) {
|
|
1926
|
+
let e = this.children;
|
|
1927
|
+
for (let t = 0, n = e.length; t < n; t++) e[t].updateWorldMatrix(!1, !0);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
toJSON(e) {
|
|
1931
|
+
let t = e === void 0 || typeof e == "string", n = {};
|
|
1932
|
+
t && (e = {
|
|
1933
|
+
geometries: {},
|
|
1934
|
+
materials: {},
|
|
1935
|
+
textures: {},
|
|
1936
|
+
images: {},
|
|
1937
|
+
shapes: {},
|
|
1938
|
+
skeletons: {},
|
|
1939
|
+
animations: {},
|
|
1940
|
+
nodes: {}
|
|
1941
|
+
}, n.metadata = {
|
|
1942
|
+
version: 4.7,
|
|
1943
|
+
type: "Object",
|
|
1944
|
+
generator: "Object3D.toJSON"
|
|
1945
|
+
});
|
|
1946
|
+
let r = {};
|
|
1947
|
+
r.uuid = this.uuid, r.type = this.type, this.name !== "" && (r.name = this.name), this.castShadow === !0 && (r.castShadow = !0), this.receiveShadow === !0 && (r.receiveShadow = !0), this.visible === !1 && (r.visible = !1), this.frustumCulled === !1 && (r.frustumCulled = !1), this.renderOrder !== 0 && (r.renderOrder = this.renderOrder), this.static !== !1 && (r.static = this.static), Object.keys(this.userData).length > 0 && (r.userData = this.userData), r.layers = this.layers.mask, r.matrix = this.matrix.toArray(), r.up = this.up.toArray(), this.pivot !== null && (r.pivot = this.pivot.toArray()), this.matrixAutoUpdate === !1 && (r.matrixAutoUpdate = !1), this.morphTargetDictionary !== void 0 && (r.morphTargetDictionary = Object.assign({}, this.morphTargetDictionary)), this.morphTargetInfluences !== void 0 && (r.morphTargetInfluences = this.morphTargetInfluences.slice()), this.isInstancedMesh && (r.type = "InstancedMesh", r.count = this.count, r.instanceMatrix = this.instanceMatrix.toJSON(), this.instanceColor !== null && (r.instanceColor = this.instanceColor.toJSON())), this.isBatchedMesh && (r.type = "BatchedMesh", r.perObjectFrustumCulled = this.perObjectFrustumCulled, r.sortObjects = this.sortObjects, r.drawRanges = this._drawRanges, r.reservedRanges = this._reservedRanges, r.geometryInfo = this._geometryInfo.map((e) => ({
|
|
1948
|
+
...e,
|
|
1949
|
+
boundingBox: e.boundingBox ? e.boundingBox.toJSON() : void 0,
|
|
1950
|
+
boundingSphere: e.boundingSphere ? e.boundingSphere.toJSON() : void 0
|
|
1951
|
+
})), r.instanceInfo = this._instanceInfo.map((e) => ({ ...e })), r.availableInstanceIds = this._availableInstanceIds.slice(), r.availableGeometryIds = this._availableGeometryIds.slice(), r.nextIndexStart = this._nextIndexStart, r.nextVertexStart = this._nextVertexStart, r.geometryCount = this._geometryCount, r.maxInstanceCount = this._maxInstanceCount, r.maxVertexCount = this._maxVertexCount, r.maxIndexCount = this._maxIndexCount, r.geometryInitialized = this._geometryInitialized, r.matricesTexture = this._matricesTexture.toJSON(e), r.indirectTexture = this._indirectTexture.toJSON(e), this._colorsTexture !== null && (r.colorsTexture = this._colorsTexture.toJSON(e)), this.boundingSphere !== null && (r.boundingSphere = this.boundingSphere.toJSON()), this.boundingBox !== null && (r.boundingBox = this.boundingBox.toJSON()));
|
|
1952
|
+
function i(t, n) {
|
|
1953
|
+
return t[n.uuid] === void 0 && (t[n.uuid] = n.toJSON(e)), n.uuid;
|
|
1954
|
+
}
|
|
1955
|
+
if (this.isScene) this.background && (this.background.isColor ? r.background = this.background.toJSON() : this.background.isTexture && (r.background = this.background.toJSON(e).uuid)), this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== !0 && (r.environment = this.environment.toJSON(e).uuid);
|
|
1956
|
+
else if (this.isMesh || this.isLine || this.isPoints) {
|
|
1957
|
+
r.geometry = i(e.geometries, this.geometry);
|
|
1958
|
+
let t = this.geometry.parameters;
|
|
1959
|
+
if (t !== void 0 && t.shapes !== void 0) {
|
|
1960
|
+
let n = t.shapes;
|
|
1961
|
+
if (Array.isArray(n)) for (let t = 0, r = n.length; t < r; t++) {
|
|
1962
|
+
let r = n[t];
|
|
1963
|
+
i(e.shapes, r);
|
|
1964
|
+
}
|
|
1965
|
+
else i(e.shapes, n);
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
if (this.isSkinnedMesh && (r.bindMode = this.bindMode, r.bindMatrix = this.bindMatrix.toArray(), this.skeleton !== void 0 && (i(e.skeletons, this.skeleton), r.skeleton = this.skeleton.uuid)), this.material !== void 0) if (Array.isArray(this.material)) {
|
|
1969
|
+
let t = [];
|
|
1970
|
+
for (let n = 0, r = this.material.length; n < r; n++) t.push(i(e.materials, this.material[n]));
|
|
1971
|
+
r.material = t;
|
|
1972
|
+
} else r.material = i(e.materials, this.material);
|
|
1973
|
+
if (this.children.length > 0) {
|
|
1974
|
+
r.children = [];
|
|
1975
|
+
for (let t = 0; t < this.children.length; t++) r.children.push(this.children[t].toJSON(e).object);
|
|
1976
|
+
}
|
|
1977
|
+
if (this.animations.length > 0) {
|
|
1978
|
+
r.animations = [];
|
|
1979
|
+
for (let t = 0; t < this.animations.length; t++) {
|
|
1980
|
+
let n = this.animations[t];
|
|
1981
|
+
r.animations.push(i(e.animations, n));
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
if (t) {
|
|
1985
|
+
let t = a(e.geometries), r = a(e.materials), i = a(e.textures), o = a(e.images), s = a(e.shapes), c = a(e.skeletons), l = a(e.animations), u = a(e.nodes);
|
|
1986
|
+
t.length > 0 && (n.geometries = t), r.length > 0 && (n.materials = r), i.length > 0 && (n.textures = i), o.length > 0 && (n.images = o), s.length > 0 && (n.shapes = s), c.length > 0 && (n.skeletons = c), l.length > 0 && (n.animations = l), u.length > 0 && (n.nodes = u);
|
|
1987
|
+
}
|
|
1988
|
+
return n.object = r, n;
|
|
1989
|
+
function a(e) {
|
|
1990
|
+
let t = [];
|
|
1991
|
+
for (let n in e) {
|
|
1992
|
+
let r = e[n];
|
|
1993
|
+
delete r.metadata, t.push(r);
|
|
1994
|
+
}
|
|
1995
|
+
return t;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
clone(e) {
|
|
1999
|
+
return new this.constructor().copy(this, e);
|
|
2000
|
+
}
|
|
2001
|
+
copy(e, t = !0) {
|
|
2002
|
+
if (this.name = e.name, this.up.copy(e.up), this.position.copy(e.position), this.rotation.order = e.rotation.order, this.quaternion.copy(e.quaternion), this.scale.copy(e.scale), this.pivot = e.pivot === null ? null : e.pivot.clone(), this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldAutoUpdate = e.matrixWorldAutoUpdate, this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate, this.layers.mask = e.layers.mask, this.visible = e.visible, this.castShadow = e.castShadow, this.receiveShadow = e.receiveShadow, this.frustumCulled = e.frustumCulled, this.renderOrder = e.renderOrder, this.static = e.static, this.animations = e.animations.slice(), this.userData = JSON.parse(JSON.stringify(e.userData)), t === !0) for (let t = 0; t < e.children.length; t++) {
|
|
2003
|
+
let n = e.children[t];
|
|
2004
|
+
this.add(n.clone());
|
|
2005
|
+
}
|
|
2006
|
+
return this;
|
|
2007
|
+
}
|
|
2008
|
+
};
|
|
2009
|
+
Ue.DEFAULT_UP = /* @__PURE__ */ new B(0, 1, 0), Ue.DEFAULT_MATRIX_AUTO_UPDATE = !0, Ue.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0;
|
|
2010
|
+
var We = {
|
|
2011
|
+
aliceblue: 15792383,
|
|
2012
|
+
antiquewhite: 16444375,
|
|
2013
|
+
aqua: 65535,
|
|
2014
|
+
aquamarine: 8388564,
|
|
2015
|
+
azure: 15794175,
|
|
2016
|
+
beige: 16119260,
|
|
2017
|
+
bisque: 16770244,
|
|
2018
|
+
black: 0,
|
|
2019
|
+
blanchedalmond: 16772045,
|
|
2020
|
+
blue: 255,
|
|
2021
|
+
blueviolet: 9055202,
|
|
2022
|
+
brown: 10824234,
|
|
2023
|
+
burlywood: 14596231,
|
|
2024
|
+
cadetblue: 6266528,
|
|
2025
|
+
chartreuse: 8388352,
|
|
2026
|
+
chocolate: 13789470,
|
|
2027
|
+
coral: 16744272,
|
|
2028
|
+
cornflowerblue: 6591981,
|
|
2029
|
+
cornsilk: 16775388,
|
|
2030
|
+
crimson: 14423100,
|
|
2031
|
+
cyan: 65535,
|
|
2032
|
+
darkblue: 139,
|
|
2033
|
+
darkcyan: 35723,
|
|
2034
|
+
darkgoldenrod: 12092939,
|
|
2035
|
+
darkgray: 11119017,
|
|
2036
|
+
darkgreen: 25600,
|
|
2037
|
+
darkgrey: 11119017,
|
|
2038
|
+
darkkhaki: 12433259,
|
|
2039
|
+
darkmagenta: 9109643,
|
|
2040
|
+
darkolivegreen: 5597999,
|
|
2041
|
+
darkorange: 16747520,
|
|
2042
|
+
darkorchid: 10040012,
|
|
2043
|
+
darkred: 9109504,
|
|
2044
|
+
darksalmon: 15308410,
|
|
2045
|
+
darkseagreen: 9419919,
|
|
2046
|
+
darkslateblue: 4734347,
|
|
2047
|
+
darkslategray: 3100495,
|
|
2048
|
+
darkslategrey: 3100495,
|
|
2049
|
+
darkturquoise: 52945,
|
|
2050
|
+
darkviolet: 9699539,
|
|
2051
|
+
deeppink: 16716947,
|
|
2052
|
+
deepskyblue: 49151,
|
|
2053
|
+
dimgray: 6908265,
|
|
2054
|
+
dimgrey: 6908265,
|
|
2055
|
+
dodgerblue: 2003199,
|
|
2056
|
+
firebrick: 11674146,
|
|
2057
|
+
floralwhite: 16775920,
|
|
2058
|
+
forestgreen: 2263842,
|
|
2059
|
+
fuchsia: 16711935,
|
|
2060
|
+
gainsboro: 14474460,
|
|
2061
|
+
ghostwhite: 16316671,
|
|
2062
|
+
gold: 16766720,
|
|
2063
|
+
goldenrod: 14329120,
|
|
2064
|
+
gray: 8421504,
|
|
2065
|
+
green: 32768,
|
|
2066
|
+
greenyellow: 11403055,
|
|
2067
|
+
grey: 8421504,
|
|
2068
|
+
honeydew: 15794160,
|
|
2069
|
+
hotpink: 16738740,
|
|
2070
|
+
indianred: 13458524,
|
|
2071
|
+
indigo: 4915330,
|
|
2072
|
+
ivory: 16777200,
|
|
2073
|
+
khaki: 15787660,
|
|
2074
|
+
lavender: 15132410,
|
|
2075
|
+
lavenderblush: 16773365,
|
|
2076
|
+
lawngreen: 8190976,
|
|
2077
|
+
lemonchiffon: 16775885,
|
|
2078
|
+
lightblue: 11393254,
|
|
2079
|
+
lightcoral: 15761536,
|
|
2080
|
+
lightcyan: 14745599,
|
|
2081
|
+
lightgoldenrodyellow: 16448210,
|
|
2082
|
+
lightgray: 13882323,
|
|
2083
|
+
lightgreen: 9498256,
|
|
2084
|
+
lightgrey: 13882323,
|
|
2085
|
+
lightpink: 16758465,
|
|
2086
|
+
lightsalmon: 16752762,
|
|
2087
|
+
lightseagreen: 2142890,
|
|
2088
|
+
lightskyblue: 8900346,
|
|
2089
|
+
lightslategray: 7833753,
|
|
2090
|
+
lightslategrey: 7833753,
|
|
2091
|
+
lightsteelblue: 11584734,
|
|
2092
|
+
lightyellow: 16777184,
|
|
2093
|
+
lime: 65280,
|
|
2094
|
+
limegreen: 3329330,
|
|
2095
|
+
linen: 16445670,
|
|
2096
|
+
magenta: 16711935,
|
|
2097
|
+
maroon: 8388608,
|
|
2098
|
+
mediumaquamarine: 6737322,
|
|
2099
|
+
mediumblue: 205,
|
|
2100
|
+
mediumorchid: 12211667,
|
|
2101
|
+
mediumpurple: 9662683,
|
|
2102
|
+
mediumseagreen: 3978097,
|
|
2103
|
+
mediumslateblue: 8087790,
|
|
2104
|
+
mediumspringgreen: 64154,
|
|
2105
|
+
mediumturquoise: 4772300,
|
|
2106
|
+
mediumvioletred: 13047173,
|
|
2107
|
+
midnightblue: 1644912,
|
|
2108
|
+
mintcream: 16121850,
|
|
2109
|
+
mistyrose: 16770273,
|
|
2110
|
+
moccasin: 16770229,
|
|
2111
|
+
navajowhite: 16768685,
|
|
2112
|
+
navy: 128,
|
|
2113
|
+
oldlace: 16643558,
|
|
2114
|
+
olive: 8421376,
|
|
2115
|
+
olivedrab: 7048739,
|
|
2116
|
+
orange: 16753920,
|
|
2117
|
+
orangered: 16729344,
|
|
2118
|
+
orchid: 14315734,
|
|
2119
|
+
palegoldenrod: 15657130,
|
|
2120
|
+
palegreen: 10025880,
|
|
2121
|
+
paleturquoise: 11529966,
|
|
2122
|
+
palevioletred: 14381203,
|
|
2123
|
+
papayawhip: 16773077,
|
|
2124
|
+
peachpuff: 16767673,
|
|
2125
|
+
peru: 13468991,
|
|
2126
|
+
pink: 16761035,
|
|
2127
|
+
plum: 14524637,
|
|
2128
|
+
powderblue: 11591910,
|
|
2129
|
+
purple: 8388736,
|
|
2130
|
+
rebeccapurple: 6697881,
|
|
2131
|
+
red: 16711680,
|
|
2132
|
+
rosybrown: 12357519,
|
|
2133
|
+
royalblue: 4286945,
|
|
2134
|
+
saddlebrown: 9127187,
|
|
2135
|
+
salmon: 16416882,
|
|
2136
|
+
sandybrown: 16032864,
|
|
2137
|
+
seagreen: 3050327,
|
|
2138
|
+
seashell: 16774638,
|
|
2139
|
+
sienna: 10506797,
|
|
2140
|
+
silver: 12632256,
|
|
2141
|
+
skyblue: 8900331,
|
|
2142
|
+
slateblue: 6970061,
|
|
2143
|
+
slategray: 7372944,
|
|
2144
|
+
slategrey: 7372944,
|
|
2145
|
+
snow: 16775930,
|
|
2146
|
+
springgreen: 65407,
|
|
2147
|
+
steelblue: 4620980,
|
|
2148
|
+
tan: 13808780,
|
|
2149
|
+
teal: 32896,
|
|
2150
|
+
thistle: 14204888,
|
|
2151
|
+
tomato: 16737095,
|
|
2152
|
+
turquoise: 4251856,
|
|
2153
|
+
violet: 15631086,
|
|
2154
|
+
wheat: 16113331,
|
|
2155
|
+
white: 16777215,
|
|
2156
|
+
whitesmoke: 16119285,
|
|
2157
|
+
yellow: 16776960,
|
|
2158
|
+
yellowgreen: 10145074
|
|
2159
|
+
}, Y = {
|
|
2160
|
+
h: 0,
|
|
2161
|
+
s: 0,
|
|
2162
|
+
l: 0
|
|
2163
|
+
}, Ge = {
|
|
2164
|
+
h: 0,
|
|
2165
|
+
s: 0,
|
|
2166
|
+
l: 0
|
|
2167
|
+
};
|
|
2168
|
+
function Ke(e, t, n) {
|
|
2169
|
+
return n < 0 && (n += 1), n > 1 && --n, n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * 6 * (2 / 3 - n) : e;
|
|
2170
|
+
}
|
|
2171
|
+
var qe = class {
|
|
2172
|
+
constructor(e, t, n) {
|
|
2173
|
+
return this.isColor = !0, this.r = 1, this.g = 1, this.b = 1, this.set(e, t, n);
|
|
2174
|
+
}
|
|
2175
|
+
set(e, t, n) {
|
|
2176
|
+
if (t === void 0 && n === void 0) {
|
|
2177
|
+
let t = e;
|
|
2178
|
+
t && t.isColor ? this.copy(t) : typeof t == "number" ? this.setHex(t) : typeof t == "string" && this.setStyle(t);
|
|
2179
|
+
} else this.setRGB(e, t, n);
|
|
2180
|
+
return this;
|
|
2181
|
+
}
|
|
2182
|
+
setScalar(e) {
|
|
2183
|
+
return this.r = e, this.g = e, this.b = e, this;
|
|
2184
|
+
}
|
|
2185
|
+
setHex(e, t = T) {
|
|
2186
|
+
return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, V.colorSpaceToWorking(this, t), this;
|
|
2187
|
+
}
|
|
2188
|
+
setRGB(e, t, n, r = V.workingColorSpace) {
|
|
2189
|
+
return this.r = e, this.g = t, this.b = n, V.colorSpaceToWorking(this, r), this;
|
|
2190
|
+
}
|
|
2191
|
+
setHSL(e, t, n, r = V.workingColorSpace) {
|
|
2192
|
+
if (e = re(e, 1), t = R(t, 0, 1), n = R(n, 0, 1), t === 0) this.r = this.g = this.b = n;
|
|
2193
|
+
else {
|
|
2194
|
+
let r = n <= .5 ? n * (1 + t) : n + t - n * t, i = 2 * n - r;
|
|
2195
|
+
this.r = Ke(i, r, e + 1 / 3), this.g = Ke(i, r, e), this.b = Ke(i, r, e - 1 / 3);
|
|
2196
|
+
}
|
|
2197
|
+
return V.colorSpaceToWorking(this, r), this;
|
|
2198
|
+
}
|
|
2199
|
+
setStyle(e, t = T) {
|
|
2200
|
+
function n(t) {
|
|
2201
|
+
t !== void 0 && parseFloat(t) < 1 && F("Color: Alpha component of " + e + " will be ignored.");
|
|
2202
|
+
}
|
|
2203
|
+
let r;
|
|
2204
|
+
if (r = /^(\w+)\(([^\)]*)\)/.exec(e)) {
|
|
2205
|
+
let i, a = r[1], o = r[2];
|
|
2206
|
+
switch (a) {
|
|
2207
|
+
case "rgb":
|
|
2208
|
+
case "rgba":
|
|
2209
|
+
if (i = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return n(i[4]), this.setRGB(Math.min(255, parseInt(i[1], 10)) / 255, Math.min(255, parseInt(i[2], 10)) / 255, Math.min(255, parseInt(i[3], 10)) / 255, t);
|
|
2210
|
+
if (i = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return n(i[4]), this.setRGB(Math.min(100, parseInt(i[1], 10)) / 100, Math.min(100, parseInt(i[2], 10)) / 100, Math.min(100, parseInt(i[3], 10)) / 100, t);
|
|
2211
|
+
break;
|
|
2212
|
+
case "hsl":
|
|
2213
|
+
case "hsla":
|
|
2214
|
+
if (i = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return n(i[4]), this.setHSL(parseFloat(i[1]) / 360, parseFloat(i[2]) / 100, parseFloat(i[3]) / 100, t);
|
|
2215
|
+
break;
|
|
2216
|
+
default: F("Color: Unknown color model " + e);
|
|
2217
|
+
}
|
|
2218
|
+
} else if (r = /^\#([A-Fa-f\d]+)$/.exec(e)) {
|
|
2219
|
+
let n = r[1], i = n.length;
|
|
2220
|
+
if (i === 3) return this.setRGB(parseInt(n.charAt(0), 16) / 15, parseInt(n.charAt(1), 16) / 15, parseInt(n.charAt(2), 16) / 15, t);
|
|
2221
|
+
if (i === 6) return this.setHex(parseInt(n, 16), t);
|
|
2222
|
+
F("Color: Invalid hex color " + e);
|
|
2223
|
+
} else if (e && e.length > 0) return this.setColorName(e, t);
|
|
2224
|
+
return this;
|
|
2225
|
+
}
|
|
2226
|
+
setColorName(e, t = T) {
|
|
2227
|
+
let n = We[e.toLowerCase()];
|
|
2228
|
+
return n === void 0 ? F("Color: Unknown color " + e) : this.setHex(n, t), this;
|
|
2229
|
+
}
|
|
2230
|
+
clone() {
|
|
2231
|
+
return new this.constructor(this.r, this.g, this.b);
|
|
2232
|
+
}
|
|
2233
|
+
copy(e) {
|
|
2234
|
+
return this.r = e.r, this.g = e.g, this.b = e.b, this;
|
|
2235
|
+
}
|
|
2236
|
+
copySRGBToLinear(e) {
|
|
2237
|
+
return this.r = H(e.r), this.g = H(e.g), this.b = H(e.b), this;
|
|
2238
|
+
}
|
|
2239
|
+
copyLinearToSRGB(e) {
|
|
2240
|
+
return this.r = U(e.r), this.g = U(e.g), this.b = U(e.b), this;
|
|
2241
|
+
}
|
|
2242
|
+
convertSRGBToLinear() {
|
|
2243
|
+
return this.copySRGBToLinear(this), this;
|
|
2244
|
+
}
|
|
2245
|
+
convertLinearToSRGB() {
|
|
2246
|
+
return this.copyLinearToSRGB(this), this;
|
|
2247
|
+
}
|
|
2248
|
+
getHex(e = T) {
|
|
2249
|
+
return V.workingToColorSpace(X.copy(this), e), Math.round(R(X.r * 255, 0, 255)) * 65536 + Math.round(R(X.g * 255, 0, 255)) * 256 + Math.round(R(X.b * 255, 0, 255));
|
|
2250
|
+
}
|
|
2251
|
+
getHexString(e = T) {
|
|
2252
|
+
return ("000000" + this.getHex(e).toString(16)).slice(-6);
|
|
2253
|
+
}
|
|
2254
|
+
getHSL(e, t = V.workingColorSpace) {
|
|
2255
|
+
V.workingToColorSpace(X.copy(this), t);
|
|
2256
|
+
let n = X.r, r = X.g, i = X.b, a = Math.max(n, r, i), o = Math.min(n, r, i), s, c, l = (o + a) / 2;
|
|
2257
|
+
if (o === a) s = 0, c = 0;
|
|
2258
|
+
else {
|
|
2259
|
+
let e = a - o;
|
|
2260
|
+
switch (c = l <= .5 ? e / (a + o) : e / (2 - a - o), a) {
|
|
2261
|
+
case n:
|
|
2262
|
+
s = (r - i) / e + (r < i ? 6 : 0);
|
|
2263
|
+
break;
|
|
2264
|
+
case r:
|
|
2265
|
+
s = (i - n) / e + 2;
|
|
2266
|
+
break;
|
|
2267
|
+
case i:
|
|
2268
|
+
s = (n - r) / e + 4;
|
|
2269
|
+
break;
|
|
2270
|
+
}
|
|
2271
|
+
s /= 6;
|
|
2272
|
+
}
|
|
2273
|
+
return e.h = s, e.s = c, e.l = l, e;
|
|
2274
|
+
}
|
|
2275
|
+
getRGB(e, t = V.workingColorSpace) {
|
|
2276
|
+
return V.workingToColorSpace(X.copy(this), t), e.r = X.r, e.g = X.g, e.b = X.b, e;
|
|
2277
|
+
}
|
|
2278
|
+
getStyle(e = T) {
|
|
2279
|
+
V.workingToColorSpace(X.copy(this), e);
|
|
2280
|
+
let t = X.r, n = X.g, r = X.b;
|
|
2281
|
+
return e === "srgb" ? `rgb(${Math.round(t * 255)},${Math.round(n * 255)},${Math.round(r * 255)})` : `color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`;
|
|
2282
|
+
}
|
|
2283
|
+
offsetHSL(e, t, n) {
|
|
2284
|
+
return this.getHSL(Y), this.setHSL(Y.h + e, Y.s + t, Y.l + n);
|
|
2285
|
+
}
|
|
2286
|
+
add(e) {
|
|
2287
|
+
return this.r += e.r, this.g += e.g, this.b += e.b, this;
|
|
2288
|
+
}
|
|
2289
|
+
addColors(e, t) {
|
|
2290
|
+
return this.r = e.r + t.r, this.g = e.g + t.g, this.b = e.b + t.b, this;
|
|
2291
|
+
}
|
|
2292
|
+
addScalar(e) {
|
|
2293
|
+
return this.r += e, this.g += e, this.b += e, this;
|
|
2294
|
+
}
|
|
2295
|
+
sub(e) {
|
|
2296
|
+
return this.r = Math.max(0, this.r - e.r), this.g = Math.max(0, this.g - e.g), this.b = Math.max(0, this.b - e.b), this;
|
|
2297
|
+
}
|
|
2298
|
+
multiply(e) {
|
|
2299
|
+
return this.r *= e.r, this.g *= e.g, this.b *= e.b, this;
|
|
2300
|
+
}
|
|
2301
|
+
multiplyScalar(e) {
|
|
2302
|
+
return this.r *= e, this.g *= e, this.b *= e, this;
|
|
2303
|
+
}
|
|
2304
|
+
lerp(e, t) {
|
|
2305
|
+
return this.r += (e.r - this.r) * t, this.g += (e.g - this.g) * t, this.b += (e.b - this.b) * t, this;
|
|
2306
|
+
}
|
|
2307
|
+
lerpColors(e, t, n) {
|
|
2308
|
+
return this.r = e.r + (t.r - e.r) * n, this.g = e.g + (t.g - e.g) * n, this.b = e.b + (t.b - e.b) * n, this;
|
|
2309
|
+
}
|
|
2310
|
+
lerpHSL(e, t) {
|
|
2311
|
+
this.getHSL(Y), e.getHSL(Ge);
|
|
2312
|
+
let n = ie(Y.h, Ge.h, t), r = ie(Y.s, Ge.s, t), i = ie(Y.l, Ge.l, t);
|
|
2313
|
+
return this.setHSL(n, r, i), this;
|
|
2314
|
+
}
|
|
2315
|
+
setFromVector3(e) {
|
|
2316
|
+
return this.r = e.x, this.g = e.y, this.b = e.z, this;
|
|
2317
|
+
}
|
|
2318
|
+
applyMatrix3(e) {
|
|
2319
|
+
let t = this.r, n = this.g, r = this.b, i = e.elements;
|
|
2320
|
+
return this.r = i[0] * t + i[3] * n + i[6] * r, this.g = i[1] * t + i[4] * n + i[7] * r, this.b = i[2] * t + i[5] * n + i[8] * r, this;
|
|
2321
|
+
}
|
|
2322
|
+
equals(e) {
|
|
2323
|
+
return e.r === this.r && e.g === this.g && e.b === this.b;
|
|
2324
|
+
}
|
|
2325
|
+
fromArray(e, t = 0) {
|
|
2326
|
+
return this.r = e[t], this.g = e[t + 1], this.b = e[t + 2], this;
|
|
2327
|
+
}
|
|
2328
|
+
toArray(e = [], t = 0) {
|
|
2329
|
+
return e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e;
|
|
2330
|
+
}
|
|
2331
|
+
fromBufferAttribute(e, t) {
|
|
2332
|
+
return this.r = e.getX(t), this.g = e.getY(t), this.b = e.getZ(t), this;
|
|
2333
|
+
}
|
|
2334
|
+
toJSON() {
|
|
2335
|
+
return this.getHex();
|
|
2336
|
+
}
|
|
2337
|
+
*[Symbol.iterator]() {
|
|
2338
|
+
yield this.r, yield this.g, yield this.b;
|
|
2339
|
+
}
|
|
2340
|
+
}, X = /* @__PURE__ */ new qe();
|
|
2341
|
+
qe.NAMES = We;
|
|
2342
|
+
var Je = class extends ye {
|
|
2343
|
+
constructor(e = null, t = 1, n = 1, r, i, a, o, s, c = f, l = f, u, d) {
|
|
2344
|
+
super(null, a, o, s, c, l, r, i, u, d), this.isDataTexture = !0, this.image = {
|
|
2345
|
+
data: e,
|
|
2346
|
+
width: t,
|
|
2347
|
+
height: n
|
|
2348
|
+
}, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
|
|
2349
|
+
}
|
|
2350
|
+
};
|
|
2351
|
+
function Ye(e, t) {
|
|
2352
|
+
return !e || e.constructor === t ? e : typeof t.BYTES_PER_ELEMENT == "number" ? new t(e) : Array.prototype.slice.call(e);
|
|
2353
|
+
}
|
|
2354
|
+
var Xe = class {
|
|
2355
|
+
constructor(e, t, n, r) {
|
|
2356
|
+
this.parameterPositions = e, this._cachedIndex = 0, this.resultBuffer = r === void 0 ? new t.constructor(n) : r, this.sampleValues = t, this.valueSize = n, this.settings = null, this.DefaultSettings_ = {};
|
|
2357
|
+
}
|
|
2358
|
+
evaluate(e) {
|
|
2359
|
+
let t = this.parameterPositions, n = this._cachedIndex, r = t[n], i = t[n - 1];
|
|
2360
|
+
validate_interval: {
|
|
2361
|
+
seek: {
|
|
2362
|
+
let a;
|
|
2363
|
+
linear_scan: {
|
|
2364
|
+
forward_scan: if (!(e < r)) {
|
|
2365
|
+
for (let a = n + 2;;) {
|
|
2366
|
+
if (r === void 0) {
|
|
2367
|
+
if (e < i) break forward_scan;
|
|
2368
|
+
return n = t.length, this._cachedIndex = n, this.copySampleValue_(n - 1);
|
|
2369
|
+
}
|
|
2370
|
+
if (n === a) break;
|
|
2371
|
+
if (i = r, r = t[++n], e < r) break seek;
|
|
2372
|
+
}
|
|
2373
|
+
a = t.length;
|
|
2374
|
+
break linear_scan;
|
|
2375
|
+
}
|
|
2376
|
+
if (!(e >= i)) {
|
|
2377
|
+
let o = t[1];
|
|
2378
|
+
e < o && (n = 2, i = o);
|
|
2379
|
+
for (let a = n - 2;;) {
|
|
2380
|
+
if (i === void 0) return this._cachedIndex = 0, this.copySampleValue_(0);
|
|
2381
|
+
if (n === a) break;
|
|
2382
|
+
if (r = i, i = t[--n - 1], e >= i) break seek;
|
|
2383
|
+
}
|
|
2384
|
+
a = n, n = 0;
|
|
2385
|
+
break linear_scan;
|
|
2386
|
+
}
|
|
2387
|
+
break validate_interval;
|
|
2388
|
+
}
|
|
2389
|
+
for (; n < a;) {
|
|
2390
|
+
let r = n + a >>> 1;
|
|
2391
|
+
e < t[r] ? a = r : n = r + 1;
|
|
2392
|
+
}
|
|
2393
|
+
if (r = t[n], i = t[n - 1], i === void 0) return this._cachedIndex = 0, this.copySampleValue_(0);
|
|
2394
|
+
if (r === void 0) return n = t.length, this._cachedIndex = n, this.copySampleValue_(n - 1);
|
|
2395
|
+
}
|
|
2396
|
+
this._cachedIndex = n, this.intervalChanged_(n, i, r);
|
|
2397
|
+
}
|
|
2398
|
+
return this.interpolate_(n, i, e, r);
|
|
2399
|
+
}
|
|
2400
|
+
getSettings_() {
|
|
2401
|
+
return this.settings || this.DefaultSettings_;
|
|
2402
|
+
}
|
|
2403
|
+
copySampleValue_(e) {
|
|
2404
|
+
let t = this.resultBuffer, n = this.sampleValues, r = this.valueSize, i = e * r;
|
|
2405
|
+
for (let e = 0; e !== r; ++e) t[e] = n[i + e];
|
|
2406
|
+
return t;
|
|
2407
|
+
}
|
|
2408
|
+
interpolate_() {
|
|
2409
|
+
throw Error("call to abstract method");
|
|
2410
|
+
}
|
|
2411
|
+
intervalChanged_() {}
|
|
2412
|
+
}, Ze = class extends Xe {
|
|
2413
|
+
constructor(e, t, n, r) {
|
|
2414
|
+
super(e, t, n, r), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = {
|
|
2415
|
+
endingStart: S,
|
|
2416
|
+
endingEnd: S
|
|
2417
|
+
};
|
|
2418
|
+
}
|
|
2419
|
+
intervalChanged_(e, t, n) {
|
|
2420
|
+
let r = this.parameterPositions, i = e - 2, a = e + 1, o = r[i], s = r[a];
|
|
2421
|
+
if (o === void 0) switch (this.getSettings_().endingStart) {
|
|
2422
|
+
case C:
|
|
2423
|
+
i = e, o = 2 * t - n;
|
|
2424
|
+
break;
|
|
2425
|
+
case w:
|
|
2426
|
+
i = r.length - 2, o = t + r[i] - r[i + 1];
|
|
2427
|
+
break;
|
|
2428
|
+
default: i = e, o = n;
|
|
2429
|
+
}
|
|
2430
|
+
if (s === void 0) switch (this.getSettings_().endingEnd) {
|
|
2431
|
+
case C:
|
|
2432
|
+
a = e, s = 2 * n - t;
|
|
2433
|
+
break;
|
|
2434
|
+
case w:
|
|
2435
|
+
a = 1, s = n + r[1] - r[0];
|
|
2436
|
+
break;
|
|
2437
|
+
default: a = e - 1, s = t;
|
|
2438
|
+
}
|
|
2439
|
+
let c = (n - t) * .5, l = this.valueSize;
|
|
2440
|
+
this._weightPrev = c / (t - o), this._weightNext = c / (s - n), this._offsetPrev = i * l, this._offsetNext = a * l;
|
|
2441
|
+
}
|
|
2442
|
+
interpolate_(e, t, n, r) {
|
|
2443
|
+
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, c = s - o, l = this._offsetPrev, u = this._offsetNext, d = this._weightPrev, f = this._weightNext, p = (n - t) / (r - t), m = p * p, h = m * p, g = -d * h + 2 * d * m - d * p, _ = (1 + d) * h + (-1.5 - 2 * d) * m + (-.5 + d) * p + 1, v = (-1 - f) * h + (1.5 + f) * m + .5 * p, y = f * h - f * m;
|
|
2444
|
+
for (let e = 0; e !== o; ++e) i[e] = g * a[l + e] + _ * a[c + e] + v * a[s + e] + y * a[u + e];
|
|
2445
|
+
return i;
|
|
2446
|
+
}
|
|
2447
|
+
}, Qe = class extends Xe {
|
|
2448
|
+
constructor(e, t, n, r) {
|
|
2449
|
+
super(e, t, n, r);
|
|
2450
|
+
}
|
|
2451
|
+
interpolate_(e, t, n, r) {
|
|
2452
|
+
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, c = s - o, l = (n - t) / (r - t), u = 1 - l;
|
|
2453
|
+
for (let e = 0; e !== o; ++e) i[e] = a[c + e] * u + a[s + e] * l;
|
|
2454
|
+
return i;
|
|
2455
|
+
}
|
|
2456
|
+
}, $e = class extends Xe {
|
|
2457
|
+
constructor(e, t, n, r) {
|
|
2458
|
+
super(e, t, n, r);
|
|
2459
|
+
}
|
|
2460
|
+
interpolate_(e) {
|
|
2461
|
+
return this.copySampleValue_(e - 1);
|
|
2462
|
+
}
|
|
2463
|
+
}, et = class extends Xe {
|
|
2464
|
+
interpolate_(e, t, n, r) {
|
|
2465
|
+
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, c = s - o, l = this.settings || this.DefaultSettings_, u = l.inTangents, d = l.outTangents;
|
|
2466
|
+
if (!u || !d) {
|
|
2467
|
+
let e = (n - t) / (r - t), l = 1 - e;
|
|
2468
|
+
for (let t = 0; t !== o; ++t) i[t] = a[c + t] * l + a[s + t] * e;
|
|
2469
|
+
return i;
|
|
2470
|
+
}
|
|
2471
|
+
let f = o * 2, p = e - 1;
|
|
2472
|
+
for (let l = 0; l !== o; ++l) {
|
|
2473
|
+
let o = a[c + l], m = a[s + l], h = p * f + l * 2, g = d[h], _ = d[h + 1], v = e * f + l * 2, y = u[v], b = u[v + 1], x = (n - t) / (r - t), S, C, w, T, E;
|
|
2474
|
+
for (let e = 0; e < 8; e++) {
|
|
2475
|
+
S = x * x, C = S * x, w = 1 - x, T = w * w, E = T * w;
|
|
2476
|
+
let e = E * t + 3 * T * x * g + 3 * w * S * y + C * r - n;
|
|
2477
|
+
if (Math.abs(e) < 1e-10) break;
|
|
2478
|
+
let i = 3 * T * (g - t) + 6 * w * x * (y - g) + 3 * S * (r - y);
|
|
2479
|
+
if (Math.abs(i) < 1e-10) break;
|
|
2480
|
+
x -= e / i, x = Math.max(0, Math.min(1, x));
|
|
2481
|
+
}
|
|
2482
|
+
i[l] = E * o + 3 * T * x * _ + 3 * w * S * b + C * m;
|
|
2483
|
+
}
|
|
2484
|
+
return i;
|
|
2485
|
+
}
|
|
2486
|
+
}, Z = class {
|
|
2487
|
+
constructor(e, t, n, r) {
|
|
2488
|
+
if (e === void 0) throw Error("THREE.KeyframeTrack: track name is undefined");
|
|
2489
|
+
if (t === void 0 || t.length === 0) throw Error("THREE.KeyframeTrack: no keyframes in track named " + e);
|
|
2490
|
+
this.name = e, this.times = Ye(t, this.TimeBufferType), this.values = Ye(n, this.ValueBufferType), this.setInterpolation(r || this.DefaultInterpolation);
|
|
2491
|
+
}
|
|
2492
|
+
static toJSON(e) {
|
|
2493
|
+
let t = e.constructor, n;
|
|
2494
|
+
if (t.toJSON !== this.toJSON) n = t.toJSON(e);
|
|
2495
|
+
else {
|
|
2496
|
+
n = {
|
|
2497
|
+
name: e.name,
|
|
2498
|
+
times: Ye(e.times, Array),
|
|
2499
|
+
values: Ye(e.values, Array)
|
|
2500
|
+
};
|
|
2501
|
+
let t = e.getInterpolation();
|
|
2502
|
+
t !== e.DefaultInterpolation && (n.interpolation = t);
|
|
2503
|
+
}
|
|
2504
|
+
return n.type = e.ValueTypeName, n;
|
|
2505
|
+
}
|
|
2506
|
+
InterpolantFactoryMethodDiscrete(e) {
|
|
2507
|
+
return new $e(this.times, this.values, this.getValueSize(), e);
|
|
2508
|
+
}
|
|
2509
|
+
InterpolantFactoryMethodLinear(e) {
|
|
2510
|
+
return new Qe(this.times, this.values, this.getValueSize(), e);
|
|
2511
|
+
}
|
|
2512
|
+
InterpolantFactoryMethodSmooth(e) {
|
|
2513
|
+
return new Ze(this.times, this.values, this.getValueSize(), e);
|
|
2514
|
+
}
|
|
2515
|
+
InterpolantFactoryMethodBezier(e) {
|
|
2516
|
+
let t = new et(this.times, this.values, this.getValueSize(), e);
|
|
2517
|
+
return this.settings && (t.settings = this.settings), t;
|
|
2518
|
+
}
|
|
2519
|
+
setInterpolation(e) {
|
|
2520
|
+
let t;
|
|
2521
|
+
switch (e) {
|
|
2522
|
+
case v:
|
|
2523
|
+
t = this.InterpolantFactoryMethodDiscrete;
|
|
2524
|
+
break;
|
|
2525
|
+
case y:
|
|
2526
|
+
t = this.InterpolantFactoryMethodLinear;
|
|
2527
|
+
break;
|
|
2528
|
+
case b:
|
|
2529
|
+
t = this.InterpolantFactoryMethodSmooth;
|
|
2530
|
+
break;
|
|
2531
|
+
case x:
|
|
2532
|
+
t = this.InterpolantFactoryMethodBezier;
|
|
2533
|
+
break;
|
|
2534
|
+
}
|
|
2535
|
+
if (t === void 0) {
|
|
2536
|
+
let t = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name;
|
|
2537
|
+
if (this.createInterpolant === void 0) if (e !== this.DefaultInterpolation) this.setInterpolation(this.DefaultInterpolation);
|
|
2538
|
+
else throw Error(t);
|
|
2539
|
+
return F("KeyframeTrack:", t), this;
|
|
2540
|
+
}
|
|
2541
|
+
return this.createInterpolant = t, this;
|
|
2542
|
+
}
|
|
2543
|
+
getInterpolation() {
|
|
2544
|
+
switch (this.createInterpolant) {
|
|
2545
|
+
case this.InterpolantFactoryMethodDiscrete: return v;
|
|
2546
|
+
case this.InterpolantFactoryMethodLinear: return y;
|
|
2547
|
+
case this.InterpolantFactoryMethodSmooth: return b;
|
|
2548
|
+
case this.InterpolantFactoryMethodBezier: return x;
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
getValueSize() {
|
|
2552
|
+
return this.values.length / this.times.length;
|
|
2553
|
+
}
|
|
2554
|
+
shift(e) {
|
|
2555
|
+
if (e !== 0) {
|
|
2556
|
+
let t = this.times;
|
|
2557
|
+
for (let n = 0, r = t.length; n !== r; ++n) t[n] += e;
|
|
2558
|
+
}
|
|
2559
|
+
return this;
|
|
2560
|
+
}
|
|
2561
|
+
scale(e) {
|
|
2562
|
+
if (e !== 1) {
|
|
2563
|
+
let t = this.times;
|
|
2564
|
+
for (let n = 0, r = t.length; n !== r; ++n) t[n] *= e;
|
|
2565
|
+
}
|
|
2566
|
+
return this;
|
|
2567
|
+
}
|
|
2568
|
+
trim(e, t) {
|
|
2569
|
+
let n = this.times, r = n.length, i = 0, a = r - 1;
|
|
2570
|
+
for (; i !== r && n[i] < e;) ++i;
|
|
2571
|
+
for (; a !== -1 && n[a] > t;) --a;
|
|
2572
|
+
if (++a, i !== 0 || a !== r) {
|
|
2573
|
+
i >= a && (a = Math.max(a, 1), i = a - 1);
|
|
2574
|
+
let e = this.getValueSize();
|
|
2575
|
+
this.times = n.slice(i, a), this.values = this.values.slice(i * e, a * e);
|
|
2576
|
+
}
|
|
2577
|
+
return this;
|
|
2578
|
+
}
|
|
2579
|
+
validate() {
|
|
2580
|
+
let e = !0, t = this.getValueSize();
|
|
2581
|
+
t - Math.floor(t) !== 0 && (I("KeyframeTrack: Invalid value size in track.", this), e = !1);
|
|
2582
|
+
let n = this.times, r = this.values, i = n.length;
|
|
2583
|
+
i === 0 && (I("KeyframeTrack: Track is empty.", this), e = !1);
|
|
2584
|
+
let a = null;
|
|
2585
|
+
for (let t = 0; t !== i; t++) {
|
|
2586
|
+
let r = n[t];
|
|
2587
|
+
if (typeof r == "number" && isNaN(r)) {
|
|
2588
|
+
I("KeyframeTrack: Time is not a valid number.", this, t, r), e = !1;
|
|
2589
|
+
break;
|
|
2590
|
+
}
|
|
2591
|
+
if (a !== null && a > r) {
|
|
2592
|
+
I("KeyframeTrack: Out of order keys.", this, t, r, a), e = !1;
|
|
2593
|
+
break;
|
|
2594
|
+
}
|
|
2595
|
+
a = r;
|
|
2596
|
+
}
|
|
2597
|
+
if (r !== void 0 && A(r)) for (let t = 0, n = r.length; t !== n; ++t) {
|
|
2598
|
+
let n = r[t];
|
|
2599
|
+
if (isNaN(n)) {
|
|
2600
|
+
I("KeyframeTrack: Value is not a valid number.", this, t, n), e = !1;
|
|
2601
|
+
break;
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
return e;
|
|
2605
|
+
}
|
|
2606
|
+
optimize() {
|
|
2607
|
+
let e = this.times.slice(), t = this.values.slice(), n = this.getValueSize(), r = this.getInterpolation() === b, i = e.length - 1, a = 1;
|
|
2608
|
+
for (let o = 1; o < i; ++o) {
|
|
2609
|
+
let i = !1, s = e[o];
|
|
2610
|
+
if (s !== e[o + 1] && (o !== 1 || s !== e[0])) if (r) i = !0;
|
|
2611
|
+
else {
|
|
2612
|
+
let e = o * n, r = e - n, a = e + n;
|
|
2613
|
+
for (let o = 0; o !== n; ++o) {
|
|
2614
|
+
let n = t[e + o];
|
|
2615
|
+
if (n !== t[r + o] || n !== t[a + o]) {
|
|
2616
|
+
i = !0;
|
|
2617
|
+
break;
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
if (i) {
|
|
2622
|
+
if (o !== a) {
|
|
2623
|
+
e[a] = e[o];
|
|
2624
|
+
let r = o * n, i = a * n;
|
|
2625
|
+
for (let e = 0; e !== n; ++e) t[i + e] = t[r + e];
|
|
2626
|
+
}
|
|
2627
|
+
++a;
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
if (i > 0) {
|
|
2631
|
+
e[a] = e[i];
|
|
2632
|
+
for (let e = i * n, r = a * n, o = 0; o !== n; ++o) t[r + o] = t[e + o];
|
|
2633
|
+
++a;
|
|
2634
|
+
}
|
|
2635
|
+
return a === e.length ? (this.times = e, this.values = t) : (this.times = e.slice(0, a), this.values = t.slice(0, a * n)), this;
|
|
2636
|
+
}
|
|
2637
|
+
clone() {
|
|
2638
|
+
let e = this.times.slice(), t = this.values.slice(), n = this.constructor, r = new n(this.name, e, t);
|
|
2639
|
+
return r.createInterpolant = this.createInterpolant, r;
|
|
2640
|
+
}
|
|
2641
|
+
};
|
|
2642
|
+
Z.prototype.ValueTypeName = "", Z.prototype.TimeBufferType = Float32Array, Z.prototype.ValueBufferType = Float32Array, Z.prototype.DefaultInterpolation = y;
|
|
2643
|
+
var tt = class extends Z {
|
|
2644
|
+
constructor(e, t, n) {
|
|
2645
|
+
super(e, t, n);
|
|
2646
|
+
}
|
|
2647
|
+
};
|
|
2648
|
+
tt.prototype.ValueTypeName = "bool", tt.prototype.ValueBufferType = Array, tt.prototype.DefaultInterpolation = v, tt.prototype.InterpolantFactoryMethodLinear = void 0, tt.prototype.InterpolantFactoryMethodSmooth = void 0;
|
|
2649
|
+
var nt = class extends Z {
|
|
2650
|
+
constructor(e, t, n, r) {
|
|
2651
|
+
super(e, t, n, r);
|
|
2652
|
+
}
|
|
2653
|
+
};
|
|
2654
|
+
nt.prototype.ValueTypeName = "color";
|
|
2655
|
+
var rt = class extends Z {
|
|
2656
|
+
constructor(e, t, n, r) {
|
|
2657
|
+
super(e, t, n, r);
|
|
2658
|
+
}
|
|
2659
|
+
};
|
|
2660
|
+
rt.prototype.ValueTypeName = "number";
|
|
2661
|
+
var it = class extends Xe {
|
|
2662
|
+
constructor(e, t, n, r) {
|
|
2663
|
+
super(e, t, n, r);
|
|
2664
|
+
}
|
|
2665
|
+
interpolate_(e, t, n, r) {
|
|
2666
|
+
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = (n - t) / (r - t), c = e * o;
|
|
2667
|
+
for (let e = c + o; c !== e; c += 4) z.slerpFlat(i, 0, a, c - o, a, c, s);
|
|
2668
|
+
return i;
|
|
2669
|
+
}
|
|
2670
|
+
}, at = class extends Z {
|
|
2671
|
+
constructor(e, t, n, r) {
|
|
2672
|
+
super(e, t, n, r);
|
|
2673
|
+
}
|
|
2674
|
+
InterpolantFactoryMethodLinear(e) {
|
|
2675
|
+
return new it(this.times, this.values, this.getValueSize(), e);
|
|
2676
|
+
}
|
|
2677
|
+
};
|
|
2678
|
+
at.prototype.ValueTypeName = "quaternion", at.prototype.InterpolantFactoryMethodSmooth = void 0;
|
|
2679
|
+
var ot = class extends Z {
|
|
2680
|
+
constructor(e, t, n) {
|
|
2681
|
+
super(e, t, n);
|
|
2682
|
+
}
|
|
2683
|
+
};
|
|
2684
|
+
ot.prototype.ValueTypeName = "string", ot.prototype.ValueBufferType = Array, ot.prototype.DefaultInterpolation = v, ot.prototype.InterpolantFactoryMethodLinear = void 0, ot.prototype.InterpolantFactoryMethodSmooth = void 0;
|
|
2685
|
+
var st = class extends Z {
|
|
2686
|
+
constructor(e, t, n, r) {
|
|
2687
|
+
super(e, t, n, r);
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
st.prototype.ValueTypeName = "vector";
|
|
2691
|
+
var ct = /* @__PURE__ */ new class {
|
|
2692
|
+
constructor(e, t, n) {
|
|
2693
|
+
let r = this, i = !1, a = 0, o = 0, s, c = [];
|
|
2694
|
+
this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = n, this._abortController = null, this.itemStart = function(e) {
|
|
2695
|
+
o++, i === !1 && r.onStart !== void 0 && r.onStart(e, a, o), i = !0;
|
|
2696
|
+
}, this.itemEnd = function(e) {
|
|
2697
|
+
a++, r.onProgress !== void 0 && r.onProgress(e, a, o), a === o && (i = !1, r.onLoad !== void 0 && r.onLoad());
|
|
2698
|
+
}, this.itemError = function(e) {
|
|
2699
|
+
r.onError !== void 0 && r.onError(e);
|
|
2700
|
+
}, this.resolveURL = function(e) {
|
|
2701
|
+
return s ? s(e) : e;
|
|
2702
|
+
}, this.setURLModifier = function(e) {
|
|
2703
|
+
return s = e, this;
|
|
2704
|
+
}, this.addHandler = function(e, t) {
|
|
2705
|
+
return c.push(e, t), this;
|
|
2706
|
+
}, this.removeHandler = function(e) {
|
|
2707
|
+
let t = c.indexOf(e);
|
|
2708
|
+
return t !== -1 && c.splice(t, 2), this;
|
|
2709
|
+
}, this.getHandler = function(e) {
|
|
2710
|
+
for (let t = 0, n = c.length; t < n; t += 2) {
|
|
2711
|
+
let n = c[t], r = c[t + 1];
|
|
2712
|
+
if (n.global && (n.lastIndex = 0), n.test(e)) return r;
|
|
2713
|
+
}
|
|
2714
|
+
return null;
|
|
2715
|
+
}, this.abort = function() {
|
|
2716
|
+
return this.abortController.abort(), this._abortController = null, this;
|
|
2717
|
+
};
|
|
2718
|
+
}
|
|
2719
|
+
get abortController() {
|
|
2720
|
+
return this._abortController ||= new AbortController(), this._abortController;
|
|
2721
|
+
}
|
|
2722
|
+
}(), lt = class {
|
|
2723
|
+
constructor(e) {
|
|
2724
|
+
this.manager = e === void 0 ? ct : e, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {}, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this }));
|
|
2725
|
+
}
|
|
2726
|
+
load() {}
|
|
2727
|
+
loadAsync(e, t) {
|
|
2728
|
+
let n = this;
|
|
2729
|
+
return new Promise(function(r, i) {
|
|
2730
|
+
n.load(e, r, t, i);
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
parse() {}
|
|
2734
|
+
setCrossOrigin(e) {
|
|
2735
|
+
return this.crossOrigin = e, this;
|
|
2736
|
+
}
|
|
2737
|
+
setWithCredentials(e) {
|
|
2738
|
+
return this.withCredentials = e, this;
|
|
2739
|
+
}
|
|
2740
|
+
setPath(e) {
|
|
2741
|
+
return this.path = e, this;
|
|
2742
|
+
}
|
|
2743
|
+
setResourcePath(e) {
|
|
2744
|
+
return this.resourcePath = e, this;
|
|
2745
|
+
}
|
|
2746
|
+
setRequestHeader(e) {
|
|
2747
|
+
return this.requestHeader = e, this;
|
|
2748
|
+
}
|
|
2749
|
+
abort() {
|
|
2750
|
+
return this;
|
|
2751
|
+
}
|
|
2752
|
+
};
|
|
2753
|
+
lt.DEFAULT_MATERIAL_NAME = "__DEFAULT";
|
|
2754
|
+
var ut = "\\[\\]\\.:\\/", dt = RegExp("[" + ut + "]", "g"), ft = "[^" + ut + "]", pt = "[^" + ut.replace("\\.", "") + "]", mt = /* @__PURE__ */ "((?:WC+[\\/:])*)".replace("WC", ft), ht = /* @__PURE__ */ "(WCOD+)?".replace("WCOD", pt), gt = /* @__PURE__ */ "(?:\\.(WC+)(?:\\[(.+)\\])?)?".replace("WC", ft), _t = /* @__PURE__ */ "\\.(WC+)(?:\\[(.+)\\])?".replace("WC", ft), vt = RegExp("^" + mt + ht + gt + _t + "$"), yt = [
|
|
2755
|
+
"material",
|
|
2756
|
+
"materials",
|
|
2757
|
+
"bones",
|
|
2758
|
+
"map"
|
|
2759
|
+
], bt = class {
|
|
2760
|
+
constructor(e, t, n) {
|
|
2761
|
+
let r = n || Q.parseTrackName(t);
|
|
2762
|
+
this._targetGroup = e, this._bindings = e.subscribe_(t, r);
|
|
2763
|
+
}
|
|
2764
|
+
getValue(e, t) {
|
|
2765
|
+
this.bind();
|
|
2766
|
+
let n = this._targetGroup.nCachedObjects_, r = this._bindings[n];
|
|
2767
|
+
r !== void 0 && r.getValue(e, t);
|
|
2768
|
+
}
|
|
2769
|
+
setValue(e, t) {
|
|
2770
|
+
let n = this._bindings;
|
|
2771
|
+
for (let r = this._targetGroup.nCachedObjects_, i = n.length; r !== i; ++r) n[r].setValue(e, t);
|
|
2772
|
+
}
|
|
2773
|
+
bind() {
|
|
2774
|
+
let e = this._bindings;
|
|
2775
|
+
for (let t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t) e[t].bind();
|
|
2776
|
+
}
|
|
2777
|
+
unbind() {
|
|
2778
|
+
let e = this._bindings;
|
|
2779
|
+
for (let t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t) e[t].unbind();
|
|
2780
|
+
}
|
|
2781
|
+
}, Q = class e {
|
|
2782
|
+
constructor(t, n, r) {
|
|
2783
|
+
this.path = n, this.parsedPath = r || e.parseTrackName(n), this.node = e.findNode(t, this.parsedPath.nodeName), this.rootNode = t, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;
|
|
2784
|
+
}
|
|
2785
|
+
static create(t, n, r) {
|
|
2786
|
+
return t && t.isAnimationObjectGroup ? new e.Composite(t, n, r) : new e(t, n, r);
|
|
2787
|
+
}
|
|
2788
|
+
static sanitizeNodeName(e) {
|
|
2789
|
+
return e.replace(/\s/g, "_").replace(dt, "");
|
|
2790
|
+
}
|
|
2791
|
+
static parseTrackName(e) {
|
|
2792
|
+
let t = vt.exec(e);
|
|
2793
|
+
if (t === null) throw Error("PropertyBinding: Cannot parse trackName: " + e);
|
|
2794
|
+
let n = {
|
|
2795
|
+
nodeName: t[2],
|
|
2796
|
+
objectName: t[3],
|
|
2797
|
+
objectIndex: t[4],
|
|
2798
|
+
propertyName: t[5],
|
|
2799
|
+
propertyIndex: t[6]
|
|
2800
|
+
}, r = n.nodeName && n.nodeName.lastIndexOf(".");
|
|
2801
|
+
if (r !== void 0 && r !== -1) {
|
|
2802
|
+
let e = n.nodeName.substring(r + 1);
|
|
2803
|
+
yt.indexOf(e) !== -1 && (n.nodeName = n.nodeName.substring(0, r), n.objectName = e);
|
|
2804
|
+
}
|
|
2805
|
+
if (n.propertyName === null || n.propertyName.length === 0) throw Error("PropertyBinding: can not parse propertyName from trackName: " + e);
|
|
2806
|
+
return n;
|
|
2807
|
+
}
|
|
2808
|
+
static findNode(e, t) {
|
|
2809
|
+
if (t === void 0 || t === "" || t === "." || t === -1 || t === e.name || t === e.uuid) return e;
|
|
2810
|
+
if (e.skeleton) {
|
|
2811
|
+
let n = e.skeleton.getBoneByName(t);
|
|
2812
|
+
if (n !== void 0) return n;
|
|
2813
|
+
}
|
|
2814
|
+
if (e.children) {
|
|
2815
|
+
let n = function(e) {
|
|
2816
|
+
for (let r = 0; r < e.length; r++) {
|
|
2817
|
+
let i = e[r];
|
|
2818
|
+
if (i.name === t || i.uuid === t) return i;
|
|
2819
|
+
let a = n(i.children);
|
|
2820
|
+
if (a) return a;
|
|
2821
|
+
}
|
|
2822
|
+
return null;
|
|
2823
|
+
}, r = n(e.children);
|
|
2824
|
+
if (r) return r;
|
|
2825
|
+
}
|
|
2826
|
+
return null;
|
|
2827
|
+
}
|
|
2828
|
+
_getValue_unavailable() {}
|
|
2829
|
+
_setValue_unavailable() {}
|
|
2830
|
+
_getValue_direct(e, t) {
|
|
2831
|
+
e[t] = this.targetObject[this.propertyName];
|
|
2832
|
+
}
|
|
2833
|
+
_getValue_array(e, t) {
|
|
2834
|
+
let n = this.resolvedProperty;
|
|
2835
|
+
for (let r = 0, i = n.length; r !== i; ++r) e[t++] = n[r];
|
|
2836
|
+
}
|
|
2837
|
+
_getValue_arrayElement(e, t) {
|
|
2838
|
+
e[t] = this.resolvedProperty[this.propertyIndex];
|
|
2839
|
+
}
|
|
2840
|
+
_getValue_toArray(e, t) {
|
|
2841
|
+
this.resolvedProperty.toArray(e, t);
|
|
2842
|
+
}
|
|
2843
|
+
_setValue_direct(e, t) {
|
|
2844
|
+
this.targetObject[this.propertyName] = e[t];
|
|
2845
|
+
}
|
|
2846
|
+
_setValue_direct_setNeedsUpdate(e, t) {
|
|
2847
|
+
this.targetObject[this.propertyName] = e[t], this.targetObject.needsUpdate = !0;
|
|
2848
|
+
}
|
|
2849
|
+
_setValue_direct_setMatrixWorldNeedsUpdate(e, t) {
|
|
2850
|
+
this.targetObject[this.propertyName] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0;
|
|
2851
|
+
}
|
|
2852
|
+
_setValue_array(e, t) {
|
|
2853
|
+
let n = this.resolvedProperty;
|
|
2854
|
+
for (let r = 0, i = n.length; r !== i; ++r) n[r] = e[t++];
|
|
2855
|
+
}
|
|
2856
|
+
_setValue_array_setNeedsUpdate(e, t) {
|
|
2857
|
+
let n = this.resolvedProperty;
|
|
2858
|
+
for (let r = 0, i = n.length; r !== i; ++r) n[r] = e[t++];
|
|
2859
|
+
this.targetObject.needsUpdate = !0;
|
|
2860
|
+
}
|
|
2861
|
+
_setValue_array_setMatrixWorldNeedsUpdate(e, t) {
|
|
2862
|
+
let n = this.resolvedProperty;
|
|
2863
|
+
for (let r = 0, i = n.length; r !== i; ++r) n[r] = e[t++];
|
|
2864
|
+
this.targetObject.matrixWorldNeedsUpdate = !0;
|
|
2865
|
+
}
|
|
2866
|
+
_setValue_arrayElement(e, t) {
|
|
2867
|
+
this.resolvedProperty[this.propertyIndex] = e[t];
|
|
2868
|
+
}
|
|
2869
|
+
_setValue_arrayElement_setNeedsUpdate(e, t) {
|
|
2870
|
+
this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.needsUpdate = !0;
|
|
2871
|
+
}
|
|
2872
|
+
_setValue_arrayElement_setMatrixWorldNeedsUpdate(e, t) {
|
|
2873
|
+
this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0;
|
|
2874
|
+
}
|
|
2875
|
+
_setValue_fromArray(e, t) {
|
|
2876
|
+
this.resolvedProperty.fromArray(e, t);
|
|
2877
|
+
}
|
|
2878
|
+
_setValue_fromArray_setNeedsUpdate(e, t) {
|
|
2879
|
+
this.resolvedProperty.fromArray(e, t), this.targetObject.needsUpdate = !0;
|
|
2880
|
+
}
|
|
2881
|
+
_setValue_fromArray_setMatrixWorldNeedsUpdate(e, t) {
|
|
2882
|
+
this.resolvedProperty.fromArray(e, t), this.targetObject.matrixWorldNeedsUpdate = !0;
|
|
2883
|
+
}
|
|
2884
|
+
_getValue_unbound(e, t) {
|
|
2885
|
+
this.bind(), this.getValue(e, t);
|
|
2886
|
+
}
|
|
2887
|
+
_setValue_unbound(e, t) {
|
|
2888
|
+
this.bind(), this.setValue(e, t);
|
|
2889
|
+
}
|
|
2890
|
+
bind() {
|
|
2891
|
+
let t = this.node, n = this.parsedPath, r = n.objectName, i = n.propertyName, a = n.propertyIndex;
|
|
2892
|
+
if (t || (t = e.findNode(this.rootNode, n.nodeName), this.node = t), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !t) {
|
|
2893
|
+
F("PropertyBinding: No target node found for track: " + this.path + ".");
|
|
2894
|
+
return;
|
|
2895
|
+
}
|
|
2896
|
+
if (r) {
|
|
2897
|
+
let e = n.objectIndex;
|
|
2898
|
+
switch (r) {
|
|
2899
|
+
case "materials":
|
|
2900
|
+
if (!t.material) {
|
|
2901
|
+
I("PropertyBinding: Can not bind to material as node does not have a material.", this);
|
|
2902
|
+
return;
|
|
2903
|
+
}
|
|
2904
|
+
if (!t.material.materials) {
|
|
2905
|
+
I("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this);
|
|
2906
|
+
return;
|
|
2907
|
+
}
|
|
2908
|
+
t = t.material.materials;
|
|
2909
|
+
break;
|
|
2910
|
+
case "bones":
|
|
2911
|
+
if (!t.skeleton) {
|
|
2912
|
+
I("PropertyBinding: Can not bind to bones as node does not have a skeleton.", this);
|
|
2913
|
+
return;
|
|
2914
|
+
}
|
|
2915
|
+
t = t.skeleton.bones;
|
|
2916
|
+
for (let n = 0; n < t.length; n++) if (t[n].name === e) {
|
|
2917
|
+
e = n;
|
|
2918
|
+
break;
|
|
2919
|
+
}
|
|
2920
|
+
break;
|
|
2921
|
+
case "map":
|
|
2922
|
+
if ("map" in t) {
|
|
2923
|
+
t = t.map;
|
|
2924
|
+
break;
|
|
2925
|
+
}
|
|
2926
|
+
if (!t.material) {
|
|
2927
|
+
I("PropertyBinding: Can not bind to material as node does not have a material.", this);
|
|
2928
|
+
return;
|
|
2929
|
+
}
|
|
2930
|
+
if (!t.material.map) {
|
|
2931
|
+
I("PropertyBinding: Can not bind to material.map as node.material does not have a map.", this);
|
|
2932
|
+
return;
|
|
2933
|
+
}
|
|
2934
|
+
t = t.material.map;
|
|
2935
|
+
break;
|
|
2936
|
+
default:
|
|
2937
|
+
if (t[r] === void 0) {
|
|
2938
|
+
I("PropertyBinding: Can not bind to objectName of node undefined.", this);
|
|
2939
|
+
return;
|
|
2940
|
+
}
|
|
2941
|
+
t = t[r];
|
|
2942
|
+
}
|
|
2943
|
+
if (e !== void 0) {
|
|
2944
|
+
if (t[e] === void 0) {
|
|
2945
|
+
I("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, t);
|
|
2946
|
+
return;
|
|
2947
|
+
}
|
|
2948
|
+
t = t[e];
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
let o = t[i];
|
|
2952
|
+
if (o === void 0) {
|
|
2953
|
+
let e = n.nodeName;
|
|
2954
|
+
I("PropertyBinding: Trying to update property for track: " + e + "." + i + " but it wasn't found.", t);
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
let s = this.Versioning.None;
|
|
2958
|
+
this.targetObject = t, t.isMaterial === !0 ? s = this.Versioning.NeedsUpdate : t.isObject3D === !0 && (s = this.Versioning.MatrixWorldNeedsUpdate);
|
|
2959
|
+
let c = this.BindingType.Direct;
|
|
2960
|
+
if (a !== void 0) {
|
|
2961
|
+
if (i === "morphTargetInfluences") {
|
|
2962
|
+
if (!t.geometry) {
|
|
2963
|
+
I("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this);
|
|
2964
|
+
return;
|
|
2965
|
+
}
|
|
2966
|
+
if (!t.geometry.morphAttributes) {
|
|
2967
|
+
I("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this);
|
|
2968
|
+
return;
|
|
2969
|
+
}
|
|
2970
|
+
t.morphTargetDictionary[a] !== void 0 && (a = t.morphTargetDictionary[a]);
|
|
2971
|
+
}
|
|
2972
|
+
c = this.BindingType.ArrayElement, this.resolvedProperty = o, this.propertyIndex = a;
|
|
2973
|
+
} else o.fromArray !== void 0 && o.toArray !== void 0 ? (c = this.BindingType.HasFromToArray, this.resolvedProperty = o) : Array.isArray(o) ? (c = this.BindingType.EntireArray, this.resolvedProperty = o) : this.propertyName = i;
|
|
2974
|
+
this.getValue = this.GetterByBindingType[c], this.setValue = this.SetterByBindingTypeAndVersioning[c][s];
|
|
2975
|
+
}
|
|
2976
|
+
unbind() {
|
|
2977
|
+
this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
Q.Composite = bt, Q.prototype.BindingType = {
|
|
2981
|
+
Direct: 0,
|
|
2982
|
+
EntireArray: 1,
|
|
2983
|
+
ArrayElement: 2,
|
|
2984
|
+
HasFromToArray: 3
|
|
2985
|
+
}, Q.prototype.Versioning = {
|
|
2986
|
+
None: 0,
|
|
2987
|
+
NeedsUpdate: 1,
|
|
2988
|
+
MatrixWorldNeedsUpdate: 2
|
|
2989
|
+
}, Q.prototype.GetterByBindingType = [
|
|
2990
|
+
Q.prototype._getValue_direct,
|
|
2991
|
+
Q.prototype._getValue_array,
|
|
2992
|
+
Q.prototype._getValue_arrayElement,
|
|
2993
|
+
Q.prototype._getValue_toArray
|
|
2994
|
+
], Q.prototype.SetterByBindingTypeAndVersioning = [
|
|
2995
|
+
[
|
|
2996
|
+
Q.prototype._setValue_direct,
|
|
2997
|
+
Q.prototype._setValue_direct_setNeedsUpdate,
|
|
2998
|
+
Q.prototype._setValue_direct_setMatrixWorldNeedsUpdate
|
|
2999
|
+
],
|
|
3000
|
+
[
|
|
3001
|
+
Q.prototype._setValue_array,
|
|
3002
|
+
Q.prototype._setValue_array_setNeedsUpdate,
|
|
3003
|
+
Q.prototype._setValue_array_setMatrixWorldNeedsUpdate
|
|
3004
|
+
],
|
|
3005
|
+
[
|
|
3006
|
+
Q.prototype._setValue_arrayElement,
|
|
3007
|
+
Q.prototype._setValue_arrayElement_setNeedsUpdate,
|
|
3008
|
+
Q.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate
|
|
3009
|
+
],
|
|
3010
|
+
[
|
|
3011
|
+
Q.prototype._setValue_fromArray,
|
|
3012
|
+
Q.prototype._setValue_fromArray_setNeedsUpdate,
|
|
3013
|
+
Q.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate
|
|
3014
|
+
]
|
|
3015
|
+
], class e {
|
|
3016
|
+
static {
|
|
3017
|
+
e.prototype.isMatrix2 = !0;
|
|
3018
|
+
}
|
|
3019
|
+
constructor(e, t, n, r) {
|
|
3020
|
+
this.elements = [
|
|
3021
|
+
1,
|
|
3022
|
+
0,
|
|
3023
|
+
0,
|
|
3024
|
+
1
|
|
3025
|
+
], e !== void 0 && this.set(e, t, n, r);
|
|
3026
|
+
}
|
|
3027
|
+
identity() {
|
|
3028
|
+
return this.set(1, 0, 0, 1), this;
|
|
3029
|
+
}
|
|
3030
|
+
fromArray(e, t = 0) {
|
|
3031
|
+
for (let n = 0; n < 4; n++) this.elements[n] = e[n + t];
|
|
3032
|
+
return this;
|
|
3033
|
+
}
|
|
3034
|
+
set(e, t, n, r) {
|
|
3035
|
+
let i = this.elements;
|
|
3036
|
+
return i[0] = e, i[2] = t, i[1] = n, i[3] = r, this;
|
|
3037
|
+
}
|
|
3038
|
+
}, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: { revision: "184" } })), typeof window < "u" && (window.__THREE__ ? F("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = "184");
|
|
3039
|
+
//#endregion
|
|
3040
|
+
//#region src/FontWorkerClient.ts
|
|
3041
|
+
var xt = class {
|
|
3042
|
+
_worker;
|
|
3043
|
+
_concurrencyManager;
|
|
3044
|
+
_nextId = 0;
|
|
3045
|
+
_pending = /* @__PURE__ */ new Map();
|
|
3046
|
+
_ready;
|
|
3047
|
+
constructor(e, t, n) {
|
|
3048
|
+
this._concurrencyManager = t, this._worker = new Worker(e, { type: void 0 }), this._worker.onmessage = (e) => {
|
|
3049
|
+
let { id: t, type: n, payload: r } = e.data, i = this._pending.get(t);
|
|
3050
|
+
i && (this._pending.delete(t), n === "error" ? i.reject(Error(r.message)) : i.resolve(r));
|
|
3051
|
+
}, this._worker.onerror = (e) => {
|
|
3052
|
+
console.error("FontWorkerClient: worker error", e), this.dispose();
|
|
3053
|
+
}, this._ready = this._send("init", { fontBudgetBytes: n?.fontBudgetBytes }).then(() => void 0), this._concurrencyManager.increment();
|
|
3054
|
+
}
|
|
3055
|
+
async ready() {
|
|
3056
|
+
return this._ready;
|
|
3057
|
+
}
|
|
3058
|
+
async loadFont(e, t, n, r) {
|
|
3059
|
+
return this._send("loadFont", {
|
|
3060
|
+
url: e,
|
|
3061
|
+
data: t,
|
|
3062
|
+
atlasKey: n,
|
|
3063
|
+
highQuality: r
|
|
3064
|
+
}, [t]);
|
|
3065
|
+
}
|
|
3066
|
+
async unloadFont(e) {
|
|
3067
|
+
return this._send("unloadFont", { url: e });
|
|
3068
|
+
}
|
|
3069
|
+
retainGlyphs(e, t) {
|
|
3070
|
+
this._send("retainGlyphs", {
|
|
3071
|
+
atlasKey: e,
|
|
3072
|
+
keys: t
|
|
3073
|
+
}, [t.buffer]);
|
|
3074
|
+
}
|
|
3075
|
+
releaseGlyphs(e, t) {
|
|
3076
|
+
this._send("releaseGlyphs", {
|
|
3077
|
+
atlasKey: e,
|
|
3078
|
+
keys: t
|
|
3079
|
+
}, [t.buffer]);
|
|
3080
|
+
}
|
|
3081
|
+
async prepareTextBatch(e, t) {
|
|
3082
|
+
let n = await this._send("prepareTextBatch", {
|
|
3083
|
+
fontUrl: e,
|
|
3084
|
+
texts: t
|
|
3085
|
+
}), r = (e) => e ? {
|
|
3086
|
+
data: new Uint8Array(e.data),
|
|
3087
|
+
width: e.width,
|
|
3088
|
+
height: e.height,
|
|
3089
|
+
channels: e.channels
|
|
3090
|
+
} : null;
|
|
3091
|
+
return {
|
|
3092
|
+
results: n.results,
|
|
3093
|
+
atlas: r(n.atlas),
|
|
3094
|
+
colorAtlas: r(n.colorAtlas),
|
|
3095
|
+
atlasKey: n.atlasKey,
|
|
3096
|
+
evicted: n.evicted
|
|
3097
|
+
};
|
|
3098
|
+
}
|
|
3099
|
+
async getMemoryStats() {
|
|
3100
|
+
return this._send("getMemoryStats", void 0);
|
|
3101
|
+
}
|
|
3102
|
+
dispose() {
|
|
3103
|
+
this._worker.terminate();
|
|
3104
|
+
for (let e of this._pending.values()) e.reject(/* @__PURE__ */ Error("FontWorkerClient disposed"));
|
|
3105
|
+
this._pending.clear(), this._concurrencyManager.decrement();
|
|
3106
|
+
}
|
|
3107
|
+
_send(e, t, n) {
|
|
3108
|
+
let r = this._nextId++;
|
|
3109
|
+
return new Promise((i, a) => {
|
|
3110
|
+
this._pending.set(r, {
|
|
3111
|
+
resolve: i,
|
|
3112
|
+
reject: a
|
|
3113
|
+
}), this._worker.postMessage({
|
|
3114
|
+
id: r,
|
|
3115
|
+
type: e,
|
|
3116
|
+
payload: t
|
|
3117
|
+
}, n ?? []);
|
|
3118
|
+
});
|
|
3119
|
+
}
|
|
3120
|
+
}, St = class {
|
|
3121
|
+
_map = /* @__PURE__ */ new Map();
|
|
3122
|
+
_maxSize;
|
|
3123
|
+
constructor(e) {
|
|
3124
|
+
this._maxSize = e;
|
|
3125
|
+
}
|
|
3126
|
+
get size() {
|
|
3127
|
+
return this._map.size;
|
|
3128
|
+
}
|
|
3129
|
+
has(e) {
|
|
3130
|
+
return this._map.has(e);
|
|
3131
|
+
}
|
|
3132
|
+
get(e) {
|
|
3133
|
+
let t = this._map.get(e);
|
|
3134
|
+
return t !== void 0 && (this._map.delete(e), this._map.set(e, t)), t;
|
|
3135
|
+
}
|
|
3136
|
+
set(e, t) {
|
|
3137
|
+
for (this._map.has(e) && this._map.delete(e), this._map.set(e, t); this._map.size > this._maxSize;) {
|
|
3138
|
+
let e = this._map.keys().next();
|
|
3139
|
+
e.done || this._map.delete(e.value);
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3142
|
+
delete(e) {
|
|
3143
|
+
return this._map.delete(e);
|
|
3144
|
+
}
|
|
3145
|
+
clear() {
|
|
3146
|
+
this._map.clear();
|
|
3147
|
+
}
|
|
3148
|
+
}, $ = (e, t) => `${e}#q=${t}`;
|
|
3149
|
+
function Ct(e, t, n, r) {
|
|
3150
|
+
return Tt(e, t, n, r === 4 ? g : _, "");
|
|
3151
|
+
}
|
|
3152
|
+
function wt(e, t, n) {
|
|
3153
|
+
return Tt(e, t, n, g, T);
|
|
3154
|
+
}
|
|
3155
|
+
function Tt(e, t, n, r, i) {
|
|
3156
|
+
let a = new Je(e, t, n, r, h);
|
|
3157
|
+
return a.minFilter = p, a.magFilter = p, a.generateMipmaps = !1, a.colorSpace = i, a.needsUpdate = !0, a;
|
|
3158
|
+
}
|
|
3159
|
+
var Et = 1e4, Dt = (e) => {
|
|
3160
|
+
let t = [];
|
|
3161
|
+
for (let n = 0; n + 1 < e.length; n += 2) t.push({
|
|
3162
|
+
from: e[n],
|
|
3163
|
+
to: e[n + 1]
|
|
3164
|
+
});
|
|
3165
|
+
return t;
|
|
3166
|
+
}, Ot = class {
|
|
3167
|
+
_workerUrl;
|
|
3168
|
+
_client;
|
|
3169
|
+
_clientPromise;
|
|
3170
|
+
_concurrencyManager;
|
|
3171
|
+
_fontBudgetBytes;
|
|
3172
|
+
_pending = /* @__PURE__ */ new Map();
|
|
3173
|
+
_loaded = /* @__PURE__ */ new Set();
|
|
3174
|
+
_shapeCache = /* @__PURE__ */ new Map();
|
|
3175
|
+
_atlasCache = /* @__PURE__ */ new Map();
|
|
3176
|
+
_colorAtlasCache = /* @__PURE__ */ new Map();
|
|
3177
|
+
_atlasDirty = /* @__PURE__ */ new Set();
|
|
3178
|
+
_colorAtlasDirty = /* @__PURE__ */ new Set();
|
|
3179
|
+
_textureCache = /* @__PURE__ */ new Map();
|
|
3180
|
+
_colorTextureCache = /* @__PURE__ */ new Map();
|
|
3181
|
+
_preparePending = /* @__PURE__ */ new Map();
|
|
3182
|
+
_batchQueue = /* @__PURE__ */ new Map();
|
|
3183
|
+
_batchScheduled = !1;
|
|
3184
|
+
_refCount = /* @__PURE__ */ new Map();
|
|
3185
|
+
_families = /* @__PURE__ */ new Map();
|
|
3186
|
+
_cmapRanges = /* @__PURE__ */ new Map();
|
|
3187
|
+
_atlasKeys = /* @__PURE__ */ new Map();
|
|
3188
|
+
_atlasGeneration = /* @__PURE__ */ new Map();
|
|
3189
|
+
_evictListeners = /* @__PURE__ */ new Map();
|
|
3190
|
+
_pendingEvictNotify = /* @__PURE__ */ new Set();
|
|
3191
|
+
_evictNotifyScheduled = !1;
|
|
3192
|
+
_retainQueue = /* @__PURE__ */ new Map();
|
|
3193
|
+
_releaseQueue = /* @__PURE__ */ new Map();
|
|
3194
|
+
_refFlushScheduled = !1;
|
|
3195
|
+
constructor(e) {
|
|
3196
|
+
this._workerUrl = e;
|
|
3197
|
+
}
|
|
3198
|
+
setConcurrencyManager(e) {
|
|
3199
|
+
this._concurrencyManager = e;
|
|
3200
|
+
}
|
|
3201
|
+
registerFontFamily(e) {
|
|
3202
|
+
this._families.set(e.family, {
|
|
3203
|
+
family: e.family,
|
|
3204
|
+
faces: e.faces.map((e) => ({
|
|
3205
|
+
url: e.url,
|
|
3206
|
+
unicodeRanges: this._cmapRanges.get(e.url) ?? e.unicodeRanges
|
|
3207
|
+
}))
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
unregisterFontFamily(e) {
|
|
3211
|
+
this._families.delete(e);
|
|
3212
|
+
}
|
|
3213
|
+
isFamily(e) {
|
|
3214
|
+
return this._families.has(e);
|
|
3215
|
+
}
|
|
3216
|
+
_segmentTextByFace(e, t) {
|
|
3217
|
+
if (e.length === 0) throw Error("FontManager: font family has no faces");
|
|
3218
|
+
if (e.length === 1) return [{
|
|
3219
|
+
url: e[0].url,
|
|
3220
|
+
text: t
|
|
3221
|
+
}];
|
|
3222
|
+
let n = [], r = "", i = "";
|
|
3223
|
+
for (let a of t) {
|
|
3224
|
+
let t = a === " " && r ? r : this._findFaceForCodepoint(e, a.codePointAt(0) ?? 0);
|
|
3225
|
+
t === r ? i += a : (i && n.push({
|
|
3226
|
+
url: r,
|
|
3227
|
+
text: i
|
|
3228
|
+
}), r = t, i = a);
|
|
3229
|
+
}
|
|
3230
|
+
return i && n.push({
|
|
3231
|
+
url: r,
|
|
3232
|
+
text: i
|
|
3233
|
+
}), n;
|
|
3234
|
+
}
|
|
3235
|
+
_findFaceForCodepoint(e, t) {
|
|
3236
|
+
for (let n of e) for (let e of n.unicodeRanges) if (t >= e.from && t <= e.to) return n.url;
|
|
3237
|
+
return e[0].url;
|
|
3238
|
+
}
|
|
3239
|
+
_applyCmapRanges(e) {
|
|
3240
|
+
let t = this._cmapRanges.get(e);
|
|
3241
|
+
if (t) for (let n of this._families.values()) for (let r of n.faces) r.url === e && (r.unicodeRanges = t);
|
|
3242
|
+
}
|
|
3243
|
+
_ensureClient() {
|
|
3244
|
+
if (this._client) return Promise.resolve(this._client);
|
|
3245
|
+
if (this._clientPromise) return this._clientPromise;
|
|
3246
|
+
if (!this._concurrencyManager) return Promise.reject(/* @__PURE__ */ Error("FontManager: concurrencyManager not set"));
|
|
3247
|
+
let e = this._concurrencyManager;
|
|
3248
|
+
return this._clientPromise = (async () => {
|
|
3249
|
+
let t = new xt(this._workerUrl, e, { fontBudgetBytes: this._fontBudgetBytes });
|
|
3250
|
+
return await t.ready(), this._client = t, t;
|
|
3251
|
+
})(), this._clientPromise.catch(() => {
|
|
3252
|
+
this._clientPromise = void 0;
|
|
3253
|
+
}), this._clientPromise;
|
|
3254
|
+
}
|
|
3255
|
+
setMemoryBudget(e) {
|
|
3256
|
+
this._fontBudgetBytes = e;
|
|
3257
|
+
}
|
|
3258
|
+
async memoryStats() {
|
|
3259
|
+
return this._client?.getMemoryStats();
|
|
3260
|
+
}
|
|
3261
|
+
async loadFont(e, t, n) {
|
|
3262
|
+
let r = $(e, t);
|
|
3263
|
+
if (this._loaded.has(r)) {
|
|
3264
|
+
this._refCount.set(r, (this._refCount.get(r) ?? 0) + 1);
|
|
3265
|
+
return;
|
|
3266
|
+
}
|
|
3267
|
+
if (this._pending.has(r)) return this._refCount.set(r, (this._refCount.get(r) ?? 0) + 1), this._pending.get(r);
|
|
3268
|
+
let i = n ? $(n, t) : void 0, a = this._fetchAndLoad(e, r, i, t);
|
|
3269
|
+
this._refCount.set(r, 1), this._pending.set(r, a), this._shapeCache.set(r, new St(Et));
|
|
3270
|
+
try {
|
|
3271
|
+
await a, this._loaded.add(r), this._atlasKeys.set(r, i ?? r);
|
|
3272
|
+
} catch (e) {
|
|
3273
|
+
throw this._refCount.delete(r), this._shapeCache.delete(r), e;
|
|
3274
|
+
} finally {
|
|
3275
|
+
this._pending.delete(r);
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
async unloadFont(e, t) {
|
|
3279
|
+
let n = $(e, t), r = this._refCount.get(n);
|
|
3280
|
+
if (!r) return;
|
|
3281
|
+
if (r > 1) {
|
|
3282
|
+
this._refCount.set(n, r - 1);
|
|
3283
|
+
return;
|
|
3284
|
+
}
|
|
3285
|
+
let i = this._atlasKeys.get(n) ?? n;
|
|
3286
|
+
this._loaded.delete(n), this._refCount.delete(n), this._shapeCache.delete(n), this._atlasKeys.delete(n), [...this._atlasKeys.values()].includes(i) || (this._shapeCache.delete(i), this._atlasCache.delete(i), this._atlasDirty.delete(i), this._colorAtlasCache.delete(i), this._colorAtlasDirty.delete(i), this._atlasGeneration.delete(i), this._textureCache.get(i)?.dispose(), this._textureCache.delete(i), this._colorTextureCache.get(i)?.dispose(), this._colorTextureCache.delete(i)), this._client && ((await this._client.unloadFont(n)).ok || console.warn(`Failed to unload font "${e}" (${t}) in worker`));
|
|
3287
|
+
}
|
|
3288
|
+
async prepareText(e, t, n, r) {
|
|
3289
|
+
if (!t) return;
|
|
3290
|
+
let i = this._families.get(e);
|
|
3291
|
+
if (i) {
|
|
3292
|
+
let a = r ?? /* @__PURE__ */ new Set(), o = i.faces.length + 1;
|
|
3293
|
+
for (; o-- > 0;) {
|
|
3294
|
+
let r = this._segmentTextByFace(i.faces, t), o = [...new Set(r.map((e) => e.url))].filter((e) => !a.has(e));
|
|
3295
|
+
if (o.length === 0) break;
|
|
3296
|
+
await Promise.all(o.map(async (t) => {
|
|
3297
|
+
await this.loadFont(t, n, e), a.add(t);
|
|
3298
|
+
}));
|
|
3299
|
+
}
|
|
3300
|
+
return this._prepareFamilyText(e, i, t, n);
|
|
3301
|
+
}
|
|
3302
|
+
return this._prepareSingleFontText(e, t, n);
|
|
3303
|
+
}
|
|
3304
|
+
isTextPrepared(e, t, n) {
|
|
3305
|
+
return this._isPreparedFresh($(e, n), t, this._resolveAtlasKey(e, n));
|
|
3306
|
+
}
|
|
3307
|
+
shapeText(e, t, n) {
|
|
3308
|
+
return this._shapeCache.get($(e, n))?.get(t);
|
|
3309
|
+
}
|
|
3310
|
+
async _prepareSingleFontText(e, t, n) {
|
|
3311
|
+
let r = $(e, n), i = this._cacheKey(r, t);
|
|
3312
|
+
if (this._isPreparedFresh(r, t, this._resolveAtlasKey(e, n))) return;
|
|
3313
|
+
if (this._preparePending.has(i)) return this._preparePending.get(i);
|
|
3314
|
+
let a = new Promise((e, n) => {
|
|
3315
|
+
let a = this._batchQueue.get(r);
|
|
3316
|
+
a || (a = [], this._batchQueue.set(r, a)), a.push({
|
|
3317
|
+
text: t,
|
|
3318
|
+
cacheKey: i,
|
|
3319
|
+
resolve: e,
|
|
3320
|
+
reject: n
|
|
3321
|
+
});
|
|
3322
|
+
});
|
|
3323
|
+
this._preparePending.set(i, a), this._batchScheduled || (this._batchScheduled = !0, queueMicrotask(() => this._flushBatch()));
|
|
3324
|
+
try {
|
|
3325
|
+
await a;
|
|
3326
|
+
} finally {
|
|
3327
|
+
this._preparePending.delete(i);
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
async _prepareFamilyText(e, t, n, r) {
|
|
3331
|
+
let i = $(e, r);
|
|
3332
|
+
if (this._isPreparedFresh(i, n, i)) return;
|
|
3333
|
+
let a = this._cacheKey(i, n);
|
|
3334
|
+
if (this._preparePending.has(a)) return this._preparePending.get(a);
|
|
3335
|
+
let o = (async () => {
|
|
3336
|
+
let e = this._segmentTextByFace(t.faces, n);
|
|
3337
|
+
await Promise.all(e.map((e) => this._prepareSingleFontText(e.url, e.text, r)));
|
|
3338
|
+
let a = this._stitchSegments(e, r), o = this._shapeCache.get(i);
|
|
3339
|
+
o || (o = new St(Et), this._shapeCache.set(i, o)), a._generation = this._currentGen(i), o.set(n, a);
|
|
3340
|
+
})();
|
|
3341
|
+
this._preparePending.set(a, o);
|
|
3342
|
+
try {
|
|
3343
|
+
await o;
|
|
3344
|
+
} finally {
|
|
3345
|
+
this._preparePending.delete(a);
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
_stitchSegments(e, t) {
|
|
3349
|
+
let n = [], r = /* @__PURE__ */ new Map(), i = 0, a = 0, o = 0, s = 0;
|
|
3350
|
+
for (let c of e) {
|
|
3351
|
+
let e = this._shapeCache.get($(c.url, t))?.get(c.text);
|
|
3352
|
+
if (!e) continue;
|
|
3353
|
+
i === 0 && (i = e.unitsPerEm, a = e.ascender, o = e.descender, s = e.lineGap);
|
|
3354
|
+
let l = i / e.unitsPerEm;
|
|
3355
|
+
for (let t of e.glyphs) n.push(l === 1 ? t : {
|
|
3356
|
+
...t,
|
|
3357
|
+
xAdvance: t.xAdvance * l,
|
|
3358
|
+
yAdvance: t.yAdvance * l,
|
|
3359
|
+
xOffset: t.xOffset * l,
|
|
3360
|
+
yOffset: t.yOffset * l
|
|
3361
|
+
});
|
|
3362
|
+
for (let t of e.metrics) {
|
|
3363
|
+
let e = `${t.fontIndex}:${t.glyphId}`;
|
|
3364
|
+
r.has(e) || r.set(e, t);
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
return i === 0 ? {
|
|
3368
|
+
glyphs: [],
|
|
3369
|
+
metrics: [],
|
|
3370
|
+
unitsPerEm: 1e3,
|
|
3371
|
+
ascender: 800,
|
|
3372
|
+
descender: -200,
|
|
3373
|
+
lineGap: 0
|
|
3374
|
+
} : {
|
|
3375
|
+
glyphs: n,
|
|
3376
|
+
metrics: [...r.values()],
|
|
3377
|
+
unitsPerEm: i,
|
|
3378
|
+
ascender: a,
|
|
3379
|
+
descender: o,
|
|
3380
|
+
lineGap: s
|
|
3381
|
+
};
|
|
3382
|
+
}
|
|
3383
|
+
getAtlas(e, t) {
|
|
3384
|
+
let n = this._resolveAtlasKey(e, t);
|
|
3385
|
+
return this._atlasCache.get(n);
|
|
3386
|
+
}
|
|
3387
|
+
getAtlasTexture(e, t) {
|
|
3388
|
+
return this._getOrUpdateTexture(this._resolveAtlasKey(e, t), this._atlasCache, this._atlasDirty, this._textureCache, (e) => Ct(e.data, e.width, e.height, e.channels));
|
|
3389
|
+
}
|
|
3390
|
+
getColorAtlas(e, t) {
|
|
3391
|
+
let n = this._resolveAtlasKey(e, t);
|
|
3392
|
+
return this._colorAtlasCache.get(n);
|
|
3393
|
+
}
|
|
3394
|
+
getColorAtlasTexture(e, t) {
|
|
3395
|
+
return this._getOrUpdateTexture(this._resolveAtlasKey(e, t), this._colorAtlasCache, this._colorAtlasDirty, this._colorTextureCache, (e) => wt(e.data, e.width, e.height));
|
|
3396
|
+
}
|
|
3397
|
+
_getOrUpdateTexture(e, t, n, r, i) {
|
|
3398
|
+
if (!n.has(e)) {
|
|
3399
|
+
let t = r.get(e);
|
|
3400
|
+
if (t) return t;
|
|
3401
|
+
}
|
|
3402
|
+
let a = t.get(e);
|
|
3403
|
+
if (!a) return null;
|
|
3404
|
+
n.delete(e);
|
|
3405
|
+
let o = r.get(e);
|
|
3406
|
+
if (o) return (o.image?.width !== a.width || o.image?.height !== a.height) && o.dispose(), o.image = {
|
|
3407
|
+
data: a.data,
|
|
3408
|
+
width: a.width,
|
|
3409
|
+
height: a.height
|
|
3410
|
+
}, o.needsUpdate = !0, o;
|
|
3411
|
+
let s = i(a);
|
|
3412
|
+
return r.set(e, s), s;
|
|
3413
|
+
}
|
|
3414
|
+
dispose() {
|
|
3415
|
+
for (let e of this._textureCache.values()) e.dispose();
|
|
3416
|
+
for (let e of this._colorTextureCache.values()) e.dispose();
|
|
3417
|
+
this._pending.clear(), this._preparePending.clear(), this._loaded.clear(), this._refCount.clear(), this._shapeCache.clear(), this._atlasGeneration.clear(), this._retainQueue.clear(), this._releaseQueue.clear(), this._refFlushScheduled = !1, this._atlasCache.clear(), this._atlasDirty.clear(), this._colorAtlasCache.clear(), this._colorAtlasDirty.clear(), this._textureCache.clear(), this._colorTextureCache.clear(), this._families.clear(), this._atlasKeys.clear(), this._client?.dispose(), this._client = void 0;
|
|
3418
|
+
}
|
|
3419
|
+
_cacheKey(e, t) {
|
|
3420
|
+
return e + "\0" + t;
|
|
3421
|
+
}
|
|
3422
|
+
_currentGen(e) {
|
|
3423
|
+
return this._atlasGeneration.get(e) ?? 0;
|
|
3424
|
+
}
|
|
3425
|
+
_isPreparedFresh(e, t, n) {
|
|
3426
|
+
let r = this._shapeCache.get(e)?.get(t);
|
|
3427
|
+
return !!r && (r._generation ?? 0) === this._currentGen(n);
|
|
3428
|
+
}
|
|
3429
|
+
onAtlasEvicted(e, t, n) {
|
|
3430
|
+
let r = this._resolveAtlasKey(e, t), i = this._evictListeners.get(r);
|
|
3431
|
+
return i || (i = /* @__PURE__ */ new Set(), this._evictListeners.set(r, i)), i.add(n), () => {
|
|
3432
|
+
let e = this._evictListeners.get(r);
|
|
3433
|
+
e && (e.delete(n), e.size === 0 && this._evictListeners.delete(r));
|
|
3434
|
+
};
|
|
3435
|
+
}
|
|
3436
|
+
_scheduleEvictNotify(e) {
|
|
3437
|
+
this._evictListeners.has(e) && (this._pendingEvictNotify.add(e), !this._evictNotifyScheduled && (this._evictNotifyScheduled = !0, queueMicrotask(() => this._flushEvictNotify())));
|
|
3438
|
+
}
|
|
3439
|
+
_flushEvictNotify() {
|
|
3440
|
+
this._evictNotifyScheduled = !1;
|
|
3441
|
+
let e = this._pendingEvictNotify;
|
|
3442
|
+
this._pendingEvictNotify = /* @__PURE__ */ new Set();
|
|
3443
|
+
for (let t of e) {
|
|
3444
|
+
let e = this._evictListeners.get(t);
|
|
3445
|
+
if (e) for (let t of [...e]) t();
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
retainGlyphs(e, t, n) {
|
|
3449
|
+
if (n.length === 0) return;
|
|
3450
|
+
let r = this._resolveAtlasKey(e, t);
|
|
3451
|
+
this._enqueueRef(this._retainQueue, r, n);
|
|
3452
|
+
}
|
|
3453
|
+
releaseGlyphs(e, t, n) {
|
|
3454
|
+
if (n.length === 0) return;
|
|
3455
|
+
let r = this._resolveAtlasKey(e, t);
|
|
3456
|
+
this._enqueueRef(this._releaseQueue, r, n);
|
|
3457
|
+
}
|
|
3458
|
+
_enqueueRef(e, t, n) {
|
|
3459
|
+
let r = e.get(t);
|
|
3460
|
+
r || (r = [], e.set(t, r));
|
|
3461
|
+
for (let e of n) r.push(e);
|
|
3462
|
+
this._refFlushScheduled || (this._refFlushScheduled = !0, queueMicrotask(() => this._flushRefs()));
|
|
3463
|
+
}
|
|
3464
|
+
_flushRefs() {
|
|
3465
|
+
this._refFlushScheduled = !1;
|
|
3466
|
+
let e = this._retainQueue, t = this._releaseQueue;
|
|
3467
|
+
this._retainQueue = /* @__PURE__ */ new Map(), this._releaseQueue = /* @__PURE__ */ new Map();
|
|
3468
|
+
let n = this._client;
|
|
3469
|
+
if (n) {
|
|
3470
|
+
for (let [t, r] of e) r.length > 0 && n.retainGlyphs(t, BigUint64Array.from(r));
|
|
3471
|
+
for (let [e, r] of t) r.length > 0 && n.releaseGlyphs(e, BigUint64Array.from(r));
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
_resolveAtlasKey(e, t) {
|
|
3475
|
+
return this._families.has(e) ? $(e, t) : this._atlasKeys.get($(e, t)) ?? $(e, t);
|
|
3476
|
+
}
|
|
3477
|
+
async _fetchAndLoad(e, t, n, r) {
|
|
3478
|
+
let i = await this._ensureClient(), a = await fetch(e);
|
|
3479
|
+
if (!a.ok) throw Error(`FontManager: failed to fetch font from ${e}: ${a.status}`);
|
|
3480
|
+
let o = await a.arrayBuffer(), s = await i.loadFont(t, o, n, r);
|
|
3481
|
+
if (!s.ok) throw Error(`FontManager: WASM failed to load font from ${e}`);
|
|
3482
|
+
s.cmapRanges?.length && !this._cmapRanges.has(e) && (this._cmapRanges.set(e, Dt(s.cmapRanges)), this._applyCmapRanges(e));
|
|
3483
|
+
}
|
|
3484
|
+
async _flushBatch() {
|
|
3485
|
+
this._batchScheduled = !1;
|
|
3486
|
+
let e = this._batchQueue;
|
|
3487
|
+
this._batchQueue = /* @__PURE__ */ new Map();
|
|
3488
|
+
let t;
|
|
3489
|
+
try {
|
|
3490
|
+
t = await this._ensureClient();
|
|
3491
|
+
} catch (t) {
|
|
3492
|
+
for (let [, n] of e) for (let e of n) e.reject(t);
|
|
3493
|
+
return;
|
|
3494
|
+
}
|
|
3495
|
+
let n = async (e, n) => {
|
|
3496
|
+
let r = n.map((e) => e.text);
|
|
3497
|
+
try {
|
|
3498
|
+
let i = await t.prepareTextBatch(e, r), a = i.atlasKey;
|
|
3499
|
+
i.evicted && (this._atlasGeneration.set(a, this._currentGen(a) + 1), this._scheduleEvictNotify(a));
|
|
3500
|
+
let o = this._currentGen(a);
|
|
3501
|
+
for (let t of i.results) t.shapeResult && (t.shapeResult._generation = o, this._shapeCache.get(e)?.set(t.text, t.shapeResult));
|
|
3502
|
+
i.atlas && (this._atlasCache.set(a, i.atlas), this._atlasDirty.add(a)), i.colorAtlas && (this._colorAtlasCache.set(a, i.colorAtlas), this._colorAtlasDirty.add(a));
|
|
3503
|
+
for (let e of n) e.resolve();
|
|
3504
|
+
} catch (e) {
|
|
3505
|
+
for (let t of n) t.reject(e);
|
|
3506
|
+
}
|
|
3507
|
+
};
|
|
3508
|
+
await Promise.all([...e].map(([e, t]) => n(e, t)));
|
|
3509
|
+
}
|
|
3510
|
+
}, kt = 64, At = (e) => e ? 8 : 35, jt = {
|
|
3511
|
+
Normal: 0,
|
|
3512
|
+
Whitespace: 1,
|
|
3513
|
+
Newline: 2,
|
|
3514
|
+
Ideographic: 3
|
|
3515
|
+
};
|
|
3516
|
+
//#endregion
|
|
3517
|
+
export { kt as COLOR_GLYPH_PX_SIZE, Ot as FontManager, xt as FontWorkerClient, jt as GlyphCharClass, St as LRUMap, At as atlasRangePx, wt as createColorAtlasTexture, Ct as createSdfAtlasTexture, c as fetchFontFamilyFromCss, e as parseCssUnicodeRange, s as parseFontFamilyFromCss };
|