@babylonjs/serializers 5.0.0-rc.7 → 5.0.1
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.
- package/OBJ/index.d.ts +1 -1
- package/OBJ/index.js +1 -1
- package/OBJ/objSerializer.d.ts +21 -21
- package/OBJ/objSerializer.js +174 -174
- package/OBJ/objSerializer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +41 -41
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +189 -189
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +24 -24
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +90 -90
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +24 -24
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +73 -73
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +20 -20
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +51 -51
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +30 -30
- package/glTF/2.0/Extensions/KHR_texture_transform.js +137 -137
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/index.d.ts +5 -5
- package/glTF/2.0/Extensions/index.js +5 -5
- package/glTF/2.0/glTFAnimation.d.ts +206 -205
- package/glTF/2.0/glTFAnimation.js +852 -852
- package/glTF/2.0/glTFAnimation.js.map +1 -1
- package/glTF/2.0/glTFData.d.ts +19 -19
- package/glTF/2.0/glTFData.js +52 -52
- package/glTF/2.0/glTFExporter.d.ts +456 -455
- package/glTF/2.0/glTFExporter.js +1975 -1972
- package/glTF/2.0/glTFExporter.js.map +1 -1
- package/glTF/2.0/glTFExporterExtension.d.ts +74 -74
- package/glTF/2.0/glTFExporterExtension.js +3 -3
- package/glTF/2.0/glTFExporterExtension.js.map +1 -1
- package/glTF/2.0/glTFMaterialExporter.d.ts +208 -207
- package/glTF/2.0/glTFMaterialExporter.js +1114 -1114
- package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
- package/glTF/2.0/glTFSerializer.d.ts +60 -60
- package/glTF/2.0/glTFSerializer.js +62 -62
- package/glTF/2.0/glTFSerializer.js.map +1 -1
- package/glTF/2.0/glTFUtilities.d.ts +99 -97
- package/glTF/2.0/glTFUtilities.js +196 -196
- package/glTF/2.0/glTFUtilities.js.map +1 -1
- package/glTF/2.0/index.d.ts +8 -8
- package/glTF/2.0/index.js +9 -8
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/2.0/shaders/textureTransform.fragment.d.ts +5 -5
- package/glTF/2.0/shaders/textureTransform.fragment.js +8 -8
- package/glTF/glTFFileExporter.d.ts +20 -20
- package/glTF/glTFFileExporter.js +3 -3
- package/glTF/index.d.ts +2 -2
- package/glTF/index.js +3 -2
- package/glTF/index.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +4 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF2Serializer.d.ts +2 -2
- package/legacy/legacy-glTF2Serializer.js +44 -43
- package/legacy/legacy-glTF2Serializer.js.map +1 -1
- package/legacy/legacy-objSerializer.d.ts +1 -1
- package/legacy/legacy-objSerializer.js +13 -12
- package/legacy/legacy-objSerializer.js.map +1 -1
- package/legacy/legacy-stlSerializer.d.ts +1 -1
- package/legacy/legacy-stlSerializer.js +13 -12
- package/legacy/legacy-stlSerializer.js.map +1 -1
- package/legacy/legacy.d.ts +4 -4
- package/legacy/legacy.js +6 -5
- package/legacy/legacy.js.map +1 -1
- package/license.md +71 -0
- package/package.json +25 -6
- package/stl/index.d.ts +1 -1
- package/stl/index.js +1 -1
- package/stl/stlSerializer.d.ts +17 -17
- package/stl/stlSerializer.js +107 -107
- package/stl/stlSerializer.js.map +1 -1
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { ImageMimeType, IMeshPrimitive, INode, IMaterial, ITextureInfo } from "babylonjs-gltf2interface";
|
|
2
|
-
import { Node } from "@babylonjs/core/node.js";
|
|
3
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
|
4
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
5
|
-
import { SubMesh } from "@babylonjs/core/Meshes/subMesh.js";
|
|
6
|
-
import { IDisposable } from "@babylonjs/core/scene.js";
|
|
7
|
-
import { _BinaryWriter } from "./glTFExporter";
|
|
8
|
-
import { IGLTFExporterExtension } from "../glTFFileExporter";
|
|
9
|
-
import { Material } from "@babylonjs/core/Materials/material.js";
|
|
10
|
-
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
|
11
|
-
/** @hidden */
|
|
12
|
-
export declare var __IGLTFExporterExtensionV2: number;
|
|
13
|
-
/**
|
|
14
|
-
* Interface for a glTF exporter extension
|
|
15
|
-
* @hidden
|
|
16
|
-
*/
|
|
17
|
-
export interface IGLTFExporterExtensionV2 extends IGLTFExporterExtension, IDisposable {
|
|
18
|
-
/**
|
|
19
|
-
* Define this method to modify the default behavior before exporting a texture
|
|
20
|
-
* @param context The context when loading the asset
|
|
21
|
-
* @param babylonTexture The Babylon.js texture
|
|
22
|
-
* @param mimeType The mime-type of the generated image
|
|
23
|
-
* @returns A promise that resolves with the exported texture
|
|
24
|
-
*/
|
|
25
|
-
preExportTextureAsync?(context: string, babylonTexture: Nullable<Texture>, mimeType: ImageMimeType): Promise<Texture>;
|
|
26
|
-
/**
|
|
27
|
-
* Define this method to get notified when a texture info is created
|
|
28
|
-
* @param context The context when loading the asset
|
|
29
|
-
* @param textureInfo The glTF texture info
|
|
30
|
-
* @param babylonTexture The Babylon.js texture
|
|
31
|
-
*/
|
|
32
|
-
postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
|
|
33
|
-
/**
|
|
34
|
-
* Define this method to modify the default behavior when exporting texture info
|
|
35
|
-
* @param context The context when loading the asset
|
|
36
|
-
* @param meshPrimitive glTF mesh primitive
|
|
37
|
-
* @param babylonSubMesh Babylon submesh
|
|
38
|
-
* @param binaryWriter glTF serializer binary writer instance
|
|
39
|
-
* @returns nullable IMeshPrimitive promise
|
|
40
|
-
*/
|
|
41
|
-
postExportMeshPrimitiveAsync?(context: string, meshPrimitive: Nullable<IMeshPrimitive>, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<IMeshPrimitive>;
|
|
42
|
-
/**
|
|
43
|
-
* Define this method to modify the default behavior when exporting a node
|
|
44
|
-
* @param context The context when exporting the node
|
|
45
|
-
* @param node glTF node
|
|
46
|
-
* @param babylonNode BabylonJS node
|
|
47
|
-
* @returns nullable INode promise
|
|
48
|
-
*/
|
|
49
|
-
postExportNodeAsync?(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap?: {
|
|
50
|
-
[key: number]: number;
|
|
51
|
-
}): Promise<Nullable<INode>>;
|
|
52
|
-
/**
|
|
53
|
-
* Define this method to modify the default behavior when exporting a material
|
|
54
|
-
* @param material glTF material
|
|
55
|
-
* @param babylonMaterial BabylonJS material
|
|
56
|
-
* @returns nullable IMaterial promise
|
|
57
|
-
*/
|
|
58
|
-
postExportMaterialAsync?(context: string, node: Nullable<IMaterial>, babylonMaterial: Material): Promise<IMaterial>;
|
|
59
|
-
/**
|
|
60
|
-
* Define this method to return additional textures to export from a material
|
|
61
|
-
* @param material glTF material
|
|
62
|
-
* @param babylonMaterial BabylonJS material
|
|
63
|
-
* @returns List of textures
|
|
64
|
-
*/
|
|
65
|
-
postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];
|
|
66
|
-
/** Gets a boolean indicating that this extension was used */
|
|
67
|
-
wasUsed: boolean;
|
|
68
|
-
/** Gets a boolean indicating that this extension is required for the file to work */
|
|
69
|
-
required: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Called after the exporter state changes to EXPORTING
|
|
72
|
-
*/
|
|
73
|
-
onExporting?(): void;
|
|
74
|
-
}
|
|
1
|
+
import type { ImageMimeType, IMeshPrimitive, INode, IMaterial, ITextureInfo } from "babylonjs-gltf2interface/.js";
|
|
2
|
+
import type { Node } from "@babylonjs/core/node.js";
|
|
3
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
|
4
|
+
import type { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
5
|
+
import type { SubMesh } from "@babylonjs/core/Meshes/subMesh.js";
|
|
6
|
+
import type { IDisposable } from "@babylonjs/core/scene.js";
|
|
7
|
+
import type { _BinaryWriter } from "./glTFExporter";
|
|
8
|
+
import type { IGLTFExporterExtension } from "../glTFFileExporter";
|
|
9
|
+
import type { Material } from "@babylonjs/core/Materials/material.js";
|
|
10
|
+
import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
|
11
|
+
/** @hidden */
|
|
12
|
+
export declare var __IGLTFExporterExtensionV2: number;
|
|
13
|
+
/**
|
|
14
|
+
* Interface for a glTF exporter extension
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export interface IGLTFExporterExtensionV2 extends IGLTFExporterExtension, IDisposable {
|
|
18
|
+
/**
|
|
19
|
+
* Define this method to modify the default behavior before exporting a texture
|
|
20
|
+
* @param context The context when loading the asset
|
|
21
|
+
* @param babylonTexture The Babylon.js texture
|
|
22
|
+
* @param mimeType The mime-type of the generated image
|
|
23
|
+
* @returns A promise that resolves with the exported texture
|
|
24
|
+
*/
|
|
25
|
+
preExportTextureAsync?(context: string, babylonTexture: Nullable<Texture>, mimeType: ImageMimeType): Promise<Texture>;
|
|
26
|
+
/**
|
|
27
|
+
* Define this method to get notified when a texture info is created
|
|
28
|
+
* @param context The context when loading the asset
|
|
29
|
+
* @param textureInfo The glTF texture info
|
|
30
|
+
* @param babylonTexture The Babylon.js texture
|
|
31
|
+
*/
|
|
32
|
+
postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
|
|
33
|
+
/**
|
|
34
|
+
* Define this method to modify the default behavior when exporting texture info
|
|
35
|
+
* @param context The context when loading the asset
|
|
36
|
+
* @param meshPrimitive glTF mesh primitive
|
|
37
|
+
* @param babylonSubMesh Babylon submesh
|
|
38
|
+
* @param binaryWriter glTF serializer binary writer instance
|
|
39
|
+
* @returns nullable IMeshPrimitive promise
|
|
40
|
+
*/
|
|
41
|
+
postExportMeshPrimitiveAsync?(context: string, meshPrimitive: Nullable<IMeshPrimitive>, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<IMeshPrimitive>;
|
|
42
|
+
/**
|
|
43
|
+
* Define this method to modify the default behavior when exporting a node
|
|
44
|
+
* @param context The context when exporting the node
|
|
45
|
+
* @param node glTF node
|
|
46
|
+
* @param babylonNode BabylonJS node
|
|
47
|
+
* @returns nullable INode promise
|
|
48
|
+
*/
|
|
49
|
+
postExportNodeAsync?(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap?: {
|
|
50
|
+
[key: number]: number;
|
|
51
|
+
}): Promise<Nullable<INode>>;
|
|
52
|
+
/**
|
|
53
|
+
* Define this method to modify the default behavior when exporting a material
|
|
54
|
+
* @param material glTF material
|
|
55
|
+
* @param babylonMaterial BabylonJS material
|
|
56
|
+
* @returns nullable IMaterial promise
|
|
57
|
+
*/
|
|
58
|
+
postExportMaterialAsync?(context: string, node: Nullable<IMaterial>, babylonMaterial: Material): Promise<IMaterial>;
|
|
59
|
+
/**
|
|
60
|
+
* Define this method to return additional textures to export from a material
|
|
61
|
+
* @param material glTF material
|
|
62
|
+
* @param babylonMaterial BabylonJS material
|
|
63
|
+
* @returns List of textures
|
|
64
|
+
*/
|
|
65
|
+
postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];
|
|
66
|
+
/** Gets a boolean indicating that this extension was used */
|
|
67
|
+
wasUsed: boolean;
|
|
68
|
+
/** Gets a boolean indicating that this extension is required for the file to work */
|
|
69
|
+
required: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Called after the exporter state changes to EXPORTING
|
|
72
|
+
*/
|
|
73
|
+
onExporting?(): void;
|
|
74
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @hidden */
|
|
2
|
-
// eslint-disable-next-line no-var, @typescript-eslint/naming-convention
|
|
3
|
-
export var __IGLTFExporterExtensionV2 = 0; // I am here to allow dts to be created
|
|
1
|
+
/** @hidden */
|
|
2
|
+
// eslint-disable-next-line no-var, @typescript-eslint/naming-convention
|
|
3
|
+
export var __IGLTFExporterExtensionV2 = 0; // I am here to allow dts to be created
|
|
4
4
|
//# sourceMappingURL=glTFExporterExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glTFExporterExtension.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/glTFExporterExtension.ts"],"names":[],"mappings":"AAaA,cAAc;AACd,wEAAwE;AACxE,MAAM,CAAC,IAAI,0BAA0B,GAAG,CAAC,CAAC,CAAC,uCAAuC","sourcesContent":["import { ImageMimeType, IMeshPrimitive, INode, IMaterial, ITextureInfo } from \"babylonjs-gltf2interface\";\r\nimport { Node } from \"core/node\";\r\nimport { Nullable } from \"core/types\";\r\n\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { SubMesh } from \"core/Meshes/subMesh\";\r\nimport { IDisposable } from \"core/scene\";\r\n\r\nimport { _BinaryWriter } from \"./glTFExporter\";\r\nimport { IGLTFExporterExtension } from \"../glTFFileExporter\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\n\r\n/** @hidden */\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 * @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}\r\n"]}
|
|
1
|
+
{"version":3,"file":"glTFExporterExtension.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/glTFExporterExtension.ts"],"names":[],"mappings":"AAaA,cAAc;AACd,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/** @hidden */\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 * @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}\r\n"]}
|
|
@@ -1,207 +1,208 @@
|
|
|
1
|
-
import { ITextureInfo,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
declare type
|
|
7
|
-
declare type
|
|
8
|
-
declare type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
* @
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*
|
|
65
|
-
* @
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
* @param
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
* @param
|
|
94
|
-
* @param
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
*
|
|
100
|
-
* @param
|
|
101
|
-
* @param
|
|
102
|
-
* @param
|
|
103
|
-
* @
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
111
|
-
* @
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
*
|
|
117
|
-
* @param
|
|
118
|
-
* @param
|
|
119
|
-
* @
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* @
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* @
|
|
134
|
-
* @param
|
|
135
|
-
* @param
|
|
136
|
-
* @param
|
|
137
|
-
* @
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*
|
|
143
|
-
* @
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
*
|
|
149
|
-
* @
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
*
|
|
155
|
-
* @
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
*
|
|
161
|
-
* @param
|
|
162
|
-
* @param
|
|
163
|
-
* @param
|
|
164
|
-
* @
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
private
|
|
168
|
-
private
|
|
169
|
-
private
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
*
|
|
173
|
-
* @param
|
|
174
|
-
* @param
|
|
175
|
-
* @param
|
|
176
|
-
* @
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
*
|
|
182
|
-
* @param
|
|
183
|
-
* @param
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
private
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
*
|
|
191
|
-
* @param
|
|
192
|
-
* @
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
*
|
|
199
|
-
* @param
|
|
200
|
-
* @param
|
|
201
|
-
* @param
|
|
202
|
-
* @param
|
|
203
|
-
* @
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
1
|
+
import type { ITextureInfo, IMaterial, IMaterialPbrMetallicRoughness } from "babylonjs-gltf2interface/.js";
|
|
2
|
+
import { ImageMimeType } from "babylonjs-gltf2interface/.js";
|
|
3
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
|
4
|
+
import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
|
5
|
+
import type { _Exporter } from "./glTFExporter";
|
|
6
|
+
declare type Material = import("@babylonjs/core/Materials/material.js").Material;
|
|
7
|
+
declare type StandardMaterial = import("@babylonjs/core/Materials/standardMaterial.js").StandardMaterial;
|
|
8
|
+
declare type PBRBaseMaterial = import("@babylonjs/core/Materials/PBR/pbrBaseMaterial.js").PBRBaseMaterial;
|
|
9
|
+
declare type PBRMetallicRoughnessMaterial = import("@babylonjs/core/Materials/PBR/pbrMetallicRoughnessMaterial.js").PBRMetallicRoughnessMaterial;
|
|
10
|
+
/**
|
|
11
|
+
* Utility methods for working with glTF material conversion properties. This class should only be used internally
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export declare class _GLTFMaterialExporter {
|
|
15
|
+
/**
|
|
16
|
+
* Represents the dielectric specular values for R, G and B
|
|
17
|
+
*/
|
|
18
|
+
private static readonly _DielectricSpecular;
|
|
19
|
+
/**
|
|
20
|
+
* Allows the maximum specular power to be defined for material calculations
|
|
21
|
+
*/
|
|
22
|
+
private static readonly _MaxSpecularPower;
|
|
23
|
+
/**
|
|
24
|
+
* Mapping to store textures
|
|
25
|
+
*/
|
|
26
|
+
private _textureMap;
|
|
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
|
+
*/
|
|
42
|
+
private static _FuzzyEquals;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the materials from a Babylon scene and converts them to glTF materials
|
|
45
|
+
* @param exportMaterials
|
|
46
|
+
* @param mimeType texture mime type
|
|
47
|
+
* @param hasTextureCoords specifies if texture coordinates are present on the material
|
|
48
|
+
*/
|
|
49
|
+
_convertMaterialsToGLTFAsync(exportMaterials: Set<Material>, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Makes a copy of the glTF material without the texture parameters
|
|
52
|
+
* @param originalMaterial original glTF material
|
|
53
|
+
* @returns glTF material without texture parameters
|
|
54
|
+
*/
|
|
55
|
+
_stripTexturesFromMaterial(originalMaterial: IMaterial): IMaterial;
|
|
56
|
+
/**
|
|
57
|
+
* Specifies if the material has any texture parameters present
|
|
58
|
+
* @param material glTF Material
|
|
59
|
+
* @returns boolean specifying if texture parameters are present
|
|
60
|
+
*/
|
|
61
|
+
_hasTexturesPresent(material: IMaterial): boolean;
|
|
62
|
+
_getTextureInfo(babylonTexture: Nullable<BaseTexture>): Nullable<ITextureInfo>;
|
|
63
|
+
/**
|
|
64
|
+
* Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material
|
|
65
|
+
* @param babylonStandardMaterial
|
|
66
|
+
* @returns glTF Metallic Roughness Material representation
|
|
67
|
+
*/
|
|
68
|
+
_convertToGLTFPBRMetallicRoughness(babylonStandardMaterial: StandardMaterial): IMaterialPbrMetallicRoughness;
|
|
69
|
+
/**
|
|
70
|
+
* Computes the metallic factor
|
|
71
|
+
* @param diffuse diffused value
|
|
72
|
+
* @param specular specular value
|
|
73
|
+
* @param oneMinusSpecularStrength one minus the specular strength
|
|
74
|
+
* @returns metallic value
|
|
75
|
+
*/
|
|
76
|
+
static _SolveMetallic(diffuse: number, specular: number, oneMinusSpecularStrength: number): number;
|
|
77
|
+
/**
|
|
78
|
+
* Sets the glTF alpha mode to a glTF material from the Babylon Material
|
|
79
|
+
* @param glTFMaterial glTF material
|
|
80
|
+
* @param babylonMaterial Babylon material
|
|
81
|
+
*/
|
|
82
|
+
private static _SetAlphaMode;
|
|
83
|
+
/**
|
|
84
|
+
* Converts a Babylon Standard Material to a glTF Material
|
|
85
|
+
* @param babylonStandardMaterial BJS Standard Material
|
|
86
|
+
* @param mimeType mime type to use for the textures
|
|
87
|
+
* @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
|
|
88
|
+
*/
|
|
89
|
+
_convertStandardMaterialAsync(babylonStandardMaterial: StandardMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
|
|
90
|
+
private _finishMaterial;
|
|
91
|
+
/**
|
|
92
|
+
* Converts a Babylon PBR Metallic Roughness Material to a glTF Material
|
|
93
|
+
* @param babylonPBRMetalRoughMaterial BJS PBR Metallic Roughness Material
|
|
94
|
+
* @param mimeType mime type to use for the textures
|
|
95
|
+
* @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
|
|
96
|
+
*/
|
|
97
|
+
_convertPBRMetallicRoughnessMaterialAsync(babylonPBRMetalRoughMaterial: PBRMetallicRoughnessMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
|
|
98
|
+
/**
|
|
99
|
+
* Converts an image typed array buffer to a base64 image
|
|
100
|
+
* @param buffer typed array buffer
|
|
101
|
+
* @param width width of the image
|
|
102
|
+
* @param height height of the image
|
|
103
|
+
* @param mimeType mimetype of the image
|
|
104
|
+
* @returns base64 image string
|
|
105
|
+
*/
|
|
106
|
+
private _createBase64FromCanvasAsync;
|
|
107
|
+
/**
|
|
108
|
+
* Generates a white texture based on the specified width and height
|
|
109
|
+
* @param width width of the texture in pixels
|
|
110
|
+
* @param height height of the texture in pixels
|
|
111
|
+
* @param scene babylonjs scene
|
|
112
|
+
* @returns white texture
|
|
113
|
+
*/
|
|
114
|
+
private _createWhiteTexture;
|
|
115
|
+
/**
|
|
116
|
+
* 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
|
|
117
|
+
* @param texture1 first texture to resize
|
|
118
|
+
* @param texture2 second texture to resize
|
|
119
|
+
* @param scene babylonjs scene
|
|
120
|
+
* @returns resized textures or null
|
|
121
|
+
*/
|
|
122
|
+
private _resizeTexturesToSameDimensions;
|
|
123
|
+
/**
|
|
124
|
+
* Converts an array of pixels to a Float32Array
|
|
125
|
+
* Throws an error if the pixel format is not supported
|
|
126
|
+
* @param pixels - array buffer containing pixel values
|
|
127
|
+
* @returns Float32 of pixels
|
|
128
|
+
*/
|
|
129
|
+
private _convertPixelArrayToFloat32;
|
|
130
|
+
/**
|
|
131
|
+
* Convert Specular Glossiness Textures to Metallic Roughness
|
|
132
|
+
* See link below for info on the material conversions from PBR Metallic/Roughness and Specular/Glossiness
|
|
133
|
+
* @link https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/examples/convert-between-workflows-bjs/js/babylon.pbrUtilities.js
|
|
134
|
+
* @param diffuseTexture texture used to store diffuse information
|
|
135
|
+
* @param specularGlossinessTexture texture used to store specular and glossiness information
|
|
136
|
+
* @param factors specular glossiness material factors
|
|
137
|
+
* @param mimeType the mime type to use for the texture
|
|
138
|
+
* @returns pbr metallic roughness interface or null
|
|
139
|
+
*/
|
|
140
|
+
private _convertSpecularGlossinessTexturesToMetallicRoughnessAsync;
|
|
141
|
+
/**
|
|
142
|
+
* Converts specular glossiness material properties to metallic roughness
|
|
143
|
+
* @param specularGlossiness interface with specular glossiness material properties
|
|
144
|
+
* @returns interface with metallic roughness material properties
|
|
145
|
+
*/
|
|
146
|
+
private _convertSpecularGlossinessToMetallicRoughness;
|
|
147
|
+
/**
|
|
148
|
+
* Calculates the surface reflectance, independent of lighting conditions
|
|
149
|
+
* @param color Color source to calculate brightness from
|
|
150
|
+
* @returns number representing the perceived brightness, or zero if color is undefined
|
|
151
|
+
*/
|
|
152
|
+
private _getPerceivedBrightness;
|
|
153
|
+
/**
|
|
154
|
+
* Returns the maximum color component value
|
|
155
|
+
* @param color
|
|
156
|
+
* @returns maximum color component value, or zero if color is null or undefined
|
|
157
|
+
*/
|
|
158
|
+
private _getMaxComponent;
|
|
159
|
+
/**
|
|
160
|
+
* Convert a PBRMaterial (Metallic/Roughness) to Metallic Roughness factors
|
|
161
|
+
* @param babylonPBRMaterial BJS PBR Metallic Roughness Material
|
|
162
|
+
* @param mimeType mime type to use for the textures
|
|
163
|
+
* @param glTFPbrMetallicRoughness glTF PBR Metallic Roughness interface
|
|
164
|
+
* @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
|
|
165
|
+
* @returns glTF PBR Metallic Roughness factors
|
|
166
|
+
*/
|
|
167
|
+
private _convertMetalRoughFactorsToMetallicRoughnessAsync;
|
|
168
|
+
private _getGLTFTextureSampler;
|
|
169
|
+
private _getGLTFTextureWrapMode;
|
|
170
|
+
private _getGLTFTextureWrapModesSampler;
|
|
171
|
+
/**
|
|
172
|
+
* Convert a PBRMaterial (Specular/Glossiness) to Metallic Roughness factors
|
|
173
|
+
* @param babylonPBRMaterial BJS PBR Metallic Roughness Material
|
|
174
|
+
* @param mimeType mime type to use for the textures
|
|
175
|
+
* @param glTFPbrMetallicRoughness glTF PBR Metallic Roughness interface
|
|
176
|
+
* @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
|
|
177
|
+
* @returns glTF PBR Metallic Roughness factors
|
|
178
|
+
*/
|
|
179
|
+
private _convertSpecGlossFactorsToMetallicRoughnessAsync;
|
|
180
|
+
/**
|
|
181
|
+
* Converts a Babylon PBR Base Material to a glTF Material
|
|
182
|
+
* @param babylonPBRMaterial BJS PBR Base Material
|
|
183
|
+
* @param mimeType mime type to use for the textures
|
|
184
|
+
* @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
|
|
185
|
+
*/
|
|
186
|
+
_convertPBRMaterialAsync(babylonPBRMaterial: PBRBaseMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
|
|
187
|
+
private _setMetallicRoughnessPbrMaterial;
|
|
188
|
+
private _getPixelsFromTexture;
|
|
189
|
+
/**
|
|
190
|
+
* Extracts a texture from a Babylon texture into file data and glTF data
|
|
191
|
+
* @param babylonTexture Babylon texture to extract
|
|
192
|
+
* @param mimeType Mime Type of the babylonTexture
|
|
193
|
+
* @return glTF texture info, or null if the texture format is not supported
|
|
194
|
+
*/
|
|
195
|
+
_exportTextureAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
|
|
196
|
+
_exportTextureInfoAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
|
|
197
|
+
/**
|
|
198
|
+
* Builds a texture from base64 string
|
|
199
|
+
* @param base64Texture base64 texture string
|
|
200
|
+
* @param baseTextureName Name to use for the texture
|
|
201
|
+
* @param mimeType image mime type for the texture
|
|
202
|
+
* @param texCoordIndex
|
|
203
|
+
* @param samplerIndex
|
|
204
|
+
* @returns glTF texture info, or null if the texture format is not supported
|
|
205
|
+
*/
|
|
206
|
+
private _getTextureInfoFromBase64;
|
|
207
|
+
}
|
|
208
|
+
export {};
|