ss-component-new 1.2.63 → 1.2.64
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-CaFP1Ou3.js → MTLLoader-CI8ixwPt.js} +1 -1
- package/dist/{MTLLoader-CE4kiml3.cjs → MTLLoader-Dvu7y2QT.cjs} +1 -1
- package/dist/{OrbitControls-DArl2VW_.js → OrbitControls-C9e3hYR3.js} +1 -1
- package/dist/{OrbitControls-Dp4IKx0f.cjs → OrbitControls-_0hxpyeP.cjs} +1 -1
- package/dist/{animationData-Bn6Bb5Do.cjs → animationData-D_zttqoJ.cjs} +1 -1
- package/dist/{animationData-CKhRG4G6.js → animationData-X5-Vecw1.js} +1 -1
- package/dist/{fileUtil-XthoWjc0.cjs → fileUtil-Bdou_B28.cjs} +1 -1
- package/dist/{fileUtil-CGSBIaqQ.js → fileUtil-DfZnK-Hd.js} +1 -1
- package/dist/{iconfont-CoOPkcMU.js → iconfont-BqCAG-Xa.js} +2 -2
- package/dist/{iconfont-CzHX5Q49.cjs → iconfont-CF0Z-1Zz.cjs} +1 -1
- package/dist/{index-DK2gRUQ5.js → index--dF_34pi.js} +3 -3
- package/dist/{index-B_N4MySi.js → index-4YT4LSe0.js} +6 -6
- package/dist/{index-D6f9QOaT.cjs → index-B67T_D-B.cjs} +1 -1
- package/dist/{index-BgGtziMi.js → index-BBhUi01k.js} +1 -1
- package/dist/{index-kU-daxaJ.cjs → index-BFDlTBy2.cjs} +1 -1
- package/dist/{index-BuLZitf5.js → index-BFbWwBLk.js} +1 -1
- package/dist/{index-CC7hLeHW.cjs → index-BNvzsde-.cjs} +1 -1
- package/dist/{index-BPAbLPKP.js → index-BXmDJjWZ.js} +3 -3
- package/dist/{index-BaCVhcpB.js → index-BayEAjm5.js} +2 -2
- package/dist/{index-DeoJm8bD.cjs → index-Bi-eQ_Ao.cjs} +1 -1
- package/dist/{index-DlWW881X.cjs → index-BlOdSSAq.cjs} +1 -1
- package/dist/{index-BlI13uDG.js → index-BtFLHygK.js} +3 -3
- package/dist/{index-CkjmhTCX.cjs → index-CCQIE4Oy.cjs} +1 -1
- package/dist/{index-BzE5v5kZ.js → index-CNm1s2vL.js} +1 -1
- package/dist/{index-CVvKFbm0.cjs → index-CPUMWDcJ.cjs} +1 -1
- package/dist/{index-BGs6f9ia.cjs → index-CQ1e9lYs.cjs} +1 -1
- package/dist/{index-CoM7mmmK.js → index-CS0QGxh0.js} +2 -2
- package/dist/{index-C9kezJl-.cjs → index-CVpMVZV1.cjs} +1 -1
- package/dist/{index-C27aVboC.cjs → index-C_sDHKxB.cjs} +1 -1
- package/dist/{index-BTFg_bTg.cjs → index-CbBgf-yk.cjs} +1 -1
- package/dist/{index-CA2Yz2_0.cjs → index-CkuJ8iH2.cjs} +1 -1
- package/dist/{index-D9lY54L2.cjs → index-Cl7W3Ut8.cjs} +1 -1
- package/dist/{index-CaVtcERG.js → index-CmhVDhAN.js} +1 -1
- package/dist/{index-DS74YOGT.js → index-Cr9tyePY.js} +1385 -1364
- package/dist/{index-Bp8HFrx8.cjs → index-Ctu9PMCG.cjs} +1 -1
- package/dist/{index-Dhr85_ZG.js → index-CuaFndyM.js} +1 -1
- package/dist/{index-BM3G9dKv.cjs → index-DE3DTsMe.cjs} +1 -1
- package/dist/{index-BIbEt8CC.cjs → index-DbTCGQx3.cjs} +1 -1
- package/dist/{index-DhNncUpj.js → index-DcOmBNJf.js} +6 -6
- package/dist/{index-CwUGEpBf.js → index-DcaPy4x5.js} +4 -4
- package/dist/{index-LviYrEee.cjs → index-DhBSzWe6.cjs} +1 -1
- package/dist/{index-Bav-TgWp.cjs → index-DtstoFZP.cjs} +1 -1
- package/dist/{index-Cv4ZnuwG.js → index-Dy4T7syW.js} +1 -1
- package/dist/{index-D4-Vm_be.js → index-Gf-kIKKw.js} +1 -1
- package/dist/{index-DbebBHFx.cjs → index-MRxhNso1.cjs} +1 -1
- package/dist/{index-0QG1fhmk.js → index-PQ_QQCkT.js} +3 -3
- package/dist/{index-DDIHX4cE.js → index-Z6YOQl0q.js} +1 -1
- package/dist/{index-DxoNiiaW.js → index-ZQaet9VV.js} +2 -2
- package/dist/{index-DO7yfB4v.cjs → index-ZRiaAb2v.cjs} +1 -1
- package/dist/{index-B3tcBTuN.js → index-ahynRrcW.js} +1 -1
- package/dist/{index-DtKItKKp.cjs → index-iaQGyhvU.cjs} +1 -1
- package/dist/{index-UbKxbl_Q.js → index-qjBFQjPJ.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-CVhcJCk3.cjs → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-B6ZjVCbD.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-DVDkdgUJ.js → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-B6uH3veM.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BKmza87s.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bs732h4o.js} +1642 -1647
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CVOmmDqn.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-ZpdB8yMK.cjs} +58 -58
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-BHE0HyLH.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-Bo0v68wl.js} +3 -3
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-UPn3ibM8.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-D6ACiiu0.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-BQu9bRjA.js → index.vue_vue_type_style_index_1_lang-BWrgp4ZE.js} +3 -3
- package/dist/{index.vue_vue_type_style_index_1_lang-BCgJtTb9.cjs → index.vue_vue_type_style_index_1_lang-C48UCmcC.cjs} +1 -1
- package/dist/{main-C8s1t45C.cjs → main-_mrHlIM9.cjs} +1 -1
- package/dist/{main-DYESspnW.js → main-m1Rhr2az.js} +2 -2
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +9 -9
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +10 -10
- package/dist/{threeModel-CPfys2Ir.cjs → threeModel-B3mSuqYu.cjs} +1 -1
- package/dist/{threeModel-CE2asK8z.js → threeModel-CvPCyPV6.js} +4 -4
- package/dist/{threePreview-B4pWTdK0.cjs → threePreview-BadLzWum.cjs} +1 -1
- package/dist/{threePreview-D1x3POg8.js → threePreview-C4uFnwJD.js} +3 -3
- package/dist/{threeSceneView-B7Rg5mYp.cjs → threeSceneView-BVrwU1JW.cjs} +1 -1
- package/dist/{threeSceneView-C_rkxb3y.js → threeSceneView-ZtLxHVG4.js} +6 -6
- package/dist/{threeSceneViewForCPMPIP-B6jB5Tek.cjs → threeSceneViewForCPMPIP-1YWF_a61.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-68VJDoWr.js → threeSceneViewForCPMPIP-C0FHJPj7.js} +7 -7
- package/dist/threeTrackPathView-DUeFqTH4.cjs +370 -0
- package/dist/{threeTrackPathView-Cs-yUH16.js → threeTrackPathView-uxK07M8K.js} +283 -263
- package/dist/{threeViewerHost-Ca1V8lHT.cjs → threeViewerHost-B0cP0E33.cjs} +1 -1
- package/dist/{threeViewerHost-N_id3Zd_.js → threeViewerHost-C5syYs1F.js} +2 -2
- package/dist/{urdfTree-D6IvPahB.js → urdfTree-DHVh6IAB.js} +1 -1
- package/dist/{urdfTree-Czcl8tzp.cjs → urdfTree-tjbbIpI4.cjs} +1 -1
- package/dist/{workpieceTreePanel-Cyhp8KK2.js → workpieceTreePanel-DrKcwg7Z.js} +5 -5
- package/dist/{workpieceTreePanel-CWGU_Vea.cjs → workpieceTreePanel-QjGBJMbm.cjs} +1 -1
- package/package.json +1 -1
- package/dist/obj/model.mtl +0 -42
- package/dist/obj/model.obj +0 -26110
- package/dist/threeTrackPathView-c50jFDAg.cjs +0 -370
- package/public/obj/model.mtl +0 -42
- package/public/obj/model.obj +0 -26110
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),X=require("./workpieceTreePanel-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),X=require("./workpieceTreePanel-QjGBJMbm.cjs"),pe=require("./iconfont-CF0Z-1Zz.cjs"),$=require("./index-C8qRkCgn.cjs"),s=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-ZpdB8yMK.cjs");require("./index.vue_vue_type_style_index_1_lang-O2ANIr19.cjs");require("./index-BpPyaNFa.cjs");const Q=require("./index-BQ3THxIZ.cjs");require("./index.vue_vue_type_style_index_1_lang-C48UCmcC.cjs");require("./index-DVkZbEnV.cjs");const Ce=require("./animationData-D_zttqoJ.cjs"),ne=require("./urdfTree-tjbbIpI4.cjs"),we=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ee=require("./dataUtil-y4dZJwH_.cjs"),M=require("./svgIcon-CUM54R6L.cjs"),Z=.001,H=s.MathUtils.degToRad,Ne=new s.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:s.DoubleSide});function Me(V=.005,m=64){const f=new s.CatmullRomCurve3([new s.Vector3(0,0,0),new s.Vector3(0,0,0)]),n=new s.TubeGeometry(f,m,V,16,!1),g=Ne;return new s.Mesh(n,g)}const ke=V=>V.reduce((m,f)=>{let n=0;const g=f.Y??0,h=f.C??0,c=f.R??0;return g>0&&(n+=g),h>0&&c>0&&(n+=c*H(h)),m+n},0),Te=V=>{const m=[],f=V.Y??0,n=V.B??0,g=V.C??0,h=V.R??0,c={pos:new s.Vector3(0,0,0),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};if(!f&&!g)return m;if(m.push(c.pos.clone()),n!==0){const C=new s.Matrix4().makeRotationAxis(c.localY,H(n));c.localX.applyMatrix4(C),c.localZ.applyMatrix4(C)}if(f>0&&(c.pos.add(c.localY.clone().multiplyScalar(f*Z)),m.push(c.pos.clone())),g>0&&h>0){const C=H(g),u=h*Z,_=c.pos.clone().add(c.localX.clone().multiplyScalar(-u)),r=Math.max(16,Math.ceil(g/5));for(let p=1;p<=r;p++){const a=C*p/r,d=new s.Matrix4().makeRotationAxis(c.localZ,a),b=c.localX.clone().multiplyScalar(u).applyMatrix4(d),E=_.clone().add(b);m.push(E)}}return m};function Se(V,m){const f=new s.Group;f.name="CompletePipe";const n={pos:new s.Vector3(0,0,0),localX:new s.Vector3(1,0,0),localY:new s.Vector3(0,1,0),localZ:new s.Vector3(0,0,1)};let g=0,h=1;for(let c=0;c<V.length;c++){const C=V[c],u=C.Y??0,_=C.B??0,r=C.C??0,p=C.R??0;if(_!==0){const a=new s.Matrix4().makeRotationAxis(n.localY,H(_));n.localX.applyMatrix4(a),n.localZ.applyMatrix4(a)}if(u>0){const a=n.pos.clone();n.pos.add(n.localY.clone().multiplyScalar(u*Z));const d=n.pos.clone(),i=Pe(a,d,m*Z);i.userData={segmentType:"straight",segmentIndex:g,frameIndex:c,length:u,frame:{Y:u,B:_,C:r,R:p}},i.name=`直段_${g}`,f.add(i);const b=a.clone();De(f,h,b,m*Z),g++}if(r>0&&p>0){const a=H(r),d=p*Z,i=[];i.push(n.pos.clone());const b=n.pos.clone().add(n.localX.clone().multiplyScalar(-d)),E=Math.max(16,Math.ceil(r/5));for(let P=1;P<=E;P++){const D=a*P/E,T=new s.Matrix4().makeRotationAxis(n.localZ,D),k=n.localX.clone().multiplyScalar(d).applyMatrix4(T),w=b.clone().add(k);i.push(w)}const v=Re(i,m*Z);v.userData={segmentType:"bend",segmentIndex:g,frameIndex:c,angle:r,radius:p,centerPoint:b.toArray(),frame:{Y:u,B:_,C:r,R:p}},v.name=`弯段_${g}`,f.add(v),Math.floor(i.length/2),i[0],n.pos=i[i.length-1].clone();const S=new s.Matrix4().makeRotationAxis(n.localZ,a);n.localY.applyMatrix4(S),n.localX.applyMatrix4(S),g++,h++}}return f}function De(V,m,f,n){const g=new s.Vector3(0,n*2,n*5),h=f.clone().add(g),c=[f,h],C=new s.BufferGeometry().setFromPoints(c),u=new s.LineDashedMaterial({color:16711680,dashSize:n*.5,gapSize:n*.3,linewidth:1}),_=new s.Line(C,u);_.computeLineDistances(),V.add(_);const r=document.createElement("canvas"),p=r.getContext("2d");r.width=128,r.height=128,p.clearRect(0,0,128,128),p.fillStyle="#FF0000",p.font="bold 80px Arial",p.textAlign="center",p.textBaseline="middle",p.fillText(m.toString(),64,64);const a=new s.CanvasTexture(r),d=new s.SpriteMaterial({map:a,transparent:!0,depthTest:!1,depthWrite:!1}),i=new s.Sprite(d),b=n*3;i.scale.set(b,b,1),i.position.copy(h),i.name=`Label_${m}`,i.userData={labelNumber:m},V.add(i)}function Pe(V,m,f){const n=new s.LineCurve3(V,m),g=new s.TubeGeometry(n,2,f,18,!1);return new s.Mesh(g,Ne)}function Re(V,m){const f=new s.CatmullRomCurve3(V,!1,"catmullrom",.01),n=new s.TubeGeometry(f,Math.max(16,V.length*2),m,18,!1);return new s.Mesh(n,Ne)}function _e(V,m,f,n,g,h=0){let c=m.slice(0,g+1);const C=m[g+1];if(C&&h>0){const i={...C,B:(C.B??0)*h,C:(C.C??0)*h};c.push(i)}const u=ke(c),_=Math.max(0,f-u),r=[];r.push(new s.Vector3(0,0,0));const p=new s.Vector3(0,_*Z,0);_>0&&r.push(p);let a={pos:p.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const d=[];for(let i=c.length-1;i>=0;i--){const b=c[i],E=Te(b);if(E.length>0){const v=E.map(T=>{const R=T.clone(),k=new s.Matrix4;return k.makeBasis(a.localX,a.localY,a.localZ),R.applyMatrix4(k),R.add(a.pos)});d.push(v);const S=v[v.length-1];a.pos=S.clone();const P=b.B??0,D=b.C??0;if(P!==0){const T=new s.Matrix4().makeRotationAxis(a.localY,H(P));a.localX.applyMatrix4(T),a.localZ.applyMatrix4(T)}if(D>0){const T=H(D),R=new s.Matrix4().makeRotationAxis(a.localZ,T);a.localY.applyMatrix4(R),a.localX.applyMatrix4(R)}}}for(const i of d)i.length>1&&r.push(...i.slice(1));r.length<2&&r.push(new s.Vector3(0,.001,0));try{const i=new s.CatmullRomCurve3(r,!1,"catmullrom",.01),b=new s.TubeGeometry(i,Math.max(2,r.length*4),n*Z,18,!1);V.geometry.dispose(),V.geometry=b}catch(i){console.error("管件更新失败",i)}}function xe(V,m,f,n=0){let g=V.slice(0,f+1);const h=V[f+1];if(h&&n>0){const a={...h,B:(h.B??0)*n,C:(h.C??0)*n};g.push(a)}const c=ke(g),C=Math.max(0,m-c),u=[];u.push(new s.Vector3(0,0,0));const _=new s.Vector3(0,C*Z,0);C>0&&u.push(_);let r={pos:_.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const p=[];for(let a=g.length-1;a>=0;a--){const d=g[a],i=Te(d);if(i.length>0){const b=i.map(P=>{const D=P.clone(),T=new s.Matrix4;return T.makeBasis(r.localX,r.localY,r.localZ),D.applyMatrix4(T),D.add(r.pos)});p.push(b);const E=b[b.length-1];r.pos=E.clone();const v=d.B??0,S=d.C??0;if(v!==0){const P=new s.Matrix4().makeRotationAxis(r.localY,H(v));r.localX.applyMatrix4(P),r.localZ.applyMatrix4(P)}if(S>0){const P=H(S),D=new s.Matrix4().makeRotationAxis(r.localZ,P);r.localY.applyMatrix4(D),r.localX.applyMatrix4(D)}}}for(const a of p)a.length>1&&u.push(...a.slice(1));return u.length<2&&u.push(new s.Vector3(0,.001,0)),u}function Ee(V,m,f,n,g,h,c,C=0,u=0){const _=g-u,r=xe(n,_,c,C);let a=xe(f,u,c,C);a.forEach(i=>i.y=-i.y),a.reverse();const d=[...a,...r];try{const i=new s.CatmullRomCurve3(d,!1,"catmullrom",.01),b=new s.TubeGeometry(i,Math.max(2,d.length*4),h*Z,18,!1);m.geometry.dispose(),V.geometry.dispose(),m.parent&&m.parent.remove(m),V.geometry=b}catch(i){console.error("管件更新失败",i)}}const Be={class:"panel-content"},ze={class:"action-bar"},Ae={class:"animation-controls"},$e={class:"control-row"},Fe={class:"control-row"},Ye={class:"frame-info"},Le={class:"control-row"},Ie={class:"progress-bar"},Ue={class:"dialog-footer"},je=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},emits:["getThreeData"],setup(V,{expose:m,emit:f}){const n=V,g=f,h=e.ref(),c=e.ref();e.watch(()=>n.threeData,l=>{const t=l==null?void 0:l.data;c.value=t==null?void 0:t.type},{immediate:!0});const C=async()=>{if(!sessionStorage.getItem("systemKey")){g("getThreeData");return}let t={};c.value===X.robotMode.SINGLE&&(t=await Ce.fetchSingleRobotAnimationData()),c.value===X.robotMode.DOUBLE&&(t=await Ce.fetchDoubleRobotAnimationData());const{initialPipeLength:o=0,pipeRadius:y=0,clampLength:N=0,animationData:x}=t;D.value=o,T.value=y,R.value=N,h.value=x;const O=$.cloneDeep(h.value),K=ce(F.value),q=(O==null?void 0:O["输出(动画数据)"])||[];u.value=q.length?q:[K]},u=e.ref([]),_=e.ref(!1),r=e.ref(""),p=e.ref(!1),a=e.ref(0),d=e.ref(0),i=e.ref(1e3);let b=!1;const E=e.ref(null),v=e.shallowRef(null),S=e.shallowRef(null),P=e.shallowRef(null),D=e.ref(0),T=e.ref(12.5),R=e.ref(30),k=e.ref([]),w=e.ref(null),I=e.computed(()=>n.model?ne.getNonFixedJoints(n.model).map(o=>o.name):[]),G=e.ref(["Y","B","C","R"]),F=e.computed(()=>[...I.value,...G.value]),Y=e.computed(()=>F.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${F.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),J=()=>u.value.map(l=>({Y:parseFloat(l.Y)||0,B:parseFloat(l.B)||0,C:parseFloat(l.C)||0,R:parseFloat(l.R)||0})),U=()=>{const l=[],t=[];return u.value.forEach(o=>{const{Y1:y,B1:N,C1:x,R1:O,Y2:K,B2:q,C2:ie,R2:A}=o;l.push({Y:parseFloat(y)||0,B:parseFloat(N)||0,C:parseFloat(x)||0,R:parseFloat(O)||0}),t.push({Y:parseFloat(K)||0,B:parseFloat(q)||0,C:parseFloat(ie)||0,R:parseFloat(A)||0})}),{posPipeYbcr:l,negPipeYbcr:t}},L=(l=0,t=0)=>{if(v.value&&S.value){const o=U();Ee(v.value,S.value,o.posPipeYbcr,o.negPipeYbcr,D.value,T.value,l,t,R.value)}else if(v.value){const o=J();_e(v.value,o,D.value,T.value,l,t)}},W=l=>{if(l<0||l>=u.value.length){console.error(`帧索引 ${l} 超出范围`);return}const t=u.value[l];if(console.log(`应用第 ${l} 帧数据 ${t}`),a.value=l,E.value){const o={};I.value.forEach(y=>{const N=parseFloat(t[y]);isNaN(N)||(o[y]=N)}),E.value.setJointAngles(o)}L(l,0)},B=async()=>{if(u.value.length===0){$.ElMessage.error("无法播放动画:无数据");return}if(!p.value){p.value=!0,b=!1,u.value.length-1===a.value&&(a.value=0);try{for(let l=a.value+1;l<u.value.length&&!b;l++){a.value=l;const t=u.value[l],o={};E.value&&I.value.forEach(y=>{const N=parseFloat(t[y]);isNaN(N)||(o[y]=N)}),E.value?await E.value.animateToState(o,i.value,y=>{d.value=(l+y)/u.value.length*100,L(l-1,y)}):(await new Promise(y=>setTimeout(y,i.value)),d.value=(l+1)/u.value.length*100)}b||$.ElMessage.success("动画播放完成")}catch(l){console.error("动画播放出错:",l),$.ElMessage.error("动画播放出错")}finally{p.value=!1,d.value=0}}},z=()=>{b=!0,p.value=!1,d.value=0,$.ElMessage.info("动画已停止")},ae=()=>{a.value=0},j=()=>{if(v.value&&S.value){const l=U();Ee(v.value,S.value,l.posPipeYbcr,l.negPipeYbcr,D.value,T.value,-1,0,R.value)}else if(v.value){const l=J();_e(v.value,l,D.value,T.value,-1,0)}},oe=()=>{E.value&&E.value.resetToZero(),j(),ae(),$.ElMessage.success("机器人和管件已重置")},me=l=>`第 ${l+1} 帧`,ve=l=>{p.value&&z(),W(l)},fe=()=>{p.value&&z(),!(a.value+1>=u.value.length)&&W(a.value+1)},ge=()=>{p.value&&z(),a.value!==0&&W(a.value-1)},se=()=>{P.value&&(P.value.visible=!0),v.value&&v.value.parent&&v.value.parent.remove(v.value),P.value=null,v.value=null,S.value=null},ce=l=>l==null?void 0:l.reduce((t,o)=>(t[o]="0",t),{});e.watch(F,(l,t)=>{if(JSON.stringify(l)!==JSON.stringify(t))if(l.length>0){const o=ce(l);u.value=[o]}else u.value=[]},{immediate:!0});const re=e.ref(0),he=l=>{re.value=l},ue=(l,t)=>{if(!l||!t)return;const o=ne.getTargetJoint(l,t),y=Me();y.visible=!1,o==null||o.add(y)},te=l=>{E.value=new X.URDFRobotController(l),k.value=ne.getAllLinkName(l),w.value="Pipe_Joint"},le=()=>{E.value=null,k.value=[],w.value=null},Ve=l=>{te(l),ue(l,w.value),he(re.value+1),oe()};e.watch(()=>n.model,l=>{if(se(),l){Ve(l);return}le()},{immediate:!0});const de=l=>{var o,y;const t=new s.Mesh(l.geometry.clone(),l.material);return t.name="managed_pipe_clone",(y=(o=l==null?void 0:l.parent)==null?void 0:o.add)==null||y.call(o,t),t.position.copy(l.position),t.rotation.copy(l.rotation),t.scale.copy(l.scale),t};e.watch([w,R,D,re],([l,t])=>{if(se(),n.model&&l){const o=ne.getMeshFromJoint(n.model,l);if(console.log(o,"meshToReplace"),o&&o.parent){P.value=o,o.visible=!1;const y=de(o);if(c.value===X.robotMode.SINGLE&&(y.position.y-=t*.001),v.value=y,c.value===X.robotMode.DOUBLE){const N=de(o);S.value=N}L(0,0)}else l&&console.warn(`在 link '${l}' 中未找到可替换的网格或其没有父级。`)}});const be=async()=>{if(F.value.length===0){$.ElMessage.warning("没有可导出的表头");return}const l=F.value.join(" ");try{await navigator.clipboard.writeText(l),$.ElMessage.success("表头已成功复制到剪贴板!")}catch(t){console.error("复制失败:",t),$.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},ye=()=>{if(!r.value.trim()){$.ElMessage.warning("导入内容不能为空");return}const l=r.value.trim().split(`
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { defineComponent as Oe, ref as h, watch as se, shallowRef as ve, computed as we, onUnmounted as Qe, resolveComponent as O, createElementBlock as _e, openBlock as te, createElementVNode as n, createVNode as o, withCtx as T, createBlock as Ce, createCommentVNode as ye, unref as M, toDisplayString as me, onMounted as We, onBeforeUnmount as Ie, Fragment as et, renderList as tt, nextTick as lt, withDirectives as q, vShow as re, renderSlot as de, isRef as Te, vModelRadio as Re } from "vue";
|
|
2
|
-
import { r as Ve, U as ot, s as je, u as nt, a as at, W as st } from "./workpieceTreePanel-
|
|
3
|
-
import { u as Ke, a as it, b as rt } from "./iconfont-
|
|
2
|
+
import { r as Ve, U as ot, s as je, u as nt, a as at, W as st } from "./workpieceTreePanel-DrKcwg7Z.js";
|
|
3
|
+
import { u as Ke, a as it, b as rt } from "./iconfont-BqCAG-Xa.js";
|
|
4
4
|
import { ag as ut, c as ct, E as X, aW as pt, aw as dt } from "./index-CbJEJj8c.js";
|
|
5
|
-
import { t as Me, T as ke, V as F, r as Q, s as mt, u as vt, k as Se, v as ft, L as gt, w as ht, x as bt, y as yt, z as wt, F as _t, I as Ct, p as kt } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
5
|
+
import { t as Me, T as ke, V as F, r as Q, s as mt, u as vt, k as Se, v as ft, L as gt, w as ht, x as bt, y as yt, z as wt, F as _t, I as Ct, p as kt } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bs732h4o.js";
|
|
6
6
|
import "./index.vue_vue_type_style_index_1_lang-BgRTCj1c.js";
|
|
7
7
|
import "./index-BHtNKL1L.js";
|
|
8
8
|
import { _ as ue, s as Pt } from "./index-PWcnUgCA.js";
|
|
9
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
9
|
+
import "./index.vue_vue_type_style_index_1_lang-BWrgp4ZE.js";
|
|
10
10
|
import "./index-CmmnHGCt.js";
|
|
11
|
-
import { f as xt, a as Dt } from "./animationData-
|
|
12
|
-
import { g as Tt, a as Rt, b as Vt, c as Mt, U as St, J as At } from "./urdfTree-
|
|
11
|
+
import { f as xt, a as Dt } from "./animationData-X5-Vecw1.js";
|
|
12
|
+
import { g as Tt, a as Rt, b as Vt, c as Mt, U as St, J as At } from "./urdfTree-DHVh6IAB.js";
|
|
13
13
|
import { _ as Xe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
14
14
|
import { g as zt, a as Ee, d as $t, c as Ft, e as Yt, b as Lt } from "./dataUtil-CjMMOcMp.js";
|
|
15
15
|
import { T as A } from "./svgIcon-D-_fXUBL.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Te=require("./index.vue_vue_type_style_index_1_lang-O2ANIr19.cjs"),A=require("./workpieceTreePanel-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Te=require("./index.vue_vue_type_style_index_1_lang-O2ANIr19.cjs"),A=require("./workpieceTreePanel-QjGBJMbm.cjs"),Z=require("./iconfont-CF0Z-1Zz.cjs"),p=require("./index-C8qRkCgn.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-ZpdB8yMK.cjs");const Q=require("./index-BQ3THxIZ.cjs"),G=require("./urdfTree-tjbbIpI4.cjs"),se=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),g=require("./svgIcon-CUM54R6L.cjs"),De=require("./animationData-D_zttqoJ.cjs"),Me=require("./MTLLoader-Dvu7y2QT.cjs"),oe=require("./index-Bi-eQ_Ao.cjs"),$e={class:"panel-content"},Be={class:"action-bar"},ze={key:0,class:"animation-controls"},Le={class:"control-row"},Re={class:"control-row"},Ue={class:"frame-info"},je={class:"control-row"},Ae={key:1,class:"empty-state"},Ie={class:"dialog-footer"},Oe=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(B,{expose:I}){const k=B,o=e.ref([]),w=e.ref(!1),C=e.ref(""),v=e.ref("stopped"),c=e.ref(0),y=e.ref(0),z=e.ref(10),S=e.ref(null);let h=0;const O=e.ref([]),T=e.computed(()=>k.model?G.getNonFixedJoints(k.model).map(m=>m.name):[]),P=e.computed(()=>[...T.value]),W=e.computed(()=>P.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${P.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),R=e.computed(()=>o.value[c.value]||{});e.watch(()=>k.model,s=>{s?(S.value=new A.URDFRobotController(s),O.value=G.getAllLinkName(s),c.value=0):(S.value=null,O.value=[])},{immediate:!0});const U=s=>{if(s<0||s>=o.value.length){console.error(`帧索引 ${s} 超出范围`);return}const n=o.value[s];if(S.value){const m={};T.value.forEach(N=>{const i=parseFloat(n[N]);isNaN(i)||(m[N]=i)}),S.value.setJointAngles(m)}c.value=s,y.value=o.value.length>1?s/(o.value.length-1)*100:100},H=async s=>{try{for(let n=c.value;n<o.value.length;n++){if(s!==h)return;const m=o.value[n],N={};if(S.value)T.value.forEach(i=>{const r=parseFloat(m[i]);isNaN(r)||(N[i]=r)}),await S.value.animateToState(N,z.value,i=>{s===h&&(y.value=(n+i)/o.value.length*100)});else{if(await new Promise(i=>setTimeout(i,z.value)),s!==h)return;y.value=(n+1)/o.value.length*100}c.value=n}s===h&&(p.ElMessage.success("动画播放完成"),v.value="stopped",y.value=100)}catch(n){console.error("动画播放出错:",n),p.ElMessage.error("动画播放出错"),v.value="stopped"}},_=()=>{if(o.value.length===0){p.ElMessage.error("无动画数据");return}v.value==="stopped"&&(c.value=0,U(0)),v.value="playing",h++,H(h),p.ElMessage.info("动画播放中")},V=()=>{v.value==="playing"&&(h++,v.value="paused",p.ElMessage.info("动画已暂停"))},D=()=>{h++,v.value="stopped",c.value=0,y.value=0,U(0),p.ElMessage.info("动画已停止并重置")},E=()=>{v.value==="playing"?V():_()},F=s=>{h++,v.value="paused",U(s)},q=()=>{if(!C.value.trim()){p.ElMessage.warning("导入内容不能为空");return}const s=C.value.trim().split(`
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { defineComponent as we, ref as u, computed as U, watch as Z, onUnmounted as He, resolveComponent as q, createElementBlock as M, openBlock as z, createElementVNode as l, createCommentVNode as G, createVNode as i, toDisplayString as B, Fragment as Ke, renderList as We, withCtx as ne, inject as he, shallowRef as ue, onMounted as Ye, nextTick as Ze, onBeforeUnmount as qe, withDirectives as $, vShow as W, renderSlot as Y, unref as d, createBlock as ye, isRef as re, vModelRadio as de } from "vue";
|
|
2
2
|
import { aw as Qe } from "./index.vue_vue_type_style_index_1_lang-BgRTCj1c.js";
|
|
3
|
-
import { U as et, s as ke, u as tt, a as lt, W as at } from "./workpieceTreePanel-
|
|
4
|
-
import { u as nt, a as ot, b as st } from "./iconfont-
|
|
3
|
+
import { U as et, s as ke, u as tt, a as lt, W as at } from "./workpieceTreePanel-DrKcwg7Z.js";
|
|
4
|
+
import { u as nt, a as ot, b as st } from "./iconfont-BqCAG-Xa.js";
|
|
5
5
|
import { c as it, E as y } from "./index-CbJEJj8c.js";
|
|
6
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
6
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bs732h4o.js";
|
|
7
7
|
import { _ as pe } from "./index-PWcnUgCA.js";
|
|
8
|
-
import { g as ut, b as rt, U as dt, J as ct, d as vt } from "./urdfTree-
|
|
8
|
+
import { g as ut, b as rt, U as dt, J as ct, d as vt } from "./urdfTree-DHVh6IAB.js";
|
|
9
9
|
import { _ as Ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
10
10
|
import { T as h } from "./svgIcon-D-_fXUBL.js";
|
|
11
|
-
import { i as pt } from "./animationData-
|
|
12
|
-
import { O as mt } from "./MTLLoader-
|
|
13
|
-
import { L as ft, j as gt } from "./index-
|
|
11
|
+
import { i as pt } from "./animationData-X5-Vecw1.js";
|
|
12
|
+
import { O as mt } from "./MTLLoader-CI8ixwPt.js";
|
|
13
|
+
import { L as ft, j as gt } from "./index-4YT4LSe0.js";
|
|
14
14
|
const bt = { class: "panel-content" }, ht = { class: "action-bar" }, yt = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "animation-controls"
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),O=require("./iconfont-CF0Z-1Zz.cjs"),l=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-ZpdB8yMK.cjs"),ye=require("./fileUtil-Bdou_B28.cjs"),we=require("./index-C8qRkCgn.cjs"),J=require("./urdfTree-tjbbIpI4.cjs"),y=require("./svgIcon-CUM54R6L.cjs"),xe=require("./isString--eJE54G5.cjs"),Se=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),K=new l.Box3,R=new l.Vector3;class oe 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],i=[-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(i,2))}applyMatrix4(e){const i=this.attributes.instanceStart,o=this.attributes.instanceEnd;return i!==void 0&&(i.applyMatrix4(e),o.applyMatrix4(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));const o=new l.InstancedInterleavedBuffer(i,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 i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));const o=new l.InstancedInterleavedBuffer(i,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 i=e.geometry;return this.setPositions(i.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new l.Box3);const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;e!==void 0&&i!==void 0&&(this.boundingBox.setFromBufferAttribute(e),K.setFromBufferAttribute(i),this.boundingBox.union(K))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new l.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(e!==void 0&&i!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let n=0;for(let c=0,d=e.count;c<d;c++)R.fromBufferAttribute(e,c),n=Math.max(n,o.distanceToSquared(R)),R.fromBufferAttribute(i,c),n=Math.max(n,o.distanceToSquared(R));this.boundingSphere.radius=Math.sqrt(n),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 $ 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 G=new l.Vector4,Q=new l.Vector3,ee=new l.Vector3,w=new l.Vector4,x=new l.Vector4,V=new l.Vector4,H=new l.Vector3,q=new l.Matrix4,S=new l.Line3,te=new l.Vector3,F=new l.Box3,W=new l.Sphere,_=new l.Vector4;let U,B;function ne(s,e,i){return _.set(0,0,-e,1).applyMatrix4(s.projectionMatrix),_.multiplyScalar(1/_.w),_.x=B/i.width,_.y=B/i.height,_.applyMatrix4(s.projectionMatrixInverse),_.multiplyScalar(1/_.w),Math.abs(Math.max(_.x,_.y))}function be(s,e){const i=s.matrixWorld,o=s.geometry,n=o.attributes.instanceStart,c=o.attributes.instanceEnd,d=Math.min(o.instanceCount,n.count);for(let a=0,u=d;a<u;a++){S.start.fromBufferAttribute(n,a),S.end.fromBufferAttribute(c,a),S.applyMatrix4(i);const f=new l.Vector3,p=new l.Vector3;U.distanceSqToSegment(S.start,S.end,p,f),p.distanceTo(f)<B*.5&&e.push({point:p,pointOnLine:f,distance:U.origin.distanceTo(p),object:s,face:null,faceIndex:a,uv:null,uv1:null})}}function ze(s,e,i){const o=e.projectionMatrix,c=s.material.resolution,d=s.matrixWorld,a=s.geometry,u=a.attributes.instanceStart,f=a.attributes.instanceEnd,p=Math.min(a.instanceCount,u.count),v=-e.near;U.at(1,V),V.w=1,V.applyMatrix4(e.matrixWorldInverse),V.applyMatrix4(o),V.multiplyScalar(1/V.w),V.x*=c.x/2,V.y*=c.y/2,V.z=0,H.copy(V),q.multiplyMatrices(e.matrixWorldInverse,d);for(let h=0,T=p;h<T;h++){if(w.fromBufferAttribute(u,h),x.fromBufferAttribute(f,h),w.w=1,x.w=1,w.applyMatrix4(q),x.applyMatrix4(q),w.z>v&&x.z>v)continue;if(w.z>v){const C=w.z-x.z,N=(w.z-v)/C;w.lerp(x,N)}else if(x.z>v){const C=x.z-w.z,N=(x.z-v)/C;x.lerp(w,N)}w.applyMatrix4(o),x.applyMatrix4(o),w.multiplyScalar(1/w.w),x.multiplyScalar(1/x.w),w.x*=c.x/2,w.y*=c.y/2,x.x*=c.x/2,x.y*=c.y/2,S.start.copy(w),S.start.z=0,S.end.copy(x),S.end.z=0;const A=S.closestPointToPointParameter(H,!0);S.at(A,te);const b=l.MathUtils.lerp(w.z,x.z,A),z=b>=-1&&b<=1,I=H.distanceTo(te)<B*.5;if(z&&I){S.start.fromBufferAttribute(u,h),S.end.fromBufferAttribute(f,h),S.start.applyMatrix4(d),S.end.applyMatrix4(d);const C=new l.Vector3,N=new l.Vector3;U.distanceSqToSegment(S.start,S.end,N,C),i.push({point:N,pointOnLine:C,distance:U.origin.distanceTo(N),object:s,face:null,faceIndex:h,uv:null,uv1:null})}}}class Ee extends l.Mesh{constructor(e=new oe,i=new $({color:Math.random()*16777215})){super(e,i),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,i=e.attributes.instanceStart,o=e.attributes.instanceEnd,n=new Float32Array(2*i.count);for(let d=0,a=0,u=i.count;d<u;d++,a+=2)Q.fromBufferAttribute(i,d),ee.fromBufferAttribute(o,d),n[a]=a===0?0:n[a-1],n[a+1]=n[a]+Q.distanceTo(ee);const c=new l.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new l.InterleavedBufferAttribute(c,1,0)),e.setAttribute("instanceDistanceEnd",new l.InterleavedBufferAttribute(c,1,1)),this}raycast(e,i){const o=this.material.worldUnits,n=e.camera;n===null&&!o&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const c=e.params.Line2!==void 0&&e.params.Line2.threshold||0;U=e.ray;const d=this.matrixWorld,a=this.geometry,u=this.material;B=u.linewidth+c,a.boundingSphere===null&&a.computeBoundingSphere(),W.copy(a.boundingSphere).applyMatrix4(d);let f;if(o)f=B*.5;else{const v=Math.max(n.near,W.distanceToPoint(U.origin));f=ne(n,v,u.resolution)}if(W.radius+=f,U.intersectsSphere(W)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),F.copy(a.boundingBox).applyMatrix4(d);let p;if(o)p=B*.5;else{const v=Math.max(n.near,F.distanceToPoint(U.origin));p=ne(n,v,u.resolution)}F.expandByScalar(p),U.intersectsBox(F)!==!1&&(o?be(this,i):ze(this,n,i))}onBeforeRender(e){const i=this.material.uniforms;i&&i.resolution&&(e.getViewport(G),this.material.uniforms.resolution.value.set(G.z,G.w))}}class se extends oe{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const i=e.length-3,o=new Float32Array(2*i);for(let n=0;n<i;n+=3)o[2*n]=e[n],o[2*n+1]=e[n+1],o[2*n+2]=e[n+2],o[2*n+3]=e[n+3],o[2*n+4]=e[n+4],o[2*n+5]=e[n+5];return super.setPositions(o),this}setColors(e){const i=e.length-3,o=new Float32Array(2*i);for(let n=0;n<i;n+=3)o[2*n]=e[n],o[2*n+1]=e[n+1],o[2*n+2]=e[n+2],o[2*n+3]=e[n+3],o[2*n+4]=e[n+4],o[2*n+5]=e[n+5];return super.setColors(o),this}setFromPoints(e){const i=e.length-1,o=new Float32Array(6*i);for(let n=0;n<i;n++)o[6*n]=e[n].x,o[6*n+1]=e[n].y,o[6*n+2]=e[n].z||0,o[6*n+3]=e[n+1].x,o[6*n+4]=e[n+1].y,o[6*n+5]=e[n+1].z||0;return super.setPositions(o),this}fromLine(e){const i=e.geometry;return this.setPositions(i.attributes.position.array),this}}class Ce extends Ee{constructor(e=new se,i=new $({color:Math.random()*16777215})){super(e,i),this.isLine2=!0,this.type="Line2"}}function Ve(s){const e=[];return s.forEach(i=>{const[o,n,c]=i.trim().split(/\s+/);e.push(+o,+n,+c)}),e}function ie(s,e,i){switch(s){case"X":e.x=+i||0;break;case"Y":e.y=+i||0;break;case"Z":e.z=+i||0;break}}function _e(s){const e=[],i=["X","Y","Z"];return s.forEach(o=>{const n={x:0,y:0,z:0},c=o.trim();if(!c)return;let d=null,a="";for(let u=0;u<(c==null?void 0:c.length);u++){const f=c[u],p=i.find(v=>v===f);if(p){d&&ie(d,n,a),a="",d=p;continue}a=a+f}ie(d,n,a),e.push(n.x,n.y,n.z)}),e}const Ue=s=>s==null?void 0:s.filter(i=>i.includes("=")),Te=s=>s.replace(/,/g,""),Ae=s=>s==null?void 0:s.map(i=>Te(i)),Ne=s=>{const e=Ue(s);return Ae(e)};function Me(s){const e=Ne(s),i=[];return e.forEach(o=>{var v,h,T,L,A,b;let[n,c,d,a]=o.trim().split(/\s+/);c=(v=c==null?void 0:c.trim)==null?void 0:v.call(c),d=(h=d==null?void 0:d.trim)==null?void 0:h.call(d),a=(T=a==null?void 0:a.trim)==null?void 0:T.call(a);const[,u]=(L=c==null?void 0:c.split)==null?void 0:L.call(c,"="),[,f]=(A=d==null?void 0:d.split)==null?void 0:A.call(d,"="),[,p]=(b=a==null?void 0:a.split)==null?void 0:b.call(a,"=");i.push(+u,+f,+p)}),i}function Le(s){return s==null?void 0:s.includes("=")}async function Be(s){var n,c;const e=(n=s==null?void 0:s.trim())==null?void 0:n.split(/\r?\n/);if(Le(s))return Me(e);const i=e==null?void 0:e[0],o=(c=i==null?void 0:i.trim())==null?void 0:c.split(/\s+/);if((o==null?void 0:o.length)>=3)return Ve(e);if((o==null?void 0:o.length)===1)return _e(e)}async function Ie(s){const e=s.trim().split(/\r?\n/),i=[];return e.forEach(o=>{const n=o.trim().split(/\s+/);if(n.length!=3)return;const[c,d,a]=n;i.push(+c,+d,+a)}),i}async function Pe(s){const e=s.trim().split(/\r?\n/),i=[];return e.forEach(o=>{const n=o.trim().split(/\s+/);if(n.length!=3)return;const[c,d,a]=n;i.push(+c,+d,+a)}),i}async function ke(s,e){const{isCyd:i,isUv:o,isCpt:n}=e;return o?Be(s):i?Pe(s):n?Ie(s):[]}function De(s,e){if(!e||e.length<3)return;const{scene:i,camera:o,renderer:n,controls:c}=s();if(!i||!o||!n||!c)return;const d=[];for(let h=0;h<e.length;h+=3)d.push(new l.Vector3(e[h],e[h+1],e[h+2]));const u=new l.CatmullRomCurve3(d,!1,"catmullrom",.5).getPoints(150).flatMap(h=>[h.x,h.y,h.z]),f=new se;f.setPositions(u);const p=new $({color:55551,linewidth:3,resolution:new l.Vector2(window.innerWidth,window.innerHeight)}),v=new Ce(f,p);return v.name="轨迹路径",i.add(v),v}function Oe(s,e,i,o=4,n=50){let c=1/0,d=-1/0,a=1/0,u=-1/0,f=1/0,p=-1/0;for(let b=0;b<s.length;b+=3){const z=s[b],I=s[b+1],C=s[b+2];c=Math.min(c,z),d=Math.max(d,z),a=Math.min(a,I),u=Math.max(u,I),f=Math.min(f,C),p=Math.max(p,C)}const h=Math.sqrt((d-c)**2+(u-a)**2+(p-f)**2)*.05,T=l.MathUtils.degToRad(e.fov),L=2*Math.tan(T/2)*n,A=h/L*i.domElement.height*(o/4);return Math.max(1,A)}function je(s){const e=new l.BufferGeometry;e.setAttribute("position",new l.Float32BufferAttribute(s,3));const i=new l.PointsMaterial({color:55551,size:1,sizeAttenuation:!1});return new l.Points(e,i)}function Re(s,e){if(!e)return;const{scene:i,camera:o,renderer:n,controls:c}=s();if(!i||!o||!n||!c)return;const d=je(e);d.name="轨迹路径",i.add(d);const a=Oe(e,o,n,.5,50);return d.material.size=a,d}const Fe={class:"obj-viewer-container"},We={class:"buttonGroup-top"},Ge={class:"buttonGroup-topLeft"},He={class:"buttonGroup-left"},qe={class:"buttonGroup-right"},$e={class:"buttonGroup-bottom"},Xe={class:"left-panel"},Ye={class:"panel-header"},Ze={class:"panel-body"},Je={key:1,class:"clipping-content"},Ke={class:"radio-group"},Qe={class:"radio-label"},et={class:"radio-label"},tt={class:"radio-label"},nt={class:"radio-label"},it={class:"right-panel"},ot={class:"panel-header"},st={class:"panel-body"},rt={key:0,class:"loading-overlay"},at=t.defineComponent({__name:"threeTrackPathView",props:{fileUrls:{},threeData:{default:()=>""},trackFileType:{}},emits:["getAnimationData","getThreeData"],setup(s,{emit:e}){const i=e,o=s,n=t.ref(null),c=t.ref(!1),d=t.ref(""),a=t.ref(!1),u=t.ref(""),f=t.ref(!1),p=t.ref(""),v=t.shallowRef(null),h=t.shallowRef(null),{currentModels:T,resetView:L,initThreeJS:A,handleResize:b,getThreeJSObjects:z,cleanup:I,axesHelperVisible:C,toggleAxesVisibility:N}=O.useThreeJS(n),{isAnimating:X,toggleAnimation:re,stopAnimation:ae}=O.useAnimation(z,T),{isClipping:le,activeClippingAxis:E,toggleClipping:ce,updateClippingPlanes:M}=O.useClipping(z,T),de=()=>{N()},k=m=>{a.value=!0,u.value=m,m==="剖面视图"&&!le.value&&ce()},j=m=>{f.value=!0,p.value=m,m==="动画仿真"&&i("getAnimationData")},Y=t.ref([]),ue=t.computed(()=>{var r;return(r=o.trackFileType)==null?void 0:r.isUv}),fe=t.computed(()=>{var r;return(r=o.trackFileType)==null?void 0:r.isCyd}),pe=t.computed(()=>{var r;return(r=o.trackFileType)==null?void 0:r.isCpt}),me=t.computed(()=>{const m=o.fileUrls||[];return m==null?void 0:m[0]});let P=null;const Z=()=>{const{scene:m}=z();P&&m&&(O.disposeObj(P,m),P=null)},he=async m=>{const r=await ye.readFileText(m);if(xe.isString(r)){Y.value=await ke(r,o.trackFileType)||[];const D=Y.value;ue.value&&(P=De(z,D)),(fe.value||pe.value)&&(P=Re(z,D)),O.frameCameraToMesh(z,P)}};t.watch(()=>me.value,async m=>{m&&(Z(),await he(m))},{immediate:!0,deep:!0});const ve=()=>{A(),window.addEventListener("resize",b);const m=z();h.value=m.scene,h.value&&(h.value.name="CPMPIP")},ge=()=>{window.removeEventListener("resize",b),X.value&&ae(),Z(),I()};return t.onMounted(async()=>{try{ve()}catch(m){console.error("Three.js 初始化失败:",m),we.ElMessage.error("渲染引擎初始化失败!")}}),t.onBeforeUnmount(()=>{ge()}),(m,r)=>{const D=t.resolveComponent("el-scrollbar");return t.openBlock(),t.createElementBlock("div",Fe,[t.createElementVNode("div",{ref_key:"threejsContainer",ref:n,class:"threejs-container"},null,512),t.createElementVNode("div",We,[t.createVNode(y.ThreeSvgIcon,{name:"guanjianjiexi",size:"34"}),t.createVNode(y.ThreeSvgIcon,{name:"guanjiekongzhi",size:"34"}),t.createVNode(y.ThreeSvgIcon,{name:"gongyishengcheng",size:"34"}),t.createVNode(y.ThreeSvgIcon,{name:"buchangshezhi",size:"34"}),t.createVNode(y.ThreeSvgIcon,{name:"shuchujiagongchengxu",size:"34"})]),t.createElementVNode("div",Ge,[t.createVNode(y.ThreeSvgIcon,{name:"viewReset",size:"24",onClick:t.unref(L),title:"重置"},null,8,["onClick"]),t.createVNode(y.ThreeSvgIcon,{name:"fangda",size:"24",title:"放大"}),t.createVNode(y.ThreeSvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),t.createVNode(y.ThreeSvgIcon,{name:"lookAround",size:"24",onClick:t.unref(re),title:t.unref(X)?"停止动画":"动画视图"},null,8,["onClick","title"]),t.createVNode(y.ThreeSvgIcon,{name:"zuobiaoxi",size:"24",active:t.unref(C),onClick:de,title:"显隐坐标轴"},null,8,["active"])]),t.createElementVNode("div",He,[t.renderSlot(m.$slots,"button-left",{switchRightPanel:k},void 0,!0),t.createVNode(y.ThreeSvgIcon,{name:"jiegoushu",size:"24",onClick:r[0]||(r[0]=g=>k("场景树")),active:a.value&&u.value==="场景树",title:"场景树"},null,8,["active"]),t.createVNode(y.ThreeSvgIcon,{name:"clipping",size:"24",onClick:r[1]||(r[1]=g=>k("剖面视图")),active:a.value&&u.value==="剖面视图",title:"剖面视图"},null,8,["active"]),t.createVNode(y.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",onClick:r[2]||(r[2]=g=>k("场景树3"))}),t.createVNode(y.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",onClick:r[3]||(r[3]=g=>k("场景4"))})]),t.createElementVNode("div",qe,[t.renderSlot(m.$slots,"button-right",{switchRightPanel:j},void 0,!0),t.createVNode(y.ThreeSvgIcon,{name:"donghuafangzhen",size:"24"}),t.createVNode(y.ThreeSvgIcon,{name:"guanjiekongzhi",size:"24",onClick:r[4]||(r[4]=g=>j("关节控制")),active:f.value&&p.value==="关节控制",title:"关节控制"},null,8,["active"]),t.createVNode(y.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:r[5]||(r[5]=g=>j("动画仿真")),active:f.value&&p.value==="动画仿真"},null,8,["active"]),t.createVNode(y.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"urdf动画",onClick:r[6]||(r[6]=g=>j("urdf动画")),active:f.value&&p.value==="urdf动画"},null,8,["active"]),t.createVNode(y.ThreeSvgIcon,{name:"donghuafangzhen",size:"24"})]),t.createElementVNode("div",$e,[t.createVNode(y.ThreeSvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:r[7]||(r[7]=()=>{})}),t.createVNode(y.ThreeSvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:r[8]||(r[8]=()=>{})}),t.createVNode(y.ThreeSvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:r[9]||(r[9]=()=>{})}),t.createVNode(y.ThreeSvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:r[10]||(r[10]=()=>{})}),t.createVNode(y.ThreeSvgIcon,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:r[11]||(r[11]=()=>{})})]),t.withDirectives(t.createElementVNode("div",Xe,[t.createElementVNode("div",Ye,[t.createElementVNode("span",null,t.toDisplayString(u.value),1),t.createElementVNode("span",{class:"close",onClick:r[12]||(r[12]=g=>a.value=!1)}," X ")]),t.createElementVNode("div",Ze,[t.createVNode(D,{height:"100%"},{default:t.withCtx(()=>[u.value==="场景树"?(t.openBlock(),t.createBlock(J.UrdfTree,{key:0,model:v.value},null,8,["model"])):t.createCommentVNode("",!0),u.value==="剖面视图"?(t.openBlock(),t.createElementBlock("div",Je,[t.createElementVNode("div",Ke,[t.createElementVNode("label",Qe,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":r[13]||(r[13]=g=>t.isRef(E)?E.value=g:null),onChange:r[14]||(r[14]=(...g)=>t.unref(M)&&t.unref(M)(...g))},null,544),[[t.vModelRadio,t.unref(E)]]),r[22]||(r[22]=t.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),t.createElementVNode("label",et,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":r[15]||(r[15]=g=>t.isRef(E)?E.value=g:null),onChange:r[16]||(r[16]=(...g)=>t.unref(M)&&t.unref(M)(...g))},null,544),[[t.vModelRadio,t.unref(E)]]),r[23]||(r[23]=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":r[17]||(r[17]=g=>t.isRef(E)?E.value=g:null),onChange:r[18]||(r[18]=(...g)=>t.unref(M)&&t.unref(M)(...g))},null,544),[[t.vModelRadio,t.unref(E)]]),r[24]||(r[24]=t.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),t.createElementVNode("label",nt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":r[19]||(r[19]=g=>t.isRef(E)?E.value=g:null),onChange:r[20]||(r[20]=(...g)=>t.unref(M)&&t.unref(M)(...g))},null,544),[[t.vModelRadio,t.unref(E)]]),r[25]||(r[25]=t.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):t.createCommentVNode("",!0)]),_:1})])],512),[[t.vShow,a.value]]),t.withDirectives(t.createElementVNode("div",it,[t.createElementVNode("div",ot,[t.createElementVNode("span",null,t.toDisplayString(p.value),1),t.createElementVNode("span",{class:"close",onClick:r[21]||(r[21]=g=>f.value=!1)}," X ")]),t.createElementVNode("div",st,[t.createVNode(D,{height:"100%"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(J.JointPanel,{model:v.value},null,8,["model"]),[[t.vShow,p.value==="关节控制"]])]),_:1})])],512),[[t.vShow,f.value]]),c.value?(t.openBlock(),t.createElementBlock("div",rt,[r[26]||(r[26]=t.createElementVNode("div",{class:"loading-spinner"},null,-1)),t.createElementVNode("p",null,t.toDisplayString(d.value),1)])):t.createCommentVNode("",!0)])}}}),lt=Se._export_sfc(at,[["__scopeId","data-v-c3ad7441"]]);exports.default=lt;
|