babylonjs.loaders.module.d.ts 43 KB

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