UNPKG

@babylonjs/loaders

Version:

The Babylon.js file loaders library is an extension you can use to load different 3D file types into a Babylon scene.

37 lines 1.67 kB
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial"; import { GLTFLoader } from "../glTFLoader"; var NAME = "MSFT_sRGBFactors"; /** @hidden */ var MSFT_sRGBFactors = /** @class */ (function () { function MSFT_sRGBFactors(loader) { this.name = NAME; this.enabled = true; this._loader = loader; } MSFT_sRGBFactors.prototype.dispose = function () { delete this._loader; }; MSFT_sRGBFactors.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) { var _this = this; return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) { if (extra) { if (!(babylonMaterial instanceof PBRMaterial)) { throw new Error(extraContext + ": Material type not supported"); } var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial); if (!babylonMaterial.albedoTexture) { babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor); } if (!babylonMaterial.reflectivityTexture) { babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor); } return promise; } return null; }); }; return MSFT_sRGBFactors; }()); export { MSFT_sRGBFactors }; GLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_sRGBFactors(loader); }); //# sourceMappingURL=MSFT_sRGBFactors.js.map