@babylonjs/serializers 7.34.3 → 7.35.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/OBJ/objSerializer.js.map +1 -1
  2. package/USDZ/usdzExporter.js.map +1 -1
  3. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
  4. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  5. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
  6. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  7. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
  8. package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
  9. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
  10. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  11. package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
  12. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  13. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  14. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  15. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  16. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
  17. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
  18. package/glTF/2.0/glTFAnimation.js.map +1 -1
  19. package/glTF/2.0/glTFData.js.map +1 -1
  20. package/glTF/2.0/glTFExporter.js.map +1 -1
  21. package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
  22. package/glTF/2.0/glTFSerializer.js.map +1 -1
  23. package/glTF/2.0/glTFUtilities.js.map +1 -1
  24. package/legacy/legacy-glTF2Serializer.js.map +1 -1
  25. package/legacy/legacy-objSerializer.js.map +1 -1
  26. package/legacy/legacy-stlSerializer.js.map +1 -1
  27. package/legacy/legacy-usdzSerializer.js.map +1 -1
  28. package/package.json +3 -3
  29. package/stl/stlSerializer.js.map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;aACpD;iBAAM;gBACH,KAAK,CAAC,KAAK,CAAC,4EAA4E,CAAC,CAAC;aAC7F;SACJ;aAAM;YACH,IAAI,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE;gBACrD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;aACxD;YACD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;YACvD,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;SACzB;IACL,CAAC;IACD;;;;OAIG;IACI,OAAO,CAAC,KAAa,EAAE,UAAmB;QAC7C,IAAI,UAAU,IAAI,IAAI,EAAE;YACpB,IAAI,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE;gBAC/B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;aAC7C;iBAAM;gBACH,KAAK,CAAC,KAAK,CAAC,4EAA4E,CAAC,CAAC;aAC7F;SACJ;aAAM;YACH,IAAI,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE;gBACrD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;aACxD;YACD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,WAAW,EAAE,CAAC;SACtB;IACL,CAAC;CACJ","sourcesContent":["import type {\r\n IBufferView,\r\n IAccessor,\r\n INode,\r\n IScene,\r\n IMesh,\r\n IMaterial,\r\n ITexture,\r\n IImage,\r\n ISampler,\r\n IAnimation,\r\n IMeshPrimitive,\r\n IBuffer,\r\n IGLTF,\r\n ITextureInfo,\r\n ISkin,\r\n ICamera,\r\n} from \"babylonjs-gltf2interface\";\r\nimport { AccessorType, ImageMimeType, MeshPrimitiveMode, AccessorComponentType, CameraType } from \"babylonjs-gltf2interface\";\r\n\r\nimport type { FloatArray, IndicesArray, Nullable } from \"core/types\";\r\nimport { Matrix, TmpVectors, Vector2, Vector3, Vector4, Quaternion } from \"core/Maths/math.vector\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { Node } from \"core/node\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport type { MorphTarget } from \"core/Morph/morphTarget\";\r\nimport { LinesMesh } from \"core/Meshes/linesMesh\";\r\nimport { InstancedMesh } from \"core/Meshes/instancedMesh\";\r\nimport type { Bone } from \"core/Bones/bone\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { Engine } from \"core/Engines/engine\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport type { IGLTFExporterExtensionV2 } from \"./glTFExporterExtension\";\r\nimport { _GLTFMaterialExporter } from \"./glTFMaterialExporter\";\r\nimport type { IExportOptions } from \"./glTFSerializer\";\r\nimport { _GLTFUtilities } from \"./glTFUtilities\";\r\nimport { GLTFData } from \"./glTFData\";\r\nimport { _GLTFAnimation } from \"./glTFAnimation\";\r\nimport { Camera } from \"core/Cameras/camera\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport { MultiMaterial } from \"core/Materials/multiMaterial\";\r\n\r\n// Matrix that converts handedness on the X-axis.\r\nconst convertHandednessMatrix = Matrix.Compose(new Vector3(-1, 1, 1), Quaternion.Identity(), Vector3.Zero());\r\n\r\n// 180 degrees rotation in Y.\r\nconst rotation180Y = new Quaternion(0, 1, 0, 0);\r\n\r\nfunction isNoopNode(node: Node, useRightHandedSystem: boolean): boolean {\r\n if (!(node instanceof TransformNode)) {\r\n return false;\r\n }\r\n\r\n // Transform\r\n if (useRightHandedSystem) {\r\n const matrix = node.getWorldMatrix();\r\n if (!matrix.isIdentity()) {\r\n return false;\r\n }\r\n } else {\r\n const matrix = node.getWorldMatrix().multiplyToRef(convertHandednessMatrix, TmpVectors.Matrix[0]);\r\n if (!matrix.isIdentity()) {\r\n return false;\r\n }\r\n }\r\n\r\n // Geometry\r\n if ((node instanceof Mesh && node.geometry) || (node instanceof InstancedMesh && node.sourceMesh.geometry)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction convertNodeHandedness(node: INode): void {\r\n const translation = Vector3.FromArrayToRef(node.translation || [0, 0, 0], 0, TmpVectors.Vector3[0]);\r\n const rotation = Quaternion.FromArrayToRef(node.rotation || [0, 0, 0, 1], 0, TmpVectors.Quaternion[0]);\r\n const scale = Vector3.FromArrayToRef(node.scale || [1, 1, 1], 0, TmpVectors.Vector3[1]);\r\n const matrix = Matrix.ComposeToRef(scale, rotation, translation, TmpVectors.Matrix[0]).multiplyToRef(convertHandednessMatrix, TmpVectors.Matrix[0]);\r\n\r\n matrix.decompose(scale, rotation, translation);\r\n\r\n if (translation.equalsToFloats(0, 0, 0)) {\r\n delete node.translation;\r\n } else {\r\n node.translation = translation.asArray();\r\n }\r\n\r\n if (Quaternion.IsIdentity(rotation)) {\r\n delete node.rotation;\r\n } else {\r\n node.rotation = rotation.asArray();\r\n }\r\n\r\n if (scale.equalsToFloats(1, 1, 1)) {\r\n delete node.scale;\r\n } else {\r\n node.scale = scale.asArray();\r\n }\r\n}\r\n\r\nfunction getBinaryWriterFunc(binaryWriter: _BinaryWriter, attributeComponentKind: AccessorComponentType): Nullable<(entry: number, byteOffset?: number) => void> {\r\n switch (attributeComponentKind) {\r\n case AccessorComponentType.UNSIGNED_BYTE: {\r\n return binaryWriter.setUInt8.bind(binaryWriter);\r\n }\r\n case AccessorComponentType.UNSIGNED_SHORT: {\r\n return binaryWriter.setUInt16.bind(binaryWriter);\r\n }\r\n case AccessorComponentType.UNSIGNED_INT: {\r\n return binaryWriter.setUInt32.bind(binaryWriter);\r\n }\r\n case AccessorComponentType.FLOAT: {\r\n return binaryWriter.setFloat32.bind(binaryWriter);\r\n }\r\n default: {\r\n Tools.Warn(\"Unsupported Attribute Component kind: \" + attributeComponentKind);\r\n return null;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Utility interface for storing vertex attribute data\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ninterface _IVertexAttributeData {\r\n /**\r\n * Specifies the Babylon Vertex Buffer Type (Position, Normal, Color, etc.)\r\n */\r\n kind: string;\r\n\r\n /**\r\n * Specifies the glTF Accessor Type (VEC2, VEC3, etc.)\r\n */\r\n accessorType: AccessorType;\r\n\r\n /**\r\n * Specifies the glTF Accessor Component Type (BYTE, UNSIGNED_BYTE, FLOAT, SHORT, INT, etc..)\r\n */\r\n accessorComponentType: AccessorComponentType;\r\n\r\n /**\r\n * Specifies the BufferView index for the vertex attribute data\r\n */\r\n bufferViewIndex?: number;\r\n\r\n /**\r\n * Specifies the number of bytes per attribute element (e.g. position would be 3 floats (x/y/z) where each float is 4 bytes, so a 12 byte stride)\r\n */\r\n byteStride?: number;\r\n\r\n /**\r\n * Specifies information about each morph target associated with this attribute\r\n */\r\n morphTargetInfo?: Readonly<{ bufferViewIndex: number; vertexCount: number; accessorType: AccessorType; minMax?: { min: Vector3; max: Vector3 } }>[];\r\n}\r\n\r\n/**\r\n * Converts Babylon Scene into glTF 2.0.\r\n * @internal\r\n */\r\nexport class _Exporter {\r\n /**\r\n * Stores the glTF to export\r\n */\r\n public _glTF: IGLTF;\r\n /**\r\n * Stores all generated buffer views, which represents views into the main glTF buffer data\r\n */\r\n public _bufferViews: IBufferView[];\r\n /**\r\n * Stores all the generated accessors, which is used for accessing the data within the buffer views in glTF\r\n */\r\n public _accessors: IAccessor[];\r\n /**\r\n * Stores all the generated nodes, which contains transform and/or mesh information per node\r\n */\r\n public _nodes: INode[];\r\n /**\r\n * Stores all the generated glTF scenes, which stores multiple node hierarchies\r\n */\r\n private _scenes: IScene[];\r\n /**\r\n * Stores all the generated glTF cameras\r\n */\r\n private _cameras: ICamera[];\r\n /**\r\n * Stores all the generated mesh information, each containing a set of primitives to render in glTF\r\n */\r\n private _meshes: IMesh[];\r\n /**\r\n * Stores all the generated material information, which represents the appearance of each primitive\r\n */\r\n public _materials: IMaterial[];\r\n\r\n public _materialMap: { [materialID: number]: number };\r\n /**\r\n * Stores all the generated texture information, which is referenced by glTF materials\r\n */\r\n public _textures: ITexture[];\r\n /**\r\n * Stores all the generated image information, which is referenced by glTF textures\r\n */\r\n public _images: IImage[];\r\n\r\n /**\r\n * Stores all the texture samplers\r\n */\r\n public _samplers: ISampler[];\r\n /**\r\n * Stores all the generated glTF skins\r\n */\r\n public _skins: ISkin[];\r\n /**\r\n * Stores all the generated animation samplers, which is referenced by glTF animations\r\n */\r\n /**\r\n * Stores the animations for glTF models\r\n */\r\n private _animations: IAnimation[];\r\n /**\r\n * Stores the total amount of bytes stored in the glTF buffer\r\n */\r\n private _totalByteLength: number;\r\n /**\r\n * Stores a reference to the Babylon scene containing the source geometry and material information\r\n */\r\n public _babylonScene: Scene;\r\n /**\r\n * Stores a map of the image data, where the key is the file name and the value\r\n * is the image data\r\n */\r\n public _imageData: { [fileName: string]: { data: ArrayBuffer; mimeType: ImageMimeType } };\r\n\r\n private _orderedImageData: Array<{ data: ArrayBuffer; mimeType: ImageMimeType }>;\r\n\r\n /**\r\n * Stores a map of the unique id of a node to its index in the node array\r\n */\r\n private _nodeMap: { [key: number]: number };\r\n\r\n /**\r\n * Baked animation sample rate\r\n */\r\n private _animationSampleRate: number;\r\n\r\n private _options: IExportOptions;\r\n\r\n private _localEngine: Engine;\r\n\r\n public _glTFMaterialExporter: _GLTFMaterialExporter;\r\n\r\n private _extensions: { [name: string]: IGLTFExporterExtensionV2 } = {};\r\n\r\n private static _ExtensionNames = new Array<string>();\r\n private static _ExtensionFactories: { [name: string]: (exporter: _Exporter) => IGLTFExporterExtensionV2 } = {};\r\n\r\n private _applyExtension<T>(\r\n node: Nullable<T>,\r\n extensions: IGLTFExporterExtensionV2[],\r\n index: number,\r\n actionAsync: (extension: IGLTFExporterExtensionV2, node: Nullable<T>) => Promise<Nullable<T>> | undefined\r\n ): Promise<Nullable<T>> {\r\n if (index >= extensions.length) {\r\n return Promise.resolve(node);\r\n }\r\n\r\n const currentPromise = actionAsync(extensions[index], node);\r\n\r\n if (!currentPromise) {\r\n return this._applyExtension(node, extensions, index + 1, actionAsync);\r\n }\r\n\r\n return currentPromise.then((newNode) => this._applyExtension(newNode, extensions, index + 1, actionAsync));\r\n }\r\n\r\n private _applyExtensions<T>(\r\n node: Nullable<T>,\r\n actionAsync: (extension: IGLTFExporterExtensionV2, node: Nullable<T>) => Promise<Nullable<T>> | undefined\r\n ): Promise<Nullable<T>> {\r\n const extensions: IGLTFExporterExtensionV2[] = [];\r\n for (const name of _Exporter._ExtensionNames) {\r\n extensions.push(this._extensions[name]);\r\n }\r\n\r\n return this._applyExtension(node, extensions, 0, actionAsync);\r\n }\r\n\r\n public _extensionsPreExportTextureAsync(context: string, babylonTexture: Nullable<Texture>, mimeType: ImageMimeType): Promise<Nullable<BaseTexture>> {\r\n return this._applyExtensions(babylonTexture, (extension, node) => extension.preExportTextureAsync && extension.preExportTextureAsync(context, node, mimeType));\r\n }\r\n\r\n public _extensionsPostExportMeshPrimitiveAsync(\r\n context: string,\r\n meshPrimitive: IMeshPrimitive,\r\n babylonSubMesh: SubMesh,\r\n binaryWriter: _BinaryWriter\r\n ): Promise<Nullable<IMeshPrimitive>> {\r\n return this._applyExtensions(\r\n meshPrimitive,\r\n (extension, node) => extension.postExportMeshPrimitiveAsync && extension.postExportMeshPrimitiveAsync(context, node, babylonSubMesh, binaryWriter)\r\n );\r\n }\r\n\r\n public _extensionsPostExportNodeAsync(\r\n context: string,\r\n node: Nullable<INode>,\r\n babylonNode: Node,\r\n nodeMap: { [key: number]: number },\r\n binaryWriter: _BinaryWriter\r\n ): Promise<Nullable<INode>> {\r\n return this._applyExtensions(node, (extension, node) => extension.postExportNodeAsync && extension.postExportNodeAsync(context, node, babylonNode, nodeMap, binaryWriter));\r\n }\r\n\r\n public _extensionsPostExportMaterialAsync(context: string, material: Nullable<IMaterial>, babylonMaterial: Material): Promise<Nullable<IMaterial>> {\r\n return this._applyExtensions(material, (extension, node) => extension.postExportMaterialAsync && extension.postExportMaterialAsync(context, node, babylonMaterial));\r\n }\r\n\r\n public _extensionsPostExportMaterialAdditionalTextures(context: string, material: IMaterial, babylonMaterial: Material): BaseTexture[] {\r\n const output: BaseTexture[] = [];\r\n\r\n for (const name of _Exporter._ExtensionNames) {\r\n const extension = this._extensions[name];\r\n\r\n if (extension.postExportMaterialAdditionalTextures) {\r\n output.push(...extension.postExportMaterialAdditionalTextures(context, material, babylonMaterial));\r\n }\r\n }\r\n\r\n return output;\r\n }\r\n\r\n public _extensionsPostExportTextures(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void {\r\n for (const name of _Exporter._ExtensionNames) {\r\n const extension = this._extensions[name];\r\n\r\n if (extension.postExportTexture) {\r\n extension.postExportTexture(context, textureInfo, babylonTexture);\r\n }\r\n }\r\n }\r\n\r\n private _forEachExtensions(action: (extension: IGLTFExporterExtensionV2) => void): void {\r\n for (const name of _Exporter._ExtensionNames) {\r\n const extension = this._extensions[name];\r\n if (extension.enabled) {\r\n action(extension);\r\n }\r\n }\r\n }\r\n\r\n private _extensionsOnExporting(): void {\r\n this._forEachExtensions((extension) => {\r\n if (extension.wasUsed) {\r\n if (this._glTF.extensionsUsed == null) {\r\n this._glTF.extensionsUsed = [];\r\n }\r\n\r\n if (this._glTF.extensionsUsed.indexOf(extension.name) === -1) {\r\n this._glTF.extensionsUsed.push(extension.name);\r\n }\r\n\r\n if (extension.required) {\r\n if (this._glTF.extensionsRequired == null) {\r\n this._glTF.extensionsRequired = [];\r\n }\r\n if (this._glTF.extensionsRequired.indexOf(extension.name) === -1) {\r\n this._glTF.extensionsRequired.push(extension.name);\r\n }\r\n }\r\n\r\n if (this._glTF.extensions == null) {\r\n this._glTF.extensions = {};\r\n }\r\n\r\n if (extension.onExporting) {\r\n extension.onExporting();\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Load glTF serializer extensions\r\n */\r\n private _loadExtensions(): void {\r\n for (const name of _Exporter._ExtensionNames) {\r\n const extension = _Exporter._ExtensionFactories[name](this);\r\n this._extensions[name] = extension;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a glTF Exporter instance, which can accept optional exporter options\r\n * @param babylonScene Babylon scene object\r\n * @param options Options to modify the behavior of the exporter\r\n */\r\n public constructor(babylonScene?: Nullable<Scene>, options?: IExportOptions) {\r\n this._glTF = {\r\n asset: { generator: `Babylon.js v${Engine.Version}`, version: \"2.0\" },\r\n };\r\n babylonScene = babylonScene || EngineStore.LastCreatedScene;\r\n if (!babylonScene) {\r\n return;\r\n }\r\n this._babylonScene = babylonScene;\r\n this._bufferViews = [];\r\n this._accessors = [];\r\n this._meshes = [];\r\n this._scenes = [];\r\n this._cameras = [];\r\n this._nodes = [];\r\n this._images = [];\r\n this._materials = [];\r\n this._materialMap = [];\r\n this._textures = [];\r\n this._samplers = [];\r\n this._skins = [];\r\n this._animations = [];\r\n this._imageData = {};\r\n this._orderedImageData = [];\r\n this._options = options || {};\r\n this._animationSampleRate = this._options.animationSampleRate || 1 / 60;\r\n\r\n this._glTFMaterialExporter = new _GLTFMaterialExporter(this);\r\n this._loadExtensions();\r\n }\r\n\r\n public dispose() {\r\n for (const extensionKey in this._extensions) {\r\n const extension = this._extensions[extensionKey];\r\n\r\n extension.dispose();\r\n }\r\n }\r\n\r\n public get options() {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Registers a glTF exporter extension\r\n * @param name Name of the extension to export\r\n * @param factory The factory function that creates the exporter extension\r\n */\r\n public static RegisterExtension(name: string, factory: (exporter: _Exporter) => IGLTFExporterExtensionV2): void {\r\n if (_Exporter.UnregisterExtension(name)) {\r\n Tools.Warn(`Extension with the name ${name} already exists`);\r\n }\r\n\r\n _Exporter._ExtensionFactories[name] = factory;\r\n _Exporter._ExtensionNames.push(name);\r\n }\r\n\r\n /**\r\n * Un-registers an exporter extension\r\n * @param name The name fo the exporter extension\r\n * @returns A boolean indicating whether the extension has been un-registered\r\n */\r\n public static UnregisterExtension(name: string): boolean {\r\n if (!_Exporter._ExtensionFactories[name]) {\r\n return false;\r\n }\r\n delete _Exporter._ExtensionFactories[name];\r\n\r\n const index = _Exporter._ExtensionNames.indexOf(name);\r\n if (index !== -1) {\r\n _Exporter._ExtensionNames.splice(index, 1);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _reorderIndicesBasedOnPrimitiveMode(submesh: SubMesh, primitiveMode: number, babylonIndices: IndicesArray, byteOffset: number, binaryWriter: _BinaryWriter) {\r\n switch (primitiveMode) {\r\n case Material.TriangleFillMode: {\r\n if (!byteOffset) {\r\n byteOffset = 0;\r\n }\r\n for (let i = submesh.indexStart, length = submesh.indexStart + submesh.indexCount; i < length; i = i + 3) {\r\n const index = byteOffset + i * 4;\r\n // swap the second and third indices\r\n const secondIndex = binaryWriter.getUInt32(index + 4);\r\n const thirdIndex = binaryWriter.getUInt32(index + 8);\r\n binaryWriter.setUInt32(thirdIndex, index + 4);\r\n binaryWriter.setUInt32(secondIndex, index + 8);\r\n }\r\n break;\r\n }\r\n case Material.TriangleFanDrawMode: {\r\n for (let i = submesh.indexStart + submesh.indexCount - 1, start = submesh.indexStart; i >= start; --i) {\r\n binaryWriter.setUInt32(babylonIndices[i], byteOffset);\r\n byteOffset += 4;\r\n }\r\n break;\r\n }\r\n case Material.TriangleStripDrawMode: {\r\n if (submesh.indexCount >= 3) {\r\n binaryWriter.setUInt32(babylonIndices[submesh.indexStart + 2], byteOffset + 4);\r\n binaryWriter.setUInt32(babylonIndices[submesh.indexStart + 1], byteOffset + 8);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Reorders the vertex attribute data based on the primitive mode. This is necessary when indices are not available and the winding order is\r\n * clock-wise during export to glTF\r\n * @param submesh BabylonJS submesh\r\n * @param primitiveMode Primitive mode of the mesh\r\n * @param vertexBufferKind The type of vertex attribute\r\n * @param meshAttributeArray The vertex attribute data\r\n * @param byteOffset The offset to the binary data\r\n * @param binaryWriter The binary data for the glTF file\r\n */\r\n private _reorderVertexAttributeDataBasedOnPrimitiveMode(\r\n submesh: SubMesh,\r\n primitiveMode: number,\r\n vertexBufferKind: string,\r\n meshAttributeArray: FloatArray,\r\n byteOffset: number,\r\n binaryWriter: _BinaryWriter\r\n ): void {\r\n switch (primitiveMode) {\r\n case Material.TriangleFillMode: {\r\n this._reorderTriangleFillMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);\r\n break;\r\n }\r\n case Material.TriangleStripDrawMode: {\r\n this._reorderTriangleStripDrawMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);\r\n break;\r\n }\r\n case Material.TriangleFanDrawMode: {\r\n this._reorderTriangleFanMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is\r\n * clock-wise during export to glTF\r\n * @param submesh BabylonJS submesh\r\n * @param vertexBufferKind The type of vertex attribute\r\n * @param meshAttributeArray The vertex attribute data\r\n * @param byteOffset The offset to the binary data\r\n * @param binaryWriter The binary data for the glTF file\r\n */\r\n private _reorderTriangleFillMode(submesh: SubMesh, vertexBufferKind: string, meshAttributeArray: FloatArray, byteOffset: number, binaryWriter: _BinaryWriter) {\r\n const vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh() as Mesh);\r\n if (vertexBuffer) {\r\n const stride = vertexBuffer.byteStride / VertexBuffer.GetTypeByteLength(vertexBuffer.type);\r\n if (submesh.verticesCount % 3 !== 0) {\r\n Tools.Error(\"The submesh vertices for the triangle fill mode is not divisible by 3!\");\r\n } else {\r\n const vertexData: Vector2[] | Vector3[] | Vector4[] = [];\r\n let index = 0;\r\n switch (vertexBufferKind) {\r\n case VertexBuffer.PositionKind:\r\n case VertexBuffer.NormalKind: {\r\n for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {\r\n index = x * stride;\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index));\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + stride));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {\r\n index = x * stride;\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index));\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index + stride));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.ColorKind: {\r\n const size = vertexBuffer.getSize();\r\n for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + size) {\r\n index = x * stride;\r\n if (size === 4) {\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index));\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index + stride));\r\n } else {\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index));\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + stride));\r\n }\r\n }\r\n break;\r\n }\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind: {\r\n for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {\r\n index = x * stride;\r\n (vertexData as Vector2[]).push(Vector2.FromArray(meshAttributeArray, index));\r\n (vertexData as Vector2[]).push(Vector2.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector2[]).push(Vector2.FromArray(meshAttributeArray, index + stride));\r\n }\r\n break;\r\n }\r\n default: {\r\n Tools.Error(`Unsupported Vertex Buffer type: ${vertexBufferKind}`);\r\n }\r\n }\r\n this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);\r\n }\r\n } else {\r\n Tools.Warn(`reorderTriangleFillMode: Vertex Buffer Kind ${vertexBufferKind} not present!`);\r\n }\r\n }\r\n\r\n /**\r\n * Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is\r\n * clock-wise during export to glTF\r\n * @param submesh BabylonJS submesh\r\n * @param vertexBufferKind The type of vertex attribute\r\n * @param meshAttributeArray The vertex attribute data\r\n * @param byteOffset The offset to the binary data\r\n * @param binaryWriter The binary data for the glTF file\r\n */\r\n private _reorderTriangleStripDrawMode(submesh: SubMesh, vertexBufferKind: string, meshAttributeArray: FloatArray, byteOffset: number, binaryWriter: _BinaryWriter) {\r\n const vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh() as Mesh);\r\n if (vertexBuffer) {\r\n const stride = vertexBuffer.byteStride / VertexBuffer.GetTypeByteLength(vertexBuffer.type);\r\n\r\n const vertexData: Vector2[] | Vector3[] | Vector4[] = [];\r\n let index = 0;\r\n switch (vertexBufferKind) {\r\n case VertexBuffer.PositionKind:\r\n case VertexBuffer.NormalKind: {\r\n index = submesh.verticesStart;\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + stride));\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.ColorKind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n vertexBuffer.getSize() === 4\r\n ? (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index))\r\n : (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector2[]).push(Vector2.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n default: {\r\n Tools.Error(`Unsupported Vertex Buffer type: ${vertexBufferKind}`);\r\n }\r\n }\r\n this._writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, binaryWriter);\r\n } else {\r\n Tools.Warn(`reorderTriangleStripDrawMode: Vertex buffer kind ${vertexBufferKind} not present!`);\r\n }\r\n }\r\n\r\n /**\r\n * Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is\r\n * clock-wise during export to glTF\r\n * @param submesh BabylonJS submesh\r\n * @param vertexBufferKind The type of vertex attribute\r\n * @param meshAttributeArray The vertex attribute data\r\n * @param byteOffset The offset to the binary data\r\n * @param binaryWriter The binary data for the glTF file\r\n */\r\n private _reorderTriangleFanMode(submesh: SubMesh, vertexBufferKind: string, meshAttributeArray: FloatArray, byteOffset: number, binaryWriter: _BinaryWriter) {\r\n const vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh() as Mesh);\r\n if (vertexBuffer) {\r\n const stride = vertexBuffer.byteStride / VertexBuffer.GetTypeByteLength(vertexBuffer.type);\r\n\r\n const vertexData: Vector2[] | Vector3[] | Vector4[] = [];\r\n let index = 0;\r\n switch (vertexBufferKind) {\r\n case VertexBuffer.PositionKind:\r\n case VertexBuffer.NormalKind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.ColorKind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index));\r\n vertexBuffer.getSize() === 4\r\n ? (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index))\r\n : (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector2[]).push(Vector2.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n default: {\r\n Tools.Error(`Unsupported Vertex Buffer type: ${vertexBufferKind}`);\r\n }\r\n }\r\n this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);\r\n } else {\r\n Tools.Warn(`reorderTriangleFanMode: Vertex buffer kind ${vertexBufferKind} not present!`);\r\n }\r\n }\r\n\r\n /**\r\n * Writes the vertex attribute data to binary\r\n * @param vertices The vertices to write to the binary writer\r\n * @param byteOffset The offset into the binary writer to overwrite binary data\r\n * @param vertexAttributeKind The vertex attribute type\r\n * @param binaryWriter The writer containing the binary data\r\n */\r\n private _writeVertexAttributeData(vertices: Vector2[] | Vector3[] | Vector4[], byteOffset: number, vertexAttributeKind: string, binaryWriter: _BinaryWriter) {\r\n for (const vertex of vertices) {\r\n if (vertexAttributeKind === VertexBuffer.NormalKind) {\r\n vertex.normalize();\r\n } else if (vertexAttributeKind === VertexBuffer.TangentKind && vertex instanceof Vector4) {\r\n _GLTFUtilities._NormalizeTangentFromRef(vertex);\r\n }\r\n\r\n for (const component of vertex.asArray()) {\r\n binaryWriter.setFloat32(component, byteOffset);\r\n byteOffset += 4;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Writes mesh attribute data to a data buffer\r\n * Returns the bytelength of the data\r\n * @param vertexBufferKind Indicates what kind of vertex data is being passed in\r\n * @param attributeComponentKind\r\n * @param meshAttributeArray Array containing the attribute data\r\n * @param stride Specifies the space between data\r\n * @param binaryWriter The buffer to write the binary data to\r\n * @param babylonTransformNode\r\n */\r\n public _writeAttributeData(\r\n vertexBufferKind: string,\r\n attributeComponentKind: AccessorComponentType,\r\n meshAttributeArray: FloatArray,\r\n stride: number,\r\n binaryWriter: _BinaryWriter,\r\n babylonTransformNode: TransformNode\r\n ) {\r\n let vertexAttributes: number[][] = [];\r\n let index: number;\r\n\r\n switch (vertexBufferKind) {\r\n case VertexBuffer.PositionKind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector3.FromArray(meshAttributeArray, index);\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.NormalKind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector3.FromArray(meshAttributeArray, index);\r\n vertexAttributes.push(vertexData.normalize().asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector4.FromArray(meshAttributeArray, index);\r\n _GLTFUtilities._NormalizeTangentFromRef(vertexData);\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.ColorKind: {\r\n const meshMaterial = (babylonTransformNode as Mesh).material;\r\n const convertToLinear = meshMaterial ? meshMaterial.getClassName() === \"StandardMaterial\" : true;\r\n const vertexData: Color3 | Color4 = stride === 3 ? new Color3() : new Color4();\r\n const useExactSrgbConversions = this._babylonScene.getEngine().useExactSrgbConversions;\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n if (stride === 3) {\r\n Color3.FromArrayToRef(meshAttributeArray, index, vertexData as Color3);\r\n if (convertToLinear) {\r\n (vertexData as Color3).toLinearSpaceToRef(vertexData as Color3, useExactSrgbConversions);\r\n }\r\n } else {\r\n Color4.FromArrayToRef(meshAttributeArray, index, vertexData as Color4);\r\n if (convertToLinear) {\r\n (vertexData as Color4).toLinearSpaceToRef(vertexData as Color4, useExactSrgbConversions);\r\n }\r\n }\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector2.FromArray(meshAttributeArray, index);\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.MatricesIndicesKind:\r\n case VertexBuffer.MatricesIndicesExtraKind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector4.FromArray(meshAttributeArray, index);\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.MatricesWeightsKind:\r\n case VertexBuffer.MatricesWeightsExtraKind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector4.FromArray(meshAttributeArray, index);\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n default: {\r\n Tools.Warn(\"Unsupported Vertex Buffer Type: \" + vertexBufferKind);\r\n vertexAttributes = [];\r\n }\r\n }\r\n\r\n const writeBinaryFunc = getBinaryWriterFunc(binaryWriter, attributeComponentKind);\r\n\r\n if (writeBinaryFunc) {\r\n for (const vertexAttribute of vertexAttributes) {\r\n for (const component of vertexAttribute) {\r\n writeBinaryFunc(component);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _createMorphTargetBufferViewKind(\r\n vertexBufferKind: string,\r\n accessorType: AccessorType,\r\n attributeComponentKind: AccessorComponentType,\r\n mesh: Mesh,\r\n morphTarget: MorphTarget,\r\n binaryWriter: _BinaryWriter,\r\n byteStride: number\r\n ): Nullable<{ bufferViewIndex: number; vertexCount: number; accessorType: AccessorType; minMax?: { min: Vector3; max: Vector3 } }> {\r\n let vertexCount: number;\r\n let minMax: { min: Vector3; max: Vector3 } | undefined;\r\n const morphData: number[] = [];\r\n const difference: Vector3 = TmpVectors.Vector3[0];\r\n\r\n switch (vertexBufferKind) {\r\n case VertexBuffer.PositionKind: {\r\n const morphPositions = morphTarget.getPositions();\r\n if (!morphPositions) {\r\n return null;\r\n }\r\n\r\n const originalPositions = mesh.getVerticesData(VertexBuffer.PositionKind, undefined, undefined, true)!;\r\n const vertexStart = 0;\r\n const min = new Vector3(Infinity, Infinity, Infinity);\r\n const max = new Vector3(-Infinity, -Infinity, -Infinity);\r\n vertexCount = originalPositions.length / 3;\r\n for (let i = vertexStart; i < vertexCount; ++i) {\r\n const originalPosition = Vector3.FromArray(originalPositions, i * 3);\r\n const morphPosition = Vector3.FromArray(morphPositions, i * 3);\r\n morphPosition.subtractToRef(originalPosition, difference);\r\n min.copyFromFloats(Math.min(difference.x, min.x), Math.min(difference.y, min.y), Math.min(difference.z, min.z));\r\n max.copyFromFloats(Math.max(difference.x, max.x), Math.max(difference.y, max.y), Math.max(difference.z, max.z));\r\n morphData.push(difference.x, difference.y, difference.z);\r\n }\r\n\r\n minMax = { min, max };\r\n\r\n break;\r\n }\r\n case VertexBuffer.NormalKind: {\r\n const morphNormals = morphTarget.getNormals();\r\n if (!morphNormals) {\r\n return null;\r\n }\r\n\r\n const originalNormals = mesh.getVerticesData(VertexBuffer.NormalKind, undefined, undefined, true)!;\r\n const vertexStart = 0;\r\n vertexCount = originalNormals.length / 3;\r\n for (let i = vertexStart; i < vertexCount; ++i) {\r\n const originalNormal = Vector3.FromArray(originalNormals, i * 3).normalize();\r\n const morphNormal = Vector3.FromArray(morphNormals, i * 3).normalize();\r\n morphNormal.subtractToRef(originalNormal, difference);\r\n morphData.push(difference.x, difference.y, difference.z);\r\n }\r\n\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n const morphTangents = morphTarget.getTangents();\r\n if (!morphTangents) {\r\n return null;\r\n }\r\n\r\n // Handedness cannot be displaced, so morph target tangents omit the w component\r\n accessorType = AccessorType.VEC3;\r\n byteStride = 12; // 3 components (x/y/z) * 4 bytes (float32)\r\n\r\n const originalTangents = mesh.getVerticesData(VertexBuffer.TangentKind, undefined, undefined, true)!;\r\n const vertexStart = 0;\r\n vertexCount = originalTangents.length / 4;\r\n for (let i = vertexStart; i < vertexCount; ++i) {\r\n // Only read the x, y, z components and ignore w\r\n const originalTangent = Vector3.FromArray(originalTangents, i * 4);\r\n _GLTFUtilities._NormalizeTangentFromRef(originalTangent);\r\n\r\n // Morph target tangents omit the w component so it won't be present in the data\r\n const morphTangent = Vector3.FromArray(morphTangents, i * 3);\r\n _GLTFUtilities._NormalizeTangentFromRef(morphTangent);\r\n\r\n morphTangent.subtractToRef(originalTangent, difference);\r\n morphData.push(difference.x, difference.y, difference.z);\r\n }\r\n\r\n break;\r\n }\r\n default: {\r\n return null;\r\n }\r\n }\r\n\r\n const binaryWriterFunc = getBinaryWriterFunc(binaryWriter, attributeComponentKind);\r\n if (!binaryWriterFunc) {\r\n return null;\r\n }\r\n\r\n const typeByteLength = VertexBuffer.GetTypeByteLength(attributeComponentKind);\r\n const byteLength = morphData.length * typeByteLength;\r\n const bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, `${vertexBufferKind} - ${morphTarget.name} (Morph Target)`);\r\n this._bufferViews.push(bufferView);\r\n const bufferViewIndex = this._bufferViews.length - 1;\r\n\r\n for (const value of morphData) {\r\n binaryWriterFunc(value);\r\n }\r\n\r\n return { bufferViewIndex, vertexCount, accessorType, minMax };\r\n }\r\n\r\n /**\r\n * Generates glTF json data\r\n * @param shouldUseGlb Indicates whether the json should be written for a glb file\r\n * @param glTFPrefix Text to use when prefixing a glTF file\r\n * @param prettyPrint Indicates whether the json file should be pretty printed (true) or not (false)\r\n * @returns json data as string\r\n */\r\n private _generateJSON(shouldUseGlb: boolean, glTFPrefix?: string, prettyPrint?: boolean): string {\r\n const buffer: IBuffer = { byteLength: this._totalByteLength };\r\n let imageName: string;\r\n let imageData: { data: ArrayBuffer; mimeType: ImageMimeType };\r\n let bufferView: IBufferView;\r\n let byteOffset: number = this._totalByteLength;\r\n\r\n if (buffer.byteLength) {\r\n this._glTF.buffers = [buffer];\r\n }\r\n if (this._nodes && this._nodes.length) {\r\n this._glTF.nodes = this._nodes;\r\n }\r\n if (this._meshes && this._meshes.length) {\r\n this._glTF.meshes = this._meshes;\r\n }\r\n if (this._scenes && this._scenes.length) {\r\n this._glTF.scenes = this._scenes;\r\n this._glTF.scene = 0;\r\n }\r\n if (this._cameras && this._cameras.length) {\r\n this._glTF.cameras = this._cameras;\r\n }\r\n if (this._bufferViews && this._bufferViews.length) {\r\n this._glTF.bufferViews = this._bufferViews;\r\n }\r\n if (this._accessors && this._accessors.length) {\r\n this._glTF.accessors = this._accessors;\r\n }\r\n if (this._animations && this._animations.length) {\r\n this._glTF.animations = this._animations;\r\n }\r\n if (this._materials && this._materials.length) {\r\n this._glTF.materials = this._materials;\r\n }\r\n if (this._textures && this._textures.length) {\r\n this._glTF.textures = this._textures;\r\n }\r\n if (this._samplers && this._samplers.length) {\r\n this._glTF.samplers = this._samplers;\r\n }\r\n if (this._skins && this._skins.length) {\r\n this._glTF.skins = this._skins;\r\n }\r\n if (this._images && this._images.length) {\r\n if (!shouldUseGlb) {\r\n this._glTF.images = this._images;\r\n } else {\r\n this._glTF.images = [];\r\n\r\n this._images.forEach((image) => {\r\n if (image.uri) {\r\n imageData = this._imageData[image.uri];\r\n this._orderedImageData.push(imageData);\r\n imageName = image.uri.split(\".\")[0] + \" image\";\r\n bufferView = _GLTFUtilities._CreateBufferView(0, byteOffset, imageData.data.byteLength, undefined, imageName);\r\n byteOffset += imageData.data.byteLength;\r\n this._bufferViews.push(bufferView);\r\n image.bufferView = this._bufferViews.length - 1;\r\n image.name = imageName;\r\n image.mimeType = imageData.mimeType;\r\n image.uri = undefined;\r\n if (!this._glTF.images) {\r\n this._glTF.images = [];\r\n }\r\n this._glTF.images.push(image);\r\n }\r\n });\r\n // Replace uri with bufferview and mime type for glb\r\n buffer.byteLength = byteOffset;\r\n }\r\n }\r\n\r\n if (!shouldUseGlb) {\r\n buffer.uri = glTFPrefix + \".bin\";\r\n }\r\n\r\n const jsonText = prettyPrint ? JSON.stringify(this._glTF, null, 2) : JSON.stringify(this._glTF);\r\n\r\n return jsonText;\r\n }\r\n\r\n /**\r\n * Generates data for .gltf and .bin files based on the glTF prefix string\r\n * @param glTFPrefix Text to use when prefixing a glTF file\r\n * @param dispose Dispose the exporter\r\n * @returns GLTFData with glTF file data\r\n */\r\n public _generateGLTFAsync(glTFPrefix: string, dispose = true): Promise<GLTFData> {\r\n return this._generateBinaryAsync().then((binaryBuffer) => {\r\n this._extensionsOnExporting();\r\n const jsonText = this._generateJSON(false, glTFPrefix, true);\r\n const bin = new Blob([binaryBuffer], { type: \"application/octet-stream\" });\r\n\r\n const glTFFileName = glTFPrefix + \".gltf\";\r\n const glTFBinFile = glTFPrefix + \".bin\";\r\n\r\n const container = new GLTFData();\r\n\r\n container.glTFFiles[glTFFileName] = jsonText;\r\n container.glTFFiles[glTFBinFile] = bin;\r\n\r\n if (this._imageData) {\r\n for (const image in this._imageData) {\r\n container.glTFFiles[image] = new Blob([this._imageData[image].data], { type: this._imageData[image].mimeType });\r\n }\r\n }\r\n\r\n if (dispose) {\r\n this.dispose();\r\n }\r\n\r\n return container;\r\n });\r\n }\r\n\r\n /**\r\n * Creates a binary buffer for glTF\r\n * @returns array buffer for binary data\r\n */\r\n private _generateBinaryAsync(): Promise<ArrayBuffer> {\r\n const binaryWriter = new _BinaryWriter(4);\r\n return this._createSceneAsync(binaryWriter).then(() => {\r\n if (this._localEngine) {\r\n this._localEngine.dispose();\r\n }\r\n return binaryWriter.getArrayBuffer();\r\n });\r\n }\r\n\r\n /**\r\n * Pads the number to a multiple of 4\r\n * @param num number to pad\r\n * @returns padded number\r\n */\r\n private _getPadding(num: number): number {\r\n const remainder = num % 4;\r\n const padding = remainder === 0 ? remainder : 4 - remainder;\r\n\r\n return padding;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _generateGLBAsync(glTFPrefix: string, dispose = true): Promise<GLTFData> {\r\n return this._generateBinaryAsync().then((binaryBuffer) => {\r\n this._extensionsOnExporting();\r\n const jsonText = this._generateJSON(true);\r\n const glbFileName = glTFPrefix + \".glb\";\r\n const headerLength = 12;\r\n const chunkLengthPrefix = 8;\r\n let jsonLength = jsonText.length;\r\n let encodedJsonText;\r\n let imageByteLength = 0;\r\n // make use of TextEncoder when available\r\n if (typeof TextEncoder !== \"undefined\") {\r\n const encoder = new TextEncoder();\r\n encodedJsonText = encoder.encode(jsonText);\r\n jsonLength = encodedJsonText.length;\r\n }\r\n for (let i = 0; i < this._orderedImageData.length; ++i) {\r\n imageByteLength += this._orderedImageData[i].data.byteLength;\r\n }\r\n const jsonPadding = this._getPadding(jsonLength);\r\n const binPadding = this._getPadding(binaryBuffer.byteLength);\r\n const imagePadding = this._getPadding(imageByteLength);\r\n\r\n const byteLength = headerLength + 2 * chunkLengthPrefix + jsonLength + jsonPadding + binaryBuffer.byteLength + binPadding + imageByteLength + imagePadding;\r\n\r\n //header\r\n const headerBuffer = new ArrayBuffer(headerLength);\r\n const headerBufferView = new DataView(headerBuffer);\r\n headerBufferView.setUint32(0, 0x46546c67, true); //glTF\r\n headerBufferView.setUint32(4, 2, true); // version\r\n headerBufferView.setUint32(8, byteLength, true); // total bytes in file\r\n\r\n //json chunk\r\n const jsonChunkBuffer = new ArrayBuffer(chunkLengthPrefix + jsonLength + jsonPadding);\r\n const jsonChunkBufferView = new DataView(jsonChunkBuffer);\r\n jsonChunkBufferView.setUint32(0, jsonLength + jsonPadding, true);\r\n jsonChunkBufferView.setUint32(4, 0x4e4f534a, true);\r\n\r\n //json chunk bytes\r\n const jsonData = new Uint8Array(jsonChunkBuffer, chunkLengthPrefix);\r\n // if TextEncoder was available, we can simply copy the encoded array\r\n if (encodedJsonText) {\r\n jsonData.set(encodedJsonText);\r\n } else {\r\n const blankCharCode = \"_\".charCodeAt(0);\r\n for (let i = 0; i < jsonLength; ++i) {\r\n const charCode = jsonText.charCodeAt(i);\r\n // if the character doesn't fit into a single UTF-16 code unit, just put a blank character\r\n if (charCode != jsonText.codePointAt(i)) {\r\n jsonData[i] = blankCharCode;\r\n } else {\r\n jsonData[i] = charCode;\r\n }\r\n }\r\n }\r\n\r\n //json padding\r\n const jsonPaddingView = new Uint8Array(jsonChunkBuffer, chunkLengthPrefix + jsonLength);\r\n for (let i = 0; i < jsonPadding; ++i) {\r\n jsonPaddingView[i] = 0x20;\r\n }\r\n\r\n //binary chunk\r\n const binaryChunkBuffer = new ArrayBuffer(chunkLengthPrefix);\r\n const binaryChunkBufferView = new DataView(binaryChunkBuffer);\r\n binaryChunkBufferView.setUint32(0, binaryBuffer.byteLength + imageByteLength + imagePadding, true);\r\n binaryChunkBufferView.setUint32(4, 0x004e4942, true);\r\n\r\n // binary padding\r\n const binPaddingBuffer = new ArrayBuffer(binPadding);\r\n const binPaddingView = new Uint8Array(binPaddingBuffer);\r\n for (let i = 0; i < binPadding; ++i) {\r\n binPaddingView[i] = 0;\r\n }\r\n\r\n const imagePaddingBuffer = new ArrayBuffer(imagePadding);\r\n const imagePaddingView = new Uint8Array(imagePaddingBuffer);\r\n for (let i = 0; i < imagePadding; ++i) {\r\n imagePaddingView[i] = 0;\r\n }\r\n\r\n const glbData = [headerBuffer, jsonChunkBuffer, binaryChunkBuffer, binaryBuffer];\r\n\r\n // binary data\r\n for (let i = 0; i < this._orderedImageData.length; ++i) {\r\n glbData.push(this._orderedImageData[i].data);\r\n }\r\n\r\n glbData.push(binPaddingBuffer);\r\n\r\n glbData.push(imagePaddingBuffer);\r\n\r\n const glbFile = new Blob(glbData, { type: \"application/octet-stream\" });\r\n\r\n const container = new GLTFData();\r\n container.glTFFiles[glbFileName] = glbFile;\r\n\r\n if (this._localEngine != null) {\r\n this._localEngine.dispose();\r\n }\r\n\r\n if (dispose) {\r\n this.dispose();\r\n }\r\n\r\n return container;\r\n });\r\n }\r\n\r\n /**\r\n * Sets the TRS for each node\r\n * @param node glTF Node for storing the transformation data\r\n * @param babylonTransformNode Babylon mesh used as the source for the transformation data\r\n */\r\n private _setNodeTransformation(node: INode, babylonTransformNode: TransformNode): void {\r\n if (!babylonTransformNode.getPivotPoint().equalsToFloats(0, 0, 0)) {\r\n Tools.Warn(\"Pivot points are not supported in the glTF serializer\");\r\n }\r\n if (!babylonTransformNode.position.equalsToFloats(0, 0, 0)) {\r\n node.translation = babylonTransformNode.position.asArray();\r\n }\r\n\r\n if (!babylonTransformNode.scaling.equalsToFloats(1, 1, 1)) {\r\n node.scale = babylonTransformNode.scaling.asArray();\r\n }\r\n\r\n const rotationQuaternion = Quaternion.FromEulerAngles(babylonTransformNode.rotation.x, babylonTransformNode.rotation.y, babylonTransformNode.rotation.z);\r\n if (babylonTransformNode.rotationQuaternion) {\r\n rotationQuaternion.multiplyInPlace(babylonTransformNode.rotationQuaternion);\r\n }\r\n if (!Quaternion.IsIdentity(rotationQuaternion)) {\r\n node.rotation = rotationQuaternion.normalize().asArray();\r\n }\r\n }\r\n\r\n private _setCameraTransformation(node: INode, babylonCamera: Camera): void {\r\n const translation = TmpVectors.Vector3[0];\r\n const rotation = TmpVectors.Quaternion[0];\r\n babylonCamera.getWorldMatrix().decompose(undefined, rotation, translation);\r\n\r\n if (!translation.equalsToFloats(0, 0, 0)) {\r\n node.translation = translation.asArray();\r\n }\r\n\r\n // // Rotation by 180 as glTF has a different convention than Babylon.\r\n rotation.multiplyInPlace(rotation180Y);\r\n\r\n if (!Quaternion.IsIdentity(rotation)) {\r\n node.rotation = rotation.asArray();\r\n }\r\n }\r\n\r\n private _getVertexBufferFromMesh(attributeKind: string, bufferMesh: Mesh): Nullable<VertexBuffer> {\r\n if (bufferMesh.isVerticesDataPresent(attributeKind, true)) {\r\n const vertexBuffer = bufferMesh.getVertexBuffer(attributeKind, true);\r\n if (vertexBuffer) {\r\n return vertexBuffer;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Creates a bufferview based on the vertices type for the Babylon mesh\r\n * @param kind Indicates the type of vertices data\r\n * @param attributeComponentKind Indicates the numerical type used to store the data\r\n * @param babylonTransformNode The Babylon mesh to get the vertices data from\r\n * @param binaryWriter The buffer to write the bufferview data to\r\n * @param byteStride\r\n */\r\n private _createBufferViewKind(\r\n kind: string,\r\n attributeComponentKind: AccessorComponentType,\r\n babylonTransformNode: TransformNode,\r\n binaryWriter: _BinaryWriter,\r\n byteStride: number\r\n ) {\r\n const bufferMesh =\r\n babylonTransformNode instanceof Mesh\r\n ? (babylonTransformNode as Mesh)\r\n : babylonTransformNode instanceof InstancedMesh\r\n ? (babylonTransformNode as InstancedMesh).sourceMesh\r\n : null;\r\n\r\n if (bufferMesh) {\r\n const vertexBuffer = bufferMesh.getVertexBuffer(kind, true);\r\n const vertexData = bufferMesh.getVerticesData(kind, undefined, undefined, true);\r\n\r\n if (vertexBuffer && vertexData) {\r\n const typeByteLength = VertexBuffer.GetTypeByteLength(attributeComponentKind);\r\n const byteLength = vertexData.length * typeByteLength;\r\n const bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, kind + \" - \" + bufferMesh.name);\r\n this._bufferViews.push(bufferView);\r\n\r\n this._writeAttributeData(kind, attributeComponentKind, vertexData, byteStride / typeByteLength, binaryWriter, babylonTransformNode);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * The primitive mode of the Babylon mesh\r\n * @param babylonMesh The BabylonJS mesh\r\n * @returns Unsigned integer of the primitive mode or null\r\n */\r\n private _getMeshPrimitiveMode(babylonMesh: AbstractMesh): number {\r\n if (babylonMesh instanceof LinesMesh) {\r\n return Material.LineListDrawMode;\r\n }\r\n if (babylonMesh instanceof InstancedMesh || babylonMesh instanceof Mesh) {\r\n const baseMesh = babylonMesh instanceof Mesh ? babylonMesh : babylonMesh.sourceMesh;\r\n if (typeof baseMesh.overrideRenderingFillMode === \"number\") {\r\n return baseMesh.overrideRenderingFillMode;\r\n }\r\n }\r\n return babylonMesh.material ? babylonMesh.material.fillMode : Material.TriangleFillMode;\r\n }\r\n\r\n /**\r\n * Sets the primitive mode of the glTF mesh primitive\r\n * @param meshPrimitive glTF mesh primitive\r\n * @param primitiveMode The primitive mode\r\n */\r\n private _setPrimitiveMode(meshPrimitive: IMeshPrimitive, primitiveMode: number) {\r\n switch (primitiveMode) {\r\n case Material.TriangleFillMode: {\r\n // glTF defaults to using Triangle Mode\r\n break;\r\n }\r\n case Material.TriangleStripDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.TRIANGLE_STRIP;\r\n break;\r\n }\r\n case Material.TriangleFanDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.TRIANGLE_FAN;\r\n break;\r\n }\r\n case Material.PointListDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.POINTS;\r\n break;\r\n }\r\n case Material.PointFillMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.POINTS;\r\n break;\r\n }\r\n case Material.LineLoopDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.LINE_LOOP;\r\n break;\r\n }\r\n case Material.LineListDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.LINES;\r\n break;\r\n }\r\n case Material.LineStripDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.LINE_STRIP;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the vertex attribute accessor based of the glTF mesh primitive\r\n * @param meshPrimitive glTF mesh primitive\r\n * @param attributeKind vertex attribute\r\n */\r\n private _setAttributeKind(attributes: { [name: string]: number }, attributeKind: string): void {\r\n switch (attributeKind) {\r\n case VertexBuffer.PositionKind: {\r\n attributes.POSITION = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.NormalKind: {\r\n attributes.NORMAL = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.ColorKind: {\r\n attributes.COLOR_0 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n attributes.TANGENT = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.UVKind: {\r\n attributes.TEXCOORD_0 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.UV2Kind: {\r\n attributes.TEXCOORD_1 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.MatricesIndicesKind: {\r\n attributes.JOINTS_0 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.MatricesIndicesExtraKind: {\r\n attributes.JOINTS_1 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.MatricesWeightsKind: {\r\n attributes.WEIGHTS_0 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.MatricesWeightsExtraKind: {\r\n attributes.WEIGHTS_1 = this._accessors.length - 1;\r\n break;\r\n }\r\n default: {\r\n Tools.Warn(\"Unsupported Vertex Buffer Type: \" + attributeKind);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets data for the primitive attributes of each submesh\r\n * @param mesh glTF Mesh object to store the primitive attribute information\r\n * @param babylonTransformNode Babylon mesh to get the primitive attribute data from\r\n * @param binaryWriter Buffer to write the attribute data to\r\n * @returns promise that resolves when done setting the primitive attributes\r\n */\r\n private _setPrimitiveAttributesAsync(mesh: IMesh, babylonTransformNode: TransformNode, binaryWriter: _BinaryWriter): Promise<void> {\r\n const promises: Promise<IMeshPrimitive>[] = [];\r\n let bufferMesh: Nullable<Mesh> = null;\r\n let bufferView: IBufferView;\r\n let minMax: { min: Nullable<number[]>; max: Nullable<number[]> };\r\n\r\n if (babylonTransformNode instanceof Mesh) {\r\n bufferMesh = babylonTransformNode as Mesh;\r\n } else if (babylonTransformNode instanceof InstancedMesh) {\r\n bufferMesh = (babylonTransformNode as InstancedMesh).sourceMesh;\r\n }\r\n const attributeData: _IVertexAttributeData[] = [\r\n { kind: VertexBuffer.PositionKind, accessorType: AccessorType.VEC3, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 12 },\r\n { kind: VertexBuffer.NormalKind, accessorType: AccessorType.VEC3, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 12 },\r\n { kind: VertexBuffer.ColorKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 16 },\r\n { kind: VertexBuffer.TangentKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 16 },\r\n { kind: VertexBuffer.UVKind, accessorType: AccessorType.VEC2, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 8 },\r\n { kind: VertexBuffer.UV2Kind, accessorType: AccessorType.VEC2, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 8 },\r\n { kind: VertexBuffer.MatricesIndicesKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.UNSIGNED_SHORT, byteStride: 8 },\r\n { kind: VertexBuffer.MatricesIndicesExtraKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.UNSIGNED_SHORT, byteStride: 8 },\r\n { kind: VertexBuffer.MatricesWeightsKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 16 },\r\n { kind: VertexBuffer.MatricesWeightsExtraKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 16 },\r\n ];\r\n\r\n if (bufferMesh) {\r\n let indexBufferViewIndex: Nullable<number> = null;\r\n const primitiveMode = this._getMeshPrimitiveMode(bufferMesh);\r\n const vertexAttributeBufferViews: { [attributeKind: string]: number } = {};\r\n const morphTargetManager = bufferMesh.morphTargetManager;\r\n\r\n // For each BabylonMesh, create bufferviews for each 'kind'\r\n for (const attribute of attributeData) {\r\n const attributeKind = attribute.kind;\r\n const attributeComponentKind = attribute.accessorComponentType;\r\n if (bufferMesh.isVerticesDataPresent(attributeKind, true)) {\r\n const vertexBuffer = this._getVertexBufferFromMesh(attributeKind, bufferMesh);\r\n attribute.byteStride = vertexBuffer\r\n ? vertexBuffer.getSize() * VertexBuffer.GetTypeByteLength(attribute.accessorComponentType)\r\n : VertexBuffer.DeduceStride(attributeKind) * 4;\r\n if (attribute.byteStride === 12) {\r\n attribute.accessorType = AccessorType.VEC3;\r\n }\r\n\r\n this._createBufferViewKind(attributeKind, attributeComponentKind, babylonTransformNode, binaryWriter, attribute.byteStride);\r\n attribute.bufferViewIndex = this._bufferViews.length - 1;\r\n vertexAttributeBufferViews[attributeKind] = attribute.bufferViewIndex;\r\n\r\n // Write any morph target data to the buffer and create an associated buffer view\r\n if (morphTargetManager) {\r\n for (let i = 0; i < morphTargetManager.numTargets; ++i) {\r\n const morphTarget = morphTargetManager.getTarget(i);\r\n const morphTargetInfo = this._createMorphTargetBufferViewKind(\r\n attributeKind,\r\n attribute.accessorType,\r\n attributeComponentKind,\r\n bufferMesh,\r\n morphTarget,\r\n binaryWriter,\r\n attribute.byteStride\r\n );\r\n\r\n // Store info about the morph target that will be needed later when creating per-submesh accessors\r\n if (morphTargetInfo) {\r\n if (!attribute.morphTargetInfo) {\r\n attribute.morphTargetInfo = [];\r\n }\r\n attribute.morphTargetInfo[i] = morphTargetInfo;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (bufferMesh.getTotalIndices()) {\r\n const indices = bufferMesh.getIndices();\r\n if (indices) {\r\n const byteLength = indices.length * 4;\r\n bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, \"Indices - \" + bufferMesh.name);\r\n this._bufferViews.push(bufferView);\r\n indexBufferViewIndex = this._bufferViews.length - 1;\r\n\r\n for (let k = 0, length = indices.length; k < length; ++k) {\r\n binaryWriter.setUInt32(indices[k]);\r\n }\r\n }\r\n }\r\n\r\n if (bufferMesh.subMeshes) {\r\n // go through all mesh primitives (submeshes)\r\n for (const submesh of bufferMesh.subMeshes) {\r\n let babylonMaterial = submesh.getMaterial() || bufferMesh.getScene().defaultMaterial;\r\n\r\n let materialIndex: Nullable<number> = null;\r\n if (babylonMaterial) {\r\n if (bufferMesh instanceof LinesMesh) {\r\n // get the color from the lines mesh and set it in the material\r\n const material: IMaterial = {\r\n name: bufferMesh.name + \" material\",\r\n };\r\n if (!bufferMesh.color.equals(Color3.White()) || bufferMesh.alpha < 1) {\r\n material.pbrMetallicRoughness = {\r\n baseColorFactor: bufferMesh.color.asArray().concat([bufferMesh.alpha]),\r\n };\r\n }\r\n this._materials.push(material);\r\n materialIndex = this._materials.length - 1;\r\n } else if (babylonMaterial instanceof MultiMaterial) {\r\n const subMaterial = babylonMaterial.subMaterials[submesh.materialIndex];\r\n if (subMaterial) {\r\n babylonMaterial = subMaterial;\r\n materialIndex = this._materialMap[babylonMaterial.uniqueId];\r\n }\r\n } else {\r\n materialIndex = this._materialMap[babylonMaterial.uniqueId];\r\n }\r\n }\r\n\r\n const glTFMaterial: Nullable<IMaterial> = materialIndex != null ? this._materials[materialIndex] : null;\r\n\r\n const meshPrimitive: IMeshPrimitive = { attributes: {} };\r\n this._setPrimitiveMode(meshPrimitive, primitiveMode);\r\n\r\n for (const attribute of attributeData) {\r\n const attributeKind = attribute.kind;\r\n if ((attributeKind === VertexBuffer.UVKind || attributeKind === VertexBuffer.UV2Kind) && !this._options.exportUnusedUVs) {\r\n if (!glTFMaterial || !this._glTFMaterialExporter._hasTexturesPresent(glTFMaterial)) {\r\n continue;\r\n }\r\n }\r\n const vertexData = bufferMesh.getVerticesData(attributeKind, undefined, undefined, true);\r\n if (vertexData) {\r\n const vertexBuffer = this._getVertexBufferFromMesh(attributeKind, bufferMesh);\r\n if (vertexBuffer) {\r\n const stride = vertexBuffer.getSize();\r\n const bufferViewIndex = attribute.bufferViewIndex;\r\n if (bufferViewIndex != undefined) {\r\n // check to see if bufferviewindex has a numeric value assigned.\r\n minMax = { min: null, max: null };\r\n if (attributeKind == VertexBuffer.PositionKind) {\r\n minMax = _GLTFUtilities._CalculateMinMaxPositions(vertexData, 0, vertexData.length / stride);\r\n }\r\n const accessor = _GLTFUtilities._CreateAccessor(\r\n bufferViewIndex,\r\n attributeKind + \" - \" + babylonTransformNode.name,\r\n attribute.accessorType,\r\n attribute.accessorComponentType,\r\n vertexData.length / stride,\r\n 0,\r\n minMax.min,\r\n minMax.max\r\n );\r\n this._accessors.push(accessor);\r\n this._setAttributeKind(meshPrimitive.attributes, attributeKind);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (indexBufferViewIndex) {\r\n // Create accessor\r\n const accessor = _GLTFUtilities._CreateAccessor(\r\n indexBufferViewIndex,\r\n \"indices - \" + babylonTransformNode.name,\r\n AccessorType.SCALAR,\r\n AccessorComponentType.UNSIGNED_INT,\r\n submesh.indexCount,\r\n submesh.indexStart * 4,\r\n null,\r\n null\r\n );\r\n this._accessors.push(accessor);\r\n meshPrimitive.indices = this._accessors.length - 1;\r\n }\r\n\r\n if (Object.keys(meshPrimitive.attributes).length > 0) {\r\n const sideOrientation = babylonMaterial._getEffectiveOrientation(bufferMesh);\r\n\r\n if (sideOrientation === (this._babylonScene.useRightHandedSystem ? Material.ClockWiseSideOrientation : Material.CounterClockWiseSideOrientation)) {\r\n let byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;\r\n if (byteOffset == null) {\r\n byteOffset = 0;\r\n }\r\n let babylonIndices: Nullable<IndicesArray> = null;\r\n if (indexBufferViewIndex != null) {\r\n babylonIndices = bufferMesh.getIndices();\r\n }\r\n if (babylonIndices) {\r\n this._reorderIndicesBasedOnPrimitiveMode(submesh, primitiveMode, babylonIndices, byteOffset, binaryWriter);\r\n } else {\r\n for (const attribute of attributeData) {\r\n const vertexData = bufferMesh.getVerticesData(attribute.kind, undefined, undefined, true);\r\n if (vertexData) {\r\n const byteOffset = this._bufferViews[vertexAttributeBufferViews[attribute.kind]].byteOffset || 0;\r\n this._reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, attribute.kind, vertexData, byteOffset, binaryWriter);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (materialIndex != null) {\r\n meshPrimitive.material = materialIndex;\r\n }\r\n }\r\n\r\n // If there are morph targets, write out targets and associated accessors\r\n if (morphTargetManager) {\r\n // By convention, morph target names are stored in the mesh extras.\r\n if (!mesh.extras) {\r\n mesh.extras = {};\r\n }\r\n mesh.extras.targetNames = [];\r\n\r\n for (let i = 0; i < morphTargetManager.numTargets; ++i) {\r\n const morphTarget = morphTargetManager.getTarget(i);\r\n mesh.extras.targetNames.push(morphTarget.name);\r\n\r\n for (const attribute of attributeData) {\r\n const morphTargetInfo = attribute.morphTargetInfo?.[i];\r\n if (morphTargetInfo) {\r\n // Write the accessor\r\n const byteOffset = 0;\r\n const accessor = _GLTFUtilities._CreateAccessor(\r\n morphTargetInfo.bufferViewIndex,\r\n `${attribute.kind} - ${morphTarget.name} (Morph Target)`,\r\n morphTargetInfo.accessorType,\r\n attribute.accessorComponentType,\r\n morphTargetInfo.vertexCount,\r\n byteOffset,\r\n morphTargetInfo.minMax?.min?.asArray() ?? null,\r\n morphTargetInfo.minMax?.max?.asArray() ?? null\r\n );\r\n this._accessors.push(accessor);\r\n\r\n // Create a target that references the new accessor\r\n if (!meshPrimitive.targets) {\r\n meshPrimitive.targets = [];\r\n }\r\n\r\n if (!meshPrimitive.targets[i]) {\r\n meshPrimitive.targets[i] = {};\r\n }\r\n\r\n this._setAttributeKind(meshPrimitive.targets[i], attribute.kind);\r\n }\r\n }\r\n }\r\n }\r\n\r\n mesh.primitives.push(meshPrimitive);\r\n\r\n this._extensionsPostExportMeshPrimitiveAsync(\"postExport\", meshPrimitive, submesh, binaryWriter);\r\n promises.push();\r\n }\r\n }\r\n }\r\n return Promise.all(promises).then(() => {\r\n /* do nothing */\r\n });\r\n }\r\n\r\n /**\r\n * Creates a glTF scene based on the array of meshes\r\n * Returns the total byte offset\r\n * @param binaryWriter Buffer to write binary data to\r\n * @returns a promise that resolves when done\r\n */\r\n private _createSceneAsync(binaryWriter: _BinaryWriter): Promise<void> {\r\n const scene: IScene = { nodes: [] };\r\n let glTFNodeIndex: number;\r\n let glTFNode: INode;\r\n let directDescendents: Node[];\r\n const nodes: Node[] = [...this._babylonScene.transformNodes, ...this._babylonScene.meshes, ...this._babylonScene.lights, ...this._babylonScene.cameras];\r\n const removedRootNodes = new Set<Node>();\r\n\r\n // Scene metadata\r\n if (this._babylonScene.metadata) {\r\n if (this._options.metadataSelector) {\r\n scene.extras = this._options.metadataSelector(this._babylonScene.metadata);\r\n } else if (this._babylonScene.metadata.gltf) {\r\n scene.extras = this._babylonScene.metadata.gltf.extras;\r\n }\r\n }\r\n\r\n // Remove no-op root nodes\r\n if ((this._options.removeNoopRootNodes ?? true) && !this._options.includeCoordinateSystemConversionNodes) {\r\n for (const rootNode of this._babylonScene.rootNodes) {\r\n if (isNoopNode(rootNode, this._babylonScene.useRightHandedSystem)) {\r\n removedRootNodes.add(rootNode);\r\n\r\n // Exclude the node from list of nodes to export\r\n nodes.splice(nodes.indexOf(rootNode), 1);\r\n }\r\n }\r\n }\r\n\r\n // Export babylon cameras to glTFCamera\r\n const cameraMap = new Map<Camera, number>();\r\n this._babylonScene.cameras.forEach((camera) => {\r\n if (this._options.shouldExportNode && !this._options.shouldExportNode(camera)) {\r\n return;\r\n }\r\n\r\n const glTFCamera: ICamera = {\r\n type: camera.mode === Camera.PERSPECTIVE_CAMERA ? CameraType.PERSPECTIVE : CameraType.ORTHOGRAPHIC,\r\n };\r\n\r\n if (camera.name) {\r\n glTFCamera.name = camera.name;\r\n }\r\n\r\n if (glTFCamera.type === CameraType.PERSPECTIVE) {\r\n glTFCamera.perspective = {\r\n aspectRatio: camera.getEngine().getAspectRatio(camera),\r\n yfov: camera.fovMode === Camera.FOVMODE_VERTICAL_FIXED ? camera.fov : camera.fov * camera.getEngine().getAspectRatio(camera),\r\n znear: camera.minZ,\r\n zfar: camera.maxZ,\r\n };\r\n } else if (glTFCamera.type === CameraType.ORTHOGRAPHIC) {\r\n const halfWidth = camera.orthoLeft && camera.orthoRight ? 0.5 * (camera.orthoRight - camera.orthoLeft) : camera.getEngine().getRenderWidth() * 0.5;\r\n const halfHeight = camera.orthoBottom && camera.orthoTop ? 0.5 * (camera.orthoTop - camera.orthoBottom) : camera.getEngine().getRenderHeight() * 0.5;\r\n glTFCamera.orthographic = {\r\n xmag: halfWidth,\r\n ymag: halfHeight,\r\n znear: camera.minZ,\r\n zfar: camera.maxZ,\r\n };\r\n }\r\n\r\n cameraMap.set(camera, this._cameras.length);\r\n this._cameras.push(glTFCamera);\r\n });\r\n\r\n const [exportNodes, exportMaterials] = this._getExportNodes(nodes);\r\n return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, ImageMimeType.PNG, true).then(() => {\r\n return this._createNodeMapAndAnimationsAsync(exportNodes, binaryWriter).then((nodeMap) => {\r\n return this._createSkinsAsync(nodeMap, binaryWriter).then((skinMap) => {\r\n this._nodeMap = nodeMap;\r\n\r\n this._totalByteLength = binaryWriter.getByteOffset();\r\n if (this._totalByteLength == undefined) {\r\n throw new Error(\"undefined byte length!\");\r\n }\r\n\r\n // Build Hierarchy with the node map.\r\n for (const babylonNode of nodes) {\r\n glTFNodeIndex = this._nodeMap[babylonNode.uniqueId];\r\n if (glTFNodeIndex !== undefined) {\r\n glTFNode = this._nodes[glTFNodeIndex];\r\n\r\n if (babylonNode.metadata) {\r\n if (this._options.metadataSelector) {\r\n glTFNode.extras = this._options.metadataSelector(babylonNode.metadata);\r\n } else if (babylonNode.metadata.gltf) {\r\n glTFNode.extras = babylonNode.metadata.gltf.extras;\r\n }\r\n }\r\n\r\n if (babylonNode instanceof Camera) {\r\n glTFNode.camera = cameraMap.get(babylonNode);\r\n }\r\n\r\n if (this._options.shouldExportNode && !this._options.shouldExportNode(babylonNode)) {\r\n Tools.Log(\"Omitting \" + babylonNode.name + \" from scene.\");\r\n } else {\r\n if (!babylonNode.parent && !this._babylonScene.useRightHandedSystem) {\r\n convertNodeHandedness(glTFNode);\r\n }\r\n\r\n if (!babylonNode.parent || removedRootNodes.has(babylonNode.parent)) {\r\n scene.nodes.push(glTFNodeIndex);\r\n }\r\n }\r\n\r\n if (babylonNode instanceof Mesh) {\r\n if (babylonNode.skeleton) {\r\n glTFNode.skin = skinMap[babylonNode.skeleton.uniqueId];\r\n }\r\n }\r\n\r\n directDescendents = babylonNode.getDescendants(true);\r\n if (!glTFNode.children && directDescendents && directDescendents.length) {\r\n const children: number[] = [];\r\n for (const descendent of directDescendents) {\r\n if (this._nodeMap[descendent.uniqueId] != null) {\r\n children.push(this._nodeMap[descendent.uniqueId]);\r\n }\r\n }\r\n if (children.length) {\r\n glTFNode.children = children;\r\n }\r\n }\r\n }\r\n }\r\n if (scene.nodes.length) {\r\n this._scenes.push(scene);\r\n }\r\n });\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Getting the nodes and materials that would be exported.\r\n * @param nodes Babylon transform nodes\r\n * @returns Set of materials which would be exported.\r\n */\r\n private _getExportNodes(nodes: Node[]): [Node[], Set<Material>] {\r\n const exportNodes: Node[] = [];\r\n const exportMaterials: Set<Material> = new Set<Material>();\r\n\r\n for (const babylonNode of nodes) {\r\n if (!this._options.shouldExportNode || this._options.shouldExportNode(babylonNode)) {\r\n exportNodes.push(babylonNode);\r\n\r\n const babylonMesh = babylonNode as AbstractMesh;\r\n if (babylonMesh.subMeshes && babylonMesh.subMeshes.length > 0) {\r\n const material = babylonMesh.material || babylonMesh.getScene().defaultMaterial;\r\n if (material instanceof MultiMaterial) {\r\n for (const subMaterial of material.subMaterials) {\r\n if (subMaterial) {\r\n exportMaterials.add(subMaterial);\r\n }\r\n }\r\n } else {\r\n exportMaterials.add(material);\r\n }\r\n }\r\n } else {\r\n `Excluding node ${babylonNode.name}`;\r\n }\r\n }\r\n\r\n return [exportNodes, exportMaterials];\r\n }\r\n\r\n /**\r\n * Creates a mapping of Node unique id to node index and handles animations\r\n * @param nodes Babylon transform nodes\r\n * @param binaryWriter Buffer to write binary data to\r\n * @returns Node mapping of unique id to index\r\n */\r\n private _createNodeMapAndAnimationsAsync(nodes: Node[], binaryWriter: _BinaryWriter): Promise<{ [key: number]: number }> {\r\n let promiseChain = Promise.resolve();\r\n const nodeMap: { [key: number]: number } = {};\r\n let nodeIndex: number;\r\n const runtimeGLTFAnimation: IAnimation = {\r\n name: \"runtime animations\",\r\n channels: [],\r\n samplers: [],\r\n };\r\n const idleGLTFAnimations: IAnimation[] = [];\r\n\r\n for (const babylonNode of nodes) {\r\n promiseChain = promiseChain.then(() => {\r\n return this._createNodeAsync(babylonNode, binaryWriter).then((node) => {\r\n const promise = this._extensionsPostExportNodeAsync(\"createNodeAsync\", node, babylonNode, nodeMap, binaryWriter);\r\n if (promise == null) {\r\n Tools.Warn(`Not exporting node ${babylonNode.name}`);\r\n return Promise.resolve();\r\n } else {\r\n return promise.then((node) => {\r\n if (!node) {\r\n return;\r\n }\r\n this._nodes.push(node);\r\n nodeIndex = this._nodes.length - 1;\r\n nodeMap[babylonNode.uniqueId] = nodeIndex;\r\n\r\n if (!this._babylonScene.animationGroups.length) {\r\n _GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations(\r\n babylonNode,\r\n runtimeGLTFAnimation,\r\n idleGLTFAnimations,\r\n nodeMap,\r\n this._nodes,\r\n binaryWriter,\r\n this._bufferViews,\r\n this._accessors,\r\n this._animationSampleRate,\r\n this._options.shouldExportAnimation\r\n );\r\n if (babylonNode.animations.length) {\r\n _GLTFAnimation._CreateNodeAnimationFromNodeAnimations(\r\n babylonNode,\r\n runtimeGLTFAnimation,\r\n idleGLTFAnimations,\r\n nodeMap,\r\n this._nodes,\r\n binaryWriter,\r\n this._bufferViews,\r\n this._accessors,\r\n this._animationSampleRate,\r\n this._options.shouldExportAnimation\r\n );\r\n }\r\n }\r\n });\r\n }\r\n });\r\n });\r\n }\r\n\r\n return promiseChain.then(() => {\r\n if (runtimeGLTFAnimation.channels.length && runtimeGLTFAnimation.samplers.length) {\r\n this._animations.push(runtimeGLTFAnimation);\r\n }\r\n idleGLTFAnimations.forEach((idleGLTFAnimation) => {\r\n if (idleGLTFAnimation.channels.length && idleGLTFAnimation.samplers.length) {\r\n this._animations.push(idleGLTFAnimation);\r\n }\r\n });\r\n\r\n if (this._babylonScene.animationGroups.length) {\r\n _GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups(\r\n this._babylonScene,\r\n this._animations,\r\n nodeMap,\r\n binaryWriter,\r\n this._bufferViews,\r\n this._accessors,\r\n this._animationSampleRate,\r\n this._options.shouldExportAnimation\r\n );\r\n }\r\n\r\n return nodeMap;\r\n });\r\n }\r\n\r\n /**\r\n * Creates a glTF node from a Babylon mesh\r\n * @param babylonNode Source Babylon mesh\r\n * @param binaryWriter Buffer for storing geometry data\r\n * @returns glTF node\r\n */\r\n private _createNodeAsync(babylonNode: Node, binaryWriter: _BinaryWriter): Promise<INode> {\r\n return Promise.resolve().then(() => {\r\n // create node to hold translation/rotation/scale and the mesh\r\n const node: INode = {};\r\n // create mesh\r\n const mesh: IMesh = { primitives: [] };\r\n\r\n if (babylonNode.name) {\r\n node.name = babylonNode.name;\r\n }\r\n\r\n if (babylonNode instanceof TransformNode) {\r\n // Set transformation\r\n this._setNodeTransformation(node, babylonNode);\r\n if (babylonNode instanceof Mesh) {\r\n const morphTargetManager = babylonNode.morphTargetManager;\r\n if (morphTargetManager && morphTargetManager.numTargets > 0) {\r\n mesh.weights = [];\r\n for (let i = 0; i < morphTargetManager.numTargets; ++i) {\r\n mesh.weights.push(morphTargetManager.getTarget(i).influence);\r\n }\r\n }\r\n }\r\n return this._setPrimitiveAttributesAsync(mesh, babylonNode, binaryWriter).then(() => {\r\n if (mesh.primitives.length) {\r\n this._meshes.push(mesh);\r\n node.mesh = this._meshes.length - 1;\r\n }\r\n return node;\r\n });\r\n } else if (babylonNode instanceof Camera) {\r\n this._setCameraTransformation(node, babylonNode);\r\n return node;\r\n } else {\r\n return node;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates a glTF skin from a Babylon skeleton\r\n * @param nodeMap Babylon transform nodes\r\n * @param binaryWriter Buffer to write binary data to\r\n * @returns Node mapping of unique id to index\r\n */\r\n private _createSkinsAsync(nodeMap: { [key: number]: number }, binaryWriter: _BinaryWriter): Promise<{ [key: number]: number }> {\r\n const promiseChain = Promise.resolve();\r\n const skinMap: { [key: number]: number } = {};\r\n for (const skeleton of this._babylonScene.skeletons) {\r\n if (skeleton.bones.length <= 0) {\r\n continue;\r\n }\r\n // create skin\r\n const skin: ISkin = { joints: [] };\r\n const inverseBindMatrices: Matrix[] = [];\r\n\r\n const boneIndexMap: { [index: number]: Bone } = {};\r\n let maxBoneIndex = -1;\r\n for (let i = 0; i < skeleton.bones.length; ++i) {\r\n const bone = skeleton.bones[i];\r\n const boneIndex = bone.getIndex() ?? i;\r\n if (boneIndex !== -1) {\r\n boneIndexMap[boneIndex] = bone;\r\n if (boneIndex > maxBoneIndex) {\r\n maxBoneIndex = boneIndex;\r\n }\r\n }\r\n }\r\n\r\n for (let boneIndex = 0; boneIndex <= maxBoneIndex; ++boneIndex) {\r\n const bone = boneIndexMap[boneIndex];\r\n inverseBindMatrices.push(bone.getInvertedAbsoluteTransform());\r\n\r\n const transformNode = bone.getTransformNode();\r\n if (transformNode && nodeMap[transformNode.uniqueId] !== null && nodeMap[transformNode.uniqueId] !== undefined) {\r\n skin.joints.push(nodeMap[transformNode.uniqueId]);\r\n } else {\r\n Tools.Warn(\"Exporting a bone without a linked transform node is currently unsupported\");\r\n }\r\n }\r\n\r\n if (skin.joints.length > 0) {\r\n // create buffer view for inverse bind matrices\r\n const byteStride = 64; // 4 x 4 matrix of 32 bit float\r\n const byteLength = inverseBindMatrices.length * byteStride;\r\n const bufferViewOffset = binaryWriter.getByteOffset();\r\n const bufferView = _GLTFUtilities._CreateBufferView(0, bufferViewOffset, byteLength, undefined, \"InverseBindMatrices\" + \" - \" + skeleton.name);\r\n this._bufferViews.push(bufferView);\r\n const bufferViewIndex = this._bufferViews.length - 1;\r\n const bindMatrixAccessor = _GLTFUtilities._CreateAccessor(\r\n bufferViewIndex,\r\n \"InverseBindMatrices\" + \" - \" + skeleton.name,\r\n AccessorType.MAT4,\r\n AccessorComponentType.FLOAT,\r\n inverseBindMatrices.length,\r\n null,\r\n null,\r\n null\r\n );\r\n const inverseBindAccessorIndex = this._accessors.push(bindMatrixAccessor) - 1;\r\n skin.inverseBindMatrices = inverseBindAccessorIndex;\r\n this._skins.push(skin);\r\n skinMap[skeleton.uniqueId] = this._skins.length - 1;\r\n\r\n inverseBindMatrices.forEach((mat) => {\r\n mat.m.forEach((cell: number) => {\r\n binaryWriter.setFloat32(cell);\r\n });\r\n });\r\n }\r\n }\r\n return promiseChain.then(() => {\r\n return skinMap;\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n *\r\n * Stores glTF binary data. If the array buffer byte length is exceeded, it doubles in size dynamically\r\n */\r\nexport class _BinaryWriter {\r\n /**\r\n * Array buffer which stores all binary data\r\n */\r\n private _arrayBuffer: ArrayBuffer;\r\n /**\r\n * View of the array buffer\r\n */\r\n private _dataView: DataView;\r\n /**\r\n * byte offset of data in array buffer\r\n */\r\n private _byteOffset: number;\r\n /**\r\n * Initialize binary writer with an initial byte length\r\n * @param byteLength Initial byte length of the array buffer\r\n */\r\n constructor(byteLength: number) {\r\n this._arrayBuffer = new ArrayBuffer(byteLength);\r\n this._dataView = new DataView(this._arrayBuffer);\r\n this._byteOffset = 0;\r\n }\r\n /**\r\n * Resize the array buffer to the specified byte length\r\n * @param byteLength The new byte length\r\n * @returns The resized array buffer\r\n */\r\n private _resizeBuffer(byteLength: number): ArrayBuffer {\r\n const newBuffer = new ArrayBuffer(byteLength);\r\n const copyOldBufferSize = Math.min(this._arrayBuffer.byteLength, byteLength);\r\n const oldUint8Array = new Uint8Array(this._arrayBuffer, 0, copyOldBufferSize);\r\n const newUint8Array = new Uint8Array(newBuffer);\r\n newUint8Array.set(oldUint8Array, 0);\r\n this._arrayBuffer = newBuffer;\r\n this._dataView = new DataView(this._arrayBuffer);\r\n\r\n return newBuffer;\r\n }\r\n /**\r\n * Get an array buffer with the length of the byte offset\r\n * @returns ArrayBuffer resized to the byte offset\r\n */\r\n public getArrayBuffer(): ArrayBuffer {\r\n return this._resizeBuffer(this.getByteOffset());\r\n }\r\n /**\r\n * Get the byte offset of the array buffer\r\n * @returns byte offset\r\n */\r\n public getByteOffset(): number {\r\n if (this._byteOffset == undefined) {\r\n throw new Error(\"Byte offset is undefined!\");\r\n }\r\n return this._byteOffset;\r\n }\r\n /**\r\n * Stores an UInt8 in the array buffer\r\n * @param entry\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n */\r\n public setUInt8(entry: number, byteOffset?: number) {\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setUint8(byteOffset, entry);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n } else {\r\n if (this._byteOffset + 1 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setUint8(this._byteOffset, entry);\r\n this._byteOffset += 1;\r\n }\r\n }\r\n\r\n /**\r\n * Stores an UInt16 in the array buffer\r\n * @param entry\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n */\r\n public setUInt16(entry: number, byteOffset?: number) {\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setUint16(byteOffset, entry, true);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n } else {\r\n if (this._byteOffset + 2 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setUint16(this._byteOffset, entry, true);\r\n this._byteOffset += 2;\r\n }\r\n }\r\n\r\n /**\r\n * Gets an UInt32 in the array buffer\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n * @returns entry\r\n */\r\n public getUInt32(byteOffset: number): number {\r\n if (byteOffset < this._byteOffset) {\r\n return this._dataView.getUint32(byteOffset, true);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n throw new Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n }\r\n\r\n public getVector3Float32FromRef(vector3: Vector3, byteOffset: number): void {\r\n if (byteOffset + 8 > this._byteOffset) {\r\n Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);\r\n } else {\r\n vector3.x = this._dataView.getFloat32(byteOffset, true);\r\n vector3.y = this._dataView.getFloat32(byteOffset + 4, true);\r\n vector3.z = this._dataView.getFloat32(byteOffset + 8, true);\r\n }\r\n }\r\n\r\n public setVector3Float32FromRef(vector3: Vector3, byteOffset: number): void {\r\n if (byteOffset + 8 > this._byteOffset) {\r\n Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);\r\n } else {\r\n this._dataView.setFloat32(byteOffset, vector3.x, true);\r\n this._dataView.setFloat32(byteOffset + 4, vector3.y, true);\r\n this._dataView.setFloat32(byteOffset + 8, vector3.z, true);\r\n }\r\n }\r\n\r\n public getVector4Float32FromRef(vector4: Vector4, byteOffset: number): void {\r\n if (byteOffset + 12 > this._byteOffset) {\r\n Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);\r\n } else {\r\n vector4.x = this._dataView.getFloat32(byteOffset, true);\r\n vector4.y = this._dataView.getFloat32(byteOffset + 4, true);\r\n vector4.z = this._dataView.getFloat32(byteOffset + 8, true);\r\n vector4.w = this._dataView.getFloat32(byteOffset + 12, true);\r\n }\r\n }\r\n\r\n public setVector4Float32FromRef(vector4: Vector4, byteOffset: number): void {\r\n if (byteOffset + 12 > this._byteOffset) {\r\n Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);\r\n } else {\r\n this._dataView.setFloat32(byteOffset, vector4.x, true);\r\n this._dataView.setFloat32(byteOffset + 4, vector4.y, true);\r\n this._dataView.setFloat32(byteOffset + 8, vector4.z, true);\r\n this._dataView.setFloat32(byteOffset + 12, vector4.w, true);\r\n }\r\n }\r\n /**\r\n * Stores a Float32 in the array buffer\r\n * @param entry\r\n * @param byteOffset\r\n */\r\n public setFloat32(entry: number, byteOffset?: number) {\r\n if (isNaN(entry)) {\r\n Tools.Error(\"Invalid data being written!\");\r\n }\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setFloat32(byteOffset, entry, true);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary length!\");\r\n }\r\n }\r\n if (this._byteOffset + 4 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setFloat32(this._byteOffset, entry, true);\r\n this._byteOffset += 4;\r\n }\r\n /**\r\n * Stores an UInt32 in the array buffer\r\n * @param entry\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n */\r\n public setUInt32(entry: number, byteOffset?: number) {\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setUint32(byteOffset, entry, true);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n } else {\r\n if (this._byteOffset + 4 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setUint32(this._byteOffset, entry, true);\r\n this._byteOffset += 4;\r\n }\r\n }\r\n /**\r\n * Stores an Int16 in the array buffer\r\n * @param entry\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n */\r\n public setInt16(entry: number, byteOffset?: number) {\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setInt16(byteOffset, entry, true);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n } else {\r\n if (this._byteOffset + 2 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setInt16(this._byteOffset, entry, true);\r\n this._byteOffset += 2;\r\n }\r\n }\r\n /**\r\n * Stores a byte in the array buffer\r\n * @param entry\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n */\r\n public setByte(entry: number, byteOffset?: number) {\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setInt8(byteOffset, entry);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n } else {\r\n if (this._byteOffset + 1 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setInt8(this._byteOffset, entry);\r\n this._byteOffset++;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"glTFExporter.js","sourceRoot":"","sources":["../../../../../dev/serializers/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AAC,CAAC,CAAC;YACzD,CAAC;YACD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type {\r\n IBufferView,\r\n IAccessor,\r\n INode,\r\n IScene,\r\n IMesh,\r\n IMaterial,\r\n ITexture,\r\n IImage,\r\n ISampler,\r\n IAnimation,\r\n IMeshPrimitive,\r\n IBuffer,\r\n IGLTF,\r\n ITextureInfo,\r\n ISkin,\r\n ICamera,\r\n} from \"babylonjs-gltf2interface\";\r\nimport { AccessorType, ImageMimeType, MeshPrimitiveMode, AccessorComponentType, CameraType } from \"babylonjs-gltf2interface\";\r\n\r\nimport type { FloatArray, IndicesArray, Nullable } from \"core/types\";\r\nimport { Matrix, TmpVectors, Vector2, Vector3, Vector4, Quaternion } from \"core/Maths/math.vector\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { Node } from \"core/node\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport type { MorphTarget } from \"core/Morph/morphTarget\";\r\nimport { LinesMesh } from \"core/Meshes/linesMesh\";\r\nimport { InstancedMesh } from \"core/Meshes/instancedMesh\";\r\nimport type { Bone } from \"core/Bones/bone\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { Engine } from \"core/Engines/engine\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport type { IGLTFExporterExtensionV2 } from \"./glTFExporterExtension\";\r\nimport { _GLTFMaterialExporter } from \"./glTFMaterialExporter\";\r\nimport type { IExportOptions } from \"./glTFSerializer\";\r\nimport { _GLTFUtilities } from \"./glTFUtilities\";\r\nimport { GLTFData } from \"./glTFData\";\r\nimport { _GLTFAnimation } from \"./glTFAnimation\";\r\nimport { Camera } from \"core/Cameras/camera\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport { MultiMaterial } from \"core/Materials/multiMaterial\";\r\n\r\n// Matrix that converts handedness on the X-axis.\r\nconst convertHandednessMatrix = Matrix.Compose(new Vector3(-1, 1, 1), Quaternion.Identity(), Vector3.Zero());\r\n\r\n// 180 degrees rotation in Y.\r\nconst rotation180Y = new Quaternion(0, 1, 0, 0);\r\n\r\nfunction isNoopNode(node: Node, useRightHandedSystem: boolean): boolean {\r\n if (!(node instanceof TransformNode)) {\r\n return false;\r\n }\r\n\r\n // Transform\r\n if (useRightHandedSystem) {\r\n const matrix = node.getWorldMatrix();\r\n if (!matrix.isIdentity()) {\r\n return false;\r\n }\r\n } else {\r\n const matrix = node.getWorldMatrix().multiplyToRef(convertHandednessMatrix, TmpVectors.Matrix[0]);\r\n if (!matrix.isIdentity()) {\r\n return false;\r\n }\r\n }\r\n\r\n // Geometry\r\n if ((node instanceof Mesh && node.geometry) || (node instanceof InstancedMesh && node.sourceMesh.geometry)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction convertNodeHandedness(node: INode): void {\r\n const translation = Vector3.FromArrayToRef(node.translation || [0, 0, 0], 0, TmpVectors.Vector3[0]);\r\n const rotation = Quaternion.FromArrayToRef(node.rotation || [0, 0, 0, 1], 0, TmpVectors.Quaternion[0]);\r\n const scale = Vector3.FromArrayToRef(node.scale || [1, 1, 1], 0, TmpVectors.Vector3[1]);\r\n const matrix = Matrix.ComposeToRef(scale, rotation, translation, TmpVectors.Matrix[0]).multiplyToRef(convertHandednessMatrix, TmpVectors.Matrix[0]);\r\n\r\n matrix.decompose(scale, rotation, translation);\r\n\r\n if (translation.equalsToFloats(0, 0, 0)) {\r\n delete node.translation;\r\n } else {\r\n node.translation = translation.asArray();\r\n }\r\n\r\n if (Quaternion.IsIdentity(rotation)) {\r\n delete node.rotation;\r\n } else {\r\n node.rotation = rotation.asArray();\r\n }\r\n\r\n if (scale.equalsToFloats(1, 1, 1)) {\r\n delete node.scale;\r\n } else {\r\n node.scale = scale.asArray();\r\n }\r\n}\r\n\r\nfunction getBinaryWriterFunc(binaryWriter: _BinaryWriter, attributeComponentKind: AccessorComponentType): Nullable<(entry: number, byteOffset?: number) => void> {\r\n switch (attributeComponentKind) {\r\n case AccessorComponentType.UNSIGNED_BYTE: {\r\n return binaryWriter.setUInt8.bind(binaryWriter);\r\n }\r\n case AccessorComponentType.UNSIGNED_SHORT: {\r\n return binaryWriter.setUInt16.bind(binaryWriter);\r\n }\r\n case AccessorComponentType.UNSIGNED_INT: {\r\n return binaryWriter.setUInt32.bind(binaryWriter);\r\n }\r\n case AccessorComponentType.FLOAT: {\r\n return binaryWriter.setFloat32.bind(binaryWriter);\r\n }\r\n default: {\r\n Tools.Warn(\"Unsupported Attribute Component kind: \" + attributeComponentKind);\r\n return null;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Utility interface for storing vertex attribute data\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ninterface _IVertexAttributeData {\r\n /**\r\n * Specifies the Babylon Vertex Buffer Type (Position, Normal, Color, etc.)\r\n */\r\n kind: string;\r\n\r\n /**\r\n * Specifies the glTF Accessor Type (VEC2, VEC3, etc.)\r\n */\r\n accessorType: AccessorType;\r\n\r\n /**\r\n * Specifies the glTF Accessor Component Type (BYTE, UNSIGNED_BYTE, FLOAT, SHORT, INT, etc..)\r\n */\r\n accessorComponentType: AccessorComponentType;\r\n\r\n /**\r\n * Specifies the BufferView index for the vertex attribute data\r\n */\r\n bufferViewIndex?: number;\r\n\r\n /**\r\n * Specifies the number of bytes per attribute element (e.g. position would be 3 floats (x/y/z) where each float is 4 bytes, so a 12 byte stride)\r\n */\r\n byteStride?: number;\r\n\r\n /**\r\n * Specifies information about each morph target associated with this attribute\r\n */\r\n morphTargetInfo?: Readonly<{ bufferViewIndex: number; vertexCount: number; accessorType: AccessorType; minMax?: { min: Vector3; max: Vector3 } }>[];\r\n}\r\n\r\n/**\r\n * Converts Babylon Scene into glTF 2.0.\r\n * @internal\r\n */\r\nexport class _Exporter {\r\n /**\r\n * Stores the glTF to export\r\n */\r\n public _glTF: IGLTF;\r\n /**\r\n * Stores all generated buffer views, which represents views into the main glTF buffer data\r\n */\r\n public _bufferViews: IBufferView[];\r\n /**\r\n * Stores all the generated accessors, which is used for accessing the data within the buffer views in glTF\r\n */\r\n public _accessors: IAccessor[];\r\n /**\r\n * Stores all the generated nodes, which contains transform and/or mesh information per node\r\n */\r\n public _nodes: INode[];\r\n /**\r\n * Stores all the generated glTF scenes, which stores multiple node hierarchies\r\n */\r\n private _scenes: IScene[];\r\n /**\r\n * Stores all the generated glTF cameras\r\n */\r\n private _cameras: ICamera[];\r\n /**\r\n * Stores all the generated mesh information, each containing a set of primitives to render in glTF\r\n */\r\n private _meshes: IMesh[];\r\n /**\r\n * Stores all the generated material information, which represents the appearance of each primitive\r\n */\r\n public _materials: IMaterial[];\r\n\r\n public _materialMap: { [materialID: number]: number };\r\n /**\r\n * Stores all the generated texture information, which is referenced by glTF materials\r\n */\r\n public _textures: ITexture[];\r\n /**\r\n * Stores all the generated image information, which is referenced by glTF textures\r\n */\r\n public _images: IImage[];\r\n\r\n /**\r\n * Stores all the texture samplers\r\n */\r\n public _samplers: ISampler[];\r\n /**\r\n * Stores all the generated glTF skins\r\n */\r\n public _skins: ISkin[];\r\n /**\r\n * Stores all the generated animation samplers, which is referenced by glTF animations\r\n */\r\n /**\r\n * Stores the animations for glTF models\r\n */\r\n private _animations: IAnimation[];\r\n /**\r\n * Stores the total amount of bytes stored in the glTF buffer\r\n */\r\n private _totalByteLength: number;\r\n /**\r\n * Stores a reference to the Babylon scene containing the source geometry and material information\r\n */\r\n public _babylonScene: Scene;\r\n /**\r\n * Stores a map of the image data, where the key is the file name and the value\r\n * is the image data\r\n */\r\n public _imageData: { [fileName: string]: { data: ArrayBuffer; mimeType: ImageMimeType } };\r\n\r\n private _orderedImageData: Array<{ data: ArrayBuffer; mimeType: ImageMimeType }>;\r\n\r\n /**\r\n * Stores a map of the unique id of a node to its index in the node array\r\n */\r\n private _nodeMap: { [key: number]: number };\r\n\r\n /**\r\n * Baked animation sample rate\r\n */\r\n private _animationSampleRate: number;\r\n\r\n private _options: IExportOptions;\r\n\r\n private _localEngine: Engine;\r\n\r\n public _glTFMaterialExporter: _GLTFMaterialExporter;\r\n\r\n private _extensions: { [name: string]: IGLTFExporterExtensionV2 } = {};\r\n\r\n private static _ExtensionNames = new Array<string>();\r\n private static _ExtensionFactories: { [name: string]: (exporter: _Exporter) => IGLTFExporterExtensionV2 } = {};\r\n\r\n private _applyExtension<T>(\r\n node: Nullable<T>,\r\n extensions: IGLTFExporterExtensionV2[],\r\n index: number,\r\n actionAsync: (extension: IGLTFExporterExtensionV2, node: Nullable<T>) => Promise<Nullable<T>> | undefined\r\n ): Promise<Nullable<T>> {\r\n if (index >= extensions.length) {\r\n return Promise.resolve(node);\r\n }\r\n\r\n const currentPromise = actionAsync(extensions[index], node);\r\n\r\n if (!currentPromise) {\r\n return this._applyExtension(node, extensions, index + 1, actionAsync);\r\n }\r\n\r\n return currentPromise.then((newNode) => this._applyExtension(newNode, extensions, index + 1, actionAsync));\r\n }\r\n\r\n private _applyExtensions<T>(\r\n node: Nullable<T>,\r\n actionAsync: (extension: IGLTFExporterExtensionV2, node: Nullable<T>) => Promise<Nullable<T>> | undefined\r\n ): Promise<Nullable<T>> {\r\n const extensions: IGLTFExporterExtensionV2[] = [];\r\n for (const name of _Exporter._ExtensionNames) {\r\n extensions.push(this._extensions[name]);\r\n }\r\n\r\n return this._applyExtension(node, extensions, 0, actionAsync);\r\n }\r\n\r\n public _extensionsPreExportTextureAsync(context: string, babylonTexture: Nullable<Texture>, mimeType: ImageMimeType): Promise<Nullable<BaseTexture>> {\r\n return this._applyExtensions(babylonTexture, (extension, node) => extension.preExportTextureAsync && extension.preExportTextureAsync(context, node, mimeType));\r\n }\r\n\r\n public _extensionsPostExportMeshPrimitiveAsync(\r\n context: string,\r\n meshPrimitive: IMeshPrimitive,\r\n babylonSubMesh: SubMesh,\r\n binaryWriter: _BinaryWriter\r\n ): Promise<Nullable<IMeshPrimitive>> {\r\n return this._applyExtensions(\r\n meshPrimitive,\r\n (extension, node) => extension.postExportMeshPrimitiveAsync && extension.postExportMeshPrimitiveAsync(context, node, babylonSubMesh, binaryWriter)\r\n );\r\n }\r\n\r\n public _extensionsPostExportNodeAsync(\r\n context: string,\r\n node: Nullable<INode>,\r\n babylonNode: Node,\r\n nodeMap: { [key: number]: number },\r\n binaryWriter: _BinaryWriter\r\n ): Promise<Nullable<INode>> {\r\n return this._applyExtensions(node, (extension, node) => extension.postExportNodeAsync && extension.postExportNodeAsync(context, node, babylonNode, nodeMap, binaryWriter));\r\n }\r\n\r\n public _extensionsPostExportMaterialAsync(context: string, material: Nullable<IMaterial>, babylonMaterial: Material): Promise<Nullable<IMaterial>> {\r\n return this._applyExtensions(material, (extension, node) => extension.postExportMaterialAsync && extension.postExportMaterialAsync(context, node, babylonMaterial));\r\n }\r\n\r\n public _extensionsPostExportMaterialAdditionalTextures(context: string, material: IMaterial, babylonMaterial: Material): BaseTexture[] {\r\n const output: BaseTexture[] = [];\r\n\r\n for (const name of _Exporter._ExtensionNames) {\r\n const extension = this._extensions[name];\r\n\r\n if (extension.postExportMaterialAdditionalTextures) {\r\n output.push(...extension.postExportMaterialAdditionalTextures(context, material, babylonMaterial));\r\n }\r\n }\r\n\r\n return output;\r\n }\r\n\r\n public _extensionsPostExportTextures(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void {\r\n for (const name of _Exporter._ExtensionNames) {\r\n const extension = this._extensions[name];\r\n\r\n if (extension.postExportTexture) {\r\n extension.postExportTexture(context, textureInfo, babylonTexture);\r\n }\r\n }\r\n }\r\n\r\n private _forEachExtensions(action: (extension: IGLTFExporterExtensionV2) => void): void {\r\n for (const name of _Exporter._ExtensionNames) {\r\n const extension = this._extensions[name];\r\n if (extension.enabled) {\r\n action(extension);\r\n }\r\n }\r\n }\r\n\r\n private _extensionsOnExporting(): void {\r\n this._forEachExtensions((extension) => {\r\n if (extension.wasUsed) {\r\n if (this._glTF.extensionsUsed == null) {\r\n this._glTF.extensionsUsed = [];\r\n }\r\n\r\n if (this._glTF.extensionsUsed.indexOf(extension.name) === -1) {\r\n this._glTF.extensionsUsed.push(extension.name);\r\n }\r\n\r\n if (extension.required) {\r\n if (this._glTF.extensionsRequired == null) {\r\n this._glTF.extensionsRequired = [];\r\n }\r\n if (this._glTF.extensionsRequired.indexOf(extension.name) === -1) {\r\n this._glTF.extensionsRequired.push(extension.name);\r\n }\r\n }\r\n\r\n if (this._glTF.extensions == null) {\r\n this._glTF.extensions = {};\r\n }\r\n\r\n if (extension.onExporting) {\r\n extension.onExporting();\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Load glTF serializer extensions\r\n */\r\n private _loadExtensions(): void {\r\n for (const name of _Exporter._ExtensionNames) {\r\n const extension = _Exporter._ExtensionFactories[name](this);\r\n this._extensions[name] = extension;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a glTF Exporter instance, which can accept optional exporter options\r\n * @param babylonScene Babylon scene object\r\n * @param options Options to modify the behavior of the exporter\r\n */\r\n public constructor(babylonScene?: Nullable<Scene>, options?: IExportOptions) {\r\n this._glTF = {\r\n asset: { generator: `Babylon.js v${Engine.Version}`, version: \"2.0\" },\r\n };\r\n babylonScene = babylonScene || EngineStore.LastCreatedScene;\r\n if (!babylonScene) {\r\n return;\r\n }\r\n this._babylonScene = babylonScene;\r\n this._bufferViews = [];\r\n this._accessors = [];\r\n this._meshes = [];\r\n this._scenes = [];\r\n this._cameras = [];\r\n this._nodes = [];\r\n this._images = [];\r\n this._materials = [];\r\n this._materialMap = [];\r\n this._textures = [];\r\n this._samplers = [];\r\n this._skins = [];\r\n this._animations = [];\r\n this._imageData = {};\r\n this._orderedImageData = [];\r\n this._options = options || {};\r\n this._animationSampleRate = this._options.animationSampleRate || 1 / 60;\r\n\r\n this._glTFMaterialExporter = new _GLTFMaterialExporter(this);\r\n this._loadExtensions();\r\n }\r\n\r\n public dispose() {\r\n for (const extensionKey in this._extensions) {\r\n const extension = this._extensions[extensionKey];\r\n\r\n extension.dispose();\r\n }\r\n }\r\n\r\n public get options() {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Registers a glTF exporter extension\r\n * @param name Name of the extension to export\r\n * @param factory The factory function that creates the exporter extension\r\n */\r\n public static RegisterExtension(name: string, factory: (exporter: _Exporter) => IGLTFExporterExtensionV2): void {\r\n if (_Exporter.UnregisterExtension(name)) {\r\n Tools.Warn(`Extension with the name ${name} already exists`);\r\n }\r\n\r\n _Exporter._ExtensionFactories[name] = factory;\r\n _Exporter._ExtensionNames.push(name);\r\n }\r\n\r\n /**\r\n * Un-registers an exporter extension\r\n * @param name The name fo the exporter extension\r\n * @returns A boolean indicating whether the extension has been un-registered\r\n */\r\n public static UnregisterExtension(name: string): boolean {\r\n if (!_Exporter._ExtensionFactories[name]) {\r\n return false;\r\n }\r\n delete _Exporter._ExtensionFactories[name];\r\n\r\n const index = _Exporter._ExtensionNames.indexOf(name);\r\n if (index !== -1) {\r\n _Exporter._ExtensionNames.splice(index, 1);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _reorderIndicesBasedOnPrimitiveMode(submesh: SubMesh, primitiveMode: number, babylonIndices: IndicesArray, byteOffset: number, binaryWriter: _BinaryWriter) {\r\n switch (primitiveMode) {\r\n case Material.TriangleFillMode: {\r\n if (!byteOffset) {\r\n byteOffset = 0;\r\n }\r\n for (let i = submesh.indexStart, length = submesh.indexStart + submesh.indexCount; i < length; i = i + 3) {\r\n const index = byteOffset + i * 4;\r\n // swap the second and third indices\r\n const secondIndex = binaryWriter.getUInt32(index + 4);\r\n const thirdIndex = binaryWriter.getUInt32(index + 8);\r\n binaryWriter.setUInt32(thirdIndex, index + 4);\r\n binaryWriter.setUInt32(secondIndex, index + 8);\r\n }\r\n break;\r\n }\r\n case Material.TriangleFanDrawMode: {\r\n for (let i = submesh.indexStart + submesh.indexCount - 1, start = submesh.indexStart; i >= start; --i) {\r\n binaryWriter.setUInt32(babylonIndices[i], byteOffset);\r\n byteOffset += 4;\r\n }\r\n break;\r\n }\r\n case Material.TriangleStripDrawMode: {\r\n if (submesh.indexCount >= 3) {\r\n binaryWriter.setUInt32(babylonIndices[submesh.indexStart + 2], byteOffset + 4);\r\n binaryWriter.setUInt32(babylonIndices[submesh.indexStart + 1], byteOffset + 8);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Reorders the vertex attribute data based on the primitive mode. This is necessary when indices are not available and the winding order is\r\n * clock-wise during export to glTF\r\n * @param submesh BabylonJS submesh\r\n * @param primitiveMode Primitive mode of the mesh\r\n * @param vertexBufferKind The type of vertex attribute\r\n * @param meshAttributeArray The vertex attribute data\r\n * @param byteOffset The offset to the binary data\r\n * @param binaryWriter The binary data for the glTF file\r\n */\r\n private _reorderVertexAttributeDataBasedOnPrimitiveMode(\r\n submesh: SubMesh,\r\n primitiveMode: number,\r\n vertexBufferKind: string,\r\n meshAttributeArray: FloatArray,\r\n byteOffset: number,\r\n binaryWriter: _BinaryWriter\r\n ): void {\r\n switch (primitiveMode) {\r\n case Material.TriangleFillMode: {\r\n this._reorderTriangleFillMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);\r\n break;\r\n }\r\n case Material.TriangleStripDrawMode: {\r\n this._reorderTriangleStripDrawMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);\r\n break;\r\n }\r\n case Material.TriangleFanDrawMode: {\r\n this._reorderTriangleFanMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is\r\n * clock-wise during export to glTF\r\n * @param submesh BabylonJS submesh\r\n * @param vertexBufferKind The type of vertex attribute\r\n * @param meshAttributeArray The vertex attribute data\r\n * @param byteOffset The offset to the binary data\r\n * @param binaryWriter The binary data for the glTF file\r\n */\r\n private _reorderTriangleFillMode(submesh: SubMesh, vertexBufferKind: string, meshAttributeArray: FloatArray, byteOffset: number, binaryWriter: _BinaryWriter) {\r\n const vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh() as Mesh);\r\n if (vertexBuffer) {\r\n const stride = vertexBuffer.byteStride / VertexBuffer.GetTypeByteLength(vertexBuffer.type);\r\n if (submesh.verticesCount % 3 !== 0) {\r\n Tools.Error(\"The submesh vertices for the triangle fill mode is not divisible by 3!\");\r\n } else {\r\n const vertexData: Vector2[] | Vector3[] | Vector4[] = [];\r\n let index = 0;\r\n switch (vertexBufferKind) {\r\n case VertexBuffer.PositionKind:\r\n case VertexBuffer.NormalKind: {\r\n for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {\r\n index = x * stride;\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index));\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + stride));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {\r\n index = x * stride;\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index));\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index + stride));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.ColorKind: {\r\n const size = vertexBuffer.getSize();\r\n for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + size) {\r\n index = x * stride;\r\n if (size === 4) {\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index));\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index + stride));\r\n } else {\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index));\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + stride));\r\n }\r\n }\r\n break;\r\n }\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind: {\r\n for (let x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {\r\n index = x * stride;\r\n (vertexData as Vector2[]).push(Vector2.FromArray(meshAttributeArray, index));\r\n (vertexData as Vector2[]).push(Vector2.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector2[]).push(Vector2.FromArray(meshAttributeArray, index + stride));\r\n }\r\n break;\r\n }\r\n default: {\r\n Tools.Error(`Unsupported Vertex Buffer type: ${vertexBufferKind}`);\r\n }\r\n }\r\n this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);\r\n }\r\n } else {\r\n Tools.Warn(`reorderTriangleFillMode: Vertex Buffer Kind ${vertexBufferKind} not present!`);\r\n }\r\n }\r\n\r\n /**\r\n * Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is\r\n * clock-wise during export to glTF\r\n * @param submesh BabylonJS submesh\r\n * @param vertexBufferKind The type of vertex attribute\r\n * @param meshAttributeArray The vertex attribute data\r\n * @param byteOffset The offset to the binary data\r\n * @param binaryWriter The binary data for the glTF file\r\n */\r\n private _reorderTriangleStripDrawMode(submesh: SubMesh, vertexBufferKind: string, meshAttributeArray: FloatArray, byteOffset: number, binaryWriter: _BinaryWriter) {\r\n const vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh() as Mesh);\r\n if (vertexBuffer) {\r\n const stride = vertexBuffer.byteStride / VertexBuffer.GetTypeByteLength(vertexBuffer.type);\r\n\r\n const vertexData: Vector2[] | Vector3[] | Vector4[] = [];\r\n let index = 0;\r\n switch (vertexBufferKind) {\r\n case VertexBuffer.PositionKind:\r\n case VertexBuffer.NormalKind: {\r\n index = submesh.verticesStart;\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + 2 * stride));\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index + stride));\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.ColorKind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n vertexBuffer.getSize() === 4\r\n ? (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index))\r\n : (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector2[]).push(Vector2.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n default: {\r\n Tools.Error(`Unsupported Vertex Buffer type: ${vertexBufferKind}`);\r\n }\r\n }\r\n this._writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, binaryWriter);\r\n } else {\r\n Tools.Warn(`reorderTriangleStripDrawMode: Vertex buffer kind ${vertexBufferKind} not present!`);\r\n }\r\n }\r\n\r\n /**\r\n * Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is\r\n * clock-wise during export to glTF\r\n * @param submesh BabylonJS submesh\r\n * @param vertexBufferKind The type of vertex attribute\r\n * @param meshAttributeArray The vertex attribute data\r\n * @param byteOffset The offset to the binary data\r\n * @param binaryWriter The binary data for the glTF file\r\n */\r\n private _reorderTriangleFanMode(submesh: SubMesh, vertexBufferKind: string, meshAttributeArray: FloatArray, byteOffset: number, binaryWriter: _BinaryWriter) {\r\n const vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh() as Mesh);\r\n if (vertexBuffer) {\r\n const stride = vertexBuffer.byteStride / VertexBuffer.GetTypeByteLength(vertexBuffer.type);\r\n\r\n const vertexData: Vector2[] | Vector3[] | Vector4[] = [];\r\n let index = 0;\r\n switch (vertexBufferKind) {\r\n case VertexBuffer.PositionKind:\r\n case VertexBuffer.NormalKind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.ColorKind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index));\r\n vertexBuffer.getSize() === 4\r\n ? (vertexData as Vector4[]).push(Vector4.FromArray(meshAttributeArray, index))\r\n : (vertexData as Vector3[]).push(Vector3.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind: {\r\n for (let x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {\r\n index = x * stride;\r\n (vertexData as Vector2[]).push(Vector2.FromArray(meshAttributeArray, index));\r\n }\r\n break;\r\n }\r\n default: {\r\n Tools.Error(`Unsupported Vertex Buffer type: ${vertexBufferKind}`);\r\n }\r\n }\r\n this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);\r\n } else {\r\n Tools.Warn(`reorderTriangleFanMode: Vertex buffer kind ${vertexBufferKind} not present!`);\r\n }\r\n }\r\n\r\n /**\r\n * Writes the vertex attribute data to binary\r\n * @param vertices The vertices to write to the binary writer\r\n * @param byteOffset The offset into the binary writer to overwrite binary data\r\n * @param vertexAttributeKind The vertex attribute type\r\n * @param binaryWriter The writer containing the binary data\r\n */\r\n private _writeVertexAttributeData(vertices: Vector2[] | Vector3[] | Vector4[], byteOffset: number, vertexAttributeKind: string, binaryWriter: _BinaryWriter) {\r\n for (const vertex of vertices) {\r\n if (vertexAttributeKind === VertexBuffer.NormalKind) {\r\n vertex.normalize();\r\n } else if (vertexAttributeKind === VertexBuffer.TangentKind && vertex instanceof Vector4) {\r\n _GLTFUtilities._NormalizeTangentFromRef(vertex);\r\n }\r\n\r\n for (const component of vertex.asArray()) {\r\n binaryWriter.setFloat32(component, byteOffset);\r\n byteOffset += 4;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Writes mesh attribute data to a data buffer\r\n * Returns the bytelength of the data\r\n * @param vertexBufferKind Indicates what kind of vertex data is being passed in\r\n * @param attributeComponentKind\r\n * @param meshAttributeArray Array containing the attribute data\r\n * @param stride Specifies the space between data\r\n * @param binaryWriter The buffer to write the binary data to\r\n * @param babylonTransformNode\r\n */\r\n public _writeAttributeData(\r\n vertexBufferKind: string,\r\n attributeComponentKind: AccessorComponentType,\r\n meshAttributeArray: FloatArray,\r\n stride: number,\r\n binaryWriter: _BinaryWriter,\r\n babylonTransformNode: TransformNode\r\n ) {\r\n let vertexAttributes: number[][] = [];\r\n let index: number;\r\n\r\n switch (vertexBufferKind) {\r\n case VertexBuffer.PositionKind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector3.FromArray(meshAttributeArray, index);\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.NormalKind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector3.FromArray(meshAttributeArray, index);\r\n vertexAttributes.push(vertexData.normalize().asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector4.FromArray(meshAttributeArray, index);\r\n _GLTFUtilities._NormalizeTangentFromRef(vertexData);\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.ColorKind: {\r\n const meshMaterial = (babylonTransformNode as Mesh).material;\r\n const convertToLinear = meshMaterial ? meshMaterial.getClassName() === \"StandardMaterial\" : true;\r\n const vertexData: Color3 | Color4 = stride === 3 ? new Color3() : new Color4();\r\n const useExactSrgbConversions = this._babylonScene.getEngine().useExactSrgbConversions;\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n if (stride === 3) {\r\n Color3.FromArrayToRef(meshAttributeArray, index, vertexData as Color3);\r\n if (convertToLinear) {\r\n (vertexData as Color3).toLinearSpaceToRef(vertexData as Color3, useExactSrgbConversions);\r\n }\r\n } else {\r\n Color4.FromArrayToRef(meshAttributeArray, index, vertexData as Color4);\r\n if (convertToLinear) {\r\n (vertexData as Color4).toLinearSpaceToRef(vertexData as Color4, useExactSrgbConversions);\r\n }\r\n }\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector2.FromArray(meshAttributeArray, index);\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.MatricesIndicesKind:\r\n case VertexBuffer.MatricesIndicesExtraKind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector4.FromArray(meshAttributeArray, index);\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n case VertexBuffer.MatricesWeightsKind:\r\n case VertexBuffer.MatricesWeightsExtraKind: {\r\n for (let k = 0, length = meshAttributeArray.length / stride; k < length; ++k) {\r\n index = k * stride;\r\n const vertexData = Vector4.FromArray(meshAttributeArray, index);\r\n vertexAttributes.push(vertexData.asArray());\r\n }\r\n break;\r\n }\r\n default: {\r\n Tools.Warn(\"Unsupported Vertex Buffer Type: \" + vertexBufferKind);\r\n vertexAttributes = [];\r\n }\r\n }\r\n\r\n const writeBinaryFunc = getBinaryWriterFunc(binaryWriter, attributeComponentKind);\r\n\r\n if (writeBinaryFunc) {\r\n for (const vertexAttribute of vertexAttributes) {\r\n for (const component of vertexAttribute) {\r\n writeBinaryFunc(component);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _createMorphTargetBufferViewKind(\r\n vertexBufferKind: string,\r\n accessorType: AccessorType,\r\n attributeComponentKind: AccessorComponentType,\r\n mesh: Mesh,\r\n morphTarget: MorphTarget,\r\n binaryWriter: _BinaryWriter,\r\n byteStride: number\r\n ): Nullable<{ bufferViewIndex: number; vertexCount: number; accessorType: AccessorType; minMax?: { min: Vector3; max: Vector3 } }> {\r\n let vertexCount: number;\r\n let minMax: { min: Vector3; max: Vector3 } | undefined;\r\n const morphData: number[] = [];\r\n const difference: Vector3 = TmpVectors.Vector3[0];\r\n\r\n switch (vertexBufferKind) {\r\n case VertexBuffer.PositionKind: {\r\n const morphPositions = morphTarget.getPositions();\r\n if (!morphPositions) {\r\n return null;\r\n }\r\n\r\n const originalPositions = mesh.getVerticesData(VertexBuffer.PositionKind, undefined, undefined, true)!;\r\n const vertexStart = 0;\r\n const min = new Vector3(Infinity, Infinity, Infinity);\r\n const max = new Vector3(-Infinity, -Infinity, -Infinity);\r\n vertexCount = originalPositions.length / 3;\r\n for (let i = vertexStart; i < vertexCount; ++i) {\r\n const originalPosition = Vector3.FromArray(originalPositions, i * 3);\r\n const morphPosition = Vector3.FromArray(morphPositions, i * 3);\r\n morphPosition.subtractToRef(originalPosition, difference);\r\n min.copyFromFloats(Math.min(difference.x, min.x), Math.min(difference.y, min.y), Math.min(difference.z, min.z));\r\n max.copyFromFloats(Math.max(difference.x, max.x), Math.max(difference.y, max.y), Math.max(difference.z, max.z));\r\n morphData.push(difference.x, difference.y, difference.z);\r\n }\r\n\r\n minMax = { min, max };\r\n\r\n break;\r\n }\r\n case VertexBuffer.NormalKind: {\r\n const morphNormals = morphTarget.getNormals();\r\n if (!morphNormals) {\r\n return null;\r\n }\r\n\r\n const originalNormals = mesh.getVerticesData(VertexBuffer.NormalKind, undefined, undefined, true)!;\r\n const vertexStart = 0;\r\n vertexCount = originalNormals.length / 3;\r\n for (let i = vertexStart; i < vertexCount; ++i) {\r\n const originalNormal = Vector3.FromArray(originalNormals, i * 3).normalize();\r\n const morphNormal = Vector3.FromArray(morphNormals, i * 3).normalize();\r\n morphNormal.subtractToRef(originalNormal, difference);\r\n morphData.push(difference.x, difference.y, difference.z);\r\n }\r\n\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n const morphTangents = morphTarget.getTangents();\r\n if (!morphTangents) {\r\n return null;\r\n }\r\n\r\n // Handedness cannot be displaced, so morph target tangents omit the w component\r\n accessorType = AccessorType.VEC3;\r\n byteStride = 12; // 3 components (x/y/z) * 4 bytes (float32)\r\n\r\n const originalTangents = mesh.getVerticesData(VertexBuffer.TangentKind, undefined, undefined, true)!;\r\n const vertexStart = 0;\r\n vertexCount = originalTangents.length / 4;\r\n for (let i = vertexStart; i < vertexCount; ++i) {\r\n // Only read the x, y, z components and ignore w\r\n const originalTangent = Vector3.FromArray(originalTangents, i * 4);\r\n _GLTFUtilities._NormalizeTangentFromRef(originalTangent);\r\n\r\n // Morph target tangents omit the w component so it won't be present in the data\r\n const morphTangent = Vector3.FromArray(morphTangents, i * 3);\r\n _GLTFUtilities._NormalizeTangentFromRef(morphTangent);\r\n\r\n morphTangent.subtractToRef(originalTangent, difference);\r\n morphData.push(difference.x, difference.y, difference.z);\r\n }\r\n\r\n break;\r\n }\r\n default: {\r\n return null;\r\n }\r\n }\r\n\r\n const binaryWriterFunc = getBinaryWriterFunc(binaryWriter, attributeComponentKind);\r\n if (!binaryWriterFunc) {\r\n return null;\r\n }\r\n\r\n const typeByteLength = VertexBuffer.GetTypeByteLength(attributeComponentKind);\r\n const byteLength = morphData.length * typeByteLength;\r\n const bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, `${vertexBufferKind} - ${morphTarget.name} (Morph Target)`);\r\n this._bufferViews.push(bufferView);\r\n const bufferViewIndex = this._bufferViews.length - 1;\r\n\r\n for (const value of morphData) {\r\n binaryWriterFunc(value);\r\n }\r\n\r\n return { bufferViewIndex, vertexCount, accessorType, minMax };\r\n }\r\n\r\n /**\r\n * Generates glTF json data\r\n * @param shouldUseGlb Indicates whether the json should be written for a glb file\r\n * @param glTFPrefix Text to use when prefixing a glTF file\r\n * @param prettyPrint Indicates whether the json file should be pretty printed (true) or not (false)\r\n * @returns json data as string\r\n */\r\n private _generateJSON(shouldUseGlb: boolean, glTFPrefix?: string, prettyPrint?: boolean): string {\r\n const buffer: IBuffer = { byteLength: this._totalByteLength };\r\n let imageName: string;\r\n let imageData: { data: ArrayBuffer; mimeType: ImageMimeType };\r\n let bufferView: IBufferView;\r\n let byteOffset: number = this._totalByteLength;\r\n\r\n if (buffer.byteLength) {\r\n this._glTF.buffers = [buffer];\r\n }\r\n if (this._nodes && this._nodes.length) {\r\n this._glTF.nodes = this._nodes;\r\n }\r\n if (this._meshes && this._meshes.length) {\r\n this._glTF.meshes = this._meshes;\r\n }\r\n if (this._scenes && this._scenes.length) {\r\n this._glTF.scenes = this._scenes;\r\n this._glTF.scene = 0;\r\n }\r\n if (this._cameras && this._cameras.length) {\r\n this._glTF.cameras = this._cameras;\r\n }\r\n if (this._bufferViews && this._bufferViews.length) {\r\n this._glTF.bufferViews = this._bufferViews;\r\n }\r\n if (this._accessors && this._accessors.length) {\r\n this._glTF.accessors = this._accessors;\r\n }\r\n if (this._animations && this._animations.length) {\r\n this._glTF.animations = this._animations;\r\n }\r\n if (this._materials && this._materials.length) {\r\n this._glTF.materials = this._materials;\r\n }\r\n if (this._textures && this._textures.length) {\r\n this._glTF.textures = this._textures;\r\n }\r\n if (this._samplers && this._samplers.length) {\r\n this._glTF.samplers = this._samplers;\r\n }\r\n if (this._skins && this._skins.length) {\r\n this._glTF.skins = this._skins;\r\n }\r\n if (this._images && this._images.length) {\r\n if (!shouldUseGlb) {\r\n this._glTF.images = this._images;\r\n } else {\r\n this._glTF.images = [];\r\n\r\n this._images.forEach((image) => {\r\n if (image.uri) {\r\n imageData = this._imageData[image.uri];\r\n this._orderedImageData.push(imageData);\r\n imageName = image.uri.split(\".\")[0] + \" image\";\r\n bufferView = _GLTFUtilities._CreateBufferView(0, byteOffset, imageData.data.byteLength, undefined, imageName);\r\n byteOffset += imageData.data.byteLength;\r\n this._bufferViews.push(bufferView);\r\n image.bufferView = this._bufferViews.length - 1;\r\n image.name = imageName;\r\n image.mimeType = imageData.mimeType;\r\n image.uri = undefined;\r\n if (!this._glTF.images) {\r\n this._glTF.images = [];\r\n }\r\n this._glTF.images.push(image);\r\n }\r\n });\r\n // Replace uri with bufferview and mime type for glb\r\n buffer.byteLength = byteOffset;\r\n }\r\n }\r\n\r\n if (!shouldUseGlb) {\r\n buffer.uri = glTFPrefix + \".bin\";\r\n }\r\n\r\n const jsonText = prettyPrint ? JSON.stringify(this._glTF, null, 2) : JSON.stringify(this._glTF);\r\n\r\n return jsonText;\r\n }\r\n\r\n /**\r\n * Generates data for .gltf and .bin files based on the glTF prefix string\r\n * @param glTFPrefix Text to use when prefixing a glTF file\r\n * @param dispose Dispose the exporter\r\n * @returns GLTFData with glTF file data\r\n */\r\n public _generateGLTFAsync(glTFPrefix: string, dispose = true): Promise<GLTFData> {\r\n return this._generateBinaryAsync().then((binaryBuffer) => {\r\n this._extensionsOnExporting();\r\n const jsonText = this._generateJSON(false, glTFPrefix, true);\r\n const bin = new Blob([binaryBuffer], { type: \"application/octet-stream\" });\r\n\r\n const glTFFileName = glTFPrefix + \".gltf\";\r\n const glTFBinFile = glTFPrefix + \".bin\";\r\n\r\n const container = new GLTFData();\r\n\r\n container.glTFFiles[glTFFileName] = jsonText;\r\n container.glTFFiles[glTFBinFile] = bin;\r\n\r\n if (this._imageData) {\r\n for (const image in this._imageData) {\r\n container.glTFFiles[image] = new Blob([this._imageData[image].data], { type: this._imageData[image].mimeType });\r\n }\r\n }\r\n\r\n if (dispose) {\r\n this.dispose();\r\n }\r\n\r\n return container;\r\n });\r\n }\r\n\r\n /**\r\n * Creates a binary buffer for glTF\r\n * @returns array buffer for binary data\r\n */\r\n private _generateBinaryAsync(): Promise<ArrayBuffer> {\r\n const binaryWriter = new _BinaryWriter(4);\r\n return this._createSceneAsync(binaryWriter).then(() => {\r\n if (this._localEngine) {\r\n this._localEngine.dispose();\r\n }\r\n return binaryWriter.getArrayBuffer();\r\n });\r\n }\r\n\r\n /**\r\n * Pads the number to a multiple of 4\r\n * @param num number to pad\r\n * @returns padded number\r\n */\r\n private _getPadding(num: number): number {\r\n const remainder = num % 4;\r\n const padding = remainder === 0 ? remainder : 4 - remainder;\r\n\r\n return padding;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _generateGLBAsync(glTFPrefix: string, dispose = true): Promise<GLTFData> {\r\n return this._generateBinaryAsync().then((binaryBuffer) => {\r\n this._extensionsOnExporting();\r\n const jsonText = this._generateJSON(true);\r\n const glbFileName = glTFPrefix + \".glb\";\r\n const headerLength = 12;\r\n const chunkLengthPrefix = 8;\r\n let jsonLength = jsonText.length;\r\n let encodedJsonText;\r\n let imageByteLength = 0;\r\n // make use of TextEncoder when available\r\n if (typeof TextEncoder !== \"undefined\") {\r\n const encoder = new TextEncoder();\r\n encodedJsonText = encoder.encode(jsonText);\r\n jsonLength = encodedJsonText.length;\r\n }\r\n for (let i = 0; i < this._orderedImageData.length; ++i) {\r\n imageByteLength += this._orderedImageData[i].data.byteLength;\r\n }\r\n const jsonPadding = this._getPadding(jsonLength);\r\n const binPadding = this._getPadding(binaryBuffer.byteLength);\r\n const imagePadding = this._getPadding(imageByteLength);\r\n\r\n const byteLength = headerLength + 2 * chunkLengthPrefix + jsonLength + jsonPadding + binaryBuffer.byteLength + binPadding + imageByteLength + imagePadding;\r\n\r\n //header\r\n const headerBuffer = new ArrayBuffer(headerLength);\r\n const headerBufferView = new DataView(headerBuffer);\r\n headerBufferView.setUint32(0, 0x46546c67, true); //glTF\r\n headerBufferView.setUint32(4, 2, true); // version\r\n headerBufferView.setUint32(8, byteLength, true); // total bytes in file\r\n\r\n //json chunk\r\n const jsonChunkBuffer = new ArrayBuffer(chunkLengthPrefix + jsonLength + jsonPadding);\r\n const jsonChunkBufferView = new DataView(jsonChunkBuffer);\r\n jsonChunkBufferView.setUint32(0, jsonLength + jsonPadding, true);\r\n jsonChunkBufferView.setUint32(4, 0x4e4f534a, true);\r\n\r\n //json chunk bytes\r\n const jsonData = new Uint8Array(jsonChunkBuffer, chunkLengthPrefix);\r\n // if TextEncoder was available, we can simply copy the encoded array\r\n if (encodedJsonText) {\r\n jsonData.set(encodedJsonText);\r\n } else {\r\n const blankCharCode = \"_\".charCodeAt(0);\r\n for (let i = 0; i < jsonLength; ++i) {\r\n const charCode = jsonText.charCodeAt(i);\r\n // if the character doesn't fit into a single UTF-16 code unit, just put a blank character\r\n if (charCode != jsonText.codePointAt(i)) {\r\n jsonData[i] = blankCharCode;\r\n } else {\r\n jsonData[i] = charCode;\r\n }\r\n }\r\n }\r\n\r\n //json padding\r\n const jsonPaddingView = new Uint8Array(jsonChunkBuffer, chunkLengthPrefix + jsonLength);\r\n for (let i = 0; i < jsonPadding; ++i) {\r\n jsonPaddingView[i] = 0x20;\r\n }\r\n\r\n //binary chunk\r\n const binaryChunkBuffer = new ArrayBuffer(chunkLengthPrefix);\r\n const binaryChunkBufferView = new DataView(binaryChunkBuffer);\r\n binaryChunkBufferView.setUint32(0, binaryBuffer.byteLength + imageByteLength + imagePadding, true);\r\n binaryChunkBufferView.setUint32(4, 0x004e4942, true);\r\n\r\n // binary padding\r\n const binPaddingBuffer = new ArrayBuffer(binPadding);\r\n const binPaddingView = new Uint8Array(binPaddingBuffer);\r\n for (let i = 0; i < binPadding; ++i) {\r\n binPaddingView[i] = 0;\r\n }\r\n\r\n const imagePaddingBuffer = new ArrayBuffer(imagePadding);\r\n const imagePaddingView = new Uint8Array(imagePaddingBuffer);\r\n for (let i = 0; i < imagePadding; ++i) {\r\n imagePaddingView[i] = 0;\r\n }\r\n\r\n const glbData = [headerBuffer, jsonChunkBuffer, binaryChunkBuffer, binaryBuffer];\r\n\r\n // binary data\r\n for (let i = 0; i < this._orderedImageData.length; ++i) {\r\n glbData.push(this._orderedImageData[i].data);\r\n }\r\n\r\n glbData.push(binPaddingBuffer);\r\n\r\n glbData.push(imagePaddingBuffer);\r\n\r\n const glbFile = new Blob(glbData, { type: \"application/octet-stream\" });\r\n\r\n const container = new GLTFData();\r\n container.glTFFiles[glbFileName] = glbFile;\r\n\r\n if (this._localEngine != null) {\r\n this._localEngine.dispose();\r\n }\r\n\r\n if (dispose) {\r\n this.dispose();\r\n }\r\n\r\n return container;\r\n });\r\n }\r\n\r\n /**\r\n * Sets the TRS for each node\r\n * @param node glTF Node for storing the transformation data\r\n * @param babylonTransformNode Babylon mesh used as the source for the transformation data\r\n */\r\n private _setNodeTransformation(node: INode, babylonTransformNode: TransformNode): void {\r\n if (!babylonTransformNode.getPivotPoint().equalsToFloats(0, 0, 0)) {\r\n Tools.Warn(\"Pivot points are not supported in the glTF serializer\");\r\n }\r\n if (!babylonTransformNode.position.equalsToFloats(0, 0, 0)) {\r\n node.translation = babylonTransformNode.position.asArray();\r\n }\r\n\r\n if (!babylonTransformNode.scaling.equalsToFloats(1, 1, 1)) {\r\n node.scale = babylonTransformNode.scaling.asArray();\r\n }\r\n\r\n const rotationQuaternion = Quaternion.FromEulerAngles(babylonTransformNode.rotation.x, babylonTransformNode.rotation.y, babylonTransformNode.rotation.z);\r\n if (babylonTransformNode.rotationQuaternion) {\r\n rotationQuaternion.multiplyInPlace(babylonTransformNode.rotationQuaternion);\r\n }\r\n if (!Quaternion.IsIdentity(rotationQuaternion)) {\r\n node.rotation = rotationQuaternion.normalize().asArray();\r\n }\r\n }\r\n\r\n private _setCameraTransformation(node: INode, babylonCamera: Camera): void {\r\n const translation = TmpVectors.Vector3[0];\r\n const rotation = TmpVectors.Quaternion[0];\r\n babylonCamera.getWorldMatrix().decompose(undefined, rotation, translation);\r\n\r\n if (!translation.equalsToFloats(0, 0, 0)) {\r\n node.translation = translation.asArray();\r\n }\r\n\r\n // // Rotation by 180 as glTF has a different convention than Babylon.\r\n rotation.multiplyInPlace(rotation180Y);\r\n\r\n if (!Quaternion.IsIdentity(rotation)) {\r\n node.rotation = rotation.asArray();\r\n }\r\n }\r\n\r\n private _getVertexBufferFromMesh(attributeKind: string, bufferMesh: Mesh): Nullable<VertexBuffer> {\r\n if (bufferMesh.isVerticesDataPresent(attributeKind, true)) {\r\n const vertexBuffer = bufferMesh.getVertexBuffer(attributeKind, true);\r\n if (vertexBuffer) {\r\n return vertexBuffer;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Creates a bufferview based on the vertices type for the Babylon mesh\r\n * @param kind Indicates the type of vertices data\r\n * @param attributeComponentKind Indicates the numerical type used to store the data\r\n * @param babylonTransformNode The Babylon mesh to get the vertices data from\r\n * @param binaryWriter The buffer to write the bufferview data to\r\n * @param byteStride\r\n */\r\n private _createBufferViewKind(\r\n kind: string,\r\n attributeComponentKind: AccessorComponentType,\r\n babylonTransformNode: TransformNode,\r\n binaryWriter: _BinaryWriter,\r\n byteStride: number\r\n ) {\r\n const bufferMesh =\r\n babylonTransformNode instanceof Mesh\r\n ? (babylonTransformNode as Mesh)\r\n : babylonTransformNode instanceof InstancedMesh\r\n ? (babylonTransformNode as InstancedMesh).sourceMesh\r\n : null;\r\n\r\n if (bufferMesh) {\r\n const vertexBuffer = bufferMesh.getVertexBuffer(kind, true);\r\n const vertexData = bufferMesh.getVerticesData(kind, undefined, undefined, true);\r\n\r\n if (vertexBuffer && vertexData) {\r\n const typeByteLength = VertexBuffer.GetTypeByteLength(attributeComponentKind);\r\n const byteLength = vertexData.length * typeByteLength;\r\n const bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, kind + \" - \" + bufferMesh.name);\r\n this._bufferViews.push(bufferView);\r\n\r\n this._writeAttributeData(kind, attributeComponentKind, vertexData, byteStride / typeByteLength, binaryWriter, babylonTransformNode);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * The primitive mode of the Babylon mesh\r\n * @param babylonMesh The BabylonJS mesh\r\n * @returns Unsigned integer of the primitive mode or null\r\n */\r\n private _getMeshPrimitiveMode(babylonMesh: AbstractMesh): number {\r\n if (babylonMesh instanceof LinesMesh) {\r\n return Material.LineListDrawMode;\r\n }\r\n if (babylonMesh instanceof InstancedMesh || babylonMesh instanceof Mesh) {\r\n const baseMesh = babylonMesh instanceof Mesh ? babylonMesh : babylonMesh.sourceMesh;\r\n if (typeof baseMesh.overrideRenderingFillMode === \"number\") {\r\n return baseMesh.overrideRenderingFillMode;\r\n }\r\n }\r\n return babylonMesh.material ? babylonMesh.material.fillMode : Material.TriangleFillMode;\r\n }\r\n\r\n /**\r\n * Sets the primitive mode of the glTF mesh primitive\r\n * @param meshPrimitive glTF mesh primitive\r\n * @param primitiveMode The primitive mode\r\n */\r\n private _setPrimitiveMode(meshPrimitive: IMeshPrimitive, primitiveMode: number) {\r\n switch (primitiveMode) {\r\n case Material.TriangleFillMode: {\r\n // glTF defaults to using Triangle Mode\r\n break;\r\n }\r\n case Material.TriangleStripDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.TRIANGLE_STRIP;\r\n break;\r\n }\r\n case Material.TriangleFanDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.TRIANGLE_FAN;\r\n break;\r\n }\r\n case Material.PointListDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.POINTS;\r\n break;\r\n }\r\n case Material.PointFillMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.POINTS;\r\n break;\r\n }\r\n case Material.LineLoopDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.LINE_LOOP;\r\n break;\r\n }\r\n case Material.LineListDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.LINES;\r\n break;\r\n }\r\n case Material.LineStripDrawMode: {\r\n meshPrimitive.mode = MeshPrimitiveMode.LINE_STRIP;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the vertex attribute accessor based of the glTF mesh primitive\r\n * @param meshPrimitive glTF mesh primitive\r\n * @param attributeKind vertex attribute\r\n */\r\n private _setAttributeKind(attributes: { [name: string]: number }, attributeKind: string): void {\r\n switch (attributeKind) {\r\n case VertexBuffer.PositionKind: {\r\n attributes.POSITION = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.NormalKind: {\r\n attributes.NORMAL = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.ColorKind: {\r\n attributes.COLOR_0 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.TangentKind: {\r\n attributes.TANGENT = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.UVKind: {\r\n attributes.TEXCOORD_0 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.UV2Kind: {\r\n attributes.TEXCOORD_1 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.MatricesIndicesKind: {\r\n attributes.JOINTS_0 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.MatricesIndicesExtraKind: {\r\n attributes.JOINTS_1 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.MatricesWeightsKind: {\r\n attributes.WEIGHTS_0 = this._accessors.length - 1;\r\n break;\r\n }\r\n case VertexBuffer.MatricesWeightsExtraKind: {\r\n attributes.WEIGHTS_1 = this._accessors.length - 1;\r\n break;\r\n }\r\n default: {\r\n Tools.Warn(\"Unsupported Vertex Buffer Type: \" + attributeKind);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets data for the primitive attributes of each submesh\r\n * @param mesh glTF Mesh object to store the primitive attribute information\r\n * @param babylonTransformNode Babylon mesh to get the primitive attribute data from\r\n * @param binaryWriter Buffer to write the attribute data to\r\n * @returns promise that resolves when done setting the primitive attributes\r\n */\r\n private _setPrimitiveAttributesAsync(mesh: IMesh, babylonTransformNode: TransformNode, binaryWriter: _BinaryWriter): Promise<void> {\r\n const promises: Promise<IMeshPrimitive>[] = [];\r\n let bufferMesh: Nullable<Mesh> = null;\r\n let bufferView: IBufferView;\r\n let minMax: { min: Nullable<number[]>; max: Nullable<number[]> };\r\n\r\n if (babylonTransformNode instanceof Mesh) {\r\n bufferMesh = babylonTransformNode as Mesh;\r\n } else if (babylonTransformNode instanceof InstancedMesh) {\r\n bufferMesh = (babylonTransformNode as InstancedMesh).sourceMesh;\r\n }\r\n const attributeData: _IVertexAttributeData[] = [\r\n { kind: VertexBuffer.PositionKind, accessorType: AccessorType.VEC3, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 12 },\r\n { kind: VertexBuffer.NormalKind, accessorType: AccessorType.VEC3, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 12 },\r\n { kind: VertexBuffer.ColorKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 16 },\r\n { kind: VertexBuffer.TangentKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 16 },\r\n { kind: VertexBuffer.UVKind, accessorType: AccessorType.VEC2, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 8 },\r\n { kind: VertexBuffer.UV2Kind, accessorType: AccessorType.VEC2, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 8 },\r\n { kind: VertexBuffer.MatricesIndicesKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.UNSIGNED_SHORT, byteStride: 8 },\r\n { kind: VertexBuffer.MatricesIndicesExtraKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.UNSIGNED_SHORT, byteStride: 8 },\r\n { kind: VertexBuffer.MatricesWeightsKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 16 },\r\n { kind: VertexBuffer.MatricesWeightsExtraKind, accessorType: AccessorType.VEC4, accessorComponentType: AccessorComponentType.FLOAT, byteStride: 16 },\r\n ];\r\n\r\n if (bufferMesh) {\r\n let indexBufferViewIndex: Nullable<number> = null;\r\n const primitiveMode = this._getMeshPrimitiveMode(bufferMesh);\r\n const vertexAttributeBufferViews: { [attributeKind: string]: number } = {};\r\n const morphTargetManager = bufferMesh.morphTargetManager;\r\n\r\n // For each BabylonMesh, create bufferviews for each 'kind'\r\n for (const attribute of attributeData) {\r\n const attributeKind = attribute.kind;\r\n const attributeComponentKind = attribute.accessorComponentType;\r\n if (bufferMesh.isVerticesDataPresent(attributeKind, true)) {\r\n const vertexBuffer = this._getVertexBufferFromMesh(attributeKind, bufferMesh);\r\n attribute.byteStride = vertexBuffer\r\n ? vertexBuffer.getSize() * VertexBuffer.GetTypeByteLength(attribute.accessorComponentType)\r\n : VertexBuffer.DeduceStride(attributeKind) * 4;\r\n if (attribute.byteStride === 12) {\r\n attribute.accessorType = AccessorType.VEC3;\r\n }\r\n\r\n this._createBufferViewKind(attributeKind, attributeComponentKind, babylonTransformNode, binaryWriter, attribute.byteStride);\r\n attribute.bufferViewIndex = this._bufferViews.length - 1;\r\n vertexAttributeBufferViews[attributeKind] = attribute.bufferViewIndex;\r\n\r\n // Write any morph target data to the buffer and create an associated buffer view\r\n if (morphTargetManager) {\r\n for (let i = 0; i < morphTargetManager.numTargets; ++i) {\r\n const morphTarget = morphTargetManager.getTarget(i);\r\n const morphTargetInfo = this._createMorphTargetBufferViewKind(\r\n attributeKind,\r\n attribute.accessorType,\r\n attributeComponentKind,\r\n bufferMesh,\r\n morphTarget,\r\n binaryWriter,\r\n attribute.byteStride\r\n );\r\n\r\n // Store info about the morph target that will be needed later when creating per-submesh accessors\r\n if (morphTargetInfo) {\r\n if (!attribute.morphTargetInfo) {\r\n attribute.morphTargetInfo = [];\r\n }\r\n attribute.morphTargetInfo[i] = morphTargetInfo;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (bufferMesh.getTotalIndices()) {\r\n const indices = bufferMesh.getIndices();\r\n if (indices) {\r\n const byteLength = indices.length * 4;\r\n bufferView = _GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, \"Indices - \" + bufferMesh.name);\r\n this._bufferViews.push(bufferView);\r\n indexBufferViewIndex = this._bufferViews.length - 1;\r\n\r\n for (let k = 0, length = indices.length; k < length; ++k) {\r\n binaryWriter.setUInt32(indices[k]);\r\n }\r\n }\r\n }\r\n\r\n if (bufferMesh.subMeshes) {\r\n // go through all mesh primitives (submeshes)\r\n for (const submesh of bufferMesh.subMeshes) {\r\n let babylonMaterial = submesh.getMaterial() || bufferMesh.getScene().defaultMaterial;\r\n\r\n let materialIndex: Nullable<number> = null;\r\n if (babylonMaterial) {\r\n if (bufferMesh instanceof LinesMesh) {\r\n // get the color from the lines mesh and set it in the material\r\n const material: IMaterial = {\r\n name: bufferMesh.name + \" material\",\r\n };\r\n if (!bufferMesh.color.equals(Color3.White()) || bufferMesh.alpha < 1) {\r\n material.pbrMetallicRoughness = {\r\n baseColorFactor: bufferMesh.color.asArray().concat([bufferMesh.alpha]),\r\n };\r\n }\r\n this._materials.push(material);\r\n materialIndex = this._materials.length - 1;\r\n } else if (babylonMaterial instanceof MultiMaterial) {\r\n const subMaterial = babylonMaterial.subMaterials[submesh.materialIndex];\r\n if (subMaterial) {\r\n babylonMaterial = subMaterial;\r\n materialIndex = this._materialMap[babylonMaterial.uniqueId];\r\n }\r\n } else {\r\n materialIndex = this._materialMap[babylonMaterial.uniqueId];\r\n }\r\n }\r\n\r\n const glTFMaterial: Nullable<IMaterial> = materialIndex != null ? this._materials[materialIndex] : null;\r\n\r\n const meshPrimitive: IMeshPrimitive = { attributes: {} };\r\n this._setPrimitiveMode(meshPrimitive, primitiveMode);\r\n\r\n for (const attribute of attributeData) {\r\n const attributeKind = attribute.kind;\r\n if ((attributeKind === VertexBuffer.UVKind || attributeKind === VertexBuffer.UV2Kind) && !this._options.exportUnusedUVs) {\r\n if (!glTFMaterial || !this._glTFMaterialExporter._hasTexturesPresent(glTFMaterial)) {\r\n continue;\r\n }\r\n }\r\n const vertexData = bufferMesh.getVerticesData(attributeKind, undefined, undefined, true);\r\n if (vertexData) {\r\n const vertexBuffer = this._getVertexBufferFromMesh(attributeKind, bufferMesh);\r\n if (vertexBuffer) {\r\n const stride = vertexBuffer.getSize();\r\n const bufferViewIndex = attribute.bufferViewIndex;\r\n if (bufferViewIndex != undefined) {\r\n // check to see if bufferviewindex has a numeric value assigned.\r\n minMax = { min: null, max: null };\r\n if (attributeKind == VertexBuffer.PositionKind) {\r\n minMax = _GLTFUtilities._CalculateMinMaxPositions(vertexData, 0, vertexData.length / stride);\r\n }\r\n const accessor = _GLTFUtilities._CreateAccessor(\r\n bufferViewIndex,\r\n attributeKind + \" - \" + babylonTransformNode.name,\r\n attribute.accessorType,\r\n attribute.accessorComponentType,\r\n vertexData.length / stride,\r\n 0,\r\n minMax.min,\r\n minMax.max\r\n );\r\n this._accessors.push(accessor);\r\n this._setAttributeKind(meshPrimitive.attributes, attributeKind);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (indexBufferViewIndex) {\r\n // Create accessor\r\n const accessor = _GLTFUtilities._CreateAccessor(\r\n indexBufferViewIndex,\r\n \"indices - \" + babylonTransformNode.name,\r\n AccessorType.SCALAR,\r\n AccessorComponentType.UNSIGNED_INT,\r\n submesh.indexCount,\r\n submesh.indexStart * 4,\r\n null,\r\n null\r\n );\r\n this._accessors.push(accessor);\r\n meshPrimitive.indices = this._accessors.length - 1;\r\n }\r\n\r\n if (Object.keys(meshPrimitive.attributes).length > 0) {\r\n const sideOrientation = babylonMaterial._getEffectiveOrientation(bufferMesh);\r\n\r\n if (sideOrientation === (this._babylonScene.useRightHandedSystem ? Material.ClockWiseSideOrientation : Material.CounterClockWiseSideOrientation)) {\r\n let byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;\r\n if (byteOffset == null) {\r\n byteOffset = 0;\r\n }\r\n let babylonIndices: Nullable<IndicesArray> = null;\r\n if (indexBufferViewIndex != null) {\r\n babylonIndices = bufferMesh.getIndices();\r\n }\r\n if (babylonIndices) {\r\n this._reorderIndicesBasedOnPrimitiveMode(submesh, primitiveMode, babylonIndices, byteOffset, binaryWriter);\r\n } else {\r\n for (const attribute of attributeData) {\r\n const vertexData = bufferMesh.getVerticesData(attribute.kind, undefined, undefined, true);\r\n if (vertexData) {\r\n const byteOffset = this._bufferViews[vertexAttributeBufferViews[attribute.kind]].byteOffset || 0;\r\n this._reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, attribute.kind, vertexData, byteOffset, binaryWriter);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (materialIndex != null) {\r\n meshPrimitive.material = materialIndex;\r\n }\r\n }\r\n\r\n // If there are morph targets, write out targets and associated accessors\r\n if (morphTargetManager) {\r\n // By convention, morph target names are stored in the mesh extras.\r\n if (!mesh.extras) {\r\n mesh.extras = {};\r\n }\r\n mesh.extras.targetNames = [];\r\n\r\n for (let i = 0; i < morphTargetManager.numTargets; ++i) {\r\n const morphTarget = morphTargetManager.getTarget(i);\r\n mesh.extras.targetNames.push(morphTarget.name);\r\n\r\n for (const attribute of attributeData) {\r\n const morphTargetInfo = attribute.morphTargetInfo?.[i];\r\n if (morphTargetInfo) {\r\n // Write the accessor\r\n const byteOffset = 0;\r\n const accessor = _GLTFUtilities._CreateAccessor(\r\n morphTargetInfo.bufferViewIndex,\r\n `${attribute.kind} - ${morphTarget.name} (Morph Target)`,\r\n morphTargetInfo.accessorType,\r\n attribute.accessorComponentType,\r\n morphTargetInfo.vertexCount,\r\n byteOffset,\r\n morphTargetInfo.minMax?.min?.asArray() ?? null,\r\n morphTargetInfo.minMax?.max?.asArray() ?? null\r\n );\r\n this._accessors.push(accessor);\r\n\r\n // Create a target that references the new accessor\r\n if (!meshPrimitive.targets) {\r\n meshPrimitive.targets = [];\r\n }\r\n\r\n if (!meshPrimitive.targets[i]) {\r\n meshPrimitive.targets[i] = {};\r\n }\r\n\r\n this._setAttributeKind(meshPrimitive.targets[i], attribute.kind);\r\n }\r\n }\r\n }\r\n }\r\n\r\n mesh.primitives.push(meshPrimitive);\r\n\r\n this._extensionsPostExportMeshPrimitiveAsync(\"postExport\", meshPrimitive, submesh, binaryWriter);\r\n promises.push();\r\n }\r\n }\r\n }\r\n return Promise.all(promises).then(() => {\r\n /* do nothing */\r\n });\r\n }\r\n\r\n /**\r\n * Creates a glTF scene based on the array of meshes\r\n * Returns the total byte offset\r\n * @param binaryWriter Buffer to write binary data to\r\n * @returns a promise that resolves when done\r\n */\r\n private _createSceneAsync(binaryWriter: _BinaryWriter): Promise<void> {\r\n const scene: IScene = { nodes: [] };\r\n let glTFNodeIndex: number;\r\n let glTFNode: INode;\r\n let directDescendents: Node[];\r\n const nodes: Node[] = [...this._babylonScene.transformNodes, ...this._babylonScene.meshes, ...this._babylonScene.lights, ...this._babylonScene.cameras];\r\n const removedRootNodes = new Set<Node>();\r\n\r\n // Scene metadata\r\n if (this._babylonScene.metadata) {\r\n if (this._options.metadataSelector) {\r\n scene.extras = this._options.metadataSelector(this._babylonScene.metadata);\r\n } else if (this._babylonScene.metadata.gltf) {\r\n scene.extras = this._babylonScene.metadata.gltf.extras;\r\n }\r\n }\r\n\r\n // Remove no-op root nodes\r\n if ((this._options.removeNoopRootNodes ?? true) && !this._options.includeCoordinateSystemConversionNodes) {\r\n for (const rootNode of this._babylonScene.rootNodes) {\r\n if (isNoopNode(rootNode, this._babylonScene.useRightHandedSystem)) {\r\n removedRootNodes.add(rootNode);\r\n\r\n // Exclude the node from list of nodes to export\r\n nodes.splice(nodes.indexOf(rootNode), 1);\r\n }\r\n }\r\n }\r\n\r\n // Export babylon cameras to glTFCamera\r\n const cameraMap = new Map<Camera, number>();\r\n this._babylonScene.cameras.forEach((camera) => {\r\n if (this._options.shouldExportNode && !this._options.shouldExportNode(camera)) {\r\n return;\r\n }\r\n\r\n const glTFCamera: ICamera = {\r\n type: camera.mode === Camera.PERSPECTIVE_CAMERA ? CameraType.PERSPECTIVE : CameraType.ORTHOGRAPHIC,\r\n };\r\n\r\n if (camera.name) {\r\n glTFCamera.name = camera.name;\r\n }\r\n\r\n if (glTFCamera.type === CameraType.PERSPECTIVE) {\r\n glTFCamera.perspective = {\r\n aspectRatio: camera.getEngine().getAspectRatio(camera),\r\n yfov: camera.fovMode === Camera.FOVMODE_VERTICAL_FIXED ? camera.fov : camera.fov * camera.getEngine().getAspectRatio(camera),\r\n znear: camera.minZ,\r\n zfar: camera.maxZ,\r\n };\r\n } else if (glTFCamera.type === CameraType.ORTHOGRAPHIC) {\r\n const halfWidth = camera.orthoLeft && camera.orthoRight ? 0.5 * (camera.orthoRight - camera.orthoLeft) : camera.getEngine().getRenderWidth() * 0.5;\r\n const halfHeight = camera.orthoBottom && camera.orthoTop ? 0.5 * (camera.orthoTop - camera.orthoBottom) : camera.getEngine().getRenderHeight() * 0.5;\r\n glTFCamera.orthographic = {\r\n xmag: halfWidth,\r\n ymag: halfHeight,\r\n znear: camera.minZ,\r\n zfar: camera.maxZ,\r\n };\r\n }\r\n\r\n cameraMap.set(camera, this._cameras.length);\r\n this._cameras.push(glTFCamera);\r\n });\r\n\r\n const [exportNodes, exportMaterials] = this._getExportNodes(nodes);\r\n return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, ImageMimeType.PNG, true).then(() => {\r\n return this._createNodeMapAndAnimationsAsync(exportNodes, binaryWriter).then((nodeMap) => {\r\n return this._createSkinsAsync(nodeMap, binaryWriter).then((skinMap) => {\r\n this._nodeMap = nodeMap;\r\n\r\n this._totalByteLength = binaryWriter.getByteOffset();\r\n if (this._totalByteLength == undefined) {\r\n throw new Error(\"undefined byte length!\");\r\n }\r\n\r\n // Build Hierarchy with the node map.\r\n for (const babylonNode of nodes) {\r\n glTFNodeIndex = this._nodeMap[babylonNode.uniqueId];\r\n if (glTFNodeIndex !== undefined) {\r\n glTFNode = this._nodes[glTFNodeIndex];\r\n\r\n if (babylonNode.metadata) {\r\n if (this._options.metadataSelector) {\r\n glTFNode.extras = this._options.metadataSelector(babylonNode.metadata);\r\n } else if (babylonNode.metadata.gltf) {\r\n glTFNode.extras = babylonNode.metadata.gltf.extras;\r\n }\r\n }\r\n\r\n if (babylonNode instanceof Camera) {\r\n glTFNode.camera = cameraMap.get(babylonNode);\r\n }\r\n\r\n if (this._options.shouldExportNode && !this._options.shouldExportNode(babylonNode)) {\r\n Tools.Log(\"Omitting \" + babylonNode.name + \" from scene.\");\r\n } else {\r\n if (!babylonNode.parent && !this._babylonScene.useRightHandedSystem) {\r\n convertNodeHandedness(glTFNode);\r\n }\r\n\r\n if (!babylonNode.parent || removedRootNodes.has(babylonNode.parent)) {\r\n scene.nodes.push(glTFNodeIndex);\r\n }\r\n }\r\n\r\n if (babylonNode instanceof Mesh) {\r\n if (babylonNode.skeleton) {\r\n glTFNode.skin = skinMap[babylonNode.skeleton.uniqueId];\r\n }\r\n }\r\n\r\n directDescendents = babylonNode.getDescendants(true);\r\n if (!glTFNode.children && directDescendents && directDescendents.length) {\r\n const children: number[] = [];\r\n for (const descendent of directDescendents) {\r\n if (this._nodeMap[descendent.uniqueId] != null) {\r\n children.push(this._nodeMap[descendent.uniqueId]);\r\n }\r\n }\r\n if (children.length) {\r\n glTFNode.children = children;\r\n }\r\n }\r\n }\r\n }\r\n if (scene.nodes.length) {\r\n this._scenes.push(scene);\r\n }\r\n });\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Getting the nodes and materials that would be exported.\r\n * @param nodes Babylon transform nodes\r\n * @returns Set of materials which would be exported.\r\n */\r\n private _getExportNodes(nodes: Node[]): [Node[], Set<Material>] {\r\n const exportNodes: Node[] = [];\r\n const exportMaterials: Set<Material> = new Set<Material>();\r\n\r\n for (const babylonNode of nodes) {\r\n if (!this._options.shouldExportNode || this._options.shouldExportNode(babylonNode)) {\r\n exportNodes.push(babylonNode);\r\n\r\n const babylonMesh = babylonNode as AbstractMesh;\r\n if (babylonMesh.subMeshes && babylonMesh.subMeshes.length > 0) {\r\n const material = babylonMesh.material || babylonMesh.getScene().defaultMaterial;\r\n if (material instanceof MultiMaterial) {\r\n for (const subMaterial of material.subMaterials) {\r\n if (subMaterial) {\r\n exportMaterials.add(subMaterial);\r\n }\r\n }\r\n } else {\r\n exportMaterials.add(material);\r\n }\r\n }\r\n } else {\r\n `Excluding node ${babylonNode.name}`;\r\n }\r\n }\r\n\r\n return [exportNodes, exportMaterials];\r\n }\r\n\r\n /**\r\n * Creates a mapping of Node unique id to node index and handles animations\r\n * @param nodes Babylon transform nodes\r\n * @param binaryWriter Buffer to write binary data to\r\n * @returns Node mapping of unique id to index\r\n */\r\n private _createNodeMapAndAnimationsAsync(nodes: Node[], binaryWriter: _BinaryWriter): Promise<{ [key: number]: number }> {\r\n let promiseChain = Promise.resolve();\r\n const nodeMap: { [key: number]: number } = {};\r\n let nodeIndex: number;\r\n const runtimeGLTFAnimation: IAnimation = {\r\n name: \"runtime animations\",\r\n channels: [],\r\n samplers: [],\r\n };\r\n const idleGLTFAnimations: IAnimation[] = [];\r\n\r\n for (const babylonNode of nodes) {\r\n promiseChain = promiseChain.then(() => {\r\n return this._createNodeAsync(babylonNode, binaryWriter).then((node) => {\r\n const promise = this._extensionsPostExportNodeAsync(\"createNodeAsync\", node, babylonNode, nodeMap, binaryWriter);\r\n if (promise == null) {\r\n Tools.Warn(`Not exporting node ${babylonNode.name}`);\r\n return Promise.resolve();\r\n } else {\r\n return promise.then((node) => {\r\n if (!node) {\r\n return;\r\n }\r\n this._nodes.push(node);\r\n nodeIndex = this._nodes.length - 1;\r\n nodeMap[babylonNode.uniqueId] = nodeIndex;\r\n\r\n if (!this._babylonScene.animationGroups.length) {\r\n _GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations(\r\n babylonNode,\r\n runtimeGLTFAnimation,\r\n idleGLTFAnimations,\r\n nodeMap,\r\n this._nodes,\r\n binaryWriter,\r\n this._bufferViews,\r\n this._accessors,\r\n this._animationSampleRate,\r\n this._options.shouldExportAnimation\r\n );\r\n if (babylonNode.animations.length) {\r\n _GLTFAnimation._CreateNodeAnimationFromNodeAnimations(\r\n babylonNode,\r\n runtimeGLTFAnimation,\r\n idleGLTFAnimations,\r\n nodeMap,\r\n this._nodes,\r\n binaryWriter,\r\n this._bufferViews,\r\n this._accessors,\r\n this._animationSampleRate,\r\n this._options.shouldExportAnimation\r\n );\r\n }\r\n }\r\n });\r\n }\r\n });\r\n });\r\n }\r\n\r\n return promiseChain.then(() => {\r\n if (runtimeGLTFAnimation.channels.length && runtimeGLTFAnimation.samplers.length) {\r\n this._animations.push(runtimeGLTFAnimation);\r\n }\r\n idleGLTFAnimations.forEach((idleGLTFAnimation) => {\r\n if (idleGLTFAnimation.channels.length && idleGLTFAnimation.samplers.length) {\r\n this._animations.push(idleGLTFAnimation);\r\n }\r\n });\r\n\r\n if (this._babylonScene.animationGroups.length) {\r\n _GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups(\r\n this._babylonScene,\r\n this._animations,\r\n nodeMap,\r\n binaryWriter,\r\n this._bufferViews,\r\n this._accessors,\r\n this._animationSampleRate,\r\n this._options.shouldExportAnimation\r\n );\r\n }\r\n\r\n return nodeMap;\r\n });\r\n }\r\n\r\n /**\r\n * Creates a glTF node from a Babylon mesh\r\n * @param babylonNode Source Babylon mesh\r\n * @param binaryWriter Buffer for storing geometry data\r\n * @returns glTF node\r\n */\r\n private _createNodeAsync(babylonNode: Node, binaryWriter: _BinaryWriter): Promise<INode> {\r\n return Promise.resolve().then(() => {\r\n // create node to hold translation/rotation/scale and the mesh\r\n const node: INode = {};\r\n // create mesh\r\n const mesh: IMesh = { primitives: [] };\r\n\r\n if (babylonNode.name) {\r\n node.name = babylonNode.name;\r\n }\r\n\r\n if (babylonNode instanceof TransformNode) {\r\n // Set transformation\r\n this._setNodeTransformation(node, babylonNode);\r\n if (babylonNode instanceof Mesh) {\r\n const morphTargetManager = babylonNode.morphTargetManager;\r\n if (morphTargetManager && morphTargetManager.numTargets > 0) {\r\n mesh.weights = [];\r\n for (let i = 0; i < morphTargetManager.numTargets; ++i) {\r\n mesh.weights.push(morphTargetManager.getTarget(i).influence);\r\n }\r\n }\r\n }\r\n return this._setPrimitiveAttributesAsync(mesh, babylonNode, binaryWriter).then(() => {\r\n if (mesh.primitives.length) {\r\n this._meshes.push(mesh);\r\n node.mesh = this._meshes.length - 1;\r\n }\r\n return node;\r\n });\r\n } else if (babylonNode instanceof Camera) {\r\n this._setCameraTransformation(node, babylonNode);\r\n return node;\r\n } else {\r\n return node;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates a glTF skin from a Babylon skeleton\r\n * @param nodeMap Babylon transform nodes\r\n * @param binaryWriter Buffer to write binary data to\r\n * @returns Node mapping of unique id to index\r\n */\r\n private _createSkinsAsync(nodeMap: { [key: number]: number }, binaryWriter: _BinaryWriter): Promise<{ [key: number]: number }> {\r\n const promiseChain = Promise.resolve();\r\n const skinMap: { [key: number]: number } = {};\r\n for (const skeleton of this._babylonScene.skeletons) {\r\n if (skeleton.bones.length <= 0) {\r\n continue;\r\n }\r\n // create skin\r\n const skin: ISkin = { joints: [] };\r\n const inverseBindMatrices: Matrix[] = [];\r\n\r\n const boneIndexMap: { [index: number]: Bone } = {};\r\n let maxBoneIndex = -1;\r\n for (let i = 0; i < skeleton.bones.length; ++i) {\r\n const bone = skeleton.bones[i];\r\n const boneIndex = bone.getIndex() ?? i;\r\n if (boneIndex !== -1) {\r\n boneIndexMap[boneIndex] = bone;\r\n if (boneIndex > maxBoneIndex) {\r\n maxBoneIndex = boneIndex;\r\n }\r\n }\r\n }\r\n\r\n for (let boneIndex = 0; boneIndex <= maxBoneIndex; ++boneIndex) {\r\n const bone = boneIndexMap[boneIndex];\r\n inverseBindMatrices.push(bone.getInvertedAbsoluteTransform());\r\n\r\n const transformNode = bone.getTransformNode();\r\n if (transformNode && nodeMap[transformNode.uniqueId] !== null && nodeMap[transformNode.uniqueId] !== undefined) {\r\n skin.joints.push(nodeMap[transformNode.uniqueId]);\r\n } else {\r\n Tools.Warn(\"Exporting a bone without a linked transform node is currently unsupported\");\r\n }\r\n }\r\n\r\n if (skin.joints.length > 0) {\r\n // create buffer view for inverse bind matrices\r\n const byteStride = 64; // 4 x 4 matrix of 32 bit float\r\n const byteLength = inverseBindMatrices.length * byteStride;\r\n const bufferViewOffset = binaryWriter.getByteOffset();\r\n const bufferView = _GLTFUtilities._CreateBufferView(0, bufferViewOffset, byteLength, undefined, \"InverseBindMatrices\" + \" - \" + skeleton.name);\r\n this._bufferViews.push(bufferView);\r\n const bufferViewIndex = this._bufferViews.length - 1;\r\n const bindMatrixAccessor = _GLTFUtilities._CreateAccessor(\r\n bufferViewIndex,\r\n \"InverseBindMatrices\" + \" - \" + skeleton.name,\r\n AccessorType.MAT4,\r\n AccessorComponentType.FLOAT,\r\n inverseBindMatrices.length,\r\n null,\r\n null,\r\n null\r\n );\r\n const inverseBindAccessorIndex = this._accessors.push(bindMatrixAccessor) - 1;\r\n skin.inverseBindMatrices = inverseBindAccessorIndex;\r\n this._skins.push(skin);\r\n skinMap[skeleton.uniqueId] = this._skins.length - 1;\r\n\r\n inverseBindMatrices.forEach((mat) => {\r\n mat.m.forEach((cell: number) => {\r\n binaryWriter.setFloat32(cell);\r\n });\r\n });\r\n }\r\n }\r\n return promiseChain.then(() => {\r\n return skinMap;\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n *\r\n * Stores glTF binary data. If the array buffer byte length is exceeded, it doubles in size dynamically\r\n */\r\nexport class _BinaryWriter {\r\n /**\r\n * Array buffer which stores all binary data\r\n */\r\n private _arrayBuffer: ArrayBuffer;\r\n /**\r\n * View of the array buffer\r\n */\r\n private _dataView: DataView;\r\n /**\r\n * byte offset of data in array buffer\r\n */\r\n private _byteOffset: number;\r\n /**\r\n * Initialize binary writer with an initial byte length\r\n * @param byteLength Initial byte length of the array buffer\r\n */\r\n constructor(byteLength: number) {\r\n this._arrayBuffer = new ArrayBuffer(byteLength);\r\n this._dataView = new DataView(this._arrayBuffer);\r\n this._byteOffset = 0;\r\n }\r\n /**\r\n * Resize the array buffer to the specified byte length\r\n * @param byteLength The new byte length\r\n * @returns The resized array buffer\r\n */\r\n private _resizeBuffer(byteLength: number): ArrayBuffer {\r\n const newBuffer = new ArrayBuffer(byteLength);\r\n const copyOldBufferSize = Math.min(this._arrayBuffer.byteLength, byteLength);\r\n const oldUint8Array = new Uint8Array(this._arrayBuffer, 0, copyOldBufferSize);\r\n const newUint8Array = new Uint8Array(newBuffer);\r\n newUint8Array.set(oldUint8Array, 0);\r\n this._arrayBuffer = newBuffer;\r\n this._dataView = new DataView(this._arrayBuffer);\r\n\r\n return newBuffer;\r\n }\r\n /**\r\n * Get an array buffer with the length of the byte offset\r\n * @returns ArrayBuffer resized to the byte offset\r\n */\r\n public getArrayBuffer(): ArrayBuffer {\r\n return this._resizeBuffer(this.getByteOffset());\r\n }\r\n /**\r\n * Get the byte offset of the array buffer\r\n * @returns byte offset\r\n */\r\n public getByteOffset(): number {\r\n if (this._byteOffset == undefined) {\r\n throw new Error(\"Byte offset is undefined!\");\r\n }\r\n return this._byteOffset;\r\n }\r\n /**\r\n * Stores an UInt8 in the array buffer\r\n * @param entry\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n */\r\n public setUInt8(entry: number, byteOffset?: number) {\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setUint8(byteOffset, entry);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n } else {\r\n if (this._byteOffset + 1 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setUint8(this._byteOffset, entry);\r\n this._byteOffset += 1;\r\n }\r\n }\r\n\r\n /**\r\n * Stores an UInt16 in the array buffer\r\n * @param entry\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n */\r\n public setUInt16(entry: number, byteOffset?: number) {\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setUint16(byteOffset, entry, true);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n } else {\r\n if (this._byteOffset + 2 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setUint16(this._byteOffset, entry, true);\r\n this._byteOffset += 2;\r\n }\r\n }\r\n\r\n /**\r\n * Gets an UInt32 in the array buffer\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n * @returns entry\r\n */\r\n public getUInt32(byteOffset: number): number {\r\n if (byteOffset < this._byteOffset) {\r\n return this._dataView.getUint32(byteOffset, true);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n throw new Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n }\r\n\r\n public getVector3Float32FromRef(vector3: Vector3, byteOffset: number): void {\r\n if (byteOffset + 8 > this._byteOffset) {\r\n Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);\r\n } else {\r\n vector3.x = this._dataView.getFloat32(byteOffset, true);\r\n vector3.y = this._dataView.getFloat32(byteOffset + 4, true);\r\n vector3.z = this._dataView.getFloat32(byteOffset + 8, true);\r\n }\r\n }\r\n\r\n public setVector3Float32FromRef(vector3: Vector3, byteOffset: number): void {\r\n if (byteOffset + 8 > this._byteOffset) {\r\n Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);\r\n } else {\r\n this._dataView.setFloat32(byteOffset, vector3.x, true);\r\n this._dataView.setFloat32(byteOffset + 4, vector3.y, true);\r\n this._dataView.setFloat32(byteOffset + 8, vector3.z, true);\r\n }\r\n }\r\n\r\n public getVector4Float32FromRef(vector4: Vector4, byteOffset: number): void {\r\n if (byteOffset + 12 > this._byteOffset) {\r\n Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);\r\n } else {\r\n vector4.x = this._dataView.getFloat32(byteOffset, true);\r\n vector4.y = this._dataView.getFloat32(byteOffset + 4, true);\r\n vector4.z = this._dataView.getFloat32(byteOffset + 8, true);\r\n vector4.w = this._dataView.getFloat32(byteOffset + 12, true);\r\n }\r\n }\r\n\r\n public setVector4Float32FromRef(vector4: Vector4, byteOffset: number): void {\r\n if (byteOffset + 12 > this._byteOffset) {\r\n Tools.Error(`BinaryWriter: byteoffset is greater than the current binary buffer length!`);\r\n } else {\r\n this._dataView.setFloat32(byteOffset, vector4.x, true);\r\n this._dataView.setFloat32(byteOffset + 4, vector4.y, true);\r\n this._dataView.setFloat32(byteOffset + 8, vector4.z, true);\r\n this._dataView.setFloat32(byteOffset + 12, vector4.w, true);\r\n }\r\n }\r\n /**\r\n * Stores a Float32 in the array buffer\r\n * @param entry\r\n * @param byteOffset\r\n */\r\n public setFloat32(entry: number, byteOffset?: number) {\r\n if (isNaN(entry)) {\r\n Tools.Error(\"Invalid data being written!\");\r\n }\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setFloat32(byteOffset, entry, true);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary length!\");\r\n }\r\n }\r\n if (this._byteOffset + 4 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setFloat32(this._byteOffset, entry, true);\r\n this._byteOffset += 4;\r\n }\r\n /**\r\n * Stores an UInt32 in the array buffer\r\n * @param entry\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n */\r\n public setUInt32(entry: number, byteOffset?: number) {\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setUint32(byteOffset, entry, true);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n } else {\r\n if (this._byteOffset + 4 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setUint32(this._byteOffset, entry, true);\r\n this._byteOffset += 4;\r\n }\r\n }\r\n /**\r\n * Stores an Int16 in the array buffer\r\n * @param entry\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n */\r\n public setInt16(entry: number, byteOffset?: number) {\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setInt16(byteOffset, entry, true);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n } else {\r\n if (this._byteOffset + 2 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setInt16(this._byteOffset, entry, true);\r\n this._byteOffset += 2;\r\n }\r\n }\r\n /**\r\n * Stores a byte in the array buffer\r\n * @param entry\r\n * @param byteOffset If defined, specifies where to set the value as an offset.\r\n */\r\n public setByte(entry: number, byteOffset?: number) {\r\n if (byteOffset != null) {\r\n if (byteOffset < this._byteOffset) {\r\n this._dataView.setInt8(byteOffset, entry);\r\n } else {\r\n Tools.Error(\"BinaryWriter: byteoffset is greater than the current binary buffer length!\");\r\n }\r\n } else {\r\n if (this._byteOffset + 1 > this._arrayBuffer.byteLength) {\r\n this._resizeBuffer(this._arrayBuffer.byteLength * 2);\r\n }\r\n this._dataView.setInt8(this._byteOffset, entry);\r\n this._byteOffset++;\r\n }\r\n }\r\n}\r\n"]}