endset_three_editor 0.4.2 → 0.4.4
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/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 be, ref as j, inject as es, computed as Be, watchEffect as ts, resolveComponent as ns, openBlock as T, createElementBlock as R, createElementVNode as b, normalizeClass as se, withModifiers as jt, unref as ss, toDisplayString as ie, Fragment as ve, renderList as wt, createBlock as Ke, createCommentVNode as X, reactive as kt, watch as Me, withDirectives as E, vModelText as N, withKeys as
|
|
4
|
+
import { toRaw as xt, defineComponent as be, ref as j, inject as es, computed as Be, watchEffect as ts, resolveComponent as ns, openBlock as T, createElementBlock as R, createElementVNode as b, normalizeClass as se, withModifiers as jt, unref as ss, toDisplayString as ie, Fragment as ve, renderList as wt, createBlock as Ke, createCommentVNode as X, reactive as kt, watch as Me, withDirectives as E, vModelText as N, 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 As, Object3D as ke, MeshBasicMaterial as Pe, LineBasicMaterial as Ze, CylinderGeometry as U, BoxGeometry as q, BufferGeometry as We, Float32BufferAttribute as pe, Mesh as v, OctahedronGeometry as lt, Line as ue, TorusGeometry as Ge, SphereGeometry as ds, Euler as hs, Matrix4 as me, PlaneGeometry as fs, DoubleSide as Rn, Loader as Yt, FileLoader as tt, Color as de, 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
|
|
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 As, Object3D as ke, MeshBasicMaterial as Pe, LineBasicMaterial as Ze, CylinderGeometry as U, BoxGeometry as q, BufferGeometry as We, Float32BufferAttribute as pe, Mesh as v, OctahedronGeometry as lt, Line as ue, TorusGeometry as Ge, SphereGeometry as ds, Euler as hs, Matrix4 as me, PlaneGeometry as fs, DoubleSide as Rn, Loader as Yt, FileLoader as tt, Color as de, 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, H = {
|
|
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 = H.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 = H.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 === H.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 = H.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 = H.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 = H.PAN;
|
|
408
408
|
} else {
|
|
409
409
|
if (this.enableRotate === !1) return;
|
|
410
|
-
this._handleMouseDownRotate(r), this.state =
|
|
410
|
+
this._handleMouseDownRotate(r), this.state = H.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 = H.ROTATE;
|
|
417
417
|
} else {
|
|
418
418
|
if (this.enablePan === !1) return;
|
|
419
|
-
this._handleMouseDownPan(r), this.state =
|
|
419
|
+
this._handleMouseDownPan(r), this.state = H.PAN;
|
|
420
420
|
}
|
|
421
421
|
break;
|
|
422
422
|
default:
|
|
423
|
-
this.state =
|
|
423
|
+
this.state = H.NONE;
|
|
424
424
|
}
|
|
425
|
-
this.state !==
|
|
425
|
+
this.state !== H.NONE && this.dispatchEvent(Kt);
|
|
426
426
|
}
|
|
427
427
|
function Ks(r) {
|
|
428
428
|
switch (this.state) {
|
|
429
|
-
case
|
|
429
|
+
case H.ROTATE:
|
|
430
430
|
if (this.enableRotate === !1) return;
|
|
431
431
|
this._handleMouseMoveRotate(r);
|
|
432
432
|
break;
|
|
433
|
-
case
|
|
433
|
+
case H.DOLLY:
|
|
434
434
|
if (this.enableZoom === !1) return;
|
|
435
435
|
this._handleMouseMoveDolly(r);
|
|
436
436
|
break;
|
|
437
|
-
case
|
|
437
|
+
case H.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 !== H.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 = H.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 = H.TOUCH_PAN;
|
|
460
460
|
break;
|
|
461
461
|
default:
|
|
462
|
-
this.state =
|
|
462
|
+
this.state = H.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 = H.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 = H.TOUCH_DOLLY_ROTATE;
|
|
474
474
|
break;
|
|
475
475
|
default:
|
|
476
|
-
this.state =
|
|
476
|
+
this.state = H.NONE;
|
|
477
477
|
}
|
|
478
478
|
break;
|
|
479
479
|
default:
|
|
480
|
-
this.state =
|
|
480
|
+
this.state = H.NONE;
|
|
481
481
|
}
|
|
482
|
-
this.state !==
|
|
482
|
+
this.state !== H.NONE && this.dispatchEvent(Kt);
|
|
483
483
|
}
|
|
484
484
|
function _s(r) {
|
|
485
485
|
switch (this._trackPointer(r), this.state) {
|
|
486
|
-
case
|
|
486
|
+
case H.TOUCH_ROTATE:
|
|
487
487
|
if (this.enableRotate === !1) return;
|
|
488
488
|
this._handleTouchMoveRotate(r), this.update();
|
|
489
489
|
break;
|
|
490
|
-
case
|
|
490
|
+
case H.TOUCH_PAN:
|
|
491
491
|
if (this.enablePan === !1) return;
|
|
492
492
|
this._handleTouchMovePan(r), this.update();
|
|
493
493
|
break;
|
|
494
|
-
case
|
|
494
|
+
case H.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 H.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 = H.NONE;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
function $s(r) {
|
|
@@ -545,8 +545,8 @@ class ni extends On {
|
|
|
545
545
|
}), o[C] = y, i[C] = y, n[C] = y;
|
|
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(), A = new K(), u = new K(), h = new M(), d = new K(),
|
|
549
|
-
a("worldPosition", l), a("worldPositionStart", c), a("worldQuaternion", A), a("worldQuaternionStart", u), a("cameraPosition", h), a("cameraQuaternion", d), a("pointStart",
|
|
548
|
+
const l = new M(), c = new M(), A = new K(), u = new K(), h = new M(), d = new K(), m = new M(), p = new M(), f = new M(), g = 0, x = new M();
|
|
549
|
+
a("worldPosition", l), a("worldPositionStart", c), a("worldQuaternion", A), a("worldQuaternionStart", u), a("cameraPosition", h), a("cameraQuaternion", d), a("pointStart", m), a("pointEnd", p), a("rotationAxis", f), a("rotationAngle", g), a("eye", x), 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";
|
|
@@ -802,8 +802,8 @@ class ci extends ke {
|
|
|
802
802
|
h.color.setHex(16776960), h.opacity = 0.25;
|
|
803
803
|
const d = e.clone();
|
|
804
804
|
d.color.setHex(16776960);
|
|
805
|
-
const
|
|
806
|
-
|
|
805
|
+
const m = e.clone();
|
|
806
|
+
m.color.setHex(7895160), this.materialLib = {
|
|
807
807
|
xAxis: i,
|
|
808
808
|
yAxis: o,
|
|
809
809
|
zAxis: a,
|
|
@@ -813,8 +813,8 @@ class ci extends ke {
|
|
|
813
813
|
zAxisTransparent: A,
|
|
814
814
|
activeTransparent: h
|
|
815
815
|
};
|
|
816
|
-
const
|
|
817
|
-
|
|
816
|
+
const p = new U(0, 0.04, 0.1, 12);
|
|
817
|
+
p.translate(0, 0.05, 0);
|
|
818
818
|
const f = new q(0.08, 0.08, 0.08);
|
|
819
819
|
f.translate(0, 0.04, 0);
|
|
820
820
|
const g = new We();
|
|
@@ -831,18 +831,18 @@ class ci extends ke {
|
|
|
831
831
|
}
|
|
832
832
|
const w = {
|
|
833
833
|
X: [
|
|
834
|
-
[new v(
|
|
835
|
-
[new v(
|
|
834
|
+
[new v(p, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
835
|
+
[new v(p, i), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
|
|
836
836
|
[new v(x, i), [0, 0, 0], [0, 0, -Math.PI / 2]]
|
|
837
837
|
],
|
|
838
838
|
Y: [
|
|
839
|
-
[new v(
|
|
840
|
-
[new v(
|
|
839
|
+
[new v(p, o), [0, 0.5, 0]],
|
|
840
|
+
[new v(p, o), [0, -0.5, 0], [Math.PI, 0, 0]],
|
|
841
841
|
[new v(x, o)]
|
|
842
842
|
],
|
|
843
843
|
Z: [
|
|
844
|
-
[new v(
|
|
845
|
-
[new v(
|
|
844
|
+
[new v(p, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
845
|
+
[new v(p, a), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
|
|
846
846
|
[new v(x, a), null, [Math.PI / 2, 0, 0]]
|
|
847
847
|
],
|
|
848
848
|
XYZ: [
|
|
@@ -882,7 +882,7 @@ class ci extends ke {
|
|
|
882
882
|
XZ: [
|
|
883
883
|
[new v(new q(0.2, 0.2, 0.01), s), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
884
884
|
]
|
|
885
|
-
},
|
|
885
|
+
}, S = {
|
|
886
886
|
START: [
|
|
887
887
|
[new v(new lt(0.01, 2), n), null, null, null, "helper"]
|
|
888
888
|
],
|
|
@@ -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), m), null, [0, Math.PI / 2, 0]]
|
|
907
907
|
],
|
|
908
908
|
X: [
|
|
909
909
|
[new v(C(0.5, 0.5), i)]
|
|
@@ -1012,7 +1012,7 @@ class ci extends ke {
|
|
|
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(ye)), 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(
|
|
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(ye)), 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) {
|
|
@@ -1096,7 +1096,7 @@ 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
|
|
1099
|
+
const Se = new M(), pn = new me(), mn = new me(), gn = new M(), bn = new M();
|
|
1100
1100
|
class di {
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Constructs a new CSS2D renderer.
|
|
@@ -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(m, p) {
|
|
1118
|
+
m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(), p.parent === null && p.matrixWorldAutoUpdate === !0 && p.updateMatrixWorld(), pn.copy(p.matrixWorldInverse), mn.multiplyMatrices(p.projectionMatrix, pn), A(m, m, p), this.sortObjects && d(m);
|
|
1119
|
+
}, this.setSize = function(m, p) {
|
|
1120
|
+
s = m, n = p, i = s / 2, o = n / 2, l.style.width = m + "px", l.style.height = p + "px";
|
|
1121
1121
|
};
|
|
1122
|
-
function c(
|
|
1123
|
-
|
|
1124
|
-
for (let
|
|
1125
|
-
c(
|
|
1122
|
+
function c(m) {
|
|
1123
|
+
m.isCSS2DObject && (m.element.style.display = "none");
|
|
1124
|
+
for (let p = 0, f = m.children.length; p < f; p++)
|
|
1125
|
+
c(m.children[p]);
|
|
1126
1126
|
}
|
|
1127
|
-
function A(
|
|
1128
|
-
if (
|
|
1129
|
-
c(
|
|
1127
|
+
function A(m, p, f) {
|
|
1128
|
+
if (m.visible === !1) {
|
|
1129
|
+
c(m);
|
|
1130
1130
|
return;
|
|
1131
1131
|
}
|
|
1132
|
-
if (
|
|
1133
|
-
|
|
1134
|
-
const g =
|
|
1135
|
-
x.style.display = g === !0 ? "" : "none", g === !0 && (
|
|
1132
|
+
if (m.isCSS2DObject) {
|
|
1133
|
+
Se.setFromMatrixPosition(m.matrixWorld), Se.applyMatrix4(mn);
|
|
1134
|
+
const g = Se.z >= -1 && Se.z <= 1 && m.layers.test(f.layers) === !0, x = m.element;
|
|
1135
|
+
x.style.display = g === !0 ? "" : "none", g === !0 && (m.onBeforeRender(t, p, f), x.style.transform = "translate(" + -100 * m.center.x + "%," + -100 * m.center.y + "%)translate(" + (Se.x * i + i) + "px," + (-Se.y * o + o) + "px)", x.parentNode !== l && l.appendChild(x), m.onAfterRender(t, p, f));
|
|
1136
1136
|
const C = {
|
|
1137
|
-
distanceToCameraSquared: u(f,
|
|
1137
|
+
distanceToCameraSquared: u(f, m)
|
|
1138
1138
|
};
|
|
1139
|
-
a.objects.set(
|
|
1139
|
+
a.objects.set(m, C);
|
|
1140
1140
|
}
|
|
1141
|
-
for (let g = 0, x =
|
|
1142
|
-
A(
|
|
1141
|
+
for (let g = 0, x = m.children.length; g < x; g++)
|
|
1142
|
+
A(m.children[g], p, f);
|
|
1143
1143
|
}
|
|
1144
|
-
function u(
|
|
1145
|
-
return gn.setFromMatrixPosition(
|
|
1144
|
+
function u(m, p) {
|
|
1145
|
+
return gn.setFromMatrixPosition(m.matrixWorld), bn.setFromMatrixPosition(p.matrixWorld), gn.distanceToSquared(bn);
|
|
1146
1146
|
}
|
|
1147
|
-
function h(
|
|
1148
|
-
const
|
|
1149
|
-
return
|
|
1150
|
-
f.isCSS2DObject &&
|
|
1151
|
-
}),
|
|
1147
|
+
function h(m) {
|
|
1148
|
+
const p = [];
|
|
1149
|
+
return m.traverseVisible(function(f) {
|
|
1150
|
+
f.isCSS2DObject && p.push(f);
|
|
1151
|
+
}), p;
|
|
1152
1152
|
}
|
|
1153
|
-
function d(
|
|
1154
|
-
const
|
|
1153
|
+
function d(m) {
|
|
1154
|
+
const p = h(m).sort(function(g, x) {
|
|
1155
1155
|
if (g.renderOrder !== x.renderOrder)
|
|
1156
1156
|
return x.renderOrder - g.renderOrder;
|
|
1157
1157
|
const C = a.objects.get(g).distanceToCameraSquared, y = a.objects.get(x).distanceToCameraSquared;
|
|
1158
1158
|
return C - y;
|
|
1159
|
-
}), f =
|
|
1160
|
-
for (let g = 0, x =
|
|
1161
|
-
|
|
1159
|
+
}), f = p.length;
|
|
1160
|
+
for (let g = 0, x = p.length; g < x; g++)
|
|
1161
|
+
p[g].element.style.zIndex = f - g;
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
@@ -1587,7 +1587,7 @@ function Ei(r) {
|
|
|
1587
1587
|
console.warn("[selectModelHandle] 传入的 objectId 为空");
|
|
1588
1588
|
return;
|
|
1589
1589
|
}
|
|
1590
|
-
|
|
1590
|
+
Hi(r);
|
|
1591
1591
|
let e = null;
|
|
1592
1592
|
st.forEach((t) => {
|
|
1593
1593
|
t.userData.id == r && (e = t), t.children && t.children.forEach((s) => {
|
|
@@ -1613,12 +1613,12 @@ function Ri(r) {
|
|
|
1613
1613
|
});
|
|
1614
1614
|
const i = s.intersectObjects(n);
|
|
1615
1615
|
if (i.length > 0) {
|
|
1616
|
-
let o =
|
|
1616
|
+
let o = Si(i[0].object);
|
|
1617
1617
|
Qt(o);
|
|
1618
1618
|
} else
|
|
1619
1619
|
Jt();
|
|
1620
1620
|
}
|
|
1621
|
-
function
|
|
1621
|
+
function Si(r) {
|
|
1622
1622
|
if (r.type === "Line") {
|
|
1623
1623
|
const e = r.parent;
|
|
1624
1624
|
switch (e.type) {
|
|
@@ -1630,7 +1630,7 @@ function Hi(r) {
|
|
|
1630
1630
|
}
|
|
1631
1631
|
return r;
|
|
1632
1632
|
}
|
|
1633
|
-
function
|
|
1633
|
+
function Hi(r, e = 500) {
|
|
1634
1634
|
var d;
|
|
1635
1635
|
if (!I.camera || !I.orbitControls) {
|
|
1636
1636
|
console.warn(
|
|
@@ -1638,13 +1638,9 @@ function Si(r, e = 500) {
|
|
|
1638
1638
|
);
|
|
1639
1639
|
return;
|
|
1640
1640
|
}
|
|
1641
|
-
if (r == null || r === "") {
|
|
1642
|
-
console.warn("[focusOnObject] 传入的 objectId 为空,无法聚焦");
|
|
1643
|
-
return;
|
|
1644
|
-
}
|
|
1645
1641
|
let t = null;
|
|
1646
|
-
if ((d = I.scene) == null || d.traverse((
|
|
1647
|
-
|
|
1642
|
+
if ((d = I.scene) == null || d.traverse((m) => {
|
|
1643
|
+
m.userData.id == r && (t = m);
|
|
1648
1644
|
}), !t) {
|
|
1649
1645
|
console.warn(
|
|
1650
1646
|
`[focusOnObject] 在场景中未找到 userData.id 为 "${r}" 的物体。请确认:1) 物体已被正确添加到场景(addModel);2) 物体的 userData.id 与传入的 objectId 一致;3) 传入的 objectId 不为空`
|
|
@@ -1676,13 +1672,13 @@ function Si(r, e = 500) {
|
|
|
1676
1672
|
tz: n.z
|
|
1677
1673
|
},
|
|
1678
1674
|
e
|
|
1679
|
-
).easing(nt.Easing.Quadratic.InOut).onUpdate((
|
|
1680
|
-
I.camera.position.set(
|
|
1675
|
+
).easing(nt.Easing.Quadratic.InOut).onUpdate((m) => {
|
|
1676
|
+
I.camera.position.set(m.x, m.y, m.z), I.orbitControls.target.set(m.tx, m.ty, m.tz), I.orbitControls.update();
|
|
1681
1677
|
}).start();
|
|
1682
|
-
} catch (
|
|
1678
|
+
} catch (m) {
|
|
1683
1679
|
console.error(
|
|
1684
1680
|
"[focusOnObject] TWEEN 动画创建失败,请检查 @tweenjs/tween.js 是否已正确安装且版本兼容(^23.1.3):",
|
|
1685
|
-
|
|
1681
|
+
m
|
|
1686
1682
|
);
|
|
1687
1683
|
}
|
|
1688
1684
|
}
|
|
@@ -1768,26 +1764,26 @@ async function Ki() {
|
|
|
1768
1764
|
r.traverse((h) => {
|
|
1769
1765
|
var d;
|
|
1770
1766
|
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_")) {
|
|
1771
|
-
const
|
|
1772
|
-
if (
|
|
1773
|
-
const
|
|
1767
|
+
const m = h;
|
|
1768
|
+
if (m.element) {
|
|
1769
|
+
const p = m.element.querySelector(
|
|
1774
1770
|
"[data-panel-title]"
|
|
1775
1771
|
), f = [];
|
|
1776
|
-
|
|
1772
|
+
m.element.querySelectorAll(
|
|
1777
1773
|
".css2d-data-panel-item"
|
|
1778
1774
|
).forEach((x) => {
|
|
1779
|
-
var w, D,
|
|
1775
|
+
var w, D, S;
|
|
1780
1776
|
const C = x.querySelector(".item-label"), y = x.querySelector(".item-value");
|
|
1781
1777
|
if (C && y) {
|
|
1782
1778
|
const Z = (C.textContent || "").trim(), _ = ((D = (w = y.childNodes[0]) == null ? void 0 : w.textContent) == null ? void 0 : D.trim()) || "", Q = y.querySelector(
|
|
1783
1779
|
"span"
|
|
1784
|
-
), ye = Q ? (Q.textContent || "").trim() : void 0, Mt = ((
|
|
1780
|
+
), ye = Q ? (Q.textContent || "").trim() : void 0, Mt = ((S = x.getAttribute("data-item-code")) == null ? void 0 : S.trim()) || void 0;
|
|
1785
1781
|
f.push({ label: Z, value: _, unit: ye, code: Mt });
|
|
1786
1782
|
}
|
|
1787
1783
|
}), h.parent && s.set(
|
|
1788
1784
|
h.parent.userData.id ? h.parent.userData.id : h.parent.uuid,
|
|
1789
1785
|
{
|
|
1790
|
-
title: ((d =
|
|
1786
|
+
title: ((d = p == null ? void 0 : p.textContent) == null ? void 0 : d.trim()) || "",
|
|
1791
1787
|
items: f
|
|
1792
1788
|
}
|
|
1793
1789
|
);
|
|
@@ -1823,17 +1819,32 @@ async function Ki() {
|
|
|
1823
1819
|
function Zi(r, e = "edit", t) {
|
|
1824
1820
|
var o, a, l;
|
|
1825
1821
|
const s = typeof r == "string" ? JSON.parse(r) : r, i = new P.ObjectLoader().parse(s);
|
|
1826
|
-
i.type === "Scene" ? I.scene = i : (o = I.scene) == null || o.add(i), t
|
|
1827
|
-
const
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1822
|
+
if (i.type === "Scene" ? I.scene = i : (o = I.scene) == null || o.add(i), t) {
|
|
1823
|
+
const c = Math.min(window.innerWidth, 7e3), A = 1920, u = 200, h = Math.max(
|
|
1824
|
+
150,
|
|
1825
|
+
Math.round(c / A * u)
|
|
1826
|
+
), m = Math.max(
|
|
1827
|
+
12,
|
|
1828
|
+
Math.min(
|
|
1829
|
+
20,
|
|
1830
|
+
Math.round(h / u * 13)
|
|
1831
|
+
)
|
|
1832
|
+
);
|
|
1833
|
+
(a = I.scene) == null || a.traverse((p) => {
|
|
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) => {
|
|
1837
1848
|
var A;
|
|
1838
1849
|
if (c.type === "DirectionalLight") {
|
|
1839
1850
|
const u = c;
|
|
@@ -1991,13 +2002,13 @@ function to() {
|
|
|
1991
2002
|
const A = this.vertices.length;
|
|
1992
2003
|
let u = this.parseVertexIndex(e, A), h = this.parseVertexIndex(t, A), d = this.parseVertexIndex(s, A);
|
|
1993
2004
|
if (this.addVertex(u, h, d), this.addColor(u, h, d), a !== void 0 && a !== "") {
|
|
1994
|
-
const
|
|
1995
|
-
u = this.parseNormalIndex(a,
|
|
2005
|
+
const m = this.normals.length;
|
|
2006
|
+
u = this.parseNormalIndex(a, m), h = this.parseNormalIndex(l, m), d = this.parseNormalIndex(c, m), this.addNormal(u, h, d);
|
|
1996
2007
|
} else
|
|
1997
2008
|
this.addFaceNormal(u, h, d);
|
|
1998
2009
|
if (n !== void 0 && n !== "") {
|
|
1999
|
-
const
|
|
2000
|
-
u = this.parseUVIndex(n,
|
|
2010
|
+
const m = this.uvs.length;
|
|
2011
|
+
u = this.parseUVIndex(n, m), h = this.parseUVIndex(i, m), d = this.parseUVIndex(o, m), this.addUV(u, h, d), this.object.geometry.hasUVIndices = !0;
|
|
2001
2012
|
} else
|
|
2002
2013
|
this.addDefaultUV();
|
|
2003
2014
|
},
|
|
@@ -2108,24 +2119,24 @@ class no extends Yt {
|
|
|
2108
2119
|
}
|
|
2109
2120
|
} else if (A === "f") {
|
|
2110
2121
|
const h = c.slice(1).trim().split(In), d = [];
|
|
2111
|
-
for (let
|
|
2112
|
-
const g = h[
|
|
2122
|
+
for (let p = 0, f = h.length; p < f; p++) {
|
|
2123
|
+
const g = h[p];
|
|
2113
2124
|
if (g.length > 0) {
|
|
2114
2125
|
const x = g.split("/");
|
|
2115
2126
|
d.push(x);
|
|
2116
2127
|
}
|
|
2117
2128
|
}
|
|
2118
|
-
const
|
|
2119
|
-
for (let
|
|
2120
|
-
const g = d[
|
|
2129
|
+
const m = d[0];
|
|
2130
|
+
for (let p = 1, f = d.length - 1; p < f; p++) {
|
|
2131
|
+
const g = d[p], x = d[p + 1];
|
|
2121
2132
|
t.addFace(
|
|
2122
|
-
|
|
2133
|
+
m[0],
|
|
2123
2134
|
g[0],
|
|
2124
2135
|
x[0],
|
|
2125
|
-
|
|
2136
|
+
m[1],
|
|
2126
2137
|
g[1],
|
|
2127
2138
|
x[1],
|
|
2128
|
-
|
|
2139
|
+
m[2],
|
|
2129
2140
|
g[2],
|
|
2130
2141
|
x[2]
|
|
2131
2142
|
);
|
|
@@ -2137,8 +2148,8 @@ class no extends Yt {
|
|
|
2137
2148
|
if (c.indexOf("/") === -1)
|
|
2138
2149
|
h = u;
|
|
2139
2150
|
else
|
|
2140
|
-
for (let
|
|
2141
|
-
const f = u[
|
|
2151
|
+
for (let m = 0, p = u.length; m < p; m++) {
|
|
2152
|
+
const f = u[m].split("/");
|
|
2142
2153
|
f[0] !== "" && h.push(f[0]), f[1] !== "" && d.push(f[1]);
|
|
2143
2154
|
}
|
|
2144
2155
|
t.addLineGeometry(h, d);
|
|
@@ -2172,34 +2183,34 @@ class no extends Yt {
|
|
|
2172
2183
|
if (i.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0) === !0)
|
|
2173
2184
|
for (let a = 0, l = t.objects.length; a < l; a++) {
|
|
2174
2185
|
const c = t.objects[a], A = c.geometry, u = c.materials, h = A.type === "Line", d = A.type === "Points";
|
|
2175
|
-
let
|
|
2186
|
+
let m = !1;
|
|
2176
2187
|
if (A.vertices.length === 0) continue;
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2188
|
+
const p = new We();
|
|
2189
|
+
p.setAttribute("position", new pe(A.vertices, 3)), A.normals.length > 0 && p.setAttribute("normal", new pe(A.normals, 3)), A.colors.length > 0 && (m = !0, p.setAttribute("color", new pe(A.colors, 3))), A.hasUVIndices === !0 && p.setAttribute("uv", new pe(A.uvs, 2));
|
|
2179
2190
|
const f = [];
|
|
2180
2191
|
for (let x = 0, C = u.length; x < C; x++) {
|
|
2181
|
-
const y = u[x], w = y.name + "_" + y.smooth + "_" +
|
|
2192
|
+
const y = u[x], w = y.name + "_" + y.smooth + "_" + m;
|
|
2182
2193
|
let D = t.materials[w];
|
|
2183
2194
|
if (this.materials !== null) {
|
|
2184
2195
|
if (D = this.materials.create(y.name), h && D && !(D instanceof Ze)) {
|
|
2185
|
-
const
|
|
2186
|
-
Qe.prototype.copy.call(
|
|
2196
|
+
const S = new Ze();
|
|
2197
|
+
Qe.prototype.copy.call(S, D), S.color.copy(D.color), D = S;
|
|
2187
2198
|
} else if (d && D && !(D instanceof Ue)) {
|
|
2188
|
-
const
|
|
2189
|
-
Qe.prototype.copy.call(
|
|
2199
|
+
const S = new Ue({ size: 10, sizeAttenuation: !1 });
|
|
2200
|
+
Qe.prototype.copy.call(S, D), S.color.copy(D.color), S.map = D.map, D = S;
|
|
2190
2201
|
}
|
|
2191
2202
|
}
|
|
2192
|
-
D === void 0 && (h ? D = new Ze() : d ? D = new Ue({ size: 1, sizeAttenuation: !1 }) : D = new ps(), D.name = y.name, D.flatShading = !y.smooth, D.vertexColors =
|
|
2203
|
+
D === void 0 && (h ? D = new Ze() : d ? D = new Ue({ size: 1, sizeAttenuation: !1 }) : D = new ps(), D.name = y.name, D.flatShading = !y.smooth, D.vertexColors = m, t.materials[w] = D), f.push(D);
|
|
2193
2204
|
}
|
|
2194
2205
|
let g;
|
|
2195
2206
|
if (f.length > 1) {
|
|
2196
2207
|
for (let x = 0, C = u.length; x < C; x++) {
|
|
2197
2208
|
const y = u[x];
|
|
2198
|
-
|
|
2209
|
+
p.addGroup(y.groupStart, y.groupCount, x);
|
|
2199
2210
|
}
|
|
2200
|
-
h ? g = new Wt(
|
|
2211
|
+
h ? g = new Wt(p, f) : d ? g = new pt(p, f) : g = new v(p, f);
|
|
2201
2212
|
} else
|
|
2202
|
-
h ? g = new Wt(
|
|
2213
|
+
h ? g = new Wt(p, f[0]) : d ? g = new pt(p, f[0]) : g = new v(p, f[0]);
|
|
2203
2214
|
g.name = c.name, i.add(g);
|
|
2204
2215
|
}
|
|
2205
2216
|
else if (t.vertices.length > 0) {
|
|
@@ -2214,7 +2225,7 @@ class no extends Yt {
|
|
|
2214
2225
|
function wn(r, e) {
|
|
2215
2226
|
if (e === ms)
|
|
2216
2227
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
2217
|
-
if (e === zt || e ===
|
|
2228
|
+
if (e === zt || e === Sn) {
|
|
2218
2229
|
let t = r.getIndex();
|
|
2219
2230
|
if (t === null) {
|
|
2220
2231
|
const o = [], a = r.getAttribute("position");
|
|
@@ -2827,16 +2838,16 @@ class wo {
|
|
|
2827
2838
|
a.push(this.parser.getDependency("accessor", o[c]).then((A) => (l[c] = A, l[c])));
|
|
2828
2839
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
|
|
2829
2840
|
const A = c.pop(), u = A.isGroup ? A.children : [A], h = c[0].count, d = [];
|
|
2830
|
-
for (const
|
|
2831
|
-
const
|
|
2841
|
+
for (const m of u) {
|
|
2842
|
+
const p = new me(), f = new M(), g = new K(), x = new M(1, 1, 1), C = new ys(m.geometry, m.material, h);
|
|
2832
2843
|
for (let y = 0; y < h; y++)
|
|
2833
|
-
l.TRANSLATION && f.fromBufferAttribute(l.TRANSLATION, y), l.ROTATION && g.fromBufferAttribute(l.ROTATION, y), l.SCALE && x.fromBufferAttribute(l.SCALE, y), C.setMatrixAt(y,
|
|
2844
|
+
l.TRANSLATION && f.fromBufferAttribute(l.TRANSLATION, y), l.ROTATION && g.fromBufferAttribute(l.ROTATION, y), l.SCALE && x.fromBufferAttribute(l.SCALE, y), C.setMatrixAt(y, p.compose(f, g, x));
|
|
2834
2845
|
for (const y in l)
|
|
2835
2846
|
if (y === "_COLOR_0") {
|
|
2836
2847
|
const w = l[y];
|
|
2837
2848
|
C.instanceColor = new Cs(w.array, w.itemSize, w.normalized);
|
|
2838
|
-
} else y !== "TRANSLATION" && y !== "ROTATION" && y !== "SCALE" &&
|
|
2839
|
-
ke.prototype.copy.call(C,
|
|
2849
|
+
} else y !== "TRANSLATION" && y !== "ROTATION" && y !== "SCALE" && m.geometry.setAttribute(y, l[y]);
|
|
2850
|
+
ke.prototype.copy.call(C, m), this.parser.assignFinalMaterial(C), d.push(C);
|
|
2840
2851
|
}
|
|
2841
2852
|
return A.isGroup ? (A.clear(), A.add(...d), A) : d[0];
|
|
2842
2853
|
}));
|
|
@@ -2896,9 +2907,9 @@ class Mo {
|
|
|
2896
2907
|
return t.getDependency("bufferView", i).then(function(A) {
|
|
2897
2908
|
return new Promise(function(u, h) {
|
|
2898
2909
|
n.decodeDracoFile(A, function(d) {
|
|
2899
|
-
for (const
|
|
2900
|
-
const
|
|
2901
|
-
f !== void 0 && (
|
|
2910
|
+
for (const m in d.attributes) {
|
|
2911
|
+
const p = d.attributes[m], f = l[m];
|
|
2912
|
+
f !== void 0 && (p.normalized = f);
|
|
2902
2913
|
}
|
|
2903
2914
|
u(d);
|
|
2904
2915
|
}, a, c, ae, h);
|
|
@@ -2930,10 +2941,10 @@ class Zn extends zs {
|
|
|
2930
2941
|
return t;
|
|
2931
2942
|
}
|
|
2932
2943
|
interpolate_(e, t, s, n) {
|
|
2933
|
-
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, c = a * 3, A = n - t, u = (s - t) / A, h = u * u, d = h * u,
|
|
2944
|
+
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, l = a * 2, c = a * 3, A = n - t, u = (s - t) / A, h = u * u, d = h * u, m = e * c, p = m - c, f = -2 * d + 3 * h, g = d - h, x = 1 - f, C = g - h + u;
|
|
2934
2945
|
for (let y = 0; y !== a; y++) {
|
|
2935
|
-
const w = o[
|
|
2936
|
-
i[y] = x * w + C * D + f *
|
|
2946
|
+
const w = o[p + y + a], D = o[p + y + l] * A, S = o[m + y + a], Z = o[m + y] * A;
|
|
2947
|
+
i[y] = x * w + C * D + f * S + g * Z;
|
|
2937
2948
|
}
|
|
2938
2949
|
return i;
|
|
2939
2950
|
}
|
|
@@ -2971,7 +2982,7 @@ const te = {
|
|
|
2971
2982
|
33071: Ts,
|
|
2972
2983
|
33648: Ps,
|
|
2973
2984
|
10497: Ft
|
|
2974
|
-
},
|
|
2985
|
+
}, St = {
|
|
2975
2986
|
SCALAR: 1,
|
|
2976
2987
|
VEC2: 2,
|
|
2977
2988
|
VEC3: 3,
|
|
@@ -3001,7 +3012,7 @@ const te = {
|
|
|
3001
3012
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
3002
3013
|
LINEAR: Wn,
|
|
3003
3014
|
STEP: ks
|
|
3004
|
-
},
|
|
3015
|
+
}, Ht = {
|
|
3005
3016
|
OPAQUE: "OPAQUE",
|
|
3006
3017
|
MASK: "MASK",
|
|
3007
3018
|
BLEND: "BLEND"
|
|
@@ -3024,7 +3035,7 @@ function xe(r, e, t) {
|
|
|
3024
3035
|
function re(r, e) {
|
|
3025
3036
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(r.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
3026
3037
|
}
|
|
3027
|
-
function
|
|
3038
|
+
function So(r, e, t) {
|
|
3028
3039
|
let s = !1, n = !1, i = !1;
|
|
3029
3040
|
for (let c = 0, A = e.length; c < A; c++) {
|
|
3030
3041
|
const u = e[c];
|
|
@@ -3056,7 +3067,7 @@ function Ho(r, e, t) {
|
|
|
3056
3067
|
return s && (r.morphAttributes.position = A), n && (r.morphAttributes.normal = u), i && (r.morphAttributes.color = h), r.morphTargetsRelative = !0, r;
|
|
3057
3068
|
});
|
|
3058
3069
|
}
|
|
3059
|
-
function
|
|
3070
|
+
function Ho(r, e) {
|
|
3060
3071
|
if (r.updateMorphTargets(), e.weights !== void 0)
|
|
3061
3072
|
for (let t = 0, s = e.weights.length; t < s; t++)
|
|
3062
3073
|
r.morphTargetInfluences[t] = e.weights[t];
|
|
@@ -3353,27 +3364,27 @@ class ko {
|
|
|
3353
3364
|
loadAccessor(e) {
|
|
3354
3365
|
const t = this, s = this.json, n = this.json.accessors[e];
|
|
3355
3366
|
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
3356
|
-
const o =
|
|
3367
|
+
const o = St[n.type], a = je[n.componentType], l = n.normalized === !0, c = new a(n.count * o);
|
|
3357
3368
|
return Promise.resolve(new _e(c, o, l));
|
|
3358
3369
|
}
|
|
3359
3370
|
const i = [];
|
|
3360
3371
|
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) {
|
|
3361
|
-
const a = o[0], l =
|
|
3362
|
-
let
|
|
3372
|
+
const a = o[0], l = St[n.type], c = je[n.componentType], A = c.BYTES_PER_ELEMENT, u = A * l, h = n.byteOffset || 0, d = n.bufferView !== void 0 ? s.bufferViews[n.bufferView].byteStride : void 0, m = n.normalized === !0;
|
|
3373
|
+
let p, f;
|
|
3363
3374
|
if (d && d !== u) {
|
|
3364
3375
|
const g = Math.floor(h / d), x = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + g + ":" + n.count;
|
|
3365
3376
|
let C = t.cache.get(x);
|
|
3366
|
-
C || (
|
|
3377
|
+
C || (p = new c(a, g * d, n.count * d / A), C = new Hn(p, d / A), t.cache.add(x, C)), f = new Ln(C, l, h % d / A, m);
|
|
3367
3378
|
} else
|
|
3368
|
-
a === null ?
|
|
3379
|
+
a === null ? p = new c(n.count * l) : p = new c(a, h, n.count * l), f = new _e(p, l, m);
|
|
3369
3380
|
if (n.sparse !== void 0) {
|
|
3370
|
-
const g =
|
|
3381
|
+
const g = St.SCALAR, x = je[n.sparse.indices.componentType], C = n.sparse.indices.byteOffset || 0, y = n.sparse.values.byteOffset || 0, w = new x(o[1], C, n.sparse.count * g), D = new c(o[2], y, n.sparse.count * l);
|
|
3371
3382
|
a !== null && (f = new _e(f.array.slice(), f.itemSize, f.normalized)), f.normalized = !1;
|
|
3372
|
-
for (let
|
|
3373
|
-
const _ = w[
|
|
3374
|
-
if (f.setX(_, D[
|
|
3383
|
+
for (let S = 0, Z = w.length; S < Z; S++) {
|
|
3384
|
+
const _ = w[S];
|
|
3385
|
+
if (f.setX(_, D[S * l]), l >= 2 && f.setY(_, D[S * l + 1]), l >= 3 && f.setZ(_, D[S * l + 2]), l >= 4 && f.setW(_, D[S * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
3375
3386
|
}
|
|
3376
|
-
f.normalized =
|
|
3387
|
+
f.normalized = m;
|
|
3377
3388
|
}
|
|
3378
3389
|
return f;
|
|
3379
3390
|
});
|
|
@@ -3423,11 +3434,11 @@ class ko {
|
|
|
3423
3434
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
3424
3435
|
const A = Promise.resolve(l).then(function(u) {
|
|
3425
3436
|
return new Promise(function(h, d) {
|
|
3426
|
-
let
|
|
3427
|
-
t.isImageBitmapLoader === !0 && (
|
|
3428
|
-
const f = new tn(
|
|
3437
|
+
let m = h;
|
|
3438
|
+
t.isImageBitmapLoader === !0 && (m = function(p) {
|
|
3439
|
+
const f = new tn(p);
|
|
3429
3440
|
f.needsUpdate = !0, h(f);
|
|
3430
|
-
}), t.load(Je.resolveURL(u, i.path),
|
|
3441
|
+
}), t.load(Je.resolveURL(u, i.path), m, void 0, d);
|
|
3431
3442
|
});
|
|
3432
3443
|
}).then(function(u) {
|
|
3433
3444
|
return c === !0 && a.revokeObjectURL(l), re(u, o), u.userData.mimeType = o.mimeType || No(o.uri), u;
|
|
@@ -3521,8 +3532,8 @@ class ko {
|
|
|
3521
3532
|
})));
|
|
3522
3533
|
}
|
|
3523
3534
|
i.doubleSided === !0 && (a.side = Rn);
|
|
3524
|
-
const A = i.alphaMode ||
|
|
3525
|
-
if (A ===
|
|
3535
|
+
const A = i.alphaMode || Ht.OPAQUE;
|
|
3536
|
+
if (A === Ht.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, A === 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)) {
|
|
3526
3537
|
const u = i.normalTexture.scale;
|
|
3527
3538
|
a.normalScale.set(u, u);
|
|
3528
3539
|
}
|
|
@@ -3589,25 +3600,25 @@ class ko {
|
|
|
3589
3600
|
}
|
|
3590
3601
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
3591
3602
|
const c = l.slice(0, l.length - 1), A = l[l.length - 1], u = [];
|
|
3592
|
-
for (let d = 0,
|
|
3593
|
-
const
|
|
3603
|
+
for (let d = 0, m = A.length; d < m; d++) {
|
|
3604
|
+
const p = A[d], f = o[d];
|
|
3594
3605
|
let g;
|
|
3595
3606
|
const x = c[d];
|
|
3596
3607
|
if (f.mode === te.TRIANGLES || f.mode === te.TRIANGLE_STRIP || f.mode === te.TRIANGLE_FAN || f.mode === void 0)
|
|
3597
|
-
g = i.isSkinnedMesh === !0 ? new Es(
|
|
3608
|
+
g = i.isSkinnedMesh === !0 ? new Es(p, x) : new v(p, x), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), f.mode === te.TRIANGLE_STRIP ? g.geometry = wn(g.geometry, Sn) : f.mode === te.TRIANGLE_FAN && (g.geometry = wn(g.geometry, zt));
|
|
3598
3609
|
else if (f.mode === te.LINES)
|
|
3599
|
-
g = new Wt(
|
|
3610
|
+
g = new Wt(p, x);
|
|
3600
3611
|
else if (f.mode === te.LINE_STRIP)
|
|
3601
|
-
g = new ue(
|
|
3612
|
+
g = new ue(p, x);
|
|
3602
3613
|
else if (f.mode === te.LINE_LOOP)
|
|
3603
|
-
g = new Rs(
|
|
3614
|
+
g = new Rs(p, x);
|
|
3604
3615
|
else if (f.mode === te.POINTS)
|
|
3605
|
-
g = new pt(
|
|
3616
|
+
g = new pt(p, x);
|
|
3606
3617
|
else
|
|
3607
3618
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + f.mode);
|
|
3608
|
-
Object.keys(g.geometry.morphAttributes).length > 0 &&
|
|
3619
|
+
Object.keys(g.geometry.morphAttributes).length > 0 && Ho(g, i), g.name = t.createUniqueName(i.name || "mesh_" + e), re(g, i), f.extensions && xe(n, g, f), t.assignFinalMaterial(g), u.push(g);
|
|
3609
3620
|
}
|
|
3610
|
-
for (let d = 0,
|
|
3621
|
+
for (let d = 0, m = u.length; d < m; d++)
|
|
3611
3622
|
t.associations.set(u[d], {
|
|
3612
3623
|
meshes: e,
|
|
3613
3624
|
primitives: d
|
|
@@ -3616,7 +3627,7 @@ class ko {
|
|
|
3616
3627
|
return i.extensions && xe(n, u[0], i), u[0];
|
|
3617
3628
|
const h = new ft();
|
|
3618
3629
|
i.extensions && xe(n, h, i), t.associations.set(h, { meshes: e });
|
|
3619
|
-
for (let d = 0,
|
|
3630
|
+
for (let d = 0, m = u.length; d < m; d++)
|
|
3620
3631
|
h.add(u[d]);
|
|
3621
3632
|
return h;
|
|
3622
3633
|
});
|
|
@@ -3635,7 +3646,7 @@ class ko {
|
|
|
3635
3646
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3636
3647
|
return;
|
|
3637
3648
|
}
|
|
3638
|
-
return s.type === "perspective" ? t = new
|
|
3649
|
+
return s.type === "perspective" ? t = new Ss(En.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new Hs(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), s.name && (t.name = this.createUniqueName(s.name)), re(t, s), Promise.resolve(t);
|
|
3639
3650
|
}
|
|
3640
3651
|
/**
|
|
3641
3652
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -3672,8 +3683,8 @@ class ko {
|
|
|
3672
3683
|
loadAnimation(e) {
|
|
3673
3684
|
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], l = [], c = [], A = [];
|
|
3674
3685
|
for (let u = 0, h = n.channels.length; u < h; u++) {
|
|
3675
|
-
const d = n.channels[u],
|
|
3676
|
-
|
|
3686
|
+
const d = n.channels[u], m = n.samplers[d.sampler], p = d.target, f = p.node, g = n.parameters !== void 0 ? n.parameters[m.input] : m.input, x = n.parameters !== void 0 ? n.parameters[m.output] : m.output;
|
|
3687
|
+
p.node !== void 0 && (o.push(this.getDependency("node", f)), a.push(this.getDependency("accessor", g)), l.push(this.getDependency("accessor", x)), c.push(m), A.push(p));
|
|
3677
3688
|
}
|
|
3678
3689
|
return Promise.all([
|
|
3679
3690
|
Promise.all(o),
|
|
@@ -3682,12 +3693,12 @@ class ko {
|
|
|
3682
3693
|
Promise.all(c),
|
|
3683
3694
|
Promise.all(A)
|
|
3684
3695
|
]).then(function(u) {
|
|
3685
|
-
const h = u[0], d = u[1],
|
|
3696
|
+
const h = u[0], d = u[1], m = u[2], p = u[3], f = u[4], g = [];
|
|
3686
3697
|
for (let C = 0, y = h.length; C < y; C++) {
|
|
3687
|
-
const w = h[C], D = d[C],
|
|
3698
|
+
const w = h[C], D = d[C], S = m[C], Z = p[C], _ = f[C];
|
|
3688
3699
|
if (w === void 0) continue;
|
|
3689
3700
|
w.updateMatrix && w.updateMatrix();
|
|
3690
|
-
const Q = s._createAnimationTracks(w, D,
|
|
3701
|
+
const Q = s._createAnimationTracks(w, D, S, Z, _);
|
|
3691
3702
|
if (Q)
|
|
3692
3703
|
for (let ye = 0; ye < Q.length; ye++)
|
|
3693
3704
|
g.push(Q[ye]);
|
|
@@ -3728,11 +3739,11 @@ class ko {
|
|
|
3728
3739
|
h !== null && A.traverse(function(d) {
|
|
3729
3740
|
d.isSkinnedMesh && d.bind(h, jo);
|
|
3730
3741
|
});
|
|
3731
|
-
for (let d = 0,
|
|
3742
|
+
for (let d = 0, m = u.length; d < m; d++)
|
|
3732
3743
|
A.add(u[d]);
|
|
3733
3744
|
if (A.userData.pivot !== void 0 && u.length > 0) {
|
|
3734
|
-
const d = A.userData.pivot,
|
|
3735
|
-
A.pivot = new M().fromArray(d), A.position.x -= d[0], A.position.y -= d[1], A.position.z -= d[2],
|
|
3745
|
+
const d = A.userData.pivot, m = u[0];
|
|
3746
|
+
A.pivot = new M().fromArray(d), A.position.x -= d[0], A.position.y -= d[1], A.position.z -= d[2], m.position.set(0, 0, 0), delete A.userData.pivot;
|
|
3736
3747
|
}
|
|
3737
3748
|
return A;
|
|
3738
3749
|
});
|
|
@@ -3833,14 +3844,14 @@ class ko {
|
|
|
3833
3844
|
break;
|
|
3834
3845
|
}
|
|
3835
3846
|
const u = n.interpolation !== void 0 ? Eo[n.interpolation] : Wn, h = this._getArrayFromAccessor(s);
|
|
3836
|
-
for (let d = 0,
|
|
3837
|
-
const
|
|
3847
|
+
for (let d = 0, m = l.length; d < m; d++) {
|
|
3848
|
+
const p = new A(
|
|
3838
3849
|
l[d] + "." + fe[i.path],
|
|
3839
3850
|
t.array,
|
|
3840
3851
|
h,
|
|
3841
3852
|
u
|
|
3842
3853
|
);
|
|
3843
|
-
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(
|
|
3854
|
+
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(p), o.push(p);
|
|
3844
3855
|
}
|
|
3845
3856
|
return o;
|
|
3846
3857
|
}
|
|
@@ -3885,11 +3896,11 @@ function Wo(r, e, t) {
|
|
|
3885
3896
|
for (let c = 0, A = i.length; c < A; c++) {
|
|
3886
3897
|
const u = i[c];
|
|
3887
3898
|
if (u.POSITION !== void 0) {
|
|
3888
|
-
const h = t.json.accessors[u.POSITION], d = h.min,
|
|
3889
|
-
if (d !== void 0 &&
|
|
3890
|
-
if (l.setX(Math.max(Math.abs(d[0]), Math.abs(
|
|
3891
|
-
const
|
|
3892
|
-
l.multiplyScalar(
|
|
3899
|
+
const h = t.json.accessors[u.POSITION], d = h.min, m = h.max;
|
|
3900
|
+
if (d !== void 0 && m !== void 0) {
|
|
3901
|
+
if (l.setX(Math.max(Math.abs(d[0]), Math.abs(m[0]))), l.setY(Math.max(Math.abs(d[1]), Math.abs(m[1]))), l.setZ(Math.max(Math.abs(d[2]), Math.abs(m[2]))), h.normalized) {
|
|
3902
|
+
const p = Vt(je[h.componentType]);
|
|
3903
|
+
l.multiplyScalar(p);
|
|
3893
3904
|
}
|
|
3894
3905
|
a.max(l);
|
|
3895
3906
|
} else
|
|
@@ -3920,7 +3931,7 @@ function Tn(r, e, t) {
|
|
|
3920
3931
|
n.push(o);
|
|
3921
3932
|
}
|
|
3922
3933
|
return qt.workingColorSpace !== ae && "COLOR_0" in s && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${qt.workingColorSpace}" not supported.`), re(r, e), Wo(r, e, t), Promise.all(n).then(function() {
|
|
3923
|
-
return e.targets !== void 0 ?
|
|
3934
|
+
return e.targets !== void 0 ? So(r, e.targets, t) : r;
|
|
3924
3935
|
});
|
|
3925
3936
|
}
|
|
3926
3937
|
const Nt = /* @__PURE__ */ new WeakMap();
|
|
@@ -4039,7 +4050,7 @@ class zo extends Yt {
|
|
|
4039
4050
|
if (o === a)
|
|
4040
4051
|
c = new _e(i, o);
|
|
4041
4052
|
else {
|
|
4042
|
-
const A = new
|
|
4053
|
+
const A = new Hn(i, a);
|
|
4043
4054
|
c = new Ln(A, o, 0);
|
|
4044
4055
|
}
|
|
4045
4056
|
n === "color" && (this._assignVertexColorSpace(c, l), c.normalized = !(i instanceof Float32Array)), t.setAttribute(n, c);
|
|
@@ -4132,8 +4143,8 @@ function Go() {
|
|
|
4132
4143
|
e.then((A) => {
|
|
4133
4144
|
const u = A.draco, h = new u.Decoder();
|
|
4134
4145
|
try {
|
|
4135
|
-
const d = t(u, h, new Int8Array(l), c),
|
|
4136
|
-
d.index &&
|
|
4146
|
+
const d = t(u, h, new Int8Array(l), c), m = d.attributes.map((p) => p.array.buffer);
|
|
4147
|
+
d.index && m.push(d.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: d }, m);
|
|
4137
4148
|
} catch (d) {
|
|
4138
4149
|
console.error(d), self.postMessage({ type: "error", id: a.id, error: d.message });
|
|
4139
4150
|
} finally {
|
|
@@ -4146,16 +4157,16 @@ function Go() {
|
|
|
4146
4157
|
function t(o, a, l, c) {
|
|
4147
4158
|
const A = c.attributeIDs, u = c.attributeTypes;
|
|
4148
4159
|
let h, d;
|
|
4149
|
-
const
|
|
4150
|
-
if (
|
|
4160
|
+
const m = a.GetEncodedGeometryType(l);
|
|
4161
|
+
if (m === o.TRIANGULAR_MESH)
|
|
4151
4162
|
h = new o.Mesh(), d = a.DecodeArrayToMesh(l, l.byteLength, h);
|
|
4152
|
-
else if (
|
|
4163
|
+
else if (m === o.POINT_CLOUD)
|
|
4153
4164
|
h = new o.PointCloud(), d = a.DecodeArrayToPointCloud(l, l.byteLength, h);
|
|
4154
4165
|
else
|
|
4155
4166
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
4156
4167
|
if (!d.ok() || h.ptr === 0)
|
|
4157
4168
|
throw new Error("THREE.DRACOLoader: Decoding failed: " + d.error_msg());
|
|
4158
|
-
const
|
|
4169
|
+
const p = { index: null, attributes: [] };
|
|
4159
4170
|
for (const f in A) {
|
|
4160
4171
|
const g = self[u[f]];
|
|
4161
4172
|
let x, C;
|
|
@@ -4166,9 +4177,9 @@ function Go() {
|
|
|
4166
4177
|
x = a.GetAttribute(h, C);
|
|
4167
4178
|
}
|
|
4168
4179
|
const y = n(o, a, h, f, g, x);
|
|
4169
|
-
f === "color" && (y.vertexColorSpace = c.vertexColorSpace),
|
|
4180
|
+
f === "color" && (y.vertexColorSpace = c.vertexColorSpace), p.attributes.push(y);
|
|
4170
4181
|
}
|
|
4171
|
-
return
|
|
4182
|
+
return m === o.TRIANGULAR_MESH && (p.index = s(o, a, h)), o.destroy(h), p;
|
|
4172
4183
|
}
|
|
4173
4184
|
function s(o, a, l) {
|
|
4174
4185
|
const A = l.num_faces() * 3, u = A * 4, h = o._malloc(u);
|
|
@@ -4177,19 +4188,19 @@ function Go() {
|
|
|
4177
4188
|
return o._free(h), { array: d, itemSize: 1 };
|
|
4178
4189
|
}
|
|
4179
4190
|
function n(o, a, l, c, A, u) {
|
|
4180
|
-
const h = l.num_points(), d = u.num_components(),
|
|
4181
|
-
a.GetAttributeDataArrayForAllPoints(l, u,
|
|
4191
|
+
const h = l.num_points(), d = u.num_components(), m = i(o, A), p = d * A.BYTES_PER_ELEMENT, f = Math.ceil(p / 4) * 4, g = f / A.BYTES_PER_ELEMENT, x = h * p, C = h * f, y = o._malloc(x);
|
|
4192
|
+
a.GetAttributeDataArrayForAllPoints(l, u, m, x, y);
|
|
4182
4193
|
const w = new A(o.HEAPF32.buffer, y, x / A.BYTES_PER_ELEMENT);
|
|
4183
4194
|
let D;
|
|
4184
|
-
if (
|
|
4195
|
+
if (p === f)
|
|
4185
4196
|
D = w.slice();
|
|
4186
4197
|
else {
|
|
4187
4198
|
D = new A(C / A.BYTES_PER_ELEMENT);
|
|
4188
|
-
let
|
|
4199
|
+
let S = 0;
|
|
4189
4200
|
for (let Z = 0, _ = w.length; Z < _; Z++) {
|
|
4190
4201
|
for (let Q = 0; Q < d; Q++)
|
|
4191
|
-
D[
|
|
4192
|
-
|
|
4202
|
+
D[S + Q] = w[Z * d + Q];
|
|
4203
|
+
S += g;
|
|
4193
4204
|
}
|
|
4194
4205
|
}
|
|
4195
4206
|
return o._free(y), {
|
|
@@ -4250,7 +4261,7 @@ function Uo(r) {
|
|
|
4250
4261
|
speedY: A = 5e-4
|
|
4251
4262
|
} = r || {}, u = new P.PlaneGeometry(e, t), d = new P.TextureLoader().load(Fo, (f) => {
|
|
4252
4263
|
f.wrapS = f.wrapT = P.RepeatWrapping, f.repeat.set(a, l), f.generateMipmaps = !1, f.minFilter = P.LinearFilter, f.magFilter = P.LinearFilter;
|
|
4253
|
-
}),
|
|
4264
|
+
}), m = new P.MeshStandardMaterial({
|
|
4254
4265
|
color: s,
|
|
4255
4266
|
roughness: n,
|
|
4256
4267
|
metalness: i,
|
|
@@ -4260,8 +4271,8 @@ function Uo(r) {
|
|
|
4260
4271
|
// 双面渲染,避免从侧面或底部看到黑色
|
|
4261
4272
|
transparent: !0,
|
|
4262
4273
|
opacity: 0.6
|
|
4263
|
-
}),
|
|
4264
|
-
|
|
4274
|
+
}), p = new P.Mesh(u, m);
|
|
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: A }, ze(p);
|
|
4265
4276
|
}
|
|
4266
4277
|
function Vo(r) {
|
|
4267
4278
|
return Et(!0), new Promise((e, t) => {
|
|
@@ -4324,16 +4335,28 @@ function Ko(r) {
|
|
|
4324
4335
|
return console.warn("请先选中一个模型,再添加数据面板"), null;
|
|
4325
4336
|
const t = Zt(e);
|
|
4326
4337
|
t && (t.dispose(), hi(e));
|
|
4327
|
-
const s =
|
|
4338
|
+
const s = Math.min(window.innerWidth, 7e3), n = 1920, i = 200, o = Math.max(
|
|
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 = [
|
|
4328
4349
|
{ label: "温度", value: "30", unit: "℃" },
|
|
4329
4350
|
{ label: "湿度", value: "65", unit: "%" },
|
|
4330
4351
|
{ label: "压力", value: "101.3", unit: "kPa" },
|
|
4331
4352
|
{ label: "名称", value: e.name || "未命名" }
|
|
4332
|
-
],
|
|
4353
|
+
], A = new Gn({
|
|
4333
4354
|
title: (r == null ? void 0 : r.title) || "数据面板",
|
|
4334
|
-
items: (r == null ? void 0 : r.items) ||
|
|
4355
|
+
items: (r == null ? void 0 : r.items) || c,
|
|
4356
|
+
width: `${o}px`,
|
|
4357
|
+
fontSize: `${l}px`
|
|
4335
4358
|
});
|
|
4336
|
-
return
|
|
4359
|
+
return A.attachTo(e), Fn(e, A), A;
|
|
4337
4360
|
}
|
|
4338
4361
|
const Zo = {
|
|
4339
4362
|
key: 1,
|
|
@@ -4350,12 +4373,12 @@ const Zo = {
|
|
|
4350
4373
|
},
|
|
4351
4374
|
emits: ["select", "delete"],
|
|
4352
4375
|
setup(r, { emit: e }) {
|
|
4353
|
-
const t = r, s = e, n = j(null), { expandedSet: i, toggleExpand: o } = es("treeExpand"), a = Be(() => i.value.has(t.node.uuid)), l = Be(() => (t.version, t.node.children.some((
|
|
4354
|
-
(
|
|
4376
|
+
const t = r, s = e, n = j(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
|
+
(p) => p.userData.isMovable === !0
|
|
4355
4378
|
))), A = Be(
|
|
4356
4379
|
() => {
|
|
4357
|
-
var
|
|
4358
|
-
return ((
|
|
4380
|
+
var p;
|
|
4381
|
+
return ((p = t.selectedObject) == null ? void 0 : p.uuid) === t.node.uuid;
|
|
4359
4382
|
}
|
|
4360
4383
|
);
|
|
4361
4384
|
ts(
|
|
@@ -4369,12 +4392,12 @@ const Zo = {
|
|
|
4369
4392
|
},
|
|
4370
4393
|
{ flush: "post" }
|
|
4371
4394
|
);
|
|
4372
|
-
const u = (
|
|
4373
|
-
|
|
4374
|
-
}, h = (
|
|
4375
|
-
|
|
4376
|
-
}, d = (
|
|
4377
|
-
return (
|
|
4395
|
+
const u = (p) => {
|
|
4396
|
+
p.stopPropagation(), s("select", t.node);
|
|
4397
|
+
}, h = (p) => {
|
|
4398
|
+
p.stopPropagation(), s("delete", t.node);
|
|
4399
|
+
}, d = (p) => p.type === "Mesh" || p.type === "Sprite" ? "🟦" : p.type === "Light" ? "💡" : "📦", m = (p) => p.name || `${p.type} (${p.id})`;
|
|
4400
|
+
return (p, f) => {
|
|
4378
4401
|
const g = ns("TreeItem", !0);
|
|
4379
4402
|
return T(), R("div", {
|
|
4380
4403
|
class: "tree-node",
|
|
@@ -4391,7 +4414,7 @@ const Zo = {
|
|
|
4391
4414
|
onClick: f[0] || (f[0] = jt((x) => ss(o)(r.node.uuid), ["stop"]))
|
|
4392
4415
|
}, ie(a.value ? "▼" : "▶"), 1)) : (T(), R("span", Zo)),
|
|
4393
4416
|
b("span", Qo, ie(d(r.node)), 1),
|
|
4394
|
-
b("span", Jo, ie(
|
|
4417
|
+
b("span", Jo, ie(m(r.node)), 1),
|
|
4395
4418
|
b("button", {
|
|
4396
4419
|
class: "tree-delete",
|
|
4397
4420
|
onClick: jt(h, ["stop"])
|
|
@@ -4444,9 +4467,9 @@ const Zo = {
|
|
|
4444
4467
|
}
|
|
4445
4468
|
function c(h) {
|
|
4446
4469
|
let d = null;
|
|
4447
|
-
return h.traverse((
|
|
4448
|
-
if (
|
|
4449
|
-
const
|
|
4470
|
+
return h.traverse((m) => {
|
|
4471
|
+
if (m.type === "Mesh" && !d) {
|
|
4472
|
+
const p = m, f = Array.isArray(p.material) ? p.material : [p.material];
|
|
4450
4473
|
for (const g of f)
|
|
4451
4474
|
if (g && (g.type === "MeshStandardMaterial" || g.type === "MeshPhongMaterial")) {
|
|
4452
4475
|
const x = g;
|
|
@@ -4461,14 +4484,14 @@ const Zo = {
|
|
|
4461
4484
|
}), d;
|
|
4462
4485
|
}
|
|
4463
4486
|
function A(h, d) {
|
|
4464
|
-
let
|
|
4465
|
-
return h.traverse((
|
|
4466
|
-
if (
|
|
4467
|
-
const f =
|
|
4487
|
+
let m = !1;
|
|
4488
|
+
return h.traverse((p) => {
|
|
4489
|
+
if (p.type === "Mesh") {
|
|
4490
|
+
const f = p, g = Array.isArray(f.material) ? f.material : [f.material];
|
|
4468
4491
|
for (const x of g)
|
|
4469
|
-
x && (x.type === "MeshStandardMaterial" || x.type === "MeshPhongMaterial") && (d.metalness !== void 0 && (x.metalness = d.metalness), d.roughness !== void 0 && (x.roughness = d.roughness), d.opacity !== void 0 && (x.opacity = d.opacity, x.transparent = d.opacity < 1), x.needsUpdate = !0,
|
|
4492
|
+
x && (x.type === "MeshStandardMaterial" || x.type === "MeshPhongMaterial") && (d.metalness !== void 0 && (x.metalness = d.metalness), d.roughness !== void 0 && (x.roughness = d.roughness), d.opacity !== void 0 && (x.opacity = d.opacity, x.transparent = d.opacity < 1), x.needsUpdate = !0, m = !0);
|
|
4470
4493
|
}
|
|
4471
|
-
}),
|
|
4494
|
+
}), m;
|
|
4472
4495
|
}
|
|
4473
4496
|
function u() {
|
|
4474
4497
|
if (t.selectedObject) {
|
|
@@ -4497,7 +4520,7 @@ const Zo = {
|
|
|
4497
4520
|
d[14] || (d[14] = b("span", null, "X:", -1)),
|
|
4498
4521
|
E(b("input", {
|
|
4499
4522
|
type: "number",
|
|
4500
|
-
"onUpdate:modelValue": d[0] || (d[0] = (
|
|
4523
|
+
"onUpdate:modelValue": d[0] || (d[0] = (m) => r.transform.position.x = m),
|
|
4501
4524
|
step: "0.01",
|
|
4502
4525
|
onInput: n
|
|
4503
4526
|
}, null, 544), [
|
|
@@ -4511,7 +4534,7 @@ const Zo = {
|
|
|
4511
4534
|
d[15] || (d[15] = b("span", null, "Y:", -1)),
|
|
4512
4535
|
E(b("input", {
|
|
4513
4536
|
type: "number",
|
|
4514
|
-
"onUpdate:modelValue": d[1] || (d[1] = (
|
|
4537
|
+
"onUpdate:modelValue": d[1] || (d[1] = (m) => r.transform.position.y = m),
|
|
4515
4538
|
step: "0.01",
|
|
4516
4539
|
onInput: n
|
|
4517
4540
|
}, null, 544), [
|
|
@@ -4525,7 +4548,7 @@ const Zo = {
|
|
|
4525
4548
|
d[16] || (d[16] = b("span", null, "Z:", -1)),
|
|
4526
4549
|
E(b("input", {
|
|
4527
4550
|
type: "number",
|
|
4528
|
-
"onUpdate:modelValue": d[2] || (d[2] = (
|
|
4551
|
+
"onUpdate:modelValue": d[2] || (d[2] = (m) => r.transform.position.z = m),
|
|
4529
4552
|
step: "0.01",
|
|
4530
4553
|
onInput: n
|
|
4531
4554
|
}, null, 544), [
|
|
@@ -4544,7 +4567,7 @@ const Zo = {
|
|
|
4544
4567
|
d[18] || (d[18] = b("span", null, "X:", -1)),
|
|
4545
4568
|
E(b("input", {
|
|
4546
4569
|
type: "number",
|
|
4547
|
-
"onUpdate:modelValue": d[3] || (d[3] = (
|
|
4570
|
+
"onUpdate:modelValue": d[3] || (d[3] = (m) => r.transform.rotation.x = m),
|
|
4548
4571
|
step: "0.01",
|
|
4549
4572
|
onInput: n
|
|
4550
4573
|
}, null, 544), [
|
|
@@ -4558,7 +4581,7 @@ const Zo = {
|
|
|
4558
4581
|
d[19] || (d[19] = b("span", null, "Y:", -1)),
|
|
4559
4582
|
E(b("input", {
|
|
4560
4583
|
type: "number",
|
|
4561
|
-
"onUpdate:modelValue": d[4] || (d[4] = (
|
|
4584
|
+
"onUpdate:modelValue": d[4] || (d[4] = (m) => r.transform.rotation.y = m),
|
|
4562
4585
|
step: "0.01",
|
|
4563
4586
|
onInput: n
|
|
4564
4587
|
}, null, 544), [
|
|
@@ -4572,7 +4595,7 @@ const Zo = {
|
|
|
4572
4595
|
d[20] || (d[20] = b("span", null, "Z:", -1)),
|
|
4573
4596
|
E(b("input", {
|
|
4574
4597
|
type: "number",
|
|
4575
|
-
"onUpdate:modelValue": d[5] || (d[5] = (
|
|
4598
|
+
"onUpdate:modelValue": d[5] || (d[5] = (m) => r.transform.rotation.z = m),
|
|
4576
4599
|
step: "0.01",
|
|
4577
4600
|
onInput: n
|
|
4578
4601
|
}, null, 544), [
|
|
@@ -4591,7 +4614,7 @@ const Zo = {
|
|
|
4591
4614
|
d[22] || (d[22] = b("span", null, "X:", -1)),
|
|
4592
4615
|
E(b("input", {
|
|
4593
4616
|
type: "number",
|
|
4594
|
-
"onUpdate:modelValue": d[6] || (d[6] = (
|
|
4617
|
+
"onUpdate:modelValue": d[6] || (d[6] = (m) => r.transform.scale.x = m),
|
|
4595
4618
|
step: "0.01",
|
|
4596
4619
|
onInput: n
|
|
4597
4620
|
}, null, 544), [
|
|
@@ -4605,7 +4628,7 @@ const Zo = {
|
|
|
4605
4628
|
d[23] || (d[23] = b("span", null, "Y:", -1)),
|
|
4606
4629
|
E(b("input", {
|
|
4607
4630
|
type: "number",
|
|
4608
|
-
"onUpdate:modelValue": d[7] || (d[7] = (
|
|
4631
|
+
"onUpdate:modelValue": d[7] || (d[7] = (m) => r.transform.scale.y = m),
|
|
4609
4632
|
step: "0.01",
|
|
4610
4633
|
onInput: n
|
|
4611
4634
|
}, null, 544), [
|
|
@@ -4619,7 +4642,7 @@ const Zo = {
|
|
|
4619
4642
|
d[24] || (d[24] = b("span", null, "Z:", -1)),
|
|
4620
4643
|
E(b("input", {
|
|
4621
4644
|
type: "number",
|
|
4622
|
-
"onUpdate:modelValue": d[8] || (d[8] = (
|
|
4645
|
+
"onUpdate:modelValue": d[8] || (d[8] = (m) => r.transform.scale.z = m),
|
|
4623
4646
|
step: "0.01",
|
|
4624
4647
|
onInput: n
|
|
4625
4648
|
}, null, 544), [
|
|
@@ -4641,7 +4664,7 @@ const Zo = {
|
|
|
4641
4664
|
min: "0",
|
|
4642
4665
|
max: "10",
|
|
4643
4666
|
step: "0.1",
|
|
4644
|
-
"onUpdate:modelValue": d[9] || (d[9] = (
|
|
4667
|
+
"onUpdate:modelValue": d[9] || (d[9] = (m) => a.intensity = m),
|
|
4645
4668
|
onInput: l
|
|
4646
4669
|
}, null, 544), [
|
|
4647
4670
|
[
|
|
@@ -4656,7 +4679,7 @@ const Zo = {
|
|
|
4656
4679
|
min: "0",
|
|
4657
4680
|
max: "100",
|
|
4658
4681
|
step: "0.1",
|
|
4659
|
-
"onUpdate:modelValue": d[10] || (d[10] = (
|
|
4682
|
+
"onUpdate:modelValue": d[10] || (d[10] = (m) => a.intensity = m),
|
|
4660
4683
|
class: "intensity-input",
|
|
4661
4684
|
onInput: l
|
|
4662
4685
|
}, null, 544), [
|
|
@@ -4678,7 +4701,7 @@ const Zo = {
|
|
|
4678
4701
|
min: "0",
|
|
4679
4702
|
max: "1",
|
|
4680
4703
|
step: "0.01",
|
|
4681
|
-
"onUpdate:modelValue": d[11] || (d[11] = (
|
|
4704
|
+
"onUpdate:modelValue": d[11] || (d[11] = (m) => i.metalness = m),
|
|
4682
4705
|
onInput: u
|
|
4683
4706
|
}, null, 544), [
|
|
4684
4707
|
[
|
|
@@ -4697,7 +4720,7 @@ const Zo = {
|
|
|
4697
4720
|
min: "0",
|
|
4698
4721
|
max: "1",
|
|
4699
4722
|
step: "0.01",
|
|
4700
|
-
"onUpdate:modelValue": d[12] || (d[12] = (
|
|
4723
|
+
"onUpdate:modelValue": d[12] || (d[12] = (m) => i.roughness = m),
|
|
4701
4724
|
onInput: u
|
|
4702
4725
|
}, null, 544), [
|
|
4703
4726
|
[
|
|
@@ -4716,7 +4739,7 @@ const Zo = {
|
|
|
4716
4739
|
min: "0",
|
|
4717
4740
|
max: "1",
|
|
4718
4741
|
step: "0.01",
|
|
4719
|
-
"onUpdate:modelValue": d[13] || (d[13] = (
|
|
4742
|
+
"onUpdate:modelValue": d[13] || (d[13] = (m) => i.opacity = m),
|
|
4720
4743
|
onInput: u
|
|
4721
4744
|
}, null, 544), [
|
|
4722
4745
|
[
|
|
@@ -4742,10 +4765,10 @@ const Zo = {
|
|
|
4742
4765
|
}, Dr = { class: "ud-value-json-preview" }, Pr = ["onClick"], Tr = {
|
|
4743
4766
|
key: 0,
|
|
4744
4767
|
class: "ud-json-error"
|
|
4745
|
-
}, Or = { class: "ud-json-actions" }, Er = ["onClick"], Rr = ["onClick"],
|
|
4768
|
+
}, Or = { class: "ud-json-actions" }, Er = ["onClick"], Rr = ["onClick"], Sr = {
|
|
4746
4769
|
key: 1,
|
|
4747
4770
|
class: "userdata-empty"
|
|
4748
|
-
},
|
|
4771
|
+
}, Hr = /* @__PURE__ */ be({
|
|
4749
4772
|
__name: "UserDataTab",
|
|
4750
4773
|
props: {
|
|
4751
4774
|
selectedObject: {}
|
|
@@ -4802,7 +4825,7 @@ const Zo = {
|
|
|
4802
4825
|
function d(C) {
|
|
4803
4826
|
return C.length <= 28 ? C : C.substring(0, 28) + "…";
|
|
4804
4827
|
}
|
|
4805
|
-
function
|
|
4828
|
+
function m(C) {
|
|
4806
4829
|
n.value = C;
|
|
4807
4830
|
const y = e.selectedObject;
|
|
4808
4831
|
if (!y) return;
|
|
@@ -4812,9 +4835,9 @@ const Zo = {
|
|
|
4812
4835
|
} catch {
|
|
4813
4836
|
i.value = String(w);
|
|
4814
4837
|
}
|
|
4815
|
-
|
|
4838
|
+
p();
|
|
4816
4839
|
}
|
|
4817
|
-
function
|
|
4840
|
+
function p() {
|
|
4818
4841
|
const C = i.value.trim();
|
|
4819
4842
|
if (!C) {
|
|
4820
4843
|
o.value = null;
|
|
@@ -4869,7 +4892,7 @@ const Zo = {
|
|
|
4869
4892
|
"onUpdate:modelValue": y[0] || (y[0] = (w) => t.value = w),
|
|
4870
4893
|
placeholder: "属性名",
|
|
4871
4894
|
class: "ud-input",
|
|
4872
|
-
onKeyup:
|
|
4895
|
+
onKeyup: He(u, ["enter"])
|
|
4873
4896
|
}, null, 544), [
|
|
4874
4897
|
[N, t.value]
|
|
4875
4898
|
]),
|
|
@@ -4877,7 +4900,7 @@ const Zo = {
|
|
|
4877
4900
|
"onUpdate:modelValue": y[1] || (y[1] = (w) => s.value = w),
|
|
4878
4901
|
placeholder: "值",
|
|
4879
4902
|
class: "ud-input ud-textarea",
|
|
4880
|
-
onKeyup:
|
|
4903
|
+
onKeyup: He(jt(u, ["prevent"]), ["enter"])
|
|
4881
4904
|
}, null, 40, xr), [
|
|
4882
4905
|
[N, s.value]
|
|
4883
4906
|
]),
|
|
@@ -4902,15 +4925,15 @@ const Zo = {
|
|
|
4902
4925
|
b("button", {
|
|
4903
4926
|
class: "ud-btn edit-json-btn",
|
|
4904
4927
|
title: "编辑对象",
|
|
4905
|
-
onClick: (
|
|
4928
|
+
onClick: (S) => m(w.key)
|
|
4906
4929
|
}, " ✎ ", 8, Pr)
|
|
4907
4930
|
], 64)) : (T(), R(ve, { key: 1 }, [
|
|
4908
4931
|
o.value ? (T(), R("div", Tr, " ⚠ " + ie(o.value), 1)) : X("", !0),
|
|
4909
4932
|
E(b("textarea", {
|
|
4910
|
-
"onUpdate:modelValue": y[2] || (y[2] = (
|
|
4933
|
+
"onUpdate:modelValue": y[2] || (y[2] = (S) => i.value = S),
|
|
4911
4934
|
class: se(["ud-json-textarea", { "has-error": o.value }]),
|
|
4912
4935
|
rows: "3",
|
|
4913
|
-
onInput:
|
|
4936
|
+
onInput: p
|
|
4914
4937
|
}, null, 34), [
|
|
4915
4938
|
[N, i.value]
|
|
4916
4939
|
]),
|
|
@@ -4918,7 +4941,7 @@ const Zo = {
|
|
|
4918
4941
|
b("button", {
|
|
4919
4942
|
class: "ud-btn apply-btn",
|
|
4920
4943
|
title: "应用修改",
|
|
4921
|
-
onClick: (
|
|
4944
|
+
onClick: (S) => f(w.key)
|
|
4922
4945
|
}, " ✓ ", 8, Er),
|
|
4923
4946
|
b("button", {
|
|
4924
4947
|
class: "ud-btn cancel-btn",
|
|
@@ -4931,11 +4954,11 @@ const Zo = {
|
|
|
4931
4954
|
key: 2,
|
|
4932
4955
|
class: "ud-btn del-btn",
|
|
4933
4956
|
title: "删除",
|
|
4934
|
-
onClick: (
|
|
4957
|
+
onClick: (S) => h(w.key)
|
|
4935
4958
|
}, " ✕ ", 8, Rr)) : X("", !0)
|
|
4936
4959
|
], 64)) : X("", !0)
|
|
4937
4960
|
], 2))), 128))
|
|
4938
|
-
])) : (T(), R("div",
|
|
4961
|
+
])) : (T(), R("div", Sr, "暂无自定义数据")),
|
|
4939
4962
|
b("button", {
|
|
4940
4963
|
class: "get-camera-btn",
|
|
4941
4964
|
onClick: x
|
|
@@ -4943,7 +4966,7 @@ const Zo = {
|
|
|
4943
4966
|
])
|
|
4944
4967
|
]));
|
|
4945
4968
|
}
|
|
4946
|
-
}), Lr = /* @__PURE__ */ Ie(
|
|
4969
|
+
}), Lr = /* @__PURE__ */ Ie(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-section" }, Xr = { class: "dp-list" }, Br = ["onUpdate:modelValue"], Ur = ["onUpdate:modelValue"], Vr = ["onUpdate:modelValue"], Yr = ["onUpdate:modelValue"], Kr = ["onClick"], Zr = { class: "dp-add-row" }, Qr = /* @__PURE__ */ be({
|
|
4947
4970
|
__name: "DataPanelTab",
|
|
4948
4971
|
props: {
|
|
4949
4972
|
selectedObject: {}
|
|
@@ -4952,20 +4975,20 @@ const Zo = {
|
|
|
4952
4975
|
const e = r, t = j(""), s = j([]), n = j(!0), i = j(""), o = j(""), a = j(""), l = j("");
|
|
4953
4976
|
let c = u(), A = !1;
|
|
4954
4977
|
function u() {
|
|
4955
|
-
const
|
|
4956
|
-
return
|
|
4978
|
+
const p = e.selectedObject;
|
|
4979
|
+
return p ? Zt(xt(p)) : null;
|
|
4957
4980
|
}
|
|
4958
|
-
Me(n, (
|
|
4959
|
-
A || !c || (c.visible =
|
|
4981
|
+
Me(n, (p) => {
|
|
4982
|
+
A || !c || (c.visible = p);
|
|
4960
4983
|
});
|
|
4961
4984
|
function h() {
|
|
4962
4985
|
A || !c || (c.setTitle(t.value), c.setItems([...s.value]));
|
|
4963
4986
|
}
|
|
4964
4987
|
Me(t, () => h()), Me(s, () => h(), { deep: !0 });
|
|
4965
|
-
function d(
|
|
4966
|
-
s.value = s.value.filter((f, g) => g !==
|
|
4988
|
+
function d(p) {
|
|
4989
|
+
s.value = s.value.filter((f, g) => g !== p), h();
|
|
4967
4990
|
}
|
|
4968
|
-
function
|
|
4991
|
+
function m() {
|
|
4969
4992
|
!i.value.trim() || !o.value.trim() || (s.value = [
|
|
4970
4993
|
...s.value,
|
|
4971
4994
|
{
|
|
@@ -4984,7 +5007,7 @@ const Zo = {
|
|
|
4984
5007
|
}, 0);
|
|
4985
5008
|
},
|
|
4986
5009
|
{ immediate: !0 }
|
|
4987
|
-
), (
|
|
5010
|
+
), (p, f) => (T(), R("div", Nr, [
|
|
4988
5011
|
b("div", jr, [
|
|
4989
5012
|
f[10] || (f[10] = b("label", null, "📊 数据面板", -1)),
|
|
4990
5013
|
b("div", kr, [
|
|
@@ -5065,7 +5088,7 @@ const Zo = {
|
|
|
5065
5088
|
class: "dp-input dp-input-sm",
|
|
5066
5089
|
"onUpdate:modelValue": f[2] || (f[2] = (g) => i.value = g),
|
|
5067
5090
|
placeholder: "标签",
|
|
5068
|
-
onKeyup:
|
|
5091
|
+
onKeyup: He(m, ["enter"])
|
|
5069
5092
|
}, null, 544), [
|
|
5070
5093
|
[N, i.value]
|
|
5071
5094
|
]),
|
|
@@ -5074,7 +5097,7 @@ const Zo = {
|
|
|
5074
5097
|
class: "dp-input dp-input-sm",
|
|
5075
5098
|
"onUpdate:modelValue": f[3] || (f[3] = (g) => o.value = g),
|
|
5076
5099
|
placeholder: "值",
|
|
5077
|
-
onKeyup:
|
|
5100
|
+
onKeyup: He(m, ["enter"])
|
|
5078
5101
|
}, null, 544), [
|
|
5079
5102
|
[N, o.value]
|
|
5080
5103
|
]),
|
|
@@ -5083,7 +5106,7 @@ const Zo = {
|
|
|
5083
5106
|
class: "dp-input dp-input-xs",
|
|
5084
5107
|
"onUpdate:modelValue": f[4] || (f[4] = (g) => a.value = g),
|
|
5085
5108
|
placeholder: "单位",
|
|
5086
|
-
onKeyup:
|
|
5109
|
+
onKeyup: He(m, ["enter"])
|
|
5087
5110
|
}, null, 544), [
|
|
5088
5111
|
[N, a.value]
|
|
5089
5112
|
]),
|
|
@@ -5092,13 +5115,13 @@ const Zo = {
|
|
|
5092
5115
|
class: "dp-input dp-input-xs",
|
|
5093
5116
|
"onUpdate:modelValue": f[5] || (f[5] = (g) => l.value = g),
|
|
5094
5117
|
placeholder: "编码",
|
|
5095
|
-
onKeyup:
|
|
5118
|
+
onKeyup: He(m, ["enter"])
|
|
5096
5119
|
}, null, 544), [
|
|
5097
5120
|
[N, l.value]
|
|
5098
5121
|
]),
|
|
5099
5122
|
b("button", {
|
|
5100
5123
|
class: "dp-btn dp-btn-add",
|
|
5101
|
-
onClick:
|
|
5124
|
+
onClick: m,
|
|
5102
5125
|
title: "添加"
|
|
5103
5126
|
}, "+")
|
|
5104
5127
|
])
|
|
@@ -5152,65 +5175,65 @@ const $r = {
|
|
|
5152
5175
|
emits: ["propertyChange", "treeSelect", "treeDelete", "transformModeChange"],
|
|
5153
5176
|
setup(r, { emit: e }) {
|
|
5154
5177
|
const t = r, s = e, n = j("translate");
|
|
5155
|
-
function i(
|
|
5156
|
-
n.value =
|
|
5178
|
+
function i(m) {
|
|
5179
|
+
n.value = m, s("transformModeChange", m);
|
|
5157
5180
|
}
|
|
5158
5181
|
const o = () => s("propertyChange"), a = j("transform"), l = Be(() => {
|
|
5159
|
-
var
|
|
5160
|
-
return !!(t.selectedObject && ((
|
|
5182
|
+
var m;
|
|
5183
|
+
return !!(t.selectedObject && ((m = t.selectedObject.userData) != null && m._hasDataPanel));
|
|
5161
5184
|
}), c = j(0), A = os(t, "selectedObject"), { expandedSet: u, toggleExpand: h } = _r(A);
|
|
5162
5185
|
rs("treeExpand", { expandedSet: u, toggleExpand: h });
|
|
5163
|
-
const d = (
|
|
5164
|
-
c.value++, s("treeDelete",
|
|
5186
|
+
const d = (m) => {
|
|
5187
|
+
c.value++, s("treeDelete", m);
|
|
5165
5188
|
};
|
|
5166
|
-
return (
|
|
5189
|
+
return (m, p) => r.transform ? (T(), R("div", $r, [
|
|
5167
5190
|
b("div", ea, [
|
|
5168
|
-
|
|
5191
|
+
p[7] || (p[7] = b("label", null, "场景物体", -1)),
|
|
5169
5192
|
b("div", ta, [
|
|
5170
5193
|
(T(!0), R(ve, null, wt(r.treeData, (f) => (T(), Ke(er, {
|
|
5171
5194
|
key: f.uuid,
|
|
5172
5195
|
node: f,
|
|
5173
5196
|
"selected-object": r.selectedObject,
|
|
5174
5197
|
version: c.value,
|
|
5175
|
-
onSelect:
|
|
5198
|
+
onSelect: p[0] || (p[0] = (g) => s("treeSelect", g)),
|
|
5176
5199
|
onDelete: d
|
|
5177
5200
|
}, null, 8, ["node", "selected-object", "version"]))), 128)),
|
|
5178
5201
|
r.treeData.length === 0 ? (T(), R("div", na, "暂无物体")) : X("", !0)
|
|
5179
5202
|
])
|
|
5180
5203
|
]),
|
|
5181
5204
|
b("div", sa, [
|
|
5182
|
-
|
|
5205
|
+
p[8] || (p[8] = b("label", null, "全局属性", -1)),
|
|
5183
5206
|
b("div", ia, [
|
|
5184
5207
|
b("button", {
|
|
5185
5208
|
class: se(["mode-btn", { active: n.value === "translate" }]),
|
|
5186
5209
|
title: "移动 (W)",
|
|
5187
|
-
onClick:
|
|
5210
|
+
onClick: p[1] || (p[1] = (f) => i("translate"))
|
|
5188
5211
|
}, " ↕ 移动 ", 2),
|
|
5189
5212
|
b("button", {
|
|
5190
5213
|
class: se(["mode-btn", { active: n.value === "rotate" }]),
|
|
5191
5214
|
title: "旋转 (E)",
|
|
5192
|
-
onClick:
|
|
5215
|
+
onClick: p[2] || (p[2] = (f) => i("rotate"))
|
|
5193
5216
|
}, " ↻ 旋转 ", 2),
|
|
5194
5217
|
b("button", {
|
|
5195
5218
|
class: se(["mode-btn", { active: n.value === "scale" }]),
|
|
5196
5219
|
title: "缩放 (R)",
|
|
5197
|
-
onClick:
|
|
5220
|
+
onClick: p[3] || (p[3] = (f) => i("scale"))
|
|
5198
5221
|
}, " ⤡ 缩放 ", 2)
|
|
5199
5222
|
])
|
|
5200
5223
|
]),
|
|
5201
5224
|
r.selectedObject ? (T(), R("div", oa, [
|
|
5202
5225
|
b("button", {
|
|
5203
5226
|
class: se(["tab-btn", { active: a.value === "transform" }]),
|
|
5204
|
-
onClick:
|
|
5227
|
+
onClick: p[4] || (p[4] = (f) => a.value = "transform")
|
|
5205
5228
|
}, " 🔄 变换 ", 2),
|
|
5206
5229
|
b("button", {
|
|
5207
5230
|
class: se(["tab-btn", { active: a.value === "userdata" }]),
|
|
5208
|
-
onClick:
|
|
5231
|
+
onClick: p[5] || (p[5] = (f) => a.value = "userdata")
|
|
5209
5232
|
}, " 📋 自定义数据 ", 2),
|
|
5210
5233
|
l.value ? (T(), R("button", {
|
|
5211
5234
|
key: 0,
|
|
5212
5235
|
class: se(["tab-btn", { active: a.value === "datapanel" }]),
|
|
5213
|
-
onClick:
|
|
5236
|
+
onClick: p[6] || (p[6] = (f) => a.value = "datapanel")
|
|
5214
5237
|
}, " 📊 数据面板 ", 2)) : X("", !0)
|
|
5215
5238
|
])) : X("", !0),
|
|
5216
5239
|
r.selectedObject ? (T(), R("div", ra, [
|
|
@@ -5228,7 +5251,7 @@ const $r = {
|
|
|
5228
5251
|
[De, a.value === "datapanel"]
|
|
5229
5252
|
])
|
|
5230
5253
|
])) : X("", !0)
|
|
5231
|
-
])) : (T(), R("div", aa, [...
|
|
5254
|
+
])) : (T(), R("div", aa, [...p[9] || (p[9] = [
|
|
5232
5255
|
b("p", null, "未选中任何模型", -1)
|
|
5233
5256
|
])]));
|
|
5234
5257
|
}
|
|
@@ -5237,19 +5260,19 @@ const $r = {
|
|
|
5237
5260
|
emits: ["addModel", "importModel"],
|
|
5238
5261
|
setup(r, { emit: e }) {
|
|
5239
5262
|
const t = j(!1), s = j(!1), n = j(!1), i = j(!1), o = e, a = j(null), l = () => {
|
|
5240
|
-
var
|
|
5241
|
-
return (
|
|
5242
|
-
}, c = (
|
|
5243
|
-
const f =
|
|
5263
|
+
var p;
|
|
5264
|
+
return (p = a.value) == null ? void 0 : p.click();
|
|
5265
|
+
}, c = (p) => {
|
|
5266
|
+
const f = p.target;
|
|
5244
5267
|
f.files && f.files.length > 0 && (o("importModel", f.files[0]), f.value = "");
|
|
5245
5268
|
}, A = () => console.log("撤销"), u = () => console.log("删除物体"), h = async () => {
|
|
5246
|
-
const
|
|
5247
|
-
console.log(JSON.parse(await
|
|
5269
|
+
const p = Ki();
|
|
5270
|
+
console.log(JSON.parse(await p));
|
|
5248
5271
|
}, d = () => {
|
|
5249
5272
|
if (!localStorage.getItem("test_id")) return localStorage.setItem("test_id", "123");
|
|
5250
5273
|
Ei(localStorage.getItem("test_id"));
|
|
5251
|
-
},
|
|
5252
|
-
return (
|
|
5274
|
+
}, m = () => qn();
|
|
5275
|
+
return (p, f) => (T(), R("div", ua, [
|
|
5253
5276
|
b("div", Aa, [
|
|
5254
5277
|
b("div", {
|
|
5255
5278
|
class: "dropdown-wrapper",
|
|
@@ -5333,7 +5356,7 @@ const $r = {
|
|
|
5333
5356
|
}, "镜头拉近"),
|
|
5334
5357
|
b("div", {
|
|
5335
5358
|
class: "menu-item",
|
|
5336
|
-
onClick:
|
|
5359
|
+
onClick: m
|
|
5337
5360
|
}, " 重置相机位置 ")
|
|
5338
5361
|
], 512), [
|
|
5339
5362
|
[De, t.value]
|
|
@@ -5419,13 +5442,13 @@ const $r = {
|
|
|
5419
5442
|
const u = () => {
|
|
5420
5443
|
const g = Ui();
|
|
5421
5444
|
g && (A.value = g);
|
|
5422
|
-
}, h = (g) => Qt(g), d = (g) => Wi(g.uuid),
|
|
5445
|
+
}, h = (g) => Qt(g), d = (g) => Wi(g.uuid), m = (g) => {
|
|
5423
5446
|
Oi(g);
|
|
5424
|
-
},
|
|
5425
|
-
|
|
5447
|
+
}, p = j(null), f = () => {
|
|
5448
|
+
p.value && Ii(p.value, e.mode, e.sceneData), u();
|
|
5426
5449
|
};
|
|
5427
5450
|
return as(() => {
|
|
5428
|
-
f(),
|
|
5451
|
+
f(), p.value && fi(p.value);
|
|
5429
5452
|
}), ls(() => {
|
|
5430
5453
|
console.log("endset_three_editor destroy"), Qi();
|
|
5431
5454
|
}), (g, x) => (T(), R("div", Ca, [
|
|
@@ -5444,7 +5467,7 @@ const $r = {
|
|
|
5444
5467
|
b("div", {
|
|
5445
5468
|
class: se(`canvas canvas-mode-${r.mode}`),
|
|
5446
5469
|
ref_key: "containerRef",
|
|
5447
|
-
ref:
|
|
5470
|
+
ref: p
|
|
5448
5471
|
}, null, 2),
|
|
5449
5472
|
r.mode === "edit" ? (T(), Ke(ca, {
|
|
5450
5473
|
key: 0,
|
|
@@ -5454,17 +5477,17 @@ const $r = {
|
|
|
5454
5477
|
onPropertyChange: a,
|
|
5455
5478
|
onTreeSelect: h,
|
|
5456
5479
|
onTreeDelete: d,
|
|
5457
|
-
onTransformModeChange:
|
|
5480
|
+
onTransformModeChange: m
|
|
5458
5481
|
}, null, 8, ["transform", "tree-data", "selected-object"])) : X("", !0)
|
|
5459
5482
|
], 2),
|
|
5460
5483
|
r.mode === "edit" ? (T(), Ke(ya, { key: 2 })) : X("", !0)
|
|
5461
5484
|
]));
|
|
5462
5485
|
}
|
|
5463
|
-
}),
|
|
5486
|
+
}), Sa = /* @__PURE__ */ Ie(wa, [["__scopeId", "data-v-ffa5f5c1"]]);
|
|
5464
5487
|
export {
|
|
5465
5488
|
ya as BottomBar,
|
|
5466
5489
|
Gn as DataPanel,
|
|
5467
|
-
|
|
5490
|
+
Sa as DrawingBoard,
|
|
5468
5491
|
ca as PropertyPanel,
|
|
5469
5492
|
ga as TopBar,
|
|
5470
5493
|
er as TreeItem,
|
|
@@ -5479,7 +5502,7 @@ export {
|
|
|
5479
5502
|
Qi as destroyEditor,
|
|
5480
5503
|
gi as disposeCSS2DRenderer,
|
|
5481
5504
|
Ki as exportSceneToJSON,
|
|
5482
|
-
|
|
5505
|
+
Hi as focusOnObject,
|
|
5483
5506
|
Ta as getCSS2DRenderer,
|
|
5484
5507
|
Yi as getCamera,
|
|
5485
5508
|
Zt as getDataPanel,
|