Files
fad_oa/ruoyi-ui/public/file-viewer/assets/XYZLoader-DbQZs-aZ.js

2 lines
907 B
JavaScript

import{C as e,K as t,p as n,u as r,w as i,wt as a}from"./three.module-BFsVh7r1.js";var o=class extends t{load(t,n,r,i){let a=this,o=new e(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(e){try{n(a.parse(e))}catch(e){i?i(e):console.error(e),a.manager.itemError(t)}},r,i)}parse(e){let t=e.split(`
`),o=[],s=[],c=new n;for(let e of t){if(e=e.trim(),e.charAt(0)===`#`)continue;let t=e.split(/\s+/);if(t.length===3&&(o.push(parseFloat(t[0])),o.push(parseFloat(t[1])),o.push(parseFloat(t[2]))),t.length===6){o.push(parseFloat(t[0])),o.push(parseFloat(t[1])),o.push(parseFloat(t[2]));let e=parseFloat(t[3])/255,n=parseFloat(t[4])/255,r=parseFloat(t[5])/255;c.setRGB(e,n,r,a),s.push(c.r,c.g,c.b)}}let l=new r;return l.setAttribute(`position`,new i(o,3)),s.length>0&&l.setAttribute(`color`,new i(s,3)),l}};export{o as XYZLoader};