endset_three_editor 0.4.1 → 0.4.3
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 He, vModelCheckbox as is, toRef as os, provide as rs, createVNode as Dt, vShow as De, shallowRef as
|
|
4
|
+
import { toRaw as xt, defineComponent as be, ref as j, inject as es, computed as Be, watchEffect as ts, resolveComponent as ns, openBlock as T, createElementBlock as R, createElementVNode as b, normalizeClass as se, withModifiers as jt, unref as ss, toDisplayString as ie, Fragment as ve, renderList as wt, createBlock as Ke, createCommentVNode as X, reactive as kt, watch as Me, withDirectives as E, vModelText as N, withKeys as He, vModelCheckbox as is, toRef as os, provide as rs, createVNode as Dt, vShow as De, shallowRef as $t, onMounted as as, onBeforeUnmount as ls } from "vue";
|
|
5
5
|
import * as P from "three";
|
|
6
|
-
import { Controls as
|
|
6
|
+
import { Controls as On, Vector3 as M, MOUSE as Ne, TOUCH as Le, Quaternion as K, Spherical as en, Vector2 as Y, Ray as cs, Plane as us, MathUtils as En, Raycaster as As, Object3D as ke, MeshBasicMaterial as Pe, LineBasicMaterial as Ze, CylinderGeometry as U, BoxGeometry as q, BufferGeometry as We, Float32BufferAttribute as pe, Mesh as v, OctahedronGeometry as lt, Line as ue, TorusGeometry as Ge, SphereGeometry as ds, Euler as hs, Matrix4 as me, PlaneGeometry as fs, DoubleSide as Rn, Loader as Yt, FileLoader as tt, Color as de, SRGBColorSpace as Ae, Group as ft, Material as Qe, PointsMaterial as Ue, MeshPhongMaterial as ps, LineSegments as Wt, Points as pt, TrianglesDrawMode as ms, TriangleFanDrawMode as zt, TriangleStripDrawMode as Sn, LoaderUtils as Je, MeshPhysicalMaterial as le, LinearSRGBColorSpace as ae, SpotLight as gs, PointLight as bs, DirectionalLight as Is, InstancedMesh as ys, InstancedBufferAttribute as Cs, TextureLoader as xs, ImageBitmapLoader as ws, BufferAttribute as _e, InterleavedBuffer as Hn, InterleavedBufferAttribute as Ln, LinearMipmapLinearFilter as Nn, NearestMipmapLinearFilter as vs, LinearMipmapNearestFilter as Ms, NearestMipmapNearestFilter as Ds, LinearFilter as Gt, NearestFilter as jn, RepeatWrapping as Ft, MirroredRepeatWrapping as Ps, ClampToEdgeWrapping as Ts, MeshStandardMaterial as kn, PropertyBinding as Os, SkinnedMesh as Es, LineLoop as Rs, PerspectiveCamera as Ss, OrthographicCamera as Hs, Skeleton as Ls, AnimationClip as Ns, Bone as js, InterpolateDiscrete as ks, InterpolateLinear as Wn, Texture as tn, VectorKeyframeTrack as nn, NumberKeyframeTrack as sn, QuaternionKeyframeTrack as on, ColorManagement as qt, FrontSide as Ws, Interpolant as zs, Box3 as Gs, Sphere as Fs } from "three";
|
|
7
7
|
import nt from "@tweenjs/tween.js";
|
|
8
|
-
const
|
|
8
|
+
const rn = { type: "change" }, Kt = { type: "start" }, zn = { type: "end" }, ct = new cs(), an = new us(), qs = Math.cos(70 * En.DEG2RAD), G = new M(), V = 2 * Math.PI, H = {
|
|
9
9
|
NONE: -1,
|
|
10
10
|
ROTATE: 0,
|
|
11
11
|
DOLLY: 1,
|
|
@@ -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 = H.NONE, this.target = new M(), this.cursor = new M(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Ne.ROTATE, MIDDLE: Ne.DOLLY, RIGHT: Ne.PAN }, this.touches = { ONE: Le.ROTATE, TWO: Le.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new M(), this._lastQuaternion = new K(), this._lastTargetPosition = new M(), this._quat = new K().setFromUnitVectors(e.up, new M(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new
|
|
26
|
+
super(e, t), this.state = H.NONE, this.target = new M(), this.cursor = new M(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Ne.ROTATE, MIDDLE: Ne.DOLLY, RIGHT: Ne.PAN }, this.touches = { ONE: Le.ROTATE, TWO: Le.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new M(), this._lastQuaternion = new K(), this._lastTargetPosition = new M(), this._quat = new K().setFromUnitVectors(e.up, new M(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new en(), this._sphericalDelta = new en(), this._scale = 1, this._panOffset = new M(), this._rotateStart = new Y(), this._rotateEnd = new Y(), this._rotateDelta = new Y(), this._panStart = new Y(), this._panEnd = new Y(), this._panDelta = new Y(), this._dollyStart = new Y(), this._dollyEnd = new Y(), this._dollyDelta = new Y(), this._dollyDirection = new M(), this._mouse = new Y(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Us.bind(this), this._onPointerDown = Bs.bind(this), this._onPointerUp = Vs.bind(this), this._onContextMenu = $s.bind(this), this._onMouseWheel = Zs.bind(this), this._onKeyDown = Qs.bind(this), this._onTouchStart = Js.bind(this), this._onTouchMove = _s.bind(this), this._onMouseDown = Ys.bind(this), this._onMouseMove = Ks.bind(this), this._interceptControlDown = ei.bind(this), this._interceptControlUp = ti.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Defines the visual representation of the cursor.
|
|
@@ -96,7 +96,7 @@ class Xs extends 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 = H.NONE;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Programmatically pan the camera.
|
|
@@ -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 = H.NONE, this._cursorStyle === "grab" && (this.domElement.style.cursor = "grab");
|
|
377
377
|
break;
|
|
378
378
|
case 1:
|
|
379
379
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -441,7 +441,7 @@ function Ks(r) {
|
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
function Zs(r) {
|
|
444
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== H.NONE || (r.preventDefault(), this.dispatchEvent(Kt), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(
|
|
444
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== H.NONE || (r.preventDefault(), this.dispatchEvent(Kt), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(zn));
|
|
445
445
|
}
|
|
446
446
|
function Qs(r) {
|
|
447
447
|
this.enabled !== !1 && this._handleKeyDown(r);
|
|
@@ -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: [
|
|
@@ -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,8 +1007,8 @@ 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
|
}
|
|
@@ -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 Se = new M(),
|
|
1099
|
+
const Se = new M(), pn = new me(), mn = new me(), gn = new M(), bn = new M();
|
|
1100
1100
|
class di {
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Constructs a new CSS2D renderer.
|
|
@@ -1114,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
|
-
Se.setFromMatrixPosition(
|
|
1134
|
-
const g = Se.z >= -1 && Se.z <= 1 &&
|
|
1135
|
-
x.style.display = g === !0 ? "" : "none", g === !0 && (
|
|
1132
|
+
if (p.isCSS2DObject) {
|
|
1133
|
+
Se.setFromMatrixPosition(p.matrixWorld), Se.applyMatrix4(mn);
|
|
1134
|
+
const g = Se.z >= -1 && Se.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(" + (Se.x * i + i) + "px," + (-Se.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
|
+
if (!r) {
|
|
1587
|
+
console.warn("[selectModelHandle] 传入的 objectId 为空");
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1586
1590
|
Hi(r);
|
|
1587
|
-
let e;
|
|
1588
|
-
|
|
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) {
|
|
@@ -1613,7 +1616,7 @@ function Ri(r) {
|
|
|
1613
1616
|
let o = Si(i[0].object);
|
|
1614
1617
|
Qt(o);
|
|
1615
1618
|
} else
|
|
1616
|
-
|
|
1619
|
+
Jt();
|
|
1617
1620
|
}
|
|
1618
1621
|
function Si(r) {
|
|
1619
1622
|
if (r.type === "Line") {
|
|
@@ -1629,11 +1632,21 @@ function Si(r) {
|
|
|
1629
1632
|
}
|
|
1630
1633
|
function Hi(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
|
+
let t = null;
|
|
1642
|
+
if ((d = I.scene) == null || d.traverse((p) => {
|
|
1643
|
+
p.userData.id == r && (t = p);
|
|
1644
|
+
}), !t) {
|
|
1645
|
+
console.warn(
|
|
1646
|
+
`[focusOnObject] 在场景中未找到 userData.id 为 "${r}" 的物体。请确认:1) 物体已被正确添加到场景(addModel);2) 物体的 userData.id 与传入的 objectId 一致;3) 传入的 objectId 不为空`
|
|
1647
|
+
);
|
|
1648
|
+
return;
|
|
1649
|
+
}
|
|
1637
1650
|
let s = null;
|
|
1638
1651
|
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
1652
|
const n = new P.Vector3();
|
|
@@ -1641,26 +1654,33 @@ function Hi(r, e = 500) {
|
|
|
1641
1654
|
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
1655
|
c.lengthSq() < 1e-3 && c.set(0, 0, 1);
|
|
1643
1656
|
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
|
-
|
|
1657
|
+
try {
|
|
1658
|
+
new nt.Tween({
|
|
1659
|
+
x: u.x,
|
|
1660
|
+
y: u.y,
|
|
1661
|
+
z: u.z,
|
|
1662
|
+
tx: h.x,
|
|
1663
|
+
ty: h.y,
|
|
1664
|
+
tz: h.z
|
|
1665
|
+
}).to(
|
|
1666
|
+
{
|
|
1667
|
+
x: s ? s.x : A.x,
|
|
1668
|
+
y: s ? s.y : A.y,
|
|
1669
|
+
z: s ? s.z : A.z,
|
|
1670
|
+
tx: n.x,
|
|
1671
|
+
ty: n.y,
|
|
1672
|
+
tz: n.z
|
|
1673
|
+
},
|
|
1674
|
+
e
|
|
1675
|
+
).easing(nt.Easing.Quadratic.InOut).onUpdate((p) => {
|
|
1676
|
+
I.camera.position.set(p.x, p.y, p.z), I.orbitControls.target.set(p.tx, p.ty, p.tz), I.orbitControls.update();
|
|
1677
|
+
}).start();
|
|
1678
|
+
} catch (p) {
|
|
1679
|
+
console.error(
|
|
1680
|
+
"[focusOnObject] TWEEN 动画创建失败,请检查 @tweenjs/tween.js 是否已正确安装且版本兼容(^23.1.3):",
|
|
1681
|
+
p
|
|
1682
|
+
);
|
|
1683
|
+
}
|
|
1664
1684
|
}
|
|
1665
1685
|
function Li(r) {
|
|
1666
1686
|
r.userData.id && st.set(String(r.userData.id), r);
|
|
@@ -1680,7 +1700,7 @@ function ze(r, e = !1) {
|
|
|
1680
1700
|
I.scene.add(r), r.userData.isMovable && (zi(r), vt()), e && I.mode === "edit" && Qt(r);
|
|
1681
1701
|
}
|
|
1682
1702
|
function ki(r) {
|
|
1683
|
-
I.selectedObject === r &&
|
|
1703
|
+
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
1704
|
}
|
|
1685
1705
|
function Wi(r) {
|
|
1686
1706
|
const e = I.scene.getObjectByProperty("uuid", r);
|
|
@@ -1736,7 +1756,7 @@ function Ra() {
|
|
|
1736
1756
|
}
|
|
1737
1757
|
async function Ki() {
|
|
1738
1758
|
var c, A, u;
|
|
1739
|
-
J == null || J(!0), await new Promise((h) => setTimeout(h, 50)),
|
|
1759
|
+
J == null || J(!0), await new Promise((h) => setTimeout(h, 50)), Jt();
|
|
1740
1760
|
const r = I.scene;
|
|
1741
1761
|
if (!r)
|
|
1742
1762
|
return J == null || J(!1), "{}";
|
|
@@ -1744,12 +1764,12 @@ async function Ki() {
|
|
|
1744
1764
|
r.traverse((h) => {
|
|
1745
1765
|
var d;
|
|
1746
1766
|
if (h.userData.type === "lightHelper" && e.push(h), h.type === "DirectionalLight" && h.userData.helper && (t.set(h, h.userData.helper), h.userData.helper = void 0), h.name && h.name.startsWith("DataPanel_")) {
|
|
1747
|
-
const
|
|
1748
|
-
if (
|
|
1749
|
-
const
|
|
1767
|
+
const p = h;
|
|
1768
|
+
if (p.element) {
|
|
1769
|
+
const m = p.element.querySelector(
|
|
1750
1770
|
"[data-panel-title]"
|
|
1751
1771
|
), f = [];
|
|
1752
|
-
|
|
1772
|
+
p.element.querySelectorAll(
|
|
1753
1773
|
".css2d-data-panel-item"
|
|
1754
1774
|
).forEach((x) => {
|
|
1755
1775
|
var w, D, S;
|
|
@@ -1763,7 +1783,7 @@ async function Ki() {
|
|
|
1763
1783
|
}), h.parent && s.set(
|
|
1764
1784
|
h.parent.userData.id ? h.parent.userData.id : h.parent.uuid,
|
|
1765
1785
|
{
|
|
1766
|
-
title: ((d =
|
|
1786
|
+
title: ((d = m == null ? void 0 : m.textContent) == null ? void 0 : d.trim()) || "",
|
|
1767
1787
|
items: f
|
|
1768
1788
|
}
|
|
1769
1789
|
);
|
|
@@ -1803,11 +1823,11 @@ function Zi(r, e = "edit", t) {
|
|
|
1803
1823
|
const A = c.userData.id || c.uuid, u = t[A];
|
|
1804
1824
|
if (u && c.userData.isMovable) {
|
|
1805
1825
|
Li(c);
|
|
1806
|
-
const h = new
|
|
1826
|
+
const h = new Gn({
|
|
1807
1827
|
title: u.title,
|
|
1808
1828
|
items: u.items
|
|
1809
1829
|
});
|
|
1810
|
-
h.attachTo(c), h.visible = !1, console.log("panel", h),
|
|
1830
|
+
h.attachTo(c), h.visible = !1, console.log("panel", h), Fn(c, h);
|
|
1811
1831
|
}
|
|
1812
1832
|
})), e === "edit" && ((l = I.scene) == null || l.traverse((c) => {
|
|
1813
1833
|
var A;
|
|
@@ -1835,7 +1855,7 @@ function Vn(r) {
|
|
|
1835
1855
|
function Qi() {
|
|
1836
1856
|
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
1857
|
}
|
|
1838
|
-
const Ji = /^[og]\s*(.+)?/, _i = /^mtllib /, $i = /^usemtl /, eo = /^usemap /,
|
|
1858
|
+
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
1859
|
function to() {
|
|
1840
1860
|
const r = {
|
|
1841
1861
|
objects: [],
|
|
@@ -1945,7 +1965,7 @@ function to() {
|
|
|
1945
1965
|
},
|
|
1946
1966
|
addFaceNormal: function(e, t, s) {
|
|
1947
1967
|
const n = this.vertices, i = this.object.geometry.normals;
|
|
1948
|
-
|
|
1968
|
+
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
1969
|
},
|
|
1950
1970
|
addColor: function(e, t, s) {
|
|
1951
1971
|
const n = this.colors, i = this.object.geometry.colors;
|
|
@@ -1967,13 +1987,13 @@ function to() {
|
|
|
1967
1987
|
const A = this.vertices.length;
|
|
1968
1988
|
let u = this.parseVertexIndex(e, A), h = this.parseVertexIndex(t, A), d = this.parseVertexIndex(s, A);
|
|
1969
1989
|
if (this.addVertex(u, h, d), this.addColor(u, h, d), a !== void 0 && a !== "") {
|
|
1970
|
-
const
|
|
1971
|
-
u = this.parseNormalIndex(a,
|
|
1990
|
+
const p = this.normals.length;
|
|
1991
|
+
u = this.parseNormalIndex(a, p), h = this.parseNormalIndex(l, p), d = this.parseNormalIndex(c, p), this.addNormal(u, h, d);
|
|
1972
1992
|
} else
|
|
1973
1993
|
this.addFaceNormal(u, h, d);
|
|
1974
1994
|
if (n !== void 0 && n !== "") {
|
|
1975
|
-
const
|
|
1976
|
-
u = this.parseUVIndex(n,
|
|
1995
|
+
const p = this.uvs.length;
|
|
1996
|
+
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
1997
|
} else
|
|
1978
1998
|
this.addDefaultUV();
|
|
1979
1999
|
},
|
|
@@ -2054,7 +2074,7 @@ class no extends Yt {
|
|
|
2054
2074
|
const A = c.charAt(0);
|
|
2055
2075
|
if (A !== "#")
|
|
2056
2076
|
if (A === "v") {
|
|
2057
|
-
const u = c.split(
|
|
2077
|
+
const u = c.split(In);
|
|
2058
2078
|
switch (u[0]) {
|
|
2059
2079
|
case "v":
|
|
2060
2080
|
t.vertices.push(
|
|
@@ -2083,25 +2103,25 @@ class no extends Yt {
|
|
|
2083
2103
|
break;
|
|
2084
2104
|
}
|
|
2085
2105
|
} else if (A === "f") {
|
|
2086
|
-
const h = c.slice(1).trim().split(
|
|
2087
|
-
for (let
|
|
2088
|
-
const g = h[
|
|
2106
|
+
const h = c.slice(1).trim().split(In), d = [];
|
|
2107
|
+
for (let m = 0, f = h.length; m < f; m++) {
|
|
2108
|
+
const g = h[m];
|
|
2089
2109
|
if (g.length > 0) {
|
|
2090
2110
|
const x = g.split("/");
|
|
2091
2111
|
d.push(x);
|
|
2092
2112
|
}
|
|
2093
2113
|
}
|
|
2094
|
-
const
|
|
2095
|
-
for (let
|
|
2096
|
-
const g = d[
|
|
2114
|
+
const p = d[0];
|
|
2115
|
+
for (let m = 1, f = d.length - 1; m < f; m++) {
|
|
2116
|
+
const g = d[m], x = d[m + 1];
|
|
2097
2117
|
t.addFace(
|
|
2098
|
-
|
|
2118
|
+
p[0],
|
|
2099
2119
|
g[0],
|
|
2100
2120
|
x[0],
|
|
2101
|
-
|
|
2121
|
+
p[1],
|
|
2102
2122
|
g[1],
|
|
2103
2123
|
x[1],
|
|
2104
|
-
|
|
2124
|
+
p[2],
|
|
2105
2125
|
g[2],
|
|
2106
2126
|
x[2]
|
|
2107
2127
|
);
|
|
@@ -2113,8 +2133,8 @@ class no extends Yt {
|
|
|
2113
2133
|
if (c.indexOf("/") === -1)
|
|
2114
2134
|
h = u;
|
|
2115
2135
|
else
|
|
2116
|
-
for (let
|
|
2117
|
-
const f = u[
|
|
2136
|
+
for (let p = 0, m = u.length; p < m; p++) {
|
|
2137
|
+
const f = u[p].split("/");
|
|
2118
2138
|
f[0] !== "" && h.push(f[0]), f[1] !== "" && d.push(f[1]);
|
|
2119
2139
|
}
|
|
2120
2140
|
t.addLineGeometry(h, d);
|
|
@@ -2148,13 +2168,13 @@ class no extends Yt {
|
|
|
2148
2168
|
if (i.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0) === !0)
|
|
2149
2169
|
for (let a = 0, l = t.objects.length; a < l; a++) {
|
|
2150
2170
|
const c = t.objects[a], A = c.geometry, u = c.materials, h = A.type === "Line", d = A.type === "Points";
|
|
2151
|
-
let
|
|
2171
|
+
let p = !1;
|
|
2152
2172
|
if (A.vertices.length === 0) continue;
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2173
|
+
const m = new We();
|
|
2174
|
+
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
2175
|
const f = [];
|
|
2156
2176
|
for (let x = 0, C = u.length; x < C; x++) {
|
|
2157
|
-
const y = u[x], w = y.name + "_" + y.smooth + "_" +
|
|
2177
|
+
const y = u[x], w = y.name + "_" + y.smooth + "_" + p;
|
|
2158
2178
|
let D = t.materials[w];
|
|
2159
2179
|
if (this.materials !== null) {
|
|
2160
2180
|
if (D = this.materials.create(y.name), h && D && !(D instanceof Ze)) {
|
|
@@ -2165,17 +2185,17 @@ class no extends Yt {
|
|
|
2165
2185
|
Qe.prototype.copy.call(S, D), S.color.copy(D.color), S.map = D.map, D = S;
|
|
2166
2186
|
}
|
|
2167
2187
|
}
|
|
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 =
|
|
2188
|
+
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
2189
|
}
|
|
2170
2190
|
let g;
|
|
2171
2191
|
if (f.length > 1) {
|
|
2172
2192
|
for (let x = 0, C = u.length; x < C; x++) {
|
|
2173
2193
|
const y = u[x];
|
|
2174
|
-
|
|
2194
|
+
m.addGroup(y.groupStart, y.groupCount, x);
|
|
2175
2195
|
}
|
|
2176
|
-
h ? g = new Wt(
|
|
2196
|
+
h ? g = new Wt(m, f) : d ? g = new pt(m, f) : g = new v(m, f);
|
|
2177
2197
|
} else
|
|
2178
|
-
h ? g = new Wt(
|
|
2198
|
+
h ? g = new Wt(m, f[0]) : d ? g = new pt(m, f[0]) : g = new v(m, f[0]);
|
|
2179
2199
|
g.name = c.name, i.add(g);
|
|
2180
2200
|
}
|
|
2181
2201
|
else if (t.vertices.length > 0) {
|
|
@@ -2187,10 +2207,10 @@ class no extends Yt {
|
|
|
2187
2207
|
return i;
|
|
2188
2208
|
}
|
|
2189
2209
|
}
|
|
2190
|
-
function
|
|
2210
|
+
function wn(r, e) {
|
|
2191
2211
|
if (e === ms)
|
|
2192
2212
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
2193
|
-
if (e === zt || e ===
|
|
2213
|
+
if (e === zt || e === Sn) {
|
|
2194
2214
|
let t = r.getIndex();
|
|
2195
2215
|
if (t === null) {
|
|
2196
2216
|
const o = [], a = r.getAttribute("position");
|
|
@@ -2269,9 +2289,9 @@ class io extends Yt {
|
|
|
2269
2289
|
}), this.register(function(t) {
|
|
2270
2290
|
return new ro(t);
|
|
2271
2291
|
}), this.register(function(t) {
|
|
2272
|
-
return new
|
|
2292
|
+
return new vn(t, O.EXT_MESHOPT_COMPRESSION);
|
|
2273
2293
|
}), this.register(function(t) {
|
|
2274
|
-
return new
|
|
2294
|
+
return new vn(t, O.KHR_MESHOPT_COMPRESSION);
|
|
2275
2295
|
}), this.register(function(t) {
|
|
2276
2296
|
return new wo(t);
|
|
2277
2297
|
});
|
|
@@ -2760,7 +2780,7 @@ class xo {
|
|
|
2760
2780
|
return s.loadTextureImage(e, o.source, l);
|
|
2761
2781
|
}
|
|
2762
2782
|
}
|
|
2763
|
-
class
|
|
2783
|
+
class vn {
|
|
2764
2784
|
constructor(e, t) {
|
|
2765
2785
|
this.name = t, this.parser = e;
|
|
2766
2786
|
}
|
|
@@ -2803,22 +2823,22 @@ class wo {
|
|
|
2803
2823
|
a.push(this.parser.getDependency("accessor", o[c]).then((A) => (l[c] = A, l[c])));
|
|
2804
2824
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
|
|
2805
2825
|
const A = c.pop(), u = A.isGroup ? A.children : [A], h = c[0].count, d = [];
|
|
2806
|
-
for (const
|
|
2807
|
-
const
|
|
2826
|
+
for (const p of u) {
|
|
2827
|
+
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
2828
|
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,
|
|
2829
|
+
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
2830
|
for (const y in l)
|
|
2811
2831
|
if (y === "_COLOR_0") {
|
|
2812
2832
|
const w = l[y];
|
|
2813
2833
|
C.instanceColor = new Cs(w.array, w.itemSize, w.normalized);
|
|
2814
|
-
} else y !== "TRANSLATION" && y !== "ROTATION" && y !== "SCALE" &&
|
|
2815
|
-
ke.prototype.copy.call(C,
|
|
2834
|
+
} else y !== "TRANSLATION" && y !== "ROTATION" && y !== "SCALE" && p.geometry.setAttribute(y, l[y]);
|
|
2835
|
+
ke.prototype.copy.call(C, p), this.parser.assignFinalMaterial(C), d.push(C);
|
|
2816
2836
|
}
|
|
2817
2837
|
return A.isGroup ? (A.clear(), A.add(...d), A) : d[0];
|
|
2818
2838
|
}));
|
|
2819
2839
|
}
|
|
2820
2840
|
}
|
|
2821
|
-
const Kn = "glTF", Xe = 12,
|
|
2841
|
+
const Kn = "glTF", Xe = 12, Mn = { JSON: 1313821514, BIN: 5130562 };
|
|
2822
2842
|
class vo {
|
|
2823
2843
|
constructor(e) {
|
|
2824
2844
|
this.name = O.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
@@ -2837,10 +2857,10 @@ class vo {
|
|
|
2837
2857
|
const a = i.getUint32(o, !0);
|
|
2838
2858
|
o += 4;
|
|
2839
2859
|
const l = i.getUint32(o, !0);
|
|
2840
|
-
if (o += 4, l ===
|
|
2860
|
+
if (o += 4, l === Mn.JSON) {
|
|
2841
2861
|
const c = new Uint8Array(e, Xe + o, a);
|
|
2842
2862
|
this.content = s.decode(c);
|
|
2843
|
-
} else if (l ===
|
|
2863
|
+
} else if (l === Mn.BIN) {
|
|
2844
2864
|
const c = Xe + o;
|
|
2845
2865
|
this.body = e.slice(c, c + a);
|
|
2846
2866
|
}
|
|
@@ -2872,9 +2892,9 @@ class Mo {
|
|
|
2872
2892
|
return t.getDependency("bufferView", i).then(function(A) {
|
|
2873
2893
|
return new Promise(function(u, h) {
|
|
2874
2894
|
n.decodeDracoFile(A, function(d) {
|
|
2875
|
-
for (const
|
|
2876
|
-
const
|
|
2877
|
-
f !== void 0 && (
|
|
2895
|
+
for (const p in d.attributes) {
|
|
2896
|
+
const m = d.attributes[p], f = l[p];
|
|
2897
|
+
f !== void 0 && (m.normalized = f);
|
|
2878
2898
|
}
|
|
2879
2899
|
u(d);
|
|
2880
2900
|
}, a, c, ae, h);
|
|
@@ -2906,9 +2926,9 @@ class Zn extends zs {
|
|
|
2906
2926
|
return t;
|
|
2907
2927
|
}
|
|
2908
2928
|
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,
|
|
2929
|
+
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
2930
|
for (let y = 0; y !== a; y++) {
|
|
2911
|
-
const w = o[
|
|
2931
|
+
const w = o[m + y + a], D = o[m + y + l] * A, S = o[p + y + a], Z = o[p + y] * A;
|
|
2912
2932
|
i[y] = x * w + C * D + f * S + g * Z;
|
|
2913
2933
|
}
|
|
2914
2934
|
return i;
|
|
@@ -2936,14 +2956,14 @@ const te = {
|
|
|
2936
2956
|
5123: Uint16Array,
|
|
2937
2957
|
5125: Uint32Array,
|
|
2938
2958
|
5126: Float32Array
|
|
2939
|
-
},
|
|
2940
|
-
9728:
|
|
2959
|
+
}, Dn = {
|
|
2960
|
+
9728: jn,
|
|
2941
2961
|
9729: Gt,
|
|
2942
2962
|
9984: Ds,
|
|
2943
2963
|
9985: Ms,
|
|
2944
2964
|
9986: vs,
|
|
2945
|
-
9987:
|
|
2946
|
-
},
|
|
2965
|
+
9987: Nn
|
|
2966
|
+
}, Pn = {
|
|
2947
2967
|
33071: Ts,
|
|
2948
2968
|
33648: Ps,
|
|
2949
2969
|
10497: Ft
|
|
@@ -2975,7 +2995,7 @@ const te = {
|
|
|
2975
2995
|
CUBICSPLINE: void 0,
|
|
2976
2996
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
2977
2997
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
2978
|
-
LINEAR:
|
|
2998
|
+
LINEAR: Wn,
|
|
2979
2999
|
STEP: ks
|
|
2980
3000
|
}, Ht = {
|
|
2981
3001
|
OPAQUE: "OPAQUE",
|
|
@@ -2983,7 +3003,7 @@ const te = {
|
|
|
2983
3003
|
BLEND: "BLEND"
|
|
2984
3004
|
};
|
|
2985
3005
|
function Ro(r) {
|
|
2986
|
-
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new
|
|
3006
|
+
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new kn({
|
|
2987
3007
|
color: 16777215,
|
|
2988
3008
|
emissive: 0,
|
|
2989
3009
|
metalness: 1,
|
|
@@ -3334,14 +3354,14 @@ class ko {
|
|
|
3334
3354
|
}
|
|
3335
3355
|
const i = [];
|
|
3336
3356
|
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 = St[n.type], c = je[n.componentType], A = c.BYTES_PER_ELEMENT, u = A * l, h = n.byteOffset || 0, d = n.bufferView !== void 0 ? s.bufferViews[n.bufferView].byteStride : void 0,
|
|
3338
|
-
let
|
|
3357
|
+
const a = o[0], l = St[n.type], c = je[n.componentType], A = c.BYTES_PER_ELEMENT, u = A * l, h = n.byteOffset || 0, d = n.bufferView !== void 0 ? s.bufferViews[n.bufferView].byteStride : void 0, p = n.normalized === !0;
|
|
3358
|
+
let m, f;
|
|
3339
3359
|
if (d && d !== u) {
|
|
3340
3360
|
const g = Math.floor(h / d), x = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + g + ":" + n.count;
|
|
3341
3361
|
let C = t.cache.get(x);
|
|
3342
|
-
C || (
|
|
3362
|
+
C || (m = new c(a, g * d, n.count * d / A), C = new Hn(m, d / A), t.cache.add(x, C)), f = new Ln(C, l, h % d / A, p);
|
|
3343
3363
|
} else
|
|
3344
|
-
a === null ?
|
|
3364
|
+
a === null ? m = new c(n.count * l) : m = new c(a, h, n.count * l), f = new _e(m, l, p);
|
|
3345
3365
|
if (n.sparse !== void 0) {
|
|
3346
3366
|
const g = St.SCALAR, x = je[n.sparse.indices.componentType], C = n.sparse.indices.byteOffset || 0, y = n.sparse.values.byteOffset || 0, w = new x(o[1], C, n.sparse.count * g), D = new c(o[2], y, n.sparse.count * l);
|
|
3347
3367
|
a !== null && (f = new _e(f.array.slice(), f.itemSize, f.normalized)), f.normalized = !1;
|
|
@@ -3349,7 +3369,7 @@ class ko {
|
|
|
3349
3369
|
const _ = w[S];
|
|
3350
3370
|
if (f.setX(_, D[S * l]), l >= 2 && f.setY(_, D[S * l + 1]), l >= 3 && f.setZ(_, D[S * l + 2]), l >= 4 && f.setW(_, D[S * l + 3]), l >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
3351
3371
|
}
|
|
3352
|
-
f.normalized =
|
|
3372
|
+
f.normalized = p;
|
|
3353
3373
|
}
|
|
3354
3374
|
return f;
|
|
3355
3375
|
});
|
|
@@ -3377,7 +3397,7 @@ class ko {
|
|
|
3377
3397
|
const c = this.loadImageSource(t, s).then(function(A) {
|
|
3378
3398
|
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
3399
|
const h = (i.samplers || {})[o.sampler] || {};
|
|
3380
|
-
return A.magFilter =
|
|
3400
|
+
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
3401
|
}).catch(function() {
|
|
3382
3402
|
return null;
|
|
3383
3403
|
});
|
|
@@ -3399,11 +3419,11 @@ class ko {
|
|
|
3399
3419
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
3400
3420
|
const A = Promise.resolve(l).then(function(u) {
|
|
3401
3421
|
return new Promise(function(h, d) {
|
|
3402
|
-
let
|
|
3403
|
-
t.isImageBitmapLoader === !0 && (
|
|
3404
|
-
const f = new
|
|
3422
|
+
let p = h;
|
|
3423
|
+
t.isImageBitmapLoader === !0 && (p = function(m) {
|
|
3424
|
+
const f = new tn(m);
|
|
3405
3425
|
f.needsUpdate = !0, h(f);
|
|
3406
|
-
}), t.load(Je.resolveURL(u, i.path),
|
|
3426
|
+
}), t.load(Je.resolveURL(u, i.path), p, void 0, d);
|
|
3407
3427
|
});
|
|
3408
3428
|
}).then(function(u) {
|
|
3409
3429
|
return c === !0 && a.revokeObjectURL(l), re(u, o), u.userData.mimeType = o.mimeType || No(o.uri), u;
|
|
@@ -3468,7 +3488,7 @@ class ko {
|
|
|
3468
3488
|
e.material = s;
|
|
3469
3489
|
}
|
|
3470
3490
|
getMaterialType() {
|
|
3471
|
-
return
|
|
3491
|
+
return kn;
|
|
3472
3492
|
}
|
|
3473
3493
|
/**
|
|
3474
3494
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -3496,7 +3516,7 @@ class ko {
|
|
|
3496
3516
|
return h.extendMaterialParams && h.extendMaterialParams(e, a);
|
|
3497
3517
|
})));
|
|
3498
3518
|
}
|
|
3499
|
-
i.doubleSided === !0 && (a.side =
|
|
3519
|
+
i.doubleSided === !0 && (a.side = Rn);
|
|
3500
3520
|
const A = i.alphaMode || Ht.OPAQUE;
|
|
3501
3521
|
if (A === Ht.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, A === Ht.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== Pe && (c.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new Y(1, 1), i.normalTexture.scale !== void 0)) {
|
|
3502
3522
|
const u = i.normalTexture.scale;
|
|
@@ -3535,7 +3555,7 @@ class ko {
|
|
|
3535
3555
|
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
3536
3556
|
function i(a) {
|
|
3537
3557
|
return s[O.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(l) {
|
|
3538
|
-
return
|
|
3558
|
+
return Tn(l, a, t);
|
|
3539
3559
|
});
|
|
3540
3560
|
}
|
|
3541
3561
|
const o = [];
|
|
@@ -3545,7 +3565,7 @@ class ko {
|
|
|
3545
3565
|
o.push(u.promise);
|
|
3546
3566
|
else {
|
|
3547
3567
|
let h;
|
|
3548
|
-
c.extensions && c.extensions[O.KHR_DRACO_MESH_COMPRESSION] ? h = i(c) : h =
|
|
3568
|
+
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
3569
|
}
|
|
3550
3570
|
}
|
|
3551
3571
|
return Promise.all(o);
|
|
@@ -3565,25 +3585,25 @@ class ko {
|
|
|
3565
3585
|
}
|
|
3566
3586
|
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(l) {
|
|
3567
3587
|
const c = l.slice(0, l.length - 1), A = l[l.length - 1], u = [];
|
|
3568
|
-
for (let d = 0,
|
|
3569
|
-
const
|
|
3588
|
+
for (let d = 0, p = A.length; d < p; d++) {
|
|
3589
|
+
const m = A[d], f = o[d];
|
|
3570
3590
|
let g;
|
|
3571
3591
|
const x = c[d];
|
|
3572
3592
|
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(
|
|
3593
|
+
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, Sn) : f.mode === te.TRIANGLE_FAN && (g.geometry = wn(g.geometry, zt));
|
|
3574
3594
|
else if (f.mode === te.LINES)
|
|
3575
|
-
g = new Wt(
|
|
3595
|
+
g = new Wt(m, x);
|
|
3576
3596
|
else if (f.mode === te.LINE_STRIP)
|
|
3577
|
-
g = new ue(
|
|
3597
|
+
g = new ue(m, x);
|
|
3578
3598
|
else if (f.mode === te.LINE_LOOP)
|
|
3579
|
-
g = new Rs(
|
|
3599
|
+
g = new Rs(m, x);
|
|
3580
3600
|
else if (f.mode === te.POINTS)
|
|
3581
|
-
g = new pt(
|
|
3601
|
+
g = new pt(m, x);
|
|
3582
3602
|
else
|
|
3583
3603
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + f.mode);
|
|
3584
3604
|
Object.keys(g.geometry.morphAttributes).length > 0 && Ho(g, i), g.name = t.createUniqueName(i.name || "mesh_" + e), re(g, i), f.extensions && xe(n, g, f), t.assignFinalMaterial(g), u.push(g);
|
|
3585
3605
|
}
|
|
3586
|
-
for (let d = 0,
|
|
3606
|
+
for (let d = 0, p = u.length; d < p; d++)
|
|
3587
3607
|
t.associations.set(u[d], {
|
|
3588
3608
|
meshes: e,
|
|
3589
3609
|
primitives: d
|
|
@@ -3592,7 +3612,7 @@ class ko {
|
|
|
3592
3612
|
return i.extensions && xe(n, u[0], i), u[0];
|
|
3593
3613
|
const h = new ft();
|
|
3594
3614
|
i.extensions && xe(n, h, i), t.associations.set(h, { meshes: e });
|
|
3595
|
-
for (let d = 0,
|
|
3615
|
+
for (let d = 0, p = u.length; d < p; d++)
|
|
3596
3616
|
h.add(u[d]);
|
|
3597
3617
|
return h;
|
|
3598
3618
|
});
|
|
@@ -3611,7 +3631,7 @@ class ko {
|
|
|
3611
3631
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3612
3632
|
return;
|
|
3613
3633
|
}
|
|
3614
|
-
return s.type === "perspective" ? t = new Ss(
|
|
3634
|
+
return s.type === "perspective" ? t = new Ss(En.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new Hs(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), s.name && (t.name = this.createUniqueName(s.name)), re(t, s), Promise.resolve(t);
|
|
3615
3635
|
}
|
|
3616
3636
|
/**
|
|
3617
3637
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -3648,8 +3668,8 @@ class ko {
|
|
|
3648
3668
|
loadAnimation(e) {
|
|
3649
3669
|
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], l = [], c = [], A = [];
|
|
3650
3670
|
for (let u = 0, h = n.channels.length; u < h; u++) {
|
|
3651
|
-
const d = n.channels[u],
|
|
3652
|
-
|
|
3671
|
+
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;
|
|
3672
|
+
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
3673
|
}
|
|
3654
3674
|
return Promise.all([
|
|
3655
3675
|
Promise.all(o),
|
|
@@ -3658,9 +3678,9 @@ class ko {
|
|
|
3658
3678
|
Promise.all(c),
|
|
3659
3679
|
Promise.all(A)
|
|
3660
3680
|
]).then(function(u) {
|
|
3661
|
-
const h = u[0], d = u[1],
|
|
3681
|
+
const h = u[0], d = u[1], p = u[2], m = u[3], f = u[4], g = [];
|
|
3662
3682
|
for (let C = 0, y = h.length; C < y; C++) {
|
|
3663
|
-
const w = h[C], D = d[C], S =
|
|
3683
|
+
const w = h[C], D = d[C], S = p[C], Z = m[C], _ = f[C];
|
|
3664
3684
|
if (w === void 0) continue;
|
|
3665
3685
|
w.updateMatrix && w.updateMatrix();
|
|
3666
3686
|
const Q = s._createAnimationTracks(w, D, S, Z, _);
|
|
@@ -3704,11 +3724,11 @@ class ko {
|
|
|
3704
3724
|
h !== null && A.traverse(function(d) {
|
|
3705
3725
|
d.isSkinnedMesh && d.bind(h, jo);
|
|
3706
3726
|
});
|
|
3707
|
-
for (let d = 0,
|
|
3727
|
+
for (let d = 0, p = u.length; d < p; d++)
|
|
3708
3728
|
A.add(u[d]);
|
|
3709
3729
|
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],
|
|
3730
|
+
const d = A.userData.pivot, p = u[0];
|
|
3731
|
+
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
3732
|
}
|
|
3713
3733
|
return A;
|
|
3714
3734
|
});
|
|
@@ -3768,7 +3788,7 @@ class ko {
|
|
|
3768
3788
|
const c = (A) => {
|
|
3769
3789
|
const u = /* @__PURE__ */ new Map();
|
|
3770
3790
|
for (const [h, d] of n.associations)
|
|
3771
|
-
(h instanceof Qe || h instanceof
|
|
3791
|
+
(h instanceof Qe || h instanceof tn) && u.set(h, d);
|
|
3772
3792
|
return A.traverse((h) => {
|
|
3773
3793
|
const d = n.associations.get(h);
|
|
3774
3794
|
d != null && u.set(h, d);
|
|
@@ -3786,37 +3806,37 @@ class ko {
|
|
|
3786
3806
|
let A;
|
|
3787
3807
|
switch (fe[i.path]) {
|
|
3788
3808
|
case fe.weights:
|
|
3789
|
-
A =
|
|
3809
|
+
A = sn;
|
|
3790
3810
|
break;
|
|
3791
3811
|
case fe.rotation:
|
|
3792
|
-
A =
|
|
3812
|
+
A = on;
|
|
3793
3813
|
break;
|
|
3794
3814
|
case fe.translation:
|
|
3795
3815
|
case fe.scale:
|
|
3796
|
-
A =
|
|
3816
|
+
A = nn;
|
|
3797
3817
|
break;
|
|
3798
3818
|
default:
|
|
3799
3819
|
switch (s.itemSize) {
|
|
3800
3820
|
case 1:
|
|
3801
|
-
A =
|
|
3821
|
+
A = sn;
|
|
3802
3822
|
break;
|
|
3803
3823
|
case 2:
|
|
3804
3824
|
case 3:
|
|
3805
3825
|
default:
|
|
3806
|
-
A =
|
|
3826
|
+
A = nn;
|
|
3807
3827
|
break;
|
|
3808
3828
|
}
|
|
3809
3829
|
break;
|
|
3810
3830
|
}
|
|
3811
|
-
const u = n.interpolation !== void 0 ? Eo[n.interpolation] :
|
|
3812
|
-
for (let d = 0,
|
|
3813
|
-
const
|
|
3831
|
+
const u = n.interpolation !== void 0 ? Eo[n.interpolation] : Wn, h = this._getArrayFromAccessor(s);
|
|
3832
|
+
for (let d = 0, p = l.length; d < p; d++) {
|
|
3833
|
+
const m = new A(
|
|
3814
3834
|
l[d] + "." + fe[i.path],
|
|
3815
3835
|
t.array,
|
|
3816
3836
|
h,
|
|
3817
3837
|
u
|
|
3818
3838
|
);
|
|
3819
|
-
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(
|
|
3839
|
+
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(m), o.push(m);
|
|
3820
3840
|
}
|
|
3821
3841
|
return o;
|
|
3822
3842
|
}
|
|
@@ -3832,7 +3852,7 @@ class ko {
|
|
|
3832
3852
|
}
|
|
3833
3853
|
_createCubicSplineTrackInterpolant(e) {
|
|
3834
3854
|
e.createInterpolant = function(s) {
|
|
3835
|
-
const n = this instanceof
|
|
3855
|
+
const n = this instanceof on ? Oo : Zn;
|
|
3836
3856
|
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
3837
3857
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
3838
3858
|
}
|
|
@@ -3861,11 +3881,11 @@ function Wo(r, e, t) {
|
|
|
3861
3881
|
for (let c = 0, A = i.length; c < A; c++) {
|
|
3862
3882
|
const u = i[c];
|
|
3863
3883
|
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(
|
|
3884
|
+
const h = t.json.accessors[u.POSITION], d = h.min, p = h.max;
|
|
3885
|
+
if (d !== void 0 && p !== void 0) {
|
|
3886
|
+
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) {
|
|
3887
|
+
const m = Vt(je[h.componentType]);
|
|
3888
|
+
l.multiplyScalar(m);
|
|
3869
3889
|
}
|
|
3870
3890
|
a.max(l);
|
|
3871
3891
|
} else
|
|
@@ -3878,7 +3898,7 @@ function Wo(r, e, t) {
|
|
|
3878
3898
|
const o = new Fs();
|
|
3879
3899
|
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, r.boundingSphere = o;
|
|
3880
3900
|
}
|
|
3881
|
-
function
|
|
3901
|
+
function Tn(r, e, t) {
|
|
3882
3902
|
const s = e.attributes, n = [];
|
|
3883
3903
|
function i(o, a) {
|
|
3884
3904
|
return t.getDependency("accessor", o).then(function(l) {
|
|
@@ -4015,8 +4035,8 @@ class zo extends Yt {
|
|
|
4015
4035
|
if (o === a)
|
|
4016
4036
|
c = new _e(i, o);
|
|
4017
4037
|
else {
|
|
4018
|
-
const A = new
|
|
4019
|
-
c = new
|
|
4038
|
+
const A = new Hn(i, a);
|
|
4039
|
+
c = new Ln(A, o, 0);
|
|
4020
4040
|
}
|
|
4021
4041
|
n === "color" && (this._assignVertexColorSpace(c, l), c.normalized = !(i instanceof Float32Array)), t.setAttribute(n, c);
|
|
4022
4042
|
}
|
|
@@ -4108,8 +4128,8 @@ function Go() {
|
|
|
4108
4128
|
e.then((A) => {
|
|
4109
4129
|
const u = A.draco, h = new u.Decoder();
|
|
4110
4130
|
try {
|
|
4111
|
-
const d = t(u, h, new Int8Array(l), c),
|
|
4112
|
-
d.index &&
|
|
4131
|
+
const d = t(u, h, new Int8Array(l), c), p = d.attributes.map((m) => m.array.buffer);
|
|
4132
|
+
d.index && p.push(d.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: d }, p);
|
|
4113
4133
|
} catch (d) {
|
|
4114
4134
|
console.error(d), self.postMessage({ type: "error", id: a.id, error: d.message });
|
|
4115
4135
|
} finally {
|
|
@@ -4122,16 +4142,16 @@ function Go() {
|
|
|
4122
4142
|
function t(o, a, l, c) {
|
|
4123
4143
|
const A = c.attributeIDs, u = c.attributeTypes;
|
|
4124
4144
|
let h, d;
|
|
4125
|
-
const
|
|
4126
|
-
if (
|
|
4145
|
+
const p = a.GetEncodedGeometryType(l);
|
|
4146
|
+
if (p === o.TRIANGULAR_MESH)
|
|
4127
4147
|
h = new o.Mesh(), d = a.DecodeArrayToMesh(l, l.byteLength, h);
|
|
4128
|
-
else if (
|
|
4148
|
+
else if (p === o.POINT_CLOUD)
|
|
4129
4149
|
h = new o.PointCloud(), d = a.DecodeArrayToPointCloud(l, l.byteLength, h);
|
|
4130
4150
|
else
|
|
4131
4151
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
4132
4152
|
if (!d.ok() || h.ptr === 0)
|
|
4133
4153
|
throw new Error("THREE.DRACOLoader: Decoding failed: " + d.error_msg());
|
|
4134
|
-
const
|
|
4154
|
+
const m = { index: null, attributes: [] };
|
|
4135
4155
|
for (const f in A) {
|
|
4136
4156
|
const g = self[u[f]];
|
|
4137
4157
|
let x, C;
|
|
@@ -4142,9 +4162,9 @@ function Go() {
|
|
|
4142
4162
|
x = a.GetAttribute(h, C);
|
|
4143
4163
|
}
|
|
4144
4164
|
const y = n(o, a, h, f, g, x);
|
|
4145
|
-
f === "color" && (y.vertexColorSpace = c.vertexColorSpace),
|
|
4165
|
+
f === "color" && (y.vertexColorSpace = c.vertexColorSpace), m.attributes.push(y);
|
|
4146
4166
|
}
|
|
4147
|
-
return
|
|
4167
|
+
return p === o.TRIANGULAR_MESH && (m.index = s(o, a, h)), o.destroy(h), m;
|
|
4148
4168
|
}
|
|
4149
4169
|
function s(o, a, l) {
|
|
4150
4170
|
const A = l.num_faces() * 3, u = A * 4, h = o._malloc(u);
|
|
@@ -4153,11 +4173,11 @@ function Go() {
|
|
|
4153
4173
|
return o._free(h), { array: d, itemSize: 1 };
|
|
4154
4174
|
}
|
|
4155
4175
|
function n(o, a, l, c, A, u) {
|
|
4156
|
-
const h = l.num_points(), d = u.num_components(),
|
|
4157
|
-
a.GetAttributeDataArrayForAllPoints(l, u,
|
|
4176
|
+
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);
|
|
4177
|
+
a.GetAttributeDataArrayForAllPoints(l, u, p, x, y);
|
|
4158
4178
|
const w = new A(o.HEAPF32.buffer, y, x / A.BYTES_PER_ELEMENT);
|
|
4159
4179
|
let D;
|
|
4160
|
-
if (
|
|
4180
|
+
if (m === f)
|
|
4161
4181
|
D = w.slice();
|
|
4162
4182
|
else {
|
|
4163
4183
|
D = new A(C / A.BYTES_PER_ELEMENT);
|
|
@@ -4226,7 +4246,7 @@ function Uo(r) {
|
|
|
4226
4246
|
speedY: A = 5e-4
|
|
4227
4247
|
} = r || {}, u = new P.PlaneGeometry(e, t), d = new P.TextureLoader().load(Fo, (f) => {
|
|
4228
4248
|
f.wrapS = f.wrapT = P.RepeatWrapping, f.repeat.set(a, l), f.generateMipmaps = !1, f.minFilter = P.LinearFilter, f.magFilter = P.LinearFilter;
|
|
4229
|
-
}),
|
|
4249
|
+
}), p = new P.MeshStandardMaterial({
|
|
4230
4250
|
color: s,
|
|
4231
4251
|
roughness: n,
|
|
4232
4252
|
metalness: i,
|
|
@@ -4236,8 +4256,8 @@ function Uo(r) {
|
|
|
4236
4256
|
// 双面渲染,避免从侧面或底部看到黑色
|
|
4237
4257
|
transparent: !0,
|
|
4238
4258
|
opacity: 0.6
|
|
4239
|
-
}),
|
|
4240
|
-
|
|
4259
|
+
}), m = new P.Mesh(u, p);
|
|
4260
|
+
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
4261
|
}
|
|
4242
4262
|
function Vo(r) {
|
|
4243
4263
|
return Et(!0), new Promise((e, t) => {
|
|
@@ -4300,16 +4320,28 @@ function Ko(r) {
|
|
|
4300
4320
|
return console.warn("请先选中一个模型,再添加数据面板"), null;
|
|
4301
4321
|
const t = Zt(e);
|
|
4302
4322
|
t && (t.dispose(), hi(e));
|
|
4303
|
-
const s =
|
|
4323
|
+
const s = Math.min(window.innerWidth, 7e3), n = 1920, i = 200, o = Math.max(
|
|
4324
|
+
150,
|
|
4325
|
+
// 最小宽度 150px(小屏设备)
|
|
4326
|
+
Math.round(s / n * i)
|
|
4327
|
+
), l = Math.max(
|
|
4328
|
+
12,
|
|
4329
|
+
Math.min(
|
|
4330
|
+
20,
|
|
4331
|
+
Math.round(o / i * 13)
|
|
4332
|
+
)
|
|
4333
|
+
), c = [
|
|
4304
4334
|
{ label: "温度", value: "30", unit: "℃" },
|
|
4305
4335
|
{ label: "湿度", value: "65", unit: "%" },
|
|
4306
4336
|
{ label: "压力", value: "101.3", unit: "kPa" },
|
|
4307
4337
|
{ label: "名称", value: e.name || "未命名" }
|
|
4308
|
-
],
|
|
4338
|
+
], A = new Gn({
|
|
4309
4339
|
title: (r == null ? void 0 : r.title) || "数据面板",
|
|
4310
|
-
items: (r == null ? void 0 : r.items) ||
|
|
4340
|
+
items: (r == null ? void 0 : r.items) || c,
|
|
4341
|
+
width: `${o}px`,
|
|
4342
|
+
fontSize: `${l}px`
|
|
4311
4343
|
});
|
|
4312
|
-
return
|
|
4344
|
+
return A.attachTo(e), Fn(e, A), A;
|
|
4313
4345
|
}
|
|
4314
4346
|
const Zo = {
|
|
4315
4347
|
key: 1,
|
|
@@ -4326,12 +4358,12 @@ const Zo = {
|
|
|
4326
4358
|
},
|
|
4327
4359
|
emits: ["select", "delete"],
|
|
4328
4360
|
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
|
-
(
|
|
4361
|
+
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(
|
|
4362
|
+
(m) => m.userData.isMovable === !0
|
|
4331
4363
|
))), A = Be(
|
|
4332
4364
|
() => {
|
|
4333
|
-
var
|
|
4334
|
-
return ((
|
|
4365
|
+
var m;
|
|
4366
|
+
return ((m = t.selectedObject) == null ? void 0 : m.uuid) === t.node.uuid;
|
|
4335
4367
|
}
|
|
4336
4368
|
);
|
|
4337
4369
|
ts(
|
|
@@ -4345,12 +4377,12 @@ const Zo = {
|
|
|
4345
4377
|
},
|
|
4346
4378
|
{ flush: "post" }
|
|
4347
4379
|
);
|
|
4348
|
-
const u = (
|
|
4349
|
-
|
|
4350
|
-
}, h = (
|
|
4351
|
-
|
|
4352
|
-
}, d = (
|
|
4353
|
-
return (
|
|
4380
|
+
const u = (m) => {
|
|
4381
|
+
m.stopPropagation(), s("select", t.node);
|
|
4382
|
+
}, h = (m) => {
|
|
4383
|
+
m.stopPropagation(), s("delete", t.node);
|
|
4384
|
+
}, d = (m) => m.type === "Mesh" || m.type === "Sprite" ? "🟦" : m.type === "Light" ? "💡" : "📦", p = (m) => m.name || `${m.type} (${m.id})`;
|
|
4385
|
+
return (m, f) => {
|
|
4354
4386
|
const g = ns("TreeItem", !0);
|
|
4355
4387
|
return T(), R("div", {
|
|
4356
4388
|
class: "tree-node",
|
|
@@ -4367,7 +4399,7 @@ const Zo = {
|
|
|
4367
4399
|
onClick: f[0] || (f[0] = jt((x) => ss(o)(r.node.uuid), ["stop"]))
|
|
4368
4400
|
}, ie(a.value ? "▼" : "▶"), 1)) : (T(), R("span", Zo)),
|
|
4369
4401
|
b("span", Qo, ie(d(r.node)), 1),
|
|
4370
|
-
b("span", Jo, ie(
|
|
4402
|
+
b("span", Jo, ie(p(r.node)), 1),
|
|
4371
4403
|
b("button", {
|
|
4372
4404
|
class: "tree-delete",
|
|
4373
4405
|
onClick: jt(h, ["stop"])
|
|
@@ -4420,9 +4452,9 @@ const Zo = {
|
|
|
4420
4452
|
}
|
|
4421
4453
|
function c(h) {
|
|
4422
4454
|
let d = null;
|
|
4423
|
-
return h.traverse((
|
|
4424
|
-
if (
|
|
4425
|
-
const
|
|
4455
|
+
return h.traverse((p) => {
|
|
4456
|
+
if (p.type === "Mesh" && !d) {
|
|
4457
|
+
const m = p, f = Array.isArray(m.material) ? m.material : [m.material];
|
|
4426
4458
|
for (const g of f)
|
|
4427
4459
|
if (g && (g.type === "MeshStandardMaterial" || g.type === "MeshPhongMaterial")) {
|
|
4428
4460
|
const x = g;
|
|
@@ -4437,14 +4469,14 @@ const Zo = {
|
|
|
4437
4469
|
}), d;
|
|
4438
4470
|
}
|
|
4439
4471
|
function A(h, d) {
|
|
4440
|
-
let
|
|
4441
|
-
return h.traverse((
|
|
4442
|
-
if (
|
|
4443
|
-
const f =
|
|
4472
|
+
let p = !1;
|
|
4473
|
+
return h.traverse((m) => {
|
|
4474
|
+
if (m.type === "Mesh") {
|
|
4475
|
+
const f = m, g = Array.isArray(f.material) ? f.material : [f.material];
|
|
4444
4476
|
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,
|
|
4477
|
+
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
4478
|
}
|
|
4447
|
-
}),
|
|
4479
|
+
}), p;
|
|
4448
4480
|
}
|
|
4449
4481
|
function u() {
|
|
4450
4482
|
if (t.selectedObject) {
|
|
@@ -4473,7 +4505,7 @@ const Zo = {
|
|
|
4473
4505
|
d[14] || (d[14] = b("span", null, "X:", -1)),
|
|
4474
4506
|
E(b("input", {
|
|
4475
4507
|
type: "number",
|
|
4476
|
-
"onUpdate:modelValue": d[0] || (d[0] = (
|
|
4508
|
+
"onUpdate:modelValue": d[0] || (d[0] = (p) => r.transform.position.x = p),
|
|
4477
4509
|
step: "0.01",
|
|
4478
4510
|
onInput: n
|
|
4479
4511
|
}, null, 544), [
|
|
@@ -4487,7 +4519,7 @@ const Zo = {
|
|
|
4487
4519
|
d[15] || (d[15] = b("span", null, "Y:", -1)),
|
|
4488
4520
|
E(b("input", {
|
|
4489
4521
|
type: "number",
|
|
4490
|
-
"onUpdate:modelValue": d[1] || (d[1] = (
|
|
4522
|
+
"onUpdate:modelValue": d[1] || (d[1] = (p) => r.transform.position.y = p),
|
|
4491
4523
|
step: "0.01",
|
|
4492
4524
|
onInput: n
|
|
4493
4525
|
}, null, 544), [
|
|
@@ -4501,7 +4533,7 @@ const Zo = {
|
|
|
4501
4533
|
d[16] || (d[16] = b("span", null, "Z:", -1)),
|
|
4502
4534
|
E(b("input", {
|
|
4503
4535
|
type: "number",
|
|
4504
|
-
"onUpdate:modelValue": d[2] || (d[2] = (
|
|
4536
|
+
"onUpdate:modelValue": d[2] || (d[2] = (p) => r.transform.position.z = p),
|
|
4505
4537
|
step: "0.01",
|
|
4506
4538
|
onInput: n
|
|
4507
4539
|
}, null, 544), [
|
|
@@ -4520,7 +4552,7 @@ const Zo = {
|
|
|
4520
4552
|
d[18] || (d[18] = b("span", null, "X:", -1)),
|
|
4521
4553
|
E(b("input", {
|
|
4522
4554
|
type: "number",
|
|
4523
|
-
"onUpdate:modelValue": d[3] || (d[3] = (
|
|
4555
|
+
"onUpdate:modelValue": d[3] || (d[3] = (p) => r.transform.rotation.x = p),
|
|
4524
4556
|
step: "0.01",
|
|
4525
4557
|
onInput: n
|
|
4526
4558
|
}, null, 544), [
|
|
@@ -4534,7 +4566,7 @@ const Zo = {
|
|
|
4534
4566
|
d[19] || (d[19] = b("span", null, "Y:", -1)),
|
|
4535
4567
|
E(b("input", {
|
|
4536
4568
|
type: "number",
|
|
4537
|
-
"onUpdate:modelValue": d[4] || (d[4] = (
|
|
4569
|
+
"onUpdate:modelValue": d[4] || (d[4] = (p) => r.transform.rotation.y = p),
|
|
4538
4570
|
step: "0.01",
|
|
4539
4571
|
onInput: n
|
|
4540
4572
|
}, null, 544), [
|
|
@@ -4548,7 +4580,7 @@ const Zo = {
|
|
|
4548
4580
|
d[20] || (d[20] = b("span", null, "Z:", -1)),
|
|
4549
4581
|
E(b("input", {
|
|
4550
4582
|
type: "number",
|
|
4551
|
-
"onUpdate:modelValue": d[5] || (d[5] = (
|
|
4583
|
+
"onUpdate:modelValue": d[5] || (d[5] = (p) => r.transform.rotation.z = p),
|
|
4552
4584
|
step: "0.01",
|
|
4553
4585
|
onInput: n
|
|
4554
4586
|
}, null, 544), [
|
|
@@ -4567,7 +4599,7 @@ const Zo = {
|
|
|
4567
4599
|
d[22] || (d[22] = b("span", null, "X:", -1)),
|
|
4568
4600
|
E(b("input", {
|
|
4569
4601
|
type: "number",
|
|
4570
|
-
"onUpdate:modelValue": d[6] || (d[6] = (
|
|
4602
|
+
"onUpdate:modelValue": d[6] || (d[6] = (p) => r.transform.scale.x = p),
|
|
4571
4603
|
step: "0.01",
|
|
4572
4604
|
onInput: n
|
|
4573
4605
|
}, null, 544), [
|
|
@@ -4581,7 +4613,7 @@ const Zo = {
|
|
|
4581
4613
|
d[23] || (d[23] = b("span", null, "Y:", -1)),
|
|
4582
4614
|
E(b("input", {
|
|
4583
4615
|
type: "number",
|
|
4584
|
-
"onUpdate:modelValue": d[7] || (d[7] = (
|
|
4616
|
+
"onUpdate:modelValue": d[7] || (d[7] = (p) => r.transform.scale.y = p),
|
|
4585
4617
|
step: "0.01",
|
|
4586
4618
|
onInput: n
|
|
4587
4619
|
}, null, 544), [
|
|
@@ -4595,7 +4627,7 @@ const Zo = {
|
|
|
4595
4627
|
d[24] || (d[24] = b("span", null, "Z:", -1)),
|
|
4596
4628
|
E(b("input", {
|
|
4597
4629
|
type: "number",
|
|
4598
|
-
"onUpdate:modelValue": d[8] || (d[8] = (
|
|
4630
|
+
"onUpdate:modelValue": d[8] || (d[8] = (p) => r.transform.scale.z = p),
|
|
4599
4631
|
step: "0.01",
|
|
4600
4632
|
onInput: n
|
|
4601
4633
|
}, null, 544), [
|
|
@@ -4617,7 +4649,7 @@ const Zo = {
|
|
|
4617
4649
|
min: "0",
|
|
4618
4650
|
max: "10",
|
|
4619
4651
|
step: "0.1",
|
|
4620
|
-
"onUpdate:modelValue": d[9] || (d[9] = (
|
|
4652
|
+
"onUpdate:modelValue": d[9] || (d[9] = (p) => a.intensity = p),
|
|
4621
4653
|
onInput: l
|
|
4622
4654
|
}, null, 544), [
|
|
4623
4655
|
[
|
|
@@ -4632,7 +4664,7 @@ const Zo = {
|
|
|
4632
4664
|
min: "0",
|
|
4633
4665
|
max: "100",
|
|
4634
4666
|
step: "0.1",
|
|
4635
|
-
"onUpdate:modelValue": d[10] || (d[10] = (
|
|
4667
|
+
"onUpdate:modelValue": d[10] || (d[10] = (p) => a.intensity = p),
|
|
4636
4668
|
class: "intensity-input",
|
|
4637
4669
|
onInput: l
|
|
4638
4670
|
}, null, 544), [
|
|
@@ -4654,7 +4686,7 @@ const Zo = {
|
|
|
4654
4686
|
min: "0",
|
|
4655
4687
|
max: "1",
|
|
4656
4688
|
step: "0.01",
|
|
4657
|
-
"onUpdate:modelValue": d[11] || (d[11] = (
|
|
4689
|
+
"onUpdate:modelValue": d[11] || (d[11] = (p) => i.metalness = p),
|
|
4658
4690
|
onInput: u
|
|
4659
4691
|
}, null, 544), [
|
|
4660
4692
|
[
|
|
@@ -4673,7 +4705,7 @@ const Zo = {
|
|
|
4673
4705
|
min: "0",
|
|
4674
4706
|
max: "1",
|
|
4675
4707
|
step: "0.01",
|
|
4676
|
-
"onUpdate:modelValue": d[12] || (d[12] = (
|
|
4708
|
+
"onUpdate:modelValue": d[12] || (d[12] = (p) => i.roughness = p),
|
|
4677
4709
|
onInput: u
|
|
4678
4710
|
}, null, 544), [
|
|
4679
4711
|
[
|
|
@@ -4692,7 +4724,7 @@ const Zo = {
|
|
|
4692
4724
|
min: "0",
|
|
4693
4725
|
max: "1",
|
|
4694
4726
|
step: "0.01",
|
|
4695
|
-
"onUpdate:modelValue": d[13] || (d[13] = (
|
|
4727
|
+
"onUpdate:modelValue": d[13] || (d[13] = (p) => i.opacity = p),
|
|
4696
4728
|
onInput: u
|
|
4697
4729
|
}, null, 544), [
|
|
4698
4730
|
[
|
|
@@ -4778,7 +4810,7 @@ const Zo = {
|
|
|
4778
4810
|
function d(C) {
|
|
4779
4811
|
return C.length <= 28 ? C : C.substring(0, 28) + "…";
|
|
4780
4812
|
}
|
|
4781
|
-
function
|
|
4813
|
+
function p(C) {
|
|
4782
4814
|
n.value = C;
|
|
4783
4815
|
const y = e.selectedObject;
|
|
4784
4816
|
if (!y) return;
|
|
@@ -4788,9 +4820,9 @@ const Zo = {
|
|
|
4788
4820
|
} catch {
|
|
4789
4821
|
i.value = String(w);
|
|
4790
4822
|
}
|
|
4791
|
-
|
|
4823
|
+
m();
|
|
4792
4824
|
}
|
|
4793
|
-
function
|
|
4825
|
+
function m() {
|
|
4794
4826
|
const C = i.value.trim();
|
|
4795
4827
|
if (!C) {
|
|
4796
4828
|
o.value = null;
|
|
@@ -4878,7 +4910,7 @@ const Zo = {
|
|
|
4878
4910
|
b("button", {
|
|
4879
4911
|
class: "ud-btn edit-json-btn",
|
|
4880
4912
|
title: "编辑对象",
|
|
4881
|
-
onClick: (S) =>
|
|
4913
|
+
onClick: (S) => p(w.key)
|
|
4882
4914
|
}, " ✎ ", 8, Pr)
|
|
4883
4915
|
], 64)) : (T(), R(ve, { key: 1 }, [
|
|
4884
4916
|
o.value ? (T(), R("div", Tr, " ⚠ " + ie(o.value), 1)) : X("", !0),
|
|
@@ -4886,7 +4918,7 @@ const Zo = {
|
|
|
4886
4918
|
"onUpdate:modelValue": y[2] || (y[2] = (S) => i.value = S),
|
|
4887
4919
|
class: se(["ud-json-textarea", { "has-error": o.value }]),
|
|
4888
4920
|
rows: "3",
|
|
4889
|
-
onInput:
|
|
4921
|
+
onInput: m
|
|
4890
4922
|
}, null, 34), [
|
|
4891
4923
|
[N, i.value]
|
|
4892
4924
|
]),
|
|
@@ -4928,20 +4960,20 @@ const Zo = {
|
|
|
4928
4960
|
const e = r, t = j(""), s = j([]), n = j(!0), i = j(""), o = j(""), a = j(""), l = j("");
|
|
4929
4961
|
let c = u(), A = !1;
|
|
4930
4962
|
function u() {
|
|
4931
|
-
const
|
|
4932
|
-
return
|
|
4963
|
+
const m = e.selectedObject;
|
|
4964
|
+
return m ? Zt(xt(m)) : null;
|
|
4933
4965
|
}
|
|
4934
|
-
Me(n, (
|
|
4935
|
-
A || !c || (c.visible =
|
|
4966
|
+
Me(n, (m) => {
|
|
4967
|
+
A || !c || (c.visible = m);
|
|
4936
4968
|
});
|
|
4937
4969
|
function h() {
|
|
4938
4970
|
A || !c || (c.setTitle(t.value), c.setItems([...s.value]));
|
|
4939
4971
|
}
|
|
4940
4972
|
Me(t, () => h()), Me(s, () => h(), { deep: !0 });
|
|
4941
|
-
function d(
|
|
4942
|
-
s.value = s.value.filter((f, g) => g !==
|
|
4973
|
+
function d(m) {
|
|
4974
|
+
s.value = s.value.filter((f, g) => g !== m), h();
|
|
4943
4975
|
}
|
|
4944
|
-
function
|
|
4976
|
+
function p() {
|
|
4945
4977
|
!i.value.trim() || !o.value.trim() || (s.value = [
|
|
4946
4978
|
...s.value,
|
|
4947
4979
|
{
|
|
@@ -4960,7 +4992,7 @@ const Zo = {
|
|
|
4960
4992
|
}, 0);
|
|
4961
4993
|
},
|
|
4962
4994
|
{ immediate: !0 }
|
|
4963
|
-
), (
|
|
4995
|
+
), (m, f) => (T(), R("div", Nr, [
|
|
4964
4996
|
b("div", jr, [
|
|
4965
4997
|
f[10] || (f[10] = b("label", null, "📊 数据面板", -1)),
|
|
4966
4998
|
b("div", kr, [
|
|
@@ -5041,7 +5073,7 @@ const Zo = {
|
|
|
5041
5073
|
class: "dp-input dp-input-sm",
|
|
5042
5074
|
"onUpdate:modelValue": f[2] || (f[2] = (g) => i.value = g),
|
|
5043
5075
|
placeholder: "标签",
|
|
5044
|
-
onKeyup: He(
|
|
5076
|
+
onKeyup: He(p, ["enter"])
|
|
5045
5077
|
}, null, 544), [
|
|
5046
5078
|
[N, i.value]
|
|
5047
5079
|
]),
|
|
@@ -5050,7 +5082,7 @@ const Zo = {
|
|
|
5050
5082
|
class: "dp-input dp-input-sm",
|
|
5051
5083
|
"onUpdate:modelValue": f[3] || (f[3] = (g) => o.value = g),
|
|
5052
5084
|
placeholder: "值",
|
|
5053
|
-
onKeyup: He(
|
|
5085
|
+
onKeyup: He(p, ["enter"])
|
|
5054
5086
|
}, null, 544), [
|
|
5055
5087
|
[N, o.value]
|
|
5056
5088
|
]),
|
|
@@ -5059,7 +5091,7 @@ const Zo = {
|
|
|
5059
5091
|
class: "dp-input dp-input-xs",
|
|
5060
5092
|
"onUpdate:modelValue": f[4] || (f[4] = (g) => a.value = g),
|
|
5061
5093
|
placeholder: "单位",
|
|
5062
|
-
onKeyup: He(
|
|
5094
|
+
onKeyup: He(p, ["enter"])
|
|
5063
5095
|
}, null, 544), [
|
|
5064
5096
|
[N, a.value]
|
|
5065
5097
|
]),
|
|
@@ -5068,13 +5100,13 @@ const Zo = {
|
|
|
5068
5100
|
class: "dp-input dp-input-xs",
|
|
5069
5101
|
"onUpdate:modelValue": f[5] || (f[5] = (g) => l.value = g),
|
|
5070
5102
|
placeholder: "编码",
|
|
5071
|
-
onKeyup: He(
|
|
5103
|
+
onKeyup: He(p, ["enter"])
|
|
5072
5104
|
}, null, 544), [
|
|
5073
5105
|
[N, l.value]
|
|
5074
5106
|
]),
|
|
5075
5107
|
b("button", {
|
|
5076
5108
|
class: "dp-btn dp-btn-add",
|
|
5077
|
-
onClick:
|
|
5109
|
+
onClick: p,
|
|
5078
5110
|
title: "添加"
|
|
5079
5111
|
}, "+")
|
|
5080
5112
|
])
|
|
@@ -5128,65 +5160,65 @@ const $r = {
|
|
|
5128
5160
|
emits: ["propertyChange", "treeSelect", "treeDelete", "transformModeChange"],
|
|
5129
5161
|
setup(r, { emit: e }) {
|
|
5130
5162
|
const t = r, s = e, n = j("translate");
|
|
5131
|
-
function i(
|
|
5132
|
-
n.value =
|
|
5163
|
+
function i(p) {
|
|
5164
|
+
n.value = p, s("transformModeChange", p);
|
|
5133
5165
|
}
|
|
5134
5166
|
const o = () => s("propertyChange"), a = j("transform"), l = Be(() => {
|
|
5135
|
-
var
|
|
5136
|
-
return !!(t.selectedObject && ((
|
|
5167
|
+
var p;
|
|
5168
|
+
return !!(t.selectedObject && ((p = t.selectedObject.userData) != null && p._hasDataPanel));
|
|
5137
5169
|
}), c = j(0), A = os(t, "selectedObject"), { expandedSet: u, toggleExpand: h } = _r(A);
|
|
5138
5170
|
rs("treeExpand", { expandedSet: u, toggleExpand: h });
|
|
5139
|
-
const d = (
|
|
5140
|
-
c.value++, s("treeDelete",
|
|
5171
|
+
const d = (p) => {
|
|
5172
|
+
c.value++, s("treeDelete", p);
|
|
5141
5173
|
};
|
|
5142
|
-
return (
|
|
5174
|
+
return (p, m) => r.transform ? (T(), R("div", $r, [
|
|
5143
5175
|
b("div", ea, [
|
|
5144
|
-
|
|
5176
|
+
m[7] || (m[7] = b("label", null, "场景物体", -1)),
|
|
5145
5177
|
b("div", ta, [
|
|
5146
5178
|
(T(!0), R(ve, null, wt(r.treeData, (f) => (T(), Ke(er, {
|
|
5147
5179
|
key: f.uuid,
|
|
5148
5180
|
node: f,
|
|
5149
5181
|
"selected-object": r.selectedObject,
|
|
5150
5182
|
version: c.value,
|
|
5151
|
-
onSelect:
|
|
5183
|
+
onSelect: m[0] || (m[0] = (g) => s("treeSelect", g)),
|
|
5152
5184
|
onDelete: d
|
|
5153
5185
|
}, null, 8, ["node", "selected-object", "version"]))), 128)),
|
|
5154
5186
|
r.treeData.length === 0 ? (T(), R("div", na, "暂无物体")) : X("", !0)
|
|
5155
5187
|
])
|
|
5156
5188
|
]),
|
|
5157
5189
|
b("div", sa, [
|
|
5158
|
-
|
|
5190
|
+
m[8] || (m[8] = b("label", null, "全局属性", -1)),
|
|
5159
5191
|
b("div", ia, [
|
|
5160
5192
|
b("button", {
|
|
5161
5193
|
class: se(["mode-btn", { active: n.value === "translate" }]),
|
|
5162
5194
|
title: "移动 (W)",
|
|
5163
|
-
onClick:
|
|
5195
|
+
onClick: m[1] || (m[1] = (f) => i("translate"))
|
|
5164
5196
|
}, " ↕ 移动 ", 2),
|
|
5165
5197
|
b("button", {
|
|
5166
5198
|
class: se(["mode-btn", { active: n.value === "rotate" }]),
|
|
5167
5199
|
title: "旋转 (E)",
|
|
5168
|
-
onClick:
|
|
5200
|
+
onClick: m[2] || (m[2] = (f) => i("rotate"))
|
|
5169
5201
|
}, " ↻ 旋转 ", 2),
|
|
5170
5202
|
b("button", {
|
|
5171
5203
|
class: se(["mode-btn", { active: n.value === "scale" }]),
|
|
5172
5204
|
title: "缩放 (R)",
|
|
5173
|
-
onClick:
|
|
5205
|
+
onClick: m[3] || (m[3] = (f) => i("scale"))
|
|
5174
5206
|
}, " ⤡ 缩放 ", 2)
|
|
5175
5207
|
])
|
|
5176
5208
|
]),
|
|
5177
5209
|
r.selectedObject ? (T(), R("div", oa, [
|
|
5178
5210
|
b("button", {
|
|
5179
5211
|
class: se(["tab-btn", { active: a.value === "transform" }]),
|
|
5180
|
-
onClick:
|
|
5212
|
+
onClick: m[4] || (m[4] = (f) => a.value = "transform")
|
|
5181
5213
|
}, " 🔄 变换 ", 2),
|
|
5182
5214
|
b("button", {
|
|
5183
5215
|
class: se(["tab-btn", { active: a.value === "userdata" }]),
|
|
5184
|
-
onClick:
|
|
5216
|
+
onClick: m[5] || (m[5] = (f) => a.value = "userdata")
|
|
5185
5217
|
}, " 📋 自定义数据 ", 2),
|
|
5186
5218
|
l.value ? (T(), R("button", {
|
|
5187
5219
|
key: 0,
|
|
5188
5220
|
class: se(["tab-btn", { active: a.value === "datapanel" }]),
|
|
5189
|
-
onClick:
|
|
5221
|
+
onClick: m[6] || (m[6] = (f) => a.value = "datapanel")
|
|
5190
5222
|
}, " 📊 数据面板 ", 2)) : X("", !0)
|
|
5191
5223
|
])) : X("", !0),
|
|
5192
5224
|
r.selectedObject ? (T(), R("div", ra, [
|
|
@@ -5204,7 +5236,7 @@ const $r = {
|
|
|
5204
5236
|
[De, a.value === "datapanel"]
|
|
5205
5237
|
])
|
|
5206
5238
|
])) : X("", !0)
|
|
5207
|
-
])) : (T(), R("div", aa, [...
|
|
5239
|
+
])) : (T(), R("div", aa, [...m[9] || (m[9] = [
|
|
5208
5240
|
b("p", null, "未选中任何模型", -1)
|
|
5209
5241
|
])]));
|
|
5210
5242
|
}
|
|
@@ -5213,19 +5245,19 @@ const $r = {
|
|
|
5213
5245
|
emits: ["addModel", "importModel"],
|
|
5214
5246
|
setup(r, { emit: e }) {
|
|
5215
5247
|
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 =
|
|
5248
|
+
var m;
|
|
5249
|
+
return (m = a.value) == null ? void 0 : m.click();
|
|
5250
|
+
}, c = (m) => {
|
|
5251
|
+
const f = m.target;
|
|
5220
5252
|
f.files && f.files.length > 0 && (o("importModel", f.files[0]), f.value = "");
|
|
5221
5253
|
}, A = () => console.log("撤销"), u = () => console.log("删除物体"), h = async () => {
|
|
5222
|
-
const
|
|
5223
|
-
console.log(JSON.parse(await
|
|
5254
|
+
const m = Ki();
|
|
5255
|
+
console.log(JSON.parse(await m));
|
|
5224
5256
|
}, d = () => {
|
|
5225
5257
|
if (!localStorage.getItem("test_id")) return localStorage.setItem("test_id", "123");
|
|
5226
5258
|
Ei(localStorage.getItem("test_id"));
|
|
5227
|
-
},
|
|
5228
|
-
return (
|
|
5259
|
+
}, p = () => qn();
|
|
5260
|
+
return (m, f) => (T(), R("div", ua, [
|
|
5229
5261
|
b("div", Aa, [
|
|
5230
5262
|
b("div", {
|
|
5231
5263
|
class: "dropdown-wrapper",
|
|
@@ -5309,7 +5341,7 @@ const $r = {
|
|
|
5309
5341
|
}, "镜头拉近"),
|
|
5310
5342
|
b("div", {
|
|
5311
5343
|
class: "menu-item",
|
|
5312
|
-
onClick:
|
|
5344
|
+
onClick: p
|
|
5313
5345
|
}, " 重置相机位置 ")
|
|
5314
5346
|
], 512), [
|
|
5315
5347
|
[De, t.value]
|
|
@@ -5355,7 +5387,7 @@ const $r = {
|
|
|
5355
5387
|
Ti((g) => {
|
|
5356
5388
|
t.value = g;
|
|
5357
5389
|
});
|
|
5358
|
-
const s =
|
|
5390
|
+
const s = $t(null), n = kt({
|
|
5359
5391
|
position: { x: 0, y: 0, z: 0 },
|
|
5360
5392
|
rotation: { x: 0, y: 0, z: 0 },
|
|
5361
5393
|
scale: { x: 1, y: 1, z: 1 }
|
|
@@ -5388,20 +5420,20 @@ const $r = {
|
|
|
5388
5420
|
} catch (x) {
|
|
5389
5421
|
console.error("导入失败:", x), alert("导入失败:" + x.message);
|
|
5390
5422
|
}
|
|
5391
|
-
}, A =
|
|
5423
|
+
}, A = $t([]);
|
|
5392
5424
|
Bi((g) => {
|
|
5393
5425
|
A.value = g;
|
|
5394
5426
|
});
|
|
5395
5427
|
const u = () => {
|
|
5396
5428
|
const g = Ui();
|
|
5397
5429
|
g && (A.value = g);
|
|
5398
|
-
}, h = (g) => Qt(g), d = (g) => Wi(g.uuid),
|
|
5430
|
+
}, h = (g) => Qt(g), d = (g) => Wi(g.uuid), p = (g) => {
|
|
5399
5431
|
Oi(g);
|
|
5400
|
-
},
|
|
5401
|
-
|
|
5432
|
+
}, m = j(null), f = () => {
|
|
5433
|
+
m.value && Ii(m.value, e.mode, e.sceneData), u();
|
|
5402
5434
|
};
|
|
5403
5435
|
return as(() => {
|
|
5404
|
-
f(),
|
|
5436
|
+
f(), m.value && fi(m.value);
|
|
5405
5437
|
}), ls(() => {
|
|
5406
5438
|
console.log("endset_three_editor destroy"), Qi();
|
|
5407
5439
|
}), (g, x) => (T(), R("div", Ca, [
|
|
@@ -5420,7 +5452,7 @@ const $r = {
|
|
|
5420
5452
|
b("div", {
|
|
5421
5453
|
class: se(`canvas canvas-mode-${r.mode}`),
|
|
5422
5454
|
ref_key: "containerRef",
|
|
5423
|
-
ref:
|
|
5455
|
+
ref: m
|
|
5424
5456
|
}, null, 2),
|
|
5425
5457
|
r.mode === "edit" ? (T(), Ke(ca, {
|
|
5426
5458
|
key: 0,
|
|
@@ -5430,7 +5462,7 @@ const $r = {
|
|
|
5430
5462
|
onPropertyChange: a,
|
|
5431
5463
|
onTreeSelect: h,
|
|
5432
5464
|
onTreeDelete: d,
|
|
5433
|
-
onTransformModeChange:
|
|
5465
|
+
onTransformModeChange: p
|
|
5434
5466
|
}, null, 8, ["transform", "tree-data", "selected-object"])) : X("", !0)
|
|
5435
5467
|
], 2),
|
|
5436
5468
|
r.mode === "edit" ? (T(), Ke(ya, { key: 2 })) : X("", !0)
|
|
@@ -5439,7 +5471,7 @@ const $r = {
|
|
|
5439
5471
|
}), Sa = /* @__PURE__ */ Ie(wa, [["__scopeId", "data-v-ffa5f5c1"]]);
|
|
5440
5472
|
export {
|
|
5441
5473
|
ya as BottomBar,
|
|
5442
|
-
|
|
5474
|
+
Gn as DataPanel,
|
|
5443
5475
|
Sa as DrawingBoard,
|
|
5444
5476
|
ca as PropertyPanel,
|
|
5445
5477
|
ga as TopBar,
|
|
@@ -5464,7 +5496,7 @@ export {
|
|
|
5464
5496
|
Ui as getSceneObjects,
|
|
5465
5497
|
Vi as getSelectedObject,
|
|
5466
5498
|
Vo as importModelFromFile,
|
|
5467
|
-
|
|
5499
|
+
qn as initDefaultMainCamera,
|
|
5468
5500
|
Ii as initEditor,
|
|
5469
5501
|
Zi as loadSceneFromJSON,
|
|
5470
5502
|
Bi as onSceneObjectsChangeCallback,
|