endset_three_editor 0.4.4 → 0.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/endset_three_editor.css +1 -1
- package/dist/three/addHandle.d.ts +0 -1
- package/dist/three/css2dPanel.d.ts +8 -0
- package/dist/three/index.d.ts +2 -0
- package/dist/three-editor.cjs.js +4 -4
- package/dist/three-editor.cjs.js.map +1 -1
- package/dist/three-editor.es.js +905 -853
- package/dist/three-editor.es.js.map +1 -1
- package/package.json +1 -1
package/dist/three-editor.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var _n = Object.defineProperty;
|
|
2
2
|
var $n = (r, e, t) => e in r ? _n(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var Re = (r, e, t) => $n(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { toRaw as xt, defineComponent as
|
|
4
|
+
import { toRaw as xt, defineComponent as Ie, ref as L, inject as es, computed as Be, watchEffect as ts, resolveComponent as ns, openBlock as T, createElementBlock as R, createElementVNode as b, normalizeClass as ie, withModifiers as jt, unref as ss, toDisplayString as _, Fragment as Me, renderList as wt, createBlock as Ke, createCommentVNode as X, reactive as kt, watch as de, withDirectives as E, vModelText as H, withKeys as He, vModelCheckbox as is, toRef as os, provide as rs, createVNode as Dt, vShow as De, shallowRef as $t, onMounted as as, onBeforeUnmount as ls } from "vue";
|
|
5
5
|
import * as P from "three";
|
|
6
|
-
import { Controls as On, Vector3 as M, MOUSE as Ne, TOUCH as Le, Quaternion as K, Spherical as en, Vector2 as Y, Ray as cs, Plane as us, MathUtils as En, Raycaster as
|
|
6
|
+
import { Controls as On, Vector3 as M, MOUSE as Ne, TOUCH as Le, Quaternion as K, Spherical as en, Vector2 as Y, Ray as cs, Plane as us, MathUtils as En, Raycaster as ds, Object3D as ke, MeshBasicMaterial as Pe, LineBasicMaterial as Ze, CylinderGeometry as U, BoxGeometry as q, BufferGeometry as We, Float32BufferAttribute as me, Mesh as v, OctahedronGeometry as lt, Line as ue, TorusGeometry as Ge, SphereGeometry as As, Euler as hs, Matrix4 as ge, PlaneGeometry as fs, DoubleSide as Rn, Loader as Yt, FileLoader as tt, Color as he, SRGBColorSpace as Ae, Group as ft, Material as Qe, PointsMaterial as Ue, MeshPhongMaterial as ps, LineSegments as Wt, Points as pt, TrianglesDrawMode as ms, TriangleFanDrawMode as zt, TriangleStripDrawMode as Sn, LoaderUtils as Je, MeshPhysicalMaterial as le, LinearSRGBColorSpace as ae, SpotLight as gs, PointLight as bs, DirectionalLight as Is, InstancedMesh as ys, InstancedBufferAttribute as Cs, TextureLoader as xs, ImageBitmapLoader as ws, BufferAttribute as _e, InterleavedBuffer as Hn, InterleavedBufferAttribute as Ln, LinearMipmapLinearFilter as Nn, NearestMipmapLinearFilter as vs, LinearMipmapNearestFilter as Ms, NearestMipmapNearestFilter as Ds, LinearFilter as Gt, NearestFilter as jn, RepeatWrapping as Ft, MirroredRepeatWrapping as Ps, ClampToEdgeWrapping as Ts, MeshStandardMaterial as kn, PropertyBinding as Os, SkinnedMesh as Es, LineLoop as Rs, PerspectiveCamera as Ss, OrthographicCamera as Hs, Skeleton as Ls, AnimationClip as Ns, Bone as js, InterpolateDiscrete as ks, InterpolateLinear as Wn, Texture as tn, VectorKeyframeTrack as nn, NumberKeyframeTrack as sn, QuaternionKeyframeTrack as on, ColorManagement as qt, FrontSide as Ws, Interpolant as zs, Box3 as Gs, Sphere as Fs } from "three";
|
|
7
7
|
import nt from "@tweenjs/tween.js";
|
|
8
|
-
const rn = { type: "change" }, Kt = { type: "start" }, zn = { type: "end" }, ct = new cs(), an = new us(), qs = Math.cos(70 * En.DEG2RAD), G = new M(), V = 2 * Math.PI,
|
|
8
|
+
const rn = { type: "change" }, Kt = { type: "start" }, zn = { type: "end" }, ct = new cs(), an = new us(), qs = Math.cos(70 * En.DEG2RAD), G = new M(), V = 2 * Math.PI, N = {
|
|
9
9
|
NONE: -1,
|
|
10
10
|
ROTATE: 0,
|
|
11
11
|
DOLLY: 1,
|
|
@@ -23,7 +23,7 @@ class Xs extends On {
|
|
|
23
23
|
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
|
|
24
24
|
*/
|
|
25
25
|
constructor(e, t = null) {
|
|
26
|
-
super(e, t), this.state =
|
|
26
|
+
super(e, t), this.state = N.NONE, this.target = new M(), this.cursor = new M(), 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: Ne.ROTATE, MIDDLE: Ne.DOLLY, RIGHT: Ne.PAN }, this.touches = { ONE: Le.ROTATE, TWO: Le.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new M(), this._lastQuaternion = new K(), this._lastTargetPosition = new M(), this._quat = new K().setFromUnitVectors(e.up, new M(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new en(), this._sphericalDelta = new en(), this._scale = 1, this._panOffset = new M(), this._rotateStart = new Y(), this._rotateEnd = new Y(), this._rotateDelta = new Y(), this._panStart = new Y(), this._panEnd = new Y(), this._panDelta = new Y(), this._dollyStart = new Y(), this._dollyEnd = new Y(), this._dollyDelta = new Y(), this._dollyDirection = new M(), this._mouse = new Y(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Us.bind(this), this._onPointerDown = Bs.bind(this), this._onPointerUp = Vs.bind(this), this._onContextMenu = $s.bind(this), this._onMouseWheel = Zs.bind(this), this._onKeyDown = Qs.bind(this), this._onTouchStart = Js.bind(this), this._onTouchMove = _s.bind(this), this._onMouseDown = Ys.bind(this), this._onMouseMove = Ks.bind(this), this._interceptControlDown = ei.bind(this), this._interceptControlUp = ti.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Defines the visual representation of the cursor.
|
|
@@ -96,7 +96,7 @@ class Xs extends On {
|
|
|
96
96
|
* was called, or the initial state.
|
|
97
97
|
*/
|
|
98
98
|
reset() {
|
|
99
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(rn), this.update(), this.state =
|
|
99
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(rn), this.update(), this.state = N.NONE;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Programmatically pan the camera.
|
|
@@ -141,7 +141,7 @@ class Xs extends On {
|
|
|
141
141
|
}
|
|
142
142
|
update(e = null) {
|
|
143
143
|
const t = this.object.position;
|
|
144
|
-
G.copy(t).sub(this.target), G.applyQuaternion(this._quat), this._spherical.setFromVector3(G), this.autoRotate && this.state ===
|
|
144
|
+
G.copy(t).sub(this.target), G.applyQuaternion(this._quat), this._spherical.setFromVector3(G), this.autoRotate && this.state === N.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
145
145
|
let s = this.minAzimuthAngle, n = this.maxAzimuthAngle;
|
|
146
146
|
isFinite(s) && isFinite(n) && (s < -Math.PI ? s += V : s > Math.PI && (s -= V), n < -Math.PI ? n += V : n > Math.PI && (n -= V), s <= n ? this._spherical.theta = Math.max(s, Math.min(n, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (s + n) / 2 ? Math.max(s, this._spherical.theta) : Math.min(n, 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);
|
|
147
147
|
let i = !1;
|
|
@@ -373,7 +373,7 @@ function Us(r) {
|
|
|
373
373
|
function Vs(r) {
|
|
374
374
|
switch (this._removePointer(r), this._pointers.length) {
|
|
375
375
|
case 0:
|
|
376
|
-
this.domElement.releasePointerCapture(r.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(zn), this.state =
|
|
376
|
+
this.domElement.releasePointerCapture(r.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(zn), this.state = N.NONE, this._cursorStyle === "grab" && (this.domElement.style.cursor = "grab");
|
|
377
377
|
break;
|
|
378
378
|
case 1:
|
|
379
379
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -399,49 +399,49 @@ function Ys(r) {
|
|
|
399
399
|
switch (e) {
|
|
400
400
|
case Ne.DOLLY:
|
|
401
401
|
if (this.enableZoom === !1) return;
|
|
402
|
-
this._handleMouseDownDolly(r), this.state =
|
|
402
|
+
this._handleMouseDownDolly(r), this.state = N.DOLLY;
|
|
403
403
|
break;
|
|
404
404
|
case Ne.ROTATE:
|
|
405
405
|
if (r.ctrlKey || r.metaKey || r.shiftKey) {
|
|
406
406
|
if (this.enablePan === !1) return;
|
|
407
|
-
this._handleMouseDownPan(r), this.state =
|
|
407
|
+
this._handleMouseDownPan(r), this.state = N.PAN;
|
|
408
408
|
} else {
|
|
409
409
|
if (this.enableRotate === !1) return;
|
|
410
|
-
this._handleMouseDownRotate(r), this.state =
|
|
410
|
+
this._handleMouseDownRotate(r), this.state = N.ROTATE;
|
|
411
411
|
}
|
|
412
412
|
break;
|
|
413
413
|
case Ne.PAN:
|
|
414
414
|
if (r.ctrlKey || r.metaKey || r.shiftKey) {
|
|
415
415
|
if (this.enableRotate === !1) return;
|
|
416
|
-
this._handleMouseDownRotate(r), this.state =
|
|
416
|
+
this._handleMouseDownRotate(r), this.state = N.ROTATE;
|
|
417
417
|
} else {
|
|
418
418
|
if (this.enablePan === !1) return;
|
|
419
|
-
this._handleMouseDownPan(r), this.state =
|
|
419
|
+
this._handleMouseDownPan(r), this.state = N.PAN;
|
|
420
420
|
}
|
|
421
421
|
break;
|
|
422
422
|
default:
|
|
423
|
-
this.state =
|
|
423
|
+
this.state = N.NONE;
|
|
424
424
|
}
|
|
425
|
-
this.state !==
|
|
425
|
+
this.state !== N.NONE && this.dispatchEvent(Kt);
|
|
426
426
|
}
|
|
427
427
|
function Ks(r) {
|
|
428
428
|
switch (this.state) {
|
|
429
|
-
case
|
|
429
|
+
case N.ROTATE:
|
|
430
430
|
if (this.enableRotate === !1) return;
|
|
431
431
|
this._handleMouseMoveRotate(r);
|
|
432
432
|
break;
|
|
433
|
-
case
|
|
433
|
+
case N.DOLLY:
|
|
434
434
|
if (this.enableZoom === !1) return;
|
|
435
435
|
this._handleMouseMoveDolly(r);
|
|
436
436
|
break;
|
|
437
|
-
case
|
|
437
|
+
case N.PAN:
|
|
438
438
|
if (this.enablePan === !1) return;
|
|
439
439
|
this._handleMouseMovePan(r);
|
|
440
440
|
break;
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
function Zs(r) {
|
|
444
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !==
|
|
444
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== N.NONE || (r.preventDefault(), this.dispatchEvent(Kt), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(zn));
|
|
445
445
|
}
|
|
446
446
|
function Qs(r) {
|
|
447
447
|
this.enabled !== !1 && this._handleKeyDown(r);
|
|
@@ -452,55 +452,55 @@ function Js(r) {
|
|
|
452
452
|
switch (this.touches.ONE) {
|
|
453
453
|
case Le.ROTATE:
|
|
454
454
|
if (this.enableRotate === !1) return;
|
|
455
|
-
this._handleTouchStartRotate(r), this.state =
|
|
455
|
+
this._handleTouchStartRotate(r), this.state = N.TOUCH_ROTATE;
|
|
456
456
|
break;
|
|
457
457
|
case Le.PAN:
|
|
458
458
|
if (this.enablePan === !1) return;
|
|
459
|
-
this._handleTouchStartPan(r), this.state =
|
|
459
|
+
this._handleTouchStartPan(r), this.state = N.TOUCH_PAN;
|
|
460
460
|
break;
|
|
461
461
|
default:
|
|
462
|
-
this.state =
|
|
462
|
+
this.state = N.NONE;
|
|
463
463
|
}
|
|
464
464
|
break;
|
|
465
465
|
case 2:
|
|
466
466
|
switch (this.touches.TWO) {
|
|
467
467
|
case Le.DOLLY_PAN:
|
|
468
468
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
469
|
-
this._handleTouchStartDollyPan(r), this.state =
|
|
469
|
+
this._handleTouchStartDollyPan(r), this.state = N.TOUCH_DOLLY_PAN;
|
|
470
470
|
break;
|
|
471
471
|
case Le.DOLLY_ROTATE:
|
|
472
472
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
473
|
-
this._handleTouchStartDollyRotate(r), this.state =
|
|
473
|
+
this._handleTouchStartDollyRotate(r), this.state = N.TOUCH_DOLLY_ROTATE;
|
|
474
474
|
break;
|
|
475
475
|
default:
|
|
476
|
-
this.state =
|
|
476
|
+
this.state = N.NONE;
|
|
477
477
|
}
|
|
478
478
|
break;
|
|
479
479
|
default:
|
|
480
|
-
this.state =
|
|
480
|
+
this.state = N.NONE;
|
|
481
481
|
}
|
|
482
|
-
this.state !==
|
|
482
|
+
this.state !== N.NONE && this.dispatchEvent(Kt);
|
|
483
483
|
}
|
|
484
484
|
function _s(r) {
|
|
485
485
|
switch (this._trackPointer(r), this.state) {
|
|
486
|
-
case
|
|
486
|
+
case N.TOUCH_ROTATE:
|
|
487
487
|
if (this.enableRotate === !1) return;
|
|
488
488
|
this._handleTouchMoveRotate(r), this.update();
|
|
489
489
|
break;
|
|
490
|
-
case
|
|
490
|
+
case N.TOUCH_PAN:
|
|
491
491
|
if (this.enablePan === !1) return;
|
|
492
492
|
this._handleTouchMovePan(r), this.update();
|
|
493
493
|
break;
|
|
494
|
-
case
|
|
494
|
+
case N.TOUCH_DOLLY_PAN:
|
|
495
495
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
496
496
|
this._handleTouchMoveDollyPan(r), this.update();
|
|
497
497
|
break;
|
|
498
|
-
case
|
|
498
|
+
case N.TOUCH_DOLLY_ROTATE:
|
|
499
499
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
500
500
|
this._handleTouchMoveDollyRotate(r), this.update();
|
|
501
501
|
break;
|
|
502
502
|
default:
|
|
503
|
-
this.state =
|
|
503
|
+
this.state = N.NONE;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
function $s(r) {
|
|
@@ -512,11 +512,11 @@ function ei(r) {
|
|
|
512
512
|
function ti(r) {
|
|
513
513
|
r.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
514
514
|
}
|
|
515
|
-
const
|
|
515
|
+
const xe = new ds(), F = new M(), fe = new M(), k = new K(), ln = {
|
|
516
516
|
X: new M(1, 0, 0),
|
|
517
517
|
Y: new M(0, 1, 0),
|
|
518
518
|
Z: new M(0, 0, 1)
|
|
519
|
-
}, Tt = { type: "change" }, cn = { type: "mouseDown", mode: null }, un = { type: "mouseUp", mode: null },
|
|
519
|
+
}, Tt = { type: "change" }, cn = { type: "mouseDown", mode: null }, un = { type: "mouseUp", mode: null }, dn = { type: "objectChange" };
|
|
520
520
|
class ni extends On {
|
|
521
521
|
/**
|
|
522
522
|
* Constructs a new controls instance.
|
|
@@ -533,20 +533,20 @@ class ni extends On {
|
|
|
533
533
|
const i = new ui();
|
|
534
534
|
this._plane = i, s.add(i);
|
|
535
535
|
const o = this;
|
|
536
|
-
function a(C,
|
|
537
|
-
let w =
|
|
536
|
+
function a(C, x) {
|
|
537
|
+
let w = x;
|
|
538
538
|
Object.defineProperty(o, C, {
|
|
539
539
|
get: function() {
|
|
540
|
-
return w !== void 0 ? w :
|
|
540
|
+
return w !== void 0 ? w : x;
|
|
541
541
|
},
|
|
542
542
|
set: function(D) {
|
|
543
543
|
w !== D && (w = D, i[C] = D, n[C] = D, o.dispatchEvent({ type: C + "-changed", value: D }), o.dispatchEvent(Tt));
|
|
544
544
|
}
|
|
545
|
-
}), o[C] =
|
|
545
|
+
}), o[C] = x, i[C] = x, n[C] = x;
|
|
546
546
|
}
|
|
547
547
|
a("camera", e), a("object", void 0), a("enabled", !0), a("axis", null), a("mode", "translate"), a("translationSnap", null), a("rotationSnap", null), a("scaleSnap", null), a("space", "world"), a("size", 1), a("dragging", !1), a("showX", !0), a("showY", !0), a("showZ", !0), a("showXY", !0), a("showYZ", !0), a("showXZ", !0), a("minX", -1 / 0), a("maxX", 1 / 0), a("minY", -1 / 0), a("maxY", 1 / 0), a("minZ", -1 / 0), a("maxZ", 1 / 0);
|
|
548
|
-
const l = new M(), c = new M(),
|
|
549
|
-
a("worldPosition", l), a("worldPositionStart", c), a("worldQuaternion",
|
|
548
|
+
const l = new M(), c = new M(), d = new K(), u = new K(), h = new M(), A = new K(), f = new M(), p = new M(), m = new M(), g = 0, y = new M();
|
|
549
|
+
a("worldPosition", l), a("worldPositionStart", c), a("worldQuaternion", d), a("worldQuaternionStart", u), a("cameraPosition", h), a("cameraQuaternion", A), a("pointStart", f), a("pointEnd", p), a("rotationAxis", m), a("rotationAngle", g), a("eye", y), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new K(), this._parentQuaternionInv = new K(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new K(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new K(), this._scaleStart = new M(), this._getPointer = si.bind(this), this._onPointerDown = oi.bind(this), this._onPointerHover = ii.bind(this), this._onPointerMove = ri.bind(this), this._onPointerUp = ai.bind(this), t !== null && this.connect(t);
|
|
550
550
|
}
|
|
551
551
|
connect(e) {
|
|
552
552
|
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.style.touchAction = "none";
|
|
@@ -565,14 +565,14 @@ class ni extends On {
|
|
|
565
565
|
}
|
|
566
566
|
pointerHover(e) {
|
|
567
567
|
if (this.object === void 0 || this.dragging === !0) return;
|
|
568
|
-
e !== null &&
|
|
569
|
-
const t = Ot(this._gizmo.picker[this.mode],
|
|
568
|
+
e !== null && xe.setFromCamera(e, this.camera);
|
|
569
|
+
const t = Ot(this._gizmo.picker[this.mode], xe);
|
|
570
570
|
t ? this.axis = t.object.name : this.axis = null;
|
|
571
571
|
}
|
|
572
572
|
pointerDown(e) {
|
|
573
573
|
if (!(this.object === void 0 || this.dragging === !0 || e != null && e.button !== 0) && this.axis !== null) {
|
|
574
|
-
e !== null &&
|
|
575
|
-
const t = Ot(this._plane,
|
|
574
|
+
e !== null && xe.setFromCamera(e, this.camera);
|
|
575
|
+
const t = Ot(this._plane, xe, !0);
|
|
576
576
|
t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, cn.mode = this.mode, this.dispatchEvent(cn);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
@@ -580,25 +580,25 @@ class ni extends On {
|
|
|
580
580
|
const t = this.axis, s = this.mode, n = this.object;
|
|
581
581
|
let i = this.space;
|
|
582
582
|
if (s === "scale" ? i = "local" : (t === "E" || t === "XYZE" || t === "XYZ") && (i = "world"), n === void 0 || t === null || this.dragging === !1 || e !== null && e.button !== -1) return;
|
|
583
|
-
e !== null &&
|
|
584
|
-
const o = Ot(this._plane,
|
|
583
|
+
e !== null && xe.setFromCamera(e, this.camera);
|
|
584
|
+
const o = Ot(this._plane, xe, !0);
|
|
585
585
|
if (o) {
|
|
586
586
|
if (this.pointEnd.copy(o.point).sub(this.worldPositionStart), s === "translate")
|
|
587
587
|
this._offset.copy(this.pointEnd).sub(this.pointStart), i === "local" && t !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), t.indexOf("X") === -1 && (this._offset.x = 0), t.indexOf("Y") === -1 && (this._offset.y = 0), t.indexOf("Z") === -1 && (this._offset.z = 0), i === "local" && t !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), n.position.copy(this._offset).add(this._positionStart), this.translationSnap && (i === "local" && (n.position.applyQuaternion(k.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (n.position.x = Math.round(n.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (n.position.y = Math.round(n.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (n.position.z = Math.round(n.position.z / this.translationSnap) * this.translationSnap), n.position.applyQuaternion(this._quaternionStart)), i === "world" && (n.parent && n.position.add(F.setFromMatrixPosition(n.parent.matrixWorld)), t.search("X") !== -1 && (n.position.x = Math.round(n.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (n.position.y = Math.round(n.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (n.position.z = Math.round(n.position.z / this.translationSnap) * this.translationSnap), n.parent && n.position.sub(F.setFromMatrixPosition(n.parent.matrixWorld)))), n.position.x = Math.max(this.minX, Math.min(this.maxX, n.position.x)), n.position.y = Math.max(this.minY, Math.min(this.maxY, n.position.y)), n.position.z = Math.max(this.minZ, Math.min(this.maxZ, n.position.z));
|
|
588
588
|
else if (s === "scale") {
|
|
589
589
|
if (t.search("XYZ") !== -1) {
|
|
590
590
|
let a = this.pointEnd.length() / this.pointStart.length();
|
|
591
|
-
this.pointEnd.dot(this.pointStart) < 0 && (a *= -1),
|
|
591
|
+
this.pointEnd.dot(this.pointStart) < 0 && (a *= -1), fe.set(a, a, a);
|
|
592
592
|
} else
|
|
593
|
-
F.copy(this.pointStart),
|
|
594
|
-
n.scale.copy(this._scaleStart).multiply(
|
|
593
|
+
F.copy(this.pointStart), fe.copy(this.pointEnd), F.applyQuaternion(this._worldQuaternionInv), fe.applyQuaternion(this._worldQuaternionInv), fe.divide(F), t.search("X") === -1 && (fe.x = 1), t.search("Y") === -1 && (fe.y = 1), t.search("Z") === -1 && (fe.z = 1);
|
|
594
|
+
n.scale.copy(this._scaleStart).multiply(fe), this.scaleSnap && (t.search("X") !== -1 && (n.scale.x = Math.round(n.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Y") !== -1 && (n.scale.y = Math.round(n.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Z") !== -1 && (n.scale.z = Math.round(n.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
|
|
595
595
|
} else if (s === "rotate") {
|
|
596
596
|
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
597
597
|
const a = 20 / this.worldPosition.distanceTo(F.setFromMatrixPosition(this.camera.matrixWorld));
|
|
598
598
|
let l = !1;
|
|
599
599
|
t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(F.copy(this.rotationAxis).cross(this.eye)) * a) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(ln[t]), F.copy(ln[t]), i === "local" && F.applyQuaternion(this.worldQuaternion), F.cross(this.eye), F.length() === 0 ? l = !0 : this.rotationAngle = this._offset.dot(F.normalize()) * a), (t === "E" || l) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), i === "local" && t !== "E" && t !== "XYZE" ? (n.quaternion.copy(this._quaternionStart), n.quaternion.multiply(k.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), n.quaternion.copy(k.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), n.quaternion.multiply(this._quaternionStart).normalize());
|
|
600
600
|
}
|
|
601
|
-
this.dispatchEvent(Tt), this.dispatchEvent(
|
|
601
|
+
this.dispatchEvent(Tt), this.dispatchEvent(dn);
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
pointerUp(e) {
|
|
@@ -628,7 +628,7 @@ class ni extends On {
|
|
|
628
628
|
* Resets the object's position, rotation and scale to when the current transform began.
|
|
629
629
|
*/
|
|
630
630
|
reset() {
|
|
631
|
-
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(Tt), this.dispatchEvent(
|
|
631
|
+
this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(Tt), this.dispatchEvent(dn), this.pointStart.copy(this.pointEnd));
|
|
632
632
|
}
|
|
633
633
|
/**
|
|
634
634
|
* Returns the raycaster that is used for user interaction. This object is shared between all
|
|
@@ -637,7 +637,7 @@ class ni extends On {
|
|
|
637
637
|
* @returns {Raycaster} The internal raycaster.
|
|
638
638
|
*/
|
|
639
639
|
getRaycaster() {
|
|
640
|
-
return
|
|
640
|
+
return xe;
|
|
641
641
|
}
|
|
642
642
|
/**
|
|
643
643
|
* Returns the transformation mode.
|
|
@@ -749,7 +749,7 @@ function Ot(r, e, t) {
|
|
|
749
749
|
return s[n];
|
|
750
750
|
return !1;
|
|
751
751
|
}
|
|
752
|
-
const ut = new hs(),
|
|
752
|
+
const ut = new hs(), j = new M(0, 1, 0), An = new M(0, 0, 0), hn = new ge(), dt = new K(), mt = new K(), oe = new M(), fn = new ge(), Ve = new M(1, 0, 0), ve = new M(0, 1, 0), Ye = new M(0, 0, 1), At = new M(), Fe = new M(), qe = new M();
|
|
753
753
|
class li extends ke {
|
|
754
754
|
constructor(e) {
|
|
755
755
|
super(), this.isTransformControlsRoot = !0, this.controls = e, this.visible = !1;
|
|
@@ -794,62 +794,62 @@ class ci extends ke {
|
|
|
794
794
|
l.color.setHex(16711680), l.opacity = 0.5;
|
|
795
795
|
const c = e.clone();
|
|
796
796
|
c.color.setHex(65280), c.opacity = 0.5;
|
|
797
|
-
const
|
|
798
|
-
|
|
797
|
+
const d = e.clone();
|
|
798
|
+
d.color.setHex(255), d.opacity = 0.5;
|
|
799
799
|
const u = e.clone();
|
|
800
800
|
u.opacity = 0.25;
|
|
801
801
|
const h = e.clone();
|
|
802
802
|
h.color.setHex(16776960), h.opacity = 0.25;
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
|
|
803
|
+
const A = e.clone();
|
|
804
|
+
A.color.setHex(16776960);
|
|
805
|
+
const f = e.clone();
|
|
806
|
+
f.color.setHex(7895160), this.materialLib = {
|
|
807
807
|
xAxis: i,
|
|
808
808
|
yAxis: o,
|
|
809
809
|
zAxis: a,
|
|
810
|
-
active:
|
|
810
|
+
active: A,
|
|
811
811
|
xAxisTransparent: l,
|
|
812
812
|
yAxisTransparent: c,
|
|
813
|
-
zAxisTransparent:
|
|
813
|
+
zAxisTransparent: d,
|
|
814
814
|
activeTransparent: h
|
|
815
815
|
};
|
|
816
816
|
const p = new U(0, 0.04, 0.1, 12);
|
|
817
817
|
p.translate(0, 0.05, 0);
|
|
818
|
-
const
|
|
819
|
-
|
|
818
|
+
const m = new q(0.08, 0.08, 0.08);
|
|
819
|
+
m.translate(0, 0.04, 0);
|
|
820
820
|
const g = new We();
|
|
821
|
-
g.setAttribute("position", new
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
function C(
|
|
825
|
-
const
|
|
826
|
-
return
|
|
821
|
+
g.setAttribute("position", new me([0, 0, 0, 1, 0, 0], 3));
|
|
822
|
+
const y = new U(75e-4, 75e-4, 0.5, 3);
|
|
823
|
+
y.translate(0, 0.25, 0);
|
|
824
|
+
function C(ee, it) {
|
|
825
|
+
const se = new Ge(ee, 75e-4, 3, 64, it * Math.PI * 2);
|
|
826
|
+
return se.rotateY(Math.PI / 2), se.rotateX(Math.PI / 2), se;
|
|
827
827
|
}
|
|
828
|
-
function
|
|
829
|
-
const
|
|
830
|
-
return
|
|
828
|
+
function x() {
|
|
829
|
+
const ee = new We();
|
|
830
|
+
return ee.setAttribute("position", new me([0, 0, 0, 1, 1, 1], 3)), ee;
|
|
831
831
|
}
|
|
832
832
|
const w = {
|
|
833
833
|
X: [
|
|
834
834
|
[new v(p, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
835
835
|
[new v(p, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
|
|
836
|
-
[new v(
|
|
836
|
+
[new v(y, i), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
837
837
|
],
|
|
838
838
|
Y: [
|
|
839
839
|
[new v(p, o), [0, 0.5, 0]],
|
|
840
840
|
[new v(p, o), [0, -0.5, 0], [Math.PI, 0, 0]],
|
|
841
|
-
[new v(
|
|
841
|
+
[new v(y, o)]
|
|
842
842
|
],
|
|
843
843
|
Z: [
|
|
844
844
|
[new v(p, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
845
845
|
[new v(p, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
|
|
846
|
-
[new v(
|
|
846
|
+
[new v(y, a), null, [Math.PI / 2, 0, 0]]
|
|
847
847
|
],
|
|
848
848
|
XYZ: [
|
|
849
849
|
[new v(new lt(0.1, 0), u), [0, 0, 0]]
|
|
850
850
|
],
|
|
851
851
|
XY: [
|
|
852
|
-
[new v(new q(0.15, 0.15, 0.01),
|
|
852
|
+
[new v(new q(0.15, 0.15, 0.01), d), [0.15, 0.15, 0]]
|
|
853
853
|
],
|
|
854
854
|
YZ: [
|
|
855
855
|
[new v(new q(0.15, 0.15, 0.01), l), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
@@ -890,7 +890,7 @@ class ci extends ke {
|
|
|
890
890
|
[new v(new lt(0.01, 2), n), null, null, null, "helper"]
|
|
891
891
|
],
|
|
892
892
|
DELTA: [
|
|
893
|
-
[new ue(
|
|
893
|
+
[new ue(x(), n), null, null, null, "helper"]
|
|
894
894
|
],
|
|
895
895
|
X: [
|
|
896
896
|
[new ue(g, n), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
@@ -903,7 +903,7 @@ class ci extends ke {
|
|
|
903
903
|
]
|
|
904
904
|
}, Z = {
|
|
905
905
|
XYZE: [
|
|
906
|
-
[new v(C(0.5, 1),
|
|
906
|
+
[new v(C(0.5, 1), f), null, [0, Math.PI / 2, 0]]
|
|
907
907
|
],
|
|
908
908
|
X: [
|
|
909
909
|
[new v(C(0.5, 0.5), i)]
|
|
@@ -917,13 +917,13 @@ class ci extends ke {
|
|
|
917
917
|
E: [
|
|
918
918
|
[new v(C(0.75, 1), h), null, [0, Math.PI / 2, 0]]
|
|
919
919
|
]
|
|
920
|
-
},
|
|
920
|
+
}, $ = {
|
|
921
921
|
AXIS: [
|
|
922
922
|
[new ue(g, n), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
923
923
|
]
|
|
924
924
|
}, Q = {
|
|
925
925
|
XYZE: [
|
|
926
|
-
[new v(new
|
|
926
|
+
[new v(new As(0.25, 10, 8), s)]
|
|
927
927
|
],
|
|
928
928
|
X: [
|
|
929
929
|
[new v(new Ge(0.5, 0.1, 4, 24), s), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]
|
|
@@ -937,24 +937,24 @@ class ci extends ke {
|
|
|
937
937
|
E: [
|
|
938
938
|
[new v(new Ge(0.75, 0.1, 2, 24), s)]
|
|
939
939
|
]
|
|
940
|
-
},
|
|
940
|
+
}, Ce = {
|
|
941
941
|
X: [
|
|
942
|
-
[new v(
|
|
943
|
-
[new v(
|
|
944
|
-
[new v(
|
|
942
|
+
[new v(m, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
943
|
+
[new v(y, i), [0, 0, 0], [0, 0, -Math.PI / 2]],
|
|
944
|
+
[new v(m, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
|
|
945
945
|
],
|
|
946
946
|
Y: [
|
|
947
|
-
[new v(
|
|
948
|
-
[new v(
|
|
949
|
-
[new v(
|
|
947
|
+
[new v(m, o), [0, 0.5, 0]],
|
|
948
|
+
[new v(y, o)],
|
|
949
|
+
[new v(m, o), [0, -0.5, 0], [0, 0, Math.PI]]
|
|
950
950
|
],
|
|
951
951
|
Z: [
|
|
952
|
-
[new v(
|
|
953
|
-
[new v(
|
|
954
|
-
[new v(
|
|
952
|
+
[new v(m, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
953
|
+
[new v(y, a), [0, 0, 0], [Math.PI / 2, 0, 0]],
|
|
954
|
+
[new v(m, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
|
|
955
955
|
],
|
|
956
956
|
XY: [
|
|
957
|
-
[new v(new q(0.15, 0.15, 0.01),
|
|
957
|
+
[new v(new q(0.15, 0.15, 0.01), d), [0.15, 0.15, 0]]
|
|
958
958
|
],
|
|
959
959
|
YZ: [
|
|
960
960
|
[new v(new q(0.15, 0.15, 0.01), l), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
@@ -1001,18 +1001,18 @@ class ci extends ke {
|
|
|
1001
1001
|
[new ue(g, n), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
|
|
1002
1002
|
]
|
|
1003
1003
|
};
|
|
1004
|
-
function ce(
|
|
1004
|
+
function ce(ee) {
|
|
1005
1005
|
const it = new ke();
|
|
1006
|
-
for (const
|
|
1007
|
-
for (let Ee =
|
|
1008
|
-
const B =
|
|
1009
|
-
B.name =
|
|
1006
|
+
for (const se in ee)
|
|
1007
|
+
for (let Ee = ee[se].length; Ee--; ) {
|
|
1008
|
+
const B = ee[se][Ee][0].clone(), ot = ee[se][Ee][1], rt = ee[se][Ee][2], at = ee[se][Ee][3], Jn = ee[se][Ee][4];
|
|
1009
|
+
B.name = se, B.tag = Jn, ot && B.position.set(ot[0], ot[1], ot[2]), rt && B.rotation.set(rt[0], rt[1], rt[2]), at && B.scale.set(at[0], at[1], at[2]), B.updateMatrix();
|
|
1010
1010
|
const _t = B.geometry.clone();
|
|
1011
1011
|
_t.applyMatrix4(B.matrix), B.geometry = _t, B.renderOrder = 1 / 0, B.position.set(0, 0, 0), B.rotation.set(0, 0, 0), B.scale.set(1, 1, 1), it.add(B);
|
|
1012
1012
|
}
|
|
1013
1013
|
return it;
|
|
1014
1014
|
}
|
|
1015
|
-
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = ce(w)), this.add(this.gizmo.rotate = ce(Z)), this.add(this.gizmo.scale = ce(
|
|
1015
|
+
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = ce(w)), this.add(this.gizmo.rotate = ce(Z)), this.add(this.gizmo.scale = ce(Ce)), this.add(this.picker.translate = ce(D)), this.add(this.picker.rotate = ce(Q)), this.add(this.picker.scale = ce(Mt)), this.add(this.helper.translate = ce(S)), this.add(this.helper.rotate = ce($)), this.add(this.helper.scale = ce(Qn)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
1016
1016
|
}
|
|
1017
1017
|
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
1018
1018
|
updateMatrixWorld(e) {
|
|
@@ -1025,10 +1025,10 @@ class ci extends ke {
|
|
|
1025
1025
|
o.visible = !0, o.rotation.set(0, 0, 0), o.position.copy(this.worldPosition);
|
|
1026
1026
|
let a;
|
|
1027
1027
|
if (this.camera.isOrthographicCamera ? a = (this.camera.top - this.camera.bottom) / this.camera.zoom : a = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), o.scale.set(1, 1, 1).multiplyScalar(a * this.size / 4), o.tag === "helper") {
|
|
1028
|
-
o.visible = !1, o.name === "AXIS" ? (o.visible = !!this.axis, this.axis === "X" && (k.setFromEuler(ut.set(0, 0, 0)), o.quaternion.copy(s).multiply(k), Math.abs(
|
|
1028
|
+
o.visible = !1, o.name === "AXIS" ? (o.visible = !!this.axis, this.axis === "X" && (k.setFromEuler(ut.set(0, 0, 0)), o.quaternion.copy(s).multiply(k), Math.abs(j.copy(Ve).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Y" && (k.setFromEuler(ut.set(0, 0, Math.PI / 2)), o.quaternion.copy(s).multiply(k), Math.abs(j.copy(ve).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Z" && (k.setFromEuler(ut.set(0, Math.PI / 2, 0)), o.quaternion.copy(s).multiply(k), Math.abs(j.copy(Ye).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "XYZE" && (k.setFromEuler(ut.set(0, Math.PI / 2, 0)), j.copy(this.rotationAxis), o.quaternion.setFromRotationMatrix(hn.lookAt(An, j, ve)), o.quaternion.multiply(k), o.visible = this.dragging), this.axis === "E" && (o.visible = !1)) : o.name === "START" ? (o.position.copy(this.worldPositionStart), o.visible = this.dragging) : o.name === "END" ? (o.position.copy(this.worldPosition), o.visible = this.dragging) : o.name === "DELTA" ? (o.position.copy(this.worldPositionStart), o.quaternion.copy(this.worldQuaternionStart), F.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), F.applyQuaternion(this.worldQuaternionStart.clone().invert()), o.scale.copy(F), o.visible = this.dragging) : (o.quaternion.copy(s), this.dragging ? o.position.copy(this.worldPositionStart) : o.position.copy(this.worldPosition), this.axis && (o.visible = this.axis.search(o.name) !== -1));
|
|
1029
1029
|
continue;
|
|
1030
1030
|
}
|
|
1031
|
-
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(
|
|
1031
|
+
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(j.copy(Ve).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Y" && Math.abs(j.copy(ve).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Z" && Math.abs(j.copy(Ye).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "XY" && Math.abs(j.copy(Ye).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "YZ" && Math.abs(j.copy(Ve).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "XZ" && Math.abs(j.copy(ve).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1)) : this.mode === "rotate" && (dt.copy(s), j.copy(this.eye).applyQuaternion(k.copy(s).invert()), o.name.search("E") !== -1 && o.quaternion.setFromRotationMatrix(hn.lookAt(this.eye, An, ve)), o.name === "X" && (k.setFromAxisAngle(Ve, Math.atan2(-j.y, j.z)), k.multiplyQuaternions(dt, k), o.quaternion.copy(k)), o.name === "Y" && (k.setFromAxisAngle(ve, Math.atan2(j.x, j.z)), k.multiplyQuaternions(dt, k), o.quaternion.copy(k)), o.name === "Z" && (k.setFromAxisAngle(Ye, Math.atan2(j.y, j.x)), k.multiplyQuaternions(dt, k), o.quaternion.copy(k))), o.visible = o.visible && (o.name.indexOf("X") === -1 || this.showX), o.visible = o.visible && (o.name.indexOf("Y") === -1 || this.showY), o.visible = o.visible && (o.name.indexOf("Z") === -1 || this.showZ), o.visible = o.visible && (o.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), o.visible = o.visible && (o.name.indexOf("XY") === -1 || this.showXY), o.visible = o.visible && (o.name.indexOf("YZ") === -1 || this.showYZ), o.visible = o.visible && (o.name.indexOf("XZ") === -1 || this.showXZ), o.material._color = o.material._color || o.material.color.clone(), o.material._opacity = o.material._opacity || o.material.opacity, o.material.color.copy(o.material._color), o.material.opacity = o.material._opacity, this.enabled && this.axis && (o.name === this.axis ? (o.material.color.copy(this.materialLib.active.color), o.material.opacity = 1) : this.axis.split("").some(function(l) {
|
|
1032
1032
|
return o.name === l;
|
|
1033
1033
|
}) && (o.material.color.copy(this.materialLib.active.color), o.material.opacity = 1));
|
|
1034
1034
|
}
|
|
@@ -1044,27 +1044,27 @@ class ui extends v {
|
|
|
1044
1044
|
}
|
|
1045
1045
|
updateMatrixWorld(e) {
|
|
1046
1046
|
let t = this.space;
|
|
1047
|
-
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"),
|
|
1047
|
+
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), At.copy(Ve).applyQuaternion(t === "local" ? this.worldQuaternion : mt), Fe.copy(ve).applyQuaternion(t === "local" ? this.worldQuaternion : mt), qe.copy(Ye).applyQuaternion(t === "local" ? this.worldQuaternion : mt), j.copy(Fe), this.mode) {
|
|
1048
1048
|
case "translate":
|
|
1049
1049
|
case "scale":
|
|
1050
1050
|
switch (this.axis) {
|
|
1051
1051
|
case "X":
|
|
1052
|
-
|
|
1052
|
+
j.copy(this.eye).cross(At), oe.copy(At).cross(j);
|
|
1053
1053
|
break;
|
|
1054
1054
|
case "Y":
|
|
1055
|
-
|
|
1055
|
+
j.copy(this.eye).cross(Fe), oe.copy(Fe).cross(j);
|
|
1056
1056
|
break;
|
|
1057
1057
|
case "Z":
|
|
1058
|
-
|
|
1058
|
+
j.copy(this.eye).cross(qe), oe.copy(qe).cross(j);
|
|
1059
1059
|
break;
|
|
1060
1060
|
case "XY":
|
|
1061
1061
|
oe.copy(qe);
|
|
1062
1062
|
break;
|
|
1063
1063
|
case "YZ":
|
|
1064
|
-
oe.copy(
|
|
1064
|
+
oe.copy(At);
|
|
1065
1065
|
break;
|
|
1066
1066
|
case "XZ":
|
|
1067
|
-
|
|
1067
|
+
j.copy(qe), oe.copy(Fe);
|
|
1068
1068
|
break;
|
|
1069
1069
|
case "XYZ":
|
|
1070
1070
|
case "E":
|
|
@@ -1076,10 +1076,10 @@ class ui extends v {
|
|
|
1076
1076
|
default:
|
|
1077
1077
|
oe.set(0, 0, 0);
|
|
1078
1078
|
}
|
|
1079
|
-
oe.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (fn.lookAt(F.set(0, 0, 0), oe,
|
|
1079
|
+
oe.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (fn.lookAt(F.set(0, 0, 0), oe, j), this.quaternion.setFromRotationMatrix(fn)), super.updateMatrixWorld(e);
|
|
1080
1080
|
}
|
|
1081
1081
|
}
|
|
1082
|
-
class
|
|
1082
|
+
class di extends ke {
|
|
1083
1083
|
/**
|
|
1084
1084
|
* Constructs a new CSS2D object.
|
|
1085
1085
|
*
|
|
@@ -1096,8 +1096,8 @@ class Ai extends ke {
|
|
|
1096
1096
|
return super.copy(e, t), this.element = e.element.cloneNode(!0), this.center = e.center, this;
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
|
-
const Se = new M(), pn = new
|
|
1100
|
-
class
|
|
1099
|
+
const Se = new M(), pn = new ge(), mn = new ge(), gn = new M(), bn = new M();
|
|
1100
|
+
class Ai {
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Constructs a new CSS2D renderer.
|
|
1103
1103
|
*
|
|
@@ -1114,51 +1114,51 @@ class di {
|
|
|
1114
1114
|
width: s,
|
|
1115
1115
|
height: n
|
|
1116
1116
|
};
|
|
1117
|
-
}, this.render = function(
|
|
1118
|
-
|
|
1119
|
-
}, this.setSize = function(
|
|
1120
|
-
s =
|
|
1117
|
+
}, this.render = function(f, p) {
|
|
1118
|
+
f.matrixWorldAutoUpdate === !0 && f.updateMatrixWorld(), p.parent === null && p.matrixWorldAutoUpdate === !0 && p.updateMatrixWorld(), pn.copy(p.matrixWorldInverse), mn.multiplyMatrices(p.projectionMatrix, pn), d(f, f, p), this.sortObjects && A(f);
|
|
1119
|
+
}, this.setSize = function(f, p) {
|
|
1120
|
+
s = f, n = p, i = s / 2, o = n / 2, l.style.width = f + "px", l.style.height = p + "px";
|
|
1121
1121
|
};
|
|
1122
|
-
function c(
|
|
1123
|
-
|
|
1124
|
-
for (let p = 0,
|
|
1125
|
-
c(
|
|
1122
|
+
function c(f) {
|
|
1123
|
+
f.isCSS2DObject && (f.element.style.display = "none");
|
|
1124
|
+
for (let p = 0, m = f.children.length; p < m; p++)
|
|
1125
|
+
c(f.children[p]);
|
|
1126
1126
|
}
|
|
1127
|
-
function
|
|
1128
|
-
if (
|
|
1129
|
-
c(
|
|
1127
|
+
function d(f, p, m) {
|
|
1128
|
+
if (f.visible === !1) {
|
|
1129
|
+
c(f);
|
|
1130
1130
|
return;
|
|
1131
1131
|
}
|
|
1132
|
-
if (
|
|
1133
|
-
Se.setFromMatrixPosition(
|
|
1134
|
-
const g = Se.z >= -1 && Se.z <= 1 &&
|
|
1135
|
-
|
|
1132
|
+
if (f.isCSS2DObject) {
|
|
1133
|
+
Se.setFromMatrixPosition(f.matrixWorld), Se.applyMatrix4(mn);
|
|
1134
|
+
const g = Se.z >= -1 && Se.z <= 1 && f.layers.test(m.layers) === !0, y = f.element;
|
|
1135
|
+
y.style.display = g === !0 ? "" : "none", g === !0 && (f.onBeforeRender(t, p, m), y.style.transform = "translate(" + -100 * f.center.x + "%," + -100 * f.center.y + "%)translate(" + (Se.x * i + i) + "px," + (-Se.y * o + o) + "px)", y.parentNode !== l && l.appendChild(y), f.onAfterRender(t, p, m));
|
|
1136
1136
|
const C = {
|
|
1137
|
-
distanceToCameraSquared: u(
|
|
1137
|
+
distanceToCameraSquared: u(m, f)
|
|
1138
1138
|
};
|
|
1139
|
-
a.objects.set(
|
|
1139
|
+
a.objects.set(f, C);
|
|
1140
1140
|
}
|
|
1141
|
-
for (let g = 0,
|
|
1142
|
-
|
|
1141
|
+
for (let g = 0, y = f.children.length; g < y; g++)
|
|
1142
|
+
d(f.children[g], p, m);
|
|
1143
1143
|
}
|
|
1144
|
-
function u(
|
|
1145
|
-
return gn.setFromMatrixPosition(
|
|
1144
|
+
function u(f, p) {
|
|
1145
|
+
return gn.setFromMatrixPosition(f.matrixWorld), bn.setFromMatrixPosition(p.matrixWorld), gn.distanceToSquared(bn);
|
|
1146
1146
|
}
|
|
1147
|
-
function h(
|
|
1147
|
+
function h(f) {
|
|
1148
1148
|
const p = [];
|
|
1149
|
-
return
|
|
1150
|
-
|
|
1149
|
+
return f.traverseVisible(function(m) {
|
|
1150
|
+
m.isCSS2DObject && p.push(m);
|
|
1151
1151
|
}), p;
|
|
1152
1152
|
}
|
|
1153
|
-
function
|
|
1154
|
-
const p = h(
|
|
1155
|
-
if (g.renderOrder !==
|
|
1156
|
-
return
|
|
1157
|
-
const C = a.objects.get(g).distanceToCameraSquared,
|
|
1158
|
-
return C -
|
|
1159
|
-
}),
|
|
1160
|
-
for (let g = 0,
|
|
1161
|
-
p[g].element.style.zIndex =
|
|
1153
|
+
function A(f) {
|
|
1154
|
+
const p = h(f).sort(function(g, y) {
|
|
1155
|
+
if (g.renderOrder !== y.renderOrder)
|
|
1156
|
+
return y.renderOrder - g.renderOrder;
|
|
1157
|
+
const C = a.objects.get(g).distanceToCameraSquared, x = a.objects.get(y).distanceToCameraSquared;
|
|
1158
|
+
return C - x;
|
|
1159
|
+
}), m = p.length;
|
|
1160
|
+
for (let g = 0, y = p.length; g < y; g++)
|
|
1161
|
+
p[g].element.style.zIndex = m - g;
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
@@ -1261,7 +1261,7 @@ class Gn {
|
|
|
1261
1261
|
const t = new P.Box3().setFromObject(e), s = new P.Vector3();
|
|
1262
1262
|
t.getSize(s);
|
|
1263
1263
|
const n = s.y / 2 + this.options.offsetY;
|
|
1264
|
-
this.css2dObject || (this.css2dObject = new
|
|
1264
|
+
this.css2dObject || (this.css2dObject = new di(this.container), this.css2dObject.name = `DataPanel_${e.name || e.uuid}`, this.css2dObject.center.set(0.5, 1)), this.css2dObject.position.set(0, n, 0), e.add(this.css2dObject), this.attachedObject = e;
|
|
1265
1265
|
}
|
|
1266
1266
|
/**
|
|
1267
1267
|
* 从附着的物体上移除面板
|
|
@@ -1366,6 +1366,26 @@ class Gn {
|
|
|
1366
1366
|
t.getSize(s), this.css2dObject.position.set(0, s.y / 2 + e, 0);
|
|
1367
1367
|
}
|
|
1368
1368
|
}
|
|
1369
|
+
/** 获取面板宽度 */
|
|
1370
|
+
getWidth() {
|
|
1371
|
+
return this.options.width || "200px";
|
|
1372
|
+
}
|
|
1373
|
+
/** 获取面板字体大小 */
|
|
1374
|
+
getFontSize() {
|
|
1375
|
+
return this.options.fontSize || "13px";
|
|
1376
|
+
}
|
|
1377
|
+
/** 设置面板宽度(轻量,不重建 DOM) */
|
|
1378
|
+
setWidth(e) {
|
|
1379
|
+
this.options.width = e, this.container && (this.container.style.width = e);
|
|
1380
|
+
}
|
|
1381
|
+
/** 设置面板字体大小(轻量,不重建 DOM) */
|
|
1382
|
+
setFontSize(e) {
|
|
1383
|
+
if (this.options.fontSize = e, this.container) {
|
|
1384
|
+
this.container.style.fontSize = e;
|
|
1385
|
+
const t = this.container.querySelector("[data-panel-title]");
|
|
1386
|
+
t && (t.style.fontSize = `calc(${e} + 2px)`);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1369
1389
|
/** 获取面板 DOM 元素(用于外部样式自定义) */
|
|
1370
1390
|
getElement() {
|
|
1371
1391
|
return this.container;
|
|
@@ -1390,9 +1410,9 @@ function hi(r) {
|
|
|
1390
1410
|
}
|
|
1391
1411
|
let W = null;
|
|
1392
1412
|
function fi(r) {
|
|
1393
|
-
return W ? (W.domElement.parentNode !== r && r.appendChild(W.domElement), W) : (W = new
|
|
1413
|
+
return W ? (W.domElement.parentNode !== r && r.appendChild(W.domElement), W) : (W = new Ai(), W.setSize(r.clientWidth, r.clientHeight), W.domElement.style.position = "absolute", W.domElement.style.top = "0", W.domElement.style.left = "0", W.domElement.style.pointerEvents = "none", r.appendChild(W.domElement), W);
|
|
1394
1414
|
}
|
|
1395
|
-
function
|
|
1415
|
+
function La() {
|
|
1396
1416
|
return W;
|
|
1397
1417
|
}
|
|
1398
1418
|
function pi(r, e) {
|
|
@@ -1430,7 +1450,7 @@ const I = {
|
|
|
1430
1450
|
};
|
|
1431
1451
|
let gt = !1, Oe = !1, Xt = [];
|
|
1432
1452
|
const bi = 16755200;
|
|
1433
|
-
let Te = null, Bt = null, bt = null,
|
|
1453
|
+
let Te = null, Bt = null, bt = null, be = [];
|
|
1434
1454
|
const st = /* @__PURE__ */ new Map();
|
|
1435
1455
|
let Ct, It = null, $e = null, et = null;
|
|
1436
1456
|
function Ii(r, e = "edit", t) {
|
|
@@ -1631,7 +1651,7 @@ function Si(r) {
|
|
|
1631
1651
|
return r;
|
|
1632
1652
|
}
|
|
1633
1653
|
function Hi(r, e = 500) {
|
|
1634
|
-
var
|
|
1654
|
+
var A;
|
|
1635
1655
|
if (!I.camera || !I.orbitControls) {
|
|
1636
1656
|
console.warn(
|
|
1637
1657
|
"[focusOnObject] 编辑器尚未初始化或已销毁,无法执行聚焦操作。请确保已调用 initEditor()"
|
|
@@ -1639,8 +1659,8 @@ function Hi(r, e = 500) {
|
|
|
1639
1659
|
return;
|
|
1640
1660
|
}
|
|
1641
1661
|
let t = null;
|
|
1642
|
-
if ((
|
|
1643
|
-
|
|
1662
|
+
if ((A = I.scene) == null || A.traverse((f) => {
|
|
1663
|
+
f.userData.id == r && (t = f);
|
|
1644
1664
|
}), !t) {
|
|
1645
1665
|
console.warn(
|
|
1646
1666
|
`[focusOnObject] 在场景中未找到 userData.id 为 "${r}" 的物体。请确认:1) 物体已被正确添加到场景(addModel);2) 物体的 userData.id 与传入的 objectId 一致;3) 传入的 objectId 不为空`
|
|
@@ -1653,7 +1673,7 @@ function Hi(r, e = 500) {
|
|
|
1653
1673
|
t.getWorldPosition(n);
|
|
1654
1674
|
const o = new P.Box3().setFromObject(t).getSize(new P.Vector3()), a = Math.max(o.x, o.y, o.z) * 0.5, l = Math.max(a * 3.5, 5), c = new P.Vector3().copy(I.camera.position).sub(n).normalize();
|
|
1655
1675
|
c.lengthSq() < 1e-3 && c.set(0, 0, 1);
|
|
1656
|
-
const
|
|
1676
|
+
const d = n.clone().add(c.multiplyScalar(l)), u = I.camera.position.clone(), h = I.orbitControls.target.clone();
|
|
1657
1677
|
try {
|
|
1658
1678
|
new nt.Tween({
|
|
1659
1679
|
x: u.x,
|
|
@@ -1664,21 +1684,21 @@ function Hi(r, e = 500) {
|
|
|
1664
1684
|
tz: h.z
|
|
1665
1685
|
}).to(
|
|
1666
1686
|
{
|
|
1667
|
-
x: s ? s.x :
|
|
1668
|
-
y: s ? s.y :
|
|
1669
|
-
z: s ? s.z :
|
|
1687
|
+
x: s ? s.x : d.x,
|
|
1688
|
+
y: s ? s.y : d.y,
|
|
1689
|
+
z: s ? s.z : d.z,
|
|
1670
1690
|
tx: n.x,
|
|
1671
1691
|
ty: n.y,
|
|
1672
1692
|
tz: n.z
|
|
1673
1693
|
},
|
|
1674
1694
|
e
|
|
1675
|
-
).easing(nt.Easing.Quadratic.InOut).onUpdate((
|
|
1676
|
-
I.camera.position.set(
|
|
1695
|
+
).easing(nt.Easing.Quadratic.InOut).onUpdate((f) => {
|
|
1696
|
+
I.camera.position.set(f.x, f.y, f.z), I.orbitControls.target.set(f.tx, f.ty, f.tz), I.orbitControls.update();
|
|
1677
1697
|
}).start();
|
|
1678
|
-
} catch (
|
|
1698
|
+
} catch (f) {
|
|
1679
1699
|
console.error(
|
|
1680
1700
|
"[focusOnObject] TWEEN 动画创建失败,请检查 @tweenjs/tween.js 是否已正确安装且版本兼容(^23.1.3):",
|
|
1681
|
-
|
|
1701
|
+
f
|
|
1682
1702
|
);
|
|
1683
1703
|
}
|
|
1684
1704
|
}
|
|
@@ -1707,20 +1727,20 @@ function Wi(r) {
|
|
|
1707
1727
|
e && ki(e);
|
|
1708
1728
|
}
|
|
1709
1729
|
function zi(r) {
|
|
1710
|
-
r.userData.isMovable && r.parent === I.scene && (
|
|
1730
|
+
r.userData.isMovable && r.parent === I.scene && (be.includes(r) || be.push(r));
|
|
1711
1731
|
}
|
|
1712
1732
|
function Gi(r) {
|
|
1713
|
-
const e =
|
|
1714
|
-
e !== -1 &&
|
|
1733
|
+
const e = be.indexOf(r);
|
|
1734
|
+
e !== -1 && be.splice(e, 1);
|
|
1715
1735
|
}
|
|
1716
1736
|
function Fi() {
|
|
1717
1737
|
const r = [];
|
|
1718
1738
|
I.scene.children.forEach((e) => {
|
|
1719
1739
|
e.userData.isMovable && r.push(e);
|
|
1720
|
-
}),
|
|
1740
|
+
}), be = r, vt();
|
|
1721
1741
|
}
|
|
1722
1742
|
function vt() {
|
|
1723
|
-
bt == null || bt([...
|
|
1743
|
+
bt == null || bt([...be]);
|
|
1724
1744
|
}
|
|
1725
1745
|
function qi(r) {
|
|
1726
1746
|
Te = r;
|
|
@@ -1732,12 +1752,12 @@ function Bi(r) {
|
|
|
1732
1752
|
bt = r;
|
|
1733
1753
|
}
|
|
1734
1754
|
function Ui() {
|
|
1735
|
-
return
|
|
1755
|
+
return be;
|
|
1736
1756
|
}
|
|
1737
1757
|
function Vi() {
|
|
1738
1758
|
return I.selectedObject;
|
|
1739
1759
|
}
|
|
1740
|
-
function
|
|
1760
|
+
function Na(r, e, t) {
|
|
1741
1761
|
if (!I.scene) return;
|
|
1742
1762
|
const s = st.get(r);
|
|
1743
1763
|
if (s) {
|
|
@@ -1745,48 +1765,53 @@ function Oa(r, e, t) {
|
|
|
1745
1765
|
n && n.updateItemByCode(e, t);
|
|
1746
1766
|
}
|
|
1747
1767
|
}
|
|
1748
|
-
function
|
|
1768
|
+
function ja() {
|
|
1749
1769
|
return I.scene;
|
|
1750
1770
|
}
|
|
1751
1771
|
function Yi() {
|
|
1752
1772
|
return I.camera;
|
|
1753
1773
|
}
|
|
1754
|
-
function
|
|
1774
|
+
function ka() {
|
|
1755
1775
|
return I.renderer;
|
|
1756
1776
|
}
|
|
1757
1777
|
async function Ki() {
|
|
1758
|
-
var c,
|
|
1778
|
+
var c, d, u;
|
|
1759
1779
|
J == null || J(!0), await new Promise((h) => setTimeout(h, 50)), Jt();
|
|
1760
1780
|
const r = I.scene;
|
|
1761
1781
|
if (!r)
|
|
1762
1782
|
return J == null || J(!1), "{}";
|
|
1763
1783
|
const e = [], t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1764
1784
|
r.traverse((h) => {
|
|
1765
|
-
var
|
|
1785
|
+
var A;
|
|
1766
1786
|
if (h.userData.type === "lightHelper" && e.push(h), h.type === "DirectionalLight" && h.userData.helper && (t.set(h, h.userData.helper), h.userData.helper = void 0), h.name && h.name.startsWith("DataPanel_")) {
|
|
1767
|
-
const
|
|
1768
|
-
if (
|
|
1769
|
-
const p =
|
|
1787
|
+
const f = h;
|
|
1788
|
+
if (f.element) {
|
|
1789
|
+
const p = f.element.querySelector(
|
|
1770
1790
|
"[data-panel-title]"
|
|
1771
|
-
),
|
|
1772
|
-
|
|
1791
|
+
), m = [];
|
|
1792
|
+
if (f.element.querySelectorAll(
|
|
1773
1793
|
".css2d-data-panel-item"
|
|
1774
|
-
).forEach((
|
|
1794
|
+
).forEach((y) => {
|
|
1775
1795
|
var w, D, S;
|
|
1776
|
-
const C =
|
|
1777
|
-
if (C &&
|
|
1778
|
-
const Z = (C.textContent || "").trim(),
|
|
1796
|
+
const C = y.querySelector(".item-label"), x = y.querySelector(".item-value");
|
|
1797
|
+
if (C && x) {
|
|
1798
|
+
const Z = (C.textContent || "").trim(), $ = ((D = (w = x.childNodes[0]) == null ? void 0 : w.textContent) == null ? void 0 : D.trim()) || "", Q = x.querySelector(
|
|
1779
1799
|
"span"
|
|
1780
|
-
),
|
|
1781
|
-
|
|
1782
|
-
}
|
|
1783
|
-
}), h.parent && s.set(
|
|
1784
|
-
h.parent.userData.id ? h.parent.userData.id : h.parent.uuid,
|
|
1785
|
-
{
|
|
1786
|
-
title: ((d = p == null ? void 0 : p.textContent) == null ? void 0 : d.trim()) || "",
|
|
1787
|
-
items: f
|
|
1800
|
+
), Ce = Q ? (Q.textContent || "").trim() : void 0, Mt = ((S = y.getAttribute("data-item-code")) == null ? void 0 : S.trim()) || void 0;
|
|
1801
|
+
m.push({ label: Z, value: $, unit: Ce, code: Mt });
|
|
1788
1802
|
}
|
|
1789
|
-
)
|
|
1803
|
+
}), h.parent) {
|
|
1804
|
+
const y = f.element.style.width || "", C = f.element.style.fontSize || "";
|
|
1805
|
+
s.set(
|
|
1806
|
+
h.parent.userData.id ? h.parent.userData.id : h.parent.uuid,
|
|
1807
|
+
{
|
|
1808
|
+
title: ((A = p == null ? void 0 : p.textContent) == null ? void 0 : A.trim()) || "",
|
|
1809
|
+
items: m,
|
|
1810
|
+
width: y,
|
|
1811
|
+
fontSize: C
|
|
1812
|
+
}
|
|
1813
|
+
);
|
|
1814
|
+
}
|
|
1790
1815
|
}
|
|
1791
1816
|
}
|
|
1792
1817
|
}), e.forEach((h) => r.remove(h));
|
|
@@ -1797,16 +1822,16 @@ async function Ki() {
|
|
|
1797
1822
|
h.name && h.name.startsWith("DataPanel_") && h.parent && h.parent.remove(h);
|
|
1798
1823
|
});
|
|
1799
1824
|
const i = n.toJSON();
|
|
1800
|
-
e.forEach((h) => r.add(h)), t.forEach((h,
|
|
1801
|
-
|
|
1825
|
+
e.forEach((h) => r.add(h)), t.forEach((h, A) => {
|
|
1826
|
+
A.userData.helper = h;
|
|
1802
1827
|
});
|
|
1803
1828
|
const o = {
|
|
1804
1829
|
position: (c = I.camera) == null ? void 0 : c.position.toArray(),
|
|
1805
|
-
rotation: (
|
|
1830
|
+
rotation: (d = I.camera) == null ? void 0 : d.rotation.toArray(),
|
|
1806
1831
|
target: ((u = I.orbitControls) == null ? void 0 : u.target.toArray()) || [0, 0, 0]
|
|
1807
1832
|
}, a = {};
|
|
1808
|
-
s.forEach((h,
|
|
1809
|
-
a[
|
|
1833
|
+
s.forEach((h, A) => {
|
|
1834
|
+
a[A] = h;
|
|
1810
1835
|
});
|
|
1811
1836
|
const l = JSON.stringify({
|
|
1812
1837
|
scene: i,
|
|
@@ -1819,38 +1844,23 @@ async function Ki() {
|
|
|
1819
1844
|
function Zi(r, e = "edit", t) {
|
|
1820
1845
|
var o, a, l;
|
|
1821
1846
|
const s = typeof r == "string" ? JSON.parse(r) : r, i = new P.ObjectLoader().parse(s);
|
|
1822
|
-
|
|
1823
|
-
const
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
const f = p.userData.id || p.uuid, g = t[f];
|
|
1835
|
-
if (g && p.userData.isMovable) {
|
|
1836
|
-
Li(p);
|
|
1837
|
-
const x = new Gn({
|
|
1838
|
-
title: g.title,
|
|
1839
|
-
items: g.items,
|
|
1840
|
-
width: `${h}px`,
|
|
1841
|
-
fontSize: `${m}px`
|
|
1842
|
-
});
|
|
1843
|
-
x.attachTo(p), x.visible = !1, Fn(p, x);
|
|
1844
|
-
}
|
|
1845
|
-
});
|
|
1846
|
-
}
|
|
1847
|
-
e === "edit" && ((l = I.scene) == null || l.traverse((c) => {
|
|
1848
|
-
var A;
|
|
1847
|
+
i.type === "Scene" ? I.scene = i : (o = I.scene) == null || o.add(i), t && ((a = I.scene) == null || a.traverse((c) => {
|
|
1848
|
+
const d = c.userData.id || c.uuid, u = t[d];
|
|
1849
|
+
if (u && c.userData.isMovable) {
|
|
1850
|
+
Li(c);
|
|
1851
|
+
const h = new Gn({
|
|
1852
|
+
title: u.title,
|
|
1853
|
+
items: u.items
|
|
1854
|
+
});
|
|
1855
|
+
h.attachTo(c), h.visible = !1, u.width && h.setWidth(u.width), u.fontSize && h.setFontSize(u.fontSize), Fn(c, h);
|
|
1856
|
+
}
|
|
1857
|
+
})), e === "edit" && ((l = I.scene) == null || l.traverse((c) => {
|
|
1858
|
+
var d;
|
|
1849
1859
|
if (c.type === "DirectionalLight") {
|
|
1850
1860
|
const u = c;
|
|
1851
1861
|
if (!u.userData.helper) {
|
|
1852
1862
|
const h = new P.DirectionalLightHelper(u, 1);
|
|
1853
|
-
h.userData.type = "lightHelper", u.userData.helper = h, (
|
|
1863
|
+
h.userData.type = "lightHelper", u.userData.helper = h, (d = I.scene) == null || d.add(h);
|
|
1854
1864
|
}
|
|
1855
1865
|
}
|
|
1856
1866
|
}));
|
|
@@ -1868,9 +1878,9 @@ function Vn(r) {
|
|
|
1868
1878
|
Vn(t);
|
|
1869
1879
|
}
|
|
1870
1880
|
function Qi() {
|
|
1871
|
-
It !== null && (cancelAnimationFrame(It), It = null), $e && I.container && (I.container.removeEventListener("click", $e), $e = null), et && (window.removeEventListener("resize", et), et = null), I.orbitControls && (I.orbitControls.dispose(), I.orbitControls = null), I.transformControls && (I.transformControls.dispose(), I.transformControls = null), I.scene && (Vn(I.scene), I.scene = null), I.renderer && (I.renderer.dispose(), I.renderer.domElement && I.container && I.container.removeChild(I.renderer.domElement), I.renderer = null), gi(), I.camera = null, I.gridHelper = null, I.selectedObject = null, I.container = null, I.mode = "",
|
|
1881
|
+
It !== null && (cancelAnimationFrame(It), It = null), $e && I.container && (I.container.removeEventListener("click", $e), $e = null), et && (window.removeEventListener("resize", et), et = null), I.orbitControls && (I.orbitControls.dispose(), I.orbitControls = null), I.transformControls && (I.transformControls.dispose(), I.transformControls = null), I.scene && (Vn(I.scene), I.scene = null), I.renderer && (I.renderer.dispose(), I.renderer.domElement && I.container && I.container.removeChild(I.renderer.domElement), I.renderer = null), gi(), I.camera = null, I.gridHelper = null, I.selectedObject = null, I.container = null, I.mode = "", be = [], st.clear(), vt(), gt = !1, Oe = !1;
|
|
1872
1882
|
}
|
|
1873
|
-
const Ji = /^[og]\s*(.+)?/, _i = /^mtllib /, $i = /^usemtl /, eo = /^usemap /, In = /\s+/, yn = new M(), Rt = new M(), Cn = new M(), xn = new M(),
|
|
1883
|
+
const Ji = /^[og]\s*(.+)?/, _i = /^mtllib /, $i = /^usemtl /, eo = /^usemap /, In = /\s+/, yn = new M(), Rt = new M(), Cn = new M(), xn = new M(), te = new M(), ht = new he();
|
|
1874
1884
|
function to() {
|
|
1875
1885
|
const r = {
|
|
1876
1886
|
objects: [],
|
|
@@ -1980,7 +1990,7 @@ function to() {
|
|
|
1980
1990
|
},
|
|
1981
1991
|
addFaceNormal: function(e, t, s) {
|
|
1982
1992
|
const n = this.vertices, i = this.object.geometry.normals;
|
|
1983
|
-
yn.fromArray(n, e), Rt.fromArray(n, t), Cn.fromArray(n, s),
|
|
1993
|
+
yn.fromArray(n, e), Rt.fromArray(n, t), Cn.fromArray(n, s), te.subVectors(Cn, Rt), xn.subVectors(yn, Rt), te.cross(xn), te.normalize(), i.push(te.x, te.y, te.z), i.push(te.x, te.y, te.z), i.push(te.x, te.y, te.z);
|
|
1984
1994
|
},
|
|
1985
1995
|
addColor: function(e, t, s) {
|
|
1986
1996
|
const n = this.colors, i = this.object.geometry.colors;
|
|
@@ -1999,16 +2009,16 @@ function to() {
|
|
|
1999
2009
|
this.object.geometry.uvs.push(t[e + 0], t[e + 1]);
|
|
2000
2010
|
},
|
|
2001
2011
|
addFace: function(e, t, s, n, i, o, a, l, c) {
|
|
2002
|
-
const
|
|
2003
|
-
let u = this.parseVertexIndex(e,
|
|
2004
|
-
if (this.addVertex(u, h,
|
|
2005
|
-
const
|
|
2006
|
-
u = this.parseNormalIndex(a,
|
|
2012
|
+
const d = this.vertices.length;
|
|
2013
|
+
let u = this.parseVertexIndex(e, d), h = this.parseVertexIndex(t, d), A = this.parseVertexIndex(s, d);
|
|
2014
|
+
if (this.addVertex(u, h, A), this.addColor(u, h, A), a !== void 0 && a !== "") {
|
|
2015
|
+
const f = this.normals.length;
|
|
2016
|
+
u = this.parseNormalIndex(a, f), h = this.parseNormalIndex(l, f), A = this.parseNormalIndex(c, f), this.addNormal(u, h, A);
|
|
2007
2017
|
} else
|
|
2008
|
-
this.addFaceNormal(u, h,
|
|
2018
|
+
this.addFaceNormal(u, h, A);
|
|
2009
2019
|
if (n !== void 0 && n !== "") {
|
|
2010
|
-
const
|
|
2011
|
-
u = this.parseUVIndex(n,
|
|
2020
|
+
const f = this.uvs.length;
|
|
2021
|
+
u = this.parseUVIndex(n, f), h = this.parseUVIndex(i, f), A = this.parseUVIndex(o, f), this.addUV(u, h, A), this.object.geometry.hasUVIndices = !0;
|
|
2012
2022
|
} else
|
|
2013
2023
|
this.addDefaultUV();
|
|
2014
2024
|
},
|
|
@@ -2086,9 +2096,9 @@ class no extends Yt {
|
|
|
2086
2096
|
for (let a = 0, l = s.length; a < l; a++) {
|
|
2087
2097
|
const c = s[a].trimStart();
|
|
2088
2098
|
if (c.length === 0) continue;
|
|
2089
|
-
const
|
|
2090
|
-
if (
|
|
2091
|
-
if (
|
|
2099
|
+
const d = c.charAt(0);
|
|
2100
|
+
if (d !== "#")
|
|
2101
|
+
if (d === "v") {
|
|
2092
2102
|
const u = c.split(In);
|
|
2093
2103
|
switch (u[0]) {
|
|
2094
2104
|
case "v":
|
|
@@ -2117,43 +2127,43 @@ class no extends Yt {
|
|
|
2117
2127
|
);
|
|
2118
2128
|
break;
|
|
2119
2129
|
}
|
|
2120
|
-
} else if (
|
|
2121
|
-
const h = c.slice(1).trim().split(In),
|
|
2122
|
-
for (let p = 0,
|
|
2130
|
+
} else if (d === "f") {
|
|
2131
|
+
const h = c.slice(1).trim().split(In), A = [];
|
|
2132
|
+
for (let p = 0, m = h.length; p < m; p++) {
|
|
2123
2133
|
const g = h[p];
|
|
2124
2134
|
if (g.length > 0) {
|
|
2125
|
-
const
|
|
2126
|
-
|
|
2135
|
+
const y = g.split("/");
|
|
2136
|
+
A.push(y);
|
|
2127
2137
|
}
|
|
2128
2138
|
}
|
|
2129
|
-
const
|
|
2130
|
-
for (let p = 1,
|
|
2131
|
-
const g =
|
|
2139
|
+
const f = A[0];
|
|
2140
|
+
for (let p = 1, m = A.length - 1; p < m; p++) {
|
|
2141
|
+
const g = A[p], y = A[p + 1];
|
|
2132
2142
|
t.addFace(
|
|
2133
|
-
|
|
2143
|
+
f[0],
|
|
2134
2144
|
g[0],
|
|
2135
|
-
|
|
2136
|
-
|
|
2145
|
+
y[0],
|
|
2146
|
+
f[1],
|
|
2137
2147
|
g[1],
|
|
2138
|
-
|
|
2139
|
-
|
|
2148
|
+
y[1],
|
|
2149
|
+
f[2],
|
|
2140
2150
|
g[2],
|
|
2141
|
-
|
|
2151
|
+
y[2]
|
|
2142
2152
|
);
|
|
2143
2153
|
}
|
|
2144
|
-
} else if (
|
|
2154
|
+
} else if (d === "l") {
|
|
2145
2155
|
const u = c.substring(1).trim().split(" ");
|
|
2146
2156
|
let h = [];
|
|
2147
|
-
const
|
|
2157
|
+
const A = [];
|
|
2148
2158
|
if (c.indexOf("/") === -1)
|
|
2149
2159
|
h = u;
|
|
2150
2160
|
else
|
|
2151
|
-
for (let
|
|
2152
|
-
const
|
|
2153
|
-
|
|
2161
|
+
for (let f = 0, p = u.length; f < p; f++) {
|
|
2162
|
+
const m = u[f].split("/");
|
|
2163
|
+
m[0] !== "" && h.push(m[0]), m[1] !== "" && A.push(m[1]);
|
|
2154
2164
|
}
|
|
2155
|
-
t.addLineGeometry(h,
|
|
2156
|
-
} else if (
|
|
2165
|
+
t.addLineGeometry(h, A);
|
|
2166
|
+
} else if (d === "p") {
|
|
2157
2167
|
const h = c.slice(1).trim().split(" ");
|
|
2158
2168
|
t.addPointGeometry(h);
|
|
2159
2169
|
} else if ((n = Ji.exec(c)) !== null) {
|
|
@@ -2165,7 +2175,7 @@ class no extends Yt {
|
|
|
2165
2175
|
t.materialLibraries.push(c.substring(7).trim());
|
|
2166
2176
|
else if (eo.test(c))
|
|
2167
2177
|
console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
|
|
2168
|
-
else if (
|
|
2178
|
+
else if (d === "s") {
|
|
2169
2179
|
if (n = c.split(" "), n.length > 1) {
|
|
2170
2180
|
const h = n[1].trim().toLowerCase();
|
|
2171
2181
|
t.object.smooth = h !== "0" && h !== "off";
|
|
@@ -2182,40 +2192,40 @@ class no extends Yt {
|
|
|
2182
2192
|
const i = new ft();
|
|
2183
2193
|
if (i.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0) === !0)
|
|
2184
2194
|
for (let a = 0, l = t.objects.length; a < l; a++) {
|
|
2185
|
-
const c = t.objects[a],
|
|
2186
|
-
let
|
|
2187
|
-
if (
|
|
2195
|
+
const c = t.objects[a], d = c.geometry, u = c.materials, h = d.type === "Line", A = d.type === "Points";
|
|
2196
|
+
let f = !1;
|
|
2197
|
+
if (d.vertices.length === 0) continue;
|
|
2188
2198
|
const p = new We();
|
|
2189
|
-
p.setAttribute("position", new
|
|
2190
|
-
const
|
|
2191
|
-
for (let
|
|
2192
|
-
const
|
|
2199
|
+
p.setAttribute("position", new me(d.vertices, 3)), d.normals.length > 0 && p.setAttribute("normal", new me(d.normals, 3)), d.colors.length > 0 && (f = !0, p.setAttribute("color", new me(d.colors, 3))), d.hasUVIndices === !0 && p.setAttribute("uv", new me(d.uvs, 2));
|
|
2200
|
+
const m = [];
|
|
2201
|
+
for (let y = 0, C = u.length; y < C; y++) {
|
|
2202
|
+
const x = u[y], w = x.name + "_" + x.smooth + "_" + f;
|
|
2193
2203
|
let D = t.materials[w];
|
|
2194
2204
|
if (this.materials !== null) {
|
|
2195
|
-
if (D = this.materials.create(
|
|
2205
|
+
if (D = this.materials.create(x.name), h && D && !(D instanceof Ze)) {
|
|
2196
2206
|
const S = new Ze();
|
|
2197
2207
|
Qe.prototype.copy.call(S, D), S.color.copy(D.color), D = S;
|
|
2198
|
-
} else if (
|
|
2208
|
+
} else if (A && D && !(D instanceof Ue)) {
|
|
2199
2209
|
const S = new Ue({ size: 10, sizeAttenuation: !1 });
|
|
2200
2210
|
Qe.prototype.copy.call(S, D), S.color.copy(D.color), S.map = D.map, D = S;
|
|
2201
2211
|
}
|
|
2202
2212
|
}
|
|
2203
|
-
D === void 0 && (h ? D = new Ze() :
|
|
2213
|
+
D === void 0 && (h ? D = new Ze() : A ? D = new Ue({ size: 1, sizeAttenuation: !1 }) : D = new ps(), D.name = x.name, D.flatShading = !x.smooth, D.vertexColors = f, t.materials[w] = D), m.push(D);
|
|
2204
2214
|
}
|
|
2205
2215
|
let g;
|
|
2206
|
-
if (
|
|
2207
|
-
for (let
|
|
2208
|
-
const
|
|
2209
|
-
p.addGroup(
|
|
2216
|
+
if (m.length > 1) {
|
|
2217
|
+
for (let y = 0, C = u.length; y < C; y++) {
|
|
2218
|
+
const x = u[y];
|
|
2219
|
+
p.addGroup(x.groupStart, x.groupCount, y);
|
|
2210
2220
|
}
|
|
2211
|
-
h ? g = new Wt(p,
|
|
2221
|
+
h ? g = new Wt(p, m) : A ? g = new pt(p, m) : g = new v(p, m);
|
|
2212
2222
|
} else
|
|
2213
|
-
h ? g = new Wt(p,
|
|
2223
|
+
h ? g = new Wt(p, m[0]) : A ? g = new pt(p, m[0]) : g = new v(p, m[0]);
|
|
2214
2224
|
g.name = c.name, i.add(g);
|
|
2215
2225
|
}
|
|
2216
2226
|
else if (t.vertices.length > 0) {
|
|
2217
2227
|
const a = new Ue({ size: 1, sizeAttenuation: !1 }), l = new We();
|
|
2218
|
-
l.setAttribute("position", new
|
|
2228
|
+
l.setAttribute("position", new me(t.vertices, 3)), t.colors.length > 0 && t.colors[0] !== void 0 && (l.setAttribute("color", new me(t.colors, 3)), a.vertexColors = !0);
|
|
2219
2229
|
const c = new pt(l, a);
|
|
2220
2230
|
i.add(c);
|
|
2221
2231
|
}
|
|
@@ -2336,11 +2346,11 @@ class io extends Yt {
|
|
|
2336
2346
|
}, l = new tt(this.manager);
|
|
2337
2347
|
l.setPath(this.path), l.setResponseType("arraybuffer"), l.setRequestHeader(this.requestHeader), l.setWithCredentials(this.withCredentials), l.load(e, function(c) {
|
|
2338
2348
|
try {
|
|
2339
|
-
i.parse(c, o, function(
|
|
2340
|
-
t(
|
|
2349
|
+
i.parse(c, o, function(d) {
|
|
2350
|
+
t(d), i.manager.itemEnd(e);
|
|
2341
2351
|
}, a);
|
|
2342
|
-
} catch (
|
|
2343
|
-
a(
|
|
2352
|
+
} catch (d) {
|
|
2353
|
+
a(d);
|
|
2344
2354
|
}
|
|
2345
2355
|
}, s, a);
|
|
2346
2356
|
}
|
|
@@ -2433,13 +2443,13 @@ class io extends Yt {
|
|
|
2433
2443
|
meshoptDecoder: this.meshoptDecoder
|
|
2434
2444
|
});
|
|
2435
2445
|
c.fileLoader.setRequestHeader(this.requestHeader);
|
|
2436
|
-
for (let
|
|
2437
|
-
const u = this.pluginCallbacks[
|
|
2446
|
+
for (let d = 0; d < this.pluginCallbacks.length; d++) {
|
|
2447
|
+
const u = this.pluginCallbacks[d](c);
|
|
2438
2448
|
u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[u.name] = u, o[u.name] = !0;
|
|
2439
2449
|
}
|
|
2440
2450
|
if (i.extensionsUsed)
|
|
2441
|
-
for (let
|
|
2442
|
-
const u = i.extensionsUsed[
|
|
2451
|
+
for (let d = 0; d < i.extensionsUsed.length; ++d) {
|
|
2452
|
+
const u = i.extensionsUsed[d], h = i.extensionsRequired || [];
|
|
2443
2453
|
switch (u) {
|
|
2444
2454
|
case O.KHR_MATERIALS_UNLIT:
|
|
2445
2455
|
o[u] = new ao();
|
|
@@ -2537,18 +2547,18 @@ class ro {
|
|
|
2537
2547
|
if (n) return n;
|
|
2538
2548
|
const i = t.json, l = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
2539
2549
|
let c;
|
|
2540
|
-
const
|
|
2541
|
-
l.color !== void 0 &&
|
|
2550
|
+
const d = new he(16777215);
|
|
2551
|
+
l.color !== void 0 && d.setRGB(l.color[0], l.color[1], l.color[2], ae);
|
|
2542
2552
|
const u = l.range !== void 0 ? l.range : 0;
|
|
2543
2553
|
switch (l.type) {
|
|
2544
2554
|
case "directional":
|
|
2545
|
-
c = new Is(
|
|
2555
|
+
c = new Is(d), c.target.position.set(0, 0, -1), c.add(c.target);
|
|
2546
2556
|
break;
|
|
2547
2557
|
case "point":
|
|
2548
|
-
c = new bs(
|
|
2558
|
+
c = new bs(d), c.distance = u;
|
|
2549
2559
|
break;
|
|
2550
2560
|
case "spot":
|
|
2551
|
-
c = new gs(
|
|
2561
|
+
c = new gs(d), c.distance = u, l.spot = l.spot || {}, l.spot.innerConeAngle = l.spot.innerConeAngle !== void 0 ? l.spot.innerConeAngle : 0, l.spot.outerConeAngle = l.spot.outerConeAngle !== void 0 ? l.spot.outerConeAngle : Math.PI / 4, c.angle = l.spot.outerConeAngle, c.penumbra = 1 - l.spot.innerConeAngle / l.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
|
|
2552
2562
|
break;
|
|
2553
2563
|
default:
|
|
2554
2564
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + l.type);
|
|
@@ -2575,7 +2585,7 @@ class ao {
|
|
|
2575
2585
|
}
|
|
2576
2586
|
extendParams(e, t, s) {
|
|
2577
2587
|
const n = [];
|
|
2578
|
-
e.color = new
|
|
2588
|
+
e.color = new he(1, 1, 1), e.opacity = 1;
|
|
2579
2589
|
const i = t.pbrMetallicRoughness;
|
|
2580
2590
|
if (i) {
|
|
2581
2591
|
if (Array.isArray(i.baseColorFactor)) {
|
|
@@ -2651,7 +2661,7 @@ class ho {
|
|
|
2651
2661
|
const s = z(this.parser, e, this.name);
|
|
2652
2662
|
if (s === null) return Promise.resolve();
|
|
2653
2663
|
const n = [];
|
|
2654
|
-
if (t.sheenColor = new
|
|
2664
|
+
if (t.sheenColor = new he(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1, s.sheenColorFactor !== void 0) {
|
|
2655
2665
|
const i = s.sheenColorFactor;
|
|
2656
2666
|
t.sheenColor.setRGB(i[0], i[1], i[2], ae);
|
|
2657
2667
|
}
|
|
@@ -2685,7 +2695,7 @@ class po {
|
|
|
2685
2695
|
const n = [];
|
|
2686
2696
|
t.thickness = s.thicknessFactor !== void 0 ? s.thicknessFactor : 0, s.thicknessTexture !== void 0 && n.push(this.parser.assignTexture(t, "thicknessMap", s.thicknessTexture)), t.attenuationDistance = s.attenuationDistance || 1 / 0;
|
|
2687
2697
|
const i = s.attenuationColor || [1, 1, 1];
|
|
2688
|
-
return t.attenuationColor = new
|
|
2698
|
+
return t.attenuationColor = new he().setRGB(i[0], i[1], i[2], ae), Promise.all(n);
|
|
2689
2699
|
}
|
|
2690
2700
|
}
|
|
2691
2701
|
class mo {
|
|
@@ -2713,7 +2723,7 @@ class go {
|
|
|
2713
2723
|
const n = [];
|
|
2714
2724
|
t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularIntensityMap", s.specularTexture));
|
|
2715
2725
|
const i = s.specularColorFactor || [1, 1, 1];
|
|
2716
|
-
return t.specularColor = new
|
|
2726
|
+
return t.specularColor = new he().setRGB(i[0], i[1], i[2], ae), s.specularColorTexture !== void 0 && n.push(this.parser.assignTexture(t, "specularColorMap", s.specularColorTexture, Ae)), Promise.all(n);
|
|
2717
2727
|
}
|
|
2718
2728
|
}
|
|
2719
2729
|
class bo {
|
|
@@ -2809,12 +2819,12 @@ class vn {
|
|
|
2809
2819
|
return null;
|
|
2810
2820
|
}
|
|
2811
2821
|
return i.then(function(a) {
|
|
2812
|
-
const l = n.byteOffset || 0, c = n.byteLength || 0,
|
|
2813
|
-
return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(
|
|
2814
|
-
return
|
|
2822
|
+
const l = n.byteOffset || 0, c = n.byteLength || 0, d = n.count, u = n.byteStride, h = new Uint8Array(a, l, c);
|
|
2823
|
+
return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(d, u, h, n.mode, n.filter).then(function(A) {
|
|
2824
|
+
return A.buffer;
|
|
2815
2825
|
}) : o.ready.then(function() {
|
|
2816
|
-
const
|
|
2817
|
-
return o.decodeGltfBuffer(new Uint8Array(
|
|
2826
|
+
const A = new ArrayBuffer(d * u);
|
|
2827
|
+
return o.decodeGltfBuffer(new Uint8Array(A), d, u, h, n.mode, n.filter), A;
|
|
2818
2828
|
});
|
|
2819
2829
|
});
|
|
2820
2830
|
} else
|
|
@@ -2831,25 +2841,25 @@ class wo {
|
|
|
2831
2841
|
return null;
|
|
2832
2842
|
const n = t.meshes[s.mesh];
|
|
2833
2843
|
for (const c of n.primitives)
|
|
2834
|
-
if (c.mode !==
|
|
2844
|
+
if (c.mode !== ne.TRIANGLES && c.mode !== ne.TRIANGLE_STRIP && c.mode !== ne.TRIANGLE_FAN && c.mode !== void 0)
|
|
2835
2845
|
return null;
|
|
2836
2846
|
const o = s.extensions[this.name].attributes, a = [], l = {};
|
|
2837
2847
|
for (const c in o)
|
|
2838
|
-
a.push(this.parser.getDependency("accessor", o[c]).then((
|
|
2848
|
+
a.push(this.parser.getDependency("accessor", o[c]).then((d) => (l[c] = d, l[c])));
|
|
2839
2849
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
|
|
2840
|
-
const
|
|
2841
|
-
for (const
|
|
2842
|
-
const p = new
|
|
2843
|
-
for (let
|
|
2844
|
-
l.TRANSLATION &&
|
|
2845
|
-
for (const
|
|
2846
|
-
if (
|
|
2847
|
-
const w = l[
|
|
2850
|
+
const d = c.pop(), u = d.isGroup ? d.children : [d], h = c[0].count, A = [];
|
|
2851
|
+
for (const f of u) {
|
|
2852
|
+
const p = new ge(), m = new M(), g = new K(), y = new M(1, 1, 1), C = new ys(f.geometry, f.material, h);
|
|
2853
|
+
for (let x = 0; x < h; x++)
|
|
2854
|
+
l.TRANSLATION && m.fromBufferAttribute(l.TRANSLATION, x), l.ROTATION && g.fromBufferAttribute(l.ROTATION, x), l.SCALE && y.fromBufferAttribute(l.SCALE, x), C.setMatrixAt(x, p.compose(m, g, y));
|
|
2855
|
+
for (const x in l)
|
|
2856
|
+
if (x === "_COLOR_0") {
|
|
2857
|
+
const w = l[x];
|
|
2848
2858
|
C.instanceColor = new Cs(w.array, w.itemSize, w.normalized);
|
|
2849
|
-
} else
|
|
2850
|
-
ke.prototype.copy.call(C,
|
|
2859
|
+
} else x !== "TRANSLATION" && x !== "ROTATION" && x !== "SCALE" && f.geometry.setAttribute(x, l[x]);
|
|
2860
|
+
ke.prototype.copy.call(C, f), this.parser.assignFinalMaterial(C), A.push(C);
|
|
2851
2861
|
}
|
|
2852
|
-
return
|
|
2862
|
+
return d.isGroup ? (d.clear(), d.add(...A), d) : A[0];
|
|
2853
2863
|
}));
|
|
2854
2864
|
}
|
|
2855
2865
|
}
|
|
@@ -2893,25 +2903,25 @@ class Mo {
|
|
|
2893
2903
|
}
|
|
2894
2904
|
decodePrimitive(e, t) {
|
|
2895
2905
|
const s = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, l = {}, c = {};
|
|
2896
|
-
for (const
|
|
2897
|
-
const u = Ut[
|
|
2898
|
-
a[u] = o[
|
|
2906
|
+
for (const d in o) {
|
|
2907
|
+
const u = Ut[d] || d.toLowerCase();
|
|
2908
|
+
a[u] = o[d];
|
|
2899
2909
|
}
|
|
2900
|
-
for (const
|
|
2901
|
-
const u = Ut[
|
|
2902
|
-
if (o[
|
|
2903
|
-
const h = s.accessors[e.attributes[
|
|
2904
|
-
c[u] =
|
|
2910
|
+
for (const d in e.attributes) {
|
|
2911
|
+
const u = Ut[d] || d.toLowerCase();
|
|
2912
|
+
if (o[d] !== void 0) {
|
|
2913
|
+
const h = s.accessors[e.attributes[d]], A = je[h.componentType];
|
|
2914
|
+
c[u] = A.name, l[u] = h.normalized === !0;
|
|
2905
2915
|
}
|
|
2906
2916
|
}
|
|
2907
|
-
return t.getDependency("bufferView", i).then(function(
|
|
2917
|
+
return t.getDependency("bufferView", i).then(function(d) {
|
|
2908
2918
|
return new Promise(function(u, h) {
|
|
2909
|
-
n.decodeDracoFile(
|
|
2910
|
-
for (const
|
|
2911
|
-
const p =
|
|
2912
|
-
|
|
2919
|
+
n.decodeDracoFile(d, function(A) {
|
|
2920
|
+
for (const f in A.attributes) {
|
|
2921
|
+
const p = A.attributes[f], m = l[f];
|
|
2922
|
+
m !== void 0 && (p.normalized = m);
|
|
2913
2923
|
}
|
|
2914
|
-
u(
|
|
2924
|
+
u(A);
|
|
2915
2925
|
}, a, c, ae, h);
|
|
2916
2926
|
});
|
|
2917
2927
|
});
|
|
@@ -2941,10 +2951,10 @@ class Zn extends zs {
|
|
|
2941
2951
|
return t;
|
|
2942
2952
|
}
|
|
2943
2953
|
interpolate_(e, t, s, n) {
|
|
2944
|
-
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, c = a * 3,
|
|
2945
|
-
for (let
|
|
2946
|
-
const w = o[p +
|
|
2947
|
-
i[
|
|
2954
|
+
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, c = a * 3, d = n - t, u = (s - t) / d, h = u * u, A = h * u, f = e * c, p = f - c, m = -2 * A + 3 * h, g = A - h, y = 1 - m, C = g - h + u;
|
|
2955
|
+
for (let x = 0; x !== a; x++) {
|
|
2956
|
+
const w = o[p + x + a], D = o[p + x + l] * d, S = o[f + x + a], Z = o[f + x] * d;
|
|
2957
|
+
i[x] = y * w + C * D + m * S + g * Z;
|
|
2948
2958
|
}
|
|
2949
2959
|
return i;
|
|
2950
2960
|
}
|
|
@@ -2956,7 +2966,7 @@ class Oo extends Zn {
|
|
|
2956
2966
|
return To.fromArray(i).normalize().toArray(i), i;
|
|
2957
2967
|
}
|
|
2958
2968
|
}
|
|
2959
|
-
const
|
|
2969
|
+
const ne = {
|
|
2960
2970
|
POINTS: 0,
|
|
2961
2971
|
LINES: 1,
|
|
2962
2972
|
LINE_LOOP: 2,
|
|
@@ -3001,7 +3011,7 @@ const te = {
|
|
|
3001
3011
|
COLOR_0: "color",
|
|
3002
3012
|
WEIGHTS_0: "skinWeight",
|
|
3003
3013
|
JOINTS_0: "skinIndex"
|
|
3004
|
-
},
|
|
3014
|
+
}, pe = {
|
|
3005
3015
|
scale: "scale",
|
|
3006
3016
|
translation: "position",
|
|
3007
3017
|
rotation: "quaternion",
|
|
@@ -3028,7 +3038,7 @@ function Ro(r) {
|
|
|
3028
3038
|
side: Ws
|
|
3029
3039
|
})), r.DefaultMaterial;
|
|
3030
3040
|
}
|
|
3031
|
-
function
|
|
3041
|
+
function we(r, e, t) {
|
|
3032
3042
|
for (const s in t.extensions)
|
|
3033
3043
|
r[s] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[s] = t.extensions[s]);
|
|
3034
3044
|
}
|
|
@@ -3037,13 +3047,13 @@ function re(r, e) {
|
|
|
3037
3047
|
}
|
|
3038
3048
|
function So(r, e, t) {
|
|
3039
3049
|
let s = !1, n = !1, i = !1;
|
|
3040
|
-
for (let c = 0,
|
|
3050
|
+
for (let c = 0, d = e.length; c < d; c++) {
|
|
3041
3051
|
const u = e[c];
|
|
3042
3052
|
if (u.POSITION !== void 0 && (s = !0), u.NORMAL !== void 0 && (n = !0), u.COLOR_0 !== void 0 && (i = !0), s && n && i) break;
|
|
3043
3053
|
}
|
|
3044
3054
|
if (!s && !n && !i) return Promise.resolve(r);
|
|
3045
3055
|
const o = [], a = [], l = [];
|
|
3046
|
-
for (let c = 0,
|
|
3056
|
+
for (let c = 0, d = e.length; c < d; c++) {
|
|
3047
3057
|
const u = e[c];
|
|
3048
3058
|
if (s) {
|
|
3049
3059
|
const h = u.POSITION !== void 0 ? t.getDependency("accessor", u.POSITION) : r.attributes.position;
|
|
@@ -3063,8 +3073,8 @@ function So(r, e, t) {
|
|
|
3063
3073
|
Promise.all(a),
|
|
3064
3074
|
Promise.all(l)
|
|
3065
3075
|
]).then(function(c) {
|
|
3066
|
-
const
|
|
3067
|
-
return s && (r.morphAttributes.position =
|
|
3076
|
+
const d = c[0], u = c[1], h = c[2];
|
|
3077
|
+
return s && (r.morphAttributes.position = d), n && (r.morphAttributes.normal = u), i && (r.morphAttributes.color = h), r.morphTargetsRelative = !0, r;
|
|
3068
3078
|
});
|
|
3069
3079
|
}
|
|
3070
3080
|
function Ho(r, e) {
|
|
@@ -3113,7 +3123,7 @@ function Vt(r) {
|
|
|
3113
3123
|
function No(r) {
|
|
3114
3124
|
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";
|
|
3115
3125
|
}
|
|
3116
|
-
const jo = new
|
|
3126
|
+
const jo = new ge();
|
|
3117
3127
|
class ko {
|
|
3118
3128
|
constructor(e = {}, t = {}) {
|
|
3119
3129
|
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new oo(), 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 = {};
|
|
@@ -3154,7 +3164,7 @@ class ko {
|
|
|
3154
3164
|
parser: s,
|
|
3155
3165
|
userData: {}
|
|
3156
3166
|
};
|
|
3157
|
-
return
|
|
3167
|
+
return we(i, a, n), re(a, n), Promise.all(s._invokeAll(function(l) {
|
|
3158
3168
|
return l.afterRoot && l.afterRoot(a);
|
|
3159
3169
|
})).then(function() {
|
|
3160
3170
|
for (const l of a.scenes)
|
|
@@ -3210,8 +3220,8 @@ class ko {
|
|
|
3210
3220
|
const n = s.clone(), i = (o, a) => {
|
|
3211
3221
|
const l = this.associations.get(o);
|
|
3212
3222
|
l != null && this.associations.set(a, l);
|
|
3213
|
-
for (const [c,
|
|
3214
|
-
i(
|
|
3223
|
+
for (const [c, d] of o.children.entries())
|
|
3224
|
+
i(d, a.children[c]);
|
|
3215
3225
|
};
|
|
3216
3226
|
return i(s, n), n.name += "_instance_" + e.uses[t]++, n;
|
|
3217
3227
|
}
|
|
@@ -3369,24 +3379,24 @@ class ko {
|
|
|
3369
3379
|
}
|
|
3370
3380
|
const i = [];
|
|
3371
3381
|
return n.bufferView !== void 0 ? i.push(this.getDependency("bufferView", n.bufferView)) : i.push(null), n.sparse !== void 0 && (i.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(i).then(function(o) {
|
|
3372
|
-
const a = o[0], l = St[n.type], c = je[n.componentType],
|
|
3373
|
-
let p,
|
|
3374
|
-
if (
|
|
3375
|
-
const g = Math.floor(h /
|
|
3376
|
-
let C = t.cache.get(
|
|
3377
|
-
C || (p = new c(a, g *
|
|
3382
|
+
const a = o[0], l = St[n.type], c = je[n.componentType], d = c.BYTES_PER_ELEMENT, u = d * l, h = n.byteOffset || 0, A = n.bufferView !== void 0 ? s.bufferViews[n.bufferView].byteStride : void 0, f = n.normalized === !0;
|
|
3383
|
+
let p, m;
|
|
3384
|
+
if (A && A !== u) {
|
|
3385
|
+
const g = Math.floor(h / A), y = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + g + ":" + n.count;
|
|
3386
|
+
let C = t.cache.get(y);
|
|
3387
|
+
C || (p = new c(a, g * A, n.count * A / d), C = new Hn(p, A / d), t.cache.add(y, C)), m = new Ln(C, l, h % A / d, f);
|
|
3378
3388
|
} else
|
|
3379
|
-
a === null ? p = new c(n.count * l) : p = new c(a, h, n.count * l),
|
|
3389
|
+
a === null ? p = new c(n.count * l) : p = new c(a, h, n.count * l), m = new _e(p, l, f);
|
|
3380
3390
|
if (n.sparse !== void 0) {
|
|
3381
|
-
const g = St.SCALAR,
|
|
3382
|
-
a !== null && (
|
|
3391
|
+
const g = St.SCALAR, y = je[n.sparse.indices.componentType], C = n.sparse.indices.byteOffset || 0, x = n.sparse.values.byteOffset || 0, w = new y(o[1], C, n.sparse.count * g), D = new c(o[2], x, n.sparse.count * l);
|
|
3392
|
+
a !== null && (m = new _e(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
|
|
3383
3393
|
for (let S = 0, Z = w.length; S < Z; S++) {
|
|
3384
|
-
const
|
|
3385
|
-
if (
|
|
3394
|
+
const $ = w[S];
|
|
3395
|
+
if (m.setX($, D[S * l]), l >= 2 && m.setY($, D[S * l + 1]), l >= 3 && m.setZ($, D[S * l + 2]), l >= 4 && m.setW($, D[S * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
3386
3396
|
}
|
|
3387
|
-
|
|
3397
|
+
m.normalized = f;
|
|
3388
3398
|
}
|
|
3389
|
-
return
|
|
3399
|
+
return m;
|
|
3390
3400
|
});
|
|
3391
3401
|
}
|
|
3392
3402
|
/**
|
|
@@ -3409,10 +3419,10 @@ class ko {
|
|
|
3409
3419
|
const n = this, i = this.json, o = i.textures[e], a = i.images[t], l = (a.uri || a.bufferView) + ":" + o.sampler;
|
|
3410
3420
|
if (this.textureCache[l])
|
|
3411
3421
|
return this.textureCache[l];
|
|
3412
|
-
const c = this.loadImageSource(t, s).then(function(
|
|
3413
|
-
|
|
3422
|
+
const c = this.loadImageSource(t, s).then(function(d) {
|
|
3423
|
+
d.flipY = !1, d.name = o.name || a.name || "", d.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (d.name = a.uri);
|
|
3414
3424
|
const h = (i.samplers || {})[o.sampler] || {};
|
|
3415
|
-
return
|
|
3425
|
+
return d.magFilter = Dn[h.magFilter] || Gt, d.minFilter = Dn[h.minFilter] || Nn, d.wrapS = Pn[h.wrapS] || Ft, d.wrapT = Pn[h.wrapT] || Ft, d.generateMipmaps = !d.isCompressedTexture && d.minFilter !== jn && d.minFilter !== Gt, n.associations.set(d, { textures: e }), d;
|
|
3416
3426
|
}).catch(function() {
|
|
3417
3427
|
return null;
|
|
3418
3428
|
});
|
|
@@ -3432,20 +3442,20 @@ class ko {
|
|
|
3432
3442
|
});
|
|
3433
3443
|
else if (o.uri === void 0)
|
|
3434
3444
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
3435
|
-
const
|
|
3436
|
-
return new Promise(function(h,
|
|
3437
|
-
let
|
|
3438
|
-
t.isImageBitmapLoader === !0 && (
|
|
3439
|
-
const
|
|
3440
|
-
|
|
3441
|
-
}), t.load(Je.resolveURL(u, i.path),
|
|
3445
|
+
const d = Promise.resolve(l).then(function(u) {
|
|
3446
|
+
return new Promise(function(h, A) {
|
|
3447
|
+
let f = h;
|
|
3448
|
+
t.isImageBitmapLoader === !0 && (f = function(p) {
|
|
3449
|
+
const m = new tn(p);
|
|
3450
|
+
m.needsUpdate = !0, h(m);
|
|
3451
|
+
}), t.load(Je.resolveURL(u, i.path), f, void 0, A);
|
|
3442
3452
|
});
|
|
3443
3453
|
}).then(function(u) {
|
|
3444
3454
|
return c === !0 && a.revokeObjectURL(l), re(u, o), u.userData.mimeType = o.mimeType || No(o.uri), u;
|
|
3445
3455
|
}).catch(function(u) {
|
|
3446
3456
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", l), u;
|
|
3447
3457
|
});
|
|
3448
|
-
return this.sourceCache[e] =
|
|
3458
|
+
return this.sourceCache[e] = d, d;
|
|
3449
3459
|
}
|
|
3450
3460
|
/**
|
|
3451
3461
|
* Asynchronously assigns a texture to the given material parameters.
|
|
@@ -3521,7 +3531,7 @@ class ko {
|
|
|
3521
3531
|
o = u.getMaterialType(), c.push(u.extendParams(a, i, t));
|
|
3522
3532
|
} else {
|
|
3523
3533
|
const u = i.pbrMetallicRoughness || {};
|
|
3524
|
-
if (a.color = new
|
|
3534
|
+
if (a.color = new he(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
|
|
3525
3535
|
const h = u.baseColorFactor;
|
|
3526
3536
|
a.color.setRGB(h[0], h[1], h[2], ae), a.opacity = h[3];
|
|
3527
3537
|
}
|
|
@@ -3532,18 +3542,18 @@ class ko {
|
|
|
3532
3542
|
})));
|
|
3533
3543
|
}
|
|
3534
3544
|
i.doubleSided === !0 && (a.side = Rn);
|
|
3535
|
-
const
|
|
3536
|
-
if (
|
|
3545
|
+
const d = i.alphaMode || Ht.OPAQUE;
|
|
3546
|
+
if (d === Ht.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, d === Ht.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== Pe && (c.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new Y(1, 1), i.normalTexture.scale !== void 0)) {
|
|
3537
3547
|
const u = i.normalTexture.scale;
|
|
3538
3548
|
a.normalScale.set(u, u);
|
|
3539
3549
|
}
|
|
3540
3550
|
if (i.occlusionTexture !== void 0 && o !== Pe && (c.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && o !== Pe) {
|
|
3541
3551
|
const u = i.emissiveFactor;
|
|
3542
|
-
a.emissive = new
|
|
3552
|
+
a.emissive = new he().setRGB(u[0], u[1], u[2], ae);
|
|
3543
3553
|
}
|
|
3544
3554
|
return i.emissiveTexture !== void 0 && o !== Pe && c.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, Ae)), Promise.all(c).then(function() {
|
|
3545
3555
|
const u = new o(a);
|
|
3546
|
-
return i.name && (u.name = i.name), re(u, i), t.associations.set(u, { materials: e }), i.extensions &&
|
|
3556
|
+
return i.name && (u.name = i.name), re(u, i), t.associations.set(u, { materials: e }), i.extensions && we(n, u, i), u;
|
|
3547
3557
|
});
|
|
3548
3558
|
}
|
|
3549
3559
|
/**
|
|
@@ -3575,12 +3585,12 @@ class ko {
|
|
|
3575
3585
|
}
|
|
3576
3586
|
const o = [];
|
|
3577
3587
|
for (let a = 0, l = e.length; a < l; a++) {
|
|
3578
|
-
const c = e[a],
|
|
3588
|
+
const c = e[a], d = Lo(c), u = n[d];
|
|
3579
3589
|
if (u)
|
|
3580
3590
|
o.push(u.promise);
|
|
3581
3591
|
else {
|
|
3582
3592
|
let h;
|
|
3583
|
-
c.extensions && c.extensions[O.KHR_DRACO_MESH_COMPRESSION] ? h = i(c) : h = Tn(new We(), c, t), n[
|
|
3593
|
+
c.extensions && c.extensions[O.KHR_DRACO_MESH_COMPRESSION] ? h = i(c) : h = Tn(new We(), c, t), n[d] = { primitive: c, promise: h }, o.push(h);
|
|
3584
3594
|
}
|
|
3585
3595
|
}
|
|
3586
3596
|
return Promise.all(o);
|
|
@@ -3595,40 +3605,40 @@ class ko {
|
|
|
3595
3605
|
loadMesh(e) {
|
|
3596
3606
|
const t = this, s = this.json, n = this.extensions, i = s.meshes[e], o = i.primitives, a = [];
|
|
3597
3607
|
for (let l = 0, c = o.length; l < c; l++) {
|
|
3598
|
-
const
|
|
3599
|
-
a.push(
|
|
3608
|
+
const d = o[l].material === void 0 ? Ro(this.cache) : this.getDependency("material", o[l].material);
|
|
3609
|
+
a.push(d);
|
|
3600
3610
|
}
|
|
3601
3611
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
3602
|
-
const c = l.slice(0, l.length - 1),
|
|
3603
|
-
for (let
|
|
3604
|
-
const p = A
|
|
3612
|
+
const c = l.slice(0, l.length - 1), d = l[l.length - 1], u = [];
|
|
3613
|
+
for (let A = 0, f = d.length; A < f; A++) {
|
|
3614
|
+
const p = d[A], m = o[A];
|
|
3605
3615
|
let g;
|
|
3606
|
-
const
|
|
3607
|
-
if (
|
|
3608
|
-
g = i.isSkinnedMesh === !0 ? new Es(p,
|
|
3609
|
-
else if (
|
|
3610
|
-
g = new Wt(p,
|
|
3611
|
-
else if (
|
|
3612
|
-
g = new ue(p,
|
|
3613
|
-
else if (
|
|
3614
|
-
g = new Rs(p,
|
|
3615
|
-
else if (
|
|
3616
|
-
g = new pt(p,
|
|
3616
|
+
const y = c[A];
|
|
3617
|
+
if (m.mode === ne.TRIANGLES || m.mode === ne.TRIANGLE_STRIP || m.mode === ne.TRIANGLE_FAN || m.mode === void 0)
|
|
3618
|
+
g = i.isSkinnedMesh === !0 ? new Es(p, y) : new v(p, y), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), m.mode === ne.TRIANGLE_STRIP ? g.geometry = wn(g.geometry, Sn) : m.mode === ne.TRIANGLE_FAN && (g.geometry = wn(g.geometry, zt));
|
|
3619
|
+
else if (m.mode === ne.LINES)
|
|
3620
|
+
g = new Wt(p, y);
|
|
3621
|
+
else if (m.mode === ne.LINE_STRIP)
|
|
3622
|
+
g = new ue(p, y);
|
|
3623
|
+
else if (m.mode === ne.LINE_LOOP)
|
|
3624
|
+
g = new Rs(p, y);
|
|
3625
|
+
else if (m.mode === ne.POINTS)
|
|
3626
|
+
g = new pt(p, y);
|
|
3617
3627
|
else
|
|
3618
|
-
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " +
|
|
3619
|
-
Object.keys(g.geometry.morphAttributes).length > 0 && Ho(g, i), g.name = t.createUniqueName(i.name || "mesh_" + e), re(g, i),
|
|
3628
|
+
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
|
|
3629
|
+
Object.keys(g.geometry.morphAttributes).length > 0 && Ho(g, i), g.name = t.createUniqueName(i.name || "mesh_" + e), re(g, i), m.extensions && we(n, g, m), t.assignFinalMaterial(g), u.push(g);
|
|
3620
3630
|
}
|
|
3621
|
-
for (let
|
|
3622
|
-
t.associations.set(u[
|
|
3631
|
+
for (let A = 0, f = u.length; A < f; A++)
|
|
3632
|
+
t.associations.set(u[A], {
|
|
3623
3633
|
meshes: e,
|
|
3624
|
-
primitives:
|
|
3634
|
+
primitives: A
|
|
3625
3635
|
});
|
|
3626
3636
|
if (u.length === 1)
|
|
3627
|
-
return i.extensions &&
|
|
3637
|
+
return i.extensions && we(n, u[0], i), u[0];
|
|
3628
3638
|
const h = new ft();
|
|
3629
|
-
i.extensions &&
|
|
3630
|
-
for (let
|
|
3631
|
-
h.add(u[
|
|
3639
|
+
i.extensions && we(n, h, i), t.associations.set(h, { meshes: e });
|
|
3640
|
+
for (let A = 0, f = u.length; A < f; A++)
|
|
3641
|
+
h.add(u[A]);
|
|
3632
3642
|
return h;
|
|
3633
3643
|
});
|
|
3634
3644
|
}
|
|
@@ -3661,11 +3671,11 @@ class ko {
|
|
|
3661
3671
|
s.push(this._loadNodeShallow(t.joints[n]));
|
|
3662
3672
|
return t.inverseBindMatrices !== void 0 ? s.push(this.getDependency("accessor", t.inverseBindMatrices)) : s.push(null), Promise.all(s).then(function(n) {
|
|
3663
3673
|
const i = n.pop(), o = n, a = [], l = [];
|
|
3664
|
-
for (let c = 0,
|
|
3674
|
+
for (let c = 0, d = o.length; c < d; c++) {
|
|
3665
3675
|
const u = o[c];
|
|
3666
3676
|
if (u) {
|
|
3667
3677
|
a.push(u);
|
|
3668
|
-
const h = new
|
|
3678
|
+
const h = new ge();
|
|
3669
3679
|
i !== null && h.fromArray(i.array, c * 16), l.push(h);
|
|
3670
3680
|
} else
|
|
3671
3681
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[c]);
|
|
@@ -3681,30 +3691,30 @@ class ko {
|
|
|
3681
3691
|
* @return {Promise<AnimationClip>}
|
|
3682
3692
|
*/
|
|
3683
3693
|
loadAnimation(e) {
|
|
3684
|
-
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], l = [], c = [],
|
|
3694
|
+
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], l = [], c = [], d = [];
|
|
3685
3695
|
for (let u = 0, h = n.channels.length; u < h; u++) {
|
|
3686
|
-
const
|
|
3687
|
-
p.node !== void 0 && (o.push(this.getDependency("node",
|
|
3696
|
+
const A = n.channels[u], f = n.samplers[A.sampler], p = A.target, m = p.node, g = n.parameters !== void 0 ? n.parameters[f.input] : f.input, y = n.parameters !== void 0 ? n.parameters[f.output] : f.output;
|
|
3697
|
+
p.node !== void 0 && (o.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", g)), l.push(this.getDependency("accessor", y)), c.push(f), d.push(p));
|
|
3688
3698
|
}
|
|
3689
3699
|
return Promise.all([
|
|
3690
3700
|
Promise.all(o),
|
|
3691
3701
|
Promise.all(a),
|
|
3692
3702
|
Promise.all(l),
|
|
3693
3703
|
Promise.all(c),
|
|
3694
|
-
Promise.all(
|
|
3704
|
+
Promise.all(d)
|
|
3695
3705
|
]).then(function(u) {
|
|
3696
|
-
const h = u[0],
|
|
3697
|
-
for (let C = 0,
|
|
3698
|
-
const w = h[C], D =
|
|
3706
|
+
const h = u[0], A = u[1], f = u[2], p = u[3], m = u[4], g = [];
|
|
3707
|
+
for (let C = 0, x = h.length; C < x; C++) {
|
|
3708
|
+
const w = h[C], D = A[C], S = f[C], Z = p[C], $ = m[C];
|
|
3699
3709
|
if (w === void 0) continue;
|
|
3700
3710
|
w.updateMatrix && w.updateMatrix();
|
|
3701
|
-
const Q = s._createAnimationTracks(w, D, S, Z,
|
|
3711
|
+
const Q = s._createAnimationTracks(w, D, S, Z, $);
|
|
3702
3712
|
if (Q)
|
|
3703
|
-
for (let
|
|
3704
|
-
g.push(Q[
|
|
3713
|
+
for (let Ce = 0; Ce < Q.length; Ce++)
|
|
3714
|
+
g.push(Q[Ce]);
|
|
3705
3715
|
}
|
|
3706
|
-
const
|
|
3707
|
-
return re(
|
|
3716
|
+
const y = new Ns(i, void 0, g);
|
|
3717
|
+
return re(y, n), y;
|
|
3708
3718
|
});
|
|
3709
3719
|
}
|
|
3710
3720
|
createNodeMesh(e) {
|
|
@@ -3727,7 +3737,7 @@ class ko {
|
|
|
3727
3737
|
*/
|
|
3728
3738
|
loadNode(e) {
|
|
3729
3739
|
const t = this.json, s = this, n = t.nodes[e], i = s._loadNodeShallow(e), o = [], a = n.children || [];
|
|
3730
|
-
for (let c = 0,
|
|
3740
|
+
for (let c = 0, d = a.length; c < d; c++)
|
|
3731
3741
|
o.push(s.getDependency("node", a[c]));
|
|
3732
3742
|
const l = n.skin === void 0 ? Promise.resolve(null) : s.getDependency("skin", n.skin);
|
|
3733
3743
|
return Promise.all([
|
|
@@ -3735,17 +3745,17 @@ class ko {
|
|
|
3735
3745
|
Promise.all(o),
|
|
3736
3746
|
l
|
|
3737
3747
|
]).then(function(c) {
|
|
3738
|
-
const
|
|
3739
|
-
h !== null &&
|
|
3740
|
-
|
|
3748
|
+
const d = c[0], u = c[1], h = c[2];
|
|
3749
|
+
h !== null && d.traverse(function(A) {
|
|
3750
|
+
A.isSkinnedMesh && A.bind(h, jo);
|
|
3741
3751
|
});
|
|
3742
|
-
for (let
|
|
3743
|
-
|
|
3744
|
-
if (
|
|
3745
|
-
const
|
|
3746
|
-
|
|
3752
|
+
for (let A = 0, f = u.length; A < f; A++)
|
|
3753
|
+
d.add(u[A]);
|
|
3754
|
+
if (d.userData.pivot !== void 0 && u.length > 0) {
|
|
3755
|
+
const A = d.userData.pivot, f = u[0];
|
|
3756
|
+
d.pivot = new M().fromArray(A), d.position.x -= A[0], d.position.y -= A[1], d.position.z -= A[2], f.position.set(0, 0, 0), delete d.userData.pivot;
|
|
3747
3757
|
}
|
|
3748
|
-
return
|
|
3758
|
+
return d;
|
|
3749
3759
|
});
|
|
3750
3760
|
}
|
|
3751
3761
|
// ._loadNodeShallow() parses a single node.
|
|
@@ -3764,22 +3774,22 @@ class ko {
|
|
|
3764
3774
|
}).forEach(function(c) {
|
|
3765
3775
|
a.push(c);
|
|
3766
3776
|
}), this.nodeCache[e] = Promise.all(a).then(function(c) {
|
|
3767
|
-
let
|
|
3768
|
-
if (i.isBone === !0 ?
|
|
3777
|
+
let d;
|
|
3778
|
+
if (i.isBone === !0 ? d = new js() : c.length > 1 ? d = new ft() : c.length === 1 ? d = c[0] : d = new ke(), d !== c[0])
|
|
3769
3779
|
for (let u = 0, h = c.length; u < h; u++)
|
|
3770
|
-
|
|
3771
|
-
if (i.name && (
|
|
3772
|
-
const u = new
|
|
3773
|
-
u.fromArray(i.matrix),
|
|
3780
|
+
d.add(c[u]);
|
|
3781
|
+
if (i.name && (d.userData.name = i.name, d.name = o), re(d, i), i.extensions && we(s, d, i), i.matrix !== void 0) {
|
|
3782
|
+
const u = new ge();
|
|
3783
|
+
u.fromArray(i.matrix), d.applyMatrix4(u);
|
|
3774
3784
|
} else
|
|
3775
|
-
i.translation !== void 0 &&
|
|
3776
|
-
if (!n.associations.has(
|
|
3777
|
-
n.associations.set(
|
|
3785
|
+
i.translation !== void 0 && d.position.fromArray(i.translation), i.rotation !== void 0 && d.quaternion.fromArray(i.rotation), i.scale !== void 0 && d.scale.fromArray(i.scale);
|
|
3786
|
+
if (!n.associations.has(d))
|
|
3787
|
+
n.associations.set(d, {});
|
|
3778
3788
|
else if (i.mesh !== void 0 && n.meshCache.refs[i.mesh] > 1) {
|
|
3779
|
-
const u = n.associations.get(
|
|
3780
|
-
n.associations.set(
|
|
3789
|
+
const u = n.associations.get(d);
|
|
3790
|
+
n.associations.set(d, { ...u });
|
|
3781
3791
|
}
|
|
3782
|
-
return n.associations.get(
|
|
3792
|
+
return n.associations.get(d).nodes = e, d;
|
|
3783
3793
|
}), this.nodeCache[e];
|
|
3784
3794
|
}
|
|
3785
3795
|
/**
|
|
@@ -3791,22 +3801,22 @@ class ko {
|
|
|
3791
3801
|
*/
|
|
3792
3802
|
loadScene(e) {
|
|
3793
3803
|
const t = this.extensions, s = this.json.scenes[e], n = this, i = new ft();
|
|
3794
|
-
s.name && (i.name = n.createUniqueName(s.name)), re(i, s), s.extensions &&
|
|
3804
|
+
s.name && (i.name = n.createUniqueName(s.name)), re(i, s), s.extensions && we(t, i, s);
|
|
3795
3805
|
const o = s.nodes || [], a = [];
|
|
3796
3806
|
for (let l = 0, c = o.length; l < c; l++)
|
|
3797
3807
|
a.push(n.getDependency("node", o[l]));
|
|
3798
3808
|
return Promise.all(a).then(function(l) {
|
|
3799
|
-
for (let
|
|
3800
|
-
const h = l[
|
|
3809
|
+
for (let d = 0, u = l.length; d < u; d++) {
|
|
3810
|
+
const h = l[d];
|
|
3801
3811
|
h.parent !== null ? i.add(so(h)) : i.add(h);
|
|
3802
3812
|
}
|
|
3803
|
-
const c = (
|
|
3813
|
+
const c = (d) => {
|
|
3804
3814
|
const u = /* @__PURE__ */ new Map();
|
|
3805
|
-
for (const [h,
|
|
3806
|
-
(h instanceof Qe || h instanceof tn) && u.set(h,
|
|
3807
|
-
return
|
|
3808
|
-
const
|
|
3809
|
-
|
|
3815
|
+
for (const [h, A] of n.associations)
|
|
3816
|
+
(h instanceof Qe || h instanceof tn) && u.set(h, A);
|
|
3817
|
+
return d.traverse((h) => {
|
|
3818
|
+
const A = n.associations.get(h);
|
|
3819
|
+
A != null && u.set(h, A);
|
|
3810
3820
|
}), u;
|
|
3811
3821
|
};
|
|
3812
3822
|
return n.associations = c(i), i;
|
|
@@ -3814,39 +3824,39 @@ class ko {
|
|
|
3814
3824
|
}
|
|
3815
3825
|
_createAnimationTracks(e, t, s, n, i) {
|
|
3816
3826
|
const o = [], a = e.name ? e.name : e.uuid, l = [];
|
|
3817
|
-
function c(
|
|
3818
|
-
|
|
3827
|
+
function c(A) {
|
|
3828
|
+
A.morphTargetInfluences && l.push(A.name ? A.name : A.uuid);
|
|
3819
3829
|
}
|
|
3820
|
-
|
|
3821
|
-
let
|
|
3822
|
-
switch (
|
|
3823
|
-
case
|
|
3824
|
-
|
|
3830
|
+
pe[i.path] === pe.weights ? (c(e), e.isGroup && e.children.forEach(c)) : l.push(a);
|
|
3831
|
+
let d;
|
|
3832
|
+
switch (pe[i.path]) {
|
|
3833
|
+
case pe.weights:
|
|
3834
|
+
d = sn;
|
|
3825
3835
|
break;
|
|
3826
|
-
case
|
|
3827
|
-
|
|
3836
|
+
case pe.rotation:
|
|
3837
|
+
d = on;
|
|
3828
3838
|
break;
|
|
3829
|
-
case
|
|
3830
|
-
case
|
|
3831
|
-
|
|
3839
|
+
case pe.translation:
|
|
3840
|
+
case pe.scale:
|
|
3841
|
+
d = nn;
|
|
3832
3842
|
break;
|
|
3833
3843
|
default:
|
|
3834
3844
|
switch (s.itemSize) {
|
|
3835
3845
|
case 1:
|
|
3836
|
-
|
|
3846
|
+
d = sn;
|
|
3837
3847
|
break;
|
|
3838
3848
|
case 2:
|
|
3839
3849
|
case 3:
|
|
3840
3850
|
default:
|
|
3841
|
-
|
|
3851
|
+
d = nn;
|
|
3842
3852
|
break;
|
|
3843
3853
|
}
|
|
3844
3854
|
break;
|
|
3845
3855
|
}
|
|
3846
3856
|
const u = n.interpolation !== void 0 ? Eo[n.interpolation] : Wn, h = this._getArrayFromAccessor(s);
|
|
3847
|
-
for (let
|
|
3848
|
-
const p = new
|
|
3849
|
-
l[
|
|
3857
|
+
for (let A = 0, f = l.length; A < f; A++) {
|
|
3858
|
+
const p = new d(
|
|
3859
|
+
l[A] + "." + pe[i.path],
|
|
3850
3860
|
t.array,
|
|
3851
3861
|
h,
|
|
3852
3862
|
u
|
|
@@ -3881,8 +3891,8 @@ function Wo(r, e, t) {
|
|
|
3881
3891
|
new M(l[0], l[1], l[2]),
|
|
3882
3892
|
new M(c[0], c[1], c[2])
|
|
3883
3893
|
), a.normalized) {
|
|
3884
|
-
const
|
|
3885
|
-
n.min.multiplyScalar(
|
|
3894
|
+
const d = Vt(je[a.componentType]);
|
|
3895
|
+
n.min.multiplyScalar(d), n.max.multiplyScalar(d);
|
|
3886
3896
|
}
|
|
3887
3897
|
} else {
|
|
3888
3898
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
@@ -3893,12 +3903,12 @@ function Wo(r, e, t) {
|
|
|
3893
3903
|
const i = e.targets;
|
|
3894
3904
|
if (i !== void 0) {
|
|
3895
3905
|
const a = new M(), l = new M();
|
|
3896
|
-
for (let c = 0,
|
|
3906
|
+
for (let c = 0, d = i.length; c < d; c++) {
|
|
3897
3907
|
const u = i[c];
|
|
3898
3908
|
if (u.POSITION !== void 0) {
|
|
3899
|
-
const h = t.json.accessors[u.POSITION],
|
|
3900
|
-
if (
|
|
3901
|
-
if (l.setX(Math.max(Math.abs(
|
|
3909
|
+
const h = t.json.accessors[u.POSITION], A = h.min, f = h.max;
|
|
3910
|
+
if (A !== void 0 && f !== void 0) {
|
|
3911
|
+
if (l.setX(Math.max(Math.abs(A[0]), Math.abs(f[0]))), l.setY(Math.max(Math.abs(A[1]), Math.abs(f[1]))), l.setZ(Math.max(Math.abs(A[2]), Math.abs(f[2]))), h.normalized) {
|
|
3902
3912
|
const p = Vt(je[h.componentType]);
|
|
3903
3913
|
l.multiplyScalar(p);
|
|
3904
3914
|
}
|
|
@@ -4031,8 +4041,8 @@ class zo extends Yt {
|
|
|
4031
4041
|
);
|
|
4032
4042
|
}
|
|
4033
4043
|
let n;
|
|
4034
|
-
const i = this.workerNextTaskID++, o = e.byteLength, a = this._getWorker(i, o).then((l) => (n = l, new Promise((c,
|
|
4035
|
-
n._callbacks[i] = { resolve: c, reject:
|
|
4044
|
+
const i = this.workerNextTaskID++, o = e.byteLength, a = this._getWorker(i, o).then((l) => (n = l, new Promise((c, d) => {
|
|
4045
|
+
n._callbacks[i] = { resolve: c, reject: d }, n.postMessage({ type: "decode", id: i, taskConfig: t, buffer: e }, [e]);
|
|
4036
4046
|
}))).then((l) => this._createGeometry(l.geometry));
|
|
4037
4047
|
return a.catch(() => !0).then(() => {
|
|
4038
4048
|
n && i && this._releaseTask(n, i);
|
|
@@ -4050,8 +4060,8 @@ class zo extends Yt {
|
|
|
4050
4060
|
if (o === a)
|
|
4051
4061
|
c = new _e(i, o);
|
|
4052
4062
|
else {
|
|
4053
|
-
const
|
|
4054
|
-
c = new Ln(
|
|
4063
|
+
const d = new Hn(i, a);
|
|
4064
|
+
c = new Ln(d, o, 0);
|
|
4055
4065
|
}
|
|
4056
4066
|
n === "color" && (this._assignVertexColorSpace(c, l), c.normalized = !(i instanceof Float32Array)), t.setAttribute(n, c);
|
|
4057
4067
|
}
|
|
@@ -4059,7 +4069,7 @@ class zo extends Yt {
|
|
|
4059
4069
|
}
|
|
4060
4070
|
_assignVertexColorSpace(e, t) {
|
|
4061
4071
|
if (t !== Ae) return;
|
|
4062
|
-
const s = new
|
|
4072
|
+
const s = new he();
|
|
4063
4073
|
for (let n = 0, i = e.count; n < i; n++)
|
|
4064
4074
|
s.fromBufferAttribute(e, n), qt.colorSpaceToWorking(s, Ae), e.setXYZ(n, s.r, s.g, s.b);
|
|
4065
4075
|
}
|
|
@@ -4132,21 +4142,21 @@ function Go() {
|
|
|
4132
4142
|
const a = o.data;
|
|
4133
4143
|
switch (a.type) {
|
|
4134
4144
|
case "init":
|
|
4135
|
-
r = a.decoderConfig, e = new Promise(function(
|
|
4145
|
+
r = a.decoderConfig, e = new Promise(function(d) {
|
|
4136
4146
|
r.onModuleLoaded = function(u) {
|
|
4137
|
-
|
|
4147
|
+
d({ draco: u });
|
|
4138
4148
|
}, DracoDecoderModule(r);
|
|
4139
4149
|
});
|
|
4140
4150
|
break;
|
|
4141
4151
|
case "decode":
|
|
4142
4152
|
const l = a.buffer, c = a.taskConfig;
|
|
4143
|
-
e.then((
|
|
4144
|
-
const u =
|
|
4153
|
+
e.then((d) => {
|
|
4154
|
+
const u = d.draco, h = new u.Decoder();
|
|
4145
4155
|
try {
|
|
4146
|
-
const
|
|
4147
|
-
|
|
4148
|
-
} catch (
|
|
4149
|
-
console.error(
|
|
4156
|
+
const A = t(u, h, new Int8Array(l), c), f = A.attributes.map((p) => p.array.buffer);
|
|
4157
|
+
A.index && f.push(A.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: A }, f);
|
|
4158
|
+
} catch (A) {
|
|
4159
|
+
console.error(A), self.postMessage({ type: "error", id: a.id, error: A.message });
|
|
4150
4160
|
} finally {
|
|
4151
4161
|
u.destroy(h);
|
|
4152
4162
|
}
|
|
@@ -4155,58 +4165,58 @@ function Go() {
|
|
|
4155
4165
|
}
|
|
4156
4166
|
};
|
|
4157
4167
|
function t(o, a, l, c) {
|
|
4158
|
-
const
|
|
4159
|
-
let h,
|
|
4160
|
-
const
|
|
4161
|
-
if (
|
|
4162
|
-
h = new o.Mesh(),
|
|
4163
|
-
else if (
|
|
4164
|
-
h = new o.PointCloud(),
|
|
4168
|
+
const d = c.attributeIDs, u = c.attributeTypes;
|
|
4169
|
+
let h, A;
|
|
4170
|
+
const f = a.GetEncodedGeometryType(l);
|
|
4171
|
+
if (f === o.TRIANGULAR_MESH)
|
|
4172
|
+
h = new o.Mesh(), A = a.DecodeArrayToMesh(l, l.byteLength, h);
|
|
4173
|
+
else if (f === o.POINT_CLOUD)
|
|
4174
|
+
h = new o.PointCloud(), A = a.DecodeArrayToPointCloud(l, l.byteLength, h);
|
|
4165
4175
|
else
|
|
4166
4176
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
4167
|
-
if (!
|
|
4168
|
-
throw new Error("THREE.DRACOLoader: Decoding failed: " +
|
|
4177
|
+
if (!A.ok() || h.ptr === 0)
|
|
4178
|
+
throw new Error("THREE.DRACOLoader: Decoding failed: " + A.error_msg());
|
|
4169
4179
|
const p = { index: null, attributes: [] };
|
|
4170
|
-
for (const
|
|
4171
|
-
const g = self[u[
|
|
4172
|
-
let
|
|
4180
|
+
for (const m in d) {
|
|
4181
|
+
const g = self[u[m]];
|
|
4182
|
+
let y, C;
|
|
4173
4183
|
if (c.useUniqueIDs)
|
|
4174
|
-
C =
|
|
4184
|
+
C = d[m], y = a.GetAttributeByUniqueId(h, C);
|
|
4175
4185
|
else {
|
|
4176
|
-
if (C = a.GetAttributeId(h, o[
|
|
4177
|
-
|
|
4186
|
+
if (C = a.GetAttributeId(h, o[d[m]]), C === -1) continue;
|
|
4187
|
+
y = a.GetAttribute(h, C);
|
|
4178
4188
|
}
|
|
4179
|
-
const
|
|
4180
|
-
|
|
4189
|
+
const x = n(o, a, h, m, g, y);
|
|
4190
|
+
m === "color" && (x.vertexColorSpace = c.vertexColorSpace), p.attributes.push(x);
|
|
4181
4191
|
}
|
|
4182
|
-
return
|
|
4192
|
+
return f === o.TRIANGULAR_MESH && (p.index = s(o, a, h)), o.destroy(h), p;
|
|
4183
4193
|
}
|
|
4184
4194
|
function s(o, a, l) {
|
|
4185
|
-
const
|
|
4195
|
+
const d = l.num_faces() * 3, u = d * 4, h = o._malloc(u);
|
|
4186
4196
|
a.GetTrianglesUInt32Array(l, u, h);
|
|
4187
|
-
const
|
|
4188
|
-
return o._free(h), { array:
|
|
4197
|
+
const A = new Uint32Array(o.HEAPF32.buffer, h, d).slice();
|
|
4198
|
+
return o._free(h), { array: A, itemSize: 1 };
|
|
4189
4199
|
}
|
|
4190
|
-
function n(o, a, l, c,
|
|
4191
|
-
const h = l.num_points(),
|
|
4192
|
-
a.GetAttributeDataArrayForAllPoints(l, u,
|
|
4193
|
-
const w = new
|
|
4200
|
+
function n(o, a, l, c, d, u) {
|
|
4201
|
+
const h = l.num_points(), A = u.num_components(), f = i(o, d), p = A * d.BYTES_PER_ELEMENT, m = Math.ceil(p / 4) * 4, g = m / d.BYTES_PER_ELEMENT, y = h * p, C = h * m, x = o._malloc(y);
|
|
4202
|
+
a.GetAttributeDataArrayForAllPoints(l, u, f, y, x);
|
|
4203
|
+
const w = new d(o.HEAPF32.buffer, x, y / d.BYTES_PER_ELEMENT);
|
|
4194
4204
|
let D;
|
|
4195
|
-
if (p ===
|
|
4205
|
+
if (p === m)
|
|
4196
4206
|
D = w.slice();
|
|
4197
4207
|
else {
|
|
4198
|
-
D = new
|
|
4208
|
+
D = new d(C / d.BYTES_PER_ELEMENT);
|
|
4199
4209
|
let S = 0;
|
|
4200
|
-
for (let Z = 0,
|
|
4201
|
-
for (let Q = 0; Q <
|
|
4202
|
-
D[S + Q] = w[Z *
|
|
4210
|
+
for (let Z = 0, $ = w.length; Z < $; Z++) {
|
|
4211
|
+
for (let Q = 0; Q < A; Q++)
|
|
4212
|
+
D[S + Q] = w[Z * A + Q];
|
|
4203
4213
|
S += g;
|
|
4204
4214
|
}
|
|
4205
4215
|
}
|
|
4206
|
-
return o._free(
|
|
4216
|
+
return o._free(x), {
|
|
4207
4217
|
name: c,
|
|
4208
4218
|
count: h,
|
|
4209
|
-
itemSize:
|
|
4219
|
+
itemSize: A,
|
|
4210
4220
|
array: D,
|
|
4211
4221
|
stride: g
|
|
4212
4222
|
};
|
|
@@ -4258,21 +4268,21 @@ function Uo(r) {
|
|
|
4258
4268
|
repeatX: a = 4,
|
|
4259
4269
|
repeatY: l = 4,
|
|
4260
4270
|
speedX: c = 5e-4,
|
|
4261
|
-
speedY:
|
|
4262
|
-
} = r || {}, u = new P.PlaneGeometry(e, t),
|
|
4263
|
-
|
|
4264
|
-
}),
|
|
4271
|
+
speedY: d = 5e-4
|
|
4272
|
+
} = r || {}, u = new P.PlaneGeometry(e, t), A = new P.TextureLoader().load(Fo, (m) => {
|
|
4273
|
+
m.wrapS = m.wrapT = P.RepeatWrapping, m.repeat.set(a, l), m.generateMipmaps = !1, m.minFilter = P.LinearFilter, m.magFilter = P.LinearFilter;
|
|
4274
|
+
}), f = new P.MeshStandardMaterial({
|
|
4265
4275
|
color: s,
|
|
4266
4276
|
roughness: n,
|
|
4267
4277
|
metalness: i,
|
|
4268
|
-
normalMap:
|
|
4278
|
+
normalMap: A,
|
|
4269
4279
|
normalScale: new P.Vector2(o, o),
|
|
4270
4280
|
side: P.DoubleSide,
|
|
4271
4281
|
// 双面渲染,避免从侧面或底部看到黑色
|
|
4272
4282
|
transparent: !0,
|
|
4273
4283
|
opacity: 0.6
|
|
4274
|
-
}), p = new P.Mesh(u,
|
|
4275
|
-
p.rotation.x = -Math.PI / 2, p.position.y = 0, p.name = "水面(标准材质)", p.userData.isWater = !0, p.userData.isMovable = !0, p.userData.waterSpeed = { x: c, y:
|
|
4284
|
+
}), p = new P.Mesh(u, f);
|
|
4285
|
+
p.rotation.x = -Math.PI / 2, p.position.y = 0, p.name = "水面(标准材质)", p.userData.isWater = !0, p.userData.isMovable = !0, p.userData.waterSpeed = { x: c, y: d }, ze(p);
|
|
4276
4286
|
}
|
|
4277
4287
|
function Vo(r) {
|
|
4278
4288
|
return Et(!0), new Promise((e, t) => {
|
|
@@ -4300,8 +4310,8 @@ function Vo(r) {
|
|
|
4300
4310
|
var h;
|
|
4301
4311
|
u.userData.isMovable = !0, u.name || (u.name = u.type), u.type === "Mesh" && (u.frustumCulled = !0, (h = u.geometry) == null || h.computeVertexNormals(), u.castShadow = !0, u.receiveShadow = !0);
|
|
4302
4312
|
});
|
|
4303
|
-
const
|
|
4304
|
-
l.position.sub(
|
|
4313
|
+
const d = new P.Box3().setFromObject(l).getCenter(new P.Vector3());
|
|
4314
|
+
l.position.sub(d), ze(l, !0), Et(!1), e(l);
|
|
4305
4315
|
},
|
|
4306
4316
|
void 0,
|
|
4307
4317
|
(a) => {
|
|
@@ -4335,28 +4345,16 @@ function Ko(r) {
|
|
|
4335
4345
|
return console.warn("请先选中一个模型,再添加数据面板"), null;
|
|
4336
4346
|
const t = Zt(e);
|
|
4337
4347
|
t && (t.dispose(), hi(e));
|
|
4338
|
-
const s =
|
|
4339
|
-
150,
|
|
4340
|
-
// 最小宽度 150px(小屏设备)
|
|
4341
|
-
Math.round(s / n * i)
|
|
4342
|
-
), l = Math.max(
|
|
4343
|
-
12,
|
|
4344
|
-
Math.min(
|
|
4345
|
-
20,
|
|
4346
|
-
Math.round(o / i * 13)
|
|
4347
|
-
)
|
|
4348
|
-
), c = [
|
|
4348
|
+
const s = [
|
|
4349
4349
|
{ label: "温度", value: "30", unit: "℃" },
|
|
4350
4350
|
{ label: "湿度", value: "65", unit: "%" },
|
|
4351
4351
|
{ label: "压力", value: "101.3", unit: "kPa" },
|
|
4352
4352
|
{ label: "名称", value: e.name || "未命名" }
|
|
4353
|
-
],
|
|
4353
|
+
], n = new Gn({
|
|
4354
4354
|
title: (r == null ? void 0 : r.title) || "数据面板",
|
|
4355
|
-
items: (r == null ? void 0 : r.items) ||
|
|
4356
|
-
width: `${o}px`,
|
|
4357
|
-
fontSize: `${l}px`
|
|
4355
|
+
items: (r == null ? void 0 : r.items) || s
|
|
4358
4356
|
});
|
|
4359
|
-
return
|
|
4357
|
+
return n.attachTo(e), Fn(e, n), n;
|
|
4360
4358
|
}
|
|
4361
4359
|
const Zo = {
|
|
4362
4360
|
key: 1,
|
|
@@ -4364,7 +4362,7 @@ const Zo = {
|
|
|
4364
4362
|
}, Qo = { class: "tree-icon" }, Jo = { class: "tree-name" }, _o = {
|
|
4365
4363
|
key: 0,
|
|
4366
4364
|
class: "tree-children"
|
|
4367
|
-
}, $o = /* @__PURE__ */
|
|
4365
|
+
}, $o = /* @__PURE__ */ Ie({
|
|
4368
4366
|
__name: "TreeItem",
|
|
4369
4367
|
props: {
|
|
4370
4368
|
node: {},
|
|
@@ -4373,9 +4371,9 @@ const Zo = {
|
|
|
4373
4371
|
},
|
|
4374
4372
|
emits: ["select", "delete"],
|
|
4375
4373
|
setup(r, { emit: e }) {
|
|
4376
|
-
const t = r, s = e, n =
|
|
4374
|
+
const t = r, s = e, n = L(null), { expandedSet: i, toggleExpand: o } = es("treeExpand"), a = Be(() => i.value.has(t.node.uuid)), l = Be(() => (t.version, t.node.children.some((p) => p.userData.isMovable === !0))), c = Be(() => (t.version, t.node.children.filter(
|
|
4377
4375
|
(p) => p.userData.isMovable === !0
|
|
4378
|
-
))),
|
|
4376
|
+
))), d = Be(
|
|
4379
4377
|
() => {
|
|
4380
4378
|
var p;
|
|
4381
4379
|
return ((p = t.selectedObject) == null ? void 0 : p.uuid) === t.node.uuid;
|
|
@@ -4383,7 +4381,7 @@ const Zo = {
|
|
|
4383
4381
|
);
|
|
4384
4382
|
ts(
|
|
4385
4383
|
() => {
|
|
4386
|
-
|
|
4384
|
+
d.value && n.value && n.value.scrollIntoView({
|
|
4387
4385
|
block: "nearest",
|
|
4388
4386
|
// 仅当元素不在可视区域时才滚动
|
|
4389
4387
|
behavior: "smooth"
|
|
@@ -4396,8 +4394,8 @@ const Zo = {
|
|
|
4396
4394
|
p.stopPropagation(), s("select", t.node);
|
|
4397
4395
|
}, h = (p) => {
|
|
4398
4396
|
p.stopPropagation(), s("delete", t.node);
|
|
4399
|
-
},
|
|
4400
|
-
return (p,
|
|
4397
|
+
}, A = (p) => p.type === "Mesh" || p.type === "Sprite" ? "🟦" : p.type === "Light" ? "💡" : "📦", f = (p) => p.name || `${p.type} (${p.id})`;
|
|
4398
|
+
return (p, m) => {
|
|
4401
4399
|
const g = ns("TreeItem", !0);
|
|
4402
4400
|
return T(), R("div", {
|
|
4403
4401
|
class: "tree-node",
|
|
@@ -4405,49 +4403,49 @@ const Zo = {
|
|
|
4405
4403
|
ref: n
|
|
4406
4404
|
}, [
|
|
4407
4405
|
b("div", {
|
|
4408
|
-
class:
|
|
4406
|
+
class: ie(["tree-item", { selected: d.value }]),
|
|
4409
4407
|
onClick: u
|
|
4410
4408
|
}, [
|
|
4411
4409
|
l.value ? (T(), R("span", {
|
|
4412
4410
|
key: 0,
|
|
4413
4411
|
class: "toggle-icon",
|
|
4414
|
-
onClick:
|
|
4415
|
-
},
|
|
4416
|
-
b("span", Qo,
|
|
4417
|
-
b("span", Jo,
|
|
4412
|
+
onClick: m[0] || (m[0] = jt((y) => ss(o)(r.node.uuid), ["stop"]))
|
|
4413
|
+
}, _(a.value ? "▼" : "▶"), 1)) : (T(), R("span", Zo)),
|
|
4414
|
+
b("span", Qo, _(A(r.node)), 1),
|
|
4415
|
+
b("span", Jo, _(f(r.node)), 1),
|
|
4418
4416
|
b("button", {
|
|
4419
4417
|
class: "tree-delete",
|
|
4420
4418
|
onClick: jt(h, ["stop"])
|
|
4421
4419
|
}, "×")
|
|
4422
4420
|
], 2),
|
|
4423
4421
|
a.value && l.value ? (T(), R("div", _o, [
|
|
4424
|
-
(T(!0), R(
|
|
4425
|
-
key:
|
|
4426
|
-
node:
|
|
4422
|
+
(T(!0), R(Me, null, wt(c.value, (y) => (T(), Ke(g, {
|
|
4423
|
+
key: y.uuid,
|
|
4424
|
+
node: y,
|
|
4427
4425
|
"selected-object": r.selectedObject,
|
|
4428
4426
|
version: r.version,
|
|
4429
|
-
onSelect:
|
|
4430
|
-
onDelete:
|
|
4427
|
+
onSelect: m[1] || (m[1] = (C) => s("select", C)),
|
|
4428
|
+
onDelete: m[2] || (m[2] = (C) => s("delete", C))
|
|
4431
4429
|
}, null, 8, ["node", "selected-object", "version"]))), 128))
|
|
4432
4430
|
])) : X("", !0)
|
|
4433
4431
|
], 512);
|
|
4434
4432
|
};
|
|
4435
4433
|
}
|
|
4436
|
-
}),
|
|
4434
|
+
}), ye = (r, e) => {
|
|
4437
4435
|
const t = r.__vccOpts || r;
|
|
4438
4436
|
for (const [s, n] of e)
|
|
4439
4437
|
t[s] = n;
|
|
4440
4438
|
return t;
|
|
4441
|
-
}, er = /* @__PURE__ */
|
|
4439
|
+
}, er = /* @__PURE__ */ ye($o, [["__scopeId", "data-v-5ad9c842"]]), tr = { class: "property-group" }, nr = { class: "row" }, sr = { class: "property-group" }, ir = { class: "row" }, or = { class: "property-group" }, rr = { class: "row" }, ar = {
|
|
4442
4440
|
key: 0,
|
|
4443
4441
|
class: "property-group light-group"
|
|
4444
4442
|
}, lr = { class: "slider-row" }, cr = {
|
|
4445
4443
|
key: 1,
|
|
4446
4444
|
class: "property-group material-group"
|
|
4447
|
-
}, ur = { class: "slider-row" },
|
|
4445
|
+
}, ur = { class: "slider-row" }, dr = { class: "slider-value" }, Ar = { class: "slider-row" }, hr = { class: "slider-value" }, fr = { class: "slider-row" }, pr = { class: "slider-value" }, mr = {
|
|
4448
4446
|
key: 0,
|
|
4449
4447
|
class: "material-hint"
|
|
4450
|
-
}, gr = /* @__PURE__ */
|
|
4448
|
+
}, gr = /* @__PURE__ */ Ie({
|
|
4451
4449
|
__name: "TransformTab",
|
|
4452
4450
|
props: {
|
|
4453
4451
|
transform: {},
|
|
@@ -4459,43 +4457,43 @@ const Zo = {
|
|
|
4459
4457
|
metalness: 0,
|
|
4460
4458
|
roughness: 0.5,
|
|
4461
4459
|
opacity: 1
|
|
4462
|
-
}), o =
|
|
4460
|
+
}), o = L(!1), a = kt({
|
|
4463
4461
|
intensity: 1
|
|
4464
4462
|
});
|
|
4465
4463
|
function l() {
|
|
4466
4464
|
t.selectedObject && t.selectedObject.type === "DirectionalLight" && (t.selectedObject.intensity = a.intensity);
|
|
4467
4465
|
}
|
|
4468
4466
|
function c(h) {
|
|
4469
|
-
let
|
|
4470
|
-
return h.traverse((
|
|
4471
|
-
if (
|
|
4472
|
-
const p =
|
|
4473
|
-
for (const g of
|
|
4467
|
+
let A = null;
|
|
4468
|
+
return h.traverse((f) => {
|
|
4469
|
+
if (f.type === "Mesh" && !A) {
|
|
4470
|
+
const p = f, m = Array.isArray(p.material) ? p.material : [p.material];
|
|
4471
|
+
for (const g of m)
|
|
4474
4472
|
if (g && (g.type === "MeshStandardMaterial" || g.type === "MeshPhongMaterial")) {
|
|
4475
|
-
const
|
|
4476
|
-
|
|
4477
|
-
metalness:
|
|
4478
|
-
roughness:
|
|
4473
|
+
const y = g;
|
|
4474
|
+
A = {
|
|
4475
|
+
metalness: y.metalness ?? 0,
|
|
4476
|
+
roughness: y.roughness ?? 0.5,
|
|
4479
4477
|
opacity: g.opacity ?? 1
|
|
4480
4478
|
};
|
|
4481
4479
|
break;
|
|
4482
4480
|
}
|
|
4483
4481
|
}
|
|
4484
|
-
}),
|
|
4482
|
+
}), A;
|
|
4485
4483
|
}
|
|
4486
|
-
function
|
|
4487
|
-
let
|
|
4484
|
+
function d(h, A) {
|
|
4485
|
+
let f = !1;
|
|
4488
4486
|
return h.traverse((p) => {
|
|
4489
4487
|
if (p.type === "Mesh") {
|
|
4490
|
-
const
|
|
4491
|
-
for (const
|
|
4492
|
-
|
|
4488
|
+
const m = p, g = Array.isArray(m.material) ? m.material : [m.material];
|
|
4489
|
+
for (const y of g)
|
|
4490
|
+
y && (y.type === "MeshStandardMaterial" || y.type === "MeshPhongMaterial") && (A.metalness !== void 0 && (y.metalness = A.metalness), A.roughness !== void 0 && (y.roughness = A.roughness), A.opacity !== void 0 && (y.opacity = A.opacity, y.transparent = A.opacity < 1), y.needsUpdate = !0, f = !0);
|
|
4493
4491
|
}
|
|
4494
|
-
}),
|
|
4492
|
+
}), f;
|
|
4495
4493
|
}
|
|
4496
4494
|
function u() {
|
|
4497
4495
|
if (t.selectedObject) {
|
|
4498
|
-
const h =
|
|
4496
|
+
const h = d(t.selectedObject, {
|
|
4499
4497
|
metalness: i.metalness,
|
|
4500
4498
|
roughness: i.roughness,
|
|
4501
4499
|
opacity: i.opacity
|
|
@@ -4503,57 +4501,57 @@ const Zo = {
|
|
|
4503
4501
|
o.value = h;
|
|
4504
4502
|
}
|
|
4505
4503
|
}
|
|
4506
|
-
return
|
|
4504
|
+
return de(
|
|
4507
4505
|
() => t.selectedObject,
|
|
4508
4506
|
(h) => {
|
|
4509
4507
|
if (h) {
|
|
4510
|
-
const
|
|
4511
|
-
|
|
4508
|
+
const A = c(h);
|
|
4509
|
+
A ? (i.metalness = A.metalness, i.roughness = A.roughness, i.opacity = A.opacity, o.value = !0) : (i.metalness = 0, i.roughness = 0.5, i.opacity = 1, o.value = !1), h.type === "DirectionalLight" && (a.intensity = h.intensity ?? 1);
|
|
4512
4510
|
} else
|
|
4513
4511
|
i.metalness = 0, i.roughness = 0.5, i.opacity = 1, o.value = !1;
|
|
4514
4512
|
},
|
|
4515
4513
|
{ immediate: !0 }
|
|
4516
|
-
), (h,
|
|
4514
|
+
), (h, A) => (T(), R("div", null, [
|
|
4517
4515
|
b("div", tr, [
|
|
4518
|
-
|
|
4516
|
+
A[17] || (A[17] = b("label", null, "位置", -1)),
|
|
4519
4517
|
b("div", nr, [
|
|
4520
|
-
|
|
4518
|
+
A[14] || (A[14] = b("span", null, "X:", -1)),
|
|
4521
4519
|
E(b("input", {
|
|
4522
4520
|
type: "number",
|
|
4523
|
-
"onUpdate:modelValue":
|
|
4521
|
+
"onUpdate:modelValue": A[0] || (A[0] = (f) => r.transform.position.x = f),
|
|
4524
4522
|
step: "0.01",
|
|
4525
4523
|
onInput: n
|
|
4526
4524
|
}, null, 544), [
|
|
4527
4525
|
[
|
|
4528
|
-
|
|
4526
|
+
H,
|
|
4529
4527
|
r.transform.position.x,
|
|
4530
4528
|
void 0,
|
|
4531
4529
|
{ number: !0 }
|
|
4532
4530
|
]
|
|
4533
4531
|
]),
|
|
4534
|
-
|
|
4532
|
+
A[15] || (A[15] = b("span", null, "Y:", -1)),
|
|
4535
4533
|
E(b("input", {
|
|
4536
4534
|
type: "number",
|
|
4537
|
-
"onUpdate:modelValue":
|
|
4535
|
+
"onUpdate:modelValue": A[1] || (A[1] = (f) => r.transform.position.y = f),
|
|
4538
4536
|
step: "0.01",
|
|
4539
4537
|
onInput: n
|
|
4540
4538
|
}, null, 544), [
|
|
4541
4539
|
[
|
|
4542
|
-
|
|
4540
|
+
H,
|
|
4543
4541
|
r.transform.position.y,
|
|
4544
4542
|
void 0,
|
|
4545
4543
|
{ number: !0 }
|
|
4546
4544
|
]
|
|
4547
4545
|
]),
|
|
4548
|
-
|
|
4546
|
+
A[16] || (A[16] = b("span", null, "Z:", -1)),
|
|
4549
4547
|
E(b("input", {
|
|
4550
4548
|
type: "number",
|
|
4551
|
-
"onUpdate:modelValue":
|
|
4549
|
+
"onUpdate:modelValue": A[2] || (A[2] = (f) => r.transform.position.z = f),
|
|
4552
4550
|
step: "0.01",
|
|
4553
4551
|
onInput: n
|
|
4554
4552
|
}, null, 544), [
|
|
4555
4553
|
[
|
|
4556
|
-
|
|
4554
|
+
H,
|
|
4557
4555
|
r.transform.position.z,
|
|
4558
4556
|
void 0,
|
|
4559
4557
|
{ number: !0 }
|
|
@@ -4562,45 +4560,45 @@ const Zo = {
|
|
|
4562
4560
|
])
|
|
4563
4561
|
]),
|
|
4564
4562
|
b("div", sr, [
|
|
4565
|
-
|
|
4563
|
+
A[21] || (A[21] = b("label", null, "旋转 (弧度)", -1)),
|
|
4566
4564
|
b("div", ir, [
|
|
4567
|
-
|
|
4565
|
+
A[18] || (A[18] = b("span", null, "X:", -1)),
|
|
4568
4566
|
E(b("input", {
|
|
4569
4567
|
type: "number",
|
|
4570
|
-
"onUpdate:modelValue":
|
|
4568
|
+
"onUpdate:modelValue": A[3] || (A[3] = (f) => r.transform.rotation.x = f),
|
|
4571
4569
|
step: "0.01",
|
|
4572
4570
|
onInput: n
|
|
4573
4571
|
}, null, 544), [
|
|
4574
4572
|
[
|
|
4575
|
-
|
|
4573
|
+
H,
|
|
4576
4574
|
r.transform.rotation.x,
|
|
4577
4575
|
void 0,
|
|
4578
4576
|
{ number: !0 }
|
|
4579
4577
|
]
|
|
4580
4578
|
]),
|
|
4581
|
-
|
|
4579
|
+
A[19] || (A[19] = b("span", null, "Y:", -1)),
|
|
4582
4580
|
E(b("input", {
|
|
4583
4581
|
type: "number",
|
|
4584
|
-
"onUpdate:modelValue":
|
|
4582
|
+
"onUpdate:modelValue": A[4] || (A[4] = (f) => r.transform.rotation.y = f),
|
|
4585
4583
|
step: "0.01",
|
|
4586
4584
|
onInput: n
|
|
4587
4585
|
}, null, 544), [
|
|
4588
4586
|
[
|
|
4589
|
-
|
|
4587
|
+
H,
|
|
4590
4588
|
r.transform.rotation.y,
|
|
4591
4589
|
void 0,
|
|
4592
4590
|
{ number: !0 }
|
|
4593
4591
|
]
|
|
4594
4592
|
]),
|
|
4595
|
-
|
|
4593
|
+
A[20] || (A[20] = b("span", null, "Z:", -1)),
|
|
4596
4594
|
E(b("input", {
|
|
4597
4595
|
type: "number",
|
|
4598
|
-
"onUpdate:modelValue":
|
|
4596
|
+
"onUpdate:modelValue": A[5] || (A[5] = (f) => r.transform.rotation.z = f),
|
|
4599
4597
|
step: "0.01",
|
|
4600
4598
|
onInput: n
|
|
4601
4599
|
}, null, 544), [
|
|
4602
4600
|
[
|
|
4603
|
-
|
|
4601
|
+
H,
|
|
4604
4602
|
r.transform.rotation.z,
|
|
4605
4603
|
void 0,
|
|
4606
4604
|
{ number: !0 }
|
|
@@ -4609,45 +4607,45 @@ const Zo = {
|
|
|
4609
4607
|
])
|
|
4610
4608
|
]),
|
|
4611
4609
|
b("div", or, [
|
|
4612
|
-
|
|
4610
|
+
A[25] || (A[25] = b("label", null, "缩放", -1)),
|
|
4613
4611
|
b("div", rr, [
|
|
4614
|
-
|
|
4612
|
+
A[22] || (A[22] = b("span", null, "X:", -1)),
|
|
4615
4613
|
E(b("input", {
|
|
4616
4614
|
type: "number",
|
|
4617
|
-
"onUpdate:modelValue":
|
|
4615
|
+
"onUpdate:modelValue": A[6] || (A[6] = (f) => r.transform.scale.x = f),
|
|
4618
4616
|
step: "0.01",
|
|
4619
4617
|
onInput: n
|
|
4620
4618
|
}, null, 544), [
|
|
4621
4619
|
[
|
|
4622
|
-
|
|
4620
|
+
H,
|
|
4623
4621
|
r.transform.scale.x,
|
|
4624
4622
|
void 0,
|
|
4625
4623
|
{ number: !0 }
|
|
4626
4624
|
]
|
|
4627
4625
|
]),
|
|
4628
|
-
|
|
4626
|
+
A[23] || (A[23] = b("span", null, "Y:", -1)),
|
|
4629
4627
|
E(b("input", {
|
|
4630
4628
|
type: "number",
|
|
4631
|
-
"onUpdate:modelValue":
|
|
4629
|
+
"onUpdate:modelValue": A[7] || (A[7] = (f) => r.transform.scale.y = f),
|
|
4632
4630
|
step: "0.01",
|
|
4633
4631
|
onInput: n
|
|
4634
4632
|
}, null, 544), [
|
|
4635
4633
|
[
|
|
4636
|
-
|
|
4634
|
+
H,
|
|
4637
4635
|
r.transform.scale.y,
|
|
4638
4636
|
void 0,
|
|
4639
4637
|
{ number: !0 }
|
|
4640
4638
|
]
|
|
4641
4639
|
]),
|
|
4642
|
-
|
|
4640
|
+
A[24] || (A[24] = b("span", null, "Z:", -1)),
|
|
4643
4641
|
E(b("input", {
|
|
4644
4642
|
type: "number",
|
|
4645
|
-
"onUpdate:modelValue":
|
|
4643
|
+
"onUpdate:modelValue": A[8] || (A[8] = (f) => r.transform.scale.z = f),
|
|
4646
4644
|
step: "0.01",
|
|
4647
4645
|
onInput: n
|
|
4648
4646
|
}, null, 544), [
|
|
4649
4647
|
[
|
|
4650
|
-
|
|
4648
|
+
H,
|
|
4651
4649
|
r.transform.scale.z,
|
|
4652
4650
|
void 0,
|
|
4653
4651
|
{ number: !0 }
|
|
@@ -4656,19 +4654,19 @@ const Zo = {
|
|
|
4656
4654
|
])
|
|
4657
4655
|
]),
|
|
4658
4656
|
r.selectedObject && r.selectedObject.type === "DirectionalLight" ? (T(), R("div", ar, [
|
|
4659
|
-
|
|
4657
|
+
A[27] || (A[27] = b("label", null, "光源属性", -1)),
|
|
4660
4658
|
b("div", lr, [
|
|
4661
|
-
|
|
4659
|
+
A[26] || (A[26] = b("span", { class: "slider-label" }, "强度", -1)),
|
|
4662
4660
|
E(b("input", {
|
|
4663
4661
|
type: "range",
|
|
4664
4662
|
min: "0",
|
|
4665
4663
|
max: "10",
|
|
4666
4664
|
step: "0.1",
|
|
4667
|
-
"onUpdate:modelValue":
|
|
4665
|
+
"onUpdate:modelValue": A[9] || (A[9] = (f) => a.intensity = f),
|
|
4668
4666
|
onInput: l
|
|
4669
4667
|
}, null, 544), [
|
|
4670
4668
|
[
|
|
4671
|
-
|
|
4669
|
+
H,
|
|
4672
4670
|
a.intensity,
|
|
4673
4671
|
void 0,
|
|
4674
4672
|
{ number: !0 }
|
|
@@ -4679,12 +4677,12 @@ const Zo = {
|
|
|
4679
4677
|
min: "0",
|
|
4680
4678
|
max: "100",
|
|
4681
4679
|
step: "0.1",
|
|
4682
|
-
"onUpdate:modelValue":
|
|
4680
|
+
"onUpdate:modelValue": A[10] || (A[10] = (f) => a.intensity = f),
|
|
4683
4681
|
class: "intensity-input",
|
|
4684
4682
|
onInput: l
|
|
4685
4683
|
}, null, 544), [
|
|
4686
4684
|
[
|
|
4687
|
-
|
|
4685
|
+
H,
|
|
4688
4686
|
a.intensity,
|
|
4689
4687
|
void 0,
|
|
4690
4688
|
{ number: !0 }
|
|
@@ -4693,69 +4691,69 @@ const Zo = {
|
|
|
4693
4691
|
])
|
|
4694
4692
|
])) : X("", !0),
|
|
4695
4693
|
r.selectedObject ? (T(), R("div", cr, [
|
|
4696
|
-
|
|
4694
|
+
A[31] || (A[31] = b("label", null, "材质", -1)),
|
|
4697
4695
|
b("div", ur, [
|
|
4698
|
-
|
|
4696
|
+
A[28] || (A[28] = b("span", { class: "slider-label" }, "金属度", -1)),
|
|
4699
4697
|
E(b("input", {
|
|
4700
4698
|
type: "range",
|
|
4701
4699
|
min: "0",
|
|
4702
4700
|
max: "1",
|
|
4703
4701
|
step: "0.01",
|
|
4704
|
-
"onUpdate:modelValue":
|
|
4702
|
+
"onUpdate:modelValue": A[11] || (A[11] = (f) => i.metalness = f),
|
|
4705
4703
|
onInput: u
|
|
4706
4704
|
}, null, 544), [
|
|
4707
4705
|
[
|
|
4708
|
-
|
|
4706
|
+
H,
|
|
4709
4707
|
i.metalness,
|
|
4710
4708
|
void 0,
|
|
4711
4709
|
{ number: !0 }
|
|
4712
4710
|
]
|
|
4713
4711
|
]),
|
|
4714
|
-
b("span",
|
|
4712
|
+
b("span", dr, _(i.metalness.toFixed(2)), 1)
|
|
4715
4713
|
]),
|
|
4716
|
-
b("div",
|
|
4717
|
-
|
|
4714
|
+
b("div", Ar, [
|
|
4715
|
+
A[29] || (A[29] = b("span", { class: "slider-label" }, "粗糙度", -1)),
|
|
4718
4716
|
E(b("input", {
|
|
4719
4717
|
type: "range",
|
|
4720
4718
|
min: "0",
|
|
4721
4719
|
max: "1",
|
|
4722
4720
|
step: "0.01",
|
|
4723
|
-
"onUpdate:modelValue":
|
|
4721
|
+
"onUpdate:modelValue": A[12] || (A[12] = (f) => i.roughness = f),
|
|
4724
4722
|
onInput: u
|
|
4725
4723
|
}, null, 544), [
|
|
4726
4724
|
[
|
|
4727
|
-
|
|
4725
|
+
H,
|
|
4728
4726
|
i.roughness,
|
|
4729
4727
|
void 0,
|
|
4730
4728
|
{ number: !0 }
|
|
4731
4729
|
]
|
|
4732
4730
|
]),
|
|
4733
|
-
b("span", hr,
|
|
4731
|
+
b("span", hr, _(i.roughness.toFixed(2)), 1)
|
|
4734
4732
|
]),
|
|
4735
4733
|
b("div", fr, [
|
|
4736
|
-
|
|
4734
|
+
A[30] || (A[30] = b("span", { class: "slider-label" }, "透明度", -1)),
|
|
4737
4735
|
E(b("input", {
|
|
4738
4736
|
type: "range",
|
|
4739
4737
|
min: "0",
|
|
4740
4738
|
max: "1",
|
|
4741
4739
|
step: "0.01",
|
|
4742
|
-
"onUpdate:modelValue":
|
|
4740
|
+
"onUpdate:modelValue": A[13] || (A[13] = (f) => i.opacity = f),
|
|
4743
4741
|
onInput: u
|
|
4744
4742
|
}, null, 544), [
|
|
4745
4743
|
[
|
|
4746
|
-
|
|
4744
|
+
H,
|
|
4747
4745
|
i.opacity,
|
|
4748
4746
|
void 0,
|
|
4749
4747
|
{ number: !0 }
|
|
4750
4748
|
]
|
|
4751
4749
|
]),
|
|
4752
|
-
b("span", pr,
|
|
4750
|
+
b("span", pr, _(i.opacity.toFixed(2)), 1)
|
|
4753
4751
|
]),
|
|
4754
4752
|
o.value ? X("", !0) : (T(), R("div", mr, " ⚠️ 当前材质不支持金属度/粗糙度(仅支持 Standard/Phong) "))
|
|
4755
4753
|
])) : X("", !0)
|
|
4756
4754
|
]));
|
|
4757
4755
|
}
|
|
4758
|
-
}), br = /* @__PURE__ */
|
|
4756
|
+
}), br = /* @__PURE__ */ ye(gr, [["__scopeId", "data-v-4cecf018"]]), Ir = { class: "userdata-tab" }, yr = { class: "property-group userdata-group" }, Cr = { class: "userdata-add-row" }, xr = ["onKeyup"], wr = {
|
|
4759
4757
|
key: 0,
|
|
4760
4758
|
class: "userdata-list"
|
|
4761
4759
|
}, vr = { class: "ud-key" }, Mr = {
|
|
@@ -4768,46 +4766,46 @@ const Zo = {
|
|
|
4768
4766
|
}, Or = { class: "ud-json-actions" }, Er = ["onClick"], Rr = ["onClick"], Sr = {
|
|
4769
4767
|
key: 1,
|
|
4770
4768
|
class: "userdata-empty"
|
|
4771
|
-
}, Hr = /* @__PURE__ */
|
|
4769
|
+
}, Hr = /* @__PURE__ */ Ie({
|
|
4772
4770
|
__name: "UserDataTab",
|
|
4773
4771
|
props: {
|
|
4774
4772
|
selectedObject: {}
|
|
4775
4773
|
},
|
|
4776
4774
|
setup(r) {
|
|
4777
|
-
const e = r, t =
|
|
4775
|
+
const e = r, t = L(""), s = L(""), n = L(null), i = L(""), o = L(null), a = L([]);
|
|
4778
4776
|
function l(C) {
|
|
4779
4777
|
if (C === null) return "null";
|
|
4780
4778
|
if (C === void 0) return "undefined";
|
|
4781
4779
|
if (Array.isArray(C)) return "array";
|
|
4782
|
-
const
|
|
4783
|
-
return
|
|
4780
|
+
const x = typeof C;
|
|
4781
|
+
return x === "object" ? "object" : x === "number" ? "number" : x === "boolean" ? "boolean" : "string";
|
|
4784
4782
|
}
|
|
4785
4783
|
function c(C) {
|
|
4786
|
-
const
|
|
4784
|
+
const x = [];
|
|
4787
4785
|
if (C.userData)
|
|
4788
4786
|
for (const [w, D] of Object.entries(C.userData))
|
|
4789
|
-
typeof w == "string" && !w.startsWith("_") &&
|
|
4787
|
+
typeof w == "string" && !w.startsWith("_") && x.push({
|
|
4790
4788
|
key: w,
|
|
4791
4789
|
value: typeof D == "object" ? JSON.stringify(D) : String(D),
|
|
4792
4790
|
rawType: l(D)
|
|
4793
4791
|
});
|
|
4794
|
-
a.value =
|
|
4792
|
+
a.value = x;
|
|
4795
4793
|
}
|
|
4796
|
-
function
|
|
4797
|
-
const
|
|
4798
|
-
if (
|
|
4799
|
-
if (
|
|
4800
|
-
if (
|
|
4801
|
-
if (
|
|
4802
|
-
const w = Number(
|
|
4803
|
-
if (
|
|
4804
|
-
return String(w) !==
|
|
4805
|
-
if (
|
|
4794
|
+
function d(C) {
|
|
4795
|
+
const x = C.trim();
|
|
4796
|
+
if (x === "true") return !0;
|
|
4797
|
+
if (x === "false") return !1;
|
|
4798
|
+
if (x === "null") return null;
|
|
4799
|
+
if (x === "undefined") return;
|
|
4800
|
+
const w = Number(x);
|
|
4801
|
+
if (x !== "" && !isNaN(w))
|
|
4802
|
+
return String(w) !== x ? x : w;
|
|
4803
|
+
if (x.startsWith("{") && x.endsWith("}") || x.startsWith("[") && x.endsWith("]"))
|
|
4806
4804
|
try {
|
|
4807
|
-
return JSON.parse(
|
|
4805
|
+
return JSON.parse(x);
|
|
4808
4806
|
} catch {
|
|
4809
4807
|
}
|
|
4810
|
-
return
|
|
4808
|
+
return x;
|
|
4811
4809
|
}
|
|
4812
4810
|
function u() {
|
|
4813
4811
|
if (!e.selectedObject || !t.value.trim()) return;
|
|
@@ -4816,20 +4814,20 @@ const Zo = {
|
|
|
4816
4814
|
t.value = "";
|
|
4817
4815
|
return;
|
|
4818
4816
|
}
|
|
4819
|
-
const
|
|
4820
|
-
e.selectedObject.userData[C] =
|
|
4817
|
+
const x = d(s.value);
|
|
4818
|
+
e.selectedObject.userData[C] = x, c(e.selectedObject), t.value = "", s.value = "";
|
|
4821
4819
|
}
|
|
4822
|
-
function h(C,
|
|
4820
|
+
function h(C, x) {
|
|
4823
4821
|
e.selectedObject && (delete e.selectedObject.userData[C], c(e.selectedObject));
|
|
4824
4822
|
}
|
|
4825
|
-
function
|
|
4823
|
+
function A(C) {
|
|
4826
4824
|
return C.length <= 28 ? C : C.substring(0, 28) + "…";
|
|
4827
4825
|
}
|
|
4828
|
-
function
|
|
4826
|
+
function f(C) {
|
|
4829
4827
|
n.value = C;
|
|
4830
|
-
const
|
|
4831
|
-
if (!
|
|
4832
|
-
const w =
|
|
4828
|
+
const x = e.selectedObject;
|
|
4829
|
+
if (!x) return;
|
|
4830
|
+
const w = x.userData[C];
|
|
4833
4831
|
try {
|
|
4834
4832
|
i.value = JSON.stringify(w, null, 2);
|
|
4835
4833
|
} catch {
|
|
@@ -4849,60 +4847,60 @@ const Zo = {
|
|
|
4849
4847
|
}
|
|
4850
4848
|
try {
|
|
4851
4849
|
JSON.parse(C), o.value = null;
|
|
4852
|
-
} catch (
|
|
4853
|
-
o.value = "JSON 格式错误:" +
|
|
4850
|
+
} catch (x) {
|
|
4851
|
+
o.value = "JSON 格式错误:" + x.message;
|
|
4854
4852
|
}
|
|
4855
4853
|
}
|
|
4856
|
-
function
|
|
4857
|
-
const
|
|
4858
|
-
if (!
|
|
4854
|
+
function m(C) {
|
|
4855
|
+
const x = e.selectedObject;
|
|
4856
|
+
if (!x) return;
|
|
4859
4857
|
const w = i.value.trim();
|
|
4860
4858
|
try {
|
|
4861
4859
|
const D = JSON.parse(w);
|
|
4862
|
-
|
|
4860
|
+
x.userData[C] = D, c(x), n.value = null, i.value = "";
|
|
4863
4861
|
} catch {
|
|
4864
|
-
|
|
4862
|
+
x.userData[C] = w, c(x), n.value = null, i.value = "";
|
|
4865
4863
|
}
|
|
4866
4864
|
}
|
|
4867
4865
|
function g() {
|
|
4868
4866
|
n.value = null, i.value = "";
|
|
4869
4867
|
}
|
|
4870
|
-
function
|
|
4868
|
+
function y() {
|
|
4871
4869
|
const C = e.selectedObject;
|
|
4872
4870
|
if (!C) return;
|
|
4873
|
-
const
|
|
4874
|
-
|
|
4875
|
-
x:
|
|
4876
|
-
y:
|
|
4877
|
-
z:
|
|
4871
|
+
const x = Yi();
|
|
4872
|
+
x && (C.userData.closeUpView = {
|
|
4873
|
+
x: x.position.x,
|
|
4874
|
+
y: x.position.y,
|
|
4875
|
+
z: x.position.z
|
|
4878
4876
|
}, c(C));
|
|
4879
4877
|
}
|
|
4880
|
-
return
|
|
4878
|
+
return de(
|
|
4881
4879
|
() => e.selectedObject,
|
|
4882
4880
|
(C) => {
|
|
4883
4881
|
C ? c(C) : a.value = [], n.value = null, i.value = "";
|
|
4884
4882
|
},
|
|
4885
4883
|
{ immediate: !0 }
|
|
4886
|
-
), (C,
|
|
4884
|
+
), (C, x) => (T(), R("div", Ir, [
|
|
4887
4885
|
b("div", yr, [
|
|
4888
|
-
|
|
4886
|
+
x[3] || (x[3] = b("label", null, "userData 属性", -1)),
|
|
4889
4887
|
b("div", Cr, [
|
|
4890
4888
|
E(b("input", {
|
|
4891
4889
|
type: "text",
|
|
4892
|
-
"onUpdate:modelValue":
|
|
4890
|
+
"onUpdate:modelValue": x[0] || (x[0] = (w) => t.value = w),
|
|
4893
4891
|
placeholder: "属性名",
|
|
4894
4892
|
class: "ud-input",
|
|
4895
4893
|
onKeyup: He(u, ["enter"])
|
|
4896
4894
|
}, null, 544), [
|
|
4897
|
-
[
|
|
4895
|
+
[H, t.value]
|
|
4898
4896
|
]),
|
|
4899
4897
|
E(b("textarea", {
|
|
4900
|
-
"onUpdate:modelValue":
|
|
4898
|
+
"onUpdate:modelValue": x[1] || (x[1] = (w) => s.value = w),
|
|
4901
4899
|
placeholder: "值",
|
|
4902
4900
|
class: "ud-input ud-textarea",
|
|
4903
4901
|
onKeyup: He(jt(u, ["prevent"]), ["enter"])
|
|
4904
4902
|
}, null, 40, xr), [
|
|
4905
|
-
[
|
|
4903
|
+
[H, s.value]
|
|
4906
4904
|
]),
|
|
4907
4905
|
b("button", {
|
|
4908
4906
|
class: "ud-btn add-btn",
|
|
@@ -4911,37 +4909,37 @@ const Zo = {
|
|
|
4911
4909
|
}, " + ")
|
|
4912
4910
|
]),
|
|
4913
4911
|
a.value.length > 0 ? (T(), R("div", wr, [
|
|
4914
|
-
(T(!0), R(
|
|
4912
|
+
(T(!0), R(Me, null, wt(a.value, (w, D) => (T(), R("div", {
|
|
4915
4913
|
key: w.key,
|
|
4916
|
-
class:
|
|
4914
|
+
class: ie(["userdata-item", {
|
|
4917
4915
|
readonly: w.key === "isMovable",
|
|
4918
4916
|
"editing-json": n.value === w.key
|
|
4919
4917
|
}])
|
|
4920
4918
|
}, [
|
|
4921
|
-
b("span", vr,
|
|
4922
|
-
w.key === "isMovable" ? (T(), R("span", Mr,
|
|
4923
|
-
n.value !== w.key ? (T(), R(
|
|
4924
|
-
b("span", Dr,
|
|
4919
|
+
b("span", vr, _(w.key), 1),
|
|
4920
|
+
w.key === "isMovable" ? (T(), R("span", Mr, _(String(w.value)) + " 🔒 ", 1)) : w.key !== "isMovable" ? (T(), R(Me, { key: 1 }, [
|
|
4921
|
+
n.value !== w.key ? (T(), R(Me, { key: 0 }, [
|
|
4922
|
+
b("span", Dr, _(A(w.value)), 1),
|
|
4925
4923
|
b("button", {
|
|
4926
4924
|
class: "ud-btn edit-json-btn",
|
|
4927
4925
|
title: "编辑对象",
|
|
4928
|
-
onClick: (S) =>
|
|
4926
|
+
onClick: (S) => f(w.key)
|
|
4929
4927
|
}, " ✎ ", 8, Pr)
|
|
4930
|
-
], 64)) : (T(), R(
|
|
4931
|
-
o.value ? (T(), R("div", Tr, " ⚠ " +
|
|
4928
|
+
], 64)) : (T(), R(Me, { key: 1 }, [
|
|
4929
|
+
o.value ? (T(), R("div", Tr, " ⚠ " + _(o.value), 1)) : X("", !0),
|
|
4932
4930
|
E(b("textarea", {
|
|
4933
|
-
"onUpdate:modelValue":
|
|
4934
|
-
class:
|
|
4931
|
+
"onUpdate:modelValue": x[2] || (x[2] = (S) => i.value = S),
|
|
4932
|
+
class: ie(["ud-json-textarea", { "has-error": o.value }]),
|
|
4935
4933
|
rows: "3",
|
|
4936
4934
|
onInput: p
|
|
4937
4935
|
}, null, 34), [
|
|
4938
|
-
[
|
|
4936
|
+
[H, i.value]
|
|
4939
4937
|
]),
|
|
4940
4938
|
b("div", Or, [
|
|
4941
4939
|
b("button", {
|
|
4942
4940
|
class: "ud-btn apply-btn",
|
|
4943
4941
|
title: "应用修改",
|
|
4944
|
-
onClick: (S) =>
|
|
4942
|
+
onClick: (S) => m(w.key)
|
|
4945
4943
|
}, " ✓ ", 8, Er),
|
|
4946
4944
|
b("button", {
|
|
4947
4945
|
class: "ud-btn cancel-btn",
|
|
@@ -4961,163 +4959,217 @@ const Zo = {
|
|
|
4961
4959
|
])) : (T(), R("div", Sr, "暂无自定义数据")),
|
|
4962
4960
|
b("button", {
|
|
4963
4961
|
class: "get-camera-btn",
|
|
4964
|
-
onClick:
|
|
4962
|
+
onClick: y
|
|
4965
4963
|
}, " 添加当前相机位置 ")
|
|
4966
4964
|
])
|
|
4967
4965
|
]));
|
|
4968
4966
|
}
|
|
4969
|
-
}), Lr = /* @__PURE__ */
|
|
4967
|
+
}), Lr = /* @__PURE__ */ ye(Hr, [["__scopeId", "data-v-4e117415"]]), Nr = { class: "datapanel-tab" }, jr = { class: "property-group" }, kr = { class: "dp-section" }, Wr = { class: "dp-visibility-row" }, zr = { class: "dp-toggle" }, Gr = { class: "dp-visibility-text" }, Fr = { class: "dp-section" }, qr = { class: "dp-size-row" }, Xr = { class: "dp-size-value" }, Br = { class: "dp-section" }, Ur = { class: "dp-size-row" }, Vr = { class: "dp-size-value" }, Yr = { class: "dp-section" }, Kr = { class: "dp-section" }, Zr = { class: "dp-list" }, Qr = ["onUpdate:modelValue"], Jr = ["onUpdate:modelValue"], _r = ["onUpdate:modelValue"], $r = ["onUpdate:modelValue"], ea = ["onClick"], ta = { class: "dp-add-row" }, na = /* @__PURE__ */ Ie({
|
|
4970
4968
|
__name: "DataPanelTab",
|
|
4971
4969
|
props: {
|
|
4972
4970
|
selectedObject: {}
|
|
4973
4971
|
},
|
|
4974
4972
|
setup(r) {
|
|
4975
|
-
const e = r, t =
|
|
4976
|
-
let
|
|
4977
|
-
function
|
|
4978
|
-
const
|
|
4979
|
-
return
|
|
4973
|
+
const e = r, t = L(""), s = L([]), n = L(!0), i = L(200), o = L(13), a = L(""), l = L(""), c = L(""), d = L("");
|
|
4974
|
+
let u = A(), h = !1;
|
|
4975
|
+
function A() {
|
|
4976
|
+
const g = e.selectedObject;
|
|
4977
|
+
return g ? Zt(xt(g)) : null;
|
|
4980
4978
|
}
|
|
4981
|
-
|
|
4982
|
-
|
|
4979
|
+
de(n, (g) => {
|
|
4980
|
+
h || !u || (u.visible = g);
|
|
4983
4981
|
});
|
|
4984
|
-
function
|
|
4985
|
-
|
|
4982
|
+
function f() {
|
|
4983
|
+
h || !u || (u.setTitle(t.value), u.setItems([...s.value]));
|
|
4986
4984
|
}
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4985
|
+
de(i, (g) => {
|
|
4986
|
+
h || !u || u.setWidth(`${g}px`);
|
|
4987
|
+
}), de(o, (g) => {
|
|
4988
|
+
h || !u || u.setFontSize(`${g}px`);
|
|
4989
|
+
}), de(t, () => f()), de(s, () => f(), { deep: !0 });
|
|
4990
|
+
function p(g) {
|
|
4991
|
+
s.value = s.value.filter((y, C) => C !== g), f();
|
|
4990
4992
|
}
|
|
4991
4993
|
function m() {
|
|
4992
|
-
!
|
|
4994
|
+
!a.value.trim() || !l.value.trim() || (s.value = [
|
|
4993
4995
|
...s.value,
|
|
4994
4996
|
{
|
|
4995
|
-
label:
|
|
4996
|
-
value:
|
|
4997
|
-
unit:
|
|
4998
|
-
code:
|
|
4997
|
+
label: a.value.trim(),
|
|
4998
|
+
value: l.value.trim(),
|
|
4999
|
+
unit: c.value.trim() || void 0,
|
|
5000
|
+
code: d.value.trim() || void 0
|
|
4999
5001
|
}
|
|
5000
|
-
],
|
|
5002
|
+
], f(), a.value = "", l.value = "", c.value = "", d.value = "");
|
|
5001
5003
|
}
|
|
5002
|
-
return
|
|
5004
|
+
return de(
|
|
5003
5005
|
() => e.selectedObject,
|
|
5004
5006
|
() => {
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
+
if (h = !0, u = A(), u) {
|
|
5008
|
+
t.value = u.getTitle(), s.value = u.getItems(), n.value = u.visible;
|
|
5009
|
+
const g = u.getWidth();
|
|
5010
|
+
i.value = parseInt(g) || 200;
|
|
5011
|
+
const y = u.getFontSize();
|
|
5012
|
+
o.value = parseInt(y) || 13;
|
|
5013
|
+
} else
|
|
5014
|
+
t.value = "", s.value = [], n.value = !0, i.value = 200, o.value = 13;
|
|
5015
|
+
a.value = "", l.value = "", c.value = "", setTimeout(() => {
|
|
5016
|
+
h = !1;
|
|
5007
5017
|
}, 0);
|
|
5008
5018
|
},
|
|
5009
5019
|
{ immediate: !0 }
|
|
5010
|
-
), (
|
|
5020
|
+
), (g, y) => (T(), R("div", Nr, [
|
|
5011
5021
|
b("div", jr, [
|
|
5012
|
-
|
|
5022
|
+
y[14] || (y[14] = b("label", null, "📊 数据面板", -1)),
|
|
5013
5023
|
b("div", kr, [
|
|
5014
|
-
|
|
5024
|
+
y[9] || (y[9] = b("span", { class: "dp-label-sm" }, "可见性", -1)),
|
|
5015
5025
|
b("div", Wr, [
|
|
5016
5026
|
b("label", zr, [
|
|
5017
5027
|
E(b("input", {
|
|
5018
5028
|
type: "checkbox",
|
|
5019
|
-
"onUpdate:modelValue":
|
|
5029
|
+
"onUpdate:modelValue": y[0] || (y[0] = (C) => n.value = C)
|
|
5020
5030
|
}, null, 512), [
|
|
5021
5031
|
[is, n.value]
|
|
5022
5032
|
]),
|
|
5023
|
-
|
|
5033
|
+
y[8] || (y[8] = b("span", { class: "dp-toggle-slider" }, null, -1))
|
|
5024
5034
|
]),
|
|
5025
|
-
b("span", Gr,
|
|
5035
|
+
b("span", Gr, _(n.value ? "显示中" : "已隐藏"), 1)
|
|
5026
5036
|
])
|
|
5027
5037
|
]),
|
|
5028
5038
|
b("div", Fr, [
|
|
5029
|
-
|
|
5039
|
+
y[10] || (y[10] = b("span", { class: "dp-label-sm" }, "面板宽度", -1)),
|
|
5040
|
+
b("div", qr, [
|
|
5041
|
+
E(b("input", {
|
|
5042
|
+
type: "range",
|
|
5043
|
+
class: "dp-range",
|
|
5044
|
+
min: "100",
|
|
5045
|
+
max: "1200",
|
|
5046
|
+
step: "10",
|
|
5047
|
+
"onUpdate:modelValue": y[1] || (y[1] = (C) => i.value = C)
|
|
5048
|
+
}, null, 512), [
|
|
5049
|
+
[
|
|
5050
|
+
H,
|
|
5051
|
+
i.value,
|
|
5052
|
+
void 0,
|
|
5053
|
+
{ number: !0 }
|
|
5054
|
+
]
|
|
5055
|
+
]),
|
|
5056
|
+
b("span", Xr, _(i.value) + "px", 1)
|
|
5057
|
+
])
|
|
5058
|
+
]),
|
|
5059
|
+
b("div", Br, [
|
|
5060
|
+
y[11] || (y[11] = b("span", { class: "dp-label-sm" }, "字体大小", -1)),
|
|
5061
|
+
b("div", Ur, [
|
|
5062
|
+
E(b("input", {
|
|
5063
|
+
type: "range",
|
|
5064
|
+
class: "dp-range",
|
|
5065
|
+
min: "10",
|
|
5066
|
+
max: "50",
|
|
5067
|
+
step: "1",
|
|
5068
|
+
"onUpdate:modelValue": y[2] || (y[2] = (C) => o.value = C)
|
|
5069
|
+
}, null, 512), [
|
|
5070
|
+
[
|
|
5071
|
+
H,
|
|
5072
|
+
o.value,
|
|
5073
|
+
void 0,
|
|
5074
|
+
{ number: !0 }
|
|
5075
|
+
]
|
|
5076
|
+
]),
|
|
5077
|
+
b("span", Vr, _(o.value) + "px", 1)
|
|
5078
|
+
])
|
|
5079
|
+
]),
|
|
5080
|
+
b("div", Yr, [
|
|
5081
|
+
y[12] || (y[12] = b("span", { class: "dp-label-sm" }, "标题", -1)),
|
|
5030
5082
|
E(b("input", {
|
|
5031
5083
|
type: "text",
|
|
5032
5084
|
class: "dp-input",
|
|
5033
|
-
"onUpdate:modelValue":
|
|
5085
|
+
"onUpdate:modelValue": y[3] || (y[3] = (C) => t.value = C),
|
|
5034
5086
|
placeholder: "面板标题"
|
|
5035
5087
|
}, null, 512), [
|
|
5036
|
-
[
|
|
5088
|
+
[H, t.value]
|
|
5037
5089
|
])
|
|
5038
5090
|
]),
|
|
5039
|
-
b("div",
|
|
5040
|
-
|
|
5041
|
-
b("div",
|
|
5042
|
-
(T(!0), R(
|
|
5091
|
+
b("div", Kr, [
|
|
5092
|
+
y[13] || (y[13] = b("span", { class: "dp-label-sm" }, "数据项", -1)),
|
|
5093
|
+
b("div", Zr, [
|
|
5094
|
+
(T(!0), R(Me, null, wt(s.value, (C, x) => (T(), R("div", {
|
|
5043
5095
|
key: x,
|
|
5044
5096
|
class: "dp-item"
|
|
5045
5097
|
}, [
|
|
5046
5098
|
E(b("input", {
|
|
5047
5099
|
type: "text",
|
|
5048
5100
|
class: "dp-input dp-input-sm",
|
|
5049
|
-
"onUpdate:modelValue": (
|
|
5101
|
+
"onUpdate:modelValue": (w) => C.label = w,
|
|
5050
5102
|
placeholder: "标签"
|
|
5051
|
-
}, null, 8,
|
|
5052
|
-
[
|
|
5103
|
+
}, null, 8, Qr), [
|
|
5104
|
+
[H, C.label]
|
|
5053
5105
|
]),
|
|
5054
5106
|
E(b("input", {
|
|
5055
5107
|
type: "text",
|
|
5056
5108
|
class: "dp-input dp-input-sm",
|
|
5057
|
-
"onUpdate:modelValue": (
|
|
5109
|
+
"onUpdate:modelValue": (w) => C.value = w,
|
|
5058
5110
|
placeholder: "值"
|
|
5059
|
-
}, null, 8,
|
|
5060
|
-
[
|
|
5111
|
+
}, null, 8, Jr), [
|
|
5112
|
+
[H, C.value]
|
|
5061
5113
|
]),
|
|
5062
5114
|
E(b("input", {
|
|
5063
5115
|
type: "text",
|
|
5064
5116
|
class: "dp-input dp-input-xs",
|
|
5065
|
-
"onUpdate:modelValue": (
|
|
5117
|
+
"onUpdate:modelValue": (w) => C.unit = w,
|
|
5066
5118
|
placeholder: "单位"
|
|
5067
|
-
}, null, 8,
|
|
5068
|
-
[
|
|
5119
|
+
}, null, 8, _r), [
|
|
5120
|
+
[H, C.unit]
|
|
5069
5121
|
]),
|
|
5070
5122
|
E(b("input", {
|
|
5071
5123
|
type: "text",
|
|
5072
5124
|
class: "dp-input dp-input-xs",
|
|
5073
|
-
"onUpdate:modelValue": (
|
|
5125
|
+
"onUpdate:modelValue": (w) => C.code = w,
|
|
5074
5126
|
placeholder: "编码"
|
|
5075
|
-
}, null, 8,
|
|
5076
|
-
[
|
|
5127
|
+
}, null, 8, $r), [
|
|
5128
|
+
[H, C.code]
|
|
5077
5129
|
]),
|
|
5078
5130
|
b("button", {
|
|
5079
5131
|
class: "dp-btn dp-btn-del",
|
|
5080
|
-
onClick: (
|
|
5132
|
+
onClick: (w) => p(x),
|
|
5081
5133
|
title: "删除此项"
|
|
5082
|
-
}, "✕", 8,
|
|
5134
|
+
}, "✕", 8, ea)
|
|
5083
5135
|
]))), 128))
|
|
5084
5136
|
]),
|
|
5085
|
-
b("div",
|
|
5137
|
+
b("div", ta, [
|
|
5086
5138
|
E(b("input", {
|
|
5087
5139
|
type: "text",
|
|
5088
5140
|
class: "dp-input dp-input-sm",
|
|
5089
|
-
"onUpdate:modelValue":
|
|
5141
|
+
"onUpdate:modelValue": y[4] || (y[4] = (C) => a.value = C),
|
|
5090
5142
|
placeholder: "标签",
|
|
5091
5143
|
onKeyup: He(m, ["enter"])
|
|
5092
5144
|
}, null, 544), [
|
|
5093
|
-
[
|
|
5145
|
+
[H, a.value]
|
|
5094
5146
|
]),
|
|
5095
5147
|
E(b("input", {
|
|
5096
5148
|
type: "text",
|
|
5097
5149
|
class: "dp-input dp-input-sm",
|
|
5098
|
-
"onUpdate:modelValue":
|
|
5150
|
+
"onUpdate:modelValue": y[5] || (y[5] = (C) => l.value = C),
|
|
5099
5151
|
placeholder: "值",
|
|
5100
5152
|
onKeyup: He(m, ["enter"])
|
|
5101
5153
|
}, null, 544), [
|
|
5102
|
-
[
|
|
5154
|
+
[H, l.value]
|
|
5103
5155
|
]),
|
|
5104
5156
|
E(b("input", {
|
|
5105
5157
|
type: "text",
|
|
5106
5158
|
class: "dp-input dp-input-xs",
|
|
5107
|
-
"onUpdate:modelValue":
|
|
5159
|
+
"onUpdate:modelValue": y[6] || (y[6] = (C) => c.value = C),
|
|
5108
5160
|
placeholder: "单位",
|
|
5109
5161
|
onKeyup: He(m, ["enter"])
|
|
5110
5162
|
}, null, 544), [
|
|
5111
|
-
[
|
|
5163
|
+
[H, c.value]
|
|
5112
5164
|
]),
|
|
5113
5165
|
E(b("input", {
|
|
5114
5166
|
type: "text",
|
|
5115
5167
|
class: "dp-input dp-input-xs",
|
|
5116
|
-
"onUpdate:modelValue":
|
|
5168
|
+
"onUpdate:modelValue": y[7] || (y[7] = (C) => d.value = C),
|
|
5117
5169
|
placeholder: "编码",
|
|
5118
5170
|
onKeyup: He(m, ["enter"])
|
|
5119
5171
|
}, null, 544), [
|
|
5120
|
-
[
|
|
5172
|
+
[H, d.value]
|
|
5121
5173
|
]),
|
|
5122
5174
|
b("button", {
|
|
5123
5175
|
class: "dp-btn dp-btn-add",
|
|
@@ -5129,9 +5181,9 @@ const Zo = {
|
|
|
5129
5181
|
])
|
|
5130
5182
|
]));
|
|
5131
5183
|
}
|
|
5132
|
-
}),
|
|
5133
|
-
function
|
|
5134
|
-
const e =
|
|
5184
|
+
}), sa = /* @__PURE__ */ ye(na, [["__scopeId", "data-v-8d2c144b"]]);
|
|
5185
|
+
function ia(r) {
|
|
5186
|
+
const e = L(/* @__PURE__ */ new Set()), t = (n) => {
|
|
5135
5187
|
const i = new Set(e.value);
|
|
5136
5188
|
i.has(n) ? i.delete(n) : i.add(n), e.value = i;
|
|
5137
5189
|
}, s = (n) => {
|
|
@@ -5142,7 +5194,7 @@ function _r(r) {
|
|
|
5142
5194
|
i.add(o.uuid), o = o.parent;
|
|
5143
5195
|
e.value = i;
|
|
5144
5196
|
};
|
|
5145
|
-
return
|
|
5197
|
+
return de(
|
|
5146
5198
|
r,
|
|
5147
5199
|
(n) => {
|
|
5148
5200
|
n && s(n);
|
|
@@ -5150,22 +5202,22 @@ function _r(r) {
|
|
|
5150
5202
|
{ immediate: !0 }
|
|
5151
5203
|
), { expandedSet: e, toggleExpand: t };
|
|
5152
5204
|
}
|
|
5153
|
-
const
|
|
5205
|
+
const oa = {
|
|
5154
5206
|
key: 0,
|
|
5155
5207
|
class: "property-panel"
|
|
5156
|
-
},
|
|
5208
|
+
}, ra = { class: "property-group tree-group" }, aa = { class: "tree-container" }, la = {
|
|
5157
5209
|
key: 0,
|
|
5158
5210
|
class: "tree-empty"
|
|
5159
|
-
},
|
|
5211
|
+
}, ca = { class: "property-group" }, ua = { class: "transform-mode-row" }, da = {
|
|
5160
5212
|
key: 0,
|
|
5161
5213
|
class: "tabs"
|
|
5162
|
-
},
|
|
5214
|
+
}, Aa = {
|
|
5163
5215
|
key: 1,
|
|
5164
5216
|
class: "tab-content"
|
|
5165
|
-
},
|
|
5217
|
+
}, ha = {
|
|
5166
5218
|
key: 1,
|
|
5167
5219
|
class: "property-panel empty"
|
|
5168
|
-
},
|
|
5220
|
+
}, fa = /* @__PURE__ */ Ie({
|
|
5169
5221
|
__name: "index",
|
|
5170
5222
|
props: {
|
|
5171
5223
|
transform: {},
|
|
@@ -5174,69 +5226,69 @@ const $r = {
|
|
|
5174
5226
|
},
|
|
5175
5227
|
emits: ["propertyChange", "treeSelect", "treeDelete", "transformModeChange"],
|
|
5176
5228
|
setup(r, { emit: e }) {
|
|
5177
|
-
const t = r, s = e, n =
|
|
5178
|
-
function i(
|
|
5179
|
-
n.value =
|
|
5229
|
+
const t = r, s = e, n = L("translate");
|
|
5230
|
+
function i(f) {
|
|
5231
|
+
n.value = f, s("transformModeChange", f);
|
|
5180
5232
|
}
|
|
5181
|
-
const o = () => s("propertyChange"), a =
|
|
5182
|
-
var
|
|
5183
|
-
return !!(t.selectedObject && ((
|
|
5184
|
-
}), c =
|
|
5233
|
+
const o = () => s("propertyChange"), a = L("transform"), l = Be(() => {
|
|
5234
|
+
var f;
|
|
5235
|
+
return !!(t.selectedObject && ((f = t.selectedObject.userData) != null && f._hasDataPanel));
|
|
5236
|
+
}), c = L(0), d = os(t, "selectedObject"), { expandedSet: u, toggleExpand: h } = ia(d);
|
|
5185
5237
|
rs("treeExpand", { expandedSet: u, toggleExpand: h });
|
|
5186
|
-
const
|
|
5187
|
-
c.value++, s("treeDelete",
|
|
5238
|
+
const A = (f) => {
|
|
5239
|
+
c.value++, s("treeDelete", f);
|
|
5188
5240
|
};
|
|
5189
|
-
return (
|
|
5190
|
-
b("div",
|
|
5241
|
+
return (f, p) => r.transform ? (T(), R("div", oa, [
|
|
5242
|
+
b("div", ra, [
|
|
5191
5243
|
p[7] || (p[7] = b("label", null, "场景物体", -1)),
|
|
5192
|
-
b("div",
|
|
5193
|
-
(T(!0), R(
|
|
5194
|
-
key:
|
|
5195
|
-
node:
|
|
5244
|
+
b("div", aa, [
|
|
5245
|
+
(T(!0), R(Me, null, wt(r.treeData, (m) => (T(), Ke(er, {
|
|
5246
|
+
key: m.uuid,
|
|
5247
|
+
node: m,
|
|
5196
5248
|
"selected-object": r.selectedObject,
|
|
5197
5249
|
version: c.value,
|
|
5198
5250
|
onSelect: p[0] || (p[0] = (g) => s("treeSelect", g)),
|
|
5199
|
-
onDelete:
|
|
5251
|
+
onDelete: A
|
|
5200
5252
|
}, null, 8, ["node", "selected-object", "version"]))), 128)),
|
|
5201
|
-
r.treeData.length === 0 ? (T(), R("div",
|
|
5253
|
+
r.treeData.length === 0 ? (T(), R("div", la, "暂无物体")) : X("", !0)
|
|
5202
5254
|
])
|
|
5203
5255
|
]),
|
|
5204
|
-
b("div",
|
|
5256
|
+
b("div", ca, [
|
|
5205
5257
|
p[8] || (p[8] = b("label", null, "全局属性", -1)),
|
|
5206
|
-
b("div",
|
|
5258
|
+
b("div", ua, [
|
|
5207
5259
|
b("button", {
|
|
5208
|
-
class:
|
|
5260
|
+
class: ie(["mode-btn", { active: n.value === "translate" }]),
|
|
5209
5261
|
title: "移动 (W)",
|
|
5210
|
-
onClick: p[1] || (p[1] = (
|
|
5262
|
+
onClick: p[1] || (p[1] = (m) => i("translate"))
|
|
5211
5263
|
}, " ↕ 移动 ", 2),
|
|
5212
5264
|
b("button", {
|
|
5213
|
-
class:
|
|
5265
|
+
class: ie(["mode-btn", { active: n.value === "rotate" }]),
|
|
5214
5266
|
title: "旋转 (E)",
|
|
5215
|
-
onClick: p[2] || (p[2] = (
|
|
5267
|
+
onClick: p[2] || (p[2] = (m) => i("rotate"))
|
|
5216
5268
|
}, " ↻ 旋转 ", 2),
|
|
5217
5269
|
b("button", {
|
|
5218
|
-
class:
|
|
5270
|
+
class: ie(["mode-btn", { active: n.value === "scale" }]),
|
|
5219
5271
|
title: "缩放 (R)",
|
|
5220
|
-
onClick: p[3] || (p[3] = (
|
|
5272
|
+
onClick: p[3] || (p[3] = (m) => i("scale"))
|
|
5221
5273
|
}, " ⤡ 缩放 ", 2)
|
|
5222
5274
|
])
|
|
5223
5275
|
]),
|
|
5224
|
-
r.selectedObject ? (T(), R("div",
|
|
5276
|
+
r.selectedObject ? (T(), R("div", da, [
|
|
5225
5277
|
b("button", {
|
|
5226
|
-
class:
|
|
5227
|
-
onClick: p[4] || (p[4] = (
|
|
5278
|
+
class: ie(["tab-btn", { active: a.value === "transform" }]),
|
|
5279
|
+
onClick: p[4] || (p[4] = (m) => a.value = "transform")
|
|
5228
5280
|
}, " 🔄 变换 ", 2),
|
|
5229
5281
|
b("button", {
|
|
5230
|
-
class:
|
|
5231
|
-
onClick: p[5] || (p[5] = (
|
|
5282
|
+
class: ie(["tab-btn", { active: a.value === "userdata" }]),
|
|
5283
|
+
onClick: p[5] || (p[5] = (m) => a.value = "userdata")
|
|
5232
5284
|
}, " 📋 自定义数据 ", 2),
|
|
5233
5285
|
l.value ? (T(), R("button", {
|
|
5234
5286
|
key: 0,
|
|
5235
|
-
class:
|
|
5236
|
-
onClick: p[6] || (p[6] = (
|
|
5287
|
+
class: ie(["tab-btn", { active: a.value === "datapanel" }]),
|
|
5288
|
+
onClick: p[6] || (p[6] = (m) => a.value = "datapanel")
|
|
5237
5289
|
}, " 📊 数据面板 ", 2)) : X("", !0)
|
|
5238
5290
|
])) : X("", !0),
|
|
5239
|
-
r.selectedObject ? (T(), R("div",
|
|
5291
|
+
r.selectedObject ? (T(), R("div", Aa, [
|
|
5240
5292
|
E(Dt(br, {
|
|
5241
5293
|
transform: r.transform,
|
|
5242
5294
|
"selected-object": r.selectedObject,
|
|
@@ -5247,62 +5299,62 @@ const $r = {
|
|
|
5247
5299
|
E(Dt(Lr, { "selected-object": r.selectedObject }, null, 8, ["selected-object"]), [
|
|
5248
5300
|
[De, a.value === "userdata"]
|
|
5249
5301
|
]),
|
|
5250
|
-
E(Dt(
|
|
5302
|
+
E(Dt(sa, { "selected-object": r.selectedObject }, null, 8, ["selected-object"]), [
|
|
5251
5303
|
[De, a.value === "datapanel"]
|
|
5252
5304
|
])
|
|
5253
5305
|
])) : X("", !0)
|
|
5254
|
-
])) : (T(), R("div",
|
|
5306
|
+
])) : (T(), R("div", ha, [...p[9] || (p[9] = [
|
|
5255
5307
|
b("p", null, "未选中任何模型", -1)
|
|
5256
5308
|
])]));
|
|
5257
5309
|
}
|
|
5258
|
-
}),
|
|
5310
|
+
}), pa = /* @__PURE__ */ ye(fa, [["__scopeId", "data-v-c92c9fa7"]]), ma = { class: "top-bar" }, ga = { class: "left-section" }, ba = { class: "dropdown-menu" }, Ia = { class: "dropdown-menu sub-menu" }, ya = { class: "dropdown-menu sub-menu" }, Ca = { class: "dropdown-menu" }, xa = /* @__PURE__ */ Ie({
|
|
5259
5311
|
__name: "TopBar",
|
|
5260
5312
|
emits: ["addModel", "importModel"],
|
|
5261
5313
|
setup(r, { emit: e }) {
|
|
5262
|
-
const t =
|
|
5314
|
+
const t = L(!1), s = L(!1), n = L(!1), i = L(!1), o = e, a = L(null), l = () => {
|
|
5263
5315
|
var p;
|
|
5264
5316
|
return (p = a.value) == null ? void 0 : p.click();
|
|
5265
5317
|
}, c = (p) => {
|
|
5266
|
-
const
|
|
5267
|
-
|
|
5268
|
-
},
|
|
5318
|
+
const m = p.target;
|
|
5319
|
+
m.files && m.files.length > 0 && (o("importModel", m.files[0]), m.value = "");
|
|
5320
|
+
}, d = () => console.log("撤销"), u = () => console.log("删除物体"), h = async () => {
|
|
5269
5321
|
const p = Ki();
|
|
5270
5322
|
console.log(JSON.parse(await p));
|
|
5271
|
-
},
|
|
5323
|
+
}, A = () => {
|
|
5272
5324
|
if (!localStorage.getItem("test_id")) return localStorage.setItem("test_id", "123");
|
|
5273
5325
|
Ei(localStorage.getItem("test_id"));
|
|
5274
|
-
},
|
|
5275
|
-
return (p,
|
|
5276
|
-
b("div",
|
|
5326
|
+
}, f = () => qn();
|
|
5327
|
+
return (p, m) => (T(), R("div", ma, [
|
|
5328
|
+
b("div", ga, [
|
|
5277
5329
|
b("div", {
|
|
5278
5330
|
class: "dropdown-wrapper",
|
|
5279
|
-
onMouseenter:
|
|
5280
|
-
onMouseleave:
|
|
5331
|
+
onMouseenter: m[9] || (m[9] = (g) => s.value = !0),
|
|
5332
|
+
onMouseleave: m[10] || (m[10] = (g) => s.value = !1)
|
|
5281
5333
|
}, [
|
|
5282
|
-
|
|
5283
|
-
E(b("div",
|
|
5334
|
+
m[15] || (m[15] = b("button", { class: "menu-btn" }, "添加", -1)),
|
|
5335
|
+
E(b("div", ba, [
|
|
5284
5336
|
b("div", {
|
|
5285
5337
|
class: "menu-item",
|
|
5286
|
-
onClick:
|
|
5338
|
+
onClick: d
|
|
5287
5339
|
}, "组"),
|
|
5288
5340
|
b("div", {
|
|
5289
5341
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
5290
|
-
onMouseenter:
|
|
5291
|
-
onMouseleave:
|
|
5342
|
+
onMouseenter: m[3] || (m[3] = (g) => n.value = !0),
|
|
5343
|
+
onMouseleave: m[4] || (m[4] = (g) => n.value = !1)
|
|
5292
5344
|
}, [
|
|
5293
|
-
|
|
5294
|
-
E(b("div",
|
|
5345
|
+
m[13] || (m[13] = b("span", null, "网格", -1)),
|
|
5346
|
+
E(b("div", Ia, [
|
|
5295
5347
|
b("div", {
|
|
5296
5348
|
class: "menu-item",
|
|
5297
|
-
onClick:
|
|
5349
|
+
onClick: m[0] || (m[0] = (g) => o("addModel", "box"))
|
|
5298
5350
|
}, " 正方体 "),
|
|
5299
5351
|
b("div", {
|
|
5300
5352
|
class: "menu-item",
|
|
5301
|
-
onClick:
|
|
5353
|
+
onClick: m[1] || (m[1] = (g) => o("addModel", "sphere"))
|
|
5302
5354
|
}, " 球体 "),
|
|
5303
5355
|
b("div", {
|
|
5304
5356
|
class: "menu-item",
|
|
5305
|
-
onClick:
|
|
5357
|
+
onClick: m[2] || (m[2] = (g) => o("addModel", "waterPlane"))
|
|
5306
5358
|
}, " 水面 "),
|
|
5307
5359
|
b("div", {
|
|
5308
5360
|
class: "menu-item",
|
|
@@ -5314,14 +5366,14 @@ const $r = {
|
|
|
5314
5366
|
], 32),
|
|
5315
5367
|
b("div", {
|
|
5316
5368
|
class: "menu-item dropdown-wrapper sub-trigger",
|
|
5317
|
-
onMouseenter:
|
|
5318
|
-
onMouseleave:
|
|
5369
|
+
onMouseenter: m[6] || (m[6] = (g) => i.value = !0),
|
|
5370
|
+
onMouseleave: m[7] || (m[7] = (g) => i.value = !1)
|
|
5319
5371
|
}, [
|
|
5320
|
-
|
|
5321
|
-
E(b("div",
|
|
5372
|
+
m[14] || (m[14] = b("span", null, "光源", -1)),
|
|
5373
|
+
E(b("div", ya, [
|
|
5322
5374
|
b("div", {
|
|
5323
5375
|
class: "menu-item",
|
|
5324
|
-
onClick:
|
|
5376
|
+
onClick: m[5] || (m[5] = (g) => o("addModel", "directionalLight"))
|
|
5325
5377
|
}, " 平行光 ")
|
|
5326
5378
|
], 512), [
|
|
5327
5379
|
[De, i.value]
|
|
@@ -5333,7 +5385,7 @@ const $r = {
|
|
|
5333
5385
|
}, "摄像机"),
|
|
5334
5386
|
b("div", {
|
|
5335
5387
|
class: "menu-item",
|
|
5336
|
-
onClick:
|
|
5388
|
+
onClick: m[8] || (m[8] = (g) => o("addModel", "dataPanel"))
|
|
5337
5389
|
}, " 数据面板 ")
|
|
5338
5390
|
], 512), [
|
|
5339
5391
|
[De, s.value]
|
|
@@ -5341,29 +5393,29 @@ const $r = {
|
|
|
5341
5393
|
], 32),
|
|
5342
5394
|
b("div", {
|
|
5343
5395
|
class: "dropdown-wrapper",
|
|
5344
|
-
onMouseenter:
|
|
5345
|
-
onMouseleave:
|
|
5396
|
+
onMouseenter: m[11] || (m[11] = (g) => t.value = !0),
|
|
5397
|
+
onMouseleave: m[12] || (m[12] = (g) => t.value = !1)
|
|
5346
5398
|
}, [
|
|
5347
|
-
|
|
5348
|
-
E(b("div",
|
|
5399
|
+
m[16] || (m[16] = b("button", { class: "menu-btn" }, "帮助", -1)),
|
|
5400
|
+
E(b("div", Ca, [
|
|
5349
5401
|
b("div", {
|
|
5350
5402
|
class: "menu-item",
|
|
5351
5403
|
onClick: h
|
|
5352
5404
|
}, "获取场景"),
|
|
5353
5405
|
b("div", {
|
|
5354
5406
|
class: "menu-item",
|
|
5355
|
-
onClick:
|
|
5407
|
+
onClick: A
|
|
5356
5408
|
}, "镜头拉近"),
|
|
5357
5409
|
b("div", {
|
|
5358
5410
|
class: "menu-item",
|
|
5359
|
-
onClick:
|
|
5411
|
+
onClick: f
|
|
5360
5412
|
}, " 重置相机位置 ")
|
|
5361
5413
|
], 512), [
|
|
5362
5414
|
[De, t.value]
|
|
5363
5415
|
])
|
|
5364
5416
|
], 32)
|
|
5365
5417
|
]),
|
|
5366
|
-
|
|
5418
|
+
m[17] || (m[17] = b("div", { class: "right-section" }, [
|
|
5367
5419
|
b("span", { class: "app-title" }, "3D 模型编辑器")
|
|
5368
5420
|
], -1)),
|
|
5369
5421
|
b("input", {
|
|
@@ -5376,10 +5428,10 @@ const $r = {
|
|
|
5376
5428
|
}, null, 544)
|
|
5377
5429
|
]));
|
|
5378
5430
|
}
|
|
5379
|
-
}),
|
|
5431
|
+
}), wa = /* @__PURE__ */ ye(xa, [["__scopeId", "data-v-45df3361"]]), va = { class: "bottom-bar" }, Ma = /* @__PURE__ */ Ie({
|
|
5380
5432
|
__name: "BottomBar",
|
|
5381
5433
|
setup(r) {
|
|
5382
|
-
return (e, t) => (T(), R("div",
|
|
5434
|
+
return (e, t) => (T(), R("div", va, [...t[0] || (t[0] = [
|
|
5383
5435
|
b("div", { class: "status-left" }, [
|
|
5384
5436
|
b("span", null, "就绪")
|
|
5385
5437
|
], -1),
|
|
@@ -5388,17 +5440,17 @@ const $r = {
|
|
|
5388
5440
|
], -1)
|
|
5389
5441
|
])]));
|
|
5390
5442
|
}
|
|
5391
|
-
}),
|
|
5443
|
+
}), Da = /* @__PURE__ */ ye(Ma, [["__scopeId", "data-v-3427bb27"]]), Pa = { class: "app-layout" }, Ta = {
|
|
5392
5444
|
key: 0,
|
|
5393
5445
|
class: "loading-overlay"
|
|
5394
|
-
},
|
|
5446
|
+
}, Oa = /* @__PURE__ */ Ie({
|
|
5395
5447
|
__name: "DrawingBoard",
|
|
5396
5448
|
props: {
|
|
5397
5449
|
mode: { default: "edit" },
|
|
5398
5450
|
sceneData: { default: null }
|
|
5399
5451
|
},
|
|
5400
5452
|
setup(r) {
|
|
5401
|
-
const e = r, t =
|
|
5453
|
+
const e = r, t = L(!1);
|
|
5402
5454
|
Ti((g) => {
|
|
5403
5455
|
t.value = g;
|
|
5404
5456
|
});
|
|
@@ -5432,64 +5484,64 @@ const $r = {
|
|
|
5432
5484
|
}, l = (g) => Yo(g), c = async (g) => {
|
|
5433
5485
|
try {
|
|
5434
5486
|
await Vo(g);
|
|
5435
|
-
} catch (
|
|
5436
|
-
console.error("导入失败:",
|
|
5487
|
+
} catch (y) {
|
|
5488
|
+
console.error("导入失败:", y), alert("导入失败:" + y.message);
|
|
5437
5489
|
}
|
|
5438
|
-
},
|
|
5490
|
+
}, d = $t([]);
|
|
5439
5491
|
Bi((g) => {
|
|
5440
|
-
|
|
5492
|
+
d.value = g;
|
|
5441
5493
|
});
|
|
5442
5494
|
const u = () => {
|
|
5443
5495
|
const g = Ui();
|
|
5444
|
-
g && (
|
|
5445
|
-
}, h = (g) => Qt(g),
|
|
5496
|
+
g && (d.value = g);
|
|
5497
|
+
}, h = (g) => Qt(g), A = (g) => Wi(g.uuid), f = (g) => {
|
|
5446
5498
|
Oi(g);
|
|
5447
|
-
}, p =
|
|
5499
|
+
}, p = L(null), m = () => {
|
|
5448
5500
|
p.value && Ii(p.value, e.mode, e.sceneData), u();
|
|
5449
5501
|
};
|
|
5450
5502
|
return as(() => {
|
|
5451
|
-
|
|
5503
|
+
m(), p.value && fi(p.value);
|
|
5452
5504
|
}), ls(() => {
|
|
5453
5505
|
console.log("endset_three_editor destroy"), Qi();
|
|
5454
|
-
}), (g,
|
|
5455
|
-
t.value ? (T(), R("div",
|
|
5506
|
+
}), (g, y) => (T(), R("div", Pa, [
|
|
5507
|
+
t.value ? (T(), R("div", Ta, [...y[0] || (y[0] = [
|
|
5456
5508
|
b("div", { class: "loading-spinner" }, null, -1),
|
|
5457
5509
|
b("div", { class: "loading-text" }, "加载中...", -1)
|
|
5458
5510
|
])])) : X("", !0),
|
|
5459
|
-
r.mode === "edit" ? (T(), Ke(
|
|
5511
|
+
r.mode === "edit" ? (T(), Ke(wa, {
|
|
5460
5512
|
key: 1,
|
|
5461
5513
|
onAddModel: l,
|
|
5462
5514
|
onImportModel: c
|
|
5463
5515
|
})) : X("", !0),
|
|
5464
5516
|
b("div", {
|
|
5465
|
-
class:
|
|
5517
|
+
class: ie(`editor-container editor-container-mode-${r.mode}`)
|
|
5466
5518
|
}, [
|
|
5467
5519
|
b("div", {
|
|
5468
|
-
class:
|
|
5520
|
+
class: ie(`canvas canvas-mode-${r.mode}`),
|
|
5469
5521
|
ref_key: "containerRef",
|
|
5470
5522
|
ref: p
|
|
5471
5523
|
}, null, 2),
|
|
5472
|
-
r.mode === "edit" ? (T(), Ke(
|
|
5524
|
+
r.mode === "edit" ? (T(), Ke(pa, {
|
|
5473
5525
|
key: 0,
|
|
5474
5526
|
transform: n,
|
|
5475
|
-
"tree-data":
|
|
5527
|
+
"tree-data": d.value,
|
|
5476
5528
|
"selected-object": s.value,
|
|
5477
5529
|
onPropertyChange: a,
|
|
5478
5530
|
onTreeSelect: h,
|
|
5479
|
-
onTreeDelete:
|
|
5480
|
-
onTransformModeChange:
|
|
5531
|
+
onTreeDelete: A,
|
|
5532
|
+
onTransformModeChange: f
|
|
5481
5533
|
}, null, 8, ["transform", "tree-data", "selected-object"])) : X("", !0)
|
|
5482
5534
|
], 2),
|
|
5483
|
-
r.mode === "edit" ? (T(), Ke(
|
|
5535
|
+
r.mode === "edit" ? (T(), Ke(Da, { key: 2 })) : X("", !0)
|
|
5484
5536
|
]));
|
|
5485
5537
|
}
|
|
5486
|
-
}),
|
|
5538
|
+
}), Wa = /* @__PURE__ */ ye(Oa, [["__scopeId", "data-v-ffa5f5c1"]]);
|
|
5487
5539
|
export {
|
|
5488
|
-
|
|
5540
|
+
Da as BottomBar,
|
|
5489
5541
|
Gn as DataPanel,
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5542
|
+
Wa as DrawingBoard,
|
|
5543
|
+
pa as PropertyPanel,
|
|
5544
|
+
wa as TopBar,
|
|
5493
5545
|
er as TreeItem,
|
|
5494
5546
|
qo as addBox,
|
|
5495
5547
|
Ko as addDataPanel,
|
|
@@ -5503,11 +5555,11 @@ export {
|
|
|
5503
5555
|
gi as disposeCSS2DRenderer,
|
|
5504
5556
|
Ki as exportSceneToJSON,
|
|
5505
5557
|
Hi as focusOnObject,
|
|
5506
|
-
|
|
5558
|
+
La as getCSS2DRenderer,
|
|
5507
5559
|
Yi as getCamera,
|
|
5508
5560
|
Zt as getDataPanel,
|
|
5509
|
-
|
|
5510
|
-
|
|
5561
|
+
ka as getRenderer,
|
|
5562
|
+
ja as getScene,
|
|
5511
5563
|
Ui as getSceneObjects,
|
|
5512
5564
|
Vi as getSelectedObject,
|
|
5513
5565
|
Vo as importModelFromFile,
|
|
@@ -5527,7 +5579,7 @@ export {
|
|
|
5527
5579
|
qi as setSelectedObjectCallback,
|
|
5528
5580
|
Xi as setTransformChangeCallback,
|
|
5529
5581
|
Oi as setTransformMode,
|
|
5530
|
-
|
|
5531
|
-
|
|
5582
|
+
Na as updateDataPanelValue,
|
|
5583
|
+
ia as useTreeExpand
|
|
5532
5584
|
};
|
|
5533
5585
|
//# sourceMappingURL=three-editor.es.js.map
|