import{ay as t}from"./index-T8LZyOXI.js";import{DDSTools as n}from"./dds-BSb1fu5d.js";import"./index-BkylzejB.js";import"./abstractEngine.cubeTexture-DfaI3mgQ.js";class M{constructor(){this.supportCascades=!0}loadCubeData(e,i,m,o){const p=i.getEngine();let a,l=!1,d=1e3;if(Array.isArray(e))for(let s=0;s<e.length;s++){const h=e[s];a=n.GetDDSInfo(h),i.width=a.width,i.height=a.height,l=(a.isRGB||a.isLuminance||a.mipmapCount>1)&&i.generateMipMaps,p._unpackFlipY(a.isCompressed),n.UploadDDSLevels(p,i,h,a,l,6,-1,s),!a.isFourCC&&a.mipmapCount===1?p.generateMipMapsForCubemap(i):d=a.mipmapCount-1}else{const s=e;a=n.GetDDSInfo(s),i.width=a.width,i.height=a.height,m&&(a.sphericalPolynomial=new t),l=(a.isRGB||a.isLuminance||a.mipmapCount>1)&&i.generateMipMaps,p._unpackFlipY(a.isCompressed),n.UploadDDSLevels(p,i,s,a,l,6),!a.isFourCC&&a.mipmapCount===1?p.generateMipMapsForCubemap(i,!1):d=a.mipmapCount-1}p._setCubeMapTextureParams(i,l,d),i.isReady=!0,i.onLoadedObservable.notifyObservers(i),i.onLoadedObservable.clear(),o&&o({isDDS:!0,width:i.width,info:a,data:e,texture:i})}loadData(e,i,m){const o=n.GetDDSInfo(e),p=(o.isRGB||o.isLuminance||o.mipmapCount>1)&&i.generateMipMaps&&Math.max(o.width,o.height)>>o.mipmapCount-1===1;m(o.width,o.height,p,o.isFourCC,()=>{n.UploadDDSLevels(i.getEngine(),i,e,o,p,1)})}}export{M as _DDSTextureLoader};
