babylonjs.loaders.module.d.ts 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101
  1. /// <reference types="babylonjs"/>
  2. /// <reference types="babylonjs-gltf2interface"/>
  3. declare module 'babylonjs-loaders' {
  4. export = BABYLON;
  5. }
  6. declare module BABYLON {
  7. class STLFileLoader implements ISceneLoaderPlugin {
  8. solidPattern: RegExp;
  9. facetsPattern: RegExp;
  10. normalPattern: RegExp;
  11. vertexPattern: RegExp;
  12. name: string;
  13. extensions: ISceneLoaderPluginExtensions;
  14. importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<ParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
  15. load(scene: Scene, data: any, rootUrl: string): boolean;
  16. loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
  17. private isBinary(data);
  18. private parseBinary(mesh, data);
  19. private parseASCII(mesh, solidData);
  20. }
  21. }
  22. declare module BABYLON {
  23. /**
  24. * Class reading and parsing the MTL file bundled with the obj file.
  25. */
  26. class MTLFileLoader {
  27. materials: BABYLON.StandardMaterial[];
  28. /**
  29. * This function will read the mtl file and create each material described inside
  30. * This function could be improve by adding :
  31. * -some component missing (Ni, Tf...)
  32. * -including the specific options available
  33. *
  34. * @param scene
  35. * @param data
  36. * @param rootUrl
  37. */
  38. parseMTL(scene: BABYLON.Scene, data: string, rootUrl: string): void;
  39. /**
  40. * Gets the texture for the material.
  41. *
  42. * If the material is imported from input file,
  43. * We sanitize the url to ensure it takes the textre from aside the material.
  44. *
  45. * @param rootUrl The root url to load from
  46. * @param value The value stored in the mtl
  47. * @return The Texture
  48. */
  49. private static _getTexture(rootUrl, value, scene);
  50. }
  51. class OBJFileLoader implements ISceneLoaderPlugin {
  52. static OPTIMIZE_WITH_UV: boolean;
  53. name: string;
  54. extensions: string;
  55. obj: RegExp;
  56. group: RegExp;
  57. mtllib: RegExp;
  58. usemtl: RegExp;
  59. smooth: RegExp;
  60. vertexPattern: RegExp;
  61. normalPattern: RegExp;
  62. uvPattern: RegExp;
  63. facePattern1: RegExp;
  64. facePattern2: RegExp;
  65. facePattern3: RegExp;
  66. facePattern4: RegExp;
  67. /**
  68. * Calls synchronously the MTL file attached to this obj.
  69. * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.
  70. * Without this function materials are not displayed in the first frame (but displayed after).
  71. * In consequence it is impossible to get material information in your HTML file
  72. *
  73. * @param url The URL of the MTL file
  74. * @param rootUrl
  75. * @param onSuccess Callback function to be called when the MTL file is loaded
  76. * @private
  77. */
  78. private _loadMTL(url, rootUrl, onSuccess);
  79. importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<ParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
  80. load(scene: Scene, data: string, rootUrl: string): boolean;
  81. loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
  82. /**
  83. * Read the OBJ file and create an Array of meshes.
  84. * Each mesh contains all information given by the OBJ and the MTL file.
  85. * i.e. vertices positions and indices, optional normals values, optional UV values, optional material
  86. *
  87. * @param meshesNames
  88. * @param scene BABYLON.Scene The scene where are displayed the data
  89. * @param data String The content of the obj file
  90. * @param rootUrl String The path to the folder
  91. * @returns Array<AbstractMesh>
  92. * @private
  93. */
  94. private _parseSolid(meshesNames, scene, data, rootUrl);
  95. }
  96. }
  97. declare module BABYLON {
  98. enum GLTFLoaderCoordinateSystemMode {
  99. /**
  100. * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
  101. */
  102. AUTO = 0,
  103. /**
  104. * Sets the useRightHandedSystem flag on the scene.
  105. */
  106. FORCE_RIGHT_HANDED = 1,
  107. }
  108. enum GLTFLoaderAnimationStartMode {
  109. /**
  110. * No animation will start.
  111. */
  112. NONE = 0,
  113. /**
  114. * The first animation will start.
  115. */
  116. FIRST = 1,
  117. /**
  118. * All animations will start.
  119. */
  120. ALL = 2,
  121. }
  122. interface IGLTFLoaderData {
  123. json: Object;
  124. bin: Nullable<ArrayBufferView>;
  125. }
  126. interface IGLTFLoaderExtension {
  127. /**
  128. * The name of this extension.
  129. */
  130. readonly name: string;
  131. /**
  132. * Whether this extension is enabled.
  133. */
  134. enabled: boolean;
  135. }
  136. enum GLTFLoaderState {
  137. Loading = 0,
  138. Ready = 1,
  139. Complete = 2,
  140. }
  141. interface IGLTFLoader extends IDisposable {
  142. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  143. animationStartMode: GLTFLoaderAnimationStartMode;
  144. compileMaterials: boolean;
  145. useClipPlane: boolean;
  146. compileShadowGenerators: boolean;
  147. onMeshLoadedObservable: Observable<AbstractMesh>;
  148. onTextureLoadedObservable: Observable<BaseTexture>;
  149. onMaterialLoadedObservable: Observable<Material>;
  150. onCompleteObservable: Observable<IGLTFLoader>;
  151. onDisposeObservable: Observable<IGLTFLoader>;
  152. onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  153. state: Nullable<GLTFLoaderState>;
  154. importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<{
  155. meshes: AbstractMesh[];
  156. particleSystems: ParticleSystem[];
  157. skeletons: Skeleton[];
  158. }>;
  159. loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<void>;
  160. }
  161. class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
  162. static CreateGLTFLoaderV1: () => IGLTFLoader;
  163. static CreateGLTFLoaderV2: () => IGLTFLoader;
  164. /**
  165. * Raised when the asset has been parsed.
  166. * The data.json property stores the glTF JSON.
  167. * The data.bin property stores the BIN chunk from a glTF binary or null if the input is not a glTF binary.
  168. */
  169. onParsedObservable: Observable<IGLTFLoaderData>;
  170. private _onParsedObserver;
  171. onParsed: (loaderData: IGLTFLoaderData) => void;
  172. static IncrementalLoading: boolean;
  173. static HomogeneousCoordinates: boolean;
  174. /**
  175. * The coordinate system mode (AUTO, FORCE_RIGHT_HANDED).
  176. */
  177. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  178. /**
  179. * The animation start mode (NONE, FIRST, ALL).
  180. */
  181. animationStartMode: GLTFLoaderAnimationStartMode;
  182. /**
  183. * Set to true to compile materials before raising the success callback.
  184. */
  185. compileMaterials: boolean;
  186. /**
  187. * Set to true to also compile materials with clip planes.
  188. */
  189. useClipPlane: boolean;
  190. /**
  191. * Set to true to compile shadow generators before raising the success callback.
  192. */
  193. compileShadowGenerators: boolean;
  194. /**
  195. * Raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  196. */
  197. readonly onMeshLoadedObservable: Observable<AbstractMesh>;
  198. private _onMeshLoadedObserver;
  199. onMeshLoaded: (mesh: AbstractMesh) => void;
  200. /**
  201. * Raised when the loader creates a texture after parsing the glTF properties of the texture.
  202. */
  203. readonly onTextureLoadedObservable: Observable<BaseTexture>;
  204. private _onTextureLoadedObserver;
  205. onTextureLoaded: (Texture: BaseTexture) => void;
  206. /**
  207. * Raised when the loader creates a material after parsing the glTF properties of the material.
  208. */
  209. readonly onMaterialLoadedObservable: Observable<Material>;
  210. private _onMaterialLoadedObserver;
  211. onMaterialLoaded: (Material: Material) => void;
  212. /**
  213. * Raised when the asset is completely loaded, immediately before the loader is disposed.
  214. * For assets with LODs, raised when all of the LODs are complete.
  215. * For assets without LODs, raised when the model is complete, immediately after onSuccess.
  216. */
  217. readonly onCompleteObservable: Observable<GLTFFileLoader>;
  218. private _onCompleteObserver;
  219. onComplete: () => void;
  220. /**
  221. * Raised when the loader is disposed.
  222. */
  223. readonly onDisposeObservable: Observable<GLTFFileLoader>;
  224. private _onDisposeObserver;
  225. onDispose: () => void;
  226. /**
  227. * Raised after a loader extension is created.
  228. * Set additional options for a loader extension in this event.
  229. */
  230. readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  231. private _onExtensionLoadedObserver;
  232. onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
  233. /**
  234. * The loader state or null if not active.
  235. */
  236. readonly loaderState: Nullable<GLTFLoaderState>;
  237. private _loader;
  238. name: string;
  239. extensions: ISceneLoaderPluginExtensions;
  240. /**
  241. * Disposes the loader, releases resources during load, and cancels any outstanding requests.
  242. */
  243. dispose(): void;
  244. importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
  245. meshes: AbstractMesh[];
  246. particleSystems: ParticleSystem[];
  247. skeletons: Skeleton[];
  248. }>;
  249. loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
  250. loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<AssetContainer>;
  251. canDirectLoad(data: string): boolean;
  252. rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
  253. createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  254. private _parse(data);
  255. private _getLoader(loaderData);
  256. private static _parseBinary(data);
  257. private static _parseV1(binaryReader);
  258. private static _parseV2(binaryReader);
  259. private static _parseVersion(version);
  260. private static _compareVersion(a, b);
  261. private static _decodeBufferToText(buffer);
  262. }
  263. }
  264. declare module BABYLON.GLTF1 {
  265. /**
  266. * Enums
  267. */
  268. enum EComponentType {
  269. BYTE = 5120,
  270. UNSIGNED_BYTE = 5121,
  271. SHORT = 5122,
  272. UNSIGNED_SHORT = 5123,
  273. FLOAT = 5126,
  274. }
  275. enum EShaderType {
  276. FRAGMENT = 35632,
  277. VERTEX = 35633,
  278. }
  279. enum EParameterType {
  280. BYTE = 5120,
  281. UNSIGNED_BYTE = 5121,
  282. SHORT = 5122,
  283. UNSIGNED_SHORT = 5123,
  284. INT = 5124,
  285. UNSIGNED_INT = 5125,
  286. FLOAT = 5126,
  287. FLOAT_VEC2 = 35664,
  288. FLOAT_VEC3 = 35665,
  289. FLOAT_VEC4 = 35666,
  290. INT_VEC2 = 35667,
  291. INT_VEC3 = 35668,
  292. INT_VEC4 = 35669,
  293. BOOL = 35670,
  294. BOOL_VEC2 = 35671,
  295. BOOL_VEC3 = 35672,
  296. BOOL_VEC4 = 35673,
  297. FLOAT_MAT2 = 35674,
  298. FLOAT_MAT3 = 35675,
  299. FLOAT_MAT4 = 35676,
  300. SAMPLER_2D = 35678,
  301. }
  302. enum ETextureWrapMode {
  303. CLAMP_TO_EDGE = 33071,
  304. MIRRORED_REPEAT = 33648,
  305. REPEAT = 10497,
  306. }
  307. enum ETextureFilterType {
  308. NEAREST = 9728,
  309. LINEAR = 9728,
  310. NEAREST_MIPMAP_NEAREST = 9984,
  311. LINEAR_MIPMAP_NEAREST = 9985,
  312. NEAREST_MIPMAP_LINEAR = 9986,
  313. LINEAR_MIPMAP_LINEAR = 9987,
  314. }
  315. enum ETextureFormat {
  316. ALPHA = 6406,
  317. RGB = 6407,
  318. RGBA = 6408,
  319. LUMINANCE = 6409,
  320. LUMINANCE_ALPHA = 6410,
  321. }
  322. enum ECullingType {
  323. FRONT = 1028,
  324. BACK = 1029,
  325. FRONT_AND_BACK = 1032,
  326. }
  327. enum EBlendingFunction {
  328. ZERO = 0,
  329. ONE = 1,
  330. SRC_COLOR = 768,
  331. ONE_MINUS_SRC_COLOR = 769,
  332. DST_COLOR = 774,
  333. ONE_MINUS_DST_COLOR = 775,
  334. SRC_ALPHA = 770,
  335. ONE_MINUS_SRC_ALPHA = 771,
  336. DST_ALPHA = 772,
  337. ONE_MINUS_DST_ALPHA = 773,
  338. CONSTANT_COLOR = 32769,
  339. ONE_MINUS_CONSTANT_COLOR = 32770,
  340. CONSTANT_ALPHA = 32771,
  341. ONE_MINUS_CONSTANT_ALPHA = 32772,
  342. SRC_ALPHA_SATURATE = 776,
  343. }
  344. /**
  345. * Interfaces
  346. */
  347. interface IGLTFProperty {
  348. extensions?: {
  349. [key: string]: any;
  350. };
  351. extras?: Object;
  352. }
  353. interface IGLTFChildRootProperty extends IGLTFProperty {
  354. name?: string;
  355. }
  356. interface IGLTFAccessor extends IGLTFChildRootProperty {
  357. bufferView: string;
  358. byteOffset: number;
  359. byteStride: number;
  360. count: number;
  361. type: string;
  362. componentType: EComponentType;
  363. max?: number[];
  364. min?: number[];
  365. name?: string;
  366. }
  367. interface IGLTFBufferView extends IGLTFChildRootProperty {
  368. buffer: string;
  369. byteOffset: number;
  370. byteLength: number;
  371. byteStride: number;
  372. target?: number;
  373. }
  374. interface IGLTFBuffer extends IGLTFChildRootProperty {
  375. uri: string;
  376. byteLength?: number;
  377. type?: string;
  378. }
  379. interface IGLTFShader extends IGLTFChildRootProperty {
  380. uri: string;
  381. type: EShaderType;
  382. }
  383. interface IGLTFProgram extends IGLTFChildRootProperty {
  384. attributes: string[];
  385. fragmentShader: string;
  386. vertexShader: string;
  387. }
  388. interface IGLTFTechniqueParameter {
  389. type: number;
  390. count?: number;
  391. semantic?: string;
  392. node?: string;
  393. value?: number | boolean | string | Array<any>;
  394. source?: string;
  395. babylonValue?: any;
  396. }
  397. interface IGLTFTechniqueCommonProfile {
  398. lightingModel: string;
  399. texcoordBindings: Object;
  400. parameters?: Array<any>;
  401. }
  402. interface IGLTFTechniqueStatesFunctions {
  403. blendColor?: number[];
  404. blendEquationSeparate?: number[];
  405. blendFuncSeparate?: number[];
  406. colorMask: boolean[];
  407. cullFace: number[];
  408. }
  409. interface IGLTFTechniqueStates {
  410. enable: number[];
  411. functions: IGLTFTechniqueStatesFunctions;
  412. }
  413. interface IGLTFTechnique extends IGLTFChildRootProperty {
  414. parameters: {
  415. [key: string]: IGLTFTechniqueParameter;
  416. };
  417. program: string;
  418. attributes: {
  419. [key: string]: string;
  420. };
  421. uniforms: {
  422. [key: string]: string;
  423. };
  424. states: IGLTFTechniqueStates;
  425. }
  426. interface IGLTFMaterial extends IGLTFChildRootProperty {
  427. technique?: string;
  428. values: string[];
  429. }
  430. interface IGLTFMeshPrimitive extends IGLTFProperty {
  431. attributes: {
  432. [key: string]: string;
  433. };
  434. indices: string;
  435. material: string;
  436. mode?: number;
  437. }
  438. interface IGLTFMesh extends IGLTFChildRootProperty {
  439. primitives: IGLTFMeshPrimitive[];
  440. }
  441. interface IGLTFImage extends IGLTFChildRootProperty {
  442. uri: string;
  443. }
  444. interface IGLTFSampler extends IGLTFChildRootProperty {
  445. magFilter?: number;
  446. minFilter?: number;
  447. wrapS?: number;
  448. wrapT?: number;
  449. }
  450. interface IGLTFTexture extends IGLTFChildRootProperty {
  451. sampler: string;
  452. source: string;
  453. format?: ETextureFormat;
  454. internalFormat?: ETextureFormat;
  455. target?: number;
  456. type?: number;
  457. babylonTexture?: Texture;
  458. }
  459. interface IGLTFAmbienLight {
  460. color?: number[];
  461. }
  462. interface IGLTFDirectionalLight {
  463. color?: number[];
  464. }
  465. interface IGLTFPointLight {
  466. color?: number[];
  467. constantAttenuation?: number;
  468. linearAttenuation?: number;
  469. quadraticAttenuation?: number;
  470. }
  471. interface IGLTFSpotLight {
  472. color?: number[];
  473. constantAttenuation?: number;
  474. fallOfAngle?: number;
  475. fallOffExponent?: number;
  476. linearAttenuation?: number;
  477. quadraticAttenuation?: number;
  478. }
  479. interface IGLTFLight extends IGLTFChildRootProperty {
  480. type: string;
  481. }
  482. interface IGLTFCameraOrthographic {
  483. xmag: number;
  484. ymag: number;
  485. zfar: number;
  486. znear: number;
  487. }
  488. interface IGLTFCameraPerspective {
  489. aspectRatio: number;
  490. yfov: number;
  491. zfar: number;
  492. znear: number;
  493. }
  494. interface IGLTFCamera extends IGLTFChildRootProperty {
  495. type: string;
  496. }
  497. interface IGLTFAnimationChannelTarget {
  498. id: string;
  499. path: string;
  500. }
  501. interface IGLTFAnimationChannel {
  502. sampler: string;
  503. target: IGLTFAnimationChannelTarget;
  504. }
  505. interface IGLTFAnimationSampler {
  506. input: string;
  507. output: string;
  508. interpolation?: string;
  509. }
  510. interface IGLTFAnimation extends IGLTFChildRootProperty {
  511. channels?: IGLTFAnimationChannel[];
  512. parameters?: {
  513. [key: string]: string;
  514. };
  515. samplers?: {
  516. [key: string]: IGLTFAnimationSampler;
  517. };
  518. }
  519. interface IGLTFNodeInstanceSkin {
  520. skeletons: string[];
  521. skin: string;
  522. meshes: string[];
  523. }
  524. interface IGLTFSkins extends IGLTFChildRootProperty {
  525. bindShapeMatrix: number[];
  526. inverseBindMatrices: string;
  527. jointNames: string[];
  528. babylonSkeleton?: Skeleton;
  529. }
  530. interface IGLTFNode extends IGLTFChildRootProperty {
  531. camera?: string;
  532. children: string[];
  533. skin?: string;
  534. jointName?: string;
  535. light?: string;
  536. matrix: number[];
  537. mesh?: string;
  538. meshes?: string[];
  539. rotation?: number[];
  540. scale?: number[];
  541. translation?: number[];
  542. babylonNode?: Node;
  543. }
  544. interface IGLTFScene extends IGLTFChildRootProperty {
  545. nodes: string[];
  546. }
  547. /**
  548. * Runtime
  549. */
  550. interface IGLTFRuntime {
  551. extensions: {
  552. [key: string]: any;
  553. };
  554. accessors: {
  555. [key: string]: IGLTFAccessor;
  556. };
  557. buffers: {
  558. [key: string]: IGLTFBuffer;
  559. };
  560. bufferViews: {
  561. [key: string]: IGLTFBufferView;
  562. };
  563. meshes: {
  564. [key: string]: IGLTFMesh;
  565. };
  566. lights: {
  567. [key: string]: IGLTFLight;
  568. };
  569. cameras: {
  570. [key: string]: IGLTFCamera;
  571. };
  572. nodes: {
  573. [key: string]: IGLTFNode;
  574. };
  575. images: {
  576. [key: string]: IGLTFImage;
  577. };
  578. textures: {
  579. [key: string]: IGLTFTexture;
  580. };
  581. shaders: {
  582. [key: string]: IGLTFShader;
  583. };
  584. programs: {
  585. [key: string]: IGLTFProgram;
  586. };
  587. samplers: {
  588. [key: string]: IGLTFSampler;
  589. };
  590. techniques: {
  591. [key: string]: IGLTFTechnique;
  592. };
  593. materials: {
  594. [key: string]: IGLTFMaterial;
  595. };
  596. animations: {
  597. [key: string]: IGLTFAnimation;
  598. };
  599. skins: {
  600. [key: string]: IGLTFSkins;
  601. };
  602. currentScene?: Object;
  603. scenes: {
  604. [key: string]: IGLTFScene;
  605. };
  606. extensionsUsed: string[];
  607. extensionsRequired?: string[];
  608. buffersCount: number;
  609. shaderscount: number;
  610. scene: Scene;
  611. rootUrl: string;
  612. loadedBufferCount: number;
  613. loadedBufferViews: {
  614. [name: string]: ArrayBufferView;
  615. };
  616. loadedShaderCount: number;
  617. importOnlyMeshes: boolean;
  618. importMeshesNames?: string[];
  619. dummyNodes: Node[];
  620. }
  621. /**
  622. * Bones
  623. */
  624. interface INodeToRoot {
  625. bone: Bone;
  626. node: IGLTFNode;
  627. id: string;
  628. }
  629. interface IJointNode {
  630. node: IGLTFNode;
  631. id: string;
  632. }
  633. }
  634. declare module BABYLON.GLTF1 {
  635. /**
  636. * Implementation of the base glTF spec
  637. */
  638. class GLTFLoaderBase {
  639. static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
  640. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  641. static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
  642. static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  643. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): void;
  644. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  645. }
  646. /**
  647. * glTF V1 Loader
  648. */
  649. class GLTFLoader implements IGLTFLoader {
  650. static Extensions: {
  651. [name: string]: GLTFLoaderExtension;
  652. };
  653. static RegisterExtension(extension: GLTFLoaderExtension): void;
  654. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  655. animationStartMode: GLTFLoaderAnimationStartMode;
  656. compileMaterials: boolean;
  657. useClipPlane: boolean;
  658. compileShadowGenerators: boolean;
  659. onDisposeObservable: Observable<IGLTFLoader>;
  660. onMeshLoadedObservable: Observable<AbstractMesh>;
  661. onTextureLoadedObservable: Observable<BaseTexture>;
  662. onMaterialLoadedObservable: Observable<Material>;
  663. onCompleteObservable: Observable<IGLTFLoader>;
  664. onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  665. state: Nullable<GLTFLoaderState>;
  666. dispose(): void;
  667. private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress, onError);
  668. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress: (event: SceneLoaderProgressEvent) => void): Promise<{
  669. meshes: AbstractMesh[];
  670. particleSystems: ParticleSystem[];
  671. skeletons: Skeleton[];
  672. }>;
  673. private _loadAsync(scene, data, rootUrl, onSuccess, onProgress, onError);
  674. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress: (event: SceneLoaderProgressEvent) => void): Promise<void>;
  675. private _loadShadersAsync(gltfRuntime, onload);
  676. private _loadBuffersAsync(gltfRuntime, onLoad, onProgress?);
  677. private _createNodes(gltfRuntime);
  678. }
  679. }
  680. declare module BABYLON.GLTF1 {
  681. /**
  682. * Utils functions for GLTF
  683. */
  684. class GLTFUtils {
  685. /**
  686. * Sets the given "parameter" matrix
  687. * @param scene: the {BABYLON.Scene} object
  688. * @param source: the source node where to pick the matrix
  689. * @param parameter: the GLTF technique parameter
  690. * @param uniformName: the name of the shader's uniform
  691. * @param shaderMaterial: the shader material
  692. */
  693. static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void;
  694. /**
  695. * Sets the given "parameter" matrix
  696. * @param shaderMaterial: the shader material
  697. * @param uniform: the name of the shader's uniform
  698. * @param value: the value of the uniform
  699. * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
  700. */
  701. static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
  702. /**
  703. * Returns the wrap mode of the texture
  704. * @param mode: the mode value
  705. */
  706. static GetWrapMode(mode: number): number;
  707. /**
  708. * Returns the byte stride giving an accessor
  709. * @param accessor: the GLTF accessor objet
  710. */
  711. static GetByteStrideFromType(accessor: IGLTFAccessor): number;
  712. /**
  713. * Returns the texture filter mode giving a mode value
  714. * @param mode: the filter mode value
  715. */
  716. static GetTextureFilterMode(mode: number): ETextureFilterType;
  717. static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
  718. /**
  719. * Returns a buffer from its accessor
  720. * @param gltfRuntime: the GLTF runtime
  721. * @param accessor: the GLTF accessor
  722. */
  723. static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
  724. /**
  725. * Decodes a buffer view into a string
  726. * @param view: the buffer view
  727. */
  728. static DecodeBufferToText(view: ArrayBufferView): string;
  729. /**
  730. * Returns the default material of gltf. Related to
  731. * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
  732. * @param scene: the Babylon.js scene
  733. */
  734. static GetDefaultMaterial(scene: Scene): ShaderMaterial;
  735. private static _DefaultMaterial;
  736. }
  737. }
  738. declare module BABYLON.GLTF1 {
  739. abstract class GLTFLoaderExtension {
  740. private _name;
  741. constructor(name: string);
  742. readonly name: string;
  743. /**
  744. * Defines an override for loading the runtime
  745. * Return true to stop further extensions from loading the runtime
  746. */
  747. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  748. /**
  749. * Defines an onverride for creating gltf runtime
  750. * Return true to stop further extensions from creating the runtime
  751. */
  752. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  753. /**
  754. * Defines an override for loading buffers
  755. * Return true to stop further extensions from loading this buffer
  756. */
  757. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
  758. /**
  759. * Defines an override for loading texture buffers
  760. * Return true to stop further extensions from loading this texture data
  761. */
  762. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  763. /**
  764. * Defines an override for creating textures
  765. * Return true to stop further extensions from loading this texture
  766. */
  767. createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
  768. /**
  769. * Defines an override for loading shader strings
  770. * Return true to stop further extensions from loading this shader data
  771. */
  772. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  773. /**
  774. * Defines an override for loading materials
  775. * Return true to stop further extensions from loading this material
  776. */
  777. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  778. static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): void;
  779. static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): void;
  780. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  781. static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  782. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string) => void, onError: (message: string) => void): void;
  783. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  784. private static LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);
  785. private static CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);
  786. private static ApplyExtensions(func, defaultFunc);
  787. }
  788. }
  789. declare module BABYLON.GLTF1 {
  790. class GLTFBinaryExtension extends GLTFLoaderExtension {
  791. private _bin;
  792. constructor();
  793. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  794. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  795. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  796. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  797. }
  798. }
  799. declare module BABYLON.GLTF1 {
  800. class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {
  801. constructor();
  802. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  803. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  804. private _loadTexture(gltfRuntime, id, material, propertyPath, onError);
  805. }
  806. }
  807. declare module BABYLON.GLTF2 {
  808. interface TypedArray extends ArrayBufferView {
  809. [index: number]: number;
  810. }
  811. interface IArrayItem {
  812. _index: number;
  813. }
  814. class ArrayItem {
  815. static Assign(values?: IArrayItem[]): void;
  816. }
  817. }
  818. declare module BABYLON.GLTF2 {
  819. interface ILoaderAccessor extends IAccessor, IArrayItem {
  820. _data?: Promise<TypedArray>;
  821. }
  822. interface ILoaderAnimationChannel extends IAnimationChannel, IArrayItem {
  823. _babylonAnimationGroup: AnimationGroup;
  824. }
  825. interface ILoaderAnimationSamplerData {
  826. input: Float32Array;
  827. interpolation: AnimationSamplerInterpolation;
  828. output: Float32Array;
  829. }
  830. interface ILoaderAnimationSampler extends IAnimationSampler, IArrayItem {
  831. _data: Promise<ILoaderAnimationSamplerData>;
  832. }
  833. interface ILoaderAnimation extends IAnimation, IArrayItem {
  834. channels: ILoaderAnimationChannel[];
  835. samplers: ILoaderAnimationSampler[];
  836. _babylonAnimationGroup: Nullable<AnimationGroup>;
  837. }
  838. interface ILoaderBuffer extends IBuffer, IArrayItem {
  839. _data?: Promise<ArrayBufferView>;
  840. }
  841. interface ILoaderBufferView extends IBufferView, IArrayItem {
  842. _data?: Promise<ArrayBufferView>;
  843. }
  844. interface ILoaderCamera extends ICamera, IArrayItem {
  845. }
  846. interface ILoaderImage extends IImage, IArrayItem {
  847. _objectURL?: Promise<string>;
  848. }
  849. interface ILoaderMaterial extends IMaterial, IArrayItem {
  850. _babylonMaterial?: Material;
  851. _babylonMeshes?: AbstractMesh[];
  852. _loaded?: Promise<void>;
  853. }
  854. interface ILoaderMesh extends IMesh, IArrayItem {
  855. primitives: ILoaderMeshPrimitive[];
  856. }
  857. interface ILoaderMeshPrimitive extends IMeshPrimitive, IArrayItem {
  858. }
  859. interface ILoaderNode extends INode, IArrayItem {
  860. _parent: ILoaderNode;
  861. _babylonMesh?: Mesh;
  862. _primitiveBabylonMeshes?: Mesh[];
  863. _babylonAnimationTargets?: Node[];
  864. _numMorphTargets?: number;
  865. }
  866. interface ILoaderSamplerData {
  867. noMipMaps: boolean;
  868. samplingMode: number;
  869. wrapU: number;
  870. wrapV: number;
  871. }
  872. interface ILoaderSampler extends ISampler, IArrayItem {
  873. _data?: ILoaderSamplerData;
  874. }
  875. interface ILoaderScene extends IScene, IArrayItem {
  876. }
  877. interface ILoaderSkin extends ISkin, IArrayItem {
  878. _babylonSkeleton: Nullable<Skeleton>;
  879. _loaded?: Promise<void>;
  880. }
  881. interface ILoaderTexture extends ITexture, IArrayItem {
  882. }
  883. interface ILoaderGLTF extends IGLTF {
  884. accessors?: ILoaderAccessor[];
  885. animations?: ILoaderAnimation[];
  886. buffers?: ILoaderBuffer[];
  887. bufferViews?: ILoaderBufferView[];
  888. cameras?: ILoaderCamera[];
  889. images?: ILoaderImage[];
  890. materials?: ILoaderMaterial[];
  891. meshes?: ILoaderMesh[];
  892. nodes?: ILoaderNode[];
  893. samplers?: ILoaderSampler[];
  894. scenes?: ILoaderScene[];
  895. skins?: ILoaderSkin[];
  896. textures?: ILoaderTexture[];
  897. }
  898. }
  899. declare module BABYLON.GLTF2 {
  900. class GLTFLoader implements IGLTFLoader {
  901. _gltf: ILoaderGLTF;
  902. _babylonScene: Scene;
  903. _completePromises: Promise<void>[];
  904. private _disposed;
  905. private _state;
  906. private _extensions;
  907. private _rootUrl;
  908. private _rootBabylonMesh;
  909. private _defaultSampler;
  910. private _progressCallback?;
  911. private _requests;
  912. private static _Names;
  913. private static _Factories;
  914. static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
  915. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  916. animationStartMode: GLTFLoaderAnimationStartMode;
  917. compileMaterials: boolean;
  918. useClipPlane: boolean;
  919. compileShadowGenerators: boolean;
  920. readonly onDisposeObservable: Observable<IGLTFLoader>;
  921. readonly onMeshLoadedObservable: Observable<AbstractMesh>;
  922. readonly onTextureLoadedObservable: Observable<BaseTexture>;
  923. readonly onMaterialLoadedObservable: Observable<Material>;
  924. readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  925. readonly onCompleteObservable: Observable<IGLTFLoader>;
  926. readonly state: Nullable<GLTFLoaderState>;
  927. dispose(): void;
  928. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
  929. meshes: AbstractMesh[];
  930. particleSystems: ParticleSystem[];
  931. skeletons: Skeleton[];
  932. }>;
  933. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
  934. private _loadAsync(nodes, scene, data, rootUrl, onProgress?);
  935. private _loadExtensions();
  936. private _loadData(data);
  937. private _setupData();
  938. private _checkExtensions();
  939. private _createRootNode();
  940. private _loadNodesAsync(nodes);
  941. _loadSceneAsync(context: string, scene: ILoaderScene): Promise<void>;
  942. private _getMeshes();
  943. private _getSkeletons();
  944. private _startAnimations();
  945. _loadNodeAsync(context: string, node: ILoaderNode): Promise<void>;
  946. private _loadMeshAsync(context, node, mesh);
  947. private _loadPrimitiveAsync(context, node, mesh, primitive);
  948. private _loadVertexDataAsync(context, primitive, babylonMesh);
  949. private _createMorphTargets(context, node, mesh, primitive, babylonMesh);
  950. private _loadMorphTargetsAsync(context, primitive, babylonMesh, babylonVertexData);
  951. private _loadMorphTargetVertexDataAsync(context, babylonVertexData, attributes, babylonMorphTarget);
  952. private static _ConvertToFloat32Array(context, accessor, data);
  953. private static _ConvertVec3ToVec4(context, data);
  954. private static _LoadTransform(node, babylonNode);
  955. private _loadSkinAsync(context, node, mesh, skin);
  956. private _loadSkinInverseBindMatricesDataAsync(context, skin);
  957. private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
  958. private _loadBones(context, skin, inverseBindMatricesData);
  959. private _loadBone(node, skin, inverseBindMatricesData, babylonBones);
  960. private _getNodeMatrix(node);
  961. private _loadAnimationsAsync();
  962. private _loadAnimationAsync(context, animation);
  963. private _loadAnimationChannelAsync(context, animationContext, animation, channel, babylonAnimationGroup);
  964. private _loadAnimationSamplerAsync(context, sampler);
  965. private _loadBufferAsync(context, buffer);
  966. _loadBufferViewAsync(context: string, bufferView: ILoaderBufferView): Promise<ArrayBufferView>;
  967. private _loadAccessorAsync(context, accessor);
  968. private _buildArrayBuffer<T>(typedArray, data, byteOffset, count, numComponents, byteStride?);
  969. private _getDefaultMaterial();
  970. private _loadMaterialMetallicRoughnessPropertiesAsync(context, material);
  971. _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Promise<void>;
  972. _createMaterial(material: ILoaderMaterial): PBRMaterial;
  973. _loadMaterialBasePropertiesAsync(context: string, material: ILoaderMaterial): Promise<void>;
  974. _loadMaterialAlphaProperties(context: string, material: ILoaderMaterial): void;
  975. _loadTextureAsync(context: string, textureInfo: ITextureInfo, assign: (texture: Texture) => void): Promise<void>;
  976. private _loadSampler(context, sampler);
  977. private _loadImageAsync(context, image);
  978. _loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
  979. private _onProgress();
  980. static _GetProperty<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
  981. private static _GetTextureWrapMode(context, mode);
  982. private static _GetTextureSamplingMode(context, magFilter?, minFilter?);
  983. private static _GetNumComponents(context, type);
  984. private static _ValidateUri(uri);
  985. private _compileMaterialsAsync();
  986. private _compileShadowGeneratorsAsync();
  987. private _clear();
  988. _applyExtensions<T>(actionAsync: (extension: GLTFLoaderExtension) => Nullable<Promise<T>>): Nullable<Promise<T>>;
  989. }
  990. }
  991. declare module BABYLON.GLTF2 {
  992. abstract class GLTFLoaderExtension implements IGLTFLoaderExtension, IDisposable {
  993. enabled: boolean;
  994. readonly abstract name: string;
  995. protected _loader: GLTFLoader;
  996. constructor(loader: GLTFLoader);
  997. dispose(): void;
  998. /** Override this method to modify the default behavior for loading scenes. */
  999. protected _loadSceneAsync(context: string, node: ILoaderScene): Nullable<Promise<void>>;
  1000. /** Override this method to modify the default behavior for loading nodes. */
  1001. protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1002. /** Override this method to modify the default behavior for loading mesh primitive vertex data. */
  1003. protected _loadVertexDataAsync(context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<VertexData>>;
  1004. /** Override this method to modify the default behavior for loading materials. */
  1005. protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
  1006. /** Override this method to modify the default behavior for loading uris. */
  1007. protected _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1008. /** Helper method called by a loader extension to load an glTF extension. */
  1009. protected _loadExtensionAsync<TProperty, TResult = void>(context: string, property: IProperty, actionAsync: (context: string, extension: TProperty) => Promise<TResult>): Nullable<Promise<TResult>>;
  1010. /** Helper method called by the loader to allow extensions to override loading scenes. */
  1011. static _LoadSceneAsync(loader: GLTFLoader, context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1012. /** Helper method called by the loader to allow extensions to override loading nodes. */
  1013. static _LoadNodeAsync(loader: GLTFLoader, context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1014. /** Helper method called by the loader to allow extensions to override loading mesh primitive vertex data. */
  1015. static _LoadVertexDataAsync(loader: GLTFLoader, context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<VertexData>>;
  1016. /** Helper method called by the loader to allow extensions to override loading materials. */
  1017. static _LoadMaterialAsync(loader: GLTFLoader, context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
  1018. /** Helper method called by the loader to allow extensions to override loading uris. */
  1019. static _LoadUriAsync(loader: GLTFLoader, context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1020. }
  1021. }
  1022. declare module BABYLON.GLTF2.Extensions {
  1023. class MSFT_lod extends GLTFLoaderExtension {
  1024. readonly name: string;
  1025. /**
  1026. * Maximum number of LODs to load, starting from the lowest LOD.
  1027. */
  1028. maxLODsToLoad: number;
  1029. private _loadingNodeLOD;
  1030. private _loadNodeSignals;
  1031. private _loadingMaterialLOD;
  1032. private _loadMaterialSignals;
  1033. protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1034. protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
  1035. protected _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1036. /**
  1037. * Gets an array of LOD properties from lowest to highest.
  1038. */
  1039. private _getLODs<T>(context, property, array, ids);
  1040. }
  1041. }
  1042. declare module BABYLON.GLTF2.Extensions {
  1043. class KHR_draco_mesh_compression extends GLTFLoaderExtension {
  1044. readonly name: string;
  1045. private _dracoCompression;
  1046. constructor(loader: GLTFLoader);
  1047. dispose(): void;
  1048. protected _loadVertexDataAsync(context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<VertexData>>;
  1049. }
  1050. }
  1051. declare module BABYLON.GLTF2.Extensions {
  1052. class KHR_materials_pbrSpecularGlossiness extends GLTFLoaderExtension {
  1053. readonly name: string;
  1054. protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
  1055. private _loadSpecularGlossinessPropertiesAsync(loader, context, material, properties);
  1056. }
  1057. }
  1058. declare module BABYLON.GLTF2.Extensions {
  1059. class KHR_lights extends GLTFLoaderExtension {
  1060. readonly name: string;
  1061. protected _loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1062. protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1063. private readonly _lights;
  1064. }
  1065. }