babylonjs.serializers.module.d.ts 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. /// <reference types="babylonjs"/>
  2. declare module 'babylonjs-serializers' {
  3. export = BABYLON;
  4. }
  5. declare module BABYLON.GLTF2 {
  6. const enum AccessorComponentType {
  7. BYTE = 5120,
  8. UNSIGNED_BYTE = 5121,
  9. SHORT = 5122,
  10. UNSIGNED_SHORT = 5123,
  11. UNSIGNED_INT = 5125,
  12. FLOAT = 5126,
  13. }
  14. const enum AccessorType {
  15. SCALAR = "SCALAR",
  16. VEC2 = "VEC2",
  17. VEC3 = "VEC3",
  18. VEC4 = "VEC4",
  19. MAT2 = "MAT2",
  20. MAT3 = "MAT3",
  21. MAT4 = "MAT4",
  22. }
  23. const enum AnimationChannelTargetPath {
  24. TRANSLATION = "translation",
  25. ROTATION = "rotation",
  26. SCALE = "scale",
  27. WEIGHTS = "weights",
  28. }
  29. const enum AnimationSamplerInterpolation {
  30. LINEAR = "LINEAR",
  31. STEP = "STEP",
  32. CUBICSPLINE = "CUBICSPLINE",
  33. }
  34. const enum CameraType {
  35. PERSPECTIVE = "perspective",
  36. ORTHOGRAPHIC = "orthographic",
  37. }
  38. const enum ImageMimeType {
  39. JPEG = "image/jpeg",
  40. PNG = "image/png",
  41. }
  42. const enum MaterialAlphaMode {
  43. OPAQUE = "OPAQUE",
  44. MASK = "MASK",
  45. BLEND = "BLEND",
  46. }
  47. const enum MeshPrimitiveMode {
  48. POINTS = 0,
  49. LINES = 1,
  50. LINE_LOOP = 2,
  51. LINE_STRIP = 3,
  52. TRIANGLES = 4,
  53. TRIANGLE_STRIP = 5,
  54. TRIANGLE_FAN = 6,
  55. }
  56. const enum TextureMagFilter {
  57. NEAREST = 9728,
  58. LINEAR = 9729,
  59. }
  60. const enum TextureMinFilter {
  61. NEAREST = 9728,
  62. LINEAR = 9729,
  63. NEAREST_MIPMAP_NEAREST = 9984,
  64. LINEAR_MIPMAP_NEAREST = 9985,
  65. NEAREST_MIPMAP_LINEAR = 9986,
  66. LINEAR_MIPMAP_LINEAR = 9987,
  67. }
  68. const enum TextureWrapMode {
  69. CLAMP_TO_EDGE = 33071,
  70. MIRRORED_REPEAT = 33648,
  71. REPEAT = 10497,
  72. }
  73. interface IProperty {
  74. extensions?: {
  75. [key: string]: any;
  76. };
  77. extras?: any;
  78. }
  79. interface IChildRootProperty extends IProperty {
  80. name?: string;
  81. }
  82. interface IAccessorSparseIndices extends IProperty {
  83. bufferView: number;
  84. byteOffset?: number;
  85. componentType: AccessorComponentType;
  86. }
  87. interface IAccessorSparseValues extends IProperty {
  88. bufferView: number;
  89. byteOffset?: number;
  90. }
  91. interface IAccessorSparse extends IProperty {
  92. count: number;
  93. indices: IAccessorSparseIndices;
  94. values: IAccessorSparseValues;
  95. }
  96. interface IAccessor extends IChildRootProperty {
  97. bufferView?: number;
  98. byteOffset?: number;
  99. componentType: AccessorComponentType;
  100. normalized?: boolean;
  101. count: number;
  102. type: AccessorType;
  103. max?: number[];
  104. min?: number[];
  105. sparse?: IAccessorSparse;
  106. }
  107. interface IAnimationChannel extends IProperty {
  108. sampler: number;
  109. target: IAnimationChannelTarget;
  110. }
  111. interface IAnimationChannelTarget extends IProperty {
  112. node: number;
  113. path: AnimationChannelTargetPath;
  114. }
  115. interface IAnimationSampler extends IProperty {
  116. input: number;
  117. interpolation?: AnimationSamplerInterpolation;
  118. output: number;
  119. }
  120. interface IAnimation extends IChildRootProperty {
  121. channels: IAnimationChannel[];
  122. samplers: IAnimationSampler[];
  123. }
  124. interface IAsset extends IChildRootProperty {
  125. copyright?: string;
  126. generator?: string;
  127. version: string;
  128. minVersion?: string;
  129. }
  130. interface IBuffer extends IChildRootProperty {
  131. uri?: string;
  132. byteLength: number;
  133. }
  134. interface IBufferView extends IChildRootProperty {
  135. buffer: number;
  136. byteOffset?: number;
  137. byteLength: number;
  138. byteStride?: number;
  139. }
  140. interface ICameraOrthographic extends IProperty {
  141. xmag: number;
  142. ymag: number;
  143. zfar: number;
  144. znear: number;
  145. }
  146. interface ICameraPerspective extends IProperty {
  147. aspectRatio: number;
  148. yfov: number;
  149. zfar: number;
  150. znear: number;
  151. }
  152. interface ICamera extends IChildRootProperty {
  153. orthographic?: ICameraOrthographic;
  154. perspective?: ICameraPerspective;
  155. type: CameraType;
  156. }
  157. interface IImage extends IChildRootProperty {
  158. uri?: string;
  159. mimeType?: ImageMimeType;
  160. bufferView?: number;
  161. }
  162. interface IMaterialNormalTextureInfo extends ITextureInfo {
  163. scale?: number;
  164. }
  165. interface IMaterialOcclusionTextureInfo extends ITextureInfo {
  166. strength?: number;
  167. }
  168. interface IMaterialPbrMetallicRoughness {
  169. baseColorFactor?: number[];
  170. baseColorTexture?: ITextureInfo;
  171. metallicFactor?: number;
  172. roughnessFactor?: number;
  173. metallicRoughnessTexture?: ITextureInfo;
  174. }
  175. interface IMaterial extends IChildRootProperty {
  176. pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
  177. normalTexture?: IMaterialNormalTextureInfo;
  178. occlusionTexture?: IMaterialOcclusionTextureInfo;
  179. emissiveTexture?: ITextureInfo;
  180. emissiveFactor?: number[];
  181. alphaMode?: MaterialAlphaMode;
  182. alphaCutoff?: number;
  183. doubleSided?: boolean;
  184. }
  185. interface IMeshPrimitive extends IProperty {
  186. attributes: {
  187. [name: string]: number;
  188. };
  189. indices?: number;
  190. material?: number;
  191. mode?: MeshPrimitiveMode;
  192. targets?: {
  193. [name: string]: number;
  194. }[];
  195. }
  196. interface IMesh extends IChildRootProperty {
  197. primitives: IMeshPrimitive[];
  198. weights?: number[];
  199. }
  200. interface INode extends IChildRootProperty {
  201. camera?: number;
  202. children?: number[];
  203. skin?: number;
  204. matrix?: number[];
  205. mesh?: number;
  206. rotation?: number[];
  207. scale?: number[];
  208. translation?: number[];
  209. weights?: number[];
  210. }
  211. interface ISampler extends IChildRootProperty {
  212. magFilter?: TextureMagFilter;
  213. minFilter?: TextureMinFilter;
  214. wrapS?: TextureWrapMode;
  215. wrapT?: TextureWrapMode;
  216. }
  217. interface IScene extends IChildRootProperty {
  218. nodes: number[];
  219. }
  220. interface ISkin extends IChildRootProperty {
  221. inverseBindMatrices?: number;
  222. skeleton?: number;
  223. joints: number[];
  224. }
  225. interface ITexture extends IChildRootProperty {
  226. sampler?: number;
  227. source: number;
  228. }
  229. interface ITextureInfo {
  230. index: number;
  231. texCoord?: number;
  232. }
  233. interface IGLTF extends IProperty {
  234. accessors?: IAccessor[];
  235. animations?: IAnimation[];
  236. asset: IAsset;
  237. buffers?: IBuffer[];
  238. bufferViews?: IBufferView[];
  239. cameras?: ICamera[];
  240. extensionsUsed?: string[];
  241. extensionsRequired?: string[];
  242. images?: IImage[];
  243. materials?: IMaterial[];
  244. meshes?: IMesh[];
  245. nodes?: INode[];
  246. samplers?: ISampler[];
  247. scene?: number;
  248. scenes?: IScene[];
  249. skins?: ISkin[];
  250. textures?: ITexture[];
  251. }
  252. }
  253. declare module BABYLON {
  254. class OBJExport {
  255. static OBJ(mesh: Mesh[], materials?: boolean, matlibname?: string, globalposition?: boolean): string;
  256. static MTL(mesh: Mesh): string;
  257. }
  258. }
  259. declare module BABYLON {
  260. /**
  261. * Holds a collection of exporter options and parameters
  262. */
  263. interface IExporterOptions {
  264. /**
  265. * Function which indicates whether a babylon mesh should be exported or not.
  266. * @param mesh - source Babylon mesh. It is used to check whether it should be
  267. * exported to glTF or not.
  268. * @returns boolean, which indicates whether the mesh should be exported (true) or not (false)
  269. */
  270. shouldExportMesh?(mesh: AbstractMesh): boolean;
  271. }
  272. /**
  273. * Class for generating glTF data from a Babylon scene.
  274. */
  275. class GLTF2Export {
  276. /**
  277. * Exports the geometry of the scene to .gltf file format.
  278. * @param scene - Babylon scene with scene hierarchy information.
  279. * @param filePrefix - File prefix to use when generating the glTF file.
  280. * @param options - Exporter options.
  281. * @returns - Returns an object with a .gltf file and associates texture names
  282. * as keys and their data and paths as values.
  283. */
  284. static GLTF(scene: Scene, filePrefix: string, options?: IExporterOptions): _GLTFData;
  285. /**
  286. * Exports the geometry of the scene to .glb file format.
  287. * @param scene - Babylon scene with scene hierarchy information.
  288. * @param filePrefix - File prefix to use when generating glb file.
  289. * @param options - Exporter options.
  290. * @returns - Returns an object with a .glb filename as key and data as value
  291. */
  292. static GLB(scene: Scene, filePrefix: string, options?: IExporterOptions): _GLTFData;
  293. }
  294. }
  295. /**
  296. * Module for the Babylon glTF 2.0 exporter. Should ONLY be used internally.
  297. * @ignore - capitalization of GLTF2 module.
  298. */
  299. declare module BABYLON.GLTF2 {
  300. /**
  301. * Converts Babylon Scene into glTF 2.0.
  302. */
  303. class _Exporter {
  304. /**
  305. * Stores all generated buffer views, which represents views into the main glTF buffer data.
  306. */
  307. private bufferViews;
  308. /**
  309. * Stores all the generated accessors, which is used for accessing the data within the buffer views in glTF.
  310. */
  311. private accessors;
  312. /**
  313. * Stores all the generated nodes, which contains transform and/or mesh information per node.
  314. */
  315. private nodes;
  316. /**
  317. * Stores the glTF asset information, which represents the glTF version and this file generator.
  318. */
  319. private asset;
  320. /**
  321. * Stores all the generated glTF scenes, which stores multiple node hierarchies.
  322. */
  323. private scenes;
  324. /**
  325. * Stores all the generated mesh information, each containing a set of primitives to render in glTF.
  326. */
  327. private meshes;
  328. /**
  329. * Stores all the generated material information, which represents the appearance of each primitive.
  330. */
  331. private materials;
  332. /**
  333. * Stores all the generated texture information, which is referenced by glTF materials.
  334. */
  335. private textures;
  336. /**
  337. * Stores all the generated image information, which is referenced by glTF textures.
  338. */
  339. private images;
  340. /**
  341. * Stores the total amount of bytes stored in the glTF buffer.
  342. */
  343. private totalByteLength;
  344. /**
  345. * Stores a reference to the Babylon scene containing the source geometry and material information.
  346. */
  347. private babylonScene;
  348. /**
  349. * Stores the exporter options, which are optionally passed in from the glTF serializer.
  350. */
  351. private options?;
  352. /**
  353. * Stores a map of the image data, where the key is the file name and the value
  354. * is the image data.
  355. */
  356. private imageData;
  357. /**
  358. * Stores a map of the unique id of a node to its index in the node array.
  359. */
  360. private nodeMap;
  361. /**
  362. * Stores the binary buffer used to store geometry data.
  363. */
  364. private binaryBuffer;
  365. /**
  366. * Specifies if the Babylon scene should be converted to right-handed on export.
  367. */
  368. private convertToRightHandedSystem;
  369. /**
  370. * Creates a glTF Exporter instance, which can accept optional exporter options.
  371. * @param babylonScene - Babylon scene object
  372. * @param options - Options to modify the behavior of the exporter.
  373. */
  374. constructor(babylonScene: Scene, options?: IExporterOptions);
  375. /**
  376. * Creates a buffer view based on teh supplied arguments
  377. * @param bufferIndex - index value of the specified buffer
  378. * @param byteOffset - byte offset value
  379. * @param byteLength - byte length of the bufferView
  380. * @param byteStride - byte distance between conequential elements.
  381. * @param name - name of the buffer view
  382. * @returns - bufferView for glTF
  383. */
  384. private createBufferView(bufferIndex, byteOffset, byteLength, byteStride?, name?);
  385. /**
  386. * Creates an accessor based on the supplied arguments
  387. * @param bufferviewIndex - The index of the bufferview referenced by this accessor.
  388. * @param name - The name of the accessor.
  389. * @param type - The type of the accessor.
  390. * @param componentType - The datatype of components in the attribute.
  391. * @param count - The number of attributes referenced by this accessor.
  392. * @param byteOffset - The offset relative to the start of the bufferView in bytes.
  393. * @param min - Minimum value of each component in this attribute.
  394. * @param max - Maximum value of each component in this attribute.
  395. * @returns - accessor for glTF
  396. */
  397. private createAccessor(bufferviewIndex, name, type, componentType, count, byteOffset, min, max);
  398. /**
  399. * Calculates the minimum and maximum values of an array of position floats.
  400. * @param positions - Positions array of a mesh.
  401. * @param vertexStart - Starting vertex offset to calculate min and max values.
  402. * @param vertexCount - Number of vertices to check for min and max values.
  403. * @returns - min number array and max number array.
  404. */
  405. private calculateMinMaxPositions(positions, vertexStart, vertexCount);
  406. /**
  407. * Converts a vector3 array to right-handed.
  408. * @param vector - vector3 Array to convert to right-handed.
  409. * @returns - right-handed Vector3 array.
  410. */
  411. private static GetRightHandedVector3(vector);
  412. /**
  413. * Converts a vector4 array to right-handed.
  414. * @param vector - vector4 Array to convert to right-handed.
  415. * @returns - right-handed vector4 array.
  416. */
  417. private static GetRightHandedVector4(vector);
  418. /**
  419. * Converts a quaternion to right-handed.
  420. * @param quaternion - Source quaternion to convert to right-handed.
  421. */
  422. private static GetRightHandedQuaternion(quaternion);
  423. /**
  424. * Writes mesh attribute data to a data buffer.
  425. * Returns the bytelength of the data.
  426. * @param vertexBufferKind - Indicates what kind of vertex data is being passed in.
  427. * @param meshAttributeArray - Array containing the attribute data.
  428. * @param strideSize - Represents the offset between consecutive attributes
  429. * @param byteOffset - The offset to start counting bytes from.
  430. * @param dataBuffer - The buffer to write the binary data to.
  431. * @returns - Byte length of the attribute data.
  432. */
  433. private writeAttributeData(vertexBufferKind, meshAttributeArray, strideSize, vertexBufferOffset, byteOffset, dataBuffer);
  434. /**
  435. * Generates glTF json data
  436. * @param shouldUseGlb - Indicates whether the json should be written for a glb file.
  437. * @param glTFPrefix - Text to use when prefixing a glTF file.
  438. * @param prettyPrint - Indicates whether the json file should be pretty printed (true) or not (false).
  439. * @returns - json data as string
  440. */
  441. private generateJSON(shouldUseGlb, glTFPrefix?, prettyPrint?);
  442. /**
  443. * Generates data for .gltf and .bin files based on the glTF prefix string
  444. * @param glTFPrefix - Text to use when prefixing a glTF file.
  445. * @returns - GLTFData with glTF file data.
  446. */
  447. _generateGLTF(glTFPrefix: string): _GLTFData;
  448. /**
  449. * Creates a binary buffer for glTF
  450. * @returns - array buffer for binary data
  451. */
  452. private generateBinary();
  453. /**
  454. * Pads the number to a multiple of 4
  455. * @param num - number to pad
  456. * @returns - padded number
  457. */
  458. private _getPadding(num);
  459. /**
  460. * Generates a glb file from the json and binary data.
  461. * Returns an object with the glb file name as the key and data as the value.
  462. * @param glTFPrefix
  463. * @returns - object with glb filename as key and data as value
  464. */
  465. _generateGLB(glTFPrefix: string): _GLTFData;
  466. /**
  467. * Sets the TRS for each node
  468. * @param node - glTF Node for storing the transformation data.
  469. * @param babylonMesh - Babylon mesh used as the source for the transformation data.
  470. */
  471. private setNodeTransformation(node, babylonMesh);
  472. /**
  473. * Creates a bufferview based on the vertices type for the Babylon mesh
  474. * @param kind - Indicates the type of vertices data.
  475. * @param babylonMesh - The Babylon mesh to get the vertices data from.
  476. * @param byteOffset - The offset from the buffer to start indexing from.
  477. * @param dataBuffer - The buffer to write the bufferview data to.
  478. * @returns bytelength of the bufferview data.
  479. */
  480. private createBufferViewKind(kind, babylonMesh, byteOffset, dataBuffer);
  481. /**
  482. * Sets data for the primitive attributes of each submesh
  483. * @param mesh - glTF Mesh object to store the primitive attribute information.
  484. * @param babylonMesh - Babylon mesh to get the primitive attribute data from.
  485. * @param byteOffset - The offset in bytes of the buffer data.
  486. * @param dataBuffer - Buffer to write the attribute data to.
  487. * @returns - bytelength of the primitive attributes plus the passed in byteOffset.
  488. */
  489. private setPrimitiveAttributes(mesh, babylonMesh, byteOffset, dataBuffer);
  490. /**
  491. * Creates a glTF scene based on the array of meshes.
  492. * Returns the the total byte offset.
  493. * @param babylonScene - Babylon scene to get the mesh data from.
  494. * @param byteOffset - Offset to start from in bytes.
  495. * @returns bytelength + byteoffset
  496. */
  497. private createScene(babylonScene, byteOffset);
  498. /**
  499. * Creates a mapping of Node unique id to node index
  500. * @param scene - Babylon Scene.
  501. * @param byteOffset - The initial byte offset.
  502. * @returns - Node mapping of unique id to index.
  503. */
  504. private createNodeMap(scene, byteOffset);
  505. /**
  506. * Creates a glTF node from a Babylon mesh.
  507. * @param babylonMesh - Source Babylon mesh.
  508. * @param byteOffset - The initial byte offset.
  509. * @param dataBuffer - Buffer for storing geometry data.
  510. * @returns - Object containing an INode and byteoffset.
  511. */
  512. private createNode(babylonMesh, byteOffset, dataBuffer);
  513. }
  514. }
  515. declare module BABYLON {
  516. /**
  517. * Class for holding and downloading glTF file data
  518. */
  519. class _GLTFData {
  520. /**
  521. * Object which contains the file name as the key and its data as the value.
  522. */
  523. glTFFiles: {
  524. [fileName: string]: string | Blob;
  525. };
  526. /**
  527. * Initializes the glTF file object.
  528. */
  529. constructor();
  530. /**
  531. * Downloads the glTF data as files based on their names and data.
  532. */
  533. downloadFiles(): void;
  534. }
  535. }
  536. declare module BABYLON.GLTF2 {
  537. /**
  538. * Utility methods for working with glTF material conversion properties. This class should only be used internally.
  539. */
  540. class _GLTFMaterial {
  541. /**
  542. * Represents the dielectric specular values for R, G and B.
  543. */
  544. private static readonly dielectricSpecular;
  545. /**
  546. * Allows the maximum specular power to be defined for material calculations.
  547. */
  548. private static maxSpecularPower;
  549. /**
  550. * Gets the materials from a Babylon scene and converts them to glTF materials.
  551. * @param scene
  552. * @param mimeType
  553. * @param images
  554. * @param textures
  555. * @param materials
  556. * @param imageData
  557. * @param hasTextureCoords
  558. */
  559. static ConvertMaterialsToGLTF(babylonMaterials: Material[], mimeType: ImageMimeType, images: IImage[], textures: ITexture[], materials: IMaterial[], imageData: {
  560. [fileName: string]: {
  561. data: Uint8Array;
  562. mimeType: ImageMimeType;
  563. };
  564. }, hasTextureCoords: boolean): void;
  565. /**
  566. * Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material.
  567. * @param babylonStandardMaterial
  568. * @returns - glTF Metallic Roughness Material representation
  569. */
  570. static ConvertToGLTFPBRMetallicRoughness(babylonStandardMaterial: StandardMaterial): IMaterialPbrMetallicRoughness;
  571. /**
  572. * Computes the metallic factor
  573. * @param diffuse - diffused value
  574. * @param specular - specular value
  575. * @param oneMinusSpecularStrength - one minus the specular strength
  576. * @returns - metallic value
  577. */
  578. static SolveMetallic(diffuse: number, specular: number, oneMinusSpecularStrength: number): number;
  579. /**
  580. * Gets the glTF alpha mode from the Babylon Material
  581. * @param babylonMaterial - Babylon Material
  582. * @returns - The Babylon alpha mode value
  583. */
  584. static GetAlphaMode(babylonMaterial: Material): MaterialAlphaMode;
  585. /**
  586. * Converts a Babylon Standard Material to a glTF Material.
  587. * @param babylonStandardMaterial - BJS Standard Material.
  588. * @param mimeType - mime type to use for the textures.
  589. * @param images - array of glTF image interfaces.
  590. * @param textures - array of glTF texture interfaces.
  591. * @param materials - array of glTF material interfaces.
  592. * @param imageData - map of image file name to data.
  593. * @param hasTextureCoords - specifies if texture coordinates are present on the submesh to determine if textures should be applied.
  594. */
  595. static ConvertStandardMaterial(babylonStandardMaterial: StandardMaterial, mimeType: ImageMimeType, images: IImage[], textures: ITexture[], materials: IMaterial[], imageData: {
  596. [fileName: string]: {
  597. data: Uint8Array;
  598. mimeType: ImageMimeType;
  599. };
  600. }, hasTextureCoords: boolean): void;
  601. /**
  602. * Converts a Babylon PBR Metallic Roughness Material to a glTF Material.
  603. * @param babylonPBRMetalRoughMaterial - BJS PBR Metallic Roughness Material.
  604. * @param mimeType - mime type to use for the textures.
  605. * @param images - array of glTF image interfaces.
  606. * @param textures - array of glTF texture interfaces.
  607. * @param materials - array of glTF material interfaces.
  608. * @param imageData - map of image file name to data.
  609. * @param hasTextureCoords - specifies if texture coordinates are present on the submesh to determine if textures should be applied.
  610. */
  611. static ConvertPBRMetallicRoughnessMaterial(babylonPBRMetalRoughMaterial: PBRMetallicRoughnessMaterial, mimeType: ImageMimeType, images: IImage[], textures: ITexture[], materials: IMaterial[], imageData: {
  612. [fileName: string]: {
  613. data: Uint8Array;
  614. mimeType: ImageMimeType;
  615. };
  616. }, hasTextureCoords: boolean): void;
  617. /**
  618. * Extracts a texture from a Babylon texture into file data and glTF data.
  619. * @param babylonTexture - Babylon texture to extract.
  620. * @param mimeType - Mime Type of the babylonTexture.
  621. * @param images - Array of glTF images.
  622. * @param textures - Array of glTF textures.
  623. * @param imageData - map of image file name and data.
  624. * @return - glTF texture, or null if the texture format is not supported.
  625. */
  626. static ExportTexture(babylonTexture: BaseTexture, mimeType: ImageMimeType, images: IImage[], textures: ITexture[], imageData: {
  627. [fileName: string]: {
  628. data: Uint8Array;
  629. mimeType: ImageMimeType;
  630. };
  631. }): Nullable<ITextureInfo>;
  632. }
  633. }