@babylonjs/serializers 5.0.0-alpha.9 → 5.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/OBJ/index.js +1 -1
  2. package/OBJ/objSerializer.js +19 -12
  3. package/OBJ/objSerializer.js.map +1 -1
  4. package/glTF/2.0/Extensions/KHR_lights_punctual.js +8 -8
  5. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  6. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +24 -0
  7. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +91 -0
  8. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -0
  9. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +6 -11
  10. package/glTF/2.0/Extensions/KHR_materials_sheen.js +13 -37
  11. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  12. package/glTF/2.0/Extensions/KHR_materials_unlit.js +3 -3
  13. package/glTF/2.0/Extensions/KHR_texture_transform.js +4 -4
  14. package/glTF/2.0/Extensions/index.d.ts +1 -0
  15. package/glTF/2.0/Extensions/index.js +5 -4
  16. package/glTF/2.0/Extensions/index.js.map +1 -1
  17. package/glTF/2.0/glTFAnimation.js +10 -9
  18. package/glTF/2.0/glTFAnimation.js.map +1 -1
  19. package/glTF/2.0/glTFData.js +1 -1
  20. package/glTF/2.0/glTFData.js.map +1 -1
  21. package/glTF/2.0/glTFExporter.d.ts +7 -0
  22. package/glTF/2.0/glTFExporter.js +133 -97
  23. package/glTF/2.0/glTFExporter.js.map +1 -1
  24. package/glTF/2.0/glTFExporterExtension.js.map +1 -1
  25. package/glTF/2.0/glTFMaterialExporter.d.ts +8 -6
  26. package/glTF/2.0/glTFMaterialExporter.js +67 -48
  27. package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
  28. package/glTF/2.0/glTFSerializer.d.ts +4 -0
  29. package/glTF/2.0/glTFSerializer.js +1 -1
  30. package/glTF/2.0/glTFSerializer.js.map +1 -1
  31. package/glTF/2.0/glTFUtilities.d.ts +1 -2
  32. package/glTF/2.0/glTFUtilities.js +1 -5
  33. package/glTF/2.0/glTFUtilities.js.map +1 -1
  34. package/glTF/2.0/index.d.ts +1 -1
  35. package/glTF/2.0/index.js +8 -8
  36. package/glTF/2.0/index.js.map +1 -1
  37. package/glTF/2.0/shaders/textureTransform.fragment.js +3 -3
  38. package/glTF/2.0/shaders/textureTransform.fragment.js.map +1 -1
  39. package/glTF/index.d.ts +1 -1
  40. package/glTF/index.js +2 -2
  41. package/glTF/index.js.map +1 -1
  42. package/index.d.ts +3 -3
  43. package/index.js +3 -3
  44. package/index.js.map +1 -1
  45. package/legacy/legacy-glTF2Serializer.d.ts +1 -1
  46. package/legacy/legacy-glTF2Serializer.js +7 -7
  47. package/legacy/legacy-glTF2Serializer.js.map +1 -1
  48. package/legacy/legacy-objSerializer.d.ts +1 -1
  49. package/legacy/legacy-objSerializer.js +2 -2
  50. package/legacy/legacy-objSerializer.js.map +1 -1
  51. package/legacy/legacy-stlSerializer.d.ts +1 -1
  52. package/legacy/legacy-stlSerializer.js +2 -2
  53. package/legacy/legacy-stlSerializer.js.map +1 -1
  54. package/legacy/legacy.js +4 -4
  55. package/package.json +7 -4
  56. package/stl/index.js +1 -1
  57. package/stl/stlSerializer.js +2 -2
  58. package/stl/stlSerializer.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"glTFExporterExtension.js","sourceRoot":"","sources":["../../../../sourceES6/serializers/src/glTF/2.0/glTFExporterExtension.ts"],"names":[],"mappings":"AAaA,cAAc;AACd,MAAM,CAAC,IAAI,0BAA0B,GAAG,CAAC,CAAC,CAAC,uCAAuC","sourcesContent":["import { ImageMimeType, IMeshPrimitive, INode, IMaterial, ITextureInfo } from \"babylonjs-gltf2interface\";\r\nimport { Node } from \"@babylonjs/core/node\";\r\nimport { Nullable } from \"@babylonjs/core/types\";\r\n\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { SubMesh } from \"@babylonjs/core/Meshes/subMesh\";\r\nimport { IDisposable } from \"@babylonjs/core/scene\";\r\n\r\nimport { _BinaryWriter } from \"./glTFExporter\";\r\nimport { IGLTFExporterExtension } from \"../glTFFileExporter\";\r\nimport { Material } from '@babylonjs/core/Materials/material';\r\nimport { BaseTexture } from '@babylonjs/core/Materials/Textures/baseTexture';\r\n\r\n/** @hidden */\r\nexport var __IGLTFExporterExtensionV2 = 0; // I am here to allow dts to be created\r\n\r\n/**\r\n * Interface for a glTF exporter extension\r\n * @hidden\r\n */\r\nexport interface IGLTFExporterExtensionV2 extends IGLTFExporterExtension, IDisposable {\r\n /**\r\n * Define this method to modify the default behavior before exporting a texture\r\n * @param context The context when loading the asset\r\n * @param babylonTexture The Babylon.js texture\r\n * @param mimeType The mime-type of the generated image\r\n * @returns A promise that resolves with the exported texture\r\n */\r\n preExportTextureAsync?(context: string, babylonTexture: Nullable<Texture>, mimeType: ImageMimeType): Promise<Texture>;\r\n\r\n /**\r\n * Define this method to get notified when a texture info is created\r\n * @param context The context when loading the asset\r\n * @param textureInfo The glTF texture info\r\n * @param babylonTexture The Babylon.js texture\r\n */\r\n postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;\r\n\r\n /**\r\n * Define this method to modify the default behavior when exporting texture info\r\n * @param context The context when loading the asset\r\n * @param meshPrimitive glTF mesh primitive\r\n * @param babylonSubMesh Babylon submesh\r\n * @param binaryWriter glTF serializer binary writer instance\r\n * @returns nullable IMeshPrimitive promise\r\n */\r\n postExportMeshPrimitiveAsync?(context: string, meshPrimitive: Nullable<IMeshPrimitive>, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<IMeshPrimitive>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when exporting a node\r\n * @param context The context when exporting the node\r\n * @param node glTF node\r\n * @param babylonNode BabylonJS node\r\n * @returns nullable INode promise\r\n */\r\n postExportNodeAsync?(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap?: {[key: number]: number}): Promise<Nullable<INode>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when exporting a material\r\n * @param material glTF material\r\n * @param babylonMaterial BabylonJS material\r\n * @returns nullable IMaterial promise\r\n */\r\n postExportMaterialAsync?(context: string, node: Nullable<IMaterial>, babylonMaterial: Material): Promise<IMaterial>;\r\n\r\n /**\r\n * Define this method to return additional textures to export from a material\r\n * @param material glTF material\r\n * @param babylonMaterial BabylonJS material\r\n * @returns List of textures\r\n */\r\n postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];\r\n\r\n /** Gets a boolean indicating that this extension was used */\r\n wasUsed: boolean;\r\n\r\n /** Gets a boolean indicating that this extension is required for the file to work */\r\n required: boolean;\r\n\r\n /**\r\n * Called after the exporter state changes to EXPORTING\r\n */\r\n onExporting?(): void;\r\n}"]}
1
+ {"version":3,"file":"glTFExporterExtension.js","sourceRoot":"","sources":["../../../../sourceES6/serializers/src/glTF/2.0/glTFExporterExtension.ts"],"names":[],"mappings":"AAaA,cAAc;AACd,MAAM,CAAC,IAAI,0BAA0B,GAAG,CAAC,CAAC,CAAC,uCAAuC","sourcesContent":["import { ImageMimeType, IMeshPrimitive, INode, IMaterial, ITextureInfo } from \"babylonjs-gltf2interface\";\r\nimport { Node } from \"@babylonjs/core/node\";\r\nimport { Nullable } from \"@babylonjs/core/types\";\r\n\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { SubMesh } from \"@babylonjs/core/Meshes/subMesh\";\r\nimport { IDisposable } from \"@babylonjs/core/scene\";\r\n\r\nimport { _BinaryWriter } from \"./glTFExporter\";\r\nimport { IGLTFExporterExtension } from \"../glTFFileExporter\";\r\nimport { Material } from '@babylonjs/core/Materials/material';\r\nimport { BaseTexture } from '@babylonjs/core/Materials/Textures/baseTexture';\r\n\r\n/** @hidden */\r\nexport var __IGLTFExporterExtensionV2 = 0; // I am here to allow dts to be created\r\n\r\n/**\r\n * Interface for a glTF exporter extension\r\n * @hidden\r\n */\r\nexport interface IGLTFExporterExtensionV2 extends IGLTFExporterExtension, IDisposable {\r\n /**\r\n * Define this method to modify the default behavior before exporting a texture\r\n * @param context The context when loading the asset\r\n * @param babylonTexture The Babylon.js texture\r\n * @param mimeType The mime-type of the generated image\r\n * @returns A promise that resolves with the exported texture\r\n */\r\n preExportTextureAsync?(context: string, babylonTexture: Nullable<Texture>, mimeType: ImageMimeType): Promise<Texture>;\r\n\r\n /**\r\n * Define this method to get notified when a texture info is created\r\n * @param context The context when loading the asset\r\n * @param textureInfo The glTF texture info\r\n * @param babylonTexture The Babylon.js texture\r\n */\r\n postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;\r\n\r\n /**\r\n * Define this method to modify the default behavior when exporting texture info\r\n * @param context The context when loading the asset\r\n * @param meshPrimitive glTF mesh primitive\r\n * @param babylonSubMesh Babylon submesh\r\n * @param binaryWriter glTF serializer binary writer instance\r\n * @returns nullable IMeshPrimitive promise\r\n */\r\n postExportMeshPrimitiveAsync?(context: string, meshPrimitive: Nullable<IMeshPrimitive>, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<IMeshPrimitive>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when exporting a node\r\n * @param context The context when exporting the node\r\n * @param node glTF node\r\n * @param babylonNode BabylonJS node\r\n * @returns nullable INode promise\r\n */\r\n postExportNodeAsync?(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap?: { [key: number]: number }): Promise<Nullable<INode>>;\r\n\r\n /**\r\n * Define this method to modify the default behavior when exporting a material\r\n * @param material glTF material\r\n * @param babylonMaterial BabylonJS material\r\n * @returns nullable IMaterial promise\r\n */\r\n postExportMaterialAsync?(context: string, node: Nullable<IMaterial>, babylonMaterial: Material): Promise<IMaterial>;\r\n\r\n /**\r\n * Define this method to return additional textures to export from a material\r\n * @param material glTF material\r\n * @param babylonMaterial BabylonJS material\r\n * @returns List of textures\r\n */\r\n postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];\r\n\r\n /** Gets a boolean indicating that this extension was used */\r\n wasUsed: boolean;\r\n\r\n /** Gets a boolean indicating that this extension is required for the file to work */\r\n required: boolean;\r\n\r\n /**\r\n * Called after the exporter state changes to EXPORTING\r\n */\r\n onExporting?(): void;\r\n}"]}
@@ -1,11 +1,11 @@
1
1
  import { ITextureInfo, ImageMimeType, IMaterial, IMaterialPbrMetallicRoughness } from "babylonjs-gltf2interface";
2
2
  import { Nullable } from "@babylonjs/core/types";
3
3
  import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture";
4
- import { Material } from "@babylonjs/core/Materials/material";
5
- import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial";
6
- import { PBRBaseMaterial } from "@babylonjs/core/Materials/PBR/pbrBaseMaterial";
7
- import { PBRMetallicRoughnessMaterial } from "@babylonjs/core/Materials/PBR/pbrMetallicRoughnessMaterial";
8
4
  import { _Exporter } from "./glTFExporter";
5
+ declare type Material = import("@babylonjs/core/Materials/material").Material;
6
+ declare type StandardMaterial = import("@babylonjs/core/Materials/standardMaterial").StandardMaterial;
7
+ declare type PBRBaseMaterial = import("@babylonjs/core/Materials/PBR/pbrBaseMaterial").PBRBaseMaterial;
8
+ declare type PBRMetallicRoughnessMaterial = import("@babylonjs/core/Materials/PBR/pbrMetallicRoughnessMaterial").PBRMetallicRoughnessMaterial;
9
9
  /**
10
10
  * Utility methods for working with glTF material conversion properties. This class should only be used internally
11
11
  * @hidden
@@ -45,11 +45,11 @@ export declare class _GLTFMaterialExporter {
45
45
  * @param mimeType texture mime type
46
46
  * @param images array of images
47
47
  * @param textures array of textures
48
- * @param materials array of materials
48
+ * @param materials set of materials
49
49
  * @param imageData mapping of texture names to base64 textures
50
50
  * @param hasTextureCoords specifies if texture coordinates are present on the material
51
51
  */
52
- _convertMaterialsToGLTFAsync(babylonMaterials: Material[], mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<void>;
52
+ _convertMaterialsToGLTFAsync(exportMaterials: Set<Material>, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<void>;
53
53
  /**
54
54
  * Makes a copy of the glTF material without the texture parameters
55
55
  * @param originalMaterial original glTF material
@@ -62,6 +62,7 @@ export declare class _GLTFMaterialExporter {
62
62
  * @returns boolean specifying if texture parameters are present
63
63
  */
64
64
  _hasTexturesPresent(material: IMaterial): boolean;
65
+ _getTextureInfo(babylonTexture: Nullable<BaseTexture>): Nullable<ITextureInfo>;
65
66
  /**
66
67
  * Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material
67
68
  * @param babylonStandardMaterial
@@ -226,3 +227,4 @@ export declare class _GLTFMaterialExporter {
226
227
  */
227
228
  private _getTextureInfoFromBase64;
228
229
  }
230
+ export {};
@@ -1,14 +1,12 @@
1
1
  import { __awaiter, __generator } from "tslib";
2
- import { Vector2 } from "@babylonjs/core/Maths/math.vector";
3
- import { Color3 } from "@babylonjs/core/Maths/math.color";
4
- import { Scalar } from "@babylonjs/core/Maths/math.scalar";
5
- import { Tools } from "@babylonjs/core/Misc/tools";
6
- import { TextureTools } from "@babylonjs/core/Misc/textureTools";
7
- import { Texture } from "@babylonjs/core/Materials/Textures/texture";
8
- import { RawTexture } from "@babylonjs/core/Materials/Textures/rawTexture";
9
- import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial";
10
- import { PBRBaseMaterial } from "@babylonjs/core/Materials/PBR/pbrBaseMaterial";
11
- import { Constants } from '@babylonjs/core/Engines/constants';
2
+ import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
3
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
4
+ import { Scalar } from "@babylonjs/core/Maths/math.scalar.js";
5
+ import { Tools } from "@babylonjs/core/Misc/tools.js";
6
+ import { TextureTools } from "@babylonjs/core/Misc/textureTools.js";
7
+ import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
8
+ import { RawTexture } from "@babylonjs/core/Materials/Textures/rawTexture.js";
9
+ import { Constants } from '@babylonjs/core/Engines/constants.js';
12
10
  /**
13
11
  * Utility methods for working with glTF material conversion properties. This class should only be used internally
14
12
  * @hidden
@@ -39,24 +37,24 @@ var _GLTFMaterialExporter = /** @class */ (function () {
39
37
  * @param mimeType texture mime type
40
38
  * @param images array of images
41
39
  * @param textures array of textures
42
- * @param materials array of materials
40
+ * @param materials set of materials
43
41
  * @param imageData mapping of texture names to base64 textures
44
42
  * @param hasTextureCoords specifies if texture coordinates are present on the material
45
43
  */
46
- _GLTFMaterialExporter.prototype._convertMaterialsToGLTFAsync = function (babylonMaterials, mimeType, hasTextureCoords) {
44
+ _GLTFMaterialExporter.prototype._convertMaterialsToGLTFAsync = function (exportMaterials, mimeType, hasTextureCoords) {
45
+ var _this = this;
47
46
  var promises = [];
48
- for (var _i = 0, babylonMaterials_1 = babylonMaterials; _i < babylonMaterials_1.length; _i++) {
49
- var babylonMaterial = babylonMaterials_1[_i];
50
- if (babylonMaterial instanceof StandardMaterial) {
51
- promises.push(this._convertStandardMaterialAsync(babylonMaterial, mimeType, hasTextureCoords));
47
+ exportMaterials.forEach(function (material) {
48
+ if (material.getClassName() === "StandardMaterial") {
49
+ promises.push(_this._convertStandardMaterialAsync(material, mimeType, hasTextureCoords));
52
50
  }
53
- else if (babylonMaterial instanceof PBRBaseMaterial) {
54
- promises.push(this._convertPBRMaterialAsync(babylonMaterial, mimeType, hasTextureCoords));
51
+ else if (material.getClassName().indexOf("PBR") !== -1) {
52
+ promises.push(_this._convertPBRMaterialAsync(material, mimeType, hasTextureCoords));
55
53
  }
56
54
  else {
57
- Tools.Warn("Unsupported material type: " + babylonMaterial.name);
55
+ Tools.Warn("Unsupported material type: " + material.name);
58
56
  }
59
- }
57
+ });
60
58
  return Promise.all(promises).then(function () { });
61
59
  };
62
60
  /**
@@ -88,6 +86,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
88
86
  * @returns boolean specifying if texture parameters are present
89
87
  */
90
88
  _GLTFMaterialExporter.prototype._hasTexturesPresent = function (material) {
89
+ var _a;
91
90
  if (material.emissiveTexture || material.normalTexture || material.occlusionTexture) {
92
91
  return true;
93
92
  }
@@ -97,8 +96,25 @@ var _GLTFMaterialExporter = /** @class */ (function () {
97
96
  return true;
98
97
  }
99
98
  }
99
+ if (material.extensions) {
100
+ for (var extension in material.extensions) {
101
+ var extensionObject = material.extensions[extension];
102
+ if (extensionObject) {
103
+ return (_a = extensionObject.hasTextures) === null || _a === void 0 ? void 0 : _a.call(extensionObject);
104
+ }
105
+ }
106
+ }
100
107
  return false;
101
108
  };
109
+ _GLTFMaterialExporter.prototype._getTextureInfo = function (babylonTexture) {
110
+ if (babylonTexture) {
111
+ var textureUid = babylonTexture.uid;
112
+ if (textureUid in this._textureMap) {
113
+ return this._textureMap[textureUid];
114
+ }
115
+ }
116
+ return null;
117
+ };
102
118
  /**
103
119
  * Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material
104
120
  * @param babylonStandardMaterial
@@ -485,10 +501,11 @@ var _GLTFMaterialExporter = /** @class */ (function () {
485
501
  * @returns pbr metallic roughness interface or null
486
502
  */
487
503
  _GLTFMaterialExporter.prototype._convertSpecularGlossinessTexturesToMetallicRoughnessAsync = function (diffuseTexture, specularGlossinessTexture, factors, mimeType) {
504
+ var _a;
488
505
  return __awaiter(this, void 0, void 0, function () {
489
506
  var promises, scene, resizedTextures, diffuseSize, diffuseBuffer, specularGlossinessBuffer, width, height, diffusePixels, specularPixels, byteLength, metallicRoughnessBuffer, baseColorBuffer, strideSize, maxBaseColor, maxMetallic, maxRoughness, h, w, offset, diffuseColor, specularColor, glossiness, specularGlossiness, metallicRoughness, metallicRoughnessFactors_1, writeOutMetallicRoughnessTexture, writeOutBaseColorTexture, h, w, destinationOffset, linearBaseColorPixel, sRGBBaseColorPixel, metallicRoughnessPixel, promise, promise;
490
- return __generator(this, function (_a) {
491
- switch (_a.label) {
507
+ return __generator(this, function (_b) {
508
+ switch (_b.label) {
492
509
  case 0:
493
510
  promises = [];
494
511
  if (!(diffuseTexture || specularGlossinessTexture)) {
@@ -497,17 +514,17 @@ var _GLTFMaterialExporter = /** @class */ (function () {
497
514
  scene = diffuseTexture ? diffuseTexture.getScene() : specularGlossinessTexture ? specularGlossinessTexture.getScene() : null;
498
515
  if (!scene) return [3 /*break*/, 3];
499
516
  resizedTextures = this._resizeTexturesToSameDimensions(diffuseTexture, specularGlossinessTexture, scene);
500
- diffuseSize = resizedTextures.texture1.getSize();
517
+ diffuseSize = (_a = resizedTextures.texture1) === null || _a === void 0 ? void 0 : _a.getSize();
501
518
  diffuseBuffer = void 0;
502
519
  specularGlossinessBuffer = void 0;
503
520
  width = diffuseSize.width;
504
521
  height = diffuseSize.height;
505
522
  return [4 /*yield*/, resizedTextures.texture1.readPixels()];
506
523
  case 1:
507
- diffusePixels = _a.sent();
524
+ diffusePixels = _b.sent();
508
525
  return [4 /*yield*/, resizedTextures.texture2.readPixels()];
509
526
  case 2:
510
- specularPixels = _a.sent();
527
+ specularPixels = _b.sent();
511
528
  if (diffusePixels) {
512
529
  diffuseBuffer = this._convertPixelArrayToFloat32(diffusePixels);
513
530
  }
@@ -659,24 +676,24 @@ var _GLTFMaterialExporter = /** @class */ (function () {
659
676
  */
660
677
  _GLTFMaterialExporter.prototype._convertMetalRoughFactorsToMetallicRoughnessAsync = function (babylonPBRMaterial, mimeType, glTFPbrMetallicRoughness, hasTextureCoords) {
661
678
  var promises = [];
662
- var baseColor = babylonPBRMaterial.albedoColor || babylonPBRMaterial.baseColor;
663
- var metallic = babylonPBRMaterial.metallic || babylonPBRMaterial.metallic;
664
- var roughness = babylonPBRMaterial.roughness || babylonPBRMaterial.roughness;
679
+ var baseColor = babylonPBRMaterial._albedoColor;
680
+ var metallic = babylonPBRMaterial._metallic;
681
+ var roughness = babylonPBRMaterial._roughness;
665
682
  var metallicRoughness = {
666
683
  baseColor: baseColor,
667
684
  metallic: metallic,
668
685
  roughness: roughness
669
686
  };
670
687
  if (hasTextureCoords) {
671
- var albedoTexture = babylonPBRMaterial.albedoTexture || babylonPBRMaterial.baseTexture;
688
+ var albedoTexture = babylonPBRMaterial._albedoTexture;
672
689
  if (albedoTexture) {
673
- promises.push(this._exportTextureAsync(babylonPBRMaterial.albedoTexture, mimeType).then(function (glTFTexture) {
690
+ promises.push(this._exportTextureAsync(babylonPBRMaterial._albedoTexture, mimeType).then(function (glTFTexture) {
674
691
  if (glTFTexture) {
675
692
  glTFPbrMetallicRoughness.baseColorTexture = glTFTexture;
676
693
  }
677
694
  }));
678
695
  }
679
- var metallicTexture = babylonPBRMaterial.metallicTexture || babylonPBRMaterial.metallicRoughnessTexture;
696
+ var metallicTexture = babylonPBRMaterial._metallicTexture;
680
697
  if (metallicTexture) {
681
698
  promises.push(this._exportTextureAsync(metallicTexture, mimeType).then(function (glTFTexture) {
682
699
  if (glTFTexture) {
@@ -799,23 +816,25 @@ var _GLTFMaterialExporter = /** @class */ (function () {
799
816
  return Promise.resolve().then(function () {
800
817
  var samplers = _this._exporter._samplers;
801
818
  var textures = _this._exporter._textures;
802
- var diffuseColor = babylonPBRMaterial.albedoColor || babylonPBRMaterial.diffuseColor || Color3.White();
803
- var specularColor = babylonPBRMaterial.reflectivityColor || babylonPBRMaterial.specularColor || Color3.White();
804
- var glossiness = babylonPBRMaterial.microSurface || babylonPBRMaterial.glossiness || 1;
819
+ var diffuseColor = babylonPBRMaterial._albedoColor;
820
+ var specularColor = babylonPBRMaterial._reflectivityColor;
821
+ var glossiness = babylonPBRMaterial._microSurface;
805
822
  var specGloss = {
806
823
  diffuseColor: diffuseColor,
807
824
  specularColor: specularColor,
808
825
  glossiness: glossiness,
809
826
  };
810
827
  var samplerIndex = null;
811
- var albedoTexture = babylonPBRMaterial.albedoTexture || babylonPBRMaterial.diffuseTexture;
812
- var reflectivityTexture = babylonPBRMaterial.reflectivityTexture || babylonPBRMaterial.specularGlossinessTexture;
813
- var sampler = _this._getGLTFTextureSampler(albedoTexture);
814
- if (sampler.magFilter != null && sampler.minFilter != null && sampler.wrapS != null && sampler.wrapT != null) {
815
- samplers.push(sampler);
816
- samplerIndex = samplers.length - 1;
828
+ var albedoTexture = babylonPBRMaterial._albedoTexture;
829
+ var reflectivityTexture = babylonPBRMaterial._reflectivityTexture;
830
+ if (albedoTexture) {
831
+ var sampler = _this._getGLTFTextureSampler(albedoTexture);
832
+ if (sampler.magFilter != null && sampler.minFilter != null && sampler.wrapS != null && sampler.wrapT != null) {
833
+ samplers.push(sampler);
834
+ samplerIndex = samplers.length - 1;
835
+ }
817
836
  }
818
- var useMicrosurfaceFromReflectivityMapAlpha = babylonPBRMaterial.useMicroSurfaceFromReflectivityMapAlpha || babylonPBRMaterial.useMicroSurfaceFromReflectivityMapAlpha;
837
+ var useMicrosurfaceFromReflectivityMapAlpha = babylonPBRMaterial._useMicroSurfaceFromReflectivityMapAlpha;
819
838
  if (reflectivityTexture && !useMicrosurfaceFromReflectivityMapAlpha) {
820
839
  return Promise.reject("_ConvertPBRMaterial: Glossiness values not included in the reflectivity texture are currently not supported");
821
840
  }
@@ -859,7 +878,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
859
878
  };
860
879
  var useMetallicRoughness = babylonPBRMaterial.isMetallicWorkflow();
861
880
  if (useMetallicRoughness) {
862
- var albedoColor = babylonPBRMaterial.albedoColor || babylonPBRMaterial.diffuseColor || babylonPBRMaterial.baseColor;
881
+ var albedoColor = babylonPBRMaterial._albedoColor;
863
882
  var alpha = babylonPBRMaterial.alpha;
864
883
  if (albedoColor) {
865
884
  glTFPbrMetallicRoughness.baseColorFactor = [
@@ -900,13 +919,13 @@ var _GLTFMaterialExporter = /** @class */ (function () {
900
919
  glTFPbrMetallicRoughness.roughnessFactor = metallicRoughness.roughness;
901
920
  }
902
921
  if (babylonPBRMaterial.backFaceCulling != null && !babylonPBRMaterial.backFaceCulling) {
903
- if (!(babylonPBRMaterial.twoSidedLighting || babylonPBRMaterial.doubleSided)) {
922
+ if (!babylonPBRMaterial._twoSidedLighting) {
904
923
  Tools.Warn(babylonPBRMaterial.name + ": Back-face culling enabled and two-sided lighting disabled is not supported in glTF.");
905
924
  }
906
925
  glTFMaterial.doubleSided = true;
907
926
  }
908
927
  if (hasTextureCoords) {
909
- var bumpTexture_1 = babylonPBRMaterial.bumpTexture || babylonPBRMaterial.normalTexture;
928
+ var bumpTexture_1 = babylonPBRMaterial._bumpTexture;
910
929
  if (bumpTexture_1) {
911
930
  var promise = this._exportTextureAsync(bumpTexture_1, mimeType).then(function (glTFTexture) {
912
931
  if (glTFTexture) {
@@ -918,7 +937,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
918
937
  });
919
938
  promises.push(promise);
920
939
  }
921
- var ambientTexture = babylonPBRMaterial.ambientTexture || babylonPBRMaterial.occlusionTexture;
940
+ var ambientTexture = babylonPBRMaterial._ambientTexture;
922
941
  if (ambientTexture) {
923
942
  var promise = this._exportTextureAsync(ambientTexture, mimeType).then(function (glTFTexture) {
924
943
  if (glTFTexture) {
@@ -927,7 +946,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
927
946
  texCoord: glTFTexture.texCoord
928
947
  };
929
948
  glTFMaterial.occlusionTexture = occlusionTexture;
930
- var ambientTextureStrength = babylonPBRMaterial.ambientTextureStrength || babylonPBRMaterial.occlusionStrength;
949
+ var ambientTextureStrength = babylonPBRMaterial._ambientTextureStrength;
931
950
  if (ambientTextureStrength) {
932
951
  occlusionTexture.strength = ambientTextureStrength;
933
952
  }
@@ -935,7 +954,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
935
954
  });
936
955
  promises.push(promise);
937
956
  }
938
- var emissiveTexture = babylonPBRMaterial.emissiveTexture || babylonPBRMaterial.emissiveTexture;
957
+ var emissiveTexture = babylonPBRMaterial._emissiveTexture;
939
958
  if (emissiveTexture) {
940
959
  var promise = this._exportTextureAsync(emissiveTexture, mimeType).then(function (glTFTexture) {
941
960
  if (glTFTexture) {
@@ -945,7 +964,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
945
964
  promises.push(promise);
946
965
  }
947
966
  }
948
- var emissiveColor = babylonPBRMaterial.emissiveColor || babylonPBRMaterial.emissiveColor;
967
+ var emissiveColor = babylonPBRMaterial._emissiveColor;
949
968
  if (!_GLTFMaterialExporter.FuzzyEquals(emissiveColor, Color3.Black(), _GLTFMaterialExporter._Epsilon)) {
950
969
  glTFMaterial.emissiveFactor = emissiveColor.asArray();
951
970
  }