ss-component-new 1.2.97 → 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-B85G8nPk.cjs → OrbitControls-8LBwRzcq.cjs} +1 -1
- package/dist/{OrbitControls-DFhYzlF3.js → OrbitControls-Cz47Q27N.js} +1 -1
- package/dist/{animationData-DfKVkFbz.js → animationData-C8lM4zZj.js} +1 -1
- package/dist/{animationData-DxBvEqB1.cjs → animationData-CKcPDmLp.cjs} +1 -1
- package/dist/{iconfont-C7kE-QbU.cjs → iconfont-B1cUqs_N.cjs} +1 -1
- package/dist/{iconfont-WOKNi2xx.js → iconfont-CUWS5tNH.js} +2 -2
- package/dist/{index-D0hovh9R.cjs → index-2hqZ_tND.cjs} +1 -1
- package/dist/{index-331j518H.cjs → index-AuEh0RiU.cjs} +1 -1
- package/dist/{index-D_igus4A.cjs → index-B2UPNwqJ.cjs} +1 -1
- package/dist/{index-BYk9Fb6p.js → index-BCvmfE-Q.js} +3 -3
- package/dist/{index-DeOwZgqL.js → index-BDw8DIQx.js} +130 -130
- package/dist/{index-CqI3frdZ.js → index-BPv8txj6.js} +6 -6
- package/dist/{index-DgZVeYqH.js → index-BQaejVqo.js} +1 -1
- package/dist/{index-DSPjcpWK.cjs → index-Ba16ouw0.cjs} +1 -1
- package/dist/{index-D_RGoDln.js → index-BaSO3EEl.js} +3 -3
- package/dist/{index-DHZMd8iK.cjs → index-BdSiNUC0.cjs} +1 -1
- package/dist/{index-BDxPlbe2.cjs → index-BfU8GMj1.cjs} +1 -1
- package/dist/{index-Cppt0AsF.cjs → index-BjKKDSDx.cjs} +1 -1
- package/dist/{index-C-dlFxRJ.cjs → index-BqgfejIC.cjs} +1 -1
- package/dist/{index-BODyH6MD.js → index-BxONUPjM.js} +1 -1
- package/dist/{index-BFzMf0GC.js → index-Byp3gJNW.js} +1 -1
- package/dist/{index-DJ6qg2Mo.js → index-C7ZsHeLt.js} +3 -3
- package/dist/{index-B-AhHUV1.js → index-C9p_wwJ7.js} +6 -6
- package/dist/{index-BoTiP0aV.js → index-CKlt750z.js} +1 -1
- package/dist/{index-CQRJ3pLh.cjs → index-CQwDw3-2.cjs} +1 -1
- package/dist/{index-hhS08X8b.js → index-CR1Ng5ip.js} +3 -3
- package/dist/{index-D6u590uA.cjs → index-CZIqVNof.cjs} +1 -1
- package/dist/{index-iErxMZBi.cjs → index-C_208RkZ.cjs} +1 -1
- package/dist/{index-S1LIIzCa.cjs → index-CqZ1E-Mt.cjs} +1 -1
- package/dist/{index-DHjtOySN.js → index-CrNsPd4D.js} +2 -2
- package/dist/{index-DrzK0O_g.cjs → index-CvQCAGWI.cjs} +1 -1
- package/dist/{index-Cnk_4Zz5.cjs → index-CyCcPnZb.cjs} +1 -1
- package/dist/{index-BI7g3c_u.js → index-CyE5qCBb.js} +13 -13
- package/dist/{index-DHBoRe9V.cjs → index-D32pAhQk.cjs} +1 -1
- package/dist/{index-DRfVnLTN.js → index-DAUjjqaD.js} +391 -391
- package/dist/{index-DbDM-XfB.cjs → index-DQTlc6Gq.cjs} +1 -1
- package/dist/{index-B_zjoT4m.js → index-DTilOAv_.js} +2 -2
- package/dist/{index-_PP-dSm3.cjs → index-D_22J0ok.cjs} +1 -1
- package/dist/{index-iZ9BRKg5.js → index-DboUMA_C.js} +1 -1
- package/dist/{index-BXv3aZ7v.js → index-DgMQpO6g.js} +1 -1
- package/dist/{index-CPAXrzNY.cjs → index-Dh6GqpZF.cjs} +1 -1
- package/dist/{index-CZPnP0uy.cjs → index-DhqEoDPT.cjs} +1 -1
- package/dist/{index-CeGM8aBH.js → index-DlwlGkyt.js} +2 -2
- package/dist/{index-6sZXjGGz.cjs → index-DtDmxPdD.cjs} +1 -1
- package/dist/{index-kLDMroPk.js → index-GxmJC9kr.js} +1 -1
- package/dist/{index-CLOUp_4j.cjs → index-XKn5AuYT.cjs} +1 -1
- package/dist/{index-Cr5if46q.js → index-mEKMjplD.js} +1 -1
- package/dist/{index-Bhha7SY3.js → index-vglZ0qjT.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-DSlAeFA3.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-ERjMISIK.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-3GcG1eTD.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CICG8Qah.js} +8908 -8949
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dzyqt2Z-.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-K6lh7Rrj.cjs} +302 -302
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-mJB_yl_P.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-DODc2KPN.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-BH0DRFVE.js → index.vue_vue_type_style_index_1_lang-B_HCEX9y.js} +6 -5
- package/dist/{index.vue_vue_type_style_index_1_lang-BRFs_L5R.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-Z5UMyCj6.js → main-DHx-3OSy.js} +2 -2
- package/dist/{main-B541MQH8.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-tKq0hvaK.cjs → threeModel-CfIK1rQB.cjs} +1 -1
- package/dist/{threeModel-BcjGbIJZ.js → threeModel-WYCdw_Ff.js} +4 -4
- package/dist/{threePreview-BnPMGQ2H.js → threePreview-C29AR7Mr.js} +310 -305
- package/dist/threePreview-Ci8TnUQ8.cjs +1 -0
- package/dist/{threeSceneView-DVUTlm6F.cjs → threeSceneView-C2MDCMux.cjs} +2 -2
- package/dist/{threeSceneView-BUD002PP.js → threeSceneView-F15mW1mm.js} +7 -7
- package/dist/threeSceneViewForCPMPIP-DK4G_ZpP.js +687 -0
- package/dist/threeSceneViewForCPMPIP-DuPZn_qv.cjs +5 -0
- package/dist/threeTrackPathView-C4eBUMef.cjs +370 -0
- package/dist/{threeTrackPathView-DDCEu3Gx.js → threeTrackPathView-DMj6YGxT.js} +436 -427
- package/dist/{threeViewerHost-BVeUteVd.js → threeViewerHost-C9ipsMff.js} +2 -2
- package/dist/{threeViewerHost-Sda_AoRw.cjs → threeViewerHost-CW6JmOUJ.cjs} +2 -2
- package/dist/{urdfTree-Br9VYqKp.cjs → urdfTree-CTiMB7ge.cjs} +1 -1
- package/dist/{urdfTree-DaWvX-6R.js → urdfTree-DGEACy9-.js} +1 -1
- package/dist/{workpieceTreePanel-BdRaFNRp.js → workpieceTreePanel-C1gy5a8r.js} +53 -52
- package/dist/workpieceTreePanel-Ded0Gqke.cjs +1 -0
- package/package.json +1 -1
- package/dist/MTLLoader-DnouUI-8.js +0 -657
- package/dist/MTLLoader-zZDM0NQh.cjs +0 -6
- package/dist/obj/model.mtl +0 -42
- package/dist/obj/model.obj +0 -26110
- package/dist/threePreview-DD0br2ae.cjs +0 -1
- package/dist/threeSceneViewForCPMPIP-BYYbyqD7.cjs +0 -5
- package/dist/threeSceneViewForCPMPIP-D4RC4BAo.js +0 -683
- package/dist/threeTrackPathView-BvUihuyk.cjs +0 -370
- package/dist/workpieceTreePanel-Z3aVdOWB.cjs +0 -1
- package/public/obj/model.mtl +0 -42
- package/public/obj/model.obj +0 -26110
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),O=require("./iconfont-C7kE-QbU.cjs"),l=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dzyqt2Z-.cjs"),Be=require("./threeViewerHost-Sda_AoRw.cjs"),W=require("./index-C8qRkCgn.cjs"),oe=require("./urdfTree-Br9VYqKp.cjs"),ue=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),V=require("./svgIcon-CUM54R6L.cjs"),Le=require("./isString--eJE54G5.cjs");function ke(r=.5,e=4){const n=new l.Mesh(new l.ConeGeometry(r,e,32),new l.MeshStandardMaterial({color:"#919191ff",metalness:.3,roughness:.6})),o=n.geometry.parameters.height;return n.geometry.translate(0,-o/2,0),n.rotation.set(-90,0,0,"XYZ"),n}function De(r,e){r.position.copy(e)}function Pe(r,e,n=new l.Color(16711680)){const o=new l.Vector3;e.getWorldPosition(o);const i=r.geometry.attributes.position,s=r.geometry.attributes.color,c=new l.Color(55551);let a=1/0,m=-1;for(let d=0;d<i.count;d++){const p=new l.Vector3().fromBufferAttribute(i,d).distanceTo(o);p<a&&(a=p,m=d)}for(let d=0;d<s.count;d++)c.toArray(s.array,d*3);if(m!==-1){const d=n.toArray(),h=m*3+2;for(let p=0;p<h;p=p+3)s.array[p]=d[0],s.array[p+1]=d[1],s.array[p+2]=d[2]}s.needsUpdate=!0}function de(r,e,n,o=new l.Color(16711680)){De(r,e),Pe(n,r,o)}const Ie={class:"panel-content"},Fe={class:"animation-controls"},Oe={class:"control-row"},je={class:"control-row"},Re={class:"frame-info"},We={class:"control-row"},Ge=t.defineComponent({__name:"trackAnimationPanel",props:{cloud:{},knife:{},vectors:{}},emits:["getThreeData"],setup(r,{expose:e,emit:n}){const o=r,i=t.computed(()=>o.vectors),s=t.ref(!1),c=t.ref(0),a=t.ref(50);let m=!1;const d=g=>`第 ${g+1} 帧`,h=g=>{if(g<0||g>=i.value.length){console.error(`帧索引 ${g} 超出范围`);return}const y=i.value[g];c.value=g,de(o.knife,y,o.cloud)},p=async()=>{if(i.value.length===0){W.ElMessage.error("无法播放动画:无数据");return}if(!s.value){s.value=!0,m=!1,i.value.length-1===c.value&&(c.value=0);try{for(let g=c.value+1;g<i.value.length&&!m;g++)await new Promise(y=>setTimeout(y,a.value)),h(g);m||W.ElMessage.success("动画播放完成")}catch(g){console.error("动画播放出错:",g),W.ElMessage.error("动画播放出错")}finally{s.value=!1}}},v=()=>{m=!0,s.value=!1,W.ElMessage.info("动画已停止")},E=g=>{s.value&&v(),h(g)};return e({playAnimation:p,stopAnimation:v,forwardFrame:()=>{s.value&&v(),!(c.value+1>=i.value.length)&&h(c.value+1)},backwardFrame:()=>{s.value&&v(),c.value!==0&&h(c.value-1)}}),(g,y)=>{const _=t.resolveComponent("el-input-number"),C=t.resolveComponent("el-form-item"),A=t.resolveComponent("el-form"),X=t.resolveComponent("el-slider");return t.openBlock(),t.createElementBlock("div",Ie,[t.createElementVNode("div",Fe,[t.createElementVNode("div",Oe,[t.createVNode(A,{"label-width":"auto",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(C,{label:"帧间隔 (ms):",prop:"frameDuration"},{default:t.withCtx(()=>[t.createVNode(_,{modelValue:a.value,"onUpdate:modelValue":y[0]||(y[0]=F=>a.value=F),min:0,max:5e3,step:10,style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),t.createElementVNode("div",je,[y[2]||(y[2]=t.createElementVNode("label",null,"当前帧:",-1)),t.createElementVNode("span",Re,t.toDisplayString(c.value+1)+" / "+t.toDisplayString(i.value.length),1)]),t.createElementVNode("div",We,[y[3]||(y[3]=t.createElementVNode("label",null,"动画进度:",-1)),t.createVNode(X,{modelValue:c.value,"onUpdate:modelValue":y[1]||(y[1]=F=>c.value=F),min:0,max:i.value.length>0?i.value.length-1:0,step:1,"format-tooltip":d,onInput:E,disabled:i.value.length===0,style:{"flex-grow":"1",margin:"0 10px"}},null,8,["modelValue","max","disabled"])])])])}}}),He=ue._export_sfc(Ge,[["__scopeId","data-v-93cde733"]]),re=new l.Box3,G=new l.Vector3;class fe extends l.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new l.Float32BufferAttribute(e,3)),this.setAttribute("uv",new l.Float32BufferAttribute(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,o=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),o.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new l.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new l.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new l.InterleavedBufferAttribute(o,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new l.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceColorStart",new l.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new l.InterleavedBufferAttribute(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new l.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new l.Box3);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),re.setFromBufferAttribute(n),this.boundingBox.union(re))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new l.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let i=0;for(let s=0,c=e.count;s<c;s++)G.fromBufferAttribute(e,s),i=Math.max(i,o.distanceToSquared(G)),G.fromBufferAttribute(n,s),i=Math.max(i,o.distanceToSquared(G));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}l.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new l.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};l.ShaderLib.line={uniforms:l.UniformsUtils.merge([l.UniformsLib.common,l.UniformsLib.fog,l.UniformsLib.line]),vertexShader:`
|
|
2
|
-
#include <common>
|
|
3
|
-
#include <color_pars_vertex>
|
|
4
|
-
#include <fog_pars_vertex>
|
|
5
|
-
#include <logdepthbuf_pars_vertex>
|
|
6
|
-
#include <clipping_planes_pars_vertex>
|
|
7
|
-
|
|
8
|
-
uniform float linewidth;
|
|
9
|
-
uniform vec2 resolution;
|
|
10
|
-
|
|
11
|
-
attribute vec3 instanceStart;
|
|
12
|
-
attribute vec3 instanceEnd;
|
|
13
|
-
|
|
14
|
-
attribute vec3 instanceColorStart;
|
|
15
|
-
attribute vec3 instanceColorEnd;
|
|
16
|
-
|
|
17
|
-
#ifdef WORLD_UNITS
|
|
18
|
-
|
|
19
|
-
varying vec4 worldPos;
|
|
20
|
-
varying vec3 worldStart;
|
|
21
|
-
varying vec3 worldEnd;
|
|
22
|
-
|
|
23
|
-
#ifdef USE_DASH
|
|
24
|
-
|
|
25
|
-
varying vec2 vUv;
|
|
26
|
-
|
|
27
|
-
#endif
|
|
28
|
-
|
|
29
|
-
#else
|
|
30
|
-
|
|
31
|
-
varying vec2 vUv;
|
|
32
|
-
|
|
33
|
-
#endif
|
|
34
|
-
|
|
35
|
-
#ifdef USE_DASH
|
|
36
|
-
|
|
37
|
-
uniform float dashScale;
|
|
38
|
-
attribute float instanceDistanceStart;
|
|
39
|
-
attribute float instanceDistanceEnd;
|
|
40
|
-
varying float vLineDistance;
|
|
41
|
-
|
|
42
|
-
#endif
|
|
43
|
-
|
|
44
|
-
void trimSegment( const in vec4 start, inout vec4 end ) {
|
|
45
|
-
|
|
46
|
-
// trim end segment so it terminates between the camera plane and the near plane
|
|
47
|
-
|
|
48
|
-
// conservative estimate of the near plane
|
|
49
|
-
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
50
|
-
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
51
|
-
float nearEstimate = - 0.5 * b / a;
|
|
52
|
-
|
|
53
|
-
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
54
|
-
|
|
55
|
-
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
void main() {
|
|
60
|
-
|
|
61
|
-
#ifdef USE_COLOR
|
|
62
|
-
|
|
63
|
-
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
64
|
-
|
|
65
|
-
#endif
|
|
66
|
-
|
|
67
|
-
#ifdef USE_DASH
|
|
68
|
-
|
|
69
|
-
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
|
70
|
-
vUv = uv;
|
|
71
|
-
|
|
72
|
-
#endif
|
|
73
|
-
|
|
74
|
-
float aspect = resolution.x / resolution.y;
|
|
75
|
-
|
|
76
|
-
// camera space
|
|
77
|
-
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
78
|
-
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
79
|
-
|
|
80
|
-
#ifdef WORLD_UNITS
|
|
81
|
-
|
|
82
|
-
worldStart = start.xyz;
|
|
83
|
-
worldEnd = end.xyz;
|
|
84
|
-
|
|
85
|
-
#else
|
|
86
|
-
|
|
87
|
-
vUv = uv;
|
|
88
|
-
|
|
89
|
-
#endif
|
|
90
|
-
|
|
91
|
-
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
92
|
-
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
93
|
-
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
94
|
-
// perhaps there is a more elegant solution -- WestLangley
|
|
95
|
-
|
|
96
|
-
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
97
|
-
|
|
98
|
-
if ( perspective ) {
|
|
99
|
-
|
|
100
|
-
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
101
|
-
|
|
102
|
-
trimSegment( start, end );
|
|
103
|
-
|
|
104
|
-
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
105
|
-
|
|
106
|
-
trimSegment( end, start );
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// clip space
|
|
113
|
-
vec4 clipStart = projectionMatrix * start;
|
|
114
|
-
vec4 clipEnd = projectionMatrix * end;
|
|
115
|
-
|
|
116
|
-
// ndc space
|
|
117
|
-
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
118
|
-
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
119
|
-
|
|
120
|
-
// direction
|
|
121
|
-
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
122
|
-
|
|
123
|
-
// account for clip-space aspect ratio
|
|
124
|
-
dir.x *= aspect;
|
|
125
|
-
dir = normalize( dir );
|
|
126
|
-
|
|
127
|
-
#ifdef WORLD_UNITS
|
|
128
|
-
|
|
129
|
-
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
130
|
-
vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
|
|
131
|
-
vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
|
|
132
|
-
vec3 worldFwd = cross( worldDir, worldUp );
|
|
133
|
-
worldPos = position.y < 0.5 ? start: end;
|
|
134
|
-
|
|
135
|
-
// height offset
|
|
136
|
-
float hw = linewidth * 0.5;
|
|
137
|
-
worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
|
|
138
|
-
|
|
139
|
-
// don't extend the line if we're rendering dashes because we
|
|
140
|
-
// won't be rendering the endcaps
|
|
141
|
-
#ifndef USE_DASH
|
|
142
|
-
|
|
143
|
-
// cap extension
|
|
144
|
-
worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
|
|
145
|
-
|
|
146
|
-
// add width to the box
|
|
147
|
-
worldPos.xyz += worldFwd * hw;
|
|
148
|
-
|
|
149
|
-
// endcaps
|
|
150
|
-
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
151
|
-
|
|
152
|
-
worldPos.xyz -= worldFwd * 2.0 * hw;
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
#endif
|
|
157
|
-
|
|
158
|
-
// project the worldpos
|
|
159
|
-
vec4 clip = projectionMatrix * worldPos;
|
|
160
|
-
|
|
161
|
-
// shift the depth of the projected points so the line
|
|
162
|
-
// segments overlap neatly
|
|
163
|
-
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
164
|
-
clip.z = clipPose.z * clip.w;
|
|
165
|
-
|
|
166
|
-
#else
|
|
167
|
-
|
|
168
|
-
vec2 offset = vec2( dir.y, - dir.x );
|
|
169
|
-
// undo aspect ratio adjustment
|
|
170
|
-
dir.x /= aspect;
|
|
171
|
-
offset.x /= aspect;
|
|
172
|
-
|
|
173
|
-
// sign flip
|
|
174
|
-
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
175
|
-
|
|
176
|
-
// endcaps
|
|
177
|
-
if ( position.y < 0.0 ) {
|
|
178
|
-
|
|
179
|
-
offset += - dir;
|
|
180
|
-
|
|
181
|
-
} else if ( position.y > 1.0 ) {
|
|
182
|
-
|
|
183
|
-
offset += dir;
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// adjust for linewidth
|
|
188
|
-
offset *= linewidth;
|
|
189
|
-
|
|
190
|
-
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
191
|
-
offset /= resolution.y;
|
|
192
|
-
|
|
193
|
-
// select end
|
|
194
|
-
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
195
|
-
|
|
196
|
-
// back to clip space
|
|
197
|
-
offset *= clip.w;
|
|
198
|
-
|
|
199
|
-
clip.xy += offset;
|
|
200
|
-
|
|
201
|
-
#endif
|
|
202
|
-
|
|
203
|
-
gl_Position = clip;
|
|
204
|
-
|
|
205
|
-
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
206
|
-
|
|
207
|
-
#include <logdepthbuf_vertex>
|
|
208
|
-
#include <clipping_planes_vertex>
|
|
209
|
-
#include <fog_vertex>
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
`,fragmentShader:`
|
|
213
|
-
uniform vec3 diffuse;
|
|
214
|
-
uniform float opacity;
|
|
215
|
-
uniform float linewidth;
|
|
216
|
-
|
|
217
|
-
#ifdef USE_DASH
|
|
218
|
-
|
|
219
|
-
uniform float dashOffset;
|
|
220
|
-
uniform float dashSize;
|
|
221
|
-
uniform float gapSize;
|
|
222
|
-
|
|
223
|
-
#endif
|
|
224
|
-
|
|
225
|
-
varying float vLineDistance;
|
|
226
|
-
|
|
227
|
-
#ifdef WORLD_UNITS
|
|
228
|
-
|
|
229
|
-
varying vec4 worldPos;
|
|
230
|
-
varying vec3 worldStart;
|
|
231
|
-
varying vec3 worldEnd;
|
|
232
|
-
|
|
233
|
-
#ifdef USE_DASH
|
|
234
|
-
|
|
235
|
-
varying vec2 vUv;
|
|
236
|
-
|
|
237
|
-
#endif
|
|
238
|
-
|
|
239
|
-
#else
|
|
240
|
-
|
|
241
|
-
varying vec2 vUv;
|
|
242
|
-
|
|
243
|
-
#endif
|
|
244
|
-
|
|
245
|
-
#include <common>
|
|
246
|
-
#include <color_pars_fragment>
|
|
247
|
-
#include <fog_pars_fragment>
|
|
248
|
-
#include <logdepthbuf_pars_fragment>
|
|
249
|
-
#include <clipping_planes_pars_fragment>
|
|
250
|
-
|
|
251
|
-
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
252
|
-
|
|
253
|
-
float mua;
|
|
254
|
-
float mub;
|
|
255
|
-
|
|
256
|
-
vec3 p13 = p1 - p3;
|
|
257
|
-
vec3 p43 = p4 - p3;
|
|
258
|
-
|
|
259
|
-
vec3 p21 = p2 - p1;
|
|
260
|
-
|
|
261
|
-
float d1343 = dot( p13, p43 );
|
|
262
|
-
float d4321 = dot( p43, p21 );
|
|
263
|
-
float d1321 = dot( p13, p21 );
|
|
264
|
-
float d4343 = dot( p43, p43 );
|
|
265
|
-
float d2121 = dot( p21, p21 );
|
|
266
|
-
|
|
267
|
-
float denom = d2121 * d4343 - d4321 * d4321;
|
|
268
|
-
|
|
269
|
-
float numer = d1343 * d4321 - d1321 * d4343;
|
|
270
|
-
|
|
271
|
-
mua = numer / denom;
|
|
272
|
-
mua = clamp( mua, 0.0, 1.0 );
|
|
273
|
-
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
274
|
-
mub = clamp( mub, 0.0, 1.0 );
|
|
275
|
-
|
|
276
|
-
return vec2( mua, mub );
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
void main() {
|
|
281
|
-
|
|
282
|
-
float alpha = opacity;
|
|
283
|
-
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
284
|
-
|
|
285
|
-
#include <clipping_planes_fragment>
|
|
286
|
-
|
|
287
|
-
#ifdef USE_DASH
|
|
288
|
-
|
|
289
|
-
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
290
|
-
|
|
291
|
-
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
292
|
-
|
|
293
|
-
#endif
|
|
294
|
-
|
|
295
|
-
#ifdef WORLD_UNITS
|
|
296
|
-
|
|
297
|
-
// Find the closest points on the view ray and the line segment
|
|
298
|
-
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
299
|
-
vec3 lineDir = worldEnd - worldStart;
|
|
300
|
-
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
301
|
-
|
|
302
|
-
vec3 p1 = worldStart + lineDir * params.x;
|
|
303
|
-
vec3 p2 = rayEnd * params.y;
|
|
304
|
-
vec3 delta = p1 - p2;
|
|
305
|
-
float len = length( delta );
|
|
306
|
-
float norm = len / linewidth;
|
|
307
|
-
|
|
308
|
-
#ifndef USE_DASH
|
|
309
|
-
|
|
310
|
-
#ifdef USE_ALPHA_TO_COVERAGE
|
|
311
|
-
|
|
312
|
-
float dnorm = fwidth( norm );
|
|
313
|
-
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
314
|
-
|
|
315
|
-
#else
|
|
316
|
-
|
|
317
|
-
if ( norm > 0.5 ) {
|
|
318
|
-
|
|
319
|
-
discard;
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
#endif
|
|
324
|
-
|
|
325
|
-
#endif
|
|
326
|
-
|
|
327
|
-
#else
|
|
328
|
-
|
|
329
|
-
#ifdef USE_ALPHA_TO_COVERAGE
|
|
330
|
-
|
|
331
|
-
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
332
|
-
float a = vUv.x;
|
|
333
|
-
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
334
|
-
float len2 = a * a + b * b;
|
|
335
|
-
float dlen = fwidth( len2 );
|
|
336
|
-
|
|
337
|
-
if ( abs( vUv.y ) > 1.0 ) {
|
|
338
|
-
|
|
339
|
-
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
#else
|
|
344
|
-
|
|
345
|
-
if ( abs( vUv.y ) > 1.0 ) {
|
|
346
|
-
|
|
347
|
-
float a = vUv.x;
|
|
348
|
-
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
349
|
-
float len2 = a * a + b * b;
|
|
350
|
-
|
|
351
|
-
if ( len2 > 1.0 ) discard;
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
#endif
|
|
356
|
-
|
|
357
|
-
#endif
|
|
358
|
-
|
|
359
|
-
#include <logdepthbuf_fragment>
|
|
360
|
-
#include <color_fragment>
|
|
361
|
-
|
|
362
|
-
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
363
|
-
|
|
364
|
-
#include <tonemapping_fragment>
|
|
365
|
-
#include <colorspace_fragment>
|
|
366
|
-
#include <fog_fragment>
|
|
367
|
-
#include <premultiplied_alpha_fragment>
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
`};class te extends l.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:l.UniformsUtils.clone(l.ShaderLib.line.uniforms),vertexShader:l.ShaderLib.line.vertexShader,fragmentShader:l.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const J=new l.Vector4,se=new l.Vector3,ae=new l.Vector3,x=new l.Vector4,b=new l.Vector4,N=new l.Vector4,Q=new l.Vector3,ee=new l.Matrix4,S=new l.Line3,le=new l.Vector3,H=new l.Box3,q=new l.Sphere,M=new l.Vector4;let T,I;function ce(r,e,n){return M.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),M.multiplyScalar(1/M.w),M.x=I/n.width,M.y=I/n.height,M.applyMatrix4(r.projectionMatrixInverse),M.multiplyScalar(1/M.w),Math.abs(Math.max(M.x,M.y))}function qe(r,e){const n=r.matrixWorld,o=r.geometry,i=o.attributes.instanceStart,s=o.attributes.instanceEnd,c=Math.min(o.instanceCount,i.count);for(let a=0,m=c;a<m;a++){S.start.fromBufferAttribute(i,a),S.end.fromBufferAttribute(s,a),S.applyMatrix4(n);const d=new l.Vector3,h=new l.Vector3;T.distanceSqToSegment(S.start,S.end,h,d),h.distanceTo(d)<I*.5&&e.push({point:h,pointOnLine:d,distance:T.origin.distanceTo(h),object:r,face:null,faceIndex:a,uv:null,uv1:null})}}function $e(r,e,n){const o=e.projectionMatrix,s=r.material.resolution,c=r.matrixWorld,a=r.geometry,m=a.attributes.instanceStart,d=a.attributes.instanceEnd,h=Math.min(a.instanceCount,m.count),p=-e.near;T.at(1,N),N.w=1,N.applyMatrix4(e.matrixWorldInverse),N.applyMatrix4(o),N.multiplyScalar(1/N.w),N.x*=s.x/2,N.y*=s.y/2,N.z=0,Q.copy(N),ee.multiplyMatrices(e.matrixWorldInverse,c);for(let v=0,E=h;v<E;v++){if(x.fromBufferAttribute(m,v),b.fromBufferAttribute(d,v),x.w=1,b.w=1,x.applyMatrix4(ee),b.applyMatrix4(ee),x.z>p&&b.z>p)continue;if(x.z>p){const C=x.z-b.z,A=(x.z-p)/C;x.lerp(b,A)}else if(b.z>p){const C=b.z-x.z,A=(b.z-p)/C;b.lerp(x,A)}x.applyMatrix4(o),b.applyMatrix4(o),x.multiplyScalar(1/x.w),b.multiplyScalar(1/b.w),x.x*=s.x/2,x.y*=s.y/2,b.x*=s.x/2,b.y*=s.y/2,S.start.copy(x),S.start.z=0,S.end.copy(b),S.end.z=0;const U=S.closestPointToPointParameter(Q,!0);S.at(U,le);const g=l.MathUtils.lerp(x.z,b.z,U),y=g>=-1&&g<=1,_=Q.distanceTo(le)<I*.5;if(y&&_){S.start.fromBufferAttribute(m,v),S.end.fromBufferAttribute(d,v),S.start.applyMatrix4(c),S.end.applyMatrix4(c);const C=new l.Vector3,A=new l.Vector3;T.distanceSqToSegment(S.start,S.end,A,C),n.push({point:A,pointOnLine:C,distance:T.origin.distanceTo(A),object:r,face:null,faceIndex:v,uv:null,uv1:null})}}}class Xe extends l.Mesh{constructor(e=new fe,n=new te({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,o=e.attributes.instanceEnd,i=new Float32Array(2*n.count);for(let c=0,a=0,m=n.count;c<m;c++,a+=2)se.fromBufferAttribute(n,c),ae.fromBufferAttribute(o,c),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+se.distanceTo(ae);const s=new l.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new l.InterleavedBufferAttribute(s,1,0)),e.setAttribute("instanceDistanceEnd",new l.InterleavedBufferAttribute(s,1,1)),this}raycast(e,n){const o=this.material.worldUnits,i=e.camera;i===null&&!o&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;T=e.ray;const c=this.matrixWorld,a=this.geometry,m=this.material;I=m.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),q.copy(a.boundingSphere).applyMatrix4(c);let d;if(o)d=I*.5;else{const p=Math.max(i.near,q.distanceToPoint(T.origin));d=ce(i,p,m.resolution)}if(q.radius+=d,T.intersectsSphere(q)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),H.copy(a.boundingBox).applyMatrix4(c);let h;if(o)h=I*.5;else{const p=Math.max(i.near,H.distanceToPoint(T.origin));h=ce(i,p,m.resolution)}H.expandByScalar(h),T.intersectsBox(H)!==!1&&(o?qe(this,n):$e(this,i,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(J),this.material.uniforms.resolution.value.set(J.z,J.w))}}class me extends fe{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,o=new Float32Array(2*n);for(let i=0;i<n;i+=3)o[2*i]=e[i],o[2*i+1]=e[i+1],o[2*i+2]=e[i+2],o[2*i+3]=e[i+3],o[2*i+4]=e[i+4],o[2*i+5]=e[i+5];return super.setPositions(o),this}setColors(e){const n=e.length-3,o=new Float32Array(2*n);for(let i=0;i<n;i+=3)o[2*i]=e[i],o[2*i+1]=e[i+1],o[2*i+2]=e[i+2],o[2*i+3]=e[i+3],o[2*i+4]=e[i+4],o[2*i+5]=e[i+5];return super.setColors(o),this}setFromPoints(e){const n=e.length-1,o=new Float32Array(6*n);for(let i=0;i<n;i++)o[6*i]=e[i].x,o[6*i+1]=e[i].y,o[6*i+2]=e[i].z||0,o[6*i+3]=e[i+1].x,o[6*i+4]=e[i+1].y,o[6*i+5]=e[i+1].z||0;return super.setPositions(o),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class Ye extends Xe{constructor(e=new me,n=new te({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}function Ze(r){const e=[];return r.forEach(n=>{const[o,i,s]=n.trim().split(/\s+/);e.push(+o,+i,+s)}),e}function $(r,e,n){switch(r){case"X":e.x=+n||0;break;case"Y":e.y=+n||0;break;case"Z":e.z=+n||0;break}}function Ke(r){const e=[],n=["X","Y","Z"];return r.forEach(o=>{const i={x:0,y:0,z:0},s=o.trim();if(!s)return;let c=null,a="";for(let m=0;m<(s==null?void 0:s.length);m++){const d=s[m],h=n.find(p=>p===d);if(h){c&&$(c,i,a),a="",c=h;continue}a=a+d}$(c,i,a),e.push(i.x,i.y,i.z)}),e}const Je=r=>r==null?void 0:r.filter(n=>n.includes("=")),Qe=r=>r.replace(/,/g,""),et=r=>r==null?void 0:r.map(n=>Qe(n)),tt=r=>{const e=Je(r);return et(e)};function nt(r){const e=tt(r),n=[];return e.forEach(o=>{var p,v,E,B,U,g;let[i,s,c,a]=o.trim().split(/\s+/);s=(p=s==null?void 0:s.trim)==null?void 0:p.call(s),c=(v=c==null?void 0:c.trim)==null?void 0:v.call(c),a=(E=a==null?void 0:a.trim)==null?void 0:E.call(a);const[,m]=(B=s==null?void 0:s.split)==null?void 0:B.call(s,"="),[,d]=(U=c==null?void 0:c.split)==null?void 0:U.call(c,"="),[,h]=(g=a==null?void 0:a.split)==null?void 0:g.call(a,"=");n.push(+m,+d,+h)}),n}const it=r=>r>="0"&&r<="9",ot=r=>r==="+"||r==="-",rt=r=>r===".";function st(r){return it(r)||ot(r)||rt(r)}function at(r){const e=[],n=new Set(["X","Y","Z"]);return r.forEach(o=>{const i={x:0,y:0,z:0},s=o.trim();if(!s)return;let c=null,a="";for(let m=0;m<(s==null?void 0:s.length);m++){const d=s[m],h=n.has(d)?d:null,p=st(d);if(h||!p){c&&$(c,i,a),h?c=h:c=null,a="";continue}a=a+d}c&&$(c,i,a),e.push(i.x,i.y,i.z)}),e}function lt(r){return r==null?void 0:r.includes("=")}async function ct(r){var i,s;const e=(i=r==null?void 0:r.trim())==null?void 0:i.split(/\r?\n/);if(lt(r))return nt(e);const n=e==null?void 0:e[0],o=(s=n==null?void 0:n.trim())==null?void 0:s.split(/\s+/);if((o==null?void 0:o.length)>=3)return Ze(e);if((o==null?void 0:o.length)===1)return Ke(e)}async function ut(r){const e=r.trim().split(/\r?\n/),n=[];return e.forEach(o=>{const i=o.trim().split(/\s+/);if(i.length!=3)return;const[s,c,a]=i;n.push(+s,+c,+a)}),n}async function dt(r){const e=r.trim().split(/\r?\n/),n=[];return e.forEach(o=>{const i=o.trim().split(/\s+/);if(i.length!=3)return;const[s,c,a]=i;n.push(+s,+c,+a)}),n}async function ft(r){let e=r.trim().split(/\r?\n/);return e=e.filter(o=>{const i=o.startsWith("X"),s=o.startsWith("G")&&o.includes("X");return i||s}),at(e)}async function mt(r,e){const{isCyd:n,isUv:o,isCpt:i,isNc:s}=e;return o?ct(r):n?dt(r):i?ut(r):s?ft(r):[]}function pt(r){const e=[];for(let n=0;n<r.length;n+=3)e.push(new l.Vector3(r[n],r[n+1],r[n+2]));return e}function ht(r,e){if(!e||e.length<3)return;const{scene:n,camera:o,renderer:i,controls:s}=r();if(!n||!o||!i||!s)return;const c=[];for(let v=0;v<e.length;v+=3)c.push(new l.Vector3(e[v],e[v+1],e[v+2]));const m=new l.CatmullRomCurve3(c,!1,"catmullrom",.5).getPoints(150).flatMap(v=>[v.x,v.y,v.z]),d=new me;d.setPositions(m);const h=new te({color:55551,linewidth:3,resolution:new l.Vector2(window.innerWidth,window.innerHeight)}),p=new Ye(d,h);return p.name="轨迹路径",n.add(p),p}function vt(r,e,n,o=4,i=50){let s=1/0,c=-1/0,a=1/0,m=-1/0,d=1/0,h=-1/0;for(let g=0;g<r.length;g+=3){const y=r[g],_=r[g+1],C=r[g+2];s=Math.min(s,y),c=Math.max(c,y),a=Math.min(a,_),m=Math.max(m,_),d=Math.min(d,C),h=Math.max(h,C)}const v=Math.sqrt((c-s)**2+(m-a)**2+(h-d)**2)*.05,E=l.MathUtils.degToRad(e.fov),B=2*Math.tan(E/2)*i,U=v/B*n.domElement.height*(o/4);return Math.min(.4,U)}function gt(r){if(r.length%3!==0)return console.error("points array length is not a multiple of 3:",r),null;const e=new l.BufferGeometry;e.setAttribute("position",new l.Float32BufferAttribute(r,3));const n=new Float32Array(r.length);for(let s=0;s<r.length;s+=3)n[s]=0,n[s+1]=.847,n[s+2]=1;e.setAttribute("color",new l.BufferAttribute(n,3));const o=new l.PointsMaterial({vertexColors:!0,size:.4,sizeAttenuation:!0}),i=new l.Points(e,o);return o.needsUpdate=!0,i}function wt(r,e){const n=new l.Box3().setFromArray(e),o=[new l.Vector3(n.min.x,n.min.y,n.min.z),new l.Vector3(n.max.x,n.min.y,n.min.z),new l.Vector3(n.min.x,n.max.y,n.min.z),new l.Vector3(n.min.x,n.min.y,n.max.z),new l.Vector3(n.max.x,n.max.y,n.min.z),new l.Vector3(n.max.x,n.min.y,n.max.z),new l.Vector3(n.min.x,n.max.y,n.max.z),new l.Vector3(n.max.x,n.max.y,n.max.z)];let i=0;for(const s of o)i=Math.max(i,s.distanceTo(r.position));return i}function yt(r,e){if(!e)return;const{scene:n,camera:o,renderer:i,controls:s}=r();if(!n||!o||!i||!s)return;const c=gt(e);if(!c)return;c.name="轨迹路径",n.add(c);const a=vt(e,o,i,.1,50);c.material.size=a;const m=wt(o,e);return o.far=m*1.2,o.updateProjectionMatrix(),c}const xt={class:"obj-viewer-container"},bt={class:"buttonGroup-topLeft"},St={class:"buttonGroup-left"},_t={class:"buttonGroup-right"},Et={class:"buttonGroup-bottom"},Ct={class:"left-panel"},Vt={class:"panel-header"},zt={class:"panel-body"},At={key:1,class:"clipping-content"},Ut={class:"radio-group"},Nt={class:"radio-label"},Mt={class:"radio-label"},Tt={class:"radio-label"},Bt={class:"radio-label"},Lt={class:"right-panel"},kt={class:"panel-header"},Dt={class:"panel-body"},Pt={key:0,class:"loading-overlay"},It=t.defineComponent({__name:"threeTrackPathView",props:{fileBlobs:{},threeData:{default:()=>""},trackFileType:{}},emits:["getAnimationData","getThreeData"],setup(r,{emit:e}){const n=e,o=r,i=t.ref(null),s=t.ref(!1),c=t.ref(""),a=t.ref(),m=t.ref(!1),d=t.ref(""),h=t.ref(!1),p=t.ref(""),v=t.shallowRef(null),E=t.shallowRef(null),{currentModels:B,resetView:U,initThreeJS:g,handleResize:y,getThreeJSObjects:_,cleanup:C,axesHelperVisible:A,toggleAxesVisibility:X}=O.useThreeJS(i),{isAnimating:F,toggleAnimation:pe,stopAnimation:he}=O.useAnimation(_,B),{isClipping:ve,activeClippingAxis:z,toggleClipping:ge,updateClippingPlanes:L}=O.useClipping(_,B),we=()=>{X()},Y=f=>{m.value=!0,d.value=f,f==="剖面视图"&&!ve.value&&ge()},Z=f=>{h.value=!0,p.value=f,f==="动画仿真"&&n("getAnimationData")},K=t.ref([]),j=t.ref([]),ye=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isUv}),xe=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isCyd}),be=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isCpt}),D=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isNc}),Se=t.computed(()=>{const f=o.fileBlobs||[];return f==null?void 0:f[0]});let k=t.shallowRef(),P=t.shallowRef();const _e=()=>{const{scene:f}=_();k.value&&f&&(O.disposeObj(k.value,f),k.value=null)},Ee=()=>{const{scene:f}=_();P.value&&f&&(O.disposeObj(P.value,f),P.value=null)},ne=()=>{_e(),Ee()},Ce=async f=>{const u=URL.createObjectURL(f),R=await Be.readFileText(u);if(URL.revokeObjectURL(u),Le.isString(R)){const w=await mt(R,o.trackFileType)||[];K.value=w;const ie=K.value;ye.value&&(k.value=ht(_,ie)),(xe.value||be.value||D.value)&&(k.value=yt(_,ie)),O.frameCameraToMesh(_,k.value)}},Ve=()=>{var f,u;P.value=ke(),j.value=pt(K.value),j.value&&j.value.length&&(de(P.value,j.value[0],k.value,new l.Color(16711680)),(u=(f=E.value)==null?void 0:f.add)==null||u.call(f,P.value))};t.watch(()=>Se.value,async f=>{f&&(ne(),await Ce(f),D.value&&Ve())},{immediate:!0,deep:!0});const ze=()=>{var f;D.value&&((f=a==null?void 0:a.value)==null||f.playAnimation())},Ae=()=>{var f;D.value&&((f=a==null?void 0:a.value)==null||f.stopAnimation())},Ue=()=>{var f;D.value&&((f=a==null?void 0:a.value)==null||f.forwardFrame())},Ne=()=>{var f;D.value&&((f=a==null?void 0:a.value)==null||f.backwardFrame())},Me=()=>{g(),window.addEventListener("resize",y);const f=_();E.value=f.scene,E.value&&(E.value.name="CPMPIP")},Te=()=>{window.removeEventListener("resize",y),F.value&&he(),ne(),C()};return t.onMounted(async()=>{try{Me()}catch(f){console.error("Three.js 初始化失败:",f),W.ElMessage.error("渲染引擎初始化失败!")}}),t.onBeforeUnmount(()=>{Te()}),(f,u)=>{const R=t.resolveComponent("el-scrollbar");return t.openBlock(),t.createElementBlock("div",xt,[t.createElementVNode("div",{ref_key:"threejsContainer",ref:i,class:"threejs-container"},null,512),t.createElementVNode("div",bt,[t.createVNode(V.ThreeSvgIcon,{name:"viewReset",size:"24",onClick:t.unref(U),title:"重置"},null,8,["onClick"]),t.createVNode(V.ThreeSvgIcon,{name:"fangda",size:"24",title:"放大"}),t.createVNode(V.ThreeSvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),t.createVNode(V.ThreeSvgIcon,{name:"lookAround",size:"24",onClick:t.unref(pe),title:t.unref(F)?"停止动画":"动画视图"},null,8,["onClick","title"]),t.createVNode(V.ThreeSvgIcon,{name:"zuobiaoxi",size:"24",active:t.unref(A),onClick:we,title:"显隐坐标轴"},null,8,["active"])]),t.createElementVNode("div",St,[t.renderSlot(f.$slots,"button-left",{switchRightPanel:Y},void 0,!0),t.createVNode(V.ThreeSvgIcon,{name:"jiegoushu",size:"24",onClick:u[0]||(u[0]=w=>Y("场景树")),active:m.value&&d.value==="场景树",title:"场景树"},null,8,["active"]),t.createVNode(V.ThreeSvgIcon,{name:"clipping",size:"24",onClick:u[1]||(u[1]=w=>Y("剖面视图")),active:m.value&&d.value==="剖面视图",title:"剖面视图"},null,8,["active"])]),t.createElementVNode("div",_t,[t.renderSlot(f.$slots,"button-right",{switchRightPanel:Z},void 0,!0),t.createVNode(V.ThreeSvgIcon,{name:"guanjiekongzhi",size:"24",onClick:u[2]||(u[2]=w=>Z("关节控制")),active:h.value&&p.value==="关节控制",title:"关节控制"},null,8,["active"]),t.createVNode(V.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:u[3]||(u[3]=w=>Z("动画仿真")),active:h.value&&p.value==="动画仿真"},null,8,["active"])]),t.createElementVNode("div",Et,[t.createVNode(V.ThreeSvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:Ne}),t.createVNode(V.ThreeSvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:ze}),t.createVNode(V.ThreeSvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:Ue}),t.createVNode(V.ThreeSvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:Ae})]),t.withDirectives(t.createElementVNode("div",Ct,[t.createElementVNode("div",Vt,[t.createElementVNode("span",null,t.toDisplayString(d.value),1),t.createElementVNode("span",{class:"close",onClick:u[4]||(u[4]=w=>m.value=!1)}," X ")]),t.createElementVNode("div",zt,[t.createVNode(R,{height:"100%"},{default:t.withCtx(()=>[d.value==="场景树"?(t.openBlock(),t.createBlock(oe.UrdfTree,{key:0,model:v.value},null,8,["model"])):t.createCommentVNode("",!0),d.value==="剖面视图"?(t.openBlock(),t.createElementBlock("div",At,[t.createElementVNode("div",Ut,[t.createElementVNode("label",Nt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":u[5]||(u[5]=w=>t.isRef(z)?z.value=w:null),onChange:u[6]||(u[6]=(...w)=>t.unref(L)&&t.unref(L)(...w))},null,544),[[t.vModelRadio,t.unref(z)]]),u[14]||(u[14]=t.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),t.createElementVNode("label",Mt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":u[7]||(u[7]=w=>t.isRef(z)?z.value=w:null),onChange:u[8]||(u[8]=(...w)=>t.unref(L)&&t.unref(L)(...w))},null,544),[[t.vModelRadio,t.unref(z)]]),u[15]||(u[15]=t.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),t.createElementVNode("label",Tt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":u[9]||(u[9]=w=>t.isRef(z)?z.value=w:null),onChange:u[10]||(u[10]=(...w)=>t.unref(L)&&t.unref(L)(...w))},null,544),[[t.vModelRadio,t.unref(z)]]),u[16]||(u[16]=t.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),t.createElementVNode("label",Bt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":u[11]||(u[11]=w=>t.isRef(z)?z.value=w:null),onChange:u[12]||(u[12]=(...w)=>t.unref(L)&&t.unref(L)(...w))},null,544),[[t.vModelRadio,t.unref(z)]]),u[17]||(u[17]=t.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):t.createCommentVNode("",!0)]),_:1})])],512),[[t.vShow,m.value]]),t.withDirectives(t.createElementVNode("div",Lt,[t.createElementVNode("div",kt,[t.createElementVNode("span",null,t.toDisplayString(p.value),1),t.createElementVNode("span",{class:"close",onClick:u[13]||(u[13]=w=>h.value=!1)}," X ")]),t.createElementVNode("div",Dt,[t.createVNode(R,{height:"100%"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(oe.JointPanel,{model:v.value},null,8,["model"]),[[t.vShow,p.value==="关节控制"]]),t.withDirectives(t.createVNode(He,{ref_key:"animationPanelRef",ref:a,cloud:t.unref(k),knife:t.unref(P),vectors:j.value},null,8,["cloud","knife","vectors"]),[[t.vShow,p.value==="动画仿真"&&D.value]])]),_:1})])],512),[[t.vShow,h.value]]),s.value?(t.openBlock(),t.createElementBlock("div",Pt,[u[18]||(u[18]=t.createElementVNode("div",{class:"loading-spinner"},null,-1)),t.createElementVNode("p",null,t.toDisplayString(c.value),1)])):t.createCommentVNode("",!0)])}}}),Ft=ue._export_sfc(It,[["__scopeId","data-v-48ba356f"]]);exports.default=Ft;
|
|
@@ -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-BRFs_L5R.cjs"),U=require("./MTLLoader-zZDM0NQh.cjs"),C=require("./threeViewerHost-Sda_AoRw.cjs"),R=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dzyqt2Z-.cjs"),e=require("vue"),D=require("./iconfont-C7kE-QbU.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;
|
package/public/obj/model.mtl
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# CAD Exchanger 3.24.0 (cadexchanger.com)
|
|
2
|
-
# Material Count: 5
|
|
3
|
-
|
|
4
|
-
newmtl Material_1
|
|
5
|
-
Ns 0.000000
|
|
6
|
-
Ka 0.200000 0.200000 0.200000
|
|
7
|
-
Kd 0.666667 0.666667 0.666667
|
|
8
|
-
Ks 0.000000 0.000000 0.000000
|
|
9
|
-
Ke 0.000000 0.000000 0.000000
|
|
10
|
-
d 1.000000
|
|
11
|
-
|
|
12
|
-
newmtl Material_2
|
|
13
|
-
Ns 0.000000
|
|
14
|
-
Ka 0.200000 0.200000 0.200000
|
|
15
|
-
Kd 0.133333 0.133333 0.133333
|
|
16
|
-
Ks 0.000000 0.000000 0.000000
|
|
17
|
-
Ke 0.000000 0.000000 0.000000
|
|
18
|
-
d 1.000000
|
|
19
|
-
|
|
20
|
-
newmtl Material_3
|
|
21
|
-
Ns 0.000000
|
|
22
|
-
Ka 0.200000 0.200000 0.200000
|
|
23
|
-
Kd 0.733333 0.733333 0.733333
|
|
24
|
-
Ks 0.000000 0.000000 0.000000
|
|
25
|
-
Ke 0.000000 0.000000 0.000000
|
|
26
|
-
d 1.000000
|
|
27
|
-
|
|
28
|
-
newmtl Material_5
|
|
29
|
-
Ns 0.000000
|
|
30
|
-
Ka 0.200000 0.200000 0.200000
|
|
31
|
-
Kd 0.396078 0.941176 0.450980
|
|
32
|
-
Ks 0.000000 0.000000 0.000000
|
|
33
|
-
Ke 0.000000 0.000000 0.000000
|
|
34
|
-
d 1.000000
|
|
35
|
-
|
|
36
|
-
newmtl Material_4
|
|
37
|
-
Ns 0.000000
|
|
38
|
-
Ka 0.200000 0.200000 0.200000
|
|
39
|
-
Kd 1.000000 1.000000 0.000000
|
|
40
|
-
Ks 0.000000 0.000000 0.000000
|
|
41
|
-
Ke 0.000000 0.000000 0.000000
|
|
42
|
-
d 1.000000
|