vendor: 4,357 bytes, line 1
1import{T as N}from"./tools-D01N7ptR.js";import{V as h}from"./buffer-DqKlo1ts.js";import{M as g}from"./mesh-oYr96VDh.js";import{RegisterSceneLoaderPlugin as I}from"./sceneLoader-CutT-qCn.js";import{A as b}from"./assetContainer-OIgMc4u0.js";import{c as x}from"./dynamic-B0TG-CUB.js";import"./standardMaterial-yn0ulAHp.js";import"./math.vector-C1xyPDEl.js";import"./math.scalar.functions-DkeaWAWz.js";import"./decorators.serialization-C7d7ykGG.js";import"./bufferUtils-DTRdUD8L.js";import"./math.color-CzLaKyb6.js";import"./dataBuffer-CgoqiUzT.js";import"./mesh.vertexData-Cr3zcPIw.js";import"./subMesh-UWDo5wjI.js";import"./drawWrapper-CZVk0xN-.js";import"./smartArray-CO6iJ0u5.js";import"./node-C-Iu0ALa.js";import"./math.viewport-CgkTt1RS.js";import"./sceneComponent-Dflhczui.js";import"./math.plane-Ce_75-g5.js";import"./lightConstants-B1TSTh-k.js";import"./sceneLoaderFlags-wywyb9ml.js";import"./index-DeFvE6lu.js";import"./math.axis-Ck7JfPPj.js";import"./material-CrEsrP1R.js";import"./texture-BEqhDl5Y.js";import"./baseTexture-CgAggsey.js";import"./drawWrapper.functions-Dzz0ghog.js";import"./scene-gn_hoGMy.js";import"./renderingManager-CiY2OUrf.js";import"./deviceInputEvents-BTza-zoR.js";import"./perfCounter-DusmGz8t.js";import"./instancedMesh-QYXOajBy.js";import"./light-DT53MGnW.js";import"./imageProcessing-2WziWti-.js";import"./pushMaterial-B8MG1fVH.js";import"./material.detailMapConfiguration-D1Pl6X8T.js";class p{constructor(){this.solidPattern=/solid (\S*)([\S\s]*?)endsolid[ ]*(\S*)/g,this.facetsPattern=/facet([\s\S]*?)endfacet/g,this.normalPattern=/normal[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.vertexPattern=/vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.name=x.name,this.extensions=x.extensions}importMesh(r,n,t,s,c){let i;if(typeof t!="string"){if(this._isBinary(t)){const e=new g("stlmesh",n);return this._parseBinary(e,t),c&&c.push(e),!0}t=new TextDecoder().decode(new Uint8Array(t))}for(;i=this.solidPattern.exec(t);){let e=i[1];const m=i[3];if(m&&e!=m)return N.Error("Error in STL, solid name != endsolid name"),!1;if(r&&e){if(r instanceof Array){if(!r.indexOf(e))continue}else if(e!==r)continue}e=e||"stlmesh";const a=new g(e,n);this._parseASCII(a,i[2]),c&&c.push(a)}return!0}load(r,n,t){return this.importMesh(null,r,n,t,null)}loadAssetContainer(r,n,t){const s=new b(r);return r._blockEntityCollection=!0,this.importMesh(null,r,n,t,s.meshes),r._blockEntityCollection=!1,s}_isBinary(r){const n=new DataView(r);if(n.byteLength<=80)return!1;const t=32/8*3+32/8*3*3+16/8,s=n.getUint32(80,!0);if(80+32/8+s*t===n.byteLength)return!0;const c=[115,111,108,105,100];for(let i=0;i<5;i++)if(n.getUint8(i)!==c[i])return!0;return!1}_parseBinary(r,n){const t=new DataView(n),s=t.getUint32(80,!0),c=84,i=50;let e=0;const m=new Float32Array(s*3*3),a=new Float32Array(s*3*3),l=new Uint32Array(s*3);let o=0;for(let d=0;d<s;d++){const f=c+d*i,A=t.getFloat32(f,!0),_=t.getFloat32(f+4,!0),O=t.getFloat32(f+8,!0);for(let E=1;E<=3;E++){const u=f+E*12;m[e]=t.getFloat32(u,!0),a[e]=A,p.DO_NOT_ALTER_FILE_COORDINATES?(m[e+1]=t.getFloat32(u+4,!0),m[e+2]=t.getFloat32(u+8,!0),a[e+1]=_,a[e+2]=O):(m[e+2]=t.getFloat32(u+4,!0),m[e+1]=t.getFloat32(u+8,!0),a[e+2]=_,a[e+1]=O),e+=3}p.DO_NOT_ALTER_FILE_COORDINATES?(l[o]=o,l[o+1]=o+2,l[o+2]=o+1,o+=3):(l[o]=o++,l[o]=o++,l[o]=o++)}r.setVerticesData(h.PositionKind,m),r.setVerticesData(h.NormalKind,a),r.setIndices(l),r.computeWorldMatrix(!0)}_parseASCII(r,n){const t=[],s=[],c=[];let i=0,e;for(;e=this.facetsPattern.exec(n);){const m=e[1],a=this.normalPattern.exec(m);if(this.normalPattern.lastIndex=0,!a)continue;const l=[Number(a[1]),Number(a[5]),Number(a[3])];let o;for(;o=this.vertexPattern.exec(m);)p.DO_NOT_ALTER_FILE_COORDINATES?(t.push(Number(o[1]),Number(o[3]),Number(o[5])),s.push(l[0],l[2],l[1])):(t.push(Number(o[1]),Number(o[5]),Number(o[3])),s.push(l[0],l[1],l[2]));p.DO_NOT_ALTER_FILE_COORDINATES?(c.push(i,i+2,i+1),i+=3):c.push(i++,i++,i++),this.vertexPattern.lastIndex=0}this.facetsPattern.lastIndex=0,r.setVerticesData(h.PositionKind,t),r.setVerticesData(h.NormalKind,s),r.setIndices(c),r.computeWorldMatrix(!0)}}p.DO_NOT_ALTER_FILE_COORDINATES=!1;I(new p);export{p as STLFileLoader};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.