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.

66 lines (62 loc) 2.62 kB
import { b as GLTFLoader, A as ArrayItem } from './glTFLoader.pure-BaIedO7s.esm.js'; import { bo as unregisterGLTFExtension, bp as registerGLTFExtension } from './index-MZPybX0H.esm.js'; import './morphTargetManager-CK7B3gaT.esm.js'; import './bone.pure-CjsCww39.esm.js'; import './skeleton-D7Sw58cv.esm.js'; import './assetContainer-Bm0vsreJ.esm.js'; import './objectModelMapping-De5EKNEZ.esm.js'; import './spotLight.pure-CRdZC6Ci.esm.js'; const NAME = "KHR_texture_basisu"; /** * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_texture_basisu/README.md) */ // eslint-disable-next-line @typescript-eslint/naming-convention class KHR_texture_basisu { /** * @internal */ constructor(loader) { /** The name of this extension. */ this.name = NAME; this._loader = loader; this.enabled = loader.isExtensionUsed(NAME); } /** @internal */ dispose() { this._loader = null; } /** * @internal */ // eslint-disable-next-line no-restricted-syntax _loadTextureAsync(context, texture, assign) { return GLTFLoader.LoadExtensionAsync(context, texture, this.name, async (extensionContext, extension) => { const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._loader.gltf.samplers, texture.sampler); const image = ArrayItem.Get(`${extensionContext}/source`, this._loader.gltf.images, extension.source); return await this._loader._createTextureAsync(context, sampler, image, (babylonTexture) => { assign(babylonTexture); }, texture._textureInfo.nonColorData ? { useRGBAIfASTCBC7NotAvailableWhenUASTC: true } : undefined, !texture._textureInfo.nonColorData); }); } } let _Registered = false; /** * Registers the KHR_texture_basisu glTF loader extension. * Safe to call multiple times; only the first call has an effect. */ // eslint-disable-next-line @typescript-eslint/naming-convention function RegisterKHR_texture_basisu() { if (_Registered) { return; } _Registered = true; unregisterGLTFExtension(NAME); registerGLTFExtension(NAME, true, (loader) => new KHR_texture_basisu(loader)); } /** * Re-exports the pure implementation and applies the runtime registration side effect. * Import "./KHR_texture_basisu.pure" for tree-shakeable, side-effect-free usage. */ RegisterKHR_texture_basisu(); export { KHR_texture_basisu, RegisterKHR_texture_basisu }; //# sourceMappingURL=KHR_texture_basisu-Cx4X85HU.esm.js.map