babylonjs.loaders.module.d.ts 162 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618
  1. /*BabylonJS Loaders*/
  2. // Dependencies for this module:
  3. // ../../../../Tools/Gulp/babylonjs
  4. // ../../../../Tools/Gulp/babylonjs-gltf2interface
  5. declare module 'babylonjs-loaders' {
  6. export * from "babylonjs-loaders/src/glTF";
  7. export * from "babylonjs-loaders/src/OBJ";
  8. export * from "babylonjs-loaders/src/STL";
  9. }
  10. declare module 'babylonjs-loaders/src/glTF' {
  11. export * from "babylonjs-loaders/src/glTF/glTFFileLoader";
  12. export * from "babylonjs-loaders/src/glTF/1.0";
  13. export * from "babylonjs-loaders/src/glTF/2.0";
  14. }
  15. declare module 'babylonjs-loaders/src/OBJ' {
  16. export * from "babylonjs-loaders/src/OBJ/objFileLoader";
  17. }
  18. declare module 'babylonjs-loaders/src/STL' {
  19. export * from "babylonjs-loaders/src/STL/stlFileLoader";
  20. }
  21. declare module 'babylonjs-loaders/src/glTF/glTFFileLoader' {
  22. import { IDisposable, Nullable, Scene, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory, Observable, SceneLoaderProgressEvent, AbstractMesh, IParticleSystem, Skeleton, AnimationGroup, BaseTexture, Material, Camera, ISceneLoaderPluginExtensions, ISceneLoaderPlugin, AssetContainer } from "babylonjs";
  23. import { IGLTFValidationResults } from "babylonjs-gltf2interface";
  24. /**
  25. * Mode that determines the coordinate system to use.
  26. */
  27. export enum GLTFLoaderCoordinateSystemMode {
  28. /**
  29. * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
  30. */
  31. AUTO = 0,
  32. /**
  33. * Sets the useRightHandedSystem flag on the scene.
  34. */
  35. FORCE_RIGHT_HANDED = 1
  36. }
  37. /**
  38. * Mode that determines what animations will start.
  39. */
  40. export enum GLTFLoaderAnimationStartMode {
  41. /**
  42. * No animation will start.
  43. */
  44. NONE = 0,
  45. /**
  46. * The first animation will start.
  47. */
  48. FIRST = 1,
  49. /**
  50. * All animations will start.
  51. */
  52. ALL = 2
  53. }
  54. /**
  55. * Interface that contains the data for the glTF asset.
  56. */
  57. export interface IGLTFLoaderData {
  58. /**
  59. * Object that represents the glTF JSON.
  60. */
  61. json: Object;
  62. /**
  63. * The BIN chunk of a binary glTF.
  64. */
  65. bin: Nullable<ArrayBufferView>;
  66. }
  67. /**
  68. * Interface for extending the loader.
  69. */
  70. export interface IGLTFLoaderExtension {
  71. /**
  72. * The name of this extension.
  73. */
  74. readonly name: string;
  75. /**
  76. * Defines whether this extension is enabled.
  77. */
  78. enabled: boolean;
  79. }
  80. /**
  81. * Loader state.
  82. */
  83. export enum GLTFLoaderState {
  84. /**
  85. * The asset is loading.
  86. */
  87. LOADING = 0,
  88. /**
  89. * The asset is ready for rendering.
  90. */
  91. READY = 1,
  92. /**
  93. * The asset is completely loaded.
  94. */
  95. COMPLETE = 2
  96. }
  97. /** @hidden */
  98. export interface IGLTFLoader extends IDisposable {
  99. readonly state: Nullable<GLTFLoaderState>;
  100. importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string) => Promise<{
  101. meshes: AbstractMesh[];
  102. particleSystems: IParticleSystem[];
  103. skeletons: Skeleton[];
  104. animationGroups: AnimationGroup[];
  105. }>;
  106. loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;
  107. }
  108. /**
  109. * File loader for loading glTF files into a scene.
  110. */
  111. export class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
  112. /** @hidden */
  113. static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
  114. /** @hidden */
  115. static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
  116. /**
  117. * Raised when the asset has been parsed
  118. */
  119. onParsedObservable: Observable<IGLTFLoaderData>;
  120. /**
  121. * Raised when the asset has been parsed
  122. */
  123. onParsed: (loaderData: IGLTFLoaderData) => void;
  124. /**
  125. * 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.
  126. * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
  127. * Defaults to true.
  128. * @hidden
  129. */
  130. static IncrementalLoading: boolean;
  131. /**
  132. * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
  133. * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
  134. * @hidden
  135. */
  136. static HomogeneousCoordinates: boolean;
  137. /**
  138. * The coordinate system mode. Defaults to AUTO.
  139. */
  140. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  141. /**
  142. * The animation start mode. Defaults to FIRST.
  143. */
  144. animationStartMode: GLTFLoaderAnimationStartMode;
  145. /**
  146. * Defines if the loader should compile materials before raising the success callback. Defaults to false.
  147. */
  148. compileMaterials: boolean;
  149. /**
  150. * Defines if the loader should also compile materials with clip planes. Defaults to false.
  151. */
  152. useClipPlane: boolean;
  153. /**
  154. * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.
  155. */
  156. compileShadowGenerators: boolean;
  157. /**
  158. * Defines if the Alpha blended materials are only applied as coverage.
  159. * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.
  160. * If true, no extra effects are applied to transparent pixels.
  161. */
  162. transparencyAsCoverage: boolean;
  163. /**
  164. * Function called before loading a url referenced by the asset.
  165. */
  166. preprocessUrlAsync: (url: string) => Promise<string>;
  167. /**
  168. * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  169. */
  170. readonly onMeshLoadedObservable: Observable<AbstractMesh>;
  171. /**
  172. * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  173. */
  174. onMeshLoaded: (mesh: AbstractMesh) => void;
  175. /**
  176. * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
  177. */
  178. readonly onTextureLoadedObservable: Observable<BaseTexture>;
  179. /**
  180. * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
  181. */
  182. onTextureLoaded: (texture: BaseTexture) => void;
  183. /**
  184. * Observable raised when the loader creates a material after parsing the glTF properties of the material.
  185. */
  186. readonly onMaterialLoadedObservable: Observable<Material>;
  187. /**
  188. * Callback raised when the loader creates a material after parsing the glTF properties of the material.
  189. */
  190. onMaterialLoaded: (material: Material) => void;
  191. /**
  192. * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.
  193. */
  194. readonly onCameraLoadedObservable: Observable<Camera>;
  195. /**
  196. * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
  197. */
  198. onCameraLoaded: (camera: Camera) => void;
  199. /**
  200. * Observable raised when the asset is completely loaded, immediately before the loader is disposed.
  201. * For assets with LODs, raised when all of the LODs are complete.
  202. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
  203. */
  204. readonly onCompleteObservable: Observable<void>;
  205. /**
  206. * Callback raised when the asset is completely loaded, immediately before the loader is disposed.
  207. * For assets with LODs, raised when all of the LODs are complete.
  208. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
  209. */
  210. onComplete: () => void;
  211. /**
  212. * Observable raised when an error occurs.
  213. */
  214. readonly onErrorObservable: Observable<any>;
  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. /**
  224. * Callback raised after the loader is disposed.
  225. */
  226. onDispose: () => void;
  227. /**
  228. * Observable raised after a loader extension is created.
  229. * Set additional options for a loader extension in this event.
  230. */
  231. readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
  232. /**
  233. * Callback raised after a loader extension is created.
  234. */
  235. onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
  236. /**
  237. * Defines if the loader logging is enabled.
  238. */
  239. loggingEnabled: boolean;
  240. /**
  241. * Defines if the loader should capture performance counters.
  242. */
  243. capturePerformanceCounters: boolean;
  244. /**
  245. * Defines if the loader should validate the asset.
  246. */
  247. validate: boolean;
  248. /**
  249. * Observable raised after validation when validate is set to true. The event data is the result of the validation.
  250. */
  251. readonly onValidatedObservable: Observable<IGLTFValidationResults>;
  252. /**
  253. * Callback raised after a loader extension is created.
  254. */
  255. onValidated: (results: IGLTFValidationResults) => void;
  256. /**
  257. * Name of the loader ("gltf")
  258. */
  259. name: string;
  260. /**
  261. * Supported file extensions of the loader (.gltf, .glb)
  262. */
  263. extensions: ISceneLoaderPluginExtensions;
  264. /**
  265. * Disposes the loader, releases resources during load, and cancels any outstanding requests.
  266. */
  267. dispose(): void;
  268. /** @hidden */
  269. _clear(): void;
  270. /**
  271. * Imports one or more meshes from the loaded glTF data and adds them to the scene
  272. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  273. * @param scene the scene the meshes should be added to
  274. * @param data the glTF data to load
  275. * @param rootUrl root url to load from
  276. * @param onProgress event that fires when loading progress has occured
  277. * @param fileName Defines the name of the file to load
  278. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  279. */
  280. importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  281. meshes: AbstractMesh[];
  282. particleSystems: IParticleSystem[];
  283. skeletons: Skeleton[];
  284. animationGroups: AnimationGroup[];
  285. }>;
  286. /**
  287. * Imports all objects from the loaded glTF data and adds them to the scene
  288. * @param scene the scene the objects should be added to
  289. * @param data the glTF data to load
  290. * @param rootUrl root url to load from
  291. * @param onProgress event that fires when loading progress has occured
  292. * @param fileName Defines the name of the file to load
  293. * @returns a promise which completes when objects have been loaded to the scene
  294. */
  295. loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  296. /**
  297. * Load into an asset container.
  298. * @param scene The scene to load into
  299. * @param data The data to import
  300. * @param rootUrl The root url for scene and resources
  301. * @param onProgress The callback when the load progresses
  302. * @param fileName Defines the name of the file to load
  303. * @returns The loaded asset container
  304. */
  305. loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
  306. /**
  307. * If the data string can be loaded directly.
  308. * @param data string contianing the file data
  309. * @returns if the data can be loaded directly
  310. */
  311. canDirectLoad(data: string): boolean;
  312. /**
  313. * Rewrites a url by combining a root url and response url.
  314. */
  315. rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
  316. /**
  317. * Instantiates a glTF file loader plugin.
  318. * @returns the created plugin
  319. */
  320. createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  321. /**
  322. * The loader state or null if the loader is not active.
  323. */
  324. readonly loaderState: Nullable<GLTFLoaderState>;
  325. /**
  326. * Returns a promise that resolves when the asset is completely loaded.
  327. * @returns a promise that resolves when the asset is completely loaded.
  328. */
  329. whenCompleteAsync(): Promise<void>;
  330. /** @hidden */
  331. _log: (message: string) => void;
  332. /** @hidden */
  333. _logOpen(message: string): void;
  334. /** @hidden */
  335. _logClose(): void;
  336. /** @hidden */
  337. _startPerformanceCounter: (counterName: string) => void;
  338. /** @hidden */
  339. _endPerformanceCounter: (counterName: string) => void;
  340. }
  341. }
  342. declare module 'babylonjs-loaders/src/glTF/1.0' {
  343. export * from "babylonjs-loaders/src/glTF/1.0/glTFBinaryExtension";
  344. export * from "babylonjs-loaders/src/glTF/1.0/glTF1Loader";
  345. export * from "babylonjs-loaders/src/glTF/1.0/glTFLoaderExtension";
  346. export * from "babylonjs-loaders/src/glTF/1.0/glTFLoaderInterfaces";
  347. export * from "babylonjs-loaders/src/glTF/1.0/glTFLoaderUtils";
  348. export * from "babylonjs-loaders/src/glTF/1.0/glTFMaterialsCommonExtension";
  349. }
  350. declare module 'babylonjs-loaders/src/glTF/2.0' {
  351. export * from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  352. export * from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  353. export * from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  354. export * from "babylonjs-loaders/src/glTF/2.0/Extensions";
  355. }
  356. declare module 'babylonjs-loaders/src/OBJ/objFileLoader' {
  357. import { StandardMaterial, Scene, ISceneLoaderPluginAsync, SceneLoaderProgressEvent, AbstractMesh, IParticleSystem, Skeleton, AnimationGroup, AssetContainer } from "babylonjs";
  358. /**
  359. * Class reading and parsing the MTL file bundled with the obj file.
  360. */
  361. export class MTLFileLoader {
  362. /**
  363. * All material loaded from the mtl will be set here
  364. */
  365. materials: StandardMaterial[];
  366. /**
  367. * This function will read the mtl file and create each material described inside
  368. * This function could be improve by adding :
  369. * -some component missing (Ni, Tf...)
  370. * -including the specific options available
  371. *
  372. * @param scene defines the scene the material will be created in
  373. * @param data defines the mtl data to parse
  374. * @param rootUrl defines the rooturl to use in order to load relative dependencies
  375. */
  376. parseMTL(scene: Scene, data: string | ArrayBuffer, rootUrl: string): void;
  377. }
  378. /**
  379. * OBJ file type loader.
  380. * This is a babylon scene loader plugin.
  381. */
  382. export class OBJFileLoader implements ISceneLoaderPluginAsync {
  383. /**
  384. * Defines if UVs are optimized by default during load.
  385. */
  386. static OPTIMIZE_WITH_UV: boolean;
  387. /**
  388. * Defines if Y is inverted by default during load.
  389. */
  390. static INVERT_Y: boolean;
  391. /**
  392. * Defines the name of the plugin.
  393. */
  394. name: string;
  395. /**
  396. * Defines the extension the plugin is able to load.
  397. */
  398. extensions: string;
  399. /** @hidden */
  400. obj: RegExp;
  401. /** @hidden */
  402. group: RegExp;
  403. /** @hidden */
  404. mtllib: RegExp;
  405. /** @hidden */
  406. usemtl: RegExp;
  407. /** @hidden */
  408. smooth: RegExp;
  409. /** @hidden */
  410. vertexPattern: RegExp;
  411. /** @hidden */
  412. normalPattern: RegExp;
  413. /** @hidden */
  414. uvPattern: RegExp;
  415. /** @hidden */
  416. facePattern1: RegExp;
  417. /** @hidden */
  418. facePattern2: RegExp;
  419. /** @hidden */
  420. facePattern3: RegExp;
  421. /** @hidden */
  422. facePattern4: RegExp;
  423. /** @hidden */
  424. facePattern5: RegExp;
  425. /**
  426. * Imports one or more meshes from the loaded glTF data and adds them to the scene
  427. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  428. * @param scene the scene the meshes should be added to
  429. * @param data the glTF data to load
  430. * @param rootUrl root url to load from
  431. * @param onProgress event that fires when loading progress has occured
  432. * @param fileName Defines the name of the file to load
  433. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  434. */
  435. importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  436. meshes: AbstractMesh[];
  437. particleSystems: IParticleSystem[];
  438. skeletons: Skeleton[];
  439. animationGroups: AnimationGroup[];
  440. }>;
  441. /**
  442. * Imports all objects from the loaded glTF data and adds them to the scene
  443. * @param scene the scene the objects should be added to
  444. * @param data the glTF data to load
  445. * @param rootUrl root url to load from
  446. * @param onProgress event that fires when loading progress has occured
  447. * @param fileName Defines the name of the file to load
  448. * @returns a promise which completes when objects have been loaded to the scene
  449. */
  450. loadAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  451. /**
  452. * Load into an asset container.
  453. * @param scene The scene to load into
  454. * @param data The data to import
  455. * @param rootUrl The root url for scene and resources
  456. * @param onProgress The callback when the load progresses
  457. * @param fileName Defines the name of the file to load
  458. * @returns The loaded asset container
  459. */
  460. loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
  461. }
  462. }
  463. declare module 'babylonjs-loaders/src/STL/stlFileLoader' {
  464. import { ISceneLoaderPlugin, ISceneLoaderPluginExtensions, Scene, Nullable, AbstractMesh, IParticleSystem, Skeleton, AssetContainer } from "babylonjs";
  465. /**
  466. * STL file type loader.
  467. * This is a babylon scene loader plugin.
  468. */
  469. export class STLFileLoader implements ISceneLoaderPlugin {
  470. /** @hidden */
  471. solidPattern: RegExp;
  472. /** @hidden */
  473. facetsPattern: RegExp;
  474. /** @hidden */
  475. normalPattern: RegExp;
  476. /** @hidden */
  477. vertexPattern: RegExp;
  478. /**
  479. * Defines the name of the plugin.
  480. */
  481. name: string;
  482. /**
  483. * Defines the extensions the stl loader is able to load.
  484. * force data to come in as an ArrayBuffer
  485. * we'll convert to string if it looks like it's an ASCII .stl
  486. */
  487. extensions: ISceneLoaderPluginExtensions;
  488. /**
  489. * Import meshes into a scene.
  490. * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
  491. * @param scene The scene to import into
  492. * @param data The data to import
  493. * @param rootUrl The root url for scene and resources
  494. * @param meshes The meshes array to import into
  495. * @param particleSystems The particle systems array to import into
  496. * @param skeletons The skeletons array to import into
  497. * @param onError The callback when import fails
  498. * @returns True if successful or false otherwise
  499. */
  500. importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<IParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
  501. /**
  502. * Load into a scene.
  503. * @param scene The scene to load into
  504. * @param data The data to import
  505. * @param rootUrl The root url for scene and resources
  506. * @param onError The callback when import fails
  507. * @returns true if successful or false otherwise
  508. */
  509. load(scene: Scene, data: any, rootUrl: string): boolean;
  510. /**
  511. * Load into an asset container.
  512. * @param scene The scene to load into
  513. * @param data The data to import
  514. * @param rootUrl The root url for scene and resources
  515. * @param onError The callback when import fails
  516. * @returns The loaded asset container
  517. */
  518. loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
  519. }
  520. }
  521. declare module 'babylonjs-loaders/src/glTF/1.0/glTFBinaryExtension' {
  522. import { GLTFLoaderExtension } from "babylonjs-loaders/src/glTF/1.0/glTFLoaderExtension";
  523. import { Scene } from "babylonjs";
  524. import { IGLTFLoaderData } from "babylonjs-loaders/src/glTF/glTFFileLoader";
  525. import { IGLTFRuntime } from "babylonjs-loaders/src/glTF/1.0/glTFLoaderInterfaces";
  526. /** @hidden */
  527. export class GLTFBinaryExtension extends GLTFLoaderExtension {
  528. constructor();
  529. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  530. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  531. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  532. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  533. }
  534. }
  535. declare module 'babylonjs-loaders/src/glTF/1.0/glTF1Loader' {
  536. import { IGLTFRuntime } from "babylonjs-loaders/src/glTF/1.0/glTFLoaderInterfaces";
  537. import { Nullable, Skeleton, Material, AbstractMesh, Texture, Scene, SceneLoaderProgressEvent, IParticleSystem, AnimationGroup } from "babylonjs";
  538. import { IGLTFLoader, GLTFLoaderState, IGLTFLoaderData } from "babylonjs-loaders/src/glTF/glTFFileLoader";
  539. import { GLTFLoaderExtension } from "babylonjs-loaders/src/glTF/1.0/glTFLoaderExtension";
  540. /**
  541. * Implementation of the base glTF spec
  542. * @hidden
  543. */
  544. export class GLTFLoaderBase {
  545. static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
  546. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  547. static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
  548. static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  549. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void;
  550. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  551. }
  552. /**
  553. * glTF V1 Loader
  554. * @hidden
  555. */
  556. export class GLTF1Loader implements IGLTFLoader {
  557. static Extensions: {
  558. [name: string]: GLTFLoaderExtension;
  559. };
  560. static RegisterExtension(extension: GLTFLoaderExtension): void;
  561. state: Nullable<GLTFLoaderState>;
  562. dispose(): void;
  563. /**
  564. * Imports one or more meshes from a loaded gltf file and adds them to the scene
  565. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  566. * @param scene the scene the meshes should be added to
  567. * @param data gltf data containing information of the meshes in a loaded file
  568. * @param rootUrl root url to load from
  569. * @param onProgress event that fires when loading progress has occured
  570. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  571. */
  572. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
  573. meshes: AbstractMesh[];
  574. particleSystems: IParticleSystem[];
  575. skeletons: Skeleton[];
  576. animationGroups: AnimationGroup[];
  577. }>;
  578. /**
  579. * Imports all objects from a loaded gltf file and adds them to the scene
  580. * @param scene the scene the objects should be added to
  581. * @param data gltf data containing information of the meshes in a loaded file
  582. * @param rootUrl root url to load from
  583. * @param onProgress event that fires when loading progress has occured
  584. * @returns a promise which completes when objects have been loaded to the scene
  585. */
  586. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
  587. }
  588. }
  589. declare module 'babylonjs-loaders/src/glTF/1.0/glTFLoaderExtension' {
  590. import { Scene, Texture, Material } from "babylonjs";
  591. import { IGLTFLoaderData } from "babylonjs-loaders/src/glTF/glTFFileLoader";
  592. import { IGLTFRuntime } from "babylonjs-loaders/src/glTF/1.0/glTFLoaderInterfaces";
  593. /** @hidden */
  594. export abstract class GLTFLoaderExtension {
  595. constructor(name: string);
  596. readonly name: string;
  597. /**
  598. * Defines an override for loading the runtime
  599. * Return true to stop further extensions from loading the runtime
  600. */
  601. loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
  602. /**
  603. * Defines an onverride for creating gltf runtime
  604. * Return true to stop further extensions from creating the runtime
  605. */
  606. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
  607. /**
  608. * Defines an override for loading buffers
  609. * Return true to stop further extensions from loading this buffer
  610. */
  611. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
  612. /**
  613. * Defines an override for loading texture buffers
  614. * Return true to stop further extensions from loading this texture data
  615. */
  616. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  617. /**
  618. * Defines an override for creating textures
  619. * Return true to stop further extensions from loading this texture
  620. */
  621. createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
  622. /**
  623. * Defines an override for loading shader strings
  624. * Return true to stop further extensions from loading this shader data
  625. */
  626. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  627. /**
  628. * Defines an override for loading materials
  629. * Return true to stop further extensions from loading this material
  630. */
  631. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  632. static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): void;
  633. static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void;
  634. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  635. static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
  636. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void;
  637. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
  638. }
  639. }
  640. declare module 'babylonjs-loaders/src/glTF/1.0/glTFLoaderInterfaces' {
  641. import { Texture, Skeleton, Scene, Bone, Node } from "babylonjs";
  642. /**
  643. * Enums
  644. * @hidden
  645. */
  646. export enum EComponentType {
  647. BYTE = 5120,
  648. UNSIGNED_BYTE = 5121,
  649. SHORT = 5122,
  650. UNSIGNED_SHORT = 5123,
  651. FLOAT = 5126
  652. }
  653. /** @hidden */
  654. export enum EShaderType {
  655. FRAGMENT = 35632,
  656. VERTEX = 35633
  657. }
  658. /** @hidden */
  659. export enum EParameterType {
  660. BYTE = 5120,
  661. UNSIGNED_BYTE = 5121,
  662. SHORT = 5122,
  663. UNSIGNED_SHORT = 5123,
  664. INT = 5124,
  665. UNSIGNED_INT = 5125,
  666. FLOAT = 5126,
  667. FLOAT_VEC2 = 35664,
  668. FLOAT_VEC3 = 35665,
  669. FLOAT_VEC4 = 35666,
  670. INT_VEC2 = 35667,
  671. INT_VEC3 = 35668,
  672. INT_VEC4 = 35669,
  673. BOOL = 35670,
  674. BOOL_VEC2 = 35671,
  675. BOOL_VEC3 = 35672,
  676. BOOL_VEC4 = 35673,
  677. FLOAT_MAT2 = 35674,
  678. FLOAT_MAT3 = 35675,
  679. FLOAT_MAT4 = 35676,
  680. SAMPLER_2D = 35678
  681. }
  682. /** @hidden */
  683. export enum ETextureWrapMode {
  684. CLAMP_TO_EDGE = 33071,
  685. MIRRORED_REPEAT = 33648,
  686. REPEAT = 10497
  687. }
  688. /** @hidden */
  689. export enum ETextureFilterType {
  690. NEAREST = 9728,
  691. LINEAR = 9728,
  692. NEAREST_MIPMAP_NEAREST = 9984,
  693. LINEAR_MIPMAP_NEAREST = 9985,
  694. NEAREST_MIPMAP_LINEAR = 9986,
  695. LINEAR_MIPMAP_LINEAR = 9987
  696. }
  697. /** @hidden */
  698. export enum ETextureFormat {
  699. ALPHA = 6406,
  700. RGB = 6407,
  701. RGBA = 6408,
  702. LUMINANCE = 6409,
  703. LUMINANCE_ALPHA = 6410
  704. }
  705. /** @hidden */
  706. export enum ECullingType {
  707. FRONT = 1028,
  708. BACK = 1029,
  709. FRONT_AND_BACK = 1032
  710. }
  711. /** @hidden */
  712. export enum EBlendingFunction {
  713. ZERO = 0,
  714. ONE = 1,
  715. SRC_COLOR = 768,
  716. ONE_MINUS_SRC_COLOR = 769,
  717. DST_COLOR = 774,
  718. ONE_MINUS_DST_COLOR = 775,
  719. SRC_ALPHA = 770,
  720. ONE_MINUS_SRC_ALPHA = 771,
  721. DST_ALPHA = 772,
  722. ONE_MINUS_DST_ALPHA = 773,
  723. CONSTANT_COLOR = 32769,
  724. ONE_MINUS_CONSTANT_COLOR = 32770,
  725. CONSTANT_ALPHA = 32771,
  726. ONE_MINUS_CONSTANT_ALPHA = 32772,
  727. SRC_ALPHA_SATURATE = 776
  728. }
  729. /** @hidden */
  730. export interface IGLTFProperty {
  731. extensions?: {
  732. [key: string]: any;
  733. };
  734. extras?: Object;
  735. }
  736. /** @hidden */
  737. export interface IGLTFChildRootProperty extends IGLTFProperty {
  738. name?: string;
  739. }
  740. /** @hidden */
  741. export interface IGLTFAccessor extends IGLTFChildRootProperty {
  742. bufferView: string;
  743. byteOffset: number;
  744. byteStride: number;
  745. count: number;
  746. type: string;
  747. componentType: EComponentType;
  748. max?: number[];
  749. min?: number[];
  750. name?: string;
  751. }
  752. /** @hidden */
  753. export interface IGLTFBufferView extends IGLTFChildRootProperty {
  754. buffer: string;
  755. byteOffset: number;
  756. byteLength: number;
  757. byteStride: number;
  758. target?: number;
  759. }
  760. /** @hidden */
  761. export interface IGLTFBuffer extends IGLTFChildRootProperty {
  762. uri: string;
  763. byteLength?: number;
  764. type?: string;
  765. }
  766. /** @hidden */
  767. export interface IGLTFShader extends IGLTFChildRootProperty {
  768. uri: string;
  769. type: EShaderType;
  770. }
  771. /** @hidden */
  772. export interface IGLTFProgram extends IGLTFChildRootProperty {
  773. attributes: string[];
  774. fragmentShader: string;
  775. vertexShader: string;
  776. }
  777. /** @hidden */
  778. export interface IGLTFTechniqueParameter {
  779. type: number;
  780. count?: number;
  781. semantic?: string;
  782. node?: string;
  783. value?: number | boolean | string | Array<any>;
  784. source?: string;
  785. babylonValue?: any;
  786. }
  787. /** @hidden */
  788. export interface IGLTFTechniqueCommonProfile {
  789. lightingModel: string;
  790. texcoordBindings: Object;
  791. parameters?: Array<any>;
  792. }
  793. /** @hidden */
  794. export interface IGLTFTechniqueStatesFunctions {
  795. blendColor?: number[];
  796. blendEquationSeparate?: number[];
  797. blendFuncSeparate?: number[];
  798. colorMask: boolean[];
  799. cullFace: number[];
  800. }
  801. /** @hidden */
  802. export interface IGLTFTechniqueStates {
  803. enable: number[];
  804. functions: IGLTFTechniqueStatesFunctions;
  805. }
  806. /** @hidden */
  807. export interface IGLTFTechnique extends IGLTFChildRootProperty {
  808. parameters: {
  809. [key: string]: IGLTFTechniqueParameter;
  810. };
  811. program: string;
  812. attributes: {
  813. [key: string]: string;
  814. };
  815. uniforms: {
  816. [key: string]: string;
  817. };
  818. states: IGLTFTechniqueStates;
  819. }
  820. /** @hidden */
  821. export interface IGLTFMaterial extends IGLTFChildRootProperty {
  822. technique?: string;
  823. values: string[];
  824. }
  825. /** @hidden */
  826. export interface IGLTFMeshPrimitive extends IGLTFProperty {
  827. attributes: {
  828. [key: string]: string;
  829. };
  830. indices: string;
  831. material: string;
  832. mode?: number;
  833. }
  834. /** @hidden */
  835. export interface IGLTFMesh extends IGLTFChildRootProperty {
  836. primitives: IGLTFMeshPrimitive[];
  837. }
  838. /** @hidden */
  839. export interface IGLTFImage extends IGLTFChildRootProperty {
  840. uri: string;
  841. }
  842. /** @hidden */
  843. export interface IGLTFSampler extends IGLTFChildRootProperty {
  844. magFilter?: number;
  845. minFilter?: number;
  846. wrapS?: number;
  847. wrapT?: number;
  848. }
  849. /** @hidden */
  850. export interface IGLTFTexture extends IGLTFChildRootProperty {
  851. sampler: string;
  852. source: string;
  853. format?: ETextureFormat;
  854. internalFormat?: ETextureFormat;
  855. target?: number;
  856. type?: number;
  857. babylonTexture?: Texture;
  858. }
  859. /** @hidden */
  860. export interface IGLTFAmbienLight {
  861. color?: number[];
  862. }
  863. /** @hidden */
  864. export interface IGLTFDirectionalLight {
  865. color?: number[];
  866. }
  867. /** @hidden */
  868. export interface IGLTFPointLight {
  869. color?: number[];
  870. constantAttenuation?: number;
  871. linearAttenuation?: number;
  872. quadraticAttenuation?: number;
  873. }
  874. /** @hidden */
  875. export interface IGLTFSpotLight {
  876. color?: number[];
  877. constantAttenuation?: number;
  878. fallOfAngle?: number;
  879. fallOffExponent?: number;
  880. linearAttenuation?: number;
  881. quadraticAttenuation?: number;
  882. }
  883. /** @hidden */
  884. export interface IGLTFLight extends IGLTFChildRootProperty {
  885. type: string;
  886. }
  887. /** @hidden */
  888. export interface IGLTFCameraOrthographic {
  889. xmag: number;
  890. ymag: number;
  891. zfar: number;
  892. znear: number;
  893. }
  894. /** @hidden */
  895. export interface IGLTFCameraPerspective {
  896. aspectRatio: number;
  897. yfov: number;
  898. zfar: number;
  899. znear: number;
  900. }
  901. /** @hidden */
  902. export interface IGLTFCamera extends IGLTFChildRootProperty {
  903. type: string;
  904. }
  905. /** @hidden */
  906. export interface IGLTFAnimationChannelTarget {
  907. id: string;
  908. path: string;
  909. }
  910. /** @hidden */
  911. export interface IGLTFAnimationChannel {
  912. sampler: string;
  913. target: IGLTFAnimationChannelTarget;
  914. }
  915. /** @hidden */
  916. export interface IGLTFAnimationSampler {
  917. input: string;
  918. output: string;
  919. interpolation?: string;
  920. }
  921. /** @hidden */
  922. export interface IGLTFAnimation extends IGLTFChildRootProperty {
  923. channels?: IGLTFAnimationChannel[];
  924. parameters?: {
  925. [key: string]: string;
  926. };
  927. samplers?: {
  928. [key: string]: IGLTFAnimationSampler;
  929. };
  930. }
  931. /** @hidden */
  932. export interface IGLTFNodeInstanceSkin {
  933. skeletons: string[];
  934. skin: string;
  935. meshes: string[];
  936. }
  937. /** @hidden */
  938. export interface IGLTFSkins extends IGLTFChildRootProperty {
  939. bindShapeMatrix: number[];
  940. inverseBindMatrices: string;
  941. jointNames: string[];
  942. babylonSkeleton?: Skeleton;
  943. }
  944. /** @hidden */
  945. export interface IGLTFNode extends IGLTFChildRootProperty {
  946. camera?: string;
  947. children: string[];
  948. skin?: string;
  949. jointName?: string;
  950. light?: string;
  951. matrix: number[];
  952. mesh?: string;
  953. meshes?: string[];
  954. rotation?: number[];
  955. scale?: number[];
  956. translation?: number[];
  957. babylonNode?: Node;
  958. }
  959. /** @hidden */
  960. export interface IGLTFScene extends IGLTFChildRootProperty {
  961. nodes: string[];
  962. }
  963. /** @hidden */
  964. export interface IGLTFRuntime {
  965. extensions: {
  966. [key: string]: any;
  967. };
  968. accessors: {
  969. [key: string]: IGLTFAccessor;
  970. };
  971. buffers: {
  972. [key: string]: IGLTFBuffer;
  973. };
  974. bufferViews: {
  975. [key: string]: IGLTFBufferView;
  976. };
  977. meshes: {
  978. [key: string]: IGLTFMesh;
  979. };
  980. lights: {
  981. [key: string]: IGLTFLight;
  982. };
  983. cameras: {
  984. [key: string]: IGLTFCamera;
  985. };
  986. nodes: {
  987. [key: string]: IGLTFNode;
  988. };
  989. images: {
  990. [key: string]: IGLTFImage;
  991. };
  992. textures: {
  993. [key: string]: IGLTFTexture;
  994. };
  995. shaders: {
  996. [key: string]: IGLTFShader;
  997. };
  998. programs: {
  999. [key: string]: IGLTFProgram;
  1000. };
  1001. samplers: {
  1002. [key: string]: IGLTFSampler;
  1003. };
  1004. techniques: {
  1005. [key: string]: IGLTFTechnique;
  1006. };
  1007. materials: {
  1008. [key: string]: IGLTFMaterial;
  1009. };
  1010. animations: {
  1011. [key: string]: IGLTFAnimation;
  1012. };
  1013. skins: {
  1014. [key: string]: IGLTFSkins;
  1015. };
  1016. currentScene?: Object;
  1017. scenes: {
  1018. [key: string]: IGLTFScene;
  1019. };
  1020. extensionsUsed: string[];
  1021. extensionsRequired?: string[];
  1022. buffersCount: number;
  1023. shaderscount: number;
  1024. scene: Scene;
  1025. rootUrl: string;
  1026. loadedBufferCount: number;
  1027. loadedBufferViews: {
  1028. [name: string]: ArrayBufferView;
  1029. };
  1030. loadedShaderCount: number;
  1031. importOnlyMeshes: boolean;
  1032. importMeshesNames?: string[];
  1033. dummyNodes: Node[];
  1034. }
  1035. /** @hidden */
  1036. export interface INodeToRoot {
  1037. bone: Bone;
  1038. node: IGLTFNode;
  1039. id: string;
  1040. }
  1041. /** @hidden */
  1042. export interface IJointNode {
  1043. node: IGLTFNode;
  1044. id: string;
  1045. }
  1046. }
  1047. declare module 'babylonjs-loaders/src/glTF/1.0/glTFLoaderUtils' {
  1048. import { Scene, ShaderMaterial, Effect, Node } from "babylonjs";
  1049. import { IGLTFTechniqueParameter, IGLTFAccessor, ETextureFilterType, IGLTFRuntime, IGLTFBufferView, EComponentType } from "babylonjs-loaders/src/glTF/1.0/glTFLoaderInterfaces";
  1050. /**
  1051. * Utils functions for GLTF
  1052. * @hidden
  1053. */
  1054. export class GLTFUtils {
  1055. /**
  1056. * Sets the given "parameter" matrix
  1057. * @param scene: the Scene object
  1058. * @param source: the source node where to pick the matrix
  1059. * @param parameter: the GLTF technique parameter
  1060. * @param uniformName: the name of the shader's uniform
  1061. * @param shaderMaterial: the shader material
  1062. */
  1063. static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void;
  1064. /**
  1065. * Sets the given "parameter" matrix
  1066. * @param shaderMaterial: the shader material
  1067. * @param uniform: the name of the shader's uniform
  1068. * @param value: the value of the uniform
  1069. * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
  1070. */
  1071. static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
  1072. /**
  1073. * Returns the wrap mode of the texture
  1074. * @param mode: the mode value
  1075. */
  1076. static GetWrapMode(mode: number): number;
  1077. /**
  1078. * Returns the byte stride giving an accessor
  1079. * @param accessor: the GLTF accessor objet
  1080. */
  1081. static GetByteStrideFromType(accessor: IGLTFAccessor): number;
  1082. /**
  1083. * Returns the texture filter mode giving a mode value
  1084. * @param mode: the filter mode value
  1085. */
  1086. static GetTextureFilterMode(mode: number): ETextureFilterType;
  1087. static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
  1088. /**
  1089. * Returns a buffer from its accessor
  1090. * @param gltfRuntime: the GLTF runtime
  1091. * @param accessor: the GLTF accessor
  1092. */
  1093. static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
  1094. /**
  1095. * Decodes a buffer view into a string
  1096. * @param view: the buffer view
  1097. */
  1098. static DecodeBufferToText(view: ArrayBufferView): string;
  1099. /**
  1100. * Returns the default material of gltf. Related to
  1101. * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
  1102. * @param scene: the Babylon.js scene
  1103. */
  1104. static GetDefaultMaterial(scene: Scene): ShaderMaterial;
  1105. }
  1106. }
  1107. declare module 'babylonjs-loaders/src/glTF/1.0/glTFMaterialsCommonExtension' {
  1108. import { GLTFLoaderExtension } from "babylonjs-loaders/src/glTF/1.0";
  1109. import { IGLTFRuntime } from "babylonjs-loaders/src/glTF/1.0/glTFLoaderInterfaces";
  1110. import { Material } from "babylonjs";
  1111. /** @hidden */
  1112. export class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {
  1113. constructor();
  1114. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  1115. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
  1116. }
  1117. }
  1118. declare module 'babylonjs-loaders/src/glTF/2.0/glTF2Loader' {
  1119. import { Scene, Nullable, Mesh, Material, SceneLoaderProgressEvent, AbstractMesh, IParticleSystem, Skeleton, AnimationGroup, Camera, BaseTexture } from "babylonjs";
  1120. import { IProperty } from "babylonjs-gltf2interface";
  1121. import { IGLTF, INode, IScene, ICamera, IAnimation, IBufferView, IMaterial, ITextureInfo, IImage, IArrayItem } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1122. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1123. import { IGLTFLoader, GLTFFileLoader, GLTFLoaderState, IGLTFLoaderData } from "babylonjs-loaders/src/glTF/glTFFileLoader";
  1124. /**
  1125. * Helper class for working with arrays when loading the glTF asset
  1126. */
  1127. export class ArrayItem {
  1128. /**
  1129. * Gets an item from the given array.
  1130. * @param context The context when loading the asset
  1131. * @param array The array to get the item from
  1132. * @param index The index to the array
  1133. * @returns The array item
  1134. */
  1135. static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
  1136. /**
  1137. * Assign an `index` field to each item of the given array.
  1138. * @param array The array of items
  1139. */
  1140. static Assign(array?: IArrayItem[]): void;
  1141. }
  1142. /**
  1143. * The glTF 2.0 loader
  1144. */
  1145. export class GLTF2Loader implements IGLTFLoader {
  1146. /** The glTF object parsed from the JSON. */
  1147. gltf: IGLTF;
  1148. /** The Babylon scene when loading the asset. */
  1149. babylonScene: Scene;
  1150. /** @hidden */
  1151. _completePromises: Promise<any>[];
  1152. /**
  1153. * Registers a loader extension.
  1154. * @param name The name of the loader extension.
  1155. * @param factory The factory function that creates the loader extension.
  1156. */
  1157. static RegisterExtension(name: string, factory: (loader: GLTF2Loader) => IGLTFLoaderExtensionV2): void;
  1158. /**
  1159. * Unregisters a loader extension.
  1160. * @param name The name of the loader extenion.
  1161. * @returns A boolean indicating whether the extension has been unregistered
  1162. */
  1163. static UnregisterExtension(name: string): boolean;
  1164. /**
  1165. * Gets the loader state.
  1166. */
  1167. readonly state: Nullable<GLTFLoaderState>;
  1168. /** @hidden */
  1169. constructor(parent: GLTFFileLoader);
  1170. /** @hidden */
  1171. dispose(): void;
  1172. /** @hidden */
  1173. importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  1174. meshes: AbstractMesh[];
  1175. particleSystems: IParticleSystem[];
  1176. skeletons: Skeleton[];
  1177. animationGroups: AnimationGroup[];
  1178. }>;
  1179. /** @hidden */
  1180. loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  1181. /**
  1182. * Loads a glTF scene.
  1183. * @param context The context when loading the asset
  1184. * @param scene The glTF scene property
  1185. * @returns A promise that resolves when the load is complete
  1186. */
  1187. loadSceneAsync(context: string, scene: IScene): Promise<void>;
  1188. /**
  1189. * Loads a glTF node.
  1190. * @param context The context when loading the asset
  1191. * @param node The glTF node property
  1192. * @param assign A function called synchronously after parsing the glTF properties
  1193. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete
  1194. */
  1195. loadNodeAsync(context: string, node: INode, assign?: (babylonMesh: Mesh) => void): Promise<Mesh>;
  1196. /**
  1197. * Loads a glTF camera.
  1198. * @param context The context when loading the asset
  1199. * @param camera The glTF camera property
  1200. * @param assign A function called synchronously after parsing the glTF properties
  1201. * @returns A promise that resolves with the loaded Babylon camera when the load is complete
  1202. */
  1203. loadCameraAsync(context: string, camera: ICamera, assign?: (babylonCamera: Camera) => void): Promise<Camera>;
  1204. /**
  1205. * Loads a glTF animation.
  1206. * @param context The context when loading the asset
  1207. * @param animation The glTF animation property
  1208. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete
  1209. */
  1210. loadAnimationAsync(context: string, animation: IAnimation): Promise<AnimationGroup>;
  1211. /**
  1212. * Loads a glTF buffer view.
  1213. * @param context The context when loading the asset
  1214. * @param bufferView The glTF buffer view property
  1215. * @returns A promise that resolves with the loaded data when the load is complete
  1216. */
  1217. loadBufferViewAsync(context: string, bufferView: IBufferView): Promise<ArrayBufferView>;
  1218. /** @hidden */
  1219. _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign?: (babylonMaterial: Material) => void): Promise<Material>;
  1220. /**
  1221. * Creates a Babylon material from a glTF material.
  1222. * @param context The context when loading the asset
  1223. * @param material The glTF material property
  1224. * @param babylonDrawMode The draw mode for the Babylon material
  1225. * @returns The Babylon material
  1226. */
  1227. createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Material;
  1228. /**
  1229. * Loads properties from a glTF material into a Babylon material.
  1230. * @param context The context when loading the asset
  1231. * @param material The glTF material property
  1232. * @param babylonMaterial The Babylon material
  1233. * @returns A promise that resolves when the load is complete
  1234. */
  1235. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
  1236. /**
  1237. * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
  1238. * @param context The context when loading the asset
  1239. * @param material The glTF material property
  1240. * @param babylonMaterial The Babylon material
  1241. * @returns A promise that resolves when the load is complete
  1242. */
  1243. loadMaterialBasePropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
  1244. /**
  1245. * Loads the alpha properties from a glTF material into a Babylon material.
  1246. * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.
  1247. * @param context The context when loading the asset
  1248. * @param material The glTF material property
  1249. * @param babylonMaterial The Babylon material
  1250. */
  1251. loadMaterialAlphaProperties(context: string, material: IMaterial, babylonMaterial: Material): void;
  1252. /**
  1253. * Loads a glTF texture info.
  1254. * @param context The context when loading the asset
  1255. * @param textureInfo The glTF texture info property
  1256. * @param assign A function called synchronously after parsing the glTF properties
  1257. * @returns A promise that resolves with the loaded Babylon texture when the load is complete
  1258. */
  1259. loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
  1260. /**
  1261. * Loads a glTF image.
  1262. * @param context The context when loading the asset
  1263. * @param image The glTF image property
  1264. * @returns A promise that resolves with the loaded data when the load is complete
  1265. */
  1266. loadImageAsync(context: string, image: IImage): Promise<ArrayBufferView>;
  1267. /**
  1268. * Loads a glTF uri.
  1269. * @param context The context when loading the asset
  1270. * @param uri The base64 or relative uri
  1271. * @returns A promise that resolves with the loaded data when the load is complete
  1272. */
  1273. loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
  1274. /**
  1275. * Helper method called by a loader extension to load an glTF extension.
  1276. * @param context The context when loading the asset
  1277. * @param property The glTF property to load the extension from
  1278. * @param extensionName The name of the extension to load
  1279. * @param actionAsync The action to run
  1280. * @returns The promise returned by actionAsync or null if the extension does not exist
  1281. */
  1282. static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  1283. /**
  1284. * Helper method called by a loader extension to load a glTF extra.
  1285. * @param context The context when loading the asset
  1286. * @param property The glTF property to load the extra from
  1287. * @param extensionName The name of the extension to load
  1288. * @param actionAsync The action to run
  1289. * @returns The promise returned by actionAsync or null if the extra does not exist
  1290. */
  1291. static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
  1292. /**
  1293. * Increments the indentation level and logs a message.
  1294. * @param message The message to log
  1295. */
  1296. logOpen(message: string): void;
  1297. /**
  1298. * Decrements the indentation level.
  1299. */
  1300. logClose(): void;
  1301. /**
  1302. * Logs a message
  1303. * @param message The message to log
  1304. */
  1305. log(message: string): void;
  1306. /**
  1307. * Starts a performance counter.
  1308. * @param counterName The name of the performance counter
  1309. */
  1310. startPerformanceCounter(counterName: string): void;
  1311. /**
  1312. * Ends a performance counter.
  1313. * @param counterName The name of the performance counter
  1314. */
  1315. endPerformanceCounter(counterName: string): void;
  1316. }
  1317. }
  1318. declare module 'babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension' {
  1319. import { IDisposable, Nullable, Mesh, Camera, Geometry, Material, BaseTexture, AnimationGroup } from "babylonjs";
  1320. import { IScene, INode, ICamera, IMeshPrimitive, IMaterial, ITextureInfo, IAnimation } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1321. import { IGLTFLoaderExtension } from "babylonjs-loaders/src/glTF/glTFFileLoader";
  1322. /** @hidden */
  1323. export var __IGLTFLoaderExtensionV2: number;
  1324. /**
  1325. * Interface for a glTF loader extension.
  1326. */
  1327. export interface IGLTFLoaderExtensionV2 extends IGLTFLoaderExtension, IDisposable {
  1328. /**
  1329. * Called after the loader state changes to LOADING.
  1330. */
  1331. onLoading?(): void;
  1332. /**
  1333. * Called after the loader state changes to READY.
  1334. */
  1335. onReady?(): void;
  1336. /**
  1337. * Define this method to modify the default behavior when loading scenes.
  1338. * @param context The context when loading the asset
  1339. * @param scene The glTF scene property
  1340. * @returns A promise that resolves when the load is complete or null if not handled
  1341. */
  1342. loadSceneAsync?(context: string, scene: IScene): Nullable<Promise<void>>;
  1343. /**
  1344. * Define this method to modify the default behavior when loading nodes.
  1345. * @param context The context when loading the asset
  1346. * @param node The glTF node property
  1347. * @param assign A function called synchronously after parsing the glTF properties
  1348. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete or null if not handled
  1349. */
  1350. loadNodeAsync?(context: string, node: INode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1351. /**
  1352. * Define this method to modify the default behavior when loading cameras.
  1353. * @param context The context when loading the asset
  1354. * @param camera The glTF camera property
  1355. * @param assign A function called synchronously after parsing the glTF properties
  1356. * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
  1357. */
  1358. loadCameraAsync?(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
  1359. /**
  1360. * @hidden Define this method to modify the default behavior when loading vertex data for mesh primitives.
  1361. * @param context The context when loading the asset
  1362. * @param primitive The glTF mesh primitive property
  1363. * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled
  1364. */
  1365. _loadVertexDataAsync?(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1366. /**
  1367. * @hidden Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.
  1368. * @param context The context when loading the asset
  1369. * @param material The glTF material property
  1370. * @param assign A function called synchronously after parsing the glTF properties
  1371. * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled
  1372. */
  1373. _loadMaterialAsync?(context: string, material: IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  1374. /**
  1375. * Define this method to modify the default behavior when creating materials.
  1376. * @param context The context when loading the asset
  1377. * @param material The glTF material property
  1378. * @param babylonDrawMode The draw mode for the Babylon material
  1379. * @returns The Babylon material or null if not handled
  1380. */
  1381. createMaterial?(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
  1382. /**
  1383. * Define this method to modify the default behavior when loading material properties.
  1384. * @param context The context when loading the asset
  1385. * @param material The glTF material property
  1386. * @param babylonMaterial The Babylon material
  1387. * @returns A promise that resolves when the load is complete or null if not handled
  1388. */
  1389. loadMaterialPropertiesAsync?(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1390. /**
  1391. * Define this method to modify the default behavior when loading texture infos.
  1392. * @param context The context when loading the asset
  1393. * @param textureInfo The glTF texture info property
  1394. * @param assign A function called synchronously after parsing the glTF properties
  1395. * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
  1396. */
  1397. loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1398. /**
  1399. * Define this method to modify the default behavior when loading animations.
  1400. * @param context The context when loading the asset
  1401. * @param animation The glTF animation property
  1402. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
  1403. */
  1404. loadAnimationAsync?(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
  1405. /**
  1406. * Define this method to modify the default behavior when loading uris.
  1407. * @param context The context when loading the asset
  1408. * @param uri The uri to load
  1409. * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
  1410. */
  1411. _loadUriAsync?(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1412. }
  1413. }
  1414. declare module 'babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces' {
  1415. import { VertexBuffer, Buffer, AnimationGroup, Material, AbstractMesh, Mesh, Bone, Skeleton } from "babylonjs";
  1416. import * as IGLTF2 from "babylonjs-gltf2interface";
  1417. /** @hidden */
  1418. export var __IGLTFLoaderInterfacesV2: number;
  1419. /**
  1420. * Loader interface with an index field.
  1421. */
  1422. export interface IArrayItem {
  1423. /**
  1424. * The index of this item in the array.
  1425. */
  1426. index: number;
  1427. }
  1428. /**
  1429. * Loader interface with additional members.
  1430. */
  1431. export interface IAccessor extends IGLTF2.IAccessor, IArrayItem {
  1432. /** @hidden */
  1433. _data?: Promise<ArrayBufferView>;
  1434. /** @hidden */
  1435. _babylonVertexBuffer?: Promise<VertexBuffer>;
  1436. }
  1437. /**
  1438. * Loader interface with additional members.
  1439. */
  1440. export interface IAnimationChannel extends IGLTF2.IAnimationChannel, IArrayItem {
  1441. }
  1442. /** @hidden */
  1443. export interface _IAnimationSamplerData {
  1444. input: Float32Array;
  1445. interpolation: IGLTF2.AnimationSamplerInterpolation;
  1446. output: Float32Array;
  1447. }
  1448. /**
  1449. * Loader interface with additional members.
  1450. */
  1451. export interface IAnimationSampler extends IGLTF2.IAnimationSampler, IArrayItem {
  1452. /** @hidden */
  1453. _data?: Promise<_IAnimationSamplerData>;
  1454. }
  1455. /**
  1456. * Loader interface with additional members.
  1457. */
  1458. export interface IAnimation extends IGLTF2.IAnimation, IArrayItem {
  1459. channels: IAnimationChannel[];
  1460. samplers: IAnimationSampler[];
  1461. /** @hidden */
  1462. _babylonAnimationGroup?: AnimationGroup;
  1463. }
  1464. /**
  1465. * Loader interface with additional members.
  1466. */
  1467. export interface IBuffer extends IGLTF2.IBuffer, IArrayItem {
  1468. /** @hidden */
  1469. _data?: Promise<ArrayBufferView>;
  1470. }
  1471. /**
  1472. * Loader interface with additional members.
  1473. */
  1474. export interface IBufferView extends IGLTF2.IBufferView, IArrayItem {
  1475. /** @hidden */
  1476. _data?: Promise<ArrayBufferView>;
  1477. /** @hidden */
  1478. _babylonBuffer?: Promise<Buffer>;
  1479. }
  1480. /**
  1481. * Loader interface with additional members.
  1482. */
  1483. export interface ICamera extends IGLTF2.ICamera, IArrayItem {
  1484. }
  1485. /**
  1486. * Loader interface with additional members.
  1487. */
  1488. export interface IImage extends IGLTF2.IImage, IArrayItem {
  1489. /** @hidden */
  1490. _data?: Promise<ArrayBufferView>;
  1491. }
  1492. /**
  1493. * Loader interface with additional members.
  1494. */
  1495. export interface IMaterialNormalTextureInfo extends IGLTF2.IMaterialNormalTextureInfo, IGLTF2.ITextureInfo {
  1496. }
  1497. /**
  1498. * Loader interface with additional members.
  1499. */
  1500. export interface IMaterialOcclusionTextureInfo extends IGLTF2.IMaterialOcclusionTextureInfo, IGLTF2.ITextureInfo {
  1501. }
  1502. /**
  1503. * Loader interface with additional members.
  1504. */
  1505. export interface IMaterialPbrMetallicRoughness extends IGLTF2.IMaterialPbrMetallicRoughness {
  1506. baseColorTexture?: ITextureInfo;
  1507. metallicRoughnessTexture?: ITextureInfo;
  1508. }
  1509. /**
  1510. * Loader interface with additional members.
  1511. */
  1512. export interface IMaterial extends IGLTF2.IMaterial, IArrayItem {
  1513. pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
  1514. normalTexture?: IMaterialNormalTextureInfo;
  1515. occlusionTexture?: IMaterialOcclusionTextureInfo;
  1516. emissiveTexture?: ITextureInfo;
  1517. /** @hidden */
  1518. _babylonData?: {
  1519. [drawMode: number]: {
  1520. material: Material;
  1521. meshes: AbstractMesh[];
  1522. promise: Promise<void>;
  1523. };
  1524. };
  1525. }
  1526. /**
  1527. * Loader interface with additional members.
  1528. */
  1529. export interface IMesh extends IGLTF2.IMesh, IArrayItem {
  1530. primitives: IMeshPrimitive[];
  1531. }
  1532. /**
  1533. * Loader interface with additional members.
  1534. */
  1535. export interface IMeshPrimitive extends IGLTF2.IMeshPrimitive, IArrayItem {
  1536. }
  1537. /**
  1538. * Loader interface with additional members.
  1539. */
  1540. export interface INode extends IGLTF2.INode, IArrayItem {
  1541. /**
  1542. * The parent glTF node.
  1543. */
  1544. parent?: INode;
  1545. /** @hidden */
  1546. _babylonMesh?: Mesh;
  1547. /** @hidden */
  1548. _primitiveBabylonMeshes?: Mesh[];
  1549. /** @hidden */
  1550. _babylonBones?: Bone[];
  1551. /** @hidden */
  1552. _numMorphTargets?: number;
  1553. }
  1554. /** @hidden */
  1555. export interface _ISamplerData {
  1556. noMipMaps: boolean;
  1557. samplingMode: number;
  1558. wrapU: number;
  1559. wrapV: number;
  1560. }
  1561. /**
  1562. * Loader interface with additional members.
  1563. */
  1564. export interface ISampler extends IGLTF2.ISampler, IArrayItem {
  1565. /** @hidden */
  1566. _data?: _ISamplerData;
  1567. }
  1568. /**
  1569. * Loader interface with additional members.
  1570. */
  1571. export interface IScene extends IGLTF2.IScene, IArrayItem {
  1572. }
  1573. /**
  1574. * Loader interface with additional members.
  1575. */
  1576. export interface ISkin extends IGLTF2.ISkin, IArrayItem {
  1577. /** @hidden */
  1578. _babylonSkeleton?: Skeleton;
  1579. /** @hidden */
  1580. _promise?: Promise<void>;
  1581. }
  1582. /**
  1583. * Loader interface with additional members.
  1584. */
  1585. export interface ITexture extends IGLTF2.ITexture, IArrayItem {
  1586. }
  1587. /**
  1588. * Loader interface with additional members.
  1589. */
  1590. export interface ITextureInfo extends IGLTF2.ITextureInfo {
  1591. }
  1592. /**
  1593. * Loader interface with additional members.
  1594. */
  1595. export interface IGLTF extends IGLTF2.IGLTF {
  1596. accessors?: IAccessor[];
  1597. animations?: IAnimation[];
  1598. buffers?: IBuffer[];
  1599. bufferViews?: IBufferView[];
  1600. cameras?: ICamera[];
  1601. images?: IImage[];
  1602. materials?: IMaterial[];
  1603. meshes?: IMesh[];
  1604. nodes?: INode[];
  1605. samplers?: ISampler[];
  1606. scenes?: IScene[];
  1607. skins?: ISkin[];
  1608. textures?: ITexture[];
  1609. }
  1610. }
  1611. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions' {
  1612. export * from "babylonjs-loaders/src/glTF/2.0/Extensions/EXT_lights_image_based";
  1613. export * from "babylonjs-loaders/src/glTF/2.0/Extensions/KHR_draco_mesh_compression";
  1614. export * from "babylonjs-loaders/src/glTF/2.0/Extensions/KHR_lights_punctual";
  1615. export * from "babylonjs-loaders/src/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness";
  1616. export * from "babylonjs-loaders/src/glTF/2.0/Extensions/KHR_materials_unlit";
  1617. export * from "babylonjs-loaders/src/glTF/2.0/Extensions/KHR_texture_transform";
  1618. export * from "babylonjs-loaders/src/glTF/2.0/Extensions/MSFT_audio_emitter";
  1619. export * from "babylonjs-loaders/src/glTF/2.0/Extensions/MSFT_lod";
  1620. export * from "babylonjs-loaders/src/glTF/2.0/Extensions/MSFT_minecraftMesh";
  1621. export * from "babylonjs-loaders/src/glTF/2.0/Extensions/MSFT_sRGBFactors";
  1622. }
  1623. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions/EXT_lights_image_based' {
  1624. import { Nullable } from "babylonjs";
  1625. import { IScene } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1626. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1627. import { GLTF2Loader } from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  1628. /**
  1629. * [Specification](https://github.com/KhronosGroup/glTF/blob/eb3e32332042e04691a5f35103f8c261e50d8f1e/extensions/2.0/Khronos/EXT_lights_image_based/README.md) (Experimental)
  1630. */
  1631. export class EXT_lights_image_based implements IGLTFLoaderExtensionV2 {
  1632. /** The name of this extension. */
  1633. readonly name: string;
  1634. /** Defines whether this extension is enabled. */
  1635. enabled: boolean;
  1636. /** @hidden */
  1637. constructor(loader: GLTF2Loader);
  1638. /** @hidden */
  1639. dispose(): void;
  1640. /** @hidden */
  1641. onLoading(): void;
  1642. /** @hidden */
  1643. loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
  1644. }
  1645. }
  1646. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions/KHR_draco_mesh_compression' {
  1647. import { Geometry, Mesh, Nullable } from "babylonjs";
  1648. import { IMeshPrimitive } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1649. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1650. import { GLTF2Loader } from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  1651. /**
  1652. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
  1653. */
  1654. export class KHR_draco_mesh_compression implements IGLTFLoaderExtensionV2 {
  1655. /** The name of this extension. */
  1656. readonly name: string;
  1657. /** Defines whether this extension is enabled. */
  1658. enabled: boolean;
  1659. /** @hidden */
  1660. constructor(loader: GLTF2Loader);
  1661. /** @hidden */
  1662. dispose(): void;
  1663. /** @hidden */
  1664. _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
  1665. }
  1666. }
  1667. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions/KHR_lights_punctual' {
  1668. import { Mesh, Nullable } from "babylonjs";
  1669. import { INode } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1670. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1671. import { GLTF2Loader } from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  1672. /**
  1673. * [Specification](https://github.com/KhronosGroup/glTF/blob/1048d162a44dbcb05aefc1874bfd423cf60135a6/extensions/2.0/Khronos/KHR_lights_punctual/README.md) (Experimental)
  1674. */
  1675. export class KHR_lights implements IGLTFLoaderExtensionV2 {
  1676. /** The name of this extension. */
  1677. readonly name: string;
  1678. /** Defines whether this extension is enabled. */
  1679. enabled: boolean;
  1680. /** @hidden */
  1681. constructor(loader: GLTF2Loader);
  1682. /** @hidden */
  1683. dispose(): void;
  1684. /** @hidden */
  1685. onLoading(): void;
  1686. /** @hidden */
  1687. loadNodeAsync(context: string, node: INode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1688. }
  1689. }
  1690. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness' {
  1691. import { Material, Nullable } from "babylonjs";
  1692. import { IMaterial } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1693. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1694. import { GLTF2Loader } from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  1695. /**
  1696. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
  1697. */
  1698. export class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtensionV2 {
  1699. /** The name of this extension. */
  1700. readonly name: string;
  1701. /** Defines whether this extension is enabled. */
  1702. enabled: boolean;
  1703. /** @hidden */
  1704. constructor(loader: GLTF2Loader);
  1705. /** @hidden */
  1706. dispose(): void;
  1707. /** @hidden */
  1708. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1709. }
  1710. }
  1711. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions/KHR_materials_unlit' {
  1712. import { Material, Nullable } from "babylonjs";
  1713. import { IMaterial } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1714. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1715. import { GLTF2Loader } from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  1716. /**
  1717. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
  1718. */
  1719. export class KHR_materials_unlit implements IGLTFLoaderExtensionV2 {
  1720. /** The name of this extension. */
  1721. readonly name: string;
  1722. /** Defines whether this extension is enabled. */
  1723. enabled: boolean;
  1724. /** @hidden */
  1725. constructor(loader: GLTF2Loader);
  1726. /** @hidden */
  1727. dispose(): void;
  1728. /** @hidden */
  1729. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1730. }
  1731. }
  1732. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions/KHR_texture_transform' {
  1733. import { BaseTexture, Nullable } from "babylonjs";
  1734. import { ITextureInfo } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1735. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1736. import { GLTF2Loader } from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  1737. /**
  1738. * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform/README.md)
  1739. */
  1740. export class KHR_texture_transform implements IGLTFLoaderExtensionV2 {
  1741. /** The name of this extension. */
  1742. readonly name: string;
  1743. /** Defines whether this extension is enabled. */
  1744. enabled: boolean;
  1745. /** @hidden */
  1746. constructor(loader: GLTF2Loader);
  1747. /** @hidden */
  1748. dispose(): void;
  1749. /** @hidden */
  1750. loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
  1751. }
  1752. }
  1753. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions/MSFT_audio_emitter' {
  1754. import { Nullable, Mesh, AnimationGroup } from "babylonjs";
  1755. import { IScene, INode, IAnimation } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1756. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1757. import { GLTF2Loader } from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  1758. /**
  1759. * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
  1760. */
  1761. export class MSFT_audio_emitter implements IGLTFLoaderExtensionV2 {
  1762. /** The name of this extension. */
  1763. readonly name: string;
  1764. /** Defines whether this extension is enabled. */
  1765. enabled: boolean;
  1766. /** @hidden */
  1767. constructor(loader: GLTF2Loader);
  1768. /** @hidden */
  1769. dispose(): void;
  1770. /** @hidden */
  1771. onLoading(): void;
  1772. /** @hidden */
  1773. loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
  1774. /** @hidden */
  1775. loadNodeAsync(context: string, node: INode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1776. /** @hidden */
  1777. loadAnimationAsync(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
  1778. }
  1779. }
  1780. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions/MSFT_lod' {
  1781. import { Observable, Nullable, Mesh, Material } from "babylonjs";
  1782. import { INode, IMaterial } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1783. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1784. import { GLTF2Loader } from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  1785. /**
  1786. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
  1787. */
  1788. export class MSFT_lod implements IGLTFLoaderExtensionV2 {
  1789. /** The name of this extension. */
  1790. readonly name: string;
  1791. /** Defines whether this extension is enabled. */
  1792. enabled: boolean;
  1793. /**
  1794. * Maximum number of LODs to load, starting from the lowest LOD.
  1795. */
  1796. maxLODsToLoad: number;
  1797. /**
  1798. * Observable raised when all node LODs of one level are loaded.
  1799. * The event data is the index of the loaded LOD starting from zero.
  1800. * Dispose the loader to cancel the loading of the next level of LODs.
  1801. */
  1802. onNodeLODsLoadedObservable: Observable<number>;
  1803. /**
  1804. * Observable raised when all material LODs of one level are loaded.
  1805. * The event data is the index of the loaded LOD starting from zero.
  1806. * Dispose the loader to cancel the loading of the next level of LODs.
  1807. */
  1808. onMaterialLODsLoadedObservable: Observable<number>;
  1809. /** @hidden */
  1810. constructor(loader: GLTF2Loader);
  1811. /** @hidden */
  1812. dispose(): void;
  1813. /** @hidden */
  1814. onReady(): void;
  1815. /** @hidden */
  1816. loadNodeAsync(context: string, node: INode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
  1817. /** @hidden */
  1818. _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
  1819. /** @hidden */
  1820. _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
  1821. }
  1822. }
  1823. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions/MSFT_minecraftMesh' {
  1824. import { Material, Nullable } from "babylonjs";
  1825. import { IMaterial } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1826. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1827. import { GLTF2Loader } from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  1828. /** @hidden */
  1829. export class MSFT_minecraftMesh implements IGLTFLoaderExtensionV2 {
  1830. readonly name: string;
  1831. enabled: boolean;
  1832. constructor(loader: GLTF2Loader);
  1833. dispose(): void;
  1834. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1835. }
  1836. }
  1837. declare module 'babylonjs-loaders/src/glTF/2.0/Extensions/MSFT_sRGBFactors' {
  1838. import { Material, Nullable } from "babylonjs";
  1839. import { IMaterial } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderInterfaces";
  1840. import { IGLTFLoaderExtensionV2 } from "babylonjs-loaders/src/glTF/2.0/glTFLoaderExtension";
  1841. import { GLTF2Loader } from "babylonjs-loaders/src/glTF/2.0/glTF2Loader";
  1842. /** @hidden */
  1843. export class MSFT_sRGBFactors implements IGLTFLoaderExtensionV2 {
  1844. readonly name: string;
  1845. enabled: boolean;
  1846. constructor(loader: GLTF2Loader);
  1847. dispose(): void;
  1848. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
  1849. }
  1850. }
  1851. /*BabylonJS Loaders*/
  1852. // Dependencies for this module:
  1853. // ../../../../Tools/Gulp/babylonjs
  1854. // ../../../../Tools/Gulp/babylonjs-gltf2interface
  1855. declare module BABYLON {
  1856. /**
  1857. * Mode that determines the coordinate system to use.
  1858. */
  1859. export enum GLTFLoaderCoordinateSystemMode {
  1860. /**
  1861. * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
  1862. */
  1863. AUTO = 0,
  1864. /**
  1865. * Sets the useRightHandedSystem flag on the scene.
  1866. */
  1867. FORCE_RIGHT_HANDED = 1
  1868. }
  1869. /**
  1870. * Mode that determines what animations will start.
  1871. */
  1872. export enum GLTFLoaderAnimationStartMode {
  1873. /**
  1874. * No animation will start.
  1875. */
  1876. NONE = 0,
  1877. /**
  1878. * The first animation will start.
  1879. */
  1880. FIRST = 1,
  1881. /**
  1882. * All animations will start.
  1883. */
  1884. ALL = 2
  1885. }
  1886. /**
  1887. * Interface that contains the data for the glTF asset.
  1888. */
  1889. export interface IGLTFLoaderData {
  1890. /**
  1891. * Object that represents the glTF JSON.
  1892. */
  1893. json: Object;
  1894. /**
  1895. * The BIN chunk of a binary glTF.
  1896. */
  1897. bin: BABYLON.Nullable<ArrayBufferView>;
  1898. }
  1899. /**
  1900. * Interface for extending the loader.
  1901. */
  1902. export interface IGLTFLoaderExtension {
  1903. /**
  1904. * The name of this extension.
  1905. */
  1906. readonly name: string;
  1907. /**
  1908. * Defines whether this extension is enabled.
  1909. */
  1910. enabled: boolean;
  1911. }
  1912. /**
  1913. * Loader state.
  1914. */
  1915. export enum GLTFLoaderState {
  1916. /**
  1917. * The asset is loading.
  1918. */
  1919. LOADING = 0,
  1920. /**
  1921. * The asset is ready for rendering.
  1922. */
  1923. READY = 1,
  1924. /**
  1925. * The asset is completely loaded.
  1926. */
  1927. COMPLETE = 2
  1928. }
  1929. /** @hidden */
  1930. export interface IGLTFLoader extends BABYLON.IDisposable {
  1931. readonly state: BABYLON.Nullable<GLTFLoaderState>;
  1932. importMeshAsync: (meshesNames: any, scene: BABYLON.Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void, fileName?: string) => Promise<{
  1933. meshes: BABYLON.AbstractMesh[];
  1934. particleSystems: BABYLON.IParticleSystem[];
  1935. skeletons: BABYLON.Skeleton[];
  1936. animationGroups: BABYLON.AnimationGroup[];
  1937. }>;
  1938. loadAsync: (scene: BABYLON.Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;
  1939. }
  1940. /**
  1941. * File loader for loading glTF files into a scene.
  1942. */
  1943. export class GLTFFileLoader implements BABYLON.IDisposable, BABYLON.ISceneLoaderPluginAsync, BABYLON.ISceneLoaderPluginFactory {
  1944. /** @hidden */
  1945. static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
  1946. /** @hidden */
  1947. static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
  1948. /**
  1949. * Raised when the asset has been parsed
  1950. */
  1951. onParsedObservable: BABYLON.Observable<IGLTFLoaderData>;
  1952. /**
  1953. * Raised when the asset has been parsed
  1954. */
  1955. onParsed: (loaderData: IGLTFLoaderData) => void;
  1956. /**
  1957. * 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.
  1958. * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
  1959. * Defaults to true.
  1960. * @hidden
  1961. */
  1962. static IncrementalLoading: boolean;
  1963. /**
  1964. * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
  1965. * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
  1966. * @hidden
  1967. */
  1968. static HomogeneousCoordinates: boolean;
  1969. /**
  1970. * The coordinate system mode. Defaults to AUTO.
  1971. */
  1972. coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
  1973. /**
  1974. * The animation start mode. Defaults to FIRST.
  1975. */
  1976. animationStartMode: GLTFLoaderAnimationStartMode;
  1977. /**
  1978. * Defines if the loader should compile materials before raising the success callback. Defaults to false.
  1979. */
  1980. compileMaterials: boolean;
  1981. /**
  1982. * Defines if the loader should also compile materials with clip planes. Defaults to false.
  1983. */
  1984. useClipPlane: boolean;
  1985. /**
  1986. * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.
  1987. */
  1988. compileShadowGenerators: boolean;
  1989. /**
  1990. * Defines if the Alpha blended materials are only applied as coverage.
  1991. * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.
  1992. * If true, no extra effects are applied to transparent pixels.
  1993. */
  1994. transparencyAsCoverage: boolean;
  1995. /**
  1996. * Function called before loading a url referenced by the asset.
  1997. */
  1998. preprocessUrlAsync: (url: string) => Promise<string>;
  1999. /**
  2000. * BABYLON.Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  2001. */
  2002. readonly onMeshLoadedObservable: BABYLON.Observable<BABYLON.AbstractMesh>;
  2003. /**
  2004. * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
  2005. */
  2006. onMeshLoaded: (mesh: BABYLON.AbstractMesh) => void;
  2007. /**
  2008. * BABYLON.Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
  2009. */
  2010. readonly onTextureLoadedObservable: BABYLON.Observable<BABYLON.BaseTexture>;
  2011. /**
  2012. * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
  2013. */
  2014. onTextureLoaded: (texture: BABYLON.BaseTexture) => void;
  2015. /**
  2016. * BABYLON.Observable raised when the loader creates a material after parsing the glTF properties of the material.
  2017. */
  2018. readonly onMaterialLoadedObservable: BABYLON.Observable<BABYLON.Material>;
  2019. /**
  2020. * Callback raised when the loader creates a material after parsing the glTF properties of the material.
  2021. */
  2022. onMaterialLoaded: (material: BABYLON.Material) => void;
  2023. /**
  2024. * BABYLON.Observable raised when the loader creates a camera after parsing the glTF properties of the camera.
  2025. */
  2026. readonly onCameraLoadedObservable: BABYLON.Observable<BABYLON.Camera>;
  2027. /**
  2028. * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
  2029. */
  2030. onCameraLoaded: (camera: BABYLON.Camera) => void;
  2031. /**
  2032. * BABYLON.Observable raised when the asset is completely loaded, immediately before the loader is disposed.
  2033. * For assets with LODs, raised when all of the LODs are complete.
  2034. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
  2035. */
  2036. readonly onCompleteObservable: BABYLON.Observable<void>;
  2037. /**
  2038. * Callback raised when the asset is completely loaded, immediately before the loader is disposed.
  2039. * For assets with LODs, raised when all of the LODs are complete.
  2040. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
  2041. */
  2042. onComplete: () => void;
  2043. /**
  2044. * BABYLON.Observable raised when an error occurs.
  2045. */
  2046. readonly onErrorObservable: BABYLON.Observable<any>;
  2047. /**
  2048. * Callback raised when an error occurs.
  2049. */
  2050. onError: (reason: any) => void;
  2051. /**
  2052. * BABYLON.Observable raised after the loader is disposed.
  2053. */
  2054. readonly onDisposeObservable: BABYLON.Observable<void>;
  2055. /**
  2056. * Callback raised after the loader is disposed.
  2057. */
  2058. onDispose: () => void;
  2059. /**
  2060. * BABYLON.Observable raised after a loader extension is created.
  2061. * Set additional options for a loader extension in this event.
  2062. */
  2063. readonly onExtensionLoadedObservable: BABYLON.Observable<IGLTFLoaderExtension>;
  2064. /**
  2065. * Callback raised after a loader extension is created.
  2066. */
  2067. onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
  2068. /**
  2069. * Defines if the loader logging is enabled.
  2070. */
  2071. loggingEnabled: boolean;
  2072. /**
  2073. * Defines if the loader should capture performance counters.
  2074. */
  2075. capturePerformanceCounters: boolean;
  2076. /**
  2077. * Defines if the loader should validate the asset.
  2078. */
  2079. validate: boolean;
  2080. /**
  2081. * BABYLON.Observable raised after validation when validate is set to true. The event data is the result of the validation.
  2082. */
  2083. readonly onValidatedObservable: BABYLON.Observable<BABYLON.GLTF2.IGLTFValidationResults>;
  2084. /**
  2085. * Callback raised after a loader extension is created.
  2086. */
  2087. onValidated: (results: BABYLON.GLTF2.IGLTFValidationResults) => void;
  2088. /**
  2089. * Name of the loader ("gltf")
  2090. */
  2091. name: string;
  2092. /**
  2093. * Supported file extensions of the loader (.gltf, .glb)
  2094. */
  2095. extensions: BABYLON.ISceneLoaderPluginExtensions;
  2096. /**
  2097. * Disposes the loader, releases resources during load, and cancels any outstanding requests.
  2098. */
  2099. dispose(): void;
  2100. /** @hidden */
  2101. _clear(): void;
  2102. /**
  2103. * Imports one or more meshes from the loaded glTF data and adds them to the scene
  2104. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  2105. * @param scene the scene the meshes should be added to
  2106. * @param data the glTF data to load
  2107. * @param rootUrl root url to load from
  2108. * @param onProgress event that fires when loading progress has occured
  2109. * @param fileName Defines the name of the file to load
  2110. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  2111. */
  2112. importMeshAsync(meshesNames: any, scene: BABYLON.Scene, data: any, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  2113. meshes: BABYLON.AbstractMesh[];
  2114. particleSystems: BABYLON.IParticleSystem[];
  2115. skeletons: BABYLON.Skeleton[];
  2116. animationGroups: BABYLON.AnimationGroup[];
  2117. }>;
  2118. /**
  2119. * Imports all objects from the loaded glTF data and adds them to the scene
  2120. * @param scene the scene the objects should be added to
  2121. * @param data the glTF data to load
  2122. * @param rootUrl root url to load from
  2123. * @param onProgress event that fires when loading progress has occured
  2124. * @param fileName Defines the name of the file to load
  2125. * @returns a promise which completes when objects have been loaded to the scene
  2126. */
  2127. loadAsync(scene: BABYLON.Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  2128. /**
  2129. * Load into an asset container.
  2130. * @param scene The scene to load into
  2131. * @param data The data to import
  2132. * @param rootUrl The root url for scene and resources
  2133. * @param onProgress The callback when the load progresses
  2134. * @param fileName Defines the name of the file to load
  2135. * @returns The loaded asset container
  2136. */
  2137. loadAssetContainerAsync(scene: BABYLON.Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void, fileName?: string): Promise<BABYLON.AssetContainer>;
  2138. /**
  2139. * If the data string can be loaded directly.
  2140. * @param data string contianing the file data
  2141. * @returns if the data can be loaded directly
  2142. */
  2143. canDirectLoad(data: string): boolean;
  2144. /**
  2145. * Rewrites a url by combining a root url and response url.
  2146. */
  2147. rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
  2148. /**
  2149. * Instantiates a glTF file loader plugin.
  2150. * @returns the created plugin
  2151. */
  2152. createPlugin(): BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
  2153. /**
  2154. * The loader state or null if the loader is not active.
  2155. */
  2156. readonly loaderState: BABYLON.Nullable<GLTFLoaderState>;
  2157. /**
  2158. * Returns a promise that resolves when the asset is completely loaded.
  2159. * @returns a promise that resolves when the asset is completely loaded.
  2160. */
  2161. whenCompleteAsync(): Promise<void>;
  2162. /** @hidden */
  2163. _log: (message: string) => void;
  2164. /** @hidden */
  2165. _logOpen(message: string): void;
  2166. /** @hidden */
  2167. _logClose(): void;
  2168. /** @hidden */
  2169. _startPerformanceCounter: (counterName: string) => void;
  2170. /** @hidden */
  2171. _endPerformanceCounter: (counterName: string) => void;
  2172. }
  2173. }
  2174. declare module BABYLON {
  2175. /**
  2176. * Class reading and parsing the MTL file bundled with the obj file.
  2177. */
  2178. export class MTLFileLoader {
  2179. /**
  2180. * All material loaded from the mtl will be set here
  2181. */
  2182. materials: BABYLON.StandardMaterial[];
  2183. /**
  2184. * This function will read the mtl file and create each material described inside
  2185. * This function could be improve by adding :
  2186. * -some component missing (Ni, Tf...)
  2187. * -including the specific options available
  2188. *
  2189. * @param scene defines the scene the material will be created in
  2190. * @param data defines the mtl data to parse
  2191. * @param rootUrl defines the rooturl to use in order to load relative dependencies
  2192. */
  2193. parseMTL(scene: BABYLON.Scene, data: string | ArrayBuffer, rootUrl: string): void;
  2194. }
  2195. /**
  2196. * OBJ file type loader.
  2197. * This is a babylon scene loader plugin.
  2198. */
  2199. export class OBJFileLoader implements BABYLON.ISceneLoaderPluginAsync {
  2200. /**
  2201. * Defines if UVs are optimized by default during load.
  2202. */
  2203. static OPTIMIZE_WITH_UV: boolean;
  2204. /**
  2205. * Defines if Y is inverted by default during load.
  2206. */
  2207. static INVERT_Y: boolean;
  2208. /**
  2209. * Defines the name of the plugin.
  2210. */
  2211. name: string;
  2212. /**
  2213. * Defines the extension the plugin is able to load.
  2214. */
  2215. extensions: string;
  2216. /** @hidden */
  2217. obj: RegExp;
  2218. /** @hidden */
  2219. group: RegExp;
  2220. /** @hidden */
  2221. mtllib: RegExp;
  2222. /** @hidden */
  2223. usemtl: RegExp;
  2224. /** @hidden */
  2225. smooth: RegExp;
  2226. /** @hidden */
  2227. vertexPattern: RegExp;
  2228. /** @hidden */
  2229. normalPattern: RegExp;
  2230. /** @hidden */
  2231. uvPattern: RegExp;
  2232. /** @hidden */
  2233. facePattern1: RegExp;
  2234. /** @hidden */
  2235. facePattern2: RegExp;
  2236. /** @hidden */
  2237. facePattern3: RegExp;
  2238. /** @hidden */
  2239. facePattern4: RegExp;
  2240. /** @hidden */
  2241. facePattern5: RegExp;
  2242. /**
  2243. * Imports one or more meshes from the loaded glTF data and adds them to the scene
  2244. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  2245. * @param scene the scene the meshes should be added to
  2246. * @param data the glTF data to load
  2247. * @param rootUrl root url to load from
  2248. * @param onProgress event that fires when loading progress has occured
  2249. * @param fileName Defines the name of the file to load
  2250. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  2251. */
  2252. importMeshAsync(meshesNames: any, scene: BABYLON.Scene, data: any, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  2253. meshes: BABYLON.AbstractMesh[];
  2254. particleSystems: BABYLON.IParticleSystem[];
  2255. skeletons: BABYLON.Skeleton[];
  2256. animationGroups: BABYLON.AnimationGroup[];
  2257. }>;
  2258. /**
  2259. * Imports all objects from the loaded glTF data and adds them to the scene
  2260. * @param scene the scene the objects should be added to
  2261. * @param data the glTF data to load
  2262. * @param rootUrl root url to load from
  2263. * @param onProgress event that fires when loading progress has occured
  2264. * @param fileName Defines the name of the file to load
  2265. * @returns a promise which completes when objects have been loaded to the scene
  2266. */
  2267. loadAsync(scene: BABYLON.Scene, data: string, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  2268. /**
  2269. * Load into an asset container.
  2270. * @param scene The scene to load into
  2271. * @param data The data to import
  2272. * @param rootUrl The root url for scene and resources
  2273. * @param onProgress The callback when the load progresses
  2274. * @param fileName Defines the name of the file to load
  2275. * @returns The loaded asset container
  2276. */
  2277. loadAssetContainerAsync(scene: BABYLON.Scene, data: string, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void, fileName?: string): Promise<BABYLON.AssetContainer>;
  2278. }
  2279. }
  2280. declare module BABYLON {
  2281. /**
  2282. * STL file type loader.
  2283. * This is a babylon scene loader plugin.
  2284. */
  2285. export class STLFileLoader implements BABYLON.ISceneLoaderPlugin {
  2286. /** @hidden */
  2287. solidPattern: RegExp;
  2288. /** @hidden */
  2289. facetsPattern: RegExp;
  2290. /** @hidden */
  2291. normalPattern: RegExp;
  2292. /** @hidden */
  2293. vertexPattern: RegExp;
  2294. /**
  2295. * Defines the name of the plugin.
  2296. */
  2297. name: string;
  2298. /**
  2299. * Defines the extensions the stl loader is able to load.
  2300. * force data to come in as an ArrayBuffer
  2301. * we'll convert to string if it looks like it's an ASCII .stl
  2302. */
  2303. extensions: BABYLON.ISceneLoaderPluginExtensions;
  2304. /**
  2305. * Import meshes into a scene.
  2306. * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
  2307. * @param scene The scene to import into
  2308. * @param data The data to import
  2309. * @param rootUrl The root url for scene and resources
  2310. * @param meshes The meshes array to import into
  2311. * @param particleSystems The particle systems array to import into
  2312. * @param skeletons The skeletons array to import into
  2313. * @param onError The callback when import fails
  2314. * @returns True if successful or false otherwise
  2315. */
  2316. importMesh(meshesNames: any, scene: BABYLON.Scene, data: any, rootUrl: string, meshes: BABYLON.Nullable<BABYLON.AbstractMesh[]>, particleSystems: BABYLON.Nullable<BABYLON.IParticleSystem[]>, skeletons: BABYLON.Nullable<BABYLON.Skeleton[]>): boolean;
  2317. /**
  2318. * Load into a scene.
  2319. * @param scene The scene to load into
  2320. * @param data The data to import
  2321. * @param rootUrl The root url for scene and resources
  2322. * @param onError The callback when import fails
  2323. * @returns true if successful or false otherwise
  2324. */
  2325. load(scene: BABYLON.Scene, data: any, rootUrl: string): boolean;
  2326. /**
  2327. * Load into an asset container.
  2328. * @param scene The scene to load into
  2329. * @param data The data to import
  2330. * @param rootUrl The root url for scene and resources
  2331. * @param onError The callback when import fails
  2332. * @returns The loaded asset container
  2333. */
  2334. loadAssetContainer(scene: BABYLON.Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): BABYLON.AssetContainer;
  2335. }
  2336. }
  2337. declare module BABYLON.GLTF1 {
  2338. /** @hidden */
  2339. export class GLTFBinaryExtension extends GLTFLoaderExtension {
  2340. constructor();
  2341. loadRuntimeAsync(scene: BABYLON.Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
  2342. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  2343. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  2344. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  2345. }
  2346. }
  2347. declare module BABYLON.GLTF1 {
  2348. /**
  2349. * Implementation of the base glTF spec
  2350. * @hidden
  2351. */
  2352. export class GLTFLoaderBase {
  2353. static CreateRuntime(parsedData: any, scene: BABYLON.Scene, rootUrl: string): IGLTFRuntime;
  2354. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  2355. static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: BABYLON.Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
  2356. static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: BABYLON.Nullable<ArrayBufferView>, onSuccess: (texture: BABYLON.Texture) => void, onError: (message: string) => void): void;
  2357. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void;
  2358. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: BABYLON.Material) => void, onError: (message: string) => void): void;
  2359. }
  2360. /**
  2361. * glTF V1 Loader
  2362. * @hidden
  2363. */
  2364. export class GLTF1Loader implements IGLTFLoader {
  2365. static Extensions: {
  2366. [name: string]: GLTFLoaderExtension;
  2367. };
  2368. static RegisterExtension(extension: GLTFLoaderExtension): void;
  2369. state: BABYLON.Nullable<GLTFLoaderState>;
  2370. dispose(): void;
  2371. /**
  2372. * Imports one or more meshes from a loaded gltf file and adds them to the scene
  2373. * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
  2374. * @param scene the scene the meshes should be added to
  2375. * @param data gltf data containing information of the meshes in a loaded file
  2376. * @param rootUrl root url to load from
  2377. * @param onProgress event that fires when loading progress has occured
  2378. * @returns a promise containg the loaded meshes, particles, skeletons and animations
  2379. */
  2380. importMeshAsync(meshesNames: any, scene: BABYLON.Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void): Promise<{
  2381. meshes: BABYLON.AbstractMesh[];
  2382. particleSystems: BABYLON.IParticleSystem[];
  2383. skeletons: BABYLON.Skeleton[];
  2384. animationGroups: BABYLON.AnimationGroup[];
  2385. }>;
  2386. /**
  2387. * Imports all objects from a loaded gltf file and adds them to the scene
  2388. * @param scene the scene the objects should be added to
  2389. * @param data gltf data containing information of the meshes in a loaded file
  2390. * @param rootUrl root url to load from
  2391. * @param onProgress event that fires when loading progress has occured
  2392. * @returns a promise which completes when objects have been loaded to the scene
  2393. */
  2394. loadAsync(scene: BABYLON.Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void): Promise<void>;
  2395. }
  2396. }
  2397. declare module BABYLON.GLTF1 {
  2398. /** @hidden */
  2399. export abstract class GLTFLoaderExtension {
  2400. constructor(name: string);
  2401. readonly name: string;
  2402. /**
  2403. * Defines an override for loading the runtime
  2404. * Return true to stop further extensions from loading the runtime
  2405. */
  2406. loadRuntimeAsync(scene: BABYLON.Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
  2407. /**
  2408. * Defines an onverride for creating gltf runtime
  2409. * Return true to stop further extensions from creating the runtime
  2410. */
  2411. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
  2412. /**
  2413. * Defines an override for loading buffers
  2414. * Return true to stop further extensions from loading this buffer
  2415. */
  2416. loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
  2417. /**
  2418. * Defines an override for loading texture buffers
  2419. * Return true to stop further extensions from loading this texture data
  2420. */
  2421. loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
  2422. /**
  2423. * Defines an override for creating textures
  2424. * Return true to stop further extensions from loading this texture
  2425. */
  2426. createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: BABYLON.Texture) => void, onError: (message: string) => void): boolean;
  2427. /**
  2428. * Defines an override for loading shader strings
  2429. * Return true to stop further extensions from loading this shader data
  2430. */
  2431. loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
  2432. /**
  2433. * Defines an override for loading materials
  2434. * Return true to stop further extensions from loading this material
  2435. */
  2436. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: BABYLON.Material) => void, onError: (message: string) => void): boolean;
  2437. static LoadRuntimeAsync(scene: BABYLON.Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): void;
  2438. static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void;
  2439. static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
  2440. static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: BABYLON.Texture) => void, onError: (message: string) => void): void;
  2441. static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void;
  2442. static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: BABYLON.Material) => void, onError: (message: string) => void): void;
  2443. }
  2444. }
  2445. declare module BABYLON.GLTF1 {
  2446. /**
  2447. * Enums
  2448. * @hidden
  2449. */
  2450. export enum EComponentType {
  2451. BYTE = 5120,
  2452. UNSIGNED_BYTE = 5121,
  2453. SHORT = 5122,
  2454. UNSIGNED_SHORT = 5123,
  2455. FLOAT = 5126
  2456. }
  2457. /** @hidden */
  2458. export enum EShaderType {
  2459. FRAGMENT = 35632,
  2460. VERTEX = 35633
  2461. }
  2462. /** @hidden */
  2463. export enum EParameterType {
  2464. BYTE = 5120,
  2465. UNSIGNED_BYTE = 5121,
  2466. SHORT = 5122,
  2467. UNSIGNED_SHORT = 5123,
  2468. INT = 5124,
  2469. UNSIGNED_INT = 5125,
  2470. FLOAT = 5126,
  2471. FLOAT_VEC2 = 35664,
  2472. FLOAT_VEC3 = 35665,
  2473. FLOAT_VEC4 = 35666,
  2474. INT_VEC2 = 35667,
  2475. INT_VEC3 = 35668,
  2476. INT_VEC4 = 35669,
  2477. BOOL = 35670,
  2478. BOOL_VEC2 = 35671,
  2479. BOOL_VEC3 = 35672,
  2480. BOOL_VEC4 = 35673,
  2481. FLOAT_MAT2 = 35674,
  2482. FLOAT_MAT3 = 35675,
  2483. FLOAT_MAT4 = 35676,
  2484. SAMPLER_2D = 35678
  2485. }
  2486. /** @hidden */
  2487. export enum ETextureWrapMode {
  2488. CLAMP_TO_EDGE = 33071,
  2489. MIRRORED_REPEAT = 33648,
  2490. REPEAT = 10497
  2491. }
  2492. /** @hidden */
  2493. export enum ETextureFilterType {
  2494. NEAREST = 9728,
  2495. LINEAR = 9728,
  2496. NEAREST_MIPMAP_NEAREST = 9984,
  2497. LINEAR_MIPMAP_NEAREST = 9985,
  2498. NEAREST_MIPMAP_LINEAR = 9986,
  2499. LINEAR_MIPMAP_LINEAR = 9987
  2500. }
  2501. /** @hidden */
  2502. export enum ETextureFormat {
  2503. ALPHA = 6406,
  2504. RGB = 6407,
  2505. RGBA = 6408,
  2506. LUMINANCE = 6409,
  2507. LUMINANCE_ALPHA = 6410
  2508. }
  2509. /** @hidden */
  2510. export enum ECullingType {
  2511. FRONT = 1028,
  2512. BACK = 1029,
  2513. FRONT_AND_BACK = 1032
  2514. }
  2515. /** @hidden */
  2516. export enum EBlendingFunction {
  2517. ZERO = 0,
  2518. ONE = 1,
  2519. SRC_COLOR = 768,
  2520. ONE_MINUS_SRC_COLOR = 769,
  2521. DST_COLOR = 774,
  2522. ONE_MINUS_DST_COLOR = 775,
  2523. SRC_ALPHA = 770,
  2524. ONE_MINUS_SRC_ALPHA = 771,
  2525. DST_ALPHA = 772,
  2526. ONE_MINUS_DST_ALPHA = 773,
  2527. CONSTANT_COLOR = 32769,
  2528. ONE_MINUS_CONSTANT_COLOR = 32770,
  2529. CONSTANT_ALPHA = 32771,
  2530. ONE_MINUS_CONSTANT_ALPHA = 32772,
  2531. SRC_ALPHA_SATURATE = 776
  2532. }
  2533. /** @hidden */
  2534. export interface IGLTFProperty {
  2535. extensions?: {
  2536. [key: string]: any;
  2537. };
  2538. extras?: Object;
  2539. }
  2540. /** @hidden */
  2541. export interface IGLTFChildRootProperty extends IGLTFProperty {
  2542. name?: string;
  2543. }
  2544. /** @hidden */
  2545. export interface IGLTFAccessor extends IGLTFChildRootProperty {
  2546. bufferView: string;
  2547. byteOffset: number;
  2548. byteStride: number;
  2549. count: number;
  2550. type: string;
  2551. componentType: EComponentType;
  2552. max?: number[];
  2553. min?: number[];
  2554. name?: string;
  2555. }
  2556. /** @hidden */
  2557. export interface IGLTFBufferView extends IGLTFChildRootProperty {
  2558. buffer: string;
  2559. byteOffset: number;
  2560. byteLength: number;
  2561. byteStride: number;
  2562. target?: number;
  2563. }
  2564. /** @hidden */
  2565. export interface IGLTFBuffer extends IGLTFChildRootProperty {
  2566. uri: string;
  2567. byteLength?: number;
  2568. type?: string;
  2569. }
  2570. /** @hidden */
  2571. export interface IGLTFShader extends IGLTFChildRootProperty {
  2572. uri: string;
  2573. type: EShaderType;
  2574. }
  2575. /** @hidden */
  2576. export interface IGLTFProgram extends IGLTFChildRootProperty {
  2577. attributes: string[];
  2578. fragmentShader: string;
  2579. vertexShader: string;
  2580. }
  2581. /** @hidden */
  2582. export interface IGLTFTechniqueParameter {
  2583. type: number;
  2584. count?: number;
  2585. semantic?: string;
  2586. node?: string;
  2587. value?: number | boolean | string | Array<any>;
  2588. source?: string;
  2589. babylonValue?: any;
  2590. }
  2591. /** @hidden */
  2592. export interface IGLTFTechniqueCommonProfile {
  2593. lightingModel: string;
  2594. texcoordBindings: Object;
  2595. parameters?: Array<any>;
  2596. }
  2597. /** @hidden */
  2598. export interface IGLTFTechniqueStatesFunctions {
  2599. blendColor?: number[];
  2600. blendEquationSeparate?: number[];
  2601. blendFuncSeparate?: number[];
  2602. colorMask: boolean[];
  2603. cullFace: number[];
  2604. }
  2605. /** @hidden */
  2606. export interface IGLTFTechniqueStates {
  2607. enable: number[];
  2608. functions: IGLTFTechniqueStatesFunctions;
  2609. }
  2610. /** @hidden */
  2611. export interface IGLTFTechnique extends IGLTFChildRootProperty {
  2612. parameters: {
  2613. [key: string]: IGLTFTechniqueParameter;
  2614. };
  2615. program: string;
  2616. attributes: {
  2617. [key: string]: string;
  2618. };
  2619. uniforms: {
  2620. [key: string]: string;
  2621. };
  2622. states: IGLTFTechniqueStates;
  2623. }
  2624. /** @hidden */
  2625. export interface IGLTFMaterial extends IGLTFChildRootProperty {
  2626. technique?: string;
  2627. values: string[];
  2628. }
  2629. /** @hidden */
  2630. export interface IGLTFMeshPrimitive extends IGLTFProperty {
  2631. attributes: {
  2632. [key: string]: string;
  2633. };
  2634. indices: string;
  2635. material: string;
  2636. mode?: number;
  2637. }
  2638. /** @hidden */
  2639. export interface IGLTFMesh extends IGLTFChildRootProperty {
  2640. primitives: IGLTFMeshPrimitive[];
  2641. }
  2642. /** @hidden */
  2643. export interface IGLTFImage extends IGLTFChildRootProperty {
  2644. uri: string;
  2645. }
  2646. /** @hidden */
  2647. export interface IGLTFSampler extends IGLTFChildRootProperty {
  2648. magFilter?: number;
  2649. minFilter?: number;
  2650. wrapS?: number;
  2651. wrapT?: number;
  2652. }
  2653. /** @hidden */
  2654. export interface IGLTFTexture extends IGLTFChildRootProperty {
  2655. sampler: string;
  2656. source: string;
  2657. format?: ETextureFormat;
  2658. internalFormat?: ETextureFormat;
  2659. target?: number;
  2660. type?: number;
  2661. babylonTexture?: BABYLON.Texture;
  2662. }
  2663. /** @hidden */
  2664. export interface IGLTFAmbienLight {
  2665. color?: number[];
  2666. }
  2667. /** @hidden */
  2668. export interface IGLTFDirectionalLight {
  2669. color?: number[];
  2670. }
  2671. /** @hidden */
  2672. export interface IGLTFPointLight {
  2673. color?: number[];
  2674. constantAttenuation?: number;
  2675. linearAttenuation?: number;
  2676. quadraticAttenuation?: number;
  2677. }
  2678. /** @hidden */
  2679. export interface IGLTFSpotLight {
  2680. color?: number[];
  2681. constantAttenuation?: number;
  2682. fallOfAngle?: number;
  2683. fallOffExponent?: number;
  2684. linearAttenuation?: number;
  2685. quadraticAttenuation?: number;
  2686. }
  2687. /** @hidden */
  2688. export interface IGLTFLight extends IGLTFChildRootProperty {
  2689. type: string;
  2690. }
  2691. /** @hidden */
  2692. export interface IGLTFCameraOrthographic {
  2693. xmag: number;
  2694. ymag: number;
  2695. zfar: number;
  2696. znear: number;
  2697. }
  2698. /** @hidden */
  2699. export interface IGLTFCameraPerspective {
  2700. aspectRatio: number;
  2701. yfov: number;
  2702. zfar: number;
  2703. znear: number;
  2704. }
  2705. /** @hidden */
  2706. export interface IGLTFCamera extends IGLTFChildRootProperty {
  2707. type: string;
  2708. }
  2709. /** @hidden */
  2710. export interface IGLTFAnimationChannelTarget {
  2711. id: string;
  2712. path: string;
  2713. }
  2714. /** @hidden */
  2715. export interface IGLTFAnimationChannel {
  2716. sampler: string;
  2717. target: IGLTFAnimationChannelTarget;
  2718. }
  2719. /** @hidden */
  2720. export interface IGLTFAnimationSampler {
  2721. input: string;
  2722. output: string;
  2723. interpolation?: string;
  2724. }
  2725. /** @hidden */
  2726. export interface IGLTFAnimation extends IGLTFChildRootProperty {
  2727. channels?: IGLTFAnimationChannel[];
  2728. parameters?: {
  2729. [key: string]: string;
  2730. };
  2731. samplers?: {
  2732. [key: string]: IGLTFAnimationSampler;
  2733. };
  2734. }
  2735. /** @hidden */
  2736. export interface IGLTFNodeInstanceSkin {
  2737. skeletons: string[];
  2738. skin: string;
  2739. meshes: string[];
  2740. }
  2741. /** @hidden */
  2742. export interface IGLTFSkins extends IGLTFChildRootProperty {
  2743. bindShapeMatrix: number[];
  2744. inverseBindMatrices: string;
  2745. jointNames: string[];
  2746. babylonSkeleton?: BABYLON.Skeleton;
  2747. }
  2748. /** @hidden */
  2749. export interface IGLTFNode extends IGLTFChildRootProperty {
  2750. camera?: string;
  2751. children: string[];
  2752. skin?: string;
  2753. jointName?: string;
  2754. light?: string;
  2755. matrix: number[];
  2756. mesh?: string;
  2757. meshes?: string[];
  2758. rotation?: number[];
  2759. scale?: number[];
  2760. translation?: number[];
  2761. babylonNode?: BABYLON.Node;
  2762. }
  2763. /** @hidden */
  2764. export interface IGLTFScene extends IGLTFChildRootProperty {
  2765. nodes: string[];
  2766. }
  2767. /** @hidden */
  2768. export interface IGLTFRuntime {
  2769. extensions: {
  2770. [key: string]: any;
  2771. };
  2772. accessors: {
  2773. [key: string]: IGLTFAccessor;
  2774. };
  2775. buffers: {
  2776. [key: string]: IGLTFBuffer;
  2777. };
  2778. bufferViews: {
  2779. [key: string]: IGLTFBufferView;
  2780. };
  2781. meshes: {
  2782. [key: string]: IGLTFMesh;
  2783. };
  2784. lights: {
  2785. [key: string]: IGLTFLight;
  2786. };
  2787. cameras: {
  2788. [key: string]: IGLTFCamera;
  2789. };
  2790. nodes: {
  2791. [key: string]: IGLTFNode;
  2792. };
  2793. images: {
  2794. [key: string]: IGLTFImage;
  2795. };
  2796. textures: {
  2797. [key: string]: IGLTFTexture;
  2798. };
  2799. shaders: {
  2800. [key: string]: IGLTFShader;
  2801. };
  2802. programs: {
  2803. [key: string]: IGLTFProgram;
  2804. };
  2805. samplers: {
  2806. [key: string]: IGLTFSampler;
  2807. };
  2808. techniques: {
  2809. [key: string]: IGLTFTechnique;
  2810. };
  2811. materials: {
  2812. [key: string]: IGLTFMaterial;
  2813. };
  2814. animations: {
  2815. [key: string]: IGLTFAnimation;
  2816. };
  2817. skins: {
  2818. [key: string]: IGLTFSkins;
  2819. };
  2820. currentScene?: Object;
  2821. scenes: {
  2822. [key: string]: IGLTFScene;
  2823. };
  2824. extensionsUsed: string[];
  2825. extensionsRequired?: string[];
  2826. buffersCount: number;
  2827. shaderscount: number;
  2828. scene: BABYLON.Scene;
  2829. rootUrl: string;
  2830. loadedBufferCount: number;
  2831. loadedBufferViews: {
  2832. [name: string]: ArrayBufferView;
  2833. };
  2834. loadedShaderCount: number;
  2835. importOnlyMeshes: boolean;
  2836. importMeshesNames?: string[];
  2837. dummyNodes: BABYLON.Node[];
  2838. }
  2839. /** @hidden */
  2840. export interface INodeToRoot {
  2841. bone: BABYLON.Bone;
  2842. node: IGLTFNode;
  2843. id: string;
  2844. }
  2845. /** @hidden */
  2846. export interface IJointNode {
  2847. node: IGLTFNode;
  2848. id: string;
  2849. }
  2850. }
  2851. declare module BABYLON.GLTF1 {
  2852. /**
  2853. * Utils functions for GLTF
  2854. * @hidden
  2855. */
  2856. export class GLTFUtils {
  2857. /**
  2858. * Sets the given "parameter" matrix
  2859. * @param scene: the BABYLON.Scene object
  2860. * @param source: the source node where to pick the matrix
  2861. * @param parameter: the GLTF technique parameter
  2862. * @param uniformName: the name of the shader's uniform
  2863. * @param shaderMaterial: the shader material
  2864. */
  2865. static SetMatrix(scene: BABYLON.Scene, source: BABYLON.Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: BABYLON.ShaderMaterial | BABYLON.Effect): void;
  2866. /**
  2867. * Sets the given "parameter" matrix
  2868. * @param shaderMaterial: the shader material
  2869. * @param uniform: the name of the shader's uniform
  2870. * @param value: the value of the uniform
  2871. * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
  2872. */
  2873. static SetUniform(shaderMaterial: BABYLON.ShaderMaterial | BABYLON.Effect, uniform: string, value: any, type: number): boolean;
  2874. /**
  2875. * Returns the wrap mode of the texture
  2876. * @param mode: the mode value
  2877. */
  2878. static GetWrapMode(mode: number): number;
  2879. /**
  2880. * Returns the byte stride giving an accessor
  2881. * @param accessor: the GLTF accessor objet
  2882. */
  2883. static GetByteStrideFromType(accessor: IGLTFAccessor): number;
  2884. /**
  2885. * Returns the texture filter mode giving a mode value
  2886. * @param mode: the filter mode value
  2887. */
  2888. static GetTextureFilterMode(mode: number): ETextureFilterType;
  2889. static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
  2890. /**
  2891. * Returns a buffer from its accessor
  2892. * @param gltfRuntime: the GLTF runtime
  2893. * @param accessor: the GLTF accessor
  2894. */
  2895. static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
  2896. /**
  2897. * Decodes a buffer view into a string
  2898. * @param view: the buffer view
  2899. */
  2900. static DecodeBufferToText(view: ArrayBufferView): string;
  2901. /**
  2902. * Returns the default material of gltf. Related to
  2903. * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
  2904. * @param scene: the Babylon.js scene
  2905. */
  2906. static GetDefaultMaterial(scene: BABYLON.Scene): BABYLON.ShaderMaterial;
  2907. }
  2908. }
  2909. declare module BABYLON.GLTF1 {
  2910. /** @hidden */
  2911. export class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {
  2912. constructor();
  2913. loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
  2914. loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: BABYLON.Material) => void, onError: (message: string) => void): boolean;
  2915. }
  2916. }
  2917. declare module BABYLON {
  2918. /**
  2919. * Helper class for working with arrays when loading the glTF asset
  2920. */
  2921. export class ArrayItem {
  2922. /**
  2923. * Gets an item from the given array.
  2924. * @param context The context when loading the asset
  2925. * @param array The array to get the item from
  2926. * @param index The index to the array
  2927. * @returns The array item
  2928. */
  2929. static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
  2930. /**
  2931. * Assign an `index` field to each item of the given array.
  2932. * @param array The array of items
  2933. */
  2934. static Assign(array?: IArrayItem[]): void;
  2935. }
  2936. /**
  2937. * The glTF 2.0 loader
  2938. */
  2939. export class GLTF2Loader implements IGLTFLoader {
  2940. /** The glTF object parsed from the JSON. */
  2941. gltf: IGLTF;
  2942. /** The Babylon scene when loading the asset. */
  2943. babylonScene: BABYLON.Scene;
  2944. /** @hidden */
  2945. _completePromises: Promise<any>[];
  2946. /**
  2947. * Registers a loader extension.
  2948. * @param name The name of the loader extension.
  2949. * @param factory The factory function that creates the loader extension.
  2950. */
  2951. static RegisterExtension(name: string, factory: (loader: GLTF2Loader) => IGLTFLoaderExtensionV2): void;
  2952. /**
  2953. * Unregisters a loader extension.
  2954. * @param name The name of the loader extenion.
  2955. * @returns A boolean indicating whether the extension has been unregistered
  2956. */
  2957. static UnregisterExtension(name: string): boolean;
  2958. /**
  2959. * Gets the loader state.
  2960. */
  2961. readonly state: BABYLON.Nullable<GLTFLoaderState>;
  2962. /** @hidden */
  2963. constructor(parent: GLTFFileLoader);
  2964. /** @hidden */
  2965. dispose(): void;
  2966. /** @hidden */
  2967. importMeshAsync(meshesNames: any, scene: BABYLON.Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void, fileName?: string): Promise<{
  2968. meshes: BABYLON.AbstractMesh[];
  2969. particleSystems: BABYLON.IParticleSystem[];
  2970. skeletons: BABYLON.Skeleton[];
  2971. animationGroups: BABYLON.AnimationGroup[];
  2972. }>;
  2973. /** @hidden */
  2974. loadAsync(scene: BABYLON.Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: BABYLON.SceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
  2975. /**
  2976. * Loads a glTF scene.
  2977. * @param context The context when loading the asset
  2978. * @param scene The glTF scene property
  2979. * @returns A promise that resolves when the load is complete
  2980. */
  2981. loadSceneAsync(context: string, scene: IScene): Promise<void>;
  2982. /**
  2983. * Loads a glTF node.
  2984. * @param context The context when loading the asset
  2985. * @param node The glTF node property
  2986. * @param assign A function called synchronously after parsing the glTF properties
  2987. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete
  2988. */
  2989. loadNodeAsync(context: string, node: INode, assign?: (babylonMesh: BABYLON.Mesh) => void): Promise<BABYLON.Mesh>;
  2990. /**
  2991. * Loads a glTF camera.
  2992. * @param context The context when loading the asset
  2993. * @param camera The glTF camera property
  2994. * @param assign A function called synchronously after parsing the glTF properties
  2995. * @returns A promise that resolves with the loaded Babylon camera when the load is complete
  2996. */
  2997. loadCameraAsync(context: string, camera: ICamera, assign?: (babylonCamera: BABYLON.Camera) => void): Promise<BABYLON.Camera>;
  2998. /**
  2999. * Loads a glTF animation.
  3000. * @param context The context when loading the asset
  3001. * @param animation The glTF animation property
  3002. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete
  3003. */
  3004. loadAnimationAsync(context: string, animation: IAnimation): Promise<BABYLON.AnimationGroup>;
  3005. /**
  3006. * Loads a glTF buffer view.
  3007. * @param context The context when loading the asset
  3008. * @param bufferView The glTF buffer view property
  3009. * @returns A promise that resolves with the loaded data when the load is complete
  3010. */
  3011. loadBufferViewAsync(context: string, bufferView: IBufferView): Promise<ArrayBufferView>;
  3012. /** @hidden */
  3013. _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: BABYLON.Mesh, babylonDrawMode: number, assign?: (babylonMaterial: BABYLON.Material) => void): Promise<BABYLON.Material>;
  3014. /**
  3015. * Creates a Babylon material from a glTF material.
  3016. * @param context The context when loading the asset
  3017. * @param material The glTF material property
  3018. * @param babylonDrawMode The draw mode for the Babylon material
  3019. * @returns The Babylon material
  3020. */
  3021. createMaterial(context: string, material: IMaterial, babylonDrawMode: number): BABYLON.Material;
  3022. /**
  3023. * Loads properties from a glTF material into a Babylon material.
  3024. * @param context The context when loading the asset
  3025. * @param material The glTF material property
  3026. * @param babylonMaterial The Babylon material
  3027. * @returns A promise that resolves when the load is complete
  3028. */
  3029. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: BABYLON.Material): Promise<void>;
  3030. /**
  3031. * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
  3032. * @param context The context when loading the asset
  3033. * @param material The glTF material property
  3034. * @param babylonMaterial The Babylon material
  3035. * @returns A promise that resolves when the load is complete
  3036. */
  3037. loadMaterialBasePropertiesAsync(context: string, material: IMaterial, babylonMaterial: BABYLON.Material): Promise<void>;
  3038. /**
  3039. * Loads the alpha properties from a glTF material into a Babylon material.
  3040. * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.
  3041. * @param context The context when loading the asset
  3042. * @param material The glTF material property
  3043. * @param babylonMaterial The Babylon material
  3044. */
  3045. loadMaterialAlphaProperties(context: string, material: IMaterial, babylonMaterial: BABYLON.Material): void;
  3046. /**
  3047. * Loads a glTF texture info.
  3048. * @param context The context when loading the asset
  3049. * @param textureInfo The glTF texture info property
  3050. * @param assign A function called synchronously after parsing the glTF properties
  3051. * @returns A promise that resolves with the loaded Babylon texture when the load is complete
  3052. */
  3053. loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign?: (babylonTexture: BABYLON.BaseTexture) => void): Promise<BABYLON.BaseTexture>;
  3054. /**
  3055. * Loads a glTF image.
  3056. * @param context The context when loading the asset
  3057. * @param image The glTF image property
  3058. * @returns A promise that resolves with the loaded data when the load is complete
  3059. */
  3060. loadImageAsync(context: string, image: IImage): Promise<ArrayBufferView>;
  3061. /**
  3062. * Loads a glTF uri.
  3063. * @param context The context when loading the asset
  3064. * @param uri The base64 or relative uri
  3065. * @returns A promise that resolves with the loaded data when the load is complete
  3066. */
  3067. loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
  3068. /**
  3069. * Helper method called by a loader extension to load an glTF extension.
  3070. * @param context The context when loading the asset
  3071. * @param property The glTF property to load the extension from
  3072. * @param extensionName The name of the extension to load
  3073. * @param actionAsync The action to run
  3074. * @returns The promise returned by actionAsync or null if the extension does not exist
  3075. */
  3076. static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: BABYLON.GLTF2.IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => BABYLON.Nullable<Promise<TResult>>): BABYLON.Nullable<Promise<TResult>>;
  3077. /**
  3078. * Helper method called by a loader extension to load a glTF extra.
  3079. * @param context The context when loading the asset
  3080. * @param property The glTF property to load the extra from
  3081. * @param extensionName The name of the extension to load
  3082. * @param actionAsync The action to run
  3083. * @returns The promise returned by actionAsync or null if the extra does not exist
  3084. */
  3085. static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: BABYLON.GLTF2.IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => BABYLON.Nullable<Promise<TResult>>): BABYLON.Nullable<Promise<TResult>>;
  3086. /**
  3087. * Increments the indentation level and logs a message.
  3088. * @param message The message to log
  3089. */
  3090. logOpen(message: string): void;
  3091. /**
  3092. * Decrements the indentation level.
  3093. */
  3094. logClose(): void;
  3095. /**
  3096. * Logs a message
  3097. * @param message The message to log
  3098. */
  3099. log(message: string): void;
  3100. /**
  3101. * Starts a performance counter.
  3102. * @param counterName The name of the performance counter
  3103. */
  3104. startPerformanceCounter(counterName: string): void;
  3105. /**
  3106. * Ends a performance counter.
  3107. * @param counterName The name of the performance counter
  3108. */
  3109. endPerformanceCounter(counterName: string): void;
  3110. }
  3111. }
  3112. declare module BABYLON {
  3113. /** @hidden */
  3114. export var __IGLTFLoaderExtensionV2: number;
  3115. /**
  3116. * Interface for a glTF loader extension.
  3117. */
  3118. export interface IGLTFLoaderExtensionV2 extends IGLTFLoaderExtension, BABYLON.IDisposable {
  3119. /**
  3120. * Called after the loader state changes to LOADING.
  3121. */
  3122. onLoading?(): void;
  3123. /**
  3124. * Called after the loader state changes to READY.
  3125. */
  3126. onReady?(): void;
  3127. /**
  3128. * Define this method to modify the default behavior when loading scenes.
  3129. * @param context The context when loading the asset
  3130. * @param scene The glTF scene property
  3131. * @returns A promise that resolves when the load is complete or null if not handled
  3132. */
  3133. loadSceneAsync?(context: string, scene: IScene): BABYLON.Nullable<Promise<void>>;
  3134. /**
  3135. * Define this method to modify the default behavior when loading nodes.
  3136. * @param context The context when loading the asset
  3137. * @param node The glTF node property
  3138. * @param assign A function called synchronously after parsing the glTF properties
  3139. * @returns A promise that resolves with the loaded Babylon mesh when the load is complete or null if not handled
  3140. */
  3141. loadNodeAsync?(context: string, node: INode, assign: (babylonMesh: BABYLON.Mesh) => void): BABYLON.Nullable<Promise<BABYLON.Mesh>>;
  3142. /**
  3143. * Define this method to modify the default behavior when loading cameras.
  3144. * @param context The context when loading the asset
  3145. * @param camera The glTF camera property
  3146. * @param assign A function called synchronously after parsing the glTF properties
  3147. * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
  3148. */
  3149. loadCameraAsync?(context: string, camera: ICamera, assign: (babylonCamera: BABYLON.Camera) => void): BABYLON.Nullable<Promise<BABYLON.Camera>>;
  3150. /**
  3151. * @hidden Define this method to modify the default behavior when loading vertex data for mesh primitives.
  3152. * @param context The context when loading the asset
  3153. * @param primitive The glTF mesh primitive property
  3154. * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled
  3155. */
  3156. _loadVertexDataAsync?(context: string, primitive: IMeshPrimitive, babylonMesh: BABYLON.Mesh): BABYLON.Nullable<Promise<BABYLON.Geometry>>;
  3157. /**
  3158. * @hidden Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.
  3159. * @param context The context when loading the asset
  3160. * @param material The glTF material property
  3161. * @param assign A function called synchronously after parsing the glTF properties
  3162. * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled
  3163. */
  3164. _loadMaterialAsync?(context: string, material: IMaterial, babylonMesh: BABYLON.Mesh, babylonDrawMode: number, assign: (babylonMaterial: BABYLON.Material) => void): BABYLON.Nullable<Promise<BABYLON.Material>>;
  3165. /**
  3166. * Define this method to modify the default behavior when creating materials.
  3167. * @param context The context when loading the asset
  3168. * @param material The glTF material property
  3169. * @param babylonDrawMode The draw mode for the Babylon material
  3170. * @returns The Babylon material or null if not handled
  3171. */
  3172. createMaterial?(context: string, material: IMaterial, babylonDrawMode: number): BABYLON.Nullable<BABYLON.Material>;
  3173. /**
  3174. * Define this method to modify the default behavior when loading material properties.
  3175. * @param context The context when loading the asset
  3176. * @param material The glTF material property
  3177. * @param babylonMaterial The Babylon material
  3178. * @returns A promise that resolves when the load is complete or null if not handled
  3179. */
  3180. loadMaterialPropertiesAsync?(context: string, material: IMaterial, babylonMaterial: BABYLON.Material): BABYLON.Nullable<Promise<void>>;
  3181. /**
  3182. * Define this method to modify the default behavior when loading texture infos.
  3183. * @param context The context when loading the asset
  3184. * @param textureInfo The glTF texture info property
  3185. * @param assign A function called synchronously after parsing the glTF properties
  3186. * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
  3187. */
  3188. loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BABYLON.BaseTexture) => void): BABYLON.Nullable<Promise<BABYLON.BaseTexture>>;
  3189. /**
  3190. * Define this method to modify the default behavior when loading animations.
  3191. * @param context The context when loading the asset
  3192. * @param animation The glTF animation property
  3193. * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
  3194. */
  3195. loadAnimationAsync?(context: string, animation: IAnimation): BABYLON.Nullable<Promise<BABYLON.AnimationGroup>>;
  3196. /**
  3197. * Define this method to modify the default behavior when loading uris.
  3198. * @param context The context when loading the asset
  3199. * @param uri The uri to load
  3200. * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
  3201. */
  3202. _loadUriAsync?(context: string, uri: string): BABYLON.Nullable<Promise<ArrayBufferView>>;
  3203. }
  3204. }
  3205. declare module BABYLON {
  3206. /** @hidden */
  3207. export var __IGLTFLoaderInterfacesV2: number;
  3208. /**
  3209. * Loader interface with an index field.
  3210. */
  3211. export interface IArrayItem {
  3212. /**
  3213. * The index of this item in the array.
  3214. */
  3215. index: number;
  3216. }
  3217. /**
  3218. * Loader interface with additional members.
  3219. */
  3220. export interface IAccessor extends BABYLON.GLTF2.IAccessor, IArrayItem {
  3221. /** @hidden */
  3222. _data?: Promise<ArrayBufferView>;
  3223. /** @hidden */
  3224. _babylonVertexBuffer?: Promise<BABYLON.VertexBuffer>;
  3225. }
  3226. /**
  3227. * Loader interface with additional members.
  3228. */
  3229. export interface IAnimationChannel extends BABYLON.GLTF2.IAnimationChannel, IArrayItem {
  3230. }
  3231. /** @hidden */
  3232. export interface _IAnimationSamplerData {
  3233. input: Float32Array;
  3234. interpolation: BABYLON.GLTF2.AnimationSamplerInterpolation;
  3235. output: Float32Array;
  3236. }
  3237. /**
  3238. * Loader interface with additional members.
  3239. */
  3240. export interface IAnimationSampler extends BABYLON.GLTF2.IAnimationSampler, IArrayItem {
  3241. /** @hidden */
  3242. _data?: Promise<_IAnimationSamplerData>;
  3243. }
  3244. /**
  3245. * Loader interface with additional members.
  3246. */
  3247. export interface IAnimation extends BABYLON.GLTF2.IAnimation, IArrayItem {
  3248. channels: IAnimationChannel[];
  3249. samplers: IAnimationSampler[];
  3250. /** @hidden */
  3251. _babylonAnimationGroup?: BABYLON.AnimationGroup;
  3252. }
  3253. /**
  3254. * Loader interface with additional members.
  3255. */
  3256. export interface IBuffer extends BABYLON.GLTF2.IBuffer, IArrayItem {
  3257. /** @hidden */
  3258. _data?: Promise<ArrayBufferView>;
  3259. }
  3260. /**
  3261. * Loader interface with additional members.
  3262. */
  3263. export interface IBufferView extends BABYLON.GLTF2.IBufferView, IArrayItem {
  3264. /** @hidden */
  3265. _data?: Promise<ArrayBufferView>;
  3266. /** @hidden */
  3267. _babylonBuffer?: Promise<BABYLON.Buffer>;
  3268. }
  3269. /**
  3270. * Loader interface with additional members.
  3271. */
  3272. export interface ICamera extends BABYLON.GLTF2.ICamera, IArrayItem {
  3273. }
  3274. /**
  3275. * Loader interface with additional members.
  3276. */
  3277. export interface IImage extends BABYLON.GLTF2.IImage, IArrayItem {
  3278. /** @hidden */
  3279. _data?: Promise<ArrayBufferView>;
  3280. }
  3281. /**
  3282. * Loader interface with additional members.
  3283. */
  3284. export interface IMaterialNormalTextureInfo extends BABYLON.GLTF2.IMaterialNormalTextureInfo, BABYLON.GLTF2.ITextureInfo {
  3285. }
  3286. /**
  3287. * Loader interface with additional members.
  3288. */
  3289. export interface IMaterialOcclusionTextureInfo extends BABYLON.GLTF2.IMaterialOcclusionTextureInfo, BABYLON.GLTF2.ITextureInfo {
  3290. }
  3291. /**
  3292. * Loader interface with additional members.
  3293. */
  3294. export interface IMaterialPbrMetallicRoughness extends BABYLON.GLTF2.IMaterialPbrMetallicRoughness {
  3295. baseColorTexture?: ITextureInfo;
  3296. metallicRoughnessTexture?: ITextureInfo;
  3297. }
  3298. /**
  3299. * Loader interface with additional members.
  3300. */
  3301. export interface IMaterial extends BABYLON.GLTF2.IMaterial, IArrayItem {
  3302. pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
  3303. normalTexture?: IMaterialNormalTextureInfo;
  3304. occlusionTexture?: IMaterialOcclusionTextureInfo;
  3305. emissiveTexture?: ITextureInfo;
  3306. /** @hidden */
  3307. _babylonData?: {
  3308. [drawMode: number]: {
  3309. material: BABYLON.Material;
  3310. meshes: BABYLON.AbstractMesh[];
  3311. promise: Promise<void>;
  3312. };
  3313. };
  3314. }
  3315. /**
  3316. * Loader interface with additional members.
  3317. */
  3318. export interface IMesh extends BABYLON.GLTF2.IMesh, IArrayItem {
  3319. primitives: IMeshPrimitive[];
  3320. }
  3321. /**
  3322. * Loader interface with additional members.
  3323. */
  3324. export interface IMeshPrimitive extends BABYLON.GLTF2.IMeshPrimitive, IArrayItem {
  3325. }
  3326. /**
  3327. * Loader interface with additional members.
  3328. */
  3329. export interface INode extends BABYLON.GLTF2.INode, IArrayItem {
  3330. /**
  3331. * The parent glTF node.
  3332. */
  3333. parent?: INode;
  3334. /** @hidden */
  3335. _babylonMesh?: BABYLON.Mesh;
  3336. /** @hidden */
  3337. _primitiveBabylonMeshes?: BABYLON.Mesh[];
  3338. /** @hidden */
  3339. _babylonBones?: BABYLON.Bone[];
  3340. /** @hidden */
  3341. _numMorphTargets?: number;
  3342. }
  3343. /** @hidden */
  3344. export interface _ISamplerData {
  3345. noMipMaps: boolean;
  3346. samplingMode: number;
  3347. wrapU: number;
  3348. wrapV: number;
  3349. }
  3350. /**
  3351. * Loader interface with additional members.
  3352. */
  3353. export interface ISampler extends BABYLON.GLTF2.ISampler, IArrayItem {
  3354. /** @hidden */
  3355. _data?: _ISamplerData;
  3356. }
  3357. /**
  3358. * Loader interface with additional members.
  3359. */
  3360. export interface IScene extends BABYLON.GLTF2.IScene, IArrayItem {
  3361. }
  3362. /**
  3363. * Loader interface with additional members.
  3364. */
  3365. export interface ISkin extends BABYLON.GLTF2.ISkin, IArrayItem {
  3366. /** @hidden */
  3367. _babylonSkeleton?: BABYLON.Skeleton;
  3368. /** @hidden */
  3369. _promise?: Promise<void>;
  3370. }
  3371. /**
  3372. * Loader interface with additional members.
  3373. */
  3374. export interface ITexture extends BABYLON.GLTF2.ITexture, IArrayItem {
  3375. }
  3376. /**
  3377. * Loader interface with additional members.
  3378. */
  3379. export interface ITextureInfo extends BABYLON.GLTF2.ITextureInfo {
  3380. }
  3381. /**
  3382. * Loader interface with additional members.
  3383. */
  3384. export interface IGLTF extends BABYLON.GLTF2.IGLTF {
  3385. accessors?: IAccessor[];
  3386. animations?: IAnimation[];
  3387. buffers?: IBuffer[];
  3388. bufferViews?: IBufferView[];
  3389. cameras?: ICamera[];
  3390. images?: IImage[];
  3391. materials?: IMaterial[];
  3392. meshes?: IMesh[];
  3393. nodes?: INode[];
  3394. samplers?: ISampler[];
  3395. scenes?: IScene[];
  3396. skins?: ISkin[];
  3397. textures?: ITexture[];
  3398. }
  3399. }
  3400. declare module BABYLON {
  3401. /**
  3402. * [Specification](https://github.com/KhronosGroup/glTF/blob/eb3e32332042e04691a5f35103f8c261e50d8f1e/extensions/2.0/Khronos/EXT_lights_image_based/README.md) (Experimental)
  3403. */
  3404. export class EXT_lights_image_based implements IGLTFLoaderExtensionV2 {
  3405. /** The name of this extension. */
  3406. readonly name: string;
  3407. /** Defines whether this extension is enabled. */
  3408. enabled: boolean;
  3409. /** @hidden */
  3410. constructor(loader: GLTF2Loader);
  3411. /** @hidden */
  3412. dispose(): void;
  3413. /** @hidden */
  3414. onLoading(): void;
  3415. /** @hidden */
  3416. loadSceneAsync(context: string, scene: IScene): BABYLON.Nullable<Promise<void>>;
  3417. }
  3418. }
  3419. declare module BABYLON {
  3420. /**
  3421. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
  3422. */
  3423. export class KHR_draco_mesh_compression implements IGLTFLoaderExtensionV2 {
  3424. /** The name of this extension. */
  3425. readonly name: string;
  3426. /** Defines whether this extension is enabled. */
  3427. enabled: boolean;
  3428. /** @hidden */
  3429. constructor(loader: GLTF2Loader);
  3430. /** @hidden */
  3431. dispose(): void;
  3432. /** @hidden */
  3433. _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: BABYLON.Mesh): BABYLON.Nullable<Promise<BABYLON.Geometry>>;
  3434. }
  3435. }
  3436. declare module BABYLON {
  3437. /**
  3438. * [Specification](https://github.com/KhronosGroup/glTF/blob/1048d162a44dbcb05aefc1874bfd423cf60135a6/extensions/2.0/Khronos/KHR_lights_punctual/README.md) (Experimental)
  3439. */
  3440. export class KHR_lights implements IGLTFLoaderExtensionV2 {
  3441. /** The name of this extension. */
  3442. readonly name: string;
  3443. /** Defines whether this extension is enabled. */
  3444. enabled: boolean;
  3445. /** @hidden */
  3446. constructor(loader: GLTF2Loader);
  3447. /** @hidden */
  3448. dispose(): void;
  3449. /** @hidden */
  3450. onLoading(): void;
  3451. /** @hidden */
  3452. loadNodeAsync(context: string, node: INode, assign: (babylonMesh: BABYLON.Mesh) => void): BABYLON.Nullable<Promise<BABYLON.Mesh>>;
  3453. }
  3454. }
  3455. declare module BABYLON {
  3456. /**
  3457. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
  3458. */
  3459. export class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtensionV2 {
  3460. /** The name of this extension. */
  3461. readonly name: string;
  3462. /** Defines whether this extension is enabled. */
  3463. enabled: boolean;
  3464. /** @hidden */
  3465. constructor(loader: GLTF2Loader);
  3466. /** @hidden */
  3467. dispose(): void;
  3468. /** @hidden */
  3469. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: BABYLON.Material): BABYLON.Nullable<Promise<void>>;
  3470. }
  3471. }
  3472. declare module BABYLON {
  3473. /**
  3474. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
  3475. */
  3476. export class KHR_materials_unlit implements IGLTFLoaderExtensionV2 {
  3477. /** The name of this extension. */
  3478. readonly name: string;
  3479. /** Defines whether this extension is enabled. */
  3480. enabled: boolean;
  3481. /** @hidden */
  3482. constructor(loader: GLTF2Loader);
  3483. /** @hidden */
  3484. dispose(): void;
  3485. /** @hidden */
  3486. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: BABYLON.Material): BABYLON.Nullable<Promise<void>>;
  3487. }
  3488. }
  3489. declare module BABYLON {
  3490. /**
  3491. * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform/README.md)
  3492. */
  3493. export class KHR_texture_transform implements IGLTFLoaderExtensionV2 {
  3494. /** The name of this extension. */
  3495. readonly name: string;
  3496. /** Defines whether this extension is enabled. */
  3497. enabled: boolean;
  3498. /** @hidden */
  3499. constructor(loader: GLTF2Loader);
  3500. /** @hidden */
  3501. dispose(): void;
  3502. /** @hidden */
  3503. loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BABYLON.BaseTexture) => void): BABYLON.Nullable<Promise<BABYLON.BaseTexture>>;
  3504. }
  3505. }
  3506. declare module BABYLON {
  3507. /**
  3508. * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
  3509. */
  3510. export class MSFT_audio_emitter implements IGLTFLoaderExtensionV2 {
  3511. /** The name of this extension. */
  3512. readonly name: string;
  3513. /** Defines whether this extension is enabled. */
  3514. enabled: boolean;
  3515. /** @hidden */
  3516. constructor(loader: GLTF2Loader);
  3517. /** @hidden */
  3518. dispose(): void;
  3519. /** @hidden */
  3520. onLoading(): void;
  3521. /** @hidden */
  3522. loadSceneAsync(context: string, scene: IScene): BABYLON.Nullable<Promise<void>>;
  3523. /** @hidden */
  3524. loadNodeAsync(context: string, node: INode, assign: (babylonMesh: BABYLON.Mesh) => void): BABYLON.Nullable<Promise<BABYLON.Mesh>>;
  3525. /** @hidden */
  3526. loadAnimationAsync(context: string, animation: IAnimation): BABYLON.Nullable<Promise<BABYLON.AnimationGroup>>;
  3527. }
  3528. }
  3529. declare module BABYLON {
  3530. /**
  3531. * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
  3532. */
  3533. export class MSFT_lod implements IGLTFLoaderExtensionV2 {
  3534. /** The name of this extension. */
  3535. readonly name: string;
  3536. /** Defines whether this extension is enabled. */
  3537. enabled: boolean;
  3538. /**
  3539. * Maximum number of LODs to load, starting from the lowest LOD.
  3540. */
  3541. maxLODsToLoad: number;
  3542. /**
  3543. * BABYLON.Observable raised when all node LODs of one level are loaded.
  3544. * The event data is the index of the loaded LOD starting from zero.
  3545. * Dispose the loader to cancel the loading of the next level of LODs.
  3546. */
  3547. onNodeLODsLoadedObservable: BABYLON.Observable<number>;
  3548. /**
  3549. * BABYLON.Observable raised when all material LODs of one level are loaded.
  3550. * The event data is the index of the loaded LOD starting from zero.
  3551. * Dispose the loader to cancel the loading of the next level of LODs.
  3552. */
  3553. onMaterialLODsLoadedObservable: BABYLON.Observable<number>;
  3554. /** @hidden */
  3555. constructor(loader: GLTF2Loader);
  3556. /** @hidden */
  3557. dispose(): void;
  3558. /** @hidden */
  3559. onReady(): void;
  3560. /** @hidden */
  3561. loadNodeAsync(context: string, node: INode, assign: (babylonMesh: BABYLON.Mesh) => void): BABYLON.Nullable<Promise<BABYLON.Mesh>>;
  3562. /** @hidden */
  3563. _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: BABYLON.Mesh, babylonDrawMode: number, assign: (babylonMaterial: BABYLON.Material) => void): BABYLON.Nullable<Promise<BABYLON.Material>>;
  3564. /** @hidden */
  3565. _loadUriAsync(context: string, uri: string): BABYLON.Nullable<Promise<ArrayBufferView>>;
  3566. }
  3567. }
  3568. declare module BABYLON {
  3569. /** @hidden */
  3570. export class MSFT_minecraftMesh implements IGLTFLoaderExtensionV2 {
  3571. readonly name: string;
  3572. enabled: boolean;
  3573. constructor(loader: GLTF2Loader);
  3574. dispose(): void;
  3575. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: BABYLON.Material): BABYLON.Nullable<Promise<void>>;
  3576. }
  3577. }
  3578. declare module BABYLON {
  3579. /** @hidden */
  3580. export class MSFT_sRGBFactors implements IGLTFLoaderExtensionV2 {
  3581. readonly name: string;
  3582. enabled: boolean;
  3583. constructor(loader: GLTF2Loader);
  3584. dispose(): void;
  3585. loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: BABYLON.Material): BABYLON.Nullable<Promise<void>>;
  3586. }
  3587. }