babylon.d.txt 847 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761
  1. declare module 'babylonjs' {
  2. export = BABYLON;
  3. }
  4. interface Window {
  5. mozIndexedDB(func: any): any;
  6. webkitIndexedDB(func: any): any;
  7. msIndexedDB: IDBFactory;
  8. IDBTransaction(func: any): any;
  9. webkitIDBTransaction(func: any): any;
  10. msIDBTransaction(func: any): any;
  11. IDBKeyRange(func: any): any;
  12. webkitIDBKeyRange(func: any): any;
  13. msIDBKeyRange(func: any): any;
  14. webkitURL: HTMLURL;
  15. webkitRequestAnimationFrame(func: any): any;
  16. mozRequestAnimationFrame(func: any): any;
  17. oRequestAnimationFrame(func: any): any;
  18. WebGLRenderingContext: WebGLRenderingContext;
  19. MSGesture: MSGesture;
  20. CANNON: any;
  21. SIMD: any;
  22. AudioContext: AudioContext;
  23. webkitAudioContext: AudioContext;
  24. PointerEvent: any;
  25. Math: Math;
  26. Uint8Array: Uint8ArrayConstructor;
  27. Float32Array: Float32ArrayConstructor;
  28. mozURL: any;
  29. msURL: any;
  30. VRFrameData: any;
  31. }
  32. interface WebGLRenderingContext {
  33. drawArraysInstanced(mode: number, first: number, count: number, primcount: number): void;
  34. drawElementsInstanced(mode: number, count: number, type: number, offset: number, primcount: number): void;
  35. vertexAttribDivisor(index: number, divisor: number): void;
  36. createVertexArray(): any;
  37. bindVertexArray(vao?: WebGLVertexArrayObject | null): void;
  38. deleteVertexArray(vao: WebGLVertexArrayObject): void;
  39. blitFramebuffer(srcX0: number, srcY0: number, srcX1: number, srcY1: number, dstX0: number, dstY0: number, dstX1: number, dstY1: number, mask: number, filter: number): void;
  40. renderbufferStorageMultisample(target: number, samples: number, internalformat: number, width: number, height: number): void;
  41. bindBufferBase(target: number, index: number, buffer: WebGLBuffer | null): void;
  42. getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string): number;
  43. uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: number, uniformBlockBinding: number): void;
  44. createQuery(): WebGLQuery;
  45. deleteQuery(query: WebGLQuery): void;
  46. beginQuery(target: number, query: WebGLQuery): void;
  47. endQuery(target: number): void;
  48. getQueryParameter(query: WebGLQuery, pname: number): any;
  49. getQuery(target: number, pname: number): any;
  50. MAX_SAMPLES: number;
  51. RGBA8: number;
  52. READ_FRAMEBUFFER: number;
  53. DRAW_FRAMEBUFFER: number;
  54. UNIFORM_BUFFER: number;
  55. HALF_FLOAT_OES: number;
  56. RGBA16F: number;
  57. RGBA32F: number;
  58. DEPTH24_STENCIL8: number;
  59. drawBuffers(buffers: number[]): void;
  60. readBuffer(src: number): void;
  61. readonly COLOR_ATTACHMENT0: number;
  62. readonly COLOR_ATTACHMENT1: number;
  63. readonly COLOR_ATTACHMENT2: number;
  64. readonly COLOR_ATTACHMENT3: number;
  65. ANY_SAMPLES_PASSED_CONSERVATIVE: number;
  66. ANY_SAMPLES_PASSED: number;
  67. QUERY_RESULT_AVAILABLE: number;
  68. QUERY_RESULT: number;
  69. }
  70. interface HTMLURL {
  71. createObjectURL(param1: any, param2?: any): string;
  72. }
  73. interface Document {
  74. exitFullscreen(): void;
  75. webkitCancelFullScreen(): void;
  76. mozCancelFullScreen(): void;
  77. msCancelFullScreen(): void;
  78. mozFullScreen: boolean;
  79. msIsFullScreen: boolean;
  80. fullscreen: boolean;
  81. mozPointerLockElement: HTMLElement;
  82. msPointerLockElement: HTMLElement;
  83. webkitPointerLockElement: HTMLElement;
  84. }
  85. interface HTMLCanvasElement {
  86. requestPointerLock(): void;
  87. msRequestPointerLock?(): void;
  88. mozRequestPointerLock?(): void;
  89. webkitRequestPointerLock?(): void;
  90. }
  91. interface CanvasRenderingContext2D {
  92. imageSmoothingEnabled: boolean;
  93. mozImageSmoothingEnabled: boolean;
  94. oImageSmoothingEnabled: boolean;
  95. webkitImageSmoothingEnabled: boolean;
  96. msImageSmoothingEnabled: boolean;
  97. }
  98. interface WebGLBuffer {
  99. references: number;
  100. capacity: number;
  101. is32Bits: boolean;
  102. }
  103. interface WebGLProgram {
  104. transformFeedback?: WebGLTransformFeedback | null;
  105. }
  106. interface MouseEvent {
  107. mozMovementX: number;
  108. mozMovementY: number;
  109. webkitMovementX: number;
  110. webkitMovementY: number;
  111. msMovementX: number;
  112. msMovementY: number;
  113. }
  114. interface MSStyleCSSProperties {
  115. webkitTransform: string;
  116. webkitTransition: string;
  117. }
  118. interface Navigator {
  119. getVRDisplays: () => any;
  120. mozGetVRDevices: (any: any) => any;
  121. getUserMedia: any;
  122. webkitGetUserMedia: any;
  123. mozGetUserMedia: any;
  124. msGetUserMedia: any;
  125. getGamepads(func?: any): any;
  126. webkitGetGamepads(func?: any): any;
  127. msGetGamepads(func?: any): any;
  128. webkitGamepads(func?: any): any;
  129. }
  130. interface HTMLVideoElement {
  131. mozSrcObject: any;
  132. }
  133. interface Screen {
  134. orientation: string;
  135. mozOrientation: string;
  136. }
  137. interface HTMLMediaElement {
  138. crossOrigin: string | null;
  139. }
  140. interface Math {
  141. fround(x: number): number;
  142. imul(a: number, b: number): number;
  143. }
  144. interface SIMDglobal {
  145. SIMD: SIMD;
  146. Math: Math;
  147. Uint8Array: Uint8ArrayConstructor;
  148. Float32Array: Float32ArrayConstructor;
  149. }
  150. interface SIMD {
  151. Float32x4: SIMD.Float32x4Constructor;
  152. Int32x4: SIMD.Int32x4Constructor;
  153. Int16x8: SIMD.Int16x8Constructor;
  154. Int8x16: SIMD.Int8x16Constructor;
  155. Uint32x4: SIMD.Uint32x4Constructor;
  156. Uint16x8: SIMD.Uint16x8Constructor;
  157. Uint8x16: SIMD.Uint8x16Constructor;
  158. Bool32x4: SIMD.Bool32x4Constructor;
  159. Bool16x8: SIMD.Bool16x8Constructor;
  160. Bool8x16: SIMD.Bool8x16Constructor;
  161. }
  162. interface GamepadPose {
  163. hasOrientation: boolean;
  164. hasPosition: boolean;
  165. position?: Float32Array;
  166. linearVelocity?: Float32Array;
  167. linearAcceleration?: Float32Array;
  168. orientation?: Float32Array;
  169. angularVelocity?: Float32Array;
  170. angularAcceleration?: Float32Array;
  171. }
  172. declare namespace SIMD {
  173. interface Float32x4 {
  174. constructor: Float32x4Constructor;
  175. valueOf(): Float32x4;
  176. toLocaleString(): string;
  177. toString(): string;
  178. }
  179. interface Float32x4Constructor {
  180. (s0?: number, s1?: number, s2?: number, s3?: number): Float32x4;
  181. prototype: Float32x4;
  182. extractLane(simd: SIMD.Float32x4, lane: number): number;
  183. swizzle(a: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  184. shuffle(a: SIMD.Float32x4, b: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  185. check(a: SIMD.Float32x4): SIMD.Float32x4;
  186. splat(n: number): SIMD.Float32x4;
  187. replaceLane(simd: SIMD.Float32x4, lane: number, value: number): SIMD.Float32x4;
  188. select(selector: SIMD.Bool32x4, a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  189. equal(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  190. notEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  191. lessThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  192. lessThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  193. greaterThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  194. greaterThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  195. add(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  196. sub(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  197. mul(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  198. div(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  199. neg(a: SIMD.Float32x4): SIMD.Float32x4;
  200. abs(a: SIMD.Float32x4): SIMD.Float32x4;
  201. min(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  202. max(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  203. minNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  204. maxNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  205. reciprocalApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  206. reciprocalSqrtApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  207. sqrt(a: SIMD.Float32x4): SIMD.Float32x4;
  208. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  209. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  210. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  211. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  212. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  213. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  214. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  215. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  216. fromInt32x4(value: SIMD.Int32x4): SIMD.Float32x4;
  217. fromUint32x4(value: SIMD.Uint32x4): SIMD.Float32x4;
  218. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Float32x4;
  219. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Float32x4;
  220. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Float32x4;
  221. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Float32x4;
  222. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Float32x4;
  223. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Float32x4;
  224. }
  225. interface Int32x4 {
  226. constructor: Int32x4Constructor;
  227. valueOf(): Int32x4;
  228. toLocaleString(): string;
  229. toString(): string;
  230. }
  231. interface Int32x4Constructor {
  232. (s0?: number, s1?: number, s2?: number, s3?: number): Int32x4;
  233. prototype: Int32x4;
  234. extractLane(simd: SIMD.Int32x4, lane: number): number;
  235. swizzle(a: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  236. shuffle(a: SIMD.Int32x4, b: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  237. check(a: SIMD.Int32x4): SIMD.Int32x4;
  238. splat(n: number): SIMD.Int32x4;
  239. replaceLane(simd: SIMD.Int32x4, lane: number, value: number): SIMD.Int32x4;
  240. select(selector: SIMD.Bool32x4, a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  241. equal(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  242. notEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  243. lessThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  244. lessThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  245. greaterThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  246. greaterThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  247. and(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  248. or(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  249. xor(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  250. not(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  251. add(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  252. sub(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  253. mul(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  254. neg(a: SIMD.Int32x4): SIMD.Int32x4;
  255. shiftLeftByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  256. shiftRightByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  257. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  258. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  259. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  260. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  261. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  262. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  263. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  264. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  265. fromFloat32x4(value: SIMD.Float32x4): SIMD.Int32x4;
  266. fromUint32x4(value: SIMD.Uint32x4): SIMD.Int32x4;
  267. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int32x4;
  268. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int32x4;
  269. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int32x4;
  270. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int32x4;
  271. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int32x4;
  272. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int32x4;
  273. }
  274. interface Int16x8 {
  275. constructor: Int16x8Constructor;
  276. valueOf(): Int16x8;
  277. toLocaleString(): string;
  278. toString(): string;
  279. }
  280. interface Int16x8Constructor {
  281. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Int16x8;
  282. prototype: Int16x8;
  283. extractLane(simd: SIMD.Int16x8, lane: number): number;
  284. swizzle(a: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  285. shuffle(a: SIMD.Int16x8, b: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  286. check(a: SIMD.Int16x8): SIMD.Int16x8;
  287. splat(n: number): SIMD.Int16x8;
  288. replaceLane(simd: SIMD.Int16x8, lane: number, value: number): SIMD.Int16x8;
  289. select(selector: SIMD.Bool16x8, a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  290. equal(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  291. notEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  292. lessThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  293. lessThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  294. greaterThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  295. greaterThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  296. and(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  297. or(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  298. xor(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  299. not(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  300. add(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  301. sub(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  302. mul(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  303. neg(a: SIMD.Int16x8): SIMD.Int16x8;
  304. shiftLeftByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  305. shiftRightByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  306. addSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  307. subSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  308. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int16x8;
  309. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int16x8): SIMD.Int16x8;
  310. fromUint16x8(value: SIMD.Uint16x8): SIMD.Int16x8;
  311. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int16x8;
  312. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int16x8;
  313. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int16x8;
  314. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int16x8;
  315. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int16x8;
  316. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int16x8;
  317. }
  318. interface Int8x16 {
  319. constructor: Int8x16Constructor;
  320. valueOf(): Int8x16;
  321. toLocaleString(): string;
  322. toString(): string;
  323. }
  324. interface Int8x16Constructor {
  325. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number, s8?: number, s9?: number, s10?: number, s11?: number, s12?: number, s13?: number, s14?: number, s15?: number): Int8x16;
  326. prototype: Int8x16;
  327. extractLane(simd: SIMD.Int8x16, lane: number): number;
  328. swizzle(a: SIMD.Int8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Int8x16;
  329. shuffle(a: SIMD.Int8x16, b: SIMD.Int8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Int8x16;
  330. check(a: SIMD.Int8x16): SIMD.Int8x16;
  331. splat(n: number): SIMD.Int8x16;
  332. replaceLane(simd: SIMD.Int8x16, lane: number, value: number): SIMD.Int8x16;
  333. select(selector: SIMD.Bool8x16, a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  334. equal(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  335. notEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  336. lessThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  337. lessThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  338. greaterThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  339. greaterThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  340. and(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  341. or(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  342. xor(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  343. not(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  344. add(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  345. sub(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  346. mul(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  347. neg(a: SIMD.Int8x16): SIMD.Int8x16;
  348. shiftLeftByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  349. shiftRightByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  350. addSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  351. subSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  352. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int8x16;
  353. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int8x16): SIMD.Int8x16;
  354. fromUint8x16(value: SIMD.Uint8x16): SIMD.Int8x16;
  355. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int8x16;
  356. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int8x16;
  357. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int8x16;
  358. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int8x16;
  359. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int8x16;
  360. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int8x16;
  361. }
  362. interface Uint32x4 {
  363. constructor: Uint32x4Constructor;
  364. valueOf(): Uint32x4;
  365. toLocaleString(): string;
  366. toString(): string;
  367. }
  368. interface Uint32x4Constructor {
  369. (s0?: number, s1?: number, s2?: number, s3?: number): Uint32x4;
  370. prototype: Uint32x4;
  371. extractLane(simd: SIMD.Uint32x4, lane: number): number;
  372. swizzle(a: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  373. shuffle(a: SIMD.Uint32x4, b: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  374. check(a: SIMD.Uint32x4): SIMD.Uint32x4;
  375. splat(n: number): SIMD.Uint32x4;
  376. replaceLane(simd: SIMD.Uint32x4, lane: number, value: number): SIMD.Uint32x4;
  377. select(selector: SIMD.Bool32x4, a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  378. equal(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  379. notEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  380. lessThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  381. lessThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  382. greaterThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  383. greaterThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  384. and(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  385. or(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  386. xor(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  387. not(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  388. add(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  389. sub(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  390. mul(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  391. shiftLeftByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  392. shiftRightByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  393. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  394. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  395. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  396. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  397. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  398. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  399. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  400. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  401. fromFloat32x4(value: SIMD.Float32x4): SIMD.Uint32x4;
  402. fromInt32x4(value: SIMD.Int32x4): SIMD.Uint32x4;
  403. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint32x4;
  404. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint32x4;
  405. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint32x4;
  406. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint32x4;
  407. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint32x4;
  408. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint32x4;
  409. }
  410. interface Uint16x8 {
  411. constructor: Uint16x8Constructor;
  412. valueOf(): Uint16x8;
  413. toLocaleString(): string;
  414. toString(): string;
  415. }
  416. interface Uint16x8Constructor {
  417. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Uint16x8;
  418. prototype: Uint16x8;
  419. extractLane(simd: SIMD.Uint16x8, lane: number): number;
  420. swizzle(a: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  421. shuffle(a: SIMD.Uint16x8, b: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  422. check(a: SIMD.Uint16x8): SIMD.Uint16x8;
  423. splat(n: number): SIMD.Uint16x8;
  424. replaceLane(simd: SIMD.Uint16x8, lane: number, value: number): SIMD.Uint16x8;
  425. select(selector: SIMD.Bool16x8, a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  426. equal(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  427. notEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  428. lessThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  429. lessThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  430. greaterThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  431. greaterThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  432. and(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  433. or(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  434. xor(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  435. not(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  436. add(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  437. sub(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  438. mul(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  439. shiftLeftByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  440. shiftRightByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  441. addSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  442. subSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  443. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint16x8;
  444. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint16x8): SIMD.Uint16x8;
  445. fromInt16x8(value: SIMD.Int16x8): SIMD.Uint16x8;
  446. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint16x8;
  447. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint16x8;
  448. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint16x8;
  449. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint16x8;
  450. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint16x8;
  451. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint16x8;
  452. }
  453. interface Uint8x16 {
  454. constructor: Uint8x16Constructor;
  455. valueOf(): Uint8x16;
  456. toLocaleString(): string;
  457. toString(): string;
  458. }
  459. interface Uint8x16Constructor {
  460. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number, s8?: number, s9?: number, s10?: number, s11?: number, s12?: number, s13?: number, s14?: number, s15?: number): Uint8x16;
  461. prototype: Uint8x16;
  462. extractLane(simd: SIMD.Uint8x16, lane: number): number;
  463. swizzle(a: SIMD.Uint8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Uint8x16;
  464. shuffle(a: SIMD.Uint8x16, b: SIMD.Uint8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Uint8x16;
  465. check(a: SIMD.Uint8x16): SIMD.Uint8x16;
  466. splat(n: number): SIMD.Uint8x16;
  467. replaceLane(simd: SIMD.Uint8x16, lane: number, value: number): SIMD.Uint8x16;
  468. select(selector: SIMD.Bool8x16, a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  469. equal(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  470. notEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  471. lessThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  472. lessThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  473. greaterThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  474. greaterThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  475. and(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  476. or(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  477. xor(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  478. not(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  479. add(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  480. sub(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  481. mul(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  482. shiftLeftByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  483. shiftRightByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  484. addSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  485. subSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  486. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint8x16;
  487. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint8x16): SIMD.Uint8x16;
  488. fromInt8x16(value: SIMD.Int8x16): SIMD.Uint8x16;
  489. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint8x16;
  490. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint8x16;
  491. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint8x16;
  492. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint8x16;
  493. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint8x16;
  494. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint8x16;
  495. }
  496. interface Bool32x4 {
  497. constructor: Bool32x4Constructor;
  498. valueOf(): Bool32x4;
  499. toLocaleString(): string;
  500. toString(): string;
  501. }
  502. interface Bool32x4Constructor {
  503. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean): Bool32x4;
  504. prototype: Bool32x4;
  505. extractLane(simd: SIMD.Bool32x4, lane: number): boolean;
  506. check(a: SIMD.Bool32x4): SIMD.Bool32x4;
  507. splat(n: boolean): SIMD.Bool32x4;
  508. replaceLane(simd: SIMD.Bool32x4, lane: number, value: boolean): SIMD.Bool32x4;
  509. allTrue(a: SIMD.Bool32x4): boolean;
  510. anyTrue(a: SIMD.Bool32x4): boolean;
  511. and(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  512. or(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  513. xor(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  514. not(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  515. }
  516. interface Bool16x8 {
  517. constructor: Bool16x8Constructor;
  518. valueOf(): Bool16x8;
  519. toLocaleString(): string;
  520. toString(): string;
  521. }
  522. interface Bool16x8Constructor {
  523. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean): Bool16x8;
  524. prototype: Bool16x8;
  525. extractLane(simd: SIMD.Bool16x8, lane: number): boolean;
  526. check(a: SIMD.Bool16x8): SIMD.Bool16x8;
  527. splat(n: boolean): SIMD.Bool16x8;
  528. replaceLane(simd: SIMD.Bool16x8, lane: number, value: boolean): SIMD.Bool16x8;
  529. allTrue(a: SIMD.Bool16x8): boolean;
  530. anyTrue(a: SIMD.Bool16x8): boolean;
  531. and(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  532. or(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  533. xor(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  534. not(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  535. }
  536. interface Bool8x16 {
  537. constructor: Bool8x16Constructor;
  538. valueOf(): Bool8x16;
  539. toLocaleString(): string;
  540. toString(): string;
  541. }
  542. interface Bool8x16Constructor {
  543. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean, s8?: boolean, s9?: boolean, s10?: boolean, s11?: boolean, s12?: boolean, s13?: boolean, s14?: boolean, s15?: boolean): Bool8x16;
  544. prototype: Bool8x16;
  545. extractLane(simd: SIMD.Bool8x16, lane: number): boolean;
  546. check(a: SIMD.Bool8x16): SIMD.Bool8x16;
  547. splat(n: boolean): SIMD.Bool8x16;
  548. replaceLane(simd: SIMD.Bool8x16, lane: number, value: boolean): SIMD.Bool8x16;
  549. allTrue(a: SIMD.Bool8x16): boolean;
  550. anyTrue(a: SIMD.Bool8x16): boolean;
  551. and(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  552. or(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  553. xor(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  554. not(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  555. }
  556. }
  557. interface EXT_disjoint_timer_query {
  558. QUERY_COUNTER_BITS_EXT: number;
  559. TIME_ELAPSED_EXT: number;
  560. TIMESTAMP_EXT: number;
  561. GPU_DISJOINT_EXT: number;
  562. QUERY_RESULT_EXT: number;
  563. QUERY_RESULT_AVAILABLE_EXT: number;
  564. queryCounterEXT(query: WebGLQuery, target: number): void;
  565. createQueryEXT(): WebGLQuery;
  566. beginQueryEXT(target: number, query: WebGLQuery): void;
  567. endQueryEXT(target: number): void;
  568. getQueryObjectEXT(query: WebGLQuery, target: number): any;
  569. deleteQueryEXT(query: WebGLQuery): void;
  570. }
  571. declare module BABYLON {
  572. /**
  573. * Node is the basic class for all scene objects (Mesh, Light Camera).
  574. */
  575. class Node {
  576. name: string;
  577. id: string;
  578. uniqueId: number;
  579. state: string;
  580. metadata: any;
  581. doNotSerialize: boolean;
  582. animations: Animation[];
  583. onReady: (node: Node) => void;
  584. parent: Nullable<Node>;
  585. getClassName(): string;
  586. /**
  587. * An event triggered when the mesh is disposed.
  588. * @type {BABYLON.Observable}
  589. */
  590. onDisposeObservable: Observable<Node>;
  591. onDispose: () => void;
  592. /**
  593. * @constructor
  594. * @param {string} name - the name and id to be given to this node
  595. * @param {BABYLON.Scene} the scene this node will be added to
  596. */
  597. constructor(name: string, scene?: Nullable<Scene>);
  598. getScene(): Scene;
  599. getEngine(): Engine;
  600. addBehavior(behavior: Behavior<Node>): Node;
  601. removeBehavior(behavior: Behavior<Node>): Node;
  602. readonly behaviors: Behavior<Node>[];
  603. getBehaviorByName(name: string): Nullable<Behavior<Node>>;
  604. getWorldMatrix(): Matrix;
  605. updateCache(force?: boolean): void;
  606. isSynchronizedWithParent(): boolean;
  607. isSynchronized(updateCache?: boolean): boolean;
  608. hasNewParent(update?: boolean): boolean;
  609. /**
  610. * Is this node ready to be used/rendered
  611. * @return {boolean} is it ready
  612. */
  613. isReady(): boolean;
  614. /**
  615. * Is this node enabled.
  616. * If the node has a parent and is enabled, the parent will be inspected as well.
  617. * @return {boolean} whether this node (and its parent) is enabled.
  618. * @see setEnabled
  619. */
  620. isEnabled(): boolean;
  621. /**
  622. * Set the enabled state of this node.
  623. * @param {boolean} value - the new enabled state
  624. * @see isEnabled
  625. */
  626. setEnabled(value: boolean): void;
  627. /**
  628. * Is this node a descendant of the given node.
  629. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
  630. * @param {BABYLON.Node} ancestor - The parent node to inspect
  631. * @see parent
  632. */
  633. isDescendantOf(ancestor: Node): boolean;
  634. /**
  635. * Evaluate the list of children and determine if they should be considered as descendants considering the given criterias
  636. * @param {BABYLON.Node[]} results the result array containing the nodes matching the given criterias
  637. * @param {boolean} directDescendantsOnly if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered.
  638. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  639. */
  640. /**
  641. * Will return all nodes that have this node as ascendant.
  642. * @param {boolean} directDescendantsOnly if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered.
  643. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  644. * @return {BABYLON.Node[]} all children nodes of all types.
  645. */
  646. getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];
  647. /**
  648. * Get all child-meshes of this node.
  649. */
  650. getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];
  651. /**
  652. * Get all child-transformNodes of this node.
  653. */
  654. getChildTransformNodes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): TransformNode[];
  655. /**
  656. * Get all direct children of this node.
  657. */
  658. getChildren(predicate?: (node: Node) => boolean): Node[];
  659. getAnimationByName(name: string): Nullable<Animation>;
  660. createAnimationRange(name: string, from: number, to: number): void;
  661. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  662. getAnimationRange(name: string): Nullable<AnimationRange>;
  663. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void;
  664. serializeAnimationRanges(): any;
  665. computeWorldMatrix(force?: boolean): Matrix;
  666. dispose(): void;
  667. static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void;
  668. }
  669. }
  670. declare module BABYLON {
  671. interface IDisposable {
  672. dispose(): void;
  673. }
  674. /**
  675. * This class is used by the onRenderingGroupObservable
  676. */
  677. class RenderingGroupInfo {
  678. /**
  679. * The Scene that being rendered
  680. */
  681. scene: Scene;
  682. /**
  683. * The camera currently used for the rendering pass
  684. */
  685. camera: Nullable<Camera>;
  686. /**
  687. * The ID of the renderingGroup being processed
  688. */
  689. renderingGroupId: number;
  690. /**
  691. * The rendering stage, can be either STAGE_PRECLEAR, STAGE_PREOPAQUE, STAGE_PRETRANSPARENT, STAGE_POSTTRANSPARENT
  692. */
  693. renderStage: number;
  694. /**
  695. * Stage corresponding to the very first hook in the renderingGroup phase: before the render buffer may be cleared
  696. * This stage will be fired no matter what
  697. */
  698. static STAGE_PRECLEAR: number;
  699. /**
  700. * Called before opaque object are rendered.
  701. * This stage will be fired only if there's 3D Opaque content to render
  702. */
  703. static STAGE_PREOPAQUE: number;
  704. /**
  705. * Called after the opaque objects are rendered and before the transparent ones
  706. * This stage will be fired only if there's 3D transparent content to render
  707. */
  708. static STAGE_PRETRANSPARENT: number;
  709. /**
  710. * Called after the transparent object are rendered, last hook of the renderingGroup phase
  711. * This stage will be fired no matter what
  712. */
  713. static STAGE_POSTTRANSPARENT: number;
  714. }
  715. /**
  716. * Represents a scene to be rendered by the engine.
  717. * @see http://doc.babylonjs.com/page.php?p=21911
  718. */
  719. class Scene implements IAnimatable {
  720. static MinDeltaTime: number;
  721. static MaxDeltaTime: number;
  722. /** The fog is deactivated */
  723. static readonly FOGMODE_NONE: number;
  724. /** The fog density is following an exponential function */
  725. static readonly FOGMODE_EXP: number;
  726. /** The fog density is following an exponential function faster than FOGMODE_EXP */
  727. static readonly FOGMODE_EXP2: number;
  728. /** The fog density is following a linear function. */
  729. static readonly FOGMODE_LINEAR: number;
  730. autoClear: boolean;
  731. autoClearDepthAndStencil: boolean;
  732. clearColor: Color4;
  733. ambientColor: Color3;
  734. /**
  735. * Texture used in all pbr material as the reflection texture.
  736. * As in the majority of the scene they are the same (exception for multi room and so on),
  737. * this is easier to reference from here than from all the materials.
  738. */
  739. /**
  740. * Texture used in all pbr material as the reflection texture.
  741. * As in the majority of the scene they are the same (exception for multi room and so on),
  742. * this is easier to set here than in all the materials.
  743. */
  744. environmentTexture: BaseTexture;
  745. /**
  746. * Default image processing configuration used either in the rendering
  747. * Forward main pass or through the imageProcessingPostProcess if present.
  748. * As in the majority of the scene they are the same (exception for multi camera),
  749. * this is easier to reference from here than from all the materials and post process.
  750. *
  751. * No setter as we it is a shared configuration, you can set the values instead.
  752. */
  753. readonly imageProcessingConfiguration: ImageProcessingConfiguration;
  754. forceWireframe: boolean;
  755. forcePointsCloud: boolean;
  756. forceShowBoundingBoxes: boolean;
  757. clipPlane: Nullable<Plane>;
  758. animationsEnabled: boolean;
  759. useConstantAnimationDeltaTime: boolean;
  760. constantlyUpdateMeshUnderPointer: boolean;
  761. hoverCursor: string;
  762. defaultCursor: string;
  763. /**
  764. * This is used to call preventDefault() on pointer down
  765. * in order to block unwanted artifacts like system double clicks
  766. */
  767. preventDefaultOnPointerDown: boolean;
  768. metadata: any;
  769. loadingPluginName: string;
  770. /**
  771. * An event triggered when the scene is disposed.
  772. * @type {BABYLON.Observable}
  773. */
  774. onDisposeObservable: Observable<Scene>;
  775. /** A function to be executed when this scene is disposed. */
  776. onDispose: () => void;
  777. /**
  778. * An event triggered before rendering the scene (right after animations and physics)
  779. * @type {BABYLON.Observable}
  780. */
  781. onBeforeRenderObservable: Observable<Scene>;
  782. /** A function to be executed before rendering this scene */
  783. beforeRender: Nullable<() => void>;
  784. /**
  785. * An event triggered after rendering the scene
  786. * @type {BABYLON.Observable}
  787. */
  788. onAfterRenderObservable: Observable<Scene>;
  789. /** A function to be executed after rendering this scene */
  790. afterRender: Nullable<() => void>;
  791. /**
  792. * An event triggered before animating the scene
  793. * @type {BABYLON.Observable}
  794. */
  795. onBeforeAnimationsObservable: Observable<Scene>;
  796. /**
  797. * An event triggered after animations processing
  798. * @type {BABYLON.Observable}
  799. */
  800. onAfterAnimationsObservable: Observable<Scene>;
  801. /**
  802. * An event triggered before draw calls are ready to be sent
  803. * @type {BABYLON.Observable}
  804. */
  805. onBeforeDrawPhaseObservable: Observable<Scene>;
  806. /**
  807. * An event triggered after draw calls have been sent
  808. * @type {BABYLON.Observable}
  809. */
  810. onAfterDrawPhaseObservable: Observable<Scene>;
  811. /**
  812. * An event triggered when physic simulation is about to be run
  813. * @type {BABYLON.Observable}
  814. */
  815. onBeforePhysicsObservable: Observable<Scene>;
  816. /**
  817. * An event triggered when physic simulation has been done
  818. * @type {BABYLON.Observable}
  819. */
  820. onAfterPhysicsObservable: Observable<Scene>;
  821. /**
  822. * An event triggered when the scene is ready
  823. * @type {BABYLON.Observable}
  824. */
  825. onReadyObservable: Observable<Scene>;
  826. /**
  827. * An event triggered before rendering a camera
  828. * @type {BABYLON.Observable}
  829. */
  830. onBeforeCameraRenderObservable: Observable<Camera>;
  831. beforeCameraRender: () => void;
  832. /**
  833. * An event triggered after rendering a camera
  834. * @type {BABYLON.Observable}
  835. */
  836. onAfterCameraRenderObservable: Observable<Camera>;
  837. afterCameraRender: () => void;
  838. /**
  839. * An event triggered when active meshes evaluation is about to start
  840. * @type {BABYLON.Observable}
  841. */
  842. onBeforeActiveMeshesEvaluationObservable: Observable<Scene>;
  843. /**
  844. * An event triggered when active meshes evaluation is done
  845. * @type {BABYLON.Observable}
  846. */
  847. onAfterActiveMeshesEvaluationObservable: Observable<Scene>;
  848. /**
  849. * An event triggered when particles rendering is about to start
  850. * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)
  851. * @type {BABYLON.Observable}
  852. */
  853. onBeforeParticlesRenderingObservable: Observable<Scene>;
  854. /**
  855. * An event triggered when particles rendering is done
  856. * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)
  857. * @type {BABYLON.Observable}
  858. */
  859. onAfterParticlesRenderingObservable: Observable<Scene>;
  860. /**
  861. * An event triggered when sprites rendering is about to start
  862. * Note: This event can be trigger more than once per frame (because sprites can be rendered by render target textures as well)
  863. * @type {BABYLON.Observable}
  864. */
  865. onBeforeSpritesRenderingObservable: Observable<Scene>;
  866. /**
  867. * An event triggered when sprites rendering is done
  868. * Note: This event can be trigger more than once per frame (because sprites can be rendered by render target textures as well)
  869. * @type {BABYLON.Observable}
  870. */
  871. onAfterSpritesRenderingObservable: Observable<Scene>;
  872. /**
  873. * An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed
  874. * @type {BABYLON.Observable}
  875. */
  876. onDataLoadedObservable: Observable<Scene>;
  877. /**
  878. * An event triggered when a camera is created
  879. * @type {BABYLON.Observable}
  880. */
  881. onNewCameraAddedObservable: Observable<Camera>;
  882. /**
  883. * An event triggered when a camera is removed
  884. * @type {BABYLON.Observable}
  885. */
  886. onCameraRemovedObservable: Observable<Camera>;
  887. /**
  888. * An event triggered when a light is created
  889. * @type {BABYLON.Observable}
  890. */
  891. onNewLightAddedObservable: Observable<Light>;
  892. /**
  893. * An event triggered when a light is removed
  894. * @type {BABYLON.Observable}
  895. */
  896. onLightRemovedObservable: Observable<Light>;
  897. /**
  898. * An event triggered when a geometry is created
  899. * @type {BABYLON.Observable}
  900. */
  901. onNewGeometryAddedObservable: Observable<Geometry>;
  902. /**
  903. * An event triggered when a geometry is removed
  904. * @type {BABYLON.Observable}
  905. */
  906. onGeometryRemovedObservable: Observable<Geometry>;
  907. /**
  908. * An event triggered when a transform node is created
  909. * @type {BABYLON.Observable}
  910. */
  911. onNewTransformNodeAddedObservable: Observable<TransformNode>;
  912. /**
  913. * An event triggered when a transform node is removed
  914. * @type {BABYLON.Observable}
  915. */
  916. onTransformNodeRemovedObservable: Observable<TransformNode>;
  917. /**
  918. * An event triggered when a mesh is created
  919. * @type {BABYLON.Observable}
  920. */
  921. onNewMeshAddedObservable: Observable<AbstractMesh>;
  922. /**
  923. * An event triggered when a mesh is removed
  924. * @type {BABYLON.Observable}
  925. */
  926. onMeshRemovedObservable: Observable<AbstractMesh>;
  927. /**
  928. * An event triggered when render targets are about to be rendered
  929. * Can happen multiple times per frame.
  930. * @type {BABYLON.Observable}
  931. */
  932. OnBeforeRenderTargetsRenderObservable: Observable<Scene>;
  933. /**
  934. * An event triggered when render targets were rendered.
  935. * Can happen multiple times per frame.
  936. * @type {BABYLON.Observable}
  937. */
  938. OnAfterRenderTargetsRenderObservable: Observable<Scene>;
  939. /**
  940. * An event triggered before calculating deterministic simulation step
  941. * @type {BABYLON.Observable}
  942. */
  943. onBeforeStepObservable: Observable<Scene>;
  944. /**
  945. * An event triggered after calculating deterministic simulation step
  946. * @type {BABYLON.Observable}
  947. */
  948. onAfterStepObservable: Observable<Scene>;
  949. /**
  950. * This Observable will be triggered for each stage of each renderingGroup of each rendered camera.
  951. * The RenderinGroupInfo class contains all the information about the context in which the observable is called
  952. * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)
  953. */
  954. onRenderingGroupObservable: Observable<RenderingGroupInfo>;
  955. animations: Animation[];
  956. pointerDownPredicate: (Mesh: AbstractMesh) => boolean;
  957. pointerUpPredicate: (Mesh: AbstractMesh) => boolean;
  958. pointerMovePredicate: (Mesh: AbstractMesh) => boolean;
  959. /** Deprecated. Use onPointerObservable instead */
  960. onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  961. /** Deprecated. Use onPointerObservable instead */
  962. onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  963. /** Deprecated. Use onPointerObservable instead */
  964. onPointerUp: (evt: PointerEvent, pickInfo: Nullable<PickingInfo>) => void;
  965. /** Deprecated. Use onPointerObservable instead */
  966. onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  967. readonly gamepadManager: GamepadManager;
  968. /**
  969. * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance).
  970. * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true
  971. */
  972. onPrePointerObservable: Observable<PointerInfoPre>;
  973. /**
  974. * Observable event triggered each time an input event is received from the rendering canvas
  975. */
  976. onPointerObservable: Observable<PointerInfo>;
  977. readonly unTranslatedPointer: Vector2;
  978. /** The distance in pixel that you have to move to prevent some events */
  979. static DragMovementThreshold: number;
  980. /** Time in milliseconds to wait to raise long press events if button is still pressed */
  981. static LongPressDelay: number;
  982. /** Time in milliseconds with two consecutive clicks will be considered as a double click */
  983. static DoubleClickDelay: number;
  984. /** If you need to check double click without raising a single click at first click, enable this flag */
  985. static ExclusiveDoubleClickMode: boolean;
  986. /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */
  987. cameraToUseForPointers: Nullable<Camera>;
  988. /**
  989. * This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl()
  990. * You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true
  991. */
  992. onPreKeyboardObservable: Observable<KeyboardInfoPre>;
  993. /**
  994. * Observable event triggered each time an keyboard event is received from the hosting window
  995. */
  996. onKeyboardObservable: Observable<KeyboardInfo>;
  997. /**
  998. * use right-handed coordinate system on this scene.
  999. * @type {boolean}
  1000. */
  1001. useRightHandedSystem: boolean;
  1002. setStepId(newStepId: number): void;
  1003. getStepId(): number;
  1004. getInternalStep(): number;
  1005. /**
  1006. * is fog enabled on this scene.
  1007. */
  1008. fogEnabled: boolean;
  1009. fogMode: number;
  1010. fogColor: Color3;
  1011. fogDensity: number;
  1012. fogStart: number;
  1013. fogEnd: number;
  1014. /**
  1015. * is shadow enabled on this scene.
  1016. * @type {boolean}
  1017. */
  1018. shadowsEnabled: boolean;
  1019. /**
  1020. * is light enabled on this scene.
  1021. * @type {boolean}
  1022. */
  1023. lightsEnabled: boolean;
  1024. /**
  1025. * All of the lights added to this scene.
  1026. * @see BABYLON.Light
  1027. * @type {BABYLON.Light[]}
  1028. */
  1029. lights: Light[];
  1030. /** All of the cameras added to this scene. */
  1031. cameras: Camera[];
  1032. /** All of the active cameras added to this scene. */
  1033. activeCameras: Camera[];
  1034. /** The current active camera */
  1035. activeCamera: Nullable<Camera>;
  1036. /**
  1037. * All of the tranform nodes added to this scene.
  1038. * @see BABYLON.TransformNode
  1039. * @type {BABYLON.TransformNode[]}
  1040. */
  1041. transformNodes: TransformNode[];
  1042. /**
  1043. * All of the (abstract) meshes added to this scene.
  1044. * @see BABYLON.AbstractMesh
  1045. * @type {BABYLON.AbstractMesh[]}
  1046. */
  1047. meshes: AbstractMesh[];
  1048. /**
  1049. * All of the animation groups added to this scene.
  1050. * @see BABYLON.AnimationGroup
  1051. * @type {BABYLON.AnimationGroup[]}
  1052. */
  1053. animationGroups: AnimationGroup[];
  1054. materials: Material[];
  1055. multiMaterials: MultiMaterial[];
  1056. /** The default material used on meshes when no material is affected */
  1057. /** The default material used on meshes when no material is affected */
  1058. defaultMaterial: Material;
  1059. texturesEnabled: boolean;
  1060. textures: BaseTexture[];
  1061. particlesEnabled: boolean;
  1062. particleSystems: IParticleSystem[];
  1063. spritesEnabled: boolean;
  1064. spriteManagers: SpriteManager[];
  1065. layers: Layer[];
  1066. highlightLayers: HighlightLayer[];
  1067. skeletonsEnabled: boolean;
  1068. skeletons: Skeleton[];
  1069. morphTargetManagers: MorphTargetManager[];
  1070. lensFlaresEnabled: boolean;
  1071. lensFlareSystems: LensFlareSystem[];
  1072. collisionsEnabled: boolean;
  1073. collisionCoordinator: ICollisionCoordinator;
  1074. /** Defines the gravity applied to this scene */
  1075. gravity: Vector3;
  1076. postProcesses: PostProcess[];
  1077. postProcessesEnabled: boolean;
  1078. postProcessManager: PostProcessManager;
  1079. readonly postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
  1080. renderTargetsEnabled: boolean;
  1081. dumpNextRenderTargets: boolean;
  1082. customRenderTargets: RenderTargetTexture[];
  1083. useDelayedTextureLoading: boolean;
  1084. importedMeshesFiles: String[];
  1085. probesEnabled: boolean;
  1086. reflectionProbes: ReflectionProbe[];
  1087. database: Database;
  1088. /**
  1089. * This scene's action manager
  1090. * @type {BABYLON.ActionManager}
  1091. */
  1092. actionManager: ActionManager;
  1093. proceduralTexturesEnabled: boolean;
  1094. soundTracks: SoundTrack[];
  1095. readonly mainSoundTrack: SoundTrack;
  1096. VRHelper: VRExperienceHelper;
  1097. simplificationQueue: SimplificationQueue;
  1098. animationTimeScale: number;
  1099. readonly _isAlternateRenderingEnabled: boolean;
  1100. readonly frustumPlanes: Plane[];
  1101. requireLightSorting: boolean;
  1102. /**
  1103. * @constructor
  1104. * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
  1105. */
  1106. constructor(engine: Engine);
  1107. readonly debugLayer: DebugLayer;
  1108. workerCollisions: boolean;
  1109. readonly selectionOctree: Octree<AbstractMesh>;
  1110. /**
  1111. * The mesh that is currently under the pointer.
  1112. * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
  1113. */
  1114. readonly meshUnderPointer: Nullable<AbstractMesh>;
  1115. /**
  1116. * Current on-screen X position of the pointer
  1117. * @return {number} X position of the pointer
  1118. */
  1119. readonly pointerX: number;
  1120. /**
  1121. * Current on-screen Y position of the pointer
  1122. * @return {number} Y position of the pointer
  1123. */
  1124. readonly pointerY: number;
  1125. getCachedMaterial(): Nullable<Material>;
  1126. getCachedEffect(): Nullable<Effect>;
  1127. getCachedVisibility(): Nullable<number>;
  1128. isCachedMaterialInvalid(material: Material, effect: Effect, visibility?: number): boolean;
  1129. getBoundingBoxRenderer(): BoundingBoxRenderer;
  1130. getOutlineRenderer(): OutlineRenderer;
  1131. getEngine(): Engine;
  1132. getTotalVertices(): number;
  1133. readonly totalVerticesPerfCounter: PerfCounter;
  1134. getActiveIndices(): number;
  1135. readonly totalActiveIndicesPerfCounter: PerfCounter;
  1136. getActiveParticles(): number;
  1137. readonly activeParticlesPerfCounter: PerfCounter;
  1138. getActiveBones(): number;
  1139. readonly activeBonesPerfCounter: PerfCounter;
  1140. getInterFramePerfCounter(): number;
  1141. readonly interFramePerfCounter: Nullable<PerfCounter>;
  1142. getLastFrameDuration(): number;
  1143. readonly lastFramePerfCounter: Nullable<PerfCounter>;
  1144. getEvaluateActiveMeshesDuration(): number;
  1145. readonly evaluateActiveMeshesDurationPerfCounter: Nullable<PerfCounter>;
  1146. getActiveMeshes(): SmartArray<AbstractMesh>;
  1147. getRenderTargetsDuration(): number;
  1148. getRenderDuration(): number;
  1149. readonly renderDurationPerfCounter: Nullable<PerfCounter>;
  1150. getParticlesDuration(): number;
  1151. readonly particlesDurationPerfCounter: Nullable<PerfCounter>;
  1152. getSpritesDuration(): number;
  1153. readonly spriteDuractionPerfCounter: Nullable<PerfCounter>;
  1154. getAnimationRatio(): number;
  1155. getRenderId(): number;
  1156. incrementRenderId(): void;
  1157. /**
  1158. * Use this method to simulate a pointer move on a mesh
  1159. * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
  1160. */
  1161. simulatePointerMove(pickResult: PickingInfo): Scene;
  1162. /**
  1163. * Use this method to simulate a pointer down on a mesh
  1164. * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
  1165. */
  1166. simulatePointerDown(pickResult: PickingInfo): Scene;
  1167. /**
  1168. * Use this method to simulate a pointer up on a mesh
  1169. * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
  1170. */
  1171. simulatePointerUp(pickResult: PickingInfo): Scene;
  1172. /**
  1173. * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
  1174. * @param attachUp defines if you want to attach events to pointerup
  1175. * @param attachDown defines if you want to attach events to pointerdown
  1176. * @param attachMove defines if you want to attach events to pointermove
  1177. */
  1178. attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean): void;
  1179. detachControl(): void;
  1180. isReady(): boolean;
  1181. resetCachedMaterial(): void;
  1182. registerBeforeRender(func: () => void): void;
  1183. unregisterBeforeRender(func: () => void): void;
  1184. registerAfterRender(func: () => void): void;
  1185. unregisterAfterRender(func: () => void): void;
  1186. getWaitingItemsCount(): number;
  1187. readonly isLoading: boolean;
  1188. /**
  1189. * Registers a function to be executed when the scene is ready.
  1190. * @param {Function} func - the function to be executed.
  1191. */
  1192. executeWhenReady(func: () => void): void;
  1193. /**
  1194. * Will start the animation sequence of a given target
  1195. * @param target - the target
  1196. * @param {number} from - from which frame should animation start
  1197. * @param {number} to - till which frame should animation run.
  1198. * @param {boolean} [loop] - should the animation loop
  1199. * @param {number} [speedRatio] - the speed in which to run the animation
  1200. * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
  1201. * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
  1202. * Returns {BABYLON.Animatable} the animatable object created for this animation
  1203. * See BABYLON.Animatable
  1204. */
  1205. beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
  1206. beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  1207. getAnimatableByTarget(target: any): Nullable<Animatable>;
  1208. readonly animatables: Animatable[];
  1209. /**
  1210. * Will stop the animation of the given target
  1211. * @param target - the target
  1212. * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
  1213. * @see beginAnimation
  1214. */
  1215. stopAnimation(target: any, animationName?: string): void;
  1216. /**
  1217. * Stops and removes all animations that have been applied to the scene
  1218. */
  1219. stopAllAnimations(): void;
  1220. getViewMatrix(): Matrix;
  1221. getProjectionMatrix(): Matrix;
  1222. getTransformMatrix(): Matrix;
  1223. setTransformMatrix(view: Matrix, projection: Matrix): void;
  1224. getSceneUniformBuffer(): UniformBuffer;
  1225. getUniqueId(): number;
  1226. addMesh(newMesh: AbstractMesh): void;
  1227. removeMesh(toRemove: AbstractMesh): number;
  1228. addTransformNode(newTransformNode: TransformNode): void;
  1229. removeTransformNode(toRemove: TransformNode): number;
  1230. removeSkeleton(toRemove: Skeleton): number;
  1231. removeMorphTargetManager(toRemove: MorphTargetManager): number;
  1232. removeLight(toRemove: Light): number;
  1233. removeCamera(toRemove: Camera): number;
  1234. addLight(newLight: Light): void;
  1235. sortLightsByPriority(): void;
  1236. addCamera(newCamera: Camera): void;
  1237. /**
  1238. * Switch active camera
  1239. * @param {Camera} newCamera - new active camera
  1240. * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
  1241. */
  1242. switchActiveCamera(newCamera: Camera, attachControl?: boolean): void;
  1243. /**
  1244. * sets the active camera of the scene using its ID
  1245. * @param {string} id - the camera's ID
  1246. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1247. * @see activeCamera
  1248. */
  1249. setActiveCameraByID(id: string): Nullable<Camera>;
  1250. /**
  1251. * sets the active camera of the scene using its name
  1252. * @param {string} name - the camera's name
  1253. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1254. * @see activeCamera
  1255. */
  1256. setActiveCameraByName(name: string): Nullable<Camera>;
  1257. /**
  1258. * get an animation group using its name
  1259. * @param {string} the material's name
  1260. * @return {BABYLON.AnimationGroup|null} the animation group or null if none found.
  1261. */
  1262. getAnimationGroupByName(name: string): Nullable<AnimationGroup>;
  1263. /**
  1264. * get a material using its id
  1265. * @param {string} the material's ID
  1266. * @return {BABYLON.Material|null} the material or null if none found.
  1267. */
  1268. getMaterialByID(id: string): Nullable<Material>;
  1269. /**
  1270. * get a material using its name
  1271. * @param {string} the material's name
  1272. * @return {BABYLON.Material|null} the material or null if none found.
  1273. */
  1274. getMaterialByName(name: string): Nullable<Material>;
  1275. getLensFlareSystemByName(name: string): Nullable<LensFlareSystem>;
  1276. getLensFlareSystemByID(id: string): Nullable<LensFlareSystem>;
  1277. getCameraByID(id: string): Nullable<Camera>;
  1278. getCameraByUniqueID(uniqueId: number): Nullable<Camera>;
  1279. /**
  1280. * get a camera using its name
  1281. * @param {string} the camera's name
  1282. * @return {BABYLON.Camera|null} the camera or null if none found.
  1283. */
  1284. getCameraByName(name: string): Nullable<Camera>;
  1285. /**
  1286. * get a bone using its id
  1287. * @param {string} the bone's id
  1288. * @return {BABYLON.Bone|null} the bone or null if not found
  1289. */
  1290. getBoneByID(id: string): Nullable<Bone>;
  1291. /**
  1292. * get a bone using its id
  1293. * @param {string} the bone's name
  1294. * @return {BABYLON.Bone|null} the bone or null if not found
  1295. */
  1296. getBoneByName(name: string): Nullable<Bone>;
  1297. /**
  1298. * get a light node using its name
  1299. * @param {string} the light's name
  1300. * @return {BABYLON.Light|null} the light or null if none found.
  1301. */
  1302. getLightByName(name: string): Nullable<Light>;
  1303. /**
  1304. * get a light node using its ID
  1305. * @param {string} the light's id
  1306. * @return {BABYLON.Light|null} the light or null if none found.
  1307. */
  1308. getLightByID(id: string): Nullable<Light>;
  1309. /**
  1310. * get a light node using its scene-generated unique ID
  1311. * @param {number} the light's unique id
  1312. * @return {BABYLON.Light|null} the light or null if none found.
  1313. */
  1314. getLightByUniqueID(uniqueId: number): Nullable<Light>;
  1315. /**
  1316. * get a particle system by id
  1317. * @param id {number} the particle system id
  1318. * @return {BABYLON.IParticleSystem|null} the corresponding system or null if none found.
  1319. */
  1320. getParticleSystemByID(id: string): Nullable<IParticleSystem>;
  1321. /**
  1322. * get a geometry using its ID
  1323. * @param {string} the geometry's id
  1324. * @return {BABYLON.Geometry|null} the geometry or null if none found.
  1325. */
  1326. getGeometryByID(id: string): Nullable<Geometry>;
  1327. /**
  1328. * add a new geometry to this scene.
  1329. * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
  1330. * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
  1331. * @return {boolean} was the geometry added or not
  1332. */
  1333. pushGeometry(geometry: Geometry, force?: boolean): boolean;
  1334. /**
  1335. * Removes an existing geometry
  1336. * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene.
  1337. * @return {boolean} was the geometry removed or not
  1338. */
  1339. removeGeometry(geometry: Geometry): boolean;
  1340. getGeometries(): Geometry[];
  1341. /**
  1342. * Get the first added mesh found of a given ID
  1343. * @param {string} id - the id to search for
  1344. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1345. */
  1346. getMeshByID(id: string): Nullable<AbstractMesh>;
  1347. getMeshesByID(id: string): Array<AbstractMesh>;
  1348. /**
  1349. * Get the first added transform node found of a given ID
  1350. * @param {string} id - the id to search for
  1351. * @return {BABYLON.TransformNode|null} the transform node found or null if not found at all.
  1352. */
  1353. getTransformNodeByID(id: string): Nullable<TransformNode>;
  1354. getTransformNodesByID(id: string): Array<TransformNode>;
  1355. /**
  1356. * Get a mesh with its auto-generated unique id
  1357. * @param {number} uniqueId - the unique id to search for
  1358. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1359. */
  1360. getMeshByUniqueID(uniqueId: number): Nullable<AbstractMesh>;
  1361. /**
  1362. * Get a the last added mesh found of a given ID
  1363. * @param {string} id - the id to search for
  1364. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1365. */
  1366. getLastMeshByID(id: string): Nullable<AbstractMesh>;
  1367. /**
  1368. * Get a the last added node (Mesh, Camera, Light) found of a given ID
  1369. * @param {string} id - the id to search for
  1370. * @return {BABYLON.Node|null} the node found or null if not found at all.
  1371. */
  1372. getLastEntryByID(id: string): Nullable<Node>;
  1373. getNodeByID(id: string): Nullable<Node>;
  1374. getNodeByName(name: string): Nullable<Node>;
  1375. getMeshByName(name: string): Nullable<AbstractMesh>;
  1376. getTransformNodeByName(name: string): Nullable<TransformNode>;
  1377. getSoundByName(name: string): Nullable<Sound>;
  1378. getLastSkeletonByID(id: string): Nullable<Skeleton>;
  1379. getSkeletonById(id: string): Nullable<Skeleton>;
  1380. getSkeletonByName(name: string): Nullable<Skeleton>;
  1381. getMorphTargetManagerById(id: number): Nullable<MorphTargetManager>;
  1382. isActiveMesh(mesh: AbstractMesh): boolean;
  1383. /**
  1384. * Return a the first highlight layer of the scene with a given name.
  1385. * @param name The name of the highlight layer to look for.
  1386. * @return The highlight layer if found otherwise null.
  1387. */
  1388. getHighlightLayerByName(name: string): Nullable<HighlightLayer>;
  1389. /**
  1390. * Return a unique id as a string which can serve as an identifier for the scene
  1391. */
  1392. readonly uid: string;
  1393. /**
  1394. * Add an externaly attached data from its key.
  1395. * This method call will fail and return false, if such key already exists.
  1396. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  1397. * @param key the unique key that identifies the data
  1398. * @param data the data object to associate to the key for this Engine instance
  1399. * @return true if no such key were already present and the data was added successfully, false otherwise
  1400. */
  1401. addExternalData<T>(key: string, data: T): boolean;
  1402. /**
  1403. * Get an externaly attached data from its key
  1404. * @param key the unique key that identifies the data
  1405. * @return the associated data, if present (can be null), or undefined if not present
  1406. */
  1407. getExternalData<T>(key: string): Nullable<T>;
  1408. /**
  1409. * Get an externaly attached data from its key, create it using a factory if it's not already present
  1410. * @param key the unique key that identifies the data
  1411. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  1412. * @return the associated data, can be null if the factory returned null.
  1413. */
  1414. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  1415. /**
  1416. * Remove an externaly attached data from the Engine instance
  1417. * @param key the unique key that identifies the data
  1418. * @return true if the data was successfully removed, false if it doesn't exist
  1419. */
  1420. removeExternalData(key: string): boolean;
  1421. /**
  1422. * Use this function to stop evaluating active meshes. The current list will be keep alive between frames
  1423. */
  1424. freezeActiveMeshes(): Scene;
  1425. /**
  1426. * Use this function to restart evaluating active meshes on every frame
  1427. */
  1428. unfreezeActiveMeshes(): this;
  1429. updateTransformMatrix(force?: boolean): void;
  1430. updateAlternateTransformMatrix(alternateCamera: Camera): void;
  1431. render(): void;
  1432. audioEnabled: boolean;
  1433. headphone: boolean;
  1434. enableDepthRenderer(): DepthRenderer;
  1435. disableDepthRenderer(): void;
  1436. enableGeometryBufferRenderer(ratio?: number): Nullable<GeometryBufferRenderer>;
  1437. disableGeometryBufferRenderer(): void;
  1438. freezeMaterials(): void;
  1439. unfreezeMaterials(): void;
  1440. dispose(): void;
  1441. readonly isDisposed: boolean;
  1442. disposeSounds(): void;
  1443. getWorldExtends(): {
  1444. min: Vector3;
  1445. max: Vector3;
  1446. };
  1447. createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
  1448. createPickingRay(x: number, y: number, world: Matrix, camera: Nullable<Camera>, cameraViewSpace?: boolean): Ray;
  1449. createPickingRayToRef(x: number, y: number, world: Matrix, result: Ray, camera: Nullable<Camera>, cameraViewSpace?: boolean): Scene;
  1450. createPickingRayInCameraSpace(x: number, y: number, camera?: Camera): Ray;
  1451. createPickingRayInCameraSpaceToRef(x: number, y: number, result: Ray, camera?: Camera): Scene;
  1452. /** Launch a ray to try to pick a mesh in the scene
  1453. * @param x position on screen
  1454. * @param y position on screen
  1455. * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true
  1456. * @param fastCheck Launch a fast check only using the bounding boxes. Can be set to null.
  1457. * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used
  1458. */
  1459. pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Nullable<Camera>): Nullable<PickingInfo>;
  1460. /** Launch a ray to try to pick a sprite in the scene
  1461. * @param x position on screen
  1462. * @param y position on screen
  1463. * @param predicate Predicate function used to determine eligible sprites. Can be set to null. In this case, a sprite must have isPickable set to true
  1464. * @param fastCheck Launch a fast check only using the bounding boxes. Can be set to null.
  1465. * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used
  1466. */
  1467. pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): Nullable<PickingInfo>;
  1468. /** Use the given ray to pick a mesh in the scene
  1469. * @param ray The ray to use to pick meshes
  1470. * @param predicate Predicate function used to determine eligible sprites. Can be set to null. In this case, a sprite must have isPickable set to true
  1471. * @param fastCheck Launch a fast check only using the bounding boxes. Can be set to null.
  1472. */
  1473. pickWithRay(ray: Ray, predicate: (mesh: AbstractMesh) => boolean, fastCheck?: boolean): Nullable<PickingInfo>;
  1474. /**
  1475. * Launch a ray to try to pick a mesh in the scene
  1476. * @param x X position on screen
  1477. * @param y Y position on screen
  1478. * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true
  1479. * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used
  1480. */
  1481. multiPick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, camera?: Camera): Nullable<PickingInfo[]>;
  1482. /**
  1483. * Launch a ray to try to pick a mesh in the scene
  1484. * @param ray Ray to use
  1485. * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true
  1486. */
  1487. multiPickWithRay(ray: Ray, predicate: (mesh: AbstractMesh) => boolean): Nullable<PickingInfo[]>;
  1488. setPointerOverMesh(mesh: Nullable<AbstractMesh>): void;
  1489. getPointerOverMesh(): Nullable<AbstractMesh>;
  1490. setPointerOverSprite(sprite: Nullable<Sprite>): void;
  1491. getPointerOverSprite(): Nullable<Sprite>;
  1492. getPhysicsEngine(): Nullable<PhysicsEngine>;
  1493. /**
  1494. * Enables physics to the current scene
  1495. * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine
  1496. * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS.
  1497. * @return {boolean} was the physics engine initialized
  1498. */
  1499. enablePhysics(gravity?: Nullable<Vector3>, plugin?: IPhysicsEnginePlugin): boolean;
  1500. disablePhysicsEngine(): void;
  1501. isPhysicsEnabled(): boolean;
  1502. deleteCompoundImpostor(compound: any): void;
  1503. createDefaultCameraOrLight(createArcRotateCamera?: boolean, replace?: boolean, attachCameraControls?: boolean): void;
  1504. createDefaultSkybox(environmentTexture?: BaseTexture, pbr?: boolean, scale?: number, blur?: number): Nullable<Mesh>;
  1505. createDefaultEnvironment(options: Partial<IEnvironmentHelperOptions>): Nullable<EnvironmentHelper>;
  1506. createDefaultVRExperience(webVROptions?: VRExperienceHelperOptions): VRExperienceHelper;
  1507. getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[];
  1508. getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[];
  1509. getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[];
  1510. getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[];
  1511. /**
  1512. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  1513. * This allowed control for front to back rendering or reversly depending of the special needs.
  1514. *
  1515. * @param renderingGroupId The rendering group id corresponding to its index
  1516. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  1517. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  1518. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  1519. */
  1520. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, alphaTestSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, transparentSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>): void;
  1521. /**
  1522. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  1523. *
  1524. * @param renderingGroupId The rendering group id corresponding to its index
  1525. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  1526. * @param depth Automatically clears depth between groups if true and autoClear is true.
  1527. * @param stencil Automatically clears stencil between groups if true and autoClear is true.
  1528. */
  1529. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth?: boolean, stencil?: boolean): void;
  1530. /**
  1531. * Will flag all materials as dirty to trigger new shader compilation
  1532. * @param predicate If not null, it will be used to specifiy if a material has to be marked as dirty
  1533. */
  1534. markAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
  1535. }
  1536. }
  1537. declare module BABYLON {
  1538. type Nullable<T> = T | null;
  1539. type float = number;
  1540. type double = number;
  1541. type int = number;
  1542. type FloatArray = number[] | Float32Array;
  1543. type IndicesArray = number[] | Int32Array | Uint32Array | Uint16Array;
  1544. }
  1545. declare module BABYLON {
  1546. class Action {
  1547. triggerOptions: any;
  1548. trigger: number;
  1549. onBeforeExecuteObservable: Observable<Action>;
  1550. constructor(triggerOptions: any, condition?: Condition);
  1551. getTriggerParameter(): any;
  1552. execute(evt?: ActionEvent): void;
  1553. skipToNextActiveAction(): void;
  1554. then(action: Action): Action;
  1555. serialize(parent: any): any;
  1556. name: string;
  1557. targetType: string;
  1558. value: string;
  1559. };
  1560. }
  1561. }
  1562. declare module BABYLON {
  1563. /**
  1564. * ActionEvent is the event beint sent when an action is triggered.
  1565. */
  1566. class ActionEvent {
  1567. source: any;
  1568. pointerX: number;
  1569. pointerY: number;
  1570. meshUnderPointer: Nullable<AbstractMesh>;
  1571. sourceEvent: any;
  1572. additionalData: any;
  1573. /**
  1574. * @param source The mesh or sprite that triggered the action.
  1575. * @param pointerX The X mouse cursor position at the time of the event
  1576. * @param pointerY The Y mouse cursor position at the time of the event
  1577. * @param meshUnderPointer The mesh that is currently pointed at (can be null)
  1578. * @param sourceEvent the original (browser) event that triggered the ActionEvent
  1579. */
  1580. constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: Nullable<AbstractMesh>, sourceEvent?: any, additionalData?: any);
  1581. /**
  1582. * Helper function to auto-create an ActionEvent from a source mesh.
  1583. * @param source The source mesh that triggered the event
  1584. * @param evt {Event} The original (browser) event
  1585. */
  1586. static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent;
  1587. /**
  1588. * Helper function to auto-create an ActionEvent from a source mesh.
  1589. * @param source The source sprite that triggered the event
  1590. * @param scene Scene associated with the sprite
  1591. * @param evt {Event} The original (browser) event
  1592. */
  1593. static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent;
  1594. /**
  1595. * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
  1596. * @param scene the scene where the event occurred
  1597. * @param evt {Event} The original (browser) event
  1598. */
  1599. static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent;
  1600. static CreateNewFromPrimitive(prim: any, pointerPos: Vector2, evt?: Event, additionalData?: any): ActionEvent;
  1601. }
  1602. /**
  1603. * Action Manager manages all events to be triggered on a given mesh or the global scene.
  1604. * A single scene can have many Action Managers to handle predefined actions on specific meshes.
  1605. */
  1606. class ActionManager {
  1607. static readonly NothingTrigger: number;
  1608. static readonly OnPickTrigger: number;
  1609. static readonly OnLeftPickTrigger: number;
  1610. static readonly OnRightPickTrigger: number;
  1611. static readonly OnCenterPickTrigger: number;
  1612. static readonly OnPickDownTrigger: number;
  1613. static readonly OnDoublePickTrigger: number;
  1614. static readonly OnPickUpTrigger: number;
  1615. static readonly OnPickOutTrigger: number;
  1616. static readonly OnLongPressTrigger: number;
  1617. static readonly OnPointerOverTrigger: number;
  1618. static readonly OnPointerOutTrigger: number;
  1619. static readonly OnEveryFrameTrigger: number;
  1620. static readonly OnIntersectionEnterTrigger: number;
  1621. static readonly OnIntersectionExitTrigger: number;
  1622. static readonly OnKeyDownTrigger: number;
  1623. static readonly OnKeyUpTrigger: number;
  1624. static Triggers: {
  1625. [key: string]: number;
  1626. };
  1627. actions: Action[];
  1628. hoverCursor: string;
  1629. constructor(scene: Scene);
  1630. dispose(): void;
  1631. getScene(): Scene;
  1632. /**
  1633. * Does this action manager handles actions of any of the given triggers
  1634. * @param {number[]} triggers - the triggers to be tested
  1635. * @return {boolean} whether one (or more) of the triggers is handeled
  1636. */
  1637. hasSpecificTriggers(triggers: number[]): boolean;
  1638. /**
  1639. * Does this action manager handles actions of a given trigger
  1640. * @param {number} trigger - the trigger to be tested
  1641. * @return {boolean} whether the trigger is handeled
  1642. */
  1643. hasSpecificTrigger(trigger: number): boolean;
  1644. /**
  1645. * Does this action manager has pointer triggers
  1646. * @return {boolean} whether or not it has pointer triggers
  1647. */
  1648. readonly hasPointerTriggers: boolean;
  1649. /**
  1650. * Does this action manager has pick triggers
  1651. * @return {boolean} whether or not it has pick triggers
  1652. */
  1653. readonly hasPickTriggers: boolean;
  1654. /**
  1655. * Does exist one action manager with at least one trigger
  1656. * @return {boolean} whether or not it exists one action manager with one trigger
  1657. **/
  1658. static readonly HasTriggers: boolean;
  1659. /**
  1660. * Does exist one action manager with at least one pick trigger
  1661. * @return {boolean} whether or not it exists one action manager with one pick trigger
  1662. **/
  1663. static readonly HasPickTriggers: boolean;
  1664. /**
  1665. * Does exist one action manager that handles actions of a given trigger
  1666. * @param {number} trigger - the trigger to be tested
  1667. * @return {boolean} whether the trigger is handeled by at least one action manager
  1668. **/
  1669. static HasSpecificTrigger(trigger: number): boolean;
  1670. /**
  1671. * Registers an action to this action manager
  1672. * @param {BABYLON.Action} action - the action to be registered
  1673. * @return {BABYLON.Action} the action amended (prepared) after registration
  1674. */
  1675. registerAction(action: Action): Nullable<Action>;
  1676. /**
  1677. * Process a specific trigger
  1678. * @param {number} trigger - the trigger to process
  1679. * @param evt {BABYLON.ActionEvent} the event details to be processed
  1680. */
  1681. processTrigger(trigger: number, evt?: ActionEvent): void;
  1682. serialize(name: string): any;
  1683. static Parse(parsedActions: any, object: Nullable<AbstractMesh>, scene: Scene): void;
  1684. static GetTriggerName(trigger: number): string;
  1685. }
  1686. }
  1687. declare module BABYLON {
  1688. class Condition {
  1689. constructor(actionManager: ActionManager);
  1690. isValid(): boolean;
  1691. serialize(): any;
  1692. }
  1693. class ValueCondition extends Condition {
  1694. propertyPath: string;
  1695. value: any;
  1696. operator: number;
  1697. static readonly IsEqual: number;
  1698. static readonly IsDifferent: number;
  1699. static readonly IsGreater: number;
  1700. static readonly IsLesser: number;
  1701. constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number);
  1702. isValid(): boolean;
  1703. serialize(): any;
  1704. static GetOperatorName(operator: number): string;
  1705. }
  1706. class PredicateCondition extends Condition {
  1707. predicate: () => boolean;
  1708. constructor(actionManager: ActionManager, predicate: () => boolean);
  1709. isValid(): boolean;
  1710. }
  1711. class StateCondition extends Condition {
  1712. value: string;
  1713. constructor(actionManager: ActionManager, target: any, value: string);
  1714. isValid(): boolean;
  1715. serialize(): any;
  1716. }
  1717. }
  1718. declare module BABYLON {
  1719. class SwitchBooleanAction extends Action {
  1720. propertyPath: string;
  1721. constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
  1722. execute(): void;
  1723. serialize(parent: any): any;
  1724. }
  1725. class SetStateAction extends Action {
  1726. value: string;
  1727. constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
  1728. execute(): void;
  1729. serialize(parent: any): any;
  1730. }
  1731. class SetValueAction extends Action {
  1732. propertyPath: string;
  1733. value: any;
  1734. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  1735. execute(): void;
  1736. serialize(parent: any): any;
  1737. }
  1738. class IncrementValueAction extends Action {
  1739. propertyPath: string;
  1740. value: any;
  1741. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  1742. execute(): void;
  1743. serialize(parent: any): any;
  1744. }
  1745. class PlayAnimationAction extends Action {
  1746. from: number;
  1747. to: number;
  1748. loop: boolean | undefined;
  1749. constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean | undefined, condition?: Condition);
  1750. execute(): void;
  1751. serialize(parent: any): any;
  1752. }
  1753. class StopAnimationAction extends Action {
  1754. constructor(triggerOptions: any, target: any, condition?: Condition);
  1755. execute(): void;
  1756. serialize(parent: any): any;
  1757. }
  1758. class DoNothingAction extends Action {
  1759. constructor(triggerOptions?: any, condition?: Condition);
  1760. execute(): void;
  1761. serialize(parent: any): any;
  1762. }
  1763. class CombineAction extends Action {
  1764. children: Action[];
  1765. constructor(triggerOptions: any, children: Action[], condition?: Condition);
  1766. execute(evt: ActionEvent): void;
  1767. serialize(parent: any): any;
  1768. }
  1769. class ExecuteCodeAction extends Action {
  1770. func: (evt: ActionEvent) => void;
  1771. constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
  1772. execute(evt: ActionEvent): void;
  1773. }
  1774. class SetParentAction extends Action {
  1775. constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
  1776. execute(): void;
  1777. serialize(parent: any): any;
  1778. }
  1779. class PlaySoundAction extends Action {
  1780. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  1781. execute(): void;
  1782. serialize(parent: any): any;
  1783. }
  1784. class StopSoundAction extends Action {
  1785. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  1786. execute(): void;
  1787. serialize(parent: any): any;
  1788. }
  1789. }
  1790. declare module BABYLON {
  1791. class InterpolateValueAction extends Action {
  1792. propertyPath: string;
  1793. value: any;
  1794. duration: number;
  1795. stopOtherAnimations: boolean | undefined;
  1796. onInterpolationDone: (() => void) | undefined;
  1797. onInterpolationDoneObservable: Observable<InterpolateValueAction>;
  1798. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean | undefined, onInterpolationDone?: (() => void) | undefined);
  1799. execute(): void;
  1800. serialize(parent: any): any;
  1801. }
  1802. }
  1803. declare module BABYLON {
  1804. class Animatable {
  1805. target: any;
  1806. fromFrame: number;
  1807. toFrame: number;
  1808. loopAnimation: boolean;
  1809. onAnimationEnd: (() => void) | null | undefined;
  1810. animationStarted: boolean;
  1811. speedRatio: number;
  1812. constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: (() => void) | null | undefined, animations?: any);
  1813. getAnimations(): RuntimeAnimation[];
  1814. appendAnimations(target: any, animations: Animation[]): void;
  1815. getAnimationByTargetProperty(property: string): Nullable<Animation>;
  1816. getRuntimeAnimationByTargetProperty(property: string): Nullable<RuntimeAnimation>;
  1817. reset(): void;
  1818. enableBlending(blendingSpeed: number): void;
  1819. disableBlending(): void;
  1820. goToFrame(frame: number): void;
  1821. pause(): void;
  1822. restart(): void;
  1823. stop(animationName?: string): void;
  1824. }
  1825. }
  1826. declare module BABYLON {
  1827. class AnimationRange {
  1828. name: string;
  1829. from: number;
  1830. to: number;
  1831. constructor(name: string, from: number, to: number);
  1832. clone(): AnimationRange;
  1833. }
  1834. /**
  1835. * Composed of a frame, and an action function
  1836. */
  1837. class AnimationEvent {
  1838. frame: number;
  1839. action: () => void;
  1840. onlyOnce: boolean | undefined;
  1841. isDone: boolean;
  1842. constructor(frame: number, action: () => void, onlyOnce?: boolean | undefined);
  1843. }
  1844. class PathCursor {
  1845. value: number;
  1846. animations: Animation[];
  1847. constructor(path: Path2);
  1848. getPoint(): Vector3;
  1849. moveAhead(step?: number): PathCursor;
  1850. moveBack(step?: number): PathCursor;
  1851. move(step: number): PathCursor;
  1852. onchange(f: (cursor: PathCursor) => void): PathCursor;
  1853. }
  1854. class Animation {
  1855. name: string;
  1856. targetProperty: string;
  1857. framePerSecond: number;
  1858. dataType: number;
  1859. loopMode: number | undefined;
  1860. enableBlending: boolean | undefined;
  1861. static AllowMatricesInterpolation: boolean;
  1862. targetPropertyPath: string[];
  1863. blendingSpeed: number;
  1864. /**
  1865. * Sets up an animation.
  1866. * @param property the property to animate
  1867. * @param animationType the animation type to apply
  1868. * @param easingFunction the easing function used in the animation
  1869. * @returns The created animation
  1870. */
  1871. static CreateAnimation(property: string, animationType: number, framePerSecond: number, easingFunction: EasingFunction): Animation;
  1872. static CreateAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Nullable<Animatable>;
  1873. static CreateMergeAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Nullable<Animatable>;
  1874. /**
  1875. * Transition property of the Camera to the target Value.
  1876. * @param property The property to transition
  1877. * @param targetValue The target Value of the property
  1878. * @param host The object where the property to animate belongs
  1879. * @param scene Scene used to run the animation
  1880. * @param frameRate Framerate (in frame/s) to use
  1881. * @param transition The transition type we want to use
  1882. * @param duration The duration of the animation, in milliseconds
  1883. * @param onAnimationEnd Call back trigger at the end of the animation.
  1884. */
  1885. static TransitionTo(property: string, targetValue: any, host: any, scene: Scene, frameRate: number, transition: Animation, duration: number, onAnimationEnd?: Nullable<() => void>): Nullable<Animatable>;
  1886. /**
  1887. * Return the array of runtime animations currently using this animation
  1888. */
  1889. readonly runtimeAnimations: RuntimeAnimation[];
  1890. readonly hasRunningRuntimeAnimations: boolean;
  1891. constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number | undefined, enableBlending?: boolean | undefined);
  1892. /**
  1893. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  1894. */
  1895. toString(fullDetails?: boolean): string;
  1896. /**
  1897. * Add an event to this animation.
  1898. */
  1899. addEvent(event: AnimationEvent): void;
  1900. /**
  1901. * Remove all events found at the given frame
  1902. * @param frame
  1903. */
  1904. removeEvents(frame: number): void;
  1905. getEvents(): AnimationEvent[];
  1906. createRange(name: string, from: number, to: number): void;
  1907. deleteRange(name: string, deleteFrames?: boolean): void;
  1908. getRange(name: string): Nullable<AnimationRange>;
  1909. getKeys(): Array<{
  1910. frame: number;
  1911. value: any;
  1912. inTangent?: any;
  1913. outTangent?: any;
  1914. }>;
  1915. getHighestFrame(): number;
  1916. getEasingFunction(): IEasingFunction;
  1917. setEasingFunction(easingFunction: EasingFunction): void;
  1918. floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
  1919. floatInterpolateFunctionWithTangents(startValue: number, outTangent: number, endValue: number, inTangent: number, gradient: number): number;
  1920. quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
  1921. quaternionInterpolateFunctionWithTangents(startValue: Quaternion, outTangent: Quaternion, endValue: Quaternion, inTangent: Quaternion, gradient: number): Quaternion;
  1922. vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
  1923. vector3InterpolateFunctionWithTangents(startValue: Vector3, outTangent: Vector3, endValue: Vector3, inTangent: Vector3, gradient: number): Vector3;
  1924. vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2;
  1925. vector2InterpolateFunctionWithTangents(startValue: Vector2, outTangent: Vector2, endValue: Vector2, inTangent: Vector2, gradient: number): Vector2;
  1926. sizeInterpolateFunction(startValue: Size, endValue: Size, gradient: number): Size;
  1927. color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
  1928. matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  1929. clone(): Animation;
  1930. setKeys(values: Array<{
  1931. frame: number;
  1932. value: any;
  1933. }>): void;
  1934. serialize(): any;
  1935. static readonly ANIMATIONTYPE_FLOAT: number;
  1936. static readonly ANIMATIONTYPE_VECTOR3: number;
  1937. static readonly ANIMATIONTYPE_VECTOR2: number;
  1938. static readonly ANIMATIONTYPE_SIZE: number;
  1939. static readonly ANIMATIONTYPE_QUATERNION: number;
  1940. static readonly ANIMATIONTYPE_MATRIX: number;
  1941. static readonly ANIMATIONTYPE_COLOR3: number;
  1942. static readonly ANIMATIONLOOPMODE_RELATIVE: number;
  1943. static readonly ANIMATIONLOOPMODE_CYCLE: number;
  1944. static readonly ANIMATIONLOOPMODE_CONSTANT: number;
  1945. static Parse(parsedAnimation: any): Animation;
  1946. static AppendSerializedAnimations(source: IAnimatable, destination: any): any;
  1947. }
  1948. }
  1949. declare module BABYLON {
  1950. /**
  1951. * This class defines the direct association between an animation and a target
  1952. */
  1953. class TargetedAnimation {
  1954. animation: Animation;
  1955. target: any;
  1956. }
  1957. /**
  1958. * Use this class to create coordinated animations on multiple targets
  1959. */
  1960. class AnimationGroup implements IDisposable {
  1961. name: string;
  1962. onAnimationEndObservable: Observable<TargetedAnimation>;
  1963. /**
  1964. * Define if the animations are started
  1965. */
  1966. readonly isStarted: boolean;
  1967. /**
  1968. * Gets or sets the speed ratio to use for all animations
  1969. */
  1970. /**
  1971. * Gets or sets the speed ratio to use for all animations
  1972. */
  1973. speedRatio: number;
  1974. constructor(name: string, scene?: Nullable<Scene>);
  1975. /**
  1976. * Add an animation (with its target) in the group
  1977. * @param animation defines the animation we want to add
  1978. * @param target defines the target of the animation
  1979. * @returns the {BABYLON.TargetedAnimation} object
  1980. */
  1981. addTargetedAnimation(animation: Animation, target: any): TargetedAnimation;
  1982. /**
  1983. * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame
  1984. * It can add constant keys at begin or end
  1985. * @param beginFrame defines the new begin frame for all animations. It can't be bigger than the smaller begin frame of all animations
  1986. * @param endFrame defines the new end frame for all animations. It can't be smaller than the larger end frame of all animations
  1987. */
  1988. normalize(beginFrame: number, endFrame: number): AnimationGroup;
  1989. /**
  1990. * Start all animations on given targets
  1991. * @param loop defines if animations must loop
  1992. * @param speedRatio defines the ratio to apply to animation speed (1 by default)
  1993. */
  1994. start(loop?: boolean, speedRatio?: number): AnimationGroup;
  1995. /**
  1996. * Pause all animations
  1997. */
  1998. pause(): AnimationGroup;
  1999. /**
  2000. * Play all animations to initial state
  2001. * This function will start() the animations if they were not started or will restart() them if they were paused
  2002. * @param loop defines if animations must loop
  2003. */
  2004. play(loop?: boolean): AnimationGroup;
  2005. /**
  2006. * Reset all animations to initial state
  2007. */
  2008. reset(): AnimationGroup;
  2009. /**
  2010. * Restart animations from key 0
  2011. */
  2012. restart(): AnimationGroup;
  2013. /**
  2014. * Stop all animations
  2015. */
  2016. stop(): AnimationGroup;
  2017. /**
  2018. * Dispose all associated resources
  2019. */
  2020. dispose(): void;
  2021. }
  2022. }
  2023. declare module BABYLON {
  2024. interface IEasingFunction {
  2025. ease(gradient: number): number;
  2026. }
  2027. class EasingFunction implements IEasingFunction {
  2028. static readonly EASINGMODE_EASEIN: number;
  2029. static readonly EASINGMODE_EASEOUT: number;
  2030. static readonly EASINGMODE_EASEINOUT: number;
  2031. setEasingMode(easingMode: number): void;
  2032. getEasingMode(): number;
  2033. easeInCore(gradient: number): number;
  2034. ease(gradient: number): number;
  2035. }
  2036. class CircleEase extends EasingFunction implements IEasingFunction {
  2037. easeInCore(gradient: number): number;
  2038. }
  2039. class BackEase extends EasingFunction implements IEasingFunction {
  2040. amplitude: number;
  2041. constructor(amplitude?: number);
  2042. easeInCore(gradient: number): number;
  2043. }
  2044. class BounceEase extends EasingFunction implements IEasingFunction {
  2045. bounces: number;
  2046. bounciness: number;
  2047. constructor(bounces?: number, bounciness?: number);
  2048. easeInCore(gradient: number): number;
  2049. }
  2050. class CubicEase extends EasingFunction implements IEasingFunction {
  2051. easeInCore(gradient: number): number;
  2052. }
  2053. class ElasticEase extends EasingFunction implements IEasingFunction {
  2054. oscillations: number;
  2055. springiness: number;
  2056. constructor(oscillations?: number, springiness?: number);
  2057. easeInCore(gradient: number): number;
  2058. }
  2059. class ExponentialEase extends EasingFunction implements IEasingFunction {
  2060. exponent: number;
  2061. constructor(exponent?: number);
  2062. easeInCore(gradient: number): number;
  2063. }
  2064. class PowerEase extends EasingFunction implements IEasingFunction {
  2065. power: number;
  2066. constructor(power?: number);
  2067. easeInCore(gradient: number): number;
  2068. }
  2069. class QuadraticEase extends EasingFunction implements IEasingFunction {
  2070. easeInCore(gradient: number): number;
  2071. }
  2072. class QuarticEase extends EasingFunction implements IEasingFunction {
  2073. easeInCore(gradient: number): number;
  2074. }
  2075. class QuinticEase extends EasingFunction implements IEasingFunction {
  2076. easeInCore(gradient: number): number;
  2077. }
  2078. class SineEase extends EasingFunction implements IEasingFunction {
  2079. easeInCore(gradient: number): number;
  2080. }
  2081. class BezierCurveEase extends EasingFunction implements IEasingFunction {
  2082. x1: number;
  2083. y1: number;
  2084. x2: number;
  2085. y2: number;
  2086. constructor(x1?: number, y1?: number, x2?: number, y2?: number);
  2087. easeInCore(gradient: number): number;
  2088. }
  2089. }
  2090. declare module BABYLON {
  2091. class RuntimeAnimation {
  2092. currentFrame: number;
  2093. constructor(target: any, animation: Animation);
  2094. readonly animation: Animation;
  2095. reset(): void;
  2096. isStopped(): boolean;
  2097. dispose(): void;
  2098. setValue(currentValue: any, blend?: boolean): void;
  2099. goToFrame(frame: number): void;
  2100. animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, blend?: boolean): boolean;
  2101. }
  2102. }
  2103. declare module BABYLON {
  2104. class Analyser {
  2105. SMOOTHING: number;
  2106. FFT_SIZE: number;
  2107. BARGRAPHAMPLITUDE: number;
  2108. DEBUGCANVASPOS: {
  2109. x: number;
  2110. y: number;
  2111. };
  2112. DEBUGCANVASSIZE: {
  2113. width: number;
  2114. height: number;
  2115. };
  2116. constructor(scene: Scene);
  2117. getFrequencyBinCount(): number;
  2118. getByteFrequencyData(): Uint8Array;
  2119. getByteTimeDomainData(): Uint8Array;
  2120. getFloatFrequencyData(): Uint8Array;
  2121. drawDebugCanvas(): void;
  2122. stopDebugCanvas(): void;
  2123. connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void;
  2124. dispose(): void;
  2125. }
  2126. }
  2127. declare module BABYLON {
  2128. class AudioEngine {
  2129. canUseWebAudio: boolean;
  2130. masterGain: GainNode;
  2131. WarnedWebAudioUnsupported: boolean;
  2132. unlocked: boolean;
  2133. onAudioUnlocked: () => any;
  2134. isMP3supported: boolean;
  2135. isOGGsupported: boolean;
  2136. readonly audioContext: Nullable<AudioContext>;
  2137. constructor();
  2138. dispose(): void;
  2139. getGlobalVolume(): number;
  2140. setGlobalVolume(newVolume: number): void;
  2141. connectToAnalyser(analyser: Analyser): void;
  2142. }
  2143. }
  2144. declare module BABYLON {
  2145. class Sound {
  2146. name: string;
  2147. autoplay: boolean;
  2148. loop: boolean;
  2149. useCustomAttenuation: boolean;
  2150. soundTrackId: number;
  2151. spatialSound: boolean;
  2152. refDistance: number;
  2153. rolloffFactor: number;
  2154. maxDistance: number;
  2155. distanceModel: string;
  2156. onended: () => any;
  2157. isPlaying: boolean;
  2158. isPaused: boolean;
  2159. /**
  2160. * Create a sound and attach it to a scene
  2161. * @param name Name of your sound
  2162. * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer
  2163. * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played
  2164. * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming
  2165. */
  2166. constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: Nullable<() => void>, options?: any);
  2167. dispose(): void;
  2168. isReady(): boolean;
  2169. setAudioBuffer(audioBuffer: AudioBuffer): void;
  2170. updateOptions(options: any): void;
  2171. switchPanningModelToHRTF(): void;
  2172. switchPanningModelToEqualPower(): void;
  2173. connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void;
  2174. /**
  2175. * Transform this sound into a directional source
  2176. * @param coneInnerAngle Size of the inner cone in degree
  2177. * @param coneOuterAngle Size of the outer cone in degree
  2178. * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)
  2179. */
  2180. setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void;
  2181. setPosition(newPosition: Vector3): void;
  2182. setLocalDirectionToMesh(newLocalDirection: Vector3): void;
  2183. updateDistanceFromListener(): void;
  2184. setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void;
  2185. /**
  2186. * Play the sound
  2187. * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
  2188. * @param offset (optional) Start the sound setting it at a specific time
  2189. */
  2190. play(time?: number, offset?: number): void;
  2191. /**
  2192. * Stop the sound
  2193. * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.
  2194. */
  2195. stop(time?: number): void;
  2196. pause(): void;
  2197. setVolume(newVolume: number, time?: number): void;
  2198. setPlaybackRate(newPlaybackRate: number): void;
  2199. getVolume(): number;
  2200. attachToMesh(meshToConnectTo: AbstractMesh): void;
  2201. detachFromMesh(): void;
  2202. clone(): Nullable<Sound>;
  2203. getAudioBuffer(): AudioBuffer | null;
  2204. serialize(): any;
  2205. static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound;
  2206. }
  2207. }
  2208. declare module BABYLON {
  2209. class SoundTrack {
  2210. id: number;
  2211. soundCollection: Array<Sound>;
  2212. constructor(scene: Scene, options?: any);
  2213. dispose(): void;
  2214. AddSound(sound: Sound): void;
  2215. RemoveSound(sound: Sound): void;
  2216. setVolume(newVolume: number): void;
  2217. switchPanningModelToHRTF(): void;
  2218. switchPanningModelToEqualPower(): void;
  2219. connectToAnalyser(analyser: Analyser): void;
  2220. }
  2221. }
  2222. declare module BABYLON {
  2223. interface Behavior<T extends Node> {
  2224. name: string;
  2225. init(): void;
  2226. attach(node: T): void;
  2227. detach(): void;
  2228. }
  2229. }
  2230. declare module BABYLON {
  2231. class Bone extends Node {
  2232. name: string;
  2233. children: Bone[];
  2234. animations: Animation[];
  2235. length: number;
  2236. constructor(name: string, skeleton: Skeleton, parentBone?: Nullable<Bone>, localMatrix?: Nullable<Matrix>, restPose?: Nullable<Matrix>, baseMatrix?: Nullable<Matrix>, index?: Nullable<number>);
  2237. getSkeleton(): Skeleton;
  2238. getParent(): Nullable<Bone>;
  2239. setParent(parent: Nullable<Bone>, updateDifferenceMatrix?: boolean): void;
  2240. getLocalMatrix(): Matrix;
  2241. getBaseMatrix(): Matrix;
  2242. getRestPose(): Matrix;
  2243. returnToRest(): void;
  2244. getWorldMatrix(): Matrix;
  2245. getInvertedAbsoluteTransform(): Matrix;
  2246. getAbsoluteTransform(): Matrix;
  2247. position: Vector3;
  2248. rotation: Vector3;
  2249. rotationQuaternion: Quaternion;
  2250. scaling: Vector3;
  2251. updateMatrix(matrix: Matrix, updateDifferenceMatrix?: boolean): void;
  2252. markAsDirty(): void;
  2253. copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired?: boolean, skelDimensionsRatio?: Nullable<Vector3>): boolean;
  2254. /**
  2255. * Translate the bone in local or world space.
  2256. * @param vec The amount to translate the bone.
  2257. * @param space The space that the translation is in.
  2258. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2259. */
  2260. translate(vec: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2261. /**
  2262. * Set the postion of the bone in local or world space.
  2263. * @param position The position to set the bone.
  2264. * @param space The space that the position is in.
  2265. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2266. */
  2267. setPosition(position: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2268. /**
  2269. * Set the absolute postion of the bone (world space).
  2270. * @param position The position to set the bone.
  2271. * @param mesh The mesh that this bone is attached to.
  2272. */
  2273. setAbsolutePosition(position: Vector3, mesh?: AbstractMesh): void;
  2274. /**
  2275. * Set the scale of the bone on the x, y and z axes.
  2276. * @param x The scale of the bone on the x axis.
  2277. * @param x The scale of the bone on the y axis.
  2278. * @param z The scale of the bone on the z axis.
  2279. * @param scaleChildren Set this to true if children of the bone should be scaled.
  2280. */
  2281. setScale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  2282. /**
  2283. * Scale the bone on the x, y and z axes.
  2284. * @param x The amount to scale the bone on the x axis.
  2285. * @param x The amount to scale the bone on the y axis.
  2286. * @param z The amount to scale the bone on the z axis.
  2287. * @param scaleChildren Set this to true if children of the bone should be scaled.
  2288. */
  2289. scale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  2290. /**
  2291. * Set the yaw, pitch, and roll of the bone in local or world space.
  2292. * @param yaw The rotation of the bone on the y axis.
  2293. * @param pitch The rotation of the bone on the x axis.
  2294. * @param roll The rotation of the bone on the z axis.
  2295. * @param space The space that the axes of rotation are in.
  2296. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2297. */
  2298. setYawPitchRoll(yaw: number, pitch: number, roll: number, space?: Space, mesh?: AbstractMesh): void;
  2299. /**
  2300. * Rotate the bone on an axis in local or world space.
  2301. * @param axis The axis to rotate the bone on.
  2302. * @param amount The amount to rotate the bone.
  2303. * @param space The space that the axis is in.
  2304. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2305. */
  2306. rotate(axis: Vector3, amount: number, space?: Space, mesh?: AbstractMesh): void;
  2307. /**
  2308. * Set the rotation of the bone to a particular axis angle in local or world space.
  2309. * @param axis The axis to rotate the bone on.
  2310. * @param angle The angle that the bone should be rotated to.
  2311. * @param space The space that the axis is in.
  2312. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2313. */
  2314. setAxisAngle(axis: Vector3, angle: number, space?: Space, mesh?: AbstractMesh): void;
  2315. /**
  2316. * Set the euler rotation of the bone in local of world space.
  2317. * @param rotation The euler rotation that the bone should be set to.
  2318. * @param space The space that the rotation is in.
  2319. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2320. */
  2321. setRotation(rotation: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2322. /**
  2323. * Set the quaternion rotation of the bone in local of world space.
  2324. * @param quat The quaternion rotation that the bone should be set to.
  2325. * @param space The space that the rotation is in.
  2326. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2327. */
  2328. setRotationQuaternion(quat: Quaternion, space?: Space, mesh?: AbstractMesh): void;
  2329. /**
  2330. * Set the rotation matrix of the bone in local of world space.
  2331. * @param rotMat The rotation matrix that the bone should be set to.
  2332. * @param space The space that the rotation is in.
  2333. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2334. */
  2335. setRotationMatrix(rotMat: Matrix, space?: Space, mesh?: AbstractMesh): void;
  2336. /**
  2337. * Get the scale of the bone
  2338. * @returns the scale of the bone
  2339. */
  2340. getScale(): Vector3;
  2341. /**
  2342. * Copy the scale of the bone to a vector3.
  2343. * @param result The vector3 to copy the scale to
  2344. */
  2345. getScaleToRef(result: Vector3): void;
  2346. /**
  2347. * Get the position of the bone in local or world space.
  2348. * @param space The space that the returned position is in.
  2349. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2350. * @returns The position of the bone
  2351. */
  2352. getPosition(space?: Space, mesh?: Nullable<AbstractMesh>): Vector3;
  2353. /**
  2354. * Copy the position of the bone to a vector3 in local or world space.
  2355. * @param space The space that the returned position is in.
  2356. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2357. * @param result The vector3 to copy the position to.
  2358. */
  2359. getPositionToRef(space: Space | undefined, mesh: Nullable<AbstractMesh>, result: Vector3): void;
  2360. /**
  2361. * Get the absolute position of the bone (world space).
  2362. * @param mesh The mesh that this bone is attached to.
  2363. * @returns The absolute position of the bone
  2364. */
  2365. getAbsolutePosition(mesh?: Nullable<AbstractMesh>): Vector3;
  2366. /**
  2367. * Copy the absolute position of the bone (world space) to the result param.
  2368. * @param mesh The mesh that this bone is attached to.
  2369. * @param result The vector3 to copy the absolute position to.
  2370. */
  2371. getAbsolutePositionToRef(mesh: AbstractMesh, result: Vector3): void;
  2372. /**
  2373. * Compute the absolute transforms of this bone and its children.
  2374. */
  2375. computeAbsoluteTransforms(): void;
  2376. /**
  2377. * Get the world direction from an axis that is in the local space of the bone.
  2378. * @param localAxis The local direction that is used to compute the world direction.
  2379. * @param mesh The mesh that this bone is attached to.
  2380. * @returns The world direction
  2381. */
  2382. getDirection(localAxis: Vector3, mesh?: Nullable<AbstractMesh>): Vector3;
  2383. /**
  2384. * Copy the world direction to a vector3 from an axis that is in the local space of the bone.
  2385. * @param localAxis The local direction that is used to compute the world direction.
  2386. * @param mesh The mesh that this bone is attached to.
  2387. * @param result The vector3 that the world direction will be copied to.
  2388. */
  2389. getDirectionToRef(localAxis: Vector3, mesh: AbstractMesh | null | undefined, result: Vector3): void;
  2390. /**
  2391. * Get the euler rotation of the bone in local or world space.
  2392. * @param space The space that the rotation should be in.
  2393. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2394. * @returns The euler rotation
  2395. */
  2396. getRotation(space?: Space, mesh?: Nullable<AbstractMesh>): Vector3;
  2397. /**
  2398. * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space.
  2399. * @param space The space that the rotation should be in.
  2400. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2401. * @param result The vector3 that the rotation should be copied to.
  2402. */
  2403. getRotationToRef(space: Space | undefined, mesh: AbstractMesh | null | undefined, result: Vector3): void;
  2404. /**
  2405. * Get the quaternion rotation of the bone in either local or world space.
  2406. * @param space The space that the rotation should be in.
  2407. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2408. * @returns The quaternion rotation
  2409. */
  2410. getRotationQuaternion(space?: Space, mesh?: Nullable<AbstractMesh>): Quaternion;
  2411. /**
  2412. * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space.
  2413. * @param space The space that the rotation should be in.
  2414. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2415. * @param result The quaternion that the rotation should be copied to.
  2416. */
  2417. getRotationQuaternionToRef(space: Space | undefined, mesh: AbstractMesh | null | undefined, result: Quaternion): void;
  2418. /**
  2419. * Get the rotation matrix of the bone in local or world space.
  2420. * @param space The space that the rotation should be in.
  2421. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2422. * @returns The rotation matrix
  2423. */
  2424. getRotationMatrix(space: Space | undefined, mesh: AbstractMesh): Matrix;
  2425. /**
  2426. * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space.
  2427. * @param space The space that the rotation should be in.
  2428. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2429. * @param result The quaternion that the rotation should be copied to.
  2430. */
  2431. getRotationMatrixToRef(space: Space | undefined, mesh: AbstractMesh, result: Matrix): void;
  2432. /**
  2433. * Get the world position of a point that is in the local space of the bone.
  2434. * @param position The local position
  2435. * @param mesh The mesh that this bone is attached to.
  2436. * @returns The world position
  2437. */
  2438. getAbsolutePositionFromLocal(position: Vector3, mesh?: Nullable<AbstractMesh>): Vector3;
  2439. /**
  2440. * Get the world position of a point that is in the local space of the bone and copy it to the result param.
  2441. * @param position The local position
  2442. * @param mesh The mesh that this bone is attached to.
  2443. * @param result The vector3 that the world position should be copied to.
  2444. */
  2445. getAbsolutePositionFromLocalToRef(position: Vector3, mesh: AbstractMesh | null | undefined, result: Vector3): void;
  2446. /**
  2447. * Get the local position of a point that is in world space.
  2448. * @param position The world position
  2449. * @param mesh The mesh that this bone is attached to.
  2450. * @returns The local position
  2451. */
  2452. getLocalPositionFromAbsolute(position: Vector3, mesh?: Nullable<AbstractMesh>): Vector3;
  2453. /**
  2454. * Get the local position of a point that is in world space and copy it to the result param.
  2455. * @param position The world position
  2456. * @param mesh The mesh that this bone is attached to.
  2457. * @param result The vector3 that the local position should be copied to.
  2458. */
  2459. getLocalPositionFromAbsoluteToRef(position: Vector3, mesh: AbstractMesh | null | undefined, result: Vector3): void;
  2460. }
  2461. }
  2462. declare module BABYLON {
  2463. class BoneIKController {
  2464. targetMesh: AbstractMesh;
  2465. poleTargetMesh: AbstractMesh;
  2466. poleTargetBone: Nullable<Bone>;
  2467. targetPosition: Vector3;
  2468. poleTargetPosition: Vector3;
  2469. poleTargetLocalOffset: Vector3;
  2470. poleAngle: number;
  2471. mesh: AbstractMesh;
  2472. slerpAmount: number;
  2473. maxAngle: number;
  2474. constructor(mesh: AbstractMesh, bone: Bone, options?: {
  2475. targetMesh?: AbstractMesh;
  2476. poleTargetMesh?: AbstractMesh;
  2477. poleTargetBone?: Bone;
  2478. poleTargetLocalOffset?: Vector3;
  2479. poleAngle?: number;
  2480. bendAxis?: Vector3;
  2481. maxAngle?: number;
  2482. slerpAmount?: number;
  2483. });
  2484. update(): void;
  2485. }
  2486. }
  2487. declare module BABYLON {
  2488. class BoneLookController {
  2489. /**
  2490. * The target Vector3 that the bone will look at.
  2491. */
  2492. target: Vector3;
  2493. /**
  2494. * The mesh that the bone is attached to.
  2495. */
  2496. mesh: AbstractMesh;
  2497. /**
  2498. * The bone that will be looking to the target.
  2499. */
  2500. bone: Bone;
  2501. /**
  2502. * The up axis of the coordinate system that is used when the bone is rotated.
  2503. */
  2504. upAxis: Vector3;
  2505. /**
  2506. * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
  2507. */
  2508. upAxisSpace: Space;
  2509. /**
  2510. * Used to make an adjustment to the yaw of the bone.
  2511. */
  2512. adjustYaw: number;
  2513. /**
  2514. * Used to make an adjustment to the pitch of the bone.
  2515. */
  2516. adjustPitch: number;
  2517. /**
  2518. * Used to make an adjustment to the roll of the bone.
  2519. */
  2520. adjustRoll: number;
  2521. /**
  2522. * The amount to slerp (spherical linear interpolation) to the target. Set this to a value between 0 and 1 (a value of 1 disables slerp).
  2523. */
  2524. slerpAmount: number;
  2525. /**
  2526. * Get/set the minimum yaw angle that the bone can look to.
  2527. */
  2528. minYaw: number;
  2529. /**
  2530. * Get/set the maximum yaw angle that the bone can look to.
  2531. */
  2532. maxYaw: number;
  2533. /**
  2534. * Get/set the minimum pitch angle that the bone can look to.
  2535. */
  2536. minPitch: number;
  2537. /**
  2538. * Get/set the maximum pitch angle that the bone can look to.
  2539. */
  2540. maxPitch: number;
  2541. /**
  2542. * Create a BoneLookController
  2543. * @param mesh the mesh that the bone belongs to
  2544. * @param bone the bone that will be looking to the target
  2545. * @param target the target Vector3 to look at
  2546. * @param settings optional settings:
  2547. * - maxYaw: the maximum angle the bone will yaw to
  2548. * - minYaw: the minimum angle the bone will yaw to
  2549. * - maxPitch: the maximum angle the bone will pitch to
  2550. * - minPitch: the minimum angle the bone will yaw to
  2551. * - slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
  2552. * - upAxis: the up axis of the coordinate system
  2553. * - upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
  2554. * - yawAxis: set yawAxis if the bone does not yaw on the y axis
  2555. * - pitchAxis: set pitchAxis if the bone does not pitch on the x axis
  2556. * - adjustYaw: used to make an adjustment to the yaw of the bone
  2557. * - adjustPitch: used to make an adjustment to the pitch of the bone
  2558. * - adjustRoll: used to make an adjustment to the roll of the bone
  2559. **/
  2560. constructor(mesh: AbstractMesh, bone: Bone, target: Vector3, options?: {
  2561. maxYaw?: number;
  2562. minYaw?: number;
  2563. maxPitch?: number;
  2564. minPitch?: number;
  2565. slerpAmount?: number;
  2566. upAxis?: Vector3;
  2567. upAxisSpace?: Space;
  2568. yawAxis?: Vector3;
  2569. pitchAxis?: Vector3;
  2570. adjustYaw?: number;
  2571. adjustPitch?: number;
  2572. adjustRoll?: number;
  2573. });
  2574. /**
  2575. * Update the bone to look at the target. This should be called before the scene is rendered (use scene.registerBeforeRender()).
  2576. */
  2577. update(): void;
  2578. }
  2579. }
  2580. declare module BABYLON {
  2581. class Skeleton implements IAnimatable {
  2582. name: string;
  2583. id: string;
  2584. bones: Bone[];
  2585. dimensionsAtRest: Vector3;
  2586. needInitialSkinMatrix: boolean;
  2587. animations: Array<Animation>;
  2588. /**
  2589. * An event triggered before computing the skeleton's matrices
  2590. * @type {BABYLON.Observable}
  2591. */
  2592. onBeforeComputeObservable: Observable<Skeleton>;
  2593. constructor(name: string, id: string, scene: Scene);
  2594. getTransformMatrices(mesh: AbstractMesh): Float32Array;
  2595. getScene(): Scene;
  2596. /**
  2597. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2598. */
  2599. toString(fullDetails?: boolean): string;
  2600. /**
  2601. * Get bone's index searching by name
  2602. * @param {string} name is bone's name to search for
  2603. * @return {number} Indice of the bone. Returns -1 if not found
  2604. */
  2605. getBoneIndexByName(name: string): number;
  2606. createAnimationRange(name: string, from: number, to: number): void;
  2607. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  2608. getAnimationRange(name: string): Nullable<AnimationRange>;
  2609. /**
  2610. * Returns as an Array, all AnimationRanges defined on this skeleton
  2611. */
  2612. getAnimationRanges(): Nullable<AnimationRange>[];
  2613. /**
  2614. * note: This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences
  2615. */
  2616. copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean;
  2617. returnToRest(): void;
  2618. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Nullable<Animatable>;
  2619. prepare(): void;
  2620. getAnimatables(): IAnimatable[];
  2621. clone(name: string, id: string): Skeleton;
  2622. enableBlending(blendingSpeed?: number): void;
  2623. dispose(): void;
  2624. serialize(): any;
  2625. static Parse(parsedSkeleton: any, scene: Scene): Skeleton;
  2626. computeAbsoluteTransforms(forceUpdate?: boolean): void;
  2627. getPoseMatrix(): Nullable<Matrix>;
  2628. sortBones(): void;
  2629. }
  2630. }
  2631. declare module BABYLON {
  2632. class ArcRotateCamera extends TargetCamera {
  2633. alpha: number;
  2634. beta: number;
  2635. radius: number;
  2636. target: Vector3;
  2637. inertialAlphaOffset: number;
  2638. inertialBetaOffset: number;
  2639. inertialRadiusOffset: number;
  2640. lowerAlphaLimit: Nullable<number>;
  2641. upperAlphaLimit: Nullable<number>;
  2642. lowerBetaLimit: number;
  2643. upperBetaLimit: number;
  2644. lowerRadiusLimit: Nullable<number>;
  2645. upperRadiusLimit: Nullable<number>;
  2646. inertialPanningX: number;
  2647. inertialPanningY: number;
  2648. pinchToPanMaxDistance: number;
  2649. panningDistanceLimit: Nullable<number>;
  2650. panningOriginTarget: Vector3;
  2651. panningInertia: number;
  2652. angularSensibilityX: number;
  2653. angularSensibilityY: number;
  2654. pinchPrecision: number;
  2655. pinchDeltaPercentage: number;
  2656. panningSensibility: number;
  2657. keysUp: number[];
  2658. keysDown: number[];
  2659. keysLeft: number[];
  2660. keysRight: number[];
  2661. wheelPrecision: number;
  2662. wheelDeltaPercentage: number;
  2663. zoomOnFactor: number;
  2664. targetScreenOffset: Vector2;
  2665. allowUpsideDown: boolean;
  2666. inputs: ArcRotateCameraInputsManager;
  2667. panningAxis: Vector3;
  2668. readonly bouncingBehavior: Nullable<BouncingBehavior>;
  2669. useBouncingBehavior: boolean;
  2670. readonly framingBehavior: Nullable<FramingBehavior>;
  2671. useFramingBehavior: boolean;
  2672. readonly autoRotationBehavior: Nullable<AutoRotationBehavior>;
  2673. useAutoRotationBehavior: boolean;
  2674. onMeshTargetChangedObservable: Observable<Nullable<AbstractMesh>>;
  2675. onCollide: (collidedMesh: AbstractMesh) => void;
  2676. checkCollisions: boolean;
  2677. collisionRadius: Vector3;
  2678. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);
  2679. /**
  2680. * Store current camera state (fov, position, etc..)
  2681. */
  2682. storeState(): Camera;
  2683. /**
  2684. * Restored camera state. You must call storeState() first
  2685. */
  2686. attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean, panningMouseButton?: number): void;
  2687. detachControl(element: HTMLElement): void;
  2688. rebuildAnglesAndRadius(): void;
  2689. setPosition(position: Vector3): void;
  2690. setTarget(target: AbstractMesh | Vector3, toBoundingCenter?: boolean, allowSamePosition?: boolean): void;
  2691. zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void;
  2692. focusOn(meshesOrMinMaxVectorAndDistance: AbstractMesh[] | {
  2693. min: Vector3;
  2694. max: Vector3;
  2695. distance: number;
  2696. }, doNotUpdateMaxZ?: boolean): void;
  2697. /**
  2698. * @override
  2699. * Override Camera.createRigCamera
  2700. */
  2701. createRigCamera(name: string, cameraIndex: number): Camera;
  2702. /**
  2703. * @override
  2704. * Override Camera._updateRigCameras
  2705. */
  2706. dispose(): void;
  2707. getClassName(): string;
  2708. }
  2709. }
  2710. declare module BABYLON {
  2711. class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
  2712. constructor(camera: ArcRotateCamera);
  2713. addMouseWheel(): ArcRotateCameraInputsManager;
  2714. addPointers(): ArcRotateCameraInputsManager;
  2715. addKeyboard(): ArcRotateCameraInputsManager;
  2716. addGamepad(): ArcRotateCameraInputsManager;
  2717. addVRDeviceOrientation(): ArcRotateCameraInputsManager;
  2718. }
  2719. }
  2720. declare module BABYLON {
  2721. class Camera extends Node {
  2722. inputs: CameraInputsManager<Camera>;
  2723. static readonly PERSPECTIVE_CAMERA: number;
  2724. static readonly ORTHOGRAPHIC_CAMERA: number;
  2725. static readonly FOVMODE_VERTICAL_FIXED: number;
  2726. static readonly FOVMODE_HORIZONTAL_FIXED: number;
  2727. static readonly RIG_MODE_NONE: number;
  2728. static readonly RIG_MODE_STEREOSCOPIC_ANAGLYPH: number;
  2729. static readonly RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number;
  2730. static readonly RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number;
  2731. static readonly RIG_MODE_STEREOSCOPIC_OVERUNDER: number;
  2732. static readonly RIG_MODE_VR: number;
  2733. static readonly RIG_MODE_WEBVR: number;
  2734. static ForceAttachControlToAlwaysPreventDefault: boolean;
  2735. static UseAlternateWebVRRendering: boolean;
  2736. position: Vector3;
  2737. upVector: Vector3;
  2738. orthoLeft: Nullable<number>;
  2739. orthoRight: Nullable<number>;
  2740. orthoBottom: Nullable<number>;
  2741. orthoTop: Nullable<number>;
  2742. fov: number;
  2743. minZ: number;
  2744. maxZ: number;
  2745. inertia: number;
  2746. mode: number;
  2747. isIntermediate: boolean;
  2748. viewport: Viewport;
  2749. layerMask: number;
  2750. fovMode: number;
  2751. cameraRigMode: number;
  2752. interaxialDistance: number;
  2753. isStereoscopicSideBySide: boolean;
  2754. customRenderTargets: RenderTargetTexture[];
  2755. onViewMatrixChangedObservable: Observable<Camera>;
  2756. onProjectionMatrixChangedObservable: Observable<Camera>;
  2757. onAfterCheckInputsObservable: Observable<Camera>;
  2758. onRestoreStateObservable: Observable<Camera>;
  2759. constructor(name: string, position: Vector3, scene: Scene);
  2760. /**
  2761. * Store current camera state (fov, position, etc..)
  2762. */
  2763. storeState(): Camera;
  2764. /**
  2765. * Restores the camera state values if it has been stored. You must call storeState() first
  2766. */
  2767. /**
  2768. * Restored camera state. You must call storeState() first
  2769. */
  2770. restoreState(): boolean;
  2771. getClassName(): string;
  2772. /**
  2773. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2774. */
  2775. toString(fullDetails?: boolean): string;
  2776. readonly globalPosition: Vector3;
  2777. getActiveMeshes(): SmartArray<AbstractMesh>;
  2778. isActiveMesh(mesh: Mesh): boolean;
  2779. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2780. detachControl(element: HTMLElement): void;
  2781. update(): void;
  2782. readonly rigCameras: Camera[];
  2783. readonly rigPostProcess: Nullable<PostProcess>;
  2784. attachPostProcess(postProcess: PostProcess, insertAt?: Nullable<number>): number;
  2785. detachPostProcess(postProcess: PostProcess): void;
  2786. getWorldMatrix(): Matrix;
  2787. getViewMatrix(force?: boolean): Matrix;
  2788. freezeProjectionMatrix(projection?: Matrix): void;
  2789. unfreezeProjectionMatrix(): void;
  2790. getProjectionMatrix(force?: boolean): Matrix;
  2791. getTranformationMatrix(): Matrix;
  2792. isInFrustum(target: ICullable): boolean;
  2793. isCompletelyInFrustum(target: ICullable): boolean;
  2794. getForwardRay(length?: number, transform?: Matrix, origin?: Vector3): Ray;
  2795. dispose(): void;
  2796. readonly leftCamera: Nullable<FreeCamera>;
  2797. readonly rightCamera: Nullable<FreeCamera>;
  2798. getLeftTarget(): Nullable<Vector3>;
  2799. getRightTarget(): Nullable<Vector3>;
  2800. setCameraRigMode(mode: number, rigParams: any): void;
  2801. /**
  2802. * This function MUST be overwritten by the different WebVR cameras available.
  2803. * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.
  2804. */
  2805. /**
  2806. * This function MUST be overwritten by the different WebVR cameras available.
  2807. * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.
  2808. */
  2809. setCameraRigParameter(name: string, value: any): void;
  2810. /**
  2811. * needs to be overridden by children so sub has required properties to be copied
  2812. */
  2813. createRigCamera(name: string, cameraIndex: number): Nullable<Camera>;
  2814. /**
  2815. * May need to be overridden by children
  2816. */
  2817. serialize(): any;
  2818. clone(name: string): Camera;
  2819. getDirection(localAxis: Vector3): Vector3;
  2820. getDirectionToRef(localAxis: Vector3, result: Vector3): void;
  2821. static GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): () => Camera;
  2822. computeWorldMatrix(): Matrix;
  2823. static Parse(parsedCamera: any, scene: Scene): Camera;
  2824. }
  2825. }
  2826. declare module BABYLON {
  2827. var CameraInputTypes: {};
  2828. interface ICameraInput<TCamera extends Camera> {
  2829. camera: Nullable<TCamera>;
  2830. getClassName(): string;
  2831. getSimpleName(): string;
  2832. attachControl: (element: HTMLElement, noPreventDefault?: boolean) => void;
  2833. detachControl: (element: Nullable<HTMLElement>) => void;
  2834. checkInputs?: () => void;
  2835. }
  2836. interface CameraInputsMap<TCamera extends Camera> {
  2837. [name: string]: ICameraInput<TCamera>;
  2838. [idx: number]: ICameraInput<TCamera>;
  2839. }
  2840. class CameraInputsManager<TCamera extends Camera> {
  2841. attached: CameraInputsMap<TCamera>;
  2842. attachedElement: Nullable<HTMLElement>;
  2843. noPreventDefault: boolean;
  2844. camera: TCamera;
  2845. checkInputs: () => void;
  2846. constructor(camera: TCamera);
  2847. add(input: ICameraInput<TCamera>): void;
  2848. remove(inputToRemove: ICameraInput<TCamera>): void;
  2849. removeByType(inputType: string): void;
  2850. attachInput(input: ICameraInput<TCamera>): void;
  2851. attachElement(element: HTMLElement, noPreventDefault?: boolean): void;
  2852. detachElement(element: HTMLElement, disconnect?: boolean): void;
  2853. rebuildInputCheck(): void;
  2854. clear(): void;
  2855. serialize(serializedCamera: any): void;
  2856. parse(parsedCamera: any): void;
  2857. }
  2858. }
  2859. declare module BABYLON {
  2860. class DeviceOrientationCamera extends FreeCamera {
  2861. constructor(name: string, position: Vector3, scene: Scene);
  2862. getClassName(): string;
  2863. resetToCurrentRotation(axis?: Axis): void;
  2864. }
  2865. }
  2866. declare module BABYLON {
  2867. class FollowCamera extends TargetCamera {
  2868. radius: number;
  2869. rotationOffset: number;
  2870. heightOffset: number;
  2871. cameraAcceleration: number;
  2872. maxCameraSpeed: number;
  2873. lockedTarget: Nullable<AbstractMesh>;
  2874. constructor(name: string, position: Vector3, scene: Scene, lockedTarget?: Nullable<AbstractMesh>);
  2875. getClassName(): string;
  2876. }
  2877. class ArcFollowCamera extends TargetCamera {
  2878. alpha: number;
  2879. beta: number;
  2880. radius: number;
  2881. target: Nullable<AbstractMesh>;
  2882. constructor(name: string, alpha: number, beta: number, radius: number, target: Nullable<AbstractMesh>, scene: Scene);
  2883. getClassName(): string;
  2884. }
  2885. }
  2886. declare module BABYLON {
  2887. class FreeCamera extends TargetCamera {
  2888. ellipsoid: Vector3;
  2889. ellipsoidOffset: Vector3;
  2890. checkCollisions: boolean;
  2891. applyGravity: boolean;
  2892. inputs: FreeCameraInputsManager;
  2893. angularSensibility: number;
  2894. keysUp: number[];
  2895. keysDown: number[];
  2896. keysLeft: number[];
  2897. keysRight: number[];
  2898. onCollide: (collidedMesh: AbstractMesh) => void;
  2899. constructor(name: string, position: Vector3, scene: Scene);
  2900. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2901. detachControl(element: HTMLElement): void;
  2902. collisionMask: number;
  2903. dispose(): void;
  2904. getClassName(): string;
  2905. }
  2906. }
  2907. declare module BABYLON {
  2908. class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
  2909. constructor(camera: FreeCamera);
  2910. addKeyboard(): FreeCameraInputsManager;
  2911. addMouse(touchEnabled?: boolean): FreeCameraInputsManager;
  2912. addGamepad(): FreeCameraInputsManager;
  2913. addDeviceOrientation(): FreeCameraInputsManager;
  2914. addTouch(): FreeCameraInputsManager;
  2915. addVirtualJoystick(): FreeCameraInputsManager;
  2916. }
  2917. }
  2918. declare module BABYLON {
  2919. class GamepadCamera extends UniversalCamera {
  2920. gamepadAngularSensibility: number;
  2921. gamepadMoveSensibility: number;
  2922. constructor(name: string, position: Vector3, scene: Scene);
  2923. getClassName(): string;
  2924. }
  2925. }
  2926. declare module BABYLON {
  2927. class AnaglyphFreeCamera extends FreeCamera {
  2928. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2929. getClassName(): string;
  2930. }
  2931. class AnaglyphArcRotateCamera extends ArcRotateCamera {
  2932. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, interaxialDistance: number, scene: Scene);
  2933. getClassName(): string;
  2934. }
  2935. class AnaglyphGamepadCamera extends GamepadCamera {
  2936. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2937. getClassName(): string;
  2938. }
  2939. class AnaglyphUniversalCamera extends UniversalCamera {
  2940. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2941. getClassName(): string;
  2942. }
  2943. class StereoscopicFreeCamera extends FreeCamera {
  2944. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2945. getClassName(): string;
  2946. }
  2947. class StereoscopicArcRotateCamera extends ArcRotateCamera {
  2948. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2949. getClassName(): string;
  2950. }
  2951. class StereoscopicGamepadCamera extends GamepadCamera {
  2952. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2953. getClassName(): string;
  2954. }
  2955. class StereoscopicUniversalCamera extends UniversalCamera {
  2956. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2957. getClassName(): string;
  2958. }
  2959. }
  2960. declare module BABYLON {
  2961. class TargetCamera extends Camera {
  2962. cameraDirection: Vector3;
  2963. cameraRotation: Vector2;
  2964. rotation: Vector3;
  2965. rotationQuaternion: Quaternion;
  2966. speed: number;
  2967. noRotationConstraint: boolean;
  2968. lockedTarget: any;
  2969. constructor(name: string, position: Vector3, scene: Scene);
  2970. getFrontPosition(distance: number): Vector3;
  2971. /**
  2972. * Store current camera state (fov, position, etc..)
  2973. */
  2974. storeState(): Camera;
  2975. /**
  2976. * Restored camera state. You must call storeState() first
  2977. */
  2978. setTarget(target: Vector3): void;
  2979. /**
  2980. * Return the current target position of the camera. This value is expressed in local space.
  2981. */
  2982. getTarget(): Vector3;
  2983. /**
  2984. * @override
  2985. * Override Camera.createRigCamera
  2986. */
  2987. createRigCamera(name: string, cameraIndex: number): Nullable<Camera>;
  2988. /**
  2989. * @override
  2990. * Override Camera._updateRigCameras
  2991. */
  2992. getClassName(): string;
  2993. }
  2994. }
  2995. declare module BABYLON {
  2996. class TouchCamera extends FreeCamera {
  2997. touchAngularSensibility: number;
  2998. touchMoveSensibility: number;
  2999. constructor(name: string, position: Vector3, scene: Scene);
  3000. getClassName(): string;
  3001. }
  3002. }
  3003. declare module BABYLON {
  3004. class UniversalCamera extends TouchCamera {
  3005. gamepadAngularSensibility: number;
  3006. gamepadMoveSensibility: number;
  3007. constructor(name: string, position: Vector3, scene: Scene);
  3008. getClassName(): string;
  3009. }
  3010. }
  3011. declare module BABYLON {
  3012. class VirtualJoysticksCamera extends FreeCamera {
  3013. constructor(name: string, position: Vector3, scene: Scene);
  3014. getClassName(): string;
  3015. }
  3016. }
  3017. declare module BABYLON {
  3018. class BoundingBox implements ICullable {
  3019. minimum: Vector3;
  3020. maximum: Vector3;
  3021. vectors: Vector3[];
  3022. center: Vector3;
  3023. centerWorld: Vector3;
  3024. extendSize: Vector3;
  3025. extendSizeWorld: Vector3;
  3026. directions: Vector3[];
  3027. vectorsWorld: Vector3[];
  3028. minimumWorld: Vector3;
  3029. maximumWorld: Vector3;
  3030. constructor(minimum: Vector3, maximum: Vector3);
  3031. getWorldMatrix(): Matrix;
  3032. setWorldMatrix(matrix: Matrix): BoundingBox;
  3033. isInFrustum(frustumPlanes: Plane[]): boolean;
  3034. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3035. intersectsPoint(point: Vector3): boolean;
  3036. intersectsSphere(sphere: BoundingSphere): boolean;
  3037. intersectsMinMax(min: Vector3, max: Vector3): boolean;
  3038. static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
  3039. static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
  3040. static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  3041. static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  3042. }
  3043. }
  3044. declare module BABYLON {
  3045. interface ICullable {
  3046. isInFrustum(frustumPlanes: Plane[]): boolean;
  3047. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3048. }
  3049. class BoundingInfo implements ICullable {
  3050. minimum: Vector3;
  3051. maximum: Vector3;
  3052. boundingBox: BoundingBox;
  3053. boundingSphere: BoundingSphere;
  3054. constructor(minimum: Vector3, maximum: Vector3);
  3055. isLocked: boolean;
  3056. update(world: Matrix): void;
  3057. /**
  3058. * Recreate the bounding info to be centered around a specific point given a specific extend.
  3059. * @param center New center of the bounding info
  3060. * @param extend New extend of the bounding info
  3061. */
  3062. centerOn(center: Vector3, extend: Vector3): BoundingInfo;
  3063. isInFrustum(frustumPlanes: Plane[]): boolean;
  3064. /**
  3065. * Gets the world distance between the min and max points of the bounding box
  3066. */
  3067. readonly diagonalLength: number;
  3068. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3069. intersectsPoint(point: Vector3): boolean;
  3070. intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
  3071. }
  3072. }
  3073. declare module BABYLON {
  3074. class BoundingSphere {
  3075. minimum: Vector3;
  3076. maximum: Vector3;
  3077. center: Vector3;
  3078. radius: number;
  3079. centerWorld: Vector3;
  3080. radiusWorld: number;
  3081. constructor(minimum: Vector3, maximum: Vector3);
  3082. isInFrustum(frustumPlanes: Plane[]): boolean;
  3083. intersectsPoint(point: Vector3): boolean;
  3084. static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
  3085. }
  3086. }
  3087. declare module BABYLON {
  3088. class Ray {
  3089. origin: Vector3;
  3090. direction: Vector3;
  3091. length: number;
  3092. constructor(origin: Vector3, direction: Vector3, length?: number);
  3093. intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
  3094. intersectsBox(box: BoundingBox): boolean;
  3095. intersectsSphere(sphere: BoundingSphere): boolean;
  3096. intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): Nullable<IntersectionInfo>;
  3097. intersectsPlane(plane: Plane): Nullable<number>;
  3098. intersectsMesh(mesh: AbstractMesh, fastCheck?: boolean): PickingInfo;
  3099. intersectsMeshes(meshes: Array<AbstractMesh>, fastCheck?: boolean, results?: Array<PickingInfo>): Array<PickingInfo>;
  3100. /**
  3101. * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
  3102. * @param sega the first point of the segment to test the intersection against
  3103. * @param segb the second point of the segment to test the intersection against
  3104. * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
  3105. * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
  3106. */
  3107. intersectionSegment(sega: Vector3, segb: Vector3, threshold: number): number;
  3108. update(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
  3109. static Zero(): Ray;
  3110. static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
  3111. /**
  3112. * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be
  3113. * transformed to the given world matrix.
  3114. * @param origin The origin point
  3115. * @param end The end point
  3116. * @param world a matrix to transform the ray to. Default is the identity matrix.
  3117. */
  3118. static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
  3119. static Transform(ray: Ray, matrix: Matrix): Ray;
  3120. static TransformToRef(ray: Ray, matrix: Matrix, result: Ray): void;
  3121. }
  3122. }
  3123. declare module BABYLON.Debug {
  3124. class AxesViewer {
  3125. scene: Nullable<Scene>;
  3126. scaleLines: number;
  3127. constructor(scene: Scene, scaleLines?: number);
  3128. update(position: Vector3, xaxis: Vector3, yaxis: Vector3, zaxis: Vector3): void;
  3129. dispose(): void;
  3130. }
  3131. }
  3132. declare module BABYLON.Debug {
  3133. class BoneAxesViewer extends Debug.AxesViewer {
  3134. mesh: Nullable<Mesh>;
  3135. bone: Nullable<Bone>;
  3136. pos: Vector3;
  3137. xaxis: Vector3;
  3138. yaxis: Vector3;
  3139. zaxis: Vector3;
  3140. constructor(scene: Scene, bone: Bone, mesh: Mesh, scaleLines?: number);
  3141. update(): void;
  3142. dispose(): void;
  3143. }
  3144. }
  3145. declare module BABYLON {
  3146. class DebugLayer {
  3147. static InspectorURL: string;
  3148. constructor(scene: Scene);
  3149. /** Creates the inspector window. */
  3150. isVisible(): boolean;
  3151. hide(): void;
  3152. show(config?: {
  3153. popup?: boolean;
  3154. initialTab?: number;
  3155. parentElement?: HTMLElement;
  3156. newColors?: {
  3157. backgroundColor?: string;
  3158. backgroundColorLighter?: string;
  3159. backgroundColorLighter2?: string;
  3160. backgroundColorLighter3?: string;
  3161. color?: string;
  3162. colorTop?: string;
  3163. colorBot?: string;
  3164. };
  3165. }): void;
  3166. }
  3167. }
  3168. declare module BABYLON.Debug {
  3169. class PhysicsViewer {
  3170. constructor(scene: Scene);
  3171. showImpostor(impostor: PhysicsImpostor): void;
  3172. hideImpostor(impostor: Nullable<PhysicsImpostor>): void;
  3173. dispose(): void;
  3174. }
  3175. }
  3176. declare module BABYLON {
  3177. class RayHelper {
  3178. ray: Nullable<Ray>;
  3179. static CreateAndShow(ray: Ray, scene: Scene, color: Color3): RayHelper;
  3180. constructor(ray: Ray);
  3181. show(scene: Scene, color: Color3): void;
  3182. hide(): void;
  3183. attachToMesh(mesh: AbstractMesh, meshSpaceDirection?: Vector3, meshSpaceOrigin?: Vector3, length?: number): void;
  3184. detachFromMesh(): void;
  3185. dispose(): void;
  3186. }
  3187. }
  3188. declare module BABYLON.Debug {
  3189. /**
  3190. * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
  3191. */
  3192. class SkeletonViewer {
  3193. skeleton: Skeleton;
  3194. mesh: AbstractMesh;
  3195. autoUpdateBonesMatrices: boolean;
  3196. renderingGroupId: number;
  3197. color: Color3;
  3198. constructor(skeleton: Skeleton, mesh: AbstractMesh, scene: Scene, autoUpdateBonesMatrices?: boolean, renderingGroupId?: number);
  3199. isEnabled: boolean;
  3200. update(): void;
  3201. dispose(): void;
  3202. }
  3203. }
  3204. declare module BABYLON {
  3205. class InstancingAttributeInfo {
  3206. /**
  3207. * Index/offset of the attribute in the vertex shader
  3208. */
  3209. index: number;
  3210. /**
  3211. * size of the attribute, 1, 2, 3 or 4
  3212. */
  3213. attributeSize: number;
  3214. /**
  3215. * type of the attribute, gl.BYTE, gl.UNSIGNED_BYTE, gl.SHORT, gl.UNSIGNED_SHORT, gl.FIXED, gl.FLOAT.
  3216. * default is FLOAT
  3217. */
  3218. attribyteType: number;
  3219. /**
  3220. * normalization of fixed-point data. behavior unclear, use FALSE, default is FALSE
  3221. */
  3222. normalized: boolean;
  3223. /**
  3224. * Offset of the data in the Vertex Buffer acting as the instancing buffer
  3225. */
  3226. offset: number;
  3227. /**
  3228. * Name of the GLSL attribute, for debugging purpose only
  3229. */
  3230. attributeName: string;
  3231. }
  3232. /**
  3233. * Define options used to create a render target texture
  3234. */
  3235. class RenderTargetCreationOptions {
  3236. generateMipMaps?: boolean;
  3237. generateDepthBuffer?: boolean;
  3238. generateStencilBuffer?: boolean;
  3239. type?: number;
  3240. samplingMode?: number;
  3241. }
  3242. /**
  3243. * Regroup several parameters relative to the browser in use
  3244. */
  3245. class EngineCapabilities {
  3246. /** The maximum textures image */
  3247. maxTexturesImageUnits: number;
  3248. maxVertexTextureImageUnits: number;
  3249. maxCombinedTexturesImageUnits: number;
  3250. /** The maximum texture size */
  3251. maxTextureSize: number;
  3252. maxCubemapTextureSize: number;
  3253. maxRenderTextureSize: number;
  3254. maxVertexAttribs: number;
  3255. maxVaryingVectors: number;
  3256. maxVertexUniformVectors: number;
  3257. maxFragmentUniformVectors: number;
  3258. standardDerivatives: boolean;
  3259. s3tc: Nullable<WEBGL_compressed_texture_s3tc>;
  3260. pvrtc: any;
  3261. etc1: any;
  3262. etc2: any;
  3263. astc: any;
  3264. textureFloat: boolean;
  3265. vertexArrayObject: boolean;
  3266. textureAnisotropicFilterExtension: Nullable<EXT_texture_filter_anisotropic>;
  3267. maxAnisotropy: number;
  3268. instancedArrays: boolean;
  3269. uintIndices: boolean;
  3270. highPrecisionShaderSupported: boolean;
  3271. fragmentDepthSupported: boolean;
  3272. textureFloatLinearFiltering: boolean;
  3273. textureFloatRender: boolean;
  3274. textureHalfFloat: boolean;
  3275. textureHalfFloatLinearFiltering: boolean;
  3276. textureHalfFloatRender: boolean;
  3277. textureLOD: boolean;
  3278. drawBuffersExtension: boolean;
  3279. depthTextureExtension: boolean;
  3280. colorBufferFloat: boolean;
  3281. timerQuery: EXT_disjoint_timer_query;
  3282. canUseTimestampForTimerQuery: boolean;
  3283. }
  3284. interface EngineOptions extends WebGLContextAttributes {
  3285. limitDeviceRatio?: number;
  3286. autoEnableWebVR?: boolean;
  3287. disableWebGL2Support?: boolean;
  3288. audioEngine?: boolean;
  3289. deterministicLockstep?: boolean;
  3290. lockstepMaxSteps?: number;
  3291. doNotHandleContextLost?: boolean;
  3292. }
  3293. interface IDisplayChangedEventArgs {
  3294. vrDisplay: any;
  3295. vrSupported: boolean;
  3296. }
  3297. /**
  3298. * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio.
  3299. */
  3300. class Engine {
  3301. /** Use this array to turn off some WebGL2 features on known buggy browsers version */
  3302. static WebGL2UniformBuffersExceptionList: string[];
  3303. static Instances: Engine[];
  3304. static readonly LastCreatedEngine: Nullable<Engine>;
  3305. static readonly LastCreatedScene: Nullable<Scene>;
  3306. /**
  3307. * Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation
  3308. */
  3309. static MarkAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
  3310. static readonly NEVER: number;
  3311. static readonly ALWAYS: number;
  3312. static readonly LESS: number;
  3313. static readonly EQUAL: number;
  3314. static readonly LEQUAL: number;
  3315. static readonly GREATER: number;
  3316. static readonly GEQUAL: number;
  3317. static readonly NOTEQUAL: number;
  3318. static readonly KEEP: number;
  3319. static readonly REPLACE: number;
  3320. static readonly INCR: number;
  3321. static readonly DECR: number;
  3322. static readonly INVERT: number;
  3323. static readonly INCR_WRAP: number;
  3324. static readonly DECR_WRAP: number;
  3325. static readonly ALPHA_DISABLE: number;
  3326. static readonly ALPHA_ONEONE: number;
  3327. static readonly ALPHA_ADD: number;
  3328. static readonly ALPHA_COMBINE: number;
  3329. static readonly ALPHA_SUBTRACT: number;
  3330. static readonly ALPHA_MULTIPLY: number;
  3331. static readonly ALPHA_MAXIMIZED: number;
  3332. static readonly ALPHA_PREMULTIPLIED: number;
  3333. static readonly ALPHA_PREMULTIPLIED_PORTERDUFF: number;
  3334. static readonly ALPHA_INTERPOLATE: number;
  3335. static readonly ALPHA_SCREENMODE: number;
  3336. static readonly DELAYLOADSTATE_NONE: number;
  3337. static readonly DELAYLOADSTATE_LOADED: number;
  3338. static readonly DELAYLOADSTATE_LOADING: number;
  3339. static readonly DELAYLOADSTATE_NOTLOADED: number;
  3340. static readonly TEXTUREFORMAT_ALPHA: number;
  3341. static readonly TEXTUREFORMAT_LUMINANCE: number;
  3342. static readonly TEXTUREFORMAT_LUMINANCE_ALPHA: number;
  3343. static readonly TEXTUREFORMAT_RGB: number;
  3344. static readonly TEXTUREFORMAT_RGBA: number;
  3345. static readonly TEXTURETYPE_UNSIGNED_INT: number;
  3346. static readonly TEXTURETYPE_FLOAT: number;
  3347. static readonly TEXTURETYPE_HALF_FLOAT: number;
  3348. static readonly SCALEMODE_FLOOR: number;
  3349. static readonly SCALEMODE_NEAREST: number;
  3350. static readonly SCALEMODE_CEILING: number;
  3351. static readonly Version: string;
  3352. static CollisionsEpsilon: number;
  3353. static CodeRepository: string;
  3354. static ShadersRepository: string;
  3355. forcePOTTextures: boolean;
  3356. isFullscreen: boolean;
  3357. isPointerLock: boolean;
  3358. cullBackFaces: boolean;
  3359. renderEvenInBackground: boolean;
  3360. preventCacheWipeBetweenFrames: boolean;
  3361. enableOfflineSupport: boolean;
  3362. scenes: Scene[];
  3363. postProcesses: PostProcess[];
  3364. /**
  3365. * Observable event triggered each time the rendering canvas is resized
  3366. */
  3367. onResizeObservable: Observable<Engine>;
  3368. /**
  3369. * Observable event triggered each time the canvas loses focus
  3370. */
  3371. onCanvasBlurObservable: Observable<Engine>;
  3372. /**
  3373. * Observable event triggered each time the canvas gains focus
  3374. */
  3375. onCanvasFocusObservable: Observable<Engine>;
  3376. /**
  3377. * Observable event triggered each time the canvas receives pointerout event
  3378. */
  3379. onCanvasPointerOutObservable: Observable<Engine>;
  3380. /**
  3381. * Observable event triggered before each texture is initialized
  3382. */
  3383. onBeforeTextureInitObservable: Observable<Texture>;
  3384. readonly isInVRExclusivePointerMode: boolean;
  3385. disableUniformBuffers: boolean;
  3386. readonly supportsUniformBuffers: boolean;
  3387. /**
  3388. * Observable raised when the engine begins a new frame
  3389. */
  3390. onBeginFrameObservable: Observable<Engine>;
  3391. /**
  3392. * Observable raised when the engine ends the current frame
  3393. */
  3394. onEndFrameObservable: Observable<Engine>;
  3395. /**
  3396. * Observable raised when the engine is about to compile a shader
  3397. */
  3398. onBeforeShaderCompilationObservable: Observable<Engine>;
  3399. /**
  3400. * Observable raised when the engine has jsut compiled a shader
  3401. */
  3402. onAfterShaderCompilationObservable: Observable<Engine>;
  3403. readonly needPOTTextures: boolean;
  3404. readonly badOS: boolean;
  3405. readonly badDesktopOS: boolean;
  3406. static audioEngine: AudioEngine;
  3407. onVRDisplayChangedObservable: Observable<IDisplayChangedEventArgs>;
  3408. onVRRequestPresentComplete: Observable<boolean>;
  3409. onVRRequestPresentStart: Observable<Engine>;
  3410. onContextLostObservable: Observable<Engine>;
  3411. onContextRestoredObservable: Observable<Engine>;
  3412. /**
  3413. * Turn this value on if you want to pause FPS computation when in background
  3414. */
  3415. disablePerformanceMonitorInBackground: boolean;
  3416. readonly performanceMonitor: PerformanceMonitor;
  3417. [key: string]: Nullable<InternalTexture>;
  3418. };
  3419. readonly texturesSupported: Array<string>;
  3420. readonly textureFormatInUse: Nullable<string>;
  3421. readonly currentViewport: Nullable<Viewport>;
  3422. readonly emptyTexture: InternalTexture;
  3423. readonly emptyTexture3D: InternalTexture;
  3424. readonly emptyCubeTexture: InternalTexture;
  3425. /**
  3426. * @constructor
  3427. * @param {HTMLCanvasElement | WebGLRenderingContext} canvasOrContext - the canvas or the webgl context to be used for rendering
  3428. * @param {boolean} [antialias] - enable antialias
  3429. * @param options - further options to be sent to the getContext function
  3430. */
  3431. constructor(canvasOrContext: Nullable<HTMLCanvasElement | WebGLRenderingContext>, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio?: boolean);
  3432. readonly webGLVersion: number;
  3433. /**
  3434. * Returns true if the stencil buffer has been enabled through the creation option of the context.
  3435. */
  3436. readonly isStencilEnable: boolean;
  3437. resetTextureCache(): void;
  3438. isDeterministicLockStep(): boolean;
  3439. getLockstepMaxSteps(): number;
  3440. getGlInfo(): {
  3441. vendor: string;
  3442. renderer: string;
  3443. version: string;
  3444. };
  3445. getAspectRatio(camera: Camera, useScreen?: boolean): number;
  3446. getRenderWidth(useScreen?: boolean): number;
  3447. getRenderHeight(useScreen?: boolean): number;
  3448. getRenderingCanvas(): Nullable<HTMLCanvasElement>;
  3449. getRenderingCanvasClientRect(): Nullable<ClientRect>;
  3450. setHardwareScalingLevel(level: number): void;
  3451. getHardwareScalingLevel(): number;
  3452. getLoadedTexturesCache(): InternalTexture[];
  3453. getCaps(): EngineCapabilities;
  3454. /** The number of draw calls submitted last frame */
  3455. readonly drawCalls: number;
  3456. readonly drawCallsPerfCounter: Nullable<PerfCounter>;
  3457. getDepthFunction(): Nullable<number>;
  3458. setDepthFunction(depthFunc: number): void;
  3459. setDepthFunctionToGreater(): void;
  3460. setDepthFunctionToGreaterOrEqual(): void;
  3461. setDepthFunctionToLess(): void;
  3462. setDepthFunctionToLessOrEqual(): void;
  3463. getStencilBuffer(): boolean;
  3464. setStencilBuffer(enable: boolean): void;
  3465. getStencilMask(): number;
  3466. setStencilMask(mask: number): void;
  3467. getStencilFunction(): number;
  3468. getStencilFunctionReference(): number;
  3469. getStencilFunctionMask(): number;
  3470. setStencilFunction(stencilFunc: number): void;
  3471. setStencilFunctionReference(reference: number): void;
  3472. setStencilFunctionMask(mask: number): void;
  3473. getStencilOperationFail(): number;
  3474. getStencilOperationDepthFail(): number;
  3475. getStencilOperationPass(): number;
  3476. setStencilOperationFail(operation: number): void;
  3477. setStencilOperationDepthFail(operation: number): void;
  3478. setStencilOperationPass(operation: number): void;
  3479. setDitheringState(value: boolean): void;
  3480. setRasterizerState(value: boolean): void;
  3481. /**
  3482. * stop executing a render loop function and remove it from the execution array
  3483. * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
  3484. */
  3485. stopRenderLoop(renderFunction?: () => void): void;
  3486. /**
  3487. * Register and execute a render loop. The engine can have more than one render function.
  3488. * @param {Function} renderFunction - the function to continuously execute starting the next render loop.
  3489. * @example
  3490. * engine.runRenderLoop(function () {
  3491. * scene.render()
  3492. * })
  3493. */
  3494. runRenderLoop(renderFunction: () => void): void;
  3495. /**
  3496. * Toggle full screen mode.
  3497. * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
  3498. * @param {any} options - an options object to be sent to the requestFullscreen function
  3499. */
  3500. switchFullscreen(requestPointerLock: boolean): void;
  3501. clear(color: Nullable<Color4>, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
  3502. scissorClear(x: number, y: number, width: number, height: number, clearColor: Color4): void;
  3503. /**
  3504. * Set the WebGL's viewport
  3505. * @param {BABYLON.Viewport} viewport - the viewport element to be used.
  3506. * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used.
  3507. * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used.
  3508. */
  3509. setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  3510. /**
  3511. * Directly set the WebGL Viewport
  3512. * The x, y, width & height are directly passed to the WebGL call
  3513. * @return the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state.
  3514. */
  3515. setDirectViewport(x: number, y: number, width: number, height: number): Nullable<Viewport>;
  3516. beginFrame(): void;
  3517. endFrame(): void;
  3518. /**
  3519. * resize the view according to the canvas' size.
  3520. * @example
  3521. * window.addEventListener("resize", function () {
  3522. * engine.resize();
  3523. * });
  3524. */
  3525. resize(): void;
  3526. /**
  3527. * force a specific size of the canvas
  3528. * @param {number} width - the new canvas' width
  3529. * @param {number} height - the new canvas' height
  3530. */
  3531. setSize(width: number, height: number): void;
  3532. isVRDevicePresent(): boolean;
  3533. getVRDevice(): any;
  3534. initWebVR(): Observable<{
  3535. vrDisplay: any;
  3536. vrSupported: any;
  3537. }>;
  3538. enableVR(): void;
  3539. disableVR(): void;
  3540. bindFramebuffer(texture: InternalTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number, forceFullscreenViewport?: boolean): void;
  3541. unBindFramebuffer(texture: InternalTexture, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
  3542. unBindMultiColorAttachmentFramebuffer(textures: InternalTexture[], disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
  3543. generateMipMapsForCubemap(texture: InternalTexture): void;
  3544. flushFramebuffer(): void;
  3545. restoreDefaultFramebuffer(): void;
  3546. createUniformBuffer(elements: FloatArray): WebGLBuffer;
  3547. createDynamicUniformBuffer(elements: FloatArray): WebGLBuffer;
  3548. updateUniformBuffer(uniformBuffer: WebGLBuffer, elements: FloatArray, offset?: number, count?: number): void;
  3549. createVertexBuffer(vertices: FloatArray): WebGLBuffer;
  3550. createDynamicVertexBuffer(vertices: FloatArray): WebGLBuffer;
  3551. updateDynamicIndexBuffer(indexBuffer: WebGLBuffer, indices: IndicesArray, offset?: number): void;
  3552. updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: FloatArray, offset?: number, count?: number): void;
  3553. createIndexBuffer(indices: IndicesArray, updatable?: boolean): WebGLBuffer;
  3554. bindArrayBuffer(buffer: Nullable<WebGLBuffer>): void;
  3555. bindUniformBuffer(buffer: Nullable<WebGLBuffer>): void;
  3556. bindUniformBufferBase(buffer: WebGLBuffer, location: number): void;
  3557. bindUniformBlock(shaderProgram: WebGLProgram, blockName: string, index: number): void;
  3558. updateArrayBuffer(data: Float32Array): void;
  3559. recordVertexArrayObject(vertexBuffers: {
  3560. [key: string]: VertexBuffer;
  3561. }, indexBuffer: Nullable<WebGLBuffer>, effect: Effect): WebGLVertexArrayObject;
  3562. bindVertexArrayObject(vertexArrayObject: WebGLVertexArrayObject, indexBuffer: Nullable<WebGLBuffer>): void;
  3563. bindBuffersDirectly(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
  3564. bindBuffers(vertexBuffers: {
  3565. [key: string]: Nullable<VertexBuffer>;
  3566. }, indexBuffer: Nullable<WebGLBuffer>, effect: Effect): void;
  3567. unbindInstanceAttributes(): void;
  3568. releaseVertexArrayObject(vao: WebGLVertexArrayObject): void;
  3569. createInstancesBuffer(capacity: number): WebGLBuffer;
  3570. deleteInstancesBuffer(buffer: WebGLBuffer): void;
  3571. updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[] | InstancingAttributeInfo[]): void;
  3572. applyStates(): void;
  3573. draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  3574. drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void;
  3575. drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  3576. drawElementsType(fillMode: number, indexStart: number, indexCount: number, instancesCount?: number): void;
  3577. drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  3578. /**
  3579. * @param baseName The base name of the effect (The name of file without .fragment.fx or .vertex.fx)
  3580. * @param samplers An array of string used to represent textures
  3581. */
  3582. createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
  3583. createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  3584. createRawShaderProgram(vertexCode: string, fragmentCode: string, context?: WebGLRenderingContext, transformFeedbackVaryings?: Nullable<string[]>): WebGLProgram;
  3585. createShaderProgram(vertexCode: string, fragmentCode: string, defines: Nullable<string>, context?: WebGLRenderingContext, transformFeedbackVaryings?: Nullable<string[]>): WebGLProgram;
  3586. getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): Nullable<WebGLUniformLocation>[];
  3587. getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  3588. enableEffect(effect: Nullable<Effect>): void;
  3589. setIntArray(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void;
  3590. setIntArray2(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void;
  3591. setIntArray3(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void;
  3592. setIntArray4(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void;
  3593. setFloatArray(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void;
  3594. setFloatArray2(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void;
  3595. setFloatArray3(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void;
  3596. setFloatArray4(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void;
  3597. setArray(uniform: Nullable<WebGLUniformLocation>, array: number[]): void;
  3598. setArray2(uniform: Nullable<WebGLUniformLocation>, array: number[]): void;
  3599. setArray3(uniform: Nullable<WebGLUniformLocation>, array: number[]): void;
  3600. setArray4(uniform: Nullable<WebGLUniformLocation>, array: number[]): void;
  3601. setMatrices(uniform: Nullable<WebGLUniformLocation>, matrices: Float32Array): void;
  3602. setMatrix(uniform: Nullable<WebGLUniformLocation>, matrix: Matrix): void;
  3603. setMatrix3x3(uniform: Nullable<WebGLUniformLocation>, matrix: Float32Array): void;
  3604. setMatrix2x2(uniform: Nullable<WebGLUniformLocation>, matrix: Float32Array): void;
  3605. setInt(uniform: Nullable<WebGLUniformLocation>, value: number): void;
  3606. setFloat(uniform: Nullable<WebGLUniformLocation>, value: number): void;
  3607. setFloat2(uniform: Nullable<WebGLUniformLocation>, x: number, y: number): void;
  3608. setFloat3(uniform: Nullable<WebGLUniformLocation>, x: number, y: number, z: number): void;
  3609. setBool(uniform: Nullable<WebGLUniformLocation>, bool: number): void;
  3610. setFloat4(uniform: Nullable<WebGLUniformLocation>, x: number, y: number, z: number, w: number): void;
  3611. setColor3(uniform: Nullable<WebGLUniformLocation>, color3: Color3): void;
  3612. setColor4(uniform: Nullable<WebGLUniformLocation>, color3: Color3, alpha: number): void;
  3613. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
  3614. setZOffset(value: number): void;
  3615. getZOffset(): number;
  3616. setDepthBuffer(enable: boolean): void;
  3617. getDepthWrite(): boolean;
  3618. setDepthWrite(enable: boolean): void;
  3619. setColorWrite(enable: boolean): void;
  3620. getColorWrite(): boolean;
  3621. setAlphaConstants(r: number, g: number, b: number, a: number): void;
  3622. setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
  3623. getAlphaMode(): number;
  3624. setAlphaTesting(enable: boolean): void;
  3625. getAlphaTesting(): boolean;
  3626. wipeCaches(bruteForce?: boolean): void;
  3627. /**
  3628. * Set the compressed texture format to use, based on the formats you have, and the formats
  3629. * supported by the hardware / browser.
  3630. *
  3631. * Khronos Texture Container (.ktx) files are used to support this. This format has the
  3632. * advantage of being specifically designed for OpenGL. Header elements directly correspond
  3633. * to API arguments needed to compressed textures. This puts the burden on the container
  3634. * generator to house the arcane code for determining these for current & future formats.
  3635. *
  3636. * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
  3637. * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
  3638. *
  3639. * Note: The result of this call is not taken into account when a texture is base64.
  3640. *
  3641. * @param {Array<string>} formatsAvailable- The list of those format families you have created
  3642. * on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)
  3643. *
  3644. * Current families are astc, dxt, pvrtc, etc2, & etc1.
  3645. * @returns The extension selected.
  3646. */
  3647. setTextureFormatToUse(formatsAvailable: Array<string>): Nullable<string>;
  3648. /**
  3649. * Usually called from BABYLON.Texture.ts. Passed information to create a WebGLTexture.
  3650. * @param {string} urlArg- This contains one of the following:
  3651. * 1. A conventional http URL, e.g. 'http://...' or 'file://...'
  3652. * 2. A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
  3653. * 3. An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
  3654. *
  3655. * @param {boolean} noMipmap- When true, no mipmaps shall be generated. Ignored for compressed textures. They must be in the file.
  3656. * @param {boolean} invertY- When true, image is flipped when loaded. You probably want true. Ignored for compressed textures. Must be flipped in the file.
  3657. * @param {Scene} scene- Needed for loading to the correct scene.
  3658. * @param {number} samplingMode- Mode with should be used sample / access the texture. Default: TRILINEAR
  3659. * @param {callback} onLoad- Optional callback to be called upon successful completion.
  3660. * @param {callback} onError- Optional callback to be called upon failure.
  3661. * @param {ArrayBuffer | HTMLImageElement} buffer- A source of a file previously fetched as either an ArrayBuffer (compressed or image format) or HTMLImageElement (image format)
  3662. * @param {WebGLTexture} fallback- An internal argument in case the function must be called again, due to etc1 not having alpha capabilities.
  3663. * @param {number} format- Internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures.
  3664. *
  3665. * @returns {WebGLTexture} for assignment back into BABYLON.Texture
  3666. */
  3667. createTexture(urlArg: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<Scene>, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<ArrayBuffer | HTMLImageElement>, fallBack?: Nullable<InternalTexture>, format?: Nullable<number>): InternalTexture;
  3668. updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>, type?: number): void;
  3669. createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>, type?: number): InternalTexture;
  3670. createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture;
  3671. updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void;
  3672. updateDynamicTexture(texture: Nullable<InternalTexture>, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean, format?: number): void;
  3673. updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;
  3674. createRenderTargetTexture(size: number | {
  3675. width: number;
  3676. height: number;
  3677. }, options: boolean | RenderTargetCreationOptions): InternalTexture;
  3678. createMultipleRenderTarget(size: any, options: any): InternalTexture[];
  3679. updateRenderTargetTextureSampleCount(texture: Nullable<InternalTexture>, samples: number): number;
  3680. updateMultipleRenderTargetTextureSampleCount(textures: Nullable<InternalTexture[]>, samples: number): number;
  3681. createRenderTargetCubeTexture(size: number, options?: RenderTargetCreationOptions): InternalTexture;
  3682. createPrefilteredCubeTexture(rootUrl: string, scene: Nullable<Scene>, scale: number, offset: number, onLoad?: Nullable<(internalTexture: Nullable<InternalTexture>) => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number, forcedExtension?: any): InternalTexture;
  3683. createCubeTexture(rootUrl: string, scene: Nullable<Scene>, files: Nullable<string[]>, noMipmap?: boolean, onLoad?: Nullable<(data?: any) => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number, forcedExtension?: any): InternalTexture;
  3684. updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression?: Nullable<string>, level?: number): void;
  3685. createRawCubeTexture(data: Nullable<ArrayBufferView[]>, size: number, format: number, type: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>): InternalTexture;
  3686. createRawCubeTextureFromUrl(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>, mipmmapGenerator: Nullable<((faces: ArrayBufferView[]) => ArrayBufferView[][])>, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, samplingMode?: number, invertY?: boolean): InternalTexture;
  3687. updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>): void;
  3688. createRawTexture3D(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>): InternalTexture;
  3689. bindSamplers(effect: Effect): void;
  3690. setTextureFromPostProcess(channel: number, postProcess: Nullable<PostProcess>): void;
  3691. unbindAllTextures(): void;
  3692. setTexture(channel: number, uniform: Nullable<WebGLUniformLocation>, texture: Nullable<BaseTexture>): void;
  3693. setTextureArray(channel: number, uniform: Nullable<WebGLUniformLocation>, textures: BaseTexture[]): void;
  3694. readPixels(x: number, y: number, width: number, height: number): Uint8Array;
  3695. /**
  3696. * Add an externaly attached data from its key.
  3697. * This method call will fail and return false, if such key already exists.
  3698. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  3699. * @param key the unique key that identifies the data
  3700. * @param data the data object to associate to the key for this Engine instance
  3701. * @return true if no such key were already present and the data was added successfully, false otherwise
  3702. */
  3703. addExternalData<T>(key: string, data: T): boolean;
  3704. /**
  3705. * Get an externaly attached data from its key
  3706. * @param key the unique key that identifies the data
  3707. * @return the associated data, if present (can be null), or undefined if not present
  3708. */
  3709. getExternalData<T>(key: string): T;
  3710. /**
  3711. * Get an externaly attached data from its key, create it using a factory if it's not already present
  3712. * @param key the unique key that identifies the data
  3713. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  3714. * @return the associated data, can be null if the factory returned null.
  3715. */
  3716. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  3717. /**
  3718. * Remove an externaly attached data from the Engine instance
  3719. * @param key the unique key that identifies the data
  3720. * @return true if the data was successfully removed, false if it doesn't exist
  3721. */
  3722. removeExternalData(key: string): boolean;
  3723. unbindAllAttributes(): void;
  3724. releaseEffects(): void;
  3725. dispose(): void;
  3726. displayLoadingUI(): void;
  3727. hideLoadingUI(): void;
  3728. loadingScreen: ILoadingScreen;
  3729. loadingUIText: string;
  3730. loadingUIBackgroundColor: string;
  3731. attachContextLostEvent(callback: ((event: WebGLContextEvent) => void)): void;
  3732. attachContextRestoredEvent(callback: ((event: WebGLContextEvent) => void)): void;
  3733. getVertexShaderSource(program: WebGLProgram): Nullable<string>;
  3734. getFragmentShaderSource(program: WebGLProgram): Nullable<string>;
  3735. getError(): number;
  3736. getFps(): number;
  3737. getDeltaTime(): number;
  3738. createQuery(): WebGLQuery;
  3739. deleteQuery(query: WebGLQuery): Engine;
  3740. isQueryResultAvailable(query: WebGLQuery): boolean;
  3741. getQueryResult(query: WebGLQuery): number;
  3742. beginOcclusionQuery(algorithmType: number, query: WebGLQuery): Engine;
  3743. endOcclusionQuery(algorithmType: number): Engine;
  3744. startTimeQuery(): Nullable<_TimeToken>;
  3745. endTimeQuery(token: _TimeToken): int;
  3746. createTransformFeedback(): WebGLTransformFeedback;
  3747. deleteTransformFeedback(value: WebGLTransformFeedback): void;
  3748. bindTransformFeedback(value: Nullable<WebGLTransformFeedback>): void;
  3749. beginTransformFeedback(usePoints?: boolean): void;
  3750. endTransformFeedback(): void;
  3751. setTranformFeedbackVaryings(program: WebGLProgram, value: string[]): void;
  3752. bindTransformFeedbackBuffer(value: Nullable<WebGLBuffer>): void;
  3753. static isSupported(): boolean;
  3754. }
  3755. }
  3756. declare module BABYLON {
  3757. class NullEngineOptions {
  3758. renderWidth: number;
  3759. renderHeight: number;
  3760. textureSize: number;
  3761. deterministicLockstep: boolean;
  3762. lockstepMaxSteps: number;
  3763. }
  3764. /**
  3765. * The null engine class provides support for headless version of babylon.js.
  3766. * This can be used in server side scenario or for testing purposes
  3767. */
  3768. class NullEngine extends Engine {
  3769. isDeterministicLockStep(): boolean;
  3770. getLockstepMaxSteps(): number;
  3771. constructor(options?: NullEngineOptions);
  3772. createVertexBuffer(vertices: FloatArray): WebGLBuffer;
  3773. createIndexBuffer(indices: IndicesArray): WebGLBuffer;
  3774. clear(color: Color4, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
  3775. getRenderWidth(useScreen?: boolean): number;
  3776. getRenderHeight(useScreen?: boolean): number;
  3777. setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  3778. createShaderProgram(vertexCode: string, fragmentCode: string, defines: string, context?: WebGLRenderingContext): WebGLProgram;
  3779. getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
  3780. getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  3781. bindSamplers(effect: Effect): void;
  3782. enableEffect(effect: Effect): void;
  3783. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
  3784. setIntArray(uniform: WebGLUniformLocation, array: Int32Array): void;
  3785. setIntArray2(uniform: WebGLUniformLocation, array: Int32Array): void;
  3786. setIntArray3(uniform: WebGLUniformLocation, array: Int32Array): void;
  3787. setIntArray4(uniform: WebGLUniformLocation, array: Int32Array): void;
  3788. setFloatArray(uniform: WebGLUniformLocation, array: Float32Array): void;
  3789. setFloatArray2(uniform: WebGLUniformLocation, array: Float32Array): void;
  3790. setFloatArray3(uniform: WebGLUniformLocation, array: Float32Array): void;
  3791. setFloatArray4(uniform: WebGLUniformLocation, array: Float32Array): void;
  3792. setArray(uniform: WebGLUniformLocation, array: number[]): void;
  3793. setArray2(uniform: WebGLUniformLocation, array: number[]): void;
  3794. setArray3(uniform: WebGLUniformLocation, array: number[]): void;
  3795. setArray4(uniform: WebGLUniformLocation, array: number[]): void;
  3796. setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void;
  3797. setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void;
  3798. setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  3799. setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  3800. setFloat(uniform: WebGLUniformLocation, value: number): void;
  3801. setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void;
  3802. setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void;
  3803. setBool(uniform: WebGLUniformLocation, bool: number): void;
  3804. setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
  3805. setColor3(uniform: WebGLUniformLocation, color3: Color3): void;
  3806. setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void;
  3807. setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
  3808. bindBuffers(vertexBuffers: {
  3809. [key: string]: VertexBuffer;
  3810. }, indexBuffer: WebGLBuffer, effect: Effect): void;
  3811. wipeCaches(bruteForce?: boolean): void;
  3812. draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  3813. drawElementsType(fillMode: number, indexStart: number, indexCount: number, instancesCount?: number): void;
  3814. drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  3815. createTexture(urlArg: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<ArrayBuffer | HTMLImageElement>, fallBack?: InternalTexture, format?: number): InternalTexture;
  3816. createRenderTargetTexture(size: any, options: boolean | RenderTargetCreationOptions): InternalTexture;
  3817. updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void;
  3818. bindFramebuffer(texture: InternalTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number, forceFullscreenViewport?: boolean): void;
  3819. unBindFramebuffer(texture: InternalTexture, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
  3820. createDynamicVertexBuffer(vertices: FloatArray): WebGLBuffer;
  3821. updateDynamicIndexBuffer(indexBuffer: WebGLBuffer, indices: IndicesArray, offset?: number): void;
  3822. updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: FloatArray, offset?: number, count?: number): void;
  3823. }
  3824. }
  3825. interface WebGLRenderingContext {
  3826. readonly RASTERIZER_DISCARD: number;
  3827. readonly TEXTURE_3D: number;
  3828. readonly TEXTURE_2D_ARRAY: number;
  3829. readonly TEXTURE_WRAP_R: number;
  3830. texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, pixels: ArrayBufferView | null): void;
  3831. texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, pixels: ArrayBufferView, offset: number): void;
  3832. texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;
  3833. compressedTexImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, data: ArrayBufferView, offset?: number, length?: number): void;
  3834. readonly TRANSFORM_FEEDBACK: number;
  3835. readonly INTERLEAVED_ATTRIBS: number;
  3836. readonly TRANSFORM_FEEDBACK_BUFFER: number;
  3837. createTransformFeedback(): WebGLTransformFeedback;
  3838. deleteTransformFeedback(transformFeedbac: WebGLTransformFeedback): void;
  3839. bindTransformFeedback(target: number, transformFeedback: WebGLTransformFeedback | null): void;
  3840. beginTransformFeedback(primitiveMode: number): void;
  3841. endTransformFeedback(): void;
  3842. transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: number): void;
  3843. }
  3844. interface ImageBitmap {
  3845. readonly width: number;
  3846. readonly height: number;
  3847. close(): void;
  3848. }
  3849. interface WebGLQuery extends WebGLObject {
  3850. }
  3851. declare var WebGLQuery: {
  3852. prototype: WebGLQuery;
  3853. new (): WebGLQuery;
  3854. };
  3855. interface WebGLSampler extends WebGLObject {
  3856. }
  3857. declare var WebGLSampler: {
  3858. prototype: WebGLSampler;
  3859. new (): WebGLSampler;
  3860. };
  3861. interface WebGLSync extends WebGLObject {
  3862. }
  3863. declare var WebGLSync: {
  3864. prototype: WebGLSync;
  3865. new (): WebGLSync;
  3866. };
  3867. interface WebGLTransformFeedback extends WebGLObject {
  3868. }
  3869. declare var WebGLTransformFeedback: {
  3870. prototype: WebGLTransformFeedback;
  3871. new (): WebGLTransformFeedback;
  3872. };
  3873. interface WebGLVertexArrayObject extends WebGLObject {
  3874. }
  3875. declare var WebGLVertexArrayObject: {
  3876. prototype: WebGLVertexArrayObject;
  3877. new (): WebGLVertexArrayObject;
  3878. };
  3879. declare module BABYLON {
  3880. class Collider {
  3881. /** Define if a collision was found */
  3882. collisionFound: boolean;
  3883. /**
  3884. * Define last intersection point in local space
  3885. */
  3886. intersectionPoint: Vector3;
  3887. /**
  3888. * Define last collided mesh
  3889. */
  3890. collidedMesh: Nullable<AbstractMesh>;
  3891. collisionMask: number;
  3892. /**
  3893. * Gets the plane normal used to compute the sliding response (in local space)
  3894. */
  3895. readonly slidePlaneNormal: Vector3;
  3896. }
  3897. }
  3898. declare module BABYLON {
  3899. var CollisionWorker: string;
  3900. interface ICollisionCoordinator {
  3901. getNewPosition(position: Vector3, displacement: Vector3, collider: Collider, maximumRetry: number, excludedMesh: Nullable<AbstractMesh>, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh: Nullable<AbstractMesh>) => void, collisionIndex: number): void;
  3902. init(scene: Scene): void;
  3903. destroy(): void;
  3904. onMeshAdded(mesh: AbstractMesh): void;
  3905. onMeshUpdated(mesh: AbstractMesh): void;
  3906. onMeshRemoved(mesh: AbstractMesh): void;
  3907. onGeometryAdded(geometry: Geometry): void;
  3908. onGeometryUpdated(geometry: Geometry): void;
  3909. onGeometryDeleted(geometry: Geometry): void;
  3910. }
  3911. interface SerializedMesh {
  3912. id: string;
  3913. name: string;
  3914. uniqueId: number;
  3915. geometryId: Nullable<string>;
  3916. sphereCenter: Array<number>;
  3917. sphereRadius: number;
  3918. boxMinimum: Array<number>;
  3919. boxMaximum: Array<number>;
  3920. worldMatrixFromCache: any;
  3921. subMeshes: Array<SerializedSubMesh>;
  3922. checkCollisions: boolean;
  3923. }
  3924. interface SerializedSubMesh {
  3925. position: number;
  3926. verticesStart: number;
  3927. verticesCount: number;
  3928. indexStart: number;
  3929. indexCount: number;
  3930. hasMaterial: boolean;
  3931. sphereCenter: Array<number>;
  3932. sphereRadius: number;
  3933. boxMinimum: Array<number>;
  3934. boxMaximum: Array<number>;
  3935. }
  3936. interface SerializedGeometry {
  3937. id: string;
  3938. positions: Float32Array;
  3939. indices: Uint32Array;
  3940. normals: Float32Array;
  3941. }
  3942. interface BabylonMessage {
  3943. taskType: WorkerTaskType;
  3944. payload: InitPayload | CollidePayload | UpdatePayload;
  3945. }
  3946. interface SerializedColliderToWorker {
  3947. position: Array<number>;
  3948. velocity: Array<number>;
  3949. radius: Array<number>;
  3950. }
  3951. enum WorkerTaskType {
  3952. INIT = 0,
  3953. UPDATE = 1,
  3954. COLLIDE = 2,
  3955. }
  3956. interface WorkerReply {
  3957. error: WorkerReplyType;
  3958. taskType: WorkerTaskType;
  3959. payload?: any;
  3960. }
  3961. interface CollisionReplyPayload {
  3962. newPosition: Array<number>;
  3963. collisionId: number;
  3964. collidedMeshUniqueId: number;
  3965. }
  3966. interface InitPayload {
  3967. }
  3968. interface CollidePayload {
  3969. collisionId: number;
  3970. collider: SerializedColliderToWorker;
  3971. maximumRetry: number;
  3972. excludedMeshUniqueId: Nullable<number>;
  3973. }
  3974. interface UpdatePayload {
  3975. updatedMeshes: {
  3976. [n: number]: SerializedMesh;
  3977. };
  3978. updatedGeometries: {
  3979. [s: string]: SerializedGeometry;
  3980. };
  3981. removedMeshes: Array<number>;
  3982. removedGeometries: Array<string>;
  3983. }
  3984. enum WorkerReplyType {
  3985. SUCCESS = 0,
  3986. UNKNOWN_ERROR = 1,
  3987. }
  3988. class CollisionCoordinatorWorker implements ICollisionCoordinator {
  3989. constructor();
  3990. static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
  3991. static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
  3992. getNewPosition(position: Vector3, displacement: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh: Nullable<AbstractMesh>) => void, collisionIndex: number): void;
  3993. init(scene: Scene): void;
  3994. destroy(): void;
  3995. onMeshAdded(mesh: AbstractMesh): void;
  3996. onMeshUpdated: (transformNode: TransformNode) => void;
  3997. onMeshRemoved(mesh: AbstractMesh): void;
  3998. onGeometryAdded(geometry: Geometry): void;
  3999. onGeometryUpdated: (geometry: Geometry) => void;
  4000. onGeometryDeleted(geometry: Geometry): void;
  4001. }
  4002. class CollisionCoordinatorLegacy implements ICollisionCoordinator {
  4003. getNewPosition(position: Vector3, displacement: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh: Nullable<AbstractMesh>) => void, collisionIndex: number): void;
  4004. init(scene: Scene): void;
  4005. destroy(): void;
  4006. onMeshAdded(mesh: AbstractMesh): void;
  4007. onMeshUpdated(mesh: AbstractMesh): void;
  4008. onMeshRemoved(mesh: AbstractMesh): void;
  4009. onGeometryAdded(geometry: Geometry): void;
  4010. onGeometryUpdated(geometry: Geometry): void;
  4011. onGeometryDeleted(geometry: Geometry): void;
  4012. }
  4013. }
  4014. declare function importScripts(...urls: string[]): void;
  4015. declare module BABYLON {
  4016. var WorkerIncluded: boolean;
  4017. class CollisionCache {
  4018. getMeshes(): {
  4019. [n: number]: SerializedMesh;
  4020. };
  4021. getGeometries(): {
  4022. [s: number]: SerializedGeometry;
  4023. };
  4024. getMesh(id: any): SerializedMesh;
  4025. addMesh(mesh: SerializedMesh): void;
  4026. removeMesh(uniqueId: number): void;
  4027. getGeometry(id: string): SerializedGeometry;
  4028. addGeometry(geometry: SerializedGeometry): void;
  4029. removeGeometry(id: string): void;
  4030. }
  4031. class CollideWorker {
  4032. collider: Collider;
  4033. constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
  4034. collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId: Nullable<number>): void;
  4035. }
  4036. interface ICollisionDetector {
  4037. onInit(payload: InitPayload): void;
  4038. onUpdate(payload: UpdatePayload): void;
  4039. onCollision(payload: CollidePayload): void;
  4040. }
  4041. class CollisionDetectorTransferable implements ICollisionDetector {
  4042. onInit(payload: InitPayload): void;
  4043. onUpdate(payload: UpdatePayload): void;
  4044. onCollision(payload: CollidePayload): void;
  4045. }
  4046. }
  4047. declare module BABYLON {
  4048. class IntersectionInfo {
  4049. bu: Nullable<number>;
  4050. bv: Nullable<number>;
  4051. distance: number;
  4052. faceId: number;
  4053. subMeshId: number;
  4054. constructor(bu: Nullable<number>, bv: Nullable<number>, distance: number);
  4055. }
  4056. class PickingInfo {
  4057. hit: boolean;
  4058. distance: number;
  4059. pickedPoint: Nullable<Vector3>;
  4060. pickedMesh: Nullable<AbstractMesh>;
  4061. bu: number;
  4062. bv: number;
  4063. faceId: number;
  4064. subMeshId: number;
  4065. pickedSprite: Nullable<Sprite>;
  4066. getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Nullable<Vector3>;
  4067. getTextureCoordinates(): Nullable<Vector2>;
  4068. }
  4069. }
  4070. declare module BABYLON {
  4071. class KeyboardEventTypes {
  4072. static readonly KEYDOWN: number;
  4073. static readonly KEYUP: number;
  4074. }
  4075. class KeyboardInfo {
  4076. type: number;
  4077. event: KeyboardEvent;
  4078. constructor(type: number, event: KeyboardEvent);
  4079. }
  4080. /**
  4081. * This class is used to store keyboard related info for the onPreKeyboardObservable event.
  4082. * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable
  4083. */
  4084. class KeyboardInfoPre extends KeyboardInfo {
  4085. constructor(type: number, event: KeyboardEvent);
  4086. skipOnPointerObservable: boolean;
  4087. }
  4088. }
  4089. declare module BABYLON {
  4090. class PointerEventTypes {
  4091. static readonly POINTERDOWN: number;
  4092. static readonly POINTERUP: number;
  4093. static readonly POINTERMOVE: number;
  4094. static readonly POINTERWHEEL: number;
  4095. static readonly POINTERPICK: number;
  4096. static readonly POINTERTAP: number;
  4097. static readonly POINTERDOUBLETAP: number;
  4098. }
  4099. class PointerInfoBase {
  4100. type: number;
  4101. event: PointerEvent | MouseWheelEvent;
  4102. constructor(type: number, event: PointerEvent | MouseWheelEvent);
  4103. }
  4104. /**
  4105. * This class is used to store pointer related info for the onPrePointerObservable event.
  4106. * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
  4107. */
  4108. class PointerInfoPre extends PointerInfoBase {
  4109. constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: number, localY: number);
  4110. localPosition: Vector2;
  4111. skipOnPointerObservable: boolean;
  4112. }
  4113. /**
  4114. * This type contains all the data related to a pointer event in Babylon.js.
  4115. * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.
  4116. */
  4117. class PointerInfo extends PointerInfoBase {
  4118. pickInfo: Nullable<PickingInfo>;
  4119. constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: Nullable<PickingInfo>);
  4120. }
  4121. }
  4122. declare module BABYLON {
  4123. class StickValues {
  4124. x: number;
  4125. y: number;
  4126. constructor(x: number, y: number);
  4127. }
  4128. interface GamepadButtonChanges {
  4129. changed: boolean;
  4130. pressChanged: boolean;
  4131. touchChanged: boolean;
  4132. valueChanged: boolean;
  4133. }
  4134. class Gamepad {
  4135. id: string;
  4136. index: number;
  4137. browserGamepad: any;
  4138. type: number;
  4139. static GAMEPAD: number;
  4140. static GENERIC: number;
  4141. static XBOX: number;
  4142. static POSE_ENABLED: number;
  4143. readonly isConnected: boolean;
  4144. constructor(id: string, index: number, browserGamepad: any, leftStickX?: number, leftStickY?: number, rightStickX?: number, rightStickY?: number);
  4145. onleftstickchanged(callback: (values: StickValues) => void): void;
  4146. onrightstickchanged(callback: (values: StickValues) => void): void;
  4147. leftStick: StickValues;
  4148. rightStick: StickValues;
  4149. update(): void;
  4150. dispose(): void;
  4151. }
  4152. class GenericPad extends Gamepad {
  4153. onButtonDownObservable: Observable<number>;
  4154. onButtonUpObservable: Observable<number>;
  4155. onbuttondown(callback: (buttonPressed: number) => void): void;
  4156. onbuttonup(callback: (buttonReleased: number) => void): void;
  4157. constructor(id: string, index: number, browserGamepad: any);
  4158. update(): void;
  4159. dispose(): void;
  4160. }
  4161. }
  4162. declare module BABYLON {
  4163. class GamepadManager {
  4164. onGamepadConnectedObservable: Observable<Gamepad>;
  4165. onGamepadDisconnectedObservable: Observable<Gamepad>;
  4166. constructor(_scene?: Scene | undefined);
  4167. readonly gamepads: Gamepad[];
  4168. getGamepadByType(type?: number): Nullable<Gamepad>;
  4169. dispose(): void;
  4170. }
  4171. }
  4172. declare module BABYLON {
  4173. enum Xbox360Button {
  4174. A = 0,
  4175. B = 1,
  4176. X = 2,
  4177. Y = 3,
  4178. Start = 4,
  4179. Back = 5,
  4180. LB = 6,
  4181. RB = 7,
  4182. LeftStick = 8,
  4183. RightStick = 9,
  4184. }
  4185. enum Xbox360Dpad {
  4186. Up = 0,
  4187. Down = 1,
  4188. Left = 2,
  4189. Right = 3,
  4190. }
  4191. class Xbox360Pad extends Gamepad {
  4192. onButtonDownObservable: Observable<Xbox360Button>;
  4193. onButtonUpObservable: Observable<Xbox360Button>;
  4194. onPadDownObservable: Observable<Xbox360Dpad>;
  4195. onPadUpObservable: Observable<Xbox360Dpad>;
  4196. constructor(id: string, index: number, gamepad: any, xboxOne?: boolean);
  4197. onlefttriggerchanged(callback: (value: number) => void): void;
  4198. onrighttriggerchanged(callback: (value: number) => void): void;
  4199. leftTrigger: number;
  4200. rightTrigger: number;
  4201. onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
  4202. onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
  4203. ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
  4204. ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
  4205. buttonA: number;
  4206. buttonB: number;
  4207. buttonX: number;
  4208. buttonY: number;
  4209. buttonStart: number;
  4210. buttonBack: number;
  4211. buttonLB: number;
  4212. buttonRB: number;
  4213. buttonLeftStick: number;
  4214. buttonRightStick: number;
  4215. dPadUp: number;
  4216. dPadDown: number;
  4217. dPadLeft: number;
  4218. dPadRight: number;
  4219. update(): void;
  4220. dispose(): void;
  4221. }
  4222. }
  4223. declare namespace BABYLON {
  4224. /**
  4225. * Represents the different options available during the creation of
  4226. * a Environment helper.
  4227. *
  4228. * This can control the default ground, skybox and image processing setup of your scene.
  4229. */
  4230. interface IEnvironmentHelperOptions {
  4231. /**
  4232. * Specifies wether or not to create a ground.
  4233. * True by default.
  4234. */
  4235. createGround: boolean;
  4236. /**
  4237. * Specifies the ground size.
  4238. * 15 by default.
  4239. */
  4240. groundSize: number;
  4241. /**
  4242. * The texture used on the ground for the main color.
  4243. * Comes from the BabylonJS CDN by default.
  4244. *
  4245. * Remarks: Can be either a texture or a url.
  4246. */
  4247. groundTexture: string | BaseTexture;
  4248. /**
  4249. * The color mixed in the ground texture by default.
  4250. * BabylonJS clearColor by default.
  4251. */
  4252. groundColor: Color3;
  4253. /**
  4254. * Specifies the ground opacity.
  4255. * 1 by default.
  4256. */
  4257. groundOpacity: number;
  4258. /**
  4259. * Enables the ground to receive shadows.
  4260. * True by default.
  4261. */
  4262. enableGroundShadow: boolean;
  4263. /**
  4264. * Helps preventing the shadow to be fully black on the ground.
  4265. * 0.5 by default.
  4266. */
  4267. groundShadowLevel: number;
  4268. /**
  4269. * Creates a mirror texture attach to the ground.
  4270. * false by default.
  4271. */
  4272. enableGroundMirror: boolean;
  4273. /**
  4274. * Specifies the ground mirror size ratio.
  4275. * 0.3 by default as the default kernel is 64.
  4276. */
  4277. groundMirrorSizeRatio: number;
  4278. /**
  4279. * Specifies the ground mirror blur kernel size.
  4280. * 64 by default.
  4281. */
  4282. groundMirrorBlurKernel: number;
  4283. /**
  4284. * Specifies the ground mirror visibility amount.
  4285. * 1 by default
  4286. */
  4287. groundMirrorAmount: number;
  4288. /**
  4289. * Specifies the ground mirror reflectance weight.
  4290. * This uses the standard weight of the background material to setup the fresnel effect
  4291. * of the mirror.
  4292. * 1 by default.
  4293. */
  4294. groundMirrorFresnelWeight: number;
  4295. /**
  4296. * Specifies the ground mirror Falloff distance.
  4297. * This can helps reducing the size of the reflection.
  4298. * 0 by Default.
  4299. */
  4300. groundMirrorFallOffDistance: number;
  4301. /**
  4302. * Specifies the ground mirror texture type.
  4303. * Unsigned Int by Default.
  4304. */
  4305. groundMirrorTextureType: number;
  4306. /**
  4307. * Specifies wether or not to create a skybox.
  4308. * True by default.
  4309. */
  4310. createSkybox: boolean;
  4311. /**
  4312. * Specifies the skybox size.
  4313. * 20 by default.
  4314. */
  4315. skyboxSize: number;
  4316. /**
  4317. * The texture used on the skybox for the main color.
  4318. * Comes from the BabylonJS CDN by default.
  4319. *
  4320. * Remarks: Can be either a texture or a url.
  4321. */
  4322. skyboxTexture: string | BaseTexture;
  4323. /**
  4324. * The color mixed in the skybox texture by default.
  4325. * BabylonJS clearColor by default.
  4326. */
  4327. skyboxColor: Color3;
  4328. /**
  4329. * The background rotation around the Y axis of the scene.
  4330. * This helps aligning the key lights of your scene with the background.
  4331. * 0 by default.
  4332. */
  4333. backgroundYRotation: number;
  4334. /**
  4335. * Compute automatically the size of the elements to best fit with the scene.
  4336. */
  4337. sizeAuto: boolean;
  4338. /**
  4339. * Default position of the rootMesh if autoSize is not true.
  4340. */
  4341. rootPosition: Vector3;
  4342. /**
  4343. * Sets up the image processing in the scene.
  4344. * true by default.
  4345. */
  4346. setupImageProcessing: boolean;
  4347. /**
  4348. * The texture used as your environment texture in the scene.
  4349. * Comes from the BabylonJS CDN by default and in use if setupImageProcessing is true.
  4350. *
  4351. * Remarks: Can be either a texture or a url.
  4352. */
  4353. environmentTexture: string | BaseTexture;
  4354. /**
  4355. * The value of the exposure to apply to the scene.
  4356. * 0.6 by default if setupImageProcessing is true.
  4357. */
  4358. cameraExposure: number;
  4359. /**
  4360. * The value of the contrast to apply to the scene.
  4361. * 1.6 by default if setupImageProcessing is true.
  4362. */
  4363. cameraContrast: number;
  4364. /**
  4365. * Specifies wether or not tonemapping should be enabled in the scene.
  4366. * true by default if setupImageProcessing is true.
  4367. */
  4368. toneMappingEnabled: boolean;
  4369. }
  4370. /**
  4371. * The Environment helper class can be used to add a fully featuread none expensive background to your scene.
  4372. * It includes by default a skybox and a ground relying on the BackgroundMaterial.
  4373. * It also helps with the default setup of your imageProcessing configuration.
  4374. */
  4375. class EnvironmentHelper {
  4376. /**
  4377. * Default ground texture URL.
  4378. */
  4379. /**
  4380. * Default skybox texture URL.
  4381. */
  4382. /**
  4383. * Default environment texture URL.
  4384. */
  4385. /**
  4386. * Creates the default options for the helper.
  4387. */
  4388. /**
  4389. * Gets the root mesh created by the helper.
  4390. */
  4391. readonly rootMesh: Mesh;
  4392. /**
  4393. * Gets the skybox created by the helper.
  4394. */
  4395. readonly skybox: Nullable<Mesh>;
  4396. /**
  4397. * Gets the skybox texture created by the helper.
  4398. */
  4399. readonly skyboxTexture: Nullable<BaseTexture>;
  4400. /**
  4401. * Gets the skybox material created by the helper.
  4402. */
  4403. readonly skyboxMaterial: Nullable<BackgroundMaterial>;
  4404. /**
  4405. * Gets the ground mesh created by the helper.
  4406. */
  4407. readonly ground: Nullable<Mesh>;
  4408. /**
  4409. * Gets the ground texture created by the helper.
  4410. */
  4411. readonly groundTexture: Nullable<BaseTexture>;
  4412. /**
  4413. * Gets the ground mirror created by the helper.
  4414. */
  4415. readonly groundMirror: Nullable<MirrorTexture>;
  4416. /**
  4417. * Gets the ground mirror render list to helps pushing the meshes
  4418. * you wish in the ground reflection.
  4419. */
  4420. readonly groundMirrorRenderList: Nullable<AbstractMesh[]>;
  4421. /**
  4422. * Gets the ground material created by the helper.
  4423. */
  4424. readonly groundMaterial: Nullable<BackgroundMaterial>;
  4425. /**
  4426. * Stores the creation options.
  4427. */
  4428. /**
  4429. * constructor
  4430. * @param options
  4431. * @param scene The scene to add the material to
  4432. */
  4433. constructor(options: Partial<IEnvironmentHelperOptions>, scene: Scene);
  4434. /**
  4435. * Updates the background according to the new options
  4436. * @param options
  4437. */
  4438. updateOptions(options: Partial<IEnvironmentHelperOptions>): void;
  4439. /**
  4440. * Sets the primary color of all the available elements.
  4441. * @param color
  4442. */
  4443. setMainColor(color: Color3): void;
  4444. /**
  4445. * Setup the image processing according to the specified options.
  4446. */
  4447. /**
  4448. * Setup the environment texture according to the specified options.
  4449. */
  4450. /**
  4451. * Setup the background according to the specified options.
  4452. */
  4453. /**
  4454. * Get the scene sizes according to the setup.
  4455. */
  4456. /**
  4457. * Setup the ground according to the specified options.
  4458. */
  4459. /**
  4460. * Setup the ground material according to the specified options.
  4461. */
  4462. /**
  4463. * Setup the ground diffuse texture according to the specified options.
  4464. */
  4465. /**
  4466. * Setup the ground mirror texture according to the specified options.
  4467. */
  4468. /**
  4469. * Setup the ground to receive the mirror texture.
  4470. */
  4471. /**
  4472. * Setup the skybox according to the specified options.
  4473. */
  4474. /**
  4475. * Setup the skybox material according to the specified options.
  4476. */
  4477. /**
  4478. * Setup the skybox reflection texture according to the specified options.
  4479. */
  4480. /**
  4481. * Dispose all the elements created by the Helper.
  4482. */
  4483. dispose(): void;
  4484. }
  4485. }
  4486. declare module BABYLON {
  4487. /**
  4488. * Highlight layer options. This helps customizing the behaviour
  4489. * of the highlight layer.
  4490. */
  4491. interface IHighlightLayerOptions {
  4492. /**
  4493. * Multiplication factor apply to the canvas size to compute the render target size
  4494. * used to generated the glowing objects (the smaller the faster).
  4495. */
  4496. mainTextureRatio: number;
  4497. /**
  4498. * Enforces a fixed size texture to ensure resize independant blur.
  4499. */
  4500. mainTextureFixedSize?: number;
  4501. /**
  4502. * Multiplication factor apply to the main texture size in the first step of the blur to reduce the size
  4503. * of the picture to blur (the smaller the faster).
  4504. */
  4505. blurTextureSizeRatio: number;
  4506. /**
  4507. * How big in texel of the blur texture is the vertical blur.
  4508. */
  4509. blurVerticalSize: number;
  4510. /**
  4511. * How big in texel of the blur texture is the horizontal blur.
  4512. */
  4513. blurHorizontalSize: number;
  4514. /**
  4515. * Alpha blending mode used to apply the blur. Default is combine.
  4516. */
  4517. alphaBlendingMode: number;
  4518. /**
  4519. * The camera attached to the layer.
  4520. */
  4521. camera: Nullable<Camera>;
  4522. }
  4523. /**
  4524. * The highlight layer Helps adding a glow effect around a mesh.
  4525. *
  4526. * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove
  4527. * glowy meshes to your scene.
  4528. *
  4529. * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!
  4530. */
  4531. class HighlightLayer {
  4532. name: string;
  4533. /**
  4534. * The neutral color used during the preparation of the glow effect.
  4535. * This is black by default as the blend operation is a blend operation.
  4536. */
  4537. static neutralColor: Color4;
  4538. /**
  4539. * Stencil value used for glowing meshes.
  4540. */
  4541. static glowingMeshStencilReference: number;
  4542. /**
  4543. * Stencil value used for the other meshes in the scene.
  4544. */
  4545. static normalMeshStencilReference: number;
  4546. /**
  4547. * Specifies whether or not the inner glow is ACTIVE in the layer.
  4548. */
  4549. innerGlow: boolean;
  4550. /**
  4551. * Specifies whether or not the outer glow is ACTIVE in the layer.
  4552. */
  4553. outerGlow: boolean;
  4554. /**
  4555. * Specifies wether the highlight layer is enabled or not.
  4556. */
  4557. isEnabled: boolean;
  4558. /**
  4559. * Gets the horizontal size of the blur.
  4560. */
  4561. /**
  4562. * Specifies the horizontal size of the blur.
  4563. */
  4564. blurHorizontalSize: number;
  4565. /**
  4566. * Gets the vertical size of the blur.
  4567. */
  4568. /**
  4569. * Specifies the vertical size of the blur.
  4570. */
  4571. blurVerticalSize: number;
  4572. /**
  4573. * Gets the camera attached to the layer.
  4574. */
  4575. readonly camera: Nullable<Camera>;
  4576. /**
  4577. * An event triggered when the highlight layer has been disposed.
  4578. * @type {BABYLON.Observable}
  4579. */
  4580. onDisposeObservable: Observable<HighlightLayer>;
  4581. /**
  4582. * An event triggered when the highlight layer is about rendering the main texture with the glowy parts.
  4583. * @type {BABYLON.Observable}
  4584. */
  4585. onBeforeRenderMainTextureObservable: Observable<HighlightLayer>;
  4586. /**
  4587. * An event triggered when the highlight layer is being blurred.
  4588. * @type {BABYLON.Observable}
  4589. */
  4590. onBeforeBlurObservable: Observable<HighlightLayer>;
  4591. /**
  4592. * An event triggered when the highlight layer has been blurred.
  4593. * @type {BABYLON.Observable}
  4594. */
  4595. onAfterBlurObservable: Observable<HighlightLayer>;
  4596. /**
  4597. * An event triggered when the glowing blurred texture is being merged in the scene.
  4598. * @type {BABYLON.Observable}
  4599. */
  4600. onBeforeComposeObservable: Observable<HighlightLayer>;
  4601. /**
  4602. * An event triggered when the glowing blurred texture has been merged in the scene.
  4603. * @type {BABYLON.Observable}
  4604. */
  4605. onAfterComposeObservable: Observable<HighlightLayer>;
  4606. /**
  4607. * An event triggered when the highlight layer changes its size.
  4608. * @type {BABYLON.Observable}
  4609. */
  4610. onSizeChangedObservable: Observable<HighlightLayer>;
  4611. /**
  4612. * Instantiates a new highlight Layer and references it to the scene..
  4613. * @param name The name of the layer
  4614. * @param scene The scene to use the layer in
  4615. * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
  4616. */
  4617. constructor(name: string, scene: Scene, options?: IHighlightLayerOptions);
  4618. /**
  4619. * Creates the render target textures and post processes used in the highlight layer.
  4620. */
  4621. /**
  4622. * Checks for the readiness of the element composing the layer.
  4623. * @param subMesh the mesh to check for
  4624. * @param useInstances specify wether or not to use instances to render the mesh
  4625. * @param emissiveTexture the associated emissive texture used to generate the glow
  4626. * @return true if ready otherwise, false
  4627. */
  4628. /**
  4629. * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
  4630. */
  4631. render(): void;
  4632. /**
  4633. * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.
  4634. * @param mesh The mesh to exclude from the highlight layer
  4635. */
  4636. addExcludedMesh(mesh: Mesh): void;
  4637. /**
  4638. * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.
  4639. * @param mesh The mesh to highlight
  4640. */
  4641. removeExcludedMesh(mesh: Mesh): void;
  4642. /**
  4643. * Add a mesh in the highlight layer in order to make it glow with the chosen color.
  4644. * @param mesh The mesh to highlight
  4645. * @param color The color of the highlight
  4646. * @param glowEmissiveOnly Extract the glow from the emissive texture
  4647. */
  4648. addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly?: boolean): void;
  4649. /**
  4650. * Remove a mesh from the highlight layer in order to make it stop glowing.
  4651. * @param mesh The mesh to highlight
  4652. */
  4653. removeMesh(mesh: Mesh): void;
  4654. /**
  4655. * Returns true if the layer contains information to display, otherwise false.
  4656. */
  4657. shouldRender(): boolean;
  4658. /**
  4659. * Sets the main texture desired size which is the closest power of two
  4660. * of the engine canvas size.
  4661. */
  4662. /**
  4663. * Force the stencil to the normal expected value for none glowing parts
  4664. */
  4665. /**
  4666. * Dispose only the render target textures and post process.
  4667. */
  4668. /**
  4669. * Dispose the highlight layer and free resources.
  4670. */
  4671. dispose(): void;
  4672. }
  4673. }
  4674. declare module BABYLON {
  4675. class Layer {
  4676. name: string;
  4677. texture: Nullable<Texture>;
  4678. isBackground: boolean;
  4679. color: Color4;
  4680. scale: Vector2;
  4681. offset: Vector2;
  4682. alphaBlendingMode: number;
  4683. alphaTest: boolean;
  4684. layerMask: number;
  4685. /**
  4686. * An event triggered when the layer is disposed.
  4687. * @type {BABYLON.Observable}
  4688. */
  4689. onDisposeObservable: Observable<Layer>;
  4690. onDispose: () => void;
  4691. /**
  4692. * An event triggered before rendering the scene
  4693. * @type {BABYLON.Observable}
  4694. */
  4695. onBeforeRenderObservable: Observable<Layer>;
  4696. onBeforeRender: () => void;
  4697. /**
  4698. * An event triggered after rendering the scene
  4699. * @type {BABYLON.Observable}
  4700. */
  4701. onAfterRenderObservable: Observable<Layer>;
  4702. onAfterRender: () => void;
  4703. constructor(name: string, imgUrl: Nullable<string>, scene: Nullable<Scene>, isBackground?: boolean, color?: Color4);
  4704. render(): void;
  4705. dispose(): void;
  4706. }
  4707. }
  4708. declare module BABYLON {
  4709. class DirectionalLight extends ShadowLight {
  4710. /**
  4711. * Fix frustum size for the shadow generation. This is disabled if the value is 0.
  4712. */
  4713. /**
  4714. * Specifies a fix frustum size for the shadow generation.
  4715. */
  4716. shadowFrustumSize: number;
  4717. shadowOrthoScale: number;
  4718. autoUpdateExtends: boolean;
  4719. /**
  4720. * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).
  4721. * The directional light is emitted from everywhere in the given direction.
  4722. * It can cast shawdows.
  4723. * Documentation : http://doc.babylonjs.com/tutorials/lights
  4724. */
  4725. constructor(name: string, direction: Vector3, scene: Scene);
  4726. /**
  4727. * Returns the string "DirectionalLight".
  4728. */
  4729. getClassName(): string;
  4730. /**
  4731. * Returns the integer 1.
  4732. */
  4733. getTypeID(): number;
  4734. /**
  4735. * Sets the passed matrix "matrix" as projection matrix for the shadows cast by the light according to the passed view matrix.
  4736. * Returns the DirectionalLight Shadow projection matrix.
  4737. */
  4738. /**
  4739. * Sets the passed matrix "matrix" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.
  4740. * Returns the DirectionalLight Shadow projection matrix.
  4741. */
  4742. /**
  4743. * Sets the passed matrix "matrix" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.
  4744. * Returns the DirectionalLight Shadow projection matrix.
  4745. */
  4746. /**
  4747. * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.
  4748. * Returns the DirectionalLight.
  4749. */
  4750. transferToEffect(effect: Effect, lightIndex: string): DirectionalLight;
  4751. /**
  4752. * Gets the minZ used for shadow according to both the scene and the light.
  4753. *
  4754. * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
  4755. * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
  4756. * @param activeCamera
  4757. */
  4758. getDepthMinZ(activeCamera: Camera): number;
  4759. /**
  4760. * Gets the maxZ used for shadow according to both the scene and the light.
  4761. *
  4762. * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
  4763. * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
  4764. * @param activeCamera
  4765. */
  4766. getDepthMaxZ(activeCamera: Camera): number;
  4767. }
  4768. }
  4769. declare module BABYLON {
  4770. class HemisphericLight extends Light {
  4771. groundColor: Color3;
  4772. direction: Vector3;
  4773. /**
  4774. * Creates a HemisphericLight object in the scene according to the passed direction (Vector3).
  4775. * The HemisphericLight simulates the ambient environment light, so the passed direction is the light reflection direction, not the incoming direction.
  4776. * The HemisphericLight can't cast shadows.
  4777. * Documentation : http://doc.babylonjs.com/tutorials/lights
  4778. */
  4779. constructor(name: string, direction: Vector3, scene: Scene);
  4780. /**
  4781. * Returns the string "HemisphericLight".
  4782. */
  4783. getClassName(): string;
  4784. /**
  4785. * Sets the HemisphericLight direction towards the passed target (Vector3).
  4786. * Returns the updated direction.
  4787. */
  4788. setDirectionToTarget(target: Vector3): Vector3;
  4789. getShadowGenerator(): Nullable<ShadowGenerator>;
  4790. /**
  4791. * Sets the passed Effect object with the HemisphericLight normalized direction and color and the passed name (string).
  4792. * Returns the HemisphericLight.
  4793. */
  4794. transferToEffect(effect: Effect, lightIndex: string): HemisphericLight;
  4795. /**
  4796. * Returns the integer 3.
  4797. */
  4798. getTypeID(): number;
  4799. }
  4800. }
  4801. declare module BABYLON {
  4802. class Light extends Node {
  4803. /**
  4804. * If every light affecting the material is in this lightmapMode,
  4805. * material.lightmapTexture adds or multiplies
  4806. * (depends on material.useLightmapAsShadowmap)
  4807. * after every other light calculations.
  4808. */
  4809. static readonly LIGHTMAP_DEFAULT: number;
  4810. /**
  4811. * material.lightmapTexture as only diffuse lighting from this light
  4812. * adds pnly specular lighting from this light
  4813. * adds dynamic shadows
  4814. */
  4815. static readonly LIGHTMAP_SPECULAR: number;
  4816. /**
  4817. * material.lightmapTexture as only lighting
  4818. * no light calculation from this light
  4819. * only adds dynamic shadows from this light
  4820. */
  4821. static readonly LIGHTMAP_SHADOWSONLY: number;
  4822. /**
  4823. * Each light type uses the default quantity according to its type:
  4824. * point/spot lights use luminous intensity
  4825. * directional lights use illuminance
  4826. */
  4827. static readonly INTENSITYMODE_AUTOMATIC: number;
  4828. /**
  4829. * lumen (lm)
  4830. */
  4831. static readonly INTENSITYMODE_LUMINOUSPOWER: number;
  4832. /**
  4833. * candela (lm/sr)
  4834. */
  4835. static readonly INTENSITYMODE_LUMINOUSINTENSITY: number;
  4836. /**
  4837. * lux (lm/m^2)
  4838. */
  4839. static readonly INTENSITYMODE_ILLUMINANCE: number;
  4840. /**
  4841. * nit (cd/m^2)
  4842. */
  4843. static readonly INTENSITYMODE_LUMINANCE: number;
  4844. /**
  4845. * Light type const id of the point light.
  4846. */
  4847. static readonly LIGHTTYPEID_POINTLIGHT: number;
  4848. /**
  4849. * Light type const id of the directional light.
  4850. */
  4851. static readonly LIGHTTYPEID_DIRECTIONALLIGHT: number;
  4852. /**
  4853. * Light type const id of the spot light.
  4854. */
  4855. static readonly LIGHTTYPEID_SPOTLIGHT: number;
  4856. /**
  4857. * Light type const id of the hemispheric light.
  4858. */
  4859. static readonly LIGHTTYPEID_HEMISPHERICLIGHT: number;
  4860. diffuse: Color3;
  4861. specular: Color3;
  4862. intensity: number;
  4863. range: number;
  4864. /**
  4865. * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type
  4866. * of light.
  4867. */
  4868. /**
  4869. * Gets the photometric scale used to interpret the intensity.
  4870. * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.
  4871. */
  4872. /**
  4873. * Sets the photometric scale used to interpret the intensity.
  4874. * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.
  4875. */
  4876. intensityMode: number;
  4877. /**
  4878. * Gets the light radius used by PBR Materials to simulate soft area lights.
  4879. */
  4880. /**
  4881. * sets the light radius used by PBR Materials to simulate soft area lights.
  4882. */
  4883. radius: number;
  4884. /**
  4885. * Defines the rendering priority of the lights. It can help in case of fallback or number of lights
  4886. * exceeding the number allowed of the materials.
  4887. */
  4888. renderPriority: number;
  4889. /**
  4890. * Defines wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching
  4891. * the current shadow generator.
  4892. */
  4893. shadowEnabled: boolean;
  4894. includedOnlyMeshes: AbstractMesh[];
  4895. excludedMeshes: AbstractMesh[];
  4896. excludeWithLayerMask: number;
  4897. includeOnlyWithLayerMask: number;
  4898. lightmapMode: number;
  4899. /**
  4900. * Creates a Light object in the scene.
  4901. * Documentation : http://doc.babylonjs.com/tutorials/lights
  4902. */
  4903. constructor(name: string, scene: Scene);
  4904. /**
  4905. * Returns the string "Light".
  4906. */
  4907. getClassName(): string;
  4908. /**
  4909. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  4910. */
  4911. toString(fullDetails?: boolean): string;
  4912. /**
  4913. * Set the enabled state of this node.
  4914. * @param {boolean} value - the new enabled state
  4915. * @see isEnabled
  4916. */
  4917. setEnabled(value: boolean): void;
  4918. /**
  4919. * Returns the Light associated shadow generator.
  4920. */
  4921. getShadowGenerator(): Nullable<IShadowGenerator>;
  4922. /**
  4923. * Returns a Vector3, the absolute light position in the World.
  4924. */
  4925. getAbsolutePosition(): Vector3;
  4926. transferToEffect(effect: Effect, lightIndex: string): void;
  4927. /**
  4928. * Boolean : True if the light will affect the passed mesh.
  4929. */
  4930. canAffectMesh(mesh: AbstractMesh): boolean;
  4931. /**
  4932. * Returns the light World matrix.
  4933. */
  4934. getWorldMatrix(): Matrix;
  4935. /**
  4936. * Sort function to order lights for rendering.
  4937. * @param a First Light object to compare to second.
  4938. * @param b Second Light object to compare first.
  4939. * @return -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b.
  4940. */
  4941. static compareLightsPriority(a: Light, b: Light): number;
  4942. /**
  4943. * Disposes the light.
  4944. */
  4945. dispose(): void;
  4946. /**
  4947. * Returns the light type ID (integer).
  4948. */
  4949. getTypeID(): number;
  4950. /**
  4951. * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.
  4952. */
  4953. getScaledIntensity(): number;
  4954. /**
  4955. * Returns a new Light object, named "name", from the current one.
  4956. */
  4957. clone(name: string): Nullable<Light>;
  4958. /**
  4959. * Serializes the current light into a Serialization object.
  4960. * Returns the serialized object.
  4961. */
  4962. serialize(): any;
  4963. /**
  4964. * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.
  4965. * This new light is named "name" and added to the passed scene.
  4966. */
  4967. static GetConstructorFromName(type: number, name: string, scene: Scene): Nullable<() => Light>;
  4968. /**
  4969. * Parses the passed "parsedLight" and returns a new instanced Light from this parsing.
  4970. */
  4971. static Parse(parsedLight: any, scene: Scene): Nullable<Light>;
  4972. /**
  4973. * Recomputes the cached photometric scale if needed.
  4974. */
  4975. /**
  4976. * Returns the Photometric Scale according to the light type and intensity mode.
  4977. */
  4978. }
  4979. }
  4980. declare module BABYLON {
  4981. class PointLight extends ShadowLight {
  4982. /**
  4983. * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  4984. * This specifies what angle the shadow will use to be created.
  4985. *
  4986. * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.
  4987. */
  4988. /**
  4989. * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  4990. * This specifies what angle the shadow will use to be created.
  4991. *
  4992. * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.
  4993. */
  4994. shadowAngle: number;
  4995. /**
  4996. * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  4997. */
  4998. direction: Vector3;
  4999. /**
  5000. * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.
  5001. * A PointLight emits the light in every direction.
  5002. * It can cast shadows.
  5003. * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :
  5004. * ```javascript
  5005. * var pointLight = new BABYLON.PointLight("pl", camera.position, scene);
  5006. * ```
  5007. * Documentation : http://doc.babylonjs.com/tutorials/lights
  5008. */
  5009. constructor(name: string, position: Vector3, scene: Scene);
  5010. /**
  5011. * Returns the string "PointLight"
  5012. */
  5013. getClassName(): string;
  5014. /**
  5015. * Returns the integer 0.
  5016. */
  5017. getTypeID(): number;
  5018. /**
  5019. * Specifies wether or not the shadowmap should be a cube texture.
  5020. */
  5021. needCube(): boolean;
  5022. /**
  5023. * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).
  5024. */
  5025. getShadowDirection(faceIndex?: number): Vector3;
  5026. /**
  5027. * Sets the passed matrix "matrix" as a left-handed perspective projection matrix with the following settings :
  5028. * - fov = PI / 2
  5029. * - aspect ratio : 1.0
  5030. * - z-near and far equal to the active camera minZ and maxZ.
  5031. * Returns the PointLight.
  5032. */
  5033. /**
  5034. * Sets the passed Effect "effect" with the PointLight transformed position (or position, if none) and passed name (string).
  5035. * Returns the PointLight.
  5036. */
  5037. transferToEffect(effect: Effect, lightIndex: string): PointLight;
  5038. }
  5039. }
  5040. declare module BABYLON {
  5041. interface IShadowLight extends Light {
  5042. id: string;
  5043. position: Vector3;
  5044. direction: Vector3;
  5045. transformedPosition: Vector3;
  5046. transformedDirection: Vector3;
  5047. name: string;
  5048. shadowMinZ: number;
  5049. shadowMaxZ: number;
  5050. computeTransformedInformation(): boolean;
  5051. getScene(): Scene;
  5052. customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
  5053. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): IShadowLight;
  5054. getDepthScale(): number;
  5055. needCube(): boolean;
  5056. needProjectionMatrixCompute(): boolean;
  5057. forceProjectionMatrixCompute(): void;
  5058. getShadowDirection(faceIndex?: number): Vector3;
  5059. /**
  5060. * Gets the minZ used for shadow according to both the scene and the light.
  5061. * @param activeCamera
  5062. */
  5063. getDepthMinZ(activeCamera: Camera): number;
  5064. /**
  5065. * Gets the minZ used for shadow according to both the scene and the light.
  5066. * @param activeCamera
  5067. */
  5068. getDepthMaxZ(activeCamera: Camera): number;
  5069. }
  5070. abstract class ShadowLight extends Light implements IShadowLight {
  5071. position: Vector3;
  5072. direction: Vector3;
  5073. shadowMinZ: number;
  5074. shadowMaxZ: number;
  5075. customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
  5076. transformedPosition: Vector3;
  5077. transformedDirection: Vector3;
  5078. /**
  5079. * Computes the light transformed position/direction in case the light is parented. Returns true if parented, else false.
  5080. */
  5081. computeTransformedInformation(): boolean;
  5082. /**
  5083. * Return the depth scale used for the shadow map.
  5084. */
  5085. getDepthScale(): number;
  5086. /**
  5087. * Returns the light direction (Vector3) for any passed face index.
  5088. */
  5089. getShadowDirection(faceIndex?: number): Vector3;
  5090. /**
  5091. * Returns the DirectionalLight absolute position in the World.
  5092. */
  5093. getAbsolutePosition(): Vector3;
  5094. /**
  5095. * Sets the DirectionalLight direction toward the passed target (Vector3).
  5096. * Returns the updated DirectionalLight direction (Vector3).
  5097. */
  5098. setDirectionToTarget(target: Vector3): Vector3;
  5099. /**
  5100. * Returns the light rotation (Vector3).
  5101. */
  5102. getRotation(): Vector3;
  5103. /**
  5104. * Boolean : false by default.
  5105. */
  5106. needCube(): boolean;
  5107. /**
  5108. * Specifies wether or not the projection matrix should be recomputed this frame.
  5109. */
  5110. needProjectionMatrixCompute(): boolean;
  5111. /**
  5112. * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.
  5113. */
  5114. forceProjectionMatrixCompute(): void;
  5115. /**
  5116. * Get the world matrix of the sahdow lights.
  5117. */
  5118. /**
  5119. * Gets the minZ used for shadow according to both the scene and the light.
  5120. * @param activeCamera
  5121. */
  5122. getDepthMinZ(activeCamera: Camera): number;
  5123. /**
  5124. * Gets the maxZ used for shadow according to both the scene and the light.
  5125. * @param activeCamera
  5126. */
  5127. getDepthMaxZ(activeCamera: Camera): number;
  5128. /**
  5129. * Sets the projection matrix according to the type of light and custom projection matrix definition.
  5130. * Returns the light.
  5131. */
  5132. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): IShadowLight;
  5133. }
  5134. }
  5135. declare module BABYLON {
  5136. class SpotLight extends ShadowLight {
  5137. angle: number;
  5138. /**
  5139. * Allows scaling the angle of the light for shadow generation only.
  5140. */
  5141. shadowAngleScale: number;
  5142. exponent: number;
  5143. /**
  5144. * Creates a SpotLight object in the scene with the passed parameters :
  5145. * - `position` (Vector3) is the initial SpotLight position,
  5146. * - `direction` (Vector3) is the initial SpotLight direction,
  5147. * - `angle` (float, in radians) is the spot light cone angle,
  5148. * - `exponent` (float) is the light decay speed with the distance from the emission spot.
  5149. * A spot light is a simply light oriented cone.
  5150. * It can cast shadows.
  5151. * Documentation : http://doc.babylonjs.com/tutorials/lights
  5152. */
  5153. constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
  5154. /**
  5155. * Returns the string "SpotLight".
  5156. */
  5157. getClassName(): string;
  5158. /**
  5159. * Returns the integer 2.
  5160. */
  5161. getTypeID(): number;
  5162. /**
  5163. * Sets the passed matrix "matrix" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.
  5164. * Returns the SpotLight.
  5165. */
  5166. /**
  5167. * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.
  5168. * Return the SpotLight.
  5169. */
  5170. transferToEffect(effect: Effect, lightIndex: string): SpotLight;
  5171. }
  5172. }
  5173. declare module BABYLON {
  5174. /**
  5175. * This class can be used to get instrumentation data from a Babylon engine
  5176. */
  5177. class EngineInstrumentation implements IDisposable {
  5178. engine: Engine;
  5179. /**
  5180. * Gets the perf counter used for GPU frame time
  5181. */
  5182. readonly gpuFrameTimeCounter: PerfCounter;
  5183. /**
  5184. * Gets the GPU frame time capture status
  5185. */
  5186. /**
  5187. * Enable or disable the GPU frame time capture
  5188. */
  5189. captureGPUFrameTime: boolean;
  5190. /**
  5191. * Gets the perf counter used for shader compilation time
  5192. */
  5193. readonly shaderCompilationTimeCounter: PerfCounter;
  5194. /**
  5195. * Gets the shader compilation time capture status
  5196. */
  5197. /**
  5198. * Enable or disable the shader compilation time capture
  5199. */
  5200. captureShaderCompilationTime: boolean;
  5201. constructor(engine: Engine);
  5202. dispose(): void;
  5203. }
  5204. }
  5205. declare module BABYLON {
  5206. /**
  5207. * This class can be used to get instrumentation data from a Babylon engine
  5208. */
  5209. class SceneInstrumentation implements IDisposable {
  5210. scene: Scene;
  5211. /**
  5212. * Gets the perf counter used for active meshes evaluation time
  5213. */
  5214. readonly activeMeshesEvaluationTimeCounter: PerfCounter;
  5215. /**
  5216. * Gets the active meshes evaluation time capture status
  5217. */
  5218. /**
  5219. * Enable or disable the active meshes evaluation time capture
  5220. */
  5221. captureActiveMeshesEvaluationTime: boolean;
  5222. /**
  5223. * Gets the perf counter used for render targets render time
  5224. */
  5225. readonly renderTargetsRenderTimeCounter: PerfCounter;
  5226. /**
  5227. * Gets the render targets render time capture status
  5228. */
  5229. /**
  5230. * Enable or disable the render targets render time capture
  5231. */
  5232. captureRenderTargetsRenderTime: boolean;
  5233. /**
  5234. * Gets the perf counter used for particles render time
  5235. */
  5236. readonly particlesRenderTimeCounter: PerfCounter;
  5237. /**
  5238. * Gets the particles render time capture status
  5239. */
  5240. /**
  5241. * Enable or disable the particles render time capture
  5242. */
  5243. captureParticlesRenderTime: boolean;
  5244. /**
  5245. * Gets the perf counter used for sprites render time
  5246. */
  5247. readonly spritesRenderTimeCounter: PerfCounter;
  5248. /**
  5249. * Gets the sprites render time capture status
  5250. */
  5251. /**
  5252. * Enable or disable the sprites render time capture
  5253. */
  5254. captureSpritesRenderTime: boolean;
  5255. /**
  5256. * Gets the perf counter used for physics time
  5257. */
  5258. readonly physicsTimeCounter: PerfCounter;
  5259. /**
  5260. * Gets the physics time capture status
  5261. */
  5262. /**
  5263. * Enable or disable the physics time capture
  5264. */
  5265. capturePhysicsTime: boolean;
  5266. /**
  5267. * Gets the perf counter used for animations time
  5268. */
  5269. readonly animationsTimeCounter: PerfCounter;
  5270. /**
  5271. * Gets the animations time capture status
  5272. */
  5273. /**
  5274. * Enable or disable the animations time capture
  5275. */
  5276. captureAnimationsTime: boolean;
  5277. /**
  5278. * Gets the perf counter used for frame time capture
  5279. */
  5280. readonly frameTimeCounter: PerfCounter;
  5281. /**
  5282. * Gets the frame time capture status
  5283. */
  5284. /**
  5285. * Enable or disable the frame time capture
  5286. */
  5287. captureFrameTime: boolean;
  5288. /**
  5289. * Gets the perf counter used for inter-frames time capture
  5290. */
  5291. readonly interFrameTimeCounter: PerfCounter;
  5292. /**
  5293. * Gets the inter-frames time capture status
  5294. */
  5295. /**
  5296. * Enable or disable the inter-frames time capture
  5297. */
  5298. captureInterFrameTime: boolean;
  5299. /**
  5300. * Gets the perf counter used for render time capture
  5301. */
  5302. readonly renderTimeCounter: PerfCounter;
  5303. /**
  5304. * Gets the render time capture status
  5305. */
  5306. /**
  5307. * Enable or disable the render time capture
  5308. */
  5309. captureRenderTime: boolean;
  5310. /**
  5311. * Gets the perf counter used for draw calls
  5312. */
  5313. readonly drawCallsCounter: PerfCounter;
  5314. /**
  5315. * Gets the perf counter used for texture collisions
  5316. */
  5317. readonly textureCollisionsCounter: PerfCounter;
  5318. constructor(scene: Scene);
  5319. dispose(): void;
  5320. }
  5321. }
  5322. declare module BABYLON {
  5323. class _TimeToken {
  5324. }
  5325. }
  5326. declare module BABYLON {
  5327. class LensFlare {
  5328. size: number;
  5329. position: number;
  5330. color: Color3;
  5331. texture: Nullable<Texture>;
  5332. alphaMode: number;
  5333. static AddFlare(size: number, position: number, color: Color3, imgUrl: string, system: LensFlareSystem): LensFlare;
  5334. constructor(size: number, position: number, color: Color3, imgUrl: string, system: LensFlareSystem);
  5335. dispose(): void;
  5336. }
  5337. }
  5338. declare module BABYLON {
  5339. class LensFlareSystem {
  5340. name: string;
  5341. lensFlares: LensFlare[];
  5342. borderLimit: number;
  5343. viewportBorder: number;
  5344. meshesSelectionPredicate: (mesh: AbstractMesh) => boolean;
  5345. layerMask: number;
  5346. id: string;
  5347. constructor(name: string, emitter: any, scene: Scene);
  5348. isEnabled: boolean;
  5349. getScene(): Scene;
  5350. getEmitter(): any;
  5351. setEmitter(newEmitter: any): void;
  5352. getEmitterPosition(): Vector3;
  5353. computeEffectivePosition(globalViewport: Viewport): boolean;
  5354. render(): boolean;
  5355. dispose(): void;
  5356. static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
  5357. serialize(): any;
  5358. }
  5359. }
  5360. declare module BABYLON {
  5361. interface ILoadingScreen {
  5362. displayLoadingUI: () => void;
  5363. hideLoadingUI: () => void;
  5364. loadingUIBackgroundColor: string;
  5365. loadingUIText: string;
  5366. }
  5367. class DefaultLoadingScreen implements ILoadingScreen {
  5368. constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
  5369. displayLoadingUI(): void;
  5370. hideLoadingUI(): void;
  5371. loadingUIText: string;
  5372. loadingUIBackgroundColor: string;
  5373. }
  5374. }
  5375. declare module BABYLON {
  5376. class SceneLoaderProgressEvent {
  5377. readonly lengthComputable: boolean;
  5378. readonly loaded: number;
  5379. readonly total: number;
  5380. constructor(lengthComputable: boolean, loaded: number, total: number);
  5381. static FromProgressEvent(event: ProgressEvent): SceneLoaderProgressEvent;
  5382. }
  5383. interface ISceneLoaderPluginExtensions {
  5384. [extension: string]: {
  5385. isBinary: boolean;
  5386. };
  5387. }
  5388. interface ISceneLoaderPluginFactory {
  5389. name: string;
  5390. createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  5391. canDirectLoad?: (data: string) => boolean;
  5392. }
  5393. interface ISceneLoaderPlugin {
  5394. name: string;
  5395. extensions: string | ISceneLoaderPluginExtensions;
  5396. importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[], onError?: (message: string, exception?: any) => void) => boolean;
  5397. load: (scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void) => boolean;
  5398. canDirectLoad?: (data: string) => boolean;
  5399. rewriteRootURL?: (rootUrl: string, responseURL?: string) => string;
  5400. }
  5401. interface ISceneLoaderPluginAsync {
  5402. name: string;
  5403. extensions: string | ISceneLoaderPluginExtensions;
  5404. importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void) => void;
  5405. loadAsync: (scene: Scene, data: string, rootUrl: string, onSuccess?: () => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void) => void;
  5406. canDirectLoad?: (data: string) => boolean;
  5407. rewriteRootURL?: (rootUrl: string, responseURL?: string) => string;
  5408. }
  5409. class SceneLoader {
  5410. static readonly NO_LOGGING: number;
  5411. static readonly MINIMAL_LOGGING: number;
  5412. static readonly SUMMARY_LOGGING: number;
  5413. static readonly DETAILED_LOGGING: number;
  5414. static ForceFullSceneLoadingForIncremental: boolean;
  5415. static ShowLoadingScreen: boolean;
  5416. static loggingLevel: number;
  5417. static CleanBoneMatrixWeights: boolean;
  5418. static OnPluginActivatedObservable: Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
  5419. static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory;
  5420. static IsPluginForExtensionAvailable(extension: string): boolean;
  5421. static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
  5422. /**
  5423. * Import meshes into a scene
  5424. * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
  5425. * @param rootUrl a string that defines the root url for scene and resources
  5426. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  5427. * @param scene the instance of BABYLON.Scene to append to
  5428. * @param onSuccess a callback with a list of imported meshes, particleSystems, and skeletons when import succeeds
  5429. * @param onProgress a callback with a progress event for each file being loaded
  5430. * @param onError a callback with the scene, a message, and possibly an exception when import fails
  5431. */
  5432. static ImportMesh(meshNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onSuccess?: Nullable<(meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void>, onProgress?: Nullable<(event: SceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
  5433. /**
  5434. * Load a scene
  5435. * @param rootUrl a string that defines the root url for scene and resources
  5436. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  5437. * @param engine is the instance of BABYLON.Engine to use to create the scene
  5438. * @param onSuccess a callback with the scene when import succeeds
  5439. * @param onProgress a callback with a progress event for each file being loaded
  5440. * @param onError a callback with the scene, a message, and possibly an exception when import fails
  5441. */
  5442. static Load(rootUrl: string, sceneFilename: any, engine: Engine, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: SceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
  5443. /**
  5444. * Append a scene
  5445. * @param rootUrl a string that defines the root url for scene and resources
  5446. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  5447. * @param scene is the instance of BABYLON.Scene to append to
  5448. * @param onSuccess a callback with the scene when import succeeds
  5449. * @param onProgress a callback with a progress event for each file being loaded
  5450. * @param onError a callback with the scene, a message, and possibly an exception when import fails
  5451. */
  5452. static Append(rootUrl: string, sceneFilename: any, scene: Scene, onSuccess?: Nullable<(scene: Scene) => void>, onProgress?: Nullable<(event: SceneLoaderProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: Nullable<string>): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
  5453. }
  5454. }
  5455. declare module BABYLON {
  5456. /**
  5457. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  5458. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  5459. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  5460. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  5461. */
  5462. class ColorCurves {
  5463. /**
  5464. * Gets the global Hue value.
  5465. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  5466. */
  5467. /**
  5468. * Sets the global Hue value.
  5469. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  5470. */
  5471. globalHue: number;
  5472. /**
  5473. * Gets the global Density value.
  5474. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  5475. * Values less than zero provide a filter of opposite hue.
  5476. */
  5477. /**
  5478. * Sets the global Density value.
  5479. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  5480. * Values less than zero provide a filter of opposite hue.
  5481. */
  5482. globalDensity: number;
  5483. /**
  5484. * Gets the global Saturation value.
  5485. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  5486. */
  5487. /**
  5488. * Sets the global Saturation value.
  5489. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  5490. */
  5491. globalSaturation: number;
  5492. /**
  5493. * Gets the highlights Hue value.
  5494. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  5495. */
  5496. /**
  5497. * Sets the highlights Hue value.
  5498. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  5499. */
  5500. highlightsHue: number;
  5501. /**
  5502. * Gets the highlights Density value.
  5503. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  5504. * Values less than zero provide a filter of opposite hue.
  5505. */
  5506. /**
  5507. * Sets the highlights Density value.
  5508. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  5509. * Values less than zero provide a filter of opposite hue.
  5510. */
  5511. highlightsDensity: number;
  5512. /**
  5513. * Gets the highlights Saturation value.
  5514. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  5515. */
  5516. /**
  5517. * Sets the highlights Saturation value.
  5518. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  5519. */
  5520. highlightsSaturation: number;
  5521. /**
  5522. * Gets the highlights Exposure value.
  5523. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  5524. */
  5525. /**
  5526. * Sets the highlights Exposure value.
  5527. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  5528. */
  5529. highlightsExposure: number;
  5530. /**
  5531. * Gets the midtones Hue value.
  5532. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  5533. */
  5534. /**
  5535. * Sets the midtones Hue value.
  5536. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  5537. */
  5538. midtonesHue: number;
  5539. /**
  5540. * Gets the midtones Density value.
  5541. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  5542. * Values less than zero provide a filter of opposite hue.
  5543. */
  5544. /**
  5545. * Sets the midtones Density value.
  5546. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  5547. * Values less than zero provide a filter of opposite hue.
  5548. */
  5549. midtonesDensity: number;
  5550. /**
  5551. * Gets the midtones Saturation value.
  5552. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  5553. */
  5554. /**
  5555. * Sets the midtones Saturation value.
  5556. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  5557. */
  5558. midtonesSaturation: number;
  5559. /**
  5560. * Gets the midtones Exposure value.
  5561. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  5562. */
  5563. /**
  5564. * Sets the midtones Exposure value.
  5565. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  5566. */
  5567. midtonesExposure: number;
  5568. /**
  5569. * Gets the shadows Hue value.
  5570. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  5571. */
  5572. /**
  5573. * Sets the shadows Hue value.
  5574. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  5575. */
  5576. shadowsHue: number;
  5577. /**
  5578. * Gets the shadows Density value.
  5579. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  5580. * Values less than zero provide a filter of opposite hue.
  5581. */
  5582. /**
  5583. * Sets the shadows Density value.
  5584. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  5585. * Values less than zero provide a filter of opposite hue.
  5586. */
  5587. shadowsDensity: number;
  5588. /**
  5589. * Gets the shadows Saturation value.
  5590. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  5591. */
  5592. /**
  5593. * Sets the shadows Saturation value.
  5594. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  5595. */
  5596. shadowsSaturation: number;
  5597. /**
  5598. * Gets the shadows Exposure value.
  5599. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  5600. */
  5601. /**
  5602. * Sets the shadows Exposure value.
  5603. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  5604. */
  5605. shadowsExposure: number;
  5606. getClassName(): string;
  5607. /**
  5608. * Binds the color curves to the shader.
  5609. * @param colorCurves The color curve to bind
  5610. * @param effect The effect to bind to
  5611. */
  5612. static Bind(colorCurves: ColorCurves, effect: Effect, positiveUniform?: string, neutralUniform?: string, negativeUniform?: string): void;
  5613. /**
  5614. * Prepare the list of uniforms associated with the ColorCurves effects.
  5615. * @param uniformsList The list of uniforms used in the effect
  5616. */
  5617. static PrepareUniforms(uniformsList: string[]): void;
  5618. /**
  5619. * Returns color grading data based on a hue, density, saturation and exposure value.
  5620. * @param filterHue The hue of the color filter.
  5621. * @param filterDensity The density of the color filter.
  5622. * @param saturation The saturation.
  5623. * @param exposure The exposure.
  5624. * @param result The result data container.
  5625. */
  5626. /**
  5627. * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
  5628. * @param value The input slider value in range [-100,100].
  5629. * @returns Adjusted value.
  5630. */
  5631. /**
  5632. * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
  5633. * @param hue The hue (H) input.
  5634. * @param saturation The saturation (S) input.
  5635. * @param brightness The brightness (B) input.
  5636. * @result An RGBA color represented as Vector4.
  5637. */
  5638. /**
  5639. * Returns a value clamped between min and max
  5640. * @param value The value to clamp
  5641. * @param min The minimum of value
  5642. * @param max The maximum of value
  5643. * @returns The clamped value.
  5644. */
  5645. /**
  5646. * Clones the current color curve instance.
  5647. * @return The cloned curves
  5648. */
  5649. clone(): ColorCurves;
  5650. /**
  5651. * Serializes the current color curve instance to a json representation.
  5652. * @return a JSON representation
  5653. */
  5654. serialize(): any;
  5655. /**
  5656. * Parses the color curve from a json representation.
  5657. * @param source the JSON source to parse
  5658. * @return The parsed curves
  5659. */
  5660. static Parse(source: any): ColorCurves;
  5661. }
  5662. }
  5663. declare module BABYLON {
  5664. class EffectFallbacks {
  5665. unBindMesh(): void;
  5666. addFallback(rank: number, define: string): void;
  5667. addCPUSkinningFallback(rank: number, mesh: AbstractMesh): void;
  5668. readonly isMoreFallbacks: boolean;
  5669. reduce(currentDefines: string): string;
  5670. }
  5671. class EffectCreationOptions {
  5672. attributes: string[];
  5673. uniformsNames: string[];
  5674. uniformBuffersNames: string[];
  5675. samplers: string[];
  5676. defines: any;
  5677. fallbacks: Nullable<EffectFallbacks>;
  5678. onCompiled: Nullable<(effect: Effect) => void>;
  5679. onError: Nullable<(effect: Effect, errors: string) => void>;
  5680. indexParameters: any;
  5681. maxSimultaneousLights: number;
  5682. transformFeedbackVaryings: Nullable<string[]>;
  5683. }
  5684. class Effect {
  5685. name: any;
  5686. defines: string;
  5687. onCompiled: Nullable<(effect: Effect) => void>;
  5688. onError: Nullable<(effect: Effect, errors: string) => void>;
  5689. onBind: Nullable<(effect: Effect) => void>;
  5690. uniqueId: number;
  5691. onCompileObservable: Observable<Effect>;
  5692. onErrorObservable: Observable<Effect>;
  5693. onBindObservable: Observable<Effect>;
  5694. constructor(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: Nullable<string[]>, engine?: Engine, defines?: Nullable<string>, fallbacks?: Nullable<EffectFallbacks>, onCompiled?: Nullable<(effect: Effect) => void>, onError?: Nullable<(effect: Effect, errors: string) => void>, indexParameters?: any);
  5695. readonly key: string;
  5696. isReady(): boolean;
  5697. getEngine(): Engine;
  5698. getProgram(): WebGLProgram;
  5699. getAttributesNames(): string[];
  5700. getAttributeLocation(index: number): number;
  5701. getAttributeLocationByName(name: string): number;
  5702. getAttributesCount(): number;
  5703. getUniformIndex(uniformName: string): number;
  5704. getUniform(uniformName: string): Nullable<WebGLUniformLocation>;
  5705. getSamplers(): string[];
  5706. getCompilationError(): string;
  5707. executeWhenCompiled(func: (effect: Effect) => void): void;
  5708. getSpecificUniformLocations(names: string[]): Nullable<WebGLUniformLocation>[];
  5709. readonly isSupported: boolean;
  5710. setTexture(channel: string, texture: Nullable<BaseTexture>): void;
  5711. setTextureArray(channel: string, textures: BaseTexture[]): void;
  5712. setTextureFromPostProcess(channel: string, postProcess: Nullable<PostProcess>): void;
  5713. bindUniformBuffer(buffer: WebGLBuffer, name: string): void;
  5714. bindUniformBlock(blockName: string, index: number): void;
  5715. setInt(uniformName: string, value: number): Effect;
  5716. setIntArray(uniformName: string, array: Int32Array): Effect;
  5717. setIntArray2(uniformName: string, array: Int32Array): Effect;
  5718. setIntArray3(uniformName: string, array: Int32Array): Effect;
  5719. setIntArray4(uniformName: string, array: Int32Array): Effect;
  5720. setFloatArray(uniformName: string, array: Float32Array): Effect;
  5721. setFloatArray2(uniformName: string, array: Float32Array): Effect;
  5722. setFloatArray3(uniformName: string, array: Float32Array): Effect;
  5723. setFloatArray4(uniformName: string, array: Float32Array): Effect;
  5724. setArray(uniformName: string, array: number[]): Effect;
  5725. setArray2(uniformName: string, array: number[]): Effect;
  5726. setArray3(uniformName: string, array: number[]): Effect;
  5727. setArray4(uniformName: string, array: number[]): Effect;
  5728. setMatrices(uniformName: string, matrices: Float32Array): Effect;
  5729. setMatrix(uniformName: string, matrix: Matrix): Effect;
  5730. setMatrix3x3(uniformName: string, matrix: Float32Array): Effect;
  5731. setMatrix2x2(uniformName: string, matrix: Float32Array): Effect;
  5732. setFloat(uniformName: string, value: number): Effect;
  5733. setBool(uniformName: string, bool: boolean): Effect;
  5734. setVector2(uniformName: string, vector2: Vector2): Effect;
  5735. setFloat2(uniformName: string, x: number, y: number): Effect;
  5736. setVector3(uniformName: string, vector3: Vector3): Effect;
  5737. setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
  5738. setVector4(uniformName: string, vector4: Vector4): Effect;
  5739. setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
  5740. setColor3(uniformName: string, color3: Color3): Effect;
  5741. setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
  5742. static ShadersStore: {
  5743. [key: string]: string;
  5744. };
  5745. static IncludesShadersStore: {
  5746. [key: string]: string;
  5747. };
  5748. static ResetCache(): void;
  5749. }
  5750. }
  5751. declare module BABYLON {
  5752. class FresnelParameters {
  5753. isEnabled: boolean;
  5754. leftColor: Color3;
  5755. rightColor: Color3;
  5756. bias: number;
  5757. power: number;
  5758. clone(): FresnelParameters;
  5759. serialize(): any;
  5760. static Parse(parsedFresnelParameters: any): FresnelParameters;
  5761. }
  5762. }
  5763. declare module BABYLON {
  5764. /**
  5765. * Interface to follow in your material defines to integrate easily the
  5766. * Image proccessing functions.
  5767. */
  5768. interface IImageProcessingConfigurationDefines {
  5769. IMAGEPROCESSING: boolean;
  5770. VIGNETTE: boolean;
  5771. VIGNETTEBLENDMODEMULTIPLY: boolean;
  5772. VIGNETTEBLENDMODEOPAQUE: boolean;
  5773. TONEMAPPING: boolean;
  5774. CONTRAST: boolean;
  5775. EXPOSURE: boolean;
  5776. COLORCURVES: boolean;
  5777. COLORGRADING: boolean;
  5778. COLORGRADING3D: boolean;
  5779. SAMPLER3DGREENDEPTH: boolean;
  5780. SAMPLER3DBGRMAP: boolean;
  5781. IMAGEPROCESSINGPOSTPROCESS: boolean;
  5782. }
  5783. /**
  5784. * This groups together the common properties used for image processing either in direct forward pass
  5785. * or through post processing effect depending on the use of the image processing pipeline in your scene
  5786. * or not.
  5787. */
  5788. class ImageProcessingConfiguration {
  5789. /**
  5790. * Color curves setup used in the effect if colorCurvesEnabled is set to true
  5791. */
  5792. colorCurves: Nullable<ColorCurves>;
  5793. /**
  5794. * Gets wether the color curves effect is enabled.
  5795. */
  5796. /**
  5797. * Sets wether the color curves effect is enabled.
  5798. */
  5799. colorCurvesEnabled: boolean;
  5800. /**
  5801. * Color grading LUT texture used in the effect if colorGradingEnabled is set to true
  5802. */
  5803. colorGradingTexture: Nullable<BaseTexture>;
  5804. /**
  5805. * Gets wether the color grading effect is enabled.
  5806. */
  5807. /**
  5808. * Sets wether the color grading effect is enabled.
  5809. */
  5810. colorGradingEnabled: boolean;
  5811. /**
  5812. * Gets wether the color grading effect is using a green depth for the 3d Texture.
  5813. */
  5814. /**
  5815. * Sets wether the color grading effect is using a green depth for the 3d Texture.
  5816. */
  5817. colorGradingWithGreenDepth: boolean;
  5818. /**
  5819. * Gets wether the color grading texture contains BGR values.
  5820. */
  5821. /**
  5822. * Sets wether the color grading texture contains BGR values.
  5823. */
  5824. colorGradingBGR: boolean;
  5825. /**
  5826. * Gets the Exposure used in the effect.
  5827. */
  5828. /**
  5829. * Sets the Exposure used in the effect.
  5830. */
  5831. exposure: number;
  5832. /**
  5833. * Gets wether the tone mapping effect is enabled.
  5834. */
  5835. /**
  5836. * Sets wether the tone mapping effect is enabled.
  5837. */
  5838. toneMappingEnabled: boolean;
  5839. /**
  5840. * Gets the contrast used in the effect.
  5841. */
  5842. /**
  5843. * Sets the contrast used in the effect.
  5844. */
  5845. contrast: number;
  5846. /**
  5847. * Vignette stretch size.
  5848. */
  5849. vignetteStretch: number;
  5850. /**
  5851. * Vignette centre X Offset.
  5852. */
  5853. vignetteCentreX: number;
  5854. /**
  5855. * Vignette centre Y Offset.
  5856. */
  5857. vignetteCentreY: number;
  5858. /**
  5859. * Vignette weight or intensity of the vignette effect.
  5860. */
  5861. vignetteWeight: number;
  5862. /**
  5863. * Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)
  5864. * if vignetteEnabled is set to true.
  5865. */
  5866. vignetteColor: Color4;
  5867. /**
  5868. * Camera field of view used by the Vignette effect.
  5869. */
  5870. vignetteCameraFov: number;
  5871. /**
  5872. * Gets the vignette blend mode allowing different kind of effect.
  5873. */
  5874. /**
  5875. * Sets the vignette blend mode allowing different kind of effect.
  5876. */
  5877. vignetteBlendMode: number;
  5878. /**
  5879. * Gets wether the vignette effect is enabled.
  5880. */
  5881. /**
  5882. * Sets wether the vignette effect is enabled.
  5883. */
  5884. vignetteEnabled: boolean;
  5885. /**
  5886. * Gets wether the image processing is applied through a post process or not.
  5887. */
  5888. /**
  5889. * Sets wether the image processing is applied through a post process or not.
  5890. */
  5891. applyByPostProcess: boolean;
  5892. /**
  5893. * Gets wether the image processing is enabled or not.
  5894. */
  5895. /**
  5896. * Sets wether the image processing is enabled or not.
  5897. */
  5898. isEnabled: boolean;
  5899. /**
  5900. * An event triggered when the configuration changes and requires Shader to Update some parameters.
  5901. * @type {BABYLON.Observable}
  5902. */
  5903. onUpdateParameters: Observable<ImageProcessingConfiguration>;
  5904. /**
  5905. * Method called each time the image processing information changes requires to recompile the effect.
  5906. */
  5907. getClassName(): string;
  5908. /**
  5909. * Prepare the list of uniforms associated with the Image Processing effects.
  5910. * @param uniformsList The list of uniforms used in the effect
  5911. * @param defines the list of defines currently in use
  5912. */
  5913. static PrepareUniforms(uniforms: string[], defines: IImageProcessingConfigurationDefines): void;
  5914. /**
  5915. * Prepare the list of samplers associated with the Image Processing effects.
  5916. * @param uniformsList The list of uniforms used in the effect
  5917. * @param defines the list of defines currently in use
  5918. */
  5919. static PrepareSamplers(samplersList: string[], defines: IImageProcessingConfigurationDefines): void;
  5920. /**
  5921. * Prepare the list of defines associated to the shader.
  5922. * @param defines the list of defines to complete
  5923. */
  5924. prepareDefines(defines: IImageProcessingConfigurationDefines, forPostProcess?: boolean): void;
  5925. /**
  5926. * Returns true if all the image processing information are ready.
  5927. */
  5928. isReady(): boolean;
  5929. /**
  5930. * Binds the image processing to the shader.
  5931. * @param effect The effect to bind to
  5932. */
  5933. bind(effect: Effect, aspectRatio?: number): void;
  5934. /**
  5935. * Clones the current image processing instance.
  5936. * @return The cloned image processing
  5937. */
  5938. clone(): ImageProcessingConfiguration;
  5939. /**
  5940. * Serializes the current image processing instance to a json representation.
  5941. * @return a JSON representation
  5942. */
  5943. serialize(): any;
  5944. /**
  5945. * Parses the image processing from a json representation.
  5946. * @param source the JSON source to parse
  5947. * @return The parsed image processing
  5948. */
  5949. static Parse(source: any): ImageProcessingConfiguration;
  5950. /**
  5951. * Used to apply the vignette as a mix with the pixel color.
  5952. */
  5953. static readonly VIGNETTEMODE_MULTIPLY: number;
  5954. /**
  5955. * Used to apply the vignette as a replacement of the pixel color.
  5956. */
  5957. static readonly VIGNETTEMODE_OPAQUE: number;
  5958. }
  5959. }
  5960. declare module BABYLON {
  5961. class MaterialDefines {
  5962. readonly isDirty: boolean;
  5963. markAsProcessed(): void;
  5964. markAsUnprocessed(): void;
  5965. markAllAsDirty(): void;
  5966. markAsImageProcessingDirty(): void;
  5967. markAsLightDirty(): void;
  5968. markAsAttributesDirty(): void;
  5969. markAsTexturesDirty(): void;
  5970. markAsFresnelDirty(): void;
  5971. markAsMiscDirty(): void;
  5972. rebuild(): void;
  5973. isEqual(other: MaterialDefines): boolean;
  5974. cloneTo(other: MaterialDefines): void;
  5975. reset(): void;
  5976. toString(): string;
  5977. }
  5978. class Material implements IAnimatable {
  5979. static readonly TriangleFillMode: number;
  5980. static readonly WireFrameFillMode: number;
  5981. static readonly PointFillMode: number;
  5982. static readonly PointListDrawMode: number;
  5983. static readonly LineListDrawMode: number;
  5984. static readonly LineLoopDrawMode: number;
  5985. static readonly LineStripDrawMode: number;
  5986. static readonly TriangleStripDrawMode: number;
  5987. static readonly TriangleFanDrawMode: number;
  5988. static readonly ClockWiseSideOrientation: number;
  5989. static readonly CounterClockWiseSideOrientation: number;
  5990. static readonly TextureDirtyFlag: number;
  5991. static readonly LightDirtyFlag: number;
  5992. static readonly FresnelDirtyFlag: number;
  5993. static readonly AttributesDirtyFlag: number;
  5994. static readonly MiscDirtyFlag: number;
  5995. id: string;
  5996. name: string;
  5997. checkReadyOnEveryCall: boolean;
  5998. checkReadyOnlyOnce: boolean;
  5999. state: string;
  6000. alpha: number;
  6001. backFaceCulling: boolean;
  6002. sideOrientation: number;
  6003. onCompiled: (effect: Effect) => void;
  6004. onError: (effect: Effect, errors: string) => void;
  6005. getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
  6006. doNotSerialize: boolean;
  6007. storeEffectOnSubMeshes: boolean;
  6008. animations: Array<Animation>;
  6009. /**
  6010. * An event triggered when the material is disposed.
  6011. * @type {BABYLON.Observable}
  6012. */
  6013. onDisposeObservable: Observable<Material>;
  6014. onDispose: () => void;
  6015. /**
  6016. * An event triggered when the material is bound.
  6017. * @type {BABYLON.Observable}
  6018. */
  6019. onBindObservable: Observable<AbstractMesh>;
  6020. onBind: (Mesh: AbstractMesh) => void;
  6021. /**
  6022. * An event triggered when the material is unbound.
  6023. * @type {BABYLON.Observable}
  6024. */
  6025. onUnBindObservable: Observable<Material>;
  6026. alphaMode: number;
  6027. needDepthPrePass: boolean;
  6028. disableDepthWrite: boolean;
  6029. forceDepthWrite: boolean;
  6030. separateCullingPass: boolean;
  6031. fogEnabled: boolean;
  6032. pointSize: number;
  6033. zOffset: number;
  6034. wireframe: boolean;
  6035. pointsCloud: boolean;
  6036. fillMode: number;
  6037. constructor(name: string, scene: Scene, doNotAdd?: boolean);
  6038. /**
  6039. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  6040. * subclasses should override adding information pertainent to themselves
  6041. */
  6042. toString(fullDetails?: boolean): string;
  6043. /**
  6044. * Child classes can use it to update shaders
  6045. */
  6046. getClassName(): string;
  6047. readonly isFrozen: boolean;
  6048. freeze(): void;
  6049. unfreeze(): void;
  6050. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  6051. isReadyForSubMesh(mesh: AbstractMesh, subMesh: BaseSubMesh, useInstances?: boolean): boolean;
  6052. getEffect(): Nullable<Effect>;
  6053. getScene(): Scene;
  6054. needAlphaBlending(): boolean;
  6055. needAlphaBlendingForMesh(mesh: AbstractMesh): boolean;
  6056. needAlphaTesting(): boolean;
  6057. getAlphaTestTexture(): Nullable<BaseTexture>;
  6058. markDirty(): void;
  6059. bind(world: Matrix, mesh?: Mesh): void;
  6060. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  6061. bindOnlyWorldMatrix(world: Matrix): void;
  6062. bindSceneUniformBuffer(effect: Effect, sceneUbo: UniformBuffer): void;
  6063. bindView(effect: Effect): void;
  6064. bindViewProjection(effect: Effect): void;
  6065. unbind(): void;
  6066. getActiveTextures(): BaseTexture[];
  6067. hasTexture(texture: BaseTexture): boolean;
  6068. clone(name: string): Nullable<Material>;
  6069. getBindedMeshes(): AbstractMesh[];
  6070. /**
  6071. * Force shader compilation including textures ready check
  6072. */
  6073. forceCompilation(mesh: AbstractMesh, onCompiled?: (material: Material) => void, options?: Partial<{
  6074. alphaTest: Nullable<boolean>;
  6075. clipPlane: boolean;
  6076. }>): void;
  6077. markAsDirty(flag: number): void;
  6078. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  6079. serialize(): any;
  6080. static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial;
  6081. static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): any;
  6082. }
  6083. }
  6084. declare module BABYLON {
  6085. class MaterialHelper {
  6086. static BindEyePosition(effect: Effect, scene: Scene): void;
  6087. static PrepareDefinesForMergedUV(texture: BaseTexture, defines: any, key: string): void;
  6088. static BindTextureMatrix(texture: BaseTexture, uniformBuffer: UniformBuffer, key: string): void;
  6089. static PrepareDefinesForMisc(mesh: AbstractMesh, scene: Scene, useLogarithmicDepth: boolean, pointsCloud: boolean, fogEnabled: boolean, defines: any): void;
  6090. static PrepareDefinesForFrameBoundValues(scene: Scene, engine: Engine, defines: any, useInstances: boolean, forceAlphaTest?: boolean): void;
  6091. static PrepareDefinesForAttributes(mesh: AbstractMesh, defines: any, useVertexColor: boolean, useBones: boolean, useMorphTargets?: boolean, useVertexAlpha?: boolean): boolean;
  6092. static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: any, specularSupported: boolean, maxSimultaneousLights?: number, disableLighting?: boolean): boolean;
  6093. static PrepareUniformsAndSamplersList(uniformsListOrOptions: string[] | EffectCreationOptions, samplersList?: string[], defines?: any, maxSimultaneousLights?: number): void;
  6094. static HandleFallbacksForShadows(defines: any, fallbacks: EffectFallbacks, maxSimultaneousLights?: number, rank?: number): number;
  6095. static PrepareAttributesForMorphTargets(attribs: string[], mesh: AbstractMesh, defines: any): void;
  6096. static PrepareAttributesForBones(attribs: string[], mesh: AbstractMesh, defines: any, fallbacks: EffectFallbacks): void;
  6097. static PrepareAttributesForInstances(attribs: string[], defines: any): void;
  6098. static BindLightShadow(light: Light, scene: Scene, mesh: AbstractMesh, lightIndex: string, effect: Effect): void;
  6099. static BindLightProperties(light: Light, effect: Effect, lightIndex: number): void;
  6100. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: any, maxSimultaneousLights?: number, usePhysicalLightFalloff?: boolean): void;
  6101. static BindFogParameters(scene: Scene, mesh: AbstractMesh, effect: Effect): void;
  6102. static BindBonesParameters(mesh?: AbstractMesh, effect?: Effect): void;
  6103. static BindMorphTargetParameters(abstractMesh: AbstractMesh, effect: Effect): void;
  6104. static BindLogDepth(defines: any, effect: Effect, scene: Scene): void;
  6105. static BindClipPlane(effect: Effect, scene: Scene): void;
  6106. }
  6107. }
  6108. declare module BABYLON {
  6109. class MultiMaterial extends Material {
  6110. subMaterials: Nullable<Material>[];
  6111. constructor(name: string, scene: Scene);
  6112. getSubMaterial(index: number): Nullable<Material>;
  6113. getActiveTextures(): BaseTexture[];
  6114. getClassName(): string;
  6115. isReadyForSubMesh(mesh: AbstractMesh, subMesh: BaseSubMesh, useInstances?: boolean): boolean;
  6116. clone(name: string, cloneChildren?: boolean): MultiMaterial;
  6117. serialize(): any;
  6118. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  6119. }
  6120. }
  6121. declare module BABYLON {
  6122. class PushMaterial extends Material {
  6123. constructor(name: string, scene: Scene);
  6124. getEffect(): Effect;
  6125. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  6126. bindOnlyWorldMatrix(world: Matrix): void;
  6127. bind(world: Matrix, mesh?: Mesh): void;
  6128. }
  6129. }
  6130. declare module BABYLON {
  6131. class ShaderMaterial extends Material {
  6132. constructor(name: string, scene: Scene, shaderPath: any, options: any);
  6133. getClassName(): string;
  6134. needAlphaBlending(): boolean;
  6135. needAlphaTesting(): boolean;
  6136. setTexture(name: string, texture: Texture): ShaderMaterial;
  6137. setTextureArray(name: string, textures: Texture[]): ShaderMaterial;
  6138. setFloat(name: string, value: number): ShaderMaterial;
  6139. setInt(name: string, value: number): ShaderMaterial;
  6140. setFloats(name: string, value: number[]): ShaderMaterial;
  6141. setColor3(name: string, value: Color3): ShaderMaterial;
  6142. setColor3Array(name: string, value: Color3[]): ShaderMaterial;
  6143. setColor4(name: string, value: Color4): ShaderMaterial;
  6144. setVector2(name: string, value: Vector2): ShaderMaterial;
  6145. setVector3(name: string, value: Vector3): ShaderMaterial;
  6146. setVector4(name: string, value: Vector4): ShaderMaterial;
  6147. setMatrix(name: string, value: Matrix): ShaderMaterial;
  6148. setMatrix3x3(name: string, value: Float32Array): ShaderMaterial;
  6149. setMatrix2x2(name: string, value: Float32Array): ShaderMaterial;
  6150. setArray2(name: string, value: number[]): ShaderMaterial;
  6151. setArray3(name: string, value: number[]): ShaderMaterial;
  6152. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  6153. bindOnlyWorldMatrix(world: Matrix): void;
  6154. bind(world: Matrix, mesh?: Mesh): void;
  6155. getActiveTextures(): BaseTexture[];
  6156. hasTexture(texture: BaseTexture): boolean;
  6157. clone(name: string): ShaderMaterial;
  6158. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  6159. serialize(): any;
  6160. static Parse(source: any, scene: Scene, rootUrl: string): ShaderMaterial;
  6161. }
  6162. }
  6163. declare module BABYLON {
  6164. class StandardMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines {
  6165. MAINUV1: boolean;
  6166. MAINUV2: boolean;
  6167. DIFFUSE: boolean;
  6168. DIFFUSEDIRECTUV: number;
  6169. AMBIENT: boolean;
  6170. AMBIENTDIRECTUV: number;
  6171. OPACITY: boolean;
  6172. OPACITYDIRECTUV: number;
  6173. OPACITYRGB: boolean;
  6174. REFLECTION: boolean;
  6175. EMISSIVE: boolean;
  6176. EMISSIVEDIRECTUV: number;
  6177. SPECULAR: boolean;
  6178. SPECULARDIRECTUV: number;
  6179. BUMP: boolean;
  6180. BUMPDIRECTUV: number;
  6181. PARALLAX: boolean;
  6182. PARALLAXOCCLUSION: boolean;
  6183. SPECULAROVERALPHA: boolean;
  6184. CLIPPLANE: boolean;
  6185. ALPHATEST: boolean;
  6186. DEPTHPREPASS: boolean;
  6187. ALPHAFROMDIFFUSE: boolean;
  6188. POINTSIZE: boolean;
  6189. FOG: boolean;
  6190. SPECULARTERM: boolean;
  6191. DIFFUSEFRESNEL: boolean;
  6192. OPACITYFRESNEL: boolean;
  6193. REFLECTIONFRESNEL: boolean;
  6194. REFRACTIONFRESNEL: boolean;
  6195. EMISSIVEFRESNEL: boolean;
  6196. FRESNEL: boolean;
  6197. NORMAL: boolean;
  6198. UV1: boolean;
  6199. UV2: boolean;
  6200. VERTEXCOLOR: boolean;
  6201. VERTEXALPHA: boolean;
  6202. NUM_BONE_INFLUENCERS: number;
  6203. BonesPerMesh: number;
  6204. INSTANCES: boolean;
  6205. GLOSSINESS: boolean;
  6206. ROUGHNESS: boolean;
  6207. EMISSIVEASILLUMINATION: boolean;
  6208. LINKEMISSIVEWITHDIFFUSE: boolean;
  6209. REFLECTIONFRESNELFROMSPECULAR: boolean;
  6210. LIGHTMAP: boolean;
  6211. LIGHTMAPDIRECTUV: number;
  6212. USELIGHTMAPASSHADOWMAP: boolean;
  6213. REFLECTIONMAP_3D: boolean;
  6214. REFLECTIONMAP_SPHERICAL: boolean;
  6215. REFLECTIONMAP_PLANAR: boolean;
  6216. REFLECTIONMAP_CUBIC: boolean;
  6217. REFLECTIONMAP_PROJECTION: boolean;
  6218. REFLECTIONMAP_SKYBOX: boolean;
  6219. REFLECTIONMAP_EXPLICIT: boolean;
  6220. REFLECTIONMAP_EQUIRECTANGULAR: boolean;
  6221. REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
  6222. REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
  6223. INVERTCUBICMAP: boolean;
  6224. LOGARITHMICDEPTH: boolean;
  6225. REFRACTION: boolean;
  6226. REFRACTIONMAP_3D: boolean;
  6227. REFLECTIONOVERALPHA: boolean;
  6228. TWOSIDEDLIGHTING: boolean;
  6229. SHADOWFLOAT: boolean;
  6230. MORPHTARGETS: boolean;
  6231. MORPHTARGETS_NORMAL: boolean;
  6232. MORPHTARGETS_TANGENT: boolean;
  6233. NUM_MORPH_INFLUENCERS: number;
  6234. NONUNIFORMSCALING: boolean;
  6235. PREMULTIPLYALPHA: boolean;
  6236. IMAGEPROCESSING: boolean;
  6237. VIGNETTE: boolean;
  6238. VIGNETTEBLENDMODEMULTIPLY: boolean;
  6239. VIGNETTEBLENDMODEOPAQUE: boolean;
  6240. TONEMAPPING: boolean;
  6241. CONTRAST: boolean;
  6242. COLORCURVES: boolean;
  6243. COLORGRADING: boolean;
  6244. COLORGRADING3D: boolean;
  6245. SAMPLER3DGREENDEPTH: boolean;
  6246. SAMPLER3DBGRMAP: boolean;
  6247. IMAGEPROCESSINGPOSTPROCESS: boolean;
  6248. EXPOSURE: boolean;
  6249. constructor();
  6250. setReflectionMode(modeToEnable: string): void;
  6251. }
  6252. class StandardMaterial extends PushMaterial {
  6253. diffuseTexture: Nullable<BaseTexture>;
  6254. ambientTexture: Nullable<BaseTexture>;
  6255. opacityTexture: Nullable<BaseTexture>;
  6256. reflectionTexture: Nullable<BaseTexture>;
  6257. emissiveTexture: Nullable<BaseTexture>;
  6258. specularTexture: Nullable<BaseTexture>;
  6259. bumpTexture: Nullable<BaseTexture>;
  6260. lightmapTexture: Nullable<BaseTexture>;
  6261. refractionTexture: Nullable<BaseTexture>;
  6262. ambientColor: Color3;
  6263. diffuseColor: Color3;
  6264. specularColor: Color3;
  6265. emissiveColor: Color3;
  6266. specularPower: number;
  6267. useAlphaFromDiffuseTexture: boolean;
  6268. useEmissiveAsIllumination: boolean;
  6269. linkEmissiveWithDiffuse: boolean;
  6270. useSpecularOverAlpha: boolean;
  6271. useReflectionOverAlpha: boolean;
  6272. disableLighting: boolean;
  6273. useParallax: boolean;
  6274. useParallaxOcclusion: boolean;
  6275. parallaxScaleBias: number;
  6276. roughness: number;
  6277. indexOfRefraction: number;
  6278. invertRefractionY: boolean;
  6279. useLightmapAsShadowmap: boolean;
  6280. diffuseFresnelParameters: FresnelParameters;
  6281. opacityFresnelParameters: FresnelParameters;
  6282. reflectionFresnelParameters: FresnelParameters;
  6283. refractionFresnelParameters: FresnelParameters;
  6284. emissiveFresnelParameters: FresnelParameters;
  6285. useReflectionFresnelFromSpecular: boolean;
  6286. useGlossinessFromSpecularMapAlpha: boolean;
  6287. maxSimultaneousLights: number;
  6288. /**
  6289. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  6290. */
  6291. invertNormalMapX: boolean;
  6292. /**
  6293. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  6294. */
  6295. invertNormalMapY: boolean;
  6296. /**
  6297. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  6298. */
  6299. twoSidedLighting: boolean;
  6300. /**
  6301. * Default configuration related to image processing available in the standard Material.
  6302. */
  6303. /**
  6304. * Gets the image processing configuration used either in this material.
  6305. */
  6306. /**
  6307. * Sets the Default image processing configuration used either in the this material.
  6308. *
  6309. * If sets to null, the scene one is in use.
  6310. */
  6311. imageProcessingConfiguration: ImageProcessingConfiguration;
  6312. /**
  6313. * Keep track of the image processing observer to allow dispose and replace.
  6314. */
  6315. /**
  6316. * Attaches a new image processing configuration to the Standard Material.
  6317. * @param configuration
  6318. */
  6319. /**
  6320. * Gets wether the color curves effect is enabled.
  6321. */
  6322. /**
  6323. * Sets wether the color curves effect is enabled.
  6324. */
  6325. cameraColorCurvesEnabled: boolean;
  6326. /**
  6327. * Gets wether the color grading effect is enabled.
  6328. */
  6329. /**
  6330. * Gets wether the color grading effect is enabled.
  6331. */
  6332. cameraColorGradingEnabled: boolean;
  6333. /**
  6334. * Gets wether tonemapping is enabled or not.
  6335. */
  6336. /**
  6337. * Sets wether tonemapping is enabled or not
  6338. */
  6339. cameraToneMappingEnabled: boolean;
  6340. /**
  6341. * The camera exposure used on this material.
  6342. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  6343. * This corresponds to a photographic exposure.
  6344. */
  6345. /**
  6346. * The camera exposure used on this material.
  6347. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  6348. * This corresponds to a photographic exposure.
  6349. */
  6350. cameraExposure: number;
  6351. /**
  6352. * Gets The camera contrast used on this material.
  6353. */
  6354. /**
  6355. * Sets The camera contrast used on this material.
  6356. */
  6357. cameraContrast: number;
  6358. /**
  6359. * Gets the Color Grading 2D Lookup Texture.
  6360. */
  6361. /**
  6362. * Sets the Color Grading 2D Lookup Texture.
  6363. */
  6364. cameraColorGradingTexture: Nullable<BaseTexture>;
  6365. /**
  6366. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  6367. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  6368. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  6369. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  6370. */
  6371. /**
  6372. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  6373. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  6374. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  6375. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  6376. */
  6377. cameraColorCurves: Nullable<ColorCurves>;
  6378. customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines) => string;
  6379. constructor(name: string, scene: Scene);
  6380. getClassName(): string;
  6381. useLogarithmicDepth: boolean;
  6382. needAlphaBlending(): boolean;
  6383. needAlphaTesting(): boolean;
  6384. getAlphaTestTexture(): Nullable<BaseTexture>;
  6385. /**
  6386. * Child classes can use it to update shaders
  6387. */
  6388. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  6389. buildUniformLayout(): void;
  6390. unbind(): void;
  6391. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  6392. getAnimatables(): IAnimatable[];
  6393. getActiveTextures(): BaseTexture[];
  6394. hasTexture(texture: BaseTexture): boolean;
  6395. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  6396. clone(name: string): StandardMaterial;
  6397. serialize(): any;
  6398. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial;
  6399. static DiffuseTextureEnabled: boolean;
  6400. static AmbientTextureEnabled: boolean;
  6401. static OpacityTextureEnabled: boolean;
  6402. static ReflectionTextureEnabled: boolean;
  6403. static EmissiveTextureEnabled: boolean;
  6404. static SpecularTextureEnabled: boolean;
  6405. static BumpTextureEnabled: boolean;
  6406. static LightmapTextureEnabled: boolean;
  6407. static RefractionTextureEnabled: boolean;
  6408. static ColorGradingTextureEnabled: boolean;
  6409. static FresnelEnabled: boolean;
  6410. }
  6411. }
  6412. declare module BABYLON {
  6413. class UniformBuffer {
  6414. /**
  6415. * Wrapper for updateUniform.
  6416. * @method updateMatrix3x3
  6417. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6418. * @param {Float32Array} matrix
  6419. */
  6420. updateMatrix3x3: (name: string, matrix: Float32Array) => void;
  6421. /**
  6422. * Wrapper for updateUniform.
  6423. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6424. * @param {Float32Array} matrix
  6425. */
  6426. updateMatrix2x2: (name: string, matrix: Float32Array) => void;
  6427. /**
  6428. * Wrapper for updateUniform.
  6429. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6430. * @param {number} x
  6431. */
  6432. updateFloat: (name: string, x: number) => void;
  6433. /**
  6434. * Wrapper for updateUniform.
  6435. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6436. * @param {number} x
  6437. * @param {number} y
  6438. * @param {string} [suffix] Suffix to add to the uniform name.
  6439. */
  6440. updateFloat2: (name: string, x: number, y: number, suffix?: string) => void;
  6441. /**
  6442. * Wrapper for updateUniform.
  6443. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6444. * @param {number} x
  6445. * @param {number} y
  6446. * @param {number} z
  6447. * @param {string} [suffix] Suffix to add to the uniform name.
  6448. */
  6449. updateFloat3: (name: string, x: number, y: number, z: number, suffix?: string) => void;
  6450. /**
  6451. * Wrapper for updateUniform.
  6452. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6453. * @param {number} x
  6454. * @param {number} y
  6455. * @param {number} z
  6456. * @param {number} w
  6457. * @param {string} [suffix] Suffix to add to the uniform name.
  6458. */
  6459. updateFloat4: (name: string, x: number, y: number, z: number, w: number, suffix?: string) => void;
  6460. /**
  6461. * Wrapper for updateUniform.
  6462. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6463. * @param {Matrix} A 4x4 matrix.
  6464. */
  6465. updateMatrix: (name: string, mat: Matrix) => void;
  6466. /**
  6467. * Wrapper for updateUniform.
  6468. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6469. * @param {Vector3} vector
  6470. */
  6471. updateVector3: (name: string, vector: Vector3) => void;
  6472. /**
  6473. * Wrapper for updateUniform.
  6474. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6475. * @param {Vector4} vector
  6476. */
  6477. updateVector4: (name: string, vector: Vector4) => void;
  6478. /**
  6479. * Wrapper for updateUniform.
  6480. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6481. * @param {Color3} color
  6482. * @param {string} [suffix] Suffix to add to the uniform name.
  6483. */
  6484. updateColor3: (name: string, color: Color3, suffix?: string) => void;
  6485. /**
  6486. * Wrapper for updateUniform.
  6487. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6488. * @param {Color3} color
  6489. * @param {number} alpha
  6490. * @param {string} [suffix] Suffix to add to the uniform name.
  6491. */
  6492. updateColor4: (name: string, color: Color3, alpha: number, suffix?: string) => void;
  6493. /**
  6494. * Uniform buffer objects.
  6495. *
  6496. * Handles blocks of uniform on the GPU.
  6497. *
  6498. * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.
  6499. *
  6500. * For more information, please refer to :
  6501. * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object
  6502. */
  6503. constructor(engine: Engine, data?: number[], dynamic?: boolean);
  6504. /**
  6505. * Indicates if the buffer is using the WebGL2 UBO implementation,
  6506. * or just falling back on setUniformXXX calls.
  6507. */
  6508. readonly useUbo: boolean;
  6509. /**
  6510. * Indicates if the WebGL underlying uniform buffer is in sync
  6511. * with the javascript cache data.
  6512. */
  6513. readonly isSync: boolean;
  6514. /**
  6515. * Indicates if the WebGL underlying uniform buffer is dynamic.
  6516. * Also, a dynamic UniformBuffer will disable cache verification and always
  6517. * update the underlying WebGL uniform buffer to the GPU.
  6518. */
  6519. isDynamic(): boolean;
  6520. /**
  6521. * The data cache on JS side.
  6522. */
  6523. getData(): Float32Array;
  6524. /**
  6525. * The underlying WebGL Uniform buffer.
  6526. */
  6527. getBuffer(): Nullable<WebGLBuffer>;
  6528. /**
  6529. * std140 layout specifies how to align data within an UBO structure.
  6530. * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159
  6531. * for specs.
  6532. */
  6533. /**
  6534. * Adds an uniform in the buffer.
  6535. * Warning : the subsequents calls of this function must be in the same order as declared in the shader
  6536. * for the layout to be correct !
  6537. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6538. * @param {number|number[]} size Data size, or data directly.
  6539. */
  6540. addUniform(name: string, size: number | number[]): void;
  6541. /**
  6542. * Wrapper for addUniform.
  6543. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6544. * @param {Matrix} mat A 4x4 matrix.
  6545. */
  6546. addMatrix(name: string, mat: Matrix): void;
  6547. /**
  6548. * Wrapper for addUniform.
  6549. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6550. * @param {number} x
  6551. * @param {number} y
  6552. */
  6553. addFloat2(name: string, x: number, y: number): void;
  6554. /**
  6555. * Wrapper for addUniform.
  6556. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6557. * @param {number} x
  6558. * @param {number} y
  6559. * @param {number} z
  6560. */
  6561. addFloat3(name: string, x: number, y: number, z: number): void;
  6562. /**
  6563. * Wrapper for addUniform.
  6564. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6565. * @param {Color3} color
  6566. */
  6567. addColor3(name: string, color: Color3): void;
  6568. /**
  6569. * Wrapper for addUniform.
  6570. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6571. * @param {Color3} color
  6572. * @param {number} alpha
  6573. */
  6574. addColor4(name: string, color: Color3, alpha: number): void;
  6575. /**
  6576. * Wrapper for addUniform.
  6577. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6578. * @param {Vector3} vector
  6579. */
  6580. addVector3(name: string, vector: Vector3): void;
  6581. /**
  6582. * Wrapper for addUniform.
  6583. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6584. */
  6585. addMatrix3x3(name: string): void;
  6586. /**
  6587. * Wrapper for addUniform.
  6588. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6589. */
  6590. addMatrix2x2(name: string): void;
  6591. /**
  6592. * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.
  6593. */
  6594. create(): void;
  6595. /**
  6596. * Updates the WebGL Uniform Buffer on the GPU.
  6597. * If the `dynamic` flag is set to true, no cache comparison is done.
  6598. * Otherwise, the buffer will be updated only if the cache differs.
  6599. */
  6600. update(): void;
  6601. /**
  6602. * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.
  6603. * @param {string} uniformName Name of the uniform, as used in the uniform block in the shader.
  6604. * @param {number[]|Float32Array} data Flattened data
  6605. * @param {number} size Size of the data.
  6606. */
  6607. updateUniform(uniformName: string, data: FloatArray, size: number): void;
  6608. /**
  6609. * Sets a sampler uniform on the effect.
  6610. * @param {string} name Name of the sampler.
  6611. * @param {Texture} texture
  6612. */
  6613. setTexture(name: string, texture: Nullable<BaseTexture>): void;
  6614. /**
  6615. * Directly updates the value of the uniform in the cache AND on the GPU.
  6616. * @param {string} uniformName Name of the uniform, as used in the uniform block in the shader.
  6617. * @param {number[]|Float32Array} data Flattened data
  6618. */
  6619. updateUniformDirectly(uniformName: string, data: FloatArray): void;
  6620. /**
  6621. * Binds this uniform buffer to an effect.
  6622. * @param {Effect} effect
  6623. * @param {string} name Name of the uniform block in the shader.
  6624. */
  6625. bindToEffect(effect: Effect, name: string): void;
  6626. /**
  6627. * Disposes the uniform buffer.
  6628. */
  6629. dispose(): void;
  6630. }
  6631. }
  6632. declare module BABYLON {
  6633. class MorphTarget {
  6634. name: string;
  6635. animations: Animation[];
  6636. onInfluenceChanged: Observable<boolean>;
  6637. influence: number;
  6638. constructor(name: string, influence?: number);
  6639. readonly hasPositions: boolean;
  6640. readonly hasNormals: boolean;
  6641. readonly hasTangents: boolean;
  6642. setPositions(data: Nullable<FloatArray>): void;
  6643. getPositions(): Nullable<FloatArray>;
  6644. setNormals(data: Nullable<FloatArray>): void;
  6645. getNormals(): Nullable<FloatArray>;
  6646. setTangents(data: Nullable<FloatArray>): void;
  6647. getTangents(): Nullable<FloatArray>;
  6648. /**
  6649. * Serializes the current target into a Serialization object.
  6650. * Returns the serialized object.
  6651. */
  6652. serialize(): any;
  6653. static Parse(serializationObject: any): MorphTarget;
  6654. static FromMesh(mesh: AbstractMesh, name?: string, influence?: number): MorphTarget;
  6655. }
  6656. }
  6657. declare module BABYLON {
  6658. class MorphTargetManager {
  6659. constructor(scene?: Nullable<Scene>);
  6660. readonly uniqueId: number;
  6661. readonly vertexCount: number;
  6662. readonly supportsNormals: boolean;
  6663. readonly supportsTangents: boolean;
  6664. readonly numTargets: number;
  6665. readonly numInfluencers: number;
  6666. readonly influences: Float32Array;
  6667. getActiveTarget(index: number): MorphTarget;
  6668. getTarget(index: number): MorphTarget;
  6669. addTarget(target: MorphTarget): void;
  6670. removeTarget(target: MorphTarget): void;
  6671. /**
  6672. * Serializes the current manager into a Serialization object.
  6673. * Returns the serialized object.
  6674. */
  6675. serialize(): any;
  6676. static Parse(serializationObject: any, scene: Scene): MorphTargetManager;
  6677. }
  6678. }
  6679. declare module BABYLON {
  6680. class Scalar {
  6681. /**
  6682. * Two pi constants convenient for computation.
  6683. */
  6684. static TwoPi: number;
  6685. /**
  6686. * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
  6687. */
  6688. static WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
  6689. /**
  6690. * Returns a string : the upper case translation of the number i to hexadecimal.
  6691. */
  6692. static ToHex(i: number): string;
  6693. /**
  6694. * Returns -1 if value is negative and +1 is value is positive.
  6695. * Returns the value itself if it's equal to zero.
  6696. */
  6697. static Sign(value: number): number;
  6698. /**
  6699. * Returns the value itself if it's between min and max.
  6700. * Returns min if the value is lower than min.
  6701. * Returns max if the value is greater than max.
  6702. */
  6703. static Clamp(value: number, min?: number, max?: number): number;
  6704. /**
  6705. * Returns the log2 of value.
  6706. */
  6707. static Log2(value: number): number;
  6708. /**
  6709. * Loops the value, so that it is never larger than length and never smaller than 0.
  6710. *
  6711. * This is similar to the modulo operator but it works with floating point numbers.
  6712. * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.
  6713. * With t = 5 and length = 2.5, the result would be 0.0.
  6714. * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator
  6715. */
  6716. static Repeat(value: number, length: number): number;
  6717. /**
  6718. * Normalize the value between 0.0 and 1.0 using min and max values
  6719. */
  6720. static Normalize(value: number, min: number, max: number): number;
  6721. /**
  6722. * Denormalize the value from 0.0 and 1.0 using min and max values
  6723. */
  6724. static Denormalize(normalized: number, min: number, max: number): number;
  6725. /**
  6726. * Calculates the shortest difference between two given angles given in degrees.
  6727. */
  6728. static DeltaAngle(current: number, target: number): number;
  6729. /**
  6730. * PingPongs the value t, so that it is never larger than length and never smaller than 0.
  6731. *
  6732. * The returned value will move back and forth between 0 and length
  6733. */
  6734. static PingPong(tx: number, length: number): number;
  6735. /**
  6736. * Interpolates between min and max with smoothing at the limits.
  6737. *
  6738. * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up
  6739. * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.
  6740. */
  6741. static SmoothStep(from: number, to: number, tx: number): number;
  6742. /**
  6743. * Moves a value current towards target.
  6744. *
  6745. * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.
  6746. * Negative values of maxDelta pushes the value away from target.
  6747. */
  6748. static MoveTowards(current: number, target: number, maxDelta: number): number;
  6749. /**
  6750. * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.
  6751. *
  6752. * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta
  6753. * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.
  6754. */
  6755. static MoveTowardsAngle(current: number, target: number, maxDelta: number): number;
  6756. /**
  6757. * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
  6758. */
  6759. static Lerp(start: number, end: number, amount: number): number;
  6760. /**
  6761. * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
  6762. * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.
  6763. */
  6764. static LerpAngle(start: number, end: number, amount: number): number;
  6765. /**
  6766. * Calculates the linear parameter t that produces the interpolant value within the range [a, b].
  6767. */
  6768. static InverseLerp(a: number, b: number, value: number): number;
  6769. /**
  6770. * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
  6771. */
  6772. static Hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number;
  6773. /**
  6774. * Returns a random float number between and min and max values
  6775. */
  6776. static RandomRange(min: number, max: number): number;
  6777. /**
  6778. * This function returns percentage of a number in a given range.
  6779. *
  6780. * RangeToPercent(40,20,60) will return 0.5 (50%)
  6781. * RangeToPercent(34,0,100) will return 0.34 (34%)
  6782. */
  6783. static RangeToPercent(number: number, min: number, max: number): number;
  6784. /**
  6785. * This function returns number that corresponds to the percentage in a given range.
  6786. *
  6787. * PercentToRange(0.34,0,100) will return 34.
  6788. */
  6789. static PercentToRange(percent: number, min: number, max: number): number;
  6790. /**
  6791. * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.
  6792. * @param angle The angle to normalize in radian.
  6793. * @return The converted angle.
  6794. */
  6795. static NormalizeRadians(angle: number): number;
  6796. }
  6797. }
  6798. declare module BABYLON {
  6799. class SIMDHelper {
  6800. static readonly IsEnabled: boolean;
  6801. static DisableSIMD(): void;
  6802. static EnableSIMD(): void;
  6803. }
  6804. }
  6805. declare module BABYLON {
  6806. const ToGammaSpace: number;
  6807. const ToLinearSpace = 2.2;
  6808. const Epsilon = 0.001;
  6809. class Color3 {
  6810. r: number;
  6811. g: number;
  6812. b: number;
  6813. /**
  6814. * Creates a new Color3 object from red, green, blue values, all between 0 and 1.
  6815. */
  6816. constructor(r?: number, g?: number, b?: number);
  6817. /**
  6818. * Returns a string with the Color3 current values.
  6819. */
  6820. toString(): string;
  6821. /**
  6822. * Returns the string "Color3".
  6823. */
  6824. getClassName(): string;
  6825. /**
  6826. * Returns the Color3 hash code.
  6827. */
  6828. getHashCode(): number;
  6829. /**
  6830. * Stores in the passed array from the passed starting index the red, green, blue values as successive elements.
  6831. * Returns the Color3.
  6832. */
  6833. toArray(array: FloatArray, index?: number): Color3;
  6834. /**
  6835. * Returns a new Color4 object from the current Color3 and the passed alpha.
  6836. */
  6837. toColor4(alpha?: number): Color4;
  6838. /**
  6839. * Returns a new array populated with 3 numeric elements : red, green and blue values.
  6840. */
  6841. asArray(): number[];
  6842. /**
  6843. * Returns the luminance value (float).
  6844. */
  6845. toLuminance(): number;
  6846. /**
  6847. * Multiply each Color3 rgb values by the passed Color3 rgb values in a new Color3 object.
  6848. * Returns this new object.
  6849. */
  6850. multiply(otherColor: Color3): Color3;
  6851. /**
  6852. * Multiply the rgb values of the Color3 and the passed Color3 and stores the result in the object "result".
  6853. * Returns the current Color3.
  6854. */
  6855. multiplyToRef(otherColor: Color3, result: Color3): Color3;
  6856. /**
  6857. * Boolean : True if the rgb values are equal to the passed ones.
  6858. */
  6859. equals(otherColor: Color3): boolean;
  6860. /**
  6861. * Boolean : True if the rgb values are equal to the passed ones.
  6862. */
  6863. equalsFloats(r: number, g: number, b: number): boolean;
  6864. /**
  6865. * Multiplies in place each rgb value by scale.
  6866. * Returns the updated Color3.
  6867. */
  6868. scale(scale: number): Color3;
  6869. /**
  6870. * Multiplies the rgb values by scale and stores the result into "result".
  6871. * Returns the unmodified current Color3.
  6872. */
  6873. scaleToRef(scale: number, result: Color3): Color3;
  6874. /**
  6875. * Returns a new Color3 set with the added values of the current Color3 and of the passed one.
  6876. */
  6877. add(otherColor: Color3): Color3;
  6878. /**
  6879. * Stores the result of the addition of the current Color3 and passed one rgb values into "result".
  6880. * Returns the unmodified current Color3.
  6881. */
  6882. addToRef(otherColor: Color3, result: Color3): Color3;
  6883. /**
  6884. * Returns a new Color3 set with the subtracted values of the passed one from the current Color3 .
  6885. */
  6886. subtract(otherColor: Color3): Color3;
  6887. /**
  6888. * Stores the result of the subtraction of passed one from the current Color3 rgb values into "result".
  6889. * Returns the unmodified current Color3.
  6890. */
  6891. subtractToRef(otherColor: Color3, result: Color3): Color3;
  6892. /**
  6893. * Returns a new Color3 copied the current one.
  6894. */
  6895. clone(): Color3;
  6896. /**
  6897. * Copies the rgb values from the source in the current Color3.
  6898. * Returns the updated Color3.
  6899. */
  6900. copyFrom(source: Color3): Color3;
  6901. /**
  6902. * Updates the Color3 rgb values from the passed floats.
  6903. * Returns the Color3.
  6904. */
  6905. copyFromFloats(r: number, g: number, b: number): Color3;
  6906. /**
  6907. * Updates the Color3 rgb values from the passed floats.
  6908. * Returns the Color3.
  6909. */
  6910. set(r: number, g: number, b: number): Color3;
  6911. /**
  6912. * Returns the Color3 hexadecimal code as a string.
  6913. */
  6914. toHexString(): string;
  6915. /**
  6916. * Returns a new Color3 converted to linear space.
  6917. */
  6918. toLinearSpace(): Color3;
  6919. /**
  6920. * Converts the Color3 values to linear space and stores the result in "convertedColor".
  6921. * Returns the unmodified Color3.
  6922. */
  6923. toLinearSpaceToRef(convertedColor: Color3): Color3;
  6924. /**
  6925. * Returns a new Color3 converted to gamma space.
  6926. */
  6927. toGammaSpace(): Color3;
  6928. /**
  6929. * Converts the Color3 values to gamma space and stores the result in "convertedColor".
  6930. * Returns the unmodified Color3.
  6931. */
  6932. toGammaSpaceToRef(convertedColor: Color3): Color3;
  6933. /**
  6934. * Creates a new Color3 from the string containing valid hexadecimal values.
  6935. */
  6936. static FromHexString(hex: string): Color3;
  6937. /**
  6938. * Creates a new Vector3 from the startind index of the passed array.
  6939. */
  6940. static FromArray(array: ArrayLike<number>, offset?: number): Color3;
  6941. /**
  6942. * Creates a new Color3 from integer values ( < 256).
  6943. */
  6944. static FromInts(r: number, g: number, b: number): Color3;
  6945. /**
  6946. * Creates a new Color3 with values linearly interpolated of "amount" between the start Color3 and the end Color3.
  6947. */
  6948. static Lerp(start: Color3, end: Color3, amount: number): Color3;
  6949. static Red(): Color3;
  6950. static Green(): Color3;
  6951. static Blue(): Color3;
  6952. static Black(): Color3;
  6953. static White(): Color3;
  6954. static Purple(): Color3;
  6955. static Magenta(): Color3;
  6956. static Yellow(): Color3;
  6957. static Gray(): Color3;
  6958. static Teal(): Color3;
  6959. static Random(): Color3;
  6960. }
  6961. class Color4 {
  6962. r: number;
  6963. g: number;
  6964. b: number;
  6965. a: number;
  6966. /**
  6967. * Creates a new Color4 object from the passed float values ( < 1) : red, green, blue, alpha.
  6968. */
  6969. constructor(r?: number, g?: number, b?: number, a?: number);
  6970. /**
  6971. * Adds in place the passed Color4 values to the current Color4.
  6972. * Returns the updated Color4.
  6973. */
  6974. addInPlace(right: Color4): Color4;
  6975. /**
  6976. * Returns a new array populated with 4 numeric elements : red, green, blue, alpha values.
  6977. */
  6978. asArray(): number[];
  6979. /**
  6980. * Stores from the starting index in the passed array the Color4 successive values.
  6981. * Returns the Color4.
  6982. */
  6983. toArray(array: number[], index?: number): Color4;
  6984. /**
  6985. * Returns a new Color4 set with the added values of the current Color4 and of the passed one.
  6986. */
  6987. add(right: Color4): Color4;
  6988. /**
  6989. * Returns a new Color4 set with the subtracted values of the passed one from the current Color4.
  6990. */
  6991. subtract(right: Color4): Color4;
  6992. /**
  6993. * Subtracts the passed ones from the current Color4 values and stores the results in "result".
  6994. * Returns the Color4.
  6995. */
  6996. subtractToRef(right: Color4, result: Color4): Color4;
  6997. /**
  6998. * Creates a new Color4 with the current Color4 values multiplied by scale.
  6999. */
  7000. scale(scale: number): Color4;
  7001. /**
  7002. * Multiplies the current Color4 values by scale and stores the result in "result".
  7003. * Returns the Color4.
  7004. */
  7005. scaleToRef(scale: number, result: Color4): Color4;
  7006. /**
  7007. * Multipy an RGBA Color4 value by another and return a new Color4 object
  7008. * @param color The Color4 (RGBA) value to multiply by
  7009. * @returns A new Color4.
  7010. */
  7011. multiply(color: Color4): Color4;
  7012. /**
  7013. * Multipy an RGBA Color4 value by another and push the result in a reference value
  7014. * @param color The Color4 (RGBA) value to multiply by
  7015. * @param result The Color4 (RGBA) to fill the result in
  7016. * @returns the result Color4.
  7017. */
  7018. multiplyToRef(color: Color4, result: Color4): Color4;
  7019. /**
  7020. * Returns a string with the Color4 values.
  7021. */
  7022. toString(): string;
  7023. /**
  7024. * Returns the string "Color4"
  7025. */
  7026. getClassName(): string;
  7027. /**
  7028. * Return the Color4 hash code as a number.
  7029. */
  7030. getHashCode(): number;
  7031. /**
  7032. * Creates a new Color4 copied from the current one.
  7033. */
  7034. clone(): Color4;
  7035. /**
  7036. * Copies the passed Color4 values into the current one.
  7037. * Returns the updated Color4.
  7038. */
  7039. copyFrom(source: Color4): Color4;
  7040. /**
  7041. * Copies the passed float values into the current one.
  7042. * Returns the updated Color4.
  7043. */
  7044. copyFromFloats(r: number, g: number, b: number, a: number): Color4;
  7045. /**
  7046. * Copies the passed float values into the current one.
  7047. * Returns the updated Color4.
  7048. */
  7049. set(r: number, g: number, b: number, a: number): Color4;
  7050. /**
  7051. * Returns a string containing the hexadecimal Color4 code.
  7052. */
  7053. toHexString(): string;
  7054. /**
  7055. * Returns a new Color4 converted to linear space.
  7056. */
  7057. toLinearSpace(): Color4;
  7058. /**
  7059. * Converts the Color4 values to linear space and stores the result in "convertedColor".
  7060. * Returns the unmodified Color4.
  7061. */
  7062. toLinearSpaceToRef(convertedColor: Color4): Color4;
  7063. /**
  7064. * Returns a new Color4 converted to gamma space.
  7065. */
  7066. toGammaSpace(): Color4;
  7067. /**
  7068. * Converts the Color4 values to gamma space and stores the result in "convertedColor".
  7069. * Returns the unmodified Color4.
  7070. */
  7071. toGammaSpaceToRef(convertedColor: Color4): Color4;
  7072. /**
  7073. * Creates a new Color4 from the valid hexadecimal value contained in the passed string.
  7074. */
  7075. static FromHexString(hex: string): Color4;
  7076. /**
  7077. * Creates a new Color4 object set with the linearly interpolated values of "amount" between the left Color4 and the right Color4.
  7078. */
  7079. static Lerp(left: Color4, right: Color4, amount: number): Color4;
  7080. /**
  7081. * Set the passed "result" with the linearly interpolated values of "amount" between the left Color4 and the right Color4.
  7082. */
  7083. static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
  7084. /**
  7085. * Creates a new Color4 from the starting index element of the passed array.
  7086. */
  7087. static FromArray(array: ArrayLike<number>, offset?: number): Color4;
  7088. /**
  7089. * Creates a new Color4 from the passed integers ( < 256 ).
  7090. */
  7091. static FromInts(r: number, g: number, b: number, a: number): Color4;
  7092. static CheckColors4(colors: number[], count: number): number[];
  7093. }
  7094. class Vector2 {
  7095. x: number;
  7096. y: number;
  7097. /**
  7098. * Creates a new Vector2 from the passed x and y coordinates.
  7099. */
  7100. constructor(x: number, y: number);
  7101. /**
  7102. * Returns a string with the Vector2 coordinates.
  7103. */
  7104. toString(): string;
  7105. /**
  7106. * Returns the string "Vector2"
  7107. */
  7108. getClassName(): string;
  7109. /**
  7110. * Returns the Vector2 hash code as a number.
  7111. */
  7112. getHashCode(): number;
  7113. /**
  7114. * Sets the Vector2 coordinates in the passed array or Float32Array from the passed index.
  7115. * Returns the Vector2.
  7116. */
  7117. toArray(array: FloatArray, index?: number): Vector2;
  7118. /**
  7119. * Returns a new array with 2 elements : the Vector2 coordinates.
  7120. */
  7121. asArray(): number[];
  7122. /**
  7123. * Sets the Vector2 coordinates with the passed Vector2 coordinates.
  7124. * Returns the updated Vector2.
  7125. */
  7126. copyFrom(source: Vector2): Vector2;
  7127. /**
  7128. * Sets the Vector2 coordinates with the passed floats.
  7129. * Returns the updated Vector2.
  7130. */
  7131. copyFromFloats(x: number, y: number): Vector2;
  7132. /**
  7133. * Sets the Vector2 coordinates with the passed floats.
  7134. * Returns the updated Vector2.
  7135. */
  7136. set(x: number, y: number): Vector2;
  7137. /**
  7138. * Returns a new Vector2 set with the addition of the current Vector2 and the passed one coordinates.
  7139. */
  7140. add(otherVector: Vector2): Vector2;
  7141. /**
  7142. * Sets the "result" coordinates with the addition of the current Vector2 and the passed one coordinates.
  7143. * Returns the Vector2.
  7144. */
  7145. addToRef(otherVector: Vector2, result: Vector2): Vector2;
  7146. /**
  7147. * Set the Vector2 coordinates by adding the passed Vector2 coordinates.
  7148. * Returns the updated Vector2.
  7149. */
  7150. addInPlace(otherVector: Vector2): Vector2;
  7151. /**
  7152. * Returns a new Vector2 by adding the current Vector2 coordinates to the passed Vector3 x, y coordinates.
  7153. */
  7154. addVector3(otherVector: Vector3): Vector2;
  7155. /**
  7156. * Returns a new Vector2 set with the subtracted coordinates of the passed one from the current Vector2.
  7157. */
  7158. subtract(otherVector: Vector2): Vector2;
  7159. /**
  7160. * Sets the "result" coordinates with the subtraction of the passed one from the current Vector2 coordinates.
  7161. * Returns the Vector2.
  7162. */
  7163. subtractToRef(otherVector: Vector2, result: Vector2): Vector2;
  7164. /**
  7165. * Sets the current Vector2 coordinates by subtracting from it the passed one coordinates.
  7166. * Returns the updated Vector2.
  7167. */
  7168. subtractInPlace(otherVector: Vector2): Vector2;
  7169. /**
  7170. * Multiplies in place the current Vector2 coordinates by the passed ones.
  7171. * Returns the updated Vector2.
  7172. */
  7173. multiplyInPlace(otherVector: Vector2): Vector2;
  7174. /**
  7175. * Returns a new Vector2 set with the multiplication of the current Vector2 and the passed one coordinates.
  7176. */
  7177. multiply(otherVector: Vector2): Vector2;
  7178. /**
  7179. * Sets "result" coordinates with the multiplication of the current Vector2 and the passed one coordinates.
  7180. * Returns the Vector2.
  7181. */
  7182. multiplyToRef(otherVector: Vector2, result: Vector2): Vector2;
  7183. /**
  7184. * Returns a new Vector2 set with the Vector2 coordinates multiplied by the passed floats.
  7185. */
  7186. multiplyByFloats(x: number, y: number): Vector2;
  7187. /**
  7188. * Returns a new Vector2 set with the Vector2 coordinates divided by the passed one coordinates.
  7189. */
  7190. divide(otherVector: Vector2): Vector2;
  7191. /**
  7192. * Sets the "result" coordinates with the Vector2 divided by the passed one coordinates.
  7193. * Returns the Vector2.
  7194. */
  7195. divideToRef(otherVector: Vector2, result: Vector2): Vector2;
  7196. /**
  7197. * Returns a new Vector2 with current Vector2 negated coordinates.
  7198. */
  7199. negate(): Vector2;
  7200. /**
  7201. * Multiply the Vector2 coordinates by scale.
  7202. * Returns the updated Vector2.
  7203. */
  7204. scaleInPlace(scale: number): Vector2;
  7205. /**
  7206. * Returns a new Vector2 scaled by "scale" from the current Vector2.
  7207. */
  7208. scale(scale: number): Vector2;
  7209. /**
  7210. * Boolean : True if the passed vector coordinates strictly equal the current Vector2 ones.
  7211. */
  7212. equals(otherVector: Vector2): boolean;
  7213. /**
  7214. * Boolean : True if the passed vector coordinates are close to the current ones by a distance of epsilon.
  7215. */
  7216. equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean;
  7217. /**
  7218. * Returns the vector length (float).
  7219. */
  7220. length(): number;
  7221. /**
  7222. * Returns the vector squared length (float);
  7223. */
  7224. lengthSquared(): number;
  7225. /**
  7226. * Normalize the vector.
  7227. * Returns the updated Vector2.
  7228. */
  7229. normalize(): Vector2;
  7230. /**
  7231. * Returns a new Vector2 copied from the Vector2.
  7232. */
  7233. clone(): Vector2;
  7234. /**
  7235. * Returns a new Vector2(0, 0)
  7236. */
  7237. static Zero(): Vector2;
  7238. /**
  7239. * Returns a new Vector2(1, 1)
  7240. */
  7241. static One(): Vector2;
  7242. /**
  7243. * Returns a new Vector2 set from the passed index element of the passed array.
  7244. */
  7245. static FromArray(array: ArrayLike<number>, offset?: number): Vector2;
  7246. /**
  7247. * Sets "result" from the passed index element of the passed array.
  7248. */
  7249. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector2): void;
  7250. /**
  7251. * Retuns a new Vector2 located for "amount" (float) on the CatmullRom spline defined by the passed four Vector2.
  7252. */
  7253. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  7254. /**
  7255. * Returns a new Vector2 set with same the coordinates than "value" ones if the vector "value" is in the square defined by "min" and "max".
  7256. * If a coordinate of "value" is lower than "min" coordinates, the returned Vector2 is given this "min" coordinate.
  7257. * If a coordinate of "value" is greater than "max" coordinates, the returned Vector2 is given this "max" coordinate.
  7258. */
  7259. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  7260. /**
  7261. * Returns a new Vector2 located for "amount" (float) on the Hermite spline defined by the vectors "value1", "value3", "tangent1", "tangent2".
  7262. */
  7263. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  7264. /**
  7265. * Returns a new Vector2 located for "amount" (float) on the linear interpolation between the vector "start" adn the vector "end".
  7266. */
  7267. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  7268. /**
  7269. * Returns the dot product (float) of the vector "left" and the vector "right".
  7270. */
  7271. static Dot(left: Vector2, right: Vector2): number;
  7272. /**
  7273. * Returns a new Vector2 equal to the normalized passed vector.
  7274. */
  7275. static Normalize(vector: Vector2): Vector2;
  7276. /**
  7277. * Returns a new Vecto2 set with the minimal coordinate values from the "left" and "right" vectors.
  7278. */
  7279. static Minimize(left: Vector2, right: Vector2): Vector2;
  7280. /**
  7281. * Returns a new Vecto2 set with the maximal coordinate values from the "left" and "right" vectors.
  7282. */
  7283. static Maximize(left: Vector2, right: Vector2): Vector2;
  7284. /**
  7285. * Returns a new Vecto2 set with the transformed coordinates of the passed vector by the passed transformation matrix.
  7286. */
  7287. static Transform(vector: Vector2, transformation: Matrix): Vector2;
  7288. /**
  7289. * Transforms the passed vector coordinates by the passed transformation matrix and stores the result in the vector "result" coordinates.
  7290. */
  7291. static TransformToRef(vector: Vector2, transformation: Matrix, result: Vector2): void;
  7292. /**
  7293. * Boolean : True if the point "p" is in the triangle defined by the vertors "p0", "p1", "p2"
  7294. */
  7295. static PointInTriangle(p: Vector2, p0: Vector2, p1: Vector2, p2: Vector2): boolean;
  7296. /**
  7297. * Returns the distance (float) between the vectors "value1" and "value2".
  7298. */
  7299. static Distance(value1: Vector2, value2: Vector2): number;
  7300. /**
  7301. * Returns the squared distance (float) between the vectors "value1" and "value2".
  7302. */
  7303. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  7304. /**
  7305. * Returns a new Vecto2 located at the center of the vectors "value1" and "value2".
  7306. */
  7307. static Center(value1: Vector2, value2: Vector2): Vector2;
  7308. /**
  7309. * Returns the shortest distance (float) between the point "p" and the segment defined by the two points "segA" and "segB".
  7310. */
  7311. static DistanceOfPointFromSegment(p: Vector2, segA: Vector2, segB: Vector2): number;
  7312. }
  7313. class Vector3 {
  7314. x: number;
  7315. y: number;
  7316. z: number;
  7317. /**
  7318. * Creates a new Vector3 object from the passed x, y, z (floats) coordinates.
  7319. * A Vector3 is the main object used in 3D geometry.
  7320. * It can represent etiher the coordinates of a point the space, either a direction.
  7321. */
  7322. constructor(x: number, y: number, z: number);
  7323. /**
  7324. * Returns a string with the Vector3 coordinates.
  7325. */
  7326. toString(): string;
  7327. /**
  7328. * Returns the string "Vector3"
  7329. */
  7330. getClassName(): string;
  7331. /**
  7332. * Returns the Vector hash code.
  7333. */
  7334. getHashCode(): number;
  7335. /**
  7336. * Returns a new array with three elements : the coordinates the Vector3.
  7337. */
  7338. asArray(): number[];
  7339. /**
  7340. * Populates the passed array or Float32Array from the passed index with the successive coordinates of the Vector3.
  7341. * Returns the Vector3.
  7342. */
  7343. toArray(array: FloatArray, index?: number): Vector3;
  7344. /**
  7345. * Returns a new Quaternion object, computed from the Vector3 coordinates.
  7346. */
  7347. toQuaternion(): Quaternion;
  7348. /**
  7349. * Adds the passed vector to the current Vector3.
  7350. * Returns the updated Vector3.
  7351. */
  7352. addInPlace(otherVector: Vector3): Vector3;
  7353. /**
  7354. * Returns a new Vector3, result of the addition the current Vector3 and the passed vector.
  7355. */
  7356. add(otherVector: Vector3): Vector3;
  7357. /**
  7358. * Adds the current Vector3 to the passed one and stores the result in the vector "result".
  7359. * Returns the current Vector3.
  7360. */
  7361. addToRef(otherVector: Vector3, result: Vector3): Vector3;
  7362. /**
  7363. * Subtract the passed vector from the current Vector3.
  7364. * Returns the updated Vector3.
  7365. */
  7366. subtractInPlace(otherVector: Vector3): Vector3;
  7367. /**
  7368. * Returns a new Vector3, result of the subtraction of the passed vector from the current Vector3.
  7369. */
  7370. subtract(otherVector: Vector3): Vector3;
  7371. /**
  7372. * Subtracts the passed vector from the current Vector3 and stores the result in the vector "result".
  7373. * Returns the current Vector3.
  7374. */
  7375. subtractToRef(otherVector: Vector3, result: Vector3): Vector3;
  7376. /**
  7377. * Returns a new Vector3 set with the subtraction of the passed floats from the current Vector3 coordinates.
  7378. */
  7379. subtractFromFloats(x: number, y: number, z: number): Vector3;
  7380. /**
  7381. * Subtracts the passed floats from the current Vector3 coordinates and set the passed vector "result" with this result.
  7382. * Returns the current Vector3.
  7383. */
  7384. subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3;
  7385. /**
  7386. * Returns a new Vector3 set with the current Vector3 negated coordinates.
  7387. */
  7388. negate(): Vector3;
  7389. /**
  7390. * Multiplies the Vector3 coordinates by the float "scale".
  7391. * Returns the updated Vector3.
  7392. */
  7393. scaleInPlace(scale: number): Vector3;
  7394. /**
  7395. * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale".
  7396. */
  7397. scale(scale: number): Vector3;
  7398. /**
  7399. * Multiplies the current Vector3 coordinates by the float "scale" and stores the result in the passed vector "result" coordinates.
  7400. * Returns the current Vector3.
  7401. */
  7402. scaleToRef(scale: number, result: Vector3): Vector3;
  7403. /**
  7404. * Boolean : True if the current Vector3 and the passed vector coordinates are strictly equal.
  7405. */
  7406. equals(otherVector: Vector3): boolean;
  7407. /**
  7408. * Boolean : True if the current Vector3 and the passed vector coordinates are distant less than epsilon.
  7409. */
  7410. equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean;
  7411. /**
  7412. * Boolean : True if the current Vector3 coordinate equal the passed floats.
  7413. */
  7414. equalsToFloats(x: number, y: number, z: number): boolean;
  7415. /**
  7416. * Muliplies the current Vector3 coordinates by the passed ones.
  7417. * Returns the updated Vector3.
  7418. */
  7419. multiplyInPlace(otherVector: Vector3): Vector3;
  7420. /**
  7421. * Returns a new Vector3, result of the multiplication of the current Vector3 by the passed vector.
  7422. */
  7423. multiply(otherVector: Vector3): Vector3;
  7424. /**
  7425. * Multiplies the current Vector3 by the passed one and stores the result in the passed vector "result".
  7426. * Returns the current Vector3.
  7427. */
  7428. multiplyToRef(otherVector: Vector3, result: Vector3): Vector3;
  7429. /**
  7430. * Returns a new Vector3 set witth the result of the mulliplication of the current Vector3 coordinates by the passed floats.
  7431. */
  7432. multiplyByFloats(x: number, y: number, z: number): Vector3;
  7433. /**
  7434. * Returns a new Vector3 set witth the result of the division of the current Vector3 coordinates by the passed ones.
  7435. */
  7436. divide(otherVector: Vector3): Vector3;
  7437. /**
  7438. * Divides the current Vector3 coordinates by the passed ones and stores the result in the passed vector "result".
  7439. * Returns the current Vector3.
  7440. */
  7441. divideToRef(otherVector: Vector3, result: Vector3): Vector3;
  7442. /**
  7443. * Updates the current Vector3 with the minimal coordinate values between its and the passed vector ones.
  7444. * Returns the updated Vector3.
  7445. */
  7446. MinimizeInPlace(other: Vector3): Vector3;
  7447. /**
  7448. * Updates the current Vector3 with the maximal coordinate values between its and the passed vector ones.
  7449. * Returns the updated Vector3.
  7450. */
  7451. MaximizeInPlace(other: Vector3): Vector3;
  7452. /**
  7453. * Return true is the vector is non uniform meaning x, y or z are not all the same.
  7454. */
  7455. readonly isNonUniform: boolean;
  7456. /**
  7457. * Returns the length of the Vector3 (float).
  7458. */
  7459. length(): number;
  7460. /**
  7461. * Returns the squared length of the Vector3 (float).
  7462. */
  7463. lengthSquared(): number;
  7464. /**
  7465. * Normalize the current Vector3.
  7466. * Returns the updated Vector3.
  7467. * /!\ In place operation.
  7468. */
  7469. normalize(): Vector3;
  7470. /**
  7471. * Normalize the current Vector3 to a new vector.
  7472. * @returns the new Vector3.
  7473. */
  7474. normalizeToNew(): Vector3;
  7475. /**
  7476. * Normalize the current Vector3 to the reference.
  7477. * @param the reference to update.
  7478. * @returns the updated Vector3.
  7479. */
  7480. normalizeToRef(reference: Vector3): Vector3;
  7481. /**
  7482. * Returns a new Vector3 copied from the current Vector3.
  7483. */
  7484. clone(): Vector3;
  7485. /**
  7486. * Copies the passed vector coordinates to the current Vector3 ones.
  7487. * Returns the updated Vector3.
  7488. */
  7489. copyFrom(source: Vector3): Vector3;
  7490. /**
  7491. * Copies the passed floats to the current Vector3 coordinates.
  7492. * Returns the updated Vector3.
  7493. */
  7494. copyFromFloats(x: number, y: number, z: number): Vector3;
  7495. /**
  7496. * Copies the passed floats to the current Vector3 coordinates.
  7497. * Returns the updated Vector3.
  7498. */
  7499. set(x: number, y: number, z: number): Vector3;
  7500. /**
  7501. *
  7502. */
  7503. static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: number): number;
  7504. /**
  7505. * Returns a new Vector3 set from the index "offset" of the passed array.
  7506. */
  7507. static FromArray(array: ArrayLike<number>, offset?: number): Vector3;
  7508. /**
  7509. * Returns a new Vector3 set from the index "offset" of the passed Float32Array.
  7510. * This function is deprecated. Use FromArray instead.
  7511. */
  7512. static FromFloatArray(array: Float32Array, offset?: number): Vector3;
  7513. /**
  7514. * Sets the passed vector "result" with the element values from the index "offset" of the passed array.
  7515. */
  7516. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector3): void;
  7517. /**
  7518. * Sets the passed vector "result" with the element values from the index "offset" of the passed Float32Array.
  7519. * This function is deprecated. Use FromArrayToRef instead.
  7520. */
  7521. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
  7522. /**
  7523. * Sets the passed vector "result" with the passed floats.
  7524. */
  7525. static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  7526. /**
  7527. * Returns a new Vector3 set to (0.0, 0.0, 0.0).
  7528. */
  7529. static Zero(): Vector3;
  7530. /**
  7531. * Returns a new Vector3 set to (1.0, 1.0, 1.0).
  7532. */
  7533. static One(): Vector3;
  7534. /**
  7535. * Returns a new Vector3 set to (0.0, 1.0, 0.0)
  7536. */
  7537. static Up(): Vector3;
  7538. /**
  7539. * Returns a new Vector3 set to (0.0, 0.0, 1.0)
  7540. */
  7541. static Forward(): Vector3;
  7542. /**
  7543. * Returns a new Vector3 set to (1.0, 0.0, 0.0)
  7544. */
  7545. static Right(): Vector3;
  7546. /**
  7547. * Returns a new Vector3 set to (-1.0, 0.0, 0.0)
  7548. */
  7549. static Left(): Vector3;
  7550. /**
  7551. * Returns a new Vector3 set with the result of the transformation by the passed matrix of the passed vector.
  7552. * This method computes tranformed coordinates only, not transformed direction vectors.
  7553. */
  7554. static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
  7555. /**
  7556. * Sets the passed vector "result" coordinates with the result of the transformation by the passed matrix of the passed vector.
  7557. * This method computes tranformed coordinates only, not transformed direction vectors.
  7558. */
  7559. static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  7560. /**
  7561. * Sets the passed vector "result" coordinates with the result of the transformation by the passed matrix of the passed floats (x, y, z).
  7562. * This method computes tranformed coordinates only, not transformed direction vectors.
  7563. */
  7564. static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  7565. /**
  7566. * Returns a new Vector3 set with the result of the normal transformation by the passed matrix of the passed vector.
  7567. * This methods computes transformed normalized direction vectors only.
  7568. */
  7569. static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
  7570. /**
  7571. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed vector.
  7572. * This methods computes transformed normalized direction vectors only.
  7573. */
  7574. static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  7575. /**
  7576. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed floats (x, y, z).
  7577. * This methods computes transformed normalized direction vectors only.
  7578. */
  7579. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  7580. /**
  7581. * Returns a new Vector3 located for "amount" on the CatmullRom interpolation spline defined by the vectors "value1", "value2", "value3", "value4".
  7582. */
  7583. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  7584. /**
  7585. * Returns a new Vector3 set with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max".
  7586. * If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one.
  7587. * If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one.
  7588. */
  7589. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  7590. /**
  7591. * Returns a new Vector3 located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2".
  7592. */
  7593. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  7594. /**
  7595. * Returns a new Vector3 located for "amount" (float) on the linear interpolation between the vectors "start" and "end".
  7596. */
  7597. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  7598. /**
  7599. * Sets the passed vector "result" with the result of the linear interpolation from the vector "start" for "amount" to the vector "end".
  7600. */
  7601. static LerpToRef(start: Vector3, end: Vector3, amount: number, result: Vector3): void;
  7602. /**
  7603. * Returns the dot product (float) between the vectors "left" and "right".
  7604. */
  7605. static Dot(left: Vector3, right: Vector3): number;
  7606. /**
  7607. * Returns a new Vector3 as the cross product of the vectors "left" and "right".
  7608. * The cross product is then orthogonal to both "left" and "right".
  7609. */
  7610. static Cross(left: Vector3, right: Vector3): Vector3;
  7611. /**
  7612. * Sets the passed vector "result" with the cross product of "left" and "right".
  7613. * The cross product is then orthogonal to both "left" and "right".
  7614. */
  7615. static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
  7616. /**
  7617. * Returns a new Vector3 as the normalization of the passed vector.
  7618. */
  7619. static Normalize(vector: Vector3): Vector3;
  7620. /**
  7621. * Sets the passed vector "result" with the normalization of the passed first vector.
  7622. */
  7623. static NormalizeToRef(vector: Vector3, result: Vector3): void;
  7624. static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
  7625. static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3;
  7626. static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
  7627. static UnprojectToRef(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix, result: Vector3): void;
  7628. static UnprojectFloatsToRef(sourceX: float, sourceY: float, sourceZ: float, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix, result: Vector3): void;
  7629. static Minimize(left: Vector3, right: Vector3): Vector3;
  7630. static Maximize(left: Vector3, right: Vector3): Vector3;
  7631. /**
  7632. * Returns the distance (float) between the vectors "value1" and "value2".
  7633. */
  7634. static Distance(value1: Vector3, value2: Vector3): number;
  7635. /**
  7636. * Returns the squared distance (float) between the vectors "value1" and "value2".
  7637. */
  7638. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  7639. /**
  7640. * Returns a new Vector3 located at the center between "value1" and "value2".
  7641. */
  7642. static Center(value1: Vector3, value2: Vector3): Vector3;
  7643. /**
  7644. * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
  7645. * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
  7646. * to something in order to rotate it from its local system to the given target system.
  7647. * Note : axis1, axis2 and axis3 are normalized during this operation.
  7648. * Returns a new Vector3.
  7649. */
  7650. static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3;
  7651. /**
  7652. * The same than RotationFromAxis but updates the passed ref Vector3 parameter instead of returning a new Vector3.
  7653. */
  7654. static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void;
  7655. }
  7656. class Vector4 {
  7657. x: number;
  7658. y: number;
  7659. z: number;
  7660. w: number;
  7661. /**
  7662. * Creates a Vector4 object from the passed floats.
  7663. */
  7664. constructor(x: number, y: number, z: number, w: number);
  7665. /**
  7666. * Returns the string with the Vector4 coordinates.
  7667. */
  7668. toString(): string;
  7669. /**
  7670. * Returns the string "Vector4".
  7671. */
  7672. getClassName(): string;
  7673. /**
  7674. * Returns the Vector4 hash code.
  7675. */
  7676. getHashCode(): number;
  7677. /**
  7678. * Returns a new array populated with 4 elements : the Vector4 coordinates.
  7679. */
  7680. asArray(): number[];
  7681. /**
  7682. * Populates the passed array from the passed index with the Vector4 coordinates.
  7683. * Returns the Vector4.
  7684. */
  7685. toArray(array: FloatArray, index?: number): Vector4;
  7686. /**
  7687. * Adds the passed vector to the current Vector4.
  7688. * Returns the updated Vector4.
  7689. */
  7690. addInPlace(otherVector: Vector4): Vector4;
  7691. /**
  7692. * Returns a new Vector4 as the result of the addition of the current Vector4 and the passed one.
  7693. */
  7694. add(otherVector: Vector4): Vector4;
  7695. /**
  7696. * Updates the passed vector "result" with the result of the addition of the current Vector4 and the passed one.
  7697. * Returns the current Vector4.
  7698. */
  7699. addToRef(otherVector: Vector4, result: Vector4): Vector4;
  7700. /**
  7701. * Subtract in place the passed vector from the current Vector4.
  7702. * Returns the updated Vector4.
  7703. */
  7704. subtractInPlace(otherVector: Vector4): Vector4;
  7705. /**
  7706. * Returns a new Vector4 with the result of the subtraction of the passed vector from the current Vector4.
  7707. */
  7708. subtract(otherVector: Vector4): Vector4;
  7709. /**
  7710. * Sets the passed vector "result" with the result of the subtraction of the passed vector from the current Vector4.
  7711. * Returns the current Vector4.
  7712. */
  7713. subtractToRef(otherVector: Vector4, result: Vector4): Vector4;
  7714. /**
  7715. * Returns a new Vector4 set with the result of the subtraction of the passed floats from the current Vector4 coordinates.
  7716. */
  7717. subtractFromFloats(x: number, y: number, z: number, w: number): Vector4;
  7718. /**
  7719. * Sets the passed vector "result" set with the result of the subtraction of the passed floats from the current Vector4 coordinates.
  7720. * Returns the current Vector4.
  7721. */
  7722. subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4;
  7723. /**
  7724. * Returns a new Vector4 set with the current Vector4 negated coordinates.
  7725. */
  7726. negate(): Vector4;
  7727. /**
  7728. * Multiplies the current Vector4 coordinates by scale (float).
  7729. * Returns the updated Vector4.
  7730. */
  7731. scaleInPlace(scale: number): Vector4;
  7732. /**
  7733. * Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float).
  7734. */
  7735. scale(scale: number): Vector4;
  7736. /**
  7737. * Sets the passed vector "result" with the current Vector4 coordinates multiplied by scale (float).
  7738. * Returns the current Vector4.
  7739. */
  7740. scaleToRef(scale: number, result: Vector4): Vector4;
  7741. /**
  7742. * Boolean : True if the current Vector4 coordinates are stricly equal to the passed ones.
  7743. */
  7744. equals(otherVector: Vector4): boolean;
  7745. /**
  7746. * Boolean : True if the current Vector4 coordinates are each beneath the distance "epsilon" from the passed vector ones.
  7747. */
  7748. equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean;
  7749. /**
  7750. * Boolean : True if the passed floats are strictly equal to the current Vector4 coordinates.
  7751. */
  7752. equalsToFloats(x: number, y: number, z: number, w: number): boolean;
  7753. /**
  7754. * Multiplies in place the current Vector4 by the passed one.
  7755. * Returns the updated Vector4.
  7756. */
  7757. multiplyInPlace(otherVector: Vector4): Vector4;
  7758. /**
  7759. * Returns a new Vector4 set with the multiplication result of the current Vector4 and the passed one.
  7760. */
  7761. multiply(otherVector: Vector4): Vector4;
  7762. /**
  7763. * Updates the passed vector "result" with the multiplication result of the current Vector4 and the passed one.
  7764. * Returns the current Vector4.
  7765. */
  7766. multiplyToRef(otherVector: Vector4, result: Vector4): Vector4;
  7767. /**
  7768. * Returns a new Vector4 set with the multiplication result of the passed floats and the current Vector4 coordinates.
  7769. */
  7770. multiplyByFloats(x: number, y: number, z: number, w: number): Vector4;
  7771. /**
  7772. * Returns a new Vector4 set with the division result of the current Vector4 by the passed one.
  7773. */
  7774. divide(otherVector: Vector4): Vector4;
  7775. /**
  7776. * Updates the passed vector "result" with the division result of the current Vector4 by the passed one.
  7777. * Returns the current Vector4.
  7778. */
  7779. divideToRef(otherVector: Vector4, result: Vector4): Vector4;
  7780. /**
  7781. * Updates the Vector4 coordinates with the minimum values between its own and the passed vector ones.
  7782. */
  7783. MinimizeInPlace(other: Vector4): Vector4;
  7784. /**
  7785. * Updates the Vector4 coordinates with the maximum values between its own and the passed vector ones.
  7786. */
  7787. MaximizeInPlace(other: Vector4): Vector4;
  7788. /**
  7789. * Returns the Vector4 length (float).
  7790. */
  7791. length(): number;
  7792. /**
  7793. * Returns the Vector4 squared length (float).
  7794. */
  7795. lengthSquared(): number;
  7796. /**
  7797. * Normalizes in place the Vector4.
  7798. * Returns the updated Vector4.
  7799. */
  7800. normalize(): Vector4;
  7801. /**
  7802. * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.
  7803. */
  7804. toVector3(): Vector3;
  7805. /**
  7806. * Returns a new Vector4 copied from the current one.
  7807. */
  7808. clone(): Vector4;
  7809. /**
  7810. * Updates the current Vector4 with the passed one coordinates.
  7811. * Returns the updated Vector4.
  7812. */
  7813. copyFrom(source: Vector4): Vector4;
  7814. /**
  7815. * Updates the current Vector4 coordinates with the passed floats.
  7816. * Returns the updated Vector4.
  7817. */
  7818. copyFromFloats(x: number, y: number, z: number, w: number): Vector4;
  7819. /**
  7820. * Updates the current Vector4 coordinates with the passed floats.
  7821. * Returns the updated Vector4.
  7822. */
  7823. set(x: number, y: number, z: number, w: number): Vector4;
  7824. /**
  7825. * Returns a new Vector4 set from the starting index of the passed array.
  7826. */
  7827. static FromArray(array: ArrayLike<number>, offset?: number): Vector4;
  7828. /**
  7829. * Updates the passed vector "result" from the starting index of the passed array.
  7830. */
  7831. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector4): void;
  7832. /**
  7833. * Updates the passed vector "result" from the starting index of the passed Float32Array.
  7834. */
  7835. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void;
  7836. /**
  7837. * Updates the passed vector "result" coordinates from the passed floats.
  7838. */
  7839. static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void;
  7840. /**
  7841. * Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0)
  7842. */
  7843. static Zero(): Vector4;
  7844. /**
  7845. * Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0)
  7846. */
  7847. static One(): Vector4;
  7848. /**
  7849. * Returns a new normalized Vector4 from the passed one.
  7850. */
  7851. static Normalize(vector: Vector4): Vector4;
  7852. /**
  7853. * Updates the passed vector "result" from the normalization of the passed one.
  7854. */
  7855. static NormalizeToRef(vector: Vector4, result: Vector4): void;
  7856. static Minimize(left: Vector4, right: Vector4): Vector4;
  7857. static Maximize(left: Vector4, right: Vector4): Vector4;
  7858. /**
  7859. * Returns the distance (float) between the vectors "value1" and "value2".
  7860. */
  7861. static Distance(value1: Vector4, value2: Vector4): number;
  7862. /**
  7863. * Returns the squared distance (float) between the vectors "value1" and "value2".
  7864. */
  7865. static DistanceSquared(value1: Vector4, value2: Vector4): number;
  7866. /**
  7867. * Returns a new Vector4 located at the center between the vectors "value1" and "value2".
  7868. */
  7869. static Center(value1: Vector4, value2: Vector4): Vector4;
  7870. /**
  7871. * Returns a new Vector4 set with the result of the normal transformation by the passed matrix of the passed vector.
  7872. * This methods computes transformed normalized direction vectors only.
  7873. */
  7874. static TransformNormal(vector: Vector4, transformation: Matrix): Vector4;
  7875. /**
  7876. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed vector.
  7877. * This methods computes transformed normalized direction vectors only.
  7878. */
  7879. static TransformNormalToRef(vector: Vector4, transformation: Matrix, result: Vector4): void;
  7880. /**
  7881. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed floats (x, y, z, w).
  7882. * This methods computes transformed normalized direction vectors only.
  7883. */
  7884. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, w: number, transformation: Matrix, result: Vector4): void;
  7885. }
  7886. interface ISize {
  7887. width: number;
  7888. height: number;
  7889. }
  7890. class Size implements ISize {
  7891. width: number;
  7892. height: number;
  7893. /**
  7894. * Creates a Size object from the passed width and height (floats).
  7895. */
  7896. constructor(width: number, height: number);
  7897. toString(): string;
  7898. /**
  7899. * Returns the string "Size"
  7900. */
  7901. getClassName(): string;
  7902. /**
  7903. * Returns the Size hash code.
  7904. */
  7905. getHashCode(): number;
  7906. /**
  7907. * Updates the current size from the passed one.
  7908. * Returns the updated Size.
  7909. */
  7910. copyFrom(src: Size): void;
  7911. /**
  7912. * Updates in place the current Size from the passed floats.
  7913. * Returns the updated Size.
  7914. */
  7915. copyFromFloats(width: number, height: number): Size;
  7916. /**
  7917. * Updates in place the current Size from the passed floats.
  7918. * Returns the updated Size.
  7919. */
  7920. set(width: number, height: number): Size;
  7921. /**
  7922. * Returns a new Size set with the multiplication result of the current Size and the passed floats.
  7923. */
  7924. multiplyByFloats(w: number, h: number): Size;
  7925. /**
  7926. * Returns a new Size copied from the passed one.
  7927. */
  7928. clone(): Size;
  7929. /**
  7930. * Boolean : True if the current Size and the passed one width and height are strictly equal.
  7931. */
  7932. equals(other: Size): boolean;
  7933. /**
  7934. * Returns the surface of the Size : width * height (float).
  7935. */
  7936. readonly surface: number;
  7937. /**
  7938. * Returns a new Size set to (0.0, 0.0)
  7939. */
  7940. static Zero(): Size;
  7941. /**
  7942. * Returns a new Size set as the addition result of the current Size and the passed one.
  7943. */
  7944. add(otherSize: Size): Size;
  7945. /**
  7946. * Returns a new Size set as the subtraction result of the passed one from the current Size.
  7947. */
  7948. subtract(otherSize: Size): Size;
  7949. /**
  7950. * Returns a new Size set at the linear interpolation "amount" between "start" and "end".
  7951. */
  7952. static Lerp(start: Size, end: Size, amount: number): Size;
  7953. }
  7954. class Quaternion {
  7955. x: number;
  7956. y: number;
  7957. z: number;
  7958. w: number;
  7959. /**
  7960. * Creates a new Quaternion from the passed floats.
  7961. */
  7962. constructor(x?: number, y?: number, z?: number, w?: number);
  7963. /**
  7964. * Returns a string with the Quaternion coordinates.
  7965. */
  7966. toString(): string;
  7967. /**
  7968. * Returns the string "Quaternion".
  7969. */
  7970. getClassName(): string;
  7971. /**
  7972. * Returns the Quaternion hash code.
  7973. */
  7974. getHashCode(): number;
  7975. /**
  7976. * Returns a new array populated with 4 elements : the Quaternion coordinates.
  7977. */
  7978. asArray(): number[];
  7979. /**
  7980. * Boolean : True if the current Quaterion and the passed one coordinates are strictly equal.
  7981. */
  7982. equals(otherQuaternion: Quaternion): boolean;
  7983. /**
  7984. * Returns a new Quaternion copied from the current one.
  7985. */
  7986. clone(): Quaternion;
  7987. /**
  7988. * Updates the current Quaternion from the passed one coordinates.
  7989. * Returns the updated Quaterion.
  7990. */
  7991. copyFrom(other: Quaternion): Quaternion;
  7992. /**
  7993. * Updates the current Quaternion from the passed float coordinates.
  7994. * Returns the updated Quaterion.
  7995. */
  7996. copyFromFloats(x: number, y: number, z: number, w: number): Quaternion;
  7997. /**
  7998. * Updates the current Quaternion from the passed float coordinates.
  7999. * Returns the updated Quaterion.
  8000. */
  8001. set(x: number, y: number, z: number, w: number): Quaternion;
  8002. /**
  8003. * Returns a new Quaternion as the addition result of the passed one and the current Quaternion.
  8004. */
  8005. add(other: Quaternion): Quaternion;
  8006. /**
  8007. * Returns a new Quaternion as the subtraction result of the passed one from the current Quaternion.
  8008. */
  8009. subtract(other: Quaternion): Quaternion;
  8010. /**
  8011. * Returns a new Quaternion set by multiplying the current Quaterion coordinates by the float "scale".
  8012. */
  8013. scale(value: number): Quaternion;
  8014. /**
  8015. * Returns a new Quaternion set as the quaternion mulplication result of the current one with the passed one "q1".
  8016. */
  8017. multiply(q1: Quaternion): Quaternion;
  8018. /**
  8019. * Sets the passed "result" as the quaternion mulplication result of the current one with the passed one "q1".
  8020. * Returns the current Quaternion.
  8021. */
  8022. multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion;
  8023. /**
  8024. * Updates the current Quaternion with the quaternion mulplication result of itself with the passed one "q1".
  8025. * Returns the updated Quaternion.
  8026. */
  8027. multiplyInPlace(q1: Quaternion): Quaternion;
  8028. /**
  8029. * Sets the passed "ref" with the conjugation of the current Quaternion.
  8030. * Returns the current Quaternion.
  8031. */
  8032. conjugateToRef(ref: Quaternion): Quaternion;
  8033. /**
  8034. * Conjugates in place the current Quaternion.
  8035. * Returns the updated Quaternion.
  8036. */
  8037. conjugateInPlace(): Quaternion;
  8038. /**
  8039. * Returns a new Quaternion as the conjugate of the current Quaternion.
  8040. */
  8041. conjugate(): Quaternion;
  8042. /**
  8043. * Returns the Quaternion length (float).
  8044. */
  8045. length(): number;
  8046. /**
  8047. * Normalize in place the current Quaternion.
  8048. * Returns the updated Quaternion.
  8049. */
  8050. normalize(): Quaternion;
  8051. /**
  8052. * Returns a new Vector3 set with the Euler angles translated from the current Quaternion.
  8053. */
  8054. toEulerAngles(order?: string): Vector3;
  8055. /**
  8056. * Sets the passed vector3 "result" with the Euler angles translated from the current Quaternion.
  8057. * Returns the current Quaternion.
  8058. */
  8059. toEulerAnglesToRef(result: Vector3, order?: string): Quaternion;
  8060. /**
  8061. * Updates the passed rotation matrix with the current Quaternion values.
  8062. * Returns the current Quaternion.
  8063. */
  8064. toRotationMatrix(result: Matrix): Quaternion;
  8065. /**
  8066. * Updates the current Quaternion from the passed rotation matrix values.
  8067. * Returns the updated Quaternion.
  8068. */
  8069. fromRotationMatrix(matrix: Matrix): Quaternion;
  8070. /**
  8071. * Returns a new Quaternion set from the passed rotation matrix values.
  8072. */
  8073. static FromRotationMatrix(matrix: Matrix): Quaternion;
  8074. /**
  8075. * Updates the passed quaternion "result" with the passed rotation matrix values.
  8076. */
  8077. static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void;
  8078. /**
  8079. * Returns a new Quaternion set to (0.0, 0.0, 0.0).
  8080. */
  8081. static Zero(): Quaternion;
  8082. /**
  8083. * Returns a new Quaternion as the inverted current Quaternion.
  8084. */
  8085. static Inverse(q: Quaternion): Quaternion;
  8086. /**
  8087. * Returns the identity Quaternion.
  8088. */
  8089. static Identity(): Quaternion;
  8090. static IsIdentity(quaternion: Quaternion): boolean;
  8091. /**
  8092. * Returns a new Quaternion set from the passed axis (Vector3) and angle in radians (float).
  8093. */
  8094. static RotationAxis(axis: Vector3, angle: number): Quaternion;
  8095. /**
  8096. * Sets the passed quaternion "result" from the passed axis (Vector3) and angle in radians (float).
  8097. */
  8098. static RotationAxisToRef(axis: Vector3, angle: number, result: Quaternion): Quaternion;
  8099. /**
  8100. * Retuns a new Quaternion set from the starting index of the passed array.
  8101. */
  8102. static FromArray(array: ArrayLike<number>, offset?: number): Quaternion;
  8103. /**
  8104. * Returns a new Quaternion set from the passed Euler float angles (y, x, z).
  8105. */
  8106. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
  8107. /**
  8108. * Sets the passed quaternion "result" from the passed float Euler angles (y, x, z).
  8109. */
  8110. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
  8111. /**
  8112. * Returns a new Quaternion from the passed float Euler angles expressed in z-x-z orientation
  8113. */
  8114. static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion;
  8115. /**
  8116. * Sets the passed quaternion "result" from the passed float Euler angles expressed in z-x-z orientation
  8117. */
  8118. static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void;
  8119. /**
  8120. * Returns a new Quaternion as the quaternion rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system.
  8121. * cf to Vector3.RotationFromAxis() documentation.
  8122. * Note : axis1, axis2 and axis3 are normalized during this operation.
  8123. */
  8124. static RotationQuaternionFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Quaternion): Quaternion;
  8125. /**
  8126. * Sets the passed quaternion "ref" with the quaternion rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system.
  8127. * cf to Vector3.RotationFromAxis() documentation.
  8128. * Note : axis1, axis2 and axis3 are normalized during this operation.
  8129. */
  8130. static RotationQuaternionFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Quaternion): void;
  8131. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  8132. static SlerpToRef(left: Quaternion, right: Quaternion, amount: number, result: Quaternion): void;
  8133. /**
  8134. * Returns a new Quaternion located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2".
  8135. */
  8136. static Hermite(value1: Quaternion, tangent1: Quaternion, value2: Quaternion, tangent2: Quaternion, amount: number): Quaternion;
  8137. }
  8138. class Matrix {
  8139. updateFlag: number;
  8140. m: Float32Array;
  8141. constructor();
  8142. /**
  8143. * Boolean : True is the matrix is the identity matrix
  8144. */
  8145. isIdentity(considerAsTextureMatrix?: boolean): boolean;
  8146. /**
  8147. * Returns the matrix determinant (float).
  8148. */
  8149. determinant(): number;
  8150. /**
  8151. * Returns the matrix underlying array.
  8152. */
  8153. toArray(): Float32Array;
  8154. /**
  8155. * Returns the matrix underlying array.
  8156. */
  8157. asArray(): Float32Array;
  8158. /**
  8159. * Inverts in place the Matrix.
  8160. * Returns the Matrix inverted.
  8161. */
  8162. invert(): Matrix;
  8163. /**
  8164. * Sets all the matrix elements to zero.
  8165. * Returns the Matrix.
  8166. */
  8167. reset(): Matrix;
  8168. /**
  8169. * Returns a new Matrix as the addition result of the current Matrix and the passed one.
  8170. */
  8171. add(other: Matrix): Matrix;
  8172. /**
  8173. * Sets the passed matrix "result" with the ddition result of the current Matrix and the passed one.
  8174. * Returns the Matrix.
  8175. */
  8176. addToRef(other: Matrix, result: Matrix): Matrix;
  8177. /**
  8178. * Adds in place the passed matrix to the current Matrix.
  8179. * Returns the updated Matrix.
  8180. */
  8181. addToSelf(other: Matrix): Matrix;
  8182. /**
  8183. * Sets the passed matrix with the current inverted Matrix.
  8184. * Returns the unmodified current Matrix.
  8185. */
  8186. invertToRef(other: Matrix): Matrix;
  8187. /**
  8188. * Inserts the translation vector (using 3 x floats) in the current Matrix.
  8189. * Returns the updated Matrix.
  8190. */
  8191. setTranslationFromFloats(x: number, y: number, z: number): Matrix;
  8192. /**
  8193. * Inserts the translation vector in the current Matrix.
  8194. * Returns the updated Matrix.
  8195. */
  8196. setTranslation(vector3: Vector3): Matrix;
  8197. /**
  8198. * Returns a new Vector3 as the extracted translation from the Matrix.
  8199. */
  8200. getTranslation(): Vector3;
  8201. /**
  8202. * Fill a Vector3 with the extracted translation from the Matrix.
  8203. */
  8204. getTranslationToRef(result: Vector3): Matrix;
  8205. /**
  8206. * Remove rotation and scaling part from the Matrix.
  8207. * Returns the updated Matrix.
  8208. */
  8209. removeRotationAndScaling(): Matrix;
  8210. /**
  8211. * Returns a new Matrix set with the multiplication result of the current Matrix and the passed one.
  8212. */
  8213. multiply(other: Matrix): Matrix;
  8214. /**
  8215. * Updates the current Matrix from the passed one values.
  8216. * Returns the updated Matrix.
  8217. */
  8218. copyFrom(other: Matrix): Matrix;
  8219. /**
  8220. * Populates the passed array from the starting index with the Matrix values.
  8221. * Returns the Matrix.
  8222. */
  8223. copyToArray(array: Float32Array, offset?: number): Matrix;
  8224. /**
  8225. * Sets the passed matrix "result" with the multiplication result of the current Matrix and the passed one.
  8226. */
  8227. multiplyToRef(other: Matrix, result: Matrix): Matrix;
  8228. /**
  8229. * Sets the Float32Array "result" from the passed index "offset" with the multiplication result of the current Matrix and the passed one.
  8230. */
  8231. multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix;
  8232. /**
  8233. * Boolean : True is the current Matrix and the passed one values are strictly equal.
  8234. */
  8235. equals(value: Matrix): boolean;
  8236. /**
  8237. * Returns a new Matrix from the current Matrix.
  8238. */
  8239. clone(): Matrix;
  8240. /**
  8241. * Returns the string "Matrix"
  8242. */
  8243. getClassName(): string;
  8244. /**
  8245. * Returns the Matrix hash code.
  8246. */
  8247. getHashCode(): number;
  8248. /**
  8249. * Decomposes the current Matrix into :
  8250. * - a scale vector3 passed as a reference to update,
  8251. * - a rotation quaternion passed as a reference to update,
  8252. * - a translation vector3 passed as a reference to update.
  8253. * Returns the boolean `true`.
  8254. */
  8255. decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean;
  8256. /**
  8257. * Returns a new Matrix as the extracted rotation matrix from the current one.
  8258. */
  8259. getRotationMatrix(): Matrix;
  8260. /**
  8261. * Extracts the rotation matrix from the current one and sets it as the passed "result".
  8262. * Returns the current Matrix.
  8263. */
  8264. getRotationMatrixToRef(result: Matrix): Matrix;
  8265. /**
  8266. * Returns a new Matrix set from the starting index of the passed array.
  8267. */
  8268. static FromArray(array: ArrayLike<number>, offset?: number): Matrix;
  8269. /**
  8270. * Sets the passed "result" matrix from the starting index of the passed array.
  8271. */
  8272. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Matrix): void;
  8273. /**
  8274. * Sets the passed "result" matrix from the starting index of the passed Float32Array by multiplying each element by the float "scale".
  8275. */
  8276. static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void;
  8277. /**
  8278. * Sets the passed matrix "result" with the 16 passed floats.
  8279. */
  8280. static FromValuesToRef(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number, result: Matrix): void;
  8281. /**
  8282. * Returns the index-th row of the current matrix as a new Vector4.
  8283. */
  8284. getRow(index: number): Nullable<Vector4>;
  8285. /**
  8286. * Sets the index-th row of the current matrix with the passed Vector4 values.
  8287. * Returns the updated Matrix.
  8288. */
  8289. setRow(index: number, row: Vector4): Matrix;
  8290. /**
  8291. * Compute the transpose of the matrix.
  8292. * Returns a new Matrix.
  8293. */
  8294. transpose(): Matrix;
  8295. /**
  8296. * Compute the transpose of the matrix.
  8297. * Returns the current matrix.
  8298. */
  8299. transposeToRef(result: Matrix): Matrix;
  8300. /**
  8301. * Sets the index-th row of the current matrix with the passed 4 x float values.
  8302. * Returns the updated Matrix.
  8303. */
  8304. setRowFromFloats(index: number, x: number, y: number, z: number, w: number): Matrix;
  8305. /**
  8306. * Static identity matrix to be used as readonly matrix
  8307. * Must not be updated.
  8308. */
  8309. static readonly IdentityReadOnly: Matrix;
  8310. /**
  8311. * Returns a new Matrix set from the 16 passed floats.
  8312. */
  8313. static FromValues(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number): Matrix;
  8314. /**
  8315. * Returns a new Matrix composed by the passed scale (vector3), rotation (quaternion) and translation (vector3).
  8316. */
  8317. static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
  8318. /**
  8319. * Update a Matrix with values composed by the passed scale (vector3), rotation (quaternion) and translation (vector3).
  8320. */
  8321. static ComposeToRef(scale: Vector3, rotation: Quaternion, translation: Vector3, result: Matrix): void;
  8322. /**
  8323. * Returns a new indentity Matrix.
  8324. */
  8325. static Identity(): Matrix;
  8326. /**
  8327. * Sets the passed "result" as an identity matrix.
  8328. */
  8329. static IdentityToRef(result: Matrix): void;
  8330. /**
  8331. * Returns a new zero Matrix.
  8332. */
  8333. static Zero(): Matrix;
  8334. /**
  8335. * Returns a new rotation matrix for "angle" radians around the X axis.
  8336. */
  8337. static RotationX(angle: number): Matrix;
  8338. /**
  8339. * Returns a new Matrix as the passed inverted one.
  8340. */
  8341. static Invert(source: Matrix): Matrix;
  8342. /**
  8343. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the X axis.
  8344. */
  8345. static RotationXToRef(angle: number, result: Matrix): void;
  8346. /**
  8347. * Returns a new rotation matrix for "angle" radians around the Y axis.
  8348. */
  8349. static RotationY(angle: number): Matrix;
  8350. /**
  8351. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the Y axis.
  8352. */
  8353. static RotationYToRef(angle: number, result: Matrix): void;
  8354. /**
  8355. * Returns a new rotation matrix for "angle" radians around the Z axis.
  8356. */
  8357. static RotationZ(angle: number): Matrix;
  8358. /**
  8359. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the Z axis.
  8360. */
  8361. static RotationZToRef(angle: number, result: Matrix): void;
  8362. /**
  8363. * Returns a new rotation matrix for "angle" radians around the passed axis.
  8364. */
  8365. static RotationAxis(axis: Vector3, angle: number): Matrix;
  8366. /**
  8367. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the passed axis.
  8368. */
  8369. static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void;
  8370. /**
  8371. * Returns a new Matrix as a rotation matrix from the Euler angles (y, x, z).
  8372. */
  8373. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  8374. /**
  8375. * Sets the passed matrix "result" as a rotation matrix from the Euler angles (y, x, z).
  8376. */
  8377. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
  8378. /**
  8379. * Returns a new Matrix as a scaling matrix from the passed floats (x, y, z).
  8380. */
  8381. static Scaling(x: number, y: number, z: number): Matrix;
  8382. /**
  8383. * Sets the passed matrix "result" as a scaling matrix from the passed floats (x, y, z).
  8384. */
  8385. static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
  8386. /**
  8387. * Returns a new Matrix as a translation matrix from the passed floats (x, y, z).
  8388. */
  8389. static Translation(x: number, y: number, z: number): Matrix;
  8390. /**
  8391. * Sets the passed matrix "result" as a translation matrix from the passed floats (x, y, z).
  8392. */
  8393. static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
  8394. /**
  8395. * Returns a new Matrix whose values are the interpolated values for "gradien" (float) between the ones of the matrices "startValue" and "endValue".
  8396. */
  8397. static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  8398. /**
  8399. * Returns a new Matrix whose values are computed by :
  8400. * - decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices,
  8401. * - interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end,
  8402. * - recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices.
  8403. */
  8404. static DecomposeLerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  8405. /**
  8406. * Returns a new rotation Matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".
  8407. * This methods works for a Left-Handed system.
  8408. */
  8409. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  8410. /**
  8411. * Sets the passed "result" Matrix as a rotation matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".
  8412. * This methods works for a Left-Handed system.
  8413. */
  8414. static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  8415. /**
  8416. * Returns a new rotation Matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".
  8417. * This methods works for a Right-Handed system.
  8418. */
  8419. static LookAtRH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  8420. /**
  8421. * Sets the passed "result" Matrix as a rotation matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".
  8422. * This methods works for a Left-Handed system.
  8423. */
  8424. static LookAtRHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  8425. /**
  8426. * Returns a new Matrix as a left-handed orthographic projection matrix computed from the passed floats : width and height of the projection plane, z near and far limits.
  8427. */
  8428. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  8429. /**
  8430. * Sets the passed matrix "result" as a left-handed orthographic projection matrix computed from the passed floats : width and height of the projection plane, z near and far limits.
  8431. */
  8432. static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void;
  8433. /**
  8434. * Returns a new Matrix as a left-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.
  8435. */
  8436. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  8437. /**
  8438. * Sets the passed matrix "result" as a left-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.
  8439. */
  8440. static OrthoOffCenterLHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  8441. /**
  8442. * Returns a new Matrix as a right-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.
  8443. */
  8444. static OrthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  8445. /**
  8446. * Sets the passed matrix "result" as a right-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.
  8447. */
  8448. static OrthoOffCenterRHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  8449. /**
  8450. * Returns a new Matrix as a left-handed perspective projection matrix computed from the passed floats : width and height of the projection plane, z near and far limits.
  8451. */
  8452. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  8453. /**
  8454. * Returns a new Matrix as a left-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.
  8455. */
  8456. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  8457. /**
  8458. * Sets the passed matrix "result" as a left-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.
  8459. */
  8460. static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  8461. /**
  8462. * Returns a new Matrix as a right-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.
  8463. */
  8464. static PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  8465. /**
  8466. * Sets the passed matrix "result" as a right-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.
  8467. */
  8468. static PerspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  8469. /**
  8470. * Sets the passed matrix "result" as a left-handed perspective projection matrix for WebVR computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.
  8471. */
  8472. static PerspectiveFovWebVRToRef(fov: {
  8473. upDegrees: number;
  8474. downDegrees: number;
  8475. leftDegrees: number;
  8476. rightDegrees: number;
  8477. }, znear: number, zfar: number, result: Matrix, rightHanded?: boolean): void;
  8478. /**
  8479. * Returns the final transformation matrix : world * view * projection * viewport
  8480. */
  8481. static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
  8482. /**
  8483. * Returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the passed Matrix.
  8484. */
  8485. static GetAsMatrix2x2(matrix: Matrix): Float32Array;
  8486. /**
  8487. * Returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the passed Matrix.
  8488. */
  8489. static GetAsMatrix3x3(matrix: Matrix): Float32Array;
  8490. /**
  8491. * Compute the transpose of the passed Matrix.
  8492. * Returns a new Matrix.
  8493. */
  8494. static Transpose(matrix: Matrix): Matrix;
  8495. /**
  8496. * Compute the transpose of the passed Matrix and store it in the result matrix.
  8497. */
  8498. static TransposeToRef(matrix: Matrix, result: Matrix): void;
  8499. /**
  8500. * Returns a new Matrix as the reflection matrix across the passed plane.
  8501. */
  8502. static Reflection(plane: Plane): Matrix;
  8503. /**
  8504. * Sets the passed matrix "result" as the reflection matrix across the passed plane.
  8505. */
  8506. static ReflectionToRef(plane: Plane, result: Matrix): void;
  8507. /**
  8508. * Sets the passed matrix "mat" as a rotation matrix composed from the 3 passed left handed axis.
  8509. */
  8510. static FromXYZAxesToRef(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, result: Matrix): void;
  8511. /**
  8512. * Sets the passed matrix "result" as a rotation matrix according to the passed quaternion.
  8513. */
  8514. static FromQuaternionToRef(quat: Quaternion, result: Matrix): void;
  8515. }
  8516. class Plane {
  8517. normal: Vector3;
  8518. d: number;
  8519. /**
  8520. * Creates a Plane object according to the passed floats a, b, c, d and the plane equation : ax + by + cz + d = 0
  8521. */
  8522. constructor(a: number, b: number, c: number, d: number);
  8523. /**
  8524. * Returns the plane coordinates as a new array of 4 elements [a, b, c, d].
  8525. */
  8526. asArray(): number[];
  8527. /**
  8528. * Returns a new plane copied from the current Plane.
  8529. */
  8530. clone(): Plane;
  8531. /**
  8532. * Returns the string "Plane".
  8533. */
  8534. getClassName(): string;
  8535. /**
  8536. * Returns the Plane hash code.
  8537. */
  8538. getHashCode(): number;
  8539. /**
  8540. * Normalize the current Plane in place.
  8541. * Returns the updated Plane.
  8542. */
  8543. normalize(): Plane;
  8544. /**
  8545. * Returns a new Plane as the result of the transformation of the current Plane by the passed matrix.
  8546. */
  8547. transform(transformation: Matrix): Plane;
  8548. /**
  8549. * Returns the dot product (float) of the point coordinates and the plane normal.
  8550. */
  8551. dotCoordinate(point: Vector3): number;
  8552. /**
  8553. * Updates the current Plane from the plane defined by the three passed points.
  8554. * Returns the updated Plane.
  8555. */
  8556. copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  8557. /**
  8558. * Boolean : True is the vector "direction" is the same side than the plane normal.
  8559. */
  8560. isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
  8561. /**
  8562. * Returns the signed distance (float) from the passed point to the Plane.
  8563. */
  8564. signedDistanceTo(point: Vector3): number;
  8565. /**
  8566. * Returns a new Plane from the passed array.
  8567. */
  8568. static FromArray(array: ArrayLike<number>): Plane;
  8569. /**
  8570. * Returns a new Plane defined by the three passed points.
  8571. */
  8572. static FromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  8573. /**
  8574. * Returns a new Plane the normal vector to this plane at the passed origin point.
  8575. * Note : the vector "normal" is updated because normalized.
  8576. */
  8577. static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
  8578. /**
  8579. * Returns the signed distance between the plane defined by the normal vector at the "origin"" point and the passed other point.
  8580. */
  8581. static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
  8582. }
  8583. class Viewport {
  8584. x: number;
  8585. y: number;
  8586. width: number;
  8587. height: number;
  8588. /**
  8589. * Creates a Viewport object located at (x, y) and sized (width, height).
  8590. */
  8591. constructor(x: number, y: number, width: number, height: number);
  8592. toGlobal(renderWidthOrEngine: number | Engine, renderHeight: number): Viewport;
  8593. /**
  8594. * Returns a new Viewport copied from the current one.
  8595. */
  8596. clone(): Viewport;
  8597. }
  8598. class Frustum {
  8599. /**
  8600. * Returns a new array of 6 Frustum planes computed by the passed transformation matrix.
  8601. */
  8602. static GetPlanes(transform: Matrix): Plane[];
  8603. static GetNearPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  8604. static GetFarPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  8605. static GetLeftPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  8606. static GetRightPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  8607. static GetTopPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  8608. static GetBottomPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  8609. /**
  8610. * Sets the passed array "frustumPlanes" with the 6 Frustum planes computed by the passed transformation matrix.
  8611. */
  8612. static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
  8613. }
  8614. enum Space {
  8615. LOCAL = 0,
  8616. WORLD = 1,
  8617. BONE = 2,
  8618. }
  8619. class Axis {
  8620. static X: Vector3;
  8621. static Y: Vector3;
  8622. static Z: Vector3;
  8623. }
  8624. class BezierCurve {
  8625. /**
  8626. * Returns the cubic Bezier interpolated value (float) at "t" (float) from the passed x1, y1, x2, y2 floats.
  8627. */
  8628. static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number;
  8629. }
  8630. enum Orientation {
  8631. CW = 0,
  8632. CCW = 1,
  8633. }
  8634. class Angle {
  8635. /**
  8636. * Creates an Angle object of "radians" radians (float).
  8637. */
  8638. constructor(radians: number);
  8639. /**
  8640. * Returns the Angle value in degrees (float).
  8641. */
  8642. degrees: () => number;
  8643. /**
  8644. * Returns the Angle value in radians (float).
  8645. */
  8646. radians: () => number;
  8647. /**
  8648. * Returns a new Angle object valued with the angle value in radians between the two passed vectors.
  8649. */
  8650. static BetweenTwoPoints(a: Vector2, b: Vector2): Angle;
  8651. /**
  8652. * Returns a new Angle object from the passed float in radians.
  8653. */
  8654. static FromRadians(radians: number): Angle;
  8655. /**
  8656. * Returns a new Angle object from the passed float in degrees.
  8657. */
  8658. static FromDegrees(degrees: number): Angle;
  8659. }
  8660. class Arc2 {
  8661. startPoint: Vector2;
  8662. midPoint: Vector2;
  8663. endPoint: Vector2;
  8664. centerPoint: Vector2;
  8665. radius: number;
  8666. angle: Angle;
  8667. startAngle: Angle;
  8668. orientation: Orientation;
  8669. /**
  8670. * Creates an Arc object from the three passed points : start, middle and end.
  8671. */
  8672. constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2);
  8673. }
  8674. class Path2 {
  8675. closed: boolean;
  8676. /**
  8677. * Creates a Path2 object from the starting 2D coordinates x and y.
  8678. */
  8679. constructor(x: number, y: number);
  8680. /**
  8681. * Adds a new segment until the passed coordinates (x, y) to the current Path2.
  8682. * Returns the updated Path2.
  8683. */
  8684. addLineTo(x: number, y: number): Path2;
  8685. /**
  8686. * Adds _numberOfSegments_ segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2.
  8687. * Returns the updated Path2.
  8688. */
  8689. addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2;
  8690. /**
  8691. * Closes the Path2.
  8692. * Returns the Path2.
  8693. */
  8694. close(): Path2;
  8695. /**
  8696. * Returns the Path2 total length (float).
  8697. */
  8698. length(): number;
  8699. /**
  8700. * Returns the Path2 internal array of points.
  8701. */
  8702. getPoints(): Vector2[];
  8703. /**
  8704. * Returns a new Vector2 located at a percentage of the Path2 total length on this path.
  8705. */
  8706. getPointAtLengthPosition(normalizedLengthPosition: number): Vector2;
  8707. /**
  8708. * Returns a new Path2 starting at the coordinates (x, y).
  8709. */
  8710. static StartingAt(x: number, y: number): Path2;
  8711. }
  8712. class Path3D {
  8713. path: Vector3[];
  8714. /**
  8715. * new Path3D(path, normal, raw)
  8716. * Creates a Path3D. A Path3D is a logical math object, so not a mesh.
  8717. * please read the description in the tutorial : http://doc.babylonjs.com/tutorials/How_to_use_Path3D
  8718. * path : an array of Vector3, the curve axis of the Path3D
  8719. * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.
  8720. * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.
  8721. */
  8722. constructor(path: Vector3[], firstNormal?: Nullable<Vector3>, raw?: boolean);
  8723. /**
  8724. * Returns the Path3D array of successive Vector3 designing its curve.
  8725. */
  8726. getCurve(): Vector3[];
  8727. /**
  8728. * Returns an array populated with tangent vectors on each Path3D curve point.
  8729. */
  8730. getTangents(): Vector3[];
  8731. /**
  8732. * Returns an array populated with normal vectors on each Path3D curve point.
  8733. */
  8734. getNormals(): Vector3[];
  8735. /**
  8736. * Returns an array populated with binormal vectors on each Path3D curve point.
  8737. */
  8738. getBinormals(): Vector3[];
  8739. /**
  8740. * Returns an array populated with distances (float) of the i-th point from the first curve point.
  8741. */
  8742. getDistances(): number[];
  8743. /**
  8744. * Forces the Path3D tangent, normal, binormal and distance recomputation.
  8745. * Returns the same object updated.
  8746. */
  8747. update(path: Vector3[], firstNormal?: Nullable<Vector3>): Path3D;
  8748. }
  8749. class Curve3 {
  8750. /**
  8751. * Returns a Curve3 object along a Quadratic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#quadratic-bezier-curve
  8752. * @param v0 (Vector3) the origin point of the Quadratic Bezier
  8753. * @param v1 (Vector3) the control point
  8754. * @param v2 (Vector3) the end point of the Quadratic Bezier
  8755. * @param nbPoints (integer) the wanted number of points in the curve
  8756. */
  8757. static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3;
  8758. /**
  8759. * Returns a Curve3 object along a Cubic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#cubic-bezier-curve
  8760. * @param v0 (Vector3) the origin point of the Cubic Bezier
  8761. * @param v1 (Vector3) the first control point
  8762. * @param v2 (Vector3) the second control point
  8763. * @param v3 (Vector3) the end point of the Cubic Bezier
  8764. * @param nbPoints (integer) the wanted number of points in the curve
  8765. */
  8766. static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3;
  8767. /**
  8768. * Returns a Curve3 object along a Hermite Spline curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#hermite-spline
  8769. * @param p1 (Vector3) the origin point of the Hermite Spline
  8770. * @param t1 (Vector3) the tangent vector at the origin point
  8771. * @param p2 (Vector3) the end point of the Hermite Spline
  8772. * @param t2 (Vector3) the tangent vector at the end point
  8773. * @param nbPoints (integer) the wanted number of points in the curve
  8774. */
  8775. static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3;
  8776. /**
  8777. * Returns a Curve3 object along a CatmullRom Spline curve :
  8778. * @param points (array of Vector3) the points the spline must pass through. At least, four points required.
  8779. * @param nbPoints (integer) the wanted number of points between each curve control points.
  8780. */
  8781. static CreateCatmullRomSpline(points: Vector3[], nbPoints: number): Curve3;
  8782. /**
  8783. * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.
  8784. * A Curve3 is designed from a series of successive Vector3.
  8785. * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
  8786. */
  8787. constructor(points: Vector3[]);
  8788. /**
  8789. * Returns the Curve3 stored array of successive Vector3
  8790. */
  8791. getPoints(): Vector3[];
  8792. /**
  8793. * Returns the computed length (float) of the curve.
  8794. */
  8795. length(): number;
  8796. /**
  8797. * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);
  8798. * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.
  8799. * curveA and curveB keep unchanged.
  8800. */
  8801. continue(curve: Curve3): Curve3;
  8802. }
  8803. class PositionNormalVertex {
  8804. position: Vector3;
  8805. normal: Vector3;
  8806. constructor(position?: Vector3, normal?: Vector3);
  8807. clone(): PositionNormalVertex;
  8808. }
  8809. class PositionNormalTextureVertex {
  8810. position: Vector3;
  8811. normal: Vector3;
  8812. uv: Vector2;
  8813. constructor(position?: Vector3, normal?: Vector3, uv?: Vector2);
  8814. clone(): PositionNormalTextureVertex;
  8815. }
  8816. class Tmp {
  8817. static Color3: Color3[];
  8818. static Vector2: Vector2[];
  8819. static Vector3: Vector3[];
  8820. static Vector4: Vector4[];
  8821. static Quaternion: Quaternion[];
  8822. static Matrix: Matrix[];
  8823. }
  8824. }
  8825. declare module BABYLON {
  8826. class SphericalPolynomial {
  8827. x: Vector3;
  8828. y: Vector3;
  8829. z: Vector3;
  8830. xx: Vector3;
  8831. yy: Vector3;
  8832. zz: Vector3;
  8833. xy: Vector3;
  8834. yz: Vector3;
  8835. zx: Vector3;
  8836. addAmbient(color: Color3): void;
  8837. static getSphericalPolynomialFromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial;
  8838. scale(scale: number): void;
  8839. }
  8840. class SphericalHarmonics {
  8841. L00: Vector3;
  8842. L1_1: Vector3;
  8843. L10: Vector3;
  8844. L11: Vector3;
  8845. L2_2: Vector3;
  8846. L2_1: Vector3;
  8847. L20: Vector3;
  8848. L21: Vector3;
  8849. L22: Vector3;
  8850. addLight(direction: Vector3, color: Color3, deltaSolidAngle: number): void;
  8851. scale(scale: number): void;
  8852. convertIncidentRadianceToIrradiance(): void;
  8853. convertIrradianceToLambertianRadiance(): void;
  8854. static getsphericalHarmonicsFromPolynomial(polynomial: SphericalPolynomial): SphericalHarmonics;
  8855. }
  8856. }
  8857. declare module BABYLON {
  8858. class AbstractMesh extends TransformNode implements IDisposable, ICullable, IGetSetVerticesData {
  8859. static OCCLUSION_TYPE_NONE: number;
  8860. static OCCLUSION_TYPE_OPTIMISTIC: number;
  8861. static OCCLUSION_TYPE_STRICT: number;
  8862. static OCCLUSION_ALGORITHM_TYPE_ACCURATE: number;
  8863. static OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE: number;
  8864. static readonly BILLBOARDMODE_NONE: number;
  8865. static readonly BILLBOARDMODE_X: number;
  8866. static readonly BILLBOARDMODE_Y: number;
  8867. static readonly BILLBOARDMODE_Z: number;
  8868. static readonly BILLBOARDMODE_ALL: number;
  8869. /**
  8870. * Read-only : the number of facets in the mesh
  8871. */
  8872. readonly facetNb: number;
  8873. /**
  8874. * The number (integer) of subdivisions per axis in the partioning space
  8875. */
  8876. partitioningSubdivisions: number;
  8877. /**
  8878. * The ratio (float) to apply to the bouding box size to set to the partioning space.
  8879. * Ex : 1.01 (default) the partioning space is 1% bigger than the bounding box.
  8880. */
  8881. partitioningBBoxRatio: number;
  8882. /**
  8883. * Boolean : must the facet be depth sorted on next call to `updateFacetData()` ?
  8884. * Works only for updatable meshes.
  8885. * Doesn't work with multi-materials.
  8886. */
  8887. mustDepthSortFacets: boolean;
  8888. /**
  8889. * The location (Vector3) where the facet depth sort must be computed from.
  8890. * By default, the active camera position.
  8891. * Used only when facet depth sort is enabled.
  8892. */
  8893. facetDepthSortFrom: Vector3;
  8894. /**
  8895. * Read-only boolean : is the feature facetData enabled ?
  8896. */
  8897. readonly isFacetDataEnabled: boolean;
  8898. /**
  8899. * An event triggered when this mesh collides with another one
  8900. * @type {BABYLON.Observable}
  8901. */
  8902. onCollideObservable: Observable<AbstractMesh>;
  8903. onCollide: () => void;
  8904. /**
  8905. * An event triggered when the collision's position changes
  8906. * @type {BABYLON.Observable}
  8907. */
  8908. onCollisionPositionChangeObservable: Observable<Vector3>;
  8909. onCollisionPositionChange: () => void;
  8910. /**
  8911. * An event triggered when material is changed
  8912. * @type {BABYLON.Observable}
  8913. */
  8914. onMaterialChangedObservable: Observable<AbstractMesh>;
  8915. definedFacingForward: boolean;
  8916. /**
  8917. * This property determines the type of occlusion query algorithm to run in WebGl, you can use:
  8918. * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.
  8919. * or
  8920. * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.
  8921. * for more info check WebGl documentations
  8922. */
  8923. occlusionQueryAlgorithmType: number;
  8924. /**
  8925. * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:
  8926. * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query whith the Mesh.
  8927. * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.
  8928. * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.
  8929. */
  8930. occlusionType: number;
  8931. /**
  8932. * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retireved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decideds to show or hide the object.
  8933. * The default value is -1 which means don't break the query and wait till the result.
  8934. */
  8935. occlusionRetryCount: number;
  8936. /**
  8937. * Property isOccluded : Gets or sets whether the mesh is occluded or not, it is used also to set the intial state of the mesh to be occluded or not.
  8938. */
  8939. isOccluded: boolean;
  8940. /**
  8941. * Flag to check the progress status of the query
  8942. */
  8943. readonly isOcclusionQueryInProgress: boolean;
  8944. visibility: number;
  8945. alphaIndex: number;
  8946. isVisible: boolean;
  8947. isPickable: boolean;
  8948. showBoundingBox: boolean;
  8949. showSubMeshesBoundingBox: boolean;
  8950. isBlocker: boolean;
  8951. enablePointerMoveEvents: boolean;
  8952. renderingGroupId: number;
  8953. material: Nullable<Material>;
  8954. receiveShadows: boolean;
  8955. renderOutline: boolean;
  8956. outlineColor: Color3;
  8957. outlineWidth: number;
  8958. renderOverlay: boolean;
  8959. overlayColor: Color3;
  8960. overlayAlpha: number;
  8961. hasVertexAlpha: boolean;
  8962. useVertexColors: boolean;
  8963. computeBonesUsingShaders: boolean;
  8964. numBoneInfluencers: number;
  8965. applyFog: boolean;
  8966. useOctreeForRenderingSelection: boolean;
  8967. useOctreeForPicking: boolean;
  8968. useOctreeForCollisions: boolean;
  8969. layerMask: number;
  8970. /**
  8971. * True if the mesh must be rendered in any case.
  8972. */
  8973. alwaysSelectAsActiveMesh: boolean;
  8974. /**
  8975. * This scene's action manager
  8976. * @type {BABYLON.ActionManager}
  8977. */
  8978. actionManager: Nullable<ActionManager>;
  8979. physicsImpostor: Nullable<PhysicsImpostor>;
  8980. ellipsoid: Vector3;
  8981. ellipsoidOffset: Vector3;
  8982. collisionMask: number;
  8983. collisionGroup: number;
  8984. edgesWidth: number;
  8985. edgesColor: Color4;
  8986. subMeshes: SubMesh[];
  8987. readonly _positions: Nullable<Vector3[]>;
  8988. skeleton: Nullable<Skeleton>;
  8989. constructor(name: string, scene?: Nullable<Scene>);
  8990. /**
  8991. * Boolean : true if the mesh has been disposed.
  8992. */
  8993. isDisposed(): boolean;
  8994. /**
  8995. * Returns the string "AbstractMesh"
  8996. */
  8997. getClassName(): string;
  8998. /**
  8999. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  9000. */
  9001. toString(fullDetails?: boolean): string;
  9002. /**
  9003. * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
  9004. * Default : (1.0, 1.0, 1.0)
  9005. */
  9006. /**
  9007. * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
  9008. * Default : (1.0, 1.0, 1.0)
  9009. */
  9010. scaling: Vector3;
  9011. /**
  9012. * Disables the mesh edger rendering mode.
  9013. * Returns the AbstractMesh.
  9014. */
  9015. disableEdgesRendering(): AbstractMesh;
  9016. /**
  9017. * Enables the edge rendering mode on the mesh.
  9018. * This mode makes the mesh edges visible.
  9019. * Returns the AbstractMesh.
  9020. */
  9021. enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): AbstractMesh;
  9022. /**
  9023. * Returns true if the mesh is blocked. Used by the class Mesh.
  9024. * Returns the boolean `false` by default.
  9025. */
  9026. readonly isBlocked: boolean;
  9027. /**
  9028. * Returns the mesh itself by default, used by the class Mesh.
  9029. * Returned type : AbstractMesh
  9030. */
  9031. getLOD(camera: Camera): AbstractMesh;
  9032. /**
  9033. * Returns 0 by default, used by the class Mesh.
  9034. * Returns an integer.
  9035. */
  9036. getTotalVertices(): number;
  9037. /**
  9038. * Returns null by default, used by the class Mesh.
  9039. * Returned type : integer array
  9040. */
  9041. getIndices(): Nullable<IndicesArray>;
  9042. /**
  9043. * Returns the array of the requested vertex data kind. Used by the class Mesh. Returns null here.
  9044. * Returned type : float array or Float32Array
  9045. */
  9046. getVerticesData(kind: string): Nullable<FloatArray>;
  9047. /**
  9048. * Sets the vertex data of the mesh geometry for the requested `kind`.
  9049. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  9050. * The `data` are either a numeric array either a Float32Array.
  9051. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  9052. * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).
  9053. * Note that a new underlying VertexBuffer object is created each call.
  9054. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  9055. *
  9056. * Possible `kind` values :
  9057. * - BABYLON.VertexBuffer.PositionKind
  9058. * - BABYLON.VertexBuffer.UVKind
  9059. * - BABYLON.VertexBuffer.UV2Kind
  9060. * - BABYLON.VertexBuffer.UV3Kind
  9061. * - BABYLON.VertexBuffer.UV4Kind
  9062. * - BABYLON.VertexBuffer.UV5Kind
  9063. * - BABYLON.VertexBuffer.UV6Kind
  9064. * - BABYLON.VertexBuffer.ColorKind
  9065. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9066. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9067. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9068. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9069. *
  9070. * Returns the Mesh.
  9071. */
  9072. setVerticesData(kind: string, data: FloatArray, updatable?: boolean, stride?: number): AbstractMesh;
  9073. /**
  9074. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  9075. * If the mesh has no geometry, it is simply returned as it is.
  9076. * The `data` are either a numeric array either a Float32Array.
  9077. * No new underlying VertexBuffer object is created.
  9078. * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  9079. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  9080. *
  9081. * Possible `kind` values :
  9082. * - BABYLON.VertexBuffer.PositionKind
  9083. * - BABYLON.VertexBuffer.UVKind
  9084. * - BABYLON.VertexBuffer.UV2Kind
  9085. * - BABYLON.VertexBuffer.UV3Kind
  9086. * - BABYLON.VertexBuffer.UV4Kind
  9087. * - BABYLON.VertexBuffer.UV5Kind
  9088. * - BABYLON.VertexBuffer.UV6Kind
  9089. * - BABYLON.VertexBuffer.ColorKind
  9090. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9091. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9092. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9093. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9094. *
  9095. * Returns the Mesh.
  9096. */
  9097. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): AbstractMesh;
  9098. /**
  9099. * Sets the mesh indices.
  9100. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  9101. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  9102. * This method creates a new index buffer each call.
  9103. * Returns the Mesh.
  9104. */
  9105. setIndices(indices: IndicesArray, totalVertices: Nullable<number>): AbstractMesh;
  9106. /** Returns false by default, used by the class Mesh.
  9107. * Returns a boolean
  9108. */
  9109. isVerticesDataPresent(kind: string): boolean;
  9110. /**
  9111. * Returns the mesh BoundingInfo object or creates a new one and returns it if undefined.
  9112. * Returns a BoundingInfo
  9113. */
  9114. getBoundingInfo(): BoundingInfo;
  9115. /**
  9116. * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units).
  9117. * @param includeDescendants Take the hierarchy's bounding box instead of the mesh's bounding box.
  9118. */
  9119. normalizeToUnitCube(includeDescendants?: boolean): AbstractMesh;
  9120. /**
  9121. * Sets a mesh new object BoundingInfo.
  9122. * Returns the AbstractMesh.
  9123. */
  9124. setBoundingInfo(boundingInfo: BoundingInfo): AbstractMesh;
  9125. readonly useBones: boolean;
  9126. /**
  9127. * Returns the latest update of the World matrix
  9128. * Returns a Matrix.
  9129. */
  9130. getWorldMatrix(): Matrix;
  9131. /**
  9132. * Returns the latest update of the World matrix determinant.
  9133. */
  9134. /**
  9135. * Perform relative position change from the point of view of behind the front of the mesh.
  9136. * This is performed taking into account the meshes current rotation, so you do not have to care.
  9137. * Supports definition of mesh facing forward or backward.
  9138. * @param {number} amountRight
  9139. * @param {number} amountUp
  9140. * @param {number} amountForward
  9141. *
  9142. * Returns the AbstractMesh.
  9143. */
  9144. movePOV(amountRight: number, amountUp: number, amountForward: number): AbstractMesh;
  9145. /**
  9146. * Calculate relative position change from the point of view of behind the front of the mesh.
  9147. * This is performed taking into account the meshes current rotation, so you do not have to care.
  9148. * Supports definition of mesh facing forward or backward.
  9149. * @param {number} amountRight
  9150. * @param {number} amountUp
  9151. * @param {number} amountForward
  9152. *
  9153. * Returns a new Vector3.
  9154. */
  9155. calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
  9156. /**
  9157. * Perform relative rotation change from the point of view of behind the front of the mesh.
  9158. * Supports definition of mesh facing forward or backward.
  9159. * @param {number} flipBack
  9160. * @param {number} twirlClockwise
  9161. * @param {number} tiltRight
  9162. *
  9163. * Returns the AbstractMesh.
  9164. */
  9165. rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): AbstractMesh;
  9166. /**
  9167. * Calculate relative rotation change from the point of view of behind the front of the mesh.
  9168. * Supports definition of mesh facing forward or backward.
  9169. * @param {number} flipBack
  9170. * @param {number} twirlClockwise
  9171. * @param {number} tiltRight
  9172. *
  9173. * Returns a new Vector3.
  9174. */
  9175. calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
  9176. /**
  9177. * Return the minimum and maximum world vectors of the entire hierarchy under current mesh
  9178. * @param includeDescendants Include bounding info from descendants as well (true by default).
  9179. */
  9180. getHierarchyBoundingVectors(includeDescendants?: boolean): {
  9181. min: Vector3;
  9182. max: Vector3;
  9183. };
  9184. /**
  9185. * Updates the mesh BoundingInfo object and all its children BoundingInfo objects also.
  9186. * Returns the AbstractMesh.
  9187. */
  9188. /**
  9189. * Update a mesh's children BoundingInfo objects only.
  9190. * Returns the AbstractMesh.
  9191. */
  9192. /**
  9193. * Returns `true` if the mesh is within the frustum defined by the passed array of planes.
  9194. * A mesh is in the frustum if its bounding box intersects the frustum.
  9195. * Boolean returned.
  9196. */
  9197. isInFrustum(frustumPlanes: Plane[]): boolean;
  9198. /**
  9199. * Returns `true` if the mesh is completely in the frustum defined be the passed array of planes.
  9200. * A mesh is completely in the frustum if its bounding box it completely inside the frustum.
  9201. * Boolean returned.
  9202. */
  9203. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  9204. /**
  9205. * True if the mesh intersects another mesh or a SolidParticle object.
  9206. * Unless the parameter `precise` is set to `true` the intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes)
  9207. * includeDescendants can be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes
  9208. * Returns a boolean.
  9209. */
  9210. intersectsMesh(mesh: AbstractMesh | SolidParticle, precise?: boolean, includeDescendants?: boolean): boolean;
  9211. /**
  9212. * Returns true if the passed point (Vector3) is inside the mesh bounding box.
  9213. * Returns a boolean.
  9214. */
  9215. intersectsPoint(point: Vector3): boolean;
  9216. getPhysicsImpostor(): Nullable<PhysicsImpostor>;
  9217. getPositionInCameraSpace(camera?: Nullable<Camera>): Vector3;
  9218. /**
  9219. * Returns the distance from the mesh to the active camera.
  9220. * Returns a float.
  9221. */
  9222. getDistanceToCamera(camera?: Nullable<Camera>): number;
  9223. applyImpulse(force: Vector3, contactPoint: Vector3): AbstractMesh;
  9224. setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): AbstractMesh;
  9225. /**
  9226. * Property checkCollisions : Boolean, whether the camera should check the collisions against the mesh.
  9227. * Default `false`.
  9228. */
  9229. checkCollisions: boolean;
  9230. /**
  9231. * Gets Collider object used to compute collisions (not physics)
  9232. */
  9233. readonly collider: Collider;
  9234. moveWithCollisions(displacement: Vector3): AbstractMesh;
  9235. /**
  9236. * This function will create an octree to help to select the right submeshes for rendering, picking and collision computations.
  9237. * Please note that you must have a decent number of submeshes to get performance improvements when using an octree.
  9238. * Returns an Octree of submeshes.
  9239. */
  9240. createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
  9241. /**
  9242. * Checks if the passed Ray intersects with the mesh.
  9243. * Returns an object PickingInfo.
  9244. */
  9245. intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
  9246. /**
  9247. * Clones the mesh, used by the class Mesh.
  9248. * Just returns `null` for an AbstractMesh.
  9249. */
  9250. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): Nullable<AbstractMesh>;
  9251. /**
  9252. * Disposes all the mesh submeshes.
  9253. * Returns the AbstractMesh.
  9254. */
  9255. releaseSubMeshes(): AbstractMesh;
  9256. /**
  9257. * Disposes the AbstractMesh.
  9258. * By default, all the mesh children are also disposed unless the parameter `doNotRecurse` is set to `true`.
  9259. * Returns nothing.
  9260. */
  9261. dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void;
  9262. /**
  9263. * Adds the passed mesh as a child to the current mesh.
  9264. * Returns the AbstractMesh.
  9265. */
  9266. addChild(mesh: AbstractMesh): AbstractMesh;
  9267. /**
  9268. * Removes the passed mesh from the current mesh children list.
  9269. * Returns the AbstractMesh.
  9270. */
  9271. removeChild(mesh: AbstractMesh): AbstractMesh;
  9272. /**
  9273. * Initialize the facet data arrays : facetNormals, facetPositions and facetPartitioning.
  9274. * Returns the AbstractMesh.
  9275. */
  9276. /**
  9277. * Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.
  9278. * This method can be called within the render loop.
  9279. * You don't need to call this method by yourself in the render loop when you update/morph a mesh with the methods CreateXXX() as they automatically manage this computation.
  9280. * Returns the AbstractMesh.
  9281. */
  9282. updateFacetData(): AbstractMesh;
  9283. /**
  9284. * Returns the facetLocalNormals array.
  9285. * The normals are expressed in the mesh local space.
  9286. */
  9287. getFacetLocalNormals(): Vector3[];
  9288. /**
  9289. * Returns the facetLocalPositions array.
  9290. * The facet positions are expressed in the mesh local space.
  9291. */
  9292. getFacetLocalPositions(): Vector3[];
  9293. /**
  9294. * Returns the facetLocalPartioning array.
  9295. */
  9296. getFacetLocalPartitioning(): number[][];
  9297. /**
  9298. * Returns the i-th facet position in the world system.
  9299. * This method allocates a new Vector3 per call.
  9300. */
  9301. getFacetPosition(i: number): Vector3;
  9302. /**
  9303. * Sets the reference Vector3 with the i-th facet position in the world system.
  9304. * Returns the AbstractMesh.
  9305. */
  9306. getFacetPositionToRef(i: number, ref: Vector3): AbstractMesh;
  9307. /**
  9308. * Returns the i-th facet normal in the world system.
  9309. * This method allocates a new Vector3 per call.
  9310. */
  9311. getFacetNormal(i: number): Vector3;
  9312. /**
  9313. * Sets the reference Vector3 with the i-th facet normal in the world system.
  9314. * Returns the AbstractMesh.
  9315. */
  9316. getFacetNormalToRef(i: number, ref: Vector3): this;
  9317. /**
  9318. * Returns the facets (in an array) in the same partitioning block than the one the passed coordinates are located (expressed in the mesh local system).
  9319. */
  9320. getFacetsAtLocalCoordinates(x: number, y: number, z: number): Nullable<number[]>;
  9321. /**
  9322. * Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found.
  9323. * If the parameter projected (vector3) is passed, it is set as the (x,y,z) World projection on the facet.
  9324. * If checkFace is true (default false), only the facet "facing" to (x,y,z) or only the ones "turning their backs", according to the parameter "facing" are returned.
  9325. * If facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position.
  9326. * If facing si false and checkFace is true, only the facet "turning their backs" to (x, y, z) are returned : negative dot (x, y, z) * facet position.
  9327. */
  9328. getClosestFacetAtCoordinates(x: number, y: number, z: number, projected?: Vector3, checkFace?: boolean, facing?: boolean): Nullable<number>;
  9329. /**
  9330. * Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found.
  9331. * If the parameter projected (vector3) is passed, it is set as the (x,y,z) local projection on the facet.
  9332. * If checkFace is true (default false), only the facet "facing" to (x,y,z) or only the ones "turning their backs", according to the parameter "facing" are returned.
  9333. * If facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position.
  9334. * If facing si false and checkFace is true, only the facet "turning their backs" to (x, y, z) are returned : negative dot (x, y, z) * facet position.
  9335. */
  9336. getClosestFacetAtLocalCoordinates(x: number, y: number, z: number, projected?: Vector3, checkFace?: boolean, facing?: boolean): Nullable<number>;
  9337. /**
  9338. * Returns the object "parameter" set with all the expected parameters for facetData computation by ComputeNormals()
  9339. */
  9340. getFacetDataParameters(): any;
  9341. /**
  9342. * Disables the feature FacetData and frees the related memory.
  9343. * Returns the AbstractMesh.
  9344. */
  9345. disableFacetData(): AbstractMesh;
  9346. /**
  9347. * Updates the AbstractMesh indices array. Actually, used by the Mesh object.
  9348. * Returns the mesh.
  9349. */
  9350. updateIndices(indices: IndicesArray): AbstractMesh;
  9351. /**
  9352. * The mesh Geometry. Actually used by the Mesh object.
  9353. * Returns a blank geometry object.
  9354. */
  9355. /**
  9356. * Creates new normals data for the mesh.
  9357. * @param updatable.
  9358. */
  9359. createNormals(updatable: boolean): void;
  9360. /**
  9361. * Align the mesh with a normal.
  9362. * Returns the mesh.
  9363. */
  9364. alignWithNormal(normal: Vector3, upDirection?: Vector3): AbstractMesh;
  9365. }
  9366. }
  9367. declare module BABYLON {
  9368. class Buffer {
  9369. constructor(engine: any, data: FloatArray, updatable: boolean, stride: number, postponeInternalCreation?: boolean, instanced?: boolean);
  9370. createVertexBuffer(kind: string, offset: number, size: number, stride?: number): VertexBuffer;
  9371. isUpdatable(): boolean;
  9372. getData(): Nullable<FloatArray>;
  9373. getBuffer(): Nullable<WebGLBuffer>;
  9374. getStrideSize(): number;
  9375. getIsInstanced(): boolean;
  9376. instanceDivisor: number;
  9377. create(data?: Nullable<FloatArray>): void;
  9378. update(data: FloatArray): void;
  9379. updateDirectly(data: Float32Array, offset: number, vertexCount?: number): void;
  9380. dispose(): void;
  9381. }
  9382. }
  9383. declare module BABYLON {
  9384. class CSG {
  9385. matrix: Matrix;
  9386. position: Vector3;
  9387. rotation: Vector3;
  9388. rotationQuaternion: Nullable<Quaternion>;
  9389. scaling: Vector3;
  9390. static FromMesh(mesh: Mesh): CSG;
  9391. clone(): CSG;
  9392. union(csg: CSG): CSG;
  9393. unionInPlace(csg: CSG): void;
  9394. subtract(csg: CSG): CSG;
  9395. subtractInPlace(csg: CSG): void;
  9396. intersect(csg: CSG): CSG;
  9397. intersectInPlace(csg: CSG): void;
  9398. inverse(): CSG;
  9399. inverseInPlace(): void;
  9400. copyTransformAttributes(csg: CSG): CSG;
  9401. buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh;
  9402. toMesh(name: string, material: Nullable<Material>, scene: Scene, keepSubMeshes: boolean): Mesh;
  9403. }
  9404. }
  9405. declare module BABYLON {
  9406. class Geometry implements IGetSetVerticesData {
  9407. id: string;
  9408. delayLoadState: number;
  9409. delayLoadingFile: Nullable<string>;
  9410. onGeometryUpdated: (geometry: Geometry, kind?: string) => void;
  9411. /**
  9412. * The Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y
  9413. * @returns The Bias Vector
  9414. */
  9415. boundingBias: Vector2;
  9416. static CreateGeometryForMesh(mesh: Mesh): Geometry;
  9417. constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Nullable<Mesh>);
  9418. readonly extend: {
  9419. minimum: Vector3;
  9420. maximum: Vector3;
  9421. };
  9422. getScene(): Scene;
  9423. getEngine(): Engine;
  9424. isReady(): boolean;
  9425. readonly doNotSerialize: boolean;
  9426. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  9427. setVerticesData(kind: string, data: FloatArray, updatable?: boolean, stride?: number): void;
  9428. removeVerticesData(kind: string): void;
  9429. setVerticesBuffer(buffer: VertexBuffer): void;
  9430. updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void;
  9431. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean): void;
  9432. getTotalVertices(): number;
  9433. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray>;
  9434. /**
  9435. * Returns a boolean defining if the vertex data for the requested `kind` is updatable.
  9436. * Possible `kind` values :
  9437. * - BABYLON.VertexBuffer.PositionKind
  9438. * - BABYLON.VertexBuffer.UVKind
  9439. * - BABYLON.VertexBuffer.UV2Kind
  9440. * - BABYLON.VertexBuffer.UV3Kind
  9441. * - BABYLON.VertexBuffer.UV4Kind
  9442. * - BABYLON.VertexBuffer.UV5Kind
  9443. * - BABYLON.VertexBuffer.UV6Kind
  9444. * - BABYLON.VertexBuffer.ColorKind
  9445. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9446. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9447. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9448. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9449. */
  9450. isVertexBufferUpdatable(kind: string): boolean;
  9451. getVertexBuffer(kind: string): Nullable<VertexBuffer>;
  9452. getVertexBuffers(): Nullable<{
  9453. [key: string]: VertexBuffer;
  9454. }>;
  9455. isVerticesDataPresent(kind: string): boolean;
  9456. getVerticesDataKinds(): string[];
  9457. updateIndices(indices: IndicesArray, offset?: number): void;
  9458. setIndices(indices: IndicesArray, totalVertices?: Nullable<number>, updatable?: boolean): void;
  9459. getTotalIndices(): number;
  9460. getIndices(copyWhenShared?: boolean): Nullable<IndicesArray>;
  9461. getIndexBuffer(): Nullable<WebGLBuffer>;
  9462. releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
  9463. applyToMesh(mesh: Mesh): void;
  9464. load(scene: Scene, onLoaded?: () => void): void;
  9465. /**
  9466. * Invert the geometry to move from a right handed system to a left handed one.
  9467. */
  9468. toLeftHanded(): void;
  9469. isDisposed(): boolean;
  9470. dispose(): void;
  9471. copy(id: string): Geometry;
  9472. serialize(): any;
  9473. serializeVerticeData(): any;
  9474. static ExtractFromMesh(mesh: Mesh, id: string): Nullable<Geometry>;
  9475. /**
  9476. * You should now use Tools.RandomId(), this method is still here for legacy reasons.
  9477. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  9478. * Be aware Math.random() could cause collisions, but:
  9479. * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
  9480. */
  9481. static RandomId(): string;
  9482. static ImportGeometry(parsedGeometry: any, mesh: Mesh): void;
  9483. static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Nullable<Geometry>;
  9484. }
  9485. module Geometry.Primitives {
  9486. class _Primitive extends Geometry {
  9487. constructor(id: string, scene: Scene, _canBeRegenerated?: boolean, mesh?: Nullable<Mesh>);
  9488. canBeRegenerated(): boolean;
  9489. regenerate(): void;
  9490. asNewGeometry(id: string): Geometry;
  9491. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  9492. setVerticesData(kind: string, data: FloatArray, updatable?: boolean): void;
  9493. copy(id: string): Geometry;
  9494. serialize(): any;
  9495. }
  9496. class Ribbon extends _Primitive {
  9497. pathArray: Vector3[][];
  9498. closeArray: boolean;
  9499. closePath: boolean;
  9500. offset: number;
  9501. side: number;
  9502. constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  9503. copy(id: string): Geometry;
  9504. }
  9505. class Box extends _Primitive {
  9506. size: number;
  9507. side: number;
  9508. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9509. copy(id: string): Geometry;
  9510. serialize(): any;
  9511. static Parse(parsedBox: any, scene: Scene): Nullable<Box>;
  9512. }
  9513. class Sphere extends _Primitive {
  9514. segments: number;
  9515. diameter: number;
  9516. side: number;
  9517. constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9518. copy(id: string): Geometry;
  9519. serialize(): any;
  9520. static Parse(parsedSphere: any, scene: Scene): Nullable<Geometry.Primitives.Sphere>;
  9521. }
  9522. class Disc extends _Primitive {
  9523. radius: number;
  9524. tessellation: number;
  9525. side: number;
  9526. constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9527. copy(id: string): Geometry;
  9528. }
  9529. class Cylinder extends _Primitive {
  9530. height: number;
  9531. diameterTop: number;
  9532. diameterBottom: number;
  9533. tessellation: number;
  9534. subdivisions: number;
  9535. side: number;
  9536. constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9537. copy(id: string): Geometry;
  9538. serialize(): any;
  9539. static Parse(parsedCylinder: any, scene: Scene): Nullable<Geometry.Primitives.Cylinder>;
  9540. }
  9541. class Torus extends _Primitive {
  9542. diameter: number;
  9543. thickness: number;
  9544. tessellation: number;
  9545. side: number;
  9546. constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9547. copy(id: string): Geometry;
  9548. serialize(): any;
  9549. static Parse(parsedTorus: any, scene: Scene): Nullable<Geometry.Primitives.Torus>;
  9550. }
  9551. class Ground extends _Primitive {
  9552. width: number;
  9553. height: number;
  9554. subdivisions: number;
  9555. constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>);
  9556. copy(id: string): Geometry;
  9557. serialize(): any;
  9558. static Parse(parsedGround: any, scene: Scene): Nullable<Geometry.Primitives.Ground>;
  9559. }
  9560. class TiledGround extends _Primitive {
  9561. xmin: number;
  9562. zmin: number;
  9563. xmax: number;
  9564. zmax: number;
  9565. subdivisions: {
  9566. w: number;
  9567. h: number;
  9568. };
  9569. precision: {
  9570. w: number;
  9571. h: number;
  9572. };
  9573. constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  9574. w: number;
  9575. h: number;
  9576. }, precision: {
  9577. w: number;
  9578. h: number;
  9579. }, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>);
  9580. copy(id: string): Geometry;
  9581. }
  9582. class Plane extends _Primitive {
  9583. size: number;
  9584. side: number;
  9585. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9586. copy(id: string): Geometry;
  9587. serialize(): any;
  9588. static Parse(parsedPlane: any, scene: Scene): Nullable<Geometry.Primitives.Plane>;
  9589. }
  9590. class TorusKnot extends _Primitive {
  9591. radius: number;
  9592. tube: number;
  9593. radialSegments: number;
  9594. tubularSegments: number;
  9595. p: number;
  9596. q: number;
  9597. side: number;
  9598. constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9599. copy(id: string): Geometry;
  9600. serialize(): any;
  9601. static Parse(parsedTorusKnot: any, scene: Scene): Nullable<Geometry.Primitives.TorusKnot>;
  9602. }
  9603. }
  9604. }
  9605. declare module BABYLON {
  9606. class GroundMesh extends Mesh {
  9607. generateOctree: boolean;
  9608. constructor(name: string, scene: Scene);
  9609. getClassName(): string;
  9610. readonly subdivisions: number;
  9611. readonly subdivisionsX: number;
  9612. readonly subdivisionsY: number;
  9613. optimize(chunksCount: number, octreeBlocksSize?: number): void;
  9614. /**
  9615. * Returns a height (y) value in the Worl system :
  9616. * the ground altitude at the coordinates (x, z) expressed in the World system.
  9617. * Returns the ground y position if (x, z) are outside the ground surface.
  9618. */
  9619. getHeightAtCoordinates(x: number, z: number): number;
  9620. /**
  9621. * Returns a normalized vector (Vector3) orthogonal to the ground
  9622. * at the ground coordinates (x, z) expressed in the World system.
  9623. * Returns Vector3(0.0, 1.0, 0.0) if (x, z) are outside the ground surface.
  9624. */
  9625. getNormalAtCoordinates(x: number, z: number): Vector3;
  9626. /**
  9627. * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground
  9628. * at the ground coordinates (x, z) expressed in the World system.
  9629. * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.
  9630. * Returns the GroundMesh.
  9631. */
  9632. getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): GroundMesh;
  9633. /**
  9634. * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()
  9635. * if the ground has been updated.
  9636. * This can be used in the render loop.
  9637. * Returns the GroundMesh.
  9638. */
  9639. updateCoordinateHeights(): GroundMesh;
  9640. serialize(serializationObject: any): void;
  9641. static Parse(parsedMesh: any, scene: Scene): GroundMesh;
  9642. }
  9643. }
  9644. declare module BABYLON {
  9645. /**
  9646. * Creates an instance based on a source mesh.
  9647. */
  9648. class InstancedMesh extends AbstractMesh {
  9649. constructor(name: string, source: Mesh);
  9650. /**
  9651. * Returns the string "InstancedMesh".
  9652. */
  9653. getClassName(): string;
  9654. readonly receiveShadows: boolean;
  9655. readonly material: Nullable<Material>;
  9656. readonly visibility: number;
  9657. readonly skeleton: Nullable<Skeleton>;
  9658. readonly renderingGroupId: number;
  9659. /**
  9660. * Returns the total number of vertices (integer).
  9661. */
  9662. getTotalVertices(): number;
  9663. readonly sourceMesh: Mesh;
  9664. /**
  9665. * Returns a float array or a Float32Array of the requested kind of data : positons, normals, uvs, etc.
  9666. */
  9667. getVerticesData(kind: string, copyWhenShared?: boolean): Nullable<FloatArray>;
  9668. /**
  9669. * Sets the vertex data of the mesh geometry for the requested `kind`.
  9670. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  9671. * The `data` are either a numeric array either a Float32Array.
  9672. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  9673. * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).
  9674. * Note that a new underlying VertexBuffer object is created each call.
  9675. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  9676. *
  9677. * Possible `kind` values :
  9678. * - BABYLON.VertexBuffer.PositionKind
  9679. * - BABYLON.VertexBuffer.UVKind
  9680. * - BABYLON.VertexBuffer.UV2Kind
  9681. * - BABYLON.VertexBuffer.UV3Kind
  9682. * - BABYLON.VertexBuffer.UV4Kind
  9683. * - BABYLON.VertexBuffer.UV5Kind
  9684. * - BABYLON.VertexBuffer.UV6Kind
  9685. * - BABYLON.VertexBuffer.ColorKind
  9686. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9687. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9688. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9689. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9690. *
  9691. * Returns the Mesh.
  9692. */
  9693. setVerticesData(kind: string, data: FloatArray, updatable?: boolean, stride?: number): Mesh;
  9694. /**
  9695. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  9696. * If the mesh has no geometry, it is simply returned as it is.
  9697. * The `data` are either a numeric array either a Float32Array.
  9698. * No new underlying VertexBuffer object is created.
  9699. * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  9700. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  9701. *
  9702. * Possible `kind` values :
  9703. * - BABYLON.VertexBuffer.PositionKind
  9704. * - BABYLON.VertexBuffer.UVKind
  9705. * - BABYLON.VertexBuffer.UV2Kind
  9706. * - BABYLON.VertexBuffer.UV3Kind
  9707. * - BABYLON.VertexBuffer.UV4Kind
  9708. * - BABYLON.VertexBuffer.UV5Kind
  9709. * - BABYLON.VertexBuffer.UV6Kind
  9710. * - BABYLON.VertexBuffer.ColorKind
  9711. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9712. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9713. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9714. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9715. *
  9716. * Returns the Mesh.
  9717. */
  9718. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): Mesh;
  9719. /**
  9720. * Sets the mesh indices.
  9721. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  9722. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  9723. * This method creates a new index buffer each call.
  9724. * Returns the Mesh.
  9725. */
  9726. setIndices(indices: IndicesArray, totalVertices?: Nullable<number>): Mesh;
  9727. /**
  9728. * Boolean : True if the mesh owns the requested kind of data.
  9729. */
  9730. isVerticesDataPresent(kind: string): boolean;
  9731. /**
  9732. * Returns an array of indices (IndicesArray).
  9733. */
  9734. getIndices(): Nullable<IndicesArray>;
  9735. readonly _positions: Nullable<Vector3[]>;
  9736. /**
  9737. * Sets a new updated BoundingInfo to the mesh.
  9738. * Returns the mesh.
  9739. */
  9740. refreshBoundingInfo(): InstancedMesh;
  9741. /**
  9742. * Returns the current associated LOD AbstractMesh.
  9743. */
  9744. getLOD(camera: Camera): AbstractMesh;
  9745. /**
  9746. * Creates a new InstancedMesh from the current mesh.
  9747. * - name (string) : the cloned mesh name
  9748. * - newParent (optional Node) : the optional Node to parent the clone to.
  9749. * - doNotCloneChildren (optional boolean, default `false`) : if `true` the model children aren't cloned.
  9750. *
  9751. * Returns the clone.
  9752. */
  9753. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh;
  9754. /**
  9755. * Disposes the InstancedMesh.
  9756. * Returns nothing.
  9757. */
  9758. dispose(doNotRecurse?: boolean): void;
  9759. }
  9760. }
  9761. declare module BABYLON {
  9762. class LinesMesh extends Mesh {
  9763. useVertexColor: boolean | undefined;
  9764. useVertexAlpha: boolean | undefined;
  9765. color: Color3;
  9766. alpha: number;
  9767. /**
  9768. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  9769. * This margin is expressed in world space coordinates, so its value may vary.
  9770. * Default value is 0.1
  9771. * @returns the intersection Threshold value.
  9772. */
  9773. /**
  9774. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  9775. * This margin is expressed in world space coordinates, so its value may vary.
  9776. * @param value the new threshold to apply
  9777. */
  9778. intersectionThreshold: number;
  9779. constructor(name: string, scene?: Nullable<Scene>, parent?: Nullable<Node>, source?: LinesMesh, doNotCloneChildren?: boolean, useVertexColor?: boolean | undefined, useVertexAlpha?: boolean | undefined);
  9780. /**
  9781. * Returns the string "LineMesh"
  9782. */
  9783. getClassName(): string;
  9784. material: Material;
  9785. readonly checkCollisions: boolean;
  9786. createInstance(name: string): InstancedMesh;
  9787. dispose(doNotRecurse?: boolean): void;
  9788. /**
  9789. * Returns a new LineMesh object cloned from the current one.
  9790. */
  9791. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh;
  9792. }
  9793. }
  9794. declare module BABYLON {
  9795. class _InstancesBatch {
  9796. mustReturn: boolean;
  9797. visibleInstances: Nullable<InstancedMesh[]>[];
  9798. renderSelf: boolean[];
  9799. }
  9800. class Mesh extends AbstractMesh implements IGetSetVerticesData {
  9801. /**
  9802. * Mesh side orientation : usually the external or front surface
  9803. */
  9804. static readonly FRONTSIDE: number;
  9805. /**
  9806. * Mesh side orientation : usually the internal or back surface
  9807. */
  9808. static readonly BACKSIDE: number;
  9809. /**
  9810. * Mesh side orientation : both internal and external or front and back surfaces
  9811. */
  9812. static readonly DOUBLESIDE: number;
  9813. /**
  9814. * Mesh side orientation : by default, `FRONTSIDE`
  9815. */
  9816. static readonly DEFAULTSIDE: number;
  9817. /**
  9818. * Mesh cap setting : no cap
  9819. */
  9820. static readonly NO_CAP: number;
  9821. /**
  9822. * Mesh cap setting : one cap at the beginning of the mesh
  9823. */
  9824. static readonly CAP_START: number;
  9825. /**
  9826. * Mesh cap setting : one cap at the end of the mesh
  9827. */
  9828. static readonly CAP_END: number;
  9829. /**
  9830. * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
  9831. */
  9832. static readonly CAP_ALL: number;
  9833. /**
  9834. * An event triggered before rendering the mesh
  9835. * @type {BABYLON.Observable}
  9836. */
  9837. onBeforeRenderObservable: Observable<Mesh>;
  9838. /**
  9839. * An event triggered after rendering the mesh
  9840. * @type {BABYLON.Observable}
  9841. */
  9842. onAfterRenderObservable: Observable<Mesh>;
  9843. /**
  9844. * An event triggered before drawing the mesh
  9845. * @type {BABYLON.Observable}
  9846. */
  9847. onBeforeDrawObservable: Observable<Mesh>;
  9848. onBeforeDraw: () => void;
  9849. delayLoadState: number;
  9850. instances: InstancedMesh[];
  9851. delayLoadingFile: string;
  9852. onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
  9853. morphTargetManager: Nullable<MorphTargetManager>;
  9854. overrideMaterialSideOrientation: Nullable<number>;
  9855. readonly source: Nullable<Mesh>;
  9856. isUnIndexed: boolean;
  9857. /**
  9858. * @constructor
  9859. * @param {string} name The value used by scene.getMeshByName() to do a lookup.
  9860. * @param {Scene} scene The scene to add this mesh to.
  9861. * @param {Node} parent The parent of this mesh, if it has one
  9862. * @param {Mesh} source An optional Mesh from which geometry is shared, cloned.
  9863. * @param {boolean} doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
  9864. * When false, achieved by calling a clone(), also passing False.
  9865. * This will make creation of children, recursive.
  9866. * @param {boolean} clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.
  9867. */
  9868. constructor(name: string, scene?: Nullable<Scene>, parent?: Nullable<Node>, source?: Nullable<Mesh>, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean);
  9869. /**
  9870. * Returns the string "Mesh".
  9871. */
  9872. getClassName(): string;
  9873. /**
  9874. * Returns a string.
  9875. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  9876. */
  9877. toString(fullDetails?: boolean): string;
  9878. /**
  9879. * True if the mesh has some Levels Of Details (LOD).
  9880. * Returns a boolean.
  9881. */
  9882. readonly hasLODLevels: boolean;
  9883. /**
  9884. * Add a mesh as LOD level triggered at the given distance.
  9885. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  9886. * @param {number} distance The distance from the center of the object to show this level
  9887. * @param {Mesh} mesh The mesh to be added as LOD level
  9888. * @return {Mesh} This mesh (for chaining)
  9889. */
  9890. addLODLevel(distance: number, mesh: Mesh): Mesh;
  9891. /**
  9892. * Returns the LOD level mesh at the passed distance or null if not found.
  9893. * It is related to the method `addLODLevel(distance, mesh)`.
  9894. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  9895. * Returns an object Mesh or `null`.
  9896. */
  9897. getLODLevelAtDistance(distance: number): Nullable<Mesh>;
  9898. /**
  9899. * Remove a mesh from the LOD array
  9900. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  9901. * @param {Mesh} mesh The mesh to be removed.
  9902. * @return {Mesh} This mesh (for chaining)
  9903. */
  9904. removeLODLevel(mesh: Mesh): Mesh;
  9905. /**
  9906. * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.
  9907. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  9908. */
  9909. getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh;
  9910. /**
  9911. * Returns the mesh internal Geometry object.
  9912. */
  9913. readonly geometry: Nullable<Geometry>;
  9914. /**
  9915. * Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
  9916. */
  9917. getTotalVertices(): number;
  9918. /**
  9919. * Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
  9920. * If `copywhenShared` is true (default false) and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
  9921. * You can force the copy with forceCopy === true
  9922. * Returns null if the mesh has no geometry or no vertex buffer.
  9923. * Possible `kind` values :
  9924. * - BABYLON.VertexBuffer.PositionKind
  9925. * - BABYLON.VertexBuffer.UVKind
  9926. * - BABYLON.VertexBuffer.UV2Kind
  9927. * - BABYLON.VertexBuffer.UV3Kind
  9928. * - BABYLON.VertexBuffer.UV4Kind
  9929. * - BABYLON.VertexBuffer.UV5Kind
  9930. * - BABYLON.VertexBuffer.UV6Kind
  9931. * - BABYLON.VertexBuffer.ColorKind
  9932. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9933. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9934. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9935. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9936. */
  9937. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray>;
  9938. /**
  9939. * Returns the mesh VertexBuffer object from the requested `kind` : positions, indices, normals, etc.
  9940. * Returns `null` if the mesh has no geometry.
  9941. * Possible `kind` values :
  9942. * - BABYLON.VertexBuffer.PositionKind
  9943. * - BABYLON.VertexBuffer.UVKind
  9944. * - BABYLON.VertexBuffer.UV2Kind
  9945. * - BABYLON.VertexBuffer.UV3Kind
  9946. * - BABYLON.VertexBuffer.UV4Kind
  9947. * - BABYLON.VertexBuffer.UV5Kind
  9948. * - BABYLON.VertexBuffer.UV6Kind
  9949. * - BABYLON.VertexBuffer.ColorKind
  9950. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9951. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9952. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9953. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9954. */
  9955. getVertexBuffer(kind: string): Nullable<VertexBuffer>;
  9956. /**
  9957. * Returns a boolean depending on the existence of the Vertex Data for the requested `kind`.
  9958. * Possible `kind` values :
  9959. * - BABYLON.VertexBuffer.PositionKind
  9960. * - BABYLON.VertexBuffer.UVKind
  9961. * - BABYLON.VertexBuffer.UV2Kind
  9962. * - BABYLON.VertexBuffer.UV3Kind
  9963. * - BABYLON.VertexBuffer.UV4Kind
  9964. * - BABYLON.VertexBuffer.UV5Kind
  9965. * - BABYLON.VertexBuffer.UV6Kind
  9966. * - BABYLON.VertexBuffer.ColorKind
  9967. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9968. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9969. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9970. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9971. */
  9972. isVerticesDataPresent(kind: string): boolean;
  9973. /**
  9974. * Returns a boolean defining if the vertex data for the requested `kind` is updatable.
  9975. * Possible `kind` values :
  9976. * - BABYLON.VertexBuffer.PositionKind
  9977. * - BABYLON.VertexBuffer.UVKind
  9978. * - BABYLON.VertexBuffer.UV2Kind
  9979. * - BABYLON.VertexBuffer.UV3Kind
  9980. * - BABYLON.VertexBuffer.UV4Kind
  9981. * - BABYLON.VertexBuffer.UV5Kind
  9982. * - BABYLON.VertexBuffer.UV6Kind
  9983. * - BABYLON.VertexBuffer.ColorKind
  9984. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9985. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9986. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9987. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9988. */
  9989. isVertexBufferUpdatable(kind: string): boolean;
  9990. /**
  9991. * Returns a string : the list of existing `kinds` of Vertex Data for this mesh.
  9992. * Possible `kind` values :
  9993. * - BABYLON.VertexBuffer.PositionKind
  9994. * - BABYLON.VertexBuffer.UVKind
  9995. * - BABYLON.VertexBuffer.UV2Kind
  9996. * - BABYLON.VertexBuffer.UV3Kind
  9997. * - BABYLON.VertexBuffer.UV4Kind
  9998. * - BABYLON.VertexBuffer.UV5Kind
  9999. * - BABYLON.VertexBuffer.UV6Kind
  10000. * - BABYLON.VertexBuffer.ColorKind
  10001. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10002. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10003. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10004. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10005. */
  10006. getVerticesDataKinds(): string[];
  10007. /**
  10008. * Returns a positive integer : the total number of indices in this mesh geometry.
  10009. * Returns zero if the mesh has no geometry.
  10010. */
  10011. getTotalIndices(): number;
  10012. /**
  10013. * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
  10014. * If the parameter `copyWhenShared` is true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
  10015. * Returns an empty array if the mesh has no geometry.
  10016. */
  10017. getIndices(copyWhenShared?: boolean): Nullable<IndicesArray>;
  10018. readonly isBlocked: boolean;
  10019. /**
  10020. * Boolean : true once the mesh is ready after all the delayed process (loading, etc) are complete.
  10021. */
  10022. isReady(): boolean;
  10023. /**
  10024. * Boolean : true if the normals aren't to be recomputed on next mesh `positions` array update.
  10025. * This property is pertinent only for updatable parametric shapes.
  10026. */
  10027. readonly areNormalsFrozen: boolean;
  10028. /**
  10029. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  10030. * It has no effect at all on other shapes.
  10031. * It prevents the mesh normals from being recomputed on next `positions` array update.
  10032. * Returns the Mesh.
  10033. */
  10034. freezeNormals(): Mesh;
  10035. /**
  10036. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  10037. * It has no effect at all on other shapes.
  10038. * It reactivates the mesh normals computation if it was previously frozen.
  10039. * Returns the Mesh.
  10040. */
  10041. unfreezeNormals(): Mesh;
  10042. /**
  10043. * Overrides instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
  10044. */
  10045. overridenInstanceCount: number;
  10046. /**
  10047. * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
  10048. * This means the mesh underlying bounding box and sphere are recomputed.
  10049. * Returns the Mesh.
  10050. */
  10051. refreshBoundingInfo(): Mesh;
  10052. subdivide(count: number): void;
  10053. /**
  10054. * Sets the vertex data of the mesh geometry for the requested `kind`.
  10055. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  10056. * The `data` are either a numeric array either a Float32Array.
  10057. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  10058. * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).
  10059. * Note that a new underlying VertexBuffer object is created each call.
  10060. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  10061. *
  10062. * Possible `kind` values :
  10063. * - BABYLON.VertexBuffer.PositionKind
  10064. * - BABYLON.VertexBuffer.UVKind
  10065. * - BABYLON.VertexBuffer.UV2Kind
  10066. * - BABYLON.VertexBuffer.UV3Kind
  10067. * - BABYLON.VertexBuffer.UV4Kind
  10068. * - BABYLON.VertexBuffer.UV5Kind
  10069. * - BABYLON.VertexBuffer.UV6Kind
  10070. * - BABYLON.VertexBuffer.ColorKind
  10071. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10072. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10073. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10074. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10075. *
  10076. * Returns the Mesh.
  10077. */
  10078. setVerticesData(kind: string, data: FloatArray, updatable?: boolean, stride?: number): Mesh;
  10079. markVerticesDataAsUpdatable(kind: string, updatable?: boolean): void;
  10080. /**
  10081. * Sets the mesh VertexBuffer.
  10082. * Returns the Mesh.
  10083. */
  10084. setVerticesBuffer(buffer: VertexBuffer): Mesh;
  10085. /**
  10086. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  10087. * If the mesh has no geometry, it is simply returned as it is.
  10088. * The `data` are either a numeric array either a Float32Array.
  10089. * No new underlying VertexBuffer object is created.
  10090. * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  10091. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  10092. *
  10093. * Possible `kind` values :
  10094. * - BABYLON.VertexBuffer.PositionKind
  10095. * - BABYLON.VertexBuffer.UVKind
  10096. * - BABYLON.VertexBuffer.UV2Kind
  10097. * - BABYLON.VertexBuffer.UV3Kind
  10098. * - BABYLON.VertexBuffer.UV4Kind
  10099. * - BABYLON.VertexBuffer.UV5Kind
  10100. * - BABYLON.VertexBuffer.UV6Kind
  10101. * - BABYLON.VertexBuffer.ColorKind
  10102. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10103. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10104. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10105. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10106. *
  10107. * Returns the Mesh.
  10108. */
  10109. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): Mesh;
  10110. /**
  10111. * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.
  10112. * tuto : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions
  10113. * The parameter `positionFunction` is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything.
  10114. * The parameter `computeNormals` is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update.
  10115. * Returns the Mesh.
  10116. */
  10117. updateMeshPositions(positionFunction: (data: FloatArray) => void, computeNormals?: boolean): Mesh;
  10118. /**
  10119. * Creates a un-shared specific occurence of the geometry for the mesh.
  10120. * Returns the Mesh.
  10121. */
  10122. makeGeometryUnique(): Mesh;
  10123. /**
  10124. * Sets the mesh indices.
  10125. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  10126. * Type is Uint16Array by default unless the mesh has more than 65536 vertices.
  10127. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  10128. * This method creates a new index buffer each call.
  10129. * Returns the Mesh.
  10130. */
  10131. setIndices(indices: IndicesArray, totalVertices?: Nullable<number>, updatable?: boolean): Mesh;
  10132. /**
  10133. * Update the current index buffer
  10134. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array)
  10135. * Returns the Mesh.
  10136. */
  10137. updateIndices(indices: IndicesArray, offset?: number): Mesh;
  10138. /**
  10139. * Invert the geometry to move from a right handed system to a left handed one.
  10140. * Returns the Mesh.
  10141. */
  10142. toLeftHanded(): Mesh;
  10143. /**
  10144. * Registers for this mesh a javascript function called just before the rendering process.
  10145. * This function is passed the current mesh.
  10146. * Return the Mesh.
  10147. */
  10148. registerBeforeRender(func: (mesh: AbstractMesh) => void): Mesh;
  10149. /**
  10150. * Disposes a previously registered javascript function called before the rendering.
  10151. * This function is passed the current mesh.
  10152. * Returns the Mesh.
  10153. */
  10154. unregisterBeforeRender(func: (mesh: AbstractMesh) => void): Mesh;
  10155. /**
  10156. * Registers for this mesh a javascript function called just after the rendering is complete.
  10157. * This function is passed the current mesh.
  10158. * Returns the Mesh.
  10159. */
  10160. registerAfterRender(func: (mesh: AbstractMesh) => void): Mesh;
  10161. /**
  10162. * Disposes a previously registered javascript function called after the rendering.
  10163. * This function is passed the current mesh.
  10164. * Return the Mesh.
  10165. */
  10166. unregisterAfterRender(func: (mesh: AbstractMesh) => void): Mesh;
  10167. /**
  10168. * Triggers the draw call for the mesh.
  10169. * Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager.
  10170. * Returns the Mesh.
  10171. */
  10172. render(subMesh: SubMesh, enableAlphaMode: boolean): Mesh;
  10173. /**
  10174. * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
  10175. */
  10176. getEmittedParticleSystems(): IParticleSystem[];
  10177. /**
  10178. * Returns an array populated with ParticleSystem objects whose the mesh or its children are the emitter.
  10179. */
  10180. getHierarchyEmittedParticleSystems(): IParticleSystem[];
  10181. /**
  10182. * Boolean, true is the mesh in the frustum defined by the Plane objects from the `frustumPlanes` array parameter.
  10183. */
  10184. isInFrustum(frustumPlanes: Plane[]): boolean;
  10185. /**
  10186. * Sets the mesh material by the material or multiMaterial `id` property.
  10187. * The material `id` is a string identifying the material or the multiMaterial.
  10188. * This method returns the Mesh.
  10189. */
  10190. setMaterialByID(id: string): Mesh;
  10191. /**
  10192. * Returns as a new array populated with the mesh material and/or skeleton, if any.
  10193. */
  10194. getAnimatables(): IAnimatable[];
  10195. /**
  10196. * Modifies the mesh geometry according to the passed transformation matrix.
  10197. * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.
  10198. * The mesh normals are modified accordingly the same transformation.
  10199. * tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  10200. * Note that, under the hood, this method sets a new VertexBuffer each call.
  10201. * Returns the Mesh.
  10202. */
  10203. bakeTransformIntoVertices(transform: Matrix): Mesh;
  10204. /**
  10205. * Modifies the mesh geometry according to its own current World Matrix.
  10206. * The mesh World Matrix is then reset.
  10207. * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.
  10208. * tuto : tuto : http://doc.babylonjs.com/resources/baking_transformations
  10209. * Note that, under the hood, this method sets a new VertexBuffer each call.
  10210. * Returns the Mesh.
  10211. */
  10212. bakeCurrentTransformIntoVertices(): Mesh;
  10213. readonly _positions: Nullable<Vector3[]>;
  10214. /**
  10215. * Returns a new Mesh object generated from the current mesh properties.
  10216. * This method must not get confused with createInstance().
  10217. * The parameter `name` is a string, the name given to the new mesh.
  10218. * The optional parameter `newParent` can be any Node object (default `null`).
  10219. * The optional parameter `doNotCloneChildren` (default `false`) allows/denies the recursive cloning of the original mesh children if any.
  10220. * The parameter `clonePhysicsImpostor` (default `true`) allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any.
  10221. */
  10222. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): Mesh;
  10223. /**
  10224. * Disposes the Mesh.
  10225. * By default, all the mesh children are also disposed unless the parameter `doNotRecurse` is set to `true`.
  10226. * Returns nothing.
  10227. */
  10228. dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void;
  10229. /**
  10230. * Modifies the mesh geometry according to a displacement map.
  10231. * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.
  10232. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  10233. * This method returns nothing.
  10234. * The parameter `url` is a string, the URL from the image file is to be downloaded.
  10235. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  10236. * The parameter `onSuccess` is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.
  10237. * The parameter `uvOffset` is an optional vector2 used to offset UV.
  10238. * The parameter `uvScale` is an optional vector2 used to scale UV.
  10239. *
  10240. * Returns the Mesh.
  10241. */
  10242. applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void, uvOffset?: Vector2, uvScale?: Vector2): Mesh;
  10243. /**
  10244. * Modifies the mesh geometry according to a displacementMap buffer.
  10245. * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.
  10246. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  10247. * This method returns nothing.
  10248. * The parameter `buffer` is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.
  10249. * The parameters `heightMapWidth` and `heightMapHeight` are positive integers to set the width and height of the buffer image.
  10250. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  10251. * The parameter `uvOffset` is an optional vector2 used to offset UV.
  10252. * The parameter `uvScale` is an optional vector2 used to scale UV.
  10253. *
  10254. * Returns the Mesh.
  10255. */
  10256. applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number, uvOffset?: Vector2, uvScale?: Vector2): Mesh;
  10257. /**
  10258. * Modify the mesh to get a flat shading rendering.
  10259. * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.
  10260. * This method returns the Mesh.
  10261. * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
  10262. */
  10263. convertToFlatShadedMesh(): Mesh;
  10264. /**
  10265. * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.
  10266. * In other words, more vertices, no more indices and a single bigger VBO.
  10267. * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
  10268. * Returns the Mesh.
  10269. */
  10270. convertToUnIndexedMesh(): Mesh;
  10271. /**
  10272. * Inverses facet orientations and inverts also the normals with `flipNormals` (default `false`) if true.
  10273. * This method returns the Mesh.
  10274. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  10275. */
  10276. flipFaces(flipNormals?: boolean): Mesh;
  10277. /**
  10278. * Creates a new InstancedMesh object from the mesh model.
  10279. * An instance shares the same properties and the same material than its model.
  10280. * Only these properties of each instance can then be set individually :
  10281. * - position
  10282. * - rotation
  10283. * - rotationQuaternion
  10284. * - setPivotMatrix
  10285. * - scaling
  10286. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_Instances
  10287. * Warning : this method is not supported for Line mesh and LineSystem
  10288. */
  10289. createInstance(name: string): InstancedMesh;
  10290. /**
  10291. * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.
  10292. * After this call, all the mesh instances have the same submeshes than the current mesh.
  10293. * This method returns the Mesh.
  10294. */
  10295. synchronizeInstances(): Mesh;
  10296. /**
  10297. * Simplify the mesh according to the given array of settings.
  10298. * Function will return immediately and will simplify async. It returns the Mesh.
  10299. * @param settings a collection of simplification settings.
  10300. * @param parallelProcessing should all levels calculate parallel or one after the other.
  10301. * @param type the type of simplification to run.
  10302. * @param successCallback optional success callback to be called after the simplification finished processing all settings.
  10303. */
  10304. simplify(settings: Array<ISimplificationSettings>, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): Mesh;
  10305. /**
  10306. * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
  10307. * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
  10308. * This should be used together with the simplification to avoid disappearing triangles.
  10309. * Returns the Mesh.
  10310. * @param successCallback an optional success callback to be called after the optimization finished.
  10311. */
  10312. optimizeIndices(successCallback?: (mesh?: Mesh) => void): Mesh;
  10313. serialize(serializationObject: any): void;
  10314. /**
  10315. * Returns a new Mesh object parsed from the source provided.
  10316. * The parameter `parsedMesh` is the source.
  10317. * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
  10318. */
  10319. static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh;
  10320. /**
  10321. * Creates a ribbon mesh.
  10322. * Please consider using the same method from the MeshBuilder class instead.
  10323. * The ribbon is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  10324. *
  10325. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  10326. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  10327. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  10328. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  10329. * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path.
  10330. * It's the offset to join together the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
  10331. * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
  10332. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10333. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10334. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10335. */
  10336. static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean | undefined, closePath: boolean, offset: number, scene?: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  10337. /**
  10338. * Creates a plane polygonal mesh. By default, this is a disc.
  10339. * Please consider using the same method from the MeshBuilder class instead.
  10340. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  10341. * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc.
  10342. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10343. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10344. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10345. */
  10346. static CreateDisc(name: string, radius: number, tessellation: number, scene?: Nullable<Scene>, updatable?: boolean, sideOrientation?: number): Mesh;
  10347. /**
  10348. * Creates a box mesh.
  10349. * Please consider using the same method from the MeshBuilder class instead.
  10350. * The parameter `size` sets the size (float) of each box side (default 1).
  10351. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10352. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10353. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10354. */
  10355. static CreateBox(name: string, size: number, scene?: Nullable<Scene>, updatable?: boolean, sideOrientation?: number): Mesh;
  10356. /**
  10357. * Creates a sphere mesh.
  10358. * Please consider using the same method from the MeshBuilder class instead.
  10359. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  10360. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  10361. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10362. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10363. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10364. */
  10365. static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  10366. /**
  10367. * Creates a cylinder or a cone mesh.
  10368. * Please consider using the same method from the MeshBuilder class instead.
  10369. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  10370. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  10371. * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter "diameterBottom" can't be zero.
  10372. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  10373. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  10374. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10375. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10376. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10377. */
  10378. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene?: Scene, updatable?: any, sideOrientation?: number): Mesh;
  10379. /**
  10380. * Creates a torus mesh.
  10381. * Please consider using the same method from the MeshBuilder class instead.
  10382. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  10383. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  10384. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  10385. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10386. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10387. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10388. */
  10389. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  10390. /**
  10391. * Creates a torus knot mesh.
  10392. * Please consider using the same method from the MeshBuilder class instead.
  10393. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  10394. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  10395. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  10396. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  10397. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10398. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10399. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10400. */
  10401. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  10402. /**
  10403. * Creates a line mesh.
  10404. * Please consider using the same method from the MeshBuilder class instead.
  10405. * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  10406. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  10407. * The parameter `points` is an array successive Vector3.
  10408. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  10409. * When updating an instance, remember that only point positions can change, not the number of points.
  10410. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10411. */
  10412. static CreateLines(name: string, points: Vector3[], scene?: Nullable<Scene>, updatable?: boolean, instance?: Nullable<LinesMesh>): LinesMesh;
  10413. /**
  10414. * Creates a dashed line mesh.
  10415. * Please consider using the same method from the MeshBuilder class instead.
  10416. * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  10417. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  10418. * The parameter `points` is an array successive Vector3.
  10419. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  10420. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  10421. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  10422. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  10423. * When updating an instance, remember that only point positions can change, not the number of points.
  10424. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10425. */
  10426. static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene?: Nullable<Scene>, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  10427. /**
  10428. * Creates a polygon mesh.
  10429. * Please consider using the same method from the MeshBuilder class instead.
  10430. * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.
  10431. * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.
  10432. * You can set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10433. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10434. * Remember you can only change the shape positions, not their number when updating a polygon.
  10435. */
  10436. static CreatePolygon(name: string, shape: Vector3[], scene: Scene, holes?: Vector3[][], updatable?: boolean, sideOrientation?: number): Mesh;
  10437. /**
  10438. * Creates an extruded polygon mesh, with depth in the Y direction.
  10439. * Please consider using the same method from the MeshBuilder class instead.
  10440. */
  10441. static ExtrudePolygon(name: string, shape: Vector3[], depth: number, scene: Scene, holes?: Vector3[][], updatable?: boolean, sideOrientation?: number): Mesh;
  10442. /**
  10443. * Creates an extruded shape mesh.
  10444. * The extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  10445. * Please consider using the same method from the MeshBuilder class instead.
  10446. *
  10447. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  10448. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  10449. * extruded along the Z axis.
  10450. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  10451. * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.
  10452. * The parameter `scale` (float, default 1) is the value to scale the shape.
  10453. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  10454. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  10455. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  10456. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10457. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10458. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10459. */
  10460. static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene?: Nullable<Scene>, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  10461. /**
  10462. * Creates an custom extruded shape mesh.
  10463. * The custom extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  10464. * Please consider using the same method from the MeshBuilder class instead.
  10465. *
  10466. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  10467. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  10468. * extruded along the Z axis.
  10469. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  10470. * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  10471. * and the distance of this point from the begining of the path :
  10472. * ```javascript
  10473. * var rotationFunction = function(i, distance) {
  10474. * // do things
  10475. * return rotationValue; }
  10476. * ```
  10477. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  10478. * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  10479. * and the distance of this point from the begining of the path :
  10480. * ```javascript
  10481. * var scaleFunction = function(i, distance) {
  10482. * // do things
  10483. * return scaleValue;}
  10484. * ```
  10485. * It must returns a float value that will be the scale value applied to the shape on each path point.
  10486. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  10487. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  10488. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  10489. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  10490. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  10491. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10492. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10493. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10494. */
  10495. static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: Function, rotationFunction: Function, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  10496. /**
  10497. * Creates lathe mesh.
  10498. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  10499. * Please consider using the same method from the MeshBuilder class instead.
  10500. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be
  10501. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  10502. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  10503. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  10504. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10505. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10506. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10507. */
  10508. static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  10509. /**
  10510. * Creates a plane mesh.
  10511. * Please consider using the same method from the MeshBuilder class instead.
  10512. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  10513. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10514. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10515. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10516. */
  10517. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  10518. /**
  10519. * Creates a ground mesh.
  10520. * Please consider using the same method from the MeshBuilder class instead.
  10521. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  10522. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  10523. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10524. */
  10525. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh;
  10526. /**
  10527. * Creates a tiled ground mesh.
  10528. * Please consider using the same method from the MeshBuilder class instead.
  10529. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  10530. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  10531. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  10532. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  10533. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  10534. * numbers of subdivisions on the ground width and height of each tile.
  10535. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10536. */
  10537. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  10538. w: number;
  10539. h: number;
  10540. }, precision: {
  10541. w: number;
  10542. h: number;
  10543. }, scene: Scene, updatable?: boolean): Mesh;
  10544. /**
  10545. * Creates a ground mesh from a height map.
  10546. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  10547. * Please consider using the same method from the MeshBuilder class instead.
  10548. * The parameter `url` sets the URL of the height map image resource.
  10549. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  10550. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  10551. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  10552. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  10553. * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).
  10554. * This function is passed the newly built mesh :
  10555. * ```javascript
  10556. * function(mesh) { // do things
  10557. * return; }
  10558. * ```
  10559. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10560. */
  10561. static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void): GroundMesh;
  10562. /**
  10563. * Creates a tube mesh.
  10564. * The tube is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  10565. * Please consider using the same method from the MeshBuilder class instead.
  10566. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  10567. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  10568. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  10569. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  10570. * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path.
  10571. * It must return a radius value (positive float) :
  10572. * ```javascript
  10573. * var radiusFunction = function(i, distance) {
  10574. * // do things
  10575. * return radius; }
  10576. * ```
  10577. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  10578. * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
  10579. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10580. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10581. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10582. */
  10583. static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
  10584. (i: number, distance: number): number;
  10585. }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  10586. /**
  10587. * Creates a polyhedron mesh.
  10588. * Please consider using the same method from the MeshBuilder class instead.
  10589. * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial
  10590. * to choose the wanted type.
  10591. * The parameter `size` (positive float, default 1) sets the polygon size.
  10592. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  10593. * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`.
  10594. * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
  10595. * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`).
  10596. * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  10597. * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
  10598. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10599. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10600. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10601. */
  10602. static CreatePolyhedron(name: string, options: {
  10603. type?: number;
  10604. size?: number;
  10605. sizeX?: number;
  10606. sizeY?: number;
  10607. sizeZ?: number;
  10608. custom?: any;
  10609. faceUV?: Vector4[];
  10610. faceColors?: Color4[];
  10611. updatable?: boolean;
  10612. sideOrientation?: number;
  10613. }, scene: Scene): Mesh;
  10614. /**
  10615. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  10616. * Please consider using the same method from the MeshBuilder class instead.
  10617. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  10618. * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`).
  10619. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  10620. * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface.
  10621. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10622. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10623. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10624. */
  10625. static CreateIcoSphere(name: string, options: {
  10626. radius?: number;
  10627. flat?: boolean;
  10628. subdivisions?: number;
  10629. sideOrientation?: number;
  10630. updatable?: boolean;
  10631. }, scene: Scene): Mesh;
  10632. /**
  10633. * Creates a decal mesh.
  10634. * Please consider using the same method from the MeshBuilder class instead.
  10635. * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal.
  10636. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  10637. * The parameter `normal` (Vector3, default Vector3.Up) sets the normal of the mesh where the decal is applied onto in World coordinates.
  10638. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  10639. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  10640. */
  10641. static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;
  10642. /**
  10643. * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  10644. */
  10645. setPositionsForCPUSkinning(): Float32Array;
  10646. /**
  10647. * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  10648. */
  10649. setNormalsForCPUSkinning(): Float32Array;
  10650. /**
  10651. * Updates the vertex buffer by applying transformation from the bones.
  10652. * Returns the Mesh.
  10653. *
  10654. * @param {skeleton} skeleton to apply
  10655. */
  10656. applySkeleton(skeleton: Skeleton): Mesh;
  10657. /**
  10658. * Returns an object `{min:` Vector3`, max:` Vector3`}`
  10659. * This min and max Vector3 are the minimum and maximum vectors of each mesh bounding box from the passed array, in the World system
  10660. */
  10661. static MinMax(meshes: AbstractMesh[]): {
  10662. min: Vector3;
  10663. max: Vector3;
  10664. };
  10665. /**
  10666. * Returns a Vector3, the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array.
  10667. */
  10668. static Center(meshesOrMinMaxVector: {
  10669. min: Vector3;
  10670. max: Vector3;
  10671. } | AbstractMesh[]): Vector3;
  10672. /**
  10673. * Merge the array of meshes into a single mesh for performance reasons.
  10674. * @param {Array<Mesh>} meshes - The vertices source. They should all be of the same material. Entries can empty
  10675. * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
  10676. * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
  10677. * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
  10678. * @param {boolean} subdivideWithSubMeshes - When true (false default), subdivide mesh to his subMesh array with meshes source.
  10679. */
  10680. static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh, subdivideWithSubMeshes?: boolean): Nullable<Mesh>;
  10681. }
  10682. }
  10683. declare module BABYLON {
  10684. interface IGetSetVerticesData {
  10685. isVerticesDataPresent(kind: string): boolean;
  10686. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray>;
  10687. getIndices(copyWhenShared?: boolean): Nullable<IndicesArray>;
  10688. setVerticesData(kind: string, data: FloatArray, updatable: boolean): void;
  10689. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): void;
  10690. setIndices(indices: IndicesArray, totalVertices: Nullable<number>, updatable?: boolean): void;
  10691. }
  10692. class VertexData {
  10693. positions: Nullable<FloatArray>;
  10694. normals: Nullable<FloatArray>;
  10695. tangents: Nullable<FloatArray>;
  10696. uvs: Nullable<FloatArray>;
  10697. uvs2: Nullable<FloatArray>;
  10698. uvs3: Nullable<FloatArray>;
  10699. uvs4: Nullable<FloatArray>;
  10700. uvs5: Nullable<FloatArray>;
  10701. uvs6: Nullable<FloatArray>;
  10702. colors: Nullable<FloatArray>;
  10703. matricesIndices: Nullable<FloatArray>;
  10704. matricesWeights: Nullable<FloatArray>;
  10705. matricesIndicesExtra: Nullable<FloatArray>;
  10706. matricesWeightsExtra: Nullable<FloatArray>;
  10707. indices: Nullable<IndicesArray>;
  10708. set(data: FloatArray, kind: string): void;
  10709. /**
  10710. * Associates the vertexData to the passed Mesh.
  10711. * Sets it as updatable or not (default `false`).
  10712. * Returns the VertexData.
  10713. */
  10714. applyToMesh(mesh: Mesh, updatable?: boolean): VertexData;
  10715. /**
  10716. * Associates the vertexData to the passed Geometry.
  10717. * Sets it as updatable or not (default `false`).
  10718. * Returns the VertexData.
  10719. */
  10720. applyToGeometry(geometry: Geometry, updatable?: boolean): VertexData;
  10721. /**
  10722. * Updates the associated mesh.
  10723. * Returns the VertexData.
  10724. */
  10725. updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): VertexData;
  10726. /**
  10727. * Updates the associated geometry.
  10728. * Returns the VertexData.
  10729. */
  10730. updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): VertexData;
  10731. /**
  10732. * Transforms each position and each normal of the vertexData according to the passed Matrix.
  10733. * Returns the VertexData.
  10734. */
  10735. transform(matrix: Matrix): VertexData;
  10736. /**
  10737. * Merges the passed VertexData into the current one.
  10738. * Returns the modified VertexData.
  10739. */
  10740. merge(other: VertexData, options?: {
  10741. tangentLength?: number;
  10742. }): VertexData;
  10743. /**
  10744. * Serializes the VertexData.
  10745. * Returns a serialized object.
  10746. */
  10747. serialize(): any;
  10748. /**
  10749. * Returns the object VertexData associated to the passed mesh.
  10750. */
  10751. static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean, forceCopy?: boolean): VertexData;
  10752. /**
  10753. * Returns the object VertexData associated to the passed geometry.
  10754. */
  10755. static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean, forceCopy?: boolean): VertexData;
  10756. /**
  10757. * Creates the vertexData of the Ribbon.
  10758. */
  10759. static CreateRibbon(options: {
  10760. pathArray: Vector3[][];
  10761. closeArray?: boolean;
  10762. closePath?: boolean;
  10763. offset?: number;
  10764. sideOrientation?: number;
  10765. frontUVs?: Vector4;
  10766. backUVs?: Vector4;
  10767. invertUV?: boolean;
  10768. uvs?: Vector2[];
  10769. colors?: Color4[];
  10770. }): VertexData;
  10771. /**
  10772. * Creates the VertexData of the Box.
  10773. */
  10774. static CreateBox(options: {
  10775. size?: number;
  10776. width?: number;
  10777. height?: number;
  10778. depth?: number;
  10779. faceUV?: Vector4[];
  10780. faceColors?: Color4[];
  10781. sideOrientation?: number;
  10782. frontUVs?: Vector4;
  10783. backUVs?: Vector4;
  10784. }): VertexData;
  10785. /**
  10786. * Creates the VertexData of the Sphere.
  10787. */
  10788. static CreateSphere(options: {
  10789. segments?: number;
  10790. diameter?: number;
  10791. diameterX?: number;
  10792. diameterY?: number;
  10793. diameterZ?: number;
  10794. arc?: number;
  10795. slice?: number;
  10796. sideOrientation?: number;
  10797. frontUVs?: Vector4;
  10798. backUVs?: Vector4;
  10799. }): VertexData;
  10800. /**
  10801. * Creates the VertexData of the Cylinder or Cone.
  10802. */
  10803. static CreateCylinder(options: {
  10804. height?: number;
  10805. diameterTop?: number;
  10806. diameterBottom?: number;
  10807. diameter?: number;
  10808. tessellation?: number;
  10809. subdivisions?: number;
  10810. arc?: number;
  10811. faceColors?: Color4[];
  10812. faceUV?: Vector4[];
  10813. hasRings?: boolean;
  10814. enclose?: boolean;
  10815. sideOrientation?: number;
  10816. frontUVs?: Vector4;
  10817. backUVs?: Vector4;
  10818. }): VertexData;
  10819. /**
  10820. * Creates the VertexData of the Torus.
  10821. */
  10822. static CreateTorus(options: {
  10823. diameter?: number;
  10824. thickness?: number;
  10825. tessellation?: number;
  10826. sideOrientation?: number;
  10827. frontUVs?: Vector4;
  10828. backUVs?: Vector4;
  10829. }): VertexData;
  10830. /**
  10831. * Creates the VertexData of the LineSystem.
  10832. */
  10833. static CreateLineSystem(options: {
  10834. lines: Vector3[][];
  10835. colors?: Nullable<Color4[][]>;
  10836. }): VertexData;
  10837. /**
  10838. * Create the VertexData of the DashedLines.
  10839. */
  10840. static CreateDashedLines(options: {
  10841. points: Vector3[];
  10842. dashSize?: number;
  10843. gapSize?: number;
  10844. dashNb?: number;
  10845. }): VertexData;
  10846. /**
  10847. * Creates the VertexData of the Ground.
  10848. */
  10849. static CreateGround(options: {
  10850. width?: number;
  10851. height?: number;
  10852. subdivisions?: number;
  10853. subdivisionsX?: number;
  10854. subdivisionsY?: number;
  10855. }): VertexData;
  10856. /**
  10857. * Creates the VertexData of the TiledGround.
  10858. */
  10859. static CreateTiledGround(options: {
  10860. xmin: number;
  10861. zmin: number;
  10862. xmax: number;
  10863. zmax: number;
  10864. subdivisions?: {
  10865. w: number;
  10866. h: number;
  10867. };
  10868. precision?: {
  10869. w: number;
  10870. h: number;
  10871. };
  10872. }): VertexData;
  10873. /**
  10874. * Creates the VertexData of the Ground designed from a heightmap.
  10875. */
  10876. static CreateGroundFromHeightMap(options: {
  10877. width: number;
  10878. height: number;
  10879. subdivisions: number;
  10880. minHeight: number;
  10881. maxHeight: number;
  10882. colorFilter: Color3;
  10883. buffer: Uint8Array;
  10884. bufferWidth: number;
  10885. bufferHeight: number;
  10886. }): VertexData;
  10887. /**
  10888. * Creates the VertexData of the Plane.
  10889. */
  10890. static CreatePlane(options: {
  10891. size?: number;
  10892. width?: number;
  10893. height?: number;
  10894. sideOrientation?: number;
  10895. frontUVs?: Vector4;
  10896. backUVs?: Vector4;
  10897. }): VertexData;
  10898. /**
  10899. * Creates the VertexData of the Disc or regular Polygon.
  10900. */
  10901. static CreateDisc(options: {
  10902. radius?: number;
  10903. tessellation?: number;
  10904. arc?: number;
  10905. sideOrientation?: number;
  10906. frontUVs?: Vector4;
  10907. backUVs?: Vector4;
  10908. }): VertexData;
  10909. /**
  10910. * Re-creates the VertexData of the Polygon for sideOrientation.
  10911. */
  10912. static CreatePolygon(polygon: Mesh, sideOrientation: number, fUV?: Vector4[], fColors?: Color4[], frontUVs?: Vector4, backUVs?: Vector4): VertexData;
  10913. /**
  10914. * Creates the VertexData of the IcoSphere.
  10915. */
  10916. static CreateIcoSphere(options: {
  10917. radius?: number;
  10918. radiusX?: number;
  10919. radiusY?: number;
  10920. radiusZ?: number;
  10921. flat?: boolean;
  10922. subdivisions?: number;
  10923. sideOrientation?: number;
  10924. frontUVs?: Vector4;
  10925. backUVs?: Vector4;
  10926. }): VertexData;
  10927. /**
  10928. * Creates the VertexData of the Polyhedron.
  10929. */
  10930. static CreatePolyhedron(options: {
  10931. type?: number;
  10932. size?: number;
  10933. sizeX?: number;
  10934. sizeY?: number;
  10935. sizeZ?: number;
  10936. custom?: any;
  10937. faceUV?: Vector4[];
  10938. faceColors?: Color4[];
  10939. flat?: boolean;
  10940. sideOrientation?: number;
  10941. frontUVs?: Vector4;
  10942. backUVs?: Vector4;
  10943. }): VertexData;
  10944. /**
  10945. * Creates the VertexData of the Torus Knot.
  10946. */
  10947. static CreateTorusKnot(options: {
  10948. radius?: number;
  10949. tube?: number;
  10950. radialSegments?: number;
  10951. tubularSegments?: number;
  10952. p?: number;
  10953. q?: number;
  10954. sideOrientation?: number;
  10955. frontUVs?: Vector4;
  10956. backUVs?: Vector4;
  10957. }): VertexData;
  10958. /**
  10959. * @param {any} - positions (number[] or Float32Array)
  10960. * @param {any} - indices (number[] or Uint16Array)
  10961. * @param {any} - normals (number[] or Float32Array)
  10962. * options (optional) :
  10963. * facetPositions : optional array of facet positions (vector3)
  10964. * facetNormals : optional array of facet normals (vector3)
  10965. * facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation
  10966. * subDiv : optional partitioning data about subdivsions on each axis (int), required for facetPartitioning computation
  10967. * ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation
  10968. * bbSize : optional bounding box size data, required for facetPartitioning computation
  10969. * bInfo : optional bounding info, required for facetPartitioning computation
  10970. * useRightHandedSystem: optional boolean to for right handed system computation
  10971. * depthSort : optional boolean to enable the facet depth sort computation
  10972. * distanceTo : optional Vector3 to compute the facet depth from this location
  10973. * depthSortedFacets : optional array of depthSortedFacets to store the facet distances from the reference location
  10974. */
  10975. static ComputeNormals(positions: any, indices: any, normals: any, options?: {
  10976. facetNormals?: any;
  10977. facetPositions?: any;
  10978. facetPartitioning?: any;
  10979. ratio?: number;
  10980. bInfo?: any;
  10981. bbSize?: Vector3;
  10982. subDiv?: any;
  10983. useRightHandedSystem?: boolean;
  10984. depthSort?: boolean;
  10985. distanceTo?: Vector3;
  10986. depthSortedFacets?: any;
  10987. }): void;
  10988. /**
  10989. * Creates a new VertexData from the imported parameters.
  10990. */
  10991. static ImportVertexData(parsedVertexData: any, geometry: Geometry): void;
  10992. }
  10993. }
  10994. declare module BABYLON {
  10995. class MeshBuilder {
  10996. /**
  10997. * Creates a box mesh.
  10998. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#box
  10999. * The parameter `size` sets the size (float) of each box side (default 1).
  11000. * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value than `size`).
  11001. * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements).
  11002. * Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  11003. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11004. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11005. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11006. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11007. */
  11008. static CreateBox(name: string, options: {
  11009. size?: number;
  11010. width?: number;
  11011. height?: number;
  11012. depth?: number;
  11013. faceUV?: Vector4[];
  11014. faceColors?: Color4[];
  11015. sideOrientation?: number;
  11016. frontUVs?: Vector4;
  11017. backUVs?: Vector4;
  11018. updatable?: boolean;
  11019. }, scene?: Nullable<Scene>): Mesh;
  11020. /**
  11021. * Creates a sphere mesh.
  11022. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#sphere
  11023. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  11024. * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value than `diameter`).
  11025. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  11026. * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio
  11027. * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude).
  11028. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11029. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11030. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11031. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11032. */
  11033. static CreateSphere(name: string, options: {
  11034. segments?: number;
  11035. diameter?: number;
  11036. diameterX?: number;
  11037. diameterY?: number;
  11038. diameterZ?: number;
  11039. arc?: number;
  11040. slice?: number;
  11041. sideOrientation?: number;
  11042. frontUVs?: Vector4;
  11043. backUVs?: Vector4;
  11044. updatable?: boolean;
  11045. }, scene: any): Mesh;
  11046. /**
  11047. * Creates a plane polygonal mesh. By default, this is a disc.
  11048. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#disc
  11049. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  11050. * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc.
  11051. * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio
  11052. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11053. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11054. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11055. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11056. */
  11057. static CreateDisc(name: string, options: {
  11058. radius?: number;
  11059. tessellation?: number;
  11060. arc?: number;
  11061. updatable?: boolean;
  11062. sideOrientation?: number;
  11063. frontUVs?: Vector4;
  11064. backUVs?: Vector4;
  11065. }, scene?: Nullable<Scene>): Mesh;
  11066. /**
  11067. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  11068. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#icosphere
  11069. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  11070. * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`).
  11071. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  11072. * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface.
  11073. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11074. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11075. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11076. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11077. */
  11078. static CreateIcoSphere(name: string, options: {
  11079. radius?: number;
  11080. radiusX?: number;
  11081. radiusY?: number;
  11082. radiusZ?: number;
  11083. flat?: boolean;
  11084. subdivisions?: number;
  11085. sideOrientation?: number;
  11086. frontUVs?: Vector4;
  11087. backUVs?: Vector4;
  11088. updatable?: boolean;
  11089. }, scene: Scene): Mesh;
  11090. /**
  11091. * Creates a ribbon mesh.
  11092. * The ribbon is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  11093. *
  11094. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  11095. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  11096. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  11097. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  11098. * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path.
  11099. * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
  11100. * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
  11101. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11102. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11103. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11104. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  11105. * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones.
  11106. * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values.
  11107. * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that
  11108. * if you set `closePath` to `true`, there's one extra vertex per path in the geometry.
  11109. * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time.
  11110. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11111. */
  11112. static CreateRibbon(name: string, options: {
  11113. pathArray: Vector3[][];
  11114. closeArray?: boolean;
  11115. closePath?: boolean;
  11116. offset?: number;
  11117. updatable?: boolean;
  11118. sideOrientation?: number;
  11119. frontUVs?: Vector4;
  11120. backUVs?: Vector4;
  11121. instance?: Mesh;
  11122. invertUV?: boolean;
  11123. uvs?: Vector2[];
  11124. colors?: Color4[];
  11125. }, scene?: Nullable<Scene>): Mesh;
  11126. /**
  11127. * Creates a cylinder or a cone mesh.
  11128. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#cylinder-or-cone
  11129. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  11130. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  11131. * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter "diameterBottom" can't be zero.
  11132. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  11133. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  11134. * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.
  11135. * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.
  11136. * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.
  11137. * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).
  11138. * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3
  11139. * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7
  11140. * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17
  11141. * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.
  11142. * If `enclose` is false, a ring surface is one element.
  11143. * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
  11144. * Example how to set colors and textures on a sliced cylinder : http://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379
  11145. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11146. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11147. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11148. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11149. */
  11150. static CreateCylinder(name: string, options: {
  11151. height?: number;
  11152. diameterTop?: number;
  11153. diameterBottom?: number;
  11154. diameter?: number;
  11155. tessellation?: number;
  11156. subdivisions?: number;
  11157. arc?: number;
  11158. faceColors?: Color4[];
  11159. faceUV?: Vector4[];
  11160. updatable?: boolean;
  11161. hasRings?: boolean;
  11162. enclose?: boolean;
  11163. sideOrientation?: number;
  11164. frontUVs?: Vector4;
  11165. backUVs?: Vector4;
  11166. }, scene: any): Mesh;
  11167. /**
  11168. * Creates a torus mesh.
  11169. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus
  11170. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  11171. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  11172. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  11173. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11174. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11175. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11176. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11177. */
  11178. static CreateTorus(name: string, options: {
  11179. diameter?: number;
  11180. thickness?: number;
  11181. tessellation?: number;
  11182. updatable?: boolean;
  11183. sideOrientation?: number;
  11184. frontUVs?: Vector4;
  11185. backUVs?: Vector4;
  11186. }, scene: any): Mesh;
  11187. /**
  11188. * Creates a torus knot mesh.
  11189. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus-knot
  11190. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  11191. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  11192. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  11193. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  11194. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11195. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11196. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11197. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11198. */
  11199. static CreateTorusKnot(name: string, options: {
  11200. radius?: number;
  11201. tube?: number;
  11202. radialSegments?: number;
  11203. tubularSegments?: number;
  11204. p?: number;
  11205. q?: number;
  11206. updatable?: boolean;
  11207. sideOrientation?: number;
  11208. frontUVs?: Vector4;
  11209. backUVs?: Vector4;
  11210. }, scene: any): Mesh;
  11211. /**
  11212. * Creates a line system mesh.
  11213. * A line system is a pool of many lines gathered in a single mesh.
  11214. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#linesystem
  11215. * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter.
  11216. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function.
  11217. * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
  11218. * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for
  11219. * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point.
  11220. * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need the alpha blending (faster).
  11221. * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  11222. * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
  11223. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11224. */
  11225. static CreateLineSystem(name: string, options: {
  11226. lines: Vector3[][];
  11227. updatable: boolean;
  11228. instance: Nullable<LinesMesh>;
  11229. colors?: Nullable<Color4[][]>;
  11230. useVertexAlpha?: boolean;
  11231. }, scene: Nullable<Scene>): LinesMesh;
  11232. /**
  11233. * Creates a line mesh.
  11234. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lines
  11235. * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  11236. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  11237. * The parameter `points` is an array successive Vector3.
  11238. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  11239. * The optional parameter `colors` is an array of successive Color4, one per line point.
  11240. * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need alpha blending (faster).
  11241. * When updating an instance, remember that only point positions can change, not the number of points.
  11242. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11243. */
  11244. static CreateLines(name: string, options: {
  11245. points: Vector3[];
  11246. updatable: boolean;
  11247. instance: Nullable<LinesMesh>;
  11248. colors?: Color4[];
  11249. useVertexAlpha?: boolean;
  11250. }, scene?: Nullable<Scene>): LinesMesh;
  11251. /**
  11252. * Creates a dashed line mesh.
  11253. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#dashed-lines
  11254. * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  11255. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  11256. * The parameter `points` is an array successive Vector3.
  11257. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  11258. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  11259. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  11260. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  11261. * When updating an instance, remember that only point positions can change, not the number of points.
  11262. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11263. */
  11264. static CreateDashedLines(name: string, options: {
  11265. points: Vector3[];
  11266. dashSize?: number;
  11267. gapSize?: number;
  11268. dashNb?: number;
  11269. updatable?: boolean;
  11270. instance?: LinesMesh;
  11271. }, scene?: Nullable<Scene>): LinesMesh;
  11272. /**
  11273. * Creates an extruded shape mesh.
  11274. * The extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  11275. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#extruded-shapes
  11276. *
  11277. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  11278. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  11279. * extruded along the Z axis.
  11280. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  11281. * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.
  11282. * The parameter `scale` (float, default 1) is the value to scale the shape.
  11283. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  11284. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  11285. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  11286. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11287. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11288. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11289. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  11290. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11291. */
  11292. static ExtrudeShape(name: string, options: {
  11293. shape: Vector3[];
  11294. path: Vector3[];
  11295. scale?: number;
  11296. rotation?: number;
  11297. cap?: number;
  11298. updatable?: boolean;
  11299. sideOrientation?: number;
  11300. frontUVs?: Vector4;
  11301. backUVs?: Vector4;
  11302. instance?: Mesh;
  11303. invertUV?: boolean;
  11304. }, scene?: Nullable<Scene>): Mesh;
  11305. /**
  11306. * Creates an custom extruded shape mesh.
  11307. * The custom extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  11308. * tuto :http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#custom-extruded-shapes
  11309. *
  11310. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  11311. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  11312. * extruded along the Z axis.
  11313. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  11314. * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  11315. * and the distance of this point from the begining of the path :
  11316. * ```javascript
  11317. * var rotationFunction = function(i, distance) {
  11318. * // do things
  11319. * return rotationValue; }
  11320. * ```
  11321. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  11322. * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  11323. * and the distance of this point from the begining of the path :
  11324. * ```javascript
  11325. * var scaleFunction = function(i, distance) {
  11326. * // do things
  11327. * return scaleValue;}
  11328. * ```
  11329. * It must returns a float value that will be the scale value applied to the shape on each path point.
  11330. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  11331. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  11332. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  11333. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  11334. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  11335. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11336. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11337. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11338. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  11339. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11340. */
  11341. static ExtrudeShapeCustom(name: string, options: {
  11342. shape: Vector3[];
  11343. path: Vector3[];
  11344. scaleFunction?: any;
  11345. rotationFunction?: any;
  11346. ribbonCloseArray?: boolean;
  11347. ribbonClosePath?: boolean;
  11348. cap?: number;
  11349. updatable?: boolean;
  11350. sideOrientation?: number;
  11351. frontUVs?: Vector4;
  11352. backUVs?: Vector4;
  11353. instance?: Mesh;
  11354. invertUV?: boolean;
  11355. }, scene: Scene): Mesh;
  11356. /**
  11357. * Creates lathe mesh.
  11358. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  11359. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lathe
  11360. *
  11361. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be
  11362. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  11363. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  11364. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  11365. * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape.
  11366. * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
  11367. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  11368. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11369. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11370. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11371. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  11372. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11373. */
  11374. static CreateLathe(name: string, options: {
  11375. shape: Vector3[];
  11376. radius?: number;
  11377. tessellation?: number;
  11378. arc?: number;
  11379. closed?: boolean;
  11380. updatable?: boolean;
  11381. sideOrientation?: number;
  11382. frontUVs?: Vector4;
  11383. backUVs?: Vector4;
  11384. cap?: number;
  11385. invertUV?: boolean;
  11386. }, scene: Scene): Mesh;
  11387. /**
  11388. * Creates a plane mesh.
  11389. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  11390. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  11391. * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value than `size`).
  11392. * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane.
  11393. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11394. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11395. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11396. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11397. */
  11398. static CreatePlane(name: string, options: {
  11399. size?: number;
  11400. width?: number;
  11401. height?: number;
  11402. sideOrientation?: number;
  11403. frontUVs?: Vector4;
  11404. backUVs?: Vector4;
  11405. updatable?: boolean;
  11406. sourcePlane?: Plane;
  11407. }, scene: Scene): Mesh;
  11408. /**
  11409. * Creates a ground mesh.
  11410. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  11411. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  11412. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  11413. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11414. */
  11415. static CreateGround(name: string, options: {
  11416. width?: number;
  11417. height?: number;
  11418. subdivisions?: number;
  11419. subdivisionsX?: number;
  11420. subdivisionsY?: number;
  11421. updatable?: boolean;
  11422. }, scene: any): Mesh;
  11423. /**
  11424. * Creates a tiled ground mesh.
  11425. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tiled-ground
  11426. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  11427. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  11428. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  11429. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  11430. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  11431. * numbers of subdivisions on the ground width and height of each tile.
  11432. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11433. */
  11434. static CreateTiledGround(name: string, options: {
  11435. xmin: number;
  11436. zmin: number;
  11437. xmax: number;
  11438. zmax: number;
  11439. subdivisions?: {
  11440. w: number;
  11441. h: number;
  11442. };
  11443. precision?: {
  11444. w: number;
  11445. h: number;
  11446. };
  11447. updatable?: boolean;
  11448. }, scene: Scene): Mesh;
  11449. /**
  11450. * Creates a ground mesh from a height map.
  11451. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  11452. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#ground-from-a-height-map
  11453. * The parameter `url` sets the URL of the height map image resource.
  11454. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  11455. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  11456. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  11457. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  11458. * The parameter `colorFilter` (optional Color3, default (0.3, 0.59, 0.11) ) is the filter to apply to the image pixel colors to compute the height.
  11459. * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).
  11460. * This function is passed the newly built mesh :
  11461. * ```javascript
  11462. * function(mesh) { // do things
  11463. * return; }
  11464. * ```
  11465. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11466. */
  11467. static CreateGroundFromHeightMap(name: string, url: string, options: {
  11468. width?: number;
  11469. height?: number;
  11470. subdivisions?: number;
  11471. minHeight?: number;
  11472. maxHeight?: number;
  11473. colorFilter?: Color3;
  11474. updatable?: boolean;
  11475. onReady?: (mesh: GroundMesh) => void;
  11476. }, scene: Scene): GroundMesh;
  11477. /**
  11478. * Creates a polygon mesh.
  11479. * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.
  11480. * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.
  11481. * You can set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11482. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11483. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11484. * Remember you can only change the shape positions, not their number when updating a polygon.
  11485. */
  11486. static CreatePolygon(name: string, options: {
  11487. shape: Vector3[];
  11488. holes?: Vector3[][];
  11489. depth?: number;
  11490. faceUV?: Vector4[];
  11491. faceColors?: Color4[];
  11492. updatable?: boolean;
  11493. sideOrientation?: number;
  11494. frontUVs?: Vector4;
  11495. backUVs?: Vector4;
  11496. }, scene: Scene): Mesh;
  11497. /**
  11498. * Creates an extruded polygon mesh, with depth in the Y direction.
  11499. * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements).
  11500. * Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  11501. */
  11502. static ExtrudePolygon(name: string, options: {
  11503. shape: Vector3[];
  11504. holes?: Vector3[][];
  11505. depth?: number;
  11506. faceUV?: Vector4[];
  11507. faceColors?: Color4[];
  11508. updatable?: boolean;
  11509. sideOrientation?: number;
  11510. frontUVs?: Vector4;
  11511. backUVs?: Vector4;
  11512. }, scene: Scene): Mesh;
  11513. /**
  11514. * Creates a tube mesh.
  11515. * The tube is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  11516. *
  11517. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tube
  11518. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  11519. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  11520. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  11521. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  11522. * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path.
  11523. * It must return a radius value (positive float) :
  11524. * ```javascript
  11525. * var radiusFunction = function(i, distance) {
  11526. * // do things
  11527. * return radius; }
  11528. * ```
  11529. * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc.
  11530. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  11531. * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
  11532. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11533. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11534. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11535. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  11536. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11537. */
  11538. static CreateTube(name: string, options: {
  11539. path: Vector3[];
  11540. radius?: number;
  11541. tessellation?: number;
  11542. radiusFunction?: {
  11543. (i: number, distance: number): number;
  11544. };
  11545. cap?: number;
  11546. arc?: number;
  11547. updatable?: boolean;
  11548. sideOrientation?: number;
  11549. frontUVs?: Vector4;
  11550. backUVs?: Vector4;
  11551. instance?: Mesh;
  11552. invertUV?: boolean;
  11553. }, scene: Scene): Mesh;
  11554. /**
  11555. * Creates a polyhedron mesh.
  11556. *
  11557. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#polyhedron
  11558. * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial
  11559. * to choose the wanted type.
  11560. * The parameter `size` (positive float, default 1) sets the polygon size.
  11561. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  11562. * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`.
  11563. * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
  11564. * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`).
  11565. * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  11566. * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
  11567. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11568. * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
  11569. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11570. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11571. */
  11572. static CreatePolyhedron(name: string, options: {
  11573. type?: number;
  11574. size?: number;
  11575. sizeX?: number;
  11576. sizeY?: number;
  11577. sizeZ?: number;
  11578. custom?: any;
  11579. faceUV?: Vector4[];
  11580. faceColors?: Color4[];
  11581. flat?: boolean;
  11582. updatable?: boolean;
  11583. sideOrientation?: number;
  11584. frontUVs?: Vector4;
  11585. backUVs?: Vector4;
  11586. }, scene: Scene): Mesh;
  11587. /**
  11588. * Creates a decal mesh.
  11589. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#decals
  11590. * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal.
  11591. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  11592. * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates.
  11593. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  11594. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  11595. */
  11596. static CreateDecal(name: string, sourceMesh: AbstractMesh, options: {
  11597. position?: Vector3;
  11598. normal?: Vector3;
  11599. size?: Vector3;
  11600. angle?: number;
  11601. }): Mesh;
  11602. }
  11603. }
  11604. declare module BABYLON.Internals {
  11605. class MeshLODLevel {
  11606. distance: number;
  11607. mesh: Mesh;
  11608. constructor(distance: number, mesh: Mesh);
  11609. }
  11610. }
  11611. declare module BABYLON {
  11612. /**
  11613. * A simplifier interface for future simplification implementations.
  11614. */
  11615. interface ISimplifier {
  11616. /**
  11617. * Simplification of a given mesh according to the given settings.
  11618. * Since this requires computation, it is assumed that the function runs async.
  11619. * @param settings The settings of the simplification, including quality and distance
  11620. * @param successCallback A callback that will be called after the mesh was simplified.
  11621. * @param errorCallback in case of an error, this callback will be called. optional.
  11622. */
  11623. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void;
  11624. }
  11625. /**
  11626. * Expected simplification settings.
  11627. * Quality should be between 0 and 1 (1 being 100%, 0 being 0%);
  11628. */
  11629. interface ISimplificationSettings {
  11630. quality: number;
  11631. distance: number;
  11632. optimizeMesh?: boolean;
  11633. }
  11634. class SimplificationSettings implements ISimplificationSettings {
  11635. quality: number;
  11636. distance: number;
  11637. optimizeMesh: boolean | undefined;
  11638. constructor(quality: number, distance: number, optimizeMesh?: boolean | undefined);
  11639. }
  11640. interface ISimplificationTask {
  11641. settings: Array<ISimplificationSettings>;
  11642. simplificationType: SimplificationType;
  11643. mesh: Mesh;
  11644. successCallback?: () => void;
  11645. parallelProcessing: boolean;
  11646. }
  11647. class SimplificationQueue {
  11648. running: boolean;
  11649. constructor();
  11650. addTask(task: ISimplificationTask): void;
  11651. executeNext(): void;
  11652. runSimplification(task: ISimplificationTask): void;
  11653. }
  11654. /**
  11655. * The implemented types of simplification.
  11656. * At the moment only Quadratic Error Decimation is implemented.
  11657. */
  11658. enum SimplificationType {
  11659. QUADRATIC = 0,
  11660. }
  11661. class DecimationTriangle {
  11662. vertices: Array<DecimationVertex>;
  11663. normal: Vector3;
  11664. error: Array<number>;
  11665. deleted: boolean;
  11666. isDirty: boolean;
  11667. borderFactor: number;
  11668. deletePending: boolean;
  11669. originalOffset: number;
  11670. constructor(vertices: Array<DecimationVertex>);
  11671. }
  11672. class DecimationVertex {
  11673. position: Vector3;
  11674. id: number;
  11675. q: QuadraticMatrix;
  11676. isBorder: boolean;
  11677. triangleStart: number;
  11678. triangleCount: number;
  11679. originalOffsets: Array<number>;
  11680. constructor(position: Vector3, id: number);
  11681. updatePosition(newPosition: Vector3): void;
  11682. }
  11683. class QuadraticMatrix {
  11684. data: Array<number>;
  11685. constructor(data?: Array<number>);
  11686. det(a11: number, a12: number, a13: number, a21: number, a22: number, a23: number, a31: number, a32: number, a33: number): number;
  11687. addInPlace(matrix: QuadraticMatrix): void;
  11688. addArrayInPlace(data: Array<number>): void;
  11689. add(matrix: QuadraticMatrix): QuadraticMatrix;
  11690. static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix;
  11691. static DataFromNumbers(a: number, b: number, c: number, d: number): number[];
  11692. }
  11693. class Reference {
  11694. vertexId: number;
  11695. triangleId: number;
  11696. constructor(vertexId: number, triangleId: number);
  11697. }
  11698. /**
  11699. * An implementation of the Quadratic Error simplification algorithm.
  11700. * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf
  11701. * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS
  11702. * @author RaananW
  11703. */
  11704. class QuadraticErrorSimplification implements ISimplifier {
  11705. syncIterations: number;
  11706. aggressiveness: number;
  11707. decimationIterations: number;
  11708. boundingBoxEpsilon: number;
  11709. constructor(_mesh: Mesh);
  11710. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void;
  11711. }
  11712. }
  11713. declare module BABYLON {
  11714. class Polygon {
  11715. static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[];
  11716. static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[];
  11717. static Parse(input: string): Vector2[];
  11718. static StartingAt(x: number, y: number): Path2;
  11719. }
  11720. class PolygonMeshBuilder {
  11721. constructor(name: string, contours: Path2, scene: Scene);
  11722. constructor(name: string, contours: Vector2[], scene: Scene);
  11723. addHole(hole: Vector2[]): PolygonMeshBuilder;
  11724. build(updatable?: boolean, depth?: number): Mesh;
  11725. }
  11726. }
  11727. declare module BABYLON {
  11728. class BaseSubMesh {
  11729. readonly effect: Nullable<Effect>;
  11730. setEffect(effect: Nullable<Effect>, defines?: Nullable<MaterialDefines>): void;
  11731. }
  11732. class SubMesh extends BaseSubMesh implements ICullable {
  11733. materialIndex: number;
  11734. verticesStart: number;
  11735. verticesCount: number;
  11736. indexStart: number;
  11737. indexCount: number;
  11738. linesIndexCount: number;
  11739. static AddToMesh(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean): SubMesh;
  11740. constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
  11741. readonly IsGlobal: boolean;
  11742. /**
  11743. * Returns the submesh BoudingInfo object.
  11744. */
  11745. getBoundingInfo(): BoundingInfo;
  11746. /**
  11747. * Sets the submesh BoundingInfo.
  11748. * Return the SubMesh.
  11749. */
  11750. setBoundingInfo(boundingInfo: BoundingInfo): SubMesh;
  11751. /**
  11752. * Returns the mesh of the current submesh.
  11753. */
  11754. getMesh(): AbstractMesh;
  11755. /**
  11756. * Returns the rendering mesh of the submesh.
  11757. */
  11758. getRenderingMesh(): Mesh;
  11759. /**
  11760. * Returns the submesh material.
  11761. */
  11762. getMaterial(): Nullable<Material>;
  11763. /**
  11764. * Sets a new updated BoundingInfo object to the submesh.
  11765. * Returns the SubMesh.
  11766. */
  11767. refreshBoundingInfo(): SubMesh;
  11768. /**
  11769. * Updates the submesh BoundingInfo.
  11770. * Returns the Submesh.
  11771. */
  11772. updateBoundingInfo(world: Matrix): SubMesh;
  11773. /**
  11774. * True is the submesh bounding box intersects the frustum defined by the passed array of planes.
  11775. * Boolean returned.
  11776. */
  11777. isInFrustum(frustumPlanes: Plane[]): boolean;
  11778. /**
  11779. * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes.
  11780. * Boolean returned.
  11781. */
  11782. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  11783. /**
  11784. * Renders the submesh.
  11785. * Returns it.
  11786. */
  11787. render(enableAlphaMode: boolean): SubMesh;
  11788. /**
  11789. * Returns a new Index Buffer.
  11790. * Type returned : WebGLBuffer.
  11791. */
  11792. getLinesIndexBuffer(indices: IndicesArray, engine: Engine): WebGLBuffer;
  11793. /**
  11794. * True is the passed Ray intersects the submesh bounding box.
  11795. * Boolean returned.
  11796. */
  11797. canIntersects(ray: Ray): boolean;
  11798. /**
  11799. * Returns an object IntersectionInfo.
  11800. */
  11801. intersects(ray: Ray, positions: Vector3[], indices: IndicesArray, fastCheck?: boolean): Nullable<IntersectionInfo>;
  11802. /**
  11803. * Creates a new Submesh from the passed Mesh.
  11804. */
  11805. clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
  11806. /**
  11807. * Disposes the Submesh.
  11808. * Returns nothing.
  11809. */
  11810. dispose(): void;
  11811. /**
  11812. * Creates a new Submesh from the passed parameters :
  11813. * - materialIndex (integer) : the index of the main mesh material.
  11814. * - startIndex (integer) : the index where to start the copy in the mesh indices array.
  11815. * - indexCount (integer) : the number of indices to copy then from the startIndex.
  11816. * - mesh (Mesh) : the main mesh to create the submesh from.
  11817. * - renderingMesh (optional Mesh) : rendering mesh.
  11818. */
  11819. static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
  11820. }
  11821. }
  11822. declare module BABYLON {
  11823. class TransformNode extends Node {
  11824. static BILLBOARDMODE_NONE: number;
  11825. static BILLBOARDMODE_X: number;
  11826. static BILLBOARDMODE_Y: number;
  11827. static BILLBOARDMODE_Z: number;
  11828. static BILLBOARDMODE_ALL: number;
  11829. billboardMode: number;
  11830. scalingDeterminant: number;
  11831. infiniteDistance: boolean;
  11832. position: Vector3;
  11833. /**
  11834. * An event triggered after the world matrix is updated
  11835. * @type {BABYLON.Observable}
  11836. */
  11837. onAfterWorldMatrixUpdateObservable: Observable<TransformNode>;
  11838. constructor(name: string, scene?: Nullable<Scene>, isPure?: boolean);
  11839. /**
  11840. * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z.
  11841. * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
  11842. * Default : (0.0, 0.0, 0.0)
  11843. */
  11844. rotation: Vector3;
  11845. /**
  11846. * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
  11847. * Default : (1.0, 1.0, 1.0)
  11848. */
  11849. /**
  11850. * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
  11851. * Default : (1.0, 1.0, 1.0)
  11852. */
  11853. scaling: Vector3;
  11854. /**
  11855. * Rotation Quaternion property : this a Quaternion object depicting the mesh rotation by using a unit quaternion.
  11856. * It's null by default.
  11857. * If set, only the rotationQuaternion is then used to compute the mesh rotation and its property `.rotation\ is then ignored and set to (0.0, 0.0, 0.0)
  11858. */
  11859. rotationQuaternion: Nullable<Quaternion>;
  11860. /**
  11861. * Returns the latest update of the World matrix
  11862. * Returns a Matrix.
  11863. */
  11864. getWorldMatrix(): Matrix;
  11865. /**
  11866. * Returns the latest update of the World matrix determinant.
  11867. */
  11868. /**
  11869. * Returns directly the latest state of the mesh World matrix.
  11870. * A Matrix is returned.
  11871. */
  11872. readonly worldMatrixFromCache: Matrix;
  11873. /**
  11874. * Copies the paramater passed Matrix into the mesh Pose matrix.
  11875. * Returns the AbstractMesh.
  11876. */
  11877. updatePoseMatrix(matrix: Matrix): TransformNode;
  11878. /**
  11879. * Returns the mesh Pose matrix.
  11880. * Returned object : Matrix
  11881. */
  11882. getPoseMatrix(): Matrix;
  11883. markAsDirty(property: string): TransformNode;
  11884. /**
  11885. * Returns the current mesh absolute position.
  11886. * Retuns a Vector3.
  11887. */
  11888. readonly absolutePosition: Vector3;
  11889. /**
  11890. * Sets a new pivot matrix to the mesh.
  11891. * Returns the AbstractMesh.
  11892. */
  11893. setPivotMatrix(matrix: Matrix, postMultiplyPivotMatrix?: boolean): TransformNode;
  11894. /**
  11895. * Returns the mesh pivot matrix.
  11896. * Default : Identity.
  11897. * A Matrix is returned.
  11898. */
  11899. getPivotMatrix(): Matrix;
  11900. /**
  11901. * Prevents the World matrix to be computed any longer.
  11902. * Returns the AbstractMesh.
  11903. */
  11904. freezeWorldMatrix(): TransformNode;
  11905. /**
  11906. * Allows back the World matrix computation.
  11907. * Returns the AbstractMesh.
  11908. */
  11909. unfreezeWorldMatrix(): this;
  11910. /**
  11911. * True if the World matrix has been frozen.
  11912. * Returns a boolean.
  11913. */
  11914. readonly isWorldMatrixFrozen: boolean;
  11915. /**
  11916. * Retuns the mesh absolute position in the World.
  11917. * Returns a Vector3.
  11918. */
  11919. getAbsolutePosition(): Vector3;
  11920. /**
  11921. * Sets the mesh absolute position in the World from a Vector3 or an Array(3).
  11922. * Returns the AbstractMesh.
  11923. */
  11924. setAbsolutePosition(absolutePosition: Vector3): TransformNode;
  11925. /**
  11926. * Sets the mesh position in its local space.
  11927. * Returns the AbstractMesh.
  11928. */
  11929. setPositionWithLocalVector(vector3: Vector3): TransformNode;
  11930. /**
  11931. * Returns the mesh position in the local space from the current World matrix values.
  11932. * Returns a new Vector3.
  11933. */
  11934. getPositionExpressedInLocalSpace(): Vector3;
  11935. /**
  11936. * Translates the mesh along the passed Vector3 in its local space.
  11937. * Returns the AbstractMesh.
  11938. */
  11939. locallyTranslate(vector3: Vector3): TransformNode;
  11940. /**
  11941. * Orients a mesh towards a target point. Mesh must be drawn facing user.
  11942. * @param targetPoint the position (must be in same space as current mesh) to look at
  11943. * @param yawCor optional yaw (y-axis) correction in radians
  11944. * @param pitchCor optional pitch (x-axis) correction in radians
  11945. * @param rollCor optional roll (z-axis) correction in radians
  11946. * @param space the choosen space of the target
  11947. * @returns the TransformNode.
  11948. */
  11949. lookAt(targetPoint: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number, space?: Space): TransformNode;
  11950. /**
  11951. * Returns a new Vector3 what is the localAxis, expressed in the mesh local space, rotated like the mesh.
  11952. * This Vector3 is expressed in the World space.
  11953. */
  11954. getDirection(localAxis: Vector3): Vector3;
  11955. /**
  11956. * Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh.
  11957. * localAxis is expressed in the mesh local space.
  11958. * result is computed in the Wordl space from the mesh World matrix.
  11959. * Returns the AbstractMesh.
  11960. */
  11961. getDirectionToRef(localAxis: Vector3, result: Vector3): TransformNode;
  11962. setPivotPoint(point: Vector3, space?: Space): TransformNode;
  11963. /**
  11964. * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.
  11965. */
  11966. getPivotPoint(): Vector3;
  11967. /**
  11968. * Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space.
  11969. * Returns the AbstractMesh.
  11970. */
  11971. getPivotPointToRef(result: Vector3): TransformNode;
  11972. /**
  11973. * Returns a new Vector3 set with the mesh pivot point World coordinates.
  11974. */
  11975. getAbsolutePivotPoint(): Vector3;
  11976. /**
  11977. * Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates.
  11978. * Returns the AbstractMesh.
  11979. */
  11980. getAbsolutePivotPointToRef(result: Vector3): TransformNode;
  11981. /**
  11982. * Defines the passed node as the parent of the current node.
  11983. * The node will remain exactly where it is and its position / rotation will be updated accordingly
  11984. * Returns the TransformNode.
  11985. */
  11986. setParent(node: Nullable<Node>): TransformNode;
  11987. readonly nonUniformScaling: boolean;
  11988. /**
  11989. * Attach the current TransformNode to another TransformNode associated with a bone
  11990. * @param bone Bone affecting the TransformNode
  11991. * @param affectedTransformNode TransformNode associated with the bone
  11992. */
  11993. attachToBone(bone: Bone, affectedTransformNode: TransformNode): TransformNode;
  11994. detachFromBone(): TransformNode;
  11995. /**
  11996. * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.
  11997. * space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
  11998. * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
  11999. * The passed axis is also normalized.
  12000. * Returns the AbstractMesh.
  12001. */
  12002. rotate(axis: Vector3, amount: number, space?: Space): TransformNode;
  12003. /**
  12004. * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.
  12005. * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
  12006. * The passed axis is also normalized.
  12007. * Returns the AbstractMesh.
  12008. * Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm
  12009. */
  12010. rotateAround(point: Vector3, axis: Vector3, amount: number): TransformNode;
  12011. /**
  12012. * Translates the mesh along the axis vector for the passed distance in the given space.
  12013. * space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
  12014. * Returns the AbstractMesh.
  12015. */
  12016. translate(axis: Vector3, distance: number, space?: Space): TransformNode;
  12017. /**
  12018. * Adds a rotation step to the mesh current rotation.
  12019. * x, y, z are Euler angles expressed in radians.
  12020. * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.
  12021. * This means this rotation is made in the mesh local space only.
  12022. * It's useful to set a custom rotation order different from the BJS standard one YXZ.
  12023. * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.
  12024. * ```javascript
  12025. * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);
  12026. * ```
  12027. * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.
  12028. * Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.
  12029. * Returns the AbstractMesh.
  12030. */
  12031. addRotation(x: number, y: number, z: number): TransformNode;
  12032. /**
  12033. * Computes the mesh World matrix and returns it.
  12034. * If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.
  12035. * If the parameter `force` is let to `false` (default), the current cached World matrix is returned.
  12036. * If the parameter `force`is set to `true`, the actual computation is done.
  12037. * Returns the mesh World Matrix.
  12038. */
  12039. computeWorldMatrix(force?: boolean): Matrix;
  12040. /**
  12041. * If you'd like to be called back after the mesh position, rotation or scaling has been updated.
  12042. * @param func: callback function to add
  12043. *
  12044. * Returns the TransformNode.
  12045. */
  12046. registerAfterWorldMatrixUpdate(func: (mesh: TransformNode) => void): TransformNode;
  12047. /**
  12048. * Removes a registered callback function.
  12049. * Returns the TransformNode.
  12050. */
  12051. unregisterAfterWorldMatrixUpdate(func: (mesh: TransformNode) => void): TransformNode;
  12052. /**
  12053. * Clone the current transform node
  12054. * Returns the new transform node
  12055. * @param name Name of the new clone
  12056. * @param newParent New parent for the clone
  12057. * @param doNotCloneChildren Do not clone children hierarchy
  12058. */
  12059. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): Nullable<TransformNode>;
  12060. serialize(currentSerializationObject?: any): any;
  12061. /**
  12062. * Returns a new TransformNode object parsed from the source provided.
  12063. * The parameter `parsedMesh` is the source.
  12064. * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
  12065. */
  12066. static Parse(parsedTransformNode: any, scene: Scene, rootUrl: string): TransformNode;
  12067. /**
  12068. * Disposes the TransformNode.
  12069. * By default, all the children are also disposed unless the parameter `doNotRecurse` is set to `true`.
  12070. * Returns nothing.
  12071. */
  12072. dispose(doNotRecurse?: boolean): void;
  12073. }
  12074. }
  12075. declare module BABYLON {
  12076. class VertexBuffer {
  12077. constructor(engine: any, data: FloatArray | Buffer, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number, instanced?: boolean, offset?: number, size?: number);
  12078. /**
  12079. * Returns the kind of the VertexBuffer (string).
  12080. */
  12081. getKind(): string;
  12082. /**
  12083. * Boolean : is the VertexBuffer updatable ?
  12084. */
  12085. isUpdatable(): boolean;
  12086. /**
  12087. * Returns an array of numbers or a Float32Array containing the VertexBuffer data.
  12088. */
  12089. getData(): Nullable<FloatArray>;
  12090. /**
  12091. * Returns the WebGLBuffer associated to the VertexBuffer.
  12092. */
  12093. getBuffer(): Nullable<WebGLBuffer>;
  12094. /**
  12095. * Returns the stride of the VertexBuffer (integer).
  12096. */
  12097. getStrideSize(): number;
  12098. /**
  12099. * Returns the offset (integer).
  12100. */
  12101. getOffset(): number;
  12102. /**
  12103. * Returns the VertexBuffer total size (integer).
  12104. */
  12105. getSize(): number;
  12106. /**
  12107. * Boolean : is the WebGLBuffer of the VertexBuffer instanced now ?
  12108. */
  12109. getIsInstanced(): boolean;
  12110. /**
  12111. * Returns the instancing divisor, zero for non-instanced (integer).
  12112. */
  12113. getInstanceDivisor(): number;
  12114. /**
  12115. * Creates the underlying WebGLBuffer from the passed numeric array or Float32Array.
  12116. * Returns the created WebGLBuffer.
  12117. */
  12118. create(data?: FloatArray): void;
  12119. /**
  12120. * Updates the underlying WebGLBuffer according to the passed numeric array or Float32Array.
  12121. * Returns the updated WebGLBuffer.
  12122. */
  12123. update(data: FloatArray): void;
  12124. /**
  12125. * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.
  12126. * Returns the directly updated WebGLBuffer.
  12127. */
  12128. updateDirectly(data: Float32Array, offset: number): void;
  12129. /**
  12130. * Disposes the VertexBuffer and the underlying WebGLBuffer.
  12131. */
  12132. dispose(): void;
  12133. static readonly PositionKind: string;
  12134. static readonly NormalKind: string;
  12135. static readonly TangentKind: string;
  12136. static readonly UVKind: string;
  12137. static readonly UV2Kind: string;
  12138. static readonly UV3Kind: string;
  12139. static readonly UV4Kind: string;
  12140. static readonly UV5Kind: string;
  12141. static readonly UV6Kind: string;
  12142. static readonly ColorKind: string;
  12143. static readonly MatricesIndicesKind: string;
  12144. static readonly MatricesWeightsKind: string;
  12145. static readonly MatricesIndicesExtraKind: string;
  12146. static readonly MatricesWeightsExtraKind: string;
  12147. }
  12148. }
  12149. declare module BABYLON {
  12150. class GPUParticleSystem implements IDisposable, IParticleSystem {
  12151. name: string;
  12152. id: string;
  12153. emitter: Nullable<AbstractMesh | Vector3>;
  12154. renderingGroupId: number;
  12155. layerMask: number;
  12156. /**
  12157. * An event triggered when the system is disposed.
  12158. * @type {BABYLON.Observable}
  12159. */
  12160. onDisposeObservable: Observable<GPUParticleSystem>;
  12161. isStarted(): boolean;
  12162. start(): void;
  12163. stop(): void;
  12164. constructor(name: string, capacity: number, scene: Scene);
  12165. animate(): void;
  12166. render(): number;
  12167. rebuild(): void;
  12168. dispose(): void;
  12169. clone(name: string, newEmitter: any): Nullable<GPUParticleSystem>;
  12170. serialize(): any;
  12171. }
  12172. }
  12173. declare module BABYLON {
  12174. class Particle {
  12175. position: Vector3;
  12176. direction: Vector3;
  12177. color: Color4;
  12178. colorStep: Color4;
  12179. lifeTime: number;
  12180. age: number;
  12181. size: number;
  12182. angle: number;
  12183. angularSpeed: number;
  12184. cellIndex: number;
  12185. constructor(particleSystem: ParticleSystem);
  12186. updateCellIndex: (scaledUpdateSpeed: number) => void;
  12187. copyTo(other: Particle): void;
  12188. }
  12189. }
  12190. declare module BABYLON {
  12191. interface IParticleSystem {
  12192. id: string;
  12193. name: string;
  12194. emitter: Nullable<AbstractMesh | Vector3>;
  12195. renderingGroupId: number;
  12196. layerMask: number;
  12197. isStarted(): boolean;
  12198. animate(): void;
  12199. render(): number;
  12200. dispose(): void;
  12201. clone(name: string, newEmitter: any): Nullable<IParticleSystem>;
  12202. serialize(): any;
  12203. rebuild(): void;
  12204. }
  12205. class ParticleSystem implements IDisposable, IAnimatable, IParticleSystem {
  12206. name: string;
  12207. static BLENDMODE_ONEONE: number;
  12208. static BLENDMODE_STANDARD: number;
  12209. animations: Animation[];
  12210. id: string;
  12211. renderingGroupId: number;
  12212. emitter: Nullable<AbstractMesh | Vector3>;
  12213. emitRate: number;
  12214. manualEmitCount: number;
  12215. updateSpeed: number;
  12216. targetStopDuration: number;
  12217. disposeOnStop: boolean;
  12218. minEmitPower: number;
  12219. maxEmitPower: number;
  12220. minLifeTime: number;
  12221. maxLifeTime: number;
  12222. minSize: number;
  12223. maxSize: number;
  12224. minAngularSpeed: number;
  12225. maxAngularSpeed: number;
  12226. particleTexture: Nullable<Texture>;
  12227. layerMask: number;
  12228. customShader: any;
  12229. preventAutoStart: boolean;
  12230. /**
  12231. * An event triggered when the system is disposed.
  12232. * @type {BABYLON.Observable}
  12233. */
  12234. onDisposeObservable: Observable<ParticleSystem>;
  12235. onDispose: () => void;
  12236. updateFunction: (particles: Particle[]) => void;
  12237. onAnimationEnd: Nullable<() => void>;
  12238. blendMode: number;
  12239. forceDepthWrite: boolean;
  12240. gravity: Vector3;
  12241. direction1: Vector3;
  12242. direction2: Vector3;
  12243. minEmitBox: Vector3;
  12244. maxEmitBox: Vector3;
  12245. color1: Color4;
  12246. color2: Color4;
  12247. colorDead: Color4;
  12248. textureMask: Color4;
  12249. startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle) => void;
  12250. startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle) => void;
  12251. startSpriteCellID: number;
  12252. endSpriteCellID: number;
  12253. spriteCellLoop: boolean;
  12254. spriteCellChangeSpeed: number;
  12255. spriteCellWidth: number;
  12256. spriteCellHeight: number;
  12257. readonly isAnimationSheetEnabled: Boolean;
  12258. constructor(name: string, capacity: number, scene: Scene, customEffect?: Nullable<Effect>, _isAnimationSheetEnabled?: boolean, epsilon?: number);
  12259. recycleParticle(particle: Particle): void;
  12260. getCapacity(): number;
  12261. isAlive(): boolean;
  12262. isStarted(): boolean;
  12263. start(): void;
  12264. stop(): void;
  12265. animate(): void;
  12266. appendParticleVertexes: Nullable<(offset: number, particle: Particle) => void>;
  12267. rebuild(): void;
  12268. render(): number;
  12269. dispose(): void;
  12270. clone(name: string, newEmitter: any): ParticleSystem;
  12271. serialize(): any;
  12272. static Parse(parsedParticleSystem: any, scene: Scene, rootUrl: string): ParticleSystem;
  12273. }
  12274. }
  12275. declare module BABYLON {
  12276. class SolidParticle {
  12277. idx: number;
  12278. color: Nullable<Color4>;
  12279. position: Vector3;
  12280. rotation: Vector3;
  12281. rotationQuaternion: Nullable<Quaternion>;
  12282. scaling: Vector3;
  12283. uvs: Vector4;
  12284. velocity: Vector3;
  12285. pivot: Vector3;
  12286. alive: boolean;
  12287. isVisible: boolean;
  12288. shapeId: number;
  12289. idxInShape: number;
  12290. /**
  12291. * Creates a Solid Particle object.
  12292. * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()
  12293. * `particleIndex` (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier.
  12294. * `positionIndex` (integer) is the starting index of the particle vertices in the SPS "positions" array.
  12295. * `indiceIndex` (integer) is the starting index of the particle indices in the SPS "indices" array.
  12296. * `model` (ModelShape) is a reference to the model shape on what the particle is designed.
  12297. * `shapeId` (integer) is the model shape identifier in the SPS.
  12298. * `idxInShape` (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))
  12299. * `modelBoundingInfo` is the reference to the model BoundingInfo used for intersection computations.
  12300. */
  12301. constructor(particleIndex: number, positionIndex: number, indiceIndex: number, model: Nullable<ModelShape>, shapeId: number, idxInShape: number, sps: SolidParticleSystem, modelBoundingInfo?: Nullable<BoundingInfo>);
  12302. /**
  12303. * legacy support, changed scale to scaling
  12304. */
  12305. scale: Vector3;
  12306. /**
  12307. * legacy support, changed quaternion to rotationQuaternion
  12308. */
  12309. quaternion: Nullable<Quaternion>;
  12310. /**
  12311. * Returns a boolean. True if the particle intersects another particle or another mesh, else false.
  12312. * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)
  12313. * `target` is the object (solid particle or mesh) what the intersection is computed against.
  12314. */
  12315. intersectsMesh(target: Mesh | SolidParticle): boolean;
  12316. }
  12317. class ModelShape {
  12318. shapeID: number;
  12319. /**
  12320. * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.
  12321. * SPS internal tool, don't use it manually.
  12322. */
  12323. constructor(id: number, shape: Vector3[], indicesLength: number, shapeUV: number[], posFunction: Nullable<(particle: SolidParticle, i: number, s: number) => void>, vtxFunction: Nullable<(particle: SolidParticle, vertex: Vector3, i: number) => void>);
  12324. }
  12325. class DepthSortedParticle {
  12326. ind: number;
  12327. indicesLength: number;
  12328. sqDistance: number;
  12329. }
  12330. }
  12331. declare module BABYLON {
  12332. /**
  12333. * Full documentation here : http://doc.babylonjs.com/overviews/Solid_Particle_System
  12334. */
  12335. class SolidParticleSystem implements IDisposable {
  12336. /**
  12337. * The SPS array of Solid Particle objects. Just access each particle as with any classic array.
  12338. * Example : var p = SPS.particles[i];
  12339. */
  12340. particles: SolidParticle[];
  12341. /**
  12342. * The SPS total number of particles. Read only. Use SPS.counter instead if you need to set your own value.
  12343. */
  12344. nbParticles: number;
  12345. /**
  12346. * If the particles must ever face the camera (default false). Useful for planar particles.
  12347. */
  12348. billboard: boolean;
  12349. /**
  12350. * Recompute normals when adding a shape
  12351. */
  12352. recomputeNormals: boolean;
  12353. /**
  12354. * This a counter ofr your own usage. It's not set by any SPS functions.
  12355. */
  12356. counter: number;
  12357. /**
  12358. * The SPS name. This name is also given to the underlying mesh.
  12359. */
  12360. name: string;
  12361. /**
  12362. * The SPS mesh. It's a standard BJS Mesh, so all the methods from the Mesh class are avalaible.
  12363. */
  12364. mesh: Mesh;
  12365. /**
  12366. * This empty object is intended to store some SPS specific or temporary values in order to lower the Garbage Collector activity.
  12367. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#garbage-collector-concerns
  12368. */
  12369. vars: any;
  12370. /**
  12371. * This array is populated when the SPS is set as 'pickable'.
  12372. * Each key of this array is a `faceId` value that you can get from a pickResult object.
  12373. * Each element of this array is an object `{idx: int, faceId: int}`.
  12374. * `idx` is the picked particle index in the `SPS.particles` array
  12375. * `faceId` is the picked face index counted within this particle.
  12376. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#pickable-particles
  12377. */
  12378. pickedParticles: {
  12379. idx: number;
  12380. faceId: number;
  12381. }[];
  12382. /**
  12383. * This array is populated when `enableDepthSort` is set to true.
  12384. * Each element of this array is an instance of the class DepthSortedParticle.
  12385. */
  12386. depthSortedParticles: DepthSortedParticle[];
  12387. /**
  12388. * Creates a SPS (Solid Particle System) object.
  12389. * `name` (String) is the SPS name, this will be the underlying mesh name.
  12390. * `scene` (Scene) is the scene in which the SPS is added.
  12391. * `updatable` (optional boolean, default true) : if the SPS must be updatable or immutable.
  12392. * `isPickable` (optional boolean, default false) : if the solid particles must be pickable.
  12393. * `enableDepthSort` (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.
  12394. * `particleIntersection` (optional boolean, default false) : if the solid particle intersections must be computed.
  12395. * `boundingSphereOnly` (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
  12396. * `bSphereRadiusFactor` (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
  12397. * Example : bSphereRadiusFactor = 1.0 / Math.sqrt(3.0) => the bounding sphere exactly matches a spherical mesh.
  12398. */
  12399. constructor(name: string, scene: Scene, options?: {
  12400. updatable?: boolean;
  12401. isPickable?: boolean;
  12402. enableDepthSort?: boolean;
  12403. particleIntersection?: boolean;
  12404. boundingSphereOnly?: boolean;
  12405. bSphereRadiusFactor?: number;
  12406. });
  12407. /**
  12408. * Builds the SPS underlying mesh. Returns a standard Mesh.
  12409. * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.
  12410. */
  12411. buildMesh(): Mesh;
  12412. /**
  12413. * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
  12414. * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
  12415. * Thus the particles generated from `digest()` have their property `position` set yet.
  12416. * `mesh` ( Mesh ) is the mesh to be digested
  12417. * `facetNb` (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any
  12418. * `delta` (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
  12419. * `number` (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets
  12420. */
  12421. digest(mesh: Mesh, options?: {
  12422. facetNb?: number;
  12423. number?: number;
  12424. delta?: number;
  12425. }): SolidParticleSystem;
  12426. /**
  12427. * Adds some particles to the SPS from the model shape. Returns the shape id.
  12428. * Please read the doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#create-an-immutable-sps
  12429. * `mesh` is any Mesh object that will be used as a model for the solid particles.
  12430. * `nb` (positive integer) the number of particles to be created from this model
  12431. * `positionFunction` is an optional javascript function to called for each particle on SPS creation.
  12432. * `vertexFunction` is an optional javascript function to called for each vertex of each particle on SPS creation
  12433. */
  12434. addShape(mesh: Mesh, nb: number, options?: {
  12435. positionFunction?: any;
  12436. vertexFunction?: any;
  12437. }): number;
  12438. /**
  12439. * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
  12440. * Returns the SPS.
  12441. */
  12442. rebuildMesh(): SolidParticleSystem;
  12443. /**
  12444. * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.
  12445. * This method calls `updateParticle()` for each particle of the SPS.
  12446. * For an animated SPS, it is usually called within the render loop.
  12447. * @param start The particle index in the particle array where to start to compute the particle property values _(default 0)_
  12448. * @param end The particle index in the particle array where to stop to compute the particle property values _(default nbParticle - 1)_
  12449. * @param update If the mesh must be finally updated on this call after all the particle computations _(default true)_
  12450. * Returns the SPS.
  12451. */
  12452. setParticles(start?: number, end?: number, update?: boolean): SolidParticleSystem;
  12453. /**
  12454. * Disposes the SPS.
  12455. * Returns nothing.
  12456. */
  12457. dispose(): void;
  12458. /**
  12459. * Visibilty helper : Recomputes the visible size according to the mesh bounding box
  12460. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  12461. * Returns the SPS.
  12462. */
  12463. refreshVisibleSize(): SolidParticleSystem;
  12464. /**
  12465. * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.
  12466. * @param size the size (float) of the visibility box
  12467. * note : this doesn't lock the SPS mesh bounding box.
  12468. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  12469. */
  12470. setVisibilityBox(size: number): void;
  12471. /**
  12472. * Sets the SPS as always visible or not
  12473. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  12474. */
  12475. isAlwaysVisible: boolean;
  12476. /**
  12477. * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.
  12478. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  12479. */
  12480. isVisibilityBoxLocked: boolean;
  12481. /**
  12482. * Tells to `setParticles()` to compute the particle rotations or not.
  12483. * Default value : true. The SPS is faster when it's set to false.
  12484. * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.
  12485. */
  12486. computeParticleRotation: boolean;
  12487. /**
  12488. * Tells to `setParticles()` to compute the particle colors or not.
  12489. * Default value : true. The SPS is faster when it's set to false.
  12490. * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.
  12491. */
  12492. computeParticleColor: boolean;
  12493. /**
  12494. * Tells to `setParticles()` to compute the particle textures or not.
  12495. * Default value : true. The SPS is faster when it's set to false.
  12496. * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.
  12497. */
  12498. computeParticleTexture: boolean;
  12499. /**
  12500. * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.
  12501. * Default value : false. The SPS is faster when it's set to false.
  12502. * Note : the particle custom vertex positions aren't stored values.
  12503. */
  12504. computeParticleVertex: boolean;
  12505. /**
  12506. * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.
  12507. */
  12508. computeBoundingBox: boolean;
  12509. /**
  12510. * Tells to `setParticles()` to sort or not the distance between each particle and the camera.
  12511. * Skipped when `enableDepthSort` is set to `false` (default) at construction time.
  12512. * Default : `true`
  12513. */
  12514. depthSortParticles: boolean;
  12515. /**
  12516. * This function does nothing. It may be overwritten to set all the particle first values.
  12517. * The SPS doesn't call this function, you may have to call it by your own.
  12518. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  12519. */
  12520. initParticles(): void;
  12521. /**
  12522. * This function does nothing. It may be overwritten to recycle a particle.
  12523. * The SPS doesn't call this function, you may have to call it by your own.
  12524. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  12525. */
  12526. recycleParticle(particle: SolidParticle): SolidParticle;
  12527. /**
  12528. * Updates a particle : this function should be overwritten by the user.
  12529. * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.
  12530. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  12531. * ex : just set a particle position or velocity and recycle conditions
  12532. */
  12533. updateParticle(particle: SolidParticle): SolidParticle;
  12534. /**
  12535. * Updates a vertex of a particle : it can be overwritten by the user.
  12536. * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.
  12537. * @param particle the current particle
  12538. * @param vertex the current index of the current particle
  12539. * @param pt the index of the current vertex in the particle shape
  12540. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#update-each-particle-shape
  12541. * ex : just set a vertex particle position
  12542. */
  12543. updateParticleVertex(particle: SolidParticle, vertex: Vector3, pt: number): Vector3;
  12544. /**
  12545. * This will be called before any other treatment by `setParticles()` and will be passed three parameters.
  12546. * This does nothing and may be overwritten by the user.
  12547. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  12548. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  12549. * @param update the boolean update value actually passed to setParticles()
  12550. */
  12551. beforeUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  12552. /**
  12553. * This will be called by `setParticles()` after all the other treatments and just before the actual mesh update.
  12554. * This will be passed three parameters.
  12555. * This does nothing and may be overwritten by the user.
  12556. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  12557. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  12558. * @param update the boolean update value actually passed to setParticles()
  12559. */
  12560. afterUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  12561. }
  12562. }
  12563. declare module BABYLON {
  12564. interface PhysicsImpostorJoint {
  12565. mainImpostor: PhysicsImpostor;
  12566. connectedImpostor: PhysicsImpostor;
  12567. joint: PhysicsJoint;
  12568. }
  12569. class PhysicsEngine {
  12570. gravity: Vector3;
  12571. constructor(gravity: Nullable<Vector3>, _physicsPlugin?: IPhysicsEnginePlugin);
  12572. setGravity(gravity: Vector3): void;
  12573. /**
  12574. * Set the time step of the physics engine.
  12575. * default is 1/60.
  12576. * To slow it down, enter 1/600 for example.
  12577. * To speed it up, 1/30
  12578. * @param {number} newTimeStep the new timestep to apply to this world.
  12579. */
  12580. setTimeStep(newTimeStep?: number): void;
  12581. /**
  12582. * Get the time step of the physics engine.
  12583. */
  12584. getTimeStep(): number;
  12585. dispose(): void;
  12586. getPhysicsPluginName(): string;
  12587. static Epsilon: number;
  12588. /**
  12589. * Adding a new impostor for the impostor tracking.
  12590. * This will be done by the impostor itself.
  12591. * @param {PhysicsImpostor} impostor the impostor to add
  12592. */
  12593. addImpostor(impostor: PhysicsImpostor): void;
  12594. /**
  12595. * Remove an impostor from the engine.
  12596. * This impostor and its mesh will not longer be updated by the physics engine.
  12597. * @param {PhysicsImpostor} impostor the impostor to remove
  12598. */
  12599. removeImpostor(impostor: PhysicsImpostor): void;
  12600. /**
  12601. * Add a joint to the physics engine
  12602. * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
  12603. * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
  12604. * @param {PhysicsJoint} the joint that will connect both impostors.
  12605. */
  12606. addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  12607. removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  12608. /**
  12609. * Called by the scene. no need to call it.
  12610. */
  12611. getPhysicsPlugin(): IPhysicsEnginePlugin;
  12612. getImpostors(): Array<PhysicsImpostor>;
  12613. getImpostorForPhysicsObject(object: IPhysicsEnabledObject): Nullable<PhysicsImpostor>;
  12614. getImpostorWithPhysicsBody(body: any): Nullable<PhysicsImpostor>;
  12615. }
  12616. interface IPhysicsEnginePlugin {
  12617. world: any;
  12618. name: string;
  12619. setGravity(gravity: Vector3): void;
  12620. setTimeStep(timeStep: number): void;
  12621. getTimeStep(): number;
  12622. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  12623. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  12624. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  12625. generatePhysicsBody(impostor: PhysicsImpostor): void;
  12626. removePhysicsBody(impostor: PhysicsImpostor): void;
  12627. generateJoint(joint: PhysicsImpostorJoint): void;
  12628. removeJoint(joint: PhysicsImpostorJoint): void;
  12629. isSupported(): boolean;
  12630. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  12631. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  12632. setLinearVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;
  12633. setAngularVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;
  12634. getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
  12635. getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
  12636. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  12637. getBodyMass(impostor: PhysicsImpostor): number;
  12638. getBodyFriction(impostor: PhysicsImpostor): number;
  12639. setBodyFriction(impostor: PhysicsImpostor, friction: number): void;
  12640. getBodyRestitution(impostor: PhysicsImpostor): number;
  12641. setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;
  12642. sleepBody(impostor: PhysicsImpostor): void;
  12643. wakeUpBody(impostor: PhysicsImpostor): void;
  12644. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  12645. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
  12646. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  12647. getRadius(impostor: PhysicsImpostor): number;
  12648. getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;
  12649. syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;
  12650. dispose(): void;
  12651. }
  12652. }
  12653. declare module BABYLON {
  12654. class PhysicsHelper {
  12655. constructor(scene: Scene);
  12656. /**
  12657. * @param {Vector3} origin the origin of the explosion
  12658. * @param {number} radius the explosion radius
  12659. * @param {number} strength the explosion strength
  12660. * @param {PhysicsRadialImpulseFalloff} falloff possible options: Constant & Linear. Defaults to Constant
  12661. */
  12662. applyRadialExplosionImpulse(origin: Vector3, radius: number, strength: number, falloff?: PhysicsRadialImpulseFalloff): Nullable<PhysicsRadialExplosionEvent>;
  12663. /**
  12664. * @param {Vector3} origin the origin of the explosion
  12665. * @param {number} radius the explosion radius
  12666. * @param {number} strength the explosion strength
  12667. * @param {PhysicsRadialImpulseFalloff} falloff possible options: Constant & Linear. Defaults to Constant
  12668. */
  12669. applyRadialExplosionForce(origin: Vector3, radius: number, strength: number, falloff?: PhysicsRadialImpulseFalloff): Nullable<PhysicsRadialExplosionEvent>;
  12670. /**
  12671. * @param {Vector3} origin the origin of the explosion
  12672. * @param {number} radius the explosion radius
  12673. * @param {number} strength the explosion strength
  12674. * @param {PhysicsRadialImpulseFalloff} falloff possible options: Constant & Linear. Defaults to Constant
  12675. */
  12676. gravitationalField(origin: Vector3, radius: number, strength: number, falloff?: PhysicsRadialImpulseFalloff): Nullable<PhysicsGravitationalFieldEvent>;
  12677. /**
  12678. * @param {Vector3} origin the origin of the updraft
  12679. * @param {number} radius the radius of the updraft
  12680. * @param {number} strength the strength of the updraft
  12681. * @param {number} height the height of the updraft
  12682. * @param {PhysicsUpdraftMode} updraftMode possible options: Center & Perpendicular. Defaults to Center
  12683. */
  12684. updraft(origin: Vector3, radius: number, strength: number, height: number, updraftMode?: PhysicsUpdraftMode): Nullable<PhysicsUpdraftEvent>;
  12685. /**
  12686. * @param {Vector3} origin the of the vortex
  12687. * @param {number} radius the radius of the vortex
  12688. * @param {number} strength the strength of the vortex
  12689. * @param {number} height the height of the vortex
  12690. */
  12691. vortex(origin: Vector3, radius: number, strength: number, height: number): Nullable<PhysicsVortexEvent>;
  12692. }
  12693. /***** Radial explosion *****/
  12694. class PhysicsRadialExplosionEvent {
  12695. constructor(scene: Scene);
  12696. /**
  12697. * Returns the data related to the radial explosion event (sphere & rays).
  12698. * @returns {PhysicsRadialExplosionEventData}
  12699. */
  12700. getData(): PhysicsRadialExplosionEventData;
  12701. /**
  12702. * Returns the force and contact point of the impostor or false, if the impostor is not affected by the force/impulse.
  12703. * @param impostor
  12704. * @param {Vector3} origin the origin of the explosion
  12705. * @param {number} radius the explosion radius
  12706. * @param {number} strength the explosion strength
  12707. * @param {PhysicsRadialImpulseFalloff} falloff possible options: Constant & Linear
  12708. * @returns {Nullable<PhysicsForceAndContactPoint>}
  12709. */
  12710. getImpostorForceAndContactPoint(impostor: PhysicsImpostor, origin: Vector3, radius: number, strength: number, falloff: PhysicsRadialImpulseFalloff): Nullable<PhysicsForceAndContactPoint>;
  12711. /**
  12712. * Disposes the sphere.
  12713. * @param {bolean} force
  12714. */
  12715. dispose(force?: boolean): void;
  12716. /*** Helpers ***/
  12717. }
  12718. /***** Gravitational Field *****/
  12719. class PhysicsGravitationalFieldEvent {
  12720. constructor(physicsHelper: PhysicsHelper, scene: Scene, origin: Vector3, radius: number, strength: number, falloff?: PhysicsRadialImpulseFalloff);
  12721. /**
  12722. * Returns the data related to the gravitational field event (sphere).
  12723. * @returns {PhysicsGravitationalFieldEventData}
  12724. */
  12725. getData(): PhysicsGravitationalFieldEventData;
  12726. /**
  12727. * Enables the gravitational field.
  12728. */
  12729. enable(): void;
  12730. /**
  12731. * Disables the gravitational field.
  12732. */
  12733. disable(): void;
  12734. /**
  12735. * Disposes the sphere.
  12736. * @param {bolean} force
  12737. */
  12738. dispose(force?: boolean): void;
  12739. }
  12740. /***** Updraft *****/
  12741. class PhysicsUpdraftEvent {
  12742. constructor(_scene: Scene, _origin: Vector3, _radius: number, _strength: number, _height: number, _updraftMode: PhysicsUpdraftMode);
  12743. /**
  12744. * Returns the data related to the updraft event (cylinder).
  12745. * @returns {PhysicsUpdraftEventData}
  12746. */
  12747. getData(): PhysicsUpdraftEventData;
  12748. /**
  12749. * Enables the updraft.
  12750. */
  12751. enable(): void;
  12752. /**
  12753. * Disables the cortex.
  12754. */
  12755. disable(): void;
  12756. /**
  12757. * Disposes the sphere.
  12758. * @param {bolean} force
  12759. */
  12760. dispose(force?: boolean): void;
  12761. /*** Helpers ***/
  12762. }
  12763. /***** Vortex *****/
  12764. class PhysicsVortexEvent {
  12765. constructor(_scene: Scene, _origin: Vector3, _radius: number, _strength: number, _height: number);
  12766. /**
  12767. * Returns the data related to the vortex event (cylinder).
  12768. * @returns {PhysicsVortexEventData}
  12769. */
  12770. getData(): PhysicsVortexEventData;
  12771. /**
  12772. * Enables the vortex.
  12773. */
  12774. enable(): void;
  12775. /**
  12776. * Disables the cortex.
  12777. */
  12778. disable(): void;
  12779. /**
  12780. * Disposes the sphere.
  12781. * @param {bolean} force
  12782. */
  12783. dispose(force?: boolean): void;
  12784. /*** Helpers ***/
  12785. }
  12786. /***** Enums *****/
  12787. /**
  12788. * The strenght of the force in correspondence to the distance of the affected object
  12789. */
  12790. enum PhysicsRadialImpulseFalloff {
  12791. Constant = 0,
  12792. Linear = 1,
  12793. }
  12794. /**
  12795. * The strenght of the force in correspondence to the distance of the affected object
  12796. */
  12797. enum PhysicsUpdraftMode {
  12798. Center = 0,
  12799. Perpendicular = 1,
  12800. }
  12801. /***** Data interfaces *****/
  12802. interface PhysicsForceAndContactPoint {
  12803. force: Vector3;
  12804. contactPoint: Vector3;
  12805. }
  12806. interface PhysicsRadialExplosionEventData {
  12807. sphere: Mesh;
  12808. rays: Array<Ray>;
  12809. }
  12810. interface PhysicsGravitationalFieldEventData {
  12811. sphere: Mesh;
  12812. }
  12813. interface PhysicsUpdraftEventData {
  12814. cylinder: Mesh;
  12815. }
  12816. interface PhysicsVortexEventData {
  12817. cylinder: Mesh;
  12818. }
  12819. }
  12820. declare module BABYLON {
  12821. interface PhysicsImpostorParameters {
  12822. mass: number;
  12823. friction?: number;
  12824. restitution?: number;
  12825. nativeOptions?: any;
  12826. ignoreParent?: boolean;
  12827. disableBidirectionalTransformation?: boolean;
  12828. }
  12829. interface IPhysicsEnabledObject {
  12830. position: Vector3;
  12831. rotationQuaternion: Nullable<Quaternion>;
  12832. scaling: Vector3;
  12833. rotation?: Vector3;
  12834. parent?: any;
  12835. getBoundingInfo(): BoundingInfo;
  12836. computeWorldMatrix(force: boolean): Matrix;
  12837. getWorldMatrix?(): Matrix;
  12838. getChildMeshes?(directDescendantsOnly?: boolean): Array<AbstractMesh>;
  12839. getVerticesData(kind: string): Nullable<Array<number> | Float32Array>;
  12840. getIndices?(): Nullable<IndicesArray>;
  12841. getScene?(): Scene;
  12842. getAbsolutePosition(): Vector3;
  12843. getAbsolutePivotPoint(): Vector3;
  12844. rotate(axis: Vector3, amount: number, space?: Space): TransformNode;
  12845. translate(axis: Vector3, distance: number, space?: Space): TransformNode;
  12846. setAbsolutePosition(absolutePosition: Vector3): TransformNode;
  12847. getClassName(): string;
  12848. }
  12849. class PhysicsImpostor {
  12850. object: IPhysicsEnabledObject;
  12851. type: number;
  12852. static DEFAULT_OBJECT_SIZE: Vector3;
  12853. static IDENTITY_QUATERNION: Quaternion;
  12854. readonly isDisposed: boolean;
  12855. mass: number;
  12856. friction: number;
  12857. restitution: number;
  12858. uniqueId: number;
  12859. constructor(object: IPhysicsEnabledObject, type: number, _options?: PhysicsImpostorParameters, _scene?: Scene | undefined);
  12860. /**
  12861. * This function will completly initialize this impostor.
  12862. * It will create a new body - but only if this mesh has no parent.
  12863. * If it has, this impostor will not be used other than to define the impostor
  12864. * of the child mesh.
  12865. */
  12866. /**
  12867. * Should a new body be generated.
  12868. */
  12869. isBodyInitRequired(): boolean;
  12870. setScalingUpdated(updated: boolean): void;
  12871. /**
  12872. * Force a regeneration of this or the parent's impostor's body.
  12873. * Use under cautious - This will remove all joints already implemented.
  12874. */
  12875. forceUpdate(): void;
  12876. /**
  12877. * Gets the body that holds this impostor. Either its own, or its parent.
  12878. */
  12879. /**
  12880. * Set the physics body. Used mainly by the physics engine/plugin
  12881. */
  12882. physicsBody: any;
  12883. parent: Nullable<PhysicsImpostor>;
  12884. resetUpdateFlags(): void;
  12885. getObjectExtendSize(): Vector3;
  12886. getObjectCenter(): Vector3;
  12887. /**
  12888. * Get a specific parametes from the options parameter.
  12889. */
  12890. getParam(paramName: string): any;
  12891. /**
  12892. * Sets a specific parameter in the options given to the physics plugin
  12893. */
  12894. setParam(paramName: string, value: number): void;
  12895. /**
  12896. * Specifically change the body's mass option. Won't recreate the physics body object
  12897. */
  12898. setMass(mass: number): void;
  12899. getLinearVelocity(): Nullable<Vector3>;
  12900. setLinearVelocity(velocity: Nullable<Vector3>): void;
  12901. getAngularVelocity(): Nullable<Vector3>;
  12902. setAngularVelocity(velocity: Nullable<Vector3>): void;
  12903. /**
  12904. * Execute a function with the physics plugin native code.
  12905. * Provide a function the will have two variables - the world object and the physics body object.
  12906. */
  12907. executeNativeFunction(func: (world: any, physicsBody: any) => void): void;
  12908. /**
  12909. * Register a function that will be executed before the physics world is stepping forward.
  12910. */
  12911. registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  12912. unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  12913. /**
  12914. * Register a function that will be executed after the physics step
  12915. */
  12916. registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  12917. unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  12918. /**
  12919. * register a function that will be executed when this impostor collides against a different body.
  12920. */
  12921. registerOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor) => void): void;
  12922. unregisterOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>) => void): void;
  12923. getParentsRotation(): Quaternion;
  12924. /**
  12925. * this function is executed by the physics engine.
  12926. */
  12927. beforeStep: () => void;
  12928. /**
  12929. * this function is executed by the physics engine.
  12930. */
  12931. afterStep: () => void;
  12932. /**
  12933. * Legacy collision detection event support
  12934. */
  12935. onCollideEvent: Nullable<(collider: PhysicsImpostor, collidedWith: PhysicsImpostor) => void>;
  12936. onCollide: (e: {
  12937. body: any;
  12938. }) => void;
  12939. /**
  12940. * Apply a force
  12941. */
  12942. applyForce(force: Vector3, contactPoint: Vector3): PhysicsImpostor;
  12943. /**
  12944. * Apply an impulse
  12945. */
  12946. applyImpulse(force: Vector3, contactPoint: Vector3): PhysicsImpostor;
  12947. /**
  12948. * A help function to create a joint.
  12949. */
  12950. createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): PhysicsImpostor;
  12951. /**
  12952. * Add a joint to this impostor with a different impostor.
  12953. */
  12954. addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): PhysicsImpostor;
  12955. /**
  12956. * Will keep this body still, in a sleep mode.
  12957. */
  12958. sleep(): PhysicsImpostor;
  12959. /**
  12960. * Wake the body up.
  12961. */
  12962. wakeUp(): PhysicsImpostor;
  12963. clone(newObject: IPhysicsEnabledObject): Nullable<PhysicsImpostor>;
  12964. dispose(): void;
  12965. setDeltaPosition(position: Vector3): void;
  12966. setDeltaRotation(rotation: Quaternion): void;
  12967. getBoxSizeToRef(result: Vector3): PhysicsImpostor;
  12968. getRadius(): number;
  12969. /**
  12970. * Sync a bone with this impostor
  12971. * @param bone The bone to sync to the impostor.
  12972. * @param boneMesh The mesh that the bone is influencing.
  12973. * @param jointPivot The pivot of the joint / bone in local space.
  12974. * @param distToJoint Optional distance from the impostor to the joint.
  12975. * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.
  12976. */
  12977. syncBoneWithImpostor(bone: Bone, boneMesh: AbstractMesh, jointPivot: Vector3, distToJoint?: number, adjustRotation?: Quaternion): void;
  12978. /**
  12979. * Sync impostor to a bone
  12980. * @param bone The bone that the impostor will be synced to.
  12981. * @param boneMesh The mesh that the bone is influencing.
  12982. * @param jointPivot The pivot of the joint / bone in local space.
  12983. * @param distToJoint Optional distance from the impostor to the joint.
  12984. * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.
  12985. * @param boneAxis Optional vector3 axis the bone is aligned with
  12986. */
  12987. syncImpostorWithBone(bone: Bone, boneMesh: AbstractMesh, jointPivot: Vector3, distToJoint?: number, adjustRotation?: Quaternion, boneAxis?: Vector3): void;
  12988. static NoImpostor: number;
  12989. static SphereImpostor: number;
  12990. static BoxImpostor: number;
  12991. static PlaneImpostor: number;
  12992. static MeshImpostor: number;
  12993. static CylinderImpostor: number;
  12994. static ParticleImpostor: number;
  12995. static HeightmapImpostor: number;
  12996. }
  12997. }
  12998. declare module BABYLON {
  12999. interface PhysicsJointData {
  13000. mainPivot?: Vector3;
  13001. connectedPivot?: Vector3;
  13002. mainAxis?: Vector3;
  13003. connectedAxis?: Vector3;
  13004. collision?: boolean;
  13005. nativeParams?: any;
  13006. }
  13007. /**
  13008. * This is a holder class for the physics joint created by the physics plugin.
  13009. * It holds a set of functions to control the underlying joint.
  13010. */
  13011. class PhysicsJoint {
  13012. type: number;
  13013. jointData: PhysicsJointData;
  13014. constructor(type: number, jointData: PhysicsJointData);
  13015. physicsJoint: any;
  13016. physicsPlugin: IPhysicsEnginePlugin;
  13017. /**
  13018. * Execute a function that is physics-plugin specific.
  13019. * @param {Function} func the function that will be executed.
  13020. * It accepts two parameters: the physics world and the physics joint.
  13021. */
  13022. executeNativeFunction(func: (world: any, physicsJoint: any) => void): void;
  13023. static DistanceJoint: number;
  13024. static HingeJoint: number;
  13025. static BallAndSocketJoint: number;
  13026. static WheelJoint: number;
  13027. static SliderJoint: number;
  13028. static PrismaticJoint: number;
  13029. static UniversalJoint: number;
  13030. static Hinge2Joint: number;
  13031. static PointToPointJoint: number;
  13032. static SpringJoint: number;
  13033. static LockJoint: number;
  13034. }
  13035. /**
  13036. * A class representing a physics distance joint.
  13037. */
  13038. class DistanceJoint extends PhysicsJoint {
  13039. constructor(jointData: DistanceJointData);
  13040. /**
  13041. * Update the predefined distance.
  13042. */
  13043. updateDistance(maxDistance: number, minDistance?: number): void;
  13044. }
  13045. class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {
  13046. constructor(type: number, jointData: PhysicsJointData);
  13047. /**
  13048. * Set the motor values.
  13049. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13050. * @param {number} force the force to apply
  13051. * @param {number} maxForce max force for this motor.
  13052. */
  13053. setMotor(force?: number, maxForce?: number): void;
  13054. /**
  13055. * Set the motor's limits.
  13056. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13057. */
  13058. setLimit(upperLimit: number, lowerLimit?: number): void;
  13059. }
  13060. /**
  13061. * This class represents a single hinge physics joint
  13062. */
  13063. class HingeJoint extends MotorEnabledJoint {
  13064. constructor(jointData: PhysicsJointData);
  13065. /**
  13066. * Set the motor values.
  13067. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13068. * @param {number} force the force to apply
  13069. * @param {number} maxForce max force for this motor.
  13070. */
  13071. setMotor(force?: number, maxForce?: number): void;
  13072. /**
  13073. * Set the motor's limits.
  13074. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13075. */
  13076. setLimit(upperLimit: number, lowerLimit?: number): void;
  13077. }
  13078. /**
  13079. * This class represents a dual hinge physics joint (same as wheel joint)
  13080. */
  13081. class Hinge2Joint extends MotorEnabledJoint {
  13082. constructor(jointData: PhysicsJointData);
  13083. /**
  13084. * Set the motor values.
  13085. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13086. * @param {number} force the force to apply
  13087. * @param {number} maxForce max force for this motor.
  13088. * @param {motorIndex} the motor's index, 0 or 1.
  13089. */
  13090. setMotor(force?: number, maxForce?: number, motorIndex?: number): void;
  13091. /**
  13092. * Set the motor limits.
  13093. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13094. * @param {number} upperLimit the upper limit
  13095. * @param {number} lowerLimit lower limit
  13096. * @param {motorIndex} the motor's index, 0 or 1.
  13097. */
  13098. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  13099. }
  13100. interface IMotorEnabledJoint {
  13101. physicsJoint: any;
  13102. setMotor(force?: number, maxForce?: number, motorIndex?: number): void;
  13103. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  13104. }
  13105. interface DistanceJointData extends PhysicsJointData {
  13106. maxDistance: number;
  13107. }
  13108. interface SpringJointData extends PhysicsJointData {
  13109. length: number;
  13110. stiffness: number;
  13111. damping: number;
  13112. }
  13113. }
  13114. declare module BABYLON {
  13115. class BoundingBoxRenderer {
  13116. frontColor: Color3;
  13117. backColor: Color3;
  13118. showBackLines: boolean;
  13119. renderList: SmartArray<BoundingBox>;
  13120. constructor(scene: Scene);
  13121. reset(): void;
  13122. render(): void;
  13123. renderOcclusionBoundingBox(mesh: AbstractMesh): void;
  13124. dispose(): void;
  13125. }
  13126. }
  13127. declare module BABYLON {
  13128. class DepthRenderer {
  13129. constructor(scene: Scene, type?: number);
  13130. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  13131. getDepthMap(): RenderTargetTexture;
  13132. dispose(): void;
  13133. }
  13134. }
  13135. declare module BABYLON {
  13136. class EdgesRenderer {
  13137. edgesWidthScalerForOrthographic: number;
  13138. edgesWidthScalerForPerspective: number;
  13139. constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean);
  13140. dispose(): void;
  13141. render(): void;
  13142. }
  13143. }
  13144. declare module BABYLON {
  13145. class GeometryBufferRenderer {
  13146. renderList: Mesh[];
  13147. readonly isSupported: boolean;
  13148. enablePosition: boolean;
  13149. constructor(scene: Scene, ratio?: number);
  13150. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  13151. getGBuffer(): MultiRenderTarget;
  13152. samples: number;
  13153. dispose(): void;
  13154. }
  13155. }
  13156. declare module BABYLON {
  13157. class OutlineRenderer {
  13158. zOffset: number;
  13159. constructor(scene: Scene);
  13160. render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void;
  13161. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  13162. }
  13163. }
  13164. declare module BABYLON {
  13165. class RenderingGroup {
  13166. index: number;
  13167. onBeforeTransparentRendering: () => void;
  13168. /**
  13169. * Set the opaque sort comparison function.
  13170. * If null the sub meshes will be render in the order they were created
  13171. */
  13172. opaqueSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number>;
  13173. /**
  13174. * Set the alpha test sort comparison function.
  13175. * If null the sub meshes will be render in the order they were created
  13176. */
  13177. alphaTestSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number>;
  13178. /**
  13179. * Set the transparent sort comparison function.
  13180. * If null the sub meshes will be render in the order they were created
  13181. */
  13182. transparentSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number>;
  13183. /**
  13184. * Creates a new rendering group.
  13185. * @param index The rendering group index
  13186. * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied
  13187. * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied
  13188. * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied
  13189. */
  13190. constructor(index: number, scene: Scene, opaqueSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, alphaTestSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, transparentSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>);
  13191. /**
  13192. * Render all the sub meshes contained in the group.
  13193. * @param customRenderFunction Used to override the default render behaviour of the group.
  13194. * @returns true if rendered some submeshes.
  13195. */
  13196. render(customRenderFunction: Nullable<(opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, depthOnlySubMeshes: SmartArray<SubMesh>) => void>, renderSprites: boolean, renderParticles: boolean, activeMeshes: Nullable<AbstractMesh[]>): void;
  13197. /**
  13198. * Renders the opaque submeshes in the order from the opaqueSortCompareFn.
  13199. * @param subMeshes The submeshes to render
  13200. */
  13201. /**
  13202. * Renders the opaque submeshes in the order from the alphatestSortCompareFn.
  13203. * @param subMeshes The submeshes to render
  13204. */
  13205. /**
  13206. * Renders the opaque submeshes in the order from the transparentSortCompareFn.
  13207. * @param subMeshes The submeshes to render
  13208. */
  13209. /**
  13210. * Renders the submeshes in a specified order.
  13211. * @param subMeshes The submeshes to sort before render
  13212. * @param sortCompareFn The comparison function use to sort
  13213. * @param cameraPosition The camera position use to preprocess the submeshes to help sorting
  13214. * @param transparent Specifies to activate blending if true
  13215. */
  13216. /**
  13217. * Renders the submeshes in the order they were dispatched (no sort applied).
  13218. * @param subMeshes The submeshes to render
  13219. */
  13220. /**
  13221. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  13222. * are rendered back to front if in the same alpha index.
  13223. *
  13224. * @param a The first submesh
  13225. * @param b The second submesh
  13226. * @returns The result of the comparison
  13227. */
  13228. static defaultTransparentSortCompare(a: SubMesh, b: SubMesh): number;
  13229. /**
  13230. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  13231. * are rendered back to front.
  13232. *
  13233. * @param a The first submesh
  13234. * @param b The second submesh
  13235. * @returns The result of the comparison
  13236. */
  13237. static backToFrontSortCompare(a: SubMesh, b: SubMesh): number;
  13238. /**
  13239. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  13240. * are rendered front to back (prevent overdraw).
  13241. *
  13242. * @param a The first submesh
  13243. * @param b The second submesh
  13244. * @returns The result of the comparison
  13245. */
  13246. static frontToBackSortCompare(a: SubMesh, b: SubMesh): number;
  13247. /**
  13248. * Resets the different lists of submeshes to prepare a new frame.
  13249. */
  13250. prepare(): void;
  13251. dispose(): void;
  13252. /**
  13253. * Inserts the submesh in its correct queue depending on its material.
  13254. * @param subMesh The submesh to dispatch
  13255. */
  13256. dispatch(subMesh: SubMesh): void;
  13257. dispatchSprites(spriteManager: SpriteManager): void;
  13258. dispatchParticles(particleSystem: IParticleSystem): void;
  13259. }
  13260. }
  13261. declare module BABYLON {
  13262. class RenderingManager {
  13263. /**
  13264. * The max id used for rendering groups (not included)
  13265. */
  13266. static MAX_RENDERINGGROUPS: number;
  13267. /**
  13268. * The min id used for rendering groups (included)
  13269. */
  13270. static MIN_RENDERINGGROUPS: number;
  13271. /**
  13272. * Used to globally prevent autoclearing scenes.
  13273. */
  13274. static AUTOCLEAR: boolean;
  13275. constructor(scene: Scene);
  13276. render(customRenderFunction: Nullable<(opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, depthOnlySubMeshes: SmartArray<SubMesh>) => void>, activeMeshes: Nullable<AbstractMesh[]>, renderParticles: boolean, renderSprites: boolean): void;
  13277. reset(): void;
  13278. dispose(): void;
  13279. dispatchSprites(spriteManager: SpriteManager): void;
  13280. dispatchParticles(particleSystem: IParticleSystem): void;
  13281. dispatch(subMesh: SubMesh): void;
  13282. /**
  13283. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  13284. * This allowed control for front to back rendering or reversly depending of the special needs.
  13285. *
  13286. * @param renderingGroupId The rendering group id corresponding to its index
  13287. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  13288. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  13289. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  13290. */
  13291. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, alphaTestSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, transparentSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>): void;
  13292. /**
  13293. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  13294. *
  13295. * @param renderingGroupId The rendering group id corresponding to its index
  13296. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  13297. * @param depth Automatically clears depth between groups if true and autoClear is true.
  13298. * @param stencil Automatically clears stencil between groups if true and autoClear is true.
  13299. */
  13300. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth?: boolean, stencil?: boolean): void;
  13301. }
  13302. }
  13303. declare module BABYLON {
  13304. class ReflectionProbe {
  13305. name: string;
  13306. invertYAxis: boolean;
  13307. position: Vector3;
  13308. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  13309. samples: number;
  13310. refreshRate: number;
  13311. getScene(): Scene;
  13312. readonly cubeTexture: RenderTargetTexture;
  13313. readonly renderList: Nullable<AbstractMesh[]>;
  13314. attachToMesh(mesh: AbstractMesh): void;
  13315. /**
  13316. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  13317. *
  13318. * @param renderingGroupId The rendering group id corresponding to its index
  13319. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  13320. */
  13321. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  13322. dispose(): void;
  13323. }
  13324. }
  13325. declare module BABYLON {
  13326. class AnaglyphPostProcess extends PostProcess {
  13327. constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
  13328. }
  13329. }
  13330. declare module BABYLON {
  13331. class BlackAndWhitePostProcess extends PostProcess {
  13332. degree: number;
  13333. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13334. }
  13335. }
  13336. declare module BABYLON {
  13337. class BlurPostProcess extends PostProcess {
  13338. direction: Vector2;
  13339. /**
  13340. * Gets the length in pixels of the blur sample region
  13341. */
  13342. /**
  13343. * Sets the length in pixels of the blur sample region
  13344. */
  13345. kernel: number;
  13346. /**
  13347. * Gets wether or not the blur is unpacking/repacking floats
  13348. */
  13349. /**
  13350. * Sets wether or not the blur needs to unpack/repack floats
  13351. */
  13352. packedFloat: boolean;
  13353. constructor(name: string, direction: Vector2, kernel: number, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
  13354. /**
  13355. * Best kernels are odd numbers that when divided by 2, their integer part is even, so 5, 9 or 13.
  13356. * Other odd kernels optimize correctly but require proportionally more samples, even kernels are
  13357. * possible but will produce minor visual artifacts. Since each new kernel requires a new shader we
  13358. * want to minimize kernel changes, having gaps between physical kernels is helpful in that regard.
  13359. * The gaps between physical kernels are compensated for in the weighting of the samples
  13360. * @param idealKernel Ideal blur kernel.
  13361. * @return Nearest best kernel.
  13362. */
  13363. /**
  13364. * Calculates the value of a Gaussian distribution with sigma 3 at a given point.
  13365. * @param x The point on the Gaussian distribution to sample.
  13366. * @return the value of the Gaussian function at x.
  13367. */
  13368. /**
  13369. * Generates a string that can be used as a floating point number in GLSL.
  13370. * @param x Value to print.
  13371. * @param decimalFigures Number of decimal places to print the number to (excluding trailing 0s).
  13372. * @return GLSL float string.
  13373. */
  13374. }
  13375. }
  13376. declare module BABYLON {
  13377. class ColorCorrectionPostProcess extends PostProcess {
  13378. constructor(name: string, colorTableUrl: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13379. }
  13380. }
  13381. declare module BABYLON {
  13382. class ConvolutionPostProcess extends PostProcess {
  13383. kernel: number[];
  13384. constructor(name: string, kernel: number[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13385. static EdgeDetect0Kernel: number[];
  13386. static EdgeDetect1Kernel: number[];
  13387. static EdgeDetect2Kernel: number[];
  13388. static SharpenKernel: number[];
  13389. static EmbossKernel: number[];
  13390. static GaussianKernel: number[];
  13391. }
  13392. }
  13393. declare module BABYLON {
  13394. class DisplayPassPostProcess extends PostProcess {
  13395. constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13396. }
  13397. }
  13398. declare module BABYLON {
  13399. class FilterPostProcess extends PostProcess {
  13400. kernelMatrix: Matrix;
  13401. constructor(name: string, kernelMatrix: Matrix, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13402. }
  13403. }
  13404. declare module BABYLON {
  13405. class FxaaPostProcess extends PostProcess {
  13406. texelWidth: number;
  13407. texelHeight: number;
  13408. constructor(name: string, options: number | PostProcessOptions, camera?: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
  13409. }
  13410. }
  13411. declare module BABYLON {
  13412. class HighlightsPostProcess extends PostProcess {
  13413. constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
  13414. }
  13415. }
  13416. declare module BABYLON {
  13417. class ImageProcessingPostProcess extends PostProcess {
  13418. /**
  13419. * Default configuration related to image processing available in the PBR Material.
  13420. */
  13421. /**
  13422. * Gets the image processing configuration used either in this material.
  13423. */
  13424. /**
  13425. * Sets the Default image processing configuration used either in the this material.
  13426. *
  13427. * If sets to null, the scene one is in use.
  13428. */
  13429. imageProcessingConfiguration: ImageProcessingConfiguration;
  13430. /**
  13431. * Keep track of the image processing observer to allow dispose and replace.
  13432. */
  13433. /**
  13434. * Attaches a new image processing configuration to the PBR Material.
  13435. * @param configuration
  13436. */
  13437. /**
  13438. * Gets Color curves setup used in the effect if colorCurvesEnabled is set to true .
  13439. */
  13440. /**
  13441. * Sets Color curves setup used in the effect if colorCurvesEnabled is set to true .
  13442. */
  13443. colorCurves: Nullable<ColorCurves>;
  13444. /**
  13445. * Gets wether the color curves effect is enabled.
  13446. */
  13447. /**
  13448. * Sets wether the color curves effect is enabled.
  13449. */
  13450. colorCurvesEnabled: boolean;
  13451. /**
  13452. * Gets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.
  13453. */
  13454. /**
  13455. * Sets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.
  13456. */
  13457. colorGradingTexture: Nullable<BaseTexture>;
  13458. /**
  13459. * Gets wether the color grading effect is enabled.
  13460. */
  13461. /**
  13462. * Gets wether the color grading effect is enabled.
  13463. */
  13464. colorGradingEnabled: boolean;
  13465. /**
  13466. * Gets exposure used in the effect.
  13467. */
  13468. /**
  13469. * Sets exposure used in the effect.
  13470. */
  13471. exposure: number;
  13472. /**
  13473. * Gets wether tonemapping is enabled or not.
  13474. */
  13475. /**
  13476. * Sets wether tonemapping is enabled or not
  13477. */
  13478. toneMappingEnabled: boolean;
  13479. /**
  13480. * Gets contrast used in the effect.
  13481. */
  13482. /**
  13483. * Sets contrast used in the effect.
  13484. */
  13485. contrast: number;
  13486. /**
  13487. * Gets Vignette stretch size.
  13488. */
  13489. /**
  13490. * Sets Vignette stretch size.
  13491. */
  13492. vignetteStretch: number;
  13493. /**
  13494. * Gets Vignette centre X Offset.
  13495. */
  13496. /**
  13497. * Sets Vignette centre X Offset.
  13498. */
  13499. vignetteCentreX: number;
  13500. /**
  13501. * Gets Vignette centre Y Offset.
  13502. */
  13503. /**
  13504. * Sets Vignette centre Y Offset.
  13505. */
  13506. vignetteCentreY: number;
  13507. /**
  13508. * Gets Vignette weight or intensity of the vignette effect.
  13509. */
  13510. /**
  13511. * Sets Vignette weight or intensity of the vignette effect.
  13512. */
  13513. vignetteWeight: number;
  13514. /**
  13515. * Gets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)
  13516. * if vignetteEnabled is set to true.
  13517. */
  13518. /**
  13519. * Sets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)
  13520. * if vignetteEnabled is set to true.
  13521. */
  13522. vignetteColor: Color4;
  13523. /**
  13524. * Gets Camera field of view used by the Vignette effect.
  13525. */
  13526. /**
  13527. * Sets Camera field of view used by the Vignette effect.
  13528. */
  13529. vignetteCameraFov: number;
  13530. /**
  13531. * Gets the vignette blend mode allowing different kind of effect.
  13532. */
  13533. /**
  13534. * Sets the vignette blend mode allowing different kind of effect.
  13535. */
  13536. vignetteBlendMode: number;
  13537. /**
  13538. * Gets wether the vignette effect is enabled.
  13539. */
  13540. /**
  13541. * Sets wether the vignette effect is enabled.
  13542. */
  13543. vignetteEnabled: boolean;
  13544. /**
  13545. * Gets wether the input of the processing is in Gamma or Linear Space.
  13546. */
  13547. /**
  13548. * Sets wether the input of the processing is in Gamma or Linear Space.
  13549. */
  13550. fromLinearSpace: boolean;
  13551. /**
  13552. * Defines cache preventing GC.
  13553. */
  13554. constructor(name: string, options: number | PostProcessOptions, camera?: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number, imageProcessingConfiguration?: ImageProcessingConfiguration);
  13555. getClassName(): string;
  13556. dispose(camera?: Camera): void;
  13557. }
  13558. }
  13559. declare module BABYLON {
  13560. class PassPostProcess extends PostProcess {
  13561. constructor(name: string, options: number | PostProcessOptions, camera?: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
  13562. }
  13563. }
  13564. declare module BABYLON {
  13565. type PostProcessOptions = {
  13566. width: number;
  13567. height: number;
  13568. };
  13569. class PostProcess {
  13570. name: string;
  13571. width: number;
  13572. height: number;
  13573. renderTargetSamplingMode: number;
  13574. clearColor: Color4;
  13575. autoClear: boolean;
  13576. alphaMode: number;
  13577. alphaConstants: Color4;
  13578. animations: Animation[];
  13579. enablePixelPerfectMode: boolean;
  13580. scaleMode: number;
  13581. alwaysForcePOT: boolean;
  13582. samples: number;
  13583. adaptScaleToCurrentViewport: boolean;
  13584. /**
  13585. * An event triggered when the postprocess is activated.
  13586. * @type {BABYLON.Observable}
  13587. */
  13588. onActivateObservable: Observable<Camera>;
  13589. onActivate: Nullable<(camera: Camera) => void>;
  13590. /**
  13591. * An event triggered when the postprocess changes its size.
  13592. * @type {BABYLON.Observable}
  13593. */
  13594. onSizeChangedObservable: Observable<PostProcess>;
  13595. onSizeChanged: (postProcess: PostProcess) => void;
  13596. /**
  13597. * An event triggered when the postprocess applies its effect.
  13598. * @type {BABYLON.Observable}
  13599. */
  13600. onApplyObservable: Observable<Effect>;
  13601. onApply: (effect: Effect) => void;
  13602. /**
  13603. * An event triggered before rendering the postprocess
  13604. * @type {BABYLON.Observable}
  13605. */
  13606. onBeforeRenderObservable: Observable<Effect>;
  13607. onBeforeRender: (effect: Effect) => void;
  13608. /**
  13609. * An event triggered after rendering the postprocess
  13610. * @type {BABYLON.Observable}
  13611. */
  13612. onAfterRenderObservable: Observable<Effect>;
  13613. onAfterRender: (efect: Effect) => void;
  13614. outputTexture: InternalTexture;
  13615. getCamera(): Camera;
  13616. readonly texelSize: Vector2;
  13617. constructor(name: string, fragmentUrl: string, parameters: Nullable<string[]>, samplers: Nullable<string[]>, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: Nullable<string>, textureType?: number, vertexUrl?: string, indexParameters?: any, blockCompilation?: boolean);
  13618. getEngine(): Engine;
  13619. getEffect(): Effect;
  13620. shareOutputWith(postProcess: PostProcess): PostProcess;
  13621. updateEffect(defines?: Nullable<string>, uniforms?: Nullable<string[]>, samplers?: Nullable<string[]>, indexParameters?: any, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): void;
  13622. isReusable(): boolean;
  13623. /** invalidate frameBuffer to hint the postprocess to create a depth buffer */
  13624. markTextureDirty(): void;
  13625. activate(camera: Nullable<Camera>, sourceTexture?: Nullable<InternalTexture>, forceDepthStencil?: boolean): void;
  13626. readonly isSupported: boolean;
  13627. readonly aspectRatio: number;
  13628. apply(): Nullable<Effect>;
  13629. dispose(camera?: Camera): void;
  13630. }
  13631. }
  13632. declare module BABYLON {
  13633. class PostProcessManager {
  13634. constructor(scene: Scene);
  13635. directRender(postProcesses: PostProcess[], targetTexture?: Nullable<InternalTexture>, forceFullscreenViewport?: boolean): void;
  13636. dispose(): void;
  13637. }
  13638. }
  13639. declare module BABYLON {
  13640. class RefractionPostProcess extends PostProcess {
  13641. color: Color3;
  13642. depth: number;
  13643. colorLevel: number;
  13644. constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13645. dispose(camera: Camera): void;
  13646. }
  13647. }
  13648. declare module BABYLON {
  13649. class StereoscopicInterlacePostProcess extends PostProcess {
  13650. constructor(name: string, rigCameras: Camera[], isStereoscopicHoriz: boolean, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13651. }
  13652. }
  13653. declare module BABYLON {
  13654. enum TonemappingOperator {
  13655. Hable = 0,
  13656. Reinhard = 1,
  13657. HejiDawson = 2,
  13658. Photographic = 3,
  13659. }
  13660. class TonemapPostProcess extends PostProcess {
  13661. exposureAdjustment: number;
  13662. constructor(name: string, _operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number);
  13663. }
  13664. }
  13665. declare module BABYLON {
  13666. class VolumetricLightScatteringPostProcess extends PostProcess {
  13667. /**
  13668. * If not undefined, the mesh position is computed from the attached node position
  13669. * @type {{position: Vector3}}
  13670. */
  13671. attachedNode: {
  13672. position: Vector3;
  13673. };
  13674. /**
  13675. * Custom position of the mesh. Used if "useCustomMeshPosition" is set to "true"
  13676. * @type {Vector3}
  13677. */
  13678. customMeshPosition: Vector3;
  13679. /**
  13680. * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)
  13681. * @type {boolean}
  13682. */
  13683. useCustomMeshPosition: boolean;
  13684. /**
  13685. * If the post-process should inverse the light scattering direction
  13686. * @type {boolean}
  13687. */
  13688. invert: boolean;
  13689. /**
  13690. * The internal mesh used by the post-process
  13691. * @type {boolean}
  13692. */
  13693. mesh: Mesh;
  13694. useDiffuseColor: boolean;
  13695. /**
  13696. * Array containing the excluded meshes not rendered in the internal pass
  13697. */
  13698. excludedMeshes: AbstractMesh[];
  13699. /**
  13700. * Controls the overall intensity of the post-process
  13701. * @type {number}
  13702. */
  13703. exposure: number;
  13704. /**
  13705. * Dissipates each sample's contribution in range [0, 1]
  13706. * @type {number}
  13707. */
  13708. decay: number;
  13709. /**
  13710. * Controls the overall intensity of each sample
  13711. * @type {number}
  13712. */
  13713. weight: number;
  13714. /**
  13715. * Controls the density of each sample
  13716. * @type {number}
  13717. */
  13718. density: number;
  13719. /**
  13720. * @constructor
  13721. * @param {string} name - The post-process name
  13722. * @param {any} ratio - The size of the post-process and/or internal pass (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)
  13723. * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to
  13724. * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering
  13725. * @param {number} samples - The post-process quality, default 100
  13726. * @param {number} samplingMode - The post-process filtering mode
  13727. * @param {BABYLON.Engine} engine - The babylon engine
  13728. * @param {boolean} reusable - If the post-process is reusable
  13729. * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided
  13730. */
  13731. constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene);
  13732. getClassName(): string;
  13733. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  13734. /**
  13735. * Sets the new light position for light scattering effect
  13736. * @param {BABYLON.Vector3} The new custom light position
  13737. */
  13738. setCustomMeshPosition(position: Vector3): void;
  13739. /**
  13740. * Returns the light position for light scattering effect
  13741. * @return {BABYLON.Vector3} The custom light position
  13742. */
  13743. getCustomMeshPosition(): Vector3;
  13744. /**
  13745. * Disposes the internal assets and detaches the post-process from the camera
  13746. */
  13747. dispose(camera: Camera): void;
  13748. /**
  13749. * Returns the render target texture used by the post-process
  13750. * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process
  13751. */
  13752. getPass(): RenderTargetTexture;
  13753. /**
  13754. * Creates a default mesh for the Volumeric Light Scattering post-process
  13755. * @param {string} The mesh name
  13756. * @param {BABYLON.Scene} The scene where to create the mesh
  13757. * @return {BABYLON.Mesh} the default mesh
  13758. */
  13759. static CreateDefaultMesh(name: string, scene: Scene): Mesh;
  13760. }
  13761. }
  13762. declare module BABYLON {
  13763. class VRDistortionCorrectionPostProcess extends PostProcess {
  13764. aspectRatio: number;
  13765. constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics);
  13766. }
  13767. }
  13768. declare module BABYLON {
  13769. class Sprite {
  13770. name: string;
  13771. position: Vector3;
  13772. color: Color4;
  13773. width: number;
  13774. height: number;
  13775. angle: number;
  13776. cellIndex: number;
  13777. invertU: number;
  13778. invertV: number;
  13779. disposeWhenFinishedAnimating: boolean;
  13780. animations: Animation[];
  13781. isPickable: boolean;
  13782. actionManager: ActionManager;
  13783. size: number;
  13784. constructor(name: string, manager: SpriteManager);
  13785. playAnimation(from: number, to: number, loop: boolean, delay: number, onAnimationEnd: () => void): void;
  13786. stopAnimation(): void;
  13787. dispose(): void;
  13788. }
  13789. }
  13790. declare module BABYLON {
  13791. class SpriteManager {
  13792. name: string;
  13793. sprites: Sprite[];
  13794. renderingGroupId: number;
  13795. layerMask: number;
  13796. fogEnabled: boolean;
  13797. isPickable: boolean;
  13798. cellWidth: number;
  13799. cellHeight: number;
  13800. /**
  13801. * An event triggered when the manager is disposed.
  13802. * @type {BABYLON.Observable}
  13803. */
  13804. onDisposeObservable: Observable<SpriteManager>;
  13805. onDispose: () => void;
  13806. texture: Texture;
  13807. constructor(name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number);
  13808. intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): Nullable<PickingInfo>;
  13809. render(): void;
  13810. dispose(): void;
  13811. }
  13812. }
  13813. declare module BABYLON.Internals {
  13814. class _AlphaState {
  13815. /**
  13816. * Initializes the state.
  13817. */
  13818. constructor();
  13819. readonly isDirty: boolean;
  13820. alphaBlend: boolean;
  13821. setAlphaBlendConstants(r: number, g: number, b: number, a: number): void;
  13822. setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
  13823. setAlphaEquationParameters(rgb: number, alpha: number): void;
  13824. reset(): void;
  13825. apply(gl: WebGLRenderingContext): void;
  13826. }
  13827. }
  13828. declare module BABYLON.Internals {
  13829. class _DepthCullingState {
  13830. /**
  13831. * Initializes the state.
  13832. */
  13833. constructor();
  13834. readonly isDirty: boolean;
  13835. zOffset: number;
  13836. cullFace: Nullable<number>;
  13837. cull: Nullable<boolean>;
  13838. depthFunc: Nullable<number>;
  13839. depthMask: boolean;
  13840. depthTest: boolean;
  13841. frontFace: Nullable<number>;
  13842. reset(): void;
  13843. apply(gl: WebGLRenderingContext): void;
  13844. }
  13845. }
  13846. declare module BABYLON.Internals {
  13847. class _StencilState {
  13848. readonly isDirty: boolean;
  13849. stencilFunc: number;
  13850. stencilFuncRef: number;
  13851. stencilFuncMask: number;
  13852. stencilOpStencilFail: number;
  13853. stencilOpDepthFail: number;
  13854. stencilOpStencilDepthPass: number;
  13855. stencilMask: number;
  13856. stencilTest: boolean;
  13857. constructor();
  13858. reset(): void;
  13859. apply(gl: WebGLRenderingContext): void;
  13860. }
  13861. }
  13862. declare module BABYLON.Internals {
  13863. class AndOrNotEvaluator {
  13864. static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
  13865. }
  13866. }
  13867. declare module BABYLON {
  13868. enum AssetTaskState {
  13869. INIT = 0,
  13870. RUNNING = 1,
  13871. DONE = 2,
  13872. ERROR = 3,
  13873. }
  13874. abstract class AbstractAssetTask {
  13875. name: string;
  13876. onSuccess: (task: any) => void;
  13877. onError: (task: any, message?: string, exception?: any) => void;
  13878. constructor(name: string);
  13879. isCompleted: boolean;
  13880. taskState: AssetTaskState;
  13881. errorObject: {
  13882. message?: string;
  13883. exception?: any;
  13884. };
  13885. run(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void;
  13886. runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void;
  13887. }
  13888. interface IAssetsProgressEvent {
  13889. remainingCount: number;
  13890. totalCount: number;
  13891. task: AbstractAssetTask;
  13892. }
  13893. class AssetsProgressEvent implements IAssetsProgressEvent {
  13894. remainingCount: number;
  13895. totalCount: number;
  13896. task: AbstractAssetTask;
  13897. constructor(remainingCount: number, totalCount: number, task: AbstractAssetTask);
  13898. }
  13899. class MeshAssetTask extends AbstractAssetTask {
  13900. name: string;
  13901. meshesNames: any;
  13902. rootUrl: string;
  13903. sceneFilename: string;
  13904. loadedMeshes: Array<AbstractMesh>;
  13905. loadedParticleSystems: Array<ParticleSystem>;
  13906. loadedSkeletons: Array<Skeleton>;
  13907. onSuccess: (task: MeshAssetTask) => void;
  13908. onError: (task: MeshAssetTask, message?: string, exception?: any) => void;
  13909. constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string);
  13910. runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void;
  13911. }
  13912. class TextFileAssetTask extends AbstractAssetTask {
  13913. name: string;
  13914. url: string;
  13915. text: string;
  13916. onSuccess: (task: TextFileAssetTask) => void;
  13917. onError: (task: TextFileAssetTask, message?: string, exception?: any) => void;
  13918. constructor(name: string, url: string);
  13919. runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void;
  13920. }
  13921. class BinaryFileAssetTask extends AbstractAssetTask {
  13922. name: string;
  13923. url: string;
  13924. data: ArrayBuffer;
  13925. onSuccess: (task: BinaryFileAssetTask) => void;
  13926. onError: (task: BinaryFileAssetTask, message?: string, exception?: any) => void;
  13927. constructor(name: string, url: string);
  13928. runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void;
  13929. }
  13930. class ImageAssetTask extends AbstractAssetTask {
  13931. name: string;
  13932. url: string;
  13933. image: HTMLImageElement;
  13934. onSuccess: (task: ImageAssetTask) => void;
  13935. onError: (task: ImageAssetTask, message?: string, exception?: any) => void;
  13936. constructor(name: string, url: string);
  13937. runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void;
  13938. }
  13939. interface ITextureAssetTask<TEX extends BaseTexture> {
  13940. texture: TEX;
  13941. }
  13942. class TextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<Texture> {
  13943. name: string;
  13944. url: string;
  13945. noMipmap: boolean | undefined;
  13946. invertY: boolean | undefined;
  13947. samplingMode: number;
  13948. texture: Texture;
  13949. onSuccess: (task: TextureAssetTask) => void;
  13950. onError: (task: TextureAssetTask, message?: string, exception?: any) => void;
  13951. constructor(name: string, url: string, noMipmap?: boolean | undefined, invertY?: boolean | undefined, samplingMode?: number);
  13952. runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void;
  13953. }
  13954. class CubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<CubeTexture> {
  13955. name: string;
  13956. url: string;
  13957. extensions: string[] | undefined;
  13958. noMipmap: boolean | undefined;
  13959. files: string[] | undefined;
  13960. texture: CubeTexture;
  13961. onSuccess: (task: CubeTextureAssetTask) => void;
  13962. onError: (task: CubeTextureAssetTask, message?: string, exception?: any) => void;
  13963. constructor(name: string, url: string, extensions?: string[] | undefined, noMipmap?: boolean | undefined, files?: string[] | undefined);
  13964. runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void;
  13965. }
  13966. class HDRCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<HDRCubeTexture> {
  13967. name: string;
  13968. url: string;
  13969. size: number | undefined;
  13970. noMipmap: boolean;
  13971. generateHarmonics: boolean;
  13972. useInGammaSpace: boolean;
  13973. usePMREMGenerator: boolean;
  13974. texture: HDRCubeTexture;
  13975. onSuccess: (task: HDRCubeTextureAssetTask) => void;
  13976. onError: (task: HDRCubeTextureAssetTask, message?: string, exception?: any) => void;
  13977. constructor(name: string, url: string, size?: number | undefined, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean);
  13978. run(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void;
  13979. }
  13980. class AssetsManager {
  13981. onFinish: (tasks: AbstractAssetTask[]) => void;
  13982. onTaskSuccess: (task: AbstractAssetTask) => void;
  13983. onTaskError: (task: AbstractAssetTask) => void;
  13984. onProgress: (remainingCount: number, totalCount: number, task: AbstractAssetTask) => void;
  13985. onTaskSuccessObservable: Observable<AbstractAssetTask>;
  13986. onTaskErrorObservable: Observable<AbstractAssetTask>;
  13987. onTasksDoneObservable: Observable<AbstractAssetTask[]>;
  13988. onProgressObservable: Observable<IAssetsProgressEvent>;
  13989. useDefaultLoadingScreen: boolean;
  13990. constructor(scene: Scene);
  13991. addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): MeshAssetTask;
  13992. addTextFileTask(taskName: string, url: string): TextFileAssetTask;
  13993. addBinaryFileTask(taskName: string, url: string): BinaryFileAssetTask;
  13994. addImageTask(taskName: string, url: string): ImageAssetTask;
  13995. addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): TextureAssetTask;
  13996. addCubeTextureTask(name: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[]): CubeTextureAssetTask;
  13997. addHDRCubeTextureTask(name: string, url: string, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean): HDRCubeTextureAssetTask;
  13998. reset(): AssetsManager;
  13999. load(): AssetsManager;
  14000. }
  14001. }
  14002. declare module BABYLON {
  14003. class Database {
  14004. static IsUASupportingBlobStorage: boolean;
  14005. static IDBStorageEnabled: boolean;
  14006. readonly enableSceneOffline: boolean;
  14007. readonly enableTexturesOffline: boolean;
  14008. constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any);
  14009. static parseURL: (url: string) => string;
  14010. static ReturnFullUrlLocation: (url: string) => string;
  14011. checkManifestFile(): void;
  14012. openAsync(successCallback: () => void, errorCallback: () => void): void;
  14013. loadImageFromDB(url: string, image: HTMLImageElement): void;
  14014. loadFileFromDB(url: string, sceneLoaded: (data: any) => void, progressCallBack?: (data: any) => void, errorCallback?: () => void, useArrayBuffer?: boolean): void;
  14015. }
  14016. }
  14017. declare module BABYLON.Internals {
  14018. interface DDSInfo {
  14019. width: number;
  14020. height: number;
  14021. mipmapCount: number;
  14022. isFourCC: boolean;
  14023. isRGB: boolean;
  14024. isLuminance: boolean;
  14025. isCube: boolean;
  14026. isCompressed: boolean;
  14027. dxgiFormat: number;
  14028. textureType: number;
  14029. }
  14030. class DDSTools {
  14031. static StoreLODInAlphaChannel: boolean;
  14032. static GetDDSInfo(arrayBuffer: any): DDSInfo;
  14033. static UploadDDSLevels(engine: Engine, gl: WebGLRenderingContext, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number, lodIndex?: number, currentFace?: number): void;
  14034. }
  14035. }
  14036. declare module BABYLON {
  14037. function expandToProperty(callback: string, targetKey?: Nullable<string>): (target: any, propertyKey: string) => void;
  14038. function serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14039. function serializeAsTexture(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14040. function serializeAsColor3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14041. function serializeAsFresnelParameters(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14042. function serializeAsVector2(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14043. function serializeAsVector3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14044. function serializeAsMeshReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14045. function serializeAsColorCurves(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14046. function serializeAsColor4(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14047. function serializeAsImageProcessingConfiguration(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14048. function serializeAsQuaternion(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14049. class SerializationHelper {
  14050. static Serialize<T>(entity: T, serializationObject?: any): any;
  14051. static Parse<T>(creationFunction: () => T, source: any, scene: Nullable<Scene>, rootUrl?: Nullable<string>): T;
  14052. static Clone<T>(creationFunction: () => T, source: T): T;
  14053. static Instanciate<T>(creationFunction: () => T, source: T): T;
  14054. }
  14055. }
  14056. declare module Earcut {
  14057. /**
  14058. * The fastest and smallest JavaScript polygon triangulation library for your WebGL apps
  14059. * @param data is a flat array of vertice coordinates like [x0, y0, x1, y1, x2, y2, ...].
  14060. * @param holeIndices is an array of hole indices if any (e.g. [5, 8] for a 12- vertice input would mean one hole with vertices 5–7 and another with 8–11).
  14061. * @param dim is the number of coordinates per vertice in the input array (2 by default).
  14062. */
  14063. function earcut(data: number[], holeIndices: number[], dim: number): Array<number>;
  14064. /**
  14065. * return a percentage difference between the polygon area and its triangulation area;
  14066. * used to verify correctness of triangulation
  14067. */
  14068. function deviation(data: number[], holeIndices: number[], dim: number, triangles: number[]): number;
  14069. /**
  14070. * turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
  14071. */
  14072. function flatten(data: number[][][]): {
  14073. vertices: number[];
  14074. holes: number[];
  14075. dimensions: number;
  14076. };
  14077. }
  14078. declare module BABYLON {
  14079. class FilesInput {
  14080. static FilesToLoad: {
  14081. [key: string]: File;
  14082. };
  14083. onProcessFileCallback: (file: File, name: string, extension: string) => true;
  14084. constructor(engine: Engine, scene: Scene, sceneLoadedCallback: (sceneFile: File, scene: Scene) => void, progressCallback: (progress: SceneLoaderProgressEvent) => void, additionalRenderLoopLogicCallback: () => void, textureLoadingCallback: (remaining: number) => void, startingProcessingFilesCallback: () => void, onReloadCallback: (sceneFile: File) => void, errorCallback: (sceneFile: File, scene: Scene, message: string) => void);
  14085. monitorElementForDragNDrop(elementToMonitor: HTMLElement): void;
  14086. dispose(): void;
  14087. loadFiles(event: any): void;
  14088. reload(): void;
  14089. }
  14090. }
  14091. declare module BABYLON.Internals {
  14092. /**
  14093. * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
  14094. * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
  14095. */
  14096. class KhronosTextureContainer {
  14097. arrayBuffer: any;
  14098. static HEADER_LEN: number;
  14099. static COMPRESSED_2D: number;
  14100. static COMPRESSED_3D: number;
  14101. static TEX_2D: number;
  14102. static TEX_3D: number;
  14103. glType: number;
  14104. glTypeSize: number;
  14105. glFormat: number;
  14106. glInternalFormat: number;
  14107. glBaseInternalFormat: number;
  14108. pixelWidth: number;
  14109. pixelHeight: number;
  14110. pixelDepth: number;
  14111. numberOfArrayElements: number;
  14112. numberOfFaces: number;
  14113. numberOfMipmapLevels: number;
  14114. bytesOfKeyValueData: number;
  14115. loadType: number;
  14116. /**
  14117. * @param {ArrayBuffer} arrayBuffer- contents of the KTX container file
  14118. * @param {number} facesExpected- should be either 1 or 6, based whether a cube texture or or
  14119. * @param {boolean} threeDExpected- provision for indicating that data should be a 3D texture, not implemented
  14120. * @param {boolean} textureArrayExpected- provision for indicating that data should be a texture array, not implemented
  14121. */
  14122. constructor(arrayBuffer: any, facesExpected: number, threeDExpected?: boolean, textureArrayExpected?: boolean);
  14123. switchEndainness(val: number): number;
  14124. /**
  14125. * It is assumed that the texture has already been created & is currently bound
  14126. */
  14127. uploadLevels(gl: WebGLRenderingContext, loadMipmaps: boolean): void;
  14128. }
  14129. }
  14130. declare module BABYLON {
  14131. /**
  14132. * A class serves as a medium between the observable and its observers
  14133. */
  14134. class EventState {
  14135. /**
  14136. * If the callback of a given Observer set skipNextObservers to true the following observers will be ignored
  14137. */
  14138. constructor(mask: number, skipNextObservers?: boolean, target?: any, currentTarget?: any);
  14139. initalize(mask: number, skipNextObservers?: boolean, target?: any, currentTarget?: any): EventState;
  14140. /**
  14141. * An Observer can set this property to true to prevent subsequent observers of being notified
  14142. */
  14143. skipNextObservers: boolean;
  14144. /**
  14145. * Get the mask value that were used to trigger the event corresponding to this EventState object
  14146. */
  14147. mask: number;
  14148. /**
  14149. * The object that originally notified the event
  14150. */
  14151. target?: any;
  14152. /**
  14153. * The current object in the bubbling phase
  14154. */
  14155. currentTarget?: any;
  14156. }
  14157. /**
  14158. * Represent an Observer registered to a given Observable object.
  14159. */
  14160. class Observer<T> {
  14161. callback: (eventData: T, eventState: EventState) => void;
  14162. mask: number;
  14163. scope: any;
  14164. constructor(callback: (eventData: T, eventState: EventState) => void, mask: number, scope?: any);
  14165. }
  14166. /**
  14167. * Represent a list of observers registered to multiple Observables object.
  14168. */
  14169. class MultiObserver<T> {
  14170. dispose(): void;
  14171. static Watch<T>(observables: Observable<T>[], callback: (eventData: T, eventState: EventState) => void, mask?: number, scope?: any): MultiObserver<T>;
  14172. }
  14173. /**
  14174. * The Observable class is a simple implementation of the Observable pattern.
  14175. * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.
  14176. * This enable a more fine grained execution without having to rely on multiple different Observable objects.
  14177. * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).
  14178. * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.
  14179. */
  14180. class Observable<T> {
  14181. constructor(onObserverAdded?: (observer: Observer<T>) => void);
  14182. /**
  14183. * Create a new Observer with the specified callback
  14184. * @param callback the callback that will be executed for that Observer
  14185. * @param mask the mask used to filter observers
  14186. * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.
  14187. * @param scope optional scope for the callback to be called from
  14188. */
  14189. add(callback: (eventData: T, eventState: EventState) => void, mask?: number, insertFirst?: boolean, scope?: any): Nullable<Observer<T>>;
  14190. /**
  14191. * Remove an Observer from the Observable object
  14192. * @param observer the instance of the Observer to remove. If it doesn't belong to this Observable, false will be returned.
  14193. */
  14194. remove(observer: Nullable<Observer<T>>): boolean;
  14195. /**
  14196. * Remove a callback from the Observable object
  14197. * @param callback the callback to remove. If it doesn't belong to this Observable, false will be returned.
  14198. */
  14199. removeCallback(callback: (eventData: T, eventState: EventState) => void): boolean;
  14200. /**
  14201. * Notify all Observers by calling their respective callback with the given data
  14202. * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute
  14203. * @param eventData
  14204. * @param mask
  14205. */
  14206. notifyObservers(eventData: T, mask?: number, target?: any, currentTarget?: any): boolean;
  14207. /**
  14208. * Notify a specific observer
  14209. * @param eventData
  14210. * @param mask
  14211. */
  14212. notifyObserver(observer: Observer<T>, eventData: T, mask?: number): void;
  14213. /**
  14214. * return true is the Observable has at least one Observer registered
  14215. */
  14216. hasObservers(): boolean;
  14217. /**
  14218. * Clear the list of observers
  14219. */
  14220. clear(): void;
  14221. /**
  14222. * Clone the current observable
  14223. */
  14224. clone(): Observable<T>;
  14225. /**
  14226. * Does this observable handles observer registered with a given mask
  14227. * @param {number} trigger - the mask to be tested
  14228. * @return {boolean} whether or not one observer registered with the given mask is handeled
  14229. **/
  14230. hasSpecificMask(mask?: number): boolean;
  14231. }
  14232. }
  14233. declare namespace BABYLON {
  14234. /**
  14235. * Performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window
  14236. */
  14237. class PerformanceMonitor {
  14238. /**
  14239. * constructor
  14240. * @param frameSampleSize The number of samples required to saturate the sliding window
  14241. */
  14242. constructor(frameSampleSize?: number);
  14243. /**
  14244. * Samples current frame
  14245. * @param timeMs A timestamp in milliseconds of the current frame to compare with other frames
  14246. */
  14247. sampleFrame(timeMs?: number): void;
  14248. /**
  14249. * Returns the average frame time in milliseconds over the sliding window (or the subset of frames sampled so far)
  14250. * @return Average frame time in milliseconds
  14251. */
  14252. readonly averageFrameTime: number;
  14253. /**
  14254. * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far)
  14255. * @return Frame time variance in milliseconds squared
  14256. */
  14257. readonly averageFrameTimeVariance: number;
  14258. /**
  14259. * Returns the frame time of the most recent frame
  14260. * @return Frame time in milliseconds
  14261. */
  14262. readonly instantaneousFrameTime: number;
  14263. /**
  14264. * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)
  14265. * @return Framerate in frames per second
  14266. */
  14267. readonly averageFPS: number;
  14268. /**
  14269. * Returns the average framerate in frames per second using the most recent frame time
  14270. * @return Framerate in frames per second
  14271. */
  14272. readonly instantaneousFPS: number;
  14273. /**
  14274. * Returns true if enough samples have been taken to completely fill the sliding window
  14275. * @return true if saturated
  14276. */
  14277. readonly isSaturated: boolean;
  14278. /**
  14279. * Enables contributions to the sliding window sample set
  14280. */
  14281. enable(): void;
  14282. /**
  14283. * Disables contributions to the sliding window sample set
  14284. * Samples will not be interpolated over the disabled period
  14285. */
  14286. disable(): void;
  14287. /**
  14288. * Returns true if sampling is enabled
  14289. * @return true if enabled
  14290. */
  14291. readonly isEnabled: boolean;
  14292. /**
  14293. * Resets performance monitor
  14294. */
  14295. reset(): void;
  14296. }
  14297. /**
  14298. * RollingAverage
  14299. *
  14300. * Utility to efficiently compute the rolling average and variance over a sliding window of samples
  14301. */
  14302. class RollingAverage {
  14303. /**
  14304. * Current average
  14305. */
  14306. average: number;
  14307. /**
  14308. * Current variance
  14309. */
  14310. variance: number;
  14311. /**
  14312. * constructor
  14313. * @param length The number of samples required to saturate the sliding window
  14314. */
  14315. constructor(length: number);
  14316. /**
  14317. * Adds a sample to the sample set
  14318. * @param v The sample value
  14319. */
  14320. add(v: number): void;
  14321. /**
  14322. * Returns previously added values or null if outside of history or outside the sliding window domain
  14323. * @param i Index in history. For example, pass 0 for the most recent value and 1 for the value before that
  14324. * @return Value previously recorded with add() or null if outside of range
  14325. */
  14326. history(i: number): number;
  14327. /**
  14328. * Returns true if enough samples have been taken to completely fill the sliding window
  14329. * @return true if sample-set saturated
  14330. */
  14331. isSaturated(): boolean;
  14332. /**
  14333. * Resets the rolling average (equivalent to 0 samples taken so far)
  14334. */
  14335. reset(): void;
  14336. /**
  14337. * Wraps a value around the sample range boundaries
  14338. * @param i Position in sample range, for example if the sample length is 5, and i is -3, then 2 will be returned.
  14339. * @return Wrapped position in sample range
  14340. */
  14341. }
  14342. }
  14343. declare module BABYLON {
  14344. class SceneOptimization {
  14345. priority: number;
  14346. apply: (scene: Scene) => boolean;
  14347. constructor(priority?: number);
  14348. }
  14349. class TextureOptimization extends SceneOptimization {
  14350. priority: number;
  14351. maximumSize: number;
  14352. constructor(priority?: number, maximumSize?: number);
  14353. apply: (scene: Scene) => boolean;
  14354. }
  14355. class HardwareScalingOptimization extends SceneOptimization {
  14356. priority: number;
  14357. maximumScale: number;
  14358. constructor(priority?: number, maximumScale?: number);
  14359. apply: (scene: Scene) => boolean;
  14360. }
  14361. class ShadowsOptimization extends SceneOptimization {
  14362. apply: (scene: Scene) => boolean;
  14363. }
  14364. class PostProcessesOptimization extends SceneOptimization {
  14365. apply: (scene: Scene) => boolean;
  14366. }
  14367. class LensFlaresOptimization extends SceneOptimization {
  14368. apply: (scene: Scene) => boolean;
  14369. }
  14370. class ParticlesOptimization extends SceneOptimization {
  14371. apply: (scene: Scene) => boolean;
  14372. }
  14373. class RenderTargetsOptimization extends SceneOptimization {
  14374. apply: (scene: Scene) => boolean;
  14375. }
  14376. class MergeMeshesOptimization extends SceneOptimization {
  14377. static UpdateSelectionTree: boolean;
  14378. apply: (scene: Scene, updateSelectionTree?: boolean | undefined) => boolean;
  14379. }
  14380. class SceneOptimizerOptions {
  14381. targetFrameRate: number;
  14382. trackerDuration: number;
  14383. optimizations: SceneOptimization[];
  14384. constructor(targetFrameRate?: number, trackerDuration?: number);
  14385. static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  14386. static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  14387. static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  14388. }
  14389. class SceneOptimizer {
  14390. static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void;
  14391. }
  14392. }
  14393. declare module BABYLON {
  14394. class SceneSerializer {
  14395. static ClearCache(): void;
  14396. static Serialize(scene: Scene): any;
  14397. static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any;
  14398. }
  14399. }
  14400. declare module BABYLON {
  14401. class SmartArray<T> {
  14402. data: Array<T>;
  14403. length: number;
  14404. [index: number]: T;
  14405. constructor(capacity: number);
  14406. push(value: T): void;
  14407. forEach(func: (content: T) => void): void;
  14408. sort(compareFn: (a: T, b: T) => number): void;
  14409. reset(): void;
  14410. dispose(): void;
  14411. concat(array: any): void;
  14412. indexOf(value: T): number;
  14413. contains(value: T): boolean;
  14414. }
  14415. class SmartArrayNoDuplicate<T> extends SmartArray<T> {
  14416. [index: number]: T;
  14417. push(value: T): void;
  14418. pushNoDuplicate(value: T): boolean;
  14419. reset(): void;
  14420. concatWithNoDuplicate(array: any): void;
  14421. }
  14422. }
  14423. declare module BABYLON {
  14424. /**
  14425. * This class implement a typical dictionary using a string as key and the generic type T as value.
  14426. * The underlying implementation relies on an associative array to ensure the best performances.
  14427. * The value can be anything including 'null' but except 'undefined'
  14428. */
  14429. class StringDictionary<T> {
  14430. /**
  14431. * This will clear this dictionary and copy the content from the 'source' one.
  14432. * If the T value is a custom object, it won't be copied/cloned, the same object will be used
  14433. * @param source the dictionary to take the content from and copy to this dictionary
  14434. */
  14435. copyFrom(source: StringDictionary<T>): void;
  14436. /**
  14437. * Get a value based from its key
  14438. * @param key the given key to get the matching value from
  14439. * @return the value if found, otherwise undefined is returned
  14440. */
  14441. get(key: string): T | undefined;
  14442. /**
  14443. * Get a value from its key or add it if it doesn't exist.
  14444. * This method will ensure you that a given key/data will be present in the dictionary.
  14445. * @param key the given key to get the matching value from
  14446. * @param factory the factory that will create the value if the key is not present in the dictionary.
  14447. * The factory will only be invoked if there's no data for the given key.
  14448. * @return the value corresponding to the key.
  14449. */
  14450. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  14451. /**
  14452. * Get a value from its key if present in the dictionary otherwise add it
  14453. * @param key the key to get the value from
  14454. * @param val if there's no such key/value pair in the dictionary add it with this value
  14455. * @return the value corresponding to the key
  14456. */
  14457. getOrAdd(key: string, val: T): T;
  14458. /**
  14459. * Check if there's a given key in the dictionary
  14460. * @param key the key to check for
  14461. * @return true if the key is present, false otherwise
  14462. */
  14463. contains(key: string): boolean;
  14464. /**
  14465. * Add a new key and its corresponding value
  14466. * @param key the key to add
  14467. * @param value the value corresponding to the key
  14468. * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
  14469. */
  14470. add(key: string, value: T): boolean;
  14471. set(key: string, value: T): boolean;
  14472. /**
  14473. * Get the element of the given key and remove it from the dictionary
  14474. * @param key
  14475. */
  14476. getAndRemove(key: string): Nullable<T>;
  14477. /**
  14478. * Remove a key/value from the dictionary.
  14479. * @param key the key to remove
  14480. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  14481. */
  14482. remove(key: string): boolean;
  14483. /**
  14484. * Clear the whole content of the dictionary
  14485. */
  14486. clear(): void;
  14487. readonly count: number;
  14488. /**
  14489. * Execute a callback on each key/val of the dictionary.
  14490. * Note that you can remove any element in this dictionary in the callback implementation
  14491. * @param callback the callback to execute on a given key/value pair
  14492. */
  14493. forEach(callback: (key: string, val: T) => void): void;
  14494. /**
  14495. * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.
  14496. * If the callback returns null or undefined the method will iterate to the next key/value pair
  14497. * Note that you can remove any element in this dictionary in the callback implementation
  14498. * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned
  14499. */
  14500. first<TRes>(callback: (key: string, val: T) => TRes): TRes | null;
  14501. }
  14502. }
  14503. declare module BABYLON {
  14504. class Tags {
  14505. static EnableFor(obj: any): void;
  14506. static DisableFor(obj: any): void;
  14507. static HasTags(obj: any): boolean;
  14508. static GetTags(obj: any, asString?: boolean): any;
  14509. static AddTagsTo(obj: any, tagsString: string): void;
  14510. static RemoveTagsFrom(obj: any, tagsString: string): void;
  14511. static MatchesQuery(obj: any, tagsQuery: string): boolean;
  14512. }
  14513. }
  14514. declare module BABYLON {
  14515. class TextureTools {
  14516. /**
  14517. * Uses the GPU to create a copy texture rescaled at a given size
  14518. * @param texture Texture to copy from
  14519. * @param width Desired width
  14520. * @param height Desired height
  14521. * @return Generated texture
  14522. */
  14523. static CreateResizedCopy(texture: Texture, width: number, height: number, useBilinearMode?: boolean): Texture;
  14524. static GetEnvironmentBRDFTexture(scene: Scene): BaseTexture;
  14525. }
  14526. }
  14527. declare module BABYLON.Internals {
  14528. class TGATools {
  14529. static GetTGAHeader(data: Uint8Array): any;
  14530. static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void;
  14531. }
  14532. }
  14533. declare module BABYLON {
  14534. interface IAnimatable {
  14535. animations: Array<Animation>;
  14536. }
  14537. class LoadFileError extends Error {
  14538. request: XMLHttpRequest | undefined;
  14539. constructor(message: string, request?: XMLHttpRequest | undefined);
  14540. }
  14541. class RetryStrategy {
  14542. static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: XMLHttpRequest, retryIndex: number) => number;
  14543. }
  14544. interface IFileRequest {
  14545. /**
  14546. * Raised when the request is complete (success or error).
  14547. */
  14548. onCompleteObservable: Observable<IFileRequest>;
  14549. /**
  14550. * Aborts the request for a file.
  14551. */
  14552. abort: () => void;
  14553. }
  14554. class Tools {
  14555. static BaseUrl: string;
  14556. static DefaultRetryStrategy: (url: string, request: XMLHttpRequest, retryIndex: number) => number;
  14557. /**
  14558. * Default behaviour for cors in the application.
  14559. * It can be a string if the expected behavior is identical in the entire app.
  14560. * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)
  14561. */
  14562. static CorsBehavior: string | ((url: string | string[]) => string);
  14563. static UseFallbackTexture: boolean;
  14564. /**
  14565. * Use this object to register external classes like custom textures or material
  14566. * to allow the laoders to instantiate them
  14567. */
  14568. static RegisteredExternalClasses: {
  14569. [key: string]: Object;
  14570. };
  14571. static fallbackTexture: string;
  14572. /**
  14573. * Interpolates between a and b via alpha
  14574. * @param a The lower value (returned when alpha = 0)
  14575. * @param b The upper value (returned when alpha = 1)
  14576. * @param alpha The interpolation-factor
  14577. * @return The mixed value
  14578. */
  14579. static Mix(a: number, b: number, alpha: number): number;
  14580. static Instantiate(className: string): any;
  14581. static SetImmediate(action: () => void): void;
  14582. static IsExponentOfTwo(value: number): boolean;
  14583. /**
  14584. * Find the next highest power of two.
  14585. * @param x Number to start search from.
  14586. * @return Next highest power of two.
  14587. */
  14588. static CeilingPOT(x: number): number;
  14589. /**
  14590. * Find the next lowest power of two.
  14591. * @param x Number to start search from.
  14592. * @return Next lowest power of two.
  14593. */
  14594. static FloorPOT(x: number): number;
  14595. /**
  14596. * Find the nearest power of two.
  14597. * @param x Number to start search from.
  14598. * @return Next nearest power of two.
  14599. */
  14600. static NearestPOT(x: number): number;
  14601. static GetExponentOfTwo(value: number, max: number, mode?: number): number;
  14602. static GetFilename(path: string): string;
  14603. static GetFolderPath(uri: string): string;
  14604. static GetDOMTextContent(element: HTMLElement): string;
  14605. static ToDegrees(angle: number): number;
  14606. static ToRadians(angle: number): number;
  14607. static EncodeArrayBufferTobase64(buffer: ArrayBuffer): string;
  14608. static ExtractMinAndMaxIndexed(positions: FloatArray, indices: IndicesArray, indexStart: number, indexCount: number, bias?: Nullable<Vector2>): {
  14609. minimum: Vector3;
  14610. maximum: Vector3;
  14611. };
  14612. static ExtractMinAndMax(positions: FloatArray, start: number, count: number, bias?: Nullable<Vector2>, stride?: number): {
  14613. minimum: Vector3;
  14614. maximum: Vector3;
  14615. };
  14616. static Vector2ArrayFeeder(array: Array<Vector2> | Float32Array): (i: number) => Nullable<Vector2>;
  14617. static ExtractMinAndMaxVector2(feeder: (index: number) => Vector2, bias?: Nullable<Vector2>): {
  14618. minimum: Vector2;
  14619. maximum: Vector2;
  14620. };
  14621. static MakeArray(obj: any, allowsNullUndefined?: boolean): Nullable<Array<any>>;
  14622. static GetPointerPrefix(): string;
  14623. /**
  14624. * @param func - the function to be called
  14625. * @param requester - the object that will request the next frame. Falls back to window.
  14626. */
  14627. static QueueNewFrame(func: () => void, requester?: any): number;
  14628. static RequestFullscreen(element: HTMLElement): void;
  14629. static ExitFullscreen(): void;
  14630. static SetCorsBehavior(url: string | string[], element: {
  14631. crossOrigin: string | null;
  14632. }): void;
  14633. static CleanUrl(url: string): string;
  14634. static PreprocessUrl: (url: string) => string;
  14635. static LoadImage(url: any, onLoad: (img: HTMLImageElement) => void, onError: (message?: string, exception?: any) => void, database: Nullable<Database>): HTMLImageElement;
  14636. static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, database?: Database, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
  14637. /**
  14638. * Load a script (identified by an url). When the url returns, the
  14639. * content of this file is added into a new script element, attached to the DOM (body element)
  14640. */
  14641. static LoadScript(scriptUrl: string, onSuccess: () => void, onError?: (message?: string, exception?: any) => void): void;
  14642. static ReadFileAsDataURL(fileToLoad: Blob, callback: (data: any) => void, progressCallback: (this: MSBaseReader, ev: ProgressEvent) => any): IFileRequest;
  14643. static ReadFile(fileToLoad: File, callback: (data: any) => void, progressCallBack?: (this: MSBaseReader, ev: ProgressEvent) => any, useArrayBuffer?: boolean): IFileRequest;
  14644. static FileAsURL(content: string): string;
  14645. static Format(value: number, decimals?: number): string;
  14646. static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
  14647. static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
  14648. static IsEmpty(obj: any): boolean;
  14649. static RegisterTopRootEvents(events: {
  14650. name: string;
  14651. handler: Nullable<(e: FocusEvent) => any>;
  14652. }[]): void;
  14653. static UnregisterTopRootEvents(events: {
  14654. name: string;
  14655. handler: Nullable<(e: FocusEvent) => any>;
  14656. }[]): void;
  14657. static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void, mimeType?: string, fileName?: string): void;
  14658. static EncodeScreenshotCanvasData(successCallback?: (data: string) => void, mimeType?: string, fileName?: string): void;
  14659. static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
  14660. static CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string): void;
  14661. static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
  14662. /**
  14663. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  14664. * Be aware Math.random() could cause collisions, but:
  14665. * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
  14666. */
  14667. static RandomId(): string;
  14668. static errorsCount: number;
  14669. static OnNewCacheEntry: (entry: string) => void;
  14670. static readonly NoneLogLevel: number;
  14671. static readonly MessageLogLevel: number;
  14672. static readonly WarningLogLevel: number;
  14673. static readonly ErrorLogLevel: number;
  14674. static readonly AllLogLevel: number;
  14675. static Log: (message: string) => void;
  14676. static Warn: (message: string) => void;
  14677. static Error: (message: string) => void;
  14678. static readonly LogCache: string;
  14679. static ClearLogCache(): void;
  14680. static LogLevels: number;
  14681. static IsWindowObjectExist(): boolean;
  14682. static readonly PerformanceNoneLogLevel: number;
  14683. static readonly PerformanceUserMarkLogLevel: number;
  14684. static readonly PerformanceConsoleLogLevel: number;
  14685. static PerformanceLogLevel: number;
  14686. static StartPerformanceCounter: (counterName: string, condition?: boolean) => void;
  14687. static EndPerformanceCounter: (counterName: string, condition?: boolean) => void;
  14688. static readonly Now: number;
  14689. /**
  14690. * This method will return the name of the class used to create the instance of the given object.
  14691. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.
  14692. * @param object the object to get the class name from
  14693. * @return the name of the class, will be "object" for a custom data type not using the @className decorator
  14694. */
  14695. static GetClassName(object: any, isType?: boolean): string;
  14696. static First<T>(array: Array<T>, predicate: (item: T) => boolean): Nullable<T>;
  14697. /**
  14698. * This method will return the name of the full name of the class, including its owning module (if any).
  14699. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).
  14700. * @param object the object to get the class name from
  14701. * @return a string that can have two forms: "moduleName.className" if module was specified when the class' Name was registered or "className" if there was not module specified.
  14702. */
  14703. static getFullClassName(object: any, isType?: boolean): Nullable<string>;
  14704. /**
  14705. * This method can be used with hashCodeFromStream when your input is an array of values that are either: number, string, boolean or custom type implementing the getHashCode():number method.
  14706. * @param array
  14707. */
  14708. static arrayOrStringFeeder(array: any): (i: number) => number;
  14709. /**
  14710. * Compute the hashCode of a stream of number
  14711. * To compute the HashCode on a string or an Array of data types implementing the getHashCode() method, use the arrayOrStringFeeder method.
  14712. * @param feeder a callback that will be called until it returns null, each valid returned values will be used to compute the hash code.
  14713. * @return the hash code computed
  14714. */
  14715. static hashCodeFromStream(feeder: (index: number) => number): number;
  14716. }
  14717. /**
  14718. * This class is used to track a performance counter which is number based.
  14719. * The user has access to many properties which give statistics of different nature
  14720. *
  14721. * The implementer can track two kinds of Performance Counter: time and count
  14722. * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.
  14723. * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.
  14724. */
  14725. class PerfCounter {
  14726. static Enabled: boolean;
  14727. /**
  14728. * Returns the smallest value ever
  14729. */
  14730. readonly min: number;
  14731. /**
  14732. * Returns the biggest value ever
  14733. */
  14734. readonly max: number;
  14735. /**
  14736. * Returns the average value since the performance counter is running
  14737. */
  14738. readonly average: number;
  14739. /**
  14740. * Returns the average value of the last second the counter was monitored
  14741. */
  14742. readonly lastSecAverage: number;
  14743. /**
  14744. * Returns the current value
  14745. */
  14746. readonly current: number;
  14747. readonly total: number;
  14748. readonly count: number;
  14749. constructor();
  14750. /**
  14751. * Call this method to start monitoring a new frame.
  14752. * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.
  14753. */
  14754. fetchNewFrame(): void;
  14755. /**
  14756. * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
  14757. * @param newCount the count value to add to the monitored count
  14758. * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.
  14759. */
  14760. addCount(newCount: number, fetchResult: boolean): void;
  14761. /**
  14762. * Start monitoring this performance counter
  14763. */
  14764. beginMonitoring(): void;
  14765. /**
  14766. * Compute the time lapsed since the previous beginMonitoring() call.
  14767. * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter
  14768. */
  14769. endMonitoring(newFrame?: boolean): void;
  14770. }
  14771. /**
  14772. * Use this className as a decorator on a given class definition to add it a name and optionally its module.
  14773. * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.
  14774. * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified
  14775. * @param name The name of the class, case should be preserved
  14776. * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.
  14777. */
  14778. function className(name: string, module?: string): (target: Object) => void;
  14779. /**
  14780. * An implementation of a loop for asynchronous functions.
  14781. */
  14782. class AsyncLoop {
  14783. iterations: number;
  14784. index: number;
  14785. /**
  14786. * Constroctor.
  14787. * @param iterations the number of iterations.
  14788. * @param _fn the function to run each iteration
  14789. * @param _successCallback the callback that will be called upon succesful execution
  14790. * @param offset starting offset.
  14791. */
  14792. constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number);
  14793. /**
  14794. * Execute the next iteration. Must be called after the last iteration was finished.
  14795. */
  14796. executeNext(): void;
  14797. /**
  14798. * Break the loop and run the success callback.
  14799. */
  14800. breakLoop(): void;
  14801. /**
  14802. * Helper function
  14803. */
  14804. static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop;
  14805. /**
  14806. * A for-loop that will run a given number of iterations synchronous and the rest async.
  14807. * @param iterations total number of iterations
  14808. * @param syncedIterations number of synchronous iterations in each async iteration.
  14809. * @param fn the function to call each iteration.
  14810. * @param callback a success call back that will be called when iterating stops.
  14811. * @param breakFunction a break condition (optional)
  14812. * @param timeout timeout settings for the setTimeout function. default - 0.
  14813. * @constructor
  14814. */
  14815. static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void;
  14816. }
  14817. }
  14818. declare module BABYLON {
  14819. enum JoystickAxis {
  14820. X = 0,
  14821. Y = 1,
  14822. Z = 2,
  14823. }
  14824. class VirtualJoystick {
  14825. reverseLeftRight: boolean;
  14826. reverseUpDown: boolean;
  14827. deltaPosition: Vector3;
  14828. pressed: boolean;
  14829. constructor(leftJoystick?: boolean);
  14830. setJoystickSensibility(newJoystickSensibility: number): void;
  14831. /**
  14832. * Change the color of the virtual joystick
  14833. * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
  14834. */
  14835. setJoystickColor(newColor: string): void;
  14836. setActionOnTouch(action: () => any): void;
  14837. setAxisForLeftRight(axis: JoystickAxis): void;
  14838. setAxisForUpDown(axis: JoystickAxis): void;
  14839. releaseCanvas(): void;
  14840. }
  14841. }
  14842. declare module BABYLON {
  14843. class AutoRotationBehavior implements Behavior<ArcRotateCamera> {
  14844. readonly name: string;
  14845. /**
  14846. * Gets the flag that indicates if user zooming should stop animation.
  14847. */
  14848. /**
  14849. * Sets the flag that indicates if user zooming should stop animation.
  14850. */
  14851. zoomStopsAnimation: boolean;
  14852. /**
  14853. * Gets the default speed at which the camera rotates around the model.
  14854. */
  14855. /**
  14856. * Sets the default speed at which the camera rotates around the model.
  14857. */
  14858. idleRotationSpeed: number;
  14859. /**
  14860. * Gets the time (milliseconds) to wait after user interaction before the camera starts rotating.
  14861. */
  14862. /**
  14863. * Sets the time (in milliseconds) to wait after user interaction before the camera starts rotating.
  14864. */
  14865. idleRotationWaitTime: number;
  14866. /**
  14867. * Gets the time (milliseconds) to take to spin up to the full idle rotation speed.
  14868. */
  14869. /**
  14870. * Sets the time (milliseconds) to take to spin up to the full idle rotation speed.
  14871. */
  14872. idleRotationSpinupTime: number;
  14873. /**
  14874. * Gets a value indicating if the camera is currently rotating because of this behavior
  14875. */
  14876. readonly rotationInProgress: boolean;
  14877. init(): void;
  14878. attach(camera: ArcRotateCamera): void;
  14879. detach(): void;
  14880. /**
  14881. * Returns true if user is scrolling.
  14882. * @return true if user is scrolling.
  14883. */
  14884. /**
  14885. * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.
  14886. */
  14887. }
  14888. }
  14889. declare module BABYLON {
  14890. /**
  14891. * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius
  14892. */
  14893. class BouncingBehavior implements Behavior<ArcRotateCamera> {
  14894. readonly name: string;
  14895. /**
  14896. * The easing function used by animations
  14897. */
  14898. static EasingFunction: BackEase;
  14899. /**
  14900. * The easing mode used by animations
  14901. */
  14902. static EasingMode: number;
  14903. /**
  14904. * The duration of the animation, in milliseconds
  14905. */
  14906. transitionDuration: number;
  14907. /**
  14908. * Length of the distance animated by the transition when lower radius is reached
  14909. */
  14910. lowerRadiusTransitionRange: number;
  14911. /**
  14912. * Length of the distance animated by the transition when upper radius is reached
  14913. */
  14914. upperRadiusTransitionRange: number;
  14915. /**
  14916. * Gets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically
  14917. */
  14918. /**
  14919. * Sets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically
  14920. * Transition ranges will be set to 5% of the bounding box diagonal in world space
  14921. */
  14922. autoTransitionRange: boolean;
  14923. init(): void;
  14924. attach(camera: ArcRotateCamera): void;
  14925. detach(): void;
  14926. /**
  14927. * Checks if the camera radius is at the specified limit. Takes into account animation locks.
  14928. * @param radiusLimit The limit to check against.
  14929. * @return Bool to indicate if at limit.
  14930. */
  14931. /**
  14932. * Applies an animation to the radius of the camera, extending by the radiusDelta.
  14933. * @param radiusDelta The delta by which to animate to. Can be negative.
  14934. */
  14935. /**
  14936. * Removes all animation locks. Allows new animations to be added to any of the camera properties.
  14937. */
  14938. /**
  14939. * Stops and removes all animations that have been applied to the camera
  14940. */
  14941. stopAllAnimations(): void;
  14942. }
  14943. }
  14944. declare module BABYLON {
  14945. class FramingBehavior implements Behavior<ArcRotateCamera> {
  14946. readonly name: string;
  14947. /**
  14948. * The easing function used by animations
  14949. */
  14950. static EasingFunction: ExponentialEase;
  14951. /**
  14952. * The easing mode used by animations
  14953. */
  14954. static EasingMode: number;
  14955. /**
  14956. * Gets current mode used by the behavior.
  14957. */
  14958. /**
  14959. * Sets the current mode used by the behavior
  14960. */
  14961. mode: number;
  14962. /**
  14963. * Gets the scale applied to the radius
  14964. */
  14965. /**
  14966. * Sets the scale applied to the radius (1 by default)
  14967. */
  14968. radiusScale: number;
  14969. /**
  14970. * Gets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.
  14971. */
  14972. /**
  14973. * Sets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.
  14974. */
  14975. positionScale: number;
  14976. /**
  14977. * Gets the angle above/below the horizontal plane to return to when the return to default elevation idle
  14978. * behaviour is triggered, in radians.
  14979. */
  14980. /**
  14981. * Sets the angle above/below the horizontal plane to return to when the return to default elevation idle
  14982. * behaviour is triggered, in radians.
  14983. */
  14984. defaultElevation: number;
  14985. /**
  14986. * Gets the time (in milliseconds) taken to return to the default beta position.
  14987. * Negative value indicates camera should not return to default.
  14988. */
  14989. /**
  14990. * Sets the time (in milliseconds) taken to return to the default beta position.
  14991. * Negative value indicates camera should not return to default.
  14992. */
  14993. elevationReturnTime: number;
  14994. /**
  14995. * Gets the delay (in milliseconds) taken before the camera returns to the default beta position.
  14996. */
  14997. /**
  14998. * Sets the delay (in milliseconds) taken before the camera returns to the default beta position.
  14999. */
  15000. elevationReturnWaitTime: number;
  15001. /**
  15002. * Gets the flag that indicates if user zooming should stop animation.
  15003. */
  15004. /**
  15005. * Sets the flag that indicates if user zooming should stop animation.
  15006. */
  15007. zoomStopsAnimation: boolean;
  15008. /**
  15009. * Gets the transition time when framing the mesh, in milliseconds
  15010. */
  15011. /**
  15012. * Sets the transition time when framing the mesh, in milliseconds
  15013. */
  15014. framingTime: number;
  15015. init(): void;
  15016. attach(camera: ArcRotateCamera): void;
  15017. detach(): void;
  15018. /**
  15019. * Targets the given mesh and updates zoom level accordingly.
  15020. * @param mesh The mesh to target.
  15021. * @param radius Optional. If a cached radius position already exists, overrides default.
  15022. * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top
  15023. * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh
  15024. * @param onAnimationEnd Callback triggered at the end of the framing animation
  15025. */
  15026. zoomOnMesh(mesh: AbstractMesh, focusOnOriginXZ?: boolean, onAnimationEnd?: Nullable<() => void>): void;
  15027. /**
  15028. * Targets the given mesh with its children and updates zoom level accordingly.
  15029. * @param mesh The mesh to target.
  15030. * @param radius Optional. If a cached radius position already exists, overrides default.
  15031. * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top
  15032. * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh
  15033. * @param onAnimationEnd Callback triggered at the end of the framing animation
  15034. */
  15035. zoomOnMeshHierarchy(mesh: AbstractMesh, focusOnOriginXZ?: boolean, onAnimationEnd?: Nullable<() => void>): void;
  15036. /**
  15037. * Targets the given meshes with their children and updates zoom level accordingly.
  15038. * @param meshes The mesh to target.
  15039. * @param radius Optional. If a cached radius position already exists, overrides default.
  15040. * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top
  15041. * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh
  15042. * @param onAnimationEnd Callback triggered at the end of the framing animation
  15043. */
  15044. zoomOnMeshesHierarchy(meshes: AbstractMesh[], focusOnOriginXZ?: boolean, onAnimationEnd?: Nullable<() => void>): void;
  15045. /**
  15046. * Targets the given mesh and updates zoom level accordingly.
  15047. * @param mesh The mesh to target.
  15048. * @param radius Optional. If a cached radius position already exists, overrides default.
  15049. * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top
  15050. * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh
  15051. * @param onAnimationEnd Callback triggered at the end of the framing animation
  15052. */
  15053. zoomOnBoundingInfo(minimumWorld: Vector3, maximumWorld: Vector3, focusOnOriginXZ?: boolean, onAnimationEnd?: Nullable<() => void>): void;
  15054. /**
  15055. * Calculates the lowest radius for the camera based on the bounding box of the mesh.
  15056. * @param mesh The mesh on which to base the calculation. mesh boundingInfo used to estimate necessary
  15057. * frustum width.
  15058. * @return The minimum distance from the primary mesh's center point at which the camera must be kept in order
  15059. * to fully enclose the mesh in the viewing frustum.
  15060. */
  15061. /**
  15062. * Keeps the camera above the ground plane. If the user pulls the camera below the ground plane, the camera
  15063. * is automatically returned to its default position (expected to be above ground plane).
  15064. */
  15065. /**
  15066. * Returns the frustum slope based on the canvas ratio and camera FOV
  15067. * @returns The frustum slope represented as a Vector2 with X and Y slopes
  15068. */
  15069. /**
  15070. * Removes all animation locks. Allows new animations to be added to any of the arcCamera properties.
  15071. */
  15072. /**
  15073. * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.
  15074. */
  15075. /**
  15076. * Stops and removes all animations that have been applied to the camera
  15077. */
  15078. stopAllAnimations(): void;
  15079. /**
  15080. * Gets a value indicating if the user is moving the camera
  15081. */
  15082. readonly isUserIsMoving: boolean;
  15083. /**
  15084. * The camera can move all the way towards the mesh.
  15085. */
  15086. static IgnoreBoundsSizeMode: number;
  15087. /**
  15088. * The camera is not allowed to zoom closer to the mesh than the point at which the adjusted bounding sphere touches the frustum sides
  15089. */
  15090. static FitFrustumSidesMode: number;
  15091. }
  15092. }
  15093. declare module BABYLON {
  15094. class ArcRotateCameraGamepadInput implements ICameraInput<ArcRotateCamera> {
  15095. camera: ArcRotateCamera;
  15096. gamepad: Nullable<Gamepad>;
  15097. gamepadRotationSensibility: number;
  15098. gamepadMoveSensibility: number;
  15099. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15100. detachControl(element: Nullable<HTMLElement>): void;
  15101. checkInputs(): void;
  15102. getClassName(): string;
  15103. getSimpleName(): string;
  15104. }
  15105. }
  15106. declare module BABYLON {
  15107. class ArcRotateCameraKeyboardMoveInput implements ICameraInput<ArcRotateCamera> {
  15108. camera: ArcRotateCamera;
  15109. keysUp: number[];
  15110. keysDown: number[];
  15111. keysLeft: number[];
  15112. keysRight: number[];
  15113. keysReset: number[];
  15114. panningSensibility: number;
  15115. zoomingSensibility: number;
  15116. useAltToZoom: boolean;
  15117. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15118. detachControl(element: Nullable<HTMLElement>): void;
  15119. checkInputs(): void;
  15120. getClassName(): string;
  15121. getSimpleName(): string;
  15122. }
  15123. }
  15124. declare module BABYLON {
  15125. class ArcRotateCameraMouseWheelInput implements ICameraInput<ArcRotateCamera> {
  15126. camera: ArcRotateCamera;
  15127. wheelPrecision: number;
  15128. /**
  15129. * wheelDeltaPercentage will be used instead of wheelPrecision if different from 0.
  15130. * It defines the percentage of current camera.radius to use as delta when wheel is used.
  15131. */
  15132. wheelDeltaPercentage: number;
  15133. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15134. detachControl(element: Nullable<HTMLElement>): void;
  15135. getClassName(): string;
  15136. getSimpleName(): string;
  15137. }
  15138. }
  15139. declare module BABYLON {
  15140. class ArcRotateCameraPointersInput implements ICameraInput<ArcRotateCamera> {
  15141. camera: ArcRotateCamera;
  15142. buttons: number[];
  15143. angularSensibilityX: number;
  15144. angularSensibilityY: number;
  15145. pinchPrecision: number;
  15146. /**
  15147. * pinchDeltaPercentage will be used instead of pinchPrecision if different from 0.
  15148. * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.
  15149. */
  15150. pinchDeltaPercentage: number;
  15151. panningSensibility: number;
  15152. multiTouchPanning: boolean;
  15153. multiTouchPanAndZoom: boolean;
  15154. pinchInwards: boolean;
  15155. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15156. detachControl(element: Nullable<HTMLElement>): void;
  15157. getClassName(): string;
  15158. getSimpleName(): string;
  15159. }
  15160. }
  15161. declare module BABYLON {
  15162. class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<ArcRotateCamera> {
  15163. camera: ArcRotateCamera;
  15164. alphaCorrection: number;
  15165. betaCorrection: number;
  15166. gammaCorrection: number;
  15167. constructor();
  15168. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15169. checkInputs(): void;
  15170. detachControl(element: Nullable<HTMLElement>): void;
  15171. getClassName(): string;
  15172. getSimpleName(): string;
  15173. }
  15174. }
  15175. declare module BABYLON {
  15176. class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera> {
  15177. constructor();
  15178. camera: FreeCamera;
  15179. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15180. detachControl(element: Nullable<HTMLElement>): void;
  15181. checkInputs(): void;
  15182. getClassName(): string;
  15183. getSimpleName(): string;
  15184. }
  15185. }
  15186. declare module BABYLON {
  15187. class FreeCameraGamepadInput implements ICameraInput<FreeCamera> {
  15188. camera: FreeCamera;
  15189. gamepad: Nullable<Gamepad>;
  15190. gamepadAngularSensibility: number;
  15191. gamepadMoveSensibility: number;
  15192. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15193. detachControl(element: Nullable<HTMLElement>): void;
  15194. checkInputs(): void;
  15195. getClassName(): string;
  15196. getSimpleName(): string;
  15197. }
  15198. }
  15199. declare module BABYLON {
  15200. class FreeCameraKeyboardMoveInput implements ICameraInput<FreeCamera> {
  15201. camera: FreeCamera;
  15202. keysUp: number[];
  15203. keysDown: number[];
  15204. keysLeft: number[];
  15205. keysRight: number[];
  15206. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15207. detachControl(element: Nullable<HTMLElement>): void;
  15208. checkInputs(): void;
  15209. getClassName(): string;
  15210. getSimpleName(): string;
  15211. }
  15212. }
  15213. declare module BABYLON {
  15214. class FreeCameraMouseInput implements ICameraInput<FreeCamera> {
  15215. touchEnabled: boolean;
  15216. camera: FreeCamera;
  15217. buttons: number[];
  15218. angularSensibility: number;
  15219. constructor(touchEnabled?: boolean);
  15220. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15221. detachControl(element: Nullable<HTMLElement>): void;
  15222. getClassName(): string;
  15223. getSimpleName(): string;
  15224. }
  15225. }
  15226. declare module BABYLON {
  15227. class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
  15228. camera: FreeCamera;
  15229. touchAngularSensibility: number;
  15230. touchMoveSensibility: number;
  15231. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15232. detachControl(element: Nullable<HTMLElement>): void;
  15233. checkInputs(): void;
  15234. getClassName(): string;
  15235. getSimpleName(): string;
  15236. }
  15237. }
  15238. declare module BABYLON {
  15239. class FreeCameraVirtualJoystickInput implements ICameraInput<FreeCamera> {
  15240. camera: FreeCamera;
  15241. getLeftJoystick(): VirtualJoystick;
  15242. getRightJoystick(): VirtualJoystick;
  15243. checkInputs(): void;
  15244. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15245. detachControl(element: Nullable<HTMLElement>): void;
  15246. getClassName(): string;
  15247. getSimpleName(): string;
  15248. }
  15249. }
  15250. declare module BABYLON {
  15251. class VRCameraMetrics {
  15252. hResolution: number;
  15253. vResolution: number;
  15254. hScreenSize: number;
  15255. vScreenSize: number;
  15256. vScreenCenter: number;
  15257. eyeToScreenDistance: number;
  15258. lensSeparationDistance: number;
  15259. interpupillaryDistance: number;
  15260. distortionK: number[];
  15261. chromaAbCorrection: number[];
  15262. postProcessScaleFactor: number;
  15263. lensCenterOffset: number;
  15264. compensateDistortion: boolean;
  15265. readonly aspectRatio: number;
  15266. readonly aspectRatioFov: number;
  15267. readonly leftHMatrix: Matrix;
  15268. readonly rightHMatrix: Matrix;
  15269. readonly leftPreViewMatrix: Matrix;
  15270. readonly rightPreViewMatrix: Matrix;
  15271. static GetDefault(): VRCameraMetrics;
  15272. }
  15273. }
  15274. declare module BABYLON {
  15275. class VRDeviceOrientationFreeCamera extends DeviceOrientationCamera {
  15276. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  15277. getClassName(): string;
  15278. }
  15279. class VRDeviceOrientationGamepadCamera extends VRDeviceOrientationFreeCamera {
  15280. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  15281. getClassName(): string;
  15282. }
  15283. class VRDeviceOrientationArcRotateCamera extends ArcRotateCamera {
  15284. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  15285. getClassName(): string;
  15286. }
  15287. }
  15288. declare module BABYLON {
  15289. interface VRTeleportationOptions {
  15290. floorMeshName?: string;
  15291. floorMeshes?: Mesh[];
  15292. }
  15293. interface VRExperienceHelperOptions extends WebVROptions {
  15294. createDeviceOrientationCamera?: boolean;
  15295. createFallbackVRDeviceOrientationFreeCamera?: boolean;
  15296. }
  15297. class VRExperienceHelper {
  15298. webVROptions: VRExperienceHelperOptions;
  15299. /**
  15300. * Observable raised when entering VR.
  15301. */
  15302. onEnteringVRObservable: Observable<VRExperienceHelper>;
  15303. /**
  15304. * Observable raised when exiting VR.
  15305. */
  15306. onExitingVRObservable: Observable<VRExperienceHelper>;
  15307. /**
  15308. * Observable raised when controller mesh is loaded.
  15309. */
  15310. onControllerMeshLoadedObservable: Observable<WebVRController>;
  15311. /** Return this.onEnteringVRObservable
  15312. * Note: This one is for backward compatibility. Please use onEnteringVRObservable directly
  15313. */
  15314. readonly onEnteringVR: Observable<VRExperienceHelper>;
  15315. /** Return this.onExitingVRObservable
  15316. * Note: This one is for backward compatibility. Please use onExitingVRObservable directly
  15317. */
  15318. readonly onExitingVR: Observable<VRExperienceHelper>;
  15319. /** Return this.onControllerMeshLoadedObservable
  15320. * Note: This one is for backward compatibility. Please use onControllerMeshLoadedObservable directly
  15321. */
  15322. readonly onControllerMeshLoaded: Observable<WebVRController>;
  15323. onNewMeshSelected: Observable<AbstractMesh>;
  15324. /**
  15325. * Observable raised when current selected mesh gets unselected
  15326. */
  15327. onSelectedMeshUnselected: Observable<AbstractMesh>;
  15328. /**
  15329. * To be optionaly changed by user to define custom ray selection
  15330. */
  15331. raySelectionPredicate: (mesh: AbstractMesh) => boolean;
  15332. /**
  15333. * To be optionaly changed by user to define custom selection logic (after ray selection)
  15334. */
  15335. meshSelectionPredicate: (mesh: AbstractMesh) => boolean;
  15336. teleportationTarget: Mesh;
  15337. displayGaze: boolean;
  15338. displayLaserPointer: boolean;
  15339. readonly deviceOrientationCamera: Nullable<DeviceOrientationCamera>;
  15340. readonly currentVRCamera: Nullable<Camera>;
  15341. readonly webVRCamera: WebVRFreeCamera;
  15342. readonly vrDeviceOrientationCamera: Nullable<VRDeviceOrientationFreeCamera>;
  15343. constructor(scene: Scene, webVROptions?: VRExperienceHelperOptions);
  15344. /**
  15345. * Gets a value indicating if we are currently in VR mode.
  15346. */
  15347. readonly isInVRMode: boolean;
  15348. /**
  15349. * Attempt to enter VR. If a headset is connected and ready, will request present on that.
  15350. * Otherwise, will use the fullscreen API.
  15351. */
  15352. enterVR(): void;
  15353. /**
  15354. * Attempt to exit VR, or fullscreen.
  15355. */
  15356. exitVR(): void;
  15357. position: Vector3;
  15358. enableInteractions(): void;
  15359. addFloorMesh(floorMesh: Mesh): void;
  15360. removeFloorMesh(floorMesh: Mesh): void;
  15361. enableTeleportation(vrTeleportationOptions?: VRTeleportationOptions): void;
  15362. changeLaserColor(color: Color3): void;
  15363. changeGazeColor(color: Color3): void;
  15364. dispose(): void;
  15365. getClassName(): string;
  15366. }
  15367. }
  15368. declare var HMDVRDevice: any;
  15369. declare var VRDisplay: any;
  15370. declare var VRFrameData: any;
  15371. declare module BABYLON {
  15372. /**
  15373. * This is a copy of VRPose.
  15374. * IMPORTANT!! The data is right-hand data.
  15375. * @export
  15376. * @interface DevicePose
  15377. */
  15378. interface DevicePose {
  15379. readonly position?: Float32Array;
  15380. readonly linearVelocity?: Float32Array;
  15381. readonly linearAcceleration?: Float32Array;
  15382. readonly orientation?: Float32Array;
  15383. readonly angularVelocity?: Float32Array;
  15384. readonly angularAcceleration?: Float32Array;
  15385. }
  15386. interface PoseControlled {
  15387. position: Vector3;
  15388. rotationQuaternion: Quaternion;
  15389. devicePosition?: Vector3;
  15390. deviceRotationQuaternion: Quaternion;
  15391. rawPose: Nullable<DevicePose>;
  15392. deviceScaleFactor: number;
  15393. updateFromDevice(poseData: DevicePose): void;
  15394. }
  15395. interface WebVROptions {
  15396. trackPosition?: boolean;
  15397. positionScale?: number;
  15398. displayName?: string;
  15399. controllerMeshes?: boolean;
  15400. defaultLightingOnControllers?: boolean;
  15401. useCustomVRButton?: boolean;
  15402. customVRButton?: HTMLButtonElement;
  15403. rayLength?: number;
  15404. defaultHeight?: number;
  15405. }
  15406. class WebVRFreeCamera extends FreeCamera implements PoseControlled {
  15407. rawPose: Nullable<DevicePose>;
  15408. devicePosition: Vector3;
  15409. deviceRotationQuaternion: Quaternion;
  15410. deviceScaleFactor: number;
  15411. controllers: Array<WebVRController>;
  15412. onControllersAttachedObservable: Observable<WebVRController[]>;
  15413. onControllerMeshLoadedObservable: Observable<WebVRController>;
  15414. rigParenting: boolean;
  15415. constructor(name: string, position: Vector3, scene: Scene, webVROptions?: WebVROptions);
  15416. deviceDistanceToRoomGround: () => number;
  15417. useStandingMatrix: (callback?: (bool: boolean) => void) => void;
  15418. dispose(): void;
  15419. getControllerByName(name: string): Nullable<WebVRController>;
  15420. readonly leftController: Nullable<WebVRController>;
  15421. readonly rightController: Nullable<WebVRController>;
  15422. getForwardRay(length?: number): Ray;
  15423. updateFromDevice(poseData: DevicePose): void;
  15424. /**
  15425. * WebVR's attach control will start broadcasting frames to the device.
  15426. * Note that in certain browsers (chrome for example) this function must be called
  15427. * within a user-interaction callback. Example:
  15428. * <pre> scene.onPointerDown = function() { camera.attachControl(canvas); }</pre>
  15429. *
  15430. * @param {HTMLElement} element
  15431. * @param {boolean} [noPreventDefault]
  15432. *
  15433. * @memberOf WebVRFreeCamera
  15434. */
  15435. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15436. detachControl(element: HTMLElement): void;
  15437. getClassName(): string;
  15438. resetToCurrentRotation(): void;
  15439. update(): void;
  15440. /**
  15441. * This function is called by the two RIG cameras.
  15442. * 'this' is the left or right camera (and NOT (!!!) the WebVRFreeCamera instance)
  15443. */
  15444. initControllers(): void;
  15445. }
  15446. }
  15447. declare module BABYLON {
  15448. interface IOctreeContainer<T> {
  15449. blocks: Array<OctreeBlock<T>>;
  15450. }
  15451. class Octree<T> {
  15452. maxDepth: number;
  15453. blocks: Array<OctreeBlock<T>>;
  15454. dynamicContent: T[];
  15455. constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, maxDepth?: number);
  15456. update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void;
  15457. addMesh(entry: T): void;
  15458. select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T>;
  15459. intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T>;
  15460. intersectsRay(ray: Ray): SmartArray<T>;
  15461. static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>) => void;
  15462. static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock<SubMesh>) => void;
  15463. }
  15464. }
  15465. declare module BABYLON {
  15466. class OctreeBlock<T> {
  15467. entries: T[];
  15468. blocks: Array<OctreeBlock<T>>;
  15469. constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void);
  15470. readonly capacity: number;
  15471. readonly minPoint: Vector3;
  15472. readonly maxPoint: Vector3;
  15473. addEntry(entry: T): void;
  15474. addEntries(entries: T[]): void;
  15475. select(frustumPlanes: Plane[], selection: SmartArrayNoDuplicate<T>, allowDuplicate?: boolean): void;
  15476. intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArrayNoDuplicate<T>, allowDuplicate?: boolean): void;
  15477. intersectsRay(ray: Ray, selection: SmartArrayNoDuplicate<T>): void;
  15478. createInnerBlocks(): void;
  15479. }
  15480. }
  15481. declare module BABYLON {
  15482. class GenericController extends WebVRController {
  15483. static readonly MODEL_BASE_URL: string;
  15484. static readonly MODEL_FILENAME: string;
  15485. constructor(vrGamepad: any);
  15486. initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void): void;
  15487. }
  15488. }
  15489. declare module BABYLON {
  15490. class OculusTouchController extends WebVRController {
  15491. static MODEL_BASE_URL: string;
  15492. static MODEL_LEFT_FILENAME: string;
  15493. static MODEL_RIGHT_FILENAME: string;
  15494. onSecondaryTriggerStateChangedObservable: Observable<ExtendedGamepadButton>;
  15495. onThumbRestChangedObservable: Observable<ExtendedGamepadButton>;
  15496. constructor(vrGamepad: any);
  15497. initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void): void;
  15498. readonly onAButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15499. readonly onBButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15500. readonly onXButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15501. readonly onYButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15502. }
  15503. }
  15504. declare module BABYLON {
  15505. enum PoseEnabledControllerType {
  15506. VIVE = 0,
  15507. OCULUS = 1,
  15508. WINDOWS = 2,
  15509. GENERIC = 3,
  15510. }
  15511. interface MutableGamepadButton {
  15512. value: number;
  15513. touched: boolean;
  15514. pressed: boolean;
  15515. }
  15516. interface ExtendedGamepadButton extends GamepadButton {
  15517. readonly pressed: boolean;
  15518. readonly touched: boolean;
  15519. readonly value: number;
  15520. }
  15521. class PoseEnabledControllerHelper {
  15522. static InitiateController(vrGamepad: any): OculusTouchController | WindowsMotionController | ViveController | GenericController;
  15523. }
  15524. class PoseEnabledController extends Gamepad implements PoseControlled {
  15525. devicePosition: Vector3;
  15526. deviceRotationQuaternion: Quaternion;
  15527. deviceScaleFactor: number;
  15528. position: Vector3;
  15529. rotationQuaternion: Quaternion;
  15530. controllerType: PoseEnabledControllerType;
  15531. rawPose: DevicePose;
  15532. constructor(browserGamepad: any);
  15533. update(): void;
  15534. updateFromDevice(poseData: DevicePose): void;
  15535. attachToMesh(mesh: AbstractMesh): void;
  15536. attachToPoseControlledCamera(camera: TargetCamera): void;
  15537. dispose(): void;
  15538. readonly mesh: Nullable<AbstractMesh>;
  15539. getForwardRay(length?: number): Ray;
  15540. }
  15541. }
  15542. declare module BABYLON {
  15543. class ViveController extends WebVRController {
  15544. static MODEL_BASE_URL: string;
  15545. static MODEL_FILENAME: string;
  15546. constructor(vrGamepad: any);
  15547. initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void): void;
  15548. readonly onLeftButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15549. readonly onRightButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15550. readonly onMenuButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15551. /**
  15552. * Vive mapping:
  15553. * 0: touchpad
  15554. * 1: trigger
  15555. * 2: left AND right buttons
  15556. * 3: menu button
  15557. */
  15558. }
  15559. }
  15560. declare module BABYLON {
  15561. abstract class WebVRController extends PoseEnabledController {
  15562. onTriggerStateChangedObservable: Observable<ExtendedGamepadButton>;
  15563. onMainButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15564. onSecondaryButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15565. onPadStateChangedObservable: Observable<ExtendedGamepadButton>;
  15566. onPadValuesChangedObservable: Observable<StickValues>;
  15567. onButtonStateChange(callback: (controlledIndex: number, buttonIndex: number, state: ExtendedGamepadButton) => void): void;
  15568. pad: StickValues;
  15569. hand: string;
  15570. readonly defaultModel: AbstractMesh;
  15571. constructor(vrGamepad: any);
  15572. update(): void;
  15573. abstract initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void): void;
  15574. dispose(): void;
  15575. }
  15576. }
  15577. declare module BABYLON {
  15578. class WindowsMotionController extends WebVRController {
  15579. static MODEL_BASE_URL: string;
  15580. static MODEL_LEFT_FILENAME: string;
  15581. static MODEL_RIGHT_FILENAME: string;
  15582. static readonly GAMEPAD_ID_PREFIX: string;
  15583. onTrackpadChangedObservable: Observable<ExtendedGamepadButton>;
  15584. onTrackpadValuesChangedObservable: Observable<StickValues>;
  15585. trackpad: StickValues;
  15586. constructor(vrGamepad: any);
  15587. readonly onTriggerButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15588. readonly onMenuButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15589. readonly onGripButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15590. readonly onThumbstickButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15591. readonly onTouchpadButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  15592. readonly onTouchpadValuesChangedObservable: Observable<StickValues>;
  15593. /**
  15594. * Called once per frame by the engine.
  15595. */
  15596. update(): void;
  15597. /**
  15598. * Called once for each button that changed state since the last frame
  15599. * @param buttonIdx Which button index changed
  15600. * @param state New state of the button
  15601. * @param changes Which properties on the state changed since last frame
  15602. */
  15603. /**
  15604. * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.
  15605. * @param scene scene in which to add meshes
  15606. * @param meshLoaded optional callback function that will be called if the mesh loads successfully.
  15607. */
  15608. initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void, forceDefault?: boolean): void;
  15609. /**
  15610. * Takes a list of meshes (as loaded from the glTF file) and finds the root node, as well as nodes that
  15611. * can be transformed by button presses and axes values, based on this._mapping.
  15612. *
  15613. * @param scene scene in which the meshes exist
  15614. * @param meshes list of meshes that make up the controller model to process
  15615. * @return structured view of the given meshes, with mapping of buttons and axes to meshes that can be transformed.
  15616. */
  15617. getForwardRay(length?: number): Ray;
  15618. dispose(): void;
  15619. }
  15620. }
  15621. declare module BABYLON {
  15622. /**
  15623. * Interface to implement to create a shadow generator compatible with BJS.
  15624. */
  15625. interface IShadowGenerator {
  15626. getShadowMap(): Nullable<RenderTargetTexture>;
  15627. getShadowMapForRendering(): Nullable<RenderTargetTexture>;
  15628. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  15629. prepareDefines(defines: MaterialDefines, lightIndex: number): void;
  15630. bindShadowLight(lightIndex: string, effect: Effect): void;
  15631. getTransformMatrix(): Matrix;
  15632. recreateShadowMap(): void;
  15633. forceCompilation(onCompiled?: (generator: ShadowGenerator) => void, options?: Partial<{
  15634. useInstances: boolean;
  15635. }>): void;
  15636. serialize(): any;
  15637. dispose(): void;
  15638. }
  15639. class ShadowGenerator implements IShadowGenerator {
  15640. static readonly FILTER_NONE: number;
  15641. static readonly FILTER_POISSONSAMPLING: number;
  15642. static readonly FILTER_EXPONENTIALSHADOWMAP: number;
  15643. static readonly FILTER_BLUREXPONENTIALSHADOWMAP: number;
  15644. static readonly FILTER_CLOSEEXPONENTIALSHADOWMAP: number;
  15645. static readonly FILTER_BLURCLOSEEXPONENTIALSHADOWMAP: number;
  15646. bias: number;
  15647. blurBoxOffset: number;
  15648. blurScale: number;
  15649. blurKernel: number;
  15650. useKernelBlur: boolean;
  15651. depthScale: number;
  15652. filter: number;
  15653. usePoissonSampling: boolean;
  15654. useVarianceShadowMap: boolean;
  15655. useBlurVarianceShadowMap: boolean;
  15656. useExponentialShadowMap: boolean;
  15657. useBlurExponentialShadowMap: boolean;
  15658. useCloseExponentialShadowMap: boolean;
  15659. useBlurCloseExponentialShadowMap: boolean;
  15660. /**
  15661. * Returns the darkness value (float).
  15662. */
  15663. getDarkness(): number;
  15664. /**
  15665. * Sets the ShadowGenerator darkness value (float <= 1.0).
  15666. * Returns the ShadowGenerator.
  15667. */
  15668. setDarkness(darkness: number): ShadowGenerator;
  15669. /**
  15670. * Sets the ability to have transparent shadow (boolean).
  15671. * Returns the ShadowGenerator.
  15672. */
  15673. setTransparencyShadow(hasShadow: boolean): ShadowGenerator;
  15674. /**
  15675. * Returns a RenderTargetTexture object : the shadow map texture.
  15676. */
  15677. getShadowMap(): Nullable<RenderTargetTexture>;
  15678. /**
  15679. * Returns the most ready computed shadow map as a RenderTargetTexture object.
  15680. */
  15681. getShadowMapForRendering(): Nullable<RenderTargetTexture>;
  15682. /**
  15683. * Helper function to add a mesh and its descendants to the list of shadow casters
  15684. * @param mesh Mesh to add
  15685. * @param includeDescendants boolean indicating if the descendants should be added. Default to true
  15686. */
  15687. addShadowCaster(mesh: AbstractMesh, includeDescendants?: boolean): ShadowGenerator;
  15688. /**
  15689. * Helper function to remove a mesh and its descendants from the list of shadow casters
  15690. * @param mesh Mesh to remove
  15691. * @param includeDescendants boolean indicating if the descendants should be removed. Default to true
  15692. */
  15693. removeShadowCaster(mesh: AbstractMesh, includeDescendants?: boolean): ShadowGenerator;
  15694. /**
  15695. * Controls the extent to which the shadows fade out at the edge of the frustum
  15696. * Used only by directionals and spots
  15697. */
  15698. frustumEdgeFalloff: number;
  15699. /**
  15700. * Returns the associated light object.
  15701. */
  15702. getLight(): IShadowLight;
  15703. forceBackFacesOnly: boolean;
  15704. /**
  15705. * Creates a ShadowGenerator object.
  15706. * A ShadowGenerator is the required tool to use the shadows.
  15707. * Each light casting shadows needs to use its own ShadowGenerator.
  15708. * Required parameters :
  15709. * - `mapSize` (integer): the size of the texture what stores the shadows. Example : 1024.
  15710. * - `light`: the light object generating the shadows.
  15711. * - `useFullFloatFirst`: by default the generator will try to use half float textures but if you need precision (for self shadowing for instance), you can use this option to enforce full float texture.
  15712. * Documentation : http://doc.babylonjs.com/tutorials/shadows
  15713. */
  15714. constructor(mapSize: number, light: IShadowLight, useFullFloatFirst?: boolean);
  15715. /**
  15716. * Force shader compilation including textures ready check
  15717. */
  15718. forceCompilation(onCompiled?: (generator: ShadowGenerator) => void, options?: Partial<{
  15719. useInstances: boolean;
  15720. }>): void;
  15721. /**
  15722. * Boolean : true when the ShadowGenerator is finally computed.
  15723. */
  15724. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  15725. /**
  15726. * This creates the defines related to the standard BJS materials.
  15727. */
  15728. prepareDefines(defines: any, lightIndex: number): void;
  15729. /**
  15730. * This binds shadow lights related to the standard BJS materials.
  15731. * It implies the unifroms available on the materials are the standard BJS ones.
  15732. */
  15733. bindShadowLight(lightIndex: string, effect: Effect): void;
  15734. /**
  15735. * Returns a Matrix object : the updated transformation matrix.
  15736. */
  15737. getTransformMatrix(): Matrix;
  15738. recreateShadowMap(): void;
  15739. /**
  15740. * Disposes the ShadowGenerator.
  15741. * Returns nothing.
  15742. */
  15743. dispose(): void;
  15744. /**
  15745. * Serializes the ShadowGenerator and returns a serializationObject.
  15746. */
  15747. serialize(): any;
  15748. /**
  15749. * Parses a serialized ShadowGenerator and returns a new ShadowGenerator.
  15750. */
  15751. static Parse(parsedShadowGenerator: any, scene: Scene): ShadowGenerator;
  15752. }
  15753. }
  15754. declare module BABYLON.Internals {
  15755. }
  15756. declare namespace BABYLON {
  15757. /**
  15758. * Background material used to create an efficient environement around your scene.
  15759. */
  15760. class BackgroundMaterial extends PushMaterial {
  15761. /**
  15762. * Standard reflectance value at parallel view angle.
  15763. */
  15764. static standardReflectance0: number;
  15765. /**
  15766. * Standard reflectance value at grazing angle.
  15767. */
  15768. static standardReflectance90: number;
  15769. /**
  15770. * Key light Color (multiply against the R channel of the environement texture)
  15771. */
  15772. primaryColor: Color3;
  15773. /**
  15774. * Key light Level (allowing HDR output of the background)
  15775. */
  15776. primaryLevel: float;
  15777. /**
  15778. * Secondary light Color (multiply against the G channel of the environement texture)
  15779. */
  15780. secondaryColor: Color3;
  15781. /**
  15782. * Secondary light Level (allowing HDR output of the background)
  15783. */
  15784. secondaryLevel: float;
  15785. /**
  15786. * Tertiary light Color (multiply against the B channel of the environement texture)
  15787. */
  15788. tertiaryColor: Color3;
  15789. /**
  15790. * Tertiary light Level (allowing HDR output of the background)
  15791. */
  15792. tertiaryLevel: float;
  15793. /**
  15794. * Reflection Texture used in the material.
  15795. * Should be author in a specific way for the best result (refer to the documentation).
  15796. */
  15797. reflectionTexture: Nullable<BaseTexture>;
  15798. /**
  15799. * Reflection Texture level of blur.
  15800. *
  15801. * Can be use to reuse an existing HDR Texture and target a specific LOD to prevent authoring the
  15802. * texture twice.
  15803. */
  15804. reflectionBlur: float;
  15805. /**
  15806. * Diffuse Texture used in the material.
  15807. * Should be author in a specific way for the best result (refer to the documentation).
  15808. */
  15809. diffuseTexture: Nullable<BaseTexture>;
  15810. /**
  15811. * Specify the list of lights casting shadow on the material.
  15812. * All scene shadow lights will be included if null.
  15813. */
  15814. shadowLights: Nullable<IShadowLight[]>;
  15815. /**
  15816. * For the lights having a blurred shadow generator, this can add a second blur pass in order to reach
  15817. * soft lighting on the background.
  15818. */
  15819. shadowBlurScale: int;
  15820. /**
  15821. * Helps adjusting the shadow to a softer level if required.
  15822. * 0 means black shadows and 1 means no shadows.
  15823. */
  15824. shadowLevel: float;
  15825. /**
  15826. * In case of opacity Fresnel or reflection falloff, this is use as a scene center.
  15827. * It is usually zero but might be interesting to modify according to your setup.
  15828. */
  15829. sceneCenter: Vector3;
  15830. /**
  15831. * This helps specifying that the material is falling off to the sky box at grazing angle.
  15832. * This helps ensuring a nice transition when the camera goes under the ground.
  15833. */
  15834. opacityFresnel: boolean;
  15835. /**
  15836. * This helps specifying that the material is falling off from diffuse to the reflection texture at grazing angle.
  15837. * This helps adding a mirror texture on the ground.
  15838. */
  15839. reflectionFresnel: boolean;
  15840. /**
  15841. * This helps specifying the falloff radius off the reflection texture from the sceneCenter.
  15842. * This helps adding a nice falloff effect to the reflection if used as a mirror for instance.
  15843. */
  15844. reflectionFalloffDistance: number;
  15845. /**
  15846. * This specifies the weight of the reflection against the background in case of reflection Fresnel.
  15847. */
  15848. reflectionAmount: number;
  15849. /**
  15850. * This specifies the weight of the reflection at grazing angle.
  15851. */
  15852. reflectionReflectance0: number;
  15853. /**
  15854. * This specifies the weight of the reflection at a perpendicular point of view.
  15855. */
  15856. reflectionReflectance90: number;
  15857. /**
  15858. * Sets the reflection reflectance fresnel values according to the default standard
  15859. * empirically know to work well :-)
  15860. */
  15861. reflectionStandardFresnelWeight: number;
  15862. /**
  15863. * Helps to directly use the maps channels instead of their level.
  15864. */
  15865. useRGBColor: boolean;
  15866. /**
  15867. * This helps reducing the banding effect that could occur on the background.
  15868. */
  15869. enableNoise: boolean;
  15870. /**
  15871. * Number of Simultaneous lights allowed on the material.
  15872. */
  15873. maxSimultaneousLights: int;
  15874. /**
  15875. * Default configuration related to image processing available in the Background Material.
  15876. */
  15877. /**
  15878. * Keep track of the image processing observer to allow dispose and replace.
  15879. */
  15880. /**
  15881. * Attaches a new image processing configuration to the PBR Material.
  15882. * @param configuration (if null the scene configuration will be use)
  15883. */
  15884. /**
  15885. * Gets the image processing configuration used either in this material.
  15886. */
  15887. /**
  15888. * Sets the Default image processing configuration used either in the this material.
  15889. *
  15890. * If sets to null, the scene one is in use.
  15891. */
  15892. imageProcessingConfiguration: Nullable<ImageProcessingConfiguration>;
  15893. /**
  15894. * Gets wether the color curves effect is enabled.
  15895. */
  15896. /**
  15897. * Sets wether the color curves effect is enabled.
  15898. */
  15899. cameraColorCurvesEnabled: boolean;
  15900. /**
  15901. * Gets wether the color grading effect is enabled.
  15902. */
  15903. /**
  15904. * Gets wether the color grading effect is enabled.
  15905. */
  15906. cameraColorGradingEnabled: boolean;
  15907. /**
  15908. * Gets wether tonemapping is enabled or not.
  15909. */
  15910. /**
  15911. * Sets wether tonemapping is enabled or not
  15912. */
  15913. cameraToneMappingEnabled: boolean;
  15914. /**
  15915. * The camera exposure used on this material.
  15916. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  15917. * This corresponds to a photographic exposure.
  15918. */
  15919. /**
  15920. * The camera exposure used on this material.
  15921. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  15922. * This corresponds to a photographic exposure.
  15923. */
  15924. cameraExposure: float;
  15925. /**
  15926. * Gets The camera contrast used on this material.
  15927. */
  15928. /**
  15929. * Sets The camera contrast used on this material.
  15930. */
  15931. cameraContrast: float;
  15932. /**
  15933. * Gets the Color Grading 2D Lookup Texture.
  15934. */
  15935. /**
  15936. * Sets the Color Grading 2D Lookup Texture.
  15937. */
  15938. cameraColorGradingTexture: Nullable<BaseTexture>;
  15939. /**
  15940. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  15941. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  15942. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  15943. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  15944. */
  15945. /**
  15946. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  15947. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  15948. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  15949. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  15950. */
  15951. cameraColorCurves: Nullable<ColorCurves>;
  15952. /**
  15953. * constructor
  15954. * @param name The name of the material
  15955. * @param scene The scene to add the material to
  15956. */
  15957. constructor(name: string, scene: Scene);
  15958. /**
  15959. * The entire material has been created in order to prevent overdraw.
  15960. * @returns false
  15961. */
  15962. needAlphaTesting(): boolean;
  15963. /**
  15964. * The entire material has been created in order to prevent overdraw.
  15965. * @returns true if blending is enable
  15966. */
  15967. needAlphaBlending(): boolean;
  15968. /**
  15969. * Checks wether the material is ready to be rendered for a given mesh.
  15970. * @param mesh The mesh to render
  15971. * @param subMesh The submesh to check against
  15972. * @param useInstances Specify wether or not the material is used with instances
  15973. */
  15974. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  15975. /**
  15976. * Build the uniform buffer used in the material.
  15977. */
  15978. buildUniformLayout(): void;
  15979. /**
  15980. * Unbind the material.
  15981. */
  15982. unbind(): void;
  15983. /**
  15984. * Bind only the world matrix to the material.
  15985. * @param world The world matrix to bind.
  15986. */
  15987. bindOnlyWorldMatrix(world: Matrix): void;
  15988. /**
  15989. * Bind the material for a dedicated submeh (every used meshes will be considered opaque).
  15990. * @param world The world matrix to bind.
  15991. * @param subMesh The submesh to bind for.
  15992. */
  15993. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  15994. /**
  15995. * Dispose the material.
  15996. * @forceDisposeEffect Force disposal of the associated effect.
  15997. * @forceDisposeTextures Force disposal of the associated textures.
  15998. */
  15999. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  16000. /**
  16001. * Clones the material.
  16002. * @name The cloned name.
  16003. * @returns The cloned material.
  16004. */
  16005. clone(name: string): BackgroundMaterial;
  16006. /**
  16007. * Serializes the current material to its JSON representation.
  16008. * @returns The JSON representation.
  16009. */
  16010. serialize(): any;
  16011. /**
  16012. * Gets the class name of the material
  16013. * @returns "BackgroundMaterial"
  16014. */
  16015. getClassName(): string;
  16016. /**
  16017. * Parse a JSON input to create back a background material.
  16018. * @param source
  16019. * @param scene
  16020. * @param rootUrl
  16021. * @returns the instantiated BackgroundMaterial.
  16022. */
  16023. static Parse(source: any, scene: Scene, rootUrl: string): BackgroundMaterial;
  16024. }
  16025. }
  16026. declare module BABYLON {
  16027. /**
  16028. * The Physically based material base class of BJS.
  16029. *
  16030. * This offers the main features of a standard PBR material.
  16031. * For more information, please refer to the documentation :
  16032. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  16033. */
  16034. abstract class PBRBaseMaterial extends PushMaterial {
  16035. /**
  16036. * Intensity of the direct lights e.g. the four lights available in your scene.
  16037. * This impacts both the direct diffuse and specular highlights.
  16038. */
  16039. /**
  16040. * Intensity of the emissive part of the material.
  16041. * This helps controlling the emissive effect without modifying the emissive color.
  16042. */
  16043. /**
  16044. * Intensity of the environment e.g. how much the environment will light the object
  16045. * either through harmonics for rough material or through the refelction for shiny ones.
  16046. */
  16047. /**
  16048. * This is a special control allowing the reduction of the specular highlights coming from the
  16049. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  16050. */
  16051. /**
  16052. * Debug Control allowing disabling the bump map on this material.
  16053. */
  16054. /**
  16055. * AKA Diffuse Texture in standard nomenclature.
  16056. */
  16057. /**
  16058. * AKA Occlusion Texture in other nomenclature.
  16059. */
  16060. /**
  16061. * AKA Occlusion Texture Intensity in other nomenclature.
  16062. */
  16063. /**
  16064. * AKA Specular texture in other nomenclature.
  16065. */
  16066. /**
  16067. * Used to switch from specular/glossiness to metallic/roughness workflow.
  16068. */
  16069. /**
  16070. * Specifies the metallic scalar of the metallic/roughness workflow.
  16071. * Can also be used to scale the metalness values of the metallic texture.
  16072. */
  16073. /**
  16074. * Specifies the roughness scalar of the metallic/roughness workflow.
  16075. * Can also be used to scale the roughness values of the metallic texture.
  16076. */
  16077. /**
  16078. * Used to enable roughness/glossiness fetch from a separate chanel depending on the current mode.
  16079. * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
  16080. */
  16081. /**
  16082. * AKA Diffuse Color in other nomenclature.
  16083. */
  16084. /**
  16085. * AKA Specular Color in other nomenclature.
  16086. */
  16087. /**
  16088. * AKA Glossiness in other nomenclature.
  16089. */
  16090. /**
  16091. * source material index of refraction (IOR)' / 'destination material IOR.
  16092. */
  16093. /**
  16094. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  16095. */
  16096. /**
  16097. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  16098. * Materials half opaque for instance using refraction could benefit from this control.
  16099. */
  16100. /**
  16101. * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
  16102. * makes the reflect vector face the model (under horizon).
  16103. */
  16104. /**
  16105. * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
  16106. * too much the area relying on ambient texture to define their ambient occlusion.
  16107. */
  16108. /**
  16109. * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.
  16110. */
  16111. /**
  16112. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  16113. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  16114. */
  16115. /**
  16116. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  16117. */
  16118. /**
  16119. * Specifies if the metallic texture contains the roughness information in its alpha channel.
  16120. */
  16121. /**
  16122. * Specifies if the metallic texture contains the roughness information in its green channel.
  16123. */
  16124. /**
  16125. * Specifies if the metallic texture contains the metallness information in its blue channel.
  16126. */
  16127. /**
  16128. * Specifies if the metallic texture contains the ambient occlusion information in its red channel.
  16129. */
  16130. /**
  16131. * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
  16132. */
  16133. /**
  16134. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  16135. * The material will try to infer what glossiness each pixel should be.
  16136. */
  16137. /**
  16138. * BJS is using an harcoded light falloff based on a manually sets up range.
  16139. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  16140. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  16141. */
  16142. /**
  16143. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  16144. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  16145. */
  16146. /**
  16147. * Allows using the bump map in parallax mode.
  16148. */
  16149. /**
  16150. * Allows using the bump map in parallax occlusion mode.
  16151. */
  16152. /**
  16153. * Controls the scale bias of the parallax mode.
  16154. */
  16155. /**
  16156. * If sets to true, disables all the lights affecting the material.
  16157. */
  16158. /**
  16159. * Number of Simultaneous lights allowed on the material.
  16160. */
  16161. /**
  16162. * If sets to true, x component of normal map value will be inverted (x = 1.0 - x).
  16163. */
  16164. /**
  16165. * If sets to true, y component of normal map value will be inverted (y = 1.0 - y).
  16166. */
  16167. /**
  16168. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  16169. */
  16170. /**
  16171. * Defines the alpha limits in alpha test mode.
  16172. */
  16173. /**
  16174. * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.
  16175. */
  16176. /**
  16177. * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.
  16178. * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)
  16179. */
  16180. /**
  16181. * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.
  16182. * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)
  16183. */
  16184. /**
  16185. * The transparency mode of the material.
  16186. */
  16187. /**
  16188. * Specifies the environment BRDF texture used to comput the scale and offset roughness values
  16189. * from cos thetav and roughness:
  16190. * http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
  16191. */
  16192. /**
  16193. * Force the shader to compute irradiance in the fragment shader in order to take bump in account.
  16194. */
  16195. /**
  16196. * Force normal to face away from face.
  16197. */
  16198. /**
  16199. * Default configuration related to image processing available in the PBR Material.
  16200. */
  16201. /**
  16202. * Keep track of the image processing observer to allow dispose and replace.
  16203. */
  16204. /**
  16205. * Attaches a new image processing configuration to the PBR Material.
  16206. * @param configuration
  16207. */
  16208. /**
  16209. * Instantiates a new PBRMaterial instance.
  16210. *
  16211. * @param name The material name
  16212. * @param scene The scene the material will be use in.
  16213. */
  16214. constructor(name: string, scene: Scene);
  16215. getClassName(): string;
  16216. useLogarithmicDepth: boolean;
  16217. /**
  16218. * Gets the current transparency mode.
  16219. */
  16220. /**
  16221. * Sets the transparency mode of the material.
  16222. */
  16223. transparencyMode: Nullable<number>;
  16224. /**
  16225. * Returns true if alpha blending should be disabled.
  16226. */
  16227. /**
  16228. * Specifies whether or not this material should be rendered in alpha blend mode.
  16229. */
  16230. needAlphaBlending(): boolean;
  16231. /**
  16232. * Specifies whether or not this material should be rendered in alpha blend mode for the given mesh.
  16233. */
  16234. needAlphaBlendingForMesh(mesh: AbstractMesh): boolean;
  16235. /**
  16236. * Specifies whether or not this material should be rendered in alpha test mode.
  16237. */
  16238. needAlphaTesting(): boolean;
  16239. /**
  16240. * Specifies whether or not the alpha value of the albedo texture should be used for alpha blending.
  16241. */
  16242. getAlphaTestTexture(): BaseTexture;
  16243. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  16244. buildUniformLayout(): void;
  16245. unbind(): void;
  16246. bindOnlyWorldMatrix(world: Matrix): void;
  16247. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  16248. getAnimatables(): IAnimatable[];
  16249. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  16250. }
  16251. }
  16252. declare module BABYLON.Internals {
  16253. /**
  16254. * The Physically based simple base material of BJS.
  16255. *
  16256. * This enables better naming and convention enforcements on top of the pbrMaterial.
  16257. * It is used as the base class for both the specGloss and metalRough conventions.
  16258. */
  16259. abstract class PBRBaseSimpleMaterial extends PBRBaseMaterial {
  16260. /**
  16261. * Number of Simultaneous lights allowed on the material.
  16262. */
  16263. maxSimultaneousLights: number;
  16264. /**
  16265. * If sets to true, disables all the lights affecting the material.
  16266. */
  16267. disableLighting: boolean;
  16268. /**
  16269. * Environment Texture used in the material (this is use for both reflection and environment lighting).
  16270. */
  16271. environmentTexture: BaseTexture;
  16272. /**
  16273. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  16274. */
  16275. invertNormalMapX: boolean;
  16276. /**
  16277. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  16278. */
  16279. invertNormalMapY: boolean;
  16280. /**
  16281. * Normal map used in the model.
  16282. */
  16283. normalTexture: BaseTexture;
  16284. /**
  16285. * Emissivie color used to self-illuminate the model.
  16286. */
  16287. emissiveColor: Color3;
  16288. /**
  16289. * Emissivie texture used to self-illuminate the model.
  16290. */
  16291. emissiveTexture: BaseTexture;
  16292. /**
  16293. * Occlusion Channel Strenght.
  16294. */
  16295. occlusionStrength: number;
  16296. /**
  16297. * Occlusion Texture of the material (adding extra occlusion effects).
  16298. */
  16299. occlusionTexture: BaseTexture;
  16300. /**
  16301. * Defines the alpha limits in alpha test mode.
  16302. */
  16303. alphaCutOff: number;
  16304. /**
  16305. * Gets the current double sided mode.
  16306. */
  16307. /**
  16308. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  16309. */
  16310. doubleSided: boolean;
  16311. lightmapTexture: BaseTexture;
  16312. useLightmapAsShadowmap: boolean;
  16313. /**
  16314. * Return the active textures of the material.
  16315. */
  16316. getActiveTextures(): BaseTexture[];
  16317. hasTexture(texture: BaseTexture): boolean;
  16318. /**
  16319. * Instantiates a new PBRMaterial instance.
  16320. *
  16321. * @param name The material name
  16322. * @param scene The scene the material will be use in.
  16323. */
  16324. constructor(name: string, scene: Scene);
  16325. getClassName(): string;
  16326. }
  16327. }
  16328. declare module BABYLON {
  16329. /**
  16330. * The Physically based material of BJS.
  16331. *
  16332. * This offers the main features of a standard PBR material.
  16333. * For more information, please refer to the documentation :
  16334. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  16335. */
  16336. class PBRMaterial extends PBRBaseMaterial {
  16337. /**
  16338. * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.
  16339. */
  16340. static readonly PBRMATERIAL_OPAQUE: number;
  16341. /**
  16342. * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
  16343. */
  16344. static readonly PBRMATERIAL_ALPHATEST: number;
  16345. /**
  16346. * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
  16347. */
  16348. static readonly PBRMATERIAL_ALPHABLEND: number;
  16349. /**
  16350. * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
  16351. * They are also discarded below the alpha cutoff threshold to improve performances.
  16352. */
  16353. static readonly PBRMATERIAL_ALPHATESTANDBLEND: number;
  16354. /**
  16355. * Intensity of the direct lights e.g. the four lights available in your scene.
  16356. * This impacts both the direct diffuse and specular highlights.
  16357. */
  16358. directIntensity: number;
  16359. /**
  16360. * Intensity of the emissive part of the material.
  16361. * This helps controlling the emissive effect without modifying the emissive color.
  16362. */
  16363. emissiveIntensity: number;
  16364. /**
  16365. * Intensity of the environment e.g. how much the environment will light the object
  16366. * either through harmonics for rough material or through the refelction for shiny ones.
  16367. */
  16368. environmentIntensity: number;
  16369. /**
  16370. * This is a special control allowing the reduction of the specular highlights coming from the
  16371. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  16372. */
  16373. specularIntensity: number;
  16374. /**
  16375. * Debug Control allowing disabling the bump map on this material.
  16376. */
  16377. disableBumpMap: boolean;
  16378. /**
  16379. * AKA Diffuse Texture in standard nomenclature.
  16380. */
  16381. albedoTexture: BaseTexture;
  16382. /**
  16383. * AKA Occlusion Texture in other nomenclature.
  16384. */
  16385. ambientTexture: BaseTexture;
  16386. /**
  16387. * AKA Occlusion Texture Intensity in other nomenclature.
  16388. */
  16389. ambientTextureStrength: number;
  16390. opacityTexture: BaseTexture;
  16391. reflectionTexture: Nullable<BaseTexture>;
  16392. emissiveTexture: BaseTexture;
  16393. /**
  16394. * AKA Specular texture in other nomenclature.
  16395. */
  16396. reflectivityTexture: BaseTexture;
  16397. /**
  16398. * Used to switch from specular/glossiness to metallic/roughness workflow.
  16399. */
  16400. metallicTexture: BaseTexture;
  16401. /**
  16402. * Specifies the metallic scalar of the metallic/roughness workflow.
  16403. * Can also be used to scale the metalness values of the metallic texture.
  16404. */
  16405. metallic: number;
  16406. /**
  16407. * Specifies the roughness scalar of the metallic/roughness workflow.
  16408. * Can also be used to scale the roughness values of the metallic texture.
  16409. */
  16410. roughness: number;
  16411. /**
  16412. * Used to enable roughness/glossiness fetch from a separate chanel depending on the current mode.
  16413. * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
  16414. */
  16415. microSurfaceTexture: BaseTexture;
  16416. bumpTexture: BaseTexture;
  16417. lightmapTexture: BaseTexture;
  16418. refractionTexture: BaseTexture;
  16419. ambientColor: Color3;
  16420. /**
  16421. * AKA Diffuse Color in other nomenclature.
  16422. */
  16423. albedoColor: Color3;
  16424. /**
  16425. * AKA Specular Color in other nomenclature.
  16426. */
  16427. reflectivityColor: Color3;
  16428. reflectionColor: Color3;
  16429. emissiveColor: Color3;
  16430. /**
  16431. * AKA Glossiness in other nomenclature.
  16432. */
  16433. microSurface: number;
  16434. /**
  16435. * source material index of refraction (IOR)' / 'destination material IOR.
  16436. */
  16437. indexOfRefraction: number;
  16438. /**
  16439. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  16440. */
  16441. invertRefractionY: boolean;
  16442. /**
  16443. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  16444. * Materials half opaque for instance using refraction could benefit from this control.
  16445. */
  16446. linkRefractionWithTransparency: boolean;
  16447. useLightmapAsShadowmap: boolean;
  16448. /**
  16449. * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.
  16450. */
  16451. useAlphaFromAlbedoTexture: boolean;
  16452. /**
  16453. * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.
  16454. */
  16455. forceAlphaTest: boolean;
  16456. /**
  16457. * Defines the alpha limits in alpha test mode.
  16458. */
  16459. alphaCutOff: number;
  16460. /**
  16461. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  16462. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  16463. */
  16464. useSpecularOverAlpha: boolean;
  16465. /**
  16466. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  16467. */
  16468. useMicroSurfaceFromReflectivityMapAlpha: boolean;
  16469. /**
  16470. * Specifies if the metallic texture contains the roughness information in its alpha channel.
  16471. */
  16472. useRoughnessFromMetallicTextureAlpha: boolean;
  16473. /**
  16474. * Specifies if the metallic texture contains the roughness information in its green channel.
  16475. */
  16476. useRoughnessFromMetallicTextureGreen: boolean;
  16477. /**
  16478. * Specifies if the metallic texture contains the metallness information in its blue channel.
  16479. */
  16480. useMetallnessFromMetallicTextureBlue: boolean;
  16481. /**
  16482. * Specifies if the metallic texture contains the ambient occlusion information in its red channel.
  16483. */
  16484. useAmbientOcclusionFromMetallicTextureRed: boolean;
  16485. /**
  16486. * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
  16487. */
  16488. useAmbientInGrayScale: boolean;
  16489. /**
  16490. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  16491. * The material will try to infer what glossiness each pixel should be.
  16492. */
  16493. useAutoMicroSurfaceFromReflectivityMap: boolean;
  16494. /**
  16495. * BJS is using an harcoded light falloff based on a manually sets up range.
  16496. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  16497. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  16498. */
  16499. usePhysicalLightFalloff: boolean;
  16500. /**
  16501. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  16502. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  16503. */
  16504. useRadianceOverAlpha: boolean;
  16505. /**
  16506. * Allows using the bump map in parallax mode.
  16507. */
  16508. useParallax: boolean;
  16509. /**
  16510. * Allows using the bump map in parallax occlusion mode.
  16511. */
  16512. useParallaxOcclusion: boolean;
  16513. /**
  16514. * Controls the scale bias of the parallax mode.
  16515. */
  16516. parallaxScaleBias: number;
  16517. /**
  16518. * If sets to true, disables all the lights affecting the material.
  16519. */
  16520. disableLighting: boolean;
  16521. /**
  16522. * Force the shader to compute irradiance in the fragment shader in order to take bump in account.
  16523. */
  16524. forceIrradianceInFragment: boolean;
  16525. /**
  16526. * Number of Simultaneous lights allowed on the material.
  16527. */
  16528. maxSimultaneousLights: number;
  16529. /**
  16530. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  16531. */
  16532. invertNormalMapX: boolean;
  16533. /**
  16534. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  16535. */
  16536. invertNormalMapY: boolean;
  16537. /**
  16538. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  16539. */
  16540. twoSidedLighting: boolean;
  16541. /**
  16542. * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.
  16543. * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)
  16544. */
  16545. useAlphaFresnel: boolean;
  16546. /**
  16547. * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.
  16548. * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)
  16549. */
  16550. useLinearAlphaFresnel: boolean;
  16551. /**
  16552. * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.
  16553. * And/Or occlude the blended part.
  16554. */
  16555. environmentBRDFTexture: Nullable<BaseTexture>;
  16556. /**
  16557. * Force normal to face away from face.
  16558. */
  16559. forceNormalForward: boolean;
  16560. /**
  16561. * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
  16562. * makes the reflect vector face the model (under horizon).
  16563. */
  16564. useHorizonOcclusion: boolean;
  16565. /**
  16566. * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
  16567. * too much the area relying on ambient texture to define their ambient occlusion.
  16568. */
  16569. useRadianceOcclusion: boolean;
  16570. /**
  16571. * Gets the image processing configuration used either in this material.
  16572. */
  16573. /**
  16574. * Sets the Default image processing configuration used either in the this material.
  16575. *
  16576. * If sets to null, the scene one is in use.
  16577. */
  16578. imageProcessingConfiguration: ImageProcessingConfiguration;
  16579. /**
  16580. * Gets wether the color curves effect is enabled.
  16581. */
  16582. /**
  16583. * Sets wether the color curves effect is enabled.
  16584. */
  16585. cameraColorCurvesEnabled: boolean;
  16586. /**
  16587. * Gets wether the color grading effect is enabled.
  16588. */
  16589. /**
  16590. * Gets wether the color grading effect is enabled.
  16591. */
  16592. cameraColorGradingEnabled: boolean;
  16593. /**
  16594. * Gets wether tonemapping is enabled or not.
  16595. */
  16596. /**
  16597. * Sets wether tonemapping is enabled or not
  16598. */
  16599. cameraToneMappingEnabled: boolean;
  16600. /**
  16601. * The camera exposure used on this material.
  16602. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  16603. * This corresponds to a photographic exposure.
  16604. */
  16605. /**
  16606. * The camera exposure used on this material.
  16607. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  16608. * This corresponds to a photographic exposure.
  16609. */
  16610. cameraExposure: number;
  16611. /**
  16612. * Gets The camera contrast used on this material.
  16613. */
  16614. /**
  16615. * Sets The camera contrast used on this material.
  16616. */
  16617. cameraContrast: number;
  16618. /**
  16619. * Gets the Color Grading 2D Lookup Texture.
  16620. */
  16621. /**
  16622. * Sets the Color Grading 2D Lookup Texture.
  16623. */
  16624. cameraColorGradingTexture: Nullable<BaseTexture>;
  16625. /**
  16626. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  16627. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  16628. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  16629. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  16630. */
  16631. /**
  16632. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  16633. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  16634. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  16635. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  16636. */
  16637. cameraColorCurves: Nullable<ColorCurves>;
  16638. /**
  16639. * Instantiates a new PBRMaterial instance.
  16640. *
  16641. * @param name The material name
  16642. * @param scene The scene the material will be use in.
  16643. */
  16644. constructor(name: string, scene: Scene);
  16645. getClassName(): string;
  16646. getActiveTextures(): BaseTexture[];
  16647. hasTexture(texture: BaseTexture): boolean;
  16648. clone(name: string): PBRMaterial;
  16649. serialize(): any;
  16650. static Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial;
  16651. }
  16652. }
  16653. declare module BABYLON {
  16654. /**
  16655. * The PBR material of BJS following the metal roughness convention.
  16656. *
  16657. * This fits to the PBR convention in the GLTF definition:
  16658. * https://github.com/KhronosGroup/glTF/tree/2.0/specification/2.0
  16659. */
  16660. class PBRMetallicRoughnessMaterial extends Internals.PBRBaseSimpleMaterial {
  16661. /**
  16662. * The base color has two different interpretations depending on the value of metalness.
  16663. * When the material is a metal, the base color is the specific measured reflectance value
  16664. * at normal incidence (F0). For a non-metal the base color represents the reflected diffuse color
  16665. * of the material.
  16666. */
  16667. baseColor: Color3;
  16668. /**
  16669. * Base texture of the metallic workflow. It contains both the baseColor information in RGB as
  16670. * well as opacity information in the alpha channel.
  16671. */
  16672. baseTexture: BaseTexture;
  16673. /**
  16674. * Specifies the metallic scalar value of the material.
  16675. * Can also be used to scale the metalness values of the metallic texture.
  16676. */
  16677. metallic: number;
  16678. /**
  16679. * Specifies the roughness scalar value of the material.
  16680. * Can also be used to scale the roughness values of the metallic texture.
  16681. */
  16682. roughness: number;
  16683. /**
  16684. * Texture containing both the metallic value in the B channel and the
  16685. * roughness value in the G channel to keep better precision.
  16686. */
  16687. metallicRoughnessTexture: BaseTexture;
  16688. /**
  16689. * Instantiates a new PBRMetalRoughnessMaterial instance.
  16690. *
  16691. * @param name The material name
  16692. * @param scene The scene the material will be use in.
  16693. */
  16694. constructor(name: string, scene: Scene);
  16695. /**
  16696. * Return the currrent class name of the material.
  16697. */
  16698. getClassName(): string;
  16699. /**
  16700. * Return the active textures of the material.
  16701. */
  16702. getActiveTextures(): BaseTexture[];
  16703. hasTexture(texture: BaseTexture): boolean;
  16704. clone(name: string): PBRMetallicRoughnessMaterial;
  16705. /**
  16706. * Serialize the material to a parsable JSON object.
  16707. */
  16708. serialize(): any;
  16709. /**
  16710. * Parses a JSON object correponding to the serialize function.
  16711. */
  16712. static Parse(source: any, scene: Scene, rootUrl: string): PBRMetallicRoughnessMaterial;
  16713. }
  16714. }
  16715. declare module BABYLON {
  16716. /**
  16717. * The PBR material of BJS following the specular glossiness convention.
  16718. *
  16719. * This fits to the PBR convention in the GLTF definition:
  16720. * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness
  16721. */
  16722. class PBRSpecularGlossinessMaterial extends Internals.PBRBaseSimpleMaterial {
  16723. /**
  16724. * Specifies the diffuse color of the material.
  16725. */
  16726. diffuseColor: Color3;
  16727. /**
  16728. * Specifies the diffuse texture of the material. This can also contains the opcity value in its alpha
  16729. * channel.
  16730. */
  16731. diffuseTexture: BaseTexture;
  16732. /**
  16733. * Specifies the specular color of the material. This indicates how reflective is the material (none to mirror).
  16734. */
  16735. specularColor: Color3;
  16736. /**
  16737. * Specifies the glossiness of the material. This indicates "how sharp is the reflection".
  16738. */
  16739. glossiness: number;
  16740. /**
  16741. * Specifies both the specular color RGB and the glossiness A of the material per pixels.
  16742. */
  16743. specularGlossinessTexture: BaseTexture;
  16744. /**
  16745. * Instantiates a new PBRSpecularGlossinessMaterial instance.
  16746. *
  16747. * @param name The material name
  16748. * @param scene The scene the material will be use in.
  16749. */
  16750. constructor(name: string, scene: Scene);
  16751. /**
  16752. * Return the currrent class name of the material.
  16753. */
  16754. getClassName(): string;
  16755. /**
  16756. * Return the active textures of the material.
  16757. */
  16758. getActiveTextures(): BaseTexture[];
  16759. hasTexture(texture: BaseTexture): boolean;
  16760. clone(name: string): PBRSpecularGlossinessMaterial;
  16761. /**
  16762. * Serialize the material to a parsable JSON object.
  16763. */
  16764. serialize(): any;
  16765. /**
  16766. * Parses a JSON object correponding to the serialize function.
  16767. */
  16768. static Parse(source: any, scene: Scene, rootUrl: string): PBRSpecularGlossinessMaterial;
  16769. }
  16770. }
  16771. declare module BABYLON {
  16772. class BaseTexture {
  16773. static DEFAULT_ANISOTROPIC_FILTERING_LEVEL: number;
  16774. name: string;
  16775. hasAlpha: boolean;
  16776. getAlphaFromRGB: boolean;
  16777. level: number;
  16778. coordinatesIndex: number;
  16779. coordinatesMode: number;
  16780. wrapU: number;
  16781. wrapV: number;
  16782. wrapR: number;
  16783. anisotropicFilteringLevel: number;
  16784. isCube: boolean;
  16785. is3D: boolean;
  16786. gammaSpace: boolean;
  16787. invertZ: boolean;
  16788. lodLevelInAlpha: boolean;
  16789. lodGenerationOffset: number;
  16790. lodGenerationScale: number;
  16791. isRenderTarget: boolean;
  16792. readonly uid: string;
  16793. toString(): string;
  16794. getClassName(): string;
  16795. animations: Animation[];
  16796. /**
  16797. * An event triggered when the texture is disposed.
  16798. * @type {BABYLON.Observable}
  16799. */
  16800. onDisposeObservable: Observable<BaseTexture>;
  16801. onDispose: () => void;
  16802. delayLoadState: number;
  16803. readonly isBlocking: boolean;
  16804. constructor(scene: Nullable<Scene>);
  16805. getScene(): Nullable<Scene>;
  16806. getTextureMatrix(): Matrix;
  16807. getReflectionTextureMatrix(): Matrix;
  16808. getInternalTexture(): Nullable<InternalTexture>;
  16809. isReadyOrNotBlocking(): boolean;
  16810. isReady(): boolean;
  16811. getSize(): ISize;
  16812. getBaseSize(): ISize;
  16813. scale(ratio: number): void;
  16814. readonly canRescale: boolean;
  16815. delayLoad(): void;
  16816. clone(): Nullable<BaseTexture>;
  16817. readonly textureType: number;
  16818. readonly textureFormat: number;
  16819. readPixels(faceIndex?: number): Nullable<ArrayBufferView>;
  16820. releaseInternalTexture(): void;
  16821. sphericalPolynomial: Nullable<SphericalPolynomial>;
  16822. readonly _lodTextureHigh: Nullable<BaseTexture>;
  16823. readonly _lodTextureMid: Nullable<BaseTexture>;
  16824. readonly _lodTextureLow: Nullable<BaseTexture>;
  16825. dispose(): void;
  16826. serialize(): any;
  16827. static WhenAllReady(textures: BaseTexture[], callback: () => void): void;
  16828. }
  16829. }
  16830. declare module BABYLON {
  16831. /**
  16832. * This represents a color grading texture. This acts as a lookup table LUT, useful during post process
  16833. * It can help converting any input color in a desired output one. This can then be used to create effects
  16834. * from sepia, black and white to sixties or futuristic rendering...
  16835. *
  16836. * The only supported format is currently 3dl.
  16837. * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table/
  16838. */
  16839. class ColorGradingTexture extends BaseTexture {
  16840. /**
  16841. * The current texture matrix. (will always be identity in color grading texture)
  16842. */
  16843. /**
  16844. * The texture URL.
  16845. */
  16846. url: string;
  16847. /**
  16848. * Empty line regex stored for GC.
  16849. */
  16850. /**
  16851. * Instantiates a ColorGradingTexture from the following parameters.
  16852. *
  16853. * @param url The location of the color gradind data (currently only supporting 3dl)
  16854. * @param scene The scene the texture will be used in
  16855. */
  16856. constructor(url: string, scene: Scene);
  16857. /**
  16858. * Returns the texture matrix used in most of the material.
  16859. * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).
  16860. */
  16861. getTextureMatrix(): Matrix;
  16862. /**
  16863. * Occurs when the file being loaded is a .3dl LUT file.
  16864. */
  16865. /**
  16866. * Starts the loading process of the texture.
  16867. */
  16868. /**
  16869. * Clones the color gradind texture.
  16870. */
  16871. clone(): ColorGradingTexture;
  16872. /**
  16873. * Called during delayed load for textures.
  16874. */
  16875. delayLoad(): void;
  16876. /**
  16877. * Parses a color grading texture serialized by Babylon.
  16878. * @param parsedTexture The texture information being parsedTexture
  16879. * @param scene The scene to load the texture in
  16880. * @param rootUrl The root url of the data assets to load
  16881. * @return A color gradind texture
  16882. */
  16883. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<ColorGradingTexture>;
  16884. /**
  16885. * Serializes the LUT texture to json format.
  16886. */
  16887. serialize(): any;
  16888. }
  16889. }
  16890. declare module BABYLON {
  16891. class CubeTexture extends BaseTexture {
  16892. url: string;
  16893. coordinatesMode: number;
  16894. static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture;
  16895. static CreateFromPrefilteredData(url: string, scene: Scene, forcedExtension?: any): CubeTexture;
  16896. constructor(rootUrl: string, scene: Scene, extensions?: Nullable<string[]>, noMipmap?: boolean, files?: Nullable<string[]>, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number, prefiltered?: boolean, forcedExtension?: any);
  16897. delayLoad(): void;
  16898. getReflectionTextureMatrix(): Matrix;
  16899. setReflectionTextureMatrix(value: Matrix): void;
  16900. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture;
  16901. clone(): CubeTexture;
  16902. }
  16903. }
  16904. declare module BABYLON {
  16905. class DynamicTexture extends Texture {
  16906. constructor(name: string, options: any, scene: Scene | null | undefined, generateMipMaps: boolean, samplingMode?: number, format?: number);
  16907. readonly canRescale: boolean;
  16908. scale(ratio: number): void;
  16909. scaleTo(width: number, height: number): void;
  16910. getContext(): CanvasRenderingContext2D;
  16911. clear(): void;
  16912. update(invertY?: boolean): void;
  16913. drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void;
  16914. clone(): DynamicTexture;
  16915. }
  16916. }
  16917. declare module BABYLON {
  16918. /**
  16919. * This represents a texture coming from an HDR input.
  16920. *
  16921. * The only supported format is currently panorama picture stored in RGBE format.
  16922. * Example of such files can be found on HDRLib: http://hdrlib.com/
  16923. */
  16924. class HDRCubeTexture extends BaseTexture {
  16925. /**
  16926. * The texture URL.
  16927. */
  16928. url: string;
  16929. /**
  16930. * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.
  16931. */
  16932. coordinatesMode: number;
  16933. /**
  16934. * Specifies wether the texture has been generated through the PMREMGenerator tool.
  16935. * This is usefull at run time to apply the good shader.
  16936. */
  16937. isPMREM: boolean;
  16938. /**
  16939. * Gets wether or not the texture is blocking during loading.
  16940. */
  16941. /**
  16942. * Sets wether or not the texture is blocking during loading.
  16943. */
  16944. isBlocking: boolean;
  16945. /**
  16946. * Instantiates an HDRTexture from the following parameters.
  16947. *
  16948. * @param url The location of the HDR raw data (Panorama stored in RGBE format)
  16949. * @param scene The scene the texture will be used in
  16950. * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
  16951. * @param noMipmap Forces to not generate the mipmap if true
  16952. * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
  16953. * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
  16954. * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
  16955. */
  16956. constructor(url: string, scene: Scene, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>);
  16957. /**
  16958. * Occurs when the file is a preprocessed .babylon.hdr file.
  16959. */
  16960. /**
  16961. * Occurs when the file is raw .hdr file.
  16962. */
  16963. /**
  16964. * Starts the loading process of the texture.
  16965. */
  16966. clone(): HDRCubeTexture;
  16967. delayLoad(): void;
  16968. getReflectionTextureMatrix(): Matrix;
  16969. setReflectionTextureMatrix(value: Matrix): void;
  16970. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<HDRCubeTexture>;
  16971. serialize(): any;
  16972. /**
  16973. * Saves as a file the data contained in the texture in a binary format.
  16974. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  16975. * as the spherical used in the lighting.
  16976. * @param url The HDR file url.
  16977. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  16978. * @param onError Method called if any error happens during download.
  16979. * @return The packed binary data.
  16980. */
  16981. static generateBabylonHDROnDisk(url: string, size: number, onError?: Nullable<(() => void)>): void;
  16982. /**
  16983. * Serializes the data contained in the texture in a binary format.
  16984. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  16985. * as the spherical used in the lighting.
  16986. * @param url The HDR file url.
  16987. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  16988. * @param onError Method called if any error happens during download.
  16989. * @return The packed binary data.
  16990. */
  16991. static generateBabylonHDR(url: string, size: number, callback: ((ArrayBuffer: ArrayBuffer) => void), onError?: Nullable<(() => void)>): void;
  16992. }
  16993. }
  16994. declare module BABYLON {
  16995. class InternalTexture {
  16996. static DATASOURCE_UNKNOWN: number;
  16997. static DATASOURCE_URL: number;
  16998. static DATASOURCE_TEMP: number;
  16999. static DATASOURCE_RAW: number;
  17000. static DATASOURCE_DYNAMIC: number;
  17001. static DATASOURCE_RENDERTARGET: number;
  17002. static DATASOURCE_MULTIRENDERTARGET: number;
  17003. static DATASOURCE_CUBE: number;
  17004. static DATASOURCE_CUBERAW: number;
  17005. static DATASOURCE_CUBEPREFILTERED: number;
  17006. static DATASOURCE_RAW3D: number;
  17007. isReady: boolean;
  17008. isCube: boolean;
  17009. is3D: boolean;
  17010. url: string;
  17011. samplingMode: number;
  17012. generateMipMaps: boolean;
  17013. samples: number;
  17014. type: number;
  17015. format: number;
  17016. onLoadedObservable: Observable<InternalTexture>;
  17017. width: number;
  17018. height: number;
  17019. depth: number;
  17020. baseWidth: number;
  17021. baseHeight: number;
  17022. baseDepth: number;
  17023. invertY: boolean;
  17024. readonly dataSource: number;
  17025. constructor(engine: Engine, dataSource: number);
  17026. incrementReferences(): void;
  17027. updateSize(width: int, height: int, depth?: int): void;
  17028. dispose(): void;
  17029. }
  17030. }
  17031. declare module BABYLON {
  17032. class MirrorTexture extends RenderTargetTexture {
  17033. mirrorPlane: Plane;
  17034. blurRatio: number;
  17035. adaptiveBlurKernel: number;
  17036. blurKernel: number;
  17037. blurKernelX: number;
  17038. blurKernelY: number;
  17039. constructor(name: string, size: number | {
  17040. width: number;
  17041. height: number;
  17042. } | {
  17043. ratio: number;
  17044. }, scene: Scene, generateMipMaps?: boolean, type?: number, samplingMode?: number, generateDepthBuffer?: boolean);
  17045. clone(): MirrorTexture;
  17046. serialize(): any;
  17047. }
  17048. }
  17049. declare module BABYLON {
  17050. interface IMultiRenderTargetOptions {
  17051. generateMipMaps: boolean;
  17052. types: number[];
  17053. samplingModes: number[];
  17054. generateDepthBuffer: boolean;
  17055. generateStencilBuffer: boolean;
  17056. generateDepthTexture: boolean;
  17057. textureCount: number;
  17058. }
  17059. class MultiRenderTarget extends RenderTargetTexture {
  17060. readonly isSupported: boolean;
  17061. readonly textures: Texture[];
  17062. readonly depthTexture: Texture;
  17063. wrapU: number;
  17064. wrapV: number;
  17065. constructor(name: string, size: any, count: number, scene: Scene, options?: any);
  17066. samples: number;
  17067. resize(size: any): void;
  17068. dispose(): void;
  17069. releaseInternalTextures(): void;
  17070. }
  17071. }
  17072. declare module BABYLON {
  17073. class RawTexture extends Texture {
  17074. format: number;
  17075. constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number);
  17076. update(data: ArrayBufferView): void;
  17077. static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  17078. static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  17079. static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  17080. static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture;
  17081. static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture;
  17082. }
  17083. }
  17084. declare module BABYLON {
  17085. /**
  17086. * Creates a refraction texture used by refraction channel of the standard material.
  17087. * @param name the texture name
  17088. * @param size size of the underlying texture
  17089. * @param scene root scene
  17090. */
  17091. class RefractionTexture extends RenderTargetTexture {
  17092. refractionPlane: Plane;
  17093. depth: number;
  17094. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  17095. clone(): RefractionTexture;
  17096. serialize(): any;
  17097. }
  17098. }
  17099. declare module BABYLON {
  17100. class RenderTargetTexture extends Texture {
  17101. isCube: boolean;
  17102. static readonly REFRESHRATE_RENDER_ONCE: number;
  17103. static readonly REFRESHRATE_RENDER_ONEVERYFRAME: number;
  17104. static readonly REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  17105. /**
  17106. * Use this predicate to dynamically define the list of mesh you want to render.
  17107. * If set, the renderList property will be overwritten.
  17108. */
  17109. renderListPredicate: (AbstractMesh: AbstractMesh) => boolean;
  17110. /**
  17111. * Use this list to define the list of mesh you want to render.
  17112. */
  17113. renderList: Nullable<Array<AbstractMesh>>;
  17114. renderParticles: boolean;
  17115. renderSprites: boolean;
  17116. coordinatesMode: number;
  17117. activeCamera: Nullable<Camera>;
  17118. customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, depthOnlySubMeshes: SmartArray<SubMesh>, beforeTransparents?: () => void) => void;
  17119. useCameraPostProcesses: boolean;
  17120. ignoreCameraViewport: boolean;
  17121. /**
  17122. * An event triggered when the texture is unbind.
  17123. * @type {BABYLON.Observable}
  17124. */
  17125. onBeforeBindObservable: Observable<RenderTargetTexture>;
  17126. /**
  17127. * An event triggered when the texture is unbind.
  17128. * @type {BABYLON.Observable}
  17129. */
  17130. onAfterUnbindObservable: Observable<RenderTargetTexture>;
  17131. onAfterUnbind: () => void;
  17132. /**
  17133. * An event triggered before rendering the texture
  17134. * @type {BABYLON.Observable}
  17135. */
  17136. onBeforeRenderObservable: Observable<number>;
  17137. onBeforeRender: (faceIndex: number) => void;
  17138. /**
  17139. * An event triggered after rendering the texture
  17140. * @type {BABYLON.Observable}
  17141. */
  17142. onAfterRenderObservable: Observable<number>;
  17143. onAfterRender: (faceIndex: number) => void;
  17144. /**
  17145. * An event triggered after the texture clear
  17146. * @type {BABYLON.Observable}
  17147. */
  17148. onClearObservable: Observable<Engine>;
  17149. onClear: (Engine: Engine) => void;
  17150. clearColor: Color4;
  17151. width: number;
  17152. height: number;
  17153. };
  17154. width: number;
  17155. height: number;
  17156. } | {
  17157. ratio: number;
  17158. };
  17159. readonly renderTargetOptions: RenderTargetCreationOptions;
  17160. constructor(name: string, size: number | {
  17161. width: number;
  17162. height: number;
  17163. } | {
  17164. ratio: number;
  17165. }, scene: Nullable<Scene>, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean, samplingMode?: number, generateDepthBuffer?: boolean, generateStencilBuffer?: boolean, isMulti?: boolean);
  17166. samples: number;
  17167. resetRefreshCounter(): void;
  17168. refreshRate: number;
  17169. addPostProcess(postProcess: PostProcess): void;
  17170. clearPostProcesses(dispose?: boolean): void;
  17171. removePostProcess(postProcess: PostProcess): void;
  17172. getRenderSize(): number;
  17173. getRenderWidth(): number;
  17174. getRenderHeight(): number;
  17175. readonly canRescale: boolean;
  17176. scale(ratio: number): void;
  17177. getReflectionTextureMatrix(): Matrix;
  17178. resize(size: number | {
  17179. width: number;
  17180. height: number;
  17181. } | {
  17182. ratio: number;
  17183. }): void;
  17184. render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void;
  17185. /**
  17186. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  17187. * This allowed control for front to back rendering or reversly depending of the special needs.
  17188. *
  17189. * @param renderingGroupId The rendering group id corresponding to its index
  17190. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  17191. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  17192. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  17193. */
  17194. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, alphaTestSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, transparentSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>): void;
  17195. /**
  17196. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  17197. *
  17198. * @param renderingGroupId The rendering group id corresponding to its index
  17199. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  17200. */
  17201. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  17202. clone(): RenderTargetTexture;
  17203. serialize(): any;
  17204. disposeFramebufferObjects(): void;
  17205. dispose(): void;
  17206. }
  17207. }
  17208. declare module BABYLON {
  17209. class Texture extends BaseTexture {
  17210. static NEAREST_SAMPLINGMODE: number;
  17211. static NEAREST_NEAREST_MIPLINEAR: number;
  17212. static BILINEAR_SAMPLINGMODE: number;
  17213. static LINEAR_LINEAR_MIPNEAREST: number;
  17214. static TRILINEAR_SAMPLINGMODE: number;
  17215. static LINEAR_LINEAR_MIPLINEAR: number;
  17216. static NEAREST_NEAREST_MIPNEAREST: number;
  17217. static NEAREST_LINEAR_MIPNEAREST: number;
  17218. static NEAREST_LINEAR_MIPLINEAR: number;
  17219. static NEAREST_LINEAR: number;
  17220. static NEAREST_NEAREST: number;
  17221. static LINEAR_NEAREST_MIPNEAREST: number;
  17222. static LINEAR_NEAREST_MIPLINEAR: number;
  17223. static LINEAR_LINEAR: number;
  17224. static LINEAR_NEAREST: number;
  17225. static EXPLICIT_MODE: number;
  17226. static SPHERICAL_MODE: number;
  17227. static PLANAR_MODE: number;
  17228. static CUBIC_MODE: number;
  17229. static PROJECTION_MODE: number;
  17230. static SKYBOX_MODE: number;
  17231. static INVCUBIC_MODE: number;
  17232. static EQUIRECTANGULAR_MODE: number;
  17233. static FIXED_EQUIRECTANGULAR_MODE: number;
  17234. static FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number;
  17235. static CLAMP_ADDRESSMODE: number;
  17236. static WRAP_ADDRESSMODE: number;
  17237. static MIRROR_ADDRESSMODE: number;
  17238. url: Nullable<string>;
  17239. uOffset: number;
  17240. vOffset: number;
  17241. uScale: number;
  17242. vScale: number;
  17243. uAng: number;
  17244. vAng: number;
  17245. wAng: number;
  17246. readonly noMipmap: boolean;
  17247. isBlocking: boolean;
  17248. readonly samplingMode: number;
  17249. constructor(url: Nullable<string>, scene: Nullable<Scene>, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, buffer?: any, deleteBuffer?: boolean, format?: number);
  17250. updateURL(url: string): void;
  17251. delayLoad(): void;
  17252. updateSamplingMode(samplingMode: number): void;
  17253. getTextureMatrix(): Matrix;
  17254. getReflectionTextureMatrix(): Matrix;
  17255. clone(): Texture;
  17256. readonly onLoadObservable: Observable<Texture>;
  17257. serialize(): any;
  17258. getClassName(): string;
  17259. dispose(): void;
  17260. static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<() => void>, format?: number): Texture;
  17261. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<BaseTexture>;
  17262. static LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number): Texture;
  17263. }
  17264. }
  17265. declare module BABYLON {
  17266. class VideoTexture extends Texture {
  17267. video: HTMLVideoElement;
  17268. /**
  17269. * Creates a video texture.
  17270. * Sample : https://doc.babylonjs.com/tutorials/01._Advanced_Texturing
  17271. * @param {Array} urlsOrVideo can be used to provide an array of urls or an already setup HTML video element.
  17272. * @param {BABYLON.Scene} scene is obviously the current scene.
  17273. * @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
  17274. * @param {boolean} invertY is false by default but can be used to invert video on Y axis
  17275. * @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
  17276. */
  17277. constructor(name: string, urlsOrVideo: string[] | HTMLVideoElement, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  17278. update(): boolean;
  17279. dispose(): void;
  17280. static CreateFromWebCam(scene: Scene, onReady: (videoTexture: VideoTexture) => void, constraints: {
  17281. minWidth: number;
  17282. maxWidth: number;
  17283. minHeight: number;
  17284. maxHeight: number;
  17285. deviceId: string;
  17286. }): void;
  17287. }
  17288. }
  17289. declare module BABYLON {
  17290. class CannonJSPlugin implements IPhysicsEnginePlugin {
  17291. world: any;
  17292. name: string;
  17293. BJSCANNON: any;
  17294. constructor(_useDeltaForWorldStep?: boolean, iterations?: number);
  17295. setGravity(gravity: Vector3): void;
  17296. setTimeStep(timeStep: number): void;
  17297. getTimeStep(): number;
  17298. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  17299. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  17300. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  17301. generatePhysicsBody(impostor: PhysicsImpostor): void;
  17302. removePhysicsBody(impostor: PhysicsImpostor): void;
  17303. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  17304. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  17305. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  17306. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  17307. isSupported(): boolean;
  17308. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  17309. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  17310. getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
  17311. getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
  17312. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  17313. getBodyMass(impostor: PhysicsImpostor): number;
  17314. getBodyFriction(impostor: PhysicsImpostor): number;
  17315. setBodyFriction(impostor: PhysicsImpostor, friction: number): void;
  17316. getBodyRestitution(impostor: PhysicsImpostor): number;
  17317. setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;
  17318. sleepBody(impostor: PhysicsImpostor): void;
  17319. wakeUpBody(impostor: PhysicsImpostor): void;
  17320. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  17321. setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number, motorIndex?: number): void;
  17322. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number): void;
  17323. syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;
  17324. getRadius(impostor: PhysicsImpostor): number;
  17325. getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;
  17326. dispose(): void;
  17327. }
  17328. }
  17329. declare module BABYLON {
  17330. class OimoJSPlugin implements IPhysicsEnginePlugin {
  17331. world: any;
  17332. name: string;
  17333. BJSOIMO: any;
  17334. constructor(iterations?: number);
  17335. setGravity(gravity: Vector3): void;
  17336. setTimeStep(timeStep: number): void;
  17337. getTimeStep(): number;
  17338. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  17339. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  17340. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  17341. generatePhysicsBody(impostor: PhysicsImpostor): void;
  17342. removePhysicsBody(impostor: PhysicsImpostor): void;
  17343. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  17344. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  17345. isSupported(): boolean;
  17346. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  17347. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  17348. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  17349. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  17350. getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
  17351. getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
  17352. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  17353. getBodyMass(impostor: PhysicsImpostor): number;
  17354. getBodyFriction(impostor: PhysicsImpostor): number;
  17355. setBodyFriction(impostor: PhysicsImpostor, friction: number): void;
  17356. getBodyRestitution(impostor: PhysicsImpostor): number;
  17357. setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;
  17358. sleepBody(impostor: PhysicsImpostor): void;
  17359. wakeUpBody(impostor: PhysicsImpostor): void;
  17360. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  17361. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
  17362. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  17363. syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;
  17364. getRadius(impostor: PhysicsImpostor): number;
  17365. getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;
  17366. dispose(): void;
  17367. }
  17368. }
  17369. declare module BABYLON {
  17370. class PostProcessRenderEffect {
  17371. applyParameters: (postProcess: PostProcess) => void;
  17372. constructor(engine: Engine, name: string, getPostProcess: () => Nullable<PostProcess>, singleInstance?: boolean);
  17373. readonly isSupported: boolean;
  17374. addPass(renderPass: PostProcessRenderPass): void;
  17375. removePass(renderPass: PostProcessRenderPass): void;
  17376. addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void;
  17377. getPass(passName: string): Nullable<PostProcessRenderPass>;
  17378. emptyPasses(): void;
  17379. getPostProcess(camera?: Camera): Nullable<PostProcess>;
  17380. }
  17381. }
  17382. declare module BABYLON {
  17383. class PostProcessRenderPass {
  17384. constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void);
  17385. setRenderList(renderList: Mesh[]): void;
  17386. getRenderTexture(): RenderTargetTexture;
  17387. }
  17388. }
  17389. declare module BABYLON {
  17390. class PostProcessRenderPipeline {
  17391. constructor(engine: Engine, name: string);
  17392. getClassName(): string;
  17393. readonly isSupported: boolean;
  17394. addEffect(renderEffect: PostProcessRenderEffect): void;
  17395. dispose(): void;
  17396. }
  17397. }
  17398. declare module BABYLON {
  17399. class PostProcessRenderPipelineManager {
  17400. constructor();
  17401. addPipeline(renderPipeline: PostProcessRenderPipeline): void;
  17402. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): void;
  17403. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): void;
  17404. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): void;
  17405. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): void;
  17406. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): void;
  17407. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): void;
  17408. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): void;
  17409. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): void;
  17410. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): void;
  17411. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): void;
  17412. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): void;
  17413. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): void;
  17414. update(): void;
  17415. dispose(): void;
  17416. }
  17417. }
  17418. declare module BABYLON.Internals {
  17419. /**
  17420. * Helper class dealing with the extraction of spherical polynomial dataArray
  17421. * from a cube map.
  17422. */
  17423. class CubeMapToSphericalPolynomialTools {
  17424. /**
  17425. * Converts a texture to the according Spherical Polynomial data.
  17426. * This extracts the first 3 orders only as they are the only one used in the lighting.
  17427. *
  17428. * @param texture The texture to extract the information from.
  17429. * @return The Spherical Polynomial data.
  17430. */
  17431. static ConvertCubeMapTextureToSphericalPolynomial(texture: BaseTexture): Nullable<SphericalPolynomial>;
  17432. /**
  17433. * Converts a cubemap to the according Spherical Polynomial data.
  17434. * This extracts the first 3 orders only as they are the only one used in the lighting.
  17435. *
  17436. * @param cubeInfo The Cube map to extract the information from.
  17437. * @return The Spherical Polynomial data.
  17438. */
  17439. static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial;
  17440. }
  17441. }
  17442. declare module BABYLON.Internals {
  17443. /**
  17444. * Header information of HDR texture files.
  17445. */
  17446. interface HDRInfo {
  17447. /**
  17448. * The height of the texture in pixels.
  17449. */
  17450. height: number;
  17451. /**
  17452. * The width of the texture in pixels.
  17453. */
  17454. width: number;
  17455. /**
  17456. * The index of the beginning of the data in the binary file.
  17457. */
  17458. dataPosition: number;
  17459. }
  17460. /**
  17461. * This groups tools to convert HDR texture to native colors array.
  17462. */
  17463. class HDRTools {
  17464. /**
  17465. * Reads header information from an RGBE texture stored in a native array.
  17466. * More information on this format are available here:
  17467. * https://en.wikipedia.org/wiki/RGBE_image_format
  17468. *
  17469. * @param uint8array The binary file stored in native array.
  17470. * @return The header information.
  17471. */
  17472. static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo;
  17473. /**
  17474. * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.
  17475. * This RGBE texture needs to store the information as a panorama.
  17476. *
  17477. * More information on this format are available here:
  17478. * https://en.wikipedia.org/wiki/RGBE_image_format
  17479. *
  17480. * @param buffer The binary file stored in an array buffer.
  17481. * @param size The expected size of the extracted cubemap.
  17482. * @return The Cube Map information.
  17483. */
  17484. static GetCubeMapTextureData(buffer: ArrayBuffer, size: number): CubeMapInfo;
  17485. /**
  17486. * Returns the pixels data extracted from an RGBE texture.
  17487. * This pixels will be stored left to right up to down in the R G B order in one array.
  17488. *
  17489. * More information on this format are available here:
  17490. * https://en.wikipedia.org/wiki/RGBE_image_format
  17491. *
  17492. * @param uint8array The binary file stored in an array buffer.
  17493. * @param hdrInfo The header information of the file.
  17494. * @return The pixels data in RGB right to left up to down order.
  17495. */
  17496. static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array;
  17497. }
  17498. }
  17499. declare module BABYLON.Internals {
  17500. /**
  17501. * CubeMap information grouping all the data for each faces as well as the cubemap size.
  17502. */
  17503. interface CubeMapInfo {
  17504. /**
  17505. * The pixel array for the front face.
  17506. * This is stored in format, left to right, up to down format.
  17507. */
  17508. front: Nullable<ArrayBufferView>;
  17509. /**
  17510. * The pixel array for the back face.
  17511. * This is stored in format, left to right, up to down format.
  17512. */
  17513. back: Nullable<ArrayBufferView>;
  17514. /**
  17515. * The pixel array for the left face.
  17516. * This is stored in format, left to right, up to down format.
  17517. */
  17518. left: Nullable<ArrayBufferView>;
  17519. /**
  17520. * The pixel array for the right face.
  17521. * This is stored in format, left to right, up to down format.
  17522. */
  17523. right: Nullable<ArrayBufferView>;
  17524. /**
  17525. * The pixel array for the up face.
  17526. * This is stored in format, left to right, up to down format.
  17527. */
  17528. up: Nullable<ArrayBufferView>;
  17529. /**
  17530. * The pixel array for the down face.
  17531. * This is stored in format, left to right, up to down format.
  17532. */
  17533. down: Nullable<ArrayBufferView>;
  17534. /**
  17535. * The size of the cubemap stored.
  17536. *
  17537. * Each faces will be size * size pixels.
  17538. */
  17539. size: number;
  17540. /**
  17541. * The format of the texture.
  17542. *
  17543. * RGBA, RGB.
  17544. */
  17545. format: number;
  17546. /**
  17547. * The type of the texture data.
  17548. *
  17549. * UNSIGNED_INT, FLOAT.
  17550. */
  17551. type: number;
  17552. /**
  17553. * Specifies whether the texture is in gamma space.
  17554. */
  17555. gammaSpace: boolean;
  17556. }
  17557. /**
  17558. * Helper class usefull to convert panorama picture to their cubemap representation in 6 faces.
  17559. */
  17560. class PanoramaToCubeMapTools {
  17561. /**
  17562. * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces).
  17563. *
  17564. * @param float32Array The source data.
  17565. * @param inputWidth The width of the input panorama.
  17566. * @param inputhHeight The height of the input panorama.
  17567. * @param size The willing size of the generated cubemap (each faces will be size * size pixels)
  17568. * @return The cubemap data
  17569. */
  17570. static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number): CubeMapInfo;
  17571. }
  17572. }
  17573. declare module BABYLON {
  17574. class CustomProceduralTexture extends ProceduralTexture {
  17575. constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  17576. isReady(): boolean;
  17577. render(useCameraPostProcess?: boolean): void;
  17578. updateTextures(): void;
  17579. updateShaderUniforms(): void;
  17580. animate: boolean;
  17581. }
  17582. }
  17583. declare module BABYLON {
  17584. class ProceduralTexture extends Texture {
  17585. isCube: boolean;
  17586. isEnabled: boolean;
  17587. onGenerated: () => void;
  17588. [key: string]: Texture;
  17589. };
  17590. constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Nullable<Texture>, generateMipMaps?: boolean, isCube?: boolean);
  17591. reset(): void;
  17592. isReady(): boolean;
  17593. resetRefreshCounter(): void;
  17594. setFragment(fragment: any): void;
  17595. refreshRate: number;
  17596. getRenderSize(): number;
  17597. resize(size: number, generateMipMaps: boolean): void;
  17598. setTexture(name: string, texture: Texture): ProceduralTexture;
  17599. setFloat(name: string, value: number): ProceduralTexture;
  17600. setFloats(name: string, value: number[]): ProceduralTexture;
  17601. setColor3(name: string, value: Color3): ProceduralTexture;
  17602. setColor4(name: string, value: Color4): ProceduralTexture;
  17603. setVector2(name: string, value: Vector2): ProceduralTexture;
  17604. setVector3(name: string, value: Vector3): ProceduralTexture;
  17605. setMatrix(name: string, value: Matrix): ProceduralTexture;
  17606. render(useCameraPostProcess?: boolean): void;
  17607. clone(): ProceduralTexture;
  17608. dispose(): void;
  17609. }
  17610. }
  17611. declare module BABYLON {
  17612. class DefaultRenderingPipeline extends PostProcessRenderPipeline implements IDisposable, IAnimatable {
  17613. readonly PassPostProcessId: string;
  17614. readonly HighLightsPostProcessId: string;
  17615. readonly BlurXPostProcessId: string;
  17616. readonly BlurYPostProcessId: string;
  17617. readonly CopyBackPostProcessId: string;
  17618. readonly ImageProcessingPostProcessId: string;
  17619. readonly FxaaPostProcessId: string;
  17620. readonly FinalMergePostProcessId: string;
  17621. pass: PassPostProcess;
  17622. highlights: HighlightsPostProcess;
  17623. blurX: BlurPostProcess;
  17624. blurY: BlurPostProcess;
  17625. copyBack: PassPostProcess;
  17626. fxaa: FxaaPostProcess;
  17627. imageProcessing: ImageProcessingPostProcess;
  17628. finalMerge: PassPostProcess;
  17629. animations: Animation[];
  17630. /**
  17631. * Specifies the size of the bloom blur kernel, relative to the final output size
  17632. */
  17633. bloomKernel: number;
  17634. /**
  17635. * Specifies the weight of the bloom in the final rendering
  17636. */
  17637. bloomWeight: number;
  17638. bloomScale: number;
  17639. bloomEnabled: boolean;
  17640. fxaaEnabled: boolean;
  17641. imageProcessingEnabled: boolean;
  17642. /**
  17643. * @constructor
  17644. * @param {string} name - The rendering pipeline name
  17645. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  17646. * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)
  17647. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  17648. * @param {boolean} automaticBuild - if false, you will have to manually call prepare() to update the pipeline
  17649. */
  17650. constructor(name: string, hdr: boolean, scene: Scene, cameras?: Camera[], automaticBuild?: boolean);
  17651. /**
  17652. * Force the compilation of the entire pipeline.
  17653. */
  17654. prepare(): void;
  17655. dispose(): void;
  17656. serialize(): any;
  17657. static Parse(source: any, scene: Scene, rootUrl: string): DefaultRenderingPipeline;
  17658. }
  17659. }
  17660. declare module BABYLON {
  17661. class LensRenderingPipeline extends PostProcessRenderPipeline {
  17662. /**
  17663. * The chromatic aberration PostProcess id in the pipeline
  17664. * @type {string}
  17665. */
  17666. LensChromaticAberrationEffect: string;
  17667. /**
  17668. * The highlights enhancing PostProcess id in the pipeline
  17669. * @type {string}
  17670. */
  17671. HighlightsEnhancingEffect: string;
  17672. /**
  17673. * The depth-of-field PostProcess id in the pipeline
  17674. * @type {string}
  17675. */
  17676. LensDepthOfFieldEffect: string;
  17677. /**
  17678. * @constructor
  17679. *
  17680. * Effect parameters are as follow:
  17681. * {
  17682. * chromatic_aberration: number; // from 0 to x (1 for realism)
  17683. * edge_blur: number; // from 0 to x (1 for realism)
  17684. * distortion: number; // from 0 to x (1 for realism)
  17685. * grain_amount: number; // from 0 to 1
  17686. * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise
  17687. * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)
  17688. * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)
  17689. * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)
  17690. * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect
  17691. * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)
  17692. * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)
  17693. * blur_noise: boolean; // add a little bit of noise to the blur (default: true)
  17694. * }
  17695. * Note: if an effect parameter is unset, effect is disabled
  17696. *
  17697. * @param {string} name - The rendering pipeline name
  17698. * @param {object} parameters - An object containing all parameters (see above)
  17699. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  17700. * @param {number} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)
  17701. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  17702. */
  17703. constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]);
  17704. setEdgeBlur(amount: number): void;
  17705. disableEdgeBlur(): void;
  17706. setGrainAmount(amount: number): void;
  17707. disableGrain(): void;
  17708. setChromaticAberration(amount: number): void;
  17709. disableChromaticAberration(): void;
  17710. setEdgeDistortion(amount: number): void;
  17711. disableEdgeDistortion(): void;
  17712. setFocusDistance(amount: number): void;
  17713. disableDepthOfField(): void;
  17714. setAperture(amount: number): void;
  17715. setDarkenOutOfFocus(amount: number): void;
  17716. enablePentagonBokeh(): void;
  17717. disablePentagonBokeh(): void;
  17718. enableNoiseBlur(): void;
  17719. disableNoiseBlur(): void;
  17720. setHighlightsGain(amount: number): void;
  17721. setHighlightsThreshold(amount: number): void;
  17722. disableHighlights(): void;
  17723. /**
  17724. * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
  17725. */
  17726. dispose(disableDepthRender?: boolean): void;
  17727. }
  17728. }
  17729. declare module BABYLON {
  17730. class SSAO2RenderingPipeline extends PostProcessRenderPipeline {
  17731. /**
  17732. * The PassPostProcess id in the pipeline that contains the original scene color
  17733. * @type {string}
  17734. */
  17735. SSAOOriginalSceneColorEffect: string;
  17736. /**
  17737. * The SSAO PostProcess id in the pipeline
  17738. * @type {string}
  17739. */
  17740. SSAORenderEffect: string;
  17741. /**
  17742. * The horizontal blur PostProcess id in the pipeline
  17743. * @type {string}
  17744. */
  17745. SSAOBlurHRenderEffect: string;
  17746. /**
  17747. * The vertical blur PostProcess id in the pipeline
  17748. * @type {string}
  17749. */
  17750. SSAOBlurVRenderEffect: string;
  17751. /**
  17752. * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
  17753. * @type {string}
  17754. */
  17755. SSAOCombineRenderEffect: string;
  17756. /**
  17757. * The output strength of the SSAO post-process. Default value is 1.0.
  17758. * @type {number}
  17759. */
  17760. totalStrength: number;
  17761. /**
  17762. * Maximum depth value to still render AO. A smooth falloff makes the dimming more natural, so there will be no abrupt shading change.
  17763. * @type {number}
  17764. */
  17765. maxZ: number;
  17766. /**
  17767. * In order to save performances, SSAO radius is clamped on close geometry. This ratio changes by how much
  17768. * @type {number}
  17769. */
  17770. minZAspect: number;
  17771. /**
  17772. * Number of samples used for the SSAO calculations. Default value is 8
  17773. * @type {number}
  17774. */
  17775. /**
  17776. * Dynamically generated sphere sampler.
  17777. * @type {number[]}
  17778. */
  17779. /**
  17780. * Blur filter offsets
  17781. * @type {number[]}
  17782. */
  17783. samples: number;
  17784. /**
  17785. * Are we using bilateral blur ?
  17786. * @type {boolean}
  17787. */
  17788. expensiveBlur: boolean;
  17789. /**
  17790. * The radius around the analyzed pixel used by the SSAO post-process. Default value is 2.0
  17791. * @type {number}
  17792. */
  17793. radius: number;
  17794. /**
  17795. * The base color of the SSAO post-process
  17796. * The final result is "base + ssao" between [0, 1]
  17797. * @type {number}
  17798. */
  17799. base: number;
  17800. /**
  17801. * Support test.
  17802. * @type {boolean}
  17803. */
  17804. static readonly IsSupported: boolean;
  17805. /**
  17806. * @constructor
  17807. * @param {string} name - The rendering pipeline name
  17808. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  17809. * @param {any} ratio - The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, blurRatio: 1.0 }
  17810. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  17811. */
  17812. constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
  17813. /**
  17814. * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
  17815. */
  17816. dispose(disableGeometryBufferRenderer?: boolean): void;
  17817. }
  17818. }
  17819. declare module BABYLON {
  17820. class SSAORenderingPipeline extends PostProcessRenderPipeline {
  17821. /**
  17822. * The PassPostProcess id in the pipeline that contains the original scene color
  17823. * @type {string}
  17824. */
  17825. SSAOOriginalSceneColorEffect: string;
  17826. /**
  17827. * The SSAO PostProcess id in the pipeline
  17828. * @type {string}
  17829. */
  17830. SSAORenderEffect: string;
  17831. /**
  17832. * The horizontal blur PostProcess id in the pipeline
  17833. * @type {string}
  17834. */
  17835. SSAOBlurHRenderEffect: string;
  17836. /**
  17837. * The vertical blur PostProcess id in the pipeline
  17838. * @type {string}
  17839. */
  17840. SSAOBlurVRenderEffect: string;
  17841. /**
  17842. * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
  17843. * @type {string}
  17844. */
  17845. SSAOCombineRenderEffect: string;
  17846. /**
  17847. * The output strength of the SSAO post-process. Default value is 1.0.
  17848. * @type {number}
  17849. */
  17850. totalStrength: number;
  17851. /**
  17852. * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006
  17853. * @type {number}
  17854. */
  17855. radius: number;
  17856. /**
  17857. * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel
  17858. * Must not be equal to fallOff and superior to fallOff.
  17859. * Default value is 0.975
  17860. * @type {number}
  17861. */
  17862. area: number;
  17863. /**
  17864. * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel
  17865. * Must not be equal to area and inferior to area.
  17866. * Default value is 0.0
  17867. * @type {number}
  17868. */
  17869. fallOff: number;
  17870. /**
  17871. * The base color of the SSAO post-process
  17872. * The final result is "base + ssao" between [0, 1]
  17873. * @type {number}
  17874. */
  17875. base: number;
  17876. /**
  17877. * @constructor
  17878. * @param {string} name - The rendering pipeline name
  17879. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  17880. * @param {any} ratio - The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, combineRatio: 1.0 }
  17881. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  17882. */
  17883. constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
  17884. /**
  17885. * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
  17886. */
  17887. dispose(disableDepthRender?: boolean): void;
  17888. }
  17889. }
  17890. declare module BABYLON {
  17891. class StandardRenderingPipeline extends PostProcessRenderPipeline implements IDisposable, IAnimatable {
  17892. /**
  17893. * Public members
  17894. */
  17895. originalPostProcess: Nullable<PostProcess>;
  17896. downSampleX4PostProcess: Nullable<PostProcess>;
  17897. brightPassPostProcess: Nullable<PostProcess>;
  17898. blurHPostProcesses: PostProcess[];
  17899. blurVPostProcesses: PostProcess[];
  17900. textureAdderPostProcess: Nullable<PostProcess>;
  17901. volumetricLightPostProcess: Nullable<PostProcess>;
  17902. volumetricLightSmoothXPostProcess: Nullable<BlurPostProcess>;
  17903. volumetricLightSmoothYPostProcess: Nullable<BlurPostProcess>;
  17904. volumetricLightMergePostProces: Nullable<PostProcess>;
  17905. volumetricLightFinalPostProcess: Nullable<PostProcess>;
  17906. luminancePostProcess: Nullable<PostProcess>;
  17907. luminanceDownSamplePostProcesses: PostProcess[];
  17908. hdrPostProcess: Nullable<PostProcess>;
  17909. textureAdderFinalPostProcess: Nullable<PostProcess>;
  17910. lensFlareFinalPostProcess: Nullable<PostProcess>;
  17911. hdrFinalPostProcess: Nullable<PostProcess>;
  17912. lensFlarePostProcess: Nullable<PostProcess>;
  17913. lensFlareComposePostProcess: Nullable<PostProcess>;
  17914. motionBlurPostProcess: Nullable<PostProcess>;
  17915. depthOfFieldPostProcess: Nullable<PostProcess>;
  17916. brightThreshold: number;
  17917. blurWidth: number;
  17918. horizontalBlur: boolean;
  17919. exposure: number;
  17920. lensTexture: Nullable<Texture>;
  17921. volumetricLightCoefficient: number;
  17922. volumetricLightPower: number;
  17923. volumetricLightBlurScale: number;
  17924. sourceLight: Nullable<SpotLight | DirectionalLight>;
  17925. hdrMinimumLuminance: number;
  17926. hdrDecreaseRate: number;
  17927. hdrIncreaseRate: number;
  17928. lensColorTexture: Nullable<Texture>;
  17929. lensFlareStrength: number;
  17930. lensFlareGhostDispersal: number;
  17931. lensFlareHaloWidth: number;
  17932. lensFlareDistortionStrength: number;
  17933. lensStarTexture: Nullable<Texture>;
  17934. lensFlareDirtTexture: Nullable<Texture>;
  17935. depthOfFieldDistance: number;
  17936. depthOfFieldBlurWidth: number;
  17937. motionStrength: number;
  17938. animations: Animation[];
  17939. /**
  17940. * Private members
  17941. */
  17942. BloomEnabled: boolean;
  17943. DepthOfFieldEnabled: boolean;
  17944. LensFlareEnabled: boolean;
  17945. HDREnabled: boolean;
  17946. VLSEnabled: boolean;
  17947. MotionBlurEnabled: boolean;
  17948. volumetricLightStepsCount: number;
  17949. motionBlurSamples: number;
  17950. /**
  17951. * @constructor
  17952. * @param {string} name - The rendering pipeline name
  17953. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  17954. * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)
  17955. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  17956. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  17957. */
  17958. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: Nullable<PostProcess>, cameras?: Camera[]);
  17959. dispose(): void;
  17960. serialize(): any;
  17961. /**
  17962. * Static members
  17963. */
  17964. static Parse(source: any, scene: Scene, rootUrl: string): StandardRenderingPipeline;
  17965. static LuminanceSteps: number;
  17966. }
  17967. }
  17968. declare module BABYLON.GUI {
  17969. interface IFocusableControl {
  17970. onFocus(): void;
  17971. onBlur(): void;
  17972. processKeyboard(evt: KeyboardEvent): void;
  17973. }
  17974. class AdvancedDynamicTexture extends DynamicTexture {
  17975. renderScale: number;
  17976. background: string;
  17977. idealWidth: number;
  17978. idealHeight: number;
  17979. renderAtIdealSize: boolean;
  17980. readonly layer: Nullable<Layer>;
  17981. readonly rootContainer: Container;
  17982. focusedControl: Nullable<IFocusableControl>;
  17983. isForeground: boolean;
  17984. constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number);
  17985. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  17986. markAsDirty(): void;
  17987. addControl(control: Control): AdvancedDynamicTexture;
  17988. removeControl(control: Control): AdvancedDynamicTexture;
  17989. dispose(): void;
  17990. attach(): void;
  17991. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  17992. moveFocusToControl(control: IFocusableControl): void;
  17993. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean): AdvancedDynamicTexture;
  17994. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
  17995. }
  17996. }
  17997. declare module BABYLON.GUI {
  17998. class Measure {
  17999. left: number;
  18000. top: number;
  18001. width: number;
  18002. height: number;
  18003. constructor(left: number, top: number, width: number, height: number);
  18004. copyFrom(other: Measure): void;
  18005. isEqualsTo(other: Measure): boolean;
  18006. static Empty(): Measure;
  18007. }
  18008. }
  18009. declare module BABYLON.GUI {
  18010. class Vector2WithInfo extends Vector2 {
  18011. buttonIndex: number;
  18012. constructor(source: Vector2, buttonIndex?: number);
  18013. }
  18014. class Matrix2D {
  18015. m: Float32Array;
  18016. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  18017. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  18018. determinant(): number;
  18019. invertToRef(result: Matrix2D): Matrix2D;
  18020. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  18021. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  18022. static Identity(): Matrix2D;
  18023. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  18024. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  18025. static RotationToRef(angle: number, result: Matrix2D): void;
  18026. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void;
  18027. }
  18028. }
  18029. declare module BABYLON.GUI {
  18030. class ValueAndUnit {
  18031. unit: number;
  18032. negativeValueAllowed: boolean;
  18033. ignoreAdaptiveScaling: boolean;
  18034. constructor(value: number, unit?: number, negativeValueAllowed?: boolean);
  18035. readonly isPercentage: boolean;
  18036. readonly isPixel: boolean;
  18037. readonly internalValue: number;
  18038. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  18039. getValue(host: AdvancedDynamicTexture): number;
  18040. toString(host: AdvancedDynamicTexture): string;
  18041. fromString(source: string | number): boolean;
  18042. static readonly UNITMODE_PERCENTAGE: number;
  18043. static readonly UNITMODE_PIXEL: number;
  18044. }
  18045. }
  18046. declare module BABYLON.GUI {
  18047. class Control {
  18048. name: string | undefined;
  18049. parent: Nullable<Container>;
  18050. ascent: number;
  18051. height: number;
  18052. descent: number;
  18053. };
  18054. isHitTestVisible: boolean;
  18055. isPointerBlocker: boolean;
  18056. isFocusInvisible: boolean;
  18057. shadowOffsetX: number;
  18058. shadowOffsetY: number;
  18059. shadowBlur: number;
  18060. shadowColor: string;
  18061. readonly typeName: string;
  18062. /**
  18063. * An event triggered when the pointer move over the control.
  18064. * @type {BABYLON.Observable}
  18065. */
  18066. onPointerMoveObservable: Observable<Vector2>;
  18067. /**
  18068. * An event triggered when the pointer move out of the control.
  18069. * @type {BABYLON.Observable}
  18070. */
  18071. onPointerOutObservable: Observable<Control>;
  18072. /**
  18073. * An event triggered when the pointer taps the control
  18074. * @type {BABYLON.Observable}
  18075. */
  18076. onPointerDownObservable: Observable<Vector2WithInfo>;
  18077. /**
  18078. * An event triggered when pointer up
  18079. * @type {BABYLON.Observable}
  18080. */
  18081. onPointerUpObservable: Observable<Vector2WithInfo>;
  18082. /**
  18083. * An event triggered when pointer enters the control
  18084. * @type {BABYLON.Observable}
  18085. */
  18086. onPointerEnterObservable: Observable<Control>;
  18087. /**
  18088. * An event triggered when the control is marked as dirty
  18089. * @type {BABYLON.Observable}
  18090. */
  18091. onDirtyObservable: Observable<Control>;
  18092. /**
  18093. * An event triggered after the control is drawn
  18094. * @type {BABYLON.Observable}
  18095. */
  18096. onAfterDrawObservable: Observable<Control>;
  18097. alpha: number;
  18098. scaleX: number;
  18099. scaleY: number;
  18100. rotation: number;
  18101. transformCenterY: number;
  18102. transformCenterX: number;
  18103. horizontalAlignment: number;
  18104. verticalAlignment: number;
  18105. width: string | number;
  18106. readonly widthInPixels: number;
  18107. height: string | number;
  18108. readonly heightInPixels: number;
  18109. fontFamily: string;
  18110. fontStyle: string;
  18111. readonly fontSizeInPixels: number;
  18112. fontSize: string | number;
  18113. color: string;
  18114. zIndex: number;
  18115. notRenderable: boolean;
  18116. isVisible: boolean;
  18117. readonly isDirty: boolean;
  18118. paddingLeft: string | number;
  18119. readonly paddingLeftInPixels: number;
  18120. paddingRight: string | number;
  18121. readonly paddingRightInPixels: number;
  18122. paddingTop: string | number;
  18123. readonly paddingTopInPixels: number;
  18124. paddingBottom: string | number;
  18125. readonly paddingBottomInPixels: number;
  18126. left: string | number;
  18127. readonly leftInPixels: number;
  18128. top: string | number;
  18129. readonly topInPixels: number;
  18130. linkOffsetX: string | number;
  18131. readonly linkOffsetXInPixels: number;
  18132. linkOffsetY: string | number;
  18133. readonly linkOffsetYInPixels: number;
  18134. readonly centerX: number;
  18135. readonly centerY: number;
  18136. constructor(name?: string | undefined);
  18137. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  18138. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  18139. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  18140. moveToVector3(position: Vector3, scene: Scene): void;
  18141. linkWithMesh(mesh: Nullable<AbstractMesh>): void;
  18142. contains(x: number, y: number): boolean;
  18143. forcePointerUp(): void;
  18144. dispose(): void;
  18145. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  18146. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  18147. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  18148. static readonly VERTICAL_ALIGNMENT_TOP: number;
  18149. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  18150. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  18151. ascent: number;
  18152. height: number;
  18153. descent: number;
  18154. };
  18155. static AddHeader(control: Control, text: string, size: string | number, options: {
  18156. isHorizontal: boolean;
  18157. controlFirst: boolean;
  18158. }): StackPanel;
  18159. }
  18160. }
  18161. declare module BABYLON.GUI {
  18162. class Container extends Control {
  18163. name: string | undefined;
  18164. background: string;
  18165. readonly children: Control[];
  18166. constructor(name?: string | undefined);
  18167. getChildByName(name: string): Nullable<Control>;
  18168. getChildByType(name: string, type: string): Nullable<Control>;
  18169. containsControl(control: Control): boolean;
  18170. addControl(control: Control): Container;
  18171. removeControl(control: Control): Container;
  18172. dispose(): void;
  18173. }
  18174. }
  18175. declare module BABYLON.GUI {
  18176. class StackPanel extends Container {
  18177. name: string | undefined;
  18178. isVertical: boolean;
  18179. width: string | number;
  18180. height: string | number;
  18181. constructor(name?: string | undefined);
  18182. }
  18183. }
  18184. declare module BABYLON.GUI {
  18185. class Rectangle extends Container {
  18186. name: string | undefined;
  18187. thickness: number;
  18188. cornerRadius: number;
  18189. constructor(name?: string | undefined);
  18190. }
  18191. }
  18192. declare module BABYLON.GUI {
  18193. class Ellipse extends Container {
  18194. name: string | undefined;
  18195. thickness: number;
  18196. constructor(name?: string | undefined);
  18197. }
  18198. }
  18199. declare module BABYLON.GUI {
  18200. class Line extends Control {
  18201. name: string | undefined;
  18202. dash: Array<number>;
  18203. connectedControl: Control;
  18204. x1: string | number;
  18205. y1: string | number;
  18206. x2: string | number;
  18207. y2: string | number;
  18208. lineWidth: number;
  18209. horizontalAlignment: number;
  18210. verticalAlignment: number;
  18211. constructor(name?: string | undefined);
  18212. }
  18213. }
  18214. declare module BABYLON.GUI {
  18215. class Slider extends Control {
  18216. name: string | undefined;
  18217. onValueChangedObservable: Observable<number>;
  18218. borderColor: string;
  18219. background: string;
  18220. barOffset: string | number;
  18221. readonly barOffsetInPixels: number;
  18222. thumbWidth: string | number;
  18223. readonly thumbWidthInPixels: number;
  18224. minimum: number;
  18225. maximum: number;
  18226. value: number;
  18227. isThumbCircle: boolean;
  18228. constructor(name?: string | undefined);
  18229. }
  18230. }
  18231. declare module BABYLON.GUI {
  18232. class Checkbox extends Control {
  18233. name: string | undefined;
  18234. thickness: number;
  18235. onIsCheckedChangedObservable: Observable<boolean>;
  18236. checkSizeRatio: number;
  18237. background: string;
  18238. isChecked: boolean;
  18239. constructor(name?: string | undefined);
  18240. }
  18241. }
  18242. declare module BABYLON.GUI {
  18243. class RadioButton extends Control {
  18244. name: string | undefined;
  18245. thickness: number;
  18246. group: string;
  18247. onIsCheckedChangedObservable: Observable<boolean>;
  18248. checkSizeRatio: number;
  18249. background: string;
  18250. isChecked: boolean;
  18251. constructor(name?: string | undefined);
  18252. }
  18253. }
  18254. declare module BABYLON.GUI {
  18255. class TextBlock extends Control {
  18256. name: string | undefined;
  18257. /**
  18258. * An event triggered after the text is changed
  18259. * @type {BABYLON.Observable}
  18260. */
  18261. onTextChangedObservable: Observable<TextBlock>;
  18262. resizeToFit: boolean;
  18263. textWrapping: boolean;
  18264. text: string;
  18265. textHorizontalAlignment: number;
  18266. textVerticalAlignment: number;
  18267. lineSpacing: string | number;
  18268. constructor(name?: string | undefined, text?: string);
  18269. dispose(): void;
  18270. }
  18271. }
  18272. declare var DOMImage: new (width?: number | undefined, height?: number | undefined) => HTMLImageElement;
  18273. declare module BABYLON.GUI {
  18274. class Image extends Control {
  18275. name: string | undefined;
  18276. sourceLeft: number;
  18277. sourceTop: number;
  18278. sourceWidth: number;
  18279. sourceHeight: number;
  18280. autoScale: boolean;
  18281. stretch: number;
  18282. domImage: HTMLImageElement;
  18283. source: Nullable<string>;
  18284. cellWidth: number;
  18285. cellHeight: number;
  18286. cellId: number;
  18287. constructor(name?: string | undefined, url?: Nullable<string>);
  18288. synchronizeSizeWithContent(): void;
  18289. static readonly STRETCH_NONE: number;
  18290. static readonly STRETCH_FILL: number;
  18291. static readonly STRETCH_UNIFORM: number;
  18292. static readonly STRETCH_EXTEND: number;
  18293. }
  18294. }
  18295. declare module BABYLON.GUI {
  18296. class Button extends Rectangle {
  18297. name: string | undefined;
  18298. pointerEnterAnimation: () => void;
  18299. pointerOutAnimation: () => void;
  18300. pointerDownAnimation: () => void;
  18301. pointerUpAnimation: () => void;
  18302. constructor(name?: string | undefined);
  18303. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  18304. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  18305. static CreateSimpleButton(name: string, text: string): Button;
  18306. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  18307. }
  18308. }
  18309. declare module BABYLON.GUI {
  18310. class ColorPicker extends Control {
  18311. name: string | undefined;
  18312. onValueChangedObservable: Observable<Color3>;
  18313. value: Color3;
  18314. width: string | number;
  18315. height: string | number;
  18316. size: string | number;
  18317. constructor(name?: string | undefined);
  18318. }
  18319. }
  18320. declare module BABYLON.GUI {
  18321. class InputText extends Control implements IFocusableControl {
  18322. name: string | undefined;
  18323. promptMessage: string;
  18324. onTextChangedObservable: Observable<InputText>;
  18325. onFocusObservable: Observable<InputText>;
  18326. onBlurObservable: Observable<InputText>;
  18327. maxWidth: string | number;
  18328. readonly maxWidthInPixels: number;
  18329. margin: string;
  18330. readonly marginInPixels: number;
  18331. autoStretchWidth: boolean;
  18332. thickness: number;
  18333. focusedBackground: string;
  18334. background: string;
  18335. placeholderColor: string;
  18336. placeholderText: string;
  18337. text: string;
  18338. width: string | number;
  18339. constructor(name?: string | undefined, text?: string);
  18340. onBlur(): void;
  18341. onFocus(): void;
  18342. processKey(keyCode: number, key?: string): void;
  18343. processKeyboard(evt: KeyboardEvent): void;
  18344. dispose(): void;
  18345. }
  18346. }
  18347. declare module BABYLON.GUI {
  18348. class KeyPropertySet {
  18349. width?: string;
  18350. height?: string;
  18351. paddingLeft?: string;
  18352. paddingRight?: string;
  18353. paddingTop?: string;
  18354. paddingBottom?: string;
  18355. color?: string;
  18356. background?: string;
  18357. }
  18358. class VirtualKeyboard extends StackPanel {
  18359. onKeyPressObservable: Observable<string>;
  18360. defaultButtonWidth: string;
  18361. defaultButtonHeight: string;
  18362. defaultButtonPaddingLeft: string;
  18363. defaultButtonPaddingRight: string;
  18364. defaultButtonPaddingTop: string;
  18365. defaultButtonPaddingBottom: string;
  18366. defaultButtonColor: string;
  18367. defaultButtonBackground: string;
  18368. shiftButtonColor: string;
  18369. selectedShiftThickness: number;
  18370. shiftState: number;
  18371. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  18372. applyShiftState(shiftState: number): void;
  18373. readonly connectedInputText: Nullable<InputText>;
  18374. connect(input: InputText): void;
  18375. disconnect(): void;
  18376. static CreateDefaultLayout(): VirtualKeyboard;
  18377. }
  18378. }