@sage-rsc/talking-head-react 1.0.21 → 1.0.23
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-CPrVtkyX.cjs} +1 -1
- package/dist/{fbxAnimationLoader-DzYmybHd.js → fbxAnimationLoader-Ceym4Gbp.js} +1 -1
- package/dist/{index-BeFzGp0g.cjs → index-Bwi0p5fF.cjs} +4 -4
- package/dist/{index-3_k5n4iL.js → index-CiNyTJ1A.js} +748 -728
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/CurriculumLearning.jsx +80 -39
- package/src/components/TalkingHeadAvatar.jsx +10 -4
|
@@ -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 * Q.DEG2RAD),
|
|
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 J, LinearSRGBColorSpace as be, SRGBColorSpace as j, 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), q = 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 = Li.bind(this), this._onKeyDown = wi.bind(this), this._onTouchStart = Si.bind(this), this._onTouchMove = Ti.bind(this), this._onMouseDown = Ai.bind(this), this._onMouseMove = Ii.bind(this), this._interceptControlDown = Ci.bind(this), this._interceptControlUp = Ei.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
24
24
|
}
|
|
25
25
|
connect(e) {
|
|
26
26
|
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -85,7 +85,7 @@ class xi extends Nn {
|
|
|
85
85
|
}
|
|
86
86
|
update(e = null) {
|
|
87
87
|
const t = this.object.position;
|
|
88
|
-
|
|
88
|
+
q.copy(t).sub(this.target), q.applyQuaternion(this._quat), this._spherical.setFromVector3(q), this.autoRotate && this.state === N.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
89
89
|
let n = this.minAzimuthAngle, i = this.maxAzimuthAngle;
|
|
90
90
|
isFinite(n) && isFinite(i) && (n < -Math.PI ? n += se : n > Math.PI && (n -= se), i < -Math.PI ? i += se : i > Math.PI && (i -= se), n <= i ? this._spherical.theta = Math.max(n, Math.min(i, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + i) / 2 ? Math.max(n, this._spherical.theta) : Math.min(i, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
|
|
91
91
|
let s = !1;
|
|
@@ -95,10 +95,10 @@ class xi extends Nn {
|
|
|
95
95
|
const o = this._spherical.radius;
|
|
96
96
|
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), s = o != this._spherical.radius;
|
|
97
97
|
}
|
|
98
|
-
if (
|
|
98
|
+
if (q.setFromSpherical(this._spherical), q.applyQuaternion(this._quatInverse), t.copy(this.target).add(q), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
|
|
99
99
|
let o = null;
|
|
100
100
|
if (this.object.isPerspectiveCamera) {
|
|
101
|
-
const a =
|
|
101
|
+
const a = q.length();
|
|
102
102
|
o = this._clampDistance(a * this._scale);
|
|
103
103
|
const l = a - o;
|
|
104
104
|
this.object.position.addScaledVector(this._dollyDirection, l), this.object.updateMatrixWorld(), s = !!l;
|
|
@@ -108,7 +108,7 @@ class xi extends Nn {
|
|
|
108
108
|
const l = this.object.zoom;
|
|
109
109
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), s = l !== this.object.zoom;
|
|
110
110
|
const r = new _(this._mouse.x, this._mouse.y, 0);
|
|
111
|
-
r.unproject(this.object), this.object.position.sub(r).add(a), this.object.updateMatrixWorld(), o =
|
|
111
|
+
r.unproject(this.object), this.object.position.sub(r).add(a), this.object.updateMatrixWorld(), o = q.length();
|
|
112
112
|
} else
|
|
113
113
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
114
114
|
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (at.origin.copy(this.object.position), at.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(at.direction)) < yi ? this.object.lookAt(this.target) : (Zt.setFromNormalAndCoplanarPoint(this.object.up, this.target), at.intersectPlane(Zt, this.target))));
|
|
@@ -132,18 +132,18 @@ class xi extends Nn {
|
|
|
132
132
|
this._sphericalDelta.phi -= e;
|
|
133
133
|
}
|
|
134
134
|
_panLeft(e, t) {
|
|
135
|
-
|
|
135
|
+
q.setFromMatrixColumn(t, 0), q.multiplyScalar(-e), this._panOffset.add(q);
|
|
136
136
|
}
|
|
137
137
|
_panUp(e, t) {
|
|
138
|
-
this.screenSpacePanning === !0 ?
|
|
138
|
+
this.screenSpacePanning === !0 ? q.setFromMatrixColumn(t, 1) : (q.setFromMatrixColumn(t, 0), q.crossVectors(this.object.up, q)), q.multiplyScalar(e), this._panOffset.add(q);
|
|
139
139
|
}
|
|
140
140
|
// deltaX and deltaY are in pixels; right and down are positive
|
|
141
141
|
_pan(e, t) {
|
|
142
142
|
const n = this.domElement;
|
|
143
143
|
if (this.object.isPerspectiveCamera) {
|
|
144
144
|
const i = this.object.position;
|
|
145
|
-
|
|
146
|
-
let s =
|
|
145
|
+
q.copy(i).sub(this.target);
|
|
146
|
+
let s = q.length();
|
|
147
147
|
s *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * s / n.clientHeight, this.object.matrix), this._panUp(2 * t * s / n.clientHeight, this.object.matrix);
|
|
148
148
|
} else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / n.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / n.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
|
|
149
149
|
}
|
|
@@ -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;
|
|
@@ -384,21 +384,21 @@ function Ii(p) {
|
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
|
-
function
|
|
387
|
+
function Li(p) {
|
|
388
388
|
this.enabled === !1 || this.enableZoom === !1 || this.state !== N.NONE || (p.preventDefault(), this.dispatchEvent(Bt), this._handleMouseWheel(this._customWheelEvent(p)), this.dispatchEvent(An));
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function wi(p) {
|
|
391
391
|
this.enabled !== !1 && this._handleKeyDown(p);
|
|
392
392
|
}
|
|
393
393
|
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 J(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,18 +781,18 @@ 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 J(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
|
-
s.baseColorTexture !== void 0 && i.push(n.assignTexture(e, "map", s.baseColorTexture,
|
|
795
|
+
s.baseColorTexture !== void 0 && i.push(n.assignTexture(e, "map", s.baseColorTexture, j));
|
|
796
796
|
}
|
|
797
797
|
return Promise.all(i);
|
|
798
798
|
}
|
|
@@ -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,20 +867,20 @@ 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 J(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
|
-
return o.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = o.sheenRoughnessFactor), o.sheenColorTexture !== void 0 && s.push(n.assignTexture(t, "sheenColorMap", o.sheenColorTexture,
|
|
883
|
+
return o.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = o.sheenRoughnessFactor), o.sheenColorTexture !== void 0 && s.push(n.assignTexture(t, "sheenColorMap", o.sheenColorTexture, j)), o.sheenRoughnessTexture !== void 0 && s.push(n.assignTexture(t, "sheenRoughnessMap", o.sheenRoughnessTexture)), Promise.all(s);
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
886
|
class Bi {
|
|
@@ -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 J().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 J().setRGB(a[0], a[1], a[2], be), o.specularColorTexture !== void 0 && s.push(n.assignTexture(t, "specularColorMap", o.specularColorTexture, j)), 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(),
|
|
1082
|
-
for (let
|
|
1083
|
-
l.TRANSLATION &&
|
|
1084
|
-
for (const
|
|
1085
|
-
if (
|
|
1086
|
-
const k = l[
|
|
1087
|
-
|
|
1088
|
-
} else
|
|
1089
|
-
Ee.prototype.copy.call(
|
|
1081
|
+
const y = new G(), f = new _(), b = new he(), I = new _(1, 1, 1), g = new cn(m.geometry, m.material, u);
|
|
1082
|
+
for (let S = 0; S < u; S++)
|
|
1083
|
+
l.TRANSLATION && f.fromBufferAttribute(l.TRANSLATION, S), l.ROTATION && b.fromBufferAttribute(l.ROTATION, S), l.SCALE && I.fromBufferAttribute(l.SCALE, S), g.setMatrixAt(S, y.compose(f, b, I));
|
|
1084
|
+
for (const S in l)
|
|
1085
|
+
if (S === "_COLOR_0") {
|
|
1086
|
+
const k = l[S];
|
|
1087
|
+
g.instanceColor = new Vn(k.array, k.itemSize, k.normalized);
|
|
1088
|
+
} else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" && m.geometry.setAttribute(S, l[S]);
|
|
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
|
}
|
|
@@ -1169,7 +1169,7 @@ class es {
|
|
|
1169
1169
|
this.name = P.KHR_MESH_QUANTIZATION;
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
1172
|
-
class
|
|
1172
|
+
class Ln extends oi {
|
|
1173
1173
|
constructor(e, t, n, i) {
|
|
1174
1174
|
super(e, t, n, i);
|
|
1175
1175
|
}
|
|
@@ -1180,16 +1180,16 @@ 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,
|
|
1184
|
-
for (let
|
|
1185
|
-
const k = o[y +
|
|
1186
|
-
s[
|
|
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
|
+
for (let S = 0; S !== a; S++) {
|
|
1185
|
+
const k = o[y + S + a], A = o[y + S + l] * c, M = o[m + S + a], E = o[m + S] * c;
|
|
1186
|
+
s[S] = I * k + g * A + f * M + b * E;
|
|
1187
1187
|
}
|
|
1188
1188
|
return s;
|
|
1189
1189
|
}
|
|
1190
1190
|
}
|
|
1191
1191
|
const ts = new he();
|
|
1192
|
-
class ns extends
|
|
1192
|
+
class ns extends Ln {
|
|
1193
1193
|
interpolate_(e, t, n, i) {
|
|
1194
1194
|
const s = super.interpolate_(e, t, n, i);
|
|
1195
1195
|
return ts.fromArray(s).normalize().toArray(s), s;
|
|
@@ -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
|
+
}, Le = {
|
|
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, S = i.sparse.values.byteOffset || 0, k = new I(o[1], g, i.sparse.count * b), A = new r(o[2], S, 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,11 +1760,11 @@ 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 J(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
|
-
h.baseColorTexture !== void 0 && r.push(t.assignTexture(a, "map", h.baseColorTexture,
|
|
1767
|
+
h.baseColorTexture !== void 0 && r.push(t.assignTexture(a, "map", h.baseColorTexture, j)), 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);
|
|
1769
1769
|
}), r.push(Promise.all(this._invokeAll(function(u) {
|
|
1770
1770
|
return u.extendMaterialParams && u.extendMaterialParams(e, a);
|
|
@@ -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 J().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, j)), 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(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)),
|
|
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, S = u.length; g < S; 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
|
-
for (let
|
|
1943
|
-
b.push(U[
|
|
1942
|
+
for (let L = 0; L < U.length; L++)
|
|
1943
|
+
b.push(U[L]);
|
|
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
|
+
Le[s.path] === Le.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 (Le[s.path]) {
|
|
2055
|
+
case Le.weights:
|
|
2056
2056
|
r = Pt;
|
|
2057
2057
|
break;
|
|
2058
|
-
case
|
|
2058
|
+
case Le.rotation:
|
|
2059
2059
|
r = mt;
|
|
2060
2060
|
break;
|
|
2061
|
-
case
|
|
2062
|
-
case
|
|
2061
|
+
case Le.translation:
|
|
2062
|
+
case Le.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] + "." + Le[s.path],
|
|
2082
2082
|
t.array,
|
|
2083
2083
|
h,
|
|
2084
2084
|
c
|
|
@@ -2099,7 +2099,7 @@ class cs {
|
|
|
2099
2099
|
}
|
|
2100
2100
|
_createCubicSplineTrackInterpolant(e) {
|
|
2101
2101
|
e.createInterpolant = function(n) {
|
|
2102
|
-
const i = this instanceof mt ? ns :
|
|
2102
|
+
const i = this instanceof mt ? ns : Ln;
|
|
2103
2103
|
return new i(this.times, this.values, this.getValueSize() / 3, n);
|
|
2104
2104
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
2105
2105
|
}
|
|
@@ -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);
|
|
@@ -2238,10 +2238,10 @@ class ds extends qe {
|
|
|
2238
2238
|
*/
|
|
2239
2239
|
parse(e, t, n = () => {
|
|
2240
2240
|
}) {
|
|
2241
|
-
this.decodeDracoFile(e, t, null, null,
|
|
2241
|
+
this.decodeDracoFile(e, t, null, null, j, 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
|
-
if (t !==
|
|
2287
|
-
const n = new
|
|
2286
|
+
if (t !== j) return;
|
|
2287
|
+
const n = new J();
|
|
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, j), 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
|
|
2405
|
-
|
|
2404
|
+
const S = i(o, a, u, f, b, I);
|
|
2405
|
+
f === "color" && (S.vertexColorSpace = r.vertexColorSpace), y.attributes.push(S);
|
|
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, wn = new ce([
|
|
2451
2451
|
0,
|
|
2452
2452
|
0,
|
|
2453
2453
|
0,
|
|
@@ -2517,57 +2517,57 @@ 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)
|
|
2524
2524
|
i[s] = s - t[n] << 5 | n;
|
|
2525
2525
|
return { b: t, r: i };
|
|
2526
|
-
}, kn = Tn(
|
|
2526
|
+
}, kn = Tn(wn, 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
2530
|
var we = (V & 43690) >> 1 | (V & 21845) << 1;
|
|
2531
2531
|
we = (we & 52428) >> 2 | (we & 13107) << 2, we = (we & 61680) >> 4 | (we & 3855) << 4, Ot[V] = ((we & 65280) >> 8 | (we & 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), Lt = 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
|
+
}, wt = function(p, e) {
|
|
2571
2571
|
var t = e / 8 | 0;
|
|
2572
2572
|
return (p[t] | p[t + 1] << 8 | p[t + 2] << 16) >> (e & 7);
|
|
2573
2573
|
}, vs = function(p) {
|
|
@@ -2590,12 +2590,12 @@ 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
|
+
}, Ls = function(p, e, t, n) {
|
|
2599
2599
|
var i = p.length, s = 0;
|
|
2600
2600
|
if (!i || e.f && !e.l)
|
|
2601
2601
|
return t || new ce(0);
|
|
@@ -2607,102 +2607,102 @@ 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[
|
|
2621
|
+
for (var D = new ce(E), U = new ce(19), L = 0; L < M; ++L)
|
|
2622
|
+
U[fs[L]] = de(p, h + L * 3, 7);
|
|
2623
2623
|
h += M * 3;
|
|
2624
|
-
for (var v =
|
|
2625
|
-
var
|
|
2626
|
-
h +=
|
|
2627
|
-
var
|
|
2628
|
-
if (
|
|
2629
|
-
|
|
2624
|
+
for (var v = Lt(U), w = (1 << v) - 1, F = qe(U, v, 1), L = 0; L < E; ) {
|
|
2625
|
+
var ie = F[de(p, h, w)];
|
|
2626
|
+
h += ie & 15;
|
|
2627
|
+
var g = ie >> 4;
|
|
2628
|
+
if (g < 16)
|
|
2629
|
+
D[L++] = g;
|
|
2630
2630
|
else {
|
|
2631
|
-
var
|
|
2632
|
-
for (
|
|
2633
|
-
|
|
2631
|
+
var K = 0, ue = 0;
|
|
2632
|
+
for (g == 16 ? (ue = 3 + de(p, h, 3), h += 2, K = D[L - 1]) : g == 17 ? (ue = 3 + de(p, h, 7), h += 3) : g == 18 && (ue = 11 + de(p, h, 127), h += 7); ue--; )
|
|
2633
|
+
D[L++] = K;
|
|
2634
2634
|
}
|
|
2635
2635
|
}
|
|
2636
|
-
var
|
|
2637
|
-
y =
|
|
2636
|
+
var Me = D.subarray(0, A), fe = D.subarray(A);
|
|
2637
|
+
y = Lt(Me), f = Lt(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, S = p[g - 4] | p[g - 3] << 8, k = g + S;
|
|
2642
2642
|
if (k > i) {
|
|
2643
|
-
l &&
|
|
2643
|
+
l && pe(0);
|
|
2644
2644
|
break;
|
|
2645
2645
|
}
|
|
2646
|
-
a && r(u +
|
|
2646
|
+
a && r(u + S), t.set(p.subarray(g, k), u), e.b = u += S, 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 <<
|
|
2656
|
-
var
|
|
2657
|
-
if (h +=
|
|
2658
|
-
l &&
|
|
2655
|
+
for (var ft = (1 << y) - 1, gt = (1 << f) - 1, We = h; ; We = h) {
|
|
2656
|
+
var K = d[wt(p, h) & ft], C = K >> 4;
|
|
2657
|
+
if (h += K & 15, h > b) {
|
|
2658
|
+
l && pe(0);
|
|
2659
2659
|
break;
|
|
2660
2660
|
}
|
|
2661
|
-
if (
|
|
2661
|
+
if (K || 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
|
-
var
|
|
2667
|
+
var Y = C - 254;
|
|
2668
2668
|
if (C > 264) {
|
|
2669
|
-
var
|
|
2670
|
-
|
|
2669
|
+
var L = C - 257, W = wn[L];
|
|
2670
|
+
Y = de(p, h, (1 << W) - 1) + Cn[L], h += W;
|
|
2671
2671
|
}
|
|
2672
|
-
var
|
|
2673
|
-
|
|
2674
|
-
var
|
|
2675
|
-
if (
|
|
2676
|
-
var
|
|
2677
|
-
|
|
2672
|
+
var te = m[wt(p, h) & gt], Ie = te >> 4;
|
|
2673
|
+
te || pe(3), h += te & 15;
|
|
2674
|
+
var fe = xs[Ie];
|
|
2675
|
+
if (Ie > 3) {
|
|
2676
|
+
var W = Sn[Ie];
|
|
2677
|
+
fe += wt(p, h) & (1 << W) - 1, h += W;
|
|
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 + Y;
|
|
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
|
-
},
|
|
2698
|
-
return ((p[0] & 15) != 8 || p[0] >> 4 > 7 || (p[0] << 8 | p[1]) % 31) &&
|
|
2697
|
+
}, ws = /* @__PURE__ */ new ce(0), Ss = function(p, e) {
|
|
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
|
-
return
|
|
2701
|
+
return Ls(p.subarray(Ss(p), -4), { i: 2 }, e, e);
|
|
2702
2702
|
}
|
|
2703
2703
|
var ks = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), Cs = 0;
|
|
2704
2704
|
try {
|
|
2705
|
-
ks.decode(
|
|
2705
|
+
ks.decode(ws, { stream: !0 }), Cs = 1;
|
|
2706
2706
|
} catch {
|
|
2707
2707
|
}
|
|
2708
2708
|
function zn(p, e, t) {
|
|
@@ -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, S = h - 1 <= I ? y - 1 : t - h;
|
|
2777
|
+
for (let A = g; A <= S; ++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,
|
|
2888
|
-
class $t extends
|
|
2887
|
+
let H, Z, 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));
|
|
@@ -2940,9 +2940,9 @@ class _s {
|
|
|
2940
2940
|
this.textureLoader = e, this.manager = t;
|
|
2941
2941
|
}
|
|
2942
2942
|
parse() {
|
|
2943
|
-
|
|
2943
|
+
Z = 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
|
}
|
|
@@ -3058,7 +3058,7 @@ class _s {
|
|
|
3058
3058
|
i === null && (i = this.textureLoader);
|
|
3059
3059
|
const s = i.path;
|
|
3060
3060
|
s || i.setPath(this.textureLoader.path);
|
|
3061
|
-
const o =
|
|
3061
|
+
const o = Z.get(e.id).children;
|
|
3062
3062
|
let a;
|
|
3063
3063
|
if (o !== void 0 && o.length > 0 && t[o[0].ID] !== void 0 && (a = t[o[0].ID], (a.indexOf("blob:") === 0 || a.indexOf("data:") === 0) && i.setPath(void 0)), a === void 0)
|
|
3064
3064
|
return console.warn("FBXLoader: Undefined filename, creating placeholder texture."), new Mt();
|
|
@@ -3083,7 +3083,7 @@ class _s {
|
|
|
3083
3083
|
parseMaterial(e, t) {
|
|
3084
3084
|
const n = e.id, i = e.attrName;
|
|
3085
3085
|
let s = e.ShadingModel;
|
|
3086
|
-
if (typeof s == "object" && (s = s.value), !
|
|
3086
|
+
if (typeof s == "object" && (s = s.value), !Z.has(n)) return null;
|
|
3087
3087
|
const o = this.parseParameters(e, t, n);
|
|
3088
3088
|
let a;
|
|
3089
3089
|
switch (s.toLowerCase()) {
|
|
@@ -3103,9 +3103,9 @@ 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 J().fromArray(e.Diffuse.value), j) : e.DiffuseColor && (e.DiffuseColor.type === "Color" || e.DiffuseColor.type === "ColorRGB") && (i.color = me.colorSpaceToWorking(new J().fromArray(e.DiffuseColor.value), j)), e.DisplacementFactor && (i.displacementScale = e.DisplacementFactor.value), e.Emissive ? i.emissive = me.colorSpaceToWorking(new J().fromArray(e.Emissive.value), j) : e.EmissiveColor && (e.EmissiveColor.type === "Color" || e.EmissiveColor.type === "ColorRGB") && (i.emissive = me.colorSpaceToWorking(new J().fromArray(e.EmissiveColor.value), j)), 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 J().fromArray(e.Specular.value), j) : e.SpecularColor && e.SpecularColor.type === "Color" && (i.specular = me.colorSpaceToWorking(new J().fromArray(e.SpecularColor.value), j));
|
|
3107
3107
|
const s = this;
|
|
3108
|
-
return
|
|
3108
|
+
return Z.get(n).children.forEach(function(o) {
|
|
3109
3109
|
const a = o.relationship;
|
|
3110
3110
|
switch (a) {
|
|
3111
3111
|
case "Bump":
|
|
@@ -3116,23 +3116,23 @@ class _s {
|
|
|
3116
3116
|
break;
|
|
3117
3117
|
case "DiffuseColor":
|
|
3118
3118
|
case "Maya|TEX_color_map":
|
|
3119
|
-
i.map = s.getTexture(t, o.ID), i.map !== void 0 && (i.map.colorSpace =
|
|
3119
|
+
i.map = s.getTexture(t, o.ID), i.map !== void 0 && (i.map.colorSpace = j);
|
|
3120
3120
|
break;
|
|
3121
3121
|
case "DisplacementColor":
|
|
3122
3122
|
i.displacementMap = s.getTexture(t, o.ID);
|
|
3123
3123
|
break;
|
|
3124
3124
|
case "EmissiveColor":
|
|
3125
|
-
i.emissiveMap = s.getTexture(t, o.ID), i.emissiveMap !== void 0 && (i.emissiveMap.colorSpace =
|
|
3125
|
+
i.emissiveMap = s.getTexture(t, o.ID), i.emissiveMap !== void 0 && (i.emissiveMap.colorSpace = j);
|
|
3126
3126
|
break;
|
|
3127
3127
|
case "NormalMap":
|
|
3128
3128
|
case "Maya|TEX_normal_map":
|
|
3129
3129
|
i.normalMap = s.getTexture(t, o.ID);
|
|
3130
3130
|
break;
|
|
3131
3131
|
case "ReflectionColor":
|
|
3132
|
-
i.envMap = s.getTexture(t, o.ID), i.envMap !== void 0 && (i.envMap.mapping = hi, i.envMap.colorSpace =
|
|
3132
|
+
i.envMap = s.getTexture(t, o.ID), i.envMap !== void 0 && (i.envMap.mapping = hi, i.envMap.colorSpace = j);
|
|
3133
3133
|
break;
|
|
3134
3134
|
case "SpecularColor":
|
|
3135
|
-
i.specularMap = s.getTexture(t, o.ID), i.specularMap !== void 0 && (i.specularMap.colorSpace =
|
|
3135
|
+
i.specularMap = s.getTexture(t, o.ID), i.specularMap !== void 0 && (i.specularMap.colorSpace = j);
|
|
3136
3136
|
break;
|
|
3137
3137
|
case "TransparentColor":
|
|
3138
3138
|
case "TransparencyFactor":
|
|
@@ -3153,7 +3153,7 @@ class _s {
|
|
|
3153
3153
|
}
|
|
3154
3154
|
// get a texture from the textureMap for use by a material.
|
|
3155
3155
|
getTexture(e, t) {
|
|
3156
|
-
return "LayeredTexture" in H.Objects && t in H.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), t =
|
|
3156
|
+
return "LayeredTexture" in H.Objects && t in H.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), t = Z.get(t).children[0].ID), e.get(t);
|
|
3157
3157
|
}
|
|
3158
3158
|
// Parse nodes in FBXTree.Objects.Deformer
|
|
3159
3159
|
// Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
|
|
@@ -3163,7 +3163,7 @@ class _s {
|
|
|
3163
3163
|
if ("Deformer" in H.Objects) {
|
|
3164
3164
|
const n = H.Objects.Deformer;
|
|
3165
3165
|
for (const i in n) {
|
|
3166
|
-
const s = n[i], o =
|
|
3166
|
+
const s = n[i], o = Z.get(parseInt(i));
|
|
3167
3167
|
if (s.attrType === "Skin") {
|
|
3168
3168
|
const a = this.parseSkeleton(o, n);
|
|
3169
3169
|
a.ID = i, o.parents.length > 1 && console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), a.geometryID = o.parents[0].ID, e[i] = a;
|
|
@@ -3213,7 +3213,7 @@ class _s {
|
|
|
3213
3213
|
fullWeights: o.FullWeights.a
|
|
3214
3214
|
};
|
|
3215
3215
|
if (o.attrType !== "BlendShapeChannel") return;
|
|
3216
|
-
a.geoID =
|
|
3216
|
+
a.geoID = Z.get(parseInt(s.ID)).children.filter(function(l) {
|
|
3217
3217
|
return l.relationship === void 0;
|
|
3218
3218
|
})[0].ID, n.push(a);
|
|
3219
3219
|
}
|
|
@@ -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
|
-
o.setLookAtProperties(l, r),
|
|
3228
|
+
o.setLookAtProperties(l, r), Z.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,13 +3237,13 @@ 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) {
|
|
3244
3244
|
const i = /* @__PURE__ */ new Map(), s = H.Objects.Model;
|
|
3245
3245
|
for (const o in s) {
|
|
3246
|
-
const a = parseInt(o), l = s[o], r =
|
|
3246
|
+
const a = parseInt(o), l = s[o], r = Z.get(a);
|
|
3247
3247
|
let c = this.buildSkeleton(r, e, a, l.attrName);
|
|
3248
3248
|
if (!c) {
|
|
3249
3249
|
switch (l.attrType) {
|
|
@@ -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 J().fromArray(n.Color.value), j));
|
|
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;
|
|
@@ -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,15 +3398,15 @@ 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
|
-
"LookAtProperty" in t &&
|
|
3404
|
+
"LookAtProperty" in t && Z.get(e.ID).children.forEach(function(i) {
|
|
3405
3405
|
if (i.relationship === "LookAtProperty") {
|
|
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
|
});
|
|
@@ -3415,10 +3415,10 @@ class _s {
|
|
|
3415
3415
|
const i = this.parsePoseNodes();
|
|
3416
3416
|
for (const s in e) {
|
|
3417
3417
|
const o = e[s];
|
|
3418
|
-
|
|
3418
|
+
Z.get(parseInt(o.ID)).parents.forEach(function(l) {
|
|
3419
3419
|
if (t.has(l.ID)) {
|
|
3420
3420
|
const r = l.ID;
|
|
3421
|
-
|
|
3421
|
+
Z.get(r).parents.forEach(function(h) {
|
|
3422
3422
|
n.has(h.ID) && n.get(h.ID).bind(new xn(o.bones), i[h.ID]);
|
|
3423
3423
|
});
|
|
3424
3424
|
}
|
|
@@ -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 J().setRGB(t, n, i, j);
|
|
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
|
}
|
|
@@ -3462,7 +3462,7 @@ class Ns {
|
|
|
3462
3462
|
if ("Geometry" in H.Objects) {
|
|
3463
3463
|
const n = H.Objects.Geometry;
|
|
3464
3464
|
for (const i in n) {
|
|
3465
|
-
const s =
|
|
3465
|
+
const s = Z.get(parseInt(i)), o = this.parseGeometry(s, n[i], e);
|
|
3466
3466
|
t.set(parseInt(i), o);
|
|
3467
3467
|
}
|
|
3468
3468
|
}
|
|
@@ -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], S = [0, 0, 0, 0];
|
|
3564
3564
|
I.forEach(function(k, A) {
|
|
3565
3565
|
let M = k, E = b[A];
|
|
3566
|
-
|
|
3567
|
-
if (M >
|
|
3568
|
-
|
|
3569
|
-
const v =
|
|
3570
|
-
|
|
3566
|
+
S.forEach(function(D, U, L) {
|
|
3567
|
+
if (M > D) {
|
|
3568
|
+
L[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 = S;
|
|
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,
|
|
3586
|
-
r[
|
|
3587
|
-
}), i++,
|
|
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, S) {
|
|
3585
|
+
const k = rt(m, n, d, g);
|
|
3586
|
+
r[S] === void 0 && (r[S] = []), r[S].push(k[0]), r[S].push(k[1]);
|
|
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 J(); o < i.length; o += 4)
|
|
3695
|
+
a.fromArray(i, o), me.colorSpaceToWorking(a, j), 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 {
|
|
@@ -3789,7 +3789,7 @@ class Bs {
|
|
|
3789
3789
|
id: t[n].id,
|
|
3790
3790
|
times: t[n].KeyTime.a.map(Xs),
|
|
3791
3791
|
values: t[n].KeyValueFloat.a
|
|
3792
|
-
}, s =
|
|
3792
|
+
}, s = Z.get(i.id);
|
|
3793
3793
|
if (s !== void 0) {
|
|
3794
3794
|
const o = s.parents[0].ID, a = s.parents[0].relationship;
|
|
3795
3795
|
a.match(/X/) ? e.get(o).curves.x = i : a.match(/Y/) ? e.get(o).curves.y = i : a.match(/Z/) ? e.get(o).curves.z = i : a.match(/DeformPercent/) && e.has(o) && (e.get(o).curves.morph = i);
|
|
@@ -3802,13 +3802,13 @@ class Bs {
|
|
|
3802
3802
|
parseAnimationLayers(e) {
|
|
3803
3803
|
const t = H.Objects.AnimationLayer, n = /* @__PURE__ */ new Map();
|
|
3804
3804
|
for (const i in t) {
|
|
3805
|
-
const s = [], o =
|
|
3805
|
+
const s = [], o = Z.get(parseInt(i));
|
|
3806
3806
|
o !== void 0 && (o.children.forEach(function(l, r) {
|
|
3807
3807
|
if (e.has(l.ID)) {
|
|
3808
3808
|
const c = e.get(l.ID);
|
|
3809
3809
|
if (c.curves.x !== void 0 || c.curves.y !== void 0 || c.curves.z !== void 0) {
|
|
3810
3810
|
if (s[r] === void 0) {
|
|
3811
|
-
const h =
|
|
3811
|
+
const h = Z.get(l.ID).parents.filter(function(u) {
|
|
3812
3812
|
return u.relationship !== void 0;
|
|
3813
3813
|
})[0].ID;
|
|
3814
3814
|
if (h !== void 0) {
|
|
@@ -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
|
}
|
|
@@ -3832,13 +3832,13 @@ class Bs {
|
|
|
3832
3832
|
s[r] && (s[r][c.attr] = c);
|
|
3833
3833
|
} else if (c.curves.morph !== void 0) {
|
|
3834
3834
|
if (s[r] === void 0) {
|
|
3835
|
-
const h =
|
|
3835
|
+
const h = Z.get(l.ID).parents.filter(function(b) {
|
|
3836
3836
|
return b.relationship !== void 0;
|
|
3837
|
-
})[0].ID, u =
|
|
3838
|
-
modelName: y.attrName ?
|
|
3837
|
+
})[0].ID, u = Z.get(h).parents[0].ID, d = Z.get(u).parents[0].ID, m = Z.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
|
}
|
|
@@ -3852,7 +3852,7 @@ class Bs {
|
|
|
3852
3852
|
parseAnimStacks(e) {
|
|
3853
3853
|
const t = H.Objects.AnimationStack, n = {};
|
|
3854
3854
|
for (const i in t) {
|
|
3855
|
-
const s =
|
|
3855
|
+
const s = Z.get(parseInt(i)).children;
|
|
3856
3856
|
s.length > 1 && console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");
|
|
3857
3857
|
const o = e.get(s[0].ID);
|
|
3858
3858
|
n[i] = {
|
|
@@ -3900,7 +3900,7 @@ class Bs {
|
|
|
3900
3900
|
const u = this.interpolateRotations(t.x, t.y, t.z, s);
|
|
3901
3901
|
o = u[0], a = u[1];
|
|
3902
3902
|
}
|
|
3903
|
-
const l =
|
|
3903
|
+
const l = it(0);
|
|
3904
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]);
|
|
@@ -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
|
|
@@ -3985,11 +3985,11 @@ 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(
|
|
3990
|
-
const
|
|
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
|
+
const S = e.times[a - 1], k = e.times[a] - S, 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(S + E * k), M.setFromQuaternion(A, i), o.push(M.x), o.push(M.y), o.push(M.z);
|
|
3993
3993
|
} else
|
|
3994
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
|
}
|
|
@@ -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
|
|
4378
|
-
|
|
4377
|
+
const L = p.preRotation.map(Q.degToRad);
|
|
4378
|
+
L.push(m), t.makeRotationFromEuler(St.fromArray(L));
|
|
4379
4379
|
}
|
|
4380
4380
|
if (p.rotation) {
|
|
4381
|
-
const
|
|
4382
|
-
|
|
4381
|
+
const L = p.rotation.map(Q.degToRad);
|
|
4382
|
+
L.push(p.eulerOrder || m), n.makeRotationFromEuler(St.fromArray(L));
|
|
4383
4383
|
}
|
|
4384
4384
|
if (p.postRotation) {
|
|
4385
|
-
const
|
|
4386
|
-
|
|
4385
|
+
const L = p.postRotation.map(Q.degToRad);
|
|
4386
|
+
L.push(m), i.makeRotationFromEuler(St.fromArray(L)), 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), S = s, k = new G();
|
|
4394
4394
|
if (d === 0)
|
|
4395
|
-
k.copy(
|
|
4395
|
+
k.copy(f).multiply(y).multiply(g).multiply(S);
|
|
4396
4396
|
else if (d === 1)
|
|
4397
|
-
k.copy(
|
|
4397
|
+
k.copy(f).multiply(g).multiply(y).multiply(S);
|
|
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(), w = g.clone().multiply(v);
|
|
4400
|
+
k.copy(f).multiply(y).multiply(w).multiply(S);
|
|
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
|
-
},
|
|
7161
|
+
}, X = 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) {
|
|
@@ -8905,7 +8905,7 @@ class Fn {
|
|
|
8905
8905
|
if (t.x === 0 && t.y === 0 && t.z === 0) continue;
|
|
8906
8906
|
O.set(t.x, t.y, t.z);
|
|
8907
8907
|
const n = this.poseAvatar.props[e];
|
|
8908
|
-
n.isQuaternion ? (
|
|
8908
|
+
n.isQuaternion ? (X.setFromEuler(O), n.multiply(X)) : n.isVector3 && n.add(O);
|
|
8909
8909
|
}
|
|
8910
8910
|
}
|
|
8911
8911
|
/**
|
|
@@ -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-Ceym4Gbp.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 && (
|
|
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 && (X.setFromAxisAngle(po, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(X)), 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
|
|
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 S = y[f].match(l), k = y[f].match(o);
|
|
9786
|
+
if (g && !b && !S && 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,15 +9809,15 @@ 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
|
|
9816
9816
|
};
|
|
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
|
-
if (
|
|
9820
|
-
let A = this.animEmojis[y[
|
|
9819
|
+
if (S) {
|
|
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((S) => S.name.includes(h) || S.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
|
|
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 S = 0; S < f.visemes.length; S++) {
|
|
10018
|
+
const k = f.visemes[S], A = f.times[S] / g, M = f.durations[S] / 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,16 +10577,16 @@ 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), X.copy(this.armature.quaternion), X.multiply(this.poseTarget.props["Hips.quaternion"]), X.multiply(this.poseTarget.props["Spine.quaternion"]), X.multiply(this.poseTarget.props["Spine1.quaternion"]), X.multiply(this.poseTarget.props["Spine2.quaternion"]), X.multiply(this.poseTarget.props["Neck.quaternion"]), X.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
|
-
const a = new R.Quaternion().setFromEuler(O), l = new R.Quaternion().copy(a).multiply(
|
|
10583
|
+
const a = new R.Quaternion().setFromEuler(O), l = new R.Quaternion().copy(a).multiply(X.clone().invert());
|
|
10584
10584
|
O.setFromQuaternion(l, "YXZ");
|
|
10585
10585
|
let r = O.x / (40 / 24) + 0.2, c = O.y / (9 / 4), h = Math.min(0.6, Math.max(-0.3, r)), u = Math.min(0.8, Math.max(-0.8, c)), d = (Math.random() - 0.5) / 4, m = (Math.random() - 0.5) / 4;
|
|
10586
10586
|
if (e) {
|
|
10587
10587
|
let y = this.animQueue.findIndex((b) => b.template.name === "lookat");
|
|
10588
10588
|
y !== -1 && this.animQueue.splice(y, 1);
|
|
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
|
/**
|
|
@@ -10617,21 +10617,21 @@ class Fn {
|
|
|
10617
10617
|
const s = new R.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), o = new R.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), a = new R.Vector3().addVectors(s, o).divideScalar(2);
|
|
10618
10618
|
a.project(this.camera);
|
|
10619
10619
|
let l = (a.x + 1) / 2 * i.width + i.left, r = -(a.y - 1) / 2 * i.height + i.top;
|
|
10620
|
-
e === null && (e = l), t === null && (t = r),
|
|
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,
|
|
10620
|
+
e === null && (e = l), t === null && (t = r), X.copy(this.armature.quaternion), X.multiply(this.poseTarget.props["Hips.quaternion"]), X.multiply(this.poseTarget.props["Spine.quaternion"]), X.multiply(this.poseTarget.props["Spine1.quaternion"]), X.multiply(this.poseTarget.props["Spine2.quaternion"]), X.multiply(this.poseTarget.props["Neck.quaternion"]), X.multiply(this.poseTarget.props["Head.quaternion"]), O.setFromQuaternion(X);
|
|
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
|
-
let
|
|
10626
|
-
|
|
10625
|
+
let S = this.animQueue.findIndex((A) => A.template.name === "lookat");
|
|
10626
|
+
S !== -1 && this.animQueue.splice(S, 1);
|
|
10627
10627
|
const k = {
|
|
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, S = y.length; g < S; 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(), X.setFromAxisAngle(h, A), k.quaternion.multiply(X), 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,214 +11095,219 @@ 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), [S, k] = Be(!0), [A, M] = Be(null), [E, D] = Be(!1), U = Ut(), L = i || U.service;
|
|
11101
11101
|
let v;
|
|
11102
|
-
|
|
11102
|
+
L === "browser" ? v = {
|
|
11103
11103
|
service: "browser",
|
|
11104
11104
|
endpoint: "",
|
|
11105
11105
|
apiKey: null,
|
|
11106
11106
|
defaultVoice: "Google US English"
|
|
11107
|
-
} :
|
|
11107
|
+
} : L === "elevenlabs" ? v = {
|
|
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 w = {
|
|
11119
11119
|
url: p,
|
|
11120
11120
|
body: e,
|
|
11121
11121
|
avatarMood: t,
|
|
11122
|
-
ttsLang:
|
|
11122
|
+
ttsLang: L === "browser" ? "en-US" : n,
|
|
11123
11123
|
ttsVoice: s || v.defaultVoice,
|
|
11124
11124
|
lipsyncLang: "en",
|
|
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
|
-
ttsService:
|
|
11131
|
+
ttsService: L,
|
|
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(w, (W) => {
|
|
11138
|
+
if (W.lengthComputable) {
|
|
11139
|
+
const te = Math.min(100, Math.round(W.loaded / W.total * 100));
|
|
11140
|
+
u(te);
|
|
11141
11141
|
}
|
|
11142
|
-
}), await new Promise((
|
|
11143
|
-
const
|
|
11144
|
-
|
|
11142
|
+
}), await new Promise((W) => {
|
|
11143
|
+
const te = () => {
|
|
11144
|
+
g.current.lipsync && Object.keys(g.current.lipsync).length > 0 ? W() : 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 (W) {
|
|
11151
|
+
console.warn("Error setting full body mode on initialization:", W);
|
|
11152
11152
|
}
|
|
11153
|
-
|
|
11154
|
-
const
|
|
11155
|
-
document.visibilityState === "visible" ?
|
|
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
|
+
const Y = () => {
|
|
11155
|
+
document.visibilityState === "visible" ? g.current?.start() : g.current?.stop();
|
|
11156
11156
|
};
|
|
11157
|
-
return document.addEventListener("visibilitychange",
|
|
11158
|
-
document.removeEventListener("visibilitychange",
|
|
11157
|
+
return document.addEventListener("visibilitychange", Y), () => {
|
|
11158
|
+
document.removeEventListener("visibilitychange", Y);
|
|
11159
11159
|
};
|
|
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((W) => {
|
|
11169
|
+
for (const te of W)
|
|
11170
|
+
g.current && g.current.onResize && g.current.onResize();
|
|
11171
11171
|
});
|
|
11172
11172
|
C.observe(I.current);
|
|
11173
|
-
const
|
|
11174
|
-
|
|
11173
|
+
const Y = () => {
|
|
11174
|
+
g.current && g.current.onResize && g.current.onResize();
|
|
11175
11175
|
};
|
|
11176
|
-
return window.addEventListener("resize",
|
|
11177
|
-
C.disconnect(), window.removeEventListener("resize",
|
|
11176
|
+
return window.addEventListener("resize", Y), () => {
|
|
11177
|
+
C.disconnect(), window.removeEventListener("resize", Y);
|
|
11178
11178
|
};
|
|
11179
11179
|
}, [E]);
|
|
11180
|
-
const
|
|
11181
|
-
if (
|
|
11180
|
+
const K = B(async () => {
|
|
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, Y = {}) => {
|
|
11188
|
+
if (g.current && E)
|
|
11189
11189
|
try {
|
|
11190
|
-
await
|
|
11191
|
-
|
|
11190
|
+
await K();
|
|
11191
|
+
const W = {
|
|
11192
|
+
...Y,
|
|
11193
|
+
lipsyncLang: Y.lipsyncLang || w.lipsyncLang || "en"
|
|
11194
|
+
};
|
|
11195
|
+
g.current.lipsync && Object.keys(g.current.lipsync).length > 0 ? (g.current.setSlowdownRate && g.current.setSlowdownRate(1.05), g.current.speakText(C, W)) : setTimeout(async () => {
|
|
11196
|
+
await K(), g.current && g.current.lipsync && (g.current.setSlowdownRate && g.current.setSlowdownRate(1.05), g.current.speakText(C, W));
|
|
11192
11197
|
}, 500);
|
|
11193
|
-
} catch (
|
|
11194
|
-
console.error("Error speaking text:",
|
|
11198
|
+
} catch (W) {
|
|
11199
|
+
console.error("Error speaking text:", W), M(W.message || "Failed to speak text");
|
|
11195
11200
|
}
|
|
11196
|
-
}, [E,
|
|
11197
|
-
|
|
11198
|
-
}, []),
|
|
11199
|
-
|
|
11201
|
+
}, [E, K, w.lipsyncLang]), Me = B(() => {
|
|
11202
|
+
g.current && (g.current.stopSpeaking(), g.current.setSlowdownRate && g.current.setSlowdownRate(1));
|
|
11203
|
+
}, []), fe = B((C) => {
|
|
11204
|
+
g.current && g.current.setMood(C);
|
|
11200
11205
|
}, []), ft = B((C) => {
|
|
11201
|
-
|
|
11202
|
-
}, []), gt = B((C,
|
|
11203
|
-
if (
|
|
11204
|
-
if (
|
|
11206
|
+
g.current && g.current.setSlowdownRate && g.current.setSlowdownRate(C);
|
|
11207
|
+
}, []), gt = B((C, Y = !1) => {
|
|
11208
|
+
if (g.current && g.current.playAnimation) {
|
|
11209
|
+
if (f && f[C] && (C = f[C]), g.current.setShowFullAvatar)
|
|
11205
11210
|
try {
|
|
11206
|
-
|
|
11207
|
-
} catch (
|
|
11208
|
-
console.warn("Error setting full body mode:",
|
|
11211
|
+
g.current.setShowFullAvatar(!0);
|
|
11212
|
+
} catch (te) {
|
|
11213
|
+
console.warn("Error setting full body mode:", te);
|
|
11209
11214
|
}
|
|
11210
11215
|
if (C.includes("."))
|
|
11211
11216
|
try {
|
|
11212
|
-
|
|
11213
|
-
} catch (
|
|
11214
|
-
console.warn(`Failed to play ${C}:`,
|
|
11217
|
+
g.current.playAnimation(C, null, 10, 0, 0.01, Y);
|
|
11218
|
+
} catch (te) {
|
|
11219
|
+
console.warn(`Failed to play ${C}:`, te);
|
|
11215
11220
|
try {
|
|
11216
|
-
|
|
11217
|
-
} catch (
|
|
11218
|
-
console.warn("Fallback animation also failed:",
|
|
11221
|
+
g.current.setBodyMovement("idle");
|
|
11222
|
+
} catch (Ie) {
|
|
11223
|
+
console.warn("Fallback animation also failed:", Ie);
|
|
11219
11224
|
}
|
|
11220
11225
|
}
|
|
11221
11226
|
else {
|
|
11222
|
-
const
|
|
11223
|
-
let
|
|
11224
|
-
for (const
|
|
11227
|
+
const te = [".fbx", ".glb", ".gltf"];
|
|
11228
|
+
let Ie = !1;
|
|
11229
|
+
for (const He of te)
|
|
11225
11230
|
try {
|
|
11226
|
-
|
|
11231
|
+
g.current.playAnimation(C + He, null, 10, 0, 0.01, Y), Ie = !0;
|
|
11227
11232
|
break;
|
|
11228
11233
|
} catch {
|
|
11229
11234
|
}
|
|
11230
|
-
if (!
|
|
11235
|
+
if (!Ie) {
|
|
11231
11236
|
console.warn("Animation not found:", C);
|
|
11232
11237
|
try {
|
|
11233
|
-
|
|
11234
|
-
} catch (
|
|
11235
|
-
console.warn("Fallback animation also failed:",
|
|
11238
|
+
g.current.setBodyMovement("idle");
|
|
11239
|
+
} catch (He) {
|
|
11240
|
+
console.warn("Fallback animation also failed:", He);
|
|
11236
11241
|
}
|
|
11237
11242
|
}
|
|
11238
11243
|
}
|
|
11239
11244
|
}
|
|
11240
|
-
}, [
|
|
11241
|
-
|
|
11245
|
+
}, [f]), We = B(() => {
|
|
11246
|
+
g.current && g.current.onResize && g.current.onResize();
|
|
11242
11247
|
}, []);
|
|
11243
11248
|
return Nt(b, () => ({
|
|
11244
|
-
speakText:
|
|
11245
|
-
stopSpeaking:
|
|
11246
|
-
resumeAudioContext:
|
|
11247
|
-
setMood:
|
|
11249
|
+
speakText: ue,
|
|
11250
|
+
stopSpeaking: Me,
|
|
11251
|
+
resumeAudioContext: K,
|
|
11252
|
+
setMood: fe,
|
|
11248
11253
|
setTimingAdjustment: ft,
|
|
11249
11254
|
playAnimation: gt,
|
|
11250
11255
|
isReady: E,
|
|
11251
|
-
talkingHead:
|
|
11252
|
-
handleResize:
|
|
11256
|
+
talkingHead: g.current,
|
|
11257
|
+
handleResize: We,
|
|
11253
11258
|
setBodyMovement: (C) => {
|
|
11254
|
-
if (
|
|
11259
|
+
if (g.current && g.current.setShowFullAvatar && g.current.setBodyMovement)
|
|
11255
11260
|
try {
|
|
11256
|
-
|
|
11257
|
-
} catch (
|
|
11258
|
-
console.warn("Error setting body movement:",
|
|
11261
|
+
g.current.setShowFullAvatar(!0), g.current.setBodyMovement(C);
|
|
11262
|
+
} catch (Y) {
|
|
11263
|
+
console.warn("Error setting body movement:", Y);
|
|
11259
11264
|
}
|
|
11260
11265
|
},
|
|
11261
|
-
setMovementIntensity: (C) =>
|
|
11266
|
+
setMovementIntensity: (C) => g.current?.setMovementIntensity(C),
|
|
11262
11267
|
playRandomDance: () => {
|
|
11263
|
-
if (
|
|
11268
|
+
if (g.current && g.current.setShowFullAvatar && g.current.playRandomDance)
|
|
11264
11269
|
try {
|
|
11265
|
-
|
|
11270
|
+
g.current.setShowFullAvatar(!0), g.current.playRandomDance();
|
|
11266
11271
|
} catch (C) {
|
|
11267
11272
|
console.warn("Error playing random dance:", C);
|
|
11268
11273
|
}
|
|
11269
11274
|
},
|
|
11270
11275
|
playReaction: (C) => {
|
|
11271
|
-
if (
|
|
11276
|
+
if (g.current && g.current.setShowFullAvatar && g.current.playReaction)
|
|
11272
11277
|
try {
|
|
11273
|
-
|
|
11274
|
-
} catch (
|
|
11275
|
-
console.warn("Error playing reaction:",
|
|
11278
|
+
g.current.setShowFullAvatar(!0), g.current.playReaction(C);
|
|
11279
|
+
} catch (Y) {
|
|
11280
|
+
console.warn("Error playing reaction:", Y);
|
|
11276
11281
|
}
|
|
11277
11282
|
},
|
|
11278
11283
|
playCelebration: () => {
|
|
11279
|
-
if (
|
|
11284
|
+
if (g.current && g.current.setShowFullAvatar && g.current.playCelebration)
|
|
11280
11285
|
try {
|
|
11281
|
-
|
|
11286
|
+
g.current.setShowFullAvatar(!0), g.current.playCelebration();
|
|
11282
11287
|
} catch (C) {
|
|
11283
11288
|
console.warn("Error playing celebration:", C);
|
|
11284
11289
|
}
|
|
11285
11290
|
},
|
|
11286
11291
|
setShowFullAvatar: (C) => {
|
|
11287
|
-
if (
|
|
11292
|
+
if (g.current && g.current.setShowFullAvatar)
|
|
11288
11293
|
try {
|
|
11289
|
-
|
|
11290
|
-
} catch (
|
|
11291
|
-
console.warn("Error setting showFullAvatar:",
|
|
11294
|
+
g.current.setShowFullAvatar(C);
|
|
11295
|
+
} catch (Y) {
|
|
11296
|
+
console.warn("Error setting showFullAvatar:", Y);
|
|
11292
11297
|
}
|
|
11293
11298
|
},
|
|
11294
11299
|
lockAvatarPosition: () => {
|
|
11295
|
-
if (
|
|
11300
|
+
if (g.current && g.current.lockAvatarPosition)
|
|
11296
11301
|
try {
|
|
11297
|
-
|
|
11302
|
+
g.current.lockAvatarPosition();
|
|
11298
11303
|
} catch (C) {
|
|
11299
11304
|
console.warn("Error locking avatar position:", C);
|
|
11300
11305
|
}
|
|
11301
11306
|
},
|
|
11302
11307
|
unlockAvatarPosition: () => {
|
|
11303
|
-
if (
|
|
11308
|
+
if (g.current && g.current.unlockAvatarPosition)
|
|
11304
11309
|
try {
|
|
11305
|
-
|
|
11310
|
+
g.current.unlockAvatarPosition();
|
|
11306
11311
|
} catch (C) {
|
|
11307
11312
|
console.warn("Error unlocking avatar position:", C);
|
|
11308
11313
|
}
|
|
@@ -11318,7 +11323,7 @@ const Dn = _t(({
|
|
|
11318
11323
|
...y
|
|
11319
11324
|
},
|
|
11320
11325
|
children: [
|
|
11321
|
-
/* @__PURE__ */
|
|
11326
|
+
/* @__PURE__ */ Te(
|
|
11322
11327
|
"div",
|
|
11323
11328
|
{
|
|
11324
11329
|
ref: I,
|
|
@@ -11330,7 +11335,7 @@ const Dn = _t(({
|
|
|
11330
11335
|
}
|
|
11331
11336
|
}
|
|
11332
11337
|
),
|
|
11333
|
-
|
|
11338
|
+
S && /* @__PURE__ */ Te("div", { className: "loading-overlay", style: {
|
|
11334
11339
|
position: "absolute",
|
|
11335
11340
|
top: "50%",
|
|
11336
11341
|
left: "50%",
|
|
@@ -11339,7 +11344,7 @@ const Dn = _t(({
|
|
|
11339
11344
|
fontSize: "18px",
|
|
11340
11345
|
zIndex: 10
|
|
11341
11346
|
}, children: "Loading avatar..." }),
|
|
11342
|
-
A && /* @__PURE__ */
|
|
11347
|
+
A && /* @__PURE__ */ Te("div", { className: "error-overlay", style: {
|
|
11343
11348
|
position: "absolute",
|
|
11344
11349
|
top: "50%",
|
|
11345
11350
|
left: "50%",
|
|
@@ -11368,17 +11373,17 @@ const mo = _t(({
|
|
|
11368
11373
|
style: s = {},
|
|
11369
11374
|
avatarConfig: o = {}
|
|
11370
11375
|
}, a) => {
|
|
11371
|
-
const l = ze(null), r = ze(null), [c, h] =
|
|
11376
|
+
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
11377
|
endpoint: "",
|
|
11373
11378
|
apiKey: null,
|
|
11374
11379
|
defaultVoice: "Google US English"
|
|
11375
11380
|
} : {
|
|
11376
|
-
...
|
|
11381
|
+
...f,
|
|
11377
11382
|
// Override API key if provided via avatarConfig
|
|
11378
|
-
apiKey: o.ttsApiKey !== void 0 && o.ttsApiKey !== null ? o.ttsApiKey :
|
|
11383
|
+
apiKey: o.ttsApiKey !== void 0 && o.ttsApiKey !== null ? o.ttsApiKey : f.apiKey,
|
|
11379
11384
|
// Override endpoint for ElevenLabs if service is explicitly set
|
|
11380
|
-
endpoint: b === "elevenlabs" && o.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" :
|
|
11381
|
-
},
|
|
11385
|
+
endpoint: b === "elevenlabs" && o.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" : f.endpoint
|
|
11386
|
+
}, g = {
|
|
11382
11387
|
url: "/avatars/brunette.glb",
|
|
11383
11388
|
// Use brunette avatar (working glTF file)
|
|
11384
11389
|
body: "F",
|
|
@@ -11392,7 +11397,7 @@ const mo = _t(({
|
|
|
11392
11397
|
bodyMovement: "idle",
|
|
11393
11398
|
movementIntensity: 0.5,
|
|
11394
11399
|
...o
|
|
11395
|
-
},
|
|
11400
|
+
}, S = {
|
|
11396
11401
|
ttsEndpoint: I.endpoint,
|
|
11397
11402
|
ttsApikey: I.apiKey,
|
|
11398
11403
|
ttsService: b,
|
|
@@ -11401,27 +11406,27 @@ const mo = _t(({
|
|
|
11401
11406
|
}, k = B(async () => {
|
|
11402
11407
|
if (!(!l.current || r.current))
|
|
11403
11408
|
try {
|
|
11404
|
-
if (h(!0), d(null), r.current = new Fn(l.current,
|
|
11405
|
-
if (
|
|
11406
|
-
const
|
|
11407
|
-
e(
|
|
11409
|
+
if (h(!0), d(null), r.current = new Fn(l.current, S), await r.current.showAvatar(g, (w) => {
|
|
11410
|
+
if (w.lengthComputable) {
|
|
11411
|
+
const F = Math.min(100, Math.round(w.loaded / w.total * 100));
|
|
11412
|
+
e(F);
|
|
11408
11413
|
}
|
|
11409
11414
|
}), 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:",
|
|
11415
|
+
const w = r.current.morphs[0].morphTargetDictionary;
|
|
11416
|
+
console.log("Available morph targets:", Object.keys(w));
|
|
11417
|
+
const F = Object.keys(w).filter((ie) => ie.startsWith("viseme_"));
|
|
11418
|
+
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
11419
|
}
|
|
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)),
|
|
11420
|
+
if (await new Promise((w) => {
|
|
11421
|
+
const F = () => {
|
|
11422
|
+
r.current.lipsync && Object.keys(r.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(r.current.lipsync)), w()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(F, 100));
|
|
11418
11423
|
};
|
|
11419
|
-
|
|
11424
|
+
F();
|
|
11420
11425
|
}), r.current && r.current.setShowFullAvatar)
|
|
11421
11426
|
try {
|
|
11422
11427
|
r.current.setShowFullAvatar(!0), console.log("Avatar initialized in full body mode");
|
|
11423
|
-
} catch (
|
|
11424
|
-
console.warn("Error setting full body mode on initialization:",
|
|
11428
|
+
} catch (w) {
|
|
11429
|
+
console.warn("Error setting full body mode on initialization:", w);
|
|
11425
11430
|
}
|
|
11426
11431
|
h(!1), y(!0), n(r.current);
|
|
11427
11432
|
const v = () => {
|
|
@@ -11430,100 +11435,100 @@ const mo = _t(({
|
|
|
11430
11435
|
return document.addEventListener("visibilitychange", v), () => {
|
|
11431
11436
|
document.removeEventListener("visibilitychange", v);
|
|
11432
11437
|
};
|
|
11433
|
-
} catch (
|
|
11434
|
-
console.error("Error initializing TalkingHead:",
|
|
11438
|
+
} catch (L) {
|
|
11439
|
+
console.error("Error initializing TalkingHead:", L), d(L.message || "Failed to initialize avatar"), h(!1), t(L);
|
|
11435
11440
|
}
|
|
11436
11441
|
}, []);
|
|
11437
11442
|
ut(() => (k(), () => {
|
|
11438
11443
|
r.current && (r.current.stop(), r.current.dispose(), r.current = null);
|
|
11439
11444
|
}), [k]);
|
|
11440
|
-
const A = B((
|
|
11445
|
+
const A = B((L) => {
|
|
11441
11446
|
if (r.current && m)
|
|
11442
11447
|
try {
|
|
11443
|
-
console.log("Speaking text:",
|
|
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(
|
|
11448
|
+
console.log("Speaking text:", L), 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(L)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
|
|
11449
|
+
r.current && r.current.lipsync ? (console.log("Lip-sync now ready, speaking..."), r.current.setSlowdownRate && (r.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), r.current.speakText(L)) : console.error("Lip-sync still not ready after waiting");
|
|
11445
11450
|
}, 500));
|
|
11446
11451
|
} catch (v) {
|
|
11447
11452
|
console.error("Error speaking text:", v), d(v.message || "Failed to speak text");
|
|
11448
11453
|
}
|
|
11449
11454
|
else
|
|
11450
11455
|
console.warn("Avatar not ready for speaking. isReady:", m, "talkingHeadRef:", !!r.current);
|
|
11451
|
-
}, [m,
|
|
11456
|
+
}, [m, g]), M = B(() => {
|
|
11452
11457
|
r.current && (r.current.stopSpeaking(), r.current.setSlowdownRate && (r.current.setSlowdownRate(1), console.log("Reset timing to normal")));
|
|
11453
|
-
}, []), E = B((
|
|
11454
|
-
r.current && r.current.setMood(
|
|
11455
|
-
}, []),
|
|
11456
|
-
r.current && r.current.setSlowdownRate && (r.current.setSlowdownRate(
|
|
11457
|
-
}, []), U = B((
|
|
11458
|
+
}, []), E = B((L) => {
|
|
11459
|
+
r.current && r.current.setMood(L);
|
|
11460
|
+
}, []), D = B((L) => {
|
|
11461
|
+
r.current && r.current.setSlowdownRate && (r.current.setSlowdownRate(L), console.log("Timing adjustment set to:", L));
|
|
11462
|
+
}, []), U = B((L, v = !1) => {
|
|
11458
11463
|
if (r.current && r.current.playAnimation) {
|
|
11459
11464
|
if (r.current.setShowFullAvatar)
|
|
11460
11465
|
try {
|
|
11461
11466
|
r.current.setShowFullAvatar(!0);
|
|
11462
|
-
} catch (
|
|
11463
|
-
console.warn("Error setting full body mode:",
|
|
11467
|
+
} catch (F) {
|
|
11468
|
+
console.warn("Error setting full body mode:", F);
|
|
11464
11469
|
}
|
|
11465
|
-
if (
|
|
11470
|
+
if (L.includes("."))
|
|
11466
11471
|
try {
|
|
11467
|
-
r.current.playAnimation(
|
|
11468
|
-
} catch (
|
|
11469
|
-
console.log(`Failed to play ${
|
|
11472
|
+
r.current.playAnimation(L, null, 10, 0, 0.01, v), console.log("Playing animation:", L);
|
|
11473
|
+
} catch (F) {
|
|
11474
|
+
console.log(`Failed to play ${L}:`, F);
|
|
11470
11475
|
try {
|
|
11471
11476
|
r.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
11472
|
-
} catch (
|
|
11473
|
-
console.warn("Fallback animation also failed:",
|
|
11477
|
+
} catch (ie) {
|
|
11478
|
+
console.warn("Fallback animation also failed:", ie);
|
|
11474
11479
|
}
|
|
11475
11480
|
}
|
|
11476
11481
|
else {
|
|
11477
|
-
const
|
|
11478
|
-
let
|
|
11479
|
-
for (const
|
|
11482
|
+
const F = [".fbx", ".glb", ".gltf"];
|
|
11483
|
+
let ie = !1;
|
|
11484
|
+
for (const K of F)
|
|
11480
11485
|
try {
|
|
11481
|
-
r.current.playAnimation(
|
|
11486
|
+
r.current.playAnimation(L + K, null, 10, 0, 0.01, v), console.log("Playing animation:", L + K), ie = !0;
|
|
11482
11487
|
break;
|
|
11483
11488
|
} catch {
|
|
11484
|
-
console.log(`Failed to play ${
|
|
11489
|
+
console.log(`Failed to play ${L}${K}, trying next format...`);
|
|
11485
11490
|
}
|
|
11486
|
-
if (!
|
|
11487
|
-
console.warn("Animation system not available or animation not found:",
|
|
11491
|
+
if (!ie) {
|
|
11492
|
+
console.warn("Animation system not available or animation not found:", L);
|
|
11488
11493
|
try {
|
|
11489
11494
|
r.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
11490
|
-
} catch (
|
|
11491
|
-
console.warn("Fallback animation also failed:",
|
|
11495
|
+
} catch (K) {
|
|
11496
|
+
console.warn("Fallback animation also failed:", K);
|
|
11492
11497
|
}
|
|
11493
11498
|
}
|
|
11494
11499
|
}
|
|
11495
11500
|
} else
|
|
11496
|
-
console.warn("Animation system not available or animation not found:",
|
|
11501
|
+
console.warn("Animation system not available or animation not found:", L);
|
|
11497
11502
|
}, []);
|
|
11498
11503
|
return Nt(a, () => ({
|
|
11499
11504
|
speakText: A,
|
|
11500
11505
|
stopSpeaking: M,
|
|
11501
11506
|
setMood: E,
|
|
11502
|
-
setTimingAdjustment:
|
|
11507
|
+
setTimingAdjustment: D,
|
|
11503
11508
|
playAnimation: U,
|
|
11504
11509
|
isReady: m,
|
|
11505
11510
|
talkingHead: r.current,
|
|
11506
|
-
setBodyMovement: (
|
|
11511
|
+
setBodyMovement: (L) => {
|
|
11507
11512
|
if (r.current && r.current.setShowFullAvatar && r.current.setBodyMovement)
|
|
11508
11513
|
try {
|
|
11509
|
-
r.current.setShowFullAvatar(!0), r.current.setBodyMovement(
|
|
11514
|
+
r.current.setShowFullAvatar(!0), r.current.setBodyMovement(L), console.log("Body movement set with full body mode:", L);
|
|
11510
11515
|
} catch (v) {
|
|
11511
11516
|
console.warn("Error setting body movement:", v);
|
|
11512
11517
|
}
|
|
11513
11518
|
},
|
|
11514
|
-
setMovementIntensity: (
|
|
11519
|
+
setMovementIntensity: (L) => r.current?.setMovementIntensity(L),
|
|
11515
11520
|
playRandomDance: () => {
|
|
11516
11521
|
if (r.current && r.current.setShowFullAvatar && r.current.playRandomDance)
|
|
11517
11522
|
try {
|
|
11518
11523
|
r.current.setShowFullAvatar(!0), r.current.playRandomDance(), console.log("Random dance played with full body mode");
|
|
11519
|
-
} catch (
|
|
11520
|
-
console.warn("Error playing random dance:",
|
|
11524
|
+
} catch (L) {
|
|
11525
|
+
console.warn("Error playing random dance:", L);
|
|
11521
11526
|
}
|
|
11522
11527
|
},
|
|
11523
|
-
playReaction: (
|
|
11528
|
+
playReaction: (L) => {
|
|
11524
11529
|
if (r.current && r.current.setShowFullAvatar && r.current.playReaction)
|
|
11525
11530
|
try {
|
|
11526
|
-
r.current.setShowFullAvatar(!0), r.current.playReaction(
|
|
11531
|
+
r.current.setShowFullAvatar(!0), r.current.playReaction(L), console.log("Reaction played with full body mode:", L);
|
|
11527
11532
|
} catch (v) {
|
|
11528
11533
|
console.warn("Error playing reaction:", v);
|
|
11529
11534
|
}
|
|
@@ -11532,14 +11537,14 @@ const mo = _t(({
|
|
|
11532
11537
|
if (r.current && r.current.setShowFullAvatar && r.current.playCelebration)
|
|
11533
11538
|
try {
|
|
11534
11539
|
r.current.setShowFullAvatar(!0), r.current.playCelebration(), console.log("Celebration played with full body mode");
|
|
11535
|
-
} catch (
|
|
11536
|
-
console.warn("Error playing celebration:",
|
|
11540
|
+
} catch (L) {
|
|
11541
|
+
console.warn("Error playing celebration:", L);
|
|
11537
11542
|
}
|
|
11538
11543
|
},
|
|
11539
|
-
setShowFullAvatar: (
|
|
11544
|
+
setShowFullAvatar: (L) => {
|
|
11540
11545
|
if (r.current && r.current.setShowFullAvatar)
|
|
11541
11546
|
try {
|
|
11542
|
-
r.current.setShowFullAvatar(
|
|
11547
|
+
r.current.setShowFullAvatar(L), console.log("Show full avatar set to:", L);
|
|
11543
11548
|
} catch (v) {
|
|
11544
11549
|
console.warn("Error setting showFullAvatar:", v);
|
|
11545
11550
|
}
|
|
@@ -11548,20 +11553,20 @@ const mo = _t(({
|
|
|
11548
11553
|
if (r.current && r.current.lockAvatarPosition)
|
|
11549
11554
|
try {
|
|
11550
11555
|
r.current.lockAvatarPosition();
|
|
11551
|
-
} catch (
|
|
11552
|
-
console.warn("Error locking avatar position:",
|
|
11556
|
+
} catch (L) {
|
|
11557
|
+
console.warn("Error locking avatar position:", L);
|
|
11553
11558
|
}
|
|
11554
11559
|
},
|
|
11555
11560
|
unlockAvatarPosition: () => {
|
|
11556
11561
|
if (r.current && r.current.unlockAvatarPosition)
|
|
11557
11562
|
try {
|
|
11558
11563
|
r.current.unlockAvatarPosition();
|
|
11559
|
-
} catch (
|
|
11560
|
-
console.warn("Error unlocking avatar position:",
|
|
11564
|
+
} catch (L) {
|
|
11565
|
+
console.warn("Error unlocking avatar position:", L);
|
|
11561
11566
|
}
|
|
11562
11567
|
}
|
|
11563
11568
|
})), /* @__PURE__ */ an("div", { className: `talking-head-container ${i}`, style: s, children: [
|
|
11564
|
-
/* @__PURE__ */
|
|
11569
|
+
/* @__PURE__ */ Te(
|
|
11565
11570
|
"div",
|
|
11566
11571
|
{
|
|
11567
11572
|
ref: l,
|
|
@@ -11573,7 +11578,7 @@ const mo = _t(({
|
|
|
11573
11578
|
}
|
|
11574
11579
|
}
|
|
11575
11580
|
),
|
|
11576
|
-
c && /* @__PURE__ */
|
|
11581
|
+
c && /* @__PURE__ */ Te("div", { className: "loading-overlay", style: {
|
|
11577
11582
|
position: "absolute",
|
|
11578
11583
|
top: "50%",
|
|
11579
11584
|
left: "50%",
|
|
@@ -11582,7 +11587,7 @@ const mo = _t(({
|
|
|
11582
11587
|
fontSize: "18px",
|
|
11583
11588
|
zIndex: 10
|
|
11584
11589
|
}, children: "Loading avatar..." }),
|
|
11585
|
-
u && /* @__PURE__ */
|
|
11590
|
+
u && /* @__PURE__ */ Te("div", { className: "error-overlay", style: {
|
|
11586
11591
|
position: "absolute",
|
|
11587
11592
|
top: "50%",
|
|
11588
11593
|
left: "50%",
|
|
@@ -11657,12 +11662,14 @@ const fo = _t(({
|
|
|
11657
11662
|
bodyMovement: e.bodyMovement || "gesturing",
|
|
11658
11663
|
movementIntensity: e.movementIntensity || 0.7,
|
|
11659
11664
|
showFullAvatar: e.showFullAvatar !== void 0 ? e.showFullAvatar : !0,
|
|
11660
|
-
animations: t
|
|
11661
|
-
|
|
11665
|
+
animations: t,
|
|
11666
|
+
lipsyncLang: "en"
|
|
11667
|
+
// Default lipsync language
|
|
11668
|
+
}, y = B(() => d.modules[h.current.currentModuleIndex]?.lessons[h.current.currentLessonIndex], [d]), f = B(() => y()?.questions[h.current.currentQuestionIndex], [y]), b = B((v, w) => w.type === "multiple_choice" || w.type === "true_false" ? v === w.answer : w.type === "code_test" && typeof v == "object" && v !== null ? v.passed === !0 : !1, []), I = B(() => {
|
|
11662
11669
|
h.current.lessonCompleted = !0, h.current.isQuestionMode = !1;
|
|
11663
11670
|
const v = Math.round(h.current.score / h.current.totalQuestions * 100);
|
|
11664
|
-
let
|
|
11665
|
-
if (v >= 80 ?
|
|
11671
|
+
let w = `Congratulations! You've completed this lesson with a score of ${h.current.score} out of ${h.current.totalQuestions} (${v}%). `;
|
|
11672
|
+
if (v >= 80 ? w += "Excellent work! You have a great understanding of this topic." : v >= 60 ? w += "Good job! You understand most of the concepts." : w += "Keep practicing! You're making progress.", u.current.onLessonComplete({
|
|
11666
11673
|
moduleIndex: h.current.currentModuleIndex,
|
|
11667
11674
|
lessonIndex: h.current.currentLessonIndex,
|
|
11668
11675
|
score: h.current.score,
|
|
@@ -11675,12 +11682,12 @@ const fo = _t(({
|
|
|
11675
11682
|
} catch {
|
|
11676
11683
|
c.current.playCelebration();
|
|
11677
11684
|
}
|
|
11678
|
-
c.current.speakText(
|
|
11685
|
+
c.current.speakText(w, { lipsyncLang: m.lipsyncLang });
|
|
11679
11686
|
}
|
|
11680
|
-
}, [t.lessonComplete]),
|
|
11687
|
+
}, [t.lessonComplete, m]), g = B(() => {
|
|
11681
11688
|
if (h.current.curriculumCompleted = !0, u.current.onCurriculumComplete({
|
|
11682
11689
|
modules: d.modules.length,
|
|
11683
|
-
totalLessons: d.modules.reduce((v,
|
|
11690
|
+
totalLessons: d.modules.reduce((v, w) => v + w.lessons.length, 0)
|
|
11684
11691
|
}), c.current) {
|
|
11685
11692
|
if (c.current.setMood("celebrating"), t.curriculumComplete)
|
|
11686
11693
|
try {
|
|
@@ -11688,58 +11695,65 @@ const fo = _t(({
|
|
|
11688
11695
|
} catch {
|
|
11689
11696
|
c.current.playCelebration();
|
|
11690
11697
|
}
|
|
11691
|
-
c.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!");
|
|
11698
|
+
c.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang: m.lipsyncLang });
|
|
11692
11699
|
}
|
|
11693
|
-
}, [t.curriculumComplete, d]),
|
|
11700
|
+
}, [t.curriculumComplete, d, m]), S = B(() => {
|
|
11694
11701
|
const v = y();
|
|
11695
|
-
|
|
11702
|
+
h.current.isQuestionMode = !0, h.current.currentQuestionIndex = 0, h.current.totalQuestions = v?.questions?.length || 0;
|
|
11703
|
+
const w = f();
|
|
11704
|
+
if (u.current.onCustomAction({
|
|
11705
|
+
type: "questionStart",
|
|
11706
|
+
moduleIndex: h.current.currentModuleIndex,
|
|
11707
|
+
lessonIndex: h.current.currentLessonIndex,
|
|
11708
|
+
totalQuestions: h.current.totalQuestions,
|
|
11709
|
+
question: w
|
|
11710
|
+
// Include first question in event
|
|
11711
|
+
}), c.current) {
|
|
11696
11712
|
if (c.current.setMood("curious"), t.questionStart)
|
|
11697
11713
|
try {
|
|
11698
11714
|
c.current.playAnimation(t.questionStart, !0);
|
|
11699
|
-
} catch (
|
|
11700
|
-
console.warn("Failed to play questionStart animation:",
|
|
11715
|
+
} catch (F) {
|
|
11716
|
+
console.warn("Failed to play questionStart animation:", F);
|
|
11701
11717
|
}
|
|
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
|
-
});
|
|
11718
|
+
w ? w.type === "code_test" ? c.current.speakText(`Let's test your coding skills! Here's your first challenge: ${w.question}`, { lipsyncLang: m.lipsyncLang }) : c.current.speakText(`Now let me ask you some questions. Here's the first one: ${w.question}`, { lipsyncLang: m.lipsyncLang }) : c.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: m.lipsyncLang });
|
|
11708
11719
|
}
|
|
11709
|
-
}, [t.questionStart, y]), k = B(() => {
|
|
11720
|
+
}, [t.questionStart, y, f, m]), k = B(() => {
|
|
11710
11721
|
const v = y();
|
|
11711
11722
|
if (h.current.currentQuestionIndex < (v?.questions?.length || 0) - 1) {
|
|
11712
|
-
|
|
11723
|
+
h.current.currentQuestionIndex += 1;
|
|
11724
|
+
const w = f();
|
|
11725
|
+
if (u.current.onCustomAction({
|
|
11726
|
+
type: "nextQuestion",
|
|
11727
|
+
moduleIndex: h.current.currentModuleIndex,
|
|
11728
|
+
lessonIndex: h.current.currentLessonIndex,
|
|
11729
|
+
questionIndex: h.current.currentQuestionIndex,
|
|
11730
|
+
question: w
|
|
11731
|
+
}), c.current) {
|
|
11713
11732
|
if (c.current.setMood("happy"), c.current.setBodyMovement("idle"), t.nextQuestion)
|
|
11714
11733
|
try {
|
|
11715
11734
|
c.current.playAnimation(t.nextQuestion, !0);
|
|
11716
|
-
} catch (
|
|
11717
|
-
console.warn("Failed to play nextQuestion animation:",
|
|
11735
|
+
} catch (F) {
|
|
11736
|
+
console.warn("Failed to play nextQuestion animation:", F);
|
|
11718
11737
|
}
|
|
11719
|
-
c.current.speakText(
|
|
11720
|
-
type: "nextQuestion",
|
|
11721
|
-
moduleIndex: h.current.currentModuleIndex,
|
|
11722
|
-
lessonIndex: h.current.currentLessonIndex,
|
|
11723
|
-
questionIndex: h.current.currentQuestionIndex
|
|
11724
|
-
});
|
|
11738
|
+
w ? w.type === "code_test" ? c.current.speakText(`Here's your next coding challenge: ${w.question}`, { lipsyncLang: m.lipsyncLang }) : c.current.speakText(`Here's the next question: ${w.question}`, { lipsyncLang: m.lipsyncLang }) : c.current.speakText("Here's the next question.", { lipsyncLang: m.lipsyncLang });
|
|
11725
11739
|
}
|
|
11726
11740
|
} else
|
|
11727
11741
|
I();
|
|
11728
|
-
}, [t.nextQuestion, y, I]), A = B(() => {
|
|
11742
|
+
}, [t.nextQuestion, y, I, f, m]), A = B(() => {
|
|
11729
11743
|
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,
|
|
11744
|
+
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!", { lipsyncLang: m.lipsyncLang })) : g();
|
|
11745
|
+
}, [d, g, m]), M = B(() => {
|
|
11732
11746
|
const v = y();
|
|
11733
11747
|
if (c.current && c.current.isReady && v?.avatar_script) {
|
|
11734
11748
|
h.current.isTeaching = !0, h.current.isQuestionMode = !1, c.current.setMood("happy");
|
|
11735
|
-
let
|
|
11749
|
+
let w = !1;
|
|
11736
11750
|
if (t.teaching)
|
|
11737
11751
|
try {
|
|
11738
|
-
c.current.playAnimation(t.teaching, !0),
|
|
11739
|
-
} catch (
|
|
11740
|
-
console.warn("Failed to play teaching animation:",
|
|
11752
|
+
c.current.playAnimation(t.teaching, !0), w = !0;
|
|
11753
|
+
} catch (F) {
|
|
11754
|
+
console.warn("Failed to play teaching animation:", F);
|
|
11741
11755
|
}
|
|
11742
|
-
|
|
11756
|
+
w || c.current.setBodyMovement("gesturing"), c.current.speakText(v.avatar_script, { lipsyncLang: m.lipsyncLang }), u.current.onLessonStart({
|
|
11743
11757
|
moduleIndex: h.current.currentModuleIndex,
|
|
11744
11758
|
lessonIndex: h.current.currentLessonIndex,
|
|
11745
11759
|
lesson: v
|
|
@@ -11749,20 +11763,20 @@ const fo = _t(({
|
|
|
11749
11763
|
lessonIndex: h.current.currentLessonIndex,
|
|
11750
11764
|
lesson: v
|
|
11751
11765
|
}), setTimeout(() => {
|
|
11752
|
-
h.current.isTeaching = !1, v.questions && v.questions.length > 0 ?
|
|
11766
|
+
h.current.isTeaching = !1, v.questions && v.questions.length > 0 ? S() : I();
|
|
11753
11767
|
}, 8e3);
|
|
11754
11768
|
}
|
|
11755
|
-
}, [t.teaching, y,
|
|
11756
|
-
const
|
|
11757
|
-
if (
|
|
11769
|
+
}, [t.teaching, y, S, I, m]), E = B((v) => {
|
|
11770
|
+
const w = f(), F = b(v, w);
|
|
11771
|
+
if (F && (h.current.score += 1), u.current.onQuestionAnswer({
|
|
11758
11772
|
moduleIndex: h.current.currentModuleIndex,
|
|
11759
11773
|
lessonIndex: h.current.currentLessonIndex,
|
|
11760
11774
|
questionIndex: h.current.currentQuestionIndex,
|
|
11761
11775
|
answer: v,
|
|
11762
|
-
isCorrect:
|
|
11763
|
-
question:
|
|
11764
|
-
}), c.current)
|
|
11765
|
-
if (
|
|
11776
|
+
isCorrect: F,
|
|
11777
|
+
question: w
|
|
11778
|
+
}), c.current) {
|
|
11779
|
+
if (F) {
|
|
11766
11780
|
if (c.current.setMood("happy"), t.correct)
|
|
11767
11781
|
try {
|
|
11768
11782
|
c.current.playReaction("happy");
|
|
@@ -11770,8 +11784,8 @@ const fo = _t(({
|
|
|
11770
11784
|
c.current.setBodyMovement("happy");
|
|
11771
11785
|
}
|
|
11772
11786
|
c.current.setBodyMovement("gesturing");
|
|
11773
|
-
const
|
|
11774
|
-
c.current.speakText(
|
|
11787
|
+
const ue = w.type === "code_test" ? `Great job! Your code passed all the tests! ${w.explanation || ""}` : `Excellent! That's correct! ${w.explanation || ""}`;
|
|
11788
|
+
c.current.speakText(ue, { lipsyncLang: m.lipsyncLang });
|
|
11775
11789
|
} else {
|
|
11776
11790
|
if (c.current.setMood("sad"), t.incorrect)
|
|
11777
11791
|
try {
|
|
@@ -11780,20 +11794,26 @@ const fo = _t(({
|
|
|
11780
11794
|
c.current.setBodyMovement("idle");
|
|
11781
11795
|
}
|
|
11782
11796
|
c.current.setBodyMovement("gesturing");
|
|
11783
|
-
const
|
|
11784
|
-
c.current.speakText(
|
|
11797
|
+
const ue = w.type === "code_test" ? `Your code didn't pass all the tests. ${w.explanation || "Try again!"}` : `Not quite right, but don't worry! ${w.explanation || ""} Let's move on to the next question.`;
|
|
11798
|
+
c.current.speakText(ue, { lipsyncLang: m.lipsyncLang });
|
|
11785
11799
|
}
|
|
11786
|
-
|
|
11787
|
-
|
|
11800
|
+
const ie = (F ? w.type === "code_test" ? `Great job! Your code passed all the tests! ${w.explanation || ""}` : `Excellent! That's correct! ${w.explanation || ""}` : w.type === "code_test" ? `Your code didn't pass all the tests. ${w.explanation || "Try again!"}` : `Not quite right, but don't worry! ${w.explanation || ""} Let's move on to the next question.`).length, K = Math.max(2e3, ie / 150 * 1e3) + 500;
|
|
11801
|
+
setTimeout(() => {
|
|
11802
|
+
k();
|
|
11803
|
+
}, K);
|
|
11804
|
+
} else
|
|
11805
|
+
k();
|
|
11806
|
+
}, [t.correct, t.incorrect, f, b, k, m]), D = B((v) => {
|
|
11807
|
+
const w = f();
|
|
11788
11808
|
if (!v || typeof v != "object") {
|
|
11789
11809
|
console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
|
|
11790
11810
|
return;
|
|
11791
11811
|
}
|
|
11792
|
-
if (
|
|
11812
|
+
if (w?.type !== "code_test") {
|
|
11793
11813
|
console.warn("Current question is not a code test. Use handleAnswerSelect for other question types.");
|
|
11794
11814
|
return;
|
|
11795
11815
|
}
|
|
11796
|
-
const
|
|
11816
|
+
const F = {
|
|
11797
11817
|
passed: v.passed === !0,
|
|
11798
11818
|
results: v.results || [],
|
|
11799
11819
|
output: v.output || "",
|
|
@@ -11808,56 +11828,56 @@ const fo = _t(({
|
|
|
11808
11828
|
moduleIndex: h.current.currentModuleIndex,
|
|
11809
11829
|
lessonIndex: h.current.currentLessonIndex,
|
|
11810
11830
|
questionIndex: h.current.currentQuestionIndex,
|
|
11811
|
-
testResult:
|
|
11812
|
-
question:
|
|
11813
|
-
}), E(
|
|
11814
|
-
}, [
|
|
11831
|
+
testResult: F,
|
|
11832
|
+
question: w
|
|
11833
|
+
}), E(F);
|
|
11834
|
+
}, [f, E]), U = B(() => {
|
|
11815
11835
|
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
|
-
}, []),
|
|
11836
|
+
}, []), L = B((v) => {
|
|
11817
11837
|
console.log("Avatar is ready!", v);
|
|
11818
|
-
const
|
|
11819
|
-
l &&
|
|
11838
|
+
const w = y();
|
|
11839
|
+
l && w?.avatar_script && setTimeout(() => {
|
|
11820
11840
|
M();
|
|
11821
11841
|
}, 1e3);
|
|
11822
11842
|
}, [l, y, M]);
|
|
11823
11843
|
return Nt(r, () => ({
|
|
11824
11844
|
// Curriculum control methods
|
|
11825
11845
|
startTeaching: M,
|
|
11826
|
-
startQuestions:
|
|
11846
|
+
startQuestions: S,
|
|
11827
11847
|
handleAnswerSelect: E,
|
|
11828
|
-
handleCodeTestResult:
|
|
11848
|
+
handleCodeTestResult: D,
|
|
11829
11849
|
nextQuestion: k,
|
|
11830
11850
|
nextLesson: A,
|
|
11831
11851
|
completeLesson: I,
|
|
11832
|
-
completeCurriculum:
|
|
11852
|
+
completeCurriculum: g,
|
|
11833
11853
|
resetCurriculum: U,
|
|
11834
11854
|
getState: () => ({ ...h.current }),
|
|
11835
|
-
getCurrentQuestion: () =>
|
|
11855
|
+
getCurrentQuestion: () => f(),
|
|
11836
11856
|
getCurrentLesson: () => y(),
|
|
11837
11857
|
// Direct access to avatar ref (always returns current value)
|
|
11838
11858
|
getAvatarRef: () => c.current,
|
|
11839
11859
|
// Convenience methods that delegate to avatar (always check current ref)
|
|
11840
|
-
speakText: async (v) => {
|
|
11841
|
-
await c.current?.resumeAudioContext?.(), c.current?.speakText(v);
|
|
11860
|
+
speakText: async (v, w = {}) => {
|
|
11861
|
+
await c.current?.resumeAudioContext?.(), c.current?.speakText(v, { ...w, lipsyncLang: w.lipsyncLang || m.lipsyncLang });
|
|
11842
11862
|
},
|
|
11843
11863
|
resumeAudioContext: async () => {
|
|
11844
11864
|
if (c.current?.resumeAudioContext)
|
|
11845
11865
|
return await c.current.resumeAudioContext();
|
|
11846
11866
|
const v = c.current?.talkingHead;
|
|
11847
11867
|
if (v?.audioCtx) {
|
|
11848
|
-
const
|
|
11849
|
-
if (
|
|
11868
|
+
const w = v.audioCtx;
|
|
11869
|
+
if (w.state === "suspended" || w.state === "interrupted")
|
|
11850
11870
|
try {
|
|
11851
|
-
await
|
|
11852
|
-
} catch (
|
|
11853
|
-
console.warn("Failed to resume audio context:",
|
|
11871
|
+
await w.resume(), console.log("Audio context resumed via talkingHead");
|
|
11872
|
+
} catch (F) {
|
|
11873
|
+
console.warn("Failed to resume audio context:", F);
|
|
11854
11874
|
}
|
|
11855
11875
|
} else
|
|
11856
11876
|
console.warn("Audio context not available yet");
|
|
11857
11877
|
},
|
|
11858
11878
|
stopSpeaking: () => c.current?.stopSpeaking(),
|
|
11859
11879
|
setMood: (v) => c.current?.setMood(v),
|
|
11860
|
-
playAnimation: (v,
|
|
11880
|
+
playAnimation: (v, w) => c.current?.playAnimation(v, w),
|
|
11861
11881
|
setBodyMovement: (v) => c.current?.setBodyMovement(v),
|
|
11862
11882
|
setMovementIntensity: (v) => c.current?.setMovementIntensity(v),
|
|
11863
11883
|
playRandomDance: () => c.current?.playRandomDance(),
|
|
@@ -11868,10 +11888,10 @@ const fo = _t(({
|
|
|
11868
11888
|
lockAvatarPosition: () => c.current?.lockAvatarPosition(),
|
|
11869
11889
|
unlockAvatarPosition: () => c.current?.unlockAvatarPosition(),
|
|
11870
11890
|
// Custom action trigger
|
|
11871
|
-
triggerCustomAction: (v,
|
|
11891
|
+
triggerCustomAction: (v, w) => {
|
|
11872
11892
|
u.current.onCustomAction({
|
|
11873
11893
|
type: v,
|
|
11874
|
-
...
|
|
11894
|
+
...w,
|
|
11875
11895
|
state: { ...h.current }
|
|
11876
11896
|
});
|
|
11877
11897
|
},
|
|
@@ -11879,12 +11899,12 @@ const fo = _t(({
|
|
|
11879
11899
|
handleResize: () => c.current?.handleResize(),
|
|
11880
11900
|
// Avatar readiness check (always returns current value)
|
|
11881
11901
|
isAvatarReady: () => c.current?.isReady || !1
|
|
11882
|
-
}), [M,
|
|
11902
|
+
}), [M, S, E, D, k, A, I, g, U, f, y]), /* @__PURE__ */ Te("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ Te(
|
|
11883
11903
|
Dn,
|
|
11884
11904
|
{
|
|
11885
11905
|
ref: c,
|
|
11886
11906
|
...m,
|
|
11887
|
-
onReady:
|
|
11907
|
+
onReady: L,
|
|
11888
11908
|
style: { width: "100%", height: "100%" }
|
|
11889
11909
|
}
|
|
11890
11910
|
) });
|