babylonjs.serializers.d.ts 50 KB

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