PageSourceSearch

https://aminedirohf-netgroup-nccl-smoke.hf.space/assets/EXT_lights_image_based-DGQjbkbj.js

js aminedirohf-netgroup-nccl-smoke.hf.space collected 2026-10-04 16:40:21 UTC 10,539 bytes, 1 lines download raw bytes

1import{a as G,S as z}from"./engine-CpuWTyJz.js";import{M as c,O as D,V as S,T as M,Q as w}from"./math.vector-C1xyPDEl.js";import{S as A}from"./decorators.serialization-C7d7ykGG.js";import{_ as F}from"./environmentTextureTools-Bxqq-W7n.js";import{_ as h,s as _,a as E,v as P}from"./bufferUtils-DTRdUD8L.js";import{T as Y}from"./tools-D01N7ptR.js";import{B as $}from"./baseTexture-CgAggsey.js";import{T as B}from"./texture-BEqhDl5Y.js";import{G as V,R as H}from"./math.scalar.functions-DkeaWAWz.js";import"./abstractEngine.cubeTexture-0PJJEs45.js";import{G as j,A as C}from"./glTFLoader-DuBN53_Z.js";import{u as q,r as O}from"./dynamic-B0TG-CUB.js";import"./thinEngine-D5ynu8Dd.js";import"./drawWrapper.functions-Dzz0ghog.js";import"./dataBuffer-CgoqiUzT.js";import"./index-DeFvE6lu.js";import"./math.axis-Ck7JfPPj.js";import"./math.color-CzLaKyb6.js";import"./math.plane-Ce_75-g5.js";import"./math.path-DFucxaHn.js";import"./perfCounter-DusmGz8t.js";import"./scene-gn_hoGMy.js";import"./smartArray-CO6iJ0u5.js";import"./lightConstants-B1TSTh-k.js";import"./sceneComponent-Dflhczui.js";import"./buffer-DqKlo1ts.js";import"./renderingManager-CiY2OUrf.js";import"./deviceInputEvents-BTza-zoR.js";import"./passPostProcess-D9n088ny.js";import"./effectRenderer-CSz5fi0n.js";import"./math.viewport-CgkTt1RS.js";import"./drawWrapper-CZVk0xN-.js";import"./renderTargetTexture-BB8nhK2f.js";import"./dumpTools-DCwESy1L.js";import"./baseTexture.polynomial-DF3NS0nO.js";import"./cubemapToSphericalPolynomial-DuWiqS6A.js";import"./mesh-oYr96VDh.js";import"./mesh.vertexData-Cr3zcPIw.js";import"./subMesh-UWDo5wjI.js";import"./node-C-Iu0ALa.js";import"./sceneLoaderFlags-wywyb9ml.js";import"./material-CrEsrP1R.js";import"./cameraInputsManager-DlqW7Xs8.js";import"./bone-B35odufe.js";import"./skeleton-BVUVDN0a.js";import"./rawTexture-Cp8_XuDs.js";import"./animation-IftAdLIx.js";import"./sceneLoader-CutT-qCn.js";import"./assetContainer-OIgMc4u0.js";import"./instancedMesh-QYXOajBy.js";import"./light-DT53MGnW.js";import"./objectModelMapping-DWcnlpHl.js";const I=.8;class l extends ${set boundingBoxSize(e){if(this._boundingBoxSize&&this._boundingBoxSize.equals(e))return;this._boundingBoxSize=e;const t=this.getScene();t&&t.markAllMaterialsAsDirty(1)}get boundingBoxSize(){return this._boundingBoxSize}set rotationY(e){this._rotationY=e,this.setReflectionTextureMatrix(c.RotationY(this._rotationY))}get rotationY(){return this._rotationY}get noMipmap(){return this._noMipmap}get forcedExtension(){return this._forcedExtension}static CreateFromImages(e,t,i){let r="";for(const s of e)r+=s;return new l(r,t,null,i,e)}static CreateFromPrefilteredData(e,t,i=null,r=!0){const s=t.useDelayedTextureLoading;t.useDelayedTextureLoading=!1;const o=new l(e,t,null,!1,null,null,null,void 0,!0,i,r);return t.useDelayedTextureLoading=s,o}constructor(e,t,i=null,r=!1,s=null,o=null,n=null,a=5,u=!1,d=null,f=!1,x=I,p=0,y,m){var v;super(t),this.onLoadObservable=new D,this.boundingBoxPosition=S.Zero(),this._rotationY=0,this._files=null,this._forcedExtension=null,this._extensions=null,this._textureMatrixRefraction=new c,this._buffer=null,this.name=e,this.url=e,this._noMipmap=r,this.hasAlpha=!1,this.isCube=!0,this._textureMatrix=c.Identity(),this.coordinatesMode=B.CUBIC_MODE;let b,T=null;i!==null&&!Array.isArray(i)?(b=i.extensions??null,this._noMipmap=i.noMipmap??!1,s=i.files??null,T=i.buffer??null,this._format=i.format??5,u=i.prefiltered??!1,d=i.forcedExtension??null,this._createPolynomials=i.createPolynomials??!1,this._lodScale=i.lodScale??I,this._lodOffset=i.lodOffset??0,this._loaderOptions=i.loaderOptions,this._useSRGBBuffer=i.useSRGBBuffer,o=i.onLoad??null,n=i.onError??null):(this._noMipmap=r,this._format=a,this._createPolynomials=f,b=i,this._loaderOptions=y,this._useSRGBBuffer=m,this._lodScale=x,this._lodOffset=p),!(!e&&!s)&&this.updateURL(e,d,o,u,n,b,(v=this.getScene())==null?void 0:v.useDelayedTextureLoading,s,T)}getClassName(){return"CubeTexture"}updateURL(e,t=null,i=null,r=!1,s=null,o=null,n=!1,a=null,u=null){(!this.name||this.name.startsWith("data:"))&&(this.name=e),this.url=e,t&&(this._forcedExtension=t);const d=e.lastIndexOf("."),f=t||(d>-1?e.substring(d).toLowerCase():""),x=f.indexOf(".dds")===0,p=f.indexOf(".env")===0,y=f.indexOf(".basis")===0;if(p?(this.gammaSpace=!1,this._prefiltered=!1,this.anisotropicFilteringLevel=1):(this._prefiltered=r,r&&(this.gammaSpace=!1,this.anisotropicFilteringLevel=1)),a)this._files=a;else if(!y&&!p&&!x&&!o&&(o=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),this._files=this._files||[],this._files.length=0,o){for(let m=0;m<o.length;m++)this._files.push(e+o[m]);this._extensions=o}this._buffer=u,n?(this.delayLoadState=4,this._delayedOnLoad=i,this._delayedOnError=s):this._loadTexture(i,s)}delayLoad(e){this.delayLoadState===4&&(e&&(this._forcedExtension=e),this.delayLoadState=1,this._loadTexture(this._delayedOnLoad,this._delayedOnError))}getReflectionTextureMatrix(){return this._textureMatrix}setReflectionTextureMatrix(e){var s,o;if(e.updateFlag===this._textureMatrix.updateFlag||(e.isIdentity()!==this._textureMatrix.isIdentity()&&((s=this.getScene())==null||s.markAllMaterialsAsDirty(1,n=>n.getActiveTextures().indexOf(this)!==-1)),this._textureMatrix=e,!((o=this.getScene())!=null&&o.useRightHandedSystem)))return;const t=M.Vector3[0],i=M.Quaternion[0],r=M.Vector3[1];this._textureMatrix.decompose(t,i,r),i.z*=-1,i.w*=-1,c.ComposeToRef(t,i,r,this._textureMatrixRefraction)}getRefractionTextureMatrix(){var e;return(e=this.getScene())!=null&&e.useRightHandedSystem?this._textureMatrixRefraction:this._textureMatrix}_loadTexture(e=null,t=null){var n;const i=this.getScene(),r=this._texture;this._texture=this._getFromCache(this.url,this._noMipmap,void 0,void 0,this._useSRGBBuffer,this.isCube);const s=()=>{var a;this.onLoadObservable.notifyObservers(this),r&&(r.dispose(),(a=this.getScene())==null||a.markAllMaterialsAsDirty(1)),e&&e()},o=(a,u)=>{this._loadingError=!0,this._errorObject={message:a,exception:u},t&&t(a,u),B.OnTextureLoadErrorObservable.notifyObservers(this)};this._texture?this._texture.isReady?Y.SetImmediate(()=>s()):this._texture.onLoadedObservable.add(()=>s()):(this._prefiltered?this._texture=this._getEngine().createPrefilteredCubeTexture(this.url,i,this._lodScale,this._lodOffset,e,o,this._format,this._forcedExtension,this._createPolynomials):this._texture=this._getEngine().createCubeTexture(this.url,i,this._files,this._noMipmap,e,o,this._format,this._forcedExtension,!1,this._lodScale,this._lodOffset,null,this._loaderOptions,!!this._useSRGBBuffer,this._buffer),(n=this._texture)==null||n.onLoadedObservable.add(()=>this.onLoadObservable.notifyObservers(this)))}static Parse(e,t,i){const r=A.Parse(()=>{let s=!1;return e.prefiltered&&(s=e.prefiltered),new l(i+(e.url??e.name),t,e.extensions,!1,e.files||null,null,null,void 0,s,e.forcedExtension)},e,t);if(e.boundingBoxPosition&&(r.boundingBoxPosition=S.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(r.boundingBoxSize=S.FromArray(e.boundingBoxSize)),e.animations)for(let s=0;s<e.animations.length;s++){const o=e.animations[s],n=V("BABYLON.Animation");n&&r.animations.push(n.Parse(o))}return r}clone(){let e=0;const t=A.Clone(()=>
1{const i=new l(this.url,this.getScene()||this._getEngine(),this._extensions,this._noMipmap,this._files);return e=i.uniqueId,i},this);return t.uniqueId=e,t}}h([_()],l.prototype,"url",void 0);h([E()],l.prototype,"boundingBoxPosition",void 0);h([E()],l.prototype,"boundingBoxSize",null);h([_("rotationY")],l.prototype,"rotationY",null);h([_("files")],l.prototype,"_files",void 0);h([_("forcedExtension")],l.prototype,"_forcedExtension",void 0);h([_("extensions")],l.prototype,"_extensions",void 0);h([P("textureMatrix")],l.prototype,"_textureMatrix",void 0);h([P("textureMatrixRefraction")],l.prototype,"_textureMatrixRefraction",void 0);B._CubeTextureParser=l.Parse;H("BABYLON.CubeTexture",l);class R extends l{constructor(e,t,i,r=5,s=0,o=!1,n=!1,a=3,u=null){super("",e),this._texture=e.getEngine().createRawCubeTexture(t,i,r,s,o,n,a,u)}update(e,t,i,r,s=null){this._texture.getEngine().updateRawCubeTexture(this._texture,e,t,i,r,s)}updateRGBDAsync(e,t=null,i=.8,r=0){return F(this._texture,e,t,i,r).then(()=>{})}clone(){return A.Clone(()=>{const e=this.getScene(),t=this._texture,i=new R(e,t._bufferViewArray,t.width,t.format,t.type,t.generateMipMaps,t.invertY,t.samplingMode,t._compression);return t.source===13&&i.updateRGBDAsync(t._bufferViewArrayArray,t._sphericalPolynomial,t._lodGenerationScale,t._lodGenerationOffset),i},this)}}const g="EXT_lights_image_based";class N{constructor(e){this.name=g,this._loader=e,this.enabled=this._loader.isExtensionUsed(g)}dispose(){this._loader=null,delete this._lights}onLoading(){const e=this._loader.gltf.extensions;if(e&&e[this.name]){const t=e[this.name];this._lights=t.lights}}loadSceneAsync(e,t){return j.LoadExtensionAsync(e,t,this.name,async(i,r)=>{this._loader._allMaterialsDirtyRequired=!0;const s=new Array;s.push(this._loader.loadSceneAsync(e,t)),this._loader.logOpen(`${i}`);const o=C.Get(`${i}/light`,this._lights,r.light);return s.push(this._loadLightAsync(`/extensions/${this.name}/lights/${r.light}`,o).then(n=>{this._loader.babylonScene.environmentTexture=n})),this._loader.logClose(),await Promise.all(s).then(()=>{})})}_loadLightAsync(e,t){if(!t._loaded){const i=new Array;this._loader.logOpen(`${e}`);const r=new Array(t.specularImages.length);for(let s=0;s<t.specularImages.length;s++){const o=t.specularImages[s];r[s]=new Array(o.length);for(let n=0;n<o.length;n++){const a=`${e}/specularImages/${s}/${n}`;this._loader.logOpen(`${a}`);const u=o[n],d=C.Get(a,this._loader.gltf.images,u);i.push(this._loader.loadImageAsync(`/images/${u}`,d).then(f=>{r[s][n]=f})),this._loader.logClose()}}this._loader.logClose(),t._loaded=Promise.all(i).then(async()=>{const s=new R(this._loader.babylonScene,null,t.specularImageSize);if(s.name=t.name||"environment",t._babylonTexture=s,t.intensity!=null&&(s.level=t.intensity),t.rotation){let u=w.FromArray(t.rotation);this._loader.babylonScene.useRightHandedSystem||(u=w.Inverse(u)),c.FromQuaternionToRef(u,s.getReflectionTextureMatrix())}if(!t.irradianceCoefficients)throw new Error(`${e}: Irradiance coefficients are missing`);const o=G.FromArray(t.irradianceCoefficients);o.scaleInPlace(t.intensity),o.convertIrradianceToLambertianRadiance();const n=z.FromHarmonics(o),a=(r.length-1)/Math.log2(t.specularImageSize);return await s.updateRGBDAsync(r,n,a)})}return t._loaded.then(()=>t._babylonTexture)}}q(g);O(g,!0,L=>new N(L));export{N as EXT_lights_image_based};

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.