@ridp/threejs 1.4.4 → 1.4.5
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/{ImageLoader-y6-Adf1b.cjs → ImageLoader-6mmE7g5P.cjs} +1 -1
- package/dist/{ImageLoader-CMAmH-92.js → ImageLoader-CnBqJLru.js} +1 -1
- package/dist/{PredictiveLoader-eiPgVdsJ.js → PredictiveLoader-DTN7SDRI.js} +305 -295
- package/dist/{PredictiveLoader-BXCwkdSX.cjs → PredictiveLoader-KOCZXzGy.cjs} +2 -2
- package/dist/assets/{gltfParserOptimized.worker-FT73rIOj.js → gltfParserOptimized.worker-yo8WMPFM.js} +1 -1
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.js +2 -2
- package/dist/threejs.cjs +1 -1
- package/dist/threejs.js +5 -5
- package/dist/{useBatchGLTFLoader-D3gPYO-K.cjs → useBatchGLTFLoader-19GZ1dxv.cjs} +1 -1
- package/dist/{useBatchGLTFLoader-DP_NdYhC.js → useBatchGLTFLoader-DPT0_95u.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as A from "three";
|
|
2
|
-
import { Controls as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { Controls as gt, Vector3 as S, MOUSE as B, TOUCH as V, Quaternion as le, Spherical as Ue, Vector2 as k, Ray as yt, Plane as _t, MathUtils as nt, TrianglesDrawMode as Tt, TriangleFanDrawMode as De, TriangleStripDrawMode as it, Loader as ot, FileLoader as de, SRGBColorSpace as Y, LinearSRGBColorSpace as U, BufferGeometry as rt, BufferAttribute as oe, Color as q, ColorManagement as Pe, LoaderUtils as re, MeshPhysicalMaterial as j, SpotLight as wt, PointLight as bt, DirectionalLight as Et, Matrix4 as se, InstancedMesh as xt, InstancedBufferAttribute as At, Object3D as ve, TextureLoader as Mt, ImageBitmapLoader as Rt, InterleavedBuffer as St, InterleavedBufferAttribute as Lt, LinearMipmapLinearFilter as at, NearestMipmapLinearFilter as Dt, LinearMipmapNearestFilter as Pt, NearestMipmapNearestFilter as Ct, LinearFilter as Ce, NearestFilter as ct, RepeatWrapping as Oe, MirroredRepeatWrapping as Ot, ClampToEdgeWrapping as kt, PointsMaterial as It, Material as Te, LineBasicMaterial as Nt, MeshStandardMaterial as lt, DoubleSide as vt, MeshBasicMaterial as ie, PropertyBinding as Ht, SkinnedMesh as Ft, Mesh as Ut, LineSegments as jt, Line as Gt, LineLoop as Bt, Points as zt, Group as we, PerspectiveCamera as Kt, OrthographicCamera as Wt, Skeleton as Xt, AnimationClip as Vt, Bone as Yt, InterpolateDiscrete as qt, InterpolateLinear as ht, Texture as je, VectorKeyframeTrack as Ge, NumberKeyframeTrack as Be, QuaternionKeyframeTrack as ze, FrontSide as $t, Interpolant as Zt, Box3 as Qt, Sphere as Jt, CameraHelper as es, GridHelper as ts, BoxHelper as ss, Raycaster as ns, AxesHelper as is, ArrowHelper as os } from "three";
|
|
3
|
+
import rs from "dexie";
|
|
4
|
+
const Ke = { type: "change" }, He = { type: "start" }, ut = { type: "end" }, ue = new yt(), We = new _t(), as = Math.cos(70 * nt.DEG2RAD), L = new S(), O = 2 * Math.PI, M = {
|
|
5
5
|
NONE: -1,
|
|
6
6
|
ROTATE: 0,
|
|
7
7
|
DOLLY: 1,
|
|
@@ -11,7 +11,7 @@ const ze = { type: "change" }, ve = { type: "start" }, ht = { type: "end" }, ue
|
|
|
11
11
|
TOUCH_DOLLY_PAN: 5,
|
|
12
12
|
TOUCH_DOLLY_ROTATE: 6
|
|
13
13
|
}, be = 1e-6;
|
|
14
|
-
class
|
|
14
|
+
class dt extends gt {
|
|
15
15
|
/**
|
|
16
16
|
* Constructs a new controls instance.
|
|
17
17
|
*
|
|
@@ -19,7 +19,7 @@ class ut extends mt {
|
|
|
19
19
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
20
20
|
*/
|
|
21
21
|
constructor(e, t = null) {
|
|
22
|
-
super(e, t), this.state =
|
|
22
|
+
super(e, t), this.state = M.NONE, this.target = new S(), this.cursor = new S(), 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: B.ROTATE, MIDDLE: B.DOLLY, RIGHT: B.PAN }, this.touches = { ONE: V.ROTATE, TWO: V.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new S(), this._lastQuaternion = new le(), this._lastTargetPosition = new S(), this._quat = new le().setFromUnitVectors(e.up, new S(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Ue(), this._sphericalDelta = new Ue(), this._scale = 1, this._panOffset = new S(), this._rotateStart = new k(), this._rotateEnd = new k(), this._rotateDelta = new k(), this._panStart = new k(), this._panEnd = new k(), this._panDelta = new k(), this._dollyStart = new k(), this._dollyEnd = new k(), this._dollyDelta = new k(), this._dollyDirection = new S(), this._mouse = new k(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = ls.bind(this), this._onPointerDown = cs.bind(this), this._onPointerUp = hs.bind(this), this._onContextMenu = ys.bind(this), this._onMouseWheel = fs.bind(this), this._onKeyDown = ps.bind(this), this._onTouchStart = ms.bind(this), this._onTouchMove = gs.bind(this), this._onMouseDown = us.bind(this), this._onMouseMove = ds.bind(this), this._interceptControlDown = _s.bind(this), this._interceptControlUp = Ts.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
23
23
|
}
|
|
24
24
|
connect(e) {
|
|
25
25
|
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";
|
|
@@ -80,11 +80,11 @@ class ut extends mt {
|
|
|
80
80
|
* was called, or the initial state.
|
|
81
81
|
*/
|
|
82
82
|
reset() {
|
|
83
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
83
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Ke), this.update(), this.state = M.NONE;
|
|
84
84
|
}
|
|
85
85
|
update(e = null) {
|
|
86
86
|
const t = this.object.position;
|
|
87
|
-
L.copy(t).sub(this.target), L.applyQuaternion(this._quat), this._spherical.setFromVector3(L), this.autoRotate && this.state ===
|
|
87
|
+
L.copy(t).sub(this.target), L.applyQuaternion(this._quat), this._spherical.setFromVector3(L), this.autoRotate && this.state === M.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);
|
|
88
88
|
let n = this.minAzimuthAngle, s = this.maxAzimuthAngle;
|
|
89
89
|
isFinite(n) && isFinite(s) && (n < -Math.PI ? n += O : n > Math.PI && (n -= O), s < -Math.PI ? s += O : s > Math.PI && (s -= O), n <= s ? this._spherical.theta = Math.max(n, Math.min(s, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + s) / 2 ? Math.max(n, this._spherical.theta) : Math.min(s, 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);
|
|
90
90
|
let i = !1;
|
|
@@ -110,12 +110,12 @@ class ut extends mt {
|
|
|
110
110
|
l.unproject(this.object), this.object.position.sub(l).add(c), this.object.updateMatrixWorld(), o = L.length();
|
|
111
111
|
} else
|
|
112
112
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
113
|
-
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (ue.origin.copy(this.object.position), ue.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ue.direction)) <
|
|
113
|
+
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (ue.origin.copy(this.object.position), ue.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ue.direction)) < as ? this.object.lookAt(this.target) : (We.setFromNormalAndCoplanarPoint(this.object.up, this.target), ue.intersectPlane(We, this.target))));
|
|
114
114
|
} else if (this.object.isOrthographicCamera) {
|
|
115
115
|
const o = this.object.zoom;
|
|
116
116
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), o !== this.object.zoom && (this.object.updateProjectionMatrix(), i = !0);
|
|
117
117
|
}
|
|
118
|
-
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > be || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > be || this._lastTargetPosition.distanceToSquared(this.target) > be ? (this.dispatchEvent(
|
|
118
|
+
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > be || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > be || this._lastTargetPosition.distanceToSquared(this.target) > be ? (this.dispatchEvent(Ke), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
119
119
|
}
|
|
120
120
|
_getAutoRotationAngle(e) {
|
|
121
121
|
return e !== null ? O / 60 * this.autoRotateSpeed * e : O / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -307,16 +307,16 @@ class ut extends mt {
|
|
|
307
307
|
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function cs(r) {
|
|
311
311
|
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(r.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(r) && (this._addPointer(r), r.pointerType === "touch" ? this._onTouchStart(r) : this._onMouseDown(r)));
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function ls(r) {
|
|
314
314
|
this.enabled !== !1 && (r.pointerType === "touch" ? this._onTouchMove(r) : this._onMouseMove(r));
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function hs(r) {
|
|
317
317
|
switch (this._removePointer(r), this._pointers.length) {
|
|
318
318
|
case 0:
|
|
319
|
-
this.domElement.releasePointerCapture(r.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(
|
|
319
|
+
this.domElement.releasePointerCapture(r.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(ut), this.state = M.NONE;
|
|
320
320
|
break;
|
|
321
321
|
case 1:
|
|
322
322
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -324,7 +324,7 @@ function ls(r) {
|
|
|
324
324
|
break;
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function us(r) {
|
|
328
328
|
let e;
|
|
329
329
|
switch (r.button) {
|
|
330
330
|
case 0:
|
|
@@ -342,128 +342,128 @@ function hs(r) {
|
|
|
342
342
|
switch (e) {
|
|
343
343
|
case B.DOLLY:
|
|
344
344
|
if (this.enableZoom === !1) return;
|
|
345
|
-
this._handleMouseDownDolly(r), this.state =
|
|
345
|
+
this._handleMouseDownDolly(r), this.state = M.DOLLY;
|
|
346
346
|
break;
|
|
347
347
|
case B.ROTATE:
|
|
348
348
|
if (r.ctrlKey || r.metaKey || r.shiftKey) {
|
|
349
349
|
if (this.enablePan === !1) return;
|
|
350
|
-
this._handleMouseDownPan(r), this.state =
|
|
350
|
+
this._handleMouseDownPan(r), this.state = M.PAN;
|
|
351
351
|
} else {
|
|
352
352
|
if (this.enableRotate === !1) return;
|
|
353
|
-
this._handleMouseDownRotate(r), this.state =
|
|
353
|
+
this._handleMouseDownRotate(r), this.state = M.ROTATE;
|
|
354
354
|
}
|
|
355
355
|
break;
|
|
356
356
|
case B.PAN:
|
|
357
357
|
if (r.ctrlKey || r.metaKey || r.shiftKey) {
|
|
358
358
|
if (this.enableRotate === !1) return;
|
|
359
|
-
this._handleMouseDownRotate(r), this.state =
|
|
359
|
+
this._handleMouseDownRotate(r), this.state = M.ROTATE;
|
|
360
360
|
} else {
|
|
361
361
|
if (this.enablePan === !1) return;
|
|
362
|
-
this._handleMouseDownPan(r), this.state =
|
|
362
|
+
this._handleMouseDownPan(r), this.state = M.PAN;
|
|
363
363
|
}
|
|
364
364
|
break;
|
|
365
365
|
default:
|
|
366
|
-
this.state =
|
|
366
|
+
this.state = M.NONE;
|
|
367
367
|
}
|
|
368
|
-
this.state !==
|
|
368
|
+
this.state !== M.NONE && this.dispatchEvent(He);
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function ds(r) {
|
|
371
371
|
switch (this.state) {
|
|
372
|
-
case
|
|
372
|
+
case M.ROTATE:
|
|
373
373
|
if (this.enableRotate === !1) return;
|
|
374
374
|
this._handleMouseMoveRotate(r);
|
|
375
375
|
break;
|
|
376
|
-
case
|
|
376
|
+
case M.DOLLY:
|
|
377
377
|
if (this.enableZoom === !1) return;
|
|
378
378
|
this._handleMouseMoveDolly(r);
|
|
379
379
|
break;
|
|
380
|
-
case
|
|
380
|
+
case M.PAN:
|
|
381
381
|
if (this.enablePan === !1) return;
|
|
382
382
|
this._handleMouseMovePan(r);
|
|
383
383
|
break;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
function ds(r) {
|
|
387
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== R.NONE || (r.preventDefault(), this.dispatchEvent(ve), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(ht));
|
|
388
|
-
}
|
|
389
386
|
function fs(r) {
|
|
390
|
-
this.enabled
|
|
387
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== M.NONE || (r.preventDefault(), this.dispatchEvent(He), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(ut));
|
|
391
388
|
}
|
|
392
389
|
function ps(r) {
|
|
390
|
+
this.enabled !== !1 && this._handleKeyDown(r);
|
|
391
|
+
}
|
|
392
|
+
function ms(r) {
|
|
393
393
|
switch (this._trackPointer(r), this._pointers.length) {
|
|
394
394
|
case 1:
|
|
395
395
|
switch (this.touches.ONE) {
|
|
396
396
|
case V.ROTATE:
|
|
397
397
|
if (this.enableRotate === !1) return;
|
|
398
|
-
this._handleTouchStartRotate(r), this.state =
|
|
398
|
+
this._handleTouchStartRotate(r), this.state = M.TOUCH_ROTATE;
|
|
399
399
|
break;
|
|
400
400
|
case V.PAN:
|
|
401
401
|
if (this.enablePan === !1) return;
|
|
402
|
-
this._handleTouchStartPan(r), this.state =
|
|
402
|
+
this._handleTouchStartPan(r), this.state = M.TOUCH_PAN;
|
|
403
403
|
break;
|
|
404
404
|
default:
|
|
405
|
-
this.state =
|
|
405
|
+
this.state = M.NONE;
|
|
406
406
|
}
|
|
407
407
|
break;
|
|
408
408
|
case 2:
|
|
409
409
|
switch (this.touches.TWO) {
|
|
410
410
|
case V.DOLLY_PAN:
|
|
411
411
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
412
|
-
this._handleTouchStartDollyPan(r), this.state =
|
|
412
|
+
this._handleTouchStartDollyPan(r), this.state = M.TOUCH_DOLLY_PAN;
|
|
413
413
|
break;
|
|
414
414
|
case V.DOLLY_ROTATE:
|
|
415
415
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
416
|
-
this._handleTouchStartDollyRotate(r), this.state =
|
|
416
|
+
this._handleTouchStartDollyRotate(r), this.state = M.TOUCH_DOLLY_ROTATE;
|
|
417
417
|
break;
|
|
418
418
|
default:
|
|
419
|
-
this.state =
|
|
419
|
+
this.state = M.NONE;
|
|
420
420
|
}
|
|
421
421
|
break;
|
|
422
422
|
default:
|
|
423
|
-
this.state =
|
|
423
|
+
this.state = M.NONE;
|
|
424
424
|
}
|
|
425
|
-
this.state !==
|
|
425
|
+
this.state !== M.NONE && this.dispatchEvent(He);
|
|
426
426
|
}
|
|
427
|
-
function
|
|
427
|
+
function gs(r) {
|
|
428
428
|
switch (this._trackPointer(r), this.state) {
|
|
429
|
-
case
|
|
429
|
+
case M.TOUCH_ROTATE:
|
|
430
430
|
if (this.enableRotate === !1) return;
|
|
431
431
|
this._handleTouchMoveRotate(r), this.update();
|
|
432
432
|
break;
|
|
433
|
-
case
|
|
433
|
+
case M.TOUCH_PAN:
|
|
434
434
|
if (this.enablePan === !1) return;
|
|
435
435
|
this._handleTouchMovePan(r), this.update();
|
|
436
436
|
break;
|
|
437
|
-
case
|
|
437
|
+
case M.TOUCH_DOLLY_PAN:
|
|
438
438
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
439
439
|
this._handleTouchMoveDollyPan(r), this.update();
|
|
440
440
|
break;
|
|
441
|
-
case
|
|
441
|
+
case M.TOUCH_DOLLY_ROTATE:
|
|
442
442
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
443
443
|
this._handleTouchMoveDollyRotate(r), this.update();
|
|
444
444
|
break;
|
|
445
445
|
default:
|
|
446
|
-
this.state =
|
|
446
|
+
this.state = M.NONE;
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function ys(r) {
|
|
450
450
|
this.enabled !== !1 && r.preventDefault();
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function _s(r) {
|
|
453
453
|
r.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function Ts(r) {
|
|
456
456
|
r.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
457
457
|
}
|
|
458
|
-
class
|
|
458
|
+
class ws extends dt {
|
|
459
459
|
constructor(e, t) {
|
|
460
460
|
super(e, t), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: B.PAN, MIDDLE: B.DOLLY, RIGHT: B.ROTATE }, this.touches = { ONE: V.PAN, TWO: V.DOLLY_ROTATE };
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
function
|
|
464
|
-
if (e ===
|
|
463
|
+
function Xe(r, e) {
|
|
464
|
+
if (e === Tt)
|
|
465
465
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
466
|
-
if (e ===
|
|
466
|
+
if (e === De || e === it) {
|
|
467
467
|
let t = r.getIndex();
|
|
468
468
|
if (t === null) {
|
|
469
469
|
const o = [], c = r.getAttribute("position");
|
|
@@ -475,7 +475,7 @@ function We(r, e) {
|
|
|
475
475
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), r;
|
|
476
476
|
}
|
|
477
477
|
const n = t.count - 2, s = [];
|
|
478
|
-
if (e ===
|
|
478
|
+
if (e === De)
|
|
479
479
|
for (let o = 1; o <= n; o++)
|
|
480
480
|
s.push(t.getX(0)), s.push(t.getX(o)), s.push(t.getX(o + 1));
|
|
481
481
|
else
|
|
@@ -488,7 +488,7 @@ function We(r, e) {
|
|
|
488
488
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), r;
|
|
489
489
|
}
|
|
490
490
|
const Ee = /* @__PURE__ */ new WeakMap();
|
|
491
|
-
class
|
|
491
|
+
class bs extends ot {
|
|
492
492
|
/**
|
|
493
493
|
* Constructs a new Draco loader.
|
|
494
494
|
*
|
|
@@ -595,7 +595,7 @@ class ws extends it {
|
|
|
595
595
|
}), c;
|
|
596
596
|
}
|
|
597
597
|
_createGeometry(e) {
|
|
598
|
-
const t = new
|
|
598
|
+
const t = new rt();
|
|
599
599
|
e.index && t.setIndex(new oe(e.index.array, 1));
|
|
600
600
|
for (let n = 0; n < e.attributes.length; n++) {
|
|
601
601
|
const s = e.attributes[n], i = s.name, o = s.array, c = s.itemSize, a = new oe(o, c);
|
|
@@ -607,7 +607,7 @@ class ws extends it {
|
|
|
607
607
|
if (t !== Y) return;
|
|
608
608
|
const n = new q();
|
|
609
609
|
for (let s = 0, i = e.count; s < i; s++)
|
|
610
|
-
n.fromBufferAttribute(e, s),
|
|
610
|
+
n.fromBufferAttribute(e, s), Pe.colorSpaceToWorking(n, Y), e.setXYZ(s, n.r, n.g, n.b);
|
|
611
611
|
}
|
|
612
612
|
_loadLibrary(e, t) {
|
|
613
613
|
const n = new de(this.manager);
|
|
@@ -624,7 +624,7 @@ class ws extends it {
|
|
|
624
624
|
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) => {
|
|
625
625
|
const s = n[0];
|
|
626
626
|
e || (this.decoderConfig.wasmBinary = n[1]);
|
|
627
|
-
const i =
|
|
627
|
+
const i = Es.toString(), o = [
|
|
628
628
|
"/* draco decoder */",
|
|
629
629
|
s,
|
|
630
630
|
"",
|
|
@@ -672,7 +672,7 @@ class ws extends it {
|
|
|
672
672
|
return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function Es() {
|
|
676
676
|
let r, e;
|
|
677
677
|
onmessage = function(o) {
|
|
678
678
|
const c = o.data;
|
|
@@ -762,7 +762,7 @@ function bs() {
|
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
|
-
class
|
|
765
|
+
class xs extends ot {
|
|
766
766
|
/**
|
|
767
767
|
* Constructs a new glTF loader.
|
|
768
768
|
*
|
|
@@ -770,39 +770,39 @@ class Es extends it {
|
|
|
770
770
|
*/
|
|
771
771
|
constructor(e) {
|
|
772
772
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
773
|
-
return new Ss(t);
|
|
774
|
-
}), this.register(function(t) {
|
|
775
773
|
return new Ls(t);
|
|
776
774
|
}), this.register(function(t) {
|
|
777
|
-
return new
|
|
775
|
+
return new Ds(t);
|
|
778
776
|
}), this.register(function(t) {
|
|
779
777
|
return new Fs(t);
|
|
780
778
|
}), this.register(function(t) {
|
|
781
779
|
return new Us(t);
|
|
782
780
|
}), this.register(function(t) {
|
|
783
|
-
return new
|
|
781
|
+
return new js(t);
|
|
784
782
|
}), this.register(function(t) {
|
|
785
783
|
return new Cs(t);
|
|
786
784
|
}), this.register(function(t) {
|
|
787
785
|
return new Os(t);
|
|
788
786
|
}), this.register(function(t) {
|
|
789
787
|
return new ks(t);
|
|
790
|
-
}), this.register(function(t) {
|
|
791
|
-
return new Ms(t);
|
|
792
788
|
}), this.register(function(t) {
|
|
793
789
|
return new Is(t);
|
|
794
790
|
}), this.register(function(t) {
|
|
795
|
-
return new
|
|
796
|
-
}), this.register(function(t) {
|
|
797
|
-
return new vs(t);
|
|
791
|
+
return new Ss(t);
|
|
798
792
|
}), this.register(function(t) {
|
|
799
793
|
return new Ns(t);
|
|
800
794
|
}), this.register(function(t) {
|
|
801
|
-
return new
|
|
795
|
+
return new Ps(t);
|
|
802
796
|
}), this.register(function(t) {
|
|
803
|
-
return new
|
|
797
|
+
return new Hs(t);
|
|
798
|
+
}), this.register(function(t) {
|
|
799
|
+
return new vs(t);
|
|
800
|
+
}), this.register(function(t) {
|
|
801
|
+
return new Ms(t);
|
|
804
802
|
}), this.register(function(t) {
|
|
805
803
|
return new Gs(t);
|
|
804
|
+
}), this.register(function(t) {
|
|
805
|
+
return new Bs(t);
|
|
806
806
|
});
|
|
807
807
|
}
|
|
808
808
|
/**
|
|
@@ -902,9 +902,9 @@ class Es extends it {
|
|
|
902
902
|
if (typeof e == "string")
|
|
903
903
|
i = JSON.parse(e);
|
|
904
904
|
else if (e instanceof ArrayBuffer)
|
|
905
|
-
if (a.decode(new Uint8Array(e, 0, 4)) ===
|
|
905
|
+
if (a.decode(new Uint8Array(e, 0, 4)) === ft) {
|
|
906
906
|
try {
|
|
907
|
-
o[b.KHR_BINARY_GLTF] = new
|
|
907
|
+
o[b.KHR_BINARY_GLTF] = new zs(e);
|
|
908
908
|
} catch (h) {
|
|
909
909
|
s && s(h);
|
|
910
910
|
return;
|
|
@@ -918,7 +918,7 @@ class Es extends it {
|
|
|
918
918
|
s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
919
919
|
return;
|
|
920
920
|
}
|
|
921
|
-
const l = new
|
|
921
|
+
const l = new sn(i, {
|
|
922
922
|
path: t || this.resourcePath || "",
|
|
923
923
|
crossOrigin: this.crossOrigin,
|
|
924
924
|
requestHeader: this.requestHeader,
|
|
@@ -939,13 +939,13 @@ class Es extends it {
|
|
|
939
939
|
o[h] = new Rs();
|
|
940
940
|
break;
|
|
941
941
|
case b.KHR_DRACO_MESH_COMPRESSION:
|
|
942
|
-
o[h] = new
|
|
942
|
+
o[h] = new Ks(i, this.dracoLoader);
|
|
943
943
|
break;
|
|
944
944
|
case b.KHR_TEXTURE_TRANSFORM:
|
|
945
|
-
o[h] = new
|
|
945
|
+
o[h] = new Ws();
|
|
946
946
|
break;
|
|
947
947
|
case b.KHR_MESH_QUANTIZATION:
|
|
948
|
-
o[h] = new
|
|
948
|
+
o[h] = new Xs();
|
|
949
949
|
break;
|
|
950
950
|
default:
|
|
951
951
|
p.indexOf(h) >= 0 && c[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".');
|
|
@@ -968,7 +968,7 @@ class Es extends it {
|
|
|
968
968
|
});
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function As() {
|
|
972
972
|
let r = {};
|
|
973
973
|
return {
|
|
974
974
|
get: function(e) {
|
|
@@ -1009,7 +1009,7 @@ const b = {
|
|
|
1009
1009
|
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
1010
1010
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
1011
1011
|
};
|
|
1012
|
-
class
|
|
1012
|
+
class Ms {
|
|
1013
1013
|
constructor(e) {
|
|
1014
1014
|
this.parser = e, this.name = b.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
1015
1015
|
}
|
|
@@ -1031,13 +1031,13 @@ class As {
|
|
|
1031
1031
|
const h = a.range !== void 0 ? a.range : 0;
|
|
1032
1032
|
switch (a.type) {
|
|
1033
1033
|
case "directional":
|
|
1034
|
-
l = new
|
|
1034
|
+
l = new Et(u), l.target.position.set(0, 0, -1), l.add(l.target);
|
|
1035
1035
|
break;
|
|
1036
1036
|
case "point":
|
|
1037
|
-
l = new
|
|
1037
|
+
l = new bt(u), l.distance = h;
|
|
1038
1038
|
break;
|
|
1039
1039
|
case "spot":
|
|
1040
|
-
l = new
|
|
1040
|
+
l = new wt(u), l.distance = h, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle !== void 0 ? a.spot.innerConeAngle : 0, a.spot.outerConeAngle = a.spot.outerConeAngle !== void 0 ? a.spot.outerConeAngle : Math.PI / 4, l.angle = a.spot.outerConeAngle, l.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
|
|
1041
1041
|
break;
|
|
1042
1042
|
default:
|
|
1043
1043
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
|
|
@@ -1076,7 +1076,7 @@ class Rs {
|
|
|
1076
1076
|
return Promise.all(s);
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
|
-
class
|
|
1079
|
+
class Ss {
|
|
1080
1080
|
constructor(e) {
|
|
1081
1081
|
this.parser = e, this.name = b.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
1082
1082
|
}
|
|
@@ -1088,7 +1088,7 @@ class Ms {
|
|
|
1088
1088
|
return i !== void 0 && (t.emissiveIntensity = i), Promise.resolve();
|
|
1089
1089
|
}
|
|
1090
1090
|
}
|
|
1091
|
-
class
|
|
1091
|
+
class Ls {
|
|
1092
1092
|
constructor(e) {
|
|
1093
1093
|
this.parser = e, this.name = b.KHR_MATERIALS_CLEARCOAT;
|
|
1094
1094
|
}
|
|
@@ -1108,7 +1108,7 @@ class Ss {
|
|
|
1108
1108
|
return Promise.all(i);
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
-
class
|
|
1111
|
+
class Ds {
|
|
1112
1112
|
constructor(e) {
|
|
1113
1113
|
this.parser = e, this.name = b.KHR_MATERIALS_DISPERSION;
|
|
1114
1114
|
}
|
|
@@ -1140,7 +1140,7 @@ class Ps {
|
|
|
1140
1140
|
return o.iridescenceFactor !== void 0 && (t.iridescence = o.iridescenceFactor), o.iridescenceTexture !== void 0 && i.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 && i.push(n.assignTexture(t, "iridescenceThicknessMap", o.iridescenceThicknessTexture)), Promise.all(i);
|
|
1141
1141
|
}
|
|
1142
1142
|
}
|
|
1143
|
-
class
|
|
1143
|
+
class Cs {
|
|
1144
1144
|
constructor(e) {
|
|
1145
1145
|
this.parser = e, this.name = b.KHR_MATERIALS_SHEEN;
|
|
1146
1146
|
}
|
|
@@ -1162,7 +1162,7 @@ class Ds {
|
|
|
1162
1162
|
return o.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = o.sheenRoughnessFactor), o.sheenColorTexture !== void 0 && i.push(n.assignTexture(t, "sheenColorMap", o.sheenColorTexture, Y)), o.sheenRoughnessTexture !== void 0 && i.push(n.assignTexture(t, "sheenRoughnessMap", o.sheenRoughnessTexture)), Promise.all(i);
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
|
-
class
|
|
1165
|
+
class Os {
|
|
1166
1166
|
constructor(e) {
|
|
1167
1167
|
this.parser = e, this.name = b.KHR_MATERIALS_TRANSMISSION;
|
|
1168
1168
|
}
|
|
@@ -1178,7 +1178,7 @@ class Cs {
|
|
|
1178
1178
|
return o.transmissionFactor !== void 0 && (t.transmission = o.transmissionFactor), o.transmissionTexture !== void 0 && i.push(n.assignTexture(t, "transmissionMap", o.transmissionTexture)), Promise.all(i);
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
|
-
class
|
|
1181
|
+
class ks {
|
|
1182
1182
|
constructor(e) {
|
|
1183
1183
|
this.parser = e, this.name = b.KHR_MATERIALS_VOLUME;
|
|
1184
1184
|
}
|
|
@@ -1196,7 +1196,7 @@ class Os {
|
|
|
1196
1196
|
return t.attenuationColor = new q().setRGB(c[0], c[1], c[2], U), Promise.all(i);
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
class
|
|
1199
|
+
class Is {
|
|
1200
1200
|
constructor(e) {
|
|
1201
1201
|
this.parser = e, this.name = b.KHR_MATERIALS_IOR;
|
|
1202
1202
|
}
|
|
@@ -1212,7 +1212,7 @@ class ks {
|
|
|
1212
1212
|
return t.ior = i.ior !== void 0 ? i.ior : 1.5, Promise.resolve();
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
class
|
|
1215
|
+
class Ns {
|
|
1216
1216
|
constructor(e) {
|
|
1217
1217
|
this.parser = e, this.name = b.KHR_MATERIALS_SPECULAR;
|
|
1218
1218
|
}
|
|
@@ -1230,7 +1230,7 @@ class Is {
|
|
|
1230
1230
|
return t.specularColor = new q().setRGB(c[0], c[1], c[2], U), o.specularColorTexture !== void 0 && i.push(n.assignTexture(t, "specularColorMap", o.specularColorTexture, Y)), Promise.all(i);
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
|
-
class
|
|
1233
|
+
class vs {
|
|
1234
1234
|
constructor(e) {
|
|
1235
1235
|
this.parser = e, this.name = b.EXT_MATERIALS_BUMP;
|
|
1236
1236
|
}
|
|
@@ -1246,7 +1246,7 @@ class Ns {
|
|
|
1246
1246
|
return t.bumpScale = o.bumpFactor !== void 0 ? o.bumpFactor : 1, o.bumpTexture !== void 0 && i.push(n.assignTexture(t, "bumpMap", o.bumpTexture)), Promise.all(i);
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
class
|
|
1249
|
+
class Hs {
|
|
1250
1250
|
constructor(e) {
|
|
1251
1251
|
this.parser = e, this.name = b.KHR_MATERIALS_ANISOTROPY;
|
|
1252
1252
|
}
|
|
@@ -1262,7 +1262,7 @@ class vs {
|
|
|
1262
1262
|
return o.anisotropyStrength !== void 0 && (t.anisotropy = o.anisotropyStrength), o.anisotropyRotation !== void 0 && (t.anisotropyRotation = o.anisotropyRotation), o.anisotropyTexture !== void 0 && i.push(n.assignTexture(t, "anisotropyMap", o.anisotropyTexture)), Promise.all(i);
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
|
-
class
|
|
1265
|
+
class Fs {
|
|
1266
1266
|
constructor(e) {
|
|
1267
1267
|
this.parser = e, this.name = b.KHR_TEXTURE_BASISU;
|
|
1268
1268
|
}
|
|
@@ -1279,7 +1279,7 @@ class Hs {
|
|
|
1279
1279
|
return t.loadTextureImage(e, i.source, o);
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
|
-
class
|
|
1282
|
+
class Us {
|
|
1283
1283
|
constructor(e) {
|
|
1284
1284
|
this.parser = e, this.name = b.EXT_TEXTURE_WEBP;
|
|
1285
1285
|
}
|
|
@@ -1296,7 +1296,7 @@ class Fs {
|
|
|
1296
1296
|
return n.loadTextureImage(e, o.source, a);
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
1299
|
-
class
|
|
1299
|
+
class js {
|
|
1300
1300
|
constructor(e) {
|
|
1301
1301
|
this.parser = e, this.name = b.EXT_TEXTURE_AVIF;
|
|
1302
1302
|
}
|
|
@@ -1313,7 +1313,7 @@ class Us {
|
|
|
1313
1313
|
return n.loadTextureImage(e, o.source, a);
|
|
1314
1314
|
}
|
|
1315
1315
|
}
|
|
1316
|
-
class
|
|
1316
|
+
class Gs {
|
|
1317
1317
|
constructor(e) {
|
|
1318
1318
|
this.name = b.EXT_MESHOPT_COMPRESSION, this.parser = e;
|
|
1319
1319
|
}
|
|
@@ -1339,7 +1339,7 @@ class js {
|
|
|
1339
1339
|
return null;
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
|
-
class
|
|
1342
|
+
class Bs {
|
|
1343
1343
|
constructor(e) {
|
|
1344
1344
|
this.name = b.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
1345
1345
|
}
|
|
@@ -1357,22 +1357,22 @@ class Gs {
|
|
|
1357
1357
|
return c.length < 1 ? null : (c.push(this.parser.createNodeMesh(e)), Promise.all(c).then((l) => {
|
|
1358
1358
|
const u = l.pop(), h = u.isGroup ? u.children : [u], p = l[0].count, m = [];
|
|
1359
1359
|
for (const _ of h) {
|
|
1360
|
-
const w = new se(), d = new S(), f = new le(), g = new S(1, 1, 1), T = new
|
|
1360
|
+
const w = new se(), d = new S(), f = new le(), g = new S(1, 1, 1), T = new xt(_.geometry, _.material, p);
|
|
1361
1361
|
for (let y = 0; y < p; y++)
|
|
1362
1362
|
a.TRANSLATION && d.fromBufferAttribute(a.TRANSLATION, y), a.ROTATION && f.fromBufferAttribute(a.ROTATION, y), a.SCALE && g.fromBufferAttribute(a.SCALE, y), T.setMatrixAt(y, w.compose(d, f, g));
|
|
1363
1363
|
for (const y in a)
|
|
1364
1364
|
if (y === "_COLOR_0") {
|
|
1365
1365
|
const E = a[y];
|
|
1366
|
-
T.instanceColor = new
|
|
1366
|
+
T.instanceColor = new At(E.array, E.itemSize, E.normalized);
|
|
1367
1367
|
} else y !== "TRANSLATION" && y !== "ROTATION" && y !== "SCALE" && _.geometry.setAttribute(y, a[y]);
|
|
1368
|
-
|
|
1368
|
+
ve.prototype.copy.call(T, _), this.parser.assignFinalMaterial(T), m.push(T);
|
|
1369
1369
|
}
|
|
1370
1370
|
return u.isGroup ? (u.clear(), u.add(...m), u) : m[0];
|
|
1371
1371
|
}));
|
|
1372
1372
|
}
|
|
1373
1373
|
}
|
|
1374
|
-
const
|
|
1375
|
-
class
|
|
1374
|
+
const ft = "glTF", ne = 12, Ve = { JSON: 1313821514, BIN: 5130562 };
|
|
1375
|
+
class zs {
|
|
1376
1376
|
constructor(e) {
|
|
1377
1377
|
this.name = b.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
1378
1378
|
const t = new DataView(e, 0, ne), n = new TextDecoder();
|
|
@@ -1380,7 +1380,7 @@ class Bs {
|
|
|
1380
1380
|
magic: n.decode(new Uint8Array(e.slice(0, 4))),
|
|
1381
1381
|
version: t.getUint32(4, !0),
|
|
1382
1382
|
length: t.getUint32(8, !0)
|
|
1383
|
-
}, this.header.magic !==
|
|
1383
|
+
}, this.header.magic !== ft)
|
|
1384
1384
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
1385
1385
|
if (this.header.version < 2)
|
|
1386
1386
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
@@ -1390,10 +1390,10 @@ class Bs {
|
|
|
1390
1390
|
const c = i.getUint32(o, !0);
|
|
1391
1391
|
o += 4;
|
|
1392
1392
|
const a = i.getUint32(o, !0);
|
|
1393
|
-
if (o += 4, a ===
|
|
1393
|
+
if (o += 4, a === Ve.JSON) {
|
|
1394
1394
|
const l = new Uint8Array(e, ne + o, c);
|
|
1395
1395
|
this.content = n.decode(l);
|
|
1396
|
-
} else if (a ===
|
|
1396
|
+
} else if (a === Ve.BIN) {
|
|
1397
1397
|
const l = ne + o;
|
|
1398
1398
|
this.body = e.slice(l, l + c);
|
|
1399
1399
|
}
|
|
@@ -1403,7 +1403,7 @@ class Bs {
|
|
|
1403
1403
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
|
-
class
|
|
1406
|
+
class Ks {
|
|
1407
1407
|
constructor(e, t) {
|
|
1408
1408
|
if (!t)
|
|
1409
1409
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
@@ -1435,7 +1435,7 @@ class zs {
|
|
|
1435
1435
|
});
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
|
-
class
|
|
1438
|
+
class Ws {
|
|
1439
1439
|
constructor() {
|
|
1440
1440
|
this.name = b.KHR_TEXTURE_TRANSFORM;
|
|
1441
1441
|
}
|
|
@@ -1443,12 +1443,12 @@ class Ks {
|
|
|
1443
1443
|
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;
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
|
-
class
|
|
1446
|
+
class Xs {
|
|
1447
1447
|
constructor() {
|
|
1448
1448
|
this.name = b.KHR_MESH_QUANTIZATION;
|
|
1449
1449
|
}
|
|
1450
1450
|
}
|
|
1451
|
-
class
|
|
1451
|
+
class pt extends Zt {
|
|
1452
1452
|
constructor(e, t, n, s) {
|
|
1453
1453
|
super(e, t, n, s);
|
|
1454
1454
|
}
|
|
@@ -1461,17 +1461,17 @@ class ft extends $t {
|
|
|
1461
1461
|
interpolate_(e, t, n, s) {
|
|
1462
1462
|
const i = this.resultBuffer, o = this.sampleValues, c = this.valueSize, a = c * 2, l = c * 3, u = s - t, h = (n - t) / u, p = h * h, m = p * h, _ = e * l, w = _ - l, d = -2 * m + 3 * p, f = m - p, g = 1 - d, T = f - p + h;
|
|
1463
1463
|
for (let y = 0; y !== c; y++) {
|
|
1464
|
-
const E = o[w + y + c], x = o[w + y + a] * u,
|
|
1465
|
-
i[y] = g * E + T * x + d *
|
|
1464
|
+
const E = o[w + y + c], x = o[w + y + a] * u, R = o[_ + y + c], P = o[_ + y] * u;
|
|
1465
|
+
i[y] = g * E + T * x + d * R + f * P;
|
|
1466
1466
|
}
|
|
1467
1467
|
return i;
|
|
1468
1468
|
}
|
|
1469
1469
|
}
|
|
1470
|
-
const
|
|
1471
|
-
class
|
|
1470
|
+
const Vs = new le();
|
|
1471
|
+
class Ys extends pt {
|
|
1472
1472
|
interpolate_(e, t, n, s) {
|
|
1473
1473
|
const i = super.interpolate_(e, t, n, s);
|
|
1474
|
-
return
|
|
1474
|
+
return Vs.fromArray(i).normalize().toArray(i), i;
|
|
1475
1475
|
}
|
|
1476
1476
|
}
|
|
1477
1477
|
const I = {
|
|
@@ -1489,16 +1489,16 @@ const I = {
|
|
|
1489
1489
|
5123: Uint16Array,
|
|
1490
1490
|
5125: Uint32Array,
|
|
1491
1491
|
5126: Float32Array
|
|
1492
|
-
},
|
|
1493
|
-
9728:
|
|
1492
|
+
}, Ye = {
|
|
1493
|
+
9728: ct,
|
|
1494
1494
|
9729: Ce,
|
|
1495
|
-
9984:
|
|
1495
|
+
9984: Ct,
|
|
1496
1496
|
9985: Pt,
|
|
1497
|
-
9986:
|
|
1498
|
-
9987:
|
|
1499
|
-
},
|
|
1500
|
-
33071:
|
|
1501
|
-
33648:
|
|
1497
|
+
9986: Dt,
|
|
1498
|
+
9987: at
|
|
1499
|
+
}, qe = {
|
|
1500
|
+
33071: kt,
|
|
1501
|
+
33648: Ot,
|
|
1502
1502
|
10497: Oe
|
|
1503
1503
|
}, xe = {
|
|
1504
1504
|
SCALAR: 1,
|
|
@@ -1524,26 +1524,26 @@ const I = {
|
|
|
1524
1524
|
translation: "position",
|
|
1525
1525
|
rotation: "quaternion",
|
|
1526
1526
|
weights: "morphTargetInfluences"
|
|
1527
|
-
},
|
|
1527
|
+
}, qs = {
|
|
1528
1528
|
CUBICSPLINE: void 0,
|
|
1529
1529
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
1530
1530
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
1531
|
-
LINEAR:
|
|
1532
|
-
STEP:
|
|
1531
|
+
LINEAR: ht,
|
|
1532
|
+
STEP: qt
|
|
1533
1533
|
}, Ae = {
|
|
1534
1534
|
OPAQUE: "OPAQUE",
|
|
1535
1535
|
MASK: "MASK",
|
|
1536
1536
|
BLEND: "BLEND"
|
|
1537
1537
|
};
|
|
1538
|
-
function
|
|
1539
|
-
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new
|
|
1538
|
+
function $s(r) {
|
|
1539
|
+
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new lt({
|
|
1540
1540
|
color: 16777215,
|
|
1541
1541
|
emissive: 0,
|
|
1542
1542
|
metalness: 1,
|
|
1543
1543
|
roughness: 1,
|
|
1544
1544
|
transparent: !1,
|
|
1545
1545
|
depthTest: !0,
|
|
1546
|
-
side:
|
|
1546
|
+
side: $t
|
|
1547
1547
|
})), r.DefaultMaterial;
|
|
1548
1548
|
}
|
|
1549
1549
|
function Z(r, e, t) {
|
|
@@ -1553,7 +1553,7 @@ function Z(r, e, t) {
|
|
|
1553
1553
|
function G(r, e) {
|
|
1554
1554
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(r.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
1555
1555
|
}
|
|
1556
|
-
function
|
|
1556
|
+
function Zs(r, e, t) {
|
|
1557
1557
|
let n = !1, s = !1, i = !1;
|
|
1558
1558
|
for (let l = 0, u = e.length; l < u; l++) {
|
|
1559
1559
|
const h = e[l];
|
|
@@ -1585,7 +1585,7 @@ function $s(r, e, t) {
|
|
|
1585
1585
|
return n && (r.morphAttributes.position = u), s && (r.morphAttributes.normal = h), i && (r.morphAttributes.color = p), r.morphTargetsRelative = !0, r;
|
|
1586
1586
|
});
|
|
1587
1587
|
}
|
|
1588
|
-
function
|
|
1588
|
+
function Qs(r, e) {
|
|
1589
1589
|
if (r.updateMorphTargets(), e.weights !== void 0)
|
|
1590
1590
|
for (let t = 0, n = e.weights.length; t < n; t++)
|
|
1591
1591
|
r.morphTargetInfluences[t] = e.weights[t];
|
|
@@ -1599,15 +1599,15 @@ function Zs(r, e) {
|
|
|
1599
1599
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
1600
1600
|
}
|
|
1601
1601
|
}
|
|
1602
|
-
function
|
|
1602
|
+
function Js(r) {
|
|
1603
1603
|
let e;
|
|
1604
1604
|
const t = r.extensions && r.extensions[b.KHR_DRACO_MESH_COMPRESSION];
|
|
1605
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
1605
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + Me(t.attributes) : e = r.indices + ":" + Me(r.attributes) + ":" + r.mode, r.targets !== void 0)
|
|
1606
1606
|
for (let n = 0, s = r.targets.length; n < s; n++)
|
|
1607
|
-
e += ":" +
|
|
1607
|
+
e += ":" + Me(r.targets[n]);
|
|
1608
1608
|
return e;
|
|
1609
1609
|
}
|
|
1610
|
-
function
|
|
1610
|
+
function Me(r) {
|
|
1611
1611
|
let e = "";
|
|
1612
1612
|
const t = Object.keys(r).sort();
|
|
1613
1613
|
for (let n = 0, s = t.length; n < s; n++)
|
|
@@ -1628,13 +1628,13 @@ function Ie(r) {
|
|
|
1628
1628
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
1629
1629
|
}
|
|
1630
1630
|
}
|
|
1631
|
-
function
|
|
1631
|
+
function en(r) {
|
|
1632
1632
|
return r.search(/\.jpe?g($|\?)/i) > 0 || r.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : r.search(/\.webp($|\?)/i) > 0 || r.search(/^data\:image\/webp/) === 0 ? "image/webp" : r.search(/\.ktx2($|\?)/i) > 0 || r.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
|
|
1633
1633
|
}
|
|
1634
|
-
const
|
|
1635
|
-
class
|
|
1634
|
+
const tn = new se();
|
|
1635
|
+
class sn {
|
|
1636
1636
|
constructor(e = {}, t = {}) {
|
|
1637
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
1637
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new As(), 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 = {};
|
|
1638
1638
|
let n = !1, s = -1, i = !1, o = -1;
|
|
1639
1639
|
if (typeof navigator < "u") {
|
|
1640
1640
|
const c = navigator.userAgent;
|
|
@@ -1642,7 +1642,7 @@ class tn {
|
|
|
1642
1642
|
const a = c.match(/Version\/(\d+)/);
|
|
1643
1643
|
s = n && a ? parseInt(a[1], 10) : -1, i = c.indexOf("Firefox") > -1, o = i ? c.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
1644
1644
|
}
|
|
1645
|
-
typeof createImageBitmap > "u" || n && s < 17 || i && o < 98 ? this.textureLoader = new
|
|
1645
|
+
typeof createImageBitmap > "u" || n && s < 17 || i && o < 98 ? this.textureLoader = new Mt(this.options.manager) : this.textureLoader = new Rt(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new de(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
1646
1646
|
}
|
|
1647
1647
|
setExtensions(e) {
|
|
1648
1648
|
this.extensions = e;
|
|
@@ -1892,15 +1892,15 @@ class tn {
|
|
|
1892
1892
|
if (m && m !== h) {
|
|
1893
1893
|
const f = Math.floor(p / m), g = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + f + ":" + s.count;
|
|
1894
1894
|
let T = t.cache.get(g);
|
|
1895
|
-
T || (w = new l(c, f * m, s.count * m / u), T = new
|
|
1895
|
+
T || (w = new l(c, f * m, s.count * m / u), T = new St(w, m / u), t.cache.add(g, T)), d = new Lt(T, a, p % m / u, _);
|
|
1896
1896
|
} else
|
|
1897
1897
|
c === null ? w = new l(s.count * a) : w = new l(c, p, s.count * a), d = new oe(w, a, _);
|
|
1898
1898
|
if (s.sparse !== void 0) {
|
|
1899
1899
|
const f = xe.SCALAR, g = te[s.sparse.indices.componentType], T = s.sparse.indices.byteOffset || 0, y = s.sparse.values.byteOffset || 0, E = new g(o[1], T, s.sparse.count * f), x = new l(o[2], y, s.sparse.count * a);
|
|
1900
1900
|
c !== null && (d = new oe(d.array.slice(), d.itemSize, d.normalized)), d.normalized = !1;
|
|
1901
|
-
for (let
|
|
1902
|
-
const C = E[
|
|
1903
|
-
if (d.setX(C, x[
|
|
1901
|
+
for (let R = 0, P = E.length; R < P; R++) {
|
|
1902
|
+
const C = E[R];
|
|
1903
|
+
if (d.setX(C, x[R * a]), a >= 2 && d.setY(C, x[R * a + 1]), a >= 3 && d.setZ(C, x[R * a + 2]), a >= 4 && d.setW(C, x[R * a + 3]), a >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1904
1904
|
}
|
|
1905
1905
|
d.normalized = _;
|
|
1906
1906
|
}
|
|
@@ -1930,7 +1930,7 @@ class tn {
|
|
|
1930
1930
|
const l = this.loadImageSource(t, n).then(function(u) {
|
|
1931
1931
|
u.flipY = !1, u.name = o.name || c.name || "", u.name === "" && typeof c.uri == "string" && c.uri.startsWith("data:image/") === !1 && (u.name = c.uri);
|
|
1932
1932
|
const p = (i.samplers || {})[o.sampler] || {};
|
|
1933
|
-
return u.magFilter =
|
|
1933
|
+
return u.magFilter = Ye[p.magFilter] || Ce, u.minFilter = Ye[p.minFilter] || at, u.wrapS = qe[p.wrapS] || Oe, u.wrapT = qe[p.wrapT] || Oe, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== ct && u.minFilter !== Ce, s.associations.set(u, { textures: e }), u;
|
|
1934
1934
|
}).catch(function() {
|
|
1935
1935
|
return null;
|
|
1936
1936
|
});
|
|
@@ -1954,12 +1954,12 @@ class tn {
|
|
|
1954
1954
|
return new Promise(function(p, m) {
|
|
1955
1955
|
let _ = p;
|
|
1956
1956
|
t.isImageBitmapLoader === !0 && (_ = function(w) {
|
|
1957
|
-
const d = new
|
|
1957
|
+
const d = new je(w);
|
|
1958
1958
|
d.needsUpdate = !0, p(d);
|
|
1959
1959
|
}), t.load(re.resolveURL(h, i.path), _, void 0, m);
|
|
1960
1960
|
});
|
|
1961
1961
|
}).then(function(h) {
|
|
1962
|
-
return l === !0 && c.revokeObjectURL(a), G(h, o), h.userData.mimeType = o.mimeType ||
|
|
1962
|
+
return l === !0 && c.revokeObjectURL(a), G(h, o), h.userData.mimeType = o.mimeType || en(o.uri), h;
|
|
1963
1963
|
}).catch(function(h) {
|
|
1964
1964
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", a), h;
|
|
1965
1965
|
});
|
|
@@ -2006,11 +2006,11 @@ class tn {
|
|
|
2006
2006
|
if (e.isPoints) {
|
|
2007
2007
|
const c = "PointsMaterial:" + n.uuid;
|
|
2008
2008
|
let a = this.cache.get(c);
|
|
2009
|
-
a || (a = new
|
|
2009
|
+
a || (a = new It(), Te.prototype.copy.call(a, n), a.color.copy(n.color), a.map = n.map, a.sizeAttenuation = !1, this.cache.add(c, a)), n = a;
|
|
2010
2010
|
} else if (e.isLine) {
|
|
2011
2011
|
const c = "LineBasicMaterial:" + n.uuid;
|
|
2012
2012
|
let a = this.cache.get(c);
|
|
2013
|
-
a || (a = new
|
|
2013
|
+
a || (a = new Nt(), Te.prototype.copy.call(a, n), a.color.copy(n.color), a.map = n.map, this.cache.add(c, a)), n = a;
|
|
2014
2014
|
}
|
|
2015
2015
|
if (s || i || o) {
|
|
2016
2016
|
let c = "ClonedMaterial:" + n.uuid + ":";
|
|
@@ -2021,7 +2021,7 @@ class tn {
|
|
|
2021
2021
|
e.material = n;
|
|
2022
2022
|
}
|
|
2023
2023
|
getMaterialType() {
|
|
2024
|
-
return
|
|
2024
|
+
return lt;
|
|
2025
2025
|
}
|
|
2026
2026
|
/**
|
|
2027
2027
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -2049,7 +2049,7 @@ class tn {
|
|
|
2049
2049
|
return p.extendMaterialParams && p.extendMaterialParams(e, c);
|
|
2050
2050
|
})));
|
|
2051
2051
|
}
|
|
2052
|
-
i.doubleSided === !0 && (c.side =
|
|
2052
|
+
i.doubleSided === !0 && (c.side = vt);
|
|
2053
2053
|
const u = i.alphaMode || Ae.OPAQUE;
|
|
2054
2054
|
if (u === Ae.BLEND ? (c.transparent = !0, c.depthWrite = !1) : (c.transparent = !1, u === Ae.MASK && (c.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== ie && (l.push(t.assignTexture(c, "normalMap", i.normalTexture)), c.normalScale = new k(1, 1), i.normalTexture.scale !== void 0)) {
|
|
2055
2055
|
const h = i.normalTexture.scale;
|
|
@@ -2072,7 +2072,7 @@ class tn {
|
|
|
2072
2072
|
* @return {string}
|
|
2073
2073
|
*/
|
|
2074
2074
|
createUniqueName(e) {
|
|
2075
|
-
const t =
|
|
2075
|
+
const t = Ht.sanitizeNodeName(e || "");
|
|
2076
2076
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
2077
2077
|
}
|
|
2078
2078
|
/**
|
|
@@ -2088,17 +2088,17 @@ class tn {
|
|
|
2088
2088
|
const t = this, n = this.extensions, s = this.primitiveCache;
|
|
2089
2089
|
function i(c) {
|
|
2090
2090
|
return n[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c, t).then(function(a) {
|
|
2091
|
-
return
|
|
2091
|
+
return $e(a, c, t);
|
|
2092
2092
|
});
|
|
2093
2093
|
}
|
|
2094
2094
|
const o = [];
|
|
2095
2095
|
for (let c = 0, a = e.length; c < a; c++) {
|
|
2096
|
-
const l = e[c], u =
|
|
2096
|
+
const l = e[c], u = Js(l), h = s[u];
|
|
2097
2097
|
if (h)
|
|
2098
2098
|
o.push(h.promise);
|
|
2099
2099
|
else {
|
|
2100
2100
|
let p;
|
|
2101
|
-
l.extensions && l.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? p = i(l) : p =
|
|
2101
|
+
l.extensions && l.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? p = i(l) : p = $e(new rt(), l, t), s[u] = { primitive: l, promise: p }, o.push(p);
|
|
2102
2102
|
}
|
|
2103
2103
|
}
|
|
2104
2104
|
return Promise.all(o);
|
|
@@ -2113,7 +2113,7 @@ class tn {
|
|
|
2113
2113
|
loadMesh(e) {
|
|
2114
2114
|
const t = this, n = this.json, s = this.extensions, i = n.meshes[e], o = i.primitives, c = [];
|
|
2115
2115
|
for (let a = 0, l = o.length; a < l; a++) {
|
|
2116
|
-
const u = o[a].material === void 0 ?
|
|
2116
|
+
const u = o[a].material === void 0 ? $s(this.cache) : this.getDependency("material", o[a].material);
|
|
2117
2117
|
c.push(u);
|
|
2118
2118
|
}
|
|
2119
2119
|
return c.push(t.loadGeometries(o)), Promise.all(c).then(function(a) {
|
|
@@ -2123,18 +2123,18 @@ class tn {
|
|
|
2123
2123
|
let f;
|
|
2124
2124
|
const g = l[m];
|
|
2125
2125
|
if (d.mode === I.TRIANGLES || d.mode === I.TRIANGLE_STRIP || d.mode === I.TRIANGLE_FAN || d.mode === void 0)
|
|
2126
|
-
f = i.isSkinnedMesh === !0 ? new
|
|
2126
|
+
f = i.isSkinnedMesh === !0 ? new Ft(w, g) : new Ut(w, g), f.isSkinnedMesh === !0 && f.normalizeSkinWeights(), d.mode === I.TRIANGLE_STRIP ? f.geometry = Xe(f.geometry, it) : d.mode === I.TRIANGLE_FAN && (f.geometry = Xe(f.geometry, De));
|
|
2127
2127
|
else if (d.mode === I.LINES)
|
|
2128
|
-
f = new Ut(w, g);
|
|
2129
|
-
else if (d.mode === I.LINE_STRIP)
|
|
2130
2128
|
f = new jt(w, g);
|
|
2131
|
-
else if (d.mode === I.
|
|
2129
|
+
else if (d.mode === I.LINE_STRIP)
|
|
2132
2130
|
f = new Gt(w, g);
|
|
2133
|
-
else if (d.mode === I.
|
|
2131
|
+
else if (d.mode === I.LINE_LOOP)
|
|
2134
2132
|
f = new Bt(w, g);
|
|
2133
|
+
else if (d.mode === I.POINTS)
|
|
2134
|
+
f = new zt(w, g);
|
|
2135
2135
|
else
|
|
2136
2136
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + d.mode);
|
|
2137
|
-
Object.keys(f.geometry.morphAttributes).length > 0 &&
|
|
2137
|
+
Object.keys(f.geometry.morphAttributes).length > 0 && Qs(f, i), f.name = t.createUniqueName(i.name || "mesh_" + e), G(f, i), d.extensions && Z(s, f, d), t.assignFinalMaterial(f), h.push(f);
|
|
2138
2138
|
}
|
|
2139
2139
|
for (let m = 0, _ = h.length; m < _; m++)
|
|
2140
2140
|
t.associations.set(h[m], {
|
|
@@ -2164,7 +2164,7 @@ class tn {
|
|
|
2164
2164
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
2165
2165
|
return;
|
|
2166
2166
|
}
|
|
2167
|
-
return n.type === "perspective" ? t = new
|
|
2167
|
+
return n.type === "perspective" ? t = new Kt(nt.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (t = new Wt(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), n.name && (t.name = this.createUniqueName(n.name)), G(t, n), Promise.resolve(t);
|
|
2168
2168
|
}
|
|
2169
2169
|
/**
|
|
2170
2170
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -2188,7 +2188,7 @@ class tn {
|
|
|
2188
2188
|
} else
|
|
2189
2189
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[l]);
|
|
2190
2190
|
}
|
|
2191
|
-
return new
|
|
2191
|
+
return new Xt(c, a);
|
|
2192
2192
|
});
|
|
2193
2193
|
}
|
|
2194
2194
|
/**
|
|
@@ -2213,15 +2213,15 @@ class tn {
|
|
|
2213
2213
|
]).then(function(h) {
|
|
2214
2214
|
const p = h[0], m = h[1], _ = h[2], w = h[3], d = h[4], f = [];
|
|
2215
2215
|
for (let g = 0, T = p.length; g < T; g++) {
|
|
2216
|
-
const y = p[g], E = m[g], x = _[g],
|
|
2216
|
+
const y = p[g], E = m[g], x = _[g], R = w[g], P = d[g];
|
|
2217
2217
|
if (y === void 0) continue;
|
|
2218
2218
|
y.updateMatrix && y.updateMatrix();
|
|
2219
|
-
const C = n._createAnimationTracks(y, E, x,
|
|
2219
|
+
const C = n._createAnimationTracks(y, E, x, R, P);
|
|
2220
2220
|
if (C)
|
|
2221
2221
|
for (let z = 0; z < C.length; z++)
|
|
2222
2222
|
f.push(C[z]);
|
|
2223
2223
|
}
|
|
2224
|
-
return new
|
|
2224
|
+
return new Vt(i, void 0, f);
|
|
2225
2225
|
});
|
|
2226
2226
|
}
|
|
2227
2227
|
createNodeMesh(e) {
|
|
@@ -2254,7 +2254,7 @@ class tn {
|
|
|
2254
2254
|
]).then(function(l) {
|
|
2255
2255
|
const u = l[0], h = l[1], p = l[2];
|
|
2256
2256
|
p !== null && u.traverse(function(m) {
|
|
2257
|
-
m.isSkinnedMesh && m.bind(p,
|
|
2257
|
+
m.isSkinnedMesh && m.bind(p, tn);
|
|
2258
2258
|
});
|
|
2259
2259
|
for (let m = 0, _ = h.length; m < _; m++)
|
|
2260
2260
|
u.add(h[m]);
|
|
@@ -2278,7 +2278,7 @@ class tn {
|
|
|
2278
2278
|
c.push(l);
|
|
2279
2279
|
}), this.nodeCache[e] = Promise.all(c).then(function(l) {
|
|
2280
2280
|
let u;
|
|
2281
|
-
if (i.isBone === !0 ? u = new
|
|
2281
|
+
if (i.isBone === !0 ? u = new Yt() : l.length > 1 ? u = new we() : l.length === 1 ? u = l[0] : u = new ve(), u !== l[0])
|
|
2282
2282
|
for (let h = 0, p = l.length; h < p; h++)
|
|
2283
2283
|
u.add(l[h]);
|
|
2284
2284
|
if (i.name && (u.userData.name = i.name, u.name = o), G(u, i), i.extensions && Z(n, u, i), i.matrix !== void 0) {
|
|
@@ -2314,7 +2314,7 @@ class tn {
|
|
|
2314
2314
|
const l = (u) => {
|
|
2315
2315
|
const h = /* @__PURE__ */ new Map();
|
|
2316
2316
|
for (const [p, m] of s.associations)
|
|
2317
|
-
(p instanceof Te || p instanceof
|
|
2317
|
+
(p instanceof Te || p instanceof je) && h.set(p, m);
|
|
2318
2318
|
return u.traverse((p) => {
|
|
2319
2319
|
const m = s.associations.get(p);
|
|
2320
2320
|
m != null && h.set(p, m);
|
|
@@ -2331,29 +2331,29 @@ class tn {
|
|
|
2331
2331
|
let l;
|
|
2332
2332
|
switch (K[i.path]) {
|
|
2333
2333
|
case K.weights:
|
|
2334
|
-
l =
|
|
2334
|
+
l = Be;
|
|
2335
2335
|
break;
|
|
2336
2336
|
case K.rotation:
|
|
2337
|
-
l =
|
|
2337
|
+
l = ze;
|
|
2338
2338
|
break;
|
|
2339
2339
|
case K.translation:
|
|
2340
2340
|
case K.scale:
|
|
2341
|
-
l =
|
|
2341
|
+
l = Ge;
|
|
2342
2342
|
break;
|
|
2343
2343
|
default:
|
|
2344
2344
|
switch (n.itemSize) {
|
|
2345
2345
|
case 1:
|
|
2346
|
-
l =
|
|
2346
|
+
l = Be;
|
|
2347
2347
|
break;
|
|
2348
2348
|
case 2:
|
|
2349
2349
|
case 3:
|
|
2350
2350
|
default:
|
|
2351
|
-
l =
|
|
2351
|
+
l = Ge;
|
|
2352
2352
|
break;
|
|
2353
2353
|
}
|
|
2354
2354
|
break;
|
|
2355
2355
|
}
|
|
2356
|
-
const u = s.interpolation !== void 0 ?
|
|
2356
|
+
const u = s.interpolation !== void 0 ? qs[s.interpolation] : ht, h = this._getArrayFromAccessor(n);
|
|
2357
2357
|
for (let p = 0, m = a.length; p < m; p++) {
|
|
2358
2358
|
const _ = new l(
|
|
2359
2359
|
a[p] + "." + K[i.path],
|
|
@@ -2377,13 +2377,13 @@ class tn {
|
|
|
2377
2377
|
}
|
|
2378
2378
|
_createCubicSplineTrackInterpolant(e) {
|
|
2379
2379
|
e.createInterpolant = function(n) {
|
|
2380
|
-
const s = this instanceof
|
|
2380
|
+
const s = this instanceof ze ? Ys : pt;
|
|
2381
2381
|
return new s(this.times, this.values, this.getValueSize() / 3, n);
|
|
2382
2382
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
2383
2383
|
}
|
|
2384
2384
|
}
|
|
2385
|
-
function
|
|
2386
|
-
const n = e.attributes, s = new
|
|
2385
|
+
function nn(r, e, t) {
|
|
2386
|
+
const n = e.attributes, s = new Qt();
|
|
2387
2387
|
if (n.POSITION !== void 0) {
|
|
2388
2388
|
const c = t.json.accessors[n.POSITION], a = c.min, l = c.max;
|
|
2389
2389
|
if (a !== void 0 && l !== void 0) {
|
|
@@ -2420,10 +2420,10 @@ function sn(r, e, t) {
|
|
|
2420
2420
|
s.expandByVector(c);
|
|
2421
2421
|
}
|
|
2422
2422
|
r.boundingBox = s;
|
|
2423
|
-
const o = new
|
|
2423
|
+
const o = new Jt();
|
|
2424
2424
|
s.getCenter(o.center), o.radius = s.min.distanceTo(s.max) / 2, r.boundingSphere = o;
|
|
2425
2425
|
}
|
|
2426
|
-
function
|
|
2426
|
+
function $e(r, e, t) {
|
|
2427
2427
|
const n = e.attributes, s = [];
|
|
2428
2428
|
function i(o, c) {
|
|
2429
2429
|
return t.getDependency("accessor", o).then(function(a) {
|
|
@@ -2440,12 +2440,12 @@ function qe(r, e, t) {
|
|
|
2440
2440
|
});
|
|
2441
2441
|
s.push(o);
|
|
2442
2442
|
}
|
|
2443
|
-
return
|
|
2444
|
-
return e.targets !== void 0 ?
|
|
2443
|
+
return Pe.workingColorSpace !== U && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Pe.workingColorSpace}" not supported.`), G(r, e), nn(r, e, t), Promise.all(s).then(function() {
|
|
2444
|
+
return e.targets !== void 0 ? Zs(r, e.targets, t) : r;
|
|
2445
2445
|
});
|
|
2446
2446
|
}
|
|
2447
|
-
const
|
|
2448
|
-
class
|
|
2447
|
+
const Ze = new S(), on = new le(), Qe = new S();
|
|
2448
|
+
class rn extends ve {
|
|
2449
2449
|
/**
|
|
2450
2450
|
* Constructs a new CSS3D object.
|
|
2451
2451
|
*
|
|
@@ -2462,7 +2462,7 @@ class on extends Ne {
|
|
|
2462
2462
|
return super.copy(e, t), this.element = e.element.cloneNode(!0), this;
|
|
2463
2463
|
}
|
|
2464
2464
|
}
|
|
2465
|
-
class
|
|
2465
|
+
class Tn extends rn {
|
|
2466
2466
|
/**
|
|
2467
2467
|
* Constructs a new CSS3D sprite object.
|
|
2468
2468
|
*
|
|
@@ -2475,8 +2475,8 @@ class _n extends on {
|
|
|
2475
2475
|
return super.copy(e, t), this.rotation2D = e.rotation2D, this;
|
|
2476
2476
|
}
|
|
2477
2477
|
}
|
|
2478
|
-
const F = new se(),
|
|
2479
|
-
class
|
|
2478
|
+
const F = new se(), an = new se();
|
|
2479
|
+
class wn {
|
|
2480
2480
|
/**
|
|
2481
2481
|
* Constructs a new CSS3D renderer.
|
|
2482
2482
|
*
|
|
@@ -2503,8 +2503,8 @@ class Tn {
|
|
|
2503
2503
|
f.view && f.view.enabled ? (l.style.transform = `translate( ${-f.view.offsetX * (n / f.view.width)}px, ${-f.view.offsetY * (s / f.view.height)}px )`, l.style.transform += `scale( ${f.view.fullWidth / f.view.width}, ${f.view.fullHeight / f.view.height} )`) : l.style.transform = "", d.matrixWorldAutoUpdate === !0 && d.updateMatrixWorld(), f.parent === null && f.matrixWorldAutoUpdate === !0 && f.updateMatrixWorld();
|
|
2504
2504
|
let T, y;
|
|
2505
2505
|
f.isOrthographicCamera && (T = -(f.right + f.left) / 2, y = (f.top + f.bottom) / 2);
|
|
2506
|
-
const E = f.view && f.view.enabled ? f.view.height / f.view.fullHeight : 1, x = f.isOrthographicCamera ? `scale( ${E} )scale(` + g + ")translate(" + h(T) + "px," + h(y) + "px)" + p(f.matrixWorldInverse) : `scale( ${E} )translateZ(` + g + "px)" + p(f.matrixWorldInverse),
|
|
2507
|
-
c.camera.style !==
|
|
2506
|
+
const E = f.view && f.view.enabled ? f.view.height / f.view.fullHeight : 1, x = f.isOrthographicCamera ? `scale( ${E} )scale(` + g + ")translate(" + h(T) + "px," + h(y) + "px)" + p(f.matrixWorldInverse) : `scale( ${E} )translateZ(` + g + "px)" + p(f.matrixWorldInverse), P = (f.isPerspectiveCamera ? "perspective(" + g + "px) " : "") + x + "translate(" + i + "px," + o + "px)";
|
|
2507
|
+
c.camera.style !== P && (u.style.transform = P, c.camera.style = P), w(d, d, f);
|
|
2508
2508
|
}, this.setSize = function(d, f) {
|
|
2509
2509
|
n = d, s = f, i = n / 2, o = s / 2, a.style.width = d + "px", a.style.height = f + "px", l.style.width = d + "px", l.style.height = f + "px", u.style.width = d + "px", u.style.height = f + "px";
|
|
2510
2510
|
};
|
|
@@ -2534,12 +2534,12 @@ class Tn {
|
|
|
2534
2534
|
if (E.style.display = y === !0 ? "" : "none", y === !0) {
|
|
2535
2535
|
d.onBeforeRender(t, f, g);
|
|
2536
2536
|
let x;
|
|
2537
|
-
d.isCSS3DSprite ? (F.copy(g.matrixWorldInverse), F.transpose(), d.rotation2D !== 0 && F.multiply(
|
|
2538
|
-
const
|
|
2539
|
-
if (
|
|
2537
|
+
d.isCSS3DSprite ? (F.copy(g.matrixWorldInverse), F.transpose(), d.rotation2D !== 0 && F.multiply(an.makeRotationZ(d.rotation2D)), d.matrixWorld.decompose(Ze, on, Qe), F.setPosition(Ze), F.scale(Qe), F.elements[3] = 0, F.elements[7] = 0, F.elements[11] = 0, F.elements[15] = 1, x = m(F)) : x = m(d.matrixWorld);
|
|
2538
|
+
const R = c.objects.get(d);
|
|
2539
|
+
if (R === void 0 || R.style !== x) {
|
|
2540
2540
|
E.style.transform = x;
|
|
2541
|
-
const
|
|
2542
|
-
c.objects.set(d,
|
|
2541
|
+
const P = { style: x };
|
|
2542
|
+
c.objects.set(d, P);
|
|
2543
2543
|
}
|
|
2544
2544
|
E.parentNode !== u && u.appendChild(E), d.onAfterRender(t, f, g);
|
|
2545
2545
|
}
|
|
@@ -2601,49 +2601,49 @@ ae.Panel = function(r, e, t) {
|
|
|
2601
2601
|
}
|
|
2602
2602
|
};
|
|
2603
2603
|
};
|
|
2604
|
-
function
|
|
2605
|
-
return new
|
|
2606
|
-
}
|
|
2607
|
-
function bn(r = 150, ...e) {
|
|
2608
|
-
return new es(r, r / 10, ...e);
|
|
2604
|
+
function bn(r) {
|
|
2605
|
+
return new es(r);
|
|
2609
2606
|
}
|
|
2610
|
-
function En(r) {
|
|
2611
|
-
return new ts(r,
|
|
2607
|
+
function En(r = 150, ...e) {
|
|
2608
|
+
return new ts(r, r / 10, ...e);
|
|
2612
2609
|
}
|
|
2613
|
-
function xn(r
|
|
2614
|
-
return new
|
|
2610
|
+
function xn(r) {
|
|
2611
|
+
return new ss(r, 16776960);
|
|
2615
2612
|
}
|
|
2616
2613
|
function An(r, e) {
|
|
2617
|
-
return new
|
|
2614
|
+
return new dt(r, e);
|
|
2615
|
+
}
|
|
2616
|
+
function Mn(r, e) {
|
|
2617
|
+
return new ws(r, e);
|
|
2618
2618
|
}
|
|
2619
2619
|
function Rn() {
|
|
2620
|
-
const r = new
|
|
2620
|
+
const r = new ns(), e = new k(0, 0);
|
|
2621
2621
|
return {
|
|
2622
2622
|
raycaster: r,
|
|
2623
2623
|
pointer: e
|
|
2624
2624
|
};
|
|
2625
2625
|
}
|
|
2626
|
-
function
|
|
2627
|
-
return new
|
|
2626
|
+
function Sn(r = 10) {
|
|
2627
|
+
return new is(r);
|
|
2628
2628
|
}
|
|
2629
|
-
function
|
|
2630
|
-
return r.normalize(), new
|
|
2629
|
+
function Ln(r = new S(1, 1, 1), e = new S(10, 10, 10), t = 5, n = 16776960) {
|
|
2630
|
+
return r.normalize(), new os(r, e, t, n);
|
|
2631
2631
|
}
|
|
2632
|
-
function
|
|
2632
|
+
function Dn() {
|
|
2633
2633
|
const r = new ae();
|
|
2634
2634
|
return r.dom.style.cssText = "position:absolute;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", r;
|
|
2635
2635
|
}
|
|
2636
|
-
const
|
|
2636
|
+
const cn = (r) => {
|
|
2637
2637
|
r.geometry && r.geometry.dispose(), r.material && (Array.isArray(r.material) ? r.material.forEach((e) => {
|
|
2638
|
-
|
|
2639
|
-
}) :
|
|
2638
|
+
Je(e);
|
|
2639
|
+
}) : Je(r.material)), r.children && r.children.forEach((e) => cn(e));
|
|
2640
2640
|
};
|
|
2641
|
-
function
|
|
2641
|
+
function Je(r) {
|
|
2642
2642
|
for (const e in r)
|
|
2643
2643
|
r[e] && r[e].isTexture && r[e].dispose();
|
|
2644
2644
|
r.dispose();
|
|
2645
2645
|
}
|
|
2646
|
-
const
|
|
2646
|
+
const Re = {};
|
|
2647
2647
|
async function Pn(r, e = 50) {
|
|
2648
2648
|
const t = {
|
|
2649
2649
|
type: r.type,
|
|
@@ -2680,7 +2680,7 @@ async function Pn(r, e = 50) {
|
|
|
2680
2680
|
}
|
|
2681
2681
|
return t;
|
|
2682
2682
|
}
|
|
2683
|
-
function
|
|
2683
|
+
function Cn(r) {
|
|
2684
2684
|
const e = {
|
|
2685
2685
|
type: r.type,
|
|
2686
2686
|
name: r.name,
|
|
@@ -2715,7 +2715,7 @@ function Dn(r) {
|
|
|
2715
2715
|
}
|
|
2716
2716
|
return e;
|
|
2717
2717
|
}
|
|
2718
|
-
async function
|
|
2718
|
+
async function ln(r, e = 50) {
|
|
2719
2719
|
const t = [];
|
|
2720
2720
|
let n;
|
|
2721
2721
|
switch (r.type) {
|
|
@@ -2758,7 +2758,7 @@ async function cn(r, e = 50) {
|
|
|
2758
2758
|
}
|
|
2759
2759
|
return n;
|
|
2760
2760
|
}
|
|
2761
|
-
function
|
|
2761
|
+
function On(r) {
|
|
2762
2762
|
const e = [];
|
|
2763
2763
|
let t;
|
|
2764
2764
|
switch (r.type) {
|
|
@@ -2853,15 +2853,15 @@ function me(r) {
|
|
|
2853
2853
|
};
|
|
2854
2854
|
}
|
|
2855
2855
|
function ge(r) {
|
|
2856
|
-
if (
|
|
2856
|
+
if (Re[r.name]) return Re[r.name];
|
|
2857
2857
|
const { type: e, ...t } = r, n = e || "MeshStandardMaterial", s = new A[n]({ ...t });
|
|
2858
2858
|
if (r.map) {
|
|
2859
2859
|
const i = new A.TextureLoader().load(r.map);
|
|
2860
2860
|
s.map = i;
|
|
2861
2861
|
}
|
|
2862
|
-
return s.needsUpdate = !0,
|
|
2862
|
+
return s.needsUpdate = !0, Re[r.name] = s, s;
|
|
2863
2863
|
}
|
|
2864
|
-
class
|
|
2864
|
+
class hn {
|
|
2865
2865
|
constructor() {
|
|
2866
2866
|
this.stats = {
|
|
2867
2867
|
hits: 0,
|
|
@@ -2981,7 +2981,7 @@ class ln {
|
|
|
2981
2981
|
}), console.groupEnd();
|
|
2982
2982
|
}
|
|
2983
2983
|
}
|
|
2984
|
-
const W = new
|
|
2984
|
+
const W = new hn();
|
|
2985
2985
|
class ye {
|
|
2986
2986
|
/**
|
|
2987
2987
|
* 异步操作并支持重试
|
|
@@ -3085,15 +3085,15 @@ class ce extends Error {
|
|
|
3085
3085
|
);
|
|
3086
3086
|
}
|
|
3087
3087
|
}
|
|
3088
|
-
const
|
|
3089
|
-
class
|
|
3088
|
+
const et = 4;
|
|
3089
|
+
class tt {
|
|
3090
3090
|
/**
|
|
3091
3091
|
* 构造函数
|
|
3092
3092
|
* @param {string} dbName - 数据库名称
|
|
3093
3093
|
* @param {CacheOptions} options - 缓存配置选项
|
|
3094
3094
|
*/
|
|
3095
3095
|
constructor(e = "threeJsIDBCache", t = {}) {
|
|
3096
|
-
this.version =
|
|
3096
|
+
this.version = et, this.dbName = e, this.options = {
|
|
3097
3097
|
maxSize: t.maxSize || 500 * 1024 * 1024,
|
|
3098
3098
|
// 默认 500MB
|
|
3099
3099
|
maxEntries: t.maxEntries || 50,
|
|
@@ -3103,10 +3103,10 @@ class et {
|
|
|
3103
3103
|
}, this.dbInit();
|
|
3104
3104
|
}
|
|
3105
3105
|
dbInit() {
|
|
3106
|
-
this.db = new
|
|
3106
|
+
this.db = new rs(this.dbName), this.db.version(this.version).stores({
|
|
3107
3107
|
models: "&path, version, timestamp, accessCount, size"
|
|
3108
3108
|
}).upgrade(async (e) => {
|
|
3109
|
-
console.log("[ IDBCache 版本更新 ] ====> version",
|
|
3109
|
+
console.log("[ IDBCache 版本更新 ] ====> version", et);
|
|
3110
3110
|
const t = e.table("models"), n = await t.toArray();
|
|
3111
3111
|
for (const s of n)
|
|
3112
3112
|
s.data instanceof ArrayBuffer || await t.delete(s.path);
|
|
@@ -3222,15 +3222,15 @@ class et {
|
|
|
3222
3222
|
await this.db.table("models").delete(e);
|
|
3223
3223
|
}
|
|
3224
3224
|
}
|
|
3225
|
-
function
|
|
3225
|
+
function mt(r) {
|
|
3226
3226
|
const { geometries: e, materials: t, hierarchy: n } = r, s = /* @__PURE__ */ new Map();
|
|
3227
3227
|
e.forEach((a, l) => {
|
|
3228
|
-
const u =
|
|
3228
|
+
const u = un(a);
|
|
3229
3229
|
s.set(l, u);
|
|
3230
3230
|
});
|
|
3231
3231
|
const i = /* @__PURE__ */ new Map();
|
|
3232
3232
|
t.forEach((a, l) => {
|
|
3233
|
-
const u =
|
|
3233
|
+
const u = dn(a);
|
|
3234
3234
|
i.set(l, u);
|
|
3235
3235
|
});
|
|
3236
3236
|
const o = new A.Group();
|
|
@@ -3242,7 +3242,7 @@ function pt(r) {
|
|
|
3242
3242
|
const u = a.geometryIndex >= 0 ? s.get(a.geometryIndex) : null, h = a.materialIndex >= 0 ? i.get(a.materialIndex) : null;
|
|
3243
3243
|
l = new A.Mesh(u, h);
|
|
3244
3244
|
} else a.type === "Group" ? l = new A.Group() : a.type === "Object3D" ? l = new A.Object3D() : l = new A.Object3D();
|
|
3245
|
-
l.name = a.name, l.position.fromArray(a.position), l.rotation.fromArray(a.rotation), l.scale.fromArray(a.scale), l.visible = a.visible, c.set(a.id, l);
|
|
3245
|
+
l.name = a.name, l.position.fromArray(a.position), l.rotation.fromArray(a.rotation), l.scale.fromArray(a.scale), l.visible = a.visible, l.userData = a.userData || {}, c.set(a.id, l);
|
|
3246
3246
|
}), n.forEach((a) => {
|
|
3247
3247
|
const l = c.get(a.id);
|
|
3248
3248
|
if (a.parentId !== null) {
|
|
@@ -3252,7 +3252,7 @@ function pt(r) {
|
|
|
3252
3252
|
o.add(l);
|
|
3253
3253
|
}), o;
|
|
3254
3254
|
}
|
|
3255
|
-
function
|
|
3255
|
+
function un(r) {
|
|
3256
3256
|
const e = new A.BufferGeometry();
|
|
3257
3257
|
for (const t in r.attributes) {
|
|
3258
3258
|
const n = r.attributes[t], s = n.array;
|
|
@@ -3278,7 +3278,7 @@ function hn(r) {
|
|
|
3278
3278
|
}
|
|
3279
3279
|
return e;
|
|
3280
3280
|
}
|
|
3281
|
-
function
|
|
3281
|
+
function dn(r) {
|
|
3282
3282
|
let e;
|
|
3283
3283
|
const t = {
|
|
3284
3284
|
color: r.color !== void 0 ? r.color : 16777215,
|
|
@@ -3321,7 +3321,7 @@ function un(r) {
|
|
|
3321
3321
|
}
|
|
3322
3322
|
return e.uuid = r.uuid, e;
|
|
3323
3323
|
}
|
|
3324
|
-
class
|
|
3324
|
+
class kn {
|
|
3325
3325
|
constructor() {
|
|
3326
3326
|
this.geometries = [], this.materials = [], this.hierarchy = [], this.geometryMap = /* @__PURE__ */ new Map(), this.materialMap = /* @__PURE__ */ new Map();
|
|
3327
3327
|
}
|
|
@@ -3346,7 +3346,7 @@ class On {
|
|
|
3346
3346
|
materials: this.materials,
|
|
3347
3347
|
hierarchy: this.hierarchy
|
|
3348
3348
|
};
|
|
3349
|
-
return
|
|
3349
|
+
return mt(e);
|
|
3350
3350
|
}
|
|
3351
3351
|
/**
|
|
3352
3352
|
* 完成构建
|
|
@@ -3355,7 +3355,7 @@ class On {
|
|
|
3355
3355
|
return this.buildCurrent();
|
|
3356
3356
|
}
|
|
3357
3357
|
}
|
|
3358
|
-
function
|
|
3358
|
+
function fn(r) {
|
|
3359
3359
|
return new Worker(
|
|
3360
3360
|
"" + new URL("assets/gltfParser.worker-D2lwod50.js", import.meta.url).href,
|
|
3361
3361
|
{
|
|
@@ -3363,9 +3363,9 @@ function dn(r) {
|
|
|
3363
3363
|
}
|
|
3364
3364
|
);
|
|
3365
3365
|
}
|
|
3366
|
-
function
|
|
3366
|
+
function pn(r) {
|
|
3367
3367
|
return new Worker(
|
|
3368
|
-
"" + new URL("assets/gltfParserOptimized.worker-
|
|
3368
|
+
"" + new URL("assets/gltfParserOptimized.worker-yo8WMPFM.js", import.meta.url).href,
|
|
3369
3369
|
{
|
|
3370
3370
|
name: r == null ? void 0 : r.name
|
|
3371
3371
|
}
|
|
@@ -3373,9 +3373,19 @@ function fn(r) {
|
|
|
3373
3373
|
}
|
|
3374
3374
|
let ee;
|
|
3375
3375
|
const Le = "/draco/";
|
|
3376
|
-
let Q, J,
|
|
3377
|
-
const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map()
|
|
3378
|
-
|
|
3376
|
+
let Q, J, st = 0;
|
|
3377
|
+
const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map();
|
|
3378
|
+
function Ne(r) {
|
|
3379
|
+
const e = r.clone(!1);
|
|
3380
|
+
r.userData && typeof r.userData == "object" ? e.userData = JSON.parse(JSON.stringify(r.userData)) : e.userData = r.userData;
|
|
3381
|
+
for (const t of r.children) {
|
|
3382
|
+
const n = Ne(t);
|
|
3383
|
+
e.add(n);
|
|
3384
|
+
}
|
|
3385
|
+
return e;
|
|
3386
|
+
}
|
|
3387
|
+
const mn = (r = {}) => {
|
|
3388
|
+
const { debug: e = !1 } = r, t = new xs(), n = new bs();
|
|
3379
3389
|
n.setDecoderPath(Le), t.setDRACOLoader(n);
|
|
3380
3390
|
const s = {
|
|
3381
3391
|
info: (...d) => e && console.log(...d),
|
|
@@ -3398,47 +3408,47 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3398
3408
|
let E = !1;
|
|
3399
3409
|
const {
|
|
3400
3410
|
maxRetries: x = 3,
|
|
3401
|
-
optimizeMaterials:
|
|
3402
|
-
simplifyGeometry:
|
|
3411
|
+
optimizeMaterials: R = !1,
|
|
3412
|
+
simplifyGeometry: P = !1,
|
|
3403
3413
|
simplifyRatio: C = 0.5,
|
|
3404
3414
|
simplifyOptions: z = {},
|
|
3405
3415
|
useMemoryCache: he = !0
|
|
3406
3416
|
// 是否使用内存缓存(默认 true)
|
|
3407
3417
|
} = T;
|
|
3408
3418
|
if (he) {
|
|
3409
|
-
const
|
|
3410
|
-
if (
|
|
3411
|
-
const N =
|
|
3419
|
+
const D = H.get(d);
|
|
3420
|
+
if (D && D.has(f)) {
|
|
3421
|
+
const N = D.get(f);
|
|
3412
3422
|
s.info(`[ 内存缓存命中 ] ${d} (version: ${f})`), s.time("[ 内存缓存克隆耗时 ]");
|
|
3413
|
-
const $ = N
|
|
3423
|
+
const $ = Ne(N);
|
|
3414
3424
|
return s.timeEnd("[ 内存缓存克隆耗时 ]"), W.recordHit(performance.now() - y), $;
|
|
3415
3425
|
}
|
|
3416
3426
|
}
|
|
3417
3427
|
try {
|
|
3418
|
-
let
|
|
3419
|
-
if (
|
|
3428
|
+
let D = await l(d, f);
|
|
3429
|
+
if (D)
|
|
3420
3430
|
s.info(`[ asyncFetch ] ====> IndexedDB 缓存命中: ${d}`), E = !0;
|
|
3421
3431
|
else {
|
|
3422
|
-
s.info(`[ asyncFetch ] ====> 缓存未命中: ${d}`), s.time("[ fetchArrayBuffer ] 加载模型耗时"),
|
|
3432
|
+
s.info(`[ asyncFetch ] ====> 缓存未命中: ${d}`), s.time("[ fetchArrayBuffer ] 加载模型耗时"), D = await ye.retry(
|
|
3423
3433
|
() => a(d, g),
|
|
3424
3434
|
{
|
|
3425
3435
|
maxRetries: x,
|
|
3426
|
-
shouldRetry: (
|
|
3436
|
+
shouldRetry: (Fe) => !!(Fe.name === "TypeError" || Fe.message.includes("HTTP error! status: 5"))
|
|
3427
3437
|
}
|
|
3428
3438
|
), s.timeEnd("[ fetchArrayBuffer ] 加载模型耗时");
|
|
3429
3439
|
const v = performance.now();
|
|
3430
|
-
await ee.saveModel(d, f,
|
|
3440
|
+
await ee.saveModel(d, f, D);
|
|
3431
3441
|
const _e = performance.now() - v;
|
|
3432
3442
|
W.recordCacheSave(_e), E = !1;
|
|
3433
3443
|
}
|
|
3434
3444
|
s.time("[ 解析模型耗时 ]");
|
|
3435
|
-
let N = await u(
|
|
3436
|
-
if (s.timeEnd("[ 解析模型耗时 ]"), s.time("[ 模型优化耗时 ]"),
|
|
3445
|
+
let N = await u(D);
|
|
3446
|
+
if (s.timeEnd("[ 解析模型耗时 ]"), s.time("[ 模型优化耗时 ]"), R) {
|
|
3437
3447
|
s.info("🔧 [ 材质优化 ] 开始合并相同材质...");
|
|
3438
3448
|
const { modelOptimizer: v } = await import("./modelOptimizer-D6fRg-DF.js");
|
|
3439
3449
|
N = v.optimizeMaterials(N);
|
|
3440
3450
|
}
|
|
3441
|
-
if (
|
|
3451
|
+
if (P) {
|
|
3442
3452
|
s.info(`🔧 [ 几何体简化 ] 开始简化模型 (比例: ${C})...`);
|
|
3443
3453
|
const { modelOptimizer: v } = await import("./modelOptimizer-D6fRg-DF.js"), _e = {
|
|
3444
3454
|
minFaceCount: 100,
|
|
@@ -3450,12 +3460,12 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3450
3460
|
if (s.timeEnd("[ 模型优化耗时 ]"), he) {
|
|
3451
3461
|
H.has(d) || H.set(d, /* @__PURE__ */ new Map());
|
|
3452
3462
|
const v = H.get(d);
|
|
3453
|
-
v.has(f) || (s.info(`[ 内存缓存 ] 存储模型 ${d} (version: ${f})`), v.set(f, N
|
|
3463
|
+
v.has(f) || (s.info(`[ 内存缓存 ] 存储模型 ${d} (version: ${f})`), v.set(f, Ne(N)));
|
|
3454
3464
|
}
|
|
3455
3465
|
const $ = performance.now() - y;
|
|
3456
3466
|
return E ? W.recordHit($) : W.recordMiss($), N;
|
|
3457
|
-
} catch (
|
|
3458
|
-
throw s.error(`加载模型 ${d} 失败:`,
|
|
3467
|
+
} catch (D) {
|
|
3468
|
+
throw s.error(`加载模型 ${d} 失败:`, D), W.recordError(d, D), D.name === "TypeError" && D.message.includes("fetch") ? ce.networkError(d, D) : D;
|
|
3459
3469
|
}
|
|
3460
3470
|
}
|
|
3461
3471
|
async function a(d, f) {
|
|
@@ -3467,19 +3477,19 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3467
3477
|
}).then((y) => {
|
|
3468
3478
|
const E = y.headers.get("content-length"), x = E ? parseInt(E, 10) : 0;
|
|
3469
3479
|
if (f && x > 0) {
|
|
3470
|
-
const
|
|
3471
|
-
let
|
|
3480
|
+
const R = y.body.getReader();
|
|
3481
|
+
let P = 0;
|
|
3472
3482
|
const C = [], z = () => {
|
|
3473
|
-
|
|
3483
|
+
R.read().then(({ done: he, value: D }) => {
|
|
3474
3484
|
if (he) {
|
|
3475
|
-
const N = new Uint8Array(
|
|
3485
|
+
const N = new Uint8Array(P);
|
|
3476
3486
|
let $ = 0;
|
|
3477
3487
|
for (const v of C)
|
|
3478
3488
|
N.set(v, $), $ += v.length;
|
|
3479
3489
|
g(N.buffer);
|
|
3480
3490
|
return;
|
|
3481
3491
|
}
|
|
3482
|
-
C.push(
|
|
3492
|
+
C.push(D), P += D.length, f(Math.round(P / x * 100)), z();
|
|
3483
3493
|
}).catch(T);
|
|
3484
3494
|
};
|
|
3485
3495
|
z();
|
|
@@ -3491,7 +3501,7 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3491
3501
|
});
|
|
3492
3502
|
}
|
|
3493
3503
|
async function l(d, f) {
|
|
3494
|
-
return ee || (ee = new
|
|
3504
|
+
return ee || (ee = new tt()), ee.getModel(d, f);
|
|
3495
3505
|
}
|
|
3496
3506
|
async function u(d, f = {}) {
|
|
3497
3507
|
if (!d) return null;
|
|
@@ -3501,17 +3511,17 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3501
3511
|
if (x)
|
|
3502
3512
|
try {
|
|
3503
3513
|
s.time("[ 优化解析 ] 使用 Transferable Objects 解析");
|
|
3504
|
-
const
|
|
3505
|
-
return s.timeEnd("[ 优化解析 ] 使用 Transferable Objects 解析"),
|
|
3506
|
-
} catch (
|
|
3507
|
-
s.warn("[ 优化解析 ] 失败,回退到标准解析",
|
|
3514
|
+
const R = await m(x, d, T);
|
|
3515
|
+
return s.timeEnd("[ 优化解析 ] 使用 Transferable Objects 解析"), mt(R);
|
|
3516
|
+
} catch (R) {
|
|
3517
|
+
s.warn("[ 优化解析 ] 失败,回退到标准解析", R);
|
|
3508
3518
|
}
|
|
3509
3519
|
}
|
|
3510
3520
|
const y = h();
|
|
3511
3521
|
if (y)
|
|
3512
3522
|
try {
|
|
3513
3523
|
const x = await _(y, d);
|
|
3514
|
-
return
|
|
3524
|
+
return ln(x);
|
|
3515
3525
|
} catch (x) {
|
|
3516
3526
|
s.warn("[ GLTF Worker ] ====> 解析失败,回退到主线程解析", x);
|
|
3517
3527
|
}
|
|
@@ -3522,7 +3532,7 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3522
3532
|
return null;
|
|
3523
3533
|
if (!Q)
|
|
3524
3534
|
try {
|
|
3525
|
-
s.info("[GLTF Worker] 使用 ?worker 工厂函数创建 Worker..."), Q =
|
|
3535
|
+
s.info("[GLTF Worker] 使用 ?worker 工厂函数创建 Worker..."), Q = fn(), s.info("[GLTF Worker] Worker 创建成功:", Q), Q.onmessage = (d) => {
|
|
3526
3536
|
const { id: f, data: g, error: T } = d.data || {};
|
|
3527
3537
|
if (!f || !X.has(f)) return;
|
|
3528
3538
|
const { resolve: y, reject: E } = X.get(f);
|
|
@@ -3541,7 +3551,7 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3541
3551
|
return null;
|
|
3542
3552
|
if (!J)
|
|
3543
3553
|
try {
|
|
3544
|
-
s.info("[Optimized Worker] 使用 ?worker 工厂函数创建 Worker..."), J =
|
|
3554
|
+
s.info("[Optimized Worker] 使用 ?worker 工厂函数创建 Worker..."), J = pn(), s.info("[Optimized Worker] Worker 创建成功:", J), J.onmessage = (d) => {
|
|
3545
3555
|
const { id: f, data: g, error: T, type: y } = d.data || {};
|
|
3546
3556
|
if (!f || !X.has(f) || y === "progress")
|
|
3547
3557
|
return;
|
|
@@ -3557,7 +3567,7 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3557
3567
|
}
|
|
3558
3568
|
return J;
|
|
3559
3569
|
}, m = (d, f, g = !1) => new Promise((T, y) => {
|
|
3560
|
-
const E = ++
|
|
3570
|
+
const E = ++st;
|
|
3561
3571
|
X.set(E, { resolve: T, reject: y });
|
|
3562
3572
|
const x = {
|
|
3563
3573
|
id: E,
|
|
@@ -3567,7 +3577,7 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3567
3577
|
};
|
|
3568
3578
|
d.postMessage(x, [f]);
|
|
3569
3579
|
}), _ = (d, f) => new Promise((g, T) => {
|
|
3570
|
-
const y = ++
|
|
3580
|
+
const y = ++st;
|
|
3571
3581
|
X.set(y, { resolve: g, reject: T }), d.postMessage({ id: y, arrayBuffer: f, dracoPath: Le });
|
|
3572
3582
|
}), w = (d) => new Promise((f, g) => {
|
|
3573
3583
|
t.parse(d, "", f, g);
|
|
@@ -3586,7 +3596,7 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3586
3596
|
* 获取缓存实例
|
|
3587
3597
|
* @returns {IDBCache} 缓存实例
|
|
3588
3598
|
*/
|
|
3589
|
-
getCache: () => ee || (ee = new
|
|
3599
|
+
getCache: () => ee || (ee = new tt()),
|
|
3590
3600
|
/**
|
|
3591
3601
|
* 打印缓存性能报告
|
|
3592
3602
|
*/
|
|
@@ -3650,13 +3660,13 @@ const X = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), pn = (r = {}
|
|
|
3650
3660
|
}
|
|
3651
3661
|
};
|
|
3652
3662
|
};
|
|
3653
|
-
class
|
|
3663
|
+
class gn {
|
|
3654
3664
|
constructor(e = {}) {
|
|
3655
3665
|
this.options = {
|
|
3656
3666
|
maxPreloadCount: e.maxPreloadCount || 5,
|
|
3657
3667
|
preloadDelay: e.preloadDelay || 1e3,
|
|
3658
3668
|
enableLearning: e.enableLearning !== !1
|
|
3659
|
-
}, this.loadHistory = /* @__PURE__ */ new Map(), this.loadSequence = [], this.associations = /* @__PURE__ */ new Map(), this.preloadQueue = /* @__PURE__ */ new Set(), this.isPreloading = !1, this.loader = null, this.getLoader = () => (this.loader || (this.loader =
|
|
3669
|
+
}, this.loadHistory = /* @__PURE__ */ new Map(), this.loadSequence = [], this.associations = /* @__PURE__ */ new Map(), this.preloadQueue = /* @__PURE__ */ new Set(), this.isPreloading = !1, this.loader = null, this.getLoader = () => (this.loader || (this.loader = mn()), this.loader);
|
|
3660
3670
|
}
|
|
3661
3671
|
/**
|
|
3662
3672
|
* 记录模型加载
|
|
@@ -3799,34 +3809,34 @@ class mn {
|
|
|
3799
3809
|
});
|
|
3800
3810
|
}
|
|
3801
3811
|
}
|
|
3802
|
-
const
|
|
3812
|
+
const In = new gn();
|
|
3803
3813
|
export {
|
|
3804
|
-
|
|
3814
|
+
hn as C,
|
|
3805
3815
|
Se as E,
|
|
3806
|
-
|
|
3816
|
+
tt as I,
|
|
3807
3817
|
ce as M,
|
|
3808
|
-
|
|
3818
|
+
gn as P,
|
|
3809
3819
|
ye as R,
|
|
3810
3820
|
ae as S,
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3821
|
+
En as a,
|
|
3822
|
+
xn as b,
|
|
3823
|
+
bn as c,
|
|
3824
|
+
An as d,
|
|
3825
|
+
Mn as e,
|
|
3816
3826
|
Rn as f,
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3827
|
+
Sn as g,
|
|
3828
|
+
Ln as h,
|
|
3829
|
+
Dn as i,
|
|
3830
|
+
cn as j,
|
|
3831
|
+
Cn as k,
|
|
3832
|
+
ln as l,
|
|
3833
|
+
On as m,
|
|
3824
3834
|
W as n,
|
|
3825
3835
|
Pn as o,
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3836
|
+
In as p,
|
|
3837
|
+
kn as q,
|
|
3838
|
+
mt as r,
|
|
3839
|
+
wn as s,
|
|
3840
|
+
Tn as t,
|
|
3841
|
+
mn as u
|
|
3832
3842
|
};
|