endset_three_editor 0.4.1 → 0.4.2
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 Se, 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
|
|
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 Hn, 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 Sn, 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 Hs, OrthographicCamera as Ss, 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
|
|
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, S = {
|
|
9
9
|
NONE: -1,
|
|
10
10
|
ROTATE: 0,
|
|
11
11
|
DOLLY: 1,
|
|
@@ -15,7 +15,7 @@ const an = { type: "change" }, Kt = { type: "start" }, Gn = { type: "end" }, ct
|
|
|
15
15
|
TOUCH_DOLLY_PAN: 5,
|
|
16
16
|
TOUCH_DOLLY_ROTATE: 6
|
|
17
17
|
}, Pt = 1e-6;
|
|
18
|
-
class Xs extends
|
|
18
|
+
class Xs extends On {
|
|
19
19
|
/**
|
|
20
20
|
* Constructs a new controls instance.
|
|
21
21
|
*
|
|
@@ -23,7 +23,7 @@ class Xs extends En {
|
|
|
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 = S.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 En {
|
|
|
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(
|
|
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 = S.NONE;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Programmatically pan the camera.
|
|
@@ -141,7 +141,7 @@ class Xs extends En {
|
|
|
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 === S.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;
|
|
@@ -167,12 +167,12 @@ class Xs extends En {
|
|
|
167
167
|
c.unproject(this.object), this.object.position.sub(c).add(a), this.object.updateMatrixWorld(), o = G.length();
|
|
168
168
|
} else
|
|
169
169
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
170
|
-
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (ct.origin.copy(this.object.position), ct.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ct.direction)) < qs ? this.object.lookAt(this.target) : (
|
|
170
|
+
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (ct.origin.copy(this.object.position), ct.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ct.direction)) < qs ? this.object.lookAt(this.target) : (an.setFromNormalAndCoplanarPoint(this.object.up, this.target), ct.intersectPlane(an, this.target))));
|
|
171
171
|
} else if (this.object.isOrthographicCamera) {
|
|
172
172
|
const o = this.object.zoom;
|
|
173
173
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), o !== this.object.zoom && (this.object.updateProjectionMatrix(), i = !0);
|
|
174
174
|
}
|
|
175
|
-
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > Pt || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Pt || this._lastTargetPosition.distanceToSquared(this.target) > Pt ? (this.dispatchEvent(
|
|
175
|
+
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > Pt || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Pt || this._lastTargetPosition.distanceToSquared(this.target) > Pt ? (this.dispatchEvent(rn), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
176
176
|
}
|
|
177
177
|
_getAutoRotationAngle(e) {
|
|
178
178
|
return e !== null ? V / 60 * this.autoRotateSpeed * e : V / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -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(
|
|
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 = S.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 = S.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 = S.PAN;
|
|
408
408
|
} else {
|
|
409
409
|
if (this.enableRotate === !1) return;
|
|
410
|
-
this._handleMouseDownRotate(r), this.state =
|
|
410
|
+
this._handleMouseDownRotate(r), this.state = S.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 = S.ROTATE;
|
|
417
417
|
} else {
|
|
418
418
|
if (this.enablePan === !1) return;
|
|
419
|
-
this._handleMouseDownPan(r), this.state =
|
|
419
|
+
this._handleMouseDownPan(r), this.state = S.PAN;
|
|
420
420
|
}
|
|
421
421
|
break;
|
|
422
422
|
default:
|
|
423
|
-
this.state =
|
|
423
|
+
this.state = S.NONE;
|
|
424
424
|
}
|
|
425
|
-
this.state !==
|
|
425
|
+
this.state !== S.NONE && this.dispatchEvent(Kt);
|
|
426
426
|
}
|
|
427
427
|
function Ks(r) {
|
|
428
428
|
switch (this.state) {
|
|
429
|
-
case
|
|
429
|
+
case S.ROTATE:
|
|
430
430
|
if (this.enableRotate === !1) return;
|
|
431
431
|
this._handleMouseMoveRotate(r);
|
|
432
432
|
break;
|
|
433
|
-
case
|
|
433
|
+
case S.DOLLY:
|
|
434
434
|
if (this.enableZoom === !1) return;
|
|
435
435
|
this._handleMouseMoveDolly(r);
|
|
436
436
|
break;
|
|
437
|
-
case
|
|
437
|
+
case S.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 !== S.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 = S.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 = S.TOUCH_PAN;
|
|
460
460
|
break;
|
|
461
461
|
default:
|
|
462
|
-
this.state =
|
|
462
|
+
this.state = S.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 = S.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 = S.TOUCH_DOLLY_ROTATE;
|
|
474
474
|
break;
|
|
475
475
|
default:
|
|
476
|
-
this.state =
|
|
476
|
+
this.state = S.NONE;
|
|
477
477
|
}
|
|
478
478
|
break;
|
|
479
479
|
default:
|
|
480
|
-
this.state =
|
|
480
|
+
this.state = S.NONE;
|
|
481
481
|
}
|
|
482
|
-
this.state !==
|
|
482
|
+
this.state !== S.NONE && this.dispatchEvent(Kt);
|
|
483
483
|
}
|
|
484
484
|
function _s(r) {
|
|
485
485
|
switch (this._trackPointer(r), this.state) {
|
|
486
|
-
case
|
|
486
|
+
case S.TOUCH_ROTATE:
|
|
487
487
|
if (this.enableRotate === !1) return;
|
|
488
488
|
this._handleTouchMoveRotate(r), this.update();
|
|
489
489
|
break;
|
|
490
|
-
case
|
|
490
|
+
case S.TOUCH_PAN:
|
|
491
491
|
if (this.enablePan === !1) return;
|
|
492
492
|
this._handleTouchMovePan(r), this.update();
|
|
493
493
|
break;
|
|
494
|
-
case
|
|
494
|
+
case S.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 S.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 = S.NONE;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
function $s(r) {
|
|
@@ -512,12 +512,12 @@ 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 Ce = new As(), F = new M(), he = new M(), k = new K(),
|
|
515
|
+
const Ce = new As(), F = new M(), he = 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" },
|
|
520
|
-
class ni extends
|
|
519
|
+
}, Tt = { type: "change" }, cn = { type: "mouseDown", mode: null }, un = { type: "mouseUp", mode: null }, An = { type: "objectChange" };
|
|
520
|
+
class ni extends On {
|
|
521
521
|
/**
|
|
522
522
|
* Constructs a new controls instance.
|
|
523
523
|
*
|
|
@@ -545,8 +545,8 @@ class ni extends En {
|
|
|
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(), p = new M(), m = 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", p), a("pointEnd", m), 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";
|
|
@@ -573,7 +573,7 @@ class ni extends En {
|
|
|
573
573
|
if (!(this.object === void 0 || this.dragging === !0 || e != null && e.button !== 0) && this.axis !== null) {
|
|
574
574
|
e !== null && Ce.setFromCamera(e, this.camera);
|
|
575
575
|
const t = Ot(this._plane, Ce, !0);
|
|
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,
|
|
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
|
}
|
|
579
579
|
pointerMove(e) {
|
|
@@ -596,13 +596,13 @@ class ni extends En {
|
|
|
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
|
-
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(
|
|
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(An);
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
pointerUp(e) {
|
|
605
|
-
e !== null && e.button !== 0 || (this.dragging && this.axis !== null && (
|
|
605
|
+
e !== null && e.button !== 0 || (this.dragging && this.axis !== null && (un.mode = this.mode, this.dispatchEvent(un)), this.dragging = !1, this.axis = null);
|
|
606
606
|
}
|
|
607
607
|
dispose() {
|
|
608
608
|
this.disconnect(), this._root.dispose();
|
|
@@ -628,7 +628,7 @@ class ni extends En {
|
|
|
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(An), 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
|
|
@@ -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(), L = new M(0, 1, 0),
|
|
752
|
+
const ut = new hs(), L = new M(0, 1, 0), dn = new M(0, 0, 0), hn = new me(), At = new K(), mt = new K(), oe = new M(), fn = new me(), Ve = new M(1, 0, 0), we = new M(0, 1, 0), Ye = new M(0, 0, 1), dt = 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;
|
|
@@ -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 p = e.clone();
|
|
806
|
+
p.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 m = new U(0, 0.04, 0.1, 12);
|
|
817
|
+
m.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(m, i), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
835
|
+
[new v(m, 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(m, o), [0, 0.5, 0]],
|
|
840
|
+
[new v(m, 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(m, a), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
845
|
+
[new v(m, 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
|
+
}, H = {
|
|
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), p), null, [0, Math.PI / 2, 0]]
|
|
907
907
|
],
|
|
908
908
|
X: [
|
|
909
909
|
[new v(C(0.5, 0.5), i)]
|
|
@@ -1007,12 +1007,12 @@ class ci extends ke {
|
|
|
1007
1007
|
for (let Ee = $[ne].length; Ee--; ) {
|
|
1008
1008
|
const B = $[ne][Ee][0].clone(), ot = $[ne][Ee][1], rt = $[ne][Ee][2], at = $[ne][Ee][3], Jn = $[ne][Ee][4];
|
|
1009
1009
|
B.name = ne, 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
|
-
const
|
|
1011
|
-
|
|
1010
|
+
const _t = B.geometry.clone();
|
|
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(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(H)), 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(L.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(L.copy(we).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(L.copy(Ye).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "XYZE" && (k.setFromEuler(ut.set(0, Math.PI / 2, 0)), L.copy(this.rotationAxis), o.quaternion.setFromRotationMatrix(
|
|
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(L.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(L.copy(we).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(L.copy(Ye).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "XYZE" && (k.setFromEuler(ut.set(0, Math.PI / 2, 0)), L.copy(this.rotationAxis), o.quaternion.setFromRotationMatrix(hn.lookAt(dn, L, we)), 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(L.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(L.copy(we).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Z" && Math.abs(L.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(L.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(L.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(L.copy(we).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1)) : this.mode === "rotate" && (At.copy(s), L.copy(this.eye).applyQuaternion(k.copy(s).invert()), o.name.search("E") !== -1 && o.quaternion.setFromRotationMatrix(
|
|
1031
|
+
o.quaternion.copy(s), this.mode === "translate" || this.mode === "scale" ? (o.name === "X" && Math.abs(L.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(L.copy(we).applyQuaternion(s).dot(this.eye)) > 0.99 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1), o.name === "Z" && Math.abs(L.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(L.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(L.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(L.copy(we).applyQuaternion(s).dot(this.eye)) < 0.2 && (o.scale.set(1e-10, 1e-10, 1e-10), o.visible = !1)) : this.mode === "rotate" && (At.copy(s), L.copy(this.eye).applyQuaternion(k.copy(s).invert()), o.name.search("E") !== -1 && o.quaternion.setFromRotationMatrix(hn.lookAt(this.eye, dn, we)), o.name === "X" && (k.setFromAxisAngle(Ve, Math.atan2(-L.y, L.z)), k.multiplyQuaternions(At, k), o.quaternion.copy(k)), o.name === "Y" && (k.setFromAxisAngle(we, Math.atan2(L.x, L.z)), k.multiplyQuaternions(At, k), o.quaternion.copy(k)), o.name === "Z" && (k.setFromAxisAngle(Ye, Math.atan2(L.y, L.x)), k.multiplyQuaternions(At, 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
|
}
|
|
@@ -1039,7 +1039,7 @@ class ui extends v {
|
|
|
1039
1039
|
constructor() {
|
|
1040
1040
|
super(
|
|
1041
1041
|
new fs(1e5, 1e5, 2, 2),
|
|
1042
|
-
new Pe({ visible: !1, wireframe: !0, side:
|
|
1042
|
+
new Pe({ visible: !1, wireframe: !0, side: Rn, transparent: !0, opacity: 0.1, toneMapped: !1 })
|
|
1043
1043
|
), this.isTransformControlsPlane = !0, this.type = "TransformControlsPlane";
|
|
1044
1044
|
}
|
|
1045
1045
|
updateMatrixWorld(e) {
|
|
@@ -1076,7 +1076,7 @@ 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) : (
|
|
1079
|
+
oe.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (fn.lookAt(F.set(0, 0, 0), oe, L), this.quaternion.setFromRotationMatrix(fn)), super.updateMatrixWorld(e);
|
|
1080
1080
|
}
|
|
1081
1081
|
}
|
|
1082
1082
|
class Ai extends ke {
|
|
@@ -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 He = 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,55 +1114,55 @@ 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(p, m) {
|
|
1118
|
+
p.matrixWorldAutoUpdate === !0 && p.updateMatrixWorld(), m.parent === null && m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(), pn.copy(m.matrixWorldInverse), mn.multiplyMatrices(m.projectionMatrix, pn), A(p, p, m), this.sortObjects && d(p);
|
|
1119
|
+
}, this.setSize = function(p, m) {
|
|
1120
|
+
s = p, n = m, i = s / 2, o = n / 2, l.style.width = p + "px", l.style.height = m + "px";
|
|
1121
1121
|
};
|
|
1122
|
-
function c(
|
|
1123
|
-
|
|
1124
|
-
for (let
|
|
1125
|
-
c(
|
|
1122
|
+
function c(p) {
|
|
1123
|
+
p.isCSS2DObject && (p.element.style.display = "none");
|
|
1124
|
+
for (let m = 0, f = p.children.length; m < f; m++)
|
|
1125
|
+
c(p.children[m]);
|
|
1126
1126
|
}
|
|
1127
|
-
function A(
|
|
1128
|
-
if (
|
|
1129
|
-
c(
|
|
1127
|
+
function A(p, m, f) {
|
|
1128
|
+
if (p.visible === !1) {
|
|
1129
|
+
c(p);
|
|
1130
1130
|
return;
|
|
1131
1131
|
}
|
|
1132
|
-
if (
|
|
1133
|
-
|
|
1134
|
-
const g =
|
|
1135
|
-
x.style.display = g === !0 ? "" : "none", g === !0 && (
|
|
1132
|
+
if (p.isCSS2DObject) {
|
|
1133
|
+
He.setFromMatrixPosition(p.matrixWorld), He.applyMatrix4(mn);
|
|
1134
|
+
const g = He.z >= -1 && He.z <= 1 && p.layers.test(f.layers) === !0, x = p.element;
|
|
1135
|
+
x.style.display = g === !0 ? "" : "none", g === !0 && (p.onBeforeRender(t, m, f), x.style.transform = "translate(" + -100 * p.center.x + "%," + -100 * p.center.y + "%)translate(" + (He.x * i + i) + "px," + (-He.y * o + o) + "px)", x.parentNode !== l && l.appendChild(x), p.onAfterRender(t, m, f));
|
|
1136
1136
|
const C = {
|
|
1137
|
-
distanceToCameraSquared: u(f,
|
|
1137
|
+
distanceToCameraSquared: u(f, p)
|
|
1138
1138
|
};
|
|
1139
|
-
a.objects.set(
|
|
1139
|
+
a.objects.set(p, C);
|
|
1140
1140
|
}
|
|
1141
|
-
for (let g = 0, x =
|
|
1142
|
-
A(
|
|
1141
|
+
for (let g = 0, x = p.children.length; g < x; g++)
|
|
1142
|
+
A(p.children[g], m, f);
|
|
1143
1143
|
}
|
|
1144
|
-
function u(
|
|
1145
|
-
return
|
|
1144
|
+
function u(p, m) {
|
|
1145
|
+
return gn.setFromMatrixPosition(p.matrixWorld), bn.setFromMatrixPosition(m.matrixWorld), gn.distanceToSquared(bn);
|
|
1146
1146
|
}
|
|
1147
|
-
function h(
|
|
1148
|
-
const
|
|
1149
|
-
return
|
|
1150
|
-
f.isCSS2DObject &&
|
|
1151
|
-
}),
|
|
1147
|
+
function h(p) {
|
|
1148
|
+
const m = [];
|
|
1149
|
+
return p.traverseVisible(function(f) {
|
|
1150
|
+
f.isCSS2DObject && m.push(f);
|
|
1151
|
+
}), m;
|
|
1152
1152
|
}
|
|
1153
|
-
function d(
|
|
1154
|
-
const
|
|
1153
|
+
function d(p) {
|
|
1154
|
+
const m = h(p).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 = m.length;
|
|
1160
|
+
for (let g = 0, x = m.length; g < x; g++)
|
|
1161
|
+
m[g].element.style.zIndex = f - g;
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
|
-
class
|
|
1165
|
+
class Gn {
|
|
1166
1166
|
constructor(e = {}) {
|
|
1167
1167
|
/** CSS2DObject 实例 */
|
|
1168
1168
|
Re(this, "css2dObject", null);
|
|
@@ -1377,7 +1377,7 @@ class Fn {
|
|
|
1377
1377
|
}
|
|
1378
1378
|
}
|
|
1379
1379
|
const yt = /* @__PURE__ */ new WeakMap();
|
|
1380
|
-
function
|
|
1380
|
+
function Fn(r, e) {
|
|
1381
1381
|
const t = xt(r);
|
|
1382
1382
|
yt.set(t, e), t.userData._hasDataPanel = !0;
|
|
1383
1383
|
}
|
|
@@ -1434,7 +1434,7 @@ let Te = null, Bt = null, bt = null, ge = [];
|
|
|
1434
1434
|
const st = /* @__PURE__ */ new Map();
|
|
1435
1435
|
let Ct, It = null, $e = null, et = null;
|
|
1436
1436
|
function Ii(r, e = "edit", t) {
|
|
1437
|
-
I.container = r, I.mode = e, yi(), Ci(), wi(), t && (Zi(t.scene, e, t.dataPanels), t != null && t.camera && (I.defaultMainCamera = t.camera,
|
|
1437
|
+
I.container = r, I.mode = e, yi(), Ci(), wi(), t && (Zi(t.scene, e, t.dataPanels), t != null && t.camera && (I.defaultMainCamera = t.camera, qn(!0))), Mi(), vi(), Ct && I.orbitControls && (I.orbitControls.target.fromArray(Ct), I.orbitControls.update()), Fi(), Xn(), $e = (s) => Ri(s), et = () => Pi(), e === "edit" && r.addEventListener("click", $e), window.addEventListener("resize", et), t || Di(), e === "edit" && xi();
|
|
1438
1438
|
}
|
|
1439
1439
|
function yi() {
|
|
1440
1440
|
const r = new P.WebGLRenderer({ antialias: !0, alpha: !0 });
|
|
@@ -1456,7 +1456,7 @@ function wi() {
|
|
|
1456
1456
|
const r = I.container, e = r.clientWidth / r.clientHeight, t = new P.PerspectiveCamera(45, e, 0.1, 1e3);
|
|
1457
1457
|
t.position.set(0, 6, 15), t.lookAt(0, 0, 0), I.camera = t;
|
|
1458
1458
|
}
|
|
1459
|
-
function
|
|
1459
|
+
function qn(r = !1) {
|
|
1460
1460
|
if (!I.defaultMainCamera) return;
|
|
1461
1461
|
const e = I.defaultMainCamera;
|
|
1462
1462
|
if (r) {
|
|
@@ -1533,9 +1533,9 @@ function Di() {
|
|
|
1533
1533
|
const r = new P.AmbientLight(16777215, 1);
|
|
1534
1534
|
I.scene.add(r);
|
|
1535
1535
|
}
|
|
1536
|
-
function
|
|
1536
|
+
function Xn() {
|
|
1537
1537
|
var r, e;
|
|
1538
|
-
It = requestAnimationFrame(
|
|
1538
|
+
It = requestAnimationFrame(Xn), nt.update(), (r = I.orbitControls) == null || r.update(), (e = I.renderer) == null || e.render(I.scene, I.camera), I.scene && I.camera && pi(I.scene, I.camera), I.scene && I.scene.traverse((t) => {
|
|
1539
1539
|
if (t.userData.isWater && t.type === "Mesh") {
|
|
1540
1540
|
const s = t, n = s.material;
|
|
1541
1541
|
if (n.normalMap) {
|
|
@@ -1551,7 +1551,7 @@ function Pi() {
|
|
|
1551
1551
|
r === 0 || e === 0 || (I.camera.aspect = r / e, I.camera.updateProjectionMatrix(), I.renderer.setSize(r, e), mi(r, e));
|
|
1552
1552
|
}
|
|
1553
1553
|
function Qt(r) {
|
|
1554
|
-
I.selectedObject !== r && (I.selectedObject && I.transformControls.detach(), I.selectedObject = r, I.transformControls.attach(r), I.transformControls.setMode(I.transformControlsMode), I.transformControls.showX = !0, I.transformControls.showY = !0, I.transformControls.showZ = !0,
|
|
1554
|
+
I.selectedObject !== r && (I.selectedObject && I.transformControls.detach(), I.selectedObject = r, I.transformControls.attach(r), I.transformControls.setMode(I.transformControlsMode), I.transformControls.showX = !0, I.transformControls.showY = !0, I.transformControls.showZ = !0, Bn(r), console.log("选中", I.selectedObject), Te == null || Te(r));
|
|
1555
1555
|
}
|
|
1556
1556
|
let J = null;
|
|
1557
1557
|
function Ti(r) {
|
|
@@ -1563,8 +1563,8 @@ function Et(r) {
|
|
|
1563
1563
|
function Oi(r) {
|
|
1564
1564
|
I.transformControlsMode = r, I.transformControls && I.transformControls.setMode(I.transformControlsMode);
|
|
1565
1565
|
}
|
|
1566
|
-
function
|
|
1567
|
-
|
|
1566
|
+
function Bn(r) {
|
|
1567
|
+
Un(), r.traverse((e) => {
|
|
1568
1568
|
if (e.isMesh) {
|
|
1569
1569
|
const t = e, s = new P.EdgesGeometry(t.geometry), n = new P.LineBasicMaterial({
|
|
1570
1570
|
color: bi,
|
|
@@ -1574,25 +1574,28 @@ function Un(r) {
|
|
|
1574
1574
|
}
|
|
1575
1575
|
});
|
|
1576
1576
|
}
|
|
1577
|
-
function
|
|
1577
|
+
function Un() {
|
|
1578
1578
|
for (const r of Xt)
|
|
1579
1579
|
r.parent && r.parent.remove(r), r.geometry.dispose(), r.material.dispose();
|
|
1580
1580
|
Xt = [];
|
|
1581
1581
|
}
|
|
1582
|
-
function
|
|
1583
|
-
I.selectedObject && (
|
|
1582
|
+
function Jt() {
|
|
1583
|
+
I.selectedObject && (Un(), I.transformControls.detach(), I.selectedObject = null, Te == null || Te(null));
|
|
1584
1584
|
}
|
|
1585
1585
|
function Ei(r) {
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1586
|
+
if (!r) {
|
|
1587
|
+
console.warn("[selectModelHandle] 传入的 objectId 为空");
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
Si(r);
|
|
1591
|
+
let e = null;
|
|
1592
|
+
st.forEach((t) => {
|
|
1589
1593
|
t.userData.id == r && (e = t), t.children && t.children.forEach((s) => {
|
|
1590
1594
|
s.name && s.name.startsWith("DataPanel_") && (s.visible = !1);
|
|
1591
1595
|
});
|
|
1592
|
-
}),
|
|
1593
|
-
e.children.forEach((t) => {
|
|
1596
|
+
}), e && (e.children.forEach((t) => {
|
|
1594
1597
|
t.name && t.name.startsWith("DataPanel_") && (t.visible = !0);
|
|
1595
|
-
}),
|
|
1598
|
+
}), Bn(e));
|
|
1596
1599
|
}
|
|
1597
1600
|
function Ri(r) {
|
|
1598
1601
|
if (Oe) {
|
|
@@ -1610,12 +1613,12 @@ function Ri(r) {
|
|
|
1610
1613
|
});
|
|
1611
1614
|
const i = s.intersectObjects(n);
|
|
1612
1615
|
if (i.length > 0) {
|
|
1613
|
-
let o =
|
|
1616
|
+
let o = Hi(i[0].object);
|
|
1614
1617
|
Qt(o);
|
|
1615
1618
|
} else
|
|
1616
|
-
|
|
1619
|
+
Jt();
|
|
1617
1620
|
}
|
|
1618
|
-
function
|
|
1621
|
+
function Hi(r) {
|
|
1619
1622
|
if (r.type === "Line") {
|
|
1620
1623
|
const e = r.parent;
|
|
1621
1624
|
switch (e.type) {
|
|
@@ -1627,13 +1630,27 @@ function Si(r) {
|
|
|
1627
1630
|
}
|
|
1628
1631
|
return r;
|
|
1629
1632
|
}
|
|
1630
|
-
function
|
|
1633
|
+
function Si(r, e = 500) {
|
|
1631
1634
|
var d;
|
|
1632
|
-
if (!I.camera || !I.orbitControls)
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1635
|
+
if (!I.camera || !I.orbitControls) {
|
|
1636
|
+
console.warn(
|
|
1637
|
+
"[focusOnObject] 编辑器尚未初始化或已销毁,无法执行聚焦操作。请确保已调用 initEditor()"
|
|
1638
|
+
);
|
|
1639
|
+
return;
|
|
1640
|
+
}
|
|
1641
|
+
if (r == null || r === "") {
|
|
1642
|
+
console.warn("[focusOnObject] 传入的 objectId 为空,无法聚焦");
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
let t = null;
|
|
1646
|
+
if ((d = I.scene) == null || d.traverse((p) => {
|
|
1647
|
+
p.userData.id == r && (t = p);
|
|
1648
|
+
}), !t) {
|
|
1649
|
+
console.warn(
|
|
1650
|
+
`[focusOnObject] 在场景中未找到 userData.id 为 "${r}" 的物体。请确认:1) 物体已被正确添加到场景(addModel);2) 物体的 userData.id 与传入的 objectId 一致;3) 传入的 objectId 不为空`
|
|
1651
|
+
);
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1637
1654
|
let s = null;
|
|
1638
1655
|
t.userData.closeUpView && typeof t.userData.closeUpView.x == "number" && typeof t.userData.closeUpView.y == "number" && typeof t.userData.closeUpView.z == "number" && (s = t.userData.closeUpView);
|
|
1639
1656
|
const n = new P.Vector3();
|
|
@@ -1641,26 +1658,33 @@ function Hi(r, e = 500) {
|
|
|
1641
1658
|
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();
|
|
1642
1659
|
c.lengthSq() < 1e-3 && c.set(0, 0, 1);
|
|
1643
1660
|
const A = n.clone().add(c.multiplyScalar(l)), u = I.camera.position.clone(), h = I.orbitControls.target.clone();
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1661
|
+
try {
|
|
1662
|
+
new nt.Tween({
|
|
1663
|
+
x: u.x,
|
|
1664
|
+
y: u.y,
|
|
1665
|
+
z: u.z,
|
|
1666
|
+
tx: h.x,
|
|
1667
|
+
ty: h.y,
|
|
1668
|
+
tz: h.z
|
|
1669
|
+
}).to(
|
|
1670
|
+
{
|
|
1671
|
+
x: s ? s.x : A.x,
|
|
1672
|
+
y: s ? s.y : A.y,
|
|
1673
|
+
z: s ? s.z : A.z,
|
|
1674
|
+
tx: n.x,
|
|
1675
|
+
ty: n.y,
|
|
1676
|
+
tz: n.z
|
|
1677
|
+
},
|
|
1678
|
+
e
|
|
1679
|
+
).easing(nt.Easing.Quadratic.InOut).onUpdate((p) => {
|
|
1680
|
+
I.camera.position.set(p.x, p.y, p.z), I.orbitControls.target.set(p.tx, p.ty, p.tz), I.orbitControls.update();
|
|
1681
|
+
}).start();
|
|
1682
|
+
} catch (p) {
|
|
1683
|
+
console.error(
|
|
1684
|
+
"[focusOnObject] TWEEN 动画创建失败,请检查 @tweenjs/tween.js 是否已正确安装且版本兼容(^23.1.3):",
|
|
1685
|
+
p
|
|
1686
|
+
);
|
|
1687
|
+
}
|
|
1664
1688
|
}
|
|
1665
1689
|
function Li(r) {
|
|
1666
1690
|
r.userData.id && st.set(String(r.userData.id), r);
|
|
@@ -1680,7 +1704,7 @@ function ze(r, e = !1) {
|
|
|
1680
1704
|
I.scene.add(r), r.userData.isMovable && (zi(r), vt()), e && I.mode === "edit" && Qt(r);
|
|
1681
1705
|
}
|
|
1682
1706
|
function ki(r) {
|
|
1683
|
-
I.selectedObject === r &&
|
|
1707
|
+
I.selectedObject === r && Jt(), ji(r), Ni(r), r.userData.helper && I.scene.remove(r.userData.helper), r.parent ? r.parent.remove(r) : I.scene.remove(r), Gi(r), vt();
|
|
1684
1708
|
}
|
|
1685
1709
|
function Wi(r) {
|
|
1686
1710
|
const e = I.scene.getObjectByProperty("uuid", r);
|
|
@@ -1736,7 +1760,7 @@ function Ra() {
|
|
|
1736
1760
|
}
|
|
1737
1761
|
async function Ki() {
|
|
1738
1762
|
var c, A, u;
|
|
1739
|
-
J == null || J(!0), await new Promise((h) => setTimeout(h, 50)),
|
|
1763
|
+
J == null || J(!0), await new Promise((h) => setTimeout(h, 50)), Jt();
|
|
1740
1764
|
const r = I.scene;
|
|
1741
1765
|
if (!r)
|
|
1742
1766
|
return J == null || J(!1), "{}";
|
|
@@ -1744,26 +1768,26 @@ async function Ki() {
|
|
|
1744
1768
|
r.traverse((h) => {
|
|
1745
1769
|
var d;
|
|
1746
1770
|
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_")) {
|
|
1747
|
-
const
|
|
1748
|
-
if (
|
|
1749
|
-
const
|
|
1771
|
+
const p = h;
|
|
1772
|
+
if (p.element) {
|
|
1773
|
+
const m = p.element.querySelector(
|
|
1750
1774
|
"[data-panel-title]"
|
|
1751
1775
|
), f = [];
|
|
1752
|
-
|
|
1776
|
+
p.element.querySelectorAll(
|
|
1753
1777
|
".css2d-data-panel-item"
|
|
1754
1778
|
).forEach((x) => {
|
|
1755
|
-
var w, D,
|
|
1779
|
+
var w, D, H;
|
|
1756
1780
|
const C = x.querySelector(".item-label"), y = x.querySelector(".item-value");
|
|
1757
1781
|
if (C && y) {
|
|
1758
1782
|
const Z = (C.textContent || "").trim(), _ = ((D = (w = y.childNodes[0]) == null ? void 0 : w.textContent) == null ? void 0 : D.trim()) || "", Q = y.querySelector(
|
|
1759
1783
|
"span"
|
|
1760
|
-
), ye = Q ? (Q.textContent || "").trim() : void 0, Mt = ((
|
|
1784
|
+
), ye = Q ? (Q.textContent || "").trim() : void 0, Mt = ((H = x.getAttribute("data-item-code")) == null ? void 0 : H.trim()) || void 0;
|
|
1761
1785
|
f.push({ label: Z, value: _, unit: ye, code: Mt });
|
|
1762
1786
|
}
|
|
1763
1787
|
}), h.parent && s.set(
|
|
1764
1788
|
h.parent.userData.id ? h.parent.userData.id : h.parent.uuid,
|
|
1765
1789
|
{
|
|
1766
|
-
title: ((d =
|
|
1790
|
+
title: ((d = m == null ? void 0 : m.textContent) == null ? void 0 : d.trim()) || "",
|
|
1767
1791
|
items: f
|
|
1768
1792
|
}
|
|
1769
1793
|
);
|
|
@@ -1803,11 +1827,11 @@ function Zi(r, e = "edit", t) {
|
|
|
1803
1827
|
const A = c.userData.id || c.uuid, u = t[A];
|
|
1804
1828
|
if (u && c.userData.isMovable) {
|
|
1805
1829
|
Li(c);
|
|
1806
|
-
const h = new
|
|
1830
|
+
const h = new Gn({
|
|
1807
1831
|
title: u.title,
|
|
1808
1832
|
items: u.items
|
|
1809
1833
|
});
|
|
1810
|
-
h.attachTo(c), h.visible = !1, console.log("panel", h),
|
|
1834
|
+
h.attachTo(c), h.visible = !1, console.log("panel", h), Fn(c, h);
|
|
1811
1835
|
}
|
|
1812
1836
|
})), e === "edit" && ((l = I.scene) == null || l.traverse((c) => {
|
|
1813
1837
|
var A;
|
|
@@ -1835,7 +1859,7 @@ function Vn(r) {
|
|
|
1835
1859
|
function Qi() {
|
|
1836
1860
|
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 = "", ge = [], st.clear(), vt(), gt = !1, Oe = !1;
|
|
1837
1861
|
}
|
|
1838
|
-
const Ji = /^[og]\s*(.+)?/, _i = /^mtllib /, $i = /^usemtl /, eo = /^usemap /,
|
|
1862
|
+
const Ji = /^[og]\s*(.+)?/, _i = /^mtllib /, $i = /^usemtl /, eo = /^usemap /, In = /\s+/, yn = new M(), Rt = new M(), Cn = new M(), xn = new M(), ee = new M(), ht = new de();
|
|
1839
1863
|
function to() {
|
|
1840
1864
|
const r = {
|
|
1841
1865
|
objects: [],
|
|
@@ -1945,7 +1969,7 @@ function to() {
|
|
|
1945
1969
|
},
|
|
1946
1970
|
addFaceNormal: function(e, t, s) {
|
|
1947
1971
|
const n = this.vertices, i = this.object.geometry.normals;
|
|
1948
|
-
|
|
1972
|
+
yn.fromArray(n, e), Rt.fromArray(n, t), Cn.fromArray(n, s), ee.subVectors(Cn, Rt), xn.subVectors(yn, Rt), ee.cross(xn), ee.normalize(), i.push(ee.x, ee.y, ee.z), i.push(ee.x, ee.y, ee.z), i.push(ee.x, ee.y, ee.z);
|
|
1949
1973
|
},
|
|
1950
1974
|
addColor: function(e, t, s) {
|
|
1951
1975
|
const n = this.colors, i = this.object.geometry.colors;
|
|
@@ -1967,13 +1991,13 @@ function to() {
|
|
|
1967
1991
|
const A = this.vertices.length;
|
|
1968
1992
|
let u = this.parseVertexIndex(e, A), h = this.parseVertexIndex(t, A), d = this.parseVertexIndex(s, A);
|
|
1969
1993
|
if (this.addVertex(u, h, d), this.addColor(u, h, d), a !== void 0 && a !== "") {
|
|
1970
|
-
const
|
|
1971
|
-
u = this.parseNormalIndex(a,
|
|
1994
|
+
const p = this.normals.length;
|
|
1995
|
+
u = this.parseNormalIndex(a, p), h = this.parseNormalIndex(l, p), d = this.parseNormalIndex(c, p), this.addNormal(u, h, d);
|
|
1972
1996
|
} else
|
|
1973
1997
|
this.addFaceNormal(u, h, d);
|
|
1974
1998
|
if (n !== void 0 && n !== "") {
|
|
1975
|
-
const
|
|
1976
|
-
u = this.parseUVIndex(n,
|
|
1999
|
+
const p = this.uvs.length;
|
|
2000
|
+
u = this.parseUVIndex(n, p), h = this.parseUVIndex(i, p), d = this.parseUVIndex(o, p), this.addUV(u, h, d), this.object.geometry.hasUVIndices = !0;
|
|
1977
2001
|
} else
|
|
1978
2002
|
this.addDefaultUV();
|
|
1979
2003
|
},
|
|
@@ -2054,7 +2078,7 @@ class no extends Yt {
|
|
|
2054
2078
|
const A = c.charAt(0);
|
|
2055
2079
|
if (A !== "#")
|
|
2056
2080
|
if (A === "v") {
|
|
2057
|
-
const u = c.split(
|
|
2081
|
+
const u = c.split(In);
|
|
2058
2082
|
switch (u[0]) {
|
|
2059
2083
|
case "v":
|
|
2060
2084
|
t.vertices.push(
|
|
@@ -2083,25 +2107,25 @@ class no extends Yt {
|
|
|
2083
2107
|
break;
|
|
2084
2108
|
}
|
|
2085
2109
|
} else if (A === "f") {
|
|
2086
|
-
const h = c.slice(1).trim().split(
|
|
2087
|
-
for (let
|
|
2088
|
-
const g = h[
|
|
2110
|
+
const h = c.slice(1).trim().split(In), d = [];
|
|
2111
|
+
for (let m = 0, f = h.length; m < f; m++) {
|
|
2112
|
+
const g = h[m];
|
|
2089
2113
|
if (g.length > 0) {
|
|
2090
2114
|
const x = g.split("/");
|
|
2091
2115
|
d.push(x);
|
|
2092
2116
|
}
|
|
2093
2117
|
}
|
|
2094
|
-
const
|
|
2095
|
-
for (let
|
|
2096
|
-
const g = d[
|
|
2118
|
+
const p = d[0];
|
|
2119
|
+
for (let m = 1, f = d.length - 1; m < f; m++) {
|
|
2120
|
+
const g = d[m], x = d[m + 1];
|
|
2097
2121
|
t.addFace(
|
|
2098
|
-
|
|
2122
|
+
p[0],
|
|
2099
2123
|
g[0],
|
|
2100
2124
|
x[0],
|
|
2101
|
-
|
|
2125
|
+
p[1],
|
|
2102
2126
|
g[1],
|
|
2103
2127
|
x[1],
|
|
2104
|
-
|
|
2128
|
+
p[2],
|
|
2105
2129
|
g[2],
|
|
2106
2130
|
x[2]
|
|
2107
2131
|
);
|
|
@@ -2113,8 +2137,8 @@ class no extends Yt {
|
|
|
2113
2137
|
if (c.indexOf("/") === -1)
|
|
2114
2138
|
h = u;
|
|
2115
2139
|
else
|
|
2116
|
-
for (let
|
|
2117
|
-
const f = u[
|
|
2140
|
+
for (let p = 0, m = u.length; p < m; p++) {
|
|
2141
|
+
const f = u[p].split("/");
|
|
2118
2142
|
f[0] !== "" && h.push(f[0]), f[1] !== "" && d.push(f[1]);
|
|
2119
2143
|
}
|
|
2120
2144
|
t.addLineGeometry(h, d);
|
|
@@ -2148,34 +2172,34 @@ class no extends Yt {
|
|
|
2148
2172
|
if (i.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0) === !0)
|
|
2149
2173
|
for (let a = 0, l = t.objects.length; a < l; a++) {
|
|
2150
2174
|
const c = t.objects[a], A = c.geometry, u = c.materials, h = A.type === "Line", d = A.type === "Points";
|
|
2151
|
-
let
|
|
2175
|
+
let p = !1;
|
|
2152
2176
|
if (A.vertices.length === 0) continue;
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2177
|
+
const m = new We();
|
|
2178
|
+
m.setAttribute("position", new pe(A.vertices, 3)), A.normals.length > 0 && m.setAttribute("normal", new pe(A.normals, 3)), A.colors.length > 0 && (p = !0, m.setAttribute("color", new pe(A.colors, 3))), A.hasUVIndices === !0 && m.setAttribute("uv", new pe(A.uvs, 2));
|
|
2155
2179
|
const f = [];
|
|
2156
2180
|
for (let x = 0, C = u.length; x < C; x++) {
|
|
2157
|
-
const y = u[x], w = y.name + "_" + y.smooth + "_" +
|
|
2181
|
+
const y = u[x], w = y.name + "_" + y.smooth + "_" + p;
|
|
2158
2182
|
let D = t.materials[w];
|
|
2159
2183
|
if (this.materials !== null) {
|
|
2160
2184
|
if (D = this.materials.create(y.name), h && D && !(D instanceof Ze)) {
|
|
2161
|
-
const
|
|
2162
|
-
Qe.prototype.copy.call(
|
|
2185
|
+
const H = new Ze();
|
|
2186
|
+
Qe.prototype.copy.call(H, D), H.color.copy(D.color), D = H;
|
|
2163
2187
|
} else if (d && D && !(D instanceof Ue)) {
|
|
2164
|
-
const
|
|
2165
|
-
Qe.prototype.copy.call(
|
|
2188
|
+
const H = new Ue({ size: 10, sizeAttenuation: !1 });
|
|
2189
|
+
Qe.prototype.copy.call(H, D), H.color.copy(D.color), H.map = D.map, D = H;
|
|
2166
2190
|
}
|
|
2167
2191
|
}
|
|
2168
|
-
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 =
|
|
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 = p, t.materials[w] = D), f.push(D);
|
|
2169
2193
|
}
|
|
2170
2194
|
let g;
|
|
2171
2195
|
if (f.length > 1) {
|
|
2172
2196
|
for (let x = 0, C = u.length; x < C; x++) {
|
|
2173
2197
|
const y = u[x];
|
|
2174
|
-
|
|
2198
|
+
m.addGroup(y.groupStart, y.groupCount, x);
|
|
2175
2199
|
}
|
|
2176
|
-
h ? g = new Wt(
|
|
2200
|
+
h ? g = new Wt(m, f) : d ? g = new pt(m, f) : g = new v(m, f);
|
|
2177
2201
|
} else
|
|
2178
|
-
h ? g = new Wt(
|
|
2202
|
+
h ? g = new Wt(m, f[0]) : d ? g = new pt(m, f[0]) : g = new v(m, f[0]);
|
|
2179
2203
|
g.name = c.name, i.add(g);
|
|
2180
2204
|
}
|
|
2181
2205
|
else if (t.vertices.length > 0) {
|
|
@@ -2187,7 +2211,7 @@ class no extends Yt {
|
|
|
2187
2211
|
return i;
|
|
2188
2212
|
}
|
|
2189
2213
|
}
|
|
2190
|
-
function
|
|
2214
|
+
function wn(r, e) {
|
|
2191
2215
|
if (e === ms)
|
|
2192
2216
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
2193
2217
|
if (e === zt || e === Hn) {
|
|
@@ -2269,9 +2293,9 @@ class io extends Yt {
|
|
|
2269
2293
|
}), this.register(function(t) {
|
|
2270
2294
|
return new ro(t);
|
|
2271
2295
|
}), this.register(function(t) {
|
|
2272
|
-
return new
|
|
2296
|
+
return new vn(t, O.EXT_MESHOPT_COMPRESSION);
|
|
2273
2297
|
}), this.register(function(t) {
|
|
2274
|
-
return new
|
|
2298
|
+
return new vn(t, O.KHR_MESHOPT_COMPRESSION);
|
|
2275
2299
|
}), this.register(function(t) {
|
|
2276
2300
|
return new wo(t);
|
|
2277
2301
|
});
|
|
@@ -2760,7 +2784,7 @@ class xo {
|
|
|
2760
2784
|
return s.loadTextureImage(e, o.source, l);
|
|
2761
2785
|
}
|
|
2762
2786
|
}
|
|
2763
|
-
class
|
|
2787
|
+
class vn {
|
|
2764
2788
|
constructor(e, t) {
|
|
2765
2789
|
this.name = t, this.parser = e;
|
|
2766
2790
|
}
|
|
@@ -2803,22 +2827,22 @@ class wo {
|
|
|
2803
2827
|
a.push(this.parser.getDependency("accessor", o[c]).then((A) => (l[c] = A, l[c])));
|
|
2804
2828
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
|
|
2805
2829
|
const A = c.pop(), u = A.isGroup ? A.children : [A], h = c[0].count, d = [];
|
|
2806
|
-
for (const
|
|
2807
|
-
const
|
|
2830
|
+
for (const p of u) {
|
|
2831
|
+
const m = new me(), f = new M(), g = new K(), x = new M(1, 1, 1), C = new ys(p.geometry, p.material, h);
|
|
2808
2832
|
for (let y = 0; y < h; y++)
|
|
2809
|
-
l.TRANSLATION && f.fromBufferAttribute(l.TRANSLATION, y), l.ROTATION && g.fromBufferAttribute(l.ROTATION, y), l.SCALE && x.fromBufferAttribute(l.SCALE, y), C.setMatrixAt(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, m.compose(f, g, x));
|
|
2810
2834
|
for (const y in l)
|
|
2811
2835
|
if (y === "_COLOR_0") {
|
|
2812
2836
|
const w = l[y];
|
|
2813
2837
|
C.instanceColor = new Cs(w.array, w.itemSize, w.normalized);
|
|
2814
|
-
} else y !== "TRANSLATION" && y !== "ROTATION" && y !== "SCALE" &&
|
|
2815
|
-
ke.prototype.copy.call(C,
|
|
2838
|
+
} else y !== "TRANSLATION" && y !== "ROTATION" && y !== "SCALE" && p.geometry.setAttribute(y, l[y]);
|
|
2839
|
+
ke.prototype.copy.call(C, p), this.parser.assignFinalMaterial(C), d.push(C);
|
|
2816
2840
|
}
|
|
2817
2841
|
return A.isGroup ? (A.clear(), A.add(...d), A) : d[0];
|
|
2818
2842
|
}));
|
|
2819
2843
|
}
|
|
2820
2844
|
}
|
|
2821
|
-
const Kn = "glTF", Xe = 12,
|
|
2845
|
+
const Kn = "glTF", Xe = 12, Mn = { JSON: 1313821514, BIN: 5130562 };
|
|
2822
2846
|
class vo {
|
|
2823
2847
|
constructor(e) {
|
|
2824
2848
|
this.name = O.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
@@ -2837,10 +2861,10 @@ class vo {
|
|
|
2837
2861
|
const a = i.getUint32(o, !0);
|
|
2838
2862
|
o += 4;
|
|
2839
2863
|
const l = i.getUint32(o, !0);
|
|
2840
|
-
if (o += 4, l ===
|
|
2864
|
+
if (o += 4, l === Mn.JSON) {
|
|
2841
2865
|
const c = new Uint8Array(e, Xe + o, a);
|
|
2842
2866
|
this.content = s.decode(c);
|
|
2843
|
-
} else if (l ===
|
|
2867
|
+
} else if (l === Mn.BIN) {
|
|
2844
2868
|
const c = Xe + o;
|
|
2845
2869
|
this.body = e.slice(c, c + a);
|
|
2846
2870
|
}
|
|
@@ -2872,9 +2896,9 @@ class Mo {
|
|
|
2872
2896
|
return t.getDependency("bufferView", i).then(function(A) {
|
|
2873
2897
|
return new Promise(function(u, h) {
|
|
2874
2898
|
n.decodeDracoFile(A, function(d) {
|
|
2875
|
-
for (const
|
|
2876
|
-
const
|
|
2877
|
-
f !== void 0 && (
|
|
2899
|
+
for (const p in d.attributes) {
|
|
2900
|
+
const m = d.attributes[p], f = l[p];
|
|
2901
|
+
f !== void 0 && (m.normalized = f);
|
|
2878
2902
|
}
|
|
2879
2903
|
u(d);
|
|
2880
2904
|
}, a, c, ae, h);
|
|
@@ -2906,10 +2930,10 @@ class Zn extends zs {
|
|
|
2906
2930
|
return t;
|
|
2907
2931
|
}
|
|
2908
2932
|
interpolate_(e, t, s, n) {
|
|
2909
|
-
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,
|
|
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, p = e * c, m = p - c, f = -2 * d + 3 * h, g = d - h, x = 1 - f, C = g - h + u;
|
|
2910
2934
|
for (let y = 0; y !== a; y++) {
|
|
2911
|
-
const w = o[
|
|
2912
|
-
i[y] = x * w + C * D + f *
|
|
2935
|
+
const w = o[m + y + a], D = o[m + y + l] * A, H = o[p + y + a], Z = o[p + y] * A;
|
|
2936
|
+
i[y] = x * w + C * D + f * H + g * Z;
|
|
2913
2937
|
}
|
|
2914
2938
|
return i;
|
|
2915
2939
|
}
|
|
@@ -2936,18 +2960,18 @@ const te = {
|
|
|
2936
2960
|
5123: Uint16Array,
|
|
2937
2961
|
5125: Uint32Array,
|
|
2938
2962
|
5126: Float32Array
|
|
2939
|
-
},
|
|
2940
|
-
9728:
|
|
2963
|
+
}, Dn = {
|
|
2964
|
+
9728: jn,
|
|
2941
2965
|
9729: Gt,
|
|
2942
2966
|
9984: Ds,
|
|
2943
2967
|
9985: Ms,
|
|
2944
2968
|
9986: vs,
|
|
2945
|
-
9987:
|
|
2946
|
-
},
|
|
2969
|
+
9987: Nn
|
|
2970
|
+
}, Pn = {
|
|
2947
2971
|
33071: Ts,
|
|
2948
2972
|
33648: Ps,
|
|
2949
2973
|
10497: Ft
|
|
2950
|
-
},
|
|
2974
|
+
}, Ht = {
|
|
2951
2975
|
SCALAR: 1,
|
|
2952
2976
|
VEC2: 2,
|
|
2953
2977
|
VEC3: 3,
|
|
@@ -2975,15 +2999,15 @@ const te = {
|
|
|
2975
2999
|
CUBICSPLINE: void 0,
|
|
2976
3000
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
2977
3001
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
2978
|
-
LINEAR:
|
|
3002
|
+
LINEAR: Wn,
|
|
2979
3003
|
STEP: ks
|
|
2980
|
-
},
|
|
3004
|
+
}, St = {
|
|
2981
3005
|
OPAQUE: "OPAQUE",
|
|
2982
3006
|
MASK: "MASK",
|
|
2983
3007
|
BLEND: "BLEND"
|
|
2984
3008
|
};
|
|
2985
3009
|
function Ro(r) {
|
|
2986
|
-
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new
|
|
3010
|
+
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new kn({
|
|
2987
3011
|
color: 16777215,
|
|
2988
3012
|
emissive: 0,
|
|
2989
3013
|
metalness: 1,
|
|
@@ -3000,7 +3024,7 @@ function xe(r, e, t) {
|
|
|
3000
3024
|
function re(r, e) {
|
|
3001
3025
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(r.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
3002
3026
|
}
|
|
3003
|
-
function
|
|
3027
|
+
function Ho(r, e, t) {
|
|
3004
3028
|
let s = !1, n = !1, i = !1;
|
|
3005
3029
|
for (let c = 0, A = e.length; c < A; c++) {
|
|
3006
3030
|
const u = e[c];
|
|
@@ -3032,7 +3056,7 @@ function So(r, e, t) {
|
|
|
3032
3056
|
return s && (r.morphAttributes.position = A), n && (r.morphAttributes.normal = u), i && (r.morphAttributes.color = h), r.morphTargetsRelative = !0, r;
|
|
3033
3057
|
});
|
|
3034
3058
|
}
|
|
3035
|
-
function
|
|
3059
|
+
function So(r, e) {
|
|
3036
3060
|
if (r.updateMorphTargets(), e.weights !== void 0)
|
|
3037
3061
|
for (let t = 0, s = e.weights.length; t < s; t++)
|
|
3038
3062
|
r.morphTargetInfluences[t] = e.weights[t];
|
|
@@ -3329,27 +3353,27 @@ class ko {
|
|
|
3329
3353
|
loadAccessor(e) {
|
|
3330
3354
|
const t = this, s = this.json, n = this.json.accessors[e];
|
|
3331
3355
|
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
3332
|
-
const o =
|
|
3356
|
+
const o = Ht[n.type], a = je[n.componentType], l = n.normalized === !0, c = new a(n.count * o);
|
|
3333
3357
|
return Promise.resolve(new _e(c, o, l));
|
|
3334
3358
|
}
|
|
3335
3359
|
const i = [];
|
|
3336
3360
|
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) {
|
|
3337
|
-
const a = o[0], l =
|
|
3338
|
-
let
|
|
3361
|
+
const a = o[0], l = Ht[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, p = n.normalized === !0;
|
|
3362
|
+
let m, f;
|
|
3339
3363
|
if (d && d !== u) {
|
|
3340
3364
|
const g = Math.floor(h / d), x = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + g + ":" + n.count;
|
|
3341
3365
|
let C = t.cache.get(x);
|
|
3342
|
-
C || (
|
|
3366
|
+
C || (m = new c(a, g * d, n.count * d / A), C = new Sn(m, d / A), t.cache.add(x, C)), f = new Ln(C, l, h % d / A, p);
|
|
3343
3367
|
} else
|
|
3344
|
-
a === null ?
|
|
3368
|
+
a === null ? m = new c(n.count * l) : m = new c(a, h, n.count * l), f = new _e(m, l, p);
|
|
3345
3369
|
if (n.sparse !== void 0) {
|
|
3346
|
-
const g =
|
|
3370
|
+
const g = Ht.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);
|
|
3347
3371
|
a !== null && (f = new _e(f.array.slice(), f.itemSize, f.normalized)), f.normalized = !1;
|
|
3348
|
-
for (let
|
|
3349
|
-
const _ = w[
|
|
3350
|
-
if (f.setX(_, D[
|
|
3372
|
+
for (let H = 0, Z = w.length; H < Z; H++) {
|
|
3373
|
+
const _ = w[H];
|
|
3374
|
+
if (f.setX(_, D[H * l]), l >= 2 && f.setY(_, D[H * l + 1]), l >= 3 && f.setZ(_, D[H * l + 2]), l >= 4 && f.setW(_, D[H * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
3351
3375
|
}
|
|
3352
|
-
f.normalized =
|
|
3376
|
+
f.normalized = p;
|
|
3353
3377
|
}
|
|
3354
3378
|
return f;
|
|
3355
3379
|
});
|
|
@@ -3377,7 +3401,7 @@ class ko {
|
|
|
3377
3401
|
const c = this.loadImageSource(t, s).then(function(A) {
|
|
3378
3402
|
A.flipY = !1, A.name = o.name || a.name || "", A.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (A.name = a.uri);
|
|
3379
3403
|
const h = (i.samplers || {})[o.sampler] || {};
|
|
3380
|
-
return A.magFilter =
|
|
3404
|
+
return A.magFilter = Dn[h.magFilter] || Gt, A.minFilter = Dn[h.minFilter] || Nn, A.wrapS = Pn[h.wrapS] || Ft, A.wrapT = Pn[h.wrapT] || Ft, A.generateMipmaps = !A.isCompressedTexture && A.minFilter !== jn && A.minFilter !== Gt, n.associations.set(A, { textures: e }), A;
|
|
3381
3405
|
}).catch(function() {
|
|
3382
3406
|
return null;
|
|
3383
3407
|
});
|
|
@@ -3399,11 +3423,11 @@ class ko {
|
|
|
3399
3423
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
3400
3424
|
const A = Promise.resolve(l).then(function(u) {
|
|
3401
3425
|
return new Promise(function(h, d) {
|
|
3402
|
-
let
|
|
3403
|
-
t.isImageBitmapLoader === !0 && (
|
|
3404
|
-
const f = new
|
|
3426
|
+
let p = h;
|
|
3427
|
+
t.isImageBitmapLoader === !0 && (p = function(m) {
|
|
3428
|
+
const f = new tn(m);
|
|
3405
3429
|
f.needsUpdate = !0, h(f);
|
|
3406
|
-
}), t.load(Je.resolveURL(u, i.path),
|
|
3430
|
+
}), t.load(Je.resolveURL(u, i.path), p, void 0, d);
|
|
3407
3431
|
});
|
|
3408
3432
|
}).then(function(u) {
|
|
3409
3433
|
return c === !0 && a.revokeObjectURL(l), re(u, o), u.userData.mimeType = o.mimeType || No(o.uri), u;
|
|
@@ -3468,7 +3492,7 @@ class ko {
|
|
|
3468
3492
|
e.material = s;
|
|
3469
3493
|
}
|
|
3470
3494
|
getMaterialType() {
|
|
3471
|
-
return
|
|
3495
|
+
return kn;
|
|
3472
3496
|
}
|
|
3473
3497
|
/**
|
|
3474
3498
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -3496,9 +3520,9 @@ class ko {
|
|
|
3496
3520
|
return h.extendMaterialParams && h.extendMaterialParams(e, a);
|
|
3497
3521
|
})));
|
|
3498
3522
|
}
|
|
3499
|
-
i.doubleSided === !0 && (a.side =
|
|
3500
|
-
const A = i.alphaMode ||
|
|
3501
|
-
if (A ===
|
|
3523
|
+
i.doubleSided === !0 && (a.side = Rn);
|
|
3524
|
+
const A = i.alphaMode || St.OPAQUE;
|
|
3525
|
+
if (A === St.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, A === St.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)) {
|
|
3502
3526
|
const u = i.normalTexture.scale;
|
|
3503
3527
|
a.normalScale.set(u, u);
|
|
3504
3528
|
}
|
|
@@ -3535,7 +3559,7 @@ class ko {
|
|
|
3535
3559
|
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
3536
3560
|
function i(a) {
|
|
3537
3561
|
return s[O.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(l) {
|
|
3538
|
-
return
|
|
3562
|
+
return Tn(l, a, t);
|
|
3539
3563
|
});
|
|
3540
3564
|
}
|
|
3541
3565
|
const o = [];
|
|
@@ -3545,7 +3569,7 @@ class ko {
|
|
|
3545
3569
|
o.push(u.promise);
|
|
3546
3570
|
else {
|
|
3547
3571
|
let h;
|
|
3548
|
-
c.extensions && c.extensions[O.KHR_DRACO_MESH_COMPRESSION] ? h = i(c) : h =
|
|
3572
|
+
c.extensions && c.extensions[O.KHR_DRACO_MESH_COMPRESSION] ? h = i(c) : h = Tn(new We(), c, t), n[A] = { primitive: c, promise: h }, o.push(h);
|
|
3549
3573
|
}
|
|
3550
3574
|
}
|
|
3551
3575
|
return Promise.all(o);
|
|
@@ -3565,25 +3589,25 @@ class ko {
|
|
|
3565
3589
|
}
|
|
3566
3590
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
3567
3591
|
const c = l.slice(0, l.length - 1), A = l[l.length - 1], u = [];
|
|
3568
|
-
for (let d = 0,
|
|
3569
|
-
const
|
|
3592
|
+
for (let d = 0, p = A.length; d < p; d++) {
|
|
3593
|
+
const m = A[d], f = o[d];
|
|
3570
3594
|
let g;
|
|
3571
3595
|
const x = c[d];
|
|
3572
3596
|
if (f.mode === te.TRIANGLES || f.mode === te.TRIANGLE_STRIP || f.mode === te.TRIANGLE_FAN || f.mode === void 0)
|
|
3573
|
-
g = i.isSkinnedMesh === !0 ? new Es(
|
|
3597
|
+
g = i.isSkinnedMesh === !0 ? new Es(m, x) : new v(m, x), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), f.mode === te.TRIANGLE_STRIP ? g.geometry = wn(g.geometry, Hn) : f.mode === te.TRIANGLE_FAN && (g.geometry = wn(g.geometry, zt));
|
|
3574
3598
|
else if (f.mode === te.LINES)
|
|
3575
|
-
g = new Wt(
|
|
3599
|
+
g = new Wt(m, x);
|
|
3576
3600
|
else if (f.mode === te.LINE_STRIP)
|
|
3577
|
-
g = new ue(
|
|
3601
|
+
g = new ue(m, x);
|
|
3578
3602
|
else if (f.mode === te.LINE_LOOP)
|
|
3579
|
-
g = new Rs(
|
|
3603
|
+
g = new Rs(m, x);
|
|
3580
3604
|
else if (f.mode === te.POINTS)
|
|
3581
|
-
g = new pt(
|
|
3605
|
+
g = new pt(m, x);
|
|
3582
3606
|
else
|
|
3583
3607
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + f.mode);
|
|
3584
|
-
Object.keys(g.geometry.morphAttributes).length > 0 &&
|
|
3608
|
+
Object.keys(g.geometry.morphAttributes).length > 0 && So(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);
|
|
3585
3609
|
}
|
|
3586
|
-
for (let d = 0,
|
|
3610
|
+
for (let d = 0, p = u.length; d < p; d++)
|
|
3587
3611
|
t.associations.set(u[d], {
|
|
3588
3612
|
meshes: e,
|
|
3589
3613
|
primitives: d
|
|
@@ -3592,7 +3616,7 @@ class ko {
|
|
|
3592
3616
|
return i.extensions && xe(n, u[0], i), u[0];
|
|
3593
3617
|
const h = new ft();
|
|
3594
3618
|
i.extensions && xe(n, h, i), t.associations.set(h, { meshes: e });
|
|
3595
|
-
for (let d = 0,
|
|
3619
|
+
for (let d = 0, p = u.length; d < p; d++)
|
|
3596
3620
|
h.add(u[d]);
|
|
3597
3621
|
return h;
|
|
3598
3622
|
});
|
|
@@ -3611,7 +3635,7 @@ class ko {
|
|
|
3611
3635
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3612
3636
|
return;
|
|
3613
3637
|
}
|
|
3614
|
-
return s.type === "perspective" ? t = new
|
|
3638
|
+
return s.type === "perspective" ? t = new Hs(En.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new Ss(-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);
|
|
3615
3639
|
}
|
|
3616
3640
|
/**
|
|
3617
3641
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -3648,8 +3672,8 @@ class ko {
|
|
|
3648
3672
|
loadAnimation(e) {
|
|
3649
3673
|
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], l = [], c = [], A = [];
|
|
3650
3674
|
for (let u = 0, h = n.channels.length; u < h; u++) {
|
|
3651
|
-
const d = n.channels[u],
|
|
3652
|
-
|
|
3675
|
+
const d = n.channels[u], p = n.samplers[d.sampler], m = d.target, f = m.node, g = n.parameters !== void 0 ? n.parameters[p.input] : p.input, x = n.parameters !== void 0 ? n.parameters[p.output] : p.output;
|
|
3676
|
+
m.node !== void 0 && (o.push(this.getDependency("node", f)), a.push(this.getDependency("accessor", g)), l.push(this.getDependency("accessor", x)), c.push(p), A.push(m));
|
|
3653
3677
|
}
|
|
3654
3678
|
return Promise.all([
|
|
3655
3679
|
Promise.all(o),
|
|
@@ -3658,12 +3682,12 @@ class ko {
|
|
|
3658
3682
|
Promise.all(c),
|
|
3659
3683
|
Promise.all(A)
|
|
3660
3684
|
]).then(function(u) {
|
|
3661
|
-
const h = u[0], d = u[1],
|
|
3685
|
+
const h = u[0], d = u[1], p = u[2], m = u[3], f = u[4], g = [];
|
|
3662
3686
|
for (let C = 0, y = h.length; C < y; C++) {
|
|
3663
|
-
const w = h[C], D = d[C],
|
|
3687
|
+
const w = h[C], D = d[C], H = p[C], Z = m[C], _ = f[C];
|
|
3664
3688
|
if (w === void 0) continue;
|
|
3665
3689
|
w.updateMatrix && w.updateMatrix();
|
|
3666
|
-
const Q = s._createAnimationTracks(w, D,
|
|
3690
|
+
const Q = s._createAnimationTracks(w, D, H, Z, _);
|
|
3667
3691
|
if (Q)
|
|
3668
3692
|
for (let ye = 0; ye < Q.length; ye++)
|
|
3669
3693
|
g.push(Q[ye]);
|
|
@@ -3704,11 +3728,11 @@ class ko {
|
|
|
3704
3728
|
h !== null && A.traverse(function(d) {
|
|
3705
3729
|
d.isSkinnedMesh && d.bind(h, jo);
|
|
3706
3730
|
});
|
|
3707
|
-
for (let d = 0,
|
|
3731
|
+
for (let d = 0, p = u.length; d < p; d++)
|
|
3708
3732
|
A.add(u[d]);
|
|
3709
3733
|
if (A.userData.pivot !== void 0 && u.length > 0) {
|
|
3710
|
-
const d = A.userData.pivot,
|
|
3711
|
-
A.pivot = new M().fromArray(d), A.position.x -= d[0], A.position.y -= d[1], A.position.z -= d[2],
|
|
3734
|
+
const d = A.userData.pivot, p = u[0];
|
|
3735
|
+
A.pivot = new M().fromArray(d), A.position.x -= d[0], A.position.y -= d[1], A.position.z -= d[2], p.position.set(0, 0, 0), delete A.userData.pivot;
|
|
3712
3736
|
}
|
|
3713
3737
|
return A;
|
|
3714
3738
|
});
|
|
@@ -3768,7 +3792,7 @@ class ko {
|
|
|
3768
3792
|
const c = (A) => {
|
|
3769
3793
|
const u = /* @__PURE__ */ new Map();
|
|
3770
3794
|
for (const [h, d] of n.associations)
|
|
3771
|
-
(h instanceof Qe || h instanceof
|
|
3795
|
+
(h instanceof Qe || h instanceof tn) && u.set(h, d);
|
|
3772
3796
|
return A.traverse((h) => {
|
|
3773
3797
|
const d = n.associations.get(h);
|
|
3774
3798
|
d != null && u.set(h, d);
|
|
@@ -3786,37 +3810,37 @@ class ko {
|
|
|
3786
3810
|
let A;
|
|
3787
3811
|
switch (fe[i.path]) {
|
|
3788
3812
|
case fe.weights:
|
|
3789
|
-
A =
|
|
3813
|
+
A = sn;
|
|
3790
3814
|
break;
|
|
3791
3815
|
case fe.rotation:
|
|
3792
|
-
A =
|
|
3816
|
+
A = on;
|
|
3793
3817
|
break;
|
|
3794
3818
|
case fe.translation:
|
|
3795
3819
|
case fe.scale:
|
|
3796
|
-
A =
|
|
3820
|
+
A = nn;
|
|
3797
3821
|
break;
|
|
3798
3822
|
default:
|
|
3799
3823
|
switch (s.itemSize) {
|
|
3800
3824
|
case 1:
|
|
3801
|
-
A =
|
|
3825
|
+
A = sn;
|
|
3802
3826
|
break;
|
|
3803
3827
|
case 2:
|
|
3804
3828
|
case 3:
|
|
3805
3829
|
default:
|
|
3806
|
-
A =
|
|
3830
|
+
A = nn;
|
|
3807
3831
|
break;
|
|
3808
3832
|
}
|
|
3809
3833
|
break;
|
|
3810
3834
|
}
|
|
3811
|
-
const u = n.interpolation !== void 0 ? Eo[n.interpolation] :
|
|
3812
|
-
for (let d = 0,
|
|
3813
|
-
const
|
|
3835
|
+
const u = n.interpolation !== void 0 ? Eo[n.interpolation] : Wn, h = this._getArrayFromAccessor(s);
|
|
3836
|
+
for (let d = 0, p = l.length; d < p; d++) {
|
|
3837
|
+
const m = new A(
|
|
3814
3838
|
l[d] + "." + fe[i.path],
|
|
3815
3839
|
t.array,
|
|
3816
3840
|
h,
|
|
3817
3841
|
u
|
|
3818
3842
|
);
|
|
3819
|
-
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(
|
|
3843
|
+
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(m), o.push(m);
|
|
3820
3844
|
}
|
|
3821
3845
|
return o;
|
|
3822
3846
|
}
|
|
@@ -3832,7 +3856,7 @@ class ko {
|
|
|
3832
3856
|
}
|
|
3833
3857
|
_createCubicSplineTrackInterpolant(e) {
|
|
3834
3858
|
e.createInterpolant = function(s) {
|
|
3835
|
-
const n = this instanceof
|
|
3859
|
+
const n = this instanceof on ? Oo : Zn;
|
|
3836
3860
|
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
3837
3861
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
3838
3862
|
}
|
|
@@ -3861,11 +3885,11 @@ function Wo(r, e, t) {
|
|
|
3861
3885
|
for (let c = 0, A = i.length; c < A; c++) {
|
|
3862
3886
|
const u = i[c];
|
|
3863
3887
|
if (u.POSITION !== void 0) {
|
|
3864
|
-
const h = t.json.accessors[u.POSITION], d = h.min,
|
|
3865
|
-
if (d !== void 0 &&
|
|
3866
|
-
if (l.setX(Math.max(Math.abs(d[0]), Math.abs(
|
|
3867
|
-
const
|
|
3868
|
-
l.multiplyScalar(
|
|
3888
|
+
const h = t.json.accessors[u.POSITION], d = h.min, p = h.max;
|
|
3889
|
+
if (d !== void 0 && p !== void 0) {
|
|
3890
|
+
if (l.setX(Math.max(Math.abs(d[0]), Math.abs(p[0]))), l.setY(Math.max(Math.abs(d[1]), Math.abs(p[1]))), l.setZ(Math.max(Math.abs(d[2]), Math.abs(p[2]))), h.normalized) {
|
|
3891
|
+
const m = Vt(je[h.componentType]);
|
|
3892
|
+
l.multiplyScalar(m);
|
|
3869
3893
|
}
|
|
3870
3894
|
a.max(l);
|
|
3871
3895
|
} else
|
|
@@ -3878,7 +3902,7 @@ function Wo(r, e, t) {
|
|
|
3878
3902
|
const o = new Fs();
|
|
3879
3903
|
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, r.boundingSphere = o;
|
|
3880
3904
|
}
|
|
3881
|
-
function
|
|
3905
|
+
function Tn(r, e, t) {
|
|
3882
3906
|
const s = e.attributes, n = [];
|
|
3883
3907
|
function i(o, a) {
|
|
3884
3908
|
return t.getDependency("accessor", o).then(function(l) {
|
|
@@ -3896,7 +3920,7 @@ function On(r, e, t) {
|
|
|
3896
3920
|
n.push(o);
|
|
3897
3921
|
}
|
|
3898
3922
|
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() {
|
|
3899
|
-
return e.targets !== void 0 ?
|
|
3923
|
+
return e.targets !== void 0 ? Ho(r, e.targets, t) : r;
|
|
3900
3924
|
});
|
|
3901
3925
|
}
|
|
3902
3926
|
const Nt = /* @__PURE__ */ new WeakMap();
|
|
@@ -4015,8 +4039,8 @@ class zo extends Yt {
|
|
|
4015
4039
|
if (o === a)
|
|
4016
4040
|
c = new _e(i, o);
|
|
4017
4041
|
else {
|
|
4018
|
-
const A = new
|
|
4019
|
-
c = new
|
|
4042
|
+
const A = new Sn(i, a);
|
|
4043
|
+
c = new Ln(A, o, 0);
|
|
4020
4044
|
}
|
|
4021
4045
|
n === "color" && (this._assignVertexColorSpace(c, l), c.normalized = !(i instanceof Float32Array)), t.setAttribute(n, c);
|
|
4022
4046
|
}
|
|
@@ -4108,8 +4132,8 @@ function Go() {
|
|
|
4108
4132
|
e.then((A) => {
|
|
4109
4133
|
const u = A.draco, h = new u.Decoder();
|
|
4110
4134
|
try {
|
|
4111
|
-
const d = t(u, h, new Int8Array(l), c),
|
|
4112
|
-
d.index &&
|
|
4135
|
+
const d = t(u, h, new Int8Array(l), c), p = d.attributes.map((m) => m.array.buffer);
|
|
4136
|
+
d.index && p.push(d.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: d }, p);
|
|
4113
4137
|
} catch (d) {
|
|
4114
4138
|
console.error(d), self.postMessage({ type: "error", id: a.id, error: d.message });
|
|
4115
4139
|
} finally {
|
|
@@ -4122,16 +4146,16 @@ function Go() {
|
|
|
4122
4146
|
function t(o, a, l, c) {
|
|
4123
4147
|
const A = c.attributeIDs, u = c.attributeTypes;
|
|
4124
4148
|
let h, d;
|
|
4125
|
-
const
|
|
4126
|
-
if (
|
|
4149
|
+
const p = a.GetEncodedGeometryType(l);
|
|
4150
|
+
if (p === o.TRIANGULAR_MESH)
|
|
4127
4151
|
h = new o.Mesh(), d = a.DecodeArrayToMesh(l, l.byteLength, h);
|
|
4128
|
-
else if (
|
|
4152
|
+
else if (p === o.POINT_CLOUD)
|
|
4129
4153
|
h = new o.PointCloud(), d = a.DecodeArrayToPointCloud(l, l.byteLength, h);
|
|
4130
4154
|
else
|
|
4131
4155
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
4132
4156
|
if (!d.ok() || h.ptr === 0)
|
|
4133
4157
|
throw new Error("THREE.DRACOLoader: Decoding failed: " + d.error_msg());
|
|
4134
|
-
const
|
|
4158
|
+
const m = { index: null, attributes: [] };
|
|
4135
4159
|
for (const f in A) {
|
|
4136
4160
|
const g = self[u[f]];
|
|
4137
4161
|
let x, C;
|
|
@@ -4142,9 +4166,9 @@ function Go() {
|
|
|
4142
4166
|
x = a.GetAttribute(h, C);
|
|
4143
4167
|
}
|
|
4144
4168
|
const y = n(o, a, h, f, g, x);
|
|
4145
|
-
f === "color" && (y.vertexColorSpace = c.vertexColorSpace),
|
|
4169
|
+
f === "color" && (y.vertexColorSpace = c.vertexColorSpace), m.attributes.push(y);
|
|
4146
4170
|
}
|
|
4147
|
-
return
|
|
4171
|
+
return p === o.TRIANGULAR_MESH && (m.index = s(o, a, h)), o.destroy(h), m;
|
|
4148
4172
|
}
|
|
4149
4173
|
function s(o, a, l) {
|
|
4150
4174
|
const A = l.num_faces() * 3, u = A * 4, h = o._malloc(u);
|
|
@@ -4153,19 +4177,19 @@ function Go() {
|
|
|
4153
4177
|
return o._free(h), { array: d, itemSize: 1 };
|
|
4154
4178
|
}
|
|
4155
4179
|
function n(o, a, l, c, A, u) {
|
|
4156
|
-
const h = l.num_points(), d = u.num_components(),
|
|
4157
|
-
a.GetAttributeDataArrayForAllPoints(l, u,
|
|
4180
|
+
const h = l.num_points(), d = u.num_components(), p = i(o, A), m = d * A.BYTES_PER_ELEMENT, f = Math.ceil(m / 4) * 4, g = f / A.BYTES_PER_ELEMENT, x = h * m, C = h * f, y = o._malloc(x);
|
|
4181
|
+
a.GetAttributeDataArrayForAllPoints(l, u, p, x, y);
|
|
4158
4182
|
const w = new A(o.HEAPF32.buffer, y, x / A.BYTES_PER_ELEMENT);
|
|
4159
4183
|
let D;
|
|
4160
|
-
if (
|
|
4184
|
+
if (m === f)
|
|
4161
4185
|
D = w.slice();
|
|
4162
4186
|
else {
|
|
4163
4187
|
D = new A(C / A.BYTES_PER_ELEMENT);
|
|
4164
|
-
let
|
|
4188
|
+
let H = 0;
|
|
4165
4189
|
for (let Z = 0, _ = w.length; Z < _; Z++) {
|
|
4166
4190
|
for (let Q = 0; Q < d; Q++)
|
|
4167
|
-
D[
|
|
4168
|
-
|
|
4191
|
+
D[H + Q] = w[Z * d + Q];
|
|
4192
|
+
H += g;
|
|
4169
4193
|
}
|
|
4170
4194
|
}
|
|
4171
4195
|
return o._free(y), {
|
|
@@ -4226,7 +4250,7 @@ function Uo(r) {
|
|
|
4226
4250
|
speedY: A = 5e-4
|
|
4227
4251
|
} = r || {}, u = new P.PlaneGeometry(e, t), d = new P.TextureLoader().load(Fo, (f) => {
|
|
4228
4252
|
f.wrapS = f.wrapT = P.RepeatWrapping, f.repeat.set(a, l), f.generateMipmaps = !1, f.minFilter = P.LinearFilter, f.magFilter = P.LinearFilter;
|
|
4229
|
-
}),
|
|
4253
|
+
}), p = new P.MeshStandardMaterial({
|
|
4230
4254
|
color: s,
|
|
4231
4255
|
roughness: n,
|
|
4232
4256
|
metalness: i,
|
|
@@ -4236,8 +4260,8 @@ function Uo(r) {
|
|
|
4236
4260
|
// 双面渲染,避免从侧面或底部看到黑色
|
|
4237
4261
|
transparent: !0,
|
|
4238
4262
|
opacity: 0.6
|
|
4239
|
-
}),
|
|
4240
|
-
|
|
4263
|
+
}), m = new P.Mesh(u, p);
|
|
4264
|
+
m.rotation.x = -Math.PI / 2, m.position.y = 0, m.name = "水面(标准材质)", m.userData.isWater = !0, m.userData.isMovable = !0, m.userData.waterSpeed = { x: c, y: A }, ze(m);
|
|
4241
4265
|
}
|
|
4242
4266
|
function Vo(r) {
|
|
4243
4267
|
return Et(!0), new Promise((e, t) => {
|
|
@@ -4305,11 +4329,11 @@ function Ko(r) {
|
|
|
4305
4329
|
{ label: "湿度", value: "65", unit: "%" },
|
|
4306
4330
|
{ label: "压力", value: "101.3", unit: "kPa" },
|
|
4307
4331
|
{ label: "名称", value: e.name || "未命名" }
|
|
4308
|
-
], n = new
|
|
4332
|
+
], n = new Gn({
|
|
4309
4333
|
title: (r == null ? void 0 : r.title) || "数据面板",
|
|
4310
4334
|
items: (r == null ? void 0 : r.items) || s
|
|
4311
4335
|
});
|
|
4312
|
-
return n.attachTo(e),
|
|
4336
|
+
return n.attachTo(e), Fn(e, n), n;
|
|
4313
4337
|
}
|
|
4314
4338
|
const Zo = {
|
|
4315
4339
|
key: 1,
|
|
@@ -4326,12 +4350,12 @@ const Zo = {
|
|
|
4326
4350
|
},
|
|
4327
4351
|
emits: ["select", "delete"],
|
|
4328
4352
|
setup(r, { emit: e }) {
|
|
4329
|
-
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((
|
|
4330
|
-
(
|
|
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((m) => m.userData.isMovable === !0))), c = Be(() => (t.version, t.node.children.filter(
|
|
4354
|
+
(m) => m.userData.isMovable === !0
|
|
4331
4355
|
))), A = Be(
|
|
4332
4356
|
() => {
|
|
4333
|
-
var
|
|
4334
|
-
return ((
|
|
4357
|
+
var m;
|
|
4358
|
+
return ((m = t.selectedObject) == null ? void 0 : m.uuid) === t.node.uuid;
|
|
4335
4359
|
}
|
|
4336
4360
|
);
|
|
4337
4361
|
ts(
|
|
@@ -4345,12 +4369,12 @@ const Zo = {
|
|
|
4345
4369
|
},
|
|
4346
4370
|
{ flush: "post" }
|
|
4347
4371
|
);
|
|
4348
|
-
const u = (
|
|
4349
|
-
|
|
4350
|
-
}, h = (
|
|
4351
|
-
|
|
4352
|
-
}, d = (
|
|
4353
|
-
return (
|
|
4372
|
+
const u = (m) => {
|
|
4373
|
+
m.stopPropagation(), s("select", t.node);
|
|
4374
|
+
}, h = (m) => {
|
|
4375
|
+
m.stopPropagation(), s("delete", t.node);
|
|
4376
|
+
}, d = (m) => m.type === "Mesh" || m.type === "Sprite" ? "🟦" : m.type === "Light" ? "💡" : "📦", p = (m) => m.name || `${m.type} (${m.id})`;
|
|
4377
|
+
return (m, f) => {
|
|
4354
4378
|
const g = ns("TreeItem", !0);
|
|
4355
4379
|
return T(), R("div", {
|
|
4356
4380
|
class: "tree-node",
|
|
@@ -4367,7 +4391,7 @@ const Zo = {
|
|
|
4367
4391
|
onClick: f[0] || (f[0] = jt((x) => ss(o)(r.node.uuid), ["stop"]))
|
|
4368
4392
|
}, ie(a.value ? "▼" : "▶"), 1)) : (T(), R("span", Zo)),
|
|
4369
4393
|
b("span", Qo, ie(d(r.node)), 1),
|
|
4370
|
-
b("span", Jo, ie(
|
|
4394
|
+
b("span", Jo, ie(p(r.node)), 1),
|
|
4371
4395
|
b("button", {
|
|
4372
4396
|
class: "tree-delete",
|
|
4373
4397
|
onClick: jt(h, ["stop"])
|
|
@@ -4420,9 +4444,9 @@ const Zo = {
|
|
|
4420
4444
|
}
|
|
4421
4445
|
function c(h) {
|
|
4422
4446
|
let d = null;
|
|
4423
|
-
return h.traverse((
|
|
4424
|
-
if (
|
|
4425
|
-
const
|
|
4447
|
+
return h.traverse((p) => {
|
|
4448
|
+
if (p.type === "Mesh" && !d) {
|
|
4449
|
+
const m = p, f = Array.isArray(m.material) ? m.material : [m.material];
|
|
4426
4450
|
for (const g of f)
|
|
4427
4451
|
if (g && (g.type === "MeshStandardMaterial" || g.type === "MeshPhongMaterial")) {
|
|
4428
4452
|
const x = g;
|
|
@@ -4437,14 +4461,14 @@ const Zo = {
|
|
|
4437
4461
|
}), d;
|
|
4438
4462
|
}
|
|
4439
4463
|
function A(h, d) {
|
|
4440
|
-
let
|
|
4441
|
-
return h.traverse((
|
|
4442
|
-
if (
|
|
4443
|
-
const f =
|
|
4464
|
+
let p = !1;
|
|
4465
|
+
return h.traverse((m) => {
|
|
4466
|
+
if (m.type === "Mesh") {
|
|
4467
|
+
const f = m, g = Array.isArray(f.material) ? f.material : [f.material];
|
|
4444
4468
|
for (const x of g)
|
|
4445
|
-
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,
|
|
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, p = !0);
|
|
4446
4470
|
}
|
|
4447
|
-
}),
|
|
4471
|
+
}), p;
|
|
4448
4472
|
}
|
|
4449
4473
|
function u() {
|
|
4450
4474
|
if (t.selectedObject) {
|
|
@@ -4473,7 +4497,7 @@ const Zo = {
|
|
|
4473
4497
|
d[14] || (d[14] = b("span", null, "X:", -1)),
|
|
4474
4498
|
E(b("input", {
|
|
4475
4499
|
type: "number",
|
|
4476
|
-
"onUpdate:modelValue": d[0] || (d[0] = (
|
|
4500
|
+
"onUpdate:modelValue": d[0] || (d[0] = (p) => r.transform.position.x = p),
|
|
4477
4501
|
step: "0.01",
|
|
4478
4502
|
onInput: n
|
|
4479
4503
|
}, null, 544), [
|
|
@@ -4487,7 +4511,7 @@ const Zo = {
|
|
|
4487
4511
|
d[15] || (d[15] = b("span", null, "Y:", -1)),
|
|
4488
4512
|
E(b("input", {
|
|
4489
4513
|
type: "number",
|
|
4490
|
-
"onUpdate:modelValue": d[1] || (d[1] = (
|
|
4514
|
+
"onUpdate:modelValue": d[1] || (d[1] = (p) => r.transform.position.y = p),
|
|
4491
4515
|
step: "0.01",
|
|
4492
4516
|
onInput: n
|
|
4493
4517
|
}, null, 544), [
|
|
@@ -4501,7 +4525,7 @@ const Zo = {
|
|
|
4501
4525
|
d[16] || (d[16] = b("span", null, "Z:", -1)),
|
|
4502
4526
|
E(b("input", {
|
|
4503
4527
|
type: "number",
|
|
4504
|
-
"onUpdate:modelValue": d[2] || (d[2] = (
|
|
4528
|
+
"onUpdate:modelValue": d[2] || (d[2] = (p) => r.transform.position.z = p),
|
|
4505
4529
|
step: "0.01",
|
|
4506
4530
|
onInput: n
|
|
4507
4531
|
}, null, 544), [
|
|
@@ -4520,7 +4544,7 @@ const Zo = {
|
|
|
4520
4544
|
d[18] || (d[18] = b("span", null, "X:", -1)),
|
|
4521
4545
|
E(b("input", {
|
|
4522
4546
|
type: "number",
|
|
4523
|
-
"onUpdate:modelValue": d[3] || (d[3] = (
|
|
4547
|
+
"onUpdate:modelValue": d[3] || (d[3] = (p) => r.transform.rotation.x = p),
|
|
4524
4548
|
step: "0.01",
|
|
4525
4549
|
onInput: n
|
|
4526
4550
|
}, null, 544), [
|
|
@@ -4534,7 +4558,7 @@ const Zo = {
|
|
|
4534
4558
|
d[19] || (d[19] = b("span", null, "Y:", -1)),
|
|
4535
4559
|
E(b("input", {
|
|
4536
4560
|
type: "number",
|
|
4537
|
-
"onUpdate:modelValue": d[4] || (d[4] = (
|
|
4561
|
+
"onUpdate:modelValue": d[4] || (d[4] = (p) => r.transform.rotation.y = p),
|
|
4538
4562
|
step: "0.01",
|
|
4539
4563
|
onInput: n
|
|
4540
4564
|
}, null, 544), [
|
|
@@ -4548,7 +4572,7 @@ const Zo = {
|
|
|
4548
4572
|
d[20] || (d[20] = b("span", null, "Z:", -1)),
|
|
4549
4573
|
E(b("input", {
|
|
4550
4574
|
type: "number",
|
|
4551
|
-
"onUpdate:modelValue": d[5] || (d[5] = (
|
|
4575
|
+
"onUpdate:modelValue": d[5] || (d[5] = (p) => r.transform.rotation.z = p),
|
|
4552
4576
|
step: "0.01",
|
|
4553
4577
|
onInput: n
|
|
4554
4578
|
}, null, 544), [
|
|
@@ -4567,7 +4591,7 @@ const Zo = {
|
|
|
4567
4591
|
d[22] || (d[22] = b("span", null, "X:", -1)),
|
|
4568
4592
|
E(b("input", {
|
|
4569
4593
|
type: "number",
|
|
4570
|
-
"onUpdate:modelValue": d[6] || (d[6] = (
|
|
4594
|
+
"onUpdate:modelValue": d[6] || (d[6] = (p) => r.transform.scale.x = p),
|
|
4571
4595
|
step: "0.01",
|
|
4572
4596
|
onInput: n
|
|
4573
4597
|
}, null, 544), [
|
|
@@ -4581,7 +4605,7 @@ const Zo = {
|
|
|
4581
4605
|
d[23] || (d[23] = b("span", null, "Y:", -1)),
|
|
4582
4606
|
E(b("input", {
|
|
4583
4607
|
type: "number",
|
|
4584
|
-
"onUpdate:modelValue": d[7] || (d[7] = (
|
|
4608
|
+
"onUpdate:modelValue": d[7] || (d[7] = (p) => r.transform.scale.y = p),
|
|
4585
4609
|
step: "0.01",
|
|
4586
4610
|
onInput: n
|
|
4587
4611
|
}, null, 544), [
|
|
@@ -4595,7 +4619,7 @@ const Zo = {
|
|
|
4595
4619
|
d[24] || (d[24] = b("span", null, "Z:", -1)),
|
|
4596
4620
|
E(b("input", {
|
|
4597
4621
|
type: "number",
|
|
4598
|
-
"onUpdate:modelValue": d[8] || (d[8] = (
|
|
4622
|
+
"onUpdate:modelValue": d[8] || (d[8] = (p) => r.transform.scale.z = p),
|
|
4599
4623
|
step: "0.01",
|
|
4600
4624
|
onInput: n
|
|
4601
4625
|
}, null, 544), [
|
|
@@ -4617,7 +4641,7 @@ const Zo = {
|
|
|
4617
4641
|
min: "0",
|
|
4618
4642
|
max: "10",
|
|
4619
4643
|
step: "0.1",
|
|
4620
|
-
"onUpdate:modelValue": d[9] || (d[9] = (
|
|
4644
|
+
"onUpdate:modelValue": d[9] || (d[9] = (p) => a.intensity = p),
|
|
4621
4645
|
onInput: l
|
|
4622
4646
|
}, null, 544), [
|
|
4623
4647
|
[
|
|
@@ -4632,7 +4656,7 @@ const Zo = {
|
|
|
4632
4656
|
min: "0",
|
|
4633
4657
|
max: "100",
|
|
4634
4658
|
step: "0.1",
|
|
4635
|
-
"onUpdate:modelValue": d[10] || (d[10] = (
|
|
4659
|
+
"onUpdate:modelValue": d[10] || (d[10] = (p) => a.intensity = p),
|
|
4636
4660
|
class: "intensity-input",
|
|
4637
4661
|
onInput: l
|
|
4638
4662
|
}, null, 544), [
|
|
@@ -4654,7 +4678,7 @@ const Zo = {
|
|
|
4654
4678
|
min: "0",
|
|
4655
4679
|
max: "1",
|
|
4656
4680
|
step: "0.01",
|
|
4657
|
-
"onUpdate:modelValue": d[11] || (d[11] = (
|
|
4681
|
+
"onUpdate:modelValue": d[11] || (d[11] = (p) => i.metalness = p),
|
|
4658
4682
|
onInput: u
|
|
4659
4683
|
}, null, 544), [
|
|
4660
4684
|
[
|
|
@@ -4673,7 +4697,7 @@ const Zo = {
|
|
|
4673
4697
|
min: "0",
|
|
4674
4698
|
max: "1",
|
|
4675
4699
|
step: "0.01",
|
|
4676
|
-
"onUpdate:modelValue": d[12] || (d[12] = (
|
|
4700
|
+
"onUpdate:modelValue": d[12] || (d[12] = (p) => i.roughness = p),
|
|
4677
4701
|
onInput: u
|
|
4678
4702
|
}, null, 544), [
|
|
4679
4703
|
[
|
|
@@ -4692,7 +4716,7 @@ const Zo = {
|
|
|
4692
4716
|
min: "0",
|
|
4693
4717
|
max: "1",
|
|
4694
4718
|
step: "0.01",
|
|
4695
|
-
"onUpdate:modelValue": d[13] || (d[13] = (
|
|
4719
|
+
"onUpdate:modelValue": d[13] || (d[13] = (p) => i.opacity = p),
|
|
4696
4720
|
onInput: u
|
|
4697
4721
|
}, null, 544), [
|
|
4698
4722
|
[
|
|
@@ -4718,10 +4742,10 @@ const Zo = {
|
|
|
4718
4742
|
}, Dr = { class: "ud-value-json-preview" }, Pr = ["onClick"], Tr = {
|
|
4719
4743
|
key: 0,
|
|
4720
4744
|
class: "ud-json-error"
|
|
4721
|
-
}, Or = { class: "ud-json-actions" }, Er = ["onClick"], Rr = ["onClick"],
|
|
4745
|
+
}, Or = { class: "ud-json-actions" }, Er = ["onClick"], Rr = ["onClick"], Hr = {
|
|
4722
4746
|
key: 1,
|
|
4723
4747
|
class: "userdata-empty"
|
|
4724
|
-
},
|
|
4748
|
+
}, Sr = /* @__PURE__ */ be({
|
|
4725
4749
|
__name: "UserDataTab",
|
|
4726
4750
|
props: {
|
|
4727
4751
|
selectedObject: {}
|
|
@@ -4778,7 +4802,7 @@ const Zo = {
|
|
|
4778
4802
|
function d(C) {
|
|
4779
4803
|
return C.length <= 28 ? C : C.substring(0, 28) + "…";
|
|
4780
4804
|
}
|
|
4781
|
-
function
|
|
4805
|
+
function p(C) {
|
|
4782
4806
|
n.value = C;
|
|
4783
4807
|
const y = e.selectedObject;
|
|
4784
4808
|
if (!y) return;
|
|
@@ -4788,9 +4812,9 @@ const Zo = {
|
|
|
4788
4812
|
} catch {
|
|
4789
4813
|
i.value = String(w);
|
|
4790
4814
|
}
|
|
4791
|
-
|
|
4815
|
+
m();
|
|
4792
4816
|
}
|
|
4793
|
-
function
|
|
4817
|
+
function m() {
|
|
4794
4818
|
const C = i.value.trim();
|
|
4795
4819
|
if (!C) {
|
|
4796
4820
|
o.value = null;
|
|
@@ -4845,7 +4869,7 @@ const Zo = {
|
|
|
4845
4869
|
"onUpdate:modelValue": y[0] || (y[0] = (w) => t.value = w),
|
|
4846
4870
|
placeholder: "属性名",
|
|
4847
4871
|
class: "ud-input",
|
|
4848
|
-
onKeyup:
|
|
4872
|
+
onKeyup: Se(u, ["enter"])
|
|
4849
4873
|
}, null, 544), [
|
|
4850
4874
|
[N, t.value]
|
|
4851
4875
|
]),
|
|
@@ -4853,7 +4877,7 @@ const Zo = {
|
|
|
4853
4877
|
"onUpdate:modelValue": y[1] || (y[1] = (w) => s.value = w),
|
|
4854
4878
|
placeholder: "值",
|
|
4855
4879
|
class: "ud-input ud-textarea",
|
|
4856
|
-
onKeyup:
|
|
4880
|
+
onKeyup: Se(jt(u, ["prevent"]), ["enter"])
|
|
4857
4881
|
}, null, 40, xr), [
|
|
4858
4882
|
[N, s.value]
|
|
4859
4883
|
]),
|
|
@@ -4878,15 +4902,15 @@ const Zo = {
|
|
|
4878
4902
|
b("button", {
|
|
4879
4903
|
class: "ud-btn edit-json-btn",
|
|
4880
4904
|
title: "编辑对象",
|
|
4881
|
-
onClick: (
|
|
4905
|
+
onClick: (H) => p(w.key)
|
|
4882
4906
|
}, " ✎ ", 8, Pr)
|
|
4883
4907
|
], 64)) : (T(), R(ve, { key: 1 }, [
|
|
4884
4908
|
o.value ? (T(), R("div", Tr, " ⚠ " + ie(o.value), 1)) : X("", !0),
|
|
4885
4909
|
E(b("textarea", {
|
|
4886
|
-
"onUpdate:modelValue": y[2] || (y[2] = (
|
|
4910
|
+
"onUpdate:modelValue": y[2] || (y[2] = (H) => i.value = H),
|
|
4887
4911
|
class: se(["ud-json-textarea", { "has-error": o.value }]),
|
|
4888
4912
|
rows: "3",
|
|
4889
|
-
onInput:
|
|
4913
|
+
onInput: m
|
|
4890
4914
|
}, null, 34), [
|
|
4891
4915
|
[N, i.value]
|
|
4892
4916
|
]),
|
|
@@ -4894,7 +4918,7 @@ const Zo = {
|
|
|
4894
4918
|
b("button", {
|
|
4895
4919
|
class: "ud-btn apply-btn",
|
|
4896
4920
|
title: "应用修改",
|
|
4897
|
-
onClick: (
|
|
4921
|
+
onClick: (H) => f(w.key)
|
|
4898
4922
|
}, " ✓ ", 8, Er),
|
|
4899
4923
|
b("button", {
|
|
4900
4924
|
class: "ud-btn cancel-btn",
|
|
@@ -4907,11 +4931,11 @@ const Zo = {
|
|
|
4907
4931
|
key: 2,
|
|
4908
4932
|
class: "ud-btn del-btn",
|
|
4909
4933
|
title: "删除",
|
|
4910
|
-
onClick: (
|
|
4934
|
+
onClick: (H) => h(w.key)
|
|
4911
4935
|
}, " ✕ ", 8, Rr)) : X("", !0)
|
|
4912
4936
|
], 64)) : X("", !0)
|
|
4913
4937
|
], 2))), 128))
|
|
4914
|
-
])) : (T(), R("div",
|
|
4938
|
+
])) : (T(), R("div", Hr, "暂无自定义数据")),
|
|
4915
4939
|
b("button", {
|
|
4916
4940
|
class: "get-camera-btn",
|
|
4917
4941
|
onClick: x
|
|
@@ -4919,7 +4943,7 @@ const Zo = {
|
|
|
4919
4943
|
])
|
|
4920
4944
|
]));
|
|
4921
4945
|
}
|
|
4922
|
-
}), Lr = /* @__PURE__ */ Ie(
|
|
4946
|
+
}), Lr = /* @__PURE__ */ Ie(Sr, [["__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({
|
|
4923
4947
|
__name: "DataPanelTab",
|
|
4924
4948
|
props: {
|
|
4925
4949
|
selectedObject: {}
|
|
@@ -4928,20 +4952,20 @@ const Zo = {
|
|
|
4928
4952
|
const e = r, t = j(""), s = j([]), n = j(!0), i = j(""), o = j(""), a = j(""), l = j("");
|
|
4929
4953
|
let c = u(), A = !1;
|
|
4930
4954
|
function u() {
|
|
4931
|
-
const
|
|
4932
|
-
return
|
|
4955
|
+
const m = e.selectedObject;
|
|
4956
|
+
return m ? Zt(xt(m)) : null;
|
|
4933
4957
|
}
|
|
4934
|
-
Me(n, (
|
|
4935
|
-
A || !c || (c.visible =
|
|
4958
|
+
Me(n, (m) => {
|
|
4959
|
+
A || !c || (c.visible = m);
|
|
4936
4960
|
});
|
|
4937
4961
|
function h() {
|
|
4938
4962
|
A || !c || (c.setTitle(t.value), c.setItems([...s.value]));
|
|
4939
4963
|
}
|
|
4940
4964
|
Me(t, () => h()), Me(s, () => h(), { deep: !0 });
|
|
4941
|
-
function d(
|
|
4942
|
-
s.value = s.value.filter((f, g) => g !==
|
|
4965
|
+
function d(m) {
|
|
4966
|
+
s.value = s.value.filter((f, g) => g !== m), h();
|
|
4943
4967
|
}
|
|
4944
|
-
function
|
|
4968
|
+
function p() {
|
|
4945
4969
|
!i.value.trim() || !o.value.trim() || (s.value = [
|
|
4946
4970
|
...s.value,
|
|
4947
4971
|
{
|
|
@@ -4960,7 +4984,7 @@ const Zo = {
|
|
|
4960
4984
|
}, 0);
|
|
4961
4985
|
},
|
|
4962
4986
|
{ immediate: !0 }
|
|
4963
|
-
), (
|
|
4987
|
+
), (m, f) => (T(), R("div", Nr, [
|
|
4964
4988
|
b("div", jr, [
|
|
4965
4989
|
f[10] || (f[10] = b("label", null, "📊 数据面板", -1)),
|
|
4966
4990
|
b("div", kr, [
|
|
@@ -5041,7 +5065,7 @@ const Zo = {
|
|
|
5041
5065
|
class: "dp-input dp-input-sm",
|
|
5042
5066
|
"onUpdate:modelValue": f[2] || (f[2] = (g) => i.value = g),
|
|
5043
5067
|
placeholder: "标签",
|
|
5044
|
-
onKeyup:
|
|
5068
|
+
onKeyup: Se(p, ["enter"])
|
|
5045
5069
|
}, null, 544), [
|
|
5046
5070
|
[N, i.value]
|
|
5047
5071
|
]),
|
|
@@ -5050,7 +5074,7 @@ const Zo = {
|
|
|
5050
5074
|
class: "dp-input dp-input-sm",
|
|
5051
5075
|
"onUpdate:modelValue": f[3] || (f[3] = (g) => o.value = g),
|
|
5052
5076
|
placeholder: "值",
|
|
5053
|
-
onKeyup:
|
|
5077
|
+
onKeyup: Se(p, ["enter"])
|
|
5054
5078
|
}, null, 544), [
|
|
5055
5079
|
[N, o.value]
|
|
5056
5080
|
]),
|
|
@@ -5059,7 +5083,7 @@ const Zo = {
|
|
|
5059
5083
|
class: "dp-input dp-input-xs",
|
|
5060
5084
|
"onUpdate:modelValue": f[4] || (f[4] = (g) => a.value = g),
|
|
5061
5085
|
placeholder: "单位",
|
|
5062
|
-
onKeyup:
|
|
5086
|
+
onKeyup: Se(p, ["enter"])
|
|
5063
5087
|
}, null, 544), [
|
|
5064
5088
|
[N, a.value]
|
|
5065
5089
|
]),
|
|
@@ -5068,13 +5092,13 @@ const Zo = {
|
|
|
5068
5092
|
class: "dp-input dp-input-xs",
|
|
5069
5093
|
"onUpdate:modelValue": f[5] || (f[5] = (g) => l.value = g),
|
|
5070
5094
|
placeholder: "编码",
|
|
5071
|
-
onKeyup:
|
|
5095
|
+
onKeyup: Se(p, ["enter"])
|
|
5072
5096
|
}, null, 544), [
|
|
5073
5097
|
[N, l.value]
|
|
5074
5098
|
]),
|
|
5075
5099
|
b("button", {
|
|
5076
5100
|
class: "dp-btn dp-btn-add",
|
|
5077
|
-
onClick:
|
|
5101
|
+
onClick: p,
|
|
5078
5102
|
title: "添加"
|
|
5079
5103
|
}, "+")
|
|
5080
5104
|
])
|
|
@@ -5128,65 +5152,65 @@ const $r = {
|
|
|
5128
5152
|
emits: ["propertyChange", "treeSelect", "treeDelete", "transformModeChange"],
|
|
5129
5153
|
setup(r, { emit: e }) {
|
|
5130
5154
|
const t = r, s = e, n = j("translate");
|
|
5131
|
-
function i(
|
|
5132
|
-
n.value =
|
|
5155
|
+
function i(p) {
|
|
5156
|
+
n.value = p, s("transformModeChange", p);
|
|
5133
5157
|
}
|
|
5134
5158
|
const o = () => s("propertyChange"), a = j("transform"), l = Be(() => {
|
|
5135
|
-
var
|
|
5136
|
-
return !!(t.selectedObject && ((
|
|
5159
|
+
var p;
|
|
5160
|
+
return !!(t.selectedObject && ((p = t.selectedObject.userData) != null && p._hasDataPanel));
|
|
5137
5161
|
}), c = j(0), A = os(t, "selectedObject"), { expandedSet: u, toggleExpand: h } = _r(A);
|
|
5138
5162
|
rs("treeExpand", { expandedSet: u, toggleExpand: h });
|
|
5139
|
-
const d = (
|
|
5140
|
-
c.value++, s("treeDelete",
|
|
5163
|
+
const d = (p) => {
|
|
5164
|
+
c.value++, s("treeDelete", p);
|
|
5141
5165
|
};
|
|
5142
|
-
return (
|
|
5166
|
+
return (p, m) => r.transform ? (T(), R("div", $r, [
|
|
5143
5167
|
b("div", ea, [
|
|
5144
|
-
|
|
5168
|
+
m[7] || (m[7] = b("label", null, "场景物体", -1)),
|
|
5145
5169
|
b("div", ta, [
|
|
5146
5170
|
(T(!0), R(ve, null, wt(r.treeData, (f) => (T(), Ke(er, {
|
|
5147
5171
|
key: f.uuid,
|
|
5148
5172
|
node: f,
|
|
5149
5173
|
"selected-object": r.selectedObject,
|
|
5150
5174
|
version: c.value,
|
|
5151
|
-
onSelect:
|
|
5175
|
+
onSelect: m[0] || (m[0] = (g) => s("treeSelect", g)),
|
|
5152
5176
|
onDelete: d
|
|
5153
5177
|
}, null, 8, ["node", "selected-object", "version"]))), 128)),
|
|
5154
5178
|
r.treeData.length === 0 ? (T(), R("div", na, "暂无物体")) : X("", !0)
|
|
5155
5179
|
])
|
|
5156
5180
|
]),
|
|
5157
5181
|
b("div", sa, [
|
|
5158
|
-
|
|
5182
|
+
m[8] || (m[8] = b("label", null, "全局属性", -1)),
|
|
5159
5183
|
b("div", ia, [
|
|
5160
5184
|
b("button", {
|
|
5161
5185
|
class: se(["mode-btn", { active: n.value === "translate" }]),
|
|
5162
5186
|
title: "移动 (W)",
|
|
5163
|
-
onClick:
|
|
5187
|
+
onClick: m[1] || (m[1] = (f) => i("translate"))
|
|
5164
5188
|
}, " ↕ 移动 ", 2),
|
|
5165
5189
|
b("button", {
|
|
5166
5190
|
class: se(["mode-btn", { active: n.value === "rotate" }]),
|
|
5167
5191
|
title: "旋转 (E)",
|
|
5168
|
-
onClick:
|
|
5192
|
+
onClick: m[2] || (m[2] = (f) => i("rotate"))
|
|
5169
5193
|
}, " ↻ 旋转 ", 2),
|
|
5170
5194
|
b("button", {
|
|
5171
5195
|
class: se(["mode-btn", { active: n.value === "scale" }]),
|
|
5172
5196
|
title: "缩放 (R)",
|
|
5173
|
-
onClick:
|
|
5197
|
+
onClick: m[3] || (m[3] = (f) => i("scale"))
|
|
5174
5198
|
}, " ⤡ 缩放 ", 2)
|
|
5175
5199
|
])
|
|
5176
5200
|
]),
|
|
5177
5201
|
r.selectedObject ? (T(), R("div", oa, [
|
|
5178
5202
|
b("button", {
|
|
5179
5203
|
class: se(["tab-btn", { active: a.value === "transform" }]),
|
|
5180
|
-
onClick:
|
|
5204
|
+
onClick: m[4] || (m[4] = (f) => a.value = "transform")
|
|
5181
5205
|
}, " 🔄 变换 ", 2),
|
|
5182
5206
|
b("button", {
|
|
5183
5207
|
class: se(["tab-btn", { active: a.value === "userdata" }]),
|
|
5184
|
-
onClick:
|
|
5208
|
+
onClick: m[5] || (m[5] = (f) => a.value = "userdata")
|
|
5185
5209
|
}, " 📋 自定义数据 ", 2),
|
|
5186
5210
|
l.value ? (T(), R("button", {
|
|
5187
5211
|
key: 0,
|
|
5188
5212
|
class: se(["tab-btn", { active: a.value === "datapanel" }]),
|
|
5189
|
-
onClick:
|
|
5213
|
+
onClick: m[6] || (m[6] = (f) => a.value = "datapanel")
|
|
5190
5214
|
}, " 📊 数据面板 ", 2)) : X("", !0)
|
|
5191
5215
|
])) : X("", !0),
|
|
5192
5216
|
r.selectedObject ? (T(), R("div", ra, [
|
|
@@ -5204,7 +5228,7 @@ const $r = {
|
|
|
5204
5228
|
[De, a.value === "datapanel"]
|
|
5205
5229
|
])
|
|
5206
5230
|
])) : X("", !0)
|
|
5207
|
-
])) : (T(), R("div", aa, [...
|
|
5231
|
+
])) : (T(), R("div", aa, [...m[9] || (m[9] = [
|
|
5208
5232
|
b("p", null, "未选中任何模型", -1)
|
|
5209
5233
|
])]));
|
|
5210
5234
|
}
|
|
@@ -5213,19 +5237,19 @@ const $r = {
|
|
|
5213
5237
|
emits: ["addModel", "importModel"],
|
|
5214
5238
|
setup(r, { emit: e }) {
|
|
5215
5239
|
const t = j(!1), s = j(!1), n = j(!1), i = j(!1), o = e, a = j(null), l = () => {
|
|
5216
|
-
var
|
|
5217
|
-
return (
|
|
5218
|
-
}, c = (
|
|
5219
|
-
const f =
|
|
5240
|
+
var m;
|
|
5241
|
+
return (m = a.value) == null ? void 0 : m.click();
|
|
5242
|
+
}, c = (m) => {
|
|
5243
|
+
const f = m.target;
|
|
5220
5244
|
f.files && f.files.length > 0 && (o("importModel", f.files[0]), f.value = "");
|
|
5221
5245
|
}, A = () => console.log("撤销"), u = () => console.log("删除物体"), h = async () => {
|
|
5222
|
-
const
|
|
5223
|
-
console.log(JSON.parse(await
|
|
5246
|
+
const m = Ki();
|
|
5247
|
+
console.log(JSON.parse(await m));
|
|
5224
5248
|
}, d = () => {
|
|
5225
5249
|
if (!localStorage.getItem("test_id")) return localStorage.setItem("test_id", "123");
|
|
5226
5250
|
Ei(localStorage.getItem("test_id"));
|
|
5227
|
-
},
|
|
5228
|
-
return (
|
|
5251
|
+
}, p = () => qn();
|
|
5252
|
+
return (m, f) => (T(), R("div", ua, [
|
|
5229
5253
|
b("div", Aa, [
|
|
5230
5254
|
b("div", {
|
|
5231
5255
|
class: "dropdown-wrapper",
|
|
@@ -5309,7 +5333,7 @@ const $r = {
|
|
|
5309
5333
|
}, "镜头拉近"),
|
|
5310
5334
|
b("div", {
|
|
5311
5335
|
class: "menu-item",
|
|
5312
|
-
onClick:
|
|
5336
|
+
onClick: p
|
|
5313
5337
|
}, " 重置相机位置 ")
|
|
5314
5338
|
], 512), [
|
|
5315
5339
|
[De, t.value]
|
|
@@ -5355,7 +5379,7 @@ const $r = {
|
|
|
5355
5379
|
Ti((g) => {
|
|
5356
5380
|
t.value = g;
|
|
5357
5381
|
});
|
|
5358
|
-
const s =
|
|
5382
|
+
const s = $t(null), n = kt({
|
|
5359
5383
|
position: { x: 0, y: 0, z: 0 },
|
|
5360
5384
|
rotation: { x: 0, y: 0, z: 0 },
|
|
5361
5385
|
scale: { x: 1, y: 1, z: 1 }
|
|
@@ -5388,20 +5412,20 @@ const $r = {
|
|
|
5388
5412
|
} catch (x) {
|
|
5389
5413
|
console.error("导入失败:", x), alert("导入失败:" + x.message);
|
|
5390
5414
|
}
|
|
5391
|
-
}, A =
|
|
5415
|
+
}, A = $t([]);
|
|
5392
5416
|
Bi((g) => {
|
|
5393
5417
|
A.value = g;
|
|
5394
5418
|
});
|
|
5395
5419
|
const u = () => {
|
|
5396
5420
|
const g = Ui();
|
|
5397
5421
|
g && (A.value = g);
|
|
5398
|
-
}, h = (g) => Qt(g), d = (g) => Wi(g.uuid),
|
|
5422
|
+
}, h = (g) => Qt(g), d = (g) => Wi(g.uuid), p = (g) => {
|
|
5399
5423
|
Oi(g);
|
|
5400
|
-
},
|
|
5401
|
-
|
|
5424
|
+
}, m = j(null), f = () => {
|
|
5425
|
+
m.value && Ii(m.value, e.mode, e.sceneData), u();
|
|
5402
5426
|
};
|
|
5403
5427
|
return as(() => {
|
|
5404
|
-
f(),
|
|
5428
|
+
f(), m.value && fi(m.value);
|
|
5405
5429
|
}), ls(() => {
|
|
5406
5430
|
console.log("endset_three_editor destroy"), Qi();
|
|
5407
5431
|
}), (g, x) => (T(), R("div", Ca, [
|
|
@@ -5420,7 +5444,7 @@ const $r = {
|
|
|
5420
5444
|
b("div", {
|
|
5421
5445
|
class: se(`canvas canvas-mode-${r.mode}`),
|
|
5422
5446
|
ref_key: "containerRef",
|
|
5423
|
-
ref:
|
|
5447
|
+
ref: m
|
|
5424
5448
|
}, null, 2),
|
|
5425
5449
|
r.mode === "edit" ? (T(), Ke(ca, {
|
|
5426
5450
|
key: 0,
|
|
@@ -5430,17 +5454,17 @@ const $r = {
|
|
|
5430
5454
|
onPropertyChange: a,
|
|
5431
5455
|
onTreeSelect: h,
|
|
5432
5456
|
onTreeDelete: d,
|
|
5433
|
-
onTransformModeChange:
|
|
5457
|
+
onTransformModeChange: p
|
|
5434
5458
|
}, null, 8, ["transform", "tree-data", "selected-object"])) : X("", !0)
|
|
5435
5459
|
], 2),
|
|
5436
5460
|
r.mode === "edit" ? (T(), Ke(ya, { key: 2 })) : X("", !0)
|
|
5437
5461
|
]));
|
|
5438
5462
|
}
|
|
5439
|
-
}),
|
|
5463
|
+
}), Ha = /* @__PURE__ */ Ie(wa, [["__scopeId", "data-v-ffa5f5c1"]]);
|
|
5440
5464
|
export {
|
|
5441
5465
|
ya as BottomBar,
|
|
5442
|
-
|
|
5443
|
-
|
|
5466
|
+
Gn as DataPanel,
|
|
5467
|
+
Ha as DrawingBoard,
|
|
5444
5468
|
ca as PropertyPanel,
|
|
5445
5469
|
ga as TopBar,
|
|
5446
5470
|
er as TreeItem,
|
|
@@ -5455,7 +5479,7 @@ export {
|
|
|
5455
5479
|
Qi as destroyEditor,
|
|
5456
5480
|
gi as disposeCSS2DRenderer,
|
|
5457
5481
|
Ki as exportSceneToJSON,
|
|
5458
|
-
|
|
5482
|
+
Si as focusOnObject,
|
|
5459
5483
|
Ta as getCSS2DRenderer,
|
|
5460
5484
|
Yi as getCamera,
|
|
5461
5485
|
Zt as getDataPanel,
|
|
@@ -5464,7 +5488,7 @@ export {
|
|
|
5464
5488
|
Ui as getSceneObjects,
|
|
5465
5489
|
Vi as getSelectedObject,
|
|
5466
5490
|
Vo as importModelFromFile,
|
|
5467
|
-
|
|
5491
|
+
qn as initDefaultMainCamera,
|
|
5468
5492
|
Ii as initEditor,
|
|
5469
5493
|
Zi as loadSceneFromJSON,
|
|
5470
5494
|
Bi as onSceneObjectsChangeCallback,
|