123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472 |
- declare module "babylonjs-loaders/glTF/glTFValidation" {
- import * as GLTF2 from 'babylonjs-gltf2interface';
- /**
- * Configuration for glTF validation
- */
- export interface IGLTFValidationConfiguration {
- /**
- * The url of the glTF validator.
- */
- url: string;
- }
- /**
- * glTF validation
- */
- export class GLTFValidation {
- /**
- * The configuration. Defaults to `{ url: "https://preview.babylonjs.com/gltf_validator.js" }`.
- */
- static Configuration: IGLTFValidationConfiguration;
- private static _LoadScriptPromise;
- /**
- * Validate a glTF asset using the glTF-Validator.
- * @param data The JSON of a glTF or the array buffer of a binary glTF
- * @param rootUrl The root url for the glTF
- * @param fileName The file name for the glTF
- * @param getExternalResource The callback to get external resources for the glTF validator
- * @returns A promise that resolves with the glTF validation results once complete
- */
- static ValidateAsync(data: string | ArrayBuffer, rootUrl: string, fileName: string, getExternalResource: (uri: string) => Promise<ArrayBuffer>): Promise<GLTF2.IGLTFValidationResults>;
- }
- }
- declare module "babylonjs-loaders/glTF/glTFFileLoader" {
- import * as GLTF2 from "babylonjs-gltf2interface";
- import { Nullable } from "babylonjs/types";
- import { Observable } from "babylonjs/Misc/observable";
- import { Camera } from "babylonjs/Cameras/camera";
- import { AnimationGroup } from "babylonjs/Animations/animationGroup";
- import { Skeleton } from "babylonjs/Bones/skeleton";
- import { IParticleSystem } from "babylonjs/Particles/IParticleSystem";
- import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
- import { Material } from "babylonjs/Materials/material";
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
- import { ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginExtensions } from "babylonjs/Loading/sceneLoader";
- import { AssetContainer } from "babylonjs/assetContainer";
- import { Scene, IDisposable } from "babylonjs/scene";
- import { WebRequest } from "babylonjs/Misc/webRequest";
- import { IFileRequest } from "babylonjs/Misc/fileRequest";
- import { IDataBuffer } from 'babylonjs/Misc/dataReader';
- import { Light } from 'babylonjs/Lights/light';
- import { TransformNode } from 'babylonjs/Meshes/transformNode';
- import { RequestFileError } from 'babylonjs/Misc/fileTools';
- /**
- * Mode that determines the coordinate system to use.
- */
- export enum GLTFLoaderCoordinateSystemMode {
- /**
- * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
- */
- AUTO = 0,
- /**
- * Sets the useRightHandedSystem flag on the scene.
- */
- FORCE_RIGHT_HANDED = 1
- }
- /**
- * Mode that determines what animations will start.
- */
- export enum GLTFLoaderAnimationStartMode {
- /**
- * No animation will start.
- */
- NONE = 0,
- /**
- * The first animation will start.
- */
- FIRST = 1,
- /**
- * All animations will start.
- */
- ALL = 2
- }
- /**
- * Interface that contains the data for the glTF asset.
- */
- export interface IGLTFLoaderData {
- /**
- * The object that represents the glTF JSON.
- */
- json: Object;
- /**
- * The BIN chunk of a binary glTF.
- */
- bin: Nullable<IDataBuffer>;
- }
- /**
- * Interface for extending the loader.
- */
- export interface IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines the order of this extension.
- * The loader sorts the extensions using these values when loading.
- */
- order?: number;
- }
- /**
- * Loader state.
- */
- export enum GLTFLoaderState {
- /**
- * The asset is loading.
- */
- LOADING = 0,
- /**
- * The asset is ready for rendering.
- */
- READY = 1,
- /**
- * The asset is completely loaded.
- */
- COMPLETE = 2
- }
- /** @hidden */
- export interface IImportMeshAsyncOutput {
- meshes: AbstractMesh[];
- particleSystems: IParticleSystem[];
- skeletons: Skeleton[];
- animationGroups: AnimationGroup[];
- lights: Light[];
- transformNodes: TransformNode[];
- }
- /** @hidden */
- export interface IGLTFLoader extends IDisposable {
- readonly state: Nullable<GLTFLoaderState>;
- importMeshAsync: (meshesNames: any, scene: Scene, forAssetContainer: boolean, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<IImportMeshAsyncOutput>;
- loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;
- }
- /**
- * File loader for loading glTF files into a scene.
- */
- export class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
- /** @hidden */
- static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
- /** @hidden */
- static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
- /**
- * Raised when the asset has been parsed
- */
- onParsedObservable: Observable<IGLTFLoaderData>;
- private _onParsedObserver;
- /**
- * Raised when the asset has been parsed
- */
- set onParsed(callback: (loaderData: IGLTFLoaderData) => void);
- /**
- * 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.
- * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
- * Defaults to true.
- * @hidden
- */
- static IncrementalLoading: boolean;
- /**
- * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
- * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
- * @hidden
- */
- static HomogeneousCoordinates: boolean;
- /**
- * The coordinate system mode. Defaults to AUTO.
- */
- coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
- /**
- * The animation start mode. Defaults to FIRST.
- */
- animationStartMode: GLTFLoaderAnimationStartMode;
- /**
- * Defines if the loader should compile materials before raising the success callback. Defaults to false.
- */
- compileMaterials: boolean;
- /**
- * Defines if the loader should also compile materials with clip planes. Defaults to false.
- */
- useClipPlane: boolean;
- /**
- * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.
- */
- compileShadowGenerators: boolean;
- /**
- * Defines if the Alpha blended materials are only applied as coverage.
- * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.
- * If true, no extra effects are applied to transparent pixels.
- */
- transparencyAsCoverage: boolean;
- /**
- * Defines if the loader should use range requests when load binary glTF files from HTTP.
- * Enabling will disable offline support and glTF validator.
- * Defaults to false.
- */
- useRangeRequests: boolean;
- /**
- * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.
- */
- createInstances: boolean;
- /**
- * Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false.
- */
- alwaysComputeBoundingBox: boolean;
- /**
- * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.
- */
- loadAllMaterials: boolean;
- /**
- * Function called before loading a url referenced by the asset.
- */
- preprocessUrlAsync: (url: string) => Promise<string>;
- /**
- * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
- */
- readonly onMeshLoadedObservable: Observable<AbstractMesh>;
- private _onMeshLoadedObserver;
- /**
- * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
- */
- set onMeshLoaded(callback: (mesh: AbstractMesh) => void);
- /**
- * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
- */
- readonly onTextureLoadedObservable: Observable<BaseTexture>;
- private _onTextureLoadedObserver;
- /**
- * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
- */
- set onTextureLoaded(callback: (texture: BaseTexture) => void);
- /**
- * Observable raised when the loader creates a material after parsing the glTF properties of the material.
- */
- readonly onMaterialLoadedObservable: Observable<Material>;
- private _onMaterialLoadedObserver;
- /**
- * Callback raised when the loader creates a material after parsing the glTF properties of the material.
- */
- set onMaterialLoaded(callback: (material: Material) => void);
- /**
- * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.
- */
- readonly onCameraLoadedObservable: Observable<Camera>;
- private _onCameraLoadedObserver;
- /**
- * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
- */
- set onCameraLoaded(callback: (camera: Camera) => void);
- /**
- * Observable raised when the asset is completely loaded, immediately before the loader is disposed.
- * For assets with LODs, raised when all of the LODs are complete.
- * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
- */
- readonly onCompleteObservable: Observable<void>;
- private _onCompleteObserver;
- /**
- * Callback raised when the asset is completely loaded, immediately before the loader is disposed.
- * For assets with LODs, raised when all of the LODs are complete.
- * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
- */
- set onComplete(callback: () => void);
- /**
- * Observable raised when an error occurs.
- */
- readonly onErrorObservable: Observable<any>;
- private _onErrorObserver;
- /**
- * Callback raised when an error occurs.
- */
- set onError(callback: (reason: any) => void);
- /**
- * Observable raised after the loader is disposed.
- */
- readonly onDisposeObservable: Observable<void>;
- private _onDisposeObserver;
- /**
- * Callback raised after the loader is disposed.
- */
- set onDispose(callback: () => void);
- /**
- * Observable raised after a loader extension is created.
- * Set additional options for a loader extension in this event.
- */
- readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
- private _onExtensionLoadedObserver;
- /**
- * Callback raised after a loader extension is created.
- */
- set onExtensionLoaded(callback: (extension: IGLTFLoaderExtension) => void);
- /**
- * Defines if the loader logging is enabled.
- */
- get loggingEnabled(): boolean;
- set loggingEnabled(value: boolean);
- /**
- * Defines if the loader should capture performance counters.
- */
- get capturePerformanceCounters(): boolean;
- set capturePerformanceCounters(value: boolean);
- /**
- * Defines if the loader should validate the asset.
- */
- validate: boolean;
- /**
- * Observable raised after validation when validate is set to true. The event data is the result of the validation.
- */
- readonly onValidatedObservable: Observable<GLTF2.IGLTFValidationResults>;
- private _onValidatedObserver;
- /**
- * Callback raised after a loader extension is created.
- */
- set onValidated(callback: (results: GLTF2.IGLTFValidationResults) => void);
- private _loader;
- private _progressCallback?;
- private _requests;
- private static magicBase64Encoded;
- /**
- * Name of the loader ("gltf")
- */
- name: string;
- /** @hidden */
- extensions: ISceneLoaderPluginExtensions;
- /**
- * Disposes the loader, releases resources during load, and cancels any outstanding requests.
- */
- dispose(): void;
- /** @hidden */
- requestFile(scene: Scene, url: string, onSuccess: (data: any, request?: WebRequest) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (error: any) => void): IFileRequest;
- /** @hidden */
- readFile(scene: Scene, file: File, onSuccess: (data: any) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => any, useArrayBuffer?: boolean, onError?: (error: any) => void): IFileRequest;
- /** @hidden */
- importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<{
- meshes: AbstractMesh[];
- particleSystems: IParticleSystem[];
- skeletons: Skeleton[];
- animationGroups: AnimationGroup[];
- }>;
- /** @hidden */
- loadAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
- /** @hidden */
- loadAssetContainerAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
- /** @hidden */
- canDirectLoad(data: string): boolean;
- /** @hidden */
- directLoad(scene: Scene, data: string): Promise<any>;
- /**
- * The callback that allows custom handling of the root url based on the response url.
- * @param rootUrl the original root url
- * @param responseURL the response url if available
- * @returns the new root url
- */
- rewriteRootURL?(rootUrl: string, responseURL?: string): string;
- /** @hidden */
- createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
- /**
- * The loader state or null if the loader is not active.
- */
- get loaderState(): Nullable<GLTFLoaderState>;
- /**
- * Returns a promise that resolves when the asset is completely loaded.
- * @returns a promise that resolves when the asset is completely loaded.
- */
- whenCompleteAsync(): Promise<void>;
- /** @hidden */
- _loadFile(url: string, scene: Scene, onSuccess: (data: string | ArrayBuffer) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest) => void): IFileRequest;
- /** @hidden */
- _requestFile(url: string, scene: Scene, onSuccess: (data: string | ArrayBuffer, request?: WebRequest) => void, useArrayBuffer?: boolean, onError?: (error: RequestFileError) => void, onOpened?: (request: WebRequest) => void): IFileRequest;
- private _onProgress;
- private _validate;
- private _getLoader;
- private _parseJson;
- private _unpackBinaryAsync;
- private _unpackBinaryV1Async;
- private _unpackBinaryV2Async;
- private static _parseVersion;
- private static _compareVersion;
- private static readonly _logSpaces;
- private _logIndentLevel;
- private _loggingEnabled;
- /** @hidden */
- _log: (message: string) => void;
- /** @hidden */
- _logOpen(message: string): void;
- /** @hidden */
- _logClose(): void;
- private _logEnabled;
- private _logDisabled;
- private _capturePerformanceCounters;
- /** @hidden */
- _startPerformanceCounter: (counterName: string) => void;
- /** @hidden */
- _endPerformanceCounter: (counterName: string) => void;
- private _startPerformanceCounterEnabled;
- private _startPerformanceCounterDisabled;
- private _endPerformanceCounterEnabled;
- private _endPerformanceCounterDisabled;
- }
- }
- declare module "babylonjs-loaders/glTF/1.0/glTFLoaderInterfaces" {
- import { Bone } from "babylonjs/Bones/bone";
- import { Skeleton } from "babylonjs/Bones/skeleton";
- import { Texture } from "babylonjs/Materials/Textures/texture";
- import { Node } from "babylonjs/node";
- import { Scene } from "babylonjs/scene";
- /**
- * Enums
- * @hidden
- */
- export enum EComponentType {
- BYTE = 5120,
- UNSIGNED_BYTE = 5121,
- SHORT = 5122,
- UNSIGNED_SHORT = 5123,
- FLOAT = 5126
- }
- /** @hidden */
- export enum EShaderType {
- FRAGMENT = 35632,
- VERTEX = 35633
- }
- /** @hidden */
- export enum EParameterType {
- BYTE = 5120,
- UNSIGNED_BYTE = 5121,
- SHORT = 5122,
- UNSIGNED_SHORT = 5123,
- INT = 5124,
- UNSIGNED_INT = 5125,
- FLOAT = 5126,
- FLOAT_VEC2 = 35664,
- FLOAT_VEC3 = 35665,
- FLOAT_VEC4 = 35666,
- INT_VEC2 = 35667,
- INT_VEC3 = 35668,
- INT_VEC4 = 35669,
- BOOL = 35670,
- BOOL_VEC2 = 35671,
- BOOL_VEC3 = 35672,
- BOOL_VEC4 = 35673,
- FLOAT_MAT2 = 35674,
- FLOAT_MAT3 = 35675,
- FLOAT_MAT4 = 35676,
- SAMPLER_2D = 35678
- }
- /** @hidden */
- export enum ETextureWrapMode {
- CLAMP_TO_EDGE = 33071,
- MIRRORED_REPEAT = 33648,
- REPEAT = 10497
- }
- /** @hidden */
- export enum ETextureFilterType {
- NEAREST = 9728,
- LINEAR = 9728,
- NEAREST_MIPMAP_NEAREST = 9984,
- LINEAR_MIPMAP_NEAREST = 9985,
- NEAREST_MIPMAP_LINEAR = 9986,
- LINEAR_MIPMAP_LINEAR = 9987
- }
- /** @hidden */
- export enum ETextureFormat {
- ALPHA = 6406,
- RGB = 6407,
- RGBA = 6408,
- LUMINANCE = 6409,
- LUMINANCE_ALPHA = 6410
- }
- /** @hidden */
- export enum ECullingType {
- FRONT = 1028,
- BACK = 1029,
- FRONT_AND_BACK = 1032
- }
- /** @hidden */
- export enum EBlendingFunction {
- ZERO = 0,
- ONE = 1,
- SRC_COLOR = 768,
- ONE_MINUS_SRC_COLOR = 769,
- DST_COLOR = 774,
- ONE_MINUS_DST_COLOR = 775,
- SRC_ALPHA = 770,
- ONE_MINUS_SRC_ALPHA = 771,
- DST_ALPHA = 772,
- ONE_MINUS_DST_ALPHA = 773,
- CONSTANT_COLOR = 32769,
- ONE_MINUS_CONSTANT_COLOR = 32770,
- CONSTANT_ALPHA = 32771,
- ONE_MINUS_CONSTANT_ALPHA = 32772,
- SRC_ALPHA_SATURATE = 776
- }
- /** @hidden */
- export interface IGLTFProperty {
- extensions?: {
- [key: string]: any;
- };
- extras?: Object;
- }
- /** @hidden */
- export interface IGLTFChildRootProperty extends IGLTFProperty {
- name?: string;
- }
- /** @hidden */
- export interface IGLTFAccessor extends IGLTFChildRootProperty {
- bufferView: string;
- byteOffset: number;
- byteStride: number;
- count: number;
- type: string;
- componentType: EComponentType;
- max?: number[];
- min?: number[];
- name?: string;
- }
- /** @hidden */
- export interface IGLTFBufferView extends IGLTFChildRootProperty {
- buffer: string;
- byteOffset: number;
- byteLength: number;
- byteStride: number;
- target?: number;
- }
- /** @hidden */
- export interface IGLTFBuffer extends IGLTFChildRootProperty {
- uri: string;
- byteLength?: number;
- type?: string;
- }
- /** @hidden */
- export interface IGLTFShader extends IGLTFChildRootProperty {
- uri: string;
- type: EShaderType;
- }
- /** @hidden */
- export interface IGLTFProgram extends IGLTFChildRootProperty {
- attributes: string[];
- fragmentShader: string;
- vertexShader: string;
- }
- /** @hidden */
- export interface IGLTFTechniqueParameter {
- type: number;
- count?: number;
- semantic?: string;
- node?: string;
- value?: number | boolean | string | Array<any>;
- source?: string;
- babylonValue?: any;
- }
- /** @hidden */
- export interface IGLTFTechniqueCommonProfile {
- lightingModel: string;
- texcoordBindings: Object;
- parameters?: Array<any>;
- }
- /** @hidden */
- export interface IGLTFTechniqueStatesFunctions {
- blendColor?: number[];
- blendEquationSeparate?: number[];
- blendFuncSeparate?: number[];
- colorMask: boolean[];
- cullFace: number[];
- }
- /** @hidden */
- export interface IGLTFTechniqueStates {
- enable: number[];
- functions: IGLTFTechniqueStatesFunctions;
- }
- /** @hidden */
- export interface IGLTFTechnique extends IGLTFChildRootProperty {
- parameters: {
- [key: string]: IGLTFTechniqueParameter;
- };
- program: string;
- attributes: {
- [key: string]: string;
- };
- uniforms: {
- [key: string]: string;
- };
- states: IGLTFTechniqueStates;
- }
- /** @hidden */
- export interface IGLTFMaterial extends IGLTFChildRootProperty {
- technique?: string;
- values: string[];
- }
- /** @hidden */
- export interface IGLTFMeshPrimitive extends IGLTFProperty {
- attributes: {
- [key: string]: string;
- };
- indices: string;
- material: string;
- mode?: number;
- }
- /** @hidden */
- export interface IGLTFMesh extends IGLTFChildRootProperty {
- primitives: IGLTFMeshPrimitive[];
- }
- /** @hidden */
- export interface IGLTFImage extends IGLTFChildRootProperty {
- uri: string;
- }
- /** @hidden */
- export interface IGLTFSampler extends IGLTFChildRootProperty {
- magFilter?: number;
- minFilter?: number;
- wrapS?: number;
- wrapT?: number;
- }
- /** @hidden */
- export interface IGLTFTexture extends IGLTFChildRootProperty {
- sampler: string;
- source: string;
- format?: ETextureFormat;
- internalFormat?: ETextureFormat;
- target?: number;
- type?: number;
- babylonTexture?: Texture;
- }
- /** @hidden */
- export interface IGLTFAmbienLight {
- color?: number[];
- }
- /** @hidden */
- export interface IGLTFDirectionalLight {
- color?: number[];
- }
- /** @hidden */
- export interface IGLTFPointLight {
- color?: number[];
- constantAttenuation?: number;
- linearAttenuation?: number;
- quadraticAttenuation?: number;
- }
- /** @hidden */
- export interface IGLTFSpotLight {
- color?: number[];
- constantAttenuation?: number;
- fallOfAngle?: number;
- fallOffExponent?: number;
- linearAttenuation?: number;
- quadraticAttenuation?: number;
- }
- /** @hidden */
- export interface IGLTFLight extends IGLTFChildRootProperty {
- type: string;
- }
- /** @hidden */
- export interface IGLTFCameraOrthographic {
- xmag: number;
- ymag: number;
- zfar: number;
- znear: number;
- }
- /** @hidden */
- export interface IGLTFCameraPerspective {
- aspectRatio: number;
- yfov: number;
- zfar: number;
- znear: number;
- }
- /** @hidden */
- export interface IGLTFCamera extends IGLTFChildRootProperty {
- type: string;
- }
- /** @hidden */
- export interface IGLTFAnimationChannelTarget {
- id: string;
- path: string;
- }
- /** @hidden */
- export interface IGLTFAnimationChannel {
- sampler: string;
- target: IGLTFAnimationChannelTarget;
- }
- /** @hidden */
- export interface IGLTFAnimationSampler {
- input: string;
- output: string;
- interpolation?: string;
- }
- /** @hidden */
- export interface IGLTFAnimation extends IGLTFChildRootProperty {
- channels?: IGLTFAnimationChannel[];
- parameters?: {
- [key: string]: string;
- };
- samplers?: {
- [key: string]: IGLTFAnimationSampler;
- };
- }
- /** @hidden */
- export interface IGLTFNodeInstanceSkin {
- skeletons: string[];
- skin: string;
- meshes: string[];
- }
- /** @hidden */
- export interface IGLTFSkins extends IGLTFChildRootProperty {
- bindShapeMatrix: number[];
- inverseBindMatrices: string;
- jointNames: string[];
- babylonSkeleton?: Skeleton;
- }
- /** @hidden */
- export interface IGLTFNode extends IGLTFChildRootProperty {
- camera?: string;
- children: string[];
- skin?: string;
- jointName?: string;
- light?: string;
- matrix: number[];
- mesh?: string;
- meshes?: string[];
- rotation?: number[];
- scale?: number[];
- translation?: number[];
- babylonNode?: Node;
- }
- /** @hidden */
- export interface IGLTFScene extends IGLTFChildRootProperty {
- nodes: string[];
- }
- /** @hidden */
- export interface IGLTFRuntime {
- extensions: {
- [key: string]: any;
- };
- accessors: {
- [key: string]: IGLTFAccessor;
- };
- buffers: {
- [key: string]: IGLTFBuffer;
- };
- bufferViews: {
- [key: string]: IGLTFBufferView;
- };
- meshes: {
- [key: string]: IGLTFMesh;
- };
- lights: {
- [key: string]: IGLTFLight;
- };
- cameras: {
- [key: string]: IGLTFCamera;
- };
- nodes: {
- [key: string]: IGLTFNode;
- };
- images: {
- [key: string]: IGLTFImage;
- };
- textures: {
- [key: string]: IGLTFTexture;
- };
- shaders: {
- [key: string]: IGLTFShader;
- };
- programs: {
- [key: string]: IGLTFProgram;
- };
- samplers: {
- [key: string]: IGLTFSampler;
- };
- techniques: {
- [key: string]: IGLTFTechnique;
- };
- materials: {
- [key: string]: IGLTFMaterial;
- };
- animations: {
- [key: string]: IGLTFAnimation;
- };
- skins: {
- [key: string]: IGLTFSkins;
- };
- currentScene?: Object;
- scenes: {
- [key: string]: IGLTFScene;
- };
- extensionsUsed: string[];
- extensionsRequired?: string[];
- buffersCount: number;
- shaderscount: number;
- scene: Scene;
- rootUrl: string;
- loadedBufferCount: number;
- loadedBufferViews: {
- [name: string]: ArrayBufferView;
- };
- loadedShaderCount: number;
- importOnlyMeshes: boolean;
- importMeshesNames?: string[];
- dummyNodes: Node[];
- forAssetContainer: boolean;
- }
- /** @hidden */
- export interface INodeToRoot {
- bone: Bone;
- node: IGLTFNode;
- id: string;
- }
- /** @hidden */
- export interface IJointNode {
- node: IGLTFNode;
- id: string;
- }
- }
- declare module "babylonjs-loaders/glTF/1.0/glTFLoaderUtils" {
- import { IGLTFTechniqueParameter, IGLTFAccessor, ETextureFilterType, IGLTFRuntime, IGLTFBufferView, EComponentType } from "babylonjs-loaders/glTF/1.0/glTFLoaderInterfaces";
- import { Effect } from "babylonjs/Materials/effect";
- import { ShaderMaterial } from "babylonjs/Materials/shaderMaterial";
- import { Node } from "babylonjs/node";
- import { Scene } from "babylonjs/scene";
- /**
- * Utils functions for GLTF
- * @hidden
- */
- export class GLTFUtils {
- /**
- * Sets the given "parameter" matrix
- * @param scene: the Scene object
- * @param source: the source node where to pick the matrix
- * @param parameter: the GLTF technique parameter
- * @param uniformName: the name of the shader's uniform
- * @param shaderMaterial: the shader material
- */
- static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void;
- /**
- * Sets the given "parameter" matrix
- * @param shaderMaterial: the shader material
- * @param uniform: the name of the shader's uniform
- * @param value: the value of the uniform
- * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
- */
- static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
- /**
- * Returns the wrap mode of the texture
- * @param mode: the mode value
- */
- static GetWrapMode(mode: number): number;
- /**
- * Returns the byte stride giving an accessor
- * @param accessor: the GLTF accessor objet
- */
- static GetByteStrideFromType(accessor: IGLTFAccessor): number;
- /**
- * Returns the texture filter mode giving a mode value
- * @param mode: the filter mode value
- */
- static GetTextureFilterMode(mode: number): ETextureFilterType;
- static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
- /**
- * Returns a buffer from its accessor
- * @param gltfRuntime: the GLTF runtime
- * @param accessor: the GLTF accessor
- */
- static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
- /**
- * Decodes a buffer view into a string
- * @param view: the buffer view
- */
- static DecodeBufferToText(view: ArrayBufferView): string;
- /**
- * Returns the default material of gltf. Related to
- * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
- * @param scene: the Babylon.js scene
- */
- static GetDefaultMaterial(scene: Scene): ShaderMaterial;
- private static _DefaultMaterial;
- }
- }
- declare module "babylonjs-loaders/glTF/1.0/glTFLoader" {
- import { IGLTFRuntime } from "babylonjs-loaders/glTF/1.0/glTFLoaderInterfaces";
- import { Nullable } from "babylonjs/types";
- import { Material } from "babylonjs/Materials/material";
- import { Texture } from "babylonjs/Materials/Textures/texture";
- import { ISceneLoaderProgressEvent } from "babylonjs/Loading/sceneLoader";
- import { Scene } from "babylonjs/scene";
- import { IGLTFLoader, GLTFLoaderState, IGLTFLoaderData, IImportMeshAsyncOutput } from "babylonjs-loaders/glTF/glTFFileLoader";
- /**
- * Implementation of the base glTF spec
- * @hidden
- */
- export class GLTFLoaderBase {
- static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
- static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
- static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
- static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
- static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void;
- static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
- }
- /**
- * glTF V1 Loader
- * @hidden
- */
- export class GLTFLoader implements IGLTFLoader {
- static Extensions: {
- [name: string]: GLTFLoaderExtension;
- };
- static RegisterExtension(extension: GLTFLoaderExtension): void;
- state: Nullable<GLTFLoaderState>;
- dispose(): void;
- private _importMeshAsync;
- /**
- * Imports one or more meshes from a loaded gltf file and adds them to the scene
- * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
- * @param scene the scene the meshes should be added to
- * @param forAssetContainer defines if the entities must be stored in the scene
- * @param data gltf data containing information of the meshes in a loaded file
- * @param rootUrl root url to load from
- * @param onProgress event that fires when loading progress has occured
- * @returns a promise containg the loaded meshes, particles, skeletons and animations
- */
- importMeshAsync(meshesNames: any, scene: Scene, forAssetContainer: boolean, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<IImportMeshAsyncOutput>;
- private _loadAsync;
- /**
- * Imports all objects from a loaded gltf file and adds them to the scene
- * @param scene the scene the objects should be added to
- * @param data gltf data containing information of the meshes in a loaded file
- * @param rootUrl root url to load from
- * @param onProgress event that fires when loading progress has occured
- * @returns a promise which completes when objects have been loaded to the scene
- */
- loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<void>;
- private _loadShadersAsync;
- private _loadBuffersAsync;
- private _createNodes;
- }
- /** @hidden */
- export abstract class GLTFLoaderExtension {
- private _name;
- constructor(name: string);
- get name(): string;
- /**
- * Defines an override for loading the runtime
- * Return true to stop further extensions from loading the runtime
- */
- loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
- /**
- * Defines an onverride for creating gltf runtime
- * Return true to stop further extensions from creating the runtime
- */
- loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
- /**
- * Defines an override for loading buffers
- * Return true to stop further extensions from loading this buffer
- */
- loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
- /**
- * Defines an override for loading texture buffers
- * Return true to stop further extensions from loading this texture data
- */
- loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
- /**
- * Defines an override for creating textures
- * Return true to stop further extensions from loading this texture
- */
- createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
- /**
- * Defines an override for loading shader strings
- * Return true to stop further extensions from loading this shader data
- */
- loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
- /**
- * Defines an override for loading materials
- * Return true to stop further extensions from loading this material
- */
- loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
- static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): void;
- static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void;
- static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
- static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
- static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void;
- static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
- private static LoadTextureBufferAsync;
- private static CreateTextureAsync;
- private static ApplyExtensions;
- }
- }
- declare module "babylonjs-loaders/glTF/1.0/glTFBinaryExtension" {
- import { GLTFLoaderExtension } from "babylonjs-loaders/glTF/1.0/glTFLoader";
- import { Scene } from "babylonjs/scene";
- import { IGLTFLoaderData } from "babylonjs-loaders/glTF/glTFFileLoader";
- import { IGLTFRuntime } from "babylonjs-loaders/glTF/1.0/glTFLoaderInterfaces";
- /** @hidden */
- export class GLTFBinaryExtension extends GLTFLoaderExtension {
- private _bin;
- constructor();
- loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
- loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
- loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
- loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
- }
- }
- declare module "babylonjs-loaders/glTF/1.0/glTFMaterialsCommonExtension" {
- import { GLTFLoaderExtension } from "babylonjs-loaders/glTF/1.0/glTFLoader";
- import { IGLTFRuntime } from "babylonjs-loaders/glTF/1.0/glTFLoaderInterfaces";
- import { Material } from "babylonjs/Materials/material";
- /** @hidden */
- export class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {
- constructor();
- loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
- loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
- private _loadTexture;
- }
- }
- declare module "babylonjs-loaders/glTF/1.0/index" {
- export * from "babylonjs-loaders/glTF/1.0/glTFBinaryExtension";
- export * from "babylonjs-loaders/glTF/1.0/glTFLoader";
- export * from "babylonjs-loaders/glTF/1.0/glTFLoaderInterfaces";
- export * from "babylonjs-loaders/glTF/1.0/glTFLoaderUtils";
- export * from "babylonjs-loaders/glTF/1.0/glTFMaterialsCommonExtension";
- }
- declare module "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces" {
- import { AnimationGroup } from "babylonjs/Animations/animationGroup";
- import { Bone } from "babylonjs/Bones/bone";
- import { Skeleton } from "babylonjs/Bones/skeleton";
- import { Material } from "babylonjs/Materials/material";
- import { TransformNode } from "babylonjs/Meshes/transformNode";
- import { Buffer, VertexBuffer } from "babylonjs/Meshes/buffer";
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
- import { Mesh } from "babylonjs/Meshes/mesh";
- import * as GLTF2 from "babylonjs-gltf2interface";
- /**
- * Loader interface with an index field.
- */
- export interface IArrayItem {
- /**
- * The index of this item in the array.
- */
- index: number;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IAccessor extends GLTF2.IAccessor, IArrayItem {
- /** @hidden */
- _data?: Promise<ArrayBufferView>;
- /** @hidden */
- _babylonVertexBuffer?: Promise<VertexBuffer>;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IAnimationChannel extends GLTF2.IAnimationChannel, IArrayItem {
- }
- /** @hidden */
- export interface _IAnimationSamplerData {
- input: Float32Array;
- interpolation: GLTF2.AnimationSamplerInterpolation;
- output: Float32Array;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IAnimationSampler extends GLTF2.IAnimationSampler, IArrayItem {
- /** @hidden */
- _data?: Promise<_IAnimationSamplerData>;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IAnimation extends GLTF2.IAnimation, IArrayItem {
- channels: IAnimationChannel[];
- samplers: IAnimationSampler[];
- /** @hidden */
- _babylonAnimationGroup?: AnimationGroup;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IBuffer extends GLTF2.IBuffer, IArrayItem {
- /** @hidden */
- _data?: Promise<ArrayBufferView>;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IBufferView extends GLTF2.IBufferView, IArrayItem {
- /** @hidden */
- _data?: Promise<ArrayBufferView>;
- /** @hidden */
- _babylonBuffer?: Promise<Buffer>;
- }
- /**
- * Loader interface with additional members.
- */
- export interface ICamera extends GLTF2.ICamera, IArrayItem {
- }
- /**
- * Loader interface with additional members.
- */
- export interface IImage extends GLTF2.IImage, IArrayItem {
- /** @hidden */
- _data?: Promise<ArrayBufferView>;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMaterialNormalTextureInfo extends GLTF2.IMaterialNormalTextureInfo, ITextureInfo {
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMaterialOcclusionTextureInfo extends GLTF2.IMaterialOcclusionTextureInfo, ITextureInfo {
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMaterialPbrMetallicRoughness extends GLTF2.IMaterialPbrMetallicRoughness {
- baseColorTexture?: ITextureInfo;
- metallicRoughnessTexture?: ITextureInfo;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMaterial extends GLTF2.IMaterial, IArrayItem {
- pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
- normalTexture?: IMaterialNormalTextureInfo;
- occlusionTexture?: IMaterialOcclusionTextureInfo;
- emissiveTexture?: ITextureInfo;
- /** @hidden */
- _data?: {
- [babylonDrawMode: number]: {
- babylonMaterial: Material;
- babylonMeshes: AbstractMesh[];
- promise: Promise<void>;
- };
- };
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMesh extends GLTF2.IMesh, IArrayItem {
- primitives: IMeshPrimitive[];
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMeshPrimitive extends GLTF2.IMeshPrimitive, IArrayItem {
- /** @hidden */
- _instanceData?: {
- babylonSourceMesh: Mesh;
- promise: Promise<any>;
- };
- }
- /**
- * Loader interface with additional members.
- */
- export interface INode extends GLTF2.INode, IArrayItem {
- /**
- * The parent glTF node.
- */
- parent?: INode;
- /** @hidden */
- _babylonTransformNode?: TransformNode;
- /** @hidden */
- _primitiveBabylonMeshes?: AbstractMesh[];
- /** @hidden */
- _babylonBones?: Bone[];
- /** @hidden */
- _numMorphTargets?: number;
- }
- /** @hidden */
- export interface _ISamplerData {
- noMipMaps: boolean;
- samplingMode: number;
- wrapU: number;
- wrapV: number;
- }
- /**
- * Loader interface with additional members.
- */
- export interface ISampler extends GLTF2.ISampler, IArrayItem {
- /** @hidden */
- _data?: _ISamplerData;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IScene extends GLTF2.IScene, IArrayItem {
- }
- /**
- * Loader interface with additional members.
- */
- export interface ISkin extends GLTF2.ISkin, IArrayItem {
- /** @hidden */
- _data?: {
- babylonSkeleton: Skeleton;
- promise: Promise<void>;
- };
- }
- /**
- * Loader interface with additional members.
- */
- export interface ITexture extends GLTF2.ITexture, IArrayItem {
- }
- /**
- * Loader interface with additional members.
- */
- export interface ITextureInfo extends GLTF2.ITextureInfo {
- }
- /**
- * Loader interface with additional members.
- */
- export interface IGLTF extends GLTF2.IGLTF {
- accessors?: IAccessor[];
- animations?: IAnimation[];
- buffers?: IBuffer[];
- bufferViews?: IBufferView[];
- cameras?: ICamera[];
- images?: IImage[];
- materials?: IMaterial[];
- meshes?: IMesh[];
- nodes?: INode[];
- samplers?: ISampler[];
- scenes?: IScene[];
- skins?: ISkin[];
- textures?: ITexture[];
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/glTFLoaderExtension" {
- import { Nullable } from "babylonjs/types";
- import { AnimationGroup } from "babylonjs/Animations/animationGroup";
- import { Material } from "babylonjs/Materials/material";
- import { Camera } from "babylonjs/Cameras/camera";
- import { Geometry } from "babylonjs/Meshes/geometry";
- import { TransformNode } from "babylonjs/Meshes/transformNode";
- import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
- import { Mesh } from "babylonjs/Meshes/mesh";
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
- import { IDisposable } from "babylonjs/scene";
- import { IScene, INode, IMesh, ISkin, ICamera, IMeshPrimitive, IMaterial, ITextureInfo, IAnimation, ITexture, IBufferView, IBuffer } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension as IGLTFBaseLoaderExtension } from "babylonjs-loaders/glTF/glTFFileLoader";
- import { IProperty } from 'babylonjs-gltf2interface';
- /**
- * Interface for a glTF loader extension.
- */
- export interface IGLTFLoaderExtension extends IGLTFBaseLoaderExtension, IDisposable {
- /**
- * Called after the loader state changes to LOADING.
- */
- onLoading?(): void;
- /**
- * Called after the loader state changes to READY.
- */
- onReady?(): void;
- /**
- * Define this method to modify the default behavior when loading scenes.
- * @param context The context when loading the asset
- * @param scene The glTF scene property
- * @returns A promise that resolves when the load is complete or null if not handled
- */
- loadSceneAsync?(context: string, scene: IScene): Nullable<Promise<void>>;
- /**
- * Define this method to modify the default behavior when loading nodes.
- * @param context The context when loading the asset
- * @param node The glTF node property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon transform node when the load is complete or null if not handled
- */
- loadNodeAsync?(context: string, node: INode, assign: (babylonMesh: TransformNode) => void): Nullable<Promise<TransformNode>>;
- /**
- * Define this method to modify the default behavior when loading cameras.
- * @param context The context when loading the asset
- * @param camera The glTF camera property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
- */
- loadCameraAsync?(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading vertex data for mesh primitives.
- * @param context The context when loading the asset
- * @param primitive The glTF mesh primitive property
- * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled
- */
- _loadVertexDataAsync?(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading data for mesh primitives.
- * @param context The context when loading the asset
- * @param name The mesh name when loading the asset
- * @param node The glTF node when loading the asset
- * @param mesh The glTF mesh when loading the asset
- * @param primitive The glTF mesh primitive property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled
- */
- _loadMeshPrimitiveAsync?(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Nullable<Promise<AbstractMesh>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled
- */
- _loadMaterialAsync?(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
- /**
- * Define this method to modify the default behavior when creating materials.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonDrawMode The draw mode for the Babylon material
- * @returns The Babylon material or null if not handled
- */
- createMaterial?(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
- /**
- * Define this method to modify the default behavior when loading material properties.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonMaterial The Babylon material
- * @returns A promise that resolves when the load is complete or null if not handled
- */
- loadMaterialPropertiesAsync?(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- /**
- * Define this method to modify the default behavior when loading texture infos.
- * @param context The context when loading the asset
- * @param textureInfo The glTF texture info property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
- */
- loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading textures.
- * @param context The context when loading the asset
- * @param texture The glTF texture property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
- */
- _loadTextureAsync?(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
- /**
- * Define this method to modify the default behavior when loading animations.
- * @param context The context when loading the asset
- * @param animation The glTF animation property
- * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
- */
- loadAnimationAsync?(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading skins.
- * @param context The context when loading the asset
- * @param node The glTF node property
- * @param skin The glTF skin property
- * @returns A promise that resolves when the load is complete or null if not handled
- */
- _loadSkinAsync?(context: string, node: INode, skin: ISkin): Nullable<Promise<void>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading uris.
- * @param context The context when loading the asset
- * @param property The glTF property associated with the uri
- * @param uri The uri to load
- * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
- */
- _loadUriAsync?(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>>;
- /**
- * Define this method to modify the default behavior when loading buffer views.
- * @param context The context when loading the asset
- * @param bufferView The glTF buffer view property
- * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
- */
- loadBufferViewAsync?(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>>;
- /**
- * Define this method to modify the default behavior when loading buffers.
- * @param context The context when loading the asset
- * @param buffer The glTF buffer property
- * @param byteOffset The byte offset to load
- * @param byteLength The byte length to load
- * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
- */
- loadBufferAsync?(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/glTFLoader" {
- import { Nullable } from "babylonjs/types";
- import { Camera } from "babylonjs/Cameras/camera";
- import { AnimationGroup } from "babylonjs/Animations/animationGroup";
- import { Material } from "babylonjs/Materials/material";
- import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
- import { TransformNode } from "babylonjs/Meshes/transformNode";
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
- import { Mesh } from "babylonjs/Meshes/mesh";
- import { ISceneLoaderProgressEvent } from "babylonjs/Loading/sceneLoader";
- import { Scene } from "babylonjs/scene";
- import { IProperty } from "babylonjs-gltf2interface";
- import { IGLTF, ISampler, INode, IScene, IMesh, IAccessor, ICamera, IAnimation, IAnimationChannel, IBufferView, IMaterial, ITextureInfo, ITexture, IImage, IMeshPrimitive, IArrayItem as IArrItem } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { IGLTFLoader, GLTFFileLoader, GLTFLoaderState, IGLTFLoaderData, IImportMeshAsyncOutput } from "babylonjs-loaders/glTF/glTFFileLoader";
- import { IAnimatable } from 'babylonjs/Animations/animatable.interface';
- import { IDataBuffer } from 'babylonjs/Misc/dataReader';
- import { Light } from 'babylonjs/Lights/light';
- /**
- * Helper class for working with arrays when loading the glTF asset
- */
- export class ArrayItem {
- /**
- * Gets an item from the given array.
- * @param context The context when loading the asset
- * @param array The array to get the item from
- * @param index The index to the array
- * @returns The array item
- */
- static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
- /**
- * Assign an `index` field to each item of the given array.
- * @param array The array of items
- */
- static Assign(array?: IArrItem[]): void;
- }
- /**
- * The glTF 2.0 loader
- */
- export class GLTFLoader implements IGLTFLoader {
- /** @hidden */
- _completePromises: Promise<any>[];
- /** @hidden */
- _forAssetContainer: boolean;
- /** Storage */
- _babylonLights: Light[];
- /** @hidden */
- _disableInstancedMesh: number;
- private _disposed;
- private _parent;
- private _state;
- private _extensions;
- private _rootUrl;
- private _fileName;
- private _uniqueRootUrl;
- private _gltf;
- private _bin;
- private _babylonScene;
- private _rootBabylonMesh;
- private _defaultBabylonMaterialData;
- private static _RegisteredExtensions;
- /**
- * The default glTF sampler.
- */
- static readonly DefaultSampler: ISampler;
- /**
- * Registers a loader extension.
- * @param name The name of the loader extension.
- * @param factory The factory function that creates the loader extension.
- */
- static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void;
- /**
- * Unregisters a loader extension.
- * @param name The name of the loader extension.
- * @returns A boolean indicating whether the extension has been unregistered
- */
- static UnregisterExtension(name: string): boolean;
- /**
- * The loader state.
- */
- get state(): Nullable<GLTFLoaderState>;
- /**
- * The object that represents the glTF JSON.
- */
- get gltf(): IGLTF;
- /**
- * The BIN chunk of a binary glTF.
- */
- get bin(): Nullable<IDataBuffer>;
- /**
- * The parent file loader.
- */
- get parent(): GLTFFileLoader;
- /**
- * The Babylon scene when loading the asset.
- */
- get babylonScene(): Scene;
- /**
- * The root Babylon mesh when loading the asset.
- */
- get rootBabylonMesh(): Mesh;
- /** @hidden */
- constructor(parent: GLTFFileLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- importMeshAsync(meshesNames: any, scene: Scene, forAssetContainer: boolean, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<IImportMeshAsyncOutput>;
- /** @hidden */
- loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
- private _loadAsync;
- private _loadData;
- private _setupData;
- private _loadExtensions;
- private _checkExtensions;
- private _setState;
- private _createRootNode;
- /**
- * Loads a glTF scene.
- * @param context The context when loading the asset
- * @param scene The glTF scene property
- * @returns A promise that resolves when the load is complete
- */
- loadSceneAsync(context: string, scene: IScene): Promise<void>;
- private _forEachPrimitive;
- private _getMeshes;
- private _getTransformNodes;
- private _getSkeletons;
- private _getAnimationGroups;
- private _startAnimations;
- /**
- * Loads a glTF node.
- * @param context The context when loading the asset
- * @param node The glTF node property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon mesh when the load is complete
- */
- loadNodeAsync(context: string, node: INode, assign?: (babylonTransformNode: TransformNode) => void): Promise<TransformNode>;
- private _loadMeshAsync;
- /**
- * @hidden Define this method to modify the default behavior when loading data for mesh primitives.
- * @param context The context when loading the asset
- * @param name The mesh name when loading the asset
- * @param node The glTF node when loading the asset
- * @param mesh The glTF mesh when loading the asset
- * @param primitive The glTF mesh primitive property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled
- */
- _loadMeshPrimitiveAsync(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Promise<AbstractMesh>;
- private _loadVertexDataAsync;
- private _createMorphTargets;
- private _loadMorphTargetsAsync;
- private _loadMorphTargetVertexDataAsync;
- private static _LoadTransform;
- private _loadSkinAsync;
- private _loadBones;
- private _loadBone;
- private _loadSkinInverseBindMatricesDataAsync;
- private _updateBoneMatrices;
- private _getNodeMatrix;
- /**
- * Loads a glTF camera.
- * @param context The context when loading the asset
- * @param camera The glTF camera property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon camera when the load is complete
- */
- loadCameraAsync(context: string, camera: ICamera, assign?: (babylonCamera: Camera) => void): Promise<Camera>;
- private _loadAnimationsAsync;
- /**
- * Loads a glTF animation.
- * @param context The context when loading the asset
- * @param animation The glTF animation property
- * @returns A promise that resolves with the loaded Babylon animation group when the load is complete
- */
- loadAnimationAsync(context: string, animation: IAnimation): Promise<AnimationGroup>;
- /**
- * @hidden Loads a glTF animation channel.
- * @param context The context when loading the asset
- * @param animationContext The context of the animation when loading the asset
- * @param animation The glTF animation property
- * @param channel The glTF animation channel property
- * @param babylonAnimationGroup The babylon animation group property
- * @param animationTargetOverride The babylon animation channel target override property. My be null.
- * @returns A void promise when the channel load is complete
- */
- _loadAnimationChannelAsync(context: string, animationContext: string, animation: IAnimation, channel: IAnimationChannel, babylonAnimationGroup: AnimationGroup, animationTargetOverride?: Nullable<IAnimatable>): Promise<void>;
- private _loadAnimationSamplerAsync;
- private _loadBufferAsync;
- /**
- * Loads a glTF buffer view.
- * @param context The context when loading the asset
- * @param bufferView The glTF buffer view property
- * @returns A promise that resolves with the loaded data when the load is complete
- */
- loadBufferViewAsync(context: string, bufferView: IBufferView): Promise<ArrayBufferView>;
- private _loadAccessorAsync;
- /** @hidden */
- _loadFloatAccessorAsync(context: string, accessor: IAccessor): Promise<Float32Array>;
- private _loadIndicesAccessorAsync;
- private _loadVertexBufferViewAsync;
- private _loadVertexAccessorAsync;
- private _loadMaterialMetallicRoughnessPropertiesAsync;
- /** @hidden */
- _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign?: (babylonMaterial: Material) => void): Promise<Material>;
- private _createDefaultMaterial;
- /**
- * Creates a Babylon material from a glTF material.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonDrawMode The draw mode for the Babylon material
- * @returns The Babylon material
- */
- createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Material;
- /**
- * Loads properties from a glTF material into a Babylon material.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonMaterial The Babylon material
- * @returns A promise that resolves when the load is complete
- */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
- /**
- * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonMaterial The Babylon material
- * @returns A promise that resolves when the load is complete
- */
- loadMaterialBasePropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
- /**
- * Loads the alpha properties from a glTF material into a Babylon material.
- * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonMaterial The Babylon material
- */
- loadMaterialAlphaProperties(context: string, material: IMaterial, babylonMaterial: Material): void;
- /**
- * Loads a glTF texture info.
- * @param context The context when loading the asset
- * @param textureInfo The glTF texture info property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon texture when the load is complete
- */
- loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
- /** @hidden */
- _loadTextureAsync(context: string, texture: ITexture, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
- /** @hidden */
- _createTextureAsync(context: string, sampler: ISampler, image: IImage, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
- private _loadSampler;
- /**
- * Loads a glTF image.
- * @param context The context when loading the asset
- * @param image The glTF image property
- * @returns A promise that resolves with the loaded data when the load is complete
- */
- loadImageAsync(context: string, image: IImage): Promise<ArrayBufferView>;
- /**
- * Loads a glTF uri.
- * @param context The context when loading the asset
- * @param property The glTF property associated with the uri
- * @param uri The base64 or relative uri
- * @returns A promise that resolves with the loaded data when the load is complete
- */
- loadUriAsync(context: string, property: IProperty, uri: string): Promise<ArrayBufferView>;
- /**
- * Adds a JSON pointer to the metadata of the Babylon object at `<object>.metadata.gltf.pointers`.
- * @param babylonObject the Babylon object with metadata
- * @param pointer the JSON pointer
- */
- static AddPointerMetadata(babylonObject: {
- metadata: any;
- }, pointer: string): void;
- private static _GetTextureWrapMode;
- private static _GetTextureSamplingMode;
- private static _GetTypedArrayConstructor;
- private static _GetTypedArray;
- private static _GetNumComponents;
- private static _ValidateUri;
- /** @hidden */
- static _GetDrawMode(context: string, mode: number | undefined): number;
- private _compileMaterialsAsync;
- private _compileShadowGeneratorsAsync;
- private _forEachExtensions;
- private _applyExtensions;
- private _extensionsOnLoading;
- private _extensionsOnReady;
- private _extensionsLoadSceneAsync;
- private _extensionsLoadNodeAsync;
- private _extensionsLoadCameraAsync;
- private _extensionsLoadVertexDataAsync;
- private _extensionsLoadMeshPrimitiveAsync;
- private _extensionsLoadMaterialAsync;
- private _extensionsCreateMaterial;
- private _extensionsLoadMaterialPropertiesAsync;
- private _extensionsLoadTextureInfoAsync;
- private _extensionsLoadTextureAsync;
- private _extensionsLoadAnimationAsync;
- private _extensionsLoadSkinAsync;
- private _extensionsLoadUriAsync;
- private _extensionsLoadBufferViewAsync;
- private _extensionsLoadBufferAsync;
- /**
- * Helper method called by a loader extension to load an glTF extension.
- * @param context The context when loading the asset
- * @param property The glTF property to load the extension from
- * @param extensionName The name of the extension to load
- * @param actionAsync The action to run
- * @returns The promise returned by actionAsync or null if the extension does not exist
- */
- static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
- /**
- * Helper method called by a loader extension to load a glTF extra.
- * @param context The context when loading the asset
- * @param property The glTF property to load the extra from
- * @param extensionName The name of the extension to load
- * @param actionAsync The action to run
- * @returns The promise returned by actionAsync or null if the extra does not exist
- */
- static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
- /**
- * Checks for presence of an extension.
- * @param name The name of the extension to check
- * @returns A boolean indicating the presence of the given extension name in `extensionsUsed`
- */
- isExtensionUsed(name: string): boolean;
- /**
- * Increments the indentation level and logs a message.
- * @param message The message to log
- */
- logOpen(message: string): void;
- /**
- * Decrements the indentation level.
- */
- logClose(): void;
- /**
- * Logs a message
- * @param message The message to log
- */
- log(message: string): void;
- /**
- * Starts a performance counter.
- * @param counterName The name of the performance counter
- */
- startPerformanceCounter(counterName: string): void;
- /**
- * Ends a performance counter.
- * @param counterName The name of the performance counter
- */
- endPerformanceCounter(counterName: string): void;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/EXT_lights_image_based" {
- import { Nullable } from "babylonjs/types";
- import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
- import { IScene } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- module "babylonjs-gltf2interface" {
- /** @hidden */
- interface IEXTLightsImageBased_LightImageBased {
- _babylonTexture?: BaseTexture;
- _loaded?: Promise<void>;
- }
- }
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md)
- */
- export class EXT_lights_image_based implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- private _lights?;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- onLoading(): void;
- /** @hidden */
- loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
- private _loadLightAsync;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/EXT_mesh_gpu_instancing" {
- import { TransformNode } from "babylonjs/Meshes/transformNode";
- import { Nullable } from "babylonjs/types";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { INode } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1691)
- * [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class EXT_mesh_gpu_instancing implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/EXT_texture_webp" {
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- import { ITexture } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
- import { Nullable } from "babylonjs/types";
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_texture_webp/)
- */
- export class EXT_texture_webp implements IGLTFLoaderExtension {
- /** The name of this extension. */
- readonly name: string;
- /** Defines whether this extension is enabled. */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression" {
- import { DracoCompression } from "babylonjs/Meshes/Compression/dracoCompression";
- import { Nullable } from "babylonjs/types";
- import { Geometry } from "babylonjs/Meshes/geometry";
- import { Mesh } from "babylonjs/Meshes/mesh";
- import { IMeshPrimitive } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
- */
- export class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * The draco compression used to decode vertex data or DracoCompression.Default if not defined
- */
- dracoCompression?: DracoCompression;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_lights_punctual" {
- import { Nullable } from "babylonjs/types";
- import { TransformNode } from "babylonjs/Meshes/transformNode";
- import { INode } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)
- */
- export class KHR_lights implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- private _lights?;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- onLoading(): void;
- /** @hidden */
- loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness" {
- import { Nullable } from "babylonjs/types";
- import { Material } from "babylonjs/Materials/material";
- import { IMaterial } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
- */
- export class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadSpecularGlossinessPropertiesAsync;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_unlit" {
- import { Nullable } from "babylonjs/types";
- import { Material } from "babylonjs/Materials/material";
- import { IMaterial } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
- */
- export class KHR_materials_unlit implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadUnlitPropertiesAsync;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_clearcoat" {
- import { Nullable } from "babylonjs/types";
- import { Material } from "babylonjs/Materials/material";
- import { IMaterial } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1677)
- * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_clearcoat implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadClearCoatPropertiesAsync;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_sheen" {
- import { Nullable } from "babylonjs/types";
- import { Material } from "babylonjs/Materials/material";
- import { IMaterial } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1688)
- * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_sheen implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadSheenPropertiesAsync;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_specular" {
- import { Nullable } from "babylonjs/types";
- import { Material } from "babylonjs/Materials/material";
- import { IMaterial } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1719)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_specular implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadSpecularPropertiesAsync;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_ior" {
- import { Nullable } from "babylonjs/types";
- import { Material } from "babylonjs/Materials/material";
- import { IMaterial } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1718)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_ior implements IGLTFLoaderExtension {
- /**
- * Default ior Value from the spec.
- */
- private static readonly _DEFAULT_IOR;
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadIorPropertiesAsync;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_variants" {
- import { Nullable } from "babylonjs/types";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- import { Mesh } from 'babylonjs/Meshes/mesh';
- import { AbstractMesh } from 'babylonjs/Meshes/abstractMesh';
- import { INode, IMeshPrimitive, IMesh } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1681)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_variants implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /**
- * Gets the list of available variant names for this asset.
- * @param rootMesh The glTF root mesh
- * @returns the list of all the variant names for this model
- */
- static GetAvailableVariants(rootMesh: Mesh): string[];
- /**
- * Gets the list of available variant names for this asset.
- * @param rootMesh The glTF root mesh
- * @returns the list of all the variant names for this model
- */
- getAvailableVariants(rootMesh: Mesh): string[];
- /**
- * Select a variant given a variant name or a list of variant names.
- * @param rootMesh The glTF root mesh
- * @param variantName The variant name(s) to select.
- */
- static SelectVariant(rootMesh: Mesh, variantName: string | string[]): void;
- /**
- * Select a variant given a variant name or a list of variant names.
- * @param rootMesh The glTF root mesh
- * @param variantName The variant name(s) to select.
- */
- selectVariant(rootMesh: Mesh, variantName: string | string[]): void;
- /**
- * Reset back to the original before selecting a variant.
- * @param rootMesh The glTF root mesh
- */
- static Reset(rootMesh: Mesh): void;
- /**
- * Reset back to the original before selecting a variant.
- * @param rootMesh The glTF root mesh
- */
- reset(rootMesh: Mesh): void;
- /**
- * Gets the last selected variant name(s) or null if original.
- * @param rootMesh The glTF root mesh
- * @returns The selected variant name(s).
- */
- static GetLastSelectedVariant(rootMesh: Mesh): Nullable<string | string[]>;
- /**
- * Gets the last selected variant name(s) or null if original.
- * @param rootMesh The glTF root mesh
- * @returns The selected variant name(s).
- */
- getLastSelectedVariant(rootMesh: Mesh): Nullable<string | string[]>;
- private static _GetExtensionMetadata;
- /** @hidden */
- _loadMeshPrimitiveAsync(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Nullable<Promise<AbstractMesh>>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_transmission" {
- import { Nullable } from "babylonjs/types";
- import { Material } from "babylonjs/Materials/material";
- import { IMaterial } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1698)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_transmission implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadTransparentPropertiesAsync;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_mesh_quantization" {
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization)
- */
- export class KHR_mesh_quantization implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_texture_basisu" {
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- import { ITexture } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
- import { Nullable } from "babylonjs/types";
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1751)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_texture_basisu implements IGLTFLoaderExtension {
- /** The name of this extension. */
- readonly name: string;
- /** Defines whether this extension is enabled. */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_texture_transform" {
- import { Nullable } from "babylonjs/types";
- import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
- import { ITextureInfo } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform)
- */
- export class KHR_texture_transform implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/KHR_xmp" {
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1553)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_xmp implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /**
- * Called after the loader state changes to LOADING.
- */
- onLoading(): void;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/MSFT_audio_emitter" {
- import { Nullable } from "babylonjs/types";
- import { AnimationGroup } from "babylonjs/Animations/animationGroup";
- import { TransformNode } from "babylonjs/Meshes/transformNode";
- import { IScene, INode, IAnimation } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /**
- * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
- */
- export class MSFT_audio_emitter implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- private _clips;
- private _emitters;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- onLoading(): void;
- /** @hidden */
- loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
- /** @hidden */
- loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
- /** @hidden */
- loadAnimationAsync(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
- private _loadClipAsync;
- private _loadEmitterAsync;
- private _getEventAction;
- private _loadAnimationEventAsync;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/MSFT_lod" {
- import { Nullable } from "babylonjs/types";
- import { Observable } from "babylonjs/Misc/observable";
- import { Material } from "babylonjs/Materials/material";
- import { TransformNode } from "babylonjs/Meshes/transformNode";
- import { Mesh } from "babylonjs/Meshes/mesh";
- import { INode, IMaterial, IBuffer, IScene } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- import { IProperty } from 'babylonjs-gltf2interface';
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
- */
- export class MSFT_lod implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- /**
- * Maximum number of LODs to load, starting from the lowest LOD.
- */
- maxLODsToLoad: number;
- /**
- * Observable raised when all node LODs of one level are loaded.
- * The event data is the index of the loaded LOD starting from zero.
- * Dispose the loader to cancel the loading of the next level of LODs.
- */
- onNodeLODsLoadedObservable: Observable<number>;
- /**
- * Observable raised when all material LODs of one level are loaded.
- * The event data is the index of the loaded LOD starting from zero.
- * Dispose the loader to cancel the loading of the next level of LODs.
- */
- onMaterialLODsLoadedObservable: Observable<number>;
- private _loader;
- private _bufferLODs;
- private _nodeIndexLOD;
- private _nodeSignalLODs;
- private _nodePromiseLODs;
- private _nodeBufferLODs;
- private _materialIndexLOD;
- private _materialSignalLODs;
- private _materialPromiseLODs;
- private _materialBufferLODs;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- onReady(): void;
- /** @hidden */
- loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
- /** @hidden */
- loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
- /** @hidden */
- _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
- /** @hidden */
- _loadUriAsync(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>>;
- /** @hidden */
- loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>>;
- private _loadBufferLOD;
- /**
- * Gets an array of LOD properties from lowest to highest.
- */
- private _getLODs;
- private _disposeTransformNode;
- private _disposeMaterials;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/MSFT_minecraftMesh" {
- import { Nullable } from "babylonjs/types";
- import { Material } from "babylonjs/Materials/material";
- import { IMaterial } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /** @hidden */
- export class MSFT_minecraftMesh implements IGLTFLoaderExtension {
- readonly name: string;
- enabled: boolean;
- private _loader;
- constructor(loader: GLTFLoader);
- dispose(): void;
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/MSFT_sRGBFactors" {
- import { Nullable } from "babylonjs/types";
- import { Material } from "babylonjs/Materials/material";
- import { IMaterial } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- /** @hidden */
- export class MSFT_sRGBFactors implements IGLTFLoaderExtension {
- readonly name: string;
- enabled: boolean;
- private _loader;
- constructor(loader: GLTFLoader);
- dispose(): void;
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/ExtrasAsMetadata" {
- import { Nullable } from "babylonjs/types";
- import { TransformNode } from "babylonjs/Meshes/transformNode";
- import { Camera } from "babylonjs/Cameras/camera";
- import { INode, ICamera, IMaterial } from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- import { IGLTFLoaderExtension } from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
- import { Material } from "babylonjs/Materials/material";
- /**
- * Store glTF extras (if present) in BJS objects' metadata
- */
- export class ExtrasAsMetadata implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- private _assignExtras;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
- /** @hidden */
- loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
- /** @hidden */
- createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
- }
- }
- declare module "babylonjs-loaders/glTF/2.0/Extensions/index" {
- export * from "babylonjs-loaders/glTF/2.0/Extensions/EXT_lights_image_based";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/EXT_mesh_gpu_instancing";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/EXT_texture_webp";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_lights_punctual";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_unlit";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_clearcoat";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_sheen";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_specular";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_ior";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_variants";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_materials_transmission";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_mesh_quantization";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_texture_basisu";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_texture_transform";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/KHR_xmp";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/MSFT_audio_emitter";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/MSFT_lod";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/MSFT_minecraftMesh";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/MSFT_sRGBFactors";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/ExtrasAsMetadata";
- }
- declare module "babylonjs-loaders/glTF/2.0/index" {
- export * from "babylonjs-loaders/glTF/2.0/glTFLoader";
- export * from "babylonjs-loaders/glTF/2.0/glTFLoaderExtension";
- export * from "babylonjs-loaders/glTF/2.0/glTFLoaderInterfaces";
- export * from "babylonjs-loaders/glTF/2.0/Extensions/index";
- }
- declare module "babylonjs-loaders/glTF/index" {
- export * from "babylonjs-loaders/glTF/glTFFileLoader";
- export * from "babylonjs-loaders/glTF/glTFValidation";
- import * as GLTF1 from "babylonjs-loaders/glTF/1.0/index";
- import * as GLTF2 from "babylonjs-loaders/glTF/2.0/index";
- export { GLTF1, GLTF2 };
- }
- declare module "babylonjs-loaders/OBJ/mtlFileLoader" {
- import { StandardMaterial } from "babylonjs/Materials/standardMaterial";
- import { Scene } from "babylonjs/scene";
- /**
- * Class reading and parsing the MTL file bundled with the obj file.
- */
- export class MTLFileLoader {
- /**
- * Invert Y-Axis of referenced textures on load
- */
- static INVERT_TEXTURE_Y: boolean;
- /**
- * All material loaded from the mtl will be set here
- */
- materials: StandardMaterial[];
- /**
- * This function will read the mtl file and create each material described inside
- * This function could be improve by adding :
- * -some component missing (Ni, Tf...)
- * -including the specific options available
- *
- * @param scene defines the scene the material will be created in
- * @param data defines the mtl data to parse
- * @param rootUrl defines the rooturl to use in order to load relative dependencies
- * @param forAssetContainer defines if the material should be registered in the scene
- */
- parseMTL(scene: Scene, data: string | ArrayBuffer, rootUrl: string, forAssetContainer: boolean): void;
- /**
- * Gets the texture for the material.
- *
- * If the material is imported from input file,
- * We sanitize the url to ensure it takes the textre from aside the material.
- *
- * @param rootUrl The root url to load from
- * @param value The value stored in the mtl
- * @return The Texture
- */
- private static _getTexture;
- }
- }
- declare module "babylonjs-loaders/OBJ/objFileLoader" {
- import { Vector2 } from "babylonjs/Maths/math.vector";
- import { AnimationGroup } from "babylonjs/Animations/animationGroup";
- import { Skeleton } from "babylonjs/Bones/skeleton";
- import { IParticleSystem } from "babylonjs/Particles/IParticleSystem";
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
- import { ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginFactory, ISceneLoaderPlugin } from "babylonjs/Loading/sceneLoader";
- import { AssetContainer } from "babylonjs/assetContainer";
- import { Scene } from "babylonjs/scene";
- /**
- * Options for loading OBJ/MTL files
- */
- type MeshLoadOptions = {
- /**
- * Defines if UVs are optimized by default during load.
- */
- OptimizeWithUV: boolean;
- /**
- * Defines custom scaling of UV coordinates of loaded meshes.
- */
- UVScaling: Vector2;
- /**
- * Invert model on y-axis (does a model scaling inversion)
- */
- InvertY: boolean;
- /**
- * Invert Y-Axis of referenced textures on load
- */
- InvertTextureY: boolean;
- /**
- * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
- */
- ImportVertexColors: boolean;
- /**
- * Compute the normals for the model, even if normals are present in the file.
- */
- ComputeNormals: boolean;
- /**
- * Skip loading the materials even if defined in the OBJ file (materials are ignored).
- */
- SkipMaterials: boolean;
- /**
- * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
- */
- MaterialLoadingFailsSilently: boolean;
- };
- /**
- * OBJ file type loader.
- * This is a babylon scene loader plugin.
- */
- export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
- /**
- * Defines if UVs are optimized by default during load.
- */
- static OPTIMIZE_WITH_UV: boolean;
- /**
- * Invert model on y-axis (does a model scaling inversion)
- */
- static INVERT_Y: boolean;
- /**
- * Invert Y-Axis of referenced textures on load
- */
- static get INVERT_TEXTURE_Y(): boolean;
- static set INVERT_TEXTURE_Y(value: boolean);
- /**
- * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
- */
- static IMPORT_VERTEX_COLORS: boolean;
- /**
- * Compute the normals for the model, even if normals are present in the file.
- */
- static COMPUTE_NORMALS: boolean;
- /**
- * Defines custom scaling of UV coordinates of loaded meshes.
- */
- static UV_SCALING: Vector2;
- /**
- * Skip loading the materials even if defined in the OBJ file (materials are ignored).
- */
- static SKIP_MATERIALS: boolean;
- /**
- * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
- *
- * Defaults to true for backwards compatibility.
- */
- static MATERIAL_LOADING_FAILS_SILENTLY: boolean;
- /**
- * Defines the name of the plugin.
- */
- name: string;
- /**
- * Defines the extension the plugin is able to load.
- */
- extensions: string;
- /** @hidden */
- obj: RegExp;
- /** @hidden */
- group: RegExp;
- /** @hidden */
- mtllib: RegExp;
- /** @hidden */
- usemtl: RegExp;
- /** @hidden */
- smooth: RegExp;
- /** @hidden */
- vertexPattern: RegExp;
- /** @hidden */
- normalPattern: RegExp;
- /** @hidden */
- uvPattern: RegExp;
- /** @hidden */
- facePattern1: RegExp;
- /** @hidden */
- facePattern2: RegExp;
- /** @hidden */
- facePattern3: RegExp;
- /** @hidden */
- facePattern4: RegExp;
- /** @hidden */
- facePattern5: RegExp;
- private _forAssetContainer;
- private _meshLoadOptions;
- /**
- * Creates loader for .OBJ files
- *
- * @param meshLoadOptions options for loading and parsing OBJ/MTL files.
- */
- constructor(meshLoadOptions?: MeshLoadOptions);
- private static get currentMeshLoadOptions();
- /**
- * Calls synchronously the MTL file attached to this obj.
- * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.
- * Without this function materials are not displayed in the first frame (but displayed after).
- * In consequence it is impossible to get material information in your HTML file
- *
- * @param url The URL of the MTL file
- * @param rootUrl
- * @param onSuccess Callback function to be called when the MTL file is loaded
- * @private
- */
- private _loadMTL;
- /**
- * Instantiates a OBJ file loader plugin.
- * @returns the created plugin
- */
- createPlugin(): ISceneLoaderPluginAsync | ISceneLoaderPlugin;
- /**
- * If the data string can be loaded directly.
- *
- * @param data string containing the file data
- * @returns if the data can be loaded directly
- */
- canDirectLoad(data: string): boolean;
- /**
- * Imports one or more meshes from the loaded OBJ data and adds them to the scene
- * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
- * @param scene the scene the meshes should be added to
- * @param data the OBJ data to load
- * @param rootUrl root url to load from
- * @param onProgress event that fires when loading progress has occured
- * @param fileName Defines the name of the file to load
- * @returns a promise containg the loaded meshes, particles, skeletons and animations
- */
- importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<{
- meshes: AbstractMesh[];
- particleSystems: IParticleSystem[];
- skeletons: Skeleton[];
- animationGroups: AnimationGroup[];
- }>;
- /**
- * Imports all objects from the loaded OBJ data and adds them to the scene
- * @param scene the scene the objects should be added to
- * @param data the OBJ data to load
- * @param rootUrl root url to load from
- * @param onProgress event that fires when loading progress has occured
- * @param fileName Defines the name of the file to load
- * @returns a promise which completes when objects have been loaded to the scene
- */
- loadAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
- /**
- * Load into an asset container.
- * @param scene The scene to load into
- * @param data The data to import
- * @param rootUrl The root url for scene and resources
- * @param onProgress The callback when the load progresses
- * @param fileName Defines the name of the file to load
- * @returns The loaded asset container
- */
- loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
- /**
- * Read the OBJ file and create an Array of meshes.
- * Each mesh contains all information given by the OBJ and the MTL file.
- * i.e. vertices positions and indices, optional normals values, optional UV values, optional material
- *
- * @param meshesNames
- * @param scene Scene The scene where are displayed the data
- * @param data String The content of the obj file
- * @param rootUrl String The path to the folder
- * @returns Array<AbstractMesh>
- * @private
- */
- private _parseSolid;
- }
- }
- declare module "babylonjs-loaders/OBJ/index" {
- export * from "babylonjs-loaders/OBJ/mtlFileLoader";
- export * from "babylonjs-loaders/OBJ/objFileLoader";
- }
- declare module "babylonjs-loaders/STL/stlFileLoader" {
- import { Nullable } from "babylonjs/types";
- import { Skeleton } from "babylonjs/Bones/skeleton";
- import { IParticleSystem } from "babylonjs/Particles/IParticleSystem";
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
- import { ISceneLoaderPlugin, ISceneLoaderPluginExtensions } from "babylonjs/Loading/sceneLoader";
- import { AssetContainer } from "babylonjs/assetContainer";
- import { Scene } from "babylonjs/scene";
- /**
- * STL file type loader.
- * This is a babylon scene loader plugin.
- */
- export class STLFileLoader implements ISceneLoaderPlugin {
- /** @hidden */
- solidPattern: RegExp;
- /** @hidden */
- facetsPattern: RegExp;
- /** @hidden */
- normalPattern: RegExp;
- /** @hidden */
- vertexPattern: RegExp;
- /**
- * Defines the name of the plugin.
- */
- name: string;
- /**
- * Defines the extensions the stl loader is able to load.
- * force data to come in as an ArrayBuffer
- * we'll convert to string if it looks like it's an ASCII .stl
- */
- extensions: ISceneLoaderPluginExtensions;
- /**
- * Import meshes into a scene.
- * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
- * @param scene The scene to import into
- * @param data The data to import
- * @param rootUrl The root url for scene and resources
- * @param meshes The meshes array to import into
- * @param particleSystems The particle systems array to import into
- * @param skeletons The skeletons array to import into
- * @param onError The callback when import fails
- * @returns True if successful or false otherwise
- */
- importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<IParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
- /**
- * Load into a scene.
- * @param scene The scene to load into
- * @param data The data to import
- * @param rootUrl The root url for scene and resources
- * @param onError The callback when import fails
- * @returns true if successful or false otherwise
- */
- load(scene: Scene, data: any, rootUrl: string): boolean;
- /**
- * Load into an asset container.
- * @param scene The scene to load into
- * @param data The data to import
- * @param rootUrl The root url for scene and resources
- * @param onError The callback when import fails
- * @returns The loaded asset container
- */
- loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
- private _isBinary;
- private _parseBinary;
- private _parseASCII;
- }
- }
- declare module "babylonjs-loaders/STL/index" {
- export * from "babylonjs-loaders/STL/stlFileLoader";
- }
- declare module "babylonjs-loaders/index" {
- export * from "babylonjs-loaders/glTF/index";
- export * from "babylonjs-loaders/OBJ/index";
- export * from "babylonjs-loaders/STL/index";
- }
- declare module "babylonjs-loaders/legacy/legacy-glTF" {
- export * from "babylonjs-loaders/glTF/glTFFileLoader";
- export * from "babylonjs-loaders/glTF/glTFValidation";
- }
- declare module "babylonjs-loaders/legacy/legacy-glTF1" {
- import * as GLTF1 from "babylonjs-loaders/glTF/1.0/index";
- export { GLTF1 };
- }
- declare module "babylonjs-loaders/legacy/legacy-glTF1FileLoader" {
- export * from "babylonjs-loaders/legacy/legacy-glTF";
- export * from "babylonjs-loaders/legacy/legacy-glTF1";
- }
- declare module "babylonjs-loaders/legacy/legacy-glTF2" {
- import * as GLTF2 from "babylonjs-loaders/glTF/2.0/index";
- export { GLTF2 };
- }
- declare module "babylonjs-loaders/legacy/legacy-glTF2FileLoader" {
- export * from "babylonjs-loaders/legacy/legacy-glTF";
- export * from "babylonjs-loaders/legacy/legacy-glTF2";
- }
- declare module "babylonjs-loaders/legacy/legacy-glTFFileLoader" {
- export * from "babylonjs-loaders/legacy/legacy-glTF";
- export * from "babylonjs-loaders/legacy/legacy-glTF1";
- export * from "babylonjs-loaders/legacy/legacy-glTF2";
- }
- declare module "babylonjs-loaders/legacy/legacy-objFileLoader" {
- export * from "babylonjs-loaders/OBJ/index";
- }
- declare module "babylonjs-loaders/legacy/legacy-stlFileLoader" {
- export * from "babylonjs-loaders/STL/index";
- }
- declare module "babylonjs-loaders/legacy/legacy" {
- import "babylonjs-loaders/index";
- export * from "babylonjs-loaders/legacy/legacy-glTF";
- export * from "babylonjs-loaders/legacy/legacy-glTF1";
- export * from "babylonjs-loaders/legacy/legacy-glTF2";
- export * from "babylonjs-loaders/legacy/legacy-objFileLoader";
- export * from "babylonjs-loaders/legacy/legacy-stlFileLoader";
- }
- declare module "babylonjs-loaders" {
- export * from "babylonjs-loaders/legacy/legacy";
- }
- declare module BABYLON {
- /**
- * Configuration for glTF validation
- */
- export interface IGLTFValidationConfiguration {
- /**
- * The url of the glTF validator.
- */
- url: string;
- }
- /**
- * glTF validation
- */
- export class GLTFValidation {
- /**
- * The configuration. Defaults to `{ url: "https://preview.babylonjs.com/gltf_validator.js" }`.
- */
- static Configuration: IGLTFValidationConfiguration;
- private static _LoadScriptPromise;
- /**
- * Validate a glTF asset using the glTF-Validator.
- * @param data The JSON of a glTF or the array buffer of a binary glTF
- * @param rootUrl The root url for the glTF
- * @param fileName The file name for the glTF
- * @param getExternalResource The callback to get external resources for the glTF validator
- * @returns A promise that resolves with the glTF validation results once complete
- */
- static ValidateAsync(data: string | ArrayBuffer, rootUrl: string, fileName: string, getExternalResource: (uri: string) => Promise<ArrayBuffer>): Promise<BABYLON.GLTF2.IGLTFValidationResults>;
- }
- }
- declare module BABYLON {
- /**
- * Mode that determines the coordinate system to use.
- */
- export enum GLTFLoaderCoordinateSystemMode {
- /**
- * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
- */
- AUTO = 0,
- /**
- * Sets the useRightHandedSystem flag on the scene.
- */
- FORCE_RIGHT_HANDED = 1
- }
- /**
- * Mode that determines what animations will start.
- */
- export enum GLTFLoaderAnimationStartMode {
- /**
- * No animation will start.
- */
- NONE = 0,
- /**
- * The first animation will start.
- */
- FIRST = 1,
- /**
- * All animations will start.
- */
- ALL = 2
- }
- /**
- * Interface that contains the data for the glTF asset.
- */
- export interface IGLTFLoaderData {
- /**
- * The object that represents the glTF JSON.
- */
- json: Object;
- /**
- * The BIN chunk of a binary glTF.
- */
- bin: Nullable<IDataBuffer>;
- }
- /**
- * Interface for extending the loader.
- */
- export interface IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines the order of this extension.
- * The loader sorts the extensions using these values when loading.
- */
- order?: number;
- }
- /**
- * Loader state.
- */
- export enum GLTFLoaderState {
- /**
- * The asset is loading.
- */
- LOADING = 0,
- /**
- * The asset is ready for rendering.
- */
- READY = 1,
- /**
- * The asset is completely loaded.
- */
- COMPLETE = 2
- }
- /** @hidden */
- export interface IImportMeshAsyncOutput {
- meshes: AbstractMesh[];
- particleSystems: IParticleSystem[];
- skeletons: Skeleton[];
- animationGroups: AnimationGroup[];
- lights: Light[];
- transformNodes: TransformNode[];
- }
- /** @hidden */
- export interface IGLTFLoader extends IDisposable {
- readonly state: Nullable<GLTFLoaderState>;
- importMeshAsync: (meshesNames: any, scene: Scene, forAssetContainer: boolean, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<IImportMeshAsyncOutput>;
- loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>;
- }
- /**
- * File loader for loading glTF files into a scene.
- */
- export class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
- /** @hidden */
- static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
- /** @hidden */
- static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
- /**
- * Raised when the asset has been parsed
- */
- onParsedObservable: Observable<IGLTFLoaderData>;
- private _onParsedObserver;
- /**
- * Raised when the asset has been parsed
- */
- set onParsed(callback: (loaderData: IGLTFLoaderData) => void);
- /**
- * 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.
- * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
- * Defaults to true.
- * @hidden
- */
- static IncrementalLoading: boolean;
- /**
- * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
- * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
- * @hidden
- */
- static HomogeneousCoordinates: boolean;
- /**
- * The coordinate system mode. Defaults to AUTO.
- */
- coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
- /**
- * The animation start mode. Defaults to FIRST.
- */
- animationStartMode: GLTFLoaderAnimationStartMode;
- /**
- * Defines if the loader should compile materials before raising the success callback. Defaults to false.
- */
- compileMaterials: boolean;
- /**
- * Defines if the loader should also compile materials with clip planes. Defaults to false.
- */
- useClipPlane: boolean;
- /**
- * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.
- */
- compileShadowGenerators: boolean;
- /**
- * Defines if the Alpha blended materials are only applied as coverage.
- * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.
- * If true, no extra effects are applied to transparent pixels.
- */
- transparencyAsCoverage: boolean;
- /**
- * Defines if the loader should use range requests when load binary glTF files from HTTP.
- * Enabling will disable offline support and glTF validator.
- * Defaults to false.
- */
- useRangeRequests: boolean;
- /**
- * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.
- */
- createInstances: boolean;
- /**
- * Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false.
- */
- alwaysComputeBoundingBox: boolean;
- /**
- * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.
- */
- loadAllMaterials: boolean;
- /**
- * Function called before loading a url referenced by the asset.
- */
- preprocessUrlAsync: (url: string) => Promise<string>;
- /**
- * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
- */
- readonly onMeshLoadedObservable: Observable<AbstractMesh>;
- private _onMeshLoadedObserver;
- /**
- * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
- */
- set onMeshLoaded(callback: (mesh: AbstractMesh) => void);
- /**
- * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
- */
- readonly onTextureLoadedObservable: Observable<BaseTexture>;
- private _onTextureLoadedObserver;
- /**
- * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
- */
- set onTextureLoaded(callback: (texture: BaseTexture) => void);
- /**
- * Observable raised when the loader creates a material after parsing the glTF properties of the material.
- */
- readonly onMaterialLoadedObservable: Observable<Material>;
- private _onMaterialLoadedObserver;
- /**
- * Callback raised when the loader creates a material after parsing the glTF properties of the material.
- */
- set onMaterialLoaded(callback: (material: Material) => void);
- /**
- * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.
- */
- readonly onCameraLoadedObservable: Observable<Camera>;
- private _onCameraLoadedObserver;
- /**
- * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
- */
- set onCameraLoaded(callback: (camera: Camera) => void);
- /**
- * Observable raised when the asset is completely loaded, immediately before the loader is disposed.
- * For assets with LODs, raised when all of the LODs are complete.
- * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
- */
- readonly onCompleteObservable: Observable<void>;
- private _onCompleteObserver;
- /**
- * Callback raised when the asset is completely loaded, immediately before the loader is disposed.
- * For assets with LODs, raised when all of the LODs are complete.
- * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
- */
- set onComplete(callback: () => void);
- /**
- * Observable raised when an error occurs.
- */
- readonly onErrorObservable: Observable<any>;
- private _onErrorObserver;
- /**
- * Callback raised when an error occurs.
- */
- set onError(callback: (reason: any) => void);
- /**
- * Observable raised after the loader is disposed.
- */
- readonly onDisposeObservable: Observable<void>;
- private _onDisposeObserver;
- /**
- * Callback raised after the loader is disposed.
- */
- set onDispose(callback: () => void);
- /**
- * Observable raised after a loader extension is created.
- * Set additional options for a loader extension in this event.
- */
- readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
- private _onExtensionLoadedObserver;
- /**
- * Callback raised after a loader extension is created.
- */
- set onExtensionLoaded(callback: (extension: IGLTFLoaderExtension) => void);
- /**
- * Defines if the loader logging is enabled.
- */
- get loggingEnabled(): boolean;
- set loggingEnabled(value: boolean);
- /**
- * Defines if the loader should capture performance counters.
- */
- get capturePerformanceCounters(): boolean;
- set capturePerformanceCounters(value: boolean);
- /**
- * Defines if the loader should validate the asset.
- */
- validate: boolean;
- /**
- * Observable raised after validation when validate is set to true. The event data is the result of the validation.
- */
- readonly onValidatedObservable: Observable<BABYLON.GLTF2.IGLTFValidationResults>;
- private _onValidatedObserver;
- /**
- * Callback raised after a loader extension is created.
- */
- set onValidated(callback: (results: BABYLON.GLTF2.IGLTFValidationResults) => void);
- private _loader;
- private _progressCallback?;
- private _requests;
- private static magicBase64Encoded;
- /**
- * Name of the loader ("gltf")
- */
- name: string;
- /** @hidden */
- extensions: ISceneLoaderPluginExtensions;
- /**
- * Disposes the loader, releases resources during load, and cancels any outstanding requests.
- */
- dispose(): void;
- /** @hidden */
- requestFile(scene: Scene, url: string, onSuccess: (data: any, request?: WebRequest) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (error: any) => void): IFileRequest;
- /** @hidden */
- readFile(scene: Scene, file: File, onSuccess: (data: any) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => any, useArrayBuffer?: boolean, onError?: (error: any) => void): IFileRequest;
- /** @hidden */
- importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<{
- meshes: AbstractMesh[];
- particleSystems: IParticleSystem[];
- skeletons: Skeleton[];
- animationGroups: AnimationGroup[];
- }>;
- /** @hidden */
- loadAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
- /** @hidden */
- loadAssetContainerAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
- /** @hidden */
- canDirectLoad(data: string): boolean;
- /** @hidden */
- directLoad(scene: Scene, data: string): Promise<any>;
- /**
- * The callback that allows custom handling of the root url based on the response url.
- * @param rootUrl the original root url
- * @param responseURL the response url if available
- * @returns the new root url
- */
- rewriteRootURL?(rootUrl: string, responseURL?: string): string;
- /** @hidden */
- createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
- /**
- * The loader state or null if the loader is not active.
- */
- get loaderState(): Nullable<GLTFLoaderState>;
- /**
- * Returns a promise that resolves when the asset is completely loaded.
- * @returns a promise that resolves when the asset is completely loaded.
- */
- whenCompleteAsync(): Promise<void>;
- /** @hidden */
- _loadFile(url: string, scene: Scene, onSuccess: (data: string | ArrayBuffer) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest) => void): IFileRequest;
- /** @hidden */
- _requestFile(url: string, scene: Scene, onSuccess: (data: string | ArrayBuffer, request?: WebRequest) => void, useArrayBuffer?: boolean, onError?: (error: RequestFileError) => void, onOpened?: (request: WebRequest) => void): IFileRequest;
- private _onProgress;
- private _validate;
- private _getLoader;
- private _parseJson;
- private _unpackBinaryAsync;
- private _unpackBinaryV1Async;
- private _unpackBinaryV2Async;
- private static _parseVersion;
- private static _compareVersion;
- private static readonly _logSpaces;
- private _logIndentLevel;
- private _loggingEnabled;
- /** @hidden */
- _log: (message: string) => void;
- /** @hidden */
- _logOpen(message: string): void;
- /** @hidden */
- _logClose(): void;
- private _logEnabled;
- private _logDisabled;
- private _capturePerformanceCounters;
- /** @hidden */
- _startPerformanceCounter: (counterName: string) => void;
- /** @hidden */
- _endPerformanceCounter: (counterName: string) => void;
- private _startPerformanceCounterEnabled;
- private _startPerformanceCounterDisabled;
- private _endPerformanceCounterEnabled;
- private _endPerformanceCounterDisabled;
- }
- }
- declare module BABYLON.GLTF1 {
- /**
- * Enums
- * @hidden
- */
- export enum EComponentType {
- BYTE = 5120,
- UNSIGNED_BYTE = 5121,
- SHORT = 5122,
- UNSIGNED_SHORT = 5123,
- FLOAT = 5126
- }
- /** @hidden */
- export enum EShaderType {
- FRAGMENT = 35632,
- VERTEX = 35633
- }
- /** @hidden */
- export enum EParameterType {
- BYTE = 5120,
- UNSIGNED_BYTE = 5121,
- SHORT = 5122,
- UNSIGNED_SHORT = 5123,
- INT = 5124,
- UNSIGNED_INT = 5125,
- FLOAT = 5126,
- FLOAT_VEC2 = 35664,
- FLOAT_VEC3 = 35665,
- FLOAT_VEC4 = 35666,
- INT_VEC2 = 35667,
- INT_VEC3 = 35668,
- INT_VEC4 = 35669,
- BOOL = 35670,
- BOOL_VEC2 = 35671,
- BOOL_VEC3 = 35672,
- BOOL_VEC4 = 35673,
- FLOAT_MAT2 = 35674,
- FLOAT_MAT3 = 35675,
- FLOAT_MAT4 = 35676,
- SAMPLER_2D = 35678
- }
- /** @hidden */
- export enum ETextureWrapMode {
- CLAMP_TO_EDGE = 33071,
- MIRRORED_REPEAT = 33648,
- REPEAT = 10497
- }
- /** @hidden */
- export enum ETextureFilterType {
- NEAREST = 9728,
- LINEAR = 9728,
- NEAREST_MIPMAP_NEAREST = 9984,
- LINEAR_MIPMAP_NEAREST = 9985,
- NEAREST_MIPMAP_LINEAR = 9986,
- LINEAR_MIPMAP_LINEAR = 9987
- }
- /** @hidden */
- export enum ETextureFormat {
- ALPHA = 6406,
- RGB = 6407,
- RGBA = 6408,
- LUMINANCE = 6409,
- LUMINANCE_ALPHA = 6410
- }
- /** @hidden */
- export enum ECullingType {
- FRONT = 1028,
- BACK = 1029,
- FRONT_AND_BACK = 1032
- }
- /** @hidden */
- export enum EBlendingFunction {
- ZERO = 0,
- ONE = 1,
- SRC_COLOR = 768,
- ONE_MINUS_SRC_COLOR = 769,
- DST_COLOR = 774,
- ONE_MINUS_DST_COLOR = 775,
- SRC_ALPHA = 770,
- ONE_MINUS_SRC_ALPHA = 771,
- DST_ALPHA = 772,
- ONE_MINUS_DST_ALPHA = 773,
- CONSTANT_COLOR = 32769,
- ONE_MINUS_CONSTANT_COLOR = 32770,
- CONSTANT_ALPHA = 32771,
- ONE_MINUS_CONSTANT_ALPHA = 32772,
- SRC_ALPHA_SATURATE = 776
- }
- /** @hidden */
- export interface IGLTFProperty {
- extensions?: {
- [key: string]: any;
- };
- extras?: Object;
- }
- /** @hidden */
- export interface IGLTFChildRootProperty extends IGLTFProperty {
- name?: string;
- }
- /** @hidden */
- export interface IGLTFAccessor extends IGLTFChildRootProperty {
- bufferView: string;
- byteOffset: number;
- byteStride: number;
- count: number;
- type: string;
- componentType: EComponentType;
- max?: number[];
- min?: number[];
- name?: string;
- }
- /** @hidden */
- export interface IGLTFBufferView extends IGLTFChildRootProperty {
- buffer: string;
- byteOffset: number;
- byteLength: number;
- byteStride: number;
- target?: number;
- }
- /** @hidden */
- export interface IGLTFBuffer extends IGLTFChildRootProperty {
- uri: string;
- byteLength?: number;
- type?: string;
- }
- /** @hidden */
- export interface IGLTFShader extends IGLTFChildRootProperty {
- uri: string;
- type: EShaderType;
- }
- /** @hidden */
- export interface IGLTFProgram extends IGLTFChildRootProperty {
- attributes: string[];
- fragmentShader: string;
- vertexShader: string;
- }
- /** @hidden */
- export interface IGLTFTechniqueParameter {
- type: number;
- count?: number;
- semantic?: string;
- node?: string;
- value?: number | boolean | string | Array<any>;
- source?: string;
- babylonValue?: any;
- }
- /** @hidden */
- export interface IGLTFTechniqueCommonProfile {
- lightingModel: string;
- texcoordBindings: Object;
- parameters?: Array<any>;
- }
- /** @hidden */
- export interface IGLTFTechniqueStatesFunctions {
- blendColor?: number[];
- blendEquationSeparate?: number[];
- blendFuncSeparate?: number[];
- colorMask: boolean[];
- cullFace: number[];
- }
- /** @hidden */
- export interface IGLTFTechniqueStates {
- enable: number[];
- functions: IGLTFTechniqueStatesFunctions;
- }
- /** @hidden */
- export interface IGLTFTechnique extends IGLTFChildRootProperty {
- parameters: {
- [key: string]: IGLTFTechniqueParameter;
- };
- program: string;
- attributes: {
- [key: string]: string;
- };
- uniforms: {
- [key: string]: string;
- };
- states: IGLTFTechniqueStates;
- }
- /** @hidden */
- export interface IGLTFMaterial extends IGLTFChildRootProperty {
- technique?: string;
- values: string[];
- }
- /** @hidden */
- export interface IGLTFMeshPrimitive extends IGLTFProperty {
- attributes: {
- [key: string]: string;
- };
- indices: string;
- material: string;
- mode?: number;
- }
- /** @hidden */
- export interface IGLTFMesh extends IGLTFChildRootProperty {
- primitives: IGLTFMeshPrimitive[];
- }
- /** @hidden */
- export interface IGLTFImage extends IGLTFChildRootProperty {
- uri: string;
- }
- /** @hidden */
- export interface IGLTFSampler extends IGLTFChildRootProperty {
- magFilter?: number;
- minFilter?: number;
- wrapS?: number;
- wrapT?: number;
- }
- /** @hidden */
- export interface IGLTFTexture extends IGLTFChildRootProperty {
- sampler: string;
- source: string;
- format?: ETextureFormat;
- internalFormat?: ETextureFormat;
- target?: number;
- type?: number;
- babylonTexture?: Texture;
- }
- /** @hidden */
- export interface IGLTFAmbienLight {
- color?: number[];
- }
- /** @hidden */
- export interface IGLTFDirectionalLight {
- color?: number[];
- }
- /** @hidden */
- export interface IGLTFPointLight {
- color?: number[];
- constantAttenuation?: number;
- linearAttenuation?: number;
- quadraticAttenuation?: number;
- }
- /** @hidden */
- export interface IGLTFSpotLight {
- color?: number[];
- constantAttenuation?: number;
- fallOfAngle?: number;
- fallOffExponent?: number;
- linearAttenuation?: number;
- quadraticAttenuation?: number;
- }
- /** @hidden */
- export interface IGLTFLight extends IGLTFChildRootProperty {
- type: string;
- }
- /** @hidden */
- export interface IGLTFCameraOrthographic {
- xmag: number;
- ymag: number;
- zfar: number;
- znear: number;
- }
- /** @hidden */
- export interface IGLTFCameraPerspective {
- aspectRatio: number;
- yfov: number;
- zfar: number;
- znear: number;
- }
- /** @hidden */
- export interface IGLTFCamera extends IGLTFChildRootProperty {
- type: string;
- }
- /** @hidden */
- export interface IGLTFAnimationChannelTarget {
- id: string;
- path: string;
- }
- /** @hidden */
- export interface IGLTFAnimationChannel {
- sampler: string;
- target: IGLTFAnimationChannelTarget;
- }
- /** @hidden */
- export interface IGLTFAnimationSampler {
- input: string;
- output: string;
- interpolation?: string;
- }
- /** @hidden */
- export interface IGLTFAnimation extends IGLTFChildRootProperty {
- channels?: IGLTFAnimationChannel[];
- parameters?: {
- [key: string]: string;
- };
- samplers?: {
- [key: string]: IGLTFAnimationSampler;
- };
- }
- /** @hidden */
- export interface IGLTFNodeInstanceSkin {
- skeletons: string[];
- skin: string;
- meshes: string[];
- }
- /** @hidden */
- export interface IGLTFSkins extends IGLTFChildRootProperty {
- bindShapeMatrix: number[];
- inverseBindMatrices: string;
- jointNames: string[];
- babylonSkeleton?: Skeleton;
- }
- /** @hidden */
- export interface IGLTFNode extends IGLTFChildRootProperty {
- camera?: string;
- children: string[];
- skin?: string;
- jointName?: string;
- light?: string;
- matrix: number[];
- mesh?: string;
- meshes?: string[];
- rotation?: number[];
- scale?: number[];
- translation?: number[];
- babylonNode?: Node;
- }
- /** @hidden */
- export interface IGLTFScene extends IGLTFChildRootProperty {
- nodes: string[];
- }
- /** @hidden */
- export interface IGLTFRuntime {
- extensions: {
- [key: string]: any;
- };
- accessors: {
- [key: string]: IGLTFAccessor;
- };
- buffers: {
- [key: string]: IGLTFBuffer;
- };
- bufferViews: {
- [key: string]: IGLTFBufferView;
- };
- meshes: {
- [key: string]: IGLTFMesh;
- };
- lights: {
- [key: string]: IGLTFLight;
- };
- cameras: {
- [key: string]: IGLTFCamera;
- };
- nodes: {
- [key: string]: IGLTFNode;
- };
- images: {
- [key: string]: IGLTFImage;
- };
- textures: {
- [key: string]: IGLTFTexture;
- };
- shaders: {
- [key: string]: IGLTFShader;
- };
- programs: {
- [key: string]: IGLTFProgram;
- };
- samplers: {
- [key: string]: IGLTFSampler;
- };
- techniques: {
- [key: string]: IGLTFTechnique;
- };
- materials: {
- [key: string]: IGLTFMaterial;
- };
- animations: {
- [key: string]: IGLTFAnimation;
- };
- skins: {
- [key: string]: IGLTFSkins;
- };
- currentScene?: Object;
- scenes: {
- [key: string]: IGLTFScene;
- };
- extensionsUsed: string[];
- extensionsRequired?: string[];
- buffersCount: number;
- shaderscount: number;
- scene: Scene;
- rootUrl: string;
- loadedBufferCount: number;
- loadedBufferViews: {
- [name: string]: ArrayBufferView;
- };
- loadedShaderCount: number;
- importOnlyMeshes: boolean;
- importMeshesNames?: string[];
- dummyNodes: Node[];
- forAssetContainer: boolean;
- }
- /** @hidden */
- export interface INodeToRoot {
- bone: Bone;
- node: IGLTFNode;
- id: string;
- }
- /** @hidden */
- export interface IJointNode {
- node: IGLTFNode;
- id: string;
- }
- }
- declare module BABYLON.GLTF1 {
- /**
- * Utils functions for GLTF
- * @hidden
- */
- export class GLTFUtils {
- /**
- * Sets the given "parameter" matrix
- * @param scene: the Scene object
- * @param source: the source node where to pick the matrix
- * @param parameter: the GLTF technique parameter
- * @param uniformName: the name of the shader's uniform
- * @param shaderMaterial: the shader material
- */
- static SetMatrix(scene: Scene, source: Node, parameter: IGLTFTechniqueParameter, uniformName: string, shaderMaterial: ShaderMaterial | Effect): void;
- /**
- * Sets the given "parameter" matrix
- * @param shaderMaterial: the shader material
- * @param uniform: the name of the shader's uniform
- * @param value: the value of the uniform
- * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)
- */
- static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
- /**
- * Returns the wrap mode of the texture
- * @param mode: the mode value
- */
- static GetWrapMode(mode: number): number;
- /**
- * Returns the byte stride giving an accessor
- * @param accessor: the GLTF accessor objet
- */
- static GetByteStrideFromType(accessor: IGLTFAccessor): number;
- /**
- * Returns the texture filter mode giving a mode value
- * @param mode: the filter mode value
- */
- static GetTextureFilterMode(mode: number): ETextureFilterType;
- static GetBufferFromBufferView(gltfRuntime: IGLTFRuntime, bufferView: IGLTFBufferView, byteOffset: number, byteLength: number, componentType: EComponentType): ArrayBufferView;
- /**
- * Returns a buffer from its accessor
- * @param gltfRuntime: the GLTF runtime
- * @param accessor: the GLTF accessor
- */
- static GetBufferFromAccessor(gltfRuntime: IGLTFRuntime, accessor: IGLTFAccessor): any;
- /**
- * Decodes a buffer view into a string
- * @param view: the buffer view
- */
- static DecodeBufferToText(view: ArrayBufferView): string;
- /**
- * Returns the default material of gltf. Related to
- * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material
- * @param scene: the Babylon.js scene
- */
- static GetDefaultMaterial(scene: Scene): ShaderMaterial;
- private static _DefaultMaterial;
- }
- }
- declare module BABYLON.GLTF1 {
- /**
- * Implementation of the base glTF spec
- * @hidden
- */
- export class GLTFLoaderBase {
- static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
- static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
- static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
- static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
- static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void;
- static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
- }
- /**
- * glTF V1 Loader
- * @hidden
- */
- export class GLTFLoader implements IGLTFLoader {
- static Extensions: {
- [name: string]: GLTFLoaderExtension;
- };
- static RegisterExtension(extension: GLTFLoaderExtension): void;
- state: Nullable<GLTFLoaderState>;
- dispose(): void;
- private _importMeshAsync;
- /**
- * Imports one or more meshes from a loaded gltf file and adds them to the scene
- * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
- * @param scene the scene the meshes should be added to
- * @param forAssetContainer defines if the entities must be stored in the scene
- * @param data gltf data containing information of the meshes in a loaded file
- * @param rootUrl root url to load from
- * @param onProgress event that fires when loading progress has occured
- * @returns a promise containg the loaded meshes, particles, skeletons and animations
- */
- importMeshAsync(meshesNames: any, scene: Scene, forAssetContainer: boolean, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<IImportMeshAsyncOutput>;
- private _loadAsync;
- /**
- * Imports all objects from a loaded gltf file and adds them to the scene
- * @param scene the scene the objects should be added to
- * @param data gltf data containing information of the meshes in a loaded file
- * @param rootUrl root url to load from
- * @param onProgress event that fires when loading progress has occured
- * @returns a promise which completes when objects have been loaded to the scene
- */
- loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<void>;
- private _loadShadersAsync;
- private _loadBuffersAsync;
- private _createNodes;
- }
- /** @hidden */
- export abstract class GLTFLoaderExtension {
- private _name;
- constructor(name: string);
- get name(): string;
- /**
- * Defines an override for loading the runtime
- * Return true to stop further extensions from loading the runtime
- */
- loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
- /**
- * Defines an onverride for creating gltf runtime
- * Return true to stop further extensions from creating the runtime
- */
- loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
- /**
- * Defines an override for loading buffers
- * Return true to stop further extensions from loading this buffer
- */
- loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
- /**
- * Defines an override for loading texture buffers
- * Return true to stop further extensions from loading this texture data
- */
- loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
- /**
- * Defines an override for creating textures
- * Return true to stop further extensions from loading this texture
- */
- createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
- /**
- * Defines an override for loading shader strings
- * Return true to stop further extensions from loading this shader data
- */
- loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
- /**
- * Defines an override for loading materials
- * Return true to stop further extensions from loading this material
- */
- loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
- static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): void;
- static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void;
- static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
- static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
- static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void;
- static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
- private static LoadTextureBufferAsync;
- private static CreateTextureAsync;
- private static ApplyExtensions;
- }
- }
- declare module BABYLON.GLTF1 {
- /** @hidden */
- export class GLTFBinaryExtension extends GLTFLoaderExtension {
- private _bin;
- constructor();
- loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean;
- loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
- loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
- loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
- }
- }
- declare module BABYLON.GLTF1 {
- /** @hidden */
- export class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {
- constructor();
- loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError: (message: string) => void): boolean;
- loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
- private _loadTexture;
- }
- }
- declare module BABYLON.GLTF2.Loader {
- /**
- * Loader interface with an index field.
- */
- export interface IArrayItem {
- /**
- * The index of this item in the array.
- */
- index: number;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IAccessor extends BABYLON.GLTF2.IAccessor, IArrayItem {
- /** @hidden */
- _data?: Promise<ArrayBufferView>;
- /** @hidden */
- _babylonVertexBuffer?: Promise<VertexBuffer>;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IAnimationChannel extends BABYLON.GLTF2.IAnimationChannel, IArrayItem {
- }
- /** @hidden */
- export interface _IAnimationSamplerData {
- input: Float32Array;
- interpolation: BABYLON.GLTF2.AnimationSamplerInterpolation;
- output: Float32Array;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IAnimationSampler extends BABYLON.GLTF2.IAnimationSampler, IArrayItem {
- /** @hidden */
- _data?: Promise<_IAnimationSamplerData>;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IAnimation extends BABYLON.GLTF2.IAnimation, IArrayItem {
- channels: IAnimationChannel[];
- samplers: IAnimationSampler[];
- /** @hidden */
- _babylonAnimationGroup?: AnimationGroup;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IBuffer extends BABYLON.GLTF2.IBuffer, IArrayItem {
- /** @hidden */
- _data?: Promise<ArrayBufferView>;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IBufferView extends BABYLON.GLTF2.IBufferView, IArrayItem {
- /** @hidden */
- _data?: Promise<ArrayBufferView>;
- /** @hidden */
- _babylonBuffer?: Promise<Buffer>;
- }
- /**
- * Loader interface with additional members.
- */
- export interface ICamera extends BABYLON.GLTF2.ICamera, IArrayItem {
- }
- /**
- * Loader interface with additional members.
- */
- export interface IImage extends BABYLON.GLTF2.IImage, IArrayItem {
- /** @hidden */
- _data?: Promise<ArrayBufferView>;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMaterialNormalTextureInfo extends BABYLON.GLTF2.IMaterialNormalTextureInfo, ITextureInfo {
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMaterialOcclusionTextureInfo extends BABYLON.GLTF2.IMaterialOcclusionTextureInfo, ITextureInfo {
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMaterialPbrMetallicRoughness extends BABYLON.GLTF2.IMaterialPbrMetallicRoughness {
- baseColorTexture?: ITextureInfo;
- metallicRoughnessTexture?: ITextureInfo;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMaterial extends BABYLON.GLTF2.IMaterial, IArrayItem {
- pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
- normalTexture?: IMaterialNormalTextureInfo;
- occlusionTexture?: IMaterialOcclusionTextureInfo;
- emissiveTexture?: ITextureInfo;
- /** @hidden */
- _data?: {
- [babylonDrawMode: number]: {
- babylonMaterial: Material;
- babylonMeshes: AbstractMesh[];
- promise: Promise<void>;
- };
- };
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMesh extends BABYLON.GLTF2.IMesh, IArrayItem {
- primitives: IMeshPrimitive[];
- }
- /**
- * Loader interface with additional members.
- */
- export interface IMeshPrimitive extends BABYLON.GLTF2.IMeshPrimitive, IArrayItem {
- /** @hidden */
- _instanceData?: {
- babylonSourceMesh: Mesh;
- promise: Promise<any>;
- };
- }
- /**
- * Loader interface with additional members.
- */
- export interface INode extends BABYLON.GLTF2.INode, IArrayItem {
- /**
- * The parent glTF node.
- */
- parent?: INode;
- /** @hidden */
- _babylonTransformNode?: TransformNode;
- /** @hidden */
- _primitiveBabylonMeshes?: AbstractMesh[];
- /** @hidden */
- _babylonBones?: Bone[];
- /** @hidden */
- _numMorphTargets?: number;
- }
- /** @hidden */
- export interface _ISamplerData {
- noMipMaps: boolean;
- samplingMode: number;
- wrapU: number;
- wrapV: number;
- }
- /**
- * Loader interface with additional members.
- */
- export interface ISampler extends BABYLON.GLTF2.ISampler, IArrayItem {
- /** @hidden */
- _data?: _ISamplerData;
- }
- /**
- * Loader interface with additional members.
- */
- export interface IScene extends BABYLON.GLTF2.IScene, IArrayItem {
- }
- /**
- * Loader interface with additional members.
- */
- export interface ISkin extends BABYLON.GLTF2.ISkin, IArrayItem {
- /** @hidden */
- _data?: {
- babylonSkeleton: Skeleton;
- promise: Promise<void>;
- };
- }
- /**
- * Loader interface with additional members.
- */
- export interface ITexture extends BABYLON.GLTF2.ITexture, IArrayItem {
- }
- /**
- * Loader interface with additional members.
- */
- export interface ITextureInfo extends BABYLON.GLTF2.ITextureInfo {
- }
- /**
- * Loader interface with additional members.
- */
- export interface IGLTF extends BABYLON.GLTF2.IGLTF {
- accessors?: IAccessor[];
- animations?: IAnimation[];
- buffers?: IBuffer[];
- bufferViews?: IBufferView[];
- cameras?: ICamera[];
- images?: IImage[];
- materials?: IMaterial[];
- meshes?: IMesh[];
- nodes?: INode[];
- samplers?: ISampler[];
- scenes?: IScene[];
- skins?: ISkin[];
- textures?: ITexture[];
- }
- }
- declare module BABYLON.GLTF2 {
- /**
- * Interface for a glTF loader extension.
- */
- export interface IGLTFLoaderExtension extends BABYLON.IGLTFLoaderExtension, IDisposable {
- /**
- * Called after the loader state changes to LOADING.
- */
- onLoading?(): void;
- /**
- * Called after the loader state changes to READY.
- */
- onReady?(): void;
- /**
- * Define this method to modify the default behavior when loading scenes.
- * @param context The context when loading the asset
- * @param scene The glTF scene property
- * @returns A promise that resolves when the load is complete or null if not handled
- */
- loadSceneAsync?(context: string, scene: IScene): Nullable<Promise<void>>;
- /**
- * Define this method to modify the default behavior when loading nodes.
- * @param context The context when loading the asset
- * @param node The glTF node property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon transform node when the load is complete or null if not handled
- */
- loadNodeAsync?(context: string, node: INode, assign: (babylonMesh: TransformNode) => void): Nullable<Promise<TransformNode>>;
- /**
- * Define this method to modify the default behavior when loading cameras.
- * @param context The context when loading the asset
- * @param camera The glTF camera property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
- */
- loadCameraAsync?(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading vertex data for mesh primitives.
- * @param context The context when loading the asset
- * @param primitive The glTF mesh primitive property
- * @returns A promise that resolves with the loaded geometry when the load is complete or null if not handled
- */
- _loadVertexDataAsync?(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading data for mesh primitives.
- * @param context The context when loading the asset
- * @param name The mesh name when loading the asset
- * @param node The glTF node when loading the asset
- * @param mesh The glTF mesh when loading the asset
- * @param primitive The glTF mesh primitive property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled
- */
- _loadMeshPrimitiveAsync?(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Nullable<Promise<AbstractMesh>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading materials. Load material creates the material and then loads material properties.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon material when the load is complete or null if not handled
- */
- _loadMaterialAsync?(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
- /**
- * Define this method to modify the default behavior when creating materials.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonDrawMode The draw mode for the Babylon material
- * @returns The Babylon material or null if not handled
- */
- createMaterial?(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
- /**
- * Define this method to modify the default behavior when loading material properties.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonMaterial The Babylon material
- * @returns A promise that resolves when the load is complete or null if not handled
- */
- loadMaterialPropertiesAsync?(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- /**
- * Define this method to modify the default behavior when loading texture infos.
- * @param context The context when loading the asset
- * @param textureInfo The glTF texture info property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
- */
- loadTextureInfoAsync?(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading textures.
- * @param context The context when loading the asset
- * @param texture The glTF texture property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
- */
- _loadTextureAsync?(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
- /**
- * Define this method to modify the default behavior when loading animations.
- * @param context The context when loading the asset
- * @param animation The glTF animation property
- * @returns A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
- */
- loadAnimationAsync?(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading skins.
- * @param context The context when loading the asset
- * @param node The glTF node property
- * @param skin The glTF skin property
- * @returns A promise that resolves when the load is complete or null if not handled
- */
- _loadSkinAsync?(context: string, node: INode, skin: ISkin): Nullable<Promise<void>>;
- /**
- * @hidden
- * Define this method to modify the default behavior when loading uris.
- * @param context The context when loading the asset
- * @param property The glTF property associated with the uri
- * @param uri The uri to load
- * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
- */
- _loadUriAsync?(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>>;
- /**
- * Define this method to modify the default behavior when loading buffer views.
- * @param context The context when loading the asset
- * @param bufferView The glTF buffer view property
- * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
- */
- loadBufferViewAsync?(context: string, bufferView: IBufferView): Nullable<Promise<ArrayBufferView>>;
- /**
- * Define this method to modify the default behavior when loading buffers.
- * @param context The context when loading the asset
- * @param buffer The glTF buffer property
- * @param byteOffset The byte offset to load
- * @param byteLength The byte length to load
- * @returns A promise that resolves with the loaded data when the load is complete or null if not handled
- */
- loadBufferAsync?(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>>;
- }
- }
- declare module BABYLON.GLTF2 {
- /**
- * Helper class for working with arrays when loading the glTF asset
- */
- export class ArrayItem {
- /**
- * Gets an item from the given array.
- * @param context The context when loading the asset
- * @param array The array to get the item from
- * @param index The index to the array
- * @returns The array item
- */
- static Get<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
- /**
- * Assign an `index` field to each item of the given array.
- * @param array The array of items
- */
- static Assign(array?: BABYLON.GLTF2.Loader.IArrayItem[]): void;
- }
- /**
- * The glTF 2.0 loader
- */
- export class GLTFLoader implements IGLTFLoader {
- /** @hidden */
- _completePromises: Promise<any>[];
- /** @hidden */
- _forAssetContainer: boolean;
- /** Storage */
- _babylonLights: Light[];
- /** @hidden */
- _disableInstancedMesh: number;
- private _disposed;
- private _parent;
- private _state;
- private _extensions;
- private _rootUrl;
- private _fileName;
- private _uniqueRootUrl;
- private _gltf;
- private _bin;
- private _babylonScene;
- private _rootBabylonMesh;
- private _defaultBabylonMaterialData;
- private static _RegisteredExtensions;
- /**
- * The default glTF sampler.
- */
- static readonly DefaultSampler: ISampler;
- /**
- * Registers a loader extension.
- * @param name The name of the loader extension.
- * @param factory The factory function that creates the loader extension.
- */
- static RegisterExtension(name: string, factory: (loader: GLTFLoader) => IGLTFLoaderExtension): void;
- /**
- * Unregisters a loader extension.
- * @param name The name of the loader extension.
- * @returns A boolean indicating whether the extension has been unregistered
- */
- static UnregisterExtension(name: string): boolean;
- /**
- * The loader state.
- */
- get state(): Nullable<GLTFLoaderState>;
- /**
- * The object that represents the glTF JSON.
- */
- get gltf(): IGLTF;
- /**
- * The BIN chunk of a binary glTF.
- */
- get bin(): Nullable<IDataBuffer>;
- /**
- * The parent file loader.
- */
- get parent(): GLTFFileLoader;
- /**
- * The Babylon scene when loading the asset.
- */
- get babylonScene(): Scene;
- /**
- * The root Babylon mesh when loading the asset.
- */
- get rootBabylonMesh(): Mesh;
- /** @hidden */
- constructor(parent: GLTFFileLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- importMeshAsync(meshesNames: any, scene: Scene, forAssetContainer: boolean, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<IImportMeshAsyncOutput>;
- /** @hidden */
- loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
- private _loadAsync;
- private _loadData;
- private _setupData;
- private _loadExtensions;
- private _checkExtensions;
- private _setState;
- private _createRootNode;
- /**
- * Loads a glTF scene.
- * @param context The context when loading the asset
- * @param scene The glTF scene property
- * @returns A promise that resolves when the load is complete
- */
- loadSceneAsync(context: string, scene: IScene): Promise<void>;
- private _forEachPrimitive;
- private _getMeshes;
- private _getTransformNodes;
- private _getSkeletons;
- private _getAnimationGroups;
- private _startAnimations;
- /**
- * Loads a glTF node.
- * @param context The context when loading the asset
- * @param node The glTF node property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon mesh when the load is complete
- */
- loadNodeAsync(context: string, node: INode, assign?: (babylonTransformNode: TransformNode) => void): Promise<TransformNode>;
- private _loadMeshAsync;
- /**
- * @hidden Define this method to modify the default behavior when loading data for mesh primitives.
- * @param context The context when loading the asset
- * @param name The mesh name when loading the asset
- * @param node The glTF node when loading the asset
- * @param mesh The glTF mesh when loading the asset
- * @param primitive The glTF mesh primitive property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled
- */
- _loadMeshPrimitiveAsync(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Promise<AbstractMesh>;
- private _loadVertexDataAsync;
- private _createMorphTargets;
- private _loadMorphTargetsAsync;
- private _loadMorphTargetVertexDataAsync;
- private static _LoadTransform;
- private _loadSkinAsync;
- private _loadBones;
- private _loadBone;
- private _loadSkinInverseBindMatricesDataAsync;
- private _updateBoneMatrices;
- private _getNodeMatrix;
- /**
- * Loads a glTF camera.
- * @param context The context when loading the asset
- * @param camera The glTF camera property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon camera when the load is complete
- */
- loadCameraAsync(context: string, camera: ICamera, assign?: (babylonCamera: Camera) => void): Promise<Camera>;
- private _loadAnimationsAsync;
- /**
- * Loads a glTF animation.
- * @param context The context when loading the asset
- * @param animation The glTF animation property
- * @returns A promise that resolves with the loaded Babylon animation group when the load is complete
- */
- loadAnimationAsync(context: string, animation: IAnimation): Promise<AnimationGroup>;
- /**
- * @hidden Loads a glTF animation channel.
- * @param context The context when loading the asset
- * @param animationContext The context of the animation when loading the asset
- * @param animation The glTF animation property
- * @param channel The glTF animation channel property
- * @param babylonAnimationGroup The babylon animation group property
- * @param animationTargetOverride The babylon animation channel target override property. My be null.
- * @returns A void promise when the channel load is complete
- */
- _loadAnimationChannelAsync(context: string, animationContext: string, animation: IAnimation, channel: IAnimationChannel, babylonAnimationGroup: AnimationGroup, animationTargetOverride?: Nullable<IAnimatable>): Promise<void>;
- private _loadAnimationSamplerAsync;
- private _loadBufferAsync;
- /**
- * Loads a glTF buffer view.
- * @param context The context when loading the asset
- * @param bufferView The glTF buffer view property
- * @returns A promise that resolves with the loaded data when the load is complete
- */
- loadBufferViewAsync(context: string, bufferView: IBufferView): Promise<ArrayBufferView>;
- private _loadAccessorAsync;
- /** @hidden */
- _loadFloatAccessorAsync(context: string, accessor: IAccessor): Promise<Float32Array>;
- private _loadIndicesAccessorAsync;
- private _loadVertexBufferViewAsync;
- private _loadVertexAccessorAsync;
- private _loadMaterialMetallicRoughnessPropertiesAsync;
- /** @hidden */
- _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign?: (babylonMaterial: Material) => void): Promise<Material>;
- private _createDefaultMaterial;
- /**
- * Creates a Babylon material from a glTF material.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonDrawMode The draw mode for the Babylon material
- * @returns The Babylon material
- */
- createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Material;
- /**
- * Loads properties from a glTF material into a Babylon material.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonMaterial The Babylon material
- * @returns A promise that resolves when the load is complete
- */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
- /**
- * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonMaterial The Babylon material
- * @returns A promise that resolves when the load is complete
- */
- loadMaterialBasePropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<void>;
- /**
- * Loads the alpha properties from a glTF material into a Babylon material.
- * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.
- * @param context The context when loading the asset
- * @param material The glTF material property
- * @param babylonMaterial The Babylon material
- */
- loadMaterialAlphaProperties(context: string, material: IMaterial, babylonMaterial: Material): void;
- /**
- * Loads a glTF texture info.
- * @param context The context when loading the asset
- * @param textureInfo The glTF texture info property
- * @param assign A function called synchronously after parsing the glTF properties
- * @returns A promise that resolves with the loaded Babylon texture when the load is complete
- */
- loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
- /** @hidden */
- _loadTextureAsync(context: string, texture: ITexture, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
- /** @hidden */
- _createTextureAsync(context: string, sampler: ISampler, image: IImage, assign?: (babylonTexture: BaseTexture) => void): Promise<BaseTexture>;
- private _loadSampler;
- /**
- * Loads a glTF image.
- * @param context The context when loading the asset
- * @param image The glTF image property
- * @returns A promise that resolves with the loaded data when the load is complete
- */
- loadImageAsync(context: string, image: IImage): Promise<ArrayBufferView>;
- /**
- * Loads a glTF uri.
- * @param context The context when loading the asset
- * @param property The glTF property associated with the uri
- * @param uri The base64 or relative uri
- * @returns A promise that resolves with the loaded data when the load is complete
- */
- loadUriAsync(context: string, property: IProperty, uri: string): Promise<ArrayBufferView>;
- /**
- * Adds a JSON pointer to the metadata of the Babylon object at `<object>.metadata.gltf.pointers`.
- * @param babylonObject the Babylon object with metadata
- * @param pointer the JSON pointer
- */
- static AddPointerMetadata(babylonObject: {
- metadata: any;
- }, pointer: string): void;
- private static _GetTextureWrapMode;
- private static _GetTextureSamplingMode;
- private static _GetTypedArrayConstructor;
- private static _GetTypedArray;
- private static _GetNumComponents;
- private static _ValidateUri;
- /** @hidden */
- static _GetDrawMode(context: string, mode: number | undefined): number;
- private _compileMaterialsAsync;
- private _compileShadowGeneratorsAsync;
- private _forEachExtensions;
- private _applyExtensions;
- private _extensionsOnLoading;
- private _extensionsOnReady;
- private _extensionsLoadSceneAsync;
- private _extensionsLoadNodeAsync;
- private _extensionsLoadCameraAsync;
- private _extensionsLoadVertexDataAsync;
- private _extensionsLoadMeshPrimitiveAsync;
- private _extensionsLoadMaterialAsync;
- private _extensionsCreateMaterial;
- private _extensionsLoadMaterialPropertiesAsync;
- private _extensionsLoadTextureInfoAsync;
- private _extensionsLoadTextureAsync;
- private _extensionsLoadAnimationAsync;
- private _extensionsLoadSkinAsync;
- private _extensionsLoadUriAsync;
- private _extensionsLoadBufferViewAsync;
- private _extensionsLoadBufferAsync;
- /**
- * Helper method called by a loader extension to load an glTF extension.
- * @param context The context when loading the asset
- * @param property The glTF property to load the extension from
- * @param extensionName The name of the extension to load
- * @param actionAsync The action to run
- * @returns The promise returned by actionAsync or null if the extension does not exist
- */
- static LoadExtensionAsync<TExtension = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
- /**
- * Helper method called by a loader extension to load a glTF extra.
- * @param context The context when loading the asset
- * @param property The glTF property to load the extra from
- * @param extensionName The name of the extension to load
- * @param actionAsync The action to run
- * @returns The promise returned by actionAsync or null if the extra does not exist
- */
- static LoadExtraAsync<TExtra = any, TResult = void>(context: string, property: IProperty, extensionName: string, actionAsync: (extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>): Nullable<Promise<TResult>>;
- /**
- * Checks for presence of an extension.
- * @param name The name of the extension to check
- * @returns A boolean indicating the presence of the given extension name in `extensionsUsed`
- */
- isExtensionUsed(name: string): boolean;
- /**
- * Increments the indentation level and logs a message.
- * @param message The message to log
- */
- logOpen(message: string): void;
- /**
- * Decrements the indentation level.
- */
- logClose(): void;
- /**
- * Logs a message
- * @param message The message to log
- */
- log(message: string): void;
- /**
- * Starts a performance counter.
- * @param counterName The name of the performance counter
- */
- startPerformanceCounter(counterName: string): void;
- /**
- * Ends a performance counter.
- * @param counterName The name of the performance counter
- */
- endPerformanceCounter(counterName: string): void;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /** @hidden */
- interface IEXTLightsImageBased_LightImageBased {
- _babylonTexture?: BaseTexture;
- _loaded?: Promise<void>;
- }
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md)
- */
- export class EXT_lights_image_based implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- private _lights?;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- onLoading(): void;
- /** @hidden */
- loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
- private _loadLightAsync;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1691)
- * [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class EXT_mesh_gpu_instancing implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_texture_webp/)
- */
- export class EXT_texture_webp implements IGLTFLoaderExtension {
- /** The name of this extension. */
- readonly name: string;
- /** Defines whether this extension is enabled. */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
- */
- export class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * The draco compression used to decode vertex data or DracoCompression.Default if not defined
- */
- dracoCompression?: DracoCompression;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)
- */
- export class KHR_lights implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- private _lights?;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- onLoading(): void;
- /** @hidden */
- loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
- */
- export class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadSpecularGlossinessPropertiesAsync;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
- */
- export class KHR_materials_unlit implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadUnlitPropertiesAsync;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1677)
- * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_clearcoat implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadClearCoatPropertiesAsync;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1688)
- * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_sheen implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadSheenPropertiesAsync;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1719)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_specular implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadSpecularPropertiesAsync;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1718)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_ior implements IGLTFLoaderExtension {
- /**
- * Default ior Value from the spec.
- */
- private static readonly _DEFAULT_IOR;
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadIorPropertiesAsync;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1681)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_variants implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /**
- * Gets the list of available variant names for this asset.
- * @param rootMesh The glTF root mesh
- * @returns the list of all the variant names for this model
- */
- static GetAvailableVariants(rootMesh: Mesh): string[];
- /**
- * Gets the list of available variant names for this asset.
- * @param rootMesh The glTF root mesh
- * @returns the list of all the variant names for this model
- */
- getAvailableVariants(rootMesh: Mesh): string[];
- /**
- * Select a variant given a variant name or a list of variant names.
- * @param rootMesh The glTF root mesh
- * @param variantName The variant name(s) to select.
- */
- static SelectVariant(rootMesh: Mesh, variantName: string | string[]): void;
- /**
- * Select a variant given a variant name or a list of variant names.
- * @param rootMesh The glTF root mesh
- * @param variantName The variant name(s) to select.
- */
- selectVariant(rootMesh: Mesh, variantName: string | string[]): void;
- /**
- * Reset back to the original before selecting a variant.
- * @param rootMesh The glTF root mesh
- */
- static Reset(rootMesh: Mesh): void;
- /**
- * Reset back to the original before selecting a variant.
- * @param rootMesh The glTF root mesh
- */
- reset(rootMesh: Mesh): void;
- /**
- * Gets the last selected variant name(s) or null if original.
- * @param rootMesh The glTF root mesh
- * @returns The selected variant name(s).
- */
- static GetLastSelectedVariant(rootMesh: Mesh): Nullable<string | string[]>;
- /**
- * Gets the last selected variant name(s) or null if original.
- * @param rootMesh The glTF root mesh
- * @returns The selected variant name(s).
- */
- getLastSelectedVariant(rootMesh: Mesh): Nullable<string | string[]>;
- private static _GetExtensionMetadata;
- /** @hidden */
- _loadMeshPrimitiveAsync(context: string, name: string, node: INode, mesh: IMesh, primitive: IMeshPrimitive, assign: (babylonMesh: AbstractMesh) => void): Nullable<Promise<AbstractMesh>>;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1698)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_materials_transmission implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- private _loadTransparentPropertiesAsync;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization)
- */
- export class KHR_mesh_quantization implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1751)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_texture_basisu implements IGLTFLoaderExtension {
- /** The name of this extension. */
- readonly name: string;
- /** Defines whether this extension is enabled. */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform)
- */
- export class KHR_texture_transform implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>>;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1553)
- * !!! Experimental Extension Subject to Changes !!!
- */
- export class KHR_xmp implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- private _loader;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /**
- * Called after the loader state changes to LOADING.
- */
- onLoading(): void;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
- */
- export class MSFT_audio_emitter implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- private _clips;
- private _emitters;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- onLoading(): void;
- /** @hidden */
- loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
- /** @hidden */
- loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
- /** @hidden */
- loadAnimationAsync(context: string, animation: IAnimation): Nullable<Promise<AnimationGroup>>;
- private _loadClipAsync;
- private _loadEmitterAsync;
- private _getEventAction;
- private _loadAnimationEventAsync;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
- */
- export class MSFT_lod implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- /**
- * Defines a number that determines the order the extensions are applied.
- */
- order: number;
- /**
- * Maximum number of LODs to load, starting from the lowest LOD.
- */
- maxLODsToLoad: number;
- /**
- * Observable raised when all node LODs of one level are loaded.
- * The event data is the index of the loaded LOD starting from zero.
- * Dispose the loader to cancel the loading of the next level of LODs.
- */
- onNodeLODsLoadedObservable: Observable<number>;
- /**
- * Observable raised when all material LODs of one level are loaded.
- * The event data is the index of the loaded LOD starting from zero.
- * Dispose the loader to cancel the loading of the next level of LODs.
- */
- onMaterialLODsLoadedObservable: Observable<number>;
- private _loader;
- private _bufferLODs;
- private _nodeIndexLOD;
- private _nodeSignalLODs;
- private _nodePromiseLODs;
- private _nodeBufferLODs;
- private _materialIndexLOD;
- private _materialSignalLODs;
- private _materialPromiseLODs;
- private _materialBufferLODs;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- onReady(): void;
- /** @hidden */
- loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
- /** @hidden */
- loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
- /** @hidden */
- _loadMaterialAsync(context: string, material: IMaterial, babylonMesh: Nullable<Mesh>, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Nullable<Promise<Material>>;
- /** @hidden */
- _loadUriAsync(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>>;
- /** @hidden */
- loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>>;
- private _loadBufferLOD;
- /**
- * Gets an array of LOD properties from lowest to highest.
- */
- private _getLODs;
- private _disposeTransformNode;
- private _disposeMaterials;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /** @hidden */
- export class MSFT_minecraftMesh implements IGLTFLoaderExtension {
- readonly name: string;
- enabled: boolean;
- private _loader;
- constructor(loader: GLTFLoader);
- dispose(): void;
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /** @hidden */
- export class MSFT_sRGBFactors implements IGLTFLoaderExtension {
- readonly name: string;
- enabled: boolean;
- private _loader;
- constructor(loader: GLTFLoader);
- dispose(): void;
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
- }
- }
- declare module BABYLON.GLTF2.Loader.Extensions {
- /**
- * Store glTF extras (if present) in BJS objects' metadata
- */
- export class ExtrasAsMetadata implements IGLTFLoaderExtension {
- /**
- * The name of this extension.
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled.
- */
- enabled: boolean;
- private _loader;
- private _assignExtras;
- /** @hidden */
- constructor(loader: GLTFLoader);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
- /** @hidden */
- loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
- /** @hidden */
- createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
- }
- }
- declare module BABYLON {
- /**
- * Class reading and parsing the MTL file bundled with the obj file.
- */
- export class MTLFileLoader {
- /**
- * Invert Y-Axis of referenced textures on load
- */
- static INVERT_TEXTURE_Y: boolean;
- /**
- * All material loaded from the mtl will be set here
- */
- materials: StandardMaterial[];
- /**
- * This function will read the mtl file and create each material described inside
- * This function could be improve by adding :
- * -some component missing (Ni, Tf...)
- * -including the specific options available
- *
- * @param scene defines the scene the material will be created in
- * @param data defines the mtl data to parse
- * @param rootUrl defines the rooturl to use in order to load relative dependencies
- * @param forAssetContainer defines if the material should be registered in the scene
- */
- parseMTL(scene: Scene, data: string | ArrayBuffer, rootUrl: string, forAssetContainer: boolean): void;
- /**
- * Gets the texture for the material.
- *
- * If the material is imported from input file,
- * We sanitize the url to ensure it takes the textre from aside the material.
- *
- * @param rootUrl The root url to load from
- * @param value The value stored in the mtl
- * @return The Texture
- */
- private static _getTexture;
- }
- }
- declare module BABYLON {
- /**
- * Options for loading OBJ/MTL files
- */
- type MeshLoadOptions = {
- /**
- * Defines if UVs are optimized by default during load.
- */
- OptimizeWithUV: boolean;
- /**
- * Defines custom scaling of UV coordinates of loaded meshes.
- */
- UVScaling: Vector2;
- /**
- * Invert model on y-axis (does a model scaling inversion)
- */
- InvertY: boolean;
- /**
- * Invert Y-Axis of referenced textures on load
- */
- InvertTextureY: boolean;
- /**
- * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
- */
- ImportVertexColors: boolean;
- /**
- * Compute the normals for the model, even if normals are present in the file.
- */
- ComputeNormals: boolean;
- /**
- * Skip loading the materials even if defined in the OBJ file (materials are ignored).
- */
- SkipMaterials: boolean;
- /**
- * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
- */
- MaterialLoadingFailsSilently: boolean;
- };
- /**
- * OBJ file type loader.
- * This is a babylon scene loader plugin.
- */
- export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
- /**
- * Defines if UVs are optimized by default during load.
- */
- static OPTIMIZE_WITH_UV: boolean;
- /**
- * Invert model on y-axis (does a model scaling inversion)
- */
- static INVERT_Y: boolean;
- /**
- * Invert Y-Axis of referenced textures on load
- */
- static get INVERT_TEXTURE_Y(): boolean;
- static set INVERT_TEXTURE_Y(value: boolean);
- /**
- * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
- */
- static IMPORT_VERTEX_COLORS: boolean;
- /**
- * Compute the normals for the model, even if normals are present in the file.
- */
- static COMPUTE_NORMALS: boolean;
- /**
- * Defines custom scaling of UV coordinates of loaded meshes.
- */
- static UV_SCALING: Vector2;
- /**
- * Skip loading the materials even if defined in the OBJ file (materials are ignored).
- */
- static SKIP_MATERIALS: boolean;
- /**
- * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
- *
- * Defaults to true for backwards compatibility.
- */
- static MATERIAL_LOADING_FAILS_SILENTLY: boolean;
- /**
- * Defines the name of the plugin.
- */
- name: string;
- /**
- * Defines the extension the plugin is able to load.
- */
- extensions: string;
- /** @hidden */
- obj: RegExp;
- /** @hidden */
- group: RegExp;
- /** @hidden */
- mtllib: RegExp;
- /** @hidden */
- usemtl: RegExp;
- /** @hidden */
- smooth: RegExp;
- /** @hidden */
- vertexPattern: RegExp;
- /** @hidden */
- normalPattern: RegExp;
- /** @hidden */
- uvPattern: RegExp;
- /** @hidden */
- facePattern1: RegExp;
- /** @hidden */
- facePattern2: RegExp;
- /** @hidden */
- facePattern3: RegExp;
- /** @hidden */
- facePattern4: RegExp;
- /** @hidden */
- facePattern5: RegExp;
- private _forAssetContainer;
- private _meshLoadOptions;
- /**
- * Creates loader for .OBJ files
- *
- * @param meshLoadOptions options for loading and parsing OBJ/MTL files.
- */
- constructor(meshLoadOptions?: MeshLoadOptions);
- private static get currentMeshLoadOptions();
- /**
- * Calls synchronously the MTL file attached to this obj.
- * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.
- * Without this function materials are not displayed in the first frame (but displayed after).
- * In consequence it is impossible to get material information in your HTML file
- *
- * @param url The URL of the MTL file
- * @param rootUrl
- * @param onSuccess Callback function to be called when the MTL file is loaded
- * @private
- */
- private _loadMTL;
- /**
- * Instantiates a OBJ file loader plugin.
- * @returns the created plugin
- */
- createPlugin(): ISceneLoaderPluginAsync | ISceneLoaderPlugin;
- /**
- * If the data string can be loaded directly.
- *
- * @param data string containing the file data
- * @returns if the data can be loaded directly
- */
- canDirectLoad(data: string): boolean;
- /**
- * Imports one or more meshes from the loaded OBJ data and adds them to the scene
- * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
- * @param scene the scene the meshes should be added to
- * @param data the OBJ data to load
- * @param rootUrl root url to load from
- * @param onProgress event that fires when loading progress has occured
- * @param fileName Defines the name of the file to load
- * @returns a promise containg the loaded meshes, particles, skeletons and animations
- */
- importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<{
- meshes: AbstractMesh[];
- particleSystems: IParticleSystem[];
- skeletons: Skeleton[];
- animationGroups: AnimationGroup[];
- }>;
- /**
- * Imports all objects from the loaded OBJ data and adds them to the scene
- * @param scene the scene the objects should be added to
- * @param data the OBJ data to load
- * @param rootUrl root url to load from
- * @param onProgress event that fires when loading progress has occured
- * @param fileName Defines the name of the file to load
- * @returns a promise which completes when objects have been loaded to the scene
- */
- loadAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
- /**
- * Load into an asset container.
- * @param scene The scene to load into
- * @param data The data to import
- * @param rootUrl The root url for scene and resources
- * @param onProgress The callback when the load progresses
- * @param fileName Defines the name of the file to load
- * @returns The loaded asset container
- */
- loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
- /**
- * Read the OBJ file and create an Array of meshes.
- * Each mesh contains all information given by the OBJ and the MTL file.
- * i.e. vertices positions and indices, optional normals values, optional UV values, optional material
- *
- * @param meshesNames
- * @param scene Scene The scene where are displayed the data
- * @param data String The content of the obj file
- * @param rootUrl String The path to the folder
- * @returns Array<AbstractMesh>
- * @private
- */
- private _parseSolid;
- }
- }
- declare module BABYLON {
- /**
- * STL file type loader.
- * This is a babylon scene loader plugin.
- */
- export class STLFileLoader implements ISceneLoaderPlugin {
- /** @hidden */
- solidPattern: RegExp;
- /** @hidden */
- facetsPattern: RegExp;
- /** @hidden */
- normalPattern: RegExp;
- /** @hidden */
- vertexPattern: RegExp;
- /**
- * Defines the name of the plugin.
- */
- name: string;
- /**
- * Defines the extensions the stl loader is able to load.
- * force data to come in as an ArrayBuffer
- * we'll convert to string if it looks like it's an ASCII .stl
- */
- extensions: ISceneLoaderPluginExtensions;
- /**
- * Import meshes into a scene.
- * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
- * @param scene The scene to import into
- * @param data The data to import
- * @param rootUrl The root url for scene and resources
- * @param meshes The meshes array to import into
- * @param particleSystems The particle systems array to import into
- * @param skeletons The skeletons array to import into
- * @param onError The callback when import fails
- * @returns True if successful or false otherwise
- */
- importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<IParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
- /**
- * Load into a scene.
- * @param scene The scene to load into
- * @param data The data to import
- * @param rootUrl The root url for scene and resources
- * @param onError The callback when import fails
- * @returns true if successful or false otherwise
- */
- load(scene: Scene, data: any, rootUrl: string): boolean;
- /**
- * Load into an asset container.
- * @param scene The scene to load into
- * @param data The data to import
- * @param rootUrl The root url for scene and resources
- * @param onError The callback when import fails
- * @returns The loaded asset container
- */
- loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
- private _isBinary;
- private _parseBinary;
- private _parseASCII;
- }
- }
|