@sage-rsc/talking-head-react 1.0.30 → 1.0.31
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-CO1F6v-w.js → fbxAnimationLoader-C0BDPJ-P.js} +1 -1
- package/dist/{fbxAnimationLoader-BG4X_1Qa.cjs → fbxAnimationLoader-C1sYMpqd.cjs} +1 -1
- package/dist/index-WXvj5jje.cjs +13 -0
- package/dist/{index-V_d1NQ-5.js → index-iUfJQ70v.js} +824 -781
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/CurriculumLearning.jsx +127 -65
- package/dist/index-BFQNNYmP.cjs +0 -13
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as rn, jsx as
|
|
2
|
-
import { forwardRef as Ut, useRef as
|
|
1
|
+
import { jsxs as rn, jsx as ze } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ut, useRef as re, useState as Xe, useCallback as V, useEffect as nt, useImperativeHandle as Gt, useLayoutEffect as Nn } from "react";
|
|
3
3
|
import * as R from "three";
|
|
4
|
-
import { Controls as Bn, Vector3 as
|
|
5
|
-
const Zt = { type: "change" }, Vt = { type: "start" }, In = { type: "end" },
|
|
4
|
+
import { Controls as Bn, Vector3 as B, MOUSE as je, TOUCH as Ge, Quaternion as fe, Spherical as jt, Vector2 as de, Ray as Un, Plane as Gn, MathUtils as ne, TrianglesDrawMode as Vn, TriangleFanDrawMode as Mt, TriangleStripDrawMode as ln, Loader as it, LoaderUtils as Ze, FileLoader as st, MeshPhysicalMaterial as we, Color as ie, LinearSRGBColorSpace as Le, SRGBColorSpace as J, SpotLight as cn, PointLight as yt, DirectionalLight as hn, Matrix4 as j, InstancedMesh as un, InstancedBufferAttribute as Wn, Object3D as Fe, TextureLoader as dn, ImageBitmapLoader as Xn, BufferAttribute as qe, InterleavedBuffer as jn, InterleavedBufferAttribute as Zn, LinearMipmapLinearFilter as pn, NearestMipmapLinearFilter as Yn, LinearMipmapNearestFilter as Kn, NearestMipmapNearestFilter as Qn, LinearFilter as zt, NearestFilter as mn, RepeatWrapping as ot, MirroredRepeatWrapping as qn, ClampToEdgeWrapping as Ht, PointsMaterial as Jn, Material as vt, LineBasicMaterial as fn, MeshStandardMaterial as xt, DoubleSide as $n, MeshBasicMaterial as Qe, PropertyBinding as at, BufferGeometry as Je, SkinnedMesh as gn, Mesh as ke, LineSegments as ei, Line as yn, LineLoop as ti, Points as ni, Group as $e, PerspectiveCamera as xn, OrthographicCamera as ii, Skeleton as bn, AnimationClip as Rn, Bone as Pt, InterpolateDiscrete as si, InterpolateLinear as vn, Texture as Ft, VectorKeyframeTrack as Dt, NumberKeyframeTrack as Ot, QuaternionKeyframeTrack as bt, ColorManagement as be, FrontSide as oi, Interpolant as ai, Box3 as ri, Sphere as li, Vector4 as rt, Curve as ci, MeshPhongMaterial as ut, MeshLambertMaterial as An, EquirectangularReflectionMapping as hi, AmbientLight as ui, Float32BufferAttribute as Ne, Uint16BufferAttribute as di, Matrix3 as pi, ShapeUtils as mi, Euler as Pe, Scene as fi, BoxGeometry as gi, BackSide as yi } from "three";
|
|
5
|
+
const Zt = { type: "change" }, Vt = { type: "start" }, In = { type: "end" }, dt = new Un(), Yt = new Gn(), xi = Math.cos(70 * ne.DEG2RAD), te = new B(), he = 2 * Math.PI, U = {
|
|
6
6
|
NONE: -1,
|
|
7
7
|
ROTATE: 0,
|
|
8
8
|
DOLLY: 1,
|
|
@@ -20,7 +20,7 @@ class bi extends Bn {
|
|
|
20
20
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
21
21
|
*/
|
|
22
22
|
constructor(e, t = null) {
|
|
23
|
-
super(e, t), this.state =
|
|
23
|
+
super(e, t), this.state = U.NONE, this.target = new B(), this.cursor = new B(), 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: je.ROTATE, MIDDLE: je.DOLLY, RIGHT: je.PAN }, this.touches = { ONE: Ge.ROTATE, TWO: Ge.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new B(), this._lastQuaternion = new fe(), this._lastTargetPosition = new B(), this._quat = new fe().setFromUnitVectors(e.up, new B(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new jt(), this._sphericalDelta = new jt(), this._scale = 1, this._panOffset = new B(), this._rotateStart = new de(), this._rotateEnd = new de(), this._rotateDelta = new de(), this._panStart = new de(), this._panEnd = new de(), this._panDelta = new de(), this._dollyStart = new de(), this._dollyEnd = new de(), this._dollyDelta = new de(), this._dollyDirection = new B(), this._mouse = new de(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = vi.bind(this), this._onPointerDown = Ri.bind(this), this._onPointerUp = Ai.bind(this), this._onContextMenu = Ci.bind(this), this._onMouseWheel = wi.bind(this), this._onKeyDown = Si.bind(this), this._onTouchStart = Ti.bind(this), this._onTouchMove = ki.bind(this), this._onMouseDown = Ii.bind(this), this._onMouseMove = Li.bind(this), this._interceptControlDown = Ei.bind(this), this._interceptControlUp = Mi.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
24
24
|
}
|
|
25
25
|
connect(e) {
|
|
26
26
|
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -81,13 +81,13 @@ class bi extends Bn {
|
|
|
81
81
|
* was called, or the initial state.
|
|
82
82
|
*/
|
|
83
83
|
reset() {
|
|
84
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Zt), this.update(), this.state =
|
|
84
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Zt), this.update(), this.state = U.NONE;
|
|
85
85
|
}
|
|
86
86
|
update(e = null) {
|
|
87
87
|
const t = this.object.position;
|
|
88
|
-
|
|
88
|
+
te.copy(t).sub(this.target), te.applyQuaternion(this._quat), this._spherical.setFromVector3(te), this.autoRotate && this.state === U.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
|
-
isFinite(n) && isFinite(i) && (n < -Math.PI ? n +=
|
|
90
|
+
isFinite(n) && isFinite(i) && (n < -Math.PI ? n += he : n > Math.PI && (n -= he), i < -Math.PI ? i += he : i > Math.PI && (i -= he), 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;
|
|
92
92
|
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
|
|
93
93
|
this._spherical.radius = this._clampDistance(this._spherical.radius);
|
|
@@ -95,23 +95,23 @@ class bi extends Bn {
|
|
|
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 (te.setFromSpherical(this._spherical), te.applyQuaternion(this._quatInverse), t.copy(this.target).add(te), 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 = te.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;
|
|
105
105
|
} else if (this.object.isOrthographicCamera) {
|
|
106
|
-
const a = new
|
|
106
|
+
const a = new B(this._mouse.x, this._mouse.y, 0);
|
|
107
107
|
a.unproject(this.object);
|
|
108
108
|
const l = this.object.zoom;
|
|
109
109
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), s = l !== this.object.zoom;
|
|
110
|
-
const r = new
|
|
111
|
-
r.unproject(this.object), this.object.position.sub(r).add(a), this.object.updateMatrixWorld(), o =
|
|
110
|
+
const r = new B(this._mouse.x, this._mouse.y, 0);
|
|
111
|
+
r.unproject(this.object), this.object.position.sub(r).add(a), this.object.updateMatrixWorld(), o = te.length();
|
|
112
112
|
} else
|
|
113
113
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
114
|
-
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (
|
|
114
|
+
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (dt.origin.copy(this.object.position), dt.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(dt.direction)) < xi ? this.object.lookAt(this.target) : (Yt.setFromNormalAndCoplanarPoint(this.object.up, this.target), dt.intersectPlane(Yt, this.target))));
|
|
115
115
|
} else if (this.object.isOrthographicCamera) {
|
|
116
116
|
const o = this.object.zoom;
|
|
117
117
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), o !== this.object.zoom && (this.object.updateProjectionMatrix(), s = !0);
|
|
@@ -119,7 +119,7 @@ class bi extends Bn {
|
|
|
119
119
|
return this._scale = 1, this._performCursorZoom = !1, s || this._lastPosition.distanceToSquared(this.object.position) > At || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > At || this._lastTargetPosition.distanceToSquared(this.target) > At ? (this.dispatchEvent(Zt), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
120
120
|
}
|
|
121
121
|
_getAutoRotationAngle(e) {
|
|
122
|
-
return e !== null ?
|
|
122
|
+
return e !== null ? he / 60 * this.autoRotateSpeed * e : he / 60 / 60 * this.autoRotateSpeed;
|
|
123
123
|
}
|
|
124
124
|
_getZoomScale(e) {
|
|
125
125
|
const t = Math.abs(e * 0.01);
|
|
@@ -132,18 +132,18 @@ class bi extends Bn {
|
|
|
132
132
|
this._sphericalDelta.phi -= e;
|
|
133
133
|
}
|
|
134
134
|
_panLeft(e, t) {
|
|
135
|
-
|
|
135
|
+
te.setFromMatrixColumn(t, 0), te.multiplyScalar(-e), this._panOffset.add(te);
|
|
136
136
|
}
|
|
137
137
|
_panUp(e, t) {
|
|
138
|
-
this.screenSpacePanning === !0 ?
|
|
138
|
+
this.screenSpacePanning === !0 ? te.setFromMatrixColumn(t, 1) : (te.setFromMatrixColumn(t, 0), te.crossVectors(this.object.up, te)), te.multiplyScalar(e), this._panOffset.add(te);
|
|
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
|
+
te.copy(i).sub(this.target);
|
|
146
|
+
let s = te.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
|
}
|
|
@@ -178,7 +178,7 @@ class bi extends Bn {
|
|
|
178
178
|
_handleMouseMoveRotate(e) {
|
|
179
179
|
this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
180
180
|
const t = this.domElement;
|
|
181
|
-
this._rotateLeft(
|
|
181
|
+
this._rotateLeft(he * this._rotateDelta.x / t.clientHeight), this._rotateUp(he * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
|
|
182
182
|
}
|
|
183
183
|
_handleMouseMoveDolly(e) {
|
|
184
184
|
this._dollyEnd.set(e.clientX, e.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
|
|
@@ -193,16 +193,16 @@ class bi extends Bn {
|
|
|
193
193
|
let t = !1;
|
|
194
194
|
switch (e.code) {
|
|
195
195
|
case this.keys.UP:
|
|
196
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(
|
|
196
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(he * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
|
|
197
197
|
break;
|
|
198
198
|
case this.keys.BOTTOM:
|
|
199
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-
|
|
199
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-he * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
|
|
200
200
|
break;
|
|
201
201
|
case this.keys.LEFT:
|
|
202
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(
|
|
202
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(he * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
|
|
203
203
|
break;
|
|
204
204
|
case this.keys.RIGHT:
|
|
205
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-
|
|
205
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-he * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
|
|
206
206
|
break;
|
|
207
207
|
}
|
|
208
208
|
t && (e.preventDefault(), this.update());
|
|
@@ -242,7 +242,7 @@ class bi extends Bn {
|
|
|
242
242
|
}
|
|
243
243
|
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
244
244
|
const t = this.domElement;
|
|
245
|
-
this._rotateLeft(
|
|
245
|
+
this._rotateLeft(he * this._rotateDelta.x / t.clientHeight), this._rotateUp(he * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
|
|
246
246
|
}
|
|
247
247
|
_handleTouchMovePan(e) {
|
|
248
248
|
if (this._pointers.length === 1)
|
|
@@ -284,7 +284,7 @@ class bi extends Bn {
|
|
|
284
284
|
}
|
|
285
285
|
_trackPointer(e) {
|
|
286
286
|
let t = this._pointerPositions[e.pointerId];
|
|
287
|
-
t === void 0 && (t = new
|
|
287
|
+
t === void 0 && (t = new de(), this._pointerPositions[e.pointerId] = t), t.set(e.pageX, e.pageY);
|
|
288
288
|
}
|
|
289
289
|
_getSecondPointerPosition(e) {
|
|
290
290
|
const t = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
|
|
@@ -317,7 +317,7 @@ function vi(p) {
|
|
|
317
317
|
function Ai(p) {
|
|
318
318
|
switch (this._removePointer(p), this._pointers.length) {
|
|
319
319
|
case 0:
|
|
320
|
-
this.domElement.releasePointerCapture(p.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(In), this.state =
|
|
320
|
+
this.domElement.releasePointerCapture(p.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(In), this.state = U.NONE;
|
|
321
321
|
break;
|
|
322
322
|
case 1:
|
|
323
323
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -343,49 +343,49 @@ function Ii(p) {
|
|
|
343
343
|
switch (e) {
|
|
344
344
|
case je.DOLLY:
|
|
345
345
|
if (this.enableZoom === !1) return;
|
|
346
|
-
this._handleMouseDownDolly(p), this.state =
|
|
346
|
+
this._handleMouseDownDolly(p), this.state = U.DOLLY;
|
|
347
347
|
break;
|
|
348
348
|
case je.ROTATE:
|
|
349
349
|
if (p.ctrlKey || p.metaKey || p.shiftKey) {
|
|
350
350
|
if (this.enablePan === !1) return;
|
|
351
|
-
this._handleMouseDownPan(p), this.state =
|
|
351
|
+
this._handleMouseDownPan(p), this.state = U.PAN;
|
|
352
352
|
} else {
|
|
353
353
|
if (this.enableRotate === !1) return;
|
|
354
|
-
this._handleMouseDownRotate(p), this.state =
|
|
354
|
+
this._handleMouseDownRotate(p), this.state = U.ROTATE;
|
|
355
355
|
}
|
|
356
356
|
break;
|
|
357
357
|
case je.PAN:
|
|
358
358
|
if (p.ctrlKey || p.metaKey || p.shiftKey) {
|
|
359
359
|
if (this.enableRotate === !1) return;
|
|
360
|
-
this._handleMouseDownRotate(p), this.state =
|
|
360
|
+
this._handleMouseDownRotate(p), this.state = U.ROTATE;
|
|
361
361
|
} else {
|
|
362
362
|
if (this.enablePan === !1) return;
|
|
363
|
-
this._handleMouseDownPan(p), this.state =
|
|
363
|
+
this._handleMouseDownPan(p), this.state = U.PAN;
|
|
364
364
|
}
|
|
365
365
|
break;
|
|
366
366
|
default:
|
|
367
|
-
this.state =
|
|
367
|
+
this.state = U.NONE;
|
|
368
368
|
}
|
|
369
|
-
this.state !==
|
|
369
|
+
this.state !== U.NONE && this.dispatchEvent(Vt);
|
|
370
370
|
}
|
|
371
371
|
function Li(p) {
|
|
372
372
|
switch (this.state) {
|
|
373
|
-
case
|
|
373
|
+
case U.ROTATE:
|
|
374
374
|
if (this.enableRotate === !1) return;
|
|
375
375
|
this._handleMouseMoveRotate(p);
|
|
376
376
|
break;
|
|
377
|
-
case
|
|
377
|
+
case U.DOLLY:
|
|
378
378
|
if (this.enableZoom === !1) return;
|
|
379
379
|
this._handleMouseMoveDolly(p);
|
|
380
380
|
break;
|
|
381
|
-
case
|
|
381
|
+
case U.PAN:
|
|
382
382
|
if (this.enablePan === !1) return;
|
|
383
383
|
this._handleMouseMovePan(p);
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
function wi(p) {
|
|
388
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !==
|
|
388
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== U.NONE || (p.preventDefault(), this.dispatchEvent(Vt), this._handleMouseWheel(this._customWheelEvent(p)), this.dispatchEvent(In));
|
|
389
389
|
}
|
|
390
390
|
function Si(p) {
|
|
391
391
|
this.enabled !== !1 && this._handleKeyDown(p);
|
|
@@ -396,55 +396,55 @@ function Ti(p) {
|
|
|
396
396
|
switch (this.touches.ONE) {
|
|
397
397
|
case Ge.ROTATE:
|
|
398
398
|
if (this.enableRotate === !1) return;
|
|
399
|
-
this._handleTouchStartRotate(p), this.state =
|
|
399
|
+
this._handleTouchStartRotate(p), this.state = U.TOUCH_ROTATE;
|
|
400
400
|
break;
|
|
401
401
|
case Ge.PAN:
|
|
402
402
|
if (this.enablePan === !1) return;
|
|
403
|
-
this._handleTouchStartPan(p), this.state =
|
|
403
|
+
this._handleTouchStartPan(p), this.state = U.TOUCH_PAN;
|
|
404
404
|
break;
|
|
405
405
|
default:
|
|
406
|
-
this.state =
|
|
406
|
+
this.state = U.NONE;
|
|
407
407
|
}
|
|
408
408
|
break;
|
|
409
409
|
case 2:
|
|
410
410
|
switch (this.touches.TWO) {
|
|
411
411
|
case Ge.DOLLY_PAN:
|
|
412
412
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
413
|
-
this._handleTouchStartDollyPan(p), this.state =
|
|
413
|
+
this._handleTouchStartDollyPan(p), this.state = U.TOUCH_DOLLY_PAN;
|
|
414
414
|
break;
|
|
415
415
|
case Ge.DOLLY_ROTATE:
|
|
416
416
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
417
|
-
this._handleTouchStartDollyRotate(p), this.state =
|
|
417
|
+
this._handleTouchStartDollyRotate(p), this.state = U.TOUCH_DOLLY_ROTATE;
|
|
418
418
|
break;
|
|
419
419
|
default:
|
|
420
|
-
this.state =
|
|
420
|
+
this.state = U.NONE;
|
|
421
421
|
}
|
|
422
422
|
break;
|
|
423
423
|
default:
|
|
424
|
-
this.state =
|
|
424
|
+
this.state = U.NONE;
|
|
425
425
|
}
|
|
426
|
-
this.state !==
|
|
426
|
+
this.state !== U.NONE && this.dispatchEvent(Vt);
|
|
427
427
|
}
|
|
428
428
|
function ki(p) {
|
|
429
429
|
switch (this._trackPointer(p), this.state) {
|
|
430
|
-
case
|
|
430
|
+
case U.TOUCH_ROTATE:
|
|
431
431
|
if (this.enableRotate === !1) return;
|
|
432
432
|
this._handleTouchMoveRotate(p), this.update();
|
|
433
433
|
break;
|
|
434
|
-
case
|
|
434
|
+
case U.TOUCH_PAN:
|
|
435
435
|
if (this.enablePan === !1) return;
|
|
436
436
|
this._handleTouchMovePan(p), this.update();
|
|
437
437
|
break;
|
|
438
|
-
case
|
|
438
|
+
case U.TOUCH_DOLLY_PAN:
|
|
439
439
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
440
440
|
this._handleTouchMoveDollyPan(p), this.update();
|
|
441
441
|
break;
|
|
442
|
-
case
|
|
442
|
+
case U.TOUCH_DOLLY_ROTATE:
|
|
443
443
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
444
444
|
this._handleTouchMoveDollyRotate(p), this.update();
|
|
445
445
|
break;
|
|
446
446
|
default:
|
|
447
|
-
this.state =
|
|
447
|
+
this.state = U.NONE;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
function Ci(p) {
|
|
@@ -483,7 +483,7 @@ function Kt(p, e) {
|
|
|
483
483
|
} else
|
|
484
484
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), p;
|
|
485
485
|
}
|
|
486
|
-
class zi extends
|
|
486
|
+
class zi extends it {
|
|
487
487
|
/**
|
|
488
488
|
* Constructs a new glTF loader.
|
|
489
489
|
*
|
|
@@ -548,7 +548,7 @@ class zi extends nt {
|
|
|
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 st(this.manager);
|
|
552
552
|
l.setPath(this.path), l.setResponseType("arraybuffer"), l.setRequestHeader(this.requestHeader), l.setWithCredentials(this.withCredentials), l.load(e, function(r) {
|
|
553
553
|
try {
|
|
554
554
|
s.parse(r, o, function(h) {
|
|
@@ -747,8 +747,8 @@ class Pi {
|
|
|
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 h = new
|
|
751
|
-
l.color !== void 0 && h.setRGB(l.color[0], l.color[1], l.color[2],
|
|
750
|
+
const h = new ie(16777215);
|
|
751
|
+
l.color !== void 0 && h.setRGB(l.color[0], l.color[1], l.color[2], Le);
|
|
752
752
|
const c = l.range !== void 0 ? l.range : 0;
|
|
753
753
|
switch (l.type) {
|
|
754
754
|
case "directional":
|
|
@@ -763,7 +763,7 @@ class Pi {
|
|
|
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), Ie(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")
|
|
@@ -785,14 +785,14 @@ class Fi {
|
|
|
785
785
|
}
|
|
786
786
|
extendParams(e, t, n) {
|
|
787
787
|
const i = [];
|
|
788
|
-
e.color = new
|
|
788
|
+
e.color = new ie(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], Le), 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 Oi {
|
|
|
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 : we;
|
|
819
819
|
}
|
|
820
820
|
extendMaterialParams(e, t) {
|
|
821
821
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -824,7 +824,7 @@ class Oi {
|
|
|
824
824
|
const s = [], o = i.extensions[this.name];
|
|
825
825
|
if (o.clearcoatFactor !== void 0 && (t.clearcoat = o.clearcoatFactor), o.clearcoatTexture !== void 0 && s.push(n.assignTexture(t, "clearcoatMap", o.clearcoatTexture)), o.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = o.clearcoatRoughnessFactor), o.clearcoatRoughnessTexture !== void 0 && s.push(n.assignTexture(t, "clearcoatRoughnessMap", o.clearcoatRoughnessTexture)), o.clearcoatNormalTexture !== void 0 && (s.push(n.assignTexture(t, "clearcoatNormalMap", o.clearcoatNormalTexture)), o.clearcoatNormalTexture.scale !== void 0)) {
|
|
826
826
|
const a = o.clearcoatNormalTexture.scale;
|
|
827
|
-
t.clearcoatNormalScale = new
|
|
827
|
+
t.clearcoatNormalScale = new de(a, a);
|
|
828
828
|
}
|
|
829
829
|
return Promise.all(s);
|
|
830
830
|
}
|
|
@@ -835,7 +835,7 @@ class _i {
|
|
|
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 : we;
|
|
839
839
|
}
|
|
840
840
|
extendMaterialParams(e, t) {
|
|
841
841
|
const i = this.parser.json.materials[e];
|
|
@@ -851,7 +851,7 @@ class Ni {
|
|
|
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 : we;
|
|
855
855
|
}
|
|
856
856
|
extendMaterialParams(e, t) {
|
|
857
857
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -867,20 +867,20 @@ class Bi {
|
|
|
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 : we;
|
|
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 ie(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], Le);
|
|
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 Ui {
|
|
@@ -889,7 +889,7 @@ class Ui {
|
|
|
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 : we;
|
|
893
893
|
}
|
|
894
894
|
extendMaterialParams(e, t) {
|
|
895
895
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -905,7 +905,7 @@ class Gi {
|
|
|
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 : we;
|
|
909
909
|
}
|
|
910
910
|
extendMaterialParams(e, t) {
|
|
911
911
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -914,7 +914,7 @@ class Gi {
|
|
|
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 ie().setRGB(a[0], a[1], a[2], Le), Promise.all(s);
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
920
|
class Vi {
|
|
@@ -923,7 +923,7 @@ class Vi {
|
|
|
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 : we;
|
|
927
927
|
}
|
|
928
928
|
extendMaterialParams(e, t) {
|
|
929
929
|
const i = this.parser.json.materials[e];
|
|
@@ -939,7 +939,7 @@ class Wi {
|
|
|
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 : we;
|
|
943
943
|
}
|
|
944
944
|
extendMaterialParams(e, t) {
|
|
945
945
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -948,7 +948,7 @@ class Wi {
|
|
|
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 ie().setRGB(a[0], a[1], a[2], Le), o.specularColorTexture !== void 0 && s.push(n.assignTexture(t, "specularColorMap", o.specularColorTexture, J)), Promise.all(s);
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
954
|
class Xi {
|
|
@@ -957,7 +957,7 @@ class Xi {
|
|
|
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 : we;
|
|
961
961
|
}
|
|
962
962
|
extendMaterialParams(e, t) {
|
|
963
963
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -973,7 +973,7 @@ class ji {
|
|
|
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 : we;
|
|
977
977
|
}
|
|
978
978
|
extendMaterialParams(e, t) {
|
|
979
979
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -1070,7 +1070,7 @@ class qi {
|
|
|
1070
1070
|
return null;
|
|
1071
1071
|
const i = t.meshes[n.mesh];
|
|
1072
1072
|
for (const r of i.primitives)
|
|
1073
|
-
if (r.mode !==
|
|
1073
|
+
if (r.mode !== me.TRIANGLES && r.mode !== me.TRIANGLE_STRIP && r.mode !== me.TRIANGLE_FAN && r.mode !== void 0)
|
|
1074
1074
|
return null;
|
|
1075
1075
|
const o = n.extensions[this.name].attributes, a = [], l = {};
|
|
1076
1076
|
for (const r in o)
|
|
@@ -1078,15 +1078,15 @@ class qi {
|
|
|
1078
1078
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((r) => {
|
|
1079
1079
|
const h = r.pop(), c = h.isGroup ? h.children : [h], u = r[0].count, d = [];
|
|
1080
1080
|
for (const m of c) {
|
|
1081
|
-
const y = new
|
|
1082
|
-
for (let
|
|
1083
|
-
l.TRANSLATION && g.fromBufferAttribute(l.TRANSLATION,
|
|
1084
|
-
for (const
|
|
1085
|
-
if (
|
|
1086
|
-
const T = l[
|
|
1081
|
+
const y = new j(), g = new B(), b = new fe(), A = new B(1, 1, 1), f = new un(m.geometry, m.material, u);
|
|
1082
|
+
for (let L = 0; L < u; L++)
|
|
1083
|
+
l.TRANSLATION && g.fromBufferAttribute(l.TRANSLATION, L), l.ROTATION && b.fromBufferAttribute(l.ROTATION, L), l.SCALE && A.fromBufferAttribute(l.SCALE, L), f.setMatrixAt(L, y.compose(g, b, A));
|
|
1084
|
+
for (const L in l)
|
|
1085
|
+
if (L === "_COLOR_0") {
|
|
1086
|
+
const T = l[L];
|
|
1087
1087
|
f.instanceColor = new Wn(T.array, T.itemSize, T.normalized);
|
|
1088
|
-
} else
|
|
1089
|
-
|
|
1088
|
+
} else L !== "TRANSLATION" && L !== "ROTATION" && L !== "SCALE" && m.geometry.setAttribute(L, l[L]);
|
|
1089
|
+
Fe.prototype.copy.call(f, m), this.parser.assignFinalMaterial(f), d.push(f);
|
|
1090
1090
|
}
|
|
1091
1091
|
return h.isGroup ? (h.clear(), h.add(...d), h) : d[0];
|
|
1092
1092
|
}));
|
|
@@ -1151,7 +1151,7 @@ class $i {
|
|
|
1151
1151
|
g !== void 0 && (y.normalized = g);
|
|
1152
1152
|
}
|
|
1153
1153
|
c(d);
|
|
1154
|
-
}, a, r,
|
|
1154
|
+
}, a, r, Le, u);
|
|
1155
1155
|
});
|
|
1156
1156
|
});
|
|
1157
1157
|
}
|
|
@@ -1180,22 +1180,22 @@ class wn extends ai {
|
|
|
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, h = i - t, c = (n - t) / h, u = c * c, d = u * c, m = e * r, y = m - r, g = -2 * d + 3 * u, b = d - u,
|
|
1184
|
-
for (let
|
|
1185
|
-
const T = o[y +
|
|
1186
|
-
s[
|
|
1183
|
+
const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, r = a * 3, h = i - t, c = (n - t) / h, u = c * c, d = u * c, m = e * r, y = m - r, g = -2 * d + 3 * u, b = d - u, A = 1 - g, f = b - u + c;
|
|
1184
|
+
for (let L = 0; L !== a; L++) {
|
|
1185
|
+
const T = o[y + L + a], v = o[y + L + l] * h, E = o[m + L + a], z = o[m + L] * h;
|
|
1186
|
+
s[L] = A * T + f * v + g * E + b * z;
|
|
1187
1187
|
}
|
|
1188
1188
|
return s;
|
|
1189
1189
|
}
|
|
1190
1190
|
}
|
|
1191
|
-
const ns = new
|
|
1191
|
+
const ns = new fe();
|
|
1192
1192
|
class is extends wn {
|
|
1193
1193
|
interpolate_(e, t, n, i) {
|
|
1194
1194
|
const s = super.interpolate_(e, t, n, i);
|
|
1195
1195
|
return ns.fromArray(s).normalize().toArray(s), s;
|
|
1196
1196
|
}
|
|
1197
1197
|
}
|
|
1198
|
-
const
|
|
1198
|
+
const me = {
|
|
1199
1199
|
POINTS: 0,
|
|
1200
1200
|
LINES: 1,
|
|
1201
1201
|
LINE_LOOP: 2,
|
|
@@ -1220,7 +1220,7 @@ const pe = {
|
|
|
1220
1220
|
}, Jt = {
|
|
1221
1221
|
33071: Ht,
|
|
1222
1222
|
33648: qn,
|
|
1223
|
-
10497:
|
|
1223
|
+
10497: ot
|
|
1224
1224
|
}, It = {
|
|
1225
1225
|
SCALAR: 1,
|
|
1226
1226
|
VEC2: 2,
|
|
@@ -1240,7 +1240,7 @@ const pe = {
|
|
|
1240
1240
|
COLOR_0: "color",
|
|
1241
1241
|
WEIGHTS_0: "skinWeight",
|
|
1242
1242
|
JOINTS_0: "skinIndex"
|
|
1243
|
-
},
|
|
1243
|
+
}, Ce = {
|
|
1244
1244
|
scale: "scale",
|
|
1245
1245
|
translation: "position",
|
|
1246
1246
|
rotation: "quaternion",
|
|
@@ -1267,11 +1267,11 @@ function os(p) {
|
|
|
1267
1267
|
side: oi
|
|
1268
1268
|
})), p.DefaultMaterial;
|
|
1269
1269
|
}
|
|
1270
|
-
function
|
|
1270
|
+
function He(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 Ie(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 as(p, e, t) {
|
|
@@ -1352,7 +1352,7 @@ function Nt(p) {
|
|
|
1352
1352
|
function cs(p) {
|
|
1353
1353
|
return p.search(/\.jpe?g($|\?)/i) > 0 || p.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : p.search(/\.webp($|\?)/i) > 0 || p.search(/^data\:image\/webp/) === 0 ? "image/webp" : p.search(/\.ktx2($|\?)/i) > 0 || p.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
|
|
1354
1354
|
}
|
|
1355
|
-
const hs = new
|
|
1355
|
+
const hs = new j();
|
|
1356
1356
|
class us {
|
|
1357
1357
|
constructor(e = {}, t = {}) {
|
|
1358
1358
|
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new Hi(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
|
|
@@ -1363,7 +1363,7 @@ class us {
|
|
|
1363
1363
|
const l = a.match(/Version\/(\d+)/);
|
|
1364
1364
|
i = n && l ? parseInt(l[1], 10) : -1, s = a.indexOf("Firefox") > -1, o = s ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
1365
1365
|
}
|
|
1366
|
-
typeof createImageBitmap > "u" || n && i < 17 || s && o < 98 ? this.textureLoader = new dn(this.options.manager) : this.textureLoader = new Xn(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new
|
|
1366
|
+
typeof createImageBitmap > "u" || n && i < 17 || s && o < 98 ? this.textureLoader = new dn(this.options.manager) : this.textureLoader = new Xn(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new st(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 us {
|
|
|
1393
1393
|
parser: n,
|
|
1394
1394
|
userData: {}
|
|
1395
1395
|
};
|
|
1396
|
-
return
|
|
1396
|
+
return He(s, a, i), Ie(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)
|
|
@@ -1611,17 +1611,17 @@ class us {
|
|
|
1611
1611
|
const a = o[0], l = It[i.type], r = Ye[i.componentType], h = r.BYTES_PER_ELEMENT, c = h * l, u = i.byteOffset || 0, d = i.bufferView !== void 0 ? n.bufferViews[i.bufferView].byteStride : void 0, m = i.normalized === !0;
|
|
1612
1612
|
let y, g;
|
|
1613
1613
|
if (d && d !== c) {
|
|
1614
|
-
const b = Math.floor(u / d),
|
|
1615
|
-
let f = t.cache.get(
|
|
1616
|
-
f || (y = new r(a, b * d, i.count * d / h), f = new jn(y, d / h), t.cache.add(
|
|
1614
|
+
const b = Math.floor(u / d), A = "InterleavedBuffer:" + i.bufferView + ":" + i.componentType + ":" + b + ":" + i.count;
|
|
1615
|
+
let f = t.cache.get(A);
|
|
1616
|
+
f || (y = new r(a, b * d, i.count * d / h), f = new jn(y, d / h), t.cache.add(A, f)), g = new Zn(f, l, u % d / h, m);
|
|
1617
1617
|
} else
|
|
1618
1618
|
a === null ? y = new r(i.count * l) : y = new r(a, u, i.count * l), g = new qe(y, l, m);
|
|
1619
1619
|
if (i.sparse !== void 0) {
|
|
1620
|
-
const b = It.SCALAR,
|
|
1620
|
+
const b = It.SCALAR, A = Ye[i.sparse.indices.componentType], f = i.sparse.indices.byteOffset || 0, L = i.sparse.values.byteOffset || 0, T = new A(o[1], f, i.sparse.count * b), v = new r(o[2], L, i.sparse.count * l);
|
|
1621
1621
|
a !== null && (g = new qe(g.array.slice(), g.itemSize, g.normalized)), g.normalized = !1;
|
|
1622
|
-
for (let
|
|
1623
|
-
const
|
|
1624
|
-
if (g.setX(
|
|
1622
|
+
for (let E = 0, z = T.length; E < z; E++) {
|
|
1623
|
+
const O = T[E];
|
|
1624
|
+
if (g.setX(O, v[E * l]), l >= 2 && g.setY(O, v[E * l + 1]), l >= 3 && g.setZ(O, v[E * l + 2]), l >= 4 && g.setW(O, v[E * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1625
1625
|
}
|
|
1626
1626
|
g.normalized = m;
|
|
1627
1627
|
}
|
|
@@ -1651,7 +1651,7 @@ class us {
|
|
|
1651
1651
|
const r = this.loadImageSource(t, n).then(function(h) {
|
|
1652
1652
|
h.flipY = !1, h.name = o.name || a.name || "", h.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (h.name = a.uri);
|
|
1653
1653
|
const u = (s.samplers || {})[o.sampler] || {};
|
|
1654
|
-
return h.magFilter = qt[u.magFilter] || zt, h.minFilter = qt[u.minFilter] || pn, h.wrapS = Jt[u.wrapS] ||
|
|
1654
|
+
return h.magFilter = qt[u.magFilter] || zt, h.minFilter = qt[u.minFilter] || pn, h.wrapS = Jt[u.wrapS] || ot, h.wrapT = Jt[u.wrapT] || ot, h.generateMipmaps = !h.isCompressedTexture && h.minFilter !== mn && h.minFilter !== zt, i.associations.set(h, { textures: e }), h;
|
|
1655
1655
|
}).catch(function() {
|
|
1656
1656
|
return null;
|
|
1657
1657
|
});
|
|
@@ -1680,7 +1680,7 @@ class us {
|
|
|
1680
1680
|
}), t.load(Ze.resolveURL(c, s.path), m, void 0, d);
|
|
1681
1681
|
});
|
|
1682
1682
|
}).then(function(c) {
|
|
1683
|
-
return r === !0 && a.revokeObjectURL(l),
|
|
1683
|
+
return r === !0 && a.revokeObjectURL(l), Ie(c, o), c.userData.mimeType = o.mimeType || cs(o.uri), c;
|
|
1684
1684
|
}).catch(function(c) {
|
|
1685
1685
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", l), c;
|
|
1686
1686
|
});
|
|
@@ -1760,11 +1760,11 @@ class us {
|
|
|
1760
1760
|
o = c.getMaterialType(), r.push(c.extendParams(a, s, t));
|
|
1761
1761
|
} else {
|
|
1762
1762
|
const c = s.pbrMetallicRoughness || {};
|
|
1763
|
-
if (a.color = new
|
|
1763
|
+
if (a.color = new ie(1, 1, 1), a.opacity = 1, Array.isArray(c.baseColorFactor)) {
|
|
1764
1764
|
const u = c.baseColorFactor;
|
|
1765
|
-
a.color.setRGB(u[0], u[1], u[2],
|
|
1765
|
+
a.color.setRGB(u[0], u[1], u[2], Le), a.opacity = u[3];
|
|
1766
1766
|
}
|
|
1767
|
-
c.baseColorTexture !== void 0 && r.push(t.assignTexture(a, "map", c.baseColorTexture,
|
|
1767
|
+
c.baseColorTexture !== void 0 && r.push(t.assignTexture(a, "map", c.baseColorTexture, J)), a.metalness = c.metallicFactor !== void 0 ? c.metallicFactor : 1, a.roughness = c.roughnessFactor !== void 0 ? c.roughnessFactor : 1, c.metallicRoughnessTexture !== void 0 && (r.push(t.assignTexture(a, "metalnessMap", c.metallicRoughnessTexture)), r.push(t.assignTexture(a, "roughnessMap", c.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 us {
|
|
|
1772
1772
|
}
|
|
1773
1773
|
s.doubleSided === !0 && (a.side = $n);
|
|
1774
1774
|
const h = s.alphaMode || Lt.OPAQUE;
|
|
1775
|
-
if (h === Lt.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, h === Lt.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && o !== Qe && (r.push(t.assignTexture(a, "normalMap", s.normalTexture)), a.normalScale = new
|
|
1775
|
+
if (h === Lt.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, h === Lt.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && o !== Qe && (r.push(t.assignTexture(a, "normalMap", s.normalTexture)), a.normalScale = new de(1, 1), s.normalTexture.scale !== void 0)) {
|
|
1776
1776
|
const c = s.normalTexture.scale;
|
|
1777
1777
|
a.normalScale.set(c, c);
|
|
1778
1778
|
}
|
|
1779
1779
|
if (s.occlusionTexture !== void 0 && o !== Qe && (r.push(t.assignTexture(a, "aoMap", s.occlusionTexture)), s.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = s.occlusionTexture.strength)), s.emissiveFactor !== void 0 && o !== Qe) {
|
|
1780
1780
|
const c = s.emissiveFactor;
|
|
1781
|
-
a.emissive = new
|
|
1781
|
+
a.emissive = new ie().setRGB(c[0], c[1], c[2], Le);
|
|
1782
1782
|
}
|
|
1783
|
-
return s.emissiveTexture !== void 0 && o !== Qe && r.push(t.assignTexture(a, "emissiveMap", s.emissiveTexture,
|
|
1783
|
+
return s.emissiveTexture !== void 0 && o !== Qe && r.push(t.assignTexture(a, "emissiveMap", s.emissiveTexture, J)), Promise.all(r).then(function() {
|
|
1784
1784
|
const c = new o(a);
|
|
1785
|
-
return s.name && (c.name = s.name),
|
|
1785
|
+
return s.name && (c.name = s.name), Ie(c, s), t.associations.set(c, { materials: e }), s.extensions && He(i, c, s), c;
|
|
1786
1786
|
});
|
|
1787
1787
|
}
|
|
1788
1788
|
/**
|
|
@@ -1793,7 +1793,7 @@ class us {
|
|
|
1793
1793
|
* @return {string}
|
|
1794
1794
|
*/
|
|
1795
1795
|
createUniqueName(e) {
|
|
1796
|
-
const t =
|
|
1796
|
+
const t = at.sanitizeNodeName(e || "");
|
|
1797
1797
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
1798
1798
|
}
|
|
1799
1799
|
/**
|
|
@@ -1842,20 +1842,20 @@ class us {
|
|
|
1842
1842
|
for (let d = 0, m = h.length; d < m; d++) {
|
|
1843
1843
|
const y = h[d], g = o[d];
|
|
1844
1844
|
let b;
|
|
1845
|
-
const
|
|
1846
|
-
if (g.mode ===
|
|
1847
|
-
b = s.isSkinnedMesh === !0 ? new gn(y,
|
|
1848
|
-
else if (g.mode ===
|
|
1849
|
-
b = new ei(y,
|
|
1850
|
-
else if (g.mode ===
|
|
1851
|
-
b = new yn(y,
|
|
1852
|
-
else if (g.mode ===
|
|
1853
|
-
b = new ti(y,
|
|
1854
|
-
else if (g.mode ===
|
|
1855
|
-
b = new ni(y,
|
|
1845
|
+
const A = r[d];
|
|
1846
|
+
if (g.mode === me.TRIANGLES || g.mode === me.TRIANGLE_STRIP || g.mode === me.TRIANGLE_FAN || g.mode === void 0)
|
|
1847
|
+
b = s.isSkinnedMesh === !0 ? new gn(y, A) : new ke(y, A), b.isSkinnedMesh === !0 && b.normalizeSkinWeights(), g.mode === me.TRIANGLE_STRIP ? b.geometry = Kt(b.geometry, ln) : g.mode === me.TRIANGLE_FAN && (b.geometry = Kt(b.geometry, Mt));
|
|
1848
|
+
else if (g.mode === me.LINES)
|
|
1849
|
+
b = new ei(y, A);
|
|
1850
|
+
else if (g.mode === me.LINE_STRIP)
|
|
1851
|
+
b = new yn(y, A);
|
|
1852
|
+
else if (g.mode === me.LINE_LOOP)
|
|
1853
|
+
b = new ti(y, A);
|
|
1854
|
+
else if (g.mode === me.POINTS)
|
|
1855
|
+
b = new ni(y, A);
|
|
1856
1856
|
else
|
|
1857
1857
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + g.mode);
|
|
1858
|
-
Object.keys(b.geometry.morphAttributes).length > 0 && rs(b, s), b.name = t.createUniqueName(s.name || "mesh_" + e),
|
|
1858
|
+
Object.keys(b.geometry.morphAttributes).length > 0 && rs(b, s), b.name = t.createUniqueName(s.name || "mesh_" + e), Ie(b, s), g.extensions && He(i, b, g), t.assignFinalMaterial(b), c.push(b);
|
|
1859
1859
|
}
|
|
1860
1860
|
for (let d = 0, m = c.length; d < m; d++)
|
|
1861
1861
|
t.associations.set(c[d], {
|
|
@@ -1863,9 +1863,9 @@ class us {
|
|
|
1863
1863
|
primitives: d
|
|
1864
1864
|
});
|
|
1865
1865
|
if (c.length === 1)
|
|
1866
|
-
return s.extensions &&
|
|
1866
|
+
return s.extensions && He(i, c[0], s), c[0];
|
|
1867
1867
|
const u = new $e();
|
|
1868
|
-
s.extensions &&
|
|
1868
|
+
s.extensions && He(i, u, s), t.associations.set(u, { meshes: e });
|
|
1869
1869
|
for (let d = 0, m = c.length; d < m; d++)
|
|
1870
1870
|
u.add(c[d]);
|
|
1871
1871
|
return u;
|
|
@@ -1885,7 +1885,7 @@ class us {
|
|
|
1885
1885
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1886
1886
|
return;
|
|
1887
1887
|
}
|
|
1888
|
-
return n.type === "perspective" ? t = new xn(
|
|
1888
|
+
return n.type === "perspective" ? t = new xn(ne.radToDeg(i.yfov), i.aspectRatio || 1, i.znear || 1, i.zfar || 2e6) : n.type === "orthographic" && (t = new ii(-i.xmag, i.xmag, i.ymag, -i.ymag, i.znear, i.zfar)), n.name && (t.name = this.createUniqueName(n.name)), Ie(t, n), Promise.resolve(t);
|
|
1889
1889
|
}
|
|
1890
1890
|
/**
|
|
1891
1891
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1904,7 +1904,7 @@ class us {
|
|
|
1904
1904
|
const c = o[r];
|
|
1905
1905
|
if (c) {
|
|
1906
1906
|
a.push(c);
|
|
1907
|
-
const u = new
|
|
1907
|
+
const u = new j();
|
|
1908
1908
|
s !== null && u.fromArray(s.array, r * 16), l.push(u);
|
|
1909
1909
|
} else
|
|
1910
1910
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[r]);
|
|
@@ -1922,8 +1922,8 @@ class us {
|
|
|
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 = [], h = [];
|
|
1924
1924
|
for (let c = 0, u = i.channels.length; c < u; c++) {
|
|
1925
|
-
const d = i.channels[c], m = i.samplers[d.sampler], y = d.target, g = y.node, b = i.parameters !== void 0 ? i.parameters[m.input] : m.input,
|
|
1926
|
-
y.node !== void 0 && (o.push(this.getDependency("node", g)), a.push(this.getDependency("accessor", b)), l.push(this.getDependency("accessor",
|
|
1925
|
+
const d = i.channels[c], m = i.samplers[d.sampler], y = d.target, g = y.node, b = i.parameters !== void 0 ? i.parameters[m.input] : m.input, A = i.parameters !== void 0 ? i.parameters[m.output] : m.output;
|
|
1926
|
+
y.node !== void 0 && (o.push(this.getDependency("node", g)), a.push(this.getDependency("accessor", b)), l.push(this.getDependency("accessor", A)), r.push(m), h.push(y));
|
|
1927
1927
|
}
|
|
1928
1928
|
return Promise.all([
|
|
1929
1929
|
Promise.all(o),
|
|
@@ -1933,17 +1933,17 @@ class us {
|
|
|
1933
1933
|
Promise.all(h)
|
|
1934
1934
|
]).then(function(c) {
|
|
1935
1935
|
const u = c[0], d = c[1], m = c[2], y = c[3], g = c[4], b = [];
|
|
1936
|
-
for (let f = 0,
|
|
1937
|
-
const T = u[f],
|
|
1936
|
+
for (let f = 0, L = u.length; f < L; f++) {
|
|
1937
|
+
const T = u[f], v = d[f], E = m[f], z = y[f], O = g[f];
|
|
1938
1938
|
if (T === void 0) continue;
|
|
1939
1939
|
T.updateMatrix && T.updateMatrix();
|
|
1940
|
-
const
|
|
1941
|
-
if (
|
|
1942
|
-
for (let
|
|
1943
|
-
b.push(
|
|
1940
|
+
const W = n._createAnimationTracks(T, v, E, z, O);
|
|
1941
|
+
if (W)
|
|
1942
|
+
for (let I = 0; I < W.length; I++)
|
|
1943
|
+
b.push(W[I]);
|
|
1944
1944
|
}
|
|
1945
|
-
const
|
|
1946
|
-
return
|
|
1945
|
+
const A = new Rn(s, void 0, b);
|
|
1946
|
+
return Ie(A, i), A;
|
|
1947
1947
|
});
|
|
1948
1948
|
}
|
|
1949
1949
|
createNodeMesh(e) {
|
|
@@ -2000,11 +2000,11 @@ class us {
|
|
|
2000
2000
|
a.push(r);
|
|
2001
2001
|
}), this.nodeCache[e] = Promise.all(a).then(function(r) {
|
|
2002
2002
|
let h;
|
|
2003
|
-
if (s.isBone === !0 ? h = new Pt() : r.length > 1 ? h = new $e() : r.length === 1 ? h = r[0] : h = new
|
|
2003
|
+
if (s.isBone === !0 ? h = new Pt() : r.length > 1 ? h = new $e() : r.length === 1 ? h = r[0] : h = new Fe(), h !== r[0])
|
|
2004
2004
|
for (let c = 0, u = r.length; c < u; c++)
|
|
2005
2005
|
h.add(r[c]);
|
|
2006
|
-
if (s.name && (h.userData.name = s.name, h.name = o),
|
|
2007
|
-
const c = new
|
|
2006
|
+
if (s.name && (h.userData.name = s.name, h.name = o), Ie(h, s), s.extensions && He(n, h, s), s.matrix !== void 0) {
|
|
2007
|
+
const c = new j();
|
|
2008
2008
|
c.fromArray(s.matrix), h.applyMatrix4(c);
|
|
2009
2009
|
} else
|
|
2010
2010
|
s.translation !== void 0 && h.position.fromArray(s.translation), s.rotation !== void 0 && h.quaternion.fromArray(s.rotation), s.scale !== void 0 && h.scale.fromArray(s.scale);
|
|
@@ -2026,7 +2026,7 @@ class us {
|
|
|
2026
2026
|
*/
|
|
2027
2027
|
loadScene(e) {
|
|
2028
2028
|
const t = this.extensions, n = this.json.scenes[e], i = this, s = new $e();
|
|
2029
|
-
n.name && (s.name = i.createUniqueName(n.name)),
|
|
2029
|
+
n.name && (s.name = i.createUniqueName(n.name)), Ie(s, n), n.extensions && He(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 us {
|
|
|
2047
2047
|
}
|
|
2048
2048
|
_createAnimationTracks(e, t, n, i, s) {
|
|
2049
2049
|
const o = [], a = e.name ? e.name : e.uuid, l = [];
|
|
2050
|
-
|
|
2050
|
+
Ce[s.path] === Ce.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 (Ce[s.path]) {
|
|
2055
|
+
case Ce.weights:
|
|
2056
2056
|
r = Ot;
|
|
2057
2057
|
break;
|
|
2058
|
-
case
|
|
2058
|
+
case Ce.rotation:
|
|
2059
2059
|
r = bt;
|
|
2060
2060
|
break;
|
|
2061
|
-
case
|
|
2062
|
-
case
|
|
2061
|
+
case Ce.translation:
|
|
2062
|
+
case Ce.scale:
|
|
2063
2063
|
r = Dt;
|
|
2064
2064
|
break;
|
|
2065
2065
|
default:
|
|
@@ -2078,7 +2078,7 @@ class us {
|
|
|
2078
2078
|
const h = i.interpolation !== void 0 ? ss[i.interpolation] : vn, c = 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] + "." + Ce[s.path],
|
|
2082
2082
|
t.array,
|
|
2083
2083
|
c,
|
|
2084
2084
|
h
|
|
@@ -2110,8 +2110,8 @@ function ds(p, e, t) {
|
|
|
2110
2110
|
const a = t.json.accessors[n.POSITION], l = a.min, r = a.max;
|
|
2111
2111
|
if (l !== void 0 && r !== void 0) {
|
|
2112
2112
|
if (i.set(
|
|
2113
|
-
new
|
|
2114
|
-
new
|
|
2113
|
+
new B(l[0], l[1], l[2]),
|
|
2114
|
+
new B(r[0], r[1], r[2])
|
|
2115
2115
|
), a.normalized) {
|
|
2116
2116
|
const h = Nt(Ye[a.componentType]);
|
|
2117
2117
|
i.min.multiplyScalar(h), i.max.multiplyScalar(h);
|
|
@@ -2124,7 +2124,7 @@ function ds(p, e, t) {
|
|
|
2124
2124
|
return;
|
|
2125
2125
|
const s = e.targets;
|
|
2126
2126
|
if (s !== void 0) {
|
|
2127
|
-
const a = new
|
|
2127
|
+
const a = new B(), l = new B();
|
|
2128
2128
|
for (let r = 0, h = s.length; r < h; r++) {
|
|
2129
2129
|
const c = s[r];
|
|
2130
2130
|
if (c.POSITION !== void 0) {
|
|
@@ -2162,12 +2162,12 @@ function $t(p, e, t) {
|
|
|
2162
2162
|
});
|
|
2163
2163
|
i.push(o);
|
|
2164
2164
|
}
|
|
2165
|
-
return
|
|
2165
|
+
return be.workingColorSpace !== Le && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${be.workingColorSpace}" not supported.`), Ie(p, e), ds(p, e, t), Promise.all(i).then(function() {
|
|
2166
2166
|
return e.targets !== void 0 ? as(p, e.targets, t) : p;
|
|
2167
2167
|
});
|
|
2168
2168
|
}
|
|
2169
2169
|
const St = /* @__PURE__ */ new WeakMap();
|
|
2170
|
-
class ps extends
|
|
2170
|
+
class ps extends it {
|
|
2171
2171
|
/**
|
|
2172
2172
|
* Constructs a new Draco loader.
|
|
2173
2173
|
*
|
|
@@ -2224,7 +2224,7 @@ class ps extends nt {
|
|
|
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 st(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 ps extends nt {
|
|
|
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 = Le, o = () => {
|
|
2245
2245
|
}) {
|
|
2246
2246
|
const a = {
|
|
2247
2247
|
attributeIDs: n || this.defaultAttributeIDs,
|
|
@@ -2283,13 +2283,13 @@ class ps extends nt {
|
|
|
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 ie();
|
|
2288
2288
|
for (let i = 0, s = e.count; i < s; i++)
|
|
2289
|
-
n.fromBufferAttribute(e, i),
|
|
2289
|
+
n.fromBufferAttribute(e, i), be.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 st(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
|
});
|
|
@@ -2394,15 +2394,15 @@ function ms() {
|
|
|
2394
2394
|
const y = { index: null, attributes: [] };
|
|
2395
2395
|
for (const g in h) {
|
|
2396
2396
|
const b = self[c[g]];
|
|
2397
|
-
let
|
|
2397
|
+
let A, f;
|
|
2398
2398
|
if (r.useUniqueIDs)
|
|
2399
|
-
f = h[g],
|
|
2399
|
+
f = h[g], A = a.GetAttributeByUniqueId(u, f);
|
|
2400
2400
|
else {
|
|
2401
2401
|
if (f = a.GetAttributeId(u, o[h[g]]), f === -1) continue;
|
|
2402
|
-
|
|
2402
|
+
A = a.GetAttribute(u, f);
|
|
2403
2403
|
}
|
|
2404
|
-
const
|
|
2405
|
-
g === "color" && (
|
|
2404
|
+
const L = i(o, a, u, g, b, A);
|
|
2405
|
+
g === "color" && (L.vertexColorSpace = r.vertexColorSpace), y.attributes.push(L);
|
|
2406
2406
|
}
|
|
2407
2407
|
return m === o.TRIANGULAR_MESH && (y.index = n(o, a, u)), o.destroy(u), y;
|
|
2408
2408
|
}
|
|
@@ -2415,10 +2415,10 @@ function ms() {
|
|
|
2415
2415
|
function i(o, a, l, r, h, c) {
|
|
2416
2416
|
const u = c.num_components(), m = l.num_points() * u, y = m * h.BYTES_PER_ELEMENT, g = s(o, h), b = o._malloc(y);
|
|
2417
2417
|
a.GetAttributeDataArrayForAllPoints(l, c, g, y, b);
|
|
2418
|
-
const
|
|
2418
|
+
const A = new h(o.HEAPF32.buffer, b, m).slice();
|
|
2419
2419
|
return o._free(b), {
|
|
2420
2420
|
name: r,
|
|
2421
|
-
array:
|
|
2421
|
+
array: A,
|
|
2422
2422
|
itemSize: u
|
|
2423
2423
|
};
|
|
2424
2424
|
}
|
|
@@ -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
|
|
2450
|
+
var ge = Uint8Array, Ve = Uint16Array, fs = Int32Array, Sn = new ge([
|
|
2451
2451
|
0,
|
|
2452
2452
|
0,
|
|
2453
2453
|
0,
|
|
@@ -2482,7 +2482,7 @@ var fe = Uint8Array, Ve = Uint16Array, fs = Int32Array, Sn = new fe([
|
|
|
2482
2482
|
0,
|
|
2483
2483
|
/* impossible */
|
|
2484
2484
|
0
|
|
2485
|
-
]), Tn = new
|
|
2485
|
+
]), Tn = new ge([
|
|
2486
2486
|
0,
|
|
2487
2487
|
0,
|
|
2488
2488
|
0,
|
|
@@ -2516,7 +2516,7 @@ var fe = Uint8Array, Ve = Uint16Array, fs = Int32Array, Sn = new fe([
|
|
|
2516
2516
|
/* unused */
|
|
2517
2517
|
0,
|
|
2518
2518
|
0
|
|
2519
|
-
]), gs = new
|
|
2519
|
+
]), gs = new ge([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), kn = function(p, e) {
|
|
2520
2520
|
for (var t = new Ve(31), n = 0; n < 31; ++n)
|
|
2521
2521
|
t[n] = e += 1 << p[n - 1];
|
|
2522
2522
|
for (var i = new fs(t[30]), n = 1; n < 30; ++n)
|
|
@@ -2526,9 +2526,9 @@ var fe = Uint8Array, Ve = Uint16Array, fs = Int32Array, Sn = new fe([
|
|
|
2526
2526
|
}, Cn = kn(Sn, 2), En = Cn.b, ys = Cn.r;
|
|
2527
2527
|
En[28] = 258, ys[258] = 28;
|
|
2528
2528
|
var xs = kn(Tn, 0), bs = xs.b, Bt = new Ve(32768);
|
|
2529
|
-
for (var
|
|
2530
|
-
var
|
|
2531
|
-
|
|
2529
|
+
for (var Z = 0; Z < 32768; ++Z) {
|
|
2530
|
+
var Ee = (Z & 43690) >> 1 | (Z & 21845) << 1;
|
|
2531
|
+
Ee = (Ee & 52428) >> 2 | (Ee & 13107) << 2, Ee = (Ee & 61680) >> 4 | (Ee & 3855) << 4, Bt[Z] = ((Ee & 65280) >> 8 | (Ee & 255) << 8) >> 1;
|
|
2532
2532
|
}
|
|
2533
2533
|
var et = (function(p, e, t) {
|
|
2534
2534
|
for (var n = p.length, i = 0, s = new Ve(e); i < n; ++i)
|
|
@@ -2548,23 +2548,23 @@ var et = (function(p, e, t) {
|
|
|
2548
2548
|
for (a = new Ve(n), i = 0; i < n; ++i)
|
|
2549
2549
|
p[i] && (a[i] = Bt[o[p[i] - 1]++] >> 15 - p[i]);
|
|
2550
2550
|
return a;
|
|
2551
|
-
}),
|
|
2552
|
-
for (var
|
|
2553
|
-
|
|
2554
|
-
for (var
|
|
2555
|
-
|
|
2556
|
-
for (var
|
|
2557
|
-
|
|
2558
|
-
for (var
|
|
2559
|
-
|
|
2560
|
-
var Mn = new
|
|
2561
|
-
for (var
|
|
2562
|
-
Mn[
|
|
2563
|
-
var Rs = /* @__PURE__ */ et(
|
|
2551
|
+
}), ct = new ge(288);
|
|
2552
|
+
for (var Z = 0; Z < 144; ++Z)
|
|
2553
|
+
ct[Z] = 8;
|
|
2554
|
+
for (var Z = 144; Z < 256; ++Z)
|
|
2555
|
+
ct[Z] = 9;
|
|
2556
|
+
for (var Z = 256; Z < 280; ++Z)
|
|
2557
|
+
ct[Z] = 7;
|
|
2558
|
+
for (var Z = 280; Z < 288; ++Z)
|
|
2559
|
+
ct[Z] = 8;
|
|
2560
|
+
var Mn = new ge(32);
|
|
2561
|
+
for (var Z = 0; Z < 32; ++Z)
|
|
2562
|
+
Mn[Z] = 5;
|
|
2563
|
+
var Rs = /* @__PURE__ */ et(ct, 9, 1), vs = /* @__PURE__ */ et(Mn, 5, 1), Tt = function(p) {
|
|
2564
2564
|
for (var e = p[0], t = 1; t < p.length; ++t)
|
|
2565
2565
|
p[t] > e && (e = p[t]);
|
|
2566
2566
|
return e;
|
|
2567
|
-
},
|
|
2567
|
+
}, ye = 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
|
}, kt = function(p, e) {
|
|
@@ -2573,7 +2573,7 @@ var Rs = /* @__PURE__ */ et(lt, 9, 1), vs = /* @__PURE__ */ et(Mn, 5, 1), Tt = f
|
|
|
2573
2573
|
}, As = function(p) {
|
|
2574
2574
|
return (p + 7) / 8 | 0;
|
|
2575
2575
|
}, Is = function(p, e, t) {
|
|
2576
|
-
return (t == null || t > p.length) && (t = p.length), new
|
|
2576
|
+
return (t == null || t > p.length) && (t = p.length), new ge(p.subarray(e, t));
|
|
2577
2577
|
}, Ls = [
|
|
2578
2578
|
"unexpected EOF",
|
|
2579
2579
|
"invalid block type",
|
|
@@ -2590,112 +2590,112 @@ var Rs = /* @__PURE__ */ et(lt, 9, 1), vs = /* @__PURE__ */ et(Mn, 5, 1), Tt = f
|
|
|
2590
2590
|
"stream finishing",
|
|
2591
2591
|
"invalid zip data"
|
|
2592
2592
|
// determined by unknown compression method
|
|
2593
|
-
],
|
|
2593
|
+
], xe = function(p, e, t) {
|
|
2594
2594
|
var n = new Error(e || Ls[p]);
|
|
2595
|
-
if (n.code = p, Error.captureStackTrace && Error.captureStackTrace(n,
|
|
2595
|
+
if (n.code = p, Error.captureStackTrace && Error.captureStackTrace(n, xe), !t)
|
|
2596
2596
|
throw n;
|
|
2597
2597
|
return n;
|
|
2598
2598
|
}, ws = function(p, e, t, n) {
|
|
2599
2599
|
var i = p.length, s = 0;
|
|
2600
2600
|
if (!i || e.f && !e.l)
|
|
2601
|
-
return t || new
|
|
2601
|
+
return t || new ge(0);
|
|
2602
2602
|
var o = !t, a = o || e.i != 2, l = e.i;
|
|
2603
|
-
o && (t = new
|
|
2604
|
-
var r = function(
|
|
2603
|
+
o && (t = new ge(i * 3));
|
|
2604
|
+
var r = function(ht) {
|
|
2605
2605
|
var _e = t.length;
|
|
2606
|
-
if (
|
|
2607
|
-
var Xt = new
|
|
2606
|
+
if (ht > _e) {
|
|
2607
|
+
var Xt = new ge(Math.max(_e * 2, ht));
|
|
2608
2608
|
Xt.set(t), t = Xt;
|
|
2609
2609
|
}
|
|
2610
2610
|
}, h = e.f || 0, c = e.p || 0, u = e.b || 0, d = e.l, m = e.d, y = e.m, g = e.n, b = i * 8;
|
|
2611
2611
|
do {
|
|
2612
2612
|
if (!d) {
|
|
2613
|
-
h =
|
|
2614
|
-
var
|
|
2615
|
-
if (c += 3,
|
|
2616
|
-
if (
|
|
2613
|
+
h = ye(p, c, 1);
|
|
2614
|
+
var A = ye(p, c + 1, 3);
|
|
2615
|
+
if (c += 3, A)
|
|
2616
|
+
if (A == 1)
|
|
2617
2617
|
d = Rs, m = vs, y = 9, g = 5;
|
|
2618
|
-
else if (
|
|
2619
|
-
var
|
|
2618
|
+
else if (A == 2) {
|
|
2619
|
+
var v = ye(p, c, 31) + 257, E = ye(p, c + 10, 15) + 4, z = v + ye(p, c + 5, 31) + 1;
|
|
2620
2620
|
c += 14;
|
|
2621
|
-
for (var
|
|
2622
|
-
|
|
2623
|
-
c +=
|
|
2624
|
-
for (var
|
|
2625
|
-
var
|
|
2626
|
-
c +=
|
|
2627
|
-
var f =
|
|
2621
|
+
for (var O = new ge(z), W = new ge(19), I = 0; I < E; ++I)
|
|
2622
|
+
W[gs[I]] = ye(p, c + I * 3, 7);
|
|
2623
|
+
c += E * 3;
|
|
2624
|
+
for (var D = Tt(W), Y = (1 << D) - 1, q = et(W, D, 1), I = 0; I < z; ) {
|
|
2625
|
+
var se = q[ye(p, c, Y)];
|
|
2626
|
+
c += se & 15;
|
|
2627
|
+
var f = se >> 4;
|
|
2628
2628
|
if (f < 16)
|
|
2629
|
-
|
|
2629
|
+
O[I++] = f;
|
|
2630
2630
|
else {
|
|
2631
|
-
var
|
|
2632
|
-
for (f == 16 ? (
|
|
2633
|
-
|
|
2631
|
+
var ee = 0, Re = 0;
|
|
2632
|
+
for (f == 16 ? (Re = 3 + ye(p, c, 3), c += 2, ee = O[I - 1]) : f == 17 ? (Re = 3 + ye(p, c, 7), c += 3) : f == 18 && (Re = 11 + ye(p, c, 127), c += 7); Re--; )
|
|
2633
|
+
O[I++] = ee;
|
|
2634
2634
|
}
|
|
2635
2635
|
}
|
|
2636
|
-
var
|
|
2637
|
-
y = Tt(
|
|
2636
|
+
var De = O.subarray(0, v), K = O.subarray(v);
|
|
2637
|
+
y = Tt(De), g = Tt(K), d = et(De, y, 1), m = et(K, g, 1);
|
|
2638
2638
|
} else
|
|
2639
|
-
|
|
2639
|
+
xe(1);
|
|
2640
2640
|
else {
|
|
2641
|
-
var f = As(c) + 4,
|
|
2641
|
+
var f = As(c) + 4, L = p[f - 4] | p[f - 3] << 8, T = f + L;
|
|
2642
2642
|
if (T > i) {
|
|
2643
|
-
l &&
|
|
2643
|
+
l && xe(0);
|
|
2644
2644
|
break;
|
|
2645
2645
|
}
|
|
2646
|
-
a && r(u +
|
|
2646
|
+
a && r(u + L), t.set(p.subarray(f, T), u), e.b = u += L, e.p = c = T * 8, e.f = h;
|
|
2647
2647
|
continue;
|
|
2648
2648
|
}
|
|
2649
2649
|
if (c > b) {
|
|
2650
|
-
l &&
|
|
2650
|
+
l && xe(0);
|
|
2651
2651
|
break;
|
|
2652
2652
|
}
|
|
2653
2653
|
}
|
|
2654
2654
|
a && r(u + 131072);
|
|
2655
|
-
for (var
|
|
2656
|
-
var
|
|
2657
|
-
if (c +=
|
|
2658
|
-
l &&
|
|
2655
|
+
for (var S = (1 << y) - 1, w = (1 << g) - 1, F = c; ; F = c) {
|
|
2656
|
+
var ee = d[kt(p, c) & S], k = ee >> 4;
|
|
2657
|
+
if (c += ee & 15, c > b) {
|
|
2658
|
+
l && xe(0);
|
|
2659
2659
|
break;
|
|
2660
2660
|
}
|
|
2661
|
-
if (
|
|
2662
|
-
t[u++] =
|
|
2663
|
-
else if (
|
|
2664
|
-
|
|
2661
|
+
if (ee || xe(2), k < 256)
|
|
2662
|
+
t[u++] = k;
|
|
2663
|
+
else if (k == 256) {
|
|
2664
|
+
F = c, d = null;
|
|
2665
2665
|
break;
|
|
2666
2666
|
} else {
|
|
2667
|
-
var
|
|
2668
|
-
if (
|
|
2669
|
-
var
|
|
2670
|
-
|
|
2667
|
+
var _ = k - 254;
|
|
2668
|
+
if (k > 264) {
|
|
2669
|
+
var I = k - 257, G = Sn[I];
|
|
2670
|
+
_ = ye(p, c, (1 << G) - 1) + En[I], c += G;
|
|
2671
2671
|
}
|
|
2672
|
-
var
|
|
2673
|
-
|
|
2674
|
-
var
|
|
2675
|
-
if (
|
|
2676
|
-
var
|
|
2677
|
-
|
|
2672
|
+
var X = m[kt(p, c) & w], Se = X >> 4;
|
|
2673
|
+
X || xe(3), c += X & 15;
|
|
2674
|
+
var K = bs[Se];
|
|
2675
|
+
if (Se > 3) {
|
|
2676
|
+
var G = Tn[Se];
|
|
2677
|
+
K += kt(p, c) & (1 << G) - 1, c += G;
|
|
2678
2678
|
}
|
|
2679
2679
|
if (c > b) {
|
|
2680
|
-
l &&
|
|
2680
|
+
l && xe(0);
|
|
2681
2681
|
break;
|
|
2682
2682
|
}
|
|
2683
2683
|
a && r(u + 131072);
|
|
2684
|
-
var
|
|
2685
|
-
if (u <
|
|
2686
|
-
var Oe = s -
|
|
2687
|
-
for (Oe + u < 0 &&
|
|
2684
|
+
var ce = u + _;
|
|
2685
|
+
if (u < K) {
|
|
2686
|
+
var Oe = s - K, Rt = Math.min(K, ce);
|
|
2687
|
+
for (Oe + u < 0 && xe(3); u < Rt; ++u)
|
|
2688
2688
|
t[u] = n[Oe + u];
|
|
2689
2689
|
}
|
|
2690
|
-
for (; u <
|
|
2691
|
-
t[u] = t[u -
|
|
2690
|
+
for (; u < ce; ++u)
|
|
2691
|
+
t[u] = t[u - K];
|
|
2692
2692
|
}
|
|
2693
2693
|
}
|
|
2694
|
-
e.l = d, e.p =
|
|
2694
|
+
e.l = d, e.p = F, e.b = u, e.f = h, d && (h = 1, e.m = y, e.d = m, e.n = g);
|
|
2695
2695
|
} while (!h);
|
|
2696
2696
|
return u != t.length && o ? Is(t, 0, u) : t.subarray(0, u);
|
|
2697
|
-
}, Ss = /* @__PURE__ */ new
|
|
2698
|
-
return ((p[0] & 15) != 8 || p[0] >> 4 > 7 || (p[0] << 8 | p[1]) % 31) &&
|
|
2697
|
+
}, Ss = /* @__PURE__ */ new ge(0), Ts = function(p, e) {
|
|
2698
|
+
return ((p[0] & 15) != 8 || p[0] >> 4 > 7 || (p[0] << 8 | p[1]) % 31) && xe(6, "invalid zlib data"), (p[1] >> 5 & 1) == 1 && xe(6, "invalid zlib data: " + (p[1] & 32 ? "need" : "unexpected") + " dictionary"), (p[1] >> 3 & 4) + 2;
|
|
2699
2699
|
};
|
|
2700
2700
|
function ks(p, e) {
|
|
2701
2701
|
return ws(p.subarray(Ts(p), -4), { i: 2 }, e, e);
|
|
@@ -2731,7 +2731,7 @@ function Ms(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 = Ms(i, n, p, e), o = new
|
|
2734
|
+
const i = zn(p, n, e), s = Ms(i, n, p, e), o = new rt(0, 0, 0, 0);
|
|
2735
2735
|
for (let a = 0; a <= p; ++a) {
|
|
2736
2736
|
const l = t[i - p + a], r = s[a], h = l.w * r;
|
|
2737
2737
|
o.x += l.x * h, o.y += l.y * h, o.z += l.z * h, o.w += l.w * r;
|
|
@@ -2771,12 +2771,12 @@ function Hs(p, e, t, n, i) {
|
|
|
2771
2771
|
m[0][0] = 1;
|
|
2772
2772
|
for (let y = 1; y <= n; ++y) {
|
|
2773
2773
|
let g = 0;
|
|
2774
|
-
const b = c - y,
|
|
2775
|
-
c >= y && (m[d][0] = m[u][0] / a[
|
|
2776
|
-
const f = b >= -1 ? 1 : -b,
|
|
2777
|
-
for (let
|
|
2778
|
-
m[d][
|
|
2779
|
-
c <=
|
|
2774
|
+
const b = c - y, A = t - y;
|
|
2775
|
+
c >= y && (m[d][0] = m[u][0] / a[A + 1][b], g = m[d][0] * a[b][A]);
|
|
2776
|
+
const f = b >= -1 ? 1 : -b, L = c - 1 <= A ? y - 1 : t - c;
|
|
2777
|
+
for (let v = f; v <= L; ++v)
|
|
2778
|
+
m[d][v] = (m[u][v] - m[u][v - 1]) / a[A + 1][b + v], g += m[d][v] * a[b + v][A];
|
|
2779
|
+
c <= A && (m[d][y] = -m[u][y - 1] / a[A + 1][c], g += m[d][y] * a[c][A]), o[y][c] = g;
|
|
2780
2780
|
const T = u;
|
|
2781
2781
|
u = d, d = T;
|
|
2782
2782
|
}
|
|
@@ -2802,7 +2802,7 @@ function Ps(p, e, t, n, i) {
|
|
|
2802
2802
|
o[h] = c;
|
|
2803
2803
|
}
|
|
2804
2804
|
for (let h = s + 1; h <= i + 1; ++h)
|
|
2805
|
-
o[h] = new
|
|
2805
|
+
o[h] = new rt(0, 0, 0);
|
|
2806
2806
|
return o;
|
|
2807
2807
|
}
|
|
2808
2808
|
function Fs(p, e) {
|
|
@@ -2820,7 +2820,7 @@ function Ds(p) {
|
|
|
2820
2820
|
const e = p.length, t = [], n = [];
|
|
2821
2821
|
for (let s = 0; s < e; ++s) {
|
|
2822
2822
|
const o = p[s];
|
|
2823
|
-
t[s] = new
|
|
2823
|
+
t[s] = new B(o.x, o.y, o.z), n[s] = o.w;
|
|
2824
2824
|
}
|
|
2825
2825
|
const i = [];
|
|
2826
2826
|
for (let s = 0; s < e; ++s) {
|
|
@@ -2851,7 +2851,7 @@ class _s extends ci {
|
|
|
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 rt(r.x, r.y, r.z, r.w);
|
|
2855
2855
|
}
|
|
2856
2856
|
}
|
|
2857
2857
|
/**
|
|
@@ -2861,7 +2861,7 @@ class _s extends ci {
|
|
|
2861
2861
|
* @param {Vector3} [optionalTarget] - The optional target vector the result is written to.
|
|
2862
2862
|
* @return {Vector3} The position on the curve.
|
|
2863
2863
|
*/
|
|
2864
|
-
getPoint(e, t = new
|
|
2864
|
+
getPoint(e, t = new B()) {
|
|
2865
2865
|
const n = t, i = this.knots[this.startKnot] + e * (this.knots[this.endKnot] - this.knots[this.startKnot]), s = zs(this.degree, this.knots, this.controlPoints, i);
|
|
2866
2866
|
return s.w !== 1 && s.divideScalar(s.w), n.set(s.x, s.y, s.z);
|
|
2867
2867
|
}
|
|
@@ -2872,7 +2872,7 @@ class _s extends ci {
|
|
|
2872
2872
|
* @param {Vector3} [optionalTarget] - The optional target vector the result is written to.
|
|
2873
2873
|
* @return {Vector3} The tangent vector.
|
|
2874
2874
|
*/
|
|
2875
|
-
getTangent(e, t = new
|
|
2875
|
+
getTangent(e, t = new B()) {
|
|
2876
2876
|
const n = t, i = this.knots[0] + e * (this.knots[this.knots.length - 1] - this.knots[0]), s = Os(this.degree, this.knots, this.controlPoints, i, 1);
|
|
2877
2877
|
return n.copy(s[1]).normalize(), n;
|
|
2878
2878
|
}
|
|
@@ -2881,11 +2881,11 @@ class _s extends ci {
|
|
|
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 rt(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 en extends
|
|
2887
|
+
let H, $, le;
|
|
2888
|
+
class en extends it {
|
|
2889
2889
|
/**
|
|
2890
2890
|
* Constructs a new FBX loader.
|
|
2891
2891
|
*
|
|
@@ -2904,7 +2904,7 @@ class en extends nt {
|
|
|
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 === "" ? Ze.extractUrlBase(e) : s.path, a = new
|
|
2907
|
+
const s = this, o = s.path === "" ? Ze.extractUrlBase(e) : s.path, a = new st(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 Ns {
|
|
|
2940
2940
|
this.textureLoader = e, this.manager = t;
|
|
2941
2941
|
}
|
|
2942
2942
|
parse() {
|
|
2943
|
-
|
|
2943
|
+
$ = this.parseConnections();
|
|
2944
2944
|
const e = this.parseImages(), t = this.parseTextures(e), n = this.parseMaterials(t), i = this.parseDeformers(), s = new Bs().parse(i);
|
|
2945
|
-
return this.parseScene(i, s, n),
|
|
2945
|
+
return this.parseScene(i, s, n), le;
|
|
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 Ns {
|
|
|
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 ? ot : Ht, n.wrapT = a === 0 ? ot : Ht, "Scaling" in e) {
|
|
3045
3045
|
const l = e.Scaling.value;
|
|
3046
3046
|
n.repeat.x = l[0], n.repeat.y = l[1];
|
|
3047
3047
|
}
|
|
@@ -3058,7 +3058,7 @@ class Ns {
|
|
|
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 = $.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 Ft();
|
|
@@ -3083,18 +3083,18 @@ class Ns {
|
|
|
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), !$.has(n)) return null;
|
|
3087
3087
|
const o = this.parseParameters(e, t, n);
|
|
3088
3088
|
let a;
|
|
3089
3089
|
switch (s.toLowerCase()) {
|
|
3090
3090
|
case "phong":
|
|
3091
|
-
a = new
|
|
3091
|
+
a = new ut();
|
|
3092
3092
|
break;
|
|
3093
3093
|
case "lambert":
|
|
3094
3094
|
a = new An();
|
|
3095
3095
|
break;
|
|
3096
3096
|
default:
|
|
3097
|
-
console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', s), a = new
|
|
3097
|
+
console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', s), a = new ut();
|
|
3098
3098
|
break;
|
|
3099
3099
|
}
|
|
3100
3100
|
return a.setValues(o), a.name = i, a;
|
|
@@ -3103,9 +3103,9 @@ class Ns {
|
|
|
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 = be.colorSpaceToWorking(new ie().fromArray(e.Diffuse.value), J) : e.DiffuseColor && (e.DiffuseColor.type === "Color" || e.DiffuseColor.type === "ColorRGB") && (i.color = be.colorSpaceToWorking(new ie().fromArray(e.DiffuseColor.value), J)), e.DisplacementFactor && (i.displacementScale = e.DisplacementFactor.value), e.Emissive ? i.emissive = be.colorSpaceToWorking(new ie().fromArray(e.Emissive.value), J) : e.EmissiveColor && (e.EmissiveColor.type === "Color" || e.EmissiveColor.type === "ColorRGB") && (i.emissive = be.colorSpaceToWorking(new ie().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 = be.colorSpaceToWorking(new ie().fromArray(e.Specular.value), J) : e.SpecularColor && e.SpecularColor.type === "Color" && (i.specular = be.colorSpaceToWorking(new ie().fromArray(e.SpecularColor.value), J));
|
|
3107
3107
|
const s = this;
|
|
3108
|
-
return
|
|
3108
|
+
return $.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 Ns {
|
|
|
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 Ns {
|
|
|
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 = $.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 Ns {
|
|
|
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 = $.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;
|
|
@@ -3192,7 +3192,7 @@ class Ns {
|
|
|
3192
3192
|
ID: i.ID,
|
|
3193
3193
|
indices: [],
|
|
3194
3194
|
weights: [],
|
|
3195
|
-
transformLink: new
|
|
3195
|
+
transformLink: new j().fromArray(s.TransformLink.a)
|
|
3196
3196
|
// transform: new Matrix4().fromArray( boneNode.Transform.a ),
|
|
3197
3197
|
// linkMode: boneNode.Mode,
|
|
3198
3198
|
};
|
|
@@ -3213,7 +3213,7 @@ class Ns {
|
|
|
3213
3213
|
fullWeights: o.FullWeights.a
|
|
3214
3214
|
};
|
|
3215
3215
|
if (o.attrType !== "BlendShapeChannel") return;
|
|
3216
|
-
a.geoID =
|
|
3216
|
+
a.geoID = $.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 Ns {
|
|
|
3221
3221
|
}
|
|
3222
3222
|
// create the main Group() to be returned by the loader
|
|
3223
3223
|
parseScene(e, t, n) {
|
|
3224
|
-
|
|
3224
|
+
le = new $e();
|
|
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), $.get(l.ID).parents.forEach(function(c) {
|
|
3229
3229
|
const u = i.get(c.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 && le.add(l);
|
|
3232
|
+
}), this.bindSkeleton(e.skeletons, t, i), this.addGlobalSceneSettings(), le.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 = Pn(l.userData.transformData);
|
|
@@ -3237,13 +3237,13 @@ class Ns {
|
|
|
3237
3237
|
}
|
|
3238
3238
|
});
|
|
3239
3239
|
const a = new Us().parse();
|
|
3240
|
-
|
|
3240
|
+
le.children.length === 1 && le.children[0].isGroup && (le.children[0].animations = a, le = le.children[0]), le.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 = $.get(a);
|
|
3247
3247
|
let h = this.buildSkeleton(r, e, a, l.attrName);
|
|
3248
3248
|
if (!h) {
|
|
3249
3249
|
switch (l.attrType) {
|
|
@@ -3268,7 +3268,7 @@ class Ns {
|
|
|
3268
3268
|
h = new $e();
|
|
3269
3269
|
break;
|
|
3270
3270
|
}
|
|
3271
|
-
h.name = l.attrName ?
|
|
3271
|
+
h.name = l.attrName ? at.sanitizeNodeName(l.attrName) : "", h.userData.originalName = l.attrName, h.ID = a;
|
|
3272
3272
|
}
|
|
3273
3273
|
this.getTransformData(h, l), i.set(a, h);
|
|
3274
3274
|
}
|
|
@@ -3282,7 +3282,7 @@ class Ns {
|
|
|
3282
3282
|
l.rawBones.forEach(function(r, h) {
|
|
3283
3283
|
if (r.ID === o.ID) {
|
|
3284
3284
|
const c = s;
|
|
3285
|
-
s = new Pt(), s.matrixWorld.copy(r.transformLink), s.name = i ?
|
|
3285
|
+
s = new Pt(), s.matrixWorld.copy(r.transformLink), s.name = i ? at.sanitizeNodeName(i) : "", s.userData.originalName = i, s.ID = n, l.bones[h] = s, c !== null && s.add(c);
|
|
3286
3286
|
}
|
|
3287
3287
|
});
|
|
3288
3288
|
}
|
|
@@ -3295,7 +3295,7 @@ class Ns {
|
|
|
3295
3295
|
const s = H.Objects.NodeAttribute[i.ID];
|
|
3296
3296
|
s !== void 0 && (n = s);
|
|
3297
3297
|
}), n === void 0)
|
|
3298
|
-
t = new
|
|
3298
|
+
t = new Fe();
|
|
3299
3299
|
else {
|
|
3300
3300
|
let i = 0;
|
|
3301
3301
|
n.CameraProjectionType !== void 0 && n.CameraProjectionType.value === 1 && (i = 1);
|
|
@@ -3314,10 +3314,10 @@ class Ns {
|
|
|
3314
3314
|
t = new xn(h, r, s, o), c !== null && t.setFocalLength(c);
|
|
3315
3315
|
break;
|
|
3316
3316
|
case 1:
|
|
3317
|
-
console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."), t = new
|
|
3317
|
+
console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."), t = new Fe();
|
|
3318
3318
|
break;
|
|
3319
3319
|
default:
|
|
3320
|
-
console.warn("THREE.FBXLoader: Unknown camera type " + i + "."), t = new
|
|
3320
|
+
console.warn("THREE.FBXLoader: Unknown camera type " + i + "."), t = new Fe();
|
|
3321
3321
|
break;
|
|
3322
3322
|
}
|
|
3323
3323
|
}
|
|
@@ -3330,12 +3330,12 @@ class Ns {
|
|
|
3330
3330
|
const s = H.Objects.NodeAttribute[i.ID];
|
|
3331
3331
|
s !== void 0 && (n = s);
|
|
3332
3332
|
}), n === void 0)
|
|
3333
|
-
t = new
|
|
3333
|
+
t = new Fe();
|
|
3334
3334
|
else {
|
|
3335
3335
|
let i;
|
|
3336
3336
|
n.LightType === void 0 ? i = 0 : i = n.LightType.value;
|
|
3337
3337
|
let s = 16777215;
|
|
3338
|
-
n.Color !== void 0 && (s =
|
|
3338
|
+
n.Color !== void 0 && (s = be.colorSpaceToWorking(new ie().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;
|
|
@@ -3350,9 +3350,9 @@ class Ns {
|
|
|
3350
3350
|
break;
|
|
3351
3351
|
case 2:
|
|
3352
3352
|
let r = Math.PI / 3;
|
|
3353
|
-
n.InnerAngle !== void 0 && (r =
|
|
3353
|
+
n.InnerAngle !== void 0 && (r = ne.degToRad(n.InnerAngle.value));
|
|
3354
3354
|
let h = 0;
|
|
3355
|
-
n.OuterAngle !== void 0 && (h =
|
|
3355
|
+
n.OuterAngle !== void 0 && (h = ne.degToRad(n.OuterAngle.value), h = Math.max(h, 1)), t = new cn(s, o, a, r, h, l);
|
|
3356
3356
|
break;
|
|
3357
3357
|
default:
|
|
3358
3358
|
console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new yt(s, o);
|
|
@@ -3367,8 +3367,8 @@ class Ns {
|
|
|
3367
3367
|
const a = [];
|
|
3368
3368
|
if (e.children.forEach(function(l) {
|
|
3369
3369
|
t.has(l.ID) && (s = t.get(l.ID)), n.has(l.ID) && a.push(n.get(l.ID));
|
|
3370
|
-
}), a.length > 1 ? o = a : a.length > 0 ? o = a[0] : (o = new
|
|
3371
|
-
name:
|
|
3370
|
+
}), a.length > 1 ? o = a : a.length > 0 ? o = a[0] : (o = new ut({
|
|
3371
|
+
name: it.DEFAULT_MATERIAL_NAME,
|
|
3372
3372
|
color: 13421772
|
|
3373
3373
|
}), a.push(o)), "color" in s.attributes && a.forEach(function(l) {
|
|
3374
3374
|
l.vertexColors = !0;
|
|
@@ -3379,17 +3379,17 @@ class Ns {
|
|
|
3379
3379
|
(c.materialIndex < 0 || c.materialIndex >= a.length) && (c.materialIndex = a.length, l = !0);
|
|
3380
3380
|
}
|
|
3381
3381
|
if (l) {
|
|
3382
|
-
const r = new
|
|
3382
|
+
const r = new ut();
|
|
3383
3383
|
a.push(r);
|
|
3384
3384
|
}
|
|
3385
3385
|
}
|
|
3386
|
-
return s.FBX_Deformer ? (i = new gn(s, o), i.normalizeSkinWeights()) : i = new
|
|
3386
|
+
return s.FBX_Deformer ? (i = new gn(s, o), i.normalizeSkinWeights()) : i = new ke(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 fn({
|
|
3392
|
-
name:
|
|
3392
|
+
name: it.DEFAULT_MATERIAL_NAME,
|
|
3393
3393
|
color: 3342591,
|
|
3394
3394
|
linewidth: 1
|
|
3395
3395
|
});
|
|
@@ -3398,15 +3398,15 @@ class Ns {
|
|
|
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 = lt(t.RotationOrder.value) : n.eulerOrder = lt(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 && $.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), le.add(e.target)) : e.lookAt(new B().fromArray(o));
|
|
3410
3410
|
}
|
|
3411
3411
|
}
|
|
3412
3412
|
});
|
|
@@ -3415,10 +3415,10 @@ class Ns {
|
|
|
3415
3415
|
const i = this.parsePoseNodes();
|
|
3416
3416
|
for (const s in e) {
|
|
3417
3417
|
const o = e[s];
|
|
3418
|
-
|
|
3418
|
+
$.get(parseInt(o.ID)).parents.forEach(function(l) {
|
|
3419
3419
|
if (t.has(l.ID)) {
|
|
3420
3420
|
const r = l.ID;
|
|
3421
|
-
|
|
3421
|
+
$.get(r).parents.forEach(function(c) {
|
|
3422
3422
|
n.has(c.ID) && n.get(c.ID).bind(new bn(o.bones), i[c.ID]);
|
|
3423
3423
|
});
|
|
3424
3424
|
}
|
|
@@ -3433,8 +3433,8 @@ class Ns {
|
|
|
3433
3433
|
if (t[n].attrType === "BindPose" && t[n].NbPoseNodes > 0) {
|
|
3434
3434
|
const i = t[n].PoseNode;
|
|
3435
3435
|
Array.isArray(i) ? i.forEach(function(s) {
|
|
3436
|
-
e[s.Node] = new
|
|
3437
|
-
}) : e[i.Node] = new
|
|
3436
|
+
e[s.Node] = new j().fromArray(s.Matrix.a);
|
|
3437
|
+
}) : e[i.Node] = new j().fromArray(i.Matrix.a);
|
|
3438
3438
|
}
|
|
3439
3439
|
}
|
|
3440
3440
|
return e;
|
|
@@ -3444,11 +3444,11 @@ class Ns {
|
|
|
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 ie().setRGB(t, n, i, J);
|
|
3448
|
+
le.add(new ui(s, 1));
|
|
3449
3449
|
}
|
|
3450
3450
|
}
|
|
3451
|
-
"UnitScaleFactor" in H.GlobalSettings && (
|
|
3451
|
+
"UnitScaleFactor" in H.GlobalSettings && (le.userData.unitScaleFactor = H.GlobalSettings.UnitScaleFactor.value);
|
|
3452
3452
|
}
|
|
3453
3453
|
}
|
|
3454
3454
|
}
|
|
@@ -3462,7 +3462,7 @@ class Bs {
|
|
|
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 = $.get(parseInt(i)), o = this.parseGeometry(s, n[i], e);
|
|
3466
3466
|
t.set(parseInt(i), o);
|
|
3467
3467
|
}
|
|
3468
3468
|
}
|
|
@@ -3490,7 +3490,7 @@ class Bs {
|
|
|
3490
3490
|
n.morphTargets[c.ID] !== void 0 && s.push(n.morphTargets[c.ID]);
|
|
3491
3491
|
});
|
|
3492
3492
|
const l = o[0], r = {};
|
|
3493
|
-
"RotationOrder" in l && (r.eulerOrder =
|
|
3493
|
+
"RotationOrder" in l && (r.eulerOrder = lt(l.RotationOrder.value)), "InheritType" in l && (r.inheritType = parseInt(l.InheritType.value)), "GeometricTranslation" in l && (r.translation = l.GeometricTranslation.value), "GeometricRotation" in l && (r.rotation = l.GeometricRotation.value), "GeometricScaling" in l && (r.scale = l.GeometricScaling.value);
|
|
3494
3494
|
const h = Pn(r);
|
|
3495
3495
|
return this.genGeometry(t, a, s, h);
|
|
3496
3496
|
}
|
|
@@ -3550,46 +3550,46 @@ class Bs {
|
|
|
3550
3550
|
return e.vertexIndices.forEach(function(d, m) {
|
|
3551
3551
|
let y, g = !1;
|
|
3552
3552
|
d < 0 && (d = d ^ -1, g = !0);
|
|
3553
|
-
let b = [],
|
|
3553
|
+
let b = [], A = [];
|
|
3554
3554
|
if (o.push(d * 3, d * 3 + 1, d * 3 + 2), e.color) {
|
|
3555
|
-
const f =
|
|
3555
|
+
const f = pt(m, n, d, e.color);
|
|
3556
3556
|
l.push(f[0], f[1], f[2]);
|
|
3557
3557
|
}
|
|
3558
3558
|
if (e.skeleton) {
|
|
3559
3559
|
if (e.weightTable[d] !== void 0 && e.weightTable[d].forEach(function(f) {
|
|
3560
|
-
|
|
3561
|
-
}),
|
|
3560
|
+
A.push(f.weight), b.push(f.id);
|
|
3561
|
+
}), A.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 f = [0, 0, 0, 0],
|
|
3564
|
-
|
|
3565
|
-
let
|
|
3566
|
-
|
|
3567
|
-
if (
|
|
3568
|
-
|
|
3569
|
-
const
|
|
3570
|
-
f[
|
|
3563
|
+
const f = [0, 0, 0, 0], L = [0, 0, 0, 0];
|
|
3564
|
+
A.forEach(function(T, v) {
|
|
3565
|
+
let E = T, z = b[v];
|
|
3566
|
+
L.forEach(function(O, W, I) {
|
|
3567
|
+
if (E > O) {
|
|
3568
|
+
I[W] = E, E = O;
|
|
3569
|
+
const D = f[W];
|
|
3570
|
+
f[W] = z, z = D;
|
|
3571
3571
|
}
|
|
3572
3572
|
});
|
|
3573
|
-
}), b = f,
|
|
3573
|
+
}), b = f, A = L;
|
|
3574
3574
|
}
|
|
3575
|
-
for (;
|
|
3576
|
-
|
|
3575
|
+
for (; A.length < 4; )
|
|
3576
|
+
A.push(0), b.push(0);
|
|
3577
3577
|
for (let f = 0; f < 4; ++f)
|
|
3578
|
-
h.push(
|
|
3578
|
+
h.push(A[f]), c.push(b[f]);
|
|
3579
3579
|
}
|
|
3580
3580
|
if (e.normal) {
|
|
3581
|
-
const f =
|
|
3581
|
+
const f = pt(m, n, d, e.normal);
|
|
3582
3582
|
a.push(f[0], f[1], f[2]);
|
|
3583
3583
|
}
|
|
3584
|
-
e.material && e.material.mappingType !== "AllSame" && (y =
|
|
3585
|
-
const T =
|
|
3586
|
-
r[
|
|
3584
|
+
e.material && e.material.mappingType !== "AllSame" && (y = pt(m, n, d, e.material)[0], y < 0 && (u.negativeMaterialIndices = !0, y = 0)), e.uv && e.uv.forEach(function(f, L) {
|
|
3585
|
+
const T = pt(m, n, d, f);
|
|
3586
|
+
r[L] === void 0 && (r[L] = []), r[L].push(T[0]), r[L].push(T[1]);
|
|
3587
3587
|
}), i++, g && (u.genFace(t, e, o, y, a, l, r, h, c, i), n++, i = 0, o = [], a = [], l = [], r = [], h = [], c = []);
|
|
3588
3588
|
}), t;
|
|
3589
3589
|
}
|
|
3590
3590
|
// See https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal
|
|
3591
3591
|
getNormalNewell(e) {
|
|
3592
|
-
const t = new
|
|
3592
|
+
const t = new B(0, 0, 0);
|
|
3593
3593
|
for (let n = 0; n < e.length; n++) {
|
|
3594
3594
|
const i = e[n], s = e[(n + 1) % e.length];
|
|
3595
3595
|
t.x += (i.y - s.y) * (i.z + s.z), t.y += (i.z - s.z) * (i.x + s.x), t.z += (i.x - s.x) * (i.y + s.y);
|
|
@@ -3597,7 +3597,7 @@ class Bs {
|
|
|
3597
3597
|
return t.normalize(), t;
|
|
3598
3598
|
}
|
|
3599
3599
|
getNormalTangentAndBitangent(e) {
|
|
3600
|
-
const t = this.getNormalNewell(e), i = (Math.abs(t.z) > 0.5 ? new
|
|
3600
|
+
const t = this.getNormalNewell(e), i = (Math.abs(t.z) > 0.5 ? new B(0, 1, 0) : new B(0, 0, 1)).cross(t).normalize(), s = t.clone().cross(i).normalize();
|
|
3601
3601
|
return {
|
|
3602
3602
|
normal: t,
|
|
3603
3603
|
tangent: i,
|
|
@@ -3605,7 +3605,7 @@ class Bs {
|
|
|
3605
3605
|
};
|
|
3606
3606
|
}
|
|
3607
3607
|
flattenVertex(e, t, n) {
|
|
3608
|
-
return new
|
|
3608
|
+
return new de(
|
|
3609
3609
|
e.dot(t),
|
|
3610
3610
|
e.dot(n)
|
|
3611
3611
|
);
|
|
@@ -3617,7 +3617,7 @@ class Bs {
|
|
|
3617
3617
|
const u = [], d = t.baseVertexPositions || t.vertexPositions;
|
|
3618
3618
|
for (let b = 0; b < n.length; b += 3)
|
|
3619
3619
|
u.push(
|
|
3620
|
-
new
|
|
3620
|
+
new B(
|
|
3621
3621
|
d[n[b]],
|
|
3622
3622
|
d[n[b + 1]],
|
|
3623
3623
|
d[n[b + 2]]
|
|
@@ -3691,8 +3691,8 @@ class Bs {
|
|
|
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 ie(); o < i.length; o += 4)
|
|
3695
|
+
a.fromArray(i, o), be.colorSpaceToWorking(a, J), a.toArray(i, o);
|
|
3696
3696
|
return {
|
|
3697
3697
|
dataSize: 4,
|
|
3698
3698
|
buffer: i,
|
|
@@ -3730,7 +3730,7 @@ class Bs {
|
|
|
3730
3730
|
return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", e.Order, e.id), new Je();
|
|
3731
3731
|
const n = t - 1, i = e.KnotVector.a, s = [], o = e.Points.a;
|
|
3732
3732
|
for (let c = 0, u = o.length; c < u; c += 4)
|
|
3733
|
-
s.push(new
|
|
3733
|
+
s.push(new rt().fromArray(o, c));
|
|
3734
3734
|
let a, l;
|
|
3735
3735
|
if (e.Form === "Closed")
|
|
3736
3736
|
s.push(s[0]);
|
|
@@ -3789,7 +3789,7 @@ class Us {
|
|
|
3789
3789
|
id: t[n].id,
|
|
3790
3790
|
times: t[n].KeyTime.a.map(js),
|
|
3791
3791
|
values: t[n].KeyValueFloat.a
|
|
3792
|
-
}, s =
|
|
3792
|
+
}, s = $.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 Us {
|
|
|
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 = $.get(parseInt(i));
|
|
3806
3806
|
o !== void 0 && (o.children.forEach(function(l, r) {
|
|
3807
3807
|
if (e.has(l.ID)) {
|
|
3808
3808
|
const h = e.get(l.ID);
|
|
3809
3809
|
if (h.curves.x !== void 0 || h.curves.y !== void 0 || h.curves.z !== void 0) {
|
|
3810
3810
|
if (s[r] === void 0) {
|
|
3811
|
-
const c =
|
|
3811
|
+
const c = $.get(l.ID).parents.filter(function(u) {
|
|
3812
3812
|
return u.relationship !== void 0;
|
|
3813
3813
|
})[0].ID;
|
|
3814
3814
|
if (c !== void 0) {
|
|
@@ -3818,24 +3818,24 @@ class Us {
|
|
|
3818
3818
|
return;
|
|
3819
3819
|
}
|
|
3820
3820
|
const d = {
|
|
3821
|
-
modelName: u.attrName ?
|
|
3821
|
+
modelName: u.attrName ? at.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
|
+
le.traverse(function(m) {
|
|
3828
3828
|
m.ID === u.id && (d.transform = m.matrix, m.userData.transformData && (d.eulerOrder = m.userData.transformData.eulerOrder));
|
|
3829
|
-
}), d.transform || (d.transform = new
|
|
3829
|
+
}), d.transform || (d.transform = new j()), "PreRotation" in u && (d.preRotation = u.PreRotation.value), "PostRotation" in u && (d.postRotation = u.PostRotation.value), s[r] = d;
|
|
3830
3830
|
}
|
|
3831
3831
|
}
|
|
3832
3832
|
s[r] && (s[r][h.attr] = h);
|
|
3833
3833
|
} else if (h.curves.morph !== void 0) {
|
|
3834
3834
|
if (s[r] === void 0) {
|
|
3835
|
-
const c =
|
|
3835
|
+
const c = $.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 = $.get(c).parents[0].ID, d = $.get(u).parents[0].ID, m = $.get(d).parents[0].ID, y = H.Objects.Model[m], g = {
|
|
3838
|
+
modelName: y.attrName ? at.sanitizeNodeName(y.attrName) : "",
|
|
3839
3839
|
morphName: H.Objects.Deformer[c].attrName
|
|
3840
3840
|
};
|
|
3841
3841
|
s[r] = g;
|
|
@@ -3852,7 +3852,7 @@ class Us {
|
|
|
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 = $.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] = {
|
|
@@ -3871,8 +3871,8 @@ class Us {
|
|
|
3871
3871
|
}
|
|
3872
3872
|
generateTracks(e) {
|
|
3873
3873
|
const t = [];
|
|
3874
|
-
let n = new
|
|
3875
|
-
if (e.transform && e.transform.decompose(n, new
|
|
3874
|
+
let n = new B(), i = new B();
|
|
3875
|
+
if (e.transform && e.transform.decompose(n, new fe(), i), n = n.toArray(), i = i.toArray(), e.T !== void 0 && Object.keys(e.T.curves).length > 0) {
|
|
3876
3876
|
const s = this.generateVectorTrack(e.modelName, e.T.curves, n, "position");
|
|
3877
3877
|
s !== void 0 && t.push(s);
|
|
3878
3878
|
}
|
|
@@ -3900,12 +3900,12 @@ class Us {
|
|
|
3900
3900
|
const u = this.interpolateRotations(t.x, t.y, t.z, s);
|
|
3901
3901
|
o = u[0], a = u[1];
|
|
3902
3902
|
}
|
|
3903
|
-
const l =
|
|
3904
|
-
n !== void 0 && (n = n.map(
|
|
3905
|
-
const r = new
|
|
3903
|
+
const l = lt(0);
|
|
3904
|
+
n !== void 0 && (n = n.map(ne.degToRad), n.push(l), n = new Pe().fromArray(n), n = new fe().setFromEuler(n)), i !== void 0 && (i = i.map(ne.degToRad), i.push(l), i = new Pe().fromArray(i), i = new fe().setFromEuler(i).invert());
|
|
3905
|
+
const r = new fe(), h = new Pe(), c = [];
|
|
3906
3906
|
if (!a || !o) return new bt(e + ".quaternion", [0], [0]);
|
|
3907
3907
|
for (let u = 0; u < a.length; u += 3)
|
|
3908
|
-
h.set(a[u], a[u + 1], a[u + 2], s), r.setFromEuler(h), n !== void 0 && r.premultiply(n), i !== void 0 && r.multiply(i), u > 2 && new
|
|
3908
|
+
h.set(a[u], a[u + 1], a[u + 2], s), r.setFromEuler(h), n !== void 0 && r.premultiply(n), i !== void 0 && r.multiply(i), u > 2 && new fe().fromArray(
|
|
3909
3909
|
c,
|
|
3910
3910
|
(u - 3) / 3 * 4
|
|
3911
3911
|
).dot(r) < 0 && r.set(-r.x, -r.y, -r.z, -r.w), r.toArray(c, u / 3 * 4);
|
|
@@ -3914,7 +3914,7 @@ class Us {
|
|
|
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 = le.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];
|
|
3918
3918
|
return new Ot(e.modelName + ".morphTargetInfluences[" + i + "]", t.times, n);
|
|
3919
3919
|
}
|
|
3920
3920
|
// For all animated objects, times are defined separately for each axis
|
|
@@ -3959,7 +3959,7 @@ class Us {
|
|
|
3959
3959
|
// PI, so we'll interpolate large rotations
|
|
3960
3960
|
interpolateRotations(e, t, n, i) {
|
|
3961
3961
|
const s = [], o = [];
|
|
3962
|
-
s.push(e.times[0]), o.push(
|
|
3962
|
+
s.push(e.times[0]), o.push(ne.degToRad(e.values[0])), o.push(ne.degToRad(t.values[0])), o.push(ne.degToRad(n.values[0]));
|
|
3963
3963
|
for (let a = 1; a < e.values.length; a++) {
|
|
3964
3964
|
const l = [
|
|
3965
3965
|
e.values[a - 1],
|
|
@@ -3968,14 +3968,14 @@ class Us {
|
|
|
3968
3968
|
];
|
|
3969
3969
|
if (isNaN(l[0]) || isNaN(l[1]) || isNaN(l[2]))
|
|
3970
3970
|
continue;
|
|
3971
|
-
const r = l.map(
|
|
3971
|
+
const r = l.map(ne.degToRad), h = [
|
|
3972
3972
|
e.values[a],
|
|
3973
3973
|
t.values[a],
|
|
3974
3974
|
n.values[a]
|
|
3975
3975
|
];
|
|
3976
3976
|
if (isNaN(h[0]) || isNaN(h[1]) || isNaN(h[2]))
|
|
3977
3977
|
continue;
|
|
3978
|
-
const c = h.map(
|
|
3978
|
+
const c = h.map(ne.degToRad), u = [
|
|
3979
3979
|
h[0] - l[0],
|
|
3980
3980
|
h[1] - l[1],
|
|
3981
3981
|
h[2] - l[2]
|
|
@@ -3985,13 +3985,13 @@ class Us {
|
|
|
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, g = new
|
|
3989
|
-
|
|
3990
|
-
const
|
|
3991
|
-
for (let
|
|
3992
|
-
|
|
3988
|
+
const y = Math.max(...d) / 180, g = new Pe(...r, i), b = new Pe(...c, i), A = new fe().setFromEuler(g), f = new fe().setFromEuler(b);
|
|
3989
|
+
A.dot(f) && f.set(-f.x, -f.y, -f.z, -f.w);
|
|
3990
|
+
const L = e.times[a - 1], T = e.times[a] - L, v = new fe(), E = new Pe();
|
|
3991
|
+
for (let z = 0; z < 1; z += 1 / y)
|
|
3992
|
+
v.copy(A.clone().slerp(f.clone(), z)), s.push(L + z * T), E.setFromQuaternion(v, i), o.push(E.x), o.push(E.y), o.push(E.z);
|
|
3993
3993
|
} else
|
|
3994
|
-
s.push(e.times[a]), o.push(
|
|
3994
|
+
s.push(e.times[a]), o.push(ne.degToRad(e.values[a])), o.push(ne.degToRad(t.values[a])), o.push(ne.degToRad(n.values[a]));
|
|
3995
3995
|
}
|
|
3996
3996
|
return [s, o];
|
|
3997
3997
|
}
|
|
@@ -4346,7 +4346,7 @@ function js(p) {
|
|
|
4346
4346
|
return p / 46186158e3;
|
|
4347
4347
|
}
|
|
4348
4348
|
const Zs = [];
|
|
4349
|
-
function
|
|
4349
|
+
function pt(p, e, t, n) {
|
|
4350
4350
|
let i;
|
|
4351
4351
|
switch (n.mappingType) {
|
|
4352
4352
|
case "ByPolygonVertex":
|
|
@@ -4368,43 +4368,43 @@ function dt(p, e, t, n) {
|
|
|
4368
4368
|
const s = i * n.dataSize, o = s + n.dataSize;
|
|
4369
4369
|
return Ks(Zs, n.buffer, s, o);
|
|
4370
4370
|
}
|
|
4371
|
-
const Ct = new
|
|
4371
|
+
const Ct = new Pe(), Be = new B();
|
|
4372
4372
|
function Pn(p) {
|
|
4373
|
-
const e = new
|
|
4373
|
+
const e = new j(), t = new j(), n = new j(), i = new j(), s = new j(), o = new j(), a = new j(), l = new j(), r = new j(), h = new j(), c = new j(), u = new j(), d = p.inheritType ? p.inheritType : 0;
|
|
4374
4374
|
p.translation && e.setPosition(Be.fromArray(p.translation));
|
|
4375
|
-
const m =
|
|
4375
|
+
const m = lt(0);
|
|
4376
4376
|
if (p.preRotation) {
|
|
4377
|
-
const
|
|
4378
|
-
|
|
4377
|
+
const I = p.preRotation.map(ne.degToRad);
|
|
4378
|
+
I.push(m), t.makeRotationFromEuler(Ct.fromArray(I));
|
|
4379
4379
|
}
|
|
4380
4380
|
if (p.rotation) {
|
|
4381
|
-
const
|
|
4382
|
-
|
|
4381
|
+
const I = p.rotation.map(ne.degToRad);
|
|
4382
|
+
I.push(p.eulerOrder || m), n.makeRotationFromEuler(Ct.fromArray(I));
|
|
4383
4383
|
}
|
|
4384
4384
|
if (p.postRotation) {
|
|
4385
|
-
const
|
|
4386
|
-
|
|
4385
|
+
const I = p.postRotation.map(ne.degToRad);
|
|
4386
|
+
I.push(m), i.makeRotationFromEuler(Ct.fromArray(I)), i.invert();
|
|
4387
4387
|
}
|
|
4388
4388
|
p.scale && s.scale(Be.fromArray(p.scale)), p.scalingOffset && a.setPosition(Be.fromArray(p.scalingOffset)), p.scalingPivot && o.setPosition(Be.fromArray(p.scalingPivot)), p.rotationOffset && l.setPosition(Be.fromArray(p.rotationOffset)), p.rotationPivot && r.setPosition(Be.fromArray(p.rotationPivot)), p.parentMatrixWorld && (c.copy(p.parentMatrix), h.copy(p.parentMatrixWorld));
|
|
4389
|
-
const y = t.clone().multiply(n).multiply(i), g = new
|
|
4389
|
+
const y = t.clone().multiply(n).multiply(i), g = new j();
|
|
4390
4390
|
g.extractRotation(h);
|
|
4391
|
-
const b = new
|
|
4391
|
+
const b = new j();
|
|
4392
4392
|
b.copyPosition(h);
|
|
4393
|
-
const
|
|
4393
|
+
const A = b.clone().invert().multiply(h), f = g.clone().invert().multiply(A), L = s, T = new j();
|
|
4394
4394
|
if (d === 0)
|
|
4395
|
-
T.copy(g).multiply(y).multiply(f).multiply(
|
|
4395
|
+
T.copy(g).multiply(y).multiply(f).multiply(L);
|
|
4396
4396
|
else if (d === 1)
|
|
4397
|
-
T.copy(g).multiply(f).multiply(y).multiply(
|
|
4397
|
+
T.copy(g).multiply(f).multiply(y).multiply(L);
|
|
4398
4398
|
else {
|
|
4399
|
-
const
|
|
4400
|
-
T.copy(g).multiply(y).multiply(
|
|
4399
|
+
const D = new j().scale(new B().setFromMatrixScale(c)).clone().invert(), Y = f.clone().multiply(D);
|
|
4400
|
+
T.copy(g).multiply(y).multiply(Y).multiply(L);
|
|
4401
4401
|
}
|
|
4402
|
-
const
|
|
4403
|
-
let
|
|
4404
|
-
const
|
|
4405
|
-
return u.copyPosition(
|
|
4402
|
+
const v = r.clone().invert(), E = o.clone().invert();
|
|
4403
|
+
let z = e.clone().multiply(l).multiply(r).multiply(t).multiply(n).multiply(i).multiply(v).multiply(a).multiply(o).multiply(s).multiply(E);
|
|
4404
|
+
const O = new j().copyPosition(z), W = h.clone().multiply(O);
|
|
4405
|
+
return u.copyPosition(W), z = u.clone().multiply(T), z.premultiply(h.invert()), z;
|
|
4406
4406
|
}
|
|
4407
|
-
function
|
|
4407
|
+
function lt(p) {
|
|
4408
4408
|
p = p || 0;
|
|
4409
4409
|
const e = [
|
|
4410
4410
|
"ZYX",
|
|
@@ -4447,21 +4447,21 @@ class Qs extends fi {
|
|
|
4447
4447
|
e.deleteAttribute("uv");
|
|
4448
4448
|
const t = new xt({ side: yi }), n = new xt(), i = new yt(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 ke(e, t);
|
|
4451
4451
|
s.position.set(-0.757, 13.219, 0.717), s.scale.set(31.713, 28.305, 28.591), this.add(s);
|
|
4452
|
-
const o = new un(e, n, 6), a = new
|
|
4452
|
+
const o = new un(e, n, 6), a = new Fe();
|
|
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 ke(e, Ue(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 ke(e, Ue(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 h = new
|
|
4458
|
+
const h = new ke(e, Ue(17));
|
|
4459
4459
|
h.position.set(14.904, 12.198, -1.832), h.scale.set(0.15, 4.265, 6.331), this.add(h);
|
|
4460
|
-
const c = new
|
|
4460
|
+
const c = new ke(e, Ue(43));
|
|
4461
4461
|
c.position.set(-0.462, 8.89, 14.52), c.scale.set(4.38, 5.441, 0.088), this.add(c);
|
|
4462
|
-
const u = new
|
|
4462
|
+
const u = new ke(e, Ue(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 ke(e, Ue(100));
|
|
4465
4465
|
d.position.set(0, 20, 0), d.scale.set(1, 0.1, 1), this.add(d);
|
|
4466
4466
|
}
|
|
4467
4467
|
/**
|
|
@@ -4531,19 +4531,19 @@ tt.Panel = function(p, e, t) {
|
|
|
4531
4531
|
var g = y.getContext("2d");
|
|
4532
4532
|
return g.font = "bold " + 9 * o + "px Helvetica,Arial,sans-serif", g.textBaseline = "top", g.fillStyle = t, g.fillRect(0, 0, a, l), g.fillStyle = e, g.fillText(p, r, h), g.fillRect(c, u, d, m), g.fillStyle = t, g.globalAlpha = 0.9, g.fillRect(c, u, d, m), {
|
|
4533
4533
|
dom: y,
|
|
4534
|
-
update: function(b,
|
|
4535
|
-
n = Math.min(n, b), i = Math.max(i, b), g.fillStyle = t, g.globalAlpha = 1, g.fillRect(0, 0, a, u), g.fillStyle = e, g.fillText(s(b) + " " + p + " (" + s(n) + "-" + s(i) + ")", r, h), g.drawImage(y, c + o, u, d - o, m, c, u, d - o, m), g.fillRect(c + d - o, u, o, m), g.fillStyle = t, g.globalAlpha = 0.9, g.fillRect(c + d - o, u, o, s((1 - b /
|
|
4534
|
+
update: function(b, A) {
|
|
4535
|
+
n = Math.min(n, b), i = Math.max(i, b), g.fillStyle = t, g.globalAlpha = 1, g.fillRect(0, 0, a, u), g.fillStyle = e, g.fillText(s(b) + " " + p + " (" + s(n) + "-" + s(i) + ")", r, h), g.drawImage(y, c + o, u, d - o, m, c, u, d - o, m), g.fillRect(c + d - o, u, o, m), g.fillStyle = t, g.globalAlpha = 0.9, g.fillRect(c + d - o, u, o, s((1 - b / A) * m));
|
|
4536
4536
|
}
|
|
4537
4537
|
};
|
|
4538
4538
|
};
|
|
4539
|
-
let x,
|
|
4540
|
-
const
|
|
4539
|
+
let x, ue, pe;
|
|
4540
|
+
const C = [0, 0, 0, 0], M = new R.Vector3(), mt = new R.Vector3(), oe = new R.Vector3(), ft = new R.Vector3();
|
|
4541
4541
|
new R.Plane();
|
|
4542
4542
|
new R.Ray();
|
|
4543
4543
|
new R.Euler();
|
|
4544
|
-
const
|
|
4544
|
+
const ae = new R.Quaternion(), sn = new R.Quaternion(), ve = new R.Matrix4(), Ae = new R.Matrix4();
|
|
4545
4545
|
new R.Vector3();
|
|
4546
|
-
const
|
|
4546
|
+
const gt = new R.Vector3(0, 0, 1), qs = new R.Vector3(1, 0, 0), Js = new R.Vector3(0, 1, 0), $s = new R.Vector3(0, 0, 1);
|
|
4547
4547
|
class eo {
|
|
4548
4548
|
constructor(e = null) {
|
|
4549
4549
|
this.opt = Object.assign({
|
|
@@ -4850,7 +4850,7 @@ class eo {
|
|
|
4850
4850
|
/// Bone's parent object
|
|
4851
4851
|
vBasis: r.position.clone(),
|
|
4852
4852
|
// Original local position
|
|
4853
|
-
vWorld: r.parent.getWorldPosition(
|
|
4853
|
+
vWorld: r.parent.getWorldPosition(M).clone(),
|
|
4854
4854
|
// World position, parent
|
|
4855
4855
|
qBasis: r.parent.quaternion.clone(),
|
|
4856
4856
|
// Original quaternion, parent
|
|
@@ -4867,7 +4867,7 @@ class eo {
|
|
|
4867
4867
|
ea: [0, 0, 0, 0]
|
|
4868
4868
|
// External acceleration [m/s^2]
|
|
4869
4869
|
};
|
|
4870
|
-
h.boneParent.matrixWorld.decompose(
|
|
4870
|
+
h.boneParent.matrixWorld.decompose(M, ae, oe), M.copy(gt).applyQuaternion(ae).setY(0).normalize(), ae.premultiply(sn.setFromUnitVectors(gt, M).invert()).normalize(), h.qWorldInverseYaw = ae.clone().normalize(), this.data.push(h), this.dict[l] = h;
|
|
4871
4871
|
try {
|
|
4872
4872
|
this.setValue(l, "type", s.type), this.setValue(l, "stiffness", s.stiffness), this.setValue(l, "damping", s.damping), this.setValue(l, "external", s.external), this.setValue(l, "limits", s.limits), this.setValue(l, "excludes", s.excludes), this.setValue(l, "deltaLocal", s.deltaLocal), this.setValue(l, "deltaWorld", s.deltaWorld), this.setValue(l, "pivot", s.pivot), this.setValue(l, "helper", s.helper);
|
|
4873
4873
|
} catch (c) {
|
|
@@ -4885,22 +4885,22 @@ class eo {
|
|
|
4885
4885
|
for (this.timerMs += e, e > 1e3 && (this.timerMs = 0), e /= 1e3, t = 0, i = this.objectsUpdate.length; t < i; t++)
|
|
4886
4886
|
o = this.objectsUpdate[t], o.updateMatrix(), o.parent === null ? o.matrixWorld.copy(o.matrix) : o.matrixWorld.multiplyMatrices(o.parent.matrixWorld, o.matrix), o.matrixWorldNeedsUpdate = !1;
|
|
4887
4887
|
for (t = 0, i = this.data.length; t < i; t++) {
|
|
4888
|
-
if (o = this.data[t],
|
|
4888
|
+
if (o = this.data[t], M.copy(o.vWorld), ve.copy(o.boneParent.matrixWorld), Ae.copy(ve).invert(), o.vWorld.setFromMatrixPosition(ve), M.applyMatrix4(Ae), M.length() > 0.5 && (console.info("Info: Unrealistic jump of " + M.length().toFixed(2) + " meters."), M.setLength(0.5)), M.applyQuaternion(o.bone.quaternion), C[0] = M.x, C[1] = M.y, C[2] = -M.z, C[3] = M.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
|
-
),
|
|
4890
|
+
x = o.children[n], C[0] -= x.v[0] * e / 3, C[1] -= x.v[1] * e / 3, C[2] += x.v[2] * e / 3, C[3] -= x.v[3] * e / 3;
|
|
4891
|
+
if (x = this.opt.sensitivityFactor, C[0] *= o.ext * x, C[1] *= o.ext * x, C[2] *= o.ext * x, C[3] *= o.ext * x, o.isX && (x = C[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 + C[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 = C[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 + C[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 = C[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 + C[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 = C[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 + C[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), C[0] = o.p[0], C[1] = o.p[1], C[2] = o.p[2], C[3] = o.p[3], x = this.opt.movementFactor, C[0] *= x, C[1] *= x, C[2] *= x, C[3] *= x, o.dl && (x = o.dl, C[0] += x[0], C[1] += x[1], C[2] += x[2]), o.dw && (x = o.dw, M.set(
|
|
4892
|
+
o.vBasis.x + C[0],
|
|
4893
|
+
o.vBasis.y + C[1],
|
|
4894
|
+
o.vBasis.z + C[2]
|
|
4895
|
+
), M.applyMatrix4(ve), M.x += x[0], M.y += x[1], M.z += x[2], M.applyMatrix4(Ae), C[0] += M.x - o.vBasis.x, C[1] += M.y - o.vBasis.y, C[2] += M.z - o.vBasis.z), o.limits && this.opt.isLimits && (x = o.limits, x[0] && (x[0][0] !== null && C[0] < x[0][0] && (C[0] = x[0][0]), x[0][1] !== null && C[0] > x[0][1] && (C[0] = x[0][1])), x[1] && (x[1][0] !== null && C[1] < x[1][0] && (C[1] = x[1][0]), x[1][1] !== null && C[1] > x[1][1] && (C[1] = x[1][1])), x[2] && (x[2][0] !== null && C[2] < x[2][0] && (C[2] = x[2][0]), x[2][1] !== null && C[2] > x[2][1] && (C[2] = x[2][1])), x[3] && (x[3][0] !== null && C[3] < x[3][0] && (C[3] = x[3][0]), x[3][1] !== null && C[3] > x[3][1] && (C[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 + C[0],
|
|
4898
|
+
o.vBasis.y + C[1],
|
|
4899
|
+
o.vBasis.z - C[2]
|
|
4900
4900
|
);
|
|
4901
|
-
else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(
|
|
4901
|
+
else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(M, ae, oe), M.copy(gt).applyQuaternion(ae).setY(0).normalize(), ae.premultiply(sn.setFromUnitVectors(gt, M).invert()).normalize(), o.boneParent.quaternion.multiply(ae.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (x = Math.atan(C[0] / o.l), ae.setFromAxisAngle($s, -x), o.boneParent.quaternion.multiply(ae)), o.isY && (x = o.l / 3, x = x * Math.tanh(C[1] / x), o.bone.position.setLength(o.l + x)), o.isX && (x = Math.atan(C[2] / o.l), ae.setFromAxisAngle(qs, -x), o.boneParent.quaternion.multiply(ae)), o.isT && (x = 1.5 * Math.tanh(C[3] * 1.5), ae.setFromAxisAngle(Js, -x), o.boneParent.quaternion.multiply(ae)), 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], oe.set(0, 0, 0), x.deltaLocal && (oe.x += x.deltaLocal[0], oe.y += x.deltaLocal[1], oe.z += x.deltaLocal[2]), oe.applyMatrix4(x.bone.matrixWorld), Ae.copy(o.boneParent.matrixWorld).invert(), oe.applyMatrix4(Ae), M.copy(o.bone.position), !(M.distanceToSquared(oe) >= x.radiusSq) && (pe = M.length(), ue = oe.length(), !(ue > x.radius + pe) && (ue < Math.abs(x.radius - pe) || (ue = (ue * ue + pe * pe - x.radiusSq) / (2 * ue), oe.normalize(), ft.copy(oe).multiplyScalar(ue), ue = Math.sqrt(pe * pe - ue * ue), M.subVectors(M, ft).projectOnPlane(oe).normalize().multiplyScalar(ue), mt.subVectors(o.vBasis, ft).projectOnPlane(oe).normalize(), pe = mt.dot(M), pe < 0 && (pe = Math.sqrt(ue * ue - pe * pe), mt.multiplyScalar(pe), M.add(mt)), M.add(ft).normalize(), oe.copy(o.bone.position).normalize(), ae.setFromUnitVectors(oe, M), o.boneParent.quaternion.premultiply(ae), o.boneParent.updateWorldMatrix(!1, !0))));
|
|
4904
4904
|
}
|
|
4905
4905
|
this.helpers.isActive && this.updateHelpers();
|
|
4906
4906
|
}
|
|
@@ -4971,17 +4971,17 @@ class eo {
|
|
|
4971
4971
|
*/
|
|
4972
4972
|
updateHelpers() {
|
|
4973
4973
|
if (x = this.helpers.points, x.bones.length) {
|
|
4974
|
-
|
|
4974
|
+
Ae.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
|
+
ve.multiplyMatrices(Ae, x.bones[t].matrixWorld), M.setFromMatrixPosition(ve), e.setXYZ(t, M.x, M.y, M.z);
|
|
4978
4978
|
e.needsUpdate = !0, x.object.updateMatrixWorld();
|
|
4979
4979
|
}
|
|
4980
4980
|
if (x = this.helpers.lines, x.bones.length) {
|
|
4981
|
-
|
|
4981
|
+
Ae.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
|
+
ve.multiplyMatrices(Ae, x.bones[t].matrixWorld), M.setFromMatrixPosition(ve), e.setXYZ(n, M.x, M.y, M.z), ve.multiplyMatrices(Ae, x.bones[t].parent.matrixWorld), M.setFromMatrixPosition(ve), e.setXYZ(n + 1, M.x, M.y, M.z);
|
|
4985
4985
|
e.needsUpdate = !0, x.object.updateMatrixWorld();
|
|
4986
4986
|
}
|
|
4987
4987
|
}
|
|
@@ -7158,7 +7158,7 @@ const uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
7158
7158
|
fr: ro,
|
|
7159
7159
|
fi: co,
|
|
7160
7160
|
lt: uo
|
|
7161
|
-
},
|
|
7161
|
+
}, Q = new R.Quaternion(), N = new R.Euler(), Te = new R.Vector3(), Me = new R.Vector3(), an = new R.Box3();
|
|
7162
7162
|
new R.Matrix4();
|
|
7163
7163
|
new R.Matrix4();
|
|
7164
7164
|
new R.Vector3();
|
|
@@ -8903,9 +8903,9 @@ class Dn {
|
|
|
8903
8903
|
updatePoseDelta() {
|
|
8904
8904
|
for (const [e, t] of Object.entries(this.poseDelta.props)) {
|
|
8905
8905
|
if (t.x === 0 && t.y === 0 && t.z === 0) continue;
|
|
8906
|
-
|
|
8906
|
+
N.set(t.x, t.y, t.z);
|
|
8907
8907
|
const n = this.poseAvatar.props[e];
|
|
8908
|
-
n.isQuaternion ? (
|
|
8908
|
+
n.isQuaternion ? (Q.setFromEuler(N), n.multiply(Q)) : n.isVector3 && n.add(N);
|
|
8909
8909
|
}
|
|
8910
8910
|
}
|
|
8911
8911
|
/**
|
|
@@ -9114,7 +9114,7 @@ class Dn {
|
|
|
9114
9114
|
*/
|
|
9115
9115
|
async initializeFBXAnimationLoader() {
|
|
9116
9116
|
try {
|
|
9117
|
-
const { FBXAnimationLoader: e } = await import("./fbxAnimationLoader-
|
|
9117
|
+
const { FBXAnimationLoader: e } = await import("./fbxAnimationLoader-C0BDPJ-P.js");
|
|
9118
9118
|
this.fbxAnimationLoader = new e(this.armature), console.log("FBX Animation Loader initialized");
|
|
9119
9119
|
} catch (e) {
|
|
9120
9120
|
console.warn("FBX Animation Loader not available:", e), this.fbxAnimationLoader = null;
|
|
@@ -9688,7 +9688,7 @@ class Dn {
|
|
|
9688
9688
|
}, i.x ? new R.Vector3(i.x, i.y, i.z) : null, !0, i.d);
|
|
9689
9689
|
break;
|
|
9690
9690
|
}
|
|
9691
|
-
if ((l || r) && (
|
|
9691
|
+
if ((l || r) && (N.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), N.x = Math.max(-0.9, Math.min(0.9, 2 * N.x - 0.5)), N.y = Math.max(-0.9, Math.min(0.9, -2.5 * N.y)), l ? (Object.assign(this.mtAvatar.eyesLookDown, { system: N.x < 0 ? -N.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: N.x < 0 ? 0 : N.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: N.y < 0 ? -N.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: N.y < 0 ? 0 : N.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: N.y < 0 ? 0 : N.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: N.y < 0 ? -N.y : 0, needsUpdate: !0 }), r && (n = -this.mtAvatar.bodyRotateY.value, i = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
|
|
9692
9692
|
name: "headmove",
|
|
9693
9693
|
dt: [[1e3, 2e3], [1e3, 2e3, 1, 2], [1e3, 2e3], [1e3, 2e3, 1, 2]],
|
|
9694
9694
|
vs: {
|
|
@@ -9709,7 +9709,7 @@ class Dn {
|
|
|
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 && (Q.setFromAxisAngle(mo, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(Q)), an.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(Te), Te.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(Me), Me.sub(this.armature.position), this.objectHips.position.y -= an.min.y / 2, this.objectHips.position.x -= (Te.x + Me.x) / 4, this.objectHips.position.z -= (Te.z + Me.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) {
|
|
@@ -9780,10 +9780,10 @@ class Dn {
|
|
|
9780
9780
|
let h = "", c = "", u = 0, d = [], m = [];
|
|
9781
9781
|
const y = Array.from(this.segmenter.segment(e), (g) => g.segment);
|
|
9782
9782
|
for (let g = 0; g < y.length; g++) {
|
|
9783
|
-
const b = g === y.length - 1,
|
|
9783
|
+
const b = g === y.length - 1, A = y[g].match(a);
|
|
9784
9784
|
let f = y[g].match(s);
|
|
9785
|
-
const
|
|
9786
|
-
if (f && !b && !
|
|
9785
|
+
const L = y[g].match(l), T = y[g].match(o);
|
|
9786
|
+
if (f && !b && !L && y[g + 1].match(s) && (f = !1), n && (h += y[g]), A && (!i || i.every((v) => g < v[0] || g > v[1])) && (c += y[g]), (T || f || b) && (c.length && (c = this.lipsyncPreProcessText(c, r), c.length && d.push({
|
|
9787
9787
|
mark: u,
|
|
9788
9788
|
word: c
|
|
9789
9789
|
})), h.length && (m.push({
|
|
@@ -9794,16 +9794,16 @@ class Dn {
|
|
|
9794
9794
|
subtitles: [h]
|
|
9795
9795
|
}
|
|
9796
9796
|
}), h = ""), c.length)) {
|
|
9797
|
-
const
|
|
9798
|
-
if (
|
|
9799
|
-
const
|
|
9800
|
-
for (let
|
|
9797
|
+
const v = this.lipsyncWordsToVisemes(c, r);
|
|
9798
|
+
if (v && v.visemes && v.visemes.length) {
|
|
9799
|
+
const E = v.times[v.visemes.length - 1] + v.durations[v.visemes.length - 1];
|
|
9800
|
+
for (let z = 0; z < v.visemes.length; z++)
|
|
9801
9801
|
m.push({
|
|
9802
9802
|
mark: u,
|
|
9803
9803
|
template: { name: "viseme" },
|
|
9804
|
-
ts: [(
|
|
9804
|
+
ts: [(v.times[z] - 0.6) / E, (v.times[z] + 0.5) / E, (v.times[z] + v.durations[z] + 0.5) / E],
|
|
9805
9805
|
vs: {
|
|
9806
|
-
["viseme_" +
|
|
9806
|
+
["viseme_" + v.visemes[z]]: [null, v.visemes[z] === "PP" || v.visemes[z] === "FF" ? 0.9 : 0.6, 0]
|
|
9807
9807
|
}
|
|
9808
9808
|
});
|
|
9809
9809
|
}
|
|
@@ -9811,14 +9811,14 @@ class Dn {
|
|
|
9811
9811
|
}
|
|
9812
9812
|
if (f || b) {
|
|
9813
9813
|
if (d.length || b && m.length) {
|
|
9814
|
-
const
|
|
9814
|
+
const v = {
|
|
9815
9815
|
anim: m
|
|
9816
9816
|
};
|
|
9817
|
-
n && (
|
|
9817
|
+
n && (v.onSubtitles = n), d.length && !t.avatarMute && (v.text = d, t.avatarMood && (v.mood = t.avatarMood), t.ttsLang && (v.lang = t.ttsLang), t.ttsVoice && (v.voice = t.ttsVoice), t.ttsRate && (v.rate = t.ttsRate), t.ttsVoice && (v.pitch = t.ttsPitch), t.ttsVolume && (v.volume = t.ttsVolume)), this.speechQueue.push(v), d = [], c = "", u = 0, m = [];
|
|
9818
9818
|
}
|
|
9819
|
-
if (
|
|
9820
|
-
let
|
|
9821
|
-
|
|
9819
|
+
if (L) {
|
|
9820
|
+
let v = this.animEmojis[y[g]];
|
|
9821
|
+
v && v.link && (v = this.animEmojis[v.link]), v && this.speechQueue.push({ emoji: v });
|
|
9822
9822
|
}
|
|
9823
9823
|
this.speechQueue.push({ break: 100 });
|
|
9824
9824
|
}
|
|
@@ -9914,10 +9914,10 @@ class Dn {
|
|
|
9914
9914
|
let y = 0.6 + this.convertRange(m, [0, h], [0, 0.4]);
|
|
9915
9915
|
if (h = Math.min(h, u.visemes.length * 200), d > 0)
|
|
9916
9916
|
for (let g = 0; g < u.visemes.length; g++) {
|
|
9917
|
-
const b = r + u.times[g] / d * h,
|
|
9917
|
+
const b = r + u.times[g] / d * h, A = u.durations[g] / d * h;
|
|
9918
9918
|
o.push({
|
|
9919
9919
|
template: { name: "viseme" },
|
|
9920
|
-
ts: [b - Math.min(60, 2 *
|
|
9920
|
+
ts: [b - Math.min(60, 2 * A / 3), b + Math.min(25, A / 2), b + A + Math.min(60, A / 2)],
|
|
9921
9921
|
vs: {
|
|
9922
9922
|
["viseme_" + u.visemes[g]]: [null, u.visemes[g] === "PP" || u.visemes[g] === "FF" ? 0.9 : y, 0]
|
|
9923
9923
|
}
|
|
@@ -9999,7 +9999,7 @@ class Dn {
|
|
|
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 h = speechSynthesis.getVoices(), c = e.voice || this.avatar.ttsVoice || this.opt.ttsVoice;
|
|
10001
10001
|
if (c && h.length > 0) {
|
|
10002
|
-
const f = h.find((
|
|
10002
|
+
const f = h.find((L) => L.name.includes(c) || L.lang === o);
|
|
10003
10003
|
f && (s.voice = f);
|
|
10004
10004
|
}
|
|
10005
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), g = this.lipsyncWordsToVisemes(y, m);
|
|
@@ -10014,19 +10014,19 @@ class Dn {
|
|
|
10014
10014
|
const b = [];
|
|
10015
10015
|
if (g && g.visemes && g.visemes.length > 0) {
|
|
10016
10016
|
const f = g.times[g.visemes.length - 1] + g.durations[g.visemes.length - 1];
|
|
10017
|
-
for (let
|
|
10018
|
-
const T = g.visemes[
|
|
10017
|
+
for (let L = 0; L < g.visemes.length; L++) {
|
|
10018
|
+
const T = g.visemes[L], v = g.times[L] / f, E = g.durations[L] / f, z = v * u, O = E * u;
|
|
10019
10019
|
b.push({
|
|
10020
10020
|
template: { name: "viseme" },
|
|
10021
|
-
ts: [
|
|
10021
|
+
ts: [z - Math.min(60, 2 * O / 3), z + Math.min(25, O / 2), z + O + Math.min(60, O / 2)],
|
|
10022
10022
|
vs: {
|
|
10023
10023
|
["viseme_" + T]: [null, T === "PP" || T === "FF" ? 0.9 : 0.6, 0]
|
|
10024
10024
|
}
|
|
10025
10025
|
});
|
|
10026
10026
|
}
|
|
10027
10027
|
}
|
|
10028
|
-
const
|
|
10029
|
-
this.audioPlaylist.push({ anim:
|
|
10028
|
+
const A = [...e.anim, ...b];
|
|
10029
|
+
this.audioPlaylist.push({ anim: A, audio: d }), this.onSubtitles = e.onSubtitles || null, this.resetLips(), e.mood && this.setMood(e.mood), this.playAudio(), s.onend = () => {
|
|
10030
10030
|
t();
|
|
10031
10031
|
}, s.onerror = (f) => {
|
|
10032
10032
|
console.error("Speech synthesis error:", f.error), n(f.error);
|
|
@@ -10564,7 +10564,7 @@ class Dn {
|
|
|
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), Te.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), Me.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), t.addVectors(Te, Me).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,12 +10577,12 @@ class Dn {
|
|
|
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,
|
|
10582
|
-
|
|
10583
|
-
const a = new R.Quaternion().setFromEuler(
|
|
10584
|
-
|
|
10585
|
-
let r =
|
|
10580
|
+
this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), Te.setFromMatrixPosition(this.objectLeftEye.matrixWorld), Me.setFromMatrixPosition(this.objectRightEye.matrixWorld), Te.add(Me).divideScalar(2), Q.copy(this.armature.quaternion), Q.multiply(this.poseTarget.props["Hips.quaternion"]), Q.multiply(this.poseTarget.props["Spine.quaternion"]), Q.multiply(this.poseTarget.props["Spine1.quaternion"]), Q.multiply(this.poseTarget.props["Spine2.quaternion"]), Q.multiply(this.poseTarget.props["Neck.quaternion"]), Q.multiply(this.poseTarget.props["Head.quaternion"]);
|
|
10581
|
+
const n = new R.Vector3().subVectors(t, Te).normalize(), i = Math.atan2(n.x, n.z), s = Math.asin(-n.y);
|
|
10582
|
+
N.set(s, i, 0, "YXZ");
|
|
10583
|
+
const a = new R.Quaternion().setFromEuler(N), l = new R.Quaternion().copy(a).multiply(Q.clone().invert());
|
|
10584
|
+
N.setFromQuaternion(l, "YXZ");
|
|
10585
|
+
let r = N.x / (40 / 24) + 0.2, h = N.y / (9 / 4), c = Math.min(0.6, Math.max(-0.3, r)), u = Math.min(0.8, Math.max(-0.8, h)), d = (Math.random() - 0.5) / 4, m = (Math.random() - 0.5) / 4;
|
|
10586
10586
|
if (e) {
|
|
10587
10587
|
let y = this.animQueue.findIndex((b) => b.template.name === "lookat");
|
|
10588
10588
|
y !== -1 && this.animQueue.splice(y, 1);
|
|
@@ -10617,20 +10617,20 @@ class Dn {
|
|
|
10617
10617
|
const s = new R.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), o = new R.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), a = new R.Vector3().addVectors(s, o).divideScalar(2);
|
|
10618
10618
|
a.project(this.camera);
|
|
10619
10619
|
let l = (a.x + 1) / 2 * i.width + i.left, r = -(a.y - 1) / 2 * i.height + i.top;
|
|
10620
|
-
e === null && (e = l), t === null && (t = r),
|
|
10621
|
-
let h =
|
|
10620
|
+
e === null && (e = l), t === null && (t = r), Q.copy(this.armature.quaternion), Q.multiply(this.poseTarget.props["Hips.quaternion"]), Q.multiply(this.poseTarget.props["Spine.quaternion"]), Q.multiply(this.poseTarget.props["Spine1.quaternion"]), Q.multiply(this.poseTarget.props["Spine2.quaternion"]), Q.multiply(this.poseTarget.props["Neck.quaternion"]), Q.multiply(this.poseTarget.props["Head.quaternion"]), N.setFromQuaternion(Q);
|
|
10621
|
+
let h = N.x / (40 / 24), c = N.y / (9 / 4), u = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), m = Math.max(window.innerWidth - l, l), y = Math.max(window.innerHeight - r, r), g = this.convertRange(t, [r - y, r + y], [-0.3, 0.6]) - h + u, b = this.convertRange(e, [l - m, l + m], [-0.8, 0.8]) - c + d;
|
|
10622
10622
|
g = Math.min(0.6, Math.max(-0.3, g)), b = Math.min(0.8, Math.max(-0.8, b));
|
|
10623
|
-
let
|
|
10623
|
+
let A = (Math.random() - 0.5) / 4, f = (Math.random() - 0.5) / 4;
|
|
10624
10624
|
if (n) {
|
|
10625
|
-
let
|
|
10626
|
-
|
|
10625
|
+
let L = this.animQueue.findIndex((v) => v.template.name === "lookat");
|
|
10626
|
+
L !== -1 && this.animQueue.splice(L, 1);
|
|
10627
10627
|
const T = {
|
|
10628
10628
|
name: "lookat",
|
|
10629
10629
|
dt: [750, n],
|
|
10630
10630
|
vs: {
|
|
10631
|
-
bodyRotateX: [g +
|
|
10631
|
+
bodyRotateX: [g + A],
|
|
10632
10632
|
bodyRotateY: [b + f],
|
|
10633
|
-
eyesRotateX: [-3 *
|
|
10633
|
+
eyesRotateX: [-3 * A + 0.1],
|
|
10634
10634
|
eyesRotateY: [-5 * f],
|
|
10635
10635
|
browInnerUp: [[0, 0.7]],
|
|
10636
10636
|
mouthLeft: [[0, 0.7]],
|
|
@@ -11008,12 +11008,12 @@ class Dn {
|
|
|
11008
11008
|
const g = e.iterations || 10;
|
|
11009
11009
|
if (t)
|
|
11010
11010
|
for (let b = 0; b < g; b++) {
|
|
11011
|
-
let
|
|
11012
|
-
for (let f = 0,
|
|
11011
|
+
let A = !1;
|
|
11012
|
+
for (let f = 0, L = y.length; f < L; f++) {
|
|
11013
11013
|
const T = y[f].bone;
|
|
11014
11014
|
T.matrixWorld.decompose(l, r, h), 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
|
-
let
|
|
11016
|
-
|
|
11015
|
+
let v = s.dot(a);
|
|
11016
|
+
v > 1 ? v = 1 : v < -1 && (v = -1), v = Math.acos(v), !(v < 1e-5) && (y[f].minAngle !== void 0 && v < y[f].minAngle && (v = y[f].minAngle), y[f].maxAngle !== void 0 && v > y[f].maxAngle && (v = y[f].maxAngle), c.crossVectors(a, s), c.normalize(), Q.setFromAxisAngle(c, v), T.quaternion.multiply(Q), T.rotation.setFromVector3(u.setFromEuler(T.rotation).clamp(new R.Vector3(
|
|
11017
11017
|
y[f].minx !== void 0 ? y[f].minx : -1 / 0,
|
|
11018
11018
|
y[f].miny !== void 0 ? y[f].miny : -1 / 0,
|
|
11019
11019
|
y[f].minz !== void 0 ? y[f].minz : -1 / 0
|
|
@@ -11021,9 +11021,9 @@ class Dn {
|
|
|
11021
11021
|
y[f].maxx !== void 0 ? y[f].maxx : 1 / 0,
|
|
11022
11022
|
y[f].maxy !== void 0 ? y[f].maxy : 1 / 0,
|
|
11023
11023
|
y[f].maxz !== void 0 ? y[f].maxz : 1 / 0
|
|
11024
|
-
))), T.updateMatrixWorld(!0),
|
|
11024
|
+
))), T.updateMatrixWorld(!0), A = !0);
|
|
11025
11025
|
}
|
|
11026
|
-
if (!
|
|
11026
|
+
if (!A) break;
|
|
11027
11027
|
}
|
|
11028
11028
|
i && y.forEach((b) => {
|
|
11029
11029
|
this.poseTarget.props[b.link + ".quaternion"].copy(b.bone.quaternion), this.poseTarget.props[b.link + ".quaternion"].t = this.animClock, this.poseTarget.props[b.link + ".quaternion"].d = i;
|
|
@@ -11097,244 +11097,244 @@ const On = Ut(({
|
|
|
11097
11097
|
style: y = {},
|
|
11098
11098
|
animations: g = {}
|
|
11099
11099
|
}, b) => {
|
|
11100
|
-
const
|
|
11101
|
-
let
|
|
11102
|
-
|
|
11100
|
+
const A = re(null), f = re(null), [L, T] = Xe(!0), [v, E] = Xe(null), [z, O] = Xe(!1), W = Wt(), I = i || W.service;
|
|
11101
|
+
let D;
|
|
11102
|
+
I === "browser" ? D = {
|
|
11103
11103
|
service: "browser",
|
|
11104
11104
|
endpoint: "",
|
|
11105
11105
|
apiKey: null,
|
|
11106
11106
|
defaultVoice: "Google US English"
|
|
11107
|
-
} :
|
|
11107
|
+
} : I === "elevenlabs" ? D = {
|
|
11108
11108
|
service: "elevenlabs",
|
|
11109
11109
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
11110
|
-
apiKey: o ||
|
|
11111
|
-
defaultVoice: s ||
|
|
11112
|
-
voices:
|
|
11113
|
-
} :
|
|
11114
|
-
...
|
|
11110
|
+
apiKey: o || W.apiKey,
|
|
11111
|
+
defaultVoice: s || W.defaultVoice || We.defaultVoice,
|
|
11112
|
+
voices: W.voices || We.voices
|
|
11113
|
+
} : D = {
|
|
11114
|
+
...W,
|
|
11115
11115
|
// Override API key if provided via props
|
|
11116
|
-
apiKey: o !== null ? o :
|
|
11116
|
+
apiKey: o !== null ? o : W.apiKey
|
|
11117
11117
|
};
|
|
11118
|
-
const
|
|
11118
|
+
const Y = {
|
|
11119
11119
|
url: p,
|
|
11120
11120
|
body: e,
|
|
11121
11121
|
avatarMood: t,
|
|
11122
|
-
ttsLang:
|
|
11123
|
-
ttsVoice: s ||
|
|
11122
|
+
ttsLang: I === "browser" ? "en-US" : n,
|
|
11123
|
+
ttsVoice: s || D.defaultVoice,
|
|
11124
11124
|
lipsyncLang: "en",
|
|
11125
11125
|
showFullAvatar: r,
|
|
11126
11126
|
bodyMovement: a,
|
|
11127
11127
|
movementIntensity: l
|
|
11128
|
-
},
|
|
11129
|
-
ttsEndpoint:
|
|
11130
|
-
ttsApikey:
|
|
11131
|
-
ttsService:
|
|
11128
|
+
}, q = {
|
|
11129
|
+
ttsEndpoint: D.endpoint,
|
|
11130
|
+
ttsApikey: D.apiKey,
|
|
11131
|
+
ttsService: I,
|
|
11132
11132
|
lipsyncModules: ["en"],
|
|
11133
11133
|
cameraView: h
|
|
11134
|
-
},
|
|
11135
|
-
if (!(!
|
|
11134
|
+
}, se = V(async () => {
|
|
11135
|
+
if (!(!A.current || f.current))
|
|
11136
11136
|
try {
|
|
11137
|
-
if (T(!0),
|
|
11138
|
-
if (
|
|
11139
|
-
const
|
|
11140
|
-
u(
|
|
11137
|
+
if (T(!0), E(null), f.current = new Dn(A.current, q), f.current.controls && (f.current.controls.enableRotate = !1, f.current.controls.enableZoom = !1, f.current.controls.enablePan = !1, f.current.controls.enableDamping = !1), g && Object.keys(g).length > 0 && (f.current.customAnimations = g), await f.current.showAvatar(Y, (G) => {
|
|
11138
|
+
if (G.lengthComputable) {
|
|
11139
|
+
const X = Math.min(100, Math.round(G.loaded / G.total * 100));
|
|
11140
|
+
u(X);
|
|
11141
11141
|
}
|
|
11142
|
-
}), await new Promise((
|
|
11143
|
-
const
|
|
11144
|
-
f.current.lipsync && Object.keys(f.current.lipsync).length > 0 ?
|
|
11142
|
+
}), await new Promise((G) => {
|
|
11143
|
+
const X = () => {
|
|
11144
|
+
f.current.lipsync && Object.keys(f.current.lipsync).length > 0 ? G() : setTimeout(X, 100);
|
|
11145
11145
|
};
|
|
11146
|
-
|
|
11146
|
+
X();
|
|
11147
11147
|
}), f.current && f.current.setShowFullAvatar)
|
|
11148
11148
|
try {
|
|
11149
11149
|
f.current.setShowFullAvatar(r);
|
|
11150
|
-
} catch (
|
|
11151
|
-
console.warn("Error setting full body mode on initialization:",
|
|
11150
|
+
} catch (G) {
|
|
11151
|
+
console.warn("Error setting full body mode on initialization:", G);
|
|
11152
11152
|
}
|
|
11153
|
-
f.current && f.current.controls && (f.current.controls.enableRotate = !1, f.current.controls.enableZoom = !1, f.current.controls.enablePan = !1, f.current.controls.enableDamping = !1, f.current.controls.update()), T(!1),
|
|
11154
|
-
const
|
|
11153
|
+
f.current && f.current.controls && (f.current.controls.enableRotate = !1, f.current.controls.enableZoom = !1, f.current.controls.enablePan = !1, f.current.controls.enableDamping = !1, f.current.controls.update()), T(!1), O(!0), c(f.current);
|
|
11154
|
+
const _ = () => {
|
|
11155
11155
|
document.visibilityState === "visible" ? f.current?.start() : f.current?.stop();
|
|
11156
11156
|
};
|
|
11157
|
-
return document.addEventListener("visibilitychange",
|
|
11158
|
-
document.removeEventListener("visibilitychange",
|
|
11157
|
+
return document.addEventListener("visibilitychange", _), () => {
|
|
11158
|
+
document.removeEventListener("visibilitychange", _);
|
|
11159
11159
|
};
|
|
11160
|
-
} catch (
|
|
11161
|
-
console.error("Error initializing TalkingHead:",
|
|
11160
|
+
} catch (k) {
|
|
11161
|
+
console.error("Error initializing TalkingHead:", k), E(k.message || "Failed to initialize avatar"), T(!1), d(k);
|
|
11162
11162
|
}
|
|
11163
11163
|
}, [p, e, t, n, i, s, o, r, a, l, h]);
|
|
11164
|
-
|
|
11164
|
+
nt(() => (se(), () => {
|
|
11165
11165
|
f.current && (f.current.stop(), f.current.dispose(), f.current = null);
|
|
11166
|
-
}), [
|
|
11167
|
-
if (!
|
|
11168
|
-
const
|
|
11169
|
-
for (const
|
|
11166
|
+
}), [se]), nt(() => {
|
|
11167
|
+
if (!A.current || !f.current) return;
|
|
11168
|
+
const k = new ResizeObserver((G) => {
|
|
11169
|
+
for (const X of G)
|
|
11170
11170
|
f.current && f.current.onResize && f.current.onResize();
|
|
11171
11171
|
});
|
|
11172
|
-
|
|
11173
|
-
const
|
|
11172
|
+
k.observe(A.current);
|
|
11173
|
+
const _ = () => {
|
|
11174
11174
|
f.current && f.current.onResize && f.current.onResize();
|
|
11175
11175
|
};
|
|
11176
|
-
return window.addEventListener("resize",
|
|
11177
|
-
|
|
11176
|
+
return window.addEventListener("resize", _), () => {
|
|
11177
|
+
k.disconnect(), window.removeEventListener("resize", _);
|
|
11178
11178
|
};
|
|
11179
|
-
}, [
|
|
11180
|
-
const
|
|
11179
|
+
}, [z]);
|
|
11180
|
+
const ee = V(async () => {
|
|
11181
11181
|
if (f.current && f.current.audioCtx)
|
|
11182
11182
|
try {
|
|
11183
11183
|
(f.current.audioCtx.state === "suspended" || f.current.audioCtx.state === "interrupted") && (await f.current.audioCtx.resume(), console.log("Audio context resumed"));
|
|
11184
|
-
} catch (
|
|
11185
|
-
console.warn("Failed to resume audio context:",
|
|
11184
|
+
} catch (k) {
|
|
11185
|
+
console.warn("Failed to resume audio context:", k);
|
|
11186
11186
|
}
|
|
11187
|
-
}, []),
|
|
11188
|
-
if (f.current &&
|
|
11187
|
+
}, []), Re = V(async (k, _ = {}) => {
|
|
11188
|
+
if (f.current && z)
|
|
11189
11189
|
try {
|
|
11190
|
-
await
|
|
11191
|
-
const
|
|
11192
|
-
...
|
|
11193
|
-
lipsyncLang:
|
|
11190
|
+
await ee();
|
|
11191
|
+
const G = {
|
|
11192
|
+
..._,
|
|
11193
|
+
lipsyncLang: _.lipsyncLang || Y.lipsyncLang || "en"
|
|
11194
11194
|
};
|
|
11195
|
-
if (
|
|
11196
|
-
const
|
|
11197
|
-
let
|
|
11198
|
-
const Rt = 600,
|
|
11195
|
+
if (_.onSpeechEnd && f.current) {
|
|
11196
|
+
const X = f.current, Se = X.onAudioEnd;
|
|
11197
|
+
let ce = null, Oe = 0;
|
|
11198
|
+
const Rt = 600, ht = () => {
|
|
11199
11199
|
if (Oe++, Oe > Rt) {
|
|
11200
|
-
|
|
11200
|
+
ce && (clearInterval(ce), ce = null);
|
|
11201
11201
|
try {
|
|
11202
|
-
|
|
11202
|
+
_.onSpeechEnd();
|
|
11203
11203
|
} catch (_e) {
|
|
11204
11204
|
console.error("Error in onSpeechEnd callback:", _e);
|
|
11205
11205
|
}
|
|
11206
11206
|
return;
|
|
11207
11207
|
}
|
|
11208
|
-
|
|
11208
|
+
X && (!X.isSpeaking || X.isSpeaking === !1) && (!X.audioPlaylist || X.audioPlaylist.length === 0) && (!X.isAudioPlaying || X.isAudioPlaying === !1) && (ce && (clearInterval(ce), ce = null), setTimeout(() => {
|
|
11209
11209
|
try {
|
|
11210
|
-
|
|
11210
|
+
_.onSpeechEnd();
|
|
11211
11211
|
} catch (_e) {
|
|
11212
11212
|
console.error("Error in onSpeechEnd callback:", _e);
|
|
11213
11213
|
}
|
|
11214
11214
|
}, 100));
|
|
11215
11215
|
};
|
|
11216
11216
|
setTimeout(() => {
|
|
11217
|
-
|
|
11217
|
+
ce = setInterval(ht, 100);
|
|
11218
11218
|
}, 500);
|
|
11219
11219
|
}
|
|
11220
|
-
f.current.lipsync && Object.keys(f.current.lipsync).length > 0 ? (f.current.setSlowdownRate && f.current.setSlowdownRate(1.05), f.current.speakText(
|
|
11221
|
-
await
|
|
11220
|
+
f.current.lipsync && Object.keys(f.current.lipsync).length > 0 ? (f.current.setSlowdownRate && f.current.setSlowdownRate(1.05), f.current.speakText(k, G)) : setTimeout(async () => {
|
|
11221
|
+
await ee(), f.current && f.current.lipsync && (f.current.setSlowdownRate && f.current.setSlowdownRate(1.05), f.current.speakText(k, G));
|
|
11222
11222
|
}, 500);
|
|
11223
|
-
} catch (
|
|
11224
|
-
console.error("Error speaking text:",
|
|
11223
|
+
} catch (G) {
|
|
11224
|
+
console.error("Error speaking text:", G), E(G.message || "Failed to speak text");
|
|
11225
11225
|
}
|
|
11226
|
-
}, [
|
|
11226
|
+
}, [z, ee, Y.lipsyncLang]), De = V(() => {
|
|
11227
11227
|
f.current && (f.current.stopSpeaking(), f.current.setSlowdownRate && f.current.setSlowdownRate(1));
|
|
11228
|
-
}, []),
|
|
11229
|
-
f.current && f.current.setMood(
|
|
11230
|
-
}, []),
|
|
11231
|
-
f.current && f.current.setSlowdownRate && f.current.setSlowdownRate(
|
|
11232
|
-
}, []),
|
|
11228
|
+
}, []), K = V((k) => {
|
|
11229
|
+
f.current && f.current.setMood(k);
|
|
11230
|
+
}, []), S = V((k) => {
|
|
11231
|
+
f.current && f.current.setSlowdownRate && f.current.setSlowdownRate(k);
|
|
11232
|
+
}, []), w = V((k, _ = !1) => {
|
|
11233
11233
|
if (f.current && f.current.playAnimation) {
|
|
11234
|
-
if (g && g[
|
|
11234
|
+
if (g && g[k] && (k = g[k]), f.current.setShowFullAvatar)
|
|
11235
11235
|
try {
|
|
11236
11236
|
f.current.setShowFullAvatar(!0);
|
|
11237
|
-
} catch (
|
|
11238
|
-
console.warn("Error setting full body mode:",
|
|
11237
|
+
} catch (X) {
|
|
11238
|
+
console.warn("Error setting full body mode:", X);
|
|
11239
11239
|
}
|
|
11240
|
-
if (
|
|
11240
|
+
if (k.includes("."))
|
|
11241
11241
|
try {
|
|
11242
|
-
f.current.playAnimation(
|
|
11243
|
-
} catch (
|
|
11244
|
-
console.warn(`Failed to play ${
|
|
11242
|
+
f.current.playAnimation(k, null, 10, 0, 0.01, _);
|
|
11243
|
+
} catch (X) {
|
|
11244
|
+
console.warn(`Failed to play ${k}:`, X);
|
|
11245
11245
|
try {
|
|
11246
11246
|
f.current.setBodyMovement("idle");
|
|
11247
|
-
} catch (
|
|
11248
|
-
console.warn("Fallback animation also failed:",
|
|
11247
|
+
} catch (Se) {
|
|
11248
|
+
console.warn("Fallback animation also failed:", Se);
|
|
11249
11249
|
}
|
|
11250
11250
|
}
|
|
11251
11251
|
else {
|
|
11252
|
-
const
|
|
11253
|
-
let
|
|
11254
|
-
for (const
|
|
11252
|
+
const X = [".fbx", ".glb", ".gltf"];
|
|
11253
|
+
let Se = !1;
|
|
11254
|
+
for (const ce of X)
|
|
11255
11255
|
try {
|
|
11256
|
-
f.current.playAnimation(
|
|
11256
|
+
f.current.playAnimation(k + ce, null, 10, 0, 0.01, _), Se = !0;
|
|
11257
11257
|
break;
|
|
11258
11258
|
} catch {
|
|
11259
11259
|
}
|
|
11260
|
-
if (!
|
|
11261
|
-
console.warn("Animation not found:",
|
|
11260
|
+
if (!Se) {
|
|
11261
|
+
console.warn("Animation not found:", k);
|
|
11262
11262
|
try {
|
|
11263
11263
|
f.current.setBodyMovement("idle");
|
|
11264
|
-
} catch (
|
|
11265
|
-
console.warn("Fallback animation also failed:",
|
|
11264
|
+
} catch (ce) {
|
|
11265
|
+
console.warn("Fallback animation also failed:", ce);
|
|
11266
11266
|
}
|
|
11267
11267
|
}
|
|
11268
11268
|
}
|
|
11269
11269
|
}
|
|
11270
|
-
}, [g]),
|
|
11270
|
+
}, [g]), F = V(() => {
|
|
11271
11271
|
f.current && f.current.onResize && f.current.onResize();
|
|
11272
11272
|
}, []);
|
|
11273
11273
|
return Gt(b, () => ({
|
|
11274
|
-
speakText:
|
|
11275
|
-
stopSpeaking:
|
|
11276
|
-
resumeAudioContext:
|
|
11277
|
-
setMood:
|
|
11278
|
-
setTimingAdjustment:
|
|
11279
|
-
playAnimation:
|
|
11280
|
-
isReady:
|
|
11274
|
+
speakText: Re,
|
|
11275
|
+
stopSpeaking: De,
|
|
11276
|
+
resumeAudioContext: ee,
|
|
11277
|
+
setMood: K,
|
|
11278
|
+
setTimingAdjustment: S,
|
|
11279
|
+
playAnimation: w,
|
|
11280
|
+
isReady: z,
|
|
11281
11281
|
talkingHead: f.current,
|
|
11282
|
-
handleResize:
|
|
11283
|
-
setBodyMovement: (
|
|
11282
|
+
handleResize: F,
|
|
11283
|
+
setBodyMovement: (k) => {
|
|
11284
11284
|
if (f.current && f.current.setShowFullAvatar && f.current.setBodyMovement)
|
|
11285
11285
|
try {
|
|
11286
|
-
f.current.setShowFullAvatar(!0), f.current.setBodyMovement(
|
|
11287
|
-
} catch (
|
|
11288
|
-
console.warn("Error setting body movement:",
|
|
11286
|
+
f.current.setShowFullAvatar(!0), f.current.setBodyMovement(k);
|
|
11287
|
+
} catch (_) {
|
|
11288
|
+
console.warn("Error setting body movement:", _);
|
|
11289
11289
|
}
|
|
11290
11290
|
},
|
|
11291
|
-
setMovementIntensity: (
|
|
11291
|
+
setMovementIntensity: (k) => f.current?.setMovementIntensity(k),
|
|
11292
11292
|
playRandomDance: () => {
|
|
11293
11293
|
if (f.current && f.current.setShowFullAvatar && f.current.playRandomDance)
|
|
11294
11294
|
try {
|
|
11295
11295
|
f.current.setShowFullAvatar(!0), f.current.playRandomDance();
|
|
11296
|
-
} catch (
|
|
11297
|
-
console.warn("Error playing random dance:",
|
|
11296
|
+
} catch (k) {
|
|
11297
|
+
console.warn("Error playing random dance:", k);
|
|
11298
11298
|
}
|
|
11299
11299
|
},
|
|
11300
|
-
playReaction: (
|
|
11300
|
+
playReaction: (k) => {
|
|
11301
11301
|
if (f.current && f.current.setShowFullAvatar && f.current.playReaction)
|
|
11302
11302
|
try {
|
|
11303
|
-
f.current.setShowFullAvatar(!0), f.current.playReaction(
|
|
11304
|
-
} catch (
|
|
11305
|
-
console.warn("Error playing reaction:",
|
|
11303
|
+
f.current.setShowFullAvatar(!0), f.current.playReaction(k);
|
|
11304
|
+
} catch (_) {
|
|
11305
|
+
console.warn("Error playing reaction:", _);
|
|
11306
11306
|
}
|
|
11307
11307
|
},
|
|
11308
11308
|
playCelebration: () => {
|
|
11309
11309
|
if (f.current && f.current.setShowFullAvatar && f.current.playCelebration)
|
|
11310
11310
|
try {
|
|
11311
11311
|
f.current.setShowFullAvatar(!0), f.current.playCelebration();
|
|
11312
|
-
} catch (
|
|
11313
|
-
console.warn("Error playing celebration:",
|
|
11312
|
+
} catch (k) {
|
|
11313
|
+
console.warn("Error playing celebration:", k);
|
|
11314
11314
|
}
|
|
11315
11315
|
},
|
|
11316
|
-
setShowFullAvatar: (
|
|
11316
|
+
setShowFullAvatar: (k) => {
|
|
11317
11317
|
if (f.current && f.current.setShowFullAvatar)
|
|
11318
11318
|
try {
|
|
11319
|
-
f.current.setShowFullAvatar(
|
|
11320
|
-
} catch (
|
|
11321
|
-
console.warn("Error setting showFullAvatar:",
|
|
11319
|
+
f.current.setShowFullAvatar(k);
|
|
11320
|
+
} catch (_) {
|
|
11321
|
+
console.warn("Error setting showFullAvatar:", _);
|
|
11322
11322
|
}
|
|
11323
11323
|
},
|
|
11324
11324
|
lockAvatarPosition: () => {
|
|
11325
11325
|
if (f.current && f.current.lockAvatarPosition)
|
|
11326
11326
|
try {
|
|
11327
11327
|
f.current.lockAvatarPosition();
|
|
11328
|
-
} catch (
|
|
11329
|
-
console.warn("Error locking avatar position:",
|
|
11328
|
+
} catch (k) {
|
|
11329
|
+
console.warn("Error locking avatar position:", k);
|
|
11330
11330
|
}
|
|
11331
11331
|
},
|
|
11332
11332
|
unlockAvatarPosition: () => {
|
|
11333
11333
|
if (f.current && f.current.unlockAvatarPosition)
|
|
11334
11334
|
try {
|
|
11335
11335
|
f.current.unlockAvatarPosition();
|
|
11336
|
-
} catch (
|
|
11337
|
-
console.warn("Error unlocking avatar position:",
|
|
11336
|
+
} catch (k) {
|
|
11337
|
+
console.warn("Error unlocking avatar position:", k);
|
|
11338
11338
|
}
|
|
11339
11339
|
}
|
|
11340
11340
|
})), /* @__PURE__ */ rn(
|
|
@@ -11348,10 +11348,10 @@ const On = Ut(({
|
|
|
11348
11348
|
...y
|
|
11349
11349
|
},
|
|
11350
11350
|
children: [
|
|
11351
|
-
/* @__PURE__ */
|
|
11351
|
+
/* @__PURE__ */ ze(
|
|
11352
11352
|
"div",
|
|
11353
11353
|
{
|
|
11354
|
-
ref:
|
|
11354
|
+
ref: A,
|
|
11355
11355
|
className: "talking-head-viewer",
|
|
11356
11356
|
style: {
|
|
11357
11357
|
width: "100%",
|
|
@@ -11360,7 +11360,7 @@ const On = Ut(({
|
|
|
11360
11360
|
}
|
|
11361
11361
|
}
|
|
11362
11362
|
),
|
|
11363
|
-
|
|
11363
|
+
L && /* @__PURE__ */ ze("div", { className: "loading-overlay", style: {
|
|
11364
11364
|
position: "absolute",
|
|
11365
11365
|
top: "50%",
|
|
11366
11366
|
left: "50%",
|
|
@@ -11369,7 +11369,7 @@ const On = Ut(({
|
|
|
11369
11369
|
fontSize: "18px",
|
|
11370
11370
|
zIndex: 10
|
|
11371
11371
|
}, children: "Loading avatar..." }),
|
|
11372
|
-
|
|
11372
|
+
v && /* @__PURE__ */ ze("div", { className: "error-overlay", style: {
|
|
11373
11373
|
position: "absolute",
|
|
11374
11374
|
top: "50%",
|
|
11375
11375
|
left: "50%",
|
|
@@ -11380,7 +11380,7 @@ const On = Ut(({
|
|
|
11380
11380
|
zIndex: 10,
|
|
11381
11381
|
padding: "20px",
|
|
11382
11382
|
borderRadius: "8px"
|
|
11383
|
-
}, children:
|
|
11383
|
+
}, children: v })
|
|
11384
11384
|
]
|
|
11385
11385
|
}
|
|
11386
11386
|
);
|
|
@@ -11398,7 +11398,7 @@ const fo = Ut(({
|
|
|
11398
11398
|
style: s = {},
|
|
11399
11399
|
avatarConfig: o = {}
|
|
11400
11400
|
}, a) => {
|
|
11401
|
-
const l =
|
|
11401
|
+
const l = re(null), r = re(null), [h, c] = Xe(!0), [u, d] = Xe(null), [m, y] = Xe(!1), g = Wt(), b = o.ttsService || g.service, A = b === "browser" ? {
|
|
11402
11402
|
endpoint: "",
|
|
11403
11403
|
apiKey: null,
|
|
11404
11404
|
defaultVoice: "Google US English"
|
|
@@ -11414,7 +11414,7 @@ const fo = Ut(({
|
|
|
11414
11414
|
body: "F",
|
|
11415
11415
|
avatarMood: "neutral",
|
|
11416
11416
|
ttsLang: b === "browser" ? "en-US" : "en",
|
|
11417
|
-
ttsVoice: o.ttsVoice ||
|
|
11417
|
+
ttsVoice: o.ttsVoice || A.defaultVoice,
|
|
11418
11418
|
lipsyncLang: "en",
|
|
11419
11419
|
// English lip-sync
|
|
11420
11420
|
showFullAvatar: !0,
|
|
@@ -11422,176 +11422,176 @@ const fo = Ut(({
|
|
|
11422
11422
|
bodyMovement: "idle",
|
|
11423
11423
|
movementIntensity: 0.5,
|
|
11424
11424
|
...o
|
|
11425
|
-
},
|
|
11426
|
-
ttsEndpoint:
|
|
11427
|
-
ttsApikey:
|
|
11425
|
+
}, L = {
|
|
11426
|
+
ttsEndpoint: A.endpoint,
|
|
11427
|
+
ttsApikey: A.apiKey,
|
|
11428
11428
|
ttsService: b,
|
|
11429
11429
|
lipsyncModules: ["en"],
|
|
11430
11430
|
cameraView: "upper"
|
|
11431
|
-
}, T =
|
|
11431
|
+
}, T = V(async () => {
|
|
11432
11432
|
if (!(!l.current || r.current))
|
|
11433
11433
|
try {
|
|
11434
|
-
if (c(!0), d(null), r.current = new Dn(l.current,
|
|
11435
|
-
if (
|
|
11436
|
-
const
|
|
11437
|
-
e(
|
|
11434
|
+
if (c(!0), d(null), r.current = new Dn(l.current, L), await r.current.showAvatar(f, (Y) => {
|
|
11435
|
+
if (Y.lengthComputable) {
|
|
11436
|
+
const q = Math.min(100, Math.round(Y.loaded / Y.total * 100));
|
|
11437
|
+
e(q);
|
|
11438
11438
|
}
|
|
11439
11439
|
}), r.current.morphs && r.current.morphs.length > 0) {
|
|
11440
|
-
const
|
|
11441
|
-
console.log("Available morph targets:", Object.keys(
|
|
11442
|
-
const
|
|
11443
|
-
console.log("Viseme morph targets found:",
|
|
11440
|
+
const Y = r.current.morphs[0].morphTargetDictionary;
|
|
11441
|
+
console.log("Available morph targets:", Object.keys(Y));
|
|
11442
|
+
const q = Object.keys(Y).filter((se) => se.startsWith("viseme_"));
|
|
11443
|
+
console.log("Viseme morph targets found:", q), q.length === 0 && (console.warn("No viseme morph targets found! Lip-sync will not work properly."), console.log("Expected viseme targets: viseme_aa, viseme_E, viseme_I, viseme_O, viseme_U, viseme_PP, viseme_SS, viseme_TH, viseme_DD, viseme_FF, viseme_kk, viseme_nn, viseme_RR, viseme_CH, viseme_sil"));
|
|
11444
11444
|
}
|
|
11445
|
-
if (await new Promise((
|
|
11446
|
-
const
|
|
11447
|
-
r.current.lipsync && Object.keys(r.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(r.current.lipsync)),
|
|
11445
|
+
if (await new Promise((Y) => {
|
|
11446
|
+
const q = () => {
|
|
11447
|
+
r.current.lipsync && Object.keys(r.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(r.current.lipsync)), Y()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(q, 100));
|
|
11448
11448
|
};
|
|
11449
|
-
|
|
11449
|
+
q();
|
|
11450
11450
|
}), r.current && r.current.setShowFullAvatar)
|
|
11451
11451
|
try {
|
|
11452
11452
|
r.current.setShowFullAvatar(!0), console.log("Avatar initialized in full body mode");
|
|
11453
|
-
} catch (
|
|
11454
|
-
console.warn("Error setting full body mode on initialization:",
|
|
11453
|
+
} catch (Y) {
|
|
11454
|
+
console.warn("Error setting full body mode on initialization:", Y);
|
|
11455
11455
|
}
|
|
11456
11456
|
c(!1), y(!0), n(r.current);
|
|
11457
|
-
const
|
|
11457
|
+
const D = () => {
|
|
11458
11458
|
document.visibilityState === "visible" ? r.current?.start() : r.current?.stop();
|
|
11459
11459
|
};
|
|
11460
|
-
return document.addEventListener("visibilitychange",
|
|
11461
|
-
document.removeEventListener("visibilitychange",
|
|
11460
|
+
return document.addEventListener("visibilitychange", D), () => {
|
|
11461
|
+
document.removeEventListener("visibilitychange", D);
|
|
11462
11462
|
};
|
|
11463
|
-
} catch (
|
|
11464
|
-
console.error("Error initializing TalkingHead:",
|
|
11463
|
+
} catch (I) {
|
|
11464
|
+
console.error("Error initializing TalkingHead:", I), d(I.message || "Failed to initialize avatar"), c(!1), t(I);
|
|
11465
11465
|
}
|
|
11466
11466
|
}, []);
|
|
11467
|
-
|
|
11467
|
+
nt(() => (T(), () => {
|
|
11468
11468
|
r.current && (r.current.stop(), r.current.dispose(), r.current = null);
|
|
11469
11469
|
}), [T]);
|
|
11470
|
-
const
|
|
11470
|
+
const v = V((I) => {
|
|
11471
11471
|
if (r.current && m)
|
|
11472
11472
|
try {
|
|
11473
|
-
console.log("Speaking text:",
|
|
11474
|
-
r.current && r.current.lipsync ? (console.log("Lip-sync now ready, speaking..."), r.current.setSlowdownRate && (r.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), r.current.speakText(
|
|
11473
|
+
console.log("Speaking text:", I), console.log("Avatar config:", f), console.log("TalkingHead instance:", r.current), r.current.lipsync && Object.keys(r.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(r.current.lipsync)), r.current.setSlowdownRate && (r.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), r.current.speakText(I)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
|
|
11474
|
+
r.current && r.current.lipsync ? (console.log("Lip-sync now ready, speaking..."), r.current.setSlowdownRate && (r.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), r.current.speakText(I)) : console.error("Lip-sync still not ready after waiting");
|
|
11475
11475
|
}, 500));
|
|
11476
|
-
} catch (
|
|
11477
|
-
console.error("Error speaking text:",
|
|
11476
|
+
} catch (D) {
|
|
11477
|
+
console.error("Error speaking text:", D), d(D.message || "Failed to speak text");
|
|
11478
11478
|
}
|
|
11479
11479
|
else
|
|
11480
11480
|
console.warn("Avatar not ready for speaking. isReady:", m, "talkingHeadRef:", !!r.current);
|
|
11481
|
-
}, [m, f]),
|
|
11481
|
+
}, [m, f]), E = V(() => {
|
|
11482
11482
|
r.current && (r.current.stopSpeaking(), r.current.setSlowdownRate && (r.current.setSlowdownRate(1), console.log("Reset timing to normal")));
|
|
11483
|
-
}, []),
|
|
11484
|
-
r.current && r.current.setMood(
|
|
11485
|
-
}, []),
|
|
11486
|
-
r.current && r.current.setSlowdownRate && (r.current.setSlowdownRate(
|
|
11487
|
-
}, []),
|
|
11483
|
+
}, []), z = V((I) => {
|
|
11484
|
+
r.current && r.current.setMood(I);
|
|
11485
|
+
}, []), O = V((I) => {
|
|
11486
|
+
r.current && r.current.setSlowdownRate && (r.current.setSlowdownRate(I), console.log("Timing adjustment set to:", I));
|
|
11487
|
+
}, []), W = V((I, D = !1) => {
|
|
11488
11488
|
if (r.current && r.current.playAnimation) {
|
|
11489
11489
|
if (r.current.setShowFullAvatar)
|
|
11490
11490
|
try {
|
|
11491
11491
|
r.current.setShowFullAvatar(!0);
|
|
11492
|
-
} catch (
|
|
11493
|
-
console.warn("Error setting full body mode:",
|
|
11492
|
+
} catch (q) {
|
|
11493
|
+
console.warn("Error setting full body mode:", q);
|
|
11494
11494
|
}
|
|
11495
|
-
if (
|
|
11495
|
+
if (I.includes("."))
|
|
11496
11496
|
try {
|
|
11497
|
-
r.current.playAnimation(
|
|
11498
|
-
} catch (
|
|
11499
|
-
console.log(`Failed to play ${
|
|
11497
|
+
r.current.playAnimation(I, null, 10, 0, 0.01, D), console.log("Playing animation:", I);
|
|
11498
|
+
} catch (q) {
|
|
11499
|
+
console.log(`Failed to play ${I}:`, q);
|
|
11500
11500
|
try {
|
|
11501
11501
|
r.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
11502
|
-
} catch (
|
|
11503
|
-
console.warn("Fallback animation also failed:",
|
|
11502
|
+
} catch (se) {
|
|
11503
|
+
console.warn("Fallback animation also failed:", se);
|
|
11504
11504
|
}
|
|
11505
11505
|
}
|
|
11506
11506
|
else {
|
|
11507
|
-
const
|
|
11508
|
-
let
|
|
11509
|
-
for (const
|
|
11507
|
+
const q = [".fbx", ".glb", ".gltf"];
|
|
11508
|
+
let se = !1;
|
|
11509
|
+
for (const ee of q)
|
|
11510
11510
|
try {
|
|
11511
|
-
r.current.playAnimation(
|
|
11511
|
+
r.current.playAnimation(I + ee, null, 10, 0, 0.01, D), console.log("Playing animation:", I + ee), se = !0;
|
|
11512
11512
|
break;
|
|
11513
11513
|
} catch {
|
|
11514
|
-
console.log(`Failed to play ${
|
|
11514
|
+
console.log(`Failed to play ${I}${ee}, trying next format...`);
|
|
11515
11515
|
}
|
|
11516
|
-
if (!
|
|
11517
|
-
console.warn("Animation system not available or animation not found:",
|
|
11516
|
+
if (!se) {
|
|
11517
|
+
console.warn("Animation system not available or animation not found:", I);
|
|
11518
11518
|
try {
|
|
11519
11519
|
r.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
11520
|
-
} catch (
|
|
11521
|
-
console.warn("Fallback animation also failed:",
|
|
11520
|
+
} catch (ee) {
|
|
11521
|
+
console.warn("Fallback animation also failed:", ee);
|
|
11522
11522
|
}
|
|
11523
11523
|
}
|
|
11524
11524
|
}
|
|
11525
11525
|
} else
|
|
11526
|
-
console.warn("Animation system not available or animation not found:",
|
|
11526
|
+
console.warn("Animation system not available or animation not found:", I);
|
|
11527
11527
|
}, []);
|
|
11528
11528
|
return Gt(a, () => ({
|
|
11529
|
-
speakText:
|
|
11530
|
-
stopSpeaking:
|
|
11531
|
-
setMood:
|
|
11532
|
-
setTimingAdjustment:
|
|
11533
|
-
playAnimation:
|
|
11529
|
+
speakText: v,
|
|
11530
|
+
stopSpeaking: E,
|
|
11531
|
+
setMood: z,
|
|
11532
|
+
setTimingAdjustment: O,
|
|
11533
|
+
playAnimation: W,
|
|
11534
11534
|
isReady: m,
|
|
11535
11535
|
talkingHead: r.current,
|
|
11536
|
-
setBodyMovement: (
|
|
11536
|
+
setBodyMovement: (I) => {
|
|
11537
11537
|
if (r.current && r.current.setShowFullAvatar && r.current.setBodyMovement)
|
|
11538
11538
|
try {
|
|
11539
|
-
r.current.setShowFullAvatar(!0), r.current.setBodyMovement(
|
|
11540
|
-
} catch (
|
|
11541
|
-
console.warn("Error setting body movement:",
|
|
11539
|
+
r.current.setShowFullAvatar(!0), r.current.setBodyMovement(I), console.log("Body movement set with full body mode:", I);
|
|
11540
|
+
} catch (D) {
|
|
11541
|
+
console.warn("Error setting body movement:", D);
|
|
11542
11542
|
}
|
|
11543
11543
|
},
|
|
11544
|
-
setMovementIntensity: (
|
|
11544
|
+
setMovementIntensity: (I) => r.current?.setMovementIntensity(I),
|
|
11545
11545
|
playRandomDance: () => {
|
|
11546
11546
|
if (r.current && r.current.setShowFullAvatar && r.current.playRandomDance)
|
|
11547
11547
|
try {
|
|
11548
11548
|
r.current.setShowFullAvatar(!0), r.current.playRandomDance(), console.log("Random dance played with full body mode");
|
|
11549
|
-
} catch (
|
|
11550
|
-
console.warn("Error playing random dance:",
|
|
11549
|
+
} catch (I) {
|
|
11550
|
+
console.warn("Error playing random dance:", I);
|
|
11551
11551
|
}
|
|
11552
11552
|
},
|
|
11553
|
-
playReaction: (
|
|
11553
|
+
playReaction: (I) => {
|
|
11554
11554
|
if (r.current && r.current.setShowFullAvatar && r.current.playReaction)
|
|
11555
11555
|
try {
|
|
11556
|
-
r.current.setShowFullAvatar(!0), r.current.playReaction(
|
|
11557
|
-
} catch (
|
|
11558
|
-
console.warn("Error playing reaction:",
|
|
11556
|
+
r.current.setShowFullAvatar(!0), r.current.playReaction(I), console.log("Reaction played with full body mode:", I);
|
|
11557
|
+
} catch (D) {
|
|
11558
|
+
console.warn("Error playing reaction:", D);
|
|
11559
11559
|
}
|
|
11560
11560
|
},
|
|
11561
11561
|
playCelebration: () => {
|
|
11562
11562
|
if (r.current && r.current.setShowFullAvatar && r.current.playCelebration)
|
|
11563
11563
|
try {
|
|
11564
11564
|
r.current.setShowFullAvatar(!0), r.current.playCelebration(), console.log("Celebration played with full body mode");
|
|
11565
|
-
} catch (
|
|
11566
|
-
console.warn("Error playing celebration:",
|
|
11565
|
+
} catch (I) {
|
|
11566
|
+
console.warn("Error playing celebration:", I);
|
|
11567
11567
|
}
|
|
11568
11568
|
},
|
|
11569
|
-
setShowFullAvatar: (
|
|
11569
|
+
setShowFullAvatar: (I) => {
|
|
11570
11570
|
if (r.current && r.current.setShowFullAvatar)
|
|
11571
11571
|
try {
|
|
11572
|
-
r.current.setShowFullAvatar(
|
|
11573
|
-
} catch (
|
|
11574
|
-
console.warn("Error setting showFullAvatar:",
|
|
11572
|
+
r.current.setShowFullAvatar(I), console.log("Show full avatar set to:", I);
|
|
11573
|
+
} catch (D) {
|
|
11574
|
+
console.warn("Error setting showFullAvatar:", D);
|
|
11575
11575
|
}
|
|
11576
11576
|
},
|
|
11577
11577
|
lockAvatarPosition: () => {
|
|
11578
11578
|
if (r.current && r.current.lockAvatarPosition)
|
|
11579
11579
|
try {
|
|
11580
11580
|
r.current.lockAvatarPosition();
|
|
11581
|
-
} catch (
|
|
11582
|
-
console.warn("Error locking avatar position:",
|
|
11581
|
+
} catch (I) {
|
|
11582
|
+
console.warn("Error locking avatar position:", I);
|
|
11583
11583
|
}
|
|
11584
11584
|
},
|
|
11585
11585
|
unlockAvatarPosition: () => {
|
|
11586
11586
|
if (r.current && r.current.unlockAvatarPosition)
|
|
11587
11587
|
try {
|
|
11588
11588
|
r.current.unlockAvatarPosition();
|
|
11589
|
-
} catch (
|
|
11590
|
-
console.warn("Error unlocking avatar position:",
|
|
11589
|
+
} catch (I) {
|
|
11590
|
+
console.warn("Error unlocking avatar position:", I);
|
|
11591
11591
|
}
|
|
11592
11592
|
}
|
|
11593
11593
|
})), /* @__PURE__ */ rn("div", { className: `talking-head-container ${i}`, style: s, children: [
|
|
11594
|
-
/* @__PURE__ */
|
|
11594
|
+
/* @__PURE__ */ ze(
|
|
11595
11595
|
"div",
|
|
11596
11596
|
{
|
|
11597
11597
|
ref: l,
|
|
@@ -11603,7 +11603,7 @@ const fo = Ut(({
|
|
|
11603
11603
|
}
|
|
11604
11604
|
}
|
|
11605
11605
|
),
|
|
11606
|
-
h && /* @__PURE__ */
|
|
11606
|
+
h && /* @__PURE__ */ ze("div", { className: "loading-overlay", style: {
|
|
11607
11607
|
position: "absolute",
|
|
11608
11608
|
top: "50%",
|
|
11609
11609
|
left: "50%",
|
|
@@ -11612,7 +11612,7 @@ const fo = Ut(({
|
|
|
11612
11612
|
fontSize: "18px",
|
|
11613
11613
|
zIndex: 10
|
|
11614
11614
|
}, children: "Loading avatar..." }),
|
|
11615
|
-
u && /* @__PURE__ */
|
|
11615
|
+
u && /* @__PURE__ */ ze("div", { className: "error-overlay", style: {
|
|
11616
11616
|
position: "absolute",
|
|
11617
11617
|
top: "50%",
|
|
11618
11618
|
left: "50%",
|
|
@@ -11643,7 +11643,7 @@ const go = Ut(({
|
|
|
11643
11643
|
},
|
|
11644
11644
|
autoStart: l = !1
|
|
11645
11645
|
}, r) => {
|
|
11646
|
-
const h =
|
|
11646
|
+
const h = re(null), c = re({
|
|
11647
11647
|
currentModuleIndex: 0,
|
|
11648
11648
|
currentLessonIndex: 0,
|
|
11649
11649
|
currentQuestionIndex: 0,
|
|
@@ -11653,44 +11653,61 @@ const go = Ut(({
|
|
|
11653
11653
|
curriculumCompleted: !1,
|
|
11654
11654
|
score: 0,
|
|
11655
11655
|
totalQuestions: 0
|
|
11656
|
-
}), u =
|
|
11656
|
+
}), u = re({
|
|
11657
11657
|
onLessonStart: n,
|
|
11658
11658
|
onLessonComplete: i,
|
|
11659
11659
|
onQuestionAnswer: s,
|
|
11660
11660
|
onCurriculumComplete: o,
|
|
11661
11661
|
onCustomAction: a
|
|
11662
|
-
}), d =
|
|
11663
|
-
gt(() => {
|
|
11664
|
-
u.current = {
|
|
11665
|
-
onLessonStart: n,
|
|
11666
|
-
onLessonComplete: i,
|
|
11667
|
-
onQuestionAnswer: s,
|
|
11668
|
-
onCurriculumComplete: o,
|
|
11669
|
-
onCustomAction: a
|
|
11670
|
-
};
|
|
11671
|
-
}, [n, i, s, o, a]);
|
|
11672
|
-
const f = p?.curriculum || {
|
|
11662
|
+
}), d = re(null), m = re(null), y = re(null), g = re(null), b = re(null), A = re(null), f = re(null), L = re(p?.curriculum || {
|
|
11673
11663
|
title: "Default Curriculum",
|
|
11674
11664
|
description: "No curriculum data provided",
|
|
11675
11665
|
language: "en",
|
|
11676
11666
|
modules: []
|
|
11677
|
-
},
|
|
11667
|
+
}), T = re({
|
|
11678
11668
|
avatarUrl: e.avatarUrl || "/avatars/brunette.glb",
|
|
11679
11669
|
avatarBody: e.avatarBody || "F",
|
|
11680
11670
|
mood: e.mood || "happy",
|
|
11681
11671
|
ttsLang: e.ttsLang || "en",
|
|
11682
11672
|
ttsService: e.ttsService || null,
|
|
11683
|
-
// Don't default to "edge" - let config decide
|
|
11684
11673
|
ttsVoice: e.ttsVoice || null,
|
|
11685
|
-
// Don't default - let config decide
|
|
11686
11674
|
ttsApiKey: e.ttsApiKey || null,
|
|
11687
11675
|
bodyMovement: e.bodyMovement || "gesturing",
|
|
11688
11676
|
movementIntensity: e.movementIntensity || 0.7,
|
|
11689
11677
|
showFullAvatar: e.showFullAvatar !== void 0 ? e.showFullAvatar : !0,
|
|
11690
11678
|
animations: t,
|
|
11691
11679
|
lipsyncLang: "en"
|
|
11692
|
-
|
|
11693
|
-
|
|
11680
|
+
});
|
|
11681
|
+
nt(() => {
|
|
11682
|
+
u.current = {
|
|
11683
|
+
onLessonStart: n,
|
|
11684
|
+
onLessonComplete: i,
|
|
11685
|
+
onQuestionAnswer: s,
|
|
11686
|
+
onCurriculumComplete: o,
|
|
11687
|
+
onCustomAction: a
|
|
11688
|
+
};
|
|
11689
|
+
}, [n, i, s, o, a]), nt(() => {
|
|
11690
|
+
L.current = p?.curriculum || {
|
|
11691
|
+
title: "Default Curriculum",
|
|
11692
|
+
description: "No curriculum data provided",
|
|
11693
|
+
language: "en",
|
|
11694
|
+
modules: []
|
|
11695
|
+
}, T.current = {
|
|
11696
|
+
avatarUrl: e.avatarUrl || "/avatars/brunette.glb",
|
|
11697
|
+
avatarBody: e.avatarBody || "F",
|
|
11698
|
+
mood: e.mood || "happy",
|
|
11699
|
+
ttsLang: e.ttsLang || "en",
|
|
11700
|
+
ttsService: e.ttsService || null,
|
|
11701
|
+
ttsVoice: e.ttsVoice || null,
|
|
11702
|
+
ttsApiKey: e.ttsApiKey || null,
|
|
11703
|
+
bodyMovement: e.bodyMovement || "gesturing",
|
|
11704
|
+
movementIntensity: e.movementIntensity || 0.7,
|
|
11705
|
+
showFullAvatar: e.showFullAvatar !== void 0 ? e.showFullAvatar : !0,
|
|
11706
|
+
animations: t,
|
|
11707
|
+
lipsyncLang: "en"
|
|
11708
|
+
};
|
|
11709
|
+
}, [p, e, t]);
|
|
11710
|
+
const v = V(() => (L.current || { modules: [] }).modules[c.current.currentModuleIndex]?.lessons[c.current.currentLessonIndex], []), E = V(() => v()?.questions[c.current.currentQuestionIndex], [v]), z = V((S, w) => w.type === "multiple_choice" || w.type === "true_false" ? S === w.answer : w.type === "code_test" && typeof S == "object" && S !== null ? S.passed === !0 : !1, []), O = V(() => {
|
|
11694
11711
|
c.current.lessonCompleted = !0, c.current.isQuestionMode = !1;
|
|
11695
11712
|
const S = c.current.totalQuestions > 0 ? Math.round(c.current.score / c.current.totalQuestions * 100) : 100;
|
|
11696
11713
|
let w = "Congratulations! You've completed this lesson";
|
|
@@ -11714,16 +11731,16 @@ const go = Ut(({
|
|
|
11714
11731
|
} catch {
|
|
11715
11732
|
h.current.playCelebration();
|
|
11716
11733
|
}
|
|
11717
|
-
const
|
|
11718
|
-
|
|
11719
|
-
lipsyncLang:
|
|
11734
|
+
const k = (L.current || { modules: [] }).modules[c.current.currentModuleIndex], _ = c.current.currentLessonIndex < (k?.lessons?.length || 0) - 1, G = T.current || { lipsyncLang: "en" };
|
|
11735
|
+
_ ? h.current.speakText(w, {
|
|
11736
|
+
lipsyncLang: G.lipsyncLang,
|
|
11720
11737
|
onSpeechEnd: () => {
|
|
11721
11738
|
setTimeout(() => {
|
|
11722
11739
|
m.current && m.current();
|
|
11723
11740
|
}, 1e3);
|
|
11724
11741
|
}
|
|
11725
11742
|
}) : h.current.speakText(w, {
|
|
11726
|
-
lipsyncLang:
|
|
11743
|
+
lipsyncLang: G.lipsyncLang,
|
|
11727
11744
|
onSpeechEnd: () => {
|
|
11728
11745
|
setTimeout(() => {
|
|
11729
11746
|
b.current && b.current();
|
|
@@ -11731,10 +11748,12 @@ const go = Ut(({
|
|
|
11731
11748
|
}
|
|
11732
11749
|
});
|
|
11733
11750
|
}
|
|
11734
|
-
}, [t.lessonComplete
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
|
|
11751
|
+
}, [t.lessonComplete]), W = V(() => {
|
|
11752
|
+
c.current.curriculumCompleted = !0;
|
|
11753
|
+
const S = L.current || { modules: [] };
|
|
11754
|
+
if (u.current.onCurriculumComplete({
|
|
11755
|
+
modules: S.modules.length,
|
|
11756
|
+
totalLessons: S.modules.reduce((w, F) => w + F.lessons.length, 0)
|
|
11738
11757
|
}), h.current) {
|
|
11739
11758
|
if (h.current.setMood("celebrating"), t.curriculumComplete)
|
|
11740
11759
|
try {
|
|
@@ -11742,12 +11761,13 @@ const go = Ut(({
|
|
|
11742
11761
|
} catch {
|
|
11743
11762
|
h.current.playCelebration();
|
|
11744
11763
|
}
|
|
11745
|
-
|
|
11764
|
+
const w = T.current || { lipsyncLang: "en" };
|
|
11765
|
+
h.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang: w.lipsyncLang });
|
|
11746
11766
|
}
|
|
11747
|
-
}, [t.curriculumComplete
|
|
11748
|
-
const S =
|
|
11767
|
+
}, [t.curriculumComplete]), I = V(() => {
|
|
11768
|
+
const S = v();
|
|
11749
11769
|
c.current.isQuestionMode = !0, c.current.currentQuestionIndex = 0, c.current.totalQuestions = S?.questions?.length || 0;
|
|
11750
|
-
const w =
|
|
11770
|
+
const w = E();
|
|
11751
11771
|
if (w && u.current.onCustomAction({
|
|
11752
11772
|
type: "questionStart",
|
|
11753
11773
|
moduleIndex: c.current.currentModuleIndex,
|
|
@@ -11759,16 +11779,20 @@ const go = Ut(({
|
|
|
11759
11779
|
if (h.current.setMood("curious"), t.questionStart)
|
|
11760
11780
|
try {
|
|
11761
11781
|
h.current.playAnimation(t.questionStart, !0);
|
|
11762
|
-
} catch (
|
|
11763
|
-
console.warn("Failed to play questionStart animation:",
|
|
11782
|
+
} catch (k) {
|
|
11783
|
+
console.warn("Failed to play questionStart animation:", k);
|
|
11764
11784
|
}
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11785
|
+
const F = T.current || { lipsyncLang: "en" };
|
|
11786
|
+
w.type === "code_test" ? h.current.speakText(`Let's test your coding skills! Here's your first challenge: ${w.question}`, { lipsyncLang: F.lipsyncLang }) : w.type === "multiple_choice" ? h.current.speakText(`Now let me ask you some questions. Here's the first one: ${w.question}`, { lipsyncLang: F.lipsyncLang }) : w.type === "true_false" ? h.current.speakText(`Let's start with some true or false questions. First question: ${w.question}`, { lipsyncLang: F.lipsyncLang }) : h.current.speakText(`Now let me ask you some questions. Here's the first one: ${w.question}`, { lipsyncLang: F.lipsyncLang });
|
|
11787
|
+
} else if (h.current) {
|
|
11788
|
+
const F = T.current || { lipsyncLang: "en" };
|
|
11789
|
+
h.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: F.lipsyncLang });
|
|
11790
|
+
}
|
|
11791
|
+
}, [t.questionStart, v, E]), D = V(() => {
|
|
11792
|
+
const S = v();
|
|
11769
11793
|
if (c.current.currentQuestionIndex < (S?.questions?.length || 0) - 1) {
|
|
11770
11794
|
c.current.currentQuestionIndex += 1;
|
|
11771
|
-
const w =
|
|
11795
|
+
const w = E();
|
|
11772
11796
|
if (w && u.current.onCustomAction({
|
|
11773
11797
|
type: "nextQuestion",
|
|
11774
11798
|
moduleIndex: c.current.currentModuleIndex,
|
|
@@ -11780,42 +11804,45 @@ const go = Ut(({
|
|
|
11780
11804
|
if (h.current.setMood("happy"), h.current.setBodyMovement("idle"), t.nextQuestion)
|
|
11781
11805
|
try {
|
|
11782
11806
|
h.current.playAnimation(t.nextQuestion, !0);
|
|
11783
|
-
} catch (
|
|
11784
|
-
console.warn("Failed to play nextQuestion animation:",
|
|
11807
|
+
} catch (k) {
|
|
11808
|
+
console.warn("Failed to play nextQuestion animation:", k);
|
|
11785
11809
|
}
|
|
11810
|
+
const F = T.current || { lipsyncLang: "en" };
|
|
11786
11811
|
w.type === "code_test" ? h.current.speakText(`Great! Now let's move on to your next coding challenge: ${w.question}`, {
|
|
11787
|
-
lipsyncLang:
|
|
11812
|
+
lipsyncLang: F.lipsyncLang
|
|
11788
11813
|
}) : w.type === "multiple_choice" ? h.current.speakText(`Alright! Here's your next question: ${w.question}`, {
|
|
11789
|
-
lipsyncLang:
|
|
11814
|
+
lipsyncLang: F.lipsyncLang
|
|
11790
11815
|
}) : w.type === "true_false" ? h.current.speakText(`Now let's try this one: ${w.question}`, {
|
|
11791
|
-
lipsyncLang:
|
|
11816
|
+
lipsyncLang: F.lipsyncLang
|
|
11792
11817
|
}) : h.current.speakText(`Here's the next question: ${w.question}`, {
|
|
11793
|
-
lipsyncLang:
|
|
11818
|
+
lipsyncLang: F.lipsyncLang
|
|
11794
11819
|
});
|
|
11795
11820
|
}
|
|
11796
11821
|
} else
|
|
11797
11822
|
y.current && y.current();
|
|
11798
|
-
}, [t.nextQuestion,
|
|
11799
|
-
const
|
|
11800
|
-
c.current.currentLessonIndex < (
|
|
11823
|
+
}, [t.nextQuestion, v, E]), Y = V(() => {
|
|
11824
|
+
const w = (L.current || { modules: [] }).modules[c.current.currentModuleIndex];
|
|
11825
|
+
c.current.currentLessonIndex < (w?.lessons?.length || 0) - 1 ? (c.current.currentLessonIndex += 1, c.current.currentQuestionIndex = 0, c.current.lessonCompleted = !1, c.current.isQuestionMode = !1, c.current.isTeaching = !1, c.current.score = 0, c.current.totalQuestions = 0, u.current.onCustomAction({
|
|
11801
11826
|
type: "lessonStart",
|
|
11802
11827
|
moduleIndex: c.current.currentModuleIndex,
|
|
11803
11828
|
lessonIndex: c.current.currentLessonIndex
|
|
11804
11829
|
}), h.current && (h.current.setMood("happy"), h.current.setBodyMovement("idle"), setTimeout(() => {
|
|
11805
11830
|
d.current && d.current();
|
|
11806
11831
|
}, 500))) : b.current && b.current();
|
|
11807
|
-
}, [
|
|
11808
|
-
const S =
|
|
11832
|
+
}, []), q = V(() => {
|
|
11833
|
+
const S = v();
|
|
11809
11834
|
if (h.current && h.current.isReady && S?.avatar_script) {
|
|
11810
11835
|
c.current.isTeaching = !0, c.current.isQuestionMode = !1, h.current.setMood("happy");
|
|
11811
11836
|
let w = !1;
|
|
11812
11837
|
if (t.teaching)
|
|
11813
11838
|
try {
|
|
11814
11839
|
h.current.playAnimation(t.teaching, !0), w = !0;
|
|
11815
|
-
} catch (
|
|
11816
|
-
console.warn("Failed to play teaching animation:",
|
|
11840
|
+
} catch (k) {
|
|
11841
|
+
console.warn("Failed to play teaching animation:", k);
|
|
11817
11842
|
}
|
|
11818
|
-
w || h.current.setBodyMovement("gesturing")
|
|
11843
|
+
w || h.current.setBodyMovement("gesturing");
|
|
11844
|
+
const F = T.current || { lipsyncLang: "en" };
|
|
11845
|
+
h.current.speakText(S.avatar_script, { lipsyncLang: F.lipsyncLang }), u.current.onLessonStart({
|
|
11819
11846
|
moduleIndex: c.current.currentModuleIndex,
|
|
11820
11847
|
lessonIndex: c.current.currentLessonIndex,
|
|
11821
11848
|
lesson: S
|
|
@@ -11825,20 +11852,20 @@ const go = Ut(({
|
|
|
11825
11852
|
lessonIndex: c.current.currentLessonIndex,
|
|
11826
11853
|
lesson: S
|
|
11827
11854
|
}), setTimeout(() => {
|
|
11828
|
-
c.current.isTeaching = !1, S.questions && S.questions.length > 0 ?
|
|
11855
|
+
c.current.isTeaching = !1, S.questions && S.questions.length > 0 ? A.current && A.current() : y.current && y.current();
|
|
11829
11856
|
}, 8e3);
|
|
11830
11857
|
}
|
|
11831
|
-
}, [t.teaching,
|
|
11832
|
-
const w =
|
|
11833
|
-
if (
|
|
11858
|
+
}, [t.teaching, v]), se = V((S) => {
|
|
11859
|
+
const w = E(), F = z(S, w);
|
|
11860
|
+
if (F && (c.current.score += 1), u.current.onQuestionAnswer({
|
|
11834
11861
|
moduleIndex: c.current.currentModuleIndex,
|
|
11835
11862
|
lessonIndex: c.current.currentLessonIndex,
|
|
11836
11863
|
questionIndex: c.current.currentQuestionIndex,
|
|
11837
11864
|
answer: S,
|
|
11838
|
-
isCorrect:
|
|
11865
|
+
isCorrect: F,
|
|
11839
11866
|
question: w
|
|
11840
11867
|
}), h.current)
|
|
11841
|
-
if (
|
|
11868
|
+
if (F) {
|
|
11842
11869
|
if (h.current.setMood("happy"), t.correct)
|
|
11843
11870
|
try {
|
|
11844
11871
|
h.current.playReaction("happy");
|
|
@@ -11846,9 +11873,9 @@ const go = Ut(({
|
|
|
11846
11873
|
h.current.setBodyMovement("happy");
|
|
11847
11874
|
}
|
|
11848
11875
|
h.current.setBodyMovement("gesturing");
|
|
11849
|
-
const
|
|
11850
|
-
h.current.speakText(
|
|
11851
|
-
lipsyncLang:
|
|
11876
|
+
const k = w.type === "code_test" ? `Great job! Your code passed all the tests! ${w.explanation || ""}` : `Excellent! That's correct! ${w.explanation || ""}`, _ = T.current || { lipsyncLang: "en" };
|
|
11877
|
+
h.current.speakText(k, {
|
|
11878
|
+
lipsyncLang: _.lipsyncLang,
|
|
11852
11879
|
onSpeechEnd: () => {
|
|
11853
11880
|
setTimeout(() => {
|
|
11854
11881
|
g.current && g.current();
|
|
@@ -11863,9 +11890,9 @@ const go = Ut(({
|
|
|
11863
11890
|
h.current.setBodyMovement("idle");
|
|
11864
11891
|
}
|
|
11865
11892
|
h.current.setBodyMovement("gesturing");
|
|
11866
|
-
const
|
|
11867
|
-
h.current.speakText(
|
|
11868
|
-
lipsyncLang:
|
|
11893
|
+
const k = 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.`, _ = T.current || { lipsyncLang: "en" };
|
|
11894
|
+
h.current.speakText(k, {
|
|
11895
|
+
lipsyncLang: _.lipsyncLang,
|
|
11869
11896
|
onSpeechEnd: () => {
|
|
11870
11897
|
setTimeout(() => {
|
|
11871
11898
|
g.current && g.current();
|
|
@@ -11875,8 +11902,8 @@ const go = Ut(({
|
|
|
11875
11902
|
}
|
|
11876
11903
|
else
|
|
11877
11904
|
g.current && g.current();
|
|
11878
|
-
}, [t.correct, t.incorrect,
|
|
11879
|
-
const w =
|
|
11905
|
+
}, [t.correct, t.incorrect, E, z]), ee = V((S) => {
|
|
11906
|
+
const w = E();
|
|
11880
11907
|
if (!S || typeof S != "object") {
|
|
11881
11908
|
console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
|
|
11882
11909
|
return;
|
|
@@ -11885,7 +11912,7 @@ const go = Ut(({
|
|
|
11885
11912
|
console.warn("Current question is not a code test. Use handleAnswerSelect for other question types.");
|
|
11886
11913
|
return;
|
|
11887
11914
|
}
|
|
11888
|
-
const
|
|
11915
|
+
const F = {
|
|
11889
11916
|
passed: S.passed === !0,
|
|
11890
11917
|
results: S.results || [],
|
|
11891
11918
|
output: S.output || "",
|
|
@@ -11900,39 +11927,41 @@ const go = Ut(({
|
|
|
11900
11927
|
moduleIndex: c.current.currentModuleIndex,
|
|
11901
11928
|
lessonIndex: c.current.currentLessonIndex,
|
|
11902
11929
|
questionIndex: c.current.currentQuestionIndex,
|
|
11903
|
-
testResult:
|
|
11930
|
+
testResult: F,
|
|
11904
11931
|
question: w
|
|
11905
|
-
}),
|
|
11906
|
-
}, [
|
|
11932
|
+
}), f.current && f.current(F);
|
|
11933
|
+
}, [E, z]), Re = V(() => {
|
|
11907
11934
|
c.current.currentModuleIndex = 0, c.current.currentLessonIndex = 0, c.current.currentQuestionIndex = 0, c.current.isTeaching = !1, c.current.isQuestionMode = !1, c.current.lessonCompleted = !1, c.current.curriculumCompleted = !1, c.current.score = 0, c.current.totalQuestions = 0;
|
|
11908
|
-
}, []),
|
|
11935
|
+
}, []), De = V((S) => {
|
|
11909
11936
|
console.log("Avatar is ready!", S);
|
|
11910
|
-
const w =
|
|
11937
|
+
const w = v();
|
|
11911
11938
|
l && w?.avatar_script && setTimeout(() => {
|
|
11912
11939
|
d.current && d.current();
|
|
11913
11940
|
}, 1e3);
|
|
11914
|
-
}, [l,
|
|
11915
|
-
|
|
11916
|
-
d.current =
|
|
11941
|
+
}, [l, v]);
|
|
11942
|
+
Nn(() => {
|
|
11943
|
+
d.current = q, m.current = Y, y.current = O, g.current = D, b.current = W, A.current = I, f.current = se;
|
|
11917
11944
|
}), Gt(r, () => ({
|
|
11918
11945
|
// Curriculum control methods
|
|
11919
|
-
startTeaching:
|
|
11920
|
-
startQuestions:
|
|
11921
|
-
handleAnswerSelect:
|
|
11922
|
-
handleCodeTestResult:
|
|
11923
|
-
nextQuestion:
|
|
11924
|
-
nextLesson:
|
|
11925
|
-
completeLesson:
|
|
11926
|
-
completeCurriculum:
|
|
11927
|
-
resetCurriculum:
|
|
11946
|
+
startTeaching: q,
|
|
11947
|
+
startQuestions: I,
|
|
11948
|
+
handleAnswerSelect: se,
|
|
11949
|
+
handleCodeTestResult: ee,
|
|
11950
|
+
nextQuestion: D,
|
|
11951
|
+
nextLesson: Y,
|
|
11952
|
+
completeLesson: O,
|
|
11953
|
+
completeCurriculum: W,
|
|
11954
|
+
resetCurriculum: Re,
|
|
11928
11955
|
getState: () => ({ ...c.current }),
|
|
11929
|
-
getCurrentQuestion: () =>
|
|
11930
|
-
getCurrentLesson: () =>
|
|
11956
|
+
getCurrentQuestion: () => E(),
|
|
11957
|
+
getCurrentLesson: () => v(),
|
|
11931
11958
|
// Direct access to avatar ref (always returns current value)
|
|
11932
11959
|
getAvatarRef: () => h.current,
|
|
11933
11960
|
// Convenience methods that delegate to avatar (always check current ref)
|
|
11934
11961
|
speakText: async (S, w = {}) => {
|
|
11935
|
-
await h.current?.resumeAudioContext?.()
|
|
11962
|
+
await h.current?.resumeAudioContext?.();
|
|
11963
|
+
const F = T.current || { lipsyncLang: "en" };
|
|
11964
|
+
h.current?.speakText(S, { ...w, lipsyncLang: w.lipsyncLang || F.lipsyncLang });
|
|
11936
11965
|
},
|
|
11937
11966
|
resumeAudioContext: async () => {
|
|
11938
11967
|
if (h.current?.resumeAudioContext)
|
|
@@ -11943,8 +11972,8 @@ const go = Ut(({
|
|
|
11943
11972
|
if (w.state === "suspended" || w.state === "interrupted")
|
|
11944
11973
|
try {
|
|
11945
11974
|
await w.resume(), console.log("Audio context resumed via talkingHead");
|
|
11946
|
-
} catch (
|
|
11947
|
-
console.warn("Failed to resume audio context:",
|
|
11975
|
+
} catch (F) {
|
|
11976
|
+
console.warn("Failed to resume audio context:", F);
|
|
11948
11977
|
}
|
|
11949
11978
|
} else
|
|
11950
11979
|
console.warn("Audio context not available yet");
|
|
@@ -11973,23 +12002,37 @@ const go = Ut(({
|
|
|
11973
12002
|
handleResize: () => h.current?.handleResize(),
|
|
11974
12003
|
// Avatar readiness check (always returns current value)
|
|
11975
12004
|
isAvatarReady: () => h.current?.isReady || !1
|
|
11976
|
-
}), [
|
|
12005
|
+
}), [q, I, se, ee, D, Y, O, W, Re, E, v]);
|
|
12006
|
+
const K = T.current || {
|
|
12007
|
+
avatarUrl: "/avatars/brunette.glb",
|
|
12008
|
+
avatarBody: "F",
|
|
12009
|
+
mood: "happy",
|
|
12010
|
+
ttsLang: "en",
|
|
12011
|
+
ttsService: null,
|
|
12012
|
+
ttsVoice: null,
|
|
12013
|
+
ttsApiKey: null,
|
|
12014
|
+
bodyMovement: "gesturing",
|
|
12015
|
+
movementIntensity: 0.7,
|
|
12016
|
+
showFullAvatar: !0,
|
|
12017
|
+
animations: t
|
|
12018
|
+
};
|
|
12019
|
+
return /* @__PURE__ */ ze("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ ze(
|
|
11977
12020
|
On,
|
|
11978
12021
|
{
|
|
11979
12022
|
ref: h,
|
|
11980
|
-
avatarUrl:
|
|
11981
|
-
avatarBody:
|
|
11982
|
-
mood:
|
|
11983
|
-
ttsLang:
|
|
11984
|
-
ttsService:
|
|
11985
|
-
ttsVoice:
|
|
11986
|
-
ttsApiKey:
|
|
11987
|
-
bodyMovement:
|
|
11988
|
-
movementIntensity:
|
|
11989
|
-
showFullAvatar:
|
|
12023
|
+
avatarUrl: K.avatarUrl,
|
|
12024
|
+
avatarBody: K.avatarBody,
|
|
12025
|
+
mood: K.mood,
|
|
12026
|
+
ttsLang: K.ttsLang,
|
|
12027
|
+
ttsService: K.ttsService,
|
|
12028
|
+
ttsVoice: K.ttsVoice,
|
|
12029
|
+
ttsApiKey: K.ttsApiKey,
|
|
12030
|
+
bodyMovement: K.bodyMovement,
|
|
12031
|
+
movementIntensity: K.movementIntensity,
|
|
12032
|
+
showFullAvatar: K.showFullAvatar,
|
|
11990
12033
|
cameraView: "upper",
|
|
11991
|
-
animations:
|
|
11992
|
-
onReady:
|
|
12034
|
+
animations: K.animations,
|
|
12035
|
+
onReady: De,
|
|
11993
12036
|
onLoading: () => {
|
|
11994
12037
|
},
|
|
11995
12038
|
onError: (S) => {
|