@babylonjs/serializers 5.0.0-rc.9 → 5.0.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.
- package/OBJ/objSerializer.d.ts +1 -1
- package/OBJ/objSerializer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +4 -4
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +2 -2
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +4 -4
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +4 -4
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +3 -3
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +3 -3
- package/glTF/2.0/Extensions/KHR_texture_transform.js +2 -2
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/index.js +5 -5
- package/glTF/2.0/glTFAnimation.d.ts +6 -5
- package/glTF/2.0/glTFAnimation.js +1 -1
- package/glTF/2.0/glTFAnimation.js.map +1 -1
- package/glTF/2.0/glTFExporter.d.ts +11 -10
- package/glTF/2.0/glTFExporter.js +34 -31
- package/glTF/2.0/glTFExporter.js.map +1 -1
- package/glTF/2.0/glTFExporterExtension.d.ts +10 -10
- package/glTF/2.0/glTFExporterExtension.js.map +1 -1
- package/glTF/2.0/glTFMaterialExporter.d.ts +5 -4
- package/glTF/2.0/glTFMaterialExporter.js +1 -1
- package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
- package/glTF/2.0/glTFSerializer.d.ts +3 -3
- package/glTF/2.0/glTFSerializer.js +1 -1
- package/glTF/2.0/glTFSerializer.js.map +1 -1
- package/glTF/2.0/glTFUtilities.d.ts +5 -3
- package/glTF/2.0/glTFUtilities.js.map +1 -1
- package/glTF/2.0/index.js +9 -8
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/index.js +3 -2
- package/glTF/index.js.map +1 -1
- package/index.js +4 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF2Serializer.d.ts +2 -2
- package/legacy/legacy-glTF2Serializer.js +8 -7
- package/legacy/legacy-glTF2Serializer.js.map +1 -1
- package/legacy/legacy-objSerializer.d.ts +1 -1
- package/legacy/legacy-objSerializer.js +3 -2
- package/legacy/legacy-objSerializer.js.map +1 -1
- package/legacy/legacy-stlSerializer.d.ts +1 -1
- package/legacy/legacy-stlSerializer.js +3 -2
- package/legacy/legacy-stlSerializer.js.map +1 -1
- package/legacy/legacy.d.ts +1 -1
- package/legacy/legacy.js +5 -4
- package/legacy/legacy.js.map +1 -1
- package/license.md +71 -0
- package/package.json +25 -6
- package/stl/index.js +1 -1
- package/stl/stlSerializer.d.ts +1 -1
- package/stl/stlSerializer.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glTFSerializer.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/glTFSerializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAyC3C;;GAEG;AACH;IAAA;IAqDA,CAAC;IApDG;;;;;;;OAOG;IACW,qBAAS,GAAvB,UAAwB,KAAY,EAAE,UAAkB,EAAE,OAAwB;QAC9E,OAAO,KAAK,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC;YAC/B,IAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACvD,IAAM,aAAa,GAAG,IAAI,SAAS,CAAC,KA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L,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,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAyC3C;;GAEG;AACH;IAAA;IAqDA,CAAC;IApDG;;;;;;;OAOG;IACW,qBAAS,GAAvB,UAAwB,KAAY,EAAE,UAAkB,EAAE,OAAwB;QAC9E,OAAO,KAAK,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC;YAC/B,IAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACvD,IAAM,aAAa,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;Y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AqDC","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,6 +1,8 @@
|
|
|
1
|
-
import { IBufferView,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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";
|
|
4
6
|
/**
|
|
5
7
|
* @hidden
|
|
6
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glTFUtilities.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/glTFUtilities.ts"],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D,UAAoD,UAAoB;QACpE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACpB,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACxB,CAAC;IAEa,uCAAwB,GAAtC,UAAuC,OAAgB;QACnD,IAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAChG,IAAI,MAAM,GAAG,CAAC,EAAE;YACZ,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC;YACpB,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC;YACpB,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC;SACvB;IACL,CAAC;IAEa,2CAA4B,GAA1C,UAA2C,YAA0B;QACjE,QAAQ,YAAY,EAAE;YAClB;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,EAAE,CAAC;YACd;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;SAChB;IACL,CAAC;IACL,qBAAC;AAAD,CAAC,AA7ND,IA6NC","sourcesContent":["import { IBufferView, AccessorType, AccessorComponentType, IAccessor } from \"babylonjs-gltf2interface\";\r\n\r\nimport { FloatArray, Nullable } from \"core/types\";\r\nimport { Vector3, Vector4, Quaternion } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport class _GLTFUtilities {\r\n /**\r\n * Creates a buffer view based on the supplied arguments\r\n * @param bufferIndex index value of the specified buffer\r\n * @param byteOffset byte offset value\r\n * @param byteLength byte length of the bufferView\r\n * @param byteStride byte distance between conequential elements\r\n * @param name name of the buffer view\r\n * @returns bufferView for glTF\r\n */\r\n public static _CreateBufferView(bufferIndex: number, byteOffset: number, byteLength: number, byteStride?: number, name?: string): IBufferView {\r\n const bufferview: IBufferView = { buffer: bufferIndex, byteLength: byteLength };\r\n if (byteOffset) {\r\n bufferview.byteOffset = byteOffset;\r\n }\r\n if (name) {\r\n bufferview.name = name;\r\n }\r\n if (byteStride) {\r\n bufferview.byteStride = byteStride;\r\n }\r\n\r\n return bufferview;\r\n }\r\n\r\n /**\r\n * Creates an accessor based on the supplied arguments\r\n * @param bufferviewIndex The index of the bufferview referenced by this accessor\r\n * @param name The name of the accessor\r\n * @param type The type of the accessor\r\n * @param componentType The datatype of components in the attribute\r\n * @param count The number of attributes referenced by this accessor\r\n * @param byteOffset The offset relative to the start of the bufferView in bytes\r\n * @param min Minimum value of each component in this attribute\r\n * @param max Maximum value of each component in this attribute\r\n * @returns accessor for glTF\r\n */\r\n public static _CreateAccessor(\r\n bufferviewIndex: number,\r\n name: string,\r\n type: AccessorType,\r\n componentType: AccessorComponentType,\r\n count: number,\r\n byteOffset: Nullable<number>,\r\n min: Nullable<number[]>,\r\n max: Nullable<number[]>\r\n ): IAccessor {\r\n const accessor: IAccessor = { name: name, bufferView: bufferviewIndex, componentType: componentType, count: count, type: type };\r\n\r\n if (min != null) {\r\n accessor.min = min;\r\n }\r\n if (max != null) {\r\n accessor.max = max;\r\n }\r\n if (byteOffset != null) {\r\n accessor.byteOffset = byteOffset;\r\n }\r\n\r\n return accessor;\r\n }\r\n\r\n /**\r\n * Calculates the minimum and maximum values of an array of position floats\r\n * @param positions Positions array of a mesh\r\n * @param vertexStart Starting vertex offset to calculate min and max values\r\n * @param vertexCount Number of vertices to check for min and max values\r\n * @param convertToRightHandedSystem\r\n * @returns min number array and max number array\r\n */\r\n public static _CalculateMinMaxPositions(\r\n positions: FloatArray,\r\n vertexStart: number,\r\n vertexCount: number,\r\n convertToRightHandedSystem: boolean\r\n ): { min: number[]; max: number[] } {\r\n const min = [Infinity, Infinity, Infinity];\r\n const max = [-Infinity, -Infinity, -Infinity];\r\n const positionStrideSize = 3;\r\n let indexOffset: number;\r\n let position: Vector3;\r\n let vector: number[];\r\n\r\n if (vertexCount) {\r\n for (let i = vertexStart, length = vertexStart + vertexCount; i < length; ++i) {\r\n indexOffset = positionStrideSize * i;\r\n\r\n position = Vector3.FromArray(positions, indexOffset);\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedPositionVector3FromRef(position);\r\n }\r\n vector = position.asArray();\r\n\r\n for (let j = 0; j < positionStrideSize; ++j) {\r\n const num = vector[j];\r\n if (num < min[j]) {\r\n min[j] = num;\r\n }\r\n if (num > max[j]) {\r\n max[j] = num;\r\n }\r\n ++indexOffset;\r\n }\r\n }\r\n }\r\n return { min, max };\r\n }\r\n\r\n /**\r\n * Converts a new right-handed Vector3\r\n * @param vector vector3 array\r\n * @returns right-handed Vector3\r\n */\r\n public static _GetRightHandedPositionVector3(vector: Vector3): Vector3 {\r\n return new Vector3(vector.x, vector.y, -vector.z);\r\n }\r\n\r\n /**\r\n * Converts a Vector3 to right-handed\r\n * @param vector Vector3 to convert to right-handed\r\n */\r\n public static _GetRightHandedPositionVector3FromRef(vector: Vector3) {\r\n vector.z *= -1;\r\n }\r\n\r\n /**\r\n * Converts a three element number array to right-handed\r\n * @param vector number array to convert to right-handed\r\n */\r\n public static _GetRightHandedPositionArray3FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a new right-handed Vector3\r\n * @param vector vector3 array\r\n * @returns right-handed Vector3\r\n */\r\n public static _GetRightHandedNormalVector3(vector: Vector3): Vector3 {\r\n return new Vector3(vector.x, vector.y, -vector.z);\r\n }\r\n\r\n /**\r\n * Converts a Vector3 to right-handed\r\n * @param vector Vector3 to convert to right-handed\r\n */\r\n public static _GetRightHandedNormalVector3FromRef(vector: Vector3) {\r\n vector.z *= -1;\r\n }\r\n\r\n /**\r\n * Converts a three element number array to right-handed\r\n * @param vector number array to convert to right-handed\r\n */\r\n public static _GetRightHandedNormalArray3FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Vector4 to right-handed\r\n * @param vector Vector4 to convert to right-handed\r\n */\r\n public static _GetRightHandedVector4FromRef(vector: Vector4) {\r\n vector.z *= -1;\r\n vector.w *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Vector4 to right-handed\r\n * @param vector Vector4 to convert to right-handed\r\n */\r\n public static _GetRightHandedArray4FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n vector[3] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Quaternion to right-handed\r\n * @param quaternion Source quaternion to convert to right-handed\r\n */\r\n public static _GetRightHandedQuaternionFromRef(quaternion: Quaternion) {\r\n quaternion.x *= -1;\r\n quaternion.y *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Quaternion to right-handed\r\n * @param quaternion Source quaternion to convert to right-handed\r\n */\r\n public static _GetRightHandedQuaternionArrayFromRef(quaternion: number[]) {\r\n quaternion[0] *= -1;\r\n quaternion[1] *= -1;\r\n }\r\n\r\n public static _NormalizeTangentFromRef(tangent: Vector4) {\r\n const length = Math.sqrt(tangent.x * tangent.x + tangent.y * tangent.y + tangent.z * tangent.z);\r\n if (length > 0) {\r\n tangent.x /= length;\r\n tangent.y /= length;\r\n tangent.z /= length;\r\n }\r\n }\r\n\r\n public static _GetDataAccessorElementCount(accessorType: AccessorType) {\r\n switch (accessorType) {\r\n case AccessorType.MAT2:\r\n return 4;\r\n case AccessorType.MAT3:\r\n return 9;\r\n case AccessorType.MAT4:\r\n return 16;\r\n case AccessorType.SCALAR:\r\n return 1;\r\n case AccessorType.VEC2:\r\n return 2;\r\n case AccessorType.VEC3:\r\n return 3;\r\n case AccessorType.VEC4:\r\n return 4;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"glTFUtilities.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/glTFUtilities.ts"],"names":[],"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,UAAoB;QACpE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACpB,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACxB,CAAC;IAEa,uCAAwB,GAAtC,UAAuC,OAAgB;QACnD,IAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAChG,IAAI,MAAM,GAAG,CAAC,EAAE;YACZ,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC;YACpB,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC;YACpB,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC;SACvB;IACL,CAAC;IAEa,2CAA4B,GAA1C,UAA2C,YAA0B;QACjE,QAAQ,YAAY,EAAE;YAClB;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,EAAE,CAAC;YACd;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;YACb;gBACI,OAAO,CAAC,CAAC;SAChB;IACL,CAAC;IACL,qBAAC;AAAD,CAAC,AA7ND,IA6NC","sourcesContent":["import type { IBufferView, AccessorComponentType, IAccessor } from \"babylonjs-gltf2interface\";\r\nimport { AccessorType } from \"babylonjs-gltf2interface\";\r\n\r\nimport type { FloatArray, Nullable } from \"core/types\";\r\nimport type { Vector4, Quaternion } from \"core/Maths/math.vector\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport class _GLTFUtilities {\r\n /**\r\n * Creates a buffer view based on the supplied arguments\r\n * @param bufferIndex index value of the specified buffer\r\n * @param byteOffset byte offset value\r\n * @param byteLength byte length of the bufferView\r\n * @param byteStride byte distance between conequential elements\r\n * @param name name of the buffer view\r\n * @returns bufferView for glTF\r\n */\r\n public static _CreateBufferView(bufferIndex: number, byteOffset: number, byteLength: number, byteStride?: number, name?: string): IBufferView {\r\n const bufferview: IBufferView = { buffer: bufferIndex, byteLength: byteLength };\r\n if (byteOffset) {\r\n bufferview.byteOffset = byteOffset;\r\n }\r\n if (name) {\r\n bufferview.name = name;\r\n }\r\n if (byteStride) {\r\n bufferview.byteStride = byteStride;\r\n }\r\n\r\n return bufferview;\r\n }\r\n\r\n /**\r\n * Creates an accessor based on the supplied arguments\r\n * @param bufferviewIndex The index of the bufferview referenced by this accessor\r\n * @param name The name of the accessor\r\n * @param type The type of the accessor\r\n * @param componentType The datatype of components in the attribute\r\n * @param count The number of attributes referenced by this accessor\r\n * @param byteOffset The offset relative to the start of the bufferView in bytes\r\n * @param min Minimum value of each component in this attribute\r\n * @param max Maximum value of each component in this attribute\r\n * @returns accessor for glTF\r\n */\r\n public static _CreateAccessor(\r\n bufferviewIndex: number,\r\n name: string,\r\n type: AccessorType,\r\n componentType: AccessorComponentType,\r\n count: number,\r\n byteOffset: Nullable<number>,\r\n min: Nullable<number[]>,\r\n max: Nullable<number[]>\r\n ): IAccessor {\r\n const accessor: IAccessor = { name: name, bufferView: bufferviewIndex, componentType: componentType, count: count, type: type };\r\n\r\n if (min != null) {\r\n accessor.min = min;\r\n }\r\n if (max != null) {\r\n accessor.max = max;\r\n }\r\n if (byteOffset != null) {\r\n accessor.byteOffset = byteOffset;\r\n }\r\n\r\n return accessor;\r\n }\r\n\r\n /**\r\n * Calculates the minimum and maximum values of an array of position floats\r\n * @param positions Positions array of a mesh\r\n * @param vertexStart Starting vertex offset to calculate min and max values\r\n * @param vertexCount Number of vertices to check for min and max values\r\n * @param convertToRightHandedSystem\r\n * @returns min number array and max number array\r\n */\r\n public static _CalculateMinMaxPositions(\r\n positions: FloatArray,\r\n vertexStart: number,\r\n vertexCount: number,\r\n convertToRightHandedSystem: boolean\r\n ): { min: number[]; max: number[] } {\r\n const min = [Infinity, Infinity, Infinity];\r\n const max = [-Infinity, -Infinity, -Infinity];\r\n const positionStrideSize = 3;\r\n let indexOffset: number;\r\n let position: Vector3;\r\n let vector: number[];\r\n\r\n if (vertexCount) {\r\n for (let i = vertexStart, length = vertexStart + vertexCount; i < length; ++i) {\r\n indexOffset = positionStrideSize * i;\r\n\r\n position = Vector3.FromArray(positions, indexOffset);\r\n if (convertToRightHandedSystem) {\r\n _GLTFUtilities._GetRightHandedPositionVector3FromRef(position);\r\n }\r\n vector = position.asArray();\r\n\r\n for (let j = 0; j < positionStrideSize; ++j) {\r\n const num = vector[j];\r\n if (num < min[j]) {\r\n min[j] = num;\r\n }\r\n if (num > max[j]) {\r\n max[j] = num;\r\n }\r\n ++indexOffset;\r\n }\r\n }\r\n }\r\n return { min, max };\r\n }\r\n\r\n /**\r\n * Converts a new right-handed Vector3\r\n * @param vector vector3 array\r\n * @returns right-handed Vector3\r\n */\r\n public static _GetRightHandedPositionVector3(vector: Vector3): Vector3 {\r\n return new Vector3(vector.x, vector.y, -vector.z);\r\n }\r\n\r\n /**\r\n * Converts a Vector3 to right-handed\r\n * @param vector Vector3 to convert to right-handed\r\n */\r\n public static _GetRightHandedPositionVector3FromRef(vector: Vector3) {\r\n vector.z *= -1;\r\n }\r\n\r\n /**\r\n * Converts a three element number array to right-handed\r\n * @param vector number array to convert to right-handed\r\n */\r\n public static _GetRightHandedPositionArray3FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a new right-handed Vector3\r\n * @param vector vector3 array\r\n * @returns right-handed Vector3\r\n */\r\n public static _GetRightHandedNormalVector3(vector: Vector3): Vector3 {\r\n return new Vector3(vector.x, vector.y, -vector.z);\r\n }\r\n\r\n /**\r\n * Converts a Vector3 to right-handed\r\n * @param vector Vector3 to convert to right-handed\r\n */\r\n public static _GetRightHandedNormalVector3FromRef(vector: Vector3) {\r\n vector.z *= -1;\r\n }\r\n\r\n /**\r\n * Converts a three element number array to right-handed\r\n * @param vector number array to convert to right-handed\r\n */\r\n public static _GetRightHandedNormalArray3FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Vector4 to right-handed\r\n * @param vector Vector4 to convert to right-handed\r\n */\r\n public static _GetRightHandedVector4FromRef(vector: Vector4) {\r\n vector.z *= -1;\r\n vector.w *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Vector4 to right-handed\r\n * @param vector Vector4 to convert to right-handed\r\n */\r\n public static _GetRightHandedArray4FromRef(vector: number[]) {\r\n vector[2] *= -1;\r\n vector[3] *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Quaternion to right-handed\r\n * @param quaternion Source quaternion to convert to right-handed\r\n */\r\n public static _GetRightHandedQuaternionFromRef(quaternion: Quaternion) {\r\n quaternion.x *= -1;\r\n quaternion.y *= -1;\r\n }\r\n\r\n /**\r\n * Converts a Quaternion to right-handed\r\n * @param quaternion Source quaternion to convert to right-handed\r\n */\r\n public static _GetRightHandedQuaternionArrayFromRef(quaternion: number[]) {\r\n quaternion[0] *= -1;\r\n quaternion[1] *= -1;\r\n }\r\n\r\n public static _NormalizeTangentFromRef(tangent: Vector4) {\r\n const length = Math.sqrt(tangent.x * tangent.x + tangent.y * tangent.y + tangent.z * tangent.z);\r\n if (length > 0) {\r\n tangent.x /= length;\r\n tangent.y /= length;\r\n tangent.z /= length;\r\n }\r\n }\r\n\r\n public static _GetDataAccessorElementCount(accessorType: AccessorType) {\r\n switch (accessorType) {\r\n case AccessorType.MAT2:\r\n return 4;\r\n case AccessorType.MAT3:\r\n return 9;\r\n case AccessorType.MAT4:\r\n return 16;\r\n case AccessorType.SCALAR:\r\n return 1;\r\n case AccessorType.VEC2:\r\n return 2;\r\n case AccessorType.VEC3:\r\n return 3;\r\n case AccessorType.VEC4:\r\n return 4;\r\n }\r\n }\r\n}\r\n"]}
|
package/glTF/2.0/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
1
|
+
/* eslint-disable import/no-internal-modules */
|
|
2
|
+
export * from "./glTFAnimation.js";
|
|
3
|
+
export * from "./glTFData.js";
|
|
4
|
+
export * from "./glTFExporter.js";
|
|
5
|
+
export * from "./glTFExporterExtension.js";
|
|
6
|
+
export * from "./glTFMaterialExporter.js";
|
|
7
|
+
export * from "./glTFSerializer.js";
|
|
8
|
+
export * from "./glTFUtilities.js";
|
|
9
|
+
export * from "./Extensions/index.js";
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/glTF/2.0/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./glTFAnimation\";\r\nexport * from \"./glTFData\";\r\nexport * from \"./glTFExporter\";\r\nexport * from \"./glTFExporterExtension\";\r\nexport * from \"./glTFMaterialExporter\";\r\nexport * from \"./glTFSerializer\";\r\nexport * from \"./glTFUtilities\";\r\nexport * from \"./Extensions/index\";\r\n"]}
|
package/glTF/index.js
CHANGED
package/glTF/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/glTF/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/glTF/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./glTFFileExporter\";\r\nexport * from \"./2.0/index\";\r\n"]}
|
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
1
|
+
/* eslint-disable import/no-internal-modules */
|
|
2
|
+
export * from "./OBJ/index.js";
|
|
3
|
+
export * from "./glTF/index.js";
|
|
4
|
+
export * from "./stl/index.js";
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lts/serializers/generated/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lts/serializers/generated/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./OBJ/index\";\r\nexport * from \"./glTF/index\";\r\nexport * from \"./stl/index\";\r\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "
|
|
2
|
-
export * from "
|
|
1
|
+
export * from "../glTF/glTFFileExporter";
|
|
2
|
+
export * from "../glTF/2.0/index";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
1
|
+
/* eslint-disable import/no-internal-modules */
|
|
2
|
+
import * as Exporters from "../glTF/glTFFileExporter.js";
|
|
3
|
+
import * as Datas from "../glTF/2.0/glTFData.js";
|
|
4
|
+
import * as Serializers from "../glTF/2.0/glTFSerializer.js";
|
|
5
|
+
import * as Extensions from "../glTF/2.0/Extensions/index.js";
|
|
6
|
+
import * as GLTF2 from "../glTF/2.0/index.js";
|
|
6
7
|
/**
|
|
7
8
|
* This is the entry point for the UMD module.
|
|
8
9
|
* The entry point for a future ESM package should be index.ts
|
|
@@ -39,6 +40,6 @@ if (typeof globalObject !== "undefined") {
|
|
|
39
40
|
BABYLON_1.GLTF2.Exporter[key] = GLTF2[key];
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
export * from "
|
|
43
|
-
export * from "
|
|
43
|
+
export * from "../glTF/glTFFileExporter.js";
|
|
44
|
+
export * from "../glTF/2.0/index.js";
|
|
44
45
|
//# sourceMappingURL=legacy-glTF2Serializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-glTF2Serializer.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/legacy/legacy-glTF2Serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"legacy-glTF2Serializer.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/legacy/legacy-glTF2Serializer.ts"],"names":[],"mappings":"AAAA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GAAG,IAAI,WAAW,EAAE;QAC3B,SAAO,CAAC,GAAG,CAAC,GAAS,WAAY,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAClB;IACD,KAAK,IAAM,GAAG,IAAI,UAAU,EAAE;QAC1B,SAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,GAAS,UAAW,CAAC,GAAG,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAClB;IACD,KAAK,IAAM,GAAG,IAAI,KAAK,EAAE;QACrB,wBAAwB;QACxB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;YACxB,SAAS;SACZ;QACD,SAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAS,KAAM,CAAC,GAAG,CAAC,CAAC;KACnD;CACJ;AACD,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as Exporters from \"../glTF/glTFFileExporter\";\nimport * as Datas from \"../glTF/2.0/glTFData\";\nimport * as Serializers from \"../glTF/2.0/glTFSerializer\";\nimport * as Extensions from \"../glTF/2.0/Extensions/index\";\nimport * as GLTF2 from \"../glTF/2.0/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n (<any>globalObject).BABYLON = (<any>globalObject).BABYLON || {};\n const BABYLON = (<any>globalObject).BABYLON;\n BABYLON.GLTF2 = BABYLON.GLTF2 || {};\n BABYLON.GLTF2.Exporter = BABYLON.GLTF2.Exporter || {};\n BABYLON.GLTF2.Exporter.Extensions = BABYLON.GLTF2.Exporter.Extensions || {};\n const keys = [];\n for (const key in Exporters) {\n BABYLON[key] = (<any>Exporters)[key];\n keys.push(key);\n }\n for (const key in Datas) {\n BABYLON[key] = (<any>Datas)[key];\n keys.push(key);\n }\n for (const key in Serializers) {\n BABYLON[key] = (<any>Serializers)[key];\n keys.push(key);\n }\n for (const key in Extensions) {\n BABYLON.GLTF2.Exporter.Extensions[key] = (<any>Extensions)[key];\n keys.push(key);\n }\n for (const key in GLTF2) {\n // Prevent Reassignment.\n if (keys.indexOf(key) > -1) {\n continue;\n }\n BABYLON.GLTF2.Exporter[key] = (<any>GLTF2)[key];\n }\n}\nexport * from \"../glTF/glTFFileExporter\";\nexport * from \"../glTF/2.0/index\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "../OBJ/index";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable import/no-internal-modules */
|
|
2
|
+
import * as Serializers from "../OBJ/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* This is the entry point for the UMD module.
|
|
4
5
|
* The entry point for a future ESM package should be index.ts
|
|
@@ -9,5 +10,5 @@ if (typeof globalObject !== "undefined") {
|
|
|
9
10
|
globalObject.BABYLON[serializer] = Serializers[serializer];
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
|
-
export * from "
|
|
13
|
+
export * from "../OBJ/index.js";
|
|
13
14
|
//# sourceMappingURL=legacy-objSerializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-objSerializer.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/legacy/legacy-objSerializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"legacy-objSerializer.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/legacy/legacy-objSerializer.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAC5C;;;GAGG;AACH,IAAM,YAAY,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACrC,KAAK,IAAM,UAAU,IAAI,WAAW,EAAE;QAC5B,YAAa,CAAC,OAAO,CAAC,UAAU,CAAC,GAAS,WAAY,CAAC,UAAU,CAAC,CAAC;KAC5E;CACJ;AACD,cAAc,cAAc,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as Serializers from \"../OBJ/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const serializer in Serializers) {\n (<any>globalObject).BABYLON[serializer] = (<any>Serializers)[serializer];\n }\n}\nexport * from \"../OBJ/index\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "../stl/index";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable import/no-internal-modules */
|
|
2
|
+
import * as Serializers from "../stl/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* This is the entry point for the UMD module.
|
|
4
5
|
* The entry point for a future ESM package should be index.ts
|
|
@@ -9,5 +10,5 @@ if (typeof globalObject !== "undefined") {
|
|
|
9
10
|
globalObject.BABYLON[serializer] = Serializers[serializer];
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
|
-
export * from "
|
|
13
|
+
export * from "../stl/index.js";
|
|
13
14
|
//# sourceMappingURL=legacy-stlSerializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-stlSerializer.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/legacy/legacy-stlSerializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"legacy-stlSerializer.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/legacy/legacy-stlSerializer.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAC5C;;;GAGG;AACH,IAAM,YAAY,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACrC,KAAK,IAAM,UAAU,IAAI,WAAW,EAAE;QAC5B,YAAa,CAAC,OAAO,CAAC,UAAU,CAAC,GAAS,WAAY,CAAC,UAAU,CAAC,CAAC;KAC5E;CACJ;AACD,cAAc,cAAc,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as Serializers from \"../stl/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const serializer in Serializers) {\n (<any>globalObject).BABYLON[serializer] = (<any>Serializers)[serializer];\n }\n}\nexport * from \"../stl/index\";\n"]}
|
package/legacy/legacy.d.ts
CHANGED
package/legacy/legacy.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export * from "./legacy-
|
|
5
|
-
export * from "./legacy-
|
|
2
|
+
/* eslint-disable import/no-internal-modules */
|
|
3
|
+
import "../index.js";
|
|
4
|
+
export * from "./legacy-glTF2Serializer.js";
|
|
5
|
+
export * from "./legacy-objSerializer.js";
|
|
6
|
+
export * from "./legacy-stlSerializer.js";
|
|
6
7
|
//# sourceMappingURL=legacy.js.map
|
package/legacy/legacy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/legacy/legacy.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,
|
|
1
|
+
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/legacy/legacy.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,+CAA+C;AAC/C,OAAO,UAAU,CAAC;AAClB,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC","sourcesContent":["/* eslint-disable import/export */\n/* eslint-disable import/no-internal-modules */\nimport \"../index\";\nexport * from \"./legacy-glTF2Serializer\";\nexport * from \"./legacy-objSerializer\";\nexport * from \"./legacy-stlSerializer\";\n"]}
|
package/license.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Apache License 2.0 (Apache)
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
<http://www.apache.org/licenses/>
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
## Definitions
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
16
|
+
|
|
17
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
18
|
+
|
|
19
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
20
|
+
|
|
21
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
22
|
+
|
|
23
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
24
|
+
|
|
25
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
26
|
+
|
|
27
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
28
|
+
|
|
29
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
30
|
+
|
|
31
|
+
## Grant of Copyright License
|
|
32
|
+
|
|
33
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
34
|
+
|
|
35
|
+
## Grant of Patent License
|
|
36
|
+
|
|
37
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
38
|
+
|
|
39
|
+
## Redistribution
|
|
40
|
+
|
|
41
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
42
|
+
|
|
43
|
+
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
44
|
+
|
|
45
|
+
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
46
|
+
|
|
47
|
+
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
48
|
+
|
|
49
|
+
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
50
|
+
|
|
51
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
52
|
+
|
|
53
|
+
## Submission of Contributions
|
|
54
|
+
|
|
55
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
56
|
+
|
|
57
|
+
## Trademarks
|
|
58
|
+
|
|
59
|
+
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
60
|
+
|
|
61
|
+
## Disclaimer of Warranty
|
|
62
|
+
|
|
63
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
64
|
+
|
|
65
|
+
## Limitation of Liability
|
|
66
|
+
|
|
67
|
+
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
68
|
+
|
|
69
|
+
## Accepting Warranty or Additional Liability
|
|
70
|
+
|
|
71
|
+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babylonjs/serializers",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -8,18 +8,19 @@
|
|
|
8
8
|
"**/*.js",
|
|
9
9
|
"**/*.d.ts",
|
|
10
10
|
"**/*.map",
|
|
11
|
-
"readme.md"
|
|
11
|
+
"readme.md",
|
|
12
|
+
"license.md"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
14
15
|
"build": "npm run clean && npm run compile",
|
|
15
16
|
"clean": "rimraf dist && rimraf *.tsbuildinfo && rimraf \"./**/*.!(md|json|build.json)\"",
|
|
16
17
|
"compile": "tsc -b tsconfig.build.json",
|
|
17
|
-
"postcompile": "build-tools -c add-js-to-es6
|
|
18
|
+
"postcompile": "build-tools -c add-js-to-es6",
|
|
18
19
|
"prepublishOnly": "build-tools -c prepare-es6-build"
|
|
19
20
|
},
|
|
20
21
|
"dependencies": {
|
|
21
|
-
"@babylonjs/core": "^5.0.
|
|
22
|
-
"babylonjs-gltf2interface": "^5.0.
|
|
22
|
+
"@babylonjs/core": "^5.0.2",
|
|
23
|
+
"babylonjs-gltf2interface": "^5.0.2",
|
|
23
24
|
"tslib": "^2.3.1"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
@@ -28,5 +29,23 @@
|
|
|
28
29
|
"rimraf": "^3.0.2",
|
|
29
30
|
"typescript": "^4.4.4"
|
|
30
31
|
},
|
|
31
|
-
"
|
|
32
|
+
"keywords": [
|
|
33
|
+
"3D",
|
|
34
|
+
"javascript",
|
|
35
|
+
"html5",
|
|
36
|
+
"webgl",
|
|
37
|
+
"babylon.js"
|
|
38
|
+
],
|
|
39
|
+
"license": "Apache-2.0",
|
|
40
|
+
"esnext": "index.js",
|
|
41
|
+
"type": "module",
|
|
42
|
+
"sideEffects": true,
|
|
43
|
+
"homepage": "https://www.babylonjs.com",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/BabylonJS/Babylon.js.git"
|
|
47
|
+
},
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/BabylonJS/Babylon.js/issues"
|
|
50
|
+
}
|
|
32
51
|
}
|
package/stl/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./stlSerializer";
|
|
1
|
+
export * from "./stlSerializer.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/stl/stlSerializer.d.ts
CHANGED
package/stl/stlSerializer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stlSerializer.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/stl/stlSerializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,0CAA4B;AACnD,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAEjD;;GAEG;AACH;IAAA;IAgHA,CAAC;IA/GG;;;;;;;;;OASG;IACW,mBAAS,GAAvB,UACI,MAAc,EACd,QAAwB,EACxB,QAA4B,EAC5B,MAAuB,EACvB,cAA8B,EAC9B,kBAAmC;QAEnC,qFAAqF;QANrF,yBAAA,EAAA,eAAwB;QACxB,yBAAA,EAAA,oBAA4B;QAC5B,uBAAA,EAAA,cAAuB;QACvB,+BAAA,EAAA,qBAA8B;QAC9B,mCAAA,EAAA,0BAAmC;QAInC,IAAM,WAAW,GAAG,UAAU,OAAY,EAAE,QAAa,EAAE,CAAS;YAChE,IAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACpE,IAAM,CAAC,GAAG;gBACN,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,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";\r\n\r\n/**\r\n * Class for generating STL data from a Babylon scene.\r\n */\r\nexport class STLExport {\r\n /**\r\n * Exports the geometry of a Mesh array in .STL file format (ASCII)\r\n * @param meshes list defines the mesh to serialize\r\n * @param download triggers the automatic download of the file.\r\n * @param fileName changes the downloads fileName.\r\n * @param binary changes the STL to a binary type.\r\n * @param isLittleEndian toggle for binary type exporter.\r\n * @param doNotBakeTransform toggle if meshes transforms should be baked or not.\r\n * @returns the STL as UTF8 string\r\n */\r\n public static CreateSTL(\r\n meshes: Mesh[],\r\n download: boolean = true,\r\n fileName: string = \"stlmesh\",\r\n binary: boolean = false,\r\n isLittleEndian: boolean = true,\r\n doNotBakeTransform: boolean = false\r\n ): any {\r\n //Binary support adapted from https://gist.github.com/paulkaplan/6d5f0ab2c7e8fdc68a61\r\n\r\n const getFaceData = function (indices: any, vertices: any, i: number) {\r\n const id = [indices[i] * 3, indices[i + 1] * 3, indices[i + 2] * 3];\r\n const v = [\r\n new Vector3(vertices[id[0]], vertices[id[0] + 2], vertices[id[0] + 1]),\r\n new Vector3(vertices[id[1]], vertices[id[1] + 2], vertices[id[1] + 1]),\r\n new Vector3(vertices[id[2]], vertices[id[2] + 2], vertices[id[2] + 1]),\r\n ];\r\n const p1p2 = v[0].subtract(v[1]);\r\n const p3p2 = v[2].subtract(v[1]);\r\n const n = Vector3.Cross(p3p2, p1p2).normalize();\r\n\r\n return { v, n };\r\n };\r\n\r\n const writeVector = function (dataview: any, offset: number, vector: Vector3, isLittleEndian: boolean) {\r\n offset = writeFloat(dataview, offset, vector.x, isLittleEndian);\r\n offset = writeFloat(dataview, offset, vector.y, isLittleEndian);\r\n return writeFloat(dataview, offset, vector.z, isLittleEndian);\r\n };\r\n\r\n const writeFloat = function (dataview: any, offset: number, value: number, isLittleEndian: boolean) {\r\n dataview.setFloat32(offset, value, isLittleEndian);\r\n return offset + 4;\r\n };\r\n\r\n let data;\r\n\r\n let faceCount = 0;\r\n let offset = 0;\r\n\r\n if (binary) {\r\n for (let i = 0; i < meshes.length; i++) {\r\n const mesh = meshes[i];\r\n const indices = mesh.getIndices();\r\n faceCount += indices ? indices.length / 3 : 0;\r\n }\r\n\r\n const bufferSize = 84 + 50 * faceCount;\r\n const buffer = new ArrayBuffer(bufferSize);\r\n data = new DataView(buffer);\r\n\r\n offset += 80;\r\n data.setUint32(offset, faceCount, isLittleEndian);\r\n offset += 4;\r\n } else {\r\n data = \"solid stlmesh\\r\\n\";\r\n }\r\n\r\n for (let i = 0; i < meshes.length; i++) {\r\n const mesh = meshes[i];\r\n if (!doNotBakeTransform) {\r\n mesh.bakeCurrentTransformIntoVertices();\r\n }\r\n const vertices = mesh.getVerticesData(VertexBuffer.PositionKind) || [];\r\n const indices = mesh.getIndices() || [];\r\n\r\n for (let i = 0; i < indices.length; i += 3) {\r\n const fd = getFaceData(indices, vertices, i);\r\n\r\n if (binary) {\r\n offset = writeVector(data, offset, fd.n, isLittleEndian);\r\n offset = writeVector(data, offset, fd.v[0], isLittleEndian);\r\n offset = writeVector(data, offset, fd.v[1], isLittleEndian);\r\n offset = writeVector(data, offset, fd.v[2], isLittleEndian);\r\n offset += 2;\r\n } else {\r\n data += \"facet normal \" + fd.n.x + \" \" + fd.n.y + \" \" + fd.n.z + \"\\r\\n\";\r\n data += \"\\touter loop\\r\\n\";\r\n data += \"\\t\\tvertex \" + fd.v[0].x + \" \" + fd.v[0].y + \" \" + fd.v[0].z + \"\\r\\n\";\r\n data += \"\\t\\tvertex \" + fd.v[1].x + \" \" + fd.v[1].y + \" \" + fd.v[1].z + \"\\r\\n\";\r\n data += \"\\t\\tvertex \" + fd.v[2].x + \" \" + fd.v[2].y + \" \" + fd.v[2].z + \"\\r\\n\";\r\n data += \"\\tendloop\\r\\n\";\r\n data += \"endfacet\\r\\n\";\r\n }\r\n }\r\n }\r\n\r\n if (!binary) {\r\n data += \"endsolid stlmesh\";\r\n }\r\n\r\n if (download) {\r\n const a = document.createElement(\"a\");\r\n const blob = new Blob([data], { type: \"application/octet-stream\" });\r\n a.href = window.URL.createObjectURL(blob);\r\n a.download = fileName + \".stl\";\r\n a.click();\r\n }\r\n\r\n return data;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"stlSerializer.js","sourceRoot":"","sources":["../../../../../lts/serializers/generated/stl/stlSerializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,0CAA4B;AACnD,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAEjD;;GAEG;AACH;IAAA;IAgHA,CAAC;IA/GG;;;;;;;;;OASG;IACW,mBAAS,GAAvB,UACI,MAAc,EACd,QAAwB,EACxB,QAA4B,EAC5B,MAAuB,EACvB,cAA8B,EAC9B,kBAAmC;QAEnC,qFAAqF;QANrF,yBAAA,EAAA,eAAwB;QACxB,yBAAA,EAAA,oBAA4B;QAC5B,uBAAA,EAAA,cAAuB;QACvB,+BAAA,EAAA,qBAA8B;QAC9B,mCAAA,EAAA,0BAAmC;QAInC,IAAM,WAAW,GAAG,UAAU,OAAY,EAAE,QAAa,EAAE,CAAS;YAChE,IAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACpE,IAAM,CAAC,GAAG;gBACN,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACtE,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC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AAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;oBAC/E,IAAI,IAAI,aAAa,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;oBAC/E,IAAI,IAAI,eAAe,CAAC;oBACxB,IAAI,IAAI,cAAc,CAAC;iBAC1B;aACJ;SACJ;QAED,IAAI,CAAC,MAAM,EAAE;YACT,IAAI,IAAI,kBAAkB,CAAC;SAC9B;QAED,IAAI,QAAQ,EAAE;YACV,IAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YACtC,IAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC;YACpE,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAC1C,CAAC,CAAC,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;YAC/B,CAAC,CAAC,KAAK,EAAE,CAAC;SACb;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,gBAAC;AAAD,CAAC,AAhHD,IAgHC","sourcesContent":["import type { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * Class for generating STL data from a Babylon scene.\r\n */\r\nexport class STLExport {\r\n /**\r\n * Exports the geometry of a Mesh array in .STL file format (ASCII)\r\n * @param meshes list defines the mesh to serialize\r\n * @param download triggers the automatic download of the file.\r\n * @param fileName changes the downloads fileName.\r\n * @param binary changes the STL to a binary type.\r\n * @param isLittleEndian toggle for binary type exporter.\r\n * @param doNotBakeTransform toggle if meshes transforms should be baked or not.\r\n * @returns the STL as UTF8 string\r\n */\r\n public static CreateSTL(\r\n meshes: Mesh[],\r\n download: boolean = true,\r\n fileName: string = \"stlmesh\",\r\n binary: boolean = false,\r\n isLittleEndian: boolean = true,\r\n doNotBakeTransform: boolean = false\r\n ): any {\r\n //Binary support adapted from https://gist.github.com/paulkaplan/6d5f0ab2c7e8fdc68a61\r\n\r\n const getFaceData = function (indices: any, vertices: any, i: number) {\r\n const id = [indices[i] * 3, indices[i + 1] * 3, indices[i + 2] * 3];\r\n const v = [\r\n new Vector3(vertices[id[0]], vertices[id[0] + 2], vertices[id[0] + 1]),\r\n new Vector3(vertices[id[1]], vertices[id[1] + 2], vertices[id[1] + 1]),\r\n new Vector3(vertices[id[2]], vertices[id[2] + 2], vertices[id[2] + 1]),\r\n ];\r\n const p1p2 = v[0].subtract(v[1]);\r\n const p3p2 = v[2].subtract(v[1]);\r\n const n = Vector3.Cross(p3p2, p1p2).normalize();\r\n\r\n return { v, n };\r\n };\r\n\r\n const writeVector = function (dataview: any, offset: number, vector: Vector3, isLittleEndian: boolean) {\r\n offset = writeFloat(dataview, offset, vector.x, isLittleEndian);\r\n offset = writeFloat(dataview, offset, vector.y, isLittleEndian);\r\n return writeFloat(dataview, offset, vector.z, isLittleEndian);\r\n };\r\n\r\n const writeFloat = function (dataview: any, offset: number, value: number, isLittleEndian: boolean) {\r\n dataview.setFloat32(offset, value, isLittleEndian);\r\n return offset + 4;\r\n };\r\n\r\n let data;\r\n\r\n let faceCount = 0;\r\n let offset = 0;\r\n\r\n if (binary) {\r\n for (let i = 0; i < meshes.length; i++) {\r\n const mesh = meshes[i];\r\n const indices = mesh.getIndices();\r\n faceCount += indices ? indices.length / 3 : 0;\r\n }\r\n\r\n const bufferSize = 84 + 50 * faceCount;\r\n const buffer = new ArrayBuffer(bufferSize);\r\n data = new DataView(buffer);\r\n\r\n offset += 80;\r\n data.setUint32(offset, faceCount, isLittleEndian);\r\n offset += 4;\r\n } else {\r\n data = \"solid stlmesh\\r\\n\";\r\n }\r\n\r\n for (let i = 0; i < meshes.length; i++) {\r\n const mesh = meshes[i];\r\n if (!doNotBakeTransform) {\r\n mesh.bakeCurrentTransformIntoVertices();\r\n }\r\n const vertices = mesh.getVerticesData(VertexBuffer.PositionKind) || [];\r\n const indices = mesh.getIndices() || [];\r\n\r\n for (let i = 0; i < indices.length; i += 3) {\r\n const fd = getFaceData(indices, vertices, i);\r\n\r\n if (binary) {\r\n offset = writeVector(data, offset, fd.n, isLittleEndian);\r\n offset = writeVector(data, offset, fd.v[0], isLittleEndian);\r\n offset = writeVector(data, offset, fd.v[1], isLittleEndian);\r\n offset = writeVector(data, offset, fd.v[2], isLittleEndian);\r\n offset += 2;\r\n } else {\r\n data += \"facet normal \" + fd.n.x + \" \" + fd.n.y + \" \" + fd.n.z + \"\\r\\n\";\r\n data += \"\\touter loop\\r\\n\";\r\n data += \"\\t\\tvertex \" + fd.v[0].x + \" \" + fd.v[0].y + \" \" + fd.v[0].z + \"\\r\\n\";\r\n data += \"\\t\\tvertex \" + fd.v[1].x + \" \" + fd.v[1].y + \" \" + fd.v[1].z + \"\\r\\n\";\r\n data += \"\\t\\tvertex \" + fd.v[2].x + \" \" + fd.v[2].y + \" \" + fd.v[2].z + \"\\r\\n\";\r\n data += \"\\tendloop\\r\\n\";\r\n data += \"endfacet\\r\\n\";\r\n }\r\n }\r\n }\r\n\r\n if (!binary) {\r\n data += \"endsolid stlmesh\";\r\n }\r\n\r\n if (download) {\r\n const a = document.createElement(\"a\");\r\n const blob = new Blob([data], { type: \"application/octet-stream\" });\r\n a.href = window.URL.createObjectURL(blob);\r\n a.download = fileName + \".stl\";\r\n a.click();\r\n }\r\n\r\n return data;\r\n }\r\n}\r\n"]}
|