@sage-rsc/talking-head-react 1.0.26 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{fbxAnimationLoader-BEp5N4LW.js → fbxAnimationLoader-BndnRQYi.js} +1 -1
- package/dist/{fbxAnimationLoader-DYwX3TQf.cjs → fbxAnimationLoader-BoEg8dON.cjs} +1 -1
- package/dist/{index-BAyfuKmk.cjs → index-COqTUp83.cjs} +2 -2
- package/dist/{index-R68Q6EcC.js → index-DPiBXfzj.js} +143 -115
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/CurriculumLearning.jsx +61 -9
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as rn, jsx as Te } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as Ut, useRef as
|
|
2
|
+
import { forwardRef as Ut, useRef as ze, useState as Ue, useCallback as B, useEffect as mt, useImperativeHandle as Gt } from "react";
|
|
3
3
|
import * as R from "three";
|
|
4
|
-
import { Controls as Nn, Vector3 as _, MOUSE as Ge, TOUCH as _e, Quaternion as ce, Spherical as jt, Vector2 as re, Ray as Bn, Plane as Un, MathUtils as
|
|
5
|
-
const Zt = { type: "change" }, Vt = { type: "start" }, In = { type: "end" }, ht = new Bn(), Yt = new Un(), yi = Math.cos(70 *
|
|
4
|
+
import { Controls as Nn, Vector3 as _, MOUSE as Ge, TOUCH as _e, Quaternion as ce, Spherical as jt, Vector2 as re, Ray as Bn, Plane as Un, MathUtils as $, TrianglesDrawMode as Gn, TriangleFanDrawMode as Mt, TriangleStripDrawMode as ln, Loader as $e, LoaderUtils as Ve, FileLoader as et, MeshPhysicalMaterial as Re, Color as ee, LinearSRGBColorSpace as be, SRGBColorSpace as Y, SpotLight as hn, PointLight as ft, DirectionalLight as cn, Matrix4 as G, InstancedMesh as un, InstancedBufferAttribute as Vn, Object3D as Me, TextureLoader as dn, ImageBitmapLoader as Wn, BufferAttribute as Ye, InterleavedBuffer as Xn, InterleavedBufferAttribute as jn, LinearMipmapLinearFilter as pn, NearestMipmapLinearFilter as Zn, LinearMipmapNearestFilter as Yn, NearestMipmapNearestFilter as Kn, LinearFilter as zt, NearestFilter as mn, RepeatWrapping as tt, MirroredRepeatWrapping as qn, ClampToEdgeWrapping as Ht, PointsMaterial as Qn, Material as vt, LineBasicMaterial as fn, MeshStandardMaterial as gt, DoubleSide as Jn, MeshBasicMaterial as Ze, PropertyBinding as nt, BufferGeometry as Ke, SkinnedMesh as gn, Mesh as Ie, LineSegments as $n, Line as yn, LineLoop as ei, Points as ti, Group as qe, PerspectiveCamera as xn, OrthographicCamera as ni, Skeleton as bn, AnimationClip as Rn, Bone as Pt, InterpolateDiscrete as ii, InterpolateLinear as vn, Texture as Ft, VectorKeyframeTrack as Dt, NumberKeyframeTrack as Ot, QuaternionKeyframeTrack as yt, ColorManagement as me, FrontSide as si, Interpolant as oi, Box3 as ai, Sphere as ri, Vector4 as it, Curve as li, MeshPhongMaterial as lt, MeshLambertMaterial as An, EquirectangularReflectionMapping as hi, AmbientLight as ci, Float32BufferAttribute as Fe, Uint16BufferAttribute as ui, Matrix3 as di, ShapeUtils as pi, Euler as Ee, Scene as mi, BoxGeometry as fi, BackSide as gi } from "three";
|
|
5
|
+
const Zt = { type: "change" }, Vt = { type: "start" }, In = { type: "end" }, ht = new Bn(), Yt = new Un(), yi = Math.cos(70 * $.DEG2RAD), Q = new _(), oe = 2 * Math.PI, N = {
|
|
6
6
|
NONE: -1,
|
|
7
7
|
ROTATE: 0,
|
|
8
8
|
DOLLY: 1,
|
|
@@ -459,7 +459,7 @@ function Ei(p) {
|
|
|
459
459
|
function Kt(p, e) {
|
|
460
460
|
if (e === Gn)
|
|
461
461
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), p;
|
|
462
|
-
if (e ===
|
|
462
|
+
if (e === Mt || e === ln) {
|
|
463
463
|
let t = p.getIndex();
|
|
464
464
|
if (t === null) {
|
|
465
465
|
const o = [], a = p.getAttribute("position");
|
|
@@ -471,7 +471,7 @@ function Kt(p, e) {
|
|
|
471
471
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), p;
|
|
472
472
|
}
|
|
473
473
|
const n = t.count - 2, i = [];
|
|
474
|
-
if (e ===
|
|
474
|
+
if (e === Mt)
|
|
475
475
|
for (let o = 1; o <= n; o++)
|
|
476
476
|
i.push(t.getX(0)), i.push(t.getX(o)), i.push(t.getX(o + 1));
|
|
477
477
|
else
|
|
@@ -483,7 +483,7 @@ function Kt(p, e) {
|
|
|
483
483
|
} else
|
|
484
484
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), p;
|
|
485
485
|
}
|
|
486
|
-
class
|
|
486
|
+
class Mi extends $e {
|
|
487
487
|
/**
|
|
488
488
|
* Constructs a new glTF loader.
|
|
489
489
|
*
|
|
@@ -689,7 +689,7 @@ class zi extends $e {
|
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function zi() {
|
|
693
693
|
let p = {};
|
|
694
694
|
return {
|
|
695
695
|
get: function(e) {
|
|
@@ -747,7 +747,7 @@ class Hi {
|
|
|
747
747
|
if (i) return i;
|
|
748
748
|
const s = t.json, l = ((s.extensions && s.extensions[this.name] || {}).lights || [])[e];
|
|
749
749
|
let r;
|
|
750
|
-
const c = new
|
|
750
|
+
const c = new ee(16777215);
|
|
751
751
|
l.color !== void 0 && c.setRGB(l.color[0], l.color[1], l.color[2], be);
|
|
752
752
|
const h = l.range !== void 0 ? l.range : 0;
|
|
753
753
|
switch (l.type) {
|
|
@@ -785,7 +785,7 @@ class Pi {
|
|
|
785
785
|
}
|
|
786
786
|
extendParams(e, t, n) {
|
|
787
787
|
const i = [];
|
|
788
|
-
e.color = new
|
|
788
|
+
e.color = new ee(1, 1, 1), e.opacity = 1;
|
|
789
789
|
const s = t.pbrMetallicRoughness;
|
|
790
790
|
if (s) {
|
|
791
791
|
if (Array.isArray(s.baseColorFactor)) {
|
|
@@ -874,7 +874,7 @@ class Ni {
|
|
|
874
874
|
if (!i.extensions || !i.extensions[this.name])
|
|
875
875
|
return Promise.resolve();
|
|
876
876
|
const s = [];
|
|
877
|
-
t.sheenColor = new
|
|
877
|
+
t.sheenColor = new ee(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
878
878
|
const o = i.extensions[this.name];
|
|
879
879
|
if (o.sheenColorFactor !== void 0) {
|
|
880
880
|
const a = o.sheenColorFactor;
|
|
@@ -914,7 +914,7 @@ class Ui {
|
|
|
914
914
|
const s = [], o = i.extensions[this.name];
|
|
915
915
|
t.thickness = o.thicknessFactor !== void 0 ? o.thicknessFactor : 0, o.thicknessTexture !== void 0 && s.push(n.assignTexture(t, "thicknessMap", o.thicknessTexture)), t.attenuationDistance = o.attenuationDistance || 1 / 0;
|
|
916
916
|
const a = o.attenuationColor || [1, 1, 1];
|
|
917
|
-
return t.attenuationColor = new
|
|
917
|
+
return t.attenuationColor = new ee().setRGB(a[0], a[1], a[2], be), Promise.all(s);
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
920
|
class Gi {
|
|
@@ -948,7 +948,7 @@ class Vi {
|
|
|
948
948
|
const s = [], o = i.extensions[this.name];
|
|
949
949
|
t.specularIntensity = o.specularFactor !== void 0 ? o.specularFactor : 1, o.specularTexture !== void 0 && s.push(n.assignTexture(t, "specularIntensityMap", o.specularTexture));
|
|
950
950
|
const a = o.specularColorFactor || [1, 1, 1];
|
|
951
|
-
return t.specularColor = new
|
|
951
|
+
return t.specularColor = new ee().setRGB(a[0], a[1], a[2], be), o.specularColorTexture !== void 0 && s.push(n.assignTexture(t, "specularColorMap", o.specularColorTexture, Y)), Promise.all(s);
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
954
|
class Wi {
|
|
@@ -1086,7 +1086,7 @@ class qi {
|
|
|
1086
1086
|
const k = l[S];
|
|
1087
1087
|
f.instanceColor = new Vn(k.array, k.itemSize, k.normalized);
|
|
1088
1088
|
} else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" && m.geometry.setAttribute(S, l[S]);
|
|
1089
|
-
|
|
1089
|
+
Me.prototype.copy.call(f, m), this.parser.assignFinalMaterial(f), d.push(f);
|
|
1090
1090
|
}
|
|
1091
1091
|
return c.isGroup ? (c.clear(), c.add(...d), c) : d[0];
|
|
1092
1092
|
}));
|
|
@@ -1182,8 +1182,8 @@ class wn extends oi {
|
|
|
1182
1182
|
interpolate_(e, t, n, i) {
|
|
1183
1183
|
const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, r = a * 3, c = i - t, h = (n - t) / c, u = h * h, d = u * h, m = e * r, y = m - r, g = -2 * d + 3 * u, b = d - u, I = 1 - g, f = b - u + h;
|
|
1184
1184
|
for (let S = 0; S !== a; S++) {
|
|
1185
|
-
const k = o[y + S + a], A = o[y + S + l] * c,
|
|
1186
|
-
s[S] = I * k + f * A + g *
|
|
1185
|
+
const k = o[y + S + a], A = o[y + S + l] * c, z = o[m + S + a], E = o[m + S] * c;
|
|
1186
|
+
s[S] = I * k + f * A + g * z + b * E;
|
|
1187
1187
|
}
|
|
1188
1188
|
return s;
|
|
1189
1189
|
}
|
|
@@ -1212,7 +1212,7 @@ const he = {
|
|
|
1212
1212
|
5126: Float32Array
|
|
1213
1213
|
}, Qt = {
|
|
1214
1214
|
9728: mn,
|
|
1215
|
-
9729:
|
|
1215
|
+
9729: zt,
|
|
1216
1216
|
9984: Kn,
|
|
1217
1217
|
9985: Yn,
|
|
1218
1218
|
9986: Zn,
|
|
@@ -1355,7 +1355,7 @@ function ls(p) {
|
|
|
1355
1355
|
const hs = new G();
|
|
1356
1356
|
class cs {
|
|
1357
1357
|
constructor(e = {}, t = {}) {
|
|
1358
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
1358
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new zi(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
|
|
1359
1359
|
let n = !1, i = -1, s = !1, o = -1;
|
|
1360
1360
|
if (typeof navigator < "u") {
|
|
1361
1361
|
const a = navigator.userAgent;
|
|
@@ -1619,9 +1619,9 @@ class cs {
|
|
|
1619
1619
|
if (i.sparse !== void 0) {
|
|
1620
1620
|
const b = It.SCALAR, I = We[i.sparse.indices.componentType], f = i.sparse.indices.byteOffset || 0, S = i.sparse.values.byteOffset || 0, k = new I(o[1], f, i.sparse.count * b), A = new r(o[2], S, i.sparse.count * l);
|
|
1621
1621
|
a !== null && (g = new Ye(g.array.slice(), g.itemSize, g.normalized)), g.normalized = !1;
|
|
1622
|
-
for (let
|
|
1623
|
-
const D = k[
|
|
1624
|
-
if (g.setX(D, A[
|
|
1622
|
+
for (let z = 0, E = k.length; z < E; z++) {
|
|
1623
|
+
const D = k[z];
|
|
1624
|
+
if (g.setX(D, A[z * l]), l >= 2 && g.setY(D, A[z * l + 1]), l >= 3 && g.setZ(D, A[z * l + 2]), l >= 4 && g.setW(D, A[z * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1625
1625
|
}
|
|
1626
1626
|
g.normalized = m;
|
|
1627
1627
|
}
|
|
@@ -1651,7 +1651,7 @@ class cs {
|
|
|
1651
1651
|
const r = this.loadImageSource(t, n).then(function(c) {
|
|
1652
1652
|
c.flipY = !1, c.name = o.name || a.name || "", c.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (c.name = a.uri);
|
|
1653
1653
|
const u = (s.samplers || {})[o.sampler] || {};
|
|
1654
|
-
return c.magFilter = Qt[u.magFilter] ||
|
|
1654
|
+
return c.magFilter = Qt[u.magFilter] || zt, c.minFilter = Qt[u.minFilter] || pn, c.wrapS = Jt[u.wrapS] || tt, c.wrapT = Jt[u.wrapT] || tt, c.generateMipmaps = !c.isCompressedTexture && c.minFilter !== mn && c.minFilter !== zt, i.associations.set(c, { textures: e }), c;
|
|
1655
1655
|
}).catch(function() {
|
|
1656
1656
|
return null;
|
|
1657
1657
|
});
|
|
@@ -1760,7 +1760,7 @@ class cs {
|
|
|
1760
1760
|
o = h.getMaterialType(), r.push(h.extendParams(a, s, t));
|
|
1761
1761
|
} else {
|
|
1762
1762
|
const h = s.pbrMetallicRoughness || {};
|
|
1763
|
-
if (a.color = new
|
|
1763
|
+
if (a.color = new ee(1, 1, 1), a.opacity = 1, Array.isArray(h.baseColorFactor)) {
|
|
1764
1764
|
const u = h.baseColorFactor;
|
|
1765
1765
|
a.color.setRGB(u[0], u[1], u[2], be), a.opacity = u[3];
|
|
1766
1766
|
}
|
|
@@ -1778,7 +1778,7 @@ class cs {
|
|
|
1778
1778
|
}
|
|
1779
1779
|
if (s.occlusionTexture !== void 0 && o !== Ze && (r.push(t.assignTexture(a, "aoMap", s.occlusionTexture)), s.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = s.occlusionTexture.strength)), s.emissiveFactor !== void 0 && o !== Ze) {
|
|
1780
1780
|
const h = s.emissiveFactor;
|
|
1781
|
-
a.emissive = new
|
|
1781
|
+
a.emissive = new ee().setRGB(h[0], h[1], h[2], be);
|
|
1782
1782
|
}
|
|
1783
1783
|
return s.emissiveTexture !== void 0 && o !== Ze && r.push(t.assignTexture(a, "emissiveMap", s.emissiveTexture, Y)), Promise.all(r).then(function() {
|
|
1784
1784
|
const h = new o(a);
|
|
@@ -1844,7 +1844,7 @@ class cs {
|
|
|
1844
1844
|
let b;
|
|
1845
1845
|
const I = r[d];
|
|
1846
1846
|
if (g.mode === he.TRIANGLES || g.mode === he.TRIANGLE_STRIP || g.mode === he.TRIANGLE_FAN || g.mode === void 0)
|
|
1847
|
-
b = s.isSkinnedMesh === !0 ? new gn(y, I) : new Ie(y, I), b.isSkinnedMesh === !0 && b.normalizeSkinWeights(), g.mode === he.TRIANGLE_STRIP ? b.geometry = Kt(b.geometry, ln) : g.mode === he.TRIANGLE_FAN && (b.geometry = Kt(b.geometry,
|
|
1847
|
+
b = s.isSkinnedMesh === !0 ? new gn(y, I) : new Ie(y, I), b.isSkinnedMesh === !0 && b.normalizeSkinWeights(), g.mode === he.TRIANGLE_STRIP ? b.geometry = Kt(b.geometry, ln) : g.mode === he.TRIANGLE_FAN && (b.geometry = Kt(b.geometry, Mt));
|
|
1848
1848
|
else if (g.mode === he.LINES)
|
|
1849
1849
|
b = new $n(y, I);
|
|
1850
1850
|
else if (g.mode === he.LINE_STRIP)
|
|
@@ -1885,7 +1885,7 @@ class cs {
|
|
|
1885
1885
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1886
1886
|
return;
|
|
1887
1887
|
}
|
|
1888
|
-
return n.type === "perspective" ? t = new xn(
|
|
1888
|
+
return n.type === "perspective" ? t = new xn($.radToDeg(i.yfov), i.aspectRatio || 1, i.znear || 1, i.zfar || 2e6) : n.type === "orthographic" && (t = new ni(-i.xmag, i.xmag, i.ymag, -i.ymag, i.znear, i.zfar)), n.name && (t.name = this.createUniqueName(n.name)), xe(t, n), Promise.resolve(t);
|
|
1889
1889
|
}
|
|
1890
1890
|
/**
|
|
1891
1891
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1934,10 +1934,10 @@ class cs {
|
|
|
1934
1934
|
]).then(function(h) {
|
|
1935
1935
|
const u = h[0], d = h[1], m = h[2], y = h[3], g = h[4], b = [];
|
|
1936
1936
|
for (let f = 0, S = u.length; f < S; f++) {
|
|
1937
|
-
const k = u[f], A = d[f],
|
|
1937
|
+
const k = u[f], A = d[f], z = m[f], E = y[f], D = g[f];
|
|
1938
1938
|
if (k === void 0) continue;
|
|
1939
1939
|
k.updateMatrix && k.updateMatrix();
|
|
1940
|
-
const U = n._createAnimationTracks(k, A,
|
|
1940
|
+
const U = n._createAnimationTracks(k, A, z, E, D);
|
|
1941
1941
|
if (U)
|
|
1942
1942
|
for (let w = 0; w < U.length; w++)
|
|
1943
1943
|
b.push(U[w]);
|
|
@@ -2000,7 +2000,7 @@ class cs {
|
|
|
2000
2000
|
a.push(r);
|
|
2001
2001
|
}), this.nodeCache[e] = Promise.all(a).then(function(r) {
|
|
2002
2002
|
let c;
|
|
2003
|
-
if (s.isBone === !0 ? c = new Pt() : r.length > 1 ? c = new qe() : r.length === 1 ? c = r[0] : c = new
|
|
2003
|
+
if (s.isBone === !0 ? c = new Pt() : r.length > 1 ? c = new qe() : r.length === 1 ? c = r[0] : c = new Me(), c !== r[0])
|
|
2004
2004
|
for (let h = 0, u = r.length; h < u; h++)
|
|
2005
2005
|
c.add(r[h]);
|
|
2006
2006
|
if (s.name && (c.userData.name = s.name, c.name = o), xe(c, s), s.extensions && Ce(n, c, s), s.matrix !== void 0) {
|
|
@@ -2284,7 +2284,7 @@ class ds extends $e {
|
|
|
2284
2284
|
}
|
|
2285
2285
|
_assignVertexColorSpace(e, t) {
|
|
2286
2286
|
if (t !== Y) return;
|
|
2287
|
-
const n = new
|
|
2287
|
+
const n = new ee();
|
|
2288
2288
|
for (let i = 0, s = e.count; i < s; i++)
|
|
2289
2289
|
n.fromBufferAttribute(e, i), me.colorSpaceToWorking(n, Y), e.setXYZ(i, n.r, n.g, n.b);
|
|
2290
2290
|
}
|
|
@@ -2557,10 +2557,10 @@ for (var V = 256; V < 280; ++V)
|
|
|
2557
2557
|
ot[V] = 7;
|
|
2558
2558
|
for (var V = 280; V < 288; ++V)
|
|
2559
2559
|
ot[V] = 8;
|
|
2560
|
-
var
|
|
2560
|
+
var Mn = new ue(32);
|
|
2561
2561
|
for (var V = 0; V < 32; ++V)
|
|
2562
|
-
|
|
2563
|
-
var bs = /* @__PURE__ */ Qe(ot, 9, 1), Rs = /* @__PURE__ */ Qe(
|
|
2562
|
+
Mn[V] = 5;
|
|
2563
|
+
var bs = /* @__PURE__ */ Qe(ot, 9, 1), Rs = /* @__PURE__ */ Qe(Mn, 5, 1), Tt = function(p) {
|
|
2564
2564
|
for (var e = p[0], t = 1; t < p.length; ++t)
|
|
2565
2565
|
p[t] > e && (e = p[t]);
|
|
2566
2566
|
return e;
|
|
@@ -2616,15 +2616,15 @@ var bs = /* @__PURE__ */ Qe(ot, 9, 1), Rs = /* @__PURE__ */ Qe(zn, 5, 1), Tt = f
|
|
|
2616
2616
|
if (I == 1)
|
|
2617
2617
|
d = bs, m = Rs, y = 9, g = 5;
|
|
2618
2618
|
else if (I == 2) {
|
|
2619
|
-
var A = de(p, h, 31) + 257,
|
|
2619
|
+
var A = de(p, h, 31) + 257, z = de(p, h + 10, 15) + 4, E = A + de(p, h + 5, 31) + 1;
|
|
2620
2620
|
h += 14;
|
|
2621
|
-
for (var D = new ue(E), U = new ue(19), w = 0; w <
|
|
2621
|
+
for (var D = new ue(E), U = new ue(19), w = 0; w < z; ++w)
|
|
2622
2622
|
U[fs[w]] = de(p, h + w * 3, 7);
|
|
2623
|
-
h +=
|
|
2623
|
+
h += z * 3;
|
|
2624
2624
|
for (var v = Tt(U), L = (1 << v) - 1, F = Qe(U, v, 1), w = 0; w < E; ) {
|
|
2625
|
-
var
|
|
2626
|
-
h +=
|
|
2627
|
-
var f =
|
|
2625
|
+
var J = F[de(p, h, L)];
|
|
2626
|
+
h += J & 15;
|
|
2627
|
+
var f = J >> 4;
|
|
2628
2628
|
if (f < 16)
|
|
2629
2629
|
D[w++] = f;
|
|
2630
2630
|
else {
|
|
@@ -2705,7 +2705,7 @@ try {
|
|
|
2705
2705
|
ks.decode(ws, { stream: !0 }), Cs = 1;
|
|
2706
2706
|
} catch {
|
|
2707
2707
|
}
|
|
2708
|
-
function
|
|
2708
|
+
function zn(p, e, t) {
|
|
2709
2709
|
const n = t.length - p - 1;
|
|
2710
2710
|
if (e >= t[n])
|
|
2711
2711
|
return n - 1;
|
|
@@ -2730,15 +2730,15 @@ function Es(p, e, t, n) {
|
|
|
2730
2730
|
}
|
|
2731
2731
|
return i;
|
|
2732
2732
|
}
|
|
2733
|
-
function
|
|
2734
|
-
const i =
|
|
2733
|
+
function Ms(p, e, t, n) {
|
|
2734
|
+
const i = zn(p, n, e), s = Es(i, n, p, e), o = new it(0, 0, 0, 0);
|
|
2735
2735
|
for (let a = 0; a <= p; ++a) {
|
|
2736
2736
|
const l = t[i - p + a], r = s[a], c = l.w * r;
|
|
2737
2737
|
o.x += l.x * c, o.y += l.y * c, o.z += l.z * c, o.w += l.w * r;
|
|
2738
2738
|
}
|
|
2739
2739
|
return o;
|
|
2740
2740
|
}
|
|
2741
|
-
function
|
|
2741
|
+
function zs(p, e, t, n, i) {
|
|
2742
2742
|
const s = [];
|
|
2743
2743
|
for (let h = 0; h <= t; ++h)
|
|
2744
2744
|
s[h] = 0;
|
|
@@ -2790,7 +2790,7 @@ function Ms(p, e, t, n, i) {
|
|
|
2790
2790
|
return o;
|
|
2791
2791
|
}
|
|
2792
2792
|
function Hs(p, e, t, n, i) {
|
|
2793
|
-
const s = i < p ? i : p, o = [], a =
|
|
2793
|
+
const s = i < p ? i : p, o = [], a = zn(p, n, e), l = zs(a, n, p, s, e), r = [];
|
|
2794
2794
|
for (let c = 0; c < t.length; ++c) {
|
|
2795
2795
|
const h = t[c].clone(), u = h.w;
|
|
2796
2796
|
h.x *= u, h.y *= u, h.z *= u, r[c] = h;
|
|
@@ -2862,7 +2862,7 @@ class Os extends li {
|
|
|
2862
2862
|
* @return {Vector3} The position on the curve.
|
|
2863
2863
|
*/
|
|
2864
2864
|
getPoint(e, t = new _()) {
|
|
2865
|
-
const n = t, i = this.knots[this.startKnot] + e * (this.knots[this.endKnot] - this.knots[this.startKnot]), s =
|
|
2865
|
+
const n = t, i = this.knots[this.startKnot] + e * (this.knots[this.endKnot] - this.knots[this.startKnot]), s = Ms(this.degree, this.knots, this.controlPoints, i);
|
|
2866
2866
|
return s.w !== 1 && s.divideScalar(s.w), n.set(s.x, s.y, s.z);
|
|
2867
2867
|
}
|
|
2868
2868
|
/**
|
|
@@ -3103,7 +3103,7 @@ class _s {
|
|
|
3103
3103
|
// Also parse the texture map and return any textures associated with the material
|
|
3104
3104
|
parseParameters(e, t, n) {
|
|
3105
3105
|
const i = {};
|
|
3106
|
-
e.BumpFactor && (i.bumpScale = e.BumpFactor.value), e.Diffuse ? i.color = me.colorSpaceToWorking(new
|
|
3106
|
+
e.BumpFactor && (i.bumpScale = e.BumpFactor.value), e.Diffuse ? i.color = me.colorSpaceToWorking(new ee().fromArray(e.Diffuse.value), Y) : e.DiffuseColor && (e.DiffuseColor.type === "Color" || e.DiffuseColor.type === "ColorRGB") && (i.color = me.colorSpaceToWorking(new ee().fromArray(e.DiffuseColor.value), Y)), e.DisplacementFactor && (i.displacementScale = e.DisplacementFactor.value), e.Emissive ? i.emissive = me.colorSpaceToWorking(new ee().fromArray(e.Emissive.value), Y) : e.EmissiveColor && (e.EmissiveColor.type === "Color" || e.EmissiveColor.type === "ColorRGB") && (i.emissive = me.colorSpaceToWorking(new ee().fromArray(e.EmissiveColor.value), Y)), e.EmissiveFactor && (i.emissiveIntensity = parseFloat(e.EmissiveFactor.value)), i.opacity = 1 - (e.TransparencyFactor ? parseFloat(e.TransparencyFactor.value) : 0), (i.opacity === 1 || i.opacity === 0) && (i.opacity = e.Opacity ? parseFloat(e.Opacity.value) : null, i.opacity === null && (i.opacity = 1 - (e.TransparentColor ? parseFloat(e.TransparentColor.value[0]) : 0))), i.opacity < 1 && (i.transparent = !0), e.ReflectionFactor && (i.reflectivity = e.ReflectionFactor.value), e.Shininess && (i.shininess = e.Shininess.value), e.Specular ? i.specular = me.colorSpaceToWorking(new ee().fromArray(e.Specular.value), Y) : e.SpecularColor && e.SpecularColor.type === "Color" && (i.specular = me.colorSpaceToWorking(new ee().fromArray(e.SpecularColor.value), Y));
|
|
3107
3107
|
const s = this;
|
|
3108
3108
|
return K.get(n).children.forEach(function(o) {
|
|
3109
3109
|
const a = o.relationship;
|
|
@@ -3295,7 +3295,7 @@ class _s {
|
|
|
3295
3295
|
const s = H.Objects.NodeAttribute[i.ID];
|
|
3296
3296
|
s !== void 0 && (n = s);
|
|
3297
3297
|
}), n === void 0)
|
|
3298
|
-
t = new
|
|
3298
|
+
t = new Me();
|
|
3299
3299
|
else {
|
|
3300
3300
|
let i = 0;
|
|
3301
3301
|
n.CameraProjectionType !== void 0 && n.CameraProjectionType.value === 1 && (i = 1);
|
|
@@ -3314,10 +3314,10 @@ class _s {
|
|
|
3314
3314
|
t = new xn(c, r, s, o), h !== null && t.setFocalLength(h);
|
|
3315
3315
|
break;
|
|
3316
3316
|
case 1:
|
|
3317
|
-
console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."), t = new
|
|
3317
|
+
console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."), t = new Me();
|
|
3318
3318
|
break;
|
|
3319
3319
|
default:
|
|
3320
|
-
console.warn("THREE.FBXLoader: Unknown camera type " + i + "."), t = new
|
|
3320
|
+
console.warn("THREE.FBXLoader: Unknown camera type " + i + "."), t = new Me();
|
|
3321
3321
|
break;
|
|
3322
3322
|
}
|
|
3323
3323
|
}
|
|
@@ -3330,12 +3330,12 @@ class _s {
|
|
|
3330
3330
|
const s = H.Objects.NodeAttribute[i.ID];
|
|
3331
3331
|
s !== void 0 && (n = s);
|
|
3332
3332
|
}), n === void 0)
|
|
3333
|
-
t = new
|
|
3333
|
+
t = new Me();
|
|
3334
3334
|
else {
|
|
3335
3335
|
let i;
|
|
3336
3336
|
n.LightType === void 0 ? i = 0 : i = n.LightType.value;
|
|
3337
3337
|
let s = 16777215;
|
|
3338
|
-
n.Color !== void 0 && (s = me.colorSpaceToWorking(new
|
|
3338
|
+
n.Color !== void 0 && (s = me.colorSpaceToWorking(new ee().fromArray(n.Color.value), Y));
|
|
3339
3339
|
let o = n.Intensity === void 0 ? 1 : n.Intensity.value / 100;
|
|
3340
3340
|
n.CastLightOnObject !== void 0 && n.CastLightOnObject.value === 0 && (o = 0);
|
|
3341
3341
|
let a = 0;
|
|
@@ -3350,9 +3350,9 @@ class _s {
|
|
|
3350
3350
|
break;
|
|
3351
3351
|
case 2:
|
|
3352
3352
|
let r = Math.PI / 3;
|
|
3353
|
-
n.InnerAngle !== void 0 && (r =
|
|
3353
|
+
n.InnerAngle !== void 0 && (r = $.degToRad(n.InnerAngle.value));
|
|
3354
3354
|
let c = 0;
|
|
3355
|
-
n.OuterAngle !== void 0 && (c =
|
|
3355
|
+
n.OuterAngle !== void 0 && (c = $.degToRad(n.OuterAngle.value), c = Math.max(c, 1)), t = new hn(s, o, a, r, c, l);
|
|
3356
3356
|
break;
|
|
3357
3357
|
default:
|
|
3358
3358
|
console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new ft(s, o);
|
|
@@ -3444,7 +3444,7 @@ class _s {
|
|
|
3444
3444
|
if ("AmbientColor" in H.GlobalSettings) {
|
|
3445
3445
|
const e = H.GlobalSettings.AmbientColor.value, t = e[0], n = e[1], i = e[2];
|
|
3446
3446
|
if (t !== 0 || n !== 0 || i !== 0) {
|
|
3447
|
-
const s = new
|
|
3447
|
+
const s = new ee().setRGB(t, n, i, Y);
|
|
3448
3448
|
ie.add(new ci(s, 1));
|
|
3449
3449
|
}
|
|
3450
3450
|
}
|
|
@@ -3562,10 +3562,10 @@ class Ns {
|
|
|
3562
3562
|
s || (console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."), s = !0);
|
|
3563
3563
|
const f = [0, 0, 0, 0], S = [0, 0, 0, 0];
|
|
3564
3564
|
I.forEach(function(k, A) {
|
|
3565
|
-
let
|
|
3565
|
+
let z = k, E = b[A];
|
|
3566
3566
|
S.forEach(function(D, U, w) {
|
|
3567
|
-
if (
|
|
3568
|
-
w[U] =
|
|
3567
|
+
if (z > D) {
|
|
3568
|
+
w[U] = z, z = D;
|
|
3569
3569
|
const v = f[U];
|
|
3570
3570
|
f[U] = E, E = v;
|
|
3571
3571
|
}
|
|
@@ -3691,7 +3691,7 @@ class Ns {
|
|
|
3691
3691
|
const t = e.MappingInformationType, n = e.ReferenceInformationType, i = e.Colors.a;
|
|
3692
3692
|
let s = [];
|
|
3693
3693
|
n === "IndexToDirect" && (s = e.ColorIndex.a);
|
|
3694
|
-
for (let o = 0, a = new
|
|
3694
|
+
for (let o = 0, a = new ee(); o < i.length; o += 4)
|
|
3695
3695
|
a.fromArray(i, o), me.colorSpaceToWorking(a, Y), a.toArray(i, o);
|
|
3696
3696
|
return {
|
|
3697
3697
|
dataSize: 4,
|
|
@@ -3901,7 +3901,7 @@ class Bs {
|
|
|
3901
3901
|
o = u[0], a = u[1];
|
|
3902
3902
|
}
|
|
3903
3903
|
const l = st(0);
|
|
3904
|
-
n !== void 0 && (n = n.map(
|
|
3904
|
+
n !== void 0 && (n = n.map($.degToRad), n.push(l), n = new Ee().fromArray(n), n = new ce().setFromEuler(n)), i !== void 0 && (i = i.map($.degToRad), i.push(l), i = new Ee().fromArray(i), i = new ce().setFromEuler(i).invert());
|
|
3905
3905
|
const r = new ce(), c = new Ee(), h = [];
|
|
3906
3906
|
if (!a || !o) return new yt(e + ".quaternion", [0], [0]);
|
|
3907
3907
|
for (let u = 0; u < a.length; u += 3)
|
|
@@ -3959,7 +3959,7 @@ class Bs {
|
|
|
3959
3959
|
// PI, so we'll interpolate large rotations
|
|
3960
3960
|
interpolateRotations(e, t, n, i) {
|
|
3961
3961
|
const s = [], o = [];
|
|
3962
|
-
s.push(e.times[0]), o.push(
|
|
3962
|
+
s.push(e.times[0]), o.push($.degToRad(e.values[0])), o.push($.degToRad(t.values[0])), o.push($.degToRad(n.values[0]));
|
|
3963
3963
|
for (let a = 1; a < e.values.length; a++) {
|
|
3964
3964
|
const l = [
|
|
3965
3965
|
e.values[a - 1],
|
|
@@ -3968,14 +3968,14 @@ class Bs {
|
|
|
3968
3968
|
];
|
|
3969
3969
|
if (isNaN(l[0]) || isNaN(l[1]) || isNaN(l[2]))
|
|
3970
3970
|
continue;
|
|
3971
|
-
const r = l.map(
|
|
3971
|
+
const r = l.map($.degToRad), c = [
|
|
3972
3972
|
e.values[a],
|
|
3973
3973
|
t.values[a],
|
|
3974
3974
|
n.values[a]
|
|
3975
3975
|
];
|
|
3976
3976
|
if (isNaN(c[0]) || isNaN(c[1]) || isNaN(c[2]))
|
|
3977
3977
|
continue;
|
|
3978
|
-
const h = c.map(
|
|
3978
|
+
const h = c.map($.degToRad), u = [
|
|
3979
3979
|
c[0] - l[0],
|
|
3980
3980
|
c[1] - l[1],
|
|
3981
3981
|
c[2] - l[2]
|
|
@@ -3987,11 +3987,11 @@ class Bs {
|
|
|
3987
3987
|
if (d[0] >= 180 || d[1] >= 180 || d[2] >= 180) {
|
|
3988
3988
|
const y = Math.max(...d) / 180, g = new Ee(...r, i), b = new Ee(...h, i), I = new ce().setFromEuler(g), f = new ce().setFromEuler(b);
|
|
3989
3989
|
I.dot(f) && f.set(-f.x, -f.y, -f.z, -f.w);
|
|
3990
|
-
const S = e.times[a - 1], k = e.times[a] - S, A = new ce(),
|
|
3990
|
+
const S = e.times[a - 1], k = e.times[a] - S, A = new ce(), z = new Ee();
|
|
3991
3991
|
for (let E = 0; E < 1; E += 1 / y)
|
|
3992
|
-
A.copy(I.clone().slerp(f.clone(), E)), s.push(S + E * k),
|
|
3992
|
+
A.copy(I.clone().slerp(f.clone(), E)), s.push(S + E * k), z.setFromQuaternion(A, i), o.push(z.x), o.push(z.y), o.push(z.z);
|
|
3993
3993
|
} else
|
|
3994
|
-
s.push(e.times[a]), o.push(
|
|
3994
|
+
s.push(e.times[a]), o.push($.degToRad(e.values[a])), o.push($.degToRad(t.values[a])), o.push($.degToRad(n.values[a]));
|
|
3995
3995
|
}
|
|
3996
3996
|
return [s, o];
|
|
3997
3997
|
}
|
|
@@ -4374,15 +4374,15 @@ function Pn(p) {
|
|
|
4374
4374
|
p.translation && e.setPosition(De.fromArray(p.translation));
|
|
4375
4375
|
const m = st(0);
|
|
4376
4376
|
if (p.preRotation) {
|
|
4377
|
-
const w = p.preRotation.map(
|
|
4377
|
+
const w = p.preRotation.map($.degToRad);
|
|
4378
4378
|
w.push(m), t.makeRotationFromEuler(Ct.fromArray(w));
|
|
4379
4379
|
}
|
|
4380
4380
|
if (p.rotation) {
|
|
4381
|
-
const w = p.rotation.map(
|
|
4381
|
+
const w = p.rotation.map($.degToRad);
|
|
4382
4382
|
w.push(p.eulerOrder || m), n.makeRotationFromEuler(Ct.fromArray(w));
|
|
4383
4383
|
}
|
|
4384
4384
|
if (p.postRotation) {
|
|
4385
|
-
const w = p.postRotation.map(
|
|
4385
|
+
const w = p.postRotation.map($.degToRad);
|
|
4386
4386
|
w.push(m), i.makeRotationFromEuler(Ct.fromArray(w)), i.invert();
|
|
4387
4387
|
}
|
|
4388
4388
|
p.scale && s.scale(De.fromArray(p.scale)), p.scalingOffset && a.setPosition(De.fromArray(p.scalingOffset)), p.scalingPivot && o.setPosition(De.fromArray(p.scalingPivot)), p.rotationOffset && l.setPosition(De.fromArray(p.rotationOffset)), p.rotationPivot && r.setPosition(De.fromArray(p.rotationPivot)), p.parentMatrixWorld && (h.copy(p.parentMatrix), c.copy(p.parentMatrixWorld));
|
|
@@ -4399,8 +4399,8 @@ function Pn(p) {
|
|
|
4399
4399
|
const v = new G().scale(new _().setFromMatrixScale(h)).clone().invert(), L = f.clone().multiply(v);
|
|
4400
4400
|
k.copy(g).multiply(y).multiply(L).multiply(S);
|
|
4401
4401
|
}
|
|
4402
|
-
const A = r.clone().invert(),
|
|
4403
|
-
let E = e.clone().multiply(l).multiply(r).multiply(t).multiply(n).multiply(i).multiply(A).multiply(a).multiply(o).multiply(s).multiply(
|
|
4402
|
+
const A = r.clone().invert(), z = o.clone().invert();
|
|
4403
|
+
let E = e.clone().multiply(l).multiply(r).multiply(t).multiply(n).multiply(i).multiply(A).multiply(a).multiply(o).multiply(s).multiply(z);
|
|
4404
4404
|
const D = new G().copyPosition(E), U = c.clone().multiply(D);
|
|
4405
4405
|
return u.copyPosition(U), E = u.clone().multiply(k), E.premultiply(c.invert()), E;
|
|
4406
4406
|
}
|
|
@@ -4449,7 +4449,7 @@ class Ks extends mi {
|
|
|
4449
4449
|
i.position.set(0.418, 16.199, 0.3), this.add(i);
|
|
4450
4450
|
const s = new Ie(e, t);
|
|
4451
4451
|
s.position.set(-0.757, 13.219, 0.717), s.scale.set(31.713, 28.305, 28.591), this.add(s);
|
|
4452
|
-
const o = new un(e, n, 6), a = new
|
|
4452
|
+
const o = new un(e, n, 6), a = new Me();
|
|
4453
4453
|
a.position.set(-10.906, 2.009, 1.846), a.rotation.set(0, -0.195, 0), a.scale.set(2.328, 7.905, 4.651), a.updateMatrix(), o.setMatrixAt(0, a.matrix), a.position.set(-5.607, -0.754, -0.758), a.rotation.set(0, 0.994, 0), a.scale.set(1.97, 1.534, 3.955), a.updateMatrix(), o.setMatrixAt(1, a.matrix), a.position.set(6.167, 0.857, 7.803), a.rotation.set(0, 0.561, 0), a.scale.set(3.927, 6.285, 3.687), a.updateMatrix(), o.setMatrixAt(2, a.matrix), a.position.set(-2.017, 0.018, 6.124), a.rotation.set(0, 0.333, 0), a.scale.set(2.002, 4.566, 2.064), a.updateMatrix(), o.setMatrixAt(3, a.matrix), a.position.set(2.291, -0.756, -2.621), a.rotation.set(0, -0.286, 0), a.scale.set(1.546, 1.552, 1.496), a.updateMatrix(), o.setMatrixAt(4, a.matrix), a.position.set(-2.193, -0.369, -5.547), a.rotation.set(0, 0.516, 0), a.scale.set(3.875, 3.487, 2.986), a.updateMatrix(), o.setMatrixAt(5, a.matrix), this.add(o);
|
|
4454
4454
|
const l = new Ie(e, Oe(50));
|
|
4455
4455
|
l.position.set(-16.116, 14.37, 8.208), l.scale.set(0.1, 2.428, 2.739), this.add(l);
|
|
@@ -4537,7 +4537,7 @@ Je.Panel = function(p, e, t) {
|
|
|
4537
4537
|
};
|
|
4538
4538
|
};
|
|
4539
4539
|
let x, ae, le;
|
|
4540
|
-
const T = [0, 0, 0, 0],
|
|
4540
|
+
const T = [0, 0, 0, 0], M = new R.Vector3(), ut = new R.Vector3(), te = new R.Vector3(), dt = new R.Vector3();
|
|
4541
4541
|
new R.Plane();
|
|
4542
4542
|
new R.Ray();
|
|
4543
4543
|
new R.Euler();
|
|
@@ -4850,7 +4850,7 @@ class $s {
|
|
|
4850
4850
|
/// Bone's parent object
|
|
4851
4851
|
vBasis: r.position.clone(),
|
|
4852
4852
|
// Original local position
|
|
4853
|
-
vWorld: r.parent.getWorldPosition(
|
|
4853
|
+
vWorld: r.parent.getWorldPosition(M).clone(),
|
|
4854
4854
|
// World position, parent
|
|
4855
4855
|
qBasis: r.parent.quaternion.clone(),
|
|
4856
4856
|
// Original quaternion, parent
|
|
@@ -4867,7 +4867,7 @@ class $s {
|
|
|
4867
4867
|
ea: [0, 0, 0, 0]
|
|
4868
4868
|
// External acceleration [m/s^2]
|
|
4869
4869
|
};
|
|
4870
|
-
c.boneParent.matrixWorld.decompose(
|
|
4870
|
+
c.boneParent.matrixWorld.decompose(M, ne, te), M.copy(pt).applyQuaternion(ne).setY(0).normalize(), ne.premultiply(sn.setFromUnitVectors(pt, M).invert()).normalize(), c.qWorldInverseYaw = ne.clone().normalize(), this.data.push(c), this.dict[l] = c;
|
|
4871
4871
|
try {
|
|
4872
4872
|
this.setValue(l, "type", s.type), this.setValue(l, "stiffness", s.stiffness), this.setValue(l, "damping", s.damping), this.setValue(l, "external", s.external), this.setValue(l, "limits", s.limits), this.setValue(l, "excludes", s.excludes), this.setValue(l, "deltaLocal", s.deltaLocal), this.setValue(l, "deltaWorld", s.deltaWorld), this.setValue(l, "pivot", s.pivot), this.setValue(l, "helper", s.helper);
|
|
4873
4873
|
} catch (h) {
|
|
@@ -4885,22 +4885,22 @@ class $s {
|
|
|
4885
4885
|
for (this.timerMs += e, e > 1e3 && (this.timerMs = 0), e /= 1e3, t = 0, i = this.objectsUpdate.length; t < i; t++)
|
|
4886
4886
|
o = this.objectsUpdate[t], o.updateMatrix(), o.parent === null ? o.matrixWorld.copy(o.matrix) : o.matrixWorld.multiplyMatrices(o.parent.matrixWorld, o.matrix), o.matrixWorldNeedsUpdate = !1;
|
|
4887
4887
|
for (t = 0, i = this.data.length; t < i; t++) {
|
|
4888
|
-
if (o = this.data[t],
|
|
4888
|
+
if (o = this.data[t], M.copy(o.vWorld), ge.copy(o.boneParent.matrixWorld), ye.copy(ge).invert(), o.vWorld.setFromMatrixPosition(ge), M.applyMatrix4(ye), M.length() > 0.5 && (console.info("Info: Unrealistic jump of " + M.length().toFixed(2) + " meters."), M.setLength(0.5)), M.applyQuaternion(o.bone.quaternion), T[0] = M.x, T[1] = M.y, T[2] = -M.z, T[3] = M.length() / 3, o.children)
|
|
4889
4889
|
for (n = 0, s = o.children.length; n < s; n++)
|
|
4890
4890
|
x = o.children[n], T[0] -= x.v[0] * e / 3, T[1] -= x.v[1] * e / 3, T[2] += x.v[2] * e / 3, T[3] -= x.v[3] * e / 3;
|
|
4891
|
-
if (x = this.opt.sensitivityFactor, T[0] *= o.ext * x, T[1] *= o.ext * x, T[2] *= o.ext * x, T[3] *= o.ext * x, o.isX && (x = T[0] / e, o.ea[0] = (x - o.ev[0]) / e, o.ev[0] = x, o.a[0] = -o.k[0] * o.p[0] - o.c[0] * o.v[0] - o.ea[0], o.p[0] += o.v[0] * e + o.a[0] * e * e / 2 + T[0], x = o.v[0] + o.a[0] * e / 2, x = -o.k[0] * o.p[0] - o.c[0] * x - o.ea[0], o.v[0] = o.v[0] + (x + o.a[0]) * e / 2), o.isY && (x = T[1] / e, o.ea[1] = (x - o.ev[1]) / e, o.ev[1] = x, o.a[1] = -o.k[1] * o.p[1] - o.c[1] * o.v[1] - o.ea[1], o.p[1] += o.v[1] * e + o.a[1] * e * e / 2 + T[1], x = o.v[1] + o.a[1] * e / 2, x = -o.k[1] * o.p[1] - o.c[1] * x - o.ea[1], o.v[1] = o.v[1] + (x + o.a[1]) * e / 2), o.isZ && (x = T[2] / e, o.ea[2] = (x - o.ev[2]) / e, o.ev[2] = x, o.a[2] = -o.k[2] * o.p[2] - o.c[2] * o.v[2] - o.ea[2], o.p[2] += o.v[2] * e + o.a[2] * e * e / 2 + T[2], x = o.v[2] + o.a[2] * e / 2, x = -o.k[2] * o.p[2] - o.c[2] * x - o.ea[2], o.v[2] = o.v[2] + (x + o.a[2]) * e / 2), o.isT && (x = T[3] / e, o.ea[3] = (x - o.ev[3]) / e, o.ev[3] = x, o.a[3] = -o.k[3] * o.p[3] - o.c[3] * o.v[3] - o.ea[3], o.p[3] += o.v[3] * e + o.a[3] * e * e / 2 + T[3], x = o.v[3] + o.a[3] * e / 2, x = -o.k[3] * o.p[3] - o.c[3] * x - o.ea[3], o.v[3] = o.v[3] + (x + o.a[3]) * e / 2), this.timerMs < this.opt.warmupMs && (o.v[0] *= 1e-4, o.p[0] *= 1e-4, o.v[1] *= 1e-4, o.p[1] *= 1e-4, o.v[2] *= 1e-4, o.p[2] *= 1e-4, o.v[3] *= 1e-4, o.p[3] *= 1e-4), T[0] = o.p[0], T[1] = o.p[1], T[2] = o.p[2], T[3] = o.p[3], x = this.opt.movementFactor, T[0] *= x, T[1] *= x, T[2] *= x, T[3] *= x, o.dl && (x = o.dl, T[0] += x[0], T[1] += x[1], T[2] += x[2]), o.dw && (x = o.dw,
|
|
4891
|
+
if (x = this.opt.sensitivityFactor, T[0] *= o.ext * x, T[1] *= o.ext * x, T[2] *= o.ext * x, T[3] *= o.ext * x, o.isX && (x = T[0] / e, o.ea[0] = (x - o.ev[0]) / e, o.ev[0] = x, o.a[0] = -o.k[0] * o.p[0] - o.c[0] * o.v[0] - o.ea[0], o.p[0] += o.v[0] * e + o.a[0] * e * e / 2 + T[0], x = o.v[0] + o.a[0] * e / 2, x = -o.k[0] * o.p[0] - o.c[0] * x - o.ea[0], o.v[0] = o.v[0] + (x + o.a[0]) * e / 2), o.isY && (x = T[1] / e, o.ea[1] = (x - o.ev[1]) / e, o.ev[1] = x, o.a[1] = -o.k[1] * o.p[1] - o.c[1] * o.v[1] - o.ea[1], o.p[1] += o.v[1] * e + o.a[1] * e * e / 2 + T[1], x = o.v[1] + o.a[1] * e / 2, x = -o.k[1] * o.p[1] - o.c[1] * x - o.ea[1], o.v[1] = o.v[1] + (x + o.a[1]) * e / 2), o.isZ && (x = T[2] / e, o.ea[2] = (x - o.ev[2]) / e, o.ev[2] = x, o.a[2] = -o.k[2] * o.p[2] - o.c[2] * o.v[2] - o.ea[2], o.p[2] += o.v[2] * e + o.a[2] * e * e / 2 + T[2], x = o.v[2] + o.a[2] * e / 2, x = -o.k[2] * o.p[2] - o.c[2] * x - o.ea[2], o.v[2] = o.v[2] + (x + o.a[2]) * e / 2), o.isT && (x = T[3] / e, o.ea[3] = (x - o.ev[3]) / e, o.ev[3] = x, o.a[3] = -o.k[3] * o.p[3] - o.c[3] * o.v[3] - o.ea[3], o.p[3] += o.v[3] * e + o.a[3] * e * e / 2 + T[3], x = o.v[3] + o.a[3] * e / 2, x = -o.k[3] * o.p[3] - o.c[3] * x - o.ea[3], o.v[3] = o.v[3] + (x + o.a[3]) * e / 2), this.timerMs < this.opt.warmupMs && (o.v[0] *= 1e-4, o.p[0] *= 1e-4, o.v[1] *= 1e-4, o.p[1] *= 1e-4, o.v[2] *= 1e-4, o.p[2] *= 1e-4, o.v[3] *= 1e-4, o.p[3] *= 1e-4), T[0] = o.p[0], T[1] = o.p[1], T[2] = o.p[2], T[3] = o.p[3], x = this.opt.movementFactor, T[0] *= x, T[1] *= x, T[2] *= x, T[3] *= x, o.dl && (x = o.dl, T[0] += x[0], T[1] += x[1], T[2] += x[2]), o.dw && (x = o.dw, M.set(
|
|
4892
4892
|
o.vBasis.x + T[0],
|
|
4893
4893
|
o.vBasis.y + T[1],
|
|
4894
4894
|
o.vBasis.z + T[2]
|
|
4895
|
-
),
|
|
4895
|
+
), M.applyMatrix4(ge), M.x += x[0], M.y += x[1], M.z += x[2], M.applyMatrix4(ye), T[0] += M.x - o.vBasis.x, T[1] += M.y - o.vBasis.y, T[2] += M.z - o.vBasis.z), o.limits && this.opt.isLimits && (x = o.limits, x[0] && (x[0][0] !== null && T[0] < x[0][0] && (T[0] = x[0][0]), x[0][1] !== null && T[0] > x[0][1] && (T[0] = x[0][1])), x[1] && (x[1][0] !== null && T[1] < x[1][0] && (T[1] = x[1][0]), x[1][1] !== null && T[1] > x[1][1] && (T[1] = x[1][1])), x[2] && (x[2][0] !== null && T[2] < x[2][0] && (T[2] = x[2][0]), x[2][1] !== null && T[2] > x[2][1] && (T[2] = x[2][1])), x[3] && (x[3][0] !== null && T[3] < x[3][0] && (T[3] = x[3][0]), x[3][1] !== null && T[3] > x[3][1] && (T[3] = x[3][1]))), o.isPoint)
|
|
4896
4896
|
o.bone.position.set(
|
|
4897
4897
|
o.vBasis.x + T[0],
|
|
4898
4898
|
o.vBasis.y + T[1],
|
|
4899
4899
|
o.vBasis.z - T[2]
|
|
4900
4900
|
);
|
|
4901
|
-
else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(
|
|
4901
|
+
else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(M, ne, te), M.copy(pt).applyQuaternion(ne).setY(0).normalize(), ne.premultiply(sn.setFromUnitVectors(pt, M).invert()).normalize(), o.boneParent.quaternion.multiply(ne.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (x = Math.atan(T[0] / o.l), ne.setFromAxisAngle(Js, -x), o.boneParent.quaternion.multiply(ne)), o.isY && (x = o.l / 3, x = x * Math.tanh(T[1] / x), o.bone.position.setLength(o.l + x)), o.isX && (x = Math.atan(T[2] / o.l), ne.setFromAxisAngle(qs, -x), o.boneParent.quaternion.multiply(ne)), o.isT && (x = 1.5 * Math.tanh(T[3] * 1.5), ne.setFromAxisAngle(Qs, -x), o.boneParent.quaternion.multiply(ne)), o.boneParent.updateWorldMatrix(!1, !0), o.excludes && this.opt.isExcludes)
|
|
4902
4902
|
for (n = 0, s = o.excludes.length; n < s; n++)
|
|
4903
|
-
x = o.excludes[n], te.set(0, 0, 0), x.deltaLocal && (te.x += x.deltaLocal[0], te.y += x.deltaLocal[1], te.z += x.deltaLocal[2]), te.applyMatrix4(x.bone.matrixWorld), ye.copy(o.boneParent.matrixWorld).invert(), te.applyMatrix4(ye),
|
|
4903
|
+
x = o.excludes[n], te.set(0, 0, 0), x.deltaLocal && (te.x += x.deltaLocal[0], te.y += x.deltaLocal[1], te.z += x.deltaLocal[2]), te.applyMatrix4(x.bone.matrixWorld), ye.copy(o.boneParent.matrixWorld).invert(), te.applyMatrix4(ye), M.copy(o.bone.position), !(M.distanceToSquared(te) >= x.radiusSq) && (le = M.length(), ae = te.length(), !(ae > x.radius + le) && (ae < Math.abs(x.radius - le) || (ae = (ae * ae + le * le - x.radiusSq) / (2 * ae), te.normalize(), dt.copy(te).multiplyScalar(ae), ae = Math.sqrt(le * le - ae * ae), M.subVectors(M, dt).projectOnPlane(te).normalize().multiplyScalar(ae), ut.subVectors(o.vBasis, dt).projectOnPlane(te).normalize(), le = ut.dot(M), le < 0 && (le = Math.sqrt(ae * ae - le * le), ut.multiplyScalar(le), M.add(ut)), M.add(dt).normalize(), te.copy(o.bone.position).normalize(), ne.setFromUnitVectors(te, M), o.boneParent.quaternion.premultiply(ne), o.boneParent.updateWorldMatrix(!1, !0))));
|
|
4904
4904
|
}
|
|
4905
4905
|
this.helpers.isActive && this.updateHelpers();
|
|
4906
4906
|
}
|
|
@@ -4974,14 +4974,14 @@ class $s {
|
|
|
4974
4974
|
ye.copy(this.armature.matrixWorld).invert();
|
|
4975
4975
|
const e = x.object.geometry.getAttribute("position");
|
|
4976
4976
|
for (let t = 0, n = x.bones.length; t < n; t++)
|
|
4977
|
-
ge.multiplyMatrices(ye, x.bones[t].matrixWorld),
|
|
4977
|
+
ge.multiplyMatrices(ye, x.bones[t].matrixWorld), M.setFromMatrixPosition(ge), e.setXYZ(t, M.x, M.y, M.z);
|
|
4978
4978
|
e.needsUpdate = !0, x.object.updateMatrixWorld();
|
|
4979
4979
|
}
|
|
4980
4980
|
if (x = this.helpers.lines, x.bones.length) {
|
|
4981
4981
|
ye.copy(this.armature.matrixWorld).invert();
|
|
4982
4982
|
const e = x.object.geometry.getAttribute("position");
|
|
4983
4983
|
for (let t = 0, n = 0, i = x.bones.length; t < i; t++, n += 2)
|
|
4984
|
-
ge.multiplyMatrices(ye, x.bones[t].matrixWorld),
|
|
4984
|
+
ge.multiplyMatrices(ye, x.bones[t].matrixWorld), M.setFromMatrixPosition(ge), e.setXYZ(n, M.x, M.y, M.z), ge.multiplyMatrices(ye, x.bones[t].parent.matrixWorld), M.setFromMatrixPosition(ge), e.setXYZ(n + 1, M.x, M.y, M.z);
|
|
4985
4985
|
e.needsUpdate = !0, x.object.updateMatrixWorld();
|
|
4986
4986
|
}
|
|
4987
4987
|
}
|
|
@@ -8757,7 +8757,7 @@ class Dn {
|
|
|
8757
8757
|
async showAvatar(e, t = null) {
|
|
8758
8758
|
if (!e || !e.hasOwnProperty("url"))
|
|
8759
8759
|
throw new Error("Invalid parameter. The avatar must have at least 'url' specified.");
|
|
8760
|
-
const n = new
|
|
8760
|
+
const n = new Mi();
|
|
8761
8761
|
if (this.dracoEnabled) {
|
|
8762
8762
|
const r = new ds();
|
|
8763
8763
|
r.setDecoderPath(this.dracoDecoderPath), n.setDRACOLoader(r);
|
|
@@ -9114,7 +9114,7 @@ class Dn {
|
|
|
9114
9114
|
*/
|
|
9115
9115
|
async initializeFBXAnimationLoader() {
|
|
9116
9116
|
try {
|
|
9117
|
-
const { FBXAnimationLoader: e } = await import("./fbxAnimationLoader-
|
|
9117
|
+
const { FBXAnimationLoader: e } = await import("./fbxAnimationLoader-BndnRQYi.js");
|
|
9118
9118
|
this.fbxAnimationLoader = new e(this.armature), console.log("FBX Animation Loader initialized");
|
|
9119
9119
|
} catch (e) {
|
|
9120
9120
|
console.warn("FBX Animation Loader not available:", e), this.fbxAnimationLoader = null;
|
|
@@ -9796,12 +9796,12 @@ class Dn {
|
|
|
9796
9796
|
}), c = ""), h.length)) {
|
|
9797
9797
|
const A = this.lipsyncWordsToVisemes(h, r);
|
|
9798
9798
|
if (A && A.visemes && A.visemes.length) {
|
|
9799
|
-
const
|
|
9799
|
+
const z = A.times[A.visemes.length - 1] + A.durations[A.visemes.length - 1];
|
|
9800
9800
|
for (let E = 0; E < A.visemes.length; E++)
|
|
9801
9801
|
m.push({
|
|
9802
9802
|
mark: u,
|
|
9803
9803
|
template: { name: "viseme" },
|
|
9804
|
-
ts: [(A.times[E] - 0.6) /
|
|
9804
|
+
ts: [(A.times[E] - 0.6) / z, (A.times[E] + 0.5) / z, (A.times[E] + A.durations[E] + 0.5) / z],
|
|
9805
9805
|
vs: {
|
|
9806
9806
|
["viseme_" + A.visemes[E]]: [null, A.visemes[E] === "PP" || A.visemes[E] === "FF" ? 0.9 : 0.6, 0]
|
|
9807
9807
|
}
|
|
@@ -10015,7 +10015,7 @@ class Dn {
|
|
|
10015
10015
|
if (g && g.visemes && g.visemes.length > 0) {
|
|
10016
10016
|
const f = g.times[g.visemes.length - 1] + g.durations[g.visemes.length - 1];
|
|
10017
10017
|
for (let S = 0; S < g.visemes.length; S++) {
|
|
10018
|
-
const k = g.visemes[S], A = g.times[S] / f,
|
|
10018
|
+
const k = g.visemes[S], A = g.times[S] / f, z = g.durations[S] / f, E = A * u, D = z * u;
|
|
10019
10019
|
b.push({
|
|
10020
10020
|
template: { name: "viseme" },
|
|
10021
10021
|
ts: [E - Math.min(60, 2 * D / 3), E + Math.min(25, D / 2), E + D + Math.min(60, D / 2)],
|
|
@@ -11097,7 +11097,7 @@ const On = Ut(({
|
|
|
11097
11097
|
style: y = {},
|
|
11098
11098
|
animations: g = {}
|
|
11099
11099
|
}, b) => {
|
|
11100
|
-
const I =
|
|
11100
|
+
const I = ze(null), f = ze(null), [S, k] = Ue(!0), [A, z] = Ue(null), [E, D] = Ue(!1), U = Wt(), w = i || U.service;
|
|
11101
11101
|
let v;
|
|
11102
11102
|
w === "browser" ? v = {
|
|
11103
11103
|
service: "browser",
|
|
@@ -11131,10 +11131,10 @@ const On = Ut(({
|
|
|
11131
11131
|
ttsService: w,
|
|
11132
11132
|
lipsyncModules: ["en"],
|
|
11133
11133
|
cameraView: c
|
|
11134
|
-
},
|
|
11134
|
+
}, J = B(async () => {
|
|
11135
11135
|
if (!(!I.current || f.current))
|
|
11136
11136
|
try {
|
|
11137
|
-
if (k(!0),
|
|
11137
|
+
if (k(!0), z(null), f.current = new Dn(I.current, F), f.current.controls && (f.current.controls.enableRotate = !1, f.current.controls.enableZoom = !1, f.current.controls.enablePan = !1, f.current.controls.enableDamping = !1), g && Object.keys(g).length > 0 && (f.current.customAnimations = g), await f.current.showAvatar(L, (j) => {
|
|
11138
11138
|
if (j.lengthComputable) {
|
|
11139
11139
|
const W = Math.min(100, Math.round(j.loaded / j.total * 100));
|
|
11140
11140
|
u(W);
|
|
@@ -11158,12 +11158,12 @@ const On = Ut(({
|
|
|
11158
11158
|
document.removeEventListener("visibilitychange", X);
|
|
11159
11159
|
};
|
|
11160
11160
|
} catch (C) {
|
|
11161
|
-
console.error("Error initializing TalkingHead:", C),
|
|
11161
|
+
console.error("Error initializing TalkingHead:", C), z(C.message || "Failed to initialize avatar"), k(!1), d(C);
|
|
11162
11162
|
}
|
|
11163
11163
|
}, [p, e, t, n, i, s, o, r, a, l, c]);
|
|
11164
|
-
mt(() => (
|
|
11164
|
+
mt(() => (J(), () => {
|
|
11165
11165
|
f.current && (f.current.stop(), f.current.dispose(), f.current = null);
|
|
11166
|
-
}), [
|
|
11166
|
+
}), [J]), mt(() => {
|
|
11167
11167
|
if (!I.current || !f.current) return;
|
|
11168
11168
|
const C = new ResizeObserver((j) => {
|
|
11169
11169
|
for (const W of j)
|
|
@@ -11221,7 +11221,7 @@ const On = Ut(({
|
|
|
11221
11221
|
await q(), f.current && f.current.lipsync && (f.current.setSlowdownRate && f.current.setSlowdownRate(1.05), f.current.speakText(C, j));
|
|
11222
11222
|
}, 500);
|
|
11223
11223
|
} catch (j) {
|
|
11224
|
-
console.error("Error speaking text:", j),
|
|
11224
|
+
console.error("Error speaking text:", j), z(j.message || "Failed to speak text");
|
|
11225
11225
|
}
|
|
11226
11226
|
}, [E, q, L.lipsyncLang]), at = B(() => {
|
|
11227
11227
|
f.current && (f.current.stopSpeaking(), f.current.setSlowdownRate && f.current.setSlowdownRate(1));
|
|
@@ -11398,7 +11398,7 @@ const mo = Ut(({
|
|
|
11398
11398
|
style: s = {},
|
|
11399
11399
|
avatarConfig: o = {}
|
|
11400
11400
|
}, a) => {
|
|
11401
|
-
const l =
|
|
11401
|
+
const l = ze(null), r = ze(null), [c, h] = Ue(!0), [u, d] = Ue(null), [m, y] = Ue(!1), g = Wt(), b = o.ttsService || g.service, I = b === "browser" ? {
|
|
11402
11402
|
endpoint: "",
|
|
11403
11403
|
apiKey: null,
|
|
11404
11404
|
defaultVoice: "Google US English"
|
|
@@ -11439,7 +11439,7 @@ const mo = Ut(({
|
|
|
11439
11439
|
}), r.current.morphs && r.current.morphs.length > 0) {
|
|
11440
11440
|
const L = r.current.morphs[0].morphTargetDictionary;
|
|
11441
11441
|
console.log("Available morph targets:", Object.keys(L));
|
|
11442
|
-
const F = Object.keys(L).filter((
|
|
11442
|
+
const F = Object.keys(L).filter((J) => J.startsWith("viseme_"));
|
|
11443
11443
|
console.log("Viseme morph targets found:", F), F.length === 0 && (console.warn("No viseme morph targets found! Lip-sync will not work properly."), console.log("Expected viseme targets: viseme_aa, viseme_E, viseme_I, viseme_O, viseme_U, viseme_PP, viseme_SS, viseme_TH, viseme_DD, viseme_FF, viseme_kk, viseme_nn, viseme_RR, viseme_CH, viseme_sil"));
|
|
11444
11444
|
}
|
|
11445
11445
|
if (await new Promise((L) => {
|
|
@@ -11478,7 +11478,7 @@ const mo = Ut(({
|
|
|
11478
11478
|
}
|
|
11479
11479
|
else
|
|
11480
11480
|
console.warn("Avatar not ready for speaking. isReady:", m, "talkingHeadRef:", !!r.current);
|
|
11481
|
-
}, [m, f]),
|
|
11481
|
+
}, [m, f]), z = B(() => {
|
|
11482
11482
|
r.current && (r.current.stopSpeaking(), r.current.setSlowdownRate && (r.current.setSlowdownRate(1), console.log("Reset timing to normal")));
|
|
11483
11483
|
}, []), E = B((w) => {
|
|
11484
11484
|
r.current && r.current.setMood(w);
|
|
@@ -11499,21 +11499,21 @@ const mo = Ut(({
|
|
|
11499
11499
|
console.log(`Failed to play ${w}:`, F);
|
|
11500
11500
|
try {
|
|
11501
11501
|
r.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
11502
|
-
} catch (
|
|
11503
|
-
console.warn("Fallback animation also failed:",
|
|
11502
|
+
} catch (J) {
|
|
11503
|
+
console.warn("Fallback animation also failed:", J);
|
|
11504
11504
|
}
|
|
11505
11505
|
}
|
|
11506
11506
|
else {
|
|
11507
11507
|
const F = [".fbx", ".glb", ".gltf"];
|
|
11508
|
-
let
|
|
11508
|
+
let J = !1;
|
|
11509
11509
|
for (const q of F)
|
|
11510
11510
|
try {
|
|
11511
|
-
r.current.playAnimation(w + q, null, 10, 0, 0.01, v), console.log("Playing animation:", w + q),
|
|
11511
|
+
r.current.playAnimation(w + q, null, 10, 0, 0.01, v), console.log("Playing animation:", w + q), J = !0;
|
|
11512
11512
|
break;
|
|
11513
11513
|
} catch {
|
|
11514
11514
|
console.log(`Failed to play ${w}${q}, trying next format...`);
|
|
11515
11515
|
}
|
|
11516
|
-
if (!
|
|
11516
|
+
if (!J) {
|
|
11517
11517
|
console.warn("Animation system not available or animation not found:", w);
|
|
11518
11518
|
try {
|
|
11519
11519
|
r.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
@@ -11527,7 +11527,7 @@ const mo = Ut(({
|
|
|
11527
11527
|
}, []);
|
|
11528
11528
|
return Gt(a, () => ({
|
|
11529
11529
|
speakText: A,
|
|
11530
|
-
stopSpeaking:
|
|
11530
|
+
stopSpeaking: z,
|
|
11531
11531
|
setMood: E,
|
|
11532
11532
|
setTimingAdjustment: D,
|
|
11533
11533
|
playAnimation: U,
|
|
@@ -11643,7 +11643,7 @@ const fo = Ut(({
|
|
|
11643
11643
|
},
|
|
11644
11644
|
autoStart: l = !1
|
|
11645
11645
|
}, r) => {
|
|
11646
|
-
const c =
|
|
11646
|
+
const c = ze(null), h = ze({
|
|
11647
11647
|
currentModuleIndex: 0,
|
|
11648
11648
|
currentLessonIndex: 0,
|
|
11649
11649
|
currentQuestionIndex: 0,
|
|
@@ -11653,7 +11653,7 @@ const fo = Ut(({
|
|
|
11653
11653
|
curriculumCompleted: !1,
|
|
11654
11654
|
score: 0,
|
|
11655
11655
|
totalQuestions: 0
|
|
11656
|
-
}), u =
|
|
11656
|
+
}), u = ze({
|
|
11657
11657
|
onLessonStart: n,
|
|
11658
11658
|
onLessonComplete: i,
|
|
11659
11659
|
onQuestionAnswer: s,
|
|
@@ -11700,6 +11700,13 @@ const fo = Ut(({
|
|
|
11700
11700
|
score: h.current.score,
|
|
11701
11701
|
totalQuestions: h.current.totalQuestions,
|
|
11702
11702
|
percentage: v
|
|
11703
|
+
}), u.current.onCustomAction({
|
|
11704
|
+
type: "lessonComplete",
|
|
11705
|
+
moduleIndex: h.current.currentModuleIndex,
|
|
11706
|
+
lessonIndex: h.current.currentLessonIndex,
|
|
11707
|
+
score: h.current.score,
|
|
11708
|
+
totalQuestions: h.current.totalQuestions,
|
|
11709
|
+
percentage: v
|
|
11703
11710
|
}), c.current) {
|
|
11704
11711
|
if (c.current.setMood("happy"), t.lessonComplete)
|
|
11705
11712
|
try {
|
|
@@ -11707,9 +11714,24 @@ const fo = Ut(({
|
|
|
11707
11714
|
} catch {
|
|
11708
11715
|
c.current.playCelebration();
|
|
11709
11716
|
}
|
|
11710
|
-
|
|
11717
|
+
const F = d.modules[h.current.currentModuleIndex];
|
|
11718
|
+
h.current.currentLessonIndex < (F?.lessons?.length || 0) - 1 ? c.current.speakText(L, {
|
|
11719
|
+
lipsyncLang: m.lipsyncLang,
|
|
11720
|
+
onSpeechEnd: () => {
|
|
11721
|
+
setTimeout(() => {
|
|
11722
|
+
A();
|
|
11723
|
+
}, 1e3);
|
|
11724
|
+
}
|
|
11725
|
+
}) : c.current.speakText(L, {
|
|
11726
|
+
lipsyncLang: m.lipsyncLang,
|
|
11727
|
+
onSpeechEnd: () => {
|
|
11728
|
+
setTimeout(() => {
|
|
11729
|
+
f();
|
|
11730
|
+
}, 1e3);
|
|
11731
|
+
}
|
|
11732
|
+
});
|
|
11711
11733
|
}
|
|
11712
|
-
}, [t.lessonComplete, m]), f = B(() => {
|
|
11734
|
+
}, [t.lessonComplete, d, A, f, m]), f = B(() => {
|
|
11713
11735
|
if (h.current.curriculumCompleted = !0, u.current.onCurriculumComplete({
|
|
11714
11736
|
modules: d.modules.length,
|
|
11715
11737
|
totalLessons: d.modules.reduce((v, L) => v + L.lessons.length, 0)
|
|
@@ -11775,8 +11797,14 @@ const fo = Ut(({
|
|
|
11775
11797
|
I();
|
|
11776
11798
|
}, [t.nextQuestion, y, I, g, m]), A = B(() => {
|
|
11777
11799
|
const v = d.modules[h.current.currentModuleIndex];
|
|
11778
|
-
h.current.currentLessonIndex < (v?.lessons?.length || 0) - 1 ? (h.current.currentLessonIndex += 1, h.current.currentQuestionIndex = 0, h.current.lessonCompleted = !1, h.current.
|
|
11779
|
-
|
|
11800
|
+
h.current.currentLessonIndex < (v?.lessons?.length || 0) - 1 ? (h.current.currentLessonIndex += 1, h.current.currentQuestionIndex = 0, h.current.lessonCompleted = !1, h.current.isQuestionMode = !1, h.current.isTeaching = !1, h.current.score = 0, h.current.totalQuestions = 0, u.current.onCustomAction({
|
|
11801
|
+
type: "lessonStart",
|
|
11802
|
+
moduleIndex: h.current.currentModuleIndex,
|
|
11803
|
+
lessonIndex: h.current.currentLessonIndex
|
|
11804
|
+
}), c.current && (c.current.setMood("happy"), c.current.setBodyMovement("idle"), setTimeout(() => {
|
|
11805
|
+
z();
|
|
11806
|
+
}, 500))) : f();
|
|
11807
|
+
}, [d, f, z]), z = B(() => {
|
|
11780
11808
|
const v = y();
|
|
11781
11809
|
if (c.current && c.current.isReady && v?.avatar_script) {
|
|
11782
11810
|
h.current.isTeaching = !0, h.current.isQuestionMode = !1, c.current.setMood("happy");
|
|
@@ -11818,8 +11846,8 @@ const fo = Ut(({
|
|
|
11818
11846
|
c.current.setBodyMovement("happy");
|
|
11819
11847
|
}
|
|
11820
11848
|
c.current.setBodyMovement("gesturing");
|
|
11821
|
-
const
|
|
11822
|
-
c.current.speakText(
|
|
11849
|
+
const J = L.type === "code_test" ? `Great job! Your code passed all the tests! ${L.explanation || ""}` : `Excellent! That's correct! ${L.explanation || ""}`;
|
|
11850
|
+
c.current.speakText(J, {
|
|
11823
11851
|
lipsyncLang: m.lipsyncLang,
|
|
11824
11852
|
onSpeechEnd: () => {
|
|
11825
11853
|
setTimeout(() => {
|
|
@@ -11835,8 +11863,8 @@ const fo = Ut(({
|
|
|
11835
11863
|
c.current.setBodyMovement("idle");
|
|
11836
11864
|
}
|
|
11837
11865
|
c.current.setBodyMovement("gesturing");
|
|
11838
|
-
const
|
|
11839
|
-
c.current.speakText(
|
|
11866
|
+
const J = L.type === "code_test" ? `Your code didn't pass all the tests. ${L.explanation || "Try again!"}` : `Not quite right, but don't worry! ${L.explanation || ""} Let's move on to the next question.`;
|
|
11867
|
+
c.current.speakText(J, {
|
|
11840
11868
|
lipsyncLang: m.lipsyncLang,
|
|
11841
11869
|
onSpeechEnd: () => {
|
|
11842
11870
|
setTimeout(() => {
|
|
@@ -11881,12 +11909,12 @@ const fo = Ut(({
|
|
|
11881
11909
|
console.log("Avatar is ready!", v);
|
|
11882
11910
|
const L = y();
|
|
11883
11911
|
l && L?.avatar_script && setTimeout(() => {
|
|
11884
|
-
|
|
11912
|
+
z();
|
|
11885
11913
|
}, 1e3);
|
|
11886
|
-
}, [l, y,
|
|
11914
|
+
}, [l, y, z]);
|
|
11887
11915
|
return Gt(r, () => ({
|
|
11888
11916
|
// Curriculum control methods
|
|
11889
|
-
startTeaching:
|
|
11917
|
+
startTeaching: z,
|
|
11890
11918
|
startQuestions: S,
|
|
11891
11919
|
handleAnswerSelect: E,
|
|
11892
11920
|
handleCodeTestResult: D,
|
|
@@ -11943,7 +11971,7 @@ const fo = Ut(({
|
|
|
11943
11971
|
handleResize: () => c.current?.handleResize(),
|
|
11944
11972
|
// Avatar readiness check (always returns current value)
|
|
11945
11973
|
isAvatarReady: () => c.current?.isReady || !1
|
|
11946
|
-
}), [
|
|
11974
|
+
}), [z, S, E, D, k, A, I, f, U, g, y]), /* @__PURE__ */ Te("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ Te(
|
|
11947
11975
|
On,
|
|
11948
11976
|
{
|
|
11949
11977
|
ref: c,
|