UNPKG

@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.2 kB
import{aa as t,bm as e,bn as n,a1 as a,bo as o,bp as s,L as i}from"./index-Bw2N6w1y.esm.min.js";t.prototype._partialLoadFile=function(t,e,n,a,o=null){this._loadFile(t,(t=>{n[e]=t,n._internalCount++,6===n._internalCount&&a(n)}),void 0,void 0,!0,((t,e)=>{o&&t&&o(t.status+" "+t.statusText,e)}))},t.prototype._cascadeLoadFiles=function(t,e,n,a=null){const o=[];o._internalCount=0;for(let t=0;t<6;t++)this._partialLoadFile(n[t],t,o,e,a)},t.prototype._cascadeLoadImgs=function(t,e,n,a,o=null,s){const i=[];i._internalCount=0;for(let l=0;l<6;l++)this._partialLoadImg(a[l],l,i,t,e,n,o,s)},t.prototype._partialLoadImg=function(t,a,o,s,i,l,r=null,u){const d=e();n(t,(t=>{o[a]=t,o._internalCount++,s&&s.removePendingData(d),6===o._internalCount&&l&&l(i,o)}),((t,e)=>{s&&s.removePendingData(d),r&&r(t,e)}),s?s.offlineProvider:null,u),s&&s.addPendingData(d)},t.prototype.createCubeTextureBase=function(t,e,n,l,r=null,u=null,d,c=null,p=!1,f=0,_=0,h=null,b=null,m=null,C=!1,g=null){const x=h||new a(this,7);x.isCube=!0,x.url=t,x.generateMipMaps=!l,x._lodGenerationScale=f,x._lodGenerationOffset=_,x._useSRGBBuffer=!!C&&this._caps.supportSRGBBuffers&&(this.version>1||this.isWebGPU||!!l),x!==h&&(x.label=t.substring(0,60)),this._doNotHandleContextLost||(x._extension=c,x._files=n,x._buffer=g);const L=t;this._transformTextureUrl&&!h&&(t=this._transformTextureUrl(t));const v=c??o(t),y=s(v),T=(t,e)=>{x.dispose(),u?u(t,e):t&&i.Warn(t)},w=(a,o)=>{t===L?a&&T(a.status+" "+a.statusText,o):(i.Warn(`Failed to load ${t}, falling back to the ${L}`),this.createCubeTextureBase(L,e,n,!!l,r,T,d,c,p,f,_,x,b,m,C,g))};if(y)y.then((a=>{const o=t=>{b&&b(x,t),a.loadCubeData(t,x,p,r,((t,e)=>{T(t,e)}))};g?o(g):n&&6===n.length?a.supportCascades?this._cascadeLoadFiles(e,(t=>o(t.map((t=>new Uint8Array(t))))),n,T):T("Textures type does not support cascades."):this._loadFile(t,(t=>o(new Uint8Array(t))),void 0,void 0,!0,w)}));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(e,x,((t,e)=>{m&&m(t,e)}),n,T)}return this._internalTexturesCache.push(x),x}; //# sourceMappingURL=abstractEngine.cubeTexture-DJ9DQfTr.esm.min.js.map