1 | import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial";
|
2 | import { GLTFLoader } from "../glTFLoader";
|
3 | var NAME = "MSFT_sRGBFactors";
|
4 |
|
5 | var MSFT_sRGBFactors = (function () {
|
6 | function MSFT_sRGBFactors(loader) {
|
7 | this.name = NAME;
|
8 | this.enabled = true;
|
9 | this._loader = loader;
|
10 | }
|
11 | MSFT_sRGBFactors.prototype.dispose = function () {
|
12 | delete this._loader;
|
13 | };
|
14 | MSFT_sRGBFactors.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
15 | var _this = this;
|
16 | return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) {
|
17 | if (extra) {
|
18 | if (!(babylonMaterial instanceof PBRMaterial)) {
|
19 | throw new Error(extraContext + ": Material type not supported");
|
20 | }
|
21 | var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);
|
22 | if (!babylonMaterial.albedoTexture) {
|
23 | babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor);
|
24 | }
|
25 | if (!babylonMaterial.reflectivityTexture) {
|
26 | babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor);
|
27 | }
|
28 | return promise;
|
29 | }
|
30 | return null;
|
31 | });
|
32 | };
|
33 | return MSFT_sRGBFactors;
|
34 | }());
|
35 | export { MSFT_sRGBFactors };
|
36 | GLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_sRGBFactors(loader); });
|
37 |
|
\ | No newline at end of file |