@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,63 +1,63 @@
|
|
|
1
|
-
import { _Exporter } from "./glTFExporter.js";
|
|
2
|
-
/**
|
|
3
|
-
* Class for generating glTF data from a Babylon scene.
|
|
4
|
-
*/
|
|
5
|
-
var GLTF2Export = /** @class */ (function () {
|
|
6
|
-
function GLTF2Export() {
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Exports the geometry of the scene to .gltf file format asynchronously
|
|
10
|
-
* @param scene Babylon scene with scene hierarchy information
|
|
11
|
-
* @param filePrefix File prefix to use when generating the glTF file
|
|
12
|
-
* @param options Exporter options
|
|
13
|
-
* @returns Returns an object with a .gltf file and associates texture names
|
|
14
|
-
* as keys and their data and paths as values
|
|
15
|
-
*/
|
|
16
|
-
GLTF2Export.GLTFAsync = function (scene, filePrefix, options) {
|
|
17
|
-
return scene.whenReadyAsync().then(function () {
|
|
18
|
-
var glTFPrefix = filePrefix.replace(/\.[^/.]+$/, "");
|
|
19
|
-
var gltfGenerator = new _Exporter(scene, options);
|
|
20
|
-
return gltfGenerator._generateGLTFAsync(glTFPrefix);
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
GLTF2Export._PreExportAsync = function (scene, options) {
|
|
24
|
-
return Promise.resolve().then(function () {
|
|
25
|
-
if (options && options.exportWithoutWaitingForScene) {
|
|
26
|
-
return Promise.resolve();
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return scene.whenReadyAsync();
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
GLTF2Export._PostExportAsync = function (scene, glTFData, options) {
|
|
34
|
-
return Promise.resolve().then(function () {
|
|
35
|
-
if (options && options.exportWithoutWaitingForScene) {
|
|
36
|
-
return glTFData;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return glTFData;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Exports the geometry of the scene to .glb file format asychronously
|
|
45
|
-
* @param scene Babylon scene with scene hierarchy information
|
|
46
|
-
* @param filePrefix File prefix to use when generating glb file
|
|
47
|
-
* @param options Exporter options
|
|
48
|
-
* @returns Returns an object with a .glb filename as key and data as value
|
|
49
|
-
*/
|
|
50
|
-
GLTF2Export.GLBAsync = function (scene, filePrefix, options) {
|
|
51
|
-
var _this = this;
|
|
52
|
-
return this._PreExportAsync(scene, options).then(function () {
|
|
53
|
-
var glTFPrefix = filePrefix.replace(/\.[^/.]+$/, "");
|
|
54
|
-
var gltfGenerator = new _Exporter(scene, options);
|
|
55
|
-
return gltfGenerator._generateGLBAsync(glTFPrefix).then(function (glTFData) {
|
|
56
|
-
return _this._PostExportAsync(scene, glTFData, options);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
return GLTF2Export;
|
|
61
|
-
}());
|
|
62
|
-
export { GLTF2Export };
|
|
1
|
+
import { _Exporter } from "./glTFExporter.js";
|
|
2
|
+
/**
|
|
3
|
+
* Class for generating glTF data from a Babylon scene.
|
|
4
|
+
*/
|
|
5
|
+
var GLTF2Export = /** @class */ (function () {
|
|
6
|
+
function GLTF2Export() {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Exports the geometry of the scene to .gltf file format asynchronously
|
|
10
|
+
* @param scene Babylon scene with scene hierarchy information
|
|
11
|
+
* @param filePrefix File prefix to use when generating the glTF file
|
|
12
|
+
* @param options Exporter options
|
|
13
|
+
* @returns Returns an object with a .gltf file and associates texture names
|
|
14
|
+
* as keys and their data and paths as values
|
|
15
|
+
*/
|
|
16
|
+
GLTF2Export.GLTFAsync = function (scene, filePrefix, options) {
|
|
17
|
+
return scene.whenReadyAsync().then(function () {
|
|
18
|
+
var glTFPrefix = filePrefix.replace(/\.[^/.]+$/, "");
|
|
19
|
+
var gltfGenerator = new _Exporter(scene, options);
|
|
20
|
+
return gltfGenerator._generateGLTFAsync(glTFPrefix);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
GLTF2Export._PreExportAsync = function (scene, options) {
|
|
24
|
+
return Promise.resolve().then(function () {
|
|
25
|
+
if (options && options.exportWithoutWaitingForScene) {
|
|
26
|
+
return Promise.resolve();
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return scene.whenReadyAsync();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
GLTF2Export._PostExportAsync = function (scene, glTFData, options) {
|
|
34
|
+
return Promise.resolve().then(function () {
|
|
35
|
+
if (options && options.exportWithoutWaitingForScene) {
|
|
36
|
+
return glTFData;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return glTFData;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Exports the geometry of the scene to .glb file format asychronously
|
|
45
|
+
* @param scene Babylon scene with scene hierarchy information
|
|
46
|
+
* @param filePrefix File prefix to use when generating glb file
|
|
47
|
+
* @param options Exporter options
|
|
48
|
+
* @returns Returns an object with a .glb filename as key and data as value
|
|
49
|
+
*/
|
|
50
|
+
GLTF2Export.GLBAsync = function (scene, filePrefix, options) {
|
|
51
|
+
var _this = this;
|
|
52
|
+
return this._PreExportAsync(scene, options).then(function () {
|
|
53
|
+
var glTFPrefix = filePrefix.replace(/\.[^/.]+$/, "");
|
|
54
|
+
var gltfGenerator = new _Exporter(scene, options);
|
|
55
|
+
return gltfGenerator._generateGLBAsync(glTFPrefix).then(function (glTFData) {
|
|
56
|
+
return _this._PostExportAsync(scene, glTFData, options);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return GLTF2Export;
|
|
61
|
+
}());
|
|
62
|
+
export { GLTF2Export };
|
|
63
63
|
//# sourceMappingURL=glTFSerializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glTFSerializer.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/glTFSerializer.ts"],"names":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AG,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACvD,IAAM,aAAa,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACpD,OAAO,aAAa,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAC,QAAQ;gBAC7D,OAAO,KAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IACL,kBAAC;AAAD,CAAC,AArDD,IAqDC","sourcesContent":["import { Node } from \"core/node\";\r\nimport { Scene } from \"core/scene\";\r\nimport { 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 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\r\n */\r\n animationSampleRate?: number;\r\n\r\n /**\r\n * Begin serialization without waiting for the scene to be ready\r\n */\r\n exportWithoutWaitingForScene?: boolean;\r\n\r\n /**\r\n * Indicates if unused vertex uv attributes should be included in export\r\n */\r\n exportUnusedUVs?: boolean;\r\n\r\n /**\r\n * Indicates if coordinate system swapping root nodes should be included in export\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":["../../../../../../lts/serializers/generated/glTF/2.0/glTFSerializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,S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AAW,EAAE,EAAE,CAAC,CAAC;YACvD,IAAM,aAAa,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACpD,OAAO,aAAa,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAC,QAAQ;gBAC7D,OAAO,KAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IACL,kBAAC;AAAD,CAAC,AArDD,IAqDC","sourcesContent":["import type { Node } from \"core/node\";\r\nimport type { Scene } from \"core/scene\";\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 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\r\n */\r\n animationSampleRate?: number;\r\n\r\n /**\r\n * Begin serialization without waiting for the scene to be ready\r\n */\r\n exportWithoutWaitingForScene?: boolean;\r\n\r\n /**\r\n * Indicates if unused vertex uv attributes should be included in export\r\n */\r\n exportUnusedUVs?: boolean;\r\n\r\n /**\r\n * Indicates if coordinate system swapping root nodes should be included in export\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,97 +1,99 @@
|
|
|
1
|
-
import { IBufferView,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
static
|
|
97
|
-
|
|
1
|
+
import type { IBufferView, AccessorComponentType, IAccessor } from "babylonjs-gltf2interface/.js";
|
|
2
|
+
import { AccessorType } from "babylonjs-gltf2interface/.js";
|
|
3
|
+
import type { FloatArray, Nullable } from "@babylonjs/core/types.js";
|
|
4
|
+
import type { Vector4, Quaternion } from "@babylonjs/core/Maths/math.vector.js";
|
|
5
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
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
|
+
* @param convertToRightHandedSystem
|
|
39
|
+
* @returns min number array and max number array
|
|
40
|
+
*/
|
|
41
|
+
static _CalculateMinMaxPositions(positions: FloatArray, vertexStart: number, vertexCount: number, convertToRightHandedSystem: boolean): {
|
|
42
|
+
min: number[];
|
|
43
|
+
max: number[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Converts a new right-handed Vector3
|
|
47
|
+
* @param vector vector3 array
|
|
48
|
+
* @returns right-handed Vector3
|
|
49
|
+
*/
|
|
50
|
+
static _GetRightHandedPositionVector3(vector: Vector3): Vector3;
|
|
51
|
+
/**
|
|
52
|
+
* Converts a Vector3 to right-handed
|
|
53
|
+
* @param vector Vector3 to convert to right-handed
|
|
54
|
+
*/
|
|
55
|
+
static _GetRightHandedPositionVector3FromRef(vector: Vector3): void;
|
|
56
|
+
/**
|
|
57
|
+
* Converts a three element number array to right-handed
|
|
58
|
+
* @param vector number array to convert to right-handed
|
|
59
|
+
*/
|
|
60
|
+
static _GetRightHandedPositionArray3FromRef(vector: number[]): void;
|
|
61
|
+
/**
|
|
62
|
+
* Converts a new right-handed Vector3
|
|
63
|
+
* @param vector vector3 array
|
|
64
|
+
* @returns right-handed Vector3
|
|
65
|
+
*/
|
|
66
|
+
static _GetRightHandedNormalVector3(vector: Vector3): Vector3;
|
|
67
|
+
/**
|
|
68
|
+
* Converts a Vector3 to right-handed
|
|
69
|
+
* @param vector Vector3 to convert to right-handed
|
|
70
|
+
*/
|
|
71
|
+
static _GetRightHandedNormalVector3FromRef(vector: Vector3): void;
|
|
72
|
+
/**
|
|
73
|
+
* Converts a three element number array to right-handed
|
|
74
|
+
* @param vector number array to convert to right-handed
|
|
75
|
+
*/
|
|
76
|
+
static _GetRightHandedNormalArray3FromRef(vector: number[]): void;
|
|
77
|
+
/**
|
|
78
|
+
* Converts a Vector4 to right-handed
|
|
79
|
+
* @param vector Vector4 to convert to right-handed
|
|
80
|
+
*/
|
|
81
|
+
static _GetRightHandedVector4FromRef(vector: Vector4): void;
|
|
82
|
+
/**
|
|
83
|
+
* Converts a Vector4 to right-handed
|
|
84
|
+
* @param vector Vector4 to convert to right-handed
|
|
85
|
+
*/
|
|
86
|
+
static _GetRightHandedArray4FromRef(vector: number[]): void;
|
|
87
|
+
/**
|
|
88
|
+
* Converts a Quaternion to right-handed
|
|
89
|
+
* @param quaternion Source quaternion to convert to right-handed
|
|
90
|
+
*/
|
|
91
|
+
static _GetRightHandedQuaternionFromRef(quaternion: Quaternion): void;
|
|
92
|
+
/**
|
|
93
|
+
* Converts a Quaternion to right-handed
|
|
94
|
+
* @param quaternion Source quaternion to convert to right-handed
|
|
95
|
+
*/
|
|
96
|
+
static _GetRightHandedQuaternionArrayFromRef(quaternion: number[]): void;
|
|
97
|
+
static _NormalizeTangentFromRef(tangent: Vector4): void;
|
|
98
|
+
static _GetDataAccessorElementCount(accessorType: AccessorType): 1 | 3 | 2 | 4 | 9 | 16;
|
|
99
|
+
}
|