lingo3d-vanilla
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
1 lines • 1.27 kB
JavaScript
;(self.webpackChunklingo3d_vanilla=self.webpackChunklingo3d_vanilla||[]).push([[195],{1195:(t,e,s)=>{s.r(e),s.d(e,{default:()=>d});s(650),s(5488);var i=s(6568),n=s(5233),o=s(7002),r=s(8753),u=s(6927),a=s(6721);function p(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const c=new WeakMap;class d extends u.Z{constructor(){super(),p(this,"bufferAttribute",new o.TlE(new Float32Array(150),3)),p(this,"curve",new o.YT8([],void 0,"catmullrom",.5));const t=new o.u9r;t.setAttribute("position",this.bufferAttribute);const e=new o.nls({color:16711680,opacity:.35}),s=new o.x12(t,e);i.Z.add(s),this.then((()=>{t.dispose(),e.dispose(),i.Z.remove(s)}))}update(){d.update(this,this)}get points(){return this.curve.points.map(n.C)}set points(t){this.curve.points=t.map(n.h),this.update()}addPoint(t){const e=(0,n.h)(t);this.curve.points.push(e),c.set(t,e),this.update()}removePoint(t){const e=c.get(t);e&&((0,a.X4)(this.curve.points,e),this.update())}}p(d,"update",(0,a.by)((t=>{const{bufferAttribute:e,curve:s}=t;if(e.needsUpdate=!0,s.points.length<2)for(let i=0;i<50;++i)e.setXYZ(i,0,0,0);else for(let i=0;i<50;++i){const t=i/49;s.getPoint(t,r.dW),e.setXYZ(i,r.dW.x,r.dW.y,r.dW.z)}}),0,"trailing"))}}]);