babylonjs.serializers.d.ts 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137
  1. declare module BABYLON {
  2. /**
  3. * Class for generating OBJ data from a Babylon scene.
  4. */
  5. export class OBJExport {
  6. /**
  7. * Exports the geometry of a Mesh array in .OBJ file format (text)
  8. * @param mesh defines the list of meshes to serialize
  9. * @param materials defines if materials should be exported
  10. * @param matlibname defines the name of the associated mtl file
  11. * @param globalposition defines if the exported positions are globals or local to the exported mesh
  12. * @returns the OBJ content
  13. */
  14. static OBJ(mesh: Mesh[], materials?: boolean, matlibname?: string, globalposition?: boolean): string;
  15. /**
  16. * Exports the material(s) of a mesh in .MTL file format (text)
  17. * @param mesh defines the mesh to extract the material from
  18. * @returns the mtl content
  19. */
  20. static MTL(mesh: Mesh): string;
  21. }
  22. }
  23. declare module BABYLON {
  24. /** @hidden */
  25. export var __IGLTFExporterExtension: number;
  26. /**
  27. * Interface for extending the exporter
  28. * @hidden
  29. */
  30. export interface IGLTFExporterExtension {
  31. /**
  32. * The name of this extension
  33. */
  34. readonly name: string;
  35. /**
  36. * Defines whether this extension is enabled
  37. */
  38. enabled: boolean;
  39. /**
  40. * Defines whether this extension is required
  41. */
  42. required: boolean;
  43. }
  44. }
  45. declare module BABYLON.GLTF2.Exporter {
  46. /** @hidden */
  47. export var __IGLTFExporterExtensionV2: number;
  48. /**
  49. * Interface for a glTF exporter extension
  50. * @hidden
  51. */
  52. export interface IGLTFExporterExtensionV2 extends IGLTFExporterExtension, IDisposable {
  53. /**
  54. * Define this method to modify the default behavior before exporting a texture
  55. * @param context The context when loading the asset
  56. * @param babylonTexture The Babylon.js texture
  57. * @param mimeType The mime-type of the generated image
  58. * @returns A promise that resolves with the exported texture
  59. */
  60. preExportTextureAsync?(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Texture>;
  61. /**
  62. * Define this method to get notified when a texture info is created
  63. * @param context The context when loading the asset
  64. * @param textureInfo The glTF texture info
  65. * @param babylonTexture The Babylon.js texture
  66. */
  67. postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
  68. /**
  69. * Define this method to modify the default behavior when exporting texture info
  70. * @param context The context when loading the asset
  71. * @param meshPrimitive glTF mesh primitive
  72. * @param babylonSubMesh Babylon submesh
  73. * @param binaryWriter glTF serializer binary writer instance
  74. * @returns nullable IMeshPrimitive promise
  75. */
  76. postExportMeshPrimitiveAsync?(context: string, meshPrimitive: IMeshPrimitive, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<IMeshPrimitive>;
  77. /**
  78. * Define this method to modify the default behavior when exporting a node
  79. * @param context The context when exporting the node
  80. * @param node glTF node
  81. * @param babylonNode BabylonJS node
  82. * @returns nullable INode promise
  83. */
  84. postExportNodeAsync?(context: string, node: INode, babylonNode: Node): Promise<INode>;
  85. /**
  86. * Define this method to modify the default behavior when exporting a material
  87. * @param material glTF material
  88. * @param babylonMaterial BabylonJS material
  89. * @returns nullable IMaterial promise
  90. */
  91. postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial>;
  92. /**
  93. * Define this method to return additional textures to export from a material
  94. * @param material glTF material
  95. * @param babylonMaterial BabylonJS material
  96. * @returns List of textures
  97. */
  98. postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];
  99. /** Gets a boolean indicating that this extension was used */
  100. wasUsed: boolean;
  101. /** Gets a boolean indicating that this extension is required for the file to work */
  102. required: boolean;
  103. /**
  104. * Called after the exporter state changes to EXPORTING
  105. */
  106. onExporting?(): void;
  107. }
  108. }
  109. declare module BABYLON.GLTF2.Exporter {
  110. /**
  111. * Utility methods for working with glTF material conversion properties. This class should only be used internally
  112. * @hidden
  113. */
  114. export class _GLTFMaterialExporter {
  115. /**
  116. * Represents the dielectric specular values for R, G and B
  117. */
  118. private static readonly _DielectricSpecular;
  119. /**
  120. * Allows the maximum specular power to be defined for material calculations
  121. */
  122. private static readonly _MaxSpecularPower;
  123. /**
  124. * Mapping to store textures
  125. */
  126. private _textureMap;
  127. /**
  128. * Numeric tolerance value
  129. */
  130. private static readonly _Epsilon;
  131. /**
  132. * Reference to the glTF Exporter
  133. */
  134. private _exporter;
  135. constructor(exporter: _Exporter);
  136. /**
  137. * Specifies if two colors are approximately equal in value
  138. * @param color1 first color to compare to
  139. * @param color2 second color to compare to
  140. * @param epsilon threshold value
  141. */
  142. private static FuzzyEquals;
  143. /**
  144. * Gets the materials from a Babylon scene and converts them to glTF materials
  145. * @param scene babylonjs scene
  146. * @param mimeType texture mime type
  147. * @param images array of images
  148. * @param textures array of textures
  149. * @param materials array of materials
  150. * @param imageData mapping of texture names to base64 textures
  151. * @param hasTextureCoords specifies if texture coordinates are present on the material
  152. */
  153. _convertMaterialsToGLTFAsync(babylonMaterials: Material[], mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<void>;
  154. /**
  155. * Makes a copy of the glTF material without the texture parameters
  156. * @param originalMaterial original glTF material
  157. * @returns glTF material without texture parameters
  158. */
  159. _stripTexturesFromMaterial(originalMaterial: IMaterial): IMaterial;
  160. /**
  161. * Specifies if the material has any texture parameters present
  162. * @param material glTF Material
  163. * @returns boolean specifying if texture parameters are present
  164. */
  165. _hasTexturesPresent(material: IMaterial): boolean;
  166. /**
  167. * Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material
  168. * @param babylonStandardMaterial
  169. * @returns glTF Metallic Roughness Material representation
  170. */
  171. _convertToGLTFPBRMetallicRoughness(babylonStandardMaterial: StandardMaterial): IMaterialPbrMetallicRoughness;
  172. /**
  173. * Computes the metallic factor
  174. * @param diffuse diffused value
  175. * @param specular specular value
  176. * @param oneMinusSpecularStrength one minus the specular strength
  177. * @returns metallic value
  178. */
  179. static _SolveMetallic(diffuse: number, specular: number, oneMinusSpecularStrength: number): number;
  180. /**
  181. * Sets the glTF alpha mode to a glTF material from the Babylon Material
  182. * @param glTFMaterial glTF material
  183. * @param babylonMaterial Babylon material
  184. */
  185. private static _SetAlphaMode;
  186. /**
  187. * Converts a Babylon Standard Material to a glTF Material
  188. * @param babylonStandardMaterial BJS Standard Material
  189. * @param mimeType mime type to use for the textures
  190. * @param images array of glTF image interfaces
  191. * @param textures array of glTF texture interfaces
  192. * @param materials array of glTF material interfaces
  193. * @param imageData map of image file name to data
  194. * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
  195. */
  196. _convertStandardMaterialAsync(babylonStandardMaterial: StandardMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
  197. private _finishMaterial;
  198. /**
  199. * Converts a Babylon PBR Metallic Roughness Material to a glTF Material
  200. * @param babylonPBRMetalRoughMaterial BJS PBR Metallic Roughness Material
  201. * @param mimeType mime type to use for the textures
  202. * @param images array of glTF image interfaces
  203. * @param textures array of glTF texture interfaces
  204. * @param materials array of glTF material interfaces
  205. * @param imageData map of image file name to data
  206. * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
  207. */
  208. _convertPBRMetallicRoughnessMaterialAsync(babylonPBRMetalRoughMaterial: PBRMetallicRoughnessMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
  209. /**
  210. * Converts an image typed array buffer to a base64 image
  211. * @param buffer typed array buffer
  212. * @param width width of the image
  213. * @param height height of the image
  214. * @param mimeType mimetype of the image
  215. * @returns base64 image string
  216. */
  217. private _createBase64FromCanvasAsync;
  218. /**
  219. * Generates a white texture based on the specified width and height
  220. * @param width width of the texture in pixels
  221. * @param height height of the texture in pixels
  222. * @param scene babylonjs scene
  223. * @returns white texture
  224. */
  225. private _createWhiteTexture;
  226. /**
  227. * Resizes the two source textures to the same dimensions. If a texture is null, a default white texture is generated. If both textures are null, returns null
  228. * @param texture1 first texture to resize
  229. * @param texture2 second texture to resize
  230. * @param scene babylonjs scene
  231. * @returns resized textures or null
  232. */
  233. private _resizeTexturesToSameDimensions;
  234. /**
  235. * Converts an array of pixels to a Float32Array
  236. * Throws an error if the pixel format is not supported
  237. * @param pixels - array buffer containing pixel values
  238. * @returns Float32 of pixels
  239. */
  240. private _convertPixelArrayToFloat32;
  241. /**
  242. * Convert Specular Glossiness Textures to Metallic Roughness
  243. * See link below for info on the material conversions from PBR Metallic/Roughness and Specular/Glossiness
  244. * @link https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/examples/convert-between-workflows-bjs/js/babylon.pbrUtilities.js
  245. * @param diffuseTexture texture used to store diffuse information
  246. * @param specularGlossinessTexture texture used to store specular and glossiness information
  247. * @param factors specular glossiness material factors
  248. * @param mimeType the mime type to use for the texture
  249. * @returns pbr metallic roughness interface or null
  250. */
  251. private _convertSpecularGlossinessTexturesToMetallicRoughnessAsync;
  252. /**
  253. * Converts specular glossiness material properties to metallic roughness
  254. * @param specularGlossiness interface with specular glossiness material properties
  255. * @returns interface with metallic roughness material properties
  256. */
  257. private _convertSpecularGlossinessToMetallicRoughness;
  258. /**
  259. * Calculates the surface reflectance, independent of lighting conditions
  260. * @param color Color source to calculate brightness from
  261. * @returns number representing the perceived brightness, or zero if color is undefined
  262. */
  263. private _getPerceivedBrightness;
  264. /**
  265. * Returns the maximum color component value
  266. * @param color
  267. * @returns maximum color component value, or zero if color is null or undefined
  268. */
  269. private _getMaxComponent;
  270. /**
  271. * Convert a PBRMaterial (Metallic/Roughness) to Metallic Roughness factors
  272. * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
  273. * @param mimeType mime type to use for the textures
  274. * @param images array of glTF image interfaces
  275. * @param textures array of glTF texture interfaces
  276. * @param glTFPbrMetallicRoughness glTF PBR Metallic Roughness interface
  277. * @param imageData map of image file name to data
  278. * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
  279. * @returns glTF PBR Metallic Roughness factors
  280. */
  281. private _convertMetalRoughFactorsToMetallicRoughnessAsync;
  282. private _getGLTFTextureSampler;
  283. private _getGLTFTextureWrapMode;
  284. private _getGLTFTextureWrapModesSampler;
  285. /**
  286. * Convert a PBRMaterial (Specular/Glossiness) to Metallic Roughness factors
  287. * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
  288. * @param mimeType mime type to use for the textures
  289. * @param images array of glTF image interfaces
  290. * @param textures array of glTF texture interfaces
  291. * @param glTFPbrMetallicRoughness glTF PBR Metallic Roughness interface
  292. * @param imageData map of image file name to data
  293. * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
  294. * @returns glTF PBR Metallic Roughness factors
  295. */
  296. private _convertSpecGlossFactorsToMetallicRoughnessAsync;
  297. /**
  298. * Converts a Babylon PBR Metallic Roughness Material to a glTF Material
  299. * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
  300. * @param mimeType mime type to use for the textures
  301. * @param images array of glTF image interfaces
  302. * @param textures array of glTF texture interfaces
  303. * @param materials array of glTF material interfaces
  304. * @param imageData map of image file name to data
  305. * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
  306. */
  307. _convertPBRMaterialAsync(babylonPBRMaterial: PBRMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
  308. private setMetallicRoughnessPbrMaterial;
  309. private getPixelsFromTexture;
  310. /**
  311. * Extracts a texture from a Babylon texture into file data and glTF data
  312. * @param babylonTexture Babylon texture to extract
  313. * @param mimeType Mime Type of the babylonTexture
  314. * @return glTF texture info, or null if the texture format is not supported
  315. */
  316. _exportTextureAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
  317. _exportTextureInfoAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
  318. /**
  319. * Builds a texture from base64 string
  320. * @param base64Texture base64 texture string
  321. * @param baseTextureName Name to use for the texture
  322. * @param mimeType image mime type for the texture
  323. * @param images array of images
  324. * @param textures array of textures
  325. * @param imageData map of image data
  326. * @returns glTF texture info, or null if the texture format is not supported
  327. */
  328. private _getTextureInfoFromBase64;
  329. }
  330. }
  331. declare module BABYLON {
  332. /**
  333. * Class for holding and downloading glTF file data
  334. */
  335. export class GLTFData {
  336. /**
  337. * Object which contains the file name as the key and its data as the value
  338. */
  339. glTFFiles: {
  340. [fileName: string]: string | Blob;
  341. };
  342. /**
  343. * Initializes the glTF file object
  344. */
  345. constructor();
  346. /**
  347. * Downloads the glTF data as files based on their names and data
  348. */
  349. downloadFiles(): void;
  350. }
  351. }
  352. declare module BABYLON {
  353. /**
  354. * Holds a collection of exporter options and parameters
  355. */
  356. export interface IExportOptions {
  357. /**
  358. * Function which indicates whether a babylon node should be exported or not
  359. * @param node source Babylon node. It is used to check whether it should be exported to glTF or not
  360. * @returns boolean, which indicates whether the node should be exported (true) or not (false)
  361. */
  362. shouldExportNode?(node: Node): boolean;
  363. /**
  364. * Function used to extract the part of node's metadata that will be exported into glTF node extras
  365. * @param metadata source metadata to read from
  366. * @returns the data to store to glTF node extras
  367. */
  368. metadataSelector?(metadata: any): any;
  369. /**
  370. * The sample rate to bake animation curves
  371. */
  372. animationSampleRate?: number;
  373. /**
  374. * Begin serialization without waiting for the scene to be ready
  375. */
  376. exportWithoutWaitingForScene?: boolean;
  377. }
  378. /**
  379. * Class for generating glTF data from a Babylon scene.
  380. */
  381. export class GLTF2Export {
  382. /**
  383. * Exports the geometry of the scene to .gltf file format asynchronously
  384. * @param scene Babylon scene with scene hierarchy information
  385. * @param filePrefix File prefix to use when generating the glTF file
  386. * @param options Exporter options
  387. * @returns Returns an object with a .gltf file and associates texture names
  388. * as keys and their data and paths as values
  389. */
  390. static GLTFAsync(scene: Scene, filePrefix: string, options?: IExportOptions): Promise<GLTFData>;
  391. private static _PreExportAsync;
  392. private static _PostExportAsync;
  393. /**
  394. * Exports the geometry of the scene to .glb file format asychronously
  395. * @param scene Babylon scene with scene hierarchy information
  396. * @param filePrefix File prefix to use when generating glb file
  397. * @param options Exporter options
  398. * @returns Returns an object with a .glb filename as key and data as value
  399. */
  400. static GLBAsync(scene: Scene, filePrefix: string, options?: IExportOptions): Promise<GLTFData>;
  401. }
  402. }
  403. declare module BABYLON.GLTF2.Exporter {
  404. /**
  405. * @hidden
  406. */
  407. export class _GLTFUtilities {
  408. /**
  409. * Creates a buffer view based on the supplied arguments
  410. * @param bufferIndex index value of the specified buffer
  411. * @param byteOffset byte offset value
  412. * @param byteLength byte length of the bufferView
  413. * @param byteStride byte distance between conequential elements
  414. * @param name name of the buffer view
  415. * @returns bufferView for glTF
  416. */
  417. static _CreateBufferView(bufferIndex: number, byteOffset: number, byteLength: number, byteStride?: number, name?: string): IBufferView;
  418. /**
  419. * Creates an accessor based on the supplied arguments
  420. * @param bufferviewIndex The index of the bufferview referenced by this accessor
  421. * @param name The name of the accessor
  422. * @param type The type of the accessor
  423. * @param componentType The datatype of components in the attribute
  424. * @param count The number of attributes referenced by this accessor
  425. * @param byteOffset The offset relative to the start of the bufferView in bytes
  426. * @param min Minimum value of each component in this attribute
  427. * @param max Maximum value of each component in this attribute
  428. * @returns accessor for glTF
  429. */
  430. static _CreateAccessor(bufferviewIndex: number, name: string, type: AccessorType, componentType: AccessorComponentType, count: number, byteOffset: Nullable<number>, min: Nullable<number[]>, max: Nullable<number[]>): IAccessor;
  431. /**
  432. * Calculates the minimum and maximum values of an array of position floats
  433. * @param positions Positions array of a mesh
  434. * @param vertexStart Starting vertex offset to calculate min and max values
  435. * @param vertexCount Number of vertices to check for min and max values
  436. * @returns min number array and max number array
  437. */
  438. static _CalculateMinMaxPositions(positions: FloatArray, vertexStart: number, vertexCount: number, convertToRightHandedSystem: boolean): {
  439. min: number[];
  440. max: number[];
  441. };
  442. /**
  443. * Converts a new right-handed Vector3
  444. * @param vector vector3 array
  445. * @returns right-handed Vector3
  446. */
  447. static _GetRightHandedPositionVector3(vector: Vector3): Vector3;
  448. /**
  449. * Converts a Vector3 to right-handed
  450. * @param vector Vector3 to convert to right-handed
  451. */
  452. static _GetRightHandedPositionVector3FromRef(vector: Vector3): void;
  453. /**
  454. * Converts a three element number array to right-handed
  455. * @param vector number array to convert to right-handed
  456. */
  457. static _GetRightHandedPositionArray3FromRef(vector: number[]): void;
  458. /**
  459. * Converts a new right-handed Vector3
  460. * @param vector vector3 array
  461. * @returns right-handed Vector3
  462. */
  463. static _GetRightHandedNormalVector3(vector: Vector3): Vector3;
  464. /**
  465. * Converts a Vector3 to right-handed
  466. * @param vector Vector3 to convert to right-handed
  467. */
  468. static _GetRightHandedNormalVector3FromRef(vector: Vector3): void;
  469. /**
  470. * Converts a three element number array to right-handed
  471. * @param vector number array to convert to right-handed
  472. */
  473. static _GetRightHandedNormalArray3FromRef(vector: number[]): void;
  474. /**
  475. * Converts a Vector4 to right-handed
  476. * @param vector Vector4 to convert to right-handed
  477. */
  478. static _GetRightHandedVector4FromRef(vector: Vector4): void;
  479. /**
  480. * Converts a Vector4 to right-handed
  481. * @param vector Vector4 to convert to right-handed
  482. */
  483. static _GetRightHandedArray4FromRef(vector: number[]): void;
  484. /**
  485. * Converts a Quaternion to right-handed
  486. * @param quaternion Source quaternion to convert to right-handed
  487. */
  488. static _GetRightHandedQuaternionFromRef(quaternion: Quaternion): void;
  489. /**
  490. * Converts a Quaternion to right-handed
  491. * @param quaternion Source quaternion to convert to right-handed
  492. */
  493. static _GetRightHandedQuaternionArrayFromRef(quaternion: number[]): void;
  494. static _NormalizeTangentFromRef(tangent: Vector4): void;
  495. }
  496. }
  497. declare module BABYLON.GLTF2.Exporter {
  498. /**
  499. * Converts Babylon Scene into glTF 2.0.
  500. * @hidden
  501. */
  502. export class _Exporter {
  503. /**
  504. * Stores the glTF to export
  505. */
  506. _glTF: IGLTF;
  507. /**
  508. * Stores all generated buffer views, which represents views into the main glTF buffer data
  509. */
  510. _bufferViews: IBufferView[];
  511. /**
  512. * Stores all the generated accessors, which is used for accessing the data within the buffer views in glTF
  513. */
  514. _accessors: IAccessor[];
  515. /**
  516. * Stores all the generated nodes, which contains transform and/or mesh information per node
  517. */
  518. private _nodes;
  519. /**
  520. * Stores all the generated glTF scenes, which stores multiple node hierarchies
  521. */
  522. private _scenes;
  523. /**
  524. * Stores all the generated mesh information, each containing a set of primitives to render in glTF
  525. */
  526. private _meshes;
  527. /**
  528. * Stores all the generated material information, which represents the appearance of each primitive
  529. */
  530. _materials: IMaterial[];
  531. _materialMap: {
  532. [materialID: number]: number;
  533. };
  534. /**
  535. * Stores all the generated texture information, which is referenced by glTF materials
  536. */
  537. _textures: ITexture[];
  538. /**
  539. * Stores all the generated image information, which is referenced by glTF textures
  540. */
  541. _images: IImage[];
  542. /**
  543. * Stores all the texture samplers
  544. */
  545. _samplers: ISampler[];
  546. /**
  547. * Stores all the generated animation samplers, which is referenced by glTF animations
  548. */
  549. /**
  550. * Stores the animations for glTF models
  551. */
  552. private _animations;
  553. /**
  554. * Stores the total amount of bytes stored in the glTF buffer
  555. */
  556. private _totalByteLength;
  557. /**
  558. * Stores a reference to the Babylon scene containing the source geometry and material information
  559. */
  560. _babylonScene: Scene;
  561. /**
  562. * Stores a map of the image data, where the key is the file name and the value
  563. * is the image data
  564. */
  565. _imageData: {
  566. [fileName: string]: {
  567. data: Uint8Array;
  568. mimeType: ImageMimeType;
  569. };
  570. };
  571. /**
  572. * Stores a map of the unique id of a node to its index in the node array
  573. */
  574. private _nodeMap;
  575. /**
  576. * Specifies if the Babylon scene should be converted to right-handed on export
  577. */
  578. _convertToRightHandedSystem: boolean;
  579. /**
  580. * Baked animation sample rate
  581. */
  582. private _animationSampleRate;
  583. private _options;
  584. private _localEngine;
  585. _glTFMaterialExporter: _GLTFMaterialExporter;
  586. private _extensions;
  587. private static _ExtensionNames;
  588. private static _ExtensionFactories;
  589. private _applyExtension;
  590. private _applyExtensions;
  591. _extensionsPreExportTextureAsync(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Nullable<BaseTexture>>;
  592. _extensionsPostExportMeshPrimitiveAsync(context: string, meshPrimitive: IMeshPrimitive, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<Nullable<IMeshPrimitive>>;
  593. _extensionsPostExportNodeAsync(context: string, node: INode, babylonNode: Node): Promise<Nullable<INode>>;
  594. _extensionsPostExportMaterialAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<Nullable<IMaterial>>;
  595. _extensionsPostExportMaterialAdditionalTextures(context: string, material: IMaterial, babylonMaterial: Material): BaseTexture[];
  596. _extensionsPostExportTextures(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
  597. private _forEachExtensions;
  598. private _extensionsOnExporting;
  599. /**
  600. * Load glTF serializer extensions
  601. */
  602. private _loadExtensions;
  603. /**
  604. * Creates a glTF Exporter instance, which can accept optional exporter options
  605. * @param babylonScene Babylon scene object
  606. * @param options Options to modify the behavior of the exporter
  607. */
  608. constructor(babylonScene: Scene, options?: IExportOptions);
  609. dispose(): void;
  610. /**
  611. * Registers a glTF exporter extension
  612. * @param name Name of the extension to export
  613. * @param factory The factory function that creates the exporter extension
  614. */
  615. static RegisterExtension(name: string, factory: (exporter: _Exporter) => IGLTFExporterExtensionV2): void;
  616. /**
  617. * Un-registers an exporter extension
  618. * @param name The name fo the exporter extension
  619. * @returns A boolean indicating whether the extension has been un-registered
  620. */
  621. static UnregisterExtension(name: string): boolean;
  622. /**
  623. * Lazy load a local engine
  624. */
  625. _getLocalEngine(): Engine;
  626. private reorderIndicesBasedOnPrimitiveMode;
  627. /**
  628. * Reorders the vertex attribute data based on the primitive mode. This is necessary when indices are not available and the winding order is
  629. * clock-wise during export to glTF
  630. * @param submesh BabylonJS submesh
  631. * @param primitiveMode Primitive mode of the mesh
  632. * @param sideOrientation the winding order of the submesh
  633. * @param vertexBufferKind The type of vertex attribute
  634. * @param meshAttributeArray The vertex attribute data
  635. * @param byteOffset The offset to the binary data
  636. * @param binaryWriter The binary data for the glTF file
  637. */
  638. private reorderVertexAttributeDataBasedOnPrimitiveMode;
  639. /**
  640. * Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is
  641. * clock-wise during export to glTF
  642. * @param submesh BabylonJS submesh
  643. * @param primitiveMode Primitive mode of the mesh
  644. * @param sideOrientation the winding order of the submesh
  645. * @param vertexBufferKind The type of vertex attribute
  646. * @param meshAttributeArray The vertex attribute data
  647. * @param byteOffset The offset to the binary data
  648. * @param binaryWriter The binary data for the glTF file
  649. */
  650. private reorderTriangleFillMode;
  651. /**
  652. * Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is
  653. * clock-wise during export to glTF
  654. * @param submesh BabylonJS submesh
  655. * @param primitiveMode Primitive mode of the mesh
  656. * @param sideOrientation the winding order of the submesh
  657. * @param vertexBufferKind The type of vertex attribute
  658. * @param meshAttributeArray The vertex attribute data
  659. * @param byteOffset The offset to the binary data
  660. * @param binaryWriter The binary data for the glTF file
  661. */
  662. private reorderTriangleStripDrawMode;
  663. /**
  664. * Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is
  665. * clock-wise during export to glTF
  666. * @param submesh BabylonJS submesh
  667. * @param primitiveMode Primitive mode of the mesh
  668. * @param sideOrientation the winding order of the submesh
  669. * @param vertexBufferKind The type of vertex attribute
  670. * @param meshAttributeArray The vertex attribute data
  671. * @param byteOffset The offset to the binary data
  672. * @param binaryWriter The binary data for the glTF file
  673. */
  674. private reorderTriangleFanMode;
  675. /**
  676. * Writes the vertex attribute data to binary
  677. * @param vertices The vertices to write to the binary writer
  678. * @param byteOffset The offset into the binary writer to overwrite binary data
  679. * @param vertexAttributeKind The vertex attribute type
  680. * @param meshAttributeArray The vertex attribute data
  681. * @param binaryWriter The writer containing the binary data
  682. */
  683. private writeVertexAttributeData;
  684. /**
  685. * Writes mesh attribute data to a data buffer
  686. * Returns the bytelength of the data
  687. * @param vertexBufferKind Indicates what kind of vertex data is being passed in
  688. * @param meshAttributeArray Array containing the attribute data
  689. * @param binaryWriter The buffer to write the binary data to
  690. * @param indices Used to specify the order of the vertex data
  691. */
  692. writeAttributeData(vertexBufferKind: string, meshAttributeArray: FloatArray, byteStride: number, binaryWriter: _BinaryWriter): void;
  693. /**
  694. * Generates glTF json data
  695. * @param shouldUseGlb Indicates whether the json should be written for a glb file
  696. * @param glTFPrefix Text to use when prefixing a glTF file
  697. * @param prettyPrint Indicates whether the json file should be pretty printed (true) or not (false)
  698. * @returns json data as string
  699. */
  700. private generateJSON;
  701. /**
  702. * Generates data for .gltf and .bin files based on the glTF prefix string
  703. * @param glTFPrefix Text to use when prefixing a glTF file
  704. * @param dispose Dispose the exporter
  705. * @returns GLTFData with glTF file data
  706. */
  707. _generateGLTFAsync(glTFPrefix: string, dispose?: boolean): Promise<GLTFData>;
  708. /**
  709. * Creates a binary buffer for glTF
  710. * @returns array buffer for binary data
  711. */
  712. private _generateBinaryAsync;
  713. /**
  714. * Pads the number to a multiple of 4
  715. * @param num number to pad
  716. * @returns padded number
  717. */
  718. private _getPadding;
  719. /**
  720. * @hidden
  721. */
  722. _generateGLBAsync(glTFPrefix: string, dispose?: boolean): Promise<GLTFData>;
  723. /**
  724. * Sets the TRS for each node
  725. * @param node glTF Node for storing the transformation data
  726. * @param babylonTransformNode Babylon mesh used as the source for the transformation data
  727. */
  728. private setNodeTransformation;
  729. private getVertexBufferFromMesh;
  730. /**
  731. * Creates a bufferview based on the vertices type for the Babylon mesh
  732. * @param kind Indicates the type of vertices data
  733. * @param babylonTransformNode The Babylon mesh to get the vertices data from
  734. * @param binaryWriter The buffer to write the bufferview data to
  735. */
  736. private createBufferViewKind;
  737. /**
  738. * The primitive mode of the Babylon mesh
  739. * @param babylonMesh The BabylonJS mesh
  740. */
  741. private getMeshPrimitiveMode;
  742. /**
  743. * Sets the primitive mode of the glTF mesh primitive
  744. * @param meshPrimitive glTF mesh primitive
  745. * @param primitiveMode The primitive mode
  746. */
  747. private setPrimitiveMode;
  748. /**
  749. * Sets the vertex attribute accessor based of the glTF mesh primitive
  750. * @param meshPrimitive glTF mesh primitive
  751. * @param attributeKind vertex attribute
  752. * @returns boolean specifying if uv coordinates are present
  753. */
  754. private setAttributeKind;
  755. /**
  756. * Sets data for the primitive attributes of each submesh
  757. * @param mesh glTF Mesh object to store the primitive attribute information
  758. * @param babylonTransformNode Babylon mesh to get the primitive attribute data from
  759. * @param binaryWriter Buffer to write the attribute data to
  760. */
  761. private setPrimitiveAttributesAsync;
  762. /**
  763. * Creates a glTF scene based on the array of meshes
  764. * Returns the the total byte offset
  765. * @param babylonScene Babylon scene to get the mesh data from
  766. * @param binaryWriter Buffer to write binary data to
  767. */
  768. private createSceneAsync;
  769. /**
  770. * Creates a mapping of Node unique id to node index and handles animations
  771. * @param babylonScene Babylon Scene
  772. * @param nodes Babylon transform nodes
  773. * @param binaryWriter Buffer to write binary data to
  774. * @returns Node mapping of unique id to index
  775. */
  776. private createNodeMapAndAnimationsAsync;
  777. /**
  778. * Creates a glTF node from a Babylon mesh
  779. * @param babylonMesh Source Babylon mesh
  780. * @param binaryWriter Buffer for storing geometry data
  781. * @returns glTF node
  782. */
  783. private createNodeAsync;
  784. }
  785. /**
  786. * @hidden
  787. *
  788. * Stores glTF binary data. If the array buffer byte length is exceeded, it doubles in size dynamically
  789. */
  790. export class _BinaryWriter {
  791. /**
  792. * Array buffer which stores all binary data
  793. */
  794. private _arrayBuffer;
  795. /**
  796. * View of the array buffer
  797. */
  798. private _dataView;
  799. /**
  800. * byte offset of data in array buffer
  801. */
  802. private _byteOffset;
  803. /**
  804. * Initialize binary writer with an initial byte length
  805. * @param byteLength Initial byte length of the array buffer
  806. */
  807. constructor(byteLength: number);
  808. /**
  809. * Resize the array buffer to the specified byte length
  810. * @param byteLength
  811. */
  812. private resizeBuffer;
  813. /**
  814. * Get an array buffer with the length of the byte offset
  815. * @returns ArrayBuffer resized to the byte offset
  816. */
  817. getArrayBuffer(): ArrayBuffer;
  818. /**
  819. * Get the byte offset of the array buffer
  820. * @returns byte offset
  821. */
  822. getByteOffset(): number;
  823. /**
  824. * Stores an UInt8 in the array buffer
  825. * @param entry
  826. * @param byteOffset If defined, specifies where to set the value as an offset.
  827. */
  828. setUInt8(entry: number, byteOffset?: number): void;
  829. /**
  830. * Gets an UInt32 in the array buffer
  831. * @param entry
  832. * @param byteOffset If defined, specifies where to set the value as an offset.
  833. */
  834. getUInt32(byteOffset: number): number;
  835. getVector3Float32FromRef(vector3: Vector3, byteOffset: number): void;
  836. setVector3Float32FromRef(vector3: Vector3, byteOffset: number): void;
  837. getVector4Float32FromRef(vector4: Vector4, byteOffset: number): void;
  838. setVector4Float32FromRef(vector4: Vector4, byteOffset: number): void;
  839. /**
  840. * Stores a Float32 in the array buffer
  841. * @param entry
  842. */
  843. setFloat32(entry: number, byteOffset?: number): void;
  844. /**
  845. * Stores an UInt32 in the array buffer
  846. * @param entry
  847. * @param byteOffset If defined, specifies where to set the value as an offset.
  848. */
  849. setUInt32(entry: number, byteOffset?: number): void;
  850. }
  851. }
  852. declare module BABYLON.GLTF2.Exporter {
  853. /**
  854. * @hidden
  855. * Interface to store animation data.
  856. */
  857. export interface _IAnimationData {
  858. /**
  859. * Keyframe data.
  860. */
  861. inputs: number[];
  862. /**
  863. * Value data.
  864. */
  865. outputs: number[][];
  866. /**
  867. * Animation interpolation data.
  868. */
  869. samplerInterpolation: AnimationSamplerInterpolation;
  870. /**
  871. * Minimum keyframe value.
  872. */
  873. inputsMin: number;
  874. /**
  875. * Maximum keyframe value.
  876. */
  877. inputsMax: number;
  878. }
  879. /**
  880. * @hidden
  881. */
  882. export interface _IAnimationInfo {
  883. /**
  884. * The target channel for the animation
  885. */
  886. animationChannelTargetPath: AnimationChannelTargetPath;
  887. /**
  888. * The glTF accessor type for the data.
  889. */
  890. dataAccessorType: AccessorType.VEC3 | AccessorType.VEC4;
  891. /**
  892. * Specifies if quaternions should be used.
  893. */
  894. useQuaternion: boolean;
  895. }
  896. /**
  897. * @hidden
  898. * Utility class for generating glTF animation data from BabylonJS.
  899. */
  900. export class _GLTFAnimation {
  901. /**
  902. * @ignore
  903. *
  904. * Creates glTF channel animation from BabylonJS animation.
  905. * @param babylonTransformNode - BabylonJS mesh.
  906. * @param animation - animation.
  907. * @param animationChannelTargetPath - The target animation channel.
  908. * @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.
  909. * @param useQuaternion - Specifies if quaternions are used.
  910. * @returns nullable IAnimationData
  911. */
  912. static _CreateNodeAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean, animationSampleRate: number): Nullable<_IAnimationData>;
  913. private static _DeduceAnimationInfo;
  914. /**
  915. * @ignore
  916. * Create node animations from the transform node animations
  917. * @param babylonNode
  918. * @param runtimeGLTFAnimation
  919. * @param idleGLTFAnimations
  920. * @param nodeMap
  921. * @param nodes
  922. * @param binaryWriter
  923. * @param bufferViews
  924. * @param accessors
  925. * @param convertToRightHandedSystem
  926. */
  927. static _CreateNodeAnimationFromNodeAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: {
  928. [key: number]: number;
  929. }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number): void;
  930. /**
  931. * @ignore
  932. * Create node animations from the animation groups
  933. * @param babylonScene
  934. * @param glTFAnimations
  935. * @param nodeMap
  936. * @param nodes
  937. * @param binaryWriter
  938. * @param bufferViews
  939. * @param accessors
  940. * @param convertToRightHandedSystem
  941. */
  942. static _CreateNodeAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: IAnimation[], nodeMap: {
  943. [key: number]: number;
  944. }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number): void;
  945. private static AddAnimation;
  946. /**
  947. * Create a baked animation
  948. * @param babylonTransformNode BabylonJS mesh
  949. * @param animation BabylonJS animation corresponding to the BabylonJS mesh
  950. * @param animationChannelTargetPath animation target channel
  951. * @param minFrame minimum animation frame
  952. * @param maxFrame maximum animation frame
  953. * @param fps frames per second of the animation
  954. * @param inputs input key frames of the animation
  955. * @param outputs output key frame data of the animation
  956. * @param convertToRightHandedSystem converts the values to right-handed
  957. * @param useQuaternion specifies if quaternions should be used
  958. */
  959. private static _CreateBakedAnimation;
  960. private static _ConvertFactorToVector3OrQuaternion;
  961. private static _SetInterpolatedValue;
  962. /**
  963. * Creates linear animation from the animation key frames
  964. * @param babylonTransformNode BabylonJS mesh
  965. * @param animation BabylonJS animation
  966. * @param animationChannelTargetPath The target animation channel
  967. * @param frameDelta The difference between the last and first frame of the animation
  968. * @param inputs Array to store the key frame times
  969. * @param outputs Array to store the key frame data
  970. * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
  971. * @param useQuaternion Specifies if quaternions are used in the animation
  972. */
  973. private static _CreateLinearOrStepAnimation;
  974. /**
  975. * Creates cubic spline animation from the animation key frames
  976. * @param babylonTransformNode BabylonJS mesh
  977. * @param animation BabylonJS animation
  978. * @param animationChannelTargetPath The target animation channel
  979. * @param frameDelta The difference between the last and first frame of the animation
  980. * @param inputs Array to store the key frame times
  981. * @param outputs Array to store the key frame data
  982. * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
  983. * @param useQuaternion Specifies if quaternions are used in the animation
  984. */
  985. private static _CreateCubicSplineAnimation;
  986. private static _GetBasePositionRotationOrScale;
  987. /**
  988. * Adds a key frame value
  989. * @param keyFrame
  990. * @param animation
  991. * @param outputs
  992. * @param animationChannelTargetPath
  993. * @param basePositionRotationOrScale
  994. * @param convertToRightHandedSystem
  995. * @param useQuaternion
  996. */
  997. private static _AddKeyframeValue;
  998. /**
  999. * Determine the interpolation based on the key frames
  1000. * @param keyFrames
  1001. * @param animationChannelTargetPath
  1002. * @param useQuaternion
  1003. */
  1004. private static _DeduceInterpolation;
  1005. /**
  1006. * Adds an input tangent or output tangent to the output data
  1007. * If an input tangent or output tangent is missing, it uses the zero vector or zero quaternion
  1008. * @param tangentType Specifies which type of tangent to handle (inTangent or outTangent)
  1009. * @param outputs The animation data by keyframe
  1010. * @param animationChannelTargetPath The target animation channel
  1011. * @param interpolation The interpolation type
  1012. * @param keyFrame The key frame with the animation data
  1013. * @param frameDelta Time difference between two frames used to scale the tangent by the frame delta
  1014. * @param useQuaternion Specifies if quaternions are used
  1015. * @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
  1016. */
  1017. private static AddSplineTangent;
  1018. /**
  1019. * Get the minimum and maximum key frames' frame values
  1020. * @param keyFrames animation key frames
  1021. * @returns the minimum and maximum key frame value
  1022. */
  1023. private static calculateMinMaxKeyFrames;
  1024. }
  1025. }
  1026. declare module BABYLON.GLTF2.Exporter {
  1027. /** @hidden */
  1028. export var textureTransformPixelShader: {
  1029. name: string;
  1030. shader: string;
  1031. };
  1032. }
  1033. declare module BABYLON.GLTF2.Exporter.Extensions {
  1034. /**
  1035. * @hidden
  1036. */
  1037. export class KHR_texture_transform implements IGLTFExporterExtensionV2 {
  1038. private _recordedTextures;
  1039. /** Name of this extension */
  1040. readonly name: string;
  1041. /** Defines whether this extension is enabled */
  1042. enabled: boolean;
  1043. /** Defines whether this extension is required */
  1044. required: boolean;
  1045. /** Reference to the glTF exporter */
  1046. private _wasUsed;
  1047. constructor(exporter: _Exporter);
  1048. dispose(): void;
  1049. /** @hidden */
  1050. get wasUsed(): boolean;
  1051. postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: Texture): void;
  1052. preExportTextureAsync(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Texture>;
  1053. /**
  1054. * Transform the babylon texture by the offset, rotation and scale parameters using a procedural texture
  1055. * @param babylonTexture
  1056. * @param offset
  1057. * @param rotation
  1058. * @param scale
  1059. * @param scene
  1060. */
  1061. private _textureTransformTextureAsync;
  1062. }
  1063. }
  1064. declare module BABYLON.GLTF2.Exporter.Extensions {
  1065. /**
  1066. * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual/README.md)
  1067. */
  1068. export class KHR_lights_punctual implements IGLTFExporterExtensionV2 {
  1069. /** The name of this extension. */
  1070. readonly name: string;
  1071. /** Defines whether this extension is enabled. */
  1072. enabled: boolean;
  1073. /** Defines whether this extension is required */
  1074. required: boolean;
  1075. /** Reference to the glTF exporter */
  1076. private _exporter;
  1077. private _lights;
  1078. /** @hidden */
  1079. constructor(exporter: _Exporter);
  1080. /** @hidden */
  1081. dispose(): void;
  1082. /** @hidden */
  1083. get wasUsed(): boolean;
  1084. /** @hidden */
  1085. onExporting(): void;
  1086. /**
  1087. * Define this method to modify the default behavior when exporting a node
  1088. * @param context The context when exporting the node
  1089. * @param node glTF node
  1090. * @param babylonNode BabylonJS node
  1091. * @returns nullable INode promise
  1092. */
  1093. postExportNodeAsync(context: string, node: INode, babylonNode: Node): Promise<INode>;
  1094. }
  1095. }
  1096. declare module BABYLON.GLTF2.Exporter.Extensions {
  1097. /**
  1098. * @hidden
  1099. */
  1100. export class KHR_materials_sheen implements IGLTFExporterExtensionV2 {
  1101. /** Name of this extension */
  1102. readonly name: string;
  1103. /** Defines whether this extension is enabled */
  1104. enabled: boolean;
  1105. /** Defines whether this extension is required */
  1106. required: boolean;
  1107. /** Reference to the glTF exporter */
  1108. private _textureInfos;
  1109. private _exportedTextures;
  1110. private _wasUsed;
  1111. constructor(exporter: _Exporter);
  1112. dispose(): void;
  1113. /** @hidden */
  1114. get wasUsed(): boolean;
  1115. private _getTextureIndex;
  1116. postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: Texture): void;
  1117. postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];
  1118. postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial>;
  1119. }
  1120. }
  1121. declare module BABYLON {
  1122. /**
  1123. * Class for generating STL data from a Babylon scene.
  1124. */
  1125. export class STLExport {
  1126. /**
  1127. * Exports the geometry of a Mesh array in .STL file format (ASCII)
  1128. * @param meshes list defines the mesh to serialize
  1129. * @param download triggers the automatic download of the file.
  1130. * @param fileName changes the downloads fileName.
  1131. * @param binary changes the STL to a binary type.
  1132. * @param isLittleEndian toggle for binary type exporter.
  1133. * @returns the STL as UTF8 string
  1134. */
  1135. static CreateSTL(meshes: Mesh[], download?: boolean, fileName?: string, binary?: boolean, isLittleEndian?: boolean): any;
  1136. }
  1137. }