babylon.glTFFileLoader.d.ts 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735
  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. /**
  1306. * Adds a JSON pointer to the metadata of the Babylon object at `<object>.metadata.gltf.pointers`.
  1307. * @param babylonObject the Babylon object with metadata
  1308. * @param pointer the JSON pointer
  1309. */
  1310. static AddPointerMetadata(babylonObject: {
  1311. metadata: any;
  1312. }, pointer: string): void;
  1313. private static _GetTextureWrapMode;
  1314. private static _GetTextureSamplingMode;
  1315. private static _GetTypedArray;
  1316. private static _GetNumComponents;
  1317. private static _ValidateUri;
  1318. private static _GetDrawMode;
  1319. private _compileMaterialsAsync;
  1320. private _compileShadowGeneratorsAsync;
  1321. private _forEachExtensions;
  1322. private _applyExtensions;
  1323. private _extensionsOnLoading;
  1324. private _extensionsOnReady;
  1325. private _extensionsLoadSceneAsync;
  1326. private _extensionsLoadNodeAsync;
  1327. private _extensionsLoadCameraAsync;
  1328. private _extensionsLoadVertexDataAsync;
  1329. private _extensionsLoadMaterialAsync;
  1330. private _extensionsCreateMaterial;
  1331. private _extensionsLoadMaterialPropertiesAsync;
  1332. private _extensionsLoadTextureInfoAsync;
  1333. private _extensionsLoadAnimationAsync;
  1334. private _extensionsLoadUriAsync;
  1335. /**
  1336. * Helper method called by a loader extension to load an glTF extension.
  1337. * @param context The context when loading the asset
  1338. * @param property The glTF property to load the extension from
  1339. * @param extensionName The name of the extension to load
  1340. * @param actionAsync The action to run
  1341. * @returns The promise returned by actionAsync or null if the extension does not exist
  1342. */
  1343. static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  1344. /**
  1345. * Helper method called by a loader extension to load a glTF extra.
  1346. * @param context The context when loading the asset
  1347. * @param property The glTF property to load the extra from
  1348. * @param extensionName The name of the extension to load
  1349. * @param actionAsync The action to run
  1350. * @returns The promise returned by actionAsync or null if the extra does not exist
  1351. */
  1352. static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  1353. /**
  1354. * Increments the indentation level and logs a message.
  1355. * @param message The message to log
  1356. */
  1357. logOpen(message: string): void;
  1358. /**
  1359. * Decrements the indentation level.
  1360. */
  1361. logClose(): void;
  1362. /**
  1363. * Logs a message
  1364. * @param message The message to log
  1365. */
  1366. log(message: string): void;
  1367. /**
  1368. * Starts a performance counter.
  1369. * @param counterName The name of the performance counter
  1370. */
  1371. startPerformanceCounter(counterName: string): void;
  1372. /**
  1373. * Ends a performance counter.
  1374. * @param counterName The name of the performance counter
  1375. */
  1376. endPerformanceCounter(counterName: string): void;
  1377. }
  1378. }
  1379. declare module BABYLON.GLTF2 {
  1380. /**
  1381. * Interface for a glTF loader extension.
  1382. */
  1383. interface IGLTFLoaderExtension extends BABYLON.IGLTFLoaderExtension, IDisposable {
  1384. /**
  1385. * Called after the loader state changes to LOADING.
  1386. */
  1387. onLoading?(): void;
  1388. /**
  1389. * Called after the loader state changes to READY.
  1390. */
  1391. onReady?(): void;
  1392. /**
  1393. * Define this method to modify the default behavior when loading scenes.
  1394. * @param context The context when loading the asset
  1395. * @param scene The glTF scene property
  1396. * @returns A promise that resolves when the load is complete or null if not handled
  1397. */
  1398. loadSceneAsync?(context: string, scene: Loader.IScene): Nullable<Promise<void>>;
  1399. /**
  1400. * Define this method to modify the default behavior when loading nodes.
  1401. * @param context The context when loading the asset
  1402. * @param node The glTF node property
  1403. * @param assign A function called synchronously after parsing the glTF properties
  1404. * @returns A promise that resolves with the loaded Babylon transform node when the load is complete or null if not handled
  1405. */
  1406. loadNodeAsync?(context: string, node: Loader.INode, assign: (babylonMesh: TransformNode) => void): Nullable<Promise<TransformNode>>;
  1407. /**
  1408. * Define this method to modify the default behavior when loading cameras.
  1409. * @param context The context when loading the asset
  1410. * @param camera The glTF camera property
  1411. * @param assign A function called synchronously after parsing the glTF properties
  1412. * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
  1413. */
  1414. loadCameraAsync?(context: string, camera: Loader.ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
  1415. /**
  1416. * @hidden Define this method to modify the default behavior when loading vertex data for mesh primitives.
  1417. * @param context The context when loading the asset
  1418. * @param primitive The glTF mesh primitive property
  1419. * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled
  1420. */
  1421. _loadVertexDataAsync?(context: string, primitive: Loader.IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1422. /**
  1423. * @hidden Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.
  1424. * @param context The context when loading the asset
  1425. * @param material The glTF material property
  1426. * @param assign A function called synchronously after parsing the glTF properties
  1427. * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled
  1428. */
  1429. _loadMaterialAsync?(context: string, material: Loader.IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  1430. /**
  1431. * Define this method to modify the default behavior when creating materials.
  1432. * @param context The context when loading the asset
  1433. * @param material The glTF material property
  1434. * @param babylonDrawMode The draw mode for the Babylon material
  1435. * @returns The Babylon material or null if not handled
  1436. */
  1437. createMaterial?(context: string, material: Loader.IMaterial, babylonDrawMode: number): Nullable<Material>;
  1438. /**
  1439. * Define this method to modify the default behavior when loading material properties.
  1440. * @param context The context when loading the asset
  1441. * @param material The glTF material property
  1442. * @param babylonMaterial The Babylon material
  1443. * @returns A promise that resolves when the load is complete or null if not handled
  1444. */
  1445. loadMaterialPropertiesAsync?(context: string, material: Loader.IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1446. /**
  1447. * Define this method to modify the default behavior when loading texture infos.
  1448. * @param context The context when loading the asset
  1449. * @param textureInfo The glTF texture info property
  1450. * @param assign A function called synchronously after parsing the glTF properties
  1451. * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
  1452. */
  1453. loadTextureInfoAsync?(context: string, textureInfo: Loader.ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1454. /**
  1455. * Define this method to modify the default behavior when loading animations.
  1456. * @param context The context when loading the asset
  1457. * @param animation The glTF animation property
  1458. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
  1459. */
  1460. loadAnimationAsync?(context: string, animation: Loader.IAnimation): Nullable<Promise<AnimationGroup>>;
  1461. /**
  1462. * Define this method to modify the default behavior when loading uris.
  1463. * @param context The context when loading the asset
  1464. * @param uri The uri to load
  1465. * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
  1466. */
  1467. _loadUriAsync?(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1468. }
  1469. }
  1470. /**
  1471. * Defines the module for the built-in glTF 2.0 loader extensions.
  1472. */
  1473. declare module BABYLON.GLTF2.Loader.Extensions {
  1474. }
  1475. declare module BABYLON.GLTF2.Loader.Extensions {
  1476. /**
  1477. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
  1478. */
  1479. class MSFT_lod implements IGLTFLoaderExtension {
  1480. /** The name of this extension. */
  1481. readonly name: string;
  1482. /** Defines whether this extension is enabled. */
  1483. enabled: boolean;
  1484. /**
  1485. * Maximum number of LODs to load, starting from the lowest LOD.
  1486. */
  1487. maxLODsToLoad: number;
  1488. /**
  1489. * Observable raised when all node LODs of one level are loaded.
  1490. * The event data is the index of the loaded LOD starting from zero.
  1491. * Dispose the loader to cancel the loading of the next level of LODs.
  1492. */
  1493. onNodeLODsLoadedObservable: Observable<number>;
  1494. /**
  1495. * Observable raised when all material LODs of one level are loaded.
  1496. * The event data is the index of the loaded LOD starting from zero.
  1497. * Dispose the loader to cancel the loading of the next level of LODs.
  1498. */
  1499. onMaterialLODsLoadedObservable: Observable<number>;
  1500. private _loader;
  1501. private _nodeIndexLOD;
  1502. private _nodeSignalLODs;
  1503. private _nodePromiseLODs;
  1504. private _materialIndexLOD;
  1505. private _materialSignalLODs;
  1506. private _materialPromiseLODs;
  1507. /** @hidden */
  1508. constructor(loader: GLTFLoader);
  1509. /** @hidden */
  1510. dispose(): void;
  1511. /** @hidden */
  1512. onReady(): void;
  1513. /** @hidden */
  1514. loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
  1515. /** @hidden */
  1516. _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  1517. /** @hidden */
  1518. _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1519. /**
  1520. * Gets an array of LOD properties from lowest to highest.
  1521. */
  1522. private _getLODs;
  1523. private _disposeUnusedMaterials;
  1524. }
  1525. }
  1526. declare module BABYLON.GLTF2.Loader.Extensions {
  1527. /** @hidden */
  1528. class MSFT_minecraftMesh implements IGLTFLoaderExtension {
  1529. readonly name: string;
  1530. enabled: boolean;
  1531. private _loader;
  1532. constructor(loader: GLTFLoader);
  1533. dispose(): void;
  1534. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1535. }
  1536. }
  1537. declare module BABYLON.GLTF2.Loader.Extensions {
  1538. /** @hidden */
  1539. class MSFT_sRGBFactors implements IGLTFLoaderExtension {
  1540. readonly name: string;
  1541. enabled: boolean;
  1542. private _loader;
  1543. constructor(loader: GLTFLoader);
  1544. dispose(): void;
  1545. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1546. }
  1547. }
  1548. declare module BABYLON.GLTF2.Loader.Extensions {
  1549. /**
  1550. * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
  1551. */
  1552. class MSFT_audio_emitter implements IGLTFLoaderExtension {
  1553. /** The name of this extension. */
  1554. readonly name: string;
  1555. /** Defines whether this extension is enabled. */
  1556. enabled: boolean;
  1557. private _loader;
  1558. private _clips;
  1559. private _emitters;
  1560. /** @hidden */
  1561. constructor(loader: GLTFLoader);
  1562. /** @hidden */
  1563. dispose(): void;
  1564. /** @hidden */
  1565. onLoading(): void;
  1566. /** @hidden */
  1567. loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
  1568. /** @hidden */
  1569. loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
  1570. /** @hidden */
  1571. loadAnimationAsync(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
  1572. private _loadClipAsync;
  1573. private _loadEmitterAsync;
  1574. private _getEventAction;
  1575. private _loadAnimationEventAsync;
  1576. }
  1577. }
  1578. declare module BABYLON.GLTF2.Loader.Extensions {
  1579. /**
  1580. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
  1581. */
  1582. class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
  1583. /** The name of this extension. */
  1584. readonly name: string;
  1585. /** Defines whether this extension is enabled. */
  1586. enabled: boolean;
  1587. private _loader;
  1588. private _dracoCompression?;
  1589. /** @hidden */
  1590. constructor(loader: GLTFLoader);
  1591. /** @hidden */
  1592. dispose(): void;
  1593. /** @hidden */
  1594. _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1595. }
  1596. }
  1597. declare module BABYLON.GLTF2.Loader.Extensions {
  1598. /**
  1599. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
  1600. */
  1601. class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension {
  1602. /** The name of this extension. */
  1603. readonly name: string;
  1604. /** Defines whether this extension is enabled. */
  1605. enabled: boolean;
  1606. private _loader;
  1607. /** @hidden */
  1608. constructor(loader: GLTFLoader);
  1609. /** @hidden */
  1610. dispose(): void;
  1611. /** @hidden */
  1612. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1613. private _loadSpecularGlossinessPropertiesAsync;
  1614. }
  1615. }
  1616. declare module BABYLON.GLTF2.Loader.Extensions {
  1617. /**
  1618. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
  1619. */
  1620. class KHR_materials_unlit implements IGLTFLoaderExtension {
  1621. /** The name of this extension. */
  1622. readonly name: string;
  1623. /** Defines whether this extension is enabled. */
  1624. enabled: boolean;
  1625. private _loader;
  1626. /** @hidden */
  1627. constructor(loader: GLTFLoader);
  1628. /** @hidden */
  1629. dispose(): void;
  1630. /** @hidden */
  1631. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1632. private _loadUnlitPropertiesAsync;
  1633. }
  1634. }
  1635. declare module BABYLON.GLTF2.Loader.Extensions {
  1636. /**
  1637. * [Specification](https://github.com/KhronosGroup/glTF/blob/1048d162a44dbcb05aefc1874bfd423cf60135a6/extensions/2.0/Khronos/KHR_lights_punctual/README.md) (Experimental)
  1638. */
  1639. class KHR_lights implements IGLTFLoaderExtension {
  1640. /** The name of this extension. */
  1641. readonly name: string;
  1642. /** Defines whether this extension is enabled. */
  1643. enabled: boolean;
  1644. private _loader;
  1645. private _lights?;
  1646. /** @hidden */
  1647. constructor(loader: GLTFLoader);
  1648. /** @hidden */
  1649. dispose(): void;
  1650. /** @hidden */
  1651. onLoading(): void;
  1652. /** @hidden */
  1653. loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
  1654. }
  1655. }
  1656. declare module BABYLON.GLTF2.Loader.Extensions {
  1657. /**
  1658. * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform/README.md)
  1659. */
  1660. class KHR_texture_transform implements IGLTFLoaderExtension {
  1661. /** The name of this extension. */
  1662. readonly name: string;
  1663. /** Defines whether this extension is enabled. */
  1664. enabled: boolean;
  1665. private _loader;
  1666. /** @hidden */
  1667. constructor(loader: GLTFLoader);
  1668. /** @hidden */
  1669. dispose(): void;
  1670. /** @hidden */
  1671. loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1672. }
  1673. }
  1674. declare module BABYLON.GLTF2.Loader.Extensions {
  1675. /**
  1676. * [Specification](https://github.com/KhronosGroup/glTF/blob/eb3e32332042e04691a5f35103f8c261e50d8f1e/extensions/2.0/Khronos/EXT_lights_image_based/README.md) (Experimental)
  1677. */
  1678. class EXT_lights_image_based implements IGLTFLoaderExtension {
  1679. /** The name of this extension. */
  1680. readonly name: string;
  1681. /** Defines whether this extension is enabled. */
  1682. enabled: boolean;
  1683. private _loader;
  1684. private _lights?;
  1685. /** @hidden */
  1686. constructor(loader: GLTFLoader);
  1687. /** @hidden */
  1688. dispose(): void;
  1689. /** @hidden */
  1690. onLoading(): void;
  1691. /** @hidden */
  1692. loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
  1693. private _loadLightAsync;
  1694. }
  1695. }