@sage-rsc/talking-head-react 1.0.28 → 1.0.29
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-xd44uqKF.js → fbxAnimationLoader-Bsel7DtJ.js} +1 -1
- package/dist/{fbxAnimationLoader-BAdAJQ7P.cjs → fbxAnimationLoader-C_QSrujX.cjs} +1 -1
- package/dist/{index-zMY6cyU2.js → index-BvDk1TRw.js} +206 -202
- package/dist/{index-Dx7mDKJm.cjs → index-C3A1_CcE.cjs} +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/CurriculumLearning.jsx +19 -12
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as rn, jsx as Ee } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as Ut, useRef as Re, useState as Ge, useCallback as
|
|
2
|
+
import { forwardRef as Ut, useRef as Re, useState as Ge, 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
|
|
5
|
-
const Zt = { type: "change" }, Vt = { type: "start" }, In = { type: "end" },
|
|
4
|
+
import { Controls as Nn, Vector3 as _, MOUSE as Ve, TOUCH as Ne, Quaternion as de, Spherical as jt, Vector2 as le, Ray as Bn, Plane as Un, MathUtils as ee, TrianglesDrawMode as Gn, TriangleFanDrawMode as Mt, TriangleStripDrawMode as ln, Loader as et, LoaderUtils as We, FileLoader as tt, MeshPhysicalMaterial as Ae, Color as te, LinearSRGBColorSpace as ve, SRGBColorSpace as q, SpotLight as cn, PointLight as ft, DirectionalLight as hn, Matrix4 as G, InstancedMesh as un, InstancedBufferAttribute as Vn, Object3D as He, TextureLoader as dn, ImageBitmapLoader as Wn, BufferAttribute as Ke, 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 nt, MirroredRepeatWrapping as qn, ClampToEdgeWrapping as Ht, PointsMaterial as Qn, Material as vt, LineBasicMaterial as fn, MeshStandardMaterial as gt, DoubleSide as Jn, MeshBasicMaterial as Ye, PropertyBinding as it, BufferGeometry as qe, SkinnedMesh as gn, Mesh as Se, 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 ge, FrontSide as si, Interpolant as oi, Box3 as ai, Sphere as ri, Vector4 as st, Curve as li, MeshPhongMaterial as lt, MeshLambertMaterial as An, EquirectangularReflectionMapping as ci, AmbientLight as hi, Float32BufferAttribute as De, Uint16BufferAttribute as ui, Matrix3 as di, ShapeUtils as pi, Euler as ze, Scene as mi, BoxGeometry as fi, BackSide as gi } from "three";
|
|
5
|
+
const Zt = { type: "change" }, Vt = { type: "start" }, In = { type: "end" }, ct = new Bn(), Yt = new Un(), yi = Math.cos(70 * ee.DEG2RAD), $ = new _(), ae = 2 * Math.PI, N = {
|
|
6
6
|
NONE: -1,
|
|
7
7
|
ROTATE: 0,
|
|
8
8
|
DOLLY: 1,
|
|
@@ -20,7 +20,7 @@ class xi extends Nn {
|
|
|
20
20
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
21
21
|
*/
|
|
22
22
|
constructor(e, t = null) {
|
|
23
|
-
super(e, t), this.state =
|
|
23
|
+
super(e, t), this.state = N.NONE, this.target = new _(), this.cursor = new _(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Ve.ROTATE, MIDDLE: Ve.DOLLY, RIGHT: Ve.PAN }, this.touches = { ONE: Ne.ROTATE, TWO: Ne.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new _(), this._lastQuaternion = new de(), this._lastTargetPosition = new _(), this._quat = new de().setFromUnitVectors(e.up, new _(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new jt(), this._sphericalDelta = new jt(), this._scale = 1, this._panOffset = new _(), this._rotateStart = new le(), this._rotateEnd = new le(), this._rotateDelta = new le(), this._panStart = new le(), this._panEnd = new le(), this._panDelta = new le(), this._dollyStart = new le(), this._dollyEnd = new le(), this._dollyDelta = new le(), this._dollyDirection = new _(), this._mouse = new le(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Ri.bind(this), this._onPointerDown = bi.bind(this), this._onPointerUp = vi.bind(this), this._onContextMenu = ki.bind(this), this._onMouseWheel = Li.bind(this), this._onKeyDown = wi.bind(this), this._onTouchStart = Si.bind(this), this._onTouchMove = Ti.bind(this), this._onMouseDown = Ai.bind(this), this._onMouseMove = Ii.bind(this), this._interceptControlDown = Ci.bind(this), this._interceptControlUp = Ei.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
24
24
|
}
|
|
25
25
|
connect(e) {
|
|
26
26
|
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -81,11 +81,11 @@ class xi extends Nn {
|
|
|
81
81
|
* was called, or the initial state.
|
|
82
82
|
*/
|
|
83
83
|
reset() {
|
|
84
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Zt), this.update(), this.state =
|
|
84
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Zt), this.update(), this.state = N.NONE;
|
|
85
85
|
}
|
|
86
86
|
update(e = null) {
|
|
87
87
|
const t = this.object.position;
|
|
88
|
-
$.copy(t).sub(this.target), $.applyQuaternion(this._quat), this._spherical.setFromVector3($), this.autoRotate && this.state ===
|
|
88
|
+
$.copy(t).sub(this.target), $.applyQuaternion(this._quat), this._spherical.setFromVector3($), this.autoRotate && this.state === N.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
89
89
|
let n = this.minAzimuthAngle, i = this.maxAzimuthAngle;
|
|
90
90
|
isFinite(n) && isFinite(i) && (n < -Math.PI ? n += ae : n > Math.PI && (n -= ae), i < -Math.PI ? i += ae : i > Math.PI && (i -= ae), n <= i ? this._spherical.theta = Math.max(n, Math.min(i, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + i) / 2 ? Math.max(n, this._spherical.theta) : Math.min(i, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
|
|
91
91
|
let s = !1;
|
|
@@ -103,15 +103,15 @@ class xi extends Nn {
|
|
|
103
103
|
const l = a - o;
|
|
104
104
|
this.object.position.addScaledVector(this._dollyDirection, l), this.object.updateMatrixWorld(), s = !!l;
|
|
105
105
|
} else if (this.object.isOrthographicCamera) {
|
|
106
|
-
const a = new
|
|
106
|
+
const a = new _(this._mouse.x, this._mouse.y, 0);
|
|
107
107
|
a.unproject(this.object);
|
|
108
108
|
const l = this.object.zoom;
|
|
109
109
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), s = l !== this.object.zoom;
|
|
110
|
-
const r = new
|
|
110
|
+
const r = new _(this._mouse.x, this._mouse.y, 0);
|
|
111
111
|
r.unproject(this.object), this.object.position.sub(r).add(a), this.object.updateMatrixWorld(), o = $.length();
|
|
112
112
|
} else
|
|
113
113
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
114
|
-
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (
|
|
114
|
+
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (ct.origin.copy(this.object.position), ct.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ct.direction)) < yi ? this.object.lookAt(this.target) : (Yt.setFromNormalAndCoplanarPoint(this.object.up, this.target), ct.intersectPlane(Yt, this.target))));
|
|
115
115
|
} else if (this.object.isOrthographicCamera) {
|
|
116
116
|
const o = this.object.zoom;
|
|
117
117
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), o !== this.object.zoom && (this.object.updateProjectionMatrix(), s = !0);
|
|
@@ -317,7 +317,7 @@ function Ri(p) {
|
|
|
317
317
|
function vi(p) {
|
|
318
318
|
switch (this._removePointer(p), this._pointers.length) {
|
|
319
319
|
case 0:
|
|
320
|
-
this.domElement.releasePointerCapture(p.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(In), this.state =
|
|
320
|
+
this.domElement.releasePointerCapture(p.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(In), this.state = N.NONE;
|
|
321
321
|
break;
|
|
322
322
|
case 1:
|
|
323
323
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -343,49 +343,49 @@ function Ai(p) {
|
|
|
343
343
|
switch (e) {
|
|
344
344
|
case Ve.DOLLY:
|
|
345
345
|
if (this.enableZoom === !1) return;
|
|
346
|
-
this._handleMouseDownDolly(p), this.state =
|
|
346
|
+
this._handleMouseDownDolly(p), this.state = N.DOLLY;
|
|
347
347
|
break;
|
|
348
348
|
case Ve.ROTATE:
|
|
349
349
|
if (p.ctrlKey || p.metaKey || p.shiftKey) {
|
|
350
350
|
if (this.enablePan === !1) return;
|
|
351
|
-
this._handleMouseDownPan(p), this.state =
|
|
351
|
+
this._handleMouseDownPan(p), this.state = N.PAN;
|
|
352
352
|
} else {
|
|
353
353
|
if (this.enableRotate === !1) return;
|
|
354
|
-
this._handleMouseDownRotate(p), this.state =
|
|
354
|
+
this._handleMouseDownRotate(p), this.state = N.ROTATE;
|
|
355
355
|
}
|
|
356
356
|
break;
|
|
357
357
|
case Ve.PAN:
|
|
358
358
|
if (p.ctrlKey || p.metaKey || p.shiftKey) {
|
|
359
359
|
if (this.enableRotate === !1) return;
|
|
360
|
-
this._handleMouseDownRotate(p), this.state =
|
|
360
|
+
this._handleMouseDownRotate(p), this.state = N.ROTATE;
|
|
361
361
|
} else {
|
|
362
362
|
if (this.enablePan === !1) return;
|
|
363
|
-
this._handleMouseDownPan(p), this.state =
|
|
363
|
+
this._handleMouseDownPan(p), this.state = N.PAN;
|
|
364
364
|
}
|
|
365
365
|
break;
|
|
366
366
|
default:
|
|
367
|
-
this.state =
|
|
367
|
+
this.state = N.NONE;
|
|
368
368
|
}
|
|
369
|
-
this.state !==
|
|
369
|
+
this.state !== N.NONE && this.dispatchEvent(Vt);
|
|
370
370
|
}
|
|
371
371
|
function Ii(p) {
|
|
372
372
|
switch (this.state) {
|
|
373
|
-
case
|
|
373
|
+
case N.ROTATE:
|
|
374
374
|
if (this.enableRotate === !1) return;
|
|
375
375
|
this._handleMouseMoveRotate(p);
|
|
376
376
|
break;
|
|
377
|
-
case
|
|
377
|
+
case N.DOLLY:
|
|
378
378
|
if (this.enableZoom === !1) return;
|
|
379
379
|
this._handleMouseMoveDolly(p);
|
|
380
380
|
break;
|
|
381
|
-
case
|
|
381
|
+
case N.PAN:
|
|
382
382
|
if (this.enablePan === !1) return;
|
|
383
383
|
this._handleMouseMovePan(p);
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
function Li(p) {
|
|
388
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !==
|
|
388
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== N.NONE || (p.preventDefault(), this.dispatchEvent(Vt), this._handleMouseWheel(this._customWheelEvent(p)), this.dispatchEvent(In));
|
|
389
389
|
}
|
|
390
390
|
function wi(p) {
|
|
391
391
|
this.enabled !== !1 && this._handleKeyDown(p);
|
|
@@ -396,55 +396,55 @@ function Si(p) {
|
|
|
396
396
|
switch (this.touches.ONE) {
|
|
397
397
|
case Ne.ROTATE:
|
|
398
398
|
if (this.enableRotate === !1) return;
|
|
399
|
-
this._handleTouchStartRotate(p), this.state =
|
|
399
|
+
this._handleTouchStartRotate(p), this.state = N.TOUCH_ROTATE;
|
|
400
400
|
break;
|
|
401
401
|
case Ne.PAN:
|
|
402
402
|
if (this.enablePan === !1) return;
|
|
403
|
-
this._handleTouchStartPan(p), this.state =
|
|
403
|
+
this._handleTouchStartPan(p), this.state = N.TOUCH_PAN;
|
|
404
404
|
break;
|
|
405
405
|
default:
|
|
406
|
-
this.state =
|
|
406
|
+
this.state = N.NONE;
|
|
407
407
|
}
|
|
408
408
|
break;
|
|
409
409
|
case 2:
|
|
410
410
|
switch (this.touches.TWO) {
|
|
411
411
|
case Ne.DOLLY_PAN:
|
|
412
412
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
413
|
-
this._handleTouchStartDollyPan(p), this.state =
|
|
413
|
+
this._handleTouchStartDollyPan(p), this.state = N.TOUCH_DOLLY_PAN;
|
|
414
414
|
break;
|
|
415
415
|
case Ne.DOLLY_ROTATE:
|
|
416
416
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
417
|
-
this._handleTouchStartDollyRotate(p), this.state =
|
|
417
|
+
this._handleTouchStartDollyRotate(p), this.state = N.TOUCH_DOLLY_ROTATE;
|
|
418
418
|
break;
|
|
419
419
|
default:
|
|
420
|
-
this.state =
|
|
420
|
+
this.state = N.NONE;
|
|
421
421
|
}
|
|
422
422
|
break;
|
|
423
423
|
default:
|
|
424
|
-
this.state =
|
|
424
|
+
this.state = N.NONE;
|
|
425
425
|
}
|
|
426
|
-
this.state !==
|
|
426
|
+
this.state !== N.NONE && this.dispatchEvent(Vt);
|
|
427
427
|
}
|
|
428
428
|
function Ti(p) {
|
|
429
429
|
switch (this._trackPointer(p), this.state) {
|
|
430
|
-
case
|
|
430
|
+
case N.TOUCH_ROTATE:
|
|
431
431
|
if (this.enableRotate === !1) return;
|
|
432
432
|
this._handleTouchMoveRotate(p), this.update();
|
|
433
433
|
break;
|
|
434
|
-
case
|
|
434
|
+
case N.TOUCH_PAN:
|
|
435
435
|
if (this.enablePan === !1) return;
|
|
436
436
|
this._handleTouchMovePan(p), this.update();
|
|
437
437
|
break;
|
|
438
|
-
case
|
|
438
|
+
case N.TOUCH_DOLLY_PAN:
|
|
439
439
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
440
440
|
this._handleTouchMoveDollyPan(p), this.update();
|
|
441
441
|
break;
|
|
442
|
-
case
|
|
442
|
+
case N.TOUCH_DOLLY_ROTATE:
|
|
443
443
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
444
444
|
this._handleTouchMoveDollyRotate(p), this.update();
|
|
445
445
|
break;
|
|
446
446
|
default:
|
|
447
|
-
this.state =
|
|
447
|
+
this.state = N.NONE;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
function ki(p) {
|
|
@@ -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 Mi extends
|
|
486
|
+
class Mi extends et {
|
|
487
487
|
/**
|
|
488
488
|
* Constructs a new glTF loader.
|
|
489
489
|
*
|
|
@@ -548,7 +548,7 @@ class Mi extends tt {
|
|
|
548
548
|
this.manager.itemStart(e);
|
|
549
549
|
const a = function(r) {
|
|
550
550
|
i ? i(r) : console.error(r), s.manager.itemError(e), s.manager.itemEnd(e);
|
|
551
|
-
}, l = new
|
|
551
|
+
}, l = new tt(this.manager);
|
|
552
552
|
l.setPath(this.path), l.setResponseType("arraybuffer"), l.setRequestHeader(this.requestHeader), l.setWithCredentials(this.withCredentials), l.load(e, function(r) {
|
|
553
553
|
try {
|
|
554
554
|
s.parse(r, o, function(h) {
|
|
@@ -1078,7 +1078,7 @@ class qi {
|
|
|
1078
1078
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((r) => {
|
|
1079
1079
|
const h = r.pop(), c = h.isGroup ? h.children : [h], u = r[0].count, d = [];
|
|
1080
1080
|
for (const m of c) {
|
|
1081
|
-
const y = new G(), g = new
|
|
1081
|
+
const y = new G(), g = new _(), b = new de(), v = new _(1, 1, 1), f = new un(m.geometry, m.material, u);
|
|
1082
1082
|
for (let S = 0; S < u; S++)
|
|
1083
1083
|
l.TRANSLATION && g.fromBufferAttribute(l.TRANSLATION, S), l.ROTATION && b.fromBufferAttribute(l.ROTATION, S), l.SCALE && v.fromBufferAttribute(l.SCALE, S), f.setMatrixAt(S, y.compose(g, b, v));
|
|
1084
1084
|
for (const S in l)
|
|
@@ -1220,7 +1220,7 @@ const ue = {
|
|
|
1220
1220
|
}, Jt = {
|
|
1221
1221
|
33071: Ht,
|
|
1222
1222
|
33648: qn,
|
|
1223
|
-
10497:
|
|
1223
|
+
10497: nt
|
|
1224
1224
|
}, It = {
|
|
1225
1225
|
SCALAR: 1,
|
|
1226
1226
|
VEC2: 2,
|
|
@@ -1363,7 +1363,7 @@ class hs {
|
|
|
1363
1363
|
const l = a.match(/Version\/(\d+)/);
|
|
1364
1364
|
i = n && l ? parseInt(l[1], 10) : -1, s = a.indexOf("Firefox") > -1, o = s ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
1365
1365
|
}
|
|
1366
|
-
typeof createImageBitmap > "u" || n && i < 17 || s && o < 98 ? this.textureLoader = new dn(this.options.manager) : this.textureLoader = new Wn(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new
|
|
1366
|
+
typeof createImageBitmap > "u" || n && i < 17 || s && o < 98 ? this.textureLoader = new dn(this.options.manager) : this.textureLoader = new Wn(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new tt(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
1367
1367
|
}
|
|
1368
1368
|
setExtensions(e) {
|
|
1369
1369
|
this.extensions = e;
|
|
@@ -1620,8 +1620,8 @@ class hs {
|
|
|
1620
1620
|
const b = It.SCALAR, v = Xe[i.sparse.indices.componentType], f = i.sparse.indices.byteOffset || 0, S = i.sparse.values.byteOffset || 0, k = new v(o[1], f, i.sparse.count * b), A = new r(o[2], S, i.sparse.count * l);
|
|
1621
1621
|
a !== null && (g = new Ke(g.array.slice(), g.itemSize, g.normalized)), g.normalized = !1;
|
|
1622
1622
|
for (let z = 0, C = k.length; z < C; z++) {
|
|
1623
|
-
const
|
|
1624
|
-
if (g.setX(
|
|
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 hs {
|
|
|
1651
1651
|
const r = this.loadImageSource(t, n).then(function(h) {
|
|
1652
1652
|
h.flipY = !1, h.name = o.name || a.name || "", h.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (h.name = a.uri);
|
|
1653
1653
|
const u = (s.samplers || {})[o.sampler] || {};
|
|
1654
|
-
return h.magFilter = Qt[u.magFilter] || zt, h.minFilter = Qt[u.minFilter] || pn, h.wrapS = Jt[u.wrapS] ||
|
|
1654
|
+
return h.magFilter = Qt[u.magFilter] || zt, h.minFilter = Qt[u.minFilter] || pn, h.wrapS = Jt[u.wrapS] || nt, h.wrapT = Jt[u.wrapT] || nt, h.generateMipmaps = !h.isCompressedTexture && h.minFilter !== mn && h.minFilter !== zt, i.associations.set(h, { textures: e }), h;
|
|
1655
1655
|
}).catch(function() {
|
|
1656
1656
|
return null;
|
|
1657
1657
|
});
|
|
@@ -1793,7 +1793,7 @@ class hs {
|
|
|
1793
1793
|
* @return {string}
|
|
1794
1794
|
*/
|
|
1795
1795
|
createUniqueName(e) {
|
|
1796
|
-
const t =
|
|
1796
|
+
const t = it.sanitizeNodeName(e || "");
|
|
1797
1797
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
1798
1798
|
}
|
|
1799
1799
|
/**
|
|
@@ -1934,13 +1934,13 @@ class hs {
|
|
|
1934
1934
|
]).then(function(c) {
|
|
1935
1935
|
const u = c[0], d = c[1], m = c[2], y = c[3], g = c[4], b = [];
|
|
1936
1936
|
for (let f = 0, S = u.length; f < S; f++) {
|
|
1937
|
-
const k = u[f], A = d[f], z = m[f], C = y[f],
|
|
1937
|
+
const k = u[f], A = d[f], z = m[f], C = y[f], D = g[f];
|
|
1938
1938
|
if (k === void 0) continue;
|
|
1939
1939
|
k.updateMatrix && k.updateMatrix();
|
|
1940
|
-
const
|
|
1941
|
-
if (
|
|
1942
|
-
for (let L = 0; L <
|
|
1943
|
-
b.push(
|
|
1940
|
+
const U = n._createAnimationTracks(k, A, z, C, D);
|
|
1941
|
+
if (U)
|
|
1942
|
+
for (let L = 0; L < U.length; L++)
|
|
1943
|
+
b.push(U[L]);
|
|
1944
1944
|
}
|
|
1945
1945
|
const v = new Rn(s, void 0, b);
|
|
1946
1946
|
return be(v, i), v;
|
|
@@ -2110,8 +2110,8 @@ function us(p, e, t) {
|
|
|
2110
2110
|
const a = t.json.accessors[n.POSITION], l = a.min, r = a.max;
|
|
2111
2111
|
if (l !== void 0 && r !== void 0) {
|
|
2112
2112
|
if (i.set(
|
|
2113
|
-
new
|
|
2114
|
-
new
|
|
2113
|
+
new _(l[0], l[1], l[2]),
|
|
2114
|
+
new _(r[0], r[1], r[2])
|
|
2115
2115
|
), a.normalized) {
|
|
2116
2116
|
const h = Nt(Xe[a.componentType]);
|
|
2117
2117
|
i.min.multiplyScalar(h), i.max.multiplyScalar(h);
|
|
@@ -2124,7 +2124,7 @@ function us(p, e, t) {
|
|
|
2124
2124
|
return;
|
|
2125
2125
|
const s = e.targets;
|
|
2126
2126
|
if (s !== void 0) {
|
|
2127
|
-
const a = new
|
|
2127
|
+
const a = new _(), l = new _();
|
|
2128
2128
|
for (let r = 0, h = s.length; r < h; r++) {
|
|
2129
2129
|
const c = s[r];
|
|
2130
2130
|
if (c.POSITION !== void 0) {
|
|
@@ -2167,7 +2167,7 @@ function $t(p, e, t) {
|
|
|
2167
2167
|
});
|
|
2168
2168
|
}
|
|
2169
2169
|
const St = /* @__PURE__ */ new WeakMap();
|
|
2170
|
-
class ds extends
|
|
2170
|
+
class ds extends et {
|
|
2171
2171
|
/**
|
|
2172
2172
|
* Constructs a new Draco loader.
|
|
2173
2173
|
*
|
|
@@ -2224,7 +2224,7 @@ class ds extends tt {
|
|
|
2224
2224
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
2225
2225
|
*/
|
|
2226
2226
|
load(e, t, n, i) {
|
|
2227
|
-
const s = new
|
|
2227
|
+
const s = new tt(this.manager);
|
|
2228
2228
|
s.setPath(this.path), s.setResponseType("arraybuffer"), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials), s.load(e, (o) => {
|
|
2229
2229
|
this.parse(o, t, i);
|
|
2230
2230
|
}, n, i);
|
|
@@ -2289,7 +2289,7 @@ class ds extends tt {
|
|
|
2289
2289
|
n.fromBufferAttribute(e, i), ge.colorSpaceToWorking(n, q), e.setXYZ(i, n.r, n.g, n.b);
|
|
2290
2290
|
}
|
|
2291
2291
|
_loadLibrary(e, t) {
|
|
2292
|
-
const n = new
|
|
2292
|
+
const n = new tt(this.manager);
|
|
2293
2293
|
return n.setPath(this.decoderPath), n.setResponseType(t), n.setWithCredentials(this.withCredentials), new Promise((i, s) => {
|
|
2294
2294
|
n.load(e, i, void 0, s);
|
|
2295
2295
|
});
|
|
@@ -2548,19 +2548,19 @@ var Je = (function(p, e, t) {
|
|
|
2548
2548
|
for (a = new Be(n), i = 0; i < n; ++i)
|
|
2549
2549
|
p[i] && (a[i] = Bt[o[p[i] - 1]++] >> 15 - p[i]);
|
|
2550
2550
|
return a;
|
|
2551
|
-
}),
|
|
2551
|
+
}), at = new pe(288);
|
|
2552
2552
|
for (var V = 0; V < 144; ++V)
|
|
2553
|
-
|
|
2553
|
+
at[V] = 8;
|
|
2554
2554
|
for (var V = 144; V < 256; ++V)
|
|
2555
|
-
|
|
2555
|
+
at[V] = 9;
|
|
2556
2556
|
for (var V = 256; V < 280; ++V)
|
|
2557
|
-
|
|
2557
|
+
at[V] = 7;
|
|
2558
2558
|
for (var V = 280; V < 288; ++V)
|
|
2559
|
-
|
|
2559
|
+
at[V] = 8;
|
|
2560
2560
|
var Mn = new pe(32);
|
|
2561
2561
|
for (var V = 0; V < 32; ++V)
|
|
2562
2562
|
Mn[V] = 5;
|
|
2563
|
-
var bs = /* @__PURE__ */ Je(
|
|
2563
|
+
var bs = /* @__PURE__ */ Je(at, 9, 1), Rs = /* @__PURE__ */ Je(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;
|
|
@@ -2601,10 +2601,10 @@ var bs = /* @__PURE__ */ Je(rt, 9, 1), Rs = /* @__PURE__ */ Je(Mn, 5, 1), Tt = f
|
|
|
2601
2601
|
return t || new pe(0);
|
|
2602
2602
|
var o = !t, a = o || e.i != 2, l = e.i;
|
|
2603
2603
|
o && (t = new pe(i * 3));
|
|
2604
|
-
var r = function(
|
|
2604
|
+
var r = function(rt) {
|
|
2605
2605
|
var Fe = t.length;
|
|
2606
|
-
if (
|
|
2607
|
-
var Xt = new pe(Math.max(Fe * 2,
|
|
2606
|
+
if (rt > Fe) {
|
|
2607
|
+
var Xt = new pe(Math.max(Fe * 2, rt));
|
|
2608
2608
|
Xt.set(t), t = Xt;
|
|
2609
2609
|
}
|
|
2610
2610
|
}, h = e.f || 0, c = e.p || 0, u = e.b || 0, d = e.l, m = e.d, y = e.m, g = e.n, b = i * 8;
|
|
@@ -2618,22 +2618,22 @@ var bs = /* @__PURE__ */ Je(rt, 9, 1), Rs = /* @__PURE__ */ Je(Mn, 5, 1), Tt = f
|
|
|
2618
2618
|
else if (v == 2) {
|
|
2619
2619
|
var A = me(p, c, 31) + 257, z = me(p, c + 10, 15) + 4, C = A + me(p, c + 5, 31) + 1;
|
|
2620
2620
|
c += 14;
|
|
2621
|
-
for (var
|
|
2622
|
-
|
|
2621
|
+
for (var D = new pe(C), U = new pe(19), L = 0; L < z; ++L)
|
|
2622
|
+
U[fs[L]] = me(p, c + L * 3, 7);
|
|
2623
2623
|
c += z * 3;
|
|
2624
|
-
for (var
|
|
2624
|
+
for (var F = Tt(U), Z = (1 << F) - 1, J = Je(U, F, 1), L = 0; L < C; ) {
|
|
2625
2625
|
var w = J[me(p, c, Z)];
|
|
2626
2626
|
c += w & 15;
|
|
2627
2627
|
var f = w >> 4;
|
|
2628
2628
|
if (f < 16)
|
|
2629
|
-
|
|
2629
|
+
D[L++] = f;
|
|
2630
2630
|
else {
|
|
2631
2631
|
var I = 0, W = 0;
|
|
2632
|
-
for (f == 16 ? (W = 3 + me(p, c, 3), c += 2, I =
|
|
2633
|
-
|
|
2632
|
+
for (f == 16 ? (W = 3 + me(p, c, 3), c += 2, I = D[L - 1]) : f == 17 ? (W = 3 + me(p, c, 7), c += 3) : f == 18 && (W = 11 + me(p, c, 127), c += 7); W--; )
|
|
2633
|
+
D[L++] = I;
|
|
2634
2634
|
}
|
|
2635
2635
|
}
|
|
2636
|
-
var Ie =
|
|
2636
|
+
var Ie = D.subarray(0, A), ce = D.subarray(A);
|
|
2637
2637
|
y = Tt(Ie), g = Tt(ce), d = Je(Ie, y, 1), m = Je(ce, g, 1);
|
|
2638
2638
|
} else
|
|
2639
2639
|
fe(1);
|
|
@@ -2731,7 +2731,7 @@ function Es(p, e, t, n) {
|
|
|
2731
2731
|
return i;
|
|
2732
2732
|
}
|
|
2733
2733
|
function Ms(p, e, t, n) {
|
|
2734
|
-
const i = zn(p, n, e), s = Es(i, n, p, e), o = new
|
|
2734
|
+
const i = zn(p, n, e), s = Es(i, n, p, e), o = new st(0, 0, 0, 0);
|
|
2735
2735
|
for (let a = 0; a <= p; ++a) {
|
|
2736
2736
|
const l = t[i - p + a], r = s[a], h = l.w * r;
|
|
2737
2737
|
o.x += l.x * h, o.y += l.y * h, o.z += l.z * h, o.w += l.w * r;
|
|
@@ -2802,7 +2802,7 @@ function Hs(p, e, t, n, i) {
|
|
|
2802
2802
|
o[h] = c;
|
|
2803
2803
|
}
|
|
2804
2804
|
for (let h = s + 1; h <= i + 1; ++h)
|
|
2805
|
-
o[h] = new
|
|
2805
|
+
o[h] = new st(0, 0, 0);
|
|
2806
2806
|
return o;
|
|
2807
2807
|
}
|
|
2808
2808
|
function Ps(p, e) {
|
|
@@ -2820,7 +2820,7 @@ function Fs(p) {
|
|
|
2820
2820
|
const e = p.length, t = [], n = [];
|
|
2821
2821
|
for (let s = 0; s < e; ++s) {
|
|
2822
2822
|
const o = p[s];
|
|
2823
|
-
t[s] = new
|
|
2823
|
+
t[s] = new _(o.x, o.y, o.z), n[s] = o.w;
|
|
2824
2824
|
}
|
|
2825
2825
|
const i = [];
|
|
2826
2826
|
for (let s = 0; s < e; ++s) {
|
|
@@ -2851,7 +2851,7 @@ class Os extends li {
|
|
|
2851
2851
|
this.degree = e, this.knots = t, this.controlPoints = [], this.startKnot = i || 0, this.endKnot = s || o;
|
|
2852
2852
|
for (let l = 0; l < a; ++l) {
|
|
2853
2853
|
const r = n[l];
|
|
2854
|
-
this.controlPoints[l] = new
|
|
2854
|
+
this.controlPoints[l] = new st(r.x, r.y, r.z, r.w);
|
|
2855
2855
|
}
|
|
2856
2856
|
}
|
|
2857
2857
|
/**
|
|
@@ -2861,7 +2861,7 @@ class Os extends li {
|
|
|
2861
2861
|
* @param {Vector3} [optionalTarget] - The optional target vector the result is written to.
|
|
2862
2862
|
* @return {Vector3} The position on the curve.
|
|
2863
2863
|
*/
|
|
2864
|
-
getPoint(e, t = new
|
|
2864
|
+
getPoint(e, t = new _()) {
|
|
2865
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
|
}
|
|
@@ -2872,7 +2872,7 @@ class Os extends li {
|
|
|
2872
2872
|
* @param {Vector3} [optionalTarget] - The optional target vector the result is written to.
|
|
2873
2873
|
* @return {Vector3} The tangent vector.
|
|
2874
2874
|
*/
|
|
2875
|
-
getTangent(e, t = new
|
|
2875
|
+
getTangent(e, t = new _()) {
|
|
2876
2876
|
const n = t, i = this.knots[0] + e * (this.knots[this.knots.length - 1] - this.knots[0]), s = Ds(this.degree, this.knots, this.controlPoints, i, 1);
|
|
2877
2877
|
return n.copy(s[1]).normalize(), n;
|
|
2878
2878
|
}
|
|
@@ -2881,11 +2881,11 @@ class Os extends li {
|
|
|
2881
2881
|
return e.degree = this.degree, e.knots = [...this.knots], e.controlPoints = this.controlPoints.map((t) => t.toArray()), e.startKnot = this.startKnot, e.endKnot = this.endKnot, e;
|
|
2882
2882
|
}
|
|
2883
2883
|
fromJSON(e) {
|
|
2884
|
-
return super.fromJSON(e), this.degree = e.degree, this.knots = [...e.knots], this.controlPoints = e.controlPoints.map((t) => new
|
|
2884
|
+
return super.fromJSON(e), this.degree = e.degree, this.knots = [...e.knots], this.controlPoints = e.controlPoints.map((t) => new st(t[0], t[1], t[2], t[3])), this.startKnot = e.startKnot, this.endKnot = e.endKnot, this;
|
|
2885
2885
|
}
|
|
2886
2886
|
}
|
|
2887
2887
|
let H, Q, se;
|
|
2888
|
-
class en extends
|
|
2888
|
+
class en extends et {
|
|
2889
2889
|
/**
|
|
2890
2890
|
* Constructs a new FBX loader.
|
|
2891
2891
|
*
|
|
@@ -2904,7 +2904,7 @@ class en extends tt {
|
|
|
2904
2904
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
2905
2905
|
*/
|
|
2906
2906
|
load(e, t, n, i) {
|
|
2907
|
-
const s = this, o = s.path === "" ? We.extractUrlBase(e) : s.path, a = new
|
|
2907
|
+
const s = this, o = s.path === "" ? We.extractUrlBase(e) : s.path, a = new tt(this.manager);
|
|
2908
2908
|
a.setPath(s.path), a.setResponseType("arraybuffer"), a.setRequestHeader(s.requestHeader), a.setWithCredentials(s.withCredentials), a.load(e, function(l) {
|
|
2909
2909
|
try {
|
|
2910
2910
|
t(s.parse(l, o));
|
|
@@ -3041,7 +3041,7 @@ class _s {
|
|
|
3041
3041
|
const n = this.loadTexture(e, t);
|
|
3042
3042
|
n.ID = e.id, n.name = e.attrName;
|
|
3043
3043
|
const i = e.WrapModeU, s = e.WrapModeV, o = i !== void 0 ? i.value : 0, a = s !== void 0 ? s.value : 0;
|
|
3044
|
-
if (n.wrapS = o === 0 ?
|
|
3044
|
+
if (n.wrapS = o === 0 ? nt : Ht, n.wrapT = a === 0 ? nt : Ht, "Scaling" in e) {
|
|
3045
3045
|
const l = e.Scaling.value;
|
|
3046
3046
|
n.repeat.x = l[0], n.repeat.y = l[1];
|
|
3047
3047
|
}
|
|
@@ -3088,13 +3088,13 @@ class _s {
|
|
|
3088
3088
|
let a;
|
|
3089
3089
|
switch (s.toLowerCase()) {
|
|
3090
3090
|
case "phong":
|
|
3091
|
-
a = new
|
|
3091
|
+
a = new lt();
|
|
3092
3092
|
break;
|
|
3093
3093
|
case "lambert":
|
|
3094
3094
|
a = new An();
|
|
3095
3095
|
break;
|
|
3096
3096
|
default:
|
|
3097
|
-
console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', s), a = new
|
|
3097
|
+
console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', s), a = new lt();
|
|
3098
3098
|
break;
|
|
3099
3099
|
}
|
|
3100
3100
|
return a.setValues(o), a.name = i, a;
|
|
@@ -3268,7 +3268,7 @@ class _s {
|
|
|
3268
3268
|
h = new Qe();
|
|
3269
3269
|
break;
|
|
3270
3270
|
}
|
|
3271
|
-
h.name = l.attrName ?
|
|
3271
|
+
h.name = l.attrName ? it.sanitizeNodeName(l.attrName) : "", h.userData.originalName = l.attrName, h.ID = a;
|
|
3272
3272
|
}
|
|
3273
3273
|
this.getTransformData(h, l), i.set(a, h);
|
|
3274
3274
|
}
|
|
@@ -3282,7 +3282,7 @@ class _s {
|
|
|
3282
3282
|
l.rawBones.forEach(function(r, h) {
|
|
3283
3283
|
if (r.ID === o.ID) {
|
|
3284
3284
|
const c = s;
|
|
3285
|
-
s = new Pt(), s.matrixWorld.copy(r.transformLink), s.name = i ?
|
|
3285
|
+
s = new Pt(), s.matrixWorld.copy(r.transformLink), s.name = i ? it.sanitizeNodeName(i) : "", s.userData.originalName = i, s.ID = n, l.bones[h] = s, c !== null && s.add(c);
|
|
3286
3286
|
}
|
|
3287
3287
|
});
|
|
3288
3288
|
}
|
|
@@ -3367,8 +3367,8 @@ class _s {
|
|
|
3367
3367
|
const a = [];
|
|
3368
3368
|
if (e.children.forEach(function(l) {
|
|
3369
3369
|
t.has(l.ID) && (s = t.get(l.ID)), n.has(l.ID) && a.push(n.get(l.ID));
|
|
3370
|
-
}), a.length > 1 ? o = a : a.length > 0 ? o = a[0] : (o = new
|
|
3371
|
-
name:
|
|
3370
|
+
}), a.length > 1 ? o = a : a.length > 0 ? o = a[0] : (o = new lt({
|
|
3371
|
+
name: et.DEFAULT_MATERIAL_NAME,
|
|
3372
3372
|
color: 13421772
|
|
3373
3373
|
}), a.push(o)), "color" in s.attributes && a.forEach(function(l) {
|
|
3374
3374
|
l.vertexColors = !0;
|
|
@@ -3379,7 +3379,7 @@ class _s {
|
|
|
3379
3379
|
(c.materialIndex < 0 || c.materialIndex >= a.length) && (c.materialIndex = a.length, l = !0);
|
|
3380
3380
|
}
|
|
3381
3381
|
if (l) {
|
|
3382
|
-
const r = new
|
|
3382
|
+
const r = new lt();
|
|
3383
3383
|
a.push(r);
|
|
3384
3384
|
}
|
|
3385
3385
|
}
|
|
@@ -3389,7 +3389,7 @@ class _s {
|
|
|
3389
3389
|
const n = e.children.reduce(function(s, o) {
|
|
3390
3390
|
return t.has(o.ID) && (s = t.get(o.ID)), s;
|
|
3391
3391
|
}, null), i = new fn({
|
|
3392
|
-
name:
|
|
3392
|
+
name: et.DEFAULT_MATERIAL_NAME,
|
|
3393
3393
|
color: 3342591,
|
|
3394
3394
|
linewidth: 1
|
|
3395
3395
|
});
|
|
@@ -3398,7 +3398,7 @@ class _s {
|
|
|
3398
3398
|
// parse the model node for transform data
|
|
3399
3399
|
getTransformData(e, t) {
|
|
3400
3400
|
const n = {};
|
|
3401
|
-
"InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)), "RotationOrder" in t ? n.eulerOrder =
|
|
3401
|
+
"InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)), "RotationOrder" in t ? n.eulerOrder = ot(t.RotationOrder.value) : n.eulerOrder = ot(0), "Lcl_Translation" in t && (n.translation = t.Lcl_Translation.value), "PreRotation" in t && (n.preRotation = t.PreRotation.value), "Lcl_Rotation" in t && (n.rotation = t.Lcl_Rotation.value), "PostRotation" in t && (n.postRotation = t.PostRotation.value), "Lcl_Scaling" in t && (n.scale = t.Lcl_Scaling.value), "ScalingOffset" in t && (n.scalingOffset = t.ScalingOffset.value), "ScalingPivot" in t && (n.scalingPivot = t.ScalingPivot.value), "RotationOffset" in t && (n.rotationOffset = t.RotationOffset.value), "RotationPivot" in t && (n.rotationPivot = t.RotationPivot.value), e.userData.transformData = n;
|
|
3402
3402
|
}
|
|
3403
3403
|
setLookAtProperties(e, t) {
|
|
3404
3404
|
"LookAtProperty" in t && Q.get(e.ID).children.forEach(function(i) {
|
|
@@ -3406,7 +3406,7 @@ class _s {
|
|
|
3406
3406
|
const s = H.Objects.Model[i.ID];
|
|
3407
3407
|
if ("Lcl_Translation" in s) {
|
|
3408
3408
|
const o = s.Lcl_Translation.value;
|
|
3409
|
-
e.target !== void 0 ? (e.target.position.fromArray(o), se.add(e.target)) : e.lookAt(new
|
|
3409
|
+
e.target !== void 0 ? (e.target.position.fromArray(o), se.add(e.target)) : e.lookAt(new _().fromArray(o));
|
|
3410
3410
|
}
|
|
3411
3411
|
}
|
|
3412
3412
|
});
|
|
@@ -3490,7 +3490,7 @@ class Ns {
|
|
|
3490
3490
|
n.morphTargets[c.ID] !== void 0 && s.push(n.morphTargets[c.ID]);
|
|
3491
3491
|
});
|
|
3492
3492
|
const l = o[0], r = {};
|
|
3493
|
-
"RotationOrder" in l && (r.eulerOrder =
|
|
3493
|
+
"RotationOrder" in l && (r.eulerOrder = ot(l.RotationOrder.value)), "InheritType" in l && (r.inheritType = parseInt(l.InheritType.value)), "GeometricTranslation" in l && (r.translation = l.GeometricTranslation.value), "GeometricRotation" in l && (r.rotation = l.GeometricRotation.value), "GeometricScaling" in l && (r.scale = l.GeometricScaling.value);
|
|
3494
3494
|
const h = Pn(r);
|
|
3495
3495
|
return this.genGeometry(t, a, s, h);
|
|
3496
3496
|
}
|
|
@@ -3552,7 +3552,7 @@ class Ns {
|
|
|
3552
3552
|
d < 0 && (d = d ^ -1, g = !0);
|
|
3553
3553
|
let b = [], v = [];
|
|
3554
3554
|
if (o.push(d * 3, d * 3 + 1, d * 3 + 2), e.color) {
|
|
3555
|
-
const f =
|
|
3555
|
+
const f = ht(m, n, d, e.color);
|
|
3556
3556
|
l.push(f[0], f[1], f[2]);
|
|
3557
3557
|
}
|
|
3558
3558
|
if (e.skeleton) {
|
|
@@ -3563,11 +3563,11 @@ class Ns {
|
|
|
3563
3563
|
const f = [0, 0, 0, 0], S = [0, 0, 0, 0];
|
|
3564
3564
|
v.forEach(function(k, A) {
|
|
3565
3565
|
let z = k, C = b[A];
|
|
3566
|
-
S.forEach(function(
|
|
3567
|
-
if (z >
|
|
3568
|
-
L[
|
|
3569
|
-
const
|
|
3570
|
-
f[
|
|
3566
|
+
S.forEach(function(D, U, L) {
|
|
3567
|
+
if (z > D) {
|
|
3568
|
+
L[U] = z, z = D;
|
|
3569
|
+
const F = f[U];
|
|
3570
|
+
f[U] = C, C = F;
|
|
3571
3571
|
}
|
|
3572
3572
|
});
|
|
3573
3573
|
}), b = f, v = S;
|
|
@@ -3578,18 +3578,18 @@ class Ns {
|
|
|
3578
3578
|
h.push(v[f]), c.push(b[f]);
|
|
3579
3579
|
}
|
|
3580
3580
|
if (e.normal) {
|
|
3581
|
-
const f =
|
|
3581
|
+
const f = ht(m, n, d, e.normal);
|
|
3582
3582
|
a.push(f[0], f[1], f[2]);
|
|
3583
3583
|
}
|
|
3584
|
-
e.material && e.material.mappingType !== "AllSame" && (y =
|
|
3585
|
-
const k =
|
|
3584
|
+
e.material && e.material.mappingType !== "AllSame" && (y = ht(m, n, d, e.material)[0], y < 0 && (u.negativeMaterialIndices = !0, y = 0)), e.uv && e.uv.forEach(function(f, S) {
|
|
3585
|
+
const k = ht(m, n, d, f);
|
|
3586
3586
|
r[S] === void 0 && (r[S] = []), r[S].push(k[0]), r[S].push(k[1]);
|
|
3587
3587
|
}), i++, g && (u.genFace(t, e, o, y, a, l, r, h, c, i), n++, i = 0, o = [], a = [], l = [], r = [], h = [], c = []);
|
|
3588
3588
|
}), t;
|
|
3589
3589
|
}
|
|
3590
3590
|
// See https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal
|
|
3591
3591
|
getNormalNewell(e) {
|
|
3592
|
-
const t = new
|
|
3592
|
+
const t = new _(0, 0, 0);
|
|
3593
3593
|
for (let n = 0; n < e.length; n++) {
|
|
3594
3594
|
const i = e[n], s = e[(n + 1) % e.length];
|
|
3595
3595
|
t.x += (i.y - s.y) * (i.z + s.z), t.y += (i.z - s.z) * (i.x + s.x), t.z += (i.x - s.x) * (i.y + s.y);
|
|
@@ -3597,7 +3597,7 @@ class Ns {
|
|
|
3597
3597
|
return t.normalize(), t;
|
|
3598
3598
|
}
|
|
3599
3599
|
getNormalTangentAndBitangent(e) {
|
|
3600
|
-
const t = this.getNormalNewell(e), i = (Math.abs(t.z) > 0.5 ? new
|
|
3600
|
+
const t = this.getNormalNewell(e), i = (Math.abs(t.z) > 0.5 ? new _(0, 1, 0) : new _(0, 0, 1)).cross(t).normalize(), s = t.clone().cross(i).normalize();
|
|
3601
3601
|
return {
|
|
3602
3602
|
normal: t,
|
|
3603
3603
|
tangent: i,
|
|
@@ -3617,7 +3617,7 @@ class Ns {
|
|
|
3617
3617
|
const u = [], d = t.baseVertexPositions || t.vertexPositions;
|
|
3618
3618
|
for (let b = 0; b < n.length; b += 3)
|
|
3619
3619
|
u.push(
|
|
3620
|
-
new
|
|
3620
|
+
new _(
|
|
3621
3621
|
d[n[b]],
|
|
3622
3622
|
d[n[b + 1]],
|
|
3623
3623
|
d[n[b + 2]]
|
|
@@ -3730,7 +3730,7 @@ class Ns {
|
|
|
3730
3730
|
return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", e.Order, e.id), new qe();
|
|
3731
3731
|
const n = t - 1, i = e.KnotVector.a, s = [], o = e.Points.a;
|
|
3732
3732
|
for (let c = 0, u = o.length; c < u; c += 4)
|
|
3733
|
-
s.push(new
|
|
3733
|
+
s.push(new st().fromArray(o, c));
|
|
3734
3734
|
let a, l;
|
|
3735
3735
|
if (e.Form === "Closed")
|
|
3736
3736
|
s.push(s[0]);
|
|
@@ -3818,7 +3818,7 @@ class Bs {
|
|
|
3818
3818
|
return;
|
|
3819
3819
|
}
|
|
3820
3820
|
const d = {
|
|
3821
|
-
modelName: u.attrName ?
|
|
3821
|
+
modelName: u.attrName ? it.sanitizeNodeName(u.attrName) : "",
|
|
3822
3822
|
ID: u.id,
|
|
3823
3823
|
initialPosition: [0, 0, 0],
|
|
3824
3824
|
initialRotation: [0, 0, 0],
|
|
@@ -3835,7 +3835,7 @@ class Bs {
|
|
|
3835
3835
|
const c = Q.get(l.ID).parents.filter(function(b) {
|
|
3836
3836
|
return b.relationship !== void 0;
|
|
3837
3837
|
})[0].ID, u = Q.get(c).parents[0].ID, d = Q.get(u).parents[0].ID, m = Q.get(d).parents[0].ID, y = H.Objects.Model[m], g = {
|
|
3838
|
-
modelName: y.attrName ?
|
|
3838
|
+
modelName: y.attrName ? it.sanitizeNodeName(y.attrName) : "",
|
|
3839
3839
|
morphName: H.Objects.Deformer[c].attrName
|
|
3840
3840
|
};
|
|
3841
3841
|
s[r] = g;
|
|
@@ -3871,7 +3871,7 @@ class Bs {
|
|
|
3871
3871
|
}
|
|
3872
3872
|
generateTracks(e) {
|
|
3873
3873
|
const t = [];
|
|
3874
|
-
let n = new
|
|
3874
|
+
let n = new _(), i = new _();
|
|
3875
3875
|
if (e.transform && e.transform.decompose(n, new de(), i), n = n.toArray(), i = i.toArray(), e.T !== void 0 && Object.keys(e.T.curves).length > 0) {
|
|
3876
3876
|
const s = this.generateVectorTrack(e.modelName, e.T.curves, n, "position");
|
|
3877
3877
|
s !== void 0 && t.push(s);
|
|
@@ -3900,7 +3900,7 @@ class Bs {
|
|
|
3900
3900
|
const u = this.interpolateRotations(t.x, t.y, t.z, s);
|
|
3901
3901
|
o = u[0], a = u[1];
|
|
3902
3902
|
}
|
|
3903
|
-
const l =
|
|
3903
|
+
const l = ot(0);
|
|
3904
3904
|
n !== void 0 && (n = n.map(ee.degToRad), n.push(l), n = new ze().fromArray(n), n = new de().setFromEuler(n)), i !== void 0 && (i = i.map(ee.degToRad), i.push(l), i = new ze().fromArray(i), i = new de().setFromEuler(i).invert());
|
|
3905
3905
|
const r = new de(), h = new ze(), c = [];
|
|
3906
3906
|
if (!a || !o) return new yt(e + ".quaternion", [0], [0]);
|
|
@@ -4346,7 +4346,7 @@ function Xs(p) {
|
|
|
4346
4346
|
return p / 46186158e3;
|
|
4347
4347
|
}
|
|
4348
4348
|
const js = [];
|
|
4349
|
-
function
|
|
4349
|
+
function ht(p, e, t, n) {
|
|
4350
4350
|
let i;
|
|
4351
4351
|
switch (n.mappingType) {
|
|
4352
4352
|
case "ByPolygonVertex":
|
|
@@ -4368,11 +4368,11 @@ function ut(p, e, t, n) {
|
|
|
4368
4368
|
const s = i * n.dataSize, o = s + n.dataSize;
|
|
4369
4369
|
return Ys(js, n.buffer, s, o);
|
|
4370
4370
|
}
|
|
4371
|
-
const Ct = new ze(), Oe = new
|
|
4371
|
+
const Ct = new ze(), Oe = new _();
|
|
4372
4372
|
function Pn(p) {
|
|
4373
4373
|
const e = new G(), t = new G(), n = new G(), i = new G(), s = new G(), o = new G(), a = new G(), l = new G(), r = new G(), h = new G(), c = new G(), u = new G(), d = p.inheritType ? p.inheritType : 0;
|
|
4374
4374
|
p.translation && e.setPosition(Oe.fromArray(p.translation));
|
|
4375
|
-
const m =
|
|
4375
|
+
const m = ot(0);
|
|
4376
4376
|
if (p.preRotation) {
|
|
4377
4377
|
const L = p.preRotation.map(ee.degToRad);
|
|
4378
4378
|
L.push(m), t.makeRotationFromEuler(Ct.fromArray(L));
|
|
@@ -4396,15 +4396,15 @@ function Pn(p) {
|
|
|
4396
4396
|
else if (d === 1)
|
|
4397
4397
|
k.copy(g).multiply(f).multiply(y).multiply(S);
|
|
4398
4398
|
else {
|
|
4399
|
-
const
|
|
4399
|
+
const F = new G().scale(new _().setFromMatrixScale(c)).clone().invert(), Z = f.clone().multiply(F);
|
|
4400
4400
|
k.copy(g).multiply(y).multiply(Z).multiply(S);
|
|
4401
4401
|
}
|
|
4402
4402
|
const A = r.clone().invert(), z = o.clone().invert();
|
|
4403
4403
|
let C = e.clone().multiply(l).multiply(r).multiply(t).multiply(n).multiply(i).multiply(A).multiply(a).multiply(o).multiply(s).multiply(z);
|
|
4404
|
-
const
|
|
4405
|
-
return u.copyPosition(
|
|
4404
|
+
const D = new G().copyPosition(C), U = h.clone().multiply(D);
|
|
4405
|
+
return u.copyPosition(U), C = u.clone().multiply(k), C.premultiply(h.invert()), C;
|
|
4406
4406
|
}
|
|
4407
|
-
function
|
|
4407
|
+
function ot(p) {
|
|
4408
4408
|
p = p || 0;
|
|
4409
4409
|
const e = [
|
|
4410
4410
|
"ZYX",
|
|
@@ -4537,13 +4537,13 @@ $e.Panel = function(p, e, t) {
|
|
|
4537
4537
|
};
|
|
4538
4538
|
};
|
|
4539
4539
|
let x, re, he;
|
|
4540
|
-
const T = [0, 0, 0, 0], M = new R.Vector3(),
|
|
4540
|
+
const T = [0, 0, 0, 0], M = new R.Vector3(), ut = new R.Vector3(), ne = new R.Vector3(), dt = new R.Vector3();
|
|
4541
4541
|
new R.Plane();
|
|
4542
4542
|
new R.Ray();
|
|
4543
4543
|
new R.Euler();
|
|
4544
4544
|
const ie = new R.Quaternion(), sn = new R.Quaternion(), ye = new R.Matrix4(), xe = new R.Matrix4();
|
|
4545
4545
|
new R.Vector3();
|
|
4546
|
-
const
|
|
4546
|
+
const pt = new R.Vector3(0, 0, 1), qs = new R.Vector3(1, 0, 0), Qs = new R.Vector3(0, 1, 0), Js = new R.Vector3(0, 0, 1);
|
|
4547
4547
|
class $s {
|
|
4548
4548
|
constructor(e = null) {
|
|
4549
4549
|
this.opt = Object.assign({
|
|
@@ -4867,7 +4867,7 @@ class $s {
|
|
|
4867
4867
|
ea: [0, 0, 0, 0]
|
|
4868
4868
|
// External acceleration [m/s^2]
|
|
4869
4869
|
};
|
|
4870
|
-
h.boneParent.matrixWorld.decompose(M, ie, ne), M.copy(
|
|
4870
|
+
h.boneParent.matrixWorld.decompose(M, ie, ne), M.copy(pt).applyQuaternion(ie).setY(0).normalize(), ie.premultiply(sn.setFromUnitVectors(pt, M).invert()).normalize(), h.qWorldInverseYaw = ie.clone().normalize(), this.data.push(h), this.dict[l] = h;
|
|
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 (c) {
|
|
@@ -4898,9 +4898,9 @@ class $s {
|
|
|
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(M, ie, ne), M.copy(
|
|
4901
|
+
else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(M, ie, ne), M.copy(pt).applyQuaternion(ie).setY(0).normalize(), ie.premultiply(sn.setFromUnitVectors(pt, M).invert()).normalize(), o.boneParent.quaternion.multiply(ie.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (x = Math.atan(T[0] / o.l), ie.setFromAxisAngle(Js, -x), o.boneParent.quaternion.multiply(ie)), 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), ie.setFromAxisAngle(qs, -x), o.boneParent.quaternion.multiply(ie)), o.isT && (x = 1.5 * Math.tanh(T[3] * 1.5), ie.setFromAxisAngle(Qs, -x), o.boneParent.quaternion.multiply(ie)), 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], ne.set(0, 0, 0), x.deltaLocal && (ne.x += x.deltaLocal[0], ne.y += x.deltaLocal[1], ne.z += x.deltaLocal[2]), ne.applyMatrix4(x.bone.matrixWorld), xe.copy(o.boneParent.matrixWorld).invert(), ne.applyMatrix4(xe), M.copy(o.bone.position), !(M.distanceToSquared(ne) >= x.radiusSq) && (he = M.length(), re = ne.length(), !(re > x.radius + he) && (re < Math.abs(x.radius - he) || (re = (re * re + he * he - x.radiusSq) / (2 * re), ne.normalize(),
|
|
4903
|
+
x = o.excludes[n], ne.set(0, 0, 0), x.deltaLocal && (ne.x += x.deltaLocal[0], ne.y += x.deltaLocal[1], ne.z += x.deltaLocal[2]), ne.applyMatrix4(x.bone.matrixWorld), xe.copy(o.boneParent.matrixWorld).invert(), ne.applyMatrix4(xe), M.copy(o.bone.position), !(M.distanceToSquared(ne) >= x.radiusSq) && (he = M.length(), re = ne.length(), !(re > x.radius + he) && (re < Math.abs(x.radius - he) || (re = (re * re + he * he - x.radiusSq) / (2 * re), ne.normalize(), dt.copy(ne).multiplyScalar(re), re = Math.sqrt(he * he - re * re), M.subVectors(M, dt).projectOnPlane(ne).normalize().multiplyScalar(re), ut.subVectors(o.vBasis, dt).projectOnPlane(ne).normalize(), he = ut.dot(M), he < 0 && (he = Math.sqrt(re * re - he * he), ut.multiplyScalar(he), M.add(ut)), M.add(dt).normalize(), ne.copy(o.bone.position).normalize(), ie.setFromUnitVectors(ne, M), o.boneParent.quaternion.premultiply(ie), o.boneParent.updateWorldMatrix(!1, !0))));
|
|
4904
4904
|
}
|
|
4905
4905
|
this.helpers.isActive && this.updateHelpers();
|
|
4906
4906
|
}
|
|
@@ -7158,7 +7158,7 @@ const ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
7158
7158
|
fr: ao,
|
|
7159
7159
|
fi: lo,
|
|
7160
7160
|
lt: ho
|
|
7161
|
-
}, K = new R.Quaternion(),
|
|
7161
|
+
}, K = new R.Quaternion(), O = new R.Euler(), we = new R.Vector3(), Ce = new R.Vector3(), an = new R.Box3();
|
|
7162
7162
|
new R.Matrix4();
|
|
7163
7163
|
new R.Matrix4();
|
|
7164
7164
|
new R.Vector3();
|
|
@@ -8903,9 +8903,9 @@ class Dn {
|
|
|
8903
8903
|
updatePoseDelta() {
|
|
8904
8904
|
for (const [e, t] of Object.entries(this.poseDelta.props)) {
|
|
8905
8905
|
if (t.x === 0 && t.y === 0 && t.z === 0) continue;
|
|
8906
|
-
|
|
8906
|
+
O.set(t.x, t.y, t.z);
|
|
8907
8907
|
const n = this.poseAvatar.props[e];
|
|
8908
|
-
n.isQuaternion ? (K.setFromEuler(
|
|
8908
|
+
n.isQuaternion ? (K.setFromEuler(O), n.multiply(K)) : n.isVector3 && n.add(O);
|
|
8909
8909
|
}
|
|
8910
8910
|
}
|
|
8911
8911
|
/**
|
|
@@ -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-Bsel7DtJ.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;
|
|
@@ -9688,7 +9688,7 @@ class Dn {
|
|
|
9688
9688
|
}, i.x ? new R.Vector3(i.x, i.y, i.z) : null, !0, i.d);
|
|
9689
9689
|
break;
|
|
9690
9690
|
}
|
|
9691
|
-
if ((l || r) && (
|
|
9691
|
+
if ((l || r) && (O.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), O.x = Math.max(-0.9, Math.min(0.9, 2 * O.x - 0.5)), O.y = Math.max(-0.9, Math.min(0.9, -2.5 * O.y)), l ? (Object.assign(this.mtAvatar.eyesLookDown, { system: O.x < 0 ? -O.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: O.x < 0 ? 0 : O.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: O.y < 0 ? -O.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: O.y < 0 ? 0 : O.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: O.y < 0 ? 0 : O.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: O.y < 0 ? -O.y : 0, needsUpdate: !0 }), r && (n = -this.mtAvatar.bodyRotateY.value, i = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
|
|
9692
9692
|
name: "headmove",
|
|
9693
9693
|
dt: [[1e3, 2e3], [1e3, 2e3, 1, 2], [1e3, 2e3], [1e3, 2e3, 1, 2]],
|
|
9694
9694
|
vs: {
|
|
@@ -10015,10 +10015,10 @@ 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, z = g.durations[S] / f, C = A * u,
|
|
10018
|
+
const k = g.visemes[S], A = g.times[S] / f, z = g.durations[S] / f, C = A * u, D = z * u;
|
|
10019
10019
|
b.push({
|
|
10020
10020
|
template: { name: "viseme" },
|
|
10021
|
-
ts: [C - Math.min(60, 2 *
|
|
10021
|
+
ts: [C - Math.min(60, 2 * D / 3), C + Math.min(25, D / 2), C + D + Math.min(60, D / 2)],
|
|
10022
10022
|
vs: {
|
|
10023
10023
|
["viseme_" + k]: [null, k === "PP" || k === "FF" ? 0.9 : 0.6, 0]
|
|
10024
10024
|
}
|
|
@@ -10579,10 +10579,10 @@ class Dn {
|
|
|
10579
10579
|
}
|
|
10580
10580
|
this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), we.setFromMatrixPosition(this.objectLeftEye.matrixWorld), Ce.setFromMatrixPosition(this.objectRightEye.matrixWorld), we.add(Ce).divideScalar(2), K.copy(this.armature.quaternion), K.multiply(this.poseTarget.props["Hips.quaternion"]), K.multiply(this.poseTarget.props["Spine.quaternion"]), K.multiply(this.poseTarget.props["Spine1.quaternion"]), K.multiply(this.poseTarget.props["Spine2.quaternion"]), K.multiply(this.poseTarget.props["Neck.quaternion"]), K.multiply(this.poseTarget.props["Head.quaternion"]);
|
|
10581
10581
|
const n = new R.Vector3().subVectors(t, we).normalize(), i = Math.atan2(n.x, n.z), s = Math.asin(-n.y);
|
|
10582
|
-
|
|
10583
|
-
const a = new R.Quaternion().setFromEuler(
|
|
10584
|
-
|
|
10585
|
-
let r =
|
|
10582
|
+
O.set(s, i, 0, "YXZ");
|
|
10583
|
+
const a = new R.Quaternion().setFromEuler(O), l = new R.Quaternion().copy(a).multiply(K.clone().invert());
|
|
10584
|
+
O.setFromQuaternion(l, "YXZ");
|
|
10585
|
+
let r = O.x / (40 / 24) + 0.2, h = O.y / (9 / 4), c = Math.min(0.6, Math.max(-0.3, r)), u = Math.min(0.8, Math.max(-0.8, h)), d = (Math.random() - 0.5) / 4, m = (Math.random() - 0.5) / 4;
|
|
10586
10586
|
if (e) {
|
|
10587
10587
|
let y = this.animQueue.findIndex((b) => b.template.name === "lookat");
|
|
10588
10588
|
y !== -1 && this.animQueue.splice(y, 1);
|
|
@@ -10617,8 +10617,8 @@ class Dn {
|
|
|
10617
10617
|
const s = new R.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), o = new R.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), a = new R.Vector3().addVectors(s, o).divideScalar(2);
|
|
10618
10618
|
a.project(this.camera);
|
|
10619
10619
|
let l = (a.x + 1) / 2 * i.width + i.left, r = -(a.y - 1) / 2 * i.height + i.top;
|
|
10620
|
-
e === null && (e = l), t === null && (t = r), K.copy(this.armature.quaternion), K.multiply(this.poseTarget.props["Hips.quaternion"]), K.multiply(this.poseTarget.props["Spine.quaternion"]), K.multiply(this.poseTarget.props["Spine1.quaternion"]), K.multiply(this.poseTarget.props["Spine2.quaternion"]), K.multiply(this.poseTarget.props["Neck.quaternion"]), K.multiply(this.poseTarget.props["Head.quaternion"]),
|
|
10621
|
-
let h =
|
|
10620
|
+
e === null && (e = l), t === null && (t = r), K.copy(this.armature.quaternion), K.multiply(this.poseTarget.props["Hips.quaternion"]), K.multiply(this.poseTarget.props["Spine.quaternion"]), K.multiply(this.poseTarget.props["Spine1.quaternion"]), K.multiply(this.poseTarget.props["Spine2.quaternion"]), K.multiply(this.poseTarget.props["Neck.quaternion"]), K.multiply(this.poseTarget.props["Head.quaternion"]), O.setFromQuaternion(K);
|
|
10621
|
+
let h = O.x / (40 / 24), c = O.y / (9 / 4), u = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), m = Math.max(window.innerWidth - l, l), y = Math.max(window.innerHeight - r, r), g = this.convertRange(t, [r - y, r + y], [-0.3, 0.6]) - h + u, b = this.convertRange(e, [l - m, l + m], [-0.8, 0.8]) - c + d;
|
|
10622
10622
|
g = Math.min(0.6, Math.max(-0.3, g)), b = Math.min(0.8, Math.max(-0.8, b));
|
|
10623
10623
|
let v = (Math.random() - 0.5) / 4, f = (Math.random() - 0.5) / 4;
|
|
10624
10624
|
if (n) {
|
|
@@ -11097,41 +11097,41 @@ const On = Ut(({
|
|
|
11097
11097
|
style: y = {},
|
|
11098
11098
|
animations: g = {}
|
|
11099
11099
|
}, b) => {
|
|
11100
|
-
const v = Re(null), f = Re(null), [S, k] = Ge(!0), [A, z] = Ge(null), [C,
|
|
11101
|
-
let
|
|
11102
|
-
L === "browser" ?
|
|
11100
|
+
const v = Re(null), f = Re(null), [S, k] = Ge(!0), [A, z] = Ge(null), [C, D] = Ge(!1), U = Wt(), L = i || U.service;
|
|
11101
|
+
let F;
|
|
11102
|
+
L === "browser" ? F = {
|
|
11103
11103
|
service: "browser",
|
|
11104
11104
|
endpoint: "",
|
|
11105
11105
|
apiKey: null,
|
|
11106
11106
|
defaultVoice: "Google US English"
|
|
11107
|
-
} : L === "elevenlabs" ?
|
|
11107
|
+
} : L === "elevenlabs" ? F = {
|
|
11108
11108
|
service: "elevenlabs",
|
|
11109
11109
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
11110
|
-
apiKey: o ||
|
|
11111
|
-
defaultVoice: s ||
|
|
11112
|
-
voices:
|
|
11113
|
-
} :
|
|
11114
|
-
...
|
|
11110
|
+
apiKey: o || U.apiKey,
|
|
11111
|
+
defaultVoice: s || U.defaultVoice || Ue.defaultVoice,
|
|
11112
|
+
voices: U.voices || Ue.voices
|
|
11113
|
+
} : F = {
|
|
11114
|
+
...U,
|
|
11115
11115
|
// Override API key if provided via props
|
|
11116
|
-
apiKey: o !== null ? o :
|
|
11116
|
+
apiKey: o !== null ? o : U.apiKey
|
|
11117
11117
|
};
|
|
11118
11118
|
const Z = {
|
|
11119
11119
|
url: p,
|
|
11120
11120
|
body: e,
|
|
11121
11121
|
avatarMood: t,
|
|
11122
11122
|
ttsLang: L === "browser" ? "en-US" : n,
|
|
11123
|
-
ttsVoice: s ||
|
|
11123
|
+
ttsVoice: s || F.defaultVoice,
|
|
11124
11124
|
lipsyncLang: "en",
|
|
11125
11125
|
showFullAvatar: r,
|
|
11126
11126
|
bodyMovement: a,
|
|
11127
11127
|
movementIntensity: l
|
|
11128
11128
|
}, J = {
|
|
11129
|
-
ttsEndpoint:
|
|
11130
|
-
ttsApikey:
|
|
11129
|
+
ttsEndpoint: F.endpoint,
|
|
11130
|
+
ttsApikey: F.apiKey,
|
|
11131
11131
|
ttsService: L,
|
|
11132
11132
|
lipsyncModules: ["en"],
|
|
11133
11133
|
cameraView: h
|
|
11134
|
-
}, w =
|
|
11134
|
+
}, w = B(async () => {
|
|
11135
11135
|
if (!(!v.current || f.current))
|
|
11136
11136
|
try {
|
|
11137
11137
|
if (k(!0), z(null), f.current = new Dn(v.current, J), 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(Z, (Y) => {
|
|
@@ -11150,7 +11150,7 @@ const On = Ut(({
|
|
|
11150
11150
|
} catch (Y) {
|
|
11151
11151
|
console.warn("Error setting full body mode on initialization:", Y);
|
|
11152
11152
|
}
|
|
11153
|
-
f.current && f.current.controls && (f.current.controls.enableRotate = !1, f.current.controls.enableZoom = !1, f.current.controls.enablePan = !1, f.current.controls.enableDamping = !1, f.current.controls.update()), k(!1),
|
|
11153
|
+
f.current && f.current.controls && (f.current.controls.enableRotate = !1, f.current.controls.enableZoom = !1, f.current.controls.enablePan = !1, f.current.controls.enableDamping = !1, f.current.controls.update()), k(!1), D(!0), c(f.current);
|
|
11154
11154
|
const j = () => {
|
|
11155
11155
|
document.visibilityState === "visible" ? f.current?.start() : f.current?.stop();
|
|
11156
11156
|
};
|
|
@@ -11161,9 +11161,9 @@ const On = Ut(({
|
|
|
11161
11161
|
console.error("Error initializing TalkingHead:", E), z(E.message || "Failed to initialize avatar"), k(!1), d(E);
|
|
11162
11162
|
}
|
|
11163
11163
|
}, [p, e, t, n, i, s, o, r, a, l, h]);
|
|
11164
|
-
|
|
11164
|
+
mt(() => (w(), () => {
|
|
11165
11165
|
f.current && (f.current.stop(), f.current.dispose(), f.current = null);
|
|
11166
|
-
}), [w]),
|
|
11166
|
+
}), [w]), mt(() => {
|
|
11167
11167
|
if (!v.current || !f.current) return;
|
|
11168
11168
|
const E = new ResizeObserver((Y) => {
|
|
11169
11169
|
for (const X of Y)
|
|
@@ -11177,14 +11177,14 @@ const On = Ut(({
|
|
|
11177
11177
|
E.disconnect(), window.removeEventListener("resize", j);
|
|
11178
11178
|
};
|
|
11179
11179
|
}, [C]);
|
|
11180
|
-
const I =
|
|
11180
|
+
const I = B(async () => {
|
|
11181
11181
|
if (f.current && f.current.audioCtx)
|
|
11182
11182
|
try {
|
|
11183
11183
|
(f.current.audioCtx.state === "suspended" || f.current.audioCtx.state === "interrupted") && (await f.current.audioCtx.resume(), console.log("Audio context resumed"));
|
|
11184
11184
|
} catch (E) {
|
|
11185
11185
|
console.warn("Failed to resume audio context:", E);
|
|
11186
11186
|
}
|
|
11187
|
-
}, []), W =
|
|
11187
|
+
}, []), W = B(async (E, j = {}) => {
|
|
11188
11188
|
if (f.current && C)
|
|
11189
11189
|
try {
|
|
11190
11190
|
await I();
|
|
@@ -11195,7 +11195,7 @@ const On = Ut(({
|
|
|
11195
11195
|
if (j.onSpeechEnd && f.current) {
|
|
11196
11196
|
const X = f.current, Le = X.onAudioEnd;
|
|
11197
11197
|
let oe = null, Pe = 0;
|
|
11198
|
-
const Rt = 600,
|
|
11198
|
+
const Rt = 600, rt = () => {
|
|
11199
11199
|
if (Pe++, Pe > Rt) {
|
|
11200
11200
|
oe && (clearInterval(oe), oe = null);
|
|
11201
11201
|
try {
|
|
@@ -11214,7 +11214,7 @@ const On = Ut(({
|
|
|
11214
11214
|
}, 100));
|
|
11215
11215
|
};
|
|
11216
11216
|
setTimeout(() => {
|
|
11217
|
-
oe = setInterval(
|
|
11217
|
+
oe = setInterval(rt, 100);
|
|
11218
11218
|
}, 500);
|
|
11219
11219
|
}
|
|
11220
11220
|
f.current.lipsync && Object.keys(f.current.lipsync).length > 0 ? (f.current.setSlowdownRate && f.current.setSlowdownRate(1.05), f.current.speakText(E, Y)) : setTimeout(async () => {
|
|
@@ -11223,13 +11223,13 @@ const On = Ut(({
|
|
|
11223
11223
|
} catch (Y) {
|
|
11224
11224
|
console.error("Error speaking text:", Y), z(Y.message || "Failed to speak text");
|
|
11225
11225
|
}
|
|
11226
|
-
}, [C, I, Z.lipsyncLang]), Ie =
|
|
11226
|
+
}, [C, I, Z.lipsyncLang]), Ie = B(() => {
|
|
11227
11227
|
f.current && (f.current.stopSpeaking(), f.current.setSlowdownRate && f.current.setSlowdownRate(1));
|
|
11228
|
-
}, []), ce =
|
|
11228
|
+
}, []), ce = B((E) => {
|
|
11229
11229
|
f.current && f.current.setMood(E);
|
|
11230
|
-
}, []), xt =
|
|
11230
|
+
}, []), xt = B((E) => {
|
|
11231
11231
|
f.current && f.current.setSlowdownRate && f.current.setSlowdownRate(E);
|
|
11232
|
-
}, []), bt =
|
|
11232
|
+
}, []), bt = B((E, j = !1) => {
|
|
11233
11233
|
if (f.current && f.current.playAnimation) {
|
|
11234
11234
|
if (g && g[E] && (E = g[E]), f.current.setShowFullAvatar)
|
|
11235
11235
|
try {
|
|
@@ -11267,7 +11267,7 @@ const On = Ut(({
|
|
|
11267
11267
|
}
|
|
11268
11268
|
}
|
|
11269
11269
|
}
|
|
11270
|
-
}, [g]), je =
|
|
11270
|
+
}, [g]), je = B(() => {
|
|
11271
11271
|
f.current && f.current.onResize && f.current.onResize();
|
|
11272
11272
|
}, []);
|
|
11273
11273
|
return Gt(b, () => ({
|
|
@@ -11428,7 +11428,7 @@ const mo = Ut(({
|
|
|
11428
11428
|
ttsService: b,
|
|
11429
11429
|
lipsyncModules: ["en"],
|
|
11430
11430
|
cameraView: "upper"
|
|
11431
|
-
}, k =
|
|
11431
|
+
}, k = B(async () => {
|
|
11432
11432
|
if (!(!l.current || r.current))
|
|
11433
11433
|
try {
|
|
11434
11434
|
if (c(!0), d(null), r.current = new Dn(l.current, S), await r.current.showAvatar(f, (Z) => {
|
|
@@ -11454,37 +11454,37 @@ const mo = Ut(({
|
|
|
11454
11454
|
console.warn("Error setting full body mode on initialization:", Z);
|
|
11455
11455
|
}
|
|
11456
11456
|
c(!1), y(!0), n(r.current);
|
|
11457
|
-
const
|
|
11457
|
+
const F = () => {
|
|
11458
11458
|
document.visibilityState === "visible" ? r.current?.start() : r.current?.stop();
|
|
11459
11459
|
};
|
|
11460
|
-
return document.addEventListener("visibilitychange",
|
|
11461
|
-
document.removeEventListener("visibilitychange",
|
|
11460
|
+
return document.addEventListener("visibilitychange", F), () => {
|
|
11461
|
+
document.removeEventListener("visibilitychange", F);
|
|
11462
11462
|
};
|
|
11463
11463
|
} catch (L) {
|
|
11464
11464
|
console.error("Error initializing TalkingHead:", L), d(L.message || "Failed to initialize avatar"), c(!1), t(L);
|
|
11465
11465
|
}
|
|
11466
11466
|
}, []);
|
|
11467
|
-
|
|
11467
|
+
mt(() => (k(), () => {
|
|
11468
11468
|
r.current && (r.current.stop(), r.current.dispose(), r.current = null);
|
|
11469
11469
|
}), [k]);
|
|
11470
|
-
const A =
|
|
11470
|
+
const A = B((L) => {
|
|
11471
11471
|
if (r.current && m)
|
|
11472
11472
|
try {
|
|
11473
11473
|
console.log("Speaking text:", L), console.log("Avatar config:", f), console.log("TalkingHead instance:", r.current), r.current.lipsync && Object.keys(r.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(r.current.lipsync)), r.current.setSlowdownRate && (r.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), r.current.speakText(L)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
|
|
11474
11474
|
r.current && r.current.lipsync ? (console.log("Lip-sync now ready, speaking..."), r.current.setSlowdownRate && (r.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), r.current.speakText(L)) : console.error("Lip-sync still not ready after waiting");
|
|
11475
11475
|
}, 500));
|
|
11476
|
-
} catch (
|
|
11477
|
-
console.error("Error speaking text:",
|
|
11476
|
+
} catch (F) {
|
|
11477
|
+
console.error("Error speaking text:", F), d(F.message || "Failed to speak text");
|
|
11478
11478
|
}
|
|
11479
11479
|
else
|
|
11480
11480
|
console.warn("Avatar not ready for speaking. isReady:", m, "talkingHeadRef:", !!r.current);
|
|
11481
|
-
}, [m, f]), z =
|
|
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
|
-
}, []), C =
|
|
11483
|
+
}, []), C = B((L) => {
|
|
11484
11484
|
r.current && r.current.setMood(L);
|
|
11485
|
-
}, []),
|
|
11485
|
+
}, []), D = B((L) => {
|
|
11486
11486
|
r.current && r.current.setSlowdownRate && (r.current.setSlowdownRate(L), console.log("Timing adjustment set to:", L));
|
|
11487
|
-
}, []),
|
|
11487
|
+
}, []), U = B((L, F = !1) => {
|
|
11488
11488
|
if (r.current && r.current.playAnimation) {
|
|
11489
11489
|
if (r.current.setShowFullAvatar)
|
|
11490
11490
|
try {
|
|
@@ -11494,7 +11494,7 @@ const mo = Ut(({
|
|
|
11494
11494
|
}
|
|
11495
11495
|
if (L.includes("."))
|
|
11496
11496
|
try {
|
|
11497
|
-
r.current.playAnimation(L, null, 10, 0, 0.01,
|
|
11497
|
+
r.current.playAnimation(L, null, 10, 0, 0.01, F), console.log("Playing animation:", L);
|
|
11498
11498
|
} catch (J) {
|
|
11499
11499
|
console.log(`Failed to play ${L}:`, J);
|
|
11500
11500
|
try {
|
|
@@ -11508,7 +11508,7 @@ const mo = Ut(({
|
|
|
11508
11508
|
let w = !1;
|
|
11509
11509
|
for (const I of J)
|
|
11510
11510
|
try {
|
|
11511
|
-
r.current.playAnimation(L + I, null, 10, 0, 0.01,
|
|
11511
|
+
r.current.playAnimation(L + I, null, 10, 0, 0.01, F), console.log("Playing animation:", L + I), w = !0;
|
|
11512
11512
|
break;
|
|
11513
11513
|
} catch {
|
|
11514
11514
|
console.log(`Failed to play ${L}${I}, trying next format...`);
|
|
@@ -11529,16 +11529,16 @@ const mo = Ut(({
|
|
|
11529
11529
|
speakText: A,
|
|
11530
11530
|
stopSpeaking: z,
|
|
11531
11531
|
setMood: C,
|
|
11532
|
-
setTimingAdjustment:
|
|
11533
|
-
playAnimation:
|
|
11532
|
+
setTimingAdjustment: D,
|
|
11533
|
+
playAnimation: U,
|
|
11534
11534
|
isReady: m,
|
|
11535
11535
|
talkingHead: r.current,
|
|
11536
11536
|
setBodyMovement: (L) => {
|
|
11537
11537
|
if (r.current && r.current.setShowFullAvatar && r.current.setBodyMovement)
|
|
11538
11538
|
try {
|
|
11539
11539
|
r.current.setShowFullAvatar(!0), r.current.setBodyMovement(L), console.log("Body movement set with full body mode:", L);
|
|
11540
|
-
} catch (
|
|
11541
|
-
console.warn("Error setting body movement:",
|
|
11540
|
+
} catch (F) {
|
|
11541
|
+
console.warn("Error setting body movement:", F);
|
|
11542
11542
|
}
|
|
11543
11543
|
},
|
|
11544
11544
|
setMovementIntensity: (L) => r.current?.setMovementIntensity(L),
|
|
@@ -11554,8 +11554,8 @@ const mo = Ut(({
|
|
|
11554
11554
|
if (r.current && r.current.setShowFullAvatar && r.current.playReaction)
|
|
11555
11555
|
try {
|
|
11556
11556
|
r.current.setShowFullAvatar(!0), r.current.playReaction(L), console.log("Reaction played with full body mode:", L);
|
|
11557
|
-
} catch (
|
|
11558
|
-
console.warn("Error playing reaction:",
|
|
11557
|
+
} catch (F) {
|
|
11558
|
+
console.warn("Error playing reaction:", F);
|
|
11559
11559
|
}
|
|
11560
11560
|
},
|
|
11561
11561
|
playCelebration: () => {
|
|
@@ -11570,8 +11570,8 @@ const mo = Ut(({
|
|
|
11570
11570
|
if (r.current && r.current.setShowFullAvatar)
|
|
11571
11571
|
try {
|
|
11572
11572
|
r.current.setShowFullAvatar(L), console.log("Show full avatar set to:", L);
|
|
11573
|
-
} catch (
|
|
11574
|
-
console.warn("Error setting showFullAvatar:",
|
|
11573
|
+
} catch (F) {
|
|
11574
|
+
console.warn("Error setting showFullAvatar:", F);
|
|
11575
11575
|
}
|
|
11576
11576
|
},
|
|
11577
11577
|
lockAvatarPosition: () => {
|
|
@@ -11660,7 +11660,7 @@ const fo = Ut(({
|
|
|
11660
11660
|
onCurriculumComplete: o,
|
|
11661
11661
|
onCustomAction: a
|
|
11662
11662
|
}), d = Re(null), m = Re(null), y = Re(null);
|
|
11663
|
-
|
|
11663
|
+
mt(() => {
|
|
11664
11664
|
u.current = {
|
|
11665
11665
|
onLessonStart: n,
|
|
11666
11666
|
onLessonComplete: i,
|
|
@@ -11690,7 +11690,7 @@ const fo = Ut(({
|
|
|
11690
11690
|
animations: t,
|
|
11691
11691
|
lipsyncLang: "en"
|
|
11692
11692
|
// Default lipsync language
|
|
11693
|
-
}, v =
|
|
11693
|
+
}, v = B(() => g.modules[c.current.currentModuleIndex]?.lessons[c.current.currentLessonIndex], [g]), f = B(() => v()?.questions[c.current.currentQuestionIndex], [v]), S = B((w, I) => I.type === "multiple_choice" || I.type === "true_false" ? w === I.answer : I.type === "code_test" && typeof w == "object" && w !== null ? w.passed === !0 : !1, []), k = B(() => {
|
|
11694
11694
|
c.current.lessonCompleted = !0, c.current.isQuestionMode = !1;
|
|
11695
11695
|
const w = c.current.totalQuestions > 0 ? Math.round(c.current.score / c.current.totalQuestions * 100) : 100;
|
|
11696
11696
|
let I = "Congratulations! You've completed this lesson";
|
|
@@ -11731,7 +11731,9 @@ const fo = Ut(({
|
|
|
11731
11731
|
}
|
|
11732
11732
|
});
|
|
11733
11733
|
}
|
|
11734
|
-
}, [t.lessonComplete, g, A, b])
|
|
11734
|
+
}, [t.lessonComplete, g, A, b]);
|
|
11735
|
+
y.current = k;
|
|
11736
|
+
const A = B(() => {
|
|
11735
11737
|
if (c.current.curriculumCompleted = !0, u.current.onCurriculumComplete({
|
|
11736
11738
|
modules: g.modules.length,
|
|
11737
11739
|
totalLessons: g.modules.reduce((w, I) => w + I.lessons.length, 0)
|
|
@@ -11744,7 +11746,7 @@ const fo = Ut(({
|
|
|
11744
11746
|
}
|
|
11745
11747
|
h.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang: b.lipsyncLang });
|
|
11746
11748
|
}
|
|
11747
|
-
}, [t.curriculumComplete, g, b]), z =
|
|
11749
|
+
}, [t.curriculumComplete, g, b]), z = B(() => {
|
|
11748
11750
|
const w = v();
|
|
11749
11751
|
c.current.isQuestionMode = !0, c.current.currentQuestionIndex = 0, c.current.totalQuestions = w?.questions?.length || 0;
|
|
11750
11752
|
const I = f();
|
|
@@ -11764,7 +11766,7 @@ const fo = Ut(({
|
|
|
11764
11766
|
}
|
|
11765
11767
|
I.type === "code_test" ? h.current.speakText(`Let's test your coding skills! Here's your first challenge: ${I.question}`, { lipsyncLang: b.lipsyncLang }) : I.type === "multiple_choice" ? h.current.speakText(`Now let me ask you some questions. Here's the first one: ${I.question}`, { lipsyncLang: b.lipsyncLang }) : I.type === "true_false" ? h.current.speakText(`Let's start with some true or false questions. First question: ${I.question}`, { lipsyncLang: b.lipsyncLang }) : h.current.speakText(`Now let me ask you some questions. Here's the first one: ${I.question}`, { lipsyncLang: b.lipsyncLang });
|
|
11766
11768
|
} else h.current && h.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: b.lipsyncLang });
|
|
11767
|
-
}, [t.questionStart, v, f, b]), C =
|
|
11769
|
+
}, [t.questionStart, v, f, b]), C = B(() => {
|
|
11768
11770
|
const w = v();
|
|
11769
11771
|
if (c.current.currentQuestionIndex < (w?.questions?.length || 0) - 1) {
|
|
11770
11772
|
c.current.currentQuestionIndex += 1;
|
|
@@ -11794,8 +11796,8 @@ const fo = Ut(({
|
|
|
11794
11796
|
});
|
|
11795
11797
|
}
|
|
11796
11798
|
} else
|
|
11797
|
-
|
|
11798
|
-
}, [t.nextQuestion, v,
|
|
11799
|
+
y.current && y.current();
|
|
11800
|
+
}, [t.nextQuestion, v, f, b]), D = B(() => {
|
|
11799
11801
|
const w = g.modules[c.current.currentModuleIndex];
|
|
11800
11802
|
c.current.currentLessonIndex < (w?.lessons?.length || 0) - 1 ? (c.current.currentLessonIndex += 1, c.current.currentQuestionIndex = 0, c.current.lessonCompleted = !1, c.current.isQuestionMode = !1, c.current.isTeaching = !1, c.current.score = 0, c.current.totalQuestions = 0, u.current.onCustomAction({
|
|
11801
11803
|
type: "lessonStart",
|
|
@@ -11804,7 +11806,9 @@ const fo = Ut(({
|
|
|
11804
11806
|
}), h.current && (h.current.setMood("happy"), h.current.setBodyMovement("idle"), setTimeout(() => {
|
|
11805
11807
|
d.current && d.current();
|
|
11806
11808
|
}, 500))) : A();
|
|
11807
|
-
}, [g, A])
|
|
11809
|
+
}, [g, A]);
|
|
11810
|
+
m.current = D;
|
|
11811
|
+
const U = B(() => {
|
|
11808
11812
|
const w = v();
|
|
11809
11813
|
if (h.current && h.current.isReady && w?.avatar_script) {
|
|
11810
11814
|
c.current.isTeaching = !0, c.current.isQuestionMode = !1, h.current.setMood("happy");
|
|
@@ -11828,7 +11832,9 @@ const fo = Ut(({
|
|
|
11828
11832
|
c.current.isTeaching = !1, w.questions && w.questions.length > 0 ? z() : y.current && y.current();
|
|
11829
11833
|
}, 8e3);
|
|
11830
11834
|
}
|
|
11831
|
-
}, [t.teaching, v, z, b])
|
|
11835
|
+
}, [t.teaching, v, z, b]);
|
|
11836
|
+
d.current = U;
|
|
11837
|
+
const L = B((w) => {
|
|
11832
11838
|
const I = f(), W = S(w, I);
|
|
11833
11839
|
if (W && (c.current.score += 1), u.current.onQuestionAnswer({
|
|
11834
11840
|
moduleIndex: c.current.currentModuleIndex,
|
|
@@ -11875,7 +11881,7 @@ const fo = Ut(({
|
|
|
11875
11881
|
}
|
|
11876
11882
|
else
|
|
11877
11883
|
C();
|
|
11878
|
-
}, [t.correct, t.incorrect, f, S, C, b]),
|
|
11884
|
+
}, [t.correct, t.incorrect, f, S, C, b]), F = B((w) => {
|
|
11879
11885
|
const I = f();
|
|
11880
11886
|
if (!w || typeof w != "object") {
|
|
11881
11887
|
console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
|
|
@@ -11903,25 +11909,23 @@ const fo = Ut(({
|
|
|
11903
11909
|
testResult: W,
|
|
11904
11910
|
question: I
|
|
11905
11911
|
}), L(W);
|
|
11906
|
-
}, [f, L]), Z =
|
|
11912
|
+
}, [f, L]), Z = B(() => {
|
|
11907
11913
|
c.current.currentModuleIndex = 0, c.current.currentLessonIndex = 0, c.current.currentQuestionIndex = 0, c.current.isTeaching = !1, c.current.isQuestionMode = !1, c.current.lessonCompleted = !1, c.current.curriculumCompleted = !1, c.current.score = 0, c.current.totalQuestions = 0;
|
|
11908
|
-
}, []), J =
|
|
11914
|
+
}, []), J = B((w) => {
|
|
11909
11915
|
console.log("Avatar is ready!", w);
|
|
11910
11916
|
const I = v();
|
|
11911
11917
|
l && I?.avatar_script && setTimeout(() => {
|
|
11912
|
-
|
|
11918
|
+
d.current && d.current();
|
|
11913
11919
|
}, 1e3);
|
|
11914
|
-
}, [l, v
|
|
11915
|
-
return
|
|
11916
|
-
d.current = O, m.current = F, y.current = k;
|
|
11917
|
-
}, [O, F, k]), Gt(r, () => ({
|
|
11920
|
+
}, [l, v]);
|
|
11921
|
+
return Gt(r, () => ({
|
|
11918
11922
|
// Curriculum control methods
|
|
11919
|
-
startTeaching:
|
|
11923
|
+
startTeaching: U,
|
|
11920
11924
|
startQuestions: z,
|
|
11921
11925
|
handleAnswerSelect: L,
|
|
11922
|
-
handleCodeTestResult:
|
|
11926
|
+
handleCodeTestResult: F,
|
|
11923
11927
|
nextQuestion: C,
|
|
11924
|
-
nextLesson:
|
|
11928
|
+
nextLesson: D,
|
|
11925
11929
|
completeLesson: k,
|
|
11926
11930
|
completeCurriculum: A,
|
|
11927
11931
|
resetCurriculum: Z,
|
|
@@ -11973,7 +11977,7 @@ const fo = Ut(({
|
|
|
11973
11977
|
handleResize: () => h.current?.handleResize(),
|
|
11974
11978
|
// Avatar readiness check (always returns current value)
|
|
11975
11979
|
isAvatarReady: () => h.current?.isReady || !1
|
|
11976
|
-
}), [
|
|
11980
|
+
}), [U, z, L, F, C, D, k, A, Z, f, v]), /* @__PURE__ */ Ee("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ Ee(
|
|
11977
11981
|
On,
|
|
11978
11982
|
{
|
|
11979
11983
|
ref: h,
|