ss-component-new 1.2.5 → 1.2.6

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.
Files changed (116) hide show
  1. package/dist/OrbitControls-Co_9huz0.cjs +1 -0
  2. package/dist/OrbitControls-DA4VpOM_.js +458 -0
  3. package/dist/STLLoader-DmGTF0Nv.js +657 -0
  4. package/dist/STLLoader-RU7KqloS.cjs +6 -0
  5. package/dist/{animationData-C-RfOMuc.cjs → animationData-B0K2ghu6.cjs} +1 -1
  6. package/dist/{animationData-y8dsr3_3.js → animationData-GqECkAbz.js} +4 -4
  7. package/dist/{array-A59WrroX.js → array-D65aMM6H.js} +1 -1
  8. package/dist/{array-BtZq8qON.cjs → array-DMPAgNcb.cjs} +1 -1
  9. package/dist/{iconfont-7cEds3Xj.js → iconfont-ljBfzBSE.js} +2 -2
  10. package/dist/{iconfont-CsuwJCas.cjs → iconfont-t5epssvu.cjs} +1 -1
  11. package/dist/{index-CIH_h4z2.js → index--rLSLEk3.js} +2 -2
  12. package/dist/{index-BstfB43W.cjs → index-67QO-qDa.cjs} +1 -1
  13. package/dist/{index-DTOlfKkI.cjs → index-87kRWJv8.cjs} +1 -1
  14. package/dist/{index-Y9ssLsHN.js → index-8Dyi4QCI.js} +183 -184
  15. package/dist/{index-CxOoKysB.cjs → index-8yRiF_z8.cjs} +1 -1
  16. package/dist/{index-CwnxmCht.js → index-9zEdW6xv.js} +2 -2
  17. package/dist/{index-DQP6am4n.cjs → index-B14iwpkN.cjs} +1 -1
  18. package/dist/{index-De5HlcQy.cjs → index-B7hLDNQ6.cjs} +1 -1
  19. package/dist/{index-Cli0OESv.js → index-BEoEUXZe.js} +10 -10
  20. package/dist/{index-DLBS_tgM.cjs → index-BHJ-tVLT.cjs} +1 -1
  21. package/dist/{index-DX6yycjK.js → index-BMMYAqF1.js} +1 -1
  22. package/dist/{index-DSb6SjE3.js → index-BNOx3XL5.js} +1 -1
  23. package/dist/{index-C5z5UbxK.cjs → index-BNvpuVyw.cjs} +1 -1
  24. package/dist/{index-1z9RrjZc.cjs → index-BOJUyAaV.cjs} +1 -1
  25. package/dist/{index-D2ZBhyUI.cjs → index-BYUPvuvs.cjs} +1 -1
  26. package/dist/{index-CKowlJfn.cjs → index-BaRkv5oc.cjs} +1 -1
  27. package/dist/{index-C1oE8qIa.cjs → index-BpR7F1Fp.cjs} +1 -1
  28. package/dist/{index-BLgbZvdb.js → index-Bs2K1FVH.js} +2 -2
  29. package/dist/{index-NcJvspI2.cjs → index-BsM9qdbC.cjs} +1 -1
  30. package/dist/{index-B8mnYY10.js → index-BsfJJu0R.js} +6 -6
  31. package/dist/{index-BCbxnJnH.js → index-Bw_JtuzR.js} +152 -152
  32. package/dist/{index-C461j30b.js → index-C1FOuBuy.js} +1 -1
  33. package/dist/{index-COKoQtgg.cjs → index-C5CKSB0e.cjs} +1 -1
  34. package/dist/{index-Bc4DtcwM.js → index-C8UOMPgt.js} +2 -2
  35. package/dist/{index-3W-Y0xpv.cjs → index-CA-FC_OL.cjs} +1 -1
  36. package/dist/{index-DNaqgwk-.js → index-CArSUfnV.js} +20 -20
  37. package/dist/{index-DU_1ks22.js → index-CBuqdsPh.js} +4 -4
  38. package/dist/{index-C_GxFCMg.js → index-CMCrQ36H.js} +3 -3
  39. package/dist/{index-DYU11-M5.js → index-CRj9VM12.js} +6 -6
  40. package/dist/{index-700WRwjB.js → index-CRrAiL5l.js} +4 -4
  41. package/dist/{index-Dzrvm_bg.js → index-CShBWCYm.js} +1 -1
  42. package/dist/{index-BwjuTBrR.js → index-CTkF2kl_.js} +1 -1
  43. package/dist/{index-COV5L9rX.cjs → index-CZaBF851.cjs} +1 -1
  44. package/dist/{index-DTCYk2wI.js → index-CbA74tCL.js} +2 -2
  45. package/dist/{index-DgymXtI4.js → index-CbDu4gfZ.js} +2 -2
  46. package/dist/{index-Bxyl11ug.cjs → index-CePZE-QA.cjs} +1 -1
  47. package/dist/{index-DIOVPmEg.cjs → index-CedgKpsz.cjs} +1 -1
  48. package/dist/{index-O8If5b4T.cjs → index-Cm3z0Vmi.cjs} +1 -1
  49. package/dist/{index-Cj8I0l8I.js → index-D-WcrLQv.js} +4 -4
  50. package/dist/{index-OsCw48Sn.cjs → index-D6mwkqWY.cjs} +1 -1
  51. package/dist/{index-BKJg9Djt.cjs → index-D8510-YQ.cjs} +1 -1
  52. package/dist/{index-Bb7Xqt9a.cjs → index-D9oqICYV.cjs} +1 -1
  53. package/dist/{index-BvApH9cT.js → index-DGepdvRW.js} +2 -2
  54. package/dist/{index-ByVPv-Yz.js → index-DGi-ANHr.js} +5 -5
  55. package/dist/{index-C4zGJtAL.js → index-DJGsDpDp.js} +3 -3
  56. package/dist/{index-CIcvrh1S.cjs → index-DPBmAgEA.cjs} +1 -1
  57. package/dist/{index-yQZ9D_YR.js → index-DPWc4No_.js} +2 -2
  58. package/dist/{index-CxnH4vfV.cjs → index-DSchKIyh.cjs} +1 -1
  59. package/dist/{index-CYp77kPp.js → index-DV_ZZQBO.js} +1 -1
  60. package/dist/{index-D8WF1ILq.cjs → index-DVmoPvzr.cjs} +1 -1
  61. package/dist/{index-DWrDb90D.cjs → index-DWs7-g1h.cjs} +1 -1
  62. package/dist/{index-HvKkM5Lq.cjs → index-DZ8a7BZ1.cjs} +1 -1
  63. package/dist/{index-Y6CA0bCm.cjs → index-DcUUpSE1.cjs} +1 -1
  64. package/dist/{index-CX_HTfbe.js → index-DvpVQvAe.js} +2 -2
  65. package/dist/{index-DYx6r9hf.cjs → index-FK1YYpjN.cjs} +1 -1
  66. package/dist/{index-BYDi6Owv.js → index-HvKjB6_P.js} +3 -3
  67. package/dist/{index-DPk1uhLn.js → index-LADv0t0E.js} +12 -12
  68. package/dist/{index-D3-XwkD_.js → index-_66uQhcl.js} +6 -6
  69. package/dist/{index-CJK74ski.cjs → index-_uyv24Pt.cjs} +1 -1
  70. package/dist/{index-CdELRsxO.js → index-g4qw0jRy.js} +6 -6
  71. package/dist/{index-GmZ7sLUW.cjs → index-mtuIEfrj.cjs} +1 -1
  72. package/dist/{index-CjI5pDiU.cjs → index-tttYIzsn.cjs} +1 -1
  73. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DLUx599w.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BSOYWm_U.cjs} +1 -1
  74. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BhLzDN6s.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DIMJusrg.js} +2 -2
  75. package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-llikchjv.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-D2VLEzGB.cjs} +1 -1
  76. package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-D-2EkcBi.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-D58IzjOR.js} +6 -6
  77. package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-DiMotFL8.cjs → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-BnNwKutS.cjs} +1 -1
  78. package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-DodcXWpb.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CJCvJvBM.js} +13 -13
  79. package/dist/{index.vue_vue_type_style_index_1_lang-CFvcnWO4.js → index.vue_vue_type_style_index_1_lang-D5Hjs-g0.js} +1 -1
  80. package/dist/{index.vue_vue_type_style_index_1_lang-BJQzMo8k.cjs → index.vue_vue_type_style_index_1_lang-H_pReDxj.cjs} +46 -45
  81. package/dist/{index.vue_vue_type_style_index_1_lang-BcYTED7W.cjs → index.vue_vue_type_style_index_1_lang-N-_9ZJEf.cjs} +1 -1
  82. package/dist/{index.vue_vue_type_style_index_1_lang-BMzWMYje.js → index.vue_vue_type_style_index_1_lang-hBa3nAgx.js} +5100 -5012
  83. package/dist/{isString-BNK38WbE.js → isString--ZVOCy4V.js} +1 -1
  84. package/dist/{isString-BmAegMGI.cjs → isString-CELwppr9.cjs} +1 -1
  85. package/dist/{main-C3-nmz2f.cjs → main-C6Iw-pcH.cjs} +1 -1
  86. package/dist/{main-DS4xl7Jm.js → main-CygliYyN.js} +5 -5
  87. package/dist/ss-component.cjs +1 -1
  88. package/dist/ss-component.css +1 -1
  89. package/dist/ss-component.js +11 -11
  90. package/dist/ss-component2.cjs +1 -1
  91. package/dist/ss-component2.js +12 -12
  92. package/dist/three-viewport-gizmo-BHznJ6W3.js +26015 -0
  93. package/dist/three-viewport-gizmo-BV37JzRa.cjs +4197 -0
  94. package/dist/{threeLatheView-BzHB-t_G.cjs → threeLatheView-CdUoB0Te.cjs} +1 -1
  95. package/dist/{threeLatheView-sTBlm0tt.js → threeLatheView-DzpPpdDr.js} +4 -4
  96. package/dist/{threeModel-BoNyasP7.cjs → threeModel-BUCLJlE5.cjs} +1 -1
  97. package/dist/{threeModel-CaxS7sQg.js → threeModel-BfMMeZCc.js} +5 -5
  98. package/dist/threePreview-BEqzg370.js +1972 -0
  99. package/dist/threePreview-C-JW_pcY.cjs +1 -0
  100. package/dist/{threeSceneView-wQdzFhdw.cjs → threeSceneView-BTsG2QJg.cjs} +1 -1
  101. package/dist/{threeSceneView-BIAOu60U.js → threeSceneView-DV5dsTZZ.js} +24 -24
  102. package/dist/{threeSceneViewForCPMPIP-XYA9PRYN.js → threeSceneViewForCPMPIP-Bexwqkry.js} +27 -27
  103. package/dist/{threeSceneViewForCPMPIP-Bkr16khM.cjs → threeSceneViewForCPMPIP-DwLWGNUd.cjs} +2 -2
  104. package/dist/{threeViewerHost-D1i6LUb6.cjs → threeViewerHost-CRqcYbJE.cjs} +1 -1
  105. package/dist/{threeViewerHost-BkOYLPdk.js → threeViewerHost-CTjd2V1D.js} +4 -4
  106. package/dist/{useRayCaster-CdDOIWOo.js → useRayCaster-D0_7oJan.js} +12 -12
  107. package/dist/{useRayCaster-0bnGc301.cjs → useRayCaster-DN56HpNP.cjs} +1 -1
  108. package/package.json +1 -1
  109. package/dist/OrbitControls-D1lM0xvz.cjs +0 -1
  110. package/dist/OrbitControls-DI8fa9gz.js +0 -419
  111. package/dist/STLLoader-KxFIlfhN.cjs +0 -6
  112. package/dist/STLLoader-memlq1bT.js +0 -609
  113. package/dist/three-viewport-gizmo-BxFHxv_x.js +0 -18587
  114. package/dist/three-viewport-gizmo-CwaL5sMV.cjs +0 -4195
  115. package/dist/threePreview-Cy7NY-gw.cjs +0 -1
  116. package/dist/threePreview-DPyqhBkJ.js +0 -1873
@@ -1,6 +0,0 @@
1
- "use strict";const c=require("./three-viewport-gizmo-CwaL5sMV.cjs"),H=/^[og]\s*(.+)?/,N=/^mtllib /,q=/^usemtl /,J=/^usemap /,R=/\s+/,G=new c.Vector3,z=new c.Vector3,D=new c.Vector3,E=new c.Vector3,j=new c.Vector3,I=new c.Color;function W(){const P={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,s){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=s!==!1;return}const i=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:s!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(t,r){const h=this._finalize(!1);h&&(h.inherited||h.groupCount<=0)&&this.materials.splice(h.index,1);const u={index:this.materials.length,name:t||"",mtllib:Array.isArray(r)&&r.length>0?r[r.length-1]:"",smooth:h!==void 0?h.smooth:this.smooth,groupStart:h!==void 0?h.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(l){const n={index:typeof l=="number"?l:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return n.clone=this.clone.bind(n),n}};return this.materials.push(u),u},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){const r=this.currentMaterial();if(r&&r.groupEnd===-1&&(r.groupEnd=this.geometry.vertices.length/3,r.groupCount=r.groupEnd-r.groupStart,r.inherited=!1),t&&this.materials.length>1)for(let h=this.materials.length-1;h>=0;h--)this.materials[h].groupCount<=0&&this.materials.splice(h,1);return t&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),r}},i&&i.name&&typeof i.clone=="function"){const t=i.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,s){const i=parseInt(e,10);return(i>=0?i-1:i+s/3)*3},parseNormalIndex:function(e,s){const i=parseInt(e,10);return(i>=0?i-1:i+s/3)*3},parseUVIndex:function(e,s){const i=parseInt(e,10);return(i>=0?i-1:i+s/2)*2},addVertex:function(e,s,i){const t=this.vertices,r=this.object.geometry.vertices;r.push(t[e+0],t[e+1],t[e+2]),r.push(t[s+0],t[s+1],t[s+2]),r.push(t[i+0],t[i+1],t[i+2])},addVertexPoint:function(e){const s=this.vertices;this.object.geometry.vertices.push(s[e+0],s[e+1],s[e+2])},addVertexLine:function(e){const s=this.vertices;this.object.geometry.vertices.push(s[e+0],s[e+1],s[e+2])},addNormal:function(e,s,i){const t=this.normals,r=this.object.geometry.normals;r.push(t[e+0],t[e+1],t[e+2]),r.push(t[s+0],t[s+1],t[s+2]),r.push(t[i+0],t[i+1],t[i+2])},addFaceNormal:function(e,s,i){const t=this.vertices,r=this.object.geometry.normals;G.fromArray(t,e),z.fromArray(t,s),D.fromArray(t,i),j.subVectors(D,z),E.subVectors(G,z),j.cross(E),j.normalize(),r.push(j.x,j.y,j.z),r.push(j.x,j.y,j.z),r.push(j.x,j.y,j.z)},addColor:function(e,s,i){const t=this.colors,r=this.object.geometry.colors;t[e]!==void 0&&r.push(t[e+0],t[e+1],t[e+2]),t[s]!==void 0&&r.push(t[s+0],t[s+1],t[s+2]),t[i]!==void 0&&r.push(t[i+0],t[i+1],t[i+2])},addUV:function(e,s,i){const t=this.uvs,r=this.object.geometry.uvs;r.push(t[e+0],t[e+1]),r.push(t[s+0],t[s+1]),r.push(t[i+0],t[i+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const s=this.uvs;this.object.geometry.uvs.push(s[e+0],s[e+1])},addFace:function(e,s,i,t,r,h,u,l,n){const o=this.vertices.length;let a=this.parseVertexIndex(e,o),f=this.parseVertexIndex(s,o),m=this.parseVertexIndex(i,o);if(this.addVertex(a,f,m),this.addColor(a,f,m),u!==void 0&&u!==""){const g=this.normals.length;a=this.parseNormalIndex(u,g),f=this.parseNormalIndex(l,g),m=this.parseNormalIndex(n,g),this.addNormal(a,f,m)}else this.addFaceNormal(a,f,m);if(t!==void 0&&t!==""){const g=this.uvs.length;a=this.parseUVIndex(t,g),f=this.parseUVIndex(r,g),m=this.parseUVIndex(h,g),this.addUV(a,f,m),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const s=this.vertices.length;for(let i=0,t=e.length;i<t;i++){const r=this.parseVertexIndex(e[i],s);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(e,s){this.object.geometry.type="Line";const i=this.vertices.length,t=this.uvs.length;for(let r=0,h=e.length;r<h;r++)this.addVertexLine(this.parseVertexIndex(e[r],i));for(let r=0,h=s.length;r<h;r++)this.addUVLine(this.parseUVIndex(s[r],t))}};return P.startObject("",!1),P}class Z extends c.Loader{constructor(e){super(e),this.materials=null}load(e,s,i,t){const r=this,h=new c.FileLoader(this.manager);h.setPath(this.path),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,function(u){try{s(r.parse(u))}catch(l){t?t(l):console.error(l),r.manager.itemError(e)}},i,t)}setMaterials(e){return this.materials=e,this}parse(e){const s=new W;e.indexOf(`\r
2
- `)!==-1&&(e=e.replace(/\r\n/g,`
3
- `)),e.indexOf(`\\
4
- `)!==-1&&(e=e.replace(/\\\n/g,""));const i=e.split(`
5
- `);let t=[];for(let u=0,l=i.length;u<l;u++){const n=i[u].trimStart();if(n.length===0)continue;const o=n.charAt(0);if(o!=="#")if(o==="v"){const a=n.split(R);switch(a[0]){case"v":s.vertices.push(parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3])),a.length>=7?(I.setRGB(parseFloat(a[4]),parseFloat(a[5]),parseFloat(a[6])).convertSRGBToLinear(),s.colors.push(I.r,I.g,I.b)):s.colors.push(void 0,void 0,void 0);break;case"vn":s.normals.push(parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]));break;case"vt":s.uvs.push(parseFloat(a[1]),parseFloat(a[2]));break}}else if(o==="f"){const f=n.slice(1).trim().split(R),m=[];for(let p=0,b=f.length;p<b;p++){const x=f[p];if(x.length>0){const w=x.split("/");m.push(w)}}const g=m[0];for(let p=1,b=m.length-1;p<b;p++){const x=m[p],w=m[p+1];s.addFace(g[0],x[0],w[0],g[1],x[1],w[1],g[2],x[2],w[2])}}else if(o==="l"){const a=n.substring(1).trim().split(" ");let f=[];const m=[];if(n.indexOf("/")===-1)f=a;else for(let g=0,p=a.length;g<p;g++){const b=a[g].split("/");b[0]!==""&&f.push(b[0]),b[1]!==""&&m.push(b[1])}s.addLineGeometry(f,m)}else if(o==="p"){const f=n.slice(1).trim().split(" ");s.addPointGeometry(f)}else if((t=H.exec(n))!==null){const a=(" "+t[0].slice(1).trim()).slice(1);s.startObject(a)}else if(q.test(n))s.object.startMaterial(n.substring(7).trim(),s.materialLibraries);else if(N.test(n))s.materialLibraries.push(n.substring(7).trim());else if(J.test(n))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(o==="s"){if(t=n.split(" "),t.length>1){const f=t[1].trim().toLowerCase();s.object.smooth=f!=="0"&&f!=="off"}else s.object.smooth=!0;const a=s.object.currentMaterial();a&&(a.smooth=s.object.smooth)}else{if(n==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+n+'"')}}s.finalize();const r=new c.Group;if(r.materialLibraries=[].concat(s.materialLibraries),!(s.objects.length===1&&s.objects[0].geometry.vertices.length===0)===!0)for(let u=0,l=s.objects.length;u<l;u++){const n=s.objects[u],o=n.geometry,a=n.materials,f=o.type==="Line",m=o.type==="Points";let g=!1;if(o.vertices.length===0)continue;const p=new c.BufferGeometry;p.setAttribute("position",new c.Float32BufferAttribute(o.vertices,3)),o.normals.length>0&&p.setAttribute("normal",new c.Float32BufferAttribute(o.normals,3)),o.colors.length>0&&(g=!0,p.setAttribute("color",new c.Float32BufferAttribute(o.colors,3))),o.hasUVIndices===!0&&p.setAttribute("uv",new c.Float32BufferAttribute(o.uvs,2));const b=[];for(let w=0,M=a.length;w<M;w++){const L=a[w],A=L.name+"_"+L.smooth+"_"+g;let d=s.materials[A];if(this.materials!==null){if(d=this.materials.create(L.name),f&&d&&!(d instanceof c.LineBasicMaterial)){const y=new c.LineBasicMaterial;c.Material.prototype.copy.call(y,d),y.color.copy(d.color),d=y}else if(m&&d&&!(d instanceof c.PointsMaterial)){const y=new c.PointsMaterial({size:10,sizeAttenuation:!1});c.Material.prototype.copy.call(y,d),y.color.copy(d.color),y.map=d.map,d=y}}d===void 0&&(f?d=new c.LineBasicMaterial:m?d=new c.PointsMaterial({size:1,sizeAttenuation:!1}):d=new c.MeshPhongMaterial,d.name=L.name,d.flatShading=!L.smooth,d.vertexColors=g,s.materials[A]=d),b.push(d)}let x;if(b.length>1){for(let w=0,M=a.length;w<M;w++){const L=a[w];p.addGroup(L.groupStart,L.groupCount,w)}f?x=new c.LineSegments(p,b):m?x=new c.Points(p,b):x=new c.Mesh(p,b)}else f?x=new c.LineSegments(p,b[0]):m?x=new c.Points(p,b[0]):x=new c.Mesh(p,b[0]);x.name=n.name,r.add(x)}else if(s.vertices.length>0){const u=new c.PointsMaterial({size:1,sizeAttenuation:!1}),l=new c.BufferGeometry;l.setAttribute("position",new c.Float32BufferAttribute(s.vertices,3)),s.colors.length>0&&s.colors[0]!==void 0&&(l.setAttribute("color",new c.Float32BufferAttribute(s.colors,3)),u.vertexColors=!0);const n=new c.Points(l,u);r.add(n)}return r}}class X extends c.Loader{constructor(e){super(e)}load(e,s,i,t){const r=this,h=this.path===""?c.LoaderUtils.extractUrlBase(e):this.path,u=new c.FileLoader(this.manager);u.setPath(this.path),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(e,function(l){try{s(r.parse(l,h))}catch(n){t?t(n):console.error(n),r.manager.itemError(e)}},i,t)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,s){const i=e.split(`
6
- `);let t={};const r=/\s+/,h={};for(let l=0;l<i.length;l++){let n=i[l];if(n=n.trim(),n.length===0||n.charAt(0)==="#")continue;const o=n.indexOf(" ");let a=o>=0?n.substring(0,o):n;a=a.toLowerCase();let f=o>=0?n.substring(o+1):"";if(f=f.trim(),a==="newmtl")t={name:f},h[f]=t;else if(a==="ka"||a==="kd"||a==="ks"||a==="ke"){const m=f.split(r,3);t[a]=[parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2])]}else t[a]=f}const u=new Y(this.resourcePath||s,this.materialOptions);return u.setCrossOrigin(this.crossOrigin),u.setManager(this.manager),u.setMaterials(h),u}}class Y{constructor(e="",s={}){this.baseUrl=e,this.options=s,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:c.FrontSide,this.wrap=this.options.wrap!==void 0?this.options.wrap:c.RepeatWrapping}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const s={};for(const i in e){const t=e[i],r={};s[i]=r;for(const h in t){let u=!0,l=t[h];const n=h.toLowerCase();switch(n){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(l=[l[0]/255,l[1]/255,l[2]/255]),this.options&&this.options.ignoreZeroRGBs&&l[0]===0&&l[1]===0&&l[2]===0&&(u=!1);break}u&&(r[n]=l)}}return s}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const s in this.materialsInfo)this.materialsArray[e]=this.create(s),this.nameLookup[s]=e,e++;return this.materialsArray}create(e){return this.materials[e]===void 0&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const s=this,i=this.materialsInfo[e],t={name:e,side:this.side};function r(u,l){return typeof l!="string"||l===""?"":/^https?:\/\//i.test(l)?l:u+l}function h(u,l){if(t[u])return;const n=s.getTextureParams(l,t),o=s.loadTexture(r(s.baseUrl,n.url));o.repeat.copy(n.scale),o.offset.copy(n.offset),o.wrapS=s.wrap,o.wrapT=s.wrap,(u==="map"||u==="emissiveMap")&&(o.colorSpace=c.SRGBColorSpace),t[u]=o}for(const u in i){const l=i[u];let n;if(l!=="")switch(u.toLowerCase()){case"kd":t.color=new c.Color().fromArray(l).convertSRGBToLinear();break;case"ks":t.specular=new c.Color().fromArray(l).convertSRGBToLinear();break;case"ke":t.emissive=new c.Color().fromArray(l).convertSRGBToLinear();break;case"map_kd":h("map",l);break;case"map_ks":h("specularMap",l);break;case"map_ke":h("emissiveMap",l);break;case"norm":h("normalMap",l);break;case"map_bump":case"bump":h("bumpMap",l);break;case"map_d":h("alphaMap",l),t.transparent=!0;break;case"ns":t.shininess=parseFloat(l);break;case"d":n=parseFloat(l),n<1&&(t.opacity=n,t.transparent=!0);break;case"tr":n=parseFloat(l),this.options&&this.options.invertTrProperty&&(n=1-n),n>0&&(t.opacity=1-n,t.transparent=!0);break}}return this.materials[e]=new c.MeshPhongMaterial(t),this.materials[e]}getTextureParams(e,s){const i={scale:new c.Vector2(1,1),offset:new c.Vector2(0,0)},t=e.split(/\s+/);let r;return r=t.indexOf("-bm"),r>=0&&(s.bumpScale=parseFloat(t[r+1]),t.splice(r,2)),r=t.indexOf("-s"),r>=0&&(i.scale.set(parseFloat(t[r+1]),parseFloat(t[r+2])),t.splice(r,4)),r=t.indexOf("-o"),r>=0&&(i.offset.set(parseFloat(t[r+1]),parseFloat(t[r+2])),t.splice(r,4)),i.url=t.join(" ").trim(),i}loadTexture(e,s,i,t,r){const h=this.manager!==void 0?this.manager:c.DefaultLoadingManager;let u=h.getHandler(e);u===null&&(u=new c.TextureLoader(h)),u.setCrossOrigin&&u.setCrossOrigin(this.crossOrigin);const l=u.load(e,i,t,r);return s!==void 0&&(l.mapping=s),l}}class K extends c.Loader{constructor(e){super(e)}load(e,s,i,t){const r=this,h=new c.FileLoader(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,function(u){try{s(r.parse(u))}catch(l){t?t(l):console.error(l),r.manager.itemError(e)}},i,t)}parse(e){function s(n){const o=new DataView(n),a=32/8*3+32/8*3*3+16/8,f=o.getUint32(80,!0);if(80+32/8+f*a===o.byteLength)return!0;const g=[115,111,108,105,100];for(let p=0;p<5;p++)if(i(g,o,p))return!1;return!0}function i(n,o,a){for(let f=0,m=n.length;f<m;f++)if(n[f]!==o.getUint8(a+f))return!1;return!0}function t(n){const o=new DataView(n),a=o.getUint32(80,!0);let f,m,g,p=!1,b,x,w,M,L;for(let v=0;v<70;v++)o.getUint32(v,!1)==1129270351&&o.getUint8(v+4)==82&&o.getUint8(v+5)==61&&(p=!0,b=new Float32Array(a*3*3),x=o.getUint8(v+6)/255,w=o.getUint8(v+7)/255,M=o.getUint8(v+8)/255,L=o.getUint8(v+9)/255);const A=84,d=12*4+2,y=new c.BufferGeometry,C=new Float32Array(a*3*3),_=new Float32Array(a*3*3),B=new c.Color;for(let v=0;v<a;v++){const k=A+v*d,O=o.getFloat32(k,!0),U=o.getFloat32(k+4,!0),S=o.getFloat32(k+8,!0);if(p){const F=o.getUint16(k+48,!0);(F&32768)===0?(f=(F&31)/31,m=(F>>5&31)/31,g=(F>>10&31)/31):(f=x,m=w,g=M)}for(let F=1;F<=3;F++){const T=k+F*12,V=v*3*3+(F-1)*3;C[V]=o.getFloat32(T,!0),C[V+1]=o.getFloat32(T+4,!0),C[V+2]=o.getFloat32(T+8,!0),_[V]=O,_[V+1]=U,_[V+2]=S,p&&(B.set(f,m,g).convertSRGBToLinear(),b[V]=B.r,b[V+1]=B.g,b[V+2]=B.b)}}return y.setAttribute("position",new c.BufferAttribute(C,3)),y.setAttribute("normal",new c.BufferAttribute(_,3)),p&&(y.setAttribute("color",new c.BufferAttribute(b,3)),y.hasColors=!0,y.alpha=L),y}function r(n){const o=new c.BufferGeometry,a=/solid([\s\S]*?)endsolid/g,f=/facet([\s\S]*?)endfacet/g,m=/solid\s(.+)/;let g=0;const p=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,b=new RegExp("vertex"+p+p+p,"g"),x=new RegExp("normal"+p+p+p,"g"),w=[],M=[],L=[],A=new c.Vector3;let d,y=0,C=0,_=0;for(;(d=a.exec(n))!==null;){C=_;const B=d[0],v=(d=m.exec(B))!==null?d[1]:"";for(L.push(v);(d=f.exec(B))!==null;){let U=0,S=0;const F=d[0];for(;(d=x.exec(F))!==null;)A.x=parseFloat(d[1]),A.y=parseFloat(d[2]),A.z=parseFloat(d[3]),S++;for(;(d=b.exec(F))!==null;)w.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),M.push(A.x,A.y,A.z),U++,_++;S!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+g),U!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+g),g++}const k=C,O=_-C;o.userData.groupNames=L,o.addGroup(k,O,y),y++}return o.setAttribute("position",new c.Float32BufferAttribute(w,3)),o.setAttribute("normal",new c.Float32BufferAttribute(M,3)),o}function h(n){return typeof n!="string"?new TextDecoder().decode(n):n}function u(n){if(typeof n=="string"){const o=new Uint8Array(n.length);for(let a=0;a<n.length;a++)o[a]=n.charCodeAt(a)&255;return o.buffer||o}else return n}const l=u(e);return s(l)?t(l):r(h(e))}}exports.MTLLoader=X;exports.OBJLoader=Z;exports.STLLoader=K;
@@ -1,609 +0,0 @@
1
- import { y as J, F as W, C as P, o as re, p as T, ax as M, ab as E, aa as Y, a9 as R, h as se, af as Z, ah as H, e as X, V as I, z as ne, au as ie, a6 as oe, J as K, aD as ae, Y as le, b as ce, _ as N } from "./three-viewport-gizmo-BxFHxv_x.js";
2
- const he = /^[og]\s*(.+)?/, ue = /^mtllib /, pe = /^usemtl /, fe = /^usemap /, Q = /\s+/, $ = new I(), q = new I(), ee = new I(), te = new I(), F = new I(), B = new P();
3
- function de() {
4
- const S = {
5
- objects: [],
6
- object: {},
7
- vertices: [],
8
- normals: [],
9
- colors: [],
10
- uvs: [],
11
- materials: {},
12
- materialLibraries: [],
13
- startObject: function(e, s) {
14
- if (this.object && this.object.fromDeclaration === !1) {
15
- this.object.name = e, this.object.fromDeclaration = s !== !1;
16
- return;
17
- }
18
- const i = this.object && typeof this.object.currentMaterial == "function" ? this.object.currentMaterial() : void 0;
19
- if (this.object && typeof this.object._finalize == "function" && this.object._finalize(!0), this.object = {
20
- name: e || "",
21
- fromDeclaration: s !== !1,
22
- geometry: {
23
- vertices: [],
24
- normals: [],
25
- colors: [],
26
- uvs: [],
27
- hasUVIndices: !1
28
- },
29
- materials: [],
30
- smooth: !0,
31
- startMaterial: function(t, r) {
32
- const h = this._finalize(!1);
33
- h && (h.inherited || h.groupCount <= 0) && this.materials.splice(h.index, 1);
34
- const c = {
35
- index: this.materials.length,
36
- name: t || "",
37
- mtllib: Array.isArray(r) && r.length > 0 ? r[r.length - 1] : "",
38
- smooth: h !== void 0 ? h.smooth : this.smooth,
39
- groupStart: h !== void 0 ? h.groupEnd : 0,
40
- groupEnd: -1,
41
- groupCount: -1,
42
- inherited: !1,
43
- clone: function(l) {
44
- const n = {
45
- index: typeof l == "number" ? l : this.index,
46
- name: this.name,
47
- mtllib: this.mtllib,
48
- smooth: this.smooth,
49
- groupStart: 0,
50
- groupEnd: -1,
51
- groupCount: -1,
52
- inherited: !1
53
- };
54
- return n.clone = this.clone.bind(n), n;
55
- }
56
- };
57
- return this.materials.push(c), c;
58
- },
59
- currentMaterial: function() {
60
- if (this.materials.length > 0)
61
- return this.materials[this.materials.length - 1];
62
- },
63
- _finalize: function(t) {
64
- const r = this.currentMaterial();
65
- if (r && r.groupEnd === -1 && (r.groupEnd = this.geometry.vertices.length / 3, r.groupCount = r.groupEnd - r.groupStart, r.inherited = !1), t && this.materials.length > 1)
66
- for (let h = this.materials.length - 1; h >= 0; h--)
67
- this.materials[h].groupCount <= 0 && this.materials.splice(h, 1);
68
- return t && this.materials.length === 0 && this.materials.push({
69
- name: "",
70
- smooth: this.smooth
71
- }), r;
72
- }
73
- }, i && i.name && typeof i.clone == "function") {
74
- const t = i.clone(0);
75
- t.inherited = !0, this.object.materials.push(t);
76
- }
77
- this.objects.push(this.object);
78
- },
79
- finalize: function() {
80
- this.object && typeof this.object._finalize == "function" && this.object._finalize(!0);
81
- },
82
- parseVertexIndex: function(e, s) {
83
- const i = parseInt(e, 10);
84
- return (i >= 0 ? i - 1 : i + s / 3) * 3;
85
- },
86
- parseNormalIndex: function(e, s) {
87
- const i = parseInt(e, 10);
88
- return (i >= 0 ? i - 1 : i + s / 3) * 3;
89
- },
90
- parseUVIndex: function(e, s) {
91
- const i = parseInt(e, 10);
92
- return (i >= 0 ? i - 1 : i + s / 2) * 2;
93
- },
94
- addVertex: function(e, s, i) {
95
- const t = this.vertices, r = this.object.geometry.vertices;
96
- r.push(t[e + 0], t[e + 1], t[e + 2]), r.push(t[s + 0], t[s + 1], t[s + 2]), r.push(t[i + 0], t[i + 1], t[i + 2]);
97
- },
98
- addVertexPoint: function(e) {
99
- const s = this.vertices;
100
- this.object.geometry.vertices.push(s[e + 0], s[e + 1], s[e + 2]);
101
- },
102
- addVertexLine: function(e) {
103
- const s = this.vertices;
104
- this.object.geometry.vertices.push(s[e + 0], s[e + 1], s[e + 2]);
105
- },
106
- addNormal: function(e, s, i) {
107
- const t = this.normals, r = this.object.geometry.normals;
108
- r.push(t[e + 0], t[e + 1], t[e + 2]), r.push(t[s + 0], t[s + 1], t[s + 2]), r.push(t[i + 0], t[i + 1], t[i + 2]);
109
- },
110
- addFaceNormal: function(e, s, i) {
111
- const t = this.vertices, r = this.object.geometry.normals;
112
- $.fromArray(t, e), q.fromArray(t, s), ee.fromArray(t, i), F.subVectors(ee, q), te.subVectors($, q), F.cross(te), F.normalize(), r.push(F.x, F.y, F.z), r.push(F.x, F.y, F.z), r.push(F.x, F.y, F.z);
113
- },
114
- addColor: function(e, s, i) {
115
- const t = this.colors, r = this.object.geometry.colors;
116
- t[e] !== void 0 && r.push(t[e + 0], t[e + 1], t[e + 2]), t[s] !== void 0 && r.push(t[s + 0], t[s + 1], t[s + 2]), t[i] !== void 0 && r.push(t[i + 0], t[i + 1], t[i + 2]);
117
- },
118
- addUV: function(e, s, i) {
119
- const t = this.uvs, r = this.object.geometry.uvs;
120
- r.push(t[e + 0], t[e + 1]), r.push(t[s + 0], t[s + 1]), r.push(t[i + 0], t[i + 1]);
121
- },
122
- addDefaultUV: function() {
123
- const e = this.object.geometry.uvs;
124
- e.push(0, 0), e.push(0, 0), e.push(0, 0);
125
- },
126
- addUVLine: function(e) {
127
- const s = this.uvs;
128
- this.object.geometry.uvs.push(s[e + 0], s[e + 1]);
129
- },
130
- addFace: function(e, s, i, t, r, h, c, l, n) {
131
- const o = this.vertices.length;
132
- let a = this.parseVertexIndex(e, o), u = this.parseVertexIndex(s, o), d = this.parseVertexIndex(i, o);
133
- if (this.addVertex(a, u, d), this.addColor(a, u, d), c !== void 0 && c !== "") {
134
- const m = this.normals.length;
135
- a = this.parseNormalIndex(c, m), u = this.parseNormalIndex(l, m), d = this.parseNormalIndex(n, m), this.addNormal(a, u, d);
136
- } else
137
- this.addFaceNormal(a, u, d);
138
- if (t !== void 0 && t !== "") {
139
- const m = this.uvs.length;
140
- a = this.parseUVIndex(t, m), u = this.parseUVIndex(r, m), d = this.parseUVIndex(h, m), this.addUV(a, u, d), this.object.geometry.hasUVIndices = !0;
141
- } else
142
- this.addDefaultUV();
143
- },
144
- addPointGeometry: function(e) {
145
- this.object.geometry.type = "Points";
146
- const s = this.vertices.length;
147
- for (let i = 0, t = e.length; i < t; i++) {
148
- const r = this.parseVertexIndex(e[i], s);
149
- this.addVertexPoint(r), this.addColor(r);
150
- }
151
- },
152
- addLineGeometry: function(e, s) {
153
- this.object.geometry.type = "Line";
154
- const i = this.vertices.length, t = this.uvs.length;
155
- for (let r = 0, h = e.length; r < h; r++)
156
- this.addVertexLine(this.parseVertexIndex(e[r], i));
157
- for (let r = 0, h = s.length; r < h; r++)
158
- this.addUVLine(this.parseUVIndex(s[r], t));
159
- }
160
- };
161
- return S.startObject("", !1), S;
162
- }
163
- class be extends J {
164
- constructor(e) {
165
- super(e), this.materials = null;
166
- }
167
- load(e, s, i, t) {
168
- const r = this, h = new W(this.manager);
169
- h.setPath(this.path), h.setRequestHeader(this.requestHeader), h.setWithCredentials(this.withCredentials), h.load(e, function(c) {
170
- try {
171
- s(r.parse(c));
172
- } catch (l) {
173
- t ? t(l) : console.error(l), r.manager.itemError(e);
174
- }
175
- }, i, t);
176
- }
177
- setMaterials(e) {
178
- return this.materials = e, this;
179
- }
180
- parse(e) {
181
- const s = new de();
182
- e.indexOf(`\r
183
- `) !== -1 && (e = e.replace(/\r\n/g, `
184
- `)), e.indexOf(`\\
185
- `) !== -1 && (e = e.replace(/\\\n/g, ""));
186
- const i = e.split(`
187
- `);
188
- let t = [];
189
- for (let c = 0, l = i.length; c < l; c++) {
190
- const n = i[c].trimStart();
191
- if (n.length === 0) continue;
192
- const o = n.charAt(0);
193
- if (o !== "#")
194
- if (o === "v") {
195
- const a = n.split(Q);
196
- switch (a[0]) {
197
- case "v":
198
- s.vertices.push(
199
- parseFloat(a[1]),
200
- parseFloat(a[2]),
201
- parseFloat(a[3])
202
- ), a.length >= 7 ? (B.setRGB(
203
- parseFloat(a[4]),
204
- parseFloat(a[5]),
205
- parseFloat(a[6])
206
- ).convertSRGBToLinear(), s.colors.push(B.r, B.g, B.b)) : s.colors.push(void 0, void 0, void 0);
207
- break;
208
- case "vn":
209
- s.normals.push(
210
- parseFloat(a[1]),
211
- parseFloat(a[2]),
212
- parseFloat(a[3])
213
- );
214
- break;
215
- case "vt":
216
- s.uvs.push(
217
- parseFloat(a[1]),
218
- parseFloat(a[2])
219
- );
220
- break;
221
- }
222
- } else if (o === "f") {
223
- const u = n.slice(1).trim().split(Q), d = [];
224
- for (let p = 0, g = u.length; p < g; p++) {
225
- const b = u[p];
226
- if (b.length > 0) {
227
- const x = b.split("/");
228
- d.push(x);
229
- }
230
- }
231
- const m = d[0];
232
- for (let p = 1, g = d.length - 1; p < g; p++) {
233
- const b = d[p], x = d[p + 1];
234
- s.addFace(
235
- m[0],
236
- b[0],
237
- x[0],
238
- m[1],
239
- b[1],
240
- x[1],
241
- m[2],
242
- b[2],
243
- x[2]
244
- );
245
- }
246
- } else if (o === "l") {
247
- const a = n.substring(1).trim().split(" ");
248
- let u = [];
249
- const d = [];
250
- if (n.indexOf("/") === -1)
251
- u = a;
252
- else
253
- for (let m = 0, p = a.length; m < p; m++) {
254
- const g = a[m].split("/");
255
- g[0] !== "" && u.push(g[0]), g[1] !== "" && d.push(g[1]);
256
- }
257
- s.addLineGeometry(u, d);
258
- } else if (o === "p") {
259
- const u = n.slice(1).trim().split(" ");
260
- s.addPointGeometry(u);
261
- } else if ((t = he.exec(n)) !== null) {
262
- const a = (" " + t[0].slice(1).trim()).slice(1);
263
- s.startObject(a);
264
- } else if (pe.test(n))
265
- s.object.startMaterial(n.substring(7).trim(), s.materialLibraries);
266
- else if (ue.test(n))
267
- s.materialLibraries.push(n.substring(7).trim());
268
- else if (fe.test(n))
269
- console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
270
- else if (o === "s") {
271
- if (t = n.split(" "), t.length > 1) {
272
- const u = t[1].trim().toLowerCase();
273
- s.object.smooth = u !== "0" && u !== "off";
274
- } else
275
- s.object.smooth = !0;
276
- const a = s.object.currentMaterial();
277
- a && (a.smooth = s.object.smooth);
278
- } else {
279
- if (n === "\0") continue;
280
- console.warn('THREE.OBJLoader: Unexpected line: "' + n + '"');
281
- }
282
- }
283
- s.finalize();
284
- const r = new re();
285
- if (r.materialLibraries = [].concat(s.materialLibraries), !(s.objects.length === 1 && s.objects[0].geometry.vertices.length === 0) === !0)
286
- for (let c = 0, l = s.objects.length; c < l; c++) {
287
- const n = s.objects[c], o = n.geometry, a = n.materials, u = o.type === "Line", d = o.type === "Points";
288
- let m = !1;
289
- if (o.vertices.length === 0) continue;
290
- const p = new T();
291
- p.setAttribute("position", new M(o.vertices, 3)), o.normals.length > 0 && p.setAttribute("normal", new M(o.normals, 3)), o.colors.length > 0 && (m = !0, p.setAttribute("color", new M(o.colors, 3))), o.hasUVIndices === !0 && p.setAttribute("uv", new M(o.uvs, 2));
292
- const g = [];
293
- for (let x = 0, C = a.length; x < C; x++) {
294
- const v = a[x], j = v.name + "_" + v.smooth + "_" + m;
295
- let f = s.materials[j];
296
- if (this.materials !== null) {
297
- if (f = this.materials.create(v.name), u && f && !(f instanceof E)) {
298
- const w = new E();
299
- Y.prototype.copy.call(w, f), w.color.copy(f.color), f = w;
300
- } else if (d && f && !(f instanceof R)) {
301
- const w = new R({ size: 10, sizeAttenuation: !1 });
302
- Y.prototype.copy.call(w, f), w.color.copy(f.color), w.map = f.map, f = w;
303
- }
304
- }
305
- f === void 0 && (u ? f = new E() : d ? f = new R({ size: 1, sizeAttenuation: !1 }) : f = new se(), f.name = v.name, f.flatShading = !v.smooth, f.vertexColors = m, s.materials[j] = f), g.push(f);
306
- }
307
- let b;
308
- if (g.length > 1) {
309
- for (let x = 0, C = a.length; x < C; x++) {
310
- const v = a[x];
311
- p.addGroup(v.groupStart, v.groupCount, x);
312
- }
313
- u ? b = new Z(p, g) : d ? b = new H(p, g) : b = new X(p, g);
314
- } else
315
- u ? b = new Z(p, g[0]) : d ? b = new H(p, g[0]) : b = new X(p, g[0]);
316
- b.name = n.name, r.add(b);
317
- }
318
- else if (s.vertices.length > 0) {
319
- const c = new R({ size: 1, sizeAttenuation: !1 }), l = new T();
320
- l.setAttribute("position", new M(s.vertices, 3)), s.colors.length > 0 && s.colors[0] !== void 0 && (l.setAttribute("color", new M(s.colors, 3)), c.vertexColors = !0);
321
- const n = new H(l, c);
322
- r.add(n);
323
- }
324
- return r;
325
- }
326
- }
327
- class xe extends J {
328
- constructor(e) {
329
- super(e);
330
- }
331
- /**
332
- * Loads and parses a MTL asset from a URL.
333
- *
334
- * @param {String} url - URL to the MTL file.
335
- * @param {Function} [onLoad] - Callback invoked with the loaded object.
336
- * @param {Function} [onProgress] - Callback for download progress.
337
- * @param {Function} [onError] - Callback for download errors.
338
- *
339
- * @see setPath setResourcePath
340
- *
341
- * @note In order for relative texture references to resolve correctly
342
- * you must call setResourcePath() explicitly prior to load.
343
- */
344
- load(e, s, i, t) {
345
- const r = this, h = this.path === "" ? ne.extractUrlBase(e) : this.path, c = new W(this.manager);
346
- c.setPath(this.path), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(e, function(l) {
347
- try {
348
- s(r.parse(l, h));
349
- } catch (n) {
350
- t ? t(n) : console.error(n), r.manager.itemError(e);
351
- }
352
- }, i, t);
353
- }
354
- setMaterialOptions(e) {
355
- return this.materialOptions = e, this;
356
- }
357
- /**
358
- * Parses a MTL file.
359
- *
360
- * @param {String} text - Content of MTL file
361
- * @return {MaterialCreator}
362
- *
363
- * @see setPath setResourcePath
364
- *
365
- * @note In order for relative texture references to resolve correctly
366
- * you must call setResourcePath() explicitly prior to parse.
367
- */
368
- parse(e, s) {
369
- const i = e.split(`
370
- `);
371
- let t = {};
372
- const r = /\s+/, h = {};
373
- for (let l = 0; l < i.length; l++) {
374
- let n = i[l];
375
- if (n = n.trim(), n.length === 0 || n.charAt(0) === "#")
376
- continue;
377
- const o = n.indexOf(" ");
378
- let a = o >= 0 ? n.substring(0, o) : n;
379
- a = a.toLowerCase();
380
- let u = o >= 0 ? n.substring(o + 1) : "";
381
- if (u = u.trim(), a === "newmtl")
382
- t = { name: u }, h[u] = t;
383
- else if (a === "ka" || a === "kd" || a === "ks" || a === "ke") {
384
- const d = u.split(r, 3);
385
- t[a] = [parseFloat(d[0]), parseFloat(d[1]), parseFloat(d[2])];
386
- } else
387
- t[a] = u;
388
- }
389
- const c = new me(this.resourcePath || s, this.materialOptions);
390
- return c.setCrossOrigin(this.crossOrigin), c.setManager(this.manager), c.setMaterials(h), c;
391
- }
392
- }
393
- class me {
394
- constructor(e = "", s = {}) {
395
- this.baseUrl = e, this.options = s, this.materialsInfo = {}, this.materials = {}, this.materialsArray = [], this.nameLookup = {}, this.crossOrigin = "anonymous", this.side = this.options.side !== void 0 ? this.options.side : ie, this.wrap = this.options.wrap !== void 0 ? this.options.wrap : oe;
396
- }
397
- setCrossOrigin(e) {
398
- return this.crossOrigin = e, this;
399
- }
400
- setManager(e) {
401
- this.manager = e;
402
- }
403
- setMaterials(e) {
404
- this.materialsInfo = this.convert(e), this.materials = {}, this.materialsArray = [], this.nameLookup = {};
405
- }
406
- convert(e) {
407
- if (!this.options) return e;
408
- const s = {};
409
- for (const i in e) {
410
- const t = e[i], r = {};
411
- s[i] = r;
412
- for (const h in t) {
413
- let c = !0, l = t[h];
414
- const n = h.toLowerCase();
415
- switch (n) {
416
- case "kd":
417
- case "ka":
418
- case "ks":
419
- this.options && this.options.normalizeRGB && (l = [l[0] / 255, l[1] / 255, l[2] / 255]), this.options && this.options.ignoreZeroRGBs && l[0] === 0 && l[1] === 0 && l[2] === 0 && (c = !1);
420
- break;
421
- }
422
- c && (r[n] = l);
423
- }
424
- }
425
- return s;
426
- }
427
- preload() {
428
- for (const e in this.materialsInfo)
429
- this.create(e);
430
- }
431
- getIndex(e) {
432
- return this.nameLookup[e];
433
- }
434
- getAsArray() {
435
- let e = 0;
436
- for (const s in this.materialsInfo)
437
- this.materialsArray[e] = this.create(s), this.nameLookup[s] = e, e++;
438
- return this.materialsArray;
439
- }
440
- create(e) {
441
- return this.materials[e] === void 0 && this.createMaterial_(e), this.materials[e];
442
- }
443
- createMaterial_(e) {
444
- const s = this, i = this.materialsInfo[e], t = {
445
- name: e,
446
- side: this.side
447
- };
448
- function r(c, l) {
449
- return typeof l != "string" || l === "" ? "" : /^https?:\/\//i.test(l) ? l : c + l;
450
- }
451
- function h(c, l) {
452
- if (t[c]) return;
453
- const n = s.getTextureParams(l, t), o = s.loadTexture(r(s.baseUrl, n.url));
454
- o.repeat.copy(n.scale), o.offset.copy(n.offset), o.wrapS = s.wrap, o.wrapT = s.wrap, (c === "map" || c === "emissiveMap") && (o.colorSpace = ce), t[c] = o;
455
- }
456
- for (const c in i) {
457
- const l = i[c];
458
- let n;
459
- if (l !== "")
460
- switch (c.toLowerCase()) {
461
- // Ns is material specular exponent
462
- case "kd":
463
- t.color = new P().fromArray(l).convertSRGBToLinear();
464
- break;
465
- case "ks":
466
- t.specular = new P().fromArray(l).convertSRGBToLinear();
467
- break;
468
- case "ke":
469
- t.emissive = new P().fromArray(l).convertSRGBToLinear();
470
- break;
471
- case "map_kd":
472
- h("map", l);
473
- break;
474
- case "map_ks":
475
- h("specularMap", l);
476
- break;
477
- case "map_ke":
478
- h("emissiveMap", l);
479
- break;
480
- case "norm":
481
- h("normalMap", l);
482
- break;
483
- case "map_bump":
484
- case "bump":
485
- h("bumpMap", l);
486
- break;
487
- case "map_d":
488
- h("alphaMap", l), t.transparent = !0;
489
- break;
490
- case "ns":
491
- t.shininess = parseFloat(l);
492
- break;
493
- case "d":
494
- n = parseFloat(l), n < 1 && (t.opacity = n, t.transparent = !0);
495
- break;
496
- case "tr":
497
- n = parseFloat(l), this.options && this.options.invertTrProperty && (n = 1 - n), n > 0 && (t.opacity = 1 - n, t.transparent = !0);
498
- break;
499
- }
500
- }
501
- return this.materials[e] = new se(t), this.materials[e];
502
- }
503
- getTextureParams(e, s) {
504
- const i = {
505
- scale: new K(1, 1),
506
- offset: new K(0, 0)
507
- }, t = e.split(/\s+/);
508
- let r;
509
- return r = t.indexOf("-bm"), r >= 0 && (s.bumpScale = parseFloat(t[r + 1]), t.splice(r, 2)), r = t.indexOf("-s"), r >= 0 && (i.scale.set(parseFloat(t[r + 1]), parseFloat(t[r + 2])), t.splice(r, 4)), r = t.indexOf("-o"), r >= 0 && (i.offset.set(parseFloat(t[r + 1]), parseFloat(t[r + 2])), t.splice(r, 4)), i.url = t.join(" ").trim(), i;
510
- }
511
- loadTexture(e, s, i, t, r) {
512
- const h = this.manager !== void 0 ? this.manager : ae;
513
- let c = h.getHandler(e);
514
- c === null && (c = new le(h)), c.setCrossOrigin && c.setCrossOrigin(this.crossOrigin);
515
- const l = c.load(e, i, t, r);
516
- return s !== void 0 && (l.mapping = s), l;
517
- }
518
- }
519
- class we extends J {
520
- constructor(e) {
521
- super(e);
522
- }
523
- load(e, s, i, t) {
524
- const r = this, h = new W(this.manager);
525
- h.setPath(this.path), h.setResponseType("arraybuffer"), h.setRequestHeader(this.requestHeader), h.setWithCredentials(this.withCredentials), h.load(e, function(c) {
526
- try {
527
- s(r.parse(c));
528
- } catch (l) {
529
- t ? t(l) : console.error(l), r.manager.itemError(e);
530
- }
531
- }, i, t);
532
- }
533
- parse(e) {
534
- function s(n) {
535
- const o = new DataView(n), a = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8, u = o.getUint32(80, !0);
536
- if (80 + 32 / 8 + u * a === o.byteLength)
537
- return !0;
538
- const m = [115, 111, 108, 105, 100];
539
- for (let p = 0; p < 5; p++)
540
- if (i(m, o, p)) return !1;
541
- return !0;
542
- }
543
- function i(n, o, a) {
544
- for (let u = 0, d = n.length; u < d; u++)
545
- if (n[u] !== o.getUint8(a + u)) return !1;
546
- return !0;
547
- }
548
- function t(n) {
549
- const o = new DataView(n), a = o.getUint32(80, !0);
550
- let u, d, m, p = !1, g, b, x, C, v;
551
- for (let y = 0; y < 70; y++)
552
- o.getUint32(y, !1) == 1129270351 && o.getUint8(y + 4) == 82 && o.getUint8(y + 5) == 61 && (p = !0, g = new Float32Array(a * 3 * 3), b = o.getUint8(y + 6) / 255, x = o.getUint8(y + 7) / 255, C = o.getUint8(y + 8) / 255, v = o.getUint8(y + 9) / 255);
553
- const j = 84, f = 12 * 4 + 2, w = new T(), V = new Float32Array(a * 3 * 3), A = new Float32Array(a * 3 * 3), k = new P();
554
- for (let y = 0; y < a; y++) {
555
- const U = j + y * f, D = o.getFloat32(U, !0), O = o.getFloat32(U + 4, !0), z = o.getFloat32(U + 8, !0);
556
- if (p) {
557
- const L = o.getUint16(U + 48, !0);
558
- (L & 32768) === 0 ? (u = (L & 31) / 31, d = (L >> 5 & 31) / 31, m = (L >> 10 & 31) / 31) : (u = b, d = x, m = C);
559
- }
560
- for (let L = 1; L <= 3; L++) {
561
- const G = U + L * 12, _ = y * 3 * 3 + (L - 1) * 3;
562
- V[_] = o.getFloat32(G, !0), V[_ + 1] = o.getFloat32(G + 4, !0), V[_ + 2] = o.getFloat32(G + 8, !0), A[_] = D, A[_ + 1] = O, A[_ + 2] = z, p && (k.set(u, d, m).convertSRGBToLinear(), g[_] = k.r, g[_ + 1] = k.g, g[_ + 2] = k.b);
563
- }
564
- }
565
- return w.setAttribute("position", new N(V, 3)), w.setAttribute("normal", new N(A, 3)), p && (w.setAttribute("color", new N(g, 3)), w.hasColors = !0, w.alpha = v), w;
566
- }
567
- function r(n) {
568
- const o = new T(), a = /solid([\s\S]*?)endsolid/g, u = /facet([\s\S]*?)endfacet/g, d = /solid\s(.+)/;
569
- let m = 0;
570
- const p = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source, g = new RegExp("vertex" + p + p + p, "g"), b = new RegExp("normal" + p + p + p, "g"), x = [], C = [], v = [], j = new I();
571
- let f, w = 0, V = 0, A = 0;
572
- for (; (f = a.exec(n)) !== null; ) {
573
- V = A;
574
- const k = f[0], y = (f = d.exec(k)) !== null ? f[1] : "";
575
- for (v.push(y); (f = u.exec(k)) !== null; ) {
576
- let O = 0, z = 0;
577
- const L = f[0];
578
- for (; (f = b.exec(L)) !== null; )
579
- j.x = parseFloat(f[1]), j.y = parseFloat(f[2]), j.z = parseFloat(f[3]), z++;
580
- for (; (f = g.exec(L)) !== null; )
581
- x.push(parseFloat(f[1]), parseFloat(f[2]), parseFloat(f[3])), C.push(j.x, j.y, j.z), O++, A++;
582
- z !== 1 && console.error("THREE.STLLoader: Something isn't right with the normal of face number " + m), O !== 3 && console.error("THREE.STLLoader: Something isn't right with the vertices of face number " + m), m++;
583
- }
584
- const U = V, D = A - V;
585
- o.userData.groupNames = v, o.addGroup(U, D, w), w++;
586
- }
587
- return o.setAttribute("position", new M(x, 3)), o.setAttribute("normal", new M(C, 3)), o;
588
- }
589
- function h(n) {
590
- return typeof n != "string" ? new TextDecoder().decode(n) : n;
591
- }
592
- function c(n) {
593
- if (typeof n == "string") {
594
- const o = new Uint8Array(n.length);
595
- for (let a = 0; a < n.length; a++)
596
- o[a] = n.charCodeAt(a) & 255;
597
- return o.buffer || o;
598
- } else
599
- return n;
600
- }
601
- const l = c(e);
602
- return s(l) ? t(l) : r(h(e));
603
- }
604
- }
605
- export {
606
- xe as M,
607
- be as O,
608
- we as S
609
- };