babylonjs.loaders.d.ts 90 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253
  1. declare module BABYLON {
  2. /**
  3. * Mode that determines the coordinate system to use.
  4. */
  5. export 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. export 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. export interface IGLTFLoaderData {
  36. /**
  37. * The object that represents the glTF JSON.
  38. */
  39. json: Object;
  40. /**
  41. * The BIN chunk of a binary glTF.
  42. */
  43. bin: Nullable<IDataBuffer>;
  44. }
  45. /**
  46. * Interface for extending the loader.
  47. */
  48. export 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. * Defines the order of this extension.
  59. * The loader sorts the extensions using these values when loading.
  60. */
  61. order?: number;
  62. }
  63. /**
  64. * Loader state.
  65. */
  66. export enum GLTFLoaderState {
  67. /**
  68. * The asset is loading.
  69. */
  70. LOADING = 0,
  71. /**
  72. * The asset is ready for rendering.
  73. */
  74. READY = 1,
  75. /**
  76. * The asset is completely loaded.
  77. */
  78. COMPLETE = 2
  79. }
  80. /** @hidden */
  81. export interface IGLTFLoader extends IDisposable {
  82. readonly state: Nullable<GLTFLoaderState>;
  83. importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string) => Promise<{
  84. meshes: AbstractMesh[];
  85. particleSystems: IParticleSystem[];
  86. skeletons: Skeleton[];
  87. animationGroups: AnimationGroup[];
  88. }>;
  89. loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;
  90. }
  91. /**
  92. * File loader for loading glTF files into a scene.
  93. */
  94. export class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
  95. /** @hidden */
  96. static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
  97. /** @hidden */
  98. static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
  99. /**
  100. * Raised when the asset has been parsed
  101. */
  102. onParsedObservable: Observable<IGLTFLoaderData>;
  103. private _onParsedObserver;
  104. /**
  105. * Raised when the asset has been parsed
  106. */
  107. onParsed: (loaderData: IGLTFLoaderData) => void;
  108. /**
  109. * 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.
  110. * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
  111. * Defaults to true.
  112. * @hidden
  113. */
  114. static IncrementalLoading: boolean;
  115. /**
  116. * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
  117. * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
  118. * @hidden
  119. */
  120. static HomogeneousCoordinates: boolean;
  121. /**
  122. * The coordinate system mode. Defaults to AUTO.
  123. */
  124. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  125. /**
  126. * The animation start mode. Defaults to FIRST.
  127. */
  128. animationStartMode: GLTFLoaderAnimationStartMode;
  129. /**
  130. * Defines if the loader should compile materials before raising the success callback. Defaults to false.
  131. */
  132. compileMaterials: boolean;
  133. /**
  134. * Defines if the loader should also compile materials with clip planes. Defaults to false.
  135. */
  136. useClipPlane: boolean;
  137. /**
  138. * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.
  139. */
  140. compileShadowGenerators: boolean;
  141. /**
  142. * Defines if the Alpha blended materials are only applied as coverage.
  143. * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.
  144. * If true, no extra effects are applied to transparent pixels.
  145. */
  146. transparencyAsCoverage: boolean;
  147. /**
  148. * Defines if the loader should use range requests when load binary glTF files from HTTP.
  149. * Enabling will disable offline support and glTF validator.
  150. * Defaults to false.
  151. */
  152. useRangeRequests: boolean;
  153. /**
  154. * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.
  155. */
  156. createInstances: boolean;
  157. /**
  158. * Function called before loading a url referenced by the asset.
  159. */
  160. preprocessUrlAsync: (url: string) => Promise<string>;
  161. /**
  162. * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  163. */
  164. readonly onMeshLoadedObservable: Observable<AbstractMesh>;
  165. private _onMeshLoadedObserver;
  166. /**
  167. * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  168. */
  169. onMeshLoaded: (mesh: AbstractMesh) => void;
  170. /**
  171. * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
  172. */
  173. readonly onTextureLoadedObservable: Observable<BaseTexture>;
  174. private _onTextureLoadedObserver;
  175. /**
  176. * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
  177. */
  178. onTextureLoaded: (texture: BaseTexture) => void;
  179. /**
  180. * Observable raised when the loader creates a material after parsing the glTF properties of the material.
  181. */
  182. readonly onMaterialLoadedObservable: Observable<Material>;
  183. private _onMaterialLoadedObserver;
  184. /**
  185. * Callback raised when the loader creates a material after parsing the glTF properties of the material.
  186. */
  187. onMaterialLoaded: (material: Material) => void;
  188. /**
  189. * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.
  190. */
  191. readonly onCameraLoadedObservable: Observable<Camera>;
  192. private _onCameraLoadedObserver;
  193. /**
  194. * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
  195. */
  196. onCameraLoaded: (camera: Camera) => void;
  197. /**
  198. * Observable raised when the asset is completely loaded, immediately before the loader is disposed.
  199. * For assets with LODs, raised when all of the LODs are complete.
  200. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
  201. */
  202. readonly onCompleteObservable: Observable<void>;
  203. private _onCompleteObserver;
  204. /**
  205. * Callback raised when the asset is completely loaded, immediately before the loader is disposed.
  206. * For assets with LODs, raised when all of the LODs are complete.
  207. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
  208. */
  209. onComplete: () => void;
  210. /**
  211. * Observable raised when an error occurs.
  212. */
  213. readonly onErrorObservable: Observable<any>;
  214. private _onErrorObserver;
  215. /**
  216. * Callback raised when an error occurs.
  217. */
  218. onError: (reason: any) => void;
  219. /**
  220. * Observable raised after the loader is disposed.
  221. */
  222. readonly onDisposeObservable: Observable<void>;
  223. private _onDisposeObserver;
  224. /**
  225. * Callback raised after the loader is disposed.
  226. */
  227. onDispose: () => void;
  228. /**
  229. * Observable raised after a loader extension is created.
  230. * Set additional options for a loader extension in this event.
  231. */
  232. readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  233. private _onExtensionLoadedObserver;
  234. /**
  235. * Callback raised after a loader extension is created.
  236. */
  237. onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
  238. /**
  239. * Defines if the loader logging is enabled.
  240. */
  241. loggingEnabled: boolean;
  242. /**
  243. * Defines if the loader should capture performance counters.
  244. */
  245. capturePerformanceCounters: boolean;
  246. /**
  247. * Defines if the loader should validate the asset.
  248. */
  249. validate: boolean;
  250. /**
  251. * Observable raised after validation when validate is set to true. The event data is the result of the validation.
  252. */
  253. readonly onValidatedObservable: Observable<BABYLON.GLTF2.IGLTFValidationResults>;
  254. private _onValidatedObserver;
  255. /**
  256. * Callback raised after a loader extension is created.
  257. */
  258. onValidated: (results: BABYLON.GLTF2.IGLTFValidationResults) => void;
  259. private _loader;
  260. /**
  261. * Name of the loader ("gltf")
  262. */
  263. name: string;
  264. /** @hidden */
  265. extensions: ISceneLoaderPluginExtensions;
  266. /**
  267. * Disposes the loader, releases resources during load, and cancels any outstanding requests.
  268. */
  269. dispose(): void;
  270. /** @hidden */
  271. _clear(): void;
  272. /** @hidden */
  273. requestFile(scene: Scene, url: string, onSuccess: (data: any, request?: WebRequest) => void, onProgress?: (ev: ProgressEvent) => void, useArrayBuffer?: boolean, onError?: (error: any) => void): IFileRequest;
  274. /** @hidden */
  275. readFile(scene: Scene, file: File, onSuccess: (data: any) => void, onProgress?: (ev: ProgressEvent) => any, useArrayBuffer?: boolean, onError?: (error: any) => void): IFileRequest;
  276. /** @hidden */
  277. importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  278. meshes: AbstractMesh[];
  279. particleSystems: IParticleSystem[];
  280. skeletons: Skeleton[];
  281. animationGroups: AnimationGroup[];
  282. }>;
  283. /** @hidden */
  284. loadAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  285. /** @hidden */
  286. loadAssetContainerAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
  287. /** @hidden */
  288. canDirectLoad(data: string): boolean;
  289. /** @hidden */
  290. directLoad(scene: Scene, data: string): any;
  291. /**
  292. * The callback that allows custom handling of the root url based on the response url.
  293. * @param rootUrl the original root url
  294. * @param responseURL the response url if available
  295. * @returns the new root url
  296. */
  297. rewriteRootURL?(rootUrl: string, responseURL?: string): string;
  298. /** @hidden */
  299. createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  300. /**
  301. * The loader state or null if the loader is not active.
  302. */
  303. readonly loaderState: Nullable<GLTFLoaderState>;
  304. /**
  305. * Returns a promise that resolves when the asset is completely loaded.
  306. * @returns a promise that resolves when the asset is completely loaded.
  307. */
  308. whenCompleteAsync(): Promise<void>;
  309. private _validateAsync;
  310. private _getLoader;
  311. private _parseJson;
  312. private _unpackBinaryAsync;
  313. private _unpackBinaryV1Async;
  314. private _unpackBinaryV2Async;
  315. private static _parseVersion;
  316. private static _compareVersion;
  317. private static readonly _logSpaces;
  318. private _logIndentLevel;
  319. private _loggingEnabled;
  320. /** @hidden */
  321. _log: (message: string) => void;
  322. /** @hidden */
  323. _logOpen(message: string): void;
  324. /** @hidden */
  325. _logClose(): void;
  326. private _logEnabled;
  327. private _logDisabled;
  328. private _capturePerformanceCounters;
  329. /** @hidden */
  330. _startPerformanceCounter: (counterName: string) => void;
  331. /** @hidden */
  332. _endPerformanceCounter: (counterName: string) => void;
  333. private _startPerformanceCounterEnabled;
  334. private _startPerformanceCounterDisabled;
  335. private _endPerformanceCounterEnabled;
  336. private _endPerformanceCounterDisabled;
  337. }
  338. }
  339. declare module BABYLON.GLTF1 {
  340. /**
  341. * Enums
  342. * @hidden
  343. */
  344. export enum EComponentType {
  345. BYTE = 5120,
  346. UNSIGNED_BYTE = 5121,
  347. SHORT = 5122,
  348. UNSIGNED_SHORT = 5123,
  349. FLOAT = 5126
  350. }
  351. /** @hidden */
  352. export enum EShaderType {
  353. FRAGMENT = 35632,
  354. VERTEX = 35633
  355. }
  356. /** @hidden */
  357. export enum EParameterType {
  358. BYTE = 5120,
  359. UNSIGNED_BYTE = 5121,
  360. SHORT = 5122,
  361. UNSIGNED_SHORT = 5123,
  362. INT = 5124,
  363. UNSIGNED_INT = 5125,
  364. FLOAT = 5126,
  365. FLOAT_VEC2 = 35664,
  366. FLOAT_VEC3 = 35665,
  367. FLOAT_VEC4 = 35666,
  368. INT_VEC2 = 35667,
  369. INT_VEC3 = 35668,
  370. INT_VEC4 = 35669,
  371. BOOL = 35670,
  372. BOOL_VEC2 = 35671,
  373. BOOL_VEC3 = 35672,
  374. BOOL_VEC4 = 35673,
  375. FLOAT_MAT2 = 35674,
  376. FLOAT_MAT3 = 35675,
  377. FLOAT_MAT4 = 35676,
  378. SAMPLER_2D = 35678
  379. }
  380. /** @hidden */
  381. export enum ETextureWrapMode {
  382. CLAMP_TO_EDGE = 33071,
  383. MIRRORED_REPEAT = 33648,
  384. REPEAT = 10497
  385. }
  386. /** @hidden */
  387. export enum ETextureFilterType {
  388. NEAREST = 9728,
  389. LINEAR = 9728,
  390. NEAREST_MIPMAP_NEAREST = 9984,
  391. LINEAR_MIPMAP_NEAREST = 9985,
  392. NEAREST_MIPMAP_LINEAR = 9986,
  393. LINEAR_MIPMAP_LINEAR = 9987
  394. }
  395. /** @hidden */
  396. export enum ETextureFormat {
  397. ALPHA = 6406,
  398. RGB = 6407,
  399. RGBA = 6408,
  400. LUMINANCE = 6409,
  401. LUMINANCE_ALPHA = 6410
  402. }
  403. /** @hidden */
  404. export enum ECullingType {
  405. FRONT = 1028,
  406. BACK = 1029,
  407. FRONT_AND_BACK = 1032
  408. }
  409. /** @hidden */
  410. export enum EBlendingFunction {
  411. ZERO = 0,
  412. ONE = 1,
  413. SRC_COLOR = 768,
  414. ONE_MINUS_SRC_COLOR = 769,
  415. DST_COLOR = 774,
  416. ONE_MINUS_DST_COLOR = 775,
  417. SRC_ALPHA = 770,
  418. ONE_MINUS_SRC_ALPHA = 771,
  419. DST_ALPHA = 772,
  420. ONE_MINUS_DST_ALPHA = 773,
  421. CONSTANT_COLOR = 32769,
  422. ONE_MINUS_CONSTANT_COLOR = 32770,
  423. CONSTANT_ALPHA = 32771,
  424. ONE_MINUS_CONSTANT_ALPHA = 32772,
  425. SRC_ALPHA_SATURATE = 776
  426. }
  427. /** @hidden */
  428. export interface IGLTFProperty {
  429. extensions?: {
  430. [key: string]: any;
  431. };
  432. extras?: Object;
  433. }
  434. /** @hidden */
  435. export interface IGLTFChildRootProperty extends IGLTFProperty {
  436. name?: string;
  437. }
  438. /** @hidden */
  439. export interface IGLTFAccessor extends IGLTFChildRootProperty {
  440. bufferView: string;
  441. byteOffset: number;
  442. byteStride: number;
  443. count: number;
  444. type: string;
  445. componentType: EComponentType;
  446. max?: number[];
  447. min?: number[];
  448. name?: string;
  449. }
  450. /** @hidden */
  451. export interface IGLTFBufferView extends IGLTFChildRootProperty {
  452. buffer: string;
  453. byteOffset: number;
  454. byteLength: number;
  455. byteStride: number;
  456. target?: number;
  457. }
  458. /** @hidden */
  459. export interface IGLTFBuffer extends IGLTFChildRootProperty {
  460. uri: string;
  461. byteLength?: number;
  462. type?: string;
  463. }
  464. /** @hidden */
  465. export interface IGLTFShader extends IGLTFChildRootProperty {
  466. uri: string;
  467. type: EShaderType;
  468. }
  469. /** @hidden */
  470. export interface IGLTFProgram extends IGLTFChildRootProperty {
  471. attributes: string[];
  472. fragmentShader: string;
  473. vertexShader: string;
  474. }
  475. /** @hidden */
  476. export interface IGLTFTechniqueParameter {
  477. type: number;
  478. count?: number;
  479. semantic?: string;
  480. node?: string;
  481. value?: number | boolean | string | Array<any>;
  482. source?: string;
  483. babylonValue?: any;
  484. }
  485. /** @hidden */
  486. export interface IGLTFTechniqueCommonProfile {
  487. lightingModel: string;
  488. texcoordBindings: Object;
  489. parameters?: Array<any>;
  490. }
  491. /** @hidden */
  492. export interface IGLTFTechniqueStatesFunctions {
  493. blendColor?: number[];
  494. blendEquationSeparate?: number[];
  495. blendFuncSeparate?: number[];
  496. colorMask: boolean[];
  497. cullFace: number[];
  498. }
  499. /** @hidden */
  500. export interface IGLTFTechniqueStates {
  501. enable: number[];
  502. functions: IGLTFTechniqueStatesFunctions;
  503. }
  504. /** @hidden */
  505. export interface IGLTFTechnique extends IGLTFChildRootProperty {
  506. parameters: {
  507. [key: string]: IGLTFTechniqueParameter;
  508. };
  509. program: string;
  510. attributes: {
  511. [key: string]: string;
  512. };
  513. uniforms: {
  514. [key: string]: string;
  515. };
  516. states: IGLTFTechniqueStates;
  517. }
  518. /** @hidden */
  519. export interface IGLTFMaterial extends IGLTFChildRootProperty {
  520. technique?: string;
  521. values: string[];
  522. }
  523. /** @hidden */
  524. export interface IGLTFMeshPrimitive extends IGLTFProperty {
  525. attributes: {
  526. [key: string]: string;
  527. };
  528. indices: string;
  529. material: string;
  530. mode?: number;
  531. }
  532. /** @hidden */
  533. export interface IGLTFMesh extends IGLTFChildRootProperty {
  534. primitives: IGLTFMeshPrimitive[];
  535. }
  536. /** @hidden */
  537. export interface IGLTFImage extends IGLTFChildRootProperty {
  538. uri: string;
  539. }
  540. /** @hidden */
  541. export interface IGLTFSampler extends IGLTFChildRootProperty {
  542. magFilter?: number;
  543. minFilter?: number;
  544. wrapS?: number;
  545. wrapT?: number;
  546. }
  547. /** @hidden */
  548. export interface IGLTFTexture extends IGLTFChildRootProperty {
  549. sampler: string;
  550. source: string;
  551. format?: ETextureFormat;
  552. internalFormat?: ETextureFormat;
  553. target?: number;
  554. type?: number;
  555. babylonTexture?: Texture;
  556. }
  557. /** @hidden */
  558. export interface IGLTFAmbienLight {
  559. color?: number[];
  560. }
  561. /** @hidden */
  562. export interface IGLTFDirectionalLight {
  563. color?: number[];
  564. }
  565. /** @hidden */
  566. export interface IGLTFPointLight {
  567. color?: number[];
  568. constantAttenuation?: number;
  569. linearAttenuation?: number;
  570. quadraticAttenuation?: number;
  571. }
  572. /** @hidden */
  573. export interface IGLTFSpotLight {
  574. color?: number[];
  575. constantAttenuation?: number;
  576. fallOfAngle?: number;
  577. fallOffExponent?: number;
  578. linearAttenuation?: number;
  579. quadraticAttenuation?: number;
  580. }
  581. /** @hidden */
  582. export interface IGLTFLight extends IGLTFChildRootProperty {
  583. type: string;
  584. }
  585. /** @hidden */
  586. export interface IGLTFCameraOrthographic {
  587. xmag: number;
  588. ymag: number;
  589. zfar: number;
  590. znear: number;
  591. }
  592. /** @hidden */
  593. export interface IGLTFCameraPerspective {
  594. aspectRatio: number;
  595. yfov: number;
  596. zfar: number;
  597. znear: number;
  598. }
  599. /** @hidden */
  600. export interface IGLTFCamera extends IGLTFChildRootProperty {
  601. type: string;
  602. }
  603. /** @hidden */
  604. export interface IGLTFAnimationChannelTarget {
  605. id: string;
  606. path: string;
  607. }
  608. /** @hidden */
  609. export interface IGLTFAnimationChannel {
  610. sampler: string;
  611. target: IGLTFAnimationChannelTarget;
  612. }
  613. /** @hidden */
  614. export interface IGLTFAnimationSampler {
  615. input: string;
  616. output: string;
  617. interpolation?: string;
  618. }
  619. /** @hidden */
  620. export interface IGLTFAnimation extends IGLTFChildRootProperty {
  621. channels?: IGLTFAnimationChannel[];
  622. parameters?: {
  623. [key: string]: string;
  624. };
  625. samplers?: {
  626. [key: string]: IGLTFAnimationSampler;
  627. };
  628. }
  629. /** @hidden */
  630. export interface IGLTFNodeInstanceSkin {
  631. skeletons: string[];
  632. skin: string;
  633. meshes: string[];
  634. }
  635. /** @hidden */
  636. export interface IGLTFSkins extends IGLTFChildRootProperty {
  637. bindShapeMatrix: number[];
  638. inverseBindMatrices: string;
  639. jointNames: string[];
  640. babylonSkeleton?: Skeleton;
  641. }
  642. /** @hidden */
  643. export interface IGLTFNode extends IGLTFChildRootProperty {
  644. camera?: string;
  645. children: string[];
  646. skin?: string;
  647. jointName?: string;
  648. light?: string;
  649. matrix: number[];
  650. mesh?: string;
  651. meshes?: string[];
  652. rotation?: number[];
  653. scale?: number[];
  654. translation?: number[];
  655. babylonNode?: Node;
  656. }
  657. /** @hidden */
  658. export interface IGLTFScene extends IGLTFChildRootProperty {
  659. nodes: string[];
  660. }
  661. /** @hidden */
  662. export interface IGLTFRuntime {
  663. extensions: {
  664. [key: string]: any;
  665. };
  666. accessors: {
  667. [key: string]: IGLTFAccessor;
  668. };
  669. buffers: {
  670. [key: string]: IGLTFBuffer;
  671. };
  672. bufferViews: {
  673. [key: string]: IGLTFBufferView;
  674. };
  675. meshes: {
  676. [key: string]: IGLTFMesh;
  677. };
  678. lights: {
  679. [key: string]: IGLTFLight;
  680. };
  681. cameras: {
  682. [key: string]: IGLTFCamera;
  683. };
  684. nodes: {
  685. [key: string]: IGLTFNode;
  686. };
  687. images: {
  688. [key: string]: IGLTFImage;
  689. };
  690. textures: {
  691. [key: string]: IGLTFTexture;
  692. };
  693. shaders: {
  694. [key: string]: IGLTFShader;
  695. };
  696. programs: {
  697. [key: string]: IGLTFProgram;
  698. };
  699. samplers: {
  700. [key: string]: IGLTFSampler;
  701. };
  702. techniques: {
  703. [key: string]: IGLTFTechnique;
  704. };
  705. materials: {
  706. [key: string]: IGLTFMaterial;
  707. };
  708. animations: {
  709. [key: string]: IGLTFAnimation;
  710. };
  711. skins: {
  712. [key: string]: IGLTFSkins;
  713. };
  714. currentScene?: Object;
  715. scenes: {
  716. [key: string]: IGLTFScene;
  717. };
  718. extensionsUsed: string[];
  719. extensionsRequired?: string[];
  720. buffersCount: number;
  721. shaderscount: number;
  722. scene: Scene;
  723. rootUrl: string;
  724. loadedBufferCount: number;
  725. loadedBufferViews: {
  726. [name: string]: ArrayBufferView;
  727. };
  728. loadedShaderCount: number;
  729. importOnlyMeshes: boolean;
  730. importMeshesNames?: string[];
  731. dummyNodes: Node[];
  732. }
  733. /** @hidden */
  734. export interface INodeToRoot {
  735. bone: Bone;
  736. node: IGLTFNode;
  737. id: string;
  738. }
  739. /** @hidden */
  740. export interface IJointNode {
  741. node: IGLTFNode;
  742. id: string;
  743. }
  744. }
  745. declare module BABYLON.GLTF1 {
  746. /**
  747. * Utils functions for GLTF
  748. * @hidden
  749. */
  750. export class GLTFUtils {
  751. /**
  752. * Sets the given "parameter" matrix
  753. * @param scene: the Scene object
  754. * @param source: the source node where to pick the matrix
  755. * @param parameter: the GLTF technique parameter
  756. * @param uniformName: the name of the shader's uniform
  757. * @param shaderMaterial: the shader material
  758. */
  759. static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void;
  760. /**
  761. * Sets the given "parameter" matrix
  762. * @param shaderMaterial: the shader material
  763. * @param uniform: the name of the shader's uniform
  764. * @param value: the value of the uniform
  765. * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
  766. */
  767. static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
  768. /**
  769. * Returns the wrap mode of the texture
  770. * @param mode: the mode value
  771. */
  772. static GetWrapMode(mode: number): number;
  773. /**
  774. * Returns the byte stride giving an accessor
  775. * @param accessor: the GLTF accessor objet
  776. */
  777. static GetByteStrideFromType(accessor: IGLTFAccessor): number;
  778. /**
  779. * Returns the texture filter mode giving a mode value
  780. * @param mode: the filter mode value
  781. */
  782. static GetTextureFilterMode(mode: number): ETextureFilterType;
  783. static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
  784. /**
  785. * Returns a buffer from its accessor
  786. * @param gltfRuntime: the GLTF runtime
  787. * @param accessor: the GLTF accessor
  788. */
  789. static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
  790. /**
  791. * Decodes a buffer view into a string
  792. * @param view: the buffer view
  793. */
  794. static DecodeBufferToText(view: ArrayBufferView): string;
  795. /**
  796. * Returns the default material of gltf. Related to
  797. * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
  798. * @param scene: the Babylon.js scene
  799. */
  800. static GetDefaultMaterial(scene: Scene): ShaderMaterial;
  801. private static _DefaultMaterial;
  802. }
  803. }
  804. declare module BABYLON.GLTF1 {
  805. /**
  806. * Implementation of the base glTF spec
  807. * @hidden
  808. */
  809. export class GLTFLoaderBase {
  810. static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
  811. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  812. static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
  813. static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  814. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void;
  815. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  816. }
  817. /**
  818. * glTF V1 Loader
  819. * @hidden
  820. */
  821. export class GLTFLoader implements IGLTFLoader {
  822. static Extensions: {
  823. [name: string]: GLTFLoaderExtension;
  824. };
  825. static RegisterExtension(extension: GLTFLoaderExtension): void;
  826. state: Nullable<GLTFLoaderState>;
  827. dispose(): void;
  828. private _importMeshAsync;
  829. /**
  830. * Imports one or more meshes from a loaded gltf file and adds them to the scene
  831. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  832. * @param scene the scene the meshes should be added to
  833. * @param data gltf data containing information of the meshes in a loaded file
  834. * @param rootUrl root url to load from
  835. * @param onProgress event that fires when loading progress has occured
  836. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  837. */
  838. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
  839. meshes: AbstractMesh[];
  840. particleSystems: IParticleSystem[];
  841. skeletons: Skeleton[];
  842. animationGroups: AnimationGroup[];
  843. }>;
  844. private _loadAsync;
  845. /**
  846. * Imports all objects from a loaded gltf file and adds them to the scene
  847. * @param scene the scene the objects should be added to
  848. * @param data gltf data containing information of the meshes in a loaded file
  849. * @param rootUrl root url to load from
  850. * @param onProgress event that fires when loading progress has occured
  851. * @returns a promise which completes when objects have been loaded to the scene
  852. */
  853. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
  854. private _loadShadersAsync;
  855. private _loadBuffersAsync;
  856. private _createNodes;
  857. }
  858. /** @hidden */
  859. export abstract class GLTFLoaderExtension {
  860. private _name;
  861. constructor(name: string);
  862. readonly name: string;
  863. /**
  864. * Defines an override for loading the runtime
  865. * Return true to stop further extensions from loading the runtime
  866. */
  867. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
  868. /**
  869. * Defines an onverride for creating gltf runtime
  870. * Return true to stop further extensions from creating the runtime
  871. */
  872. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
  873. /**
  874. * Defines an override for loading buffers
  875. * Return true to stop further extensions from loading this buffer
  876. */
  877. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
  878. /**
  879. * Defines an override for loading texture buffers
  880. * Return true to stop further extensions from loading this texture data
  881. */
  882. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  883. /**
  884. * Defines an override for creating textures
  885. * Return true to stop further extensions from loading this texture
  886. */
  887. createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
  888. /**
  889. * Defines an override for loading shader strings
  890. * Return true to stop further extensions from loading this shader data
  891. */
  892. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  893. /**
  894. * Defines an override for loading materials
  895. * Return true to stop further extensions from loading this material
  896. */
  897. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  898. static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): void;
  899. static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void;
  900. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  901. static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  902. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void;
  903. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  904. private static LoadTextureBufferAsync;
  905. private static CreateTextureAsync;
  906. private static ApplyExtensions;
  907. }
  908. }
  909. declare module BABYLON.GLTF1 {
  910. /** @hidden */
  911. export class GLTFBinaryExtension extends GLTFLoaderExtension {
  912. private _bin;
  913. constructor();
  914. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  915. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  916. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  917. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  918. }
  919. }
  920. declare module BABYLON.GLTF1 {
  921. /** @hidden */
  922. export class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {
  923. constructor();
  924. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  925. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  926. private _loadTexture;
  927. }
  928. }
  929. declare module BABYLON.GLTF2.Loader {
  930. /**
  931. * Loader interface with an index field.
  932. */
  933. export interface IArrayItem {
  934. /**
  935. * The index of this item in the array.
  936. */
  937. index: number;
  938. }
  939. /**
  940. * Loader interface with additional members.
  941. */
  942. export interface IAccessor extends BABYLON.GLTF2.IAccessor, IArrayItem {
  943. /** @hidden */
  944. _data?: Promise<ArrayBufferView>;
  945. /** @hidden */
  946. _babylonVertexBuffer?: Promise<VertexBuffer>;
  947. }
  948. /**
  949. * Loader interface with additional members.
  950. */
  951. export interface IAnimationChannel extends BABYLON.GLTF2.IAnimationChannel, IArrayItem {
  952. }
  953. /** @hidden */
  954. export interface _IAnimationSamplerData {
  955. input: Float32Array;
  956. interpolation: BABYLON.GLTF2.AnimationSamplerInterpolation;
  957. output: Float32Array;
  958. }
  959. /**
  960. * Loader interface with additional members.
  961. */
  962. export interface IAnimationSampler extends BABYLON.GLTF2.IAnimationSampler, IArrayItem {
  963. /** @hidden */
  964. _data?: Promise<_IAnimationSamplerData>;
  965. }
  966. /**
  967. * Loader interface with additional members.
  968. */
  969. export interface IAnimation extends BABYLON.GLTF2.IAnimation, IArrayItem {
  970. channels: IAnimationChannel[];
  971. samplers: IAnimationSampler[];
  972. /** @hidden */
  973. _babylonAnimationGroup?: AnimationGroup;
  974. }
  975. /**
  976. * Loader interface with additional members.
  977. */
  978. export interface IBuffer extends BABYLON.GLTF2.IBuffer, IArrayItem {
  979. /** @hidden */
  980. _data?: Promise<ArrayBufferView>;
  981. }
  982. /**
  983. * Loader interface with additional members.
  984. */
  985. export interface IBufferView extends BABYLON.GLTF2.IBufferView, IArrayItem {
  986. /** @hidden */
  987. _data?: Promise<ArrayBufferView>;
  988. /** @hidden */
  989. _babylonBuffer?: Promise<Buffer>;
  990. }
  991. /**
  992. * Loader interface with additional members.
  993. */
  994. export interface ICamera extends BABYLON.GLTF2.ICamera, IArrayItem {
  995. }
  996. /**
  997. * Loader interface with additional members.
  998. */
  999. export interface IImage extends BABYLON.GLTF2.IImage, IArrayItem {
  1000. /** @hidden */
  1001. _data?: Promise<ArrayBufferView>;
  1002. }
  1003. /**
  1004. * Loader interface with additional members.
  1005. */
  1006. export interface IMaterialNormalTextureInfo extends BABYLON.GLTF2.IMaterialNormalTextureInfo, ITextureInfo {
  1007. }
  1008. /**
  1009. * Loader interface with additional members.
  1010. */
  1011. export interface IMaterialOcclusionTextureInfo extends BABYLON.GLTF2.IMaterialOcclusionTextureInfo, ITextureInfo {
  1012. }
  1013. /**
  1014. * Loader interface with additional members.
  1015. */
  1016. export interface IMaterialPbrMetallicRoughness extends BABYLON.GLTF2.IMaterialPbrMetallicRoughness {
  1017. baseColorTexture?: ITextureInfo;
  1018. metallicRoughnessTexture?: ITextureInfo;
  1019. }
  1020. /**
  1021. * Loader interface with additional members.
  1022. */
  1023. export interface IMaterial extends BABYLON.GLTF2.IMaterial, IArrayItem {
  1024. pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
  1025. normalTexture?: IMaterialNormalTextureInfo;
  1026. occlusionTexture?: IMaterialOcclusionTextureInfo;
  1027. emissiveTexture?: ITextureInfo;
  1028. /** @hidden */
  1029. _data?: {
  1030. [babylonDrawMode: number]: {
  1031. babylonMaterial: Material;
  1032. babylonMeshes: AbstractMesh[];
  1033. promise: Promise<void>;
  1034. };
  1035. };
  1036. }
  1037. /**
  1038. * Loader interface with additional members.
  1039. */
  1040. export interface IMesh extends BABYLON.GLTF2.IMesh, IArrayItem {
  1041. primitives: IMeshPrimitive[];
  1042. }
  1043. /**
  1044. * Loader interface with additional members.
  1045. */
  1046. export interface IMeshPrimitive extends BABYLON.GLTF2.IMeshPrimitive, IArrayItem {
  1047. /** @hidden */
  1048. _instanceData?: {
  1049. babylonSourceMesh: Mesh;
  1050. promise: Promise<any>;
  1051. };
  1052. }
  1053. /**
  1054. * Loader interface with additional members.
  1055. */
  1056. export interface INode extends BABYLON.GLTF2.INode, IArrayItem {
  1057. /**
  1058. * The parent glTF node.
  1059. */
  1060. parent?: INode;
  1061. /** @hidden */
  1062. _babylonTransformNode?: TransformNode;
  1063. /** @hidden */
  1064. _primitiveBabylonMeshes?: AbstractMesh[];
  1065. /** @hidden */
  1066. _babylonBones?: Bone[];
  1067. /** @hidden */
  1068. _numMorphTargets?: number;
  1069. }
  1070. /** @hidden */
  1071. export interface _ISamplerData {
  1072. noMipMaps: boolean;
  1073. samplingMode: number;
  1074. wrapU: number;
  1075. wrapV: number;
  1076. }
  1077. /**
  1078. * Loader interface with additional members.
  1079. */
  1080. export interface ISampler extends BABYLON.GLTF2.ISampler, IArrayItem {
  1081. /** @hidden */
  1082. _data?: _ISamplerData;
  1083. }
  1084. /**
  1085. * Loader interface with additional members.
  1086. */
  1087. export interface IScene extends BABYLON.GLTF2.IScene, IArrayItem {
  1088. }
  1089. /**
  1090. * Loader interface with additional members.
  1091. */
  1092. export interface ISkin extends BABYLON.GLTF2.ISkin, IArrayItem {
  1093. /** @hidden */
  1094. _data?: {
  1095. babylonSkeleton: Skeleton;
  1096. promise: Promise<void>;
  1097. };
  1098. }
  1099. /**
  1100. * Loader interface with additional members.
  1101. */
  1102. export interface ITexture extends BABYLON.GLTF2.ITexture, IArrayItem {
  1103. }
  1104. /**
  1105. * Loader interface with additional members.
  1106. */
  1107. export interface ITextureInfo extends BABYLON.GLTF2.ITextureInfo {
  1108. }
  1109. /**
  1110. * Loader interface with additional members.
  1111. */
  1112. export interface IGLTF extends BABYLON.GLTF2.IGLTF {
  1113. accessors?: IAccessor[];
  1114. animations?: IAnimation[];
  1115. buffers?: IBuffer[];
  1116. bufferViews?: IBufferView[];
  1117. cameras?: ICamera[];
  1118. images?: IImage[];
  1119. materials?: IMaterial[];
  1120. meshes?: IMesh[];
  1121. nodes?: INode[];
  1122. samplers?: ISampler[];
  1123. scenes?: IScene[];
  1124. skins?: ISkin[];
  1125. textures?: ITexture[];
  1126. }
  1127. }
  1128. declare module BABYLON.GLTF2 {
  1129. /**
  1130. * Interface for a glTF loader extension.
  1131. */
  1132. export interface IGLTFLoaderExtension extends BABYLON.IGLTFLoaderExtension, IDisposable {
  1133. /**
  1134. * Called after the loader state changes to LOADING.
  1135. */
  1136. onLoading?(): void;
  1137. /**
  1138. * Called after the loader state changes to READY.
  1139. */
  1140. onReady?(): void;
  1141. /**
  1142. * Define this method to modify the default behavior when loading scenes.
  1143. * @param context The context when loading the asset
  1144. * @param scene The glTF scene property
  1145. * @returns A promise that resolves when the load is complete or null if not handled
  1146. */
  1147. loadSceneAsync?(context: string, scene: IScene): Nullable<Promise<void>>;
  1148. /**
  1149. * Define this method to modify the default behavior when loading nodes.
  1150. * @param context The context when loading the asset
  1151. * @param node The glTF node property
  1152. * @param assign A function called synchronously after parsing the glTF properties
  1153. * @returns A promise that resolves with the loaded Babylon transform node when the load is complete or null if not handled
  1154. */
  1155. loadNodeAsync?(context: string, node: INode, assign: (babylonMesh: TransformNode) => void): Nullable<Promise<TransformNode>>;
  1156. /**
  1157. * Define this method to modify the default behavior when loading cameras.
  1158. * @param context The context when loading the asset
  1159. * @param camera The glTF camera property
  1160. * @param assign A function called synchronously after parsing the glTF properties
  1161. * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
  1162. */
  1163. loadCameraAsync?(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
  1164. /**
  1165. * @hidden Define this method to modify the default behavior when loading vertex data for mesh primitives.
  1166. * @param context The context when loading the asset
  1167. * @param primitive The glTF mesh primitive property
  1168. * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled
  1169. */
  1170. _loadVertexDataAsync?(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1171. /**
  1172. * @hidden Define this method to modify the default behavior when loading data for mesh primitives.
  1173. * @param context The context when loading the asset
  1174. * @param name The mesh name when loading the asset
  1175. * @param node The glTF node when loading the asset
  1176. * @param mesh The glTF mesh when loading the asset
  1177. * @param primitive The glTF mesh primitive property
  1178. * @param assign A function called synchronously after parsing the glTF properties
  1179. * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled
  1180. */
  1181. _loadMeshPrimitiveAsync?(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Promise<AbstractMesh>;
  1182. /**
  1183. * @hidden Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.
  1184. * @param context The context when loading the asset
  1185. * @param material The glTF material property
  1186. * @param assign A function called synchronously after parsing the glTF properties
  1187. * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled
  1188. */
  1189. _loadMaterialAsync?(context: string, material: IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  1190. /**
  1191. * Define this method to modify the default behavior when creating materials.
  1192. * @param context The context when loading the asset
  1193. * @param material The glTF material property
  1194. * @param babylonDrawMode The draw mode for the Babylon material
  1195. * @returns The Babylon material or null if not handled
  1196. */
  1197. createMaterial?(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
  1198. /**
  1199. * Define this method to modify the default behavior when loading material properties.
  1200. * @param context The context when loading the asset
  1201. * @param material The glTF material property
  1202. * @param babylonMaterial The Babylon material
  1203. * @returns A promise that resolves when the load is complete or null if not handled
  1204. */
  1205. loadMaterialPropertiesAsync?(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1206. /**
  1207. * Define this method to modify the default behavior when loading texture infos.
  1208. * @param context The context when loading the asset
  1209. * @param textureInfo The glTF texture info property
  1210. * @param assign A function called synchronously after parsing the glTF properties
  1211. * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
  1212. */
  1213. loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1214. /**
  1215. * Define this method to modify the default behavior when loading animations.
  1216. * @param context The context when loading the asset
  1217. * @param animation The glTF animation property
  1218. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
  1219. */
  1220. loadAnimationAsync?(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
  1221. /**
  1222. * @hidden Define this method to modify the default behavior when loading skins.
  1223. * @param context The context when loading the asset
  1224. * @param node The glTF node property
  1225. * @param skin The glTF skin property
  1226. * @returns A promise that resolves when the load is complete or null if not handled
  1227. */
  1228. _loadSkinAsync?(context: string, node: INode, skin: ISkin): Nullable<Promise<void>>;
  1229. /**
  1230. * @hidden Define this method to modify the default behavior when loading uris.
  1231. * @param context The context when loading the asset
  1232. * @param property The glTF property associated with the uri
  1233. * @param uri The uri to load
  1234. * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
  1235. */
  1236. _loadUriAsync?(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>>;
  1237. /**
  1238. * Define this method to modify the default behavior when loading buffer views.
  1239. * @param context The context when loading the asset
  1240. * @param bufferView The glTF buffer view property
  1241. * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
  1242. */
  1243. loadBufferViewAsync?(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>>;
  1244. /**
  1245. * Define this method to modify the default behavior when loading buffers.
  1246. * @param context The context when loading the asset
  1247. * @param buffer The glTF buffer property
  1248. * @param byteOffset The byte offset to load
  1249. * @param byteLength The byte length to load
  1250. * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
  1251. */
  1252. loadBufferAsync?(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>>;
  1253. }
  1254. }
  1255. declare module BABYLON.GLTF2 {
  1256. /**
  1257. * Helper class for working with arrays when loading the glTF asset
  1258. */
  1259. export class ArrayItem {
  1260. /**
  1261. * Gets an item from the given array.
  1262. * @param context The context when loading the asset
  1263. * @param array The array to get the item from
  1264. * @param index The index to the array
  1265. * @returns The array item
  1266. */
  1267. static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
  1268. /**
  1269. * Assign an `index` field to each item of the given array.
  1270. * @param array The array of items
  1271. */
  1272. static Assign(array?: BABYLON.GLTF2.Loader.IArrayItem[]): void;
  1273. }
  1274. /**
  1275. * The glTF 2.0 loader
  1276. */
  1277. export class GLTFLoader implements IGLTFLoader {
  1278. /** @hidden */
  1279. _completePromises: Promise<any>[];
  1280. private _disposed;
  1281. private _parent;
  1282. private _state;
  1283. private _extensions;
  1284. private _rootUrl;
  1285. private _fileName;
  1286. private _uniqueRootUrl;
  1287. private _gltf;
  1288. private _bin;
  1289. private _babylonScene;
  1290. private _rootBabylonMesh;
  1291. private _defaultBabylonMaterialData;
  1292. private _progressCallback?;
  1293. private _requests;
  1294. private static readonly _DefaultSampler;
  1295. private static _RegisteredExtensions;
  1296. /**
  1297. * Registers a loader extension.
  1298. * @param name The name of the loader extension.
  1299. * @param factory The factory function that creates the loader extension.
  1300. */
  1301. static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void;
  1302. /**
  1303. * Unregisters a loader extension.
  1304. * @param name The name of the loader extension.
  1305. * @returns A boolean indicating whether the extension has been unregistered
  1306. */
  1307. static UnregisterExtension(name: string): boolean;
  1308. /**
  1309. * Gets the loader state.
  1310. */
  1311. readonly state: Nullable<GLTFLoaderState>;
  1312. /**
  1313. * The object that represents the glTF JSON.
  1314. */
  1315. readonly gltf: IGLTF;
  1316. /**
  1317. * The BIN chunk of a binary glTF.
  1318. */
  1319. readonly bin: Nullable<IDataBuffer>;
  1320. /**
  1321. * The parent file loader.
  1322. */
  1323. readonly parent: GLTFFileLoader;
  1324. /**
  1325. * The Babylon scene when loading the asset.
  1326. */
  1327. readonly babylonScene: Scene;
  1328. /**
  1329. * The root Babylon mesh when loading the asset.
  1330. */
  1331. readonly rootBabylonMesh: Mesh;
  1332. /** @hidden */
  1333. constructor(parent: GLTFFileLoader);
  1334. /** @hidden */
  1335. dispose(): void;
  1336. /** @hidden */
  1337. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  1338. meshes: AbstractMesh[];
  1339. particleSystems: IParticleSystem[];
  1340. skeletons: Skeleton[];
  1341. animationGroups: AnimationGroup[];
  1342. }>;
  1343. /** @hidden */
  1344. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  1345. private _loadAsync;
  1346. private _loadData;
  1347. private _setupData;
  1348. private _loadExtensions;
  1349. private _checkExtensions;
  1350. private _setState;
  1351. private _createRootNode;
  1352. /**
  1353. * Loads a glTF scene.
  1354. * @param context The context when loading the asset
  1355. * @param scene The glTF scene property
  1356. * @returns A promise that resolves when the load is complete
  1357. */
  1358. loadSceneAsync(context: string, scene: IScene): Promise<void>;
  1359. private _forEachPrimitive;
  1360. private _getMeshes;
  1361. private _getSkeletons;
  1362. private _getAnimationGroups;
  1363. private _startAnimations;
  1364. /**
  1365. * Loads a glTF node.
  1366. * @param context The context when loading the asset
  1367. * @param node The glTF node property
  1368. * @param assign A function called synchronously after parsing the glTF properties
  1369. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete
  1370. */
  1371. loadNodeAsync(context: string, node: INode, assign?: (babylonTransformNode: TransformNode) => void): Promise<TransformNode>;
  1372. private _loadMeshAsync;
  1373. /**
  1374. * @hidden Define this method to modify the default behavior when loading data for mesh primitives.
  1375. * @param context The context when loading the asset
  1376. * @param name The mesh name when loading the asset
  1377. * @param node The glTF node when loading the asset
  1378. * @param mesh The glTF mesh when loading the asset
  1379. * @param primitive The glTF mesh primitive property
  1380. * @param assign A function called synchronously after parsing the glTF properties
  1381. * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled
  1382. */
  1383. _loadMeshPrimitiveAsync(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Promise<AbstractMesh>;
  1384. private _loadVertexDataAsync;
  1385. private _createMorphTargets;
  1386. private _loadMorphTargetsAsync;
  1387. private _loadMorphTargetVertexDataAsync;
  1388. private static _LoadTransform;
  1389. private _loadSkinAsync;
  1390. private _loadBones;
  1391. private _loadBone;
  1392. private _loadSkinInverseBindMatricesDataAsync;
  1393. private _updateBoneMatrices;
  1394. private _getNodeMatrix;
  1395. /**
  1396. * Loads a glTF camera.
  1397. * @param context The context when loading the asset
  1398. * @param camera The glTF camera property
  1399. * @param assign A function called synchronously after parsing the glTF properties
  1400. * @returns A promise that resolves with the loaded Babylon camera when the load is complete
  1401. */
  1402. loadCameraAsync(context: string, camera: ICamera, assign?: (babylonCamera: Camera) => void): Promise<Camera>;
  1403. private _loadAnimationsAsync;
  1404. /**
  1405. * Loads a glTF animation.
  1406. * @param context The context when loading the asset
  1407. * @param animation The glTF animation property
  1408. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete
  1409. */
  1410. loadAnimationAsync(context: string, animation: IAnimation): Promise<AnimationGroup>;
  1411. /**
  1412. * @hidden Loads a glTF animation channel.
  1413. * @param context The context when loading the asset
  1414. * @param animationContext The context of the animation when loading the asset
  1415. * @param animation The glTF animation property
  1416. * @param channel The glTF animation channel property
  1417. * @param babylonAnimationGroup The babylon animation group property
  1418. * @param animationTargetOverride The babylon animation channel target override property. My be null.
  1419. * @returns A void promise when the channel load is complete
  1420. */
  1421. _loadAnimationChannelAsync(context: string, animationContext: string, animation: IAnimation, channel: IAnimationChannel, babylonAnimationGroup: AnimationGroup, animationTargetOverride?: Nullable<IAnimatable>): Promise<void>;
  1422. private _loadAnimationSamplerAsync;
  1423. private _loadBufferAsync;
  1424. /**
  1425. * Loads a glTF buffer view.
  1426. * @param context The context when loading the asset
  1427. * @param bufferView The glTF buffer view property
  1428. * @returns A promise that resolves with the loaded data when the load is complete
  1429. */
  1430. loadBufferViewAsync(context: string, bufferView: IBufferView): Promise<ArrayBufferView>;
  1431. private _loadAccessorAsync;
  1432. private _loadFloatAccessorAsync;
  1433. private _loadIndicesAccessorAsync;
  1434. private _loadVertexBufferViewAsync;
  1435. private _loadVertexAccessorAsync;
  1436. private _loadMaterialMetallicRoughnessPropertiesAsync;
  1437. /** @hidden */
  1438. _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign?: (babylonMaterial: Material) => void): Promise<Material>;
  1439. private _createDefaultMaterial;
  1440. /**
  1441. * Creates a Babylon material from a glTF material.
  1442. * @param context The context when loading the asset
  1443. * @param material The glTF material property
  1444. * @param babylonDrawMode The draw mode for the Babylon material
  1445. * @returns The Babylon material
  1446. */
  1447. createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Material;
  1448. /**
  1449. * Loads properties from a glTF material into a Babylon material.
  1450. * @param context The context when loading the asset
  1451. * @param material The glTF material property
  1452. * @param babylonMaterial The Babylon material
  1453. * @returns A promise that resolves when the load is complete
  1454. */
  1455. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
  1456. /**
  1457. * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
  1458. * @param context The context when loading the asset
  1459. * @param material The glTF material property
  1460. * @param babylonMaterial The Babylon material
  1461. * @returns A promise that resolves when the load is complete
  1462. */
  1463. loadMaterialBasePropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
  1464. /**
  1465. * Loads the alpha properties from a glTF material into a Babylon material.
  1466. * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.
  1467. * @param context The context when loading the asset
  1468. * @param material The glTF material property
  1469. * @param babylonMaterial The Babylon material
  1470. */
  1471. loadMaterialAlphaProperties(context: string, material: IMaterial, babylonMaterial: Material): void;
  1472. /**
  1473. * Loads a glTF texture info.
  1474. * @param context The context when loading the asset
  1475. * @param textureInfo The glTF texture info property
  1476. * @param assign A function called synchronously after parsing the glTF properties
  1477. * @returns A promise that resolves with the loaded Babylon texture when the load is complete
  1478. */
  1479. loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
  1480. private _loadTextureAsync;
  1481. private _loadSampler;
  1482. /**
  1483. * Loads a glTF image.
  1484. * @param context The context when loading the asset
  1485. * @param image The glTF image property
  1486. * @returns A promise that resolves with the loaded data when the load is complete
  1487. */
  1488. loadImageAsync(context: string, image: IImage): Promise<ArrayBufferView>;
  1489. /**
  1490. * Loads a glTF uri.
  1491. * @param context The context when loading the asset
  1492. * @param property The glTF property associated with the uri
  1493. * @param uri The base64 or relative uri
  1494. * @returns A promise that resolves with the loaded data when the load is complete
  1495. */
  1496. loadUriAsync(context: string, property: IProperty, uri: string): Promise<ArrayBufferView>;
  1497. private _onProgress;
  1498. /**
  1499. * Adds a JSON pointer to the metadata of the Babylon object at `<object>.metadata.gltf.pointers`.
  1500. * @param babylonObject the Babylon object with metadata
  1501. * @param pointer the JSON pointer
  1502. */
  1503. static AddPointerMetadata(babylonObject: {
  1504. metadata: any;
  1505. }, pointer: string): void;
  1506. private static _GetTextureWrapMode;
  1507. private static _GetTextureSamplingMode;
  1508. private static _GetTypedArrayConstructor;
  1509. private static _GetTypedArray;
  1510. private static _GetNumComponents;
  1511. private static _ValidateUri;
  1512. private static _GetDrawMode;
  1513. private _compileMaterialsAsync;
  1514. private _compileShadowGeneratorsAsync;
  1515. private _forEachExtensions;
  1516. private _applyExtensions;
  1517. private _extensionsOnLoading;
  1518. private _extensionsOnReady;
  1519. private _extensionsLoadSceneAsync;
  1520. private _extensionsLoadNodeAsync;
  1521. private _extensionsLoadCameraAsync;
  1522. private _extensionsLoadVertexDataAsync;
  1523. private _extensionsLoadMeshPrimitiveAsync;
  1524. private _extensionsLoadMaterialAsync;
  1525. private _extensionsCreateMaterial;
  1526. private _extensionsLoadMaterialPropertiesAsync;
  1527. private _extensionsLoadTextureInfoAsync;
  1528. private _extensionsLoadAnimationAsync;
  1529. private _extensionsLoadSkinAsync;
  1530. private _extensionsLoadUriAsync;
  1531. private _extensionsLoadBufferViewAsync;
  1532. private _extensionsLoadBufferAsync;
  1533. /**
  1534. * Helper method called by a loader extension to load an glTF extension.
  1535. * @param context The context when loading the asset
  1536. * @param property The glTF property to load the extension from
  1537. * @param extensionName The name of the extension to load
  1538. * @param actionAsync The action to run
  1539. * @returns The promise returned by actionAsync or null if the extension does not exist
  1540. */
  1541. static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  1542. /**
  1543. * Helper method called by a loader extension to load a glTF extra.
  1544. * @param context The context when loading the asset
  1545. * @param property The glTF property to load the extra from
  1546. * @param extensionName The name of the extension to load
  1547. * @param actionAsync The action to run
  1548. * @returns The promise returned by actionAsync or null if the extra does not exist
  1549. */
  1550. static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  1551. /**
  1552. * Checks for presence of an extension.
  1553. * @param name The name of the extension to check
  1554. * @returns A boolean indicating the presence of the given extension name in `extensionsUsed`
  1555. */
  1556. isExtensionUsed(name: string): boolean;
  1557. /**
  1558. * Increments the indentation level and logs a message.
  1559. * @param message The message to log
  1560. */
  1561. logOpen(message: string): void;
  1562. /**
  1563. * Decrements the indentation level.
  1564. */
  1565. logClose(): void;
  1566. /**
  1567. * Logs a message
  1568. * @param message The message to log
  1569. */
  1570. log(message: string): void;
  1571. /**
  1572. * Starts a performance counter.
  1573. * @param counterName The name of the performance counter
  1574. */
  1575. startPerformanceCounter(counterName: string): void;
  1576. /**
  1577. * Ends a performance counter.
  1578. * @param counterName The name of the performance counter
  1579. */
  1580. endPerformanceCounter(counterName: string): void;
  1581. }
  1582. }
  1583. declare module BABYLON.GLTF2.Loader.Extensions {
  1584. /**
  1585. * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md)
  1586. */
  1587. export class EXT_lights_image_based implements IGLTFLoaderExtension {
  1588. /**
  1589. * The name of this extension.
  1590. */
  1591. readonly name: string;
  1592. /**
  1593. * Defines whether this extension is enabled.
  1594. */
  1595. enabled: boolean;
  1596. private _loader;
  1597. private _lights?;
  1598. /** @hidden */
  1599. constructor(loader: GLTFLoader);
  1600. /** @hidden */
  1601. dispose(): void;
  1602. /** @hidden */
  1603. onLoading(): void;
  1604. /** @hidden */
  1605. loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
  1606. private _loadLightAsync;
  1607. }
  1608. }
  1609. declare module BABYLON.GLTF2.Loader.Extensions {
  1610. /**
  1611. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
  1612. */
  1613. export class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
  1614. /**
  1615. * The name of this extension.
  1616. */
  1617. readonly name: string;
  1618. /**
  1619. * The draco compression used to decode vertex data or DracoCompression.Default if not defined
  1620. */
  1621. dracoCompression?: DracoCompression;
  1622. /**
  1623. * Defines whether this extension is enabled.
  1624. */
  1625. enabled: boolean;
  1626. private _loader;
  1627. /** @hidden */
  1628. constructor(loader: GLTFLoader);
  1629. /** @hidden */
  1630. dispose(): void;
  1631. /** @hidden */
  1632. _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1633. }
  1634. }
  1635. declare module BABYLON.GLTF2.Loader.Extensions {
  1636. /**
  1637. * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual/README.md)
  1638. */
  1639. export class KHR_lights implements IGLTFLoaderExtension {
  1640. /**
  1641. * The name of this extension.
  1642. */
  1643. readonly name: string;
  1644. /**
  1645. * Defines whether this extension is enabled.
  1646. */
  1647. enabled: boolean;
  1648. private _loader;
  1649. private _lights?;
  1650. /** @hidden */
  1651. constructor(loader: GLTFLoader);
  1652. /** @hidden */
  1653. dispose(): void;
  1654. /** @hidden */
  1655. onLoading(): void;
  1656. /** @hidden */
  1657. loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
  1658. }
  1659. }
  1660. declare module BABYLON.GLTF2.Loader.Extensions {
  1661. /**
  1662. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
  1663. */
  1664. export class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension {
  1665. /**
  1666. * The name of this extension.
  1667. */
  1668. readonly name: string;
  1669. /**
  1670. * Defines whether this extension is enabled.
  1671. */
  1672. enabled: boolean;
  1673. /**
  1674. * Defines a number that determines the order the extensions are applied.
  1675. */
  1676. order: number;
  1677. private _loader;
  1678. /** @hidden */
  1679. constructor(loader: GLTFLoader);
  1680. /** @hidden */
  1681. dispose(): void;
  1682. /** @hidden */
  1683. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1684. private _loadSpecularGlossinessPropertiesAsync;
  1685. }
  1686. }
  1687. declare module BABYLON.GLTF2.Loader.Extensions {
  1688. /**
  1689. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
  1690. */
  1691. export class KHR_materials_unlit implements IGLTFLoaderExtension {
  1692. /**
  1693. * The name of this extension.
  1694. */
  1695. readonly name: string;
  1696. /**
  1697. * Defines whether this extension is enabled.
  1698. */
  1699. enabled: boolean;
  1700. /**
  1701. * Defines a number that determines the order the extensions are applied.
  1702. */
  1703. order: number;
  1704. private _loader;
  1705. /** @hidden */
  1706. constructor(loader: GLTFLoader);
  1707. /** @hidden */
  1708. dispose(): void;
  1709. /** @hidden */
  1710. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1711. private _loadUnlitPropertiesAsync;
  1712. }
  1713. }
  1714. declare module BABYLON.GLTF2.Loader.Extensions {
  1715. /**
  1716. * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1677)
  1717. * [Playground Sample](https://www.babylonjs-playground.com/#7F7PN6)
  1718. * !!! Experimental Extension Subject to Changes !!!
  1719. */
  1720. export class KHR_materials_clearcoat implements IGLTFLoaderExtension {
  1721. /**
  1722. * The name of this extension.
  1723. */
  1724. readonly name: string;
  1725. /**
  1726. * Defines whether this extension is enabled.
  1727. */
  1728. enabled: boolean;
  1729. /**
  1730. * Defines a number that determines the order the extensions are applied.
  1731. */
  1732. order: number;
  1733. private _loader;
  1734. /** @hidden */
  1735. constructor(loader: GLTFLoader);
  1736. /** @hidden */
  1737. dispose(): void;
  1738. /** @hidden */
  1739. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1740. private _loadClearCoatPropertiesAsync;
  1741. }
  1742. }
  1743. declare module BABYLON.GLTF2.Loader.Extensions {
  1744. /**
  1745. * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1688)
  1746. * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#1)
  1747. * !!! Experimental Extension Subject to Changes !!!
  1748. */
  1749. export class KHR_materials_sheen implements IGLTFLoaderExtension {
  1750. /**
  1751. * The name of this extension.
  1752. */
  1753. readonly name: string;
  1754. /**
  1755. * Defines whether this extension is enabled.
  1756. */
  1757. enabled: boolean;
  1758. /**
  1759. * Defines a number that determines the order the extensions are applied.
  1760. */
  1761. order: number;
  1762. private _loader;
  1763. /** @hidden */
  1764. constructor(loader: GLTFLoader);
  1765. /** @hidden */
  1766. dispose(): void;
  1767. /** @hidden */
  1768. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1769. private _loadSheenPropertiesAsync;
  1770. }
  1771. }
  1772. declare module BABYLON.GLTF2.Loader.Extensions {
  1773. /**
  1774. * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1677)
  1775. * !!! Experimental Extension Subject to Changes !!!
  1776. */
  1777. export class KHR_materials_specular implements IGLTFLoaderExtension {
  1778. /**
  1779. * The name of this extension.
  1780. */
  1781. readonly name: string;
  1782. /**
  1783. * Defines whether this extension is enabled.
  1784. */
  1785. enabled: boolean;
  1786. /**
  1787. * Defines a number that determines the order the extensions are applied.
  1788. */
  1789. order: number;
  1790. private _loader;
  1791. /** @hidden */
  1792. constructor(loader: GLTFLoader);
  1793. /** @hidden */
  1794. dispose(): void;
  1795. /** @hidden */
  1796. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1797. private _loadSpecularPropertiesAsync;
  1798. }
  1799. }
  1800. declare module BABYLON.GLTF2.Loader.Extensions {
  1801. /**
  1802. * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform/README.md)
  1803. */
  1804. export class KHR_texture_transform implements IGLTFLoaderExtension {
  1805. /**
  1806. * The name of this extension.
  1807. */
  1808. readonly name: string;
  1809. /**
  1810. * Defines whether this extension is enabled.
  1811. */
  1812. enabled: boolean;
  1813. private _loader;
  1814. /** @hidden */
  1815. constructor(loader: GLTFLoader);
  1816. /** @hidden */
  1817. dispose(): void;
  1818. /** @hidden */
  1819. loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1820. }
  1821. }
  1822. declare module BABYLON.GLTF2.Loader.Extensions {
  1823. /**
  1824. * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
  1825. */
  1826. export class MSFT_audio_emitter implements IGLTFLoaderExtension {
  1827. /**
  1828. * The name of this extension.
  1829. */
  1830. readonly name: string;
  1831. /**
  1832. * Defines whether this extension is enabled.
  1833. */
  1834. enabled: boolean;
  1835. private _loader;
  1836. private _clips;
  1837. private _emitters;
  1838. /** @hidden */
  1839. constructor(loader: GLTFLoader);
  1840. /** @hidden */
  1841. dispose(): void;
  1842. /** @hidden */
  1843. onLoading(): void;
  1844. /** @hidden */
  1845. loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
  1846. /** @hidden */
  1847. loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
  1848. /** @hidden */
  1849. loadAnimationAsync(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
  1850. private _loadClipAsync;
  1851. private _loadEmitterAsync;
  1852. private _getEventAction;
  1853. private _loadAnimationEventAsync;
  1854. }
  1855. }
  1856. declare module BABYLON.GLTF2.Loader.Extensions {
  1857. /**
  1858. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
  1859. */
  1860. export class MSFT_lod implements IGLTFLoaderExtension {
  1861. /**
  1862. * The name of this extension.
  1863. */
  1864. readonly name: string;
  1865. /**
  1866. * Defines whether this extension is enabled.
  1867. */
  1868. enabled: boolean;
  1869. /**
  1870. * Defines a number that determines the order the extensions are applied.
  1871. */
  1872. order: number;
  1873. /**
  1874. * Maximum number of LODs to load, starting from the lowest LOD.
  1875. */
  1876. maxLODsToLoad: number;
  1877. /**
  1878. * Observable raised when all node LODs of one level are loaded.
  1879. * The event data is the index of the loaded LOD starting from zero.
  1880. * Dispose the loader to cancel the loading of the next level of LODs.
  1881. */
  1882. onNodeLODsLoadedObservable: Observable<number>;
  1883. /**
  1884. * Observable raised when all material LODs of one level are loaded.
  1885. * The event data is the index of the loaded LOD starting from zero.
  1886. * Dispose the loader to cancel the loading of the next level of LODs.
  1887. */
  1888. onMaterialLODsLoadedObservable: Observable<number>;
  1889. private _loader;
  1890. private _nodeIndexLOD;
  1891. private _nodeSignalLODs;
  1892. private _nodePromiseLODs;
  1893. private _materialIndexLOD;
  1894. private _materialSignalLODs;
  1895. private _materialPromiseLODs;
  1896. private _indexLOD;
  1897. private _bufferLODs;
  1898. /** @hidden */
  1899. constructor(loader: GLTFLoader);
  1900. /** @hidden */
  1901. dispose(): void;
  1902. /** @hidden */
  1903. onReady(): void;
  1904. /** @hidden */
  1905. loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
  1906. /** @hidden */
  1907. _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  1908. /** @hidden */
  1909. _loadUriAsync(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>>;
  1910. /** @hidden */
  1911. loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>>;
  1912. private _loadBufferLOD;
  1913. /**
  1914. * Gets an array of LOD properties from lowest to highest.
  1915. */
  1916. private _getLODs;
  1917. private _disposeUnusedMaterials;
  1918. }
  1919. }
  1920. declare module BABYLON.GLTF2.Loader.Extensions {
  1921. /** @hidden */
  1922. export class MSFT_minecraftMesh implements IGLTFLoaderExtension {
  1923. readonly name: string;
  1924. enabled: boolean;
  1925. private _loader;
  1926. constructor(loader: GLTFLoader);
  1927. dispose(): void;
  1928. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1929. }
  1930. }
  1931. declare module BABYLON.GLTF2.Loader.Extensions {
  1932. /** @hidden */
  1933. export class MSFT_sRGBFactors implements IGLTFLoaderExtension {
  1934. readonly name: string;
  1935. enabled: boolean;
  1936. private _loader;
  1937. constructor(loader: GLTFLoader);
  1938. dispose(): void;
  1939. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1940. }
  1941. }
  1942. declare module BABYLON.GLTF2.Loader.Extensions {
  1943. /**
  1944. * Store glTF extras (if present) in BJS objects' metadata
  1945. */
  1946. export class ExtrasAsMetadata implements IGLTFLoaderExtension {
  1947. /**
  1948. * The name of this extension.
  1949. */
  1950. readonly name: string;
  1951. /**
  1952. * Defines whether this extension is enabled.
  1953. */
  1954. enabled: boolean;
  1955. private _loader;
  1956. private _assignExtras;
  1957. /** @hidden */
  1958. constructor(loader: GLTFLoader);
  1959. /** @hidden */
  1960. dispose(): void;
  1961. /** @hidden */
  1962. loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
  1963. /** @hidden */
  1964. loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
  1965. /** @hidden */
  1966. createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
  1967. }
  1968. }
  1969. declare module BABYLON {
  1970. /**
  1971. * Class reading and parsing the MTL file bundled with the obj file.
  1972. */
  1973. export class MTLFileLoader {
  1974. /**
  1975. * All material loaded from the mtl will be set here
  1976. */
  1977. materials: StandardMaterial[];
  1978. /**
  1979. * This function will read the mtl file and create each material described inside
  1980. * This function could be improve by adding :
  1981. * -some component missing (Ni, Tf...)
  1982. * -including the specific options available
  1983. *
  1984. * @param scene defines the scene the material will be created in
  1985. * @param data defines the mtl data to parse
  1986. * @param rootUrl defines the rooturl to use in order to load relative dependencies
  1987. */
  1988. parseMTL(scene: Scene, data: string | ArrayBuffer, rootUrl: string): void;
  1989. /**
  1990. * Gets the texture for the material.
  1991. *
  1992. * If the material is imported from input file,
  1993. * We sanitize the url to ensure it takes the textre from aside the material.
  1994. *
  1995. * @param rootUrl The root url to load from
  1996. * @param value The value stored in the mtl
  1997. * @return The Texture
  1998. */
  1999. private static _getTexture;
  2000. }
  2001. /**
  2002. * Options for loading OBJ/MTL files
  2003. */
  2004. type MeshLoadOptions = {
  2005. /**
  2006. * Defines if UVs are optimized by default during load.
  2007. */
  2008. OptimizeWithUV: boolean;
  2009. /**
  2010. * Defines custom scaling of UV coordinates of loaded meshes.
  2011. */
  2012. UVScaling: Vector2;
  2013. /**
  2014. * Invert model on y-axis (does a model scaling inversion)
  2015. */
  2016. InvertY: boolean;
  2017. /**
  2018. * Invert Y-Axis of referenced textures on load
  2019. */
  2020. InvertTextureY: boolean;
  2021. /**
  2022. * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
  2023. */
  2024. ImportVertexColors: boolean;
  2025. /**
  2026. * Compute the normals for the model, even if normals are present in the file.
  2027. */
  2028. ComputeNormals: boolean;
  2029. /**
  2030. * Skip loading the materials even if defined in the OBJ file (materials are ignored).
  2031. */
  2032. SkipMaterials: boolean;
  2033. /**
  2034. * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
  2035. */
  2036. MaterialLoadingFailsSilently: boolean;
  2037. };
  2038. /**
  2039. * OBJ file type loader.
  2040. * This is a babylon scene loader plugin.
  2041. */
  2042. export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
  2043. /**
  2044. * Defines if UVs are optimized by default during load.
  2045. */
  2046. static OPTIMIZE_WITH_UV: boolean;
  2047. /**
  2048. * Invert model on y-axis (does a model scaling inversion)
  2049. */
  2050. static INVERT_Y: boolean;
  2051. /**
  2052. * Invert Y-Axis of referenced textures on load
  2053. */
  2054. static INVERT_TEXTURE_Y: boolean;
  2055. /**
  2056. * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
  2057. */
  2058. static IMPORT_VERTEX_COLORS: boolean;
  2059. /**
  2060. * Compute the normals for the model, even if normals are present in the file.
  2061. */
  2062. static COMPUTE_NORMALS: boolean;
  2063. /**
  2064. * Defines custom scaling of UV coordinates of loaded meshes.
  2065. */
  2066. static UV_SCALING: Vector2;
  2067. /**
  2068. * Skip loading the materials even if defined in the OBJ file (materials are ignored).
  2069. */
  2070. static SKIP_MATERIALS: boolean;
  2071. /**
  2072. * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
  2073. *
  2074. * Defaults to true for backwards compatibility.
  2075. */
  2076. static MATERIAL_LOADING_FAILS_SILENTLY: boolean;
  2077. /**
  2078. * Defines the name of the plugin.
  2079. */
  2080. name: string;
  2081. /**
  2082. * Defines the extension the plugin is able to load.
  2083. */
  2084. extensions: string;
  2085. /** @hidden */
  2086. obj: RegExp;
  2087. /** @hidden */
  2088. group: RegExp;
  2089. /** @hidden */
  2090. mtllib: RegExp;
  2091. /** @hidden */
  2092. usemtl: RegExp;
  2093. /** @hidden */
  2094. smooth: RegExp;
  2095. /** @hidden */
  2096. vertexPattern: RegExp;
  2097. /** @hidden */
  2098. normalPattern: RegExp;
  2099. /** @hidden */
  2100. uvPattern: RegExp;
  2101. /** @hidden */
  2102. facePattern1: RegExp;
  2103. /** @hidden */
  2104. facePattern2: RegExp;
  2105. /** @hidden */
  2106. facePattern3: RegExp;
  2107. /** @hidden */
  2108. facePattern4: RegExp;
  2109. /** @hidden */
  2110. facePattern5: RegExp;
  2111. private _meshLoadOptions;
  2112. /**
  2113. * Creates loader for .OBJ files
  2114. *
  2115. * @param meshLoadOptions options for loading and parsing OBJ/MTL files.
  2116. */
  2117. constructor(meshLoadOptions?: MeshLoadOptions);
  2118. private static readonly currentMeshLoadOptions;
  2119. /**
  2120. * Calls synchronously the MTL file attached to this obj.
  2121. * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.
  2122. * Without this function materials are not displayed in the first frame (but displayed after).
  2123. * In consequence it is impossible to get material information in your HTML file
  2124. *
  2125. * @param url The URL of the MTL file
  2126. * @param rootUrl
  2127. * @param onSuccess Callback function to be called when the MTL file is loaded
  2128. * @private
  2129. */
  2130. private _loadMTL;
  2131. /**
  2132. * Instantiates a OBJ file loader plugin.
  2133. * @returns the created plugin
  2134. */
  2135. createPlugin(): ISceneLoaderPluginAsync | ISceneLoaderPlugin;
  2136. /**
  2137. * If the data string can be loaded directly.
  2138. *
  2139. * @param data string containing the file data
  2140. * @returns if the data can be loaded directly
  2141. */
  2142. canDirectLoad(data: string): boolean;
  2143. /**
  2144. * Imports one or more meshes from the loaded OBJ data and adds them to the scene
  2145. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  2146. * @param scene the scene the meshes should be added to
  2147. * @param data the OBJ data to load
  2148. * @param rootUrl root url to load from
  2149. * @param onProgress event that fires when loading progress has occured
  2150. * @param fileName Defines the name of the file to load
  2151. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  2152. */
  2153. importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  2154. meshes: AbstractMesh[];
  2155. particleSystems: IParticleSystem[];
  2156. skeletons: Skeleton[];
  2157. animationGroups: AnimationGroup[];
  2158. }>;
  2159. /**
  2160. * Imports all objects from the loaded OBJ data and adds them to the scene
  2161. * @param scene the scene the objects should be added to
  2162. * @param data the OBJ data to load
  2163. * @param rootUrl root url to load from
  2164. * @param onProgress event that fires when loading progress has occured
  2165. * @param fileName Defines the name of the file to load
  2166. * @returns a promise which completes when objects have been loaded to the scene
  2167. */
  2168. loadAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  2169. /**
  2170. * Load into an asset container.
  2171. * @param scene The scene to load into
  2172. * @param data The data to import
  2173. * @param rootUrl The root url for scene and resources
  2174. * @param onProgress The callback when the load progresses
  2175. * @param fileName Defines the name of the file to load
  2176. * @returns The loaded asset container
  2177. */
  2178. loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
  2179. /**
  2180. * Read the OBJ file and create an Array of meshes.
  2181. * Each mesh contains all information given by the OBJ and the MTL file.
  2182. * i.e. vertices positions and indices, optional normals values, optional UV values, optional material
  2183. *
  2184. * @param meshesNames
  2185. * @param scene Scene The scene where are displayed the data
  2186. * @param data String The content of the obj file
  2187. * @param rootUrl String The path to the folder
  2188. * @returns Array<AbstractMesh>
  2189. * @private
  2190. */
  2191. private _parseSolid;
  2192. }
  2193. }
  2194. declare module BABYLON {
  2195. /**
  2196. * STL file type loader.
  2197. * This is a babylon scene loader plugin.
  2198. */
  2199. export class STLFileLoader implements ISceneLoaderPlugin {
  2200. /** @hidden */
  2201. solidPattern: RegExp;
  2202. /** @hidden */
  2203. facetsPattern: RegExp;
  2204. /** @hidden */
  2205. normalPattern: RegExp;
  2206. /** @hidden */
  2207. vertexPattern: RegExp;
  2208. /**
  2209. * Defines the name of the plugin.
  2210. */
  2211. name: string;
  2212. /**
  2213. * Defines the extensions the stl loader is able to load.
  2214. * force data to come in as an ArrayBuffer
  2215. * we'll convert to string if it looks like it's an ASCII .stl
  2216. */
  2217. extensions: ISceneLoaderPluginExtensions;
  2218. /**
  2219. * Import meshes into a scene.
  2220. * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
  2221. * @param scene The scene to import into
  2222. * @param data The data to import
  2223. * @param rootUrl The root url for scene and resources
  2224. * @param meshes The meshes array to import into
  2225. * @param particleSystems The particle systems array to import into
  2226. * @param skeletons The skeletons array to import into
  2227. * @param onError The callback when import fails
  2228. * @returns True if successful or false otherwise
  2229. */
  2230. importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<IParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
  2231. /**
  2232. * Load into a scene.
  2233. * @param scene The scene to load into
  2234. * @param data The data to import
  2235. * @param rootUrl The root url for scene and resources
  2236. * @param onError The callback when import fails
  2237. * @returns true if successful or false otherwise
  2238. */
  2239. load(scene: Scene, data: any, rootUrl: string): boolean;
  2240. /**
  2241. * Load into an asset container.
  2242. * @param scene The scene to load into
  2243. * @param data The data to import
  2244. * @param rootUrl The root url for scene and resources
  2245. * @param onError The callback when import fails
  2246. * @returns The loaded asset container
  2247. */
  2248. loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
  2249. private _isBinary;
  2250. private _parseBinary;
  2251. private _parseASCII;
  2252. }
  2253. }