babylon.glTF2FileLoader.d.ts 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161
  1. declare module BABYLON {
  2. /**
  3. * Mode that determines the coordinate system to use.
  4. */
  5. enum GLTFLoaderCoordinateSystemMode {
  6. /**
  7. * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
  8. */
  9. AUTO = 0,
  10. /**
  11. * Sets the useRightHandedSystem flag on the scene.
  12. */
  13. FORCE_RIGHT_HANDED = 1
  14. }
  15. /**
  16. * Mode that determines what animations will start.
  17. */
  18. enum GLTFLoaderAnimationStartMode {
  19. /**
  20. * No animation will start.
  21. */
  22. NONE = 0,
  23. /**
  24. * The first animation will start.
  25. */
  26. FIRST = 1,
  27. /**
  28. * All animations will start.
  29. */
  30. ALL = 2
  31. }
  32. /**
  33. * Interface that contains the data for the glTF asset.
  34. */
  35. interface IGLTFLoaderData {
  36. /**
  37. * Object that represents the glTF JSON.
  38. */
  39. json: Object;
  40. /**
  41. * The BIN chunk of a binary glTF.
  42. */
  43. bin: Nullable<ArrayBufferView>;
  44. }
  45. /**
  46. * Interface for extending the loader.
  47. */
  48. interface IGLTFLoaderExtension {
  49. /**
  50. * The name of this extension.
  51. */
  52. readonly name: string;
  53. /**
  54. * Defines whether this extension is enabled.
  55. */
  56. enabled: boolean;
  57. }
  58. /**
  59. * Loader state.
  60. */
  61. enum GLTFLoaderState {
  62. /**
  63. * The asset is loading.
  64. */
  65. LOADING = 0,
  66. /**
  67. * The asset is ready for rendering.
  68. */
  69. READY = 1,
  70. /**
  71. * The asset is completely loaded.
  72. */
  73. COMPLETE = 2
  74. }
  75. /** @hidden */
  76. interface IGLTFLoader extends IDisposable {
  77. readonly state: Nullable<GLTFLoaderState>;
  78. importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string) => Promise<{
  79. meshes: AbstractMesh[];
  80. particleSystems: IParticleSystem[];
  81. skeletons: Skeleton[];
  82. animationGroups: AnimationGroup[];
  83. }>;
  84. loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;
  85. }
  86. /**
  87. * File loader for loading glTF files into a scene.
  88. */
  89. class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
  90. /** @hidden */
  91. static _CreateGLTFLoaderV1: (parent: GLTFFileLoader) => IGLTFLoader;
  92. /** @hidden */
  93. static _CreateGLTFLoaderV2: (parent: GLTFFileLoader) => IGLTFLoader;
  94. /**
  95. * Raised when the asset has been parsed
  96. */
  97. onParsedObservable: Observable<IGLTFLoaderData>;
  98. private _onParsedObserver;
  99. /**
  100. * Raised when the asset has been parsed
  101. */
  102. onParsed: (loaderData: IGLTFLoaderData) => void;
  103. /**
  104. * Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders.
  105. * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
  106. * Defaults to true.
  107. * @hidden
  108. */
  109. static IncrementalLoading: boolean;
  110. /**
  111. * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
  112. * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
  113. * @hidden
  114. */
  115. static HomogeneousCoordinates: boolean;
  116. /**
  117. * The coordinate system mode. Defaults to AUTO.
  118. */
  119. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  120. /**
  121. * The animation start mode. Defaults to FIRST.
  122. */
  123. animationStartMode: GLTFLoaderAnimationStartMode;
  124. /**
  125. * Defines if the loader should compile materials before raising the success callback. Defaults to false.
  126. */
  127. compileMaterials: boolean;
  128. /**
  129. * Defines if the loader should also compile materials with clip planes. Defaults to false.
  130. */
  131. useClipPlane: boolean;
  132. /**
  133. * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.
  134. */
  135. compileShadowGenerators: boolean;
  136. /**
  137. * Defines if the Alpha blended materials are only applied as coverage.
  138. * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.
  139. * If true, no extra effects are applied to transparent pixels.
  140. */
  141. transparencyAsCoverage: boolean;
  142. /**
  143. * Function called before loading a url referenced by the asset.
  144. */
  145. preprocessUrlAsync: (url: string) => Promise<string>;
  146. /**
  147. * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  148. */
  149. readonly onMeshLoadedObservable: Observable<AbstractMesh>;
  150. private _onMeshLoadedObserver;
  151. /**
  152. * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  153. */
  154. onMeshLoaded: (mesh: AbstractMesh) => void;
  155. /**
  156. * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
  157. */
  158. readonly onTextureLoadedObservable: Observable<BaseTexture>;
  159. private _onTextureLoadedObserver;
  160. /**
  161. * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
  162. */
  163. onTextureLoaded: (texture: BaseTexture) => void;
  164. /**
  165. * Observable raised when the loader creates a material after parsing the glTF properties of the material.
  166. */
  167. readonly onMaterialLoadedObservable: Observable<Material>;
  168. private _onMaterialLoadedObserver;
  169. /**
  170. * Callback raised when the loader creates a material after parsing the glTF properties of the material.
  171. */
  172. onMaterialLoaded: (material: Material) => void;
  173. /**
  174. * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.
  175. */
  176. readonly onCameraLoadedObservable: Observable<Camera>;
  177. private _onCameraLoadedObserver;
  178. /**
  179. * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
  180. */
  181. onCameraLoaded: (camera: Camera) => void;
  182. /**
  183. * Observable raised when the asset is completely loaded, immediately before the loader is disposed.
  184. * For assets with LODs, raised when all of the LODs are complete.
  185. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
  186. */
  187. readonly onCompleteObservable: Observable<void>;
  188. private _onCompleteObserver;
  189. /**
  190. * Callback raised when the asset is completely loaded, immediately before the loader is disposed.
  191. * For assets with LODs, raised when all of the LODs are complete.
  192. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
  193. */
  194. onComplete: () => void;
  195. /**
  196. * Observable raised when an error occurs.
  197. */
  198. readonly onErrorObservable: Observable<any>;
  199. private _onErrorObserver;
  200. /**
  201. * Callback raised when an error occurs.
  202. */
  203. onError: (reason: any) => void;
  204. /**
  205. * Observable raised after the loader is disposed.
  206. */
  207. readonly onDisposeObservable: Observable<void>;
  208. private _onDisposeObserver;
  209. /**
  210. * Callback raised after the loader is disposed.
  211. */
  212. onDispose: () => void;
  213. /**
  214. * Observable raised after a loader extension is created.
  215. * Set additional options for a loader extension in this event.
  216. */
  217. readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  218. private _onExtensionLoadedObserver;
  219. /**
  220. * Callback raised after a loader extension is created.
  221. */
  222. onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
  223. /**
  224. * Defines if the loader logging is enabled.
  225. */
  226. loggingEnabled: boolean;
  227. /**
  228. * Defines if the loader should capture performance counters.
  229. */
  230. capturePerformanceCounters: boolean;
  231. /**
  232. * Defines if the loader should validate the asset.
  233. */
  234. validate: boolean;
  235. /**
  236. * Observable raised after validation when validate is set to true. The event data is the result of the validation.
  237. */
  238. readonly onValidatedObservable: Observable<IGLTFValidationResults>;
  239. private _onValidatedObserver;
  240. /**
  241. * Callback raised after a loader extension is created.
  242. */
  243. onValidated: (results: IGLTFValidationResults) => void;
  244. private _loader;
  245. /**
  246. * Name of the loader ("gltf")
  247. */
  248. name: string;
  249. /**
  250. * Supported file extensions of the loader (.gltf, .glb)
  251. */
  252. extensions: ISceneLoaderPluginExtensions;
  253. /**
  254. * Disposes the loader, releases resources during load, and cancels any outstanding requests.
  255. */
  256. dispose(): void;
  257. /** @hidden */
  258. _clear(): void;
  259. /**
  260. * Imports one or more meshes from the loaded glTF data and adds them to the scene
  261. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  262. * @param scene the scene the meshes should be added to
  263. * @param data the glTF data to load
  264. * @param rootUrl root url to load from
  265. * @param onProgress event that fires when loading progress has occured
  266. * @param fileName Defines the name of the file to load
  267. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  268. */
  269. importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  270. meshes: AbstractMesh[];
  271. particleSystems: IParticleSystem[];
  272. skeletons: Skeleton[];
  273. animationGroups: AnimationGroup[];
  274. }>;
  275. /**
  276. * Imports all objects from the loaded glTF data and adds them to the scene
  277. * @param scene the scene the objects should be added to
  278. * @param data the glTF data to load
  279. * @param rootUrl root url to load from
  280. * @param onProgress event that fires when loading progress has occured
  281. * @param fileName Defines the name of the file to load
  282. * @returns a promise which completes when objects have been loaded to the scene
  283. */
  284. loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  285. /**
  286. * Load into an asset container.
  287. * @param scene The scene to load into
  288. * @param data The data to import
  289. * @param rootUrl The root url for scene and resources
  290. * @param onProgress The callback when the load progresses
  291. * @param fileName Defines the name of the file to load
  292. * @returns The loaded asset container
  293. */
  294. loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
  295. /**
  296. * If the data string can be loaded directly.
  297. * @param data string contianing the file data
  298. * @returns if the data can be loaded directly
  299. */
  300. canDirectLoad(data: string): boolean;
  301. /**
  302. * Rewrites a url by combining a root url and response url.
  303. */
  304. rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
  305. /**
  306. * Instantiates a glTF file loader plugin.
  307. * @returns the created plugin
  308. */
  309. createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  310. /**
  311. * The loader state or null if the loader is not active.
  312. */
  313. readonly loaderState: Nullable<GLTFLoaderState>;
  314. /**
  315. * Returns a promise that resolves when the asset is completely loaded.
  316. * @returns a promise that resolves when the asset is completely loaded.
  317. */
  318. whenCompleteAsync(): Promise<void>;
  319. private _parseAsync;
  320. private _validateAsync;
  321. private _getLoader;
  322. private _unpackBinary;
  323. private _unpackBinaryV1;
  324. private _unpackBinaryV2;
  325. private static _parseVersion;
  326. private static _compareVersion;
  327. private static _decodeBufferToText;
  328. private static readonly _logSpaces;
  329. private _logIndentLevel;
  330. private _loggingEnabled;
  331. /** @hidden */
  332. _log: (message: string) => void;
  333. /** @hidden */
  334. _logOpen(message: string): void;
  335. /** @hidden */
  336. _logClose(): void;
  337. private _logEnabled;
  338. private _logDisabled;
  339. private _capturePerformanceCounters;
  340. /** @hidden */
  341. _startPerformanceCounter: (counterName: string) => void;
  342. /** @hidden */
  343. _endPerformanceCounter: (counterName: string) => void;
  344. private _startPerformanceCounterEnabled;
  345. private _startPerformanceCounterDisabled;
  346. private _endPerformanceCounterEnabled;
  347. private _endPerformanceCounterDisabled;
  348. }
  349. }
  350. declare module BABYLON.GLTF2 {
  351. /**
  352. * Loader interface with an index field.
  353. */
  354. interface IArrayItem {
  355. /**
  356. * The index of this item in the array.
  357. */
  358. index: number;
  359. }
  360. /**
  361. * Loader interface with additional members.
  362. */
  363. interface ILoaderAccessor extends IAccessor, IArrayItem {
  364. /** @hidden */
  365. _data?: Promise<ArrayBufferView>;
  366. /** @hidden */
  367. _babylonVertexBuffer?: Promise<VertexBuffer>;
  368. }
  369. /**
  370. * Loader interface with additional members.
  371. */
  372. interface ILoaderAnimationChannel extends IAnimationChannel, IArrayItem {
  373. }
  374. /** @hidden */
  375. interface _ILoaderAnimationSamplerData {
  376. input: Float32Array;
  377. interpolation: AnimationSamplerInterpolation;
  378. output: Float32Array;
  379. }
  380. /**
  381. * Loader interface with additional members.
  382. */
  383. interface ILoaderAnimationSampler extends IAnimationSampler, IArrayItem {
  384. /** @hidden */
  385. _data?: Promise<_ILoaderAnimationSamplerData>;
  386. }
  387. /**
  388. * Loader interface with additional members.
  389. */
  390. interface ILoaderAnimation extends IAnimation, IArrayItem {
  391. channels: ILoaderAnimationChannel[];
  392. samplers: ILoaderAnimationSampler[];
  393. /** @hidden */
  394. _babylonAnimationGroup?: AnimationGroup;
  395. }
  396. /**
  397. * Loader interface with additional members.
  398. */
  399. interface ILoaderBuffer extends IBuffer, IArrayItem {
  400. /** @hidden */
  401. _data?: Promise<ArrayBufferView>;
  402. }
  403. /**
  404. * Loader interface with additional members.
  405. */
  406. interface ILoaderBufferView extends IBufferView, IArrayItem {
  407. /** @hidden */
  408. _data?: Promise<ArrayBufferView>;
  409. /** @hidden */
  410. _babylonBuffer?: Promise<Buffer>;
  411. }
  412. /**
  413. * Loader interface with additional members.
  414. */
  415. interface ILoaderCamera extends ICamera, IArrayItem {
  416. }
  417. /**
  418. * Loader interface with additional members.
  419. */
  420. interface ILoaderImage extends IImage, IArrayItem {
  421. /** @hidden */
  422. _data?: Promise<ArrayBufferView>;
  423. }
  424. /**
  425. * Loader interface with additional members.
  426. */
  427. interface ILoaderMaterialNormalTextureInfo extends IMaterialNormalTextureInfo, ILoaderTextureInfo {
  428. }
  429. /**
  430. * Loader interface with additional members.
  431. */
  432. interface ILoaderMaterialOcclusionTextureInfo extends IMaterialOcclusionTextureInfo, ILoaderTextureInfo {
  433. }
  434. /**
  435. * Loader interface with additional members.
  436. */
  437. interface ILoaderMaterialPbrMetallicRoughness extends IMaterialPbrMetallicRoughness {
  438. baseColorTexture?: ILoaderTextureInfo;
  439. metallicRoughnessTexture?: ILoaderTextureInfo;
  440. }
  441. /**
  442. * Loader interface with additional members.
  443. */
  444. interface ILoaderMaterial extends IMaterial, IArrayItem {
  445. pbrMetallicRoughness?: ILoaderMaterialPbrMetallicRoughness;
  446. normalTexture?: ILoaderMaterialNormalTextureInfo;
  447. occlusionTexture?: ILoaderMaterialOcclusionTextureInfo;
  448. emissiveTexture?: ILoaderTextureInfo;
  449. /** @hidden */
  450. _babylonData?: {
  451. [drawMode: number]: {
  452. material: Material;
  453. meshes: AbstractMesh[];
  454. promise: Promise<void>;
  455. };
  456. };
  457. }
  458. /**
  459. * Loader interface with additional members.
  460. */
  461. interface ILoaderMesh extends IMesh, IArrayItem {
  462. primitives: ILoaderMeshPrimitive[];
  463. }
  464. /**
  465. * Loader interface with additional members.
  466. */
  467. interface ILoaderMeshPrimitive extends IMeshPrimitive, IArrayItem {
  468. }
  469. /**
  470. * Loader interface with additional members.
  471. */
  472. interface ILoaderNode extends INode, IArrayItem {
  473. /**
  474. * The parent glTF node.
  475. */
  476. parent?: ILoaderNode;
  477. /** @hidden */
  478. _babylonMesh?: Mesh;
  479. /** @hidden */
  480. _primitiveBabylonMeshes?: Mesh[];
  481. /** @hidden */
  482. _babylonBones?: Bone[];
  483. /** @hidden */
  484. _numMorphTargets?: number;
  485. }
  486. /** @hidden */
  487. interface _ILoaderSamplerData {
  488. noMipMaps: boolean;
  489. samplingMode: number;
  490. wrapU: number;
  491. wrapV: number;
  492. }
  493. /**
  494. * Loader interface with additional members.
  495. */
  496. interface ILoaderSampler extends ISampler, IArrayItem {
  497. /** @hidden */
  498. _data?: _ILoaderSamplerData;
  499. }
  500. /**
  501. * Loader interface with additional members.
  502. */
  503. interface ILoaderScene extends IScene, IArrayItem {
  504. }
  505. /**
  506. * Loader interface with additional members.
  507. */
  508. interface ILoaderSkin extends ISkin, IArrayItem {
  509. /** @hidden */
  510. _babylonSkeleton?: Skeleton;
  511. /** @hidden */
  512. _promise?: Promise<void>;
  513. }
  514. /**
  515. * Loader interface with additional members.
  516. */
  517. interface ILoaderTexture extends ITexture, IArrayItem {
  518. }
  519. /**
  520. * Loader interface with additional members.
  521. */
  522. interface ILoaderTextureInfo extends ITextureInfo {
  523. }
  524. /**
  525. * Loader interface with additional members.
  526. */
  527. interface ILoaderGLTF extends IGLTF {
  528. accessors?: ILoaderAccessor[];
  529. animations?: ILoaderAnimation[];
  530. buffers?: ILoaderBuffer[];
  531. bufferViews?: ILoaderBufferView[];
  532. cameras?: ILoaderCamera[];
  533. images?: ILoaderImage[];
  534. materials?: ILoaderMaterial[];
  535. meshes?: ILoaderMesh[];
  536. nodes?: ILoaderNode[];
  537. samplers?: ILoaderSampler[];
  538. scenes?: ILoaderScene[];
  539. skins?: ILoaderSkin[];
  540. textures?: ILoaderTexture[];
  541. }
  542. }
  543. /**
  544. * Defines the module for importing and exporting glTF 2.0 assets
  545. */
  546. declare module BABYLON.GLTF2 {
  547. /**
  548. * Helper class for working with arrays when loading the glTF asset
  549. */
  550. class ArrayItem {
  551. /**
  552. * Gets an item from the given array.
  553. * @param context The context when loading the asset
  554. * @param array The array to get the item from
  555. * @param index The index to the array
  556. * @returns The array item
  557. */
  558. static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
  559. /**
  560. * Assign an `index` field to each item of the given array.
  561. * @param array The array of items
  562. */
  563. static Assign(array?: IArrayItem[]): void;
  564. }
  565. /**
  566. * The glTF 2.0 loader
  567. */
  568. class GLTFLoader implements IGLTFLoader {
  569. /** The glTF object parsed from the JSON. */
  570. gltf: ILoaderGLTF;
  571. /** The Babylon scene when loading the asset. */
  572. babylonScene: Scene;
  573. /** @hidden */
  574. _completePromises: Promise<any>[];
  575. private _disposed;
  576. private _parent;
  577. private _state;
  578. private _extensions;
  579. private _rootUrl;
  580. private _fileName;
  581. private _uniqueRootUrl;
  582. private _rootBabylonMesh;
  583. private _defaultBabylonMaterialData;
  584. private _progressCallback?;
  585. private _requests;
  586. private static readonly _DefaultSampler;
  587. private static _ExtensionNames;
  588. private static _ExtensionFactories;
  589. /**
  590. * Registers a loader extension.
  591. * @param name The name of the loader extension.
  592. * @param factory The factory function that creates the loader extension.
  593. */
  594. static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void;
  595. /**
  596. * Unregisters a loader extension.
  597. * @param name The name of the loader extenion.
  598. * @returns A boolean indicating whether the extension has been unregistered
  599. */
  600. static UnregisterExtension(name: string): boolean;
  601. /**
  602. * Gets the loader state.
  603. */
  604. readonly state: Nullable<GLTFLoaderState>;
  605. /** @hidden */
  606. constructor(parent: GLTFFileLoader);
  607. /** @hidden */
  608. dispose(): void;
  609. /** @hidden */
  610. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  611. meshes: AbstractMesh[];
  612. particleSystems: IParticleSystem[];
  613. skeletons: Skeleton[];
  614. animationGroups: AnimationGroup[];
  615. }>;
  616. /** @hidden */
  617. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  618. private _loadAsync;
  619. private _loadData;
  620. private _setupData;
  621. private _loadExtensions;
  622. private _checkExtensions;
  623. private _setState;
  624. private _createRootNode;
  625. /**
  626. * Loads a glTF scene.
  627. * @param context The context when loading the asset
  628. * @param scene The glTF scene property
  629. * @returns A promise that resolves when the load is complete
  630. */
  631. loadSceneAsync(context: string, scene: ILoaderScene): Promise<void>;
  632. private _forEachPrimitive;
  633. private _getMeshes;
  634. private _getSkeletons;
  635. private _getAnimationGroups;
  636. private _startAnimations;
  637. /**
  638. * Loads a glTF node.
  639. * @param context The context when loading the asset
  640. * @param node The glTF node property
  641. * @param assign A function called synchronously after parsing the glTF properties
  642. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete
  643. */
  644. loadNodeAsync(context: string, node: ILoaderNode, assign?: (babylonMesh: Mesh) => void): Promise<Mesh>;
  645. private _loadMeshAsync;
  646. private _loadMeshPrimitiveAsync;
  647. private _loadVertexDataAsync;
  648. private _createMorphTargets;
  649. private _loadMorphTargetsAsync;
  650. private _loadMorphTargetVertexDataAsync;
  651. private static _LoadTransform;
  652. private _loadSkinAsync;
  653. private _loadBones;
  654. private _loadBone;
  655. private _loadSkinInverseBindMatricesDataAsync;
  656. private _updateBoneMatrices;
  657. private _getNodeMatrix;
  658. /**
  659. * Loads a glTF camera.
  660. * @param context The context when loading the asset
  661. * @param camera The glTF camera property
  662. * @param assign A function called synchronously after parsing the glTF properties
  663. * @returns A promise that resolves with the loaded Babylon camera when the load is complete
  664. */
  665. loadCameraAsync(context: string, camera: ILoaderCamera, assign?: (babylonCamera: Camera) => void): Promise<Camera>;
  666. private _loadAnimationsAsync;
  667. /**
  668. * Loads a glTF animation.
  669. * @param context The context when loading the asset
  670. * @param animation The glTF animation property
  671. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete
  672. */
  673. loadAnimationAsync(context: string, animation: ILoaderAnimation): Promise<AnimationGroup>;
  674. private _loadAnimationChannelAsync;
  675. private _loadAnimationSamplerAsync;
  676. private _loadBufferAsync;
  677. /**
  678. * Loads a glTF buffer view.
  679. * @param context The context when loading the asset
  680. * @param bufferView The glTF buffer view property
  681. * @returns A promise that resolves with the loaded data when the load is complete
  682. */
  683. loadBufferViewAsync(context: string, bufferView: ILoaderBufferView): Promise<ArrayBufferView>;
  684. private _loadIndicesAccessorAsync;
  685. private _loadFloatAccessorAsync;
  686. private _loadVertexBufferViewAsync;
  687. private _loadVertexAccessorAsync;
  688. private _loadMaterialMetallicRoughnessPropertiesAsync;
  689. /** @hidden */
  690. _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign?: (babylonMaterial: Material) => void): Promise<Material>;
  691. private _createDefaultMaterial;
  692. /**
  693. * Creates a Babylon material from a glTF material.
  694. * @param context The context when loading the asset
  695. * @param material The glTF material property
  696. * @param babylonDrawMode The draw mode for the Babylon material
  697. * @returns The Babylon material
  698. */
  699. createMaterial(context: string, material: ILoaderMaterial, babylonDrawMode: number): Material;
  700. /**
  701. * Loads properties from a glTF material into a Babylon material.
  702. * @param context The context when loading the asset
  703. * @param material The glTF material property
  704. * @param babylonMaterial The Babylon material
  705. * @returns A promise that resolves when the load is complete
  706. */
  707. loadMaterialPropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Promise<void>;
  708. /**
  709. * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
  710. * @param context The context when loading the asset
  711. * @param material The glTF material property
  712. * @param babylonMaterial The Babylon material
  713. * @returns A promise that resolves when the load is complete
  714. */
  715. loadMaterialBasePropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Promise<void>;
  716. /**
  717. * Loads the alpha properties from a glTF material into a Babylon material.
  718. * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.
  719. * @param context The context when loading the asset
  720. * @param material The glTF material property
  721. * @param babylonMaterial The Babylon material
  722. */
  723. loadMaterialAlphaProperties(context: string, material: ILoaderMaterial, babylonMaterial: Material): void;
  724. /**
  725. * Loads a glTF texture info.
  726. * @param context The context when loading the asset
  727. * @param textureInfo The glTF texture info property
  728. * @param assign A function called synchronously after parsing the glTF properties
  729. * @returns A promise that resolves with the loaded Babylon texture when the load is complete
  730. */
  731. loadTextureInfoAsync(context: string, textureInfo: ILoaderTextureInfo, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
  732. private _loadTextureAsync;
  733. private _loadSampler;
  734. /**
  735. * Loads a glTF image.
  736. * @param context The context when loading the asset
  737. * @param image The glTF image property
  738. * @returns A promise that resolves with the loaded data when the load is complete
  739. */
  740. loadImageAsync(context: string, image: ILoaderImage): Promise<ArrayBufferView>;
  741. /**
  742. * Loads a glTF uri.
  743. * @param context The context when loading the asset
  744. * @param uri The base64 or relative uri
  745. * @returns A promise that resolves with the loaded data when the load is complete
  746. */
  747. loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
  748. private _onProgress;
  749. private static _GetTextureWrapMode;
  750. private static _GetTextureSamplingMode;
  751. private static _GetTypedArray;
  752. private static _GetNumComponents;
  753. private static _ValidateUri;
  754. private static _GetDrawMode;
  755. private _compileMaterialsAsync;
  756. private _compileShadowGeneratorsAsync;
  757. private _forEachExtensions;
  758. private _applyExtensions;
  759. private _extensionsOnLoading;
  760. private _extensionsOnReady;
  761. private _extensionsLoadSceneAsync;
  762. private _extensionsLoadNodeAsync;
  763. private _extensionsLoadCameraAsync;
  764. private _extensionsLoadVertexDataAsync;
  765. private _extensionsLoadMaterialAsync;
  766. private _extensionsCreateMaterial;
  767. private _extensionsLoadMaterialPropertiesAsync;
  768. private _extensionsLoadTextureInfoAsync;
  769. private _extensionsLoadAnimationAsync;
  770. private _extensionsLoadUriAsync;
  771. /**
  772. * Helper method called by a loader extension to load an glTF extension.
  773. * @param context The context when loading the asset
  774. * @param property The glTF property to load the extension from
  775. * @param extensionName The name of the extension to load
  776. * @param actionAsync The action to run
  777. * @returns The promise returned by actionAsync or null if the extension does not exist
  778. */
  779. static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  780. /**
  781. * Helper method called by a loader extension to load a glTF extra.
  782. * @param context The context when loading the asset
  783. * @param property The glTF property to load the extra from
  784. * @param extensionName The name of the extension to load
  785. * @param actionAsync The action to run
  786. * @returns The promise returned by actionAsync or null if the extra does not exist
  787. */
  788. static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  789. /**
  790. * Increments the indentation level and logs a message.
  791. * @param message The message to log
  792. */
  793. logOpen(message: string): void;
  794. /**
  795. * Decrements the indentation level.
  796. */
  797. logClose(): void;
  798. /**
  799. * Logs a message
  800. * @param message The message to log
  801. */
  802. log(message: string): void;
  803. /**
  804. * Starts a performance counter.
  805. * @param counterName The name of the performance counter
  806. */
  807. startPerformanceCounter(counterName: string): void;
  808. /**
  809. * Ends a performance counter.
  810. * @param counterName The name of the performance counter
  811. */
  812. endPerformanceCounter(counterName: string): void;
  813. }
  814. }
  815. declare module BABYLON.GLTF2 {
  816. /**
  817. * Interface for a glTF loader extension.
  818. */
  819. interface IGLTFLoaderExtension extends BABYLON.IGLTFLoaderExtension, IDisposable {
  820. /**
  821. * Called after the loader state changes to LOADING.
  822. */
  823. onLoading?(): void;
  824. /**
  825. * Called after the loader state changes to READY.
  826. */
  827. onReady?(): void;
  828. /**
  829. * Define this method to modify the default behavior when loading scenes.
  830. * @param context The context when loading the asset
  831. * @param scene The glTF scene property
  832. * @returns A promise that resolves when the load is complete or null if not handled
  833. */
  834. loadSceneAsync?(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  835. /**
  836. * Define this method to modify the default behavior when loading nodes.
  837. * @param context The context when loading the asset
  838. * @param node The glTF node property
  839. * @param assign A function called synchronously after parsing the glTF properties
  840. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete or null if not handled
  841. */
  842. loadNodeAsync?(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  843. /**
  844. * Define this method to modify the default behavior when loading cameras.
  845. * @param context The context when loading the asset
  846. * @param camera The glTF camera property
  847. * @param assign A function called synchronously after parsing the glTF properties
  848. * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
  849. */
  850. loadCameraAsync?(context: string, camera: ILoaderCamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
  851. /**
  852. * @hidden Define this method to modify the default behavior when loading vertex data for mesh primitives.
  853. * @param context The context when loading the asset
  854. * @param primitive The glTF mesh primitive property
  855. * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled
  856. */
  857. _loadVertexDataAsync?(context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  858. /**
  859. * @hidden Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.
  860. * @param context The context when loading the asset
  861. * @param material The glTF material property
  862. * @param assign A function called synchronously after parsing the glTF properties
  863. * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled
  864. */
  865. _loadMaterialAsync?(context: string, material: ILoaderMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  866. /**
  867. * Define this method to modify the default behavior when creating materials.
  868. * @param context The context when loading the asset
  869. * @param material The glTF material property
  870. * @param babylonDrawMode The draw mode for the Babylon material
  871. * @returns The Babylon material or null if not handled
  872. */
  873. createMaterial?(context: string, material: ILoaderMaterial, babylonDrawMode: number): Nullable<Material>;
  874. /**
  875. * Define this method to modify the default behavior when loading material properties.
  876. * @param context The context when loading the asset
  877. * @param material The glTF material property
  878. * @param babylonMaterial The Babylon material
  879. * @returns A promise that resolves when the load is complete or null if not handled
  880. */
  881. loadMaterialPropertiesAsync?(context: string, material: ILoaderMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  882. /**
  883. * Define this method to modify the default behavior when loading texture infos.
  884. * @param context The context when loading the asset
  885. * @param textureInfo The glTF texture info property
  886. * @param assign A function called synchronously after parsing the glTF properties
  887. * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
  888. */
  889. loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  890. /**
  891. * Define this method to modify the default behavior when loading animations.
  892. * @param context The context when loading the asset
  893. * @param animation The glTF animation property
  894. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
  895. */
  896. loadAnimationAsync?(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
  897. /**
  898. * Define this method to modify the default behavior when loading uris.
  899. * @param context The context when loading the asset
  900. * @param uri The uri to load
  901. * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
  902. */
  903. _loadUriAsync?(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  904. }
  905. }
  906. /**
  907. * Defines the module for the built-in glTF 2.0 loader extensions.
  908. */
  909. declare module BABYLON.GLTF2.Extensions {
  910. }
  911. declare module BABYLON.GLTF2.Extensions {
  912. /**
  913. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
  914. */
  915. class MSFT_lod implements IGLTFLoaderExtension {
  916. /** The name of this extension. */
  917. readonly name: string;
  918. /** Defines whether this extension is enabled. */
  919. enabled: boolean;
  920. /**
  921. * Maximum number of LODs to load, starting from the lowest LOD.
  922. */
  923. maxLODsToLoad: number;
  924. /**
  925. * Observable raised when all node LODs of one level are loaded.
  926. * The event data is the index of the loaded LOD starting from zero.
  927. * Dispose the loader to cancel the loading of the next level of LODs.
  928. */
  929. onNodeLODsLoadedObservable: Observable<number>;
  930. /**
  931. * Observable raised when all material LODs of one level are loaded.
  932. * The event data is the index of the loaded LOD starting from zero.
  933. * Dispose the loader to cancel the loading of the next level of LODs.
  934. */
  935. onMaterialLODsLoadedObservable: Observable<number>;
  936. private _loader;
  937. private _nodeIndexLOD;
  938. private _nodeSignalLODs;
  939. private _nodePromiseLODs;
  940. private _materialIndexLOD;
  941. private _materialSignalLODs;
  942. private _materialPromiseLODs;
  943. /** @hidden */
  944. constructor(loader: GLTFLoader);
  945. /** @hidden */
  946. dispose(): void;
  947. /** @hidden */
  948. onReady(): void;
  949. /** @hidden */
  950. loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  951. /** @hidden */
  952. _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  953. /** @hidden */
  954. _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  955. /**
  956. * Gets an array of LOD properties from lowest to highest.
  957. */
  958. private _getLODs;
  959. private _disposeUnusedMaterials;
  960. }
  961. }
  962. declare module BABYLON.GLTF2.Extensions {
  963. /** @hidden */
  964. class MSFT_minecraftMesh implements IGLTFLoaderExtension {
  965. readonly name: string;
  966. enabled: boolean;
  967. private _loader;
  968. constructor(loader: GLTFLoader);
  969. dispose(): void;
  970. loadMaterialPropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  971. }
  972. }
  973. declare module BABYLON.GLTF2.Extensions {
  974. /** @hidden */
  975. class MSFT_sRGBFactors implements IGLTFLoaderExtension {
  976. readonly name: string;
  977. enabled: boolean;
  978. private _loader;
  979. constructor(loader: GLTFLoader);
  980. dispose(): void;
  981. loadMaterialPropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  982. }
  983. }
  984. declare module BABYLON.GLTF2.Extensions {
  985. /**
  986. * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
  987. */
  988. class MSFT_audio_emitter implements IGLTFLoaderExtension {
  989. /** The name of this extension. */
  990. readonly name: string;
  991. /** Defines whether this extension is enabled. */
  992. enabled: boolean;
  993. private _loader;
  994. private _clips;
  995. private _emitters;
  996. /** @hidden */
  997. constructor(loader: GLTFLoader);
  998. /** @hidden */
  999. dispose(): void;
  1000. /** @hidden */
  1001. onLoading(): void;
  1002. /** @hidden */
  1003. loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1004. /** @hidden */
  1005. loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1006. /** @hidden */
  1007. loadAnimationAsync(context: string, animation: ILoaderAnimation): Nullable<Promise<AnimationGroup>>;
  1008. private _loadClipAsync;
  1009. private _loadEmitterAsync;
  1010. private _getEventAction;
  1011. private _loadAnimationEventAsync;
  1012. }
  1013. }
  1014. declare module BABYLON.GLTF2.Extensions {
  1015. /**
  1016. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
  1017. */
  1018. class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
  1019. /** The name of this extension. */
  1020. readonly name: string;
  1021. /** Defines whether this extension is enabled. */
  1022. enabled: boolean;
  1023. private _loader;
  1024. private _dracoCompression?;
  1025. /** @hidden */
  1026. constructor(loader: GLTFLoader);
  1027. /** @hidden */
  1028. dispose(): void;
  1029. /** @hidden */
  1030. _loadVertexDataAsync(context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1031. }
  1032. }
  1033. declare module BABYLON.GLTF2.Extensions {
  1034. /**
  1035. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
  1036. */
  1037. class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension {
  1038. /** The name of this extension. */
  1039. readonly name: string;
  1040. /** Defines whether this extension is enabled. */
  1041. enabled: boolean;
  1042. private _loader;
  1043. /** @hidden */
  1044. constructor(loader: GLTFLoader);
  1045. /** @hidden */
  1046. dispose(): void;
  1047. /** @hidden */
  1048. loadMaterialPropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1049. private _loadSpecularGlossinessPropertiesAsync;
  1050. }
  1051. }
  1052. declare module BABYLON.GLTF2.Extensions {
  1053. /**
  1054. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
  1055. */
  1056. class KHR_materials_unlit implements IGLTFLoaderExtension {
  1057. /** The name of this extension. */
  1058. readonly name: string;
  1059. /** Defines whether this extension is enabled. */
  1060. enabled: boolean;
  1061. private _loader;
  1062. /** @hidden */
  1063. constructor(loader: GLTFLoader);
  1064. /** @hidden */
  1065. dispose(): void;
  1066. /** @hidden */
  1067. loadMaterialPropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1068. private _loadUnlitPropertiesAsync;
  1069. }
  1070. }
  1071. declare module BABYLON.GLTF2.Extensions {
  1072. /**
  1073. * [Specification](https://github.com/MiiBond/glTF/tree/khr_lights_v1/extensions/Khronos/KHR_lights) (Experimental)
  1074. */
  1075. class KHR_lights implements IGLTFLoaderExtension {
  1076. /** The name of this extension. */
  1077. readonly name: string;
  1078. /** Defines whether this extension is enabled. */
  1079. enabled: boolean;
  1080. private _loader;
  1081. private _lights?;
  1082. /** @hidden */
  1083. constructor(loader: GLTFLoader);
  1084. /** @hidden */
  1085. dispose(): void;
  1086. /** @hidden */
  1087. onLoading(): void;
  1088. /** @hidden */
  1089. loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1090. /** @hidden */
  1091. loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1092. }
  1093. }
  1094. declare module BABYLON.GLTF2.Extensions {
  1095. /**
  1096. * [Specification](https://github.com/AltspaceVR/glTF/blob/avr-sampler-offset-tile/extensions/2.0/Khronos/KHR_texture_transform/README.md) (Experimental)
  1097. */
  1098. class KHR_texture_transform implements IGLTFLoaderExtension {
  1099. /** The name of this extension. */
  1100. readonly name: string;
  1101. /** Defines whether this extension is enabled. */
  1102. enabled: boolean;
  1103. private _loader;
  1104. /** @hidden */
  1105. constructor(loader: GLTFLoader);
  1106. /** @hidden */
  1107. dispose(): void;
  1108. /** @hidden */
  1109. loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1110. }
  1111. }
  1112. declare module BABYLON.GLTF2.Extensions {
  1113. /**
  1114. * [Specification](TODO) (Experimental)
  1115. */
  1116. class EXT_lights_imageBased implements IGLTFLoaderExtension {
  1117. /** The name of this extension. */
  1118. readonly name: string;
  1119. /** Defines whether this extension is enabled. */
  1120. enabled: boolean;
  1121. private _loader;
  1122. private _lights?;
  1123. /** @hidden */
  1124. constructor(loader: GLTFLoader);
  1125. /** @hidden */
  1126. dispose(): void;
  1127. /** @hidden */
  1128. onLoading(): void;
  1129. /** @hidden */
  1130. loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1131. private _loadLightAsync;
  1132. }
  1133. }