@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) • 1.81 kB
JavaScript
import{b as e,A as t}from"./glTFLoader.pure-Bdyl6AcK.esm.min.js";import{aY as s,bo as o,bp as r}from"./index-BPURObVq.esm.min.js";import"./morphTargetManager-CdEb1BHc.esm.min.js";import"./bone.pure-BcPT5kCP.esm.min.js";import"./skeleton-DinTjF3y.esm.min.js";import"./assetContainer-CAncviZo.esm.min.js";import"./objectModelMapping-ClgDmo5Q.esm.min.js";import"./spotLight.pure-5s2DDDIt.esm.min.js";let n=0,a=null;class i{static get Default(){return i._Default||(i._Default=new i),i._Default}constructor(){const e=i.Configuration.decoder;this._decoderModulePromise=s.LoadBabylonScriptAsync(e.url).then(()=>MeshoptDecoder.ready)}dispose(){delete this._decoderModulePromise}async decodeGltfBufferAsync(e,t,s,o,r){await this._decoderModulePromise,0===n&&(MeshoptDecoder.useWorkers(1),n=1);const i=await MeshoptDecoder.decodeGltfBufferAsync(t,s,e,o,r);return null!==a&&clearTimeout(a),a=setTimeout(()=>{MeshoptDecoder.useWorkers(0),n=0,a=null},1e3),i}}i.Configuration={decoder:{url:`${s._DefaultCdnUrl}/meshopt_decoder.js`}},i._Default=null;const d="EXT_meshopt_compression";class l{constructor(e){this.name=d,this.enabled=e.isExtensionUsed(d),this._loader=e}dispose(){this._loader=null}loadBufferViewAsync(s,o){return e.LoadExtensionAsync(s,o,this.name,async(e,r)=>{const n=o;if(n._meshOptData)return await n._meshOptData;const a=t.Get(`${s}/buffer`,this._loader.gltf.buffers,r.buffer);return n._meshOptData=this._loader.loadBufferAsync(`/buffers/${a.index}`,a,r.byteOffset||0,r.byteLength).then(async e=>await i.Default.decodeGltfBufferAsync(e,r.count,r.byteStride,r.mode,r.filter)),await n._meshOptData})}}let u=!1;function c(){u||(u=!0,o(d),r(d,!0,e=>new l(e)))}c();export{l as EXT_meshopt_compression,c as RegisterEXT_meshopt_compression};
//# sourceMappingURL=EXT_meshopt_compression-Chl9-hef.esm.min.js.map