babylon.glTFFileLoader.d.ts 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710
  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. * JSON that represents the glTF.
  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, fullName?: 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, fullName?: 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. /** @hidden */
  143. _normalizeAnimationGroupsToBeginAtZero: boolean;
  144. /**
  145. * Function called before loading a url referenced by the asset.
  146. */
  147. preprocessUrlAsync: (url: string) => Promise<string>;
  148. /**
  149. * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  150. */
  151. readonly onMeshLoadedObservable: Observable<AbstractMesh>;
  152. private _onMeshLoadedObserver;
  153. /**
  154. * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  155. */
  156. onMeshLoaded: (mesh: AbstractMesh) => void;
  157. /**
  158. * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
  159. */
  160. readonly onTextureLoadedObservable: Observable<BaseTexture>;
  161. private _onTextureLoadedObserver;
  162. /**
  163. * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
  164. */
  165. onTextureLoaded: (texture: BaseTexture) => void;
  166. /**
  167. * Observable raised when the loader creates a material after parsing the glTF properties of the material.
  168. */
  169. readonly onMaterialLoadedObservable: Observable<Material>;
  170. private _onMaterialLoadedObserver;
  171. /**
  172. * Callback raised when the loader creates a material after parsing the glTF properties of the material.
  173. */
  174. onMaterialLoaded: (material: Material) => void;
  175. /**
  176. * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.
  177. */
  178. readonly onCameraLoadedObservable: Observable<Camera>;
  179. private _onCameraLoadedObserver;
  180. /**
  181. * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
  182. */
  183. onCameraLoaded: (camera: Camera) => void;
  184. /**
  185. * Observable raised when the asset is completely loaded, immediately before the loader is disposed.
  186. * For assets with LODs, raised when all of the LODs are complete.
  187. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
  188. */
  189. readonly onCompleteObservable: Observable<void>;
  190. private _onCompleteObserver;
  191. /**
  192. * Callback raised when the asset is completely loaded, immediately before the loader is disposed.
  193. * For assets with LODs, raised when all of the LODs are complete.
  194. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
  195. */
  196. onComplete: () => void;
  197. /**
  198. * Observable raised when an error occurs.
  199. */
  200. readonly onErrorObservable: Observable<any>;
  201. private _onErrorObserver;
  202. /**
  203. * Callback raised when an error occurs.
  204. */
  205. onError: (reason: any) => void;
  206. /**
  207. * Observable raised after the loader is disposed.
  208. */
  209. readonly onDisposeObservable: Observable<void>;
  210. private _onDisposeObserver;
  211. /**
  212. * Callback raised after the loader is disposed.
  213. */
  214. onDispose: () => void;
  215. /**
  216. * Observable raised after a loader extension is created.
  217. * Set additional options for a loader extension in this event.
  218. */
  219. readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  220. private _onExtensionLoadedObserver;
  221. /**
  222. * Callback raised after a loader extension is created.
  223. */
  224. onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
  225. /**
  226. * Returns a promise that resolves when the asset is completely loaded.
  227. * @returns a promise that resolves when the asset is completely loaded.
  228. */
  229. whenCompleteAsync(): Promise<void>;
  230. /**
  231. * The loader state or null if the loader is not active.
  232. */
  233. readonly loaderState: Nullable<GLTFLoaderState>;
  234. /**
  235. * Defines if the loader logging is enabled.
  236. */
  237. loggingEnabled: boolean;
  238. /**
  239. * Defines if the loader should capture performance counters.
  240. */
  241. capturePerformanceCounters: boolean;
  242. private _loader;
  243. /**
  244. * Name of the loader ("gltf")
  245. */
  246. name: string;
  247. /**
  248. * Supported file extensions of the loader (.gltf, .glb)
  249. */
  250. extensions: ISceneLoaderPluginExtensions;
  251. /**
  252. * Disposes the loader, releases resources during load, and cancels any outstanding requests.
  253. */
  254. dispose(): void;
  255. /** @hidden */
  256. _clear(): void;
  257. /**
  258. * Imports one or more meshes from the loaded glTF data and adds them to the scene
  259. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  260. * @param scene the scene the meshes should be added to
  261. * @param data the glTF data to load
  262. * @param rootUrl root url to load from
  263. * @param onProgress event that fires when loading progress has occured
  264. * @param fullName Defines the FQDN of the file to load
  265. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  266. */
  267. importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fullName?: string): Promise<{
  268. meshes: AbstractMesh[];
  269. particleSystems: IParticleSystem[];
  270. skeletons: Skeleton[];
  271. animationGroups: AnimationGroup[];
  272. }>;
  273. /**
  274. * Imports all objects from the loaded glTF data and adds them to the scene
  275. * @param scene the scene the objects should be added to
  276. * @param data the glTF data to load
  277. * @param rootUrl root url to load from
  278. * @param onProgress event that fires when loading progress has occured
  279. * @param fullName Defines the FQDN of the file to load
  280. * @returns a promise which completes when objects have been loaded to the scene
  281. */
  282. loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fullName?: string): Promise<void>;
  283. /**
  284. * Load into an asset container.
  285. * @param scene The scene to load into
  286. * @param data The data to import
  287. * @param rootUrl The root url for scene and resources
  288. * @param onProgress The callback when the load progresses
  289. * @param fullName Defines the FQDN of the file to load
  290. * @returns The loaded asset container
  291. */
  292. loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fullName?: string): Promise<AssetContainer>;
  293. /**
  294. * If the data string can be loaded directly.
  295. * @param data string contianing the file data
  296. * @returns if the data can be loaded directly
  297. */
  298. canDirectLoad(data: string): boolean;
  299. /**
  300. * Rewrites a url by combining a root url and response url.
  301. */
  302. rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
  303. /**
  304. * Instantiates a glTF file loader plugin.
  305. * @returns the created plugin
  306. */
  307. createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  308. private _parse;
  309. private _getLoader;
  310. private _parseBinary;
  311. private _parseV1;
  312. private _parseV2;
  313. private static _parseVersion;
  314. private static _compareVersion;
  315. private static _decodeBufferToText;
  316. private static readonly _logSpaces;
  317. private _logIndentLevel;
  318. private _loggingEnabled;
  319. /** @hidden */
  320. _log: (message: string) => void;
  321. /** @hidden */
  322. _logOpen(message: string): void;
  323. /** @hidden */
  324. _logClose(): void;
  325. private _logEnabled;
  326. private _logDisabled;
  327. private _capturePerformanceCounters;
  328. /** @hidden */
  329. _startPerformanceCounter: (counterName: string) => void;
  330. /** @hidden */
  331. _endPerformanceCounter: (counterName: string) => void;
  332. private _startPerformanceCounterEnabled;
  333. private _startPerformanceCounterDisabled;
  334. private _endPerformanceCounterEnabled;
  335. private _endPerformanceCounterDisabled;
  336. }
  337. }
  338. declare module BABYLON.GLTF1 {
  339. /**
  340. * Enums
  341. */
  342. enum EComponentType {
  343. BYTE = 5120,
  344. UNSIGNED_BYTE = 5121,
  345. SHORT = 5122,
  346. UNSIGNED_SHORT = 5123,
  347. FLOAT = 5126
  348. }
  349. enum EShaderType {
  350. FRAGMENT = 35632,
  351. VERTEX = 35633
  352. }
  353. enum EParameterType {
  354. BYTE = 5120,
  355. UNSIGNED_BYTE = 5121,
  356. SHORT = 5122,
  357. UNSIGNED_SHORT = 5123,
  358. INT = 5124,
  359. UNSIGNED_INT = 5125,
  360. FLOAT = 5126,
  361. FLOAT_VEC2 = 35664,
  362. FLOAT_VEC3 = 35665,
  363. FLOAT_VEC4 = 35666,
  364. INT_VEC2 = 35667,
  365. INT_VEC3 = 35668,
  366. INT_VEC4 = 35669,
  367. BOOL = 35670,
  368. BOOL_VEC2 = 35671,
  369. BOOL_VEC3 = 35672,
  370. BOOL_VEC4 = 35673,
  371. FLOAT_MAT2 = 35674,
  372. FLOAT_MAT3 = 35675,
  373. FLOAT_MAT4 = 35676,
  374. SAMPLER_2D = 35678
  375. }
  376. enum ETextureWrapMode {
  377. CLAMP_TO_EDGE = 33071,
  378. MIRRORED_REPEAT = 33648,
  379. REPEAT = 10497
  380. }
  381. enum ETextureFilterType {
  382. NEAREST = 9728,
  383. LINEAR = 9728,
  384. NEAREST_MIPMAP_NEAREST = 9984,
  385. LINEAR_MIPMAP_NEAREST = 9985,
  386. NEAREST_MIPMAP_LINEAR = 9986,
  387. LINEAR_MIPMAP_LINEAR = 9987
  388. }
  389. enum ETextureFormat {
  390. ALPHA = 6406,
  391. RGB = 6407,
  392. RGBA = 6408,
  393. LUMINANCE = 6409,
  394. LUMINANCE_ALPHA = 6410
  395. }
  396. enum ECullingType {
  397. FRONT = 1028,
  398. BACK = 1029,
  399. FRONT_AND_BACK = 1032
  400. }
  401. enum EBlendingFunction {
  402. ZERO = 0,
  403. ONE = 1,
  404. SRC_COLOR = 768,
  405. ONE_MINUS_SRC_COLOR = 769,
  406. DST_COLOR = 774,
  407. ONE_MINUS_DST_COLOR = 775,
  408. SRC_ALPHA = 770,
  409. ONE_MINUS_SRC_ALPHA = 771,
  410. DST_ALPHA = 772,
  411. ONE_MINUS_DST_ALPHA = 773,
  412. CONSTANT_COLOR = 32769,
  413. ONE_MINUS_CONSTANT_COLOR = 32770,
  414. CONSTANT_ALPHA = 32771,
  415. ONE_MINUS_CONSTANT_ALPHA = 32772,
  416. SRC_ALPHA_SATURATE = 776
  417. }
  418. /**
  419. * Interfaces
  420. */
  421. interface IGLTFProperty {
  422. extensions?: {
  423. [key: string]: any;
  424. };
  425. extras?: Object;
  426. }
  427. interface IGLTFChildRootProperty extends IGLTFProperty {
  428. name?: string;
  429. }
  430. interface IGLTFAccessor extends IGLTFChildRootProperty {
  431. bufferView: string;
  432. byteOffset: number;
  433. byteStride: number;
  434. count: number;
  435. type: string;
  436. componentType: EComponentType;
  437. max?: number[];
  438. min?: number[];
  439. name?: string;
  440. }
  441. interface IGLTFBufferView extends IGLTFChildRootProperty {
  442. buffer: string;
  443. byteOffset: number;
  444. byteLength: number;
  445. byteStride: number;
  446. target?: number;
  447. }
  448. interface IGLTFBuffer extends IGLTFChildRootProperty {
  449. uri: string;
  450. byteLength?: number;
  451. type?: string;
  452. }
  453. interface IGLTFShader extends IGLTFChildRootProperty {
  454. uri: string;
  455. type: EShaderType;
  456. }
  457. interface IGLTFProgram extends IGLTFChildRootProperty {
  458. attributes: string[];
  459. fragmentShader: string;
  460. vertexShader: string;
  461. }
  462. interface IGLTFTechniqueParameter {
  463. type: number;
  464. count?: number;
  465. semantic?: string;
  466. node?: string;
  467. value?: number | boolean | string | Array<any>;
  468. source?: string;
  469. babylonValue?: any;
  470. }
  471. interface IGLTFTechniqueCommonProfile {
  472. lightingModel: string;
  473. texcoordBindings: Object;
  474. parameters?: Array<any>;
  475. }
  476. interface IGLTFTechniqueStatesFunctions {
  477. blendColor?: number[];
  478. blendEquationSeparate?: number[];
  479. blendFuncSeparate?: number[];
  480. colorMask: boolean[];
  481. cullFace: number[];
  482. }
  483. interface IGLTFTechniqueStates {
  484. enable: number[];
  485. functions: IGLTFTechniqueStatesFunctions;
  486. }
  487. interface IGLTFTechnique extends IGLTFChildRootProperty {
  488. parameters: {
  489. [key: string]: IGLTFTechniqueParameter;
  490. };
  491. program: string;
  492. attributes: {
  493. [key: string]: string;
  494. };
  495. uniforms: {
  496. [key: string]: string;
  497. };
  498. states: IGLTFTechniqueStates;
  499. }
  500. interface IGLTFMaterial extends IGLTFChildRootProperty {
  501. technique?: string;
  502. values: string[];
  503. }
  504. interface IGLTFMeshPrimitive extends IGLTFProperty {
  505. attributes: {
  506. [key: string]: string;
  507. };
  508. indices: string;
  509. material: string;
  510. mode?: number;
  511. }
  512. interface IGLTFMesh extends IGLTFChildRootProperty {
  513. primitives: IGLTFMeshPrimitive[];
  514. }
  515. interface IGLTFImage extends IGLTFChildRootProperty {
  516. uri: string;
  517. }
  518. interface IGLTFSampler extends IGLTFChildRootProperty {
  519. magFilter?: number;
  520. minFilter?: number;
  521. wrapS?: number;
  522. wrapT?: number;
  523. }
  524. interface IGLTFTexture extends IGLTFChildRootProperty {
  525. sampler: string;
  526. source: string;
  527. format?: ETextureFormat;
  528. internalFormat?: ETextureFormat;
  529. target?: number;
  530. type?: number;
  531. babylonTexture?: Texture;
  532. }
  533. interface IGLTFAmbienLight {
  534. color?: number[];
  535. }
  536. interface IGLTFDirectionalLight {
  537. color?: number[];
  538. }
  539. interface IGLTFPointLight {
  540. color?: number[];
  541. constantAttenuation?: number;
  542. linearAttenuation?: number;
  543. quadraticAttenuation?: number;
  544. }
  545. interface IGLTFSpotLight {
  546. color?: number[];
  547. constantAttenuation?: number;
  548. fallOfAngle?: number;
  549. fallOffExponent?: number;
  550. linearAttenuation?: number;
  551. quadraticAttenuation?: number;
  552. }
  553. interface IGLTFLight extends IGLTFChildRootProperty {
  554. type: string;
  555. }
  556. interface IGLTFCameraOrthographic {
  557. xmag: number;
  558. ymag: number;
  559. zfar: number;
  560. znear: number;
  561. }
  562. interface IGLTFCameraPerspective {
  563. aspectRatio: number;
  564. yfov: number;
  565. zfar: number;
  566. znear: number;
  567. }
  568. interface IGLTFCamera extends IGLTFChildRootProperty {
  569. type: string;
  570. }
  571. interface IGLTFAnimationChannelTarget {
  572. id: string;
  573. path: string;
  574. }
  575. interface IGLTFAnimationChannel {
  576. sampler: string;
  577. target: IGLTFAnimationChannelTarget;
  578. }
  579. interface IGLTFAnimationSampler {
  580. input: string;
  581. output: string;
  582. interpolation?: string;
  583. }
  584. interface IGLTFAnimation extends IGLTFChildRootProperty {
  585. channels?: IGLTFAnimationChannel[];
  586. parameters?: {
  587. [key: string]: string;
  588. };
  589. samplers?: {
  590. [key: string]: IGLTFAnimationSampler;
  591. };
  592. }
  593. interface IGLTFNodeInstanceSkin {
  594. skeletons: string[];
  595. skin: string;
  596. meshes: string[];
  597. }
  598. interface IGLTFSkins extends IGLTFChildRootProperty {
  599. bindShapeMatrix: number[];
  600. inverseBindMatrices: string;
  601. jointNames: string[];
  602. babylonSkeleton?: Skeleton;
  603. }
  604. interface IGLTFNode extends IGLTFChildRootProperty {
  605. camera?: string;
  606. children: string[];
  607. skin?: string;
  608. jointName?: string;
  609. light?: string;
  610. matrix: number[];
  611. mesh?: string;
  612. meshes?: string[];
  613. rotation?: number[];
  614. scale?: number[];
  615. translation?: number[];
  616. babylonNode?: Node;
  617. }
  618. interface IGLTFScene extends IGLTFChildRootProperty {
  619. nodes: string[];
  620. }
  621. /**
  622. * Runtime
  623. */
  624. interface IGLTFRuntime {
  625. extensions: {
  626. [key: string]: any;
  627. };
  628. accessors: {
  629. [key: string]: IGLTFAccessor;
  630. };
  631. buffers: {
  632. [key: string]: IGLTFBuffer;
  633. };
  634. bufferViews: {
  635. [key: string]: IGLTFBufferView;
  636. };
  637. meshes: {
  638. [key: string]: IGLTFMesh;
  639. };
  640. lights: {
  641. [key: string]: IGLTFLight;
  642. };
  643. cameras: {
  644. [key: string]: IGLTFCamera;
  645. };
  646. nodes: {
  647. [key: string]: IGLTFNode;
  648. };
  649. images: {
  650. [key: string]: IGLTFImage;
  651. };
  652. textures: {
  653. [key: string]: IGLTFTexture;
  654. };
  655. shaders: {
  656. [key: string]: IGLTFShader;
  657. };
  658. programs: {
  659. [key: string]: IGLTFProgram;
  660. };
  661. samplers: {
  662. [key: string]: IGLTFSampler;
  663. };
  664. techniques: {
  665. [key: string]: IGLTFTechnique;
  666. };
  667. materials: {
  668. [key: string]: IGLTFMaterial;
  669. };
  670. animations: {
  671. [key: string]: IGLTFAnimation;
  672. };
  673. skins: {
  674. [key: string]: IGLTFSkins;
  675. };
  676. currentScene?: Object;
  677. scenes: {
  678. [key: string]: IGLTFScene;
  679. };
  680. extensionsUsed: string[];
  681. extensionsRequired?: string[];
  682. buffersCount: number;
  683. shaderscount: number;
  684. scene: Scene;
  685. rootUrl: string;
  686. loadedBufferCount: number;
  687. loadedBufferViews: {
  688. [name: string]: ArrayBufferView;
  689. };
  690. loadedShaderCount: number;
  691. importOnlyMeshes: boolean;
  692. importMeshesNames?: string[];
  693. dummyNodes: Node[];
  694. }
  695. /**
  696. * Bones
  697. */
  698. interface INodeToRoot {
  699. bone: Bone;
  700. node: IGLTFNode;
  701. id: string;
  702. }
  703. interface IJointNode {
  704. node: IGLTFNode;
  705. id: string;
  706. }
  707. }
  708. declare module BABYLON.GLTF1 {
  709. /**
  710. * Implementation of the base glTF spec
  711. */
  712. class GLTFLoaderBase {
  713. static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
  714. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  715. static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
  716. static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  717. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void;
  718. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  719. }
  720. /**
  721. * glTF V1 Loader
  722. */
  723. class GLTFLoader implements IGLTFLoader {
  724. static Extensions: {
  725. [name: string]: GLTFLoaderExtension;
  726. };
  727. static RegisterExtension(extension: GLTFLoaderExtension): void;
  728. state: Nullable<GLTFLoaderState>;
  729. dispose(): void;
  730. private _importMeshAsync;
  731. /**
  732. * Imports one or more meshes from a loaded gltf file and adds them to the scene
  733. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  734. * @param scene the scene the meshes should be added to
  735. * @param data gltf data containing information of the meshes in a loaded file
  736. * @param rootUrl root url to load from
  737. * @param onProgress event that fires when loading progress has occured
  738. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  739. */
  740. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
  741. meshes: AbstractMesh[];
  742. particleSystems: IParticleSystem[];
  743. skeletons: Skeleton[];
  744. animationGroups: AnimationGroup[];
  745. }>;
  746. private _loadAsync;
  747. /**
  748. * Imports all objects from a loaded gltf file and adds them to the scene
  749. * @param scene the scene the objects should be added to
  750. * @param data gltf data containing information of the meshes in a loaded file
  751. * @param rootUrl root url to load from
  752. * @param onProgress event that fires when loading progress has occured
  753. * @returns a promise which completes when objects have been loaded to the scene
  754. */
  755. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
  756. private _loadShadersAsync;
  757. private _loadBuffersAsync;
  758. private _createNodes;
  759. }
  760. }
  761. declare module BABYLON.GLTF1 {
  762. /**
  763. * Utils functions for GLTF
  764. */
  765. class GLTFUtils {
  766. /**
  767. * Sets the given "parameter" matrix
  768. * @param scene: the {BABYLON.Scene} object
  769. * @param source: the source node where to pick the matrix
  770. * @param parameter: the GLTF technique parameter
  771. * @param uniformName: the name of the shader's uniform
  772. * @param shaderMaterial: the shader material
  773. */
  774. static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void;
  775. /**
  776. * Sets the given "parameter" matrix
  777. * @param shaderMaterial: the shader material
  778. * @param uniform: the name of the shader's uniform
  779. * @param value: the value of the uniform
  780. * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
  781. */
  782. static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
  783. /**
  784. * Returns the wrap mode of the texture
  785. * @param mode: the mode value
  786. */
  787. static GetWrapMode(mode: number): number;
  788. /**
  789. * Returns the byte stride giving an accessor
  790. * @param accessor: the GLTF accessor objet
  791. */
  792. static GetByteStrideFromType(accessor: IGLTFAccessor): number;
  793. /**
  794. * Returns the texture filter mode giving a mode value
  795. * @param mode: the filter mode value
  796. */
  797. static GetTextureFilterMode(mode: number): ETextureFilterType;
  798. static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
  799. /**
  800. * Returns a buffer from its accessor
  801. * @param gltfRuntime: the GLTF runtime
  802. * @param accessor: the GLTF accessor
  803. */
  804. static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
  805. /**
  806. * Decodes a buffer view into a string
  807. * @param view: the buffer view
  808. */
  809. static DecodeBufferToText(view: ArrayBufferView): string;
  810. /**
  811. * Returns the default material of gltf. Related to
  812. * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
  813. * @param scene: the Babylon.js scene
  814. */
  815. static GetDefaultMaterial(scene: Scene): ShaderMaterial;
  816. private static _DefaultMaterial;
  817. }
  818. }
  819. declare module BABYLON.GLTF1 {
  820. abstract class GLTFLoaderExtension {
  821. private _name;
  822. constructor(name: string);
  823. readonly name: string;
  824. /**
  825. * Defines an override for loading the runtime
  826. * Return true to stop further extensions from loading the runtime
  827. */
  828. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
  829. /**
  830. * Defines an onverride for creating gltf runtime
  831. * Return true to stop further extensions from creating the runtime
  832. */
  833. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
  834. /**
  835. * Defines an override for loading buffers
  836. * Return true to stop further extensions from loading this buffer
  837. */
  838. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
  839. /**
  840. * Defines an override for loading texture buffers
  841. * Return true to stop further extensions from loading this texture data
  842. */
  843. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  844. /**
  845. * Defines an override for creating textures
  846. * Return true to stop further extensions from loading this texture
  847. */
  848. createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
  849. /**
  850. * Defines an override for loading shader strings
  851. * Return true to stop further extensions from loading this shader data
  852. */
  853. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  854. /**
  855. * Defines an override for loading materials
  856. * Return true to stop further extensions from loading this material
  857. */
  858. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  859. static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): void;
  860. static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void;
  861. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  862. static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  863. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void;
  864. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  865. private static LoadTextureBufferAsync;
  866. private static CreateTextureAsync;
  867. private static ApplyExtensions;
  868. }
  869. }
  870. declare module BABYLON.GLTF1 {
  871. class GLTFBinaryExtension extends GLTFLoaderExtension {
  872. private _bin;
  873. constructor();
  874. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  875. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  876. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  877. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  878. }
  879. }
  880. declare module BABYLON.GLTF1 {
  881. class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {
  882. constructor();
  883. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  884. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  885. private _loadTexture;
  886. }
  887. }
  888. declare module BABYLON.GLTF2 {
  889. /**
  890. * Loader interface with an index field.
  891. */
  892. interface IArrayItem {
  893. /**
  894. * The index of this item in the array.
  895. */
  896. index: number;
  897. }
  898. /**
  899. * Loader interface with additional members.
  900. */
  901. interface ILoaderAccessor extends IAccessor, IArrayItem {
  902. /** @hidden */
  903. _data?: Promise<ArrayBufferView>;
  904. /** @hidden */
  905. _babylonVertexBuffer?: Promise<VertexBuffer>;
  906. }
  907. /**
  908. * Loader interface with additional members.
  909. */
  910. interface ILoaderAnimationChannel extends IAnimationChannel, IArrayItem {
  911. }
  912. /** @hidden */
  913. interface _ILoaderAnimationSamplerData {
  914. input: Float32Array;
  915. interpolation: AnimationSamplerInterpolation;
  916. output: Float32Array;
  917. }
  918. /**
  919. * Loader interface with additional members.
  920. */
  921. interface ILoaderAnimationSampler extends IAnimationSampler, IArrayItem {
  922. /** @hidden */
  923. _data?: Promise<_ILoaderAnimationSamplerData>;
  924. }
  925. /**
  926. * Loader interface with additional members.
  927. */
  928. interface ILoaderAnimation extends IAnimation, IArrayItem {
  929. channels: ILoaderAnimationChannel[];
  930. samplers: ILoaderAnimationSampler[];
  931. /** @hidden */
  932. _babylonAnimationGroup?: AnimationGroup;
  933. }
  934. /**
  935. * Loader interface with additional members.
  936. */
  937. interface ILoaderBuffer extends IBuffer, IArrayItem {
  938. /** @hidden */
  939. _data?: Promise<ArrayBufferView>;
  940. }
  941. /**
  942. * Loader interface with additional members.
  943. */
  944. interface ILoaderBufferView extends IBufferView, IArrayItem {
  945. /** @hidden */
  946. _data?: Promise<ArrayBufferView>;
  947. /** @hidden */
  948. _babylonBuffer?: Promise<Buffer>;
  949. }
  950. /**
  951. * Loader interface with additional members.
  952. */
  953. interface ILoaderCamera extends ICamera, IArrayItem {
  954. }
  955. /**
  956. * Loader interface with additional members.
  957. */
  958. interface ILoaderImage extends IImage, IArrayItem {
  959. /** @hidden */
  960. _data?: Promise<ArrayBufferView>;
  961. }
  962. /**
  963. * Loader interface with additional members.
  964. */
  965. interface ILoaderMaterialNormalTextureInfo extends IMaterialNormalTextureInfo, ILoaderTextureInfo {
  966. }
  967. /**
  968. * Loader interface with additional members.
  969. */
  970. interface ILoaderMaterialOcclusionTextureInfo extends IMaterialOcclusionTextureInfo, ILoaderTextureInfo {
  971. }
  972. /**
  973. * Loader interface with additional members.
  974. */
  975. interface ILoaderMaterialPbrMetallicRoughness extends IMaterialPbrMetallicRoughness {
  976. baseColorTexture?: ILoaderTextureInfo;
  977. metallicRoughnessTexture?: ILoaderTextureInfo;
  978. }
  979. /**
  980. * Loader interface with additional members.
  981. */
  982. interface ILoaderMaterial extends IMaterial, IArrayItem {
  983. pbrMetallicRoughness?: ILoaderMaterialPbrMetallicRoughness;
  984. normalTexture?: ILoaderMaterialNormalTextureInfo;
  985. occlusionTexture?: ILoaderMaterialOcclusionTextureInfo;
  986. emissiveTexture?: ILoaderTextureInfo;
  987. /** @hidden */
  988. _babylonData?: {
  989. [drawMode: number]: {
  990. material: Material;
  991. meshes: AbstractMesh[];
  992. promise: Promise<void>;
  993. };
  994. };
  995. }
  996. /**
  997. * Loader interface with additional members.
  998. */
  999. interface ILoaderMesh extends IMesh, IArrayItem {
  1000. primitives: ILoaderMeshPrimitive[];
  1001. }
  1002. /**
  1003. * Loader interface with additional members.
  1004. */
  1005. interface ILoaderMeshPrimitive extends IMeshPrimitive, IArrayItem {
  1006. }
  1007. /**
  1008. * Loader interface with additional members.
  1009. */
  1010. interface ILoaderNode extends INode, IArrayItem {
  1011. /**
  1012. * The parent glTF node.
  1013. */
  1014. parent?: ILoaderNode;
  1015. /** @hidden */
  1016. _babylonMesh?: Mesh;
  1017. /** @hidden */
  1018. _primitiveBabylonMeshes?: Mesh[];
  1019. /** @hidden */
  1020. _babylonBones?: Bone[];
  1021. /** @hidden */
  1022. _numMorphTargets?: number;
  1023. }
  1024. /** @hidden */
  1025. interface _ILoaderSamplerData {
  1026. noMipMaps: boolean;
  1027. samplingMode: number;
  1028. wrapU: number;
  1029. wrapV: number;
  1030. }
  1031. /**
  1032. * Loader interface with additional members.
  1033. */
  1034. interface ILoaderSampler extends ISampler, IArrayItem {
  1035. /** @hidden */
  1036. _data?: _ILoaderSamplerData;
  1037. }
  1038. /**
  1039. * Loader interface with additional members.
  1040. */
  1041. interface ILoaderScene extends IScene, IArrayItem {
  1042. }
  1043. /**
  1044. * Loader interface with additional members.
  1045. */
  1046. interface ILoaderSkin extends ISkin, IArrayItem {
  1047. /** @hidden */
  1048. _babylonSkeleton?: Skeleton;
  1049. /** @hidden */
  1050. _promise?: Promise<void>;
  1051. }
  1052. /**
  1053. * Loader interface with additional members.
  1054. */
  1055. interface ILoaderTexture extends ITexture, IArrayItem {
  1056. }
  1057. /**
  1058. * Loader interface with additional members.
  1059. */
  1060. interface ILoaderTextureInfo extends ITextureInfo {
  1061. }
  1062. /**
  1063. * Loader interface with additional members.
  1064. */
  1065. interface ILoaderGLTF extends IGLTF {
  1066. accessors?: ILoaderAccessor[];
  1067. animations?: ILoaderAnimation[];
  1068. buffers?: ILoaderBuffer[];
  1069. bufferViews?: ILoaderBufferView[];
  1070. cameras?: ILoaderCamera[];
  1071. images?: ILoaderImage[];
  1072. materials?: ILoaderMaterial[];
  1073. meshes?: ILoaderMesh[];
  1074. nodes?: ILoaderNode[];
  1075. samplers?: ILoaderSampler[];
  1076. scenes?: ILoaderScene[];
  1077. skins?: ILoaderSkin[];
  1078. textures?: ILoaderTexture[];
  1079. }
  1080. }
  1081. /**
  1082. * Defines the module for importing and exporting glTF 2.0 assets
  1083. */
  1084. declare module BABYLON.GLTF2 {
  1085. /**
  1086. * Helper class for working with arrays when loading the glTF asset
  1087. */
  1088. class ArrayItem {
  1089. /**
  1090. * Gets an item from the given array.
  1091. * @param context The context when loading the asset
  1092. * @param array The array to get the item from
  1093. * @param index The index to the array
  1094. * @returns The array item
  1095. */
  1096. static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
  1097. /**
  1098. * Assign an `index` field to each item of the given array.
  1099. * @param array The array of items
  1100. */
  1101. static Assign(array?: IArrayItem[]): void;
  1102. }
  1103. /**
  1104. * The glTF 2.0 loader
  1105. */
  1106. class GLTFLoader implements IGLTFLoader {
  1107. /** The glTF object parsed from the JSON. */
  1108. gltf: ILoaderGLTF;
  1109. /** The Babylon scene when loading the asset. */
  1110. babylonScene: Scene;
  1111. /** @hidden */
  1112. _completePromises: Promise<any>[];
  1113. private _disposed;
  1114. private _parent;
  1115. private _state;
  1116. private _extensions;
  1117. private _rootUrl;
  1118. private _fullName;
  1119. private _rootBabylonMesh;
  1120. private _defaultBabylonMaterialData;
  1121. private _progressCallback?;
  1122. private _requests;
  1123. private static readonly _DefaultSampler;
  1124. private static _ExtensionNames;
  1125. private static _ExtensionFactories;
  1126. /**
  1127. * Registers a loader extension.
  1128. * @param name The name of the loader extension.
  1129. * @param factory The factory function that creates the loader extension.
  1130. */
  1131. static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void;
  1132. /**
  1133. * Unregisters a loader extension.
  1134. * @param name The name of the loader extenion.
  1135. * @returns A boolean indicating whether the extension has been unregistered
  1136. */
  1137. static UnregisterExtension(name: string): boolean;
  1138. /**
  1139. * Gets the loader state.
  1140. */
  1141. readonly state: Nullable<GLTFLoaderState>;
  1142. /** @hidden */
  1143. constructor(parent: GLTFFileLoader);
  1144. /** @hidden */
  1145. dispose(): void;
  1146. /** @hidden */
  1147. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fullName?: string): Promise<{
  1148. meshes: AbstractMesh[];
  1149. particleSystems: IParticleSystem[];
  1150. skeletons: Skeleton[];
  1151. animationGroups: AnimationGroup[];
  1152. }>;
  1153. /** @hidden */
  1154. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fullName?: string): Promise<void>;
  1155. private _loadAsync;
  1156. private _loadData;
  1157. private _setupData;
  1158. private _loadExtensions;
  1159. private _checkExtensions;
  1160. private _setState;
  1161. private _createRootNode;
  1162. /**
  1163. * Loads a glTF scene.
  1164. * @param context The context when loading the asset
  1165. * @param scene The glTF scene property
  1166. * @returns A promise that resolves when the load is complete
  1167. */
  1168. loadSceneAsync(context: string, scene: ILoaderScene): Promise<void>;
  1169. private _forEachPrimitive;
  1170. private _getMeshes;
  1171. private _getSkeletons;
  1172. private _getAnimationGroups;
  1173. private _startAnimations;
  1174. /**
  1175. * Loads a glTF node.
  1176. * @param context The context when loading the asset
  1177. * @param node The glTF node property
  1178. * @param assign A function called synchronously after parsing the glTF properties
  1179. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete
  1180. */
  1181. loadNodeAsync(context: string, node: ILoaderNode, assign?: (babylonMesh: Mesh) => void): Promise<Mesh>;
  1182. private _loadMeshAsync;
  1183. private _loadMeshPrimitiveAsync;
  1184. private _loadVertexDataAsync;
  1185. private _createMorphTargets;
  1186. private _loadMorphTargetsAsync;
  1187. private _loadMorphTargetVertexDataAsync;
  1188. private static _LoadTransform;
  1189. private _loadSkinAsync;
  1190. private _loadBones;
  1191. private _loadBone;
  1192. private _loadSkinInverseBindMatricesDataAsync;
  1193. private _updateBoneMatrices;
  1194. private _getNodeMatrix;
  1195. /**
  1196. * Loads a glTF camera.
  1197. * @param context The context when loading the asset
  1198. * @param camera The glTF camera property
  1199. * @param assign A function called synchronously after parsing the glTF properties
  1200. * @returns A promise that resolves with the loaded Babylon camera when the load is complete
  1201. */
  1202. loadCameraAsync(context: string, camera: ILoaderCamera, assign?: (babylonCamera: Camera) => void): Promise<Camera>;
  1203. private _loadAnimationsAsync;
  1204. /**
  1205. * Loads a glTF animation.
  1206. * @param context The context when loading the asset
  1207. * @param animation The glTF animation property
  1208. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete
  1209. */
  1210. loadAnimationAsync(context: string, animation: ILoaderAnimation): Promise<AnimationGroup>;
  1211. private _loadAnimationChannelAsync;
  1212. private _loadAnimationSamplerAsync;
  1213. private _loadBufferAsync;
  1214. /**
  1215. * Loads a glTF buffer view.
  1216. * @param context The context when loading the asset
  1217. * @param bufferView The glTF buffer view property
  1218. * @returns A promise that resolves with the loaded data when the load is complete
  1219. */
  1220. loadBufferViewAsync(context: string, bufferView: ILoaderBufferView): Promise<ArrayBufferView>;
  1221. private _loadIndicesAccessorAsync;
  1222. private _loadFloatAccessorAsync;
  1223. private _loadVertexBufferViewAsync;
  1224. private _loadVertexAccessorAsync;
  1225. private _loadMaterialMetallicRoughnessPropertiesAsync;
  1226. /** @hidden */
  1227. _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign?: (babylonMaterial: Material) => void): Promise<Material>;
  1228. private _createDefaultMaterial;
  1229. /**
  1230. * Creates a Babylon material from a glTF material.
  1231. * @param context The context when loading the asset
  1232. * @param material The glTF material property
  1233. * @param babylonDrawMode The draw mode for the Babylon material
  1234. * @returns The Babylon material
  1235. */
  1236. createMaterial(context: string, material: ILoaderMaterial, babylonDrawMode: number): Material;
  1237. /**
  1238. * Loads properties from a glTF material into a Babylon material.
  1239. * @param context The context when loading the asset
  1240. * @param material The glTF material property
  1241. * @param babylonMaterial The Babylon material
  1242. * @returns A promise that resolves when the load is complete
  1243. */
  1244. loadMaterialPropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Promise<void>;
  1245. /**
  1246. * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
  1247. * @param context The context when loading the asset
  1248. * @param material The glTF material property
  1249. * @param babylonMaterial The Babylon material
  1250. * @returns A promise that resolves when the load is complete
  1251. */
  1252. loadMaterialBasePropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Promise<void>;
  1253. /**
  1254. * Loads the alpha properties from a glTF material into a Babylon material.
  1255. * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.
  1256. * @param context The context when loading the asset
  1257. * @param material The glTF material property
  1258. * @param babylonMaterial The Babylon material
  1259. */
  1260. loadMaterialAlphaProperties(context: string, material: ILoaderMaterial, babylonMaterial: Material): void;
  1261. /**
  1262. * Loads a glTF texture info.
  1263. * @param context The context when loading the asset
  1264. * @param textureInfo The glTF texture info property
  1265. * @param assign A function called synchronously after parsing the glTF properties
  1266. * @returns A promise that resolves with the loaded Babylon texture when the load is complete
  1267. */
  1268. loadTextureInfoAsync(context: string, textureInfo: ILoaderTextureInfo, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
  1269. private _loadTextureAsync;
  1270. private _loadSampler;
  1271. /**
  1272. * Loads a glTF image.
  1273. * @param context The context when loading the asset
  1274. * @param image The glTF image property
  1275. * @returns A promise that resolves with the loaded data when the load is complete
  1276. */
  1277. loadImageAsync(context: string, image: ILoaderImage): Promise<ArrayBufferView>;
  1278. /**
  1279. * Loads a glTF uri.
  1280. * @param context The context when loading the asset
  1281. * @param uri The base64 or relative uri
  1282. * @returns A promise that resolves with the loaded data when the load is complete
  1283. */
  1284. loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
  1285. private _onProgress;
  1286. private static _GetTextureWrapMode;
  1287. private static _GetTextureSamplingMode;
  1288. private static _GetTypedArray;
  1289. private static _GetNumComponents;
  1290. private static _ValidateUri;
  1291. private static _GetDrawMode;
  1292. private _compileMaterialsAsync;
  1293. private _compileShadowGeneratorsAsync;
  1294. private _forEachExtensions;
  1295. private _applyExtensions;
  1296. private _extensionsOnLoading;
  1297. private _extensionsOnReady;
  1298. private _extensionsLoadSceneAsync;
  1299. private _extensionsLoadNodeAsync;
  1300. private _extensionsLoadCameraAsync;
  1301. private _extensionsLoadVertexDataAsync;
  1302. private _extensionsLoadMaterialAsync;
  1303. private _extensionsCreateMaterial;
  1304. private _extensionsLoadMaterialPropertiesAsync;
  1305. private _extensionsLoadTextureInfoAsync;
  1306. private _extensionsLoadAnimationAsync;
  1307. private _extensionsLoadUriAsync;
  1308. /**
  1309. * Helper method called by a loader extension to load an glTF extension.
  1310. * @param context The context when loading the asset
  1311. * @param property The glTF property to load the extension from
  1312. * @param extensionName The name of the extension to load
  1313. * @param actionAsync The action to run
  1314. * @returns The promise returned by actionAsync or null if the extension does not exist
  1315. */
  1316. static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  1317. /**
  1318. * Helper method called by a loader extension to load a glTF extra.
  1319. * @param context The context when loading the asset
  1320. * @param property The glTF property to load the extra from
  1321. * @param extensionName The name of the extension to load
  1322. * @param actionAsync The action to run
  1323. * @returns The promise returned by actionAsync or null if the extra does not exist
  1324. */
  1325. static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  1326. /**
  1327. * Increments the indentation level and logs a message.
  1328. * @param message The message to log
  1329. */
  1330. logOpen(message: string): void;
  1331. /**
  1332. * Decrements the indentation level.
  1333. */
  1334. logClose(): void;
  1335. /**
  1336. * Logs a message
  1337. * @param message The message to log
  1338. */
  1339. log(message: string): void;
  1340. /**
  1341. * Starts a performance counter.
  1342. * @param counterName The name of the performance counter
  1343. */
  1344. startPerformanceCounter(counterName: string): void;
  1345. /**
  1346. * Ends a performance counter.
  1347. * @param counterName The name of the performance counter
  1348. */
  1349. endPerformanceCounter(counterName: string): void;
  1350. }
  1351. }
  1352. declare module BABYLON.GLTF2 {
  1353. /**
  1354. * Interface for a glTF loader extension.
  1355. */
  1356. interface IGLTFLoaderExtension extends BABYLON.IGLTFLoaderExtension, IDisposable {
  1357. /**
  1358. * Called after the loader state changes to LOADING.
  1359. */
  1360. onLoading?(): void;
  1361. /**
  1362. * Called after the loader state changes to READY.
  1363. */
  1364. onReady?(): void;
  1365. /**
  1366. * Define this method to modify the default behavior when loading scenes.
  1367. * @param context The context when loading the asset
  1368. * @param scene The glTF scene property
  1369. * @returns A promise that resolves when the load is complete or null if not handled
  1370. */
  1371. loadSceneAsync?(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1372. /**
  1373. * Define this method to modify the default behavior when loading nodes.
  1374. * @param context The context when loading the asset
  1375. * @param node The glTF node property
  1376. * @param assign A function called synchronously after parsing the glTF properties
  1377. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete or null if not handled
  1378. */
  1379. loadNodeAsync?(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1380. /**
  1381. * Define this method to modify the default behavior when loading cameras.
  1382. * @param context The context when loading the asset
  1383. * @param camera The glTF camera property
  1384. * @param assign A function called synchronously after parsing the glTF properties
  1385. * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
  1386. */
  1387. loadCameraAsync?(context: string, camera: ILoaderCamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
  1388. /**
  1389. * @hidden Define this method to modify the default behavior when loading vertex data for mesh primitives.
  1390. * @param context The context when loading the asset
  1391. * @param primitive The glTF mesh primitive property
  1392. * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled
  1393. */
  1394. _loadVertexDataAsync?(context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1395. /**
  1396. * @hidden Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.
  1397. * @param context The context when loading the asset
  1398. * @param material The glTF material property
  1399. * @param assign A function called synchronously after parsing the glTF properties
  1400. * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled
  1401. */
  1402. _loadMaterialAsync?(context: string, material: ILoaderMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  1403. /**
  1404. * Define this method to modify the default behavior when creating materials.
  1405. * @param context The context when loading the asset
  1406. * @param material The glTF material property
  1407. * @param babylonDrawMode The draw mode for the Babylon material
  1408. * @returns The Babylon material or null if not handled
  1409. */
  1410. createMaterial?(context: string, material: ILoaderMaterial, babylonDrawMode: number): Nullable<Material>;
  1411. /**
  1412. * Define this method to modify the default behavior when loading material properties.
  1413. * @param context The context when loading the asset
  1414. * @param material The glTF material property
  1415. * @param babylonMaterial The Babylon material
  1416. * @returns A promise that resolves when the load is complete or null if not handled
  1417. */
  1418. loadMaterialPropertiesAsync?(context: string, material: ILoaderMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1419. /**
  1420. * Define this method to modify the default behavior when loading texture infos.
  1421. * @param context The context when loading the asset
  1422. * @param textureInfo The glTF texture info property
  1423. * @param assign A function called synchronously after parsing the glTF properties
  1424. * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
  1425. */
  1426. loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1427. /**
  1428. * Define this method to modify the default behavior when loading animations.
  1429. * @param context The context when loading the asset
  1430. * @param animation The glTF animation property
  1431. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
  1432. */
  1433. loadAnimationAsync?(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
  1434. /**
  1435. * Define this method to modify the default behavior when loading uris.
  1436. * @param context The context when loading the asset
  1437. * @param uri The uri to load
  1438. * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
  1439. */
  1440. _loadUriAsync?(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1441. }
  1442. }
  1443. /**
  1444. * Defines the module for the built-in glTF 2.0 loader extensions.
  1445. */
  1446. declare module BABYLON.GLTF2.Extensions {
  1447. }
  1448. declare module BABYLON.GLTF2.Extensions {
  1449. /**
  1450. * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
  1451. */
  1452. class MSFT_audio_emitter implements IGLTFLoaderExtension {
  1453. /** The name of this extension. */
  1454. readonly name: string;
  1455. /** Defines whether this extension is enabled. */
  1456. enabled: boolean;
  1457. private _loader;
  1458. private _clips;
  1459. private _emitters;
  1460. /** @hidden */
  1461. constructor(loader: GLTFLoader);
  1462. /** @hidden */
  1463. dispose(): void;
  1464. /** @hidden */
  1465. onLoading(): void;
  1466. /** @hidden */
  1467. loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1468. /** @hidden */
  1469. loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1470. /** @hidden */
  1471. loadAnimationAsync(context: string, animation: ILoaderAnimation): Nullable<Promise<AnimationGroup>>;
  1472. private _loadClipAsync;
  1473. private _loadEmitterAsync;
  1474. private _getEventAction;
  1475. private _loadAnimationEventAsync;
  1476. }
  1477. }
  1478. declare module BABYLON.GLTF2.Extensions {
  1479. /**
  1480. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
  1481. */
  1482. class MSFT_lod implements IGLTFLoaderExtension {
  1483. /** The name of this extension. */
  1484. readonly name: string;
  1485. /** Defines whether this extension is enabled. */
  1486. enabled: boolean;
  1487. /**
  1488. * Maximum number of LODs to load, starting from the lowest LOD.
  1489. */
  1490. maxLODsToLoad: number;
  1491. /**
  1492. * Observable raised when all node LODs of one level are loaded.
  1493. * The event data is the index of the loaded LOD starting from zero.
  1494. * Dispose the loader to cancel the loading of the next level of LODs.
  1495. */
  1496. onNodeLODsLoadedObservable: Observable<number>;
  1497. /**
  1498. * Observable raised when all material LODs of one level are loaded.
  1499. * The event data is the index of the loaded LOD starting from zero.
  1500. * Dispose the loader to cancel the loading of the next level of LODs.
  1501. */
  1502. onMaterialLODsLoadedObservable: Observable<number>;
  1503. private _loader;
  1504. private _nodeIndexLOD;
  1505. private _nodeSignalLODs;
  1506. private _nodePromiseLODs;
  1507. private _materialIndexLOD;
  1508. private _materialSignalLODs;
  1509. private _materialPromiseLODs;
  1510. /** @hidden */
  1511. constructor(loader: GLTFLoader);
  1512. /** @hidden */
  1513. dispose(): void;
  1514. /** @hidden */
  1515. onReady(): void;
  1516. /** @hidden */
  1517. loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1518. /** @hidden */
  1519. _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  1520. /** @hidden */
  1521. _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1522. /**
  1523. * Gets an array of LOD properties from lowest to highest.
  1524. */
  1525. private _getLODs;
  1526. private _disposeUnusedMaterials;
  1527. }
  1528. }
  1529. declare module BABYLON.GLTF2.Extensions {
  1530. /** @hidden */
  1531. class MSFT_minecraftMesh implements IGLTFLoaderExtension {
  1532. readonly name: string;
  1533. enabled: boolean;
  1534. private _loader;
  1535. constructor(loader: GLTFLoader);
  1536. dispose(): void;
  1537. loadMaterialPropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1538. }
  1539. }
  1540. declare module BABYLON.GLTF2.Extensions {
  1541. /** @hidden */
  1542. class MSFT_sRGBFactors implements IGLTFLoaderExtension {
  1543. readonly name: string;
  1544. enabled: boolean;
  1545. private _loader;
  1546. constructor(loader: GLTFLoader);
  1547. dispose(): void;
  1548. loadMaterialPropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1549. }
  1550. }
  1551. declare module BABYLON.GLTF2.Extensions {
  1552. /**
  1553. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
  1554. */
  1555. class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
  1556. /** The name of this extension. */
  1557. readonly name: string;
  1558. /** Defines whether this extension is enabled. */
  1559. enabled: boolean;
  1560. private _loader;
  1561. private _dracoCompression?;
  1562. /** @hidden */
  1563. constructor(loader: GLTFLoader);
  1564. /** @hidden */
  1565. dispose(): void;
  1566. /** @hidden */
  1567. _loadVertexDataAsync(context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1568. }
  1569. }
  1570. declare module BABYLON.GLTF2.Extensions {
  1571. /**
  1572. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
  1573. */
  1574. class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension {
  1575. /** The name of this extension. */
  1576. readonly name: string;
  1577. /** Defines whether this extension is enabled. */
  1578. enabled: boolean;
  1579. private _loader;
  1580. /** @hidden */
  1581. constructor(loader: GLTFLoader);
  1582. /** @hidden */
  1583. dispose(): void;
  1584. /** @hidden */
  1585. loadMaterialPropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1586. private _loadSpecularGlossinessPropertiesAsync;
  1587. }
  1588. }
  1589. declare module BABYLON.GLTF2.Extensions {
  1590. /**
  1591. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
  1592. */
  1593. class KHR_materials_unlit implements IGLTFLoaderExtension {
  1594. /** The name of this extension. */
  1595. readonly name: string;
  1596. /** Defines whether this extension is enabled. */
  1597. enabled: boolean;
  1598. private _loader;
  1599. /** @hidden */
  1600. constructor(loader: GLTFLoader);
  1601. /** @hidden */
  1602. dispose(): void;
  1603. /** @hidden */
  1604. loadMaterialPropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1605. private _loadUnlitPropertiesAsync;
  1606. }
  1607. }
  1608. declare module BABYLON.GLTF2.Extensions {
  1609. /**
  1610. * [Specification](https://github.com/MiiBond/glTF/tree/khr_lights_v1/extensions/Khronos/KHR_lights) (Experimental)
  1611. */
  1612. class KHR_lights implements IGLTFLoaderExtension {
  1613. /** The name of this extension. */
  1614. readonly name: string;
  1615. /** Defines whether this extension is enabled. */
  1616. enabled: boolean;
  1617. private _loader;
  1618. private _lights?;
  1619. /** @hidden */
  1620. constructor(loader: GLTFLoader);
  1621. /** @hidden */
  1622. dispose(): void;
  1623. /** @hidden */
  1624. onLoading(): void;
  1625. /** @hidden */
  1626. loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1627. /** @hidden */
  1628. loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1629. }
  1630. }
  1631. declare module BABYLON.GLTF2.Extensions {
  1632. /**
  1633. * [Specification](https://github.com/AltspaceVR/glTF/blob/avr-sampler-offset-tile/extensions/2.0/Khronos/KHR_texture_transform/README.md) (Experimental)
  1634. */
  1635. class KHR_texture_transform implements IGLTFLoaderExtension {
  1636. /** The name of this extension. */
  1637. readonly name: string;
  1638. /** Defines whether this extension is enabled. */
  1639. enabled: boolean;
  1640. private _loader;
  1641. /** @hidden */
  1642. constructor(loader: GLTFLoader);
  1643. /** @hidden */
  1644. dispose(): void;
  1645. /** @hidden */
  1646. loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1647. }
  1648. }
  1649. declare module BABYLON.GLTF2.Extensions {
  1650. /**
  1651. * [Specification](TODO) (Experimental)
  1652. */
  1653. class EXT_lights_imageBased implements IGLTFLoaderExtension {
  1654. /** The name of this extension. */
  1655. readonly name: string;
  1656. /** Defines whether this extension is enabled. */
  1657. enabled: boolean;
  1658. private _loader;
  1659. private _lights?;
  1660. /** @hidden */
  1661. constructor(loader: GLTFLoader);
  1662. /** @hidden */
  1663. dispose(): void;
  1664. /** @hidden */
  1665. onLoading(): void;
  1666. /** @hidden */
  1667. loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
  1668. private _loadLightAsync;
  1669. }
  1670. }