PageSourceSearch

https://beattapneon-iymhez8u.manus.space/assets/envTextureLoader-BbQtqr2o.js

js beattapneon-iymhez8u.manus.space collected 2026-10-03 05:00:17 UTC 32,214 bytes, 5 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/postprocess.vertex-Bvrfu3Xg.js","assets/index-5o0RL3Os.js","assets/index-CtRTp9S9.css","assets/postprocess.vertex-DsYTk9ca.js","assets/rgbdDecode.fragment-C8CAnR8E.js","assets/rgbdDecode.fragment-G0QEUr4P.js"])))=>i.map(i=>d[i]);
2import{e as Ue,O as q,k as Y,l as se,d as u,m as we,n as Se,o as Oe,g as Ae,G as De,i as y,A as Re,p as Ge,s as w,q as Ve,a as ke,S as Ne,V as D,I as Ee,B as J,r as qe,t as He,u as je}from"./index-5o0RL3Os.js";import{C as $e}from"./cubemapToSphericalPolynomial-Da587q9Z.js";class Ye{static GetEffect(t){return t.getPipelineContext===void 0?t.effect:t}constructor(t,i=!0){this._wasPreviouslyReady=!1,this._forceRebindOnNextCall=!0,this._wasPreviouslyUsingInstances=null,this.effect=null,this.defines=null,this.drawContext=t.createDrawContext(),i&&(this.materialContext=t.createMaterialContext())}setEffect(t,i,n=!0){this.effect=t,i!==void 0&&(this.defines=i),n&&this.drawContext?.reset()}dispose(t=!1){if(this.effect){const i=this.effect;t?i.dispose():Ue.SetImmediate(()=>{i.getEngine().onEndFrameObservable.addOnce(()=>{i.dispose()})}),this.effect=null}this.drawContext?.dispose()}}class S{static RegisterShaderCodeProcessing(t,i){if(!i){delete S._CustomShaderCodeProcessing[t??""];return}S._CustomShaderCodeProcessing[t??""]=i}static _GetShaderCodeProcessing(t){return S._CustomShaderCodeProcessing[t]??S._CustomShaderCodeProcessing[""]}get name(){return this.options.name}set name(t){this.options.name=t}isReady(){return this._drawWrapper.effect?.isReady()??!1}get drawWrapper(){return this._drawWrapper}get effect(){return this._drawWrapper.effect}set effect(t){this._drawWrapper.effect=t}constructor(t){this.alphaMode=0,this.onEffectCreatedObservable=new q(void 0,!0),this.onApplyObservable=new q,this._shadersLoaded=!1,this._webGPUReady=!1,this._importPromises=[],this.options={...t,name:t.name||"effectWrapper",engine:t.engine,uniforms:t.uniforms||t.uniformNames||[],uniformNames:void 0,samplers:t.samplers||t.samplerNames||[],samplerNames:void 0,attributeNames:t.attributeNames||["position"],uniformBuffers:t.uniformBuffers||[],defines:t.defines||"",useShaderStore:t.useShaderStore||!1,vertexUrl:t.vertexUrl||t.vertexShader||"postprocess",vertexShader:void 0,fragmentShader:t.fragmentShader||"pass",indexParameters:t.indexParameters,blockCompilation:t.blockCompilation||!1,shaderLanguage:t.shaderLanguage||0,onCompiled:t.onCompiled||void 0,extraInitializations:t.extraInitializations||void 0,extraInitializationsAsync:t.extraInitializationsAsync||void 0,useAsPostProcess:t.useAsPostProcess??!1,allowEmptySourceTexture:t.allowEmptySourceTexture??!1},this.options.uniformNames=this.options.uniforms,this.options.samplerNames=this.options.samplers,this.options.vertexShader=this.options.vertexUrl,this.options.useAsPostProcess&&(!this.options.allowEmptySourceTexture&&this.options.samplers.indexOf("textureSampler")===-1&&this.options.samplers.push("textureSampler"),this.options.uniforms.indexOf("scale")===-1&&this.options.uniforms.push("scale")),t.vertexUrl||t.vertexShader?this._shaderPath={vertexSource:this.options.vertexShader}:(this.options.useAsPostProcess||(this.options.uniforms.push("scale"),this.onApplyObservable.add(()=>{this.effect.setFloat2("scale",1,1)})),this._shaderPath={vertex:this.options.vertexShader}),this._shaderPath.fragmentSource=this.options.fragmentShader,this._shaderPath.spectorName=this.options.name,this.options.useShaderStore&&(this._shaderPath.fragment=this._shaderPath.fragmentSource,this._shaderPath.vertex||(this._shaderPath.vertex=this._shaderPath.vertexSource),delete this._shaderPath.fragmentSource,delete this._shaderPath.vertexSource),this.onApplyObservable.add(()=>{this.bind()}),this.options.useShaderStore||(this._onContextRestoredObserver=this.options.engine.onContextRestoredObservable.add(()=>{this.effect._pipelineContext=null,this.effect._prepareEffect()})),this._drawWrapper=new Ye(this.options.engine),this._webGPUReady=this.options.shaderLanguage===1;const i=Array.isArray(this.options.defines)?this.options.defines.join(`
3`):this.options.defines;this._postConstructor(this.options.blockCompilation,i,this.options.extraInitializations)}_gatherImports(t=!1,i){}_postConstructor(t,i=null,n,l){this._importPromises.length=0,l&&this._importPromises.push(...l);const a=this.options.engine.isWebGPU&&!S.ForceGLSL;this._gatherImports(a,this._importPromises),this.options.useShaderStore&&this._shaderPath.vertex==="postprocess"&&this._importPromises.push(a&&this._webGPUReady?Y(()=>import("./postprocess.vertex-Bvrfu3Xg.js"),__vite__mapDeps([0,1,2])):Y(()=>import("./postprocess.vertex-DsYTk9ca.js"),__vite__mapDeps([3,1,2]))),n!==void 0&&n(a,this._importPromises),a&&this._webGPUReady&&(this.options.shaderLanguage=1),t||this.updateEffect(i)}
3updateEffect(t=null,i=null,n=null,l,a,o,f,T){const x=S._GetShaderCodeProcessing(this.name);if(x?.defineCustomBindings){const v=i?.slice()??[];v.push(...this.options.uniforms);const m=n?.slice()??[];m.push(...this.options.samplers),t=x.defineCustomBindings(this.name,t,v,m),i=v,n=m}this.options.defines=t||"";const R=this._shadersLoaded||this._importPromises.length===0?void 0:async()=>{await Promise.all(this._importPromises),this._shadersLoaded=!0};let P;this.options.extraInitializationsAsync?P=async()=>{await R?.(),await this.options.extraInitializationsAsync()}:P=R,this.options.useShaderStore?this._drawWrapper.effect=this.options.engine.createEffect({vertex:f??this._shaderPath.vertex,fragment:T??this._shaderPath.fragment},{attributes:this.options.attributeNames,uniformsNames:i||this.options.uniforms,uniformBuffersNames:this.options.uniformBuffers,samplers:n||this.options.samplers,defines:t!==null?t:"",fallbacks:null,onCompiled:a??this.options.onCompiled,onError:o??null,indexParameters:l||this.options.indexParameters,processCodeAfterIncludes:x?.processCodeAfterIncludes?(v,m)=>x.processCodeAfterIncludes(this.name,v,m):null,processFinalCode:x?.processFinalCode?(v,m)=>x.processFinalCode(this.name,v,m):null,shaderLanguage:this.options.shaderLanguage,extraInitializationsAsync:P},this.options.engine):this._drawWrapper.effect=new se(this._shaderPath,this.options.attributeNames,i||this.options.uniforms,n||this.options.samplerNames,this.options.engine,t,void 0,a||this.options.onCompiled,void 0,void 0,void 0,this.options.shaderLanguage,P),this.onEffectCreatedObservable.notifyObservers(this._drawWrapper.effect)}bind(t=!1){this.options.useAsPostProcess&&!t&&(this.options.engine.setAlphaMode(this.alphaMode),this.drawWrapper.effect.setFloat2("scale",1,1)),S._GetShaderCodeProcessing(this.name)?.bindCustomBindings?.(this.name,this._drawWrapper.effect)}dispose(t=!1){this._onContextRestoredObserver&&(this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null),this.onEffectCreatedObservable.clear(),this._drawWrapper.dispose(!0)}}S.ForceGLSL=!1;S._CustomShaderCodeProcessing={};let We=(()=>{var s;let t=[],i,n=[],l=[],a,o,f=[],T=[],x,R=[],P=[],v,m=[],_=[],C,z=[],O=[],W,N=[],G=[],I,j=[],H=[],M,V,re=[],ie=[],ae,ne=[],oe=[],le,he=[],ue=[],de,fe=[],ce=[],pe,_e=[],me=[],ge,xe=[],be=[],Pe,Ce=[],ye=[];return s=class{static get ForceGLSL(){return S.ForceGLSL}static set ForceGLSL(e){S.ForceGLSL=e}static RegisterShaderCodeProcessing(e,r){S.RegisterShaderCodeProcessing(e,r)}get name(){return this._effectWrapper.name}set name(e){this._effectWrapper.name=e}get alphaMode(){return this._effectWrapper.alphaMode}set alphaMode(e){this._effectWrapper.alphaMode=e}get samples(){return this._samples}set samples(e){this._samples=Math.min(e,this._engine.getCaps().maxMSAASamples),this._textures.forEach(r=>{r.setSamples(this._samples)})}get shaderLanguage(){return this._shaderLanguage}getEffectName(){return this._fragmentUrl}set onActivate(e){this._onActivateObserver&&this.onActivateObservable.remove(this._onActivateObserver),e&&(this._onActivateObserver=this.onActivateObservable.add(e))}set onSizeChanged(e){this._onSizeChangedObserver&&this.onSizeChangedObservable.remove(this._onSizeChangedObserver),this._onSizeChangedObserver=this.onSizeChangedObservable.add(e)}set onApply(e){this._onApplyObserver&&this.onApplyObservable.remove(this._onApplyObserver),this._onApplyObserver=this.onApplyObservable.add(e)}set onBeforeRender(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)}set onAfterRender(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)}get inputTexture(){return this._textures.data[this._currentRenderTextureInd]}set inputTexture(e){this._forcedOutputTexture=e}restoreDefaultInputTexture(){this._forcedOutputTexture&&(this._forcedOutputTexture=null,this.markTextureDirty())}getCamera(){return this._camera}get texelSize(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.texelSize:(this._forcedOutputTexture&&this._texelSize.copyFromFloats(1/this._forcedOutputTexture.width,1/this._forcedOutputTexture.height),this._texelSize)}constructor(e,r,h,c,d,b,F=1,A,L,E=null,B=0,$="postprocess",U,k=!1,Te=5,X,ve){this._parentContainer=(u(this,t),null),this.uniqueId=u(this,n,void 0),this.width=(u(this,l),u(this,f,-1)),this.height=(u(this,T),u(this,R,-1)),this.nodeMaterialSource=(u(this,P),null),this._outputTexture=null,this.renderTargetSamplingMode=u(this,m,void 0),this.clearColor=(u(this,_),u(this,z,void 0)),this.autoClear=(u(this,O),u(this,N,!0)),this.forceAutoClearInAlphaMode=(u(this,G),u(this,j,!1)),this.alphaConstants=(u(this,H),u(this,re,void 0)),this.animations=(u(this,ie),[]),this.enablePixelPerfectMode=u(this,ne,!1),this.forceFullscreenViewport=(u(this,oe),u(this,he,!0)),this.inspectableCustomProperties=u(this,ue),this.scaleMode=u(this,fe,1),this.alwaysForcePOT=(u(this,ce),u(this,_e,!1)),this._samples=(u(this,me),u(this,xe,1)),this.adaptScaleToCurrentViewport=(u(this,be),u(this,Ce,!1)),this.doNotSerialize=(u(this,ye),!1),this._webGPUReady=!1,this._reusable=!1,this._renderId=0,this.externalTextureSamplerBinding=!1,this._textures=new we(2),this._textureCache=[],this._currentRenderTextureInd=0,this._scaleRatio=new Se(1,1),this._texelSize=Se.Zero(),this.onActivateObservable=new q,this.onSizeChangedObservable=new q,this.onApplyObservable=new q,this.onBeforeRenderObservable=new q,this.onAfterRenderObservable=new q,this.onDisposeObservable=new q,Je(
vendor: 6,824 bytes, lines 3-5
3);let K=1,ee=null,te;if(h&&!Array.isArray(h)){const p=h;h=p.uniforms??null,c=p.samplers??null,K=p.size??1,b=p.camera??null,F=p.samplingMode??1,A=p.engine,L=p.reusable,E=Array.isArray(p.defines)?p.defines.join(`
4`):p.defines??null,B=p.textureType??0,$=p.vertexUrl??"postprocess",U=p.indexParameters,k=p.blockCompilation??!1,Te=p.textureFormat??5,X=p.shaderLanguage??0,ee=p.uniformBuffers??null,ve=p.extraInitializations,te=p.effectWrapper}else d&&(typeof d=="number"?K=d:K={width:d.width,height:d.height});if(this._useExistingThinPostProcess=!!te,this._effectWrapper=te??new S({name:e,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:r,engine:A||b?.getScene().getEngine(),uniforms:h,samplers:c,uniformBuffers:ee,defines:E,vertexUrl:$,indexParameters:U,blockCompilation:!0,shaderLanguage:X,extraInitializations:void 0}),this.name=e,this.onEffectCreatedObservable=this._effectWrapper.onEffectCreatedObservable,b!=null?(this._camera=b,this._scene=b.getScene(),b.attachPostProcess(this),this._engine=this._scene.getEngine(),this._scene.addPostProcess(this),this.uniqueId=this._scene.getUniqueId()):A&&(this._engine=A,this._engine.postProcesses.push(this)),this._options=K,this.renderTargetSamplingMode=F||1,this._reusable=L||!1,this._textureType=B,this._textureFormat=Te,this._shaderLanguage=X||0,this._samplers=c||[],this._samplers.indexOf("textureSampler")===-1&&this._samplers.push("textureSampler"),this._fragmentUrl=r,this._vertexUrl=$,this._parameters=h||[],this._parameters.indexOf("scale")===-1&&this._parameters.push("scale"),this._uniformBuffers=ee||[],this._indexParameters=U,!this._useExistingThinPostProcess){this._webGPUReady=this._shaderLanguage===1;const p=[];this._gatherImports(this._engine.isWebGPU&&!s.ForceGLSL,p),this._effectWrapper._webGPUReady=this._webGPUReady,this._effectWrapper._postConstructor(k,E,ve,p)}}_gatherImports(e=!1,r){e&&this._webGPUReady?r.push(Promise.all([Y(()=>import("./postprocess.vertex-Bvrfu3Xg.js"),__vite__mapDeps([0,1,2]))])):r.push(Promise.all([Y(()=>import("./postprocess.vertex-DsYTk9ca.js"),__vite__mapDeps([3,1,2]))]))}getClassName(){return"PostProcess"}getEngine(){return this._engine}getEffect(){return this._effectWrapper.drawWrapper.effect}shareOutputWith(e){return this._disposeTextures(),this._shareOutputWithPostProcess=e,this}useOwnOutput(){this._textures.length==0&&(this._textures=new we(2)),this._shareOutputWithPostProcess=null}updateEffect(e=null,r=null,h=null,c,d,b,F,A){this._effectWrapper.updateEffect(e,r,h,c,d,b,F,A),this._postProcessDefines=Array.isArray(this._effectWrapper.options.defines)?this._effectWrapper.options.defines.join(`
5`):this._effectWrapper.options.defines}isReusable(){return this._reusable}markTextureDirty(){this.width=-1}_createRenderTargetTexture(e,r,h=0){for(let d=0;d<this._textureCache.length;d++)if(this._textureCache[d].texture.width===e.width&&this._textureCache[d].texture.height===e.height&&this._textureCache[d].postProcessChannel===h&&this._textureCache[d].texture._generateDepthBuffer===r.generateDepthBuffer&&this._textureCache[d].texture.samples===r.samples)return this._textureCache[d].texture;const c=this._engine.createRenderTargetTexture(e,r);return this._textureCache.push({texture:c,postProcessChannel:h,lastUsedRenderId:-1}),c}_flushTextureCache(){const e=this._renderId;for(let r=this._textureCache.length-1;r>=0;r--)if(e-this._textureCache[r].lastUsedRenderId>100){let h=!1;for(let c=0;c<this._textures.length;c++)if(this._textures.data[c]===this._textureCache[r].texture){h=!0;break}h||(this._textureCache[r].texture.dispose(),this._textureCache.splice(r,1))}}resize(e,r,h=null,c=!1,d=!1){this._textures.length>0&&this._textures.reset(),this.width=e,this.height=r;let b=null;if(h){for(let L=0;L<h._postProcesses.length;L++)if(h._postProcesses[L]!==null){b=h._postProcesses[L];break}}const F={width:this.width,height:this.height},A={generateMipMaps:c,generateDepthBuffer:d||b===this,generateStencilBuffer:(d||b===this)&&this._engine.isStencilEnable,samplingMode:this.renderTargetSamplingMode,type:this._textureType,format:this._textureFormat,samples:this._samples,label:"PostProcessRTT-"+this.name};this._textures.push(this._createRenderTargetTexture(F,A,0)),this._reusable&&this._textures.push(this._createRenderTargetTexture(F,A,1)),this._texelSize.copyFromFloats(1/this.width,1/this.height),this.onSizeChangedObservable.notifyObservers(this)}_getTarget(){let e;if(this._shareOutputWithPostProcess)e=this._shareOutputWithPostProcess.inputTexture;else if(this._forcedOutputTexture)e=this._forcedOutputTexture,this.width=this._forcedOutputTexture.width,this.height=this._forcedOutputTexture.height;else{e=this.inputTexture;let r;for(let h=0;h<this._textureCache.length;h++)if(this._textureCache[h].texture===e){r=this._textureCache[h];break}r&&(r.lastUsedRenderId=this._renderId)}return e}activate(e,r=null,h){const c=e===null||e.cameraRigMode!==void 0?e||this._camera:null,d=c?.getScene()??e,b=d.getEngine(),F=b.getCaps().maxTextureSize,A=(r?r.width:this._engine.getRenderWidth(!0))*this._options|0,L=(r?r.height:this._engine.getRenderHeight(!0))*this._options|0;let E=this._options.width||A,B=this._options.height||L;const $=this.renderTargetSamplingMode!==7&&this.renderTargetSamplingMode!==1&&this.renderTargetSamplingMode!==2;let U=null;if(!this._shareOutputWithPostProcess&&!this._forcedOutputTexture){if(this.adaptScaleToCurrentViewport){const k=b.currentViewport;k&&(E*=k.width,B*=k.height)}($||this.alwaysForcePOT)&&(this._options.width||(E=b.needPOTTextures?Oe(E,F,this.scaleMode):E),this._options.height||(B=b.needPOTTextures?Oe(B,F,this.scaleMode):B)),(this.width!==E||this.height!==B||!(U=this._getTarget()))&&this.resize(E,B,c,$,h),this._textures.forEach(k=>{k.samples!==this.samples&&this._engine.updateRenderTargetTextureSampleCount(k,this.samples)}),this._flushTextureCache(),this._renderId++}return U||(U=this._getTarget()),this.enablePixelPerfectMode?(this._scaleRatio.copyFromFloats(A/E,L/B),this._engine.bindFramebuffer(U,0,A,L,this.forceFullscreenViewport)):(this._scaleRatio.copyFromFloats(1,1),this._engine.bindFramebuffer(U,0,void 0,void 0,this.forceFullscreenViewport)),this._engine._debugInsertMarker?.(`post process ${this.name} input`),this.onActivateObservable.notifyObservers(c),this.autoClear&&(this.alphaMode===0||this.forceAutoClearInAlphaMode)&&this._engine.clear(this.clearColor?this.clearColor:d.clearColor,d._allowPostProcessClearColor,!0,!0),this._reusable&&(this._currentRenderTextureInd=(this._currentRenderTextureInd+1)%2),U}get isSupported(){return this._effectWrapper.drawWrapper.effect.isSupported}get aspectRatio(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.aspectRatio:this._forcedOutputTexture?this._forcedOutputTexture.width/this._forcedOutputTexture.height:this.width/this.height}isReady(){return this._effectWrapper.isReady()}
5apply(){if(!this._effectWrapper.isReady())return null;this._engine.enableEffect(this._effectWrapper.drawWrapper),this._engine.setState(!1),this._engine.setDepthBuffer(!1),this._engine.setDepthWrite(!1),this.alphaConstants&&this.getEngine().setAlphaConstants(this.alphaConstants.r,this.alphaConstants.g,this.alphaConstants.b,this.alphaConstants.a),this._engine.setAlphaMode(this.alphaMode);let e;return this._shareOutputWithPostProcess?e=this._shareOutputWithPostProcess.inputTexture:this._forcedOutputTexture?e=this._forcedOutputTexture:e=this.inputTexture,this.externalTextureSamplerBinding||this._effectWrapper.drawWrapper.effect._bindTexture("textureSampler",e?.texture),this._effectWrapper.drawWrapper.effect.setVector2("scale",this._scaleRatio),this.onApplyObservable.notifyObservers(this._effectWrapper.drawWrapper.effect),this._effectWrapper.bind(!0),this._effectWrapper.drawWrapper.effect}_disposeTextures(){if(this._shareOutputWithPostProcess||this._forcedOutputTexture){this._disposeTextureCache();return}this._disposeTextureCache(),this._textures.dispose()}_disposeTextureCache(){for(let e=this._textureCache.length-1;e>=0;e--)this._textureCache[e].texture.dispose();this._textureCache.length=0}setPrePassRenderer(e){return this._prePassEffectConfiguration?(this._prePassEffectConfiguration=e.addEffectConfiguration(this._prePassEffectConfiguration),this._prePassEffectConfiguration.enabled=!0,!0):!1}dispose(e){e=e||this._camera,this._useExistingThinPostProcess||this._effectWrapper.dispose(),this._disposeTextures(),this._scene&&this._scene.removePostProcess(this);let r;if(this._parentContainer&&(r=this._parentContainer.postProcesses.indexOf(this),r>-1&&this._parentContainer.postProcesses.splice(r,1),this._parentContainer=null),r=this._engine.postProcesses.indexOf(this),r!==-1&&this._engine.postProcesses.splice(r,1),this.onDisposeObservable.notifyObservers(),!!e){if(e.detachPostProcess(this),r=e._postProcesses.indexOf(this),r===0&&e._postProcesses.length>0){const h=this._camera._getFirstPostProcess();h&&h.markTextureDirty()}this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear(),this.onEffectCreatedObservable.clear()}}serialize(){const e=Ae.Serialize(this),r=this.getCamera()||this._scene&&this._scene.activeCamera;return e.customType="BABYLON."+this.getClassName(),e.cameraId=r?r.id:null,e.reusable=this._reusable,e.textureType=this._textureType,e.fragmentUrl=this._fragmentUrl,e.parameters=this._parameters,e.samplers=this._samplers,e.uniformBuffers=this._uniformBuffers,e.options=this._options,e.defines=this._postProcessDefines,e.textureFormat=this._textureFormat,e.vertexUrl=this._vertexUrl,e.indexParameters=this._indexParameters,e}clone(){const e=this.serialize();e._engine=this._engine,e.cameraId=null;const r=s.Parse(e,this._scene,"");return r?(r.onActivateObservable=this.onActivateObservable.clone(),r.onSizeChangedObservable=this.onSizeChangedObservable.clone(),r.onApplyObservable=this.onApplyObservable.clone(),r.onBeforeRenderObservable=this.onBeforeRenderObservable.clone(),r.onAfterRenderObservable=this.onAfterRenderObservable.clone(),r._prePassEffectConfiguration=this._prePassEffectConfiguration,r):null}static Parse(e,r,h){const c=De(e.customType);if(!c||!c._Parse)return null;const d=r?r.getCameraById(e.cameraId):null;return c._Parse(e,d,r,h)}static _Parse(e,r,h,c){return Ae.Parse(()=>new s(e.name,e.fragmentUrl,e.parameters,e.samplers,e.options,r,e.renderTargetSamplingMode,e._engine,e.reusable,e.defines,e.textureType,e.vertexUrl,e.indexParameters,!1,e.textureFormat),e,h,c)}},(()=>{const g=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;i=[w()],a=[w()],o=[w()],x=[w()],v=[w()],C=[Ve()],W=[w()],I=[w()],M=[w()],V=[w()],ae=[w()],le=[w()],de=[w()],pe=[w()],ge=[w("samples")],Pe=[w()],y(s,null,a,{kind:"getter",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name},metadata:g},null,t),y(s,null,M,{kind:"getter",name:"alphaMode",static:!1,private:!1,access:{has:e=>"alphaMode"in e,get:e=>e.alphaMode},metadata:g},null,t),y(null,null,i,{kind:"field",name:"uniqueId",static:!1,private:!1,access:{has:e=>"uniqueId"in e,get:e=>e.uniqueId,set:(e,r)=>{e.uniqueId=r}},metadata:g},n,l),y(null,null,o,{kind:"field",name:"width",static:!1,private:!1,access:{has:e=>"width"in e,get:e=>e.width,set:(e,r)=>{e.width=r}},metadata:g},f,T),y(null,null,x,{kind:"field",name:"height",static:!1,private:!1,access:{has:e=>"height"in e,get:e=>e.height,set:(e,r)=>{e.height=r}},metadata:g},R,P),y(null,null,v,{kind:"field",name:"renderTargetSamplingMode",static:!1,private:!1,access:{has:e=>"renderTargetSamplingMode"in e,get:e=>e.renderTargetSamplingMode,set:(e,r)=>{e.renderTargetSamplingMode=r}},metadata:g},m,_),y(null,null,C,{kind:"field",name:"clearColor",static:!1,private:!1,access:{has:e=>"clearColor"in e,get:e=>e.clearColor,set:(e,r)=>{e.clearColor=r}},metadata:g},z,O),y(null,null,W,{kind:"field",name:"autoClear",static:!1,private:!1,access:{has:e=>"autoClear"in e,get:e=>e.autoClear,set:(e,r)=>{e.autoClear=r}},metadata:g},N,G),y(null,null,I,{kind:"field",name:"forceAutoClearInAlphaMode",static:!1,private:!1,access:{has:e=>"forceAutoClearInAlphaMode"in e,get:e=>e.forceAutoClearInAlphaMode,set:(e,r)=>{e.forceAutoClearInAlphaMode=r}},metadata:g},j,H),y(null,null,V,{kind:"field",name:"alphaConstants",static:!1,private:!1,access:{has:e=>"alphaConstants"in e,get:e=>e.alphaConstants,set:(e,r)=>{e.alphaConstants=r}},metadata:g},re,ie),y(null,null,ae,{kind:"field",name:"enablePixelPerfectMode",static:!1,private:!1,access:{has:e=>"enablePixelPerfectMode"in e,get:e=>e.enablePixelPerfectMode,set:(e,r)=>{e.enablePixelPerfectMode=r}},metadata:g},ne,oe),y(null,null,le,{kind:"field",name:"forceFullscreenViewport",static:!1,private:!1,access:{has:e=>"forceFullscreenViewport"in e,get:e=>e.forceFullscreenViewport,set:(e,r)=>{e.forceFullscreenViewport=r}},metadata:g},he,ue),y(null,null,de,{kind:"field",name:"scaleMode",static:!1,private:!1,access:{has:e=>"scaleMode"in e,get:e=>e.scaleMode,set:(e,r)=>{e.scaleMode=r}},metadata:g},fe,ce),y(null,null,pe,{kind:"field",name:"alwaysForcePOT",static:!1,private:!1,access:{has:e=>"alwaysForcePOT"in e,get:e=>e.alwaysForcePOT,set:(e,r)=>{e.alwaysForcePOT=r}},metadata:g},_e,me),y(null,null,ge,{kind:"field",name:"_samples",static:!1,private:!1,access:{has:e=>"_samples"in e,get:e=>e._samples,set:(e,r)=>{e._samples=r}},metadata:g},xe,be),y(null,null,Pe,{kind:"field",name:"adaptScaleToCurrentViewport",static:!1,private:!1,access:{has:e=>"adaptScaleToCurrentViewport"in e,get:e=>e.adaptScaleToCurrentViewport,set:(e,r)=>{e.adaptScaleToCurrentViewport=r}},metadata:g},Ce,ye),g&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:g})})(),s})(),Ie=!1;function Je(){Ie||(Ie=!0,Re.prototype.setTextureFromPostProcess=function(s,t,i){let n=null;t&&(t._forcedOutputTexture?n=t._forcedOutputTexture:t._textures.data[t._currentRenderTextureInd]&&(n=t._textures.data[t._currentRenderTextureInd])),this._bindTexture(s,n?.texture??null,i)},Re.prototype.setTextureFromPostProcessOutput=function(s,t,i){this._bindTexture(s,t?._outputTexture?.texture??null,i)},se.prototype.setTextureFromPostProcess=function(s,t){this._engine.setTextureFromPostProcess(this._samplers[s],t,s)},se.prototype.setTextureFromPostProcessOutput=function(s,t){this._engine.setTextureFromPostProcessOutput(this._samplers[s],t,s)},Ge("BABYLON.PostProcess",We))}
5const Q="image/png",Me=2,ze=[134,22,135,150,246,214,150,54];function Ze(s){const t=new DataView(s.buffer,s.byteOffset,s.byteLength);let i=0;for(let o=0;o<ze.length;o++)if(t.getUint8(i++)!==ze[o])return ke.Error("Not a babylon environment map"),null;let n="",l;for(;l=t.getUint8(i++);)n+=String.fromCharCode(l);let a=JSON.parse(n);return a=Z(a),a.binaryDataPosition=i,a.specular&&(a.specular.lodGenerationScale=a.specular.lodGenerationScale||.8),a}function Z(s){if(s.version>Me)throw new Error(`Unsupported babylon environment map version "${s.version}". Latest supported version is "${Me}".`);return s.version===2||(s={...s,version:2,imageType:Q}),s}function Ke(s,t){t=Z(t);const i=t.specular;let n=Math.log2(t.width);if(n=Math.round(n)+1,i.mipmaps.length!==6*n)throw new Error(`Unsupported specular mipmaps number "${i.mipmaps.length}"`);const l=new Array(n);for(let a=0;a<n;a++){l[a]=new Array(6);for(let o=0;o<6;o++){const f=i.mipmaps[a*6+o];l[a][o]=new Uint8Array(s.buffer,s.byteOffset+t.binaryDataPosition+f.position,f.length)}}return l}function Qe(s,t){t=Z(t);const i=new Array(6),n=t.irradiance?.irradianceTexture;if(n){if(n.faces.length!==6)throw new Error(`Incorrect irradiance texture faces number "${n.faces.length}"`);for(let l=0;l<6;l++){const a=n.faces[l];i[l]=new Uint8Array(s.buffer,s.byteOffset+t.binaryDataPosition+a.position,a.length)}}return i}function Xe(s,t,i){i=Z(i);const n=i.specular;if(!n)return Promise.resolve([]);s._lodGenerationScale=n.lodGenerationScale;const l=[],a=Ke(t,i);l.push(et(s,a,i.imageType));const o=i.irradiance?.irradianceTexture;if(o){const f=Qe(t,i);let T=null;i.irradiance?.irradianceTexture?.dominantDirection&&(T=D.FromArray(i.irradiance.irradianceTexture.dominantDirection)),l.push(tt(s,f,o.size,i.imageType,T))}return Promise.all(l)}async function Fe(s,t,i,n,l,a,o,f,T,x,R){return await new Promise((P,v)=>{if(i){const m=t.createTexture(null,!0,!0,null,1,null,_=>{v(_)},s);n?.onEffectCreatedObservable.addOnce(_=>{_.executeWhenCompiled(()=>{n.externalTextureSamplerBinding=!0,n.onApply=C=>{C._bindTexture("textureSampler",m),C.setFloat2("scale",1,t._features.needsInvertingBitmap&&s instanceof ImageBitmap?-1:1)},t.scenes.length&&(t.scenes[0].postProcessManager.directRender([n],x,!0,a,o),t.restoreDefaultFramebuffer(),m.dispose(),URL.revokeObjectURL(l),P())})})}else{if(t._uploadImageToTexture(R,s,a,o),f){const m=T[o];m&&t._uploadImageToTexture(m._texture,s,a,0)}P()}})}async function et(s,t,i=Q){const n=s.getEngine();s.format=5,s.type=0,s.generateMipMaps=!0,s._cachedAnisotropicFilteringLevel=null,n.updateTextureSamplingMode(3,s),await Be(s,t,!0,i),s.isReady=!0}async function tt(s,t,i,n=Q,l=null){const a=s.getEngine(),o=new Ee(a,5),f=new J(a,o);s._irradianceTexture=f,f._dominantDirection=l,o.isCube=!0,o.format=5,o.type=0,o.generateMipMaps=!0,o._cachedAnisotropicFilteringLevel=null,o.generateMipMaps=!0,o.width=i,o.height=i,a.updateTextureSamplingMode(3,o),await Be(o,[t],!1,n),a.generateMipMapsForCubemap(o),o.isReady=!0}async function Be(s,t,i,n=Q){if(!qe(s.width))throw new Error("Texture size must be a power of two");const l=He(s.width)+1,a=s.getEngine();let o=!1,f=!1,T=null,x=null,R=null;const P=a.getCaps();P.textureLOD?a._features.supportRenderAndCopyToLodForFloatTextures?P.textureHalfFloatRender&&P.textureHalfFloatLinearFiltering?(o=!0,s.type=2):P.textureFloatRender&&P.textureFloatLinearFiltering&&(o=!0,s.type=1):o=!1:(o=!1,f=i);let v=0;if(o)a.isWebGPU?(v=1,await Y(()=>import("./rgbdDecode.fragment-C8CAnR8E.js"),__vite__mapDeps([4,1,2]))):await Y(()=>import("./rgbdDecode.fragment-G0QEUr4P.js"),__vite__mapDeps([5,1,2])),T=new We("rgbdDecode","rgbdDecode",null,null,1,null,3,a,!1,void 0,s.type,void 0,null,!1,void 0,v),s._isRGBD=!1,s.invertY=!1,x=a.createRenderTargetCubeTexture(s.width,{generateDepthBuffer:!1,generateMipMaps:!0,generateStencilBuffer:!1,samplingMode:3,type:s.type,format:5});else if(s._isRGBD=!0,s.invertY=!0,f){R={};const C=s._lodGenerationScale,z=s._lodGenerationOffset;for(let O=0;O<3;O++){const N=1-O/2,G=z,I=(l-1)*C+z,j=G+(I-G)*N,H=Math.round(Math.min(Math.max(j,0),I)),M=new Ee(a,2);M.isCube=!0,M.invertY=!0,M.generateMipMaps=!1,a.updateTextureSamplingMode(2,M);const V=new J(null);switch(V._isCube=!0,V._texture=M,R[H]=V,O){case 0:s._lodTextureLow=V;break;case 1:s._lodTextureMid=V;break;case 2:s._lodTextureHigh=V;break}}}const m=[];for(let _=0;_<t.length;_++)for(let C=0;C<6;C++){const z=t[_][C],O=je(z),W=new Blob([O],{type:n}),N=URL.createObjectURL(W);let G;if(a._features.forceBitmapOverHTMLImageElement)G=a.createImageBitmap(W,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(async I=>await Fe(I,a,o,T,N,C,_,f,R,x,s));else{const I=new Image;I.src=N,G=new Promise((j,H)=>{I.onload=()=>
5{Fe(I,a,o,T,N,C,_,f,R,x,s).then(()=>j()).catch(M=>{H(M)})},I.onerror=M=>{H(M)}})}m.push(G)}if(await Promise.all(m),t.length<l){let _;const C=Math.pow(2,l-1-t.length),z=C*C*4;switch(s.type){case 0:{_=new Uint8Array(z);break}case 2:{_=new Uint16Array(z);break}case 1:{_=new Float32Array(z);break}}for(let O=t.length;O<l;O++)for(let W=0;W<6;W++)a._uploadArrayBufferViewToTexture(x?.texture||s,_,W,O)}if(x){const _=s._irradianceTexture;s._irradianceTexture=null,a._releaseTexture(s),x._swapAndDie(s),s._irradianceTexture=_}T&&T.dispose(),f&&(s._lodTextureHigh&&s._lodTextureHigh._texture&&(s._lodTextureHigh._texture.isReady=!0),s._lodTextureMid&&s._lodTextureMid._texture&&(s._lodTextureMid._texture.isReady=!0),s._lodTextureLow&&s._lodTextureLow._texture&&(s._lodTextureLow._texture.isReady=!0))}function st(s,t){t=Z(t);const i=t.irradiance;if(!i)return;const n=new Ne;D.FromArrayToRef(i.x,0,n.x),D.FromArrayToRef(i.y,0,n.y),D.FromArrayToRef(i.z,0,n.z),D.FromArrayToRef(i.xx,0,n.xx),D.FromArrayToRef(i.yy,0,n.yy),D.FromArrayToRef(i.zz,0,n.zz),D.FromArrayToRef(i.yz,0,n.yz),D.FromArrayToRef(i.zx,0,n.zx),D.FromArrayToRef(i.xy,0,n.xy),s._sphericalPolynomial=n}let Le=!1;function rt(){Le||(Le=!0,J.prototype._sphericalPolynomialTargetSize=0,J.prototype.forceSphericalPolynomialsRecompute=function(){this._texture&&(this._texture._sphericalPolynomial=null,this._texture._sphericalPolynomialPromise=null,this._texture._sphericalPolynomialComputed=!1)},Object.defineProperty(J.prototype,"sphericalPolynomial",{get:function(){if(this._texture){if(this._texture._sphericalPolynomial||this._texture._sphericalPolynomialComputed)return this._texture._sphericalPolynomial;if(this._texture.isReady)return this._texture._sphericalPolynomialPromise||(this._texture._sphericalPolynomialPromise=$e.ConvertCubeMapTextureToSphericalPolynomial(this),this._texture._sphericalPolynomialPromise===null?this._texture._sphericalPolynomialComputed=!0:this._texture._sphericalPolynomialPromise.then(s=>{this._texture._sphericalPolynomial=s,this._texture._sphericalPolynomialComputed=!0})),null}return null},set:function(s){this._texture&&(this._texture._sphericalPolynomial=s)},enumerable:!0,configurable:!0}))}class ot{constructor(){this.supportCascades=!1}loadCubeData(t,i,n,l,a){if(Array.isArray(t))return;const o=Ze(t);if(o){i.width=o.width,i.height=o.width;try{rt(),st(i,o),Xe(i,t,o).then(()=>{i.isReady=!0,i.onLoadedObservable.notifyObservers(i),i.onLoadedObservable.clear(),l&&l()},f=>{a?.("Can not upload environment levels",f)})}catch(f){a?.("Can not upload environment file",f)}}else a&&a("Can not parse the environment file",null)}loadData(){throw".env not supported in 2d."}}export{ot as _ENVTextureLoader};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.