PageSourceSearch

https://balloon99-kj7qgchv.manus.space/assets/envTextureLoader-CI73Qj7S.js

js balloon99-kj7qgchv.manus.space collected 2026-10-03 05:00:24 UTC 8,053 bytes, 2 lines download raw bytes

vendor: 5,463 bytes, lines 1-2
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rgbdDecode.fragment-Cm96rMKV.js","assets/fileTools.pure-O3hflNMy.js","assets/helperFunctions-B6Ks6Htg.js","assets/rgbdDecode.fragment-CXZ77-jm.js","assets/helperFunctions-D7-zXdUR.js"])))=>i.map(i=>d[i]);
2import{_ as M}from"./index-DY6XcbtQ.js";import{L as E,V as d,J as B,K as z,N as G,U as V}from"./fileTools.pure-O3hflNMy.js";import{S as k}from"./engine-CThjqeAu.js";import{B as v}from"./baseTexture.pure-BeMB4zCM.js";import{P as H}from"./postProcess.pure-DaBR2bKQ.js";import{C as N}from"./cubemapToSphericalPolynomial--fI2d8Is.js";import"./perfCounter-BXP6OJRQ.js";import"./math.size-F3xmSqZc.js";import"./smartArray-B7wVGkJ5.js";const I="image/png",D=2,S=[134,22,135,150,246,214,150,54];function $(e){const n=new DataView(e.buffer,e.byteOffset,e.byteLength);let r=0;for(let a=0;a<S.length;a++)if(n.getUint8(r++)!==S[a])return E.Error("Not a babylon environment map"),null;let i="",o;for(;o=n.getUint8(r++);)i+=String.fromCharCode(o);let t=JSON.parse(i);return t=A(t),t.binaryDataPosition=r,t.specular&&(t.specular.lodGenerationScale=t.specular.lodGenerationScale||.8),t}function A(e){if(e.version>D)throw new Error(`Unsupported babylon environment map version "${e.version}". Latest supported version is "${D}".`);return e.version===2||(e={...e,version:2,imageType:I}),e}function Y(e,n){n=A(n);const r=n.specular;let i=Math.log2(n.width);if(i=Math.round(i)+1,r.mipmaps.length!==6*i)throw new Error(`Unsupported specular mipmaps number "${r.mipmaps.length}"`);const o=new Array(i);for(let t=0;t<i;t++){o[t]=new Array(6);for(let a=0;a<6;a++){const s=r.mipmaps[t*6+a];o[t][a]=new Uint8Array(e.buffer,e.byteOffset+n.binaryDataPosition+s.position,s.length)}}return o}function j(e,n){n=A(n);const r=new Array(6),i=n.irradiance?.irradianceTexture;if(i){if(i.faces.length!==6)throw new Error(`Incorrect irradiance texture faces number "${i.faces.length}"`);for(let o=0;o<6;o++){const t=i.faces[o];r[o]=new Uint8Array(e.buffer,e.byteOffset+n.binaryDataPosition+t.position,t.length)}}return r}function J(e,n,r){r=A(r);const i=r.specular;if(!i)return Promise.resolve([]);e._lodGenerationScale=i.lodGenerationScale;const o=[],t=Y(n,r);o.push(W(e,t,r.imageType));const a=r.irradiance?.irradianceTexture;if(a){const s=j(n,r);let u=null;r.irradiance?.irradianceTexture?.dominantDirection&&(u=d.FromArray(r.irradiance.irradianceTexture.dominantDirection)),o.push(K(e,s,a.size,r.imageType,u))}return Promise.all(o)}async function F(e,n,r,i,o,t,a,s,u,h,x){return await new Promise((y,R)=>{if(r){const _=n.createTexture(null,!0,!0,null,1,null,l=>{R(l)},e);i?.onEffectCreatedObservable.addOnce(l=>{l.executeWhenCompiled(()=>{i.externalTextureSamplerBinding=!0,i.onApply=c=>{c._bindTexture("textureSampler",_),c.setFloat2("scale",1,n._features.needsInvertingBitmap&&e instanceof ImageBitmap?-1:1)},n.scenes.length&&(n.scenes[0].postProcessManager.directRender([i],h,!0,t,a),n.restoreDefaultFramebuffer(),_.dispose(),URL.revokeObjectURL(o),y())})})}else{if(n._uploadImageToTexture(x,e,t,a),s){const _=u[a];_&&n._uploadImageToTexture(_._texture,e,t,0)}y()}})}async function W(e,n,r=I){const i=e.getEngine();e.format=5,e.type=0,e.generateMipMaps=!0,e._cachedAnisotropicFilteringLevel=null,i.updateTextureSamplingMode(3,e),await U(e,n,!0,r),e.isReady=!0}async function K(e,n,r,i=I,o=null){const t=e.getEngine(),a=new B(t,5),s=new v(t,a);e._irradianceTexture=s,s._dominantDirection=o,a.isCube=!0,a.format=5,a.type=0,a.generateMipMaps=!0,a._cachedAnisotropicFilteringLevel=null,a.generateMipMaps=!0,a.width=r,a.height=r,t.updateTextureSamplingMode(3,a),await U(a,[n],!1,i),t.generateMipMapsForCubemap(a),a.isReady=!0}async function U(e,n,r,i=I){if(!z(e.width))throw new Error("Texture size must be a power of two");const o=G(e.width)+1,t=e.getEngine();let a=!1,s=!1,u=null,h=null,x=null;const y=t.getCaps();y.textureLOD?t._features.supportRenderAndCopyToLodForFloatTextures?y.textureHalfFloatRender&&y.textureHalfFloatLinearFiltering?(a=!0,e.type=2):y.textureFloatRender&&y.textureFloatLinearFiltering&&(a=!0,e.type=1):a=!1:(a=!1,s=r);let R=0;if(a)t.isWebGPU?(R=1,await M(()=>import("./rgbdDecode.fragment-Cm96rMKV.js"),__vite__mapDeps([0,1,2]))):await M(()=>import("./rgbdDecode.fragment-CXZ77-jm.js"),__vite__mapDeps([3,1,4])),u=new H("rgbdDecode","rgbdDecode",null,null,1,null,3,t,!1,void 0,e.type,void 0,null,!1,void 0,R),e._isRGBD=!1,e.invertY=!1,h=t.createRenderTargetCubeTexture(e.width,{generateDepthBuffer:!1,generateMipMaps:!0,generateStencilBuffer:!1,samplingMode:3,type:e.type,format:5});else if(e._isRGBD=!0,e.invertY=!0,s){x={};const c=e._lodGenerationScale,g=e._lodGenerationOffset;for(let p=0;p<3;p++){const P=1-p/2,w=g,f=(o-1)*c+g,C=w+(f-w)*P,L=Math.round(Math.min(Math.max(C,0),f)),m=new B(t,2);m.isCube=!0,m.invertY=!0,m.generateMipMaps=!1,t.updateTextureSamplingMode(2,m);const b=new v(null);switch(b._isCube=!0,b._texture=m,x[L]=b,p){case 0:e._lodTextureLow=b;break;case 1:e._lodTextureMid=b;break;case 2:e._lodTextureHigh=b;break}}}const _=[];for(let l=0;l<n.length;l++)for(let c=0;c<6;c++){const g=n[l][c],p=V(g),T=new Blob([p],{type:i}),P=URL.createObjectURL(T);let w;if(t._features.forceBitmapOverHTMLImageElement)w=t.createImageBitmap(T,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(async f=>await F(f,t,a,u,P,c,l,s,x,h,e));else{const f=new Image;f.src=P,w=new Promise((C,L)=>{f.onload=()=>{F(f,t,a,u,P,c,l,s,x,h,e).then(()=>C()).catch(m=>{L(m)})},f.onerror=m=>{L(m)}})}_.push(w)}
2if(await Promise.all(_),n.length<o){let l;const c=Math.pow(2,o-1-n.length),g=c*c*4;switch(e.type){case 0:{l=new Uint8Array(g);break}case 2:{l=new Uint16Array(g);break}case 1:{l=new Float32Array(g);break}}for(let p=n.length;p<o;p++)for(let T=0;T<6;T++)t._uploadArrayBufferViewToTexture(h?.texture||e,l,T,p)}if(h){const l=e._irradianceTexture;e._irradianceTexture=null,t._releaseTexture(e),h._swapAndDie(e),e._irradianceTexture=l}u&&u.dispose(),s&&(e._lodTextureHigh&&e._lodTextureHigh._texture&&(e._lodTextureHigh._texture.isReady=!0),e._lodTextureMid&&e._lodTextureMid._texture&&(e._lodTextureMid._texture.isReady=!0),e._lodTextureLow&&e._lodTextureLow._texture&&(e._lodTextureLow._texture.isReady=!0))}function q(e,n){n=A(n);const r=n.irradiance;if(!r)return;const i=new k;d.FromArrayToRef(r.x,0,i.x),d.FromArrayToRef(r.y,0,i.y),d.FromArrayToRef(r.z,0,i.z),d.FromArrayToRef(r.xx,0,i.xx),d.FromArrayToRef(r.yy,0,i.yy),d.FromArrayToRef(r.zz,0,i.zz),d.FromArrayToRef(r.yz,0,i.yz),d.FromArrayToRef(r.zx,0,i.zx),d.FromArrayToRef(r.xy,0,i.xy),e._sphericalPolynomial=i}let O=!1;function Q(){O||(O=!0,v.prototype._sphericalPolynomialTargetSize=0,v.prototype.forceSphericalPolynomialsRecompute=function(){this._texture&&(this._texture._sphericalPolynomial=null,this._texture._sphericalPolynomialPromise=null,this._texture._sphericalPolynomialComputed=!1)},Object.defineProperty(v.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=N.ConvertCubeMapTextureToSphericalPolynomial(this),this._texture._sphericalPolynomialPromise===null?this._texture._sphericalPolynomialComputed=!0:this._texture._sphericalPolynomialPromise.then(e=>{this._texture._sphericalPolynomial=e,this._texture._sphericalPolynomialComputed=!0})),null}return null},set:function(e){this._texture&&(this._texture._sphericalPolynomial=e)},enumerable:!0,configurable:!0}))}class se{constructor(){this.supportCascades=!1}loadCubeData(n,r,i,o,t){if(Array.isArray(n))return;const a=$(n);if(a){r.width=a.width,r.height=a.width;try{Q(),q(r,a),J(r,n,a).then(()=>{r.isReady=!0,r.onLoadedObservable.notifyObservers(r),r.onLoadedObservable.clear(),o&&o()},s=>{t?.("Can not upload environment levels",s)})}catch(s){t?.("Can not upload environment file",s)}}else t&&t("Can not parse the environment file",null)}loadData(){throw".env not supported in 2d."}}export{se 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.