babylon.glTFFileLoader.d.ts 66 KB

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