@sage-rsc/talking-head-react 1.0.28 → 1.0.30
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-BAdAJQ7P.cjs → fbxAnimationLoader-BG4X_1Qa.cjs} +1 -1
- package/dist/{fbxAnimationLoader-xd44uqKF.js → fbxAnimationLoader-CO1F6v-w.js} +1 -1
- package/dist/index-BFQNNYmP.cjs +13 -0
- package/dist/{index-zMY6cyU2.js → index-V_d1NQ-5.js} +1031 -1031
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/CurriculumLearning.jsx +57 -29
- package/src/lib/talkinghead.mjs +1 -1
- package/dist/index-Dx7mDKJm.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 He } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ut, useRef as de, useState as Xe, useCallback as B, useEffect as gt, useImperativeHandle as Gt, useLayoutEffect as Nn } from "react";
|
|
3
3
|
import * as R from "three";
|
|
4
|
-
import { Controls as
|
|
5
|
-
const Zt = { type: "change" }, Vt = { type: "start" }, In = { type: "end" },
|
|
4
|
+
import { Controls as Bn, Vector3 as _, MOUSE as je, TOUCH as Ge, Quaternion as me, Spherical as jt, Vector2 as he, Ray as Un, Plane as Gn, MathUtils as te, TrianglesDrawMode as Vn, TriangleFanDrawMode as Mt, TriangleStripDrawMode as ln, Loader as nt, LoaderUtils as Ze, FileLoader as it, MeshPhysicalMaterial as Ie, Color as ne, LinearSRGBColorSpace as Ae, SRGBColorSpace as Q, SpotLight as cn, PointLight as yt, DirectionalLight as hn, Matrix4 as G, InstancedMesh as un, InstancedBufferAttribute as Wn, Object3D as De, 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 st, 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 ot, BufferGeometry as Je, SkinnedMesh as gn, Mesh as Te, 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 xe, FrontSide as oi, Interpolant as ai, Box3 as ri, Sphere as li, Vector4 as at, Curve as ci, MeshPhongMaterial as ht, MeshLambertMaterial as An, EquirectangularReflectionMapping as hi, AmbientLight as ui, Float32BufferAttribute as Ne, Uint16BufferAttribute as di, Matrix3 as pi, ShapeUtils as mi, Euler as Fe, Scene as fi, BoxGeometry as gi, BackSide as yi } from "three";
|
|
5
|
+
const Zt = { type: "change" }, Vt = { type: "start" }, In = { type: "end" }, ut = new Un(), Yt = new Gn(), xi = Math.cos(70 * te.DEG2RAD), ee = new _(), le = 2 * Math.PI, N = {
|
|
6
6
|
NONE: -1,
|
|
7
7
|
ROTATE: 0,
|
|
8
8
|
DOLLY: 1,
|
|
@@ -12,7 +12,7 @@ const Zt = { type: "change" }, Vt = { type: "start" }, In = { type: "end" }, ht
|
|
|
12
12
|
TOUCH_DOLLY_PAN: 5,
|
|
13
13
|
TOUCH_DOLLY_ROTATE: 6
|
|
14
14
|
}, At = 1e-6;
|
|
15
|
-
class
|
|
15
|
+
class bi extends Bn {
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a new controls instance.
|
|
18
18
|
*
|
|
@@ -20,7 +20,7 @@ class xi extends Nn {
|
|
|
20
20
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
21
21
|
*/
|
|
22
22
|
constructor(e, t = null) {
|
|
23
|
-
super(e, t), this.state =
|
|
23
|
+
super(e, t), this.state = N.NONE, this.target = new _(), this.cursor = new _(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: 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 _(), this._lastQuaternion = new me(), this._lastTargetPosition = new _(), this._quat = new me().setFromUnitVectors(e.up, new _(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new jt(), this._sphericalDelta = new jt(), this._scale = 1, this._panOffset = new _(), this._rotateStart = new he(), this._rotateEnd = new he(), this._rotateDelta = new he(), this._panStart = new he(), this._panEnd = new he(), this._panDelta = new he(), this._dollyStart = new he(), this._dollyEnd = new he(), this._dollyDelta = new he(), this._dollyDirection = new _(), this._mouse = new he(), 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 xi extends Nn {
|
|
|
81
81
|
* was called, or the initial state.
|
|
82
82
|
*/
|
|
83
83
|
reset() {
|
|
84
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Zt), this.update(), this.state =
|
|
84
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Zt), this.update(), this.state = N.NONE;
|
|
85
85
|
}
|
|
86
86
|
update(e = null) {
|
|
87
87
|
const t = this.object.position;
|
|
88
|
-
|
|
88
|
+
ee.copy(t).sub(this.target), ee.applyQuaternion(this._quat), this._spherical.setFromVector3(ee), this.autoRotate && this.state === N.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
89
89
|
let n = this.minAzimuthAngle, i = this.maxAzimuthAngle;
|
|
90
|
-
isFinite(n) && isFinite(i) && (n < -Math.PI ? n +=
|
|
90
|
+
isFinite(n) && isFinite(i) && (n < -Math.PI ? n += le : n > Math.PI && (n -= le), i < -Math.PI ? i += le : i > Math.PI && (i -= le), 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 xi extends Nn {
|
|
|
95
95
|
const o = this._spherical.radius;
|
|
96
96
|
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), s = o != this._spherical.radius;
|
|
97
97
|
}
|
|
98
|
-
if (
|
|
98
|
+
if (ee.setFromSpherical(this._spherical), ee.applyQuaternion(this._quatInverse), t.copy(this.target).add(ee), 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 = ee.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 _(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 _(this._mouse.x, this._mouse.y, 0);
|
|
111
|
+
r.unproject(this.object), this.object.position.sub(r).add(a), this.object.updateMatrixWorld(), o = ee.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) : (ut.origin.copy(this.object.position), ut.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ut.direction)) < xi ? this.object.lookAt(this.target) : (Yt.setFromNormalAndCoplanarPoint(this.object.up, this.target), ut.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 xi extends Nn {
|
|
|
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 ? le / 60 * this.autoRotateSpeed * e : le / 60 / 60 * this.autoRotateSpeed;
|
|
123
123
|
}
|
|
124
124
|
_getZoomScale(e) {
|
|
125
125
|
const t = Math.abs(e * 0.01);
|
|
@@ -132,18 +132,18 @@ class xi extends Nn {
|
|
|
132
132
|
this._sphericalDelta.phi -= e;
|
|
133
133
|
}
|
|
134
134
|
_panLeft(e, t) {
|
|
135
|
-
|
|
135
|
+
ee.setFromMatrixColumn(t, 0), ee.multiplyScalar(-e), this._panOffset.add(ee);
|
|
136
136
|
}
|
|
137
137
|
_panUp(e, t) {
|
|
138
|
-
this.screenSpacePanning === !0 ?
|
|
138
|
+
this.screenSpacePanning === !0 ? ee.setFromMatrixColumn(t, 1) : (ee.setFromMatrixColumn(t, 0), ee.crossVectors(this.object.up, ee)), ee.multiplyScalar(e), this._panOffset.add(ee);
|
|
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
|
+
ee.copy(i).sub(this.target);
|
|
146
|
+
let s = ee.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 xi extends Nn {
|
|
|
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(le * this._rotateDelta.x / t.clientHeight), this._rotateUp(le * 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 xi extends Nn {
|
|
|
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(le * 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(-le * 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(le * 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(-le * 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 xi extends Nn {
|
|
|
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(le * this._rotateDelta.x / t.clientHeight), this._rotateUp(le * 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 xi extends Nn {
|
|
|
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 he(), 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];
|
|
@@ -308,16 +308,16 @@ class xi extends Nn {
|
|
|
308
308
|
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function Ri(p) {
|
|
312
312
|
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(p.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(p) && (this._addPointer(p), p.pointerType === "touch" ? this._onTouchStart(p) : this._onMouseDown(p)));
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function vi(p) {
|
|
315
315
|
this.enabled !== !1 && (p.pointerType === "touch" ? this._onTouchMove(p) : this._onMouseMove(p));
|
|
316
316
|
}
|
|
317
|
-
function
|
|
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 = N.NONE;
|
|
321
321
|
break;
|
|
322
322
|
case 1:
|
|
323
323
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -325,7 +325,7 @@ function vi(p) {
|
|
|
325
325
|
break;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function Ii(p) {
|
|
329
329
|
let e;
|
|
330
330
|
switch (p.button) {
|
|
331
331
|
case 0:
|
|
@@ -341,123 +341,123 @@ function Ai(p) {
|
|
|
341
341
|
e = -1;
|
|
342
342
|
}
|
|
343
343
|
switch (e) {
|
|
344
|
-
case
|
|
344
|
+
case je.DOLLY:
|
|
345
345
|
if (this.enableZoom === !1) return;
|
|
346
|
-
this._handleMouseDownDolly(p), this.state =
|
|
346
|
+
this._handleMouseDownDolly(p), this.state = N.DOLLY;
|
|
347
347
|
break;
|
|
348
|
-
case
|
|
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 = N.PAN;
|
|
352
352
|
} else {
|
|
353
353
|
if (this.enableRotate === !1) return;
|
|
354
|
-
this._handleMouseDownRotate(p), this.state =
|
|
354
|
+
this._handleMouseDownRotate(p), this.state = N.ROTATE;
|
|
355
355
|
}
|
|
356
356
|
break;
|
|
357
|
-
case
|
|
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 = N.ROTATE;
|
|
361
361
|
} else {
|
|
362
362
|
if (this.enablePan === !1) return;
|
|
363
|
-
this._handleMouseDownPan(p), this.state =
|
|
363
|
+
this._handleMouseDownPan(p), this.state = N.PAN;
|
|
364
364
|
}
|
|
365
365
|
break;
|
|
366
366
|
default:
|
|
367
|
-
this.state =
|
|
367
|
+
this.state = N.NONE;
|
|
368
368
|
}
|
|
369
|
-
this.state !==
|
|
369
|
+
this.state !== N.NONE && this.dispatchEvent(Vt);
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function Li(p) {
|
|
372
372
|
switch (this.state) {
|
|
373
|
-
case
|
|
373
|
+
case N.ROTATE:
|
|
374
374
|
if (this.enableRotate === !1) return;
|
|
375
375
|
this._handleMouseMoveRotate(p);
|
|
376
376
|
break;
|
|
377
|
-
case
|
|
377
|
+
case N.DOLLY:
|
|
378
378
|
if (this.enableZoom === !1) return;
|
|
379
379
|
this._handleMouseMoveDolly(p);
|
|
380
380
|
break;
|
|
381
|
-
case
|
|
381
|
+
case N.PAN:
|
|
382
382
|
if (this.enablePan === !1) return;
|
|
383
383
|
this._handleMouseMovePan(p);
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
|
-
function Li(p) {
|
|
388
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== B.NONE || (p.preventDefault(), this.dispatchEvent(Vt), this._handleMouseWheel(this._customWheelEvent(p)), this.dispatchEvent(In));
|
|
389
|
-
}
|
|
390
387
|
function wi(p) {
|
|
391
|
-
this.enabled
|
|
388
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== N.NONE || (p.preventDefault(), this.dispatchEvent(Vt), this._handleMouseWheel(this._customWheelEvent(p)), this.dispatchEvent(In));
|
|
392
389
|
}
|
|
393
390
|
function Si(p) {
|
|
391
|
+
this.enabled !== !1 && this._handleKeyDown(p);
|
|
392
|
+
}
|
|
393
|
+
function Ti(p) {
|
|
394
394
|
switch (this._trackPointer(p), this._pointers.length) {
|
|
395
395
|
case 1:
|
|
396
396
|
switch (this.touches.ONE) {
|
|
397
|
-
case
|
|
397
|
+
case Ge.ROTATE:
|
|
398
398
|
if (this.enableRotate === !1) return;
|
|
399
|
-
this._handleTouchStartRotate(p), this.state =
|
|
399
|
+
this._handleTouchStartRotate(p), this.state = N.TOUCH_ROTATE;
|
|
400
400
|
break;
|
|
401
|
-
case
|
|
401
|
+
case Ge.PAN:
|
|
402
402
|
if (this.enablePan === !1) return;
|
|
403
|
-
this._handleTouchStartPan(p), this.state =
|
|
403
|
+
this._handleTouchStartPan(p), this.state = N.TOUCH_PAN;
|
|
404
404
|
break;
|
|
405
405
|
default:
|
|
406
|
-
this.state =
|
|
406
|
+
this.state = N.NONE;
|
|
407
407
|
}
|
|
408
408
|
break;
|
|
409
409
|
case 2:
|
|
410
410
|
switch (this.touches.TWO) {
|
|
411
|
-
case
|
|
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 = N.TOUCH_DOLLY_PAN;
|
|
414
414
|
break;
|
|
415
|
-
case
|
|
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 = N.TOUCH_DOLLY_ROTATE;
|
|
418
418
|
break;
|
|
419
419
|
default:
|
|
420
|
-
this.state =
|
|
420
|
+
this.state = N.NONE;
|
|
421
421
|
}
|
|
422
422
|
break;
|
|
423
423
|
default:
|
|
424
|
-
this.state =
|
|
424
|
+
this.state = N.NONE;
|
|
425
425
|
}
|
|
426
|
-
this.state !==
|
|
426
|
+
this.state !== N.NONE && this.dispatchEvent(Vt);
|
|
427
427
|
}
|
|
428
|
-
function
|
|
428
|
+
function ki(p) {
|
|
429
429
|
switch (this._trackPointer(p), this.state) {
|
|
430
|
-
case
|
|
430
|
+
case N.TOUCH_ROTATE:
|
|
431
431
|
if (this.enableRotate === !1) return;
|
|
432
432
|
this._handleTouchMoveRotate(p), this.update();
|
|
433
433
|
break;
|
|
434
|
-
case
|
|
434
|
+
case N.TOUCH_PAN:
|
|
435
435
|
if (this.enablePan === !1) return;
|
|
436
436
|
this._handleTouchMovePan(p), this.update();
|
|
437
437
|
break;
|
|
438
|
-
case
|
|
438
|
+
case N.TOUCH_DOLLY_PAN:
|
|
439
439
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
440
440
|
this._handleTouchMoveDollyPan(p), this.update();
|
|
441
441
|
break;
|
|
442
|
-
case
|
|
442
|
+
case N.TOUCH_DOLLY_ROTATE:
|
|
443
443
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
444
444
|
this._handleTouchMoveDollyRotate(p), this.update();
|
|
445
445
|
break;
|
|
446
446
|
default:
|
|
447
|
-
this.state =
|
|
447
|
+
this.state = N.NONE;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function Ci(p) {
|
|
451
451
|
this.enabled !== !1 && p.preventDefault();
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function Ei(p) {
|
|
454
454
|
p.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function Mi(p) {
|
|
457
457
|
p.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
458
458
|
}
|
|
459
459
|
function Kt(p, e) {
|
|
460
|
-
if (e ===
|
|
460
|
+
if (e === Vn)
|
|
461
461
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), p;
|
|
462
462
|
if (e === Mt || e === ln) {
|
|
463
463
|
let t = p.getIndex();
|
|
@@ -483,7 +483,7 @@ function Kt(p, e) {
|
|
|
483
483
|
} else
|
|
484
484
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), p;
|
|
485
485
|
}
|
|
486
|
-
class
|
|
486
|
+
class zi extends nt {
|
|
487
487
|
/**
|
|
488
488
|
* Constructs a new glTF loader.
|
|
489
489
|
*
|
|
@@ -491,37 +491,37 @@ class Mi extends tt {
|
|
|
491
491
|
*/
|
|
492
492
|
constructor(e) {
|
|
493
493
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
494
|
-
return new Di(t);
|
|
495
|
-
}), this.register(function(t) {
|
|
496
494
|
return new Oi(t);
|
|
497
495
|
}), this.register(function(t) {
|
|
498
|
-
return new
|
|
496
|
+
return new _i(t);
|
|
499
497
|
}), this.register(function(t) {
|
|
500
498
|
return new Zi(t);
|
|
501
499
|
}), this.register(function(t) {
|
|
502
500
|
return new Yi(t);
|
|
503
501
|
}), this.register(function(t) {
|
|
504
|
-
return new
|
|
502
|
+
return new Ki(t);
|
|
505
503
|
}), this.register(function(t) {
|
|
506
504
|
return new Bi(t);
|
|
507
505
|
}), this.register(function(t) {
|
|
508
506
|
return new Ui(t);
|
|
509
507
|
}), this.register(function(t) {
|
|
510
508
|
return new Gi(t);
|
|
511
|
-
}), this.register(function(t) {
|
|
512
|
-
return new Fi(t);
|
|
513
509
|
}), this.register(function(t) {
|
|
514
510
|
return new Vi(t);
|
|
515
511
|
}), this.register(function(t) {
|
|
516
|
-
return new
|
|
517
|
-
}), this.register(function(t) {
|
|
518
|
-
return new Xi(t);
|
|
512
|
+
return new Di(t);
|
|
519
513
|
}), this.register(function(t) {
|
|
520
514
|
return new Wi(t);
|
|
521
515
|
}), this.register(function(t) {
|
|
522
|
-
return new
|
|
516
|
+
return new Ni(t);
|
|
523
517
|
}), this.register(function(t) {
|
|
524
|
-
return new
|
|
518
|
+
return new ji(t);
|
|
519
|
+
}), this.register(function(t) {
|
|
520
|
+
return new Xi(t);
|
|
521
|
+
}), this.register(function(t) {
|
|
522
|
+
return new Pi(t);
|
|
523
|
+
}), this.register(function(t) {
|
|
524
|
+
return new Qi(t);
|
|
525
525
|
}), this.register(function(t) {
|
|
526
526
|
return new qi(t);
|
|
527
527
|
});
|
|
@@ -541,14 +541,14 @@ class Mi extends tt {
|
|
|
541
541
|
if (this.resourcePath !== "")
|
|
542
542
|
o = this.resourcePath;
|
|
543
543
|
else if (this.path !== "") {
|
|
544
|
-
const r =
|
|
545
|
-
o =
|
|
544
|
+
const r = Ze.extractUrlBase(e);
|
|
545
|
+
o = Ze.resolveURL(r, this.path);
|
|
546
546
|
} else
|
|
547
|
-
o =
|
|
547
|
+
o = Ze.extractUrlBase(e);
|
|
548
548
|
this.manager.itemStart(e);
|
|
549
549
|
const a = function(r) {
|
|
550
550
|
i ? i(r) : console.error(r), s.manager.itemError(e), s.manager.itemEnd(e);
|
|
551
|
-
}, l = new
|
|
551
|
+
}, l = new it(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) {
|
|
@@ -625,7 +625,7 @@ class Mi extends tt {
|
|
|
625
625
|
else if (e instanceof ArrayBuffer)
|
|
626
626
|
if (l.decode(new Uint8Array(e, 0, 4)) === Ln) {
|
|
627
627
|
try {
|
|
628
|
-
o[P.KHR_BINARY_GLTF] = new
|
|
628
|
+
o[P.KHR_BINARY_GLTF] = new Ji(e);
|
|
629
629
|
} catch (c) {
|
|
630
630
|
i && i(c);
|
|
631
631
|
return;
|
|
@@ -639,7 +639,7 @@ class Mi extends tt {
|
|
|
639
639
|
i && i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
640
640
|
return;
|
|
641
641
|
}
|
|
642
|
-
const r = new
|
|
642
|
+
const r = new us(s, {
|
|
643
643
|
path: t || this.resourcePath || "",
|
|
644
644
|
crossOrigin: this.crossOrigin,
|
|
645
645
|
requestHeader: this.requestHeader,
|
|
@@ -657,16 +657,16 @@ class Mi extends tt {
|
|
|
657
657
|
const c = s.extensionsUsed[h], u = s.extensionsRequired || [];
|
|
658
658
|
switch (c) {
|
|
659
659
|
case P.KHR_MATERIALS_UNLIT:
|
|
660
|
-
o[c] = new
|
|
660
|
+
o[c] = new Fi();
|
|
661
661
|
break;
|
|
662
662
|
case P.KHR_DRACO_MESH_COMPRESSION:
|
|
663
|
-
o[c] = new
|
|
663
|
+
o[c] = new $i(s, this.dracoLoader);
|
|
664
664
|
break;
|
|
665
665
|
case P.KHR_TEXTURE_TRANSFORM:
|
|
666
|
-
o[c] = new
|
|
666
|
+
o[c] = new es();
|
|
667
667
|
break;
|
|
668
668
|
case P.KHR_MESH_QUANTIZATION:
|
|
669
|
-
o[c] = new
|
|
669
|
+
o[c] = new ts();
|
|
670
670
|
break;
|
|
671
671
|
default:
|
|
672
672
|
u.indexOf(c) >= 0 && a[c] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + c + '".');
|
|
@@ -689,7 +689,7 @@ class Mi extends tt {
|
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function Hi() {
|
|
693
693
|
let p = {};
|
|
694
694
|
return {
|
|
695
695
|
get: function(e) {
|
|
@@ -730,7 +730,7 @@ const P = {
|
|
|
730
730
|
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
731
731
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
732
732
|
};
|
|
733
|
-
class
|
|
733
|
+
class Pi {
|
|
734
734
|
constructor(e) {
|
|
735
735
|
this.parser = e, this.name = P.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
736
736
|
}
|
|
@@ -747,15 +747,15 @@ class Hi {
|
|
|
747
747
|
if (i) return i;
|
|
748
748
|
const s = t.json, l = ((s.extensions && s.extensions[this.name] || {}).lights || [])[e];
|
|
749
749
|
let r;
|
|
750
|
-
const h = new
|
|
751
|
-
l.color !== void 0 && h.setRGB(l.color[0], l.color[1], l.color[2],
|
|
750
|
+
const h = new ne(16777215);
|
|
751
|
+
l.color !== void 0 && h.setRGB(l.color[0], l.color[1], l.color[2], Ae);
|
|
752
752
|
const c = l.range !== void 0 ? l.range : 0;
|
|
753
753
|
switch (l.type) {
|
|
754
754
|
case "directional":
|
|
755
755
|
r = new hn(h), r.target.position.set(0, 0, -1), r.add(r.target);
|
|
756
756
|
break;
|
|
757
757
|
case "point":
|
|
758
|
-
r = new
|
|
758
|
+
r = new yt(h), r.distance = c;
|
|
759
759
|
break;
|
|
760
760
|
case "spot":
|
|
761
761
|
r = new cn(h), r.distance = c, l.spot = l.spot || {}, l.spot.innerConeAngle = l.spot.innerConeAngle !== void 0 ? l.spot.innerConeAngle : 0, l.spot.outerConeAngle = l.spot.outerConeAngle !== void 0 ? l.spot.outerConeAngle : Math.PI / 4, r.angle = l.spot.outerConeAngle, r.penumbra = 1 - l.spot.innerConeAngle / l.spot.outerConeAngle, r.target.position.set(0, 0, -1), r.add(r.target);
|
|
@@ -763,7 +763,7 @@ class Hi {
|
|
|
763
763
|
default:
|
|
764
764
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + l.type);
|
|
765
765
|
}
|
|
766
|
-
return r.position.set(0, 0, 0),
|
|
766
|
+
return r.position.set(0, 0, 0), ve(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")
|
|
@@ -776,28 +776,28 @@ class Hi {
|
|
|
776
776
|
});
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
|
-
class
|
|
779
|
+
class Fi {
|
|
780
780
|
constructor() {
|
|
781
781
|
this.name = P.KHR_MATERIALS_UNLIT;
|
|
782
782
|
}
|
|
783
783
|
getMaterialType() {
|
|
784
|
-
return
|
|
784
|
+
return Qe;
|
|
785
785
|
}
|
|
786
786
|
extendParams(e, t, n) {
|
|
787
787
|
const i = [];
|
|
788
|
-
e.color = new
|
|
788
|
+
e.color = new ne(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], Ae), 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, Q));
|
|
796
796
|
}
|
|
797
797
|
return Promise.all(i);
|
|
798
798
|
}
|
|
799
799
|
}
|
|
800
|
-
class
|
|
800
|
+
class Di {
|
|
801
801
|
constructor(e) {
|
|
802
802
|
this.parser = e, this.name = P.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
803
803
|
}
|
|
@@ -809,13 +809,13 @@ class Fi {
|
|
|
809
809
|
return s !== void 0 && (t.emissiveIntensity = s), Promise.resolve();
|
|
810
810
|
}
|
|
811
811
|
}
|
|
812
|
-
class
|
|
812
|
+
class Oi {
|
|
813
813
|
constructor(e) {
|
|
814
814
|
this.parser = e, this.name = P.KHR_MATERIALS_CLEARCOAT;
|
|
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 : Ie;
|
|
819
819
|
}
|
|
820
820
|
extendMaterialParams(e, t) {
|
|
821
821
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -824,18 +824,18 @@ class Di {
|
|
|
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 he(a, a);
|
|
828
828
|
}
|
|
829
829
|
return Promise.all(s);
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
|
-
class
|
|
832
|
+
class _i {
|
|
833
833
|
constructor(e) {
|
|
834
834
|
this.parser = e, this.name = P.KHR_MATERIALS_DISPERSION;
|
|
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 : Ie;
|
|
839
839
|
}
|
|
840
840
|
extendMaterialParams(e, t) {
|
|
841
841
|
const i = this.parser.json.materials[e];
|
|
@@ -845,13 +845,13 @@ class Oi {
|
|
|
845
845
|
return t.dispersion = s.dispersion !== void 0 ? s.dispersion : 0, Promise.resolve();
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
|
-
class
|
|
848
|
+
class Ni {
|
|
849
849
|
constructor(e) {
|
|
850
850
|
this.parser = e, this.name = P.KHR_MATERIALS_IRIDESCENCE;
|
|
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 : Ie;
|
|
855
855
|
}
|
|
856
856
|
extendMaterialParams(e, t) {
|
|
857
857
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -861,35 +861,35 @@ class _i {
|
|
|
861
861
|
return o.iridescenceFactor !== void 0 && (t.iridescence = o.iridescenceFactor), o.iridescenceTexture !== void 0 && s.push(n.assignTexture(t, "iridescenceMap", o.iridescenceTexture)), o.iridescenceIor !== void 0 && (t.iridescenceIOR = o.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), o.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = o.iridescenceThicknessMinimum), o.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = o.iridescenceThicknessMaximum), o.iridescenceThicknessTexture !== void 0 && s.push(n.assignTexture(t, "iridescenceThicknessMap", o.iridescenceThicknessTexture)), Promise.all(s);
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
|
-
class
|
|
864
|
+
class Bi {
|
|
865
865
|
constructor(e) {
|
|
866
866
|
this.parser = e, this.name = P.KHR_MATERIALS_SHEEN;
|
|
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 : Ie;
|
|
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 ne(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], Ae);
|
|
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, Q)), o.sheenRoughnessTexture !== void 0 && s.push(n.assignTexture(t, "sheenRoughnessMap", o.sheenRoughnessTexture)), Promise.all(s);
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
|
-
class
|
|
886
|
+
class Ui {
|
|
887
887
|
constructor(e) {
|
|
888
888
|
this.parser = e, this.name = P.KHR_MATERIALS_TRANSMISSION;
|
|
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 : Ie;
|
|
893
893
|
}
|
|
894
894
|
extendMaterialParams(e, t) {
|
|
895
895
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -899,13 +899,13 @@ class Bi {
|
|
|
899
899
|
return o.transmissionFactor !== void 0 && (t.transmission = o.transmissionFactor), o.transmissionTexture !== void 0 && s.push(n.assignTexture(t, "transmissionMap", o.transmissionTexture)), Promise.all(s);
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
|
-
class
|
|
902
|
+
class Gi {
|
|
903
903
|
constructor(e) {
|
|
904
904
|
this.parser = e, this.name = P.KHR_MATERIALS_VOLUME;
|
|
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 : Ie;
|
|
909
909
|
}
|
|
910
910
|
extendMaterialParams(e, t) {
|
|
911
911
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -914,16 +914,16 @@ class Ui {
|
|
|
914
914
|
const s = [], o = i.extensions[this.name];
|
|
915
915
|
t.thickness = o.thicknessFactor !== void 0 ? o.thicknessFactor : 0, o.thicknessTexture !== void 0 && s.push(n.assignTexture(t, "thicknessMap", o.thicknessTexture)), t.attenuationDistance = o.attenuationDistance || 1 / 0;
|
|
916
916
|
const a = o.attenuationColor || [1, 1, 1];
|
|
917
|
-
return t.attenuationColor = new
|
|
917
|
+
return t.attenuationColor = new ne().setRGB(a[0], a[1], a[2], Ae), Promise.all(s);
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
|
-
class
|
|
920
|
+
class Vi {
|
|
921
921
|
constructor(e) {
|
|
922
922
|
this.parser = e, this.name = P.KHR_MATERIALS_IOR;
|
|
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 : Ie;
|
|
927
927
|
}
|
|
928
928
|
extendMaterialParams(e, t) {
|
|
929
929
|
const i = this.parser.json.materials[e];
|
|
@@ -933,13 +933,13 @@ class Gi {
|
|
|
933
933
|
return t.ior = s.ior !== void 0 ? s.ior : 1.5, Promise.resolve();
|
|
934
934
|
}
|
|
935
935
|
}
|
|
936
|
-
class
|
|
936
|
+
class Wi {
|
|
937
937
|
constructor(e) {
|
|
938
938
|
this.parser = e, this.name = P.KHR_MATERIALS_SPECULAR;
|
|
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 : Ie;
|
|
943
943
|
}
|
|
944
944
|
extendMaterialParams(e, t) {
|
|
945
945
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -948,16 +948,16 @@ class Vi {
|
|
|
948
948
|
const s = [], o = i.extensions[this.name];
|
|
949
949
|
t.specularIntensity = o.specularFactor !== void 0 ? o.specularFactor : 1, o.specularTexture !== void 0 && s.push(n.assignTexture(t, "specularIntensityMap", o.specularTexture));
|
|
950
950
|
const a = o.specularColorFactor || [1, 1, 1];
|
|
951
|
-
return t.specularColor = new
|
|
951
|
+
return t.specularColor = new ne().setRGB(a[0], a[1], a[2], Ae), o.specularColorTexture !== void 0 && s.push(n.assignTexture(t, "specularColorMap", o.specularColorTexture, Q)), Promise.all(s);
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
|
-
class
|
|
954
|
+
class Xi {
|
|
955
955
|
constructor(e) {
|
|
956
956
|
this.parser = e, this.name = P.EXT_MATERIALS_BUMP;
|
|
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 : Ie;
|
|
961
961
|
}
|
|
962
962
|
extendMaterialParams(e, t) {
|
|
963
963
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -967,13 +967,13 @@ class Wi {
|
|
|
967
967
|
return t.bumpScale = o.bumpFactor !== void 0 ? o.bumpFactor : 1, o.bumpTexture !== void 0 && s.push(n.assignTexture(t, "bumpMap", o.bumpTexture)), Promise.all(s);
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
class
|
|
970
|
+
class ji {
|
|
971
971
|
constructor(e) {
|
|
972
972
|
this.parser = e, this.name = P.KHR_MATERIALS_ANISOTROPY;
|
|
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 : Ie;
|
|
977
977
|
}
|
|
978
978
|
extendMaterialParams(e, t) {
|
|
979
979
|
const n = this.parser, i = n.json.materials[e];
|
|
@@ -983,7 +983,7 @@ class Xi {
|
|
|
983
983
|
return o.anisotropyStrength !== void 0 && (t.anisotropy = o.anisotropyStrength), o.anisotropyRotation !== void 0 && (t.anisotropyRotation = o.anisotropyRotation), o.anisotropyTexture !== void 0 && s.push(n.assignTexture(t, "anisotropyMap", o.anisotropyTexture)), Promise.all(s);
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
|
-
class
|
|
986
|
+
class Zi {
|
|
987
987
|
constructor(e) {
|
|
988
988
|
this.parser = e, this.name = P.KHR_TEXTURE_BASISU;
|
|
989
989
|
}
|
|
@@ -1000,7 +1000,7 @@ class ji {
|
|
|
1000
1000
|
return t.loadTextureImage(e, s.source, o);
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
|
-
class
|
|
1003
|
+
class Yi {
|
|
1004
1004
|
constructor(e) {
|
|
1005
1005
|
this.parser = e, this.name = P.EXT_TEXTURE_WEBP;
|
|
1006
1006
|
}
|
|
@@ -1017,7 +1017,7 @@ class Zi {
|
|
|
1017
1017
|
return n.loadTextureImage(e, o.source, l);
|
|
1018
1018
|
}
|
|
1019
1019
|
}
|
|
1020
|
-
class
|
|
1020
|
+
class Ki {
|
|
1021
1021
|
constructor(e) {
|
|
1022
1022
|
this.parser = e, this.name = P.EXT_TEXTURE_AVIF;
|
|
1023
1023
|
}
|
|
@@ -1034,7 +1034,7 @@ class Yi {
|
|
|
1034
1034
|
return n.loadTextureImage(e, o.source, l);
|
|
1035
1035
|
}
|
|
1036
1036
|
}
|
|
1037
|
-
class
|
|
1037
|
+
class Qi {
|
|
1038
1038
|
constructor(e) {
|
|
1039
1039
|
this.name = P.EXT_MESHOPT_COMPRESSION, this.parser = e;
|
|
1040
1040
|
}
|
|
@@ -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 !== pe.TRIANGLES && r.mode !== pe.TRIANGLE_STRIP && r.mode !== pe.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,25 +1078,25 @@ class qi {
|
|
|
1078
1078
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((r) => {
|
|
1079
1079
|
const h = r.pop(), c = h.isGroup ? h.children : [h], u = r[0].count, d = [];
|
|
1080
1080
|
for (const m of c) {
|
|
1081
|
-
const y = new G(), g = new
|
|
1082
|
-
for (let
|
|
1083
|
-
l.TRANSLATION && g.fromBufferAttribute(l.TRANSLATION,
|
|
1084
|
-
for (const
|
|
1085
|
-
if (
|
|
1086
|
-
const
|
|
1087
|
-
f.instanceColor = new
|
|
1088
|
-
} else
|
|
1089
|
-
|
|
1081
|
+
const y = new G(), g = new _(), b = new me(), I = new _(1, 1, 1), f = new un(m.geometry, m.material, u);
|
|
1082
|
+
for (let v = 0; v < u; v++)
|
|
1083
|
+
l.TRANSLATION && g.fromBufferAttribute(l.TRANSLATION, v), l.ROTATION && b.fromBufferAttribute(l.ROTATION, v), l.SCALE && I.fromBufferAttribute(l.SCALE, v), f.setMatrixAt(v, y.compose(g, b, I));
|
|
1084
|
+
for (const v in l)
|
|
1085
|
+
if (v === "_COLOR_0") {
|
|
1086
|
+
const T = l[v];
|
|
1087
|
+
f.instanceColor = new Wn(T.array, T.itemSize, T.normalized);
|
|
1088
|
+
} else v !== "TRANSLATION" && v !== "ROTATION" && v !== "SCALE" && m.geometry.setAttribute(v, l[v]);
|
|
1089
|
+
De.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
|
}));
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
|
-
const Ln = "glTF",
|
|
1096
|
-
class
|
|
1095
|
+
const Ln = "glTF", Ke = 12, Qt = { JSON: 1313821514, BIN: 5130562 };
|
|
1096
|
+
class Ji {
|
|
1097
1097
|
constructor(e) {
|
|
1098
1098
|
this.name = P.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
1099
|
-
const t = new DataView(e, 0,
|
|
1099
|
+
const t = new DataView(e, 0, Ke), n = new TextDecoder();
|
|
1100
1100
|
if (this.header = {
|
|
1101
1101
|
magic: n.decode(new Uint8Array(e.slice(0, 4))),
|
|
1102
1102
|
version: t.getUint32(4, !0),
|
|
@@ -1105,17 +1105,17 @@ class Qi {
|
|
|
1105
1105
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
1106
1106
|
if (this.header.version < 2)
|
|
1107
1107
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
1108
|
-
const i = this.header.length -
|
|
1108
|
+
const i = this.header.length - Ke, s = new DataView(e, Ke);
|
|
1109
1109
|
let o = 0;
|
|
1110
1110
|
for (; o < i; ) {
|
|
1111
1111
|
const a = s.getUint32(o, !0);
|
|
1112
1112
|
o += 4;
|
|
1113
1113
|
const l = s.getUint32(o, !0);
|
|
1114
|
-
if (o += 4, l ===
|
|
1115
|
-
const r = new Uint8Array(e,
|
|
1114
|
+
if (o += 4, l === Qt.JSON) {
|
|
1115
|
+
const r = new Uint8Array(e, Ke + o, a);
|
|
1116
1116
|
this.content = n.decode(r);
|
|
1117
|
-
} else if (l ===
|
|
1118
|
-
const r =
|
|
1117
|
+
} else if (l === Qt.BIN) {
|
|
1118
|
+
const r = Ke + o;
|
|
1119
1119
|
this.body = e.slice(r, r + a);
|
|
1120
1120
|
}
|
|
1121
1121
|
o += a;
|
|
@@ -1124,7 +1124,7 @@ class Qi {
|
|
|
1124
1124
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
1127
|
-
class
|
|
1127
|
+
class $i {
|
|
1128
1128
|
constructor(e, t) {
|
|
1129
1129
|
if (!t)
|
|
1130
1130
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
@@ -1139,7 +1139,7 @@ class Ji {
|
|
|
1139
1139
|
for (const h in e.attributes) {
|
|
1140
1140
|
const c = _t[h] || h.toLowerCase();
|
|
1141
1141
|
if (o[h] !== void 0) {
|
|
1142
|
-
const u = n.accessors[e.attributes[h]], d =
|
|
1142
|
+
const u = n.accessors[e.attributes[h]], d = Ye[u.componentType];
|
|
1143
1143
|
r[c] = d.name, l[c] = u.normalized === !0;
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
@@ -1151,12 +1151,12 @@ class Ji {
|
|
|
1151
1151
|
g !== void 0 && (y.normalized = g);
|
|
1152
1152
|
}
|
|
1153
1153
|
c(d);
|
|
1154
|
-
}, a, r,
|
|
1154
|
+
}, a, r, Ae, u);
|
|
1155
1155
|
});
|
|
1156
1156
|
});
|
|
1157
1157
|
}
|
|
1158
1158
|
}
|
|
1159
|
-
class
|
|
1159
|
+
class es {
|
|
1160
1160
|
constructor() {
|
|
1161
1161
|
this.name = P.KHR_TEXTURE_TRANSFORM;
|
|
1162
1162
|
}
|
|
@@ -1164,12 +1164,12 @@ class $i {
|
|
|
1164
1164
|
return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.texCoord !== void 0 && (e.channel = t.texCoord), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e;
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
-
class
|
|
1167
|
+
class ts {
|
|
1168
1168
|
constructor() {
|
|
1169
1169
|
this.name = P.KHR_MESH_QUANTIZATION;
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
1172
|
-
class wn extends
|
|
1172
|
+
class wn extends ai {
|
|
1173
1173
|
constructor(e, t, n, i) {
|
|
1174
1174
|
super(e, t, n, i);
|
|
1175
1175
|
}
|
|
@@ -1180,22 +1180,22 @@ class wn extends oi {
|
|
|
1180
1180
|
return t;
|
|
1181
1181
|
}
|
|
1182
1182
|
interpolate_(e, t, n, i) {
|
|
1183
|
-
const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, r = a * 3, 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
|
|
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, I = 1 - g, f = b - u + c;
|
|
1184
|
+
for (let v = 0; v !== a; v++) {
|
|
1185
|
+
const T = o[y + v + a], A = o[y + v + l] * h, z = o[m + v + a], M = o[m + v] * h;
|
|
1186
|
+
s[v] = I * T + f * A + g * z + b * M;
|
|
1187
1187
|
}
|
|
1188
1188
|
return s;
|
|
1189
1189
|
}
|
|
1190
1190
|
}
|
|
1191
|
-
const
|
|
1192
|
-
class
|
|
1191
|
+
const ns = new me();
|
|
1192
|
+
class is extends wn {
|
|
1193
1193
|
interpolate_(e, t, n, i) {
|
|
1194
1194
|
const s = super.interpolate_(e, t, n, i);
|
|
1195
|
-
return
|
|
1195
|
+
return ns.fromArray(s).normalize().toArray(s), s;
|
|
1196
1196
|
}
|
|
1197
1197
|
}
|
|
1198
|
-
const
|
|
1198
|
+
const pe = {
|
|
1199
1199
|
POINTS: 0,
|
|
1200
1200
|
LINES: 1,
|
|
1201
1201
|
LINE_LOOP: 2,
|
|
@@ -1203,24 +1203,24 @@ const ue = {
|
|
|
1203
1203
|
TRIANGLES: 4,
|
|
1204
1204
|
TRIANGLE_STRIP: 5,
|
|
1205
1205
|
TRIANGLE_FAN: 6
|
|
1206
|
-
},
|
|
1206
|
+
}, Ye = {
|
|
1207
1207
|
5120: Int8Array,
|
|
1208
1208
|
5121: Uint8Array,
|
|
1209
1209
|
5122: Int16Array,
|
|
1210
1210
|
5123: Uint16Array,
|
|
1211
1211
|
5125: Uint32Array,
|
|
1212
1212
|
5126: Float32Array
|
|
1213
|
-
},
|
|
1213
|
+
}, qt = {
|
|
1214
1214
|
9728: mn,
|
|
1215
1215
|
9729: zt,
|
|
1216
|
-
9984:
|
|
1217
|
-
9985:
|
|
1218
|
-
9986:
|
|
1216
|
+
9984: Qn,
|
|
1217
|
+
9985: Kn,
|
|
1218
|
+
9986: Yn,
|
|
1219
1219
|
9987: pn
|
|
1220
1220
|
}, Jt = {
|
|
1221
1221
|
33071: Ht,
|
|
1222
1222
|
33648: qn,
|
|
1223
|
-
10497:
|
|
1223
|
+
10497: st
|
|
1224
1224
|
}, It = {
|
|
1225
1225
|
SCALAR: 1,
|
|
1226
1226
|
VEC2: 2,
|
|
@@ -1240,41 +1240,41 @@ const ue = {
|
|
|
1240
1240
|
COLOR_0: "color",
|
|
1241
1241
|
WEIGHTS_0: "skinWeight",
|
|
1242
1242
|
JOINTS_0: "skinIndex"
|
|
1243
|
-
},
|
|
1243
|
+
}, Ee = {
|
|
1244
1244
|
scale: "scale",
|
|
1245
1245
|
translation: "position",
|
|
1246
1246
|
rotation: "quaternion",
|
|
1247
1247
|
weights: "morphTargetInfluences"
|
|
1248
|
-
},
|
|
1248
|
+
}, ss = {
|
|
1249
1249
|
CUBICSPLINE: void 0,
|
|
1250
1250
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
1251
1251
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
1252
1252
|
LINEAR: vn,
|
|
1253
|
-
STEP:
|
|
1253
|
+
STEP: si
|
|
1254
1254
|
}, Lt = {
|
|
1255
1255
|
OPAQUE: "OPAQUE",
|
|
1256
1256
|
MASK: "MASK",
|
|
1257
1257
|
BLEND: "BLEND"
|
|
1258
1258
|
};
|
|
1259
|
-
function
|
|
1260
|
-
return p.DefaultMaterial === void 0 && (p.DefaultMaterial = new
|
|
1259
|
+
function os(p) {
|
|
1260
|
+
return p.DefaultMaterial === void 0 && (p.DefaultMaterial = new xt({
|
|
1261
1261
|
color: 16777215,
|
|
1262
1262
|
emissive: 0,
|
|
1263
1263
|
metalness: 1,
|
|
1264
1264
|
roughness: 1,
|
|
1265
1265
|
transparent: !1,
|
|
1266
1266
|
depthTest: !0,
|
|
1267
|
-
side:
|
|
1267
|
+
side: oi
|
|
1268
1268
|
})), p.DefaultMaterial;
|
|
1269
1269
|
}
|
|
1270
|
-
function
|
|
1270
|
+
function Pe(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 ve(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
|
-
function
|
|
1277
|
+
function as(p, e, t) {
|
|
1278
1278
|
let n = !1, i = !1, s = !1;
|
|
1279
1279
|
for (let r = 0, h = e.length; r < h; r++) {
|
|
1280
1280
|
const c = e[r];
|
|
@@ -1306,7 +1306,7 @@ function os(p, e, t) {
|
|
|
1306
1306
|
return n && (p.morphAttributes.position = h), i && (p.morphAttributes.normal = c), s && (p.morphAttributes.color = u), p.morphTargetsRelative = !0, p;
|
|
1307
1307
|
});
|
|
1308
1308
|
}
|
|
1309
|
-
function
|
|
1309
|
+
function rs(p, e) {
|
|
1310
1310
|
if (p.updateMorphTargets(), e.weights !== void 0)
|
|
1311
1311
|
for (let t = 0, n = e.weights.length; t < n; t++)
|
|
1312
1312
|
p.morphTargetInfluences[t] = e.weights[t];
|
|
@@ -1320,7 +1320,7 @@ function as(p, e) {
|
|
|
1320
1320
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
1323
|
-
function
|
|
1323
|
+
function ls(p) {
|
|
1324
1324
|
let e;
|
|
1325
1325
|
const t = p.extensions && p.extensions[P.KHR_DRACO_MESH_COMPRESSION];
|
|
1326
1326
|
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + wt(t.attributes) : e = p.indices + ":" + wt(p.attributes) + ":" + p.mode, p.targets !== void 0)
|
|
@@ -1349,13 +1349,13 @@ function Nt(p) {
|
|
|
1349
1349
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
1350
1350
|
}
|
|
1351
1351
|
}
|
|
1352
|
-
function
|
|
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
|
|
1356
|
-
class
|
|
1355
|
+
const hs = new G();
|
|
1356
|
+
class us {
|
|
1357
1357
|
constructor(e = {}, t = {}) {
|
|
1358
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
1358
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new 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 = {};
|
|
1359
1359
|
let n = !1, i = -1, s = !1, o = -1;
|
|
1360
1360
|
if (typeof navigator < "u") {
|
|
1361
1361
|
const a = navigator.userAgent;
|
|
@@ -1363,7 +1363,7 @@ class hs {
|
|
|
1363
1363
|
const l = a.match(/Version\/(\d+)/);
|
|
1364
1364
|
i = n && l ? parseInt(l[1], 10) : -1, s = a.indexOf("Firefox") > -1, o = s ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
1365
1365
|
}
|
|
1366
|
-
typeof createImageBitmap > "u" || n && i < 17 || s && o < 98 ? this.textureLoader = new dn(this.options.manager) : this.textureLoader = new
|
|
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 it(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 hs {
|
|
|
1393
1393
|
parser: n,
|
|
1394
1394
|
userData: {}
|
|
1395
1395
|
};
|
|
1396
|
-
return
|
|
1396
|
+
return Pe(s, a, i), ve(a, i), Promise.all(n._invokeAll(function(l) {
|
|
1397
1397
|
return l.afterRoot && l.afterRoot(a);
|
|
1398
1398
|
})).then(function() {
|
|
1399
1399
|
for (const l of a.scenes)
|
|
@@ -1574,7 +1574,7 @@ class hs {
|
|
|
1574
1574
|
return Promise.resolve(this.extensions[P.KHR_BINARY_GLTF].body);
|
|
1575
1575
|
const i = this.options;
|
|
1576
1576
|
return new Promise(function(s, o) {
|
|
1577
|
-
n.load(
|
|
1577
|
+
n.load(Ze.resolveURL(t.uri, i.path), s, void 0, function() {
|
|
1578
1578
|
o(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
1579
1579
|
});
|
|
1580
1580
|
});
|
|
@@ -1603,25 +1603,25 @@ class hs {
|
|
|
1603
1603
|
loadAccessor(e) {
|
|
1604
1604
|
const t = this, n = this.json, i = this.json.accessors[e];
|
|
1605
1605
|
if (i.bufferView === void 0 && i.sparse === void 0) {
|
|
1606
|
-
const o = It[i.type], a =
|
|
1607
|
-
return Promise.resolve(new
|
|
1606
|
+
const o = It[i.type], a = Ye[i.componentType], l = i.normalized === !0, r = new a(i.count * o);
|
|
1607
|
+
return Promise.resolve(new qe(r, o, l));
|
|
1608
1608
|
}
|
|
1609
1609
|
const s = [];
|
|
1610
1610
|
return i.bufferView !== void 0 ? s.push(this.getDependency("bufferView", i.bufferView)) : s.push(null), i.sparse !== void 0 && (s.push(this.getDependency("bufferView", i.sparse.indices.bufferView)), s.push(this.getDependency("bufferView", i.sparse.values.bufferView))), Promise.all(s).then(function(o) {
|
|
1611
|
-
const a = o[0], l = It[i.type], r =
|
|
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
|
|
1614
|
+
const b = Math.floor(u / d), I = "InterleavedBuffer:" + i.bufferView + ":" + i.componentType + ":" + b + ":" + i.count;
|
|
1615
|
+
let f = t.cache.get(I);
|
|
1616
|
+
f || (y = new r(a, b * d, i.count * d / h), f = new jn(y, d / h), t.cache.add(I, f)), g = new Zn(f, l, u % d / h, m);
|
|
1617
1617
|
} else
|
|
1618
|
-
a === null ? y = new r(i.count * l) : y = new r(a, u, i.count * l), g = new
|
|
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,
|
|
1621
|
-
a !== null && (g = new
|
|
1622
|
-
for (let z = 0,
|
|
1623
|
-
const
|
|
1624
|
-
if (g.setX(
|
|
1620
|
+
const b = It.SCALAR, I = Ye[i.sparse.indices.componentType], f = i.sparse.indices.byteOffset || 0, v = i.sparse.values.byteOffset || 0, T = new I(o[1], f, i.sparse.count * b), A = new r(o[2], v, i.sparse.count * l);
|
|
1621
|
+
a !== null && (g = new qe(g.array.slice(), g.itemSize, g.normalized)), g.normalized = !1;
|
|
1622
|
+
for (let z = 0, M = T.length; z < M; z++) {
|
|
1623
|
+
const D = T[z];
|
|
1624
|
+
if (g.setX(D, A[z * l]), l >= 2 && g.setY(D, A[z * l + 1]), l >= 3 && g.setZ(D, A[z * l + 2]), l >= 4 && g.setW(D, A[z * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1625
1625
|
}
|
|
1626
1626
|
g.normalized = m;
|
|
1627
1627
|
}
|
|
@@ -1651,7 +1651,7 @@ class hs {
|
|
|
1651
1651
|
const r = this.loadImageSource(t, n).then(function(h) {
|
|
1652
1652
|
h.flipY = !1, h.name = o.name || a.name || "", h.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (h.name = a.uri);
|
|
1653
1653
|
const u = (s.samplers || {})[o.sampler] || {};
|
|
1654
|
-
return h.magFilter =
|
|
1654
|
+
return h.magFilter = qt[u.magFilter] || zt, h.minFilter = qt[u.minFilter] || pn, h.wrapS = Jt[u.wrapS] || st, h.wrapT = Jt[u.wrapT] || st, 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
|
});
|
|
@@ -1677,10 +1677,10 @@ class hs {
|
|
|
1677
1677
|
t.isImageBitmapLoader === !0 && (m = function(y) {
|
|
1678
1678
|
const g = new Ft(y);
|
|
1679
1679
|
g.needsUpdate = !0, u(g);
|
|
1680
|
-
}), t.load(
|
|
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), ve(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
|
});
|
|
@@ -1727,7 +1727,7 @@ class hs {
|
|
|
1727
1727
|
if (e.isPoints) {
|
|
1728
1728
|
const a = "PointsMaterial:" + n.uuid;
|
|
1729
1729
|
let l = this.cache.get(a);
|
|
1730
|
-
l || (l = new
|
|
1730
|
+
l || (l = new Jn(), vt.prototype.copy.call(l, n), l.color.copy(n.color), l.map = n.map, l.sizeAttenuation = !1, this.cache.add(a, l)), n = l;
|
|
1731
1731
|
} else if (e.isLine) {
|
|
1732
1732
|
const a = "LineBasicMaterial:" + n.uuid;
|
|
1733
1733
|
let l = this.cache.get(a);
|
|
@@ -1742,7 +1742,7 @@ class hs {
|
|
|
1742
1742
|
e.material = n;
|
|
1743
1743
|
}
|
|
1744
1744
|
getMaterialType() {
|
|
1745
|
-
return
|
|
1745
|
+
return xt;
|
|
1746
1746
|
}
|
|
1747
1747
|
/**
|
|
1748
1748
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -1760,29 +1760,29 @@ class hs {
|
|
|
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 ne(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], Ae), 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, Q)), 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);
|
|
1771
1771
|
})));
|
|
1772
1772
|
}
|
|
1773
|
-
s.doubleSided === !0 && (a.side =
|
|
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 !==
|
|
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 he(1, 1), s.normalTexture.scale !== void 0)) {
|
|
1776
1776
|
const c = s.normalTexture.scale;
|
|
1777
1777
|
a.normalScale.set(c, c);
|
|
1778
1778
|
}
|
|
1779
|
-
if (s.occlusionTexture !== void 0 && o !==
|
|
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 ne().setRGB(c[0], c[1], c[2], Ae);
|
|
1782
1782
|
}
|
|
1783
|
-
return s.emissiveTexture !== void 0 && o !==
|
|
1783
|
+
return s.emissiveTexture !== void 0 && o !== Qe && r.push(t.assignTexture(a, "emissiveMap", s.emissiveTexture, Q)), 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), ve(c, s), t.associations.set(c, { materials: e }), s.extensions && Pe(i, c, s), c;
|
|
1786
1786
|
});
|
|
1787
1787
|
}
|
|
1788
1788
|
/**
|
|
@@ -1793,7 +1793,7 @@ class hs {
|
|
|
1793
1793
|
* @return {string}
|
|
1794
1794
|
*/
|
|
1795
1795
|
createUniqueName(e) {
|
|
1796
|
-
const t =
|
|
1796
|
+
const t = ot.sanitizeNodeName(e || "");
|
|
1797
1797
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
1798
1798
|
}
|
|
1799
1799
|
/**
|
|
@@ -1814,12 +1814,12 @@ class hs {
|
|
|
1814
1814
|
}
|
|
1815
1815
|
const o = [];
|
|
1816
1816
|
for (let a = 0, l = e.length; a < l; a++) {
|
|
1817
|
-
const r = e[a], h =
|
|
1817
|
+
const r = e[a], h = ls(r), c = i[h];
|
|
1818
1818
|
if (c)
|
|
1819
1819
|
o.push(c.promise);
|
|
1820
1820
|
else {
|
|
1821
1821
|
let u;
|
|
1822
|
-
r.extensions && r.extensions[P.KHR_DRACO_MESH_COMPRESSION] ? u = s(r) : u = $t(new
|
|
1822
|
+
r.extensions && r.extensions[P.KHR_DRACO_MESH_COMPRESSION] ? u = s(r) : u = $t(new Je(), r, t), i[h] = { primitive: r, promise: u }, o.push(u);
|
|
1823
1823
|
}
|
|
1824
1824
|
}
|
|
1825
1825
|
return Promise.all(o);
|
|
@@ -1834,7 +1834,7 @@ class hs {
|
|
|
1834
1834
|
loadMesh(e) {
|
|
1835
1835
|
const t = this, n = this.json, i = this.extensions, s = n.meshes[e], o = s.primitives, a = [];
|
|
1836
1836
|
for (let l = 0, r = o.length; l < r; l++) {
|
|
1837
|
-
const h = o[l].material === void 0 ?
|
|
1837
|
+
const h = o[l].material === void 0 ? os(this.cache) : this.getDependency("material", o[l].material);
|
|
1838
1838
|
a.push(h);
|
|
1839
1839
|
}
|
|
1840
1840
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
@@ -1842,20 +1842,20 @@ class hs {
|
|
|
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
|
|
1850
|
-
else if (g.mode ===
|
|
1851
|
-
b = new yn(y,
|
|
1852
|
-
else if (g.mode ===
|
|
1853
|
-
b = new
|
|
1854
|
-
else if (g.mode ===
|
|
1855
|
-
b = new
|
|
1845
|
+
const I = r[d];
|
|
1846
|
+
if (g.mode === pe.TRIANGLES || g.mode === pe.TRIANGLE_STRIP || g.mode === pe.TRIANGLE_FAN || g.mode === void 0)
|
|
1847
|
+
b = s.isSkinnedMesh === !0 ? new gn(y, I) : new Te(y, I), b.isSkinnedMesh === !0 && b.normalizeSkinWeights(), g.mode === pe.TRIANGLE_STRIP ? b.geometry = Kt(b.geometry, ln) : g.mode === pe.TRIANGLE_FAN && (b.geometry = Kt(b.geometry, Mt));
|
|
1848
|
+
else if (g.mode === pe.LINES)
|
|
1849
|
+
b = new ei(y, I);
|
|
1850
|
+
else if (g.mode === pe.LINE_STRIP)
|
|
1851
|
+
b = new yn(y, I);
|
|
1852
|
+
else if (g.mode === pe.LINE_LOOP)
|
|
1853
|
+
b = new ti(y, I);
|
|
1854
|
+
else if (g.mode === pe.POINTS)
|
|
1855
|
+
b = new ni(y, I);
|
|
1856
1856
|
else
|
|
1857
1857
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + g.mode);
|
|
1858
|
-
Object.keys(b.geometry.morphAttributes).length > 0 &&
|
|
1858
|
+
Object.keys(b.geometry.morphAttributes).length > 0 && rs(b, s), b.name = t.createUniqueName(s.name || "mesh_" + e), ve(b, s), g.extensions && Pe(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 hs {
|
|
|
1863
1863
|
primitives: d
|
|
1864
1864
|
});
|
|
1865
1865
|
if (c.length === 1)
|
|
1866
|
-
return s.extensions &&
|
|
1867
|
-
const u = new
|
|
1868
|
-
s.extensions &&
|
|
1866
|
+
return s.extensions && Pe(i, c[0], s), c[0];
|
|
1867
|
+
const u = new $e();
|
|
1868
|
+
s.extensions && Pe(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 hs {
|
|
|
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(te.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)), ve(t, n), Promise.resolve(t);
|
|
1889
1889
|
}
|
|
1890
1890
|
/**
|
|
1891
1891
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1922,8 +1922,8 @@ class hs {
|
|
|
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, I = 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", I)), r.push(m), h.push(y));
|
|
1927
1927
|
}
|
|
1928
1928
|
return Promise.all([
|
|
1929
1929
|
Promise.all(o),
|
|
@@ -1933,17 +1933,17 @@ class hs {
|
|
|
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
|
|
1938
|
-
if (
|
|
1939
|
-
|
|
1940
|
-
const
|
|
1941
|
-
if (
|
|
1942
|
-
for (let L = 0; L <
|
|
1943
|
-
b.push(
|
|
1944
|
-
}
|
|
1945
|
-
const
|
|
1946
|
-
return
|
|
1936
|
+
for (let f = 0, v = u.length; f < v; f++) {
|
|
1937
|
+
const T = u[f], A = d[f], z = m[f], M = y[f], D = g[f];
|
|
1938
|
+
if (T === void 0) continue;
|
|
1939
|
+
T.updateMatrix && T.updateMatrix();
|
|
1940
|
+
const U = n._createAnimationTracks(T, A, z, M, D);
|
|
1941
|
+
if (U)
|
|
1942
|
+
for (let L = 0; L < U.length; L++)
|
|
1943
|
+
b.push(U[L]);
|
|
1944
|
+
}
|
|
1945
|
+
const I = new Rn(s, void 0, b);
|
|
1946
|
+
return ve(I, i), I;
|
|
1947
1947
|
});
|
|
1948
1948
|
}
|
|
1949
1949
|
createNodeMesh(e) {
|
|
@@ -1976,7 +1976,7 @@ class hs {
|
|
|
1976
1976
|
]).then(function(r) {
|
|
1977
1977
|
const h = r[0], c = r[1], u = r[2];
|
|
1978
1978
|
u !== null && h.traverse(function(d) {
|
|
1979
|
-
d.isSkinnedMesh && d.bind(u,
|
|
1979
|
+
d.isSkinnedMesh && d.bind(u, hs);
|
|
1980
1980
|
});
|
|
1981
1981
|
for (let d = 0, m = c.length; d < m; d++)
|
|
1982
1982
|
h.add(c[d]);
|
|
@@ -2000,10 +2000,10 @@ class hs {
|
|
|
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
|
|
2003
|
+
if (s.isBone === !0 ? h = new Pt() : r.length > 1 ? h = new $e() : r.length === 1 ? h = r[0] : h = new De(), 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),
|
|
2006
|
+
if (s.name && (h.userData.name = s.name, h.name = o), ve(h, s), s.extensions && Pe(n, h, s), s.matrix !== void 0) {
|
|
2007
2007
|
const c = new G();
|
|
2008
2008
|
c.fromArray(s.matrix), h.applyMatrix4(c);
|
|
2009
2009
|
} else
|
|
@@ -2025,8 +2025,8 @@ class hs {
|
|
|
2025
2025
|
* @return {Promise<Group>}
|
|
2026
2026
|
*/
|
|
2027
2027
|
loadScene(e) {
|
|
2028
|
-
const t = this.extensions, n = this.json.scenes[e], i = this, s = new
|
|
2029
|
-
n.name && (s.name = i.createUniqueName(n.name)),
|
|
2028
|
+
const t = this.extensions, n = this.json.scenes[e], i = this, s = new $e();
|
|
2029
|
+
n.name && (s.name = i.createUniqueName(n.name)), ve(s, n), n.extensions && Pe(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 hs {
|
|
|
2047
2047
|
}
|
|
2048
2048
|
_createAnimationTracks(e, t, n, i, s) {
|
|
2049
2049
|
const o = [], a = e.name ? e.name : e.uuid, l = [];
|
|
2050
|
-
|
|
2050
|
+
Ee[s.path] === Ee.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 (Ee[s.path]) {
|
|
2055
|
+
case Ee.weights:
|
|
2056
2056
|
r = Ot;
|
|
2057
2057
|
break;
|
|
2058
|
-
case
|
|
2059
|
-
r =
|
|
2058
|
+
case Ee.rotation:
|
|
2059
|
+
r = bt;
|
|
2060
2060
|
break;
|
|
2061
|
-
case
|
|
2062
|
-
case
|
|
2061
|
+
case Ee.translation:
|
|
2062
|
+
case Ee.scale:
|
|
2063
2063
|
r = Dt;
|
|
2064
2064
|
break;
|
|
2065
2065
|
default:
|
|
@@ -2075,10 +2075,10 @@ class hs {
|
|
|
2075
2075
|
}
|
|
2076
2076
|
break;
|
|
2077
2077
|
}
|
|
2078
|
-
const h = i.interpolation !== void 0 ?
|
|
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] + "." + Ee[s.path],
|
|
2082
2082
|
t.array,
|
|
2083
2083
|
c,
|
|
2084
2084
|
h
|
|
@@ -2099,21 +2099,21 @@ class hs {
|
|
|
2099
2099
|
}
|
|
2100
2100
|
_createCubicSplineTrackInterpolant(e) {
|
|
2101
2101
|
e.createInterpolant = function(n) {
|
|
2102
|
-
const i = this instanceof
|
|
2102
|
+
const i = this instanceof bt ? is : wn;
|
|
2103
2103
|
return new i(this.times, this.values, this.getValueSize() / 3, n);
|
|
2104
2104
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
2105
2105
|
}
|
|
2106
2106
|
}
|
|
2107
|
-
function
|
|
2108
|
-
const n = e.attributes, i = new
|
|
2107
|
+
function ds(p, e, t) {
|
|
2108
|
+
const n = e.attributes, i = new ri();
|
|
2109
2109
|
if (n.POSITION !== void 0) {
|
|
2110
2110
|
const a = t.json.accessors[n.POSITION], l = a.min, r = a.max;
|
|
2111
2111
|
if (l !== void 0 && r !== void 0) {
|
|
2112
2112
|
if (i.set(
|
|
2113
|
-
new
|
|
2114
|
-
new
|
|
2113
|
+
new _(l[0], l[1], l[2]),
|
|
2114
|
+
new _(r[0], r[1], r[2])
|
|
2115
2115
|
), a.normalized) {
|
|
2116
|
-
const h = Nt(
|
|
2116
|
+
const h = Nt(Ye[a.componentType]);
|
|
2117
2117
|
i.min.multiplyScalar(h), i.max.multiplyScalar(h);
|
|
2118
2118
|
}
|
|
2119
2119
|
} else {
|
|
@@ -2124,14 +2124,14 @@ function us(p, e, t) {
|
|
|
2124
2124
|
return;
|
|
2125
2125
|
const s = e.targets;
|
|
2126
2126
|
if (s !== void 0) {
|
|
2127
|
-
const a = new
|
|
2127
|
+
const a = new _(), l = new _();
|
|
2128
2128
|
for (let r = 0, h = s.length; r < h; r++) {
|
|
2129
2129
|
const c = s[r];
|
|
2130
2130
|
if (c.POSITION !== void 0) {
|
|
2131
2131
|
const u = t.json.accessors[c.POSITION], d = u.min, m = u.max;
|
|
2132
2132
|
if (d !== void 0 && m !== void 0) {
|
|
2133
2133
|
if (l.setX(Math.max(Math.abs(d[0]), Math.abs(m[0]))), l.setY(Math.max(Math.abs(d[1]), Math.abs(m[1]))), l.setZ(Math.max(Math.abs(d[2]), Math.abs(m[2]))), u.normalized) {
|
|
2134
|
-
const y = Nt(
|
|
2134
|
+
const y = Nt(Ye[u.componentType]);
|
|
2135
2135
|
l.multiplyScalar(y);
|
|
2136
2136
|
}
|
|
2137
2137
|
a.max(l);
|
|
@@ -2142,7 +2142,7 @@ function us(p, e, t) {
|
|
|
2142
2142
|
i.expandByVector(a);
|
|
2143
2143
|
}
|
|
2144
2144
|
p.boundingBox = i;
|
|
2145
|
-
const o = new
|
|
2145
|
+
const o = new li();
|
|
2146
2146
|
i.getCenter(o.center), o.radius = i.min.distanceTo(i.max) / 2, p.boundingSphere = o;
|
|
2147
2147
|
}
|
|
2148
2148
|
function $t(p, e, t) {
|
|
@@ -2162,12 +2162,12 @@ function $t(p, e, t) {
|
|
|
2162
2162
|
});
|
|
2163
2163
|
i.push(o);
|
|
2164
2164
|
}
|
|
2165
|
-
return
|
|
2166
|
-
return e.targets !== void 0 ?
|
|
2165
|
+
return xe.workingColorSpace !== Ae && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${xe.workingColorSpace}" not supported.`), ve(p, e), ds(p, e, t), Promise.all(i).then(function() {
|
|
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
|
|
2170
|
+
class ps extends nt {
|
|
2171
2171
|
/**
|
|
2172
2172
|
* Constructs a new Draco loader.
|
|
2173
2173
|
*
|
|
@@ -2224,7 +2224,7 @@ class ds extends tt {
|
|
|
2224
2224
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
2225
2225
|
*/
|
|
2226
2226
|
load(e, t, n, i) {
|
|
2227
|
-
const s = new
|
|
2227
|
+
const s = new it(this.manager);
|
|
2228
2228
|
s.setPath(this.path), s.setResponseType("arraybuffer"), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials), s.load(e, (o) => {
|
|
2229
2229
|
this.parse(o, t, i);
|
|
2230
2230
|
}, n, i);
|
|
@@ -2238,10 +2238,10 @@ class ds extends tt {
|
|
|
2238
2238
|
*/
|
|
2239
2239
|
parse(e, t, n = () => {
|
|
2240
2240
|
}) {
|
|
2241
|
-
this.decodeDracoFile(e, t, null, null,
|
|
2241
|
+
this.decodeDracoFile(e, t, null, null, Q, n).catch(n);
|
|
2242
2242
|
}
|
|
2243
2243
|
//
|
|
2244
|
-
decodeDracoFile(e, t, n, i, s =
|
|
2244
|
+
decodeDracoFile(e, t, n, i, s = Ae, o = () => {
|
|
2245
2245
|
}) {
|
|
2246
2246
|
const a = {
|
|
2247
2247
|
attributeIDs: n || this.defaultAttributeIDs,
|
|
@@ -2274,22 +2274,22 @@ class ds extends tt {
|
|
|
2274
2274
|
}), a;
|
|
2275
2275
|
}
|
|
2276
2276
|
_createGeometry(e) {
|
|
2277
|
-
const t = new
|
|
2278
|
-
e.index && t.setIndex(new
|
|
2277
|
+
const t = new Je();
|
|
2278
|
+
e.index && t.setIndex(new qe(e.index.array, 1));
|
|
2279
2279
|
for (let n = 0; n < e.attributes.length; n++) {
|
|
2280
|
-
const i = e.attributes[n], s = i.name, o = i.array, a = i.itemSize, l = new
|
|
2280
|
+
const i = e.attributes[n], s = i.name, o = i.array, a = i.itemSize, l = new qe(o, a);
|
|
2281
2281
|
s === "color" && (this._assignVertexColorSpace(l, i.vertexColorSpace), l.normalized = !(o instanceof Float32Array)), t.setAttribute(s, l);
|
|
2282
2282
|
}
|
|
2283
2283
|
return t;
|
|
2284
2284
|
}
|
|
2285
2285
|
_assignVertexColorSpace(e, t) {
|
|
2286
|
-
if (t !==
|
|
2287
|
-
const n = new
|
|
2286
|
+
if (t !== Q) return;
|
|
2287
|
+
const n = new ne();
|
|
2288
2288
|
for (let i = 0, s = e.count; i < s; i++)
|
|
2289
|
-
n.fromBufferAttribute(e, i),
|
|
2289
|
+
n.fromBufferAttribute(e, i), xe.colorSpaceToWorking(n, Q), e.setXYZ(i, n.r, n.g, n.b);
|
|
2290
2290
|
}
|
|
2291
2291
|
_loadLibrary(e, t) {
|
|
2292
|
-
const n = new
|
|
2292
|
+
const n = new it(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
|
});
|
|
@@ -2303,7 +2303,7 @@ class ds extends tt {
|
|
|
2303
2303
|
return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((n) => {
|
|
2304
2304
|
const i = n[0];
|
|
2305
2305
|
e || (this.decoderConfig.wasmBinary = n[1]);
|
|
2306
|
-
const s =
|
|
2306
|
+
const s = ms.toString(), o = [
|
|
2307
2307
|
"/* draco decoder */",
|
|
2308
2308
|
i,
|
|
2309
2309
|
"",
|
|
@@ -2351,7 +2351,7 @@ class ds extends tt {
|
|
|
2351
2351
|
return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
|
|
2352
2352
|
}
|
|
2353
2353
|
}
|
|
2354
|
-
function
|
|
2354
|
+
function ms() {
|
|
2355
2355
|
let p, e;
|
|
2356
2356
|
onmessage = function(o) {
|
|
2357
2357
|
const a = o.data;
|
|
@@ -2394,15 +2394,15 @@ function ps() {
|
|
|
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 I, f;
|
|
2398
2398
|
if (r.useUniqueIDs)
|
|
2399
|
-
f = h[g],
|
|
2399
|
+
f = h[g], I = a.GetAttributeByUniqueId(u, f);
|
|
2400
2400
|
else {
|
|
2401
2401
|
if (f = a.GetAttributeId(u, o[h[g]]), f === -1) continue;
|
|
2402
|
-
|
|
2402
|
+
I = a.GetAttribute(u, f);
|
|
2403
2403
|
}
|
|
2404
|
-
const
|
|
2405
|
-
g === "color" && (
|
|
2404
|
+
const v = i(o, a, u, g, b, I);
|
|
2405
|
+
g === "color" && (v.vertexColorSpace = r.vertexColorSpace), y.attributes.push(v);
|
|
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 ps() {
|
|
|
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 I = new h(o.HEAPF32.buffer, b, m).slice();
|
|
2419
2419
|
return o._free(b), {
|
|
2420
2420
|
name: r,
|
|
2421
|
-
array:
|
|
2421
|
+
array: I,
|
|
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 fe = Uint8Array, Ve = Uint16Array, fs = Int32Array, Sn = new fe([
|
|
2451
2451
|
0,
|
|
2452
2452
|
0,
|
|
2453
2453
|
0,
|
|
@@ -2482,7 +2482,7 @@ var pe = Uint8Array, Be = Uint16Array, ms = Int32Array, Sn = new pe([
|
|
|
2482
2482
|
0,
|
|
2483
2483
|
/* impossible */
|
|
2484
2484
|
0
|
|
2485
|
-
]), Tn = new
|
|
2485
|
+
]), Tn = new fe([
|
|
2486
2486
|
0,
|
|
2487
2487
|
0,
|
|
2488
2488
|
0,
|
|
@@ -2516,65 +2516,65 @@ var pe = Uint8Array, Be = Uint16Array, ms = Int32Array, Sn = new pe([
|
|
|
2516
2516
|
/* unused */
|
|
2517
2517
|
0,
|
|
2518
2518
|
0
|
|
2519
|
-
]),
|
|
2520
|
-
for (var t = new
|
|
2519
|
+
]), gs = new fe([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), kn = function(p, e) {
|
|
2520
|
+
for (var t = new Ve(31), n = 0; n < 31; ++n)
|
|
2521
2521
|
t[n] = e += 1 << p[n - 1];
|
|
2522
|
-
for (var i = new
|
|
2522
|
+
for (var i = new fs(t[30]), n = 1; n < 30; ++n)
|
|
2523
2523
|
for (var s = t[n]; s < t[n + 1]; ++s)
|
|
2524
2524
|
i[s] = s - t[n] << 5 | n;
|
|
2525
2525
|
return { b: t, r: i };
|
|
2526
|
-
}, Cn = kn(Sn, 2), En = Cn.b,
|
|
2527
|
-
En[28] = 258,
|
|
2528
|
-
var
|
|
2526
|
+
}, Cn = kn(Sn, 2), En = Cn.b, ys = Cn.r;
|
|
2527
|
+
En[28] = 258, ys[258] = 28;
|
|
2528
|
+
var xs = kn(Tn, 0), bs = xs.b, Bt = new Ve(32768);
|
|
2529
2529
|
for (var V = 0; V < 32768; ++V) {
|
|
2530
|
-
var
|
|
2531
|
-
|
|
2530
|
+
var Me = (V & 43690) >> 1 | (V & 21845) << 1;
|
|
2531
|
+
Me = (Me & 52428) >> 2 | (Me & 13107) << 2, Me = (Me & 61680) >> 4 | (Me & 3855) << 4, Bt[V] = ((Me & 65280) >> 8 | (Me & 255) << 8) >> 1;
|
|
2532
2532
|
}
|
|
2533
|
-
var
|
|
2534
|
-
for (var n = p.length, i = 0, s = new
|
|
2533
|
+
var et = (function(p, e, t) {
|
|
2534
|
+
for (var n = p.length, i = 0, s = new Ve(e); i < n; ++i)
|
|
2535
2535
|
p[i] && ++s[p[i] - 1];
|
|
2536
|
-
var o = new
|
|
2536
|
+
var o = new Ve(e);
|
|
2537
2537
|
for (i = 1; i < e; ++i)
|
|
2538
2538
|
o[i] = o[i - 1] + s[i - 1] << 1;
|
|
2539
2539
|
var a;
|
|
2540
2540
|
if (t) {
|
|
2541
|
-
a = new
|
|
2541
|
+
a = new Ve(1 << e);
|
|
2542
2542
|
var l = 15 - e;
|
|
2543
2543
|
for (i = 0; i < n; ++i)
|
|
2544
2544
|
if (p[i])
|
|
2545
2545
|
for (var r = i << 4 | p[i], h = e - p[i], c = o[p[i] - 1]++ << h, u = c | (1 << h) - 1; c <= u; ++c)
|
|
2546
2546
|
a[Bt[c] >> l] = r;
|
|
2547
2547
|
} else
|
|
2548
|
-
for (a = new
|
|
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
|
-
}),
|
|
2551
|
+
}), lt = new fe(288);
|
|
2552
2552
|
for (var V = 0; V < 144; ++V)
|
|
2553
|
-
|
|
2553
|
+
lt[V] = 8;
|
|
2554
2554
|
for (var V = 144; V < 256; ++V)
|
|
2555
|
-
|
|
2555
|
+
lt[V] = 9;
|
|
2556
2556
|
for (var V = 256; V < 280; ++V)
|
|
2557
|
-
|
|
2557
|
+
lt[V] = 7;
|
|
2558
2558
|
for (var V = 280; V < 288; ++V)
|
|
2559
|
-
|
|
2560
|
-
var Mn = new
|
|
2559
|
+
lt[V] = 8;
|
|
2560
|
+
var Mn = new fe(32);
|
|
2561
2561
|
for (var V = 0; V < 32; ++V)
|
|
2562
2562
|
Mn[V] = 5;
|
|
2563
|
-
var
|
|
2563
|
+
var Rs = /* @__PURE__ */ et(lt, 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
|
+
}, ge = 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) {
|
|
2571
2571
|
var t = e / 8 | 0;
|
|
2572
2572
|
return (p[t] | p[t + 1] << 8 | p[t + 2] << 16) >> (e & 7);
|
|
2573
|
-
},
|
|
2573
|
+
}, As = function(p) {
|
|
2574
2574
|
return (p + 7) / 8 | 0;
|
|
2575
|
-
},
|
|
2576
|
-
return (t == null || t > p.length) && (t = p.length), new
|
|
2577
|
-
},
|
|
2575
|
+
}, Is = function(p, e, t) {
|
|
2576
|
+
return (t == null || t > p.length) && (t = p.length), new fe(p.subarray(e, t));
|
|
2577
|
+
}, Ls = [
|
|
2578
2578
|
"unexpected EOF",
|
|
2579
2579
|
"invalid block type",
|
|
2580
2580
|
"invalid length/literal",
|
|
@@ -2590,119 +2590,119 @@ var bs = /* @__PURE__ */ Je(rt, 9, 1), Rs = /* @__PURE__ */ Je(Mn, 5, 1), Tt = f
|
|
|
2590
2590
|
"stream finishing",
|
|
2591
2591
|
"invalid zip data"
|
|
2592
2592
|
// determined by unknown compression method
|
|
2593
|
-
],
|
|
2594
|
-
var n = new Error(e ||
|
|
2595
|
-
if (n.code = p, Error.captureStackTrace && Error.captureStackTrace(n,
|
|
2593
|
+
], ye = function(p, e, t) {
|
|
2594
|
+
var n = new Error(e || Ls[p]);
|
|
2595
|
+
if (n.code = p, Error.captureStackTrace && Error.captureStackTrace(n, ye), !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 fe(0);
|
|
2602
2602
|
var o = !t, a = o || e.i != 2, l = e.i;
|
|
2603
|
-
o && (t = new
|
|
2604
|
-
var r = function(
|
|
2605
|
-
var
|
|
2606
|
-
if (
|
|
2607
|
-
var Xt = new
|
|
2603
|
+
o && (t = new fe(i * 3));
|
|
2604
|
+
var r = function(ct) {
|
|
2605
|
+
var _e = t.length;
|
|
2606
|
+
if (ct > _e) {
|
|
2607
|
+
var Xt = new fe(Math.max(_e * 2, ct));
|
|
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 (
|
|
2617
|
-
d =
|
|
2618
|
-
else if (
|
|
2619
|
-
var A =
|
|
2613
|
+
h = ge(p, c, 1);
|
|
2614
|
+
var I = ge(p, c + 1, 3);
|
|
2615
|
+
if (c += 3, I)
|
|
2616
|
+
if (I == 1)
|
|
2617
|
+
d = Rs, m = vs, y = 9, g = 5;
|
|
2618
|
+
else if (I == 2) {
|
|
2619
|
+
var A = ge(p, c, 31) + 257, z = ge(p, c + 10, 15) + 4, M = A + ge(p, c + 5, 31) + 1;
|
|
2620
2620
|
c += 14;
|
|
2621
|
-
for (var
|
|
2622
|
-
|
|
2621
|
+
for (var D = new fe(M), U = new fe(19), L = 0; L < z; ++L)
|
|
2622
|
+
U[gs[L]] = ge(p, c + L * 3, 7);
|
|
2623
2623
|
c += z * 3;
|
|
2624
|
-
for (var
|
|
2625
|
-
var
|
|
2626
|
-
c +=
|
|
2627
|
-
var f =
|
|
2624
|
+
for (var F = Tt(U), X = (1 << F) - 1, K = et(U, F, 1), L = 0; L < M; ) {
|
|
2625
|
+
var oe = K[ge(p, c, X)];
|
|
2626
|
+
c += oe & 15;
|
|
2627
|
+
var f = oe >> 4;
|
|
2628
2628
|
if (f < 16)
|
|
2629
|
-
|
|
2629
|
+
D[L++] = f;
|
|
2630
2630
|
else {
|
|
2631
|
-
var
|
|
2632
|
-
for (f == 16 ? (
|
|
2633
|
-
|
|
2631
|
+
var J = 0, Le = 0;
|
|
2632
|
+
for (f == 16 ? (Le = 3 + ge(p, c, 3), c += 2, J = D[L - 1]) : f == 17 ? (Le = 3 + ge(p, c, 7), c += 3) : f == 18 && (Le = 11 + ge(p, c, 127), c += 7); Le--; )
|
|
2633
|
+
D[L++] = J;
|
|
2634
2634
|
}
|
|
2635
2635
|
}
|
|
2636
|
-
var
|
|
2637
|
-
y = Tt(
|
|
2636
|
+
var S = D.subarray(0, A), w = D.subarray(A);
|
|
2637
|
+
y = Tt(S), g = Tt(w), d = et(S, y, 1), m = et(w, g, 1);
|
|
2638
2638
|
} else
|
|
2639
|
-
|
|
2639
|
+
ye(1);
|
|
2640
2640
|
else {
|
|
2641
|
-
var f =
|
|
2642
|
-
if (
|
|
2643
|
-
l &&
|
|
2641
|
+
var f = As(c) + 4, v = p[f - 4] | p[f - 3] << 8, T = f + v;
|
|
2642
|
+
if (T > i) {
|
|
2643
|
+
l && ye(0);
|
|
2644
2644
|
break;
|
|
2645
2645
|
}
|
|
2646
|
-
a && r(u +
|
|
2646
|
+
a && r(u + v), t.set(p.subarray(f, T), u), e.b = u += v, e.p = c = T * 8, e.f = h;
|
|
2647
2647
|
continue;
|
|
2648
2648
|
}
|
|
2649
2649
|
if (c > b) {
|
|
2650
|
-
l &&
|
|
2650
|
+
l && ye(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 $ = (1 << y) - 1, ke = (1 << g) - 1, Ce = c; ; Ce = c) {
|
|
2656
|
+
var J = d[kt(p, c) & $], C = J >> 4;
|
|
2657
|
+
if (c += J & 15, c > b) {
|
|
2658
|
+
l && ye(0);
|
|
2659
2659
|
break;
|
|
2660
2660
|
}
|
|
2661
|
-
if (
|
|
2662
|
-
t[u++] =
|
|
2663
|
-
else if (
|
|
2664
|
-
|
|
2661
|
+
if (J || ye(2), C < 256)
|
|
2662
|
+
t[u++] = C;
|
|
2663
|
+
else if (C == 256) {
|
|
2664
|
+
Ce = c, d = null;
|
|
2665
2665
|
break;
|
|
2666
2666
|
} else {
|
|
2667
|
-
var j =
|
|
2668
|
-
if (
|
|
2669
|
-
var L =
|
|
2670
|
-
j =
|
|
2667
|
+
var j = C - 254;
|
|
2668
|
+
if (C > 264) {
|
|
2669
|
+
var L = C - 257, Z = Sn[L];
|
|
2670
|
+
j = ge(p, c, (1 << Z) - 1) + En[L], c += Z;
|
|
2671
2671
|
}
|
|
2672
|
-
var
|
|
2673
|
-
|
|
2674
|
-
var
|
|
2675
|
-
if (
|
|
2676
|
-
var
|
|
2677
|
-
|
|
2672
|
+
var W = m[kt(p, c) & ke], we = W >> 4;
|
|
2673
|
+
W || ye(3), c += W & 15;
|
|
2674
|
+
var w = bs[we];
|
|
2675
|
+
if (we > 3) {
|
|
2676
|
+
var Z = Tn[we];
|
|
2677
|
+
w += kt(p, c) & (1 << Z) - 1, c += Z;
|
|
2678
2678
|
}
|
|
2679
2679
|
if (c > b) {
|
|
2680
|
-
l &&
|
|
2680
|
+
l && ye(0);
|
|
2681
2681
|
break;
|
|
2682
2682
|
}
|
|
2683
2683
|
a && r(u + 131072);
|
|
2684
|
-
var
|
|
2685
|
-
if (u <
|
|
2686
|
-
var
|
|
2687
|
-
for (
|
|
2688
|
-
t[u] = n[
|
|
2684
|
+
var re = u + j;
|
|
2685
|
+
if (u < w) {
|
|
2686
|
+
var Oe = s - w, Rt = Math.min(w, re);
|
|
2687
|
+
for (Oe + u < 0 && ye(3); u < Rt; ++u)
|
|
2688
|
+
t[u] = n[Oe + u];
|
|
2689
2689
|
}
|
|
2690
|
-
for (; u <
|
|
2691
|
-
t[u] = t[u -
|
|
2690
|
+
for (; u < re; ++u)
|
|
2691
|
+
t[u] = t[u - w];
|
|
2692
2692
|
}
|
|
2693
2693
|
}
|
|
2694
|
-
e.l = d, e.p =
|
|
2694
|
+
e.l = d, e.p = Ce, e.b = u, e.f = h, d && (h = 1, e.m = y, e.d = m, e.n = g);
|
|
2695
2695
|
} while (!h);
|
|
2696
|
-
return u != t.length && o ?
|
|
2697
|
-
},
|
|
2698
|
-
return ((p[0] & 15) != 8 || p[0] >> 4 > 7 || (p[0] << 8 | p[1]) % 31) &&
|
|
2696
|
+
return u != t.length && o ? Is(t, 0, u) : t.subarray(0, u);
|
|
2697
|
+
}, Ss = /* @__PURE__ */ new fe(0), Ts = function(p, e) {
|
|
2698
|
+
return ((p[0] & 15) != 8 || p[0] >> 4 > 7 || (p[0] << 8 | p[1]) % 31) && ye(6, "invalid zlib data"), (p[1] >> 5 & 1) == 1 && ye(6, "invalid zlib data: " + (p[1] & 32 ? "need" : "unexpected") + " dictionary"), (p[1] >> 3 & 4) + 2;
|
|
2699
2699
|
};
|
|
2700
|
-
function
|
|
2701
|
-
return
|
|
2700
|
+
function ks(p, e) {
|
|
2701
|
+
return ws(p.subarray(Ts(p), -4), { i: 2 }, e, e);
|
|
2702
2702
|
}
|
|
2703
|
-
var
|
|
2703
|
+
var Cs = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), Es = 0;
|
|
2704
2704
|
try {
|
|
2705
|
-
|
|
2705
|
+
Cs.decode(Ss, { stream: !0 }), Es = 1;
|
|
2706
2706
|
} catch {
|
|
2707
2707
|
}
|
|
2708
2708
|
function zn(p, e, t) {
|
|
@@ -2716,7 +2716,7 @@ function zn(p, e, t) {
|
|
|
2716
2716
|
e < t[o] ? s = o : i = o, o = Math.floor((i + s) / 2);
|
|
2717
2717
|
return o;
|
|
2718
2718
|
}
|
|
2719
|
-
function
|
|
2719
|
+
function Ms(p, e, t, n) {
|
|
2720
2720
|
const i = [], s = [], o = [];
|
|
2721
2721
|
i[0] = 1;
|
|
2722
2722
|
for (let a = 1; a <= t; ++a) {
|
|
@@ -2730,15 +2730,15 @@ function Es(p, e, t, n) {
|
|
|
2730
2730
|
}
|
|
2731
2731
|
return i;
|
|
2732
2732
|
}
|
|
2733
|
-
function
|
|
2734
|
-
const i = zn(p, n, e), s =
|
|
2733
|
+
function zs(p, e, t, n) {
|
|
2734
|
+
const i = zn(p, n, e), s = Ms(i, n, p, e), o = new at(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;
|
|
2738
2738
|
}
|
|
2739
2739
|
return o;
|
|
2740
2740
|
}
|
|
2741
|
-
function
|
|
2741
|
+
function Hs(p, e, t, n, i) {
|
|
2742
2742
|
const s = [];
|
|
2743
2743
|
for (let c = 0; c <= t; ++c)
|
|
2744
2744
|
s[c] = 0;
|
|
@@ -2771,14 +2771,14 @@ function zs(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 A = f; A <=
|
|
2778
|
-
m[d][A] = (m[u][A] - m[u][A - 1]) / a[
|
|
2779
|
-
c <=
|
|
2780
|
-
const
|
|
2781
|
-
u = d, d =
|
|
2774
|
+
const b = c - y, I = t - y;
|
|
2775
|
+
c >= y && (m[d][0] = m[u][0] / a[I + 1][b], g = m[d][0] * a[b][I]);
|
|
2776
|
+
const f = b >= -1 ? 1 : -b, v = c - 1 <= I ? y - 1 : t - c;
|
|
2777
|
+
for (let A = f; A <= v; ++A)
|
|
2778
|
+
m[d][A] = (m[u][A] - m[u][A - 1]) / a[I + 1][b + A], g += m[d][A] * a[b + A][I];
|
|
2779
|
+
c <= I && (m[d][y] = -m[u][y - 1] / a[I + 1][c], g += m[d][y] * a[c][I]), o[y][c] = g;
|
|
2780
|
+
const T = u;
|
|
2781
|
+
u = d, d = T;
|
|
2782
2782
|
}
|
|
2783
2783
|
}
|
|
2784
2784
|
let h = t;
|
|
@@ -2789,8 +2789,8 @@ function zs(p, e, t, n, i) {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
return o;
|
|
2791
2791
|
}
|
|
2792
|
-
function
|
|
2793
|
-
const s = i < p ? i : p, o = [], a = zn(p, n, e), l =
|
|
2792
|
+
function Ps(p, e, t, n, i) {
|
|
2793
|
+
const s = i < p ? i : p, o = [], a = zn(p, n, e), l = Hs(a, n, p, s, e), r = [];
|
|
2794
2794
|
for (let h = 0; h < t.length; ++h) {
|
|
2795
2795
|
const c = t[h].clone(), u = c.w;
|
|
2796
2796
|
c.x *= u, c.y *= u, c.z *= u, r[h] = c;
|
|
@@ -2802,10 +2802,10 @@ function Hs(p, e, t, n, i) {
|
|
|
2802
2802
|
o[h] = c;
|
|
2803
2803
|
}
|
|
2804
2804
|
for (let h = s + 1; h <= i + 1; ++h)
|
|
2805
|
-
o[h] = new
|
|
2805
|
+
o[h] = new at(0, 0, 0);
|
|
2806
2806
|
return o;
|
|
2807
2807
|
}
|
|
2808
|
-
function
|
|
2808
|
+
function Fs(p, e) {
|
|
2809
2809
|
let t = 1;
|
|
2810
2810
|
for (let i = 2; i <= p; ++i)
|
|
2811
2811
|
t *= i;
|
|
@@ -2816,26 +2816,26 @@ function Ps(p, e) {
|
|
|
2816
2816
|
n *= i;
|
|
2817
2817
|
return t / n;
|
|
2818
2818
|
}
|
|
2819
|
-
function
|
|
2819
|
+
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 _(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) {
|
|
2827
2827
|
const o = t[s].clone();
|
|
2828
2828
|
for (let a = 1; a <= s; ++a)
|
|
2829
|
-
o.sub(i[s - a].clone().multiplyScalar(
|
|
2829
|
+
o.sub(i[s - a].clone().multiplyScalar(Fs(s, a) * n[a]));
|
|
2830
2830
|
i[s] = o.divideScalar(n[0]);
|
|
2831
2831
|
}
|
|
2832
2832
|
return i;
|
|
2833
2833
|
}
|
|
2834
|
-
function
|
|
2835
|
-
const s =
|
|
2836
|
-
return
|
|
2834
|
+
function Os(p, e, t, n, i) {
|
|
2835
|
+
const s = Ps(p, e, t, n, i);
|
|
2836
|
+
return Ds(s);
|
|
2837
2837
|
}
|
|
2838
|
-
class
|
|
2838
|
+
class _s extends ci {
|
|
2839
2839
|
/**
|
|
2840
2840
|
* Constructs a new NURBS curve.
|
|
2841
2841
|
*
|
|
@@ -2851,7 +2851,7 @@ class Os extends li {
|
|
|
2851
2851
|
this.degree = e, this.knots = t, this.controlPoints = [], this.startKnot = i || 0, this.endKnot = s || o;
|
|
2852
2852
|
for (let l = 0; l < a; ++l) {
|
|
2853
2853
|
const r = n[l];
|
|
2854
|
-
this.controlPoints[l] = new
|
|
2854
|
+
this.controlPoints[l] = new at(r.x, r.y, r.z, r.w);
|
|
2855
2855
|
}
|
|
2856
2856
|
}
|
|
2857
2857
|
/**
|
|
@@ -2861,8 +2861,8 @@ class Os extends li {
|
|
|
2861
2861
|
* @param {Vector3} [optionalTarget] - The optional target vector the result is written to.
|
|
2862
2862
|
* @return {Vector3} The position on the curve.
|
|
2863
2863
|
*/
|
|
2864
|
-
getPoint(e, t = new
|
|
2865
|
-
const n = t, i = this.knots[this.startKnot] + e * (this.knots[this.endKnot] - this.knots[this.startKnot]), s =
|
|
2864
|
+
getPoint(e, t = new _()) {
|
|
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
|
}
|
|
2868
2868
|
/**
|
|
@@ -2872,8 +2872,8 @@ class Os extends li {
|
|
|
2872
2872
|
* @param {Vector3} [optionalTarget] - The optional target vector the result is written to.
|
|
2873
2873
|
* @return {Vector3} The tangent vector.
|
|
2874
2874
|
*/
|
|
2875
|
-
getTangent(e, t = new
|
|
2876
|
-
const n = t, i = this.knots[0] + e * (this.knots[this.knots.length - 1] - this.knots[0]), s =
|
|
2875
|
+
getTangent(e, t = new _()) {
|
|
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
|
}
|
|
2879
2879
|
toJSON() {
|
|
@@ -2881,11 +2881,11 @@ class Os extends li {
|
|
|
2881
2881
|
return e.degree = this.degree, e.knots = [...this.knots], e.controlPoints = this.controlPoints.map((t) => t.toArray()), e.startKnot = this.startKnot, e.endKnot = this.endKnot, e;
|
|
2882
2882
|
}
|
|
2883
2883
|
fromJSON(e) {
|
|
2884
|
-
return super.fromJSON(e), this.degree = e.degree, this.knots = [...e.knots], this.controlPoints = e.controlPoints.map((t) => new
|
|
2884
|
+
return super.fromJSON(e), this.degree = e.degree, this.knots = [...e.knots], this.controlPoints = e.controlPoints.map((t) => new at(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, q, ae;
|
|
2888
|
+
class en extends nt {
|
|
2889
2889
|
/**
|
|
2890
2890
|
* Constructs a new FBX loader.
|
|
2891
2891
|
*
|
|
@@ -2904,7 +2904,7 @@ class en extends tt {
|
|
|
2904
2904
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
2905
2905
|
*/
|
|
2906
2906
|
load(e, t, n, i) {
|
|
2907
|
-
const s = this, o = s.path === "" ?
|
|
2907
|
+
const s = this, o = s.path === "" ? Ze.extractUrlBase(e) : s.path, a = new it(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));
|
|
@@ -2921,28 +2921,28 @@ class en extends tt {
|
|
|
2921
2921
|
* @return {Group} An object representing the parsed asset.
|
|
2922
2922
|
*/
|
|
2923
2923
|
parse(e, t) {
|
|
2924
|
-
if (
|
|
2925
|
-
H = new
|
|
2924
|
+
if (Ws(e))
|
|
2925
|
+
H = new Vs().parse(e);
|
|
2926
2926
|
else {
|
|
2927
2927
|
const i = Fn(e);
|
|
2928
|
-
if (!
|
|
2928
|
+
if (!Xs(i))
|
|
2929
2929
|
throw new Error("THREE.FBXLoader: Unknown format.");
|
|
2930
2930
|
if (nn(i) < 7e3)
|
|
2931
2931
|
throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + nn(i));
|
|
2932
|
-
H = new
|
|
2932
|
+
H = new Gs().parse(i);
|
|
2933
2933
|
}
|
|
2934
2934
|
const n = new dn(this.manager).setPath(this.resourcePath || t).setCrossOrigin(this.crossOrigin);
|
|
2935
|
-
return new
|
|
2935
|
+
return new Ns(n, this.manager).parse(H);
|
|
2936
2936
|
}
|
|
2937
2937
|
}
|
|
2938
|
-
class
|
|
2938
|
+
class Ns {
|
|
2939
2939
|
constructor(e, t) {
|
|
2940
2940
|
this.textureLoader = e, this.manager = t;
|
|
2941
2941
|
}
|
|
2942
2942
|
parse() {
|
|
2943
|
-
|
|
2944
|
-
const e = this.parseImages(), t = this.parseTextures(e), n = this.parseMaterials(t), i = this.parseDeformers(), s = new
|
|
2945
|
-
return this.parseScene(i, s, n),
|
|
2943
|
+
q = this.parseConnections();
|
|
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), ae;
|
|
2946
2946
|
}
|
|
2947
2947
|
// Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
|
|
2948
2948
|
// and details the connection type
|
|
@@ -3041,7 +3041,7 @@ class _s {
|
|
|
3041
3041
|
const n = this.loadTexture(e, t);
|
|
3042
3042
|
n.ID = e.id, n.name = e.attrName;
|
|
3043
3043
|
const i = e.WrapModeU, s = e.WrapModeV, o = i !== void 0 ? i.value : 0, a = s !== void 0 ? s.value : 0;
|
|
3044
|
-
if (n.wrapS = o === 0 ?
|
|
3044
|
+
if (n.wrapS = o === 0 ? st : Ht, n.wrapT = a === 0 ? st : 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 _s {
|
|
|
3058
3058
|
i === null && (i = this.textureLoader);
|
|
3059
3059
|
const s = i.path;
|
|
3060
3060
|
s || i.setPath(this.textureLoader.path);
|
|
3061
|
-
const o =
|
|
3061
|
+
const o = q.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 _s {
|
|
|
3083
3083
|
parseMaterial(e, t) {
|
|
3084
3084
|
const n = e.id, i = e.attrName;
|
|
3085
3085
|
let s = e.ShadingModel;
|
|
3086
|
-
if (typeof s == "object" && (s = s.value), !
|
|
3086
|
+
if (typeof s == "object" && (s = s.value), !q.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 ht();
|
|
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 ht();
|
|
3098
3098
|
break;
|
|
3099
3099
|
}
|
|
3100
3100
|
return a.setValues(o), a.name = i, a;
|
|
@@ -3103,9 +3103,9 @@ class _s {
|
|
|
3103
3103
|
// Also parse the texture map and return any textures associated with the material
|
|
3104
3104
|
parseParameters(e, t, n) {
|
|
3105
3105
|
const i = {};
|
|
3106
|
-
e.BumpFactor && (i.bumpScale = e.BumpFactor.value), e.Diffuse ? i.color =
|
|
3106
|
+
e.BumpFactor && (i.bumpScale = e.BumpFactor.value), e.Diffuse ? i.color = xe.colorSpaceToWorking(new ne().fromArray(e.Diffuse.value), Q) : e.DiffuseColor && (e.DiffuseColor.type === "Color" || e.DiffuseColor.type === "ColorRGB") && (i.color = xe.colorSpaceToWorking(new ne().fromArray(e.DiffuseColor.value), Q)), e.DisplacementFactor && (i.displacementScale = e.DisplacementFactor.value), e.Emissive ? i.emissive = xe.colorSpaceToWorking(new ne().fromArray(e.Emissive.value), Q) : e.EmissiveColor && (e.EmissiveColor.type === "Color" || e.EmissiveColor.type === "ColorRGB") && (i.emissive = xe.colorSpaceToWorking(new ne().fromArray(e.EmissiveColor.value), Q)), 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 = xe.colorSpaceToWorking(new ne().fromArray(e.Specular.value), Q) : e.SpecularColor && e.SpecularColor.type === "Color" && (i.specular = xe.colorSpaceToWorking(new ne().fromArray(e.SpecularColor.value), Q));
|
|
3107
3107
|
const s = this;
|
|
3108
|
-
return
|
|
3108
|
+
return q.get(n).children.forEach(function(o) {
|
|
3109
3109
|
const a = o.relationship;
|
|
3110
3110
|
switch (a) {
|
|
3111
3111
|
case "Bump":
|
|
@@ -3116,23 +3116,23 @@ class _s {
|
|
|
3116
3116
|
break;
|
|
3117
3117
|
case "DiffuseColor":
|
|
3118
3118
|
case "Maya|TEX_color_map":
|
|
3119
|
-
i.map = s.getTexture(t, o.ID), i.map !== void 0 && (i.map.colorSpace =
|
|
3119
|
+
i.map = s.getTexture(t, o.ID), i.map !== void 0 && (i.map.colorSpace = Q);
|
|
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 = Q);
|
|
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 =
|
|
3132
|
+
i.envMap = s.getTexture(t, o.ID), i.envMap !== void 0 && (i.envMap.mapping = hi, i.envMap.colorSpace = Q);
|
|
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 = Q);
|
|
3136
3136
|
break;
|
|
3137
3137
|
case "TransparentColor":
|
|
3138
3138
|
case "TransparencyFactor":
|
|
@@ -3153,7 +3153,7 @@ class _s {
|
|
|
3153
3153
|
}
|
|
3154
3154
|
// get a texture from the textureMap for use by a material.
|
|
3155
3155
|
getTexture(e, t) {
|
|
3156
|
-
return "LayeredTexture" in H.Objects && t in H.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), t =
|
|
3156
|
+
return "LayeredTexture" in H.Objects && t in H.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), t = q.get(t).children[0].ID), e.get(t);
|
|
3157
3157
|
}
|
|
3158
3158
|
// Parse nodes in FBXTree.Objects.Deformer
|
|
3159
3159
|
// Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
|
|
@@ -3163,7 +3163,7 @@ class _s {
|
|
|
3163
3163
|
if ("Deformer" in H.Objects) {
|
|
3164
3164
|
const n = H.Objects.Deformer;
|
|
3165
3165
|
for (const i in n) {
|
|
3166
|
-
const s = n[i], o =
|
|
3166
|
+
const s = n[i], o = q.get(parseInt(i));
|
|
3167
3167
|
if (s.attrType === "Skin") {
|
|
3168
3168
|
const a = this.parseSkeleton(o, n);
|
|
3169
3169
|
a.ID = i, o.parents.length > 1 && console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), a.geometryID = o.parents[0].ID, e[i] = a;
|
|
@@ -3213,7 +3213,7 @@ class _s {
|
|
|
3213
3213
|
fullWeights: o.FullWeights.a
|
|
3214
3214
|
};
|
|
3215
3215
|
if (o.attrType !== "BlendShapeChannel") return;
|
|
3216
|
-
a.geoID =
|
|
3216
|
+
a.geoID = q.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,29 +3221,29 @@ class _s {
|
|
|
3221
3221
|
}
|
|
3222
3222
|
// create the main Group() to be returned by the loader
|
|
3223
3223
|
parseScene(e, t, n) {
|
|
3224
|
-
|
|
3224
|
+
ae = 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), q.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 && ae.add(l);
|
|
3232
|
+
}), this.bindSkeleton(e.skeletons, t, i), this.addGlobalSceneSettings(), ae.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);
|
|
3236
3236
|
l.applyMatrix4(r), l.updateWorldMatrix();
|
|
3237
3237
|
}
|
|
3238
3238
|
});
|
|
3239
|
-
const a = new
|
|
3240
|
-
|
|
3239
|
+
const a = new Us().parse();
|
|
3240
|
+
ae.children.length === 1 && ae.children[0].isGroup && (ae.children[0].animations = a, ae = ae.children[0]), ae.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 = q.get(a);
|
|
3247
3247
|
let h = this.buildSkeleton(r, e, a, l.attrName);
|
|
3248
3248
|
if (!h) {
|
|
3249
3249
|
switch (l.attrType) {
|
|
@@ -3265,10 +3265,10 @@ class _s {
|
|
|
3265
3265
|
break;
|
|
3266
3266
|
case "Null":
|
|
3267
3267
|
default:
|
|
3268
|
-
h = new
|
|
3268
|
+
h = new $e();
|
|
3269
3269
|
break;
|
|
3270
3270
|
}
|
|
3271
|
-
h.name = l.attrName ?
|
|
3271
|
+
h.name = l.attrName ? ot.sanitizeNodeName(l.attrName) : "", h.userData.originalName = l.attrName, h.ID = a;
|
|
3272
3272
|
}
|
|
3273
3273
|
this.getTransformData(h, l), i.set(a, h);
|
|
3274
3274
|
}
|
|
@@ -3282,7 +3282,7 @@ class _s {
|
|
|
3282
3282
|
l.rawBones.forEach(function(r, h) {
|
|
3283
3283
|
if (r.ID === o.ID) {
|
|
3284
3284
|
const c = s;
|
|
3285
|
-
s = new Pt(), s.matrixWorld.copy(r.transformLink), s.name = i ?
|
|
3285
|
+
s = new Pt(), s.matrixWorld.copy(r.transformLink), s.name = i ? ot.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 _s {
|
|
|
3295
3295
|
const s = H.Objects.NodeAttribute[i.ID];
|
|
3296
3296
|
s !== void 0 && (n = s);
|
|
3297
3297
|
}), n === void 0)
|
|
3298
|
-
t = new
|
|
3298
|
+
t = new De();
|
|
3299
3299
|
else {
|
|
3300
3300
|
let i = 0;
|
|
3301
3301
|
n.CameraProjectionType !== void 0 && n.CameraProjectionType.value === 1 && (i = 1);
|
|
@@ -3314,10 +3314,10 @@ class _s {
|
|
|
3314
3314
|
t = new xn(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 De();
|
|
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 De();
|
|
3321
3321
|
break;
|
|
3322
3322
|
}
|
|
3323
3323
|
}
|
|
@@ -3330,12 +3330,12 @@ class _s {
|
|
|
3330
3330
|
const s = H.Objects.NodeAttribute[i.ID];
|
|
3331
3331
|
s !== void 0 && (n = s);
|
|
3332
3332
|
}), n === void 0)
|
|
3333
|
-
t = new
|
|
3333
|
+
t = new De();
|
|
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 = xe.colorSpaceToWorking(new ne().fromArray(n.Color.value), Q));
|
|
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;
|
|
@@ -3343,19 +3343,19 @@ class _s {
|
|
|
3343
3343
|
const l = 1;
|
|
3344
3344
|
switch (i) {
|
|
3345
3345
|
case 0:
|
|
3346
|
-
t = new
|
|
3346
|
+
t = new yt(s, o, a, l);
|
|
3347
3347
|
break;
|
|
3348
3348
|
case 1:
|
|
3349
3349
|
t = new hn(s, o);
|
|
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 = te.degToRad(n.InnerAngle.value));
|
|
3354
3354
|
let h = 0;
|
|
3355
|
-
n.OuterAngle !== void 0 && (h =
|
|
3355
|
+
n.OuterAngle !== void 0 && (h = te.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
|
-
console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new
|
|
3358
|
+
console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new yt(s, o);
|
|
3359
3359
|
break;
|
|
3360
3360
|
}
|
|
3361
3361
|
n.CastShadows !== void 0 && n.CastShadows.value === 1 && (t.castShadow = !0);
|
|
@@ -3367,8 +3367,8 @@ class _s {
|
|
|
3367
3367
|
const a = [];
|
|
3368
3368
|
if (e.children.forEach(function(l) {
|
|
3369
3369
|
t.has(l.ID) && (s = t.get(l.ID)), n.has(l.ID) && a.push(n.get(l.ID));
|
|
3370
|
-
}), a.length > 1 ? o = a : a.length > 0 ? o = a[0] : (o = new
|
|
3371
|
-
name:
|
|
3370
|
+
}), a.length > 1 ? o = a : a.length > 0 ? o = a[0] : (o = new ht({
|
|
3371
|
+
name: nt.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 _s {
|
|
|
3379
3379
|
(c.materialIndex < 0 || c.materialIndex >= a.length) && (c.materialIndex = a.length, l = !0);
|
|
3380
3380
|
}
|
|
3381
3381
|
if (l) {
|
|
3382
|
-
const r = new
|
|
3382
|
+
const r = new ht();
|
|
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 Te(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: nt.DEFAULT_MATERIAL_NAME,
|
|
3393
3393
|
color: 3342591,
|
|
3394
3394
|
linewidth: 1
|
|
3395
3395
|
});
|
|
@@ -3398,15 +3398,15 @@ class _s {
|
|
|
3398
3398
|
// parse the model node for transform data
|
|
3399
3399
|
getTransformData(e, t) {
|
|
3400
3400
|
const n = {};
|
|
3401
|
-
"InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)), "RotationOrder" in t ? n.eulerOrder =
|
|
3401
|
+
"InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)), "RotationOrder" in t ? n.eulerOrder = rt(t.RotationOrder.value) : n.eulerOrder = rt(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 && q.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), ae.add(e.target)) : e.lookAt(new _().fromArray(o));
|
|
3410
3410
|
}
|
|
3411
3411
|
}
|
|
3412
3412
|
});
|
|
@@ -3415,10 +3415,10 @@ class _s {
|
|
|
3415
3415
|
const i = this.parsePoseNodes();
|
|
3416
3416
|
for (const s in e) {
|
|
3417
3417
|
const o = e[s];
|
|
3418
|
-
|
|
3418
|
+
q.get(parseInt(o.ID)).parents.forEach(function(l) {
|
|
3419
3419
|
if (t.has(l.ID)) {
|
|
3420
3420
|
const r = l.ID;
|
|
3421
|
-
|
|
3421
|
+
q.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
|
}
|
|
@@ -3444,15 +3444,15 @@ class _s {
|
|
|
3444
3444
|
if ("AmbientColor" in H.GlobalSettings) {
|
|
3445
3445
|
const e = H.GlobalSettings.AmbientColor.value, t = e[0], n = e[1], i = e[2];
|
|
3446
3446
|
if (t !== 0 || n !== 0 || i !== 0) {
|
|
3447
|
-
const s = new
|
|
3448
|
-
|
|
3447
|
+
const s = new ne().setRGB(t, n, i, Q);
|
|
3448
|
+
ae.add(new ui(s, 1));
|
|
3449
3449
|
}
|
|
3450
3450
|
}
|
|
3451
|
-
"UnitScaleFactor" in H.GlobalSettings && (
|
|
3451
|
+
"UnitScaleFactor" in H.GlobalSettings && (ae.userData.unitScaleFactor = H.GlobalSettings.UnitScaleFactor.value);
|
|
3452
3452
|
}
|
|
3453
3453
|
}
|
|
3454
3454
|
}
|
|
3455
|
-
class
|
|
3455
|
+
class Bs {
|
|
3456
3456
|
constructor() {
|
|
3457
3457
|
this.negativeMaterialIndices = !1;
|
|
3458
3458
|
}
|
|
@@ -3462,7 +3462,7 @@ class Ns {
|
|
|
3462
3462
|
if ("Geometry" in H.Objects) {
|
|
3463
3463
|
const n = H.Objects.Geometry;
|
|
3464
3464
|
for (const i in n) {
|
|
3465
|
-
const s =
|
|
3465
|
+
const s = q.get(parseInt(i)), o = this.parseGeometry(s, n[i], e);
|
|
3466
3466
|
t.set(parseInt(i), o);
|
|
3467
3467
|
}
|
|
3468
3468
|
}
|
|
@@ -3490,22 +3490,22 @@ class Ns {
|
|
|
3490
3490
|
n.morphTargets[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 = rt(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
|
}
|
|
3497
3497
|
// Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
|
|
3498
3498
|
genGeometry(e, t, n, i) {
|
|
3499
|
-
const s = new
|
|
3499
|
+
const s = new Je();
|
|
3500
3500
|
e.attrName && (s.name = e.attrName);
|
|
3501
|
-
const o = this.parseGeoNode(e, t), a = this.genBuffers(o), l = new
|
|
3502
|
-
if (l.applyMatrix4(i), s.setAttribute("position", l), a.colors.length > 0 && s.setAttribute("color", new
|
|
3503
|
-
const r = new
|
|
3501
|
+
const o = this.parseGeoNode(e, t), a = this.genBuffers(o), l = new Ne(a.vertex, 3);
|
|
3502
|
+
if (l.applyMatrix4(i), s.setAttribute("position", l), a.colors.length > 0 && s.setAttribute("color", new Ne(a.colors, 3)), t && (s.setAttribute("skinIndex", new di(a.weightsIndices, 4)), s.setAttribute("skinWeight", new Ne(a.vertexWeights, 4)), s.FBX_Deformer = t), a.normal.length > 0) {
|
|
3503
|
+
const r = new pi().getNormalMatrix(i), h = new Ne(a.normal, 3);
|
|
3504
3504
|
h.applyNormalMatrix(r), s.setAttribute("normal", h);
|
|
3505
3505
|
}
|
|
3506
3506
|
if (a.uvs.forEach(function(r, h) {
|
|
3507
3507
|
const c = h === 0 ? "uv" : `uv${h}`;
|
|
3508
|
-
s.setAttribute(c, new
|
|
3508
|
+
s.setAttribute(c, new Ne(a.uvs[h], 2));
|
|
3509
3509
|
}), o.material && o.material.mappingType !== "AllSame") {
|
|
3510
3510
|
let r = a.materialIndex[0], h = 0;
|
|
3511
3511
|
if (a.materialIndex.forEach(function(c, u) {
|
|
@@ -3550,46 +3550,46 @@ class Ns {
|
|
|
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 = [], I = [];
|
|
3554
3554
|
if (o.push(d * 3, d * 3 + 1, d * 3 + 2), e.color) {
|
|
3555
|
-
const f =
|
|
3555
|
+
const f = dt(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
|
+
I.push(f.weight), b.push(f.id);
|
|
3561
|
+
}), I.length > 4) {
|
|
3562
3562
|
s || (console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."), s = !0);
|
|
3563
|
-
const f = [0, 0, 0, 0],
|
|
3564
|
-
|
|
3565
|
-
let z =
|
|
3566
|
-
|
|
3567
|
-
if (z >
|
|
3568
|
-
L[
|
|
3569
|
-
const
|
|
3570
|
-
f[
|
|
3563
|
+
const f = [0, 0, 0, 0], v = [0, 0, 0, 0];
|
|
3564
|
+
I.forEach(function(T, A) {
|
|
3565
|
+
let z = T, M = b[A];
|
|
3566
|
+
v.forEach(function(D, U, L) {
|
|
3567
|
+
if (z > D) {
|
|
3568
|
+
L[U] = z, z = D;
|
|
3569
|
+
const F = f[U];
|
|
3570
|
+
f[U] = M, M = F;
|
|
3571
3571
|
}
|
|
3572
3572
|
});
|
|
3573
|
-
}), b = f,
|
|
3573
|
+
}), b = f, I = v;
|
|
3574
3574
|
}
|
|
3575
|
-
for (;
|
|
3576
|
-
|
|
3575
|
+
for (; I.length < 4; )
|
|
3576
|
+
I.push(0), b.push(0);
|
|
3577
3577
|
for (let f = 0; f < 4; ++f)
|
|
3578
|
-
h.push(
|
|
3578
|
+
h.push(I[f]), c.push(b[f]);
|
|
3579
3579
|
}
|
|
3580
3580
|
if (e.normal) {
|
|
3581
|
-
const f =
|
|
3581
|
+
const f = dt(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
|
|
3586
|
-
r[
|
|
3584
|
+
e.material && e.material.mappingType !== "AllSame" && (y = dt(m, n, d, e.material)[0], y < 0 && (u.negativeMaterialIndices = !0, y = 0)), e.uv && e.uv.forEach(function(f, v) {
|
|
3585
|
+
const T = dt(m, n, d, f);
|
|
3586
|
+
r[v] === void 0 && (r[v] = []), r[v].push(T[0]), r[v].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 _(0, 0, 0);
|
|
3593
3593
|
for (let n = 0; n < e.length; n++) {
|
|
3594
3594
|
const i = e[n], s = e[(n + 1) % e.length];
|
|
3595
3595
|
t.x += (i.y - s.y) * (i.z + s.z), t.y += (i.z - s.z) * (i.x + s.x), t.z += (i.x - s.x) * (i.y + s.y);
|
|
@@ -3597,7 +3597,7 @@ class Ns {
|
|
|
3597
3597
|
return t.normalize(), t;
|
|
3598
3598
|
}
|
|
3599
3599
|
getNormalTangentAndBitangent(e) {
|
|
3600
|
-
const t = this.getNormalNewell(e), i = (Math.abs(t.z) > 0.5 ? new
|
|
3600
|
+
const t = this.getNormalNewell(e), i = (Math.abs(t.z) > 0.5 ? new _(0, 1, 0) : new _(0, 0, 1)).cross(t).normalize(), s = t.clone().cross(i).normalize();
|
|
3601
3601
|
return {
|
|
3602
3602
|
normal: t,
|
|
3603
3603
|
tangent: i,
|
|
@@ -3605,7 +3605,7 @@ class Ns {
|
|
|
3605
3605
|
};
|
|
3606
3606
|
}
|
|
3607
3607
|
flattenVertex(e, t, n) {
|
|
3608
|
-
return new
|
|
3608
|
+
return new he(
|
|
3609
3609
|
e.dot(t),
|
|
3610
3610
|
e.dot(n)
|
|
3611
3611
|
);
|
|
@@ -3617,7 +3617,7 @@ class Ns {
|
|
|
3617
3617
|
const u = [], d = t.baseVertexPositions || t.vertexPositions;
|
|
3618
3618
|
for (let b = 0; b < n.length; b += 3)
|
|
3619
3619
|
u.push(
|
|
3620
|
-
new
|
|
3620
|
+
new _(
|
|
3621
3621
|
d[n[b]],
|
|
3622
3622
|
d[n[b + 1]],
|
|
3623
3623
|
d[n[b + 2]]
|
|
@@ -3626,7 +3626,7 @@ class Ns {
|
|
|
3626
3626
|
const { tangent: m, bitangent: y } = this.getNormalTangentAndBitangent(u), g = [];
|
|
3627
3627
|
for (const b of u)
|
|
3628
3628
|
g.push(this.flattenVertex(b, m, y));
|
|
3629
|
-
c =
|
|
3629
|
+
c = mi.triangulateShape(g, []);
|
|
3630
3630
|
} else
|
|
3631
3631
|
c = [[0, 1, 2]];
|
|
3632
3632
|
for (const [u, d, m] of c)
|
|
@@ -3659,7 +3659,7 @@ class Ns {
|
|
|
3659
3659
|
vertexIndices: a,
|
|
3660
3660
|
vertexPositions: c,
|
|
3661
3661
|
baseVertexPositions: o
|
|
3662
|
-
}, d = this.genBuffers(u), m = new
|
|
3662
|
+
}, d = this.genBuffers(u), m = new Ne(d.vertex, 3);
|
|
3663
3663
|
m.name = s || n.attrName, m.applyMatrix4(i), e.morphAttributes.position.push(m);
|
|
3664
3664
|
}
|
|
3665
3665
|
// Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
|
|
@@ -3691,8 +3691,8 @@ class Ns {
|
|
|
3691
3691
|
const t = e.MappingInformationType, n = e.ReferenceInformationType, i = e.Colors.a;
|
|
3692
3692
|
let s = [];
|
|
3693
3693
|
n === "IndexToDirect" && (s = e.ColorIndex.a);
|
|
3694
|
-
for (let o = 0, a = new
|
|
3695
|
-
a.fromArray(i, o),
|
|
3694
|
+
for (let o = 0, a = new ne(); o < i.length; o += 4)
|
|
3695
|
+
a.fromArray(i, o), xe.colorSpaceToWorking(a, Q), a.toArray(i, o);
|
|
3696
3696
|
return {
|
|
3697
3697
|
dataSize: 4,
|
|
3698
3698
|
buffer: i,
|
|
@@ -3727,10 +3727,10 @@ class Ns {
|
|
|
3727
3727
|
parseNurbsGeometry(e) {
|
|
3728
3728
|
const t = parseInt(e.Order);
|
|
3729
3729
|
if (isNaN(t))
|
|
3730
|
-
return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", e.Order, e.id), new
|
|
3730
|
+
return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", e.Order, e.id), new 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 at().fromArray(o, c));
|
|
3734
3734
|
let a, l;
|
|
3735
3735
|
if (e.Form === "Closed")
|
|
3736
3736
|
s.push(s[0]);
|
|
@@ -3739,11 +3739,11 @@ class Ns {
|
|
|
3739
3739
|
for (let c = 0; c < n; ++c)
|
|
3740
3740
|
s.push(s[c]);
|
|
3741
3741
|
}
|
|
3742
|
-
const h = new
|
|
3743
|
-
return new
|
|
3742
|
+
const h = new _s(n, i, s, a, l).getPoints(s.length * 12);
|
|
3743
|
+
return new Je().setFromPoints(h);
|
|
3744
3744
|
}
|
|
3745
3745
|
}
|
|
3746
|
-
class
|
|
3746
|
+
class Us {
|
|
3747
3747
|
// take raw animation clips and turn them into three.js animation clips
|
|
3748
3748
|
parse() {
|
|
3749
3749
|
const e = [], t = this.parseClips();
|
|
@@ -3787,9 +3787,9 @@ class Bs {
|
|
|
3787
3787
|
for (const n in t) {
|
|
3788
3788
|
const i = {
|
|
3789
3789
|
id: t[n].id,
|
|
3790
|
-
times: t[n].KeyTime.a.map(
|
|
3790
|
+
times: t[n].KeyTime.a.map(js),
|
|
3791
3791
|
values: t[n].KeyValueFloat.a
|
|
3792
|
-
}, s =
|
|
3792
|
+
}, s = q.get(i.id);
|
|
3793
3793
|
if (s !== void 0) {
|
|
3794
3794
|
const o = s.parents[0].ID, a = s.parents[0].relationship;
|
|
3795
3795
|
a.match(/X/) ? e.get(o).curves.x = i : a.match(/Y/) ? e.get(o).curves.y = i : a.match(/Z/) ? e.get(o).curves.z = i : a.match(/DeformPercent/) && e.has(o) && (e.get(o).curves.morph = i);
|
|
@@ -3802,13 +3802,13 @@ class Bs {
|
|
|
3802
3802
|
parseAnimationLayers(e) {
|
|
3803
3803
|
const t = H.Objects.AnimationLayer, n = /* @__PURE__ */ new Map();
|
|
3804
3804
|
for (const i in t) {
|
|
3805
|
-
const s = [], o =
|
|
3805
|
+
const s = [], o = q.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 = q.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,13 +3818,13 @@ class Bs {
|
|
|
3818
3818
|
return;
|
|
3819
3819
|
}
|
|
3820
3820
|
const d = {
|
|
3821
|
-
modelName: u.attrName ?
|
|
3821
|
+
modelName: u.attrName ? ot.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
|
+
ae.traverse(function(m) {
|
|
3828
3828
|
m.ID === u.id && (d.transform = m.matrix, m.userData.transformData && (d.eulerOrder = m.userData.transformData.eulerOrder));
|
|
3829
3829
|
}), d.transform || (d.transform = new G()), "PreRotation" in u && (d.preRotation = u.PreRotation.value), "PostRotation" in u && (d.postRotation = u.PostRotation.value), s[r] = d;
|
|
3830
3830
|
}
|
|
@@ -3832,10 +3832,10 @@ class Bs {
|
|
|
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 = q.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 = q.get(c).parents[0].ID, d = q.get(u).parents[0].ID, m = q.get(d).parents[0].ID, y = H.Objects.Model[m], g = {
|
|
3838
|
+
modelName: y.attrName ? ot.sanitizeNodeName(y.attrName) : "",
|
|
3839
3839
|
morphName: H.Objects.Deformer[c].attrName
|
|
3840
3840
|
};
|
|
3841
3841
|
s[r] = g;
|
|
@@ -3852,7 +3852,7 @@ class Bs {
|
|
|
3852
3852
|
parseAnimStacks(e) {
|
|
3853
3853
|
const t = H.Objects.AnimationStack, n = {};
|
|
3854
3854
|
for (const i in t) {
|
|
3855
|
-
const s =
|
|
3855
|
+
const s = q.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 Bs {
|
|
|
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 _(), i = new _();
|
|
3875
|
+
if (e.transform && e.transform.decompose(n, new me(), 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,21 +3900,21 @@ class Bs {
|
|
|
3900
3900
|
const u = this.interpolateRotations(t.x, t.y, t.z, s);
|
|
3901
3901
|
o = u[0], a = u[1];
|
|
3902
3902
|
}
|
|
3903
|
-
const l =
|
|
3904
|
-
n !== void 0 && (n = n.map(
|
|
3905
|
-
const r = new
|
|
3906
|
-
if (!a || !o) return new
|
|
3903
|
+
const l = rt(0);
|
|
3904
|
+
n !== void 0 && (n = n.map(te.degToRad), n.push(l), n = new Fe().fromArray(n), n = new me().setFromEuler(n)), i !== void 0 && (i = i.map(te.degToRad), i.push(l), i = new Fe().fromArray(i), i = new me().setFromEuler(i).invert());
|
|
3905
|
+
const r = new me(), h = new Fe(), c = [];
|
|
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 me().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);
|
|
3912
|
-
return new
|
|
3912
|
+
return new bt(e + ".quaternion", o, c);
|
|
3913
3913
|
}
|
|
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 = ae.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 Bs {
|
|
|
3959
3959
|
// PI, so we'll interpolate large rotations
|
|
3960
3960
|
interpolateRotations(e, t, n, i) {
|
|
3961
3961
|
const s = [], o = [];
|
|
3962
|
-
s.push(e.times[0]), o.push(
|
|
3962
|
+
s.push(e.times[0]), o.push(te.degToRad(e.values[0])), o.push(te.degToRad(t.values[0])), o.push(te.degToRad(n.values[0]));
|
|
3963
3963
|
for (let a = 1; a < e.values.length; a++) {
|
|
3964
3964
|
const l = [
|
|
3965
3965
|
e.values[a - 1],
|
|
@@ -3968,14 +3968,14 @@ class Bs {
|
|
|
3968
3968
|
];
|
|
3969
3969
|
if (isNaN(l[0]) || isNaN(l[1]) || isNaN(l[2]))
|
|
3970
3970
|
continue;
|
|
3971
|
-
const r = l.map(
|
|
3971
|
+
const r = l.map(te.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(te.degToRad), u = [
|
|
3979
3979
|
h[0] - l[0],
|
|
3980
3980
|
h[1] - l[1],
|
|
3981
3981
|
h[2] - l[2]
|
|
@@ -3985,18 +3985,18 @@ class Bs {
|
|
|
3985
3985
|
Math.abs(u[2])
|
|
3986
3986
|
];
|
|
3987
3987
|
if (d[0] >= 180 || d[1] >= 180 || d[2] >= 180) {
|
|
3988
|
-
const y = Math.max(...d) / 180, g = new
|
|
3989
|
-
|
|
3990
|
-
const
|
|
3991
|
-
for (let
|
|
3992
|
-
A.copy(
|
|
3988
|
+
const y = Math.max(...d) / 180, g = new Fe(...r, i), b = new Fe(...c, i), I = new me().setFromEuler(g), f = new me().setFromEuler(b);
|
|
3989
|
+
I.dot(f) && f.set(-f.x, -f.y, -f.z, -f.w);
|
|
3990
|
+
const v = e.times[a - 1], T = e.times[a] - v, A = new me(), z = new Fe();
|
|
3991
|
+
for (let M = 0; M < 1; M += 1 / y)
|
|
3992
|
+
A.copy(I.clone().slerp(f.clone(), M)), s.push(v + M * T), z.setFromQuaternion(A, i), o.push(z.x), o.push(z.y), o.push(z.z);
|
|
3993
3993
|
} else
|
|
3994
|
-
s.push(e.times[a]), o.push(
|
|
3994
|
+
s.push(e.times[a]), o.push(te.degToRad(e.values[a])), o.push(te.degToRad(t.values[a])), o.push(te.degToRad(n.values[a]));
|
|
3995
3995
|
}
|
|
3996
3996
|
return [s, o];
|
|
3997
3997
|
}
|
|
3998
3998
|
}
|
|
3999
|
-
class
|
|
3999
|
+
class Gs {
|
|
4000
4000
|
getPrevNode() {
|
|
4001
4001
|
return this.nodeStack[this.currentIndent - 2];
|
|
4002
4002
|
}
|
|
@@ -4050,7 +4050,7 @@ class Us {
|
|
|
4050
4050
|
let c = s.split(",").slice(3);
|
|
4051
4051
|
c = c.map(function(u) {
|
|
4052
4052
|
return u.trim().replace(/^"/, "");
|
|
4053
|
-
}), i = "connections", s = [r, h],
|
|
4053
|
+
}), i = "connections", s = [r, h], Ys(s, c), o[i] === void 0 && (o[i] = []);
|
|
4054
4054
|
}
|
|
4055
4055
|
i === "Node" && (o.id = s), i in o && Array.isArray(o[i]) ? o[i].push(s) : i !== "a" ? o[i] = s : o.a = s, this.setCurrentProp(o, i), i === "a" && s.slice(-1) !== "," && (o.a = Et(s));
|
|
4056
4056
|
}
|
|
@@ -4091,7 +4091,7 @@ class Us {
|
|
|
4091
4091
|
}, this.setCurrentProp(this.getPrevNode(), s);
|
|
4092
4092
|
}
|
|
4093
4093
|
}
|
|
4094
|
-
class
|
|
4094
|
+
class Vs {
|
|
4095
4095
|
parse(e) {
|
|
4096
4096
|
const t = new tn(e);
|
|
4097
4097
|
t.skip(23);
|
|
@@ -4195,7 +4195,7 @@ class Gs {
|
|
|
4195
4195
|
case "l":
|
|
4196
4196
|
return e.getInt64Array(i);
|
|
4197
4197
|
}
|
|
4198
|
-
const a =
|
|
4198
|
+
const a = ks(new Uint8Array(e.getArrayBuffer(o))), l = new tn(a.buffer);
|
|
4199
4199
|
switch (t) {
|
|
4200
4200
|
case "b":
|
|
4201
4201
|
case "c":
|
|
@@ -4320,11 +4320,11 @@ class Hn {
|
|
|
4320
4320
|
this[e] = t;
|
|
4321
4321
|
}
|
|
4322
4322
|
}
|
|
4323
|
-
function
|
|
4323
|
+
function Ws(p) {
|
|
4324
4324
|
const e = "Kaydara FBX Binary \0";
|
|
4325
4325
|
return p.byteLength >= e.length && e === Fn(p, 0, e.length);
|
|
4326
4326
|
}
|
|
4327
|
-
function
|
|
4327
|
+
function Xs(p) {
|
|
4328
4328
|
const e = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"];
|
|
4329
4329
|
let t = 0;
|
|
4330
4330
|
function n(i) {
|
|
@@ -4342,11 +4342,11 @@ function nn(p) {
|
|
|
4342
4342
|
return parseInt(t[1]);
|
|
4343
4343
|
throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.");
|
|
4344
4344
|
}
|
|
4345
|
-
function
|
|
4345
|
+
function js(p) {
|
|
4346
4346
|
return p / 46186158e3;
|
|
4347
4347
|
}
|
|
4348
|
-
const
|
|
4349
|
-
function
|
|
4348
|
+
const Zs = [];
|
|
4349
|
+
function dt(p, e, t, n) {
|
|
4350
4350
|
let i;
|
|
4351
4351
|
switch (n.mappingType) {
|
|
4352
4352
|
case "ByPolygonVertex":
|
|
@@ -4366,45 +4366,45 @@ function ut(p, e, t, n) {
|
|
|
4366
4366
|
}
|
|
4367
4367
|
n.referenceType === "IndexToDirect" && (i = n.indices[i]);
|
|
4368
4368
|
const s = i * n.dataSize, o = s + n.dataSize;
|
|
4369
|
-
return
|
|
4369
|
+
return Ks(Zs, n.buffer, s, o);
|
|
4370
4370
|
}
|
|
4371
|
-
const Ct = new
|
|
4371
|
+
const Ct = new Fe(), Be = new _();
|
|
4372
4372
|
function Pn(p) {
|
|
4373
4373
|
const e = new G(), t = new G(), n = new G(), i = new G(), s = new G(), o = new G(), a = new G(), l = new G(), r = new G(), h = new G(), c = new G(), u = new G(), d = p.inheritType ? p.inheritType : 0;
|
|
4374
|
-
p.translation && e.setPosition(
|
|
4375
|
-
const m =
|
|
4374
|
+
p.translation && e.setPosition(Be.fromArray(p.translation));
|
|
4375
|
+
const m = rt(0);
|
|
4376
4376
|
if (p.preRotation) {
|
|
4377
|
-
const L = p.preRotation.map(
|
|
4377
|
+
const L = p.preRotation.map(te.degToRad);
|
|
4378
4378
|
L.push(m), t.makeRotationFromEuler(Ct.fromArray(L));
|
|
4379
4379
|
}
|
|
4380
4380
|
if (p.rotation) {
|
|
4381
|
-
const L = p.rotation.map(
|
|
4381
|
+
const L = p.rotation.map(te.degToRad);
|
|
4382
4382
|
L.push(p.eulerOrder || m), n.makeRotationFromEuler(Ct.fromArray(L));
|
|
4383
4383
|
}
|
|
4384
4384
|
if (p.postRotation) {
|
|
4385
|
-
const L = p.postRotation.map(
|
|
4385
|
+
const L = p.postRotation.map(te.degToRad);
|
|
4386
4386
|
L.push(m), i.makeRotationFromEuler(Ct.fromArray(L)), i.invert();
|
|
4387
4387
|
}
|
|
4388
|
-
p.scale && s.scale(
|
|
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
4389
|
const y = t.clone().multiply(n).multiply(i), g = new G();
|
|
4390
4390
|
g.extractRotation(h);
|
|
4391
4391
|
const b = new G();
|
|
4392
4392
|
b.copyPosition(h);
|
|
4393
|
-
const
|
|
4393
|
+
const I = b.clone().invert().multiply(h), f = g.clone().invert().multiply(I), v = s, T = new G();
|
|
4394
4394
|
if (d === 0)
|
|
4395
|
-
|
|
4395
|
+
T.copy(g).multiply(y).multiply(f).multiply(v);
|
|
4396
4396
|
else if (d === 1)
|
|
4397
|
-
|
|
4397
|
+
T.copy(g).multiply(f).multiply(y).multiply(v);
|
|
4398
4398
|
else {
|
|
4399
|
-
const
|
|
4400
|
-
|
|
4399
|
+
const F = new G().scale(new _().setFromMatrixScale(c)).clone().invert(), X = f.clone().multiply(F);
|
|
4400
|
+
T.copy(g).multiply(y).multiply(X).multiply(v);
|
|
4401
4401
|
}
|
|
4402
4402
|
const A = r.clone().invert(), z = o.clone().invert();
|
|
4403
|
-
let
|
|
4404
|
-
const
|
|
4405
|
-
return u.copyPosition(
|
|
4403
|
+
let M = e.clone().multiply(l).multiply(r).multiply(t).multiply(n).multiply(i).multiply(A).multiply(a).multiply(o).multiply(s).multiply(z);
|
|
4404
|
+
const D = new G().copyPosition(M), U = h.clone().multiply(D);
|
|
4405
|
+
return u.copyPosition(U), M = u.clone().multiply(T), M.premultiply(h.invert()), M;
|
|
4406
4406
|
}
|
|
4407
|
-
function
|
|
4407
|
+
function rt(p) {
|
|
4408
4408
|
p = p || 0;
|
|
4409
4409
|
const e = [
|
|
4410
4410
|
"ZYX",
|
|
@@ -4431,37 +4431,37 @@ function Et(p) {
|
|
|
4431
4431
|
function Fn(p, e, t) {
|
|
4432
4432
|
return e === void 0 && (e = 0), t === void 0 && (t = p.byteLength), new TextDecoder().decode(new Uint8Array(p, e, t));
|
|
4433
4433
|
}
|
|
4434
|
-
function
|
|
4434
|
+
function Ys(p, e) {
|
|
4435
4435
|
for (let t = 0, n = p.length, i = e.length; t < i; t++, n++)
|
|
4436
4436
|
p[n] = e[t];
|
|
4437
4437
|
}
|
|
4438
|
-
function
|
|
4438
|
+
function Ks(p, e, t, n) {
|
|
4439
4439
|
for (let i = t, s = 0; i < n; i++, s++)
|
|
4440
4440
|
p[s] = e[i];
|
|
4441
4441
|
return p;
|
|
4442
4442
|
}
|
|
4443
|
-
class
|
|
4443
|
+
class Qs extends fi {
|
|
4444
4444
|
constructor() {
|
|
4445
4445
|
super();
|
|
4446
|
-
const e = new
|
|
4446
|
+
const e = new gi();
|
|
4447
4447
|
e.deleteAttribute("uv");
|
|
4448
|
-
const t = new
|
|
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 Te(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 De();
|
|
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 Te(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 Te(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 Te(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 Te(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 Te(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 Te(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
|
/**
|
|
@@ -4477,14 +4477,14 @@ class Ks extends mi {
|
|
|
4477
4477
|
t.dispose();
|
|
4478
4478
|
}
|
|
4479
4479
|
}
|
|
4480
|
-
function
|
|
4480
|
+
function Ue(p) {
|
|
4481
4481
|
return new An({
|
|
4482
4482
|
color: 0,
|
|
4483
4483
|
emissive: 16777215,
|
|
4484
4484
|
emissiveIntensity: p
|
|
4485
4485
|
});
|
|
4486
4486
|
}
|
|
4487
|
-
var
|
|
4487
|
+
var tt = function() {
|
|
4488
4488
|
var p = 0, e = document.createElement("div");
|
|
4489
4489
|
e.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", e.addEventListener("click", function(h) {
|
|
4490
4490
|
h.preventDefault(), n(++p % e.children.length);
|
|
@@ -4497,9 +4497,9 @@ var $e = function() {
|
|
|
4497
4497
|
e.children[c].style.display = c === h ? "block" : "none";
|
|
4498
4498
|
p = h;
|
|
4499
4499
|
}
|
|
4500
|
-
var i = (performance || Date).now(), s = i, o = 0, a = t(new
|
|
4500
|
+
var i = (performance || Date).now(), s = i, o = 0, a = t(new tt.Panel("FPS", "#0ff", "#002")), l = t(new tt.Panel("MS", "#0f0", "#020"));
|
|
4501
4501
|
if (self.performance && self.performance.memory)
|
|
4502
|
-
var r = t(new
|
|
4502
|
+
var r = t(new tt.Panel("MB", "#f08", "#201"));
|
|
4503
4503
|
return n(0), {
|
|
4504
4504
|
REVISION: 16,
|
|
4505
4505
|
dom: e,
|
|
@@ -4525,26 +4525,26 @@ var $e = function() {
|
|
|
4525
4525
|
setMode: n
|
|
4526
4526
|
};
|
|
4527
4527
|
};
|
|
4528
|
-
|
|
4528
|
+
tt.Panel = function(p, e, t) {
|
|
4529
4529
|
var n = 1 / 0, i = 0, s = Math.round, o = s(window.devicePixelRatio || 1), a = 80 * o, l = 48 * o, r = 3 * o, h = 2 * o, c = 3 * o, u = 15 * o, d = 74 * o, m = 30 * o, y = document.createElement("canvas");
|
|
4530
4530
|
y.width = a, y.height = l, y.style.cssText = "width:80px;height:48px";
|
|
4531
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, I) {
|
|
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 / I) * m));
|
|
4536
4536
|
}
|
|
4537
4537
|
};
|
|
4538
4538
|
};
|
|
4539
|
-
let x,
|
|
4540
|
-
const
|
|
4539
|
+
let x, ce, ue;
|
|
4540
|
+
const k = [0, 0, 0, 0], E = new R.Vector3(), pt = new R.Vector3(), ie = new R.Vector3(), mt = new R.Vector3();
|
|
4541
4541
|
new R.Plane();
|
|
4542
4542
|
new R.Ray();
|
|
4543
4543
|
new R.Euler();
|
|
4544
|
-
const
|
|
4544
|
+
const se = new R.Quaternion(), sn = new R.Quaternion(), be = new R.Matrix4(), Re = new R.Matrix4();
|
|
4545
4545
|
new R.Vector3();
|
|
4546
|
-
const
|
|
4547
|
-
class
|
|
4546
|
+
const ft = 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
|
+
class eo {
|
|
4548
4548
|
constructor(e = null) {
|
|
4549
4549
|
this.opt = Object.assign({
|
|
4550
4550
|
warmupMs: 2e3,
|
|
@@ -4850,7 +4850,7 @@ class $s {
|
|
|
4850
4850
|
/// Bone's parent object
|
|
4851
4851
|
vBasis: r.position.clone(),
|
|
4852
4852
|
// Original local position
|
|
4853
|
-
vWorld: r.parent.getWorldPosition(
|
|
4853
|
+
vWorld: r.parent.getWorldPosition(E).clone(),
|
|
4854
4854
|
// World position, parent
|
|
4855
4855
|
qBasis: r.parent.quaternion.clone(),
|
|
4856
4856
|
// Original quaternion, parent
|
|
@@ -4867,7 +4867,7 @@ class $s {
|
|
|
4867
4867
|
ea: [0, 0, 0, 0]
|
|
4868
4868
|
// External acceleration [m/s^2]
|
|
4869
4869
|
};
|
|
4870
|
-
h.boneParent.matrixWorld.decompose(
|
|
4870
|
+
h.boneParent.matrixWorld.decompose(E, se, ie), E.copy(ft).applyQuaternion(se).setY(0).normalize(), se.premultiply(sn.setFromUnitVectors(ft, E).invert()).normalize(), h.qWorldInverseYaw = se.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 $s {
|
|
|
4885
4885
|
for (this.timerMs += e, e > 1e3 && (this.timerMs = 0), e /= 1e3, t = 0, i = this.objectsUpdate.length; t < i; t++)
|
|
4886
4886
|
o = this.objectsUpdate[t], o.updateMatrix(), o.parent === null ? o.matrixWorld.copy(o.matrix) : o.matrixWorld.multiplyMatrices(o.parent.matrixWorld, o.matrix), o.matrixWorldNeedsUpdate = !1;
|
|
4887
4887
|
for (t = 0, i = this.data.length; t < i; t++) {
|
|
4888
|
-
if (o = this.data[t],
|
|
4888
|
+
if (o = this.data[t], E.copy(o.vWorld), be.copy(o.boneParent.matrixWorld), Re.copy(be).invert(), o.vWorld.setFromMatrixPosition(be), E.applyMatrix4(Re), E.length() > 0.5 && (console.info("Info: Unrealistic jump of " + E.length().toFixed(2) + " meters."), E.setLength(0.5)), E.applyQuaternion(o.bone.quaternion), k[0] = E.x, k[1] = E.y, k[2] = -E.z, k[3] = E.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], k[0] -= x.v[0] * e / 3, k[1] -= x.v[1] * e / 3, k[2] += x.v[2] * e / 3, k[3] -= x.v[3] * e / 3;
|
|
4891
|
+
if (x = this.opt.sensitivityFactor, k[0] *= o.ext * x, k[1] *= o.ext * x, k[2] *= o.ext * x, k[3] *= o.ext * x, o.isX && (x = k[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 + k[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 = k[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 + k[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 = k[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 + k[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 = k[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 + k[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), k[0] = o.p[0], k[1] = o.p[1], k[2] = o.p[2], k[3] = o.p[3], x = this.opt.movementFactor, k[0] *= x, k[1] *= x, k[2] *= x, k[3] *= x, o.dl && (x = o.dl, k[0] += x[0], k[1] += x[1], k[2] += x[2]), o.dw && (x = o.dw, E.set(
|
|
4892
|
+
o.vBasis.x + k[0],
|
|
4893
|
+
o.vBasis.y + k[1],
|
|
4894
|
+
o.vBasis.z + k[2]
|
|
4895
|
+
), E.applyMatrix4(be), E.x += x[0], E.y += x[1], E.z += x[2], E.applyMatrix4(Re), k[0] += E.x - o.vBasis.x, k[1] += E.y - o.vBasis.y, k[2] += E.z - o.vBasis.z), o.limits && this.opt.isLimits && (x = o.limits, x[0] && (x[0][0] !== null && k[0] < x[0][0] && (k[0] = x[0][0]), x[0][1] !== null && k[0] > x[0][1] && (k[0] = x[0][1])), x[1] && (x[1][0] !== null && k[1] < x[1][0] && (k[1] = x[1][0]), x[1][1] !== null && k[1] > x[1][1] && (k[1] = x[1][1])), x[2] && (x[2][0] !== null && k[2] < x[2][0] && (k[2] = x[2][0]), x[2][1] !== null && k[2] > x[2][1] && (k[2] = x[2][1])), x[3] && (x[3][0] !== null && k[3] < x[3][0] && (k[3] = x[3][0]), x[3][1] !== null && k[3] > x[3][1] && (k[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 + k[0],
|
|
4898
|
+
o.vBasis.y + k[1],
|
|
4899
|
+
o.vBasis.z - k[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(E, se, ie), E.copy(ft).applyQuaternion(se).setY(0).normalize(), se.premultiply(sn.setFromUnitVectors(ft, E).invert()).normalize(), o.boneParent.quaternion.multiply(se.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (x = Math.atan(k[0] / o.l), se.setFromAxisAngle($s, -x), o.boneParent.quaternion.multiply(se)), o.isY && (x = o.l / 3, x = x * Math.tanh(k[1] / x), o.bone.position.setLength(o.l + x)), o.isX && (x = Math.atan(k[2] / o.l), se.setFromAxisAngle(qs, -x), o.boneParent.quaternion.multiply(se)), o.isT && (x = 1.5 * Math.tanh(k[3] * 1.5), se.setFromAxisAngle(Js, -x), o.boneParent.quaternion.multiply(se)), 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], ie.set(0, 0, 0), x.deltaLocal && (ie.x += x.deltaLocal[0], ie.y += x.deltaLocal[1], ie.z += x.deltaLocal[2]), ie.applyMatrix4(x.bone.matrixWorld), Re.copy(o.boneParent.matrixWorld).invert(), ie.applyMatrix4(Re), E.copy(o.bone.position), !(E.distanceToSquared(ie) >= x.radiusSq) && (ue = E.length(), ce = ie.length(), !(ce > x.radius + ue) && (ce < Math.abs(x.radius - ue) || (ce = (ce * ce + ue * ue - x.radiusSq) / (2 * ce), ie.normalize(), mt.copy(ie).multiplyScalar(ce), ce = Math.sqrt(ue * ue - ce * ce), E.subVectors(E, mt).projectOnPlane(ie).normalize().multiplyScalar(ce), pt.subVectors(o.vBasis, mt).projectOnPlane(ie).normalize(), ue = pt.dot(E), ue < 0 && (ue = Math.sqrt(ce * ce - ue * ue), pt.multiplyScalar(ue), E.add(pt)), E.add(mt).normalize(), ie.copy(o.bone.position).normalize(), se.setFromUnitVectors(ie, E), o.boneParent.quaternion.premultiply(se), o.boneParent.updateWorldMatrix(!1, !0))));
|
|
4904
4904
|
}
|
|
4905
4905
|
this.helpers.isActive && this.updateHelpers();
|
|
4906
4906
|
}
|
|
@@ -4971,17 +4971,17 @@ class $s {
|
|
|
4971
4971
|
*/
|
|
4972
4972
|
updateHelpers() {
|
|
4973
4973
|
if (x = this.helpers.points, x.bones.length) {
|
|
4974
|
-
|
|
4974
|
+
Re.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
|
+
be.multiplyMatrices(Re, x.bones[t].matrixWorld), E.setFromMatrixPosition(be), e.setXYZ(t, E.x, E.y, E.z);
|
|
4978
4978
|
e.needsUpdate = !0, x.object.updateMatrixWorld();
|
|
4979
4979
|
}
|
|
4980
4980
|
if (x = this.helpers.lines, x.bones.length) {
|
|
4981
|
-
|
|
4981
|
+
Re.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
|
+
be.multiplyMatrices(Re, x.bones[t].matrixWorld), E.setFromMatrixPosition(be), e.setXYZ(n, E.x, E.y, E.z), be.multiplyMatrices(Re, x.bones[t].parent.matrixWorld), E.setFromMatrixPosition(be), e.setXYZ(n + 1, E.x, E.y, E.z);
|
|
4985
4985
|
e.needsUpdate = !0, x.object.updateMatrixWorld();
|
|
4986
4986
|
}
|
|
4987
4987
|
}
|
|
@@ -5018,7 +5018,7 @@ class $s {
|
|
|
5018
5018
|
this.stop(), this.scene = null, this.armature = null, this.config = [], this.data = [], this.dict = {}, this.objectsUpdate = [], this.timerMs = 0;
|
|
5019
5019
|
}
|
|
5020
5020
|
}
|
|
5021
|
-
class
|
|
5021
|
+
class to {
|
|
5022
5022
|
constructor(e) {
|
|
5023
5023
|
this.audioContext = e, this.analyzer = null, this.dataArray = null, this.bufferLength = 0;
|
|
5024
5024
|
}
|
|
@@ -5343,7 +5343,7 @@ class eo {
|
|
|
5343
5343
|
return i * s;
|
|
5344
5344
|
}
|
|
5345
5345
|
}
|
|
5346
|
-
class
|
|
5346
|
+
class no {
|
|
5347
5347
|
/**
|
|
5348
5348
|
* @constructor
|
|
5349
5349
|
*/
|
|
@@ -5925,11 +5925,11 @@ class to {
|
|
|
5925
5925
|
return t;
|
|
5926
5926
|
}
|
|
5927
5927
|
}
|
|
5928
|
-
const
|
|
5928
|
+
const io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5929
5929
|
__proto__: null,
|
|
5930
|
-
LipsyncEn:
|
|
5930
|
+
LipsyncEn: no
|
|
5931
5931
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5932
|
-
class
|
|
5932
|
+
class so {
|
|
5933
5933
|
/**
|
|
5934
5934
|
* @constructor
|
|
5935
5935
|
*/
|
|
@@ -6283,11 +6283,11 @@ class io {
|
|
|
6283
6283
|
return t;
|
|
6284
6284
|
}
|
|
6285
6285
|
}
|
|
6286
|
-
const
|
|
6286
|
+
const oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6287
6287
|
__proto__: null,
|
|
6288
|
-
LipsyncDe:
|
|
6288
|
+
LipsyncDe: so
|
|
6289
6289
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6290
|
-
class
|
|
6290
|
+
class ao {
|
|
6291
6291
|
/**
|
|
6292
6292
|
* @constructor
|
|
6293
6293
|
*/
|
|
@@ -6818,11 +6818,11 @@ class oo {
|
|
|
6818
6818
|
return t;
|
|
6819
6819
|
}
|
|
6820
6820
|
}
|
|
6821
|
-
const
|
|
6821
|
+
const ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6822
6822
|
__proto__: null,
|
|
6823
|
-
LipsyncFr:
|
|
6823
|
+
LipsyncFr: ao
|
|
6824
6824
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6825
|
-
class
|
|
6825
|
+
class lo {
|
|
6826
6826
|
/**
|
|
6827
6827
|
* @constructor
|
|
6828
6828
|
*/
|
|
@@ -6965,11 +6965,11 @@ class ro {
|
|
|
6965
6965
|
return t;
|
|
6966
6966
|
}
|
|
6967
6967
|
}
|
|
6968
|
-
const
|
|
6968
|
+
const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6969
6969
|
__proto__: null,
|
|
6970
|
-
LipsyncFi:
|
|
6970
|
+
LipsyncFi: lo
|
|
6971
6971
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6972
|
-
class
|
|
6972
|
+
class ho {
|
|
6973
6973
|
/**
|
|
6974
6974
|
* @constructor
|
|
6975
6975
|
*/
|
|
@@ -7149,21 +7149,21 @@ class co {
|
|
|
7149
7149
|
return t;
|
|
7150
7150
|
}
|
|
7151
7151
|
}
|
|
7152
|
-
const
|
|
7152
|
+
const uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7153
7153
|
__proto__: null,
|
|
7154
|
-
LipsyncLt:
|
|
7155
|
-
}, Symbol.toStringTag, { value: "Module" })), uo = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZU1lc3NhZ2UuYmluZCh0aGlzKTsKCiAgICB0aGlzLl9zYW1wbGVSYXRlID0gb3B0aW9ucz8ucHJvY2Vzc29yT3B0aW9ucz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J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEuCiAgICAgICAgICAgIHRoaXMuX3NpbGVuY2VGcmFtZXNDb3VudCsrOwogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHRoaXMuX3VuZGVycnVuQmxvY2tzKys7CiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0K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ZXRyaWNzIiwKICAgICAgICAgICAgZGF0YTogewogICAgICAgICAgICAgIHN0YXRlOiB0aGlzLl9zdGF0ZSwKICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzLAogICAgICAgICAgICAgIHF1ZXVlZE1zOiBNYXRoLnJvdW5kKChxdWV1ZWRTYW1wbGVzIC8gdGhpcy5fc2FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICBtYXhRdWV1ZWRNczogTWF0aC5yb3VuZCgodGhpcy5fbWF4UXVldWVTYW1wbGVzIC8gdGhpcy5fc2FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICB1bmRlcnJ1bkJsb2NrczogdGhpcy5fdW5kZXJydW5CbG9ja3MsCiAgICAgICAgICAgICAgZnJhbWVzUHJvY2Vzc2VkOiB0aGlzLl9mcmFtZXNQcm9jZXNzZWQKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoXykgeyB9CiAgICAgICAgLy8gRG9uJ3QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), on = {
|
|
7156
|
-
en:
|
|
7157
|
-
de:
|
|
7158
|
-
fr:
|
|
7159
|
-
fi:
|
|
7160
|
-
lt:
|
|
7161
|
-
},
|
|
7154
|
+
LipsyncLt: ho
|
|
7155
|
+
}, Symbol.toStringTag, { value: "Module" })), po = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3Jrb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8gc3RvcCBpbW1lZGlhdGVseS4KICAgIGlmICh0eXBlID09PSAic3RvcCIpIHsKICAgICAgdGhpcy5yZXNldCgpOwogICAgICAvLyBTZW5kIGZpbmFsIG1ldHJpY3Mgc2hvd2luZyBjbGVhcmVkIHN0YXRlCiAgICAgIGlmICh0aGlzLl9tZXRyaWNzRW5hYmxlZCkgewogICAgICAgIHRyeSB7CiAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICB0eXBlOiAibWV0cmljcyIsCiAgICAgICAgICAgIGRhdGE6IHsKICAgICAgICAgICAgICBzdGF0ZTogUGxheWJhY2tXb3JrbGV0LkZTTS5JRExFLAogICAgICAgICAgICAgIHF1ZXVlZFNhbXBsZXM6IDAsCiAgICAgICAgICAgICAgcXVldWVkTXM6IDAsCiAgICAgICAgICAgICAgbWF4UXVldWVkTXM6IE1hdGgucm91bmQoKHRoaXMuX21heFF1ZXVlU2FtcGxlcyAvIHRoaXMuX3NhbXBsZVJhdGUpICogMTAwMCksCiAgICAgICAgICAgICAgdW5kZXJydW5CbG9ja3M6IHRoaXMuX3VuZGVycnVuQmxvY2tzLAogICAgICAgICAgICAgIGZyYW1lc1Byb2Nlc3NlZDogdGhpcy5fZnJhbWVzUHJvY2Vzc2VkCiAgICAgICAgICAgIH0KICAgICAgICAgIH0pOwogICAgICAgIH0gY2F0Y2ggKF8pIHsgfQogICAgICB9CiAgICAgIHJldHVybjsKICAgIH0KCiAgICAvLyBNYWluIHRocmVhZCBoYXMgc2lnbmFsZWQgdGhhdCBubyBtb3JlIGF1ZGlvIGNodW5rcyB3aWxsIGJlIHNlbnQgZm9yIHRoaXMgdXR0ZXJhbmNlLgogICAgaWYgKHR5cGUgPT09ICJuby1tb3JlLWRhdGEiKSB7CiAgICAgIHRoaXMuX25vTW9yZURhdGFSZWNlaXZlZCA9IHRydWU7CiAgICAgIHJldHVybjsKICAgIH0KCiAgICAvLyBVcGRhdGUgbWV0cmljcyBjb25maWd1c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oeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUl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rLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), on = {
|
|
7156
|
+
en: io,
|
|
7157
|
+
de: oo,
|
|
7158
|
+
fr: ro,
|
|
7159
|
+
fi: co,
|
|
7160
|
+
lt: uo
|
|
7161
|
+
}, Y = new R.Quaternion(), O = new R.Euler(), Se = new R.Vector3(), ze = new R.Vector3(), an = new R.Box3();
|
|
7162
7162
|
new R.Matrix4();
|
|
7163
7163
|
new R.Matrix4();
|
|
7164
7164
|
new R.Vector3();
|
|
7165
7165
|
new R.Vector3(0, 0, 1);
|
|
7166
|
-
const
|
|
7166
|
+
const mo = new R.Vector3(1, 0, 0);
|
|
7167
7167
|
new R.Vector3(0, 1, 0);
|
|
7168
7168
|
new R.Vector3(0, 0, 1);
|
|
7169
7169
|
class Dn {
|
|
@@ -7292,7 +7292,7 @@ class Dn {
|
|
|
7292
7292
|
avatarOnlyCamera: null,
|
|
7293
7293
|
statsNode: null,
|
|
7294
7294
|
statsStyle: null
|
|
7295
|
-
}, Object.assign(this.opt, t || {}), this.opt.statsNode && (this.stats = new
|
|
7295
|
+
}, Object.assign(this.opt, t || {}), this.opt.statsNode && (this.stats = new tt(), this.opt.statsStyle && (this.stats.dom.style.cssText = this.opt.statsStyle), this.opt.statsNode.appendChild(this.stats.dom)), this.poseTemplates = {
|
|
7296
7296
|
side: {
|
|
7297
7297
|
standing: !0,
|
|
7298
7298
|
props: {
|
|
@@ -8591,7 +8591,7 @@ class Dn {
|
|
|
8591
8591
|
this.opt.lightSpotDispersion
|
|
8592
8592
|
), this.setLighting(this.opt);
|
|
8593
8593
|
const a = new R.PMREMGenerator(this.renderer);
|
|
8594
|
-
a.compileEquirectangularShader(), this.scene.environment = a.fromScene(new
|
|
8594
|
+
a.compileEquirectangularShader(), this.scene.environment = a.fromScene(new Qs()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new bi(this.camera, this.renderer.domElement), this.controls.enableZoom = this.opt.cameraZoomEnable, this.controls.enableRotate = this.opt.cameraRotateEnable, this.controls.enablePan = this.opt.cameraPanEnable, this.controls.minDistance = 2, this.controls.maxDistance = 2e3, this.controls.autoRotateSpeed = 0, this.controls.autoRotate = !1, this.controls.update(), this.cameraClock = null;
|
|
8595
8595
|
}
|
|
8596
8596
|
this.ikMesh = new R.SkinnedMesh();
|
|
8597
8597
|
const s = {
|
|
@@ -8609,14 +8609,14 @@ class Dn {
|
|
|
8609
8609
|
Object.entries(s).forEach((a, l) => {
|
|
8610
8610
|
const r = new R.Bone();
|
|
8611
8611
|
r.name = a[0], a[1] ? this.ikMesh.getObjectByName(a[1]).add(r) : this.ikMesh.add(r), o.push(r);
|
|
8612
|
-
}), this.ikMesh.bind(new R.Skeleton(o)), this.dynamicbones = new
|
|
8612
|
+
}), this.ikMesh.bind(new R.Skeleton(o)), this.dynamicbones = new eo(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
|
|
8613
8613
|
}
|
|
8614
8614
|
/**
|
|
8615
8615
|
* Helper that re/creates the audio context and the other nodes.
|
|
8616
8616
|
* @param {number} sampleRate
|
|
8617
8617
|
*/
|
|
8618
8618
|
initAudioGraph(e = null) {
|
|
8619
|
-
if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), e ? this.audioCtx = new AudioContext({ sampleRate: e }) : this.audioCtx = new AudioContext(), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioBackgroundSource = this.audioCtx.createBufferSource(), this.audioBackgroundGainNode = this.audioCtx.createGain(), this.audioSpeechGainNode = this.audioCtx.createGain(), this.audioStreamGainNode = this.audioCtx.createGain(), this.audioAnalyzerNode = this.audioCtx.createAnalyser(), this.audioAnalyzerNode.fftSize = 256, this.audioAnalyzerNode.smoothingTimeConstant = 0.1, this.audioAnalyzerNode.minDecibels = -70, this.audioAnalyzerNode.maxDecibels = -10, this.audioAnalyzer = new
|
|
8619
|
+
if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), e ? this.audioCtx = new AudioContext({ sampleRate: e }) : this.audioCtx = new AudioContext(), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioBackgroundSource = this.audioCtx.createBufferSource(), this.audioBackgroundGainNode = this.audioCtx.createGain(), this.audioSpeechGainNode = this.audioCtx.createGain(), this.audioStreamGainNode = this.audioCtx.createGain(), this.audioAnalyzerNode = this.audioCtx.createAnalyser(), this.audioAnalyzerNode.fftSize = 256, this.audioAnalyzerNode.smoothingTimeConstant = 0.1, this.audioAnalyzerNode.minDecibels = -70, this.audioAnalyzerNode.maxDecibels = -10, this.audioAnalyzer = new to(this.audioCtx), this.audioReverbNode = this.audioCtx.createConvolver(), this.audioBackgroundGainNode.connect(this.audioReverbNode), this.audioAnalyzerNode.connect(this.audioSpeechGainNode), this.audioSpeechGainNode.connect(this.audioReverbNode), this.audioStreamGainNode.connect(this.audioReverbNode), this.audioReverbNode.connect(this.audioCtx.destination), this.setReverb(this.currentReverb || null), this.setMixerGain(
|
|
8620
8620
|
this.opt.mixerGainSpeech,
|
|
8621
8621
|
this.opt.mixerGainBackground
|
|
8622
8622
|
), this.workletLoaded = !1, this.streamWorkletNode) {
|
|
@@ -8757,9 +8757,9 @@ class Dn {
|
|
|
8757
8757
|
async showAvatar(e, t = null) {
|
|
8758
8758
|
if (!e || !e.hasOwnProperty("url"))
|
|
8759
8759
|
throw new Error("Invalid parameter. The avatar must have at least 'url' specified.");
|
|
8760
|
-
const n = new
|
|
8760
|
+
const n = new zi();
|
|
8761
8761
|
if (this.dracoEnabled) {
|
|
8762
|
-
const r = new
|
|
8762
|
+
const r = new ps();
|
|
8763
8763
|
r.setDecoderPath(this.dracoDecoderPath), n.setDRACOLoader(r);
|
|
8764
8764
|
}
|
|
8765
8765
|
let i = await n.loadAsync(e.url, t);
|
|
@@ -8903,9 +8903,9 @@ class Dn {
|
|
|
8903
8903
|
updatePoseDelta() {
|
|
8904
8904
|
for (const [e, t] of Object.entries(this.poseDelta.props)) {
|
|
8905
8905
|
if (t.x === 0 && t.y === 0 && t.z === 0) continue;
|
|
8906
|
-
|
|
8906
|
+
O.set(t.x, t.y, t.z);
|
|
8907
8907
|
const n = this.poseAvatar.props[e];
|
|
8908
|
-
n.isQuaternion ? (
|
|
8908
|
+
n.isQuaternion ? (Y.setFromEuler(O), n.multiply(Y)) : n.isVector3 && n.add(O);
|
|
8909
8909
|
}
|
|
8910
8910
|
}
|
|
8911
8911
|
/**
|
|
@@ -9114,7 +9114,7 @@ class Dn {
|
|
|
9114
9114
|
*/
|
|
9115
9115
|
async initializeFBXAnimationLoader() {
|
|
9116
9116
|
try {
|
|
9117
|
-
const { FBXAnimationLoader: e } = await import("./fbxAnimationLoader-
|
|
9117
|
+
const { FBXAnimationLoader: e } = await import("./fbxAnimationLoader-CO1F6v-w.js");
|
|
9118
9118
|
this.fbxAnimationLoader = new e(this.armature), console.log("FBX Animation Loader initialized");
|
|
9119
9119
|
} catch (e) {
|
|
9120
9120
|
console.warn("FBX Animation Loader not available:", e), this.fbxAnimationLoader = null;
|
|
@@ -9688,7 +9688,7 @@ class Dn {
|
|
|
9688
9688
|
}, i.x ? new R.Vector3(i.x, i.y, i.z) : null, !0, i.d);
|
|
9689
9689
|
break;
|
|
9690
9690
|
}
|
|
9691
|
-
if ((l || r) && (
|
|
9691
|
+
if ((l || r) && (O.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), O.x = Math.max(-0.9, Math.min(0.9, 2 * O.x - 0.5)), O.y = Math.max(-0.9, Math.min(0.9, -2.5 * O.y)), l ? (Object.assign(this.mtAvatar.eyesLookDown, { system: O.x < 0 ? -O.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: O.x < 0 ? 0 : O.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: O.y < 0 ? -O.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: O.y < 0 ? 0 : O.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: O.y < 0 ? 0 : O.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: O.y < 0 ? -O.y : 0, needsUpdate: !0 }), r && (n = -this.mtAvatar.bodyRotateY.value, i = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
|
|
9692
9692
|
name: "headmove",
|
|
9693
9693
|
dt: [[1e3, 2e3], [1e3, 2e3, 1, 2], [1e3, 2e3], [1e3, 2e3, 1, 2]],
|
|
9694
9694
|
vs: {
|
|
@@ -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 && (Y.setFromAxisAngle(mo, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(Y)), an.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(Se), Se.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(ze), ze.sub(this.armature.position), this.objectHips.position.y -= an.min.y / 2, this.objectHips.position.x -= (Se.x + ze.x) / 4, this.objectHips.position.z -= (Se.z + ze.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, I = y[g].match(a);
|
|
9784
9784
|
let f = y[g].match(s);
|
|
9785
|
-
const
|
|
9786
|
-
if (f && !b && !
|
|
9785
|
+
const v = y[g].match(l), T = y[g].match(o);
|
|
9786
|
+
if (f && !b && !v && y[g + 1].match(s) && (f = !1), n && (h += y[g]), I && (!i || i.every((A) => g < A[0] || g > A[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({
|
|
@@ -9797,13 +9797,13 @@ class Dn {
|
|
|
9797
9797
|
const A = this.lipsyncWordsToVisemes(c, r);
|
|
9798
9798
|
if (A && A.visemes && A.visemes.length) {
|
|
9799
9799
|
const z = A.times[A.visemes.length - 1] + A.durations[A.visemes.length - 1];
|
|
9800
|
-
for (let
|
|
9800
|
+
for (let M = 0; M < A.visemes.length; M++)
|
|
9801
9801
|
m.push({
|
|
9802
9802
|
mark: u,
|
|
9803
9803
|
template: { name: "viseme" },
|
|
9804
|
-
ts: [(A.times[
|
|
9804
|
+
ts: [(A.times[M] - 0.6) / z, (A.times[M] + 0.5) / z, (A.times[M] + A.durations[M] + 0.5) / z],
|
|
9805
9805
|
vs: {
|
|
9806
|
-
["viseme_" + A.visemes[
|
|
9806
|
+
["viseme_" + A.visemes[M]]: [null, A.visemes[M] === "PP" || A.visemes[M] === "FF" ? 0.9 : 0.6, 0]
|
|
9807
9807
|
}
|
|
9808
9808
|
});
|
|
9809
9809
|
}
|
|
@@ -9816,7 +9816,7 @@ class Dn {
|
|
|
9816
9816
|
};
|
|
9817
9817
|
n && (A.onSubtitles = n), d.length && !t.avatarMute && (A.text = d, t.avatarMood && (A.mood = t.avatarMood), t.ttsLang && (A.lang = t.ttsLang), t.ttsVoice && (A.voice = t.ttsVoice), t.ttsRate && (A.rate = t.ttsRate), t.ttsVoice && (A.pitch = t.ttsPitch), t.ttsVolume && (A.volume = t.ttsVolume)), this.speechQueue.push(A), d = [], c = "", u = 0, m = [];
|
|
9818
9818
|
}
|
|
9819
|
-
if (
|
|
9819
|
+
if (v) {
|
|
9820
9820
|
let A = this.animEmojis[y[g]];
|
|
9821
9821
|
A && A.link && (A = this.animEmojis[A.link]), A && this.speechQueue.push({ emoji: A });
|
|
9822
9822
|
}
|
|
@@ -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, I = 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 * I / 3), b + Math.min(25, I / 2), b + I + Math.min(60, I / 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((v) => v.name.includes(c) || v.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
|
|
10017
|
+
for (let v = 0; v < g.visemes.length; v++) {
|
|
10018
|
+
const T = g.visemes[v], A = g.times[v] / f, z = g.durations[v] / f, M = A * u, D = z * u;
|
|
10019
10019
|
b.push({
|
|
10020
10020
|
template: { name: "viseme" },
|
|
10021
|
-
ts: [
|
|
10021
|
+
ts: [M - Math.min(60, 2 * D / 3), M + Math.min(25, D / 2), M + D + Math.min(60, D / 2)],
|
|
10022
10022
|
vs: {
|
|
10023
|
-
["viseme_" +
|
|
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 I = [...e.anim, ...b];
|
|
10029
|
+
this.audioPlaylist.push({ anim: I, audio: d }), this.onSubtitles = e.onSubtitles || null, this.resetLips(), e.mood && this.setMood(e.mood), this.playAudio(), s.onend = () => {
|
|
10030
10030
|
t();
|
|
10031
10031
|
}, s.onerror = (f) => {
|
|
10032
10032
|
console.error("Speech synthesis error:", f.error), n(f.error);
|
|
@@ -10326,7 +10326,7 @@ class Dn {
|
|
|
10326
10326
|
}
|
|
10327
10327
|
if (!this.workletLoaded)
|
|
10328
10328
|
try {
|
|
10329
|
-
const a = this.audioCtx.audioWorklet.addModule(
|
|
10329
|
+
const a = this.audioCtx.audioWorklet.addModule(po.href), l = new Promise(
|
|
10330
10330
|
(r, h) => setTimeout(() => h(new Error("Worklet loading timed out")), 5e3)
|
|
10331
10331
|
);
|
|
10332
10332
|
await Promise.race([a, l]), this.workletLoaded = !0;
|
|
@@ -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), Se.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), ze.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), t.addVectors(Se, ze).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), Se.setFromMatrixPosition(this.objectLeftEye.matrixWorld), ze.setFromMatrixPosition(this.objectRightEye.matrixWorld), Se.add(ze).divideScalar(2), Y.copy(this.armature.quaternion), Y.multiply(this.poseTarget.props["Hips.quaternion"]), Y.multiply(this.poseTarget.props["Spine.quaternion"]), Y.multiply(this.poseTarget.props["Spine1.quaternion"]), Y.multiply(this.poseTarget.props["Spine2.quaternion"]), Y.multiply(this.poseTarget.props["Neck.quaternion"]), Y.multiply(this.poseTarget.props["Head.quaternion"]);
|
|
10581
|
+
const n = new R.Vector3().subVectors(t, Se).normalize(), i = Math.atan2(n.x, n.z), s = Math.asin(-n.y);
|
|
10582
|
+
O.set(s, i, 0, "YXZ");
|
|
10583
|
+
const a = new R.Quaternion().setFromEuler(O), l = new R.Quaternion().copy(a).multiply(Y.clone().invert());
|
|
10584
|
+
O.setFromQuaternion(l, "YXZ");
|
|
10585
|
+
let r = O.x / (40 / 24) + 0.2, h = O.y / (9 / 4), c = Math.min(0.6, Math.max(-0.3, r)), u = Math.min(0.8, Math.max(-0.8, h)), d = (Math.random() - 0.5) / 4, m = (Math.random() - 0.5) / 4;
|
|
10586
10586
|
if (e) {
|
|
10587
10587
|
let y = this.animQueue.findIndex((b) => b.template.name === "lookat");
|
|
10588
10588
|
y !== -1 && this.animQueue.splice(y, 1);
|
|
@@ -10617,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), Y.copy(this.armature.quaternion), Y.multiply(this.poseTarget.props["Hips.quaternion"]), Y.multiply(this.poseTarget.props["Spine.quaternion"]), Y.multiply(this.poseTarget.props["Spine1.quaternion"]), Y.multiply(this.poseTarget.props["Spine2.quaternion"]), Y.multiply(this.poseTarget.props["Neck.quaternion"]), Y.multiply(this.poseTarget.props["Head.quaternion"]), O.setFromQuaternion(Y);
|
|
10621
|
+
let h = O.x / (40 / 24), c = O.y / (9 / 4), u = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), m = Math.max(window.innerWidth - l, l), y = Math.max(window.innerHeight - r, r), g = this.convertRange(t, [r - y, r + y], [-0.3, 0.6]) - h + u, b = this.convertRange(e, [l - m, l + m], [-0.8, 0.8]) - c + d;
|
|
10622
10622
|
g = Math.min(0.6, Math.max(-0.3, g)), b = Math.min(0.8, Math.max(-0.8, b));
|
|
10623
|
-
let
|
|
10623
|
+
let I = (Math.random() - 0.5) / 4, f = (Math.random() - 0.5) / 4;
|
|
10624
10624
|
if (n) {
|
|
10625
|
-
let
|
|
10626
|
-
|
|
10627
|
-
const
|
|
10625
|
+
let v = this.animQueue.findIndex((A) => A.template.name === "lookat");
|
|
10626
|
+
v !== -1 && this.animQueue.splice(v, 1);
|
|
10627
|
+
const T = {
|
|
10628
10628
|
name: "lookat",
|
|
10629
10629
|
dt: [750, n],
|
|
10630
10630
|
vs: {
|
|
10631
|
-
bodyRotateX: [g +
|
|
10631
|
+
bodyRotateX: [g + I],
|
|
10632
10632
|
bodyRotateY: [b + f],
|
|
10633
|
-
eyesRotateX: [-3 *
|
|
10633
|
+
eyesRotateX: [-3 * I + 0.1],
|
|
10634
10634
|
eyesRotateY: [-5 * f],
|
|
10635
10635
|
browInnerUp: [[0, 0.7]],
|
|
10636
10636
|
mouthLeft: [[0, 0.7]],
|
|
@@ -10639,7 +10639,7 @@ class Dn {
|
|
|
10639
10639
|
headMove: [0]
|
|
10640
10640
|
}
|
|
10641
10641
|
};
|
|
10642
|
-
this.animQueue.push(this.animFactory(
|
|
10642
|
+
this.animQueue.push(this.animFactory(T));
|
|
10643
10643
|
}
|
|
10644
10644
|
}
|
|
10645
10645
|
/**
|
|
@@ -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,
|
|
11013
|
-
const
|
|
11014
|
-
|
|
11011
|
+
let I = !1;
|
|
11012
|
+
for (let f = 0, v = y.length; f < v; f++) {
|
|
11013
|
+
const T = y[f].bone;
|
|
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
11015
|
let A = s.dot(a);
|
|
11016
|
-
A > 1 ? A = 1 : A < -1 && (A = -1), A = Math.acos(A), !(A < 1e-5) && (y[f].minAngle !== void 0 && A < y[f].minAngle && (A = y[f].minAngle), y[f].maxAngle !== void 0 && A > y[f].maxAngle && (A = y[f].maxAngle), c.crossVectors(a, s), c.normalize(),
|
|
11016
|
+
A > 1 ? A = 1 : A < -1 && (A = -1), A = Math.acos(A), !(A < 1e-5) && (y[f].minAngle !== void 0 && A < y[f].minAngle && (A = y[f].minAngle), y[f].maxAngle !== void 0 && A > y[f].maxAngle && (A = y[f].maxAngle), c.crossVectors(a, s), c.normalize(), Y.setFromAxisAngle(c, A), T.quaternion.multiply(Y), 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
|
-
))),
|
|
11024
|
+
))), T.updateMatrixWorld(!0), I = !0);
|
|
11025
11025
|
}
|
|
11026
|
-
if (!
|
|
11026
|
+
if (!I) 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;
|
|
@@ -11036,7 +11036,7 @@ class Dn {
|
|
|
11036
11036
|
this.isRunning = !1, this.stop(), this.stopSpeaking(), this.streamStop(), this.isAvatarOnly ? this.armature && (this.armature.parent && this.armature.parent.remove(this.armature), this.clearThree(this.armature)) : (this.clearThree(this.scene), this.resizeobserver.disconnect(), this.renderer && (this.renderer.dispose(), this.renderer.domElement && this.renderer.domElement.parentNode && this.renderer.domElement.parentNode.removeChild(this.renderer.domElement), this.renderer = null)), this.clearThree(this.ikMesh), this.dynamicbones.dispose();
|
|
11037
11037
|
}
|
|
11038
11038
|
}
|
|
11039
|
-
const
|
|
11039
|
+
const We = {
|
|
11040
11040
|
apiKey: "sk_ace57ef3ef65a92b9d3bee2a00183b78ca790bc3e10964f2",
|
|
11041
11041
|
// Replace with your actual API key (should start with sk_)
|
|
11042
11042
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
@@ -11060,13 +11060,13 @@ const Ue = {
|
|
|
11060
11060
|
function Wt() {
|
|
11061
11061
|
return {
|
|
11062
11062
|
service: "elevenlabs",
|
|
11063
|
-
endpoint:
|
|
11064
|
-
apiKey:
|
|
11065
|
-
defaultVoice:
|
|
11066
|
-
voices:
|
|
11063
|
+
endpoint: We.endpoint,
|
|
11064
|
+
apiKey: We.apiKey,
|
|
11065
|
+
defaultVoice: We.defaultVoice,
|
|
11066
|
+
voices: We.voices
|
|
11067
11067
|
};
|
|
11068
11068
|
}
|
|
11069
|
-
function
|
|
11069
|
+
function Ro() {
|
|
11070
11070
|
const p = Wt(), e = [];
|
|
11071
11071
|
return Object.entries(p.voices).forEach(([t, n]) => {
|
|
11072
11072
|
e.push({
|
|
@@ -11097,210 +11097,210 @@ const On = Ut(({
|
|
|
11097
11097
|
style: y = {},
|
|
11098
11098
|
animations: g = {}
|
|
11099
11099
|
}, b) => {
|
|
11100
|
-
const
|
|
11101
|
-
let
|
|
11102
|
-
L === "browser" ?
|
|
11100
|
+
const I = de(null), f = de(null), [v, T] = Xe(!0), [A, z] = Xe(null), [M, D] = Xe(!1), U = Wt(), L = i || U.service;
|
|
11101
|
+
let F;
|
|
11102
|
+
L === "browser" ? F = {
|
|
11103
11103
|
service: "browser",
|
|
11104
11104
|
endpoint: "",
|
|
11105
11105
|
apiKey: null,
|
|
11106
11106
|
defaultVoice: "Google US English"
|
|
11107
|
-
} : L === "elevenlabs" ?
|
|
11107
|
+
} : L === "elevenlabs" ? F = {
|
|
11108
11108
|
service: "elevenlabs",
|
|
11109
11109
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
11110
|
-
apiKey: o ||
|
|
11111
|
-
defaultVoice: s ||
|
|
11112
|
-
voices:
|
|
11113
|
-
} :
|
|
11114
|
-
...
|
|
11110
|
+
apiKey: o || U.apiKey,
|
|
11111
|
+
defaultVoice: s || U.defaultVoice || We.defaultVoice,
|
|
11112
|
+
voices: U.voices || We.voices
|
|
11113
|
+
} : F = {
|
|
11114
|
+
...U,
|
|
11115
11115
|
// Override API key if provided via props
|
|
11116
|
-
apiKey: o !== null ? o :
|
|
11116
|
+
apiKey: o !== null ? o : U.apiKey
|
|
11117
11117
|
};
|
|
11118
|
-
const
|
|
11118
|
+
const X = {
|
|
11119
11119
|
url: p,
|
|
11120
11120
|
body: e,
|
|
11121
11121
|
avatarMood: t,
|
|
11122
11122
|
ttsLang: L === "browser" ? "en-US" : n,
|
|
11123
|
-
ttsVoice: s ||
|
|
11123
|
+
ttsVoice: s || F.defaultVoice,
|
|
11124
11124
|
lipsyncLang: "en",
|
|
11125
11125
|
showFullAvatar: r,
|
|
11126
11126
|
bodyMovement: a,
|
|
11127
11127
|
movementIntensity: l
|
|
11128
|
-
},
|
|
11129
|
-
ttsEndpoint:
|
|
11130
|
-
ttsApikey:
|
|
11128
|
+
}, K = {
|
|
11129
|
+
ttsEndpoint: F.endpoint,
|
|
11130
|
+
ttsApikey: F.apiKey,
|
|
11131
11131
|
ttsService: L,
|
|
11132
11132
|
lipsyncModules: ["en"],
|
|
11133
11133
|
cameraView: h
|
|
11134
|
-
},
|
|
11135
|
-
if (!(!
|
|
11134
|
+
}, oe = B(async () => {
|
|
11135
|
+
if (!(!I.current || f.current))
|
|
11136
11136
|
try {
|
|
11137
|
-
if (
|
|
11138
|
-
if (
|
|
11139
|
-
const
|
|
11140
|
-
u(
|
|
11137
|
+
if (T(!0), z(null), f.current = new Dn(I.current, K), 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(X, (Z) => {
|
|
11138
|
+
if (Z.lengthComputable) {
|
|
11139
|
+
const W = Math.min(100, Math.round(Z.loaded / Z.total * 100));
|
|
11140
|
+
u(W);
|
|
11141
11141
|
}
|
|
11142
|
-
}), await new Promise((
|
|
11143
|
-
const
|
|
11144
|
-
f.current.lipsync && Object.keys(f.current.lipsync).length > 0 ?
|
|
11142
|
+
}), await new Promise((Z) => {
|
|
11143
|
+
const W = () => {
|
|
11144
|
+
f.current.lipsync && Object.keys(f.current.lipsync).length > 0 ? Z() : setTimeout(W, 100);
|
|
11145
11145
|
};
|
|
11146
|
-
|
|
11146
|
+
W();
|
|
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 (Z) {
|
|
11151
|
+
console.warn("Error setting full body mode on initialization:", Z);
|
|
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()),
|
|
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), D(!0), c(f.current);
|
|
11154
11154
|
const j = () => {
|
|
11155
11155
|
document.visibilityState === "visible" ? f.current?.start() : f.current?.stop();
|
|
11156
11156
|
};
|
|
11157
11157
|
return document.addEventListener("visibilitychange", j), () => {
|
|
11158
11158
|
document.removeEventListener("visibilitychange", j);
|
|
11159
11159
|
};
|
|
11160
|
-
} catch (
|
|
11161
|
-
console.error("Error initializing TalkingHead:",
|
|
11160
|
+
} catch (C) {
|
|
11161
|
+
console.error("Error initializing TalkingHead:", C), z(C.message || "Failed to initialize avatar"), T(!1), d(C);
|
|
11162
11162
|
}
|
|
11163
11163
|
}, [p, e, t, n, i, s, o, r, a, l, h]);
|
|
11164
|
-
|
|
11164
|
+
gt(() => (oe(), () => {
|
|
11165
11165
|
f.current && (f.current.stop(), f.current.dispose(), f.current = null);
|
|
11166
|
-
}), [
|
|
11167
|
-
if (!
|
|
11168
|
-
const
|
|
11169
|
-
for (const
|
|
11166
|
+
}), [oe]), gt(() => {
|
|
11167
|
+
if (!I.current || !f.current) return;
|
|
11168
|
+
const C = new ResizeObserver((Z) => {
|
|
11169
|
+
for (const W of Z)
|
|
11170
11170
|
f.current && f.current.onResize && f.current.onResize();
|
|
11171
11171
|
});
|
|
11172
|
-
|
|
11172
|
+
C.observe(I.current);
|
|
11173
11173
|
const j = () => {
|
|
11174
11174
|
f.current && f.current.onResize && f.current.onResize();
|
|
11175
11175
|
};
|
|
11176
11176
|
return window.addEventListener("resize", j), () => {
|
|
11177
|
-
|
|
11177
|
+
C.disconnect(), window.removeEventListener("resize", j);
|
|
11178
11178
|
};
|
|
11179
|
-
}, [
|
|
11180
|
-
const
|
|
11179
|
+
}, [M]);
|
|
11180
|
+
const J = B(async () => {
|
|
11181
11181
|
if (f.current && f.current.audioCtx)
|
|
11182
11182
|
try {
|
|
11183
11183
|
(f.current.audioCtx.state === "suspended" || f.current.audioCtx.state === "interrupted") && (await f.current.audioCtx.resume(), console.log("Audio context resumed"));
|
|
11184
|
-
} catch (
|
|
11185
|
-
console.warn("Failed to resume audio context:",
|
|
11184
|
+
} catch (C) {
|
|
11185
|
+
console.warn("Failed to resume audio context:", C);
|
|
11186
11186
|
}
|
|
11187
|
-
}, []),
|
|
11188
|
-
if (f.current &&
|
|
11187
|
+
}, []), Le = B(async (C, j = {}) => {
|
|
11188
|
+
if (f.current && M)
|
|
11189
11189
|
try {
|
|
11190
|
-
await
|
|
11191
|
-
const
|
|
11190
|
+
await J();
|
|
11191
|
+
const Z = {
|
|
11192
11192
|
...j,
|
|
11193
|
-
lipsyncLang: j.lipsyncLang ||
|
|
11193
|
+
lipsyncLang: j.lipsyncLang || X.lipsyncLang || "en"
|
|
11194
11194
|
};
|
|
11195
11195
|
if (j.onSpeechEnd && f.current) {
|
|
11196
|
-
const
|
|
11197
|
-
let
|
|
11198
|
-
const Rt = 600,
|
|
11199
|
-
if (
|
|
11200
|
-
|
|
11196
|
+
const W = f.current, we = W.onAudioEnd;
|
|
11197
|
+
let re = null, Oe = 0;
|
|
11198
|
+
const Rt = 600, ct = () => {
|
|
11199
|
+
if (Oe++, Oe > Rt) {
|
|
11200
|
+
re && (clearInterval(re), re = null);
|
|
11201
11201
|
try {
|
|
11202
11202
|
j.onSpeechEnd();
|
|
11203
|
-
} catch (
|
|
11204
|
-
console.error("Error in onSpeechEnd callback:",
|
|
11203
|
+
} catch (_e) {
|
|
11204
|
+
console.error("Error in onSpeechEnd callback:", _e);
|
|
11205
11205
|
}
|
|
11206
11206
|
return;
|
|
11207
11207
|
}
|
|
11208
|
-
|
|
11208
|
+
W && (!W.isSpeaking || W.isSpeaking === !1) && (!W.audioPlaylist || W.audioPlaylist.length === 0) && (!W.isAudioPlaying || W.isAudioPlaying === !1) && (re && (clearInterval(re), re = null), setTimeout(() => {
|
|
11209
11209
|
try {
|
|
11210
11210
|
j.onSpeechEnd();
|
|
11211
|
-
} catch (
|
|
11212
|
-
console.error("Error in onSpeechEnd callback:",
|
|
11211
|
+
} catch (_e) {
|
|
11212
|
+
console.error("Error in onSpeechEnd callback:", _e);
|
|
11213
11213
|
}
|
|
11214
11214
|
}, 100));
|
|
11215
11215
|
};
|
|
11216
11216
|
setTimeout(() => {
|
|
11217
|
-
|
|
11217
|
+
re = setInterval(ct, 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(C, Z)) : setTimeout(async () => {
|
|
11221
|
+
await J(), f.current && f.current.lipsync && (f.current.setSlowdownRate && f.current.setSlowdownRate(1.05), f.current.speakText(C, Z));
|
|
11222
11222
|
}, 500);
|
|
11223
|
-
} catch (
|
|
11224
|
-
console.error("Error speaking text:",
|
|
11223
|
+
} catch (Z) {
|
|
11224
|
+
console.error("Error speaking text:", Z), z(Z.message || "Failed to speak text");
|
|
11225
11225
|
}
|
|
11226
|
-
}, [
|
|
11226
|
+
}, [M, J, X.lipsyncLang]), S = B(() => {
|
|
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
|
+
}, []), w = B((C) => {
|
|
11229
|
+
f.current && f.current.setMood(C);
|
|
11230
|
+
}, []), $ = B((C) => {
|
|
11231
|
+
f.current && f.current.setSlowdownRate && f.current.setSlowdownRate(C);
|
|
11232
|
+
}, []), ke = B((C, j = !1) => {
|
|
11233
11233
|
if (f.current && f.current.playAnimation) {
|
|
11234
|
-
if (g && g[
|
|
11234
|
+
if (g && g[C] && (C = g[C]), f.current.setShowFullAvatar)
|
|
11235
11235
|
try {
|
|
11236
11236
|
f.current.setShowFullAvatar(!0);
|
|
11237
|
-
} catch (
|
|
11238
|
-
console.warn("Error setting full body mode:",
|
|
11237
|
+
} catch (W) {
|
|
11238
|
+
console.warn("Error setting full body mode:", W);
|
|
11239
11239
|
}
|
|
11240
|
-
if (
|
|
11240
|
+
if (C.includes("."))
|
|
11241
11241
|
try {
|
|
11242
|
-
f.current.playAnimation(
|
|
11243
|
-
} catch (
|
|
11244
|
-
console.warn(`Failed to play ${
|
|
11242
|
+
f.current.playAnimation(C, null, 10, 0, 0.01, j);
|
|
11243
|
+
} catch (W) {
|
|
11244
|
+
console.warn(`Failed to play ${C}:`, W);
|
|
11245
11245
|
try {
|
|
11246
11246
|
f.current.setBodyMovement("idle");
|
|
11247
|
-
} catch (
|
|
11248
|
-
console.warn("Fallback animation also failed:",
|
|
11247
|
+
} catch (we) {
|
|
11248
|
+
console.warn("Fallback animation also failed:", we);
|
|
11249
11249
|
}
|
|
11250
11250
|
}
|
|
11251
11251
|
else {
|
|
11252
|
-
const
|
|
11253
|
-
let
|
|
11254
|
-
for (const
|
|
11252
|
+
const W = [".fbx", ".glb", ".gltf"];
|
|
11253
|
+
let we = !1;
|
|
11254
|
+
for (const re of W)
|
|
11255
11255
|
try {
|
|
11256
|
-
f.current.playAnimation(
|
|
11256
|
+
f.current.playAnimation(C + re, null, 10, 0, 0.01, j), we = !0;
|
|
11257
11257
|
break;
|
|
11258
11258
|
} catch {
|
|
11259
11259
|
}
|
|
11260
|
-
if (!
|
|
11261
|
-
console.warn("Animation not found:",
|
|
11260
|
+
if (!we) {
|
|
11261
|
+
console.warn("Animation not found:", C);
|
|
11262
11262
|
try {
|
|
11263
11263
|
f.current.setBodyMovement("idle");
|
|
11264
|
-
} catch (
|
|
11265
|
-
console.warn("Fallback animation also failed:",
|
|
11264
|
+
} catch (re) {
|
|
11265
|
+
console.warn("Fallback animation also failed:", re);
|
|
11266
11266
|
}
|
|
11267
11267
|
}
|
|
11268
11268
|
}
|
|
11269
11269
|
}
|
|
11270
|
-
}, [g]),
|
|
11270
|
+
}, [g]), Ce = B(() => {
|
|
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: Le,
|
|
11275
|
+
stopSpeaking: S,
|
|
11276
|
+
resumeAudioContext: J,
|
|
11277
|
+
setMood: w,
|
|
11278
|
+
setTimingAdjustment: $,
|
|
11279
|
+
playAnimation: ke,
|
|
11280
|
+
isReady: M,
|
|
11281
11281
|
talkingHead: f.current,
|
|
11282
|
-
handleResize:
|
|
11283
|
-
setBodyMovement: (
|
|
11282
|
+
handleResize: Ce,
|
|
11283
|
+
setBodyMovement: (C) => {
|
|
11284
11284
|
if (f.current && f.current.setShowFullAvatar && f.current.setBodyMovement)
|
|
11285
11285
|
try {
|
|
11286
|
-
f.current.setShowFullAvatar(!0), f.current.setBodyMovement(
|
|
11286
|
+
f.current.setShowFullAvatar(!0), f.current.setBodyMovement(C);
|
|
11287
11287
|
} catch (j) {
|
|
11288
11288
|
console.warn("Error setting body movement:", j);
|
|
11289
11289
|
}
|
|
11290
11290
|
},
|
|
11291
|
-
setMovementIntensity: (
|
|
11291
|
+
setMovementIntensity: (C) => f.current?.setMovementIntensity(C),
|
|
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 (C) {
|
|
11297
|
+
console.warn("Error playing random dance:", C);
|
|
11298
11298
|
}
|
|
11299
11299
|
},
|
|
11300
|
-
playReaction: (
|
|
11300
|
+
playReaction: (C) => {
|
|
11301
11301
|
if (f.current && f.current.setShowFullAvatar && f.current.playReaction)
|
|
11302
11302
|
try {
|
|
11303
|
-
f.current.setShowFullAvatar(!0), f.current.playReaction(
|
|
11303
|
+
f.current.setShowFullAvatar(!0), f.current.playReaction(C);
|
|
11304
11304
|
} catch (j) {
|
|
11305
11305
|
console.warn("Error playing reaction:", j);
|
|
11306
11306
|
}
|
|
@@ -11309,14 +11309,14 @@ const On = Ut(({
|
|
|
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 (C) {
|
|
11313
|
+
console.warn("Error playing celebration:", C);
|
|
11314
11314
|
}
|
|
11315
11315
|
},
|
|
11316
|
-
setShowFullAvatar: (
|
|
11316
|
+
setShowFullAvatar: (C) => {
|
|
11317
11317
|
if (f.current && f.current.setShowFullAvatar)
|
|
11318
11318
|
try {
|
|
11319
|
-
f.current.setShowFullAvatar(
|
|
11319
|
+
f.current.setShowFullAvatar(C);
|
|
11320
11320
|
} catch (j) {
|
|
11321
11321
|
console.warn("Error setting showFullAvatar:", j);
|
|
11322
11322
|
}
|
|
@@ -11325,16 +11325,16 @@ const On = Ut(({
|
|
|
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 (C) {
|
|
11329
|
+
console.warn("Error locking avatar position:", C);
|
|
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 (C) {
|
|
11337
|
+
console.warn("Error unlocking avatar position:", C);
|
|
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__ */ He(
|
|
11352
11352
|
"div",
|
|
11353
11353
|
{
|
|
11354
|
-
ref:
|
|
11354
|
+
ref: I,
|
|
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
|
+
v && /* @__PURE__ */ He("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
|
-
A && /* @__PURE__ */
|
|
11372
|
+
A && /* @__PURE__ */ He("div", { className: "error-overlay", style: {
|
|
11373
11373
|
position: "absolute",
|
|
11374
11374
|
top: "50%",
|
|
11375
11375
|
left: "50%",
|
|
@@ -11386,7 +11386,7 @@ const On = Ut(({
|
|
|
11386
11386
|
);
|
|
11387
11387
|
});
|
|
11388
11388
|
On.displayName = "TalkingHeadAvatar";
|
|
11389
|
-
const
|
|
11389
|
+
const fo = Ut(({
|
|
11390
11390
|
text: p = "Hello! I'm a talking avatar. How are you today?",
|
|
11391
11391
|
onLoading: e = () => {
|
|
11392
11392
|
},
|
|
@@ -11398,7 +11398,7 @@ const mo = Ut(({
|
|
|
11398
11398
|
style: s = {},
|
|
11399
11399
|
avatarConfig: o = {}
|
|
11400
11400
|
}, a) => {
|
|
11401
|
-
const l =
|
|
11401
|
+
const l = de(null), r = de(null), [h, c] = Xe(!0), [u, d] = Xe(null), [m, y] = Xe(!1), g = Wt(), b = o.ttsService || g.service, I = b === "browser" ? {
|
|
11402
11402
|
endpoint: "",
|
|
11403
11403
|
apiKey: null,
|
|
11404
11404
|
defaultVoice: "Google US English"
|
|
@@ -11414,7 +11414,7 @@ const mo = 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 || I.defaultVoice,
|
|
11418
11418
|
lipsyncLang: "en",
|
|
11419
11419
|
// English lip-sync
|
|
11420
11420
|
showFullAvatar: !0,
|
|
@@ -11422,103 +11422,103 @@ const mo = Ut(({
|
|
|
11422
11422
|
bodyMovement: "idle",
|
|
11423
11423
|
movementIntensity: 0.5,
|
|
11424
11424
|
...o
|
|
11425
|
-
},
|
|
11426
|
-
ttsEndpoint:
|
|
11427
|
-
ttsApikey:
|
|
11425
|
+
}, v = {
|
|
11426
|
+
ttsEndpoint: I.endpoint,
|
|
11427
|
+
ttsApikey: I.apiKey,
|
|
11428
11428
|
ttsService: b,
|
|
11429
11429
|
lipsyncModules: ["en"],
|
|
11430
11430
|
cameraView: "upper"
|
|
11431
|
-
},
|
|
11431
|
+
}, T = B(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, v), await r.current.showAvatar(f, (X) => {
|
|
11435
|
+
if (X.lengthComputable) {
|
|
11436
|
+
const K = Math.min(100, Math.round(X.loaded / X.total * 100));
|
|
11437
|
+
e(K);
|
|
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 X = r.current.morphs[0].morphTargetDictionary;
|
|
11441
|
+
console.log("Available morph targets:", Object.keys(X));
|
|
11442
|
+
const K = Object.keys(X).filter((oe) => oe.startsWith("viseme_"));
|
|
11443
|
+
console.log("Viseme morph targets found:", K), K.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((X) => {
|
|
11446
|
+
const K = () => {
|
|
11447
|
+
r.current.lipsync && Object.keys(r.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(r.current.lipsync)), X()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(K, 100));
|
|
11448
11448
|
};
|
|
11449
|
-
|
|
11449
|
+
K();
|
|
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 (X) {
|
|
11454
|
+
console.warn("Error setting full body mode on initialization:", X);
|
|
11455
11455
|
}
|
|
11456
11456
|
c(!1), y(!0), n(r.current);
|
|
11457
|
-
const
|
|
11457
|
+
const F = () => {
|
|
11458
11458
|
document.visibilityState === "visible" ? r.current?.start() : r.current?.stop();
|
|
11459
11459
|
};
|
|
11460
|
-
return document.addEventListener("visibilitychange",
|
|
11461
|
-
document.removeEventListener("visibilitychange",
|
|
11460
|
+
return document.addEventListener("visibilitychange", F), () => {
|
|
11461
|
+
document.removeEventListener("visibilitychange", F);
|
|
11462
11462
|
};
|
|
11463
11463
|
} catch (L) {
|
|
11464
11464
|
console.error("Error initializing TalkingHead:", L), d(L.message || "Failed to initialize avatar"), c(!1), t(L);
|
|
11465
11465
|
}
|
|
11466
11466
|
}, []);
|
|
11467
|
-
|
|
11467
|
+
gt(() => (T(), () => {
|
|
11468
11468
|
r.current && (r.current.stop(), r.current.dispose(), r.current = null);
|
|
11469
|
-
}), [
|
|
11470
|
-
const A =
|
|
11469
|
+
}), [T]);
|
|
11470
|
+
const A = B((L) => {
|
|
11471
11471
|
if (r.current && m)
|
|
11472
11472
|
try {
|
|
11473
11473
|
console.log("Speaking text:", L), console.log("Avatar config:", f), console.log("TalkingHead instance:", r.current), r.current.lipsync && Object.keys(r.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(r.current.lipsync)), r.current.setSlowdownRate && (r.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), r.current.speakText(L)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
|
|
11474
11474
|
r.current && r.current.lipsync ? (console.log("Lip-sync now ready, speaking..."), r.current.setSlowdownRate && (r.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), r.current.speakText(L)) : console.error("Lip-sync still not ready after waiting");
|
|
11475
11475
|
}, 500));
|
|
11476
|
-
} catch (
|
|
11477
|
-
console.error("Error speaking text:",
|
|
11476
|
+
} catch (F) {
|
|
11477
|
+
console.error("Error speaking text:", F), d(F.message || "Failed to speak text");
|
|
11478
11478
|
}
|
|
11479
11479
|
else
|
|
11480
11480
|
console.warn("Avatar not ready for speaking. isReady:", m, "talkingHeadRef:", !!r.current);
|
|
11481
|
-
}, [m, f]), z =
|
|
11481
|
+
}, [m, f]), z = B(() => {
|
|
11482
11482
|
r.current && (r.current.stopSpeaking(), r.current.setSlowdownRate && (r.current.setSlowdownRate(1), console.log("Reset timing to normal")));
|
|
11483
|
-
}, []),
|
|
11483
|
+
}, []), M = B((L) => {
|
|
11484
11484
|
r.current && r.current.setMood(L);
|
|
11485
|
-
}, []),
|
|
11485
|
+
}, []), D = B((L) => {
|
|
11486
11486
|
r.current && r.current.setSlowdownRate && (r.current.setSlowdownRate(L), console.log("Timing adjustment set to:", L));
|
|
11487
|
-
}, []),
|
|
11487
|
+
}, []), U = B((L, F = !1) => {
|
|
11488
11488
|
if (r.current && r.current.playAnimation) {
|
|
11489
11489
|
if (r.current.setShowFullAvatar)
|
|
11490
11490
|
try {
|
|
11491
11491
|
r.current.setShowFullAvatar(!0);
|
|
11492
|
-
} catch (
|
|
11493
|
-
console.warn("Error setting full body mode:",
|
|
11492
|
+
} catch (K) {
|
|
11493
|
+
console.warn("Error setting full body mode:", K);
|
|
11494
11494
|
}
|
|
11495
11495
|
if (L.includes("."))
|
|
11496
11496
|
try {
|
|
11497
|
-
r.current.playAnimation(L, null, 10, 0, 0.01,
|
|
11498
|
-
} catch (
|
|
11499
|
-
console.log(`Failed to play ${L}:`,
|
|
11497
|
+
r.current.playAnimation(L, null, 10, 0, 0.01, F), console.log("Playing animation:", L);
|
|
11498
|
+
} catch (K) {
|
|
11499
|
+
console.log(`Failed to play ${L}:`, K);
|
|
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 (oe) {
|
|
11503
|
+
console.warn("Fallback animation also failed:", oe);
|
|
11504
11504
|
}
|
|
11505
11505
|
}
|
|
11506
11506
|
else {
|
|
11507
|
-
const
|
|
11508
|
-
let
|
|
11509
|
-
for (const
|
|
11507
|
+
const K = [".fbx", ".glb", ".gltf"];
|
|
11508
|
+
let oe = !1;
|
|
11509
|
+
for (const J of K)
|
|
11510
11510
|
try {
|
|
11511
|
-
r.current.playAnimation(L +
|
|
11511
|
+
r.current.playAnimation(L + J, null, 10, 0, 0.01, F), console.log("Playing animation:", L + J), oe = !0;
|
|
11512
11512
|
break;
|
|
11513
11513
|
} catch {
|
|
11514
|
-
console.log(`Failed to play ${L}${
|
|
11514
|
+
console.log(`Failed to play ${L}${J}, trying next format...`);
|
|
11515
11515
|
}
|
|
11516
|
-
if (!
|
|
11516
|
+
if (!oe) {
|
|
11517
11517
|
console.warn("Animation system not available or animation not found:", L);
|
|
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 (J) {
|
|
11521
|
+
console.warn("Fallback animation also failed:", J);
|
|
11522
11522
|
}
|
|
11523
11523
|
}
|
|
11524
11524
|
}
|
|
@@ -11528,17 +11528,17 @@ const mo = Ut(({
|
|
|
11528
11528
|
return Gt(a, () => ({
|
|
11529
11529
|
speakText: A,
|
|
11530
11530
|
stopSpeaking: z,
|
|
11531
|
-
setMood:
|
|
11532
|
-
setTimingAdjustment:
|
|
11533
|
-
playAnimation:
|
|
11531
|
+
setMood: M,
|
|
11532
|
+
setTimingAdjustment: D,
|
|
11533
|
+
playAnimation: U,
|
|
11534
11534
|
isReady: m,
|
|
11535
11535
|
talkingHead: r.current,
|
|
11536
11536
|
setBodyMovement: (L) => {
|
|
11537
11537
|
if (r.current && r.current.setShowFullAvatar && r.current.setBodyMovement)
|
|
11538
11538
|
try {
|
|
11539
11539
|
r.current.setShowFullAvatar(!0), r.current.setBodyMovement(L), console.log("Body movement set with full body mode:", L);
|
|
11540
|
-
} catch (
|
|
11541
|
-
console.warn("Error setting body movement:",
|
|
11540
|
+
} catch (F) {
|
|
11541
|
+
console.warn("Error setting body movement:", F);
|
|
11542
11542
|
}
|
|
11543
11543
|
},
|
|
11544
11544
|
setMovementIntensity: (L) => r.current?.setMovementIntensity(L),
|
|
@@ -11554,8 +11554,8 @@ const mo = Ut(({
|
|
|
11554
11554
|
if (r.current && r.current.setShowFullAvatar && r.current.playReaction)
|
|
11555
11555
|
try {
|
|
11556
11556
|
r.current.setShowFullAvatar(!0), r.current.playReaction(L), console.log("Reaction played with full body mode:", L);
|
|
11557
|
-
} catch (
|
|
11558
|
-
console.warn("Error playing reaction:",
|
|
11557
|
+
} catch (F) {
|
|
11558
|
+
console.warn("Error playing reaction:", F);
|
|
11559
11559
|
}
|
|
11560
11560
|
},
|
|
11561
11561
|
playCelebration: () => {
|
|
@@ -11570,8 +11570,8 @@ const mo = Ut(({
|
|
|
11570
11570
|
if (r.current && r.current.setShowFullAvatar)
|
|
11571
11571
|
try {
|
|
11572
11572
|
r.current.setShowFullAvatar(L), console.log("Show full avatar set to:", L);
|
|
11573
|
-
} catch (
|
|
11574
|
-
console.warn("Error setting showFullAvatar:",
|
|
11573
|
+
} catch (F) {
|
|
11574
|
+
console.warn("Error setting showFullAvatar:", F);
|
|
11575
11575
|
}
|
|
11576
11576
|
},
|
|
11577
11577
|
lockAvatarPosition: () => {
|
|
@@ -11591,7 +11591,7 @@ const mo = Ut(({
|
|
|
11591
11591
|
}
|
|
11592
11592
|
}
|
|
11593
11593
|
})), /* @__PURE__ */ rn("div", { className: `talking-head-container ${i}`, style: s, children: [
|
|
11594
|
-
/* @__PURE__ */
|
|
11594
|
+
/* @__PURE__ */ He(
|
|
11595
11595
|
"div",
|
|
11596
11596
|
{
|
|
11597
11597
|
ref: l,
|
|
@@ -11603,7 +11603,7 @@ const mo = Ut(({
|
|
|
11603
11603
|
}
|
|
11604
11604
|
}
|
|
11605
11605
|
),
|
|
11606
|
-
h && /* @__PURE__ */
|
|
11606
|
+
h && /* @__PURE__ */ He("div", { className: "loading-overlay", style: {
|
|
11607
11607
|
position: "absolute",
|
|
11608
11608
|
top: "50%",
|
|
11609
11609
|
left: "50%",
|
|
@@ -11612,7 +11612,7 @@ const mo = Ut(({
|
|
|
11612
11612
|
fontSize: "18px",
|
|
11613
11613
|
zIndex: 10
|
|
11614
11614
|
}, children: "Loading avatar..." }),
|
|
11615
|
-
u && /* @__PURE__ */
|
|
11615
|
+
u && /* @__PURE__ */ He("div", { className: "error-overlay", style: {
|
|
11616
11616
|
position: "absolute",
|
|
11617
11617
|
top: "50%",
|
|
11618
11618
|
left: "50%",
|
|
@@ -11626,8 +11626,8 @@ const mo = Ut(({
|
|
|
11626
11626
|
}, children: u })
|
|
11627
11627
|
] });
|
|
11628
11628
|
});
|
|
11629
|
-
|
|
11630
|
-
const
|
|
11629
|
+
fo.displayName = "TalkingHeadComponent";
|
|
11630
|
+
const go = Ut(({
|
|
11631
11631
|
curriculumData: p = null,
|
|
11632
11632
|
avatarConfig: e = {},
|
|
11633
11633
|
animations: t = {},
|
|
@@ -11643,7 +11643,7 @@ const fo = Ut(({
|
|
|
11643
11643
|
},
|
|
11644
11644
|
autoStart: l = !1
|
|
11645
11645
|
}, r) => {
|
|
11646
|
-
const h =
|
|
11646
|
+
const h = de(null), c = de({
|
|
11647
11647
|
currentModuleIndex: 0,
|
|
11648
11648
|
currentLessonIndex: 0,
|
|
11649
11649
|
currentQuestionIndex: 0,
|
|
@@ -11653,14 +11653,14 @@ const fo = Ut(({
|
|
|
11653
11653
|
curriculumCompleted: !1,
|
|
11654
11654
|
score: 0,
|
|
11655
11655
|
totalQuestions: 0
|
|
11656
|
-
}), u =
|
|
11656
|
+
}), u = de({
|
|
11657
11657
|
onLessonStart: n,
|
|
11658
11658
|
onLessonComplete: i,
|
|
11659
11659
|
onQuestionAnswer: s,
|
|
11660
11660
|
onCurriculumComplete: o,
|
|
11661
11661
|
onCustomAction: a
|
|
11662
|
-
}), d =
|
|
11663
|
-
|
|
11662
|
+
}), d = de(null), m = de(null), y = de(null), g = de(null), b = de(null), I = de(null);
|
|
11663
|
+
gt(() => {
|
|
11664
11664
|
u.current = {
|
|
11665
11665
|
onLessonStart: n,
|
|
11666
11666
|
onLessonComplete: i,
|
|
@@ -11669,12 +11669,12 @@ const fo = Ut(({
|
|
|
11669
11669
|
onCustomAction: a
|
|
11670
11670
|
};
|
|
11671
11671
|
}, [n, i, s, o, a]);
|
|
11672
|
-
const
|
|
11672
|
+
const f = p?.curriculum || {
|
|
11673
11673
|
title: "Default Curriculum",
|
|
11674
11674
|
description: "No curriculum data provided",
|
|
11675
11675
|
language: "en",
|
|
11676
11676
|
modules: []
|
|
11677
|
-
},
|
|
11677
|
+
}, v = {
|
|
11678
11678
|
avatarUrl: e.avatarUrl || "/avatars/brunette.glb",
|
|
11679
11679
|
avatarBody: e.avatarBody || "F",
|
|
11680
11680
|
mood: e.mood || "happy",
|
|
@@ -11690,23 +11690,23 @@ const fo = Ut(({
|
|
|
11690
11690
|
animations: t,
|
|
11691
11691
|
lipsyncLang: "en"
|
|
11692
11692
|
// Default lipsync language
|
|
11693
|
-
},
|
|
11693
|
+
}, T = B(() => f.modules[c.current.currentModuleIndex]?.lessons[c.current.currentLessonIndex], [f]), A = B(() => T()?.questions[c.current.currentQuestionIndex], [T]), z = B((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, []), M = B(() => {
|
|
11694
11694
|
c.current.lessonCompleted = !0, c.current.isQuestionMode = !1;
|
|
11695
|
-
const
|
|
11696
|
-
let
|
|
11697
|
-
if (c.current.totalQuestions > 0 ?
|
|
11695
|
+
const S = c.current.totalQuestions > 0 ? Math.round(c.current.score / c.current.totalQuestions * 100) : 100;
|
|
11696
|
+
let w = "Congratulations! You've completed this lesson";
|
|
11697
|
+
if (c.current.totalQuestions > 0 ? w += ` with a score of ${c.current.score} out of ${c.current.totalQuestions} (${S}%). ` : w += "! ", S >= 80 ? w += "Excellent work! You have a great understanding of this topic." : S >= 60 ? w += "Good job! You understand most of the concepts." : w += "Keep practicing! You're making progress.", u.current.onLessonComplete({
|
|
11698
11698
|
moduleIndex: c.current.currentModuleIndex,
|
|
11699
11699
|
lessonIndex: c.current.currentLessonIndex,
|
|
11700
11700
|
score: c.current.score,
|
|
11701
11701
|
totalQuestions: c.current.totalQuestions,
|
|
11702
|
-
percentage:
|
|
11702
|
+
percentage: S
|
|
11703
11703
|
}), u.current.onCustomAction({
|
|
11704
11704
|
type: "lessonComplete",
|
|
11705
11705
|
moduleIndex: c.current.currentModuleIndex,
|
|
11706
11706
|
lessonIndex: c.current.currentLessonIndex,
|
|
11707
11707
|
score: c.current.score,
|
|
11708
11708
|
totalQuestions: c.current.totalQuestions,
|
|
11709
|
-
percentage:
|
|
11709
|
+
percentage: S
|
|
11710
11710
|
}), h.current) {
|
|
11711
11711
|
if (h.current.setMood("happy"), t.lessonComplete)
|
|
11712
11712
|
try {
|
|
@@ -11714,27 +11714,27 @@ const fo = Ut(({
|
|
|
11714
11714
|
} catch {
|
|
11715
11715
|
h.current.playCelebration();
|
|
11716
11716
|
}
|
|
11717
|
-
const
|
|
11718
|
-
c.current.currentLessonIndex < (
|
|
11719
|
-
lipsyncLang:
|
|
11717
|
+
const $ = f.modules[c.current.currentModuleIndex];
|
|
11718
|
+
c.current.currentLessonIndex < ($?.lessons?.length || 0) - 1 ? h.current.speakText(w, {
|
|
11719
|
+
lipsyncLang: v.lipsyncLang,
|
|
11720
11720
|
onSpeechEnd: () => {
|
|
11721
11721
|
setTimeout(() => {
|
|
11722
11722
|
m.current && m.current();
|
|
11723
11723
|
}, 1e3);
|
|
11724
11724
|
}
|
|
11725
|
-
}) : h.current.speakText(
|
|
11726
|
-
lipsyncLang:
|
|
11725
|
+
}) : h.current.speakText(w, {
|
|
11726
|
+
lipsyncLang: v.lipsyncLang,
|
|
11727
11727
|
onSpeechEnd: () => {
|
|
11728
11728
|
setTimeout(() => {
|
|
11729
|
-
|
|
11729
|
+
b.current && b.current();
|
|
11730
11730
|
}, 1e3);
|
|
11731
11731
|
}
|
|
11732
11732
|
});
|
|
11733
11733
|
}
|
|
11734
|
-
}, [t.lessonComplete,
|
|
11734
|
+
}, [t.lessonComplete, f, v]), D = B(() => {
|
|
11735
11735
|
if (c.current.curriculumCompleted = !0, u.current.onCurriculumComplete({
|
|
11736
|
-
modules:
|
|
11737
|
-
totalLessons:
|
|
11736
|
+
modules: f.modules.length,
|
|
11737
|
+
totalLessons: f.modules.reduce((S, w) => S + w.lessons.length, 0)
|
|
11738
11738
|
}), h.current) {
|
|
11739
11739
|
if (h.current.setMood("celebrating"), t.curriculumComplete)
|
|
11740
11740
|
try {
|
|
@@ -11742,103 +11742,103 @@ const fo = Ut(({
|
|
|
11742
11742
|
} catch {
|
|
11743
11743
|
h.current.playCelebration();
|
|
11744
11744
|
}
|
|
11745
|
-
h.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang:
|
|
11745
|
+
h.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang: v.lipsyncLang });
|
|
11746
11746
|
}
|
|
11747
|
-
}, [t.curriculumComplete,
|
|
11748
|
-
const
|
|
11749
|
-
c.current.isQuestionMode = !0, c.current.currentQuestionIndex = 0, c.current.totalQuestions =
|
|
11750
|
-
const
|
|
11751
|
-
if (
|
|
11747
|
+
}, [t.curriculumComplete, f, v]), U = B(() => {
|
|
11748
|
+
const S = T();
|
|
11749
|
+
c.current.isQuestionMode = !0, c.current.currentQuestionIndex = 0, c.current.totalQuestions = S?.questions?.length || 0;
|
|
11750
|
+
const w = A();
|
|
11751
|
+
if (w && u.current.onCustomAction({
|
|
11752
11752
|
type: "questionStart",
|
|
11753
11753
|
moduleIndex: c.current.currentModuleIndex,
|
|
11754
11754
|
lessonIndex: c.current.currentLessonIndex,
|
|
11755
11755
|
questionIndex: c.current.currentQuestionIndex,
|
|
11756
11756
|
totalQuestions: c.current.totalQuestions,
|
|
11757
|
-
question:
|
|
11758
|
-
}), h.current &&
|
|
11757
|
+
question: w
|
|
11758
|
+
}), h.current && w) {
|
|
11759
11759
|
if (h.current.setMood("curious"), t.questionStart)
|
|
11760
11760
|
try {
|
|
11761
11761
|
h.current.playAnimation(t.questionStart, !0);
|
|
11762
|
-
} catch (
|
|
11763
|
-
console.warn("Failed to play questionStart animation:",
|
|
11762
|
+
} catch ($) {
|
|
11763
|
+
console.warn("Failed to play questionStart animation:", $);
|
|
11764
11764
|
}
|
|
11765
|
-
|
|
11766
|
-
} else h.current && h.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang:
|
|
11767
|
-
}, [t.questionStart,
|
|
11768
|
-
const
|
|
11769
|
-
if (c.current.currentQuestionIndex < (
|
|
11765
|
+
w.type === "code_test" ? h.current.speakText(`Let's test your coding skills! Here's your first challenge: ${w.question}`, { lipsyncLang: v.lipsyncLang }) : w.type === "multiple_choice" ? h.current.speakText(`Now let me ask you some questions. Here's the first one: ${w.question}`, { lipsyncLang: v.lipsyncLang }) : w.type === "true_false" ? h.current.speakText(`Let's start with some true or false questions. First question: ${w.question}`, { lipsyncLang: v.lipsyncLang }) : h.current.speakText(`Now let me ask you some questions. Here's the first one: ${w.question}`, { lipsyncLang: v.lipsyncLang });
|
|
11766
|
+
} else h.current && h.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: v.lipsyncLang });
|
|
11767
|
+
}, [t.questionStart, T, A, v]), L = B(() => {
|
|
11768
|
+
const S = T();
|
|
11769
|
+
if (c.current.currentQuestionIndex < (S?.questions?.length || 0) - 1) {
|
|
11770
11770
|
c.current.currentQuestionIndex += 1;
|
|
11771
|
-
const
|
|
11772
|
-
if (
|
|
11771
|
+
const w = A();
|
|
11772
|
+
if (w && u.current.onCustomAction({
|
|
11773
11773
|
type: "nextQuestion",
|
|
11774
11774
|
moduleIndex: c.current.currentModuleIndex,
|
|
11775
11775
|
lessonIndex: c.current.currentLessonIndex,
|
|
11776
11776
|
questionIndex: c.current.currentQuestionIndex,
|
|
11777
11777
|
totalQuestions: c.current.totalQuestions,
|
|
11778
|
-
question:
|
|
11779
|
-
}), h.current &&
|
|
11778
|
+
question: w
|
|
11779
|
+
}), h.current && w) {
|
|
11780
11780
|
if (h.current.setMood("happy"), h.current.setBodyMovement("idle"), t.nextQuestion)
|
|
11781
11781
|
try {
|
|
11782
11782
|
h.current.playAnimation(t.nextQuestion, !0);
|
|
11783
|
-
} catch (
|
|
11784
|
-
console.warn("Failed to play nextQuestion animation:",
|
|
11783
|
+
} catch ($) {
|
|
11784
|
+
console.warn("Failed to play nextQuestion animation:", $);
|
|
11785
11785
|
}
|
|
11786
|
-
|
|
11787
|
-
lipsyncLang:
|
|
11788
|
-
}) :
|
|
11789
|
-
lipsyncLang:
|
|
11790
|
-
}) :
|
|
11791
|
-
lipsyncLang:
|
|
11792
|
-
}) : h.current.speakText(`Here's the next question: ${
|
|
11793
|
-
lipsyncLang:
|
|
11786
|
+
w.type === "code_test" ? h.current.speakText(`Great! Now let's move on to your next coding challenge: ${w.question}`, {
|
|
11787
|
+
lipsyncLang: v.lipsyncLang
|
|
11788
|
+
}) : w.type === "multiple_choice" ? h.current.speakText(`Alright! Here's your next question: ${w.question}`, {
|
|
11789
|
+
lipsyncLang: v.lipsyncLang
|
|
11790
|
+
}) : w.type === "true_false" ? h.current.speakText(`Now let's try this one: ${w.question}`, {
|
|
11791
|
+
lipsyncLang: v.lipsyncLang
|
|
11792
|
+
}) : h.current.speakText(`Here's the next question: ${w.question}`, {
|
|
11793
|
+
lipsyncLang: v.lipsyncLang
|
|
11794
11794
|
});
|
|
11795
11795
|
}
|
|
11796
11796
|
} else
|
|
11797
|
-
|
|
11798
|
-
}, [t.nextQuestion,
|
|
11799
|
-
const
|
|
11800
|
-
c.current.currentLessonIndex < (
|
|
11797
|
+
y.current && y.current();
|
|
11798
|
+
}, [t.nextQuestion, T, A, v]), F = B(() => {
|
|
11799
|
+
const S = f.modules[c.current.currentModuleIndex];
|
|
11800
|
+
c.current.currentLessonIndex < (S?.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
11801
|
type: "lessonStart",
|
|
11802
11802
|
moduleIndex: c.current.currentModuleIndex,
|
|
11803
11803
|
lessonIndex: c.current.currentLessonIndex
|
|
11804
11804
|
}), h.current && (h.current.setMood("happy"), h.current.setBodyMovement("idle"), setTimeout(() => {
|
|
11805
11805
|
d.current && d.current();
|
|
11806
|
-
}, 500))) :
|
|
11807
|
-
}, [
|
|
11808
|
-
const
|
|
11809
|
-
if (h.current && h.current.isReady &&
|
|
11806
|
+
}, 500))) : b.current && b.current();
|
|
11807
|
+
}, [f]), X = B(() => {
|
|
11808
|
+
const S = T();
|
|
11809
|
+
if (h.current && h.current.isReady && S?.avatar_script) {
|
|
11810
11810
|
c.current.isTeaching = !0, c.current.isQuestionMode = !1, h.current.setMood("happy");
|
|
11811
|
-
let
|
|
11811
|
+
let w = !1;
|
|
11812
11812
|
if (t.teaching)
|
|
11813
11813
|
try {
|
|
11814
|
-
h.current.playAnimation(t.teaching, !0),
|
|
11815
|
-
} catch (
|
|
11816
|
-
console.warn("Failed to play teaching animation:",
|
|
11814
|
+
h.current.playAnimation(t.teaching, !0), w = !0;
|
|
11815
|
+
} catch ($) {
|
|
11816
|
+
console.warn("Failed to play teaching animation:", $);
|
|
11817
11817
|
}
|
|
11818
|
-
|
|
11818
|
+
w || h.current.setBodyMovement("gesturing"), h.current.speakText(S.avatar_script, { lipsyncLang: v.lipsyncLang }), u.current.onLessonStart({
|
|
11819
11819
|
moduleIndex: c.current.currentModuleIndex,
|
|
11820
11820
|
lessonIndex: c.current.currentLessonIndex,
|
|
11821
|
-
lesson:
|
|
11821
|
+
lesson: S
|
|
11822
11822
|
}), u.current.onCustomAction({
|
|
11823
11823
|
type: "teachingStart",
|
|
11824
11824
|
moduleIndex: c.current.currentModuleIndex,
|
|
11825
11825
|
lessonIndex: c.current.currentLessonIndex,
|
|
11826
|
-
lesson:
|
|
11826
|
+
lesson: S
|
|
11827
11827
|
}), setTimeout(() => {
|
|
11828
|
-
c.current.isTeaching = !1,
|
|
11828
|
+
c.current.isTeaching = !1, S.questions && S.questions.length > 0 ? I.current && I.current() : y.current && y.current();
|
|
11829
11829
|
}, 8e3);
|
|
11830
11830
|
}
|
|
11831
|
-
}, [t.teaching,
|
|
11832
|
-
const
|
|
11833
|
-
if (
|
|
11831
|
+
}, [t.teaching, T, v]), K = B((S) => {
|
|
11832
|
+
const w = A(), $ = z(S, w);
|
|
11833
|
+
if ($ && (c.current.score += 1), u.current.onQuestionAnswer({
|
|
11834
11834
|
moduleIndex: c.current.currentModuleIndex,
|
|
11835
11835
|
lessonIndex: c.current.currentLessonIndex,
|
|
11836
11836
|
questionIndex: c.current.currentQuestionIndex,
|
|
11837
|
-
answer:
|
|
11838
|
-
isCorrect:
|
|
11839
|
-
question:
|
|
11837
|
+
answer: S,
|
|
11838
|
+
isCorrect: $,
|
|
11839
|
+
question: w
|
|
11840
11840
|
}), h.current)
|
|
11841
|
-
if (
|
|
11841
|
+
if ($) {
|
|
11842
11842
|
if (h.current.setMood("happy"), t.correct)
|
|
11843
11843
|
try {
|
|
11844
11844
|
h.current.playReaction("happy");
|
|
@@ -11846,12 +11846,12 @@ const fo = Ut(({
|
|
|
11846
11846
|
h.current.setBodyMovement("happy");
|
|
11847
11847
|
}
|
|
11848
11848
|
h.current.setBodyMovement("gesturing");
|
|
11849
|
-
const
|
|
11850
|
-
h.current.speakText(
|
|
11851
|
-
lipsyncLang:
|
|
11849
|
+
const ke = w.type === "code_test" ? `Great job! Your code passed all the tests! ${w.explanation || ""}` : `Excellent! That's correct! ${w.explanation || ""}`;
|
|
11850
|
+
h.current.speakText(ke, {
|
|
11851
|
+
lipsyncLang: v.lipsyncLang,
|
|
11852
11852
|
onSpeechEnd: () => {
|
|
11853
11853
|
setTimeout(() => {
|
|
11854
|
-
|
|
11854
|
+
g.current && g.current();
|
|
11855
11855
|
}, 500);
|
|
11856
11856
|
}
|
|
11857
11857
|
});
|
|
@@ -11863,109 +11863,109 @@ const fo = Ut(({
|
|
|
11863
11863
|
h.current.setBodyMovement("idle");
|
|
11864
11864
|
}
|
|
11865
11865
|
h.current.setBodyMovement("gesturing");
|
|
11866
|
-
const
|
|
11867
|
-
h.current.speakText(
|
|
11868
|
-
lipsyncLang:
|
|
11866
|
+
const ke = 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.`;
|
|
11867
|
+
h.current.speakText(ke, {
|
|
11868
|
+
lipsyncLang: v.lipsyncLang,
|
|
11869
11869
|
onSpeechEnd: () => {
|
|
11870
11870
|
setTimeout(() => {
|
|
11871
|
-
|
|
11871
|
+
g.current && g.current();
|
|
11872
11872
|
}, 500);
|
|
11873
11873
|
}
|
|
11874
11874
|
});
|
|
11875
11875
|
}
|
|
11876
11876
|
else
|
|
11877
|
-
|
|
11878
|
-
}, [t.correct, t.incorrect,
|
|
11879
|
-
const
|
|
11880
|
-
if (!
|
|
11877
|
+
g.current && g.current();
|
|
11878
|
+
}, [t.correct, t.incorrect, A, z, v]), oe = B((S) => {
|
|
11879
|
+
const w = A();
|
|
11880
|
+
if (!S || typeof S != "object") {
|
|
11881
11881
|
console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
|
|
11882
11882
|
return;
|
|
11883
11883
|
}
|
|
11884
|
-
if (
|
|
11884
|
+
if (w?.type !== "code_test") {
|
|
11885
11885
|
console.warn("Current question is not a code test. Use handleAnswerSelect for other question types.");
|
|
11886
11886
|
return;
|
|
11887
11887
|
}
|
|
11888
|
-
const
|
|
11889
|
-
passed:
|
|
11890
|
-
results:
|
|
11891
|
-
output:
|
|
11892
|
-
error:
|
|
11893
|
-
executionTime:
|
|
11894
|
-
testCount:
|
|
11895
|
-
passedCount:
|
|
11896
|
-
failedCount:
|
|
11888
|
+
const $ = {
|
|
11889
|
+
passed: S.passed === !0,
|
|
11890
|
+
results: S.results || [],
|
|
11891
|
+
output: S.output || "",
|
|
11892
|
+
error: S.error || null,
|
|
11893
|
+
executionTime: S.executionTime || null,
|
|
11894
|
+
testCount: S.testCount || 0,
|
|
11895
|
+
passedCount: S.passedCount || 0,
|
|
11896
|
+
failedCount: S.failedCount || 0
|
|
11897
11897
|
};
|
|
11898
11898
|
u.current.onCustomAction({
|
|
11899
11899
|
type: "codeTestSubmitted",
|
|
11900
11900
|
moduleIndex: c.current.currentModuleIndex,
|
|
11901
11901
|
lessonIndex: c.current.currentLessonIndex,
|
|
11902
11902
|
questionIndex: c.current.currentQuestionIndex,
|
|
11903
|
-
testResult:
|
|
11904
|
-
question:
|
|
11905
|
-
}),
|
|
11906
|
-
}, [
|
|
11903
|
+
testResult: $,
|
|
11904
|
+
question: w
|
|
11905
|
+
}), handleAnswerSelectRef.current && handleAnswerSelectRef.current($);
|
|
11906
|
+
}, [A, z, v]), J = B(() => {
|
|
11907
11907
|
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
|
-
}, []),
|
|
11909
|
-
console.log("Avatar is ready!",
|
|
11910
|
-
const
|
|
11911
|
-
l &&
|
|
11912
|
-
|
|
11908
|
+
}, []), Le = B((S) => {
|
|
11909
|
+
console.log("Avatar is ready!", S);
|
|
11910
|
+
const w = T();
|
|
11911
|
+
l && w?.avatar_script && setTimeout(() => {
|
|
11912
|
+
d.current && d.current();
|
|
11913
11913
|
}, 1e3);
|
|
11914
|
-
}, [l,
|
|
11915
|
-
return
|
|
11916
|
-
d.current =
|
|
11917
|
-
}
|
|
11914
|
+
}, [l, T]);
|
|
11915
|
+
return Nn(() => {
|
|
11916
|
+
d.current = X, m.current = F, y.current = M, g.current = L, b.current = D, I.current = U, handleAnswerSelectRef.current = K;
|
|
11917
|
+
}), Gt(r, () => ({
|
|
11918
11918
|
// Curriculum control methods
|
|
11919
|
-
startTeaching:
|
|
11920
|
-
startQuestions:
|
|
11921
|
-
handleAnswerSelect:
|
|
11922
|
-
handleCodeTestResult:
|
|
11923
|
-
nextQuestion:
|
|
11919
|
+
startTeaching: X,
|
|
11920
|
+
startQuestions: U,
|
|
11921
|
+
handleAnswerSelect: K,
|
|
11922
|
+
handleCodeTestResult: oe,
|
|
11923
|
+
nextQuestion: L,
|
|
11924
11924
|
nextLesson: F,
|
|
11925
|
-
completeLesson:
|
|
11926
|
-
completeCurriculum:
|
|
11927
|
-
resetCurriculum:
|
|
11925
|
+
completeLesson: M,
|
|
11926
|
+
completeCurriculum: D,
|
|
11927
|
+
resetCurriculum: J,
|
|
11928
11928
|
getState: () => ({ ...c.current }),
|
|
11929
|
-
getCurrentQuestion: () =>
|
|
11930
|
-
getCurrentLesson: () =>
|
|
11929
|
+
getCurrentQuestion: () => A(),
|
|
11930
|
+
getCurrentLesson: () => T(),
|
|
11931
11931
|
// Direct access to avatar ref (always returns current value)
|
|
11932
11932
|
getAvatarRef: () => h.current,
|
|
11933
11933
|
// Convenience methods that delegate to avatar (always check current ref)
|
|
11934
|
-
speakText: async (
|
|
11935
|
-
await h.current?.resumeAudioContext?.(), h.current?.speakText(
|
|
11934
|
+
speakText: async (S, w = {}) => {
|
|
11935
|
+
await h.current?.resumeAudioContext?.(), h.current?.speakText(S, { ...w, lipsyncLang: w.lipsyncLang || v.lipsyncLang });
|
|
11936
11936
|
},
|
|
11937
11937
|
resumeAudioContext: async () => {
|
|
11938
11938
|
if (h.current?.resumeAudioContext)
|
|
11939
11939
|
return await h.current.resumeAudioContext();
|
|
11940
|
-
const
|
|
11941
|
-
if (
|
|
11942
|
-
const
|
|
11943
|
-
if (
|
|
11940
|
+
const S = h.current?.talkingHead;
|
|
11941
|
+
if (S?.audioCtx) {
|
|
11942
|
+
const w = S.audioCtx;
|
|
11943
|
+
if (w.state === "suspended" || w.state === "interrupted")
|
|
11944
11944
|
try {
|
|
11945
|
-
await
|
|
11946
|
-
} catch (
|
|
11947
|
-
console.warn("Failed to resume audio context:",
|
|
11945
|
+
await w.resume(), console.log("Audio context resumed via talkingHead");
|
|
11946
|
+
} catch ($) {
|
|
11947
|
+
console.warn("Failed to resume audio context:", $);
|
|
11948
11948
|
}
|
|
11949
11949
|
} else
|
|
11950
11950
|
console.warn("Audio context not available yet");
|
|
11951
11951
|
},
|
|
11952
11952
|
stopSpeaking: () => h.current?.stopSpeaking(),
|
|
11953
|
-
setMood: (
|
|
11954
|
-
playAnimation: (
|
|
11955
|
-
setBodyMovement: (
|
|
11956
|
-
setMovementIntensity: (
|
|
11953
|
+
setMood: (S) => h.current?.setMood(S),
|
|
11954
|
+
playAnimation: (S, w) => h.current?.playAnimation(S, w),
|
|
11955
|
+
setBodyMovement: (S) => h.current?.setBodyMovement(S),
|
|
11956
|
+
setMovementIntensity: (S) => h.current?.setMovementIntensity(S),
|
|
11957
11957
|
playRandomDance: () => h.current?.playRandomDance(),
|
|
11958
|
-
playReaction: (
|
|
11958
|
+
playReaction: (S) => h.current?.playReaction(S),
|
|
11959
11959
|
playCelebration: () => h.current?.playCelebration(),
|
|
11960
|
-
setShowFullAvatar: (
|
|
11961
|
-
setTimingAdjustment: (
|
|
11960
|
+
setShowFullAvatar: (S) => h.current?.setShowFullAvatar(S),
|
|
11961
|
+
setTimingAdjustment: (S) => h.current?.setTimingAdjustment(S),
|
|
11962
11962
|
lockAvatarPosition: () => h.current?.lockAvatarPosition(),
|
|
11963
11963
|
unlockAvatarPosition: () => h.current?.unlockAvatarPosition(),
|
|
11964
11964
|
// Custom action trigger
|
|
11965
|
-
triggerCustomAction: (
|
|
11965
|
+
triggerCustomAction: (S, w) => {
|
|
11966
11966
|
u.current.onCustomAction({
|
|
11967
|
-
type:
|
|
11968
|
-
...
|
|
11967
|
+
type: S,
|
|
11968
|
+
...w,
|
|
11969
11969
|
state: { ...c.current }
|
|
11970
11970
|
});
|
|
11971
11971
|
},
|
|
@@ -11973,32 +11973,32 @@ const fo = Ut(({
|
|
|
11973
11973
|
handleResize: () => h.current?.handleResize(),
|
|
11974
11974
|
// Avatar readiness check (always returns current value)
|
|
11975
11975
|
isAvatarReady: () => h.current?.isReady || !1
|
|
11976
|
-
}), [
|
|
11976
|
+
}), [X, U, K, oe, L, F, M, D, J, A, T]), /* @__PURE__ */ He("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ He(
|
|
11977
11977
|
On,
|
|
11978
11978
|
{
|
|
11979
11979
|
ref: h,
|
|
11980
|
-
avatarUrl:
|
|
11981
|
-
avatarBody:
|
|
11982
|
-
mood:
|
|
11983
|
-
ttsLang:
|
|
11984
|
-
ttsService:
|
|
11985
|
-
ttsVoice:
|
|
11986
|
-
ttsApiKey:
|
|
11987
|
-
bodyMovement:
|
|
11988
|
-
movementIntensity:
|
|
11989
|
-
showFullAvatar:
|
|
11980
|
+
avatarUrl: v.avatarUrl,
|
|
11981
|
+
avatarBody: v.avatarBody,
|
|
11982
|
+
mood: v.mood,
|
|
11983
|
+
ttsLang: v.ttsLang,
|
|
11984
|
+
ttsService: v.ttsService,
|
|
11985
|
+
ttsVoice: v.ttsVoice,
|
|
11986
|
+
ttsApiKey: v.ttsApiKey,
|
|
11987
|
+
bodyMovement: v.bodyMovement,
|
|
11988
|
+
movementIntensity: v.movementIntensity,
|
|
11989
|
+
showFullAvatar: v.showFullAvatar,
|
|
11990
11990
|
cameraView: "upper",
|
|
11991
|
-
animations:
|
|
11992
|
-
onReady:
|
|
11991
|
+
animations: v.animations,
|
|
11992
|
+
onReady: Le,
|
|
11993
11993
|
onLoading: () => {
|
|
11994
11994
|
},
|
|
11995
|
-
onError: (
|
|
11996
|
-
console.error("Avatar error:",
|
|
11995
|
+
onError: (S) => {
|
|
11996
|
+
console.error("Avatar error:", S);
|
|
11997
11997
|
}
|
|
11998
11998
|
}
|
|
11999
11999
|
) });
|
|
12000
12000
|
});
|
|
12001
|
-
|
|
12001
|
+
go.displayName = "CurriculumLearning";
|
|
12002
12002
|
const _n = {
|
|
12003
12003
|
// Code-based dance animations (no FBX required)
|
|
12004
12004
|
dance: {
|
|
@@ -12102,15 +12102,15 @@ const _n = {
|
|
|
12102
12102
|
duration: 5e3,
|
|
12103
12103
|
description: "Excited, energetic movement"
|
|
12104
12104
|
}
|
|
12105
|
-
},
|
|
12105
|
+
}, vo = (p) => _n[p] || null, Ao = (p) => _n.hasOwnProperty(p);
|
|
12106
12106
|
export {
|
|
12107
|
-
|
|
12107
|
+
go as C,
|
|
12108
12108
|
en as F,
|
|
12109
12109
|
On as T,
|
|
12110
|
-
|
|
12110
|
+
fo as a,
|
|
12111
12111
|
Wt as b,
|
|
12112
|
-
|
|
12112
|
+
Ro as c,
|
|
12113
12113
|
_n as d,
|
|
12114
|
-
|
|
12115
|
-
|
|
12114
|
+
vo as g,
|
|
12115
|
+
Ao as h
|
|
12116
12116
|
};
|