import{L as V,I as X}from"./index-Cwdlo4ih.js";import{WebGPUEngine as f}from"./webgpuEngine-BahM8Fj8.js";import"./index-aMLoRFR_.js";import"./svelte/svelte_svelte.js";import"./svelte/svelte_animate.js";import"./svelte/svelte_attachments.js";import"./svelte/svelte_easing.js";import"./svelte/svelte_internal_client.js";import"./svelte/svelte_internal_flags_async.js";import"./svelte/svelte_internal_flags_legacy.js";import"./svelte/svelte_internal_flags_tracing.js";import"./svelte/svelte_internal_server.js";import"./svelte/svelte_legacy.js";import"./svelte/svelte_motion.js";import"./svelte/svelte_reactivity.js";import"./svelte/svelte_reactivity_window.js";import"./svelte/svelte_server.js";import"./svelte/svelte_store.js";import"./svelte/svelte_transition.js";import"./svelte/svelte_events.js";import"./instancesVertex-XVT5DcYf.js";import"./bakedVertexAnimation-DE01jqsk.js";import"./instancesDeclaration-DMH7shct.js";import"./helperFunctions-CXpBHsR3.js";import"./fresnelFunction-DCh8imMC.js";import"./meshUboDeclaration-DC9dQiNJ.js";import"./sceneUboDeclaration-BUTqy656.js";import"./decalFragment-aLKraF3o.js";import"./audioEngine-CZsqSpdE.js";f.prototype.unBindMultiColorAttachmentFramebuffer=function(t,e=!1,n){n&&n(),this._endCurrentRenderPass(),t.disableAutomaticMSAAResolve||this.resolveMultiFramebuffer(t,!1),e||this.generateMipMapsMultiFramebuffer(t),this._currentRenderTarget=null,this._mrtAttachments=[],this._cacheRenderPipeline.setMRT([]),this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments)};f.prototype.createMultipleRenderTarget=function(t,e,n){let a=!1,u=!0,l=!1,d=!1,c=15,g=1,h=1;const U=0,v=3,H=!1,k=5,N=3553;let x=[],T=[],M=[],_=[],y=[],R=[],b=[],S=[],F=[],A=[],m=!1;const i=this._createHardwareRenderTargetWrapper(!0,!1,t);e!==void 0&&(a=e.generateMipMaps??!1,u=e.generateDepthBuffer??!0,l=e.generateStencilBuffer??!1,d=e.generateDepthTexture??!1,g=e.textureCount??1,c=e.depthTextureFormat??15,x=e.types||x,T=e.samplingModes||T,M=e.useSRGBBuffers||M,_=e.formats||_,y=e.targetTypes||y,R=e.faceIndex||R,b=e.layerIndex||b,S=e.layerCounts||S,F=e.labels||F,A=e.creationFlags||A,h=e.samples??h,m=e.dontCreateTextures??!1);const D=t.width??t,G=t.height??t,B=[],I=[],P=[];i.label=e?.label??"MultiRenderTargetWrapper",i._generateDepthBuffer=u,i._generateStencilBuffer=l,i._attachments=I,i._defaultAttachments=P;let p=null;(u||l||d)&&!m&&(d||(u&&l?c=13:u?c=14:c=19),p=i.createDepthStencilTexture(0,!1,l,1,c,i.label+"-DepthStencil"));const w=e!==void 0&&typeof e=="object"&&e.createMipMaps&&!a;for(let s=0;s<g;s++){let C=T[s]||v,o=x[s]||U;const Y=_[s]||k,j=(M[s]||H)&&this._caps.supportSRGBBuffers,E=y[s]||N,L=S[s]??1,O=A[s];if((o===1&&!this._caps.textureFloatLinearFiltering||o===2&&!this._caps.textureHalfFloatLinearFiltering)&&(C=1),o===1&&!this._caps.textureFloat&&(o=0,V.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")),I.push(s+1),P.push(n?s+1:s===0?1:0),E===-1||m)continue;const r=new X(this,6);switch(B[s]=r,E){case 34067:r.isCube=!0;break;case 32879:r.is3D=!0,r.baseDepth=r.depth=L;break;case 35866:r.is2DArray=!0,r.baseDepth=r.depth=L;break}r.baseWidth=D,r.baseHeight=G,r.width=D,r.height=G,r.isReady=!0,r.samples=1,r.generateMipMaps=a,r.samplingMode=C,r.type=o,r._cachedWrapU=0,r._cachedWrapV=0,r._useSRGBBuffer=j,r.format=Y,r.label=F[s]??i.label+"-Texture"+s,this._internalTexturesCache.push(r),w&&(r.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(r,void 0,void 0,void 0,O),w&&(r.generateMipMaps=!1)}return p&&(p.incrementReferences(),B[g]=p,this._internalTexturesCache.push(p)),i.setTextures(B),i.setLayerAndFaceIndices(b,R),m?i._samples=h:this.updateMultipleRenderTargetTextureSampleCount(i,h),i};f.prototype.updateMultipleRenderTargetTextureSampleCount=function(t,e){if(!t||!t.textures||t.textures.length===0||t.textures[0].samples===e)return e;const n=t.textures.length;if(n===0)return 1;e=Math.min(e,this.getCaps().maxMSAASamples);for(let a=0;a<n;++a)t.textures[a]._hardwareTexture?.releaseMSAATextures();for(let a=0;a<n;++a){const u=t.textures[a];u.samples=e}return t._depthStencilTexture&&(t._depthStencilTexture.samples=e),t._samples=e,e};f.prototype.generateMipMapsMultiFramebuffer=function(t){const e=t;if(!e.isMulti)return;const a=e._attachments.length;for(let u=0;u<a;u++){const l=e.textures[u];l.generateMipMaps&&!l.isCube&&!l.is3D&&this._generateMipmaps(l)}};f.prototype.resolveMultiFramebuffer=function(t,e=!0){this.resolveFramebuffer(t,e)};f.prototype.bindAttachments=function(t){t.length===0||!this._currentRenderTarget||(this._mrtAttachments=t,this._currentRenderPass&&this._cacheRenderPipeline.setMRTAttachments(t))};f.prototype.buildTextureLayout=function(t,e=!1){const n=[];if(e)n.push(1);else for(let a=0;a<t.length;a++)t[a]?n.push(a+1):n.push(0);return n};f.prototype.restoreSingleAttachment=function(){};f.prototype.restoreSingleAttachmentForRenderTarget=function(){};
