endset_three_editor 0.4.8 → 0.4.9
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 es = (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) => es(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { toRaw as vt, defineComponent as be, ref as j, inject as ts, computed as Ue, watchEffect as ns, resolveComponent as ss, openBlock as T, createElementBlock as R, createElementVNode as b, normalizeClass as se, withModifiers as Wt, unref as is, toDisplayString as ie, Fragment as ve, renderList as Mt, createBlock as Ze, createCommentVNode as X, reactive as zt, watch as Me, withDirectives as E, vModelText as N, withKeys as He, vModelCheckbox as os, toRef as rs, provide as as, createVNode as Tt, vShow as De, shallowRef as
|
|
4
|
+
import { toRaw as vt, defineComponent as be, ref as j, inject as ts, computed as Ue, watchEffect as ns, resolveComponent as ss, openBlock as T, createElementBlock as R, createElementVNode as b, normalizeClass as se, withModifiers as Wt, unref as is, toDisplayString as ie, Fragment as ve, renderList as Mt, createBlock as Ze, createCommentVNode as X, reactive as zt, watch as Me, withDirectives as E, vModelText as N, withKeys as He, vModelCheckbox as os, toRef as rs, provide as as, createVNode as Tt, vShow as De, shallowRef as nn, onMounted as ls, onBeforeUnmount as cs } from "vue";
|
|
5
5
|
import * as P from "three";
|
|
6
|
-
import { Controls as
|
|
6
|
+
import { Controls as Sn, Vector3 as M, MOUSE as Ne, TOUCH as Le, Quaternion as K, Spherical as sn, Vector2 as Y, Ray as us, Plane as As, MathUtils as Hn, Raycaster as ds, Object3D as ke, MeshBasicMaterial as Pe, LineBasicMaterial as Qe, CylinderGeometry as U, BoxGeometry as q, BufferGeometry as We, Float32BufferAttribute as pe, Mesh as v, OctahedronGeometry as ut, Line as ue, TorusGeometry as Ge, SphereGeometry as hs, Euler as fs, Matrix4 as me, PlaneGeometry as ps, DoubleSide as Ln, Loader as Zt, FileLoader as nt, Color as de, SRGBColorSpace as Ae, Group as mt, Material as Je, PointsMaterial as Ve, MeshPhongMaterial as ms, LineSegments as Gt, Points as gt, TrianglesDrawMode as gs, TriangleFanDrawMode as Ft, TriangleStripDrawMode as Nn, LoaderUtils as _e, MeshPhysicalMaterial as le, LinearSRGBColorSpace as ae, SpotLight as bs, PointLight as Is, DirectionalLight as ys, InstancedMesh as Cs, InstancedBufferAttribute as xs, TextureLoader as ws, ImageBitmapLoader as vs, BufferAttribute as $e, InterleavedBuffer as jn, InterleavedBufferAttribute as kn, LinearMipmapLinearFilter as Wn, NearestMipmapLinearFilter as Ms, LinearMipmapNearestFilter as Ds, NearestMipmapNearestFilter as Ps, LinearFilter as qt, NearestFilter as zn, RepeatWrapping as Xt, MirroredRepeatWrapping as Ts, ClampToEdgeWrapping as Os, MeshStandardMaterial as Gn, PropertyBinding as Es, SkinnedMesh as Rs, LineLoop as Ss, PerspectiveCamera as Hs, OrthographicCamera as Ls, Skeleton as Ns, AnimationClip as js, Bone as ks, InterpolateDiscrete as Ws, InterpolateLinear as Fn, Texture as on, VectorKeyframeTrack as rn, NumberKeyframeTrack as an, QuaternionKeyframeTrack as ln, ColorManagement as Bt, FrontSide as zs, Interpolant as Gs, Box3 as Fs, Sphere as qs } from "three";
|
|
7
7
|
import st from "@tweenjs/tween.js";
|
|
8
|
-
const
|
|
8
|
+
const cn = { type: "change" }, Qt = { type: "start" }, qn = { type: "end" }, At = new us(), un = new As(), Xs = Math.cos(70 * Hn.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 ln = { type: "change" }, Qt = { type: "start" }, Fn = { type: "end" }, At
|
|
|
15
15
|
TOUCH_DOLLY_PAN: 5,
|
|
16
16
|
TOUCH_DOLLY_ROTATE: 6
|
|
17
17
|
}, Ot = 1e-6;
|
|
18
|
-
class Bs extends
|
|
18
|
+
class Bs extends Sn {
|
|
19
19
|
/**
|
|
20
20
|
* Constructs a new controls instance.
|
|
21
21
|
*
|
|
@@ -23,7 +23,7 @@ class Bs extends Rn {
|
|
|
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 sn(), this._sphericalDelta = new sn(), 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 = Vs.bind(this), this._onPointerDown = Us.bind(this), this._onPointerUp = Ys.bind(this), this._onContextMenu = ei.bind(this), this._onMouseWheel = Qs.bind(this), this._onKeyDown = Js.bind(this), this._onTouchStart = _s.bind(this), this._onTouchMove = $s.bind(this), this._onMouseDown = Ks.bind(this), this._onMouseMove = Zs.bind(this), this._interceptControlDown = ti.bind(this), this._interceptControlUp = ni.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 Bs extends Rn {
|
|
|
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(cn), this.update(), this.state = H.NONE;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Programmatically pan the camera.
|
|
@@ -167,12 +167,12 @@ class Bs extends Rn {
|
|
|
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) : (At.origin.copy(this.object.position), At.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(At.direction)) < Xs ? 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) : (At.origin.copy(this.object.position), At.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(At.direction)) < Xs ? this.object.lookAt(this.target) : (un.setFromNormalAndCoplanarPoint(this.object.up, this.target), At.intersectPlane(un, 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) > Ot || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Ot || this._lastTargetPosition.distanceToSquared(this.target) > Ot ? (this.dispatchEvent(
|
|
175
|
+
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > Ot || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Ot || this._lastTargetPosition.distanceToSquared(this.target) > Ot ? (this.dispatchEvent(cn), 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 Vs(r) {
|
|
|
373
373
|
function Ys(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(qn), 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 Zs(r) {
|
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
function Qs(r) {
|
|
444
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== H.NONE || (r.preventDefault(), this.dispatchEvent(Qt), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(
|
|
444
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== H.NONE || (r.preventDefault(), this.dispatchEvent(Qt), this._handleMouseWheel(this._customWheelEvent(r)), this.dispatchEvent(qn));
|
|
445
445
|
}
|
|
446
446
|
function Js(r) {
|
|
447
447
|
this.enabled !== !1 && this._handleKeyDown(r);
|
|
@@ -512,12 +512,12 @@ function ti(r) {
|
|
|
512
512
|
function ni(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 ds(), F = new M(), he = new M(), k = new K(),
|
|
515
|
+
const Ce = new ds(), F = new M(), he = new M(), k = new K(), An = {
|
|
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
|
-
}, Et = { type: "change" },
|
|
520
|
-
class si extends
|
|
519
|
+
}, Et = { type: "change" }, dn = { type: "mouseDown", mode: null }, hn = { type: "mouseUp", mode: null }, fn = { type: "objectChange" };
|
|
520
|
+
class si extends Sn {
|
|
521
521
|
/**
|
|
522
522
|
* Constructs a new controls instance.
|
|
523
523
|
*
|
|
@@ -573,7 +573,7 @@ class si extends Rn {
|
|
|
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 = Rt(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, dn.mode = this.mode, this.dispatchEvent(dn);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
pointerMove(e) {
|
|
@@ -596,13 +596,13 @@ class si extends Rn {
|
|
|
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(An[t]), F.copy(An[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(Et), this.dispatchEvent(
|
|
601
|
+
this.dispatchEvent(Et), this.dispatchEvent(fn);
|
|
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 && (hn.mode = this.mode, this.dispatchEvent(hn)), this.dragging = !1, this.axis = null);
|
|
606
606
|
}
|
|
607
607
|
dispose() {
|
|
608
608
|
this.disconnect(), this._root.dispose();
|
|
@@ -628,7 +628,7 @@ class si extends Rn {
|
|
|
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(Et), 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(Et), this.dispatchEvent(fn), 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 Rt(r, e, t) {
|
|
|
749
749
|
return s[n];
|
|
750
750
|
return !1;
|
|
751
751
|
}
|
|
752
|
-
const dt = new fs(), L = new M(0, 1, 0),
|
|
752
|
+
const dt = new fs(), L = new M(0, 1, 0), pn = new M(0, 0, 0), mn = new me(), ht = new K(), bt = new K(), oe = new M(), gn = new me(), Ye = new M(1, 0, 0), we = new M(0, 1, 0), Ke = new M(0, 0, 1), ft = new M(), Fe = new M(), qe = new M();
|
|
753
753
|
class ci extends ke {
|
|
754
754
|
constructor(e) {
|
|
755
755
|
super(), this.isTransformControlsRoot = !0, this.controls = e, this.visible = !1;
|
|
@@ -1007,8 +1007,8 @@ class ui extends ke {
|
|
|
1007
1007
|
for (let Ee = $[ne].length; Ee--; ) {
|
|
1008
1008
|
const B = $[ne][Ee][0].clone(), at = $[ne][Ee][1], lt = $[ne][Ee][2], ct = $[ne][Ee][3], _n = $[ne][Ee][4];
|
|
1009
1009
|
B.name = ne, B.tag = _n, at && B.position.set(at[0], at[1], at[2]), lt && B.rotation.set(lt[0], lt[1], lt[2]), ct && B.scale.set(ct[0], ct[1], ct[2]), B.updateMatrix();
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1010
|
+
const tn = B.geometry.clone();
|
|
1011
|
+
tn.applyMatrix4(B.matrix), B.geometry = tn, B.renderOrder = 1 / 0, B.position.set(0, 0, 0), B.rotation.set(0, 0, 0), B.scale.set(1, 1, 1), rt.add(B);
|
|
1012
1012
|
}
|
|
1013
1013
|
return rt;
|
|
1014
1014
|
}
|
|
@@ -1025,10 +1025,10 @@ class ui 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(dt.set(0, 0, 0)), o.quaternion.copy(s).multiply(k), Math.abs(L.copy(Ye).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Y" && (k.setFromEuler(dt.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(dt.set(0, Math.PI / 2, 0)), o.quaternion.copy(s).multiply(k), Math.abs(L.copy(Ke).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "XYZE" && (k.setFromEuler(dt.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(dt.set(0, 0, 0)), o.quaternion.copy(s).multiply(k), Math.abs(L.copy(Ye).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "Y" && (k.setFromEuler(dt.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(dt.set(0, Math.PI / 2, 0)), o.quaternion.copy(s).multiply(k), Math.abs(L.copy(Ke).applyQuaternion(s).dot(this.eye)) > 0.9 && (o.visible = !1)), this.axis === "XYZE" && (k.setFromEuler(dt.set(0, Math.PI / 2, 0)), L.copy(this.rotationAxis), o.quaternion.setFromRotationMatrix(mn.lookAt(pn, 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(Ye).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(Ke).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(Ke).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(Ye).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" && (ht.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(Ye).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(Ke).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(Ke).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(Ye).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" && (ht.copy(s), L.copy(this.eye).applyQuaternion(k.copy(s).invert()), o.name.search("E") !== -1 && o.quaternion.setFromRotationMatrix(mn.lookAt(this.eye, pn, we)), o.name === "X" && (k.setFromAxisAngle(Ye, Math.atan2(-L.y, L.z)), k.multiplyQuaternions(ht, k), o.quaternion.copy(k)), o.name === "Y" && (k.setFromAxisAngle(we, Math.atan2(L.x, L.z)), k.multiplyQuaternions(ht, k), o.quaternion.copy(k)), o.name === "Z" && (k.setFromAxisAngle(Ke, Math.atan2(L.y, L.x)), k.multiplyQuaternions(ht, 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 Ai extends v {
|
|
|
1039
1039
|
constructor() {
|
|
1040
1040
|
super(
|
|
1041
1041
|
new ps(1e5, 1e5, 2, 2),
|
|
1042
|
-
new Pe({ visible: !1, wireframe: !0, side:
|
|
1042
|
+
new Pe({ visible: !1, wireframe: !0, side: Ln, 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 Ai 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) : (gn.lookAt(F.set(0, 0, 0), oe, L), this.quaternion.setFromRotationMatrix(gn)), super.updateMatrixWorld(e);
|
|
1080
1080
|
}
|
|
1081
1081
|
}
|
|
1082
1082
|
class di extends ke {
|
|
@@ -1096,7 +1096,7 @@ class di 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(), bn = new me(), In = new me(), yn = new M(), Cn = new M();
|
|
1100
1100
|
class hi {
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Constructs a new CSS2D renderer.
|
|
@@ -1115,7 +1115,7 @@ class hi {
|
|
|
1115
1115
|
height: n
|
|
1116
1116
|
};
|
|
1117
1117
|
}, this.render = function(p, m) {
|
|
1118
|
-
p.matrixWorldAutoUpdate === !0 && p.updateMatrixWorld(), m.parent === null && m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(),
|
|
1118
|
+
p.matrixWorldAutoUpdate === !0 && p.updateMatrixWorld(), m.parent === null && m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld(), bn.copy(m.matrixWorldInverse), In.multiplyMatrices(m.projectionMatrix, bn), A(p, p, m), this.sortObjects && d(p);
|
|
1119
1119
|
}, this.setSize = function(p, m) {
|
|
1120
1120
|
s = p, n = m, i = s / 2, o = n / 2, l.style.width = p + "px", l.style.height = m + "px";
|
|
1121
1121
|
};
|
|
@@ -1130,7 +1130,7 @@ class hi {
|
|
|
1130
1130
|
return;
|
|
1131
1131
|
}
|
|
1132
1132
|
if (p.isCSS2DObject) {
|
|
1133
|
-
Se.setFromMatrixPosition(p.matrixWorld), Se.applyMatrix4(
|
|
1133
|
+
Se.setFromMatrixPosition(p.matrixWorld), Se.applyMatrix4(In);
|
|
1134
1134
|
const g = Se.z >= -1 && Se.z <= 1 && p.layers.test(f.layers) === !0, x = p.element;
|
|
1135
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 y = {
|
|
@@ -1142,7 +1142,7 @@ class hi {
|
|
|
1142
1142
|
A(p.children[g], m, f);
|
|
1143
1143
|
}
|
|
1144
1144
|
function u(p, m) {
|
|
1145
|
-
return
|
|
1145
|
+
return yn.setFromMatrixPosition(p.matrixWorld), Cn.setFromMatrixPosition(m.matrixWorld), yn.distanceToSquared(Cn);
|
|
1146
1146
|
}
|
|
1147
1147
|
function h(p) {
|
|
1148
1148
|
const m = [];
|
|
@@ -1411,7 +1411,7 @@ class it {
|
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
const xt = /* @__PURE__ */ new WeakMap();
|
|
1414
|
-
function
|
|
1414
|
+
function Xn(r, e) {
|
|
1415
1415
|
const t = vt(r);
|
|
1416
1416
|
xt.set(t, e), t.userData._hasDataPanel = !0;
|
|
1417
1417
|
}
|
|
@@ -1468,7 +1468,7 @@ let Te = null, Vt = null, yt = null, ge = [];
|
|
|
1468
1468
|
const ot = /* @__PURE__ */ new Map();
|
|
1469
1469
|
let wt, Ct = null, et = null, tt = null;
|
|
1470
1470
|
function Ti(r, e = "edit", t) {
|
|
1471
|
-
I.container = r, I.mode = e, Oi(), Ei(), Si(), t && (io(t.scene, e, t.dataPanels), t != null && t.camera && (I.defaultMainCamera = t.camera,
|
|
1471
|
+
I.container = r, I.mode = e, Oi(), Ei(), Si(), t && (io(t.scene, e, t.dataPanels), t != null && t.camera && (I.defaultMainCamera = t.camera, Bn(!0))), Li(), Hi(), wt && I.orbitControls && (I.orbitControls.target.fromArray(wt), I.orbitControls.update()), Qi(), Un(), et = (s) => Gi(s), tt = () => ji(), e === "edit" && r.addEventListener("click", et), window.addEventListener("resize", tt), t || Ni(), e === "edit" && Ri();
|
|
1472
1472
|
}
|
|
1473
1473
|
function Oi() {
|
|
1474
1474
|
const r = new P.WebGLRenderer({ antialias: !0, alpha: !0 });
|
|
@@ -1490,8 +1490,9 @@ function Si() {
|
|
|
1490
1490
|
const r = I.container, e = r.clientWidth / r.clientHeight, t = new P.PerspectiveCamera(45, e, 0.1, 1e3);
|
|
1491
1491
|
t.position.set(0, 6, 15), t.lookAt(0, 0, 0), I.camera = t;
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function Bn(r = !1) {
|
|
1494
1494
|
if (!I.defaultMainCamera) return;
|
|
1495
|
+
$t();
|
|
1495
1496
|
const e = I.defaultMainCamera;
|
|
1496
1497
|
if (r) {
|
|
1497
1498
|
I.camera.position.set(
|
|
@@ -1567,9 +1568,9 @@ function Ni() {
|
|
|
1567
1568
|
const r = new P.AmbientLight(16777215, 1);
|
|
1568
1569
|
I.scene.add(r);
|
|
1569
1570
|
}
|
|
1570
|
-
function
|
|
1571
|
+
function Un() {
|
|
1571
1572
|
var r, e;
|
|
1572
|
-
Ct = requestAnimationFrame(
|
|
1573
|
+
Ct = requestAnimationFrame(Un), st.update(), (r = I.orbitControls) == null || r.update(), (e = I.renderer) == null || e.render(I.scene, I.camera), I.scene && I.camera && vi(I.scene, I.camera), I.scene && I.scene.traverse((t) => {
|
|
1573
1574
|
if (t.userData.isWater && t.type === "Mesh") {
|
|
1574
1575
|
const s = t, n = s.material;
|
|
1575
1576
|
if (n.normalMap) {
|
|
@@ -1585,7 +1586,7 @@ function ji() {
|
|
|
1585
1586
|
r === 0 || e === 0 || (I.camera.aspect = r / e, I.camera.updateProjectionMatrix(), I.renderer.setSize(r, e), Mi(r, e));
|
|
1586
1587
|
}
|
|
1587
1588
|
function _t(r) {
|
|
1588
|
-
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,
|
|
1589
|
+
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, Vn(r), console.log("选中", I.selectedObject), Te == null || Te(r));
|
|
1589
1590
|
}
|
|
1590
1591
|
let J = null;
|
|
1591
1592
|
function ki(r) {
|
|
@@ -1597,8 +1598,8 @@ function St(r) {
|
|
|
1597
1598
|
function Wi(r) {
|
|
1598
1599
|
I.transformControlsMode = r, I.transformControls && I.transformControls.setMode(I.transformControlsMode);
|
|
1599
1600
|
}
|
|
1600
|
-
function
|
|
1601
|
-
|
|
1601
|
+
function Vn(r) {
|
|
1602
|
+
$t(), r.traverse((e) => {
|
|
1602
1603
|
if (e.isMesh) {
|
|
1603
1604
|
const t = e, s = new P.EdgesGeometry(t.geometry), n = new P.LineBasicMaterial({
|
|
1604
1605
|
color: Pi,
|
|
@@ -1608,20 +1609,15 @@ function Un(r) {
|
|
|
1608
1609
|
}
|
|
1609
1610
|
});
|
|
1610
1611
|
}
|
|
1611
|
-
function
|
|
1612
|
+
function $t() {
|
|
1612
1613
|
for (const r of Ut)
|
|
1613
1614
|
r.parent && r.parent.remove(r), r.geometry.dispose(), r.material.dispose();
|
|
1614
1615
|
Ut = [];
|
|
1615
1616
|
}
|
|
1616
|
-
function
|
|
1617
|
-
I.selectedObject && (
|
|
1617
|
+
function en() {
|
|
1618
|
+
I.selectedObject && ($t(), I.transformControls.detach(), I.selectedObject = null, Te == null || Te(null));
|
|
1618
1619
|
}
|
|
1619
1620
|
function zi(r) {
|
|
1620
|
-
if (!r) {
|
|
1621
|
-
console.warn("[selectModelHandle] 传入的 objectId 为空");
|
|
1622
|
-
return;
|
|
1623
|
-
}
|
|
1624
|
-
qi(r);
|
|
1625
1621
|
let e = null;
|
|
1626
1622
|
ot.forEach((t) => {
|
|
1627
1623
|
t.userData.id == r && (e = t), t.children && t.children.forEach((s) => {
|
|
@@ -1629,7 +1625,7 @@ function zi(r) {
|
|
|
1629
1625
|
});
|
|
1630
1626
|
}), e && (e.children.forEach((t) => {
|
|
1631
1627
|
t.name && t.name.startsWith("DataPanel_") && (t.visible = !0);
|
|
1632
|
-
}),
|
|
1628
|
+
}), Vn(e), qi(r));
|
|
1633
1629
|
}
|
|
1634
1630
|
function Gi(r) {
|
|
1635
1631
|
if (Oe) {
|
|
@@ -1650,7 +1646,7 @@ function Gi(r) {
|
|
|
1650
1646
|
let o = Fi(i[0].object);
|
|
1651
1647
|
_t(o);
|
|
1652
1648
|
} else
|
|
1653
|
-
|
|
1649
|
+
en();
|
|
1654
1650
|
}
|
|
1655
1651
|
function Fi(r) {
|
|
1656
1652
|
if (r.type === "Line") {
|
|
@@ -1734,7 +1730,7 @@ function ze(r, e = !1) {
|
|
|
1734
1730
|
I.scene.add(r), r.userData.isMovable && (Ki(r), Dt()), e && I.mode === "edit" && _t(r);
|
|
1735
1731
|
}
|
|
1736
1732
|
function Vi(r) {
|
|
1737
|
-
I.selectedObject === r &&
|
|
1733
|
+
I.selectedObject === r && en(), Ui(r), Bi(r), r.userData.helper && I.scene.remove(r.userData.helper), r.parent ? r.parent.remove(r) : I.scene.remove(r), Zi(r), Dt();
|
|
1738
1734
|
}
|
|
1739
1735
|
function Yi(r) {
|
|
1740
1736
|
const e = I.scene.getObjectByProperty("uuid", r);
|
|
@@ -1790,7 +1786,7 @@ function Ga() {
|
|
|
1790
1786
|
}
|
|
1791
1787
|
async function so() {
|
|
1792
1788
|
var c, A, u;
|
|
1793
|
-
J == null || J(!0), await new Promise((h) => setTimeout(h, 50)),
|
|
1789
|
+
J == null || J(!0), await new Promise((h) => setTimeout(h, 50)), en();
|
|
1794
1790
|
const r = I.scene;
|
|
1795
1791
|
if (!r)
|
|
1796
1792
|
return J == null || J(!1), "{}";
|
|
@@ -1866,7 +1862,7 @@ function io(r, e = "edit", t) {
|
|
|
1866
1862
|
title: u.title,
|
|
1867
1863
|
items: u.items
|
|
1868
1864
|
});
|
|
1869
|
-
h.attachTo(c), h.visible = !1, u.width && h.setWidth(u.width), u.fontSize && h.setFontSize(u.fontSize),
|
|
1865
|
+
h.attachTo(c), h.visible = !1, u.width && h.setWidth(u.width), u.fontSize && h.setFontSize(u.fontSize), Xn(c, h);
|
|
1870
1866
|
}
|
|
1871
1867
|
})), e === "edit" && ((l = I.scene) == null || l.traverse((c) => {
|
|
1872
1868
|
var A;
|
|
@@ -1894,7 +1890,7 @@ function Yn(r) {
|
|
|
1894
1890
|
function oo() {
|
|
1895
1891
|
Ct !== null && (cancelAnimationFrame(Ct), Ct = null), et && I.container && (I.container.removeEventListener("click", et), et = null), tt && (window.removeEventListener("resize", tt), tt = null), I.orbitControls && (I.orbitControls.dispose(), I.orbitControls = null), I.transformControls && (I.transformControls.dispose(), I.transformControls = null), I.scene && (Yn(I.scene), I.scene = null), I.renderer && (I.renderer.dispose(), I.renderer.domElement && I.container && I.container.removeChild(I.renderer.domElement), I.renderer = null), Di(), I.camera = null, I.gridHelper = null, I.selectedObject = null, I.container = null, I.mode = "", ge = [], ot.clear(), Dt(), It = !1, Oe = !1;
|
|
1896
1892
|
}
|
|
1897
|
-
const ro = /^[og]\s*(.+)?/, ao = /^mtllib /, lo = /^usemtl /, co = /^usemap /,
|
|
1893
|
+
const ro = /^[og]\s*(.+)?/, ao = /^mtllib /, lo = /^usemtl /, co = /^usemap /, xn = /\s+/, wn = new M(), Ht = new M(), vn = new M(), Mn = new M(), ee = new M(), pt = new de();
|
|
1898
1894
|
function uo() {
|
|
1899
1895
|
const r = {
|
|
1900
1896
|
objects: [],
|
|
@@ -2004,7 +2000,7 @@ function uo() {
|
|
|
2004
2000
|
},
|
|
2005
2001
|
addFaceNormal: function(e, t, s) {
|
|
2006
2002
|
const n = this.vertices, i = this.object.geometry.normals;
|
|
2007
|
-
|
|
2003
|
+
wn.fromArray(n, e), Ht.fromArray(n, t), vn.fromArray(n, s), ee.subVectors(vn, Ht), Mn.subVectors(wn, Ht), ee.cross(Mn), 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);
|
|
2008
2004
|
},
|
|
2009
2005
|
addColor: function(e, t, s) {
|
|
2010
2006
|
const n = this.colors, i = this.object.geometry.colors;
|
|
@@ -2113,7 +2109,7 @@ class Ao extends Zt {
|
|
|
2113
2109
|
const A = c.charAt(0);
|
|
2114
2110
|
if (A !== "#")
|
|
2115
2111
|
if (A === "v") {
|
|
2116
|
-
const u = c.split(
|
|
2112
|
+
const u = c.split(xn);
|
|
2117
2113
|
switch (u[0]) {
|
|
2118
2114
|
case "v":
|
|
2119
2115
|
t.vertices.push(
|
|
@@ -2142,7 +2138,7 @@ class Ao extends Zt {
|
|
|
2142
2138
|
break;
|
|
2143
2139
|
}
|
|
2144
2140
|
} else if (A === "f") {
|
|
2145
|
-
const h = c.slice(1).trim().split(
|
|
2141
|
+
const h = c.slice(1).trim().split(xn), d = [];
|
|
2146
2142
|
for (let m = 0, f = h.length; m < f; m++) {
|
|
2147
2143
|
const g = h[m];
|
|
2148
2144
|
if (g.length > 0) {
|
|
@@ -2246,10 +2242,10 @@ class Ao extends Zt {
|
|
|
2246
2242
|
return i;
|
|
2247
2243
|
}
|
|
2248
2244
|
}
|
|
2249
|
-
function
|
|
2245
|
+
function Dn(r, e) {
|
|
2250
2246
|
if (e === gs)
|
|
2251
2247
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), r;
|
|
2252
|
-
if (e === Ft || e ===
|
|
2248
|
+
if (e === Ft || e === Nn) {
|
|
2253
2249
|
let t = r.getIndex();
|
|
2254
2250
|
if (t === null) {
|
|
2255
2251
|
const o = [], a = r.getAttribute("position");
|
|
@@ -2328,9 +2324,9 @@ class fo extends Zt {
|
|
|
2328
2324
|
}), this.register(function(t) {
|
|
2329
2325
|
return new mo(t);
|
|
2330
2326
|
}), this.register(function(t) {
|
|
2331
|
-
return new
|
|
2327
|
+
return new Pn(t, O.EXT_MESHOPT_COMPRESSION);
|
|
2332
2328
|
}), this.register(function(t) {
|
|
2333
|
-
return new
|
|
2329
|
+
return new Pn(t, O.KHR_MESHOPT_COMPRESSION);
|
|
2334
2330
|
}), this.register(function(t) {
|
|
2335
2331
|
return new So(t);
|
|
2336
2332
|
});
|
|
@@ -2819,7 +2815,7 @@ class Ro {
|
|
|
2819
2815
|
return s.loadTextureImage(e, o.source, l);
|
|
2820
2816
|
}
|
|
2821
2817
|
}
|
|
2822
|
-
class
|
|
2818
|
+
class Pn {
|
|
2823
2819
|
constructor(e, t) {
|
|
2824
2820
|
this.name = t, this.parser = e;
|
|
2825
2821
|
}
|
|
@@ -2877,7 +2873,7 @@ class So {
|
|
|
2877
2873
|
}));
|
|
2878
2874
|
}
|
|
2879
2875
|
}
|
|
2880
|
-
const Zn = "glTF", Be = 12,
|
|
2876
|
+
const Zn = "glTF", Be = 12, Tn = { JSON: 1313821514, BIN: 5130562 };
|
|
2881
2877
|
class Ho {
|
|
2882
2878
|
constructor(e) {
|
|
2883
2879
|
this.name = O.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
@@ -2896,10 +2892,10 @@ class Ho {
|
|
|
2896
2892
|
const a = i.getUint32(o, !0);
|
|
2897
2893
|
o += 4;
|
|
2898
2894
|
const l = i.getUint32(o, !0);
|
|
2899
|
-
if (o += 4, l ===
|
|
2895
|
+
if (o += 4, l === Tn.JSON) {
|
|
2900
2896
|
const c = new Uint8Array(e, Be + o, a);
|
|
2901
2897
|
this.content = s.decode(c);
|
|
2902
|
-
} else if (l ===
|
|
2898
|
+
} else if (l === Tn.BIN) {
|
|
2903
2899
|
const c = Be + o;
|
|
2904
2900
|
this.body = e.slice(c, c + a);
|
|
2905
2901
|
}
|
|
@@ -2995,14 +2991,14 @@ const te = {
|
|
|
2995
2991
|
5123: Uint16Array,
|
|
2996
2992
|
5125: Uint32Array,
|
|
2997
2993
|
5126: Float32Array
|
|
2998
|
-
},
|
|
2999
|
-
9728:
|
|
2994
|
+
}, On = {
|
|
2995
|
+
9728: zn,
|
|
3000
2996
|
9729: qt,
|
|
3001
2997
|
9984: Ps,
|
|
3002
2998
|
9985: Ds,
|
|
3003
2999
|
9986: Ms,
|
|
3004
|
-
9987:
|
|
3005
|
-
},
|
|
3000
|
+
9987: Wn
|
|
3001
|
+
}, En = {
|
|
3006
3002
|
33071: Os,
|
|
3007
3003
|
33648: Ts,
|
|
3008
3004
|
10497: Xt
|
|
@@ -3034,7 +3030,7 @@ const te = {
|
|
|
3034
3030
|
CUBICSPLINE: void 0,
|
|
3035
3031
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
3036
3032
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
3037
|
-
LINEAR:
|
|
3033
|
+
LINEAR: Fn,
|
|
3038
3034
|
STEP: Ws
|
|
3039
3035
|
}, Nt = {
|
|
3040
3036
|
OPAQUE: "OPAQUE",
|
|
@@ -3042,7 +3038,7 @@ const te = {
|
|
|
3042
3038
|
BLEND: "BLEND"
|
|
3043
3039
|
};
|
|
3044
3040
|
function Go(r) {
|
|
3045
|
-
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new
|
|
3041
|
+
return r.DefaultMaterial === void 0 && (r.DefaultMaterial = new Gn({
|
|
3046
3042
|
color: 16777215,
|
|
3047
3043
|
emissive: 0,
|
|
3048
3044
|
metalness: 1,
|
|
@@ -3398,7 +3394,7 @@ class Vo {
|
|
|
3398
3394
|
if (d && d !== u) {
|
|
3399
3395
|
const g = Math.floor(h / d), x = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + g + ":" + n.count;
|
|
3400
3396
|
let y = t.cache.get(x);
|
|
3401
|
-
y || (m = new c(a, g * d, n.count * d / A), y = new
|
|
3397
|
+
y || (m = new c(a, g * d, n.count * d / A), y = new jn(m, d / A), t.cache.add(x, y)), f = new kn(y, l, h % d / A, p);
|
|
3402
3398
|
} else
|
|
3403
3399
|
a === null ? m = new c(n.count * l) : m = new c(a, h, n.count * l), f = new $e(m, l, p);
|
|
3404
3400
|
if (n.sparse !== void 0) {
|
|
@@ -3436,7 +3432,7 @@ class Vo {
|
|
|
3436
3432
|
const c = this.loadImageSource(t, s).then(function(A) {
|
|
3437
3433
|
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);
|
|
3438
3434
|
const h = (i.samplers || {})[o.sampler] || {};
|
|
3439
|
-
return A.magFilter =
|
|
3435
|
+
return A.magFilter = On[h.magFilter] || qt, A.minFilter = On[h.minFilter] || Wn, A.wrapS = En[h.wrapS] || Xt, A.wrapT = En[h.wrapT] || Xt, A.generateMipmaps = !A.isCompressedTexture && A.minFilter !== zn && A.minFilter !== qt, n.associations.set(A, { textures: e }), A;
|
|
3440
3436
|
}).catch(function() {
|
|
3441
3437
|
return null;
|
|
3442
3438
|
});
|
|
@@ -3460,7 +3456,7 @@ class Vo {
|
|
|
3460
3456
|
return new Promise(function(h, d) {
|
|
3461
3457
|
let p = h;
|
|
3462
3458
|
t.isImageBitmapLoader === !0 && (p = function(m) {
|
|
3463
|
-
const f = new
|
|
3459
|
+
const f = new on(m);
|
|
3464
3460
|
f.needsUpdate = !0, h(f);
|
|
3465
3461
|
}), t.load(_e.resolveURL(u, i.path), p, void 0, d);
|
|
3466
3462
|
});
|
|
@@ -3527,7 +3523,7 @@ class Vo {
|
|
|
3527
3523
|
e.material = s;
|
|
3528
3524
|
}
|
|
3529
3525
|
getMaterialType() {
|
|
3530
|
-
return
|
|
3526
|
+
return Gn;
|
|
3531
3527
|
}
|
|
3532
3528
|
/**
|
|
3533
3529
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -3555,7 +3551,7 @@ class Vo {
|
|
|
3555
3551
|
return h.extendMaterialParams && h.extendMaterialParams(e, a);
|
|
3556
3552
|
})));
|
|
3557
3553
|
}
|
|
3558
|
-
i.doubleSided === !0 && (a.side =
|
|
3554
|
+
i.doubleSided === !0 && (a.side = Ln);
|
|
3559
3555
|
const A = i.alphaMode || Nt.OPAQUE;
|
|
3560
3556
|
if (A === Nt.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, A === Nt.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)) {
|
|
3561
3557
|
const u = i.normalTexture.scale;
|
|
@@ -3594,7 +3590,7 @@ class Vo {
|
|
|
3594
3590
|
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
3595
3591
|
function i(a) {
|
|
3596
3592
|
return s[O.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(l) {
|
|
3597
|
-
return
|
|
3593
|
+
return Rn(l, a, t);
|
|
3598
3594
|
});
|
|
3599
3595
|
}
|
|
3600
3596
|
const o = [];
|
|
@@ -3604,7 +3600,7 @@ class Vo {
|
|
|
3604
3600
|
o.push(u.promise);
|
|
3605
3601
|
else {
|
|
3606
3602
|
let h;
|
|
3607
|
-
c.extensions && c.extensions[O.KHR_DRACO_MESH_COMPRESSION] ? h = i(c) : h =
|
|
3603
|
+
c.extensions && c.extensions[O.KHR_DRACO_MESH_COMPRESSION] ? h = i(c) : h = Rn(new We(), c, t), n[A] = { primitive: c, promise: h }, o.push(h);
|
|
3608
3604
|
}
|
|
3609
3605
|
}
|
|
3610
3606
|
return Promise.all(o);
|
|
@@ -3629,7 +3625,7 @@ class Vo {
|
|
|
3629
3625
|
let g;
|
|
3630
3626
|
const x = c[d];
|
|
3631
3627
|
if (f.mode === te.TRIANGLES || f.mode === te.TRIANGLE_STRIP || f.mode === te.TRIANGLE_FAN || f.mode === void 0)
|
|
3632
|
-
g = i.isSkinnedMesh === !0 ? new Rs(m, x) : new v(m, x), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), f.mode === te.TRIANGLE_STRIP ? g.geometry =
|
|
3628
|
+
g = i.isSkinnedMesh === !0 ? new Rs(m, x) : new v(m, x), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), f.mode === te.TRIANGLE_STRIP ? g.geometry = Dn(g.geometry, Nn) : f.mode === te.TRIANGLE_FAN && (g.geometry = Dn(g.geometry, Ft));
|
|
3633
3629
|
else if (f.mode === te.LINES)
|
|
3634
3630
|
g = new Gt(m, x);
|
|
3635
3631
|
else if (f.mode === te.LINE_STRIP)
|
|
@@ -3670,7 +3666,7 @@ class Vo {
|
|
|
3670
3666
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
3671
3667
|
return;
|
|
3672
3668
|
}
|
|
3673
|
-
return s.type === "perspective" ? t = new Hs(
|
|
3669
|
+
return s.type === "perspective" ? t = new Hs(Hn.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new Ls(-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);
|
|
3674
3670
|
}
|
|
3675
3671
|
/**
|
|
3676
3672
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -3827,7 +3823,7 @@ class Vo {
|
|
|
3827
3823
|
const c = (A) => {
|
|
3828
3824
|
const u = /* @__PURE__ */ new Map();
|
|
3829
3825
|
for (const [h, d] of n.associations)
|
|
3830
|
-
(h instanceof Je || h instanceof
|
|
3826
|
+
(h instanceof Je || h instanceof on) && u.set(h, d);
|
|
3831
3827
|
return A.traverse((h) => {
|
|
3832
3828
|
const d = n.associations.get(h);
|
|
3833
3829
|
d != null && u.set(h, d);
|
|
@@ -3845,29 +3841,29 @@ class Vo {
|
|
|
3845
3841
|
let A;
|
|
3846
3842
|
switch (fe[i.path]) {
|
|
3847
3843
|
case fe.weights:
|
|
3848
|
-
A =
|
|
3844
|
+
A = an;
|
|
3849
3845
|
break;
|
|
3850
3846
|
case fe.rotation:
|
|
3851
|
-
A =
|
|
3847
|
+
A = ln;
|
|
3852
3848
|
break;
|
|
3853
3849
|
case fe.translation:
|
|
3854
3850
|
case fe.scale:
|
|
3855
|
-
A =
|
|
3851
|
+
A = rn;
|
|
3856
3852
|
break;
|
|
3857
3853
|
default:
|
|
3858
3854
|
switch (s.itemSize) {
|
|
3859
3855
|
case 1:
|
|
3860
|
-
A =
|
|
3856
|
+
A = an;
|
|
3861
3857
|
break;
|
|
3862
3858
|
case 2:
|
|
3863
3859
|
case 3:
|
|
3864
3860
|
default:
|
|
3865
|
-
A =
|
|
3861
|
+
A = rn;
|
|
3866
3862
|
break;
|
|
3867
3863
|
}
|
|
3868
3864
|
break;
|
|
3869
3865
|
}
|
|
3870
|
-
const u = n.interpolation !== void 0 ? zo[n.interpolation] :
|
|
3866
|
+
const u = n.interpolation !== void 0 ? zo[n.interpolation] : Fn, h = this._getArrayFromAccessor(s);
|
|
3871
3867
|
for (let d = 0, p = l.length; d < p; d++) {
|
|
3872
3868
|
const m = new A(
|
|
3873
3869
|
l[d] + "." + fe[i.path],
|
|
@@ -3891,7 +3887,7 @@ class Vo {
|
|
|
3891
3887
|
}
|
|
3892
3888
|
_createCubicSplineTrackInterpolant(e) {
|
|
3893
3889
|
e.createInterpolant = function(s) {
|
|
3894
|
-
const n = this instanceof
|
|
3890
|
+
const n = this instanceof ln ? Wo : Qn;
|
|
3895
3891
|
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
3896
3892
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
3897
3893
|
}
|
|
@@ -3937,7 +3933,7 @@ function Yo(r, e, t) {
|
|
|
3937
3933
|
const o = new qs();
|
|
3938
3934
|
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, r.boundingSphere = o;
|
|
3939
3935
|
}
|
|
3940
|
-
function
|
|
3936
|
+
function Rn(r, e, t) {
|
|
3941
3937
|
const s = e.attributes, n = [];
|
|
3942
3938
|
function i(o, a) {
|
|
3943
3939
|
return t.getDependency("accessor", o).then(function(l) {
|
|
@@ -4074,8 +4070,8 @@ class Ko extends Zt {
|
|
|
4074
4070
|
if (o === a)
|
|
4075
4071
|
c = new $e(i, o);
|
|
4076
4072
|
else {
|
|
4077
|
-
const A = new
|
|
4078
|
-
c = new
|
|
4073
|
+
const A = new jn(i, a);
|
|
4074
|
+
c = new kn(A, o, 0);
|
|
4079
4075
|
}
|
|
4080
4076
|
n === "color" && (this._assignVertexColorSpace(c, l), c.normalized = !(i instanceof Float32Array)), t.setAttribute(n, c);
|
|
4081
4077
|
}
|
|
@@ -4368,7 +4364,7 @@ function sr(r) {
|
|
|
4368
4364
|
title: (r == null ? void 0 : r.title) || "数据面板",
|
|
4369
4365
|
items: (r == null ? void 0 : r.items) || s
|
|
4370
4366
|
});
|
|
4371
|
-
return n.attachTo(e),
|
|
4367
|
+
return n.attachTo(e), Xn(e, n), n;
|
|
4372
4368
|
}
|
|
4373
4369
|
const ir = {
|
|
4374
4370
|
key: 1,
|
|
@@ -5283,7 +5279,7 @@ const la = {
|
|
|
5283
5279
|
}, d = () => {
|
|
5284
5280
|
if (!localStorage.getItem("test_id")) return localStorage.setItem("test_id", "123");
|
|
5285
5281
|
zi(localStorage.getItem("test_id"));
|
|
5286
|
-
}, p = () =>
|
|
5282
|
+
}, p = () => Bn();
|
|
5287
5283
|
return (m, f) => (T(), R("div", Ia, [
|
|
5288
5284
|
b("div", ya, [
|
|
5289
5285
|
b("div", {
|
|
@@ -5414,7 +5410,7 @@ const la = {
|
|
|
5414
5410
|
ki((g) => {
|
|
5415
5411
|
t.value = g;
|
|
5416
5412
|
});
|
|
5417
|
-
const s =
|
|
5413
|
+
const s = nn(null), n = zt({
|
|
5418
5414
|
position: { x: 0, y: 0, z: 0 },
|
|
5419
5415
|
rotation: { x: 0, y: 0, z: 0 },
|
|
5420
5416
|
scale: { x: 1, y: 1, z: 1 }
|
|
@@ -5447,7 +5443,7 @@ const la = {
|
|
|
5447
5443
|
} catch (x) {
|
|
5448
5444
|
console.error("导入失败:", x), alert("导入失败:" + x.message);
|
|
5449
5445
|
}
|
|
5450
|
-
}, A =
|
|
5446
|
+
}, A = nn([]);
|
|
5451
5447
|
$i((g) => {
|
|
5452
5448
|
A.value = g;
|
|
5453
5449
|
});
|
|
@@ -5523,7 +5519,7 @@ export {
|
|
|
5523
5519
|
eo as getSceneObjects,
|
|
5524
5520
|
to as getSelectedObject,
|
|
5525
5521
|
tr as importModelFromFile,
|
|
5526
|
-
|
|
5522
|
+
Bn as initDefaultMainCamera,
|
|
5527
5523
|
Ti as initEditor,
|
|
5528
5524
|
io as loadSceneFromJSON,
|
|
5529
5525
|
$i as onSceneObjectsChangeCallback,
|