ss-component-new 1.2.98 → 1.2.99
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-B4z0XNO-.js +304 -0
- package/dist/MTLLoader-n_3HPhif.cjs +2 -0
- package/dist/OBJLoader-C_JaUegI.cjs +5 -0
- package/dist/OBJLoader-Dilcv9TL.js +356 -0
- package/dist/{OrbitControls-BLs9AYBY.cjs → OrbitControls-8LBwRzcq.cjs} +1 -1
- package/dist/{OrbitControls-KkyEKP5M.js → OrbitControls-Cz47Q27N.js} +1 -1
- package/dist/{animationData-Btgynl98.js → animationData-C8lM4zZj.js} +1 -1
- package/dist/{animationData-CCImpyvS.cjs → animationData-CKcPDmLp.cjs} +1 -1
- package/dist/{iconfont-BXzhYF5A.cjs → iconfont-B1cUqs_N.cjs} +1 -1
- package/dist/{iconfont-B8CQB3CO.js → iconfont-CUWS5tNH.js} +2 -2
- package/dist/{index-6sDAnob5.cjs → index-2hqZ_tND.cjs} +1 -1
- package/dist/{index-CnBVZu9x.cjs → index-AuEh0RiU.cjs} +1 -1
- package/dist/{index-BaXxrBtb.cjs → index-B2UPNwqJ.cjs} +1 -1
- package/dist/{index-DXrBVvWh.js → index-BCvmfE-Q.js} +3 -3
- package/dist/{index-Bk8CKDbz.js → index-BDw8DIQx.js} +130 -130
- package/dist/{index-Cz7uQ_eD.js → index-BPv8txj6.js} +6 -6
- package/dist/{index--JyaPE1g.js → index-BQaejVqo.js} +1 -1
- package/dist/{index-BMSOMrGq.cjs → index-Ba16ouw0.cjs} +1 -1
- package/dist/{index-C9U9aO2Y.js → index-BaSO3EEl.js} +3 -3
- package/dist/{index-1TxthiQw.cjs → index-BdSiNUC0.cjs} +1 -1
- package/dist/{index-CYmbZuJq.cjs → index-BfU8GMj1.cjs} +1 -1
- package/dist/{index-B_WRw_3s.cjs → index-BjKKDSDx.cjs} +1 -1
- package/dist/{index-DThE5nRZ.cjs → index-BqgfejIC.cjs} +1 -1
- package/dist/{index-Dggo7EaF.js → index-BxONUPjM.js} +1 -1
- package/dist/{index-BCNDy7LZ.js → index-Byp3gJNW.js} +1 -1
- package/dist/{index-hbpC0O70.js → index-C7ZsHeLt.js} +3 -3
- package/dist/{index-tUUpniUl.js → index-C9p_wwJ7.js} +6 -6
- package/dist/{index-zsvDrZxo.js → index-CKlt750z.js} +1 -1
- package/dist/{index-C_rjTaFu.cjs → index-CQwDw3-2.cjs} +1 -1
- package/dist/{index-CLddyFrz.js → index-CR1Ng5ip.js} +3 -3
- package/dist/{index-DMTBVsgY.cjs → index-CZIqVNof.cjs} +1 -1
- package/dist/{index-yWC1EX2L.cjs → index-C_208RkZ.cjs} +1 -1
- package/dist/{index-k579sq5M.cjs → index-CqZ1E-Mt.cjs} +1 -1
- package/dist/{index-Cmlus98m.js → index-CrNsPd4D.js} +2 -2
- package/dist/{index-DRjN9mko.cjs → index-CvQCAGWI.cjs} +1 -1
- package/dist/{index-B8XDW6Ly.cjs → index-CyCcPnZb.cjs} +1 -1
- package/dist/{index-CAAOZFSQ.js → index-CyE5qCBb.js} +13 -13
- package/dist/{index-DcxUbnrO.cjs → index-D32pAhQk.cjs} +1 -1
- package/dist/{index-DZf4BLpR.js → index-DAUjjqaD.js} +391 -391
- package/dist/{index-DvQRFx9T.cjs → index-DQTlc6Gq.cjs} +1 -1
- package/dist/{index-blVMOcaF.js → index-DTilOAv_.js} +2 -2
- package/dist/{index-7ZZHuv4d.cjs → index-D_22J0ok.cjs} +1 -1
- package/dist/{index-JQ_SaJ0O.js → index-DboUMA_C.js} +1 -1
- package/dist/{index-BkPXyAKD.js → index-DgMQpO6g.js} +1 -1
- package/dist/{index-FnJX1FLR.cjs → index-Dh6GqpZF.cjs} +1 -1
- package/dist/{index-CWJuJJYp.cjs → index-DhqEoDPT.cjs} +1 -1
- package/dist/{index-uWijQ8Cy.js → index-DlwlGkyt.js} +2 -2
- package/dist/{index-nSLXu4eq.cjs → index-DtDmxPdD.cjs} +1 -1
- package/dist/{index-CUAM_spJ.js → index-GxmJC9kr.js} +1 -1
- package/dist/{index-2wJBzGa-.cjs → index-XKn5AuYT.cjs} +1 -1
- package/dist/{index-B4YN6ElV.js → index-mEKMjplD.js} +1 -1
- package/dist/{index-DdQjdsrn.js → index-vglZ0qjT.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-BKdUW522.cjs → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-DKwCF412.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-DPDuWtDv.js → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-DqIuWlps.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CmofVWvn.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CICG8Qah.js} +7302 -7338
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Y4oIHCVM.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-K6lh7Rrj.cjs} +282 -282
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-D0zznqn6.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-Cpyo5jke.js} +3 -3
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-YB8ip9Xh.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-Cq8VF9uK.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-CT8c_mLo.js → index.vue_vue_type_style_index_1_lang-B_HCEX9y.js} +6 -5
- package/dist/{index.vue_vue_type_style_index_1_lang-BB0IwRdP.cjs → index.vue_vue_type_style_index_1_lang-rTLLuvuo.cjs} +5 -5
- package/dist/loaderUtil-B0djdt91.js +5 -0
- package/dist/loaderUtil-CaWWb8db.cjs +1 -0
- package/dist/{main-CbZLyXuF.js → main-DHx-3OSy.js} +2 -2
- package/dist/{main-BOuiQUiL.cjs → main-DS156sQ4.cjs} +1 -1
- 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-i87HG3Ck.cjs → threeModel-CfIK1rQB.cjs} +1 -1
- package/dist/{threeModel-BJ6MrCa-.js → threeModel-WYCdw_Ff.js} +4 -4
- package/dist/{threePreview-D3wObBZq.js → threePreview-C29AR7Mr.js} +7 -6
- package/dist/threePreview-Ci8TnUQ8.cjs +1 -0
- package/dist/{threeSceneView-DQpyKixe.cjs → threeSceneView-C2MDCMux.cjs} +1 -1
- package/dist/{threeSceneView-DDpjEIgl.js → threeSceneView-F15mW1mm.js} +6 -6
- package/dist/{threeSceneViewForCPMPIP-DV_aOUU5.js → threeSceneViewForCPMPIP-DK4G_ZpP.js} +219 -219
- package/dist/threeSceneViewForCPMPIP-DuPZn_qv.cjs +5 -0
- package/dist/threeTrackPathView-C4eBUMef.cjs +370 -0
- package/dist/{threeTrackPathView-D6aAG4g8.js → threeTrackPathView-DMj6YGxT.js} +316 -323
- package/dist/{threeViewerHost-XR9tepbY.js → threeViewerHost-C9ipsMff.js} +2 -2
- package/dist/{threeViewerHost-I50ZyvKF.cjs → threeViewerHost-CW6JmOUJ.cjs} +2 -2
- package/dist/{urdfTree-B19ebCHj.cjs → urdfTree-CTiMB7ge.cjs} +1 -1
- package/dist/{urdfTree-CjxhpnRl.js → urdfTree-DGEACy9-.js} +1 -1
- package/dist/{workpieceTreePanel-DAnMGvlX.js → workpieceTreePanel-C1gy5a8r.js} +53 -52
- package/dist/workpieceTreePanel-Ded0Gqke.cjs +1 -0
- package/package.json +1 -1
- package/dist/MTLLoader-CCS24gLm.js +0 -657
- package/dist/MTLLoader-DlcJK6vT.cjs +0 -6
- package/dist/threePreview-B3v9SadK.cjs +0 -1
- package/dist/threeSceneViewForCPMPIP-iaIkud0j.cjs +0 -5
- package/dist/threeTrackPathView-nPb7Tgdd.cjs +0 -370
- package/dist/workpieceTreePanel-0L7tkycK.cjs +0 -1
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),F=require("./iconfont-BXzhYF5A.cjs"),l=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Y4oIHCVM.cjs"),De=require("./threeViewerHost-I50ZyvKF.cjs"),$=require("./index-C8qRkCgn.cjs"),le=require("./urdfTree-B19ebCHj.cjs"),pe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),V=require("./svgIcon-CUM54R6L.cjs"),Pe=require("./isString--eJE54G5.cjs");function Ie(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 Fe(r,e){r.position.copy(e)}function Oe(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 f=0;f<i.count;f++){const p=new l.Vector3().fromBufferAttribute(i,f).distanceTo(o);p<a&&(a=p,m=f)}for(let f=0;f<s.count;f++)c.toArray(s.array,f*3);if(m!==-1){const f=n.toArray(),v=m*3+2;for(let p=0;p<v;p=p+3)s.array[p]=f[0],s.array[p+1]=f[1],s.array[p+2]=f[2]}s.needsUpdate=!0}function ve(r,e,n,o=new l.Color(16711680)){Fe(r,e),Oe(n,r,o)}const je={class:"panel-content"},Re={class:"animation-controls"},We={class:"control-row"},Ge={class:"control-row"},He={class:"frame-info"},qe={class:"control-row"},$e=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 f=w=>`第 ${w+1} 帧`,v=w=>{if(w<0||w>=i.value.length){console.error(`帧索引 ${w} 超出范围`);return}const g=i.value[w];c.value=w,ve(o.knife,g,o.cloud)},p=async()=>{if(i.value.length===0){$.ElMessage.error("无法播放动画:无数据");return}if(!s.value){s.value=!0,m=!1,i.value.length-1===c.value&&(c.value=0);try{for(let w=c.value+1;w<i.value.length&&!m;w++)await new Promise(g=>setTimeout(g,a.value)),v(w);m||$.ElMessage.success("动画播放完成")}catch(w){console.error("动画播放出错:",w)}finally{s.value=!1}}},h=async()=>{s.value&&(m=!0,await new Promise(w=>{const g=t.watch(()=>s.value,z=>{g(),w()})}),$.ElMessage.info("动画已停止"))},C=async w=>{s.value&&await h(),v(w)},N=async()=>{s.value&&await h(),!(c.value+1>=i.value.length)&&v(c.value+1)},U=async()=>{s.value&&await h(),c.value!==0&&v(c.value-1)},x=()=>{c.value=0};return e({playAnimation:p,stopAnimation:h,forwardFrame:N,backwardFrame:U,resetAnimationFrame:x,reset:async()=>{await h(),x()}}),(w,g)=>{const z=t.resolveComponent("el-input-number"),Y=t.resolveComponent("el-form-item"),Z=t.resolveComponent("el-form"),W=t.resolveComponent("el-slider");return t.openBlock(),t.createElementBlock("div",je,[t.createElementVNode("div",Re,[t.createElementVNode("div",We,[t.createVNode(Z,{"label-width":"auto",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(Y,{label:"帧间隔 (ms):",prop:"frameDuration"},{default:t.withCtx(()=>[t.createVNode(z,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=O=>a.value=O),min:0,max:5e3,step:10,style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),t.createElementVNode("div",Ge,[g[2]||(g[2]=t.createElementVNode("label",null,"当前帧:",-1)),t.createElementVNode("span",He,t.toDisplayString(c.value+1)+" / "+t.toDisplayString(i.value.length),1)]),t.createElementVNode("div",qe,[g[3]||(g[3]=t.createElementVNode("label",null,"动画进度:",-1)),t.createVNode(W,{modelValue:c.value,"onUpdate:modelValue":g[1]||(g[1]=O=>c.value=O),min:0,max:i.value.length>0?i.value.length-1:0,step:1,"format-tooltip":f,onInput:C,disabled:i.value.length===0,style:{"flex-grow":"1",margin:"0 10px"}},null,8,["modelValue","max","disabled"])])])])}}}),Xe=pe._export_sfc($e,[["__scopeId","data-v-56b5183f"]]),ce=new l.Box3,G=new l.Vector3;class he 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),ce.setFromBufferAttribute(n),this.boundingBox.union(ce))}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 ie 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 ee=new l.Vector4,ue=new l.Vector3,de=new l.Vector3,b=new l.Vector4,S=new l.Vector4,M=new l.Vector4,te=new l.Vector3,ne=new l.Matrix4,_=new l.Line3,fe=new l.Vector3,H=new l.Box3,q=new l.Sphere,T=new l.Vector4;let B,I;function me(r,e,n){return T.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),T.multiplyScalar(1/T.w),T.x=I/n.width,T.y=I/n.height,T.applyMatrix4(r.projectionMatrixInverse),T.multiplyScalar(1/T.w),Math.abs(Math.max(T.x,T.y))}function Ye(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++){_.start.fromBufferAttribute(i,a),_.end.fromBufferAttribute(s,a),_.applyMatrix4(n);const f=new l.Vector3,v=new l.Vector3;B.distanceSqToSegment(_.start,_.end,v,f),v.distanceTo(f)<I*.5&&e.push({point:v,pointOnLine:f,distance:B.origin.distanceTo(v),object:r,face:null,faceIndex:a,uv:null,uv1:null})}}function Ze(r,e,n){const o=e.projectionMatrix,s=r.material.resolution,c=r.matrixWorld,a=r.geometry,m=a.attributes.instanceStart,f=a.attributes.instanceEnd,v=Math.min(a.instanceCount,m.count),p=-e.near;B.at(1,M),M.w=1,M.applyMatrix4(e.matrixWorldInverse),M.applyMatrix4(o),M.multiplyScalar(1/M.w),M.x*=s.x/2,M.y*=s.y/2,M.z=0,te.copy(M),ne.multiplyMatrices(e.matrixWorldInverse,c);for(let h=0,C=v;h<C;h++){if(b.fromBufferAttribute(m,h),S.fromBufferAttribute(f,h),b.w=1,S.w=1,b.applyMatrix4(ne),S.applyMatrix4(ne),b.z>p&&S.z>p)continue;if(b.z>p){const g=b.z-S.z,z=(b.z-p)/g;b.lerp(S,z)}else if(S.z>p){const g=S.z-b.z,z=(S.z-p)/g;S.lerp(b,z)}b.applyMatrix4(o),S.applyMatrix4(o),b.multiplyScalar(1/b.w),S.multiplyScalar(1/S.w),b.x*=s.x/2,b.y*=s.y/2,S.x*=s.x/2,S.y*=s.y/2,_.start.copy(b),_.start.z=0,_.end.copy(S),_.end.z=0;const U=_.closestPointToPointParameter(te,!0);_.at(U,fe);const x=l.MathUtils.lerp(b.z,S.z,U),E=x>=-1&&x<=1,w=te.distanceTo(fe)<I*.5;if(E&&w){_.start.fromBufferAttribute(m,h),_.end.fromBufferAttribute(f,h),_.start.applyMatrix4(c),_.end.applyMatrix4(c);const g=new l.Vector3,z=new l.Vector3;B.distanceSqToSegment(_.start,_.end,z,g),n.push({point:z,pointOnLine:g,distance:B.origin.distanceTo(z),object:r,face:null,faceIndex:h,uv:null,uv1:null})}}}class Ke extends l.Mesh{constructor(e=new he,n=new ie({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)ue.fromBufferAttribute(n,c),de.fromBufferAttribute(o,c),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+ue.distanceTo(de);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;B=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 f;if(o)f=I*.5;else{const p=Math.max(i.near,q.distanceToPoint(B.origin));f=me(i,p,m.resolution)}if(q.radius+=f,B.intersectsSphere(q)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),H.copy(a.boundingBox).applyMatrix4(c);let v;if(o)v=I*.5;else{const p=Math.max(i.near,H.distanceToPoint(B.origin));v=me(i,p,m.resolution)}H.expandByScalar(v),B.intersectsBox(H)!==!1&&(o?Ye(this,n):Ze(this,i,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(ee),this.material.uniforms.resolution.value.set(ee.z,ee.w))}}class ge extends he{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 Je extends Ke{constructor(e=new ge,n=new ie({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}function Qe(r){const e=[];return r.forEach(n=>{const[o,i,s]=n.trim().split(/\s+/);e.push(+o,+i,+s)}),e}function X(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 et(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 f=s[m],v=n.find(p=>p===f);if(v){c&&X(c,i,a),a="",c=v;continue}a=a+f}X(c,i,a),e.push(i.x,i.y,i.z)}),e}const tt=r=>r==null?void 0:r.filter(n=>n.includes("=")),nt=r=>r.replace(/,/g,""),it=r=>r==null?void 0:r.map(n=>nt(n)),ot=r=>{const e=tt(r);return it(e)};function rt(r){const e=ot(r),n=[];return e.forEach(o=>{var p,h,C,N,U,x;let[i,s,c,a]=o.trim().split(/\s+/);s=(p=s==null?void 0:s.trim)==null?void 0:p.call(s),c=(h=c==null?void 0:c.trim)==null?void 0:h.call(c),a=(C=a==null?void 0:a.trim)==null?void 0:C.call(a);const[,m]=(N=s==null?void 0:s.split)==null?void 0:N.call(s,"="),[,f]=(U=c==null?void 0:c.split)==null?void 0:U.call(c,"="),[,v]=(x=a==null?void 0:a.split)==null?void 0:x.call(a,"=");n.push(+m,+f,+v)}),n}const st=r=>r>="0"&&r<="9",at=r=>r==="+"||r==="-",lt=r=>r===".";function ct(r){return st(r)||at(r)||lt(r)}function ut(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 f=s[m],v=n.has(f)?f:null,p=ct(f);if(v||!p){c&&X(c,i,a),c=v,a="";continue}a=a+f}c&&X(c,i,a),e.push(i.x,i.y,i.z)}),e}function dt(r){return r==null?void 0:r.includes("=")}async function ft(r){var i,s;const e=(i=r==null?void 0:r.trim())==null?void 0:i.split(/\r?\n/);if(dt(r))return rt(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 Qe(e);if((o==null?void 0:o.length)===1)return et(e)}async function mt(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 pt(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 vt(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}),ut(e)}async function ht(r,e){const{isCyd:n,isUv:o,isCpt:i,isNc:s}=e;return o?ft(r):n?pt(r):i?mt(r):s?vt(r):[]}function gt(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 wt(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 h=0;h<e.length;h+=3)c.push(new l.Vector3(e[h],e[h+1],e[h+2]));const m=new l.CatmullRomCurve3(c,!1,"catmullrom",.5).getPoints(150).flatMap(h=>[h.x,h.y,h.z]),f=new ge;f.setPositions(m);const v=new ie({color:55551,linewidth:3,resolution:new l.Vector2(window.innerWidth,window.innerHeight)}),p=new Je(f,v);return p.name="轨迹路径",n.add(p),p}function yt(r,e,n,o=4,i=50){let s=1/0,c=-1/0,a=1/0,m=-1/0,f=1/0,v=-1/0;for(let x=0;x<r.length;x+=3){const E=r[x],w=r[x+1],g=r[x+2];s=Math.min(s,E),c=Math.max(c,E),a=Math.min(a,w),m=Math.max(m,w),f=Math.min(f,g),v=Math.max(v,g)}const h=Math.sqrt((c-s)**2+(m-a)**2+(v-f)**2)*.05,C=l.MathUtils.degToRad(e.fov),N=2*Math.tan(C/2)*i,U=h/N*n.domElement.height*(o/4);return Math.min(.4,U)}function xt(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 bt(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 St(r,e){if(!e)return;const{scene:n,camera:o,renderer:i,controls:s}=r();if(!n||!o||!i||!s)return;const c=xt(e);if(!c)return;c.name="轨迹路径",n.add(c);const a=yt(e,o,i,.1,50);c.material.size=a;const m=bt(o,e);return o.far=m*1.2,o.updateProjectionMatrix(),c}const _t={class:"obj-viewer-container"},Et={class:"buttonGroup-topLeft"},Ct={class:"buttonGroup-left"},Vt={class:"buttonGroup-right"},zt={class:"buttonGroup-bottom"},At={class:"left-panel"},Ut={class:"panel-header"},Nt={class:"panel-body"},Mt={key:1,class:"clipping-content"},Tt={class:"radio-group"},Bt={class:"radio-label"},Lt={class:"radio-label"},kt={class:"radio-label"},Dt={class:"radio-label"},Pt={class:"right-panel"},It={class:"panel-header"},Ft={class:"panel-body"},Ot={key:0,class:"loading-overlay"},jt=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),f=t.ref(""),v=t.ref(!1),p=t.ref(""),h=t.shallowRef(null),C=t.shallowRef(null),{currentModels:N,initThreeJS:U,handleResize:x,getThreeJSObjects:E,cleanup:w,axesHelperVisible:g,toggleAxesVisibility:z,zoomIn:Y,zoomOut:Z}=F.useThreeJS(i),{isAnimating:W,toggleAnimation:O,stopAnimation:we}=F.useAnimation(E,N),{isClipping:ye,activeClippingAxis:A,toggleClipping:xe,updateClippingPlanes:L}=F.useClipping(E,N),be=()=>{z()},K=d=>{m.value=!0,f.value=d,d==="剖面视图"&&!ye.value&&xe()},J=d=>{v.value=!0,p.value=d,d==="动画仿真"&&n("getAnimationData")},Q=t.ref([]),j=t.ref([]),Se=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isUv}),_e=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isCyd}),Ee=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}),oe=t.computed(()=>{const d=o.fileBlobs||[];return d==null?void 0:d[0]});let k=t.shallowRef(),P=t.shallowRef();const Ce=()=>{const{scene:d}=E();k.value&&d&&(F.disposeObj(k.value,d),k.value=null)},Ve=()=>{const{scene:d}=E();P.value&&d&&(F.disposeObj(P.value,d),P.value=null)},re=()=>{Ce(),Ve()},ze=async d=>{const u=URL.createObjectURL(d),R=await De.readFileText(u);if(URL.revokeObjectURL(u),Pe.isString(R)){const y=await ht(R,o.trackFileType)||[];Q.value=y;const ae=Q.value;Se.value&&(k.value=wt(E,ae)),(_e.value||Ee.value||D.value)&&(k.value=St(E,ae)),F.frameCameraToMesh(E,k.value)}},Ae=()=>{var d,u;P.value=Ie(),j.value=gt(Q.value),j.value&&j.value.length&&(ve(P.value,j.value[0],k.value,new l.Color(16711680)),(u=(d=C.value)==null?void 0:d.add)==null||u.call(d,P.value))},Ue=async()=>{var d;await((d=a==null?void 0:a.value)==null?void 0:d.reset()),await se(oe.value)},se=async d=>{re(),await ze(d),D.value&&Ae()};t.watch(()=>oe.value,async d=>{d&&await se(d)},{immediate:!0,deep:!0});const Ne=()=>{var d;D.value&&((d=a==null?void 0:a.value)==null||d.playAnimation())},Me=()=>{var d;D.value&&((d=a==null?void 0:a.value)==null||d.stopAnimation())},Te=()=>{var d;D.value&&((d=a==null?void 0:a.value)==null||d.forwardFrame())},Be=()=>{var d;D.value&&((d=a==null?void 0:a.value)==null||d.backwardFrame())},Le=()=>{U(),window.addEventListener("resize",x);const d=E();C.value=d.scene,C.value&&(C.value.name="CPMPIP")},ke=()=>{window.removeEventListener("resize",x),W.value&&we(),re(),w()};return t.onMounted(async()=>{try{Le()}catch(d){console.error("Three.js 初始化失败:",d),$.ElMessage.error("渲染引擎初始化失败!")}}),t.onBeforeUnmount(()=>{ke()}),(d,u)=>{const R=t.resolveComponent("el-scrollbar");return t.openBlock(),t.createElementBlock("div",_t,[t.createElementVNode("div",{ref_key:"threejsContainer",ref:i,class:"threejs-container"},null,512),t.createElementVNode("div",Et,[t.createVNode(V.ThreeSvgIcon,{name:"viewReset",size:"24",onClick:Ue,title:"重置"}),t.createVNode(V.ThreeSvgIcon,{name:"fangda",size:"24",title:"放大",onClick:t.unref(Y)},null,8,["onClick"]),t.createVNode(V.ThreeSvgIcon,{name:"suoxiao",size:"24",title:"缩小",onClick:t.unref(Z)},null,8,["onClick"]),t.createVNode(V.ThreeSvgIcon,{name:"lookAround",size:"24",onClick:t.unref(O),title:t.unref(W)?"停止动画":"动画视图"},null,8,["onClick","title"]),t.createVNode(V.ThreeSvgIcon,{name:"zuobiaoxi",size:"24",active:t.unref(g),onClick:be,title:"显隐坐标轴"},null,8,["active"])]),t.createElementVNode("div",Ct,[t.renderSlot(d.$slots,"button-left",{switchRightPanel:K},void 0,!0),t.createVNode(V.ThreeSvgIcon,{name:"jiegoushu",size:"24",onClick:u[0]||(u[0]=y=>K("场景树")),active:m.value&&f.value==="场景树",title:"场景树"},null,8,["active"]),t.createVNode(V.ThreeSvgIcon,{name:"clipping",size:"24",onClick:u[1]||(u[1]=y=>K("剖面视图")),active:m.value&&f.value==="剖面视图",title:"剖面视图"},null,8,["active"])]),t.createElementVNode("div",Vt,[t.renderSlot(d.$slots,"button-right",{switchRightPanel:J},void 0,!0),t.createVNode(V.ThreeSvgIcon,{name:"guanjiekongzhi",size:"24",onClick:u[2]||(u[2]=y=>J("关节控制")),active:v.value&&p.value==="关节控制",title:"关节控制"},null,8,["active"]),t.createVNode(V.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:u[3]||(u[3]=y=>J("动画仿真")),active:v.value&&p.value==="动画仿真"},null,8,["active"])]),t.createElementVNode("div",zt,[t.createVNode(V.ThreeSvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:Be}),t.createVNode(V.ThreeSvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:Ne}),t.createVNode(V.ThreeSvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:Te}),t.createVNode(V.ThreeSvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:Me})]),t.withDirectives(t.createElementVNode("div",At,[t.createElementVNode("div",Ut,[t.createElementVNode("span",null,t.toDisplayString(f.value),1),t.createElementVNode("span",{class:"close",onClick:u[4]||(u[4]=y=>m.value=!1)}," X ")]),t.createElementVNode("div",Nt,[t.createVNode(R,{height:"100%"},{default:t.withCtx(()=>[f.value==="场景树"?(t.openBlock(),t.createBlock(le.UrdfTree,{key:0,model:h.value},null,8,["model"])):t.createCommentVNode("",!0),f.value==="剖面视图"?(t.openBlock(),t.createElementBlock("div",Mt,[t.createElementVNode("div",Tt,[t.createElementVNode("label",Bt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":u[5]||(u[5]=y=>t.isRef(A)?A.value=y:null),onChange:u[6]||(u[6]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(A)]]),u[14]||(u[14]=t.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),t.createElementVNode("label",Lt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":u[7]||(u[7]=y=>t.isRef(A)?A.value=y:null),onChange:u[8]||(u[8]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(A)]]),u[15]||(u[15]=t.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),t.createElementVNode("label",kt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":u[9]||(u[9]=y=>t.isRef(A)?A.value=y:null),onChange:u[10]||(u[10]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(A)]]),u[16]||(u[16]=t.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),t.createElementVNode("label",Dt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":u[11]||(u[11]=y=>t.isRef(A)?A.value=y:null),onChange:u[12]||(u[12]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(A)]]),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",Pt,[t.createElementVNode("div",It,[t.createElementVNode("span",null,t.toDisplayString(p.value),1),t.createElementVNode("span",{class:"close",onClick:u[13]||(u[13]=y=>v.value=!1)}," X ")]),t.createElementVNode("div",Ft,[t.createVNode(R,{height:"100%"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(le.JointPanel,{model:h.value},null,8,["model"]),[[t.vShow,p.value==="关节控制"]]),t.withDirectives(t.createVNode(Xe,{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,v.value]]),s.value?(t.openBlock(),t.createElementBlock("div",Ot,[u[18]||(u[18]=t.createElementVNode("div",{class:"loading-spinner"},null,-1)),t.createElementVNode("p",null,t.toDisplayString(c.value),1)])):t.createCommentVNode("",!0)])}}}),Rt=pe._export_sfc(jt,[["__scopeId","data-v-a8f1772d"]]);exports.default=Rt;
|
|
@@ -1 +0,0 @@
|
|
|
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;
|