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.

67 lines (63 loc) 2.61 kB
import { b as GLTFLoader } 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 = "MSFT_sRGBFactors"; /** @internal */ // eslint-disable-next-line @typescript-eslint/naming-convention class MSFT_sRGBFactors { /** @internal */ constructor(loader) { /** @internal */ this.name = NAME; this._loader = loader; this.enabled = this._loader.isExtensionUsed(NAME); } /** @internal */ dispose() { this._loader = null; } /** @internal*/ // eslint-disable-next-line no-restricted-syntax loadMaterialPropertiesAsync(context, material, babylonMaterial) { return GLTFLoader.LoadExtraAsync(context, material, this.name, async (extraContext, extra) => { if (extra) { const adapter = this._loader._getOrCreateMaterialAdapter(babylonMaterial); const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial); const useExactSrgbConversions = babylonMaterial.getScene().getEngine().useExactSrgbConversions; if (!adapter.baseColorTexture) { adapter.baseColor.toLinearSpaceToRef(adapter.baseColor, useExactSrgbConversions); } if (!adapter.specularColorTexture) { adapter.specularColor.toLinearSpaceToRef(adapter.specularColor, useExactSrgbConversions); } return await promise; } }); } } let _Registered = false; /** * Registers the MSFT_sRGBFactors glTF loader extension. * Safe to call multiple times; only the first call has an effect. */ // eslint-disable-next-line @typescript-eslint/naming-convention function RegisterMSFT_sRGBFactors() { if (_Registered) { return; } _Registered = true; unregisterGLTFExtension(NAME); registerGLTFExtension(NAME, true, (loader) => new MSFT_sRGBFactors(loader)); } /** * Re-exports the pure implementation and applies the runtime registration side effect. * Import "./MSFT_sRGBFactors.pure" for tree-shakeable, side-effect-free usage. */ RegisterMSFT_sRGBFactors(); export { MSFT_sRGBFactors, RegisterMSFT_sRGBFactors }; //# sourceMappingURL=MSFT_sRGBFactors-vfVMGQAy.esm.js.map