@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
3 lines (2 loc) • 2.31 kB
JavaScript
import{A as e,v as t,L as n,w as a,x as o,y as s}from"./index-BPURObVq.esm.min.js";import{_ as r}from"./textureLoaderManager-CGf6Ha4H.esm.min.js";let i=!1;function l(){i||(i=!0,e.prototype._partialLoadFile=function(e,t,n,a,o=null){this._loadFile(e,e=>{n[t]=e,n._internalCount++,6===n._internalCount&&a(n)},void 0,void 0,!0,(e,t)=>{o&&e&&o(e.status+" "+e.statusText,t)})},e.prototype._cascadeLoadFiles=function(e,t,n,a=null){const o=[];o._internalCount=0;for(let e=0;e<6;e++)this._partialLoadFile(n[e],e,o,t,a)},e.prototype._cascadeLoadImgs=function(e,t,n,a,o=null,s){const r=[];r._internalCount=0;for(let i=0;i<6;i++)this._partialLoadImg(a[i],i,r,e,t,n,o,s)},e.prototype._partialLoadImg=function(e,a,o,s,r,i,l=null,u){const d=t();n(e,e=>{o[a]=e,o._internalCount++,s&&s.removePendingData(d),6===o._internalCount&&i&&i(r,o)},(e,t)=>{s&&s.removePendingData(d),l&&l(e,t)},s?s.offlineProvider:null,u),s&&s.addPendingData(d)},e.prototype.createCubeTextureBase=function(e,t,n,i,l=null,u=null,d,c=null,f=!1,p=0,_=0,h=null,m=null,x=null,C=!1,g=null){const b=h||new a(this,7);b.isCube=!0,b.url=e,b.generateMipMaps=!i,b._lodGenerationScale=p,b._lodGenerationOffset=_,b._useSRGBBuffer=!!C&&this._caps.supportSRGBBuffers&&(this.version>1||this.isWebGPU||!!i),b!==h&&(b.label=e.substring(0,60)),this._doNotHandleContextLost||(b._extension=c,b._files=n,b._buffer=g);const L=e;this._transformTextureUrl&&!h&&(e=this._transformTextureUrl(e));const v=c??o(e),y=r(v),w=(e,t)=>{b.dispose(),u?u(e,t):e&&s.Warn(e)},T=(a,o)=>{e===L?a&&w(a.status+" "+a.statusText,o):(s.Warn(`Failed to load ${e}, falling back to the ${L}`),this.createCubeTextureBase(L,t,n,!!i,l,w,d,c,f,p,_,b,m,x,C,g))};if(y)y.then(a=>{const o=e=>{m&&m(b,e),a.loadCubeData(e,b,f,l,(e,t)=>{w(e,t)})};g?o(g):n&&6===n.length?a.supportCascades?this._cascadeLoadFiles(t,e=>o(e.map(e=>new Uint8Array(e))),n,w):w("Textures type does not support cascades."):this._loadFile(e,e=>o(new Uint8Array(e)),void 0,t?t.offlineProvider||null:void 0,!0,T)});else{if(!n||0===n.length)throw new Error("Cannot load cubemap because files were not defined, or the correct loader was not found.");this._cascadeLoadImgs(t,b,(e,t)=>{x&&x(e,t)},n,w)}return this._internalTexturesCache.push(b),b})}export{l as R};
//# sourceMappingURL=abstractEngine.cubeTexture.pure-DReMqode.esm.min.js.map