ss-component-new 1.3.665 → 1.3.666
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/MTLLoader-DI0avKtj.js +657 -0
- package/dist/URDFLoader-PUxvYFDe.js +2304 -0
- package/dist/animationData-05aVUytq.js +83 -0
- package/dist/array-BHRYnJKv.js +1044 -0
- package/dist/clone-Ddn1p6-1.js +8 -0
- package/dist/config.js +1 -1
- package/dist/eleIcon-BWVKfp5t.js +29 -0
- package/dist/iconfont-BNdGaGPn.js +1018 -0
- package/dist/icons/svg/Update.svg +1 -0
- package/dist/icons/svg/functionList.svg +1 -0
- package/dist/icons/svg/uploadCopy.svg +1 -0
- package/dist/index-7mFTFA3-.js +107 -0
- package/dist/index-BDhIWgKn.js +658 -0
- package/dist/index-BFqUz4pN.js +52 -0
- package/dist/index-BP1mKUQP.js +627 -0
- package/dist/index-BczRQX8N.js +407 -0
- package/dist/index-BnrvtCYj.js +55 -0
- package/dist/index-Bpr501oZ.js +78 -0
- package/dist/index-BvbZiTVB.js +342 -0
- package/dist/index-Bvvz41NY.js +44 -0
- package/dist/index-C2M8MGB3.js +83 -0
- package/dist/index-C67QqPPT.js +24865 -0
- package/dist/index-C85-PeF1.js +11773 -0
- package/dist/index-C9DBY1gg.js +103 -0
- package/dist/index-CFFbhR3G.js +996 -0
- package/dist/index-COr2mcbl.js +48 -0
- package/dist/index-CQ8DCGnJ.js +98 -0
- package/dist/index-CV2cha0T.js +864 -0
- package/dist/index-CV_jQDcg.js +9 -0
- package/dist/index-CXe4q28L.js +447 -0
- package/dist/{index-BobGeNMx.js → index-ChNfRlIP.js} +5 -5
- package/dist/index-CqNlqFQ5.js +117 -0
- package/dist/index-D-5v1Jx7.js +93 -0
- package/dist/index-D4LcEpQ7.js +619 -0
- package/dist/index-D9w3QWuY.js +468 -0
- package/dist/index-DGObzWyL.js +8984 -0
- package/dist/index-DJ59jXR0.js +28483 -0
- package/dist/index-DJrzqi4-.js +209 -0
- package/dist/index-D_kI6aHR.js +98 -0
- package/dist/index-DhQcwkOc.js +61958 -0
- package/dist/index-DhULdX5n.js +2623 -0
- package/dist/index-Dibj25i7.js +93 -0
- package/dist/index-Dr9Wt5nC.js +84 -0
- package/dist/index-Dwt0Wlg_.js +201 -0
- package/dist/index-WPJbEuld.js +62 -0
- package/dist/index-YVR3acYT.js +61 -0
- package/dist/{index-BKK_dL6t.js → index-dD-mKgue.js} +3 -3
- package/dist/index-roQK_1xA.js +30 -0
- package/dist/index-uF-ibwG0.js +9 -0
- package/dist/{index.vue_vue_type_script_setup_true_lang-DRzriV-s.js → index.vue_vue_type_script_setup_true_lang-DwbHXtUp.js} +2 -2
- package/dist/index.vue_vue_type_style_index_0_scoped_39e1db95_lang-CG9X8aa2.js +137728 -0
- package/dist/isString-CoCw_sp3.js +8 -0
- package/dist/localIcon-CoJHw5ss.js +76 -0
- package/dist/main-Dlo2i9wB.js +502 -0
- package/dist/menuIndex-Dt0NyAyE.js +159 -0
- package/dist/request-DiogHwkN.js +9465 -0
- package/dist/ss-component.css +8 -2
- package/dist/ss-component.js +64 -28
- package/dist/ss-component2.js +75 -15
- package/dist/ss-component3.js +1 -1
- package/dist/threeModel-BfY7WDWB.js +1108 -0
- package/dist/threePreview-BHLSA5YS.js +2259 -0
- package/dist/threeSceneView-ZTUK-ls2.js +1289 -0
- package/dist/threeSceneViewForCPMPIP-DCG4eBvk.js +538 -0
- package/dist/threeTrackPathView-BR8-g2Tr.js +620 -0
- package/dist/threeViewerHost-BwblfmOC.js +233 -0
- package/dist/urdfTree-IEJgkVzs.js +254 -0
- package/dist/workpieceTreePanel-aZV2ut3W.js +555 -0
- package/package.json +4 -4
- package/public/config.js +1 -1
- package/public/icons/svg/Update.svg +1 -0
- package/public/icons/svg/functionList.svg +1 -0
- package/public/icons/svg/uploadCopy.svg +1 -0
- package/dist/index-CoXdIQt_.js +0 -50
- package/dist/index-DJWOuBw9.js +0 -195
- package/dist/index-DK2pco3V.js +0 -1044
- package/dist/index-DfraOPVU.js +0 -9022
- package/dist/index-MHAwX3y9.js +0 -182
- package/dist/menu-B8iV5Rhf.js +0 -5215
- package/dist/origin-C4Shcrcr.js +0 -11428
- /package/dist/icons/svg/{table-close.svg → tableClose.svg} +0 -0
- /package/dist/icons/svg/{table-expand.svg → tableExpand.svg} +0 -0
- /package/public/icons/svg/{table-close.svg → tableClose.svg} +0 -0
- /package/public/icons/svg/{table-expand.svg → tableExpand.svg} +0 -0
|
@@ -0,0 +1,1108 @@
|
|
|
1
|
+
import { ref as b, watch as Pe, openBlock as H, createElementBlock as q, createBlock as Le, computed as ie, onMounted as $e, onUnmounted as je, Fragment as Xe, renderList as He, createElementVNode as h, toDisplayString as ae, createCommentVNode as xe, resolveComponent as Je, createVNode as z, defineComponent as Ye, normalizeStyle as Ee, normalizeClass as Fe, nextTick as Be, onBeforeUnmount as qe, unref as O, withDirectives as se, withCtx as Te, isRef as he, vModelRadio as ye, vShow as we } from "vue";
|
|
2
|
+
import { V as x, B as be, S as Ze, C as We, P as Ke, W as Ne, b as Qe, A as et, c as tt, M as Ve, X as nt, G as at, e as Me, f as ot, h as De, i as st, D as ke, H as lt, j as Re, k as Oe, l as Ue, m as ze, E as _e, n as de, o as it, T as rt, p as ct } from "./index.vue_vue_type_style_index_0_scoped_39e1db95_lang-CG9X8aa2.js";
|
|
3
|
+
import { O as ut } from "./iconfont-BNdGaGPn.js";
|
|
4
|
+
import { V as dt, W as pt } from "./index-DhQcwkOc.js";
|
|
5
|
+
import { _ as me } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
+
import { c as Ge } from "./index-DGObzWyL.js";
|
|
7
|
+
import { E as Ie } from "./request-DiogHwkN.js";
|
|
8
|
+
function mt(A) {
|
|
9
|
+
let f = null, r = null, c = null, v = null, M = null, k = null, i = null, D = null;
|
|
10
|
+
const F = 1e3 / 30;
|
|
11
|
+
let T = 0;
|
|
12
|
+
const S = b([]), l = b(new x()), C = b(new x()), g = () => {
|
|
13
|
+
if (!A.value) return;
|
|
14
|
+
f = new Ze(), f.background = new We(15790320);
|
|
15
|
+
const d = A.value;
|
|
16
|
+
r = new Ke(75, d.clientWidth / d.clientHeight, 0.1, 1e4), r.position.set(8, -8, 6), r.up.set(0, 0, 1), r.lookAt(0, 0, 0), c = new Ne({
|
|
17
|
+
antialias: !0,
|
|
18
|
+
alpha: !0
|
|
19
|
+
}), c.setSize(d.clientWidth, d.clientHeight), c.localClippingEnabled = !0, c.shadowMap.enabled = !0, c.shadowMap.type = Qe, c.toneMapping = et, c.toneMappingExposure = 1, c.outputColorSpace = tt, d.appendChild(c.domElement), v = new ut(r, c.domElement), v.enableDamping = !0, v.dampingFactor = 0.05, v.mouseButtons = {
|
|
20
|
+
LEFT: null,
|
|
21
|
+
MIDDLE: Ve.PAN,
|
|
22
|
+
RIGHT: Ve.ROTATE
|
|
23
|
+
}, v.panSpeed = 0.7, M = new nt(r, c, {
|
|
24
|
+
container: d,
|
|
25
|
+
type: "cube",
|
|
26
|
+
placement: "top-right",
|
|
27
|
+
offset: {
|
|
28
|
+
top: 10,
|
|
29
|
+
right: 10
|
|
30
|
+
},
|
|
31
|
+
background: {
|
|
32
|
+
color: "#D1D1D1",
|
|
33
|
+
opacity: 1
|
|
34
|
+
},
|
|
35
|
+
front: {
|
|
36
|
+
label: "Top"
|
|
37
|
+
},
|
|
38
|
+
bottom: {
|
|
39
|
+
label: "Front"
|
|
40
|
+
},
|
|
41
|
+
left: {
|
|
42
|
+
label: "Left"
|
|
43
|
+
},
|
|
44
|
+
right: {
|
|
45
|
+
label: "Right"
|
|
46
|
+
},
|
|
47
|
+
top: {
|
|
48
|
+
label: "Back"
|
|
49
|
+
},
|
|
50
|
+
back: {
|
|
51
|
+
label: "Bottom"
|
|
52
|
+
}
|
|
53
|
+
}), M.attachControls(v), p(), _();
|
|
54
|
+
}, e = (d, a) => {
|
|
55
|
+
i && (f.remove(i), i.dispose()), D && (f.remove(D), D.geometry.dispose(), D.material.dispose());
|
|
56
|
+
const E = Math.min(Math.max(Math.floor(d / 20), 30), 40);
|
|
57
|
+
i = new at(d, E, 13421772, 14540253), i.rotateX(Math.PI / 2), i.position.copy(a), f.add(i);
|
|
58
|
+
const V = new Me(d, d), X = new ot({
|
|
59
|
+
opacity: 0.3,
|
|
60
|
+
// 阴影透明度
|
|
61
|
+
color: 0
|
|
62
|
+
});
|
|
63
|
+
D = new De(V, X), D.position.copy(a), D.position.z -= 0.01, D.receiveShadow = !0, f.add(D);
|
|
64
|
+
}, u = () => {
|
|
65
|
+
if (S.value.length === 0)
|
|
66
|
+
return;
|
|
67
|
+
const d = new be();
|
|
68
|
+
let a = !1;
|
|
69
|
+
if (S.value.forEach((N) => {
|
|
70
|
+
if (N.userData.boundingBox)
|
|
71
|
+
d.union(N.userData.boundingBox), a = !0;
|
|
72
|
+
else if (N.userData.modelId && modelBoundingBoxes.has(N.userData.modelId)) {
|
|
73
|
+
const te = modelBoundingBoxes.get(N.userData.modelId);
|
|
74
|
+
d.union(te.box), a = !0;
|
|
75
|
+
} else
|
|
76
|
+
d.expandByObject(N), a = !0;
|
|
77
|
+
}), !a) {
|
|
78
|
+
console.warn("无法计算包围盒,网格更新失败");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const E = d.getSize(new x()), V = d.getCenter(new x()), X = Math.max(E.x, E.y, E.z), W = Math.max(X * 8, 50), K = new x(
|
|
82
|
+
V.x,
|
|
83
|
+
V.y,
|
|
84
|
+
d.min.z
|
|
85
|
+
// 模型的最底部
|
|
86
|
+
);
|
|
87
|
+
e(W, K);
|
|
88
|
+
}, p = () => {
|
|
89
|
+
const d = new st(4210752, 0.6);
|
|
90
|
+
f.add(d);
|
|
91
|
+
const a = new ke(16777215, 2);
|
|
92
|
+
a.position.set(10, 10, 8), a.castShadow = !0, a.shadow.mapSize.width = 4096, a.shadow.mapSize.height = 4096, a.shadow.camera.near = 0.5, a.shadow.camera.far = 50, a.shadow.camera.left = -50, a.shadow.camera.right = 50, a.shadow.camera.top = 50, a.shadow.camera.bottom = -50, f.add(a);
|
|
93
|
+
const E = new ke(16777215, 0.8);
|
|
94
|
+
E.position.set(-8, -8, 6), f.add(E);
|
|
95
|
+
const V = new ke(16777215, 0.6);
|
|
96
|
+
V.position.set(0, -15, 2), f.add(V);
|
|
97
|
+
const X = new lt(16777215, 4473924, 0.8);
|
|
98
|
+
f.add(X);
|
|
99
|
+
const W = new Re(16777215, 1, 50);
|
|
100
|
+
W.position.set(15, 15, 15), f.add(W);
|
|
101
|
+
const K = new Re(16777215, 0.5, 50);
|
|
102
|
+
K.position.set(-15, -15, 15), f.add(K);
|
|
103
|
+
}, _ = () => {
|
|
104
|
+
k = requestAnimationFrame(_), v && v.update();
|
|
105
|
+
const d = performance.now(), a = d - T;
|
|
106
|
+
a < F || (T = d - a % F, c && f && r && c.render(f, r), M && M.render());
|
|
107
|
+
}, U = (d) => {
|
|
108
|
+
[
|
|
109
|
+
"map",
|
|
110
|
+
"normalMap",
|
|
111
|
+
"bumpMap",
|
|
112
|
+
"roughnessMap",
|
|
113
|
+
"metalnessMap",
|
|
114
|
+
"emissiveMap",
|
|
115
|
+
"specularMap",
|
|
116
|
+
"envMap",
|
|
117
|
+
"lightMap",
|
|
118
|
+
"aoMap",
|
|
119
|
+
"displacementMap"
|
|
120
|
+
].forEach((E) => {
|
|
121
|
+
d[E] && d[E].dispose && d[E].dispose();
|
|
122
|
+
}), d.dispose && d.dispose();
|
|
123
|
+
}, R = (d) => {
|
|
124
|
+
d == null || d.traverse((a) => {
|
|
125
|
+
a.geometry && a.geometry.dispose(), a.material && (Array.isArray(a.material) ? a.material.forEach((E) => {
|
|
126
|
+
U(E);
|
|
127
|
+
}) : U(a.material));
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
// 响应式数据
|
|
132
|
+
currentModels: S,
|
|
133
|
+
initialCameraPosition: l,
|
|
134
|
+
initialTargetPosition: C,
|
|
135
|
+
// 方法
|
|
136
|
+
initThreeJS: g,
|
|
137
|
+
handleResize: () => {
|
|
138
|
+
if (!A.value || !r || !c || !M) return;
|
|
139
|
+
const d = A.value, a = d.clientWidth, E = d.clientHeight;
|
|
140
|
+
r.aspect = a / E, r.updateProjectionMatrix(), c.setSize(a, E), M.update();
|
|
141
|
+
},
|
|
142
|
+
fitCameraToAllModels: (d) => {
|
|
143
|
+
if (!r || !v || S.value.length === 0) return;
|
|
144
|
+
const a = new be();
|
|
145
|
+
let E = !1;
|
|
146
|
+
if (S.value.forEach((te) => {
|
|
147
|
+
if (te.userData.boundingBox)
|
|
148
|
+
a.union(te.userData.boundingBox), E = !0;
|
|
149
|
+
else if (te.userData.modelId && d.has(te.userData.modelId)) {
|
|
150
|
+
const re = d.get(te.userData.modelId);
|
|
151
|
+
a.union(re.box), E = !0;
|
|
152
|
+
} else
|
|
153
|
+
a.expandByObject(te), E = !0;
|
|
154
|
+
}), !E) {
|
|
155
|
+
console.warn("无法计算包围盒");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const V = a.getSize(new x()), X = a.getCenter(new x()), K = Math.max(V.x, V.y, V.z) * 0.8, N = new x(X.x + K, X.y - K, X.z + K);
|
|
159
|
+
r.position.copy(N), r.lookAt(X), v.target.copy(X), v.update(), l.value.copy(N), C.value.copy(X), u();
|
|
160
|
+
},
|
|
161
|
+
getThreeJSObjects: () => ({
|
|
162
|
+
scene: f,
|
|
163
|
+
camera: r,
|
|
164
|
+
renderer: c,
|
|
165
|
+
controls: v,
|
|
166
|
+
gizmo: M
|
|
167
|
+
}),
|
|
168
|
+
clearAllModels: () => {
|
|
169
|
+
if (!f) return;
|
|
170
|
+
S.value.forEach((a) => {
|
|
171
|
+
f.remove(a), R(a);
|
|
172
|
+
});
|
|
173
|
+
const d = [];
|
|
174
|
+
f.children.forEach((a) => {
|
|
175
|
+
!a.isLight && !a.isCamera && a.type !== "GridHelper" && a !== D && d.push(a);
|
|
176
|
+
}), d.forEach((a) => {
|
|
177
|
+
f.remove(a), R(a);
|
|
178
|
+
}), S.value = [], u();
|
|
179
|
+
},
|
|
180
|
+
cleanup: () => {
|
|
181
|
+
k && cancelAnimationFrame(k), i && i.dispose(), D && (D.geometry.dispose(), D.material.dispose()), c && c.dispose(), v && v.dispose(), M && M.dispose();
|
|
182
|
+
},
|
|
183
|
+
updateGridForModels: u
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function ft(A, f) {
|
|
187
|
+
const r = b(!1);
|
|
188
|
+
let c = null, v = 12700, M = new x(), k = new x(), i = new x(), D = 0, L = null;
|
|
189
|
+
const F = (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2, T = (e) => {
|
|
190
|
+
const u = new x(), p = D * 1.2, _ = new x(i.x + p, i.y, i.z), U = new x(i.x, i.y + p, i.z), R = new x(i.x, i.y - p, i.z);
|
|
191
|
+
if (e <= 0.567) {
|
|
192
|
+
const G = e / 0.567 * Math.PI * 2;
|
|
193
|
+
u.x = i.x + Math.cos(G) * p, u.z = i.z + Math.sin(G) * p, u.y = i.y;
|
|
194
|
+
} else if (e <= 0.724) {
|
|
195
|
+
const J = (e - 0.567) / 0.157, G = F(J);
|
|
196
|
+
u.lerpVectors(_, U, G);
|
|
197
|
+
} else if (e <= 0.881) {
|
|
198
|
+
const J = (e - 0.724) / 0.157, j = F(J) * Math.PI;
|
|
199
|
+
u.x = i.x + Math.sin(j) * p, u.y = i.y + Math.cos(j) * p, u.z = i.z;
|
|
200
|
+
} else {
|
|
201
|
+
const J = (e - 0.881) / 0.119, G = F(J);
|
|
202
|
+
u.lerpVectors(R, M, G);
|
|
203
|
+
}
|
|
204
|
+
return u;
|
|
205
|
+
}, S = () => {
|
|
206
|
+
const { camera: e, controls: u } = A();
|
|
207
|
+
if (!e || !u) return;
|
|
208
|
+
c || (c = Date.now());
|
|
209
|
+
const p = Date.now() - c, _ = Math.min(p / v, 1);
|
|
210
|
+
if (_ >= 1) {
|
|
211
|
+
C();
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const U = T(_);
|
|
215
|
+
e.position.copy(U), e.lookAt(i), u.target.copy(i), L = requestAnimationFrame(S);
|
|
216
|
+
}, l = () => {
|
|
217
|
+
if (f.value.length === 0) return;
|
|
218
|
+
const { camera: e, controls: u } = A();
|
|
219
|
+
if (!e || !u) return;
|
|
220
|
+
M.copy(e.position), k.copy(u.target);
|
|
221
|
+
const p = new be();
|
|
222
|
+
f.value.forEach((Z) => {
|
|
223
|
+
p.expandByObject(Z);
|
|
224
|
+
});
|
|
225
|
+
const _ = p.getSize(new x());
|
|
226
|
+
i = p.getCenter(new x()), D = Math.max(_.x, _.y, _.z) * 1.2;
|
|
227
|
+
const U = new x(i.x + D * 1.2, i.y, i.z);
|
|
228
|
+
u.enabled = !1;
|
|
229
|
+
const R = e.position.clone(), J = 1e3, G = Date.now(), j = () => {
|
|
230
|
+
const Z = Date.now() - G, ee = Math.min(Z / J, 1), d = F(ee);
|
|
231
|
+
e.position.lerpVectors(R, U, d), e.lookAt(i), u.target.copy(i), ee < 1 ? requestAnimationFrame(j) : (r.value = !0, c = null, S());
|
|
232
|
+
};
|
|
233
|
+
j();
|
|
234
|
+
}, C = () => {
|
|
235
|
+
r.value = !1, c = null, L && (cancelAnimationFrame(L), L = null);
|
|
236
|
+
const { controls: e } = A();
|
|
237
|
+
e && (e.enabled = !0, e.target.copy(k));
|
|
238
|
+
};
|
|
239
|
+
return {
|
|
240
|
+
isAnimating: r,
|
|
241
|
+
toggleAnimation: () => {
|
|
242
|
+
if (r.value) {
|
|
243
|
+
r.value = !1, c = null, L && (cancelAnimationFrame(L), L = null);
|
|
244
|
+
const { camera: e, controls: u } = A();
|
|
245
|
+
if (!e || !u) return;
|
|
246
|
+
u.enabled = !0;
|
|
247
|
+
const p = e.position.clone(), _ = u.target.clone(), U = 1500, R = Date.now(), J = () => {
|
|
248
|
+
const G = Date.now() - R, j = Math.min(G / U, 1), Z = F(j);
|
|
249
|
+
e.position.lerpVectors(p, M, Z), u.target.lerpVectors(_, k, Z), j < 1 && requestAnimationFrame(J);
|
|
250
|
+
};
|
|
251
|
+
J();
|
|
252
|
+
} else
|
|
253
|
+
l();
|
|
254
|
+
},
|
|
255
|
+
startAnimation: l,
|
|
256
|
+
stopAnimation: C
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function vt(A, f) {
|
|
260
|
+
const r = b(!1), c = b("none");
|
|
261
|
+
let v = [], M = [], k = new be(), i = new x();
|
|
262
|
+
const D = () => {
|
|
263
|
+
v = [
|
|
264
|
+
new ze(new x(1, 0, 0), 0),
|
|
265
|
+
// X轴平面
|
|
266
|
+
new ze(new x(0, 1, 0), 0),
|
|
267
|
+
// Y轴平面
|
|
268
|
+
new ze(new x(0, 0, 1), 0)
|
|
269
|
+
// Z轴平面
|
|
270
|
+
];
|
|
271
|
+
}, L = () => {
|
|
272
|
+
k.makeEmpty(), f.value.forEach((g) => {
|
|
273
|
+
k.expandByObject(g);
|
|
274
|
+
}), i = k.getCenter(new x());
|
|
275
|
+
}, F = (g) => {
|
|
276
|
+
const e = k.getSize(new x());
|
|
277
|
+
let u, p, _;
|
|
278
|
+
g === "x" ? (u = new Me(e.z * 1.2, e.y * 1.2), p = new x(i.x, i.y, i.z), _ = new _e(0, Math.PI / 2, 0)) : g === "y" ? (u = new Me(e.x * 1.2, e.z * 1.2), p = new x(i.x, i.y, i.z), _ = new _e(Math.PI / 2, 0, 0)) : g === "z" && (u = new Me(e.x * 1.2, e.y * 1.2), p = new x(i.x, i.y, i.z), _ = new _e(0, 0, 0));
|
|
279
|
+
const U = new Oe({
|
|
280
|
+
color: 8900331,
|
|
281
|
+
transparent: !0,
|
|
282
|
+
opacity: 0.3,
|
|
283
|
+
side: Ue,
|
|
284
|
+
depthWrite: !1
|
|
285
|
+
}), R = new De(u, U);
|
|
286
|
+
return R.position.copy(p), R.rotation.copy(_), R;
|
|
287
|
+
}, T = () => {
|
|
288
|
+
if (S(), l(), c.value === "none")
|
|
289
|
+
return;
|
|
290
|
+
L();
|
|
291
|
+
let g = null;
|
|
292
|
+
if (c.value === "x" ? (v[0].constant = -i.x, g = v[0]) : c.value === "y" ? (v[1].constant = -i.y, g = v[1]) : c.value === "z" && (v[2].constant = -i.z, g = v[2]), g) {
|
|
293
|
+
f.value.forEach((u) => {
|
|
294
|
+
u.traverse((p) => {
|
|
295
|
+
p.isMesh && p.material && (Array.isArray(p.material) ? p.material.forEach((_) => {
|
|
296
|
+
_.clippingPlanes = [g];
|
|
297
|
+
}) : p.material.clippingPlanes = [g]);
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
const { scene: e } = A();
|
|
301
|
+
if (e) {
|
|
302
|
+
const u = F(c.value);
|
|
303
|
+
e.add(u), M.push(u);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}, S = () => {
|
|
307
|
+
f.value.forEach((g) => {
|
|
308
|
+
g.traverse((e) => {
|
|
309
|
+
e.isMesh && e.material && (Array.isArray(e.material) ? e.material.forEach((u) => {
|
|
310
|
+
u.clippingPlanes = [];
|
|
311
|
+
}) : e.material.clippingPlanes = []);
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
}, l = () => {
|
|
315
|
+
const { scene: g } = A();
|
|
316
|
+
g && M.forEach((e) => {
|
|
317
|
+
g.remove(e), e.geometry.dispose(), e.material.dispose();
|
|
318
|
+
}), M = [];
|
|
319
|
+
};
|
|
320
|
+
return {
|
|
321
|
+
isClipping: r,
|
|
322
|
+
activeClippingAxis: c,
|
|
323
|
+
toggleClipping: () => {
|
|
324
|
+
r.value = !r.value, r.value ? (D(), f.value.length > 0 && L()) : (c.value = "none", S(), l());
|
|
325
|
+
},
|
|
326
|
+
updateClippingPlanes: T,
|
|
327
|
+
clearClippingPlanes: S,
|
|
328
|
+
clearClippingMeshes: l
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
const gt = { class: "panel-content" }, ht = {
|
|
332
|
+
__name: "animationPanel",
|
|
333
|
+
props: {
|
|
334
|
+
animationData: Object,
|
|
335
|
+
model: Object
|
|
336
|
+
},
|
|
337
|
+
setup(A) {
|
|
338
|
+
const f = A;
|
|
339
|
+
b();
|
|
340
|
+
const r = b();
|
|
341
|
+
return Pe(
|
|
342
|
+
() => [f == null ? void 0 : f.animationData],
|
|
343
|
+
() => {
|
|
344
|
+
var v;
|
|
345
|
+
let c = ((v = Ge(f == null ? void 0 : f.animationData)) == null ? void 0 : v["输出(动画数据)Content"]) ?? [];
|
|
346
|
+
c && (r.value = c);
|
|
347
|
+
},
|
|
348
|
+
{ deep: !0, immediate: !0 }
|
|
349
|
+
), (c, v) => {
|
|
350
|
+
var M, k, i;
|
|
351
|
+
return H(), q("div", gt, [
|
|
352
|
+
(H(), Le(dt, {
|
|
353
|
+
itemData: (M = r.value) == null ? void 0 : M.compData,
|
|
354
|
+
key: (k = r.value) == null ? void 0 : k.id,
|
|
355
|
+
index: (i = r.value) == null ? void 0 : i.id,
|
|
356
|
+
showHeader: !1
|
|
357
|
+
}, null, 8, ["itemData", "index"]))
|
|
358
|
+
]);
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
}, yt = /* @__PURE__ */ me(ht, [["__scopeId", "data-v-2387536e"]]), wt = { class: "panel-content" }, xt = {
|
|
362
|
+
key: 0,
|
|
363
|
+
class: "joints-list"
|
|
364
|
+
}, Mt = { class: "joint-info-row" }, Pt = { class: "joint-left" }, bt = { class: "joint-name" }, Ct = { class: "joint-range" }, kt = { class: "joint-type" }, zt = {
|
|
365
|
+
key: 0,
|
|
366
|
+
class: "joint-control-row"
|
|
367
|
+
}, _t = { class: "slider-container" }, At = ["min", "max", "value", "onInput", "disabled"], Dt = { class: "value-display" }, St = { class: "joint-value" }, Et = { class: "unit" }, Ft = {
|
|
368
|
+
key: 1,
|
|
369
|
+
class: "empty-state"
|
|
370
|
+
}, pe = 1e-3, Bt = 1e3, Ae = 60, Tt = {
|
|
371
|
+
__name: "jointPanel",
|
|
372
|
+
props: {
|
|
373
|
+
model: Object,
|
|
374
|
+
scene: Object,
|
|
375
|
+
animationData: Object
|
|
376
|
+
},
|
|
377
|
+
setup(A, { expose: f }) {
|
|
378
|
+
const r = A;
|
|
379
|
+
b(!0);
|
|
380
|
+
const c = b([]), v = b(null), M = b(null), k = b(12.5), i = b(), D = b(1302), L = b(30), F = b(!1), T = b(!1), S = b(0), l = b(0), C = b(null), g = ct.degToRad, e = b(1), u = () => Bt / Ae / e.value;
|
|
381
|
+
let p = [];
|
|
382
|
+
Pe(
|
|
383
|
+
() => r.animationData,
|
|
384
|
+
(n) => {
|
|
385
|
+
var s;
|
|
386
|
+
D.value = n.extra.管长, k.value = n.extra.外径 / 2;
|
|
387
|
+
let m = ((s = Ge(n)) == null ? void 0 : s["输出(动画数据)"]) ?? [];
|
|
388
|
+
m && m.length > 0 && (p = m);
|
|
389
|
+
},
|
|
390
|
+
{ deep: !0 }
|
|
391
|
+
), ie(() => p.length > 0);
|
|
392
|
+
const _ = (n, m = !1) => n === "revolute" ? m ? Math.PI : -Math.PI : n === "prismatic" ? m ? 1 : -1 : 0, U = () => {
|
|
393
|
+
if (!v.value)
|
|
394
|
+
return Ie.error("未加载 URDF"), !1;
|
|
395
|
+
let n = null;
|
|
396
|
+
return v.value.traverse((m) => {
|
|
397
|
+
n || m.name === "Pipe_Link" && m.traverse((s) => {
|
|
398
|
+
s instanceof De && !n && (n = s);
|
|
399
|
+
});
|
|
400
|
+
}), n ? (n.position.y -= L.value * pe, i.value = n, n.material = new Oe({
|
|
401
|
+
color: 11184810,
|
|
402
|
+
shininess: 80,
|
|
403
|
+
side: Ue
|
|
404
|
+
}), !0) : (Ie.error('在 "Pipe_Link" 内未找到任何 Mesh'), !1);
|
|
405
|
+
}, R = (n) => {
|
|
406
|
+
if (!n || !n.joints)
|
|
407
|
+
return console.warn("URDF模型没有关节信息"), [];
|
|
408
|
+
let m = null;
|
|
409
|
+
if (n.traverse((w) => {
|
|
410
|
+
w.name === "Pipe_Link" && !m && (m = w);
|
|
411
|
+
}), m)
|
|
412
|
+
i.value = m;
|
|
413
|
+
else
|
|
414
|
+
return console.warn("未找到管子模型"), [];
|
|
415
|
+
const s = [];
|
|
416
|
+
return Object.keys(n.joints).forEach((w) => {
|
|
417
|
+
const o = n.joints[w];
|
|
418
|
+
if (o._jointType === "fixed")
|
|
419
|
+
return;
|
|
420
|
+
const t = o.limit ? {
|
|
421
|
+
lower: o.limit.lower ?? _(o._jointType, !1),
|
|
422
|
+
upper: o.limit.upper ?? _(o._jointType, !0)
|
|
423
|
+
} : {
|
|
424
|
+
lower: _(o._jointType, !1),
|
|
425
|
+
upper: _(o._jointType, !0)
|
|
426
|
+
};
|
|
427
|
+
s.push({
|
|
428
|
+
name: w,
|
|
429
|
+
type: o._jointType || "unknown",
|
|
430
|
+
limit: t,
|
|
431
|
+
currentValue: o.angle || 0,
|
|
432
|
+
urdfJoint: o
|
|
433
|
+
});
|
|
434
|
+
}), s.sort((w, o) => w.name.localeCompare(o.name));
|
|
435
|
+
}, J = (n, m) => {
|
|
436
|
+
const s = c.value.find((o) => o.name === n);
|
|
437
|
+
if (!s) return;
|
|
438
|
+
const w = parseFloat(m);
|
|
439
|
+
if (s.limit) {
|
|
440
|
+
const o = Math.max(s.limit.lower, Math.min(s.limit.upper, w));
|
|
441
|
+
s.currentValue = o;
|
|
442
|
+
} else
|
|
443
|
+
s.currentValue = w;
|
|
444
|
+
r.model && r.model.setJointValue ? r.model.setJointValue(n, s.currentValue) : s.urdfJoint && s.urdfJoint.setJointValue(s.currentValue);
|
|
445
|
+
}, G = (n) => n.reduce((m, s) => {
|
|
446
|
+
let w = 0;
|
|
447
|
+
const o = s.Y ?? 0, t = s.C ?? 0, y = s.R ?? 0;
|
|
448
|
+
return o > 0 && (w += o), t > 0 && y > 0 && (w += y * g(t)), m + w;
|
|
449
|
+
}, 0), j = (n) => {
|
|
450
|
+
const m = [], s = n.Y ?? 0, w = n.B ?? 0, o = n.C ?? 0, t = n.R ?? 0, y = {
|
|
451
|
+
pos: new x(0, 0, 0),
|
|
452
|
+
localY: new x(0, 1, 0),
|
|
453
|
+
localX: new x(1, 0, 0),
|
|
454
|
+
localZ: new x(0, 0, 1)
|
|
455
|
+
};
|
|
456
|
+
if (!s && !o) return m;
|
|
457
|
+
if (m.push(y.pos.clone()), w !== 0) {
|
|
458
|
+
const Y = new de().makeRotationAxis(y.localY, g(w));
|
|
459
|
+
y.localX.applyMatrix4(Y), y.localZ.applyMatrix4(Y);
|
|
460
|
+
}
|
|
461
|
+
if (s > 0 && (y.pos.add(y.localY.clone().multiplyScalar(s * pe)), m.push(y.pos.clone())), o > 0 && t > 0) {
|
|
462
|
+
const Y = g(o), $ = t * pe, ne = y.pos.clone().add(y.localX.clone().multiplyScalar(-$)), I = Math.max(16, Math.ceil(o / 5));
|
|
463
|
+
for (let P = 1; P <= I; P++) {
|
|
464
|
+
const Q = Y * P / I, oe = new de().makeRotationAxis(y.localZ, Q), ve = y.localX.clone().multiplyScalar($).applyMatrix4(oe), ge = ne.clone().add(ve);
|
|
465
|
+
m.push(ge);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return m;
|
|
469
|
+
}, Z = (n, m = 0) => {
|
|
470
|
+
let s = p.slice(0, n + 1);
|
|
471
|
+
const w = p[n + 1];
|
|
472
|
+
if (w && m > 0) {
|
|
473
|
+
const I = {
|
|
474
|
+
...w,
|
|
475
|
+
// 根据插值因子计算当前的弯曲角度C,实现从0到目标角度的平滑过渡
|
|
476
|
+
B: (w.B ?? 0) * m,
|
|
477
|
+
// 根据插值因子计算当前的弯曲角度C,实现从0到目标角度的平滑过渡
|
|
478
|
+
C: (w.C ?? 0) * m
|
|
479
|
+
};
|
|
480
|
+
s.push(I);
|
|
481
|
+
}
|
|
482
|
+
const o = G(s), t = Math.max(0, D.value - o), y = [];
|
|
483
|
+
y.push(new x(0, 0, 0));
|
|
484
|
+
const Y = new x(0, t * pe, 0);
|
|
485
|
+
t > 0 && y.push(Y);
|
|
486
|
+
let $ = {
|
|
487
|
+
pos: Y.clone(),
|
|
488
|
+
localY: new x(0, 1, 0),
|
|
489
|
+
localX: new x(1, 0, 0),
|
|
490
|
+
localZ: new x(0, 0, 1)
|
|
491
|
+
};
|
|
492
|
+
const ne = [];
|
|
493
|
+
for (let I = s.length - 1; I >= 0; I--) {
|
|
494
|
+
const P = s[I], Q = j(P);
|
|
495
|
+
if (Q.length > 0) {
|
|
496
|
+
const oe = Q.map((le) => {
|
|
497
|
+
const ue = le.clone(), Se = new de();
|
|
498
|
+
return Se.makeBasis($.localX, $.localY, $.localZ), ue.applyMatrix4(Se), ue.add($.pos);
|
|
499
|
+
});
|
|
500
|
+
ne.push(oe);
|
|
501
|
+
const ce = oe[oe.length - 1];
|
|
502
|
+
$.pos = ce.clone();
|
|
503
|
+
const ve = P.B ?? 0, ge = P.C ?? 0;
|
|
504
|
+
if (ve !== 0) {
|
|
505
|
+
const le = new de().makeRotationAxis($.localY, g(ve));
|
|
506
|
+
$.localX.applyMatrix4(le), $.localZ.applyMatrix4(le);
|
|
507
|
+
}
|
|
508
|
+
if (ge > 0) {
|
|
509
|
+
const le = g(ge), ue = new de().makeRotationAxis($.localZ, le);
|
|
510
|
+
$.localY.applyMatrix4(ue), $.localX.applyMatrix4(ue);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
for (const I of ne)
|
|
515
|
+
I.length > 1 && y.push(...I.slice(1));
|
|
516
|
+
y.length < 2 && y.push(new x(0, 1e-3, 0));
|
|
517
|
+
try {
|
|
518
|
+
const I = new it(y, !1, "catmullrom", 0.01), P = new rt(I, Math.max(2, y.length * 4), k.value * pe, 18, !1);
|
|
519
|
+
i.value.geometry.dispose(), i.value.geometry = P;
|
|
520
|
+
} catch (I) {
|
|
521
|
+
console.error("管件更新失败", I);
|
|
522
|
+
}
|
|
523
|
+
}, ee = (n, m, s = 1) => {
|
|
524
|
+
n && (Object.keys(n).forEach((w) => {
|
|
525
|
+
const o = n[w], t = c.value.find((y) => y.name === w);
|
|
526
|
+
t && (t.currentValue = o, r.model && r.model.setJointValue ? r.model.setJointValue(w, o) : t.urdfJoint && t.urdfJoint.setJointValue(o));
|
|
527
|
+
}), Z(m, s));
|
|
528
|
+
}, d = (n, m, s) => n + (m - n) * s, a = (n, m, s) => {
|
|
529
|
+
if (!n || !m) return n || m;
|
|
530
|
+
const w = {};
|
|
531
|
+
return Object.keys(n).forEach((o) => {
|
|
532
|
+
const t = n[o], y = m[o];
|
|
533
|
+
w[o] = d(t, y || t, s);
|
|
534
|
+
}), w;
|
|
535
|
+
}, E = () => {
|
|
536
|
+
if (p.length === 0) {
|
|
537
|
+
console.warn("没有动画数据");
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
U(), F.value = !0, T.value = !1, S.value = 0, l.value = 0, V();
|
|
541
|
+
}, V = () => {
|
|
542
|
+
if (!F.value || T.value) return;
|
|
543
|
+
const n = S.value;
|
|
544
|
+
if (n >= p.length - 1) {
|
|
545
|
+
const o = p[p.length - 1];
|
|
546
|
+
ee(o, p.length - 1, 1), W();
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const m = l.value / Ae, s = p[n], w = p[n + 1];
|
|
550
|
+
if (w) {
|
|
551
|
+
const o = a(s, w, m);
|
|
552
|
+
ee(o, n, m);
|
|
553
|
+
} else
|
|
554
|
+
ee(s, n);
|
|
555
|
+
l.value++, l.value > Ae && (l.value = 0, S.value++), C.value = setTimeout(V, u());
|
|
556
|
+
}, X = () => {
|
|
557
|
+
T.value = !0, C.value && (clearTimeout(C.value), C.value = null);
|
|
558
|
+
}, W = () => {
|
|
559
|
+
F.value = !1, T.value = !1, e.value = 1, C.value && (clearTimeout(C.value), C.value = null);
|
|
560
|
+
};
|
|
561
|
+
f({
|
|
562
|
+
startAnimation: E,
|
|
563
|
+
pauseAnimation: X,
|
|
564
|
+
stopAnimation: W,
|
|
565
|
+
resetAll: () => {
|
|
566
|
+
W(), S.value = 0, l.value = 0, c.value.forEach((n) => {
|
|
567
|
+
(n.type === "revolute" || n.type === "prismatic") && J(n.name, 0);
|
|
568
|
+
}), Z(-1, 0);
|
|
569
|
+
},
|
|
570
|
+
fastForward: () => {
|
|
571
|
+
e.value < 4 && (e.value = Math.min(4, e.value * 2));
|
|
572
|
+
},
|
|
573
|
+
fastBackward: () => {
|
|
574
|
+
e.value > 0.25 && (e.value = Math.max(0.25, e.value / 2));
|
|
575
|
+
}
|
|
576
|
+
}), Pe(
|
|
577
|
+
() => r.model,
|
|
578
|
+
(n) => {
|
|
579
|
+
n ? (v.value = n, c.value = R(n)) : c.value = [];
|
|
580
|
+
},
|
|
581
|
+
{ immediate: !0 }
|
|
582
|
+
);
|
|
583
|
+
const re = () => {
|
|
584
|
+
!r.model || F.value && !T.value || c.value.forEach((n) => {
|
|
585
|
+
n.urdfJoint && n.urdfJoint.angle !== void 0 && (n.currentValue = n.urdfJoint.angle);
|
|
586
|
+
});
|
|
587
|
+
}, fe = () => {
|
|
588
|
+
const n = () => {
|
|
589
|
+
re(), M.value = requestAnimationFrame(n);
|
|
590
|
+
};
|
|
591
|
+
n();
|
|
592
|
+
}, Ce = () => {
|
|
593
|
+
M.value && (cancelAnimationFrame(M.value), M.value = null);
|
|
594
|
+
};
|
|
595
|
+
return $e(() => {
|
|
596
|
+
fe();
|
|
597
|
+
}), je(() => {
|
|
598
|
+
Ce(), W();
|
|
599
|
+
}), (n, m) => (H(), q("div", wt, [
|
|
600
|
+
c.value.length > 0 ? (H(), q("div", xt, [
|
|
601
|
+
(H(!0), q(Xe, null, He(c.value, (s) => {
|
|
602
|
+
var w, o, t, y;
|
|
603
|
+
return H(), q("div", {
|
|
604
|
+
key: s.name,
|
|
605
|
+
class: "joint-item"
|
|
606
|
+
}, [
|
|
607
|
+
h("div", Mt, [
|
|
608
|
+
h("div", Pt, [
|
|
609
|
+
h("span", bt, ae(s.name), 1),
|
|
610
|
+
h("span", Ct, " [" + ae(((w = s.limit) == null ? void 0 : w.lower.toFixed(2)) ?? (s.type === "revolute" ? "-3.14" : "-1.00")) + ", " + ae(((o = s.limit) == null ? void 0 : o.upper.toFixed(2)) ?? (s.type === "revolute" ? "3.14" : "1.00")) + "] ", 1)
|
|
611
|
+
]),
|
|
612
|
+
h("span", kt, ae(s.type), 1)
|
|
613
|
+
]),
|
|
614
|
+
s.type === "revolute" || s.type === "prismatic" ? (H(), q("div", zt, [
|
|
615
|
+
h("div", _t, [
|
|
616
|
+
h("input", {
|
|
617
|
+
type: "range",
|
|
618
|
+
min: ((t = s.limit) == null ? void 0 : t.lower) ?? (s.type === "revolute" ? -Math.PI : -1),
|
|
619
|
+
max: ((y = s.limit) == null ? void 0 : y.upper) ?? (s.type === "revolute" ? Math.PI : 1),
|
|
620
|
+
step: 0.01,
|
|
621
|
+
value: s.currentValue,
|
|
622
|
+
onInput: (Y) => J(s.name, Y.target.value),
|
|
623
|
+
class: "joint-slider",
|
|
624
|
+
disabled: F.value && !T.value
|
|
625
|
+
}, null, 40, At)
|
|
626
|
+
]),
|
|
627
|
+
h("div", Dt, [
|
|
628
|
+
h("span", St, ae(s.currentValue ? Number(s.currentValue).toFixed(3) : "0.000"), 1),
|
|
629
|
+
h("span", Et, ae(s.type === "revolute" ? "rad" : "m"), 1)
|
|
630
|
+
])
|
|
631
|
+
])) : xe("", !0)
|
|
632
|
+
]);
|
|
633
|
+
}), 128))
|
|
634
|
+
])) : (H(), q("div", Ft, [...m[0] || (m[0] = [
|
|
635
|
+
h("p", null, "未检测到可控制的关节", -1)
|
|
636
|
+
])]))
|
|
637
|
+
]));
|
|
638
|
+
}
|
|
639
|
+
}, Vt = /* @__PURE__ */ me(Tt, [["__scopeId", "data-v-bcf4fa92"]]), Rt = { class: "panel-content" }, It = "id", Lt = {
|
|
640
|
+
__name: "urdfTree",
|
|
641
|
+
props: {
|
|
642
|
+
model: Object,
|
|
643
|
+
maxExpandCount: {
|
|
644
|
+
type: Number,
|
|
645
|
+
default: 10
|
|
646
|
+
},
|
|
647
|
+
expandStrategy: {
|
|
648
|
+
type: String,
|
|
649
|
+
default: "breadth",
|
|
650
|
+
validator: (A) => ["breadth", "firstLevel"].includes(A)
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
emits: ["nodeClick"],
|
|
654
|
+
setup(A, { emit: f }) {
|
|
655
|
+
const r = A, c = f, v = b([]), M = {
|
|
656
|
+
children: "children",
|
|
657
|
+
label: "label"
|
|
658
|
+
}, k = (l) => {
|
|
659
|
+
c("nodeClick", l);
|
|
660
|
+
}, i = (l, C = 0) => {
|
|
661
|
+
const g = [];
|
|
662
|
+
return Array.isArray(l) && (l == null ? void 0 : l.length) > 0 && l.forEach((e) => {
|
|
663
|
+
if (!(e != null && e.isMesh) && ((e == null ? void 0 : e.type) === "URDFJoint" || (e == null ? void 0 : e.type) === "URDFLink")) {
|
|
664
|
+
const u = {
|
|
665
|
+
name: e == null ? void 0 : e.name,
|
|
666
|
+
label: e == null ? void 0 : e.name,
|
|
667
|
+
show: !0,
|
|
668
|
+
level: C + 1,
|
|
669
|
+
isPenultimate: !1,
|
|
670
|
+
type: e == null ? void 0 : e.type,
|
|
671
|
+
id: e == null ? void 0 : e.id,
|
|
672
|
+
limit: (e == null ? void 0 : e.limit) ?? "",
|
|
673
|
+
children: i(e == null ? void 0 : e.children, C + 1),
|
|
674
|
+
path: e == null ? void 0 : e.name
|
|
675
|
+
};
|
|
676
|
+
g.push(u);
|
|
677
|
+
}
|
|
678
|
+
}), g;
|
|
679
|
+
}, D = (l) => l ? [{
|
|
680
|
+
name: l == null ? void 0 : l.name,
|
|
681
|
+
label: l == null ? void 0 : l.name,
|
|
682
|
+
show: !0,
|
|
683
|
+
level: 1,
|
|
684
|
+
isPenultimate: !1,
|
|
685
|
+
type: l == null ? void 0 : l.type,
|
|
686
|
+
id: l == null ? void 0 : l.id,
|
|
687
|
+
limit: (l == null ? void 0 : l.limit) ?? "",
|
|
688
|
+
children: i(l == null ? void 0 : l.children, 1),
|
|
689
|
+
path: l == null ? void 0 : l.name
|
|
690
|
+
}] : [], L = (l, C) => {
|
|
691
|
+
const g = [], e = [...l];
|
|
692
|
+
for (; e.length > 0 && g.length < C; ) {
|
|
693
|
+
const u = e.shift();
|
|
694
|
+
u.children && u.children.length > 0 && (g.push(u.id), e.push(...u.children));
|
|
695
|
+
}
|
|
696
|
+
return g;
|
|
697
|
+
}, F = (l, C) => {
|
|
698
|
+
const g = [];
|
|
699
|
+
return l.forEach((e) => {
|
|
700
|
+
if (e.children && e.children.length > 0) {
|
|
701
|
+
g.push(e.id);
|
|
702
|
+
const u = e.children.filter((p) => p.children && p.children.length > 0).slice(0, C).map((p) => p.id);
|
|
703
|
+
g.push(...u);
|
|
704
|
+
}
|
|
705
|
+
}), g.slice(0, C + 1);
|
|
706
|
+
}, T = ie(() => !v.value || v.value.length === 0 ? [] : r.expandStrategy === "firstLevel" ? F(v.value, r.maxExpandCount) : L(v.value, r.maxExpandCount)), S = ie(() => r != null && r.model ? D(r.model) : []);
|
|
707
|
+
return Pe(
|
|
708
|
+
S,
|
|
709
|
+
(l) => {
|
|
710
|
+
v.value = JSON.parse(JSON.stringify(l));
|
|
711
|
+
},
|
|
712
|
+
{ immediate: !0 }
|
|
713
|
+
), (l, C) => {
|
|
714
|
+
const g = Je("el-tree");
|
|
715
|
+
return H(), q("div", Rt, [
|
|
716
|
+
z(g, {
|
|
717
|
+
data: v.value,
|
|
718
|
+
props: M,
|
|
719
|
+
"default-expanded-keys": T.value,
|
|
720
|
+
"node-key": It,
|
|
721
|
+
onNodeClick: k
|
|
722
|
+
}, null, 8, ["data", "default-expanded-keys"])
|
|
723
|
+
]);
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
}, $t = /* @__PURE__ */ me(Lt, [["__scopeId", "data-v-290ff4e1"]]), Jt = ["xlink:href"], Ot = /* @__PURE__ */ Ye({
|
|
727
|
+
__name: "svgIcon",
|
|
728
|
+
props: {
|
|
729
|
+
backgroundColor: { default: "#f0f0f0" },
|
|
730
|
+
prefix: { default: "icon" },
|
|
731
|
+
name: {},
|
|
732
|
+
size: { default: 16 },
|
|
733
|
+
spin: { type: Boolean, default: !1 },
|
|
734
|
+
active: { type: Boolean, default: !1 }
|
|
735
|
+
},
|
|
736
|
+
setup(A) {
|
|
737
|
+
const f = A, r = ie(
|
|
738
|
+
() => ({
|
|
739
|
+
backgroundColor: f.backgroundColor
|
|
740
|
+
})
|
|
741
|
+
), c = ie(() => `#${f.prefix}-${f.name}`), v = ie(() => {
|
|
742
|
+
const { size: M } = f;
|
|
743
|
+
let k = `${M}`;
|
|
744
|
+
return k = `${k.replace("px", "")}px`, {
|
|
745
|
+
width: k,
|
|
746
|
+
height: k
|
|
747
|
+
};
|
|
748
|
+
});
|
|
749
|
+
return (M, k) => (H(), q("div", {
|
|
750
|
+
class: Fe(["container", { active: A.active }]),
|
|
751
|
+
style: Ee(r.value)
|
|
752
|
+
}, [
|
|
753
|
+
(H(), q("svg", {
|
|
754
|
+
class: Fe(["svg-icon", [M.$attrs.class, A.spin && "svg-icon-spin"]]),
|
|
755
|
+
style: Ee(v.value),
|
|
756
|
+
"aria-hidden": "true"
|
|
757
|
+
}, [
|
|
758
|
+
h("use", { "xlink:href": c.value }, null, 8, Jt)
|
|
759
|
+
], 6))
|
|
760
|
+
], 6));
|
|
761
|
+
}
|
|
762
|
+
}), B = /* @__PURE__ */ me(Ot, [["__scopeId", "data-v-3150a90b"]]), Ut = { class: "obj-viewer-container" }, Gt = { class: "buttonGroup-top" }, jt = { class: "buttonGroup-topLeft" }, Xt = { class: "buttonGroup-left" }, Ht = { class: "buttonGroup-right" }, Yt = { class: "buttonGroup-bottom" }, qt = { class: "left-panel" }, Zt = { class: "panel-header" }, Wt = {
|
|
763
|
+
key: 1,
|
|
764
|
+
class: "clipping-content"
|
|
765
|
+
}, Kt = { class: "radio-group" }, Nt = { class: "radio-label" }, Qt = { class: "radio-label" }, en = { class: "radio-label" }, tn = { class: "radio-label" }, nn = { class: "right-panel" }, an = { class: "panel-header" }, on = {
|
|
766
|
+
key: 0,
|
|
767
|
+
class: "loading-overlay"
|
|
768
|
+
}, sn = {
|
|
769
|
+
__name: "threeModel",
|
|
770
|
+
props: {
|
|
771
|
+
animationData: {
|
|
772
|
+
type: Object,
|
|
773
|
+
default: () => {
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
},
|
|
777
|
+
emits: ["getAnimationData"],
|
|
778
|
+
setup(A, { expose: f, emit: r }) {
|
|
779
|
+
const c = r;
|
|
780
|
+
let v = null, M = !1;
|
|
781
|
+
const k = b(null), i = b(!1), D = b("");
|
|
782
|
+
b(!1);
|
|
783
|
+
const L = b(!1), F = b(!1), T = b(""), S = b(!1), l = b(""), C = b(), {
|
|
784
|
+
currentModels: g,
|
|
785
|
+
initialCameraPosition: e,
|
|
786
|
+
initialTargetPosition: u,
|
|
787
|
+
initThreeJS: p,
|
|
788
|
+
handleResize: _,
|
|
789
|
+
fitCameraToAllModels: U,
|
|
790
|
+
getThreeJSObjects: R,
|
|
791
|
+
clearAllModels: J,
|
|
792
|
+
cleanup: G
|
|
793
|
+
} = mt(k), { isAnimating: j, toggleAnimation: Z, stopAnimation: ee } = ft(R, g), { isClipping: d, activeClippingAxis: a, toggleClipping: E, updateClippingPlanes: V } = vt(
|
|
794
|
+
R,
|
|
795
|
+
g
|
|
796
|
+
), { addModelsFromUrls: X, loadModelByDefaultPath: W, urdfModel: K, modelBoundingBoxes: N } = pt(
|
|
797
|
+
R,
|
|
798
|
+
g,
|
|
799
|
+
i,
|
|
800
|
+
D,
|
|
801
|
+
J
|
|
802
|
+
), te = () => {
|
|
803
|
+
if (L.value || g.value.length === 0) return;
|
|
804
|
+
L.value = !0, j.value && ee();
|
|
805
|
+
const { camera: o, controls: t } = R();
|
|
806
|
+
if (!o || !t) return;
|
|
807
|
+
t.enabled = !0;
|
|
808
|
+
const y = (Q) => Q < 0.5 ? 4 * Q * Q * Q : 1 - Math.pow(-2 * Q + 2, 3) / 2, Y = o.position.clone(), $ = t.target.clone(), ne = 1500, I = Date.now(), P = () => {
|
|
809
|
+
const Q = Date.now() - I, oe = Math.min(Q / ne, 1), ce = y(oe);
|
|
810
|
+
o.position.lerpVectors(Y, e.value, ce), t.target.lerpVectors($, u.value, ce), oe < 1 ? requestAnimationFrame(P) : L.value = !1;
|
|
811
|
+
};
|
|
812
|
+
P();
|
|
813
|
+
}, re = async () => M ? Promise.resolve() : new Promise((o) => {
|
|
814
|
+
const t = () => {
|
|
815
|
+
M ? o() : requestAnimationFrame(t);
|
|
816
|
+
};
|
|
817
|
+
t();
|
|
818
|
+
}), fe = async (o, t) => {
|
|
819
|
+
try {
|
|
820
|
+
await re(), j.value && ee(), d.value && E();
|
|
821
|
+
const y = await t(o);
|
|
822
|
+
return U(N), y;
|
|
823
|
+
} catch (y) {
|
|
824
|
+
throw console.error("加载模型失败:", y), y;
|
|
825
|
+
}
|
|
826
|
+
}, Ce = async (o) => fe(o, X), n = async (o) => fe(o, W), m = (o) => {
|
|
827
|
+
F.value = !0, T.value = o, o === "剖面视图" && !d.value && E();
|
|
828
|
+
}, s = (o) => {
|
|
829
|
+
S.value = !0, l.value = o, o === "动画仿真" && c("getAnimationData");
|
|
830
|
+
}, w = () => {
|
|
831
|
+
Be(() => {
|
|
832
|
+
var o;
|
|
833
|
+
(o = C.value) == null || o.startAnimation();
|
|
834
|
+
});
|
|
835
|
+
};
|
|
836
|
+
return $e(async () => {
|
|
837
|
+
await Be();
|
|
838
|
+
try {
|
|
839
|
+
p(), v = R().scene, M = !0, window.addEventListener("resize", _);
|
|
840
|
+
} catch (o) {
|
|
841
|
+
console.error("Three.js初始化失败:", o);
|
|
842
|
+
}
|
|
843
|
+
}), qe(() => {
|
|
844
|
+
M = !1, T.value = "", l.value = "", window.removeEventListener("resize", _), j.value && ee(), G();
|
|
845
|
+
}), f({
|
|
846
|
+
addModelsFromUrls: Ce,
|
|
847
|
+
loadModelByDefaultPath: n
|
|
848
|
+
}), (o, t) => {
|
|
849
|
+
var Y, $, ne, I;
|
|
850
|
+
const y = Je("el-scrollbar");
|
|
851
|
+
return H(), q("div", Ut, [
|
|
852
|
+
h("div", {
|
|
853
|
+
ref_key: "threejsContainer",
|
|
854
|
+
ref: k,
|
|
855
|
+
class: "threejs-container"
|
|
856
|
+
}, null, 512),
|
|
857
|
+
h("div", Gt, [
|
|
858
|
+
z(B, {
|
|
859
|
+
name: "guanjianjiexi",
|
|
860
|
+
size: "34"
|
|
861
|
+
}),
|
|
862
|
+
z(B, {
|
|
863
|
+
name: "guanjiekongzhi",
|
|
864
|
+
size: "34"
|
|
865
|
+
}),
|
|
866
|
+
z(B, {
|
|
867
|
+
name: "gongyishengcheng",
|
|
868
|
+
size: "34"
|
|
869
|
+
}),
|
|
870
|
+
z(B, {
|
|
871
|
+
name: "buchangshezhi",
|
|
872
|
+
size: "34"
|
|
873
|
+
}),
|
|
874
|
+
z(B, {
|
|
875
|
+
name: "shuchujiagongchengxu",
|
|
876
|
+
size: "34"
|
|
877
|
+
})
|
|
878
|
+
]),
|
|
879
|
+
h("div", jt, [
|
|
880
|
+
z(B, {
|
|
881
|
+
name: "viewReset",
|
|
882
|
+
size: "24",
|
|
883
|
+
onClick: te,
|
|
884
|
+
title: "重置"
|
|
885
|
+
}),
|
|
886
|
+
z(B, {
|
|
887
|
+
name: "fangda",
|
|
888
|
+
size: "24",
|
|
889
|
+
title: "放大"
|
|
890
|
+
}),
|
|
891
|
+
z(B, {
|
|
892
|
+
name: "suoxiao",
|
|
893
|
+
size: "24",
|
|
894
|
+
title: "缩小"
|
|
895
|
+
}),
|
|
896
|
+
z(B, {
|
|
897
|
+
name: "lookAround",
|
|
898
|
+
size: "24",
|
|
899
|
+
onClick: O(Z),
|
|
900
|
+
title: O(j) ? "停止动画" : "动画视图"
|
|
901
|
+
}, null, 8, ["onClick", "title"])
|
|
902
|
+
]),
|
|
903
|
+
h("div", Xt, [
|
|
904
|
+
z(B, {
|
|
905
|
+
name: "jiegoushu",
|
|
906
|
+
size: "24",
|
|
907
|
+
onClick: t[0] || (t[0] = (P) => m("场景树")),
|
|
908
|
+
active: F.value && T.value === "场景树",
|
|
909
|
+
title: "场景树"
|
|
910
|
+
}, null, 8, ["active"]),
|
|
911
|
+
z(B, {
|
|
912
|
+
name: "clipping",
|
|
913
|
+
size: "24",
|
|
914
|
+
onClick: t[1] || (t[1] = (P) => m("剖面视图")),
|
|
915
|
+
active: F.value && T.value === "剖面视图",
|
|
916
|
+
title: "剖面视图"
|
|
917
|
+
}, null, 8, ["active"]),
|
|
918
|
+
z(B, {
|
|
919
|
+
name: "donghuafangzhen",
|
|
920
|
+
size: "24",
|
|
921
|
+
onClick: t[2] || (t[2] = (P) => m("场景树3"))
|
|
922
|
+
}),
|
|
923
|
+
z(B, {
|
|
924
|
+
name: "donghuafangzhen",
|
|
925
|
+
size: "24",
|
|
926
|
+
onClick: t[3] || (t[3] = (P) => m("场景4"))
|
|
927
|
+
})
|
|
928
|
+
]),
|
|
929
|
+
h("div", Ht, [
|
|
930
|
+
z(B, {
|
|
931
|
+
name: "donghuafangzhen",
|
|
932
|
+
size: "24"
|
|
933
|
+
}),
|
|
934
|
+
z(B, {
|
|
935
|
+
name: "donghuafangzhen",
|
|
936
|
+
size: "24"
|
|
937
|
+
}),
|
|
938
|
+
z(B, {
|
|
939
|
+
name: "guanjiekongzhi",
|
|
940
|
+
size: "24",
|
|
941
|
+
onClick: t[4] || (t[4] = (P) => s("关节控制")),
|
|
942
|
+
active: S.value && l.value === "关节控制",
|
|
943
|
+
title: "关节控制"
|
|
944
|
+
}, null, 8, ["active"]),
|
|
945
|
+
z(B, {
|
|
946
|
+
name: "donghuafangzhen",
|
|
947
|
+
size: "24",
|
|
948
|
+
title: "动画仿真",
|
|
949
|
+
onClick: t[5] || (t[5] = (P) => s("动画仿真")),
|
|
950
|
+
active: S.value && l.value === "动画仿真"
|
|
951
|
+
}, null, 8, ["active"]),
|
|
952
|
+
z(B, {
|
|
953
|
+
name: "donghuafangzhen",
|
|
954
|
+
size: "24"
|
|
955
|
+
}),
|
|
956
|
+
z(B, {
|
|
957
|
+
name: "donghuafangzhen",
|
|
958
|
+
size: "24"
|
|
959
|
+
})
|
|
960
|
+
]),
|
|
961
|
+
h("div", Yt, [
|
|
962
|
+
z(B, {
|
|
963
|
+
name: "kuaitui",
|
|
964
|
+
size: "24",
|
|
965
|
+
backgroundColor: "#ffffff",
|
|
966
|
+
title: "快退",
|
|
967
|
+
onClick: (Y = C.value) == null ? void 0 : Y.fastBackward
|
|
968
|
+
}, null, 8, ["onClick"]),
|
|
969
|
+
z(B, {
|
|
970
|
+
name: "bofang",
|
|
971
|
+
size: "24",
|
|
972
|
+
backgroundColor: "#ffffff",
|
|
973
|
+
title: "播放",
|
|
974
|
+
onClick: w
|
|
975
|
+
}),
|
|
976
|
+
z(B, {
|
|
977
|
+
name: "kuaijin",
|
|
978
|
+
size: "24",
|
|
979
|
+
backgroundColor: "#ffffff",
|
|
980
|
+
title: "快进",
|
|
981
|
+
onClick: ($ = C.value) == null ? void 0 : $.fastForward
|
|
982
|
+
}, null, 8, ["onClick"]),
|
|
983
|
+
z(B, {
|
|
984
|
+
name: "zanting",
|
|
985
|
+
size: "24",
|
|
986
|
+
backgroundColor: "#ffffff",
|
|
987
|
+
title: "暂停",
|
|
988
|
+
onClick: (ne = C.value) == null ? void 0 : ne.pauseAnimation
|
|
989
|
+
}, null, 8, ["onClick"]),
|
|
990
|
+
z(B, {
|
|
991
|
+
name: "zhongzhi",
|
|
992
|
+
size: "24",
|
|
993
|
+
backgroundColor: "#ffffff",
|
|
994
|
+
title: "停止",
|
|
995
|
+
onClick: (I = C.value) == null ? void 0 : I.resetAll
|
|
996
|
+
}, null, 8, ["onClick"])
|
|
997
|
+
]),
|
|
998
|
+
se(h("div", qt, [
|
|
999
|
+
h("div", Zt, [
|
|
1000
|
+
h("span", null, ae(T.value), 1),
|
|
1001
|
+
h("span", {
|
|
1002
|
+
class: "close",
|
|
1003
|
+
onClick: t[6] || (t[6] = (P) => F.value = !1)
|
|
1004
|
+
}, " X ")
|
|
1005
|
+
]),
|
|
1006
|
+
z(y, { "max-height": "650px" }, {
|
|
1007
|
+
default: Te(() => [
|
|
1008
|
+
T.value === "场景树" ? (H(), Le($t, {
|
|
1009
|
+
key: 0,
|
|
1010
|
+
model: O(K)
|
|
1011
|
+
}, null, 8, ["model"])) : xe("", !0),
|
|
1012
|
+
T.value === "剖面视图" ? (H(), q("div", Wt, [
|
|
1013
|
+
h("div", Kt, [
|
|
1014
|
+
h("label", Nt, [
|
|
1015
|
+
se(h("input", {
|
|
1016
|
+
type: "radio",
|
|
1017
|
+
name: "clipping-axis",
|
|
1018
|
+
value: "none",
|
|
1019
|
+
"onUpdate:modelValue": t[7] || (t[7] = (P) => he(a) ? a.value = P : null),
|
|
1020
|
+
onChange: t[8] || (t[8] = (...P) => O(V) && O(V)(...P))
|
|
1021
|
+
}, null, 544), [
|
|
1022
|
+
[ye, O(a)]
|
|
1023
|
+
]),
|
|
1024
|
+
t[16] || (t[16] = h("span", { class: "radio-text" }, "无切割", -1))
|
|
1025
|
+
]),
|
|
1026
|
+
h("label", Qt, [
|
|
1027
|
+
se(h("input", {
|
|
1028
|
+
type: "radio",
|
|
1029
|
+
name: "clipping-axis",
|
|
1030
|
+
value: "x",
|
|
1031
|
+
"onUpdate:modelValue": t[9] || (t[9] = (P) => he(a) ? a.value = P : null),
|
|
1032
|
+
onChange: t[10] || (t[10] = (...P) => O(V) && O(V)(...P))
|
|
1033
|
+
}, null, 544), [
|
|
1034
|
+
[ye, O(a)]
|
|
1035
|
+
]),
|
|
1036
|
+
t[17] || (t[17] = h("span", { class: "radio-text" }, "X轴切割", -1))
|
|
1037
|
+
]),
|
|
1038
|
+
h("label", en, [
|
|
1039
|
+
se(h("input", {
|
|
1040
|
+
type: "radio",
|
|
1041
|
+
name: "clipping-axis",
|
|
1042
|
+
value: "y",
|
|
1043
|
+
"onUpdate:modelValue": t[11] || (t[11] = (P) => he(a) ? a.value = P : null),
|
|
1044
|
+
onChange: t[12] || (t[12] = (...P) => O(V) && O(V)(...P))
|
|
1045
|
+
}, null, 544), [
|
|
1046
|
+
[ye, O(a)]
|
|
1047
|
+
]),
|
|
1048
|
+
t[18] || (t[18] = h("span", { class: "radio-text" }, "Y轴切割", -1))
|
|
1049
|
+
]),
|
|
1050
|
+
h("label", tn, [
|
|
1051
|
+
se(h("input", {
|
|
1052
|
+
type: "radio",
|
|
1053
|
+
name: "clipping-axis",
|
|
1054
|
+
value: "z",
|
|
1055
|
+
"onUpdate:modelValue": t[13] || (t[13] = (P) => he(a) ? a.value = P : null),
|
|
1056
|
+
onChange: t[14] || (t[14] = (...P) => O(V) && O(V)(...P))
|
|
1057
|
+
}, null, 544), [
|
|
1058
|
+
[ye, O(a)]
|
|
1059
|
+
]),
|
|
1060
|
+
t[19] || (t[19] = h("span", { class: "radio-text" }, "Z轴切割", -1))
|
|
1061
|
+
])
|
|
1062
|
+
])
|
|
1063
|
+
])) : xe("", !0)
|
|
1064
|
+
]),
|
|
1065
|
+
_: 1
|
|
1066
|
+
})
|
|
1067
|
+
], 512), [
|
|
1068
|
+
[we, F.value]
|
|
1069
|
+
]),
|
|
1070
|
+
se(h("div", nn, [
|
|
1071
|
+
h("div", an, [
|
|
1072
|
+
h("span", null, ae(l.value), 1),
|
|
1073
|
+
h("span", {
|
|
1074
|
+
class: "close",
|
|
1075
|
+
onClick: t[15] || (t[15] = (P) => S.value = !1)
|
|
1076
|
+
}, " X ")
|
|
1077
|
+
]),
|
|
1078
|
+
z(y, { "max-height": "650px" }, {
|
|
1079
|
+
default: Te(() => [
|
|
1080
|
+
se(z(Vt, {
|
|
1081
|
+
ref_key: "jointRef",
|
|
1082
|
+
ref: C,
|
|
1083
|
+
model: O(K),
|
|
1084
|
+
scene: O(v),
|
|
1085
|
+
animationData: A.animationData
|
|
1086
|
+
}, null, 8, ["model", "scene", "animationData"]), [
|
|
1087
|
+
[we, l.value === "关节控制"]
|
|
1088
|
+
]),
|
|
1089
|
+
se(z(yt, { animationData: A.animationData }, null, 8, ["animationData"]), [
|
|
1090
|
+
[we, l.value === "动画仿真"]
|
|
1091
|
+
])
|
|
1092
|
+
]),
|
|
1093
|
+
_: 1
|
|
1094
|
+
})
|
|
1095
|
+
], 512), [
|
|
1096
|
+
[we, S.value]
|
|
1097
|
+
]),
|
|
1098
|
+
i.value ? (H(), q("div", on, [
|
|
1099
|
+
t[20] || (t[20] = h("div", { class: "loading-spinner" }, null, -1)),
|
|
1100
|
+
h("p", null, ae(D.value), 1)
|
|
1101
|
+
])) : xe("", !0)
|
|
1102
|
+
]);
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
}, fn = /* @__PURE__ */ me(sn, [["__scopeId", "data-v-eb64b36c"]]);
|
|
1106
|
+
export {
|
|
1107
|
+
fn as default
|
|
1108
|
+
};
|