ss-component-new 1.2.96 → 1.2.98
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-8qht74Q7.js → MTLLoader-CCS24gLm.js} +1 -1
- package/dist/{MTLLoader-BmycYKH6.cjs → MTLLoader-DlcJK6vT.cjs} +1 -1
- package/dist/{OrbitControls-Bzn7u6zE.cjs → OrbitControls-BLs9AYBY.cjs} +1 -1
- package/dist/{OrbitControls-BjJ79rTx.js → OrbitControls-KkyEKP5M.js} +1 -1
- package/dist/{animationData-0jCpD3l0.js → animationData-Btgynl98.js} +3 -3
- package/dist/{animationData-CAppfuqr.cjs → animationData-CCImpyvS.cjs} +1 -1
- package/dist/{array-Dg-eQLeS.cjs → array-CYnA_0YM.cjs} +1 -1
- package/dist/{array-Cn-xxeGh.js → array-jPdolPpm.js} +1 -1
- package/dist/{dataUtil-BFP1At6d.cjs → dataUtil-B4sGo38_.cjs} +1 -1
- package/dist/{dataUtil-C4lMM2nY.js → dataUtil-DQX9rTvE.js} +1 -1
- package/dist/{iconfont-m9s2eWSa.js → iconfont-B8CQB3CO.js} +2 -2
- package/dist/{iconfont-CYyOVK2s.cjs → iconfont-BXzhYF5A.cjs} +1 -1
- package/dist/{index-1l1PVuvD.js → index--JyaPE1g.js} +1 -1
- package/dist/{index-6Chvz-6H.cjs → index-1TxthiQw.cjs} +1 -1
- package/dist/{index-Bvvx3SbS.cjs → index-2wJBzGa-.cjs} +1 -1
- package/dist/{index-D-7WLmXf.cjs → index-6sDAnob5.cjs} +1 -1
- package/dist/{index-ykiHcw47.cjs → index-7ZZHuv4d.cjs} +1 -1
- package/dist/{index-CTh_Ncuz.cjs → index-B21qNg4A.cjs} +1 -1
- package/dist/{index-B01K_q9I.js → index-B4YN6ElV.js} +2 -2
- package/dist/{index-j16y0mCJ.cjs → index-B8XDW6Ly.cjs} +1 -1
- package/dist/{index-C0g2wZa2.js → index-BCNDy7LZ.js} +1 -1
- package/dist/{index-traVr_lk.cjs → index-BMSOMrGq.cjs} +1 -1
- package/dist/{index-BayQ6HRi.js → index-BXfKtvF-.js} +1 -1
- package/dist/{index-C8dRWVYa.cjs → index-B_WRw_3s.cjs} +1 -1
- package/dist/{index-ii79t_b4.cjs → index-BaXxrBtb.cjs} +1 -1
- package/dist/{index-B-gCmSbm.js → index-Bk8CKDbz.js} +7 -7
- package/dist/{index-i247pLsX.js → index-BkPXyAKD.js} +2 -2
- package/dist/{index-Df60duTb.js → index-BxZ-k8Ww.js} +1 -1
- package/dist/{index-C3pEzgj_.js → index-C9U9aO2Y.js} +5 -5
- package/dist/{index-DijDlKaY.js → index-CAAOZFSQ.js} +19 -19
- package/dist/{index-DMwTF1Hl.cjs → index-CGRb8BQx.cjs} +1 -1
- package/dist/{index-TGJkSdz2.js → index-CJOQxUog.js} +2 -2
- package/dist/{index-D98HbHeq.js → index-CLddyFrz.js} +3 -3
- package/dist/{index-DEX2MMzx.js → index-CSQJCfDf.js} +1 -1
- package/dist/{index-C3nNOYlY.js → index-CUAM_spJ.js} +3 -3
- package/dist/{index-FKHrqiVz.js → index-CV2JWX-7.js} +1 -1
- package/dist/{index-Bag6byEJ.cjs → index-CWJuJJYp.cjs} +1 -1
- package/dist/{index-DJSzUDVP.cjs → index-CYmbZuJq.cjs} +1 -1
- package/dist/{index-PUTWsBgd.cjs → index-C_rjTaFu.cjs} +1 -1
- package/dist/{index-D0NuMuh5.js → index-CcwTi2WJ.js} +1 -1
- package/dist/{index-CaaRetWn.js → index-Cmlus98m.js} +5 -5
- package/dist/{index-B_GqgLqE.cjs → index-CnBVZu9x.cjs} +1 -1
- package/dist/{index-DlnbkEM7.cjs → index-Cw3gRBT3.cjs} +1 -1
- package/dist/{index-BIvGwNqR.js → index-Cz7uQ_eD.js} +11 -11
- package/dist/{index-BnLOogVf.cjs → index-DMTBVsgY.cjs} +1 -1
- package/dist/{index-Bg0aEQlB.js → index-DRizRbU3.js} +1 -1
- package/dist/{index-CQm-J0AU.cjs → index-DRjN9mko.cjs} +1 -1
- package/dist/{index-VzkNVYhI.cjs → index-DThE5nRZ.cjs} +1 -1
- package/dist/{index-BgKE_tia.js → index-DXrBVvWh.js} +5 -5
- package/dist/{index-Dgpx-Hra.js → index-DZf4BLpR.js} +8 -8
- package/dist/{index-5hihfJxO.cjs → index-DcxUbnrO.cjs} +1 -1
- package/dist/{index-Bt57uQ3d.js → index-DdQjdsrn.js} +2 -2
- package/dist/{index-BdvqBTDW.js → index-Dggo7EaF.js} +2 -2
- package/dist/{index-DY8hmk1Q.cjs → index-DhufphmT.cjs} +1 -1
- package/dist/{index-D-7Puf0_.cjs → index-DvQRFx9T.cjs} +1 -1
- package/dist/{index-CSZdFHsD.cjs → index-DwFpQNpA.cjs} +1 -1
- package/dist/{index-3JUnbgIT.cjs → index-FnJX1FLR.cjs} +1 -1
- package/dist/{index-B0eWCQHx.js → index-JQ_SaJ0O.js} +2 -2
- package/dist/{index-BjjK_8u-.cjs → index-a6bC3A9D.cjs} +1 -1
- package/dist/{index-M8PsQPdI.js → index-blVMOcaF.js} +2 -2
- package/dist/{index-dme4eW3i.cjs → index-eaKFpHpQ.cjs} +1 -1
- package/dist/{index-MCoX9dAt.js → index-hbpC0O70.js} +5 -5
- package/dist/{index-B7d98_nQ.cjs → index-k579sq5M.cjs} +1 -1
- package/dist/{index-CO1At3Qt.cjs → index-nSLXu4eq.cjs} +1 -1
- package/dist/{index-CIu1uGjo.js → index-tUUpniUl.js} +1 -1
- package/dist/{index-oIwmn1U8.js → index-uWijQ8Cy.js} +4 -4
- package/dist/{index-DgnURGHM.cjs → index-yWC1EX2L.cjs} +1 -1
- package/dist/{index-D6G3wQov.js → index-zsvDrZxo.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-BweLdgQg.cjs → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-BKdUW522.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-Bln4NQBz.js → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-DPDuWtDv.js} +11 -11
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DFR9Kcwi.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CmofVWvn.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C2CSvQmH.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Y4oIHCVM.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-BNgp6mzJ.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-D0zznqn6.js} +5 -5
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-CPnq8zy9.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-YB8ip9Xh.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-DBVG4Icj.cjs → index.vue_vue_type_style_index_1_lang-B8_elAaU.cjs} +5 -5
- package/dist/{index.vue_vue_type_style_index_1_lang-Dk-QY9vy.cjs → index.vue_vue_type_style_index_1_lang-BB0IwRdP.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-D0fEUDml.js → index.vue_vue_type_style_index_1_lang-CT8c_mLo.js} +4 -4
- package/dist/{index.vue_vue_type_style_index_1_lang-Bjoq8geZ.js → index.vue_vue_type_style_index_1_lang-Cg1p_3ne.js} +159 -163
- package/dist/{main-Da2N7L0r.cjs → main-BOuiQUiL.cjs} +1 -1
- package/dist/{main-Dc3xXHlm.js → main-CbZLyXuF.js} +4 -4
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +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-Db0eOtGe.js → threeModel-BJ6MrCa-.js} +4 -4
- package/dist/{threeModel-B5m5e2r3.cjs → threeModel-i87HG3Ck.cjs} +1 -1
- package/dist/{threePreview-CIuFqz2p.cjs → threePreview-B3v9SadK.cjs} +1 -1
- package/dist/{threePreview-Bd5BpbCA.js → threePreview-D3wObBZq.js} +309 -305
- package/dist/{threeSceneView-mXWAjDOa.js → threeSceneView-DDpjEIgl.js} +11 -11
- package/dist/{threeSceneView-ClZqVdCB.cjs → threeSceneView-DQpyKixe.cjs} +2 -2
- package/dist/{threeSceneViewForCPMPIP-DAYVqOg4.js → threeSceneViewForCPMPIP-DV_aOUU5.js} +202 -198
- package/dist/threeSceneViewForCPMPIP-iaIkud0j.cjs +5 -0
- package/dist/{threeTrackPathView-BypIKggF.js → threeTrackPathView-D6aAG4g8.js} +375 -359
- package/dist/threeTrackPathView-nPb7Tgdd.cjs +370 -0
- package/dist/{threeViewerHost-CG9MEd0B.cjs → threeViewerHost-I50ZyvKF.cjs} +2 -2
- package/dist/{threeViewerHost-D8aKuUdC.js → threeViewerHost-XR9tepbY.js} +3 -3
- package/dist/{urdfTree-CXBSDiJj.cjs → urdfTree-B19ebCHj.cjs} +1 -1
- package/dist/{urdfTree-DxLmsFUL.js → urdfTree-CjxhpnRl.js} +1 -1
- package/dist/{workpieceTreePanel-C0gVhVe8.cjs → workpieceTreePanel-0L7tkycK.cjs} +1 -1
- package/dist/{workpieceTreePanel-u_fWFvEp.js → workpieceTreePanel-DAnMGvlX.js} +5 -5
- package/package.json +1 -1
- package/dist/threeSceneViewForCPMPIP-Cs2p48GK.cjs +0 -5
- package/dist/threeTrackPathView-CC7mxoKt.cjs +0 -370
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=Object.defineProperty;var oe=(b,n,o)=>n in b?te(b,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):b[n]=o;var j=(b,n,o)=>oe(b,typeof n!="symbol"?n+"":n,o);const se=require("./index.vue_vue_type_style_index_1_lang-Dk-QY9vy.cjs"),U=require("./MTLLoader-BmycYKH6.cjs"),C=require("./threeViewerHost-CG9MEd0B.cjs"),R=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C2CSvQmH.cjs"),e=require("vue"),D=require("./iconfont-CYyOVK2s.cjs"),le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function ne(b){const{mtlUrl:n,manager:o,resourcePath:l,onLoad:m,onProgress:r,onError:w}=b,p=new U.MTLLoader(o);return l&&p.setResourcePath(l),p.load(n,m,r,w),p}function ie(b){const{objUrl:n,manager:o,materials:l,onLoad:m,onProgress:r,onError:w}=b,p=new U.OBJLoader(o);return l&&p.setMaterials(l),p.load(n,m,r,w),p}function ae(b){const{manager:n,baseFolderUrl:o,onFileProgress:l}=b,m=new se.URDFLoader(n);return m.packages=r=>`${o.endsWith("/")?o:o+"/"}${r}/`,m.loadMeshCb=(r,w,p)=>{const g=(()=>{const E=r.split("?")[0].split("#")[0],c=E.lastIndexOf(".");return c>=0?E.slice(c+1).toLowerCase():void 0})();switch(g){case"obj":{const E=(()=>{try{return new URL(".",r).toString()}catch{const a=r.lastIndexOf("/");return a>=0?r.slice(0,a+1):r}})(),c=(()=>{var d;return(((d=r.split("/").pop())==null?void 0:d.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${E}${c}.mtl`,h=a=>{ie({objUrl:r,manager:w,materials:a,onLoad:d=>p(d),onProgress:d=>l==null?void 0:l(r,d==null?void 0:d.loaded,d==null?void 0:d.total),onError:d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${r}`,d),p(new R.Group)}})};ne({mtlUrl:f,manager:w,resourcePath:E,onLoad:a=>{try{a.preload()}catch{}h(a)},onProgress:a=>l==null?void 0:l(f,a==null?void 0:a.loaded,a==null?void 0:a.total),onError:a=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),h(void 0)}});break}case"stl":{new U.STLLoader(w).load(r,c=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),h=new R.Mesh(c,f);h.castShadow=!0,h.receiveShadow=!0,p(h)},c=>l==null?void 0:l(r,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${r}`,c),p(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${r})`),p(new R.Group)}},m}function ce(b,n,o,l){return{loadSceneFromFile:r=>new Promise((w,p)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,E=0,c=null;const f=new R.LoadingManager;f.onStart=(a,d,V)=>{g=V||0,E=d||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(a,d,V)=>{E=d,g=V;const L=`正在加载 ${d} / ${V} 个文件: ${C.getFilenameFromUrl(a)}`;l.value=L,d===V&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(c){c.updateMatrixWorld(!0);const v=new R.Box3().setFromObject(c);v.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),c.userData.boundingBox=v,c.traverse(u=>{u.isMesh&&(u.castShadow=!0,u.receiveShadow=!0)}),w(c)}else p(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=a=>{console.warn(`LoadingManager 报告一个资源加载失败: ${a}。加载流程将继续。`)};const h=(a,d,V)=>{const L=C.getFilenameFromUrl(a);let v;V&&V>0?v=`${L}(${C.formatBytes(d)} / ${C.formatBytes(V)})`:d&&d>0?v=`${L}(已下载 ${C.formatBytes(d)})`:v=`${L}`,l.value=`正在下载第 ${E+1} / ${g} 个文件: ${v}`};try{const a=URL.createObjectURL(r);ae({manager:f,baseFolderUrl:re,onFileProgress:h}).load(a,V=>{c=V},void 0,V=>{console.error(`加载 URDF 文件 (${r.name}) 时发生致命错误:`,V),l.value="URDF 文件解析失败",o.value=!1,p(new Error(`加载 URDF 文件失败: ${r.name}`))})}catch(a){console.error("初始化 URDF 加载时发生致命错误:",a),l.value="模型加载失败",o.value=!1,p(a)}})}}function de(b,n,o,l=["URDFVisual"]){let m=null;const r=e.ref(null),w=new R.Raycaster,p=new R.Vector2,g=new Map;function E(){o.value.forEach(v=>{v.traverse(u=>{l!=null&&l.includes(u.type)&&g.set(u.id,{obj:u,axis:u.axis||new R.Vector3(1,0,0),limits:u.limits})})})}function c(v){r.value&&r.value.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(0))}),r.value=v,v.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(65280))})}function f(v){const u=b.value.getBoundingClientRect();p.x=(v.clientX-u.left)/u.width*2-1,p.y=-((v.clientY-u.top)/u.height)*2+1,w.setFromCamera(p,m);const t=w.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,_=null;for(;s;){if(g.has(s.id)){_=g.get(s.id);break}s=s.parent}_&&c(_)}function h(){b.value&&b.value.removeEventListener("click",f,!1)}function a(){const{scene:v,camera:u}=n();m=u,E(),b.value&&b.value.addEventListener("click",f,!1)}function d(v){r.value&&(r.value.obj.visible=v)}function V(v){var s;const{axis:u,value:t}=v;D.updateObjectPosition((s=r.value)==null?void 0:s.obj,u,t)}function L(v){var s;const{axis:u,value:t}=v;D.updateObjectRotation((s=r.value)==null?void 0:s.obj,u,t)}return{initRaycaster:a,dispose:h,selectedObject3D:r,setSelectedObjVisible:d,updatePosition:V,updateRotation:L}}const ue={SINGLE:"单机",DOUBLE:"双机"},me={ROBOT:1,PIPECOMPARSION:2};class pe{constructor(n){j(this,"robot");j(this,"movableJoints");this.robot=n,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(n=>n.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(n=>n.name)}setJointAngle(n,o){const l=this.robot.joints[n];if(!l||l.jointType==="fixed")return console.warn(`关节 ${n} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${n} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(n){Object.entries(n).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const n={};return this.movableJoints.forEach(o=>{n[o.name]=o.angle||0}),n}resetToZero(){this.movableJoints.forEach(n=>{n.setJointValue(0)})}getJointLimits(n){const o=this.robot.joints[n];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(n,o=1e3,l){const m=this.getCurrentJointStates(),r=Date.now();return new Promise(w=>{const p=()=>{const g=Date.now()-r,E=Math.min(g/o,1),c=this.easeInOutCubic(E),f={};Object.keys(n).forEach(h=>{const a=m[h]||0,d=n[h];f[h]=a+(d-a)*c}),this.setJointAngles(f),l&&l(E),E<1?requestAnimationFrame(p):w()};p()})}easeInOutCubic(n){return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}async playSequence(n,o=1e3,l){for(let m=0;m<n.length;m++)await this.animateToState(n[m],o,r=>{l&&l(m,r)})}}const ve={class:"panel-content"},fe={class:"obj"},be={key:0,class:"obj-base"},_e=["title"],we=["title"],Ee={key:1},he={class:"obj-position"},Ve={class:"coord-item"},ge={class:"coord-item"},ye={class:"coord-item"},Ne={class:"obj-rotation"},Le={class:"coord-item"},Re={class:"coord-item"},Se={class:"coord-item"},Ce={class:"world"},je={class:"coord-line"},De={class:"coord-text"},Ue={class:"world-position-item"},Me={class:"world-position-item"},Fe={class:"world-position-item"},$e={class:"coord-line"},Oe={class:"coord-text"},xe={class:"world-rotation-item"},Je={class:"world-rotation-item"},Te={class:"world-rotation-item"},ke=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(b,{emit:n}){const o=b,l=n,m=e.ref([]),r=e.ref({}),w=(t,s=0)=>{const _=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(i=>{if(!(i!=null&&i.isMesh)){const y={name:i==null?void 0:i.name,label:(i==null?void 0:i.name)||(i==null?void 0:i.type),show:!0,level:s+1,isPenultimate:!1,type:i==null?void 0:i.type,id:i==null?void 0:i.id,limit:(i==null?void 0:i.limit)??"",children:w(i==null?void 0:i.children,s+1),path:i==null?void 0:i.name};_.push(y)}}),_},p=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level: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:w(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const _=[],i=[...t];for(;i.length>0&&_.length<s;){const y=i.shift();y.children&&y.children.length>0&&(_.push(y.id),i.push(...y.children))}return _},E=(t,s)=>{const _=[];return t.forEach(i=>{if(i.children&&i.children.length>0){_.push(i.id);const y=i.children.filter(S=>S.children&&S.children.length>0).slice(0,s).map(S=>S.id);_.push(...y)}}),_.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?E(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const c=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,h=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},a=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},d=t=>{l("visibleChange",t)},V=e.computed(()=>o!=null&&o.model?p(o.model):[]),L=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),v=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),u=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(r.value=D.getObject3DData(o.model))},{deep:!0,immediate:!0}),e.watch(V,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var S,M,F,$,O,x,J,T,k,P,B,z,I,A,q,W,G,X,Y,Z,H,K,Q,ee;const _=e.resolveComponent("el-divider"),i=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(_,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",{class:"obj-name",title:L.value},e.toDisplayString(L.value),9,_e),e.createElementVNode("div",{class:"obj-type",title:v.value},"["+e.toDisplayString(v.value)+"]",9,we)])):(e.openBlock(),e.createElementBlock("div",Ee,"空")),e.createVNode(i,{"model-value":u.value,onChange:d},null,8,["model-value"])]),e.createVNode(_,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",he,[e.createElementVNode("div",Ve,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":c((M=(S=r.value)==null?void 0:S.position)==null?void 0:M.x),onChange:s[0]||(s[0]=N=>h(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":c(($=(F=r.value)==null?void 0:F.position)==null?void 0:$.y),onChange:s[1]||(s[1]=N=>h(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ye,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":c((x=(O=r.value)==null?void 0:O.position)==null?void 0:x.z),onChange:s[2]||(s[2]=N=>h(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",Ne,[e.createElementVNode("div",Le,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((T=(J=r.value)==null?void 0:J.rotation)==null?void 0:T.x),onChange:s[3]||(s[3]=N=>a(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Re,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((P=(k=r.value)==null?void 0:k.rotation)==null?void 0:P.y),onChange:s[4]||(s[4]=N=>a(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((z=(B=r.value)==null?void 0:B.rotation)==null?void 0:z.z),onChange:s[5]||(s[5]=N=>a(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",Ce,[e.createElementVNode("div",je,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",De,[e.createElementVNode("div",Ue,e.toDisplayString(c((A=(I=r.value)==null?void 0:I.worldPosition)==null?void 0:A.x))+", ",1),e.createElementVNode("div",Me,e.toDisplayString(c((W=(q=r.value)==null?void 0:q.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Fe,e.toDisplayString(c((X=(G=r.value)==null?void 0:G.worldPosition)==null?void 0:X.z)),1)])]),e.createElementVNode("div",$e,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Oe,[e.createElementVNode("div",xe,e.toDisplayString(f((Z=(Y=r.value)==null?void 0:Y.worldRotation)==null?void 0:Z.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((K=(H=r.value)==null?void 0:H.worldRotation)==null?void 0:K.y))+"°, ",1),e.createElementVNode("div",Te,e.toDisplayString(f((ee=(Q=r.value)==null?void 0:Q.worldRotation)==null?void 0:ee.z))+"° ",1)])])])])}}}),Pe=le._export_sfc(ke,[["__scopeId","data-v-00d48931"]]);exports.URDFRobotController=pe;exports.WorkpieceTreePanel=Pe;exports.robotMode=ue;exports.sceneType=me;exports.useRaycaster=de;exports.useUrdfLoader=ce;
|
|
1
|
+
"use strict";var te=Object.defineProperty;var oe=(b,n,o)=>n in b?te(b,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):b[n]=o;var j=(b,n,o)=>oe(b,typeof n!="symbol"?n+"":n,o);const se=require("./index.vue_vue_type_style_index_1_lang-BB0IwRdP.cjs"),U=require("./MTLLoader-DlcJK6vT.cjs"),C=require("./threeViewerHost-I50ZyvKF.cjs"),R=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Y4oIHCVM.cjs"),e=require("vue"),D=require("./iconfont-BXzhYF5A.cjs"),le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function ne(b){const{mtlUrl:n,manager:o,resourcePath:l,onLoad:m,onProgress:r,onError:w}=b,p=new U.MTLLoader(o);return l&&p.setResourcePath(l),p.load(n,m,r,w),p}function ie(b){const{objUrl:n,manager:o,materials:l,onLoad:m,onProgress:r,onError:w}=b,p=new U.OBJLoader(o);return l&&p.setMaterials(l),p.load(n,m,r,w),p}function ae(b){const{manager:n,baseFolderUrl:o,onFileProgress:l}=b,m=new se.URDFLoader(n);return m.packages=r=>`${o.endsWith("/")?o:o+"/"}${r}/`,m.loadMeshCb=(r,w,p)=>{const g=(()=>{const E=r.split("?")[0].split("#")[0],c=E.lastIndexOf(".");return c>=0?E.slice(c+1).toLowerCase():void 0})();switch(g){case"obj":{const E=(()=>{try{return new URL(".",r).toString()}catch{const a=r.lastIndexOf("/");return a>=0?r.slice(0,a+1):r}})(),c=(()=>{var d;return(((d=r.split("/").pop())==null?void 0:d.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${E}${c}.mtl`,h=a=>{ie({objUrl:r,manager:w,materials:a,onLoad:d=>p(d),onProgress:d=>l==null?void 0:l(r,d==null?void 0:d.loaded,d==null?void 0:d.total),onError:d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${r}`,d),p(new R.Group)}})};ne({mtlUrl:f,manager:w,resourcePath:E,onLoad:a=>{try{a.preload()}catch{}h(a)},onProgress:a=>l==null?void 0:l(f,a==null?void 0:a.loaded,a==null?void 0:a.total),onError:a=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),h(void 0)}});break}case"stl":{new U.STLLoader(w).load(r,c=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),h=new R.Mesh(c,f);h.castShadow=!0,h.receiveShadow=!0,p(h)},c=>l==null?void 0:l(r,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${r}`,c),p(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${r})`),p(new R.Group)}},m}function ce(b,n,o,l){return{loadSceneFromFile:r=>new Promise((w,p)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,E=0,c=null;const f=new R.LoadingManager;f.onStart=(a,d,V)=>{g=V||0,E=d||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(a,d,V)=>{E=d,g=V;const L=`正在加载 ${d} / ${V} 个文件: ${C.getFilenameFromUrl(a)}`;l.value=L,d===V&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(c){c.updateMatrixWorld(!0);const v=new R.Box3().setFromObject(c);v.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),c.userData.boundingBox=v,c.traverse(u=>{u.isMesh&&(u.castShadow=!0,u.receiveShadow=!0)}),w(c)}else p(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=a=>{console.warn(`LoadingManager 报告一个资源加载失败: ${a}。加载流程将继续。`)};const h=(a,d,V)=>{const L=C.getFilenameFromUrl(a);let v;V&&V>0?v=`${L}(${C.formatBytes(d)} / ${C.formatBytes(V)})`:d&&d>0?v=`${L}(已下载 ${C.formatBytes(d)})`:v=`${L}`,l.value=`正在下载第 ${E+1} / ${g} 个文件: ${v}`};try{const a=URL.createObjectURL(r);ae({manager:f,baseFolderUrl:re,onFileProgress:h}).load(a,V=>{c=V},void 0,V=>{console.error(`加载 URDF 文件 (${r.name}) 时发生致命错误:`,V),l.value="URDF 文件解析失败",o.value=!1,p(new Error(`加载 URDF 文件失败: ${r.name}`))})}catch(a){console.error("初始化 URDF 加载时发生致命错误:",a),l.value="模型加载失败",o.value=!1,p(a)}})}}function de(b,n,o,l=["URDFVisual"]){let m=null;const r=e.ref(null),w=new R.Raycaster,p=new R.Vector2,g=new Map;function E(){o.value.forEach(v=>{v.traverse(u=>{l!=null&&l.includes(u.type)&&g.set(u.id,{obj:u,axis:u.axis||new R.Vector3(1,0,0),limits:u.limits})})})}function c(v){r.value&&r.value.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(0))}),r.value=v,v.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(65280))})}function f(v){const u=b.value.getBoundingClientRect();p.x=(v.clientX-u.left)/u.width*2-1,p.y=-((v.clientY-u.top)/u.height)*2+1,w.setFromCamera(p,m);const t=w.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,_=null;for(;s;){if(g.has(s.id)){_=g.get(s.id);break}s=s.parent}_&&c(_)}function h(){b.value&&b.value.removeEventListener("click",f,!1)}function a(){const{scene:v,camera:u}=n();m=u,E(),b.value&&b.value.addEventListener("click",f,!1)}function d(v){r.value&&(r.value.obj.visible=v)}function V(v){var s;const{axis:u,value:t}=v;D.updateObjectPosition((s=r.value)==null?void 0:s.obj,u,t)}function L(v){var s;const{axis:u,value:t}=v;D.updateObjectRotation((s=r.value)==null?void 0:s.obj,u,t)}return{initRaycaster:a,dispose:h,selectedObject3D:r,setSelectedObjVisible:d,updatePosition:V,updateRotation:L}}const ue={SINGLE:"单机",DOUBLE:"双机"},me={ROBOT:1,PIPECOMPARSION:2};class pe{constructor(n){j(this,"robot");j(this,"movableJoints");this.robot=n,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(n=>n.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(n=>n.name)}setJointAngle(n,o){const l=this.robot.joints[n];if(!l||l.jointType==="fixed")return console.warn(`关节 ${n} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${n} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(n){Object.entries(n).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const n={};return this.movableJoints.forEach(o=>{n[o.name]=o.angle||0}),n}resetToZero(){this.movableJoints.forEach(n=>{n.setJointValue(0)})}getJointLimits(n){const o=this.robot.joints[n];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(n,o=1e3,l){const m=this.getCurrentJointStates(),r=Date.now();return new Promise(w=>{const p=()=>{const g=Date.now()-r,E=Math.min(g/o,1),c=this.easeInOutCubic(E),f={};Object.keys(n).forEach(h=>{const a=m[h]||0,d=n[h];f[h]=a+(d-a)*c}),this.setJointAngles(f),l&&l(E),E<1?requestAnimationFrame(p):w()};p()})}easeInOutCubic(n){return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}async playSequence(n,o=1e3,l){for(let m=0;m<n.length;m++)await this.animateToState(n[m],o,r=>{l&&l(m,r)})}}const ve={class:"panel-content"},fe={class:"obj"},be={key:0,class:"obj-base"},_e=["title"],we=["title"],Ee={key:1},he={class:"obj-position"},Ve={class:"coord-item"},ge={class:"coord-item"},ye={class:"coord-item"},Ne={class:"obj-rotation"},Le={class:"coord-item"},Re={class:"coord-item"},Se={class:"coord-item"},Ce={class:"world"},je={class:"coord-line"},De={class:"coord-text"},Ue={class:"world-position-item"},Me={class:"world-position-item"},Fe={class:"world-position-item"},$e={class:"coord-line"},Oe={class:"coord-text"},xe={class:"world-rotation-item"},Je={class:"world-rotation-item"},Te={class:"world-rotation-item"},ke=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(b,{emit:n}){const o=b,l=n,m=e.ref([]),r=e.ref({}),w=(t,s=0)=>{const _=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(i=>{if(!(i!=null&&i.isMesh)){const y={name:i==null?void 0:i.name,label:(i==null?void 0:i.name)||(i==null?void 0:i.type),show:!0,level:s+1,isPenultimate:!1,type:i==null?void 0:i.type,id:i==null?void 0:i.id,limit:(i==null?void 0:i.limit)??"",children:w(i==null?void 0:i.children,s+1),path:i==null?void 0:i.name};_.push(y)}}),_},p=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level: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:w(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const _=[],i=[...t];for(;i.length>0&&_.length<s;){const y=i.shift();y.children&&y.children.length>0&&(_.push(y.id),i.push(...y.children))}return _},E=(t,s)=>{const _=[];return t.forEach(i=>{if(i.children&&i.children.length>0){_.push(i.id);const y=i.children.filter(S=>S.children&&S.children.length>0).slice(0,s).map(S=>S.id);_.push(...y)}}),_.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?E(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const c=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,h=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},a=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},d=t=>{l("visibleChange",t)},V=e.computed(()=>o!=null&&o.model?p(o.model):[]),L=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),v=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),u=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(r.value=D.getObject3DData(o.model))},{deep:!0,immediate:!0}),e.watch(V,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var S,M,F,$,O,x,J,T,k,P,B,z,I,A,q,W,G,X,Y,Z,H,K,Q,ee;const _=e.resolveComponent("el-divider"),i=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(_,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",{class:"obj-name",title:L.value},e.toDisplayString(L.value),9,_e),e.createElementVNode("div",{class:"obj-type",title:v.value},"["+e.toDisplayString(v.value)+"]",9,we)])):(e.openBlock(),e.createElementBlock("div",Ee,"空")),e.createVNode(i,{"model-value":u.value,onChange:d},null,8,["model-value"])]),e.createVNode(_,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",he,[e.createElementVNode("div",Ve,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":c((M=(S=r.value)==null?void 0:S.position)==null?void 0:M.x),onChange:s[0]||(s[0]=N=>h(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":c(($=(F=r.value)==null?void 0:F.position)==null?void 0:$.y),onChange:s[1]||(s[1]=N=>h(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ye,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":c((x=(O=r.value)==null?void 0:O.position)==null?void 0:x.z),onChange:s[2]||(s[2]=N=>h(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",Ne,[e.createElementVNode("div",Le,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((T=(J=r.value)==null?void 0:J.rotation)==null?void 0:T.x),onChange:s[3]||(s[3]=N=>a(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Re,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((P=(k=r.value)==null?void 0:k.rotation)==null?void 0:P.y),onChange:s[4]||(s[4]=N=>a(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((z=(B=r.value)==null?void 0:B.rotation)==null?void 0:z.z),onChange:s[5]||(s[5]=N=>a(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",Ce,[e.createElementVNode("div",je,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",De,[e.createElementVNode("div",Ue,e.toDisplayString(c((A=(I=r.value)==null?void 0:I.worldPosition)==null?void 0:A.x))+", ",1),e.createElementVNode("div",Me,e.toDisplayString(c((W=(q=r.value)==null?void 0:q.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Fe,e.toDisplayString(c((X=(G=r.value)==null?void 0:G.worldPosition)==null?void 0:X.z)),1)])]),e.createElementVNode("div",$e,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Oe,[e.createElementVNode("div",xe,e.toDisplayString(f((Z=(Y=r.value)==null?void 0:Y.worldRotation)==null?void 0:Z.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((K=(H=r.value)==null?void 0:H.worldRotation)==null?void 0:K.y))+"°, ",1),e.createElementVNode("div",Te,e.toDisplayString(f((ee=(Q=r.value)==null?void 0:Q.worldRotation)==null?void 0:ee.z))+"° ",1)])])])])}}}),Pe=le._export_sfc(ke,[["__scopeId","data-v-00d48931"]]);exports.URDFRobotController=pe;exports.WorkpieceTreePanel=Pe;exports.robotMode=ue;exports.sceneType=me;exports.useRaycaster=de;exports.useUrdfLoader=ce;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var ce = Object.defineProperty;
|
|
2
2
|
var de = (b, l, o) => l in b ? ce(b, l, { enumerable: !0, configurable: !0, writable: !0, value: o }) : b[l] = o;
|
|
3
3
|
var E = (b, l, o) => de(b, typeof l != "symbol" ? l + "" : l, o);
|
|
4
|
-
import { U as me } from "./index.vue_vue_type_style_index_1_lang-
|
|
5
|
-
import { S as ve, M as pe, O as fe } from "./MTLLoader-
|
|
6
|
-
import { f as re, h as F } from "./threeViewerHost-
|
|
7
|
-
import { a_ as be, u as J, o as we, k as he, B as _e, a$ as ge, Y as ye, V as Le } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
4
|
+
import { U as me } from "./index.vue_vue_type_style_index_1_lang-CT8c_mLo.js";
|
|
5
|
+
import { S as ve, M as pe, O as fe } from "./MTLLoader-CCS24gLm.js";
|
|
6
|
+
import { f as re, h as F } from "./threeViewerHost-XR9tepbY.js";
|
|
7
|
+
import { a_ as be, u as J, o as we, k as he, B as _e, a$ as ge, Y as ye, V as Le } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CmofVWvn.js";
|
|
8
8
|
import { ref as T, defineComponent as je, computed as M, watch as ue, resolveComponent as x, createElementBlock as k, openBlock as P, createVNode as S, createElementVNode as c, withCtx as O, createTextVNode as D, toDisplayString as $ } from "vue";
|
|
9
|
-
import { c as Re, e as Se, g as Ue } from "./iconfont-
|
|
9
|
+
import { c as Re, e as Se, g as Ue } from "./iconfont-B8CQB3CO.js";
|
|
10
10
|
import { _ as $e } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
11
11
|
const Ce = "http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";
|
|
12
12
|
function Me(b) {
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Me=require("./index.vue_vue_type_style_index_1_lang-DBVG4Icj.cjs"),U=require("./workpieceTreePanel-C0gVhVe8.cjs"),Q=require("./iconfont-CYyOVK2s.cjs"),f=require("./index-C8qRkCgn.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C2CSvQmH.cjs");const ee=require("./index-DY8hmk1Q.cjs"),H=require("./urdfTree-CXBSDiJj.cjs"),re=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),N=require("./svgIcon-CUM54R6L.cjs"),Be=require("./animationData-CAppfuqr.cjs"),ze=require("./MTLLoader-BmycYKH6.cjs"),se=require("./index-ykiHcw47.cjs"),$e={class:"panel-content"},Le={class:"action-bar"},Re={key:0,class:"animation-controls"},Ue={class:"control-row"},je={class:"control-row"},Ae={class:"frame-info"},Ie={class:"control-row"},Oe={key:1,class:"empty-state"},Fe={class:"dialog-footer"},qe=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(T,{expose:j}){const w=T,o=e.ref([]),C=e.ref(!1),_=e.ref(""),i=e.ref("stopped"),d=e.ref(0),D=e.ref(0),L=e.ref(10),g=e.ref(null);let m=0;const A=e.ref([]),I=e.computed(()=>w.model?H.getNonFixedJoints(w.model).map(r=>r.name):[]),M=e.computed(()=>[...I.value]),X=e.computed(()=>M.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
|
-
${M.value.join(" ")}
|
|
3
|
-
0 0 0 ...
|
|
4
|
-
1 2 3 ...`:"请先加载模型。"),B=e.computed(()=>o.value[d.value]||{});e.watch(()=>w.model,s=>{s?(g.value=new U.URDFRobotController(s),A.value=H.getAllLinkName(s),d.value=0):(g.value=null,A.value=[])},{immediate:!0});const z=s=>{if(s<0||s>=o.value.length){console.error(`帧索引 ${s} 超出范围`);return}const n=o.value[s];if(g.value){const r={};I.value.forEach(V=>{const v=parseFloat(n[V]);isNaN(v)||(r[V]=v)}),g.value.setJointAngles(r)}d.value=s,D.value=o.value.length>1?s/(o.value.length-1)*100:100},W=async s=>{try{for(let n=d.value;n<o.value.length;n++){if(s!==m)return;const r=o.value[n],V={};if(g.value)I.value.forEach(v=>{const p=parseFloat(r[v]);isNaN(p)||(V[v]=p)}),await g.value.animateToState(V,L.value,v=>{s===m&&(D.value=(n+v)/o.value.length*100)});else{if(await new Promise(v=>setTimeout(v,L.value)),s!==m)return;D.value=(n+1)/o.value.length*100}d.value=n}s===m&&(f.ElMessage.success("动画播放完成"),i.value="stopped",D.value=100)}catch(n){console.error("动画播放出错:",n),f.ElMessage.error("动画播放出错"),i.value="stopped"}},R=()=>{if(o.value.length===0){f.ElMessage.error("无动画数据");return}i.value==="stopped"&&(d.value=0,z(0)),i.value="playing",m++,W(m),f.ElMessage.info("动画播放中")},O=()=>{i.value==="playing"&&(m++,i.value="paused",f.ElMessage.info("动画已暂停"))},F=()=>{m++,i.value="stopped",d.value=0,D.value=0,z(0),f.ElMessage.info("动画已停止并重置")},P=()=>{i.value==="playing"?O():R()},y=s=>{m++,i.value="paused",z(s)},$=()=>{if(!_.value.trim()){f.ElMessage.warning("导入内容不能为空");return}const s=_.value.trim().split(`
|
|
5
|
-
`).filter(p=>p.trim()!=="");if(s.length<2){f.ElMessage.error("导入数据至少需要包含表头行和一行数据");return}const n=s[0].split(" ").map(p=>p.trim()),r={};if(n.forEach((p,u)=>{M.value.includes(p)&&(r[u]=p)}),Object.keys(r).length===0){f.ElMessage.error("没有找到匹配的表头,请检查表头名称是否正确");return}const v=s.slice(1).map(p=>{const u=p.split(" "),E={};return M.value.forEach(S=>{E[S]="0"}),Object.entries(r).forEach(([S,Y])=>{const q=u[parseInt(S)];q!==void 0&&q.trim()!==""&&(E[Y]=q.trim())}),E});v.length>0?(o.value=v,f.ElMessage.success(`成功导入 ${v.length} 行数据!`),C.value=!1,_.value="",F()):f.ElMessage.error("未能解析到有效数据,请检查格式。")};e.watch(()=>w.xyzbcList,()=>{w.xyzbcList&&(o.value=f.cloneDeep(w.xyzbcList))},{immediate:!0});const k=s=>`第 ${s+1} 帧`;return j({handlePlayPause:P,playAnimation:R,pauseAnimation:O,stopAnimation:F}),e.onUnmounted(()=>{m++}),(s,n)=>{const r=e.resolveComponent("el-input-number"),V=e.resolveComponent("el-slider"),v=e.resolveComponent("el-input"),p=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",$e,[e.createElementVNode("div",Le,[e.createVNode(ee._sfc_main,{onClick:n[0]||(n[0]=u=>C.value=!0),disabled:M.value.length===0,modelValue:"导入数据"},null,8,["disabled"])]),o.value.length>0?(e.openBlock(),e.createElementBlock("div",Re,[e.createElementVNode("div",Ue,[n[6]||(n[6]=e.createElementVNode("label",null,"帧间隔 (ms):",-1)),e.createVNode(r,{modelValue:L.value,"onUpdate:modelValue":n[1]||(n[1]=u=>L.value=u),min:10,max:5e3,step:100,size:"small",style:{width:"120px"}},null,8,["modelValue"])]),e.createElementVNode("div",je,[n[7]||(n[7]=e.createElementVNode("label",null,"当前帧:",-1)),e.createElementVNode("span",Ae,e.toDisplayString(d.value+1)+" / "+e.toDisplayString(o.value.length),1)]),e.createElementVNode("div",Ie,[n[8]||(n[8]=e.createElementVNode("label",null,"动画进度:",-1)),e.createVNode(V,{modelValue:d.value,"onUpdate:modelValue":n[2]||(n[2]=u=>d.value=u),min:0,max:o.value.length>0?o.value.length-1:0,step:1,"format-tooltip":k,onInput:y,disabled:o.value.length===0||i.value==="playing",style:{"flex-grow":"1",margin:"0 10px"}},null,8,["modelValue","max","disabled"])]),e.createElementVNode("div",null,[n[9]||(n[9]=e.createElementVNode("label",null,"当前帧数据:",-1)),e.createElementVNode("div",null,[B.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(B.value,(u,E)=>(e.openBlock(),e.createElementBlock("div",{key:E},e.toDisplayString(E)+": "+e.toDisplayString(u),1))),128)):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),o.value.length===0?(e.openBlock(),e.createElementBlock("div",Oe,n[10]||(n[10]=[e.createElementVNode("p",null,"请先导入数据",-1)]))):e.createCommentVNode("",!0),e.createVNode(p,{modelValue:C.value,"onUpdate:modelValue":n[5]||(n[5]=u=>C.value=u),title:"导入数据",width:"500px"},{footer:e.withCtx(()=>[e.createElementVNode("span",Fe,[e.createVNode(ee._sfc_main,{modelValue:"取消",onClick:n[4]||(n[4]=u=>C.value=!1)}),e.createVNode(ee._sfc_main,{modelValue:"确认导入",onClick:$,type:"primary"})])]),default:e.withCtx(()=>[n[11]||(n[11]=e.createElementVNode("p",{class:"import-instructions"}," 请从Excel或CSV中复制数据 (首行为表头, Tab分隔) ",-1)),e.createVNode(v,{modelValue:_.value,"onUpdate:modelValue":n[3]||(n[3]=u=>_.value=u),type:"textarea",rows:10,placeholder:X.value},null,8,["modelValue","placeholder"])]),_:1,__:[11]},8,["modelValue"])])}}}),ie=re._export_sfc(qe,[["__scopeId","data-v-06bc34b3"]]),Je=async T=>await new ze.OBJLoader().loadAsync(T),He=async T=>await Je(T),Xe={class:"obj-viewer-container"},Ge={class:"buttonGroup-topLeft"},Ke={class:"buttonGroup-left"},We={class:"buttonGroup-right"},Ye={class:"buttonGroup-bottom"},Ze={class:"top-panel"},Qe={class:"panel-header"},et={class:"panel-body"},tt={class:"left-panel"},lt={class:"panel-header"},nt={class:"panel-body"},ot={key:1,class:"clipping-content"},at={class:"radio-group"},st={class:"radio-label"},it={class:"radio-label"},rt={class:"radio-label"},ut={class:"radio-label"},ct={class:"right-panel"},dt={class:"panel-header"},vt={class:"panel-body"},mt={key:0,class:"loading-overlay"},pt={key:1,class:"brand"},ft={class:"brand-item"},gt={class:"item-value"},ht={class:"brand-item"},Nt={class:"item-value"},Vt={class:"brand-item"},bt={class:"item-value"},yt=e.defineComponent({__name:"threeSceneViewForCPMPIP",props:{fileBlobs:{default:()=>[]},threeData:{}},emits:["getAnimationData","getThreeData"],setup(T,{emit:j}){const w=j,o=T,C=e.inject("setManagementPageTitle"),_=e.inject("setManagementPageVisible"),i=e.computed(()=>{var t,a;return(a=(t=o==null?void 0:o.threeData)==null?void 0:t.data)==null?void 0:a.machine}),d=e.computed(()=>{var t;return(t=i==null?void 0:i.value)==null?void 0:t.产品型号}),D=e.computed(()=>{var t;return(t=i==null?void 0:i.value)==null?void 0:t.编号}),L=e.computed(()=>{var t;return(t=i==null?void 0:i.value)==null?void 0:t.厂家}),g=e.computed(()=>{var t,a;return(a=(t=o==null?void 0:o.threeData)==null?void 0:t.data)==null?void 0:a.workpieceInfo}),m=e.computed(()=>{var t,a;return(a=(t=o==null?void 0:o.threeData)==null?void 0:t.data)==null?void 0:a.knife}),A=e.ref([]),I=async l=>{!l||!l.isExtra||(await M(l),C==null||C(l==null?void 0:l.pageName),_==null||_(!0))},M=se.debounce(async l=>{await se.onPageBack();const{mainKey:t,baseMenuPath:a}=l||{};Me.copyAdd(a,t)},500);e.watch(()=>[d.value,g.value,m.value],()=>{var h,c,oe,ae;const l=[],t={pageName:"机床",name:"机床",label:"机床",type:"机床",id:"机床",path:"机床",baseMenuPath:"设备库/机床",children:[],show:!0,isPenultimate:!1};d.value&&t.children.push({isExtra:!0,pageName:"机床",mainKey:d.value,label:d.value,baseMenuPath:"设备库/机床"});const a={pageName:"工件",name:"工件",label:"工件",type:"工件",id:"工件",path:"工件",baseMenuPath:"设备库/机床",children:[],show:!0,isPenultimate:!1};g.value&&a.children.push({isExtra:!0,type:(h=g.value)==null?void 0:h.type,pageName:"工件",mainKey:(c=g.value)==null?void 0:c.name,label:(oe=g.value)==null?void 0:oe.name,baseMenuPath:`工件库/${(ae=g.value)==null?void 0:ae.type}`});const K={pageName:"刀具",name:"刀具",label:"刀具",type:"刀具",id:"刀具",path:"刀具",children:[],show:!0,isPenultimate:!1};m.value&&K.children.push({isExtra:!0,pageName:"刀具",mainKey:m.value,label:m.value,baseMenuPath:"设备库/刀具"}),l.push(t,a,K),A.value=l},{immediate:!0});const X=e.ref([]),B=e.computed(()=>{var t,a;return(a=(t=o==null?void 0:o.threeData)==null?void 0:t.data)==null?void 0:a.csvUrl});e.watch(()=>B.value,async()=>{if(console.log("three data",o==null?void 0:o.threeData),console.log("csvUrl",B.value),B.value){const l=await Be.initXYZBCList(B.value);X.value=l}},{immediate:!0});const z=e.computed(()=>{var t,a;return(a=(t=o==null?void 0:o.threeData)==null?void 0:t.data)==null?void 0:a.bladeObjUrl}),W=e.ref(U.sceneType.ROBOT),R=e.ref(null),O=e.ref(!1),F=e.ref(""),P=e.ref(!1),y=e.ref(""),$=e.ref(!1),k=e.ref(""),s=e.ref(!1),n=e.ref(""),r=e.shallowRef(null),V=e.ref("叶片模型"),v=e.shallowRef(null),p=e.shallowRef(null),u=e.shallowRef(null),E=e.ref(ie),{currentModels:S,resetView:Y,initThreeJS:q,handleResize:te,getThreeJSObjects:J,cleanup:ue,setModels:le,axesHelperVisible:ce,toggleAxesVisibility:de}=Q.useThreeJS(R),{loadSceneFromFile:ve}=U.useUrdfLoader(J,S,O,F),{isAnimating:ne,toggleAnimation:me,stopAnimation:pe}=Q.useAnimation(J,S),{isClipping:fe,activeClippingAxis:b,toggleClipping:ge,updateClippingPlanes:x}=Q.useClipping(J,S),{initRaycaster:he,selectedObject3D:Ne,setSelectedObjVisible:Ve,updatePosition:be,updateRotation:ye,dispose:Ee}=U.useRaycaster(R,J,S),ke=()=>{de()},we=e.computed(()=>W.value===U.sceneType.ROBOT),G=l=>{P.value=!0,y.value=l,l==="剖面视图"&&!fe.value&&ge()},Z=l=>{$.value=!0,k.value=l,l==="动画仿真"&&w("getAnimationData")},Ce=()=>{var l;(l=E.value)==null||l.handlePlayPause()},_e=()=>{var l;(l=E.value)==null||l.pauseAnimation()},Pe=()=>{var l;(l=E.value)==null||l.stopAnimation()},Se=(l,t)=>H.getMeshFromLink(l,t),xe=async l=>{const t=Se(l,V.value);if(p.value=t,console.log("bladeObjUrl",z.value),t&&t.parent&&z.value){const a=await He(z.value);a.name="blade_clone",t.parent.add(a),a.position.copy(t.position),a.rotation.copy(t.rotation),a.scale.copy(t.scale),t.visible=!1,v.value=a}else V.value&&console.warn(`在 Blade '${V.value}' 中未找到可替换的网格或其没有父级。`)};e.watch(()=>o.fileBlobs,l=>{if(l&&l.length>0){const t=l[0];if(!t.name.toLowerCase().endsWith(".urdf"))return;ve(t).then(a=>{r.value=a,a&&xe(a)}).catch(a=>{console.error("加载URDF文件时发生错误:",a),f.ElMessage.error("加载urdf模型失败"),r.value=null})}else r.value=null},{immediate:!0,deep:!0}),e.watch(r,l=>{le(l?[l]:[]),he()});const Te=()=>{q(),window.addEventListener("resize",te);const l=J();u.value=l.scene},De=()=>{y.value="",k.value="",window.removeEventListener("resize",te),ne.value&&pe(),ue(),Ee()};return e.onMounted(async()=>{await e.nextTick();try{Te()}catch(l){console.error("Three.js 初始化失败:",l),f.ElMessage.error("渲染引擎初始化失败!")}}),e.onBeforeUnmount(()=>{De()}),(l,t)=>{const a=e.resolveComponent("el-scrollbar"),K=e.resolveComponent("PipeAnalysisPanel");return e.openBlock(),e.createElementBlock("div",Xe,[e.withDirectives(e.createElementVNode("div",{ref_key:"threejsContainer",ref:R,class:"threejs-container"},null,512),[[e.vShow,we.value]]),e.createElementVNode("div",Ge,[e.createVNode(N.ThreeSvgIcon,{name:"viewReset",size:"24",onClick:e.unref(Y),title:"重置"},null,8,["onClick"]),e.createVNode(N.ThreeSvgIcon,{name:"fangda",size:"24",title:"放大"}),e.createVNode(N.ThreeSvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(N.ThreeSvgIcon,{name:"lookAround",size:"24",onClick:e.unref(me),title:e.unref(ne)?"停止动画":"动画视图"},null,8,["onClick","title"]),e.createVNode(N.ThreeSvgIcon,{name:"zuobiaoxi",size:"24",active:e.unref(ce),onClick:ke,title:"显隐坐标轴"},null,8,["active"])]),e.createElementVNode("div",Ke,[e.renderSlot(l.$slots,"button-left",{switchRightPanel:G},void 0,!0),e.createVNode(N.ThreeSvgIcon,{name:"jiegoushu",size:"24",onClick:t[0]||(t[0]=h=>G("场景树")),active:P.value&&y.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(N.ThreeSvgIcon,{name:"clipping",size:"24",onClick:t[1]||(t[1]=h=>G("剖面视图")),active:P.value&&y.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(N.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",onClick:t[2]||(t[2]=h=>G("工件树")),active:P.value&&y.value==="工件树"},null,8,["active"])]),e.createElementVNode("div",We,[e.renderSlot(l.$slots,"button-right",{switchRightPanel:Z},void 0,!0),e.createVNode(N.ThreeSvgIcon,{name:"jichuangxuanze",size:"24",onClick:t[3]||(t[3]=h=>Z("机床控制")),active:$.value&&k.value==="机床控制",title:"机床控制"},null,8,["active"]),e.createVNode(N.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:t[4]||(t[4]=h=>Z("动画仿真")),active:$.value&&k.value==="动画仿真"},null,8,["active"])]),e.createElementVNode("div",Ye,[e.createVNode(N.ThreeSvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:Ce}),e.createVNode(N.ThreeSvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:_e}),e.createVNode(N.ThreeSvgIcon,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:Pe})]),e.withDirectives(e.createElementVNode("div",Ze,[e.createElementVNode("div",Qe,[e.createElementVNode("span",null,e.toDisplayString(n.value),1),e.createElementVNode("span",{class:"close",onClick:t[5]||(t[5]=h=>s.value=!1)}," X ")]),e.createElementVNode("div",et,[e.createVNode(a,{height:"100%"},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"top-panel",{topPanelType:n.value},void 0,!0)]),_:3})])],512),[[e.vShow,s.value]]),e.withDirectives(e.createElementVNode("div",tt,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(y.value),1),e.createElementVNode("span",{class:"close",onClick:t[6]||(t[6]=h=>P.value=!1)}," X ")]),e.createElementVNode("div",nt,[e.createVNode(a,{height:"100%"},{default:e.withCtx(()=>{var h;return[y.value==="场景树"?(e.openBlock(),e.createBlock(H.UrdfTree,{key:0,model:r.value,extraNodes:A.value,onNodeClick:I},null,8,["model","extraNodes"])):e.createCommentVNode("",!0),y.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",ot,[e.createElementVNode("div",at,[e.createElementVNode("label",st,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":t[7]||(t[7]=c=>e.isRef(b)?b.value=c:null),onChange:t[8]||(t[8]=(...c)=>e.unref(x)&&e.unref(x)(...c))},null,544),[[e.vModelRadio,e.unref(b)]]),t[16]||(t[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",it,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":t[9]||(t[9]=c=>e.isRef(b)?b.value=c:null),onChange:t[10]||(t[10]=(...c)=>e.unref(x)&&e.unref(x)(...c))},null,544),[[e.vModelRadio,e.unref(b)]]),t[17]||(t[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",rt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":t[11]||(t[11]=c=>e.isRef(b)?b.value=c:null),onChange:t[12]||(t[12]=(...c)=>e.unref(x)&&e.unref(x)(...c))},null,544),[[e.vModelRadio,e.unref(b)]]),t[18]||(t[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",ut,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":t[13]||(t[13]=c=>e.isRef(b)?b.value=c:null),onChange:t[14]||(t[14]=(...c)=>e.unref(x)&&e.unref(x)(...c))},null,544),[[e.vModelRadio,e.unref(b)]]),t[19]||(t[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0),y.value==="工件树"?(e.openBlock(),e.createBlock(U.WorkpieceTreePanel,{key:2,model:(h=e.unref(Ne))==null?void 0:h.obj,onVisibleChange:e.unref(Ve),onUpdatePosition:e.unref(be),onUpdateRotation:e.unref(ye)},null,8,["model","onVisibleChange","onUpdatePosition","onUpdateRotation"])):e.createCommentVNode("",!0)]}),_:1})])],512),[[e.vShow,P.value]]),e.withDirectives(e.createElementVNode("div",ct,[e.createElementVNode("div",dt,[e.createElementVNode("span",null,e.toDisplayString(k.value),1),e.createElementVNode("span",{class:"close",onClick:t[15]||(t[15]=h=>$.value=!1)}," X ")]),e.createElementVNode("div",vt,[e.createVNode(a,{height:"100%"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(H.JointPanel,{model:r.value},null,8,["model"]),[[e.vShow,k.value==="机床控制"]]),e.withDirectives(e.createVNode(ie,{model:r.value,scene:u.value,xyzbcList:X.value,ref_key:"urdfAnimationPanelRef",ref:E},null,8,["model","scene","xyzbcList"]),[[e.vShow,k.value==="动画仿真"]]),e.renderSlot(l.$slots,"right-panel",{rightPanelType:k.value},void 0,!0)]),_:3})])],512),[[e.vShow,$.value]]),O.value?(e.openBlock(),e.createElementBlock("div",mt,[t[20]||(t[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(F.value),1)])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",pt,[e.createElementVNode("div",ft,[t[21]||(t[21]=e.createElementVNode("div",{class:"item-label"},"厂家:",-1)),e.createElementVNode("div",gt,e.toDisplayString(L.value),1)]),e.createElementVNode("div",ht,[t[22]||(t[22]=e.createElementVNode("div",{class:"item-label"},"型号:",-1)),e.createElementVNode("div",Nt,e.toDisplayString(d.value),1)]),e.createElementVNode("div",Vt,[t[23]||(t[23]=e.createElementVNode("div",{class:"item-label"},"编号:",-1)),e.createElementVNode("div",bt,e.toDisplayString(D.value),1)])])):e.createCommentVNode("",!0),e.createVNode(K,{ref:"pipeAnalysisPanelRef"},null,512)])}}}),Et=re._export_sfc(yt,[["__scopeId","data-v-eef66dd4"]]);exports.default=Et;
|
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),O=require("./iconfont-CYyOVK2s.cjs"),l=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C2CSvQmH.cjs"),Be=require("./threeViewerHost-CG9MEd0B.cjs"),W=require("./index-C8qRkCgn.cjs"),oe=require("./urdfTree-CXBSDiJj.cjs"),ue=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),V=require("./svgIcon-CUM54R6L.cjs"),Le=require("./isString--eJE54G5.cjs");function ke(r=.5,e=4){const n=new l.Mesh(new l.ConeGeometry(r,e,32),new l.MeshStandardMaterial({color:"#919191ff",metalness:.3,roughness:.6})),o=n.geometry.parameters.height;return n.geometry.translate(0,-o/2,0),n.rotation.set(-90,0,0,"XYZ"),n}function De(r,e){r.position.copy(e)}function Pe(r,e,n=new l.Color(16711680)){const o=new l.Vector3;e.getWorldPosition(o);const i=r.geometry.attributes.position,s=r.geometry.attributes.color,c=new l.Color(55551);let a=1/0,m=-1;for(let d=0;d<i.count;d++){const p=new l.Vector3().fromBufferAttribute(i,d).distanceTo(o);p<a&&(a=p,m=d)}for(let d=0;d<s.count;d++)c.toArray(s.array,d*3);if(m!==-1){const d=n.toArray(),h=m*3+2;for(let p=0;p<h;p=p+3)s.array[p]=d[0],s.array[p+1]=d[1],s.array[p+2]=d[2]}s.needsUpdate=!0}function de(r,e,n,o=new l.Color(16711680)){De(r,e),Pe(n,r,o)}const Ie={class:"panel-content"},Fe={class:"animation-controls"},Oe={class:"control-row"},je={class:"control-row"},Re={class:"frame-info"},We={class:"control-row"},Ge=t.defineComponent({__name:"trackAnimationPanel",props:{cloud:{},knife:{},vectors:{}},emits:["getThreeData"],setup(r,{expose:e,emit:n}){const o=r,i=t.computed(()=>o.vectors),s=t.ref(!1),c=t.ref(0),a=t.ref(50);let m=!1;const d=g=>`第 ${g+1} 帧`,h=g=>{if(g<0||g>=i.value.length){console.error(`帧索引 ${g} 超出范围`);return}const y=i.value[g];c.value=g,de(o.knife,y,o.cloud)},p=async()=>{if(i.value.length===0){W.ElMessage.error("无法播放动画:无数据");return}if(!s.value){s.value=!0,m=!1,i.value.length-1===c.value&&(c.value=0);try{for(let g=c.value+1;g<i.value.length&&!m;g++)await new Promise(y=>setTimeout(y,a.value)),h(g);m||W.ElMessage.success("动画播放完成")}catch(g){console.error("动画播放出错:",g),W.ElMessage.error("动画播放出错")}finally{s.value=!1}}},v=()=>{m=!0,s.value=!1,W.ElMessage.info("动画已停止")},E=g=>{s.value&&v(),h(g)};return e({playAnimation:p,stopAnimation:v,forwardFrame:()=>{s.value&&v(),!(c.value+1>=i.value.length)&&h(c.value+1)},backwardFrame:()=>{s.value&&v(),c.value!==0&&h(c.value-1)}}),(g,y)=>{const _=t.resolveComponent("el-input-number"),C=t.resolveComponent("el-form-item"),A=t.resolveComponent("el-form"),X=t.resolveComponent("el-slider");return t.openBlock(),t.createElementBlock("div",Ie,[t.createElementVNode("div",Fe,[t.createElementVNode("div",Oe,[t.createVNode(A,{"label-width":"auto",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(C,{label:"帧间隔 (ms):",prop:"frameDuration"},{default:t.withCtx(()=>[t.createVNode(_,{modelValue:a.value,"onUpdate:modelValue":y[0]||(y[0]=F=>a.value=F),min:0,max:5e3,step:10,style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),t.createElementVNode("div",je,[y[2]||(y[2]=t.createElementVNode("label",null,"当前帧:",-1)),t.createElementVNode("span",Re,t.toDisplayString(c.value+1)+" / "+t.toDisplayString(i.value.length),1)]),t.createElementVNode("div",We,[y[3]||(y[3]=t.createElementVNode("label",null,"动画进度:",-1)),t.createVNode(X,{modelValue:c.value,"onUpdate:modelValue":y[1]||(y[1]=F=>c.value=F),min:0,max:i.value.length>0?i.value.length-1:0,step:1,"format-tooltip":d,onInput:E,disabled:i.value.length===0,style:{"flex-grow":"1",margin:"0 10px"}},null,8,["modelValue","max","disabled"])])])])}}}),He=ue._export_sfc(Ge,[["__scopeId","data-v-93cde733"]]),re=new l.Box3,G=new l.Vector3;class fe extends l.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new l.Float32BufferAttribute(e,3)),this.setAttribute("uv",new l.Float32BufferAttribute(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,o=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),o.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new l.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new l.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new l.InterleavedBufferAttribute(o,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new l.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceColorStart",new l.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new l.InterleavedBufferAttribute(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new l.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new l.Box3);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),re.setFromBufferAttribute(n),this.boundingBox.union(re))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new l.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let i=0;for(let s=0,c=e.count;s<c;s++)G.fromBufferAttribute(e,s),i=Math.max(i,o.distanceToSquared(G)),G.fromBufferAttribute(n,s),i=Math.max(i,o.distanceToSquared(G));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}l.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new l.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};l.ShaderLib.line={uniforms:l.UniformsUtils.merge([l.UniformsLib.common,l.UniformsLib.fog,l.UniformsLib.line]),vertexShader:`
|
|
2
|
-
#include <common>
|
|
3
|
-
#include <color_pars_vertex>
|
|
4
|
-
#include <fog_pars_vertex>
|
|
5
|
-
#include <logdepthbuf_pars_vertex>
|
|
6
|
-
#include <clipping_planes_pars_vertex>
|
|
7
|
-
|
|
8
|
-
uniform float linewidth;
|
|
9
|
-
uniform vec2 resolution;
|
|
10
|
-
|
|
11
|
-
attribute vec3 instanceStart;
|
|
12
|
-
attribute vec3 instanceEnd;
|
|
13
|
-
|
|
14
|
-
attribute vec3 instanceColorStart;
|
|
15
|
-
attribute vec3 instanceColorEnd;
|
|
16
|
-
|
|
17
|
-
#ifdef WORLD_UNITS
|
|
18
|
-
|
|
19
|
-
varying vec4 worldPos;
|
|
20
|
-
varying vec3 worldStart;
|
|
21
|
-
varying vec3 worldEnd;
|
|
22
|
-
|
|
23
|
-
#ifdef USE_DASH
|
|
24
|
-
|
|
25
|
-
varying vec2 vUv;
|
|
26
|
-
|
|
27
|
-
#endif
|
|
28
|
-
|
|
29
|
-
#else
|
|
30
|
-
|
|
31
|
-
varying vec2 vUv;
|
|
32
|
-
|
|
33
|
-
#endif
|
|
34
|
-
|
|
35
|
-
#ifdef USE_DASH
|
|
36
|
-
|
|
37
|
-
uniform float dashScale;
|
|
38
|
-
attribute float instanceDistanceStart;
|
|
39
|
-
attribute float instanceDistanceEnd;
|
|
40
|
-
varying float vLineDistance;
|
|
41
|
-
|
|
42
|
-
#endif
|
|
43
|
-
|
|
44
|
-
void trimSegment( const in vec4 start, inout vec4 end ) {
|
|
45
|
-
|
|
46
|
-
// trim end segment so it terminates between the camera plane and the near plane
|
|
47
|
-
|
|
48
|
-
// conservative estimate of the near plane
|
|
49
|
-
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
50
|
-
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
51
|
-
float nearEstimate = - 0.5 * b / a;
|
|
52
|
-
|
|
53
|
-
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
54
|
-
|
|
55
|
-
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
void main() {
|
|
60
|
-
|
|
61
|
-
#ifdef USE_COLOR
|
|
62
|
-
|
|
63
|
-
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
64
|
-
|
|
65
|
-
#endif
|
|
66
|
-
|
|
67
|
-
#ifdef USE_DASH
|
|
68
|
-
|
|
69
|
-
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
|
70
|
-
vUv = uv;
|
|
71
|
-
|
|
72
|
-
#endif
|
|
73
|
-
|
|
74
|
-
float aspect = resolution.x / resolution.y;
|
|
75
|
-
|
|
76
|
-
// camera space
|
|
77
|
-
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
78
|
-
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
79
|
-
|
|
80
|
-
#ifdef WORLD_UNITS
|
|
81
|
-
|
|
82
|
-
worldStart = start.xyz;
|
|
83
|
-
worldEnd = end.xyz;
|
|
84
|
-
|
|
85
|
-
#else
|
|
86
|
-
|
|
87
|
-
vUv = uv;
|
|
88
|
-
|
|
89
|
-
#endif
|
|
90
|
-
|
|
91
|
-
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
92
|
-
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
93
|
-
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
94
|
-
// perhaps there is a more elegant solution -- WestLangley
|
|
95
|
-
|
|
96
|
-
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
97
|
-
|
|
98
|
-
if ( perspective ) {
|
|
99
|
-
|
|
100
|
-
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
101
|
-
|
|
102
|
-
trimSegment( start, end );
|
|
103
|
-
|
|
104
|
-
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
105
|
-
|
|
106
|
-
trimSegment( end, start );
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// clip space
|
|
113
|
-
vec4 clipStart = projectionMatrix * start;
|
|
114
|
-
vec4 clipEnd = projectionMatrix * end;
|
|
115
|
-
|
|
116
|
-
// ndc space
|
|
117
|
-
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
118
|
-
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
119
|
-
|
|
120
|
-
// direction
|
|
121
|
-
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
122
|
-
|
|
123
|
-
// account for clip-space aspect ratio
|
|
124
|
-
dir.x *= aspect;
|
|
125
|
-
dir = normalize( dir );
|
|
126
|
-
|
|
127
|
-
#ifdef WORLD_UNITS
|
|
128
|
-
|
|
129
|
-
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
130
|
-
vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
|
|
131
|
-
vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
|
|
132
|
-
vec3 worldFwd = cross( worldDir, worldUp );
|
|
133
|
-
worldPos = position.y < 0.5 ? start: end;
|
|
134
|
-
|
|
135
|
-
// height offset
|
|
136
|
-
float hw = linewidth * 0.5;
|
|
137
|
-
worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
|
|
138
|
-
|
|
139
|
-
// don't extend the line if we're rendering dashes because we
|
|
140
|
-
// won't be rendering the endcaps
|
|
141
|
-
#ifndef USE_DASH
|
|
142
|
-
|
|
143
|
-
// cap extension
|
|
144
|
-
worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
|
|
145
|
-
|
|
146
|
-
// add width to the box
|
|
147
|
-
worldPos.xyz += worldFwd * hw;
|
|
148
|
-
|
|
149
|
-
// endcaps
|
|
150
|
-
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
151
|
-
|
|
152
|
-
worldPos.xyz -= worldFwd * 2.0 * hw;
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
#endif
|
|
157
|
-
|
|
158
|
-
// project the worldpos
|
|
159
|
-
vec4 clip = projectionMatrix * worldPos;
|
|
160
|
-
|
|
161
|
-
// shift the depth of the projected points so the line
|
|
162
|
-
// segments overlap neatly
|
|
163
|
-
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
164
|
-
clip.z = clipPose.z * clip.w;
|
|
165
|
-
|
|
166
|
-
#else
|
|
167
|
-
|
|
168
|
-
vec2 offset = vec2( dir.y, - dir.x );
|
|
169
|
-
// undo aspect ratio adjustment
|
|
170
|
-
dir.x /= aspect;
|
|
171
|
-
offset.x /= aspect;
|
|
172
|
-
|
|
173
|
-
// sign flip
|
|
174
|
-
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
175
|
-
|
|
176
|
-
// endcaps
|
|
177
|
-
if ( position.y < 0.0 ) {
|
|
178
|
-
|
|
179
|
-
offset += - dir;
|
|
180
|
-
|
|
181
|
-
} else if ( position.y > 1.0 ) {
|
|
182
|
-
|
|
183
|
-
offset += dir;
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// adjust for linewidth
|
|
188
|
-
offset *= linewidth;
|
|
189
|
-
|
|
190
|
-
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
191
|
-
offset /= resolution.y;
|
|
192
|
-
|
|
193
|
-
// select end
|
|
194
|
-
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
195
|
-
|
|
196
|
-
// back to clip space
|
|
197
|
-
offset *= clip.w;
|
|
198
|
-
|
|
199
|
-
clip.xy += offset;
|
|
200
|
-
|
|
201
|
-
#endif
|
|
202
|
-
|
|
203
|
-
gl_Position = clip;
|
|
204
|
-
|
|
205
|
-
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
206
|
-
|
|
207
|
-
#include <logdepthbuf_vertex>
|
|
208
|
-
#include <clipping_planes_vertex>
|
|
209
|
-
#include <fog_vertex>
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
`,fragmentShader:`
|
|
213
|
-
uniform vec3 diffuse;
|
|
214
|
-
uniform float opacity;
|
|
215
|
-
uniform float linewidth;
|
|
216
|
-
|
|
217
|
-
#ifdef USE_DASH
|
|
218
|
-
|
|
219
|
-
uniform float dashOffset;
|
|
220
|
-
uniform float dashSize;
|
|
221
|
-
uniform float gapSize;
|
|
222
|
-
|
|
223
|
-
#endif
|
|
224
|
-
|
|
225
|
-
varying float vLineDistance;
|
|
226
|
-
|
|
227
|
-
#ifdef WORLD_UNITS
|
|
228
|
-
|
|
229
|
-
varying vec4 worldPos;
|
|
230
|
-
varying vec3 worldStart;
|
|
231
|
-
varying vec3 worldEnd;
|
|
232
|
-
|
|
233
|
-
#ifdef USE_DASH
|
|
234
|
-
|
|
235
|
-
varying vec2 vUv;
|
|
236
|
-
|
|
237
|
-
#endif
|
|
238
|
-
|
|
239
|
-
#else
|
|
240
|
-
|
|
241
|
-
varying vec2 vUv;
|
|
242
|
-
|
|
243
|
-
#endif
|
|
244
|
-
|
|
245
|
-
#include <common>
|
|
246
|
-
#include <color_pars_fragment>
|
|
247
|
-
#include <fog_pars_fragment>
|
|
248
|
-
#include <logdepthbuf_pars_fragment>
|
|
249
|
-
#include <clipping_planes_pars_fragment>
|
|
250
|
-
|
|
251
|
-
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
252
|
-
|
|
253
|
-
float mua;
|
|
254
|
-
float mub;
|
|
255
|
-
|
|
256
|
-
vec3 p13 = p1 - p3;
|
|
257
|
-
vec3 p43 = p4 - p3;
|
|
258
|
-
|
|
259
|
-
vec3 p21 = p2 - p1;
|
|
260
|
-
|
|
261
|
-
float d1343 = dot( p13, p43 );
|
|
262
|
-
float d4321 = dot( p43, p21 );
|
|
263
|
-
float d1321 = dot( p13, p21 );
|
|
264
|
-
float d4343 = dot( p43, p43 );
|
|
265
|
-
float d2121 = dot( p21, p21 );
|
|
266
|
-
|
|
267
|
-
float denom = d2121 * d4343 - d4321 * d4321;
|
|
268
|
-
|
|
269
|
-
float numer = d1343 * d4321 - d1321 * d4343;
|
|
270
|
-
|
|
271
|
-
mua = numer / denom;
|
|
272
|
-
mua = clamp( mua, 0.0, 1.0 );
|
|
273
|
-
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
274
|
-
mub = clamp( mub, 0.0, 1.0 );
|
|
275
|
-
|
|
276
|
-
return vec2( mua, mub );
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
void main() {
|
|
281
|
-
|
|
282
|
-
float alpha = opacity;
|
|
283
|
-
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
284
|
-
|
|
285
|
-
#include <clipping_planes_fragment>
|
|
286
|
-
|
|
287
|
-
#ifdef USE_DASH
|
|
288
|
-
|
|
289
|
-
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
290
|
-
|
|
291
|
-
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
292
|
-
|
|
293
|
-
#endif
|
|
294
|
-
|
|
295
|
-
#ifdef WORLD_UNITS
|
|
296
|
-
|
|
297
|
-
// Find the closest points on the view ray and the line segment
|
|
298
|
-
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
299
|
-
vec3 lineDir = worldEnd - worldStart;
|
|
300
|
-
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
301
|
-
|
|
302
|
-
vec3 p1 = worldStart + lineDir * params.x;
|
|
303
|
-
vec3 p2 = rayEnd * params.y;
|
|
304
|
-
vec3 delta = p1 - p2;
|
|
305
|
-
float len = length( delta );
|
|
306
|
-
float norm = len / linewidth;
|
|
307
|
-
|
|
308
|
-
#ifndef USE_DASH
|
|
309
|
-
|
|
310
|
-
#ifdef USE_ALPHA_TO_COVERAGE
|
|
311
|
-
|
|
312
|
-
float dnorm = fwidth( norm );
|
|
313
|
-
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
314
|
-
|
|
315
|
-
#else
|
|
316
|
-
|
|
317
|
-
if ( norm > 0.5 ) {
|
|
318
|
-
|
|
319
|
-
discard;
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
#endif
|
|
324
|
-
|
|
325
|
-
#endif
|
|
326
|
-
|
|
327
|
-
#else
|
|
328
|
-
|
|
329
|
-
#ifdef USE_ALPHA_TO_COVERAGE
|
|
330
|
-
|
|
331
|
-
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
332
|
-
float a = vUv.x;
|
|
333
|
-
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
334
|
-
float len2 = a * a + b * b;
|
|
335
|
-
float dlen = fwidth( len2 );
|
|
336
|
-
|
|
337
|
-
if ( abs( vUv.y ) > 1.0 ) {
|
|
338
|
-
|
|
339
|
-
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
#else
|
|
344
|
-
|
|
345
|
-
if ( abs( vUv.y ) > 1.0 ) {
|
|
346
|
-
|
|
347
|
-
float a = vUv.x;
|
|
348
|
-
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
349
|
-
float len2 = a * a + b * b;
|
|
350
|
-
|
|
351
|
-
if ( len2 > 1.0 ) discard;
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
#endif
|
|
356
|
-
|
|
357
|
-
#endif
|
|
358
|
-
|
|
359
|
-
#include <logdepthbuf_fragment>
|
|
360
|
-
#include <color_fragment>
|
|
361
|
-
|
|
362
|
-
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
363
|
-
|
|
364
|
-
#include <tonemapping_fragment>
|
|
365
|
-
#include <colorspace_fragment>
|
|
366
|
-
#include <fog_fragment>
|
|
367
|
-
#include <premultiplied_alpha_fragment>
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
`};class te extends l.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:l.UniformsUtils.clone(l.ShaderLib.line.uniforms),vertexShader:l.ShaderLib.line.vertexShader,fragmentShader:l.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const J=new l.Vector4,se=new l.Vector3,ae=new l.Vector3,x=new l.Vector4,b=new l.Vector4,N=new l.Vector4,Q=new l.Vector3,ee=new l.Matrix4,S=new l.Line3,le=new l.Vector3,H=new l.Box3,q=new l.Sphere,M=new l.Vector4;let T,I;function ce(r,e,n){return M.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),M.multiplyScalar(1/M.w),M.x=I/n.width,M.y=I/n.height,M.applyMatrix4(r.projectionMatrixInverse),M.multiplyScalar(1/M.w),Math.abs(Math.max(M.x,M.y))}function qe(r,e){const n=r.matrixWorld,o=r.geometry,i=o.attributes.instanceStart,s=o.attributes.instanceEnd,c=Math.min(o.instanceCount,i.count);for(let a=0,m=c;a<m;a++){S.start.fromBufferAttribute(i,a),S.end.fromBufferAttribute(s,a),S.applyMatrix4(n);const d=new l.Vector3,h=new l.Vector3;T.distanceSqToSegment(S.start,S.end,h,d),h.distanceTo(d)<I*.5&&e.push({point:h,pointOnLine:d,distance:T.origin.distanceTo(h),object:r,face:null,faceIndex:a,uv:null,uv1:null})}}function $e(r,e,n){const o=e.projectionMatrix,s=r.material.resolution,c=r.matrixWorld,a=r.geometry,m=a.attributes.instanceStart,d=a.attributes.instanceEnd,h=Math.min(a.instanceCount,m.count),p=-e.near;T.at(1,N),N.w=1,N.applyMatrix4(e.matrixWorldInverse),N.applyMatrix4(o),N.multiplyScalar(1/N.w),N.x*=s.x/2,N.y*=s.y/2,N.z=0,Q.copy(N),ee.multiplyMatrices(e.matrixWorldInverse,c);for(let v=0,E=h;v<E;v++){if(x.fromBufferAttribute(m,v),b.fromBufferAttribute(d,v),x.w=1,b.w=1,x.applyMatrix4(ee),b.applyMatrix4(ee),x.z>p&&b.z>p)continue;if(x.z>p){const C=x.z-b.z,A=(x.z-p)/C;x.lerp(b,A)}else if(b.z>p){const C=b.z-x.z,A=(b.z-p)/C;b.lerp(x,A)}x.applyMatrix4(o),b.applyMatrix4(o),x.multiplyScalar(1/x.w),b.multiplyScalar(1/b.w),x.x*=s.x/2,x.y*=s.y/2,b.x*=s.x/2,b.y*=s.y/2,S.start.copy(x),S.start.z=0,S.end.copy(b),S.end.z=0;const U=S.closestPointToPointParameter(Q,!0);S.at(U,le);const g=l.MathUtils.lerp(x.z,b.z,U),y=g>=-1&&g<=1,_=Q.distanceTo(le)<I*.5;if(y&&_){S.start.fromBufferAttribute(m,v),S.end.fromBufferAttribute(d,v),S.start.applyMatrix4(c),S.end.applyMatrix4(c);const C=new l.Vector3,A=new l.Vector3;T.distanceSqToSegment(S.start,S.end,A,C),n.push({point:A,pointOnLine:C,distance:T.origin.distanceTo(A),object:r,face:null,faceIndex:v,uv:null,uv1:null})}}}class Xe extends l.Mesh{constructor(e=new fe,n=new te({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,o=e.attributes.instanceEnd,i=new Float32Array(2*n.count);for(let c=0,a=0,m=n.count;c<m;c++,a+=2)se.fromBufferAttribute(n,c),ae.fromBufferAttribute(o,c),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+se.distanceTo(ae);const s=new l.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new l.InterleavedBufferAttribute(s,1,0)),e.setAttribute("instanceDistanceEnd",new l.InterleavedBufferAttribute(s,1,1)),this}raycast(e,n){const o=this.material.worldUnits,i=e.camera;i===null&&!o&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;T=e.ray;const c=this.matrixWorld,a=this.geometry,m=this.material;I=m.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),q.copy(a.boundingSphere).applyMatrix4(c);let d;if(o)d=I*.5;else{const p=Math.max(i.near,q.distanceToPoint(T.origin));d=ce(i,p,m.resolution)}if(q.radius+=d,T.intersectsSphere(q)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),H.copy(a.boundingBox).applyMatrix4(c);let h;if(o)h=I*.5;else{const p=Math.max(i.near,H.distanceToPoint(T.origin));h=ce(i,p,m.resolution)}H.expandByScalar(h),T.intersectsBox(H)!==!1&&(o?qe(this,n):$e(this,i,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(J),this.material.uniforms.resolution.value.set(J.z,J.w))}}class me extends fe{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,o=new Float32Array(2*n);for(let i=0;i<n;i+=3)o[2*i]=e[i],o[2*i+1]=e[i+1],o[2*i+2]=e[i+2],o[2*i+3]=e[i+3],o[2*i+4]=e[i+4],o[2*i+5]=e[i+5];return super.setPositions(o),this}setColors(e){const n=e.length-3,o=new Float32Array(2*n);for(let i=0;i<n;i+=3)o[2*i]=e[i],o[2*i+1]=e[i+1],o[2*i+2]=e[i+2],o[2*i+3]=e[i+3],o[2*i+4]=e[i+4],o[2*i+5]=e[i+5];return super.setColors(o),this}setFromPoints(e){const n=e.length-1,o=new Float32Array(6*n);for(let i=0;i<n;i++)o[6*i]=e[i].x,o[6*i+1]=e[i].y,o[6*i+2]=e[i].z||0,o[6*i+3]=e[i+1].x,o[6*i+4]=e[i+1].y,o[6*i+5]=e[i+1].z||0;return super.setPositions(o),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class Ye extends Xe{constructor(e=new me,n=new te({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}function Ze(r){const e=[];return r.forEach(n=>{const[o,i,s]=n.trim().split(/\s+/);e.push(+o,+i,+s)}),e}function $(r,e,n){switch(r){case"X":e.x=+n||0;break;case"Y":e.y=+n||0;break;case"Z":e.z=+n||0;break}}function Ke(r){const e=[],n=["X","Y","Z"];return r.forEach(o=>{const i={x:0,y:0,z:0},s=o.trim();if(!s)return;let c=null,a="";for(let m=0;m<(s==null?void 0:s.length);m++){const d=s[m],h=n.find(p=>p===d);if(h){c&&$(c,i,a),a="",c=h;continue}a=a+d}$(c,i,a),e.push(i.x,i.y,i.z)}),e}const Je=r=>r==null?void 0:r.filter(n=>n.includes("=")),Qe=r=>r.replace(/,/g,""),et=r=>r==null?void 0:r.map(n=>Qe(n)),tt=r=>{const e=Je(r);return et(e)};function nt(r){const e=tt(r),n=[];return e.forEach(o=>{var p,v,E,B,U,g;let[i,s,c,a]=o.trim().split(/\s+/);s=(p=s==null?void 0:s.trim)==null?void 0:p.call(s),c=(v=c==null?void 0:c.trim)==null?void 0:v.call(c),a=(E=a==null?void 0:a.trim)==null?void 0:E.call(a);const[,m]=(B=s==null?void 0:s.split)==null?void 0:B.call(s,"="),[,d]=(U=c==null?void 0:c.split)==null?void 0:U.call(c,"="),[,h]=(g=a==null?void 0:a.split)==null?void 0:g.call(a,"=");n.push(+m,+d,+h)}),n}const it=r=>r>="0"&&r<="9",ot=r=>r==="+"||r==="-",rt=r=>r===".";function st(r){return it(r)||ot(r)||rt(r)}function at(r){const e=[],n=new Set(["X","Y","Z"]);return r.forEach(o=>{const i={x:0,y:0,z:0},s=o.trim();if(!s)return;let c=null,a="";for(let m=0;m<(s==null?void 0:s.length);m++){const d=s[m],h=n.has(d)?d:null,p=st(d);if(h||!p){c&&$(c,i,a),h?c=h:c=null,a="";continue}a=a+d}c&&$(c,i,a),e.push(i.x,i.y,i.z)}),e}function lt(r){return r==null?void 0:r.includes("=")}async function ct(r){var i,s;const e=(i=r==null?void 0:r.trim())==null?void 0:i.split(/\r?\n/);if(lt(r))return nt(e);const n=e==null?void 0:e[0],o=(s=n==null?void 0:n.trim())==null?void 0:s.split(/\s+/);if((o==null?void 0:o.length)>=3)return Ze(e);if((o==null?void 0:o.length)===1)return Ke(e)}async function ut(r){const e=r.trim().split(/\r?\n/),n=[];return e.forEach(o=>{const i=o.trim().split(/\s+/);if(i.length!=3)return;const[s,c,a]=i;n.push(+s,+c,+a)}),n}async function dt(r){const e=r.trim().split(/\r?\n/),n=[];return e.forEach(o=>{const i=o.trim().split(/\s+/);if(i.length!=3)return;const[s,c,a]=i;n.push(+s,+c,+a)}),n}async function ft(r){let e=r.trim().split(/\r?\n/);return e=e.filter(o=>{const i=o.startsWith("X"),s=o.startsWith("G")&&o.includes("X");return i||s}),at(e)}async function mt(r,e){const{isCyd:n,isUv:o,isCpt:i,isNc:s}=e;return o?ct(r):n?dt(r):i?ut(r):s?ft(r):[]}function pt(r){const e=[];for(let n=0;n<r.length;n+=3)e.push(new l.Vector3(r[n],r[n+1],r[n+2]));return e}function ht(r,e){if(!e||e.length<3)return;const{scene:n,camera:o,renderer:i,controls:s}=r();if(!n||!o||!i||!s)return;const c=[];for(let v=0;v<e.length;v+=3)c.push(new l.Vector3(e[v],e[v+1],e[v+2]));const m=new l.CatmullRomCurve3(c,!1,"catmullrom",.5).getPoints(150).flatMap(v=>[v.x,v.y,v.z]),d=new me;d.setPositions(m);const h=new te({color:55551,linewidth:3,resolution:new l.Vector2(window.innerWidth,window.innerHeight)}),p=new Ye(d,h);return p.name="轨迹路径",n.add(p),p}function vt(r,e,n,o=4,i=50){let s=1/0,c=-1/0,a=1/0,m=-1/0,d=1/0,h=-1/0;for(let g=0;g<r.length;g+=3){const y=r[g],_=r[g+1],C=r[g+2];s=Math.min(s,y),c=Math.max(c,y),a=Math.min(a,_),m=Math.max(m,_),d=Math.min(d,C),h=Math.max(h,C)}const v=Math.sqrt((c-s)**2+(m-a)**2+(h-d)**2)*.05,E=l.MathUtils.degToRad(e.fov),B=2*Math.tan(E/2)*i,U=v/B*n.domElement.height*(o/4);return Math.min(.4,U)}function gt(r){if(r.length%3!==0)return console.error("points array length is not a multiple of 3:",r),null;const e=new l.BufferGeometry;e.setAttribute("position",new l.Float32BufferAttribute(r,3));const n=new Float32Array(r.length);for(let s=0;s<r.length;s+=3)n[s]=0,n[s+1]=.847,n[s+2]=1;e.setAttribute("color",new l.BufferAttribute(n,3));const o=new l.PointsMaterial({vertexColors:!0,size:.4,sizeAttenuation:!0}),i=new l.Points(e,o);return o.needsUpdate=!0,i}function wt(r,e){const n=new l.Box3().setFromArray(e),o=[new l.Vector3(n.min.x,n.min.y,n.min.z),new l.Vector3(n.max.x,n.min.y,n.min.z),new l.Vector3(n.min.x,n.max.y,n.min.z),new l.Vector3(n.min.x,n.min.y,n.max.z),new l.Vector3(n.max.x,n.max.y,n.min.z),new l.Vector3(n.max.x,n.min.y,n.max.z),new l.Vector3(n.min.x,n.max.y,n.max.z),new l.Vector3(n.max.x,n.max.y,n.max.z)];let i=0;for(const s of o)i=Math.max(i,s.distanceTo(r.position));return i}function yt(r,e){if(!e)return;const{scene:n,camera:o,renderer:i,controls:s}=r();if(!n||!o||!i||!s)return;const c=gt(e);if(!c)return;c.name="轨迹路径",n.add(c);const a=vt(e,o,i,.1,50);c.material.size=a;const m=wt(o,e);return o.far=m*1.2,o.updateProjectionMatrix(),c}const xt={class:"obj-viewer-container"},bt={class:"buttonGroup-topLeft"},St={class:"buttonGroup-left"},_t={class:"buttonGroup-right"},Et={class:"buttonGroup-bottom"},Ct={class:"left-panel"},Vt={class:"panel-header"},zt={class:"panel-body"},At={key:1,class:"clipping-content"},Ut={class:"radio-group"},Nt={class:"radio-label"},Mt={class:"radio-label"},Tt={class:"radio-label"},Bt={class:"radio-label"},Lt={class:"right-panel"},kt={class:"panel-header"},Dt={class:"panel-body"},Pt={key:0,class:"loading-overlay"},It=t.defineComponent({__name:"threeTrackPathView",props:{fileBlobs:{},threeData:{default:()=>""},trackFileType:{}},emits:["getAnimationData","getThreeData"],setup(r,{emit:e}){const n=e,o=r,i=t.ref(null),s=t.ref(!1),c=t.ref(""),a=t.ref(),m=t.ref(!1),d=t.ref(""),h=t.ref(!1),p=t.ref(""),v=t.shallowRef(null),E=t.shallowRef(null),{currentModels:B,resetView:U,initThreeJS:g,handleResize:y,getThreeJSObjects:_,cleanup:C,axesHelperVisible:A,toggleAxesVisibility:X}=O.useThreeJS(i),{isAnimating:F,toggleAnimation:pe,stopAnimation:he}=O.useAnimation(_,B),{isClipping:ve,activeClippingAxis:z,toggleClipping:ge,updateClippingPlanes:L}=O.useClipping(_,B),we=()=>{X()},Y=f=>{m.value=!0,d.value=f,f==="剖面视图"&&!ve.value&&ge()},Z=f=>{h.value=!0,p.value=f,f==="动画仿真"&&n("getAnimationData")},K=t.ref([]),j=t.ref([]),ye=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isUv}),xe=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isCyd}),be=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isCpt}),D=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isNc}),Se=t.computed(()=>{const f=o.fileBlobs||[];return f==null?void 0:f[0]});let k=t.shallowRef(),P=t.shallowRef();const _e=()=>{const{scene:f}=_();k.value&&f&&(O.disposeObj(k.value,f),k.value=null)},Ee=()=>{const{scene:f}=_();P.value&&f&&(O.disposeObj(P.value,f),P.value=null)},ne=()=>{_e(),Ee()},Ce=async f=>{const u=URL.createObjectURL(f),R=await Be.readFileText(u);if(URL.revokeObjectURL(u),Le.isString(R)){const w=await mt(R,o.trackFileType)||[];K.value=w;const ie=K.value;ye.value&&(k.value=ht(_,ie)),(xe.value||be.value||D.value)&&(k.value=yt(_,ie)),O.frameCameraToMesh(_,k.value)}},Ve=()=>{var f,u;P.value=ke(),j.value=pt(K.value),j.value&&j.value.length&&(de(P.value,j.value[0],k.value,new l.Color(16711680)),(u=(f=E.value)==null?void 0:f.add)==null||u.call(f,P.value))};t.watch(()=>Se.value,async f=>{f&&(ne(),await Ce(f),D.value&&Ve())},{immediate:!0,deep:!0});const ze=()=>{var f;D.value&&((f=a==null?void 0:a.value)==null||f.playAnimation())},Ae=()=>{var f;D.value&&((f=a==null?void 0:a.value)==null||f.stopAnimation())},Ue=()=>{var f;D.value&&((f=a==null?void 0:a.value)==null||f.forwardFrame())},Ne=()=>{var f;D.value&&((f=a==null?void 0:a.value)==null||f.backwardFrame())},Me=()=>{g(),window.addEventListener("resize",y);const f=_();E.value=f.scene,E.value&&(E.value.name="CPMPIP")},Te=()=>{window.removeEventListener("resize",y),F.value&&he(),ne(),C()};return t.onMounted(async()=>{try{Me()}catch(f){console.error("Three.js 初始化失败:",f),W.ElMessage.error("渲染引擎初始化失败!")}}),t.onBeforeUnmount(()=>{Te()}),(f,u)=>{const R=t.resolveComponent("el-scrollbar");return t.openBlock(),t.createElementBlock("div",xt,[t.createElementVNode("div",{ref_key:"threejsContainer",ref:i,class:"threejs-container"},null,512),t.createElementVNode("div",bt,[t.createVNode(V.ThreeSvgIcon,{name:"viewReset",size:"24",onClick:t.unref(U),title:"重置"},null,8,["onClick"]),t.createVNode(V.ThreeSvgIcon,{name:"fangda",size:"24",title:"放大"}),t.createVNode(V.ThreeSvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),t.createVNode(V.ThreeSvgIcon,{name:"lookAround",size:"24",onClick:t.unref(pe),title:t.unref(F)?"停止动画":"动画视图"},null,8,["onClick","title"]),t.createVNode(V.ThreeSvgIcon,{name:"zuobiaoxi",size:"24",active:t.unref(A),onClick:we,title:"显隐坐标轴"},null,8,["active"])]),t.createElementVNode("div",St,[t.renderSlot(f.$slots,"button-left",{switchRightPanel:Y},void 0,!0),t.createVNode(V.ThreeSvgIcon,{name:"jiegoushu",size:"24",onClick:u[0]||(u[0]=w=>Y("场景树")),active:m.value&&d.value==="场景树",title:"场景树"},null,8,["active"]),t.createVNode(V.ThreeSvgIcon,{name:"clipping",size:"24",onClick:u[1]||(u[1]=w=>Y("剖面视图")),active:m.value&&d.value==="剖面视图",title:"剖面视图"},null,8,["active"])]),t.createElementVNode("div",_t,[t.renderSlot(f.$slots,"button-right",{switchRightPanel:Z},void 0,!0),t.createVNode(V.ThreeSvgIcon,{name:"guanjiekongzhi",size:"24",onClick:u[2]||(u[2]=w=>Z("关节控制")),active:h.value&&p.value==="关节控制",title:"关节控制"},null,8,["active"]),t.createVNode(V.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:u[3]||(u[3]=w=>Z("动画仿真")),active:h.value&&p.value==="动画仿真"},null,8,["active"])]),t.createElementVNode("div",Et,[t.createVNode(V.ThreeSvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:Ne}),t.createVNode(V.ThreeSvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:ze}),t.createVNode(V.ThreeSvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:Ue}),t.createVNode(V.ThreeSvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:Ae})]),t.withDirectives(t.createElementVNode("div",Ct,[t.createElementVNode("div",Vt,[t.createElementVNode("span",null,t.toDisplayString(d.value),1),t.createElementVNode("span",{class:"close",onClick:u[4]||(u[4]=w=>m.value=!1)}," X ")]),t.createElementVNode("div",zt,[t.createVNode(R,{height:"100%"},{default:t.withCtx(()=>[d.value==="场景树"?(t.openBlock(),t.createBlock(oe.UrdfTree,{key:0,model:v.value},null,8,["model"])):t.createCommentVNode("",!0),d.value==="剖面视图"?(t.openBlock(),t.createElementBlock("div",At,[t.createElementVNode("div",Ut,[t.createElementVNode("label",Nt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":u[5]||(u[5]=w=>t.isRef(z)?z.value=w:null),onChange:u[6]||(u[6]=(...w)=>t.unref(L)&&t.unref(L)(...w))},null,544),[[t.vModelRadio,t.unref(z)]]),u[14]||(u[14]=t.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),t.createElementVNode("label",Mt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":u[7]||(u[7]=w=>t.isRef(z)?z.value=w:null),onChange:u[8]||(u[8]=(...w)=>t.unref(L)&&t.unref(L)(...w))},null,544),[[t.vModelRadio,t.unref(z)]]),u[15]||(u[15]=t.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),t.createElementVNode("label",Tt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":u[9]||(u[9]=w=>t.isRef(z)?z.value=w:null),onChange:u[10]||(u[10]=(...w)=>t.unref(L)&&t.unref(L)(...w))},null,544),[[t.vModelRadio,t.unref(z)]]),u[16]||(u[16]=t.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),t.createElementVNode("label",Bt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":u[11]||(u[11]=w=>t.isRef(z)?z.value=w:null),onChange:u[12]||(u[12]=(...w)=>t.unref(L)&&t.unref(L)(...w))},null,544),[[t.vModelRadio,t.unref(z)]]),u[17]||(u[17]=t.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):t.createCommentVNode("",!0)]),_:1})])],512),[[t.vShow,m.value]]),t.withDirectives(t.createElementVNode("div",Lt,[t.createElementVNode("div",kt,[t.createElementVNode("span",null,t.toDisplayString(p.value),1),t.createElementVNode("span",{class:"close",onClick:u[13]||(u[13]=w=>h.value=!1)}," X ")]),t.createElementVNode("div",Dt,[t.createVNode(R,{height:"100%"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(oe.JointPanel,{model:v.value},null,8,["model"]),[[t.vShow,p.value==="关节控制"]]),t.withDirectives(t.createVNode(He,{ref_key:"animationPanelRef",ref:a,cloud:t.unref(k),knife:t.unref(P),vectors:j.value},null,8,["cloud","knife","vectors"]),[[t.vShow,p.value==="动画仿真"&&D.value]])]),_:1})])],512),[[t.vShow,h.value]]),s.value?(t.openBlock(),t.createElementBlock("div",Pt,[u[18]||(u[18]=t.createElementVNode("div",{class:"loading-spinner"},null,-1)),t.createElementVNode("p",null,t.toDisplayString(c.value),1)])):t.createCommentVNode("",!0)])}}}),Ft=ue._export_sfc(It,[["__scopeId","data-v-48ba356f"]]);exports.default=Ft;
|