ss-component-new 1.2.6 → 1.2.8
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/OrbitControls-BoyGapft.js +419 -0
- package/dist/OrbitControls-D1lM0xvz.cjs +1 -0
- package/dist/STLLoader-BBRISxpD.js +609 -0
- package/dist/STLLoader-KxFIlfhN.cjs +6 -0
- package/dist/{animationData-GqECkAbz.js → animationData-B7Ho3YRJ.js} +6 -6
- package/dist/{animationData-B0K2ghu6.cjs → animationData-DZb0nCA7.cjs} +1 -1
- package/dist/{array-D65aMM6H.js → array-A59WrroX.js} +1 -1
- package/dist/{array-DMPAgNcb.cjs → array-BtZq8qON.cjs} +1 -1
- package/dist/{iconfont-ljBfzBSE.js → iconfont-B9HCA4uh.js} +2 -2
- package/dist/{iconfont-t5epssvu.cjs → iconfont-CsuwJCas.cjs} +1 -1
- package/dist/{index-BOJUyAaV.cjs → index-1z9RrjZc.cjs} +1 -1
- package/dist/{index-BsM9qdbC.cjs → index-9VmYR-Tw.cjs} +1 -1
- package/dist/{index-CZaBF851.cjs → index-B1umuIRK.cjs} +1 -1
- package/dist/{index-D9oqICYV.cjs → index-B7R-snbI.cjs} +1 -1
- package/dist/{index-Bw_JtuzR.js → index-BCbxnJnH.js} +152 -152
- package/dist/{index-DWs7-g1h.cjs → index-BDRBkDJA.cjs} +1 -1
- package/dist/{index-Bs2K1FVH.js → index-BLgbZvdb.js} +2 -2
- package/dist/{index-CRrAiL5l.js → index-BTbyRzT-.js} +4 -4
- package/dist/{index-67QO-qDa.cjs → index-B_poZQZb.cjs} +1 -1
- package/dist/{index-HvKjB6_P.js → index-BbgLINMj.js} +3 -3
- package/dist/{index-D-WcrLQv.js → index-BhZsNq8s.js} +4 -4
- package/dist/{index-_66uQhcl.js → index-BmnY6J1z.js} +6 -6
- package/dist/{index-DGepdvRW.js → index-BvApH9cT.js} +2 -2
- package/dist/{index-CTkF2kl_.js → index-BwjuTBrR.js} +1 -1
- package/dist/{index-BpR7F1Fp.cjs → index-C1oE8qIa.cjs} +1 -1
- package/dist/{index-C1FOuBuy.js → index-C461j30b.js} +1 -1
- package/dist/{index-BNvpuVyw.cjs → index-C5z5UbxK.cjs} +1 -1
- package/dist/{index-D6mwkqWY.cjs → index-C7gejN5b.cjs} +1 -1
- package/dist/{index-DGi-ANHr.js → index-CCk4wLVh.js} +5 -5
- package/dist/{index--rLSLEk3.js → index-CIH_h4z2.js} +2 -2
- package/dist/{index-_uyv24Pt.cjs → index-CJK74ski.cjs} +1 -1
- package/dist/{index-FK1YYpjN.cjs → index-CSgKl9XW.cjs} +1 -1
- package/dist/{index-g4qw0jRy.js → index-CXDE4hkn.js} +6 -6
- package/dist/{index-DvpVQvAe.js → index-CX_HTfbe.js} +2 -2
- package/dist/{index-DV_ZZQBO.js → index-CYp77kPp.js} +1 -1
- package/dist/{index-CA-FC_OL.cjs → index-C_ti3XV8.cjs} +1 -1
- package/dist/{index-CePZE-QA.cjs → index-CjE91R_G.cjs} +1 -1
- package/dist/{index-tttYIzsn.cjs → index-CjI5pDiU.cjs} +1 -1
- package/dist/{index-9zEdW6xv.js → index-CwnxmCht.js} +2 -2
- package/dist/{index-8yRiF_z8.cjs → index-CxOoKysB.cjs} +1 -1
- package/dist/{index-DSchKIyh.cjs → index-CxnH4vfV.cjs} +1 -1
- package/dist/{index-DVmoPvzr.cjs → index-D8WF1ILq.cjs} +1 -1
- package/dist/{index-CArSUfnV.js → index-DEqQrElM.js} +20 -20
- package/dist/{index-DPBmAgEA.cjs → index-DF5Pi3ni.cjs} +1 -1
- package/dist/{index-B14iwpkN.cjs → index-DFGb7whK.cjs} +1 -1
- package/dist/{index-D8510-YQ.cjs → index-DGlPPiil.cjs} +1 -1
- package/dist/{index-BYUPvuvs.cjs → index-DKfCN6-m.cjs} +1 -1
- package/dist/{index-BHJ-tVLT.cjs → index-DLBS_tgM.cjs} +1 -1
- package/dist/{index-DJGsDpDp.js → index-DORLBXry.js} +3 -3
- package/dist/{index-C8UOMPgt.js → index-DR77gDZR.js} +2 -2
- package/dist/{index-BNOx3XL5.js → index-DSb6SjE3.js} +1 -1
- package/dist/{index-CbA74tCL.js → index-DTCYk2wI.js} +2 -2
- package/dist/{index-CBuqdsPh.js → index-DUeesiV8.js} +4 -4
- package/dist/{index-BMMYAqF1.js → index-DX6yycjK.js} +1 -1
- package/dist/{index-BaRkv5oc.cjs → index-DYSG1zs3.cjs} +1 -1
- package/dist/{index-CMCrQ36H.js → index-Da1wDO-s.js} +3 -3
- package/dist/{index-B7hLDNQ6.cjs → index-De5HlcQy.cjs} +1 -1
- package/dist/{index-DPWc4No_.js → index-DeBhlCUZ.js} +2 -2
- package/dist/{index-CbDu4gfZ.js → index-DgymXtI4.js} +2 -2
- package/dist/{index-C5CKSB0e.cjs → index-DrYODxS9.cjs} +1 -1
- package/dist/{index-LADv0t0E.js → index-Duk-i7rO.js} +12 -12
- package/dist/{index-mtuIEfrj.cjs → index-GmZ7sLUW.cjs} +1 -1
- package/dist/{index-DZ8a7BZ1.cjs → index-HvKkM5Lq.cjs} +1 -1
- package/dist/{index-CedgKpsz.cjs → index-PSFAyPDK.cjs} +1 -1
- package/dist/{index-8Dyi4QCI.js → index-RztQL2pV.js} +10 -10
- package/dist/{index-BEoEUXZe.js → index-UAR7Rrcy.js} +10 -10
- package/dist/{index-DcUUpSE1.cjs → index-Y6CA0bCm.cjs} +1 -1
- package/dist/{index-CShBWCYm.js → index-grNn6QlX.js} +1 -1
- package/dist/{index-87kRWJv8.cjs → index-jXcCmzjf.cjs} +1 -1
- package/dist/{index-CRj9VM12.js → index-kthhSPBL.js} +6 -6
- package/dist/{index-BsfJJu0R.js → index-oD3MoCYB.js} +6 -6
- package/dist/{index-Cm3z0Vmi.cjs → index-ydHaHhIm.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DIMJusrg.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BhLzDN6s.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BSOYWm_U.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DLUx599w.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-D2VLEzGB.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-C0nr97YM.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-D58IzjOR.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-DUQ6JlgC.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-BnNwKutS.cjs → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CQTa8bTF.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CJCvJvBM.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-DQMzwdx6.js} +13 -13
- package/dist/{index.vue_vue_type_style_index_1_lang-N-_9ZJEf.cjs → index.vue_vue_type_style_index_1_lang-BcYTED7W.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-D5Hjs-g0.js → index.vue_vue_type_style_index_1_lang-CFvcnWO4.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-H_pReDxj.cjs → index.vue_vue_type_style_index_1_lang-CfAaw5Oq.cjs} +45 -46
- package/dist/{index.vue_vue_type_style_index_1_lang-hBa3nAgx.js → index.vue_vue_type_style_index_1_lang-DLO5Vd6g.js} +5012 -5100
- package/dist/{isString--ZVOCy4V.js → isString-BNK38WbE.js} +1 -1
- package/dist/{isString-CELwppr9.cjs → isString-BmAegMGI.cjs} +1 -1
- package/dist/{main-CygliYyN.js → main-B7KvM2Mo.js} +5 -5
- package/dist/{main-C6Iw-pcH.cjs → main-BVrZ-TOJ.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +11 -11
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +12 -12
- package/dist/three-viewport-gizmo-BlxFLyPm.js +18587 -0
- package/dist/three-viewport-gizmo-CwaL5sMV.cjs +4195 -0
- package/dist/{threeLatheView-CdUoB0Te.cjs → threeLatheView-BzHB-t_G.cjs} +1 -1
- package/dist/{threeLatheView-DzpPpdDr.js → threeLatheView-arWFYuHh.js} +4 -4
- package/dist/{threeModel-BUCLJlE5.cjs → threeModel-D9BMlyjW.cjs} +1 -1
- package/dist/{threeModel-BfMMeZCc.js → threeModel-cQGFkPhn.js} +5 -5
- package/dist/threePreview-Cy7NY-gw.cjs +1 -0
- package/dist/threePreview-DKlyIJKv.js +1873 -0
- package/dist/threeSceneView-C-8QVXZL.js +1413 -0
- package/dist/threeSceneView-LorxQ4CB.cjs +5 -0
- package/dist/{threeSceneViewForCPMPIP-Bexwqkry.js → threeSceneViewForCPMPIP-DWzYs6dv.js} +27 -27
- package/dist/{threeSceneViewForCPMPIP-DwLWGNUd.cjs → threeSceneViewForCPMPIP-X9rajWCF.cjs} +2 -2
- package/dist/{threeViewerHost-CRqcYbJE.cjs → threeViewerHost-C77kS_JK.cjs} +1 -1
- package/dist/{threeViewerHost-CTjd2V1D.js → threeViewerHost-QFIxDBay.js} +4 -4
- package/dist/{useRayCaster-DN56HpNP.cjs → useRayCaster-DNSFv7lN.cjs} +1 -1
- package/dist/{useRayCaster-D0_7oJan.js → useRayCaster-DwVmFKhR.js} +12 -12
- package/package.json +1 -1
- package/dist/OrbitControls-Co_9huz0.cjs +0 -1
- package/dist/OrbitControls-DA4VpOM_.js +0 -458
- package/dist/STLLoader-DmGTF0Nv.js +0 -657
- package/dist/STLLoader-RU7KqloS.cjs +0 -6
- package/dist/three-viewport-gizmo-BHznJ6W3.js +0 -26015
- package/dist/three-viewport-gizmo-BV37JzRa.cjs +0 -4197
- package/dist/threePreview-BEqzg370.js +0 -1972
- package/dist/threePreview-C-JW_pcY.cjs +0 -1
- package/dist/threeSceneView-BTsG2QJg.cjs +0 -5
- package/dist/threeSceneView-DV5dsTZZ.js +0 -1471
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("./three-viewport-gizmo-BV37JzRa.cjs"),H=/^[og]\s*(.+)?/,N=/^mtllib /,W=/^usemtl /,q=/^usemap /,G=/\s+/,T=new i.Vector3,z=new i.Vector3,D=new i.Vector3,E=new i.Vector3,C=new i.Vector3,I=new i.Color;function J(){const B={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(t,s){if(this.object&&this.object.fromDeclaration===!1){this.object.name=t,this.object.fromDeclaration=s!==!1;return}const o=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:t||"",fromDeclaration:s!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,r){const u=this._finalize(!1);u&&(u.inherited||u.groupCount<=0)&&this.materials.splice(u.index,1);const h={index:this.materials.length,name:e||"",mtllib:Array.isArray(r)&&r.length>0?r[r.length-1]:"",smooth:u!==void 0?u.smooth:this.smooth,groupStart:u!==void 0?u.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(c){const n={index:typeof c=="number"?c: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(h),h},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){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),e&&this.materials.length>1)for(let u=this.materials.length-1;u>=0;u--)this.materials[u].groupCount<=0&&this.materials.splice(u,1);return e&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),r}},o&&o.name&&typeof o.clone=="function"){const e=o.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(t,s){const o=parseInt(t,10);return(o>=0?o-1:o+s/3)*3},parseNormalIndex:function(t,s){const o=parseInt(t,10);return(o>=0?o-1:o+s/3)*3},parseUVIndex:function(t,s){const o=parseInt(t,10);return(o>=0?o-1:o+s/2)*2},addVertex:function(t,s,o){const e=this.vertices,r=this.object.geometry.vertices;r.push(e[t+0],e[t+1],e[t+2]),r.push(e[s+0],e[s+1],e[s+2]),r.push(e[o+0],e[o+1],e[o+2])},addVertexPoint:function(t){const s=this.vertices;this.object.geometry.vertices.push(s[t+0],s[t+1],s[t+2])},addVertexLine:function(t){const s=this.vertices;this.object.geometry.vertices.push(s[t+0],s[t+1],s[t+2])},addNormal:function(t,s,o){const e=this.normals,r=this.object.geometry.normals;r.push(e[t+0],e[t+1],e[t+2]),r.push(e[s+0],e[s+1],e[s+2]),r.push(e[o+0],e[o+1],e[o+2])},addFaceNormal:function(t,s,o){const e=this.vertices,r=this.object.geometry.normals;T.fromArray(e,t),z.fromArray(e,s),D.fromArray(e,o),C.subVectors(D,z),E.subVectors(T,z),C.cross(E),C.normalize(),r.push(C.x,C.y,C.z),r.push(C.x,C.y,C.z),r.push(C.x,C.y,C.z)},addColor:function(t,s,o){const e=this.colors,r=this.object.geometry.colors;e[t]!==void 0&&r.push(e[t+0],e[t+1],e[t+2]),e[s]!==void 0&&r.push(e[s+0],e[s+1],e[s+2]),e[o]!==void 0&&r.push(e[o+0],e[o+1],e[o+2])},addUV:function(t,s,o){const e=this.uvs,r=this.object.geometry.uvs;r.push(e[t+0],e[t+1]),r.push(e[s+0],e[s+1]),r.push(e[o+0],e[o+1])},addDefaultUV:function(){const t=this.object.geometry.uvs;t.push(0,0),t.push(0,0),t.push(0,0)},addUVLine:function(t){const s=this.uvs;this.object.geometry.uvs.push(s[t+0],s[t+1])},addFace:function(t,s,o,e,r,u,h,c,n){const a=this.vertices.length;let l=this.parseVertexIndex(t,a),f=this.parseVertexIndex(s,a),m=this.parseVertexIndex(o,a);if(this.addVertex(l,f,m),this.addColor(l,f,m),h!==void 0&&h!==""){const g=this.normals.length;l=this.parseNormalIndex(h,g),f=this.parseNormalIndex(c,g),m=this.parseNormalIndex(n,g),this.addNormal(l,f,m)}else this.addFaceNormal(l,f,m);if(e!==void 0&&e!==""){const g=this.uvs.length;l=this.parseUVIndex(e,g),f=this.parseUVIndex(r,g),m=this.parseUVIndex(u,g),this.addUV(l,f,m),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(t){this.object.geometry.type="Points";const s=this.vertices.length;for(let o=0,e=t.length;o<e;o++){const r=this.parseVertexIndex(t[o],s);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(t,s){this.object.geometry.type="Line";const o=this.vertices.length,e=this.uvs.length;for(let r=0,u=t.length;r<u;r++)this.addVertexLine(this.parseVertexIndex(t[r],o));for(let r=0,u=s.length;r<u;r++)this.addUVLine(this.parseUVIndex(s[r],e))}};return B.startObject("",!1),B}class Z extends i.Loader{constructor(t){super(t),this.materials=null}load(t,s,o,e){const r=this,u=new i.FileLoader(this.manager);u.setPath(this.path),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(t,function(h){try{s(r.parse(h))}catch(c){e?e(c):console.error(c),r.manager.itemError(t)}},o,e)}setMaterials(t){return this.materials=t,this}parse(t){const s=new J;t.indexOf(`\r
|
|
2
|
-
`)!==-1&&(t=t.replace(/\r\n/g,`
|
|
3
|
-
`)),t.indexOf(`\\
|
|
4
|
-
`)!==-1&&(t=t.replace(/\\\n/g,""));const o=t.split(`
|
|
5
|
-
`);let e=[];for(let h=0,c=o.length;h<c;h++){const n=o[h].trimStart();if(n.length===0)continue;const a=n.charAt(0);if(a!=="#")if(a==="v"){const l=n.split(G);switch(l[0]){case"v":s.vertices.push(parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3])),l.length>=7?(I.setRGB(parseFloat(l[4]),parseFloat(l[5]),parseFloat(l[6]),i.SRGBColorSpace),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(l[1]),parseFloat(l[2]),parseFloat(l[3]));break;case"vt":s.uvs.push(parseFloat(l[1]),parseFloat(l[2]));break}}else if(a==="f"){const f=n.slice(1).trim().split(G),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(a==="l"){const l=n.substring(1).trim().split(" ");let f=[];const m=[];if(n.indexOf("/")===-1)f=l;else for(let g=0,p=l.length;g<p;g++){const b=l[g].split("/");b[0]!==""&&f.push(b[0]),b[1]!==""&&m.push(b[1])}s.addLineGeometry(f,m)}else if(a==="p"){const f=n.slice(1).trim().split(" ");s.addPointGeometry(f)}else if((e=H.exec(n))!==null){const l=(" "+e[0].slice(1).trim()).slice(1);s.startObject(l)}else if(W.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(q.test(n))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(a==="s"){if(e=n.split(" "),e.length>1){const f=e[1].trim().toLowerCase();s.object.smooth=f!=="0"&&f!=="off"}else s.object.smooth=!0;const l=s.object.currentMaterial();l&&(l.smooth=s.object.smooth)}else{if(n==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+n+'"')}}s.finalize();const r=new i.Group;if(r.materialLibraries=[].concat(s.materialLibraries),!(s.objects.length===1&&s.objects[0].geometry.vertices.length===0)===!0)for(let h=0,c=s.objects.length;h<c;h++){const n=s.objects[h],a=n.geometry,l=n.materials,f=a.type==="Line",m=a.type==="Points";let g=!1;if(a.vertices.length===0)continue;const p=new i.BufferGeometry;p.setAttribute("position",new i.Float32BufferAttribute(a.vertices,3)),a.normals.length>0&&p.setAttribute("normal",new i.Float32BufferAttribute(a.normals,3)),a.colors.length>0&&(g=!0,p.setAttribute("color",new i.Float32BufferAttribute(a.colors,3))),a.hasUVIndices===!0&&p.setAttribute("uv",new i.Float32BufferAttribute(a.uvs,2));const b=[];for(let w=0,j=l.length;w<j;w++){const F=l[w],M=F.name+"_"+F.smooth+"_"+g;let d=s.materials[M];if(this.materials!==null){if(d=this.materials.create(F.name),f&&d&&!(d instanceof i.LineBasicMaterial)){const y=new i.LineBasicMaterial;i.Material.prototype.copy.call(y,d),y.color.copy(d.color),d=y}else if(m&&d&&!(d instanceof i.PointsMaterial)){const y=new i.PointsMaterial({size:10,sizeAttenuation:!1});i.Material.prototype.copy.call(y,d),y.color.copy(d.color),y.map=d.map,d=y}}d===void 0&&(f?d=new i.LineBasicMaterial:m?d=new i.PointsMaterial({size:1,sizeAttenuation:!1}):d=new i.MeshPhongMaterial,d.name=F.name,d.flatShading=!F.smooth,d.vertexColors=g,s.materials[M]=d),b.push(d)}let x;if(b.length>1){for(let w=0,j=l.length;w<j;w++){const F=l[w];p.addGroup(F.groupStart,F.groupCount,w)}f?x=new i.LineSegments(p,b):m?x=new i.Points(p,b):x=new i.Mesh(p,b)}else f?x=new i.LineSegments(p,b[0]):m?x=new i.Points(p,b[0]):x=new i.Mesh(p,b[0]);x.name=n.name,r.add(x)}else if(s.vertices.length>0){const h=new i.PointsMaterial({size:1,sizeAttenuation:!1}),c=new i.BufferGeometry;c.setAttribute("position",new i.Float32BufferAttribute(s.vertices,3)),s.colors.length>0&&s.colors[0]!==void 0&&(c.setAttribute("color",new i.Float32BufferAttribute(s.colors,3)),h.vertexColors=!0);const n=new i.Points(c,h);r.add(n)}return r}}class X extends i.Loader{constructor(t){super(t)}load(t,s,o,e){const r=this,u=this.path===""?i.LoaderUtils.extractUrlBase(t):this.path,h=new i.FileLoader(this.manager);h.setPath(this.path),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(t,function(c){try{s(r.parse(c,u))}catch(n){e?e(n):console.error(n),r.manager.itemError(t)}},o,e)}setMaterialOptions(t){return this.materialOptions=t,this}parse(t,s){const o=t.split(`
|
|
6
|
-
`);let e={};const r=/\s+/,u={};for(let c=0;c<o.length;c++){let n=o[c];if(n=n.trim(),n.length===0||n.charAt(0)==="#")continue;const a=n.indexOf(" ");let l=a>=0?n.substring(0,a):n;l=l.toLowerCase();let f=a>=0?n.substring(a+1):"";if(f=f.trim(),l==="newmtl")e={name:f},u[f]=e;else if(l==="ka"||l==="kd"||l==="ks"||l==="ke"){const m=f.split(r,3);e[l]=[parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2])]}else e[l]=f}const h=new Y(this.resourcePath||s,this.materialOptions);return h.setCrossOrigin(this.crossOrigin),h.setManager(this.manager),h.setMaterials(u),h}}class Y{constructor(t="",s={}){this.baseUrl=t,this.options=s,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:i.FrontSide,this.wrap=this.options.wrap!==void 0?this.options.wrap:i.RepeatWrapping}setCrossOrigin(t){return this.crossOrigin=t,this}setManager(t){this.manager=t}setMaterials(t){this.materialsInfo=this.convert(t),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(t){if(!this.options)return t;const s={};for(const o in t){const e=t[o],r={};s[o]=r;for(const u in e){let h=!0,c=e[u];const n=u.toLowerCase();switch(n){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(c=[c[0]/255,c[1]/255,c[2]/255]),this.options&&this.options.ignoreZeroRGBs&&c[0]===0&&c[1]===0&&c[2]===0&&(h=!1);break}h&&(r[n]=c)}}return s}preload(){for(const t in this.materialsInfo)this.create(t)}getIndex(t){return this.nameLookup[t]}getAsArray(){let t=0;for(const s in this.materialsInfo)this.materialsArray[t]=this.create(s),this.nameLookup[s]=t,t++;return this.materialsArray}create(t){return this.materials[t]===void 0&&this.createMaterial_(t),this.materials[t]}createMaterial_(t){const s=this,o=this.materialsInfo[t],e={name:t,side:this.side};function r(h,c){return typeof c!="string"||c===""?"":/^https?:\/\//i.test(c)?c:h+c}function u(h,c){if(e[h])return;const n=s.getTextureParams(c,e),a=s.loadTexture(r(s.baseUrl,n.url));a.repeat.copy(n.scale),a.offset.copy(n.offset),a.wrapS=s.wrap,a.wrapT=s.wrap,(h==="map"||h==="emissiveMap")&&(a.colorSpace=i.SRGBColorSpace),e[h]=a}for(const h in o){const c=o[h];let n;if(c!=="")switch(h.toLowerCase()){case"kd":e.color=i.ColorManagement.colorSpaceToWorking(new i.Color().fromArray(c),i.SRGBColorSpace);break;case"ks":e.specular=i.ColorManagement.colorSpaceToWorking(new i.Color().fromArray(c),i.SRGBColorSpace);break;case"ke":e.emissive=i.ColorManagement.colorSpaceToWorking(new i.Color().fromArray(c),i.SRGBColorSpace);break;case"map_kd":u("map",c);break;case"map_ks":u("specularMap",c);break;case"map_ke":u("emissiveMap",c);break;case"norm":u("normalMap",c);break;case"map_bump":case"bump":u("bumpMap",c);break;case"disp":u("displacementMap",c);break;case"map_d":u("alphaMap",c),e.transparent=!0;break;case"ns":e.shininess=parseFloat(c);break;case"d":n=parseFloat(c),n<1&&(e.opacity=n,e.transparent=!0);break;case"tr":n=parseFloat(c),this.options&&this.options.invertTrProperty&&(n=1-n),n>0&&(e.opacity=1-n,e.transparent=!0);break}}return this.materials[t]=new i.MeshPhongMaterial(e),this.materials[t]}getTextureParams(t,s){const o={scale:new i.Vector2(1,1),offset:new i.Vector2(0,0)},e=t.split(/\s+/);let r;return r=e.indexOf("-bm"),r>=0&&(s.bumpScale=parseFloat(e[r+1]),e.splice(r,2)),r=e.indexOf("-mm"),r>=0&&(s.displacementBias=parseFloat(e[r+1]),s.displacementScale=parseFloat(e[r+2]),e.splice(r,3)),r=e.indexOf("-s"),r>=0&&(o.scale.set(parseFloat(e[r+1]),parseFloat(e[r+2])),e.splice(r,4)),r=e.indexOf("-o"),r>=0&&(o.offset.set(parseFloat(e[r+1]),parseFloat(e[r+2])),e.splice(r,4)),o.url=e.join(" ").trim(),o}loadTexture(t,s,o,e,r){const u=this.manager!==void 0?this.manager:i.DefaultLoadingManager;let h=u.getHandler(t);h===null&&(h=new i.TextureLoader(u)),h.setCrossOrigin&&h.setCrossOrigin(this.crossOrigin);const c=h.load(t,o,e,r);return s!==void 0&&(c.mapping=s),c}}class K extends i.Loader{constructor(t){super(t)}load(t,s,o,e){const r=this,u=new i.FileLoader(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(t,function(h){try{s(r.parse(h))}catch(c){e?e(c):console.error(c),r.manager.itemError(t)}},o,e)}parse(t){function s(n){const a=new DataView(n),l=32/8*3+32/8*3*3+16/8,f=a.getUint32(80,!0);if(80+32/8+f*l===a.byteLength)return!0;const g=[115,111,108,105,100];for(let p=0;p<5;p++)if(o(g,a,p))return!1;return!0}function o(n,a,l){for(let f=0,m=n.length;f<m;f++)if(n[f]!==a.getUint8(l+f))return!1;return!0}function e(n){const a=new DataView(n),l=a.getUint32(80,!0);let f,m,g,p=!1,b,x,w,j,F;for(let v=0;v<70;v++)a.getUint32(v,!1)==1129270351&&a.getUint8(v+4)==82&&a.getUint8(v+5)==61&&(p=!0,b=new Float32Array(l*3*3),x=a.getUint8(v+6)/255,w=a.getUint8(v+7)/255,j=a.getUint8(v+8)/255,F=a.getUint8(v+9)/255);const M=84,d=12*4+2,y=new i.BufferGeometry,V=new Float32Array(l*3*3),_=new Float32Array(l*3*3),S=new i.Color;for(let v=0;v<l;v++){const k=M+v*d,O=a.getFloat32(k,!0),U=a.getFloat32(k+4,!0),P=a.getFloat32(k+8,!0);if(p){const L=a.getUint16(k+48,!0);(L&32768)===0?(f=(L&31)/31,m=(L>>5&31)/31,g=(L>>10&31)/31):(f=x,m=w,g=j)}for(let L=1;L<=3;L++){const R=k+L*12,A=v*3*3+(L-1)*3;V[A]=a.getFloat32(R,!0),V[A+1]=a.getFloat32(R+4,!0),V[A+2]=a.getFloat32(R+8,!0),_[A]=O,_[A+1]=U,_[A+2]=P,p&&(S.setRGB(f,m,g,i.SRGBColorSpace),b[A]=S.r,b[A+1]=S.g,b[A+2]=S.b)}}return y.setAttribute("position",new i.BufferAttribute(V,3)),y.setAttribute("normal",new i.BufferAttribute(_,3)),p&&(y.setAttribute("color",new i.BufferAttribute(b,3)),y.hasColors=!0,y.alpha=F),y}function r(n){const a=new i.BufferGeometry,l=/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=[],j=[],F=[],M=new i.Vector3;let d,y=0,V=0,_=0;for(;(d=l.exec(n))!==null;){V=_;const S=d[0],v=(d=m.exec(S))!==null?d[1]:"";for(F.push(v);(d=f.exec(S))!==null;){let U=0,P=0;const L=d[0];for(;(d=x.exec(L))!==null;)M.x=parseFloat(d[1]),M.y=parseFloat(d[2]),M.z=parseFloat(d[3]),P++;for(;(d=b.exec(L))!==null;)w.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),j.push(M.x,M.y,M.z),U++,_++;P!==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=V,O=_-V;a.userData.groupNames=F,a.addGroup(k,O,y),y++}return a.setAttribute("position",new i.Float32BufferAttribute(w,3)),a.setAttribute("normal",new i.Float32BufferAttribute(j,3)),a}function u(n){return typeof n!="string"?new TextDecoder().decode(n):n}function h(n){if(typeof n=="string"){const a=new Uint8Array(n.length);for(let l=0;l<n.length;l++)a[l]=n.charCodeAt(l)&255;return a.buffer||a}else return n}const c=h(t);return s(c)?e(c):r(u(t))}}exports.MTLLoader=X;exports.OBJLoader=Z;exports.STLLoader=K;
|