babylonjs.loaders.d.ts 73 KB

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