@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
2 lines (1 loc) • 874 B
JavaScript
import{Entity as t}from"../entity.js";import{GSplatInstance as s}from"../../scene/gsplat/gsplat-instance.js";import{GSplat as a}from"../../scene/gsplat/gsplat.js";import{GSplatCompressed as e}from"../../scene/gsplat/gsplat-compressed.js";class l{constructor(t,s){this.device=void 0,this.splatData=void 0,this.splat=null,this.device=t,this.splatData=s}destroy(){var t;this.device=null,this.splatData=null,null==(t=this.splat)||t.destroy(),this.splat=null}createSplat(){return this.splat||(this.splat=this.splatData.isCompressed?new e(this.device,this.splatData):new a(this.device,this.splatData)),this.splat}instantiate(s={}){const a=this.createInstance(s),e=new t,l=e.addComponent("gsplat",{instance:a});return e.setLocalEulerAngles(0,0,180),l.customAabb=a.splat.aabb.clone(),e}createInstance(t={}){const a=this.createSplat();return new s(a,t)}}export{l as GSplatResource};