@babylonjs/serializers 5.32.1 → 5.33.0
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/glTF/2.0/Extensions/KHR_texture_transform.d.ts +2 -9
- package/glTF/2.0/Extensions/KHR_texture_transform.js +5 -54
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/glTFExporter.d.ts +2 -2
- package/glTF/2.0/glTFExporter.js +3 -3
- package/glTF/2.0/glTFExporter.js.map +1 -1
- package/glTF/2.0/glTFExporterExtension.d.ts +1 -1
- package/glTF/2.0/glTFExporterExtension.js.map +1 -1
- package/glTF/2.0/glTFMaterialExporter.d.ts +6 -13
- package/glTF/2.0/glTFMaterialExporter.js +216 -262
- package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
- package/package.json +3 -3
- package/glTF/2.0/shaders/textureTransform.fragment.d.ts +0 -5
- package/glTF/2.0/shaders/textureTransform.fragment.js +0 -13
- package/glTF/2.0/shaders/textureTransform.fragment.js.map +0 -1
@@ -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<Texture
|
25
|
+
preExportTextureAsync?(context: string, babylonTexture: Nullable<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
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"glTFExporterExtension.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/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<Texture
|
1
|
+
{"version":3,"file":"glTFExporterExtension.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/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"]}
|
@@ -23,6 +23,7 @@ export declare class _GLTFMaterialExporter {
|
|
23
23
|
* Mapping to store textures
|
24
24
|
*/
|
25
25
|
private _textureMap;
|
26
|
+
private _internalTextureToImage;
|
26
27
|
/**
|
27
28
|
* Numeric tolerance value
|
28
29
|
*/
|
@@ -95,7 +96,7 @@ export declare class _GLTFMaterialExporter {
|
|
95
96
|
* @param mimeType mimetype of the image
|
96
97
|
* @returns base64 image string
|
97
98
|
*/
|
98
|
-
private
|
99
|
+
private _getImageDataAsync;
|
99
100
|
/**
|
100
101
|
* Generates a white texture based on the specified width and height
|
101
102
|
* @param width width of the texture in pixels
|
@@ -157,9 +158,8 @@ export declare class _GLTFMaterialExporter {
|
|
157
158
|
* @returns glTF PBR Metallic Roughness factors
|
158
159
|
*/
|
159
160
|
private _convertMetalRoughFactorsToMetallicRoughnessAsync;
|
160
|
-
private
|
161
|
+
private _getTextureSampler;
|
161
162
|
private _getGLTFTextureWrapMode;
|
162
|
-
private _getGLTFTextureWrapModesSampler;
|
163
163
|
/**
|
164
164
|
* Convert a PBRMaterial (Specular/Glossiness) to Metallic Roughness factors
|
165
165
|
* @param babylonPBRMaterial BJS PBR Metallic Roughness Material
|
@@ -186,15 +186,8 @@ export declare class _GLTFMaterialExporter {
|
|
186
186
|
*/
|
187
187
|
_exportTextureAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
|
188
188
|
_exportTextureInfoAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
* @param baseTextureName Name to use for the texture
|
193
|
-
* @param mimeType image mime type for the texture
|
194
|
-
* @param texCoordIndex
|
195
|
-
* @param samplerIndex
|
196
|
-
* @returns glTF texture info, or null if the texture format is not supported
|
197
|
-
*/
|
198
|
-
private _getTextureInfoFromBase64;
|
189
|
+
private _exportImage;
|
190
|
+
private _exportTextureInfo;
|
191
|
+
private _exportTextureSampler;
|
199
192
|
}
|
200
193
|
export {};
|