+s.scale.y+s.scale.z)/3),P=C*C,I=Math.max(0,p.start),_=Math.min(x.count,p.start+p.count);for(let D=I,L=_-1;DP)continue;T.applyMatrix4(s.matrixWorld);let V=e.ray.origin.distanceTo(T);Ve.far||r.push({distance:V,point:A.clone().applyMatrix4(s.matrixWorld),object:n})}}function y(v,x,S,w,A,T,b){let M=new E,C=new E,P=new E,I=new E,_=new E;if(M.fromBufferAttribute(w,A),C.fromBufferAttribute(w,T),P.fromBufferAttribute(w,b),S.intersectTriangle(M,C,P,!1,I)===null)return null;_.copy(I),_.applyMatrix4(v.matrixWorld);let L=x.ray.origin.distanceTo(_);return Lx.far?null:{faceIndex:1,distance:L,point:_.clone(),object:v}}};var wx=new E,bs=new qn,zE=class extends ol{constructor(e){let r=new _e,i=new ss({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new We(15711266),c=new We(15711266),u=new We(2857471);h("n1","n2",l),h("n2","n4",l),h("n4","n3",l),h("n3","n1",l),h("f1","f2",l),h("f2","f4",l),h("f4","f3",l),h("f3","f1",l),h("n1","f1",l),h("n2","f2",l),h("n3","f3",l),h("n4","f4",l),h("p","n1",c),h("p","n2",c),h("p","n3",c),h("p","n4",c),h("u1","u2",u),h("u2","u3",u),h("u3","u1",u);function h(f,p,m){d(f,m),d(p,m)}function d(f,p){s.push(0,0,0),o.push(p.r,p.g,p.b),a[f]===void 0&&(a[f]=[]),a[f].push(s.length/3-1)}r.setAttribute("position",new Te(s,3)),r.setAttribute("color",new Te(o,3));super(r,i);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let e=this.geometry,r=this.pointMap,i=!0;bs.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=i?.8:1e-4;Js("n1",r,e,bs,-s,-o,a),Js("n2",r,e,bs,s,-o,a),Js("n3",r,e,bs,-s,o,a),Js("n4",r,e,bs,s,o,a);let l=a;Js("f1",r,e,bs,-s,-o,l),Js("f2",r,e,bs,s,-o,l),Js("f3",r,e,bs,-s,o,l),Js("f4",r,e,bs,s,o,l);let c=l,u=.5;Js("u1",r,e,bs,s*.7*u,o*1.1,c),Js("u2",r,e,bs,-s*.7*u,o*1.1,c),Js("u3",r,e,bs,0,o*(1.1+.9*u),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Js(n,t,e,r,i,s,o){wx.set(i,s,o).unproject(r);let a=t[n];if(a!==void 0){let l=e.getAttribute("position");for(let c=0,u=a.length;ct.is=e=>"objectHelper"in e)(Ex||(Ex={}));var Ss=(n,t)=>class extends xd(n){constructor(){super(...arguments);this.objectHelper=new t(this);this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(i,s){this.objectHelper.raycast(i,s)}showGizmos(){for(let i in this.gizmos){let s=this.gizmos[i];s instanceof fl&&(s.visible=!0)}}updateEntityBoxSize(i,s){this.objectHelper.visible&&this.geometryHelper instanceof mi?(i.setScalar(0),s.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,s)}hideGizmos(){for(let i in this.gizmos){let s=this.gizmos[i];s instanceof fl&&(s.visible=!1)}}};var Tx=790,uf=new E,GE=new E,jE=new Ke,HE=new E,Fm=new E,WE=new E,wr=class extends Ss(qn,Ax){constructor(e="",r={...Fc.defaultData,name:""}){super();this._cameraType="OrthographicCamera";this.targetOffset=Ml.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.wasMovedByUser=!1;this.wasMovedBySwitchCameraAction=!1;this.super_Entity(e,r),this.previousProjectionMatrix=new ue,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,s=this.height;this.orthoCamera=new nl(i*-.5,i*.5,s*.5,s*-.5,-5e4,1e4),this.perspCamera=new $r(45,i/s,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,r){e==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(e,r){r>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,r,i){typeof e=="number"&&(e=new E(e,r,i)),super.lookAt(e),this.getWorldPosition(uf),this.targetOffset=uf.distanceTo(e)}getTarget(e=new E){return this.getWorldDirection(GE),this.getWorldPosition(uf),GE.multiplyScalar(this.targetOffset),e.copy(uf).add(GE),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(uf),uf.distanceTo(e)}updateUp(){this.getWorldQuaternion(jE),HE.set(0,0,1).applyQuaternion(jE),Fm.copy(Tt.DEFAULT_UP),this.isUpVectorFlipped&&Fm.negate(),Fm.applyQuaternion(jE),WE.copy(Tt.DEFAULT_UP).projectOnPlane(HE),this.angleOffsetFromUp=WE.angleTo(Fm),this.angleOffsetFromUp*=WE.cross(Fm).dot(HE)>=0?1:-1}updateTransformState(e,r){let i=super.updateTransformState(e,r);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(e){let r=e.getWorldPosition(new E),s=e.getWorldDirection(new E).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToTarget(e){let i=this.getWorldDirection(new E).multiplyScalar(this.targetOffset);return{position:e.clone().sub(i),target:e}}getViewToObject(e){let r=new E,i=e.getWorldPosition(r);return this.getViewToTarget(r)}setViewplaneSize(e,r,i=!1){if(this.aspect=e/r,i){let s=e>r?this.aspect:1,o=e>r?1:this.aspect;this.left=-Tx*.5*s,this.right=Tx*.5*s,this.top=Tx*.5*(1/o),this.bottom=-Tx*.5*(1/o)}else this.left=-e*.5,this.right=e*.5,this.top=r*.5,this.bottom=-r*.5;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,r,i,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,r,i,s,o,a):this.orthoCamera.setViewOffset(e,r,i,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,r){return super.copy(e,r),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}toCameraState(e=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Dh(r,e)}updateCameraSubtype(e,r){let i=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";r.zoom!==void 0&&this.setZoom(i,r.zoom),r.near!==void 0&&this.setNear(i,r.near),r.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=r.fov)}updateState(e,r){this.updateCameraState(e,r)}updateCameraState(e,r){this.updateState_Entity(e,r),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,r,i){super.updateByPatchedOp(e,r,i),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}};var hf=new ue,SK=new ue;function qE(n){let t=!1;return n.scene.objects.traverse((e,r)=>{r.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}var Fn=class extends vs{constructor(e,r,i){super(e,r);this.data=r;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.geometry=new _e;this.onAfterRender=(e,r,i,s,o,a)=>{super.onAfterRender(e,r,i,s,o,a),this.recomputeBoolean()};this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,r,i){super.updateByPatchedOp(e,r,i),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,r=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let s=0;s0&&o.geometry.drawRange.count>0&&o.booleanMeshSetAddress!==0){hf.multiplyMatrices(o.hiddenMatrix,o.matrix);try{if(o.booleanMeshSetAddress===-1){if((o.geometry.index??o.geometry.getAttribute("position")).count/3<15e5&&(o.booleanMeshSetAddress=ms.getMeshSet(o.geometry,e===!0,r)),o.booleanMeshSetAddress===-1)return;ms.transformMeshSet(o.booleanMeshSetAddress,hf),o.booleanMatrixInvOld.copy(hf).invert(),o.booleanWasTransformed=!1}else o instanceof Fn&&o.needsTransformForDownstream===!0?(ms.transformMeshSet(o.booleanMeshSetAddress,hf),o.needsTransformForDownstream=!1):o.booleanWasTransformed===!0&&(ms.transformMeshSet(o.booleanMeshSetAddress,SK.multiplyMatrices(hf,o.booleanMatrixInvOld)),o.booleanMatrixInvOld.copy(hf).invert(),o.booleanWasTransformed=!1)}catch(a){console.error(a),o.booleanMeshSetAddress=0,o.geometry.userData.booleanOperationDidFail=!0;continue}ms.hasOpenEdges(o.booleanMeshSetAddress)===!1||s===this.children.length-1&&this.booleanOp===2?(this.meshSetAddresses.push(o.booleanMeshSetAddress),o.geometry.userData.booleanOperationDidFail=!1):o.geometry.userData.booleanOperationDidFail="openEdges"}}if(this.meshSetAddresses.length===0){this.geometry.setAttribute("position",new Te([],0)),this.geometry.setDrawRange(0,0);return}if(e===!0)return ms.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new _e,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=ms.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(s){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(s)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,of(this),af(this)}dispose(){super.dispose(),this.geometry.dispose()}};var Mx;(t=>{function n(e){return yt.is(e)&&e instanceof hl}t.is=n})(Mx||(Mx={}));var df=(n,t)=>class extends Ss(n,t){updateState_Light(r,i){this.updateState_Entity(r,i),r.color!==void 0&&(this.color=i.shared.color(r.color)),r.intensity!==void 0&&(this.intensity=r.intensity),r.depth!==void 0&&(this.shadow.camera.far=r.depth,this.shadow.needsUpdate=!0),r.shadows!==void 0&&(this.castShadow=r.shadows)}};var cn=n=>n instanceof mr,En=n=>n!==null&&n instanceof Fn,B3=n=>n instanceof wr,N3=n=>Mx.is(n),Vm=n=>Ex.is(n);var wK=new E(1,1,1),F3=new E,AK=new E,V3=new Ke,ws=class extends Uo(Ry){constructor(e,r=15){super(r);this.object=e;this.dummy=new sn;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,r){zo(this.object,ws.geometryHelper,e,r,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(F3,V3,AK),this.matrix.compose(F3,V3,wK),super.updateMatrixWorld(e)}updateWorldMatrix(e,r){}};var As=class extends Ss(sn,ws){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}};var Kl=class extends Ss(sn,ws){constructor(e,r,i){super();this.super_Entity(e,r),this.context=i,this.objectHelper.update()}updateState(e,r){this.updateState_Entity(e,r)}};var W3={RED:0,GREEN:1,BLUE:2,ALPHA:3};var km="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";var EK=`#ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif uniform lowp sampler2D cocBuffer;uniform vec2 texelSize;uniform float scale;uniform vec4 kernel64[32];varying vec2 vUv;void main(){ #ifdef FOREGROUND vec2 CoCNearFar=texture2D(cocBuffer,vUv).rg;float CoC=CoCNearFar.r*scale; #else float CoC=texture2D(cocBuffer,vUv).g*scale; #endif if(CoC==0.0){gl_FragColor=texture2D(inputBuffer,vUv);}else{ #ifdef FOREGROUND vec2 step=texelSize*max(CoC,CoCNearFar.g*scale); #else vec2 step=texelSize*CoC; #endif vec4 acc=vec4(0.0);for(int i=0;i<32;++i){vec4 kernel=kernel64[i];vec2 uv=step*kernel.xy+vUv;acc+=texture2D(inputBuffer,uv);uv=step*kernel.zw+vUv;acc+=texture2D(inputBuffer,uv);}gl_FragColor=acc/64.0;}}`,Cx=class extends it{constructor(n=!1,t=!1){super({name:"BokehMaterial",defines:{PASS:n?"2":"1"},uniforms:{kernel64:new le(null),kernel16:new le(null),inputBuffer:new le(null),cocBuffer:new le(null),texelSize:new le(new k),scale:new le(1)},blending:$t,depthWrite:!1,depthTest:!1,fragmentShader:EK,vertexShader:km}),this.toneMapped=!1,t&&(this.defines.FOREGROUND="1"),this.generateKernel()}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}set cocBuffer(n){this.uniforms.cocBuffer.value=n}setCoCBuffer(n){this.uniforms.cocBuffer.value=n}get scale(){return this.uniforms.scale.value}set scale(n){this.uniforms.scale.value=n}getScale(n){return this.uniforms.scale.value=n}setScale(n){this.uniforms.scale.value=n}generateKernel(){let n=2.39996323,t=new Float32Array(128),e=new Float32Array(32),r=0,i=0;for(let a=0;a<80;++a){let l=a*n,c=Math.sqrt(a)/Math.sqrt(80),u=c*Math.cos(l),h=c*Math.sin(l);a%5===0?(e[i++]=u,e[i++]=h):(t[r++]=u,t[r++]=h)}let s=[],o=[];for(let a=0;a<128;)s.push(new Ze(t[a++],t[a++],t[a++],t[a++]));for(let a=0;a<32;)o.push(new Ze(e[a++],e[a++],e[a++],e[a++]));this.uniforms.kernel64.value=s,this.uniforms.kernel16.value=o}setTexelSize(n,t){this.uniforms.texelSize.value.set(n,t)}setSize(n,t){this.uniforms.texelSize.value.set(1/n,1/t)}};function k3(n,t,e){return n*(t-e)-t}function ZE(n,t,e){return Math.min(Math.max((n+t)/(t-e),0),1)}var TK=`#include #include #ifdef GL_FRAGMENT_PRECISION_HIGH uniform highp sampler2D depthBuffer; #else uniform mediump sampler2D depthBuffer; #endif uniform float focusDistance;uniform float focusRange;uniform float cameraNear;uniform float cameraFar;varying vec2 vUv;float readDepth(const in vec2 uv){ #if DEPTH_PACKING == 3201 return unpackRGBAToDepth(texture2D(depthBuffer,uv)); #else return texture2D(depthBuffer,uv).r; #endif }void main(){float depth=readDepth(vUv); #ifdef PERSPECTIVE_CAMERA float viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);float linearDepth=viewZToOrthographicDepth(viewZ,cameraNear,cameraFar); #else float linearDepth=depth; #endif float signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focusRange,abs(signedDistance));gl_FragColor.rg=magnitude*vec2(step(signedDistance,0.0),step(0.0,signedDistance));}`,MK=class extends it{constructor(n){super({name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new le(null),focusDistance:new le(0),focusRange:new le(0),cameraNear:new le(.3),cameraFar:new le(1e3)},blending:$t,depthWrite:!1,depthTest:!1,fragmentShader:TK,vertexShader:km}),this.toneMapped=!1,this.uniforms.focalLength=this.uniforms.focusRange,this.adoptCameraSettings(n)}get near(){return this.uniforms.cameraNear.value}get far(){return this.uniforms.cameraFar.value}set depthBuffer(n){this.uniforms.depthBuffer.value=n}set depthPacking(n){this.defines.DEPTH_PACKING=n.toFixed(0),this.needsUpdate=!0}setDepthBuffer(n,t=Bi){this.depthBuffer=n,this.depthPacking=t}get focusDistance(){return this.uniforms.focusDistance.value}set focusDistance(n){this.uniforms.focusDistance.value=n}get worldFocusDistance(){return-k3(this.focusDistance,this.near,this.far)}set worldFocusDistance(n){this.focusDistance=ZE(-n,this.near,this.far)}getFocusDistance(n){this.uniforms.focusDistance.value=n}setFocusDistance(n){this.uniforms.focusDistance.value=n}get focalLength(){return this.focusRange}set focalLength(n){this.focusRange=n}get focusRange(){return this.uniforms.focusRange.value}set focusRange(n){this.uniforms.focusRange.value=n}get worldFocusRange(){return-k3(this.focusRange,this.near,this.far)}set worldFocusRange(n){this.focusRange=ZE(-n,this.near,this.far)}getFocalLength(n){return this.focusRange}setFocalLength(n){this.focusRange=n}adoptCameraSettings(n){n&&(this.uniforms.cameraNear.value=n.near,this.uniforms.cameraFar.value=n.far,n instanceof $r?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},CK=`#include #include #ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25; #include #include }`,PK="uniform vec2 texelSize;uniform vec2 halfTexelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize*vec2(kernel)+halfTexelSize)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}",U3=class extends it{constructor(n=new k){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new le(null),texelSize:new le(new k),halfTexelSize:new le(new k),kernel:new le(0),scale:new le(1)},blending:$t,depthWrite:!1,depthTest:!1,fragmentShader:CK,vertexShader:PK}),this.toneMapped=!1,this.setTexelSize(n.x,n.y)}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.inputBuffer=n}get scale(){return this.uniforms.scale.value}set scale(n){this.uniforms.scale.value=n}getScale(){return this.uniforms.scale.value}setScale(n){this.uniforms.scale.value=n}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(n){this.uniforms.kernel.value=n}setKernel(n){this.kernel=n}setTexelSize(n,t){this.uniforms.texelSize.value.set(n,t),this.uniforms.halfTexelSize.value.set(n,t).multiplyScalar(.5)}setSize(n,t){let e=this.uniforms;e.texelSize.value.set(1/n,1/t),e.halfTexelSize.value.copy(e.texelSize.value).multiplyScalar(.5)}},_K=`#ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel; #include }`,IK=class extends it{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new le(null),opacity:new le(1)},blending:$t,depthWrite:!1,depthTest:!1,fragmentShader:_K,vertexShader:km}),this.toneMapped=!1}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}getOpacity(n){return this.uniforms.opacity.value}setOpacity(n){this.uniforms.opacity.value=n}};var DK=`varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1; #if THREE_REVISION < 143 #define luminance(v) linearToRelativeLuminance(v) #endif #if EDGE_DETECTION_MODE != 0 varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5; #endif #if EDGE_DETECTION_MODE == 1 #include #endif #if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1 #ifdef GL_FRAGMENT_PRECISION_HIGH uniform highp sampler2D depthBuffer; #else uniform mediump sampler2D depthBuffer; #endif float readDepth(const in vec2 uv){ #if DEPTH_PACKING == 3201 return unpackRGBAToDepth(texture2D(depthBuffer,uv)); #else return texture2D(depthBuffer,uv).r; #endif }vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);} #elif PREDICATION_MODE == 2 uniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);} #endif #if PREDICATION_MODE != 0 vec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);} #endif #if EDGE_DETECTION_MODE != 0 uniform sampler2D inputBuffer; #endif void main(){ #if EDGE_DETECTION_MODE == 0 const vec2 threshold=vec2(DEPTH_THRESHOLD); #elif PREDICATION_MODE != 0 vec2 threshold=calculatePredicatedThreshold(); #else const vec2 threshold=vec2(EDGE_THRESHOLD); #endif #if EDGE_DETECTION_MODE == 0 vec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0); #elif EDGE_DETECTION_MODE == 1 float l=luminance(texture2D(inputBuffer,vUv).rgb);float lLeft=luminance(texture2D(inputBuffer,vUv0).rgb);float lTop=luminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=luminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=luminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=luminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=luminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0); #elif EDGE_DETECTION_MODE == 2 vec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0); #endif }`,OK=`uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1; #if EDGE_DETECTION_MODE != 0 varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5; #endif void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0); #if EDGE_DETECTION_MODE != 0 vUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0); #endif gl_Position=vec4(position.xy,1.0,1.0);}`,ff={DEPTH:0,LUMA:1,COLOR:2},RK={DISABLED:0,DEPTH:1,CUSTOM:2},LK=class extends it{constructor(n=new k,t=ff.COLOR){super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:ha.replace(/\D+/g,""),LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new le(null),depthBuffer:new le(null),predicationBuffer:new le(null),texelSize:new le(n)},blending:$t,depthWrite:!1,depthTest:!1,fragmentShader:DK,vertexShader:OK}),this.toneMapped=!1,this.edgeDetectionMode=t}set depthBuffer(n){this.uniforms.depthBuffer.value=n}set depthPacking(n){this.defines.DEPTH_PACKING=n.toFixed(0),this.needsUpdate=!0}setDepthBuffer(n,t=Bi){this.depthBuffer=n,this.depthPacking=t}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(n){this.defines.EDGE_DETECTION_MODE=n.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(n){this.edgeDetectionMode=n}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(n){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=n.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(n){this.localContrastAdaptationFactor=n}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(n){this.defines.EDGE_THRESHOLD=n.toFixed("6"),this.defines.DEPTH_THRESHOLD=(n*.1).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(n){this.edgeDetectionThreshold=n}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(n){this.defines.PREDICATION_MODE=n.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(n){this.predicationMode=n}set predicationBuffer(n){this.uniforms.predicationBuffer.value=n}setPredicationBuffer(n){this.uniforms.predicationBuffer.value=n}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(n){this.defines.PREDICATION_THRESHOLD=n.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(n){this.predicationThreshold=n}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(n){this.defines.PREDICATION_SCALE=n.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(n){this.predicationScale=n}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(n){this.defines.PREDICATION_STRENGTH=n.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(n){this.predicationStrength=n}setSize(n,t){this.uniforms.texelSize.value.set(1/n,1/t)}},BK=`#include #include #include #define packFloatToRGBA(v) packDepthToRGBA(v) #define unpackRGBAToFloat(v) unpackRGBAToDepth(v) #ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif #ifdef GL_FRAGMENT_PRECISION_HIGH uniform highp sampler2D depthBuffer; #else uniform mediump sampler2D depthBuffer; #endif uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv; #if THREE_REVISION < 143 #define luminance(v) linearToRelativeLuminance(v) #endif #if THREE_REVISION >= 137 vec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);} #endif float readDepth(const in vec2 uv){ #if DEPTH_PACKING == 3201 return unpackRGBAToDepth(texture2D(depthBuffer,uv)); #else return texture2D(depthBuffer,uv).r; #endif }float getViewZ(const in float depth){ #ifdef PERSPECTIVE_CAMERA return perspectiveDepthToViewZ(depth,cameraNear,cameraFar); #else return orthographicDepthToViewZ(depth,cameraNear,cameraFar); #endif }FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0; #ifdef ENCODE_OUTPUT #include #endif #include }`,NK="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEADvoid main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORTgl_Position=vec4(position.xy,1.0,1.0);}",$s={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},JE=class extends it{constructor(n,t,e,r,i=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:ha.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new le(null),depthBuffer:new le(null),resolution:new le(new k),texelSize:new le(new k),cameraNear:new le(.3),cameraFar:new le(1e3),aspect:new le(1),time:new le(0)},blending:$t,depthWrite:!1,depthTest:!1,dithering:i}),this.toneMapped=!1,n&&this.setShaderParts(n),t&&this.setDefines(t),e&&this.setUniforms(e),this.adoptCameraSettings(r)}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(n){this.uniforms.depthBuffer.value=n}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(n){this.defines.DEPTH_PACKING=n.toFixed(0),this.needsUpdate=!0}setDepthBuffer(n,t=Bi){this.depthBuffer=n,this.depthPacking=t}setShaderParts(n){return this.fragmentShader=BK.replace($s.FRAGMENT_HEAD,n.get($s.FRAGMENT_HEAD)).replace($s.FRAGMENT_MAIN_UV,n.get($s.FRAGMENT_MAIN_UV)).replace($s.FRAGMENT_MAIN_IMAGE,n.get($s.FRAGMENT_MAIN_IMAGE)),this.vertexShader=NK.replace($s.VERTEX_HEAD,n.get($s.VERTEX_HEAD)).replace($s.VERTEX_MAIN_SUPPORT,n.get($s.VERTEX_MAIN_SUPPORT)),this.needsUpdate=!0,this}setDefines(n){for(let t of n.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(n){for(let t of n.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(n){this.extensions={};for(let t of n)this.extensions[t]=!0;return this}get encodeOutput(){return this.defines.ENCODE_OUTPUT!==void 0}set encodeOutput(n){this.encodeOutput!==n&&(n?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(n){return this.encodeOutput}setOutputEncodingEnabled(n){this.encodeOutput=n}get time(){return this.uniforms.time.value}set time(n){this.uniforms.time.value=n}setDeltaTime(n){this.uniforms.time.value+=n}adoptCameraSettings(n){n&&(this.uniforms.cameraNear.value=n.near,this.uniforms.cameraFar.value=n.far,n instanceof $r?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(n,t){let e=this.uniforms;e.resolution.value.set(n,t),e.texelSize.value.set(1/n,1/t),e.aspect.value=n/t}static get Section(){return $s}};var FK=`#include #if THREE_REVISION < 143 #define luminance(v) linearToRelativeLuminance(v) #endif #ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif #ifdef RANGE uniform vec2 range; #elif defined(THRESHOLD) uniform float threshold;uniform float smoothing; #endif varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb); #ifdef RANGE float low=step(range.x,l);float high=step(l,range.y);l*=low*high; #elif defined(THRESHOLD) l=smoothstep(threshold,threshold+smoothing,l); #endif #ifdef COLOR gl_FragColor=vec4(texel.rgb*l,l); #else gl_FragColor=vec4(l); #endif }`,VK=class extends it{constructor(n=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:ha.replace(/\D+/g,"")},uniforms:{inputBuffer:new le(null),threshold:new le(0),smoothing:new le(1),range:new le(null)},blending:$t,depthWrite:!1,depthTest:!1,fragmentShader:FK,vertexShader:km}),this.toneMapped=!1,this.colorOutput=n,this.luminanceRange=t}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}get threshold(){return this.uniforms.threshold.value}set threshold(n){this.smoothing>0||n>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=n}getThreshold(){return this.threshold}setThreshold(n){this.threshold=n}get smoothing(){return this.uniforms.smoothing.value}set smoothing(n){this.threshold>0||n>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=n}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(n){this.smoothing=n}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(n){}get colorOutput(){return this.defines.COLOR!==void 0}set colorOutput(n){n?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(n){return this.colorOutput}setColorOutputEnabled(n){this.colorOutput=n}get useRange(){return this.luminanceRange!==null}set useRange(n){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(n){n!==null?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=n,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(n){this.luminanceRange=n}},kK=`#ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif #ifdef MASK_PRECISION_HIGH uniform mediump sampler2D maskTexture; #else uniform lowp sampler2D maskTexture; #endif #if MASK_FUNCTION != 0 uniform float strength; #endif varying vec2 vUv;void main(){ #if COLOR_CHANNEL == 0 float mask=texture2D(maskTexture,vUv).r; #elif COLOR_CHANNEL == 1 float mask=texture2D(maskTexture,vUv).g; #elif COLOR_CHANNEL == 2 float mask=texture2D(maskTexture,vUv).b; #else float mask=texture2D(maskTexture,vUv).a; #endif #if MASK_FUNCTION == 0 #ifdef INVERTED mask=step(mask,0.0); #else mask=1.0-step(mask,0.0); #endif #else mask=clamp(mask*strength,0.0,1.0); #ifdef INVERTED mask=1.0-mask; #endif #endif #if MASK_FUNCTION == 2 gl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask); #else gl_FragColor=mask*texture2D(inputBuffer,vUv); #endif }`,q3={DISCARD:0,MULTIPLY:1,MULTIPLY_RGB_SET_ALPHA:2},UK=class extends it{constructor(n=null){super({name:"MaskMaterial",uniforms:{maskTexture:new le(n),inputBuffer:new le(null),strength:new le(1)},blending:$t,depthWrite:!1,depthTest:!1,fragmentShader:kK,vertexShader:km}),this.toneMapped=!1,this.setColorChannel(W3.RED),this.setMaskFunction(q3.DISCARD)}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}set maskTexture(n){this.uniforms.maskTexture.value=n,delete this.defines.MASK_PRECISION_HIGH,n.type!==_r&&(this.defines.MASK_PRECISION_HIGH="1"),this.needsUpdate=!0}setMaskTexture(n){this.maskTexture=n}set colorChannel(n){this.defines.COLOR_CHANNEL=n.toFixed(0),this.needsUpdate=!0}setColorChannel(n){this.colorChannel=n}set maskFunction(n){this.defines.MASK_FUNCTION=n.toFixed(0),this.needsUpdate=!0}setMaskFunction(n){this.maskFunction=n}get inverted(){return this.defines.INVERTED!==void 0}set inverted(n){this.inverted&&!n?delete this.defines.INVERTED:n&&(this.defines.INVERTED="1"),this.needsUpdate=!0}isInverted(){return this.inverted}setInverted(n){this.inverted=n}get strength(){return this.uniforms.strength.value}set strength(n){this.uniforms.strength.value=n}getStrength(){return this.strength}setStrength(n){this.strength=n}};var zK=`#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize) #if __VERSION__ < 300 #define round(v) floor(v + 0.5) #endif #ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif uniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;iend&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;iend&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){ #if !defined(DISABLE_CORNER_DETECTION) vec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0); #endif }void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){ #if !defined(DISABLE_CORNER_DETECTION) vec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0); #endif }void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){ #if !defined(DISABLE_DIAG_DETECTION) weights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){ #endif vec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d); #if !defined(DISABLE_DIAG_DETECTION) }else{e.r=0.0;} #endif }if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}`,GK="uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}",jK=class extends it{constructor(n=new k,t=new k){super({name:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new le(null),searchTexture:new le(null),areaTexture:new le(null),resolution:new le(t),texelSize:new le(n)},blending:$t,depthWrite:!1,depthTest:!1,fragmentShader:zK,vertexShader:GK}),this.toneMapped=!1}set inputBuffer(n){this.uniforms.inputBuffer.value=n}setInputBuffer(n){this.uniforms.inputBuffer.value=n}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(n){this.uniforms.searchTexture.value=n}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(n){this.uniforms.areaTexture.value=n}setLookupTextures(n,t){this.searchTexture=n,this.areaTexture=t}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(n){let t=Math.min(Math.max(n,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(n){this.orthogonalSearchSteps=n}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(n){let t=Math.min(Math.max(n,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(n){this.diagonalSearchSteps=n}get diagonalDetection(){return this.defines.DISABLE_DIAG_DETECTION===void 0}set diagonalDetection(n){n?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(n){this.diagonalDetection=n}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(n){let t=Math.min(Math.max(n,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(n){this.cornerRounding=n}get cornerDetection(){return this.defines.DISABLE_CORNER_DETECTION===void 0}set cornerDetection(n){n?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(n){this.cornerDetection=n}setSize(n,t){let e=this.uniforms;e.texelSize.value.set(1/n,1/t),e.resolution.value.set(n,t)}};var HK=new qn,Ql=null;function WK(){if(Ql===null){let n=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);Ql=new _e,Ql.setAttribute!==void 0?(Ql.setAttribute("position",new Xe(n,3)),Ql.setAttribute("uv",new Xe(t,2))):(Ql.addAttribute("position",new Xe(n,3)),Ql.addAttribute("uv",new Xe(t,2)))}return Ql}var xi=class{constructor(n="Pass",t=new ei,e=HK){this.name=n,this.renderer=null,this.scene=t,this.camera=e,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(n){if(this.rtt===n){let t=this.getFullscreenMaterial();t!==null&&(t.needsUpdate=!0),this.rtt=!n}}setRenderer(n){this.renderer=n}isEnabled(){return this.enabled}setEnabled(n){this.enabled=n}get fullscreenMaterial(){return this.screen!==null?this.screen.material:null}set fullscreenMaterial(n){let t=this.screen;t!==null?t.material=n:(t=new Ut(WK(),n),t.frustumCulled=!1,this.scene===null&&(this.scene=new ei),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(n){this.fullscreenMaterial=n}getDepthTexture(){return null}setDepthTexture(n,t=Bi){}render(n,t,e,r,i){throw new Error("Render method not implemented!")}setSize(n,t){}initialize(n,t,e){}dispose(){for(let n of Object.keys(this)){let t=this[n];if(t!==null&&typeof t=="object"&&typeof t.dispose=="function"){if(t instanceof ei||t===this.renderer)continue;this[n].dispose()}}}},Um=class extends xi{constructor(n,t=!0){super("CopyPass"),this.fullscreenMaterial=new IK,this.needsSwap=!1,this.renderTarget=n,n===void 0&&(this.renderTarget=new dt(1,1,{minFilter:rt,magFilter:rt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(n){this.autoResize=n}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(n){this.autoResize=n}render(n,t,e,r,i){this.fullscreenMaterial.inputBuffer=t.texture,n.setRenderTarget(this.renderToScreen?null:this.renderTarget),n.render(this.scene,this.camera)}setSize(n,t){this.autoResize&&this.renderTarget.setSize(n,t)}initialize(n,t,e){e!==void 0&&(this.renderTarget.texture.type=e,e!==_r?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":n.outputEncoding===at&&(this.renderTarget.texture.encoding=at))}};var Y3=class extends xi{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(n,t,e,r,i){let s=n.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},YE=new We,$E=class extends xi{constructor(n=!0,t=!0,e=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=n,this.depth=t,this.stencil=e,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(n,t,e){this.color=n,this.depth=t,this.stencil=e}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(n){this.overrideClearColor=n}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(n){this.overrideClearAlpha=n}render(n,t,e,r,i){let s=this.overrideClearColor,o=this.overrideClearAlpha,a=n.getClearAlpha(),l=s!==null,c=o>=0;l?(YE.copy(n.getClearColor(YE)),n.setClearColor(s,c?o:a)):c&&n.setClearAlpha(o),n.setRenderTarget(this.renderToScreen?null:t),n.clear(this.color,this.depth,this.stencil),l?n.setClearColor(YE,a):c&&n.setClearAlpha(a)}},Zl=-1,Vn=class extends pr{constructor(n,t=Zl,e=Zl,r=1){super(),this.resizable=n,this.base=new k(1,1),this.preferred=new k(t,e),this.target=this.preferred,this.s=r}get width(){let{base:n,preferred:t,scale:e}=this,r;return t.width!==Zl?r=t.width:t.height!==Zl?r=Math.round(t.height*(n.width/Math.max(n.height,1))):r=Math.round(n.width*e),r}set width(n){this.preferredWidth=n}get height(){let{base:n,preferred:t,scale:e}=this,r;return t.height!==Zl?r=t.height:t.width!==Zl?r=Math.round(t.width/Math.max(n.width/Math.max(n.height,1),1)):r=Math.round(n.height*e),r}set height(n){this.preferredHeight=n}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(n){this.s!==n&&(this.s=n,this.preferred.setScalar(Zl),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getScale(){return this.scale}setScale(n){this.scale=n}get baseWidth(){return this.base.width}set baseWidth(n){this.base.width!==n&&(this.base.width=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getBaseWidth(){return this.base.width}setBaseWidth(n){this.base.width!==n&&(this.base.width=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}get baseHeight(){return this.base.height}set baseHeight(n){this.base.height!==n&&(this.base.height=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(n){this.baseHeight=n}setBaseSize(n,t){(this.base.width!==n||this.base.height!==t)&&(this.base.set(n,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}get preferredWidth(){return this.preferred.width}set preferredWidth(n){this.preferred.width!==n&&(this.preferred.width=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(n){this.preferredWidth=n}get preferredHeight(){return this.preferred.height}set preferredHeight(n){this.preferred.height!==n&&(this.preferred.height=n,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(n){this.preferredHeight=n}setPreferredSize(n,t){(this.preferred.width!==n||this.preferred.height!==t)&&(this.preferred.set(n,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}copy(n){this.base.set(n.getBaseWidth(),n.getBaseHeight()),this.preferred.set(n.getPreferredWidth(),n.getPreferredHeight()),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height)}static get AUTO_SIZE(){return Zl}},XE=!1,z3=class{constructor(n=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(n),this.meshCount=0,this.replaceMaterial=t=>{if(t.isMesh){let e;if(t.material.flatShading)switch(t.material.side){case fi:e=this.materialsFlatShadedDoubleSide;break;case pi:e=this.materialsFlatShadedBackSide;break;default:e=this.materialsFlatShaded;break}else switch(t.material.side){case fi:e=this.materialsDoubleSide;break;case pi:e=this.materialsBackSide;break;default:e=this.materials;break}this.originalMaterials.set(t,t.material),t.isSkinnedMesh?t.material=e[2]:t.isInstancedMesh?t.material=e[1]:t.material=e[0],++this.meshCount}}}setMaterial(n){if(this.disposeMaterials(),this.material=n,n!==null){let t=this.materials=[n.clone(),n.clone(),n.clone()];for(let e of t)e.uniforms=Object.assign({},n.uniforms),e.side=Hn;t[2].skinning=!0,this.materialsBackSide=t.map(e=>{let r=e.clone();return r.uniforms=Object.assign({},n.uniforms),r.side=pi,r}),this.materialsDoubleSide=t.map(e=>{let r=e.clone();return r.uniforms=Object.assign({},n.uniforms),r.side=fi,r}),this.materialsFlatShaded=t.map(e=>{let r=e.clone();return r.uniforms=Object.assign({},n.uniforms),r.flatShading=!0,r}),this.materialsFlatShadedBackSide=t.map(e=>{let r=e.clone();return r.uniforms=Object.assign({},n.uniforms),r.flatShading=!0,r.side=pi,r}),this.materialsFlatShadedDoubleSide=t.map(e=>{let r=e.clone();return r.uniforms=Object.assign({},n.uniforms),r.flatShading=!0,r.side=fi,r})}}render(n,t,e){let r=n.shadowMap.enabled;if(n.shadowMap.enabled=!1,XE){let i=this.originalMaterials;this.meshCount=0,t.traverse(this.replaceMaterial),n.render(t,e);for(let s of i)s[0].material=s[1];this.meshCount!==i.size&&i.clear()}else{let i=t.overrideMaterial;t.overrideMaterial=this.material,n.render(t,e),t.overrideMaterial=i}n.shadowMap.enabled=r}disposeMaterials(){if(this.material!==null){let n=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(let t of n)t.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return XE}static set workaroundEnabled(n){XE=n}},qK=class extends xi{constructor(n,t,e=null){super("RenderPass",n,t),this.needsSwap=!1,this.clearPass=new $E,this.overrideMaterialManager=e===null?null:new z3(e),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}get renderToScreen(){return super.renderToScreen}set renderToScreen(n){super.renderToScreen=n,this.clearPass.renderToScreen=n}get overrideMaterial(){let n=this.overrideMaterialManager;return n!==null?n.material:null}set overrideMaterial(n){let t=this.overrideMaterialManager;n!==null?t!==null?t.setMaterial(n):this.overrideMaterialManager=new z3(n):t!==null&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(n){this.overrideMaterial=n}get clear(){return this.clearPass.enabled}set clear(n){this.clearPass.enabled=n}getSelection(){return this.selection}setSelection(n){this.selection=n}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(n){this.ignoreBackground=n}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(n){this.skipShadowMapUpdate=n}getClearPass(){return this.clearPass}render(n,t,e,r,i){let s=this.scene,o=this.camera,a=this.selection,l=o.layers.mask,c=s.background,u=n.shadowMap.autoUpdate,h=this.renderToScreen?null:t;a!==null&&o.layers.set(a.getLayer()),this.skipShadowMapUpdate&&(n.shadowMap.autoUpdate=!1),(this.ignoreBackground||this.clearPass.overrideClearColor!==null)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(n,t),n.setRenderTarget(h),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(n,s,o):n.render(s,o),o.layers.mask=l,s.background=c,n.shadowMap.autoUpdate=u}},eT=class extends xi{constructor(n,t,{resolutionScale:e=1,width:r=Vn.AUTO_SIZE,height:i=Vn.AUTO_SIZE,renderTarget:s}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new qK(n,t,new yp({depthPacking:zw}));let o=this.renderPass;o.skipShadowMapUpdate=!0,o.ignoreBackground=!0;let a=o.getClearPass();a.overrideClearColor=new We(16777215),a.overrideClearAlpha=1,this.renderTarget=s,this.renderTarget===void 0&&(this.renderTarget=new dt(1,1,{minFilter:Vt,magFilter:Vt,stencilBuffer:!1}),this.renderTarget.texture.name="DepthPass.Target");let l=this.resolution=new Vn(this,r,i,e);l.addEventListener("change",c=>this.setSize(l.baseWidth,l.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(n){this.resolution.scale=n}render(n,t,e,r,i){let s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(n,s)}setSize(n,t){let e=this.resolution;e.setBaseSize(n,t),this.renderTarget.setSize(e.width,e.height)}};var tOe=new Float32Array([255/256/256**3,255/256/256**2,255/256/256,255/256]);var Pt={SKIP:0,ADD:1,ALPHA:2,AVERAGE:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,EXCLUSION:8,LIGHTEN:9,MULTIPLY:10,DIVIDE:11,NEGATION:12,NORMAL:13,OVERLAY:14,REFLECT:15,SCREEN:16,SOFT_LIGHT:17,SUBTRACT:18},YK="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x+y,1.0)*opacity+x*(1.0-opacity);}",XK="vec3 blend(const in vec3 x,const in vec3 y,const in float opacity){return y*opacity+x*(1.0-opacity);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){float a=min(y.a,opacity);return vec4(blend(x.rgb,y.rgb,a),max(x.a,a));}",KK="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y)*0.5*opacity+x*(1.0-opacity);}",QK="float blend(const in float x,const in float y){return(y==0.0)?y:max(1.0-(1.0-x)/y,0.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",ZK="float blend(const in float x,const in float y){return(y==1.0)?y:min(x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",JK="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}",$K="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}",eQ="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y-2.0*x*y)*opacity+x*(1.0-opacity);}",tQ="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}",rQ="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}",iQ="float blend(const in float x,const in float y){return(y>0.0)?min(x/y,1.0):1.0;}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",nQ="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-abs(1.0-x-y))*opacity+x*(1.0-opacity);}",sQ="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*opacity+x*(1.0-opacity);}",oQ="float blend(const in float x,const in float y){return(x<0.5)?(2.0*x*y):(1.0-2.0*(1.0-x)*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",aQ="float blend(const in float x,const in float y){return(y==1.0)?y:min(x*x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",lQ="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-(1.0-x)*(1.0-y))*opacity+x*(1.0-opacity);}",cQ="float blend(const in float x,const in float y){return(y<0.5)?(2.0*x*y+x*x*(1.0-2.0*y)):(sqrt(x)*(2.0*y-1.0)+2.0*x*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",uQ="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x+y-1.0,0.0)*opacity+x*(1.0-opacity);}",hQ=new Map([[Pt.SKIP,null],[Pt.ADD,YK],[Pt.ALPHA,XK],[Pt.AVERAGE,KK],[Pt.COLOR_BURN,QK],[Pt.COLOR_DODGE,ZK],[Pt.DARKEN,JK],[Pt.DIFFERENCE,$K],[Pt.EXCLUSION,eQ],[Pt.LIGHTEN,tQ],[Pt.MULTIPLY,rQ],[Pt.DIVIDE,iQ],[Pt.NEGATION,nQ],[Pt.NORMAL,sQ],[Pt.OVERLAY,oQ],[Pt.REFLECT,aQ],[Pt.SCREEN,lQ],[Pt.SOFT_LIGHT,cQ],[Pt.SUBTRACT,uQ]]),dQ=class extends pr{constructor(n,t=1){super(),this.f=n,this.opacity=new le(t)}getOpacity(){return this.opacity.value}setOpacity(n){this.opacity.value=n}get blendFunction(){return this.f}set blendFunction(n){this.f=n,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(n){this.blendFunction=n}getShaderCode(){return hQ.get(this.blendFunction)}},Go={NONE:0,DEPTH:1,CONVOLUTION:2};var jo=class extends pr{constructor(n,t,{attributes:e=Go.NONE,blendFunction:r=Pt.SCREEN,defines:i=new Map,uniforms:s=new Map,extensions:o=null,vertexShader:a=null}={}){super(),this.name=n,this.renderer=null,this.attributes=e,this.fragmentShader=t,this.vertexShader=a,this.defines=i,this.uniforms=s,this.extensions=o,this.blendMode=new dQ(r),this.blendMode.addEventListener("change",l=>this.setChanged())}getName(){return this.name}setRenderer(n){this.renderer=n}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(n){this.attributes=n,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(n){this.fragmentShader=n,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(n){this.vertexShader=n,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(n,t=Bi){}update(n,t,e){}setSize(n,t){}initialize(n,t,e){}dispose(){for(let n of Object.keys(this)){let t=this[n];if(t!==null&&typeof t=="object"&&typeof t.dispose=="function"){if(t instanceof ei||t===this.renderer)continue;this[n].dispose()}}}};function G3(n,t,e){for(let r of t){let i="$1"+n+r.charAt(0).toUpperCase()+r.slice(1),s=new RegExp("([^\\.])(\\b"+r+"\\b)","g");for(let o of e.entries())o[1]!==null&&e.set(o[0],o[1].replace(s,i))}}function fQ(n,t,e,r,i,s,o){let a=new Map([["fragment",t.getFragmentShader()],["vertex",t.getVertexShader()]]),l=a.get("fragment")!==void 0&&/mainImage/.test(a.get("fragment")),c=a.get("fragment")!==void 0&&/mainUv/.test(a.get("fragment")),u=[],h=[],d=!1,f=!1;if(a.get("fragment")===void 0)console.error("Missing fragment shader",t);else if(c&&(o&Go.CONVOLUTION)!==0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",t);else if(!l&&!c)console.error("The fragment shader contains neither a mainImage nor a mainUv function",t);else{let p=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,m=JE.Section;if(c){let y=` ${n}MainUv(UV); `;e.set(m.FRAGMENT_MAIN_UV,e.get(m.FRAGMENT_MAIN_UV)+y),d=!0}if(a.get("vertex")!==null&&/mainSupport/.test(a.get("vertex"))){let y=` ${n}MainSupport(`;y+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(a.get("vertex"))?`vUv); `:`); `,e.set(m.VERTEX_MAIN_SUPPORT,e.get(m.VERTEX_MAIN_SUPPORT)+y),u=u.concat([...a.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(v=>v[1])),h=h.concat(u).concat([...a.get("vertex").matchAll(p)].map(v=>v[1]))}h=h.concat([...a.get("fragment").matchAll(p)].map(y=>y[1])),h=h.concat([...t.defines.keys()].map(y=>y.replace(/\([\w\s,]*\)/g,""))),h=h.concat([...t.uniforms.keys()]),t.uniforms.forEach((y,v)=>s.set(n+v.charAt(0).toUpperCase()+v.slice(1),y)),t.defines.forEach((y,v)=>i.set(n+v.charAt(0).toUpperCase()+v.slice(1),y)),G3(n,h,i),G3(n,h,a);let g=t.blendMode;if(r.set(g.blendFunction,g),l){let y=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/,v=`${n}MainImage(color0, UV, `;(o&Go.DEPTH)!==0&&y.test(a.get("fragment"))&&(v+="depth, ",f=!0),v+=`color1); `;let x=n+"BlendOpacity";s.set(x,g.opacity),v+=`color0 = blend${g.blendFunction}(color0, color1, ${x}); `,e.set(m.FRAGMENT_MAIN_IMAGE,e.get(m.FRAGMENT_MAIN_IMAGE)+v),v=`uniform float ${x}; `,e.set(m.FRAGMENT_HEAD,e.get(m.FRAGMENT_HEAD)+v)}e.set(m.FRAGMENT_HEAD,e.get(m.FRAGMENT_HEAD)+a.get("fragment")+` `),a.get("vertex")!==null&&e.set(m.VERTEX_HEAD,e.get(m.VERTEX_HEAD)+a.get("vertex")+` `)}return{varyings:u,transformedUv:d,readDepth:f}}var tu=class extends xi{constructor(n,...t){super("EffectPass"),this.fullscreenMaterial=new JE(null,null,null,n),this.effects=t.sort((e,r)=>r.attributes-e.attributes),this.skipRendering=!1,this.uniformCount=0,this.varyingCount=0,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(n){this.fullscreenMaterial.encodeOutput=n}get dithering(){return this.fullscreenMaterial.dithering}set dithering(n){let t=this.fullscreenMaterial;t.dithering=n,t.needsUpdate=!0}verifyResources(){let n=this.renderer.capabilities,t=Math.min(n.maxFragmentUniforms,n.maxVertexUniforms);this.uniformCount>t&&console.warn("The current rendering context doesn't support more than "+t+" uniforms, but "+this.uniformCount+" were defined"),t=n.maxVaryings,this.varyingCount>t&&console.warn("The current rendering context doesn't support more than "+t+" varyings, but "+this.varyingCount+" were defined")}updateMaterial(){let n=JE.Section,t=new Map([[n.FRAGMENT_HEAD,""],[n.FRAGMENT_MAIN_UV,""],[n.FRAGMENT_MAIN_IMAGE,""],[n.VERTEX_HEAD,""],[n.VERTEX_MAIN_SUPPORT,""]]),e=new Map,r=new Map,i=new Map,s=new Set,o=0,a=0,l=0,c=!1,u=!1;for(let d of this.effects)if(d.blendMode.blendFunction===Pt.SKIP)l|=d.getAttributes()&Go.DEPTH;else if((l&d.getAttributes()&Go.CONVOLUTION)!==0)console.error("Convolution effects cannot be merged",d);else{l|=d.getAttributes();let f="e"+o++,p=fQ(f,d,t,e,r,i,l);if(a+=p.varyings.length,c=c||p.transformedUv,u=u||p.readDepth,d.extensions!==null)for(let m of d.extensions)s.add(m)}let h=/\bblend\b/g;for(let d of e.values()){let f=d.getShaderCode().replace(h,`blend${d.blendFunction}`);t.set(n.FRAGMENT_HEAD,t.get(n.FRAGMENT_HEAD)+f+` `)}if((l&Go.DEPTH)!==0){if(u){let d=`float depth = readDepth(UV); `;t.set(n.FRAGMENT_MAIN_IMAGE,d+t.get(n.FRAGMENT_MAIN_IMAGE))}this.needsDepthTexture=this.getDepthTexture()===null}else this.needsDepthTexture=!1;if(c){let d=`vec2 transformedUv = vUv; `;t.set(n.FRAGMENT_MAIN_UV,d+t.get(n.FRAGMENT_MAIN_UV)),r.set("UV","transformedUv")}else r.set("UV","vUv");t.forEach((d,f,p)=>p.set(f,d.trim().replace(/^#/,` #`))),this.uniformCount=i.size,this.varyingCount=a,this.skipRendering=o===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderParts(t).setExtensions(s).setUniforms(i).setDefines(r)}recompile(){this.updateMaterial(),this.verifyResources()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(n,t=Bi){this.fullscreenMaterial.depthBuffer=n,this.fullscreenMaterial.depthPacking=t;for(let e of this.effects)e.setDepthTexture(n,t)}render(n,t,e,r,i){for(let s of this.effects)s.update(n,t,r);if(!this.skipRendering||this.renderToScreen){let s=this.fullscreenMaterial;s.inputBuffer=t.texture,s.time+=r,n.setRenderTarget(this.renderToScreen?null:e),n.render(this.scene,this.camera)}}setSize(n,t){this.fullscreenMaterial.setSize(n,t);for(let e of this.effects)e.setSize(n,t)}initialize(n,t,e){this.renderer=n;for(let r of this.effects)r.initialize(n,t,e),r.addEventListener("change",i=>this.handleEvent(i));this.updateMaterial(),this.verifyResources(),e!==void 0&&e!==_r&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(let n of this.effects)n.dispose()}handleEvent(n){switch(n.type){case"change":this.recompile();break}}},pQ=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],_x=class extends xi{constructor({resolutionScale:n=.5,width:t=Vn.AUTO_SIZE,height:e=Vn.AUTO_SIZE,kernelSize:r=zm.LARGE}={}){super("KawaseBlurPass"),this.renderTargetA=new dt(1,1,{minFilter:rt,magFilter:rt,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";let i=this.resolution=new Vn(this,t,e,n);i.addEventListener("change",s=>this.setSize(i.baseWidth,i.baseHeight)),this.blurMaterial=new U3,this.ditheredBlurMaterial=new U3,this.ditheredBlurMaterial.uniforms.scale=this.blurMaterial.uniforms.scale,this.ditheredBlurMaterial.dithering=!0,this.dithering=!1,this.kernelSize=r}getResolution(){return this.resolution}get width(){return this.resolution.width}set width(n){this.resolution.preferredWidth=n}get height(){return this.resolution.height}set height(n){this.resolution.preferredHeight=n}get scale(){return this.blurMaterial.scale}set scale(n){this.blurMaterial.scale=n}getScale(){return this.blurMaterial.scale}setScale(n){this.blurMaterial.scale=n}getKernelSize(){return this.kernelSize}setKernelSize(n){this.kernelSize=n}getResolutionScale(){return this.resolution.scale}setResolutionScale(n){this.resolution.scale=n}render(n,t,e,r,i){let s=this.scene,o=this.camera,a=this.renderTargetA,l=this.renderTargetB,c=pQ[this.kernelSize],u=this.blurMaterial,h=t,d,f;for(this.fullscreenMaterial=u,d=0,f=c.length-1;dthis.setSize(s.baseWidth,s.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(n,t,e,r,i){let s=this.fullscreenMaterial;s.inputBuffer=t.texture,n.setRenderTarget(this.renderToScreen?null:this.renderTarget),n.render(this.scene,this.camera)}setSize(n,t){let e=this.resolution;e.setBaseSize(n,t),this.renderTarget.setSize(e.width,e.height)}initialize(n,t,e){e!==void 0&&e!==_r&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},X3=class extends xi{constructor(n,t){super("MaskPass",n,t),this.needsSwap=!1,this.clearPass=new $E(!1,!1,!0),this.inverse=!1}get inverted(){return this.inverse}set inverted(n){this.inverse=n}get clear(){return this.clearPass.enabled}set clear(n){this.clearPass.enabled=n}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(n){this.inverted=n}render(n,t,e,r,i){let s=n.getContext(),o=n.state.buffers,a=this.scene,l=this.camera,c=this.clearPass,u=this.inverted?0:1,h=1-u;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),o.stencil.setFunc(s.ALWAYS,u,4294967295),o.stencil.setClear(h),o.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?c.render(n,null):(c.render(n,t),c.render(n,e))),this.renderToScreen?(n.setRenderTarget(null),n.render(a,l)):(n.setRenderTarget(t),n.render(a,l),n.setRenderTarget(e),n.render(a,l)),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(s.EQUAL,1,4294967295),o.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),o.stencil.setLocked(!0)}};var hn=class extends xi{constructor(n,t="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=n,this.inputBufferUniform=null,this.setInput(t)}setInput(n){if(this.inputBufferUniform=null,this.fullscreenMaterial!==null){let t=this.fullscreenMaterial.uniforms;t!==void 0&&t[n]!==void 0&&(this.inputBufferUniform=t[n])}}render(n,t,e,r,i){this.inputBufferUniform!==null&&t!==null&&(this.inputBufferUniform.value=t.texture),n.setRenderTarget(this.renderToScreen?null:e),n.render(this.scene,this.camera)}initialize(n,t,e){e!==void 0&&e!==_r&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},KE=1/1e3,gQ=1e3,K3=class{constructor(){this.previousTime=0,this.currentTime=0,this.delta=0,this.fixedDelta=1e3/60,this.elapsed=0,this.timescale=1,this.fixedDeltaEnabled=!1,this.autoReset=!1}setFixedDeltaEnabled(n){return this.fixedDeltaEnabled=n,this}isAutoResetEnabled(n){return this.autoReset}setAutoResetEnabled(n){return typeof document<"u"&&document.hidden!==void 0&&(n?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this.autoReset=n),this}getDelta(){return this.delta*KE}getFixedDelta(){return this.fixedDelta*KE}setFixedDelta(n){return this.fixedDelta=n*gQ,this}getElapsed(){return this.elapsed*KE}getTimescale(){return this.timescale}setTimescale(n){return this.timescale=n,this}update(n){return this.fixedDeltaEnabled?this.delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=n!==void 0?n:performance.now(),this.delta=this.currentTime-this.previousTime),this.delta*=this.timescale,this.elapsed+=this.delta,this}reset(){return this.delta=0,this.elapsed=0,this.currentTime=performance.now(),this}handleEvent(n){document.hidden||(this.currentTime=performance.now())}dispose(){this.setAutoResetEnabled(!1)}};var zm={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5};var yQ=`#ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D map; #else uniform lowp sampler2D map; #endif uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=clamp(texture2D(map,uv)*intensity,0.0,1.0);}`,Q3=class extends jo{constructor({blendFunction:n=Pt.SCREEN,luminanceThreshold:t=.9,luminanceSmoothing:e=.025,resolutionScale:r=.5,intensity:i=1,width:s=Vn.AUTO_SIZE,height:o=Vn.AUTO_SIZE,kernelSize:a=zm.LARGE}={}){super("BloomEffect",yQ,{blendFunction:n,uniforms:new Map([["map",new le(null)],["intensity",new le(i)]])}),this.renderTarget=new dt(1,1,{minFilter:rt,magFilter:rt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.renderTarget.texture.generateMipmaps=!1,this.uniforms.get("map").value=this.renderTarget.texture,this.luminancePass=new mQ({renderTarget:this.renderTarget,colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothingFactor=e,this.blurPass=new _x({resolutionScale:r,width:s,height:o,kernelSize:a});let l=this.blurPass.getResolution();l.addEventListener("change",c=>this.setSize(l.baseWidth,l.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}get resolution(){return this.blurPass.resolution}getResolution(){return this.blurPass.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(n){this.resolution.preferredWidth=n}get height(){return this.resolution.height}set height(n){this.resolution.preferredHeight=n}get dithering(){return this.blurPass.dithering}set dithering(n){this.blurPass.dithering=n}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(n){this.blurPass.kernelSize=n}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(n){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(n){this.uniforms.get("intensity").value=n}getIntensity(){return this.intensity}setIntensity(n){this.intensity=n}getResolutionScale(){return this.resolution.scale}setResolutionScale(n){this.resolution.scale=n}update(n,t,e){let r=this.renderTarget;this.luminancePass.enabled?(this.luminancePass.render(n,t,r),this.blurPass.render(n,r,r)):this.blurPass.render(n,t,r)}setSize(n,t){let e=this.resolution;e.setBaseSize(n,t),this.renderTarget.setSize(e.width,e.height),this.luminancePass.resolution.copy(e)}initialize(n,t,e){this.blurPass.initialize(n,t,e),e!==void 0&&(this.renderTarget.texture.type=e,n.outputEncoding===at&&(this.renderTarget.texture.encoding=at))}};var vQ="uniform float brightness;uniform float contrast;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=inputColor.rgb+vec3(brightness-0.5);if(contrast>0.0){color/=vec3(1.0-contrast);}else{color*=vec3(1.0+contrast);}outputColor=vec4(min(color+vec3(0.5),1.0),inputColor.a);}",Z3=class extends jo{constructor({blendFunction:n=Pt.NORMAL,brightness:t=0,contrast:e=0}={}){super("BrightnessContrastEffect",vQ,{blendFunction:n,uniforms:new Map([["brightness",new le(t)],["contrast",new le(e)]])})}get brightness(){return this.uniforms.get("brightness").value}set brightness(n){this.uniforms.get("brightness").value=n}getBrightness(n){return this.brightness}setBrightness(n){this.brightness=n}get contrast(){return this.uniforms.get("contrast").value}set contrast(n){this.uniforms.get("contrast").value=n}getContrast(n){return this.contrast}setContrast(n){this.contrast=n}},xQ="void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=vec4(vec3(average(inputColor.rgb)),inputColor.a);}",J3=class extends jo{constructor(n=Pt.NORMAL){super("ColorAverageEffect",xQ,{blendFunction:n})}};var bQ="varying vec2 vUvR;varying vec2 vUvB;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec2 ra=texture2D(inputBuffer,vUvR).ra;vec2 ba=texture2D(inputBuffer,vUvB).ba;outputColor=vec4(ra.x,inputColor.g,ba.x,max(max(ra.y,ba.y),inputColor.a));}",SQ="uniform vec2 offset;varying vec2 vUvR;varying vec2 vUvB;void mainSupport(const in vec2 uv){vec2 shift=offset*vec2(1.0,aspect);vUvR=uv+shift;vUvB=uv-shift;}",$3=class extends jo{constructor({blendFunction:n=Pt.NORMAL,offset:t=new k(.001,5e-4)}={}){super("ChromaticAberrationEffect",bQ,{vertexShader:SQ,blendFunction:n,attributes:Go.CONVOLUTION,uniforms:new Map([["offset",new le(t)]])})}get offset(){return this.uniforms.get("offset").value}set offset(n){this.uniforms.get("offset").value=n}getOffset(){return this.offset}setOffset(n){this.offset=n}};var wQ=`#ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D nearColorBuffer;uniform mediump sampler2D farColorBuffer; #else uniform lowp sampler2D nearColorBuffer;uniform lowp sampler2D farColorBuffer; #endif uniform lowp sampler2D nearCoCBuffer;uniform float scale;void mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){vec4 colorNear=texture2D(nearColorBuffer,uv);vec4 colorFar=texture2D(farColorBuffer,uv);float CoCNear=texture2D(nearCoCBuffer,uv).r;CoCNear=min(CoCNear*scale,1.0);vec4 result=inputColor*(1.0-colorFar.a)+colorFar;result=mix(result,colorNear,CoCNear);outputColor=result;}`,eL=class extends jo{constructor(n,{blendFunction:t=Pt.NORMAL,worldFocusDistance:e,worldFocusRange:r,focusDistance:i=0,focalLength:s=.1,focusRange:o=s,bokehScale:a=1,width:l=Vn.AUTO_SIZE,height:c=Vn.AUTO_SIZE}={}){super("DepthOfFieldEffect",wQ,{blendFunction:t,attributes:Go.DEPTH,uniforms:new Map([["nearColorBuffer",new le(null)],["farColorBuffer",new le(null)],["nearCoCBuffer",new le(null)],["scale",new le(1)]])}),this.camera=n,this.renderTarget=new dt(1,1,{minFilter:rt,magFilter:rt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="DoF.Intermediate",this.renderTarget.texture.generateMipmaps=!1,this.renderTargetMasked=this.renderTarget.clone(),this.renderTargetMasked.texture.name="DoF.Masked.Far",this.renderTargetNear=this.renderTarget.clone(),this.renderTargetNear.texture.name="DoF.Bokeh.Near",this.uniforms.get("nearColorBuffer").value=this.renderTargetNear.texture,this.renderTargetFar=this.renderTarget.clone(),this.renderTargetFar.texture.name="DoF.Bokeh.Far",this.uniforms.get("farColorBuffer").value=this.renderTargetFar.texture,this.renderTargetCoC=this.renderTarget.clone(),this.renderTargetCoC.texture.name="DoF.CoC",this.renderTargetCoCBlurred=this.renderTargetCoC.clone(),this.renderTargetCoCBlurred.texture.name="DoF.CoC.Blurred",this.uniforms.get("nearCoCBuffer").value=this.renderTargetCoCBlurred.texture,this.cocPass=new hn(new MK(n));let u=this.cocMaterial;u.focusDistance=i,u.focusRange=o,e!==void 0&&(u.worldFocusDistance=e),r!==void 0&&(u.worldFocusRange=r),this.blurPass=new _x({kernelSize:zm.MEDIUM,width:l,height:c});let h=this.blurPass.getResolution();h.addEventListener("change",f=>this.setSize(h.getBaseWidth(),h.getBaseHeight())),this.maskPass=new hn(new UK(this.renderTargetCoC.texture));let d=this.maskPass.fullscreenMaterial;d.maskFunction=q3.MULTIPLY,d.colorChannel=W3.GREEN,this.bokehNearBasePass=new hn(new Cx(!1,!0)),this.bokehNearBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehNearFillPass=new hn(new Cx(!0,!0)),this.bokehNearFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehFarBasePass=new hn(new Cx(!1,!1)),this.bokehFarBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.bokehFarFillPass=new hn(new Cx(!0,!1)),this.bokehFarFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.target=null,this.bokehScale=a}get cocTexture(){return this.renderTargetCoC.texture}get cocMaterial(){return this.cocPass.fullscreenMaterial}get circleOfConfusionMaterial(){return this.cocMaterial}getCircleOfConfusionMaterial(){return this.circleOfConfusionMaterial}getBlurPass(){return this.blurPass}get resolution(){return this.blurPass.getResolution()}getResolution(){return this.blurPass.getResolution()}get bokehScale(){return this.uniforms.get("scale").value}set bokehScale(n){let t=[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];for(let e of t)e.fullscreenMaterial.setScale(n);this.maskPass.fullscreenMaterial.setStrength(n),this.uniforms.get("scale").value=n}getBokehScale(){return this.bokehScale}setBokehScale(n){this.bokehScale=n}getTarget(){return this.target}setTarget(n){this.target=n}calculateFocusDistance(n){let t=this.camera,e=t.position.distanceTo(n);return ZE(-e,t.near,t.far)}setDepthTexture(n,t=Bi){this.circleOfConfusionMaterial.depthBuffer=n,this.circleOfConfusionMaterial.depthPacking=t}update(n,t,e){let r=this.renderTarget,i=this.renderTargetCoC,s=this.renderTargetCoCBlurred,o=this.renderTargetMasked;if(this.target!==null){let a=this.calculateFocusDistance(this.target);this.circleOfConfusionMaterial.focusDistance=a}this.cocPass.render(n,null,i),this.blurPass.render(n,i,s),this.maskPass.render(n,t,o),this.bokehFarBasePass.render(n,o,r),this.bokehFarFillPass.render(n,r,this.renderTargetFar),this.bokehNearBasePass.render(n,t,r),this.bokehNearFillPass.render(n,r,this.renderTargetNear)}setSize(n,t){let e=this.resolution;e.setBaseSize(n,t);let r=e.width,i=e.height,s=[this.cocPass,this.blurPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];s.push(this.renderTargetCoC,this.renderTargetMasked),s.forEach(a=>a.setSize(n,t)),s=[this.renderTarget,this.renderTargetNear,this.renderTargetFar,this.renderTargetCoCBlurred],s.forEach(a=>a.setSize(r,i)),[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(a=>a.fullscreenMaterial.setSize(r,i))}initialize(n,t,e){[this.cocPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(i=>i.initialize(n,t,e)),this.blurPass.initialize(n,t,_r),e!==void 0&&(this.renderTarget.texture.type=e,this.renderTargetNear.texture.type=e,this.renderTargetFar.texture.type=e,this.renderTargetMasked.texture.type=e,n.outputEncoding===at&&(this.renderTarget.texture.encoding=at,this.renderTargetNear.texture.encoding=at,this.renderTargetFar.texture.encoding=at,this.renderTargetMasked.texture.encoding=at))}};var fOe=new E,pOe=new ue;var AQ="uniform vec3 hue;uniform float saturation;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=vec3(dot(inputColor.rgb,hue.xyz),dot(inputColor.rgb,hue.zxy),dot(inputColor.rgb,hue.yzx));float average=(color.r+color.g+color.b)/3.0;vec3 diff=average-color;if(saturation>0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}",tL=class extends jo{constructor({blendFunction:n=Pt.NORMAL,hue:t=0,saturation:e=0}={}){super("HueSaturationEffect",AQ,{blendFunction:n,uniforms:new Map([["hue",new le(new E)],["saturation",new le(e)]])}),this.hue=t}get saturation(){return this.uniforms.get("saturation").value}set saturation(n){this.uniforms.get("saturation").value=n}getSaturation(){return this.saturation}setSaturation(n){this.saturation=n}get hue(){let n=this.uniforms.get("hue").value;return Math.acos((n.x*3-1)/2)}set hue(n){let t=Math.sin(n),e=Math.cos(n);this.uniforms.get("hue").value.set((2*e+1)/3,(-Math.sqrt(3)*t-e+1)/3,(Math.sqrt(3)*t-e+1)/3)}getHue(){return this.hue}setHue(n){this.hue=n}};var yOe=new We;var EQ=`void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*time)); #ifdef PREMULTIPLY outputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a); #else outputColor=vec4(noise,inputColor.a); #endif }`,rL=class extends jo{constructor({blendFunction:n=Pt.SCREEN,premultiply:t=!1}={}){super("NoiseEffect",EQ,{blendFunction:n}),this.premultiply=t}get premultiply(){return this.defines.has("PREMULTIPLY")}set premultiply(n){this.premultiply!==n&&(n?this.defines.set("PREMULTIPLY","1"):this.defines.delete("PREMULTIPLY"),this.setChanged())}isPremultiplied(){return this.premultiply}setPremultiplied(n){this.premultiply=n}};var TQ="uniform bool active;uniform vec2 d;void mainUv(inout vec2 uv){if(active){uv=vec2(d.x*(floor(uv.x/d.x)+0.5),d.y*(floor(uv.y/d.y)+0.5));}}",iL=class extends jo{constructor(n=30){super("PixelationEffect",TQ,{uniforms:new Map([["active",new le(!1)],["d",new le(new k)]])}),this.resolution=new k,this.d=0,this.granularity=n}get granularity(){return this.d}set granularity(n){let t=Math.floor(n);t%2>0&&(t+=1),this.d=t,this.uniforms.get("active").value=t>0,this.setSize(this.resolution.width,this.resolution.height)}getGranularity(){return this.granularity}setGranularity(n){this.granularity=n}setSize(n,t){this.resolution.set(n,t),this.uniforms.get("d").value.setScalar(this.d).divide(this.resolution)}};var bOe=Math.PI*.5,SOe=new E,wOe=new E;var j3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC",H3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAYAAAABNmBHAAAgAElEQVR4Xuy9CbhlV1ktOvbpq09DkiIkUBI6kxASIH0DlAQiIK1wRfSJTx+i4JX7vKIigs8HXpXvqVcvrcC9agQ7IDTSSWgqCQQliDRBJKkkhDSkqVPNqVOnP+8b//rH3P+eZ+199tlznVTlvVrft7+1T7OaueZY42/m37QALKNk2wHg1pITlB17mC+Pp11W3X/LHyT32vhg48/5SOv+PnwpsHA70JoGlueB1iKApeqzvOzn44GatTB76Xzhd7suBR7+WWADgDEAwwCG/L54b/poDLrHuvvm70Z2Avhsc+PVcxscBU8F8C8ADg5+ipIjD/PlGwfgju8B924E5seARUfLsiNmqQW0IjL8+7L2NYD/7COBzfcCm+aB8SVgdAkYIRCXKyDax4EdAanL5PuNPllNvXDlAHwFgP8AcC2AhRIoDXbsYb48dl5WkVFTE3LGDcC9m4CZCWBuFFgeAZaGAYJQQCRqDHT+McJrVb8zwATUXH02MHYf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dtgGcewesFt7Rc/Gx8iWjUCjGCT1YvWT1MwgUqrf3NG45tTbcu0aximWx9xENcEQHGbcYAEwtSXSqY0gnCdgeuMI0cvuGx/FUGgFhwEYrR80QckWN+X0fjm1DwAWv8RgJFilJZBznz0pQg+AZAAlVWh1GvGka0XzB0cCQi30aSGVa9AF62fLOB7MhrfnJoPwPER59Px+o3e76mL5Kwp2G57xPl0kxc3er+nLvyKtLmhfUC78RHn081ONnq/pzcAR5xPR9mRRu/31IVgvgUccT4dNaobvd/TGYAjzqejumqj93s6A3DE+XRUg2VSCjdaGr3fUw+I+VPwiPPpqJjO8J1Nw43e7ymHwHoAKMFd7QErAeEE5NNJMb3R+z3lsGcNzgfgiPPpomJ6o/d76oGwPgCOKJ8uKqY3er+nKwBHmE+noqRG7/fUA199U/AI8+kEwEbv93QHoEhZTnA+nYqSGr3fBoAtaiqBUImdm5hPJwA2er+nKwBHnE+X1gUzSbnR+z11wPj/AeCpPDD3t7rvAAAAAElFTkSuQmCC",MQ="uniform sampler2D weightMap;varying vec2 vOffset0;varying vec2 vOffset1;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 a;a.x=texture2D(weightMap,vOffset0).a;a.y=texture2D(weightMap,vOffset1).g;a.wz=texture2D(weightMap,uv).rb;vec4 color=inputColor;if(dot(a,vec4(1.0))>=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",CQ="varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",Ua={LOW:0,MEDIUM:1,HIGH:2,ULTRA:3},Ix=class extends jo{constructor({preset:n=Ua.MEDIUM,edgeDetectionMode:t=ff.COLOR,predicationMode:e=RK.DISABLED}={}){super("SMAAEffect",MQ,{vertexShader:CQ,blendFunction:Pt.NORMAL,attributes:Go.CONVOLUTION|Go.DEPTH,uniforms:new Map([["weightMap",new le(null)]])});let r,i;arguments.length>1&&(r=arguments[0],i=arguments[1],arguments.length>2&&(n=arguments[2]),arguments.length>3&&(t=arguments[3])),this.renderTargetEdges=new dt(1,1,{minFilter:rt,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new $E(!0,!1,!1),this.clearPass.overrideClearColor=new We(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new hn(new LK),this.edgeDetectionMaterial.edgeDetectionMode=t,this.edgeDetectionMaterial.predicationMode=e,this.weightsPass=new hn(new jK);let s=new Ep;s.onLoad=()=>{let o=new er(r);o.name="SMAA.Search",o.magFilter=Vt,o.minFilter=Vt,o.generateMipmaps=!1,o.needsUpdate=!0,o.flipY=!0,this.weightsMaterial.searchTexture=o;let a=new er(i);a.name="SMAA.Area",a.magFilter=rt,a.minFilter=rt,a.generateMipmaps=!1,a.needsUpdate=!0,a.flipY=!1,this.weightsMaterial.areaTexture=a,this.dispatchEvent({type:"load"})},s.itemStart("search"),s.itemStart("area"),r!==void 0&&i!==void 0?(s.itemEnd("search"),s.itemEnd("area")):typeof Image<"u"&&(r=new Image,i=new Image,r.addEventListener("load",()=>s.itemEnd("search")),i.addEventListener("load",()=>s.itemEnd("area")),r.src=j3,i.src=H3),this.applyPreset(n)}get edgesTexture(){return this.renderTargetEdges.texture}getEdgesTexture(){return this.edgesTexture}get weightsTexture(){return this.renderTargetWeights.texture}getWeightsTexture(){return this.weightsTexture}get edgeDetectionMaterial(){return this.edgeDetectionPass.fullscreenMaterial}get colorEdgesMaterial(){return this.edgeDetectionMaterial}getEdgeDetectionMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.fullscreenMaterial}getWeightsMaterial(){return this.weightsMaterial}setEdgeDetectionThreshold(n){this.edgeDetectionMaterial.edgeDetectionThreshold=n}setOrthogonalSearchSteps(n){this.weightsMaterial.orthogonalSearchSteps=n}applyPreset(n){let t=this.edgeDetectionMaterial,e=this.weightsMaterial;switch(n){case Ua.LOW:t.edgeDetectionThreshold=.15,e.orthogonalSearchSteps=4,e.diagonalDetection=!1,e.cornerDetection=!1;break;case Ua.MEDIUM:t.edgeDetectionThreshold=.1,e.orthogonalSearchSteps=8,e.diagonalDetection=!1,e.cornerDetection=!1;break;case Ua.HIGH:t.edgeDetectionThreshold=.1,e.orthogonalSearchSteps=16,e.diagonalSearchSteps=8,e.cornerRounding=25,e.diagonalDetection=!0,e.cornerDetection=!0;break;case Ua.ULTRA:t.edgeDetectionThreshold=.05,e.orthogonalSearchSteps=32,e.diagonalSearchSteps=16,e.cornerRounding=25,e.diagonalDetection=!0,e.cornerDetection=!0;break}}setDepthTexture(n,t=Bi){this.edgeDetectionMaterial.depthBuffer=n,this.edgeDetectionMaterial.depthPacking=t}update(n,t,e){this.clearPass.render(n,this.renderTargetEdges),this.edgeDetectionPass.render(n,t,this.renderTargetEdges),this.weightsPass.render(n,this.renderTargetEdges,this.renderTargetWeights)}setSize(n,t){this.edgeDetectionMaterial.setSize(n,t),this.weightsMaterial.setSize(n,t),this.renderTargetEdges.setSize(n,t),this.renderTargetWeights.setSize(n,t)}dispose(){let{searchTexture:n,areaTexture:t}=this.weightsMaterial;n!==null&&t!==null&&(n.dispose(),t.dispose()),super.dispose()}static get searchImageDataURL(){return j3}static get areaImageDataURL(){return H3}};var PQ=`uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb; #if VIGNETTE_TECHNIQUE == 0 float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset)); #else vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord)); #endif outputColor=vec4(color,inputColor.a);}`,Px={DEFAULT:0,ESKIL:1},nL=class extends jo{constructor({blendFunction:n=Pt.NORMAL,technique:t=Px.DEFAULT,eskil:e=!1,offset:r=.5,darkness:i=.5}={}){super("VignetteEffect",PQ,{blendFunction:n,defines:new Map([["VIGNETTE_TECHNIQUE",t.toFixed(0)]]),uniforms:new Map([["offset",new le(r)],["darkness",new le(i)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(n){this.technique!==n&&(this.defines.set("VIGNETTE_TECHNIQUE",n.toFixed(0)),this.setChanged())}get eskil(){return this.technique===Px.ESKIL}set eskil(n){this.technique=n?Px.ESKIL:Px.DEFAULT}getTechnique(){return this.technique}setTechnique(n){this.technique=n}get offset(){return this.uniforms.get("offset").value}set offset(n){this.uniforms.get("offset").value=n}getOffset(){return this.offset}setOffset(n){this.offset=n}get darkness(){return this.uniforms.get("darkness").value}set darkness(n){this.uniforms.get("darkness").value=n}getDarkness(){return this.darkness}setDarkness(n){this.darkness=n}},TOe=[new Float32Array(3),new Float32Array(3)],MOe=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],COe=[[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1])]];var POe=[new Float32Array(2),new Float32Array(2)];var _Oe=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),IOe=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],DOe=[new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4])],OOe=[new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3])];var ROe=new Map([[un(0,0,0,0),new Float32Array([0,0,0,0])],[un(0,0,0,1),new Float32Array([0,0,0,1])],[un(0,0,1,0),new Float32Array([0,0,1,0])],[un(0,0,1,1),new Float32Array([0,0,1,1])],[un(0,1,0,0),new Float32Array([0,1,0,0])],[un(0,1,0,1),new Float32Array([0,1,0,1])],[un(0,1,1,0),new Float32Array([0,1,1,0])],[un(0,1,1,1),new Float32Array([0,1,1,1])],[un(1,0,0,0),new Float32Array([1,0,0,0])],[un(1,0,0,1),new Float32Array([1,0,0,1])],[un(1,0,1,0),new Float32Array([1,0,1,0])],[un(1,0,1,1),new Float32Array([1,0,1,1])],[un(1,1,0,0),new Float32Array([1,1,0,0])],[un(1,1,0,1),new Float32Array([1,1,0,1])],[un(1,1,1,0),new Float32Array([1,1,1,0])],[un(1,1,1,1),new Float32Array([1,1,1,1])]]);function QE(n,t,e){return n+(t-n)*e}function un(n,t,e,r){let i=QE(n,t,.75),s=QE(e,r,1-.25);return QE(i,s,1-.125)}var si=class{constructor(t,e){this.enabled=!1;this.effect=new t(e),Object.defineProperty(this,"opacity",{enumerable:!0,set(r){this.effect.blendMode.opacity.value=r},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(r){this.effect.blendMode.setBlendFunction(Number(r))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=Pt.NORMAL}};var pf=class extends si{constructor(){super(Q3),this.blendFunction=Pt.SCREEN}set intensity(t){this.effect.intensity=t}get intensity(){return this.effect.intensity}set luminanceThreshold(t){this.effect.luminanceMaterial.threshold=t}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(t){this.effect.luminanceMaterial.smoothing=t}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(t){this.effect.blurPass.scale=t}get blurScale(){return this.effect.blurPass.scale}set kernelSize(t){this.effect.blurPass.kernelSize=t}get kernelSize(){return this.effect.blurPass.kernelSize}};var mf=class extends si{constructor(){super(Z3)}set contrast(t){this.effect.uniforms.get("contrast").value=t}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(t){this.effect.uniforms.get("brightness").value=t}get brightness(){return this.effect.uniforms.get("brightness").value}};var gf=class extends si{constructor(){super($3),this.effect.offset=new k(.01,.01)}set offset(t){this.effect.offset.set(t[0]/1e3,t[1]/1e3)}get offset(){return[this.effect.offset.x*1e3,this.effect.offset.y*1e3]}};var yf=class extends si{constructor(){super(J3)}};var vf=class extends si{constructor(){super(tL);this._hue=0}set hue(e){this._hue=e,this.effect.setHue(e)}get hue(){return this._hue}set saturation(e){this.effect.uniforms.get("saturation").value=e}get saturation(){return this.effect.uniforms.get("saturation").value}};var xf=class extends si{constructor(){super(rL),this.blendFunction=Pt.OVERLAY}};var bf=class extends si{constructor(){super(nL)}get eskil(){return this.effect.eskil}set eskil(t){this.effect.eskil=t}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(t){this.effect.uniforms.get("darkness").value=t}get offset(){return this.effect.uniforms.get("offset").value}set offset(t){this.effect.uniforms.get("offset").value=t}};var Sf=class extends si{constructor(e){super(eL)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e/2e3}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=this.isPerspectiveCamera?e/2e3:(e+992)/2e3}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}setCamera(e){let r=!1;(e.isPerspectiveCamera&&this.isPerspectiveCamera===!1||!e.isPerspectiveCamera&&this.isPerspectiveCamera===!0)&&(r=!0),e.isPerspectiveCamera?(this.effect.circleOfConfusionMaterial.adoptCameraSettings(e.perspCamera),this.isPerspectiveCamera=!0):(this.effect.circleOfConfusionMaterial.adoptCameraSettings(e),this.isPerspectiveCamera=!1),r&&this.effect.setChanged()}};var wf=class extends si{constructor(){super(iL)}get granularity(){return this.effect.getGranularity()}set granularity(t){this.effect.setGranularity(t)}};var sL=`#define GLSLIFY 1 varying vec2 vUv;varying vec2 vTexCoords[9];uniform vec2 resolution;void main(){vUv=position.xy*0.5+0.5;vec2 texelSize=vec2(1.0)/resolution;vTexCoords[0]=vUv+vec2(-texelSize.x,-texelSize.y);vTexCoords[1]=vUv+vec2(0.0,-texelSize.y);vTexCoords[2]=vUv+vec2(texelSize.x,-texelSize.y);vTexCoords[3]=vUv+vec2(-texelSize.x,0.0);vTexCoords[4]=vUv+vec2(0.0,0.0);vTexCoords[5]=vUv+vec2(texelSize.x,0.0);vTexCoords[6]=vUv+vec2(-texelSize.x,texelSize.y);vTexCoords[7]=vUv+vec2(0.0,texelSize.y);vTexCoords[8]=vUv+vec2(texelSize.x,texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}`;var oL=`#define GLSLIFY 1 #include varying vec2 vUv;varying vec2 vTexCoords[9];uniform sampler2D inputBuffer;uniform sampler2D historyBuffer;uniform sampler2D velocityBuffer;uniform sampler2D depthBuffer;uniform vec2 resolution; #define USE_YCOCG #define USE_CATMULL_ROM const float feedback_min=0.5;const float feedback_max=0.95;vec3 RGB_YCoCg(vec3 c){return vec3(c.x/4.0+c.y/2.0+c.z/4.0,c.x/2.0-c.z/2.0,-c.x/4.0+c.y/2.0-c.z/4.0);}vec3 YCoCg_RGB(vec3 c){return clamp(vec3(c.x+c.y-c.z,c.x+c.z,c.x-c.y-c.z),vec3(0.0),vec3(1.0));}vec4 sample_color(sampler2D tex,vec2 uv){ #ifdef USE_YCOCG vec4 c=texture(tex,uv);return vec4(RGB_YCoCg(c.rgb),c.a); #else return texture(tex,uv); #endif }vec4 sample_catmull_rom(sampler2D tex,vec2 uv,vec2 texSize){vec2 samplePos=uv*texSize;vec2 texPos1=floor(samplePos-0.5)+0.5;vec2 f=samplePos-texPos1;vec2 w0=f*(-0.5+f*(1.0-0.5*f));vec2 w1=1.0+f*f*(-2.5+1.5*f);vec2 w2=f*(0.5+f*(2.0-1.5*f));vec2 w3=f*f*(-0.5+0.5*f);vec2 w12=w1+w2;vec2 offset12=w2/(w1+w2);vec2 texPos0=texPos1-1.0;vec2 texPos3=texPos1+2.0;vec2 texPos12=texPos1+offset12;texPos0/=texSize;texPos3/=texSize;texPos12/=texSize;vec4 result=vec4(0.0);result+=texture2D(tex,vec2(texPos12.x,texPos0.y))*w12.x*w0.y;result+=texture2D(tex,vec2(texPos0.x,texPos12.y))*w0.x*w12.y;result+=texture2D(tex,vec2(texPos12.x,texPos12.y))*w12.x*w12.y;result+=texture2D(tex,vec2(texPos3.x,texPos12.y))*w3.x*w12.y;result+=texture2D(tex,vec2(texPos12.x,texPos3.y))*w12.x*w3.y;return result;}vec3 choose_motion_vector(){ #ifdef CHOOSE_LONGEST_MOTION_VECTOR float longest=-1.0;vec3 v_choose=vec3(-1.0);for(int i=0;i<9;i++){vec3 v=texture2D(velocityBuffer,vTexCoords[i]).rgb;float l=length(v.xy);if(l>longest){longest=l;v_choose=v;}}return v_choose; #else float closest_depth=1000.0;vec2 closest_uv_offset=vec2(0.0);for(int i=0;i<9;i++){float neighbor_depth=texture2D(depthBuffer,vTexCoords[i]).r;if(neighbor_depth1.0){return vec4(p_clip,avg.w)+v_clip/ma_unit;}else{return input_texel;}}vec3 clip_aabb_variance(in vec3 cOld,in vec3 cNew,in vec3 centre,in vec3 halfSize){if(all(lessThanEqual(abs(cOld-centre),halfSize))){return cOld;}vec3 dir=(cNew-cOld);vec3 near=centre-sign(dir)*halfSize;vec3 tAll=(near-cOld)/dir;float t=0.0001;for(int i=0;i<3;i++){if(tAll[i]>=0.0&&tAll[i]=0.0001){return cOld;}return cOld+dir*t;}void main(){vec3 v=choose_motion_vector();vec2 velocity=v.rg;vec2 previousPixelPos=vUv-velocity;vec4 currentColor=sample_color(inputBuffer,vUv); #ifdef USE_CATMULL_ROM vec4 previousColor=sample_catmull_rom(historyBuffer,previousPixelPos,resolution); #else vec4 previousColor=sample_color(historyBuffer,previousPixelPos); #endif #ifdef USE_YCOCG previousColor=vec4(RGB_YCoCg(previousColor.rgb),previousColor.a); #endif vec4 ctl=sample_color(inputBuffer,vTexCoords[0]);vec4 ctc=sample_color(inputBuffer,vTexCoords[1]);vec4 ctr=sample_color(inputBuffer,vTexCoords[2]);vec4 cml=sample_color(inputBuffer,vTexCoords[3]);vec4 cmc=sample_color(inputBuffer,vTexCoords[4]);vec4 cmr=sample_color(inputBuffer,vTexCoords[5]);vec4 cbl=sample_color(inputBuffer,vTexCoords[6]);vec4 cbc=sample_color(inputBuffer,vTexCoords[7]);vec4 cbr=sample_color(inputBuffer,vTexCoords[8]);vec4 cmin=min(ctl,min(ctc,min(ctr,min(cml,min(cmc,min(cmr,min(cbl,min(cbc,cbr))))))));vec4 cmax=max(ctl,max(ctc,max(ctr,max(cml,max(cmc,max(cmr,max(cbl,max(cbc,cbr))))))));vec4 cavg=(ctl+ctc+ctr+cml+cmc+cmr+cbl+cbc+cbr)/9.0;vec4 cmin5=min(ctc,min(cml,min(cmc,min(cmr,cbc))));vec4 cmax5=max(ctc,max(cml,max(cmc,max(cmr,cbc))));vec4 cavg5=(ctc+cml+cmc+cmr+cbc)/5.0;cmin=0.5*(cmin+cmin5);cmax=0.5*(cmax+cmax5);cavg=0.5*(cavg+cavg5); #ifdef USE_YCOCG vec2 chroma_extent=vec2(0.25*0.5*(cmax.r-cmin.r));vec2 chroma_center=currentColor.gb;cmin.yz=chroma_center-chroma_extent;cmax.yz=chroma_center+chroma_extent;cavg.yz=chroma_center; #endif vec4 previousColorClipped=clamp(previousColor,cmin,cmax); #ifdef LUMINANCE_DIFFERENCES #ifdef USE_YCOCG float lum0=currentColor.r;float lum1=previousColorClipped.r; #else float lum0=luminance(currentColor.rgb);float lum1=luminance(previousColorClipped.rgb); #endif float unbiased_diff=abs(lum0-lum1)/max(lum0,max(lum1,0.2));float unbiased_weight=1.0-unbiased_diff;float unbiased_weight_sqr=unbiased_weight*unbiased_weight;float k_feedback=mix(feedback_min,feedback_max,unbiased_weight_sqr);vec4 result=mix(currentColor,previousColorClipped,vec4(k_feedback)); #else const float alpha=0.1;vec4 result=mix(currentColor,previousColorClipped,1.0-alpha); #endif #ifdef USE_YCOCG gl_FragColor=vec4(YCoCg_RGB(result.rgb).rgb,result.a); #else gl_FragColor=result; #endif }`;var aL=`#define GLSLIFY 1 varying vec2 vUv;void main(){gl_Position=vec4(position.xy,1.0,1.0);vUv=position.xy*0.5+0.5;}`;var lL=`#define GLSLIFY 1 layout(location=1)out vec4 gVelocity;varying vec2 vUv;uniform sampler2D inputBuffer;void main(){gl_FragColor=texture2D(inputBuffer,vUv);gVelocity=vec4(0.0);}`;var Af=class extends it{constructor(){super({name:"PassthroughMaterial",uniforms:{inputBuffer:new le(null)},blending:$t,depthWrite:!1,depthTest:!1,vertexShader:aL,fragmentShader:lL})}set inputBuffer(t){this.uniforms.inputBuffer.value=t}},Dx=class extends xi{constructor(){super("TAAResolvePass");this.MRTCompatible=!0;this.needsSwap=!1,this.passThroughMaterial=new Af,this.resolutionVector=new k,this.resolveMaterial=new it({name:"TAAResolveMaterial",uniforms:{inputBuffer:new le(null),historyBuffer:new le(null),velocityBuffer:new le(null),depthBuffer:new le(null),resolution:new le(new k)},blending:$t,depthWrite:!1,depthTest:!1,vertexShader:sL,fragmentShader:oL}),this.historyRenderTarget=new dt(1024,1024,{minFilter:rt,stencilBuffer:!1,depthBuffer:!1}),this.historyRenderTarget.texture.name="TAA.History",this.resultRenderTarget=new dt(1024,1024,{minFilter:rt,stencilBuffer:!1,depthBuffer:!1}),this.resultRenderTarget.texture.name="TAA.Output"}setSize(e,r){this.historyRenderTarget.setSize(e,r),this.resultRenderTarget.setSize(e,r)}render(e,r){this.fullscreenMaterial=this.resolveMaterial,this.resolveMaterial.uniforms.inputBuffer.value=r.texture[0],this.resolveMaterial.uniforms.velocityBuffer.value=r.texture[1],this.resolveMaterial.uniforms.depthBuffer.value=r.depthTexture,this.resolveMaterial.uniforms.historyBuffer.value=this.historyRenderTarget.texture,this.resolveMaterial.uniforms.resolution.value.set(r.width,r.height),e.setRenderTarget(this.resultRenderTarget),e.render(this.scene,this.camera),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,e.setRenderTarget(this.historyRenderTarget),e.render(this.scene,this.camera);let i=this.renderToScreen?null:r;this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,e.setRenderTarget(i),e.render(this.scene,this.camera)}dispose(){this.resultRenderTarget.dispose(),this.historyRenderTarget.dispose(),this.resolveMaterial.dispose(),this.passThroughMaterial.dispose()}};var Ox=class extends xi{constructor(e,r,i){super("TransmissionPass",void 0,r);this.MRTCompatible=!0;this.depthPass=new eT(e,r,{renderTarget:i.transmissionDepthTarget}),this.passThroughMaterial=new Af,this.splineScene=e,this.needsSwap=!1}updatePasses(e){this.passThroughMaterial=new Af,this.depthPass=new eT(this.splineScene,this.camera,{renderTarget:e.transmissionDepthTarget})}setCamera(e){this.camera=e}setScene(e){this.splineScene=e}render(e,r,i){let s=this.camera.layers.mask,o=e;o.setRenderTarget(o.transmissionRenderTarget),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=r.texture[0],o.clear(),o.render(this.scene,this.camera),this.camera.layers.disable(3),this.depthPass.render(e,r,i),o.shadowMap.needsUpdate=!1,o.shadowMap.autoUpdate=!1;let a=this.renderToScreen?null:r;this.camera.layers.set(3),e.setRenderTarget(a),e.render(this.splineScene,this.camera),this.camera.layers.mask=s}};var cL=new ei,LQ=new it({transparent:!0,vertexShader:` void main() { gl_Position = vec4(0.0); } `,fragmentShader:` layout(location = 1) out vec4 gVelocity; void main() { gl_FragColor = vec4(0.0); gVelocity = vec4(0.0); } `}),ru=class extends xi{constructor(e,r,i){super("OpaquePass",r??cL,i);this.MRTCompatible=!0;this.hasTransmissionPass=!1;this.clear=!0;this.clearColorOnly=!1;this.clearDepth=!1;this.needsSwap=!1,this.originalMaterials=new Map,this.MRTCompatible=e}setCamera(e){this.camera=e}setScene(e){this.scene=e??cL}getScene(){return this.scene}render(e,r){this.camera.layers.enable(3),this.hasTransmissionPass&&(this.originalMaterials.clear(),this.scene.traverse(s=>{s.layers.isEnabled(3)&&s instanceof mr&&(this.originalMaterials.set(s.id,s.material),s.material=LQ)}),e.shadowMap.needsUpdate=!0,e.shadowMap.autoUpdate=!0),this.camera.layers.enable(8);let i=this.renderToScreen?null:r;e.setRenderTarget(i),this.clearColorOnly&&e.clear(!0,!1,!0),this.clear&&e.clear(),e.render(this.scene,this.camera),this.clearDepth&&e.clear(!1,!0,!1),this.hasTransmissionPass&&this.originalMaterials.forEach((s,o)=>{let a=this.scene.getObjectById(o);a&&(a.material=s)})}};var Rx=class{constructor(t,{depthBuffer:e=!0,stencilBuffer:r=!1,multisampling:i=0,frameBufferType:s=0}={}){this.renderer=t;this.helperStartIndex=0;this.copyPass=new Um;this.depthTexture=null;this.timer=new K3;this._width=1;this._height=1;this.passes=[];this.helperPasses=[];this.autoRenderToScreen=!0;this.inputBuffer=this.createBuffer(e,r,s,i,!0,"input buffer mrt"),this.inputBufferSingle=this.createBuffer(e,r,s,i,!1," input buffer single"),this.inputBufferSingle.texture.dispose(),this.inputBufferSingle.depthTexture.dispose(),this.inputBufferSingle.texture=this.inputBuffer.texture[0],this.inputBufferSingle.depthTexture=this.inputBuffer.depthTexture,this.outputBuffer=this.inputBuffer.clone(),this.outputBuffer.name="output buffer mrt",this.outputBufferSingle=this.createBuffer(e,r,s,i,!1,"output buffer single"),this.outputBufferSingle.texture.dispose(),this.outputBufferSingle.depthTexture.dispose(),this.outputBufferSingle.texture=this.outputBuffer.texture[0],this.outputBufferSingle.depthTexture=this.outputBuffer.depthTexture,this.setRenderer(t)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(t){let e=this.inputBuffer,r=this.multisampling;r>0&&t>0?(this.inputBuffer.samples=t,this.outputBuffer.samples=t,this.inputBuffer.dispose(),this.outputBuffer.dispose()):r!==t&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("creating new input buffer"),this.inputBuffer=this.createBuffer(e.depthBuffer,e.stencilBuffer,e.texture.type,t,!0,"new input buffer"),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(t){if(this.renderer=t,t!==null){let e=t.getSize(new k),r=t.getContext().getContextAttributes()?.alpha??!1,i=this.inputBuffer.texture[0].type;i===_r&&t.outputEncoding===at&&(this.inputBuffer.texture[0].encoding=at,this.outputBuffer.texture[0].encoding=at,this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("doing some kinda dispose??")),t.autoClear=!1,this.setSize(e.width,e.height,!1);for(let s of this.passes)s.initialize(t,r,i)}}replaceRenderer(t,e=!0){let r=this.renderer,i=r.domElement.parentNode;return this.setRenderer(t),e&&i!==null&&(i.removeChild(r.domElement),i.appendChild(t.domElement)),r}createDepthTexture(){let t=this.depthTexture=new ns(this._width,this._height);return this.inputBuffer.depthTexture=t,this.inputBuffer.stencilBuffer?(t.format=il,t.type=el):t.type=Ds,t}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(let t of this.passes)t.setDepthTexture(null)}}createBuffer(t,e,r,i,s,o){let a=this.renderer,l=a===null?new k:a.getDrawingBufferSize(new k),c={minFilter:rt,magFilter:rt,wrapS:Qt,wrapT:Qt,stencilBuffer:e,depthBuffer:t},u;return i>0?(u=new dt(l.width,l.height,c),u.samples=i):(s?(u=new fy(l.width,l.height,2,c),u.texture[1].type=Wn):u=new dt(l.width,l.height,c),u.depthTexture=new ns(2048,2048),u.depthTexture.type=br),r===_r&&a!==null&&a.outputEncoding===at&&(Array.isArray(u.texture)?u.texture.forEach(h=>h.encoding=at):u.texture.encoding=at),Array.isArray(u.texture)?u.texture.forEach((h,d)=>{h.name=`EffectComposer.Buffer ${s} ${d}`,h.generateMipmaps=!1}):(u.texture.name=`EffectComposer.Buffer ${s}`,u.texture.generateMipmaps=!1),u.name=o,u}addPass(t,e){let r=this.passes,i=this.renderer,s=i.getDrawingBufferSize(new k),o=i.getContext().getContextAttributes()?.alpha??!1,a;if(t.MRTCompatible&&(a=this.inputBuffer.texture[0].type),t.MRTCompatible||(a=this.inputBuffer.texture.type),t.setRenderer(i),t.setSize(s.width,s.height),t.initialize(i,o,a),this.autoRenderToScreen&&(r.length>0&&(r[r.length-1].renderToScreen=!1),t.renderToScreen&&(this.autoRenderToScreen=!1)),e!==void 0?r.splice(e,0,t):r.push(t),this.autoRenderToScreen&&(r[r.length-1].renderToScreen=!0),t.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){let l=this.createDepthTexture();for(t of r)t.setDepthTexture(l)}else t.setDepthTexture(this.depthTexture)}setHelperStartIndex(t){this.helperStartIndex=t}removePass(t){let e=this.passes,r=e.indexOf(t);if(r!==-1&&e.splice(r,1).length>0){if(this.depthTexture!==null){let o=(l,c)=>l||c.needsDepthTexture;e.reduce(o,!1)||t.getDepthTexture()===this.depthTexture&&t.setDepthTexture(null)}this.autoRenderToScreen&&r===e.length&&(t.renderToScreen=!1,e.length>0&&(e[e.length-1].renderToScreen=!0))}}removeAllPasses(){let t=this.passes;t.length>0&&(this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!1),this.passes=[])}render(t){let e=this.renderer,r=this.copyPass,i=this.inputBuffer,s=this.outputBuffer,o=this.inputBufferSingle,a=this.outputBufferSingle,l=!1,c,u,h,d;t===void 0&&(t=this.timer.update().getDelta());for(let f of this.passes)f.enabled&&(f.MRTCompatible?f.render(e,i,s,t,l):f.render(e,o,a,t,l),f.needsSwap&&(l&&(r.renderToScreen=f.renderToScreen,c=e.getContext(),u=e.state.buffers.stencil,u.setFunc(c.NOTEQUAL,1,4294967295),r.render(e,i,s,t,l),u.setFunc(c.EQUAL,1,4294967295)),h=i,d=o,i=s,o=a,s=h,a=d),f instanceof X3?l=!0:f instanceof Y3&&(l=!1))}setSize(t,e,r){let i=this.renderer;if(this._width=t,this._height=e,t===void 0||e===void 0){let o=i.getSize(new k);t=o.width,e=o.height}i.setSize(t,e,r);let s=i.getDrawingBufferSize(new k);this.inputBuffer.setSize(s.width,s.height),this.outputBuffer.setSize(s.width,s.height),this.inputBufferSingle.setSize(s.width,s.height),this.outputBufferSingle.setSize(s.width,s.height);for(let o of this.passes)o.setSize(s.width,s.height)}reset(){let t=this.timer.isAutoResetEnabled();this.dispose(),this.autoRenderToScreen=!0,this.timer.setAutoResetEnabled(t)}dispose(){for(let t of this.passes)t.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.inputBufferSingle!==null&&this.inputBufferSingle.dispose(),this.outputBufferSingle!==null&&this.outputBufferSingle.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}};var BQ=new it({name:"CombineMaterial",uniforms:{inputBufferA:new le(null),inputBufferB:new le(null)},blending:$t,depthWrite:!1,depthTest:!1,vertexShader:` varying vec2 vUv; void main() { gl_Position = vec4(position.xy, 1.0, 1.0); vUv = position.xy * 0.5 + 0.5; } `,fragmentShader:` varying vec2 vUv; uniform sampler2D inputBufferA; uniform sampler2D inputBufferB; // TODO: Why do we need these when postpro of framemode is enabled??? layout(location = 1) out vec4 gVelocity; void main() { vec4 resA = texture2D(inputBufferA, vUv); vec4 resB = texture2D(inputBufferB, vUv); float a = resA.a + resB.a * ( 1.0 - resA.a ); vec4 res; res.rgb = resA.rgb + (resB.rgb * (1.0 - resA.a)); res.a = resA.a + resB.a * (1.0 - resA.a); gl_FragColor = res; gVelocity = vec4(0.0); } `}),Lx=class extends xi{constructor(e){super("HelperPass",void 0,e);this.MRTCompatible=!1;this.fullscreenMaterial=BQ,this.helperPass=new ru(!1,void 0,this.camera),this.helperPass.hasTransmissionPass=!1,this.helperPass.clear=!1,this.helperPass.renderToScreen=!1,this.helperPassOnTop=new ru(!1,void 0,this.camera),this.helperPassOnTop.hasTransmissionPass=!1,this.helperPassOnTop.clear=!1,this.helperPassOnTop.renderToScreen=!1;let r=new Ix({preset:Ua.LOW,edgeDetectionMode:ff.COLOR});this.effectPass=new tu(this.camera,r),this.rt=new dt(10,10,{minFilter:rt,magFilter:rt,wrapS:Qt,wrapT:Qt,depthBuffer:!0})}setSize(e,r){this.rt.setSize(e,r),this.effectPass.setSize(e,r)}set sceneHelpers(e){this.helperPass.setScene(e)}get sceneHelpers(){return this.helperPass.getScene()}set sceneHelpersOnTop(e){this.helperPassOnTop.setScene(e)}get sceneHelpersOnTop(){return this.helperPassOnTop.getScene()}setCamera(e){this.helperPass.setCamera(e),this.helperPassOnTop.setCamera(e)}initialize(e,r,i){super.initialize(e,r,i),this.effectPass.initialize(e,r,i)}dispose(){super.dispose(),this.rt.dispose(),this.effectPass.dispose()}render(e,r,i){this.rt.depthTexture=r.depthTexture;let s=e.getClearAlpha();e.setClearAlpha(0),this.helperPass.clearDepth=!0,this.helperPass.clearColorOnly=!0,this.helperPass.render(e,this.rt),this.helperPassOnTop.render(e,this.rt),this.effectPass.renderToScreen=!1,this.effectPass.render(e,this.rt,i),this.fullscreenMaterial.uniforms.inputBufferA.value=i.texture,this.fullscreenMaterial.uniforms.inputBufferB.value=r.texture,e.setClearAlpha(s),e.setRenderTarget(null),e.clear(),e.render(this.scene,this.camera)}};var uL=`#define GLSLIFY 1 #include #include out vec3 n;void main(){ #include #include #include #include #include #include #include #include vec4 view_space=viewMatrix*modelMatrix*vec4(transformed,1.0);gl_Position=projectionMatrix*view_space;n=normalize(transformedNormal);}`;var hL=`#define GLSLIFY 1 in vec3 n;void main(){gl_FragColor=vec4(n,1.0);}`;var dL=`#define GLSLIFY 1 out vec2 v_uv;void main(){v_uv=uv;gl_Position=vec4(position.xy,1.0,1.0);}`;var fL=`#define GLSLIFY 1 in vec2 v_uv;const float pi=3.14159265;const float num_steps=4.0;const float num_directions=4.0;uniform float near;uniform float far;uniform float fov;uniform vec4 proj_info;uniform bool is_ortho;uniform vec2 resolution;uniform float radius_of_influence;uniform float radius_in_screen_space;uniform float exponent;uniform vec3 ao_color;uniform float bias;uniform sampler2D texture_depth;uniform sampler2D texture_normals;uniform sampler2D texture_blue_noise;uniform sampler2D texture_blue_noise_in_disk;uniform sampler2D texture_color_pass;uniform int frame_index;uniform bool fog_enabled;uniform float fog_near;uniform float fog_far;vec3 uv_to_view_space(vec2 uv,float eye_z){return vec3((uv*proj_info.xy+proj_info.zw)*(is_ortho ? 1.0 : eye_z),eye_z);}float linearize_depth(float depth_sampled){float z=is_ortho ? depth_sampled : depth_sampled*2.0-1.0;return mix((2.0*near*far)/(far+near-z*(far-near)),near+z*(far-near),float(is_ortho));}vec3 get_view_position(vec2 uv_coords){float linear_depth=linearize_depth(texture(texture_depth,uv_coords).x);return uv_to_view_space(uv_coords,linear_depth);}vec3 min_difference(vec3 p,vec3 right,vec3 left){vec3 v1=right-p;vec3 v2=p-left;return(dot(v1,v1)=far){final=1.0;}vec3 color=mix(ao_color,vec3(1.0),final);if(fog_enabled){float fog_factor=smoothstep(fog_near,fog_far,view_space_p.z);color=mix(color,vec3(1.0),fog_factor);}gl_FragColor=vec4(color,1.0);}`;var pL=`#define GLSLIFY 1 out vec2 v_uv;void main(){gl_Position=vec4(position.xy,1.0,1.0);v_uv=uv;}`;var mL=`#define GLSLIFY 1 in vec2 v_uv;uniform sampler2D texture_ao_lrez;uniform sampler2D texture_depth_lrez;uniform sampler2D texture_depth_hrez;uniform float near;uniform float far;float linearize_depth(float depth_sampled){float z=depth_sampled*2.0-1.0;return(2.0*near*far)/(far+near-z*(far-near));}vec2 nearest_depth_filter(in vec2 uv){vec2 resolution=vec2(textureSize(texture_depth_lrez,0));vec2 texel_size=1.0/resolution;vec2 offset=uv-0.5*texel_size;float d_hrez=texture(texture_depth_hrez,uv).r;float a=abs(d_hrez-texture(texture_depth_lrez,offset).r);float b=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(texel_size.x,0.0)).r);float c=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(0.0,texel_size.y)).r);float d=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(texel_size.x,texel_size.y)).r);float min_diff=min(a,min(b,min(c,d)));if(min_diff==a)return offset;if(min_diff==b)return offset+vec2(texel_size.x,0.0);if(min_diff==c)return offset+vec2(0.0,texel_size.y);if(min_diff==d)return offset+vec2(texel_size.x,texel_size.y);}void main(){ #ifdef DEBUG float d_lrez=texture(texture_depth_lrez,v_uv).r;float d_hrez=texture(texture_depth_hrez,v_uv).r;float output_d=mix(linearize_depth(d_lrez)/far,linearize_depth(d_hrez)/far,step(0.5,v_uv.x));gl_FragColor=vec4(vec3(output_d),1.0); #else vec2 filtered_uv=nearest_depth_filter(v_uv);vec4 ao=texture(texture_ao_lrez,filtered_uv);gl_FragColor=vec4(ao.rgb,1.0);gl_FragColor=ao; #endif }`;var Ef=[[.478712,.875764],[-.337956,-.793959],[-.955259,-.028164],[.864527,.325689],[.209342,-.395657],[-.106779,.672585],[.156213,.235113],[-.413644,-.082856],[-.415667,.323909],[.141896,-.93998],[.954932,-.182516],[-.766184,.410799],[-.434912,-.458845],[.415242,-.078724],[.728335,-.491777],[-.058086,-.066401],[.20299,.686837],[-.808362,-.556402],[.507386,-.640839],[-.723494,-.22924],[.48974,.317826],[-.622663,.765301],[-.01064,.929347],[.663146,.647618],[-.096674,-.413835],[.525945,-.321063],[-.122533,.366019],[.195235,-.687983],[-.563203,.098748],[.418563,.561335],[-.378595,.800367],[.826922,.001024],[-.085372,-.766651],[-.92192,.183673],[-.590008,-.721799],[.167751,-.164393],[.032961,-.56253],[.6329,-.107059],[-.46408,.569669],[-.173676,-.958758],[-.242648,-.234303],[-.275362,.157163],[.382295,-.795131],[.562955,.115562],[.190586,.470121],[.770764,-.297576],[.237281,.93105],[-.666642,-.455871],[-.905649,-.298379],[.33952,.157829],[.701438,-.7041],[-.062758,.160346],[-.220674,.957141],[.642692,.432706],[-.77339,-.015272],[-.671467,.24688],[.158051,.062859],[.806009,.527232],[-.05762,-.247071],[.333436,-.51671],[-.550658,-.315773],[-.652078,.589846],[.008818,.530556],[-.210004,.519896]];var GQ=new it({vertexShader:uL,fragmentShader:hL}),Tf=new it({vertexShader:pL,fragmentShader:mL,uniforms:{texture_ao_lrez:new le(null),texture_depth_lrez:new le(null),texture_depth_hrez:new le(null),near:new le(null),far:new le(null)}}),Bx=class extends xi{constructor(e,r){super("AmbientOcclusionPass",void 0,r);this.fogEnabled=!1;this.fogNear=1;this.fogFar=1e3;this.frameIndex=0;this._runHalfRes=!0;this._width=1;this._height=1;let i=1024,s=1024;this.gBuffer=new dt(i,s,{type:xo?Wn:br,depthTexture:new ns(i,s),minFilter:rt,magFilter:rt}),this.depthBufferHighRes=new dt(i,s,{depthTexture:new ns(i,s)}),this.aoBuffer=new dt(i,s,{minFilter:rt,magFilter:rt}),this.splineScene=e,this.splineCamera=r;let o=new Float32Array(Ef.length*2);for(let l=0;l with size float rectangle(vec2 st, vec2 size) { size = vec2(0.5) - size * 0.5; vec2 uv = vec2(step(size.x, st.x), step(size.y, st.y)); uv *= vec2(step(size.x, 1.0 - st.x), step(size.y, 1.0 - st.y)); return uv.x * uv.y; } uniform vec2 uSize; uniform float uScale; uniform float uDPR; uniform float uCurrent; uniform vec3 uSceneColor; void main() { vec2 screenUv = gl_FragCoord.xy / uResolution.xy; screenUv *= 1.0 / uDPR; vec2 center = vec2(0.5, -0.5); vec2 outsideUv = screenUv; outsideUv += center; outsideUv -= uCoords.xy / uResolution.xy; outsideUv = (outsideUv - 0.5) + 0.5; outsideUv -= center; vec2 s = (uSize / uResolution) * uScale; float isOutside = 1.0 - rectangle(outsideUv, s); vec2 mid = vec2(0.5); vec2 insideUv = (screenUv - mid + s * mid) / s; vec4 background = texture2D(tInput, screenUv); vec4 image = texture2D(tMap, insideUv); gl_FragColor = mix(image, background, isOutside); } `,Nx=class extends hn{constructor(){super(new it({vertexShader:jQ,fragmentShader:HQ,uniforms:{tInput:new le(null),tMap:new le(null),uResolution:new le(new k),uSize:new le(new k),uCoords:new le(new k),uScale:new le(1),uSceneColor:new le(new We(16711680)),uDPR:new le(1),uCurrent:new le(0)}}),"tInput"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.tMap.value}set texture(t){this.uniforms.tMap.value=t}};var WQ=` void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`,qQ=` uniform sampler2D toScene; uniform sampler2D fromScene; uniform vec2 resolution; uniform vec2 uResolution; uniform float uDPR; uniform float mixRatio; uniform sampler2D tMixTexture; uniform int useTexture; uniform float threshold; void main() { vec2 screenUv = gl_FragCoord.xy / uResolution.xy; screenUv *= 1.0 / uDPR; vec4 texel1 = texture2D( fromScene, screenUv ); vec4 texel2 = texture2D( toScene, screenUv ); if (useTexture==1) { vec4 transitionTexel = texture2D( tMixTexture, screenUv ); float r = mixRatio * (1.0 + threshold * 2.0) - threshold; float mixf=clamp((transitionTexel.r - r)*(1.0/threshold), 0.0, 1.0); gl_FragColor = mix( texel1, texel2, mixf ); } else { gl_FragColor = mix( texel1, texel2, mixRatio ); } } `,YQ=[],Fx=class extends hn{constructor(){super(new it({vertexShader:WQ,fragmentShader:qQ,uniforms:{toScene:new le(null),fromScene:new le(null),uResolution:new le(new k),uDPR:new le(1),mixRatio:new le(0),threshold:new le(.1),useTexture:new le(0),tMixTexture:{value:YQ[0]}}}),"toScene"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.fromScene.value}set texture(t){this.uniforms.fromScene.value=t}};var XQ=` void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`,KQ=` uniform sampler2D inputBuffer; uniform sampler2D blurredInputBuffer; uniform sampler2D overlay; uniform float blurIntensity; uniform vec2 uResolution; uniform float uDPR; void main() { vec2 screenUv = gl_FragCoord.xy / uResolution.xy; screenUv *= 1.0 / uDPR; vec4 texel1 = texture2D( overlay, screenUv ); vec4 texel2 = texture2D( inputBuffer, screenUv ); vec4 texel3 = texture2D( blurredInputBuffer, screenUv ); float blurMask2 = max(sign(texel1.a), 0.0) * blurIntensity; gl_FragColor = mix( mix(texel2, texel3, blurMask2), texel1, texel1.a ); } `,Vx=class extends hn{constructor(){super(new it({vertexShader:XQ,fragmentShader:KQ,uniforms:{inputBuffer:new le(null),blurredInputBuffer:new le(null),overlay:new le(null),uResolution:new le(new k),uDPR:new le(1),blurIntensity:new le(0)}}));this._blurEnabled=!1;this.blurTarget=new dt(1,1,{minFilter:rt,magFilter:rt,wrapS:Qt,wrapT:Qt}),this.blurPass=new _x({width:window.innerWidth,height:window.innerHeight,kernelSize:zm.HUGE,resolutionScale:.25}),this.blurPass.renderToScreen=!1,this.uniforms.blurredInputBuffer.value=this.blurTarget.texture}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.overlay.value}set texture(e){this.uniforms.overlay.value=e}setResolution(e,r,i=1){this.uniforms.uResolution.value.set(e,r),this.uniforms.uDPR.value=i,this.blurPass.setSize(e,r),this.blurTarget.setSize(e,r),this.blurPass.setSize(e,r)}get uiCanvas(){return this._uiCanvas}set uiCanvas(e){this._uiCanvas=e,e.texture&&(this.uniforms.overlay.value=e.texture);let i=e.frame;if(i){let s=i.data.backgroundBlur,o=s.radius;this._blurEnabled=s.enabled,this.uniforms.blurIntensity.value=this._blurEnabled?1:0,this.blurPass.scale=o/3}}render(e,r,i,s,o){this._blurEnabled&&(this.blurPass.setDepthTexture(this.getDepthTexture()),this.blurPass.render(e,r,this.blurTarget,s,o)),super.render(e,r,i,s,o)}};var QQ=` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`,ZQ=` uniform sampler2D tInput; uniform sampler2D tOverlayImage; varying vec2 vUv; uniform vec2 uResolution; uniform vec2 uRightBottom; uniform vec2 uImageSize; uniform float uScale; uniform float uDPR; vec3 blendNormal(vec3 base, vec3 blend) { return blend; } vec3 blendNormal(vec3 base, vec3 blend, float opacity) { return (blendNormal(base, blend) * opacity + base * (1.0 - opacity)); } vec4 drawFixedSizeImage(sampler2D image, vec2 screenUV, vec2 imageSize, vec2 imageCoords, vec2 screenSize, float dpr) { vec2 uv = (screenUV * screenSize * dpr - imageCoords) / (imageSize * dpr); if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) { return vec4(0.0); } return texture2D(image, uv); } void main() { vec2 screenUV = gl_FragCoord.xy / (uResolution.xy * uDPR); vec2 imageCoords = vec2(uResolution.x * uDPR - uImageSize.x * uScale * uDPR - uRightBottom.x * uDPR, uRightBottom.y * uDPR); vec4 background = texture2D(tInput, screenUV); vec4 image = drawFixedSizeImage(tOverlayImage, screenUV, uImageSize * uScale, imageCoords, uResolution, uDPR); gl_FragColor = vec4(blendNormal(background.rgb, image.rgb, image.a), max(background.a, image.a)); } `,kx=class extends hn{constructor(){super(new it({vertexShader:QQ,fragmentShader:ZQ,uniforms:{tInput:new le(null),tOverlayImage:new le(null),uResolution:new le(new k),uImageSize:new le(new k),uRightBottom:new le(new k(20,20)),uScale:new le(.25),uDPR:new le(1)}}),"tInput")}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.tOverlayImage.value}set texture(t){this.uniforms.tOverlayImage.value=t,this.uniforms.uImageSize.value.set(t.image.width,t.image.height)}};function yL(n,t){return t&&t.enabled&&n.push(t.effect),n}var JQ=n=>Object.values(Pt).includes(n)?n:Pt.NORMAL,Gm=class extends pr{constructor(e,r){super();this._needsDOFResize=r;this.postprocessingState=qh.defaultData;this._scene=new ei;this._camera=new wr;this.effects=new Map;this.blueNoiseTexture=new gi;this._renderToScreen=!0;this._isUIOverlayEnabled=!1;this.clock=new Py,this.renderer=e,this.debug=!1,this.effects.set("bloom",new pf),this.effects.set("chromaticAberration",new gf),this.effects.set("vignette",new bf),this.effects.set("noise",new xf),this.effects.set("colorAverage",new yf),this.effects.set("hueSaturation",new vf),this.effects.set("brightnessContrast",new mf),this.effects.set("depthOfField",new Sf),this.effects.set("pixelation",new wf),this.effectComposer=new Rx(this.renderer),this.effectComposer.autoRenderToScreen=!1,this.opaquePass=new ru(!0,this.scene,this.camera),this.opaquePass.clear=!0,this.transmissionPass=new Ox(this.scene,this.camera,this.renderer),this.aoPass=new Bx(this.scene,this.camera),this.taaPass=new Dx,this.taaPass.renderToScreen=!1,this.helperPass=new Lx(this.camera),this.helperPass.renderToScreen=!1,this.stylesOverlayPass=new Nx,this.stylesOverlayPass.enabled=!1,this.uiOverlayPass=new Vx,this.uiOverlayPass.enabled=!1,this.logoOverlayPass=new kx,this.logoOverlayPass.enabled=!1,this.sceneTransitionPass=new Fx,this.sceneTransitionPass.enabled=!1,this._initCopyPass(),this._initPasses()}set overlayTexture(e){e!==void 0?(this.stylesOverlayPass.texture=e,this.stylesOverlayPass.enabled=!0):this.stylesOverlayPass.enabled=!1}get overlayTexture(){return this.stylesOverlayPass.texture}set sceneHelpers(e){this.helperPass.sceneHelpers=e}get sceneHelpers(){return this.helperPass.sceneHelpers}set sceneHelpersOnTop(e){this.helperPass.sceneHelpersOnTop=e}get sceneHelpersOnTop(){return this.helperPass.sceneHelpersOnTop}get scene(){return this._scene}set scene(e){this._scene=e,this.opaquePass.setScene(e),this.transmissionPass.setScene(e),this.aoPass.setScene(e)}get camera(){return this._camera}set camera(e){let r=this._camera!==e;this._camera=e,this.opaquePass.setCamera(e),this.transmissionPass.setCamera(e),r&&this.transmissionPass.updatePasses(this.renderer),this.aoPass.setCamera(e),this.helperPass.setCamera(e),this.effects.get("depthOfField").setCamera(e)}updateRenderToScreen(){let e=!1;for(let r=this.effectComposer.passes.length-1;r>=0;r--){let i=this.effectComposer.passes[r];if(i.enabled===!0&&!e&&this._renderToScreen){i.renderToScreen=!0,e=!0;continue}i.renderToScreen=!1}}get isUIOverlayEnabled(){return this._isUIOverlayEnabled}disableUIOverlay(){this._isUIOverlayEnabled=!1}enableUIOverlay(){this._isUIOverlayEnabled=!0}disableHelpers(){this.helperPass.enabled=!1,this.updateRenderToScreen()}enableHelpers(){this.helperPass.enabled=!0,this.updateRenderToScreen()}updateBlueNoiseTexture(e){this.blueNoiseTexture=new gi(e,128,128),this.blueNoiseTexture.wrapS=Rs,this.blueNoiseTexture.wrapT=Rs,this.blueNoiseTexture.minFilter=Vt,this.blueNoiseTexture.magFilter=Vt,this.blueNoiseTexture.needsUpdate=!0}setAmbientOcclusionParams(e,r,i,s,o,a,l,c){this.aoPass.enabled=e,this.aoPass.radius=r,this.aoPass.bias=i,this.aoPass.aoColor=s,this.aoPass.fogEnabled=o,this.aoPass.fogNear=a,this.aoPass.fogFar=l,this.aoPass.runHalfRes!==!c&&(this.aoPass.runHalfRes=!c)}setTransmissionPassEnabled(e){this.transmissionPass.enabled=e,this.opaquePass.hasTransmissionPass=e}_initPasses(){if(this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.removeAllPasses(),this.transmissionPass.updatePasses(this.renderer),this.effectComposer.addPass(this.aoPass),this.effectComposer.addPass(this.opaquePass),this.effectComposer.addPass(this.transmissionPass),this.effectComposer.addPass(this.taaPass),this.postprocessingState.enabled){let e=[this.effects.get("pixelation")].reduce(yL,[]);e.length>0&&(this.uvEffectPass=new tu(this.camera,...e),this.uvEffectPass.renderToScreen=!1,this.effectComposer.addPass(this.uvEffectPass));let r=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("depthOfField"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(yL,[]);if(r.length>0&&(this.effectPass=new tu(this.camera,...r),this.effectPass.renderToScreen=!1,this.effectComposer.addPass(this.effectPass),this._needsDOFResize&&this.effects.get("depthOfField")?.enabled&&window!==void 0)){let i=this.renderer.viewportWidth,s=this.renderer.viewportHeight;this.renderer.setSize(i-1,s-1),this.renderer.setSize(i,s)}}this.effectComposer.addPass(this.stylesOverlayPass),this.effectComposer.addPass(this.uiOverlayPass),this.effectComposer.addPass(this.sceneTransitionPass),this.effectComposer.addPass(this.helperPass),this.effectComposer.addPass(this.logoOverlayPass)}_initCopyPass(){if(this._savePass)return;let e=new k;this.renderer.getDrawingBufferSize(e),this._rt=new dt(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:Rs,wrapT:Rs}),this._rt.samples=0,this._savePass=new Um(this._rt,!1),this._savePass.renderToScreen=!1}setCopyPass(e){this._rt=e,this._savePass=new Um(this._rt,!1),this.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){if(this._renderToScreen===e)return;let r=this.effectComposer;!r||(e===!0?r.removePass(this._savePass):r.addPass(this._savePass),this._renderToScreen=e,this.updateRenderToScreen())}set sceneTransitionFromTexture(e){e!==this.sceneTransitionPass.texture&&(e!==null?this.sceneTransitionPass.enabled=!0:(this.sceneTransitionPass.enabled=!1,this.updateRenderToScreen()),this.sceneTransitionPass.texture=e)}setWatermark(e){this.logoOverlayPass.enabled=e!==null,e&&(this.logoOverlayPass.texture=e)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}updatePostprocessing(e){let{enabled:r,...i}=e,s=!1;r!==this.postprocessingState.enabled&&(s=!0);for(let o of Object.entries(i)){let a=o[1],l=this.effects.get(o[0]);if(l){l.enabled!==a.enabled&&(s=!0),l.enabled=a.enabled;for(let[c,u]of Object.entries(a))c==="blendFunction"?l.blendFunction=JQ(u):l[c]=u}}this.postprocessingState=e,s&&this._initPasses()}render(){this.effectComposer.render(this.clock.getDelta())}setScissor(e,r,i,s){e instanceof Ze?(this.effectComposer.inputBuffer.scissor.set(e.x,e.y,e.z,e.w),this.effectComposer.outputBuffer.scissor.set(e.x,e.y,e.z,e.w)):(this.effectComposer.inputBuffer.scissor.set(e,r,i,s),this.effectComposer.outputBuffer.scissor.set(e,r,i,s));let o=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(o),this.effectComposer.outputBuffer.scissor.multiplyScalar(o),this.renderer.setScissor(e,r,i,s)}setScissorTest(e){this.effectComposer.inputBuffer.scissorTest=e,this.effectComposer.outputBuffer.scissorTest=e,this.renderer.setScissorTest(e)}setViewport(e,r,i,s){e instanceof Ze?(this.effectComposer.inputBuffer.viewport.copy(e),this.effectComposer.outputBuffer.viewport.copy(e)):(this.effectComposer.inputBuffer.viewport.set(e,r,i,s),this.effectComposer.outputBuffer.viewport.set(e,r,i,s))}resize(e,r,i){if(this.effectComposer.setSize(e,r,i),this._rt){let s=this.renderer.getPixelRatio();this._rt.setSize(e*s,r*s)}}dispose(){this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.dispose()}};var $Q=n=>` // PCSS implementation based on: // https://www.gamedev.net/articles/programming/graphics/contact-hardening-soft-shadows-made-fast-r4906/ // NOTE: This number affects how big the shadow blur can // possibly get. Bigger number == bigger blur, but less precise results const float gPenumbraFilterSize = 80.0; const int gPenumbraSamples = ${n}; const int gShadowSamples = ${n}; const float gShadowSamplesRpc = 1.0f / float(gShadowSamples); #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif /* #if NUM_RECT_AREA_LIGHTS > 0 // TODO (abelnation): create uniforms for area light shadows #endif */ float computePenumbra(int index, sampler2D shadowMap, float temporalAngle, float texelSize, vec2 uv, float compare, float texelScalar, float shadowRadius) { float penumbra = 1.0; float blockerDepthAvg = 0.0; float blockerCount = 0.0; #pragma unroll_loop_start for(int i = 0; i < gPenumbraSamples; i ++) { vec2 offset = (vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize) * texelScalar; float depth = unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ); if(depth < compare + 0.0001) { blockerDepthAvg += depth; blockerCount++; } } #pragma unroll_loop_end if (blockerCount > 0.0) { blockerDepthAvg /= blockerCount; // Compute penumbra penumbra = (compare - blockerDepthAvg) / (blockerDepthAvg); penumbra *= penumbra; penumbra *= 200.0 * penumbraSize[min(index, ${5} - 1)]; // Magic number that affects how quickly the penumbra grows return clamp(penumbra, 0.00, 1.0); } return 0.0; } float vogelShadow(int index, sampler2D shadowMap, vec2 uv, float texelSize, float compare, float shadowRadius) { float shadow = 0.0f; // NOTE: When using TAA, we should use screen space interleaved gradient noise vec2 halton = haltonSequence[frameIndex]; float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton); float temporalAngle = temporalOffset * PI2; float texelScalar = (gPenumbraFilterSize) / (texelSize * 1024.); float penumbra = computePenumbra(index, shadowMap, temporalAngle, texelSize, uv, compare, texelScalar, shadowRadius); if (penumbra == -1.0) { return 1.0; } #pragma unroll_loop_start for (int i = 0; i < gShadowSamples; i++) { vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize; // Overall blurring offset vec2 offset = vogelSample * (shadowRadius * 2.); // Penumbra offset offset += vogelSample * (penumbra * texelScalar); shadow += step( compare, unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ) ); } #pragma unroll_loop_end return shadow * gShadowSamplesRpc; } float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); // Hard Shadow if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } float getShadow( int i, sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; // if ( something && something ) breaks ATI OpenGL shader compiler // if ( all( something, something ) ) using this instead bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); bool inFrustum = all( inFrustumVec ); bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); bool frustumTest = all( frustumTestVec ); if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; return vogelShadow(i, shadowMap, shadowCoord.xy, texelSize.x, shadowCoord.z, shadowRadius ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else // no percentage-closer filtering: shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return shadow; } // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D // vector suitable for 2D texture mapping. This code uses the following layout for the // 2D texture: // // xzXZ // y Y // // Y - Positive y direction // y - Negative y direction // X - Positive x direction // x - Negative x direction // Z - Positive z direction // z - Negative z direction // // Source and test bed: // https://gist.github.com/tschw/da10c43c467ce8afd0c4 vec2 cubeToUV( vec3 v, float texelSizeY ) { // Number of texels to avoid at the edge of each square vec3 absV = abs( v ); // Intersect unit cube float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; // Apply scale to avoid seams // two texels less per square (one texel will do for NEAREST) v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); // Unwrap // space: -1 ... 1 range for each square // // #X## dim := ( 4 , 2 ) // # # center := ( 1 , 1 ) vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } // Transform to UV space // scale := 0.5 / dim // translate := ( center + 0.5 ) / dim return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { float shadow = 1.0; vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); // for point lights, the uniform @vShadowCoord is re-purposed to hold // the vector from the light to the world-space position of the fragment. vec3 lightToPosition = shadowCoord.xyz; // dp = normalized distance from light to fragment position float compare = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp? compare += shadowBias; // bd3D = base direction 3D vec3 bd3D = normalize( lightToPosition ); vec2 halton = haltonSequence[frameIndex]; float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton); float temporalAngle = temporalOffset * PI2; #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_VSM ) for (int i = 0; i < gShadowSamples; i++) { vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize; // Overall blurring offset vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.); // NOTE: Removed for now // Penumbra offset //offset += vec3(vogelSample.x, vogelSample.y, vogelSample.y) * (penumbra * gPenumbraFilterSize); shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare ); } return shadow * gShadowSamplesRpc; #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) for (int i = 0; i < 16; i++) { vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize; // Overall blurring offset vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.); shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare ); } return shadow * (1.0 / 16.0); #else // no percentage-closer filtering return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), compare ); #endif } #endif `,eZ=xt.lights_fragment_begin,tZ=xt.shadowmask_pars_fragment,vL=null,rZ=n=>{switch(n){case"low":return 8;case"medium":return 16;case"high":return 32;default:return 16}},xL=(n="medium")=>{if(vL===n)return!1;vL=n;let t=rZ(n);xt.shadowmap_pars_fragment=$Q(t);let e=eZ.slice();e=e.replace("getShadow( spotShadowMap[ i ]",`getShadow( UNROLLED_LOOP_INDEX + ${3}, spotShadowMap[ i ]`),e=e.replace("getShadow( directionalShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX, directionalShadowMap[ i ]"),xt.lights_fragment_begin=e;let r=tZ.slice();return r=r.replaceAll("getShadow(","getShadow( UNROLLED_LOOP_INDEX, "),xt.shadowmask_pars_fragment=r,!0};var iZ=` attribute vec3 randomColor; varying vec3 vNormal; flat out vec3 vColor; #include #include void main() { #include #include #include #include vec3 transformed = vec3(position); #include #include vNormal = normal; vColor = randomColor; gl_Position = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0)); } `,nZ=` uniform float depthContrast; varying vec3 vNormal; flat in vec3 vColor; void main() { vec3 normal = (normalize(vNormal)).rgb; float contrastDepth = (gl_FragCoord.z - 0.5) * depthContrast + 0.5; vec3 resultColor = mix(mix(vColor, normal, 0.2), vec3(contrastDepth), 0.4); gl_FragColor = vec4(resultColor, vColor.r); gl_FragColor = vec4(resultColor, vColor.r); } `,Ux=new it({vertexShader:iZ,fragmentShader:nZ,uniforms:{depthContrast:{value:1}}});var bL=new er,SL=new k,zx=class extends Hw{constructor(e){super(e);this._pixelRatio=this.getPixelRatio();this.viewportWidth=1;this.viewportHeight=1;this.resolution=new k;this.dummyCamera=new wr;this.sceneTransitionDuration=0;this.sceneTransitionTimeRemaining=-1;this.isXRCopyPassSet=!1;this.clear=(e=!0,r=!0,i=!0)=>{let s=this.getContext(),o=0;e&&(o|=s.COLOR_BUFFER_BIT),r&&(o|=s.DEPTH_BUFFER_BIT),i&&(o|=s.STENCIL_BUFFER_BIT),s.clear(o),s.clearBufferfv(s.COLOR,1,[0,0,0,1])};this.pipeline=new Gm(this,e?.needsDOFResize??!1),this.autoClear=!1;let r=this.setPixelRatio.bind(this),i=this.setSize.bind(this);this.shadowMap.enabled=!0,this.shadowMap.type=Ly,this.dummyCamera.matrixAutoUpdate=!1,this.domElement.removeAttribute("data-engine");let s=this.getContext();if(s&&"drawingBufferColorSpace"in s)try{s.drawingBufferColorSpace="display-p3"}catch(o){console.warn(o)}this.setPixelRatio=o=>{this._pixelRatio!==o&&(this._pixelRatio=o,r(o))},this.setSize=(o,a,l=!0)=>{(this.viewportWidth!==o||this.viewportHeight!==a)&&(this.viewportWidth=o,this.viewportHeight=a,i(o,a,l),this.normalRenderTarget?.setSize(o*this._pixelRatio,a*this._pixelRatio),this._resizeTransmission(o,a),this.transmissionDepthTarget?.setSize(o*this._pixelRatio/2,a*this._pixelRatio/2),this.pipeline.resize(o,a,l))},this._superDispose=this.dispose,this.dispose=this._currentDispose}createAORenderTarget(){this.aoRenderTarget===void 0&&(this.aoRenderTarget=new dt(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:rt,magFilter:rt,wrapS:Qt,wrapT:Qt,depthBuffer:!1}))}_resizeTransmission(e,r){this.transmissionRenderTarget?.setSize(e*this._pixelRatio/(this.hdTransmission?1:2),r*this._pixelRatio/(this.hdTransmission?1:2)),this.aoRenderTarget?.setSize(e*this._pixelRatio/1,r*this._pixelRatio/1)}get hdTransmission(){return $e.transmissionLod.value===1}set hdTransmission(e){$e.transmissionLod.value=e===!0?1:2,this._resizeTransmission(this.viewportWidth,this.viewportHeight)}createTransmissionRenderTarget(){this.transmissionRenderTarget===void 0&&(this.transmissionRenderTarget=new dt(this.viewportWidth*this._pixelRatio/(this.hdTransmission?1:2),this.viewportHeight*this._pixelRatio/(this.hdTransmission?1:2),{generateMipmaps:!0,minFilter:xc,magFilter:rt,wrapS:Qt,wrapT:Qt,depthBuffer:!1}),this.transmissionDepthTarget=new dt(this.viewportWidth*this._pixelRatio/2,this.viewportHeight*this._pixelRatio/2,{minFilter:Vt,magFilter:Vt,depthBuffer:!1}))}createNormalRenderTarget(){this.normalRenderTarget===void 0&&(this.normalRenderTarget=new dt(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:Vt,magFilter:Vt,type:br,depthTexture:new ns(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio)}))}renderNormal(e,r,i){this.normalRenderTarget&&(this.setClearColor(0),i.layers.enable(8),i.layers.disable(0),i.layers.disable(3),r.traverseEntity(s=>{s.layers.isEnabled(8)&&(s.copyPreviousMatrix=!1)}),this.setRenderTarget(this.normalRenderTarget),this.clear(),i instanceof wr?Ux.uniforms.depthContrast.value=(i.far-i.near)/1e4:Ux.uniforms.depthContrast.value=1,r.overrideMaterial=Ux,this.render(r,i),this.setClearColor(r.bgColor,r.bgColor.a),this.setRenderTarget(null),r.overrideMaterial=e.wireframeState?Gx:null,i.layers.enable(0),i.layers.enable(3),r.traverseEntity(s=>{s.layers.isEnabled(8)&&(s.copyPreviousMatrix=!0)}))}renderSplineSceneWithDummyCamera(e,r,i=1){this.dummyCamera.updateCameraState(r.dataPatched),this.dummyCamera.matrix.copy(r.matrixWorld);let s=r.height,o=r.width,a=this.viewportWidth/this.viewportHeight;o{$e.penumbraSize.value[m]=p}),$e.pixelRatioNode.value=this.getPixelRatio(),this.resolution.x!==0&&this.resolution.y!==0?$e.resolution.value.set(this.resolution.x,this.resolution.y):$e.resolution.value.set(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio),a!==void 0?($e.normalRenderTarget.value=a,$e.normalRenderTargetDepth.value=bL):u.needsNormal()&&(this.createNormalRenderTarget(),$e.normalRenderTarget.value=this.normalRenderTarget.texture,$e.normalRenderTargetDepth.value=this.normalRenderTarget.depthTexture,this.renderNormal(u,l,r));let h=l.data.ao,d=h.occlusion;if(d&&(this.createAORenderTarget(),$e.aoRenderTarget.value=this.aoRenderTarget.texture),$e.aoEnabled.value=d,this.pipeline.setAmbientOcclusionParams(h.occlusion,h.radius,h.bias,l.aoColor,l.fog!==null,l.backupFog.near,l.backupFog.far,h.aoFullRes&&!xo),this.pipeline.aoPass.setBlueNoiseTexture(this.pipeline.blueNoiseTexture),this.pipeline.isUIOverlayEnabled&&l.uiCanvas?.enabled&&l.uiCanvas.texture&&l.uiCanvas.texture.image.width>0){let p=this.getSize(SL),m=this.getPixelRatio();(l.uiCanvas.width!==this.viewportWidth||l.uiCanvas.height!==this.viewportHeight||l.uiCanvas.dpr!==m)&&l.uiCanvas.applySize({width:this.viewportWidth,height:this.viewportHeight},m),l.uiCanvas.render(this),this.pipeline.uiOverlayPass.uiCanvas=l.uiCanvas,this.pipeline.uiOverlayPass.enabled=!0,this.pipeline.uiOverlayPass.setResolution(p.x,p.y,m),this.pipeline.updateRenderToScreen()}else this.pipeline.uiOverlayPass.enabled=!1,this.pipeline.updateRenderToScreen();if(this.pipeline.logoOverlayPass.enabled){let p=this.getSize(SL),m=this.getPixelRatio();this.pipeline.logoOverlayPass.uniforms.uResolution.value.set(p.x,p.y),this.pipeline.logoOverlayPass.uniforms.uDPR.value=m}let f=!1;if(o!==void 0)$e.transmissionRenderTarget.value=o,$e.transmissionRenderTargetDepth.value=bL,this.pipeline.setTransmissionPassEnabled(!1);else{let p=u.needsTransmission();p&&(this.transmissionRenderTarget===void 0&&(f=!0),this.createTransmissionRenderTarget(),$e.transmissionRenderTarget.value=this.transmissionRenderTarget.texture,$e.aspectRatio.value=DR(this.viewportWidth,this.viewportHeight),$e.transmissionRenderTargetDepth.value=this.transmissionDepthTarget.texture),this.pipeline.setTransmissionPassEnabled(p)}r.layers.enable(3),r.layers.enable(8),this.pipeline.sceneHelpers=i,this.pipeline.sceneHelpersOnTop=s,this.pipeline.scene=l,this.pipeline.camera=r,f&&this.pipeline.transmissionPass.updatePasses(this),this.pipeline.postprocessingState!==l.postprocessing&&(this.pipeline.updatePostprocessing(l.postprocessing),!i&&!s&&this.pipeline.disableHelpers()),this.clearAlphaOverride!==void 0&&this.setClearAlpha(this.clearAlphaOverride),l.overrideMaterial=u.wireframeState?Gx:null,this.pipeline.render(),$e.frameIndex.value=($e.frameIndex.value+1)%16,r instanceof wr&&r.copyHistory(),l.visible=c}renderFromSceneForSceneTransitionPass(e,r,i){this.pipeline.renderToScreen=!1,this.pipeline.renderTarget,this.renderSplineScene(e,r),this.pipeline.sceneTransitionFromTexture=this.pipeline.renderTarget.texture,this.sceneTransitionDuration=i,this.sceneTransitionTimeRemaining=i,this.pipeline.renderToScreen=!0;let s=this.pipeline.sceneTransitionPass.uniforms;s.uDPR.value=window.devicePixelRatio,s.uResolution.value.set(this.domElement.width,this.domElement.height).divideScalar(window.devicePixelRatio)}_currentDispose(){this._superDispose(),this.pipeline.dispose(),this.aoRenderTarget?.dispose(),this.transmissionRenderTarget?.dispose(),this.transmissionDepthTarget?.dispose(),this.normalRenderTarget?.dispose(),this.normalRenderTarget?.depthTexture?.dispose()}};var Mf=class extends Uo(Oy){constructor(e,r=15,i=10066329){super(e,r,i);this.object=e;this.added=!1;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,r){zo(this.object,Mf.geometryHelper,e,r)}};var Cf=class extends Uo(Dy){constructor(e,r=15,i=6710886){super(e,r,i);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,r){zo(this.object,Cf.geometryHelper,e,r)}};var jx=class extends Uo(Iy){constructor(e,r=6710886){super(e,r);this.object=e;this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,r){zo(this.object,jx.geometryHelper,e,r)}update(){if(this.object!==void 0){let e=jx._vector,r=this.object.distance?this.object.distance:1e3,i=r*Math.tan(this.object.angle);this.cone.scale.set(i,i,r),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o0?Hx(i,e-1):[null,null];(e>0&&i.length?i[a].charAt(l):null)===` `&&(s++,o=0),this.current.start=e,this.current.end=void 0;let[u,h]=rT(this.object,s,o),{AD:d,descender:f}=this.object,p=f+d*.5,{width:m,height:g,depth:y}=this.object.geometry.userData.parameters,v=typeof m=="string"?0:m,x=typeof g=="string"?0:g;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(u-v*.5,h+p+x*.5,y),this.hideSelectionMesh(),this.showCaretMesh()}setSelection(e,r){if(this.object===void 0)return;let i=this.object.wrappedText;this.current.start=e,this.current.end=r;let s=[],o=[],a=aZ(i,e,r),{lineHeight:l,AD:c,descender:u}=this.object,h=u+c*.5-l*.5;for(let[v,x,S]of a)if(x!==S){let[w,A]=rT(this.object,v,x),[T,b]=rT(this.object,v,S);A+=h,b+=h,b+=l;let M=s.length/3;s.push(w,A,0),s.push(T,A,0),s.push(T,b,0),s.push(w,b,0),o.push(M+0,M+1,M+2),o.push(M+2,M+3,M+0)}let d=new _e;d.setIndex(o),d.setAttribute("position",new Te(s,3));let{width:f,height:p,depth:m}=this.object.geometry.userData.parameters,g=typeof f=="string"?0:f,y=typeof p=="string"?0:p;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=d,this.selectionMesh.position.x=-g*.5,this.selectionMesh.position.y=y*.5,this.selectionMesh.position.z=m,this.showSelectionMesh(),this.hideCaretMesh()}getSelectionFromPosition(e,r,i="previous"){if(this.object===void 0||this.object.font===void 0)return;let s=this.object.wrappedText,o=s.length,a=this.object.lineHeight,l=o*a,{height:c,verticalAlign:u}=this.object.geometry.userData.parameters,h=typeof c=="string"?0:c,d=0;u===3?d=h-l:u===2&&(d=h*.5-l*.5);let f=Math.min(Math.floor(Math.max(Math.min(-r-d,l),0)/a),o-1),p=this.object.charCoords[f],m=this.object.charWidths[f],g=0,y=!1;if(i==="previous"){for(let x=0;x0){g=x,y=!0;break}}else if(i==="closest"){let x=1/0;for(let S=0;S=S&&es+=o.length,0)+i}showSelectionMesh(){this.selectionMesh.material.opacity=this._selectionVisibleAlpha}hideSelectionMesh(){this.selectionMesh.material.opacity=0}showCaretMesh(){this.caretMesh.material.opacity=this._caretVisibleAlpha}hideCaretMesh(){this.caretMesh.material.opacity=0}};function rT(n,t,e){let{charCoords:r,charWidths:i,initialOffsetY:s,lineHeight:o}=n;if(r[t]&&r[t].length===0||r.length===0){let u=0,{horizontalAlign:h}=n.data.geometry,d=n.wrappedText,{width:f}=n.geometry.userData.parameters;return d.length===1&&d[0].length===0&&(h===3?u=f*.5:h===2&&(u=f)),[u,s-o*t]}let a=r[t];if(a===void 0||a.length===0)return[0,0];let[l,c]=a[Math.min(e,a.length-1)];return e>=a.length&&(l+=i[t][e-1]),[l,c]}function Hx(n,t){let e=0;for(let r=0;r=n[r].length&&(r++,i=0);for(let l=r;l<=s;l++){let c=n[l],u=l===r?i:0,h=l===s?o:c.length;a.push([l,u,h])}return a}function wL(n,t){let e=ri.fromHex(3223857),r=.8;for(let i of n.layers){if(i.data.type==="light"||i.data.type==="displace"||i.data.type==="fresnel"||i.data.type==="matcap"||i.data.type==="texture"||i.data.type==="toon"||i.data.type==="outline"||i.data.type==="transmission"||i.data.type==="noise")continue;let s=typeof i.data.alpha=="string"?Number(t.getVariable(i.data.alpha)):i.data.alpha;if(i.data.type==="color"&&s>.3){e=lZ(i.data.color,t),r=s;break}else if((i.data.type==="depth"||i.data.type==="gradient")&&s>.3){let o=cZ(i.data);e={r:o[0],g:o[1],b:o[2]},r=typeof i.data.alpha=="string"?1:i.data.alpha;break}}return{...e,a:r}}function lZ(n,t){return typeof n=="string"?t.data.colors[n]:n}function cZ(n){return n.colors[0]}function uZ(n,t){n.shadow.camera.right=t/2,n.shadow.camera.left=-t/2,n.shadow.camera.top=t/2,n.shadow.camera.bottom=-t/2,n.shadow.needsUpdate=!0}var _f=class extends df(Cy,Mf){constructor(t,e,r){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.top=1250,s.bottom=-1250,s.right=1250,s.left=-1250,s.near=-1e4,s.far=2500;let o=new dl(this.shadow.camera);o.visible=!1,this.gizmos.shadowmap=o}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof dl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let r=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&uZ(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),r&&this.update()}};var AL=new E,EL=new E,TL=new Ke,If=class extends df(Ty,jm){constructor(t,e,r){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.fov=we.RAD2DEG*2*this.angle,s.aspect=1,s.near=100,s.far=2500;let o=new dl(this.shadow.camera);o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof dl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),EL.setFromMatrixPosition(this.matrixWorld),TL.setFromRotationMatrix(this.matrixWorld),AL.copy(this.up).applyQuaternion(TL).negate().multiplyScalar(this.distance),this.target.position.copy(EL).add(AL),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}};function hZ(n){let t=(n[0][0]+n[1][1])/2,e=(n[0][0]-n[1][1])/2,r=(n[1][0]+n[0][1])/2,i=(n[1][0]-n[0][1])/2,s=Math.sqrt(t*t+i*i),o=Math.sqrt(e*e+r*r),a=s+o,l=s-o,c=Math.atan2(r,e),u=Math.atan2(i,t),h=(u-c)/2,d=(u+c)/2,f=[[Math.cos(d),Math.sin(d)],[-Math.sin(d),Math.cos(d)]],p=[[a,0],[0,l]],m=[[Math.cos(h),Math.sin(h)],[-Math.sin(h),Math.cos(h)]];return f[0][0]*=-1,f[0][1]*=-1,m[0][0]*=-1,m[1][0]*=-1,[f,p,m]}function Wx(n,t){return[[n[0][0]*t[0][0]+n[0][1]*t[1][0],n[0][0]*t[0][1]+n[0][1]*t[1][1]],[n[1][0]*t[0][0]+n[1][1]*t[1][0],n[1][0]*t[0][1]+n[1][1]*t[1][1]]]}function ML(n){return[[n[0][0],n[1][0]],[n[0][1],n[1][1]]]}function CL(n){let[t,e,r]=hZ(n),i=Wx(t,ML(r)),s=Wx(Wx(r,e),ML(r)),o=Math.atan2(i[1][0],i[0][0]),a=[s[0][0],s[1][1]],l=[s[0][1]/s[1][1],s[1][0]/s[0][0]];return{rotation:o,scale:a,shear:l}}function PL({rotation:n,scale:t,shear:e}){let r=Math.cos(n),i=Math.sin(n),s=[[r,-i],[i,r]],o=[[t[0],e[0]*t[1]],[e[1]*t[0],t[1]]],a=Wx(s,o);return[a[0][0],a[1][0],a[0][1],a[1][1]]}var St;(w=>{function n(){return[1,0,0,0,1,0,0,0,1]}w.identity=n;function t(A,T=w.identity()){for(let b=0,M=A.length;b=i[0]&&t<=s[0]&&e>=i[1]&&e<=s[1]}applyTransforms(t){t.setTransform(this.worldMatrix,this.ignoreCameraZoom)}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges()),this._recursiveBBox}updateLocalMatrix(){this.localMatrix=St.compose(this.position,this.scale,IL(this.rotation),Ca.getPivot(this.dataPatched),this.shear)}updateWorldMatrix(t,e,r){let i=this.parent;e&&i!==null&&i!==void 0&&i.updateWorldMatrix(t,!0,!1),t&&this.updateLocalMatrix(),this.parent?this.worldMatrix=St.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=St.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}get pivot(){return Ca.getPivot(this.data)}getCenter(){return[0,0]}getHalfSize(){return[0,0]}get id(){return this.uuid}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{t.resetBBoxNeedsUpdateSelf()})}updateTransformState(t){let e=!1;t.position!==void 0&&(e=!0,this.position=t.position),t.rotation!==void 0&&(e=!0,this.rotation=t.rotation),t.scale!==void 0&&(e=!0,this.scale=t.scale),t.shear!==void 0&&(e=!0,this.shear=t.shear),e&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}updateByOp(t,e,r){t.type===0&&t.props.visible!==void 0&&(this.visible=t.props.visible),this.data=e,this.data=e;let i=t,s=Lt(t.path,["states","*"]);if(s!==null){if(t.type===0){let[o]=s;if(this?.stateSelection===o){let a={...t.props};if(delete a.name,Object.values(t.props).some(l=>l===void 0)){let l=this.data;if(l!==void 0){let c=Sr.zoom(l,t.path.slice(2));if(c)for(let u in t.props)t.props[u]===void 0&&u in c&&(a[u]=c[u])}}i={...t,props:a,path:t.path.slice(2)}}}}else if(t.type===0){let o=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(o!==void 0){if(t.props.name!==void 0&&o.name){let{name:l,...c}=o;o=c}let a=Sr.removeOverridden(t.path,t.props,o);i={...t,props:a}}}this.updateByPatchedOpBase(i,Ma.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r)}changeSelectedState(t,e,r=!1){if(!(this.data.states.length===0&&!r)){for(let i of this.data.states)Ma.toOps(this.data,i.data).forEach(o=>{let a=Vh.replaceProps(o,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,e)});if(t!==null){let i=this.data.states.data(t);i&&(this.dataPatched=Ma.patch(this.data,i),Ma.toOps(this.data,i).forEach(o=>{this.updateByPatchedOp(o,this.dataPatched,e)}))}r&&this.updateTransformState(this.dataPatched),this.stateSelection=t}}updateState(t,e){t.name!==void 0&&(this.name=t.name),t.visible!==void 0&&(this.visible=t.visible),this.updateTransformState(t)}updateByPatchedOpBase(t,e,r){this.dataPatched=e,this.updateByPatchedOp(t,e,r)}updateByPatchedOp(t,e,r){t.path.length===0&&t.type===0&&this.updateState(t.props,r),this.requestRender()}traverseFrameAncestors(t){this.traverseAncestors(e=>{e.data.type==="frame2d"&&t(e)})}traverseAncestors(t){let e=this.parent;for(;e;)t(e),e=e.parent}requestRender(){this.traverseFrameAncestors(t=>{t.requestRender()})}clone(t){let e=new rr(this.uuid,this.data,t);return e.parent=void 0,e}addEventListener(t,e){this.emitter.on(t,e)}removeEventListener(t,e){this.emitter.off(t,e)}dispatchEvent(t){this.emitter.emit(t.type,{...t,target:t.target??this})}traverseSortNextHelper(){let t=this.parent;if(t){let e=t.children;if(e){let r=e.indexOf(this)+1;return e[r]?e[r]:t.traverseSortNextHelper()}}}sortNext(){let t=this.children;return t&&t.length>0&&t[0]?t[0]:this.traverseSortNextHelper()}isDescendantOf(t){t instanceof rr&&(t=t.uuid);let e=this;for(;e.parent;){if(e.parent.uuid===t)return!0;e=e.parent}return!1}};var Zi=class extends rr{constructor(e,r,i){super(e,r,i);this.uuid=e;this.data=r;this.context=i;this.children=[]}add(e){e.parent&&e.parent instanceof Zi&&e.parent.remove(e),this.children.push(e),e.parent=this}remove(e){let r=this.children.indexOf(e);r>=0&&(this.children.splice(r,1),e.parent=void 0)}traverse(e){let r=e(this);if(r!==!0)for(let i of this.children)i instanceof Zi?i.traverse(e):r=e(i)}intersectsChildrenHelper(e,r,i,s,o){for(let a of this.children)if(a.intersects(e,r,i,!1)&&(o.push(a),s)||a instanceof Zi&&a.intersectsChildrenHelper(e,r,i,s,o))return!0;return!1}intersectsChildren(e,r,i,s=!1,o=[],a=!1){return this.intersectsChildrenHelper(e,r,i,s,o),o}intersectsChildrenHelperReverse(e,r,i,s,o){for(let a of this.children)if(a instanceof Zi&&a.intersectsChildrenHelperReverse(e,r,i,s,o)||a.intersects(e,r,i,!1)&&(o.push(a),s))return!0;return!1}intersectsChildrenReverse(e,r,i,s=!1,o=[],a=!1){return this.intersectsChildrenHelperReverse(e,r,i,s,o),o}updateWorldMatrix(e,r,i){if(super.updateWorldMatrix(e,r,i),i&&this.children)for(let s of this.children)s.updateWorldMatrix(e,!1,!0)}find(e){let r;return this.traverse(i=>{i.uuid===e&&(r=i)}),r}innerDrawChildren(e){for(let r=this.children.length-1;r>=0;r--)this.children[r].draw(e)}resetBBoxNeedsUpdate(){super.resetBBoxNeedsUpdate(),this.traverse(e=>{e.resetBBoxNeedsUpdateSelf()})}clone(e){let r=new Zi(this.uuid,this.data,e);r.parent=void 0;for(let i of this.children)r.add(i.clone(e));return r}},kn=class extends Zi{constructor(e,r,i){super(e,r,i);this.uuid=e;this.data=r;this.updateState(r,i)}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.innerDrawChildren(e),e.restore())}clone(e){let r=new kn(this.uuid,this.data,e);r.parent=void 0;for(let i of this.children)r.add(i.clone(e));return r}};function fZ(n,t){let[[e,r],[i,s]]=n,[[o,a],[l,c]]=t,u=(e-i)*(a-c)-(r-s)*(o-l);if(u===0)return!1;let h=((e-o)*(a-c)-(r-a)*(o-l))/u,d=-((e-i)*(r-a)-(r-s)*(e-o))/u;return h>=0&&h<=1&&d>=0&&d<=1}var OL=[[-1,1],[-1,-1],[1,-1],[1,1]],DL=(n,t,e)=>{let r=n.getCenter(),i=n.getHalfSize(),s=St.append(t,n.worldMatrix);i[0]===0&&i[1]===0?e.push(St.apply(r,s)):OL.forEach(o=>{let a=[o[0]*i[0]+r[0],o[1]*i[1]+r[1]];e.push(St.apply(a,s))})},$l=class{constructor(){this.matrix=St.identity();this.min=[1/0,1/0];this.max=[-1/0,-1/0];this.vertices=[];this.edges=[]}setFromObjectSize(t,e=!1){t.updateWorldMatrix(),this.makeEmpty(),St.copy(t.worldMatrix,this.matrix);let r=St.invert(t.worldMatrix);this.expandByObjectSize(t,r,e)}expandByObjectSize(t,e,r=!1){let i=[];r===!0&&t instanceof Zi?t.traverse(s=>{s.visible&&DL(s,e,i)}):DL(t,e,i),this.setFromPoints(i)}setFromSize(t,e,r){this.makeEmpty(),St.copy(r,this.matrix),this.expandBySize(t,e,r)}expandBySize(t,e,r){[St.apply([0,0],r),St.apply([0,e],r),St.apply([t,e],r),St.apply([t,0],r)].forEach(s=>this.expandByPoint(s))}getCenter(){let[t,e]=this.min,[r,i]=this.getHalfSize();return St.apply([t+r,e+i],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(t){this.makeEmpty();for(let e of t)this.expandByPoint(e)}expandByPoint(t){this.min=[Math.min(this.min[0],t[0]),Math.min(this.min[1],t[1])],this.max=[Math.max(this.max[0],t[0]),Math.max(this.max[1],t[1])]}computeVertices(){let[t,e]=this.getHalfSize(),r=this.getCenter(),[i,s,o,a]=St.getAbcdef(this.matrix),l=St.create(i,s,o,a,r[0],r[1]);this.vertices=OL.map(([c,u])=>St.apply([c*t,u*e],l))}computeEdges(){this.edges=[];for(let t=0,e=this.vertices.length;t=r[0]&&t<=i[0]&&e>=r[1]&&e<=i[1]}containsPoint(t){let[e,r]=t,[i,s]=this.min,[o,a]=this.max;return e>=i&&e<=o&&r>=s&&r<=a}intersectsBBox2D(t){for(let e=0,r=this.edges.length;e{LL=n}),RL=!1;var qx;function NL(){if(RL)return;if(qx)return qx;async function n(){let e=await import("./ui.js");LL(e.default??e),RL=!0}return qx=n(),qx}function nT(n){let t=!1;return n.scene.objects.traverse((e,r)=>{(r.type==="Mesh"&&r.geometry.type==="UIGeometry"||r.type==="Page"&&r.uiFrame!==void 0)&&(t=!0)}),t}var pt,iT;async function pZ(n){let t=await BL;pt||(iT||(iT=t({locateFile:()=>n})),pt=await iT)}var FL=St.identity(),Hm=class{constructor(t,e=1){this.canvas=t;this._dpr=e;this._width=0;this._height=0;this._strokeMode="inside";this._layerBlur=0;this._backgroundBlur=0;this._dropShadowBlur=0;this._dropShadowOffsetX=0;this._dropShadowOffsetY=0;this._dropShadowColor=bt.transparent;this._innerShadowBlur=0;this._innerShadowOffsetX=0;this._innerShadowOffsetY=0;this._innerShadowSpread=0;this._innerShadowColor=bt.transparent;this._fonts=new Map;this._isSizeDirty=!1;try{let r=t.getBoundingClientRect();t.width=r.width*e,t.height=r.height*e}catch{console.log(t.width,e)}this._currentM3Transform=FL,this._currentTransform=new Float32Array(FL)}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this._isSizeDirty=!0}async init(){if(!this.wasmURL)throw Error("Your must set the wasm binary url with renderer.wasmURL = ... before you can call renderer.init");await pZ(this.wasmURL),this._surface=pt.MakeWebGLCanvasSurface(this.canvas),this.ctx=this._surface?.getCanvas(),this._paint=new pt.Paint,this._paint.setAntiAlias(!0),this._paintFill=this._paint.copy(),this._paintFill.setStyle(pt.PaintStyle.Fill),this._paintStroke=this._paint.copy(),this._paintStroke.setStyle(pt.PaintStyle.Stroke),this.ctx?.scale(this.dpr,this.dpr)}get currentTransform(){return this._currentM3Transform}get currentTransformBuffer(){return this._currentTransform}set currentTransform(t){this._currentM3Transform=t,this._currentTransform.set(t)}async loadFont(t,e){let r=await(await fetch(t)).arrayBuffer();this.registerFont(r,e)}registerFont(t,e){if(this._fonts.has(e))return;let r=pt.FontMgr.FromData(t);if(r)this._fonts.set(e,r);else throw new Error("Invalid font data for "+e)}get width(){return this._width}get height(){return this._height}set strokeColor(t){this._paintStroke&&this._paintStroke.setColor(Yx(t),pt.ColorSpace.DISPLAY_P3)}set fillColor(t){this._paintFill&&this._paintFill.setColor(Yx(t),pt.ColorSpace.DISPLAY_P3)}set lineWidth(t){this._paintStroke&&this._paintStroke.setStrokeWidth(this._strokeMode==="center"?t:t*2)}set strokeMode(t){this._strokeMode=t}set dropShadowBlur(t){this._dropShadowBlur=t}set dropShadowColor(t){this._dropShadowColor=t}set dropShadowOffsetX(t){this._dropShadowOffsetX=t}set dropShadowOffsetY(t){this._dropShadowOffsetY=t}set innerShadowBlur(t){this._innerShadowBlur=t}set innerShadowColor(t){this._innerShadowColor=t}set innerShadowOffsetX(t){this._innerShadowOffsetX=t}set innerShadowOffsetY(t){this._innerShadowOffsetY=t}set innerShadowSpread(t){this._innerShadowSpread=t}set layerBlur(t){this._layerBlur=t}set backgroundBlur(t){this._backgroundBlur=t}clear(){this.ctx?.clear(pt.TRANSPARENT)}save(){this.ctx?.save()}restore(){this.ctx?.restore()}beginPath(){this._currentPath?.delete(),this._currentPath=new pt.Path}closePath(){let t=this._currentPath;if(t){if(t.isEmpty())return;let e=t.getBounds();(e[3]-e[1]||e[2]-e[0])&&t.close()}}fill(){this._paintInner(this._paintFill,!0)}stroke(){this._paintInner(this._paintStroke,!1)}clipRect(t,e,r,i,s=0,o=0,a=0,l=0){let c=pt.XYWHRect(t,e,r,i);if(s===0&&o===0&&l===0&&a===0)this.ctx?.clipRect(c,pt.ClipOp.Intersect,!0);else{let u=pt.RRectXY(c,s,s);u[4]=u[5]=s,u[6]=u[7]=o,u[8]=u[9]=a,u[10]=u[11]=l,this.ctx?.clipRRect(u,pt.ClipOp.Intersect,!0)}}_applyShadowOffsetMatrix(){if(this.ctx){let t=St.invert(this.currentTransform);this.ctx.concat(t);let e=St.translate(St.identity(),this._dropShadowOffsetX,this._dropShadowOffsetY);this.ctx.concat(e),this.ctx.concat(this._currentTransform)}}_applyEffectsToPaint(t,e,r=!0){if(this.ctx&&this._currentPath){let i,s=!1;if(r&&this._hasDropShadow()){let o=t.copy();o.setColor(Yx(this._dropShadowColor));let a;this._dropShadowBlur>0&&(a=pt.MaskFilter.MakeBlur(pt.BlurStyle.Normal,this._dropShadowBlur*this.dpr*(this.camera?.scale??1),!1),o.setMaskFilter(a)),this.ctx.save(),this.ctx.clipPath(this._currentPath,pt.ClipOp.Difference,!0),this._applyShadowOffsetMatrix(),e(o),this.ctx.restore(),o.delete(),a?.delete()}if(this._backgroundBlur>0&&r){this.ctx.save(),this.ctx.clipPath(this._currentPath,pt.ClipOp.Intersect,!0);let o=pt.ImageFilter.MakeBlur(this._backgroundBlur,this._backgroundBlur,pt.TileMode.Clamp,null),a=t.copy();a.setImageFilter(o),a.setAlphaf(1);let l=this._currentPath.computeTightBounds();this.ctx.saveLayer(a,l,null,pt.SaveLayerInitWithPrevious),this.ctx.drawColor(t.getColor()),this.ctx.restore(),this.ctx.restore(),a.delete(),o.delete(),s=!0}if(this._layerBlur>0){let o=t.copy();i=pt.MaskFilter.MakeBlur(pt.BlurStyle.Normal,this._layerBlur*this.dpr*(this.camera?.scale??1),!1),o.setMaskFilter(i),e(o),o.delete(),i.delete(),s=!0}if(s||e(t),r&&this._hasInnerShadow()){let o=new pt.Paint;o.setAntiAlias(!0),o.setStyle(pt.PaintStyle.Fill),o.setColor(Yx(this._innerShadowColor));let a;this._innerShadowBlur>0&&(a=pt.MaskFilter.MakeBlur(pt.BlurStyle.Normal,this._innerShadowBlur*this.dpr*(this.camera?.scale??1),!1),o.setMaskFilter(a));let l=this._currentPath.computeTightBounds(),[c,u,h,d]=l,f=h-c,p=d-u;this.ctx.save(),this.ctx.clipPath(this._currentPath,pt.ClipOp.Intersect,!0),this.ctx.saveLayer(o,l,null,pt.SaveLayerInitWithPrevious),this.ctx?.translate(this._innerShadowOffsetX,this._innerShadowOffsetY),this.ctx.drawRect(pt.XYWHRect(-1e3-this._innerShadowOffsetX,-1e3-this._innerShadowOffsetY,2e3+f+Math.abs(this._innerShadowOffsetX*2),2e3+p+Math.abs(this._innerShadowOffsetY*2)),o),o.setBlendMode(pt.BlendMode.Clear),this.ctx.drawPath(this._currentPath,o),this.ctx.restore(),this.ctx.restore(),o.delete(),a?.delete()}}}_paintInner(t,e=!0){if(this.ctx&&this._currentPath&&t){let r=this.ctx,i=this._currentPath;this._applyEffectsToPaint(t,s=>{let o=!1;!e&&this._strokeMode!=="center"&&(r.save(),r.clipPath(i,this._strokeMode==="outside"?pt.ClipOp.Difference:pt.ClipOp.Intersect,!0),o=!0),r.drawPath(i,s),o&&r.restore()},e)}}_hasDropShadow(){return this._dropShadowColor?.a>0}_hasInnerShadow(){return this._innerShadowColor?.a>0}path(t){this._currentPath?.addPath(pt.Path.MakeFromSVGString(t))}ellipse(t,e,r,i,s,o,a,l){if(!VL([t,e,r,i])||!this._currentPath)return;if(r<0||i<0)throw Error("radii cannot be negative");let c=pt.XYWHRect(t-r,e-i,r*2,i*2);this._currentPath?.addOval(c)}rect(t,e,r,i,s=0,o=0,a=0,l=0){let c=pt.XYWHRect(t,e,r,i);if(!!VL(c))if(s===0&&o===0&&l===0&&a===0)this._currentPath?.addRect(c);else{let u=pt.RRectXY(c,s,s);u[4]=u[5]=s,u[6]=u[7]=o,u[8]=u[9]=a,u[10]=u[11]=l,this._currentPath?.addRRect(u)}}getHorizontalAlign(t){switch(t){case 2:return pt.TextAlign.Right;case 3:return pt.TextAlign.Center;case 4:return pt.TextAlign.Justify;case 1:default:return pt.TextAlign.Left}}drawTextInner(t,e,r,[i,s,o,a],l,c,u=!0){let h=0,{ctx:d}=this;if(!d)return h;let f=c.copy(),p=c.copy();return p.setAlphaf(0),this._applyEffectsToPaint(f,m=>{e.pushPaintStyle(r,m,p),e.addText(t);let g=e.build();g.layout(o);let y=s;l===2?y+=(a-g.getHeight())/2:l===3&&(y+=a-g.getHeight()),d.drawParagraph(g,i,y),h=g.getHeight(),e.reset(),g.delete()},u),f.delete(),p.delete(),h}drawText(t,e){let r=0,i=this._fonts.get(e.font),{ctx:s,_paintFill:o,_paintStroke:a}=this;if(i&&s){let l=new pt.TextStyle({fontFamilies:[e.font],fontSize:e.fontSize,heightMultiplier:e.lineHeight,letterSpacing:e.letterSpacing}),c=new pt.ParagraphStyle({textStyle:l,textAlign:this.getHorizontalAlign(e.horizontalAlign)}),u=pt.XYWHRect(e.x,e.y,e.width,e.height),h=pt.ParagraphBuilder.Make(c,i);o&&(r=this.drawTextInner(t,h,l,u,e.verticalAlign,o,!0)),a&&(r=this.drawTextInner(t,h,l,u,e.verticalAlign,a,!1)),h.delete()}return{height:r}}render(){this._surface?.flush()}moveTo(t,e){this._currentPath?.moveTo(t,e)}lineTo(t,e){this._currentPath?.lineTo(t,e)}bezierCurveTo(t,e,r,i,s,o){this._currentPath?.cubicTo(t,e,r,i,s,o)}quadraticCurveTo(t,e,r,i){this._currentPath?.quadTo(t,e,r,i)}setTransform(t,e=!1){if(!this.ctx)return;let r=this.ctx.getTotalMatrix(),i=St.invert(r);if(i&&this.ctx.concat(i),this.ctx?.scale(this.dpr,this.dpr),this.camera?.enabled&&(this.ctx?.concat(this.camera.worldMatrix),e)){let s=St.getScale(this.camera.worldMatrix);this.ctx?.scale(1/s[0],1/s[1])}this.ctx?.concat(t),this.currentTransform=t}transform(t){this.ctx?.concat(t)}setSize(t,e){!this._isSizeDirty&&t===this._width&&e===this._height||(this._isSizeDirty=!1,this._width=t,this._height=e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",this.canvas.width=t*this.dpr,this.canvas.height=e*this.dpr,this._surface&&(this._surface=pt.MakeWebGLCanvasSurface(this.canvas),this.ctx=this._surface?.getCanvas()))}};function VL(n){for(let t=0;t0?this.stroke.color:bt.transparent,e.strokeMode=this.stroke.mode,e.lineWidth=this.stroke.thickness}applyFilters(e){this.layerBlur.enabled?e.layerBlur=this.layerBlur.radius*5:e.layerBlur=0,this.backgroundBlur.enabled?e.backgroundBlur=this.backgroundBlur.radius*5:e.backgroundBlur=0,this.dropShadow.enabled?(e.dropShadowBlur=this.dropShadow.blurRadius*5,e.dropShadowColor=this.dropShadow.color,e.dropShadowOffsetX=this.dropShadow.offset[0],e.dropShadowOffsetY=this.dropShadow.offset[1]):e.dropShadowColor=bt.transparent,this.innerShadow.enabled?(e.innerShadowSpread=this.innerShadow.spread,e.innerShadowBlur=this.innerShadow.blurRadius*5,e.innerShadowColor=this.innerShadow.color,e.innerShadowOffsetX=this.innerShadow.offset[0],e.innerShadowOffsetY=this.innerShadow.offset[1]):e.innerShadowColor=bt.transparent}innerDraw(e){}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.applyFilters(e),this.applyFillStroke(e),e.beginPath(),this.innerDraw(e),this.autoClose&&e.closePath(),this.fill.enabled&&e.fill(),this.stroke.enabled&&e.stroke(),e.restore())}updateByPatchedOp(e,r,i){super.updateByPatchedOp(e,r,i),e.type===0&&(Lt(e.path,["fill"])?this.fill.update(e.props):Lt(e.path,["stroke"])?this.stroke.update(e.props):Lt(e.path,["dropShadow"])?this.dropShadow.update(e.props):Lt(e.path,["innerShadow"])?this.innerShadow.update(e.props):Lt(e.path,["layerBlur"])?this.layerBlur.update(e.props):Lt(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}updateState(e,r){super.updateState(e,r),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur)}clone(e){let r=new Ar(this.uuid,this.data,e);return r.parent=void 0,r}};var ec=class extends Ar{constructor(e,r,i){super(e,r,i);this.uuid=e;this.data=r;this.width=0;this.height=0;this.updateState(r,i)}innerDraw(e){e.ellipse(this.width*.5,this.height*.5,this.width*.5,this.height*.5,0,0,Math.PI*2)}intersectsInLocalSpace(e,r){return _L(e,r,this.width*.5,this.height*.5,this.width*.5,this.height*.5)}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let r=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,r=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,r=!0),r&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,r){super.updateState(e,r),this.updateSizeState(e)}clone(e){let r=new ec(this.uuid,this.data,e);return r.parent=void 0,r}};var Es=class extends Ar{constructor(e,r,i){super(e,r,i);this.uuid=e;this.data=r;this.width=0;this.height=0;this.cornerRadius=[0,0,0,0];this.updateState(r,i)}innerDraw(e){e.rect(0,0,this.width,this.height,...this.cornerRadius)}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let r=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,r=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,r=!0),r&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,r){super.updateState(e,r),this.updateSizeState(e),this.updateCornerState(e)}clone(e){let r=new Es(this.uuid,this.data,e);return r.parent=void 0,r}};var tc=class extends Ar{constructor(e,r,i){super(e,r,i);this.uuid=e;this.data=r;this._textHeight=0;this._textHeightDirty=!0;this.width=0;this.height=0;this.updateState(r,i)}get textHeight(){return this._textHeight}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:bt.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:bt.transparent,e.strokeMode="center",e.lineWidth=this.stroke.thickness}innerDraw(e){this._fontHolder?.arrayBuffer&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&e.registerFont(this._fontHolder.arrayBuffer,this.data.font);let r=this.data.textTransform,i=this.data.text.textValue.toString(),s=r===2?i.toUpperCase():r===3?i.toLowerCase():i,{height:o}=e.drawText(s,{x:0,y:0,width:this.width,height:this.height,fontSize:this.data.fontSize,lineHeight:this.data.lineHeight??1,letterSpacing:this.data.letterSpacing??0,horizontalAlign:this.data.horizontalAlign,verticalAlign:this.data.verticalAlign,font:this.data.font});this._textHeight=o}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let r=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,r=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,r=!0),r&&this.updateWorldMatrix(!0,!1,!0)}updateFontState(e,{shared:r}){e.font!==void 0&&(this._fontHolder=r.getFont(e.font),this._fontHolder&&!this._fontHolder.isLoaded&&this._fontHolder.loadingPromise.then(()=>{this.requestRender()}))}updateState(e,r){super.updateState(e,r),this.updateSizeState(e),this.updateFontState(e,r)}clone(e){let r=new tc(this.uuid,this.data,e);return r.parent=void 0,r}};var Df=class extends Ar{constructor(e,r,i){super(e,r,i);this.uuid=e;this.data=r;this.curves=[];this.extremasBBox={min:[0,0],max:[0,0]};this.updateState(r,i)}computeExtremas(){this.curves.length===0&&this.computeCurves();let e=this.curves.map(s=>Qx.extremas(s)),r=[1/0,1/0],i=[-1/0,-1/0];for(let s=0,o=e.length;si[0]&&(i[0]=a[1][0]),a[1][1]>i[1]&&(i[1]=a[1][1])}return this.extremasBBox.min=[r[0],r[1]],this.extremasBBox.max=[i[0],i[1]],this.extremasBBox}computeCurves(){this.curves=[];for(let i=1,s=this.data.points.length;i{function n(o){let a=o.start,l=o.cp1,c=o.cp2,u=o.end,h=[3*(l[0]-a[0]),3*(l[1]-a[1])],d=[3*(c[0]-l[0]),3*(c[1]-l[1])],f=[3*(u[0]-c[0]),3*(u[1]-c[1])],p={start:h,cp:d,end:f};return o.derivative=p,p.derivative=sT.derive(p),p}s.derive=n;function t(o,a,l,c=!1){let u=o-2*a+l;if(u!==0){let h=-Math.sqrt(Math.abs(a*a-o*l)),d=-o+a,f=-(h+d)/u,p=-(-h+d)/u;return[f,p]}else if(a!==l&&u===0)return[(2*a-l)/(2*(a-l))];return[]}function e(o){let a=o.derivative??s.derive(o),l=a.start,c=a.cp,u=a.end;return[t(l[0],c[0],u[0]),t(l[1],c[1],u[1])]}s.droot=e;function r(o){let[a,l]=s.droot(o),c=[o.start[0],o.end[0]],u=[o.start[1],o.end[1]];for(let h of a)c.push(s.compute(o,Math.min(1,Math.max(0,h)))[0]);for(let h of l)u.push(s.compute(o,Math.min(1,Math.max(0,h)))[1]);return c.sort((h,d)=>h-d),u.sort((h,d)=>h-d),[[c[0],u[0]],[c[c.length-1],u[u.length-1]]]}s.extremas=r;function i(o,a){if(a===0)return[...o.start];if(a===1)return[...o.end];let l=1-a,c=l*l,u=a*a,h=c*l,d=c*a*3,f=l*u*3,p=a*u;return[h*o.start[0]+d*o.cp1[0]+f*o.cp2[0]+p*o.end[0],h*o.start[1]+d*o.cp1[1]+f*o.cp2[1]+p*o.end[1]]}s.compute=i})(Qx||(Qx={}));var sT;(r=>{function n(i){let s=i.start,o=i.cp,a=i.end,l=[2*(o[0]-s[0]),2*(o[1]-s[1])],c=[2*(a[0]-o[0]),2*(a[1]-o[1])],u={start:l,end:c};return u.derivative=oT.derive(u),i.derivative=u,u}r.derive=n;function t(i){let s=i.derivative??r.derive(i),o=s.start,a=s.end;return[o[0]!==a[0]?o[0]/(o[0]-a[0]):0,o[1]!==a[1]?o[1]/(o[1]-a[1]):0]}r.droot=t;function e(i,s){if(s===0)return[...i.start];if(s===1)return[...i.end];let o=1-s,a=o*o,l=s*s,c=a,u=o*s*2,h=l;return[c*i.start[0]+u*i.cp[0]+h*i.end[0],c*i.start[1]+u*i.cp[1]+h*i.end[1]]}r.compute=e})(sT||(sT={}));var oT;(e=>{function n(r){let i=r.start,s=r.end,o=[s[0]-i[0],s[1]-i[1]];return r.derivative=o,r.derivative}e.derive=n;function t(r,i){if(i===0)return[...r.start];if(i===1)return[...r.end];let s=r.start,o=r.end;return[s[0]+(o[0]-s[0])*i,s[1]+(o[1]-s[1])*i]}e.compute=t})(oT||(oT={}));var Ji=class extends Zi{constructor(e,r,i){super(e,r,i);this.uuid=e;this.width=0;this.height=0;this.clipped=!0;this.background=new Es(e+"-background",rd.defaultData,i),this.background.parent=this,this.updateState(r,i)}get fill(){return this.background.fill}get stroke(){return this.background.stroke}get backgroundBlur(){return this.background.backgroundBlur}get layerBlur(){return this.background.layerBlur}get dropShadow(){return this.background.dropShadow}get innerShadow(){return this.background.innerShadow}get cornerRadius(){return this.background.cornerRadius}set cornerRadius(e){this.background.cornerRadius=e}updateLocalMatrix(){super.updateLocalMatrix(),this.background?.updateLocalMatrix()}updateWorldMatrix(e,r,i){super.updateWorldMatrix(e,r,i),this.background?.updateWorldMatrix(e,r,i)}draw(e){if(!this.visible)return;e.save();let r=this.width,i=this.height;this.applyTransforms(e),this.background.width=r,this.background.height=i,this.background.draw(e),this.clipped&&e.clipRect(0,0,r,i,...this.cornerRadius),this.innerDrawChildren(e),e.restore()}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let r=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,r=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,r=!0),r&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,r){super.updateState(e,r),this.updateSizeState(e),this.updateCornerState(e),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur),e.clipped!==void 0&&(this.clipped=e.clipped)}requestRender(){super.requestRender(),this.dispatchEvent({type:"render"})}dispose(){this.removeEventListener("render")}updateByPatchedOp(e,r,i){super.updateByPatchedOp(e,r,i),e.type===0&&(Lt(e.path,["fill"])?this.fill.update(e.props):Lt(e.path,["stroke"])?this.stroke.update(e.props):Lt(e.path,["dropShadow"])?this.dropShadow.update(e.props):Lt(e.path,["innerShadow"])?this.innerShadow.update(e.props):Lt(e.path,["layerBlur"])?this.layerBlur.update(e.props):Lt(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}clone(e){let r=new Ji(this.uuid,this.data,e);r.parent=void 0;for(let i of this.children)r.add(i.clone(e));return r}};var GL=ta(aT(),1),za=class extends Ar{constructor(e,r,i){super(e,r,i);this.uuid=e;this.data=r;this._pathBBox=new DOMRect;this.path="";this.updateState(r,i),this.autoClose=!1,this.computeSVGBBox()}computeSVGBBox(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg"),r=document.createElementNS("http://www.w3.org/2000/svg","path");document.body.appendChild(e),r.setAttribute("d",this.path),e.appendChild(r),this._pathBBox=r.getBBox(),e.remove()}innerDraw(e){e.path(this.path)}intersectsInLocalSpace(e,r){return e>=this._pathBBox.x&&e<=this._pathBBox.x+this._pathBBox.width&&r>=this._pathBBox.y&&r<=this._pathBBox.y+this._pathBBox.height}getCenter(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}getHalfSize(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}updateState(e,r){super.updateState(e,r),e.path!==void 0&&(this.path=e.path,this.computeSVGBBox())}clone(e){let r=new za(this.uuid,this.data,e);return r.parent=void 0,r}};function jL(n,t=1,e=1){if(t<=0||e<=0)return n;let i=(0,GL.parseSVG)(n).map(s=>{let o={...s};return"x"in o&&(o.x=o.x*t),"y"in o&&(o.y=o.y*e),"x1"in o&&(o.x1=o.x1*t),"x2"in o&&(o.x2=o.x2*t),"y1"in o&&(o.y1=o.y1*e),"y2"in o&&(o.y2=o.y2*e),"rx"in o&&(o.rx=o.rx*t),"ry"in o&&(o.ry=o.ry*e),o});return HL(i)}function HL(n){let t=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"],e;return n.map(r=>{let i=[];t.forEach(o=>{if(o in r){let a=r[o]*1;i.length&&a>=0&&i.push(","),i.push(a)}});let s=(e===r.code?i[0]<0?"":",":r.code)+i.join("");return e=r.code,s}).join("")}function WL(n,t,e){switch(t.type){case"ellipse2d":return new ec(n,t,e);case"rectangle2d":return new Es(n,t,e);case"text2d":return new tc(n,t,e);case"vector2d":return new Df(n,t,e);case"path2d":return new za(n,t,e);case"frame2d":return new Ji(n,t,e);case"group2d":default:return new kn(n,t,e)}}var lT=class{constructor(t,e,r){this.uuid=t;this.data=e;this.group=new kn(lT.GROUP_ID,{...Zp.defaultData},r),this.createChildrenObjects(e.objects,this.group,r)}createObject(t,e,r,i,s,o){let a=WL(t,e,o);a&&(i.add(a),i.children.splice(s,0,i.children.pop()),a.updateWorldMatrix(),r.length>0&&(a instanceof kn||a instanceof Ji)&&this.createChildrenObjects(r,a,o))}createChildrenObjects(t,e,r){let i=0;for(let s of t)this.createObject(s.id,s.data,s.children,e,i,r),i+=1}draw(t){this.group.draw(t)}updateEntityByOp(t,e,r,i){let s=this.find(t);if(s)try{s.updateByOp(e,r,{shared:i})}catch(o){console.error(o)}}updateTreeByOp(t,e){if(t.path.length===0&&t.type===7){let r=t.parent===null?this.group:this.find(t.parent);r!==void 0&&r instanceof Zi&&(this.createObject(t.id,t.data,t.children,r,t.localIndex,e),r.requestRender())}else if(t.path.length===0&&t.type===8){let r=this.find(t.id);if(r!==void 0&&r.parent!==void 0&&r.parent instanceof Zi){let i=r.parent;r.resetBBoxNeedsUpdate(),i?.remove(r),i?.requestRender()}}else if(t.path.length===0&&t.type===9){let r=this.find(t.id);if(r!==void 0){let i=r.parent,s=t.parent===null?this:this.find(t.parent);if(s===void 0&&!1&&console.error("unexpected",s,t),s instanceof Zi||s===this){s.add(r);let o=t.localIndex;s.children.splice(o,0,s.children.pop()),r.updateWorldMatrix(!0,!1,!0),i?.requestRender(),r.requestRender()}r.resetBBoxNeedsUpdate()}}}add(t){this.group.add(t)}remove(t){this.group.remove(t)}traverse(t){this.group.traverse(e=>{e!==this.group&&t(e)})}intersectsChildren(t,e,r,i=!1,s=[]){return this.group.intersectsChildren(t,e,r,i,s,!0)}intersectsChildrenReverse(t,e,r,i=!1,s=[]){return this.group.intersectsChildrenReverse(t,e,r,i,s,!0)}find(t){return this.group.find(t)}get children(){return this.group.children}project(t,e){return this.group.project(t,e)}getWithSortKey(t){let e=this.find(t);if(e===void 0)return;let r=[],i=e;for(;i!==this.group;){let s=i;i=i.parent;let o=i.children.indexOf(s);r.splice(0,0,o)}return{entity:e,sortKey:r}}getAllSorted(t){let e=[];for(let r of t){let i=this.getWithSortKey(r.id);i!==void 0&&e.push(i)}return e.sort((r,i)=>fv(r.sortKey,i.sortKey)),e.map(r=>r.entity)}},su=lT;su.GROUP_ID="scene2d";function cT({constraints:n,newParentWidth:t,newParentHeight:e,initialParentWidth:r,initialParentHeight:i,objectInitialWidth:s,objectInitialHeight:o,objectInitialPosition:a}){let{horizontalConstraint:l,verticalConstraint:c}=n,u=t-r,h=e-i,d=s,f=o,p=a[0],m=a[1];if(l!==0){if(l===1)p+=u;else if(l===3)p+=u/2;else if(l===2)d=Math.max(1,d+u);else if(l===4){let g=t/r;d*=g,p*=g}}if(c!==0){if(c===1)m+=h;else if(c===3)m+=h/2;else if(c===2)f=Math.max(1,f+h);else if(c===4){let g=e/i;f*=g,m*=g}}return{width:d,height:f,position:[p,m]}}var vZ=ta(aT(),1);var IVe={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{mm:1,px:1,cm:1,in:1,pt:1,pc:1}};var bZ=` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`,SZ=` uniform sampler2D tDiffuse; varying vec2 vUv; void main() { vec4 texel = texture2D( tDiffuse, vUv ); gl_FragColor = texel; }`,wZ=new nl(-1,1,1,-1,0,1),dT=class extends _e{constructor(){super(),this.setAttribute("position",new Te([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Te([0,2,0,0,2,0],2))}},AZ=new dT,fT=class{constructor(t){this._mesh=new Ut(AZ,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,wZ)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}},qL=new it({defines:{},uniforms:{tDiffuse:new le(null)},vertexShader:bZ,fragmentShader:SZ}),EZ=new fT(qL),uT=null,hT=null,TZ=()=>(uT===null&&(uT=document.createElement("canvas")),uT),MZ=n=>(hT===null&&(hT=new Hm(n)),hT),CZ=St.identity(),Of=class{constructor(t,e,r,i){this.uuid=t;this.width=e;this.height=r;this.context=i;this.enabled=!0;this.isScreenSpace=!1;this.dpr=window.devicePixelRatio;this.isFrameDirty=!1;this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.context.shared.requestRender()};this._innerApplySize=()=>{let t=this.width,e=this.height,r=this.dpr;this.renderer.dpr=this.isScreenSpace?r:Math.floor(2048/Math.max(t,e)),this.renderer.setSize(t,e)};this.onFrameOverrideObjectEvent=t=>{if(t.target?.uuid!==void 0){let e=this.frameRoot?.find(t.target.uuid);e&&e.dispatchEvent({...t,target:e})}};this.scene2d=new su(we.generateUUID(),u0.defaultData,{dpr:window.devicePixelRatio,shared:i.shared}),this.canvas=TZ(),this.renderer=MZ(this.canvas),this.promise=this.init(),this.renderTarget=new dt(1,1,{type:Wn,stencilBuffer:!1,depthBuffer:!1}),i.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=i.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new xy(this.canvas)),this._canvasTexture}async init(){this.renderer instanceof Hm&&(this.renderer.wasmURL=J0.skiaWasmUrl),await this.renderer.init()}render(t){if(this.isFrameDirty){this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),qL.uniforms.tDiffuse.value=this.canvasTexture,this.canvasTexture.needsUpdate=!0;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),EZ.render(t),t.setRenderTarget(e),this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,r,i){this.scene2d.updateEntityByOp(t,e,r,i),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,r=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=r,this.frameOverride.localMatrix=CZ,this.isScreenSpace&&(this.frameOverride.fill.color=bt.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:r},YL({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let r=Math.max(1,t?.width??this.width),i=Math.max(1,t?.height??this.height);this.dpr=e,this.width=r,this.height=i,this._innerApplySize();let s=1,o=512,a=512;(r*e{r.addEventListener("beginState",this.onFrameOverrideObjectEvent)}),this.frameOverride.traverse(r=>{r.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginStateChange",this.onFrameOverrideObjectEvent)}),this.frameOverride?.traverse(t=>{t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function YL({objectOverride:n,objectRoot:t,newParentWidth:e,newParentHeight:r,initialParentWidth:i,initialParentHeight:s}){if(n instanceof Ji&&t instanceof Ji||n instanceof kn&&t instanceof kn)for(let o=0,a=n.children.length;o{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,r){e.color!==void 0&&(this.ambientLight.color=Qi(e.color,r)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(r=>{r instanceof Fn&&r.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof vs)if(Array.isArray(e.material))for(let r of e.material)r.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){e.softShadowQuality!==void 0&&this.isActive&&xL(e.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,r){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){let i=this.scene;i.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Qi(e.color,r),this.backupFog.near=e.near,this.backupFog.far=e.far}updateAo(e,r){e.aoColor!==void 0&&(this.aoColor=Qi(e.aoColor,r))}updateByOp(e,r,i,s){let o=this.data.uiFrame;super.updateByOp(e,r,i,s);let a=r;Lt(e.path,["fog"])?this.updateFog(a.fog,i.shared):Lt(e.path,["ao"])?this.updateAo(a.ao,i.shared):Lt(e.path,["ambient"])?this.updateAmbientLight(a.ambient,i.shared):Lt(e.path,["shadow"])?this.updateShadow(a.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||o!==a.uiFrame)&&this.updateUIFrame(e.props.uiFrame,i)}updateUIFrame(e,r){e?(this.uiCanvas||this.createUICanvas(e,r),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,r){this.updateState_Entity(e,r),e.backgroundColor!==void 0&&this.setBackgroundColor(Qi(e.backgroundColor,r.shared)),e.fog!==void 0&&this.updateFog(e.fog,r.shared),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,r.shared),e.ao!==void 0&&this.updateAo(e.ao,r.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,r){}raycast(e,r){super.raycast(e,r)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(5).fill(.5);let e=0,r=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof _f&&i.visible&&e<3&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof If&&i.visible&&e<5-3&&(this.penumbraSizeArrayCache[3+r]=i.data.penumbraSize??.5,r+=1)})}raycastWithClones(e){let r=[],i=s=>{for(let o of s.children){let a=o.cloner;yt.is(o)&&(o.visible||a?.object.data.visible)&&((cn(o)||Vm(o)&&this.scene.enableHelpers&&o.objectHelper.visible)&&(e.intersectObject(o,!1,r),Ym(o,e,r,!0)),i(o))}};return i(this),r}updateEntity2DByOp(e,r,i,s){this.uiCanvas?.updateEntity2DByOp(e,r,i,s)}};var Jx=class extends df(My,Cf){constructor(t,e,r){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.fov=90,s.aspect=1,s.near=100,s.far=2500;let o=new E(-s.far+this.position.x,-s.far+this.position.y,-s.far+this.position.z),a=new E(s.far+this.position.x,s.far+this.position.y,s.far+this.position.z),l=new Ht(o,a),c=new fl(l,new We(16755200));c.visible=!1,this.gizmos.shadowmap=c,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let t in this.gizmos){let e=this.gizmos[t];if(e instanceof fl){let r=this.shadow.camera,i=new E(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),s=new E(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z);e.box.set(i,s),e.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}};var $x=class extends cr{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,e){let r=this.geometry.getAttribute("position");r!==void 0?ym(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,t,e):super.updateEntityBoxSize(t,e)}};var rc=class extends cr{constructor(e,r,i){super(e,r,i);this._shapeId=null;this._context=i}updateState(e,r){super.updateState(e,r),this.updateShape()}updateShape(){let e={...this.data.geometry.extrusion.shape};for(let s in e)typeof e[s]=="string"&&(e[s]=this._context.shared.getVariable(e[s],[this.uuid,"geometry","extrusion","shape",s]));let r;if(e.type==="Custom"){let s=e.shapeId;if(s!==this._shapeId&&this.detachShape(),s){this._shapeId=s;let o=this._context.scene.find(s);o?.data&&(o.attachedPaths.add(this),r=o.geometry.userData?.shape),r||this._context.scene.addPendingCommand(()=>this.updateShape())}}else{let s;switch(e.type){case"Rectangle":s=Id;break;case"Ellipse":s=Cd;break;case"Polygon":s=V0;break;case"Star":s=k0;break;default:throw new Error(`Unknown shape type: ${e.type}`)}r=s.create({parameters:e}).userData.shape}let i=this.geometry;r&&i.inputs&&(i.inputs.shapeData=r,i.build(),this.attachedSurfaceCloners.forEach(s=>s.update()))}detachShape(){this._shapeId!==null&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,r){return super.updateTransformState(e,r)}updateGeometryInteractions(e,r){super.updateGeometryInteractions(e,r),this.updateShape()}updateEntityBoxSize(e,r){let i=this.geometry.getAttribute("position");i!==void 0?ym(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,r):super.updateEntityBoxSize(e,r)}};var ic=class extends Yl{constructor(e,r,i){super(e,r,i);this.data=r}};var eo=class extends Ss(sn,ws){constructor(e,r,i){super();r.type==="Instance"&&typeof e=="string"&&(r=this.transformAssignData(r,i)),this.super_Entity(e,r),this.objectHelper.update()}get isComponentRoot(){return this.data.type==="Component"&&typeof this.identity=="string"}get isInstanceRoot(){return this.data.type==="Instance"&&typeof this.identity=="string"}transformAssignData(e,r){let i=Qh.getComponentData({scene:r.scene.data,shared:r.shared.data},e.component);if(i){let s,o;for(let a of Po.rootOverrideProps)e[a]===void 0?(s===void 0&&(s={...e}),s[a]=i.data[a]):(o===void 0&&(o={}),o[a]=e[a],s===void 0&&(s={...e}),s[a]=So.apply(i.data[a],e[a]));return this.overrideData=o,s}else return{...vi.defaultData,...e,...Pn(vi.defaultData,Po.rootOverrideProps)}}updateByOp(e,r,i,s){let o;if(this.isInstanceRoot&&!s){if(r=this.transformAssignData(r,i),e.type===0&&e.path.length===0&&this.component)for(let a of Po.rootOverrideProps)a in e.props&&e.props[a]===void 0&&(o===void 0&&(o={...e,props:{...e.props}}),o.props[a]=this.component.data[a]);else if(e.type===0&&e.path.length>0&&Po.rootOverrideProps.includes(e.path[0])){let a=e.path[0];o===void 0&&(o={...e,path:[],props:{[a]:r[a]}})}}super.updateByOp(o??e,r,i,s)}updateState(e,r){this.updateState_Entity(e,r)}expandInstanceChildren(e){let r=this.data;if(this.component===void 0){let i=e.scene.find(r.component)??null,s=!1;if(i!==this.oldComponent){if(this.oldComponent){let o=0;for(let a of this.children)if(yt.is(a))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(a),eb(a),o+=1;else break;this.children.splice(0,o)}s=!0}if(i){let o={};KL(e,[this.uuid],r.overrides,this,i,i,0,s,o);for(let a of this.children)if(yt.is(a)){let l=a.data;l.type==="Empty"&&l.animations&&a.traverseEntity(c=>{let u=c.dataPatched;if(c instanceof cr&&u.bones&&u.boneInverses){let h=c.dataPatched;if(h.bones&&h.boneInverses){let d=h.bones.map(m=>e.scene.find(o[m])),f=h.boneInverses.map(m=>new ue().fromArray(m)),p=new sl(d,f);c.bind(p,c.bindMatrix)}}else c.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function eb(n){if(n.component){let t=n.component.instances.indexOf(n);t>=0&&n.component.instances.splice(t,1);for(let e of n.children)yt.is(e)&&eb(e)}}function XL(n,t,e,r){return n.component===t&&Rc(n.identity,r)?n.overrideData===e?2:1:0}function KL(n,t,e,r,i,s,o,a,l){if(o>50)return!1;if(r.component!==i){if(r.component){let u=r.component.instances.indexOf(r);u>=0&&r.component.instances.splice(u,1)}i.instances.find(u=>u===r)||i.instances.push(r),r.component=i}i instanceof eo&&i.isInstanceRoot&&i.expandInstanceChildren(n);let c=0;for(let u of i.children)if(yt.is(u)){let h=[...t,...typeof u.identity=="string"?[u.identity]:u.identity],d=Xh.resolve(e,h,1);if(d!=null&&!(d instanceof yr)){if(!1)debugger;Object.setPrototypeOf(d,yr.prototype),console.error("wrong prototype")}let f=null,p;if(!a){let m=r.children[c];if(f=yt.is(m)?m:null,f!==null){let g=XL(f,u,d,h);p=g>=1?f.stateSelection:void 0,g!==2&&(f=null)}if(f===null&&(f=n.scene.findInstance(h)??null,f!==null)){let g=XL(f,u,d,h);if(p=g>=1?f.stateSelection:void 0,g!==2)f=null;else{let y=f.parent.children.indexOf(f);f.parent.children.splice(y,1),r.children.splice(c,0,f),f.parent===r?(y<=c&&console.error("not possible"),void 0):(f.parent=r,f.matrixWorldNeedsUpdate=!0,f.resetBBoxNeedsUpdate(),f.updateVisible(),n.pendingDeletes.delete(f),void 0)}}}if(f===null){let m=d?So.apply(u.data,d):u.data;ks.is(m.type)&&(m={...m,type:"Empty"}),f=Hs.createEntity(h,m,n),f.overrideData=d,r.add(f),r.children.splice(r.children.length-1,1),r.children.splice(c,0,f),f.updateState(f.data,n),p&&f.changeSelectedState(p,n),n.scene.registerInstanceAndSetUuid(f)}if(f.isBone){let m=f.identity[f.identity.length-1];l[m]=f.uuid}c+=1,KL(n,t,e,f,u,s,o+1,a,l)}if(!a){let u=c;for(;;){let h=r.children[c];if(yt.is(h))n.pendingDeletes.add(h);else break;c+=1}r.children.splice(u,c-u)}return!0}var tb=class extends Ss(vp,ws){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}};var Er=class extends cr{constructor(e,r,i){super(e,r,i);this.onBeforeRender=e=>{this.uiCanvas.render(e)};this.uiCanvas=new Of(e+"-canvas",r.geometry.width,r.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(e,r,i){super.updateByPatchedOpGeometry(e,r,i),e.type===0&&(e.props.frame!==void 0&&this.applyFrame(e.props.frame,i.shared),(e.props.width!==void 0||e.props.height!==void 0)&&this.applySize(e.props,i.shared))}applySize(e,r){let i=e?.width??this.dataPatched.geometry.width,s=e?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:s}),this.applyGeometryParametersFromFrame(r)}applyFrame(e,r){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(r),this.applyMaterialParametersFromFrame({shared:r})}applyGeometryParametersFromFrame(e){let r=this.frame;r&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:r.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:r.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=Da(this.dataPatched.geometry,e,this.data.flatShading,this))}applyMaterialParametersFromFrame(e){let r=this.frame;if(r){let i=r.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset(this.dataPatched.material,e,!0)}}updateEntity2DByOp(e,r,i,s){this.uiCanvas.updateEntity2DByOp(e,r,i,s),e===this.frameId&&r.type===0&&(r.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(s):Lt(r.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:s}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(e){super.removeInteractionGeometry(e),this.applySize({},e)}updateGeometryInteractions(e,r){super.updateGeometryInteractions(e,r),this.applySize({width:e.width,height:e.height},r)}};var rb=class{constructor(t,e,r){this.variables=[],this.currentTextureIndex=0;let i=br,s=new ei,o=new qn;o.position.z=1;let a={passThruTexture:{value:null}},l=h(f(),a),c=new Ut(new Li(2,2),l);s.add(c),this.setDataType=function(p){return i=p,this},this.addVariable=function(p,m,g){let y=this.createShaderMaterial(m),v={name:p,initialValueTexture:g,material:y,dependencies:null,renderTargets:[],wrapS:null,wrapT:null,minFilter:Vt,magFilter:Vt};return this.variables.push(v),v},this.setVariableDependencies=function(p,m){p.dependencies=m},this.init=function(){if(r.capabilities.isWebGL2===!1&&r.extensions.has("OES_texture_float")===!1)return"No OES_texture_float support for float textures.";if(r.capabilities.maxVertexTextures===0)return"No support for vertex shader textures.";for(let p=0;pt){s=o;break}else t1&&(s=1-s,o=1-o),$i.a.fromBufferAttribute(this.positionAttribute,t*3),$i.b.fromBufferAttribute(this.positionAttribute,t*3+1),$i.c.fromBufferAttribute(this.positionAttribute,t*3+2),e.set(0,0,0).addScaledVector($i.a,s).addScaledVector($i.b,o).addScaledVector($i.c,1-(s+o)),r!==void 0&&$i.getNormal(r),i!==void 0&&this.colorAttribute!==void 0&&($i.a.fromBufferAttribute(this.colorAttribute,t*3),$i.b.fromBufferAttribute(this.colorAttribute,t*3+1),$i.c.fromBufferAttribute(this.colorAttribute,t*3+2),ib.set(0,0,0).addScaledVector($i.a,s).addScaledVector($i.b,o).addScaledVector($i.c,1-(s+o)),i.r=ib.x,i.g=ib.y,i.b=ib.z),this}};function QL(n){let t=new Float32Array(n*n*2);for(let e=0;e .5) { float isColliding = step(0.5, collisionFlag); // 1.0 if collisionFlag > 0.5, otherwise 0.0 float bounceOffset = 3.0 * isColliding; // Becomes 3.0 if colliding, 0.0 otherwise vec3 collisionAdjustedVelocity = velocity * (1.0 + bounceOffset); // Update position based on collision or normal movement vec3 fpsVelocity = velocity * min(uFPSRatio, 5.0); position += mix(fpsVelocity, collisionAdjustedVelocity, isColliding); // EMISSION RATE - BIRTH // if (isSpawning == 1.0) { // Better Approach to avoid If statement vec3 newPosition = applyQuaternionToVector(uWorldQuaternion, originalPosition) + uWorldOffset; originalPosition = mix(originalPosition, newPosition, isSpawning); position = mix(position, originalPosition, isSpawning);; timeStart = mix(timeStart, uTime, isSpawning); // Calculate timeLeft for life normalization float timeLeft = max(lifeTime - (uTime - timeStart), 0.0); float life_Normalize = timeLeft / lifeTime; // Use isActive to blend between the calculated color and black vec4 activeColor = vec4(position, life_Normalize); // if (isActive == 1.0) { gl_FragColor = mix(vec4(0.0), activeColor, isActive); } `;var rB=` vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; } vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; } vec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); } vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; } vec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); } float snoise(vec3 v) { const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); vec3 i = floor(v + dot(v, C.yyy) ); vec3 x0 = v - i + dot(i, C.xxx) ; vec3 g = step(x0.yzx, x0.xyz); vec3 l = 1.0 - g; vec3 i1 = min( g.xyz, l.zxy ); vec3 i2 = max( g.xyz, l.zxy ); vec3 x1 = x0 - i1 + C.xxx; vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y // Permutations i = mod289(i); vec4 p = permute( permute( permute( i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); // Gradients: 7x7 points over a square, mapped onto an octahedron. // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) float n_ = 0.142857142857; // 1.0/7.0 vec3 ns = n_ * D.wyz - D.xzx; vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7) vec4 x_ = floor(j * ns.z); vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) vec4 x = x_ *ns.x + ns.yyyy; vec4 y = y_ *ns.x + ns.yyyy; vec4 h = 1.0 - abs(x) - abs(y); vec4 b0 = vec4( x.xy, y.xy ); vec4 b1 = vec4( x.zw, y.zw ); vec4 s0 = floor(b0)*2.0 + 1.0; vec4 s1 = floor(b1)*2.0 + 1.0; vec4 sh = -step(h, vec4(0.0)); vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; vec3 p0 = vec3(a0.xy,h.x); vec3 p1 = vec3(a0.zw,h.y); vec3 p2 = vec3(a1.xy,h.z); vec3 p3 = vec3(a1.zw,h.w); //Normalise gradients vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w; // Mix final noise value vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); m = m * m; return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) ); } vec3 snoiseVec3( vec3 x ){ float s = snoise(vec3( x )); float s1 = snoise(vec3( x.y - 19.1 , x.z + 33.4 , x.x + 47.2 )); float s2 = snoise(vec3( x.z + 74.2 , x.x - 124.5 , x.y + 99.4 )); vec3 c = vec3( s , s1 , s2 ); return c; } vec3 curlNoise( vec3 p, float seed){ p += seed; const float e = .1; vec3 dx = vec3( e , 0.0 , 0.0 ); vec3 dy = vec3( 0.0 , e , 0.0 ); vec3 dz = vec3( 0.0 , 0.0 , e ); vec3 p_x0 = snoiseVec3( p - dx ); vec3 p_x1 = snoiseVec3( p + dx ); vec3 p_y0 = snoiseVec3( p - dy ); vec3 p_y1 = snoiseVec3( p + dy ); vec3 p_z0 = snoiseVec3( p - dz ); vec3 p_z1 = snoiseVec3( p + dz ); float x = p_y1.z - p_y0.z - p_z1.y + p_z0.y; float y = p_z1.x - p_z0.x - p_x1.z + p_x0.z; float z = p_x1.y - p_x0.y - p_y1.x + p_y0.x; const float divisor = 1.0 / ( 2.0 * e ); return normalize( vec3( x , y , z ) * divisor ); } // Classic Perlin noise float cnoise(vec3 P) { vec3 Pi0 = floor(P); // Integer part for indexing vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1 Pi0 = mod289(Pi0); Pi1 = mod289(Pi1); vec3 Pf0 = fract(P); // Fractional part for interpolation vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0 vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); vec4 iy = vec4(Pi0.yy, Pi1.yy); vec4 iz0 = Pi0.zzzz; vec4 iz1 = Pi1.zzzz; vec4 ixy = permute(permute(ix) + iy); vec4 ixy0 = permute(ixy + iz0); vec4 ixy1 = permute(ixy + iz1); vec4 gx0 = ixy0 * (1.0 / 7.0); vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5; gx0 = fract(gx0); vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); vec4 sz0 = step(gz0, vec4(0.0)); gx0 -= sz0 * (step(0.0, gx0) - 0.5); gy0 -= sz0 * (step(0.0, gy0) - 0.5); vec4 gx1 = ixy1 * (1.0 / 7.0); vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5; gx1 = fract(gx1); vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); vec4 sz1 = step(gz1, vec4(0.0)); gx1 -= sz1 * (step(0.0, gx1) - 0.5); gy1 -= sz1 * (step(0.0, gy1) - 0.5); vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); g000 *= norm0.x; g010 *= norm0.y; g100 *= norm0.z; g110 *= norm0.w; vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); g001 *= norm1.x; g011 *= norm1.y; g101 *= norm1.z; g111 *= norm1.w; float n000 = dot(g000, Pf0); float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); float n111 = dot(g111, Pf1); vec3 fade_xyz = fade(Pf0); vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); return 2.2 * n_xyz; } vec3 fbm_vec3(vec3 p, float frequency, float offset) { return vec3( cnoise((p+vec3(offset))*frequency), cnoise((p+vec3(offset+20.0))*frequency), cnoise((p+vec3(offset-30.0))*frequency) ); } `;var iB=` #ifdef USE_COLLIDER float restitution = max(uBounce * 2., .01); // Energy Loss // SPHERE COLLIDER // ************************************************************** #ifdef USE_SPHERE_COLLIDER // Convert collider size to radii (assuming uColliderSize is the diameter in each axis) vec3 radii = uColliderSize; // Adjust position relative to collider vec3 relPos = position - uColliderPos; // Apply rotation of the collider to the relative position relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); // Scale relative position by radii (for ellipsoid collision detection) vec3 scaledPos = relPos / radii; // Calculate ellipsoidal distance float dist = length(scaledPos); // Distance in terms of ellipsoid // Check for collision if (dist <= 1. + particleSize / length(radii) && collisionFlag == 0.0) { // Compute the normal at the collision point, accounting for particle size vec3 adjustedPos = scaledPos * (1.0 + particleSize / length(radii)); // Compute the normal at the collision point vec3 normal = ellipsoidNormal(adjustedPos, radii); // Rotate the normal back to world space normal = applyQuaternionToVector(uColliderQuaternion, normal); // Reflect the velocity vector off the normal velocity = reflect(velocity, normal) * restitution; collisionFlag = 1.0; } else { collisionFlag = 0.0; } #endif // BOX COLLIDER or PLANE COLLIDER // ************************************************************** #ifdef USE_BOX_COLLIDER // Box dimensions and repulsion variables vec3 boxHalfSize = uColliderSize / 2.0; // Convert world position to box's local space vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); // Collision detection vec3 localDistance = abs(localPos) - boxHalfSize; float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z)); // Collision Detected if (distToSurface <= particleSize * 0.5 && collisionFlag == 0.0) { // Find the nearest face normal for bounce direction vec3 normal; if (localDistance.x > localDistance.y && localDistance.x > localDistance.z) { normal = vec3(sign(localPos.x), 0.0, 0.0); } else if (localDistance.y > localDistance.z) { normal = vec3(0.0, sign(localPos.y), 0.0); } else { normal = vec3(0.0, 0.0, sign(localPos.z)); } // Rotate normal back to world space normal = applyQuaternionToVector(uColliderQuaternion, normal); // Reflect velocity and apply repulsion force velocity = reflect(velocity, normal) * restitution; collisionFlag = 1.0; } else { collisionFlag = 0.0; } #endif #endif // END COLLIDER `;var nB=` #ifdef USE_ATTRACTOR #ifdef USE_SPHERE_COLLIDER // Convert collider size to radii (assuming uColliderSize is the diameter in each axis) vec3 radii = uColliderSize; // Adjust position relative to collider vec3 relPos = position - uColliderPos; // Apply rotation of the collider to the relative position relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); // Scale relative position by radii (for ellipsoid collision detection) vec3 scaledPos = relPos / radii; // Calculate ellipsoidal distance float distToSurface = length(scaledPos); // Distance in terms of ellipsoid float insideCheck = 1.0; #endif #ifdef USE_BOX_COLLIDER // Box dimensions vec3 boxHalfSize = uColliderSize / 2.0; // Convert world position to box's local space vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); vec3 localDistance = abs(localPos) - boxHalfSize; float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z)); float insideCheck = particleSize; #endif // Apply vortex force inside the Helper #ifdef USE_FORCE_LOCAL_SPACE if (distToSurface <= insideCheck ) { // Define parameters for the attractor field #ifdef USE_SPHERE_COLLIDER float attractorStrength = (1.0 - distToSurface ) * uForceIntensity; // Adjust as needed #endif #ifdef USE_BOX_COLLIDER float attractorStrength = max((1.0 - insideCheck / distToSurface), 0.) * uForceIntensity; // Adjust as needed #endif float attractorDamping = uForceDamping; // Adjust as needed (higher values will attenuate velocity more) // Use the same radii calculation code as for the collider vec3 attractorRadii = uColliderSize; // Adjust position relative to attractor center vec3 relPos = position - uColliderPos; // Apply rotation of the collider to the relative position relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); // Scale relative position by radii (for ellipsoid attraction) vec3 scaledPos = relPos / attractorRadii; // Calculate ellipsoidal distance as attractor radius float attractorRadius = length(scaledPos); // Calculate the distance from the attractor center vec3 relativePosition = position - uColliderPos; // Calculate the force vector towards the attractor center vec3 attractorForce = normalize(relativePosition) * attractorStrength; // Apply the attractor force to the particle velocity -= attractorForce; // Attenuate the particle's velocity velocity *= attractorDamping; } #else // Calculate the distance from the attractor center vec3 relativePosition = position - uColliderPos; // Calculate the force vector towards the attractor center vec3 attractorForce = normalize(relativePosition) * uForceIntensity; // Apply the attractor force to the particle velocity -= attractorForce; // Attenuate the particle's velocity velocity *= uForceDamping; #endif #endif `;var sB=` #ifdef USE_VORTEX // Box dimensions vec3 boxHalfSize = uColliderSize / 2.0; // Convert world position to box's local space vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); vec3 localDistance = abs(localPos) - boxHalfSize; float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z)); // Apply vortex force inside the box if (distToSurface <= particleSize) { float vortexStrength = uForceIntensity; vec3 localTopCenter = vec3(0.0, 0., 0.0); // Transform the local top center to the world space vec3 vortexCenter = uColliderPos + applyQuaternionToVector(uColliderQuaternion, localTopCenter); // Calculate the vector from particle to vortex center vec3 vortexVector = vortexCenter - position; // Calculate the rotation axis from the inverse of the collider's quaternion and the fixed up vector // Note: important to add a tiny z component to the up vector to avoid instability vec3 upVector = vec3(0.0, 1.0, 0.01); vec3 rotationAxis = cross(upVector, applyQuaternionToVector(uColliderQuaternion, vortexVector)); rotationAxis = normalize(rotationAxis); // Add rotational component to velocity float rotationSpeed = length(vortexVector * vortexStrength * 3.0) ; vec3 rotationVelocity = rotationAxis * rotationSpeed; // velocity += rotationVelocity * 0.005 ; velocity = rotationVelocity * 0.005 ; // Calculate vortex force // vec3 vortexForce = normalize(vortexVector) * uSpeed * .1 ; // Apply the vortex force to the particle vec3 originDirection = applyQuaternionToVector(uWorldQuaternion, directions); velocity += applyForce( originDirection * uSpeed * (1. - uForceDamping) , mass * .5); } #endif `;var oB=` // uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU // uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU // uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU uniform sampler2D uOriginalPosition; uniform sampler2D uDirections; uniform vec3 uDirectionsAxis; uniform vec4 uWorldQuaternion; uniform vec3 uGravity; uniform float uNoiseStrength; // Variation of the noise uniform float uNoiseScale; // Scale of the noise uniform float uNoiseSeed; // Seed of the noise uniform float particleSize; uniform float uSpeed; // update speed of the particles uniform float uRandomMassFactor; // COLLIDER uniform vec3 uColliderPos; // Collider Position uniform vec3 uColliderSize; // Collider Dimension uniform vec4 uColliderQuaternion; // Collider Rotation uniform vec4 uColliderQuaternionInvert; // Collider Rotation uniform float uBounce; // Bounce factor uniform float uForceDamping; uniform float uForceIntensity; `+rB+` float rand(vec2 co){ return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453); } vec3 applyQuaternionToVector( vec4 q, vec3 v ){ return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v ); } vec3 applyForce(vec3 force, float mass) { vec3 acceleration = force / mass; return acceleration; } vec4 conjugate(vec4 q) { return vec4(q.w, -q.x, -q.y, -q.z); } // Function to compute the normal of the ellipsoid at a given point vec3 ellipsoidNormal(vec3 p, vec3 radii) { return normalize(p / (radii * radii)); } float friction = .3; void main() { vec2 vUv = gl_FragCoord.xy / resolution.xy; vec3 position = texture2D( uCurrentPosition, vUv ).xyz; vec3 originalPosition = texture2D( uOriginalPosition, vUv ).xyz; float timeLeft = texture2D( uCurrentPosition, vUv ).w; vec3 directions = texture2D( uDirections, vUv ).xyz; vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz; float mass = rand(originalPosition.xy) * 0.5 + 0.5; float isSpawning = texture2D( uCurrentEmissionRate, vUv ).x; // 1. = spawning, 0. = not spawning float isActive = texture2D( uCurrentEmissionRate, vUv ).y; // 1. = active, 0. = not active float collisionFlag =texture2D( uCurrentVelocity, vUv ).w; // Indicate collision // Randomness Mass mass = (1.0 - (uRandomMassFactor * mass)); if (isActive == 1.0) { // ************************************************************** // FORCES NOISES // ************************************************************** #ifdef USE_CURL_NOISE if (uNoiseScale > 0.0 ) { velocity = curlNoise(position * uNoiseScale * .002, uNoiseSeed) * ( uNoiseStrength + 1.0) * .05 * uSpeed; } // Variation of the noise Over Time if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) { velocity += curlNoise( position, uNoiseSeed) * uNoiseStrength * 0.05 * uSpeed; } #endif // ************************************************************** #ifdef USE_SIMPLEX_NOISE if (uNoiseScale > 0.0 ) { velocity = vec3(snoise(position * uNoiseScale * .001) * ( uNoiseStrength + 1.0) * .1); velocity *= uSpeed; } // Variation of the noise Over Time if (uNoiseStrength > 0.0 && uNoiseScale == 0.0) { velocity += vec3(snoise(position * uNoiseStrength * .001) * .05 * uSpeed); } #endif // ************************************************************** #ifdef USE_FBM_NOISE if (uNoiseScale > 0.0 ) { velocity = fbm_vec3(position * uNoiseScale * .001, ( uNoiseStrength + 1.0), uNoiseSeed); velocity *= uSpeed; } // Variation of the noise Over Time if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) { velocity += fbm_vec3(position * uNoiseStrength * .001, ( uNoiseStrength + 1.0), uNoiseSeed) * .1 * uSpeed; } #endif // COLLIDER ${iB} // ATTRACTION ${nB} // VORTEX ${sB} } // End isActive // SPAWN BIRTH // ************************************************************** // if (isSpawning == 1.) #ifdef USE_NORMALS velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, directions) * uSpeed, isSpawning); #else velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, uDirectionsAxis) * uSpeed, isSpawning); #endif // if (collisionFlag == 0.0) velocity += applyForce(uGravity, mass * .5) * (1.0 - collisionFlag); gl_FragColor = vec4(velocity, collisionFlag); } `;var gT=` // Linear Fade In float linearFadeIn(float t) { return t; } // linear fade out float linearFadeOut(float t) { return 1.0 - t; } float linearInOut(float t) { return t < 0.5 ? t : (1.0 - t); } // lerp float lerp(float a, float b, float t) { return a + (b - a) * t; } // Ease In Out Quart float exponentialInOut(float t) { return t < 0.4 ? lerp(0.0, 1.0, t / 0.4) : t > 0.6 ? lerp(1.0, 0.0, (t - 0.6) / 0.4) : 1.0; } // constant float constant(float t) { return 1.0; } `;var aB=` float rand(vec3 co){ return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); } vec3 applyQuaternionToVector( vec4 q, vec3 v ){ return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v ); } vec3 applyForce(vec3 force, float mass) { vec3 acceleration = force / mass; return acceleration; } `;var lB=` vec3 rgb2xyz (in vec3 rgb) { float r = rgb.r; float g = rgb.g; float b = rgb.b; r = r > 0.04045 ? pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); g = g > 0.04045 ? pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); b = b > 0.04045 ? pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); float x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); float y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); float z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); vec3 xyz = vec3( (r * 0.4124) + (g * 0.3576) + (b * 0.1805) * 100.0, (r * 0.2126) + (g * 0.7152) + (b * 0.0722) * 100.0, (r * 0.0193) + (g * 0.1192) + (b * 0.9505) * 100.0 ); return(xyz); } vec3 xyz2lab (in vec3 xyz) { float x = xyz.x / 95.047; float y = xyz.y / 100.0; float z = xyz.z / 108.883; x = x > 0.008856 ? pow(x, 1.0 / 3.0) : (7.787 * x) + (16.0 / 116.0); y = y > 0.008856 ? pow(y, 1.0 / 3.0) : (7.787 * y) + (16.0 / 116.0); z = z > 0.008856 ? pow(z, 1.0 / 3.0) : (7.787 * z) + (16.0 / 116.0); vec3 lab = vec3((116.0 * y) - 16.0, 500.0 * (x - y), 200.0 * (y - z)); return(lab); } vec3 rgb2lab(in vec3 rgb) { vec3 xyz = rgb2xyz(rgb); vec3 lab = xyz2lab(xyz); return(lab); } vec3 xyz2rgb (in vec3 xyz) { float x = xyz.x / 100.0; float y = xyz.y / 100.0; float z = xyz.z / 100.0; float r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); float g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); float b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); r = r > 0.0031308 ? ((1.055 * pow(r, 1.0 / 2.4)) - 0.055) : r * 12.92; g = g > 0.0031308 ? ((1.055 * pow(g, 1.0 / 2.4)) - 0.055) : g * 12.92; b = b > 0.0031308 ? ((1.055 * pow(b, 1.0 / 2.4)) - 0.055) : b * 12.92; r = min(max(0.0, r), 1.0); g = min(max(0.0, g), 1.0); b = min(max(0.0, b), 1.0); return(vec3(r, g, b)); } vec3 lab2xyz (in vec3 lab) { float l = lab.x; float a = lab.y; float b = lab.z; float y = (l + 16.0) / 116.0; float x = a / 500.0 + y; float z = y - b / 200.0; float y2 = pow(y, 3.0); float x2 = pow(x, 3.0); float z2 = pow(z, 3.0); y = y2 > 0.008856 ? y2 : (y - 16.0 / 116.0) / 7.787; x = x2 > 0.008856 ? x2 : (x - 16.0 / 116.0) / 7.787; z = z2 > 0.008856 ? z2 : (z - 16.0 / 116.0) / 7.787; x *= 95.047; y *= 100.0; z *= 108.883; return(vec3(x, y, z)); } vec3 lab2rgb (in vec3 lab) { vec3 xyz = lab2xyz(lab); vec3 rgb = xyz2rgb(xyz); return(rgb); } `;var cB=` uniform sampler2D uPosition; uniform float uSize; uniform float uSizeEnd; uniform vec3 uWorldOffset; uniform vec4 uWorldQuaternion; // Billboard Behavior - Currently at Zero, but we can change that uniform float uRotation; uniform float uRotationEnd; uniform vec2 center; // Randomness uniform float uRandScaleFactor; uniform float uRandRotationFactor; attribute vec2 ref; varying float v_LifeLeft; // normalized lifetime 1 to 0 varying vec2 vUv; varying vec2 vRef; ${aB} ${gT} `,uB=({easeSize:n="linearFadeOut"})=>` vUv = uv; vRef = ref; // Normalized LifeTime 1 to 0 float lifeLeft = texture2D(uPosition, ref).w; v_LifeLeft = lifeLeft; // Position From DataTexture Simulation vec3 pos = texture2D(uPosition, ref).rgb - uWorldOffset; // Apply World Quaternion pos = applyQuaternionToVector(uWorldQuaternion, pos); #ifdef USE_SIZE_END // Scaled Over Time float t = 1. - lifeLeft; float currentSize = mix(uSize, uSizeEnd, t); // Linearly interpolate between uSize and uSizeEnd vec3 scaledPosition = position * vec3(currentSize); #else // Change Size Behavior over LifeTime float easeSize = ${n}(1. - lifeLeft); // Scaled Over Time vec3 scaledPosition = position * vec3(uSize * easeSize); #endif // Billboard Behavior vec2 scale; scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); // Randomness float randRef = rand(ref); scale *= (1.0 - (uRandScaleFactor * randRef)); // Rotation float randRotation = 2.0 * PI * ( uRandRotationFactor * randRef); float originalRotation = (1.0 - uRotation) * 2.0 * PI; float originalRotationEnd = (1.0 - uRotationEnd) * 2.0 * PI; // OverTime float finalRotation = mix(originalRotation + randRotation, originalRotationEnd + randRotation, lifeLeft); vec2 alignedPosition = ( scaledPosition.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( finalRotation ) * alignedPosition.x - sin( finalRotation ) * alignedPosition.y; rotatedPosition.y = sin( finalRotation ) * alignedPosition.x + cos( finalRotation ) * alignedPosition.y; mat4 instanceMatrix = mat4( vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(pos.x, pos.y, pos.z, 1.0) ); mvPosition = modelViewMatrix * instanceMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; `,hB=` uniform vec4 uColor; // start color uniform vec4 uColor2; // end color uniform sampler2D uTexture; // texture varying float v_LifeLeft; // normalized lifetime 1 to 0 varying vec2 vUv; varying vec2 vRef; float random(vec2 co) { return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); } `+gT+` ${lB} `,dB=({easeOpacity:n="linearFadeOut"})=>` // if Particle is dead, hide it if (v_LifeLeft <= 0.005 ) { discard; } #ifdef USE_RANDOM_COLORING float randVal = random(vRef); // Generate a random value based on the reference vec4 color = mix(uColor, uColor2, randVal); // Interpolate between the two colors #else vec4 color = mix(uColor, uColor2, 1. - v_LifeLeft); #endif // Opacity over Life Time float finalAlpha = ${n}(1. - v_LifeLeft); vec4 textureColor = texture2D(uTexture, vUv).rgba; finalColor = textureColor.rgb * color.rgb; finalAlpha = color.a * textureColor.a * finalAlpha; gl_FragColor = vec4(finalColor, finalAlpha); `;var sb=class extends it{constructor(e,r){super();this.needsJitter=!0;this.type="ParticleMaterial";this.easeOpacity="linearFadeIn";this.easeSize="linearFadeIn";this.useSizeEnd=!1;this.isColoringRandom=!1;this.init(e,r),this.context=r}reset(){}init(e,r){this.transparent=!0,this.depthTest=!0,this.depthWrite=!1,this.easeOpacity=e.ease,this.easeSize=e.easeSize,this.layers=[],or.startContext(or.globalContext),this.lightLayer=new wn(0,"",{...Gr.defaultData("light","phong"),visible:!1},new Ra,{},r.shared),or.endContext(or.globalContext),this.build()}updateState(e){e.coloring!==void 0&&(this.isColoringRandom=e.coloring==="random"),e.color!==void 0&&(e.color instanceof Array?this.uniforms.uColor.value=e.color:this.uniforms.uColor.value=this.context.shared.color(e.color)),e.color2!==void 0&&(e.color2 instanceof Array?this.uniforms.uColor2.value=e.color2:this.uniforms.uColor2.value=this.context.shared.color(e.color2)),e.size!==void 0&&(this.uniforms.uSize.value=e.size[0],this.uniforms.uSizeEnd.value=e.size[1],e.size[0]!==e.size[1]?this.useSizeEnd=!0:this.useSizeEnd=!1),e.ease!==void 0&&(this.easeOpacity=e.ease,this.build()),e.easeSize!==void 0&&(this.easeSize=e.easeSize,this.build()),this.needsUpdate=!0}onBeforeCompile(e){this.build(),e.defines=this.defines,e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader}build(){let e=new Ud;return e.needsJitter=this.needsJitter,e.addFragmentParsCode(MR),e.buildShader("vertex",this.fragment),e.buildShader("fragment",this.fragment),e.addFragmentFinalCode(CR),this.isColoringRandom&&e.define("USE_RANDOM_COLORING"),this.useSizeEnd&&e.define("USE_SIZE_END"),e.addVertexParsCode(cB),e.addFragmentParsCode(hB),e.addVertexFinalCode(uB({easeSize:this.easeSize})),e.addFragmentFinalCode(dB({easeOpacity:this.easeOpacity})),this.vertexShader=e.getCode("vertex"),this.fragmentShader=e.getCode("fragment"),this.defines=e.defines,this.uniforms={...e.uniforms,...this.uniforms},this.extensions=e.extensions,this}get nodeMaterial(){return this}get fragment(){return this.lightLayer.node}getDefines(){return this.defines}nodeMaterialDispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}};var Rf=class{constructor(t,e,r,i){this.type="SphereEmitterShape";this.targetMesh=void 0;this.size=t,this.type=r,this.textureSize=ZL(e);let s=1;this.targetMesh=i?.type==="Mesh"&&i?i:this.getMesh(r,s);let{positions:o,dataTexture:a,dataTextureNormals:l}=this.createPositions(this.textureSize,this.targetMesh??this.getMesh(r,s));this.positionsTexture=a,this.positionsAttribute=o,this.directionsTexture=l}createPositions(t,e){let{positions:r,normals:i}=JL(e,t*t),s=mT(r,t),o=mT(i,t);return{dataTexture:s,positions:r,dataTextureNormals:o}}getMesh(t,e){let r=null;switch(t){case"SphereEmitterShape":{r=new Bs(e*.5,32,32);break}case"TorusEmitterShape":{r=new Wu(e*.5,.3,15,40);break}case"ConeEmitterShape":{r=new al(e,e,15);break}case"BoxEmitterShape":{r=new mi(e,e,e);break}case"PlaneEmitterShape":{r=new Li(e,e),r.rotateX(-Math.PI/2);break}case"MeshEmitterShape":{r=new Bs(e,32,32);break}default:{r=new Bs(e,32,32);break}}return new Ut(r,new on({color:16711680}))}applyToShader(t,e){this.size=new E().fromArray(e.size),t.uEmitterSize.value=this.size}dispose(){this.positionsTexture.dispose(),this.directionsTexture.dispose(),this.positionsAttribute=new Float32Array}};function nc(n){let t={...n},e=Gh.defaultData;t.forceFieldObjectId&&(t.colliderEntityId=t.forceFieldObjectId);let r={...e.shape,...t.shape},i={...e.renderMaterial,...t.renderMaterial};return{...e,...t,shape:r,renderMaterial:i}}var fB=` // uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU // uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU // uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU uniform sampler2D uIndex; // Texture with corresponding index uniform float uLastIndexEmitted; // Last emitted index uniform float uParticlesToEmit; // Number of particles to emit on that frame uniform float uTime; void main() { vec2 vUv = gl_FragCoord.xy / resolution.xy; float particleIndex = texture(uIndex, vUv).x; float timeLeft = texture2D( uCurrentPosition, vUv ).w; float isActive = texture2D( uCurrentEmissionRate, vUv ).g; // 1. = active, 0. = not active float timeStart = texture2D( uCurrentEmissionRate, vUv ).b; // ********** Detect Colision to Create a flag and use it in position ********** // We are doing this here, so // ********** Emit Particles ********** // X = isSpawning 0.0 or 1.0 // Y = isActive 0.0 or 1.0 // Check if the vertex index is between the first value and the last value // if (particleIndex >= uLastIndexEmitted && particleIndex < uLastIndexEmitted + uParticlesToEmit) { // // Emit a particle by writing 1 to the red channel of the color output // // r: 1. == emit the particle // // g: 1. == particle is now active // timeStart = uTime; // gl_FragColor = vec4(1.0, 1.0, timeStart, 1.0); // } else { // // The Particle is either already emitted or not in the range of the particles to emit // // Do not emit a particle by writing 0 to the red channel of the color output // gl_FragColor = vec4(0.0, isActive, timeStart, 1.0); // } // Determine if the particle is within the emission range float emitLowerBound = step(uLastIndexEmitted, particleIndex); float emitUpperBound = step(particleIndex, uLastIndexEmitted + uParticlesToEmit - 1.0); float emitParticle = emitLowerBound * emitUpperBound; // 1.0 if in range, 0.0 otherwise // Set timeStart and color timeStart = mix(timeStart, uTime, emitParticle); gl_FragColor = vec4(emitParticle, mix(isActive, 1.0, emitParticle), timeStart, 1.0); } `;var yT=10,ob=class extends Tt{constructor(e,r){super();this.type="ParticleEmitter";this.debugMode=!1;this.worldSpace=!0;this.rootObject=null;this.gpuCompute=null;this.positionSimRT=null;this.velocitySimRT=null;this.emissionRateSimRT=null;this.emitterShape=void 0;this.isEmitting=!1;this.hasBeenReset=!1;this.emittedParticlesAmount=0;this.lastEmitTime=0;this.globalTime=0;this.targetFPS=60;this.previousRatio=1;this.lerpFactor=.4;this.particlesAmount=0;this.noiseStrength=0;this.noiseScale=0;this.isBillboardBased=!0;this.simFeaturesDefinition={USE_COLLIDER:!1,USE_ATTRACTOR:!1,USE_VORTEX:!1,USE_SPHERE_COLLIDER:!1,USE_BOX_COLLIDER:!1,USE_FORCE_LOCAL_SPACE:!1,USE_NORMALS:!1,USE_CURL_NOISE:!0,USE_SIMPLEX_NOISE:!1,USE_FBM_NOISE:!1};this.textureLoader=new Ay;this.currentWorldPosition=new E;this.systemQuaternion=new Ke;this.worldGravity=new E(0,0,0);this.directionAxis=new E(0,0,0);this.colliderV3=new E(0,0,0);this.colliderQuaternion=new Ke(0,0,0,1);this.matrixAutoUpdate=!0,this.renderer=e,this.system=r,this.shared=r.context.shared;let i=r.data;this.material=new sb(i.renderMaterial,r.context),this.material.uniforms={uSize:{value:0},uSizeEnd:{value:0},uColor:{value:i.renderMaterial.color},uColor2:{value:i.renderMaterial.color2},uPosition:{value:new E(0,0,0)},uEmissionData:{value:new E(0,0,0)},uTexture:{value:this.defaultTexture},uWorldOffset:{value:new E(0,0,0)},uWorldQuaternion:{value:new Ze(0,0,0,1)},uRandScaleFactor:{value:i.randomScale??0},uRandRotationFactor:{value:i.randomRotation??0},uRotation:{value:i.renderMaterial.spriteRotation[0]??0},uRotationEnd:{value:i.renderMaterial.spriteRotation[1]??0}},this.setTexture(this.material.uniforms,i.renderMaterial.texture),this.init(i)}setTexture(e,r){let i=r.data;if(typeof r=="string"){let s=this.shared.image(r),o=new er(s.img);o.needsUpdate=!0,e.uTexture.value=o;return}if(typeof i!="string"){let s=new Image;s.onload=()=>{let l=new er(s);l.needsUpdate=!0,e.uTexture.value=l};let o=new Blob([i],{type:"image/*"}),a=URL.createObjectURL(o);s.src=a}}updateGeometryAttributes(e,r){let i=QL(r);!this.emitterShape?.positionsAttribute||e.geometry.setAttribute("ref",new mo(i,2))}applyWorldSpace(){if(!this.system.started||!this.worldSpace||!this.positionSimRT||!this.velocitySimRT)return;let e=this.system;e.getWorldQuaternion(this.systemQuaternion),this.systemQuaternion.invert(),e.getWorldPosition(this.currentWorldPosition),this.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.positionSimRT.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.systemQuaternion.invert(),this.positionSimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.velocitySimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize())}update(e,r){if(!this.gpuCompute||!this.positionSimRT||!this.velocitySimRT||!this.emissionRateSimRT||this.hasBeenReset)return;if(this.checkIfAllParticlesAreDead()&&!this.hasBeenReset){this.reset();return}this.applyWorldSpace(),this.globalTime=e,this.positionSimRT.material.uniforms.uTime.value=e,this.emissionRateSimRT.material.uniforms.uTime.value=e;let i=1e3/r,s=this.targetFPS/i,o=this.previousRatio+(s-this.previousRatio)*this.lerpFactor;this.positionSimRT.material.uniforms.uFPSRatio.value=o,this.previousRatio=o;let a=this.isEmitting?this.GoEmitSomeParticles(e,this.system.data.birthRatePerSec):0;this.emissionRateSimRT.material.uniforms.uLastIndexEmitted.value=this.emittedParticlesAmount,this.emissionRateSimRT.material.uniforms.uParticlesToEmit.value=a,this.material.uniforms.uPosition.value=this.gpuCompute.getCurrentRenderTarget(this.positionSimRT)?.texture,this.system.colliderEntities.length>0&&this.renderColliders(),this.gpuCompute.compute()}renderColliders(){if(!this.velocitySimRT)return;let e=this.system.colliderEntities[0],r=this.simFeaturesDefinition.USE_COLLIDER||this.simFeaturesDefinition.USE_ATTRACTOR||this.simFeaturesDefinition.USE_VORTEX;if(e.destroyedInAction&&r&&this.init(nc({...this.system.data,colliderEntityId:null})),!e||e.destroyedInAction)return;e.getWorldPosition(this.colliderV3),this.colliderV3.y===0&&(this.colliderV3.y=1e-4),this.velocitySimRT.material.uniforms.uColliderPos.value.copy(this.colliderV3);let i=e.data.size;this.colliderV3.fromArray(i),this.velocitySimRT.material.uniforms.uColliderSize.value.copy(this.simFeaturesDefinition.USE_SPHERE_COLLIDER?this.colliderV3.multiplyScalar(.5):this.colliderV3),e.getWorldQuaternion(this.colliderQuaternion),this.velocitySimRT.material.uniforms.uColliderQuaternion.value.copy(this.colliderQuaternion.normalize()),this.velocitySimRT.material.uniforms.uColliderQuaternionInvert.value.copy(this.colliderQuaternion.normalize().invert())}updateState(e){!this.velocitySimRT||!this.positionSimRT||(e.renderMaterial&&this.updateMaterialState(e.renderMaterial),this.updateParticleState(e))}updateVariableState(e,r){if(!this.velocitySimRT||!this.positionSimRT)return;r[2]==="size"&&this.material.updateState({size:[e,this.material.uniforms.uSizeEnd.value]}),r[2]==="sizeEnd"&&this.material.updateState({size:[this.material.uniforms.uSize.value,e]});let i=(s,o)=>{let a=[...this.system.data.shape.size];a[s]=o,this.updateParticleState({shape:{...this.system.data.shape,size:a}})};r[2]==="shape_size_0"&&i(0,e),r[2]==="shape_size_1"&&i(1,e),r[2]==="shape_size_2"&&i(2,e),r[2]==="speed"&&(this.velocitySimRT.material.uniforms.uSpeed.value=e/yT),r[2]==="gravity"&&this.worldGravity.set(0,e/100,0),r[2]==="noiseStrength"&&(this.noiseStrength=e,this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),r[2]==="noiseScale"&&(this.noiseScale=e,this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),r[2]==="direction_x"&&(this.directionAxis=this.getDirectionAxis([Number(e),this.system.data.direction[1],this.system.data.direction[2]])),r[2]==="direction_y"&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],Number(e),this.system.data.direction[2]])),r[2]==="direction_z"&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],this.system.data.direction[1],Number(e)]))}updateMaterialState(e){this.material.updateState({...e,size:e.size?[Number(this.shared.getVariable(e.size[0],[this.uuid,"particles","size"])),Number(this.shared.getVariable(e.size[1],[this.uuid,"particles","sizeEnd"]))]:[0,0]}),e.texture&&(this.setTexture(this.material.uniforms,e.texture),this.material.needsUpdate=!0)}updateParticleState(e){if(!(!this.positionSimRT||!this.velocitySimRT)){if(this.shouldReInitGPUCompute(e)&&this.init(nc(this.system.data)),e.life!==void 0&&(this.positionSimRT.material.uniforms.uMaxLifeTime.value=e.life),e.speed!==void 0&&(this.velocitySimRT.material.uniforms.uSpeed.value=Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/yT),e.collisionBounce!==void 0&&(this.velocitySimRT.material.uniforms.uBounce.value=e.collisionBounce),e.noiseStrength!==void 0&&(this.noiseStrength=Number(this.shared.getVariable(e.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),e.noiseScale!==void 0&&(this.noiseScale=Number(this.shared.getVariable(e.noiseScale,[this.uuid,"particles","noiseScale"])),this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),e.noiseSeed!==void 0&&(this.velocitySimRT.material.uniforms.uNoiseSeed.value=e.noiseSeed),e.randomMass!==void 0&&(this.velocitySimRT.material.uniforms.uRandomMassFactor.value=e.randomMass),e.renderMaterial?.size!==void 0){let r=this.shared.getVariable(e.renderMaterial.size[0],[this.uuid,"particles","size"]);this.velocitySimRT.material.uniforms.particleSize.value=Number(r)}if(e.renderMaterial?.spriteRotation!==void 0&&(this.material.uniforms.uRotation.value=e.renderMaterial.spriteRotation[0],this.material.uniforms.uRotationEnd.value=e.renderMaterial.spriteRotation[1]),e.shape!==void 0){let r=e.shape.size??this.system.data.shape.size,i=[Number(this.shared.getVariable(r[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(r[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(r[2],[this.uuid,"particles","shape_size_2"]))],s={...nc(this.system.data).shape,size:i};this.emitterShape?.applyToShader(this.positionSimRT.material.uniforms,s)}if(e.gravity!==void 0&&(this.worldGravity.set(0,Number(this.shared.getVariable(this.system.data.gravity,[this.uuid,"particles","gravity"]))/100,0),this.velocitySimRT.material.uniforms.uGravity={value:this.worldGravity}),e.direction!==void 0){let r=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(r),this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis}e.randomRotation!==void 0&&(this.material.uniforms.uRandRotationFactor.value=e.randomRotation),e.randomScale!==void 0&&(this.material.uniforms.uRandScaleFactor.value=e.randomScale)}}updateForceFieldParameters(e){!this.velocitySimRT||(e.forceIntensity!==void 0&&(this.velocitySimRT.material.uniforms.uForceIntensity.value=e.forceIntensity),e.forceDambing!==void 0&&(this.velocitySimRT.material.uniforms.uForceDamping.value=e.forceDambing))}getDirectionAxis(e){let r=[Number(e[0])*we.DEG2RAD,Number(e[1])*we.DEG2RAD,Number(e[2])*we.DEG2RAD],i=new nr(r[0],r[1],r[2],"XYZ");return this.directionAxis.set(0,1,0).applyEuler(i).normalize(),this.velocitySimRT&&(this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis),this.directionAxis}shouldReInitGPUCompute(e){let{birthRatePerSec:r,rootObjectType:i,colliderEntityId:s,shape:o,emitTimeDuration:a,emitTimeCycle:l,life:c,directionMode:u,noiseType:h}=e;return r!==void 0||i!==void 0||(s||s===null)||l!==void 0||o!==void 0||c!==void 0||a!==void 0||u!==void 0||h!==void 0}init(e){this.dispose(),this.particlesAmount=this.getMaxParticlesAmount({birthRatePerSecond:e.birthRatePerSec,particleMaxLifeTime:e.life,loopDuration:e.emitTimeCycle==="infinity"?0:e.emitTimeDuration}),this.particlesAmount>1e5&&(console.warn(`The maximum number of particles is limited to ${1e5}.`),this.particlesAmount=1e5),this.emitterShape=this.createShape(e.shape,this.particlesAmount);let r=setInterval(()=>{if(!!this.emitterShape)if(isNaN(this.emitterShape.positionsTexture.source.data.data[0])){this.init(e);return}else clearInterval(r)},100);if(!this.emitterShape)return;let i=new rb(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer),s=this.updateSimulationDefinition(e),o=i.addVariable("uCurrentPosition",s+tB,this.emitterShape.positionsTexture),a=i.addVariable("uCurrentVelocity",s+oB,this.emitterShape.directionsTexture),l=i.addVariable("uCurrentEmissionRate",fB,eB(this.emitterShape.textureSize));i.setVariableDependencies(o,[o,a,l]),i.setVariableDependencies(a,[o,a,l]),i.setVariableDependencies(l,[o,a,l]);let c=$L({size:this.emitterShape.textureSize}),u={uOriginalPosition:{value:this.emitterShape.positionsTexture},uWorldOffset:{value:new E(0,0,0)},uWorldQuaternion:{value:new Ze(0,0,0,1)},uTime:{value:0},uFPSRatio:{value:1},uMaxLifeTime:{value:e.life},uEmitterSize:{value:new E(Number(this.shared.getVariable(e.shape.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(e.shape.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(e.shape.size[2],[this.uuid,"particles","shape_size_2"])))},particleSize:{value:0}};o.material.uniforms=u;let h=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(h),this.worldGravity.set(0,Number(this.shared.getVariable(this.system.data.gravity,[this.uuid,"particles","gravity"]))/100,0),this.noiseStrength=Number(this.shared.getVariable(e.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.noiseScale=Number(this.shared.getVariable(e.noiseScale,[this.uuid,"particles","noiseScale"]));let d=e.colliderEntityId&&this.system.getColliderData(e.colliderEntityId),f={uOriginalPosition:{value:this.emitterShape.positionsTexture},uDirections:{value:this.emitterShape.directionsTexture},uDirectionsAxis:{value:this.directionAxis},uWorldQuaternion:{value:new Ze(0,0,0,1)},uColliderPos:{value:new E(0,0,0)},uColliderSize:{value:new E(0,0,0)},uForceIntensity:{value:d?d.forceIntensity:0},uForceDamping:{value:d?d.forceDambing:0},uColliderQuaternion:{value:new Ze(0,0,0,1)},uColliderQuaternionInvert:{value:new Ze(0,0,0,1)},particleSize:{value:0},uGravity:{value:this.worldGravity},uNoiseStrength:{value:this.noiseStrength},uNoiseScale:{value:this.noiseScale},uNoiseSeed:{value:e.noiseSeed},uRandomMassFactor:{value:e.randomMass},uBounce:{value:e.collisionBounce},uSpeed:{value:Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/yT}};a.material.uniforms=f;let p={uIndex:{value:c},uTime:{value:0},uLastIndexEmitted:{value:0},uParticlesToEmit:{value:0}};l.material.uniforms=p;let m=[Number(this.shared.getVariable(e.shape.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(e.shape.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(e.shape.size[2],[this.uuid,"particles","shape_size_2"]))],g={...nc(this.system.data).shape,size:m};this.emitterShape.applyToShader(o.material.uniforms,g),i.init(),this.gpuCompute=i,this.positionSimRT=o,this.velocitySimRT=a,this.emissionRateSimRT=l,this.rootObject=this.createPrimaryEmitter(this.emitterShape.textureSize),this.add(this.rootObject),this.material.needsUpdate=!0}getDirectionFromVariable(e){let r=Number(this.shared.getVariable(e[0],[this.uuid,"particles","direction_x"])),i=Number(this.shared.getVariable(e[1],[this.uuid,"particles","direction_y"])),s=Number(this.shared.getVariable(e[2],[this.uuid,"particles","direction_z"]));return[r,i,s]}updateSimulationDefinition(e){if(this.simFeaturesDefinition.USE_COLLIDER=!1,this.simFeaturesDefinition.USE_ATTRACTOR=!1,this.simFeaturesDefinition.USE_VORTEX=!1,this.simFeaturesDefinition.USE_SPHERE_COLLIDER=!1,this.simFeaturesDefinition.USE_BOX_COLLIDER=!1,this.simFeaturesDefinition.USE_FORCE_LOCAL_SPACE=!1,this.simFeaturesDefinition.USE_NORMALS=!1,this.simFeaturesDefinition.USE_CURL_NOISE=!1,this.simFeaturesDefinition.USE_SIMPLEX_NOISE=!1,this.simFeaturesDefinition.USE_FBM_NOISE=!1,e.colliderEntityId&&this.system.colliderEntities.length>0){let i=this.system.getColliderData(e.colliderEntityId);switch(i?.forceType){case"attractor":this.simFeaturesDefinition.USE_ATTRACTOR=!0;break;case"collider":this.simFeaturesDefinition.USE_COLLIDER=!0;break;case"vortex":this.simFeaturesDefinition.USE_VORTEX=!0;break}let s=i?.colliderType;s==="sphere"&&(this.simFeaturesDefinition.USE_SPHERE_COLLIDER=!0),s==="box"&&(this.simFeaturesDefinition.USE_BOX_COLLIDER=!0),i?.forceRange==="helper"&&(this.simFeaturesDefinition.USE_FORCE_LOCAL_SPACE=!0)}e.directionMode==="normals"&&(this.simFeaturesDefinition.USE_NORMALS=!0),e.noiseType==="curl"&&(this.simFeaturesDefinition.USE_CURL_NOISE=!0),e.noiseType==="simplex"&&(this.simFeaturesDefinition.USE_SIMPLEX_NOISE=!0),e.noiseType==="fbm"&&(this.simFeaturesDefinition.USE_FBM_NOISE=!0);let r="";for(let[i,s]of Object.entries(this.simFeaturesDefinition))s&&(r+=`#define ${i} `);return r}createShape(e,r){this.emitterShape&&this.emitterShape.dispose();let i=new E(Number(this.shared.getVariable(e.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(e.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(e.size[2],[this.uuid,"particles","shape_size_2"])));if(e.type==="MeshEmitterShape"){let s=null;return this.system.context.scene.traverseEntity(o=>{o.uuid===e.fromMeshId&&(s=o)}),s?new Rf(i,r,e.type,s):new Rf(i,r,"SphereEmitterShape")}else return new Rf(i,r,e.type)}createPrimaryEmitter(e){let r,i=e*e;return r=new yy(new Li(1,1,1),this.material,i),this.updateGeometryAttributes(r,e),this.material.needsUpdate=!0,r.onBeforeRender=()=>{this.applyWorldSpace()},r}getMaxParticlesAmount({birthRatePerSecond:e,particleMaxLifeTime:r,loopDuration:i=0}){return Math.ceil(e*(r+i))}dispose(){!this.gpuCompute||(this.rootObject?.parent?.remove(this.rootObject),this.gpuCompute.dispose(),this.material.nodeMaterialDispose(),this.emitterShape?.dispose())}GoEmitSomeParticles(e,r){let i=e-this.lastEmitTime,s=1/r;if(i>=s){let o=Math.max(1,Math.floor(i/s));return this.lastEmitTime=e,this.emittedParticlesAmount+o>this.particlesAmount&&(this.emittedParticlesAmount=0),this.emittedParticlesAmount+=o,o}return 0}checkIfAllParticlesAreDead(){return this.lastEmitTime+this.system.data.life+1{this._hasOnAfterRenderBeenCalled||(this._hasOnAfterRenderBeenCalled=!0,this.init(e))};this.context=i,this.data={...r,...nc(r)},this.geometry.setAttribute("position",new Te([],3)),this.material=new on({colorWrite:!1}),this.frustumCulled=!1}init(e){this.renderer=e,this.emitter=new ob(e,this),this.add(this.emitter),this.updateParticleState(this.data)}update(e){if(!this.isReady||!this.started||this.isFrozen||this.isIdle)return;this.actualTime+=e,this.stopped||(this.currentLoopTime+=e);let r=this.data.emitTimeCycle==="one_time";if((this.data.emitTimeCycle==="loop"||r)&&this.currentLoopTime>this.data.emitTimeDuration*1e3&&(this.stopped||(this.stop(),r||this.start(this.data.emitTimeDelay*1e3))),this.emitter&&this.started){let s=this.actualTime/1e3;this.emitter.update(s,e)}this.scale.set(1,1,1),this.updateMatrix()}isReady(){return!!this.emitter}hasCollider(e){return this.colliderEntities.some(r=>r.identity===e)}getColliderData(e){let r=this.colliderEntities.find(i=>i.identity===e);return r?r.data:null}updateByPatchedOp(e,r,i){super.updateByPatchedOp(e,r,i),Lt(e.path,["renderMaterial"])&&this.updateParticleState({renderMaterial:{...this.data.renderMaterial,...Lr.drop(e,1).props}}),Lt(e.path,["shape"])&&this.updateParticleState({shape:{...this.data.shape,...Lr.drop(e,1).props}})}updateState(e,r){super.updateState(e,r),this.updateParticleState(e)}updateParticleState(e){if(!!this.emitter){if(e.colliderEntityId!==void 0&&e.colliderEntityId!==null){let r=this.context.scene.find(e.colliderEntityId);this.colliderEntities=r?[r]:[]}e.colliderEntityId===null&&(this.colliderEntities=[]),this.emitter.updateState(e),e.emitTimeCycle&&this.started&&this.start()}}updateFromColliderEntity(e){!this.emitter||(this.emitter.updateForceFieldParameters(e),this.stop(),this.start())}start(e=0){if(this.currentLoopTime=0,e){this.timeoutId=window.setTimeout(()=>{this.start(0)},e);return}this.started=!0,this.stopped=!1,this.isFrozen=!1,this.emitter?.startEmitting(this.actualTime/1e3)}froze(){this.isFrozen=!0}unFroze(){this.isFrozen=!1}stop(){this.stopped=!0,this.currentLoopTime=0,this.emitter?.stopEmitting(),clearTimeout(this.timeoutId)}reset(){this.started=!1,this.stopped=!1,this.emitter?.reset()}wakeUp(){this.isIdle=!1}sleep(){this.isIdle=!0,this.reset()}};function DZ(){try{let n=window.location.href;if(n.includes("reducesubdiv=")){let t=n.indexOf("reducesubdiv=")+13;return parseInt(n.slice(t,t+1))}}catch{}}var vT=DZ();function OZ(n,t,e){vT!==void 0&&(t?.geometry?.subdivisions??0)>vT&&(console.log("reducing subdivisions",t.name,t.geometry.subdivisions),t.geometry.subdivisions=vT);let r;return t.geometry.type==="TextGeometry"?new Yl(n,t,e):t.geometry.type==="InputGeometry"?new ic(n,t,e):(t.geometry.type==="SubdivGeometry"?r=new Zs(n,t,e):t.geometry.type==="PathGeometry"?r=new rc(n,t,e):t.geometry.type==="VectorGeometry"?r=new $x(n,t,e):t.geometry.type==="BooleanGeometry"?r=new Fn(n,t,e):t.geometry.type==="UIGeometry"?r=new Er(n,t,e):r=new cr(n,t,e),r)}function ab(n,t,e){return console.assert(t.type!==void 0),t.type==="Mesh"?OZ(n,t,e):t.type==="Empty"?new As(n,t):t.type==="Particle"?new sc(n,t,e):t.type==="ParticleCollider"?new Kl(n,t,e):t.type==="Splat"?new As(n,t):t.type==="Bone"?new tb(n,t):t.type==="Page"?new ur(n,t,e):t.type==="PointLight"?new Jx(n,t,e):t.type==="SpotLight"?new If(n,t,e):t.type==="DirectionalLight"?new _f(n,t,e):t.type==="Component"||t.type==="Instance"?new eo(n,t,e):ks.is(t.type)?new wr(n,t):(console.error(t),new As(n,t))}Hs.createEntity=ab;function RZ(n,t,e){let r=ab(n.identity,t,e),i=n.children,s=n.attachedPaths,o=n.parent,a=n.component,l=n.instances,c=n.overrideData,u=n.uuid,h=n.stateSelection;n.dispose();for(let d of Object.keys(n))delete n[d];Object.setPrototypeOf(n,Object.getPrototypeOf(r));for(let d of Object.keys(r))n[d]=r[d];n.children=[...n.children,...i],n.attachedPaths=s,n.parent=o,n.component=a,n.instances=l,n.uuid=u,n.overrideData=c,n.updateState(n.data,e),h&&n.changeSelectedState(h,e),n.resetBBoxNeedsUpdate()}Hs.changeEntityProptotype=RZ;Hs.Cloner=Gi;function mB(n,t,e,r){n.updateByOp(t,e,r,!1)}function gB(n,t){let e=!1,r=t.getLayersOfType("transmission"),i=t.getLayersOfType("outline");return i.length>0&&(n.layers.set(8),r.length>0&&n.layers.enable(3),e=!0,af(n),of(n)),r.length===0&&i.length===0&&n.layers.set(0),n instanceof vs&&n.needsAO&&n.layers.enable(5),e}function yB(n,t){if(!t.layers)return!1;let e=!1,r=t.getLayersOfType("transmission").filter(s=>s.data.visible),i=t.getLayersOfType("outline").filter(s=>s.data.visible);return r.length>0&&(n.layers.set(3),i.length>0&&n.layers.enable(8),e=!0),r.length===0&&i.length===0&&n.layers.set(0),n.needsAO&&n.layers.enable(5),e}function vB(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof vs)if(Array.isArray(e.material))for(let r=0;r{if(e instanceof vs)if(Array.isArray(e.material))for(let r=0;r0&&e.push({...u[0],object:r?s:n})}}var lb=class{constructor(){this._constraints=new Map}setConstraint(t,e){e===null?this._constraints.delete(t):this._constraints.set(t,e)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((r,i)=>{let s=[i,r],o=r;for(;this._constraints.has(o);){if(o=this._constraints.get(o),s.includes(o)){console.warn(`circular dependency detected: ${s.join(" -> ")}`);break}e.has(o)||s.push(o)}for(let a=s.length-2;a>=0;a--)if(!e.has(s[a])){let l=t.find(s[a]);l?l.applyPathSnapping(t):console.warn(`missing entity ${s[a]}`),e.add(s[a])}})}findDependency(t,e){let r=t;for(;this._constraints.has(r);)if(r=this._constraints.get(r),r===e)return!0;return!1}};var bB="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL";var Ho=class{};uo(Ho,"DepthMapRange",1<<16),uo(Ho,"MemoryPageSize",65536),uo(Ho,"BytesPerFloat",4),uo(Ho,"BytesPerInt",4);function FZ(n){let t,e,r,i,s,o,a,l,c,u,h,d,f,p,m,g;function y(P){let I=new Float64Array(u,o,16);for(let D=0;D<16;D++)I[D]=P[D];let _;if(r>1){t.exports.sortIndexes(i,s,c,o,a,l,d.DepthMapRange,r);let D=new Uint32Array(r);_=D.buffer,D.set(new Uint32Array(u,l,r))}else if(r===1){let D=new Uint32Array(r);D[0]=new Uint32Array(u,i,e)[0],_=D.buffer}else _=new ArrayBuffer(0);n.postMessage({sortDone:!0,indexesBuffer:_},[_])}function v(P,I,_){let D=new Float32Array(u,s,e*3);r=0;let L=new Uint32Array(u,i,e);for(let j=0;j<_.length-1;j++){let V=I[j],H=P[j].elements,W=V.filter(Q=>Q.enabled&&Q.mode==="Include").map(Q=>Q.type==="Box"?A(Q):M(Q)),q=V.filter(Q=>Q.enabled&&Q.mode==="Exclude").map(Q=>Q.type==="Box"?A(Q):M(Q));for(let Q=_[j];Q<_[j+1];Q++){let G=f[Q*3],Z=f[Q*3+1],te=f[Q*3+2];if((W.length===0||S(G,Z,te,W))&&(q.length===0||!S(G,Z,te,q))){let $=1/(H[3]*G+H[7]*Z+H[11]*te+H[15]);D[r*3]=(H[0]*G+H[4]*Z+H[8]*te+H[12])*$,D[r*3+1]=(H[1]*G+H[5]*Z+H[9]*te+H[13])*$,D[r*3+2]=(H[2]*G+H[6]*Z+H[10]*te+H[14])*$,L[r]=Q,r++}}}}function x(P,I){let _=[],D=I.filter(V=>V.enabled&&V.mode==="Include").map(V=>V.type==="Box"?A(V):M(V)),L=I.filter(V=>V.enabled&&V.mode==="Exclude").map(V=>V.type==="Box"?A(V):M(V)),j=P.length;for(let V=0;V{let V=w(P,I,_,j.invRotationMatrix,j.cropCenter);return Array.isArray(j)?b(V.x,V.y,V.z,j):C(V.x,V.y,V.z,j)})}function w(P,I,_,D,L){let j=P-L[0],V=I-L[1],H=_-L[2],W=1/(D[3]*j+D[7]*V+D[11]*H+D[15]);return{x:(D[0]*j+D[4]*V+D[8]*H+D[12])*W+L[0],y:(D[1]*j+D[5]*V+D[9]*H+D[13])*W+L[1],z:(D[2]*j+D[6]*V+D[10]*H+D[14])*W+L[2]}}function A(P){let I=P.cropSize[0]/2,_=P.cropSize[1]/2,D=P.cropSize[2]/2,L=[P.cropCenter[0]-I,P.cropCenter[1]-_,P.cropCenter[2]-D,P.cropCenter[0]+I,P.cropCenter[1]+_,P.cropCenter[2]+D],j=T(P.cropRotation);return Object.assign(L,{invRotationMatrix:j,cropCenter:P.cropCenter})}function T(P){let I=[],_=P[0]*Math.PI/180,D=P[1]*Math.PI/180,L=P[2]*Math.PI/180,j=Math.cos(_),V=Math.sin(_),H=Math.cos(D),W=Math.sin(D),q=Math.cos(L),Q=Math.sin(L),G=j*q,Z=j*Q,te=V*q,$=V*Q;return I[0]=H*q,I[1]=-H*Q,I[2]=W,I[4]=Z+te*W,I[5]=G-$*W,I[6]=-V*H,I[8]=$-G*W,I[9]=te+Z*W,I[10]=j*H,I[12]=0,I[13]=0,I[14]=0,I[3]=0,I[7]=0,I[11]=0,I[15]=1,I}function b(P,I,_,D){return P>=D[0]&&P<=D[3]&&I>=D[1]&&I<=D[4]&&_>=D[2]&&_<=D[5]}function M(P){let I=2/P.cropSize[0],_=2/P.cropSize[1],D=2/P.cropSize[2],L=T(P.cropRotation);return{invRadiusX:I,invRadiusY:_,invRadiusZ:D,cropCenter:P.cropCenter,invRotationMatrix:L}}function C(P,I,_,D){let L=(P-D.cropCenter[0])*D.invRadiusX,j=(I-D.cropCenter[1])*D.invRadiusY,V=(_-D.cropCenter[2])*D.invRadiusZ;return L*L+j*j+V*V<=1}n.onmessage=P=>{if(P.data.getCroppedIndexes){let I=new Uint32Array(x(new Float32Array(P.data.positions),P.data.crops)).buffer;n.postMessage({outOfBoundsIndexes:I},[I])}else if(P.data.positions)h=P.data.positions,f=new Float32Array(h),m=P.data.meshMatrixWorlds,g=P.data.cropsArray,p=P.data.meshIndexIntervals,v(m,g,p),n.postMessage({sortSetupComplete:!0});else if(P.data.sort||P.data.newMatrixWorlds||P.data.newCropsArray)(P.data.newMatrixWorlds||P.data.newCropsArray)&&(g=P.data.newCropsArray||g,m=P.data.newMatrixWorlds||m,v(m,g,p)),y(P.data.sort.view,P.data.sort.cameraPosition);else if(P.data.init){d=P.data.init.Constants,e=P.data.init.splatCount;let I=d.BytesPerInt,_=d.BytesPerFloat*3,D=new Uint8Array(P.data.init.sorterWasmBytes),L=I+_,j=e*L,V=e*d.BytesPerInt*2+d.DepthMapRange*d.BytesPerInt*2,H=d.MemoryPageSize*32,W=j+V+H,q=Math.floor(W/d.MemoryPageSize)+1,Q={module:{},env:{memory:new WebAssembly.Memory({initial:q*2,maximum:q*3,shared:!0})}};WebAssembly.compile(D).then(G=>WebAssembly.instantiate(G,Q)).then(G=>{t=G,i=0,s=e*I,o=s+e*_,c=o+16*d.BytesPerFloat*2,a=c+e*d.BytesPerInt,l=a+d.DepthMapRange*d.BytesPerInt,u=Q.env.memory.buffer,n.postMessage({sortSetupPhase1Complete:!0})})}}}function SB(n){let t=new Worker(URL.createObjectURL(new Blob(["(",FZ.toString(),")(self)"],{type:"application/javascript"}))),e=atob(bB),r=new Uint8Array(e.length);for(let i=0;i{if(r.visible===!1)return!0;r.type==="Splat"&&(t=!0)}),t}var oc=class extends Ut{constructor(e,r,i,s,o=!1,a=1,l,c){super(i,s);this.splatCount=r,this.meshIndexIntervals=l,this.meshMatrixWorlds=c,this.splatBuffers=e,this.geometry=i,this.material=s,this.splatDataTextures=null,this.halfPrecisionCovariancesOnGPU=o,this.devicePixelRatio=a,this.resetLocalSplatDataAndTexturesFromSplatBuffer()}static buildMesh(e,r,i=!1,s=1,o,a){let l=oc.buildGeomtery(r),c=oc.buildMaterial(o);return new oc(e,r,l,c,i,s,o,a)}static buildMaterial(e){let r=` precision highp float; #include attribute uint splatIndex; uniform highp sampler2D covariancesTexture; uniform highp usampler2D centersColorsTexture; uniform vec2 focal; uniform vec2 viewport; uniform vec2 basisViewport; uniform vec2 covariancesTextureSize; uniform vec2 centersColorsTextureSize; uniform highp sampler2D meshMatrixWorldsTexture; uniform uint meshIndexIntervals[257]; uniform float orthoZoom; varying vec4 vColor; varying vec2 vUv; varying vec2 vPosition; const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0); const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000)); const uvec4 shift4 = uvec4(0, 8, 16, 24); vec4 uintToRGBAVec (uint u) { uvec4 urgba = mask4 & u; urgba = urgba >> shift4; vec4 rgba = vec4(urgba) * encodeNorm4; return rgba; } vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) { vec2 samplerUV = vec2(0.0, 0.0); float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x; samplerUV.y = float(floor(d)) / dimensions.y; samplerUV.x = fract(d); return samplerUV; } void main () { uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize)); vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba)); vColor = uintToRGBAVec(sampledCenterColor.r); vPosition = position.xy * 2.0; uint meshIndex; for (int i = 1; i < 257; i++) { if (splatIndex < meshIndexIntervals[i]) { meshIndex = uint(i - 1); break; } } float strideMulmeshIndex = float(4u*meshIndex); float meshMatrixWorldsTextureLength = float(256*4); mat4 modelMat = mat4( texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)), texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)), texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)), texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0)) ); mat4 modelViewMat = viewMatrix * modelMat; vec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); vec4 clipCenter = projectionMatrix * viewCenter; vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg; vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg; vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg; vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r); vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg); // Compute the 2D covariance matrix from the upper-right portion of the 3D covariance matrix mat3 Vrk = mat3( cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z, cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y, cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z ); float s = 1.0 / (viewCenter.z * viewCenter.z); mat3 W = transpose(mat3(modelViewMat)); mat3 T = orthoZoom > 0.0 ? W : W * mat3( focal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s, 0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s, 0., 0., 0. ); mat3 cov2Dm = transpose(T) * Vrk * T; cov2Dm[0][0] += 0.3; cov2Dm[1][1] += 0.3; // We are interested in the upper-left 2x2 portion of the projected 3D covariance matrix because // we only care about the X and Y values. We want the X-diagonal, cov2Dm[0][0], // the Y-diagonal, cov2Dm[1][1], and the correlation between the two cov2Dm[0][1]. We don't // need cov2Dm[1][0] because it is a symetric matrix. vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]); vec3 ndcCenter = clipCenter.xyz / clipCenter.w; // We now need to solve for the eigen-values and eigen vectors of the 2D covariance matrix // so that we can determine the 2D basis for the splat. This is done using the method described // here: https://people.math.harvard.edu/~knill/teaching/math21b2004/exhibits/2dmatrices/index.html // // This is a different approach than in the original work at INRIA. In that work they compute the // max extents of the 2D covariance matrix in screen space to form an axis aligned bounding rectangle // which forms the geometry that is actually rasterized. They then use the inverse 2D covariance // matrix (called 'conic') to determine fragment opacity. float a = cov2Dv.x; float d = cov2Dv.z; float b = cov2Dv.y; float D = a * d - b * b; float trace = a + d; float traceOver2 = 0.5 * trace; float term2 = sqrt(trace * trace / 4.0 - D); float eigenValue1 = traceOver2 + term2; float eigenValue2 = max(traceOver2 - term2, 0.00); // prevent negative eigen value const float maxSplatSize = 1024.0; vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a)); // since the eigen vectors are orthogonal, we derive the second one from the first vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x); vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize); vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize); vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport; if (orthoZoom > 0.0) { ndcOffset *= orthoZoom; } gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0); }`,i=` precision highp float; #include uniform vec3 debugColor; varying vec4 vColor; varying vec2 vUv; varying vec2 vPosition; layout(location = 1) out vec4 gVelocity; void main () { // compute the negative squared distance from the center of the splat to the // current fragment in the splat's local space. float A = -dot(vPosition, vPosition); if (A < -4.0) discard; vec3 color = vColor.rgb; A = exp(A) * vColor.a; gl_FragColor = vec4(color.rgb, A); gVelocity = vec4(0.0); // so it is ignored by TAA }`,s={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:e},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new k},viewport:{type:"v2",value:new k},basisViewport:{type:"v2",value:new k},debugColor:{type:"v3",value:new We},covariancesTextureSize:{type:"v2",value:new k(1024,1024)},centersColorsTextureSize:{type:"v2",value:new k(1024,1024)},orthoZoom:{type:"f",value:-1}};return new it({uniforms:s,vertexShader:r,fragmentShader:i,transparent:!0,alphaTest:1,blending:$a,depthTest:!0,depthWrite:!1,side:fi})}static buildGeomtery(e){let r=new _e;r.setIndex([0,1,2,0,2,3]);let i=new Float32Array(4*3),s=new Xe(i,3);r.setAttribute("position",s),s.setXYZ(0,-1,-1,0),s.setXYZ(1,-1,1,0),s.setXYZ(2,1,1,0),s.setXYZ(3,1,-1,0),s.needsUpdate=!0;let o=new Mp().copy(r),a=new Uint32Array(e),l=new mo(a,1,!1);return l.setUsage(uP),o.setAttribute("splatIndex",l),o.instanceCount=e,o}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(s=>s.buildPreComputedBuffers()),this.covariances=new Float32Array(this.splatCount*6),this.colors=new Uint8Array(this.splatCount*4),this.centers=new Float32Array(this.splatCount*3);let e=0,r=0,i=0;for(let s of this.splatBuffers){let o=s.nsplats;this.colors.subarray(e,e+o*4).set(s.colorsA),e+=o*4,this.centers.subarray(r,r+o*3).set(s.decoded.xyz.denormDequant().data),r+=o*3,this.covariances.subarray(i,i+o*6).set(new Float32Array(s.precomputedCovarianceBufferData)),i+=o*6}}allocateAndStoreLocalSplatDataInTextures(){let i=this.splatCount,s=new k(4096,1024);for(;s.x*s.y*20&&(ub.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(ub),this.material.uniforms.basisViewport.value.set(2/ub.x,2/ub.y),this.material.uniforms.focal.value.set(r,i),this.material.uniforms.orthoZoom.value=s,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}};var EB,xT=new Promise(n=>{EB=n}),AB=!1;var db;function bT(){if(AB)return;if(db)return db;async function n(){let e=await import("./gaussian-splat-compression.js");EB(e),AB=!0}return db=n(),db}var TB;xT.then(n=>TB=n);var Xm=class{constructor(t={}){uo(this,"updateView",function(){let t=new ue,e=[],r=new E(0,0,-1),i=new E(0,0,-1),s=new E,o=new E;return function(a=!1,l){let c=this.updateMatrixWorldsInWorkerIfNeeded(),u=this.cropsChanged();if(!a){i.set(0,0,-1).applyQuaternion(l.quaternion);let d=!1,f=!1;if(i.dot(r)<=.95&&(d=!0),o.copy(l.position).sub(s).length()>=1&&(f=!0),!d&&!f&&!c&&!u&&!this.needsInitialRender)return}this.needsInitialRender=!1,s.copy(l.position),r.copy(i),t.copy(l.matrixWorld).invert(),t.premultiply(this.dummyPerspectiveMatrix),e[0]=l.position.x,e[1]=l.position.y,e[2]=l.position.z;let h={sort:{view:t.elements,cameraPosition:e,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...c?{newMatrixWorlds:this.meshMatrixWorlds}:{},...u?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=h:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(h))}}());this.scene=t.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=new ue().makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(t,e){let r=new k;if(this.splatMesh===null)return;this.splatMesh.getSplatCount()>0&&(t.getSize(r),this.cameraFocalLengthX=e.projectionMatrix.elements[0]*this.devicePixelRatio*r.x*.45,this.cameraFocalLengthY=e.projectionMatrix.elements[5]*this.devicePixelRatio*r.y*.45,this.splatMesh.updateUniforms(r,this.cameraFocalLengthX,this.cameraFocalLengthY,e.isPerspectiveCamera?-1:e.zoom*this.devicePixelRatio))}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=new E().fromArray(t.position)),t.orientation&&(t.orientation=new Ke().fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];if(this.splatEntries=e,this.activePage.traverseVisibleEntity(o=>{o.data.type==="Splat"&&e.push(o)}),this.splatMesh&&this.splatMesh.dispose(),e.length===0)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(o=>o.matrixWorld),this.meshMatrixWorldsOld=e.map(o=>o.matrixWorld.clone()),this.cropsArray=e.map(o=>o.data.crops.map(a=>a.data));let r=e.map(o=>new TB.GSplineBuffer(new Uint8Array(o.data.buffer).buffer)),i=0,s=[0];for(let o of r)i+=o.getSplatCount(),s.push(i);return this.setupSplatMesh(r,i,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,s,this.meshMatrixWorlds),this.setupSortWorker(i),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;ee.equals(this.meshMatrixWorldsOld[r]))?!1:(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(e=>e.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,r)=>{e.data.crops.forEach((i,s)=>{this.cropsArray[r][s]===void 0?(t=!0,this.cropsArray[r][s]=i.data):Object.entries(i.data).forEach(([o,a])=>{Array.isArray(a)&&a.some((l,c)=>l!==this.cropsArray[r][s][o][c])?(t=!0,this.cropsArray[r][s][o]=a):a!==this.cropsArray[r][s]?.[o]&&(t=!0,this.cropsArray[r][s][o]=a)})}),e.data.crops.length!==this.cropsArray[r]?.length&&(this.cropsArray[r].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,r=new E,i=new Ke,