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.

50 lines (47 loc) 2.12 kB
import { bM as PBRMaterial, bJ as unregisterGLTFExtension, bI as registerGLTFExtension } from './index-FzOfPXLV.esm.js'; import { GLTFLoader } from './glTFLoader-VVyk3AwX.esm.js'; import './bone--mL3H5cQ.esm.js'; import './skeleton-B7-ffRm_.esm.js'; import './rawTexture-B2DimmQ5.esm.js'; import './assetContainer-8JZnoDWQ.esm.js'; import './objectModelMapping-CJnQ6at_.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) { if (!(babylonMaterial instanceof PBRMaterial)) { throw new Error(`${extraContext}: Material type not supported`); } const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial); const useExactSrgbConversions = babylonMaterial.getScene().getEngine().useExactSrgbConversions; if (!babylonMaterial.albedoTexture) { babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor, useExactSrgbConversions); } if (!babylonMaterial.reflectivityTexture) { babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor, useExactSrgbConversions); } return await promise; } }); } } unregisterGLTFExtension(NAME); registerGLTFExtension(NAME, true, (loader) => new MSFT_sRGBFactors(loader)); export { MSFT_sRGBFactors }; //# sourceMappingURL=MSFT_sRGBFactors-14kFztVi.esm.js.map