ss-component-new 1.2.102 → 1.2.104
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-Ba3Sw0qc.cjs +2 -0
- package/dist/MTLLoader-D1eddwj5.js +304 -0
- package/dist/OBJLoader-Ccztnb7q.cjs +5 -0
- package/dist/OBJLoader-Dbvs6FPE.js +356 -0
- package/dist/{OrbitControls-Deef-SGl.cjs → OrbitControls-4MHeioHw.cjs} +1 -1
- package/dist/{OrbitControls-C9N9rB9B.js → OrbitControls-Cjw_KOHC.js} +1 -1
- package/dist/{URDFLoader-k1y9goOI.js → URDFLoader-CoZLjCJd.js} +2 -2
- package/dist/{URDFLoader-DqwL5IDf.cjs → URDFLoader-CpWPMjVe.cjs} +1 -1
- package/dist/{animationData-DrckknP8.cjs → animationData-BnTGQKwS.cjs} +1 -1
- package/dist/{animationData-C-Xcm2AN.js → animationData-BvsjiRVj.js} +8 -8
- package/dist/array-9p7DNXvU.cjs +11 -0
- package/dist/{array-C_FEnaiV.js → array-C8iQwpTA.js} +60 -60
- package/dist/{iconfont-BMZKZ5nk.cjs → iconfont-BaAj3_06.cjs} +1 -1
- package/dist/{iconfont-DGzB0pHH.js → iconfont-Y7T2toeV.js} +2 -2
- package/dist/{index-Cgosc3NM.cjs → index-0auEZo-e.cjs} +1 -1
- package/dist/{index-CfL6w-V6.cjs → index-4qPfTE2N.cjs} +1 -1
- package/dist/{index-BMkyzagn.js → index-B7AUD4WX.js} +1 -1
- package/dist/{index-D2z5JkK9.js → index-BBN1g3xM.js} +7 -7
- package/dist/{index-BQGZ1ozI.cjs → index-BDB9UEom.cjs} +1 -1
- package/dist/{index-0N18Z5C5.js → index-BPNJJLHy.js} +4 -4
- package/dist/{index-CfU80jZm.cjs → index-BRggZNlV.cjs} +1 -1
- package/dist/{index-B9pSsYrd.js → index-BS6QHkma.js} +2 -2
- package/dist/{index-Cq0NDZct.cjs → index-BS6agsDn.cjs} +1 -1
- package/dist/{index-D1fzVbgy.js → index-BTOuU89o.js} +1 -1
- package/dist/{index-DGwxV0QX.js → index-BTtyhXXh.js} +4 -4
- package/dist/{index-CmLvxC7c.cjs → index-BVSYRcWr.cjs} +1 -1
- package/dist/{index-CY1ah--y.js → index-BZOh3_gx.js} +1 -1
- package/dist/{index-CeZjEIfb.js → index-BlU8_cQJ.js} +3 -3
- package/dist/{index-CJg-UJ16.cjs → index-BnG2m-rz.cjs} +1 -1
- package/dist/{index-BKwmIG6F.js → index-BnPMxGwT.js} +2 -2
- package/dist/{index-BwHEjRNc.cjs → index-BrrWwl7K.cjs} +1 -1
- package/dist/{index-Dgj4MOtJ.cjs → index-BsWNeABU.cjs} +1 -1
- package/dist/{index-yWY0iPZG.js → index-BzgVt31h.js} +1 -1
- package/dist/{index-Dr9mV7nz.js → index-C33Vbjs1.js} +1 -1
- package/dist/{index-BgNU4W5A.cjs → index-C5DuTAa3.cjs} +1 -1
- package/dist/index-CCn39_My.js +2863 -0
- package/dist/{index-CWajaafK.js → index-CH8UqnD0.js} +1 -1
- package/dist/{index-CEaI90sV.cjs → index-CHSyToa9.cjs} +1 -1
- package/dist/{index-D6QRXtK3.js → index-CMYctQuy.js} +1 -1
- package/dist/{index-CAfc4XMJ.cjs → index-ChPtAFHd.cjs} +1 -1
- package/dist/index-CjBkazQI.js +12769 -0
- package/dist/{index-D-xEQhDU.js → index-Cw8AEzFE.js} +17 -17
- package/dist/index-D-rphhyR.cjs +1 -0
- package/dist/{index-BbEot6J2.cjs → index-D2VZ3yKJ.cjs} +1 -1
- package/dist/{index-DqVLi4Ut.cjs → index-D32cltw8.cjs} +1 -1
- package/dist/{index-DbVhGbQH.cjs → index-D5GBBEGT.cjs} +1 -1
- package/dist/{index-KER3_EMm.cjs → index-DGgIC9Ci.cjs} +1 -1
- package/dist/{index-DkZeWAzW.js → index-DNzGnZ9b.js} +1 -1
- package/dist/{index-CIsRA9IT.js → index-DQ6IzFQ5.js} +3 -3
- package/dist/{index-D-mXs-iP.cjs → index-DWfI3sFn.cjs} +1 -1
- package/dist/{index-BJN5uiVj.cjs → index-DaFSwUQ_.cjs} +1 -1
- package/dist/{index-BXl32R28.js → index-DbMHV4lw.js} +1 -1
- package/dist/{index-CCaBHOqF.js → index-Dq7TIHg6.js} +1 -1
- package/dist/{index-DGznkzdx.cjs → index-DshZWoCO.cjs} +1 -1
- package/dist/{index-ktc30u1t.js → index-Dw0Z9Hlt.js} +1 -1
- package/dist/{index-DdJnTqJC.js → index-GDNoXUbf.js} +4 -4
- package/dist/index-TCWeRXHL.cjs +1 -0
- package/dist/{index-BEdZOeDf.cjs → index-upgflsvQ.cjs} +1 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-CUu5PEMI.cjs +37 -0
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-B1NDV_vN.js → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-sVthin7E.js} +9353 -9340
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DT7QToQt.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BiIM-5JP.js} +9128 -9164
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CTaiaM3L.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DMNlC-XU.cjs} +306 -306
- package/dist/{index.vue_vue_type_style_index_0_scoped_140f5e74_lang-OGG8JaT-.js → index.vue_vue_type_style_index_0_scoped_140f5e74_lang-BBR_syQM.js} +4 -4
- package/dist/{index.vue_vue_type_style_index_0_scoped_140f5e74_lang-Cc2tqioo.cjs → index.vue_vue_type_style_index_0_scoped_140f5e74_lang-M0a373CU.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-DcrVu9ug.js → index.vue_vue_type_style_index_1_lang-DQIl_Ai4.js} +12 -11
- package/dist/index.vue_vue_type_style_index_1_lang-D_xZOBhz.cjs +3 -0
- package/dist/loaderUtil-BlPl2UEV.cjs +1 -0
- package/dist/loaderUtil-CYV8iqHH.js +5 -0
- package/dist/{main-Do63Qi7-.js → main-BO2PfDmr.js} +3 -3
- package/dist/{main-qVwRiuvq.cjs → main-m-xpATu6.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-_2nnBp7o.cjs → threeModel-B_1d1zW-.cjs} +1 -1
- package/dist/{threeModel-CXRiVM5d.js → threeModel-Bos4VTAQ.js} +4 -4
- package/dist/threePreview-CN_nhJqo.cjs +1 -0
- package/dist/{threePreview-BZCNZS_n.js → threePreview-CXvLhKKc.js} +7 -6
- package/dist/{threeSceneView-tc-uMyBJ.js → threeSceneView-BfQdal9L.js} +8 -8
- package/dist/{threeSceneView-BQP9c5GU.cjs → threeSceneView-CjJ-2gxn.cjs} +1 -1
- package/dist/threeSceneViewForCPMPIP-BLM7In8B.cjs +5 -0
- package/dist/{threeSceneViewForCPMPIP-mFST-7QX.js → threeSceneViewForCPMPIP-RJz5SSOc.js} +172 -172
- package/dist/threeTrackPathView-4KmJ0FDf.cjs +370 -0
- package/dist/{threeTrackPathView-BA0YnxNq.js → threeTrackPathView-DMydxowA.js} +531 -540
- package/dist/{threeViewerHost-Bdte7fSM.js → threeViewerHost-Ce14fZqu.js} +2 -2
- package/dist/{threeViewerHost-DKVExhin.cjs → threeViewerHost-DPIL-3jI.cjs} +1 -1
- package/dist/{urdfTree-CyVKJK8I.cjs → urdfTree-Bg3HIC0r.cjs} +1 -1
- package/dist/{urdfTree-Bg-nhqvc.js → urdfTree-adl-NSzy.js} +1 -1
- package/dist/{workpieceTreePanel-CNiyjIbu.js → workpieceTreePanel-Ck7fxvLy.js} +28 -27
- package/dist/workpieceTreePanel-m_l0Rm29.cjs +1 -0
- package/package.json +1 -1
- package/dist/MTLLoader-Bb8Ng5B_.cjs +0 -6
- package/dist/MTLLoader-BtQkka14.js +0 -657
- package/dist/array-DWxha5Ig.cjs +0 -11
- package/dist/index-BDXJaKkD.js +0 -2849
- package/dist/index-BxL72GrI.cjs +0 -1
- package/dist/index-Ci7EmJmB.cjs +0 -1
- package/dist/index-DlM3mp_g.js +0 -12747
- package/dist/index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-DqrLieMD.cjs +0 -37
- package/dist/index.vue_vue_type_style_index_1_lang-2ELtYvZg.cjs +0 -3
- package/dist/threePreview-tsVkByR8.cjs +0 -1
- package/dist/threeSceneViewForCPMPIP-Bg8Vj2T_.cjs +0 -5
- package/dist/threeTrackPathView-Dm2u98oB.cjs +0 -370
- package/dist/workpieceTreePanel-j1lIZCg_.cjs +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const i=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DMNlC-XU.cjs");class P extends i.Loader{constructor(e){super(e)}load(e,l,u,t){const o=this,c=new i.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(n){try{l(o.parse(n))}catch(r){t?t(r):console.error(r),o.manager.itemError(e)}},u,t)}parse(e){function l(s){const a=new DataView(s),p=32/8*3+32/8*3*3+16/8,f=a.getUint32(80,!0);if(80+32/8+f*p===a.byteLength)return!0;const x=[115,111,108,105,100];for(let m=0;m<5;m++)if(u(x,a,m))return!1;return!0}function u(s,a,p){for(let f=0,g=s.length;f<g;f++)if(s[f]!==a.getUint8(p+f))return!1;return!0}function t(s){const a=new DataView(s),p=a.getUint32(80,!0);let f,g,x,m=!1,L,_,M,v,B;for(let d=0;d<70;d++)a.getUint32(d,!1)==1129270351&&a.getUint8(d+4)==82&&a.getUint8(d+5)==61&&(m=!0,L=new Float32Array(p*3*3),_=a.getUint8(d+6)/255,M=a.getUint8(d+7)/255,v=a.getUint8(d+8)/255,B=a.getUint8(d+9)/255);const k=84,h=12*4+2,F=new i.BufferGeometry,y=new Float32Array(p*3*3),C=new Float32Array(p*3*3),S=new i.Color;for(let d=0;d<p;d++){const A=k+d*h,O=a.getFloat32(A,!0),R=a.getFloat32(A+4,!0),T=a.getFloat32(A+8,!0);if(m){const w=a.getUint16(A+48,!0);(w&32768)===0?(f=(w&31)/31,g=(w>>5&31)/31,x=(w>>10&31)/31):(f=_,g=M,x=v)}for(let w=1;w<=3;w++){const U=A+w*12,b=d*3*3+(w-1)*3;y[b]=a.getFloat32(U,!0),y[b+1]=a.getFloat32(U+4,!0),y[b+2]=a.getFloat32(U+8,!0),C[b]=O,C[b+1]=R,C[b+2]=T,m&&(S.setRGB(f,g,x,i.SRGBColorSpace),L[b]=S.r,L[b+1]=S.g,L[b+2]=S.b)}}return F.setAttribute("position",new i.BufferAttribute(y,3)),F.setAttribute("normal",new i.BufferAttribute(C,3)),m&&(F.setAttribute("color",new i.BufferAttribute(L,3)),F.hasColors=!0,F.alpha=B),F}function o(s){const a=new i.BufferGeometry,p=/solid([\s\S]*?)endsolid/g,f=/facet([\s\S]*?)endfacet/g,g=/solid\s(.+)/;let x=0;const m=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,L=new RegExp("vertex"+m+m+m,"g"),_=new RegExp("normal"+m+m+m,"g"),M=[],v=[],B=[],k=new i.Vector3;let h,F=0,y=0,C=0;for(;(h=p.exec(s))!==null;){y=C;const S=h[0],d=(h=g.exec(S))!==null?h[1]:"";for(B.push(d);(h=f.exec(S))!==null;){let R=0,T=0;const w=h[0];for(;(h=_.exec(w))!==null;)k.x=parseFloat(h[1]),k.y=parseFloat(h[2]),k.z=parseFloat(h[3]),T++;for(;(h=L.exec(w))!==null;)M.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),v.push(k.x,k.y,k.z),R++,C++;T!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+x),R!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+x),x++}const A=y,O=C-y;a.userData.groupNames=B,a.addGroup(A,O,F),F++}return a.setAttribute("position",new i.Float32BufferAttribute(M,3)),a.setAttribute("normal",new i.Float32BufferAttribute(v,3)),a}function c(s){return typeof s!="string"?new TextDecoder().decode(s):s}function n(s){if(typeof s=="string"){const a=new Uint8Array(s.length);for(let p=0;p<s.length;p++)a[p]=s.charCodeAt(p)&255;return a.buffer||a}else return s}const r=n(e);return l(r)?t(r):o(c(e))}}class V extends i.Loader{constructor(e){super(e)}load(e,l,u,t){const o=this,c=this.path===""?i.LoaderUtils.extractUrlBase(e):this.path,n=new i.FileLoader(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,function(r){try{l(o.parse(r,c))}catch(s){t?t(s):console.error(s),o.manager.itemError(e)}},u,t)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,l){const u=e.split(`
|
|
2
|
+
`);let t={};const o=/\s+/,c={};for(let r=0;r<u.length;r++){let s=u[r];if(s=s.trim(),s.length===0||s.charAt(0)==="#")continue;const a=s.indexOf(" ");let p=a>=0?s.substring(0,a):s;p=p.toLowerCase();let f=a>=0?s.substring(a+1):"";if(f=f.trim(),p==="newmtl")t={name:f},c[f]=t;else if(p==="ka"||p==="kd"||p==="ks"||p==="ke"){const g=f.split(o,3);t[p]=[parseFloat(g[0]),parseFloat(g[1]),parseFloat(g[2])]}else t[p]=f}const n=new D(this.resourcePath||l,this.materialOptions);return n.setCrossOrigin(this.crossOrigin),n.setManager(this.manager),n.setMaterials(c),n}}class D{constructor(e="",l={}){this.baseUrl=e,this.options=l,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(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 l={};for(const u in e){const t=e[u],o={};l[u]=o;for(const c in t){let n=!0,r=t[c];const s=c.toLowerCase();switch(s){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(r=[r[0]/255,r[1]/255,r[2]/255]),this.options&&this.options.ignoreZeroRGBs&&r[0]===0&&r[1]===0&&r[2]===0&&(n=!1);break}n&&(o[s]=r)}}return l}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const l in this.materialsInfo)this.materialsArray[e]=this.create(l),this.nameLookup[l]=e,e++;return this.materialsArray}create(e){return this.materials[e]===void 0&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const l=this,u=this.materialsInfo[e],t={name:e,side:this.side};function o(n,r){return typeof r!="string"||r===""?"":/^https?:\/\//i.test(r)?r:n+r}function c(n,r){if(t[n])return;const s=l.getTextureParams(r,t),a=l.loadTexture(o(l.baseUrl,s.url));a.repeat.copy(s.scale),a.offset.copy(s.offset),a.wrapS=l.wrap,a.wrapT=l.wrap,(n==="map"||n==="emissiveMap")&&(a.colorSpace=i.SRGBColorSpace),t[n]=a}for(const n in u){const r=u[n];let s;if(r!=="")switch(n.toLowerCase()){case"kd":t.color=i.ColorManagement.colorSpaceToWorking(new i.Color().fromArray(r),i.SRGBColorSpace);break;case"ks":t.specular=i.ColorManagement.colorSpaceToWorking(new i.Color().fromArray(r),i.SRGBColorSpace);break;case"ke":t.emissive=i.ColorManagement.colorSpaceToWorking(new i.Color().fromArray(r),i.SRGBColorSpace);break;case"map_kd":c("map",r);break;case"map_ks":c("specularMap",r);break;case"map_ke":c("emissiveMap",r);break;case"norm":c("normalMap",r);break;case"map_bump":case"bump":c("bumpMap",r);break;case"disp":c("displacementMap",r);break;case"map_d":c("alphaMap",r),t.transparent=!0;break;case"ns":t.shininess=parseFloat(r);break;case"d":s=parseFloat(r),s<1&&(t.opacity=s,t.transparent=!0);break;case"tr":s=parseFloat(r),this.options&&this.options.invertTrProperty&&(s=1-s),s>0&&(t.opacity=1-s,t.transparent=!0);break}}return this.materials[e]=new i.MeshPhongMaterial(t),this.materials[e]}getTextureParams(e,l){const u={scale:new i.Vector2(1,1),offset:new i.Vector2(0,0)},t=e.split(/\s+/);let o;return o=t.indexOf("-bm"),o>=0&&(l.bumpScale=parseFloat(t[o+1]),t.splice(o,2)),o=t.indexOf("-mm"),o>=0&&(l.displacementBias=parseFloat(t[o+1]),l.displacementScale=parseFloat(t[o+2]),t.splice(o,3)),o=t.indexOf("-s"),o>=0&&(u.scale.set(parseFloat(t[o+1]),parseFloat(t[o+2])),t.splice(o,4)),o=t.indexOf("-o"),o>=0&&(u.offset.set(parseFloat(t[o+1]),parseFloat(t[o+2])),t.splice(o,4)),u.url=t.join(" ").trim(),u}loadTexture(e,l,u,t,o){const c=this.manager!==void 0?this.manager:i.DefaultLoadingManager;let n=c.getHandler(e);n===null&&(n=new i.TextureLoader(c)),n.setCrossOrigin&&n.setCrossOrigin(this.crossOrigin);const r=n.load(e,u,t,o);return l!==void 0&&(r.mapping=l),r}}exports.MTLLoader=V;exports.STLLoader=P;
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { aU as E, aV as z, aK as G, _ as B, a3 as U, a$ as P, X as q, aW as H, b6 as X, b2 as Z, bo as j, bI as V, ae as K, b8 as W, c0 as Y, bf as $ } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BiIM-5JP.js";
|
|
2
|
+
class N extends E {
|
|
3
|
+
/**
|
|
4
|
+
* Constructs a new STL loader.
|
|
5
|
+
*
|
|
6
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
7
|
+
*/
|
|
8
|
+
constructor(e) {
|
|
9
|
+
super(e);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Starts loading from the given URL and passes the loaded STL asset
|
|
13
|
+
* to the `onLoad()` callback.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
16
|
+
* @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.
|
|
17
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
18
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
19
|
+
*/
|
|
20
|
+
load(e, i, p, t) {
|
|
21
|
+
const n = this, c = new z(this.manager);
|
|
22
|
+
c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(e, function(o) {
|
|
23
|
+
try {
|
|
24
|
+
i(n.parse(o));
|
|
25
|
+
} catch (s) {
|
|
26
|
+
t ? t(s) : console.error(s), n.manager.itemError(e);
|
|
27
|
+
}
|
|
28
|
+
}, p, t);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Parses the given STL data and returns the resulting geometry.
|
|
32
|
+
*
|
|
33
|
+
* @param {ArrayBuffer} data - The raw STL data as an array buffer.
|
|
34
|
+
* @return {BufferGeometry} The parsed geometry.
|
|
35
|
+
*/
|
|
36
|
+
parse(e) {
|
|
37
|
+
function i(r) {
|
|
38
|
+
const a = new DataView(r), l = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8, u = a.getUint32(80, !0);
|
|
39
|
+
if (80 + 32 / 8 + u * l === a.byteLength)
|
|
40
|
+
return !0;
|
|
41
|
+
const w = [115, 111, 108, 105, 100];
|
|
42
|
+
for (let d = 0; d < 5; d++)
|
|
43
|
+
if (p(w, a, d)) return !1;
|
|
44
|
+
return !0;
|
|
45
|
+
}
|
|
46
|
+
function p(r, a, l) {
|
|
47
|
+
for (let u = 0, m = r.length; u < m; u++)
|
|
48
|
+
if (r[u] !== a.getUint8(l + u)) return !1;
|
|
49
|
+
return !0;
|
|
50
|
+
}
|
|
51
|
+
function t(r) {
|
|
52
|
+
const a = new DataView(r), l = a.getUint32(80, !0);
|
|
53
|
+
let u, m, w, d = !1, C, O, M, S, v;
|
|
54
|
+
for (let h = 0; h < 70; h++)
|
|
55
|
+
a.getUint32(h, !1) == 1129270351 && a.getUint8(h + 4) == 82 && a.getUint8(h + 5) == 61 && (d = !0, C = new Float32Array(l * 3 * 3), O = a.getUint8(h + 6) / 255, M = a.getUint8(h + 7) / 255, S = a.getUint8(h + 8) / 255, v = a.getUint8(h + 9) / 255);
|
|
56
|
+
const b = 84, f = 12 * 4 + 2, x = new G(), k = new Float32Array(l * 3 * 3), y = new Float32Array(l * 3 * 3), A = new B();
|
|
57
|
+
for (let h = 0; h < l; h++) {
|
|
58
|
+
const L = b + h * f, _ = a.getFloat32(L, !0), T = a.getFloat32(L + 4, !0), R = a.getFloat32(L + 8, !0);
|
|
59
|
+
if (d) {
|
|
60
|
+
const g = a.getUint16(L + 48, !0);
|
|
61
|
+
(g & 32768) === 0 ? (u = (g & 31) / 31, m = (g >> 5 & 31) / 31, w = (g >> 10 & 31) / 31) : (u = O, m = M, w = S);
|
|
62
|
+
}
|
|
63
|
+
for (let g = 1; g <= 3; g++) {
|
|
64
|
+
const I = L + g * 12, F = h * 3 * 3 + (g - 1) * 3;
|
|
65
|
+
k[F] = a.getFloat32(I, !0), k[F + 1] = a.getFloat32(I + 4, !0), k[F + 2] = a.getFloat32(I + 8, !0), y[F] = _, y[F + 1] = T, y[F + 2] = R, d && (A.setRGB(u, m, w, U), C[F] = A.r, C[F + 1] = A.g, C[F + 2] = A.b);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return x.setAttribute("position", new P(k, 3)), x.setAttribute("normal", new P(y, 3)), d && (x.setAttribute("color", new P(C, 3)), x.hasColors = !0, x.alpha = v), x;
|
|
69
|
+
}
|
|
70
|
+
function n(r) {
|
|
71
|
+
const a = new G(), l = /solid([\s\S]*?)endsolid/g, u = /facet([\s\S]*?)endfacet/g, m = /solid\s(.+)/;
|
|
72
|
+
let w = 0;
|
|
73
|
+
const d = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source, C = new RegExp("vertex" + d + d + d, "g"), O = new RegExp("normal" + d + d + d, "g"), M = [], S = [], v = [], b = new q();
|
|
74
|
+
let f, x = 0, k = 0, y = 0;
|
|
75
|
+
for (; (f = l.exec(r)) !== null; ) {
|
|
76
|
+
k = y;
|
|
77
|
+
const A = f[0], h = (f = m.exec(A)) !== null ? f[1] : "";
|
|
78
|
+
for (v.push(h); (f = u.exec(A)) !== null; ) {
|
|
79
|
+
let T = 0, R = 0;
|
|
80
|
+
const g = f[0];
|
|
81
|
+
for (; (f = O.exec(g)) !== null; )
|
|
82
|
+
b.x = parseFloat(f[1]), b.y = parseFloat(f[2]), b.z = parseFloat(f[3]), R++;
|
|
83
|
+
for (; (f = C.exec(g)) !== null; )
|
|
84
|
+
M.push(parseFloat(f[1]), parseFloat(f[2]), parseFloat(f[3])), S.push(b.x, b.y, b.z), T++, y++;
|
|
85
|
+
R !== 1 && console.error("THREE.STLLoader: Something isn't right with the normal of face number " + w), T !== 3 && console.error("THREE.STLLoader: Something isn't right with the vertices of face number " + w), w++;
|
|
86
|
+
}
|
|
87
|
+
const L = k, _ = y - k;
|
|
88
|
+
a.userData.groupNames = v, a.addGroup(L, _, x), x++;
|
|
89
|
+
}
|
|
90
|
+
return a.setAttribute("position", new H(M, 3)), a.setAttribute("normal", new H(S, 3)), a;
|
|
91
|
+
}
|
|
92
|
+
function c(r) {
|
|
93
|
+
return typeof r != "string" ? new TextDecoder().decode(r) : r;
|
|
94
|
+
}
|
|
95
|
+
function o(r) {
|
|
96
|
+
if (typeof r == "string") {
|
|
97
|
+
const a = new Uint8Array(r.length);
|
|
98
|
+
for (let l = 0; l < r.length; l++)
|
|
99
|
+
a[l] = r.charCodeAt(l) & 255;
|
|
100
|
+
return a.buffer || a;
|
|
101
|
+
} else
|
|
102
|
+
return r;
|
|
103
|
+
}
|
|
104
|
+
const s = o(e);
|
|
105
|
+
return i(s) ? t(s) : n(c(e));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
class ee extends E {
|
|
109
|
+
constructor(e) {
|
|
110
|
+
super(e);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Starts loading from the given URL and passes the loaded MTL asset
|
|
114
|
+
* to the `onLoad()` callback.
|
|
115
|
+
*
|
|
116
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
117
|
+
* @param {function(MaterialCreator)} onLoad - Executed when the loading process has been finished.
|
|
118
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
119
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
120
|
+
*/
|
|
121
|
+
load(e, i, p, t) {
|
|
122
|
+
const n = this, c = this.path === "" ? X.extractUrlBase(e) : this.path, o = new z(this.manager);
|
|
123
|
+
o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(s) {
|
|
124
|
+
try {
|
|
125
|
+
i(n.parse(s, c));
|
|
126
|
+
} catch (r) {
|
|
127
|
+
t ? t(r) : console.error(r), n.manager.itemError(e);
|
|
128
|
+
}
|
|
129
|
+
}, p, t);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Sets the material options.
|
|
133
|
+
*
|
|
134
|
+
* @param {MTLLoader~MaterialOptions} value - The material options.
|
|
135
|
+
* @return {MTLLoader} A reference to this loader.
|
|
136
|
+
*/
|
|
137
|
+
setMaterialOptions(e) {
|
|
138
|
+
return this.materialOptions = e, this;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Parses the given MTL data and returns the resulting material creator.
|
|
142
|
+
*
|
|
143
|
+
* @param {string} text - The raw MTL data as a string.
|
|
144
|
+
* @param {string} path - The URL base path.
|
|
145
|
+
* @return {MaterialCreator} The material creator.
|
|
146
|
+
*/
|
|
147
|
+
parse(e, i) {
|
|
148
|
+
const p = e.split(`
|
|
149
|
+
`);
|
|
150
|
+
let t = {};
|
|
151
|
+
const n = /\s+/, c = {};
|
|
152
|
+
for (let s = 0; s < p.length; s++) {
|
|
153
|
+
let r = p[s];
|
|
154
|
+
if (r = r.trim(), r.length === 0 || r.charAt(0) === "#")
|
|
155
|
+
continue;
|
|
156
|
+
const a = r.indexOf(" ");
|
|
157
|
+
let l = a >= 0 ? r.substring(0, a) : r;
|
|
158
|
+
l = l.toLowerCase();
|
|
159
|
+
let u = a >= 0 ? r.substring(a + 1) : "";
|
|
160
|
+
if (u = u.trim(), l === "newmtl")
|
|
161
|
+
t = { name: u }, c[u] = t;
|
|
162
|
+
else if (l === "ka" || l === "kd" || l === "ks" || l === "ke") {
|
|
163
|
+
const m = u.split(n, 3);
|
|
164
|
+
t[l] = [parseFloat(m[0]), parseFloat(m[1]), parseFloat(m[2])];
|
|
165
|
+
} else
|
|
166
|
+
t[l] = u;
|
|
167
|
+
}
|
|
168
|
+
const o = new J(this.resourcePath || i, this.materialOptions);
|
|
169
|
+
return o.setCrossOrigin(this.crossOrigin), o.setManager(this.manager), o.setMaterials(c), o;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
class J {
|
|
173
|
+
constructor(e = "", i = {}) {
|
|
174
|
+
this.baseUrl = e, this.options = i, this.materialsInfo = {}, this.materials = {}, this.materialsArray = [], this.nameLookup = {}, this.crossOrigin = "anonymous", this.side = this.options.side !== void 0 ? this.options.side : Z, this.wrap = this.options.wrap !== void 0 ? this.options.wrap : j;
|
|
175
|
+
}
|
|
176
|
+
setCrossOrigin(e) {
|
|
177
|
+
return this.crossOrigin = e, this;
|
|
178
|
+
}
|
|
179
|
+
setManager(e) {
|
|
180
|
+
this.manager = e;
|
|
181
|
+
}
|
|
182
|
+
setMaterials(e) {
|
|
183
|
+
this.materialsInfo = this.convert(e), this.materials = {}, this.materialsArray = [], this.nameLookup = {};
|
|
184
|
+
}
|
|
185
|
+
convert(e) {
|
|
186
|
+
if (!this.options) return e;
|
|
187
|
+
const i = {};
|
|
188
|
+
for (const p in e) {
|
|
189
|
+
const t = e[p], n = {};
|
|
190
|
+
i[p] = n;
|
|
191
|
+
for (const c in t) {
|
|
192
|
+
let o = !0, s = t[c];
|
|
193
|
+
const r = c.toLowerCase();
|
|
194
|
+
switch (r) {
|
|
195
|
+
case "kd":
|
|
196
|
+
case "ka":
|
|
197
|
+
case "ks":
|
|
198
|
+
this.options && this.options.normalizeRGB && (s = [s[0] / 255, s[1] / 255, s[2] / 255]), this.options && this.options.ignoreZeroRGBs && s[0] === 0 && s[1] === 0 && s[2] === 0 && (o = !1);
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
o && (n[r] = s);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return i;
|
|
205
|
+
}
|
|
206
|
+
preload() {
|
|
207
|
+
for (const e in this.materialsInfo)
|
|
208
|
+
this.create(e);
|
|
209
|
+
}
|
|
210
|
+
getIndex(e) {
|
|
211
|
+
return this.nameLookup[e];
|
|
212
|
+
}
|
|
213
|
+
getAsArray() {
|
|
214
|
+
let e = 0;
|
|
215
|
+
for (const i in this.materialsInfo)
|
|
216
|
+
this.materialsArray[e] = this.create(i), this.nameLookup[i] = e, e++;
|
|
217
|
+
return this.materialsArray;
|
|
218
|
+
}
|
|
219
|
+
create(e) {
|
|
220
|
+
return this.materials[e] === void 0 && this.createMaterial_(e), this.materials[e];
|
|
221
|
+
}
|
|
222
|
+
createMaterial_(e) {
|
|
223
|
+
const i = this, p = this.materialsInfo[e], t = {
|
|
224
|
+
name: e,
|
|
225
|
+
side: this.side
|
|
226
|
+
};
|
|
227
|
+
function n(o, s) {
|
|
228
|
+
return typeof s != "string" || s === "" ? "" : /^https?:\/\//i.test(s) ? s : o + s;
|
|
229
|
+
}
|
|
230
|
+
function c(o, s) {
|
|
231
|
+
if (t[o]) return;
|
|
232
|
+
const r = i.getTextureParams(s, t), a = i.loadTexture(n(i.baseUrl, r.url));
|
|
233
|
+
a.repeat.copy(r.scale), a.offset.copy(r.offset), a.wrapS = i.wrap, a.wrapT = i.wrap, (o === "map" || o === "emissiveMap") && (a.colorSpace = U), t[o] = a;
|
|
234
|
+
}
|
|
235
|
+
for (const o in p) {
|
|
236
|
+
const s = p[o];
|
|
237
|
+
let r;
|
|
238
|
+
if (s !== "")
|
|
239
|
+
switch (o.toLowerCase()) {
|
|
240
|
+
// Ns is material specular exponent
|
|
241
|
+
case "kd":
|
|
242
|
+
t.color = V.colorSpaceToWorking(new B().fromArray(s), U);
|
|
243
|
+
break;
|
|
244
|
+
case "ks":
|
|
245
|
+
t.specular = V.colorSpaceToWorking(new B().fromArray(s), U);
|
|
246
|
+
break;
|
|
247
|
+
case "ke":
|
|
248
|
+
t.emissive = V.colorSpaceToWorking(new B().fromArray(s), U);
|
|
249
|
+
break;
|
|
250
|
+
case "map_kd":
|
|
251
|
+
c("map", s);
|
|
252
|
+
break;
|
|
253
|
+
case "map_ks":
|
|
254
|
+
c("specularMap", s);
|
|
255
|
+
break;
|
|
256
|
+
case "map_ke":
|
|
257
|
+
c("emissiveMap", s);
|
|
258
|
+
break;
|
|
259
|
+
case "norm":
|
|
260
|
+
c("normalMap", s);
|
|
261
|
+
break;
|
|
262
|
+
case "map_bump":
|
|
263
|
+
case "bump":
|
|
264
|
+
c("bumpMap", s);
|
|
265
|
+
break;
|
|
266
|
+
case "disp":
|
|
267
|
+
c("displacementMap", s);
|
|
268
|
+
break;
|
|
269
|
+
case "map_d":
|
|
270
|
+
c("alphaMap", s), t.transparent = !0;
|
|
271
|
+
break;
|
|
272
|
+
case "ns":
|
|
273
|
+
t.shininess = parseFloat(s);
|
|
274
|
+
break;
|
|
275
|
+
case "d":
|
|
276
|
+
r = parseFloat(s), r < 1 && (t.opacity = r, t.transparent = !0);
|
|
277
|
+
break;
|
|
278
|
+
case "tr":
|
|
279
|
+
r = parseFloat(s), this.options && this.options.invertTrProperty && (r = 1 - r), r > 0 && (t.opacity = 1 - r, t.transparent = !0);
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return this.materials[e] = new K(t), this.materials[e];
|
|
284
|
+
}
|
|
285
|
+
getTextureParams(e, i) {
|
|
286
|
+
const p = {
|
|
287
|
+
scale: new W(1, 1),
|
|
288
|
+
offset: new W(0, 0)
|
|
289
|
+
}, t = e.split(/\s+/);
|
|
290
|
+
let n;
|
|
291
|
+
return n = t.indexOf("-bm"), n >= 0 && (i.bumpScale = parseFloat(t[n + 1]), t.splice(n, 2)), n = t.indexOf("-mm"), n >= 0 && (i.displacementBias = parseFloat(t[n + 1]), i.displacementScale = parseFloat(t[n + 2]), t.splice(n, 3)), n = t.indexOf("-s"), n >= 0 && (p.scale.set(parseFloat(t[n + 1]), parseFloat(t[n + 2])), t.splice(n, 4)), n = t.indexOf("-o"), n >= 0 && (p.offset.set(parseFloat(t[n + 1]), parseFloat(t[n + 2])), t.splice(n, 4)), p.url = t.join(" ").trim(), p;
|
|
292
|
+
}
|
|
293
|
+
loadTexture(e, i, p, t, n) {
|
|
294
|
+
const c = this.manager !== void 0 ? this.manager : Y;
|
|
295
|
+
let o = c.getHandler(e);
|
|
296
|
+
o === null && (o = new $(c)), o.setCrossOrigin && o.setCrossOrigin(this.crossOrigin);
|
|
297
|
+
const s = o.load(e, p, t, n);
|
|
298
|
+
return i !== void 0 && (s.mapping = i), s;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
export {
|
|
302
|
+
ee as M,
|
|
303
|
+
N as S
|
|
304
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";const r=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DMNlC-XU.cjs"),z=/^[og]\s*(.+)?/,B=/^mtllib /,U=/^usemtl /,S=/^usemap /,A=/\s+/,P=new r.Vector3,M=new r.Vector3,I=new r.Vector3,C=new r.Vector3,j=new r.Vector3,V=new r.Color;function D(){const L={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(s,e){if(this.object&&this.object.fromDeclaration===!1){this.object.name=s,this.object.fromDeclaration=e!==!1;return}const n=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:s||"",fromDeclaration:e!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(t,i){const l=this._finalize(!1);l&&(l.inherited||l.groupCount<=0)&&this.materials.splice(l.index,1);const m={index:this.materials.length,name:t||"",mtllib:Array.isArray(i)&&i.length>0?i[i.length-1]:"",smooth:l!==void 0?l.smooth:this.smooth,groupStart:l!==void 0?l.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(b){const a={index:typeof b=="number"?b:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return a.clone=this.clone.bind(a),a}};return this.materials.push(m),m},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){const i=this.currentMaterial();if(i&&i.groupEnd===-1&&(i.groupEnd=this.geometry.vertices.length/3,i.groupCount=i.groupEnd-i.groupStart,i.inherited=!1),t&&this.materials.length>1)for(let l=this.materials.length-1;l>=0;l--)this.materials[l].groupCount<=0&&this.materials.splice(l,1);return t&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),i}},n&&n.name&&typeof n.clone=="function"){const t=n.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(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/3)*3},parseNormalIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/3)*3},parseUVIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/2)*2},addVertex:function(s,e,n){const t=this.vertices,i=this.object.geometry.vertices;i.push(t[s+0],t[s+1],t[s+2]),i.push(t[e+0],t[e+1],t[e+2]),i.push(t[n+0],t[n+1],t[n+2])},addVertexPoint:function(s){const e=this.vertices;this.object.geometry.vertices.push(e[s+0],e[s+1],e[s+2])},addVertexLine:function(s){const e=this.vertices;this.object.geometry.vertices.push(e[s+0],e[s+1],e[s+2])},addNormal:function(s,e,n){const t=this.normals,i=this.object.geometry.normals;i.push(t[s+0],t[s+1],t[s+2]),i.push(t[e+0],t[e+1],t[e+2]),i.push(t[n+0],t[n+1],t[n+2])},addFaceNormal:function(s,e,n){const t=this.vertices,i=this.object.geometry.normals;P.fromArray(t,s),M.fromArray(t,e),I.fromArray(t,n),j.subVectors(I,M),C.subVectors(P,M),j.cross(C),j.normalize(),i.push(j.x,j.y,j.z),i.push(j.x,j.y,j.z),i.push(j.x,j.y,j.z)},addColor:function(s,e,n){const t=this.colors,i=this.object.geometry.colors;t[s]!==void 0&&i.push(t[s+0],t[s+1],t[s+2]),t[e]!==void 0&&i.push(t[e+0],t[e+1],t[e+2]),t[n]!==void 0&&i.push(t[n+0],t[n+1],t[n+2])},addUV:function(s,e,n){const t=this.uvs,i=this.object.geometry.uvs;i.push(t[s+0],t[s+1]),i.push(t[e+0],t[e+1]),i.push(t[n+0],t[n+1])},addDefaultUV:function(){const s=this.object.geometry.uvs;s.push(0,0),s.push(0,0),s.push(0,0)},addUVLine:function(s){const e=this.uvs;this.object.geometry.uvs.push(e[s+0],e[s+1])},addFace:function(s,e,n,t,i,l,m,b,a){const u=this.vertices.length;let o=this.parseVertexIndex(s,u),c=this.parseVertexIndex(e,u),f=this.parseVertexIndex(n,u);if(this.addVertex(o,c,f),this.addColor(o,c,f),m!==void 0&&m!==""){const p=this.normals.length;o=this.parseNormalIndex(m,p),c=this.parseNormalIndex(b,p),f=this.parseNormalIndex(a,p),this.addNormal(o,c,f)}else this.addFaceNormal(o,c,f);if(t!==void 0&&t!==""){const p=this.uvs.length;o=this.parseUVIndex(t,p),c=this.parseUVIndex(i,p),f=this.parseUVIndex(l,p),this.addUV(o,c,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(s){this.object.geometry.type="Points";const e=this.vertices.length;for(let n=0,t=s.length;n<t;n++){const i=this.parseVertexIndex(s[n],e);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(s,e){this.object.geometry.type="Line";const n=this.vertices.length,t=this.uvs.length;for(let i=0,l=s.length;i<l;i++)this.addVertexLine(this.parseVertexIndex(s[i],n));for(let i=0,l=e.length;i<l;i++)this.addUVLine(this.parseUVIndex(e[i],t))}};return L.startObject("",!1),L}class G extends r.Loader{constructor(s){super(s),this.materials=null}load(s,e,n,t){const i=this,l=new r.FileLoader(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(s,function(m){try{e(i.parse(m))}catch(b){t?t(b):console.error(b),i.manager.itemError(s)}},n,t)}setMaterials(s){return this.materials=s,this}parse(s){const e=new D;s.indexOf(`\r
|
|
2
|
+
`)!==-1&&(s=s.replace(/\r\n/g,`
|
|
3
|
+
`)),s.indexOf(`\\
|
|
4
|
+
`)!==-1&&(s=s.replace(/\\\n/g,""));const n=s.split(`
|
|
5
|
+
`);let t=[];for(let m=0,b=n.length;m<b;m++){const a=n[m].trimStart();if(a.length===0)continue;const u=a.charAt(0);if(u!=="#")if(u==="v"){const o=a.split(A);switch(o[0]){case"v":e.vertices.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3])),o.length>=7?(V.setRGB(parseFloat(o[4]),parseFloat(o[5]),parseFloat(o[6]),r.SRGBColorSpace),e.colors.push(V.r,V.g,V.b)):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));break;case"vt":e.uvs.push(parseFloat(o[1]),parseFloat(o[2]));break}}else if(u==="f"){const c=a.slice(1).trim().split(A),f=[];for(let h=0,g=c.length;h<g;h++){const v=c[h];if(v.length>0){const y=v.split("/");f.push(y)}}const p=f[0];for(let h=1,g=f.length-1;h<g;h++){const v=f[h],y=f[h+1];e.addFace(p[0],v[0],y[0],p[1],v[1],y[1],p[2],v[2],y[2])}}else if(u==="l"){const o=a.substring(1).trim().split(" ");let c=[];const f=[];if(a.indexOf("/")===-1)c=o;else for(let p=0,h=o.length;p<h;p++){const g=o[p].split("/");g[0]!==""&&c.push(g[0]),g[1]!==""&&f.push(g[1])}e.addLineGeometry(c,f)}else if(u==="p"){const c=a.slice(1).trim().split(" ");e.addPointGeometry(c)}else if((t=z.exec(a))!==null){const o=(" "+t[0].slice(1).trim()).slice(1);e.startObject(o)}else if(U.test(a))e.object.startMaterial(a.substring(7).trim(),e.materialLibraries);else if(B.test(a))e.materialLibraries.push(a.substring(7).trim());else if(S.test(a))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(u==="s"){if(t=a.split(" "),t.length>1){const c=t[1].trim().toLowerCase();e.object.smooth=c!=="0"&&c!=="off"}else e.object.smooth=!0;const o=e.object.currentMaterial();o&&(o.smooth=e.object.smooth)}else{if(a==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+a+'"')}}e.finalize();const i=new r.Group;if(i.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let m=0,b=e.objects.length;m<b;m++){const a=e.objects[m],u=a.geometry,o=a.materials,c=u.type==="Line",f=u.type==="Points";let p=!1;if(u.vertices.length===0)continue;const h=new r.BufferGeometry;h.setAttribute("position",new r.Float32BufferAttribute(u.vertices,3)),u.normals.length>0&&h.setAttribute("normal",new r.Float32BufferAttribute(u.normals,3)),u.colors.length>0&&(p=!0,h.setAttribute("color",new r.Float32BufferAttribute(u.colors,3))),u.hasUVIndices===!0&&h.setAttribute("uv",new r.Float32BufferAttribute(u.uvs,2));const g=[];for(let y=0,w=o.length;y<w;y++){const x=o[y],F=x.name+"_"+x.smooth+"_"+p;let d=e.materials[F];if(this.materials!==null){if(d=this.materials.create(x.name),c&&d&&!(d instanceof r.LineBasicMaterial)){const _=new r.LineBasicMaterial;r.Material.prototype.copy.call(_,d),_.color.copy(d.color),d=_}else if(f&&d&&!(d instanceof r.PointsMaterial)){const _=new r.PointsMaterial({size:10,sizeAttenuation:!1});r.Material.prototype.copy.call(_,d),_.color.copy(d.color),_.map=d.map,d=_}}d===void 0&&(c?d=new r.LineBasicMaterial:f?d=new r.PointsMaterial({size:1,sizeAttenuation:!1}):d=new r.MeshPhongMaterial,d.name=x.name,d.flatShading=!x.smooth,d.vertexColors=p,e.materials[F]=d),g.push(d)}let v;if(g.length>1){for(let y=0,w=o.length;y<w;y++){const x=o[y];h.addGroup(x.groupStart,x.groupCount,y)}c?v=new r.LineSegments(h,g):f?v=new r.Points(h,g):v=new r.Mesh(h,g)}else c?v=new r.LineSegments(h,g[0]):f?v=new r.Points(h,g[0]):v=new r.Mesh(h,g[0]);v.name=a.name,i.add(v)}else if(e.vertices.length>0){const m=new r.PointsMaterial({size:1,sizeAttenuation:!1}),b=new r.BufferGeometry;b.setAttribute("position",new r.Float32BufferAttribute(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(b.setAttribute("color",new r.Float32BufferAttribute(e.colors,3)),m.vertexColors=!0);const a=new r.Points(b,m);i.add(a)}return i}}exports.OBJLoader=G;
|