three-mediapipe-rig 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -4
- package/dist/meshcap/atlas-builder.d.ts +9 -0
- package/dist/meshcap/atlas-builder.d.ts.map +1 -1
- package/dist/meshcap/audio.d.ts +27 -0
- package/dist/meshcap/audio.d.ts.map +1 -0
- package/dist/meshcap/constants.d.ts +8 -1
- package/dist/meshcap/constants.d.ts.map +1 -1
- package/dist/meshcap/material.d.ts +40 -6
- package/dist/meshcap/material.d.ts.map +1 -1
- package/dist/meshcap/meshcap.d.ts +1 -0
- package/dist/meshcap/meshcap.d.ts.map +1 -1
- package/dist/meshcap/parse-mcap-file.d.ts +2 -1
- package/dist/meshcap/parse-mcap-file.d.ts.map +1 -1
- package/dist/meshcap/types.d.ts +59 -9
- package/dist/meshcap/types.d.ts.map +1 -1
- package/dist/meshcap/write-mcap-file.d.ts +13 -0
- package/dist/meshcap/write-mcap-file.d.ts.map +1 -1
- package/dist/meshcap.js +527 -271
- package/dist/rigger.js +440 -392
- package/dist/tracking/FaceTracker.d.ts +9 -2
- package/dist/tracking/FaceTracker.d.ts.map +1 -1
- package/dist/tracking/PoseTracker.d.ts +3 -0
- package/dist/tracking/PoseTracker.d.ts.map +1 -1
- package/dist/tracking/TrackerManager.d.ts +16 -7
- package/dist/tracking/TrackerManager.d.ts.map +1 -1
- package/dist/tracking/recoding/recorder.d.ts +1 -1
- package/dist/tracking/recoding/recorder.d.ts.map +1 -1
- package/package.json +11 -10
package/dist/meshcap.js
CHANGED
|
@@ -1,316 +1,572 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { instancedArray as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
1
|
+
import { MeshPhysicalNodeMaterial as Lt, Vector3 as _, Matrix4 as Bt } from "three/webgpu";
|
|
2
|
+
import { deflate as St, inflate as Tt } from "fflate";
|
|
3
|
+
import { c as Vt, F as $ } from "./face-tracker-utils-xt9__vBF.js";
|
|
4
|
+
import { instancedArray as K, texture as mt, uniform as tt, attribute as zt, varying as Ft, vec3 as Et, float as Pt, select as Ot, positionLocal as jt } from "three/tsl";
|
|
5
|
+
import { TextureLoader as pt, Texture as Nt } from "three";
|
|
6
|
+
const wt = 1296253264, Wt = 3;
|
|
7
|
+
async function Dt(o) {
|
|
8
|
+
if (o instanceof ArrayBuffer)
|
|
9
|
+
return o;
|
|
10
|
+
if (o instanceof File || o instanceof Blob)
|
|
11
|
+
return o.arrayBuffer();
|
|
12
|
+
if (typeof o == "string")
|
|
13
|
+
return (await fetch(o)).arrayBuffer();
|
|
14
|
+
throw new Error(`Unsupported audio source type: ${typeof o}`);
|
|
15
|
+
}
|
|
16
|
+
async function Xt(o, s) {
|
|
17
|
+
const a = new AudioContext(), i = await Dt(o), n = await a.decodeAudioData(i);
|
|
18
|
+
for (const t of s) {
|
|
19
|
+
if (!t.audioSprite)
|
|
20
|
+
continue;
|
|
21
|
+
const g = Math.floor(t.audioSprite.start * n.sampleRate), m = Math.floor(t.duration * n.sampleRate), l = a.createBuffer(
|
|
22
|
+
n.numberOfChannels,
|
|
23
|
+
m,
|
|
24
|
+
n.sampleRate
|
|
25
|
+
);
|
|
26
|
+
for (let r = 0; r < n.numberOfChannels; r++) {
|
|
27
|
+
const e = n.getChannelData(r).subarray(g, g + m);
|
|
28
|
+
l.getChannelData(r).set(e);
|
|
29
|
+
}
|
|
30
|
+
const A = Ht(l), M = new Blob([A], { type: "audio/wav" }), x = URL.createObjectURL(M), f = new Audio(x);
|
|
31
|
+
t.audioSprite.domElement = f, console.log("Assigned audio to clip: ", t.name, " at ", t.audioSprite.start, " for ", t.duration, " seconds");
|
|
32
|
+
}
|
|
33
|
+
return a.close(), {
|
|
34
|
+
blob: new Blob([i], { type: "audio/wav" }),
|
|
35
|
+
sprites: s.map((t) => t.audioSprite ? [t.audioSprite.start, t.duration] : void 0)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function Ht(o) {
|
|
39
|
+
const s = o.numberOfChannels, a = o.sampleRate, i = o.length * s * 2, n = new ArrayBuffer(44 + i), t = new DataView(n), g = (l, A) => [...A].forEach((M, x) => t.setUint8(l + x, M.charCodeAt(0)));
|
|
40
|
+
g(0, "RIFF"), t.setUint32(4, 36 + i, !0), g(8, "WAVE"), g(12, "fmt "), t.setUint32(16, 16, !0), t.setUint16(20, 1, !0), t.setUint16(22, s, !0), t.setUint32(24, a, !0), t.setUint32(28, a * s * 2, !0), t.setUint16(32, s * 2, !0), t.setUint16(34, 16, !0), g(36, "data"), t.setUint32(40, i, !0);
|
|
41
|
+
let m = 44;
|
|
42
|
+
for (let l = 0; l < o.length; l++)
|
|
43
|
+
for (let A = 0; A < s; A++) {
|
|
44
|
+
const M = Math.max(-1, Math.min(1, o.getChannelData(A)[l]));
|
|
45
|
+
t.setInt16(m, M * 32767, !0), m += 2;
|
|
46
|
+
}
|
|
47
|
+
return n;
|
|
48
|
+
}
|
|
49
|
+
const ht = /* @__PURE__ */ new WeakMap();
|
|
50
|
+
function Yt(o, s) {
|
|
51
|
+
const a = ht.get(o) || new AudioContext();
|
|
52
|
+
ht.set(o, a);
|
|
53
|
+
const i = a.createGain();
|
|
54
|
+
i.connect(a.destination), i.gain.value = 1;
|
|
55
|
+
let n;
|
|
56
|
+
return {
|
|
57
|
+
stopCurrent() {
|
|
58
|
+
n && (n.stop(), n = void 0);
|
|
59
|
+
},
|
|
60
|
+
setVolume(t) {
|
|
61
|
+
i.gain.value = t;
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* @param clipIndex Index of the clip to play
|
|
65
|
+
* @returns The audio buffer source node that is playing the audio.
|
|
66
|
+
*/
|
|
67
|
+
playSprite(t) {
|
|
68
|
+
this.stopCurrent();
|
|
69
|
+
const g = s[t];
|
|
70
|
+
if (!g.audioSprite) return;
|
|
71
|
+
const m = a.createBufferSource();
|
|
72
|
+
return m.buffer = o, m.connect(i), m.start(0, g.audioSprite.start, g.duration), n = m, m;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function qt(o, s, a, i, n) {
|
|
77
|
+
const t = !i;
|
|
78
|
+
i ?? (i = new Lt()), t && (a.material = i), a.geometry.hasAttribute("landmarkIndex") || Vt(a);
|
|
79
|
+
const g = [], m = [], l = [];
|
|
80
|
+
let A = 0, M = 0;
|
|
81
|
+
for (let y = 0; y < s.length; y++) {
|
|
82
|
+
const v = s[y];
|
|
83
|
+
g.push(A, M, v.frames.length, v.fps), A += v.frames.length, M += v.frames.length * $, m.push(v.aspectRatio), l.push(y == 0 ? 0 : l[y - 1] + s[y - 1].frames.length);
|
|
84
|
+
}
|
|
85
|
+
const x = K(new Float32Array(m), "float"), f = K(new Uint32Array(g), "uvec4"), r = new Float32Array(s.flatMap((y) => y.frames).reduce((y, v) => (y.push(v.frameUV.u, v.frameUV.v, v.frameUV.w, v.frameUV.h), y), [])), e = K(r, "vec4"), c = new Float32Array(s.flatMap((y) => y.frames.flatMap((v) => [v.cropUV.u, v.cropUV.v, v.cropUV.w, v.cropUV.h]))), d = K(c, "vec4"), u = new Float32Array(s.flatMap((y) => y.landmarks.flatMap((v) => v.flatMap((z) => [z.x, z.y, z.z])))), w = K(u, "vec3"), p = mt(o), h = tt(0), U = tt(0), I = tt(!0), b = x.element(h), C = K(new Uint32Array(l), "uint"), k = U, P = C.element(h).add(k), N = e.element(f.element(h).x.add(k)), L = f.element(h).y.add(k.mul($)), W = zt("landmarkIndex", "uint").toUint(), G = L.add(W), D = w.element(G), X = d.element(P), S = D.xy.sub(X.xy).div(X.zw), B = Ft(N.xy.add(S.mul(N.zw))), F = mt(p, B);
|
|
86
|
+
i.colorNode = F;
|
|
87
|
+
const E = w.element(L.add(234)).xy, T = w.element(L.add(93)).xy, yt = w.element(L.add(454)).xy, lt = w.element(L.add(323)).xy, ft = E.sub(T).div(2).add(T), vt = yt.sub(lt).div(2).add(lt).sub(ft).div(2).add(ft), R = a.geometry.attributes.position, et = 116, nt = 346, xt = new _().subVectors(
|
|
88
|
+
new _(R.getX(et), R.getY(et), R.getZ(et)),
|
|
89
|
+
new _(R.getX(nt), R.getY(nt), R.getZ(nt))
|
|
90
|
+
).lengthSq(), ot = 209, at = 429, At = tt(new _().addVectors(
|
|
91
|
+
new _(R.getX(ot), R.getY(ot), R.getZ(ot)),
|
|
92
|
+
new _(R.getX(at), R.getY(at), R.getZ(at))
|
|
93
|
+
).multiplyScalar(0.5)), Mt = tt(xt), bt = w.element(L.add(nt)).sub(w.element(L.add(et))).lengthSq(), Ct = Mt.div(bt).sqrt(), It = D.sub(vt).xzy.mul(Et(1, -1, Pt(1).div(b))).mul(Ct).add(At);
|
|
94
|
+
i.positionNode = Ot(W.toUint().lessThanEqual($), It, jt);
|
|
95
|
+
let J = 0, O = 0, H, Y, rt = s[0].frames, st = !1, q = n ? Yt(n, s) : void 0, dt;
|
|
96
|
+
const V = {
|
|
97
|
+
muted: !1,
|
|
98
|
+
clips: s,
|
|
99
|
+
atlasTexture: o,
|
|
100
|
+
material: i,
|
|
101
|
+
getLastKnownFaceTransform: () => dt,
|
|
102
|
+
goto(y, v = !0, z, Rt = !0) {
|
|
103
|
+
var ut;
|
|
104
|
+
let j = -1;
|
|
105
|
+
if (typeof y == "number")
|
|
106
|
+
j = y;
|
|
107
|
+
else if (j = s.findIndex((kt) => kt.name === y), j === -1)
|
|
108
|
+
throw new Error(`Clip ${y.toString()} not found`);
|
|
109
|
+
I.value = v, U.value = 0, h.value = j;
|
|
110
|
+
const Z = s[j];
|
|
111
|
+
H = Z, rt = Z.frames, J = Z.duration, O = 0, Y = z, st = !0, q && (q.stopCurrent(), Rt && !V.muted && Z.audioSprite && (q.playSprite(j), (ut = V.playClipAudioHook) == null || ut.call(V, j, Z.audioSprite.start, Z.duration)));
|
|
112
|
+
},
|
|
113
|
+
update(y) {
|
|
114
|
+
var v;
|
|
115
|
+
if (st) {
|
|
116
|
+
if (O += y, U.value = Zt(rt, O, U.value), dt = rt[U.value].transformMatrix, I.value)
|
|
117
|
+
O >= J && (O -= J, U.value = 0, V.muted || (q == null || q.playSprite(h.value), H != null && H.audioSprite && ((v = V.playClipAudioHook) == null || v.call(V, h.value, H.audioSprite.start, H.duration))), Y == null || Y(O));
|
|
118
|
+
else if (O >= J) {
|
|
119
|
+
const z = Y;
|
|
120
|
+
Y = void 0, z == null || z(J);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
dispose() {
|
|
125
|
+
o.dispose(), i.dispose();
|
|
126
|
+
},
|
|
127
|
+
gotoAndLoop(y, v) {
|
|
128
|
+
this.goto(y, !0, v);
|
|
129
|
+
},
|
|
130
|
+
gotoAndPlay(y, v) {
|
|
131
|
+
this.goto(y, !1, v);
|
|
132
|
+
},
|
|
133
|
+
gotoAndStop(y, v = 0) {
|
|
134
|
+
this.goto(y, !1, void 0, !1), U.value = v, st = !1;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
return V;
|
|
138
|
+
}
|
|
139
|
+
function Zt(o, s, a) {
|
|
140
|
+
for (; a < o.length - 1 && o[a + 1].startTime <= s; )
|
|
141
|
+
a++;
|
|
142
|
+
return a;
|
|
143
|
+
}
|
|
144
|
+
async function _t(o, s = !0) {
|
|
145
|
+
const a = await Ut(o, s);
|
|
146
|
+
return new Promise((i, n) => {
|
|
147
|
+
St(new Uint8Array(a), { level: 9 }, (t, g) => {
|
|
148
|
+
if (t) return n(t);
|
|
149
|
+
const m = new Blob([g], { type: "application/octet-stream" });
|
|
150
|
+
i(m);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async function Ut(o, s = !0) {
|
|
155
|
+
const a = new TextEncoder(), i = o.clips.length, n = o.clips.map((c) => a.encode(c.name)), t = 9, g = n.reduce((c, d, u) => {
|
|
156
|
+
const w = o.clips[u].frames.length, p = 1 + d.byteLength, h = 2, U = 1, I = 1, b = 1, C = 16;
|
|
157
|
+
let k = $ * 6;
|
|
158
|
+
return c + p + h + U + I + b + (C + k) * w;
|
|
159
|
+
}, 0), m = o.clips.reduce((c, d) => c + 2 + 2, 0), l = o.clips.reduce((c, d) => c + d.frames.length * 2, 0), A = o.clips.reduce((c, d) => c + d.frames.length * 64, 0), x = t + g + m + l + 3 & -4, f = new ArrayBuffer(x + A), r = new DataView(f);
|
|
160
|
+
let e = 0;
|
|
161
|
+
r.setUint32(e, wt), e += 4, r.setUint8(e, Wt), e += 1, r.setUint8(e, o.clips.length), e += 1, r.setUint16(e, o.atlasSize), e += 2, r.setUint8(e, o.padding), e += 1;
|
|
162
|
+
for (let c = 0; c < i; c++) {
|
|
163
|
+
r.setUint8(e, n[c].byteLength), e += 1, new Uint8Array(f, e, n[c].byteLength).set(n[c]), e += n[c].byteLength, r.setUint16(e, o.clips[c].frames.length), e += 2, r.setUint8(e, o.clips[c].fps), e += 1, r.setUint8(e, Math.round(o.clips[c].scale * 100)), e += 1, r.setUint8(e, Math.round(o.clips[c].aspectRatio * 100)), e += 1;
|
|
164
|
+
const d = o.clips[c];
|
|
165
|
+
for (let u = 0; u < d.frames.length; u++) {
|
|
166
|
+
const w = d.frames[u].cropUV, p = d.frames[u].frameUV, h = 1e4;
|
|
167
|
+
r.setUint16(e, Math.round(p.u * h)), e += 2, r.setUint16(e, Math.round(p.v * h)), e += 2, r.setUint16(e, Math.round(p.w * h)), e += 2, r.setUint16(e, Math.round(p.h * h)), e += 2, r.setUint16(e, Math.round(w.u * h)), e += 2, r.setUint16(e, Math.round(w.v * h)), e += 2, r.setUint16(e, Math.round(w.w * h)), e += 2, r.setUint16(e, Math.round(w.h * h)), e += 2;
|
|
168
|
+
const U = d.landmarks[u], I = u > 0 ? d.landmarks[u - 1] : null;
|
|
169
|
+
U.reduce((b, C) => Math.max(b, Math.abs(C.z)), 0);
|
|
170
|
+
for (let b = 0; b < $; b++) {
|
|
171
|
+
const C = Math.round(U[b].x * 1e3), k = Math.round(U[b].y * 1e3), P = Math.round(U[b].z * 1e3);
|
|
172
|
+
if (s)
|
|
173
|
+
if (I === null)
|
|
174
|
+
r.setUint16(e, C), e += 2, r.setUint16(e, k), e += 2, r.setInt16(e, P), e += 2;
|
|
175
|
+
else {
|
|
176
|
+
const N = Math.round(I[b].x * 1e3), L = Math.round(I[b].y * 1e3), W = Math.round(I[b].z * 1e3), G = C - N, D = k - L, X = P - W;
|
|
177
|
+
r.setInt16(e, G), e += 2, r.setInt16(e, D), e += 2, r.setInt16(e, X), e += 2;
|
|
178
|
+
}
|
|
179
|
+
else
|
|
180
|
+
r.setUint16(e, C), e += 2, r.setUint16(e, k), e += 2, r.setInt16(e, P), e += 2;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
for (let c = 0; c < i; c++) {
|
|
185
|
+
const d = o.clips[c];
|
|
186
|
+
r.setUint16(e, Math.round(d.duration * 1e3)), e += 2, d.audioSprite ? r.setUint16(e, Math.round(d.audioSprite.start * 1e3)) : r.setUint16(e, 1), e += 2;
|
|
187
|
+
}
|
|
188
|
+
for (let c = 0; c < i; c++) {
|
|
189
|
+
const d = o.clips[c];
|
|
190
|
+
let u = 0;
|
|
191
|
+
for (const w of d.frames) {
|
|
192
|
+
const p = Math.floor((w.startTime - u) * 1e3);
|
|
193
|
+
r.setUint16(e, p), e += 2, u = w.startTime;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
e = e + 3 & -4;
|
|
197
|
+
for (let c = 0; c < i; c++) {
|
|
198
|
+
const d = o.clips[c];
|
|
199
|
+
for (const u of d.frames)
|
|
200
|
+
u.transformMatrix ? u.transformMatrix.toArray(new Float32Array(f, e, 16)) : new Float32Array(f, e, 16).fill(0), e += 64;
|
|
201
|
+
}
|
|
202
|
+
return f;
|
|
203
|
+
}
|
|
204
|
+
async function ie(o) {
|
|
205
|
+
if (typeof o == "string") {
|
|
206
|
+
const a = await (await fetch(o)).arrayBuffer();
|
|
207
|
+
return it(a);
|
|
10
208
|
} else
|
|
11
|
-
return new Promise((
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
},
|
|
209
|
+
return new Promise((s, a) => {
|
|
210
|
+
const i = new FileReader();
|
|
211
|
+
i.onload = (n) => {
|
|
212
|
+
const t = n.target.result;
|
|
213
|
+
s(it(t));
|
|
214
|
+
}, i.onerror = (n) => {
|
|
215
|
+
a(n);
|
|
216
|
+
}, i.readAsArrayBuffer(o);
|
|
19
217
|
});
|
|
20
218
|
}
|
|
21
|
-
async function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
219
|
+
async function it(o, s = !0) {
|
|
220
|
+
let a = !1;
|
|
221
|
+
const i = s ? await new Promise((f, r) => {
|
|
222
|
+
Tt(new Uint8Array(o), (e, c) => {
|
|
223
|
+
e ? r(e) : f(c);
|
|
25
224
|
});
|
|
26
|
-
})
|
|
27
|
-
let
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
for (let
|
|
40
|
-
const r =
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
for (let
|
|
54
|
-
const k =
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const L =
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
for (let
|
|
72
|
-
if (
|
|
73
|
-
const F =
|
|
74
|
-
|
|
75
|
-
const E =
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
225
|
+
}) : new Uint8Array(o), n = new DataView(i.buffer);
|
|
226
|
+
let t = 0;
|
|
227
|
+
const g = n.getUint32(t);
|
|
228
|
+
if (t += 4, g !== wt) throw new Error("Invalid file: not a MCAP file");
|
|
229
|
+
const m = n.getUint8(t);
|
|
230
|
+
t += 1;
|
|
231
|
+
const l = n.getUint8(t);
|
|
232
|
+
t += 1;
|
|
233
|
+
const A = n.getUint16(t);
|
|
234
|
+
t += 2;
|
|
235
|
+
const M = n.getUint8(t);
|
|
236
|
+
t += 1;
|
|
237
|
+
const x = [];
|
|
238
|
+
for (let f = 0; f < l; f++) {
|
|
239
|
+
const r = n.getUint8(t);
|
|
240
|
+
t += 1;
|
|
241
|
+
const e = new Uint8Array(i.buffer, t, r), c = new TextDecoder().decode(e);
|
|
242
|
+
t += r;
|
|
243
|
+
const d = m >= 3 ? n.getUint16(t) : n.getUint8(t);
|
|
244
|
+
t += m >= 3 ? 2 : 1;
|
|
245
|
+
const u = n.getUint8(t);
|
|
246
|
+
t += 1;
|
|
247
|
+
const w = n.getUint8(t) / 100;
|
|
248
|
+
t += 1;
|
|
249
|
+
const p = n.getUint8(t) / 100;
|
|
250
|
+
t += 1;
|
|
251
|
+
const h = [], U = [], I = [];
|
|
252
|
+
for (let b = 0; b < d; b++) {
|
|
253
|
+
const C = m < 3 ? 1e3 : 1e4, k = n.getUint16(t) / C;
|
|
254
|
+
t += 2;
|
|
255
|
+
const P = n.getUint16(t) / C;
|
|
256
|
+
t += 2;
|
|
257
|
+
const N = n.getUint16(t) / C;
|
|
258
|
+
t += 2;
|
|
259
|
+
const L = n.getUint16(t) / C;
|
|
260
|
+
t += 2, h.push({ u: k, v: P, w: N, h: L });
|
|
261
|
+
const W = n.getUint16(t) / C;
|
|
262
|
+
t += 2;
|
|
263
|
+
const G = n.getUint16(t) / C;
|
|
264
|
+
t += 2;
|
|
265
|
+
const D = n.getUint16(t) / C;
|
|
266
|
+
t += 2;
|
|
267
|
+
const X = n.getUint16(t) / C;
|
|
268
|
+
t += 2, I.push({ u: W, v: G, w: D, h: X });
|
|
269
|
+
const Q = [], S = b > 0 ? U[b - 1] : null;
|
|
270
|
+
for (let B = 0; B < $; B++)
|
|
271
|
+
if (S === null) {
|
|
272
|
+
const F = n.getUint16(t) / 1e3;
|
|
273
|
+
t += 2;
|
|
274
|
+
const E = n.getUint16(t) / 1e3;
|
|
275
|
+
t += 2;
|
|
276
|
+
const T = n.getInt16(t) / 1e3;
|
|
277
|
+
t += 2, Q.push({ x: F, y: E, z: T });
|
|
79
278
|
} else {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
x:
|
|
87
|
-
y:
|
|
88
|
-
z:
|
|
89
|
-
});
|
|
279
|
+
let F, E, T;
|
|
280
|
+
m < 3 ? (F = n.getInt8(t) / 1e3, t += 1, E = n.getInt8(t) / 1e3, t += 1, T = n.getInt8(t) / 1e3, t += 1, Q.push({
|
|
281
|
+
x: S[B].x + F,
|
|
282
|
+
y: S[B].y + E,
|
|
283
|
+
z: S[B].z + T
|
|
284
|
+
})) : (F = n.getInt16(t) / 1e3, t += 2, E = n.getInt16(t) / 1e3, t += 2, T = n.getInt16(t) / 1e3, t += 2, Q.push({
|
|
285
|
+
x: S[B].x + F,
|
|
286
|
+
y: S[B].y + E,
|
|
287
|
+
z: S[B].z + T
|
|
288
|
+
}));
|
|
90
289
|
}
|
|
91
|
-
|
|
290
|
+
U.push(Q);
|
|
92
291
|
}
|
|
93
|
-
|
|
94
|
-
name:
|
|
95
|
-
fps:
|
|
96
|
-
scale:
|
|
97
|
-
aspectRatio:
|
|
98
|
-
frames:
|
|
99
|
-
cropUV:
|
|
100
|
-
frameUV:
|
|
292
|
+
x.push({
|
|
293
|
+
name: c,
|
|
294
|
+
fps: u,
|
|
295
|
+
scale: w,
|
|
296
|
+
aspectRatio: p,
|
|
297
|
+
frames: I.map((b, C) => ({
|
|
298
|
+
cropUV: b,
|
|
299
|
+
frameUV: h[C],
|
|
300
|
+
startTime: C / u
|
|
301
|
+
//<-- default for versions sub 2...
|
|
101
302
|
})),
|
|
102
|
-
landmarks:
|
|
303
|
+
landmarks: U,
|
|
304
|
+
duration: d / u
|
|
305
|
+
// default for versions sub 2...
|
|
103
306
|
});
|
|
104
307
|
}
|
|
308
|
+
if (m >= 2) {
|
|
309
|
+
for (let f = 0; f < x.length; f++) {
|
|
310
|
+
let r = n.getUint16(t);
|
|
311
|
+
t += 2, x[f].duration = r / 1e3;
|
|
312
|
+
let e = n.getUint16(t);
|
|
313
|
+
t += 2, e === 1 ? console.log("Clip " + f + " has no audio") : (e /= 1e3, x[f].audioSprite = { start: e }, a = !0, console.log("MCAP AUDIO CLIP;", e, "Duration: ", r / 1e3));
|
|
314
|
+
}
|
|
315
|
+
for (let f = 0; f < x.length; f++) {
|
|
316
|
+
const r = x[f];
|
|
317
|
+
let e = 0;
|
|
318
|
+
for (let c = 0; c < r.frames.length; c++) {
|
|
319
|
+
const d = m < 3 ? n.getUint8(t) : n.getUint16(t);
|
|
320
|
+
t += m < 3 ? 1 : 2;
|
|
321
|
+
const u = e + d / 1e3;
|
|
322
|
+
r.frames[c].startTime = u, e = u;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (m >= 3) {
|
|
326
|
+
t = t + 3 & -4;
|
|
327
|
+
for (let f = 0; f < x.length; f++) {
|
|
328
|
+
const r = x[f];
|
|
329
|
+
for (let e = 0; e < r.frames.length; e++) {
|
|
330
|
+
const c = new Float32Array(n.buffer, t, 16);
|
|
331
|
+
t += 64, r.frames[e].transformMatrix = new Bt().fromArray(c);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
105
336
|
return {
|
|
106
|
-
clips:
|
|
107
|
-
version:
|
|
108
|
-
atlasSize:
|
|
109
|
-
atlasPadding:
|
|
110
|
-
|
|
111
|
-
let
|
|
112
|
-
if (
|
|
113
|
-
|
|
337
|
+
clips: x,
|
|
338
|
+
version: m,
|
|
339
|
+
atlasSize: A,
|
|
340
|
+
atlasPadding: M,
|
|
341
|
+
async unpackClips(f, r) {
|
|
342
|
+
let e, c = !0, d, u;
|
|
343
|
+
if (f instanceof HTMLCanvasElement)
|
|
344
|
+
c = !1, e = f, u = e.getContext("2d");
|
|
114
345
|
else {
|
|
115
|
-
let
|
|
116
|
-
if (typeof
|
|
117
|
-
|
|
118
|
-
else if (
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
URL.revokeObjectURL(
|
|
123
|
-
},
|
|
346
|
+
let p = new Image();
|
|
347
|
+
if (typeof f == "string")
|
|
348
|
+
p.src = f;
|
|
349
|
+
else if (f instanceof File || f instanceof Blob) {
|
|
350
|
+
const h = URL.createObjectURL(f);
|
|
351
|
+
p.src = h, await new Promise((U, I) => {
|
|
352
|
+
p.onload = () => {
|
|
353
|
+
URL.revokeObjectURL(h), U();
|
|
354
|
+
}, p.onerror = I;
|
|
124
355
|
});
|
|
125
|
-
} else
|
|
126
|
-
(!
|
|
127
|
-
|
|
128
|
-
}),
|
|
356
|
+
} else f instanceof HTMLImageElement && (p = f);
|
|
357
|
+
(!p.complete || !p.naturalWidth) && await new Promise((h, U) => {
|
|
358
|
+
p.onload = () => h(), p.onerror = U;
|
|
359
|
+
}), e = document.createElement("canvas"), e.width = p.width, e.height = p.height, u = e.getContext("2d"), u.drawImage(p, 0, 0);
|
|
129
360
|
}
|
|
130
|
-
const
|
|
131
|
-
...
|
|
132
|
-
frames:
|
|
133
|
-
const
|
|
134
|
-
return
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
361
|
+
const w = x.map((p) => ({
|
|
362
|
+
...p,
|
|
363
|
+
frames: p.frames.map((h) => {
|
|
364
|
+
const U = document.createElement("canvas");
|
|
365
|
+
return U.width = h.frameUV.w * e.width, U.height = h.frameUV.h * e.height, U.getContext("2d").drawImage(
|
|
366
|
+
e,
|
|
367
|
+
h.frameUV.u * e.width,
|
|
368
|
+
h.frameUV.v * e.height,
|
|
369
|
+
h.frameUV.w * e.width,
|
|
370
|
+
h.frameUV.h * e.height,
|
|
140
371
|
0,
|
|
141
372
|
0,
|
|
142
|
-
|
|
143
|
-
|
|
373
|
+
U.width,
|
|
374
|
+
U.height
|
|
144
375
|
), {
|
|
145
|
-
canvas:
|
|
146
|
-
cropUV:
|
|
376
|
+
canvas: U,
|
|
377
|
+
cropUV: h.cropUV,
|
|
378
|
+
startTime: h.startTime
|
|
147
379
|
};
|
|
148
380
|
})
|
|
149
381
|
}));
|
|
150
|
-
return
|
|
382
|
+
return c && e.remove(), a && (r ? d = await Xt(r, w) : console.warn("This mcap file uses an audio atlas, but no audio atlas file was provided.")), {
|
|
383
|
+
clips: w,
|
|
384
|
+
audioAtlas: d
|
|
385
|
+
};
|
|
386
|
+
},
|
|
387
|
+
createMaterialHandlerOnMesh(f, r, e, c) {
|
|
388
|
+
return qt(r, x, f, e, c);
|
|
151
389
|
}
|
|
152
390
|
};
|
|
153
391
|
}
|
|
154
|
-
async function
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
let g = N * 6;
|
|
158
|
-
return f + y + i + U + n + c + (u ? l + g + (l + N * 3) * (p - 1) : (l + g) * p);
|
|
159
|
-
}, 0), h = new ArrayBuffer(v + x), s = new DataView(h);
|
|
160
|
-
let t = 0;
|
|
161
|
-
s.setUint32(t, J), t += 4, s.setUint8(t, _), t += 1, s.setUint8(t, m.clips.length), t += 1, s.setUint16(t, m.canvas.width), t += 2, s.setUint8(t, m.padding), t += 1;
|
|
162
|
-
for (let f = 0; f < m.clips.length; f++) {
|
|
163
|
-
s.setUint8(t, e[f].byteLength), t += 1, new Uint8Array(h, t, e[f].byteLength).set(e[f]), t += e[f].byteLength, s.setUint8(t, m.clips[f].frames.length), t += 1, s.setUint8(t, m.clips[f].fps), t += 1, s.setUint8(t, Math.round(m.clips[f].scale * 100)), t += 1, s.setUint8(t, Math.round(m.clips[f].aspectRatio * 100)), t += 1;
|
|
164
|
-
const a = m.clips[f];
|
|
165
|
-
for (let r = 0; r < a.frames.length; r++) {
|
|
166
|
-
const p = a.frames[r].cropUV, y = a.frames[r].frameUV;
|
|
167
|
-
s.setUint16(t, Math.round(y.u * 1e3)), t += 2, s.setUint16(t, Math.round(y.v * 1e3)), t += 2, s.setUint16(t, Math.round(y.w * 1e3)), t += 2, s.setUint16(t, Math.round(y.h * 1e3)), t += 2, s.setUint16(t, Math.round(p.u * 1e3)), t += 2, s.setUint16(t, Math.round(p.v * 1e3)), t += 2, s.setUint16(t, Math.round(p.w * 1e3)), t += 2, s.setUint16(t, Math.round(p.h * 1e3)), t += 2;
|
|
168
|
-
const i = a.landmarks[r], U = r > 0 ? a.landmarks[r - 1] : null;
|
|
169
|
-
i.reduce((n, c) => Math.max(n, Math.abs(c.z)), 0);
|
|
170
|
-
for (let n = 0; n < N; n++) {
|
|
171
|
-
const c = Math.round(i[n].x * 1e3), l = Math.round(i[n].y * 1e3), g = Math.round(i[n].z * 1e3);
|
|
172
|
-
if (u)
|
|
173
|
-
if (U === null)
|
|
174
|
-
s.setUint16(t, c), t += 2, s.setUint16(t, l), t += 2, s.setInt16(t, g), t += 2;
|
|
175
|
-
else {
|
|
176
|
-
const b = Math.round(U[n].x * 1e3), M = Math.round(U[n].y * 1e3), k = Math.round(U[n].z * 1e3), A = c - b, R = l - M, L = g - k;
|
|
177
|
-
console.log("Deltas: ", A), s.setInt8(t, A), t += 1, s.setInt8(t, R), t += 1, s.setInt8(t, L), t += 1;
|
|
178
|
-
}
|
|
179
|
-
else
|
|
180
|
-
s.setUint16(t, c), t += 2, s.setUint16(t, l), t += 2, s.setInt16(t, g), t += 2;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return new Promise((f, a) => {
|
|
185
|
-
ft(new Uint8Array(h), { level: 9 }, (r, p) => {
|
|
186
|
-
if (r) return a(r);
|
|
187
|
-
const y = new Blob([p], { type: "application/octet-stream" });
|
|
188
|
-
f(y);
|
|
189
|
-
});
|
|
190
|
-
});
|
|
392
|
+
async function ce(o) {
|
|
393
|
+
const s = await Ut(o);
|
|
394
|
+
return it(s, !1);
|
|
191
395
|
}
|
|
192
|
-
function
|
|
193
|
-
const o = [],
|
|
194
|
-
let
|
|
195
|
-
const
|
|
196
|
-
for (const
|
|
197
|
-
let
|
|
198
|
-
for (const
|
|
199
|
-
if (
|
|
200
|
-
|
|
396
|
+
function Kt(o) {
|
|
397
|
+
const s = $t(o), a = [], i = [];
|
|
398
|
+
let n = 0;
|
|
399
|
+
const t = [...o].sort((l, A) => A.height - l.height);
|
|
400
|
+
for (const l of t) {
|
|
401
|
+
let A = !1;
|
|
402
|
+
for (const M of a)
|
|
403
|
+
if (l.width <= s - M.currentX && l.height <= M.height) {
|
|
404
|
+
i.push({
|
|
405
|
+
...l,
|
|
406
|
+
x: M.currentX,
|
|
407
|
+
y: M.y
|
|
408
|
+
}), M.currentX += l.width, A = !0;
|
|
201
409
|
break;
|
|
202
410
|
}
|
|
203
|
-
if (!
|
|
204
|
-
const
|
|
205
|
-
y:
|
|
206
|
-
height:
|
|
207
|
-
currentX:
|
|
411
|
+
if (!A) {
|
|
412
|
+
const M = {
|
|
413
|
+
y: n,
|
|
414
|
+
height: l.height,
|
|
415
|
+
currentX: l.width
|
|
208
416
|
};
|
|
209
|
-
|
|
417
|
+
a.push(M), i.push({
|
|
418
|
+
...l,
|
|
419
|
+
x: 0,
|
|
420
|
+
y: n
|
|
421
|
+
}), n += l.height;
|
|
210
422
|
}
|
|
211
423
|
}
|
|
212
|
-
|
|
424
|
+
const g = a.length > 0 ? Math.max(...a.map((l) => l.currentX)) : 0, m = n;
|
|
425
|
+
return {
|
|
426
|
+
packed: i,
|
|
427
|
+
width: Math.max(g, s),
|
|
428
|
+
height: m
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function $t(o) {
|
|
432
|
+
if (o.length === 0) return 1;
|
|
433
|
+
const s = o.reduce((n, t) => n + t.width * t.height, 0);
|
|
434
|
+
let a = Math.ceil(Math.sqrt(s));
|
|
435
|
+
const i = Math.max(...o.map((n) => n.width));
|
|
436
|
+
return a = Math.max(a, i), a = Gt(a), a;
|
|
213
437
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
438
|
+
function Gt(o) {
|
|
439
|
+
return Math.pow(2, Math.ceil(Math.log2(o)));
|
|
440
|
+
}
|
|
441
|
+
const Qt = 20;
|
|
442
|
+
function le(o, s, a = 0) {
|
|
443
|
+
const i = o.flatMap((d) => d.frames.map((u) => u.canvas)), n = Array.from(i.entries()).map(([d, u]) => ({
|
|
444
|
+
id: d,
|
|
218
445
|
// index of the frame after all the frames from all the clips have been flattened
|
|
219
|
-
width:
|
|
220
|
-
height:
|
|
221
|
-
})),
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
for (const
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
u:
|
|
230
|
-
v:
|
|
231
|
-
w:
|
|
232
|
-
h:
|
|
446
|
+
width: u.width + a * 2,
|
|
447
|
+
height: u.height + a * 2
|
|
448
|
+
})), t = Kt(n), g = t.height, m = t.width, l = Math.min(1, s / m, s / g), A = Math.floor(m * l), M = Math.floor(g * l) + Qt, x = document.createElement("canvas");
|
|
449
|
+
x.width = A, x.height = M;
|
|
450
|
+
const f = x.getContext("2d");
|
|
451
|
+
f.fillStyle = "#000000", f.fillRect(0, 0, x.width, x.height);
|
|
452
|
+
const r = [];
|
|
453
|
+
for (const d of t.packed) {
|
|
454
|
+
const u = i[d.id], w = d.x + a, p = d.y + a, h = u.width, U = u.height;
|
|
455
|
+
f.drawImage(u, w * l, p * l, h * l, U * l), r[d.id] = {
|
|
456
|
+
u: w * l / A,
|
|
457
|
+
v: p * l / M,
|
|
458
|
+
w: h * l / A,
|
|
459
|
+
h: U * l / M
|
|
233
460
|
};
|
|
234
461
|
}
|
|
235
|
-
const
|
|
236
|
-
let
|
|
237
|
-
for (const
|
|
238
|
-
const
|
|
239
|
-
...
|
|
462
|
+
const e = [];
|
|
463
|
+
let c = 0;
|
|
464
|
+
for (const d of o) {
|
|
465
|
+
const u = {
|
|
466
|
+
...d,
|
|
240
467
|
frames: []
|
|
241
468
|
};
|
|
242
|
-
for (const
|
|
243
|
-
|
|
244
|
-
frameUV:
|
|
245
|
-
cropUV:
|
|
469
|
+
for (const w of d.frames)
|
|
470
|
+
u.frames.push({
|
|
471
|
+
frameUV: r[c++],
|
|
472
|
+
cropUV: w.cropUV,
|
|
473
|
+
startTime: w.startTime,
|
|
474
|
+
transformMatrix: w.transformMatrix
|
|
246
475
|
});
|
|
247
|
-
|
|
476
|
+
e.push(u);
|
|
248
477
|
}
|
|
249
|
-
return
|
|
250
|
-
canvas:
|
|
251
|
-
clips:
|
|
252
|
-
padding:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
478
|
+
return f.font = `${Math.max(6, Math.floor(12))}px monospace`, f.fillStyle = "#ff0000", f.fillText("Created with MeshCap : https://bandinopla.github.io/three-mediapipe-rig/?editor=meshcap", 0, M - 4), {
|
|
479
|
+
canvas: x,
|
|
480
|
+
clips: e,
|
|
481
|
+
padding: a,
|
|
482
|
+
atlasSize: s,
|
|
483
|
+
async save(d) {
|
|
484
|
+
const u = await _t(this);
|
|
485
|
+
if (d) {
|
|
486
|
+
const w = URL.createObjectURL(u), p = document.createElement("a");
|
|
487
|
+
p.href = w, p.download = "atlas.mcap", p.click(), URL.revokeObjectURL(w), p.remove();
|
|
258
488
|
}
|
|
259
|
-
return
|
|
489
|
+
return u;
|
|
490
|
+
},
|
|
491
|
+
async saveImageAtlas(d, u) {
|
|
492
|
+
const w = document.createElement("a");
|
|
493
|
+
w.download = u ? "atlas.jpg" : "atlas.png";
|
|
494
|
+
let p = this.canvas;
|
|
495
|
+
if (d)
|
|
496
|
+
return await Jt(p, d, u);
|
|
497
|
+
w.href = p.toDataURL(u ? "image/jpeg" : "image/png", u ? 0.8 : 1), w.click();
|
|
260
498
|
}
|
|
261
499
|
};
|
|
262
500
|
}
|
|
263
|
-
function
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
let
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
501
|
+
function ct(o, s) {
|
|
502
|
+
const a = new Uint8Array(o);
|
|
503
|
+
let i = 0;
|
|
504
|
+
for (let n = 0; n < s.length; n++)
|
|
505
|
+
i = i + s.charCodeAt(n) & 255;
|
|
506
|
+
for (let n = 0; n < a.length; n++)
|
|
507
|
+
a[n] ^= i;
|
|
508
|
+
return a;
|
|
509
|
+
}
|
|
510
|
+
async function Jt(o, s, a) {
|
|
511
|
+
const n = await (await new Promise((A) => o.toBlob(A, a ? "image/jpeg" : "image/png", a ? 0.8 : 1))).arrayBuffer(), t = ct(n, s), g = new Blob([t], { type: "application/octet-stream" }), m = URL.createObjectURL(g), l = document.createElement("a");
|
|
512
|
+
l.href = m, l.download = "atlas.mcatlas", l.click(), URL.revokeObjectURL(m);
|
|
513
|
+
}
|
|
514
|
+
async function fe(o, s) {
|
|
515
|
+
if (typeof o == "string")
|
|
516
|
+
if (o.endsWith(".mcatlas")) {
|
|
517
|
+
const i = await (await fetch(o)).arrayBuffer();
|
|
518
|
+
return await gt(i, s);
|
|
519
|
+
} else
|
|
520
|
+
return new pt().loadAsync(o);
|
|
521
|
+
else {
|
|
522
|
+
if (o.name.endsWith(".mcatlas"))
|
|
523
|
+
return new Promise((i, n) => {
|
|
524
|
+
const t = new FileReader();
|
|
525
|
+
t.onload = (g) => {
|
|
526
|
+
const m = g.target.result;
|
|
527
|
+
i(gt(m, s));
|
|
528
|
+
}, t.onerror = (g) => {
|
|
529
|
+
n(g);
|
|
530
|
+
}, t.readAsArrayBuffer(o);
|
|
531
|
+
});
|
|
532
|
+
const a = URL.createObjectURL(o);
|
|
533
|
+
return await new Promise((i, n) => {
|
|
534
|
+
new pt().load(a, i, void 0, n);
|
|
535
|
+
});
|
|
270
536
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
throw new Error(`Clip ${d.toString()} not found`);
|
|
296
|
-
b.value = w, g.value = 0, l.value = I;
|
|
297
|
-
},
|
|
298
|
-
update(d) {
|
|
299
|
-
g.value += d;
|
|
300
|
-
},
|
|
301
|
-
dispose() {
|
|
302
|
-
m.dispose(), e.dispose();
|
|
303
|
-
},
|
|
304
|
-
gotoAndLoop(d) {
|
|
305
|
-
this.goto(d, !0);
|
|
306
|
-
},
|
|
307
|
-
gotoAndPlay(d) {
|
|
308
|
-
this.goto(d, !1);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
537
|
+
}
|
|
538
|
+
async function gt(o, s) {
|
|
539
|
+
if (!s)
|
|
540
|
+
throw new Error("No passphrase provided");
|
|
541
|
+
const a = ct(o, s), i = new Blob([a], { type: "image/png" }), n = URL.createObjectURL(i), t = document.createElement("img");
|
|
542
|
+
await new Promise((m, l) => {
|
|
543
|
+
t.onload = () => m(), t.onerror = l, t.src = n;
|
|
544
|
+
});
|
|
545
|
+
const g = new Nt(t);
|
|
546
|
+
return g.needsUpdate = !0, g;
|
|
547
|
+
}
|
|
548
|
+
async function de(o, s) {
|
|
549
|
+
const a = document.createElement("canvas");
|
|
550
|
+
a.width = o.width, a.height = o.height, a.getContext("2d").drawImage(o, 0, 0);
|
|
551
|
+
const n = await new Promise((g, m) => {
|
|
552
|
+
a.toBlob((l) => {
|
|
553
|
+
if (!l) {
|
|
554
|
+
m(new Error("Failed to create blob"));
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
g(l.arrayBuffer());
|
|
558
|
+
}, "image/jpeg", 0.75);
|
|
559
|
+
}), t = ct(n, s);
|
|
560
|
+
return new Blob([t], { type: "application/octet-stream" });
|
|
311
561
|
}
|
|
312
562
|
export {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
563
|
+
Ht as audioBufferToWav,
|
|
564
|
+
le as buildMeshCapAtlas,
|
|
565
|
+
Yt as createAudioAtlasPlayer,
|
|
566
|
+
qt as createMeshCapMaterial,
|
|
567
|
+
Xt as extractAudioSprites,
|
|
568
|
+
ie as loadMeshCapFile,
|
|
569
|
+
fe as loadMeshcapAtlas,
|
|
570
|
+
de as obfuscateImage,
|
|
571
|
+
ce as readAsMCapFile
|
|
316
572
|
};
|