@babylonjs/serializers 7.37.1 → 7.37.2

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 (70) hide show
  1. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +6 -7
  2. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +18 -12
  3. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
  4. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +5 -6
  5. package/glTF/2.0/Extensions/KHR_lights_punctual.js +99 -109
  6. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  7. package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +2 -2
  8. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +6 -6
  9. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
  10. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +2 -2
  11. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +9 -9
  12. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  13. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.d.ts +2 -2
  14. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +7 -7
  15. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
  16. package/glTF/2.0/Extensions/KHR_materials_dispersion.js +2 -2
  17. package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
  18. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +2 -2
  19. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
  20. package/glTF/2.0/Extensions/KHR_materials_ior.js +2 -2
  21. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  22. package/glTF/2.0/Extensions/KHR_materials_iridescence.d.ts +2 -2
  23. package/glTF/2.0/Extensions/KHR_materials_iridescence.js +7 -7
  24. package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
  25. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +2 -2
  26. package/glTF/2.0/Extensions/KHR_materials_sheen.js +8 -8
  27. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  28. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +2 -2
  29. package/glTF/2.0/Extensions/KHR_materials_specular.js +7 -7
  30. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  31. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +2 -2
  32. package/glTF/2.0/Extensions/KHR_materials_transmission.js +6 -6
  33. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  34. package/glTF/2.0/Extensions/KHR_materials_unlit.js +2 -2
  35. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  36. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +2 -2
  37. package/glTF/2.0/Extensions/KHR_materials_volume.js +6 -6
  38. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
  39. package/glTF/2.0/Extensions/KHR_texture_transform.js +2 -2
  40. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
  41. package/glTF/2.0/Extensions/index.d.ts +9 -9
  42. package/glTF/2.0/Extensions/index.js +9 -9
  43. package/glTF/2.0/Extensions/index.js.map +1 -1
  44. package/glTF/2.0/dataWriter.d.ts +18 -0
  45. package/glTF/2.0/dataWriter.js +65 -0
  46. package/glTF/2.0/dataWriter.js.map +1 -0
  47. package/glTF/2.0/glTFAnimation.d.ts +4 -10
  48. package/glTF/2.0/glTFAnimation.js +87 -19
  49. package/glTF/2.0/glTFAnimation.js.map +1 -1
  50. package/glTF/2.0/glTFData.d.ts +5 -3
  51. package/glTF/2.0/glTFData.js +35 -36
  52. package/glTF/2.0/glTFData.js.map +1 -1
  53. package/glTF/2.0/glTFExporter.d.ts +62 -363
  54. package/glTF/2.0/glTFExporter.js +867 -1579
  55. package/glTF/2.0/glTFExporter.js.map +1 -1
  56. package/glTF/2.0/glTFExporterExtension.d.ts +8 -9
  57. package/glTF/2.0/glTFExporterExtension.js.map +1 -1
  58. package/glTF/2.0/glTFMaterialExporter.d.ts +26 -126
  59. package/glTF/2.0/glTFMaterialExporter.js +276 -438
  60. package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
  61. package/glTF/2.0/glTFMorphTargetsUtilities.d.ts +14 -0
  62. package/glTF/2.0/glTFMorphTargetsUtilities.js +105 -0
  63. package/glTF/2.0/glTFMorphTargetsUtilities.js.map +1 -0
  64. package/glTF/2.0/glTFSerializer.d.ts +10 -13
  65. package/glTF/2.0/glTFSerializer.js +25 -44
  66. package/glTF/2.0/glTFSerializer.js.map +1 -1
  67. package/glTF/2.0/glTFUtilities.d.ts +75 -43
  68. package/glTF/2.0/glTFUtilities.js +350 -103
  69. package/glTF/2.0/glTFUtilities.js.map +1 -1
  70. package/package.json +3 -3
@@ -4,10 +4,10 @@ import type { Nullable } from "@babylonjs/core/types.js";
4
4
  import type { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
5
5
  import type { SubMesh } from "@babylonjs/core/Meshes/subMesh.js";
6
6
  import type { IDisposable } from "@babylonjs/core/scene.js";
7
- import type { _BinaryWriter } from "./glTFExporter";
8
7
  import type { IGLTFExporterExtension } from "../glTFFileExporter";
9
8
  import type { Material } from "@babylonjs/core/Materials/material.js";
10
9
  import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
10
+ import type { DataWriter } from "./dataWriter";
11
11
  /** @internal */
12
12
  export declare var __IGLTFExporterExtensionV2: number;
13
13
  /**
@@ -22,7 +22,7 @@ export interface IGLTFExporterExtensionV2 extends IGLTFExporterExtension, IDispo
22
22
  * @param mimeType The mime-type of the generated image
23
23
  * @returns A promise that resolves with the exported texture
24
24
  */
25
- preExportTextureAsync?(context: string, babylonTexture: Nullable<Texture>, mimeType: ImageMimeType): Promise<Nullable<Texture>>;
25
+ preExportTextureAsync?(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Nullable<Texture>>;
26
26
  /**
27
27
  * Define this method to get notified when a texture info is created
28
28
  * @param context The context when loading the asset
@@ -31,31 +31,30 @@ export interface IGLTFExporterExtensionV2 extends IGLTFExporterExtension, IDispo
31
31
  */
32
32
  postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
33
33
  /**
34
- * Define this method to modify the default behavior when exporting texture info
34
+ * Define this method to modify the default behavior when exporting a mesh primitive
35
35
  * @param context The context when loading the asset
36
36
  * @param meshPrimitive glTF mesh primitive
37
37
  * @param babylonSubMesh Babylon submesh
38
- * @param binaryWriter glTF serializer binary writer instance
39
38
  * @returns nullable IMeshPrimitive promise
40
39
  */
41
- postExportMeshPrimitiveAsync?(context: string, meshPrimitive: Nullable<IMeshPrimitive>, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<IMeshPrimitive>;
40
+ postExportMeshPrimitiveAsync?(context: string, meshPrimitive: IMeshPrimitive, babylonSubMesh: SubMesh): Promise<IMeshPrimitive>;
42
41
  /**
43
42
  * Define this method to modify the default behavior when exporting a node
44
43
  * @param context The context when exporting the node
45
44
  * @param node glTF node
46
45
  * @param babylonNode BabylonJS node
46
+ * @param nodeMap Current node mapping of babylon node to glTF node index. Useful for combining nodes together.
47
+ * @param convertToRightHanded Flag indicating whether to convert values to right-handed
47
48
  * @returns nullable INode promise
48
49
  */
49
- postExportNodeAsync?(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap: {
50
- [key: number]: number;
51
- }, binaryWriter: _BinaryWriter): Promise<Nullable<INode>>;
50
+ postExportNodeAsync?(context: string, node: INode, babylonNode: Node, nodeMap: Map<Node, number>, convertToRightHanded: boolean, dataWriter: DataWriter): Promise<Nullable<INode>>;
52
51
  /**
53
52
  * Define this method to modify the default behavior when exporting a material
54
53
  * @param material glTF material
55
54
  * @param babylonMaterial BabylonJS material
56
55
  * @returns nullable IMaterial promise
57
56
  */
58
- postExportMaterialAsync?(context: string, node: Nullable<IMaterial>, babylonMaterial: Material): Promise<IMaterial>;
57
+ postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial>;
59
58
  /**
60
59
  * Define this method to return additional textures to export from a material
61
60
  * @param material glTF material
@@ -1 +1 @@
1
- {"version":3,"file":"glTFExporterExtension.js","sourceRoot":"","sources":["../../../../../dev/serializers/src/glTF/2.0/glTFExporterExtension.ts"],"names":[],"mappings":"AAaA,gBAAgB;AAChB,wEAAwE;AACxE,MAAM,CAAC,IAAI,0BAA0B,GAAG,CAAC,CAAC,CAAC,uCAAuC","sourcesContent":["import type { ImageMimeType, IMeshPrimitive, INode, IMaterial, ITextureInfo } from \"babylonjs-gltf2interface\";\r\nimport type { Node } from \"core/node\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { IDisposable } from \"core/scene\";\r\n\r\nimport type { _BinaryWriter } from \"./glTFExporter\";\r\nimport type { IGLTFExporterExtension } from \"../glTFFileExporter\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\n\r\n/** @internal */\r\n// eslint-disable-next-line no-var, @typescript-eslint/naming-convention\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 * @internal\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<Nullable<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 }, binaryWriter: _BinaryWriter): 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}\r\n"]}
1
+ {"version":3,"file":"glTFExporterExtension.js","sourceRoot":"","sources":["../../../../../dev/serializers/src/glTF/2.0/glTFExporterExtension.ts"],"names":[],"mappings":"AAaA,gBAAgB;AAChB,wEAAwE;AACxE,MAAM,CAAC,IAAI,0BAA0B,GAAG,CAAC,CAAC,CAAC,uCAAuC","sourcesContent":["import type { ImageMimeType, IMeshPrimitive, INode, IMaterial, ITextureInfo } from \"babylonjs-gltf2interface\";\r\nimport type { Node } from \"core/node\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { IDisposable } from \"core/scene\";\r\n\r\nimport type { IGLTFExporterExtension } from \"../glTFFileExporter\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { DataWriter } from \"./dataWriter\";\r\n\r\n/** @internal */\r\n// eslint-disable-next-line no-var, @typescript-eslint/naming-convention\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 * @internal\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: Texture, mimeType: ImageMimeType): Promise<Nullable<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 a mesh primitive\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 * @returns nullable IMeshPrimitive promise\r\n */\r\n postExportMeshPrimitiveAsync?(context: string, meshPrimitive: IMeshPrimitive, babylonSubMesh: SubMesh): 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 * @param nodeMap Current node mapping of babylon node to glTF node index. Useful for combining nodes together.\r\n * @param convertToRightHanded Flag indicating whether to convert values to right-handed\r\n * @returns nullable INode promise\r\n */\r\n postExportNodeAsync?(\r\n context: string,\r\n node: INode,\r\n babylonNode: Node,\r\n nodeMap: Map<Node, number>,\r\n convertToRightHanded: boolean,\r\n dataWriter: DataWriter\r\n ): 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: 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}\r\n"]}
@@ -1,113 +1,33 @@
1
- import type { ITextureInfo, IMaterial, IMaterialPbrMetallicRoughness } from "babylonjs-gltf2interface";
1
+ import type { ITextureInfo } from "babylonjs-gltf2interface";
2
2
  import { ImageMimeType } from "babylonjs-gltf2interface";
3
3
  import type { Nullable } from "@babylonjs/core/types.js";
4
4
  import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
5
- import type { _Exporter } from "./glTFExporter";
6
- import type { Material } from "@babylonjs/core/Materials/material.js";
5
+ import type { GLTFExporter } from "./glTFExporter";
7
6
  import type { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js";
8
7
  import type { PBRBaseMaterial } from "@babylonjs/core/Materials/PBR/pbrBaseMaterial.js";
9
8
  /**
10
- * Utility methods for working with glTF material conversion properties. This class should only be used internally
9
+ * Computes the metallic factor.
10
+ * @param diffuse diffused value
11
+ * @param specular specular value
12
+ * @param oneMinusSpecularStrength one minus the specular strength
13
+ * @returns metallic value
11
14
  * @internal
12
15
  */
13
- export declare class _GLTFMaterialExporter {
14
- /**
15
- * Represents the dielectric specular values for R, G and B
16
- */
17
- private static readonly _DielectricSpecular;
18
- /**
19
- * Allows the maximum specular power to be defined for material calculations
20
- */
21
- private static readonly _MaxSpecularPower;
22
- /**
23
- * Mapping to store textures
24
- */
16
+ export declare function _SolveMetallic(diffuse: number, specular: number, oneMinusSpecularStrength: number): number;
17
+ /**
18
+ * Utility methods for working with glTF material conversion properties.
19
+ * @internal
20
+ */
21
+ export declare class GLTFMaterialExporter {
22
+ private readonly _exporter;
25
23
  private _textureMap;
26
24
  private _internalTextureToImage;
27
- /**
28
- * Numeric tolerance value
29
- */
30
- private static readonly _Epsilon;
31
- /**
32
- * Reference to the glTF Exporter
33
- */
34
- private _exporter;
35
- constructor(exporter: _Exporter);
36
- /**
37
- * Specifies if two colors are approximately equal in value
38
- * @param color1 first color to compare to
39
- * @param color2 second color to compare to
40
- * @param epsilon threshold value
41
- * @returns boolean specifying if the colors are approximately equal in value
42
- */
43
- private static _FuzzyEquals;
44
- /**
45
- * Gets the materials from a Babylon scene and converts them to glTF materials
46
- * @param exportMaterials
47
- * @param mimeType texture mime type
48
- * @param hasTextureCoords specifies if texture coordinates are present on the material
49
- * @returns promise that resolves after all materials have been converted
50
- */
51
- _convertMaterialsToGLTFAsync(exportMaterials: Set<Material>, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<void>;
52
- /**
53
- * Makes a copy of the glTF material without the texture parameters
54
- * @param originalMaterial original glTF material
55
- * @returns glTF material without texture parameters
56
- */
57
- _stripTexturesFromMaterial(originalMaterial: IMaterial): IMaterial;
58
- /**
59
- * Specifies if the material has any texture parameters present
60
- * @param material glTF Material
61
- * @returns boolean specifying if texture parameters are present
62
- */
63
- _hasTexturesPresent(material: IMaterial): boolean;
64
- _getTextureInfo(babylonTexture: Nullable<BaseTexture>): Nullable<ITextureInfo>;
65
- /**
66
- * Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material
67
- * @param babylonStandardMaterial
68
- * @returns glTF Metallic Roughness Material representation
69
- */
70
- _convertToGLTFPBRMetallicRoughness(babylonStandardMaterial: StandardMaterial): IMaterialPbrMetallicRoughness;
71
- /**
72
- * Computes the metallic factor
73
- * @param diffuse diffused value
74
- * @param specular specular value
75
- * @param oneMinusSpecularStrength one minus the specular strength
76
- * @returns metallic value
77
- */
78
- static _SolveMetallic(diffuse: number, specular: number, oneMinusSpecularStrength: number): number;
79
- /**
80
- * Sets the glTF alpha mode to a glTF material from the Babylon Material
81
- * @param glTFMaterial glTF material
82
- * @param babylonMaterial Babylon material
83
- */
84
- private static _SetAlphaMode;
85
- /**
86
- * Converts a Babylon Standard Material to a glTF Material
87
- * @param babylonStandardMaterial BJS Standard Material
88
- * @param mimeType mime type to use for the textures
89
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
90
- * @returns promise, resolved with the material
91
- */
92
- _convertStandardMaterialAsync(babylonStandardMaterial: StandardMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
93
- private _finishMaterial;
94
- /**
95
- * Converts an image typed array buffer to a base64 image
96
- * @param buffer typed array buffer
97
- * @param width width of the image
98
- * @param height height of the image
99
- * @param mimeType mimetype of the image
100
- * @returns base64 image string
101
- */
25
+ constructor(_exporter: GLTFExporter);
26
+ getTextureInfo(babylonTexture: Nullable<BaseTexture>): Nullable<ITextureInfo>;
27
+ exportStandardMaterialAsync(babylonStandardMaterial: StandardMaterial, mimeType: ImageMimeType, hasUVs: boolean): Promise<number>;
28
+ private _convertToGLTFPBRMetallicRoughness;
29
+ private _finishMaterialAsync;
102
30
  private _getImageDataAsync;
103
- /**
104
- * Generates a white texture based on the specified width and height
105
- * @param width width of the texture in pixels
106
- * @param height height of the texture in pixels
107
- * @param scene babylonjs scene
108
- * @returns white texture
109
- */
110
- private _createWhiteTexture;
111
31
  /**
112
32
  * Resizes the two source textures to the same dimensions. If a texture is null, a default white texture is generated. If both textures are null, returns null
113
33
  * @param texture1 first texture to resize
@@ -116,17 +36,10 @@ export declare class _GLTFMaterialExporter {
116
36
  * @returns resized textures or null
117
37
  */
118
38
  private _resizeTexturesToSameDimensions;
119
- /**
120
- * Converts an array of pixels to a Float32Array
121
- * Throws an error if the pixel format is not supported
122
- * @param pixels - array buffer containing pixel values
123
- * @returns Float32 of pixels
124
- */
125
- private _convertPixelArrayToFloat32;
126
39
  /**
127
40
  * Convert Specular Glossiness Textures to Metallic Roughness
128
41
  * See link below for info on the material conversions from PBR Metallic/Roughness and Specular/Glossiness
129
- * @link https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness/examples/convert-between-workflows-bjs/js/babylon.pbrUtilities.js
42
+ * @see https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness/examples/convert-between-workflows-bjs/js/babylon.pbrUtilities.js
130
43
  * @param diffuseTexture texture used to store diffuse information
131
44
  * @param specularGlossinessTexture texture used to store specular and glossiness information
132
45
  * @param factors specular glossiness material factors
@@ -157,7 +70,7 @@ export declare class _GLTFMaterialExporter {
157
70
  * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
158
71
  * @param mimeType mime type to use for the textures
159
72
  * @param glTFPbrMetallicRoughness glTF PBR Metallic Roughness interface
160
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
73
+ * @param hasUVs specifies if texture coordinates are present on the submesh to determine if textures should be applied
161
74
  * @returns glTF PBR Metallic Roughness factors
162
75
  */
163
76
  private _convertMetalRoughFactorsToMetallicRoughnessAsync;
@@ -168,28 +81,15 @@ export declare class _GLTFMaterialExporter {
168
81
  * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
169
82
  * @param mimeType mime type to use for the textures
170
83
  * @param pbrMetallicRoughness glTF PBR Metallic Roughness interface
171
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
84
+ * @param hasUVs specifies if texture coordinates are present on the submesh to determine if textures should be applied
172
85
  * @returns glTF PBR Metallic Roughness factors
173
86
  */
174
87
  private _convertSpecGlossFactorsToMetallicRoughnessAsync;
175
- /**
176
- * Converts a Babylon PBR Base Material to a glTF Material
177
- * @param babylonPBRMaterial BJS PBR Base Material
178
- * @param mimeType mime type to use for the textures
179
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
180
- * @returns async glTF Material representation
181
- */
182
- _convertPBRMaterialAsync(babylonPBRMaterial: PBRBaseMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
183
- private _setMetallicRoughnessPbrMaterial;
88
+ exportPBRMaterialAsync(babylonPBRMaterial: PBRBaseMaterial, mimeType: ImageMimeType, hasUVs: boolean): Promise<number>;
89
+ private _setMetallicRoughnessPbrMaterialAsync;
184
90
  private _getPixelsFromTexture;
185
- /**
186
- * Extracts a texture from a Babylon texture into file data and glTF data
187
- * @param babylonTexture Babylon texture to extract
188
- * @param mimeType Mime Type of the babylonTexture
189
- * @returns glTF texture info, or null if the texture format is not supported
190
- */
191
- _exportTextureAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
192
- _exportTextureInfoAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
91
+ exportTextureAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
92
+ private _exportTextureInfoAsync;
193
93
  private _exportImage;
194
94
  private _exportTextureInfo;
195
95
  private _exportTextureSampler;