@sage-rsc/talking-head-react 1.0.21 → 1.0.22
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-CVM-Jv5Y.cjs → fbxAnimationLoader-Bs9Qd-Cz.cjs} +1 -1
- package/dist/{fbxAnimationLoader-DzYmybHd.js → fbxAnimationLoader-DRJgB6tB.js} +1 -1
- package/dist/{index-3_k5n4iL.js → index-B58d_xt0.js} +619 -606
- package/dist/{index-BeFzGp0g.cjs → index-BrvgGvOZ.cjs} +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/CurriculumLearning.jsx +66 -26
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as an, jsx as
|
|
2
|
-
import { forwardRef as _t, useRef as ze, useState as
|
|
1
|
+
import { jsxs as an, jsx as Te } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as _t, useRef as ze, useState as Be, useCallback as B, useEffect as ut, useImperativeHandle as Nt } from "react";
|
|
3
3
|
import * as R from "three";
|
|
4
|
-
import { Controls as Nn, Vector3 as _, MOUSE as
|
|
5
|
-
const jt = { type: "change" }, Bt = { type: "start" }, An = { type: "end" }, at = new Bn(), Zt = new Un(), yi = Math.cos(70 *
|
|
4
|
+
import { Controls as Nn, Vector3 as _, MOUSE as Ue, TOUCH as Oe, Quaternion as he, Spherical as Xt, Vector2 as ae, Ray as Bn, Plane as Un, MathUtils as q, TrianglesDrawMode as Gn, TriangleFanDrawMode as kt, TriangleStripDrawMode as rn, Loader as Je, LoaderUtils as Ge, FileLoader as $e, MeshPhysicalMaterial as Re, Color as Q, LinearSRGBColorSpace as be, SRGBColorSpace as X, SpotLight as ln, PointLight as dt, DirectionalLight as hn, Matrix4 as G, InstancedMesh as cn, InstancedBufferAttribute as Vn, Object3D as Ee, TextureLoader as un, ImageBitmapLoader as Wn, BufferAttribute as Ze, InterleavedBuffer as Xn, InterleavedBufferAttribute as jn, LinearMipmapLinearFilter as dn, NearestMipmapLinearFilter as Zn, LinearMipmapNearestFilter as Yn, NearestMipmapNearestFilter as Kn, LinearFilter as Ct, NearestFilter as pn, RepeatWrapping as et, MirroredRepeatWrapping as qn, ClampToEdgeWrapping as Et, PointsMaterial as Qn, Material as xt, LineBasicMaterial as mn, MeshStandardMaterial as pt, DoubleSide as Jn, MeshBasicMaterial as je, PropertyBinding as tt, BufferGeometry as Ye, SkinnedMesh as fn, Mesh as Ae, LineSegments as $n, Line as gn, LineLoop as ei, Points as ti, Group as Ke, PerspectiveCamera as yn, OrthographicCamera as ni, Skeleton as xn, AnimationClip as bn, Bone as zt, InterpolateDiscrete as ii, InterpolateLinear as Rn, Texture as Mt, VectorKeyframeTrack as Ht, NumberKeyframeTrack as Pt, QuaternionKeyframeTrack as mt, ColorManagement as me, FrontSide as si, Interpolant as oi, Box3 as ai, Sphere as ri, Vector4 as nt, Curve as li, MeshPhongMaterial as ot, MeshLambertMaterial as vn, EquirectangularReflectionMapping as hi, AmbientLight as ci, Float32BufferAttribute as Pe, Uint16BufferAttribute as ui, Matrix3 as di, ShapeUtils as pi, Euler as Ce, Scene as mi, BoxGeometry as fi, BackSide as gi } from "three";
|
|
5
|
+
const jt = { type: "change" }, Bt = { type: "start" }, An = { type: "end" }, at = new Bn(), Zt = new Un(), yi = Math.cos(70 * q.DEG2RAD), K = new _(), se = 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 = 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:
|
|
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: Ue.ROTATE, MIDDLE: Ue.DOLLY, RIGHT: Ue.PAN }, this.touches = { ONE: Oe.ROTATE, TWO: Oe.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 he(), this._lastTargetPosition = new _(), this._quat = new he().setFromUnitVectors(e.up, new _(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Xt(), this._sphericalDelta = new Xt(), this._scale = 1, this._panOffset = new _(), this._rotateStart = new ae(), this._rotateEnd = new ae(), this._rotateDelta = new ae(), this._panStart = new ae(), this._panEnd = new ae(), this._panDelta = new ae(), this._dollyStart = new ae(), this._dollyEnd = new ae(), this._dollyDelta = new ae(), this._dollyDirection = new _(), this._mouse = new ae(), 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 = wi.bind(this), this._onKeyDown = Li.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";
|
|
@@ -341,11 +341,11 @@ function Ai(p) {
|
|
|
341
341
|
e = -1;
|
|
342
342
|
}
|
|
343
343
|
switch (e) {
|
|
344
|
-
case
|
|
344
|
+
case Ue.DOLLY:
|
|
345
345
|
if (this.enableZoom === !1) return;
|
|
346
346
|
this._handleMouseDownDolly(p), this.state = N.DOLLY;
|
|
347
347
|
break;
|
|
348
|
-
case
|
|
348
|
+
case Ue.ROTATE:
|
|
349
349
|
if (p.ctrlKey || p.metaKey || p.shiftKey) {
|
|
350
350
|
if (this.enablePan === !1) return;
|
|
351
351
|
this._handleMouseDownPan(p), this.state = N.PAN;
|
|
@@ -354,7 +354,7 @@ function Ai(p) {
|
|
|
354
354
|
this._handleMouseDownRotate(p), this.state = N.ROTATE;
|
|
355
355
|
}
|
|
356
356
|
break;
|
|
357
|
-
case
|
|
357
|
+
case Ue.PAN:
|
|
358
358
|
if (p.ctrlKey || p.metaKey || p.shiftKey) {
|
|
359
359
|
if (this.enableRotate === !1) return;
|
|
360
360
|
this._handleMouseDownRotate(p), this.state = N.ROTATE;
|
|
@@ -394,11 +394,11 @@ function Si(p) {
|
|
|
394
394
|
switch (this._trackPointer(p), this._pointers.length) {
|
|
395
395
|
case 1:
|
|
396
396
|
switch (this.touches.ONE) {
|
|
397
|
-
case
|
|
397
|
+
case Oe.ROTATE:
|
|
398
398
|
if (this.enableRotate === !1) return;
|
|
399
399
|
this._handleTouchStartRotate(p), this.state = N.TOUCH_ROTATE;
|
|
400
400
|
break;
|
|
401
|
-
case
|
|
401
|
+
case Oe.PAN:
|
|
402
402
|
if (this.enablePan === !1) return;
|
|
403
403
|
this._handleTouchStartPan(p), this.state = N.TOUCH_PAN;
|
|
404
404
|
break;
|
|
@@ -408,11 +408,11 @@ function Si(p) {
|
|
|
408
408
|
break;
|
|
409
409
|
case 2:
|
|
410
410
|
switch (this.touches.TWO) {
|
|
411
|
-
case
|
|
411
|
+
case Oe.DOLLY_PAN:
|
|
412
412
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
413
413
|
this._handleTouchStartDollyPan(p), this.state = N.TOUCH_DOLLY_PAN;
|
|
414
414
|
break;
|
|
415
|
-
case
|
|
415
|
+
case Oe.DOLLY_ROTATE:
|
|
416
416
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
417
417
|
this._handleTouchStartDollyRotate(p), this.state = N.TOUCH_DOLLY_ROTATE;
|
|
418
418
|
break;
|
|
@@ -483,7 +483,7 @@ function Yt(p, e) {
|
|
|
483
483
|
} else
|
|
484
484
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), p;
|
|
485
485
|
}
|
|
486
|
-
class zi extends
|
|
486
|
+
class zi extends Je {
|
|
487
487
|
/**
|
|
488
488
|
* Constructs a new glTF loader.
|
|
489
489
|
*
|
|
@@ -523,7 +523,7 @@ class zi extends qe {
|
|
|
523
523
|
}), this.register(function(t) {
|
|
524
524
|
return new Ki(t);
|
|
525
525
|
}), this.register(function(t) {
|
|
526
|
-
return new
|
|
526
|
+
return new qi(t);
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
529
|
/**
|
|
@@ -541,14 +541,14 @@ class zi extends qe {
|
|
|
541
541
|
if (this.resourcePath !== "")
|
|
542
542
|
o = this.resourcePath;
|
|
543
543
|
else if (this.path !== "") {
|
|
544
|
-
const r =
|
|
545
|
-
o =
|
|
544
|
+
const r = Ge.extractUrlBase(e);
|
|
545
|
+
o = Ge.resolveURL(r, this.path);
|
|
546
546
|
} else
|
|
547
|
-
o =
|
|
547
|
+
o = Ge.extractUrlBase(e);
|
|
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 $e(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(c) {
|
|
@@ -625,7 +625,7 @@ class zi extends qe {
|
|
|
625
625
|
else if (e instanceof ArrayBuffer)
|
|
626
626
|
if (l.decode(new Uint8Array(e, 0, 4)) === In) {
|
|
627
627
|
try {
|
|
628
|
-
o[P.KHR_BINARY_GLTF] = new
|
|
628
|
+
o[P.KHR_BINARY_GLTF] = new Qi(e);
|
|
629
629
|
} catch (h) {
|
|
630
630
|
i && i(h);
|
|
631
631
|
return;
|
|
@@ -747,8 +747,8 @@ 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
|
|
751
|
-
l.color !== void 0 && c.setRGB(l.color[0], l.color[1], l.color[2],
|
|
750
|
+
const c = new Q(16777215);
|
|
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) {
|
|
754
754
|
case "directional":
|
|
@@ -763,7 +763,7 @@ class Hi {
|
|
|
763
763
|
default:
|
|
764
764
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + l.type);
|
|
765
765
|
}
|
|
766
|
-
return r.position.set(0, 0, 0),
|
|
766
|
+
return r.position.set(0, 0, 0), xe(r, l), l.intensity !== void 0 && (r.intensity = l.intensity), r.name = t.createUniqueName(l.name || "light_" + e), i = Promise.resolve(r), t.cache.add(n, i), i;
|
|
767
767
|
}
|
|
768
768
|
getDependency(e, t) {
|
|
769
769
|
if (e === "light")
|
|
@@ -781,16 +781,16 @@ class Pi {
|
|
|
781
781
|
this.name = P.KHR_MATERIALS_UNLIT;
|
|
782
782
|
}
|
|
783
783
|
getMaterialType() {
|
|
784
|
-
return
|
|
784
|
+
return je;
|
|
785
785
|
}
|
|
786
786
|
extendParams(e, t, n) {
|
|
787
787
|
const i = [];
|
|
788
|
-
e.color = new
|
|
788
|
+
e.color = new Q(1, 1, 1), e.opacity = 1;
|
|
789
789
|
const s = t.pbrMetallicRoughness;
|
|
790
790
|
if (s) {
|
|
791
791
|
if (Array.isArray(s.baseColorFactor)) {
|
|
792
792
|
const o = s.baseColorFactor;
|
|
793
|
-
e.color.setRGB(o[0], o[1], o[2],
|
|
793
|
+
e.color.setRGB(o[0], o[1], o[2], be), e.opacity = o[3];
|
|
794
794
|
}
|
|
795
795
|
s.baseColorTexture !== void 0 && i.push(n.assignTexture(e, "map", s.baseColorTexture, X));
|
|
796
796
|
}
|
|
@@ -815,7 +815,7 @@ class Di {
|
|
|
815
815
|
}
|
|
816
816
|
getMaterialType(e) {
|
|
817
817
|
const n = this.parser.json.materials[e];
|
|
818
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
818
|
+
return !n.extensions || !n.extensions[this.name] ? null : Re;
|
|
819
819
|
}
|
|
820
820
|
extendMaterialParams(e, t) {
|
|
821
821
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -835,7 +835,7 @@ class Oi {
|
|
|
835
835
|
}
|
|
836
836
|
getMaterialType(e) {
|
|
837
837
|
const n = this.parser.json.materials[e];
|
|
838
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
838
|
+
return !n.extensions || !n.extensions[this.name] ? null : Re;
|
|
839
839
|
}
|
|
840
840
|
extendMaterialParams(e, t) {
|
|
841
841
|
const i = this.parser.json.materials[e];
|
|
@@ -851,7 +851,7 @@ class _i {
|
|
|
851
851
|
}
|
|
852
852
|
getMaterialType(e) {
|
|
853
853
|
const n = this.parser.json.materials[e];
|
|
854
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
854
|
+
return !n.extensions || !n.extensions[this.name] ? null : Re;
|
|
855
855
|
}
|
|
856
856
|
extendMaterialParams(e, t) {
|
|
857
857
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -867,18 +867,18 @@ class Ni {
|
|
|
867
867
|
}
|
|
868
868
|
getMaterialType(e) {
|
|
869
869
|
const n = this.parser.json.materials[e];
|
|
870
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
870
|
+
return !n.extensions || !n.extensions[this.name] ? null : Re;
|
|
871
871
|
}
|
|
872
872
|
extendMaterialParams(e, t) {
|
|
873
873
|
const n = this.parser, i = n.json.materials[e];
|
|
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 Q(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;
|
|
881
|
-
t.sheenColor.setRGB(a[0], a[1], a[2],
|
|
881
|
+
t.sheenColor.setRGB(a[0], a[1], a[2], be);
|
|
882
882
|
}
|
|
883
883
|
return o.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = o.sheenRoughnessFactor), o.sheenColorTexture !== void 0 && s.push(n.assignTexture(t, "sheenColorMap", o.sheenColorTexture, X)), o.sheenRoughnessTexture !== void 0 && s.push(n.assignTexture(t, "sheenRoughnessMap", o.sheenRoughnessTexture)), Promise.all(s);
|
|
884
884
|
}
|
|
@@ -889,7 +889,7 @@ class Bi {
|
|
|
889
889
|
}
|
|
890
890
|
getMaterialType(e) {
|
|
891
891
|
const n = this.parser.json.materials[e];
|
|
892
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
892
|
+
return !n.extensions || !n.extensions[this.name] ? null : Re;
|
|
893
893
|
}
|
|
894
894
|
extendMaterialParams(e, t) {
|
|
895
895
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -905,7 +905,7 @@ class Ui {
|
|
|
905
905
|
}
|
|
906
906
|
getMaterialType(e) {
|
|
907
907
|
const n = this.parser.json.materials[e];
|
|
908
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
908
|
+
return !n.extensions || !n.extensions[this.name] ? null : Re;
|
|
909
909
|
}
|
|
910
910
|
extendMaterialParams(e, t) {
|
|
911
911
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -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 Q().setRGB(a[0], a[1], a[2], be), Promise.all(s);
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
920
|
class Gi {
|
|
@@ -923,7 +923,7 @@ class Gi {
|
|
|
923
923
|
}
|
|
924
924
|
getMaterialType(e) {
|
|
925
925
|
const n = this.parser.json.materials[e];
|
|
926
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
926
|
+
return !n.extensions || !n.extensions[this.name] ? null : Re;
|
|
927
927
|
}
|
|
928
928
|
extendMaterialParams(e, t) {
|
|
929
929
|
const i = this.parser.json.materials[e];
|
|
@@ -939,7 +939,7 @@ class Vi {
|
|
|
939
939
|
}
|
|
940
940
|
getMaterialType(e) {
|
|
941
941
|
const n = this.parser.json.materials[e];
|
|
942
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
942
|
+
return !n.extensions || !n.extensions[this.name] ? null : Re;
|
|
943
943
|
}
|
|
944
944
|
extendMaterialParams(e, t) {
|
|
945
945
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -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 Q().setRGB(a[0], a[1], a[2], be), o.specularColorTexture !== void 0 && s.push(n.assignTexture(t, "specularColorMap", o.specularColorTexture, X)), Promise.all(s);
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
954
|
class Wi {
|
|
@@ -957,7 +957,7 @@ class Wi {
|
|
|
957
957
|
}
|
|
958
958
|
getMaterialType(e) {
|
|
959
959
|
const n = this.parser.json.materials[e];
|
|
960
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
960
|
+
return !n.extensions || !n.extensions[this.name] ? null : Re;
|
|
961
961
|
}
|
|
962
962
|
extendMaterialParams(e, t) {
|
|
963
963
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -973,7 +973,7 @@ class Xi {
|
|
|
973
973
|
}
|
|
974
974
|
getMaterialType(e) {
|
|
975
975
|
const n = this.parser.json.materials[e];
|
|
976
|
-
return !n.extensions || !n.extensions[this.name] ? null :
|
|
976
|
+
return !n.extensions || !n.extensions[this.name] ? null : Re;
|
|
977
977
|
}
|
|
978
978
|
extendMaterialParams(e, t) {
|
|
979
979
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -1060,7 +1060,7 @@ class Ki {
|
|
|
1060
1060
|
return null;
|
|
1061
1061
|
}
|
|
1062
1062
|
}
|
|
1063
|
-
class
|
|
1063
|
+
class qi {
|
|
1064
1064
|
constructor(e) {
|
|
1065
1065
|
this.name = P.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
1066
1066
|
}
|
|
@@ -1078,25 +1078,25 @@ class Qi {
|
|
|
1078
1078
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((r) => {
|
|
1079
1079
|
const c = r.pop(), h = c.isGroup ? c.children : [c], u = r[0].count, d = [];
|
|
1080
1080
|
for (const m of h) {
|
|
1081
|
-
const y = new G(),
|
|
1081
|
+
const y = new G(), f = new _(), b = new he(), I = new _(1, 1, 1), g = new cn(m.geometry, m.material, u);
|
|
1082
1082
|
for (let L = 0; L < u; L++)
|
|
1083
|
-
l.TRANSLATION &&
|
|
1083
|
+
l.TRANSLATION && f.fromBufferAttribute(l.TRANSLATION, L), l.ROTATION && b.fromBufferAttribute(l.ROTATION, L), l.SCALE && I.fromBufferAttribute(l.SCALE, L), g.setMatrixAt(L, y.compose(f, b, I));
|
|
1084
1084
|
for (const L in l)
|
|
1085
1085
|
if (L === "_COLOR_0") {
|
|
1086
1086
|
const k = l[L];
|
|
1087
|
-
|
|
1087
|
+
g.instanceColor = new Vn(k.array, k.itemSize, k.normalized);
|
|
1088
1088
|
} else L !== "TRANSLATION" && L !== "ROTATION" && L !== "SCALE" && m.geometry.setAttribute(L, l[L]);
|
|
1089
|
-
Ee.prototype.copy.call(
|
|
1089
|
+
Ee.prototype.copy.call(g, m), this.parser.assignFinalMaterial(g), d.push(g);
|
|
1090
1090
|
}
|
|
1091
1091
|
return c.isGroup ? (c.clear(), c.add(...d), c) : d[0];
|
|
1092
1092
|
}));
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
|
-
const In = "glTF",
|
|
1096
|
-
class
|
|
1095
|
+
const In = "glTF", Xe = 12, Kt = { JSON: 1313821514, BIN: 5130562 };
|
|
1096
|
+
class Qi {
|
|
1097
1097
|
constructor(e) {
|
|
1098
1098
|
this.name = P.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
1099
|
-
const t = new DataView(e, 0,
|
|
1099
|
+
const t = new DataView(e, 0, Xe), n = new TextDecoder();
|
|
1100
1100
|
if (this.header = {
|
|
1101
1101
|
magic: n.decode(new Uint8Array(e.slice(0, 4))),
|
|
1102
1102
|
version: t.getUint32(4, !0),
|
|
@@ -1105,17 +1105,17 @@ class qi {
|
|
|
1105
1105
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
1106
1106
|
if (this.header.version < 2)
|
|
1107
1107
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
1108
|
-
const i = this.header.length -
|
|
1108
|
+
const i = this.header.length - Xe, s = new DataView(e, Xe);
|
|
1109
1109
|
let o = 0;
|
|
1110
1110
|
for (; o < i; ) {
|
|
1111
1111
|
const a = s.getUint32(o, !0);
|
|
1112
1112
|
o += 4;
|
|
1113
1113
|
const l = s.getUint32(o, !0);
|
|
1114
1114
|
if (o += 4, l === Kt.JSON) {
|
|
1115
|
-
const r = new Uint8Array(e,
|
|
1115
|
+
const r = new Uint8Array(e, Xe + o, a);
|
|
1116
1116
|
this.content = n.decode(r);
|
|
1117
1117
|
} else if (l === Kt.BIN) {
|
|
1118
|
-
const r =
|
|
1118
|
+
const r = Xe + o;
|
|
1119
1119
|
this.body = e.slice(r, r + a);
|
|
1120
1120
|
}
|
|
1121
1121
|
o += a;
|
|
@@ -1139,7 +1139,7 @@ class Ji {
|
|
|
1139
1139
|
for (const c in e.attributes) {
|
|
1140
1140
|
const h = Ft[c] || c.toLowerCase();
|
|
1141
1141
|
if (o[c] !== void 0) {
|
|
1142
|
-
const u = n.accessors[e.attributes[c]], d =
|
|
1142
|
+
const u = n.accessors[e.attributes[c]], d = Ve[u.componentType];
|
|
1143
1143
|
r[h] = d.name, l[h] = u.normalized === !0;
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
@@ -1147,11 +1147,11 @@ class Ji {
|
|
|
1147
1147
|
return new Promise(function(h, u) {
|
|
1148
1148
|
i.decodeDracoFile(c, function(d) {
|
|
1149
1149
|
for (const m in d.attributes) {
|
|
1150
|
-
const y = d.attributes[m],
|
|
1151
|
-
|
|
1150
|
+
const y = d.attributes[m], f = l[m];
|
|
1151
|
+
f !== void 0 && (y.normalized = f);
|
|
1152
1152
|
}
|
|
1153
1153
|
h(d);
|
|
1154
|
-
}, a, r,
|
|
1154
|
+
}, a, r, be, u);
|
|
1155
1155
|
});
|
|
1156
1156
|
});
|
|
1157
1157
|
}
|
|
@@ -1180,10 +1180,10 @@ class wn extends oi {
|
|
|
1180
1180
|
return t;
|
|
1181
1181
|
}
|
|
1182
1182
|
interpolate_(e, t, n, i) {
|
|
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,
|
|
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, f = -2 * d + 3 * u, b = d - u, I = 1 - f, g = b - u + h;
|
|
1184
1184
|
for (let L = 0; L !== a; L++) {
|
|
1185
1185
|
const k = o[y + L + a], A = o[y + L + l] * c, M = o[m + L + a], E = o[m + L] * c;
|
|
1186
|
-
s[L] = I * k +
|
|
1186
|
+
s[L] = I * k + g * A + f * M + b * E;
|
|
1187
1187
|
}
|
|
1188
1188
|
return s;
|
|
1189
1189
|
}
|
|
@@ -1203,24 +1203,24 @@ const le = {
|
|
|
1203
1203
|
TRIANGLES: 4,
|
|
1204
1204
|
TRIANGLE_STRIP: 5,
|
|
1205
1205
|
TRIANGLE_FAN: 6
|
|
1206
|
-
},
|
|
1206
|
+
}, Ve = {
|
|
1207
1207
|
5120: Int8Array,
|
|
1208
1208
|
5121: Uint8Array,
|
|
1209
1209
|
5122: Int16Array,
|
|
1210
1210
|
5123: Uint16Array,
|
|
1211
1211
|
5125: Uint32Array,
|
|
1212
1212
|
5126: Float32Array
|
|
1213
|
-
},
|
|
1213
|
+
}, qt = {
|
|
1214
1214
|
9728: pn,
|
|
1215
1215
|
9729: Ct,
|
|
1216
1216
|
9984: Kn,
|
|
1217
1217
|
9985: Yn,
|
|
1218
1218
|
9986: Zn,
|
|
1219
1219
|
9987: dn
|
|
1220
|
-
},
|
|
1220
|
+
}, Qt = {
|
|
1221
1221
|
33071: Et,
|
|
1222
|
-
33648:
|
|
1223
|
-
10497:
|
|
1222
|
+
33648: qn,
|
|
1223
|
+
10497: et
|
|
1224
1224
|
}, Rt = {
|
|
1225
1225
|
SCALAR: 1,
|
|
1226
1226
|
VEC2: 2,
|
|
@@ -1240,7 +1240,7 @@ const le = {
|
|
|
1240
1240
|
COLOR_0: "color",
|
|
1241
1241
|
WEIGHTS_0: "skinWeight",
|
|
1242
1242
|
JOINTS_0: "skinIndex"
|
|
1243
|
-
},
|
|
1243
|
+
}, we = {
|
|
1244
1244
|
scale: "scale",
|
|
1245
1245
|
translation: "position",
|
|
1246
1246
|
rotation: "quaternion",
|
|
@@ -1271,7 +1271,7 @@ function ke(p, e, t) {
|
|
|
1271
1271
|
for (const n in t.extensions)
|
|
1272
1272
|
p[n] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[n] = t.extensions[n]);
|
|
1273
1273
|
}
|
|
1274
|
-
function
|
|
1274
|
+
function xe(p, e) {
|
|
1275
1275
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(p.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
1276
1276
|
}
|
|
1277
1277
|
function os(p, e, t) {
|
|
@@ -1363,7 +1363,7 @@ class cs {
|
|
|
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 un(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 un(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 $e(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;
|
|
@@ -1393,7 +1393,7 @@ class cs {
|
|
|
1393
1393
|
parser: n,
|
|
1394
1394
|
userData: {}
|
|
1395
1395
|
};
|
|
1396
|
-
return ke(s, a, i),
|
|
1396
|
+
return ke(s, a, i), xe(a, i), Promise.all(n._invokeAll(function(l) {
|
|
1397
1397
|
return l.afterRoot && l.afterRoot(a);
|
|
1398
1398
|
})).then(function() {
|
|
1399
1399
|
for (const l of a.scenes)
|
|
@@ -1574,7 +1574,7 @@ class cs {
|
|
|
1574
1574
|
return Promise.resolve(this.extensions[P.KHR_BINARY_GLTF].body);
|
|
1575
1575
|
const i = this.options;
|
|
1576
1576
|
return new Promise(function(s, o) {
|
|
1577
|
-
n.load(
|
|
1577
|
+
n.load(Ge.resolveURL(t.uri, i.path), s, void 0, function() {
|
|
1578
1578
|
o(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
1579
1579
|
});
|
|
1580
1580
|
});
|
|
@@ -1603,29 +1603,29 @@ class cs {
|
|
|
1603
1603
|
loadAccessor(e) {
|
|
1604
1604
|
const t = this, n = this.json, i = this.json.accessors[e];
|
|
1605
1605
|
if (i.bufferView === void 0 && i.sparse === void 0) {
|
|
1606
|
-
const o = Rt[i.type], a =
|
|
1607
|
-
return Promise.resolve(new
|
|
1606
|
+
const o = Rt[i.type], a = Ve[i.componentType], l = i.normalized === !0, r = new a(i.count * o);
|
|
1607
|
+
return Promise.resolve(new Ze(r, o, l));
|
|
1608
1608
|
}
|
|
1609
1609
|
const s = [];
|
|
1610
1610
|
return i.bufferView !== void 0 ? s.push(this.getDependency("bufferView", i.bufferView)) : s.push(null), i.sparse !== void 0 && (s.push(this.getDependency("bufferView", i.sparse.indices.bufferView)), s.push(this.getDependency("bufferView", i.sparse.values.bufferView))), Promise.all(s).then(function(o) {
|
|
1611
|
-
const a = o[0], l = Rt[i.type], r =
|
|
1612
|
-
let y,
|
|
1611
|
+
const a = o[0], l = Rt[i.type], r = Ve[i.componentType], c = r.BYTES_PER_ELEMENT, h = c * l, u = i.byteOffset || 0, d = i.bufferView !== void 0 ? n.bufferViews[i.bufferView].byteStride : void 0, m = i.normalized === !0;
|
|
1612
|
+
let y, f;
|
|
1613
1613
|
if (d && d !== h) {
|
|
1614
1614
|
const b = Math.floor(u / d), I = "InterleavedBuffer:" + i.bufferView + ":" + i.componentType + ":" + b + ":" + i.count;
|
|
1615
|
-
let
|
|
1616
|
-
|
|
1615
|
+
let g = t.cache.get(I);
|
|
1616
|
+
g || (y = new r(a, b * d, i.count * d / c), g = new Xn(y, d / c), t.cache.add(I, g)), f = new jn(g, l, u % d / c, m);
|
|
1617
1617
|
} else
|
|
1618
|
-
a === null ? y = new r(i.count * l) : y = new r(a, u, i.count * l),
|
|
1618
|
+
a === null ? y = new r(i.count * l) : y = new r(a, u, i.count * l), f = new Ze(y, l, m);
|
|
1619
1619
|
if (i.sparse !== void 0) {
|
|
1620
|
-
const b = Rt.SCALAR, I =
|
|
1621
|
-
a !== null && (
|
|
1620
|
+
const b = Rt.SCALAR, I = Ve[i.sparse.indices.componentType], g = i.sparse.indices.byteOffset || 0, L = i.sparse.values.byteOffset || 0, k = new I(o[1], g, i.sparse.count * b), A = new r(o[2], L, i.sparse.count * l);
|
|
1621
|
+
a !== null && (f = new Ze(f.array.slice(), f.itemSize, f.normalized)), f.normalized = !1;
|
|
1622
1622
|
for (let M = 0, E = k.length; M < E; M++) {
|
|
1623
|
-
const
|
|
1624
|
-
if (
|
|
1623
|
+
const D = k[M];
|
|
1624
|
+
if (f.setX(D, A[M * l]), l >= 2 && f.setY(D, A[M * l + 1]), l >= 3 && f.setZ(D, A[M * l + 2]), l >= 4 && f.setW(D, A[M * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1625
1625
|
}
|
|
1626
|
-
|
|
1626
|
+
f.normalized = m;
|
|
1627
1627
|
}
|
|
1628
|
-
return
|
|
1628
|
+
return f;
|
|
1629
1629
|
});
|
|
1630
1630
|
}
|
|
1631
1631
|
/**
|
|
@@ -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 =
|
|
1654
|
+
return c.magFilter = qt[u.magFilter] || Ct, c.minFilter = qt[u.minFilter] || dn, c.wrapS = Qt[u.wrapS] || et, c.wrapT = Qt[u.wrapT] || et, c.generateMipmaps = !c.isCompressedTexture && c.minFilter !== pn && c.minFilter !== Ct, i.associations.set(c, { textures: e }), c;
|
|
1655
1655
|
}).catch(function() {
|
|
1656
1656
|
return null;
|
|
1657
1657
|
});
|
|
@@ -1675,12 +1675,12 @@ class cs {
|
|
|
1675
1675
|
return new Promise(function(u, d) {
|
|
1676
1676
|
let m = u;
|
|
1677
1677
|
t.isImageBitmapLoader === !0 && (m = function(y) {
|
|
1678
|
-
const
|
|
1679
|
-
|
|
1680
|
-
}), t.load(
|
|
1678
|
+
const f = new Mt(y);
|
|
1679
|
+
f.needsUpdate = !0, u(f);
|
|
1680
|
+
}), t.load(Ge.resolveURL(h, s.path), m, void 0, d);
|
|
1681
1681
|
});
|
|
1682
1682
|
}).then(function(h) {
|
|
1683
|
-
return r === !0 && a.revokeObjectURL(l),
|
|
1683
|
+
return r === !0 && a.revokeObjectURL(l), xe(h, o), h.userData.mimeType = o.mimeType || ls(o.uri), h;
|
|
1684
1684
|
}).catch(function(h) {
|
|
1685
1685
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", l), h;
|
|
1686
1686
|
});
|
|
@@ -1727,7 +1727,7 @@ class cs {
|
|
|
1727
1727
|
if (e.isPoints) {
|
|
1728
1728
|
const a = "PointsMaterial:" + n.uuid;
|
|
1729
1729
|
let l = this.cache.get(a);
|
|
1730
|
-
l || (l = new
|
|
1730
|
+
l || (l = new Qn(), xt.prototype.copy.call(l, n), l.color.copy(n.color), l.map = n.map, l.sizeAttenuation = !1, this.cache.add(a, l)), n = l;
|
|
1731
1731
|
} else if (e.isLine) {
|
|
1732
1732
|
const a = "LineBasicMaterial:" + n.uuid;
|
|
1733
1733
|
let l = this.cache.get(a);
|
|
@@ -1760,9 +1760,9 @@ 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 Q(1, 1, 1), a.opacity = 1, Array.isArray(h.baseColorFactor)) {
|
|
1764
1764
|
const u = h.baseColorFactor;
|
|
1765
|
-
a.color.setRGB(u[0], u[1], u[2],
|
|
1765
|
+
a.color.setRGB(u[0], u[1], u[2], be), a.opacity = u[3];
|
|
1766
1766
|
}
|
|
1767
1767
|
h.baseColorTexture !== void 0 && r.push(t.assignTexture(a, "map", h.baseColorTexture, X)), a.metalness = h.metallicFactor !== void 0 ? h.metallicFactor : 1, a.roughness = h.roughnessFactor !== void 0 ? h.roughnessFactor : 1, h.metallicRoughnessTexture !== void 0 && (r.push(t.assignTexture(a, "metalnessMap", h.metallicRoughnessTexture)), r.push(t.assignTexture(a, "roughnessMap", h.metallicRoughnessTexture))), o = this._invokeOne(function(u) {
|
|
1768
1768
|
return u.getMaterialType && u.getMaterialType(e);
|
|
@@ -1772,17 +1772,17 @@ class cs {
|
|
|
1772
1772
|
}
|
|
1773
1773
|
s.doubleSided === !0 && (a.side = Jn);
|
|
1774
1774
|
const c = s.alphaMode || vt.OPAQUE;
|
|
1775
|
-
if (c === vt.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, c === vt.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && o !==
|
|
1775
|
+
if (c === vt.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, c === vt.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && o !== je && (r.push(t.assignTexture(a, "normalMap", s.normalTexture)), a.normalScale = new ae(1, 1), s.normalTexture.scale !== void 0)) {
|
|
1776
1776
|
const h = s.normalTexture.scale;
|
|
1777
1777
|
a.normalScale.set(h, h);
|
|
1778
1778
|
}
|
|
1779
|
-
if (s.occlusionTexture !== void 0 && o !==
|
|
1779
|
+
if (s.occlusionTexture !== void 0 && o !== je && (r.push(t.assignTexture(a, "aoMap", s.occlusionTexture)), s.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = s.occlusionTexture.strength)), s.emissiveFactor !== void 0 && o !== je) {
|
|
1780
1780
|
const h = s.emissiveFactor;
|
|
1781
|
-
a.emissive = new
|
|
1781
|
+
a.emissive = new Q().setRGB(h[0], h[1], h[2], be);
|
|
1782
1782
|
}
|
|
1783
|
-
return s.emissiveTexture !== void 0 && o !==
|
|
1783
|
+
return s.emissiveTexture !== void 0 && o !== je && r.push(t.assignTexture(a, "emissiveMap", s.emissiveTexture, X)), Promise.all(r).then(function() {
|
|
1784
1784
|
const h = new o(a);
|
|
1785
|
-
return s.name && (h.name = s.name),
|
|
1785
|
+
return s.name && (h.name = s.name), xe(h, s), t.associations.set(h, { materials: e }), s.extensions && ke(i, h, s), h;
|
|
1786
1786
|
});
|
|
1787
1787
|
}
|
|
1788
1788
|
/**
|
|
@@ -1793,7 +1793,7 @@ class cs {
|
|
|
1793
1793
|
* @return {string}
|
|
1794
1794
|
*/
|
|
1795
1795
|
createUniqueName(e) {
|
|
1796
|
-
const t =
|
|
1796
|
+
const t = tt.sanitizeNodeName(e || "");
|
|
1797
1797
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
1798
1798
|
}
|
|
1799
1799
|
/**
|
|
@@ -1819,7 +1819,7 @@ class cs {
|
|
|
1819
1819
|
o.push(h.promise);
|
|
1820
1820
|
else {
|
|
1821
1821
|
let u;
|
|
1822
|
-
r.extensions && r.extensions[P.KHR_DRACO_MESH_COMPRESSION] ? u = s(r) : u = Jt(new
|
|
1822
|
+
r.extensions && r.extensions[P.KHR_DRACO_MESH_COMPRESSION] ? u = s(r) : u = Jt(new Ye(), r, t), i[c] = { primitive: r, promise: u }, o.push(u);
|
|
1823
1823
|
}
|
|
1824
1824
|
}
|
|
1825
1825
|
return Promise.all(o);
|
|
@@ -1840,22 +1840,22 @@ class cs {
|
|
|
1840
1840
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
1841
1841
|
const r = l.slice(0, l.length - 1), c = l[l.length - 1], h = [];
|
|
1842
1842
|
for (let d = 0, m = c.length; d < m; d++) {
|
|
1843
|
-
const y = c[d],
|
|
1843
|
+
const y = c[d], f = o[d];
|
|
1844
1844
|
let b;
|
|
1845
1845
|
const I = r[d];
|
|
1846
|
-
if (
|
|
1847
|
-
b = s.isSkinnedMesh === !0 ? new fn(y, I) : new
|
|
1848
|
-
else if (
|
|
1846
|
+
if (f.mode === le.TRIANGLES || f.mode === le.TRIANGLE_STRIP || f.mode === le.TRIANGLE_FAN || f.mode === void 0)
|
|
1847
|
+
b = s.isSkinnedMesh === !0 ? new fn(y, I) : new Ae(y, I), b.isSkinnedMesh === !0 && b.normalizeSkinWeights(), f.mode === le.TRIANGLE_STRIP ? b.geometry = Yt(b.geometry, rn) : f.mode === le.TRIANGLE_FAN && (b.geometry = Yt(b.geometry, kt));
|
|
1848
|
+
else if (f.mode === le.LINES)
|
|
1849
1849
|
b = new $n(y, I);
|
|
1850
|
-
else if (
|
|
1850
|
+
else if (f.mode === le.LINE_STRIP)
|
|
1851
1851
|
b = new gn(y, I);
|
|
1852
|
-
else if (
|
|
1852
|
+
else if (f.mode === le.LINE_LOOP)
|
|
1853
1853
|
b = new ei(y, I);
|
|
1854
|
-
else if (
|
|
1854
|
+
else if (f.mode === le.POINTS)
|
|
1855
1855
|
b = new ti(y, I);
|
|
1856
1856
|
else
|
|
1857
|
-
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " +
|
|
1858
|
-
Object.keys(b.geometry.morphAttributes).length > 0 && as(b, s), b.name = t.createUniqueName(s.name || "mesh_" + e),
|
|
1857
|
+
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + f.mode);
|
|
1858
|
+
Object.keys(b.geometry.morphAttributes).length > 0 && as(b, s), b.name = t.createUniqueName(s.name || "mesh_" + e), xe(b, s), f.extensions && ke(i, b, f), t.assignFinalMaterial(b), h.push(b);
|
|
1859
1859
|
}
|
|
1860
1860
|
for (let d = 0, m = h.length; d < m; d++)
|
|
1861
1861
|
t.associations.set(h[d], {
|
|
@@ -1864,7 +1864,7 @@ class cs {
|
|
|
1864
1864
|
});
|
|
1865
1865
|
if (h.length === 1)
|
|
1866
1866
|
return s.extensions && ke(i, h[0], s), h[0];
|
|
1867
|
-
const u = new
|
|
1867
|
+
const u = new Ke();
|
|
1868
1868
|
s.extensions && ke(i, u, s), t.associations.set(u, { meshes: e });
|
|
1869
1869
|
for (let d = 0, m = h.length; d < m; d++)
|
|
1870
1870
|
u.add(h[d]);
|
|
@@ -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 yn(
|
|
1888
|
+
return n.type === "perspective" ? t = new yn(q.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
|
|
@@ -1922,8 +1922,8 @@ class cs {
|
|
|
1922
1922
|
loadAnimation(e) {
|
|
1923
1923
|
const t = this.json, n = this, i = t.animations[e], s = i.name ? i.name : "animation_" + e, o = [], a = [], l = [], r = [], c = [];
|
|
1924
1924
|
for (let h = 0, u = i.channels.length; h < u; h++) {
|
|
1925
|
-
const d = i.channels[h], m = i.samplers[d.sampler], y = d.target,
|
|
1926
|
-
y.node !== void 0 && (o.push(this.getDependency("node",
|
|
1925
|
+
const d = i.channels[h], m = i.samplers[d.sampler], y = d.target, f = y.node, b = i.parameters !== void 0 ? i.parameters[m.input] : m.input, I = i.parameters !== void 0 ? i.parameters[m.output] : m.output;
|
|
1926
|
+
y.node !== void 0 && (o.push(this.getDependency("node", f)), a.push(this.getDependency("accessor", b)), l.push(this.getDependency("accessor", I)), r.push(m), c.push(y));
|
|
1927
1927
|
}
|
|
1928
1928
|
return Promise.all([
|
|
1929
1929
|
Promise.all(o),
|
|
@@ -1932,18 +1932,18 @@ class cs {
|
|
|
1932
1932
|
Promise.all(r),
|
|
1933
1933
|
Promise.all(c)
|
|
1934
1934
|
]).then(function(h) {
|
|
1935
|
-
const u = h[0], d = h[1], m = h[2], y = h[3],
|
|
1936
|
-
for (let
|
|
1937
|
-
const k = u[
|
|
1935
|
+
const u = h[0], d = h[1], m = h[2], y = h[3], f = h[4], b = [];
|
|
1936
|
+
for (let g = 0, L = u.length; g < L; g++) {
|
|
1937
|
+
const k = u[g], A = d[g], M = m[g], E = y[g], D = f[g];
|
|
1938
1938
|
if (k === void 0) continue;
|
|
1939
1939
|
k.updateMatrix && k.updateMatrix();
|
|
1940
|
-
const U = n._createAnimationTracks(k, A, M, E,
|
|
1940
|
+
const U = n._createAnimationTracks(k, A, M, E, D);
|
|
1941
1941
|
if (U)
|
|
1942
1942
|
for (let w = 0; w < U.length; w++)
|
|
1943
1943
|
b.push(U[w]);
|
|
1944
1944
|
}
|
|
1945
1945
|
const I = new bn(s, void 0, b);
|
|
1946
|
-
return
|
|
1946
|
+
return xe(I, i), I;
|
|
1947
1947
|
});
|
|
1948
1948
|
}
|
|
1949
1949
|
createNodeMesh(e) {
|
|
@@ -2000,10 +2000,10 @@ 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 zt() : r.length > 1 ? c = new
|
|
2003
|
+
if (s.isBone === !0 ? c = new zt() : r.length > 1 ? c = new Ke() : r.length === 1 ? c = r[0] : c = new Ee(), c !== r[0])
|
|
2004
2004
|
for (let h = 0, u = r.length; h < u; h++)
|
|
2005
2005
|
c.add(r[h]);
|
|
2006
|
-
if (s.name && (c.userData.name = s.name, c.name = o),
|
|
2006
|
+
if (s.name && (c.userData.name = s.name, c.name = o), xe(c, s), s.extensions && ke(n, c, s), s.matrix !== void 0) {
|
|
2007
2007
|
const h = new G();
|
|
2008
2008
|
h.fromArray(s.matrix), c.applyMatrix4(h);
|
|
2009
2009
|
} else
|
|
@@ -2025,8 +2025,8 @@ class cs {
|
|
|
2025
2025
|
* @return {Promise<Group>}
|
|
2026
2026
|
*/
|
|
2027
2027
|
loadScene(e) {
|
|
2028
|
-
const t = this.extensions, n = this.json.scenes[e], i = this, s = new
|
|
2029
|
-
n.name && (s.name = i.createUniqueName(n.name)),
|
|
2028
|
+
const t = this.extensions, n = this.json.scenes[e], i = this, s = new Ke();
|
|
2029
|
+
n.name && (s.name = i.createUniqueName(n.name)), xe(s, n), n.extensions && ke(t, s, n);
|
|
2030
2030
|
const o = n.nodes || [], a = [];
|
|
2031
2031
|
for (let l = 0, r = o.length; l < r; l++)
|
|
2032
2032
|
a.push(i.getDependency("node", o[l]));
|
|
@@ -2047,19 +2047,19 @@ class cs {
|
|
|
2047
2047
|
}
|
|
2048
2048
|
_createAnimationTracks(e, t, n, i, s) {
|
|
2049
2049
|
const o = [], a = e.name ? e.name : e.uuid, l = [];
|
|
2050
|
-
|
|
2050
|
+
we[s.path] === we.weights ? e.traverse(function(u) {
|
|
2051
2051
|
u.morphTargetInfluences && l.push(u.name ? u.name : u.uuid);
|
|
2052
2052
|
}) : l.push(a);
|
|
2053
2053
|
let r;
|
|
2054
|
-
switch (
|
|
2055
|
-
case
|
|
2054
|
+
switch (we[s.path]) {
|
|
2055
|
+
case we.weights:
|
|
2056
2056
|
r = Pt;
|
|
2057
2057
|
break;
|
|
2058
|
-
case
|
|
2058
|
+
case we.rotation:
|
|
2059
2059
|
r = mt;
|
|
2060
2060
|
break;
|
|
2061
|
-
case
|
|
2062
|
-
case
|
|
2061
|
+
case we.translation:
|
|
2062
|
+
case we.scale:
|
|
2063
2063
|
r = Ht;
|
|
2064
2064
|
break;
|
|
2065
2065
|
default:
|
|
@@ -2078,7 +2078,7 @@ class cs {
|
|
|
2078
2078
|
const c = i.interpolation !== void 0 ? is[i.interpolation] : Rn, h = this._getArrayFromAccessor(n);
|
|
2079
2079
|
for (let u = 0, d = l.length; u < d; u++) {
|
|
2080
2080
|
const m = new r(
|
|
2081
|
-
l[u] + "." +
|
|
2081
|
+
l[u] + "." + we[s.path],
|
|
2082
2082
|
t.array,
|
|
2083
2083
|
h,
|
|
2084
2084
|
c
|
|
@@ -2113,7 +2113,7 @@ function us(p, e, t) {
|
|
|
2113
2113
|
new _(l[0], l[1], l[2]),
|
|
2114
2114
|
new _(r[0], r[1], r[2])
|
|
2115
2115
|
), a.normalized) {
|
|
2116
|
-
const c = Dt(
|
|
2116
|
+
const c = Dt(Ve[a.componentType]);
|
|
2117
2117
|
i.min.multiplyScalar(c), i.max.multiplyScalar(c);
|
|
2118
2118
|
}
|
|
2119
2119
|
} else {
|
|
@@ -2131,7 +2131,7 @@ function us(p, e, t) {
|
|
|
2131
2131
|
const u = t.json.accessors[h.POSITION], d = u.min, m = u.max;
|
|
2132
2132
|
if (d !== void 0 && m !== void 0) {
|
|
2133
2133
|
if (l.setX(Math.max(Math.abs(d[0]), Math.abs(m[0]))), l.setY(Math.max(Math.abs(d[1]), Math.abs(m[1]))), l.setZ(Math.max(Math.abs(d[2]), Math.abs(m[2]))), u.normalized) {
|
|
2134
|
-
const y = Dt(
|
|
2134
|
+
const y = Dt(Ve[u.componentType]);
|
|
2135
2135
|
l.multiplyScalar(y);
|
|
2136
2136
|
}
|
|
2137
2137
|
a.max(l);
|
|
@@ -2162,12 +2162,12 @@ function Jt(p, e, t) {
|
|
|
2162
2162
|
});
|
|
2163
2163
|
i.push(o);
|
|
2164
2164
|
}
|
|
2165
|
-
return
|
|
2165
|
+
return me.workingColorSpace !== be && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${me.workingColorSpace}" not supported.`), xe(p, e), us(p, e, t), Promise.all(i).then(function() {
|
|
2166
2166
|
return e.targets !== void 0 ? os(p, e.targets, t) : p;
|
|
2167
2167
|
});
|
|
2168
2168
|
}
|
|
2169
2169
|
const It = /* @__PURE__ */ new WeakMap();
|
|
2170
|
-
class ds extends
|
|
2170
|
+
class ds extends Je {
|
|
2171
2171
|
/**
|
|
2172
2172
|
* Constructs a new Draco loader.
|
|
2173
2173
|
*
|
|
@@ -2224,7 +2224,7 @@ class ds extends qe {
|
|
|
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 $e(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);
|
|
@@ -2241,7 +2241,7 @@ class ds extends qe {
|
|
|
2241
2241
|
this.decodeDracoFile(e, t, null, null, X, n).catch(n);
|
|
2242
2242
|
}
|
|
2243
2243
|
//
|
|
2244
|
-
decodeDracoFile(e, t, n, i, s =
|
|
2244
|
+
decodeDracoFile(e, t, n, i, s = be, o = () => {
|
|
2245
2245
|
}) {
|
|
2246
2246
|
const a = {
|
|
2247
2247
|
attributeIDs: n || this.defaultAttributeIDs,
|
|
@@ -2274,22 +2274,22 @@ class ds extends qe {
|
|
|
2274
2274
|
}), a;
|
|
2275
2275
|
}
|
|
2276
2276
|
_createGeometry(e) {
|
|
2277
|
-
const t = new
|
|
2278
|
-
e.index && t.setIndex(new
|
|
2277
|
+
const t = new Ye();
|
|
2278
|
+
e.index && t.setIndex(new Ze(e.index.array, 1));
|
|
2279
2279
|
for (let n = 0; n < e.attributes.length; n++) {
|
|
2280
|
-
const i = e.attributes[n], s = i.name, o = i.array, a = i.itemSize, l = new
|
|
2280
|
+
const i = e.attributes[n], s = i.name, o = i.array, a = i.itemSize, l = new Ze(o, a);
|
|
2281
2281
|
s === "color" && (this._assignVertexColorSpace(l, i.vertexColorSpace), l.normalized = !(o instanceof Float32Array)), t.setAttribute(s, l);
|
|
2282
2282
|
}
|
|
2283
2283
|
return t;
|
|
2284
2284
|
}
|
|
2285
2285
|
_assignVertexColorSpace(e, t) {
|
|
2286
2286
|
if (t !== X) return;
|
|
2287
|
-
const n = new
|
|
2287
|
+
const n = new Q();
|
|
2288
2288
|
for (let i = 0, s = e.count; i < s; i++)
|
|
2289
|
-
n.fromBufferAttribute(e, i),
|
|
2289
|
+
n.fromBufferAttribute(e, i), me.colorSpaceToWorking(n, X), e.setXYZ(i, n.r, n.g, n.b);
|
|
2290
2290
|
}
|
|
2291
2291
|
_loadLibrary(e, t) {
|
|
2292
|
-
const n = new
|
|
2292
|
+
const n = new $e(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
|
});
|
|
@@ -2392,17 +2392,17 @@ function ps() {
|
|
|
2392
2392
|
if (!d.ok() || u.ptr === 0)
|
|
2393
2393
|
throw new Error("THREE.DRACOLoader: Decoding failed: " + d.error_msg());
|
|
2394
2394
|
const y = { index: null, attributes: [] };
|
|
2395
|
-
for (const
|
|
2396
|
-
const b = self[h[
|
|
2397
|
-
let I,
|
|
2395
|
+
for (const f in c) {
|
|
2396
|
+
const b = self[h[f]];
|
|
2397
|
+
let I, g;
|
|
2398
2398
|
if (r.useUniqueIDs)
|
|
2399
|
-
|
|
2399
|
+
g = c[f], I = a.GetAttributeByUniqueId(u, g);
|
|
2400
2400
|
else {
|
|
2401
|
-
if (
|
|
2402
|
-
I = a.GetAttribute(u,
|
|
2401
|
+
if (g = a.GetAttributeId(u, o[c[f]]), g === -1) continue;
|
|
2402
|
+
I = a.GetAttribute(u, g);
|
|
2403
2403
|
}
|
|
2404
|
-
const L = i(o, a, u,
|
|
2405
|
-
|
|
2404
|
+
const L = i(o, a, u, f, b, I);
|
|
2405
|
+
f === "color" && (L.vertexColorSpace = r.vertexColorSpace), y.attributes.push(L);
|
|
2406
2406
|
}
|
|
2407
2407
|
return m === o.TRIANGULAR_MESH && (y.index = n(o, a, u)), o.destroy(u), y;
|
|
2408
2408
|
}
|
|
@@ -2413,8 +2413,8 @@ function ps() {
|
|
|
2413
2413
|
return o._free(u), { array: d, itemSize: 1 };
|
|
2414
2414
|
}
|
|
2415
2415
|
function i(o, a, l, r, c, h) {
|
|
2416
|
-
const u = h.num_components(), m = l.num_points() * u, y = m * c.BYTES_PER_ELEMENT,
|
|
2417
|
-
a.GetAttributeDataArrayForAllPoints(l, h,
|
|
2416
|
+
const u = h.num_components(), m = l.num_points() * u, y = m * c.BYTES_PER_ELEMENT, f = s(o, c), b = o._malloc(y);
|
|
2417
|
+
a.GetAttributeDataArrayForAllPoints(l, h, f, y, b);
|
|
2418
2418
|
const I = new c(o.HEAPF32.buffer, b, m).slice();
|
|
2419
2419
|
return o._free(b), {
|
|
2420
2420
|
name: r,
|
|
@@ -2447,7 +2447,7 @@ fflate - fast JavaScript compression/decompression
|
|
|
2447
2447
|
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
|
2448
2448
|
version 0.8.2
|
|
2449
2449
|
*/
|
|
2450
|
-
var ce = Uint8Array,
|
|
2450
|
+
var ce = Uint8Array, _e = Uint16Array, ms = Int32Array, Ln = new ce([
|
|
2451
2451
|
0,
|
|
2452
2452
|
0,
|
|
2453
2453
|
0,
|
|
@@ -2517,7 +2517,7 @@ var ce = Uint8Array, Oe = Uint16Array, ms = Int32Array, Ln = new ce([
|
|
|
2517
2517
|
0,
|
|
2518
2518
|
0
|
|
2519
2519
|
]), fs = new ce([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Tn = function(p, e) {
|
|
2520
|
-
for (var t = new
|
|
2520
|
+
for (var t = new _e(31), n = 0; n < 31; ++n)
|
|
2521
2521
|
t[n] = e += 1 << p[n - 1];
|
|
2522
2522
|
for (var i = new ms(t[30]), n = 1; n < 30; ++n)
|
|
2523
2523
|
for (var s = t[n]; s < t[n + 1]; ++s)
|
|
@@ -2525,46 +2525,46 @@ var ce = Uint8Array, Oe = Uint16Array, ms = Int32Array, Ln = new ce([
|
|
|
2525
2525
|
return { b: t, r: i };
|
|
2526
2526
|
}, kn = Tn(Ln, 2), Cn = kn.b, gs = kn.r;
|
|
2527
2527
|
Cn[28] = 258, gs[258] = 28;
|
|
2528
|
-
var ys = Tn(Sn, 0), xs = ys.b, Ot = new
|
|
2528
|
+
var ys = Tn(Sn, 0), xs = ys.b, Ot = new _e(32768);
|
|
2529
2529
|
for (var V = 0; V < 32768; ++V) {
|
|
2530
|
-
var
|
|
2531
|
-
|
|
2530
|
+
var Le = (V & 43690) >> 1 | (V & 21845) << 1;
|
|
2531
|
+
Le = (Le & 52428) >> 2 | (Le & 13107) << 2, Le = (Le & 61680) >> 4 | (Le & 3855) << 4, Ot[V] = ((Le & 65280) >> 8 | (Le & 255) << 8) >> 1;
|
|
2532
2532
|
}
|
|
2533
|
-
var
|
|
2534
|
-
for (var n = p.length, i = 0, s = new
|
|
2533
|
+
var qe = (function(p, e, t) {
|
|
2534
|
+
for (var n = p.length, i = 0, s = new _e(e); i < n; ++i)
|
|
2535
2535
|
p[i] && ++s[p[i] - 1];
|
|
2536
|
-
var o = new
|
|
2536
|
+
var o = new _e(e);
|
|
2537
2537
|
for (i = 1; i < e; ++i)
|
|
2538
2538
|
o[i] = o[i - 1] + s[i - 1] << 1;
|
|
2539
2539
|
var a;
|
|
2540
2540
|
if (t) {
|
|
2541
|
-
a = new
|
|
2541
|
+
a = new _e(1 << e);
|
|
2542
2542
|
var l = 15 - e;
|
|
2543
2543
|
for (i = 0; i < n; ++i)
|
|
2544
2544
|
if (p[i])
|
|
2545
2545
|
for (var r = i << 4 | p[i], c = e - p[i], h = o[p[i] - 1]++ << c, u = h | (1 << c) - 1; h <= u; ++h)
|
|
2546
2546
|
a[Ot[h] >> l] = r;
|
|
2547
2547
|
} else
|
|
2548
|
-
for (a = new
|
|
2548
|
+
for (a = new _e(n), i = 0; i < n; ++i)
|
|
2549
2549
|
p[i] && (a[i] = Ot[o[p[i] - 1]++] >> 15 - p[i]);
|
|
2550
2550
|
return a;
|
|
2551
|
-
}),
|
|
2551
|
+
}), st = new ce(288);
|
|
2552
2552
|
for (var V = 0; V < 144; ++V)
|
|
2553
|
-
|
|
2553
|
+
st[V] = 8;
|
|
2554
2554
|
for (var V = 144; V < 256; ++V)
|
|
2555
|
-
|
|
2555
|
+
st[V] = 9;
|
|
2556
2556
|
for (var V = 256; V < 280; ++V)
|
|
2557
|
-
|
|
2557
|
+
st[V] = 7;
|
|
2558
2558
|
for (var V = 280; V < 288; ++V)
|
|
2559
|
-
|
|
2559
|
+
st[V] = 8;
|
|
2560
2560
|
var En = new ce(32);
|
|
2561
2561
|
for (var V = 0; V < 32; ++V)
|
|
2562
2562
|
En[V] = 5;
|
|
2563
|
-
var bs = /* @__PURE__ */
|
|
2563
|
+
var bs = /* @__PURE__ */ qe(st, 9, 1), Rs = /* @__PURE__ */ qe(En, 5, 1), wt = 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;
|
|
2567
|
-
},
|
|
2567
|
+
}, de = function(p, e, t) {
|
|
2568
2568
|
var n = e / 8 | 0;
|
|
2569
2569
|
return (p[n] | p[n + 1] << 8) >> (e & 7) & t;
|
|
2570
2570
|
}, Lt = function(p, e) {
|
|
@@ -2590,9 +2590,9 @@ var bs = /* @__PURE__ */ Ke(it, 9, 1), Rs = /* @__PURE__ */ Ke(En, 5, 1), wt = f
|
|
|
2590
2590
|
"stream finishing",
|
|
2591
2591
|
"invalid zip data"
|
|
2592
2592
|
// determined by unknown compression method
|
|
2593
|
-
],
|
|
2593
|
+
], pe = function(p, e, t) {
|
|
2594
2594
|
var n = new Error(e || Is[p]);
|
|
2595
|
-
if (n.code = p, Error.captureStackTrace && Error.captureStackTrace(n,
|
|
2595
|
+
if (n.code = p, Error.captureStackTrace && Error.captureStackTrace(n, pe), !t)
|
|
2596
2596
|
throw n;
|
|
2597
2597
|
return n;
|
|
2598
2598
|
}, ws = function(p, e, t, n) {
|
|
@@ -2607,95 +2607,95 @@ var bs = /* @__PURE__ */ Ke(it, 9, 1), Rs = /* @__PURE__ */ Ke(En, 5, 1), wt = f
|
|
|
2607
2607
|
var Wt = new ce(Math.max(Vt * 2, Gt));
|
|
2608
2608
|
Wt.set(t), t = Wt;
|
|
2609
2609
|
}
|
|
2610
|
-
}, c = e.f || 0, h = e.p || 0, u = e.b || 0, d = e.l, m = e.d, y = e.m,
|
|
2610
|
+
}, c = e.f || 0, h = e.p || 0, u = e.b || 0, d = e.l, m = e.d, y = e.m, f = e.n, b = i * 8;
|
|
2611
2611
|
do {
|
|
2612
2612
|
if (!d) {
|
|
2613
|
-
c =
|
|
2614
|
-
var I =
|
|
2613
|
+
c = de(p, h, 1);
|
|
2614
|
+
var I = de(p, h + 1, 3);
|
|
2615
2615
|
if (h += 3, I)
|
|
2616
2616
|
if (I == 1)
|
|
2617
|
-
d = bs, m = Rs, y = 9,
|
|
2617
|
+
d = bs, m = Rs, y = 9, f = 5;
|
|
2618
2618
|
else if (I == 2) {
|
|
2619
|
-
var A =
|
|
2619
|
+
var A = de(p, h, 31) + 257, M = de(p, h + 10, 15) + 4, E = A + de(p, h + 5, 31) + 1;
|
|
2620
2620
|
h += 14;
|
|
2621
|
-
for (var
|
|
2622
|
-
U[fs[w]] =
|
|
2621
|
+
for (var D = new ce(E), U = new ce(19), w = 0; w < M; ++w)
|
|
2622
|
+
U[fs[w]] = de(p, h + w * 3, 7);
|
|
2623
2623
|
h += M * 3;
|
|
2624
|
-
for (var v = wt(U),
|
|
2625
|
-
var
|
|
2626
|
-
h +=
|
|
2627
|
-
var
|
|
2628
|
-
if (
|
|
2629
|
-
|
|
2624
|
+
for (var v = wt(U), S = (1 << v) - 1, F = qe(U, v, 1), w = 0; w < E; ) {
|
|
2625
|
+
var ie = F[de(p, h, S)];
|
|
2626
|
+
h += ie & 15;
|
|
2627
|
+
var g = ie >> 4;
|
|
2628
|
+
if (g < 16)
|
|
2629
|
+
D[w++] = g;
|
|
2630
2630
|
else {
|
|
2631
|
-
var Y = 0,
|
|
2632
|
-
for (
|
|
2633
|
-
|
|
2631
|
+
var Y = 0, ue = 0;
|
|
2632
|
+
for (g == 16 ? (ue = 3 + de(p, h, 3), h += 2, Y = D[w - 1]) : g == 17 ? (ue = 3 + de(p, h, 7), h += 3) : g == 18 && (ue = 11 + de(p, h, 127), h += 7); ue--; )
|
|
2633
|
+
D[w++] = Y;
|
|
2634
2634
|
}
|
|
2635
2635
|
}
|
|
2636
|
-
var
|
|
2637
|
-
y = wt(
|
|
2636
|
+
var Me = D.subarray(0, A), fe = D.subarray(A);
|
|
2637
|
+
y = wt(Me), f = wt(fe), d = qe(Me, y, 1), m = qe(fe, f, 1);
|
|
2638
2638
|
} else
|
|
2639
|
-
|
|
2639
|
+
pe(1);
|
|
2640
2640
|
else {
|
|
2641
|
-
var
|
|
2641
|
+
var g = vs(h) + 4, L = p[g - 4] | p[g - 3] << 8, k = g + L;
|
|
2642
2642
|
if (k > i) {
|
|
2643
|
-
l &&
|
|
2643
|
+
l && pe(0);
|
|
2644
2644
|
break;
|
|
2645
2645
|
}
|
|
2646
|
-
a && r(u + L), t.set(p.subarray(
|
|
2646
|
+
a && r(u + L), t.set(p.subarray(g, k), u), e.b = u += L, e.p = h = k * 8, e.f = c;
|
|
2647
2647
|
continue;
|
|
2648
2648
|
}
|
|
2649
2649
|
if (h > b) {
|
|
2650
|
-
l &&
|
|
2650
|
+
l && pe(0);
|
|
2651
2651
|
break;
|
|
2652
2652
|
}
|
|
2653
2653
|
}
|
|
2654
2654
|
a && r(u + 131072);
|
|
2655
|
-
for (var ft = (1 << y) - 1, gt = (1 <<
|
|
2655
|
+
for (var ft = (1 << y) - 1, gt = (1 << f) - 1, We = h; ; We = h) {
|
|
2656
2656
|
var Y = d[Lt(p, h) & ft], C = Y >> 4;
|
|
2657
2657
|
if (h += Y & 15, h > b) {
|
|
2658
|
-
l &&
|
|
2658
|
+
l && pe(0);
|
|
2659
2659
|
break;
|
|
2660
2660
|
}
|
|
2661
|
-
if (Y ||
|
|
2661
|
+
if (Y || pe(2), C < 256)
|
|
2662
2662
|
t[u++] = C;
|
|
2663
2663
|
else if (C == 256) {
|
|
2664
|
-
|
|
2664
|
+
We = h, d = null;
|
|
2665
2665
|
break;
|
|
2666
2666
|
} else {
|
|
2667
2667
|
var Z = C - 254;
|
|
2668
2668
|
if (C > 264) {
|
|
2669
|
-
var w = C - 257,
|
|
2670
|
-
Z =
|
|
2669
|
+
var w = C - 257, J = Ln[w];
|
|
2670
|
+
Z = de(p, h, (1 << J) - 1) + Cn[w], h += J;
|
|
2671
2671
|
}
|
|
2672
|
-
var
|
|
2673
|
-
|
|
2674
|
-
var
|
|
2675
|
-
if (
|
|
2676
|
-
var
|
|
2677
|
-
|
|
2672
|
+
var te = m[Lt(p, h) & gt], Ie = te >> 4;
|
|
2673
|
+
te || pe(3), h += te & 15;
|
|
2674
|
+
var fe = xs[Ie];
|
|
2675
|
+
if (Ie > 3) {
|
|
2676
|
+
var J = Sn[Ie];
|
|
2677
|
+
fe += Lt(p, h) & (1 << J) - 1, h += J;
|
|
2678
2678
|
}
|
|
2679
2679
|
if (h > b) {
|
|
2680
|
-
l &&
|
|
2680
|
+
l && pe(0);
|
|
2681
2681
|
break;
|
|
2682
2682
|
}
|
|
2683
2683
|
a && r(u + 131072);
|
|
2684
|
-
var
|
|
2685
|
-
if (u <
|
|
2686
|
-
var yt = s -
|
|
2687
|
-
for (yt + u < 0 &&
|
|
2684
|
+
var He = u + Z;
|
|
2685
|
+
if (u < fe) {
|
|
2686
|
+
var yt = s - fe, _n = Math.min(fe, He);
|
|
2687
|
+
for (yt + u < 0 && pe(3); u < _n; ++u)
|
|
2688
2688
|
t[u] = n[yt + u];
|
|
2689
2689
|
}
|
|
2690
|
-
for (; u <
|
|
2691
|
-
t[u] = t[u -
|
|
2690
|
+
for (; u < He; ++u)
|
|
2691
|
+
t[u] = t[u - fe];
|
|
2692
2692
|
}
|
|
2693
2693
|
}
|
|
2694
|
-
e.l = d, e.p =
|
|
2694
|
+
e.l = d, e.p = We, e.b = u, e.f = c, d && (c = 1, e.m = y, e.d = m, e.n = f);
|
|
2695
2695
|
} while (!c);
|
|
2696
2696
|
return u != t.length && o ? As(t, 0, u) : t.subarray(0, u);
|
|
2697
2697
|
}, Ls = /* @__PURE__ */ new ce(0), Ss = function(p, e) {
|
|
2698
|
-
return ((p[0] & 15) != 8 || p[0] >> 4 > 7 || (p[0] << 8 | p[1]) % 31) &&
|
|
2698
|
+
return ((p[0] & 15) != 8 || p[0] >> 4 > 7 || (p[0] << 8 | p[1]) % 31) && pe(6, "invalid zlib data"), (p[1] >> 5 & 1) == 1 && pe(6, "invalid zlib data: " + (p[1] & 32 ? "need" : "unexpected") + " dictionary"), (p[1] >> 3 & 4) + 2;
|
|
2699
2699
|
};
|
|
2700
2700
|
function Ts(p, e) {
|
|
2701
2701
|
return ws(p.subarray(Ss(p), -4), { i: 2 }, e, e);
|
|
@@ -2731,7 +2731,7 @@ function Es(p, e, t, n) {
|
|
|
2731
2731
|
return i;
|
|
2732
2732
|
}
|
|
2733
2733
|
function zs(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 nt(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;
|
|
@@ -2756,8 +2756,8 @@ function Ms(p, e, t, n, i) {
|
|
|
2756
2756
|
for (let d = 0; d < h; ++d) {
|
|
2757
2757
|
const m = r[d + 1], y = l[h - d];
|
|
2758
2758
|
a[h][d] = m + y;
|
|
2759
|
-
const
|
|
2760
|
-
a[d][h] = u + m *
|
|
2759
|
+
const f = a[d][h - 1] / a[h][d];
|
|
2760
|
+
a[d][h] = u + m * f, u = y * f;
|
|
2761
2761
|
}
|
|
2762
2762
|
a[h][h] = u;
|
|
2763
2763
|
}
|
|
@@ -2770,13 +2770,13 @@ function Ms(p, e, t, n, i) {
|
|
|
2770
2770
|
m[y] = s.slice(0);
|
|
2771
2771
|
m[0][0] = 1;
|
|
2772
2772
|
for (let y = 1; y <= n; ++y) {
|
|
2773
|
-
let
|
|
2773
|
+
let f = 0;
|
|
2774
2774
|
const b = h - y, I = t - y;
|
|
2775
|
-
h >= y && (m[d][0] = m[u][0] / a[I + 1][b],
|
|
2776
|
-
const
|
|
2777
|
-
for (let A =
|
|
2778
|
-
m[d][A] = (m[u][A] - m[u][A - 1]) / a[I + 1][b + A],
|
|
2779
|
-
h <= I && (m[d][y] = -m[u][y - 1] / a[I + 1][h],
|
|
2775
|
+
h >= y && (m[d][0] = m[u][0] / a[I + 1][b], f = m[d][0] * a[b][I]);
|
|
2776
|
+
const g = b >= -1 ? 1 : -b, L = h - 1 <= I ? y - 1 : t - h;
|
|
2777
|
+
for (let A = g; A <= L; ++A)
|
|
2778
|
+
m[d][A] = (m[u][A] - m[u][A - 1]) / a[I + 1][b + A], f += m[d][A] * a[b + A][I];
|
|
2779
|
+
h <= I && (m[d][y] = -m[u][y - 1] / a[I + 1][h], f += m[d][y] * a[h][I]), o[y][h] = f;
|
|
2780
2780
|
const k = u;
|
|
2781
2781
|
u = d, d = k;
|
|
2782
2782
|
}
|
|
@@ -2802,7 +2802,7 @@ function Hs(p, e, t, n, i) {
|
|
|
2802
2802
|
o[c] = h;
|
|
2803
2803
|
}
|
|
2804
2804
|
for (let c = s + 1; c <= i + 1; ++c)
|
|
2805
|
-
o[c] = new
|
|
2805
|
+
o[c] = new nt(0, 0, 0);
|
|
2806
2806
|
return o;
|
|
2807
2807
|
}
|
|
2808
2808
|
function Ps(p, e) {
|
|
@@ -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 nt(r.x, r.y, r.z, r.w);
|
|
2855
2855
|
}
|
|
2856
2856
|
}
|
|
2857
2857
|
/**
|
|
@@ -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 nt(t[0], t[1], t[2], t[3])), this.startKnot = e.startKnot, this.endKnot = e.endKnot, this;
|
|
2885
2885
|
}
|
|
2886
2886
|
}
|
|
2887
|
-
let H, j,
|
|
2888
|
-
class $t extends
|
|
2887
|
+
let H, j, ne;
|
|
2888
|
+
class $t extends Je {
|
|
2889
2889
|
/**
|
|
2890
2890
|
* Constructs a new FBX loader.
|
|
2891
2891
|
*
|
|
@@ -2904,7 +2904,7 @@ class $t extends qe {
|
|
|
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 === "" ?
|
|
2907
|
+
const s = this, o = s.path === "" ? Ge.extractUrlBase(e) : s.path, a = new $e(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));
|
|
@@ -2942,7 +2942,7 @@ class _s {
|
|
|
2942
2942
|
parse() {
|
|
2943
2943
|
j = this.parseConnections();
|
|
2944
2944
|
const e = this.parseImages(), t = this.parseTextures(e), n = this.parseMaterials(t), i = this.parseDeformers(), s = new Ns().parse(i);
|
|
2945
|
-
return this.parseScene(i, s, n),
|
|
2945
|
+
return this.parseScene(i, s, n), ne;
|
|
2946
2946
|
}
|
|
2947
2947
|
// Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
|
|
2948
2948
|
// and details the connection type
|
|
@@ -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 ? et : Et, n.wrapT = a === 0 ? et : Et, "Scaling" in e) {
|
|
3045
3045
|
const l = e.Scaling.value;
|
|
3046
3046
|
n.repeat.x = l[0], n.repeat.y = l[1];
|
|
3047
3047
|
}
|
|
@@ -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 =
|
|
3106
|
+
e.BumpFactor && (i.bumpScale = e.BumpFactor.value), e.Diffuse ? i.color = me.colorSpaceToWorking(new Q().fromArray(e.Diffuse.value), X) : e.DiffuseColor && (e.DiffuseColor.type === "Color" || e.DiffuseColor.type === "ColorRGB") && (i.color = me.colorSpaceToWorking(new Q().fromArray(e.DiffuseColor.value), X)), e.DisplacementFactor && (i.displacementScale = e.DisplacementFactor.value), e.Emissive ? i.emissive = me.colorSpaceToWorking(new Q().fromArray(e.Emissive.value), X) : e.EmissiveColor && (e.EmissiveColor.type === "Color" || e.EmissiveColor.type === "ColorRGB") && (i.emissive = me.colorSpaceToWorking(new Q().fromArray(e.EmissiveColor.value), X)), 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 Q().fromArray(e.Specular.value), X) : e.SpecularColor && e.SpecularColor.type === "Color" && (i.specular = me.colorSpaceToWorking(new Q().fromArray(e.SpecularColor.value), X));
|
|
3107
3107
|
const s = this;
|
|
3108
3108
|
return j.get(n).children.forEach(function(o) {
|
|
3109
3109
|
const a = o.relationship;
|
|
@@ -3221,15 +3221,15 @@ class _s {
|
|
|
3221
3221
|
}
|
|
3222
3222
|
// create the main Group() to be returned by the loader
|
|
3223
3223
|
parseScene(e, t, n) {
|
|
3224
|
-
|
|
3224
|
+
ne = new Ke();
|
|
3225
3225
|
const i = this.parseModels(e.skeletons, t, n), s = H.Objects.Model, o = this;
|
|
3226
3226
|
i.forEach(function(l) {
|
|
3227
3227
|
const r = s[l.ID];
|
|
3228
3228
|
o.setLookAtProperties(l, r), j.get(l.ID).parents.forEach(function(h) {
|
|
3229
3229
|
const u = i.get(h.ID);
|
|
3230
3230
|
u !== void 0 && u.add(l);
|
|
3231
|
-
}), l.parent === null &&
|
|
3232
|
-
}), this.bindSkeleton(e.skeletons, t, i), this.addGlobalSceneSettings(),
|
|
3231
|
+
}), l.parent === null && ne.add(l);
|
|
3232
|
+
}), this.bindSkeleton(e.skeletons, t, i), this.addGlobalSceneSettings(), ne.traverse(function(l) {
|
|
3233
3233
|
if (l.userData.transformData) {
|
|
3234
3234
|
l.parent && (l.userData.transformData.parentMatrix = l.parent.matrix, l.userData.transformData.parentMatrixWorld = l.parent.matrixWorld);
|
|
3235
3235
|
const r = Hn(l.userData.transformData);
|
|
@@ -3237,7 +3237,7 @@ class _s {
|
|
|
3237
3237
|
}
|
|
3238
3238
|
});
|
|
3239
3239
|
const a = new Bs().parse();
|
|
3240
|
-
|
|
3240
|
+
ne.children.length === 1 && ne.children[0].isGroup && (ne.children[0].animations = a, ne = ne.children[0]), ne.animations = a;
|
|
3241
3241
|
}
|
|
3242
3242
|
// parse nodes in FBXTree.Objects.Model
|
|
3243
3243
|
parseModels(e, t, n) {
|
|
@@ -3265,10 +3265,10 @@ class _s {
|
|
|
3265
3265
|
break;
|
|
3266
3266
|
case "Null":
|
|
3267
3267
|
default:
|
|
3268
|
-
c = new
|
|
3268
|
+
c = new Ke();
|
|
3269
3269
|
break;
|
|
3270
3270
|
}
|
|
3271
|
-
c.name = l.attrName ?
|
|
3271
|
+
c.name = l.attrName ? tt.sanitizeNodeName(l.attrName) : "", c.userData.originalName = l.attrName, c.ID = a;
|
|
3272
3272
|
}
|
|
3273
3273
|
this.getTransformData(c, l), i.set(a, c);
|
|
3274
3274
|
}
|
|
@@ -3282,7 +3282,7 @@ class _s {
|
|
|
3282
3282
|
l.rawBones.forEach(function(r, c) {
|
|
3283
3283
|
if (r.ID === o.ID) {
|
|
3284
3284
|
const h = s;
|
|
3285
|
-
s = new zt(), s.matrixWorld.copy(r.transformLink), s.name = i ?
|
|
3285
|
+
s = new zt(), s.matrixWorld.copy(r.transformLink), s.name = i ? tt.sanitizeNodeName(i) : "", s.userData.originalName = i, s.ID = n, l.bones[c] = s, h !== null && s.add(h);
|
|
3286
3286
|
}
|
|
3287
3287
|
});
|
|
3288
3288
|
}
|
|
@@ -3335,7 +3335,7 @@ class _s {
|
|
|
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 =
|
|
3338
|
+
n.Color !== void 0 && (s = me.colorSpaceToWorking(new Q().fromArray(n.Color.value), X));
|
|
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 = q.degToRad(n.InnerAngle.value));
|
|
3354
3354
|
let c = 0;
|
|
3355
|
-
n.OuterAngle !== void 0 && (c =
|
|
3355
|
+
n.OuterAngle !== void 0 && (c = q.degToRad(n.OuterAngle.value), c = Math.max(c, 1)), t = new ln(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 dt(s, o);
|
|
@@ -3368,7 +3368,7 @@ class _s {
|
|
|
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
3370
|
}), a.length > 1 ? o = a : a.length > 0 ? o = a[0] : (o = new ot({
|
|
3371
|
-
name:
|
|
3371
|
+
name: Je.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;
|
|
@@ -3383,13 +3383,13 @@ class _s {
|
|
|
3383
3383
|
a.push(r);
|
|
3384
3384
|
}
|
|
3385
3385
|
}
|
|
3386
|
-
return s.FBX_Deformer ? (i = new fn(s, o), i.normalizeSkinWeights()) : i = new
|
|
3386
|
+
return s.FBX_Deformer ? (i = new fn(s, o), i.normalizeSkinWeights()) : i = new Ae(s, o), i;
|
|
3387
3387
|
}
|
|
3388
3388
|
createCurve(e, t) {
|
|
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 mn({
|
|
3392
|
-
name:
|
|
3392
|
+
name: Je.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 = it(t.RotationOrder.value) : n.eulerOrder = it(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 && j.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),
|
|
3409
|
+
e.target !== void 0 ? (e.target.position.fromArray(o), ne.add(e.target)) : e.lookAt(new _().fromArray(o));
|
|
3410
3410
|
}
|
|
3411
3411
|
}
|
|
3412
3412
|
});
|
|
@@ -3444,11 +3444,11 @@ 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
|
|
3448
|
-
|
|
3447
|
+
const s = new Q().setRGB(t, n, i, X);
|
|
3448
|
+
ne.add(new ci(s, 1));
|
|
3449
3449
|
}
|
|
3450
3450
|
}
|
|
3451
|
-
"UnitScaleFactor" in H.GlobalSettings && (
|
|
3451
|
+
"UnitScaleFactor" in H.GlobalSettings && (ne.userData.unitScaleFactor = H.GlobalSettings.UnitScaleFactor.value);
|
|
3452
3452
|
}
|
|
3453
3453
|
}
|
|
3454
3454
|
}
|
|
@@ -3490,22 +3490,22 @@ class Ns {
|
|
|
3490
3490
|
n.morphTargets[h.ID] !== void 0 && s.push(n.morphTargets[h.ID]);
|
|
3491
3491
|
});
|
|
3492
3492
|
const l = o[0], r = {};
|
|
3493
|
-
"RotationOrder" in l && (r.eulerOrder =
|
|
3493
|
+
"RotationOrder" in l && (r.eulerOrder = it(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 c = Hn(r);
|
|
3495
3495
|
return this.genGeometry(t, a, s, c);
|
|
3496
3496
|
}
|
|
3497
3497
|
// Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
|
|
3498
3498
|
genGeometry(e, t, n, i) {
|
|
3499
|
-
const s = new
|
|
3499
|
+
const s = new Ye();
|
|
3500
3500
|
e.attrName && (s.name = e.attrName);
|
|
3501
|
-
const o = this.parseGeoNode(e, t), a = this.genBuffers(o), l = new
|
|
3502
|
-
if (l.applyMatrix4(i), s.setAttribute("position", l), a.colors.length > 0 && s.setAttribute("color", new
|
|
3503
|
-
const r = new di().getNormalMatrix(i), c = new
|
|
3501
|
+
const o = this.parseGeoNode(e, t), a = this.genBuffers(o), l = new Pe(a.vertex, 3);
|
|
3502
|
+
if (l.applyMatrix4(i), s.setAttribute("position", l), a.colors.length > 0 && s.setAttribute("color", new Pe(a.colors, 3)), t && (s.setAttribute("skinIndex", new ui(a.weightsIndices, 4)), s.setAttribute("skinWeight", new Pe(a.vertexWeights, 4)), s.FBX_Deformer = t), a.normal.length > 0) {
|
|
3503
|
+
const r = new di().getNormalMatrix(i), c = new Pe(a.normal, 3);
|
|
3504
3504
|
c.applyNormalMatrix(r), s.setAttribute("normal", c);
|
|
3505
3505
|
}
|
|
3506
3506
|
if (a.uvs.forEach(function(r, c) {
|
|
3507
3507
|
const h = c === 0 ? "uv" : `uv${c}`;
|
|
3508
|
-
s.setAttribute(h, new
|
|
3508
|
+
s.setAttribute(h, new Pe(a.uvs[c], 2));
|
|
3509
3509
|
}), o.material && o.material.mappingType !== "AllSame") {
|
|
3510
3510
|
let r = a.materialIndex[0], c = 0;
|
|
3511
3511
|
if (a.materialIndex.forEach(function(h, u) {
|
|
@@ -3548,43 +3548,43 @@ class Ns {
|
|
|
3548
3548
|
let n = 0, i = 0, s = !1, o = [], a = [], l = [], r = [], c = [], h = [];
|
|
3549
3549
|
const u = this;
|
|
3550
3550
|
return e.vertexIndices.forEach(function(d, m) {
|
|
3551
|
-
let y,
|
|
3552
|
-
d < 0 && (d = d ^ -1,
|
|
3551
|
+
let y, f = !1;
|
|
3552
|
+
d < 0 && (d = d ^ -1, f = !0);
|
|
3553
3553
|
let b = [], I = [];
|
|
3554
3554
|
if (o.push(d * 3, d * 3 + 1, d * 3 + 2), e.color) {
|
|
3555
|
-
const
|
|
3556
|
-
l.push(
|
|
3555
|
+
const g = rt(m, n, d, e.color);
|
|
3556
|
+
l.push(g[0], g[1], g[2]);
|
|
3557
3557
|
}
|
|
3558
3558
|
if (e.skeleton) {
|
|
3559
|
-
if (e.weightTable[d] !== void 0 && e.weightTable[d].forEach(function(
|
|
3560
|
-
I.push(
|
|
3559
|
+
if (e.weightTable[d] !== void 0 && e.weightTable[d].forEach(function(g) {
|
|
3560
|
+
I.push(g.weight), b.push(g.id);
|
|
3561
3561
|
}), I.length > 4) {
|
|
3562
3562
|
s || (console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."), s = !0);
|
|
3563
|
-
const
|
|
3563
|
+
const g = [0, 0, 0, 0], L = [0, 0, 0, 0];
|
|
3564
3564
|
I.forEach(function(k, A) {
|
|
3565
3565
|
let M = k, E = b[A];
|
|
3566
|
-
L.forEach(function(
|
|
3567
|
-
if (M >
|
|
3568
|
-
w[U] = M, M =
|
|
3569
|
-
const v =
|
|
3570
|
-
|
|
3566
|
+
L.forEach(function(D, U, w) {
|
|
3567
|
+
if (M > D) {
|
|
3568
|
+
w[U] = M, M = D;
|
|
3569
|
+
const v = g[U];
|
|
3570
|
+
g[U] = E, E = v;
|
|
3571
3571
|
}
|
|
3572
3572
|
});
|
|
3573
|
-
}), b =
|
|
3573
|
+
}), b = g, I = L;
|
|
3574
3574
|
}
|
|
3575
3575
|
for (; I.length < 4; )
|
|
3576
3576
|
I.push(0), b.push(0);
|
|
3577
|
-
for (let
|
|
3578
|
-
c.push(I[
|
|
3577
|
+
for (let g = 0; g < 4; ++g)
|
|
3578
|
+
c.push(I[g]), h.push(b[g]);
|
|
3579
3579
|
}
|
|
3580
3580
|
if (e.normal) {
|
|
3581
|
-
const
|
|
3582
|
-
a.push(
|
|
3581
|
+
const g = rt(m, n, d, e.normal);
|
|
3582
|
+
a.push(g[0], g[1], g[2]);
|
|
3583
3583
|
}
|
|
3584
|
-
e.material && e.material.mappingType !== "AllSame" && (y = rt(m, n, d, e.material)[0], y < 0 && (u.negativeMaterialIndices = !0, y = 0)), e.uv && e.uv.forEach(function(
|
|
3585
|
-
const k = rt(m, n, d,
|
|
3584
|
+
e.material && e.material.mappingType !== "AllSame" && (y = rt(m, n, d, e.material)[0], y < 0 && (u.negativeMaterialIndices = !0, y = 0)), e.uv && e.uv.forEach(function(g, L) {
|
|
3585
|
+
const k = rt(m, n, d, g);
|
|
3586
3586
|
r[L] === void 0 && (r[L] = []), r[L].push(k[0]), r[L].push(k[1]);
|
|
3587
|
-
}), i++,
|
|
3587
|
+
}), i++, f && (u.genFace(t, e, o, y, a, l, r, c, h, i), n++, i = 0, o = [], a = [], l = [], r = [], c = [], h = []);
|
|
3588
3588
|
}), t;
|
|
3589
3589
|
}
|
|
3590
3590
|
// See https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal
|
|
@@ -3623,15 +3623,15 @@ class Ns {
|
|
|
3623
3623
|
d[n[b + 2]]
|
|
3624
3624
|
)
|
|
3625
3625
|
);
|
|
3626
|
-
const { tangent: m, bitangent: y } = this.getNormalTangentAndBitangent(u),
|
|
3626
|
+
const { tangent: m, bitangent: y } = this.getNormalTangentAndBitangent(u), f = [];
|
|
3627
3627
|
for (const b of u)
|
|
3628
|
-
|
|
3629
|
-
h = pi.triangulateShape(
|
|
3628
|
+
f.push(this.flattenVertex(b, m, y));
|
|
3629
|
+
h = pi.triangulateShape(f, []);
|
|
3630
3630
|
} else
|
|
3631
3631
|
h = [[0, 1, 2]];
|
|
3632
3632
|
for (const [u, d, m] of h)
|
|
3633
|
-
e.vertex.push(t.vertexPositions[n[u * 3]]), e.vertex.push(t.vertexPositions[n[u * 3 + 1]]), e.vertex.push(t.vertexPositions[n[u * 3 + 2]]), e.vertex.push(t.vertexPositions[n[d * 3]]), e.vertex.push(t.vertexPositions[n[d * 3 + 1]]), e.vertex.push(t.vertexPositions[n[d * 3 + 2]]), e.vertex.push(t.vertexPositions[n[m * 3]]), e.vertex.push(t.vertexPositions[n[m * 3 + 1]]), e.vertex.push(t.vertexPositions[n[m * 3 + 2]]), t.skeleton && (e.vertexWeights.push(l[u * 4]), e.vertexWeights.push(l[u * 4 + 1]), e.vertexWeights.push(l[u * 4 + 2]), e.vertexWeights.push(l[u * 4 + 3]), e.vertexWeights.push(l[d * 4]), e.vertexWeights.push(l[d * 4 + 1]), e.vertexWeights.push(l[d * 4 + 2]), e.vertexWeights.push(l[d * 4 + 3]), e.vertexWeights.push(l[m * 4]), e.vertexWeights.push(l[m * 4 + 1]), e.vertexWeights.push(l[m * 4 + 2]), e.vertexWeights.push(l[m * 4 + 3]), e.weightsIndices.push(r[u * 4]), e.weightsIndices.push(r[u * 4 + 1]), e.weightsIndices.push(r[u * 4 + 2]), e.weightsIndices.push(r[u * 4 + 3]), e.weightsIndices.push(r[d * 4]), e.weightsIndices.push(r[d * 4 + 1]), e.weightsIndices.push(r[d * 4 + 2]), e.weightsIndices.push(r[d * 4 + 3]), e.weightsIndices.push(r[m * 4]), e.weightsIndices.push(r[m * 4 + 1]), e.weightsIndices.push(r[m * 4 + 2]), e.weightsIndices.push(r[m * 4 + 3])), t.color && (e.colors.push(o[u * 3]), e.colors.push(o[u * 3 + 1]), e.colors.push(o[u * 3 + 2]), e.colors.push(o[d * 3]), e.colors.push(o[d * 3 + 1]), e.colors.push(o[d * 3 + 2]), e.colors.push(o[m * 3]), e.colors.push(o[m * 3 + 1]), e.colors.push(o[m * 3 + 2])), t.material && t.material.mappingType !== "AllSame" && (e.materialIndex.push(i), e.materialIndex.push(i), e.materialIndex.push(i)), t.normal && (e.normal.push(s[u * 3]), e.normal.push(s[u * 3 + 1]), e.normal.push(s[u * 3 + 2]), e.normal.push(s[d * 3]), e.normal.push(s[d * 3 + 1]), e.normal.push(s[d * 3 + 2]), e.normal.push(s[m * 3]), e.normal.push(s[m * 3 + 1]), e.normal.push(s[m * 3 + 2])), t.uv && t.uv.forEach(function(y,
|
|
3634
|
-
e.uvs[
|
|
3633
|
+
e.vertex.push(t.vertexPositions[n[u * 3]]), e.vertex.push(t.vertexPositions[n[u * 3 + 1]]), e.vertex.push(t.vertexPositions[n[u * 3 + 2]]), e.vertex.push(t.vertexPositions[n[d * 3]]), e.vertex.push(t.vertexPositions[n[d * 3 + 1]]), e.vertex.push(t.vertexPositions[n[d * 3 + 2]]), e.vertex.push(t.vertexPositions[n[m * 3]]), e.vertex.push(t.vertexPositions[n[m * 3 + 1]]), e.vertex.push(t.vertexPositions[n[m * 3 + 2]]), t.skeleton && (e.vertexWeights.push(l[u * 4]), e.vertexWeights.push(l[u * 4 + 1]), e.vertexWeights.push(l[u * 4 + 2]), e.vertexWeights.push(l[u * 4 + 3]), e.vertexWeights.push(l[d * 4]), e.vertexWeights.push(l[d * 4 + 1]), e.vertexWeights.push(l[d * 4 + 2]), e.vertexWeights.push(l[d * 4 + 3]), e.vertexWeights.push(l[m * 4]), e.vertexWeights.push(l[m * 4 + 1]), e.vertexWeights.push(l[m * 4 + 2]), e.vertexWeights.push(l[m * 4 + 3]), e.weightsIndices.push(r[u * 4]), e.weightsIndices.push(r[u * 4 + 1]), e.weightsIndices.push(r[u * 4 + 2]), e.weightsIndices.push(r[u * 4 + 3]), e.weightsIndices.push(r[d * 4]), e.weightsIndices.push(r[d * 4 + 1]), e.weightsIndices.push(r[d * 4 + 2]), e.weightsIndices.push(r[d * 4 + 3]), e.weightsIndices.push(r[m * 4]), e.weightsIndices.push(r[m * 4 + 1]), e.weightsIndices.push(r[m * 4 + 2]), e.weightsIndices.push(r[m * 4 + 3])), t.color && (e.colors.push(o[u * 3]), e.colors.push(o[u * 3 + 1]), e.colors.push(o[u * 3 + 2]), e.colors.push(o[d * 3]), e.colors.push(o[d * 3 + 1]), e.colors.push(o[d * 3 + 2]), e.colors.push(o[m * 3]), e.colors.push(o[m * 3 + 1]), e.colors.push(o[m * 3 + 2])), t.material && t.material.mappingType !== "AllSame" && (e.materialIndex.push(i), e.materialIndex.push(i), e.materialIndex.push(i)), t.normal && (e.normal.push(s[u * 3]), e.normal.push(s[u * 3 + 1]), e.normal.push(s[u * 3 + 2]), e.normal.push(s[d * 3]), e.normal.push(s[d * 3 + 1]), e.normal.push(s[d * 3 + 2]), e.normal.push(s[m * 3]), e.normal.push(s[m * 3 + 1]), e.normal.push(s[m * 3 + 2])), t.uv && t.uv.forEach(function(y, f) {
|
|
3634
|
+
e.uvs[f] === void 0 && (e.uvs[f] = []), e.uvs[f].push(a[f][u * 2]), e.uvs[f].push(a[f][u * 2 + 1]), e.uvs[f].push(a[f][d * 2]), e.uvs[f].push(a[f][d * 2 + 1]), e.uvs[f].push(a[f][m * 2]), e.uvs[f].push(a[f][m * 2 + 1]);
|
|
3635
3635
|
});
|
|
3636
3636
|
}
|
|
3637
3637
|
addMorphTargets(e, t, n, i) {
|
|
@@ -3652,14 +3652,14 @@ class Ns {
|
|
|
3652
3652
|
genMorphGeometry(e, t, n, i, s) {
|
|
3653
3653
|
const o = t.Vertices !== void 0 ? t.Vertices.a : [], a = t.PolygonVertexIndex !== void 0 ? t.PolygonVertexIndex.a : [], l = n.Vertices !== void 0 ? n.Vertices.a : [], r = n.Indexes !== void 0 ? n.Indexes.a : [], c = e.attributes.position.count * 3, h = new Float32Array(c);
|
|
3654
3654
|
for (let y = 0; y < r.length; y++) {
|
|
3655
|
-
const
|
|
3656
|
-
h[
|
|
3655
|
+
const f = r[y] * 3;
|
|
3656
|
+
h[f] = l[y * 3], h[f + 1] = l[y * 3 + 1], h[f + 2] = l[y * 3 + 2];
|
|
3657
3657
|
}
|
|
3658
3658
|
const u = {
|
|
3659
3659
|
vertexIndices: a,
|
|
3660
3660
|
vertexPositions: h,
|
|
3661
3661
|
baseVertexPositions: o
|
|
3662
|
-
}, d = this.genBuffers(u), m = new
|
|
3662
|
+
}, d = this.genBuffers(u), m = new Pe(d.vertex, 3);
|
|
3663
3663
|
m.name = s || n.attrName, m.applyMatrix4(i), e.morphAttributes.position.push(m);
|
|
3664
3664
|
}
|
|
3665
3665
|
// Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
|
|
@@ -3691,8 +3691,8 @@ 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
|
|
3695
|
-
a.fromArray(i, o),
|
|
3694
|
+
for (let o = 0, a = new Q(); o < i.length; o += 4)
|
|
3695
|
+
a.fromArray(i, o), me.colorSpaceToWorking(a, X), a.toArray(i, o);
|
|
3696
3696
|
return {
|
|
3697
3697
|
dataSize: 4,
|
|
3698
3698
|
buffer: i,
|
|
@@ -3727,10 +3727,10 @@ class Ns {
|
|
|
3727
3727
|
parseNurbsGeometry(e) {
|
|
3728
3728
|
const t = parseInt(e.Order);
|
|
3729
3729
|
if (isNaN(t))
|
|
3730
|
-
return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", e.Order, e.id), new
|
|
3730
|
+
return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", e.Order, e.id), new Ye();
|
|
3731
3731
|
const n = t - 1, i = e.KnotVector.a, s = [], o = e.Points.a;
|
|
3732
3732
|
for (let h = 0, u = o.length; h < u; h += 4)
|
|
3733
|
-
s.push(new
|
|
3733
|
+
s.push(new nt().fromArray(o, h));
|
|
3734
3734
|
let a, l;
|
|
3735
3735
|
if (e.Form === "Closed")
|
|
3736
3736
|
s.push(s[0]);
|
|
@@ -3740,7 +3740,7 @@ class Ns {
|
|
|
3740
3740
|
s.push(s[h]);
|
|
3741
3741
|
}
|
|
3742
3742
|
const c = new Os(n, i, s, a, l).getPoints(s.length * 12);
|
|
3743
|
-
return new
|
|
3743
|
+
return new Ye().setFromPoints(c);
|
|
3744
3744
|
}
|
|
3745
3745
|
}
|
|
3746
3746
|
class Bs {
|
|
@@ -3818,13 +3818,13 @@ class Bs {
|
|
|
3818
3818
|
return;
|
|
3819
3819
|
}
|
|
3820
3820
|
const d = {
|
|
3821
|
-
modelName: u.attrName ?
|
|
3821
|
+
modelName: u.attrName ? tt.sanitizeNodeName(u.attrName) : "",
|
|
3822
3822
|
ID: u.id,
|
|
3823
3823
|
initialPosition: [0, 0, 0],
|
|
3824
3824
|
initialRotation: [0, 0, 0],
|
|
3825
3825
|
initialScale: [1, 1, 1]
|
|
3826
3826
|
};
|
|
3827
|
-
|
|
3827
|
+
ne.traverse(function(m) {
|
|
3828
3828
|
m.ID === u.id && (d.transform = m.matrix, m.userData.transformData && (d.eulerOrder = m.userData.transformData.eulerOrder));
|
|
3829
3829
|
}), d.transform || (d.transform = new G()), "PreRotation" in u && (d.preRotation = u.PreRotation.value), "PostRotation" in u && (d.postRotation = u.PostRotation.value), s[r] = d;
|
|
3830
3830
|
}
|
|
@@ -3834,11 +3834,11 @@ class Bs {
|
|
|
3834
3834
|
if (s[r] === void 0) {
|
|
3835
3835
|
const h = j.get(l.ID).parents.filter(function(b) {
|
|
3836
3836
|
return b.relationship !== void 0;
|
|
3837
|
-
})[0].ID, u = j.get(h).parents[0].ID, d = j.get(u).parents[0].ID, m = j.get(d).parents[0].ID, y = H.Objects.Model[m],
|
|
3838
|
-
modelName: y.attrName ?
|
|
3837
|
+
})[0].ID, u = j.get(h).parents[0].ID, d = j.get(u).parents[0].ID, m = j.get(d).parents[0].ID, y = H.Objects.Model[m], f = {
|
|
3838
|
+
modelName: y.attrName ? tt.sanitizeNodeName(y.attrName) : "",
|
|
3839
3839
|
morphName: H.Objects.Deformer[h].attrName
|
|
3840
3840
|
};
|
|
3841
|
-
s[r] =
|
|
3841
|
+
s[r] = f;
|
|
3842
3842
|
}
|
|
3843
3843
|
s[r][c.attr] = c;
|
|
3844
3844
|
}
|
|
@@ -3900,8 +3900,8 @@ 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 =
|
|
3904
|
-
n !== void 0 && (n = n.map(
|
|
3903
|
+
const l = it(0);
|
|
3904
|
+
n !== void 0 && (n = n.map(q.degToRad), n.push(l), n = new Ce().fromArray(n), n = new he().setFromEuler(n)), i !== void 0 && (i = i.map(q.degToRad), i.push(l), i = new Ce().fromArray(i), i = new he().setFromEuler(i).invert());
|
|
3905
3905
|
const r = new he(), c = new Ce(), h = [];
|
|
3906
3906
|
if (!a || !o) return new mt(e + ".quaternion", [0], [0]);
|
|
3907
3907
|
for (let u = 0; u < a.length; u += 3)
|
|
@@ -3914,7 +3914,7 @@ class Bs {
|
|
|
3914
3914
|
generateMorphTrack(e) {
|
|
3915
3915
|
const t = e.DeformPercent.curves.morph, n = t.values.map(function(s) {
|
|
3916
3916
|
return s / 100;
|
|
3917
|
-
}), i =
|
|
3917
|
+
}), i = ne.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];
|
|
3918
3918
|
return new Pt(e.modelName + ".morphTargetInfluences[" + i + "]", t.times, n);
|
|
3919
3919
|
}
|
|
3920
3920
|
// For all animated objects, times are defined separately for each axis
|
|
@@ -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(q.degToRad(e.values[0])), o.push(q.degToRad(t.values[0])), o.push(q.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(q.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(q.degToRad), u = [
|
|
3979
3979
|
c[0] - l[0],
|
|
3980
3980
|
c[1] - l[1],
|
|
3981
3981
|
c[2] - l[2]
|
|
@@ -3985,13 +3985,13 @@ class Bs {
|
|
|
3985
3985
|
Math.abs(u[2])
|
|
3986
3986
|
];
|
|
3987
3987
|
if (d[0] >= 180 || d[1] >= 180 || d[2] >= 180) {
|
|
3988
|
-
const y = Math.max(...d) / 180,
|
|
3989
|
-
I.dot(
|
|
3988
|
+
const y = Math.max(...d) / 180, f = new Ce(...r, i), b = new Ce(...h, i), I = new he().setFromEuler(f), g = new he().setFromEuler(b);
|
|
3989
|
+
I.dot(g) && g.set(-g.x, -g.y, -g.z, -g.w);
|
|
3990
3990
|
const L = e.times[a - 1], k = e.times[a] - L, A = new he(), M = new Ce();
|
|
3991
3991
|
for (let E = 0; E < 1; E += 1 / y)
|
|
3992
|
-
A.copy(I.clone().slerp(
|
|
3992
|
+
A.copy(I.clone().slerp(g.clone(), E)), s.push(L + E * k), M.setFromQuaternion(A, i), o.push(M.x), o.push(M.y), o.push(M.z);
|
|
3993
3993
|
} else
|
|
3994
|
-
s.push(e.times[a]), o.push(
|
|
3994
|
+
s.push(e.times[a]), o.push(q.degToRad(e.values[a])), o.push(q.degToRad(t.values[a])), o.push(q.degToRad(n.values[a]));
|
|
3995
3995
|
}
|
|
3996
3996
|
return [s, o];
|
|
3997
3997
|
}
|
|
@@ -4368,43 +4368,43 @@ function rt(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 St = new Ce(),
|
|
4371
|
+
const St = new Ce(), Fe = new _();
|
|
4372
4372
|
function Hn(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(), c = new G(), h = new G(), u = new G(), d = p.inheritType ? p.inheritType : 0;
|
|
4374
|
-
p.translation && e.setPosition(
|
|
4375
|
-
const m =
|
|
4374
|
+
p.translation && e.setPosition(Fe.fromArray(p.translation));
|
|
4375
|
+
const m = it(0);
|
|
4376
4376
|
if (p.preRotation) {
|
|
4377
|
-
const w = p.preRotation.map(
|
|
4377
|
+
const w = p.preRotation.map(q.degToRad);
|
|
4378
4378
|
w.push(m), t.makeRotationFromEuler(St.fromArray(w));
|
|
4379
4379
|
}
|
|
4380
4380
|
if (p.rotation) {
|
|
4381
|
-
const w = p.rotation.map(
|
|
4381
|
+
const w = p.rotation.map(q.degToRad);
|
|
4382
4382
|
w.push(p.eulerOrder || m), n.makeRotationFromEuler(St.fromArray(w));
|
|
4383
4383
|
}
|
|
4384
4384
|
if (p.postRotation) {
|
|
4385
|
-
const w = p.postRotation.map(
|
|
4385
|
+
const w = p.postRotation.map(q.degToRad);
|
|
4386
4386
|
w.push(m), i.makeRotationFromEuler(St.fromArray(w)), i.invert();
|
|
4387
4387
|
}
|
|
4388
|
-
p.scale && s.scale(
|
|
4389
|
-
const y = t.clone().multiply(n).multiply(i),
|
|
4390
|
-
|
|
4388
|
+
p.scale && s.scale(Fe.fromArray(p.scale)), p.scalingOffset && a.setPosition(Fe.fromArray(p.scalingOffset)), p.scalingPivot && o.setPosition(Fe.fromArray(p.scalingPivot)), p.rotationOffset && l.setPosition(Fe.fromArray(p.rotationOffset)), p.rotationPivot && r.setPosition(Fe.fromArray(p.rotationPivot)), p.parentMatrixWorld && (h.copy(p.parentMatrix), c.copy(p.parentMatrixWorld));
|
|
4389
|
+
const y = t.clone().multiply(n).multiply(i), f = new G();
|
|
4390
|
+
f.extractRotation(c);
|
|
4391
4391
|
const b = new G();
|
|
4392
4392
|
b.copyPosition(c);
|
|
4393
|
-
const I = b.clone().invert().multiply(c),
|
|
4393
|
+
const I = b.clone().invert().multiply(c), g = f.clone().invert().multiply(I), L = s, k = new G();
|
|
4394
4394
|
if (d === 0)
|
|
4395
|
-
k.copy(
|
|
4395
|
+
k.copy(f).multiply(y).multiply(g).multiply(L);
|
|
4396
4396
|
else if (d === 1)
|
|
4397
|
-
k.copy(
|
|
4397
|
+
k.copy(f).multiply(g).multiply(y).multiply(L);
|
|
4398
4398
|
else {
|
|
4399
|
-
const v = new G().scale(new _().setFromMatrixScale(h)).clone().invert(),
|
|
4400
|
-
k.copy(
|
|
4399
|
+
const v = new G().scale(new _().setFromMatrixScale(h)).clone().invert(), S = g.clone().multiply(v);
|
|
4400
|
+
k.copy(f).multiply(y).multiply(S).multiply(L);
|
|
4401
4401
|
}
|
|
4402
4402
|
const A = r.clone().invert(), M = o.clone().invert();
|
|
4403
4403
|
let E = e.clone().multiply(l).multiply(r).multiply(t).multiply(n).multiply(i).multiply(A).multiply(a).multiply(o).multiply(s).multiply(M);
|
|
4404
|
-
const
|
|
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
|
}
|
|
4407
|
-
function
|
|
4407
|
+
function it(p) {
|
|
4408
4408
|
p = p || 0;
|
|
4409
4409
|
const e = [
|
|
4410
4410
|
"ZYX",
|
|
@@ -4447,21 +4447,21 @@ class Ks extends mi {
|
|
|
4447
4447
|
e.deleteAttribute("uv");
|
|
4448
4448
|
const t = new pt({ side: gi }), n = new pt(), i = new dt(16777215, 900, 28, 2);
|
|
4449
4449
|
i.position.set(0.418, 16.199, 0.3), this.add(i);
|
|
4450
|
-
const s = new
|
|
4450
|
+
const s = new Ae(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
4452
|
const o = new cn(e, n, 6), a = new Ee();
|
|
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
|
-
const l = new
|
|
4454
|
+
const l = new Ae(e, De(50));
|
|
4455
4455
|
l.position.set(-16.116, 14.37, 8.208), l.scale.set(0.1, 2.428, 2.739), this.add(l);
|
|
4456
|
-
const r = new
|
|
4456
|
+
const r = new Ae(e, De(50));
|
|
4457
4457
|
r.position.set(-16.109, 18.021, -8.207), r.scale.set(0.1, 2.425, 2.751), this.add(r);
|
|
4458
|
-
const c = new
|
|
4458
|
+
const c = new Ae(e, De(17));
|
|
4459
4459
|
c.position.set(14.904, 12.198, -1.832), c.scale.set(0.15, 4.265, 6.331), this.add(c);
|
|
4460
|
-
const h = new
|
|
4460
|
+
const h = new Ae(e, De(43));
|
|
4461
4461
|
h.position.set(-0.462, 8.89, 14.52), h.scale.set(4.38, 5.441, 0.088), this.add(h);
|
|
4462
|
-
const u = new
|
|
4462
|
+
const u = new Ae(e, De(20));
|
|
4463
4463
|
u.position.set(3.235, 11.486, -12.541), u.scale.set(2.5, 2, 0.1), this.add(u);
|
|
4464
|
-
const d = new
|
|
4464
|
+
const d = new Ae(e, De(100));
|
|
4465
4465
|
d.position.set(0, 20, 0), d.scale.set(1, 0.1, 1), this.add(d);
|
|
4466
4466
|
}
|
|
4467
4467
|
/**
|
|
@@ -4477,7 +4477,7 @@ class Ks extends mi {
|
|
|
4477
4477
|
t.dispose();
|
|
4478
4478
|
}
|
|
4479
4479
|
}
|
|
4480
|
-
function
|
|
4480
|
+
function De(p) {
|
|
4481
4481
|
return new vn({
|
|
4482
4482
|
color: 0,
|
|
4483
4483
|
emissive: 16777215,
|
|
@@ -4528,22 +4528,22 @@ var Qe = function() {
|
|
|
4528
4528
|
Qe.Panel = function(p, e, t) {
|
|
4529
4529
|
var n = 1 / 0, i = 0, s = Math.round, o = s(window.devicePixelRatio || 1), a = 80 * o, l = 48 * o, r = 3 * o, c = 2 * o, h = 3 * o, u = 15 * o, d = 74 * o, m = 30 * o, y = document.createElement("canvas");
|
|
4530
4530
|
y.width = a, y.height = l, y.style.cssText = "width:80px;height:48px";
|
|
4531
|
-
var
|
|
4532
|
-
return
|
|
4531
|
+
var f = y.getContext("2d");
|
|
4532
|
+
return f.font = "bold " + 9 * o + "px Helvetica,Arial,sans-serif", f.textBaseline = "top", f.fillStyle = t, f.fillRect(0, 0, a, l), f.fillStyle = e, f.fillText(p, r, c), f.fillRect(h, u, d, m), f.fillStyle = t, f.globalAlpha = 0.9, f.fillRect(h, u, d, m), {
|
|
4533
4533
|
dom: y,
|
|
4534
4534
|
update: function(b, I) {
|
|
4535
|
-
n = Math.min(n, b), i = Math.max(i, b),
|
|
4535
|
+
n = Math.min(n, b), i = Math.max(i, b), f.fillStyle = t, f.globalAlpha = 1, f.fillRect(0, 0, a, u), f.fillStyle = e, f.fillText(s(b) + " " + p + " (" + s(n) + "-" + s(i) + ")", r, c), f.drawImage(y, h + o, u, d - o, m, h, u, d - o, m), f.fillRect(h + d - o, u, o, m), f.fillStyle = t, f.globalAlpha = 0.9, f.fillRect(h + d - o, u, o, s((1 - b / I) * m));
|
|
4536
4536
|
}
|
|
4537
4537
|
};
|
|
4538
4538
|
};
|
|
4539
4539
|
let x, oe, re;
|
|
4540
|
-
const
|
|
4540
|
+
const T = [0, 0, 0, 0], z = new R.Vector3(), lt = new R.Vector3(), $ = new R.Vector3(), ht = new R.Vector3();
|
|
4541
4541
|
new R.Plane();
|
|
4542
4542
|
new R.Ray();
|
|
4543
4543
|
new R.Euler();
|
|
4544
|
-
const
|
|
4544
|
+
const ee = new R.Quaternion(), nn = new R.Quaternion(), ge = new R.Matrix4(), ye = new R.Matrix4();
|
|
4545
4545
|
new R.Vector3();
|
|
4546
|
-
const ct = new R.Vector3(0, 0, 1),
|
|
4546
|
+
const ct = 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
|
-
c.boneParent.matrixWorld.decompose(z,
|
|
4870
|
+
c.boneParent.matrixWorld.decompose(z, ee, $), z.copy(ct).applyQuaternion(ee).setY(0).normalize(), ee.premultiply(nn.setFromUnitVectors(ct, z).invert()).normalize(), c.qWorldInverseYaw = ee.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], z.copy(o.vWorld),
|
|
4888
|
+
if (o = this.data[t], z.copy(o.vWorld), ge.copy(o.boneParent.matrixWorld), ye.copy(ge).invert(), o.vWorld.setFromMatrixPosition(ge), z.applyMatrix4(ye), z.length() > 0.5 && (console.info("Info: Unrealistic jump of " + z.length().toFixed(2) + " meters."), z.setLength(0.5)), z.applyQuaternion(o.bone.quaternion), T[0] = z.x, T[1] = z.y, T[2] = -z.z, T[3] = z.length() / 3, o.children)
|
|
4889
4889
|
for (n = 0, s = o.children.length; n < s; n++)
|
|
4890
|
-
x = o.children[n],
|
|
4891
|
-
if (x = this.opt.sensitivityFactor,
|
|
4892
|
-
o.vBasis.x +
|
|
4893
|
-
o.vBasis.y +
|
|
4894
|
-
o.vBasis.z +
|
|
4895
|
-
), z.applyMatrix4(
|
|
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, z.set(
|
|
4892
|
+
o.vBasis.x + T[0],
|
|
4893
|
+
o.vBasis.y + T[1],
|
|
4894
|
+
o.vBasis.z + T[2]
|
|
4895
|
+
), z.applyMatrix4(ge), z.x += x[0], z.y += x[1], z.z += x[2], z.applyMatrix4(ye), T[0] += z.x - o.vBasis.x, T[1] += z.y - o.vBasis.y, T[2] += z.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
|
-
o.vBasis.x +
|
|
4898
|
-
o.vBasis.y +
|
|
4899
|
-
o.vBasis.z -
|
|
4897
|
+
o.vBasis.x + T[0],
|
|
4898
|
+
o.vBasis.y + T[1],
|
|
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(z,
|
|
4901
|
+
else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(z, ee, $), z.copy(ct).applyQuaternion(ee).setY(0).normalize(), ee.premultiply(nn.setFromUnitVectors(ct, z).invert()).normalize(), o.boneParent.quaternion.multiply(ee.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (x = Math.atan(T[0] / o.l), ee.setFromAxisAngle(Js, -x), o.boneParent.quaternion.multiply(ee)), 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), ee.setFromAxisAngle(qs, -x), o.boneParent.quaternion.multiply(ee)), o.isT && (x = 1.5 * Math.tanh(T[3] * 1.5), ee.setFromAxisAngle(Qs, -x), o.boneParent.quaternion.multiply(ee)), 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],
|
|
4903
|
+
x = o.excludes[n], $.set(0, 0, 0), x.deltaLocal && ($.x += x.deltaLocal[0], $.y += x.deltaLocal[1], $.z += x.deltaLocal[2]), $.applyMatrix4(x.bone.matrixWorld), ye.copy(o.boneParent.matrixWorld).invert(), $.applyMatrix4(ye), z.copy(o.bone.position), !(z.distanceToSquared($) >= x.radiusSq) && (re = z.length(), oe = $.length(), !(oe > x.radius + re) && (oe < Math.abs(x.radius - re) || (oe = (oe * oe + re * re - x.radiusSq) / (2 * oe), $.normalize(), ht.copy($).multiplyScalar(oe), oe = Math.sqrt(re * re - oe * oe), z.subVectors(z, ht).projectOnPlane($).normalize().multiplyScalar(oe), lt.subVectors(o.vBasis, ht).projectOnPlane($).normalize(), re = lt.dot(z), re < 0 && (re = Math.sqrt(oe * oe - re * re), lt.multiplyScalar(re), z.add(lt)), z.add(ht).normalize(), $.copy(o.bone.position).normalize(), ee.setFromUnitVectors($, z), o.boneParent.quaternion.premultiply(ee), o.boneParent.updateWorldMatrix(!1, !0))));
|
|
4904
4904
|
}
|
|
4905
4905
|
this.helpers.isActive && this.updateHelpers();
|
|
4906
4906
|
}
|
|
@@ -4971,17 +4971,17 @@ class $s {
|
|
|
4971
4971
|
*/
|
|
4972
4972
|
updateHelpers() {
|
|
4973
4973
|
if (x = this.helpers.points, x.bones.length) {
|
|
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
|
-
|
|
4977
|
+
ge.multiplyMatrices(ye, x.bones[t].matrixWorld), z.setFromMatrixPosition(ge), e.setXYZ(t, z.x, z.y, z.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
|
-
|
|
4984
|
+
ge.multiplyMatrices(ye, x.bones[t].matrixWorld), z.setFromMatrixPosition(ge), e.setXYZ(n, z.x, z.y, z.z), ge.multiplyMatrices(ye, x.bones[t].parent.matrixWorld), z.setFromMatrixPosition(ge), e.setXYZ(n + 1, z.x, z.y, z.z);
|
|
4985
4985
|
e.needsUpdate = !0, x.object.updateMatrixWorld();
|
|
4986
4986
|
}
|
|
4987
4987
|
}
|
|
@@ -5137,8 +5137,8 @@ class eo {
|
|
|
5137
5137
|
for (let h = 0; h < i / 2; h++) {
|
|
5138
5138
|
const u = n[(l + h) * 2], d = n[(l + h) * 2 + 1], m = n[(l + h + i / 2) * 2] * r - n[(l + h + i / 2) * 2 + 1] * c, y = n[(l + h + i / 2) * 2] * c + n[(l + h + i / 2) * 2 + 1] * r;
|
|
5139
5139
|
n[(l + h) * 2] = u + m, n[(l + h) * 2 + 1] = d + y, n[(l + h + i / 2) * 2] = u - m, n[(l + h + i / 2) * 2 + 1] = d - y;
|
|
5140
|
-
const
|
|
5141
|
-
r =
|
|
5140
|
+
const f = r * o - c * a, b = r * a + c * o;
|
|
5141
|
+
r = f, c = b;
|
|
5142
5142
|
}
|
|
5143
5143
|
}
|
|
5144
5144
|
}
|
|
@@ -7158,7 +7158,7 @@ const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
7158
7158
|
fr: ao,
|
|
7159
7159
|
fi: lo,
|
|
7160
7160
|
lt: co
|
|
7161
|
-
}, W = new R.Quaternion(), O = new R.Euler(),
|
|
7161
|
+
}, W = new R.Quaternion(), O = new R.Euler(), ve = new R.Vector3(), Se = new R.Vector3(), on = new R.Box3();
|
|
7162
7162
|
new R.Matrix4();
|
|
7163
7163
|
new R.Matrix4();
|
|
7164
7164
|
new R.Vector3();
|
|
@@ -8733,13 +8733,13 @@ class Fn {
|
|
|
8733
8733
|
const h = s.morphTargetDictionary[r], u = o.morphAttributes.position[h], d = o.morphAttributes.normal?.[h];
|
|
8734
8734
|
a || (a = new R.Float32BufferAttribute(u.count * 3, 3), d && (l = new R.Float32BufferAttribute(u.count * 3, 3)));
|
|
8735
8735
|
for (let m = 0; m < u.count; m++) {
|
|
8736
|
-
const y = a.getX(m) + u.getX(m) * c,
|
|
8737
|
-
a.setXYZ(m, y,
|
|
8736
|
+
const y = a.getX(m) + u.getX(m) * c, f = a.getY(m) + u.getY(m) * c, b = a.getZ(m) + u.getZ(m) * c;
|
|
8737
|
+
a.setXYZ(m, y, f, b);
|
|
8738
8738
|
}
|
|
8739
8739
|
if (d)
|
|
8740
8740
|
for (let m = 0; m < u.count; m++) {
|
|
8741
|
-
const y = l.getX(m) + d.getX(m) * c,
|
|
8742
|
-
l.setXYZ(m, y,
|
|
8741
|
+
const y = l.getX(m) + d.getX(m) * c, f = l.getY(m) + d.getY(m) * c, b = l.getZ(m) + d.getZ(m) * c;
|
|
8742
|
+
l.setXYZ(m, y, f, b);
|
|
8743
8743
|
}
|
|
8744
8744
|
}
|
|
8745
8745
|
if (a) {
|
|
@@ -9114,7 +9114,7 @@ class Fn {
|
|
|
9114
9114
|
*/
|
|
9115
9115
|
async initializeFBXAnimationLoader() {
|
|
9116
9116
|
try {
|
|
9117
|
-
const { FBXAnimationLoader: e } = await import("./fbxAnimationLoader-
|
|
9117
|
+
const { FBXAnimationLoader: e } = await import("./fbxAnimationLoader-DRJgB6tB.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;
|
|
@@ -9624,8 +9624,8 @@ class Fn {
|
|
|
9624
9624
|
else {
|
|
9625
9625
|
m.newvalue = d[i + 1];
|
|
9626
9626
|
const y = h.ts[i + 1] - h.ts[i];
|
|
9627
|
-
let
|
|
9628
|
-
y > 1e-4 && (
|
|
9627
|
+
let f = 1;
|
|
9628
|
+
y > 1e-4 && (f = (this.animClock - h.ts[i]) / y), f < 1 && (m.easing && (f = m.easing(f)), m.newvalue = (1 - f) * d[i] + f * m.newvalue), m.ref && m.ref !== h.vs && m.ref.hasOwnProperty(u) && delete m.ref[u], m.ref = h.vs;
|
|
9629
9629
|
}
|
|
9630
9630
|
if (a)
|
|
9631
9631
|
switch (u) {
|
|
@@ -9709,7 +9709,7 @@ class Fn {
|
|
|
9709
9709
|
eyeLookOutRight: [null, 0],
|
|
9710
9710
|
eyeContact: [0]
|
|
9711
9711
|
}
|
|
9712
|
-
})))), t > 2 * this.animFrameDur && (t = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (n = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], i = this.mtAvatar[n], i.needsUpdate || Object.assign(i, { base: (this.mood.baseline[n] || 0) + (1 + a / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(t / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), (this.isSpeaking || this.isListening) && l ? a > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = a) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), n = this.volumeHeadTarget - this.volumeHeadCurrent, i = Math.abs(n), i > 1e-4 && (o = i * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * t / 1e3 / i) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(n) * Math.min(i, o)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (W.setFromAxisAngle(po, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(W)), on.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(
|
|
9712
|
+
})))), t > 2 * this.animFrameDur && (t = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (n = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], i = this.mtAvatar[n], i.needsUpdate || Object.assign(i, { base: (this.mood.baseline[n] || 0) + (1 + a / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(t / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), (this.isSpeaking || this.isListening) && l ? a > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = a) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), n = this.volumeHeadTarget - this.volumeHeadCurrent, i = Math.abs(n), i > 1e-4 && (o = i * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * t / 1e3 / i) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(n) * Math.min(i, o)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (W.setFromAxisAngle(po, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(W)), on.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(ve), ve.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(Se), Se.sub(this.armature.position), this.objectHips.position.y -= on.min.y / 2, this.objectHips.position.x -= (ve.x + Se.x) / 4, this.objectHips.position.z -= (ve.z + Se.z) / 2, this.dynamicbones.update(t), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(t), this.updateMorphTargets(t), this.isAvatarOnly)
|
|
9713
9713
|
this.stats && this.stats.end();
|
|
9714
9714
|
else {
|
|
9715
9715
|
if (this.cameraClock !== null && this.cameraClock < 1e3) {
|
|
@@ -9778,12 +9778,12 @@ class Fn {
|
|
|
9778
9778
|
t = t || {};
|
|
9779
9779
|
const s = /[!\.\?\n\p{Extended_Pictographic}]/ug, o = /[ ]/ug, a = /[\p{L}\p{N},\.\p{Quotation_Mark}!€\$\+\p{Dash_Punctuation}%&\?]/ug, l = /[\p{Extended_Pictographic}]/ug, r = t.lipsyncLang || this.avatar.lipsyncLang || this.opt.lipsyncLang;
|
|
9780
9780
|
let c = "", h = "", u = 0, d = [], m = [];
|
|
9781
|
-
const y = Array.from(this.segmenter.segment(e), (
|
|
9782
|
-
for (let
|
|
9783
|
-
const b =
|
|
9784
|
-
let
|
|
9785
|
-
const L = y[
|
|
9786
|
-
if (
|
|
9781
|
+
const y = Array.from(this.segmenter.segment(e), (f) => f.segment);
|
|
9782
|
+
for (let f = 0; f < y.length; f++) {
|
|
9783
|
+
const b = f === y.length - 1, I = y[f].match(a);
|
|
9784
|
+
let g = y[f].match(s);
|
|
9785
|
+
const L = y[f].match(l), k = y[f].match(o);
|
|
9786
|
+
if (g && !b && !L && y[f + 1].match(s) && (g = !1), n && (c += y[f]), I && (!i || i.every((A) => f < A[0] || f > A[1])) && (h += y[f]), (k || g || b) && (h.length && (h = this.lipsyncPreProcessText(h, r), h.length && d.push({
|
|
9787
9787
|
mark: u,
|
|
9788
9788
|
word: h
|
|
9789
9789
|
})), c.length && (m.push({
|
|
@@ -9809,7 +9809,7 @@ class Fn {
|
|
|
9809
9809
|
}
|
|
9810
9810
|
h = "", u++;
|
|
9811
9811
|
}
|
|
9812
|
-
if (
|
|
9812
|
+
if (g || b) {
|
|
9813
9813
|
if (d.length || b && m.length) {
|
|
9814
9814
|
const A = {
|
|
9815
9815
|
anim: m
|
|
@@ -9817,7 +9817,7 @@ class Fn {
|
|
|
9817
9817
|
n && (A.onSubtitles = n), d.length && !t.avatarMute && (A.text = d, t.avatarMood && (A.mood = t.avatarMood), t.ttsLang && (A.lang = t.ttsLang), t.ttsVoice && (A.voice = t.ttsVoice), t.ttsRate && (A.rate = t.ttsRate), t.ttsVoice && (A.pitch = t.ttsPitch), t.ttsVolume && (A.volume = t.ttsVolume)), this.speechQueue.push(A), d = [], h = "", u = 0, m = [];
|
|
9818
9818
|
}
|
|
9819
9819
|
if (L) {
|
|
9820
|
-
let A = this.animEmojis[y[
|
|
9820
|
+
let A = this.animEmojis[y[f]];
|
|
9821
9821
|
A && A.link && (A = this.animEmojis[A.link]), A && this.speechQueue.push({ emoji: A });
|
|
9822
9822
|
}
|
|
9823
9823
|
this.speechQueue.push({ break: 100 });
|
|
@@ -9913,13 +9913,13 @@ class Fn {
|
|
|
9913
9913
|
const d = u.times[u.visemes.length - 1] + u.durations[u.visemes.length - 1], m = Math.min(c, Math.max(0, c - u.visemes.length * 150));
|
|
9914
9914
|
let y = 0.6 + this.convertRange(m, [0, c], [0, 0.4]);
|
|
9915
9915
|
if (c = Math.min(c, u.visemes.length * 200), d > 0)
|
|
9916
|
-
for (let
|
|
9917
|
-
const b = r + u.times[
|
|
9916
|
+
for (let f = 0; f < u.visemes.length; f++) {
|
|
9917
|
+
const b = r + u.times[f] / d * c, I = u.durations[f] / d * c;
|
|
9918
9918
|
o.push({
|
|
9919
9919
|
template: { name: "viseme" },
|
|
9920
9920
|
ts: [b - Math.min(60, 2 * I / 3), b + Math.min(25, I / 2), b + I + Math.min(60, I / 2)],
|
|
9921
9921
|
vs: {
|
|
9922
|
-
["viseme_" + u.visemes[
|
|
9922
|
+
["viseme_" + u.visemes[f]]: [null, u.visemes[f] === "PP" || u.visemes[f] === "FF" ? 0.9 : y, 0]
|
|
9923
9923
|
}
|
|
9924
9924
|
});
|
|
9925
9925
|
}
|
|
@@ -9995,30 +9995,30 @@ class Fn {
|
|
|
9995
9995
|
*/
|
|
9996
9996
|
async synthesizeWithBrowserTTS(e) {
|
|
9997
9997
|
return new Promise((t, n) => {
|
|
9998
|
-
const i = e.text.map((
|
|
9998
|
+
const i = e.text.map((g) => g.word).join(" "), s = new SpeechSynthesisUtterance(i), o = e.lang || this.avatar.ttsLang || this.opt.ttsLang || "en-US", a = (e.rate || this.avatar.ttsRate || this.opt.ttsRate || 1) + this.mood.speech.deltaRate, l = (e.pitch || this.avatar.ttsPitch || this.opt.ttsPitch || 1) + this.mood.speech.deltaPitch, r = (e.volume || this.avatar.ttsVolume || this.opt.ttsVolume || 1) + this.mood.speech.deltaVolume;
|
|
9999
9999
|
s.lang = o, s.rate = Math.max(0.1, Math.min(10, a)), s.pitch = Math.max(0, Math.min(2, l)), s.volume = Math.max(0, Math.min(1, r));
|
|
10000
10000
|
const c = speechSynthesis.getVoices(), h = e.voice || this.avatar.ttsVoice || this.opt.ttsVoice;
|
|
10001
10001
|
if (h && c.length > 0) {
|
|
10002
|
-
const
|
|
10003
|
-
|
|
10002
|
+
const g = c.find((L) => L.name.includes(h) || L.lang === o);
|
|
10003
|
+
g && (s.voice = g);
|
|
10004
10004
|
}
|
|
10005
|
-
const u = i.length * 100 / s.rate, d = this.audioCtx.createBuffer(1, this.audioCtx.sampleRate * (u / 1e3), this.audioCtx.sampleRate), m = this.avatar.lipsyncLang || this.opt.lipsyncLang || "en", y = this.lipsyncPreProcessText(i, m),
|
|
10005
|
+
const u = i.length * 100 / s.rate, d = this.audioCtx.createBuffer(1, this.audioCtx.sampleRate * (u / 1e3), this.audioCtx.sampleRate), m = this.avatar.lipsyncLang || this.opt.lipsyncLang || "en", y = this.lipsyncPreProcessText(i, m), f = this.lipsyncWordsToVisemes(y, m);
|
|
10006
10006
|
console.log("Browser TTS Lip-sync Debug:", {
|
|
10007
10007
|
text: i,
|
|
10008
10008
|
lipsyncLang: m,
|
|
10009
10009
|
processedText: y,
|
|
10010
|
-
lipsyncData:
|
|
10011
|
-
hasVisemes:
|
|
10010
|
+
lipsyncData: f,
|
|
10011
|
+
hasVisemes: f && f.visemes && f.visemes.length > 0,
|
|
10012
10012
|
estimatedDuration: u
|
|
10013
10013
|
});
|
|
10014
10014
|
const b = [];
|
|
10015
|
-
if (
|
|
10016
|
-
const
|
|
10017
|
-
for (let L = 0; L <
|
|
10018
|
-
const k =
|
|
10015
|
+
if (f && f.visemes && f.visemes.length > 0) {
|
|
10016
|
+
const g = f.times[f.visemes.length - 1] + f.durations[f.visemes.length - 1];
|
|
10017
|
+
for (let L = 0; L < f.visemes.length; L++) {
|
|
10018
|
+
const k = f.visemes[L], A = f.times[L] / g, M = f.durations[L] / g, E = A * u, D = M * u;
|
|
10019
10019
|
b.push({
|
|
10020
10020
|
template: { name: "viseme" },
|
|
10021
|
-
ts: [E - Math.min(60, 2 *
|
|
10021
|
+
ts: [E - Math.min(60, 2 * D / 3), E + Math.min(25, D / 2), E + 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
|
}
|
|
@@ -10028,8 +10028,8 @@ class Fn {
|
|
|
10028
10028
|
const I = [...e.anim, ...b];
|
|
10029
10029
|
this.audioPlaylist.push({ anim: I, audio: d }), this.onSubtitles = e.onSubtitles || null, this.resetLips(), e.mood && this.setMood(e.mood), this.playAudio(), s.onend = () => {
|
|
10030
10030
|
t();
|
|
10031
|
-
}, s.onerror = (
|
|
10032
|
-
console.error("Speech synthesis error:",
|
|
10031
|
+
}, s.onerror = (g) => {
|
|
10032
|
+
console.error("Speech synthesis error:", g.error), n(g.error);
|
|
10033
10033
|
}, speechSynthesis.speak(s);
|
|
10034
10034
|
});
|
|
10035
10035
|
}
|
|
@@ -10092,15 +10092,15 @@ class Fn {
|
|
|
10092
10092
|
console.error("Text-based lip-sync failed, using fallback:", u);
|
|
10093
10093
|
const d = t.toLowerCase().split(/\s+/), m = [];
|
|
10094
10094
|
for (const y of d)
|
|
10095
|
-
for (const
|
|
10095
|
+
for (const f of y) {
|
|
10096
10096
|
let b = "aa";
|
|
10097
|
-
"aeiou".includes(
|
|
10097
|
+
"aeiou".includes(f) ? b = "aa" : "bp".includes(f) ? b = "PP" : "fv".includes(f) ? b = "FF" : "st".includes(f) ? b = "SS" : "dln".includes(f) ? b = "DD" : "kg".includes(f) ? b = "kk" : "rw".includes(f) && (b = "RR"), m.push(b);
|
|
10098
10098
|
}
|
|
10099
10099
|
r = {
|
|
10100
|
-
visemes: m.map((y,
|
|
10100
|
+
visemes: m.map((y, f) => ({
|
|
10101
10101
|
viseme: y,
|
|
10102
|
-
startTime:
|
|
10103
|
-
endTime: (
|
|
10102
|
+
startTime: f * a.duration / m.length,
|
|
10103
|
+
endTime: (f + 1) * a.duration / m.length,
|
|
10104
10104
|
duration: a.duration / m.length,
|
|
10105
10105
|
intensity: 0.6
|
|
10106
10106
|
})),
|
|
@@ -10125,12 +10125,12 @@ class Fn {
|
|
|
10125
10125
|
if (r.visemes && r.visemes.length > 0) {
|
|
10126
10126
|
console.log("ElevenLabs: Generating lip-sync animation from", r.visemes.length, "visemes");
|
|
10127
10127
|
for (let u = 0; u < r.visemes.length; u++) {
|
|
10128
|
-
const d = r.visemes[u], m = d.startTime * 1e3, y = d.duration * 1e3,
|
|
10128
|
+
const d = r.visemes[u], m = d.startTime * 1e3, y = d.duration * 1e3, f = d.intensity;
|
|
10129
10129
|
c.push({
|
|
10130
10130
|
template: { name: "viseme" },
|
|
10131
10131
|
ts: [m - Math.min(60, 2 * y / 3), m + Math.min(25, y / 2), m + y + Math.min(60, y / 2)],
|
|
10132
10132
|
vs: {
|
|
10133
|
-
["viseme_" + d.viseme]: [null,
|
|
10133
|
+
["viseme_" + d.viseme]: [null, f, 0]
|
|
10134
10134
|
}
|
|
10135
10135
|
});
|
|
10136
10136
|
}
|
|
@@ -10564,7 +10564,7 @@ class Fn {
|
|
|
10564
10564
|
*/
|
|
10565
10565
|
lookAtCamera(e) {
|
|
10566
10566
|
let t;
|
|
10567
|
-
if (this.speakTo && (t = new R.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0),
|
|
10567
|
+
if (this.speakTo && (t = new R.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0), ve.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), Se.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), t.addVectors(ve, Se).divideScalar(2)) : this.speakTo.isObject3D ? this.speakTo.getWorldPosition(t) : this.speakTo.isVector3 ? t.set(this.speakTo) : this.speakTo.x && this.speakTo.y && this.speakTo.z && t.set(this.speakTo.x, this.speakTo.y, this.speakTo.z)), !t) {
|
|
10568
10568
|
if (this.avatar.hasOwnProperty("avatarIgnoreCamera")) {
|
|
10569
10569
|
if (this.avatar.avatarIgnoreCamera) {
|
|
10570
10570
|
this.lookAhead(e);
|
|
@@ -10577,8 +10577,8 @@ class Fn {
|
|
|
10577
10577
|
this.lookAt(null, null, e);
|
|
10578
10578
|
return;
|
|
10579
10579
|
}
|
|
10580
|
-
this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0),
|
|
10581
|
-
const n = new R.Vector3().subVectors(t,
|
|
10580
|
+
this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), ve.setFromMatrixPosition(this.objectLeftEye.matrixWorld), Se.setFromMatrixPosition(this.objectRightEye.matrixWorld), ve.add(Se).divideScalar(2), W.copy(this.armature.quaternion), W.multiply(this.poseTarget.props["Hips.quaternion"]), W.multiply(this.poseTarget.props["Spine.quaternion"]), W.multiply(this.poseTarget.props["Spine1.quaternion"]), W.multiply(this.poseTarget.props["Spine2.quaternion"]), W.multiply(this.poseTarget.props["Neck.quaternion"]), W.multiply(this.poseTarget.props["Head.quaternion"]);
|
|
10581
|
+
const n = new R.Vector3().subVectors(t, ve).normalize(), i = Math.atan2(n.x, n.z), s = Math.asin(-n.y);
|
|
10582
10582
|
O.set(s, i, 0, "YXZ");
|
|
10583
10583
|
const a = new R.Quaternion().setFromEuler(O), l = new R.Quaternion().copy(a).multiply(W.clone().invert());
|
|
10584
10584
|
O.setFromQuaternion(l, "YXZ");
|
|
@@ -10586,7 +10586,7 @@ class Fn {
|
|
|
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);
|
|
10589
|
-
const
|
|
10589
|
+
const f = {
|
|
10590
10590
|
name: "lookat",
|
|
10591
10591
|
dt: [750, e],
|
|
10592
10592
|
vs: {
|
|
@@ -10601,7 +10601,7 @@ class Fn {
|
|
|
10601
10601
|
headMove: [0]
|
|
10602
10602
|
}
|
|
10603
10603
|
};
|
|
10604
|
-
this.animQueue.push(this.animFactory(
|
|
10604
|
+
this.animQueue.push(this.animFactory(f));
|
|
10605
10605
|
}
|
|
10606
10606
|
}
|
|
10607
10607
|
/**
|
|
@@ -10618,9 +10618,9 @@ class Fn {
|
|
|
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
10620
|
e === null && (e = l), t === null && (t = r), W.copy(this.armature.quaternion), W.multiply(this.poseTarget.props["Hips.quaternion"]), W.multiply(this.poseTarget.props["Spine.quaternion"]), W.multiply(this.poseTarget.props["Spine1.quaternion"]), W.multiply(this.poseTarget.props["Spine2.quaternion"]), W.multiply(this.poseTarget.props["Neck.quaternion"]), W.multiply(this.poseTarget.props["Head.quaternion"]), O.setFromQuaternion(W);
|
|
10621
|
-
let c = O.x / (40 / 24), h = 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),
|
|
10622
|
-
|
|
10623
|
-
let I = (Math.random() - 0.5) / 4,
|
|
10621
|
+
let c = O.x / (40 / 24), h = 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), f = this.convertRange(t, [r - y, r + y], [-0.3, 0.6]) - c + u, b = this.convertRange(e, [l - m, l + m], [-0.8, 0.8]) - h + d;
|
|
10622
|
+
f = Math.min(0.6, Math.max(-0.3, f)), b = Math.min(0.8, Math.max(-0.8, b));
|
|
10623
|
+
let I = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
|
|
10624
10624
|
if (n) {
|
|
10625
10625
|
let L = this.animQueue.findIndex((A) => A.template.name === "lookat");
|
|
10626
10626
|
L !== -1 && this.animQueue.splice(L, 1);
|
|
@@ -10628,10 +10628,10 @@ class Fn {
|
|
|
10628
10628
|
name: "lookat",
|
|
10629
10629
|
dt: [750, n],
|
|
10630
10630
|
vs: {
|
|
10631
|
-
bodyRotateX: [
|
|
10632
|
-
bodyRotateY: [b +
|
|
10631
|
+
bodyRotateX: [f + I],
|
|
10632
|
+
bodyRotateY: [b + g],
|
|
10633
10633
|
eyesRotateX: [-3 * I + 0.1],
|
|
10634
|
-
eyesRotateY: [-5 *
|
|
10634
|
+
eyesRotateY: [-5 * g],
|
|
10635
10635
|
browInnerUp: [[0, 0.7]],
|
|
10636
10636
|
mouthLeft: [[0, 0.7]],
|
|
10637
10637
|
mouthRight: [[0, 0.7]],
|
|
@@ -10862,12 +10862,12 @@ class Fn {
|
|
|
10862
10862
|
const d = {};
|
|
10863
10863
|
u.tracks.forEach((y) => {
|
|
10864
10864
|
y.name = y.name.replaceAll("mixamorig", "");
|
|
10865
|
-
const
|
|
10866
|
-
if (
|
|
10865
|
+
const f = y.name.split(".");
|
|
10866
|
+
if (f[1] === "position") {
|
|
10867
10867
|
for (let b = 0; b < y.values.length; b++)
|
|
10868
10868
|
y.values[b] = y.values[b] * s;
|
|
10869
10869
|
d[y.name] = new R.Vector3(y.values[0], y.values[1], y.values[2]);
|
|
10870
|
-
} else
|
|
10870
|
+
} else f[1] === "quaternion" ? d[y.name] = new R.Quaternion(y.values[0], y.values[1], y.values[2], y.values[3]) : f[1] === "rotation" && (d[f[0] + ".quaternion"] = new R.Quaternion().setFromEuler(new R.Euler(y.values[0], y.values[1], y.values[2], "XYZ")).normalize());
|
|
10871
10871
|
});
|
|
10872
10872
|
const m = { props: d };
|
|
10873
10873
|
d["Hips.position"] && (d["Hips.position"].y < 0.5 ? m.lying = !0 : m.standing = !0), this.animClips.push({
|
|
@@ -10966,7 +10966,7 @@ class Fn {
|
|
|
10966
10966
|
const u = [];
|
|
10967
10967
|
for (let y = 1; y < a.ts.length; y++) u.push(a.ts[y] - a.ts[y - 1]);
|
|
10968
10968
|
const d = o.template?.rescale || u.map((y) => y / c), m = t * 1e3 - c;
|
|
10969
|
-
a.ts = a.ts.map((y,
|
|
10969
|
+
a.ts = a.ts.map((y, f, b) => f === 0 ? l : b[f - 1] + u[f - 1] + d[f - 1] * m);
|
|
10970
10970
|
} else {
|
|
10971
10971
|
const u = t * 1e3 / c;
|
|
10972
10972
|
a.ts = a.ts.map((d) => l + u * (d - l));
|
|
@@ -11005,22 +11005,22 @@ class Fn {
|
|
|
11005
11005
|
y.forEach((b) => {
|
|
11006
11006
|
b.bone = this.ikMesh.getObjectByName(b.link), b.bone.quaternion.copy(this.getPoseTemplateProp(b.link + ".quaternion"));
|
|
11007
11007
|
}), d.updateMatrixWorld(!0);
|
|
11008
|
-
const
|
|
11008
|
+
const f = e.iterations || 10;
|
|
11009
11009
|
if (t)
|
|
11010
|
-
for (let b = 0; b <
|
|
11010
|
+
for (let b = 0; b < f; b++) {
|
|
11011
11011
|
let I = !1;
|
|
11012
|
-
for (let
|
|
11013
|
-
const k = y[
|
|
11012
|
+
for (let g = 0, L = y.length; g < L; g++) {
|
|
11013
|
+
const k = y[g].bone;
|
|
11014
11014
|
k.matrixWorld.decompose(l, r, c), r.invert(), o.setFromMatrixPosition(m.matrixWorld), a.subVectors(o, l), a.applyQuaternion(r), a.normalize(), s.subVectors(t, l), s.applyQuaternion(r), s.normalize();
|
|
11015
11015
|
let A = s.dot(a);
|
|
11016
|
-
A > 1 ? A = 1 : A < -1 && (A = -1), A = Math.acos(A), !(A < 1e-5) && (y[
|
|
11017
|
-
y[
|
|
11018
|
-
y[
|
|
11019
|
-
y[
|
|
11016
|
+
A > 1 ? A = 1 : A < -1 && (A = -1), A = Math.acos(A), !(A < 1e-5) && (y[g].minAngle !== void 0 && A < y[g].minAngle && (A = y[g].minAngle), y[g].maxAngle !== void 0 && A > y[g].maxAngle && (A = y[g].maxAngle), h.crossVectors(a, s), h.normalize(), W.setFromAxisAngle(h, A), k.quaternion.multiply(W), k.rotation.setFromVector3(u.setFromEuler(k.rotation).clamp(new R.Vector3(
|
|
11017
|
+
y[g].minx !== void 0 ? y[g].minx : -1 / 0,
|
|
11018
|
+
y[g].miny !== void 0 ? y[g].miny : -1 / 0,
|
|
11019
|
+
y[g].minz !== void 0 ? y[g].minz : -1 / 0
|
|
11020
11020
|
), new R.Vector3(
|
|
11021
|
-
y[
|
|
11022
|
-
y[
|
|
11023
|
-
y[
|
|
11021
|
+
y[g].maxx !== void 0 ? y[g].maxx : 1 / 0,
|
|
11022
|
+
y[g].maxy !== void 0 ? y[g].maxy : 1 / 0,
|
|
11023
|
+
y[g].maxz !== void 0 ? y[g].maxz : 1 / 0
|
|
11024
11024
|
))), k.updateMatrixWorld(!0), I = !0);
|
|
11025
11025
|
}
|
|
11026
11026
|
if (!I) break;
|
|
@@ -11036,7 +11036,7 @@ class Fn {
|
|
|
11036
11036
|
this.isRunning = !1, this.stop(), this.stopSpeaking(), this.streamStop(), this.isAvatarOnly ? this.armature && (this.armature.parent && this.armature.parent.remove(this.armature), this.clearThree(this.armature)) : (this.clearThree(this.scene), this.resizeobserver.disconnect(), this.renderer && (this.renderer.dispose(), this.renderer.domElement && this.renderer.domElement.parentNode && this.renderer.domElement.parentNode.removeChild(this.renderer.domElement), this.renderer = null)), this.clearThree(this.ikMesh), this.dynamicbones.dispose();
|
|
11037
11037
|
}
|
|
11038
11038
|
}
|
|
11039
|
-
const
|
|
11039
|
+
const Ne = {
|
|
11040
11040
|
apiKey: "sk_ace57ef3ef65a92b9d3bee2a00183b78ca790bc3e10964f2",
|
|
11041
11041
|
// Replace with your actual API key (should start with sk_)
|
|
11042
11042
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
@@ -11060,10 +11060,10 @@ const _e = {
|
|
|
11060
11060
|
function Ut() {
|
|
11061
11061
|
return {
|
|
11062
11062
|
service: "elevenlabs",
|
|
11063
|
-
endpoint:
|
|
11064
|
-
apiKey:
|
|
11065
|
-
defaultVoice:
|
|
11066
|
-
voices:
|
|
11063
|
+
endpoint: Ne.endpoint,
|
|
11064
|
+
apiKey: Ne.apiKey,
|
|
11065
|
+
defaultVoice: Ne.defaultVoice,
|
|
11066
|
+
voices: Ne.voices
|
|
11067
11067
|
};
|
|
11068
11068
|
}
|
|
11069
11069
|
function bo() {
|
|
@@ -11095,9 +11095,9 @@ const Dn = _t(({
|
|
|
11095
11095
|
},
|
|
11096
11096
|
className: m = "",
|
|
11097
11097
|
style: y = {},
|
|
11098
|
-
animations:
|
|
11098
|
+
animations: f = {}
|
|
11099
11099
|
}, b) => {
|
|
11100
|
-
const I = ze(null),
|
|
11100
|
+
const I = ze(null), g = ze(null), [L, k] = Be(!0), [A, M] = Be(null), [E, D] = Be(!1), U = Ut(), w = i || U.service;
|
|
11101
11101
|
let v;
|
|
11102
11102
|
w === "browser" ? v = {
|
|
11103
11103
|
service: "browser",
|
|
@@ -11108,14 +11108,14 @@ const Dn = _t(({
|
|
|
11108
11108
|
service: "elevenlabs",
|
|
11109
11109
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
11110
11110
|
apiKey: o || U.apiKey,
|
|
11111
|
-
defaultVoice: s || U.defaultVoice ||
|
|
11112
|
-
voices: U.voices ||
|
|
11111
|
+
defaultVoice: s || U.defaultVoice || Ne.defaultVoice,
|
|
11112
|
+
voices: U.voices || Ne.voices
|
|
11113
11113
|
} : v = {
|
|
11114
11114
|
...U,
|
|
11115
11115
|
// Override API key if provided via props
|
|
11116
11116
|
apiKey: o !== null ? o : U.apiKey
|
|
11117
11117
|
};
|
|
11118
|
-
const
|
|
11118
|
+
const S = {
|
|
11119
11119
|
url: p,
|
|
11120
11120
|
body: e,
|
|
11121
11121
|
avatarMood: t,
|
|
@@ -11125,34 +11125,34 @@ const Dn = _t(({
|
|
|
11125
11125
|
showFullAvatar: r,
|
|
11126
11126
|
bodyMovement: a,
|
|
11127
11127
|
movementIntensity: l
|
|
11128
|
-
},
|
|
11128
|
+
}, F = {
|
|
11129
11129
|
ttsEndpoint: v.endpoint,
|
|
11130
11130
|
ttsApikey: v.apiKey,
|
|
11131
11131
|
ttsService: w,
|
|
11132
11132
|
lipsyncModules: ["en"],
|
|
11133
11133
|
cameraView: c
|
|
11134
|
-
},
|
|
11135
|
-
if (!(!I.current ||
|
|
11134
|
+
}, ie = B(async () => {
|
|
11135
|
+
if (!(!I.current || g.current))
|
|
11136
11136
|
try {
|
|
11137
|
-
if (k(!0), M(null),
|
|
11138
|
-
if (
|
|
11139
|
-
const
|
|
11140
|
-
u(
|
|
11137
|
+
if (k(!0), M(null), g.current = new Fn(I.current, F), g.current.controls && (g.current.controls.enableRotate = !1, g.current.controls.enableZoom = !1, g.current.controls.enablePan = !1, g.current.controls.enableDamping = !1), f && Object.keys(f).length > 0 && (g.current.customAnimations = f), await g.current.showAvatar(S, (J) => {
|
|
11138
|
+
if (J.lengthComputable) {
|
|
11139
|
+
const te = Math.min(100, Math.round(J.loaded / J.total * 100));
|
|
11140
|
+
u(te);
|
|
11141
11141
|
}
|
|
11142
|
-
}), await new Promise((
|
|
11143
|
-
const
|
|
11144
|
-
|
|
11142
|
+
}), await new Promise((J) => {
|
|
11143
|
+
const te = () => {
|
|
11144
|
+
g.current.lipsync && Object.keys(g.current.lipsync).length > 0 ? J() : setTimeout(te, 100);
|
|
11145
11145
|
};
|
|
11146
|
-
|
|
11147
|
-
}),
|
|
11146
|
+
te();
|
|
11147
|
+
}), g.current && g.current.setShowFullAvatar)
|
|
11148
11148
|
try {
|
|
11149
|
-
|
|
11150
|
-
} catch (
|
|
11151
|
-
console.warn("Error setting full body mode on initialization:",
|
|
11149
|
+
g.current.setShowFullAvatar(r);
|
|
11150
|
+
} catch (J) {
|
|
11151
|
+
console.warn("Error setting full body mode on initialization:", J);
|
|
11152
11152
|
}
|
|
11153
|
-
|
|
11153
|
+
g.current && g.current.controls && (g.current.controls.enableRotate = !1, g.current.controls.enableZoom = !1, g.current.controls.enablePan = !1, g.current.controls.enableDamping = !1, g.current.controls.update()), k(!1), D(!0), h(g.current);
|
|
11154
11154
|
const Z = () => {
|
|
11155
|
-
document.visibilityState === "visible" ?
|
|
11155
|
+
document.visibilityState === "visible" ? g.current?.start() : g.current?.stop();
|
|
11156
11156
|
};
|
|
11157
11157
|
return document.addEventListener("visibilitychange", Z), () => {
|
|
11158
11158
|
document.removeEventListener("visibilitychange", Z);
|
|
@@ -11160,149 +11160,149 @@ const Dn = _t(({
|
|
|
11160
11160
|
} catch (C) {
|
|
11161
11161
|
console.error("Error initializing TalkingHead:", C), M(C.message || "Failed to initialize avatar"), k(!1), d(C);
|
|
11162
11162
|
}
|
|
11163
|
-
}, [p, e, t, n, i, s, o, r, a, l, c,
|
|
11164
|
-
ut(() => (
|
|
11165
|
-
|
|
11166
|
-
}), [
|
|
11167
|
-
if (!I.current || !
|
|
11168
|
-
const C = new ResizeObserver((
|
|
11169
|
-
for (const
|
|
11170
|
-
|
|
11163
|
+
}, [p, e, t, n, i, s, o, r, a, l, c, f]);
|
|
11164
|
+
ut(() => (ie(), () => {
|
|
11165
|
+
g.current && (g.current.stop(), g.current.dispose(), g.current = null);
|
|
11166
|
+
}), [ie]), ut(() => {
|
|
11167
|
+
if (!I.current || !g.current) return;
|
|
11168
|
+
const C = new ResizeObserver((J) => {
|
|
11169
|
+
for (const te of J)
|
|
11170
|
+
g.current && g.current.onResize && g.current.onResize();
|
|
11171
11171
|
});
|
|
11172
11172
|
C.observe(I.current);
|
|
11173
11173
|
const Z = () => {
|
|
11174
|
-
|
|
11174
|
+
g.current && g.current.onResize && g.current.onResize();
|
|
11175
11175
|
};
|
|
11176
11176
|
return window.addEventListener("resize", Z), () => {
|
|
11177
11177
|
C.disconnect(), window.removeEventListener("resize", Z);
|
|
11178
11178
|
};
|
|
11179
11179
|
}, [E]);
|
|
11180
11180
|
const Y = B(async () => {
|
|
11181
|
-
if (
|
|
11181
|
+
if (g.current && g.current.audioCtx)
|
|
11182
11182
|
try {
|
|
11183
|
-
(
|
|
11183
|
+
(g.current.audioCtx.state === "suspended" || g.current.audioCtx.state === "interrupted") && (await g.current.audioCtx.resume(), console.log("Audio context resumed"));
|
|
11184
11184
|
} catch (C) {
|
|
11185
11185
|
console.warn("Failed to resume audio context:", C);
|
|
11186
11186
|
}
|
|
11187
|
-
}, []),
|
|
11188
|
-
if (
|
|
11187
|
+
}, []), ue = B(async (C) => {
|
|
11188
|
+
if (g.current && E)
|
|
11189
11189
|
try {
|
|
11190
|
-
await Y(),
|
|
11191
|
-
await Y(),
|
|
11190
|
+
await Y(), g.current.lipsync && Object.keys(g.current.lipsync).length > 0 ? (g.current.setSlowdownRate && g.current.setSlowdownRate(1.05), g.current.speakText(C)) : setTimeout(async () => {
|
|
11191
|
+
await Y(), g.current && g.current.lipsync && (g.current.setSlowdownRate && g.current.setSlowdownRate(1.05), g.current.speakText(C));
|
|
11192
11192
|
}, 500);
|
|
11193
11193
|
} catch (Z) {
|
|
11194
11194
|
console.error("Error speaking text:", Z), M(Z.message || "Failed to speak text");
|
|
11195
11195
|
}
|
|
11196
|
-
}, [E, Y]),
|
|
11197
|
-
|
|
11198
|
-
}, []),
|
|
11199
|
-
|
|
11196
|
+
}, [E, Y]), Me = B(() => {
|
|
11197
|
+
g.current && (g.current.stopSpeaking(), g.current.setSlowdownRate && g.current.setSlowdownRate(1));
|
|
11198
|
+
}, []), fe = B((C) => {
|
|
11199
|
+
g.current && g.current.setMood(C);
|
|
11200
11200
|
}, []), ft = B((C) => {
|
|
11201
|
-
|
|
11201
|
+
g.current && g.current.setSlowdownRate && g.current.setSlowdownRate(C);
|
|
11202
11202
|
}, []), gt = B((C, Z = !1) => {
|
|
11203
|
-
if (
|
|
11204
|
-
if (
|
|
11203
|
+
if (g.current && g.current.playAnimation) {
|
|
11204
|
+
if (f && f[C] && (C = f[C]), g.current.setShowFullAvatar)
|
|
11205
11205
|
try {
|
|
11206
|
-
|
|
11207
|
-
} catch (
|
|
11208
|
-
console.warn("Error setting full body mode:",
|
|
11206
|
+
g.current.setShowFullAvatar(!0);
|
|
11207
|
+
} catch (te) {
|
|
11208
|
+
console.warn("Error setting full body mode:", te);
|
|
11209
11209
|
}
|
|
11210
11210
|
if (C.includes("."))
|
|
11211
11211
|
try {
|
|
11212
|
-
|
|
11213
|
-
} catch (
|
|
11214
|
-
console.warn(`Failed to play ${C}:`,
|
|
11212
|
+
g.current.playAnimation(C, null, 10, 0, 0.01, Z);
|
|
11213
|
+
} catch (te) {
|
|
11214
|
+
console.warn(`Failed to play ${C}:`, te);
|
|
11215
11215
|
try {
|
|
11216
|
-
|
|
11217
|
-
} catch (
|
|
11218
|
-
console.warn("Fallback animation also failed:",
|
|
11216
|
+
g.current.setBodyMovement("idle");
|
|
11217
|
+
} catch (Ie) {
|
|
11218
|
+
console.warn("Fallback animation also failed:", Ie);
|
|
11219
11219
|
}
|
|
11220
11220
|
}
|
|
11221
11221
|
else {
|
|
11222
|
-
const
|
|
11223
|
-
let
|
|
11224
|
-
for (const
|
|
11222
|
+
const te = [".fbx", ".glb", ".gltf"];
|
|
11223
|
+
let Ie = !1;
|
|
11224
|
+
for (const He of te)
|
|
11225
11225
|
try {
|
|
11226
|
-
|
|
11226
|
+
g.current.playAnimation(C + He, null, 10, 0, 0.01, Z), Ie = !0;
|
|
11227
11227
|
break;
|
|
11228
11228
|
} catch {
|
|
11229
11229
|
}
|
|
11230
|
-
if (!
|
|
11230
|
+
if (!Ie) {
|
|
11231
11231
|
console.warn("Animation not found:", C);
|
|
11232
11232
|
try {
|
|
11233
|
-
|
|
11234
|
-
} catch (
|
|
11235
|
-
console.warn("Fallback animation also failed:",
|
|
11233
|
+
g.current.setBodyMovement("idle");
|
|
11234
|
+
} catch (He) {
|
|
11235
|
+
console.warn("Fallback animation also failed:", He);
|
|
11236
11236
|
}
|
|
11237
11237
|
}
|
|
11238
11238
|
}
|
|
11239
11239
|
}
|
|
11240
|
-
}, [
|
|
11241
|
-
|
|
11240
|
+
}, [f]), We = B(() => {
|
|
11241
|
+
g.current && g.current.onResize && g.current.onResize();
|
|
11242
11242
|
}, []);
|
|
11243
11243
|
return Nt(b, () => ({
|
|
11244
|
-
speakText:
|
|
11245
|
-
stopSpeaking:
|
|
11244
|
+
speakText: ue,
|
|
11245
|
+
stopSpeaking: Me,
|
|
11246
11246
|
resumeAudioContext: Y,
|
|
11247
|
-
setMood:
|
|
11247
|
+
setMood: fe,
|
|
11248
11248
|
setTimingAdjustment: ft,
|
|
11249
11249
|
playAnimation: gt,
|
|
11250
11250
|
isReady: E,
|
|
11251
|
-
talkingHead:
|
|
11252
|
-
handleResize:
|
|
11251
|
+
talkingHead: g.current,
|
|
11252
|
+
handleResize: We,
|
|
11253
11253
|
setBodyMovement: (C) => {
|
|
11254
|
-
if (
|
|
11254
|
+
if (g.current && g.current.setShowFullAvatar && g.current.setBodyMovement)
|
|
11255
11255
|
try {
|
|
11256
|
-
|
|
11256
|
+
g.current.setShowFullAvatar(!0), g.current.setBodyMovement(C);
|
|
11257
11257
|
} catch (Z) {
|
|
11258
11258
|
console.warn("Error setting body movement:", Z);
|
|
11259
11259
|
}
|
|
11260
11260
|
},
|
|
11261
|
-
setMovementIntensity: (C) =>
|
|
11261
|
+
setMovementIntensity: (C) => g.current?.setMovementIntensity(C),
|
|
11262
11262
|
playRandomDance: () => {
|
|
11263
|
-
if (
|
|
11263
|
+
if (g.current && g.current.setShowFullAvatar && g.current.playRandomDance)
|
|
11264
11264
|
try {
|
|
11265
|
-
|
|
11265
|
+
g.current.setShowFullAvatar(!0), g.current.playRandomDance();
|
|
11266
11266
|
} catch (C) {
|
|
11267
11267
|
console.warn("Error playing random dance:", C);
|
|
11268
11268
|
}
|
|
11269
11269
|
},
|
|
11270
11270
|
playReaction: (C) => {
|
|
11271
|
-
if (
|
|
11271
|
+
if (g.current && g.current.setShowFullAvatar && g.current.playReaction)
|
|
11272
11272
|
try {
|
|
11273
|
-
|
|
11273
|
+
g.current.setShowFullAvatar(!0), g.current.playReaction(C);
|
|
11274
11274
|
} catch (Z) {
|
|
11275
11275
|
console.warn("Error playing reaction:", Z);
|
|
11276
11276
|
}
|
|
11277
11277
|
},
|
|
11278
11278
|
playCelebration: () => {
|
|
11279
|
-
if (
|
|
11279
|
+
if (g.current && g.current.setShowFullAvatar && g.current.playCelebration)
|
|
11280
11280
|
try {
|
|
11281
|
-
|
|
11281
|
+
g.current.setShowFullAvatar(!0), g.current.playCelebration();
|
|
11282
11282
|
} catch (C) {
|
|
11283
11283
|
console.warn("Error playing celebration:", C);
|
|
11284
11284
|
}
|
|
11285
11285
|
},
|
|
11286
11286
|
setShowFullAvatar: (C) => {
|
|
11287
|
-
if (
|
|
11287
|
+
if (g.current && g.current.setShowFullAvatar)
|
|
11288
11288
|
try {
|
|
11289
|
-
|
|
11289
|
+
g.current.setShowFullAvatar(C);
|
|
11290
11290
|
} catch (Z) {
|
|
11291
11291
|
console.warn("Error setting showFullAvatar:", Z);
|
|
11292
11292
|
}
|
|
11293
11293
|
},
|
|
11294
11294
|
lockAvatarPosition: () => {
|
|
11295
|
-
if (
|
|
11295
|
+
if (g.current && g.current.lockAvatarPosition)
|
|
11296
11296
|
try {
|
|
11297
|
-
|
|
11297
|
+
g.current.lockAvatarPosition();
|
|
11298
11298
|
} catch (C) {
|
|
11299
11299
|
console.warn("Error locking avatar position:", C);
|
|
11300
11300
|
}
|
|
11301
11301
|
},
|
|
11302
11302
|
unlockAvatarPosition: () => {
|
|
11303
|
-
if (
|
|
11303
|
+
if (g.current && g.current.unlockAvatarPosition)
|
|
11304
11304
|
try {
|
|
11305
|
-
|
|
11305
|
+
g.current.unlockAvatarPosition();
|
|
11306
11306
|
} catch (C) {
|
|
11307
11307
|
console.warn("Error unlocking avatar position:", C);
|
|
11308
11308
|
}
|
|
@@ -11318,7 +11318,7 @@ const Dn = _t(({
|
|
|
11318
11318
|
...y
|
|
11319
11319
|
},
|
|
11320
11320
|
children: [
|
|
11321
|
-
/* @__PURE__ */
|
|
11321
|
+
/* @__PURE__ */ Te(
|
|
11322
11322
|
"div",
|
|
11323
11323
|
{
|
|
11324
11324
|
ref: I,
|
|
@@ -11330,7 +11330,7 @@ const Dn = _t(({
|
|
|
11330
11330
|
}
|
|
11331
11331
|
}
|
|
11332
11332
|
),
|
|
11333
|
-
L && /* @__PURE__ */
|
|
11333
|
+
L && /* @__PURE__ */ Te("div", { className: "loading-overlay", style: {
|
|
11334
11334
|
position: "absolute",
|
|
11335
11335
|
top: "50%",
|
|
11336
11336
|
left: "50%",
|
|
@@ -11339,7 +11339,7 @@ const Dn = _t(({
|
|
|
11339
11339
|
fontSize: "18px",
|
|
11340
11340
|
zIndex: 10
|
|
11341
11341
|
}, children: "Loading avatar..." }),
|
|
11342
|
-
A && /* @__PURE__ */
|
|
11342
|
+
A && /* @__PURE__ */ Te("div", { className: "error-overlay", style: {
|
|
11343
11343
|
position: "absolute",
|
|
11344
11344
|
top: "50%",
|
|
11345
11345
|
left: "50%",
|
|
@@ -11368,17 +11368,17 @@ const mo = _t(({
|
|
|
11368
11368
|
style: s = {},
|
|
11369
11369
|
avatarConfig: o = {}
|
|
11370
11370
|
}, a) => {
|
|
11371
|
-
const l = ze(null), r = ze(null), [c, h] =
|
|
11371
|
+
const l = ze(null), r = ze(null), [c, h] = Be(!0), [u, d] = Be(null), [m, y] = Be(!1), f = Ut(), b = o.ttsService || f.service, I = b === "browser" ? {
|
|
11372
11372
|
endpoint: "",
|
|
11373
11373
|
apiKey: null,
|
|
11374
11374
|
defaultVoice: "Google US English"
|
|
11375
11375
|
} : {
|
|
11376
|
-
...
|
|
11376
|
+
...f,
|
|
11377
11377
|
// Override API key if provided via avatarConfig
|
|
11378
|
-
apiKey: o.ttsApiKey !== void 0 && o.ttsApiKey !== null ? o.ttsApiKey :
|
|
11378
|
+
apiKey: o.ttsApiKey !== void 0 && o.ttsApiKey !== null ? o.ttsApiKey : f.apiKey,
|
|
11379
11379
|
// Override endpoint for ElevenLabs if service is explicitly set
|
|
11380
|
-
endpoint: b === "elevenlabs" && o.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" :
|
|
11381
|
-
},
|
|
11380
|
+
endpoint: b === "elevenlabs" && o.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" : f.endpoint
|
|
11381
|
+
}, g = {
|
|
11382
11382
|
url: "/avatars/brunette.glb",
|
|
11383
11383
|
// Use brunette avatar (working glTF file)
|
|
11384
11384
|
body: "F",
|
|
@@ -11401,27 +11401,27 @@ const mo = _t(({
|
|
|
11401
11401
|
}, k = B(async () => {
|
|
11402
11402
|
if (!(!l.current || r.current))
|
|
11403
11403
|
try {
|
|
11404
|
-
if (h(!0), d(null), r.current = new Fn(l.current, L), await r.current.showAvatar(
|
|
11405
|
-
if (
|
|
11406
|
-
const
|
|
11407
|
-
e(
|
|
11404
|
+
if (h(!0), d(null), r.current = new Fn(l.current, L), await r.current.showAvatar(g, (S) => {
|
|
11405
|
+
if (S.lengthComputable) {
|
|
11406
|
+
const F = Math.min(100, Math.round(S.loaded / S.total * 100));
|
|
11407
|
+
e(F);
|
|
11408
11408
|
}
|
|
11409
11409
|
}), r.current.morphs && r.current.morphs.length > 0) {
|
|
11410
|
-
const
|
|
11411
|
-
console.log("Available morph targets:", Object.keys(
|
|
11412
|
-
const
|
|
11413
|
-
console.log("Viseme morph targets found:",
|
|
11410
|
+
const S = r.current.morphs[0].morphTargetDictionary;
|
|
11411
|
+
console.log("Available morph targets:", Object.keys(S));
|
|
11412
|
+
const F = Object.keys(S).filter((ie) => ie.startsWith("viseme_"));
|
|
11413
|
+
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"));
|
|
11414
11414
|
}
|
|
11415
|
-
if (await new Promise((
|
|
11416
|
-
const
|
|
11417
|
-
r.current.lipsync && Object.keys(r.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(r.current.lipsync)),
|
|
11415
|
+
if (await new Promise((S) => {
|
|
11416
|
+
const F = () => {
|
|
11417
|
+
r.current.lipsync && Object.keys(r.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(r.current.lipsync)), S()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(F, 100));
|
|
11418
11418
|
};
|
|
11419
|
-
|
|
11419
|
+
F();
|
|
11420
11420
|
}), r.current && r.current.setShowFullAvatar)
|
|
11421
11421
|
try {
|
|
11422
11422
|
r.current.setShowFullAvatar(!0), console.log("Avatar initialized in full body mode");
|
|
11423
|
-
} catch (
|
|
11424
|
-
console.warn("Error setting full body mode on initialization:",
|
|
11423
|
+
} catch (S) {
|
|
11424
|
+
console.warn("Error setting full body mode on initialization:", S);
|
|
11425
11425
|
}
|
|
11426
11426
|
h(!1), y(!0), n(r.current);
|
|
11427
11427
|
const v = () => {
|
|
@@ -11440,7 +11440,7 @@ const mo = _t(({
|
|
|
11440
11440
|
const A = B((w) => {
|
|
11441
11441
|
if (r.current && m)
|
|
11442
11442
|
try {
|
|
11443
|
-
console.log("Speaking text:", w), console.log("Avatar config:",
|
|
11443
|
+
console.log("Speaking text:", w), console.log("Avatar config:", g), 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(w)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
|
|
11444
11444
|
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(w)) : console.error("Lip-sync still not ready after waiting");
|
|
11445
11445
|
}, 500));
|
|
11446
11446
|
} catch (v) {
|
|
@@ -11448,42 +11448,42 @@ const mo = _t(({
|
|
|
11448
11448
|
}
|
|
11449
11449
|
else
|
|
11450
11450
|
console.warn("Avatar not ready for speaking. isReady:", m, "talkingHeadRef:", !!r.current);
|
|
11451
|
-
}, [m,
|
|
11451
|
+
}, [m, g]), M = B(() => {
|
|
11452
11452
|
r.current && (r.current.stopSpeaking(), r.current.setSlowdownRate && (r.current.setSlowdownRate(1), console.log("Reset timing to normal")));
|
|
11453
11453
|
}, []), E = B((w) => {
|
|
11454
11454
|
r.current && r.current.setMood(w);
|
|
11455
|
-
}, []),
|
|
11455
|
+
}, []), D = B((w) => {
|
|
11456
11456
|
r.current && r.current.setSlowdownRate && (r.current.setSlowdownRate(w), console.log("Timing adjustment set to:", w));
|
|
11457
11457
|
}, []), U = B((w, v = !1) => {
|
|
11458
11458
|
if (r.current && r.current.playAnimation) {
|
|
11459
11459
|
if (r.current.setShowFullAvatar)
|
|
11460
11460
|
try {
|
|
11461
11461
|
r.current.setShowFullAvatar(!0);
|
|
11462
|
-
} catch (
|
|
11463
|
-
console.warn("Error setting full body mode:",
|
|
11462
|
+
} catch (F) {
|
|
11463
|
+
console.warn("Error setting full body mode:", F);
|
|
11464
11464
|
}
|
|
11465
11465
|
if (w.includes("."))
|
|
11466
11466
|
try {
|
|
11467
11467
|
r.current.playAnimation(w, null, 10, 0, 0.01, v), console.log("Playing animation:", w);
|
|
11468
|
-
} catch (
|
|
11469
|
-
console.log(`Failed to play ${w}:`,
|
|
11468
|
+
} catch (F) {
|
|
11469
|
+
console.log(`Failed to play ${w}:`, F);
|
|
11470
11470
|
try {
|
|
11471
11471
|
r.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
11472
|
-
} catch (
|
|
11473
|
-
console.warn("Fallback animation also failed:",
|
|
11472
|
+
} catch (ie) {
|
|
11473
|
+
console.warn("Fallback animation also failed:", ie);
|
|
11474
11474
|
}
|
|
11475
11475
|
}
|
|
11476
11476
|
else {
|
|
11477
|
-
const
|
|
11478
|
-
let
|
|
11479
|
-
for (const Y of
|
|
11477
|
+
const F = [".fbx", ".glb", ".gltf"];
|
|
11478
|
+
let ie = !1;
|
|
11479
|
+
for (const Y of F)
|
|
11480
11480
|
try {
|
|
11481
|
-
r.current.playAnimation(w + Y, null, 10, 0, 0.01, v), console.log("Playing animation:", w + Y),
|
|
11481
|
+
r.current.playAnimation(w + Y, null, 10, 0, 0.01, v), console.log("Playing animation:", w + Y), ie = !0;
|
|
11482
11482
|
break;
|
|
11483
11483
|
} catch {
|
|
11484
11484
|
console.log(`Failed to play ${w}${Y}, trying next format...`);
|
|
11485
11485
|
}
|
|
11486
|
-
if (!
|
|
11486
|
+
if (!ie) {
|
|
11487
11487
|
console.warn("Animation system not available or animation not found:", w);
|
|
11488
11488
|
try {
|
|
11489
11489
|
r.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
@@ -11499,7 +11499,7 @@ const mo = _t(({
|
|
|
11499
11499
|
speakText: A,
|
|
11500
11500
|
stopSpeaking: M,
|
|
11501
11501
|
setMood: E,
|
|
11502
|
-
setTimingAdjustment:
|
|
11502
|
+
setTimingAdjustment: D,
|
|
11503
11503
|
playAnimation: U,
|
|
11504
11504
|
isReady: m,
|
|
11505
11505
|
talkingHead: r.current,
|
|
@@ -11561,7 +11561,7 @@ const mo = _t(({
|
|
|
11561
11561
|
}
|
|
11562
11562
|
}
|
|
11563
11563
|
})), /* @__PURE__ */ an("div", { className: `talking-head-container ${i}`, style: s, children: [
|
|
11564
|
-
/* @__PURE__ */
|
|
11564
|
+
/* @__PURE__ */ Te(
|
|
11565
11565
|
"div",
|
|
11566
11566
|
{
|
|
11567
11567
|
ref: l,
|
|
@@ -11573,7 +11573,7 @@ const mo = _t(({
|
|
|
11573
11573
|
}
|
|
11574
11574
|
}
|
|
11575
11575
|
),
|
|
11576
|
-
c && /* @__PURE__ */
|
|
11576
|
+
c && /* @__PURE__ */ Te("div", { className: "loading-overlay", style: {
|
|
11577
11577
|
position: "absolute",
|
|
11578
11578
|
top: "50%",
|
|
11579
11579
|
left: "50%",
|
|
@@ -11582,7 +11582,7 @@ const mo = _t(({
|
|
|
11582
11582
|
fontSize: "18px",
|
|
11583
11583
|
zIndex: 10
|
|
11584
11584
|
}, children: "Loading avatar..." }),
|
|
11585
|
-
u && /* @__PURE__ */
|
|
11585
|
+
u && /* @__PURE__ */ Te("div", { className: "error-overlay", style: {
|
|
11586
11586
|
position: "absolute",
|
|
11587
11587
|
top: "50%",
|
|
11588
11588
|
left: "50%",
|
|
@@ -11658,11 +11658,11 @@ const fo = _t(({
|
|
|
11658
11658
|
movementIntensity: e.movementIntensity || 0.7,
|
|
11659
11659
|
showFullAvatar: e.showFullAvatar !== void 0 ? e.showFullAvatar : !0,
|
|
11660
11660
|
animations: t
|
|
11661
|
-
}, y = B(() => d.modules[h.current.currentModuleIndex]?.lessons[h.current.currentLessonIndex], [d]),
|
|
11661
|
+
}, y = B(() => d.modules[h.current.currentModuleIndex]?.lessons[h.current.currentLessonIndex], [d]), f = B(() => y()?.questions[h.current.currentQuestionIndex], [y]), b = B((v, S) => S.type === "multiple_choice" || S.type === "true_false" ? v === S.answer : S.type === "code_test" && typeof v == "object" && v !== null ? v.passed === !0 : !1, []), I = B(() => {
|
|
11662
11662
|
h.current.lessonCompleted = !0, h.current.isQuestionMode = !1;
|
|
11663
11663
|
const v = Math.round(h.current.score / h.current.totalQuestions * 100);
|
|
11664
|
-
let
|
|
11665
|
-
if (v >= 80 ?
|
|
11664
|
+
let S = `Congratulations! You've completed this lesson with a score of ${h.current.score} out of ${h.current.totalQuestions} (${v}%). `;
|
|
11665
|
+
if (v >= 80 ? S += "Excellent work! You have a great understanding of this topic." : v >= 60 ? S += "Good job! You understand most of the concepts." : S += "Keep practicing! You're making progress.", u.current.onLessonComplete({
|
|
11666
11666
|
moduleIndex: h.current.currentModuleIndex,
|
|
11667
11667
|
lessonIndex: h.current.currentLessonIndex,
|
|
11668
11668
|
score: h.current.score,
|
|
@@ -11675,12 +11675,12 @@ const fo = _t(({
|
|
|
11675
11675
|
} catch {
|
|
11676
11676
|
c.current.playCelebration();
|
|
11677
11677
|
}
|
|
11678
|
-
c.current.speakText(
|
|
11678
|
+
c.current.speakText(S);
|
|
11679
11679
|
}
|
|
11680
|
-
}, [t.lessonComplete]),
|
|
11680
|
+
}, [t.lessonComplete]), g = B(() => {
|
|
11681
11681
|
if (h.current.curriculumCompleted = !0, u.current.onCurriculumComplete({
|
|
11682
11682
|
modules: d.modules.length,
|
|
11683
|
-
totalLessons: d.modules.reduce((v,
|
|
11683
|
+
totalLessons: d.modules.reduce((v, S) => v + S.lessons.length, 0)
|
|
11684
11684
|
}), c.current) {
|
|
11685
11685
|
if (c.current.setMood("celebrating"), t.curriculumComplete)
|
|
11686
11686
|
try {
|
|
@@ -11692,54 +11692,61 @@ const fo = _t(({
|
|
|
11692
11692
|
}
|
|
11693
11693
|
}, [t.curriculumComplete, d]), L = B(() => {
|
|
11694
11694
|
const v = y();
|
|
11695
|
-
|
|
11695
|
+
h.current.isQuestionMode = !0, h.current.currentQuestionIndex = 0, h.current.totalQuestions = v?.questions?.length || 0;
|
|
11696
|
+
const S = f();
|
|
11697
|
+
if (u.current.onCustomAction({
|
|
11698
|
+
type: "questionStart",
|
|
11699
|
+
moduleIndex: h.current.currentModuleIndex,
|
|
11700
|
+
lessonIndex: h.current.currentLessonIndex,
|
|
11701
|
+
totalQuestions: h.current.totalQuestions,
|
|
11702
|
+
question: S
|
|
11703
|
+
// Include first question in event
|
|
11704
|
+
}), c.current) {
|
|
11696
11705
|
if (c.current.setMood("curious"), t.questionStart)
|
|
11697
11706
|
try {
|
|
11698
11707
|
c.current.playAnimation(t.questionStart, !0);
|
|
11699
|
-
} catch (
|
|
11700
|
-
console.warn("Failed to play questionStart animation:",
|
|
11708
|
+
} catch (F) {
|
|
11709
|
+
console.warn("Failed to play questionStart animation:", F);
|
|
11701
11710
|
}
|
|
11702
|
-
c.current.speakText("Now let me ask you some questions to test your understanding.")
|
|
11703
|
-
type: "questionStart",
|
|
11704
|
-
moduleIndex: h.current.currentModuleIndex,
|
|
11705
|
-
lessonIndex: h.current.currentLessonIndex,
|
|
11706
|
-
totalQuestions: h.current.totalQuestions
|
|
11707
|
-
});
|
|
11711
|
+
S ? S.type === "code_test" ? c.current.speakText(`Let's test your coding skills! Here's your first challenge: ${S.question}`) : c.current.speakText(`Now let me ask you some questions. Here's the first one: ${S.question}`) : c.current.speakText("Now let me ask you some questions to test your understanding.");
|
|
11708
11712
|
}
|
|
11709
|
-
}, [t.questionStart, y]), k = B(() => {
|
|
11713
|
+
}, [t.questionStart, y, f]), k = B(() => {
|
|
11710
11714
|
const v = y();
|
|
11711
11715
|
if (h.current.currentQuestionIndex < (v?.questions?.length || 0) - 1) {
|
|
11712
|
-
|
|
11716
|
+
h.current.currentQuestionIndex += 1;
|
|
11717
|
+
const S = f();
|
|
11718
|
+
if (u.current.onCustomAction({
|
|
11719
|
+
type: "nextQuestion",
|
|
11720
|
+
moduleIndex: h.current.currentModuleIndex,
|
|
11721
|
+
lessonIndex: h.current.currentLessonIndex,
|
|
11722
|
+
questionIndex: h.current.currentQuestionIndex,
|
|
11723
|
+
question: S
|
|
11724
|
+
}), c.current) {
|
|
11713
11725
|
if (c.current.setMood("happy"), c.current.setBodyMovement("idle"), t.nextQuestion)
|
|
11714
11726
|
try {
|
|
11715
11727
|
c.current.playAnimation(t.nextQuestion, !0);
|
|
11716
|
-
} catch (
|
|
11717
|
-
console.warn("Failed to play nextQuestion animation:",
|
|
11728
|
+
} catch (F) {
|
|
11729
|
+
console.warn("Failed to play nextQuestion animation:", F);
|
|
11718
11730
|
}
|
|
11719
|
-
c.current.speakText(
|
|
11720
|
-
type: "nextQuestion",
|
|
11721
|
-
moduleIndex: h.current.currentModuleIndex,
|
|
11722
|
-
lessonIndex: h.current.currentLessonIndex,
|
|
11723
|
-
questionIndex: h.current.currentQuestionIndex
|
|
11724
|
-
});
|
|
11731
|
+
S ? S.type === "code_test" ? c.current.speakText(`Here's your next coding challenge: ${S.question}`) : c.current.speakText(`Here's the next question: ${S.question}`) : c.current.speakText("Here's the next question.");
|
|
11725
11732
|
}
|
|
11726
11733
|
} else
|
|
11727
11734
|
I();
|
|
11728
|
-
}, [t.nextQuestion, y, I]), A = B(() => {
|
|
11735
|
+
}, [t.nextQuestion, y, I, f]), A = B(() => {
|
|
11729
11736
|
const v = d.modules[h.current.currentModuleIndex];
|
|
11730
|
-
h.current.currentLessonIndex < (v?.lessons?.length || 0) - 1 ? (h.current.currentLessonIndex += 1, h.current.currentQuestionIndex = 0, h.current.lessonCompleted = !1, h.current.score = 0, h.current.totalQuestions = 0, c.current && c.current.speakText("Let's move on to the next lesson!")) :
|
|
11731
|
-
}, [d,
|
|
11737
|
+
h.current.currentLessonIndex < (v?.lessons?.length || 0) - 1 ? (h.current.currentLessonIndex += 1, h.current.currentQuestionIndex = 0, h.current.lessonCompleted = !1, h.current.score = 0, h.current.totalQuestions = 0, c.current && c.current.speakText("Let's move on to the next lesson!")) : g();
|
|
11738
|
+
}, [d, g]), M = B(() => {
|
|
11732
11739
|
const v = y();
|
|
11733
11740
|
if (c.current && c.current.isReady && v?.avatar_script) {
|
|
11734
11741
|
h.current.isTeaching = !0, h.current.isQuestionMode = !1, c.current.setMood("happy");
|
|
11735
|
-
let
|
|
11742
|
+
let S = !1;
|
|
11736
11743
|
if (t.teaching)
|
|
11737
11744
|
try {
|
|
11738
|
-
c.current.playAnimation(t.teaching, !0),
|
|
11739
|
-
} catch (
|
|
11740
|
-
console.warn("Failed to play teaching animation:",
|
|
11745
|
+
c.current.playAnimation(t.teaching, !0), S = !0;
|
|
11746
|
+
} catch (F) {
|
|
11747
|
+
console.warn("Failed to play teaching animation:", F);
|
|
11741
11748
|
}
|
|
11742
|
-
|
|
11749
|
+
S || c.current.setBodyMovement("gesturing"), c.current.speakText(v.avatar_script), u.current.onLessonStart({
|
|
11743
11750
|
moduleIndex: h.current.currentModuleIndex,
|
|
11744
11751
|
lessonIndex: h.current.currentLessonIndex,
|
|
11745
11752
|
lesson: v
|
|
@@ -11753,16 +11760,16 @@ const fo = _t(({
|
|
|
11753
11760
|
}, 8e3);
|
|
11754
11761
|
}
|
|
11755
11762
|
}, [t.teaching, y, L, I]), E = B((v) => {
|
|
11756
|
-
const
|
|
11757
|
-
if (
|
|
11763
|
+
const S = f(), F = b(v, S);
|
|
11764
|
+
if (F && (h.current.score += 1), u.current.onQuestionAnswer({
|
|
11758
11765
|
moduleIndex: h.current.currentModuleIndex,
|
|
11759
11766
|
lessonIndex: h.current.currentLessonIndex,
|
|
11760
11767
|
questionIndex: h.current.currentQuestionIndex,
|
|
11761
11768
|
answer: v,
|
|
11762
|
-
isCorrect:
|
|
11763
|
-
question:
|
|
11764
|
-
}), c.current)
|
|
11765
|
-
if (
|
|
11769
|
+
isCorrect: F,
|
|
11770
|
+
question: S
|
|
11771
|
+
}), c.current) {
|
|
11772
|
+
if (F) {
|
|
11766
11773
|
if (c.current.setMood("happy"), t.correct)
|
|
11767
11774
|
try {
|
|
11768
11775
|
c.current.playReaction("happy");
|
|
@@ -11770,8 +11777,8 @@ const fo = _t(({
|
|
|
11770
11777
|
c.current.setBodyMovement("happy");
|
|
11771
11778
|
}
|
|
11772
11779
|
c.current.setBodyMovement("gesturing");
|
|
11773
|
-
const
|
|
11774
|
-
c.current.speakText(
|
|
11780
|
+
const ue = S.type === "code_test" ? `Great job! Your code passed all the tests! ${S.explanation || ""}` : `Excellent! That's correct! ${S.explanation || ""}`;
|
|
11781
|
+
c.current.speakText(ue);
|
|
11775
11782
|
} else {
|
|
11776
11783
|
if (c.current.setMood("sad"), t.incorrect)
|
|
11777
11784
|
try {
|
|
@@ -11780,20 +11787,26 @@ const fo = _t(({
|
|
|
11780
11787
|
c.current.setBodyMovement("idle");
|
|
11781
11788
|
}
|
|
11782
11789
|
c.current.setBodyMovement("gesturing");
|
|
11783
|
-
const
|
|
11784
|
-
c.current.speakText(
|
|
11790
|
+
const ue = S.type === "code_test" ? `Your code didn't pass all the tests. ${S.explanation || "Try again!"}` : `Not quite right, but don't worry! ${S.explanation || ""} Let's move on to the next question.`;
|
|
11791
|
+
c.current.speakText(ue);
|
|
11785
11792
|
}
|
|
11786
|
-
|
|
11787
|
-
|
|
11793
|
+
const ie = (F ? S.type === "code_test" ? `Great job! Your code passed all the tests! ${S.explanation || ""}` : `Excellent! That's correct! ${S.explanation || ""}` : S.type === "code_test" ? `Your code didn't pass all the tests. ${S.explanation || "Try again!"}` : `Not quite right, but don't worry! ${S.explanation || ""} Let's move on to the next question.`).length, Y = Math.max(2e3, ie / 150 * 1e3) + 500;
|
|
11794
|
+
setTimeout(() => {
|
|
11795
|
+
k();
|
|
11796
|
+
}, Y);
|
|
11797
|
+
} else
|
|
11798
|
+
k();
|
|
11799
|
+
}, [t.correct, t.incorrect, f, b, k]), D = B((v) => {
|
|
11800
|
+
const S = f();
|
|
11788
11801
|
if (!v || typeof v != "object") {
|
|
11789
11802
|
console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
|
|
11790
11803
|
return;
|
|
11791
11804
|
}
|
|
11792
|
-
if (
|
|
11805
|
+
if (S?.type !== "code_test") {
|
|
11793
11806
|
console.warn("Current question is not a code test. Use handleAnswerSelect for other question types.");
|
|
11794
11807
|
return;
|
|
11795
11808
|
}
|
|
11796
|
-
const
|
|
11809
|
+
const F = {
|
|
11797
11810
|
passed: v.passed === !0,
|
|
11798
11811
|
results: v.results || [],
|
|
11799
11812
|
output: v.output || "",
|
|
@@ -11808,15 +11821,15 @@ const fo = _t(({
|
|
|
11808
11821
|
moduleIndex: h.current.currentModuleIndex,
|
|
11809
11822
|
lessonIndex: h.current.currentLessonIndex,
|
|
11810
11823
|
questionIndex: h.current.currentQuestionIndex,
|
|
11811
|
-
testResult:
|
|
11812
|
-
question:
|
|
11813
|
-
}), E(
|
|
11814
|
-
}, [
|
|
11824
|
+
testResult: F,
|
|
11825
|
+
question: S
|
|
11826
|
+
}), E(F);
|
|
11827
|
+
}, [f, E]), U = B(() => {
|
|
11815
11828
|
h.current.currentModuleIndex = 0, h.current.currentLessonIndex = 0, h.current.currentQuestionIndex = 0, h.current.isTeaching = !1, h.current.isQuestionMode = !1, h.current.lessonCompleted = !1, h.current.curriculumCompleted = !1, h.current.score = 0, h.current.totalQuestions = 0;
|
|
11816
11829
|
}, []), w = B((v) => {
|
|
11817
11830
|
console.log("Avatar is ready!", v);
|
|
11818
|
-
const
|
|
11819
|
-
l &&
|
|
11831
|
+
const S = y();
|
|
11832
|
+
l && S?.avatar_script && setTimeout(() => {
|
|
11820
11833
|
M();
|
|
11821
11834
|
}, 1e3);
|
|
11822
11835
|
}, [l, y, M]);
|
|
@@ -11825,14 +11838,14 @@ const fo = _t(({
|
|
|
11825
11838
|
startTeaching: M,
|
|
11826
11839
|
startQuestions: L,
|
|
11827
11840
|
handleAnswerSelect: E,
|
|
11828
|
-
handleCodeTestResult:
|
|
11841
|
+
handleCodeTestResult: D,
|
|
11829
11842
|
nextQuestion: k,
|
|
11830
11843
|
nextLesson: A,
|
|
11831
11844
|
completeLesson: I,
|
|
11832
|
-
completeCurriculum:
|
|
11845
|
+
completeCurriculum: g,
|
|
11833
11846
|
resetCurriculum: U,
|
|
11834
11847
|
getState: () => ({ ...h.current }),
|
|
11835
|
-
getCurrentQuestion: () =>
|
|
11848
|
+
getCurrentQuestion: () => f(),
|
|
11836
11849
|
getCurrentLesson: () => y(),
|
|
11837
11850
|
// Direct access to avatar ref (always returns current value)
|
|
11838
11851
|
getAvatarRef: () => c.current,
|
|
@@ -11845,19 +11858,19 @@ const fo = _t(({
|
|
|
11845
11858
|
return await c.current.resumeAudioContext();
|
|
11846
11859
|
const v = c.current?.talkingHead;
|
|
11847
11860
|
if (v?.audioCtx) {
|
|
11848
|
-
const
|
|
11849
|
-
if (
|
|
11861
|
+
const S = v.audioCtx;
|
|
11862
|
+
if (S.state === "suspended" || S.state === "interrupted")
|
|
11850
11863
|
try {
|
|
11851
|
-
await
|
|
11852
|
-
} catch (
|
|
11853
|
-
console.warn("Failed to resume audio context:",
|
|
11864
|
+
await S.resume(), console.log("Audio context resumed via talkingHead");
|
|
11865
|
+
} catch (F) {
|
|
11866
|
+
console.warn("Failed to resume audio context:", F);
|
|
11854
11867
|
}
|
|
11855
11868
|
} else
|
|
11856
11869
|
console.warn("Audio context not available yet");
|
|
11857
11870
|
},
|
|
11858
11871
|
stopSpeaking: () => c.current?.stopSpeaking(),
|
|
11859
11872
|
setMood: (v) => c.current?.setMood(v),
|
|
11860
|
-
playAnimation: (v,
|
|
11873
|
+
playAnimation: (v, S) => c.current?.playAnimation(v, S),
|
|
11861
11874
|
setBodyMovement: (v) => c.current?.setBodyMovement(v),
|
|
11862
11875
|
setMovementIntensity: (v) => c.current?.setMovementIntensity(v),
|
|
11863
11876
|
playRandomDance: () => c.current?.playRandomDance(),
|
|
@@ -11868,10 +11881,10 @@ const fo = _t(({
|
|
|
11868
11881
|
lockAvatarPosition: () => c.current?.lockAvatarPosition(),
|
|
11869
11882
|
unlockAvatarPosition: () => c.current?.unlockAvatarPosition(),
|
|
11870
11883
|
// Custom action trigger
|
|
11871
|
-
triggerCustomAction: (v,
|
|
11884
|
+
triggerCustomAction: (v, S) => {
|
|
11872
11885
|
u.current.onCustomAction({
|
|
11873
11886
|
type: v,
|
|
11874
|
-
...
|
|
11887
|
+
...S,
|
|
11875
11888
|
state: { ...h.current }
|
|
11876
11889
|
});
|
|
11877
11890
|
},
|
|
@@ -11879,7 +11892,7 @@ const fo = _t(({
|
|
|
11879
11892
|
handleResize: () => c.current?.handleResize(),
|
|
11880
11893
|
// Avatar readiness check (always returns current value)
|
|
11881
11894
|
isAvatarReady: () => c.current?.isReady || !1
|
|
11882
|
-
}), [M, L, E,
|
|
11895
|
+
}), [M, L, E, D, k, A, I, g, U, f, y]), /* @__PURE__ */ Te("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ Te(
|
|
11883
11896
|
Dn,
|
|
11884
11897
|
{
|
|
11885
11898
|
ref: c,
|