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.

60 lines (57 loc) 2.29 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 = "KHR_materials_emissive_strength"; /** * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md) */ // eslint-disable-next-line @typescript-eslint/naming-convention class KHR_materials_emissive_strength { /** * @internal */ constructor(loader) { /** * The name of this extension. */ this.name = NAME; /** * Defines a number that determines the order the extensions are applied. */ this.order = 170; 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.LoadExtensionAsync(context, material, this.name, async (extensionContext, extension) => { // eslint-disable-next-line github/no-then return await this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial).then(() => { this._loadEmissiveProperties(extensionContext, extension, babylonMaterial); }); }); } _loadEmissiveProperties(context, properties, babylonMaterial) { if (!(babylonMaterial instanceof PBRMaterial)) { throw new Error(`${context}: Material type not supported`); } if (properties.emissiveStrength !== undefined) { babylonMaterial.emissiveIntensity = properties.emissiveStrength; } } } unregisterGLTFExtension(NAME); registerGLTFExtension(NAME, true, (loader) => new KHR_materials_emissive_strength(loader)); export { KHR_materials_emissive_strength }; //# sourceMappingURL=KHR_materials_emissive_strength-C92VqWh3.esm.js.map