@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
@@ -1,58 +1,39 @@
1
- import { _Exporter } from "./glTFExporter.js";
1
+ import { GLTFExporter } from "./glTFExporter.js";
2
2
  /**
3
3
  * Class for generating glTF data from a Babylon scene.
4
4
  */
5
5
  export class GLTF2Export {
6
6
  /**
7
- * Exports the geometry of the scene to .gltf file format asynchronously
8
- * @param scene Babylon scene with scene hierarchy information
9
- * @param filePrefix File prefix to use when generating the glTF file
7
+ * Exports the scene to .gltf file format
8
+ * @param scene Babylon scene
9
+ * @param fileName Name to use for the .gltf file
10
10
  * @param options Exporter options
11
- * @returns Returns an object with a .gltf file and associates texture names
12
- * as keys and their data and paths as values
11
+ * @returns Returns the exported data
13
12
  */
14
- static GLTFAsync(scene, filePrefix, options) {
15
- return scene.whenReadyAsync().then(() => {
16
- const glTFPrefix = filePrefix.replace(/\.[^/.]+$/, "");
17
- const gltfGenerator = new _Exporter(scene, options);
18
- return gltfGenerator._generateGLTFAsync(glTFPrefix);
19
- });
20
- }
21
- static _PreExportAsync(scene, options) {
22
- return Promise.resolve().then(() => {
23
- if (options && options.exportWithoutWaitingForScene) {
24
- return Promise.resolve();
25
- }
26
- else {
27
- return scene.whenReadyAsync();
28
- }
29
- });
30
- }
31
- static _PostExportAsync(scene, glTFData, options) {
32
- return Promise.resolve().then(() => {
33
- if (options && options.exportWithoutWaitingForScene) {
34
- return glTFData;
35
- }
36
- else {
37
- return glTFData;
38
- }
39
- });
13
+ static async GLTFAsync(scene, fileName, options) {
14
+ if (!options || !options.exportWithoutWaitingForScene) {
15
+ await scene.whenReadyAsync();
16
+ }
17
+ const exporter = new GLTFExporter(scene, options);
18
+ const data = await exporter.generateGLTFAsync(fileName.replace(/\.[^/.]+$/, ""));
19
+ exporter.dispose();
20
+ return data;
40
21
  }
41
22
  /**
42
- * Exports the geometry of the scene to .glb file format asychronously
43
- * @param scene Babylon scene with scene hierarchy information
44
- * @param filePrefix File prefix to use when generating glb file
23
+ * Exports the scene to .glb file format
24
+ * @param scene Babylon scene
25
+ * @param fileName Name to use for the .glb file
45
26
  * @param options Exporter options
46
- * @returns Returns an object with a .glb filename as key and data as value
27
+ * @returns Returns the exported data
47
28
  */
48
- static GLBAsync(scene, filePrefix, options) {
49
- return this._PreExportAsync(scene, options).then(() => {
50
- const glTFPrefix = filePrefix.replace(/\.[^/.]+$/, "");
51
- const gltfGenerator = new _Exporter(scene, options);
52
- return gltfGenerator._generateGLBAsync(glTFPrefix).then((glTFData) => {
53
- return this._PostExportAsync(scene, glTFData, options);
54
- });
55
- });
29
+ static async GLBAsync(scene, fileName, options) {
30
+ if (!options || !options.exportWithoutWaitingForScene) {
31
+ await scene.whenReadyAsync();
32
+ }
33
+ const exporter = new GLTFExporter(scene, options);
34
+ const data = await exporter.generateGLBAsync(fileName.replace(/\.[^/.]+$/, ""));
35
+ exporter.dispose();
36
+ return data;
56
37
  }
57
38
  }
58
39
  //# sourceMappingURL=glTFSerializer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"glTFSerializer.js","sourceRoot":"","sources":["../../../../../dev/serializers/src/glTF/2.0/glTFSerializer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAsD3C;;GAEG;AACH,MAAM,OAAO,WAAW;IACpB;;;;;;;OAOG;IACI,MAAM,CAAC,SAAS,CAAC,KAAY,EAAE,UAAkB,EAAE,OAAwB;QAC9E,OAAO,KAAK,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YACpC,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACvD,MAAM,aAAa,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACpD,OAAO,aAAa,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,MAAM,CAAC,eAAe,CAAC,KAAY,EAAE,OAAwB;QACjE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YAC/B,IAAI,OAAO,IAAI,OAAO,CAAC,4BAA4B,EAAE,CAAC;gBAClD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACJ,OAAO,KAAK,CAAC,cAAc,EAAE,CAAC;YAClC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAC,KAAY,EAAE,QAAkB,EAAE,OAAwB;QACtF,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YAC/B,IAAI,OAAO,IAAI,OAAO,CAAC,4BAA4B,EAAE,CAAC;gBAClD,OAAO,QAAQ,CAAC;YACpB,CAAC;iBAAM,CAAC;gBACJ,OAAO,QAAQ,CAAC;YACpB,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,QAAQ,CAAC,KAAY,EAAE,UAAkB,EAAE,OAAwB;QAC7E,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAClD,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACvD,MAAM,aAAa,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACpD,OAAO,aAAa,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACjE,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type { Node } from \"core/node\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Animation } from \"core/Animations/animation\";\r\nimport type { GLTFData } from \"./glTFData\";\r\nimport { _Exporter } from \"./glTFExporter\";\r\n\r\n/**\r\n * Holds a collection of exporter options and parameters\r\n */\r\nexport interface IExportOptions {\r\n /**\r\n * Function which indicates whether a babylon node should be exported or not\r\n * @param node source Babylon node. It is used to check whether it should be exported to glTF or not\r\n * @returns boolean, which indicates whether the node should be exported (true) or not (false)\r\n */\r\n shouldExportNode?(node: Node): boolean;\r\n\r\n /**\r\n * Function which indicates whether an animation on the scene should be exported or not\r\n * @param animation source animation\r\n * @returns boolean, which indicates whether the animation should be exported (true) or not (false)\r\n */\r\n shouldExportAnimation?(animation: Animation): boolean;\r\n\r\n /**\r\n * Function used to extract the part of node's metadata that will be exported into glTF node extras\r\n * @param metadata source metadata to read from\r\n * @returns the data to store to glTF node extras\r\n */\r\n metadataSelector?(metadata: any): any;\r\n\r\n /**\r\n * The sample rate to bake animation curves. Defaults to 1 / 60.\r\n */\r\n animationSampleRate?: number;\r\n\r\n /**\r\n * Begin serialization without waiting for the scene to be ready. Defaults to false.\r\n */\r\n exportWithoutWaitingForScene?: boolean;\r\n\r\n /**\r\n * Indicates if unused vertex uv attributes should be included in export. Defaults to false.\r\n */\r\n exportUnusedUVs?: boolean;\r\n\r\n /**\r\n * Remove no-op root nodes when possible. Defaults to true.\r\n */\r\n removeNoopRootNodes?: boolean;\r\n\r\n /**\r\n * Indicates if coordinate system swapping root nodes should be included in export. Defaults to false.\r\n * @deprecated Please use removeNoopRootNodes instead\r\n */\r\n includeCoordinateSystemConversionNodes?: boolean;\r\n}\r\n\r\n/**\r\n * Class for generating glTF data from a Babylon scene.\r\n */\r\nexport class GLTF2Export {\r\n /**\r\n * Exports the geometry of the scene to .gltf file format asynchronously\r\n * @param scene Babylon scene with scene hierarchy information\r\n * @param filePrefix File prefix to use when generating the glTF file\r\n * @param options Exporter options\r\n * @returns Returns an object with a .gltf file and associates texture names\r\n * as keys and their data and paths as values\r\n */\r\n public static GLTFAsync(scene: Scene, filePrefix: string, options?: IExportOptions): Promise<GLTFData> {\r\n return scene.whenReadyAsync().then(() => {\r\n const glTFPrefix = filePrefix.replace(/\\.[^/.]+$/, \"\");\r\n const gltfGenerator = new _Exporter(scene, options);\r\n return gltfGenerator._generateGLTFAsync(glTFPrefix);\r\n });\r\n }\r\n\r\n private static _PreExportAsync(scene: Scene, options?: IExportOptions): Promise<void> {\r\n return Promise.resolve().then(() => {\r\n if (options && options.exportWithoutWaitingForScene) {\r\n return Promise.resolve();\r\n } else {\r\n return scene.whenReadyAsync();\r\n }\r\n });\r\n }\r\n\r\n private static _PostExportAsync(scene: Scene, glTFData: GLTFData, options?: IExportOptions): Promise<GLTFData> {\r\n return Promise.resolve().then(() => {\r\n if (options && options.exportWithoutWaitingForScene) {\r\n return glTFData;\r\n } else {\r\n return glTFData;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Exports the geometry of the scene to .glb file format asychronously\r\n * @param scene Babylon scene with scene hierarchy information\r\n * @param filePrefix File prefix to use when generating glb file\r\n * @param options Exporter options\r\n * @returns Returns an object with a .glb filename as key and data as value\r\n */\r\n public static GLBAsync(scene: Scene, filePrefix: string, options?: IExportOptions): Promise<GLTFData> {\r\n return this._PreExportAsync(scene, options).then(() => {\r\n const glTFPrefix = filePrefix.replace(/\\.[^/.]+$/, \"\");\r\n const gltfGenerator = new _Exporter(scene, options);\r\n return gltfGenerator._generateGLBAsync(glTFPrefix).then((glTFData) => {\r\n return this._PostExportAsync(scene, glTFData, options);\r\n });\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"glTFSerializer.js","sourceRoot":"","sources":["../../../../../dev/serializers/src/glTF/2.0/glTFSerializer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAsD9C;;GAEG;AACH,MAAM,OAAO,WAAW;IACpB;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAY,EAAE,QAAgB,EAAE,OAAwB;QAClF,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,4BAA4B,EAAE,CAAC;YACpD,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjC,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC;QACjF,QAAQ,CAAC,OAAO,EAAE,CAAC;QAEnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAY,EAAE,QAAgB,EAAE,OAAwB;QACjF,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,4BAA4B,EAAE,CAAC;YACpD,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjC,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC;QAChF,QAAQ,CAAC,OAAO,EAAE,CAAC;QAEnB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { Node } from \"core/node\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Animation } from \"core/Animations/animation\";\r\nimport type { GLTFData } from \"./glTFData\";\r\nimport { GLTFExporter } from \"./glTFExporter\";\r\n\r\n/**\r\n * Holds a collection of exporter options and parameters\r\n */\r\nexport interface IExportOptions {\r\n /**\r\n * Function which indicates whether a babylon node should be exported or not\r\n * @param node source Babylon node. It is used to check whether it should be exported to glTF or not\r\n * @returns boolean, which indicates whether the node should be exported (true) or not (false)\r\n */\r\n shouldExportNode?(node: Node): boolean;\r\n\r\n /**\r\n * Function which indicates whether an animation on the scene should be exported or not\r\n * @param animation source animation\r\n * @returns boolean, which indicates whether the animation should be exported (true) or not (false)\r\n */\r\n shouldExportAnimation?(animation: Animation): boolean;\r\n\r\n /**\r\n * Function used to extract the part of node's metadata that will be exported into glTF node extras\r\n * @param metadata source metadata to read from\r\n * @returns the data to store to glTF node extras\r\n */\r\n metadataSelector?(metadata: any): any;\r\n\r\n /**\r\n * The sample rate to bake animation curves. Defaults to 1 / 60.\r\n */\r\n animationSampleRate?: number;\r\n\r\n /**\r\n * Begin serialization without waiting for the scene to be ready. Defaults to false.\r\n */\r\n exportWithoutWaitingForScene?: boolean;\r\n\r\n /**\r\n * Indicates if unused vertex uv attributes should be included in export. Defaults to false.\r\n */\r\n exportUnusedUVs?: boolean;\r\n\r\n /**\r\n * Remove no-op root nodes when possible. Defaults to true.\r\n */\r\n removeNoopRootNodes?: boolean;\r\n\r\n /**\r\n * Indicates if coordinate system swapping root nodes should be included in export. Defaults to false.\r\n * @deprecated Please use removeNoopRootNodes instead\r\n */\r\n includeCoordinateSystemConversionNodes?: boolean;\r\n}\r\n\r\n/**\r\n * Class for generating glTF data from a Babylon scene.\r\n */\r\nexport class GLTF2Export {\r\n /**\r\n * Exports the scene to .gltf file format\r\n * @param scene Babylon scene\r\n * @param fileName Name to use for the .gltf file\r\n * @param options Exporter options\r\n * @returns Returns the exported data\r\n */\r\n public static async GLTFAsync(scene: Scene, fileName: string, options?: IExportOptions): Promise<GLTFData> {\r\n if (!options || !options.exportWithoutWaitingForScene) {\r\n await scene.whenReadyAsync();\r\n }\r\n\r\n const exporter = new GLTFExporter(scene, options);\r\n const data = await exporter.generateGLTFAsync(fileName.replace(/\\.[^/.]+$/, \"\"));\r\n exporter.dispose();\r\n\r\n return data;\r\n }\r\n\r\n /**\r\n * Exports the scene to .glb file format\r\n * @param scene Babylon scene\r\n * @param fileName Name to use for the .glb file\r\n * @param options Exporter options\r\n * @returns Returns the exported data\r\n */\r\n public static async GLBAsync(scene: Scene, fileName: string, options?: IExportOptions): Promise<GLTFData> {\r\n if (!options || !options.exportWithoutWaitingForScene) {\r\n await scene.whenReadyAsync();\r\n }\r\n\r\n const exporter = new GLTFExporter(scene, options);\r\n const data = await exporter.generateGLBAsync(fileName.replace(/\\.[^/.]+$/, \"\"));\r\n exporter.dispose();\r\n\r\n return data;\r\n }\r\n}\r\n"]}
@@ -1,46 +1,78 @@
1
- import type { IBufferView, AccessorComponentType, IAccessor } from "babylonjs-gltf2interface";
2
- import { AccessorType } from "babylonjs-gltf2interface";
3
- import type { FloatArray, Nullable } from "@babylonjs/core/types.js";
1
+ import type { IBufferView, AccessorComponentType, IAccessor, INode } from "babylonjs-gltf2interface";
2
+ import { AccessorType, MeshPrimitiveMode } from "babylonjs-gltf2interface";
3
+ import type { FloatArray, DataArray, IndicesArray, Nullable } from "@babylonjs/core/types.js";
4
4
  import type { Vector4 } from "@babylonjs/core/Maths/math.vector.js";
5
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
5
+ import { Quaternion, Vector3 } from "@babylonjs/core/Maths/math.vector.js";
6
+ import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
7
+ import type { Node } from "@babylonjs/core/node.js";
6
8
  /**
7
- * @internal
9
+ * Creates a buffer view based on the supplied arguments
10
+ * @param bufferIndex index value of the specified buffer
11
+ * @param byteOffset byte offset value
12
+ * @param byteLength byte length of the bufferView
13
+ * @param byteStride byte distance between conequential elements
14
+ * @returns bufferView for glTF
8
15
  */
9
- export declare class _GLTFUtilities {
10
- /**
11
- * Creates a buffer view based on the supplied arguments
12
- * @param bufferIndex index value of the specified buffer
13
- * @param byteOffset byte offset value
14
- * @param byteLength byte length of the bufferView
15
- * @param byteStride byte distance between conequential elements
16
- * @param name name of the buffer view
17
- * @returns bufferView for glTF
18
- */
19
- static _CreateBufferView(bufferIndex: number, byteOffset: number, byteLength: number, byteStride?: number, name?: string): IBufferView;
20
- /**
21
- * Creates an accessor based on the supplied arguments
22
- * @param bufferviewIndex The index of the bufferview referenced by this accessor
23
- * @param name The name of the accessor
24
- * @param type The type of the accessor
25
- * @param componentType The datatype of components in the attribute
26
- * @param count The number of attributes referenced by this accessor
27
- * @param byteOffset The offset relative to the start of the bufferView in bytes
28
- * @param min Minimum value of each component in this attribute
29
- * @param max Maximum value of each component in this attribute
30
- * @returns accessor for glTF
31
- */
32
- static _CreateAccessor(bufferviewIndex: number, name: string, type: AccessorType, componentType: AccessorComponentType, count: number, byteOffset: Nullable<number>, min: Nullable<number[]>, max: Nullable<number[]>): IAccessor;
33
- /**
34
- * Calculates the minimum and maximum values of an array of position floats
35
- * @param positions Positions array of a mesh
36
- * @param vertexStart Starting vertex offset to calculate min and max values
37
- * @param vertexCount Number of vertices to check for min and max values
38
- * @returns min number array and max number array
39
- */
40
- static _CalculateMinMaxPositions(positions: FloatArray, vertexStart: number, vertexCount: number): {
41
- min: number[];
42
- max: number[];
43
- };
44
- static _NormalizeTangentFromRef(tangent: Vector4 | Vector3): void;
45
- static _GetDataAccessorElementCount(accessorType: AccessorType): 1 | 3 | 2 | 4 | 9 | 16;
46
- }
16
+ export declare function CreateBufferView(bufferIndex: number, byteOffset: number, byteLength: number, byteStride?: number): IBufferView;
17
+ /**
18
+ * Creates an accessor based on the supplied arguments
19
+ * @param bufferViewIndex The index of the bufferview referenced by this accessor
20
+ * @param type The type of the accessor
21
+ * @param componentType The datatype of components in the attribute
22
+ * @param count The number of attributes referenced by this accessor
23
+ * @param byteOffset The offset relative to the start of the bufferView in bytes
24
+ * @param minMax Minimum and maximum value of each component in this attribute
25
+ * @param normalized Specifies whether integer data values are normalized before usage
26
+ * @returns accessor for glTF
27
+ */
28
+ export declare function CreateAccessor(bufferViewIndex: number, type: AccessorType, componentType: AccessorComponentType, count: number, byteOffset: Nullable<number>, minMax?: Nullable<{
29
+ min: number[];
30
+ max: number[];
31
+ }>, normalized?: boolean): IAccessor;
32
+ export declare function GetAccessorElementCount(accessorType: AccessorType): number;
33
+ export declare function FloatsNeed16BitInteger(floatArray: FloatArray): boolean;
34
+ export declare function IsStandardVertexAttribute(type: string): boolean;
35
+ export declare function GetAccessorType(kind: string, hasVertexColorAlpha: boolean): AccessorType;
36
+ export declare function GetAttributeType(kind: string): string;
37
+ export declare function GetPrimitiveMode(fillMode: number): MeshPrimitiveMode;
38
+ export declare function IsTriangleFillMode(fillMode: number): boolean;
39
+ export declare function NormalizeTangent(tangent: Vector4 | Vector3): void;
40
+ export declare function ConvertToRightHandedPosition(value: Vector3): Vector3;
41
+ export declare function ConvertToRightHandedRotation(value: Quaternion): Quaternion;
42
+ export declare function ConvertToRightHandedNode(value: INode): void;
43
+ /**
44
+ * Rotation by 180 as glTF has a different convention than Babylon.
45
+ * @param rotation Target camera rotation.
46
+ * @returns Ref to camera rotation.
47
+ */
48
+ export declare function ConvertCameraRotationToGLTF(rotation: Quaternion): Quaternion;
49
+ export declare function RotateNode180Y(node: INode): void;
50
+ /**
51
+ * Collapses GLTF parent and node into a single node. This is useful for removing nodes that were added by the GLTF importer.
52
+ * @param node Target parent node.
53
+ * @param parentNode Original GLTF node (Light or Camera).
54
+ */
55
+ export declare function CollapseParentNode(node: INode, parentNode: INode): void;
56
+ /**
57
+ * Sometimes the GLTF Importer can add extra transform nodes (for lights and cameras). This checks if a parent node was added by the GLTF Importer. If so, it should be removed during serialization.
58
+ * @param babylonNode Original GLTF node (Light or Camera).
59
+ * @param parentBabylonNode Target parent node.
60
+ * @returns True if the parent node was added by the GLTF importer.
61
+ */
62
+ export declare function IsParentAddedByImporter(babylonNode: Node, parentBabylonNode: Node): boolean;
63
+ export declare function IsNoopNode(node: Node, useRightHandedSystem: boolean): boolean;
64
+ export declare function AreIndices32Bits(indices: Nullable<IndicesArray>, count: number): boolean;
65
+ export declare function IndicesArrayToUint8Array(indices: IndicesArray, start: number, count: number, is32Bits: boolean): Uint8Array;
66
+ export declare function DataArrayToUint8Array(data: DataArray): Uint8Array;
67
+ export declare function GetMinMax(data: DataArray, vertexBuffer: VertexBuffer, start: number, count: number): {
68
+ min: number[];
69
+ max: number[];
70
+ };
71
+ /**
72
+ * Removes, in-place, object properties which have the same value as the default value.
73
+ * Useful for avoiding unnecessary properties in the glTF JSON.
74
+ * @param object the object to omit default values from
75
+ * @param defaultValues a partial object with default values
76
+ * @returns object with default values omitted
77
+ */
78
+ export declare function OmitDefaultValues<T extends Object>(object: T, defaultValues: Partial<T>): T;