ss-component-new 1.1.649 → 1.1.650

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.
Files changed (90) hide show
  1. package/dist/OrbitControls-Bg4B8Cgp.cjs +1 -0
  2. package/dist/OrbitControls-_OchPPiM.js +458 -0
  3. package/dist/{array-aPSjboDC.cjs → array-A9Rs-yNQ.cjs} +1 -1
  4. package/dist/{array-CmuXVJcq.js → array-CrFbJF1B.js} +1 -1
  5. package/dist/{index-BMiIYkQX.js → index--CQAIixM.js} +23 -23
  6. package/dist/{index-BbXTjZC6.js → index--UImh9jo.js} +44 -44
  7. package/dist/{index-BZcD1S7f.js → index-2tlC0WSo.js} +5 -5
  8. package/dist/index-4u6cukm_.cjs +7 -0
  9. package/dist/{index-CPrLaNjA.cjs → index-5_rbXdYz.cjs} +1 -1
  10. package/dist/{index-CfqT1FB6.js → index-99EALz1V.js} +6 -6
  11. package/dist/{index-DOaMKKyw.cjs → index-AJ-ERxfw.cjs} +1 -1
  12. package/dist/{index-0HD35fP-.js → index-B074Qw5U.js} +5 -5
  13. package/dist/{index-Bg8pXrX1.js → index-B3rk6w-A.js} +1 -1
  14. package/dist/index-B6Ml2anh.js +1363 -0
  15. package/dist/{index-DavPYW6C.cjs → index-BBS2a17j.cjs} +1 -1
  16. package/dist/{index-BRgti4Vk.cjs → index-BE8DQhoN.cjs} +1 -1
  17. package/dist/{index-Bc4QRK5_.js → index-BFEIlehR.js} +2853 -2822
  18. package/dist/{index-BMPwcf8P.cjs → index-BPmwBpKK.cjs} +1 -1
  19. package/dist/{index-p3IpHK5z.cjs → index-BR77jf7K.cjs} +12 -12
  20. package/dist/{index-BdwwvqBV.js → index-BUaCslMJ.js} +5 -5
  21. package/dist/{index-DlZ39exG.js → index-BmKUUO5G.js} +3 -3
  22. package/dist/{index-DAaL5Eoq.cjs → index-BypkILb5.cjs} +1 -1
  23. package/dist/index-C2Ok3w4G.cjs +1 -0
  24. package/dist/{index-SaOuyaJw.js → index-C7_vKAdv.js} +6 -6
  25. package/dist/index-C8PYYQwg.cjs +1 -0
  26. package/dist/{index-DkCoZbhh.js → index-C9dpcELX.js} +3 -3
  27. package/dist/{index-Bmvc2b5a.cjs → index-CFbzkHW0.cjs} +1 -1
  28. package/dist/{index-DL6591by.js → index-CL7Kg1Kn.js} +616 -671
  29. package/dist/{index-D33XDWeA.cjs → index-Cgru6blF.cjs} +1 -1
  30. package/dist/{index-Tq1Lujhv.cjs → index-D0LMLPcN.cjs} +1 -1
  31. package/dist/{index-CoLPeWbP.cjs → index-D5kNDyke.cjs} +1 -1
  32. package/dist/{index-C9HkqXuv.js → index-D6MYmUDV.js} +1 -1
  33. package/dist/{index-CUfvgW-P.js → index-D7XVufPP.js} +1 -1
  34. package/dist/{index-h6ZpTS4x.js → index-DB74RlFp.js} +8 -8
  35. package/dist/index-DE2i0Hrn.js +6435 -0
  36. package/dist/{index-Cax9Gcc2.cjs → index-DQMaqq7k.cjs} +1 -1
  37. package/dist/{index-CaRvdQDj.js → index-DWfglGK2.js} +3 -3
  38. package/dist/{index-D_JcQBhQ.js → index-DWzq96q9.js} +7 -7
  39. package/dist/{index-DOMlBYd3.cjs → index-DaGbhRQG.cjs} +1 -1
  40. package/dist/{index-GcPeN2Pl.cjs → index-Dc1Oymj0.cjs} +1 -1
  41. package/dist/{index-DwTtqshG.js → index-Di7JB-TG.js} +3 -3
  42. package/dist/{index-C-zHD2dx.cjs → index-DmOb4Y3Y.cjs} +175 -175
  43. package/dist/{index-Chz_f8HF.js → index-Dr3CYkCo.js} +5 -5
  44. package/dist/{index-DY6p_kYl.cjs → index-DtsQ-ZoV.cjs} +1 -1
  45. package/dist/{index-Dq69JbNT.js → index-DuJ88H2v.js} +30 -30
  46. package/dist/{index-Da0aT75u.js → index-Dw_V6yKW.js} +49 -31
  47. package/dist/{index-Bkc_eA-6.cjs → index-Ek40M5wF.cjs} +1 -1
  48. package/dist/{index-C0XUPmmN.cjs → index-P35j7PPT.cjs} +1 -1
  49. package/dist/{index-C0Skr8vW.js → index-RhyWQqr7.js} +3 -3
  50. package/dist/{index-CaccSGDq.cjs → index-dLGOwGSm.cjs} +1 -1
  51. package/dist/{index-DlwxyuGS.cjs → index-fonjRvDp.cjs} +1 -1
  52. package/dist/{index-BCtH2YUo.cjs → index-mm1iZv-U.cjs} +1 -1
  53. package/dist/{index.vue_vue_type_script_setup_true_lang-DZDm1D_1.js → index.vue_vue_type_script_setup_true_lang-D32wqX6B.js} +24 -24
  54. package/dist/{index.vue_vue_type_script_setup_true_lang-CZgjidw2.cjs → index.vue_vue_type_script_setup_true_lang-DrQm9pS8.cjs} +1 -1
  55. package/dist/index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-D3x-AlQS.cjs +1354 -0
  56. package/dist/index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-uJF9vYMQ.js +61635 -0
  57. package/dist/{index.vue_vue_type_style_index_0_scoped_264dc673_lang-BSZ5EEcY.js → index.vue_vue_type_style_index_0_scoped_264dc673_lang-DThFTJbG.js} +4829 -4908
  58. package/dist/index.vue_vue_type_style_index_0_scoped_264dc673_lang-IayePa4v.cjs +56 -0
  59. package/dist/{index.vue_vue_type_style_index_0_scoped_c8f6ea20_lang-DVUyWmPJ.cjs → index.vue_vue_type_style_index_0_scoped_c8f6ea20_lang-Cc3pYah2.cjs} +1 -1
  60. package/dist/{index.vue_vue_type_style_index_0_scoped_c8f6ea20_lang-DWtnMEYF.js → index.vue_vue_type_style_index_0_scoped_c8f6ea20_lang-D-l2wgcD.js} +8 -8
  61. package/dist/{login-ZGc0USt4.cjs → login-9FT8kgSz.cjs} +1 -1
  62. package/dist/{login-CbKgBqdm.js → login-Ct7wC1jE.js} +5 -5
  63. package/dist/{main-AuBsvtRo.cjs → main-BFSKjZRd.cjs} +1 -1
  64. package/dist/{main-FPsSpm49.js → main-Dw3o67DJ.js} +5 -5
  65. package/dist/{menu-BzQW-fEY.js → menu-Bj0eSg6d.js} +2504 -2450
  66. package/dist/{menu-CyErnOWr.cjs → menu-ScIJ5kqr.cjs} +12 -12
  67. package/dist/{modelComp-U2iMeIQU.js → modelComp-CUCWitDo.js} +1 -1
  68. package/dist/{modelComp-4_7EVAJl.cjs → modelComp-CkSDfH0-.cjs} +1 -1
  69. package/dist/obj/model.mtl +42 -0
  70. package/dist/obj/model.obj +26110 -0
  71. package/dist/ss-component.cjs +1 -1
  72. package/dist/ss-component.css +7 -1
  73. package/dist/ss-component.js +9 -9
  74. package/dist/ss-component2.cjs +1 -1
  75. package/dist/ss-component2.js +9 -9
  76. package/dist/threeModel-BKsAhpob.cjs +1 -0
  77. package/dist/threeModel-e6llE76r.js +1106 -0
  78. package/package.json +5 -3
  79. package/public/obj/model.mtl +42 -0
  80. package/public/obj/model.obj +26110 -0
  81. package/dist/index-1vppGfrB.cjs +0 -1
  82. package/dist/index-BEAaSlwn.cjs +0 -7
  83. package/dist/index-CK0nMCCq.js +0 -4758
  84. package/dist/index-DfeSp3Xs.cjs +0 -1
  85. package/dist/index-s1Ss2z_W.js +0 -1362
  86. package/dist/index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CktgCT12.cjs +0 -1339
  87. package/dist/index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DVsoGKzS.js +0 -62124
  88. package/dist/index.vue_vue_type_style_index_0_scoped_264dc673_lang-BIfh1cHt.cjs +0 -56
  89. package/dist/threeModel-Cu6GSNTS.js +0 -1559
  90. package/dist/threeModel-zBuUEfA7.cjs +0 -1
@@ -1,1559 +0,0 @@
1
- import { ref as E, watch as ke, createElementBlock as W, openBlock as $, createBlock as Je, computed as de, onMounted as We, onUnmounted as ot, Fragment as nt, renderList as at, createElementVNode as w, createCommentVNode as Te, toDisplayString as le, resolveComponent as qe, createVNode as C, defineComponent as lt, normalizeStyle as Ue, normalizeClass as Ye, nextTick as Be, onBeforeUnmount as rt, withDirectives as ce, unref as V, withCtx as Ve, isRef as Me, vModelRadio as xe, vShow as Ee } from "vue";
2
- import { C as ct, V as y, M as he, T as pe, Q as Ze, S as He, c as ne, R as ht, P as Ce, d as Qe, B as Ae, e as ut, f as pt, g as dt, W as mt, h as ft, A as _t, i as gt, X as yt, G as vt, j as Se, k as bt, l as Ie, m as wt, D as ze, H as Pt, n as Xe, o as et, p as tt, E as Le, s as Mt, q as ge, r as xt, t as Et, v as Dt } from "./index-Da0aT75u.js";
3
- import { _ as ve } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
- import { c as st, E as Ke } from "./menu-BzQW-fEY.js";
5
- const $e = { type: "change" }, Fe = { type: "start" }, it = { type: "end" }, De = new ht(), Ge = new Ce(), Tt = Math.cos(70 * Qe.DEG2RAD), Y = new y(), J = 2 * Math.PI, k = {
6
- NONE: -1,
7
- ROTATE: 0,
8
- DOLLY: 1,
9
- PAN: 2,
10
- TOUCH_ROTATE: 3,
11
- TOUCH_PAN: 4,
12
- TOUCH_DOLLY_PAN: 5,
13
- TOUCH_DOLLY_ROTATE: 6
14
- }, Oe = 1e-6;
15
- class Ct extends ct {
16
- /**
17
- * Constructs a new controls instance.
18
- *
19
- * @param {Object3D} object - The object that is managed by the controls.
20
- * @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
21
- */
22
- constructor(e, t = null) {
23
- super(e, t), this.state = k.NONE, this.target = new y(), this.cursor = new y(), 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: he.ROTATE, MIDDLE: he.DOLLY, RIGHT: he.PAN }, this.touches = { ONE: pe.ROTATE, TWO: pe.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new y(), this._lastQuaternion = new Ze(), this._lastTargetPosition = new y(), this._quat = new Ze().setFromUnitVectors(e.up, new y(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new He(), this._sphericalDelta = new He(), this._scale = 1, this._panOffset = new y(), this._rotateStart = new ne(), this._rotateEnd = new ne(), this._rotateDelta = new ne(), this._panStart = new ne(), this._panEnd = new ne(), this._panDelta = new ne(), this._dollyStart = new ne(), this._dollyEnd = new ne(), this._dollyDelta = new ne(), this._dollyDirection = new y(), this._mouse = new ne(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = kt.bind(this), this._onPointerDown = St.bind(this), this._onPointerUp = At.bind(this), this._onContextMenu = Ft.bind(this), this._onMouseWheel = Lt.bind(this), this._onKeyDown = Ot.bind(this), this._onTouchStart = jt.bind(this), this._onTouchMove = It.bind(this), this._onMouseDown = Rt.bind(this), this._onMouseMove = zt.bind(this), this._interceptControlDown = Nt.bind(this), this._interceptControlUp = Ut.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
24
- }
25
- connect(e) {
26
- super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
27
- }
28
- disconnect() {
29
- this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerUp), this.domElement.removeEventListener("wheel", this._onMouseWheel), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.stopListenToKeyEvents(), this.domElement.getRootNode().removeEventListener("keydown", this._interceptControlDown, { capture: !0 }), this.domElement.style.touchAction = "auto";
30
- }
31
- dispose() {
32
- this.disconnect();
33
- }
34
- /**
35
- * Get the current vertical rotation, in radians.
36
- *
37
- * @return {number} The current vertical rotation, in radians.
38
- */
39
- getPolarAngle() {
40
- return this._spherical.phi;
41
- }
42
- /**
43
- * Get the current horizontal rotation, in radians.
44
- *
45
- * @return {number} The current horizontal rotation, in radians.
46
- */
47
- getAzimuthalAngle() {
48
- return this._spherical.theta;
49
- }
50
- /**
51
- * Returns the distance from the camera to the target.
52
- *
53
- * @return {number} The distance from the camera to the target.
54
- */
55
- getDistance() {
56
- return this.object.position.distanceTo(this.target);
57
- }
58
- /**
59
- * Adds key event listeners to the given DOM element.
60
- * `window` is a recommended argument for using this method.
61
- *
62
- * @param {HTMLDOMElement} domElement - The DOM element
63
- */
64
- listenToKeyEvents(e) {
65
- e.addEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = e;
66
- }
67
- /**
68
- * Removes the key event listener previously defined with `listenToKeyEvents()`.
69
- */
70
- stopListenToKeyEvents() {
71
- this._domElementKeyEvents !== null && (this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = null);
72
- }
73
- /**
74
- * Save the current state of the controls. This can later be recovered with `reset()`.
75
- */
76
- saveState() {
77
- this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
78
- }
79
- /**
80
- * Reset the controls to their state from either the last time the `saveState()`
81
- * was called, or the initial state.
82
- */
83
- reset() {
84
- this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent($e), this.update(), this.state = k.NONE;
85
- }
86
- update(e = null) {
87
- const t = this.object.position;
88
- Y.copy(t).sub(this.target), Y.applyQuaternion(this._quat), this._spherical.setFromVector3(Y), this.autoRotate && this.state === k.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
89
- let i = this.minAzimuthAngle, a = this.maxAzimuthAngle;
90
- isFinite(i) && isFinite(a) && (i < -Math.PI ? i += J : i > Math.PI && (i -= J), a < -Math.PI ? a += J : a > Math.PI && (a -= J), i <= a ? this._spherical.theta = Math.max(i, Math.min(a, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (i + a) / 2 ? Math.max(i, this._spherical.theta) : Math.min(a, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
91
- let d = !1;
92
- if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
93
- this._spherical.radius = this._clampDistance(this._spherical.radius);
94
- else {
95
- const b = this._spherical.radius;
96
- this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), d = b != this._spherical.radius;
97
- }
98
- if (Y.setFromSpherical(this._spherical), Y.applyQuaternion(this._quatInverse), t.copy(this.target).add(Y), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
99
- let b = null;
100
- if (this.object.isPerspectiveCamera) {
101
- const l = Y.length();
102
- b = this._clampDistance(l * this._scale);
103
- const D = l - b;
104
- this.object.position.addScaledVector(this._dollyDirection, D), this.object.updateMatrixWorld(), d = !!D;
105
- } else if (this.object.isOrthographicCamera) {
106
- const l = new y(this._mouse.x, this._mouse.y, 0);
107
- l.unproject(this.object);
108
- const D = this.object.zoom;
109
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), d = D !== this.object.zoom;
110
- const I = new y(this._mouse.x, this._mouse.y, 0);
111
- I.unproject(this.object), this.object.position.sub(I).add(l), this.object.updateMatrixWorld(), b = Y.length();
112
- } else
113
- console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
114
- b !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(b).add(this.object.position) : (De.origin.copy(this.object.position), De.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(De.direction)) < Tt ? this.object.lookAt(this.target) : (Ge.setFromNormalAndCoplanarPoint(this.object.up, this.target), De.intersectPlane(Ge, this.target))));
115
- } else if (this.object.isOrthographicCamera) {
116
- const b = this.object.zoom;
117
- this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), b !== this.object.zoom && (this.object.updateProjectionMatrix(), d = !0);
118
- }
119
- return this._scale = 1, this._performCursorZoom = !1, d || this._lastPosition.distanceToSquared(this.object.position) > Oe || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Oe || this._lastTargetPosition.distanceToSquared(this.target) > Oe ? (this.dispatchEvent($e), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
120
- }
121
- _getAutoRotationAngle(e) {
122
- return e !== null ? J / 60 * this.autoRotateSpeed * e : J / 60 / 60 * this.autoRotateSpeed;
123
- }
124
- _getZoomScale(e) {
125
- const t = Math.abs(e * 0.01);
126
- return Math.pow(0.95, this.zoomSpeed * t);
127
- }
128
- _rotateLeft(e) {
129
- this._sphericalDelta.theta -= e;
130
- }
131
- _rotateUp(e) {
132
- this._sphericalDelta.phi -= e;
133
- }
134
- _panLeft(e, t) {
135
- Y.setFromMatrixColumn(t, 0), Y.multiplyScalar(-e), this._panOffset.add(Y);
136
- }
137
- _panUp(e, t) {
138
- this.screenSpacePanning === !0 ? Y.setFromMatrixColumn(t, 1) : (Y.setFromMatrixColumn(t, 0), Y.crossVectors(this.object.up, Y)), Y.multiplyScalar(e), this._panOffset.add(Y);
139
- }
140
- // deltaX and deltaY are in pixels; right and down are positive
141
- _pan(e, t) {
142
- const i = this.domElement;
143
- if (this.object.isPerspectiveCamera) {
144
- const a = this.object.position;
145
- Y.copy(a).sub(this.target);
146
- let d = Y.length();
147
- d *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * d / i.clientHeight, this.object.matrix), this._panUp(2 * t * d / i.clientHeight, this.object.matrix);
148
- } else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / i.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / i.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
149
- }
150
- _dollyOut(e) {
151
- this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
152
- }
153
- _dollyIn(e) {
154
- this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale *= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
155
- }
156
- _updateZoomParameters(e, t) {
157
- if (!this.zoomToCursor)
158
- return;
159
- this._performCursorZoom = !0;
160
- const i = this.domElement.getBoundingClientRect(), a = e - i.left, d = t - i.top, b = i.width, l = i.height;
161
- this._mouse.x = a / b * 2 - 1, this._mouse.y = -(d / l) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
162
- }
163
- _clampDistance(e) {
164
- return Math.max(this.minDistance, Math.min(this.maxDistance, e));
165
- }
166
- //
167
- // event callbacks - update the object state
168
- //
169
- _handleMouseDownRotate(e) {
170
- this._rotateStart.set(e.clientX, e.clientY);
171
- }
172
- _handleMouseDownDolly(e) {
173
- this._updateZoomParameters(e.clientX, e.clientX), this._dollyStart.set(e.clientX, e.clientY);
174
- }
175
- _handleMouseDownPan(e) {
176
- this._panStart.set(e.clientX, e.clientY);
177
- }
178
- _handleMouseMoveRotate(e) {
179
- this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
180
- const t = this.domElement;
181
- this._rotateLeft(J * this._rotateDelta.x / t.clientHeight), this._rotateUp(J * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
182
- }
183
- _handleMouseMoveDolly(e) {
184
- this._dollyEnd.set(e.clientX, e.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
185
- }
186
- _handleMouseMovePan(e) {
187
- this._panEnd.set(e.clientX, e.clientY), this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd), this.update();
188
- }
189
- _handleMouseWheel(e) {
190
- this._updateZoomParameters(e.clientX, e.clientY), e.deltaY < 0 ? this._dollyIn(this._getZoomScale(e.deltaY)) : e.deltaY > 0 && this._dollyOut(this._getZoomScale(e.deltaY)), this.update();
191
- }
192
- _handleKeyDown(e) {
193
- let t = !1;
194
- switch (e.code) {
195
- case this.keys.UP:
196
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(J * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
197
- break;
198
- case this.keys.BOTTOM:
199
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-J * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
200
- break;
201
- case this.keys.LEFT:
202
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(J * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
203
- break;
204
- case this.keys.RIGHT:
205
- e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-J * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
206
- break;
207
- }
208
- t && (e.preventDefault(), this.update());
209
- }
210
- _handleTouchStartRotate(e) {
211
- if (this._pointers.length === 1)
212
- this._rotateStart.set(e.pageX, e.pageY);
213
- else {
214
- const t = this._getSecondPointerPosition(e), i = 0.5 * (e.pageX + t.x), a = 0.5 * (e.pageY + t.y);
215
- this._rotateStart.set(i, a);
216
- }
217
- }
218
- _handleTouchStartPan(e) {
219
- if (this._pointers.length === 1)
220
- this._panStart.set(e.pageX, e.pageY);
221
- else {
222
- const t = this._getSecondPointerPosition(e), i = 0.5 * (e.pageX + t.x), a = 0.5 * (e.pageY + t.y);
223
- this._panStart.set(i, a);
224
- }
225
- }
226
- _handleTouchStartDolly(e) {
227
- const t = this._getSecondPointerPosition(e), i = e.pageX - t.x, a = e.pageY - t.y, d = Math.sqrt(i * i + a * a);
228
- this._dollyStart.set(0, d);
229
- }
230
- _handleTouchStartDollyPan(e) {
231
- this.enableZoom && this._handleTouchStartDolly(e), this.enablePan && this._handleTouchStartPan(e);
232
- }
233
- _handleTouchStartDollyRotate(e) {
234
- this.enableZoom && this._handleTouchStartDolly(e), this.enableRotate && this._handleTouchStartRotate(e);
235
- }
236
- _handleTouchMoveRotate(e) {
237
- if (this._pointers.length == 1)
238
- this._rotateEnd.set(e.pageX, e.pageY);
239
- else {
240
- const i = this._getSecondPointerPosition(e), a = 0.5 * (e.pageX + i.x), d = 0.5 * (e.pageY + i.y);
241
- this._rotateEnd.set(a, d);
242
- }
243
- this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
244
- const t = this.domElement;
245
- this._rotateLeft(J * this._rotateDelta.x / t.clientHeight), this._rotateUp(J * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
246
- }
247
- _handleTouchMovePan(e) {
248
- if (this._pointers.length === 1)
249
- this._panEnd.set(e.pageX, e.pageY);
250
- else {
251
- const t = this._getSecondPointerPosition(e), i = 0.5 * (e.pageX + t.x), a = 0.5 * (e.pageY + t.y);
252
- this._panEnd.set(i, a);
253
- }
254
- this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
255
- }
256
- _handleTouchMoveDolly(e) {
257
- const t = this._getSecondPointerPosition(e), i = e.pageX - t.x, a = e.pageY - t.y, d = Math.sqrt(i * i + a * a);
258
- this._dollyEnd.set(0, d), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
259
- const b = (e.pageX + t.x) * 0.5, l = (e.pageY + t.y) * 0.5;
260
- this._updateZoomParameters(b, l);
261
- }
262
- _handleTouchMoveDollyPan(e) {
263
- this.enableZoom && this._handleTouchMoveDolly(e), this.enablePan && this._handleTouchMovePan(e);
264
- }
265
- _handleTouchMoveDollyRotate(e) {
266
- this.enableZoom && this._handleTouchMoveDolly(e), this.enableRotate && this._handleTouchMoveRotate(e);
267
- }
268
- // pointers
269
- _addPointer(e) {
270
- this._pointers.push(e.pointerId);
271
- }
272
- _removePointer(e) {
273
- delete this._pointerPositions[e.pointerId];
274
- for (let t = 0; t < this._pointers.length; t++)
275
- if (this._pointers[t] == e.pointerId) {
276
- this._pointers.splice(t, 1);
277
- return;
278
- }
279
- }
280
- _isTrackingPointer(e) {
281
- for (let t = 0; t < this._pointers.length; t++)
282
- if (this._pointers[t] == e.pointerId) return !0;
283
- return !1;
284
- }
285
- _trackPointer(e) {
286
- let t = this._pointerPositions[e.pointerId];
287
- t === void 0 && (t = new ne(), this._pointerPositions[e.pointerId] = t), t.set(e.pageX, e.pageY);
288
- }
289
- _getSecondPointerPosition(e) {
290
- const t = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
291
- return this._pointerPositions[t];
292
- }
293
- //
294
- _customWheelEvent(e) {
295
- const t = e.deltaMode, i = {
296
- clientX: e.clientX,
297
- clientY: e.clientY,
298
- deltaY: e.deltaY
299
- };
300
- switch (t) {
301
- case 1:
302
- i.deltaY *= 16;
303
- break;
304
- case 2:
305
- i.deltaY *= 100;
306
- break;
307
- }
308
- return e.ctrlKey && !this._controlActive && (i.deltaY *= 10), i;
309
- }
310
- }
311
- function St(o) {
312
- this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(o.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(o) && (this._addPointer(o), o.pointerType === "touch" ? this._onTouchStart(o) : this._onMouseDown(o)));
313
- }
314
- function kt(o) {
315
- this.enabled !== !1 && (o.pointerType === "touch" ? this._onTouchMove(o) : this._onMouseMove(o));
316
- }
317
- function At(o) {
318
- switch (this._removePointer(o), this._pointers.length) {
319
- case 0:
320
- this.domElement.releasePointerCapture(o.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(it), this.state = k.NONE;
321
- break;
322
- case 1:
323
- const e = this._pointers[0], t = this._pointerPositions[e];
324
- this._onTouchStart({ pointerId: e, pageX: t.x, pageY: t.y });
325
- break;
326
- }
327
- }
328
- function Rt(o) {
329
- let e;
330
- switch (o.button) {
331
- case 0:
332
- e = this.mouseButtons.LEFT;
333
- break;
334
- case 1:
335
- e = this.mouseButtons.MIDDLE;
336
- break;
337
- case 2:
338
- e = this.mouseButtons.RIGHT;
339
- break;
340
- default:
341
- e = -1;
342
- }
343
- switch (e) {
344
- case he.DOLLY:
345
- if (this.enableZoom === !1) return;
346
- this._handleMouseDownDolly(o), this.state = k.DOLLY;
347
- break;
348
- case he.ROTATE:
349
- if (o.ctrlKey || o.metaKey || o.shiftKey) {
350
- if (this.enablePan === !1) return;
351
- this._handleMouseDownPan(o), this.state = k.PAN;
352
- } else {
353
- if (this.enableRotate === !1) return;
354
- this._handleMouseDownRotate(o), this.state = k.ROTATE;
355
- }
356
- break;
357
- case he.PAN:
358
- if (o.ctrlKey || o.metaKey || o.shiftKey) {
359
- if (this.enableRotate === !1) return;
360
- this._handleMouseDownRotate(o), this.state = k.ROTATE;
361
- } else {
362
- if (this.enablePan === !1) return;
363
- this._handleMouseDownPan(o), this.state = k.PAN;
364
- }
365
- break;
366
- default:
367
- this.state = k.NONE;
368
- }
369
- this.state !== k.NONE && this.dispatchEvent(Fe);
370
- }
371
- function zt(o) {
372
- switch (this.state) {
373
- case k.ROTATE:
374
- if (this.enableRotate === !1) return;
375
- this._handleMouseMoveRotate(o);
376
- break;
377
- case k.DOLLY:
378
- if (this.enableZoom === !1) return;
379
- this._handleMouseMoveDolly(o);
380
- break;
381
- case k.PAN:
382
- if (this.enablePan === !1) return;
383
- this._handleMouseMovePan(o);
384
- break;
385
- }
386
- }
387
- function Lt(o) {
388
- this.enabled === !1 || this.enableZoom === !1 || this.state !== k.NONE || (o.preventDefault(), this.dispatchEvent(Fe), this._handleMouseWheel(this._customWheelEvent(o)), this.dispatchEvent(it));
389
- }
390
- function Ot(o) {
391
- this.enabled !== !1 && this._handleKeyDown(o);
392
- }
393
- function jt(o) {
394
- switch (this._trackPointer(o), this._pointers.length) {
395
- case 1:
396
- switch (this.touches.ONE) {
397
- case pe.ROTATE:
398
- if (this.enableRotate === !1) return;
399
- this._handleTouchStartRotate(o), this.state = k.TOUCH_ROTATE;
400
- break;
401
- case pe.PAN:
402
- if (this.enablePan === !1) return;
403
- this._handleTouchStartPan(o), this.state = k.TOUCH_PAN;
404
- break;
405
- default:
406
- this.state = k.NONE;
407
- }
408
- break;
409
- case 2:
410
- switch (this.touches.TWO) {
411
- case pe.DOLLY_PAN:
412
- if (this.enableZoom === !1 && this.enablePan === !1) return;
413
- this._handleTouchStartDollyPan(o), this.state = k.TOUCH_DOLLY_PAN;
414
- break;
415
- case pe.DOLLY_ROTATE:
416
- if (this.enableZoom === !1 && this.enableRotate === !1) return;
417
- this._handleTouchStartDollyRotate(o), this.state = k.TOUCH_DOLLY_ROTATE;
418
- break;
419
- default:
420
- this.state = k.NONE;
421
- }
422
- break;
423
- default:
424
- this.state = k.NONE;
425
- }
426
- this.state !== k.NONE && this.dispatchEvent(Fe);
427
- }
428
- function It(o) {
429
- switch (this._trackPointer(o), this.state) {
430
- case k.TOUCH_ROTATE:
431
- if (this.enableRotate === !1) return;
432
- this._handleTouchMoveRotate(o), this.update();
433
- break;
434
- case k.TOUCH_PAN:
435
- if (this.enablePan === !1) return;
436
- this._handleTouchMovePan(o), this.update();
437
- break;
438
- case k.TOUCH_DOLLY_PAN:
439
- if (this.enableZoom === !1 && this.enablePan === !1) return;
440
- this._handleTouchMoveDollyPan(o), this.update();
441
- break;
442
- case k.TOUCH_DOLLY_ROTATE:
443
- if (this.enableZoom === !1 && this.enableRotate === !1) return;
444
- this._handleTouchMoveDollyRotate(o), this.update();
445
- break;
446
- default:
447
- this.state = k.NONE;
448
- }
449
- }
450
- function Ft(o) {
451
- this.enabled !== !1 && o.preventDefault();
452
- }
453
- function Nt(o) {
454
- o.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
455
- }
456
- function Ut(o) {
457
- o.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
458
- }
459
- function Yt(o) {
460
- let e = null, t = null, i = null, a = null, d = null, b = null, l = null, D = null;
461
- const z = 1e3 / 30;
462
- let O = 0;
463
- const A = E([]), p = E(new y()), T = E(new y()), v = () => {
464
- if (!o.value) return;
465
- e = new ut(), e.background = new pt(15790320);
466
- const f = o.value;
467
- t = new dt(75, f.clientWidth / f.clientHeight, 0.1, 1e4), t.position.set(8, -8, 6), t.up.set(0, 0, 1), t.lookAt(0, 0, 0), i = new mt({
468
- antialias: !0,
469
- alpha: !0
470
- }), i.setSize(f.clientWidth, f.clientHeight), i.localClippingEnabled = !0, i.shadowMap.enabled = !0, i.shadowMap.type = ft, i.toneMapping = _t, i.toneMappingExposure = 1, i.outputColorSpace = gt, f.appendChild(i.domElement), a = new Ct(t, i.domElement), a.enableDamping = !0, a.dampingFactor = 0.05, a.mouseButtons = {
471
- LEFT: null,
472
- MIDDLE: he.PAN,
473
- RIGHT: he.ROTATE
474
- }, a.panSpeed = 0.7, d = new yt(t, i, {
475
- container: f,
476
- type: "cube",
477
- placement: "top-right",
478
- offset: {
479
- top: 10,
480
- right: 10
481
- },
482
- background: {
483
- color: "#D1D1D1",
484
- opacity: 1
485
- },
486
- front: {
487
- label: "Top"
488
- },
489
- bottom: {
490
- label: "Front"
491
- },
492
- left: {
493
- label: "Left"
494
- },
495
- right: {
496
- label: "Right"
497
- },
498
- top: {
499
- label: "Back"
500
- },
501
- back: {
502
- label: "Bottom"
503
- }
504
- }), d.attachControls(a), _(), S();
505
- }, s = (f, c) => {
506
- l && (e.remove(l), l.dispose()), D && (e.remove(D), D.geometry.dispose(), D.material.dispose());
507
- const R = Math.min(Math.max(Math.floor(f / 20), 30), 40);
508
- l = new vt(f, R, 13421772, 14540253), l.rotateX(Math.PI / 2), l.position.copy(c), e.add(l);
509
- const j = new Se(f, f), K = new bt({
510
- opacity: 0.3,
511
- // 阴影透明度
512
- color: 0
513
- });
514
- D = new Ie(j, K), D.position.copy(c), D.position.z -= 0.01, D.receiveShadow = !0, e.add(D);
515
- }, m = () => {
516
- if (A.value.length === 0)
517
- return;
518
- const f = new Ae();
519
- let c = !1;
520
- if (A.value.forEach((te) => {
521
- if (te.userData.boundingBox)
522
- f.union(te.userData.boundingBox), c = !0;
523
- else if (te.userData.modelId && modelBoundingBoxes.has(te.userData.modelId)) {
524
- const oe = modelBoundingBoxes.get(te.userData.modelId);
525
- f.union(oe.box), c = !0;
526
- } else
527
- f.expandByObject(te), c = !0;
528
- }), !c) {
529
- console.warn("无法计算包围盒,网格更新失败");
530
- return;
531
- }
532
- const R = f.getSize(new y()), j = f.getCenter(new y()), K = Math.max(R.x, R.y, R.z), Q = Math.max(K * 8, 50), ee = new y(
533
- j.x,
534
- j.y,
535
- f.min.z
536
- // 模型的最底部
537
- );
538
- s(Q, ee);
539
- }, _ = () => {
540
- const f = new wt(4210752, 0.6);
541
- e.add(f);
542
- const c = new ze(16777215, 2);
543
- c.position.set(10, 10, 8), c.castShadow = !0, c.shadow.mapSize.width = 4096, c.shadow.mapSize.height = 4096, c.shadow.camera.near = 0.5, c.shadow.camera.far = 50, c.shadow.camera.left = -50, c.shadow.camera.right = 50, c.shadow.camera.top = 50, c.shadow.camera.bottom = -50, e.add(c);
544
- const R = new ze(16777215, 0.8);
545
- R.position.set(-8, -8, 6), e.add(R);
546
- const j = new ze(16777215, 0.6);
547
- j.position.set(0, -15, 2), e.add(j);
548
- const K = new Pt(16777215, 4473924, 0.8);
549
- e.add(K);
550
- const Q = new Xe(16777215, 1, 50);
551
- Q.position.set(15, 15, 15), e.add(Q);
552
- const ee = new Xe(16777215, 0.5, 50);
553
- ee.position.set(-15, -15, 15), e.add(ee);
554
- }, S = () => {
555
- b = requestAnimationFrame(S), a && a.update();
556
- const f = performance.now(), c = f - O;
557
- c < z || (O = f - c % z, i && e && t && i.render(e, t), d && d.render());
558
- }, Z = (f) => {
559
- [
560
- "map",
561
- "normalMap",
562
- "bumpMap",
563
- "roughnessMap",
564
- "metalnessMap",
565
- "emissiveMap",
566
- "specularMap",
567
- "envMap",
568
- "lightMap",
569
- "aoMap",
570
- "displacementMap"
571
- ].forEach((R) => {
572
- f[R] && f[R].dispose && f[R].dispose();
573
- }), f.dispose && f.dispose();
574
- }, F = (f) => {
575
- f == null || f.traverse((c) => {
576
- c.geometry && c.geometry.dispose(), c.material && (Array.isArray(c.material) ? c.material.forEach((R) => {
577
- Z(R);
578
- }) : Z(c.material));
579
- });
580
- };
581
- return {
582
- // 响应式数据
583
- currentModels: A,
584
- initialCameraPosition: p,
585
- initialTargetPosition: T,
586
- // 方法
587
- initThreeJS: v,
588
- handleResize: () => {
589
- if (!o.value || !t || !i || !d) return;
590
- const f = o.value, c = f.clientWidth, R = f.clientHeight;
591
- t.aspect = c / R, t.updateProjectionMatrix(), i.setSize(c, R), d.update();
592
- },
593
- fitCameraToAllModels: (f) => {
594
- if (!t || !a || A.value.length === 0) return;
595
- const c = new Ae();
596
- let R = !1;
597
- if (A.value.forEach((oe) => {
598
- if (oe.userData.boundingBox)
599
- c.union(oe.userData.boundingBox), R = !0;
600
- else if (oe.userData.modelId && f.has(oe.userData.modelId)) {
601
- const me = f.get(oe.userData.modelId);
602
- c.union(me.box), R = !0;
603
- } else
604
- c.expandByObject(oe), R = !0;
605
- }), !R) {
606
- console.warn("无法计算包围盒");
607
- return;
608
- }
609
- const j = c.getSize(new y()), K = c.getCenter(new y()), ee = Math.max(j.x, j.y, j.z) * 0.8, te = new y(K.x + ee, K.y - ee, K.z + ee);
610
- t.position.copy(te), t.lookAt(K), a.target.copy(K), a.update(), p.value.copy(te), T.value.copy(K), m();
611
- },
612
- getThreeJSObjects: () => ({
613
- scene: e,
614
- camera: t,
615
- renderer: i,
616
- controls: a,
617
- gizmo: d
618
- }),
619
- clearAllModels: () => {
620
- if (!e) return;
621
- A.value.forEach((c) => {
622
- e.remove(c), F(c);
623
- });
624
- const f = [];
625
- e.children.forEach((c) => {
626
- !c.isLight && !c.isCamera && c.type !== "GridHelper" && c !== D && f.push(c);
627
- }), f.forEach((c) => {
628
- e.remove(c), F(c);
629
- }), A.value = [], m();
630
- },
631
- cleanup: () => {
632
- b && cancelAnimationFrame(b), l && l.dispose(), D && (D.geometry.dispose(), D.material.dispose()), i && i.dispose(), a && a.dispose(), d && d.dispose();
633
- },
634
- updateGridForModels: m
635
- };
636
- }
637
- function Bt(o, e) {
638
- const t = E(!1);
639
- let i = null, a = 12700, d = new y(), b = new y(), l = new y(), D = 0, I = null;
640
- const z = (s) => s < 0.5 ? 4 * s * s * s : 1 - Math.pow(-2 * s + 2, 3) / 2, O = (s) => {
641
- const m = new y(), _ = D * 1.2, S = new y(l.x + _, l.y, l.z), Z = new y(l.x, l.y + _, l.z), F = new y(l.x, l.y - _, l.z);
642
- if (s <= 0.567) {
643
- const H = s / 0.567 * Math.PI * 2;
644
- m.x = l.x + Math.cos(H) * _, m.z = l.z + Math.sin(H) * _, m.y = l.y;
645
- } else if (s <= 0.724) {
646
- const B = (s - 0.567) / 0.157, H = z(B);
647
- m.lerpVectors(S, Z, H);
648
- } else if (s <= 0.881) {
649
- const B = (s - 0.724) / 0.157, X = z(B) * Math.PI;
650
- m.x = l.x + Math.sin(X) * _, m.y = l.y + Math.cos(X) * _, m.z = l.z;
651
- } else {
652
- const B = (s - 0.881) / 0.119, H = z(B);
653
- m.lerpVectors(F, d, H);
654
- }
655
- return m;
656
- }, A = () => {
657
- const { camera: s, controls: m } = o();
658
- if (!s || !m) return;
659
- i || (i = Date.now());
660
- const _ = Date.now() - i, S = Math.min(_ / a, 1);
661
- if (S >= 1) {
662
- T();
663
- return;
664
- }
665
- const Z = O(S);
666
- s.position.copy(Z), s.lookAt(l), m.target.copy(l), I = requestAnimationFrame(A);
667
- }, p = () => {
668
- if (e.value.length === 0) return;
669
- const { camera: s, controls: m } = o();
670
- if (!s || !m) return;
671
- d.copy(s.position), b.copy(m.target);
672
- const _ = new Ae();
673
- e.value.forEach((q) => {
674
- _.expandByObject(q);
675
- });
676
- const S = _.getSize(new y());
677
- l = _.getCenter(new y()), D = Math.max(S.x, S.y, S.z) * 1.2;
678
- const Z = new y(l.x + D * 1.2, l.y, l.z);
679
- m.enabled = !1;
680
- const F = s.position.clone(), B = 1e3, H = Date.now(), X = () => {
681
- const q = Date.now() - H, ie = Math.min(q / B, 1), f = z(ie);
682
- s.position.lerpVectors(F, Z, f), s.lookAt(l), m.target.copy(l), ie < 1 ? requestAnimationFrame(X) : (t.value = !0, i = null, A());
683
- };
684
- X();
685
- }, T = () => {
686
- t.value = !1, i = null, I && (cancelAnimationFrame(I), I = null);
687
- const { controls: s } = o();
688
- s && (s.enabled = !0, s.target.copy(b));
689
- };
690
- return {
691
- isAnimating: t,
692
- toggleAnimation: () => {
693
- if (t.value) {
694
- t.value = !1, i = null, I && (cancelAnimationFrame(I), I = null);
695
- const { camera: s, controls: m } = o();
696
- if (!s || !m) return;
697
- m.enabled = !0;
698
- const _ = s.position.clone(), S = m.target.clone(), Z = 1500, F = Date.now(), B = () => {
699
- const H = Date.now() - F, X = Math.min(H / Z, 1), q = z(X);
700
- s.position.lerpVectors(_, d, q), m.target.lerpVectors(S, b, q), X < 1 && requestAnimationFrame(B);
701
- };
702
- B();
703
- } else
704
- p();
705
- },
706
- startAnimation: p,
707
- stopAnimation: T
708
- };
709
- }
710
- function Vt(o, e) {
711
- const t = E(!1), i = E("none");
712
- let a = [], d = [], b = new Ae(), l = new y();
713
- const D = () => {
714
- a = [
715
- new Ce(new y(1, 0, 0), 0),
716
- // X轴平面
717
- new Ce(new y(0, 1, 0), 0),
718
- // Y轴平面
719
- new Ce(new y(0, 0, 1), 0)
720
- // Z轴平面
721
- ];
722
- }, I = () => {
723
- b.makeEmpty(), e.value.forEach((v) => {
724
- b.expandByObject(v);
725
- }), l = b.getCenter(new y());
726
- }, z = (v) => {
727
- const s = b.getSize(new y());
728
- let m, _, S;
729
- v === "x" ? (m = new Se(s.z * 1.2, s.y * 1.2), _ = new y(l.x, l.y, l.z), S = new Le(0, Math.PI / 2, 0)) : v === "y" ? (m = new Se(s.x * 1.2, s.z * 1.2), _ = new y(l.x, l.y, l.z), S = new Le(Math.PI / 2, 0, 0)) : v === "z" && (m = new Se(s.x * 1.2, s.y * 1.2), _ = new y(l.x, l.y, l.z), S = new Le(0, 0, 0));
730
- const Z = new et({
731
- color: 8900331,
732
- transparent: !0,
733
- opacity: 0.3,
734
- side: tt,
735
- depthWrite: !1
736
- }), F = new Ie(m, Z);
737
- return F.position.copy(_), F.rotation.copy(S), F;
738
- }, O = () => {
739
- if (A(), p(), i.value === "none")
740
- return;
741
- I();
742
- let v = null;
743
- if (i.value === "x" ? (a[0].constant = -l.x, v = a[0]) : i.value === "y" ? (a[1].constant = -l.y, v = a[1]) : i.value === "z" && (a[2].constant = -l.z, v = a[2]), v) {
744
- e.value.forEach((m) => {
745
- m.traverse((_) => {
746
- _.isMesh && _.material && (Array.isArray(_.material) ? _.material.forEach((S) => {
747
- S.clippingPlanes = [v];
748
- }) : _.material.clippingPlanes = [v]);
749
- });
750
- });
751
- const { scene: s } = o();
752
- if (s) {
753
- const m = z(i.value);
754
- s.add(m), d.push(m);
755
- }
756
- }
757
- }, A = () => {
758
- e.value.forEach((v) => {
759
- v.traverse((s) => {
760
- s.isMesh && s.material && (Array.isArray(s.material) ? s.material.forEach((m) => {
761
- m.clippingPlanes = [];
762
- }) : s.material.clippingPlanes = []);
763
- });
764
- });
765
- }, p = () => {
766
- const { scene: v } = o();
767
- v && d.forEach((s) => {
768
- v.remove(s), s.geometry.dispose(), s.material.dispose();
769
- }), d = [];
770
- };
771
- return {
772
- isClipping: t,
773
- activeClippingAxis: i,
774
- toggleClipping: () => {
775
- t.value = !t.value, t.value ? (D(), e.value.length > 0 && I()) : (i.value = "none", A(), p());
776
- },
777
- updateClippingPlanes: O,
778
- clearClippingPlanes: A,
779
- clearClippingMeshes: p
780
- };
781
- }
782
- const Zt = { class: "panel-content" }, Ht = {
783
- __name: "animationPanel",
784
- props: {
785
- animationData: Object,
786
- model: Object
787
- },
788
- setup(o) {
789
- const e = o;
790
- E();
791
- const t = E();
792
- return ke(
793
- () => [e == null ? void 0 : e.animationData],
794
- () => {
795
- var a;
796
- let i = ((a = st(e == null ? void 0 : e.animationData)) == null ? void 0 : a.动画输出Content) ?? [];
797
- i && (t.value = i);
798
- },
799
- { deep: !0, immediate: !0 }
800
- ), (i, a) => {
801
- var d, b, l;
802
- return $(), W("div", Zt, [
803
- ($(), Je(Mt, {
804
- itemData: (d = t.value) == null ? void 0 : d.compData,
805
- key: (b = t.value) == null ? void 0 : b.id,
806
- index: (l = t.value) == null ? void 0 : l.id,
807
- showHeader: !1
808
- }, null, 8, ["itemData", "index"]))
809
- ]);
810
- };
811
- }
812
- }, Xt = /* @__PURE__ */ ve(Ht, [["__scopeId", "data-v-1e90a659"]]), Kt = { class: "panel-content" }, $t = {
813
- key: 0,
814
- class: "joints-list"
815
- }, Gt = { class: "joint-info-row" }, Jt = { class: "joint-left" }, Wt = { class: "joint-name" }, qt = { class: "joint-range" }, Qt = { class: "joint-type" }, es = {
816
- key: 0,
817
- class: "joint-control-row"
818
- }, ts = { class: "slider-container" }, ss = ["min", "max", "value", "onInput", "disabled"], is = { class: "value-display" }, os = { class: "joint-value" }, ns = { class: "unit" }, as = {
819
- key: 1,
820
- class: "empty-state"
821
- }, ye = 1e-3, ls = 1e3, je = 60, rs = {
822
- __name: "jointPanel",
823
- props: {
824
- model: Object,
825
- scene: Object,
826
- animationData: Object
827
- },
828
- setup(o, { expose: e }) {
829
- const t = o;
830
- E(!0);
831
- const i = E([]), a = E(null), d = E(null), b = E(12.5), l = E(), D = E(1302), I = E(30), z = E(!1), O = E(!1), A = E(0), p = E(0), T = E(null), v = Qe.degToRad, s = E(1), m = () => ls / je / s.value;
832
- let _ = [];
833
- ke(
834
- () => t.animationData,
835
- (r) => {
836
- var u;
837
- D.value = r.extra.管长, b.value = r.extra.外径 / 2;
838
- let g = ((u = st(r)) == null ? void 0 : u.动画输出) ?? [];
839
- g && g.length > 0 && (_ = g);
840
- },
841
- { deep: !0 }
842
- ), de(() => _.length > 0);
843
- const S = (r, g = !1) => r === "revolute" ? g ? Math.PI : -Math.PI : r === "prismatic" ? g ? 1 : -1 : 0, Z = () => {
844
- if (!a.value)
845
- return Ke.error("未加载 URDF"), !1;
846
- let r = null;
847
- return a.value.traverse((g) => {
848
- r || g.name === "Pipe_Link" && g.traverse((u) => {
849
- u instanceof Ie && !r && (r = u);
850
- });
851
- }), r ? (r.position.y -= I.value * ye, l.value = r, r.material = new et({
852
- color: 11184810,
853
- shininess: 80,
854
- side: tt
855
- }), !0) : (Ke.error('在 "Pipe_Link" 内未找到任何 Mesh'), !1);
856
- }, F = (r) => {
857
- if (!r || !r.joints)
858
- return console.warn("URDF模型没有关节信息"), [];
859
- let g = null;
860
- if (r.traverse((M) => {
861
- M.name === "Pipe_Link" && !g && (g = M);
862
- }), g)
863
- l.value = g;
864
- else
865
- return console.warn("未找到管子模型"), [];
866
- const u = [];
867
- return Object.keys(r.joints).forEach((M) => {
868
- const h = r.joints[M];
869
- if (h._jointType === "fixed")
870
- return;
871
- const n = h.limit ? {
872
- lower: h.limit.lower ?? S(h._jointType, !1),
873
- upper: h.limit.upper ?? S(h._jointType, !0)
874
- } : {
875
- lower: S(h._jointType, !1),
876
- upper: S(h._jointType, !0)
877
- };
878
- u.push({
879
- name: M,
880
- type: h._jointType || "unknown",
881
- limit: n,
882
- currentValue: h.angle || 0,
883
- urdfJoint: h
884
- });
885
- }), u.sort((M, h) => M.name.localeCompare(h.name));
886
- }, B = (r, g) => {
887
- const u = i.value.find((h) => h.name === r);
888
- if (!u) return;
889
- const M = parseFloat(g);
890
- if (u.limit) {
891
- const h = Math.max(u.limit.lower, Math.min(u.limit.upper, M));
892
- u.currentValue = h;
893
- } else
894
- u.currentValue = M;
895
- t.model && t.model.setJointValue ? t.model.setJointValue(r, u.currentValue) : u.urdfJoint && u.urdfJoint.setJointValue(u.currentValue);
896
- }, H = (r) => r.reduce((g, u) => {
897
- let M = 0;
898
- const h = u.Y ?? 0, n = u.C ?? 0, P = u.R ?? 0;
899
- return h > 0 && (M += h), n > 0 && P > 0 && (M += P * v(n)), g + M;
900
- }, 0), X = (r) => {
901
- const g = [], u = r.Y ?? 0, M = r.B ?? 0, h = r.C ?? 0, n = r.R ?? 0, P = {
902
- pos: new y(0, 0, 0),
903
- localY: new y(0, 1, 0),
904
- localX: new y(1, 0, 0),
905
- localZ: new y(0, 0, 1)
906
- };
907
- if (!u && !h) return g;
908
- if (g.push(P.pos.clone()), M !== 0) {
909
- const G = new ge().makeRotationAxis(P.localY, v(M));
910
- P.localX.applyMatrix4(G), P.localZ.applyMatrix4(G);
911
- }
912
- if (u > 0 && (P.pos.add(P.localY.clone().multiplyScalar(u * ye)), g.push(P.pos.clone())), h > 0 && n > 0) {
913
- const G = v(h), U = n * ye, ae = P.pos.clone().add(P.localX.clone().multiplyScalar(-U)), N = Math.max(16, Math.ceil(h / 5));
914
- for (let x = 1; x <= N; x++) {
915
- const se = G * x / N, re = new ge().makeRotationAxis(P.localZ, se), we = P.localX.clone().multiplyScalar(U).applyMatrix4(re), Pe = ae.clone().add(we);
916
- g.push(Pe);
917
- }
918
- }
919
- return g;
920
- }, q = (r, g = 0) => {
921
- let u = _.slice(0, r + 1);
922
- const M = _[r + 1];
923
- if (M && g > 0) {
924
- const N = {
925
- ...M,
926
- // 根据插值因子计算当前的弯曲角度C,实现从0到目标角度的平滑过渡
927
- B: (M.B ?? 0) * g,
928
- // 根据插值因子计算当前的弯曲角度C,实现从0到目标角度的平滑过渡
929
- C: (M.C ?? 0) * g
930
- };
931
- u.push(N);
932
- }
933
- const h = H(u), n = Math.max(0, D.value - h), P = [];
934
- P.push(new y(0, 0, 0));
935
- const G = new y(0, n * ye, 0);
936
- n > 0 && P.push(G);
937
- let U = {
938
- pos: G.clone(),
939
- localY: new y(0, 1, 0),
940
- localX: new y(1, 0, 0),
941
- localZ: new y(0, 0, 1)
942
- };
943
- const ae = [];
944
- for (let N = u.length - 1; N >= 0; N--) {
945
- const x = u[N], se = X(x);
946
- if (se.length > 0) {
947
- const re = se.map((ue) => {
948
- const _e = ue.clone(), Ne = new ge();
949
- return Ne.makeBasis(U.localX, U.localY, U.localZ), _e.applyMatrix4(Ne), _e.add(U.pos);
950
- });
951
- ae.push(re);
952
- const fe = re[re.length - 1];
953
- U.pos = fe.clone();
954
- const we = x.B ?? 0, Pe = x.C ?? 0;
955
- if (we !== 0) {
956
- const ue = new ge().makeRotationAxis(U.localY, v(we));
957
- U.localX.applyMatrix4(ue), U.localZ.applyMatrix4(ue);
958
- }
959
- if (Pe > 0) {
960
- const ue = v(Pe), _e = new ge().makeRotationAxis(U.localZ, ue);
961
- U.localY.applyMatrix4(_e), U.localX.applyMatrix4(_e);
962
- }
963
- }
964
- }
965
- for (const N of ae)
966
- N.length > 1 && P.push(...N.slice(1));
967
- P.length < 2 && P.push(new y(0, 1e-3, 0));
968
- try {
969
- const N = new xt(P, !1, "catmullrom", 0.01), x = new Et(N, Math.max(2, P.length * 4), b.value * ye, 18, !1);
970
- l.value.geometry.dispose(), l.value.geometry = x;
971
- } catch (N) {
972
- console.error("管件更新失败", N);
973
- }
974
- }, ie = (r, g, u = 1) => {
975
- r && (Object.keys(r).forEach((M) => {
976
- const h = r[M], n = i.value.find((P) => P.name === M);
977
- n && (n.currentValue = h, t.model && t.model.setJointValue ? t.model.setJointValue(M, h) : n.urdfJoint && n.urdfJoint.setJointValue(h));
978
- }), q(g, u));
979
- }, f = (r, g, u) => r + (g - r) * u, c = (r, g, u) => {
980
- if (!r || !g) return r || g;
981
- const M = {};
982
- return Object.keys(r).forEach((h) => {
983
- const n = r[h], P = g[h];
984
- M[h] = f(n, P || n, u);
985
- }), M;
986
- }, R = () => {
987
- if (_.length === 0) {
988
- console.warn("没有动画数据");
989
- return;
990
- }
991
- Z(), z.value = !0, O.value = !1, A.value = 0, p.value = 0, j();
992
- }, j = () => {
993
- if (!z.value || O.value) return;
994
- const r = A.value;
995
- if (r >= _.length - 1) {
996
- const h = _[_.length - 1];
997
- ie(h, _.length - 1, 1), Q();
998
- return;
999
- }
1000
- const g = p.value / je, u = _[r], M = _[r + 1];
1001
- if (M) {
1002
- const h = c(u, M, g);
1003
- ie(h, r, g);
1004
- } else
1005
- ie(u, r);
1006
- p.value++, p.value > je && (p.value = 0, A.value++), T.value = setTimeout(j, m());
1007
- }, K = () => {
1008
- O.value = !0, T.value && (clearTimeout(T.value), T.value = null);
1009
- }, Q = () => {
1010
- z.value = !1, O.value = !1, s.value = 1, T.value && (clearTimeout(T.value), T.value = null);
1011
- };
1012
- e({
1013
- startAnimation: R,
1014
- pauseAnimation: K,
1015
- stopAnimation: Q,
1016
- resetAll: () => {
1017
- Q(), A.value = 0, p.value = 0, i.value.forEach((r) => {
1018
- (r.type === "revolute" || r.type === "prismatic") && B(r.name, 0);
1019
- }), q(-1, 0);
1020
- },
1021
- fastForward: () => {
1022
- s.value < 4 && (s.value = Math.min(4, s.value * 2));
1023
- },
1024
- fastBackward: () => {
1025
- s.value > 0.25 && (s.value = Math.max(0.25, s.value / 2));
1026
- }
1027
- }), ke(
1028
- () => t.model,
1029
- (r) => {
1030
- r ? (a.value = r, i.value = F(r)) : i.value = [];
1031
- },
1032
- { immediate: !0 }
1033
- );
1034
- const me = () => {
1035
- !t.model || z.value && !O.value || i.value.forEach((r) => {
1036
- r.urdfJoint && r.urdfJoint.angle !== void 0 && (r.currentValue = r.urdfJoint.angle);
1037
- });
1038
- }, be = () => {
1039
- const r = () => {
1040
- me(), d.value = requestAnimationFrame(r);
1041
- };
1042
- r();
1043
- }, Re = () => {
1044
- d.value && (cancelAnimationFrame(d.value), d.value = null);
1045
- };
1046
- return We(() => {
1047
- be();
1048
- }), ot(() => {
1049
- Re(), Q();
1050
- }), (r, g) => ($(), W("div", Kt, [
1051
- i.value.length > 0 ? ($(), W("div", $t, [
1052
- ($(!0), W(nt, null, at(i.value, (u) => {
1053
- var M, h, n, P;
1054
- return $(), W("div", {
1055
- key: u.name,
1056
- class: "joint-item"
1057
- }, [
1058
- w("div", Gt, [
1059
- w("div", Jt, [
1060
- w("span", Wt, le(u.name), 1),
1061
- w("span", qt, " [" + le(((M = u.limit) == null ? void 0 : M.lower.toFixed(2)) ?? (u.type === "revolute" ? "-3.14" : "-1.00")) + ", " + le(((h = u.limit) == null ? void 0 : h.upper.toFixed(2)) ?? (u.type === "revolute" ? "3.14" : "1.00")) + "] ", 1)
1062
- ]),
1063
- w("span", Qt, le(u.type), 1)
1064
- ]),
1065
- u.type === "revolute" || u.type === "prismatic" ? ($(), W("div", es, [
1066
- w("div", ts, [
1067
- w("input", {
1068
- type: "range",
1069
- min: ((n = u.limit) == null ? void 0 : n.lower) ?? (u.type === "revolute" ? -Math.PI : -1),
1070
- max: ((P = u.limit) == null ? void 0 : P.upper) ?? (u.type === "revolute" ? Math.PI : 1),
1071
- step: 0.01,
1072
- value: u.currentValue,
1073
- onInput: (G) => B(u.name, G.target.value),
1074
- class: "joint-slider",
1075
- disabled: z.value && !O.value
1076
- }, null, 40, ss)
1077
- ]),
1078
- w("div", is, [
1079
- w("span", os, le(u.currentValue ? Number(u.currentValue).toFixed(3) : "0.000"), 1),
1080
- w("span", ns, le(u.type === "revolute" ? "rad" : "m"), 1)
1081
- ])
1082
- ])) : Te("", !0)
1083
- ]);
1084
- }), 128))
1085
- ])) : ($(), W("div", as, g[0] || (g[0] = [
1086
- w("p", null, "未检测到可控制的关节", -1)
1087
- ])))
1088
- ]));
1089
- }
1090
- }, cs = /* @__PURE__ */ ve(rs, [["__scopeId", "data-v-0bb82714"]]), hs = { class: "panel-content" }, us = "id", ps = {
1091
- __name: "urdfTree",
1092
- props: {
1093
- model: Object,
1094
- maxExpandCount: {
1095
- type: Number,
1096
- default: 10
1097
- },
1098
- expandStrategy: {
1099
- type: String,
1100
- default: "breadth",
1101
- validator: (o) => ["breadth", "firstLevel"].includes(o)
1102
- }
1103
- },
1104
- emits: ["nodeClick"],
1105
- setup(o, { emit: e }) {
1106
- const t = o, i = e, a = E([]), d = {
1107
- children: "children",
1108
- label: "label"
1109
- }, b = (p) => {
1110
- i("nodeClick", p);
1111
- }, l = (p, T = 0) => {
1112
- const v = [];
1113
- return Array.isArray(p) && (p == null ? void 0 : p.length) > 0 && p.forEach((s) => {
1114
- if (!(s != null && s.isMesh) && ((s == null ? void 0 : s.type) === "URDFJoint" || (s == null ? void 0 : s.type) === "URDFLink")) {
1115
- const m = {
1116
- name: s == null ? void 0 : s.name,
1117
- label: s == null ? void 0 : s.name,
1118
- show: !0,
1119
- level: T + 1,
1120
- isPenultimate: !1,
1121
- type: s == null ? void 0 : s.type,
1122
- id: s == null ? void 0 : s.id,
1123
- limit: (s == null ? void 0 : s.limit) ?? "",
1124
- children: l(s == null ? void 0 : s.children, T + 1),
1125
- path: s == null ? void 0 : s.name
1126
- };
1127
- v.push(m);
1128
- }
1129
- }), v;
1130
- }, D = (p) => p ? [{
1131
- name: p == null ? void 0 : p.name,
1132
- label: p == null ? void 0 : p.name,
1133
- show: !0,
1134
- level: 1,
1135
- isPenultimate: !1,
1136
- type: p == null ? void 0 : p.type,
1137
- id: p == null ? void 0 : p.id,
1138
- limit: (p == null ? void 0 : p.limit) ?? "",
1139
- children: l(p == null ? void 0 : p.children, 1),
1140
- path: p == null ? void 0 : p.name
1141
- }] : [], I = (p, T) => {
1142
- const v = [], s = [...p];
1143
- for (; s.length > 0 && v.length < T; ) {
1144
- const m = s.shift();
1145
- m.children && m.children.length > 0 && (v.push(m.id), s.push(...m.children));
1146
- }
1147
- return v;
1148
- }, z = (p, T) => {
1149
- const v = [];
1150
- return p.forEach((s) => {
1151
- if (s.children && s.children.length > 0) {
1152
- v.push(s.id);
1153
- const m = s.children.filter((_) => _.children && _.children.length > 0).slice(0, T).map((_) => _.id);
1154
- v.push(...m);
1155
- }
1156
- }), v.slice(0, T + 1);
1157
- }, O = de(() => !a.value || a.value.length === 0 ? [] : t.expandStrategy === "firstLevel" ? z(a.value, t.maxExpandCount) : I(a.value, t.maxExpandCount)), A = de(() => t != null && t.model ? D(t.model) : []);
1158
- return ke(
1159
- A,
1160
- (p) => {
1161
- a.value = JSON.parse(JSON.stringify(p));
1162
- },
1163
- { immediate: !0 }
1164
- ), (p, T) => {
1165
- const v = qe("el-tree");
1166
- return $(), W("div", hs, [
1167
- C(v, {
1168
- data: a.value,
1169
- props: d,
1170
- "default-expanded-keys": O.value,
1171
- "node-key": us,
1172
- onNodeClick: b
1173
- }, null, 8, ["data", "default-expanded-keys"])
1174
- ]);
1175
- };
1176
- }
1177
- }, ds = /* @__PURE__ */ ve(ps, [["__scopeId", "data-v-290ff4e1"]]), ms = ["xlink:href"], fs = /* @__PURE__ */ lt({
1178
- __name: "svgIcon",
1179
- props: {
1180
- backgroundColor: { default: "#f0f0f0" },
1181
- prefix: { default: "icon" },
1182
- name: {},
1183
- size: { default: 16 },
1184
- spin: { type: Boolean, default: !1 },
1185
- active: { type: Boolean, default: !1 }
1186
- },
1187
- setup(o) {
1188
- const e = o, t = de(
1189
- () => ({
1190
- backgroundColor: e.backgroundColor
1191
- })
1192
- ), i = de(() => `#${e.prefix}-${e.name}`), a = de(() => {
1193
- const { size: d } = e;
1194
- let b = `${d}`;
1195
- return b = `${b.replace("px", "")}px`, {
1196
- width: b,
1197
- height: b
1198
- };
1199
- });
1200
- return (d, b) => ($(), W("div", {
1201
- class: Ye(["container", { active: d.active }]),
1202
- style: Ue(t.value)
1203
- }, [
1204
- ($(), W("svg", {
1205
- class: Ye(["svg-icon", [d.$attrs.class, d.spin && "svg-icon-spin"]]),
1206
- style: Ue(a.value),
1207
- "aria-hidden": "true"
1208
- }, [
1209
- w("use", { "xlink:href": i.value }, null, 8, ms)
1210
- ], 6))
1211
- ], 6));
1212
- }
1213
- }), L = /* @__PURE__ */ ve(fs, [["__scopeId", "data-v-3150a90b"]]), _s = { class: "obj-viewer-container" }, gs = { class: "buttonGroup-top" }, ys = { class: "buttonGroup-topLeft" }, vs = { class: "buttonGroup-left" }, bs = { class: "buttonGroup-right" }, ws = { class: "buttonGroup-bottom" }, Ps = { class: "left-panel" }, Ms = { class: "panel-header" }, xs = {
1214
- key: 1,
1215
- class: "clipping-content"
1216
- }, Es = { class: "radio-group" }, Ds = { class: "radio-label" }, Ts = { class: "radio-label" }, Cs = { class: "radio-label" }, Ss = { class: "radio-label" }, ks = { class: "right-panel" }, As = { class: "panel-header" }, Rs = {
1217
- key: 0,
1218
- class: "loading-overlay"
1219
- }, zs = {
1220
- __name: "threeModel",
1221
- props: {
1222
- animationData: {
1223
- type: Object,
1224
- default: () => {
1225
- }
1226
- }
1227
- },
1228
- emits: ["getAnimationData"],
1229
- setup(o, { expose: e, emit: t }) {
1230
- const i = t;
1231
- let a = null, d = !1;
1232
- const b = E(null), l = E(!1), D = E("");
1233
- E(!1);
1234
- const I = E(!1), z = E(!1), O = E(""), A = E(!1), p = E(""), T = E(), {
1235
- currentModels: v,
1236
- initialCameraPosition: s,
1237
- initialTargetPosition: m,
1238
- initThreeJS: _,
1239
- handleResize: S,
1240
- fitCameraToAllModels: Z,
1241
- getThreeJSObjects: F,
1242
- clearAllModels: B,
1243
- cleanup: H
1244
- } = Yt(b), { isAnimating: X, toggleAnimation: q, stopAnimation: ie } = Bt(F, v), { isClipping: f, activeClippingAxis: c, toggleClipping: R, updateClippingPlanes: j } = Vt(
1245
- F,
1246
- v
1247
- ), { addModelsFromUrls: K, loadModelByDefaultPath: Q, urdfModel: ee, modelBoundingBoxes: te } = Dt(
1248
- F,
1249
- v,
1250
- l,
1251
- D,
1252
- B
1253
- ), oe = () => {
1254
- if (I.value || v.value.length === 0) return;
1255
- I.value = !0, X.value && ie();
1256
- const { camera: h, controls: n } = F();
1257
- if (!h || !n) return;
1258
- n.enabled = !0;
1259
- const P = (se) => se < 0.5 ? 4 * se * se * se : 1 - Math.pow(-2 * se + 2, 3) / 2, G = h.position.clone(), U = n.target.clone(), ae = 1500, N = Date.now(), x = () => {
1260
- const se = Date.now() - N, re = Math.min(se / ae, 1), fe = P(re);
1261
- h.position.lerpVectors(G, s.value, fe), n.target.lerpVectors(U, m.value, fe), re < 1 ? requestAnimationFrame(x) : I.value = !1;
1262
- };
1263
- x();
1264
- }, me = async () => d ? Promise.resolve() : new Promise((h) => {
1265
- const n = () => {
1266
- d ? h() : requestAnimationFrame(n);
1267
- };
1268
- n();
1269
- }), be = async (h, n) => {
1270
- try {
1271
- await me(), X.value && ie(), f.value && R();
1272
- const P = await n(h);
1273
- return Z(te), P;
1274
- } catch (P) {
1275
- throw console.error("加载模型失败:", P), P;
1276
- }
1277
- }, Re = async (h) => be(h, K), r = async (h) => be(h, Q), g = (h) => {
1278
- z.value = !0, O.value = h, h === "剖面视图" && !f.value && R();
1279
- }, u = (h) => {
1280
- A.value = !0, p.value = h, h === "动画仿真" && i("getAnimationData");
1281
- }, M = () => {
1282
- Be(() => {
1283
- var h;
1284
- (h = T.value) == null || h.startAnimation();
1285
- });
1286
- };
1287
- return We(async () => {
1288
- await Be();
1289
- try {
1290
- _(), a = F().scene, d = !0, window.addEventListener("resize", S);
1291
- } catch (h) {
1292
- console.error("Three.js初始化失败:", h);
1293
- }
1294
- }), rt(() => {
1295
- d = !1, O.value = "", p.value = "", window.removeEventListener("resize", S), X.value && ie(), H();
1296
- }), e({
1297
- addModelsFromUrls: Re,
1298
- loadModelByDefaultPath: r
1299
- }), (h, n) => {
1300
- var G, U, ae, N;
1301
- const P = qe("el-scrollbar");
1302
- return $(), W("div", _s, [
1303
- w("div", {
1304
- ref_key: "threejsContainer",
1305
- ref: b,
1306
- class: "threejs-container"
1307
- }, null, 512),
1308
- w("div", gs, [
1309
- C(L, {
1310
- name: "guanjianjiexi",
1311
- size: "34"
1312
- }),
1313
- C(L, {
1314
- name: "guanjiekongzhi",
1315
- size: "34"
1316
- }),
1317
- C(L, {
1318
- name: "gongyishengcheng",
1319
- size: "34"
1320
- }),
1321
- C(L, {
1322
- name: "buchangshezhi",
1323
- size: "34"
1324
- }),
1325
- C(L, {
1326
- name: "shuchujiagongchengxu",
1327
- size: "34"
1328
- })
1329
- ]),
1330
- w("div", ys, [
1331
- C(L, {
1332
- name: "viewReset",
1333
- size: "24",
1334
- onClick: oe,
1335
- title: "重置"
1336
- }),
1337
- C(L, {
1338
- name: "fangda",
1339
- size: "24",
1340
- title: "放大"
1341
- }),
1342
- C(L, {
1343
- name: "suoxiao",
1344
- size: "24",
1345
- title: "缩小"
1346
- }),
1347
- C(L, {
1348
- name: "lookAround",
1349
- size: "24",
1350
- onClick: V(q),
1351
- title: V(X) ? "停止动画" : "动画视图"
1352
- }, null, 8, ["onClick", "title"])
1353
- ]),
1354
- w("div", vs, [
1355
- C(L, {
1356
- name: "jiegoushu",
1357
- size: "24",
1358
- onClick: n[0] || (n[0] = (x) => g("场景树")),
1359
- active: z.value && O.value === "场景树",
1360
- title: "场景树"
1361
- }, null, 8, ["active"]),
1362
- C(L, {
1363
- name: "clipping",
1364
- size: "24",
1365
- onClick: n[1] || (n[1] = (x) => g("剖面视图")),
1366
- active: z.value && O.value === "剖面视图",
1367
- title: "剖面视图"
1368
- }, null, 8, ["active"]),
1369
- C(L, {
1370
- name: "donghuafangzhen",
1371
- size: "24",
1372
- onClick: n[2] || (n[2] = (x) => g("场景树3"))
1373
- }),
1374
- C(L, {
1375
- name: "donghuafangzhen",
1376
- size: "24",
1377
- onClick: n[3] || (n[3] = (x) => g("场景4"))
1378
- })
1379
- ]),
1380
- w("div", bs, [
1381
- C(L, {
1382
- name: "donghuafangzhen",
1383
- size: "24"
1384
- }),
1385
- C(L, {
1386
- name: "donghuafangzhen",
1387
- size: "24"
1388
- }),
1389
- C(L, {
1390
- name: "guanjiekongzhi",
1391
- size: "24",
1392
- onClick: n[4] || (n[4] = (x) => u("关节控制")),
1393
- active: A.value && p.value === "关节控制",
1394
- title: "关节控制"
1395
- }, null, 8, ["active"]),
1396
- C(L, {
1397
- name: "donghuafangzhen",
1398
- size: "24",
1399
- title: "动画仿真",
1400
- onClick: n[5] || (n[5] = (x) => u("动画仿真")),
1401
- active: A.value && p.value === "动画仿真"
1402
- }, null, 8, ["active"]),
1403
- C(L, {
1404
- name: "donghuafangzhen",
1405
- size: "24"
1406
- }),
1407
- C(L, {
1408
- name: "donghuafangzhen",
1409
- size: "24"
1410
- })
1411
- ]),
1412
- w("div", ws, [
1413
- C(L, {
1414
- name: "kuaitui",
1415
- size: "24",
1416
- backgroundColor: "#ffffff",
1417
- title: "快退",
1418
- onClick: (G = T.value) == null ? void 0 : G.fastBackward
1419
- }, null, 8, ["onClick"]),
1420
- C(L, {
1421
- name: "bofang",
1422
- size: "24",
1423
- backgroundColor: "#ffffff",
1424
- title: "播放",
1425
- onClick: M
1426
- }),
1427
- C(L, {
1428
- name: "kuaijin",
1429
- size: "24",
1430
- backgroundColor: "#ffffff",
1431
- title: "快进",
1432
- onClick: (U = T.value) == null ? void 0 : U.fastForward
1433
- }, null, 8, ["onClick"]),
1434
- C(L, {
1435
- name: "zanting",
1436
- size: "24",
1437
- backgroundColor: "#ffffff",
1438
- title: "暂停",
1439
- onClick: (ae = T.value) == null ? void 0 : ae.pauseAnimation
1440
- }, null, 8, ["onClick"]),
1441
- C(L, {
1442
- name: "zhongzhi",
1443
- size: "24",
1444
- backgroundColor: "#ffffff",
1445
- title: "停止",
1446
- onClick: (N = T.value) == null ? void 0 : N.resetAll
1447
- }, null, 8, ["onClick"])
1448
- ]),
1449
- ce(w("div", Ps, [
1450
- w("div", Ms, [
1451
- w("span", null, le(O.value), 1),
1452
- w("span", {
1453
- class: "close",
1454
- onClick: n[6] || (n[6] = (x) => z.value = !1)
1455
- }, " X ")
1456
- ]),
1457
- C(P, { "max-height": "650px" }, {
1458
- default: Ve(() => [
1459
- O.value === "场景树" ? ($(), Je(ds, {
1460
- key: 0,
1461
- model: V(ee)
1462
- }, null, 8, ["model"])) : Te("", !0),
1463
- O.value === "剖面视图" ? ($(), W("div", xs, [
1464
- w("div", Es, [
1465
- w("label", Ds, [
1466
- ce(w("input", {
1467
- type: "radio",
1468
- name: "clipping-axis",
1469
- value: "none",
1470
- "onUpdate:modelValue": n[7] || (n[7] = (x) => Me(c) ? c.value = x : null),
1471
- onChange: n[8] || (n[8] = (...x) => V(j) && V(j)(...x))
1472
- }, null, 544), [
1473
- [xe, V(c)]
1474
- ]),
1475
- n[16] || (n[16] = w("span", { class: "radio-text" }, "无切割", -1))
1476
- ]),
1477
- w("label", Ts, [
1478
- ce(w("input", {
1479
- type: "radio",
1480
- name: "clipping-axis",
1481
- value: "x",
1482
- "onUpdate:modelValue": n[9] || (n[9] = (x) => Me(c) ? c.value = x : null),
1483
- onChange: n[10] || (n[10] = (...x) => V(j) && V(j)(...x))
1484
- }, null, 544), [
1485
- [xe, V(c)]
1486
- ]),
1487
- n[17] || (n[17] = w("span", { class: "radio-text" }, "X轴切割", -1))
1488
- ]),
1489
- w("label", Cs, [
1490
- ce(w("input", {
1491
- type: "radio",
1492
- name: "clipping-axis",
1493
- value: "y",
1494
- "onUpdate:modelValue": n[11] || (n[11] = (x) => Me(c) ? c.value = x : null),
1495
- onChange: n[12] || (n[12] = (...x) => V(j) && V(j)(...x))
1496
- }, null, 544), [
1497
- [xe, V(c)]
1498
- ]),
1499
- n[18] || (n[18] = w("span", { class: "radio-text" }, "Y轴切割", -1))
1500
- ]),
1501
- w("label", Ss, [
1502
- ce(w("input", {
1503
- type: "radio",
1504
- name: "clipping-axis",
1505
- value: "z",
1506
- "onUpdate:modelValue": n[13] || (n[13] = (x) => Me(c) ? c.value = x : null),
1507
- onChange: n[14] || (n[14] = (...x) => V(j) && V(j)(...x))
1508
- }, null, 544), [
1509
- [xe, V(c)]
1510
- ]),
1511
- n[19] || (n[19] = w("span", { class: "radio-text" }, "Z轴切割", -1))
1512
- ])
1513
- ])
1514
- ])) : Te("", !0)
1515
- ]),
1516
- _: 1
1517
- })
1518
- ], 512), [
1519
- [Ee, z.value]
1520
- ]),
1521
- ce(w("div", ks, [
1522
- w("div", As, [
1523
- w("span", null, le(p.value), 1),
1524
- w("span", {
1525
- class: "close",
1526
- onClick: n[15] || (n[15] = (x) => A.value = !1)
1527
- }, " X ")
1528
- ]),
1529
- C(P, { "max-height": "650px" }, {
1530
- default: Ve(() => [
1531
- ce(C(cs, {
1532
- ref_key: "jointRef",
1533
- ref: T,
1534
- model: V(ee),
1535
- scene: V(a),
1536
- animationData: o.animationData
1537
- }, null, 8, ["model", "scene", "animationData"]), [
1538
- [Ee, p.value === "关节控制"]
1539
- ]),
1540
- ce(C(Xt, { animationData: o.animationData }, null, 8, ["animationData"]), [
1541
- [Ee, p.value === "动画仿真"]
1542
- ])
1543
- ]),
1544
- _: 1
1545
- })
1546
- ], 512), [
1547
- [Ee, A.value]
1548
- ]),
1549
- l.value ? ($(), W("div", Rs, [
1550
- n[20] || (n[20] = w("div", { class: "loading-spinner" }, null, -1)),
1551
- w("p", null, le(D.value), 1)
1552
- ])) : Te("", !0)
1553
- ]);
1554
- };
1555
- }
1556
- }, Fs = /* @__PURE__ */ ve(zs, [["__scopeId", "data-v-7bc47bb3"]]);
1557
- export {
1558
- Fs as default
1559
- };