ss-component-new 1.3.21 → 1.3.23
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-YtHulNzU.cjs → MTLLoader-C_XCtjSi.cjs} +1 -1
- package/dist/{MTLLoader-CBRDqlja.js → MTLLoader-YR-bfx1D.js} +24 -24
- package/dist/{OrbitControls-CKR1ruPg.js → OrbitControls-BGsXD_A7.js} +1 -1
- package/dist/{OrbitControls-Bwzpfq8_.cjs → OrbitControls-CktvE4iE.cjs} +1 -1
- package/dist/{URDFLoader-DIvTWPgk.cjs → URDFLoader-10oVp_KW.cjs} +1 -1
- package/dist/{URDFLoader-D-0fnLWu.js → URDFLoader-m1gMdnSQ.js} +189 -189
- package/dist/{animationData-BBVNOO1d.js → animationData-CpK8d_Vm.js} +19 -19
- package/dist/{animationData-krmt7b15.cjs → animationData-Cr2ra7rm.cjs} +1 -1
- package/dist/{array-AvrqnNoJ.js → array-BmfCVZvi.js} +46 -46
- package/dist/{array-CMW4ey7w.cjs → array-COho2hZW.cjs} +1 -1
- package/dist/{iconfont-CSj9Ypb0.js → iconfont-0yJB130V.js} +29 -29
- package/dist/{iconfont-CUPzGSlt.cjs → iconfont-DsF7kuG5.cjs} +1 -1
- package/dist/{index-VF71yUkZ.js → index-5YbplPvi.js} +2 -2
- package/dist/{index-I09e-7nF.js → index-76YbJdM8.js} +2 -2
- package/dist/{index-BWb8IVmh.js → index-98Ogvz1v.js} +7 -7
- package/dist/{index-B7VKjUP4.cjs → index-B4LIBl-a.cjs} +1 -1
- package/dist/{index-NB4ig2Zg.js → index-B52TVCSg.js} +8 -8
- package/dist/{index-B1Zztqcr.cjs → index-BEBJWYp0.cjs} +1 -1
- package/dist/{index-Dx5UzB8t.js → index-BHjvJiFA.js} +5 -5
- package/dist/{index-BLxE_tkf.cjs → index-BJPBBWWH.cjs} +1 -1
- package/dist/{index-DEF8zy07.js → index-BLcFvu4u.js} +3 -3
- package/dist/{index-BPstNH4r.cjs → index-BPlHuTxE.cjs} +4 -4
- package/dist/index-BPu9kWR3.js +11883 -0
- package/dist/{index-snyYrfwK.cjs → index-BRJ1_Tfi.cjs} +1 -1
- package/dist/{index-vCTVD7cV.cjs → index-BWCv7zxy.cjs} +1 -1
- package/dist/{index-DWfxnemZ.js → index-BXUByyre.js} +2 -2
- package/dist/{index-DUt_5IeJ.js → index-Bnp6YMyE.js} +1461 -1455
- package/dist/{index-CGrJyKvT.cjs → index-BxMPyw-Y.cjs} +1 -1
- package/dist/{index-DWm4nu2G.cjs → index-CBqGrYej.cjs} +1 -1
- package/dist/{index-Dm67w52u.cjs → index-CC9drriV.cjs} +1 -1
- package/dist/{index-sMsCzNtW.js → index-COQpDVsv.js} +1570 -1535
- package/dist/{index-C4Ohl9vT.js → index-CRbfwrdV.js} +41 -41
- package/dist/{index-CuvQZsbE.cjs → index-CVXrjDFh.cjs} +1 -1
- package/dist/{index-CEzEaG0d.js → index-CXiOVgoz.js} +1 -1
- package/dist/{index-BzGHYxs2.cjs → index-CbBY3TG6.cjs} +1 -1
- package/dist/{index-DuGfBNM6.cjs → index-CgFSiyRX.cjs} +1 -1
- package/dist/{index-Cu-8pzHm.js → index-Chxt6xBv.js} +5 -5
- package/dist/{index-CIrXKpNl.cjs → index-Cjqg29ul.cjs} +1 -1
- package/dist/index-CpbBe_mV.cjs +1 -0
- package/dist/index-CuAHwR97.cjs +1 -0
- package/dist/{index-DHrb-D39.js → index-D-kqGA71.js} +7 -7
- package/dist/{index-euZWOilV.cjs → index-D3ixok8t.cjs} +1 -1
- package/dist/{index-D39AtL48.js → index-D8HD14bz.js} +1 -1
- package/dist/{index-DABBYx7H.js → index-DBh5Z73C.js} +1 -1
- package/dist/index-DIWralYr.js +67 -0
- package/dist/{index-C8fMwErX.cjs → index-DRTxe12U.cjs} +13 -13
- package/dist/{index-BFKUrR1o.cjs → index-DS-YTop9.cjs} +1 -1
- package/dist/{index-Cw4Pm2PQ.cjs → index-DU9e5EhS.cjs} +1 -1
- package/dist/{index-DN2waPoj.cjs → index-D_Yhv_HV.cjs} +1 -1
- package/dist/{index-d6tZBTSp.cjs → index-DaIE9uY1.cjs} +1 -1
- package/dist/{index-BT6DSXQW.js → index-Ddoq7kRQ.js} +9 -9
- package/dist/{index-CZKslfuq.js → index-Du1HuKYs.js} +2 -2
- package/dist/{index-Cxl9cpua.js → index-HgbCIoqo.js} +2 -2
- package/dist/index-MK7NdOmS.cjs +1 -0
- package/dist/{index-C7WQ1ky5.js → index-NaWMtdUV.js} +2 -2
- package/dist/{index-DTttfGgm.js → index-OX4hSXv6.js} +7 -7
- package/dist/{index-DXiGkaWi.cjs → index-TMUwtzAm.cjs} +1 -1
- package/dist/{index-DGRL8SEt.js → index-Va8AOLWi.js} +1 -1
- package/dist/{index-Bjsm8c8q.cjs → index-c4SVf22I.cjs} +1 -1
- package/dist/{index-CppJQDiT.js → index-gfdgTjvQ.js} +3 -3
- package/dist/{index-CEq2QX9L.js → index-nr6V1FzX.js} +7 -7
- package/dist/{index-ovqPs7X7.cjs → index-oMihgN5x.cjs} +1 -1
- package/dist/{index-DTuVgYze.cjs → index-r6HP72OA.cjs} +1 -1
- package/dist/{index-CBtxzh-u.js → index-tVVurbFz.js} +3 -3
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-n7J00Lcz.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-1pEFQ04s.js} +29074 -28413
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-b_9vxv2X.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-ZMwIbmlN.cjs} +392 -382
- package/dist/{index.vue_vue_type_style_index_1_lang-DDedRKQj.cjs → index.vue_vue_type_style_index_1_lang--4T7j9qz.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-q8rMzh6x.js → index.vue_vue_type_style_index_1_lang-CNh42_ZH.js} +75 -75
- package/dist/{main-CmrBxQsF.cjs → main-BH4e9Of0.cjs} +1 -1
- package/dist/{main-ZLB6NnLd.js → main-DU0KTY9Z.js} +4 -4
- package/dist/{menuIndex-8RF_0N_y.cjs → menuIndex-D52EAwtb.cjs} +1 -1
- package/dist/{menuIndex-BwWrdu20.js → menuIndex-DYaogp2R.js} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.js +10 -10
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +11 -11
- package/dist/{threeModel-DpvPVwlN.js → threeModel-AsOY6mTs.js} +45 -45
- package/dist/{threeModel-D5UnPmV3.cjs → threeModel-rcCyHi_m.cjs} +1 -1
- package/dist/{threePreview-XQG7sQy9.js → threePreview-CkKl3frr.js} +125 -125
- package/dist/{threePreview-CBFQtSls.cjs → threePreview-DOD9HOZn.cjs} +1 -1
- package/dist/{threeSceneView-D97Sc8hd.cjs → threeSceneView-DZvOLWv6.cjs} +1 -1
- package/dist/{threeSceneView-CdZFIImJ.js → threeSceneView-DlL9pZlj.js} +38 -38
- package/dist/{threeSceneViewForCPMPIP-4Cjv1ZS4.cjs → threeSceneViewForCPMPIP-CZvKvfDx.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-DH__ogKh.js → threeSceneViewForCPMPIP-DB0Eczbs.js} +8 -8
- package/dist/{threeTrackPathView-s17KavQX.cjs → threeTrackPathView-DgyAEYfV.cjs} +1 -1
- package/dist/{threeTrackPathView-BFQXaw-a.js → threeTrackPathView-Eb1bvUXJ.js} +78 -78
- package/dist/{threeViewerHost-C39tiQj-.cjs → threeViewerHost-BMU1tg9c.cjs} +1 -1
- package/dist/{threeViewerHost-BgPjA_94.js → threeViewerHost-Bdzv9iPb.js} +11 -11
- package/dist/{urdfTree-HdeBG5se.cjs → urdfTree-CoK2r17Y.cjs} +1 -1
- package/dist/{urdfTree-DM6uTeXj.js → urdfTree-hLtm0aFY.js} +10 -10
- package/dist/{workpieceTreePanel-C5qUdbmi.js → workpieceTreePanel-Ne_ACq86.js} +63 -63
- package/dist/{workpieceTreePanel-BKOHDm85.cjs → workpieceTreePanel-mWvCQyyw.cjs} +1 -1
- package/package.json +1 -1
- package/dist/index-BteE57Nz.js +0 -103
- package/dist/index-C8FzkPpO.cjs +0 -1
- package/dist/index-CmctAnWR.cjs +0 -11
- package/dist/index-CsbDyIb2.cjs +0 -1
- package/dist/index-DdXtt1dh.js +0 -12544
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ref as b, watch as Pe, createElementBlock as Z, openBlock as Y, createBlock as
|
|
2
|
-
import { V as M,
|
|
3
|
-
import { O as ut } from "./OrbitControls-
|
|
4
|
-
import { s as dt } from "./index-
|
|
5
|
-
import { u as pt } from "./index.vue_vue_type_style_index_1_lang-
|
|
1
|
+
import { ref as b, watch as Pe, createElementBlock as Z, openBlock as Y, createBlock as Le, computed as ie, onMounted as $e, onUnmounted as je, Fragment as Xe, renderList as Ye, createElementVNode as h, createCommentVNode as xe, toDisplayString as ae, resolveComponent as Je, createVNode as z, defineComponent as He, normalizeStyle as Fe, normalizeClass as Ee, nextTick as Be, onBeforeUnmount as Ze, withDirectives as se, unref as O, withCtx as Te, isRef as he, vModelRadio as ye, vShow as we } from "vue";
|
|
2
|
+
import { V as M, O as be, P as qe, Q as We, R as Ke, W as Ne, T as Qe, U as et, X as tt, Y as Re, Z as nt, _ as at, $ as Me, a0 as ot, a1 as De, a2 as st, a3 as ke, a4 as lt, a5 as Ve, a6 as Oe, a7 as Ue, a8 as ze, a9 as _e, aa as de, ab as it, ac as rt, ad as ct } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-1pEFQ04s.js";
|
|
3
|
+
import { O as ut } from "./OrbitControls-BGsXD_A7.js";
|
|
4
|
+
import { s as dt } from "./index-OX4hSXv6.js";
|
|
5
|
+
import { u as pt } from "./index.vue_vue_type_style_index_1_lang-CNh42_ZH.js";
|
|
6
6
|
import { _ as me } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
|
-
import { c as Ge } from "./index-
|
|
8
|
-
import { E as
|
|
7
|
+
import { c as Ge } from "./index-COQpDVsv.js";
|
|
8
|
+
import { E as Ie } from "./index-B8HqIYd5.js";
|
|
9
9
|
function mt(F) {
|
|
10
10
|
let f = null, r = null, c = null, v = null, w = null, k = null, i = null, A = null;
|
|
11
11
|
const E = 1e3 / 30;
|
|
@@ -186,7 +186,7 @@ function mt(F) {
|
|
|
186
186
|
}
|
|
187
187
|
function ft(F, f) {
|
|
188
188
|
const r = b(!1);
|
|
189
|
-
let c = null, v = 12700, w = new M(), k = new M(), i = new M(), A = 0,
|
|
189
|
+
let c = null, v = 12700, w = new M(), k = new M(), i = new M(), A = 0, L = null;
|
|
190
190
|
const E = (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2, T = (e) => {
|
|
191
191
|
const u = new M(), p = A * 1.2, _ = new M(i.x + p, i.y, i.z), U = new M(i.x, i.y + p, i.z), V = new M(i.x, i.y - p, i.z);
|
|
192
192
|
if (e <= 0.567) {
|
|
@@ -213,7 +213,7 @@ function ft(F, f) {
|
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
215
|
const U = T(_);
|
|
216
|
-
e.position.copy(U), e.lookAt(i), u.target.copy(i),
|
|
216
|
+
e.position.copy(U), e.lookAt(i), u.target.copy(i), L = requestAnimationFrame(D);
|
|
217
217
|
}, l = () => {
|
|
218
218
|
if (f.value.length === 0) return;
|
|
219
219
|
const { camera: e, controls: u } = F();
|
|
@@ -233,7 +233,7 @@ function ft(F, f) {
|
|
|
233
233
|
};
|
|
234
234
|
j();
|
|
235
235
|
}, C = () => {
|
|
236
|
-
r.value = !1, c = null,
|
|
236
|
+
r.value = !1, c = null, L && (cancelAnimationFrame(L), L = null);
|
|
237
237
|
const { controls: e } = F();
|
|
238
238
|
e && (e.enabled = !0, e.target.copy(k));
|
|
239
239
|
};
|
|
@@ -241,7 +241,7 @@ function ft(F, f) {
|
|
|
241
241
|
isAnimating: r,
|
|
242
242
|
toggleAnimation: () => {
|
|
243
243
|
if (r.value) {
|
|
244
|
-
r.value = !1, c = null,
|
|
244
|
+
r.value = !1, c = null, L && (cancelAnimationFrame(L), L = null);
|
|
245
245
|
const { camera: e, controls: u } = F();
|
|
246
246
|
if (!e || !u) return;
|
|
247
247
|
u.enabled = !0;
|
|
@@ -269,7 +269,7 @@ function vt(F, f) {
|
|
|
269
269
|
new ze(new M(0, 0, 1), 0)
|
|
270
270
|
// Z轴平面
|
|
271
271
|
];
|
|
272
|
-
},
|
|
272
|
+
}, L = () => {
|
|
273
273
|
k.makeEmpty(), f.value.forEach((g) => {
|
|
274
274
|
k.expandByObject(g);
|
|
275
275
|
}), i = k.getCenter(new M());
|
|
@@ -288,7 +288,7 @@ function vt(F, f) {
|
|
|
288
288
|
}, T = () => {
|
|
289
289
|
if (D(), l(), c.value === "none")
|
|
290
290
|
return;
|
|
291
|
-
|
|
291
|
+
L();
|
|
292
292
|
let g = null;
|
|
293
293
|
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) {
|
|
294
294
|
f.value.forEach((u) => {
|
|
@@ -322,7 +322,7 @@ function vt(F, f) {
|
|
|
322
322
|
isClipping: r,
|
|
323
323
|
activeClippingAxis: c,
|
|
324
324
|
toggleClipping: () => {
|
|
325
|
-
r.value = !r.value, r.value ? (A(), f.value.length > 0 &&
|
|
325
|
+
r.value = !r.value, r.value ? (A(), f.value.length > 0 && L()) : (c.value = "none", D(), l());
|
|
326
326
|
},
|
|
327
327
|
updateClippingPlanes: T,
|
|
328
328
|
clearClippingPlanes: D,
|
|
@@ -350,7 +350,7 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
350
350
|
), (c, v) => {
|
|
351
351
|
var w, k, i;
|
|
352
352
|
return Y(), Z("div", gt, [
|
|
353
|
-
(Y(),
|
|
353
|
+
(Y(), Le(dt, {
|
|
354
354
|
itemData: (w = r.value) == null ? void 0 : w.compData,
|
|
355
355
|
key: (k = r.value) == null ? void 0 : k.id,
|
|
356
356
|
index: (i = r.value) == null ? void 0 : i.id,
|
|
@@ -378,7 +378,7 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
378
378
|
setup(F, { expose: f }) {
|
|
379
379
|
const r = F;
|
|
380
380
|
b(!0);
|
|
381
|
-
const c = b([]), v = b(null), w = b(null), k = b(12.5), i = b(), A = b(1302),
|
|
381
|
+
const c = b([]), v = b(null), w = b(null), k = b(12.5), i = b(), A = b(1302), L = b(30), E = b(!1), T = b(!1), D = b(0), l = b(0), C = b(null), g = it.degToRad, e = b(1), u = () => Bt / Ae / e.value;
|
|
382
382
|
let p = [];
|
|
383
383
|
Pe(
|
|
384
384
|
() => r.animationData,
|
|
@@ -392,17 +392,17 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
392
392
|
), ie(() => p.length > 0);
|
|
393
393
|
const _ = (n, m = !1) => n === "revolute" ? m ? Math.PI : -Math.PI : n === "prismatic" ? m ? 1 : -1 : 0, U = () => {
|
|
394
394
|
if (!v.value)
|
|
395
|
-
return
|
|
395
|
+
return Ie.error("未加载 URDF"), !1;
|
|
396
396
|
let n = null;
|
|
397
397
|
return v.value.traverse((m) => {
|
|
398
398
|
n || m.name === "Pipe_Link" && m.traverse((s) => {
|
|
399
399
|
s instanceof De && !n && (n = s);
|
|
400
400
|
});
|
|
401
|
-
}), n ? (n.position.y -=
|
|
401
|
+
}), n ? (n.position.y -= L.value * pe, i.value = n, n.material = new Oe({
|
|
402
402
|
color: 11184810,
|
|
403
403
|
shininess: 80,
|
|
404
404
|
side: Ue
|
|
405
|
-
}), !0) : (
|
|
405
|
+
}), !0) : (Ie.error('在 "Pipe_Link" 内未找到任何 Mesh'), !1);
|
|
406
406
|
}, V = (n) => {
|
|
407
407
|
if (!n || !n.joints)
|
|
408
408
|
return console.warn("URDF模型没有关节信息"), [];
|
|
@@ -460,9 +460,9 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
460
460
|
y.localX.applyMatrix4(H), y.localZ.applyMatrix4(H);
|
|
461
461
|
}
|
|
462
462
|
if (s > 0 && (y.pos.add(y.localY.clone().multiplyScalar(s * pe)), m.push(y.pos.clone())), o > 0 && t > 0) {
|
|
463
|
-
const H = g(o), $ = t * pe, ne = y.pos.clone().add(y.localX.clone().multiplyScalar(-$)),
|
|
464
|
-
for (let P = 1; P <=
|
|
465
|
-
const Q = H * P /
|
|
463
|
+
const H = g(o), $ = t * pe, ne = y.pos.clone().add(y.localX.clone().multiplyScalar(-$)), I = Math.max(16, Math.ceil(o / 5));
|
|
464
|
+
for (let P = 1; P <= I; P++) {
|
|
465
|
+
const Q = H * P / I, oe = new de().makeRotationAxis(y.localZ, Q), ve = y.localX.clone().multiplyScalar($).applyMatrix4(oe), ge = ne.clone().add(ve);
|
|
466
466
|
m.push(ge);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
@@ -471,14 +471,14 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
471
471
|
let s = p.slice(0, n + 1);
|
|
472
472
|
const x = p[n + 1];
|
|
473
473
|
if (x && m > 0) {
|
|
474
|
-
const
|
|
474
|
+
const I = {
|
|
475
475
|
...x,
|
|
476
476
|
// 根据插值因子计算当前的弯曲角度C,实现从0到目标角度的平滑过渡
|
|
477
477
|
B: (x.B ?? 0) * m,
|
|
478
478
|
// 根据插值因子计算当前的弯曲角度C,实现从0到目标角度的平滑过渡
|
|
479
479
|
C: (x.C ?? 0) * m
|
|
480
480
|
};
|
|
481
|
-
s.push(
|
|
481
|
+
s.push(I);
|
|
482
482
|
}
|
|
483
483
|
const o = G(s), t = Math.max(0, A.value - o), y = [];
|
|
484
484
|
y.push(new M(0, 0, 0));
|
|
@@ -491,8 +491,8 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
491
491
|
localZ: new M(0, 0, 1)
|
|
492
492
|
};
|
|
493
493
|
const ne = [];
|
|
494
|
-
for (let
|
|
495
|
-
const P = s[
|
|
494
|
+
for (let I = s.length - 1; I >= 0; I--) {
|
|
495
|
+
const P = s[I], Q = j(P);
|
|
496
496
|
if (Q.length > 0) {
|
|
497
497
|
const oe = Q.map((le) => {
|
|
498
498
|
const ue = le.clone(), Se = new de();
|
|
@@ -512,14 +512,14 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
for (const
|
|
516
|
-
|
|
515
|
+
for (const I of ne)
|
|
516
|
+
I.length > 1 && y.push(...I.slice(1));
|
|
517
517
|
y.length < 2 && y.push(new M(0, 1e-3, 0));
|
|
518
518
|
try {
|
|
519
|
-
const
|
|
519
|
+
const I = new rt(y, !1, "catmullrom", 0.01), P = new ct(I, Math.max(2, y.length * 4), k.value * pe, 18, !1);
|
|
520
520
|
i.value.geometry.dispose(), i.value.geometry = P;
|
|
521
|
-
} catch (
|
|
522
|
-
console.error("管件更新失败",
|
|
521
|
+
} catch (I) {
|
|
522
|
+
console.error("管件更新失败", I);
|
|
523
523
|
}
|
|
524
524
|
}, ee = (n, m, s = 1) => {
|
|
525
525
|
n && (Object.keys(n).forEach((x) => {
|
|
@@ -637,7 +637,7 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
637
637
|
])))
|
|
638
638
|
]));
|
|
639
639
|
}
|
|
640
|
-
}, Rt = /* @__PURE__ */ me(Tt, [["__scopeId", "data-v-035ae936"]]), Vt = { class: "panel-content" },
|
|
640
|
+
}, Rt = /* @__PURE__ */ me(Tt, [["__scopeId", "data-v-035ae936"]]), Vt = { class: "panel-content" }, It = "id", Lt = {
|
|
641
641
|
__name: "urdfTree",
|
|
642
642
|
props: {
|
|
643
643
|
model: Object,
|
|
@@ -688,7 +688,7 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
688
688
|
limit: (l == null ? void 0 : l.limit) ?? "",
|
|
689
689
|
children: i(l == null ? void 0 : l.children, 1),
|
|
690
690
|
path: l == null ? void 0 : l.name
|
|
691
|
-
}] : [],
|
|
691
|
+
}] : [], L = (l, C) => {
|
|
692
692
|
const g = [], e = [...l];
|
|
693
693
|
for (; e.length > 0 && g.length < C; ) {
|
|
694
694
|
const u = e.shift();
|
|
@@ -704,7 +704,7 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
704
704
|
g.push(...u);
|
|
705
705
|
}
|
|
706
706
|
}), g.slice(0, C + 1);
|
|
707
|
-
}, T = ie(() => !v.value || v.value.length === 0 ? [] : r.expandStrategy === "firstLevel" ? E(v.value, r.maxExpandCount) :
|
|
707
|
+
}, T = ie(() => !v.value || v.value.length === 0 ? [] : r.expandStrategy === "firstLevel" ? E(v.value, r.maxExpandCount) : L(v.value, r.maxExpandCount)), D = ie(() => r != null && r.model ? A(r.model) : []);
|
|
708
708
|
return Pe(
|
|
709
709
|
D,
|
|
710
710
|
(l) => {
|
|
@@ -718,13 +718,13 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
718
718
|
data: v.value,
|
|
719
719
|
props: w,
|
|
720
720
|
"default-expanded-keys": T.value,
|
|
721
|
-
"node-key":
|
|
721
|
+
"node-key": It,
|
|
722
722
|
onNodeClick: k
|
|
723
723
|
}, null, 8, ["data", "default-expanded-keys"])
|
|
724
724
|
]);
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
|
-
}, $t = /* @__PURE__ */ me(
|
|
727
|
+
}, $t = /* @__PURE__ */ me(Lt, [["__scopeId", "data-v-290ff4e1"]]), Jt = ["xlink:href"], Ot = /* @__PURE__ */ He({
|
|
728
728
|
__name: "svgIcon",
|
|
729
729
|
props: {
|
|
730
730
|
backgroundColor: { default: "#f0f0f0" },
|
|
@@ -781,7 +781,7 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
781
781
|
let v = null, w = !1;
|
|
782
782
|
const k = b(null), i = b(!1), A = b("");
|
|
783
783
|
b(!1);
|
|
784
|
-
const
|
|
784
|
+
const L = b(!1), E = b(!1), T = b(""), D = b(!1), l = b(""), C = b(), {
|
|
785
785
|
currentModels: g,
|
|
786
786
|
initialCameraPosition: e,
|
|
787
787
|
initialTargetPosition: u,
|
|
@@ -801,14 +801,14 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
801
801
|
A,
|
|
802
802
|
J
|
|
803
803
|
), te = () => {
|
|
804
|
-
if (
|
|
805
|
-
|
|
804
|
+
if (L.value || g.value.length === 0) return;
|
|
805
|
+
L.value = !0, j.value && ee();
|
|
806
806
|
const { camera: o, controls: t } = V();
|
|
807
807
|
if (!o || !t) return;
|
|
808
808
|
t.enabled = !0;
|
|
809
|
-
const y = (Q) => Q < 0.5 ? 4 * Q * Q * Q : 1 - Math.pow(-2 * Q + 2, 3) / 2, H = o.position.clone(), $ = t.target.clone(), ne = 1500,
|
|
810
|
-
const Q = Date.now() -
|
|
811
|
-
o.position.lerpVectors(H, e.value, ce), t.target.lerpVectors($, u.value, ce), oe < 1 ? requestAnimationFrame(P) :
|
|
809
|
+
const y = (Q) => Q < 0.5 ? 4 * Q * Q * Q : 1 - Math.pow(-2 * Q + 2, 3) / 2, H = o.position.clone(), $ = t.target.clone(), ne = 1500, I = Date.now(), P = () => {
|
|
810
|
+
const Q = Date.now() - I, oe = Math.min(Q / ne, 1), ce = y(oe);
|
|
811
|
+
o.position.lerpVectors(H, e.value, ce), t.target.lerpVectors($, u.value, ce), oe < 1 ? requestAnimationFrame(P) : L.value = !1;
|
|
812
812
|
};
|
|
813
813
|
P();
|
|
814
814
|
}, re = async () => w ? Promise.resolve() : new Promise((o) => {
|
|
@@ -847,7 +847,7 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
847
847
|
addModelsFromUrls: Ce,
|
|
848
848
|
loadModelByDefaultPath: n
|
|
849
849
|
}), (o, t) => {
|
|
850
|
-
var H, $, ne,
|
|
850
|
+
var H, $, ne, I;
|
|
851
851
|
const y = Je("el-scrollbar");
|
|
852
852
|
return Y(), Z("div", Ut, [
|
|
853
853
|
h("div", {
|
|
@@ -993,7 +993,7 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
993
993
|
size: "24",
|
|
994
994
|
backgroundColor: "#ffffff",
|
|
995
995
|
title: "停止",
|
|
996
|
-
onClick: (
|
|
996
|
+
onClick: (I = C.value) == null ? void 0 : I.resetAll
|
|
997
997
|
}, null, 8, ["onClick"])
|
|
998
998
|
]),
|
|
999
999
|
se(h("div", Zt, [
|
|
@@ -1006,7 +1006,7 @@ const gt = { class: "panel-content" }, ht = {
|
|
|
1006
1006
|
]),
|
|
1007
1007
|
z(y, { "max-height": "650px" }, {
|
|
1008
1008
|
default: Te(() => [
|
|
1009
|
-
T.value === "场景树" ? (Y(),
|
|
1009
|
+
T.value === "场景树" ? (Y(), Le($t, {
|
|
1010
1010
|
key: 0,
|
|
1011
1011
|
model: O(K)
|
|
1012
1012
|
}, null, 8, ["model"])) : xe("", !0),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-b_9vxv2X.cjs"),me=require("./OrbitControls-Bwzpfq8_.cjs"),fe=require("./index-DWm4nu2G.cjs"),ve=require("./index.vue_vue_type_style_index_1_lang-DDedRKQj.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),pe=require("./index-C8fMwErX.cjs"),de=require("./index-C5pQXH0_.cjs");function ge(z){let g=null,u=null,d=null,h=null,x=null,_=null,c=null,C=null;const D=1e3/30;let S=0;const E=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;g=new n.Scene,g.background=new n.Color(15790320);const m=z.value;u=new n.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),u.position.set(8,-8,6),u.up.set(0,0,1),u.lookAt(0,0,0),d=new n.WebGLRenderer({antialias:!0,alpha:!0}),d.setSize(m.clientWidth,m.clientHeight),d.localClippingEnabled=!0,d.shadowMap.enabled=!0,d.shadowMap.type=n.PCFSoftShadowMap,d.toneMapping=n.ACESFilmicToneMapping,d.toneMappingExposure=1,d.outputColorSpace=n.SRGBColorSpace,m.appendChild(d.domElement),h=new me.OrbitControls(u,d.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},h.panSpeed=.7,x=new n.Xe(u,d,{container:m,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),x.attachControls(h),f(),P()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),C&&(g.remove(C),C.geometry.dispose(),C.material.dispose());const b=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,b,13421772,14540253),c.rotateX(Math.PI/2),c.position.copy(l),g.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});C=new n.Mesh(B,O),C.position.copy(l),C.position.z-=.01,C.receiveShadow=!0,g.add(C)},p=()=>{if(E.value.length===0)return;const m=new n.Box3;let l=!1;if(E.value.forEach(X=>{if(X.userData.boundingBox)m.union(X.userData.boundingBox),l=!0;else if(X.userData.modelId&&modelBoundingBoxes.has(X.userData.modelId)){const Z=modelBoundingBoxes.get(X.userData.modelId);m.union(Z.box),l=!0}else m.expandByObject(X),l=!0}),!l){console.warn("无法计算包围盒,网格更新失败");return}const b=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(b.x,b.y,b.z),j=Math.max(O*8,50),q=new n.Vector3(B.x,B.y,m.min.z);t(j,q)},f=()=>{const m=new n.AmbientLight(4210752,.6);g.add(m);const l=new n.DirectionalLight(16777215,2);l.position.set(10,10,8),l.castShadow=!0,l.shadow.mapSize.width=4096,l.shadow.mapSize.height=4096,l.shadow.camera.near=.5,l.shadow.camera.far=50,l.shadow.camera.left=-50,l.shadow.camera.right=50,l.shadow.camera.top=50,l.shadow.camera.bottom=-50,g.add(l);const b=new n.DirectionalLight(16777215,.8);b.position.set(-8,-8,6),g.add(b);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),g.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);g.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),g.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),g.add(q)},P=()=>{_=requestAnimationFrame(P),h&&h.update();const m=performance.now(),l=m-S;l<D||(S=m-l%D,d&&g&&u&&d.render(g,u),x&&x.render())},I=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(b=>{m[b]&&m[b].dispose&&m[b].dispose()}),m.dispose&&m.dispose()},A=m=>{m==null||m.traverse(l=>{l.geometry&&l.geometry.dispose(),l.material&&(Array.isArray(l.material)?l.material.forEach(b=>{I(b)}):I(l.material))})};return{currentModels:E,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,b=m.clientHeight;u.aspect=l/b,u.updateProjectionMatrix(),d.setSize(l,b),x.update()},fitCameraToAllModels:m=>{if(!u||!h||E.value.length===0)return;const l=new n.Box3;let b=!1;if(E.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),b=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),b=!0}else l.expandByObject(Z),b=!0}),!b){console.warn("无法计算包围盒");return}const B=l.getSize(new n.Vector3),O=l.getCenter(new n.Vector3),q=Math.max(B.x,B.y,B.z)*.8,X=new n.Vector3(O.x+q,O.y-q,O.z+q);u.position.copy(X),u.lookAt(O),h.target.copy(O),h.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:g,camera:u,renderer:d,controls:h,gizmo:x}),clearAllModels:()=>{if(!g)return;E.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==C&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),E.value=[],p()},cleanup:()=>{_&&cancelAnimationFrame(_),c&&c.dispose(),C&&(C.geometry.dispose(),C.material.dispose()),d&&d.dispose(),h&&h.dispose(),x&&x.dispose()},updateGridForModels:p}}function he(z,g){const u=e.ref(!1);let d=null,h=12700,x=new n.Vector3,_=new n.Vector3,c=new n.Vector3,C=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,S=t=>{const p=new n.Vector3,f=C*1.2,P=new n.Vector3(c.x+f,c.y,c.z),I=new n.Vector3(c.x,c.y+f,c.z),A=new n.Vector3(c.x,c.y-f,c.z);if(t<=.567){const $=t/.567*Math.PI*2;p.x=c.x+Math.cos($)*f,p.z=c.z+Math.sin($)*f,p.y=c.y}else if(t<=.724){const L=(t-.567)/.157,$=D(L);p.lerpVectors(P,I,$)}else if(t<=.881){const L=(t-.724)/.157,J=D(L)*Math.PI;p.x=c.x+Math.sin(J)*f,p.y=c.y+Math.cos(J)*f,p.z=c.z}else{const L=(t-.881)/.119,$=D(L);p.lerpVectors(A,x,$)}return p},E=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,P=Math.min(f/h,1);if(P>=1){k();return}const I=S(P);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(E)},r=()=>{if(g.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),_.copy(p.target);const f=new n.Box3;g.value.forEach(G=>{f.expandByObject(G)});const P=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),C=Math.max(P.x,P.y,P.z)*1.2;const I=new n.Vector3(c.x+C*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const G=Date.now()-$,Y=Math.min(G/L,1),m=D(Y);t.position.lerpVectors(A,I,m),t.lookAt(c),p.target.copy(c),Y<1?requestAnimationFrame(J):(u.value=!0,d=null,E())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(_))};return{isAnimating:u,toggleAnimation:()=>{if(u.value){u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{camera:t,controls:p}=z();if(!t||!p)return;p.enabled=!0;const f=t.position.clone(),P=p.target.clone(),I=1500,A=Date.now(),L=()=>{const $=Date.now()-A,J=Math.min($/I,1),G=D(J);t.position.lerpVectors(f,x,G),p.target.lerpVectors(P,_,G),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function ye(z,g){const u=e.ref(!1),d=e.ref("none");let h=[],x=[],_=new n.Box3,c=new n.Vector3;const C=()=>{h=[new n.Plane(new n.Vector3(1,0,0),0),new n.Plane(new n.Vector3(0,1,0),0),new n.Plane(new n.Vector3(0,0,1),0)]},F=()=>{_.makeEmpty(),g.value.forEach(y=>{_.expandByObject(y)}),c=_.getCenter(new n.Vector3)},D=y=>{const t=_.getSize(new n.Vector3);let p,f,P;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(0,Math.PI/2,0)):y==="y"?(p=new n.PlaneGeometry(t.x*1.2,t.z*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(Math.PI/2,0,0)):y==="z"&&(p=new n.PlaneGeometry(t.x*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(0,0,0));const I=new n.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:n.DoubleSide,depthWrite:!1}),A=new n.Mesh(p,I);return A.position.copy(f),A.rotation.copy(P),A},S=()=>{if(E(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(h[0].constant=-c.x,y=h[0]):d.value==="y"?(h[1].constant=-c.y,y=h[1]):d.value==="z"&&(h[2].constant=-c.z,y=h[2]),y){g.value.forEach(p=>{p.traverse(f=>{f.isMesh&&f.material&&(Array.isArray(f.material)?f.material.forEach(P=>{P.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},E=()=>{g.value.forEach(y=>{y.traverse(t=>{t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(p=>{p.clippingPlanes=[]}):t.material.clippingPlanes=[])})})},r=()=>{const{scene:y}=z();y&&x.forEach(t=>{y.remove(t),t.geometry.dispose(),t.material.dispose()}),x=[]};return{isClipping:u,activeClippingAxis:d,toggleClipping:()=>{u.value=!u.value,u.value?(C(),g.value.length>0&&F()):(d.value="none",E(),r())},updateClippingPlanes:S,clearClippingPlanes:E,clearClippingMeshes:r}}const we={class:"panel-content"},xe={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const g=z;e.ref();const u=e.ref();return e.watch(()=>[g==null?void 0:g.animationData],()=>{var h;let d=((h=pe.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,_,c;return e.openBlock(),e.createElementBlock("div",we,[(e.openBlock(),e.createBlock(fe.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(_=u.value)==null?void 0:_.id,index:(c=u.value)==null?void 0:c.id,showHeader:!1},null,8,["itemData","index"]))])}}},Ve=oe._export_sfc(xe,[["__scopeId","data-v-2387536e"]]),Me={class:"panel-content"},ke={key:0,class:"joints-list"},_e={class:"joint-info-row"},Pe={class:"joint-left"},Ce={class:"joint-name"},Ee={class:"joint-range"},be={class:"joint-type"},ze={key:0,class:"joint-control-row"},De={class:"slider-container"},Ne=["min","max","value","onInput","disabled"],Se={class:"value-display"},Be={class:"joint-value"},Ae={class:"unit"},Re={key:1,class:"empty-state"},ae=.001,Fe=1e3,ce=60,Te={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:g}){const u=z;e.ref(!0);const d=e.ref([]),h=e.ref(null),x=e.ref(null),_=e.ref(12.5),c=e.ref(),C=e.ref(1302),F=e.ref(30),D=e.ref(!1),S=e.ref(!1),E=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Fe/ce/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;C.value=o.extra.管长,_.value=o.extra.外径/2;let v=((i=pe.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const P=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!h.value)return de.ElMessage.error("未加载 URDF"),!1;let o=null;return h.value.traverse(v=>{o||v.name==="Pipe_Link"&&v.traverse(i=>{i instanceof n.Mesh&&!o&&(o=i)})}),o?(o.position.y-=F.value*ae,c.value=o,o.material=new n.MeshPhongMaterial({color:11184810,shininess:80,side:n.DoubleSide}),!0):(de.ElMessage.error('在 "Pipe_Link" 内未找到任何 Mesh'),!1)},A=o=>{if(!o||!o.joints)return console.warn("URDF模型没有关节信息"),[];let v=null;if(o.traverse(V=>{V.name==="Pipe_Link"&&!v&&(v=V)}),v)c.value=v;else return console.warn("未找到管子模型"),[];const i=[];return Object.keys(o.joints).forEach(V=>{const s=o.joints[V];if(s._jointType==="fixed")return;const a=s.limit?{lower:s.limit.lower??P(s._jointType,!1),upper:s.limit.upper??P(s._jointType,!0)}:{lower:P(s._jointType,!1),upper:P(s._jointType,!0)};i.push({name:V,type:s._jointType||"unknown",limit:a,currentValue:s.angle||0,urdfJoint:s})}),i.sort((V,s)=>V.name.localeCompare(s.name))},L=(o,v)=>{const i=d.value.find(s=>s.name===o);if(!i)return;const V=parseFloat(v);if(i.limit){const s=Math.max(i.limit.lower,Math.min(i.limit.upper,V));i.currentValue=s}else i.currentValue=V;u.model&&u.model.setJointValue?u.model.setJointValue(o,i.currentValue):i.urdfJoint&&i.urdfJoint.setJointValue(i.currentValue)},$=o=>o.reduce((v,i)=>{let V=0;const s=i.Y??0,a=i.C??0,w=i.R??0;return s>0&&(V+=s),a>0&&w>0&&(V+=w*y(a)),v+V},0),J=o=>{const v=[],i=o.Y??0,V=o.B??0,s=o.C??0,a=o.R??0,w={pos:new n.Vector3(0,0,0),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};if(!i&&!s)return v;if(v.push(w.pos.clone()),V!==0){const U=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(U),w.localZ.applyMatrix4(U)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const U=y(s),T=a*ae,W=w.pos.clone().add(w.localX.clone().multiplyScalar(-T)),R=Math.max(16,Math.ceil(s/5));for(let M=1;M<=R;M++){const H=U*M/R,K=new n.Matrix4().makeRotationAxis(w.localZ,H),se=w.localX.clone().multiplyScalar(T).applyMatrix4(K),ie=W.clone().add(se);v.push(ie)}}return v},G=(o,v=0)=>{let i=f.slice(0,o+1);const V=f[o+1];if(V&&v>0){const R={...V,B:(V.B??0)*v,C:(V.C??0)*v};i.push(R)}const s=$(i),a=Math.max(0,C.value-s),w=[];w.push(new n.Vector3(0,0,0));const U=new n.Vector3(0,a*ae,0);a>0&&w.push(U);let T={pos:U.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const W=[];for(let R=i.length-1;R>=0;R--){const M=i[R],H=J(M);if(H.length>0){const K=H.map(Q=>{const ne=Q.clone(),ue=new n.Matrix4;return ue.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(ue),ne.add(T.pos)});W.push(K);const te=K[K.length-1];T.pos=te.clone();const se=M.B??0,ie=M.C??0;if(se!==0){const Q=new n.Matrix4().makeRotationAxis(T.localY,y(se));T.localX.applyMatrix4(Q),T.localZ.applyMatrix4(Q)}if(ie>0){const Q=y(ie),ne=new n.Matrix4().makeRotationAxis(T.localZ,Q);T.localY.applyMatrix4(ne),T.localX.applyMatrix4(ne)}}}for(const R of W)R.length>1&&w.push(...R.slice(1));w.length<2&&w.push(new n.Vector3(0,.001,0));try{const R=new n.CatmullRomCurve3(w,!1,"catmullrom",.01),M=new n.TubeGeometry(R,Math.max(2,w.length*4),_.value*ae,18,!1);c.value.geometry.dispose(),c.value.geometry=M}catch(R){console.error("管件更新失败",R)}},Y=(o,v,i=1)=>{o&&(Object.keys(o).forEach(V=>{const s=o[V],a=d.value.find(w=>w.name===V);a&&(a.currentValue=s,u.model&&u.model.setJointValue?u.model.setJointValue(V,s):a.urdfJoint&&a.urdfJoint.setJointValue(s))}),G(v,i))},m=(o,v,i)=>o+(v-o)*i,l=(o,v,i)=>{if(!o||!v)return o||v;const V={};return Object.keys(o).forEach(s=>{const a=o[s],w=v[s];V[s]=m(a,w||a,i)}),V},b=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,S.value=!1,E.value=0,r.value=0,B()},B=()=>{if(!D.value||S.value)return;const o=E.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ce,i=f[o],V=f[o+1];if(V){const s=l(i,V,v);Y(s,o,v)}else Y(i,o);r.value++,r.value>ce&&(r.value=0,E.value++),k.value=setTimeout(B,p())},O=()=>{S.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,S.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};g({startAnimation:b,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),E.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),G(-1,0)},fastForward:()=>{t.value<4&&(t.value=Math.min(4,t.value*2))},fastBackward:()=>{t.value>.25&&(t.value=Math.max(.25,t.value/2))}}),e.watch(()=>u.model,o=>{o?(h.value=o,d.value=A(o)):d.value=[]},{immediate:!0});const ee=()=>{!u.model||D.value&&!S.value||d.value.forEach(o=>{o.urdfJoint&&o.urdfJoint.angle!==void 0&&(o.currentValue=o.urdfJoint.angle)})},le=()=>{const o=()=>{ee(),x.value=requestAnimationFrame(o)};o()},re=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{re(),j()}),(o,v)=>(e.openBlock(),e.createElementBlock("div",Me,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",ke,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var V,s,a,w;return e.openBlock(),e.createElementBlock("div",{key:i.name,class:"joint-item"},[e.createElementVNode("div",_e,[e.createElementVNode("div",Pe,[e.createElementVNode("span",Ce,e.toDisplayString(i.name),1),e.createElementVNode("span",Ee," ["+e.toDisplayString(((V=i.limit)==null?void 0:V.lower.toFixed(2))??(i.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((s=i.limit)==null?void 0:s.upper.toFixed(2))??(i.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",be,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("div",De,[e.createElementVNode("input",{type:"range",min:((a=i.limit)==null?void 0:a.lower)??(i.type==="revolute"?-Math.PI:-1),max:((w=i.limit)==null?void 0:w.upper)??(i.type==="revolute"?Math.PI:1),step:.01,value:i.currentValue,onInput:U=>L(i.name,U.target.value),class:"joint-slider",disabled:D.value&&!S.value},null,40,Ne)]),e.createElementVNode("div",Se,[e.createElementVNode("span",Be,e.toDisplayString(i.currentValue?Number(i.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Ae,e.toDisplayString(i.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Re,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},Le=oe._export_sfc(Te,[["__scopeId","data-v-035ae936"]]),Ie={class:"panel-content"},$e="id",Je={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:z=>["breadth","firstLevel"].includes(z)}},emits:["nodeClick"],setup(z,{emit:g}){const u=z,d=g,h=e.ref([]),x={children:"children",label:"label"},_=r=>{d("nodeClick",r)},c=(r,k=0)=>{const y=[];return Array.isArray(r)&&(r==null?void 0:r.length)>0&&r.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const p={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:k+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:c(t==null?void 0:t.children,k+1),path:t==null?void 0:t.name};y.push(p)}}),y},C=r=>r?[{name:r==null?void 0:r.name,label:r==null?void 0:r.name,show:!0,level:1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:c(r==null?void 0:r.children,1),path:r==null?void 0:r.name}]:[],F=(r,k)=>{const y=[],t=[...r];for(;t.length>0&&y.length<k;){const p=t.shift();p.children&&p.children.length>0&&(y.push(p.id),t.push(...p.children))}return y},D=(r,k)=>{const y=[];return r.forEach(t=>{if(t.children&&t.children.length>0){y.push(t.id);const p=t.children.filter(f=>f.children&&f.children.length>0).slice(0,k).map(f=>f.id);y.push(...p)}}),y.slice(0,k+1)},S=e.computed(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),E=e.computed(()=>u!=null&&u.model?C(u.model):[]);return e.watch(E,r=>{h.value=JSON.parse(JSON.stringify(r))},{immediate:!0}),(r,k)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(y,{data:h.value,props:x,"default-expanded-keys":S.value,"node-key":$e,onNodeClick:_},null,8,["data","default-expanded-keys"])])}}},Oe=oe._export_sfc(Je,[["__scopeId","data-v-290ff4e1"]]),Ue=["xlink:href"],Ge=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(z){const g=z,u=e.computed(()=>({backgroundColor:g.backgroundColor})),d=e.computed(()=>`#${g.prefix}-${g.name}`),h=e.computed(()=>{const{size:x}=g;let _=`${x}`;return _=`${_.replace("px","")}px`,{width:_,height:_}});return(x,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:x.active}]),style:e.normalizeStyle(u.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[x.$attrs.class,x.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(h.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Ue)],6))],6))}}),N=oe._export_sfc(Ge,[["__scopeId","data-v-3150a90b"]]),je={class:"obj-viewer-container"},qe={class:"buttonGroup-top"},Xe={class:"buttonGroup-topLeft"},He={class:"buttonGroup-left"},Ye={class:"buttonGroup-right"},Ze={class:"buttonGroup-bottom"},We={class:"left-panel"},Ke={class:"panel-header"},Qe={key:1,class:"clipping-content"},et={class:"radio-group"},tt={class:"radio-label"},nt={class:"radio-label"},at={class:"radio-label"},ot={class:"radio-label"},lt={class:"right-panel"},st={class:"panel-header"},it={key:0,class:"loading-overlay"},rt={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(z,{expose:g,emit:u}){const d=u;let h=null,x=!1;const _=e.ref(null),c=e.ref(!1),C=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),S=e.ref(""),E=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:P,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ge(_),{isAnimating:J,toggleAnimation:G,stopAnimation:Y}=he(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:b,updateClippingPlanes:B}=ye(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=ve.useModelLoader(A,y,c,C,L),Z=()=>{if(F.value||y.value.length===0)return;F.value=!0,J.value&&Y();const{camera:s,controls:a}=A();if(!s||!a)return;a.enabled=!0;const w=H=>H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2,U=s.position.clone(),T=a.target.clone(),W=1500,R=Date.now(),M=()=>{const H=Date.now()-R,K=Math.min(H/W,1),te=w(K);s.position.lerpVectors(U,t.value,te),a.target.lerpVectors(T,p.value,te),K<1?requestAnimationFrame(M):F.value=!1};M()},ee=async()=>x?Promise.resolve():new Promise(s=>{const a=()=>{x?s():requestAnimationFrame(a)};a()}),le=async(s,a)=>{try{await ee(),J.value&&Y(),m.value&&b();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},re=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,S.value=s,s==="剖面视图"&&!m.value&&b()},i=s=>{E.value=!0,r.value=s,s==="动画仿真"&&d("getAnimationData")},V=()=>{e.nextTick(()=>{var s;(s=k.value)==null||s.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{f(),h=A().scene,x=!0,window.addEventListener("resize",P)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,S.value="",r.value="",window.removeEventListener("resize",P),J.value&&Y(),$()}),g({addModelsFromUrls:re,loadModelByDefaultPath:o}),(s,a)=>{var U,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",je,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:_,class:"threejs-container"},null,512),e.createElementVNode("div",qe,[e.createVNode(N,{name:"guanjianjiexi",size:"34"}),e.createVNode(N,{name:"guanjiekongzhi",size:"34"}),e.createVNode(N,{name:"gongyishengcheng",size:"34"}),e.createVNode(N,{name:"buchangshezhi",size:"34"}),e.createVNode(N,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",Xe,[e.createVNode(N,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(N,{name:"fangda",size:"24",title:"放大"}),e.createVNode(N,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(N,{name:"lookAround",size:"24",onClick:e.unref(G),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",He,[e.createVNode(N,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&S.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(N,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&S.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",Ye,[e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:E.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:E.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ze,[e.createVNode(N,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(U=k.value)==null?void 0:U.fastBackward},null,8,["onClick"]),e.createVNode(N,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(N,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(N,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(N,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(R=k.value)==null?void 0:R.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",We,[e.createElementVNode("div",Ke,[e.createElementVNode("span",null,e.toDisplayString(S.value),1),e.createElementVNode("span",{class:"close",onClick:a[6]||(a[6]=M=>D.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[S.value==="场景树"?(e.openBlock(),e.createBlock(Oe,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),S.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Qe,[e.createElementVNode("div",et,[e.createElementVNode("label",tt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":a[7]||(a[7]=M=>e.isRef(l)?l.value=M:null),onChange:a[8]||(a[8]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[16]||(a[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":a[9]||(a[9]=M=>e.isRef(l)?l.value=M:null),onChange:a[10]||(a[10]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[17]||(a[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",at,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":a[11]||(a[11]=M=>e.isRef(l)?l.value=M:null),onChange:a[12]||(a[12]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[18]||(a[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",ot,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":a[13]||(a[13]=M=>e.isRef(l)?l.value=M:null),onChange:a[14]||(a[14]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[19]||(a[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,D.value]]),e.withDirectives(e.createElementVNode("div",lt,[e.createElementVNode("div",st,[e.createElementVNode("span",null,e.toDisplayString(r.value),1),e.createElementVNode("span",{class:"close",onClick:a[15]||(a[15]=M=>E.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Le,{ref_key:"jointRef",ref:k,model:e.unref(q),scene:e.unref(h),animationData:z.animationData},null,8,["model","scene","animationData"]),[[e.vShow,r.value==="关节控制"]]),e.withDirectives(e.createVNode(Ve,{animationData:z.animationData},null,8,["animationData"]),[[e.vShow,r.value==="动画仿真"]])]),_:1})],512),[[e.vShow,E.value]]),c.value?(e.openBlock(),e.createElementBlock("div",it,[a[20]||(a[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(C.value),1)])):e.createCommentVNode("",!0)])}}},ct=oe._export_sfc(rt,[["__scopeId","data-v-7bc47bb3"]]);exports.default=ct;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-ZMwIbmlN.cjs"),me=require("./OrbitControls-CktvE4iE.cjs"),fe=require("./index-CBqGrYej.cjs"),ve=require("./index.vue_vue_type_style_index_1_lang--4T7j9qz.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),pe=require("./index-DRTxe12U.cjs"),de=require("./index-C5pQXH0_.cjs");function ge(z){let g=null,u=null,d=null,h=null,x=null,_=null,c=null,C=null;const D=1e3/30;let S=0;const E=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;g=new n.Scene,g.background=new n.Color(15790320);const m=z.value;u=new n.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),u.position.set(8,-8,6),u.up.set(0,0,1),u.lookAt(0,0,0),d=new n.WebGLRenderer({antialias:!0,alpha:!0}),d.setSize(m.clientWidth,m.clientHeight),d.localClippingEnabled=!0,d.shadowMap.enabled=!0,d.shadowMap.type=n.PCFSoftShadowMap,d.toneMapping=n.ACESFilmicToneMapping,d.toneMappingExposure=1,d.outputColorSpace=n.SRGBColorSpace,m.appendChild(d.domElement),h=new me.OrbitControls(u,d.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},h.panSpeed=.7,x=new n.Xe(u,d,{container:m,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),x.attachControls(h),f(),P()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),C&&(g.remove(C),C.geometry.dispose(),C.material.dispose());const b=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,b,13421772,14540253),c.rotateX(Math.PI/2),c.position.copy(l),g.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});C=new n.Mesh(B,O),C.position.copy(l),C.position.z-=.01,C.receiveShadow=!0,g.add(C)},p=()=>{if(E.value.length===0)return;const m=new n.Box3;let l=!1;if(E.value.forEach(X=>{if(X.userData.boundingBox)m.union(X.userData.boundingBox),l=!0;else if(X.userData.modelId&&modelBoundingBoxes.has(X.userData.modelId)){const Z=modelBoundingBoxes.get(X.userData.modelId);m.union(Z.box),l=!0}else m.expandByObject(X),l=!0}),!l){console.warn("无法计算包围盒,网格更新失败");return}const b=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(b.x,b.y,b.z),j=Math.max(O*8,50),q=new n.Vector3(B.x,B.y,m.min.z);t(j,q)},f=()=>{const m=new n.AmbientLight(4210752,.6);g.add(m);const l=new n.DirectionalLight(16777215,2);l.position.set(10,10,8),l.castShadow=!0,l.shadow.mapSize.width=4096,l.shadow.mapSize.height=4096,l.shadow.camera.near=.5,l.shadow.camera.far=50,l.shadow.camera.left=-50,l.shadow.camera.right=50,l.shadow.camera.top=50,l.shadow.camera.bottom=-50,g.add(l);const b=new n.DirectionalLight(16777215,.8);b.position.set(-8,-8,6),g.add(b);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),g.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);g.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),g.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),g.add(q)},P=()=>{_=requestAnimationFrame(P),h&&h.update();const m=performance.now(),l=m-S;l<D||(S=m-l%D,d&&g&&u&&d.render(g,u),x&&x.render())},I=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(b=>{m[b]&&m[b].dispose&&m[b].dispose()}),m.dispose&&m.dispose()},A=m=>{m==null||m.traverse(l=>{l.geometry&&l.geometry.dispose(),l.material&&(Array.isArray(l.material)?l.material.forEach(b=>{I(b)}):I(l.material))})};return{currentModels:E,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,b=m.clientHeight;u.aspect=l/b,u.updateProjectionMatrix(),d.setSize(l,b),x.update()},fitCameraToAllModels:m=>{if(!u||!h||E.value.length===0)return;const l=new n.Box3;let b=!1;if(E.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),b=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),b=!0}else l.expandByObject(Z),b=!0}),!b){console.warn("无法计算包围盒");return}const B=l.getSize(new n.Vector3),O=l.getCenter(new n.Vector3),q=Math.max(B.x,B.y,B.z)*.8,X=new n.Vector3(O.x+q,O.y-q,O.z+q);u.position.copy(X),u.lookAt(O),h.target.copy(O),h.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:g,camera:u,renderer:d,controls:h,gizmo:x}),clearAllModels:()=>{if(!g)return;E.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==C&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),E.value=[],p()},cleanup:()=>{_&&cancelAnimationFrame(_),c&&c.dispose(),C&&(C.geometry.dispose(),C.material.dispose()),d&&d.dispose(),h&&h.dispose(),x&&x.dispose()},updateGridForModels:p}}function he(z,g){const u=e.ref(!1);let d=null,h=12700,x=new n.Vector3,_=new n.Vector3,c=new n.Vector3,C=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,S=t=>{const p=new n.Vector3,f=C*1.2,P=new n.Vector3(c.x+f,c.y,c.z),I=new n.Vector3(c.x,c.y+f,c.z),A=new n.Vector3(c.x,c.y-f,c.z);if(t<=.567){const $=t/.567*Math.PI*2;p.x=c.x+Math.cos($)*f,p.z=c.z+Math.sin($)*f,p.y=c.y}else if(t<=.724){const L=(t-.567)/.157,$=D(L);p.lerpVectors(P,I,$)}else if(t<=.881){const L=(t-.724)/.157,J=D(L)*Math.PI;p.x=c.x+Math.sin(J)*f,p.y=c.y+Math.cos(J)*f,p.z=c.z}else{const L=(t-.881)/.119,$=D(L);p.lerpVectors(A,x,$)}return p},E=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,P=Math.min(f/h,1);if(P>=1){k();return}const I=S(P);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(E)},r=()=>{if(g.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),_.copy(p.target);const f=new n.Box3;g.value.forEach(G=>{f.expandByObject(G)});const P=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),C=Math.max(P.x,P.y,P.z)*1.2;const I=new n.Vector3(c.x+C*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const G=Date.now()-$,Y=Math.min(G/L,1),m=D(Y);t.position.lerpVectors(A,I,m),t.lookAt(c),p.target.copy(c),Y<1?requestAnimationFrame(J):(u.value=!0,d=null,E())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(_))};return{isAnimating:u,toggleAnimation:()=>{if(u.value){u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{camera:t,controls:p}=z();if(!t||!p)return;p.enabled=!0;const f=t.position.clone(),P=p.target.clone(),I=1500,A=Date.now(),L=()=>{const $=Date.now()-A,J=Math.min($/I,1),G=D(J);t.position.lerpVectors(f,x,G),p.target.lerpVectors(P,_,G),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function ye(z,g){const u=e.ref(!1),d=e.ref("none");let h=[],x=[],_=new n.Box3,c=new n.Vector3;const C=()=>{h=[new n.Plane(new n.Vector3(1,0,0),0),new n.Plane(new n.Vector3(0,1,0),0),new n.Plane(new n.Vector3(0,0,1),0)]},F=()=>{_.makeEmpty(),g.value.forEach(y=>{_.expandByObject(y)}),c=_.getCenter(new n.Vector3)},D=y=>{const t=_.getSize(new n.Vector3);let p,f,P;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(0,Math.PI/2,0)):y==="y"?(p=new n.PlaneGeometry(t.x*1.2,t.z*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(Math.PI/2,0,0)):y==="z"&&(p=new n.PlaneGeometry(t.x*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(0,0,0));const I=new n.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:n.DoubleSide,depthWrite:!1}),A=new n.Mesh(p,I);return A.position.copy(f),A.rotation.copy(P),A},S=()=>{if(E(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(h[0].constant=-c.x,y=h[0]):d.value==="y"?(h[1].constant=-c.y,y=h[1]):d.value==="z"&&(h[2].constant=-c.z,y=h[2]),y){g.value.forEach(p=>{p.traverse(f=>{f.isMesh&&f.material&&(Array.isArray(f.material)?f.material.forEach(P=>{P.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},E=()=>{g.value.forEach(y=>{y.traverse(t=>{t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(p=>{p.clippingPlanes=[]}):t.material.clippingPlanes=[])})})},r=()=>{const{scene:y}=z();y&&x.forEach(t=>{y.remove(t),t.geometry.dispose(),t.material.dispose()}),x=[]};return{isClipping:u,activeClippingAxis:d,toggleClipping:()=>{u.value=!u.value,u.value?(C(),g.value.length>0&&F()):(d.value="none",E(),r())},updateClippingPlanes:S,clearClippingPlanes:E,clearClippingMeshes:r}}const we={class:"panel-content"},xe={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const g=z;e.ref();const u=e.ref();return e.watch(()=>[g==null?void 0:g.animationData],()=>{var h;let d=((h=pe.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,_,c;return e.openBlock(),e.createElementBlock("div",we,[(e.openBlock(),e.createBlock(fe.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(_=u.value)==null?void 0:_.id,index:(c=u.value)==null?void 0:c.id,showHeader:!1},null,8,["itemData","index"]))])}}},Ve=oe._export_sfc(xe,[["__scopeId","data-v-2387536e"]]),Me={class:"panel-content"},ke={key:0,class:"joints-list"},_e={class:"joint-info-row"},Pe={class:"joint-left"},Ce={class:"joint-name"},Ee={class:"joint-range"},be={class:"joint-type"},ze={key:0,class:"joint-control-row"},De={class:"slider-container"},Ne=["min","max","value","onInput","disabled"],Se={class:"value-display"},Be={class:"joint-value"},Ae={class:"unit"},Re={key:1,class:"empty-state"},ae=.001,Fe=1e3,ce=60,Te={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:g}){const u=z;e.ref(!0);const d=e.ref([]),h=e.ref(null),x=e.ref(null),_=e.ref(12.5),c=e.ref(),C=e.ref(1302),F=e.ref(30),D=e.ref(!1),S=e.ref(!1),E=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Fe/ce/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;C.value=o.extra.管长,_.value=o.extra.外径/2;let v=((i=pe.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const P=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!h.value)return de.ElMessage.error("未加载 URDF"),!1;let o=null;return h.value.traverse(v=>{o||v.name==="Pipe_Link"&&v.traverse(i=>{i instanceof n.Mesh&&!o&&(o=i)})}),o?(o.position.y-=F.value*ae,c.value=o,o.material=new n.MeshPhongMaterial({color:11184810,shininess:80,side:n.DoubleSide}),!0):(de.ElMessage.error('在 "Pipe_Link" 内未找到任何 Mesh'),!1)},A=o=>{if(!o||!o.joints)return console.warn("URDF模型没有关节信息"),[];let v=null;if(o.traverse(V=>{V.name==="Pipe_Link"&&!v&&(v=V)}),v)c.value=v;else return console.warn("未找到管子模型"),[];const i=[];return Object.keys(o.joints).forEach(V=>{const s=o.joints[V];if(s._jointType==="fixed")return;const a=s.limit?{lower:s.limit.lower??P(s._jointType,!1),upper:s.limit.upper??P(s._jointType,!0)}:{lower:P(s._jointType,!1),upper:P(s._jointType,!0)};i.push({name:V,type:s._jointType||"unknown",limit:a,currentValue:s.angle||0,urdfJoint:s})}),i.sort((V,s)=>V.name.localeCompare(s.name))},L=(o,v)=>{const i=d.value.find(s=>s.name===o);if(!i)return;const V=parseFloat(v);if(i.limit){const s=Math.max(i.limit.lower,Math.min(i.limit.upper,V));i.currentValue=s}else i.currentValue=V;u.model&&u.model.setJointValue?u.model.setJointValue(o,i.currentValue):i.urdfJoint&&i.urdfJoint.setJointValue(i.currentValue)},$=o=>o.reduce((v,i)=>{let V=0;const s=i.Y??0,a=i.C??0,w=i.R??0;return s>0&&(V+=s),a>0&&w>0&&(V+=w*y(a)),v+V},0),J=o=>{const v=[],i=o.Y??0,V=o.B??0,s=o.C??0,a=o.R??0,w={pos:new n.Vector3(0,0,0),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};if(!i&&!s)return v;if(v.push(w.pos.clone()),V!==0){const U=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(U),w.localZ.applyMatrix4(U)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const U=y(s),T=a*ae,W=w.pos.clone().add(w.localX.clone().multiplyScalar(-T)),R=Math.max(16,Math.ceil(s/5));for(let M=1;M<=R;M++){const H=U*M/R,K=new n.Matrix4().makeRotationAxis(w.localZ,H),se=w.localX.clone().multiplyScalar(T).applyMatrix4(K),ie=W.clone().add(se);v.push(ie)}}return v},G=(o,v=0)=>{let i=f.slice(0,o+1);const V=f[o+1];if(V&&v>0){const R={...V,B:(V.B??0)*v,C:(V.C??0)*v};i.push(R)}const s=$(i),a=Math.max(0,C.value-s),w=[];w.push(new n.Vector3(0,0,0));const U=new n.Vector3(0,a*ae,0);a>0&&w.push(U);let T={pos:U.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const W=[];for(let R=i.length-1;R>=0;R--){const M=i[R],H=J(M);if(H.length>0){const K=H.map(Q=>{const ne=Q.clone(),ue=new n.Matrix4;return ue.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(ue),ne.add(T.pos)});W.push(K);const te=K[K.length-1];T.pos=te.clone();const se=M.B??0,ie=M.C??0;if(se!==0){const Q=new n.Matrix4().makeRotationAxis(T.localY,y(se));T.localX.applyMatrix4(Q),T.localZ.applyMatrix4(Q)}if(ie>0){const Q=y(ie),ne=new n.Matrix4().makeRotationAxis(T.localZ,Q);T.localY.applyMatrix4(ne),T.localX.applyMatrix4(ne)}}}for(const R of W)R.length>1&&w.push(...R.slice(1));w.length<2&&w.push(new n.Vector3(0,.001,0));try{const R=new n.CatmullRomCurve3(w,!1,"catmullrom",.01),M=new n.TubeGeometry(R,Math.max(2,w.length*4),_.value*ae,18,!1);c.value.geometry.dispose(),c.value.geometry=M}catch(R){console.error("管件更新失败",R)}},Y=(o,v,i=1)=>{o&&(Object.keys(o).forEach(V=>{const s=o[V],a=d.value.find(w=>w.name===V);a&&(a.currentValue=s,u.model&&u.model.setJointValue?u.model.setJointValue(V,s):a.urdfJoint&&a.urdfJoint.setJointValue(s))}),G(v,i))},m=(o,v,i)=>o+(v-o)*i,l=(o,v,i)=>{if(!o||!v)return o||v;const V={};return Object.keys(o).forEach(s=>{const a=o[s],w=v[s];V[s]=m(a,w||a,i)}),V},b=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,S.value=!1,E.value=0,r.value=0,B()},B=()=>{if(!D.value||S.value)return;const o=E.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ce,i=f[o],V=f[o+1];if(V){const s=l(i,V,v);Y(s,o,v)}else Y(i,o);r.value++,r.value>ce&&(r.value=0,E.value++),k.value=setTimeout(B,p())},O=()=>{S.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,S.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};g({startAnimation:b,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),E.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),G(-1,0)},fastForward:()=>{t.value<4&&(t.value=Math.min(4,t.value*2))},fastBackward:()=>{t.value>.25&&(t.value=Math.max(.25,t.value/2))}}),e.watch(()=>u.model,o=>{o?(h.value=o,d.value=A(o)):d.value=[]},{immediate:!0});const ee=()=>{!u.model||D.value&&!S.value||d.value.forEach(o=>{o.urdfJoint&&o.urdfJoint.angle!==void 0&&(o.currentValue=o.urdfJoint.angle)})},le=()=>{const o=()=>{ee(),x.value=requestAnimationFrame(o)};o()},re=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{re(),j()}),(o,v)=>(e.openBlock(),e.createElementBlock("div",Me,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",ke,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var V,s,a,w;return e.openBlock(),e.createElementBlock("div",{key:i.name,class:"joint-item"},[e.createElementVNode("div",_e,[e.createElementVNode("div",Pe,[e.createElementVNode("span",Ce,e.toDisplayString(i.name),1),e.createElementVNode("span",Ee," ["+e.toDisplayString(((V=i.limit)==null?void 0:V.lower.toFixed(2))??(i.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((s=i.limit)==null?void 0:s.upper.toFixed(2))??(i.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",be,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("div",De,[e.createElementVNode("input",{type:"range",min:((a=i.limit)==null?void 0:a.lower)??(i.type==="revolute"?-Math.PI:-1),max:((w=i.limit)==null?void 0:w.upper)??(i.type==="revolute"?Math.PI:1),step:.01,value:i.currentValue,onInput:U=>L(i.name,U.target.value),class:"joint-slider",disabled:D.value&&!S.value},null,40,Ne)]),e.createElementVNode("div",Se,[e.createElementVNode("span",Be,e.toDisplayString(i.currentValue?Number(i.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Ae,e.toDisplayString(i.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Re,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},Le=oe._export_sfc(Te,[["__scopeId","data-v-035ae936"]]),Ie={class:"panel-content"},$e="id",Je={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:z=>["breadth","firstLevel"].includes(z)}},emits:["nodeClick"],setup(z,{emit:g}){const u=z,d=g,h=e.ref([]),x={children:"children",label:"label"},_=r=>{d("nodeClick",r)},c=(r,k=0)=>{const y=[];return Array.isArray(r)&&(r==null?void 0:r.length)>0&&r.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const p={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:k+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:c(t==null?void 0:t.children,k+1),path:t==null?void 0:t.name};y.push(p)}}),y},C=r=>r?[{name:r==null?void 0:r.name,label:r==null?void 0:r.name,show:!0,level:1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:c(r==null?void 0:r.children,1),path:r==null?void 0:r.name}]:[],F=(r,k)=>{const y=[],t=[...r];for(;t.length>0&&y.length<k;){const p=t.shift();p.children&&p.children.length>0&&(y.push(p.id),t.push(...p.children))}return y},D=(r,k)=>{const y=[];return r.forEach(t=>{if(t.children&&t.children.length>0){y.push(t.id);const p=t.children.filter(f=>f.children&&f.children.length>0).slice(0,k).map(f=>f.id);y.push(...p)}}),y.slice(0,k+1)},S=e.computed(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),E=e.computed(()=>u!=null&&u.model?C(u.model):[]);return e.watch(E,r=>{h.value=JSON.parse(JSON.stringify(r))},{immediate:!0}),(r,k)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(y,{data:h.value,props:x,"default-expanded-keys":S.value,"node-key":$e,onNodeClick:_},null,8,["data","default-expanded-keys"])])}}},Oe=oe._export_sfc(Je,[["__scopeId","data-v-290ff4e1"]]),Ue=["xlink:href"],Ge=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(z){const g=z,u=e.computed(()=>({backgroundColor:g.backgroundColor})),d=e.computed(()=>`#${g.prefix}-${g.name}`),h=e.computed(()=>{const{size:x}=g;let _=`${x}`;return _=`${_.replace("px","")}px`,{width:_,height:_}});return(x,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:x.active}]),style:e.normalizeStyle(u.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[x.$attrs.class,x.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(h.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Ue)],6))],6))}}),N=oe._export_sfc(Ge,[["__scopeId","data-v-3150a90b"]]),je={class:"obj-viewer-container"},qe={class:"buttonGroup-top"},Xe={class:"buttonGroup-topLeft"},He={class:"buttonGroup-left"},Ye={class:"buttonGroup-right"},Ze={class:"buttonGroup-bottom"},We={class:"left-panel"},Ke={class:"panel-header"},Qe={key:1,class:"clipping-content"},et={class:"radio-group"},tt={class:"radio-label"},nt={class:"radio-label"},at={class:"radio-label"},ot={class:"radio-label"},lt={class:"right-panel"},st={class:"panel-header"},it={key:0,class:"loading-overlay"},rt={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(z,{expose:g,emit:u}){const d=u;let h=null,x=!1;const _=e.ref(null),c=e.ref(!1),C=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),S=e.ref(""),E=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:P,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ge(_),{isAnimating:J,toggleAnimation:G,stopAnimation:Y}=he(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:b,updateClippingPlanes:B}=ye(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=ve.useModelLoader(A,y,c,C,L),Z=()=>{if(F.value||y.value.length===0)return;F.value=!0,J.value&&Y();const{camera:s,controls:a}=A();if(!s||!a)return;a.enabled=!0;const w=H=>H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2,U=s.position.clone(),T=a.target.clone(),W=1500,R=Date.now(),M=()=>{const H=Date.now()-R,K=Math.min(H/W,1),te=w(K);s.position.lerpVectors(U,t.value,te),a.target.lerpVectors(T,p.value,te),K<1?requestAnimationFrame(M):F.value=!1};M()},ee=async()=>x?Promise.resolve():new Promise(s=>{const a=()=>{x?s():requestAnimationFrame(a)};a()}),le=async(s,a)=>{try{await ee(),J.value&&Y(),m.value&&b();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},re=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,S.value=s,s==="剖面视图"&&!m.value&&b()},i=s=>{E.value=!0,r.value=s,s==="动画仿真"&&d("getAnimationData")},V=()=>{e.nextTick(()=>{var s;(s=k.value)==null||s.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{f(),h=A().scene,x=!0,window.addEventListener("resize",P)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,S.value="",r.value="",window.removeEventListener("resize",P),J.value&&Y(),$()}),g({addModelsFromUrls:re,loadModelByDefaultPath:o}),(s,a)=>{var U,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",je,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:_,class:"threejs-container"},null,512),e.createElementVNode("div",qe,[e.createVNode(N,{name:"guanjianjiexi",size:"34"}),e.createVNode(N,{name:"guanjiekongzhi",size:"34"}),e.createVNode(N,{name:"gongyishengcheng",size:"34"}),e.createVNode(N,{name:"buchangshezhi",size:"34"}),e.createVNode(N,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",Xe,[e.createVNode(N,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(N,{name:"fangda",size:"24",title:"放大"}),e.createVNode(N,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(N,{name:"lookAround",size:"24",onClick:e.unref(G),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",He,[e.createVNode(N,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&S.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(N,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&S.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",Ye,[e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:E.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:E.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ze,[e.createVNode(N,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(U=k.value)==null?void 0:U.fastBackward},null,8,["onClick"]),e.createVNode(N,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(N,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(N,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(N,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(R=k.value)==null?void 0:R.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",We,[e.createElementVNode("div",Ke,[e.createElementVNode("span",null,e.toDisplayString(S.value),1),e.createElementVNode("span",{class:"close",onClick:a[6]||(a[6]=M=>D.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[S.value==="场景树"?(e.openBlock(),e.createBlock(Oe,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),S.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Qe,[e.createElementVNode("div",et,[e.createElementVNode("label",tt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":a[7]||(a[7]=M=>e.isRef(l)?l.value=M:null),onChange:a[8]||(a[8]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[16]||(a[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":a[9]||(a[9]=M=>e.isRef(l)?l.value=M:null),onChange:a[10]||(a[10]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[17]||(a[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",at,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":a[11]||(a[11]=M=>e.isRef(l)?l.value=M:null),onChange:a[12]||(a[12]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[18]||(a[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",ot,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":a[13]||(a[13]=M=>e.isRef(l)?l.value=M:null),onChange:a[14]||(a[14]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[19]||(a[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,D.value]]),e.withDirectives(e.createElementVNode("div",lt,[e.createElementVNode("div",st,[e.createElementVNode("span",null,e.toDisplayString(r.value),1),e.createElementVNode("span",{class:"close",onClick:a[15]||(a[15]=M=>E.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Le,{ref_key:"jointRef",ref:k,model:e.unref(q),scene:e.unref(h),animationData:z.animationData},null,8,["model","scene","animationData"]),[[e.vShow,r.value==="关节控制"]]),e.withDirectives(e.createVNode(Ve,{animationData:z.animationData},null,8,["animationData"]),[[e.vShow,r.value==="动画仿真"]])]),_:1})],512),[[e.vShow,E.value]]),c.value?(e.openBlock(),e.createElementBlock("div",it,[a[20]||(a[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(C.value),1)])):e.createCommentVNode("",!0)])}}},ct=oe._export_sfc(rt,[["__scopeId","data-v-7bc47bb3"]]);exports.default=ct;
|