@ridp/threejs 1.4.5 → 1.4.7
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/README.md +148 -43
- package/dist/{PredictiveLoader-KOCZXzGy.cjs → PredictiveLoader-Tnm0gRZR.cjs} +1 -1
- package/dist/{PredictiveLoader-DTN7SDRI.js → PredictiveLoader-VyluUQ_9.js} +98 -97
- package/dist/assets/{gltfParserOptimized.worker-yo8WMPFM.js → gltfParserOptimized.worker-BHgPWvd-.js} +1 -1
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.js +2 -2
- package/dist/{ImageLoader-CnBqJLru.js → objectQuery-DV6aOB66.js} +418 -409
- package/dist/objectQuery-E6g-_2wI.cjs +24 -0
- package/dist/threejs.cjs +2 -2
- package/dist/threejs.js +29 -27
- package/dist/{useBatchGLTFLoader-DPT0_95u.js → useBatchGLTFLoader-CaIsPkER.js} +1 -1
- package/dist/{useBatchGLTFLoader-19GZ1dxv.cjs → useBatchGLTFLoader-DQt14QwC.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +18 -16
- package/package.json +1 -1
- package/dist/ImageLoader-6mmE7g5P.cjs +0 -24
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as A from "three";
|
|
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
|
|
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 Pe, 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 De, 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 Rt, ImageBitmapLoader as Mt, InterleavedBuffer as St, InterleavedBufferAttribute as Lt, LinearMipmapLinearFilter as at, NearestMipmapLinearFilter as Pt, LinearMipmapNearestFilter as Dt, 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
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,
|
|
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, R = {
|
|
5
5
|
NONE: -1,
|
|
6
6
|
ROTATE: 0,
|
|
7
7
|
DOLLY: 1,
|
|
@@ -19,7 +19,7 @@ class dt extends gt {
|
|
|
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 = R.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 dt extends gt {
|
|
|
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(Ke), this.update(), this.state =
|
|
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 = R.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 === R.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;
|
|
@@ -316,7 +316,7 @@ function ls(r) {
|
|
|
316
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(ut), this.state =
|
|
319
|
+
this.domElement.releasePointerCapture(r.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(ut), this.state = R.NONE;
|
|
320
320
|
break;
|
|
321
321
|
case 1:
|
|
322
322
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -342,49 +342,49 @@ function us(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 = R.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 = R.PAN;
|
|
351
351
|
} else {
|
|
352
352
|
if (this.enableRotate === !1) return;
|
|
353
|
-
this._handleMouseDownRotate(r), this.state =
|
|
353
|
+
this._handleMouseDownRotate(r), this.state = R.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 = R.ROTATE;
|
|
360
360
|
} else {
|
|
361
361
|
if (this.enablePan === !1) return;
|
|
362
|
-
this._handleMouseDownPan(r), this.state =
|
|
362
|
+
this._handleMouseDownPan(r), this.state = R.PAN;
|
|
363
363
|
}
|
|
364
364
|
break;
|
|
365
365
|
default:
|
|
366
|
-
this.state =
|
|
366
|
+
this.state = R.NONE;
|
|
367
367
|
}
|
|
368
|
-
this.state !==
|
|
368
|
+
this.state !== R.NONE && this.dispatchEvent(He);
|
|
369
369
|
}
|
|
370
370
|
function ds(r) {
|
|
371
371
|
switch (this.state) {
|
|
372
|
-
case
|
|
372
|
+
case R.ROTATE:
|
|
373
373
|
if (this.enableRotate === !1) return;
|
|
374
374
|
this._handleMouseMoveRotate(r);
|
|
375
375
|
break;
|
|
376
|
-
case
|
|
376
|
+
case R.DOLLY:
|
|
377
377
|
if (this.enableZoom === !1) return;
|
|
378
378
|
this._handleMouseMoveDolly(r);
|
|
379
379
|
break;
|
|
380
|
-
case
|
|
380
|
+
case R.PAN:
|
|
381
381
|
if (this.enablePan === !1) return;
|
|
382
382
|
this._handleMouseMovePan(r);
|
|
383
383
|
break;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
function fs(r) {
|
|
387
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !==
|
|
387
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== R.NONE || (r.preventDefault(), this.dispatchEvent(He), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(ut));
|
|
388
388
|
}
|
|
389
389
|
function ps(r) {
|
|
390
390
|
this.enabled !== !1 && this._handleKeyDown(r);
|
|
@@ -395,55 +395,55 @@ function ms(r) {
|
|
|
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 = R.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 = R.TOUCH_PAN;
|
|
403
403
|
break;
|
|
404
404
|
default:
|
|
405
|
-
this.state =
|
|
405
|
+
this.state = R.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 = R.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 = R.TOUCH_DOLLY_ROTATE;
|
|
417
417
|
break;
|
|
418
418
|
default:
|
|
419
|
-
this.state =
|
|
419
|
+
this.state = R.NONE;
|
|
420
420
|
}
|
|
421
421
|
break;
|
|
422
422
|
default:
|
|
423
|
-
this.state =
|
|
423
|
+
this.state = R.NONE;
|
|
424
424
|
}
|
|
425
|
-
this.state !==
|
|
425
|
+
this.state !== R.NONE && this.dispatchEvent(He);
|
|
426
426
|
}
|
|
427
427
|
function gs(r) {
|
|
428
428
|
switch (this._trackPointer(r), this.state) {
|
|
429
|
-
case
|
|
429
|
+
case R.TOUCH_ROTATE:
|
|
430
430
|
if (this.enableRotate === !1) return;
|
|
431
431
|
this._handleTouchMoveRotate(r), this.update();
|
|
432
432
|
break;
|
|
433
|
-
case
|
|
433
|
+
case R.TOUCH_PAN:
|
|
434
434
|
if (this.enablePan === !1) return;
|
|
435
435
|
this._handleTouchMovePan(r), this.update();
|
|
436
436
|
break;
|
|
437
|
-
case
|
|
437
|
+
case R.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 R.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 = R.NONE;
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
function ys(r) {
|
|
@@ -463,7 +463,7 @@ class ws extends dt {
|
|
|
463
463
|
function Xe(r, e) {
|
|
464
464
|
if (e === Tt)
|
|
465
465
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
466
|
-
if (e ===
|
|
466
|
+
if (e === Pe || 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 Xe(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 === Pe)
|
|
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
|
|
@@ -607,7 +607,7 @@ class bs extends ot {
|
|
|
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), De.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);
|
|
@@ -772,7 +772,7 @@ class xs extends ot {
|
|
|
772
772
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
773
773
|
return new Ls(t);
|
|
774
774
|
}), this.register(function(t) {
|
|
775
|
-
return new
|
|
775
|
+
return new Ps(t);
|
|
776
776
|
}), this.register(function(t) {
|
|
777
777
|
return new Fs(t);
|
|
778
778
|
}), this.register(function(t) {
|
|
@@ -792,13 +792,13 @@ class xs extends ot {
|
|
|
792
792
|
}), this.register(function(t) {
|
|
793
793
|
return new Ns(t);
|
|
794
794
|
}), this.register(function(t) {
|
|
795
|
-
return new
|
|
795
|
+
return new Ds(t);
|
|
796
796
|
}), this.register(function(t) {
|
|
797
797
|
return new Hs(t);
|
|
798
798
|
}), this.register(function(t) {
|
|
799
799
|
return new vs(t);
|
|
800
800
|
}), this.register(function(t) {
|
|
801
|
-
return new
|
|
801
|
+
return new Rs(t);
|
|
802
802
|
}), this.register(function(t) {
|
|
803
803
|
return new Gs(t);
|
|
804
804
|
}), this.register(function(t) {
|
|
@@ -936,7 +936,7 @@ class xs extends ot {
|
|
|
936
936
|
const h = i.extensionsUsed[u], p = i.extensionsRequired || [];
|
|
937
937
|
switch (h) {
|
|
938
938
|
case b.KHR_MATERIALS_UNLIT:
|
|
939
|
-
o[h] = new
|
|
939
|
+
o[h] = new Ms();
|
|
940
940
|
break;
|
|
941
941
|
case b.KHR_DRACO_MESH_COMPRESSION:
|
|
942
942
|
o[h] = new Ks(i, this.dracoLoader);
|
|
@@ -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 Rs {
|
|
1013
1013
|
constructor(e) {
|
|
1014
1014
|
this.parser = e, this.name = b.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
1015
1015
|
}
|
|
@@ -1055,7 +1055,7 @@ class Ms {
|
|
|
1055
1055
|
});
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
|
-
class
|
|
1058
|
+
class Ms {
|
|
1059
1059
|
constructor() {
|
|
1060
1060
|
this.name = b.KHR_MATERIALS_UNLIT;
|
|
1061
1061
|
}
|
|
@@ -1108,7 +1108,7 @@ class Ls {
|
|
|
1108
1108
|
return Promise.all(i);
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
-
class
|
|
1111
|
+
class Ps {
|
|
1112
1112
|
constructor(e) {
|
|
1113
1113
|
this.parser = e, this.name = b.KHR_MATERIALS_DISPERSION;
|
|
1114
1114
|
}
|
|
@@ -1124,7 +1124,7 @@ class Ds {
|
|
|
1124
1124
|
return t.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
1127
|
-
class
|
|
1127
|
+
class Ds {
|
|
1128
1128
|
constructor(e) {
|
|
1129
1129
|
this.parser = e, this.name = b.KHR_MATERIALS_IRIDESCENCE;
|
|
1130
1130
|
}
|
|
@@ -1461,8 +1461,8 @@ class pt extends Zt {
|
|
|
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, M = o[_ + y + c], D = o[_ + y] * u;
|
|
1465
|
+
i[y] = g * E + T * x + d * M + f * D;
|
|
1466
1466
|
}
|
|
1467
1467
|
return i;
|
|
1468
1468
|
}
|
|
@@ -1493,8 +1493,8 @@ const I = {
|
|
|
1493
1493
|
9728: ct,
|
|
1494
1494
|
9729: Ce,
|
|
1495
1495
|
9984: Ct,
|
|
1496
|
-
9985:
|
|
1497
|
-
9986:
|
|
1496
|
+
9985: Dt,
|
|
1497
|
+
9986: Pt,
|
|
1498
1498
|
9987: at
|
|
1499
1499
|
}, qe = {
|
|
1500
1500
|
33071: kt,
|
|
@@ -1602,12 +1602,12 @@ function Qs(r, e) {
|
|
|
1602
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 + ":" + Re(t.attributes) : e = r.indices + ":" + Re(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 += ":" + Re(r.targets[n]);
|
|
1608
1608
|
return e;
|
|
1609
1609
|
}
|
|
1610
|
-
function
|
|
1610
|
+
function Re(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++)
|
|
@@ -1642,7 +1642,7 @@ class sn {
|
|
|
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 Rt(this.options.manager) : this.textureLoader = new Mt(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;
|
|
@@ -1898,9 +1898,9 @@ class sn {
|
|
|
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 M = 0, D = E.length; M < D; M++) {
|
|
1902
|
+
const C = E[M];
|
|
1903
|
+
if (d.setX(C, x[M * a]), a >= 2 && d.setY(C, x[M * a + 1]), a >= 3 && d.setZ(C, x[M * a + 2]), a >= 4 && d.setW(C, x[M * a + 3]), a >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1904
1904
|
}
|
|
1905
1905
|
d.normalized = _;
|
|
1906
1906
|
}
|
|
@@ -2123,7 +2123,7 @@ class sn {
|
|
|
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 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,
|
|
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, Pe));
|
|
2127
2127
|
else if (d.mode === I.LINES)
|
|
2128
2128
|
f = new jt(w, g);
|
|
2129
2129
|
else if (d.mode === I.LINE_STRIP)
|
|
@@ -2213,10 +2213,10 @@ class sn {
|
|
|
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], M = w[g], D = 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, M, D);
|
|
2220
2220
|
if (C)
|
|
2221
2221
|
for (let z = 0; z < C.length; z++)
|
|
2222
2222
|
f.push(C[z]);
|
|
@@ -2440,7 +2440,7 @@ function $e(r, e, t) {
|
|
|
2440
2440
|
});
|
|
2441
2441
|
s.push(o);
|
|
2442
2442
|
}
|
|
2443
|
-
return
|
|
2443
|
+
return De.workingColorSpace !== U && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${De.workingColorSpace}" not supported.`), G(r, e), nn(r, e, t), Promise.all(s).then(function() {
|
|
2444
2444
|
return e.targets !== void 0 ? Zs(r, e.targets, t) : r;
|
|
2445
2445
|
});
|
|
2446
2446
|
}
|
|
@@ -2503,8 +2503,8 @@ class wn {
|
|
|
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), D = (f.isPerspectiveCamera ? "perspective(" + g + "px) " : "") + x + "translate(" + i + "px," + o + "px)";
|
|
2507
|
+
c.camera.style !== D && (u.style.transform = D, c.camera.style = D), 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
|
};
|
|
@@ -2535,11 +2535,11 @@ class wn {
|
|
|
2535
2535
|
d.onBeforeRender(t, f, g);
|
|
2536
2536
|
let x;
|
|
2537
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
|
|
2539
|
-
if (
|
|
2538
|
+
const M = c.objects.get(d);
|
|
2539
|
+
if (M === void 0 || M.style !== x) {
|
|
2540
2540
|
E.style.transform = x;
|
|
2541
|
-
const
|
|
2542
|
-
c.objects.set(d,
|
|
2541
|
+
const D = { style: x };
|
|
2542
|
+
c.objects.set(d, D);
|
|
2543
2543
|
}
|
|
2544
2544
|
E.parentNode !== u && u.appendChild(E), d.onAfterRender(t, f, g);
|
|
2545
2545
|
}
|
|
@@ -2613,10 +2613,10 @@ function xn(r) {
|
|
|
2613
2613
|
function An(r, e) {
|
|
2614
2614
|
return new dt(r, e);
|
|
2615
2615
|
}
|
|
2616
|
-
function
|
|
2616
|
+
function Rn(r, e) {
|
|
2617
2617
|
return new ws(r, e);
|
|
2618
2618
|
}
|
|
2619
|
-
function
|
|
2619
|
+
function Mn() {
|
|
2620
2620
|
const r = new ns(), e = new k(0, 0);
|
|
2621
2621
|
return {
|
|
2622
2622
|
raycaster: r,
|
|
@@ -2629,7 +2629,7 @@ function Sn(r = 10) {
|
|
|
2629
2629
|
function Ln(r = new S(1, 1, 1), e = new S(10, 10, 10), t = 5, n = 16776960) {
|
|
2630
2630
|
return r.normalize(), new os(r, e, t, n);
|
|
2631
2631
|
}
|
|
2632
|
-
function
|
|
2632
|
+
function Pn() {
|
|
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
|
}
|
|
@@ -2643,8 +2643,8 @@ function Je(r) {
|
|
|
2643
2643
|
r[e] && r[e].isTexture && r[e].dispose();
|
|
2644
2644
|
r.dispose();
|
|
2645
2645
|
}
|
|
2646
|
-
const
|
|
2647
|
-
async function
|
|
2646
|
+
const Me = {};
|
|
2647
|
+
async function Dn(r, e = 50) {
|
|
2648
2648
|
const t = {
|
|
2649
2649
|
type: r.type,
|
|
2650
2650
|
name: r.name,
|
|
@@ -2853,13 +2853,13 @@ function me(r) {
|
|
|
2853
2853
|
};
|
|
2854
2854
|
}
|
|
2855
2855
|
function ge(r) {
|
|
2856
|
-
if (
|
|
2856
|
+
if (Me[r.name]) return Me[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, Me[r.name] = s, s;
|
|
2863
2863
|
}
|
|
2864
2864
|
class hn {
|
|
2865
2865
|
constructor() {
|
|
@@ -3281,6 +3281,7 @@ function un(r) {
|
|
|
3281
3281
|
function dn(r) {
|
|
3282
3282
|
let e;
|
|
3283
3283
|
const t = {
|
|
3284
|
+
name: r.name,
|
|
3284
3285
|
color: r.color !== void 0 ? r.color : 16777215,
|
|
3285
3286
|
opacity: r.opacity !== void 0 ? r.opacity : 1,
|
|
3286
3287
|
transparent: r.transparent !== void 0 ? r.transparent : !1,
|
|
@@ -3365,7 +3366,7 @@ function fn(r) {
|
|
|
3365
3366
|
}
|
|
3366
3367
|
function pn(r) {
|
|
3367
3368
|
return new Worker(
|
|
3368
|
-
"" + new URL("assets/gltfParserOptimized.worker-
|
|
3369
|
+
"" + new URL("assets/gltfParserOptimized.worker-BHgPWvd-.js", import.meta.url).href,
|
|
3369
3370
|
{
|
|
3370
3371
|
name: r == null ? void 0 : r.name
|
|
3371
3372
|
}
|
|
@@ -3408,28 +3409,28 @@ const mn = (r = {}) => {
|
|
|
3408
3409
|
let E = !1;
|
|
3409
3410
|
const {
|
|
3410
3411
|
maxRetries: x = 3,
|
|
3411
|
-
optimizeMaterials:
|
|
3412
|
-
simplifyGeometry:
|
|
3412
|
+
optimizeMaterials: M = !1,
|
|
3413
|
+
simplifyGeometry: D = !1,
|
|
3413
3414
|
simplifyRatio: C = 0.5,
|
|
3414
3415
|
simplifyOptions: z = {},
|
|
3415
3416
|
useMemoryCache: he = !0
|
|
3416
3417
|
// 是否使用内存缓存(默认 true)
|
|
3417
3418
|
} = T;
|
|
3418
3419
|
if (he) {
|
|
3419
|
-
const
|
|
3420
|
-
if (
|
|
3421
|
-
const N =
|
|
3420
|
+
const P = H.get(d);
|
|
3421
|
+
if (P && P.has(f)) {
|
|
3422
|
+
const N = P.get(f);
|
|
3422
3423
|
s.info(`[ 内存缓存命中 ] ${d} (version: ${f})`), s.time("[ 内存缓存克隆耗时 ]");
|
|
3423
3424
|
const $ = Ne(N);
|
|
3424
3425
|
return s.timeEnd("[ 内存缓存克隆耗时 ]"), W.recordHit(performance.now() - y), $;
|
|
3425
3426
|
}
|
|
3426
3427
|
}
|
|
3427
3428
|
try {
|
|
3428
|
-
let
|
|
3429
|
-
if (
|
|
3429
|
+
let P = await l(d, f);
|
|
3430
|
+
if (P)
|
|
3430
3431
|
s.info(`[ asyncFetch ] ====> IndexedDB 缓存命中: ${d}`), E = !0;
|
|
3431
3432
|
else {
|
|
3432
|
-
s.info(`[ asyncFetch ] ====> 缓存未命中: ${d}`), s.time("[ fetchArrayBuffer ] 加载模型耗时"),
|
|
3433
|
+
s.info(`[ asyncFetch ] ====> 缓存未命中: ${d}`), s.time("[ fetchArrayBuffer ] 加载模型耗时"), P = await ye.retry(
|
|
3433
3434
|
() => a(d, g),
|
|
3434
3435
|
{
|
|
3435
3436
|
maxRetries: x,
|
|
@@ -3437,18 +3438,18 @@ const mn = (r = {}) => {
|
|
|
3437
3438
|
}
|
|
3438
3439
|
), s.timeEnd("[ fetchArrayBuffer ] 加载模型耗时");
|
|
3439
3440
|
const v = performance.now();
|
|
3440
|
-
await ee.saveModel(d, f,
|
|
3441
|
+
await ee.saveModel(d, f, P);
|
|
3441
3442
|
const _e = performance.now() - v;
|
|
3442
3443
|
W.recordCacheSave(_e), E = !1;
|
|
3443
3444
|
}
|
|
3444
3445
|
s.time("[ 解析模型耗时 ]");
|
|
3445
|
-
let N = await u(
|
|
3446
|
-
if (s.timeEnd("[ 解析模型耗时 ]"), s.time("[ 模型优化耗时 ]"),
|
|
3446
|
+
let N = await u(P);
|
|
3447
|
+
if (s.timeEnd("[ 解析模型耗时 ]"), s.time("[ 模型优化耗时 ]"), M) {
|
|
3447
3448
|
s.info("🔧 [ 材质优化 ] 开始合并相同材质...");
|
|
3448
3449
|
const { modelOptimizer: v } = await import("./modelOptimizer-D6fRg-DF.js");
|
|
3449
3450
|
N = v.optimizeMaterials(N);
|
|
3450
3451
|
}
|
|
3451
|
-
if (
|
|
3452
|
+
if (D) {
|
|
3452
3453
|
s.info(`🔧 [ 几何体简化 ] 开始简化模型 (比例: ${C})...`);
|
|
3453
3454
|
const { modelOptimizer: v } = await import("./modelOptimizer-D6fRg-DF.js"), _e = {
|
|
3454
3455
|
minFaceCount: 100,
|
|
@@ -3464,8 +3465,8 @@ const mn = (r = {}) => {
|
|
|
3464
3465
|
}
|
|
3465
3466
|
const $ = performance.now() - y;
|
|
3466
3467
|
return E ? W.recordHit($) : W.recordMiss($), N;
|
|
3467
|
-
} catch (
|
|
3468
|
-
throw s.error(`加载模型 ${d} 失败:`,
|
|
3468
|
+
} catch (P) {
|
|
3469
|
+
throw s.error(`加载模型 ${d} 失败:`, P), W.recordError(d, P), P.name === "TypeError" && P.message.includes("fetch") ? ce.networkError(d, P) : P;
|
|
3469
3470
|
}
|
|
3470
3471
|
}
|
|
3471
3472
|
async function a(d, f) {
|
|
@@ -3477,19 +3478,19 @@ const mn = (r = {}) => {
|
|
|
3477
3478
|
}).then((y) => {
|
|
3478
3479
|
const E = y.headers.get("content-length"), x = E ? parseInt(E, 10) : 0;
|
|
3479
3480
|
if (f && x > 0) {
|
|
3480
|
-
const
|
|
3481
|
-
let
|
|
3481
|
+
const M = y.body.getReader();
|
|
3482
|
+
let D = 0;
|
|
3482
3483
|
const C = [], z = () => {
|
|
3483
|
-
|
|
3484
|
+
M.read().then(({ done: he, value: P }) => {
|
|
3484
3485
|
if (he) {
|
|
3485
|
-
const N = new Uint8Array(
|
|
3486
|
+
const N = new Uint8Array(D);
|
|
3486
3487
|
let $ = 0;
|
|
3487
3488
|
for (const v of C)
|
|
3488
3489
|
N.set(v, $), $ += v.length;
|
|
3489
3490
|
g(N.buffer);
|
|
3490
3491
|
return;
|
|
3491
3492
|
}
|
|
3492
|
-
C.push(
|
|
3493
|
+
C.push(P), D += P.length, f(Math.round(D / x * 100)), z();
|
|
3493
3494
|
}).catch(T);
|
|
3494
3495
|
};
|
|
3495
3496
|
z();
|
|
@@ -3511,10 +3512,10 @@ const mn = (r = {}) => {
|
|
|
3511
3512
|
if (x)
|
|
3512
3513
|
try {
|
|
3513
3514
|
s.time("[ 优化解析 ] 使用 Transferable Objects 解析");
|
|
3514
|
-
const
|
|
3515
|
-
return s.timeEnd("[ 优化解析 ] 使用 Transferable Objects 解析"), mt(
|
|
3516
|
-
} catch (
|
|
3517
|
-
s.warn("[ 优化解析 ] 失败,回退到标准解析",
|
|
3515
|
+
const M = await m(x, d, T);
|
|
3516
|
+
return s.timeEnd("[ 优化解析 ] 使用 Transferable Objects 解析"), mt(M);
|
|
3517
|
+
} catch (M) {
|
|
3518
|
+
s.warn("[ 优化解析 ] 失败,回退到标准解析", M);
|
|
3518
3519
|
}
|
|
3519
3520
|
}
|
|
3520
3521
|
const y = h();
|
|
@@ -3822,17 +3823,17 @@ export {
|
|
|
3822
3823
|
xn as b,
|
|
3823
3824
|
bn as c,
|
|
3824
3825
|
An as d,
|
|
3825
|
-
|
|
3826
|
-
|
|
3826
|
+
Rn as e,
|
|
3827
|
+
Mn as f,
|
|
3827
3828
|
Sn as g,
|
|
3828
3829
|
Ln as h,
|
|
3829
|
-
|
|
3830
|
+
Pn as i,
|
|
3830
3831
|
cn as j,
|
|
3831
3832
|
Cn as k,
|
|
3832
3833
|
ln as l,
|
|
3833
3834
|
On as m,
|
|
3834
3835
|
W as n,
|
|
3835
|
-
|
|
3836
|
+
Dn as o,
|
|
3836
3837
|
In as p,
|
|
3837
3838
|
kn as q,
|
|
3838
3839
|
mt as r,
|