babylon.glTFFileLoader.d.ts 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721
  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. _babylonData?: {
  1001. [drawMode: number]: {
  1002. material: Material;
  1003. meshes: 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. }
  1019. /**
  1020. * Loader interface with additional members.
  1021. */
  1022. interface INode extends GLTF2.INode, IArrayItem {
  1023. /**
  1024. * The parent glTF node.
  1025. */
  1026. parent?: INode;
  1027. /** @hidden */
  1028. _babylonMesh?: Mesh;
  1029. /** @hidden */
  1030. _primitiveBabylonMeshes?: Mesh[];
  1031. /** @hidden */
  1032. _babylonBones?: Bone[];
  1033. /** @hidden */
  1034. _numMorphTargets?: number;
  1035. }
  1036. /** @hidden */
  1037. interface _ISamplerData {
  1038. noMipMaps: boolean;
  1039. samplingMode: number;
  1040. wrapU: number;
  1041. wrapV: number;
  1042. }
  1043. /**
  1044. * Loader interface with additional members.
  1045. */
  1046. interface ISampler extends GLTF2.ISampler, IArrayItem {
  1047. /** @hidden */
  1048. _data?: _ISamplerData;
  1049. }
  1050. /**
  1051. * Loader interface with additional members.
  1052. */
  1053. interface IScene extends GLTF2.IScene, IArrayItem {
  1054. }
  1055. /**
  1056. * Loader interface with additional members.
  1057. */
  1058. interface ISkin extends GLTF2.ISkin, IArrayItem {
  1059. /** @hidden */
  1060. _babylonSkeleton?: Skeleton;
  1061. /** @hidden */
  1062. _promise?: Promise<void>;
  1063. }
  1064. /**
  1065. * Loader interface with additional members.
  1066. */
  1067. interface ITexture extends GLTF2.ITexture, IArrayItem {
  1068. }
  1069. /**
  1070. * Loader interface with additional members.
  1071. */
  1072. interface ITextureInfo extends GLTF2.ITextureInfo {
  1073. }
  1074. /**
  1075. * Loader interface with additional members.
  1076. */
  1077. interface IGLTF extends GLTF2.IGLTF {
  1078. accessors?: IAccessor[];
  1079. animations?: IAnimation[];
  1080. buffers?: IBuffer[];
  1081. bufferViews?: IBufferView[];
  1082. cameras?: ICamera[];
  1083. images?: IImage[];
  1084. materials?: IMaterial[];
  1085. meshes?: IMesh[];
  1086. nodes?: INode[];
  1087. samplers?: ISampler[];
  1088. scenes?: IScene[];
  1089. skins?: ISkin[];
  1090. textures?: ITexture[];
  1091. }
  1092. }
  1093. /**
  1094. * Defines the module for importing and exporting glTF 2.0 assets
  1095. */
  1096. declare module BABYLON.GLTF2 {
  1097. /**
  1098. * Helper class for working with arrays when loading the glTF asset
  1099. */
  1100. class ArrayItem {
  1101. /**
  1102. * Gets an item from the given array.
  1103. * @param context The context when loading the asset
  1104. * @param array The array to get the item from
  1105. * @param index The index to the array
  1106. * @returns The array item
  1107. */
  1108. static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
  1109. /**
  1110. * Assign an `index` field to each item of the given array.
  1111. * @param array The array of items
  1112. */
  1113. static Assign(array?: Loader.IArrayItem[]): void;
  1114. }
  1115. /**
  1116. * The glTF 2.0 loader
  1117. */
  1118. class GLTFLoader implements IGLTFLoader {
  1119. /** The glTF object parsed from the JSON. */
  1120. gltf: Loader.IGLTF;
  1121. /** The Babylon scene when loading the asset. */
  1122. babylonScene: Scene;
  1123. /** @hidden */
  1124. _completePromises: Promise<any>[];
  1125. private _disposed;
  1126. private _parent;
  1127. private _state;
  1128. private _extensions;
  1129. private _rootUrl;
  1130. private _fileName;
  1131. private _uniqueRootUrl;
  1132. private _rootBabylonMesh;
  1133. private _defaultBabylonMaterialData;
  1134. private _progressCallback?;
  1135. private _requests;
  1136. private static readonly _DefaultSampler;
  1137. private static _ExtensionNames;
  1138. private static _ExtensionFactories;
  1139. /**
  1140. * Registers a loader extension.
  1141. * @param name The name of the loader extension.
  1142. * @param factory The factory function that creates the loader extension.
  1143. */
  1144. static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void;
  1145. /**
  1146. * Unregisters a loader extension.
  1147. * @param name The name of the loader extenion.
  1148. * @returns A boolean indicating whether the extension has been unregistered
  1149. */
  1150. static UnregisterExtension(name: string): boolean;
  1151. /**
  1152. * Gets the loader state.
  1153. */
  1154. readonly state: Nullable<GLTFLoaderState>;
  1155. /** @hidden */
  1156. constructor(parent: GLTFFileLoader);
  1157. /** @hidden */
  1158. dispose(): void;
  1159. /** @hidden */
  1160. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  1161. meshes: AbstractMesh[];
  1162. particleSystems: IParticleSystem[];
  1163. skeletons: Skeleton[];
  1164. animationGroups: AnimationGroup[];
  1165. }>;
  1166. /** @hidden */
  1167. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  1168. private _loadAsync;
  1169. private _loadData;
  1170. private _setupData;
  1171. private _loadExtensions;
  1172. private _checkExtensions;
  1173. private _setState;
  1174. private _createRootNode;
  1175. /**
  1176. * Loads a glTF scene.
  1177. * @param context The context when loading the asset
  1178. * @param scene The glTF scene property
  1179. * @returns A promise that resolves when the load is complete
  1180. */
  1181. loadSceneAsync(context: string, scene: Loader.IScene): Promise<void>;
  1182. private _forEachPrimitive;
  1183. private _getMeshes;
  1184. private _getSkeletons;
  1185. private _getAnimationGroups;
  1186. private _startAnimations;
  1187. /**
  1188. * Loads a glTF node.
  1189. * @param context The context when loading the asset
  1190. * @param node The glTF node property
  1191. * @param assign A function called synchronously after parsing the glTF properties
  1192. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete
  1193. */
  1194. loadNodeAsync(context: string, node: Loader.INode, assign?: (babylonMesh: Mesh) => void): Promise<Mesh>;
  1195. private _loadMeshAsync;
  1196. private _loadMeshPrimitiveAsync;
  1197. private _loadVertexDataAsync;
  1198. private _createMorphTargets;
  1199. private _loadMorphTargetsAsync;
  1200. private _loadMorphTargetVertexDataAsync;
  1201. private static _LoadTransform;
  1202. private _loadSkinAsync;
  1203. private _loadBones;
  1204. private _loadBone;
  1205. private _loadSkinInverseBindMatricesDataAsync;
  1206. private _updateBoneMatrices;
  1207. private _getNodeMatrix;
  1208. /**
  1209. * Loads a glTF camera.
  1210. * @param context The context when loading the asset
  1211. * @param camera The glTF camera property
  1212. * @param assign A function called synchronously after parsing the glTF properties
  1213. * @returns A promise that resolves with the loaded Babylon camera when the load is complete
  1214. */
  1215. loadCameraAsync(context: string, camera: Loader.ICamera, assign?: (babylonCamera: Camera) => void): Promise<Camera>;
  1216. private _loadAnimationsAsync;
  1217. /**
  1218. * Loads a glTF animation.
  1219. * @param context The context when loading the asset
  1220. * @param animation The glTF animation property
  1221. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete
  1222. */
  1223. loadAnimationAsync(context: string, animation: Loader.IAnimation): Promise<AnimationGroup>;
  1224. private _loadAnimationChannelAsync;
  1225. private _loadAnimationSamplerAsync;
  1226. private _loadBufferAsync;
  1227. /**
  1228. * Loads a glTF buffer view.
  1229. * @param context The context when loading the asset
  1230. * @param bufferView The glTF buffer view property
  1231. * @returns A promise that resolves with the loaded data when the load is complete
  1232. */
  1233. loadBufferViewAsync(context: string, bufferView: Loader.IBufferView): Promise<ArrayBufferView>;
  1234. private _loadIndicesAccessorAsync;
  1235. private _loadFloatAccessorAsync;
  1236. private _loadVertexBufferViewAsync;
  1237. private _loadVertexAccessorAsync;
  1238. private _loadMaterialMetallicRoughnessPropertiesAsync;
  1239. /** @hidden */
  1240. _loadMaterialAsync(context: string, material: Loader.IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign?: (babylonMaterial: Material) => void): Promise<Material>;
  1241. private _createDefaultMaterial;
  1242. /**
  1243. * Creates a Babylon material from a glTF material.
  1244. * @param context The context when loading the asset
  1245. * @param material The glTF material property
  1246. * @param babylonDrawMode The draw mode for the Babylon material
  1247. * @returns The Babylon material
  1248. */
  1249. createMaterial(context: string, material: Loader.IMaterial, babylonDrawMode: number): Material;
  1250. /**
  1251. * Loads properties from a glTF material into a Babylon material.
  1252. * @param context The context when loading the asset
  1253. * @param material The glTF material property
  1254. * @param babylonMaterial The Babylon material
  1255. * @returns A promise that resolves when the load is complete
  1256. */
  1257. loadMaterialPropertiesAsync(context: string, material: Loader.IMaterial, babylonMaterial: Material): Promise<void>;
  1258. /**
  1259. * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
  1260. * @param context The context when loading the asset
  1261. * @param material The glTF material property
  1262. * @param babylonMaterial The Babylon material
  1263. * @returns A promise that resolves when the load is complete
  1264. */
  1265. loadMaterialBasePropertiesAsync(context: string, material: Loader.IMaterial, babylonMaterial: Material): Promise<void>;
  1266. /**
  1267. * Loads the alpha properties from a glTF material into a Babylon material.
  1268. * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.
  1269. * @param context The context when loading the asset
  1270. * @param material The glTF material property
  1271. * @param babylonMaterial The Babylon material
  1272. */
  1273. loadMaterialAlphaProperties(context: string, material: Loader.IMaterial, babylonMaterial: Material): void;
  1274. /**
  1275. * Loads a glTF texture info.
  1276. * @param context The context when loading the asset
  1277. * @param textureInfo The glTF texture info property
  1278. * @param assign A function called synchronously after parsing the glTF properties
  1279. * @returns A promise that resolves with the loaded Babylon texture when the load is complete
  1280. */
  1281. loadTextureInfoAsync(context: string, textureInfo: Loader.ITextureInfo, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
  1282. private _loadTextureAsync;
  1283. private _loadSampler;
  1284. /**
  1285. * Loads a glTF image.
  1286. * @param context The context when loading the asset
  1287. * @param image The glTF image property
  1288. * @returns A promise that resolves with the loaded data when the load is complete
  1289. */
  1290. loadImageAsync(context: string, image: Loader.IImage): Promise<ArrayBufferView>;
  1291. /**
  1292. * Loads a glTF uri.
  1293. * @param context The context when loading the asset
  1294. * @param uri The base64 or relative uri
  1295. * @returns A promise that resolves with the loaded data when the load is complete
  1296. */
  1297. loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
  1298. private _onProgress;
  1299. private static _GetTextureWrapMode;
  1300. private static _GetTextureSamplingMode;
  1301. private static _GetTypedArray;
  1302. private static _GetNumComponents;
  1303. private static _ValidateUri;
  1304. private static _GetDrawMode;
  1305. private _compileMaterialsAsync;
  1306. private _compileShadowGeneratorsAsync;
  1307. private _forEachExtensions;
  1308. private _applyExtensions;
  1309. private _extensionsOnLoading;
  1310. private _extensionsOnReady;
  1311. private _extensionsLoadSceneAsync;
  1312. private _extensionsLoadNodeAsync;
  1313. private _extensionsLoadCameraAsync;
  1314. private _extensionsLoadVertexDataAsync;
  1315. private _extensionsLoadMaterialAsync;
  1316. private _extensionsCreateMaterial;
  1317. private _extensionsLoadMaterialPropertiesAsync;
  1318. private _extensionsLoadTextureInfoAsync;
  1319. private _extensionsLoadAnimationAsync;
  1320. private _extensionsLoadUriAsync;
  1321. /**
  1322. * Helper method called by a loader extension to load an glTF extension.
  1323. * @param context The context when loading the asset
  1324. * @param property The glTF property to load the extension from
  1325. * @param extensionName The name of the extension to load
  1326. * @param actionAsync The action to run
  1327. * @returns The promise returned by actionAsync or null if the extension does not exist
  1328. */
  1329. static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  1330. /**
  1331. * Helper method called by a loader extension to load a glTF extra.
  1332. * @param context The context when loading the asset
  1333. * @param property The glTF property to load the extra from
  1334. * @param extensionName The name of the extension to load
  1335. * @param actionAsync The action to run
  1336. * @returns The promise returned by actionAsync or null if the extra does not exist
  1337. */
  1338. static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  1339. /**
  1340. * Increments the indentation level and logs a message.
  1341. * @param message The message to log
  1342. */
  1343. logOpen(message: string): void;
  1344. /**
  1345. * Decrements the indentation level.
  1346. */
  1347. logClose(): void;
  1348. /**
  1349. * Logs a message
  1350. * @param message The message to log
  1351. */
  1352. log(message: string): void;
  1353. /**
  1354. * Starts a performance counter.
  1355. * @param counterName The name of the performance counter
  1356. */
  1357. startPerformanceCounter(counterName: string): void;
  1358. /**
  1359. * Ends a performance counter.
  1360. * @param counterName The name of the performance counter
  1361. */
  1362. endPerformanceCounter(counterName: string): void;
  1363. }
  1364. }
  1365. declare module BABYLON.GLTF2 {
  1366. /**
  1367. * Interface for a glTF loader extension.
  1368. */
  1369. interface IGLTFLoaderExtension extends BABYLON.IGLTFLoaderExtension, IDisposable {
  1370. /**
  1371. * Called after the loader state changes to LOADING.
  1372. */
  1373. onLoading?(): void;
  1374. /**
  1375. * Called after the loader state changes to READY.
  1376. */
  1377. onReady?(): void;
  1378. /**
  1379. * Define this method to modify the default behavior when loading scenes.
  1380. * @param context The context when loading the asset
  1381. * @param scene The glTF scene property
  1382. * @returns A promise that resolves when the load is complete or null if not handled
  1383. */
  1384. loadSceneAsync?(context: string, scene: Loader.IScene): Nullable<Promise<void>>;
  1385. /**
  1386. * Define this method to modify the default behavior when loading nodes.
  1387. * @param context The context when loading the asset
  1388. * @param node The glTF node property
  1389. * @param assign A function called synchronously after parsing the glTF properties
  1390. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete or null if not handled
  1391. */
  1392. loadNodeAsync?(context: string, node: Loader.INode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1393. /**
  1394. * Define this method to modify the default behavior when loading cameras.
  1395. * @param context The context when loading the asset
  1396. * @param camera The glTF camera property
  1397. * @param assign A function called synchronously after parsing the glTF properties
  1398. * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
  1399. */
  1400. loadCameraAsync?(context: string, camera: Loader.ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
  1401. /**
  1402. * @hidden Define this method to modify the default behavior when loading vertex data for mesh primitives.
  1403. * @param context The context when loading the asset
  1404. * @param primitive The glTF mesh primitive property
  1405. * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled
  1406. */
  1407. _loadVertexDataAsync?(context: string, primitive: Loader.IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1408. /**
  1409. * @hidden Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.
  1410. * @param context The context when loading the asset
  1411. * @param material The glTF material property
  1412. * @param assign A function called synchronously after parsing the glTF properties
  1413. * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled
  1414. */
  1415. _loadMaterialAsync?(context: string, material: Loader.IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  1416. /**
  1417. * Define this method to modify the default behavior when creating materials.
  1418. * @param context The context when loading the asset
  1419. * @param material The glTF material property
  1420. * @param babylonDrawMode The draw mode for the Babylon material
  1421. * @returns The Babylon material or null if not handled
  1422. */
  1423. createMaterial?(context: string, material: Loader.IMaterial, babylonDrawMode: number): Nullable<Material>;
  1424. /**
  1425. * Define this method to modify the default behavior when loading material properties.
  1426. * @param context The context when loading the asset
  1427. * @param material The glTF material property
  1428. * @param babylonMaterial The Babylon material
  1429. * @returns A promise that resolves when the load is complete or null if not handled
  1430. */
  1431. loadMaterialPropertiesAsync?(context: string, material: Loader.IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1432. /**
  1433. * Define this method to modify the default behavior when loading texture infos.
  1434. * @param context The context when loading the asset
  1435. * @param textureInfo The glTF texture info property
  1436. * @param assign A function called synchronously after parsing the glTF properties
  1437. * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
  1438. */
  1439. loadTextureInfoAsync?(context: string, textureInfo: Loader.ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1440. /**
  1441. * Define this method to modify the default behavior when loading animations.
  1442. * @param context The context when loading the asset
  1443. * @param animation The glTF animation property
  1444. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
  1445. */
  1446. loadAnimationAsync?(context: string, animation: Loader.IAnimation): Nullable<Promise<AnimationGroup>>;
  1447. /**
  1448. * Define this method to modify the default behavior when loading uris.
  1449. * @param context The context when loading the asset
  1450. * @param uri The uri to load
  1451. * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
  1452. */
  1453. _loadUriAsync?(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1454. }
  1455. }
  1456. /**
  1457. * Defines the module for the built-in glTF 2.0 loader extensions.
  1458. */
  1459. declare module BABYLON.GLTF2.Loader.Extensions {
  1460. }
  1461. declare module BABYLON.GLTF2.Loader.Extensions {
  1462. /**
  1463. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
  1464. */
  1465. class MSFT_lod implements IGLTFLoaderExtension {
  1466. /** The name of this extension. */
  1467. readonly name: string;
  1468. /** Defines whether this extension is enabled. */
  1469. enabled: boolean;
  1470. /**
  1471. * Maximum number of LODs to load, starting from the lowest LOD.
  1472. */
  1473. maxLODsToLoad: number;
  1474. /**
  1475. * Observable raised when all node LODs of one level are loaded.
  1476. * The event data is the index of the loaded LOD starting from zero.
  1477. * Dispose the loader to cancel the loading of the next level of LODs.
  1478. */
  1479. onNodeLODsLoadedObservable: Observable<number>;
  1480. /**
  1481. * Observable raised when all material 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. onMaterialLODsLoadedObservable: Observable<number>;
  1486. private _loader;
  1487. private _nodeIndexLOD;
  1488. private _nodeSignalLODs;
  1489. private _nodePromiseLODs;
  1490. private _materialIndexLOD;
  1491. private _materialSignalLODs;
  1492. private _materialPromiseLODs;
  1493. /** @hidden */
  1494. constructor(loader: GLTFLoader);
  1495. /** @hidden */
  1496. dispose(): void;
  1497. /** @hidden */
  1498. onReady(): void;
  1499. /** @hidden */
  1500. loadNodeAsync(context: string, node: INode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1501. /** @hidden */
  1502. _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  1503. /** @hidden */
  1504. _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1505. /**
  1506. * Gets an array of LOD properties from lowest to highest.
  1507. */
  1508. private _getLODs;
  1509. private _disposeUnusedMaterials;
  1510. }
  1511. }
  1512. declare module BABYLON.GLTF2.Loader.Extensions {
  1513. /** @hidden */
  1514. class MSFT_minecraftMesh implements IGLTFLoaderExtension {
  1515. readonly name: string;
  1516. enabled: boolean;
  1517. private _loader;
  1518. constructor(loader: GLTFLoader);
  1519. dispose(): void;
  1520. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1521. }
  1522. }
  1523. declare module BABYLON.GLTF2.Loader.Extensions {
  1524. /** @hidden */
  1525. class MSFT_sRGBFactors implements IGLTFLoaderExtension {
  1526. readonly name: string;
  1527. enabled: boolean;
  1528. private _loader;
  1529. constructor(loader: GLTFLoader);
  1530. dispose(): void;
  1531. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1532. }
  1533. }
  1534. declare module BABYLON.GLTF2.Loader.Extensions {
  1535. /**
  1536. * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
  1537. */
  1538. class MSFT_audio_emitter implements IGLTFLoaderExtension {
  1539. /** The name of this extension. */
  1540. readonly name: string;
  1541. /** Defines whether this extension is enabled. */
  1542. enabled: boolean;
  1543. private _loader;
  1544. private _clips;
  1545. private _emitters;
  1546. /** @hidden */
  1547. constructor(loader: GLTFLoader);
  1548. /** @hidden */
  1549. dispose(): void;
  1550. /** @hidden */
  1551. onLoading(): void;
  1552. /** @hidden */
  1553. loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
  1554. /** @hidden */
  1555. loadNodeAsync(context: string, node: INode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1556. /** @hidden */
  1557. loadAnimationAsync(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
  1558. private _loadClipAsync;
  1559. private _loadEmitterAsync;
  1560. private _getEventAction;
  1561. private _loadAnimationEventAsync;
  1562. }
  1563. }
  1564. declare module BABYLON.GLTF2.Loader.Extensions {
  1565. /**
  1566. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
  1567. */
  1568. class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
  1569. /** The name of this extension. */
  1570. readonly name: string;
  1571. /** Defines whether this extension is enabled. */
  1572. enabled: boolean;
  1573. private _loader;
  1574. private _dracoCompression?;
  1575. /** @hidden */
  1576. constructor(loader: GLTFLoader);
  1577. /** @hidden */
  1578. dispose(): void;
  1579. /** @hidden */
  1580. _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1581. }
  1582. }
  1583. declare module BABYLON.GLTF2.Loader.Extensions {
  1584. /**
  1585. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
  1586. */
  1587. class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension {
  1588. /** The name of this extension. */
  1589. readonly name: string;
  1590. /** Defines whether this extension is enabled. */
  1591. enabled: boolean;
  1592. private _loader;
  1593. /** @hidden */
  1594. constructor(loader: GLTFLoader);
  1595. /** @hidden */
  1596. dispose(): void;
  1597. /** @hidden */
  1598. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1599. private _loadSpecularGlossinessPropertiesAsync;
  1600. }
  1601. }
  1602. declare module BABYLON.GLTF2.Loader.Extensions {
  1603. /**
  1604. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
  1605. */
  1606. class KHR_materials_unlit implements IGLTFLoaderExtension {
  1607. /** The name of this extension. */
  1608. readonly name: string;
  1609. /** Defines whether this extension is enabled. */
  1610. enabled: boolean;
  1611. private _loader;
  1612. /** @hidden */
  1613. constructor(loader: GLTFLoader);
  1614. /** @hidden */
  1615. dispose(): void;
  1616. /** @hidden */
  1617. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1618. private _loadUnlitPropertiesAsync;
  1619. }
  1620. }
  1621. declare module BABYLON.GLTF2.Loader.Extensions {
  1622. /**
  1623. * [Specification](https://github.com/KhronosGroup/glTF/blob/1048d162a44dbcb05aefc1874bfd423cf60135a6/extensions/2.0/Khronos/KHR_lights_punctual/README.md) (Experimental)
  1624. */
  1625. class KHR_lights implements IGLTFLoaderExtension {
  1626. /** The name of this extension. */
  1627. readonly name: string;
  1628. /** Defines whether this extension is enabled. */
  1629. enabled: boolean;
  1630. private _loader;
  1631. private _lights?;
  1632. /** @hidden */
  1633. constructor(loader: GLTFLoader);
  1634. /** @hidden */
  1635. dispose(): void;
  1636. /** @hidden */
  1637. onLoading(): void;
  1638. /** @hidden */
  1639. loadNodeAsync(context: string, node: INode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1640. }
  1641. }
  1642. declare module BABYLON.GLTF2.Loader.Extensions {
  1643. /**
  1644. * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform/README.md)
  1645. */
  1646. class KHR_texture_transform implements IGLTFLoaderExtension {
  1647. /** The name of this extension. */
  1648. readonly name: string;
  1649. /** Defines whether this extension is enabled. */
  1650. enabled: boolean;
  1651. private _loader;
  1652. /** @hidden */
  1653. constructor(loader: GLTFLoader);
  1654. /** @hidden */
  1655. dispose(): void;
  1656. /** @hidden */
  1657. loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1658. }
  1659. }
  1660. declare module BABYLON.GLTF2.Loader.Extensions {
  1661. /**
  1662. * [Specification](https://github.com/KhronosGroup/glTF/blob/eb3e32332042e04691a5f35103f8c261e50d8f1e/extensions/2.0/Khronos/EXT_lights_image_based/README.md) (Experimental)
  1663. */
  1664. class EXT_lights_image_based implements IGLTFLoaderExtension {
  1665. /** The name of this extension. */
  1666. readonly name: string;
  1667. /** Defines whether this extension is enabled. */
  1668. enabled: boolean;
  1669. private _loader;
  1670. private _lights?;
  1671. /** @hidden */
  1672. constructor(loader: GLTFLoader);
  1673. /** @hidden */
  1674. dispose(): void;
  1675. /** @hidden */
  1676. onLoading(): void;
  1677. /** @hidden */
  1678. loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
  1679. private _loadLightAsync;
  1680. }
  1681. }