babylonjs.loaders.module.d.ts 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083
  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 _loadData(data);
  935. private _setupData();
  936. private _createRootNode();
  937. private _loadNodesAsync(nodes);
  938. _loadSceneAsync(context: string, scene: ILoaderScene): Promise<void>;
  939. private _getMeshes();
  940. private _getSkeletons();
  941. private _startAnimations();
  942. _loadNodeAsync(context: string, node: ILoaderNode): Promise<void>;
  943. private _loadMeshAsync(context, node, mesh);
  944. private _loadPrimitiveAsync(context, node, mesh, primitive);
  945. private _loadVertexDataAsync(context, primitive, babylonMesh);
  946. private _createMorphTargets(context, node, mesh, primitive, babylonMesh);
  947. private _loadMorphTargetsAsync(context, primitive, babylonMesh, babylonVertexData);
  948. private _loadMorphTargetVertexDataAsync(context, babylonVertexData, attributes, babylonMorphTarget);
  949. private static _ConvertToFloat32Array(context, accessor, data);
  950. private static _ConvertVec3ToVec4(context, data);
  951. private static _LoadTransform(node, babylonNode);
  952. private _loadSkinAsync(context, node, mesh, skin);
  953. private _loadSkinInverseBindMatricesDataAsync(context, skin);
  954. private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
  955. private _loadBones(context, skin, inverseBindMatricesData);
  956. private _loadBone(node, skin, inverseBindMatricesData, babylonBones);
  957. private _getNodeMatrix(node);
  958. private _loadAnimationsAsync();
  959. private _loadAnimationAsync(context, animation);
  960. private _loadAnimationChannelAsync(context, animationContext, animation, channel, babylonAnimationGroup);
  961. private _loadAnimationSamplerAsync(context, sampler);
  962. private _loadBufferAsync(context, buffer);
  963. private _loadBufferViewAsync(context, bufferView);
  964. private _loadAccessorAsync(context, accessor);
  965. private _buildArrayBuffer<T>(typedArray, data, byteOffset, count, numComponents, byteStride?);
  966. private _getDefaultMaterial();
  967. private _loadMaterialMetallicRoughnessPropertiesAsync(context, material);
  968. _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Promise<void>;
  969. _createMaterial(material: ILoaderMaterial): PBRMaterial;
  970. _loadMaterialBasePropertiesAsync(context: string, material: ILoaderMaterial): Promise<void>;
  971. _loadMaterialAlphaProperties(context: string, material: ILoaderMaterial): void;
  972. _loadTextureAsync(context: string, textureInfo: ITextureInfo, assign: (texture: Texture) => void): Promise<void>;
  973. private _loadSampler(context, sampler);
  974. private _loadImageAsync(context, image);
  975. _loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
  976. private _onProgress();
  977. static _GetProperty<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
  978. private static _GetTextureWrapMode(context, mode);
  979. private static _GetTextureSamplingMode(context, magFilter?, minFilter?);
  980. private static _GetNumComponents(context, type);
  981. private static _ValidateUri(uri);
  982. private _compileMaterialsAsync();
  983. private _compileShadowGeneratorsAsync();
  984. private _abortRequests();
  985. private _releaseResources();
  986. _applyExtensions<T>(actionAsync: (extension: GLTFLoaderExtension) => Nullable<Promise<T>>): Nullable<Promise<T>>;
  987. }
  988. }
  989. declare module BABYLON.GLTF2 {
  990. abstract class GLTFLoaderExtension implements IGLTFLoaderExtension {
  991. enabled: boolean;
  992. protected _loader: GLTFLoader;
  993. constructor(loader: GLTFLoader);
  994. readonly abstract name: string;
  995. /** Override this method to modify the default behavior for loading scenes. */
  996. protected _loadSceneAsync(context: string, node: ILoaderScene): Nullable<Promise<void>>;
  997. /** Override this method to modify the default behavior for loading nodes. */
  998. protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
  999. /** Override this method to modify the default behavior for loading materials. */
  1000. protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
  1001. /** Override this method to modify the default behavior for loading uris. */
  1002. protected _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1003. /** Helper method called by a loader extension to load an glTF extension. */
  1004. protected _loadExtensionAsync<T>(context: string, property: IProperty, actionAsync: (context: string, extension: T) => Promise<void>): Nullable<Promise<void>>;
  1005. /** Helper method called by the loader to allow extensions to override loading scenes. */
  1006. static _LoadSceneAsync(loader: GLTFLoader, context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1007. /** Helper method called by the loader to allow extensions to override loading nodes. */
  1008. static _LoadNodeAsync(loader: GLTFLoader, context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1009. /** Helper method called by the loader to allow extensions to override loading materials. */
  1010. static _LoadMaterialAsync(loader: GLTFLoader, context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
  1011. /** Helper method called by the loader to allow extensions to override loading uris. */
  1012. static _LoadUriAsync(loader: GLTFLoader, context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1013. }
  1014. }
  1015. declare module BABYLON.GLTF2.Extensions {
  1016. class MSFT_lod extends GLTFLoaderExtension {
  1017. readonly name: string;
  1018. /**
  1019. * Maximum number of LODs to load, starting from the lowest LOD.
  1020. */
  1021. maxLODsToLoad: number;
  1022. private _loadingNodeLOD;
  1023. private _loadNodeSignals;
  1024. private _loadingMaterialLOD;
  1025. private _loadMaterialSignals;
  1026. protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1027. protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
  1028. protected _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1029. /**
  1030. * Gets an array of LOD properties from lowest to highest.
  1031. */
  1032. private _getLODs<T>(context, property, array, ids);
  1033. }
  1034. }
  1035. declare module BABYLON.GLTF2.Extensions {
  1036. class KHR_materials_pbrSpecularGlossiness extends GLTFLoaderExtension {
  1037. readonly name: string;
  1038. protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
  1039. private _loadSpecularGlossinessPropertiesAsync(loader, context, material, properties);
  1040. }
  1041. }
  1042. declare module BABYLON.GLTF2.Extensions {
  1043. class KHR_lights extends GLTFLoaderExtension {
  1044. readonly name: string;
  1045. protected _loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1046. protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
  1047. private readonly _lights;
  1048. }
  1049. }