babylon.d.txt 721 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435
  1. declare module BABYLON {
  2. class InstancingAttributeInfo {
  3. /**
  4. * Index/offset of the attribute in the vertex shader
  5. */
  6. index: number;
  7. /**
  8. * size of the attribute, 1, 2, 3 or 4
  9. */
  10. attributeSize: number;
  11. /**
  12. * type of the attribute, gl.BYTE, gl.UNSIGNED_BYTE, gl.SHORT, gl.UNSIGNED_SHORT, gl.FIXED, gl.FLOAT.
  13. * default is FLOAT
  14. */
  15. attribyteType: number;
  16. /**
  17. * normalization of fixed-point data. behavior unclear, use FALSE, default is FALSE
  18. */
  19. normalized: boolean;
  20. /**
  21. * Offset of the data in the Vertex Buffer acting as the instancing buffer
  22. */
  23. offset: number;
  24. /**
  25. * Name of the GLSL attribute, for debugging purpose only
  26. */
  27. attributeName: string;
  28. }
  29. class EngineCapabilities {
  30. maxTexturesImageUnits: number;
  31. maxVertexTextureImageUnits: number;
  32. maxTextureSize: number;
  33. maxCubemapTextureSize: number;
  34. maxRenderTextureSize: number;
  35. maxVertexAttribs: number;
  36. maxVaryingVectors: number;
  37. maxVertexUniformVectors: number;
  38. maxFragmentUniformVectors: number;
  39. standardDerivatives: boolean;
  40. s3tc: WEBGL_compressed_texture_s3tc;
  41. pvrtc: any;
  42. etc1: any;
  43. etc2: any;
  44. astc: any;
  45. textureFloat: boolean;
  46. vertexArrayObject: boolean;
  47. textureAnisotropicFilterExtension: EXT_texture_filter_anisotropic;
  48. maxAnisotropy: number;
  49. instancedArrays: boolean;
  50. uintIndices: boolean;
  51. highPrecisionShaderSupported: boolean;
  52. fragmentDepthSupported: boolean;
  53. textureFloatLinearFiltering: boolean;
  54. textureFloatRender: boolean;
  55. textureHalfFloat: boolean;
  56. textureHalfFloatLinearFiltering: boolean;
  57. textureHalfFloatRender: boolean;
  58. textureLOD: boolean;
  59. drawBuffersExtension: any;
  60. colorBufferFloat: boolean;
  61. }
  62. interface EngineOptions extends WebGLContextAttributes {
  63. limitDeviceRatio?: number;
  64. autoEnableWebVR?: boolean;
  65. disableWebGL2Support?: boolean;
  66. audioEngine?: boolean;
  67. }
  68. /**
  69. * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio.
  70. */
  71. class Engine {
  72. static Instances: Engine[];
  73. static readonly LastCreatedEngine: Engine;
  74. static readonly LastCreatedScene: Scene;
  75. /**
  76. * Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation
  77. */
  78. static MarkAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
  79. private static HALF_FLOAT_OES;
  80. private static RGBA16F;
  81. private static RGBA32F;
  82. static readonly NEVER: number;
  83. static readonly ALWAYS: number;
  84. static readonly LESS: number;
  85. static readonly EQUAL: number;
  86. static readonly LEQUAL: number;
  87. static readonly GREATER: number;
  88. static readonly GEQUAL: number;
  89. static readonly NOTEQUAL: number;
  90. static readonly KEEP: number;
  91. static readonly REPLACE: number;
  92. static readonly INCR: number;
  93. static readonly DECR: number;
  94. static readonly INVERT: number;
  95. static readonly INCR_WRAP: number;
  96. static readonly DECR_WRAP: number;
  97. static readonly ALPHA_DISABLE: number;
  98. static readonly ALPHA_ONEONE: number;
  99. static readonly ALPHA_ADD: number;
  100. static readonly ALPHA_COMBINE: number;
  101. static readonly ALPHA_SUBTRACT: number;
  102. static readonly ALPHA_MULTIPLY: number;
  103. static readonly ALPHA_MAXIMIZED: number;
  104. static readonly ALPHA_PREMULTIPLIED: number;
  105. static readonly ALPHA_PREMULTIPLIED_PORTERDUFF: number;
  106. static readonly ALPHA_INTERPOLATE: number;
  107. static readonly ALPHA_SCREENMODE: number;
  108. static readonly DELAYLOADSTATE_NONE: number;
  109. static readonly DELAYLOADSTATE_LOADED: number;
  110. static readonly DELAYLOADSTATE_LOADING: number;
  111. static readonly DELAYLOADSTATE_NOTLOADED: number;
  112. static readonly TEXTUREFORMAT_ALPHA: number;
  113. static readonly TEXTUREFORMAT_LUMINANCE: number;
  114. static readonly TEXTUREFORMAT_LUMINANCE_ALPHA: number;
  115. static readonly TEXTUREFORMAT_RGB: number;
  116. static readonly TEXTUREFORMAT_RGBA: number;
  117. static readonly TEXTURETYPE_UNSIGNED_INT: number;
  118. static readonly TEXTURETYPE_FLOAT: number;
  119. static readonly TEXTURETYPE_HALF_FLOAT: number;
  120. static readonly SCALEMODE_FLOOR: number;
  121. static readonly SCALEMODE_NEAREST: number;
  122. static readonly SCALEMODE_CEILING: number;
  123. static readonly Version: string;
  124. static CollisionsEpsilon: number;
  125. static CodeRepository: string;
  126. static ShadersRepository: string;
  127. isFullscreen: boolean;
  128. isPointerLock: boolean;
  129. cullBackFaces: boolean;
  130. renderEvenInBackground: boolean;
  131. preventCacheWipeBetweenFrames: boolean;
  132. enableOfflineSupport: typeof Database;
  133. scenes: Scene[];
  134. /**
  135. * Observable event triggered each time the rendering canvas is resized
  136. */
  137. onResizeObservable: Observable<Engine>;
  138. /**
  139. * Observable event triggered each time the canvas lost focus
  140. */
  141. onCanvasBlurObservable: Observable<Engine>;
  142. vrDisplaysPromise: any;
  143. static audioEngine: AudioEngine;
  144. private fpsRange;
  145. private previousFramesDuration;
  146. private fps;
  147. private deltaTime;
  148. readonly texturesSupported: Array<string>;
  149. readonly textureFormatInUse: string;
  150. readonly emptyTexture: WebGLTexture;
  151. readonly emptyCubeTexture: WebGLTexture;
  152. /**
  153. * @constructor
  154. * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering
  155. * @param {boolean} [antialias] - enable antialias
  156. * @param options - further options to be sent to the getContext function
  157. */
  158. constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio?: boolean);
  159. readonly webGLVersion: number;
  160. /**
  161. * Returns true if the stencil buffer has been enabled through the creation option of the context.
  162. */
  163. readonly isStencilEnable: boolean;
  164. resetTextureCache(): void;
  165. getGlInfo(): {
  166. vendor: string;
  167. renderer: string;
  168. version: string;
  169. };
  170. getAspectRatio(camera: Camera, useScreen?: boolean): number;
  171. getRenderWidth(useScreen?: boolean): number;
  172. getRenderHeight(useScreen?: boolean): number;
  173. getRenderingCanvas(): HTMLCanvasElement;
  174. getRenderingCanvasClientRect(): ClientRect;
  175. setHardwareScalingLevel(level: number): void;
  176. getHardwareScalingLevel(): number;
  177. getLoadedTexturesCache(): WebGLTexture[];
  178. getCaps(): EngineCapabilities;
  179. readonly drawCalls: number;
  180. readonly drawCallsPerfCounter: PerfCounter;
  181. getDepthFunction(): number;
  182. setDepthFunction(depthFunc: number): void;
  183. setDepthFunctionToGreater(): void;
  184. setDepthFunctionToGreaterOrEqual(): void;
  185. setDepthFunctionToLess(): void;
  186. setDepthFunctionToLessOrEqual(): void;
  187. getStencilBuffer(): boolean;
  188. setStencilBuffer(enable: boolean): void;
  189. getStencilMask(): number;
  190. setStencilMask(mask: number): void;
  191. getStencilFunction(): number;
  192. getStencilFunctionReference(): number;
  193. getStencilFunctionMask(): number;
  194. setStencilFunction(stencilFunc: number): void;
  195. setStencilFunctionReference(reference: number): void;
  196. setStencilFunctionMask(mask: number): void;
  197. getStencilOperationFail(): number;
  198. getStencilOperationDepthFail(): number;
  199. getStencilOperationPass(): number;
  200. setStencilOperationFail(operation: number): void;
  201. setStencilOperationDepthFail(operation: number): void;
  202. setStencilOperationPass(operation: number): void;
  203. setDitheringState(value: boolean): void;
  204. /**
  205. * stop executing a render loop function and remove it from the execution array
  206. * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
  207. */
  208. stopRenderLoop(renderFunction?: () => void): void;
  209. /**
  210. * Register and execute a render loop. The engine can have more than one render function.
  211. * @param {Function} renderFunction - the function to continuously execute starting the next render loop.
  212. * @example
  213. * engine.runRenderLoop(function () {
  214. * scene.render()
  215. * })
  216. */
  217. runRenderLoop(renderFunction: () => void): void;
  218. /**
  219. * Toggle full screen mode.
  220. * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
  221. * @param {any} options - an options object to be sent to the requestFullscreen function
  222. */
  223. switchFullscreen(requestPointerLock: boolean): void;
  224. clear(color: Color4, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
  225. scissorClear(x: number, y: number, width: number, height: number, clearColor: Color4): void;
  226. /**
  227. * Set the WebGL's viewport
  228. * @param {BABYLON.Viewport} viewport - the viewport element to be used.
  229. * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used.
  230. * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used.
  231. */
  232. setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  233. /**
  234. * Directly set the WebGL Viewport
  235. * The x, y, width & height are directly passed to the WebGL call
  236. * @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.
  237. */
  238. setDirectViewport(x: number, y: number, width: number, height: number): Viewport;
  239. beginFrame(): void;
  240. endFrame(): void;
  241. /**
  242. * resize the view according to the canvas' size.
  243. * @example
  244. * window.addEventListener("resize", function () {
  245. * engine.resize();
  246. * });
  247. */
  248. resize(): void;
  249. /**
  250. * force a specific size of the canvas
  251. * @param {number} width - the new canvas' width
  252. * @param {number} height - the new canvas' height
  253. */
  254. setSize(width: number, height: number): void;
  255. isVRDevicePresent(callback: (result: boolean) => void): void;
  256. getVRDevice(name: string, callback: (device: any) => void): void;
  257. initWebVR(): void;
  258. enableVR(vrDevice: any): void;
  259. disableVR(): void;
  260. bindFramebuffer(texture: WebGLTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number): void;
  261. private bindUnboundFramebuffer(framebuffer);
  262. unBindFramebuffer(texture: WebGLTexture, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
  263. generateMipMapsForCubemap(texture: WebGLTexture): void;
  264. flushFramebuffer(): void;
  265. restoreDefaultFramebuffer(): void;
  266. createUniformBuffer(elements: number[] | Float32Array): WebGLBuffer;
  267. createDynamicUniformBuffer(elements: number[] | Float32Array): WebGLBuffer;
  268. updateUniformBuffer(uniformBuffer: WebGLBuffer, elements: number[] | Float32Array, offset?: number, count?: number): void;
  269. createVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  270. createDynamicVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  271. updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: number[] | Float32Array, offset?: number, count?: number): void;
  272. createIndexBuffer(indices: IndicesArray): WebGLBuffer;
  273. bindArrayBuffer(buffer: WebGLBuffer): void;
  274. bindUniformBuffer(buffer?: WebGLBuffer): void;
  275. bindUniformBufferBase(buffer: WebGLBuffer, location: number): void;
  276. bindUniformBlock(shaderProgram: WebGLProgram, blockName: string, index: number): void;
  277. private bindIndexBuffer(buffer);
  278. private bindBuffer(buffer, target);
  279. updateArrayBuffer(data: Float32Array): void;
  280. private vertexAttribPointer(buffer, indx, size, type, normalized, stride, offset);
  281. recordVertexArrayObject(vertexBuffers: {
  282. [key: string]: VertexBuffer;
  283. }, indexBuffer: WebGLBuffer, effect: Effect): WebGLVertexArrayObject;
  284. bindVertexArrayObject(vertexArrayObject: WebGLVertexArrayObject, indexBuffer: WebGLBuffer): void;
  285. bindBuffersDirectly(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
  286. bindBuffers(vertexBuffers: {
  287. [key: string]: VertexBuffer;
  288. }, indexBuffer: WebGLBuffer, effect: Effect): void;
  289. unbindInstanceAttributes(): void;
  290. releaseVertexArrayObject(vao: WebGLVertexArrayObject): void;
  291. createInstancesBuffer(capacity: number): WebGLBuffer;
  292. deleteInstancesBuffer(buffer: WebGLBuffer): void;
  293. updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[] | InstancingAttributeInfo[]): void;
  294. applyStates(): void;
  295. draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  296. drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void;
  297. drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  298. 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;
  299. createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  300. createShaderProgram(vertexCode: string, fragmentCode: string, defines: string, context?: WebGLRenderingContext): WebGLProgram;
  301. getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
  302. getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  303. enableEffect(effect: Effect): void;
  304. setIntArray(uniform: WebGLUniformLocation, array: Int32Array): void;
  305. setIntArray2(uniform: WebGLUniformLocation, array: Int32Array): void;
  306. setIntArray3(uniform: WebGLUniformLocation, array: Int32Array): void;
  307. setIntArray4(uniform: WebGLUniformLocation, array: Int32Array): void;
  308. setFloatArray(uniform: WebGLUniformLocation, array: Float32Array): void;
  309. setFloatArray2(uniform: WebGLUniformLocation, array: Float32Array): void;
  310. setFloatArray3(uniform: WebGLUniformLocation, array: Float32Array): void;
  311. setFloatArray4(uniform: WebGLUniformLocation, array: Float32Array): void;
  312. setArray(uniform: WebGLUniformLocation, array: number[]): void;
  313. setArray2(uniform: WebGLUniformLocation, array: number[]): void;
  314. setArray3(uniform: WebGLUniformLocation, array: number[]): void;
  315. setArray4(uniform: WebGLUniformLocation, array: number[]): void;
  316. setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void;
  317. setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void;
  318. setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  319. setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  320. setFloat(uniform: WebGLUniformLocation, value: number): void;
  321. setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void;
  322. setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void;
  323. setBool(uniform: WebGLUniformLocation, bool: number): void;
  324. setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
  325. setColor3(uniform: WebGLUniformLocation, color3: Color3): void;
  326. setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void;
  327. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
  328. setZOffset(value: number): void;
  329. getZOffset(): number;
  330. setDepthBuffer(enable: boolean): void;
  331. getDepthWrite(): boolean;
  332. setDepthWrite(enable: boolean): void;
  333. setColorWrite(enable: boolean): void;
  334. setAlphaConstants(r: number, g: number, b: number, a: number): void;
  335. setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
  336. getAlphaMode(): number;
  337. setAlphaTesting(enable: boolean): void;
  338. getAlphaTesting(): boolean;
  339. wipeCaches(bruteForce?: boolean): void;
  340. /**
  341. * Set the compressed texture format to use, based on the formats you have, and the formats
  342. * supported by the hardware / browser.
  343. *
  344. * Khronos Texture Container (.ktx) files are used to support this. This format has the
  345. * advantage of being specifically designed for OpenGL. Header elements directly correspond
  346. * to API arguments needed to compressed textures. This puts the burden on the container
  347. * generator to house the arcane code for determining these for current & future formats.
  348. *
  349. * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
  350. * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
  351. *
  352. * Note: The result of this call is not taken into account when a texture is base64.
  353. *
  354. * @param {Array<string>} formatsAvailable- The list of those format families you have created
  355. * on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)
  356. *
  357. * Current families are astc, dxt, pvrtc, etc2, & etc1.
  358. * @returns The extension selected.
  359. */
  360. setTextureFormatToUse(formatsAvailable: Array<string>): string;
  361. /**
  362. * Usually called from BABYLON.Texture.ts. Passed information to create a WebGLTexture.
  363. * @param {string} urlArg- This contains one of the following:
  364. * 1. A conventional http URL, e.g. 'http://...' or 'file://...'
  365. * 2. A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
  366. * 3. An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
  367. *
  368. * @param {boolean} noMipmap- When true, no mipmaps shall be generated. Ignored for compressed textures. They must be in the file.
  369. * @param {boolean} invertY- When true, image is flipped when loaded. You probably want true. Ignored for compressed textures. Must be flipped in the file.
  370. * @param {Scene} scene- Needed for loading to the correct scene.
  371. * @param {number} samplingMode- Mode with should be used sample / access the texture. Default: TRILINEAR
  372. * @param {callback} onLoad- Optional callback to be called upon successful completion.
  373. * @param {callback} onError- Optional callback to be called upon failure.
  374. * @param {ArrayBuffer | HTMLImageElement} buffer- A source of a file previously fetched as either an ArrayBuffer (compressed or image format) or HTMLImageElement (image format)
  375. * @param {WebGLTexture} fallback- An internal argument in case the function must be called again, due to etc1 not having alpha capabilities.
  376. * @param {number} format- Internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures.
  377. *
  378. * @returns {WebGLTexture} for assignment back into BABYLON.Texture
  379. */
  380. createTexture(urlArg: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: ArrayBuffer | HTMLImageElement, fallBack?: WebGLTexture, format?: number): WebGLTexture;
  381. updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void;
  382. createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture;
  383. createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): WebGLTexture;
  384. updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void;
  385. updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean, format?: number): void;
  386. updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void;
  387. createRenderTargetTexture(size: any, options: any): WebGLTexture;
  388. createMultipleRenderTarget(size: any, options: any): WebGLTexture[];
  389. updateRenderTargetTextureSampleCount(texture: WebGLTexture, samples: number): number;
  390. createRenderTargetCubeTexture(size: number, options?: any): WebGLTexture;
  391. createCubeTexture(rootUrl: string, scene: Scene, files: string[], noMipmap?: boolean, onLoad?: () => void, onError?: () => void, format?: number): WebGLTexture;
  392. updateTextureSize(texture: WebGLTexture, width: number, height: number): void;
  393. updateRawCubeTexture(texture: WebGLTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression?: string, level?: number): void;
  394. createRawCubeTexture(data: ArrayBufferView[], size: number, format: number, type: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture;
  395. createRawCubeTextureFromUrl(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer: ArrayBuffer) => ArrayBufferView[], mipmmapGenerator: ((faces: ArrayBufferView[]) => ArrayBufferView[][]), onLoad?: () => void, onError?: () => void, samplingMode?: number, invertY?: boolean): WebGLTexture;
  396. private setProgram(program);
  397. bindSamplers(effect: Effect): void;
  398. private activateTexture(texture);
  399. setTextureFromPostProcess(channel: number, postProcess: PostProcess): void;
  400. unbindAllTextures(): void;
  401. setTexture(channel: number, uniform: WebGLUniformLocation, texture: BaseTexture): void;
  402. setTextureArray(channel: number, uniform: WebGLUniformLocation, textures: BaseTexture[]): void;
  403. readPixels(x: number, y: number, width: number, height: number): Uint8Array;
  404. /**
  405. * Add an externaly attached data from its key.
  406. * This method call will fail and return false, if such key already exists.
  407. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  408. * @param key the unique key that identifies the data
  409. * @param data the data object to associate to the key for this Engine instance
  410. * @return true if no such key were already present and the data was added successfully, false otherwise
  411. */
  412. addExternalData<T>(key: string, data: T): boolean;
  413. /**
  414. * Get an externaly attached data from its key
  415. * @param key the unique key that identifies the data
  416. * @return the associated data, if present (can be null), or undefined if not present
  417. */
  418. getExternalData<T>(key: string): T;
  419. /**
  420. * Get an externaly attached data from its key, create it using a factory if it's not already present
  421. * @param key the unique key that identifies the data
  422. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  423. * @return the associated data, can be null if the factory returned null.
  424. */
  425. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  426. /**
  427. * Remove an externaly attached data from the Engine instance
  428. * @param key the unique key that identifies the data
  429. * @return true if the data was successfully removed, false if it doesn't exist
  430. */
  431. removeExternalData(key: any): boolean;
  432. releaseInternalTexture(texture: WebGLTexture): void;
  433. unbindAllAttributes(): void;
  434. releaseEffects(): void;
  435. dispose(): void;
  436. displayLoadingUI(): void;
  437. hideLoadingUI(): void;
  438. loadingScreen: ILoadingScreen;
  439. loadingUIText: string;
  440. loadingUIBackgroundColor: string;
  441. attachContextLostEvent(callback: ((event: WebGLContextEvent) => void)): void;
  442. attachContextRestoredEvent(callback: ((event: WebGLContextEvent) => void)): void;
  443. getVertexShaderSource(program: WebGLProgram): string;
  444. getFragmentShaderSource(program: WebGLProgram): string;
  445. getError(): number;
  446. getFps(): number;
  447. getDeltaTime(): number;
  448. static isSupported(): boolean;
  449. }
  450. }
  451. interface Window {
  452. mozIndexedDB(func: any): any;
  453. webkitIndexedDB(func: any): any;
  454. msIndexedDB: IDBFactory;
  455. IDBTransaction(func: any): any;
  456. webkitIDBTransaction(func: any): any;
  457. msIDBTransaction(func: any): any;
  458. IDBKeyRange(func: any): any;
  459. webkitIDBKeyRange(func: any): any;
  460. msIDBKeyRange(func: any): any;
  461. webkitURL: HTMLURL;
  462. webkitRequestAnimationFrame(func: any): any;
  463. mozRequestAnimationFrame(func: any): any;
  464. oRequestAnimationFrame(func: any): any;
  465. WebGLRenderingContext: WebGLRenderingContext;
  466. MSGesture: MSGesture;
  467. CANNON: any;
  468. SIMD: any;
  469. AudioContext: AudioContext;
  470. webkitAudioContext: AudioContext;
  471. PointerEvent: any;
  472. Math: Math;
  473. Uint8Array: Uint8ArrayConstructor;
  474. Float32Array: Float32ArrayConstructor;
  475. mozURL: any;
  476. msURL: any;
  477. VRFrameData: any;
  478. }
  479. interface WebGLRenderingContext {
  480. drawArraysInstanced(mode: number, first: number, count: number, primcount: number): void;
  481. drawElementsInstanced(mode: number, count: number, type: number, offset: number, primcount: number): void;
  482. vertexAttribDivisor(index: number, divisor: number): void;
  483. createVertexArray(): any;
  484. bindVertexArray(vao: WebGLVertexArrayObject): void;
  485. deleteVertexArray(vao: WebGLVertexArrayObject): void;
  486. blitFramebuffer(srcX0: number, srcY0: number, srcX1: number, srcY1: number, dstX0: number, dstY0: number, dstX1: number, dstY1: number, mask: number, filter: number): void;
  487. renderbufferStorageMultisample(target: number, samples: number, internalformat: number, width: number, height: number): void;
  488. bindBufferBase(target: number, index: number, buffer: WebGLBuffer | null): void;
  489. getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string): number;
  490. uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: number, uniformBlockBinding: number): void;
  491. MAX_SAMPLES: number;
  492. RGBA8: number;
  493. READ_FRAMEBUFFER: number;
  494. DRAW_FRAMEBUFFER: number;
  495. UNIFORM_BUFFER: number;
  496. drawBuffers(buffers: number[]): void;
  497. readBuffer(src: number): void;
  498. readonly COLOR_ATTACHMENT0: number;
  499. readonly COLOR_ATTACHMENT1: number;
  500. readonly COLOR_ATTACHMENT2: number;
  501. readonly COLOR_ATTACHMENT3: number;
  502. }
  503. interface HTMLURL {
  504. createObjectURL(param1: any, param2?: any): any;
  505. }
  506. interface Document {
  507. exitFullscreen(): void;
  508. webkitCancelFullScreen(): void;
  509. mozCancelFullScreen(): void;
  510. msCancelFullScreen(): void;
  511. mozFullScreen: boolean;
  512. msIsFullScreen: boolean;
  513. fullscreen: boolean;
  514. mozPointerLockElement: HTMLElement;
  515. msPointerLockElement: HTMLElement;
  516. webkitPointerLockElement: HTMLElement;
  517. }
  518. interface HTMLCanvasElement {
  519. requestPointerLock(): void;
  520. msRequestPointerLock?(): void;
  521. mozRequestPointerLock?(): void;
  522. webkitRequestPointerLock?(): void;
  523. }
  524. interface CanvasRenderingContext2D {
  525. imageSmoothingEnabled: boolean;
  526. mozImageSmoothingEnabled: boolean;
  527. oImageSmoothingEnabled: boolean;
  528. webkitImageSmoothingEnabled: boolean;
  529. msImageSmoothingEnabled: boolean;
  530. }
  531. interface WebGLTexture {
  532. isReady: boolean;
  533. isCube: boolean;
  534. url: string;
  535. noMipmap: boolean;
  536. samplingMode: number;
  537. references: number;
  538. generateMipMaps: boolean;
  539. samples: number;
  540. type: number;
  541. onLoadedCallbacks: Array<Function>;
  542. }
  543. interface WebGLBuffer {
  544. references: number;
  545. capacity: number;
  546. is32Bits: boolean;
  547. }
  548. interface MouseEvent {
  549. mozMovementX: number;
  550. mozMovementY: number;
  551. webkitMovementX: number;
  552. webkitMovementY: number;
  553. msMovementX: number;
  554. msMovementY: number;
  555. }
  556. interface MSStyleCSSProperties {
  557. webkitTransform: string;
  558. webkitTransition: string;
  559. }
  560. interface Navigator {
  561. getVRDisplays: () => any;
  562. mozGetVRDevices: (any: any) => any;
  563. isCocoonJS: boolean;
  564. getUserMedia: any;
  565. webkitGetUserMedia: any;
  566. mozGetUserMedia: any;
  567. msGetUserMedia: any;
  568. }
  569. interface HTMLVideoElement {
  570. mozSrcObject: any;
  571. }
  572. interface Screen {
  573. orientation: string;
  574. mozOrientation: string;
  575. }
  576. interface HTMLMediaElement {
  577. crossOrigin: string | null;
  578. }
  579. interface Math {
  580. fround(x: number): number;
  581. imul(a: number, b: number): number;
  582. }
  583. interface SIMDglobal {
  584. SIMD: SIMD;
  585. Math: Math;
  586. Uint8Array: Uint8ArrayConstructor;
  587. Float32Array: Float32ArrayConstructor;
  588. }
  589. interface SIMD {
  590. Float32x4: SIMD.Float32x4Constructor;
  591. Int32x4: SIMD.Int32x4Constructor;
  592. Int16x8: SIMD.Int16x8Constructor;
  593. Int8x16: SIMD.Int8x16Constructor;
  594. Uint32x4: SIMD.Uint32x4Constructor;
  595. Uint16x8: SIMD.Uint16x8Constructor;
  596. Uint8x16: SIMD.Uint8x16Constructor;
  597. Bool32x4: SIMD.Bool32x4Constructor;
  598. Bool16x8: SIMD.Bool16x8Constructor;
  599. Bool8x16: SIMD.Bool8x16Constructor;
  600. }
  601. interface GamepadPose {
  602. hasOrientation: boolean;
  603. hasPosition: boolean;
  604. position?: Float32Array;
  605. linearVelocity?: Float32Array;
  606. linearAcceleration?: Float32Array;
  607. orientation?: Float32Array;
  608. angularVelocity?: Float32Array;
  609. angularAcceleration?: Float32Array;
  610. }
  611. declare namespace SIMD {
  612. interface Float32x4 {
  613. constructor: Float32x4Constructor;
  614. valueOf(): Float32x4;
  615. toLocaleString(): string;
  616. toString(): string;
  617. }
  618. interface Float32x4Constructor {
  619. (s0?: number, s1?: number, s2?: number, s3?: number): Float32x4;
  620. prototype: Float32x4;
  621. extractLane(simd: SIMD.Float32x4, lane: number): number;
  622. swizzle(a: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  623. shuffle(a: SIMD.Float32x4, b: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  624. check(a: SIMD.Float32x4): SIMD.Float32x4;
  625. splat(n: number): SIMD.Float32x4;
  626. replaceLane(simd: SIMD.Float32x4, lane: number, value: number): SIMD.Float32x4;
  627. select(selector: SIMD.Bool32x4, a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  628. equal(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  629. notEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  630. lessThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  631. lessThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  632. greaterThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  633. greaterThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  634. add(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  635. sub(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  636. mul(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  637. div(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  638. neg(a: SIMD.Float32x4): SIMD.Float32x4;
  639. abs(a: SIMD.Float32x4): SIMD.Float32x4;
  640. min(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  641. max(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  642. minNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  643. maxNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  644. reciprocalApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  645. reciprocalSqrtApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  646. sqrt(a: SIMD.Float32x4): SIMD.Float32x4;
  647. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  648. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  649. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  650. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  651. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  652. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  653. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  654. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  655. fromInt32x4(value: SIMD.Int32x4): SIMD.Float32x4;
  656. fromUint32x4(value: SIMD.Uint32x4): SIMD.Float32x4;
  657. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Float32x4;
  658. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Float32x4;
  659. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Float32x4;
  660. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Float32x4;
  661. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Float32x4;
  662. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Float32x4;
  663. }
  664. interface Int32x4 {
  665. constructor: Int32x4Constructor;
  666. valueOf(): Int32x4;
  667. toLocaleString(): string;
  668. toString(): string;
  669. }
  670. interface Int32x4Constructor {
  671. (s0?: number, s1?: number, s2?: number, s3?: number): Int32x4;
  672. prototype: Int32x4;
  673. extractLane(simd: SIMD.Int32x4, lane: number): number;
  674. swizzle(a: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  675. shuffle(a: SIMD.Int32x4, b: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  676. check(a: SIMD.Int32x4): SIMD.Int32x4;
  677. splat(n: number): SIMD.Int32x4;
  678. replaceLane(simd: SIMD.Int32x4, lane: number, value: number): SIMD.Int32x4;
  679. select(selector: SIMD.Bool32x4, a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  680. equal(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  681. notEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  682. lessThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  683. lessThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  684. greaterThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  685. greaterThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  686. and(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  687. or(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  688. xor(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  689. not(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  690. add(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  691. sub(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  692. mul(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  693. neg(a: SIMD.Int32x4): SIMD.Int32x4;
  694. shiftLeftByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  695. shiftRightByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  696. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  697. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  698. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  699. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  700. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  701. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  702. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  703. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  704. fromFloat32x4(value: SIMD.Float32x4): SIMD.Int32x4;
  705. fromUint32x4(value: SIMD.Uint32x4): SIMD.Int32x4;
  706. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int32x4;
  707. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int32x4;
  708. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int32x4;
  709. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int32x4;
  710. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int32x4;
  711. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int32x4;
  712. }
  713. interface Int16x8 {
  714. constructor: Int16x8Constructor;
  715. valueOf(): Int16x8;
  716. toLocaleString(): string;
  717. toString(): string;
  718. }
  719. interface Int16x8Constructor {
  720. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Int16x8;
  721. prototype: Int16x8;
  722. extractLane(simd: SIMD.Int16x8, lane: number): number;
  723. swizzle(a: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  724. 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;
  725. check(a: SIMD.Int16x8): SIMD.Int16x8;
  726. splat(n: number): SIMD.Int16x8;
  727. replaceLane(simd: SIMD.Int16x8, lane: number, value: number): SIMD.Int16x8;
  728. select(selector: SIMD.Bool16x8, a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  729. equal(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  730. notEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  731. lessThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  732. lessThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  733. greaterThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  734. greaterThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  735. and(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  736. or(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  737. xor(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  738. not(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  739. add(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  740. sub(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  741. mul(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  742. neg(a: SIMD.Int16x8): SIMD.Int16x8;
  743. shiftLeftByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  744. shiftRightByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  745. addSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  746. subSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  747. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int16x8;
  748. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int16x8): SIMD.Int16x8;
  749. fromUint16x8(value: SIMD.Uint16x8): SIMD.Int16x8;
  750. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int16x8;
  751. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int16x8;
  752. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int16x8;
  753. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int16x8;
  754. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int16x8;
  755. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int16x8;
  756. }
  757. interface Int8x16 {
  758. constructor: Int8x16Constructor;
  759. valueOf(): Int8x16;
  760. toLocaleString(): string;
  761. toString(): string;
  762. }
  763. interface Int8x16Constructor {
  764. (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;
  765. prototype: Int8x16;
  766. extractLane(simd: SIMD.Int8x16, lane: number): number;
  767. 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;
  768. 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;
  769. check(a: SIMD.Int8x16): SIMD.Int8x16;
  770. splat(n: number): SIMD.Int8x16;
  771. replaceLane(simd: SIMD.Int8x16, lane: number, value: number): SIMD.Int8x16;
  772. select(selector: SIMD.Bool8x16, a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  773. equal(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  774. notEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  775. lessThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  776. lessThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  777. greaterThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  778. greaterThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  779. and(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  780. or(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  781. xor(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  782. not(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  783. add(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  784. sub(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  785. mul(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  786. neg(a: SIMD.Int8x16): SIMD.Int8x16;
  787. shiftLeftByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  788. shiftRightByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  789. addSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  790. subSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  791. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int8x16;
  792. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int8x16): SIMD.Int8x16;
  793. fromUint8x16(value: SIMD.Uint8x16): SIMD.Int8x16;
  794. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int8x16;
  795. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int8x16;
  796. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int8x16;
  797. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int8x16;
  798. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int8x16;
  799. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int8x16;
  800. }
  801. interface Uint32x4 {
  802. constructor: Uint32x4Constructor;
  803. valueOf(): Uint32x4;
  804. toLocaleString(): string;
  805. toString(): string;
  806. }
  807. interface Uint32x4Constructor {
  808. (s0?: number, s1?: number, s2?: number, s3?: number): Uint32x4;
  809. prototype: Uint32x4;
  810. extractLane(simd: SIMD.Uint32x4, lane: number): number;
  811. swizzle(a: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  812. shuffle(a: SIMD.Uint32x4, b: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  813. check(a: SIMD.Uint32x4): SIMD.Uint32x4;
  814. splat(n: number): SIMD.Uint32x4;
  815. replaceLane(simd: SIMD.Uint32x4, lane: number, value: number): SIMD.Uint32x4;
  816. select(selector: SIMD.Bool32x4, a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  817. equal(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  818. notEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  819. lessThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  820. lessThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  821. greaterThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  822. greaterThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  823. and(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  824. or(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  825. xor(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  826. not(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  827. add(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  828. sub(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  829. mul(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  830. shiftLeftByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  831. shiftRightByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  832. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  833. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  834. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  835. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  836. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  837. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  838. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  839. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  840. fromFloat32x4(value: SIMD.Float32x4): SIMD.Uint32x4;
  841. fromInt32x4(value: SIMD.Int32x4): SIMD.Uint32x4;
  842. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint32x4;
  843. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint32x4;
  844. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint32x4;
  845. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint32x4;
  846. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint32x4;
  847. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint32x4;
  848. }
  849. interface Uint16x8 {
  850. constructor: Uint16x8Constructor;
  851. valueOf(): Uint16x8;
  852. toLocaleString(): string;
  853. toString(): string;
  854. }
  855. interface Uint16x8Constructor {
  856. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Uint16x8;
  857. prototype: Uint16x8;
  858. extractLane(simd: SIMD.Uint16x8, lane: number): number;
  859. swizzle(a: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  860. 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;
  861. check(a: SIMD.Uint16x8): SIMD.Uint16x8;
  862. splat(n: number): SIMD.Uint16x8;
  863. replaceLane(simd: SIMD.Uint16x8, lane: number, value: number): SIMD.Uint16x8;
  864. select(selector: SIMD.Bool16x8, a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  865. equal(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  866. notEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  867. lessThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  868. lessThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  869. greaterThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  870. greaterThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  871. and(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  872. or(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  873. xor(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  874. not(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  875. add(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  876. sub(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  877. mul(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  878. shiftLeftByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  879. shiftRightByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  880. addSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  881. subSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  882. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint16x8;
  883. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint16x8): SIMD.Uint16x8;
  884. fromInt16x8(value: SIMD.Int16x8): SIMD.Uint16x8;
  885. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint16x8;
  886. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint16x8;
  887. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint16x8;
  888. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint16x8;
  889. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint16x8;
  890. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint16x8;
  891. }
  892. interface Uint8x16 {
  893. constructor: Uint8x16Constructor;
  894. valueOf(): Uint8x16;
  895. toLocaleString(): string;
  896. toString(): string;
  897. }
  898. interface Uint8x16Constructor {
  899. (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;
  900. prototype: Uint8x16;
  901. extractLane(simd: SIMD.Uint8x16, lane: number): number;
  902. 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;
  903. 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;
  904. check(a: SIMD.Uint8x16): SIMD.Uint8x16;
  905. splat(n: number): SIMD.Uint8x16;
  906. replaceLane(simd: SIMD.Uint8x16, lane: number, value: number): SIMD.Uint8x16;
  907. select(selector: SIMD.Bool8x16, a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  908. equal(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  909. notEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  910. lessThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  911. lessThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  912. greaterThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  913. greaterThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  914. and(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  915. or(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  916. xor(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  917. not(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  918. add(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  919. sub(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  920. mul(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  921. shiftLeftByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  922. shiftRightByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  923. addSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  924. subSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  925. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint8x16;
  926. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint8x16): SIMD.Uint8x16;
  927. fromInt8x16(value: SIMD.Int8x16): SIMD.Uint8x16;
  928. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint8x16;
  929. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint8x16;
  930. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint8x16;
  931. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint8x16;
  932. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint8x16;
  933. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint8x16;
  934. }
  935. interface Bool32x4 {
  936. constructor: Bool32x4Constructor;
  937. valueOf(): Bool32x4;
  938. toLocaleString(): string;
  939. toString(): string;
  940. }
  941. interface Bool32x4Constructor {
  942. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean): Bool32x4;
  943. prototype: Bool32x4;
  944. extractLane(simd: SIMD.Bool32x4, lane: number): boolean;
  945. check(a: SIMD.Bool32x4): SIMD.Bool32x4;
  946. splat(n: boolean): SIMD.Bool32x4;
  947. replaceLane(simd: SIMD.Bool32x4, lane: number, value: boolean): SIMD.Bool32x4;
  948. allTrue(a: SIMD.Bool32x4): boolean;
  949. anyTrue(a: SIMD.Bool32x4): boolean;
  950. and(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  951. or(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  952. xor(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  953. not(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  954. }
  955. interface Bool16x8 {
  956. constructor: Bool16x8Constructor;
  957. valueOf(): Bool16x8;
  958. toLocaleString(): string;
  959. toString(): string;
  960. }
  961. interface Bool16x8Constructor {
  962. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean): Bool16x8;
  963. prototype: Bool16x8;
  964. extractLane(simd: SIMD.Bool16x8, lane: number): boolean;
  965. check(a: SIMD.Bool16x8): SIMD.Bool16x8;
  966. splat(n: boolean): SIMD.Bool16x8;
  967. replaceLane(simd: SIMD.Bool16x8, lane: number, value: boolean): SIMD.Bool16x8;
  968. allTrue(a: SIMD.Bool16x8): boolean;
  969. anyTrue(a: SIMD.Bool16x8): boolean;
  970. and(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  971. or(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  972. xor(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  973. not(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  974. }
  975. interface Bool8x16 {
  976. constructor: Bool8x16Constructor;
  977. valueOf(): Bool8x16;
  978. toLocaleString(): string;
  979. toString(): string;
  980. }
  981. interface Bool8x16Constructor {
  982. (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;
  983. prototype: Bool8x16;
  984. extractLane(simd: SIMD.Bool8x16, lane: number): boolean;
  985. check(a: SIMD.Bool8x16): SIMD.Bool8x16;
  986. splat(n: boolean): SIMD.Bool8x16;
  987. replaceLane(simd: SIMD.Bool8x16, lane: number, value: boolean): SIMD.Bool8x16;
  988. allTrue(a: SIMD.Bool8x16): boolean;
  989. anyTrue(a: SIMD.Bool8x16): boolean;
  990. and(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  991. or(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  992. xor(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  993. not(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  994. }
  995. }
  996. declare module BABYLON {
  997. /**
  998. * Node is the basic class for all scene objects (Mesh, Light Camera).
  999. */
  1000. class Node {
  1001. name: string;
  1002. id: string;
  1003. uniqueId: number;
  1004. state: string;
  1005. metadata: any;
  1006. doNotSerialize: boolean;
  1007. animations: Animation[];
  1008. onReady: (node: Node) => void;
  1009. parent: Node;
  1010. getClassName(): string;
  1011. /**
  1012. * An event triggered when the mesh is disposed.
  1013. * @type {BABYLON.Observable}
  1014. */
  1015. onDisposeObservable: Observable<Node>;
  1016. onDispose: () => void;
  1017. /**
  1018. * @constructor
  1019. * @param {string} name - the name and id to be given to this node
  1020. * @param {BABYLON.Scene} the scene this node will be added to
  1021. */
  1022. constructor(name: string, scene: Scene);
  1023. getScene(): Scene;
  1024. getEngine(): Engine;
  1025. getWorldMatrix(): Matrix;
  1026. updateCache(force?: boolean): void;
  1027. isSynchronizedWithParent(): boolean;
  1028. isSynchronized(updateCache?: boolean): boolean;
  1029. hasNewParent(update?: boolean): boolean;
  1030. /**
  1031. * Is this node ready to be used/rendered
  1032. * @return {boolean} is it ready
  1033. */
  1034. isReady(): boolean;
  1035. /**
  1036. * Is this node enabled.
  1037. * If the node has a parent and is enabled, the parent will be inspected as well.
  1038. * @return {boolean} whether this node (and its parent) is enabled.
  1039. * @see setEnabled
  1040. */
  1041. isEnabled(): boolean;
  1042. /**
  1043. * Set the enabled state of this node.
  1044. * @param {boolean} value - the new enabled state
  1045. * @see isEnabled
  1046. */
  1047. setEnabled(value: boolean): void;
  1048. /**
  1049. * Is this node a descendant of the given node.
  1050. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
  1051. * @param {BABYLON.Node} ancestor - The parent node to inspect
  1052. * @see parent
  1053. */
  1054. isDescendantOf(ancestor: Node): boolean;
  1055. /**
  1056. * Evaluate the list of children and determine if they should be considered as descendants considering the given criterias
  1057. * @param {BABYLON.Node[]} results the result array containing the nodes matching the given criterias
  1058. * @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.
  1059. * @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.
  1060. */
  1061. /**
  1062. * Will return all nodes that have this node as ascendant.
  1063. * @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.
  1064. * @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.
  1065. * @return {BABYLON.Node[]} all children nodes of all types.
  1066. */
  1067. getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];
  1068. /**
  1069. * Get all child-meshes of this node.
  1070. */
  1071. getChildMeshes(directDecendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];
  1072. /**
  1073. * Get all direct children of this node.
  1074. */
  1075. getChildren(predicate?: (node: Node) => boolean): Node[];
  1076. getAnimationByName(name: string): Animation;
  1077. createAnimationRange(name: string, from: number, to: number): void;
  1078. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  1079. getAnimationRange(name: string): AnimationRange;
  1080. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void;
  1081. serializeAnimationRanges(): any;
  1082. dispose(): void;
  1083. static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void;
  1084. }
  1085. }
  1086. declare module BABYLON {
  1087. interface IDisposable {
  1088. dispose(): void;
  1089. }
  1090. class PointerEventTypes {
  1091. static readonly POINTERDOWN: number;
  1092. static readonly POINTERUP: number;
  1093. static readonly POINTERMOVE: number;
  1094. static readonly POINTERWHEEL: number;
  1095. static readonly POINTERPICK: number;
  1096. static readonly POINTERTAP: number;
  1097. static readonly POINTERDOUBLETAP: number;
  1098. }
  1099. class PointerInfoBase {
  1100. type: number;
  1101. event: PointerEvent | MouseWheelEvent;
  1102. constructor(type: number, event: PointerEvent | MouseWheelEvent);
  1103. }
  1104. /**
  1105. * This class is used to store pointer related info for the onPrePointerObservable event.
  1106. * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
  1107. */
  1108. class PointerInfoPre extends PointerInfoBase {
  1109. constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: any, localY: any);
  1110. localPosition: Vector2;
  1111. skipOnPointerObservable: boolean;
  1112. }
  1113. /**
  1114. * This type contains all the data related to a pointer event in Babylon.js.
  1115. * 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.
  1116. */
  1117. class PointerInfo extends PointerInfoBase {
  1118. pickInfo: PickingInfo;
  1119. constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: PickingInfo);
  1120. }
  1121. /**
  1122. * This class is used by the onRenderingGroupObservable
  1123. */
  1124. class RenderingGroupInfo {
  1125. /**
  1126. * The Scene that being rendered
  1127. */
  1128. scene: Scene;
  1129. /**
  1130. * The camera currently used for the rendering pass
  1131. */
  1132. camera: Camera;
  1133. /**
  1134. * The ID of the renderingGroup being processed
  1135. */
  1136. renderingGroupId: number;
  1137. /**
  1138. * The rendering stage, can be either STAGE_PRECLEAR, STAGE_PREOPAQUE, STAGE_PRETRANSPARENT, STAGE_POSTTRANSPARENT
  1139. */
  1140. renderStage: number;
  1141. /**
  1142. * Stage corresponding to the very first hook in the renderingGroup phase: before the render buffer may be cleared
  1143. * This stage will be fired no matter what
  1144. */
  1145. static STAGE_PRECLEAR: number;
  1146. /**
  1147. * Called before opaque object are rendered.
  1148. * This stage will be fired only if there's 3D Opaque content to render
  1149. */
  1150. static STAGE_PREOPAQUE: number;
  1151. /**
  1152. * Called after the opaque objects are rendered and before the transparent ones
  1153. * This stage will be fired only if there's 3D transparent content to render
  1154. */
  1155. static STAGE_PRETRANSPARENT: number;
  1156. /**
  1157. * Called after the transparent object are rendered, last hook of the renderingGroup phase
  1158. * This stage will be fired no matter what
  1159. */
  1160. static STAGE_POSTTRANSPARENT: number;
  1161. }
  1162. /**
  1163. * Represents a scene to be rendered by the engine.
  1164. * @see http://doc.babylonjs.com/page.php?p=21911
  1165. */
  1166. class Scene implements IAnimatable {
  1167. static MinDeltaTime: number;
  1168. static MaxDeltaTime: number;
  1169. static readonly FOGMODE_NONE: number;
  1170. static readonly FOGMODE_EXP: number;
  1171. static readonly FOGMODE_EXP2: number;
  1172. static readonly FOGMODE_LINEAR: number;
  1173. autoClear: boolean;
  1174. autoClearDepthAndStencil: boolean;
  1175. clearColor: Color4;
  1176. ambientColor: Color3;
  1177. /**
  1178. * Texture used in all pbr material as the reflection texture.
  1179. * As in the majority of the scene they are the same (exception for multi room and so on),
  1180. * this is easier to reference from here than from all the materials.
  1181. */
  1182. /**
  1183. * Texture used in all pbr material as the reflection texture.
  1184. * As in the majority of the scene they are the same (exception for multi room and so on),
  1185. * this is easier to set here than in all the materials.
  1186. */
  1187. environmentTexture: BaseTexture;
  1188. forceWireframe: boolean;
  1189. forcePointsCloud: boolean;
  1190. forceShowBoundingBoxes: boolean;
  1191. clipPlane: Plane;
  1192. animationsEnabled: boolean;
  1193. constantlyUpdateMeshUnderPointer: boolean;
  1194. hoverCursor: string;
  1195. metadata: any;
  1196. /**
  1197. * An event triggered when the scene is disposed.
  1198. * @type {BABYLON.Observable}
  1199. */
  1200. onDisposeObservable: Observable<Scene>;
  1201. onDispose: () => void;
  1202. /**
  1203. * An event triggered before rendering the scene
  1204. * @type {BABYLON.Observable}
  1205. */
  1206. onBeforeRenderObservable: Observable<Scene>;
  1207. beforeRender: () => void;
  1208. /**
  1209. * An event triggered after rendering the scene
  1210. * @type {BABYLON.Observable}
  1211. */
  1212. onAfterRenderObservable: Observable<Scene>;
  1213. afterRender: () => void;
  1214. /**
  1215. * An event triggered when the scene is ready
  1216. * @type {BABYLON.Observable}
  1217. */
  1218. onReadyObservable: Observable<Scene>;
  1219. /**
  1220. * An event triggered before rendering a camera
  1221. * @type {BABYLON.Observable}
  1222. */
  1223. onBeforeCameraRenderObservable: Observable<Camera>;
  1224. beforeCameraRender: () => void;
  1225. /**
  1226. * An event triggered after rendering a camera
  1227. * @type {BABYLON.Observable}
  1228. */
  1229. onAfterCameraRenderObservable: Observable<Camera>;
  1230. afterCameraRender: () => void;
  1231. /**
  1232. * An event triggered when a camera is created
  1233. * @type {BABYLON.Observable}
  1234. */
  1235. onNewCameraAddedObservable: Observable<Camera>;
  1236. /**
  1237. * An event triggered when a camera is removed
  1238. * @type {BABYLON.Observable}
  1239. */
  1240. onCameraRemovedObservable: Observable<Camera>;
  1241. /**
  1242. * An event triggered when a light is created
  1243. * @type {BABYLON.Observable}
  1244. */
  1245. onNewLightAddedObservable: Observable<Light>;
  1246. /**
  1247. * An event triggered when a light is removed
  1248. * @type {BABYLON.Observable}
  1249. */
  1250. onLightRemovedObservable: Observable<Light>;
  1251. /**
  1252. * An event triggered when a geometry is created
  1253. * @type {BABYLON.Observable}
  1254. */
  1255. onNewGeometryAddedObservable: Observable<Geometry>;
  1256. /**
  1257. * An event triggered when a geometry is removed
  1258. * @type {BABYLON.Observable}
  1259. */
  1260. onGeometryRemovedObservable: Observable<Geometry>;
  1261. /**
  1262. * An event triggered when a mesh is created
  1263. * @type {BABYLON.Observable}
  1264. */
  1265. onNewMeshAddedObservable: Observable<AbstractMesh>;
  1266. /**
  1267. * An event triggered when a mesh is removed
  1268. * @type {BABYLON.Observable}
  1269. */
  1270. onMeshRemovedObservable: Observable<AbstractMesh>;
  1271. /**
  1272. * This Observable will be triggered for each stage of each renderingGroup of each rendered camera.
  1273. * The RenderinGroupInfo class contains all the information about the context in which the observable is called
  1274. * 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)
  1275. */
  1276. onRenderingGroupObservable: Observable<RenderingGroupInfo>;
  1277. animations: Animation[];
  1278. pointerDownPredicate: (Mesh: AbstractMesh) => boolean;
  1279. pointerUpPredicate: (Mesh: AbstractMesh) => boolean;
  1280. pointerMovePredicate: (Mesh: AbstractMesh) => boolean;
  1281. onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1282. onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1283. onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1284. onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1285. /**
  1286. * This observable event is triggered when any mouse event registered during Scene.attach() is called BEFORE the 3D engine to process anything (mesh/sprite picking for instance).
  1287. * You have the possibility to skip the 3D Engine process and the call to onPointerObservable by setting PointerInfoBase.skipOnPointerObservable to true
  1288. */
  1289. onPrePointerObservable: Observable<PointerInfoPre>;
  1290. /**
  1291. * Observable event triggered each time an input event is received from the rendering canvas
  1292. */
  1293. onPointerObservable: Observable<PointerInfo>;
  1294. readonly unTranslatedPointer: Vector2;
  1295. static DragMovementThreshold: number;
  1296. static LongPressDelay: number;
  1297. static DoubleClickDelay: number;
  1298. static ExclusiveDoubleClickMode: boolean;
  1299. cameraToUseForPointers: Camera;
  1300. /**
  1301. * use right-handed coordinate system on this scene.
  1302. * @type {boolean}
  1303. */
  1304. useRightHandedSystem: boolean;
  1305. /**
  1306. * is fog enabled on this scene.
  1307. * @type {boolean}
  1308. */
  1309. fogEnabled: boolean;
  1310. fogMode: number;
  1311. fogColor: Color3;
  1312. fogDensity: number;
  1313. fogStart: number;
  1314. fogEnd: number;
  1315. /**
  1316. * is shadow enabled on this scene.
  1317. * @type {boolean}
  1318. */
  1319. shadowsEnabled: boolean;
  1320. /**
  1321. * is light enabled on this scene.
  1322. * @type {boolean}
  1323. */
  1324. lightsEnabled: boolean;
  1325. /**
  1326. * All of the lights added to this scene.
  1327. * @see BABYLON.Light
  1328. * @type {BABYLON.Light[]}
  1329. */
  1330. lights: Light[];
  1331. /**
  1332. * All of the cameras added to this scene.
  1333. * @see BABYLON.Camera
  1334. * @type {BABYLON.Camera[]}
  1335. */
  1336. cameras: Camera[];
  1337. activeCameras: Camera[];
  1338. activeCamera: Camera;
  1339. /**
  1340. * All of the (abstract) meshes added to this scene.
  1341. * @see BABYLON.AbstractMesh
  1342. * @type {BABYLON.AbstractMesh[]}
  1343. */
  1344. meshes: AbstractMesh[];
  1345. materials: Material[];
  1346. multiMaterials: MultiMaterial[];
  1347. defaultMaterial: Material;
  1348. texturesEnabled: boolean;
  1349. textures: BaseTexture[];
  1350. particlesEnabled: boolean;
  1351. particleSystems: ParticleSystem[];
  1352. spritesEnabled: boolean;
  1353. spriteManagers: SpriteManager[];
  1354. layers: Layer[];
  1355. highlightLayers: HighlightLayer[];
  1356. skeletonsEnabled: boolean;
  1357. skeletons: Skeleton[];
  1358. morphTargetManagers: MorphTargetManager[];
  1359. lensFlaresEnabled: boolean;
  1360. lensFlareSystems: LensFlareSystem[];
  1361. collisionsEnabled: boolean;
  1362. collisionCoordinator: ICollisionCoordinator;
  1363. gravity: Vector3;
  1364. postProcessesEnabled: boolean;
  1365. postProcessManager: PostProcessManager;
  1366. readonly postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
  1367. renderTargetsEnabled: boolean;
  1368. dumpNextRenderTargets: boolean;
  1369. customRenderTargets: RenderTargetTexture[];
  1370. useDelayedTextureLoading: boolean;
  1371. importedMeshesFiles: String[];
  1372. probesEnabled: boolean;
  1373. reflectionProbes: ReflectionProbe[];
  1374. database: any;
  1375. /**
  1376. * This scene's action manager
  1377. * @type {BABYLON.ActionManager}
  1378. */
  1379. actionManager: ActionManager;
  1380. proceduralTexturesEnabled: boolean;
  1381. mainSoundTrack: SoundTrack;
  1382. soundTracks: SoundTrack[];
  1383. simplificationQueue: SimplificationQueue;
  1384. animationTimeScale: number;
  1385. readonly frustumPlanes: Plane[];
  1386. requireLightSorting: boolean;
  1387. /**
  1388. * @constructor
  1389. * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
  1390. */
  1391. constructor(engine: Engine);
  1392. readonly debugLayer: DebugLayer;
  1393. workerCollisions: boolean;
  1394. readonly selectionOctree: Octree<AbstractMesh>;
  1395. /**
  1396. * The mesh that is currently under the pointer.
  1397. * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
  1398. */
  1399. readonly meshUnderPointer: AbstractMesh;
  1400. /**
  1401. * Current on-screen X position of the pointer
  1402. * @return {number} X position of the pointer
  1403. */
  1404. readonly pointerX: number;
  1405. /**
  1406. * Current on-screen Y position of the pointer
  1407. * @return {number} Y position of the pointer
  1408. */
  1409. readonly pointerY: number;
  1410. getCachedMaterial(): Material;
  1411. getCachedEffect(): Effect;
  1412. getCachedVisibility(): number;
  1413. isCachedMaterialValid(material: Material, effect: Effect, visibility?: number): boolean;
  1414. getBoundingBoxRenderer(): BoundingBoxRenderer;
  1415. getOutlineRenderer(): OutlineRenderer;
  1416. getEngine(): Engine;
  1417. getTotalVertices(): number;
  1418. readonly totalVerticesPerfCounter: PerfCounter;
  1419. getActiveIndices(): number;
  1420. readonly totalActiveIndicesPerfCounter: PerfCounter;
  1421. getActiveParticles(): number;
  1422. readonly activeParticlesPerfCounter: PerfCounter;
  1423. getActiveBones(): number;
  1424. readonly activeBonesPerfCounter: PerfCounter;
  1425. getLastFrameDuration(): number;
  1426. readonly lastFramePerfCounter: PerfCounter;
  1427. getEvaluateActiveMeshesDuration(): number;
  1428. readonly evaluateActiveMeshesDurationPerfCounter: PerfCounter;
  1429. getActiveMeshes(): SmartArray<Mesh>;
  1430. getRenderTargetsDuration(): number;
  1431. getRenderDuration(): number;
  1432. readonly renderDurationPerfCounter: PerfCounter;
  1433. getParticlesDuration(): number;
  1434. readonly particlesDurationPerfCounter: PerfCounter;
  1435. getSpritesDuration(): number;
  1436. readonly spriteDuractionPerfCounter: PerfCounter;
  1437. getAnimationRatio(): number;
  1438. getRenderId(): number;
  1439. incrementRenderId(): void;
  1440. /**
  1441. * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
  1442. * @param attachUp defines if you want to attach events to pointerup
  1443. * @param attachDown defines if you want to attach events to pointerdown
  1444. * @param attachMove defines if you want to attach events to pointermove
  1445. */
  1446. attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean): void;
  1447. detachControl(): void;
  1448. isReady(): boolean;
  1449. resetCachedMaterial(): void;
  1450. registerBeforeRender(func: () => void): void;
  1451. unregisterBeforeRender(func: () => void): void;
  1452. registerAfterRender(func: () => void): void;
  1453. unregisterAfterRender(func: () => void): void;
  1454. getWaitingItemsCount(): number;
  1455. /**
  1456. * Registers a function to be executed when the scene is ready.
  1457. * @param {Function} func - the function to be executed.
  1458. */
  1459. executeWhenReady(func: () => void): void;
  1460. /**
  1461. * Will start the animation sequence of a given target
  1462. * @param target - the target
  1463. * @param {number} from - from which frame should animation start
  1464. * @param {number} to - till which frame should animation run.
  1465. * @param {boolean} [loop] - should the animation loop
  1466. * @param {number} [speedRatio] - the speed in which to run the animation
  1467. * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
  1468. * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
  1469. * @return {BABYLON.Animatable} the animatable object created for this animation
  1470. * @see BABYLON.Animatable
  1471. * @see http://doc.babylonjs.com/page.php?p=22081
  1472. */
  1473. beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
  1474. beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  1475. getAnimatableByTarget(target: any): Animatable;
  1476. readonly Animatables: Animatable[];
  1477. /**
  1478. * Will stop the animation of the given target
  1479. * @param target - the target
  1480. * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
  1481. * @see beginAnimation
  1482. */
  1483. stopAnimation(target: any, animationName?: string): void;
  1484. getViewMatrix(): Matrix;
  1485. getProjectionMatrix(): Matrix;
  1486. getTransformMatrix(): Matrix;
  1487. setTransformMatrix(view: Matrix, projection: Matrix): void;
  1488. getSceneUniformBuffer(): UniformBuffer;
  1489. getUniqueId(): number;
  1490. addMesh(newMesh: AbstractMesh): void;
  1491. removeMesh(toRemove: AbstractMesh): number;
  1492. removeSkeleton(toRemove: Skeleton): number;
  1493. removeMorphTargetManager(toRemove: MorphTargetManager): number;
  1494. removeLight(toRemove: Light): number;
  1495. removeCamera(toRemove: Camera): number;
  1496. addLight(newLight: Light): void;
  1497. sortLightsByPriority(): void;
  1498. addCamera(newCamera: Camera): void;
  1499. /**
  1500. * Switch active camera
  1501. * @param {Camera} newCamera - new active camera
  1502. * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
  1503. */
  1504. switchActiveCamera(newCamera: Camera, attachControl?: boolean): void;
  1505. /**
  1506. * sets the active camera of the scene using its ID
  1507. * @param {string} id - the camera's ID
  1508. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1509. * @see activeCamera
  1510. */
  1511. setActiveCameraByID(id: string): Camera;
  1512. /**
  1513. * sets the active camera of the scene using its name
  1514. * @param {string} name - the camera's name
  1515. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1516. * @see activeCamera
  1517. */
  1518. setActiveCameraByName(name: string): Camera;
  1519. /**
  1520. * get a material using its id
  1521. * @param {string} the material's ID
  1522. * @return {BABYLON.Material|null} the material or null if none found.
  1523. */
  1524. getMaterialByID(id: string): Material;
  1525. /**
  1526. * get a material using its name
  1527. * @param {string} the material's name
  1528. * @return {BABYLON.Material|null} the material or null if none found.
  1529. */
  1530. getMaterialByName(name: string): Material;
  1531. getLensFlareSystemByName(name: string): LensFlareSystem;
  1532. getLensFlareSystemByID(id: string): LensFlareSystem;
  1533. getCameraByID(id: string): Camera;
  1534. getCameraByUniqueID(uniqueId: number): Camera;
  1535. /**
  1536. * get a camera using its name
  1537. * @param {string} the camera's name
  1538. * @return {BABYLON.Camera|null} the camera or null if none found.
  1539. */
  1540. getCameraByName(name: string): Camera;
  1541. /**
  1542. * get a bone using its id
  1543. * @param {string} the bone's id
  1544. * @return {BABYLON.Bone|null} the bone or null if not found
  1545. */
  1546. getBoneByID(id: string): Bone;
  1547. /**
  1548. * get a bone using its id
  1549. * @param {string} the bone's name
  1550. * @return {BABYLON.Bone|null} the bone or null if not found
  1551. */
  1552. getBoneByName(name: string): Bone;
  1553. /**
  1554. * get a light node using its name
  1555. * @param {string} the light's name
  1556. * @return {BABYLON.Light|null} the light or null if none found.
  1557. */
  1558. getLightByName(name: string): Light;
  1559. /**
  1560. * get a light node using its ID
  1561. * @param {string} the light's id
  1562. * @return {BABYLON.Light|null} the light or null if none found.
  1563. */
  1564. getLightByID(id: string): Light;
  1565. /**
  1566. * get a light node using its scene-generated unique ID
  1567. * @param {number} the light's unique id
  1568. * @return {BABYLON.Light|null} the light or null if none found.
  1569. */
  1570. getLightByUniqueID(uniqueId: number): Light;
  1571. /**
  1572. * get a particle system by id
  1573. * @param id {number} the particle system id
  1574. * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found.
  1575. */
  1576. getParticleSystemByID(id: string): ParticleSystem;
  1577. /**
  1578. * get a geometry using its ID
  1579. * @param {string} the geometry's id
  1580. * @return {BABYLON.Geometry|null} the geometry or null if none found.
  1581. */
  1582. getGeometryByID(id: string): Geometry;
  1583. /**
  1584. * add a new geometry to this scene.
  1585. * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
  1586. * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
  1587. * @return {boolean} was the geometry added or not
  1588. */
  1589. pushGeometry(geometry: Geometry, force?: boolean): boolean;
  1590. /**
  1591. * Removes an existing geometry
  1592. * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene.
  1593. * @return {boolean} was the geometry removed or not
  1594. */
  1595. removeGeometry(geometry: Geometry): boolean;
  1596. getGeometries(): Geometry[];
  1597. /**
  1598. * Get the first added mesh found of a given ID
  1599. * @param {string} id - the id to search for
  1600. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1601. */
  1602. getMeshByID(id: string): AbstractMesh;
  1603. getMeshesByID(id: string): Array<AbstractMesh>;
  1604. /**
  1605. * Get a mesh with its auto-generated unique id
  1606. * @param {number} uniqueId - the unique id to search for
  1607. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1608. */
  1609. getMeshByUniqueID(uniqueId: number): AbstractMesh;
  1610. /**
  1611. * Get a the last added mesh found of a given ID
  1612. * @param {string} id - the id to search for
  1613. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1614. */
  1615. getLastMeshByID(id: string): AbstractMesh;
  1616. /**
  1617. * Get a the last added node (Mesh, Camera, Light) found of a given ID
  1618. * @param {string} id - the id to search for
  1619. * @return {BABYLON.Node|null} the node found or null if not found at all.
  1620. */
  1621. getLastEntryByID(id: string): Node;
  1622. getNodeByID(id: string): Node;
  1623. getNodeByName(name: string): Node;
  1624. getMeshByName(name: string): AbstractMesh;
  1625. getSoundByName(name: string): Sound;
  1626. getLastSkeletonByID(id: string): Skeleton;
  1627. getSkeletonById(id: string): Skeleton;
  1628. getSkeletonByName(name: string): Skeleton;
  1629. getMorphTargetManagerById(id: number): MorphTargetManager;
  1630. isActiveMesh(mesh: Mesh): boolean;
  1631. /**
  1632. * Return a the first highlight layer of the scene with a given name.
  1633. * @param name The name of the highlight layer to look for.
  1634. * @return The highlight layer if found otherwise null.
  1635. */
  1636. getHighlightLayerByName(name: string): HighlightLayer;
  1637. /**
  1638. * Return a unique id as a string which can serve as an identifier for the scene
  1639. */
  1640. readonly uid: string;
  1641. /**
  1642. * Add an externaly attached data from its key.
  1643. * This method call will fail and return false, if such key already exists.
  1644. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  1645. * @param key the unique key that identifies the data
  1646. * @param data the data object to associate to the key for this Engine instance
  1647. * @return true if no such key were already present and the data was added successfully, false otherwise
  1648. */
  1649. addExternalData<T>(key: string, data: T): boolean;
  1650. /**
  1651. * Get an externaly attached data from its key
  1652. * @param key the unique key that identifies the data
  1653. * @return the associated data, if present (can be null), or undefined if not present
  1654. */
  1655. getExternalData<T>(key: string): T;
  1656. /**
  1657. * Get an externaly attached data from its key, create it using a factory if it's not already present
  1658. * @param key the unique key that identifies the data
  1659. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  1660. * @return the associated data, can be null if the factory returned null.
  1661. */
  1662. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  1663. /**
  1664. * Remove an externaly attached data from the Engine instance
  1665. * @param key the unique key that identifies the data
  1666. * @return true if the data was successfully removed, false if it doesn't exist
  1667. */
  1668. removeExternalData(key: any): boolean;
  1669. updateTransformMatrix(force?: boolean): void;
  1670. render(): void;
  1671. audioEnabled: boolean;
  1672. headphone: boolean;
  1673. enableDepthRenderer(): DepthRenderer;
  1674. disableDepthRenderer(): void;
  1675. enableGeometryBufferRenderer(ratio?: number): GeometryBufferRenderer;
  1676. disableGeometryBufferRenderer(): void;
  1677. freezeMaterials(): void;
  1678. unfreezeMaterials(): void;
  1679. dispose(): void;
  1680. readonly isDisposed: boolean;
  1681. disposeSounds(): void;
  1682. getWorldExtends(): {
  1683. min: Vector3;
  1684. max: Vector3;
  1685. };
  1686. createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
  1687. createPickingRay(x: number, y: number, world: Matrix, camera: Camera, cameraViewSpace?: boolean): Ray;
  1688. createPickingRayInCameraSpace(x: number, y: number, camera: Camera): Ray;
  1689. pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1690. pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1691. pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo;
  1692. multiPick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, camera?: Camera): PickingInfo[];
  1693. multiPickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean): PickingInfo[];
  1694. setPointerOverMesh(mesh: AbstractMesh): void;
  1695. getPointerOverMesh(): AbstractMesh;
  1696. setPointerOverSprite(sprite: Sprite): void;
  1697. getPointerOverSprite(): Sprite;
  1698. getPhysicsEngine(): PhysicsEngine;
  1699. /**
  1700. * Enables physics to the current scene
  1701. * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine
  1702. * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS.
  1703. * @return {boolean} was the physics engine initialized
  1704. */
  1705. enablePhysics(gravity?: Vector3, plugin?: IPhysicsEnginePlugin): boolean;
  1706. disablePhysicsEngine(): void;
  1707. isPhysicsEnabled(): boolean;
  1708. deleteCompoundImpostor(compound: any): void;
  1709. createDefaultCameraOrLight(createArcRotateCamera?: boolean): void;
  1710. createDefaultSkybox(environmentTexture?: BaseTexture, pbr?: boolean): Mesh;
  1711. getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[];
  1712. getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[];
  1713. getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[];
  1714. getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[];
  1715. /**
  1716. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  1717. * This allowed control for front to back rendering or reversly depending of the special needs.
  1718. *
  1719. * @param renderingGroupId The rendering group id corresponding to its index
  1720. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  1721. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  1722. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  1723. */
  1724. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  1725. /**
  1726. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  1727. *
  1728. * @param renderingGroupId The rendering group id corresponding to its index
  1729. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  1730. * @param depth Automatically clears depth between groups if true and autoClear is true.
  1731. * @param stencil Automatically clears stencil between groups if true and autoClear is true.
  1732. */
  1733. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth?: boolean, stencil?: boolean): void;
  1734. /**
  1735. * Will flag all materials as dirty to trigger new shader compilation
  1736. * @param predicate If not null, it will be used to specifiy if a material has to be marked as dirty
  1737. */
  1738. markAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
  1739. }
  1740. }
  1741. interface ImageBitmap {
  1742. readonly width: number;
  1743. readonly height: number;
  1744. close(): void;
  1745. }
  1746. interface WebGLQuery extends WebGLObject {
  1747. }
  1748. declare var WebGLQuery: {
  1749. prototype: WebGLQuery;
  1750. new (): WebGLQuery;
  1751. };
  1752. interface WebGLSampler extends WebGLObject {
  1753. }
  1754. declare var WebGLSampler: {
  1755. prototype: WebGLSampler;
  1756. new (): WebGLSampler;
  1757. };
  1758. interface WebGLSync extends WebGLObject {
  1759. }
  1760. declare var WebGLSync: {
  1761. prototype: WebGLSync;
  1762. new (): WebGLSync;
  1763. };
  1764. interface WebGLTransformFeedback extends WebGLObject {
  1765. }
  1766. declare var WebGLTransformFeedback: {
  1767. prototype: WebGLTransformFeedback;
  1768. new (): WebGLTransformFeedback;
  1769. };
  1770. interface WebGLVertexArrayObject extends WebGLObject {
  1771. }
  1772. declare var WebGLVertexArrayObject: {
  1773. prototype: WebGLVertexArrayObject;
  1774. new (): WebGLVertexArrayObject;
  1775. };
  1776. declare module BABYLON {
  1777. class Action {
  1778. triggerOptions: any;
  1779. trigger: number;
  1780. constructor(triggerOptions: any, condition?: Condition);
  1781. getTriggerParameter(): any;
  1782. execute(evt: ActionEvent): void;
  1783. skipToNextActiveAction(): void;
  1784. then(action: Action): Action;
  1785. serialize(parent: any): any;
  1786. name: string;
  1787. targetType: string;
  1788. value: string;
  1789. };
  1790. }
  1791. }
  1792. declare module BABYLON {
  1793. /**
  1794. * ActionEvent is the event beint sent when an action is triggered.
  1795. */
  1796. class ActionEvent {
  1797. source: any;
  1798. pointerX: number;
  1799. pointerY: number;
  1800. meshUnderPointer: AbstractMesh;
  1801. sourceEvent: any;
  1802. additionalData: any;
  1803. /**
  1804. * @constructor
  1805. * @param source The mesh or sprite that triggered the action.
  1806. * @param pointerX The X mouse cursor position at the time of the event
  1807. * @param pointerY The Y mouse cursor position at the time of the event
  1808. * @param meshUnderPointer The mesh that is currently pointed at (can be null)
  1809. * @param sourceEvent the original (browser) event that triggered the ActionEvent
  1810. */
  1811. constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any);
  1812. /**
  1813. * Helper function to auto-create an ActionEvent from a source mesh.
  1814. * @param source The source mesh that triggered the event
  1815. * @param evt {Event} The original (browser) event
  1816. */
  1817. static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent;
  1818. /**
  1819. * Helper function to auto-create an ActionEvent from a source mesh.
  1820. * @param source The source sprite that triggered the event
  1821. * @param scene Scene associated with the sprite
  1822. * @param evt {Event} The original (browser) event
  1823. */
  1824. static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent;
  1825. /**
  1826. * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
  1827. * @param scene the scene where the event occurred
  1828. * @param evt {Event} The original (browser) event
  1829. */
  1830. static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent;
  1831. static CreateNewFromPrimitive(prim: any, pointerPos: Vector2, evt?: Event, additionalData?: any): ActionEvent;
  1832. }
  1833. /**
  1834. * Action Manager manages all events to be triggered on a given mesh or the global scene.
  1835. * A single scene can have many Action Managers to handle predefined actions on specific meshes.
  1836. */
  1837. class ActionManager {
  1838. static readonly NothingTrigger: number;
  1839. static readonly OnPickTrigger: number;
  1840. static readonly OnLeftPickTrigger: number;
  1841. static readonly OnRightPickTrigger: number;
  1842. static readonly OnCenterPickTrigger: number;
  1843. static readonly OnPickDownTrigger: number;
  1844. static readonly OnDoublePickTrigger: number;
  1845. static readonly OnPickUpTrigger: number;
  1846. static readonly OnPickOutTrigger: number;
  1847. static readonly OnLongPressTrigger: number;
  1848. static readonly OnPointerOverTrigger: number;
  1849. static readonly OnPointerOutTrigger: number;
  1850. static readonly OnEveryFrameTrigger: number;
  1851. static readonly OnIntersectionEnterTrigger: number;
  1852. static readonly OnIntersectionExitTrigger: number;
  1853. static readonly OnKeyDownTrigger: number;
  1854. static readonly OnKeyUpTrigger: number;
  1855. static Triggers: {};
  1856. actions: Action[];
  1857. hoverCursor: string;
  1858. constructor(scene: Scene);
  1859. dispose(): void;
  1860. getScene(): Scene;
  1861. /**
  1862. * Does this action manager handles actions of any of the given triggers
  1863. * @param {number[]} triggers - the triggers to be tested
  1864. * @return {boolean} whether one (or more) of the triggers is handeled
  1865. */
  1866. hasSpecificTriggers(triggers: number[]): boolean;
  1867. /**
  1868. * Does this action manager handles actions of a given trigger
  1869. * @param {number} trigger - the trigger to be tested
  1870. * @return {boolean} whether the trigger is handeled
  1871. */
  1872. hasSpecificTrigger(trigger: number): boolean;
  1873. /**
  1874. * Does this action manager has pointer triggers
  1875. * @return {boolean} whether or not it has pointer triggers
  1876. */
  1877. readonly hasPointerTriggers: boolean;
  1878. /**
  1879. * Does this action manager has pick triggers
  1880. * @return {boolean} whether or not it has pick triggers
  1881. */
  1882. readonly hasPickTriggers: boolean;
  1883. /**
  1884. * Does exist one action manager with at least one trigger
  1885. * @return {boolean} whether or not it exists one action manager with one trigger
  1886. **/
  1887. static readonly HasTriggers: boolean;
  1888. /**
  1889. * Does exist one action manager with at least one pick trigger
  1890. * @return {boolean} whether or not it exists one action manager with one pick trigger
  1891. **/
  1892. static readonly HasPickTriggers: boolean;
  1893. /**
  1894. * Does exist one action manager that handles actions of a given trigger
  1895. * @param {number} trigger - the trigger to be tested
  1896. * @return {boolean} whether the trigger is handeled by at least one action manager
  1897. **/
  1898. static HasSpecificTrigger(trigger: number): boolean;
  1899. /**
  1900. * Registers an action to this action manager
  1901. * @param {BABYLON.Action} action - the action to be registered
  1902. * @return {BABYLON.Action} the action amended (prepared) after registration
  1903. */
  1904. registerAction(action: Action): Action;
  1905. /**
  1906. * Process a specific trigger
  1907. * @param {number} trigger - the trigger to process
  1908. * @param evt {BABYLON.ActionEvent} the event details to be processed
  1909. */
  1910. processTrigger(trigger: number, evt: ActionEvent): void;
  1911. serialize(name: string): any;
  1912. static Parse(parsedActions: any, object: AbstractMesh, scene: Scene): void;
  1913. static GetTriggerName(trigger: number): string;
  1914. }
  1915. }
  1916. declare module BABYLON {
  1917. class Condition {
  1918. constructor(actionManager: ActionManager);
  1919. isValid(): boolean;
  1920. serialize(): any;
  1921. }
  1922. class ValueCondition extends Condition {
  1923. propertyPath: string;
  1924. value: any;
  1925. operator: number;
  1926. static readonly IsEqual: number;
  1927. static readonly IsDifferent: number;
  1928. static readonly IsGreater: number;
  1929. static readonly IsLesser: number;
  1930. constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number);
  1931. isValid(): boolean;
  1932. serialize(): any;
  1933. static GetOperatorName(operator: number): string;
  1934. }
  1935. class PredicateCondition extends Condition {
  1936. predicate: () => boolean;
  1937. constructor(actionManager: ActionManager, predicate: () => boolean);
  1938. isValid(): boolean;
  1939. }
  1940. class StateCondition extends Condition {
  1941. value: string;
  1942. constructor(actionManager: ActionManager, target: any, value: string);
  1943. isValid(): boolean;
  1944. serialize(): any;
  1945. }
  1946. }
  1947. declare module BABYLON {
  1948. class SwitchBooleanAction extends Action {
  1949. propertyPath: string;
  1950. constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
  1951. execute(): void;
  1952. serialize(parent: any): any;
  1953. }
  1954. class SetStateAction extends Action {
  1955. value: string;
  1956. constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
  1957. execute(): void;
  1958. serialize(parent: any): any;
  1959. }
  1960. class SetValueAction extends Action {
  1961. propertyPath: string;
  1962. value: any;
  1963. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  1964. execute(): void;
  1965. serialize(parent: any): any;
  1966. }
  1967. class IncrementValueAction extends Action {
  1968. propertyPath: string;
  1969. value: any;
  1970. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  1971. execute(): void;
  1972. serialize(parent: any): any;
  1973. }
  1974. class PlayAnimationAction extends Action {
  1975. from: number;
  1976. to: number;
  1977. loop: boolean;
  1978. constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition);
  1979. execute(): void;
  1980. serialize(parent: any): any;
  1981. }
  1982. class StopAnimationAction extends Action {
  1983. constructor(triggerOptions: any, target: any, condition?: Condition);
  1984. execute(): void;
  1985. serialize(parent: any): any;
  1986. }
  1987. class DoNothingAction extends Action {
  1988. constructor(triggerOptions?: any, condition?: Condition);
  1989. execute(): void;
  1990. serialize(parent: any): any;
  1991. }
  1992. class CombineAction extends Action {
  1993. children: Action[];
  1994. constructor(triggerOptions: any, children: Action[], condition?: Condition);
  1995. execute(evt: ActionEvent): void;
  1996. serialize(parent: any): any;
  1997. }
  1998. class ExecuteCodeAction extends Action {
  1999. func: (evt: ActionEvent) => void;
  2000. constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
  2001. execute(evt: ActionEvent): void;
  2002. }
  2003. class SetParentAction extends Action {
  2004. constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
  2005. execute(): void;
  2006. serialize(parent: any): any;
  2007. }
  2008. class PlaySoundAction extends Action {
  2009. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  2010. execute(): void;
  2011. serialize(parent: any): any;
  2012. }
  2013. class StopSoundAction extends Action {
  2014. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  2015. execute(): void;
  2016. serialize(parent: any): any;
  2017. }
  2018. }
  2019. declare module BABYLON {
  2020. class InterpolateValueAction extends Action {
  2021. propertyPath: string;
  2022. value: any;
  2023. duration: number;
  2024. stopOtherAnimations: boolean;
  2025. onInterpolationDone: () => void;
  2026. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean, onInterpolationDone?: () => void);
  2027. execute(): void;
  2028. serialize(parent: any): any;
  2029. }
  2030. }
  2031. declare module BABYLON {
  2032. class Animatable {
  2033. target: any;
  2034. fromFrame: number;
  2035. toFrame: number;
  2036. loopAnimation: boolean;
  2037. speedRatio: number;
  2038. onAnimationEnd: any;
  2039. animationStarted: boolean;
  2040. constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any);
  2041. getAnimations(): Animation[];
  2042. appendAnimations(target: any, animations: Animation[]): void;
  2043. getAnimationByTargetProperty(property: string): Animation;
  2044. reset(): void;
  2045. enableBlending(blendingSpeed: number): void;
  2046. disableBlending(): void;
  2047. goToFrame(frame: number): void;
  2048. pause(): void;
  2049. restart(): void;
  2050. stop(animationName?: string): void;
  2051. }
  2052. }
  2053. declare module BABYLON {
  2054. class AnimationRange {
  2055. name: string;
  2056. from: number;
  2057. to: number;
  2058. constructor(name: string, from: number, to: number);
  2059. clone(): AnimationRange;
  2060. }
  2061. /**
  2062. * Composed of a frame, and an action function
  2063. */
  2064. class AnimationEvent {
  2065. frame: number;
  2066. action: () => void;
  2067. onlyOnce: boolean;
  2068. isDone: boolean;
  2069. constructor(frame: number, action: () => void, onlyOnce?: boolean);
  2070. }
  2071. class PathCursor {
  2072. private path;
  2073. value: number;
  2074. animations: Animation[];
  2075. constructor(path: Path2);
  2076. getPoint(): Vector3;
  2077. moveAhead(step?: number): PathCursor;
  2078. moveBack(step?: number): PathCursor;
  2079. move(step: number): PathCursor;
  2080. private ensureLimits();
  2081. private markAsDirty(propertyName);
  2082. private raiseOnChange();
  2083. onchange(f: (cursor: PathCursor) => void): PathCursor;
  2084. }
  2085. class Animation {
  2086. name: string;
  2087. targetProperty: string;
  2088. framePerSecond: number;
  2089. dataType: number;
  2090. loopMode: number;
  2091. enableBlending: boolean;
  2092. targetPropertyPath: string[];
  2093. currentFrame: number;
  2094. allowMatricesInterpolation: boolean;
  2095. blendingSpeed: number;
  2096. static CreateAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  2097. static CreateMergeAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  2098. constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number, enableBlending?: boolean);
  2099. /**
  2100. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2101. */
  2102. toString(fullDetails?: boolean): string;
  2103. /**
  2104. * Add an event to this animation.
  2105. */
  2106. addEvent(event: AnimationEvent): void;
  2107. /**
  2108. * Remove all events found at the given frame
  2109. * @param frame
  2110. */
  2111. removeEvents(frame: number): void;
  2112. createRange(name: string, from: number, to: number): void;
  2113. deleteRange(name: string, deleteFrames?: boolean): void;
  2114. getRange(name: string): AnimationRange;
  2115. reset(): void;
  2116. isStopped(): boolean;
  2117. getKeys(): Array<{
  2118. frame: number;
  2119. value: any;
  2120. }>;
  2121. getHighestFrame(): number;
  2122. getEasingFunction(): IEasingFunction;
  2123. setEasingFunction(easingFunction: EasingFunction): void;
  2124. floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
  2125. floatInterpolateFunctionWithTangents(startValue: number, outTangent: number, endValue: number, inTangent: number, gradient: number): number;
  2126. quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
  2127. quaternionInterpolateFunctionWithTangents(startValue: Quaternion, outTangent: Quaternion, endValue: Quaternion, inTangent: Quaternion, gradient: number): Quaternion;
  2128. vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
  2129. vector3InterpolateFunctionWithTangents(startValue: Vector3, outTangent: Vector3, endValue: Vector3, inTangent: Vector3, gradient: number): Vector3;
  2130. vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2;
  2131. vector2InterpolateFunctionWithTangents(startValue: Vector2, outTangent: Vector2, endValue: Vector2, inTangent: Vector2, gradient: number): Vector2;
  2132. sizeInterpolateFunction(startValue: Size, endValue: Size, gradient: number): Size;
  2133. color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
  2134. matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  2135. clone(): Animation;
  2136. setKeys(values: Array<{
  2137. frame: number;
  2138. value: any;
  2139. }>): void;
  2140. setValue(currentValue: any, blend?: boolean): void;
  2141. goToFrame(frame: number): void;
  2142. animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, blend?: boolean): boolean;
  2143. serialize(): any;
  2144. static readonly ANIMATIONTYPE_FLOAT: number;
  2145. static readonly ANIMATIONTYPE_VECTOR3: number;
  2146. static readonly ANIMATIONTYPE_VECTOR2: number;
  2147. static readonly ANIMATIONTYPE_SIZE: number;
  2148. static readonly ANIMATIONTYPE_QUATERNION: number;
  2149. static readonly ANIMATIONTYPE_MATRIX: number;
  2150. static readonly ANIMATIONTYPE_COLOR3: number;
  2151. static readonly ANIMATIONLOOPMODE_RELATIVE: number;
  2152. static readonly ANIMATIONLOOPMODE_CYCLE: number;
  2153. static readonly ANIMATIONLOOPMODE_CONSTANT: number;
  2154. static Parse(parsedAnimation: any): Animation;
  2155. static AppendSerializedAnimations(source: IAnimatable, destination: any): any;
  2156. }
  2157. }
  2158. declare module BABYLON {
  2159. interface IEasingFunction {
  2160. ease(gradient: number): number;
  2161. }
  2162. class EasingFunction implements IEasingFunction {
  2163. static readonly EASINGMODE_EASEIN: number;
  2164. static readonly EASINGMODE_EASEOUT: number;
  2165. static readonly EASINGMODE_EASEINOUT: number;
  2166. setEasingMode(easingMode: number): void;
  2167. getEasingMode(): number;
  2168. easeInCore(gradient: number): number;
  2169. ease(gradient: number): number;
  2170. }
  2171. class CircleEase extends EasingFunction implements IEasingFunction {
  2172. easeInCore(gradient: number): number;
  2173. }
  2174. class BackEase extends EasingFunction implements IEasingFunction {
  2175. amplitude: number;
  2176. constructor(amplitude?: number);
  2177. easeInCore(gradient: number): number;
  2178. }
  2179. class BounceEase extends EasingFunction implements IEasingFunction {
  2180. bounces: number;
  2181. bounciness: number;
  2182. constructor(bounces?: number, bounciness?: number);
  2183. easeInCore(gradient: number): number;
  2184. }
  2185. class CubicEase extends EasingFunction implements IEasingFunction {
  2186. easeInCore(gradient: number): number;
  2187. }
  2188. class ElasticEase extends EasingFunction implements IEasingFunction {
  2189. oscillations: number;
  2190. springiness: number;
  2191. constructor(oscillations?: number, springiness?: number);
  2192. easeInCore(gradient: number): number;
  2193. }
  2194. class ExponentialEase extends EasingFunction implements IEasingFunction {
  2195. exponent: number;
  2196. constructor(exponent?: number);
  2197. easeInCore(gradient: number): number;
  2198. }
  2199. class PowerEase extends EasingFunction implements IEasingFunction {
  2200. power: number;
  2201. constructor(power?: number);
  2202. easeInCore(gradient: number): number;
  2203. }
  2204. class QuadraticEase extends EasingFunction implements IEasingFunction {
  2205. easeInCore(gradient: number): number;
  2206. }
  2207. class QuarticEase extends EasingFunction implements IEasingFunction {
  2208. easeInCore(gradient: number): number;
  2209. }
  2210. class QuinticEase extends EasingFunction implements IEasingFunction {
  2211. easeInCore(gradient: number): number;
  2212. }
  2213. class SineEase extends EasingFunction implements IEasingFunction {
  2214. easeInCore(gradient: number): number;
  2215. }
  2216. class BezierCurveEase extends EasingFunction implements IEasingFunction {
  2217. x1: number;
  2218. y1: number;
  2219. x2: number;
  2220. y2: number;
  2221. constructor(x1?: number, y1?: number, x2?: number, y2?: number);
  2222. easeInCore(gradient: number): number;
  2223. }
  2224. }
  2225. declare module BABYLON {
  2226. class Analyser {
  2227. SMOOTHING: number;
  2228. FFT_SIZE: number;
  2229. BARGRAPHAMPLITUDE: number;
  2230. DEBUGCANVASPOS: {
  2231. x: number;
  2232. y: number;
  2233. };
  2234. DEBUGCANVASSIZE: {
  2235. width: number;
  2236. height: number;
  2237. };
  2238. constructor(scene: Scene);
  2239. getFrequencyBinCount(): number;
  2240. getByteFrequencyData(): Uint8Array;
  2241. getByteTimeDomainData(): Uint8Array;
  2242. getFloatFrequencyData(): Uint8Array;
  2243. drawDebugCanvas(): void;
  2244. stopDebugCanvas(): void;
  2245. connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void;
  2246. dispose(): void;
  2247. }
  2248. }
  2249. declare module BABYLON {
  2250. class AudioEngine {
  2251. canUseWebAudio: boolean;
  2252. masterGain: GainNode;
  2253. WarnedWebAudioUnsupported: boolean;
  2254. unlocked: boolean;
  2255. onAudioUnlocked: () => any;
  2256. isMP3supported: boolean;
  2257. isOGGsupported: boolean;
  2258. readonly audioContext: AudioContext;
  2259. constructor();
  2260. dispose(): void;
  2261. getGlobalVolume(): number;
  2262. setGlobalVolume(newVolume: number): void;
  2263. connectToAnalyser(analyser: Analyser): void;
  2264. }
  2265. }
  2266. declare module BABYLON {
  2267. class Sound {
  2268. name: string;
  2269. autoplay: boolean;
  2270. loop: boolean;
  2271. useCustomAttenuation: boolean;
  2272. soundTrackId: number;
  2273. spatialSound: boolean;
  2274. refDistance: number;
  2275. rolloffFactor: number;
  2276. maxDistance: number;
  2277. distanceModel: string;
  2278. onended: () => any;
  2279. isPlaying: boolean;
  2280. isPaused: boolean;
  2281. /**
  2282. * Create a sound and attach it to a scene
  2283. * @param name Name of your sound
  2284. * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer
  2285. * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played
  2286. * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming
  2287. */
  2288. constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any);
  2289. dispose(): void;
  2290. isReady(): boolean;
  2291. setAudioBuffer(audioBuffer: AudioBuffer): void;
  2292. updateOptions(options: any): void;
  2293. switchPanningModelToHRTF(): void;
  2294. switchPanningModelToEqualPower(): void;
  2295. connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void;
  2296. /**
  2297. * Transform this sound into a directional source
  2298. * @param coneInnerAngle Size of the inner cone in degree
  2299. * @param coneOuterAngle Size of the outer cone in degree
  2300. * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)
  2301. */
  2302. setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void;
  2303. setPosition(newPosition: Vector3): void;
  2304. setLocalDirectionToMesh(newLocalDirection: Vector3): void;
  2305. updateDistanceFromListener(): void;
  2306. setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void;
  2307. /**
  2308. * Play the sound
  2309. * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
  2310. * @param offset (optional) Start the sound setting it at a specific time
  2311. */
  2312. play(time?: number, offset?: number): void;
  2313. /**
  2314. * Stop the sound
  2315. * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.
  2316. */
  2317. stop(time?: number): void;
  2318. pause(): void;
  2319. setVolume(newVolume: number, time?: number): void;
  2320. setPlaybackRate(newPlaybackRate: number): void;
  2321. getVolume(): number;
  2322. attachToMesh(meshToConnectTo: AbstractMesh): void;
  2323. detachFromMesh(): void;
  2324. clone(): Sound;
  2325. getAudioBuffer(): AudioBuffer;
  2326. serialize(): any;
  2327. static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound;
  2328. }
  2329. }
  2330. declare module BABYLON {
  2331. class SoundTrack {
  2332. id: number;
  2333. soundCollection: Array<Sound>;
  2334. constructor(scene: Scene, options?: any);
  2335. dispose(): void;
  2336. AddSound(sound: Sound): void;
  2337. RemoveSound(sound: Sound): void;
  2338. setVolume(newVolume: number): void;
  2339. switchPanningModelToHRTF(): void;
  2340. switchPanningModelToEqualPower(): void;
  2341. connectToAnalyser(analyser: Analyser): void;
  2342. }
  2343. }
  2344. declare module BABYLON {
  2345. class Bone extends Node {
  2346. name: string;
  2347. children: Bone[];
  2348. animations: Animation[];
  2349. length: number;
  2350. constructor(name: string, skeleton: Skeleton, parentBone?: Bone, matrix?: Matrix, restPose?: Matrix);
  2351. getSkeleton(): Skeleton;
  2352. getParent(): Bone;
  2353. setParent(parent: Bone, updateDifferenceMatrix?: boolean): void;
  2354. getLocalMatrix(): Matrix;
  2355. getBaseMatrix(): Matrix;
  2356. getRestPose(): Matrix;
  2357. returnToRest(): void;
  2358. getWorldMatrix(): Matrix;
  2359. getInvertedAbsoluteTransform(): Matrix;
  2360. getAbsoluteTransform(): Matrix;
  2361. position: Vector3;
  2362. rotation: Vector3;
  2363. rotationQuaternion: Quaternion;
  2364. scaling: Vector3;
  2365. updateMatrix(matrix: Matrix, updateDifferenceMatrix?: boolean): void;
  2366. markAsDirty(): void;
  2367. copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired?: boolean, skelDimensionsRatio?: Vector3): boolean;
  2368. /**
  2369. * Translate the bone in local or world space.
  2370. * @param vec The amount to translate the bone.
  2371. * @param space The space that the translation is in.
  2372. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2373. */
  2374. translate(vec: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2375. /**
  2376. * Set the postion of the bone in local or world space.
  2377. * @param position The position to set the bone.
  2378. * @param space The space that the position is in.
  2379. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2380. */
  2381. setPosition(position: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2382. /**
  2383. * Set the absolute postion of the bone (world space).
  2384. * @param position The position to set the bone.
  2385. * @param mesh The mesh that this bone is attached to.
  2386. */
  2387. setAbsolutePosition(position: Vector3, mesh?: AbstractMesh): void;
  2388. /**
  2389. * Set the scale of the bone on the x, y and z axes.
  2390. * @param x The scale of the bone on the x axis.
  2391. * @param x The scale of the bone on the y axis.
  2392. * @param z The scale of the bone on the z axis.
  2393. * @param scaleChildren Set this to true if children of the bone should be scaled.
  2394. */
  2395. setScale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  2396. /**
  2397. * Scale the bone on the x, y and z axes.
  2398. * @param x The amount to scale the bone on the x axis.
  2399. * @param x The amount to scale the bone on the y axis.
  2400. * @param z The amount to scale the bone on the z axis.
  2401. * @param scaleChildren Set this to true if children of the bone should be scaled.
  2402. */
  2403. scale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  2404. /**
  2405. * Set the yaw, pitch, and roll of the bone in local or world space.
  2406. * @param yaw The rotation of the bone on the y axis.
  2407. * @param pitch The rotation of the bone on the x axis.
  2408. * @param roll The rotation of the bone on the z axis.
  2409. * @param space The space that the axes of rotation are in.
  2410. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2411. */
  2412. setYawPitchRoll(yaw: number, pitch: number, roll: number, space?: Space, mesh?: AbstractMesh): void;
  2413. /**
  2414. * Rotate the bone on an axis in local or world space.
  2415. * @param axis The axis to rotate the bone on.
  2416. * @param amount The amount to rotate the bone.
  2417. * @param space The space that the axis is in.
  2418. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2419. */
  2420. rotate(axis: Vector3, amount: number, space?: Space, mesh?: AbstractMesh): void;
  2421. /**
  2422. * Set the rotation of the bone to a particular axis angle in local or world space.
  2423. * @param axis The axis to rotate the bone on.
  2424. * @param angle The angle that the bone should be rotated to.
  2425. * @param space The space that the axis is in.
  2426. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2427. */
  2428. setAxisAngle(axis: Vector3, angle: number, space?: Space, mesh?: AbstractMesh): void;
  2429. /**
  2430. * Set the euler rotation of the bone in local of world space.
  2431. * @param rotation The euler rotation that the bone should be set to.
  2432. * @param space The space that the rotation is in.
  2433. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2434. */
  2435. setRotation(rotation: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2436. /**
  2437. * Set the quaternion rotation of the bone in local of world space.
  2438. * @param quat The quaternion rotation that the bone should be set to.
  2439. * @param space The space that the rotation is in.
  2440. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2441. */
  2442. setRotationQuaternion(quat: Quaternion, space?: Space, mesh?: AbstractMesh): void;
  2443. /**
  2444. * Set the rotation matrix of the bone in local of world space.
  2445. * @param rotMat The rotation matrix that the bone should be set to.
  2446. * @param space The space that the rotation is in.
  2447. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2448. */
  2449. setRotationMatrix(rotMat: Matrix, space?: Space, mesh?: AbstractMesh): void;
  2450. /**
  2451. * Get the scale of the bone
  2452. * @returns the scale of the bone
  2453. */
  2454. getScale(): Vector3;
  2455. /**
  2456. * Copy the scale of the bone to a vector3.
  2457. * @param result The vector3 to copy the scale to
  2458. */
  2459. getScaleToRef(result: Vector3): void;
  2460. /**
  2461. * Get the position of the bone in local or world space.
  2462. * @param space The space that the returned position is in.
  2463. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2464. * @returns The position of the bone
  2465. */
  2466. getPosition(space?: Space, mesh?: AbstractMesh): Vector3;
  2467. /**
  2468. * Copy the position of the bone to a vector3 in local or world space.
  2469. * @param space The space that the returned position is in.
  2470. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2471. * @param result The vector3 to copy the position to.
  2472. */
  2473. getPositionToRef(space: Space, mesh: AbstractMesh, result: Vector3): void;
  2474. /**
  2475. * Get the absolute position of the bone (world space).
  2476. * @param mesh The mesh that this bone is attached to.
  2477. * @returns The absolute position of the bone
  2478. */
  2479. getAbsolutePosition(mesh?: AbstractMesh): Vector3;
  2480. /**
  2481. * Copy the absolute position of the bone (world space) to the result param.
  2482. * @param mesh The mesh that this bone is attached to.
  2483. * @param result The vector3 to copy the absolute position to.
  2484. */
  2485. getAbsolutePositionToRef(mesh: AbstractMesh, result: Vector3): void;
  2486. /**
  2487. * Compute the absolute transforms of this bone and its children.
  2488. */
  2489. computeAbsoluteTransforms(): void;
  2490. /**
  2491. * Get the world direction from an axis that is in the local space of the bone.
  2492. * @param localAxis The local direction that is used to compute the world direction.
  2493. * @param mesh The mesh that this bone is attached to.
  2494. * @returns The world direction
  2495. */
  2496. getDirection(localAxis: Vector3, mesh?: AbstractMesh): Vector3;
  2497. /**
  2498. * Copy the world direction to a vector3 from an axis that is in the local space of the bone.
  2499. * @param localAxis The local direction that is used to compute the world direction.
  2500. * @param mesh The mesh that this bone is attached to.
  2501. * @param result The vector3 that the world direction will be copied to.
  2502. */
  2503. getDirectionToRef(localAxis: Vector3, mesh: AbstractMesh, result: Vector3): void;
  2504. /**
  2505. * Get the euler rotation of the bone in local or world space.
  2506. * @param space The space that the rotation should be in.
  2507. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2508. * @returns The euler rotation
  2509. */
  2510. getRotation(space?: Space, mesh?: AbstractMesh): Vector3;
  2511. /**
  2512. * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space.
  2513. * @param space The space that the rotation should be in.
  2514. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2515. * @param result The vector3 that the rotation should be copied to.
  2516. */
  2517. getRotationToRef(space: Space, mesh: AbstractMesh, result: Vector3): void;
  2518. /**
  2519. * Get the quaternion rotation of the bone in either local or world space.
  2520. * @param space The space that the rotation should be in.
  2521. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2522. * @returns The quaternion rotation
  2523. */
  2524. getRotationQuaternion(space?: Space, mesh?: AbstractMesh): Quaternion;
  2525. /**
  2526. * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space.
  2527. * @param space The space that the rotation should be in.
  2528. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2529. * @param result The quaternion that the rotation should be copied to.
  2530. */
  2531. getRotationQuaternionToRef(space: Space, mesh: AbstractMesh, result: Quaternion): void;
  2532. /**
  2533. * Get the rotation matrix of the bone in local or world space.
  2534. * @param space The space that the rotation should be in.
  2535. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2536. * @returns The rotation matrix
  2537. */
  2538. getRotationMatrix(space: Space, mesh: AbstractMesh): Matrix;
  2539. /**
  2540. * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space.
  2541. * @param space The space that the rotation should be in.
  2542. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  2543. * @param result The quaternion that the rotation should be copied to.
  2544. */
  2545. getRotationMatrixToRef(space: Space, mesh: AbstractMesh, result: Matrix): void;
  2546. /**
  2547. * Get the world position of a point that is in the local space of the bone.
  2548. * @param position The local position
  2549. * @param mesh The mesh that this bone is attached to.
  2550. * @returns The world position
  2551. */
  2552. getAbsolutePositionFromLocal(position: Vector3, mesh?: AbstractMesh): Vector3;
  2553. /**
  2554. * Get the world position of a point that is in the local space of the bone and copy it to the result param.
  2555. * @param position The local position
  2556. * @param mesh The mesh that this bone is attached to.
  2557. * @param result The vector3 that the world position should be copied to.
  2558. */
  2559. getAbsolutePositionFromLocalToRef(position: Vector3, mesh: AbstractMesh, result: Vector3): void;
  2560. /**
  2561. * Get the local position of a point that is in world space.
  2562. * @param position The world position
  2563. * @param mesh The mesh that this bone is attached to.
  2564. * @returns The local position
  2565. */
  2566. getLocalPositionFromAbsolute(position: Vector3, mesh?: AbstractMesh): Vector3;
  2567. /**
  2568. * Get the local position of a point that is in world space and copy it to the result param.
  2569. * @param position The world position
  2570. * @param mesh The mesh that this bone is attached to.
  2571. * @param result The vector3 that the local position should be copied to.
  2572. */
  2573. getLocalPositionFromAbsoluteToRef(position: Vector3, mesh: AbstractMesh, result: Vector3): void;
  2574. }
  2575. }
  2576. declare module BABYLON {
  2577. class BoneIKController {
  2578. targetMesh: AbstractMesh;
  2579. poleTargetMesh: AbstractMesh;
  2580. poleTargetBone: Bone;
  2581. targetPosition: Vector3;
  2582. poleTargetPosition: Vector3;
  2583. poleTargetLocalOffset: Vector3;
  2584. poleAngle: number;
  2585. mesh: AbstractMesh;
  2586. slerpAmount: number;
  2587. maxAngle: number;
  2588. constructor(mesh: AbstractMesh, bone: Bone, options?: {
  2589. targetMesh?: AbstractMesh;
  2590. poleTargetMesh?: AbstractMesh;
  2591. poleTargetBone?: Bone;
  2592. poleTargetLocalOffset?: Vector3;
  2593. poleAngle?: number;
  2594. bendAxis?: Vector3;
  2595. maxAngle?: number;
  2596. slerpAmount?: number;
  2597. });
  2598. update(): void;
  2599. }
  2600. }
  2601. declare module BABYLON {
  2602. class BoneLookController {
  2603. /**
  2604. * The target Vector3 that the bone will look at.
  2605. */
  2606. target: Vector3;
  2607. /**
  2608. * The mesh that the bone is attached to.
  2609. */
  2610. mesh: AbstractMesh;
  2611. /**
  2612. * The bone that will be looking to the target.
  2613. */
  2614. bone: Bone;
  2615. /**
  2616. * The up axis of the coordinate system that is used when the bone is rotated.
  2617. */
  2618. upAxis: Vector3;
  2619. /**
  2620. * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
  2621. */
  2622. upAxisSpace: Space;
  2623. /**
  2624. * Used to make an adjustment to the yaw of the bone.
  2625. */
  2626. adjustYaw: number;
  2627. /**
  2628. * Used to make an adjustment to the pitch of the bone.
  2629. */
  2630. adjustPitch: number;
  2631. /**
  2632. * Used to make an adjustment to the roll of the bone.
  2633. */
  2634. adjustRoll: number;
  2635. /**
  2636. * 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).
  2637. */
  2638. slerpAmount: number;
  2639. /**
  2640. * Get/set the minimum yaw angle that the bone can look to.
  2641. */
  2642. minYaw: number;
  2643. /**
  2644. * Get/set the maximum yaw angle that the bone can look to.
  2645. */
  2646. maxYaw: number;
  2647. /**
  2648. * Get/set the minimum pitch angle that the bone can look to.
  2649. */
  2650. minPitch: number;
  2651. /**
  2652. * Get/set the maximum pitch angle that the bone can look to.
  2653. */
  2654. maxPitch: number;
  2655. /**
  2656. * Create a BoneLookController
  2657. * @param mesh the mesh that the bone belongs to
  2658. * @param bone the bone that will be looking to the target
  2659. * @param target the target Vector3 to look at
  2660. * @param settings optional settings:
  2661. * - maxYaw: the maximum angle the bone will yaw to
  2662. * - minYaw: the minimum angle the bone will yaw to
  2663. * - maxPitch: the maximum angle the bone will pitch to
  2664. * - minPitch: the minimum angle the bone will yaw to
  2665. * - slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
  2666. * - upAxis: the up axis of the coordinate system
  2667. * - upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
  2668. * - yawAxis: set yawAxis if the bone does not yaw on the y axis
  2669. * - pitchAxis: set pitchAxis if the bone does not pitch on the x axis
  2670. * - adjustYaw: used to make an adjustment to the yaw of the bone
  2671. * - adjustPitch: used to make an adjustment to the pitch of the bone
  2672. * - adjustRoll: used to make an adjustment to the roll of the bone
  2673. **/
  2674. constructor(mesh: AbstractMesh, bone: Bone, target: Vector3, options?: {
  2675. maxYaw?: number;
  2676. minYaw?: number;
  2677. maxPitch?: number;
  2678. minPitch?: number;
  2679. slerpAmount?: number;
  2680. upAxis?: Vector3;
  2681. upAxisSpace?: Space;
  2682. yawAxis?: Vector3;
  2683. pitchAxis?: Vector3;
  2684. adjustYaw?: number;
  2685. adjustPitch?: number;
  2686. adjustRoll?: number;
  2687. });
  2688. /**
  2689. * Update the bone to look at the target. This should be called before the scene is rendered (use scene.registerBeforeRender()).
  2690. */
  2691. update(): void;
  2692. }
  2693. }
  2694. declare module BABYLON {
  2695. class Skeleton {
  2696. name: string;
  2697. id: string;
  2698. bones: Bone[];
  2699. dimensionsAtRest: Vector3;
  2700. needInitialSkinMatrix: boolean;
  2701. /**
  2702. * An event triggered before computing the skeleton's matrices
  2703. * @type {BABYLON.Observable}
  2704. */
  2705. onBeforeComputeObservable: Observable<Skeleton>;
  2706. constructor(name: string, id: string, scene: Scene);
  2707. getTransformMatrices(mesh: AbstractMesh): Float32Array;
  2708. getScene(): Scene;
  2709. /**
  2710. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2711. */
  2712. toString(fullDetails?: boolean): string;
  2713. /**
  2714. * Get bone's index searching by name
  2715. * @param {string} name is bone's name to search for
  2716. * @return {number} Indice of the bone. Returns -1 if not found
  2717. */
  2718. getBoneIndexByName(name: string): number;
  2719. createAnimationRange(name: string, from: number, to: number): void;
  2720. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  2721. getAnimationRange(name: string): AnimationRange;
  2722. /**
  2723. * Returns as an Array, all AnimationRanges defined on this skeleton
  2724. */
  2725. getAnimationRanges(): AnimationRange[];
  2726. /**
  2727. * note: This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences
  2728. */
  2729. copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean;
  2730. returnToRest(): void;
  2731. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  2732. prepare(): void;
  2733. getAnimatables(): IAnimatable[];
  2734. clone(name: string, id: string): Skeleton;
  2735. enableBlending(blendingSpeed?: number): void;
  2736. dispose(): void;
  2737. serialize(): any;
  2738. static Parse(parsedSkeleton: any, scene: Scene): Skeleton;
  2739. computeAbsoluteTransforms(forceUpdate?: boolean): void;
  2740. getPoseMatrix(): Matrix;
  2741. }
  2742. }
  2743. declare module BABYLON {
  2744. class ArcRotateCamera extends TargetCamera {
  2745. alpha: number;
  2746. beta: number;
  2747. radius: number;
  2748. target: Vector3;
  2749. inertialAlphaOffset: number;
  2750. inertialBetaOffset: number;
  2751. inertialRadiusOffset: number;
  2752. lowerAlphaLimit: any;
  2753. upperAlphaLimit: any;
  2754. lowerBetaLimit: number;
  2755. upperBetaLimit: number;
  2756. lowerRadiusLimit: any;
  2757. upperRadiusLimit: any;
  2758. inertialPanningX: number;
  2759. inertialPanningY: number;
  2760. panningInertia: number;
  2761. angularSensibilityX: number;
  2762. angularSensibilityY: number;
  2763. pinchPrecision: number;
  2764. panningSensibility: number;
  2765. keysUp: number[];
  2766. keysDown: number[];
  2767. keysLeft: number[];
  2768. keysRight: number[];
  2769. wheelPrecision: number;
  2770. zoomOnFactor: number;
  2771. targetScreenOffset: Vector2;
  2772. allowUpsideDown: boolean;
  2773. inputs: ArcRotateCameraInputsManager;
  2774. panningAxis: Vector3;
  2775. onCollide: (collidedMesh: AbstractMesh) => void;
  2776. checkCollisions: boolean;
  2777. collisionRadius: Vector3;
  2778. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);
  2779. attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean, panningMouseButton?: number): void;
  2780. detachControl(element: HTMLElement): void;
  2781. rebuildAnglesAndRadius(): void;
  2782. setPosition(position: Vector3): void;
  2783. setTarget(target: AbstractMesh | Vector3, toBoundingCenter?: boolean, allowSamePosition?: boolean): void;
  2784. zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void;
  2785. focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void;
  2786. /**
  2787. * @override
  2788. * Override Camera.createRigCamera
  2789. */
  2790. createRigCamera(name: string, cameraIndex: number): Camera;
  2791. /**
  2792. * @override
  2793. * Override Camera._updateRigCameras
  2794. */
  2795. dispose(): void;
  2796. getClassName(): string;
  2797. }
  2798. }
  2799. declare module BABYLON {
  2800. class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
  2801. constructor(camera: ArcRotateCamera);
  2802. addMouseWheel(): ArcRotateCameraInputsManager;
  2803. addPointers(): ArcRotateCameraInputsManager;
  2804. addKeyboard(): ArcRotateCameraInputsManager;
  2805. addGamepad(): ArcRotateCameraInputsManager;
  2806. addVRDeviceOrientation(): ArcRotateCameraInputsManager;
  2807. }
  2808. }
  2809. declare module BABYLON {
  2810. class Camera extends Node {
  2811. inputs: CameraInputsManager<Camera>;
  2812. static readonly PERSPECTIVE_CAMERA: number;
  2813. static readonly ORTHOGRAPHIC_CAMERA: number;
  2814. static readonly FOVMODE_VERTICAL_FIXED: number;
  2815. static readonly FOVMODE_HORIZONTAL_FIXED: number;
  2816. static readonly RIG_MODE_NONE: number;
  2817. static readonly RIG_MODE_STEREOSCOPIC_ANAGLYPH: number;
  2818. static readonly RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number;
  2819. static readonly RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number;
  2820. static readonly RIG_MODE_STEREOSCOPIC_OVERUNDER: number;
  2821. static readonly RIG_MODE_VR: number;
  2822. static readonly RIG_MODE_WEBVR: number;
  2823. static ForceAttachControlToAlwaysPreventDefault: boolean;
  2824. position: Vector3;
  2825. upVector: Vector3;
  2826. orthoLeft: any;
  2827. orthoRight: any;
  2828. orthoBottom: any;
  2829. orthoTop: any;
  2830. fov: number;
  2831. minZ: number;
  2832. maxZ: number;
  2833. inertia: number;
  2834. mode: number;
  2835. isIntermediate: boolean;
  2836. viewport: Viewport;
  2837. layerMask: number;
  2838. fovMode: number;
  2839. cameraRigMode: number;
  2840. interaxialDistance: number;
  2841. isStereoscopicSideBySide: boolean;
  2842. customRenderTargets: RenderTargetTexture[];
  2843. constructor(name: string, position: Vector3, scene: Scene);
  2844. getClassName(): string;
  2845. /**
  2846. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2847. */
  2848. toString(fullDetails?: boolean): string;
  2849. readonly globalPosition: Vector3;
  2850. getActiveMeshes(): SmartArray<Mesh>;
  2851. isActiveMesh(mesh: Mesh): boolean;
  2852. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2853. detachControl(element: HTMLElement): void;
  2854. update(): void;
  2855. readonly rigCameras: Camera[];
  2856. readonly rigPostProcess: PostProcess;
  2857. attachPostProcess(postProcess: PostProcess, insertAt?: number): number;
  2858. detachPostProcess(postProcess: PostProcess, atIndices?: any): number[];
  2859. getWorldMatrix(): Matrix;
  2860. getViewMatrix(force?: boolean): Matrix;
  2861. freezeProjectionMatrix(projection?: Matrix): void;
  2862. unfreezeProjectionMatrix(): void;
  2863. getProjectionMatrix(force?: boolean): Matrix;
  2864. getTranformationMatrix(): Matrix;
  2865. private updateFrustumPlanes();
  2866. isInFrustum(target: ICullable): boolean;
  2867. isCompletelyInFrustum(target: ICullable): boolean;
  2868. getForwardRay(length?: number, transform?: Matrix, origin?: Vector3): Ray;
  2869. dispose(): void;
  2870. readonly leftCamera: FreeCamera;
  2871. readonly rightCamera: FreeCamera;
  2872. getLeftTarget(): Vector3;
  2873. getRightTarget(): Vector3;
  2874. setCameraRigMode(mode: number, rigParams: any): void;
  2875. /**
  2876. * This function MUST be overwritten by the different WebVR cameras available.
  2877. * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.
  2878. */
  2879. /**
  2880. * This function MUST be overwritten by the different WebVR cameras available.
  2881. * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.
  2882. */
  2883. setCameraRigParameter(name: string, value: any): void;
  2884. /**
  2885. * needs to be overridden by children so sub has required properties to be copied
  2886. */
  2887. createRigCamera(name: string, cameraIndex: number): Camera;
  2888. /**
  2889. * May need to be overridden by children
  2890. */
  2891. serialize(): any;
  2892. clone(name: string): Camera;
  2893. getDirection(localAxis: Vector3): Vector3;
  2894. getDirectionToRef(localAxis: Vector3, result: Vector3): void;
  2895. static GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): () => Camera;
  2896. static Parse(parsedCamera: any, scene: Scene): Camera;
  2897. }
  2898. }
  2899. declare module BABYLON {
  2900. var CameraInputTypes: {};
  2901. interface ICameraInput<TCamera extends BABYLON.Camera> {
  2902. camera: TCamera;
  2903. getTypeName(): string;
  2904. getSimpleName(): string;
  2905. attachControl: (element: HTMLElement, noPreventDefault?: boolean) => void;
  2906. detachControl: (element: HTMLElement) => void;
  2907. checkInputs?: () => void;
  2908. }
  2909. interface CameraInputsMap<TCamera extends BABYLON.Camera> {
  2910. [name: string]: ICameraInput<TCamera>;
  2911. [idx: number]: ICameraInput<TCamera>;
  2912. }
  2913. class CameraInputsManager<TCamera extends BABYLON.Camera> {
  2914. attached: CameraInputsMap<TCamera>;
  2915. attachedElement: HTMLElement;
  2916. noPreventDefault: boolean;
  2917. camera: TCamera;
  2918. checkInputs: () => void;
  2919. constructor(camera: TCamera);
  2920. add(input: ICameraInput<TCamera>): void;
  2921. remove(inputToRemove: ICameraInput<TCamera>): void;
  2922. removeByType(inputType: string): void;
  2923. attachInput(input: ICameraInput<TCamera>): void;
  2924. attachElement(element: HTMLElement, noPreventDefault?: boolean): void;
  2925. detachElement(element: HTMLElement): void;
  2926. rebuildInputCheck(): void;
  2927. clear(): void;
  2928. serialize(serializedCamera: any): void;
  2929. parse(parsedCamera: any): void;
  2930. }
  2931. }
  2932. declare module BABYLON {
  2933. class DeviceOrientationCamera extends FreeCamera {
  2934. constructor(name: string, position: Vector3, scene: Scene);
  2935. getClassName(): string;
  2936. resetToCurrentRotation(axis?: Axis): void;
  2937. }
  2938. }
  2939. declare module BABYLON {
  2940. class FollowCamera extends TargetCamera {
  2941. radius: number;
  2942. rotationOffset: number;
  2943. heightOffset: number;
  2944. cameraAcceleration: number;
  2945. maxCameraSpeed: number;
  2946. lockedTarget: AbstractMesh;
  2947. constructor(name: string, position: Vector3, scene: Scene, lockedTarget?: AbstractMesh);
  2948. private getRadians(degrees);
  2949. private follow(cameraTarget);
  2950. getClassName(): string;
  2951. }
  2952. class ArcFollowCamera extends TargetCamera {
  2953. alpha: number;
  2954. beta: number;
  2955. radius: number;
  2956. target: AbstractMesh;
  2957. constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene);
  2958. private follow();
  2959. getClassName(): string;
  2960. }
  2961. }
  2962. declare module BABYLON {
  2963. class FreeCamera extends TargetCamera {
  2964. ellipsoid: Vector3;
  2965. checkCollisions: boolean;
  2966. applyGravity: boolean;
  2967. inputs: FreeCameraInputsManager;
  2968. angularSensibility: number;
  2969. keysUp: number[];
  2970. keysDown: number[];
  2971. keysLeft: number[];
  2972. keysRight: number[];
  2973. onCollide: (collidedMesh: AbstractMesh) => void;
  2974. constructor(name: string, position: Vector3, scene: Scene);
  2975. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2976. detachControl(element: HTMLElement): void;
  2977. collisionMask: number;
  2978. dispose(): void;
  2979. getClassName(): string;
  2980. }
  2981. }
  2982. declare module BABYLON {
  2983. class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
  2984. constructor(camera: FreeCamera);
  2985. addKeyboard(): FreeCameraInputsManager;
  2986. addMouse(touchEnabled?: boolean): FreeCameraInputsManager;
  2987. addGamepad(): FreeCameraInputsManager;
  2988. addDeviceOrientation(): FreeCameraInputsManager;
  2989. addTouch(): FreeCameraInputsManager;
  2990. addVirtualJoystick(): FreeCameraInputsManager;
  2991. }
  2992. }
  2993. declare module BABYLON {
  2994. class GamepadCamera extends UniversalCamera {
  2995. gamepadAngularSensibility: number;
  2996. gamepadMoveSensibility: number;
  2997. constructor(name: string, position: Vector3, scene: Scene);
  2998. getClassName(): string;
  2999. }
  3000. }
  3001. declare module BABYLON {
  3002. class AnaglyphFreeCamera extends FreeCamera {
  3003. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  3004. getClassName(): string;
  3005. }
  3006. class AnaglyphArcRotateCamera extends ArcRotateCamera {
  3007. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene);
  3008. getClassName(): string;
  3009. }
  3010. class AnaglyphGamepadCamera extends GamepadCamera {
  3011. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  3012. getClassName(): string;
  3013. }
  3014. class AnaglyphUniversalCamera extends UniversalCamera {
  3015. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  3016. getClassName(): string;
  3017. }
  3018. class StereoscopicFreeCamera extends FreeCamera {
  3019. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3020. getClassName(): string;
  3021. }
  3022. class StereoscopicArcRotateCamera extends ArcRotateCamera {
  3023. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3024. getClassName(): string;
  3025. }
  3026. class StereoscopicGamepadCamera extends GamepadCamera {
  3027. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3028. getClassName(): string;
  3029. }
  3030. class StereoscopicUniversalCamera extends UniversalCamera {
  3031. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3032. getClassName(): string;
  3033. }
  3034. }
  3035. declare module BABYLON {
  3036. class TargetCamera extends Camera {
  3037. cameraDirection: Vector3;
  3038. cameraRotation: Vector2;
  3039. rotation: Vector3;
  3040. rotationQuaternion: Quaternion;
  3041. speed: number;
  3042. noRotationConstraint: boolean;
  3043. lockedTarget: any;
  3044. constructor(name: string, position: Vector3, scene: Scene);
  3045. getFrontPosition(distance: number): Vector3;
  3046. setTarget(target: Vector3): void;
  3047. /**
  3048. * Return the current target position of the camera. This value is expressed in local space.
  3049. */
  3050. getTarget(): Vector3;
  3051. /**
  3052. * @override
  3053. * Override Camera.createRigCamera
  3054. */
  3055. createRigCamera(name: string, cameraIndex: number): Camera;
  3056. /**
  3057. * @override
  3058. * Override Camera._updateRigCameras
  3059. */
  3060. getClassName(): string;
  3061. }
  3062. }
  3063. declare module BABYLON {
  3064. class TouchCamera extends FreeCamera {
  3065. touchAngularSensibility: number;
  3066. touchMoveSensibility: number;
  3067. constructor(name: string, position: Vector3, scene: Scene);
  3068. getClassName(): string;
  3069. }
  3070. }
  3071. declare module BABYLON {
  3072. class UniversalCamera extends TouchCamera {
  3073. gamepadAngularSensibility: number;
  3074. gamepadMoveSensibility: number;
  3075. constructor(name: string, position: Vector3, scene: Scene);
  3076. getClassName(): string;
  3077. }
  3078. }
  3079. declare module BABYLON {
  3080. class VirtualJoysticksCamera extends FreeCamera {
  3081. constructor(name: string, position: Vector3, scene: Scene);
  3082. getClassName(): string;
  3083. }
  3084. }
  3085. declare module BABYLON {
  3086. class Collider {
  3087. radius: Vector3;
  3088. retry: number;
  3089. velocity: Vector3;
  3090. basePoint: Vector3;
  3091. epsilon: number;
  3092. collisionFound: boolean;
  3093. velocityWorldLength: number;
  3094. basePointWorld: Vector3;
  3095. velocityWorld: Vector3;
  3096. normalizedVelocity: Vector3;
  3097. initialVelocity: Vector3;
  3098. initialPosition: Vector3;
  3099. nearestDistance: number;
  3100. intersectionPoint: Vector3;
  3101. collidedMesh: AbstractMesh;
  3102. collisionMask: number;
  3103. }
  3104. }
  3105. declare module BABYLON {
  3106. var CollisionWorker: string;
  3107. interface ICollisionCoordinator {
  3108. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  3109. init(scene: Scene): void;
  3110. destroy(): void;
  3111. onMeshAdded(mesh: AbstractMesh): any;
  3112. onMeshUpdated(mesh: AbstractMesh): any;
  3113. onMeshRemoved(mesh: AbstractMesh): any;
  3114. onGeometryAdded(geometry: Geometry): any;
  3115. onGeometryUpdated(geometry: Geometry): any;
  3116. onGeometryDeleted(geometry: Geometry): any;
  3117. }
  3118. interface SerializedMesh {
  3119. id: string;
  3120. name: string;
  3121. uniqueId: number;
  3122. geometryId: string;
  3123. sphereCenter: Array<number>;
  3124. sphereRadius: number;
  3125. boxMinimum: Array<number>;
  3126. boxMaximum: Array<number>;
  3127. worldMatrixFromCache: any;
  3128. subMeshes: Array<SerializedSubMesh>;
  3129. checkCollisions: boolean;
  3130. }
  3131. interface SerializedSubMesh {
  3132. position: number;
  3133. verticesStart: number;
  3134. verticesCount: number;
  3135. indexStart: number;
  3136. indexCount: number;
  3137. hasMaterial: boolean;
  3138. sphereCenter: Array<number>;
  3139. sphereRadius: number;
  3140. boxMinimum: Array<number>;
  3141. boxMaximum: Array<number>;
  3142. }
  3143. interface SerializedGeometry {
  3144. id: string;
  3145. positions: Float32Array;
  3146. indices: Uint32Array;
  3147. normals: Float32Array;
  3148. }
  3149. interface BabylonMessage {
  3150. taskType: WorkerTaskType;
  3151. payload: InitPayload | CollidePayload | UpdatePayload;
  3152. }
  3153. interface SerializedColliderToWorker {
  3154. position: Array<number>;
  3155. velocity: Array<number>;
  3156. radius: Array<number>;
  3157. }
  3158. enum WorkerTaskType {
  3159. INIT = 0,
  3160. UPDATE = 1,
  3161. COLLIDE = 2,
  3162. }
  3163. interface WorkerReply {
  3164. error: WorkerReplyType;
  3165. taskType: WorkerTaskType;
  3166. payload?: any;
  3167. }
  3168. interface CollisionReplyPayload {
  3169. newPosition: Array<number>;
  3170. collisionId: number;
  3171. collidedMeshUniqueId: number;
  3172. }
  3173. interface InitPayload {
  3174. }
  3175. interface CollidePayload {
  3176. collisionId: number;
  3177. collider: SerializedColliderToWorker;
  3178. maximumRetry: number;
  3179. excludedMeshUniqueId?: number;
  3180. }
  3181. interface UpdatePayload {
  3182. updatedMeshes: {
  3183. [n: number]: SerializedMesh;
  3184. };
  3185. updatedGeometries: {
  3186. [s: string]: SerializedGeometry;
  3187. };
  3188. removedMeshes: Array<number>;
  3189. removedGeometries: Array<string>;
  3190. }
  3191. enum WorkerReplyType {
  3192. SUCCESS = 0,
  3193. UNKNOWN_ERROR = 1,
  3194. }
  3195. class CollisionCoordinatorWorker implements ICollisionCoordinator {
  3196. constructor();
  3197. static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
  3198. static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
  3199. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  3200. init(scene: Scene): void;
  3201. destroy(): void;
  3202. onMeshAdded(mesh: AbstractMesh): void;
  3203. onMeshUpdated: (mesh: AbstractMesh) => void;
  3204. onMeshRemoved(mesh: AbstractMesh): void;
  3205. onGeometryAdded(geometry: Geometry): void;
  3206. onGeometryUpdated: (geometry: Geometry) => void;
  3207. onGeometryDeleted(geometry: Geometry): void;
  3208. }
  3209. class CollisionCoordinatorLegacy implements ICollisionCoordinator {
  3210. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  3211. init(scene: Scene): void;
  3212. destroy(): void;
  3213. onMeshAdded(mesh: AbstractMesh): void;
  3214. onMeshUpdated(mesh: AbstractMesh): void;
  3215. onMeshRemoved(mesh: AbstractMesh): void;
  3216. onGeometryAdded(geometry: Geometry): void;
  3217. onGeometryUpdated(geometry: Geometry): void;
  3218. onGeometryDeleted(geometry: Geometry): void;
  3219. }
  3220. }
  3221. declare module BABYLON {
  3222. var WorkerIncluded: boolean;
  3223. class CollisionCache {
  3224. getMeshes(): {
  3225. [n: number]: SerializedMesh;
  3226. };
  3227. getGeometries(): {
  3228. [s: number]: SerializedGeometry;
  3229. };
  3230. getMesh(id: any): SerializedMesh;
  3231. addMesh(mesh: SerializedMesh): void;
  3232. removeMesh(uniqueId: number): void;
  3233. getGeometry(id: string): SerializedGeometry;
  3234. addGeometry(geometry: SerializedGeometry): void;
  3235. removeGeometry(id: string): void;
  3236. }
  3237. class CollideWorker {
  3238. collider: Collider;
  3239. private finalPosition;
  3240. private collisionsScalingMatrix;
  3241. private collisionTranformationMatrix;
  3242. constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
  3243. collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void;
  3244. private checkCollision(mesh);
  3245. private processCollisionsForSubMeshes(transformMatrix, mesh);
  3246. private collideForSubMesh(subMesh, transformMatrix, meshGeometry);
  3247. private checkSubmeshCollision(subMesh);
  3248. }
  3249. interface ICollisionDetector {
  3250. onInit(payload: InitPayload): void;
  3251. onUpdate(payload: UpdatePayload): void;
  3252. onCollision(payload: CollidePayload): void;
  3253. }
  3254. class CollisionDetectorTransferable implements ICollisionDetector {
  3255. onInit(payload: InitPayload): void;
  3256. onUpdate(payload: UpdatePayload): void;
  3257. onCollision(payload: CollidePayload): void;
  3258. }
  3259. }
  3260. declare module BABYLON {
  3261. class IntersectionInfo {
  3262. bu: number;
  3263. bv: number;
  3264. distance: number;
  3265. faceId: number;
  3266. subMeshId: number;
  3267. constructor(bu: number, bv: number, distance: number);
  3268. }
  3269. class PickingInfo {
  3270. hit: boolean;
  3271. distance: number;
  3272. pickedPoint: Vector3;
  3273. pickedMesh: AbstractMesh;
  3274. bu: number;
  3275. bv: number;
  3276. faceId: number;
  3277. subMeshId: number;
  3278. pickedSprite: Sprite;
  3279. getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3;
  3280. getTextureCoordinates(): Vector2;
  3281. }
  3282. }
  3283. declare module BABYLON {
  3284. class BoundingBox implements ICullable {
  3285. minimum: Vector3;
  3286. maximum: Vector3;
  3287. vectors: Vector3[];
  3288. center: Vector3;
  3289. centerWorld: Vector3;
  3290. extendSize: Vector3;
  3291. extendSizeWorld: Vector3;
  3292. directions: Vector3[];
  3293. vectorsWorld: Vector3[];
  3294. minimumWorld: Vector3;
  3295. maximumWorld: Vector3;
  3296. constructor(minimum: Vector3, maximum: Vector3);
  3297. getWorldMatrix(): Matrix;
  3298. setWorldMatrix(matrix: Matrix): BoundingBox;
  3299. isInFrustum(frustumPlanes: Plane[]): boolean;
  3300. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3301. intersectsPoint(point: Vector3): boolean;
  3302. intersectsSphere(sphere: BoundingSphere): boolean;
  3303. intersectsMinMax(min: Vector3, max: Vector3): boolean;
  3304. static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
  3305. static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
  3306. static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  3307. static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  3308. }
  3309. }
  3310. declare module BABYLON {
  3311. interface ICullable {
  3312. isInFrustum(frustumPlanes: Plane[]): boolean;
  3313. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3314. }
  3315. class BoundingInfo implements ICullable {
  3316. minimum: Vector3;
  3317. maximum: Vector3;
  3318. boundingBox: BoundingBox;
  3319. boundingSphere: BoundingSphere;
  3320. constructor(minimum: Vector3, maximum: Vector3);
  3321. isLocked: boolean;
  3322. update(world: Matrix): void;
  3323. isInFrustum(frustumPlanes: Plane[]): boolean;
  3324. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3325. intersectsPoint(point: Vector3): boolean;
  3326. intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
  3327. }
  3328. }
  3329. declare module BABYLON {
  3330. class BoundingSphere {
  3331. minimum: Vector3;
  3332. maximum: Vector3;
  3333. center: Vector3;
  3334. radius: number;
  3335. centerWorld: Vector3;
  3336. radiusWorld: number;
  3337. constructor(minimum: Vector3, maximum: Vector3);
  3338. isInFrustum(frustumPlanes: Plane[]): boolean;
  3339. intersectsPoint(point: Vector3): boolean;
  3340. static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
  3341. }
  3342. }
  3343. declare module BABYLON {
  3344. class Ray {
  3345. origin: Vector3;
  3346. direction: Vector3;
  3347. length: number;
  3348. constructor(origin: Vector3, direction: Vector3, length?: number);
  3349. intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
  3350. intersectsBox(box: BoundingBox): boolean;
  3351. intersectsSphere(sphere: BoundingSphere): boolean;
  3352. intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
  3353. intersectsPlane(plane: Plane): number;
  3354. intersectsMesh(mesh: AbstractMesh, fastCheck?: boolean): PickingInfo;
  3355. intersectsMeshes(meshes: Array<AbstractMesh>, fastCheck?: boolean, results?: Array<PickingInfo>): Array<PickingInfo>;
  3356. private static smallnum;
  3357. private static rayl;
  3358. /**
  3359. * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
  3360. * @param sega the first point of the segment to test the intersection against
  3361. * @param segb the second point of the segment to test the intersection against
  3362. * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
  3363. * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
  3364. */
  3365. intersectionSegment(sega: Vector3, segb: Vector3, threshold: number): number;
  3366. static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
  3367. /**
  3368. * 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
  3369. * transformed to the given world matrix.
  3370. * @param origin The origin point
  3371. * @param end The end point
  3372. * @param world a matrix to transform the ray to. Default is the identity matrix.
  3373. */
  3374. static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
  3375. static Transform(ray: Ray, matrix: Matrix): Ray;
  3376. static TransformToRef(ray: Ray, matrix: Matrix, result: Ray): void;
  3377. }
  3378. }
  3379. declare module BABYLON {
  3380. /**
  3381. * Highlight layer options. This helps customizing the behaviour
  3382. * of the highlight layer.
  3383. */
  3384. interface IHighlightLayerOptions {
  3385. /**
  3386. * Multiplication factor apply to the canvas size to compute the render target size
  3387. * used to generated the glowing objects (the smaller the faster).
  3388. */
  3389. mainTextureRatio?: number;
  3390. /**
  3391. * Enforces a fixed size texture to ensure resize independant blur.
  3392. */
  3393. mainTextureFixedSize?: number;
  3394. /**
  3395. * Multiplication factor apply to the main texture size in the first step of the blur to reduce the size
  3396. * of the picture to blur (the smaller the faster).
  3397. */
  3398. blurTextureSizeRatio?: number;
  3399. /**
  3400. * How big in texel of the blur texture is the vertical blur.
  3401. */
  3402. blurVerticalSize?: number;
  3403. /**
  3404. * How big in texel of the blur texture is the horizontal blur.
  3405. */
  3406. blurHorizontalSize?: number;
  3407. /**
  3408. * Alpha blending mode used to apply the blur. Default is combine.
  3409. */
  3410. alphaBlendingMode?: number;
  3411. /**
  3412. * The camera attached to the layer.
  3413. */
  3414. camera?: Camera;
  3415. }
  3416. /**
  3417. * The highlight layer Helps adding a glow effect around a mesh.
  3418. *
  3419. * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove
  3420. * glowy meshes to your scene.
  3421. *
  3422. * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!
  3423. */
  3424. class HighlightLayer {
  3425. name: string;
  3426. /**
  3427. * The neutral color used during the preparation of the glow effect.
  3428. * This is black by default as the blend operation is a blend operation.
  3429. */
  3430. static neutralColor: Color4;
  3431. /**
  3432. * Stencil value used for glowing meshes.
  3433. */
  3434. static glowingMeshStencilReference: number;
  3435. /**
  3436. * Stencil value used for the other meshes in the scene.
  3437. */
  3438. static normalMeshStencilReference: number;
  3439. /**
  3440. * Specifies whether or not the inner glow is ACTIVE in the layer.
  3441. */
  3442. innerGlow: boolean;
  3443. /**
  3444. * Specifies whether or not the outer glow is ACTIVE in the layer.
  3445. */
  3446. outerGlow: boolean;
  3447. /**
  3448. * Specifies wether the highlight layer is enabled or not.
  3449. */
  3450. isEnabled: boolean;
  3451. /**
  3452. * Gets the horizontal size of the blur.
  3453. */
  3454. /**
  3455. * Specifies the horizontal size of the blur.
  3456. */
  3457. blurHorizontalSize: number;
  3458. /**
  3459. * Gets the vertical size of the blur.
  3460. */
  3461. /**
  3462. * Specifies the vertical size of the blur.
  3463. */
  3464. blurVerticalSize: number;
  3465. /**
  3466. * Gets the camera attached to the layer.
  3467. */
  3468. readonly camera: Camera;
  3469. /**
  3470. * An event triggered when the highlight layer has been disposed.
  3471. * @type {BABYLON.Observable}
  3472. */
  3473. onDisposeObservable: Observable<HighlightLayer>;
  3474. /**
  3475. * An event triggered when the highlight layer is about rendering the main texture with the glowy parts.
  3476. * @type {BABYLON.Observable}
  3477. */
  3478. onBeforeRenderMainTextureObservable: Observable<HighlightLayer>;
  3479. /**
  3480. * An event triggered when the highlight layer is being blurred.
  3481. * @type {BABYLON.Observable}
  3482. */
  3483. onBeforeBlurObservable: Observable<HighlightLayer>;
  3484. /**
  3485. * An event triggered when the highlight layer has been blurred.
  3486. * @type {BABYLON.Observable}
  3487. */
  3488. onAfterBlurObservable: Observable<HighlightLayer>;
  3489. /**
  3490. * An event triggered when the glowing blurred texture is being merged in the scene.
  3491. * @type {BABYLON.Observable}
  3492. */
  3493. onBeforeComposeObservable: Observable<HighlightLayer>;
  3494. /**
  3495. * An event triggered when the glowing blurred texture has been merged in the scene.
  3496. * @type {BABYLON.Observable}
  3497. */
  3498. onAfterComposeObservable: Observable<HighlightLayer>;
  3499. /**
  3500. * An event triggered when the highlight layer changes its size.
  3501. * @type {BABYLON.Observable}
  3502. */
  3503. onSizeChangedObservable: Observable<HighlightLayer>;
  3504. /**
  3505. * Instantiates a new highlight Layer and references it to the scene..
  3506. * @param name The name of the layer
  3507. * @param scene The scene to use the layer in
  3508. * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
  3509. */
  3510. constructor(name: string, scene: Scene, options?: IHighlightLayerOptions);
  3511. /**
  3512. * Creates the render target textures and post processes used in the highlight layer.
  3513. */
  3514. private createTextureAndPostProcesses();
  3515. /**
  3516. * Checks for the readiness of the element composing the layer.
  3517. * @param subMesh the mesh to check for
  3518. * @param useInstances specify wether or not to use instances to render the mesh
  3519. * @param emissiveTexture the associated emissive texture used to generate the glow
  3520. * @return true if ready otherwise, false
  3521. */
  3522. private isReady(subMesh, useInstances, emissiveTexture);
  3523. /**
  3524. * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
  3525. */
  3526. render(): void;
  3527. /**
  3528. * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.
  3529. * @param mesh The mesh to exclude from the highlight layer
  3530. */
  3531. addExcludedMesh(mesh: Mesh): void;
  3532. /**
  3533. * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.
  3534. * @param mesh The mesh to highlight
  3535. */
  3536. removeExcludedMesh(mesh: Mesh): void;
  3537. /**
  3538. * Add a mesh in the highlight layer in order to make it glow with the chosen color.
  3539. * @param mesh The mesh to highlight
  3540. * @param color The color of the highlight
  3541. * @param glowEmissiveOnly Extract the glow from the emissive texture
  3542. */
  3543. addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly?: boolean): void;
  3544. /**
  3545. * Remove a mesh from the highlight layer in order to make it stop glowing.
  3546. * @param mesh The mesh to highlight
  3547. */
  3548. removeMesh(mesh: Mesh): void;
  3549. /**
  3550. * Returns true if the layer contains information to display, otherwise false.
  3551. */
  3552. shouldRender(): boolean;
  3553. /**
  3554. * Sets the main texture desired size which is the closest power of two
  3555. * of the engine canvas size.
  3556. */
  3557. private setMainTextureSize();
  3558. /**
  3559. * Force the stencil to the normal expected value for none glowing parts
  3560. */
  3561. private defaultStencilReference(mesh);
  3562. /**
  3563. * Dispose only the render target textures and post process.
  3564. */
  3565. private disposeTextureAndPostProcesses();
  3566. /**
  3567. * Dispose the highlight layer and free resources.
  3568. */
  3569. dispose(): void;
  3570. }
  3571. }
  3572. declare module BABYLON {
  3573. class Layer {
  3574. name: string;
  3575. texture: Texture;
  3576. isBackground: boolean;
  3577. color: Color4;
  3578. scale: Vector2;
  3579. offset: Vector2;
  3580. alphaBlendingMode: number;
  3581. alphaTest: boolean;
  3582. layerMask: number;
  3583. /**
  3584. * An event triggered when the layer is disposed.
  3585. * @type {BABYLON.Observable}
  3586. */
  3587. onDisposeObservable: Observable<Layer>;
  3588. onDispose: () => void;
  3589. /**
  3590. * An event triggered before rendering the scene
  3591. * @type {BABYLON.Observable}
  3592. */
  3593. onBeforeRenderObservable: Observable<Layer>;
  3594. onBeforeRender: () => void;
  3595. /**
  3596. * An event triggered after rendering the scene
  3597. * @type {BABYLON.Observable}
  3598. */
  3599. onAfterRenderObservable: Observable<Layer>;
  3600. onAfterRender: () => void;
  3601. constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
  3602. render(): void;
  3603. dispose(): void;
  3604. }
  3605. }
  3606. declare module BABYLON {
  3607. class LensFlare {
  3608. size: number;
  3609. position: number;
  3610. color: Color3;
  3611. texture: Texture;
  3612. alphaMode: number;
  3613. constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
  3614. dispose: () => void;
  3615. }
  3616. }
  3617. declare module BABYLON {
  3618. class LensFlareSystem {
  3619. name: string;
  3620. lensFlares: LensFlare[];
  3621. borderLimit: number;
  3622. viewportBorder: number;
  3623. meshesSelectionPredicate: (mesh: Mesh) => boolean;
  3624. layerMask: number;
  3625. id: string;
  3626. constructor(name: string, emitter: any, scene: Scene);
  3627. isEnabled: boolean;
  3628. getScene(): Scene;
  3629. getEmitter(): any;
  3630. setEmitter(newEmitter: any): void;
  3631. getEmitterPosition(): Vector3;
  3632. computeEffectivePosition(globalViewport: Viewport): boolean;
  3633. render(): boolean;
  3634. dispose(): void;
  3635. static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
  3636. serialize(): any;
  3637. }
  3638. }
  3639. declare module BABYLON.Debug {
  3640. class AxesViewer {
  3641. scene: Scene;
  3642. scaleLines: number;
  3643. constructor(scene: Scene, scaleLines?: number);
  3644. update(position: Vector3, xaxis: Vector3, yaxis: Vector3, zaxis: Vector3): void;
  3645. dispose(): void;
  3646. }
  3647. }
  3648. declare module BABYLON.Debug {
  3649. class BoneAxesViewer extends Debug.AxesViewer {
  3650. mesh: Mesh;
  3651. bone: Bone;
  3652. pos: Vector3;
  3653. xaxis: Vector3;
  3654. yaxis: Vector3;
  3655. zaxis: Vector3;
  3656. constructor(scene: Scene, bone: Bone, mesh: Mesh, scaleLines?: number);
  3657. update(): void;
  3658. dispose(): void;
  3659. }
  3660. }
  3661. declare module BABYLON {
  3662. class DebugLayer {
  3663. static InspectorURL: string;
  3664. constructor(scene: Scene);
  3665. /** Creates the inspector window. */
  3666. isVisible(): boolean;
  3667. hide(): void;
  3668. show(config?: {
  3669. popup?: boolean;
  3670. initialTab?: number;
  3671. parentElement?: HTMLElement;
  3672. newColors?: {
  3673. backgroundColor?: string;
  3674. backgroundColorLighter?: string;
  3675. backgroundColorLighter2?: string;
  3676. backgroundColorLighter3?: string;
  3677. color?: string;
  3678. colorTop?: string;
  3679. colorBot?: string;
  3680. };
  3681. }): void;
  3682. }
  3683. }
  3684. declare module BABYLON {
  3685. class RayHelper {
  3686. ray: Ray;
  3687. static CreateAndShow(ray: Ray, scene: Scene, color: Color3): RayHelper;
  3688. constructor(ray: Ray);
  3689. show(scene: Scene, color: Color3): void;
  3690. hide(): void;
  3691. attachToMesh(mesh: AbstractMesh, meshSpaceDirection?: Vector3, meshSpaceOrigin?: Vector3, length?: number): void;
  3692. detachFromMesh(): void;
  3693. dispose(): void;
  3694. }
  3695. }
  3696. declare module BABYLON.Debug {
  3697. /**
  3698. * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
  3699. */
  3700. class SkeletonViewer {
  3701. skeleton: Skeleton;
  3702. mesh: AbstractMesh;
  3703. autoUpdateBonesMatrices: boolean;
  3704. renderingGroupId: number;
  3705. color: Color3;
  3706. constructor(skeleton: Skeleton, mesh: AbstractMesh, scene: Scene, autoUpdateBonesMatrices?: boolean, renderingGroupId?: number);
  3707. isEnabled: boolean;
  3708. update(): void;
  3709. dispose(): void;
  3710. }
  3711. }
  3712. declare module BABYLON {
  3713. class DirectionalLight extends ShadowLight {
  3714. /**
  3715. * Fix frustum size for the shadow generation. This is disabled if the value is 0.
  3716. */
  3717. /**
  3718. * Specifies a fix frustum size for the shadow generation.
  3719. */
  3720. shadowFrustumSize: number;
  3721. shadowOrthoScale: number;
  3722. autoUpdateExtends: boolean;
  3723. /**
  3724. * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).
  3725. * The directional light is emitted from everywhere in the given direction.
  3726. * It can cast shawdows.
  3727. * Documentation : http://doc.babylonjs.com/tutorials/lights
  3728. */
  3729. constructor(name: string, direction: Vector3, scene: Scene);
  3730. /**
  3731. * Returns the string "DirectionalLight".
  3732. */
  3733. getClassName(): string;
  3734. /**
  3735. * Returns the integer 1.
  3736. */
  3737. getTypeID(): number;
  3738. /**
  3739. * Sets the passed matrix "matrix" as projection matrix for the shadows cast by the light according to the passed view matrix.
  3740. * Returns the DirectionalLight Shadow projection matrix.
  3741. */
  3742. /**
  3743. * Sets the passed matrix "matrix" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.
  3744. * Returns the DirectionalLight Shadow projection matrix.
  3745. */
  3746. /**
  3747. * Sets the passed matrix "matrix" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.
  3748. * Returns the DirectionalLight Shadow projection matrix.
  3749. */
  3750. /**
  3751. * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.
  3752. * Returns the DirectionalLight.
  3753. */
  3754. transferToEffect(effect: Effect, lightIndex: string): DirectionalLight;
  3755. /**
  3756. * Gets the minZ used for shadow according to both the scene and the light.
  3757. *
  3758. * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
  3759. * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
  3760. * @param activeCamera
  3761. */
  3762. getDepthMinZ(activeCamera: Camera): number;
  3763. /**
  3764. * Gets the maxZ used for shadow according to both the scene and the light.
  3765. *
  3766. * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
  3767. * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
  3768. * @param activeCamera
  3769. */
  3770. getDepthMaxZ(activeCamera: Camera): number;
  3771. }
  3772. }
  3773. declare module BABYLON {
  3774. class HemisphericLight extends Light {
  3775. groundColor: Color3;
  3776. direction: Vector3;
  3777. /**
  3778. * Creates a HemisphericLight object in the scene according to the passed direction (Vector3).
  3779. * The HemisphericLight simulates the ambient environment light, so the passed direction is the light reflection direction, not the incoming direction.
  3780. * The HemisphericLight can't cast shadows.
  3781. * Documentation : http://doc.babylonjs.com/tutorials/lights
  3782. */
  3783. constructor(name: string, direction: Vector3, scene: Scene);
  3784. /**
  3785. * Returns the string "HemisphericLight".
  3786. */
  3787. getClassName(): string;
  3788. /**
  3789. * Sets the HemisphericLight direction towards the passed target (Vector3).
  3790. * Returns the updated direction.
  3791. */
  3792. setDirectionToTarget(target: Vector3): Vector3;
  3793. getShadowGenerator(): ShadowGenerator;
  3794. /**
  3795. * Sets the passed Effect object with the HemisphericLight normalized direction and color and the passed name (string).
  3796. * Returns the HemisphericLight.
  3797. */
  3798. transferToEffect(effect: Effect, lightIndex: string): HemisphericLight;
  3799. /**
  3800. * Returns the integer 3.
  3801. */
  3802. getTypeID(): number;
  3803. }
  3804. }
  3805. declare module BABYLON {
  3806. class Light extends Node {
  3807. /**
  3808. * If every light affecting the material is in this lightmapMode,
  3809. * material.lightmapTexture adds or multiplies
  3810. * (depends on material.useLightmapAsShadowmap)
  3811. * after every other light calculations.
  3812. */
  3813. static readonly LIGHTMAP_DEFAULT: number;
  3814. /**
  3815. * material.lightmapTexture as only diffuse lighting from this light
  3816. * adds pnly specular lighting from this light
  3817. * adds dynamic shadows
  3818. */
  3819. static readonly LIGHTMAP_SPECULAR: number;
  3820. /**
  3821. * material.lightmapTexture as only lighting
  3822. * no light calculation from this light
  3823. * only adds dynamic shadows from this light
  3824. */
  3825. static readonly LIGHTMAP_SHADOWSONLY: number;
  3826. /**
  3827. * Each light type uses the default quantity according to its type:
  3828. * point/spot lights use luminous intensity
  3829. * directional lights use illuminance
  3830. */
  3831. static readonly INTENSITYMODE_AUTOMATIC: number;
  3832. /**
  3833. * lumen (lm)
  3834. */
  3835. static readonly INTENSITYMODE_LUMINOUSPOWER: number;
  3836. /**
  3837. * candela (lm/sr)
  3838. */
  3839. static readonly INTENSITYMODE_LUMINOUSINTENSITY: number;
  3840. /**
  3841. * lux (lm/m^2)
  3842. */
  3843. static readonly INTENSITYMODE_ILLUMINANCE: number;
  3844. /**
  3845. * nit (cd/m^2)
  3846. */
  3847. static readonly INTENSITYMODE_LUMINANCE: number;
  3848. /**
  3849. * Light type const id of the point light.
  3850. */
  3851. static readonly LIGHTTYPEID_POINTLIGHT: number;
  3852. /**
  3853. * Light type const id of the directional light.
  3854. */
  3855. static readonly LIGHTTYPEID_DIRECTIONALLIGHT: number;
  3856. /**
  3857. * Light type const id of the spot light.
  3858. */
  3859. static readonly LIGHTTYPEID_SPOTLIGHT: number;
  3860. /**
  3861. * Light type const id of the hemispheric light.
  3862. */
  3863. static readonly LIGHTTYPEID_HEMISPHERICLIGHT: number;
  3864. diffuse: Color3;
  3865. specular: Color3;
  3866. intensity: number;
  3867. range: number;
  3868. /**
  3869. * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type
  3870. * of light.
  3871. */
  3872. /**
  3873. * Gets the photometric scale used to interpret the intensity.
  3874. * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.
  3875. */
  3876. /**
  3877. * Sets the photometric scale used to interpret the intensity.
  3878. * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.
  3879. */
  3880. intensityMode: number;
  3881. /**
  3882. * Gets the light radius used by PBR Materials to simulate soft area lights.
  3883. */
  3884. /**
  3885. * sets the light radius used by PBR Materials to simulate soft area lights.
  3886. */
  3887. radius: number;
  3888. /**
  3889. * Defines the rendering priority of the lights. It can help in case of fallback or number of lights
  3890. * exceeding the number allowed of the materials.
  3891. */
  3892. renderPriority: number;
  3893. /**
  3894. * Defines wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching
  3895. * the current shadow generator.
  3896. */
  3897. shadowEnabled: boolean;
  3898. includedOnlyMeshes: AbstractMesh[];
  3899. excludedMeshes: AbstractMesh[];
  3900. excludeWithLayerMask: number;
  3901. includeOnlyWithLayerMask: number;
  3902. lightmapMode: number;
  3903. /**
  3904. * Creates a Light object in the scene.
  3905. * Documentation : http://doc.babylonjs.com/tutorials/lights
  3906. */
  3907. constructor(name: string, scene: Scene);
  3908. /**
  3909. * Returns the string "Light".
  3910. */
  3911. getClassName(): string;
  3912. /**
  3913. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  3914. */
  3915. toString(fullDetails?: boolean): string;
  3916. /**
  3917. * Set the enabled state of this node.
  3918. * @param {boolean} value - the new enabled state
  3919. * @see isEnabled
  3920. */
  3921. setEnabled(value: boolean): void;
  3922. /**
  3923. * Returns the Light associated shadow generator.
  3924. */
  3925. getShadowGenerator(): IShadowGenerator;
  3926. /**
  3927. * Returns a Vector3, the absolute light position in the World.
  3928. */
  3929. getAbsolutePosition(): Vector3;
  3930. transferToEffect(effect: Effect, lightIndex: string): void;
  3931. /**
  3932. * Boolean : True if the light will affect the passed mesh.
  3933. */
  3934. canAffectMesh(mesh: AbstractMesh): boolean;
  3935. /**
  3936. * Returns the light World matrix.
  3937. */
  3938. getWorldMatrix(): Matrix;
  3939. /**
  3940. * Sort function to order lights for rendering.
  3941. * @param a First Light object to compare to second.
  3942. * @param b Second Light object to compare first.
  3943. * @return -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b.
  3944. */
  3945. static compareLightsPriority(a: Light, b: Light): number;
  3946. /**
  3947. * Disposes the light.
  3948. */
  3949. dispose(): void;
  3950. /**
  3951. * Returns the light type ID (integer).
  3952. */
  3953. getTypeID(): number;
  3954. /**
  3955. * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.
  3956. */
  3957. getScaledIntensity(): number;
  3958. /**
  3959. * Returns a new Light object, named "name", from the current one.
  3960. */
  3961. clone(name: string): Light;
  3962. /**
  3963. * Serializes the current light into a Serialization object.
  3964. * Returns the serialized object.
  3965. */
  3966. serialize(): any;
  3967. /**
  3968. * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.
  3969. * This new light is named "name" and added to the passed scene.
  3970. */
  3971. static GetConstructorFromName(type: number, name: string, scene: Scene): () => Light;
  3972. /**
  3973. * Parses the passed "parsedLight" and returns a new instanced Light from this parsing.
  3974. */
  3975. static Parse(parsedLight: any, scene: Scene): Light;
  3976. /**
  3977. * Recomputes the cached photometric scale if needed.
  3978. */
  3979. /**
  3980. * Returns the Photometric Scale according to the light type and intensity mode.
  3981. */
  3982. }
  3983. }
  3984. declare module BABYLON {
  3985. class PointLight extends ShadowLight {
  3986. /**
  3987. * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  3988. * This specifies what angle the shadow will use to be created.
  3989. *
  3990. * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.
  3991. */
  3992. /**
  3993. * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  3994. * This specifies what angle the shadow will use to be created.
  3995. *
  3996. * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.
  3997. */
  3998. shadowAngle: number;
  3999. /**
  4000. * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  4001. */
  4002. direction: Vector3;
  4003. /**
  4004. * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.
  4005. * A PointLight emits the light in every direction.
  4006. * It can cast shadows.
  4007. * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :
  4008. * ```javascript
  4009. * var pointLight = new BABYLON.PointLight("pl", camera.position, scene);
  4010. * ```
  4011. * Documentation : http://doc.babylonjs.com/tutorials/lights
  4012. */
  4013. constructor(name: string, position: Vector3, scene: Scene);
  4014. /**
  4015. * Returns the string "PointLight"
  4016. */
  4017. getClassName(): string;
  4018. /**
  4019. * Returns the integer 0.
  4020. */
  4021. getTypeID(): number;
  4022. /**
  4023. * Specifies wether or not the shadowmap should be a cube texture.
  4024. */
  4025. needCube(): boolean;
  4026. /**
  4027. * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).
  4028. */
  4029. getShadowDirection(faceIndex?: number): Vector3;
  4030. /**
  4031. * Sets the passed matrix "matrix" as a left-handed perspective projection matrix with the following settings :
  4032. * - fov = PI / 2
  4033. * - aspect ratio : 1.0
  4034. * - z-near and far equal to the active camera minZ and maxZ.
  4035. * Returns the PointLight.
  4036. */
  4037. /**
  4038. * Sets the passed Effect "effect" with the PointLight transformed position (or position, if none) and passed name (string).
  4039. * Returns the PointLight.
  4040. */
  4041. transferToEffect(effect: Effect, lightIndex: string): PointLight;
  4042. }
  4043. }
  4044. declare module BABYLON {
  4045. interface IShadowLight extends Light {
  4046. id: string;
  4047. position: Vector3;
  4048. direction: Vector3;
  4049. transformedPosition: Vector3;
  4050. transformedDirection: Vector3;
  4051. name: string;
  4052. shadowMinZ: number;
  4053. shadowMaxZ: number;
  4054. computeTransformedInformation(): boolean;
  4055. getScene(): Scene;
  4056. customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
  4057. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): IShadowLight;
  4058. getDepthScale(): number;
  4059. needCube(): boolean;
  4060. needProjectionMatrixCompute(): boolean;
  4061. forceProjectionMatrixCompute(): void;
  4062. getShadowDirection(faceIndex?: number): Vector3;
  4063. /**
  4064. * Gets the minZ used for shadow according to both the scene and the light.
  4065. * @param activeCamera
  4066. */
  4067. getDepthMinZ(activeCamera: Camera): number;
  4068. /**
  4069. * Gets the minZ used for shadow according to both the scene and the light.
  4070. * @param activeCamera
  4071. */
  4072. getDepthMaxZ(activeCamera: Camera): number;
  4073. }
  4074. abstract class ShadowLight extends Light implements IShadowLight {
  4075. protected abstract _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  4076. position: Vector3;
  4077. direction: Vector3;
  4078. shadowMinZ: number;
  4079. shadowMaxZ: number;
  4080. customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
  4081. transformedPosition: Vector3;
  4082. transformedDirection: Vector3;
  4083. /**
  4084. * Computes the light transformed position/direction in case the light is parented. Returns true if parented, else false.
  4085. */
  4086. computeTransformedInformation(): boolean;
  4087. /**
  4088. * Return the depth scale used for the shadow map.
  4089. */
  4090. getDepthScale(): number;
  4091. /**
  4092. * Returns the light direction (Vector3) for any passed face index.
  4093. */
  4094. getShadowDirection(faceIndex?: number): Vector3;
  4095. /**
  4096. * Returns the DirectionalLight absolute position in the World.
  4097. */
  4098. getAbsolutePosition(): Vector3;
  4099. /**
  4100. * Sets the DirectionalLight direction toward the passed target (Vector3).
  4101. * Returns the updated DirectionalLight direction (Vector3).
  4102. */
  4103. setDirectionToTarget(target: Vector3): Vector3;
  4104. /**
  4105. * Returns the light rotation (Vector3).
  4106. */
  4107. getRotation(): Vector3;
  4108. /**
  4109. * Boolean : false by default.
  4110. */
  4111. needCube(): boolean;
  4112. /**
  4113. * Specifies wether or not the projection matrix should be recomputed this frame.
  4114. */
  4115. needProjectionMatrixCompute(): boolean;
  4116. /**
  4117. * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.
  4118. */
  4119. forceProjectionMatrixCompute(): void;
  4120. /**
  4121. * Get the world matrix of the sahdow lights.
  4122. */
  4123. /**
  4124. * Gets the minZ used for shadow according to both the scene and the light.
  4125. * @param activeCamera
  4126. */
  4127. getDepthMinZ(activeCamera: Camera): number;
  4128. /**
  4129. * Gets the maxZ used for shadow according to both the scene and the light.
  4130. * @param activeCamera
  4131. */
  4132. getDepthMaxZ(activeCamera: Camera): number;
  4133. /**
  4134. * Sets the projection matrix according to the type of light and custom projection matrix definition.
  4135. * Returns the light.
  4136. */
  4137. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): IShadowLight;
  4138. }
  4139. }
  4140. declare module BABYLON {
  4141. class SpotLight extends ShadowLight {
  4142. angle: number;
  4143. /**
  4144. * Allows scaling the angle of the light for shadow generation only.
  4145. */
  4146. shadowAngleScale: number;
  4147. exponent: number;
  4148. /**
  4149. * Creates a SpotLight object in the scene with the passed parameters :
  4150. * - `position` (Vector3) is the initial SpotLight position,
  4151. * - `direction` (Vector3) is the initial SpotLight direction,
  4152. * - `angle` (float, in radians) is the spot light cone angle,
  4153. * - `exponent` (float) is the light decay speed with the distance from the emission spot.
  4154. * A spot light is a simply light oriented cone.
  4155. * It can cast shadows.
  4156. * Documentation : http://doc.babylonjs.com/tutorials/lights
  4157. */
  4158. constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
  4159. /**
  4160. * Returns the string "SpotLight".
  4161. */
  4162. getClassName(): string;
  4163. /**
  4164. * Returns the integer 2.
  4165. */
  4166. getTypeID(): number;
  4167. /**
  4168. * 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.
  4169. * Returns the SpotLight.
  4170. */
  4171. /**
  4172. * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.
  4173. * Return the SpotLight.
  4174. */
  4175. transferToEffect(effect: Effect, lightIndex: string): SpotLight;
  4176. }
  4177. }
  4178. declare module BABYLON {
  4179. interface ISceneLoaderPluginExtensions {
  4180. [extension: string]: {
  4181. isBinary: boolean;
  4182. };
  4183. }
  4184. interface ISceneLoaderPlugin {
  4185. extensions: string | ISceneLoaderPluginExtensions;
  4186. importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean;
  4187. load: (scene: Scene, data: string, rootUrl: string) => boolean;
  4188. canDirectLoad?: (data: string) => boolean;
  4189. }
  4190. interface ISceneLoaderPluginAsync {
  4191. extensions: string | ISceneLoaderPluginExtensions;
  4192. importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onsuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onerror: () => void) => void;
  4193. loadAsync: (scene: Scene, data: string, rootUrl: string, onsuccess: () => void, onerror: () => void) => void;
  4194. canDirectLoad?: (data: string) => boolean;
  4195. }
  4196. class SceneLoader {
  4197. static readonly NO_LOGGING: number;
  4198. static readonly MINIMAL_LOGGING: number;
  4199. static readonly SUMMARY_LOGGING: number;
  4200. static readonly DETAILED_LOGGING: number;
  4201. static ForceFullSceneLoadingForIncremental: boolean;
  4202. static ShowLoadingScreen: boolean;
  4203. static loggingLevel: number;
  4204. static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  4205. static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
  4206. static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, message: string, exception?: any) => void): void;
  4207. /**
  4208. * Load a scene
  4209. * @param rootUrl a string that defines the root url for scene and resources
  4210. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  4211. * @param engine is the instance of BABYLON.Engine to use to create the scene
  4212. */
  4213. static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  4214. /**
  4215. * Append a scene
  4216. * @param rootUrl a string that defines the root url for scene and resources
  4217. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  4218. * @param scene is the instance of BABYLON.Scene to append to
  4219. */
  4220. static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  4221. }
  4222. }
  4223. declare module BABYLON {
  4224. /**
  4225. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  4226. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  4227. * 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;
  4228. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  4229. */
  4230. class ColorCurves {
  4231. /**
  4232. * Gets the global Hue value.
  4233. * 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).
  4234. */
  4235. /**
  4236. * Sets the global Hue value.
  4237. * 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).
  4238. */
  4239. globalHue: number;
  4240. /**
  4241. * Gets the global Density value.
  4242. * 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.
  4243. * Values less than zero provide a filter of opposite hue.
  4244. */
  4245. /**
  4246. * Sets the global Density value.
  4247. * 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.
  4248. * Values less than zero provide a filter of opposite hue.
  4249. */
  4250. globalDensity: number;
  4251. /**
  4252. * Gets the global Saturation value.
  4253. * 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.
  4254. */
  4255. /**
  4256. * Sets the global Saturation value.
  4257. * 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.
  4258. */
  4259. globalSaturation: number;
  4260. /**
  4261. * Gets the highlights Hue value.
  4262. * 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).
  4263. */
  4264. /**
  4265. * Sets the highlights Hue value.
  4266. * 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).
  4267. */
  4268. highlightsHue: number;
  4269. /**
  4270. * Gets the highlights Density value.
  4271. * 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.
  4272. * Values less than zero provide a filter of opposite hue.
  4273. */
  4274. /**
  4275. * Sets the highlights Density value.
  4276. * 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.
  4277. * Values less than zero provide a filter of opposite hue.
  4278. */
  4279. highlightsDensity: number;
  4280. /**
  4281. * Gets the highlights Saturation value.
  4282. * 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.
  4283. */
  4284. /**
  4285. * Sets the highlights Saturation value.
  4286. * 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.
  4287. */
  4288. highlightsSaturation: number;
  4289. /**
  4290. * Gets the highlights Exposure value.
  4291. * 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.
  4292. */
  4293. /**
  4294. * Sets the highlights Exposure value.
  4295. * 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.
  4296. */
  4297. highlightsExposure: number;
  4298. /**
  4299. * Gets the midtones Hue value.
  4300. * 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).
  4301. */
  4302. /**
  4303. * Sets the midtones Hue value.
  4304. * 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).
  4305. */
  4306. midtonesHue: number;
  4307. /**
  4308. * Gets the midtones Density value.
  4309. * 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.
  4310. * Values less than zero provide a filter of opposite hue.
  4311. */
  4312. /**
  4313. * Sets the midtones Density value.
  4314. * 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.
  4315. * Values less than zero provide a filter of opposite hue.
  4316. */
  4317. midtonesDensity: number;
  4318. /**
  4319. * Gets the midtones Saturation value.
  4320. * 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.
  4321. */
  4322. /**
  4323. * Sets the midtones Saturation value.
  4324. * 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.
  4325. */
  4326. midtonesSaturation: number;
  4327. /**
  4328. * Gets the midtones Exposure value.
  4329. * 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.
  4330. */
  4331. /**
  4332. * Sets the midtones Exposure value.
  4333. * 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.
  4334. */
  4335. midtonesExposure: number;
  4336. /**
  4337. * Gets the shadows Hue value.
  4338. * 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).
  4339. */
  4340. /**
  4341. * Sets the shadows Hue value.
  4342. * 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).
  4343. */
  4344. shadowsHue: number;
  4345. /**
  4346. * Gets the shadows Density value.
  4347. * 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.
  4348. * Values less than zero provide a filter of opposite hue.
  4349. */
  4350. /**
  4351. * Sets the shadows Density value.
  4352. * 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.
  4353. * Values less than zero provide a filter of opposite hue.
  4354. */
  4355. shadowsDensity: number;
  4356. /**
  4357. * Gets the shadows Saturation value.
  4358. * 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.
  4359. */
  4360. /**
  4361. * Sets the shadows Saturation value.
  4362. * 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.
  4363. */
  4364. shadowsSaturation: number;
  4365. /**
  4366. * Gets the shadows Exposure value.
  4367. * 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.
  4368. */
  4369. /**
  4370. * Sets the shadows Exposure value.
  4371. * 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.
  4372. */
  4373. shadowsExposure: number;
  4374. /**
  4375. * Binds the color curves to the shader.
  4376. * @param colorCurves The color curve to bind
  4377. * @param effect The effect to bind to
  4378. */
  4379. static Bind(colorCurves: ColorCurves, effect: Effect, positiveUniform?: string, neutralUniform?: string, negativeUniform?: string): void;
  4380. /**
  4381. * Prepare the list of uniforms associated with the ColorCurves effects.
  4382. * @param uniformsList The list of uniforms used in the effect
  4383. */
  4384. static PrepareUniforms(uniformsList: string[]): void;
  4385. /**
  4386. * Returns color grading data based on a hue, density, saturation and exposure value.
  4387. * @param filterHue The hue of the color filter.
  4388. * @param filterDensity The density of the color filter.
  4389. * @param saturation The saturation.
  4390. * @param exposure The exposure.
  4391. * @param result The result data container.
  4392. */
  4393. private getColorGradingDataToRef(hue, density, saturation, exposure, result);
  4394. /**
  4395. * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
  4396. * @param value The input slider value in range [-100,100].
  4397. * @returns Adjusted value.
  4398. */
  4399. private static applyColorGradingSliderNonlinear(value);
  4400. /**
  4401. * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
  4402. * @param hue The hue (H) input.
  4403. * @param saturation The saturation (S) input.
  4404. * @param brightness The brightness (B) input.
  4405. * @result An RGBA color represented as Vector4.
  4406. */
  4407. private static fromHSBToRef(hue, saturation, brightness, result);
  4408. /**
  4409. * Returns a value clamped between min and max
  4410. * @param value The value to clamp
  4411. * @param min The minimum of value
  4412. * @param max The maximum of value
  4413. * @returns The clamped value.
  4414. */
  4415. private static clamp(value, min, max);
  4416. /**
  4417. * Clones the current color curve instance.
  4418. * @return The cloned curves
  4419. */
  4420. clone(): ColorCurves;
  4421. /**
  4422. * Serializes the current color curve instance to a json representation.
  4423. * @return a JSON representation
  4424. */
  4425. serialize(): any;
  4426. /**
  4427. * Parses the color curve from a json representation.
  4428. * @param source the JSON source to parse
  4429. * @return The parsed curves
  4430. */
  4431. static Parse(source: any): ColorCurves;
  4432. }
  4433. }
  4434. declare module BABYLON {
  4435. class EffectFallbacks {
  4436. addFallback(rank: number, define: string): void;
  4437. addCPUSkinningFallback(rank: number, mesh: BABYLON.AbstractMesh): void;
  4438. readonly isMoreFallbacks: boolean;
  4439. reduce(currentDefines: string): string;
  4440. }
  4441. class EffectCreationOptions {
  4442. attributes: string[];
  4443. uniformsNames: string[];
  4444. uniformBuffersNames: string[];
  4445. samplers: string[];
  4446. defines: any;
  4447. fallbacks: EffectFallbacks;
  4448. onCompiled: (effect: Effect) => void;
  4449. onError: (effect: Effect, errors: string) => void;
  4450. indexParameters: any;
  4451. maxSimultaneousLights: number;
  4452. }
  4453. class Effect {
  4454. name: any;
  4455. defines: string;
  4456. onCompiled: (effect: Effect) => void;
  4457. onError: (effect: Effect, errors: string) => void;
  4458. onBind: (effect: Effect) => void;
  4459. uniqueId: number;
  4460. onCompileObservable: Observable<Effect>;
  4461. onErrorObservable: Observable<Effect>;
  4462. onBindObservable: Observable<Effect>;
  4463. constructor(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], engine?: Engine, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any);
  4464. readonly key: string;
  4465. isReady(): boolean;
  4466. getProgram(): WebGLProgram;
  4467. getAttributesNames(): string[];
  4468. getAttributeLocation(index: number): number;
  4469. getAttributeLocationByName(name: string): number;
  4470. getAttributesCount(): number;
  4471. getUniformIndex(uniformName: string): number;
  4472. getUniform(uniformName: string): WebGLUniformLocation;
  4473. getSamplers(): string[];
  4474. getCompilationError(): string;
  4475. getVertexShaderSource(): string;
  4476. getFragmentShaderSource(): string;
  4477. executeWhenCompiled(func: (effect: Effect) => void): void;
  4478. readonly isSupported: boolean;
  4479. setTexture(channel: string, texture: BaseTexture): void;
  4480. setTextureArray(channel: string, textures: BaseTexture[]): void;
  4481. setTextureFromPostProcess(channel: string, postProcess: PostProcess): void;
  4482. bindUniformBuffer(buffer: WebGLBuffer, name: string): void;
  4483. bindUniformBlock(blockName: string, index: number): void;
  4484. setIntArray(uniformName: string, array: Int32Array): Effect;
  4485. setIntArray2(uniformName: string, array: Int32Array): Effect;
  4486. setIntArray3(uniformName: string, array: Int32Array): Effect;
  4487. setIntArray4(uniformName: string, array: Int32Array): Effect;
  4488. setFloatArray(uniformName: string, array: Float32Array): Effect;
  4489. setFloatArray2(uniformName: string, array: Float32Array): Effect;
  4490. setFloatArray3(uniformName: string, array: Float32Array): Effect;
  4491. setFloatArray4(uniformName: string, array: Float32Array): Effect;
  4492. setArray(uniformName: string, array: number[]): Effect;
  4493. setArray2(uniformName: string, array: number[]): Effect;
  4494. setArray3(uniformName: string, array: number[]): Effect;
  4495. setArray4(uniformName: string, array: number[]): Effect;
  4496. setMatrices(uniformName: string, matrices: Float32Array): Effect;
  4497. setMatrix(uniformName: string, matrix: Matrix): Effect;
  4498. setMatrix3x3(uniformName: string, matrix: Float32Array): Effect;
  4499. setMatrix2x2(uniformName: string, matrix: Float32Array): Effect;
  4500. setFloat(uniformName: string, value: number): Effect;
  4501. setBool(uniformName: string, bool: boolean): Effect;
  4502. setVector2(uniformName: string, vector2: Vector2): Effect;
  4503. setFloat2(uniformName: string, x: number, y: number): Effect;
  4504. setVector3(uniformName: string, vector3: Vector3): Effect;
  4505. setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
  4506. setVector4(uniformName: string, vector4: Vector4): Effect;
  4507. setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
  4508. setColor3(uniformName: string, color3: Color3): Effect;
  4509. setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
  4510. static ShadersStore: {};
  4511. static IncludesShadersStore: {};
  4512. }
  4513. }
  4514. declare module BABYLON {
  4515. class FresnelParameters {
  4516. isEnabled: boolean;
  4517. leftColor: Color3;
  4518. rightColor: Color3;
  4519. bias: number;
  4520. power: number;
  4521. clone(): FresnelParameters;
  4522. serialize(): any;
  4523. static Parse(parsedFresnelParameters: any): FresnelParameters;
  4524. }
  4525. }
  4526. declare module BABYLON {
  4527. class MaterialDefines {
  4528. readonly isDirty: boolean;
  4529. markAsProcessed(): void;
  4530. markAsUnprocessed(): void;
  4531. markAllAsDirty(): void;
  4532. markAsLightDirty(): void;
  4533. markAsAttributesDirty(): void;
  4534. markAsTexturesDirty(): void;
  4535. markAsFresnelDirty(): void;
  4536. markAsMiscDirty(): void;
  4537. rebuild(): void;
  4538. isEqual(other: MaterialDefines): boolean;
  4539. cloneTo(other: MaterialDefines): void;
  4540. reset(): void;
  4541. toString(): string;
  4542. }
  4543. class Material {
  4544. static readonly TriangleFillMode: number;
  4545. static readonly WireFrameFillMode: number;
  4546. static readonly PointFillMode: number;
  4547. static readonly ClockWiseSideOrientation: number;
  4548. static readonly CounterClockWiseSideOrientation: number;
  4549. static readonly TextureDirtyFlag: number;
  4550. static readonly LightDirtyFlag: number;
  4551. static readonly FresnelDirtyFlag: number;
  4552. static readonly AttributesDirtyFlag: number;
  4553. static readonly MiscDirtyFlag: number;
  4554. id: string;
  4555. name: string;
  4556. checkReadyOnEveryCall: boolean;
  4557. checkReadyOnlyOnce: boolean;
  4558. state: string;
  4559. alpha: number;
  4560. backFaceCulling: boolean;
  4561. sideOrientation: number;
  4562. onCompiled: (effect: Effect) => void;
  4563. onError: (effect: Effect, errors: string) => void;
  4564. getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
  4565. doNotSerialize: boolean;
  4566. storeEffectOnSubMeshes: boolean;
  4567. /**
  4568. * An event triggered when the material is disposed.
  4569. * @type {BABYLON.Observable}
  4570. */
  4571. onDisposeObservable: Observable<Material>;
  4572. onDispose: () => void;
  4573. /**
  4574. * An event triggered when the material is bound.
  4575. * @type {BABYLON.Observable}
  4576. */
  4577. onBindObservable: Observable<AbstractMesh>;
  4578. onBind: (Mesh: AbstractMesh) => void;
  4579. /**
  4580. * An event triggered when the material is unbound.
  4581. * @type {BABYLON.Observable}
  4582. */
  4583. onUnBindObservable: Observable<Material>;
  4584. alphaMode: number;
  4585. disableDepthWrite: boolean;
  4586. fogEnabled: boolean;
  4587. pointSize: number;
  4588. zOffset: number;
  4589. wireframe: boolean;
  4590. pointsCloud: boolean;
  4591. fillMode: number;
  4592. constructor(name: string, scene: Scene, doNotAdd?: boolean);
  4593. /**
  4594. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  4595. * subclasses should override adding information pertainent to themselves
  4596. */
  4597. toString(fullDetails?: boolean): string;
  4598. /**
  4599. * Child classes can use it to update shaders
  4600. */
  4601. markAsDirty(flag: number): void;
  4602. getClassName(): string;
  4603. readonly isFrozen: boolean;
  4604. freeze(): void;
  4605. unfreeze(): void;
  4606. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4607. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  4608. getEffect(): Effect;
  4609. getScene(): Scene;
  4610. needAlphaBlending(): boolean;
  4611. needAlphaTesting(): boolean;
  4612. getAlphaTestTexture(): BaseTexture;
  4613. markDirty(): void;
  4614. bind(world: Matrix, mesh?: Mesh): void;
  4615. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  4616. bindOnlyWorldMatrix(world: Matrix): void;
  4617. bindSceneUniformBuffer(effect: Effect, sceneUbo: UniformBuffer): void;
  4618. bindView(effect: Effect): void;
  4619. bindViewProjection(effect: Effect): void;
  4620. unbind(): void;
  4621. clone(name: string): Material;
  4622. getBindedMeshes(): AbstractMesh[];
  4623. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4624. serialize(): any;
  4625. static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial;
  4626. static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): any;
  4627. }
  4628. }
  4629. declare module BABYLON {
  4630. class MaterialHelper {
  4631. static PrepareDefinesForMisc(mesh: AbstractMesh, scene: Scene, useLogarithmicDepth: boolean, pointsCloud: any, fogEnabled: boolean, defines: MaterialDefines): void;
  4632. static PrepareDefinesForFrameBoundValues(scene: Scene, engine: Engine, defines: MaterialDefines, useInstances: boolean, forceAlphaTest?: boolean): void;
  4633. static PrepareDefinesForAttributes(mesh: AbstractMesh, defines: MaterialDefines, useVertexColor: boolean, useBones: boolean, useMorphTargets?: boolean): boolean;
  4634. static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: MaterialDefines, specularSupported: boolean, maxSimultaneousLights?: number, disableLighting?: boolean): boolean;
  4635. static PrepareUniformsAndSamplersList(uniformsListOrOptions: string[] | EffectCreationOptions, samplersList?: string[], defines?: MaterialDefines, maxSimultaneousLights?: number): void;
  4636. static HandleFallbacksForShadows(defines: MaterialDefines, fallbacks: EffectFallbacks, maxSimultaneousLights?: number): void;
  4637. static PrepareAttributesForMorphTargets(attribs: string[], mesh: AbstractMesh, defines: MaterialDefines): void;
  4638. static PrepareAttributesForBones(attribs: string[], mesh: AbstractMesh, defines: MaterialDefines, fallbacks: EffectFallbacks): void;
  4639. static PrepareAttributesForInstances(attribs: string[], defines: MaterialDefines): void;
  4640. static BindLightShadow(light: Light, scene: Scene, mesh: AbstractMesh, lightIndex: string, effect: Effect): void;
  4641. static BindLightProperties(light: Light, effect: Effect, lightIndex: number): void;
  4642. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, maxSimultaneousLights?: number): void;
  4643. static BindFogParameters(scene: Scene, mesh: AbstractMesh, effect: Effect): void;
  4644. static BindBonesParameters(mesh: AbstractMesh, effect: Effect): void;
  4645. static BindMorphTargetParameters(abstractMesh: AbstractMesh, effect: Effect): void;
  4646. static BindLogDepth(defines: MaterialDefines, effect: Effect, scene: Scene): void;
  4647. static BindClipPlane(effect: Effect, scene: Scene): void;
  4648. }
  4649. }
  4650. declare module BABYLON {
  4651. class MultiMaterial extends Material {
  4652. subMaterials: Material[];
  4653. constructor(name: string, scene: Scene);
  4654. getSubMaterial(index: any): Material;
  4655. getClassName(): string;
  4656. isReady(mesh?: AbstractMesh): boolean;
  4657. clone(name: string, cloneChildren?: boolean): MultiMaterial;
  4658. serialize(): any;
  4659. }
  4660. }
  4661. declare module BABYLON {
  4662. class PushMaterial extends Material {
  4663. constructor(name: string, scene: Scene);
  4664. getEffect(): Effect;
  4665. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4666. bindOnlyWorldMatrix(world: Matrix): void;
  4667. bind(world: Matrix, mesh?: Mesh): void;
  4668. markAsDirty(flag: number): void;
  4669. }
  4670. }
  4671. declare module BABYLON {
  4672. class ShaderMaterial extends Material {
  4673. constructor(name: string, scene: Scene, shaderPath: any, options: any);
  4674. getClassName(): string;
  4675. needAlphaBlending(): boolean;
  4676. needAlphaTesting(): boolean;
  4677. setTexture(name: string, texture: Texture): ShaderMaterial;
  4678. setTextureArray(name: string, textures: Texture[]): ShaderMaterial;
  4679. setFloat(name: string, value: number): ShaderMaterial;
  4680. setFloats(name: string, value: number[]): ShaderMaterial;
  4681. setColor3(name: string, value: Color3): ShaderMaterial;
  4682. setColor4(name: string, value: Color4): ShaderMaterial;
  4683. setVector2(name: string, value: Vector2): ShaderMaterial;
  4684. setVector3(name: string, value: Vector3): ShaderMaterial;
  4685. setVector4(name: string, value: Vector4): ShaderMaterial;
  4686. setMatrix(name: string, value: Matrix): ShaderMaterial;
  4687. setMatrix3x3(name: string, value: Float32Array): ShaderMaterial;
  4688. setMatrix2x2(name: string, value: Float32Array): ShaderMaterial;
  4689. setArray3(name: string, value: number[]): ShaderMaterial;
  4690. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4691. bindOnlyWorldMatrix(world: Matrix): void;
  4692. bind(world: Matrix, mesh?: Mesh): void;
  4693. clone(name: string): ShaderMaterial;
  4694. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4695. serialize(): any;
  4696. static Parse(source: any, scene: Scene, rootUrl: string): ShaderMaterial;
  4697. }
  4698. }
  4699. declare module BABYLON {
  4700. class StandardMaterialDefines extends MaterialDefines {
  4701. DIFFUSE: boolean;
  4702. AMBIENT: boolean;
  4703. OPACITY: boolean;
  4704. OPACITYRGB: boolean;
  4705. REFLECTION: boolean;
  4706. EMISSIVE: boolean;
  4707. SPECULAR: boolean;
  4708. BUMP: boolean;
  4709. PARALLAX: boolean;
  4710. PARALLAXOCCLUSION: boolean;
  4711. SPECULAROVERALPHA: boolean;
  4712. CLIPPLANE: boolean;
  4713. ALPHATEST: boolean;
  4714. ALPHAFROMDIFFUSE: boolean;
  4715. POINTSIZE: boolean;
  4716. FOG: boolean;
  4717. SPECULARTERM: boolean;
  4718. DIFFUSEFRESNEL: boolean;
  4719. OPACITYFRESNEL: boolean;
  4720. REFLECTIONFRESNEL: boolean;
  4721. REFRACTIONFRESNEL: boolean;
  4722. EMISSIVEFRESNEL: boolean;
  4723. FRESNEL: boolean;
  4724. NORMAL: boolean;
  4725. UV1: boolean;
  4726. UV2: boolean;
  4727. VERTEXCOLOR: boolean;
  4728. VERTEXALPHA: boolean;
  4729. NUM_BONE_INFLUENCERS: number;
  4730. BonesPerMesh: number;
  4731. INSTANCES: boolean;
  4732. GLOSSINESS: boolean;
  4733. ROUGHNESS: boolean;
  4734. EMISSIVEASILLUMINATION: boolean;
  4735. LINKEMISSIVEWITHDIFFUSE: boolean;
  4736. REFLECTIONFRESNELFROMSPECULAR: boolean;
  4737. LIGHTMAP: boolean;
  4738. USELIGHTMAPASSHADOWMAP: boolean;
  4739. REFLECTIONMAP_3D: boolean;
  4740. REFLECTIONMAP_SPHERICAL: boolean;
  4741. REFLECTIONMAP_PLANAR: boolean;
  4742. REFLECTIONMAP_CUBIC: boolean;
  4743. REFLECTIONMAP_PROJECTION: boolean;
  4744. REFLECTIONMAP_SKYBOX: boolean;
  4745. REFLECTIONMAP_EXPLICIT: boolean;
  4746. REFLECTIONMAP_EQUIRECTANGULAR: boolean;
  4747. REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
  4748. REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
  4749. INVERTCUBICMAP: boolean;
  4750. LOGARITHMICDEPTH: boolean;
  4751. REFRACTION: boolean;
  4752. REFRACTIONMAP_3D: boolean;
  4753. REFLECTIONOVERALPHA: boolean;
  4754. INVERTNORMALMAPX: boolean;
  4755. INVERTNORMALMAPY: boolean;
  4756. TWOSIDEDLIGHTING: boolean;
  4757. SHADOWFLOAT: boolean;
  4758. CAMERACOLORGRADING: boolean;
  4759. CAMERACOLORCURVES: boolean;
  4760. MORPHTARGETS: boolean;
  4761. MORPHTARGETS_NORMAL: boolean;
  4762. MORPHTARGETS_TANGENT: boolean;
  4763. NUM_MORPH_INFLUENCERS: number;
  4764. USERIGHTHANDEDSYSTEM: boolean;
  4765. constructor();
  4766. setReflectionMode(modeToEnable: string): void;
  4767. }
  4768. class StandardMaterial extends PushMaterial {
  4769. diffuseTexture: BaseTexture;
  4770. ambientTexture: BaseTexture;
  4771. opacityTexture: BaseTexture;
  4772. reflectionTexture: BaseTexture;
  4773. emissiveTexture: BaseTexture;
  4774. specularTexture: BaseTexture;
  4775. bumpTexture: BaseTexture;
  4776. lightmapTexture: BaseTexture;
  4777. refractionTexture: BaseTexture;
  4778. ambientColor: Color3;
  4779. diffuseColor: Color3;
  4780. specularColor: Color3;
  4781. emissiveColor: Color3;
  4782. specularPower: number;
  4783. useAlphaFromDiffuseTexture: boolean;
  4784. useEmissiveAsIllumination: boolean;
  4785. linkEmissiveWithDiffuse: boolean;
  4786. useSpecularOverAlpha: boolean;
  4787. useReflectionOverAlpha: boolean;
  4788. disableLighting: boolean;
  4789. useParallax: boolean;
  4790. useParallaxOcclusion: boolean;
  4791. parallaxScaleBias: number;
  4792. roughness: number;
  4793. indexOfRefraction: number;
  4794. invertRefractionY: boolean;
  4795. useLightmapAsShadowmap: boolean;
  4796. diffuseFresnelParameters: FresnelParameters;
  4797. opacityFresnelParameters: FresnelParameters;
  4798. reflectionFresnelParameters: FresnelParameters;
  4799. refractionFresnelParameters: FresnelParameters;
  4800. emissiveFresnelParameters: FresnelParameters;
  4801. useReflectionFresnelFromSpecular: boolean;
  4802. useGlossinessFromSpecularMapAlpha: boolean;
  4803. maxSimultaneousLights: number;
  4804. /**
  4805. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  4806. */
  4807. invertNormalMapX: boolean;
  4808. /**
  4809. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  4810. */
  4811. invertNormalMapY: boolean;
  4812. /**
  4813. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  4814. */
  4815. twoSidedLighting: boolean;
  4816. /**
  4817. * Color Grading 2D Lookup Texture.
  4818. * This allows special effects like sepia, black and white to sixties rendering style.
  4819. */
  4820. cameraColorGradingTexture: BaseTexture;
  4821. /**
  4822. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  4823. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  4824. * 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;
  4825. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  4826. */
  4827. cameraColorCurves: ColorCurves;
  4828. customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines) => string;
  4829. constructor(name: string, scene: Scene);
  4830. getClassName(): string;
  4831. useLogarithmicDepth: boolean;
  4832. needAlphaBlending(): boolean;
  4833. needAlphaTesting(): boolean;
  4834. getAlphaTestTexture(): BaseTexture;
  4835. /**
  4836. * Child classes can use it to update shaders
  4837. */
  4838. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  4839. buildUniformLayout(): void;
  4840. unbind(): void;
  4841. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  4842. getAnimatables(): IAnimatable[];
  4843. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4844. clone(name: string): StandardMaterial;
  4845. serialize(): any;
  4846. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial;
  4847. static DiffuseTextureEnabled: boolean;
  4848. static AmbientTextureEnabled: boolean;
  4849. static OpacityTextureEnabled: boolean;
  4850. static ReflectionTextureEnabled: boolean;
  4851. static EmissiveTextureEnabled: boolean;
  4852. static SpecularTextureEnabled: boolean;
  4853. static BumpTextureEnabled: boolean;
  4854. static LightmapTextureEnabled: boolean;
  4855. static RefractionTextureEnabled: boolean;
  4856. static ColorGradingTextureEnabled: boolean;
  4857. static FresnelEnabled: boolean;
  4858. }
  4859. }
  4860. declare module BABYLON {
  4861. class UniformBuffer {
  4862. /**
  4863. * Wrapper for updateUniform.
  4864. * @method updateMatrix3x3
  4865. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4866. * @param {Float32Array} matrix
  4867. */
  4868. updateMatrix3x3: (name: string, matrix: Float32Array) => void;
  4869. /**
  4870. * Wrapper for updateUniform.
  4871. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4872. * @param {Float32Array} matrix
  4873. */
  4874. updateMatrix2x2: (name: string, matrix: Float32Array) => void;
  4875. /**
  4876. * Wrapper for updateUniform.
  4877. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4878. * @param {number} x
  4879. */
  4880. updateFloat: (name: string, x: number) => void;
  4881. /**
  4882. * Wrapper for updateUniform.
  4883. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4884. * @param {number} x
  4885. * @param {number} y
  4886. * @param {string} [suffix] Suffix to add to the uniform name.
  4887. */
  4888. updateFloat2: (name: string, x: number, y: number, suffix?: string) => void;
  4889. /**
  4890. * Wrapper for updateUniform.
  4891. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4892. * @param {number} x
  4893. * @param {number} y
  4894. * @param {number} z
  4895. * @param {string} [suffix] Suffix to add to the uniform name.
  4896. */
  4897. updateFloat3: (name: string, x: number, y: number, z: number, suffix?: string) => void;
  4898. /**
  4899. * Wrapper for updateUniform.
  4900. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4901. * @param {number} x
  4902. * @param {number} y
  4903. * @param {number} z
  4904. * @param {number} w
  4905. * @param {string} [suffix] Suffix to add to the uniform name.
  4906. */
  4907. updateFloat4: (name: string, x: number, y: number, z: number, w: number, suffix?: string) => void;
  4908. /**
  4909. * Wrapper for updateUniform.
  4910. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4911. * @param {Matrix} A 4x4 matrix.
  4912. */
  4913. updateMatrix: (name: string, mat: Matrix) => void;
  4914. /**
  4915. * Wrapper for updateUniform.
  4916. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4917. * @param {Vector3} vector
  4918. */
  4919. updateVector3: (name: string, vector: Vector3) => void;
  4920. /**
  4921. * Wrapper for updateUniform.
  4922. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4923. * @param {Vector4} vector
  4924. */
  4925. updateVector4: (name: string, vector: Vector4) => void;
  4926. /**
  4927. * Wrapper for updateUniform.
  4928. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4929. * @param {Color3} color
  4930. * @param {string} [suffix] Suffix to add to the uniform name.
  4931. */
  4932. updateColor3: (name: string, color: Color3, suffix?: string) => void;
  4933. /**
  4934. * Wrapper for updateUniform.
  4935. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4936. * @param {Color3} color
  4937. * @param {number} alpha
  4938. * @param {string} [suffix] Suffix to add to the uniform name.
  4939. */
  4940. updateColor4: (name: string, color: Color3, alpha: number, suffix?: string) => void;
  4941. /**
  4942. * Uniform buffer objects.
  4943. *
  4944. * Handles blocks of uniform on the GPU.
  4945. *
  4946. * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.
  4947. *
  4948. * For more information, please refer to :
  4949. * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object
  4950. */
  4951. constructor(engine: Engine, data?: number[], dynamic?: boolean);
  4952. /**
  4953. * Indicates if the buffer is using the WebGL2 UBO implementation,
  4954. * or just falling back on setUniformXXX calls.
  4955. */
  4956. readonly useUbo: boolean;
  4957. /**
  4958. * Indicates if the WebGL underlying uniform buffer is in sync
  4959. * with the javascript cache data.
  4960. */
  4961. readonly isSync: boolean;
  4962. /**
  4963. * Indicates if the WebGL underlying uniform buffer is dynamic.
  4964. * Also, a dynamic UniformBuffer will disable cache verification and always
  4965. * update the underlying WebGL uniform buffer to the GPU.
  4966. */
  4967. isDynamic(): boolean;
  4968. /**
  4969. * The data cache on JS side.
  4970. */
  4971. getData(): Float32Array;
  4972. /**
  4973. * The underlying WebGL Uniform buffer.
  4974. */
  4975. getBuffer(): WebGLBuffer;
  4976. /**
  4977. * std140 layout specifies how to align data within an UBO structure.
  4978. * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159
  4979. * for specs.
  4980. */
  4981. /**
  4982. * Adds an uniform in the buffer.
  4983. * Warning : the subsequents calls of this function must be in the same order as declared in the shader
  4984. * for the layout to be correct !
  4985. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4986. * @param {number|number[]} size Data size, or data directly.
  4987. */
  4988. addUniform(name: string, size: number | number[]): void;
  4989. /**
  4990. * Wrapper for addUniform.
  4991. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4992. * @param {Matrix} mat A 4x4 matrix.
  4993. */
  4994. addMatrix(name: string, mat: Matrix): void;
  4995. /**
  4996. * Wrapper for addUniform.
  4997. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  4998. * @param {number} x
  4999. * @param {number} y
  5000. */
  5001. addFloat2(name: string, x: number, y: number): void;
  5002. /**
  5003. * Wrapper for addUniform.
  5004. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  5005. * @param {number} x
  5006. * @param {number} y
  5007. * @param {number} z
  5008. */
  5009. addFloat3(name: string, x: number, y: number, z: number): void;
  5010. /**
  5011. * Wrapper for addUniform.
  5012. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  5013. * @param {Color3} color
  5014. */
  5015. addColor3(name: string, color: Color3): void;
  5016. /**
  5017. * Wrapper for addUniform.
  5018. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  5019. * @param {Color3} color
  5020. * @param {number} alpha
  5021. */
  5022. addColor4(name: string, color: Color3, alpha: number): void;
  5023. /**
  5024. * Wrapper for addUniform.
  5025. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  5026. * @param {Vector3} vector
  5027. */
  5028. addVector3(name: string, vector: Vector3): void;
  5029. /**
  5030. * Wrapper for addUniform.
  5031. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  5032. */
  5033. addMatrix3x3(name: string): void;
  5034. /**
  5035. * Wrapper for addUniform.
  5036. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  5037. */
  5038. addMatrix2x2(name: string): void;
  5039. /**
  5040. * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.
  5041. */
  5042. create(): void;
  5043. /**
  5044. * Updates the WebGL Uniform Buffer on the GPU.
  5045. * If the `dynamic` flag is set to true, no cache comparison is done.
  5046. * Otherwise, the buffer will be updated only if the cache differs.
  5047. */
  5048. update(): void;
  5049. /**
  5050. * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.
  5051. * @param {string} uniformName Name of the uniform, as used in the uniform block in the shader.
  5052. * @param {number[]|Float32Array} data Flattened data
  5053. * @param {number} size Size of the data.
  5054. */
  5055. updateUniform(uniformName: string, data: number[] | Float32Array, size: number): void;
  5056. /**
  5057. * Sets a sampler uniform on the effect.
  5058. * @param {string} name Name of the sampler.
  5059. * @param {Texture} texture
  5060. */
  5061. setTexture(name: string, texture: BaseTexture): void;
  5062. /**
  5063. * Directly updates the value of the uniform in the cache AND on the GPU.
  5064. * @param {string} uniformName Name of the uniform, as used in the uniform block in the shader.
  5065. * @param {number[]|Float32Array} data Flattened data
  5066. */
  5067. updateUniformDirectly(uniformName: string, data: number[] | Float32Array): void;
  5068. /**
  5069. * Binds this uniform buffer to an effect.
  5070. * @param {Effect} effect
  5071. * @param {string} name Name of the uniform block in the shader.
  5072. */
  5073. bindToEffect(effect: Effect, name: string): void;
  5074. /**
  5075. * Disposes the uniform buffer.
  5076. */
  5077. dispose(): void;
  5078. }
  5079. }
  5080. declare module BABYLON {
  5081. class AbstractMesh extends Node implements IDisposable, ICullable, IGetSetVerticesData {
  5082. static readonly BILLBOARDMODE_NONE: number;
  5083. static readonly BILLBOARDMODE_X: number;
  5084. static readonly BILLBOARDMODE_Y: number;
  5085. static readonly BILLBOARDMODE_Z: number;
  5086. static readonly BILLBOARDMODE_ALL: number;
  5087. /**
  5088. * Read-only : the number of facets in the mesh
  5089. */
  5090. readonly facetNb: number;
  5091. /**
  5092. * The number (integer) of subdivisions per axis in the partioning space
  5093. */
  5094. partitioningSubdivisions: number;
  5095. /**
  5096. * The ratio (float) to apply to the bouding box size to set to the partioning space.
  5097. * Ex : 1.01 (default) the partioning space is 1% bigger than the bounding box.
  5098. */
  5099. partitioningBBoxRatio: number;
  5100. /**
  5101. * Read-only boolean : is the feature facetData enabled ?
  5102. */
  5103. readonly isFacetDataEnabled: boolean;
  5104. /**
  5105. * An event triggered when this mesh collides with another one
  5106. * @type {BABYLON.Observable}
  5107. */
  5108. onCollideObservable: Observable<AbstractMesh>;
  5109. onCollide: () => void;
  5110. /**
  5111. * An event triggered when the collision's position changes
  5112. * @type {BABYLON.Observable}
  5113. */
  5114. onCollisionPositionChangeObservable: Observable<Vector3>;
  5115. onCollisionPositionChange: () => void;
  5116. /**
  5117. * An event triggered after the world matrix is updated
  5118. * @type {BABYLON.Observable}
  5119. */
  5120. onAfterWorldMatrixUpdateObservable: Observable<AbstractMesh>;
  5121. definedFacingForward: boolean;
  5122. position: Vector3;
  5123. billboardMode: number;
  5124. visibility: number;
  5125. alphaIndex: number;
  5126. infiniteDistance: boolean;
  5127. isVisible: boolean;
  5128. isPickable: boolean;
  5129. showBoundingBox: boolean;
  5130. showSubMeshesBoundingBox: boolean;
  5131. isBlocker: boolean;
  5132. renderingGroupId: number;
  5133. material: Material;
  5134. receiveShadows: boolean;
  5135. renderOutline: boolean;
  5136. outlineColor: Color3;
  5137. outlineWidth: number;
  5138. renderOverlay: boolean;
  5139. overlayColor: Color3;
  5140. overlayAlpha: number;
  5141. hasVertexAlpha: boolean;
  5142. useVertexColors: boolean;
  5143. computeBonesUsingShaders: boolean;
  5144. numBoneInfluencers: number;
  5145. applyFog: boolean;
  5146. scalingDeterminant: number;
  5147. useOctreeForRenderingSelection: boolean;
  5148. useOctreeForPicking: boolean;
  5149. useOctreeForCollisions: boolean;
  5150. layerMask: number;
  5151. /**
  5152. * True if the mesh must be rendered in any case.
  5153. */
  5154. alwaysSelectAsActiveMesh: boolean;
  5155. /**
  5156. * This scene's action manager
  5157. * @type {BABYLON.ActionManager}
  5158. */
  5159. actionManager: ActionManager;
  5160. physicsImpostor: BABYLON.PhysicsImpostor;
  5161. ellipsoid: Vector3;
  5162. ellipsoidOffset: Vector3;
  5163. collisionMask: number;
  5164. collisionGroup: number;
  5165. edgesWidth: number;
  5166. edgesColor: Color4;
  5167. subMeshes: SubMesh[];
  5168. readonly _positions: Vector3[];
  5169. skeleton: Skeleton;
  5170. constructor(name: string, scene: Scene);
  5171. /**
  5172. * Returns the string "AbstractMesh"
  5173. */
  5174. getClassName(): string;
  5175. /**
  5176. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  5177. */
  5178. toString(fullDetails?: boolean): string;
  5179. /**
  5180. * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z.
  5181. * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
  5182. * Default : (0.0, 0.0, 0.0)
  5183. */
  5184. rotation: Vector3;
  5185. /**
  5186. * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
  5187. * Default : (1.0, 1.0, 1.0)
  5188. */
  5189. scaling: Vector3;
  5190. /**
  5191. * Rotation Quaternion property : this a Quaternion object depicting the mesh rotation by using a unit quaternion.
  5192. * It's null by default.
  5193. * 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)
  5194. */
  5195. rotationQuaternion: Quaternion;
  5196. /**
  5197. * Copies the paramater passed Matrix into the mesh Pose matrix.
  5198. * Returns the AbstractMesh.
  5199. */
  5200. updatePoseMatrix(matrix: Matrix): AbstractMesh;
  5201. /**
  5202. * Returns the mesh Pose matrix.
  5203. * Returned object : Matrix
  5204. */
  5205. getPoseMatrix(): Matrix;
  5206. /**
  5207. * Disables the mesh edger rendering mode.
  5208. * Returns the AbstractMesh.
  5209. */
  5210. disableEdgesRendering(): AbstractMesh;
  5211. /**
  5212. * Enables the edge rendering mode on the mesh.
  5213. * This mode makes the mesh edges visible.
  5214. * Returns the AbstractMesh.
  5215. */
  5216. enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): AbstractMesh;
  5217. /**
  5218. * Returns true if the mesh is blocked. Used by the class Mesh.
  5219. * Returns the boolean `false` by default.
  5220. */
  5221. readonly isBlocked: boolean;
  5222. /**
  5223. * Returns the mesh itself by default, used by the class Mesh.
  5224. * Returned type : AbstractMesh
  5225. */
  5226. getLOD(camera: Camera): AbstractMesh;
  5227. /**
  5228. * Returns 0 by default, used by the class Mesh.
  5229. * Returns an integer.
  5230. */
  5231. getTotalVertices(): number;
  5232. /**
  5233. * Returns null by default, used by the class Mesh.
  5234. * Returned type : integer array
  5235. */
  5236. getIndices(): IndicesArray;
  5237. /**
  5238. * Returns the array of the requested vertex data kind. Used by the class Mesh. Returns null here.
  5239. * Returned type : float array or Float32Array
  5240. */
  5241. getVerticesData(kind: string): number[] | Float32Array;
  5242. /**
  5243. * Sets the vertex data of the mesh geometry for the requested `kind`.
  5244. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  5245. * The `data` are either a numeric array either a Float32Array.
  5246. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  5247. * 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).
  5248. * Note that a new underlying VertexBuffer object is created each call.
  5249. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  5250. *
  5251. * Possible `kind` values :
  5252. * - BABYLON.VertexBuffer.PositionKind
  5253. * - BABYLON.VertexBuffer.UVKind
  5254. * - BABYLON.VertexBuffer.UV2Kind
  5255. * - BABYLON.VertexBuffer.UV3Kind
  5256. * - BABYLON.VertexBuffer.UV4Kind
  5257. * - BABYLON.VertexBuffer.UV5Kind
  5258. * - BABYLON.VertexBuffer.UV6Kind
  5259. * - BABYLON.VertexBuffer.ColorKind
  5260. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5261. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5262. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5263. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5264. *
  5265. * Returns the Mesh.
  5266. */
  5267. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): Mesh;
  5268. /**
  5269. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  5270. * If the mesh has no geometry, it is simply returned as it is.
  5271. * The `data` are either a numeric array either a Float32Array.
  5272. * No new underlying VertexBuffer object is created.
  5273. * 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.
  5274. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  5275. *
  5276. * Possible `kind` values :
  5277. * - BABYLON.VertexBuffer.PositionKind
  5278. * - BABYLON.VertexBuffer.UVKind
  5279. * - BABYLON.VertexBuffer.UV2Kind
  5280. * - BABYLON.VertexBuffer.UV3Kind
  5281. * - BABYLON.VertexBuffer.UV4Kind
  5282. * - BABYLON.VertexBuffer.UV5Kind
  5283. * - BABYLON.VertexBuffer.UV6Kind
  5284. * - BABYLON.VertexBuffer.ColorKind
  5285. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5286. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5287. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5288. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5289. *
  5290. * Returns the Mesh.
  5291. */
  5292. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): Mesh;
  5293. /**
  5294. * Sets the mesh indices.
  5295. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  5296. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  5297. * This method creates a new index buffer each call.
  5298. * Returns the Mesh.
  5299. */
  5300. setIndices(indices: IndicesArray, totalVertices?: number): Mesh;
  5301. /** Returns false by default, used by the class Mesh.
  5302. * Returns a boolean
  5303. */
  5304. isVerticesDataPresent(kind: string): boolean;
  5305. /**
  5306. * Returns the mesh BoundingInfo object or creates a new one and returns it if undefined.
  5307. * Returns a BoundingInfo
  5308. */
  5309. getBoundingInfo(): BoundingInfo;
  5310. /**
  5311. * Sets a mesh new object BoundingInfo.
  5312. * Returns the AbstractMesh.
  5313. */
  5314. setBoundingInfo(boundingInfo: BoundingInfo): AbstractMesh;
  5315. readonly useBones: boolean;
  5316. /**
  5317. * Returns the last update of the World matrix
  5318. * Returns a Matrix.
  5319. */
  5320. getWorldMatrix(): Matrix;
  5321. /**
  5322. * Returns directly the last state of the mesh World matrix.
  5323. * A Matrix is returned.
  5324. */
  5325. readonly worldMatrixFromCache: Matrix;
  5326. /**
  5327. * Returns the current mesh absolute position.
  5328. * Retuns a Vector3.
  5329. */
  5330. readonly absolutePosition: Vector3;
  5331. /**
  5332. * Prevents the World matrix to be computed any longer.
  5333. * Returns the AbstractMesh.
  5334. */
  5335. freezeWorldMatrix(): AbstractMesh;
  5336. /**
  5337. * Allows back the World matrix computation.
  5338. * Returns the AbstractMesh.
  5339. */
  5340. unfreezeWorldMatrix(): this;
  5341. /**
  5342. * True if the World matrix has been frozen.
  5343. * Returns a boolean.
  5344. */
  5345. readonly isWorldMatrixFrozen: boolean;
  5346. /**
  5347. * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.
  5348. * space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
  5349. * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
  5350. * The passed axis is also normalized.
  5351. * Returns the AbstractMesh.
  5352. */
  5353. rotate(axis: Vector3, amount: number, space?: Space): AbstractMesh;
  5354. /**
  5355. * Translates the mesh along the axis vector for the passed distance in the given space.
  5356. * space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
  5357. * Returns the AbstractMesh.
  5358. */
  5359. translate(axis: Vector3, distance: number, space?: Space): AbstractMesh;
  5360. /**
  5361. * Adds a rotation step to the mesh current rotation.
  5362. * x, y, z are Euler angles expressed in radians.
  5363. * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.
  5364. * This means this rotation is made in the mesh local space only.
  5365. * It's useful to set a custom rotation order different from the BJS standard one YXZ.
  5366. * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.
  5367. * ```javascript
  5368. * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);
  5369. * ```
  5370. * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.
  5371. * 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.
  5372. * Returns the AbstractMesh.
  5373. */
  5374. addRotation(x: number, y: number, z: number): AbstractMesh;
  5375. /**
  5376. * Retuns the mesh absolute position in the World.
  5377. * Returns a Vector3.
  5378. */
  5379. getAbsolutePosition(): Vector3;
  5380. /**
  5381. * Sets the mesh absolute position in the World from a Vector3 or an Array(3).
  5382. * Returns the AbstractMesh.
  5383. */
  5384. setAbsolutePosition(absolutePosition: Vector3): AbstractMesh;
  5385. /**
  5386. * Perform relative position change from the point of view of behind the front of the mesh.
  5387. * This is performed taking into account the meshes current rotation, so you do not have to care.
  5388. * Supports definition of mesh facing forward or backward.
  5389. * @param {number} amountRight
  5390. * @param {number} amountUp
  5391. * @param {number} amountForward
  5392. *
  5393. * Returns the AbstractMesh.
  5394. */
  5395. movePOV(amountRight: number, amountUp: number, amountForward: number): AbstractMesh;
  5396. /**
  5397. * Calculate relative position change from the point of view of behind the front of the mesh.
  5398. * This is performed taking into account the meshes current rotation, so you do not have to care.
  5399. * Supports definition of mesh facing forward or backward.
  5400. * @param {number} amountRight
  5401. * @param {number} amountUp
  5402. * @param {number} amountForward
  5403. *
  5404. * Returns a new Vector3.
  5405. */
  5406. calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
  5407. /**
  5408. * Perform relative rotation change from the point of view of behind the front of the mesh.
  5409. * Supports definition of mesh facing forward or backward.
  5410. * @param {number} flipBack
  5411. * @param {number} twirlClockwise
  5412. * @param {number} tiltRight
  5413. *
  5414. * Returns the AbstractMesh.
  5415. */
  5416. rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): AbstractMesh;
  5417. /**
  5418. * Calculate relative rotation change from the point of view of behind the front of the mesh.
  5419. * Supports definition of mesh facing forward or backward.
  5420. * @param {number} flipBack
  5421. * @param {number} twirlClockwise
  5422. * @param {number} tiltRight
  5423. *
  5424. * Returns a new Vector3.
  5425. */
  5426. calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
  5427. /**
  5428. * Sets a new pivot matrix to the mesh.
  5429. * Returns the AbstractMesh.
  5430. */
  5431. setPivotMatrix(matrix: Matrix): AbstractMesh;
  5432. /**
  5433. * Returns the mesh pivot matrix.
  5434. * Default : Identity.
  5435. * A Matrix is returned.
  5436. */
  5437. getPivotMatrix(): Matrix;
  5438. markAsDirty(property: string): AbstractMesh;
  5439. /**
  5440. * Updates the mesh BoundingInfo object and all its children BoundingInfo objects also.
  5441. * Returns the AbstractMesh.
  5442. */
  5443. /**
  5444. * Update a mesh's children BoundingInfo objects only.
  5445. * Returns the AbstractMesh.
  5446. */
  5447. /**
  5448. * Computes the mesh World matrix and returns it.
  5449. * If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.
  5450. * If the parameter `force` is let to `false` (default), the current cached World matrix is returned.
  5451. * If the parameter `force`is set to `true`, the actual computation is done.
  5452. * Returns the mesh World Matrix.
  5453. */
  5454. computeWorldMatrix(force?: boolean): Matrix;
  5455. /**
  5456. * If you'd like to be called back after the mesh position, rotation or scaling has been updated.
  5457. * @param func: callback function to add
  5458. *
  5459. * Returns the AbstractMesh.
  5460. */
  5461. registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): AbstractMesh;
  5462. /**
  5463. * Removes a registered callback function.
  5464. * Returns the AbstractMesh.
  5465. */
  5466. unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): AbstractMesh;
  5467. /**
  5468. * Sets the mesh position in its local space.
  5469. * Returns the AbstractMesh.
  5470. */
  5471. setPositionWithLocalVector(vector3: Vector3): AbstractMesh;
  5472. /**
  5473. * Returns the mesh position in the local space from the current World matrix values.
  5474. * Returns a new Vector3.
  5475. */
  5476. getPositionExpressedInLocalSpace(): Vector3;
  5477. /**
  5478. * Translates the mesh along the passed Vector3 in its local space.
  5479. * Returns the AbstractMesh.
  5480. */
  5481. locallyTranslate(vector3: Vector3): AbstractMesh;
  5482. lookAt(targetPoint: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number, space?: Space): AbstractMesh;
  5483. attachToBone(bone: Bone, affectedMesh: AbstractMesh): AbstractMesh;
  5484. detachFromBone(): AbstractMesh;
  5485. /**
  5486. * Returns `true` if the mesh is within the frustum defined by the passed array of planes.
  5487. * A mesh is in the frustum if its bounding box intersects the frustum.
  5488. * Boolean returned.
  5489. */
  5490. isInFrustum(frustumPlanes: Plane[]): boolean;
  5491. /**
  5492. * Returns `true` if the mesh is completely in the frustum defined be the passed array of planes.
  5493. * A mesh is completely in the frustum if its bounding box it completely inside the frustum.
  5494. * Boolean returned.
  5495. */
  5496. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  5497. /**
  5498. * True if the mesh intersects another mesh or a SolidParticle object.
  5499. * 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)
  5500. * Returns a boolean.
  5501. */
  5502. intersectsMesh(mesh: AbstractMesh | SolidParticle, precise?: boolean): boolean;
  5503. /**
  5504. * Returns true if the passed point (Vector3) is inside the mesh bounding box.
  5505. * Returns a boolean.
  5506. */
  5507. intersectsPoint(point: Vector3): boolean;
  5508. getPhysicsImpostor(): PhysicsImpostor;
  5509. getPositionInCameraSpace(camera?: Camera): Vector3;
  5510. /**
  5511. * Returns the distance from the mesh to the active camera.
  5512. * Returns a float.
  5513. */
  5514. getDistanceToCamera(camera?: Camera): number;
  5515. applyImpulse(force: Vector3, contactPoint: Vector3): AbstractMesh;
  5516. setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): AbstractMesh;
  5517. /**
  5518. * Property checkCollisions : Boolean, whether the camera should check the collisions against the mesh.
  5519. * Default `false`.
  5520. */
  5521. checkCollisions: boolean;
  5522. moveWithCollisions(velocity: Vector3): AbstractMesh;
  5523. /**
  5524. * This function will create an octree to help to select the right submeshes for rendering, picking and collision computations.
  5525. * Please note that you must have a decent number of submeshes to get performance improvements when using an octree.
  5526. * Returns an Octree of submeshes.
  5527. */
  5528. createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
  5529. /**
  5530. * Checks if the passed Ray intersects with the mesh.
  5531. * Returns an object PickingInfo.
  5532. */
  5533. intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
  5534. /**
  5535. * Clones the mesh, used by the class Mesh.
  5536. * Just returns `null` for an AbstractMesh.
  5537. */
  5538. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh;
  5539. /**
  5540. * Disposes all the mesh submeshes.
  5541. * Returns the AbstractMesh.
  5542. */
  5543. releaseSubMeshes(): AbstractMesh;
  5544. /**
  5545. * Disposes the AbstractMesh.
  5546. * Some internal references are kept for further use.
  5547. * By default, all the mesh children are also disposed unless the parameter `doNotRecurse` is set to `true`.
  5548. * Returns nothing.
  5549. */
  5550. dispose(doNotRecurse?: boolean): void;
  5551. /**
  5552. * Returns a new Vector3 what is the localAxis, expressed in the mesh local space, rotated like the mesh.
  5553. * This Vector3 is expressed in the World space.
  5554. */
  5555. getDirection(localAxis: Vector3): Vector3;
  5556. /**
  5557. * Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh.
  5558. * localAxis is expressed in the mesh local space.
  5559. * result is computed in the Wordl space from the mesh World matrix.
  5560. * Returns the AbstractMesh.
  5561. */
  5562. getDirectionToRef(localAxis: Vector3, result: Vector3): AbstractMesh;
  5563. setPivotPoint(point: Vector3, space?: Space): AbstractMesh;
  5564. /**
  5565. * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.
  5566. */
  5567. getPivotPoint(): Vector3;
  5568. /**
  5569. * Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space.
  5570. * Returns the AbstractMesh.
  5571. */
  5572. getPivotPointToRef(result: Vector3): AbstractMesh;
  5573. /**
  5574. * Returns a new Vector3 set with the mesh pivot point World coordinates.
  5575. */
  5576. getAbsolutePivotPoint(): Vector3;
  5577. /**
  5578. * Defines the passed mesh as the parent of the current mesh.
  5579. * Returns the AbstractMesh.
  5580. */
  5581. setParent(mesh: AbstractMesh): AbstractMesh;
  5582. /**
  5583. * Adds the passed mesh as a child to the current mesh.
  5584. * Returns the AbstractMesh.
  5585. */
  5586. addChild(mesh: AbstractMesh): AbstractMesh;
  5587. /**
  5588. * Removes the passed mesh from the current mesh children list.
  5589. * Returns the AbstractMesh.
  5590. */
  5591. removeChild(mesh: AbstractMesh): AbstractMesh;
  5592. /**
  5593. * Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates.
  5594. * Returns the AbstractMesh.
  5595. */
  5596. getAbsolutePivotPointToRef(result: Vector3): AbstractMesh;
  5597. /**
  5598. * Initialize the facet data arrays : facetNormals, facetPositions and facetPartitioning.
  5599. * Returns the AbstractMesh.
  5600. */
  5601. /**
  5602. * Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.
  5603. * This method can be called within the render loop.
  5604. * 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.
  5605. * Returns the AbstractMesh.
  5606. */
  5607. updateFacetData(): AbstractMesh;
  5608. /**
  5609. * Returns the facetLocalNormals array.
  5610. * The normals are expressed in the mesh local space.
  5611. */
  5612. getFacetLocalNormals(): Vector3[];
  5613. /**
  5614. * Returns the facetLocalPositions array.
  5615. * The facet positions are expressed in the mesh local space.
  5616. */
  5617. getFacetLocalPositions(): Vector3[];
  5618. /**
  5619. * Returns the facetLocalPartioning array.
  5620. */
  5621. getFacetLocalPartitioning(): number[][];
  5622. /**
  5623. * Returns the i-th facet position in the world system.
  5624. * This method allocates a new Vector3 per call.
  5625. */
  5626. getFacetPosition(i: number): Vector3;
  5627. /**
  5628. * Sets the reference Vector3 with the i-th facet position in the world system.
  5629. * Returns the AbstractMesh.
  5630. */
  5631. getFacetPositionToRef(i: number, ref: Vector3): AbstractMesh;
  5632. /**
  5633. * Returns the i-th facet normal in the world system.
  5634. * This method allocates a new Vector3 per call.
  5635. */
  5636. getFacetNormal(i: number): Vector3;
  5637. /**
  5638. * Sets the reference Vector3 with the i-th facet normal in the world system.
  5639. * Returns the AbstractMesh.
  5640. */
  5641. getFacetNormalToRef(i: number, ref: Vector3): this;
  5642. /**
  5643. * 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).
  5644. */
  5645. getFacetsAtLocalCoordinates(x: number, y: number, z: number): number[];
  5646. /**
  5647. * Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found.
  5648. * If the parameter projected (vector3) is passed, it is set as the (x,y,z) World projection on the facet.
  5649. * 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.
  5650. * If facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position.
  5651. * 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.
  5652. */
  5653. getClosestFacetAtCoordinates(x: number, y: number, z: number, projected?: Vector3, checkFace?: boolean, facing?: boolean): number;
  5654. /**
  5655. * Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found.
  5656. * If the parameter projected (vector3) is passed, it is set as the (x,y,z) local projection on the facet.
  5657. * 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.
  5658. * If facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position.
  5659. * 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.
  5660. */
  5661. getClosestFacetAtLocalCoordinates(x: number, y: number, z: number, projected?: Vector3, checkFace?: boolean, facing?: boolean): number;
  5662. /**
  5663. * Returns the object "parameter" set with all the expected parameters for facetData computation by ComputeNormals()
  5664. */
  5665. getFacetDataParameters(): any;
  5666. /**
  5667. * Disables the feature FacetData and frees the related memory.
  5668. * Returns the AbstractMesh.
  5669. */
  5670. disableFacetData(): AbstractMesh;
  5671. /**
  5672. * Creates new normals data for the mesh.
  5673. * @param updatable.
  5674. */
  5675. createNormals(updatable: boolean): void;
  5676. }
  5677. }
  5678. declare module BABYLON {
  5679. class Buffer {
  5680. constructor(engine: any, data: number[] | Float32Array, updatable: boolean, stride: number, postponeInternalCreation?: boolean, instanced?: boolean);
  5681. createVertexBuffer(kind: string, offset: number, size: number, stride?: number): VertexBuffer;
  5682. isUpdatable(): boolean;
  5683. getData(): number[] | Float32Array;
  5684. getBuffer(): WebGLBuffer;
  5685. getStrideSize(): number;
  5686. getIsInstanced(): boolean;
  5687. create(data?: number[] | Float32Array): void;
  5688. update(data: number[] | Float32Array): void;
  5689. updateDirectly(data: Float32Array, offset: number, vertexCount?: number): void;
  5690. dispose(): void;
  5691. }
  5692. }
  5693. declare module BABYLON {
  5694. class CSG {
  5695. private polygons;
  5696. matrix: Matrix;
  5697. position: Vector3;
  5698. rotation: Vector3;
  5699. rotationQuaternion: Quaternion;
  5700. scaling: Vector3;
  5701. static FromMesh(mesh: Mesh): CSG;
  5702. private static FromPolygons(polygons);
  5703. clone(): CSG;
  5704. private toPolygons();
  5705. union(csg: CSG): CSG;
  5706. unionInPlace(csg: CSG): void;
  5707. subtract(csg: CSG): CSG;
  5708. subtractInPlace(csg: CSG): void;
  5709. intersect(csg: CSG): CSG;
  5710. intersectInPlace(csg: CSG): void;
  5711. inverse(): CSG;
  5712. inverseInPlace(): void;
  5713. copyTransformAttributes(csg: CSG): CSG;
  5714. buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh;
  5715. toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh;
  5716. }
  5717. }
  5718. declare module BABYLON {
  5719. class Geometry implements IGetSetVerticesData {
  5720. id: string;
  5721. delayLoadState: number;
  5722. delayLoadingFile: string;
  5723. onGeometryUpdated: (geometry: Geometry, kind?: string) => void;
  5724. /**
  5725. * 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
  5726. * @returns The Bias Vector
  5727. */
  5728. boundingBias: Vector2;
  5729. constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh);
  5730. readonly extend: {
  5731. minimum: Vector3;
  5732. maximum: Vector3;
  5733. };
  5734. getScene(): Scene;
  5735. getEngine(): Engine;
  5736. isReady(): boolean;
  5737. readonly doNotSerialize: boolean;
  5738. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  5739. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
  5740. removeVerticesData(kind: string): void;
  5741. setVerticesBuffer(buffer: VertexBuffer): void;
  5742. updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void;
  5743. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean): void;
  5744. private updateBoundingInfo(updateExtends, data);
  5745. getTotalVertices(): number;
  5746. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): number[] | Float32Array;
  5747. getVertexBuffer(kind: string): VertexBuffer;
  5748. getVertexBuffers(): {
  5749. [key: string]: VertexBuffer;
  5750. };
  5751. isVerticesDataPresent(kind: string): boolean;
  5752. getVerticesDataKinds(): string[];
  5753. setIndices(indices: IndicesArray, totalVertices?: number): void;
  5754. getTotalIndices(): number;
  5755. getIndices(copyWhenShared?: boolean): IndicesArray;
  5756. getIndexBuffer(): WebGLBuffer;
  5757. releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
  5758. applyToMesh(mesh: Mesh): void;
  5759. private updateExtend(data?, stride?);
  5760. private notifyUpdate(kind?);
  5761. load(scene: Scene, onLoaded?: () => void): void;
  5762. /**
  5763. * Invert the geometry to move from a right handed system to a left handed one.
  5764. */
  5765. toLeftHanded(): void;
  5766. isDisposed(): boolean;
  5767. dispose(): void;
  5768. copy(id: string): Geometry;
  5769. serialize(): any;
  5770. private toNumberArray(origin);
  5771. serializeVerticeData(): any;
  5772. static ExtractFromMesh(mesh: Mesh, id: string): Geometry;
  5773. /**
  5774. * You should now use Tools.RandomId(), this method is still here for legacy reasons.
  5775. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  5776. * Be aware Math.random() could cause collisions, but:
  5777. * "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"
  5778. */
  5779. static RandomId(): string;
  5780. static ImportGeometry(parsedGeometry: any, mesh: Mesh): void;
  5781. static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Geometry;
  5782. }
  5783. module Geometry.Primitives {
  5784. class _Primitive extends Geometry {
  5785. constructor(id: string, scene: Scene, _canBeRegenerated?: boolean, mesh?: Mesh);
  5786. canBeRegenerated(): boolean;
  5787. regenerate(): void;
  5788. asNewGeometry(id: string): Geometry;
  5789. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  5790. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
  5791. copy(id: string): Geometry;
  5792. serialize(): any;
  5793. }
  5794. class Ribbon extends _Primitive {
  5795. pathArray: Vector3[][];
  5796. closeArray: boolean;
  5797. closePath: boolean;
  5798. offset: number;
  5799. side: number;
  5800. constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5801. copy(id: string): Geometry;
  5802. }
  5803. class Box extends _Primitive {
  5804. size: number;
  5805. side: number;
  5806. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5807. copy(id: string): Geometry;
  5808. serialize(): any;
  5809. static Parse(parsedBox: any, scene: Scene): Box;
  5810. }
  5811. class Sphere extends _Primitive {
  5812. segments: number;
  5813. diameter: number;
  5814. side: number;
  5815. constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5816. copy(id: string): Geometry;
  5817. serialize(): any;
  5818. static Parse(parsedSphere: any, scene: Scene): Geometry.Primitives.Sphere;
  5819. }
  5820. class Disc extends _Primitive {
  5821. radius: number;
  5822. tessellation: number;
  5823. side: number;
  5824. constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5825. copy(id: string): Geometry;
  5826. }
  5827. class Cylinder extends _Primitive {
  5828. height: number;
  5829. diameterTop: number;
  5830. diameterBottom: number;
  5831. tessellation: number;
  5832. subdivisions: number;
  5833. side: number;
  5834. constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5835. copy(id: string): Geometry;
  5836. serialize(): any;
  5837. static Parse(parsedCylinder: any, scene: Scene): Geometry.Primitives.Cylinder;
  5838. }
  5839. class Torus extends _Primitive {
  5840. diameter: number;
  5841. thickness: number;
  5842. tessellation: number;
  5843. side: number;
  5844. constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5845. copy(id: string): Geometry;
  5846. serialize(): any;
  5847. static Parse(parsedTorus: any, scene: Scene): Geometry.Primitives.Torus;
  5848. }
  5849. class Ground extends _Primitive {
  5850. width: number;
  5851. height: number;
  5852. subdivisions: number;
  5853. constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh);
  5854. copy(id: string): Geometry;
  5855. serialize(): any;
  5856. static Parse(parsedGround: any, scene: Scene): Geometry.Primitives.Ground;
  5857. }
  5858. class TiledGround extends _Primitive {
  5859. xmin: number;
  5860. zmin: number;
  5861. xmax: number;
  5862. zmax: number;
  5863. subdivisions: {
  5864. w: number;
  5865. h: number;
  5866. };
  5867. precision: {
  5868. w: number;
  5869. h: number;
  5870. };
  5871. constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  5872. w: number;
  5873. h: number;
  5874. }, precision: {
  5875. w: number;
  5876. h: number;
  5877. }, canBeRegenerated?: boolean, mesh?: Mesh);
  5878. copy(id: string): Geometry;
  5879. }
  5880. class Plane extends _Primitive {
  5881. size: number;
  5882. side: number;
  5883. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5884. copy(id: string): Geometry;
  5885. serialize(): any;
  5886. static Parse(parsedPlane: any, scene: Scene): Geometry.Primitives.Plane;
  5887. }
  5888. class TorusKnot extends _Primitive {
  5889. radius: number;
  5890. tube: number;
  5891. radialSegments: number;
  5892. tubularSegments: number;
  5893. p: number;
  5894. q: number;
  5895. side: number;
  5896. constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5897. copy(id: string): Geometry;
  5898. serialize(): any;
  5899. static Parse(parsedTorusKnot: any, scene: Scene): Geometry.Primitives.TorusKnot;
  5900. }
  5901. }
  5902. }
  5903. declare module BABYLON {
  5904. class GroundMesh extends Mesh {
  5905. generateOctree: boolean;
  5906. constructor(name: string, scene: Scene);
  5907. getClassName(): string;
  5908. readonly subdivisions: number;
  5909. readonly subdivisionsX: number;
  5910. readonly subdivisionsY: number;
  5911. optimize(chunksCount: number, octreeBlocksSize?: number): void;
  5912. /**
  5913. * Returns a height (y) value in the Worl system :
  5914. * the ground altitude at the coordinates (x, z) expressed in the World system.
  5915. * Returns the ground y position if (x, z) are outside the ground surface.
  5916. */
  5917. getHeightAtCoordinates(x: number, z: number): number;
  5918. /**
  5919. * Returns a normalized vector (Vector3) orthogonal to the ground
  5920. * at the ground coordinates (x, z) expressed in the World system.
  5921. * Returns Vector3(0.0, 1.0, 0.0) if (x, z) are outside the ground surface.
  5922. */
  5923. getNormalAtCoordinates(x: number, z: number): Vector3;
  5924. /**
  5925. * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground
  5926. * at the ground coordinates (x, z) expressed in the World system.
  5927. * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.
  5928. * Returns the GroundMesh.
  5929. */
  5930. getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): GroundMesh;
  5931. /**
  5932. * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()
  5933. * if the ground has been updated.
  5934. * This can be used in the render loop.
  5935. * Returns the GroundMesh.
  5936. */
  5937. updateCoordinateHeights(): GroundMesh;
  5938. serialize(serializationObject: any): void;
  5939. static Parse(parsedMesh: any, scene: Scene): GroundMesh;
  5940. }
  5941. }
  5942. declare module BABYLON {
  5943. /**
  5944. * Creates an instance based on a source mesh.
  5945. */
  5946. class InstancedMesh extends AbstractMesh {
  5947. constructor(name: string, source: Mesh);
  5948. /**
  5949. * Returns the string "InstancedMesh".
  5950. */
  5951. getClassName(): string;
  5952. readonly receiveShadows: boolean;
  5953. readonly material: Material;
  5954. readonly visibility: number;
  5955. readonly skeleton: Skeleton;
  5956. readonly renderingGroupId: number;
  5957. /**
  5958. * Returns the total number of vertices (integer).
  5959. */
  5960. getTotalVertices(): number;
  5961. readonly sourceMesh: Mesh;
  5962. /**
  5963. * Returns a float array or a Float32Array of the requested kind of data : positons, normals, uvs, etc.
  5964. */
  5965. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  5966. /**
  5967. * Sets the vertex data of the mesh geometry for the requested `kind`.
  5968. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  5969. * The `data` are either a numeric array either a Float32Array.
  5970. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  5971. * 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).
  5972. * Note that a new underlying VertexBuffer object is created each call.
  5973. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  5974. *
  5975. * Possible `kind` values :
  5976. * - BABYLON.VertexBuffer.PositionKind
  5977. * - BABYLON.VertexBuffer.UVKind
  5978. * - BABYLON.VertexBuffer.UV2Kind
  5979. * - BABYLON.VertexBuffer.UV3Kind
  5980. * - BABYLON.VertexBuffer.UV4Kind
  5981. * - BABYLON.VertexBuffer.UV5Kind
  5982. * - BABYLON.VertexBuffer.UV6Kind
  5983. * - BABYLON.VertexBuffer.ColorKind
  5984. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5985. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5986. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5987. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5988. *
  5989. * Returns the Mesh.
  5990. */
  5991. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): Mesh;
  5992. /**
  5993. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  5994. * If the mesh has no geometry, it is simply returned as it is.
  5995. * The `data` are either a numeric array either a Float32Array.
  5996. * No new underlying VertexBuffer object is created.
  5997. * 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.
  5998. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  5999. *
  6000. * Possible `kind` values :
  6001. * - BABYLON.VertexBuffer.PositionKind
  6002. * - BABYLON.VertexBuffer.UVKind
  6003. * - BABYLON.VertexBuffer.UV2Kind
  6004. * - BABYLON.VertexBuffer.UV3Kind
  6005. * - BABYLON.VertexBuffer.UV4Kind
  6006. * - BABYLON.VertexBuffer.UV5Kind
  6007. * - BABYLON.VertexBuffer.UV6Kind
  6008. * - BABYLON.VertexBuffer.ColorKind
  6009. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6010. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6011. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6012. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6013. *
  6014. * Returns the Mesh.
  6015. */
  6016. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): Mesh;
  6017. /**
  6018. * Sets the mesh indices.
  6019. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  6020. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  6021. * This method creates a new index buffer each call.
  6022. * Returns the Mesh.
  6023. */
  6024. setIndices(indices: IndicesArray, totalVertices?: number): Mesh;
  6025. /**
  6026. * Boolean : True if the mesh owns the requested kind of data.
  6027. */
  6028. isVerticesDataPresent(kind: string): boolean;
  6029. /**
  6030. * Returns an array of indices (IndicesArray).
  6031. */
  6032. getIndices(): IndicesArray;
  6033. readonly _positions: Vector3[];
  6034. /**
  6035. * Sets a new updated BoundingInfo to the mesh.
  6036. * Returns the mesh.
  6037. */
  6038. refreshBoundingInfo(): InstancedMesh;
  6039. /**
  6040. * Returns the current associated LOD AbstractMesh.
  6041. */
  6042. getLOD(camera: Camera): AbstractMesh;
  6043. /**
  6044. * Creates a new InstancedMesh from the current mesh.
  6045. * - name (string) : the cloned mesh name
  6046. * - newParent (optional Node) : the optional Node to parent the clone to.
  6047. * - doNotCloneChildren (optional boolean, default `false`) : if `true` the model children aren't cloned.
  6048. *
  6049. * Returns the clone.
  6050. */
  6051. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh;
  6052. /**
  6053. * Disposes the InstancedMesh.
  6054. * Returns nothing.
  6055. */
  6056. dispose(doNotRecurse?: boolean): void;
  6057. }
  6058. }
  6059. declare module BABYLON {
  6060. class LinesMesh extends Mesh {
  6061. useVertexColor: boolean;
  6062. color: Color3;
  6063. alpha: number;
  6064. /**
  6065. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  6066. * This margin is expressed in world space coordinates, so its value may vary.
  6067. * Default value is 0.1
  6068. * @returns the intersection Threshold value.
  6069. */
  6070. /**
  6071. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  6072. * This margin is expressed in world space coordinates, so its value may vary.
  6073. * @param value the new threshold to apply
  6074. */
  6075. intersectionThreshold: number;
  6076. constructor(name: string, scene: Scene, parent?: Node, source?: LinesMesh, doNotCloneChildren?: boolean, useVertexColor?: boolean);
  6077. /**
  6078. * Returns the string "LineMesh"
  6079. */
  6080. getClassName(): string;
  6081. readonly material: Material;
  6082. readonly checkCollisions: boolean;
  6083. createInstance(name: string): InstancedMesh;
  6084. dispose(doNotRecurse?: boolean): void;
  6085. /**
  6086. * Returns a new LineMesh object cloned from the current one.
  6087. */
  6088. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh;
  6089. }
  6090. }
  6091. declare module BABYLON {
  6092. class _InstancesBatch {
  6093. mustReturn: boolean;
  6094. visibleInstances: InstancedMesh[][];
  6095. renderSelf: boolean[];
  6096. }
  6097. class Mesh extends AbstractMesh implements IGetSetVerticesData {
  6098. /**
  6099. * Mesh side orientation : usually the external or front surface
  6100. */
  6101. static readonly FRONTSIDE: number;
  6102. /**
  6103. * Mesh side orientation : usually the internal or back surface
  6104. */
  6105. static readonly BACKSIDE: number;
  6106. /**
  6107. * Mesh side orientation : both internal and external or front and back surfaces
  6108. */
  6109. static readonly DOUBLESIDE: number;
  6110. /**
  6111. * Mesh side orientation : by default, `FRONTSIDE`
  6112. */
  6113. static readonly DEFAULTSIDE: number;
  6114. /**
  6115. * Mesh cap setting : no cap
  6116. */
  6117. static readonly NO_CAP: number;
  6118. /**
  6119. * Mesh cap setting : one cap at the beginning of the mesh
  6120. */
  6121. static readonly CAP_START: number;
  6122. /**
  6123. * Mesh cap setting : one cap at the end of the mesh
  6124. */
  6125. static readonly CAP_END: number;
  6126. /**
  6127. * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
  6128. */
  6129. static readonly CAP_ALL: number;
  6130. /**
  6131. * An event triggered before rendering the mesh
  6132. * @type {BABYLON.Observable}
  6133. */
  6134. onBeforeRenderObservable: Observable<Mesh>;
  6135. /**
  6136. * An event triggered after rendering the mesh
  6137. * @type {BABYLON.Observable}
  6138. */
  6139. onAfterRenderObservable: Observable<Mesh>;
  6140. /**
  6141. * An event triggered before drawing the mesh
  6142. * @type {BABYLON.Observable}
  6143. */
  6144. onBeforeDrawObservable: Observable<Mesh>;
  6145. onBeforeDraw: () => void;
  6146. delayLoadState: number;
  6147. instances: InstancedMesh[];
  6148. delayLoadingFile: string;
  6149. onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
  6150. morphTargetManager: MorphTargetManager;
  6151. readonly source: BABYLON.Mesh;
  6152. /**
  6153. * @constructor
  6154. * @param {string} name The value used by scene.getMeshByName() to do a lookup.
  6155. * @param {Scene} scene The scene to add this mesh to.
  6156. * @param {Node} parent The parent of this mesh, if it has one
  6157. * @param {Mesh} source An optional Mesh from which geometry is shared, cloned.
  6158. * @param {boolean} doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
  6159. * When false, achieved by calling a clone(), also passing False.
  6160. * This will make creation of children, recursive.
  6161. * @param {boolean} clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.
  6162. */
  6163. constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean);
  6164. /**
  6165. * Returns the string "Mesh".
  6166. */
  6167. getClassName(): string;
  6168. /**
  6169. * Returns a string.
  6170. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  6171. */
  6172. toString(fullDetails?: boolean): string;
  6173. /**
  6174. * True if the mesh has some Levels Of Details (LOD).
  6175. * Returns a boolean.
  6176. */
  6177. readonly hasLODLevels: boolean;
  6178. /**
  6179. * Add a mesh as LOD level triggered at the given distance.
  6180. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6181. * @param {number} distance The distance from the center of the object to show this level
  6182. * @param {Mesh} mesh The mesh to be added as LOD level
  6183. * @return {Mesh} This mesh (for chaining)
  6184. */
  6185. addLODLevel(distance: number, mesh: Mesh): Mesh;
  6186. /**
  6187. * Returns the LOD level mesh at the passed distance or null if not found.
  6188. * It is related to the method `addLODLevel(distance, mesh)`.
  6189. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6190. * Returns an object Mesh or `null`.
  6191. */
  6192. getLODLevelAtDistance(distance: number): Mesh;
  6193. /**
  6194. * Remove a mesh from the LOD array
  6195. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6196. * @param {Mesh} mesh The mesh to be removed.
  6197. * @return {Mesh} This mesh (for chaining)
  6198. */
  6199. removeLODLevel(mesh: Mesh): Mesh;
  6200. /**
  6201. * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.
  6202. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6203. */
  6204. getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh;
  6205. /**
  6206. * Returns the mesh internal Geometry object.
  6207. */
  6208. readonly geometry: Geometry;
  6209. /**
  6210. * Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
  6211. */
  6212. getTotalVertices(): number;
  6213. /**
  6214. * Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
  6215. * 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.
  6216. * You can force the copy with forceCopy === true
  6217. * Returns null if the mesh has no geometry or no vertex buffer.
  6218. * Possible `kind` values :
  6219. * - BABYLON.VertexBuffer.PositionKind
  6220. * - BABYLON.VertexBuffer.UVKind
  6221. * - BABYLON.VertexBuffer.UV2Kind
  6222. * - BABYLON.VertexBuffer.UV3Kind
  6223. * - BABYLON.VertexBuffer.UV4Kind
  6224. * - BABYLON.VertexBuffer.UV5Kind
  6225. * - BABYLON.VertexBuffer.UV6Kind
  6226. * - BABYLON.VertexBuffer.ColorKind
  6227. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6228. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6229. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6230. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6231. */
  6232. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): number[] | Float32Array;
  6233. /**
  6234. * Returns the mesh VertexBuffer object from the requested `kind` : positions, indices, normals, etc.
  6235. * Returns `undefined` if the mesh has no geometry.
  6236. * Possible `kind` values :
  6237. * - BABYLON.VertexBuffer.PositionKind
  6238. * - BABYLON.VertexBuffer.UVKind
  6239. * - BABYLON.VertexBuffer.UV2Kind
  6240. * - BABYLON.VertexBuffer.UV3Kind
  6241. * - BABYLON.VertexBuffer.UV4Kind
  6242. * - BABYLON.VertexBuffer.UV5Kind
  6243. * - BABYLON.VertexBuffer.UV6Kind
  6244. * - BABYLON.VertexBuffer.ColorKind
  6245. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6246. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6247. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6248. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6249. */
  6250. getVertexBuffer(kind: any): VertexBuffer;
  6251. /**
  6252. * Returns a boolean depending on the existence of the Vertex Data for the requested `kind`.
  6253. * Possible `kind` values :
  6254. * - BABYLON.VertexBuffer.PositionKind
  6255. * - BABYLON.VertexBuffer.UVKind
  6256. * - BABYLON.VertexBuffer.UV2Kind
  6257. * - BABYLON.VertexBuffer.UV3Kind
  6258. * - BABYLON.VertexBuffer.UV4Kind
  6259. * - BABYLON.VertexBuffer.UV5Kind
  6260. * - BABYLON.VertexBuffer.UV6Kind
  6261. * - BABYLON.VertexBuffer.ColorKind
  6262. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6263. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6264. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6265. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6266. */
  6267. isVerticesDataPresent(kind: string): boolean;
  6268. /**
  6269. * Returns a string : the list of existing `kinds` of Vertex Data for this mesh.
  6270. * Possible `kind` values :
  6271. * - BABYLON.VertexBuffer.PositionKind
  6272. * - BABYLON.VertexBuffer.UVKind
  6273. * - BABYLON.VertexBuffer.UV2Kind
  6274. * - BABYLON.VertexBuffer.UV3Kind
  6275. * - BABYLON.VertexBuffer.UV4Kind
  6276. * - BABYLON.VertexBuffer.UV5Kind
  6277. * - BABYLON.VertexBuffer.UV6Kind
  6278. * - BABYLON.VertexBuffer.ColorKind
  6279. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6280. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6281. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6282. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6283. */
  6284. getVerticesDataKinds(): string[];
  6285. /**
  6286. * Returns a positive integer : the total number of indices in this mesh geometry.
  6287. * Returns zero if the mesh has no geometry.
  6288. */
  6289. getTotalIndices(): number;
  6290. /**
  6291. * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
  6292. * 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.
  6293. * Returns an empty array if the mesh has no geometry.
  6294. */
  6295. getIndices(copyWhenShared?: boolean): IndicesArray;
  6296. readonly isBlocked: boolean;
  6297. /**
  6298. * Boolean : true once the mesh is ready after all the delayed process (loading, etc) are complete.
  6299. */
  6300. isReady(): boolean;
  6301. /**
  6302. * Boolean : true if the mesh has been disposed.
  6303. */
  6304. isDisposed(): boolean;
  6305. /**
  6306. * Sets the mesh side orientation : BABYLON.Mesh.FRONTSIDE, BABYLON.Mesh.BACKSIDE, BABYLON.Mesh.DOUBLESIDE or BABYLON.Mesh.DEFAULTSIDE
  6307. * tuto : http://doc.babylonjs.com/tutorials/Discover_Basic_Elements#side-orientation
  6308. */
  6309. sideOrientation: number;
  6310. /**
  6311. * Boolean : true if the normals aren't to be recomputed on next mesh `positions` array update.
  6312. * This property is pertinent only for updatable parametric shapes.
  6313. */
  6314. readonly areNormalsFrozen: boolean;
  6315. /**
  6316. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  6317. * It has no effect at all on other shapes.
  6318. * It prevents the mesh normals from being recomputed on next `positions` array update.
  6319. * Returns the Mesh.
  6320. */
  6321. freezeNormals(): Mesh;
  6322. /**
  6323. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  6324. * It has no effect at all on other shapes.
  6325. * It reactivates the mesh normals computation if it was previously frozen.
  6326. * Returns the Mesh.
  6327. */
  6328. unfreezeNormals(): Mesh;
  6329. /**
  6330. * Overrides instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
  6331. */
  6332. overridenInstanceCount: number;
  6333. /**
  6334. * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
  6335. * This means the mesh underlying bounding box and sphere are recomputed.
  6336. * Returns the Mesh.
  6337. */
  6338. refreshBoundingInfo(): Mesh;
  6339. subdivide(count: number): void;
  6340. /**
  6341. * Sets the vertex data of the mesh geometry for the requested `kind`.
  6342. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  6343. * The `data` are either a numeric array either a Float32Array.
  6344. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  6345. * 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).
  6346. * Note that a new underlying VertexBuffer object is created each call.
  6347. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  6348. *
  6349. * Possible `kind` values :
  6350. * - BABYLON.VertexBuffer.PositionKind
  6351. * - BABYLON.VertexBuffer.UVKind
  6352. * - BABYLON.VertexBuffer.UV2Kind
  6353. * - BABYLON.VertexBuffer.UV3Kind
  6354. * - BABYLON.VertexBuffer.UV4Kind
  6355. * - BABYLON.VertexBuffer.UV5Kind
  6356. * - BABYLON.VertexBuffer.UV6Kind
  6357. * - BABYLON.VertexBuffer.ColorKind
  6358. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6359. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6360. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6361. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6362. *
  6363. * Returns the Mesh.
  6364. */
  6365. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): Mesh;
  6366. markVerticesDataAsUpdatable(kind: string, updatable?: boolean): void;
  6367. /**
  6368. * Sets the mesh VertexBuffer.
  6369. * Returns the Mesh.
  6370. */
  6371. setVerticesBuffer(buffer: VertexBuffer): Mesh;
  6372. /**
  6373. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  6374. * If the mesh has no geometry, it is simply returned as it is.
  6375. * The `data` are either a numeric array either a Float32Array.
  6376. * No new underlying VertexBuffer object is created.
  6377. * 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.
  6378. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  6379. *
  6380. * Possible `kind` values :
  6381. * - BABYLON.VertexBuffer.PositionKind
  6382. * - BABYLON.VertexBuffer.UVKind
  6383. * - BABYLON.VertexBuffer.UV2Kind
  6384. * - BABYLON.VertexBuffer.UV3Kind
  6385. * - BABYLON.VertexBuffer.UV4Kind
  6386. * - BABYLON.VertexBuffer.UV5Kind
  6387. * - BABYLON.VertexBuffer.UV6Kind
  6388. * - BABYLON.VertexBuffer.ColorKind
  6389. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6390. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6391. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6392. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6393. *
  6394. * Returns the Mesh.
  6395. */
  6396. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): Mesh;
  6397. /**
  6398. * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.
  6399. * tuto : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions
  6400. * The parameter `positionFunction` is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything.
  6401. * The parameter `computeNormals` is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update.
  6402. * Returns the Mesh.
  6403. */
  6404. updateMeshPositions(positionFunction: any, computeNormals?: boolean): Mesh;
  6405. /**
  6406. * Creates a un-shared specific occurence of the geometry for the mesh.
  6407. * Returns the Mesh.
  6408. */
  6409. makeGeometryUnique(): Mesh;
  6410. /**
  6411. * Sets the mesh indices.
  6412. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  6413. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  6414. * This method creates a new index buffer each call.
  6415. * Returns the Mesh.
  6416. */
  6417. setIndices(indices: IndicesArray, totalVertices?: number): Mesh;
  6418. /**
  6419. * Invert the geometry to move from a right handed system to a left handed one.
  6420. * Returns the Mesh.
  6421. */
  6422. toLeftHanded(): Mesh;
  6423. /**
  6424. * Registers for this mesh a javascript function called just before the rendering process.
  6425. * This function is passed the current mesh.
  6426. * Return the Mesh.
  6427. */
  6428. registerBeforeRender(func: (mesh: AbstractMesh) => void): Mesh;
  6429. /**
  6430. * Disposes a previously registered javascript function called before the rendering.
  6431. * This function is passed the current mesh.
  6432. * Returns the Mesh.
  6433. */
  6434. unregisterBeforeRender(func: (mesh: AbstractMesh) => void): Mesh;
  6435. /**
  6436. * Registers for this mesh a javascript function called just after the rendering is complete.
  6437. * This function is passed the current mesh.
  6438. * Returns the Mesh.
  6439. */
  6440. registerAfterRender(func: (mesh: AbstractMesh) => void): Mesh;
  6441. /**
  6442. * Disposes a previously registered javascript function called after the rendering.
  6443. * This function is passed the current mesh.
  6444. * Return the Mesh.
  6445. */
  6446. unregisterAfterRender(func: (mesh: AbstractMesh) => void): Mesh;
  6447. /**
  6448. * Triggers the draw call for the mesh.
  6449. * Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager.
  6450. * Returns the Mesh.
  6451. */
  6452. render(subMesh: SubMesh, enableAlphaMode: boolean): Mesh;
  6453. /**
  6454. * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
  6455. */
  6456. getEmittedParticleSystems(): ParticleSystem[];
  6457. /**
  6458. * Returns an array populated with ParticleSystem objects whose the mesh or its children are the emitter.
  6459. */
  6460. getHierarchyEmittedParticleSystems(): ParticleSystem[];
  6461. /**
  6462. * Boolean, true is the mesh in the frustum defined by the Plane objects from the `frustumPlanes` array parameter.
  6463. */
  6464. isInFrustum(frustumPlanes: Plane[]): boolean;
  6465. /**
  6466. * Sets the mesh material by the material or multiMaterial `id` property.
  6467. * The material `id` is a string identifying the material or the multiMaterial.
  6468. * This method returns the Mesh.
  6469. */
  6470. setMaterialByID(id: string): Mesh;
  6471. /**
  6472. * Returns as a new array populated with the mesh material and/or skeleton, if any.
  6473. */
  6474. getAnimatables(): IAnimatable[];
  6475. /**
  6476. * Modifies the mesh geometry according to the passed transformation matrix.
  6477. * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.
  6478. * The mesh normals are modified accordingly the same transformation.
  6479. * tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  6480. * Note that, under the hood, this method sets a new VertexBuffer each call.
  6481. * Returns the Mesh.
  6482. */
  6483. bakeTransformIntoVertices(transform: Matrix): Mesh;
  6484. /**
  6485. * Modifies the mesh geometry according to its own current World Matrix.
  6486. * The mesh World Matrix is then reset.
  6487. * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.
  6488. * tuto : tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  6489. * Note that, under the hood, this method sets a new VertexBuffer each call.
  6490. * Returns the Mesh.
  6491. */
  6492. bakeCurrentTransformIntoVertices(): Mesh;
  6493. readonly _positions: Vector3[];
  6494. /**
  6495. * Returns a new Mesh object generated from the current mesh properties.
  6496. * This method must not get confused with createInstance().
  6497. * The parameter `name` is a string, the name given to the new mesh.
  6498. * The optional parameter `newParent` can be any Node object (default `null`).
  6499. * The optional parameter `doNotCloneChildren` (default `false`) allows/denies the recursive cloning of the original mesh children if any.
  6500. * 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.
  6501. */
  6502. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): Mesh;
  6503. /**
  6504. * Disposes the mesh.
  6505. * This also frees the memory allocated under the hood to all the buffers used by WebGL.
  6506. */
  6507. dispose(doNotRecurse?: boolean): void;
  6508. /**
  6509. * Modifies the mesh geometry according to a displacement map.
  6510. * 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.
  6511. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  6512. * This method returns nothing.
  6513. * The parameter `url` is a string, the URL from the image file is to be downloaded.
  6514. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  6515. * 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.
  6516. * The parameter `uvOffset` is an optional vector2 used to offset UV.
  6517. * The parameter `uvScale` is an optional vector2 used to scale UV.
  6518. *
  6519. * Returns the Mesh.
  6520. */
  6521. applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void, uvOffset?: Vector2, uvScale?: Vector2): Mesh;
  6522. /**
  6523. * Modifies the mesh geometry according to a displacementMap buffer.
  6524. * 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.
  6525. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  6526. * This method returns nothing.
  6527. * 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.
  6528. * The parameters `heightMapWidth` and `heightMapHeight` are positive integers to set the width and height of the buffer image.
  6529. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  6530. * The parameter `uvOffset` is an optional vector2 used to offset UV.
  6531. * The parameter `uvScale` is an optional vector2 used to scale UV.
  6532. *
  6533. * Returns the Mesh.
  6534. */
  6535. applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number, uvOffset?: Vector2, uvScale?: Vector2): Mesh;
  6536. /**
  6537. * Modify the mesh to get a flat shading rendering.
  6538. * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.
  6539. * This method returns the Mesh.
  6540. * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
  6541. */
  6542. convertToFlatShadedMesh(): Mesh;
  6543. /**
  6544. * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.
  6545. * In other words, more vertices, no more indices and a single bigger VBO.
  6546. * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
  6547. * Returns the Mesh.
  6548. */
  6549. convertToUnIndexedMesh(): Mesh;
  6550. /**
  6551. * Inverses facet orientations and inverts also the normals with `flipNormals` (default `false`) if true.
  6552. * This method returns the Mesh.
  6553. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  6554. */
  6555. flipFaces(flipNormals?: boolean): Mesh;
  6556. /**
  6557. * Creates a new InstancedMesh object from the mesh model.
  6558. * An instance shares the same properties and the same material than its model.
  6559. * Only these properties of each instance can then be set individually :
  6560. * - position
  6561. * - rotation
  6562. * - rotationQuaternion
  6563. * - setPivotMatrix
  6564. * - scaling
  6565. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_Instances
  6566. * Warning : this method is not supported for Line mesh and LineSystem
  6567. */
  6568. createInstance(name: string): InstancedMesh;
  6569. /**
  6570. * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.
  6571. * After this call, all the mesh instances have the same submeshes than the current mesh.
  6572. * This method returns the Mesh.
  6573. */
  6574. synchronizeInstances(): Mesh;
  6575. /**
  6576. * Simplify the mesh according to the given array of settings.
  6577. * Function will return immediately and will simplify async. It returns the Mesh.
  6578. * @param settings a collection of simplification settings.
  6579. * @param parallelProcessing should all levels calculate parallel or one after the other.
  6580. * @param type the type of simplification to run.
  6581. * @param successCallback optional success callback to be called after the simplification finished processing all settings.
  6582. */
  6583. simplify(settings: Array<ISimplificationSettings>, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): Mesh;
  6584. /**
  6585. * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
  6586. * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
  6587. * This should be used together with the simplification to avoid disappearing triangles.
  6588. * Returns the Mesh.
  6589. * @param successCallback an optional success callback to be called after the optimization finished.
  6590. */
  6591. optimizeIndices(successCallback?: (mesh?: Mesh) => void): Mesh;
  6592. serialize(serializationObject: any): void;
  6593. /**
  6594. * Returns a new Mesh object what is a deep copy of the passed mesh.
  6595. * The parameter `parsedMesh` is the mesh to be copied.
  6596. * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
  6597. */
  6598. static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh;
  6599. /**
  6600. * Creates a ribbon mesh.
  6601. * Please consider using the same method from the MeshBuilder class instead.
  6602. * 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.
  6603. *
  6604. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  6605. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  6606. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  6607. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  6608. * 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.
  6609. * 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.
  6610. * 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
  6611. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6612. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6613. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6614. */
  6615. static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene?: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6616. /**
  6617. * Creates a plane polygonal mesh. By default, this is a disc.
  6618. * Please consider using the same method from the MeshBuilder class instead.
  6619. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  6620. * 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.
  6621. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6622. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6623. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6624. */
  6625. static CreateDisc(name: string, radius: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6626. /**
  6627. * Creates a box mesh.
  6628. * Please consider using the same method from the MeshBuilder class instead.
  6629. * The parameter `size` sets the size (float) of each box side (default 1).
  6630. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6631. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6632. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6633. */
  6634. static CreateBox(name: string, size: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6635. /**
  6636. * Creates a sphere mesh.
  6637. * Please consider using the same method from the MeshBuilder class instead.
  6638. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  6639. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  6640. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6641. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6642. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6643. */
  6644. static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6645. /**
  6646. * Creates a cylinder or a cone mesh.
  6647. * Please consider using the same method from the MeshBuilder class instead.
  6648. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  6649. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  6650. * 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.
  6651. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  6652. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  6653. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6654. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6655. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6656. */
  6657. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene?: Scene, updatable?: any, sideOrientation?: number): Mesh;
  6658. /**
  6659. * Creates a torus mesh.
  6660. * Please consider using the same method from the MeshBuilder class instead.
  6661. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  6662. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  6663. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  6664. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6665. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6666. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6667. */
  6668. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6669. /**
  6670. * Creates a torus knot mesh.
  6671. * Please consider using the same method from the MeshBuilder class instead.
  6672. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  6673. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  6674. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  6675. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  6676. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6677. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6678. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6679. */
  6680. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6681. /**
  6682. * Creates a line mesh.
  6683. * Please consider using the same method from the MeshBuilder class instead.
  6684. * 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.
  6685. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  6686. * The parameter `points` is an array successive Vector3.
  6687. * 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
  6688. * When updating an instance, remember that only point positions can change, not the number of points.
  6689. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6690. */
  6691. static CreateLines(name: string, points: Vector3[], scene?: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  6692. /**
  6693. * Creates a dashed line mesh.
  6694. * Please consider using the same method from the MeshBuilder class instead.
  6695. * 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.
  6696. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  6697. * The parameter `points` is an array successive Vector3.
  6698. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  6699. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  6700. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  6701. * 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
  6702. * When updating an instance, remember that only point positions can change, not the number of points.
  6703. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6704. */
  6705. static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene?: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  6706. /**
  6707. * Creates a polygon mesh.
  6708. * Please consider using the same method from the MeshBuilder class instead.
  6709. * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.
  6710. * 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.
  6711. * You can set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6712. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6713. * Remember you can only change the shape positions, not their number when updating a polygon.
  6714. */
  6715. static CreatePolygon(name: string, shape: Vector3[], scene: Scene, holes?: Vector3[][], updatable?: boolean, sideOrientation?: number): Mesh;
  6716. /**
  6717. * Creates an extruded polygon mesh, with depth in the Y direction.
  6718. * Please consider using the same method from the MeshBuilder class instead.
  6719. */
  6720. static ExtrudePolygon(name: string, shape: Vector3[], depth: number, scene: Scene, holes?: Vector3[][], updatable?: boolean, sideOrientation?: number): Mesh;
  6721. /**
  6722. * Creates an extruded shape mesh.
  6723. * 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.
  6724. * Please consider using the same method from the MeshBuilder class instead.
  6725. *
  6726. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  6727. * 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
  6728. * extruded along the Z axis.
  6729. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  6730. * 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.
  6731. * The parameter `scale` (float, default 1) is the value to scale the shape.
  6732. * 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
  6733. * 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
  6734. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  6735. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6736. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6737. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6738. */
  6739. static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene?: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6740. /**
  6741. * Creates an custom extruded shape mesh.
  6742. * 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.
  6743. * Please consider using the same method from the MeshBuilder class instead.
  6744. *
  6745. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  6746. * 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
  6747. * extruded along the Z axis.
  6748. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  6749. * 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
  6750. * and the distance of this point from the begining of the path :
  6751. * ```javascript
  6752. * var rotationFunction = function(i, distance) {
  6753. * // do things
  6754. * return rotationValue; }
  6755. * ```
  6756. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  6757. * 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
  6758. * and the distance of this point from the begining of the path :
  6759. * ```javascript
  6760. * var scaleFunction = function(i, distance) {
  6761. * // do things
  6762. * return scaleValue;}
  6763. * ```
  6764. * It must returns a float value that will be the scale value applied to the shape on each path point.
  6765. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  6766. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  6767. * 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
  6768. * 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
  6769. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  6770. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6771. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6772. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6773. */
  6774. 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;
  6775. /**
  6776. * Creates lathe mesh.
  6777. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  6778. * Please consider using the same method from the MeshBuilder class instead.
  6779. * 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
  6780. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  6781. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  6782. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  6783. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6784. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6785. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6786. */
  6787. static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6788. /**
  6789. * Creates a plane mesh.
  6790. * Please consider using the same method from the MeshBuilder class instead.
  6791. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  6792. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6793. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6794. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6795. */
  6796. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6797. /**
  6798. * Creates a ground mesh.
  6799. * Please consider using the same method from the MeshBuilder class instead.
  6800. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  6801. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  6802. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6803. */
  6804. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh;
  6805. /**
  6806. * Creates a tiled ground mesh.
  6807. * Please consider using the same method from the MeshBuilder class instead.
  6808. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  6809. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  6810. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  6811. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  6812. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  6813. * numbers of subdivisions on the ground width and height of each tile.
  6814. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6815. */
  6816. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  6817. w: number;
  6818. h: number;
  6819. }, precision: {
  6820. w: number;
  6821. h: number;
  6822. }, scene: Scene, updatable?: boolean): Mesh;
  6823. /**
  6824. * Creates a ground mesh from a height map.
  6825. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  6826. * Please consider using the same method from the MeshBuilder class instead.
  6827. * The parameter `url` sets the URL of the height map image resource.
  6828. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  6829. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  6830. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  6831. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  6832. * 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).
  6833. * This function is passed the newly built mesh :
  6834. * ```javascript
  6835. * function(mesh) { // do things
  6836. * return; }
  6837. * ```
  6838. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6839. */
  6840. 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;
  6841. /**
  6842. * Creates a tube mesh.
  6843. * 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.
  6844. * Please consider using the same method from the MeshBuilder class instead.
  6845. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  6846. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  6847. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  6848. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  6849. * 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.
  6850. * It must return a radius value (positive float) :
  6851. * ```javascript
  6852. * var radiusFunction = function(i, distance) {
  6853. * // do things
  6854. * return radius; }
  6855. * ```
  6856. * 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
  6857. * 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
  6858. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6859. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6860. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6861. */
  6862. static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
  6863. (i: number, distance: number): number;
  6864. }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6865. /**
  6866. * Creates a polyhedron mesh.
  6867. * Please consider using the same method from the MeshBuilder class instead.
  6868. * 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
  6869. * to choose the wanted type.
  6870. * The parameter `size` (positive float, default 1) sets the polygon size.
  6871. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  6872. * 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`.
  6873. * 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
  6874. * 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)`).
  6875. * 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
  6876. * 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.
  6877. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6878. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6879. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6880. */
  6881. static CreatePolyhedron(name: string, options: {
  6882. type?: number;
  6883. size?: number;
  6884. sizeX?: number;
  6885. sizeY?: number;
  6886. sizeZ?: number;
  6887. custom?: any;
  6888. faceUV?: Vector4[];
  6889. faceColors?: Color4[];
  6890. updatable?: boolean;
  6891. sideOrientation?: number;
  6892. }, scene: Scene): Mesh;
  6893. /**
  6894. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  6895. * Please consider using the same method from the MeshBuilder class instead.
  6896. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  6897. * 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`).
  6898. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  6899. * 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.
  6900. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6901. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6902. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6903. */
  6904. static CreateIcoSphere(name: string, options: {
  6905. radius?: number;
  6906. flat?: boolean;
  6907. subdivisions?: number;
  6908. sideOrientation?: number;
  6909. updatable?: boolean;
  6910. }, scene: Scene): Mesh;
  6911. /**
  6912. * Creates a decal mesh.
  6913. * Please consider using the same method from the MeshBuilder class instead.
  6914. * 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.
  6915. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  6916. * The parameter `normal` (Vector3, default Vector3.Up) sets the normal of the mesh where the decal is applied onto in World coordinates.
  6917. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  6918. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  6919. */
  6920. static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;
  6921. /**
  6922. * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  6923. */
  6924. setPositionsForCPUSkinning(): Float32Array;
  6925. /**
  6926. * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  6927. */
  6928. setNormalsForCPUSkinning(): Float32Array;
  6929. /**
  6930. * Updates the vertex buffer by applying transformation from the bones.
  6931. * Returns the Mesh.
  6932. *
  6933. * @param {skeleton} skeleton to apply
  6934. */
  6935. applySkeleton(skeleton: Skeleton): Mesh;
  6936. /**
  6937. * Returns an object `{min:` Vector3`, max:` Vector3`}`
  6938. * This min and max Vector3 are the minimum and maximum vectors of each mesh bounding box from the passed array, in the World system
  6939. */
  6940. static MinMax(meshes: AbstractMesh[]): {
  6941. min: Vector3;
  6942. max: Vector3;
  6943. };
  6944. /**
  6945. * Returns a Vector3, the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array.
  6946. */
  6947. static Center(meshesOrMinMaxVector: any): Vector3;
  6948. /**
  6949. * Merge the array of meshes into a single mesh for performance reasons.
  6950. * @param {Array<Mesh>} meshes - The vertices source. They should all be of the same material. Entries can empty
  6951. * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
  6952. * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
  6953. * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
  6954. * @param {boolean} subdivideWithSubMeshes - When true (false default), subdivide mesh to his subMesh array with meshes source.
  6955. */
  6956. static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh, subdivideWithSubMeshes?: boolean): Mesh;
  6957. }
  6958. }
  6959. declare module BABYLON {
  6960. type IndicesArray = number[] | Int32Array | Uint32Array | Uint16Array;
  6961. interface IGetSetVerticesData {
  6962. isVerticesDataPresent(kind: string): boolean;
  6963. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): number[] | Float32Array;
  6964. getIndices(copyWhenShared?: boolean): IndicesArray;
  6965. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
  6966. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
  6967. setIndices(indices: IndicesArray): void;
  6968. }
  6969. class VertexData {
  6970. positions: number[] | Float32Array;
  6971. normals: number[] | Float32Array;
  6972. tangents: number[] | Float32Array;
  6973. uvs: number[] | Float32Array;
  6974. uvs2: number[] | Float32Array;
  6975. uvs3: number[] | Float32Array;
  6976. uvs4: number[] | Float32Array;
  6977. uvs5: number[] | Float32Array;
  6978. uvs6: number[] | Float32Array;
  6979. colors: number[] | Float32Array;
  6980. matricesIndices: number[] | Float32Array;
  6981. matricesWeights: number[] | Float32Array;
  6982. matricesIndicesExtra: number[] | Float32Array;
  6983. matricesWeightsExtra: number[] | Float32Array;
  6984. indices: IndicesArray;
  6985. set(data: number[] | Float32Array, kind: string): void;
  6986. /**
  6987. * Associates the vertexData to the passed Mesh.
  6988. * Sets it as updatable or not (default `false`).
  6989. * Returns the VertexData.
  6990. */
  6991. applyToMesh(mesh: Mesh, updatable?: boolean): VertexData;
  6992. /**
  6993. * Associates the vertexData to the passed Geometry.
  6994. * Sets it as updatable or not (default `false`).
  6995. * Returns the VertexData.
  6996. */
  6997. applyToGeometry(geometry: Geometry, updatable?: boolean): VertexData;
  6998. /**
  6999. * Updates the associated mesh.
  7000. * Returns the VertexData.
  7001. */
  7002. updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): VertexData;
  7003. /**
  7004. * Updates the associated geometry.
  7005. * Returns the VertexData.
  7006. */
  7007. updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): VertexData;
  7008. /**
  7009. * Transforms each position and each normal of the vertexData according to the passed Matrix.
  7010. * Returns the VertexData.
  7011. */
  7012. transform(matrix: Matrix): VertexData;
  7013. /**
  7014. * Merges the passed VertexData into the current one.
  7015. * Returns the modified VertexData.
  7016. */
  7017. merge(other: VertexData): VertexData;
  7018. /**
  7019. * Serializes the VertexData.
  7020. * Returns a serialized object.
  7021. */
  7022. serialize(): any;
  7023. /**
  7024. * Returns the object VertexData associated to the passed mesh.
  7025. */
  7026. static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean, forceCopy?: boolean): VertexData;
  7027. /**
  7028. * Returns the object VertexData associated to the passed geometry.
  7029. */
  7030. static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean, forceCopy?: boolean): VertexData;
  7031. /**
  7032. * Creates the vertexData of the Ribbon.
  7033. */
  7034. static CreateRibbon(options: {
  7035. pathArray: Vector3[][];
  7036. closeArray?: boolean;
  7037. closePath?: boolean;
  7038. offset?: number;
  7039. sideOrientation?: number;
  7040. frontUVs?: Vector4;
  7041. backUVs?: Vector4;
  7042. invertUV?: boolean;
  7043. uvs?: Vector2[];
  7044. colors?: Color4[];
  7045. }): VertexData;
  7046. /**
  7047. * Creates the VertexData of the Box.
  7048. */
  7049. static CreateBox(options: {
  7050. size?: number;
  7051. width?: number;
  7052. height?: number;
  7053. depth?: number;
  7054. faceUV?: Vector4[];
  7055. faceColors?: Color4[];
  7056. sideOrientation?: number;
  7057. frontUVs?: Vector4;
  7058. backUVs?: Vector4;
  7059. }): VertexData;
  7060. /**
  7061. * Creates the VertexData of the Sphere.
  7062. */
  7063. static CreateSphere(options: {
  7064. segments?: number;
  7065. diameter?: number;
  7066. diameterX?: number;
  7067. diameterY?: number;
  7068. diameterZ?: number;
  7069. arc?: number;
  7070. slice?: number;
  7071. sideOrientation?: number;
  7072. frontUVs?: Vector4;
  7073. backUVs?: Vector4;
  7074. }): VertexData;
  7075. /**
  7076. * Creates the VertexData of the Cylinder or Cone.
  7077. */
  7078. static CreateCylinder(options: {
  7079. height?: number;
  7080. diameterTop?: number;
  7081. diameterBottom?: number;
  7082. diameter?: number;
  7083. tessellation?: number;
  7084. subdivisions?: number;
  7085. arc?: number;
  7086. faceColors?: Color4[];
  7087. faceUV?: Vector4[];
  7088. hasRings?: boolean;
  7089. enclose?: boolean;
  7090. sideOrientation?: number;
  7091. frontUVs?: Vector4;
  7092. backUVs?: Vector4;
  7093. }): VertexData;
  7094. /**
  7095. * Creates the VertexData of the Torus.
  7096. */
  7097. static CreateTorus(options: {
  7098. diameter?: number;
  7099. thickness?: number;
  7100. tessellation?: number;
  7101. sideOrientation?: number;
  7102. frontUVs?: Vector4;
  7103. backUVs?: Vector4;
  7104. }): VertexData;
  7105. /**
  7106. * Creates the VertexData of the LineSystem.
  7107. */
  7108. static CreateLineSystem(options: {
  7109. lines: Vector3[][];
  7110. }): VertexData;
  7111. /**
  7112. * Create the VertexData of the DashedLines.
  7113. */
  7114. static CreateDashedLines(options: {
  7115. points: Vector3[];
  7116. dashSize?: number;
  7117. gapSize?: number;
  7118. dashNb?: number;
  7119. }): VertexData;
  7120. /**
  7121. * Creates the VertexData of the Ground.
  7122. */
  7123. static CreateGround(options: {
  7124. width?: number;
  7125. height?: number;
  7126. subdivisions?: number;
  7127. subdivisionsX?: number;
  7128. subdivisionsY?: number;
  7129. }): VertexData;
  7130. /**
  7131. * Creates the VertexData of the TiledGround.
  7132. */
  7133. static CreateTiledGround(options: {
  7134. xmin: number;
  7135. zmin: number;
  7136. xmax: number;
  7137. zmax: number;
  7138. subdivisions?: {
  7139. w: number;
  7140. h: number;
  7141. };
  7142. precision?: {
  7143. w: number;
  7144. h: number;
  7145. };
  7146. }): VertexData;
  7147. /**
  7148. * Creates the VertexData of the Ground designed from a heightmap.
  7149. */
  7150. static CreateGroundFromHeightMap(options: {
  7151. width: number;
  7152. height: number;
  7153. subdivisions: number;
  7154. minHeight: number;
  7155. maxHeight: number;
  7156. colorFilter: Color3;
  7157. buffer: Uint8Array;
  7158. bufferWidth: number;
  7159. bufferHeight: number;
  7160. }): VertexData;
  7161. /**
  7162. * Creates the VertexData of the Plane.
  7163. */
  7164. static CreatePlane(options: {
  7165. size?: number;
  7166. width?: number;
  7167. height?: number;
  7168. sideOrientation?: number;
  7169. frontUVs?: Vector4;
  7170. backUVs?: Vector4;
  7171. }): VertexData;
  7172. /**
  7173. * Creates the VertexData of the Disc or regular Polygon.
  7174. */
  7175. static CreateDisc(options: {
  7176. radius?: number;
  7177. tessellation?: number;
  7178. arc?: number;
  7179. sideOrientation?: number;
  7180. frontUVs?: Vector4;
  7181. backUVs?: Vector4;
  7182. }): VertexData;
  7183. /**
  7184. * Re-creates the VertexData of the Polygon for sideOrientation.
  7185. */
  7186. static CreatePolygon(polygon: Mesh, sideOrientation: number, fUV?: any, fColors?: any, frontUVs?: Vector4, backUVs?: Vector4): VertexData;
  7187. /**
  7188. * Creates the VertexData of the IcoSphere.
  7189. */
  7190. static CreateIcoSphere(options: {
  7191. radius?: number;
  7192. radiusX?: number;
  7193. radiusY?: number;
  7194. radiusZ?: number;
  7195. flat?: boolean;
  7196. subdivisions?: number;
  7197. sideOrientation?: number;
  7198. frontUVs?: Vector4;
  7199. backUVs?: Vector4;
  7200. }): VertexData;
  7201. /**
  7202. * Creates the VertexData of the Polyhedron.
  7203. */
  7204. static CreatePolyhedron(options: {
  7205. type?: number;
  7206. size?: number;
  7207. sizeX?: number;
  7208. sizeY?: number;
  7209. sizeZ?: number;
  7210. custom?: any;
  7211. faceUV?: Vector4[];
  7212. faceColors?: Color4[];
  7213. flat?: boolean;
  7214. sideOrientation?: number;
  7215. frontUVs?: Vector4;
  7216. backUVs?: Vector4;
  7217. }): VertexData;
  7218. /**
  7219. * Creates the VertexData of the Torus Knot.
  7220. */
  7221. static CreateTorusKnot(options: {
  7222. radius?: number;
  7223. tube?: number;
  7224. radialSegments?: number;
  7225. tubularSegments?: number;
  7226. p?: number;
  7227. q?: number;
  7228. sideOrientation?: number;
  7229. frontUVs?: Vector4;
  7230. backUVs?: Vector4;
  7231. }): VertexData;
  7232. /**
  7233. * @param {any} - positions (number[] or Float32Array)
  7234. * @param {any} - indices (number[] or Uint16Array)
  7235. * @param {any} - normals (number[] or Float32Array)
  7236. * options (optional) :
  7237. * facetPositions : optional array of facet positions (vector3)
  7238. * facetNormals : optional array of facet normals (vector3)
  7239. * facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation
  7240. * subDiv : optional partitioning data about subdivsions on each axis (int), required for facetPartitioning computation
  7241. * ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation
  7242. * bbSize : optional bounding box size data, required for facetPartitioning computation
  7243. * bInfo : optional bounding info, required for facetPartitioning computation
  7244. */
  7245. static ComputeNormals(positions: any, indices: any, normals: any, options?: {
  7246. facetNormals?: any;
  7247. facetPositions?: any;
  7248. facetPartitioning?: any;
  7249. ratio?: number;
  7250. bInfo?: any;
  7251. bbSize?: Vector3;
  7252. subDiv?: any;
  7253. useRightHandedSystem?: boolean;
  7254. }): void;
  7255. /**
  7256. * Creates a new VertexData from the imported parameters.
  7257. */
  7258. static ImportVertexData(parsedVertexData: any, geometry: Geometry): void;
  7259. }
  7260. }
  7261. declare module BABYLON {
  7262. class MeshBuilder {
  7263. private static updateSideOrientation(orientation, scene);
  7264. /**
  7265. * Creates a box mesh.
  7266. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#box
  7267. * The parameter `size` sets the size (float) of each box side (default 1).
  7268. * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value than `size`).
  7269. * 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).
  7270. * Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  7271. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7272. * 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).
  7273. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7274. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7275. */
  7276. static CreateBox(name: string, options: {
  7277. size?: number;
  7278. width?: number;
  7279. height?: number;
  7280. depth?: number;
  7281. faceUV?: Vector4[];
  7282. faceColors?: Color4[];
  7283. sideOrientation?: number;
  7284. frontUVs?: Vector4;
  7285. backUVs?: Vector4;
  7286. updatable?: boolean;
  7287. }, scene: Scene): Mesh;
  7288. /**
  7289. * Creates a sphere mesh.
  7290. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#sphere
  7291. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  7292. * 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`).
  7293. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  7294. * 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
  7295. * 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).
  7296. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7297. * 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).
  7298. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7299. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7300. */
  7301. static CreateSphere(name: string, options: {
  7302. segments?: number;
  7303. diameter?: number;
  7304. diameterX?: number;
  7305. diameterY?: number;
  7306. diameterZ?: number;
  7307. arc?: number;
  7308. slice?: number;
  7309. sideOrientation?: number;
  7310. frontUVs?: Vector4;
  7311. backUVs?: Vector4;
  7312. updatable?: boolean;
  7313. }, scene: any): Mesh;
  7314. /**
  7315. * Creates a plane polygonal mesh. By default, this is a disc.
  7316. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#disc
  7317. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  7318. * 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.
  7319. * 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
  7320. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7321. * 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).
  7322. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7323. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7324. */
  7325. static CreateDisc(name: string, options: {
  7326. radius?: number;
  7327. tessellation?: number;
  7328. arc?: number;
  7329. updatable?: boolean;
  7330. sideOrientation?: number;
  7331. frontUVs?: Vector4;
  7332. backUVs?: Vector4;
  7333. }, scene: Scene): Mesh;
  7334. /**
  7335. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  7336. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#icosphere
  7337. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  7338. * 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`).
  7339. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  7340. * 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.
  7341. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7342. * 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).
  7343. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7344. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7345. */
  7346. static CreateIcoSphere(name: string, options: {
  7347. radius?: number;
  7348. radiusX?: number;
  7349. radiusY?: number;
  7350. radiusZ?: number;
  7351. flat?: boolean;
  7352. subdivisions?: number;
  7353. sideOrientation?: number;
  7354. frontUVs?: Vector4;
  7355. backUVs?: Vector4;
  7356. updatable?: boolean;
  7357. }, scene: Scene): Mesh;
  7358. /**
  7359. * Creates a ribbon mesh.
  7360. * 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.
  7361. *
  7362. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  7363. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  7364. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  7365. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  7366. * 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.
  7367. * 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.
  7368. * 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
  7369. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7370. * 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).
  7371. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7372. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7373. * 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.
  7374. * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values.
  7375. * 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
  7376. * if you set `closePath` to `true`, there's one extra vertex per path in the geometry.
  7377. * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time.
  7378. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7379. */
  7380. static CreateRibbon(name: string, options: {
  7381. pathArray: Vector3[][];
  7382. closeArray?: boolean;
  7383. closePath?: boolean;
  7384. offset?: number;
  7385. updatable?: boolean;
  7386. sideOrientation?: number;
  7387. frontUVs?: Vector4;
  7388. backUVs?: Vector4;
  7389. instance?: Mesh;
  7390. invertUV?: boolean;
  7391. uvs?: Vector2[];
  7392. colors?: Color4[];
  7393. }, scene?: Scene): Mesh;
  7394. /**
  7395. * Creates a cylinder or a cone mesh.
  7396. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#cylinder-or-cone
  7397. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  7398. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  7399. * 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.
  7400. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  7401. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  7402. * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.
  7403. * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.
  7404. * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.
  7405. * 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).
  7406. * 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
  7407. * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7
  7408. * 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
  7409. * 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.
  7410. * If `enclose` is false, a ring surface is one element.
  7411. * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
  7412. * 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
  7413. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7414. * 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).
  7415. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7416. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7417. */
  7418. static CreateCylinder(name: string, options: {
  7419. height?: number;
  7420. diameterTop?: number;
  7421. diameterBottom?: number;
  7422. diameter?: number;
  7423. tessellation?: number;
  7424. subdivisions?: number;
  7425. arc?: number;
  7426. faceColors?: Color4[];
  7427. faceUV?: Vector4[];
  7428. updatable?: boolean;
  7429. hasRings?: boolean;
  7430. enclose?: boolean;
  7431. sideOrientation?: number;
  7432. frontUVs?: Vector4;
  7433. backUVs?: Vector4;
  7434. }, scene: any): Mesh;
  7435. /**
  7436. * Creates a torus mesh.
  7437. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus
  7438. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  7439. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  7440. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  7441. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7442. * 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).
  7443. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7444. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7445. */
  7446. static CreateTorus(name: string, options: {
  7447. diameter?: number;
  7448. thickness?: number;
  7449. tessellation?: number;
  7450. updatable?: boolean;
  7451. sideOrientation?: number;
  7452. frontUVs?: Vector4;
  7453. backUVs?: Vector4;
  7454. }, scene: any): Mesh;
  7455. /**
  7456. * Creates a torus knot mesh.
  7457. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus-knot
  7458. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  7459. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  7460. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  7461. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  7462. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7463. * 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).
  7464. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7465. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7466. */
  7467. static CreateTorusKnot(name: string, options: {
  7468. radius?: number;
  7469. tube?: number;
  7470. radialSegments?: number;
  7471. tubularSegments?: number;
  7472. p?: number;
  7473. q?: number;
  7474. updatable?: boolean;
  7475. sideOrientation?: number;
  7476. frontUVs?: Vector4;
  7477. backUVs?: Vector4;
  7478. }, scene: any): Mesh;
  7479. /**
  7480. * Creates a line system mesh.
  7481. * A line system is a pool of many lines gathered in a single mesh.
  7482. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#linesystem
  7483. * 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.
  7484. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function.
  7485. * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
  7486. * 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
  7487. * 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
  7488. * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
  7489. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7490. */
  7491. static CreateLineSystem(name: string, options: {
  7492. lines: Vector3[][];
  7493. updatable: boolean;
  7494. instance?: LinesMesh;
  7495. }, scene: Scene): LinesMesh;
  7496. /**
  7497. * Creates a line mesh.
  7498. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lines
  7499. * 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.
  7500. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  7501. * The parameter `points` is an array successive Vector3.
  7502. * 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
  7503. * When updating an instance, remember that only point positions can change, not the number of points.
  7504. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7505. */
  7506. static CreateLines(name: string, options: {
  7507. points: Vector3[];
  7508. updatable?: boolean;
  7509. instance?: LinesMesh;
  7510. }, scene: Scene): LinesMesh;
  7511. /**
  7512. * Creates a dashed line mesh.
  7513. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#dashed-lines
  7514. * 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.
  7515. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  7516. * The parameter `points` is an array successive Vector3.
  7517. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  7518. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  7519. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  7520. * 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
  7521. * When updating an instance, remember that only point positions can change, not the number of points.
  7522. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7523. */
  7524. static CreateDashedLines(name: string, options: {
  7525. points: Vector3[];
  7526. dashSize?: number;
  7527. gapSize?: number;
  7528. dashNb?: number;
  7529. updatable?: boolean;
  7530. instance?: LinesMesh;
  7531. }, scene: Scene): LinesMesh;
  7532. /**
  7533. * Creates an extruded shape mesh.
  7534. * 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.
  7535. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#extruded-shapes
  7536. *
  7537. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  7538. * 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
  7539. * extruded along the Z axis.
  7540. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  7541. * 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.
  7542. * The parameter `scale` (float, default 1) is the value to scale the shape.
  7543. * 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
  7544. * 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
  7545. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  7546. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7547. * 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).
  7548. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7549. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7550. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7551. */
  7552. static ExtrudeShape(name: string, options: {
  7553. shape: Vector3[];
  7554. path: Vector3[];
  7555. scale?: number;
  7556. rotation?: number;
  7557. cap?: number;
  7558. updatable?: boolean;
  7559. sideOrientation?: number;
  7560. frontUVs?: Vector4;
  7561. backUVs?: Vector4;
  7562. instance?: Mesh;
  7563. invertUV?: boolean;
  7564. }, scene: Scene): Mesh;
  7565. /**
  7566. * Creates an custom extruded shape mesh.
  7567. * 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.
  7568. * tuto :http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#custom-extruded-shapes
  7569. *
  7570. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  7571. * 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
  7572. * extruded along the Z axis.
  7573. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  7574. * 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
  7575. * and the distance of this point from the begining of the path :
  7576. * ```javascript
  7577. * var rotationFunction = function(i, distance) {
  7578. * // do things
  7579. * return rotationValue; }
  7580. * ```
  7581. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  7582. * 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
  7583. * and the distance of this point from the begining of the path :
  7584. * ```javascript
  7585. * var scaleFunction = function(i, distance) {
  7586. * // do things
  7587. * return scaleValue;}
  7588. * ```
  7589. * It must returns a float value that will be the scale value applied to the shape on each path point.
  7590. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  7591. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  7592. * 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
  7593. * 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
  7594. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  7595. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7596. * 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).
  7597. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7598. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7599. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7600. */
  7601. static ExtrudeShapeCustom(name: string, options: {
  7602. shape: Vector3[];
  7603. path: Vector3[];
  7604. scaleFunction?: any;
  7605. rotationFunction?: any;
  7606. ribbonCloseArray?: boolean;
  7607. ribbonClosePath?: boolean;
  7608. cap?: number;
  7609. updatable?: boolean;
  7610. sideOrientation?: number;
  7611. frontUVs?: Vector4;
  7612. backUVs?: Vector4;
  7613. instance?: Mesh;
  7614. invertUV?: boolean;
  7615. }, scene: Scene): Mesh;
  7616. /**
  7617. * Creates lathe mesh.
  7618. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  7619. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lathe
  7620. *
  7621. * 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
  7622. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  7623. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  7624. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  7625. * 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.
  7626. * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
  7627. * 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
  7628. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7629. * 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).
  7630. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7631. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7632. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7633. */
  7634. static CreateLathe(name: string, options: {
  7635. shape: Vector3[];
  7636. radius?: number;
  7637. tessellation?: number;
  7638. arc?: number;
  7639. closed?: boolean;
  7640. updatable?: boolean;
  7641. sideOrientation?: number;
  7642. frontUVs?: Vector4;
  7643. backUVs?: Vector4;
  7644. cap?: number;
  7645. invertUV?: boolean;
  7646. }, scene: Scene): Mesh;
  7647. /**
  7648. * Creates a plane mesh.
  7649. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  7650. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  7651. * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value than `size`).
  7652. * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane.
  7653. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7654. * 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).
  7655. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7656. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7657. */
  7658. static CreatePlane(name: string, options: {
  7659. size?: number;
  7660. width?: number;
  7661. height?: number;
  7662. sideOrientation?: number;
  7663. frontUVs?: Vector4;
  7664. backUVs?: Vector4;
  7665. updatable?: boolean;
  7666. sourcePlane?: Plane;
  7667. }, scene: Scene): Mesh;
  7668. /**
  7669. * Creates a ground mesh.
  7670. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  7671. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  7672. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  7673. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7674. */
  7675. static CreateGround(name: string, options: {
  7676. width?: number;
  7677. height?: number;
  7678. subdivisions?: number;
  7679. subdivisionsX?: number;
  7680. subdivisionsY?: number;
  7681. updatable?: boolean;
  7682. }, scene: any): Mesh;
  7683. /**
  7684. * Creates a tiled ground mesh.
  7685. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tiled-ground
  7686. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  7687. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  7688. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  7689. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  7690. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  7691. * numbers of subdivisions on the ground width and height of each tile.
  7692. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7693. */
  7694. static CreateTiledGround(name: string, options: {
  7695. xmin: number;
  7696. zmin: number;
  7697. xmax: number;
  7698. zmax: number;
  7699. subdivisions?: {
  7700. w: number;
  7701. h: number;
  7702. };
  7703. precision?: {
  7704. w: number;
  7705. h: number;
  7706. };
  7707. updatable?: boolean;
  7708. }, scene: Scene): Mesh;
  7709. /**
  7710. * Creates a ground mesh from a height map.
  7711. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  7712. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#ground-from-a-height-map
  7713. * The parameter `url` sets the URL of the height map image resource.
  7714. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  7715. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  7716. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  7717. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  7718. * 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.
  7719. * 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).
  7720. * This function is passed the newly built mesh :
  7721. * ```javascript
  7722. * function(mesh) { // do things
  7723. * return; }
  7724. * ```
  7725. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7726. */
  7727. static CreateGroundFromHeightMap(name: string, url: string, options: {
  7728. width?: number;
  7729. height?: number;
  7730. subdivisions?: number;
  7731. minHeight?: number;
  7732. maxHeight?: number;
  7733. colorFilter?: Color3;
  7734. updatable?: boolean;
  7735. onReady?: (mesh: GroundMesh) => void;
  7736. }, scene: Scene): GroundMesh;
  7737. /**
  7738. * Creates a polygon mesh.
  7739. * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.
  7740. * 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.
  7741. * You can set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7742. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7743. * 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).
  7744. * Remember you can only change the shape positions, not their number when updating a polygon.
  7745. */
  7746. static CreatePolygon(name: string, options: {
  7747. shape: Vector3[];
  7748. holes?: Vector3[][];
  7749. depth?: number;
  7750. faceUV?: Vector4[];
  7751. faceColors?: Color4[];
  7752. updatable?: boolean;
  7753. sideOrientation?: number;
  7754. frontUVs?: Vector4;
  7755. backUVs?: Vector4;
  7756. }, scene: Scene): Mesh;
  7757. /**
  7758. * Creates an extruded polygon mesh, with depth in the Y direction.
  7759. * 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).
  7760. * Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  7761. */
  7762. static ExtrudePolygon(name: string, options: {
  7763. shape: Vector3[];
  7764. holes?: Vector3[][];
  7765. depth?: number;
  7766. faceUV?: Vector4[];
  7767. faceColors?: Color4[];
  7768. updatable?: boolean;
  7769. sideOrientation?: number;
  7770. frontUVs?: Vector4;
  7771. backUVs?: Vector4;
  7772. }, scene: Scene): Mesh;
  7773. /**
  7774. * Creates a tube mesh.
  7775. * 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.
  7776. *
  7777. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tube
  7778. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  7779. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  7780. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  7781. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  7782. * 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.
  7783. * It must return a radius value (positive float) :
  7784. * ```javascript
  7785. * var radiusFunction = function(i, distance) {
  7786. * // do things
  7787. * return radius; }
  7788. * ```
  7789. * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc.
  7790. * 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
  7791. * 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
  7792. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7793. * 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).
  7794. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7795. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7796. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7797. */
  7798. static CreateTube(name: string, options: {
  7799. path: Vector3[];
  7800. radius?: number;
  7801. tessellation?: number;
  7802. radiusFunction?: {
  7803. (i: number, distance: number): number;
  7804. };
  7805. cap?: number;
  7806. arc?: number;
  7807. updatable?: boolean;
  7808. sideOrientation?: number;
  7809. frontUVs?: Vector4;
  7810. backUVs?: Vector4;
  7811. instance?: Mesh;
  7812. invertUV?: boolean;
  7813. }, scene: Scene): Mesh;
  7814. /**
  7815. * Creates a polyhedron mesh.
  7816. *
  7817. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#polyhedron
  7818. * 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
  7819. * to choose the wanted type.
  7820. * The parameter `size` (positive float, default 1) sets the polygon size.
  7821. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  7822. * 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`.
  7823. * 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
  7824. * 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)`).
  7825. * 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
  7826. * 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.
  7827. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7828. * 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).
  7829. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7830. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7831. */
  7832. static CreatePolyhedron(name: string, options: {
  7833. type?: number;
  7834. size?: number;
  7835. sizeX?: number;
  7836. sizeY?: number;
  7837. sizeZ?: number;
  7838. custom?: any;
  7839. faceUV?: Vector4[];
  7840. faceColors?: Color4[];
  7841. flat?: boolean;
  7842. updatable?: boolean;
  7843. sideOrientation?: number;
  7844. frontUVs?: Vector4;
  7845. backUVs?: Vector4;
  7846. }, scene: Scene): Mesh;
  7847. /**
  7848. * Creates a decal mesh.
  7849. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#decals
  7850. * 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.
  7851. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  7852. * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates.
  7853. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  7854. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  7855. */
  7856. static CreateDecal(name: string, sourceMesh: AbstractMesh, options: {
  7857. position?: Vector3;
  7858. normal?: Vector3;
  7859. size?: Vector3;
  7860. angle?: number;
  7861. }): Mesh;
  7862. }
  7863. }
  7864. declare module BABYLON.Internals {
  7865. class MeshLODLevel {
  7866. distance: number;
  7867. mesh: Mesh;
  7868. constructor(distance: number, mesh: Mesh);
  7869. }
  7870. }
  7871. declare module BABYLON {
  7872. /**
  7873. * A simplifier interface for future simplification implementations.
  7874. */
  7875. interface ISimplifier {
  7876. /**
  7877. * Simplification of a given mesh according to the given settings.
  7878. * Since this requires computation, it is assumed that the function runs async.
  7879. * @param settings The settings of the simplification, including quality and distance
  7880. * @param successCallback A callback that will be called after the mesh was simplified.
  7881. * @param errorCallback in case of an error, this callback will be called. optional.
  7882. */
  7883. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void;
  7884. }
  7885. /**
  7886. * Expected simplification settings.
  7887. * Quality should be between 0 and 1 (1 being 100%, 0 being 0%);
  7888. */
  7889. interface ISimplificationSettings {
  7890. quality: number;
  7891. distance: number;
  7892. optimizeMesh?: boolean;
  7893. }
  7894. class SimplificationSettings implements ISimplificationSettings {
  7895. quality: number;
  7896. distance: number;
  7897. optimizeMesh: boolean;
  7898. constructor(quality: number, distance: number, optimizeMesh?: boolean);
  7899. }
  7900. interface ISimplificationTask {
  7901. settings: Array<ISimplificationSettings>;
  7902. simplificationType: SimplificationType;
  7903. mesh: Mesh;
  7904. successCallback?: () => void;
  7905. parallelProcessing: boolean;
  7906. }
  7907. class SimplificationQueue {
  7908. running: any;
  7909. constructor();
  7910. addTask(task: ISimplificationTask): void;
  7911. executeNext(): void;
  7912. runSimplification(task: ISimplificationTask): void;
  7913. private getSimplifier(task);
  7914. }
  7915. /**
  7916. * The implemented types of simplification.
  7917. * At the moment only Quadratic Error Decimation is implemented.
  7918. */
  7919. enum SimplificationType {
  7920. QUADRATIC = 0,
  7921. }
  7922. class DecimationTriangle {
  7923. vertices: Array<DecimationVertex>;
  7924. normal: Vector3;
  7925. error: Array<number>;
  7926. deleted: boolean;
  7927. isDirty: boolean;
  7928. borderFactor: number;
  7929. deletePending: boolean;
  7930. originalOffset: number;
  7931. constructor(vertices: Array<DecimationVertex>);
  7932. }
  7933. class DecimationVertex {
  7934. position: Vector3;
  7935. id: any;
  7936. q: QuadraticMatrix;
  7937. isBorder: boolean;
  7938. triangleStart: number;
  7939. triangleCount: number;
  7940. originalOffsets: Array<number>;
  7941. constructor(position: Vector3, id: any);
  7942. updatePosition(newPosition: Vector3): void;
  7943. }
  7944. class QuadraticMatrix {
  7945. data: Array<number>;
  7946. constructor(data?: Array<number>);
  7947. det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number;
  7948. addInPlace(matrix: QuadraticMatrix): void;
  7949. addArrayInPlace(data: Array<number>): void;
  7950. add(matrix: QuadraticMatrix): QuadraticMatrix;
  7951. static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix;
  7952. static DataFromNumbers(a: number, b: number, c: number, d: number): number[];
  7953. }
  7954. class Reference {
  7955. vertexId: number;
  7956. triangleId: number;
  7957. constructor(vertexId: number, triangleId: number);
  7958. }
  7959. /**
  7960. * An implementation of the Quadratic Error simplification algorithm.
  7961. * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf
  7962. * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS
  7963. * @author RaananW
  7964. */
  7965. class QuadraticErrorSimplification implements ISimplifier {
  7966. private triangles;
  7967. private vertices;
  7968. private references;
  7969. private initialized;
  7970. syncIterations: number;
  7971. aggressiveness: number;
  7972. decimationIterations: number;
  7973. boundingBoxEpsilon: number;
  7974. constructor(_mesh: Mesh);
  7975. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void;
  7976. private isTriangleOnBoundingBox(triangle);
  7977. private runDecimation(settings, submeshIndex, successCallback);
  7978. private initWithMesh(submeshIndex, callback, optimizeMesh?);
  7979. private init(callback);
  7980. private reconstructMesh(submeshIndex);
  7981. private initDecimatedMesh();
  7982. private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr);
  7983. private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles);
  7984. private identifyBorder();
  7985. private updateMesh(identifyBorders?);
  7986. private vertexError(q, point);
  7987. private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?);
  7988. }
  7989. }
  7990. declare module BABYLON {
  7991. class Polygon {
  7992. static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[];
  7993. static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[];
  7994. static Parse(input: string): Vector2[];
  7995. static StartingAt(x: number, y: number): Path2;
  7996. }
  7997. class PolygonMeshBuilder {
  7998. constructor(name: string, contours: Path2, scene: Scene);
  7999. constructor(name: string, contours: Vector2[], scene: Scene);
  8000. addHole(hole: Vector2[]): PolygonMeshBuilder;
  8001. build(updatable?: boolean, depth?: number): Mesh;
  8002. private addSide(positions, normals, uvs, indices, bounds, points, depth, flip);
  8003. }
  8004. }
  8005. declare module BABYLON {
  8006. class SubMesh implements ICullable {
  8007. materialIndex: number;
  8008. verticesStart: number;
  8009. verticesCount: number;
  8010. indexStart: any;
  8011. indexCount: number;
  8012. linesIndexCount: number;
  8013. readonly effect: Effect;
  8014. setEffect(effect: Effect, defines?: MaterialDefines): void;
  8015. constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
  8016. readonly IsGlobal: boolean;
  8017. /**
  8018. * Returns the submesh BoudingInfo object.
  8019. */
  8020. getBoundingInfo(): BoundingInfo;
  8021. /**
  8022. * Sets the submesh BoundingInfo.
  8023. * Return the SubMesh.
  8024. */
  8025. setBoundingInfo(boundingInfo: BoundingInfo): SubMesh;
  8026. /**
  8027. * Returns the mesh of the current submesh.
  8028. */
  8029. getMesh(): AbstractMesh;
  8030. /**
  8031. * Returns the rendering mesh of the submesh.
  8032. */
  8033. getRenderingMesh(): Mesh;
  8034. /**
  8035. * Returns the submesh material.
  8036. */
  8037. getMaterial(): Material;
  8038. /**
  8039. * Sets a new updated BoundingInfo object to the submesh.
  8040. * Returns the SubMesh.
  8041. */
  8042. refreshBoundingInfo(): SubMesh;
  8043. /**
  8044. * Updates the submesh BoundingInfo.
  8045. * Returns the Submesh.
  8046. */
  8047. updateBoundingInfo(world: Matrix): SubMesh;
  8048. /**
  8049. * True is the submesh bounding box intersects the frustum defined by the passed array of planes.
  8050. * Boolean returned.
  8051. */
  8052. isInFrustum(frustumPlanes: Plane[]): boolean;
  8053. /**
  8054. * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes.
  8055. * Boolean returned.
  8056. */
  8057. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  8058. /**
  8059. * Renders the submesh.
  8060. * Returns it.
  8061. */
  8062. render(enableAlphaMode: boolean): SubMesh;
  8063. /**
  8064. * Returns a new Index Buffer.
  8065. * Type returned : WebGLBuffer.
  8066. */
  8067. getLinesIndexBuffer(indices: IndicesArray, engine: Engine): WebGLBuffer;
  8068. /**
  8069. * True is the passed Ray intersects the submesh bounding box.
  8070. * Boolean returned.
  8071. */
  8072. canIntersects(ray: Ray): boolean;
  8073. /**
  8074. * Returns an object IntersectionInfo.
  8075. */
  8076. intersects(ray: Ray, positions: Vector3[], indices: IndicesArray, fastCheck?: boolean): IntersectionInfo;
  8077. /**
  8078. * Creates a new Submesh from the passed Mesh.
  8079. */
  8080. clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
  8081. /**
  8082. * Disposes the Submesh.
  8083. * Returns nothing.
  8084. */
  8085. dispose(): void;
  8086. /**
  8087. * Creates a new Submesh from the passed parameters :
  8088. * - materialIndex (integer) : the index of the main mesh material.
  8089. * - startIndex (integer) : the index where to start the copy in the mesh indices array.
  8090. * - indexCount (integer) : the number of indices to copy then from the startIndex.
  8091. * - mesh (Mesh) : the main mesh to create the submesh from.
  8092. * - renderingMesh (optional Mesh) : rendering mesh.
  8093. */
  8094. static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
  8095. }
  8096. }
  8097. declare module BABYLON {
  8098. class VertexBuffer {
  8099. constructor(engine: any, data: number[] | Float32Array | Buffer, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number, instanced?: boolean, offset?: number, size?: number);
  8100. /**
  8101. * Returns the kind of the VertexBuffer (string).
  8102. */
  8103. getKind(): string;
  8104. /**
  8105. * Boolean : is the VertexBuffer updatable ?
  8106. */
  8107. isUpdatable(): boolean;
  8108. /**
  8109. * Returns an array of numbers or a Float32Array containing the VertexBuffer data.
  8110. */
  8111. getData(): number[] | Float32Array;
  8112. /**
  8113. * Returns the WebGLBuffer associated to the VertexBuffer.
  8114. */
  8115. getBuffer(): WebGLBuffer;
  8116. /**
  8117. * Returns the stride of the VertexBuffer (integer).
  8118. */
  8119. getStrideSize(): number;
  8120. /**
  8121. * Returns the offset (integer).
  8122. */
  8123. getOffset(): number;
  8124. /**
  8125. * Returns the VertexBuffer total size (integer).
  8126. */
  8127. getSize(): number;
  8128. /**
  8129. * Boolean : is the WebGLBuffer of the VertexBuffer instanced now ?
  8130. */
  8131. getIsInstanced(): boolean;
  8132. /**
  8133. * Creates the underlying WebGLBuffer from the passed numeric array or Float32Array.
  8134. * Returns the created WebGLBuffer.
  8135. */
  8136. create(data?: number[] | Float32Array): void;
  8137. /**
  8138. * Updates the underlying WebGLBuffer according to the passed numeric array or Float32Array.
  8139. * Returns the updated WebGLBuffer.
  8140. */
  8141. update(data: number[] | Float32Array): void;
  8142. /**
  8143. * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.
  8144. * Returns the directly updated WebGLBuffer.
  8145. */
  8146. updateDirectly(data: Float32Array, offset: number): void;
  8147. /**
  8148. * Disposes the VertexBuffer and the underlying WebGLBuffer.
  8149. */
  8150. dispose(): void;
  8151. static readonly PositionKind: string;
  8152. static readonly NormalKind: string;
  8153. static readonly TangentKind: string;
  8154. static readonly UVKind: string;
  8155. static readonly UV2Kind: string;
  8156. static readonly UV3Kind: string;
  8157. static readonly UV4Kind: string;
  8158. static readonly UV5Kind: string;
  8159. static readonly UV6Kind: string;
  8160. static readonly ColorKind: string;
  8161. static readonly MatricesIndicesKind: string;
  8162. static readonly MatricesWeightsKind: string;
  8163. static readonly MatricesIndicesExtraKind: string;
  8164. static readonly MatricesWeightsExtraKind: string;
  8165. }
  8166. }
  8167. declare module BABYLON {
  8168. class SIMDHelper {
  8169. static readonly IsEnabled: boolean;
  8170. static DisableSIMD(): void;
  8171. static EnableSIMD(): void;
  8172. }
  8173. }
  8174. declare module BABYLON {
  8175. const ToGammaSpace: number;
  8176. const ToLinearSpace = 2.2;
  8177. const Epsilon = 0.001;
  8178. class MathTools {
  8179. /**
  8180. * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
  8181. */
  8182. static WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
  8183. /**
  8184. * Returns a string : the upper case translation of the number i to hexadecimal.
  8185. */
  8186. static ToHex(i: number): string;
  8187. /**
  8188. * Returns -1 if value is negative and +1 is value is positive.
  8189. * Returns the value itself if it's equal to zero.
  8190. */
  8191. static Sign(value: number): number;
  8192. /**
  8193. * Returns the value itself if it's between min and max.
  8194. * Returns min if the value is lower than min.
  8195. * Returns max if the value is greater than max.
  8196. */
  8197. static Clamp(value: number, min?: number, max?: number): number;
  8198. }
  8199. class Scalar {
  8200. /**
  8201. * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
  8202. */
  8203. static Lerp(start: number, end: number, amount: number): number;
  8204. /**
  8205. * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
  8206. */
  8207. static Hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number;
  8208. }
  8209. class Color3 {
  8210. r: number;
  8211. g: number;
  8212. b: number;
  8213. /**
  8214. * Creates a new Color3 object from red, green, blue values, all between 0 and 1.
  8215. */
  8216. constructor(r?: number, g?: number, b?: number);
  8217. /**
  8218. * Returns a string with the Color3 current values.
  8219. */
  8220. toString(): string;
  8221. /**
  8222. * Returns the string "Color3".
  8223. */
  8224. getClassName(): string;
  8225. /**
  8226. * Returns the Color3 hash code.
  8227. */
  8228. getHashCode(): number;
  8229. /**
  8230. * Stores in the passed array from the passed starting index the red, green, blue values as successive elements.
  8231. * Returns the Color3.
  8232. */
  8233. toArray(array: number[] | Float32Array, index?: number): Color3;
  8234. /**
  8235. * Returns a new Color4 object from the current Color3 and the passed alpha.
  8236. */
  8237. toColor4(alpha?: number): Color4;
  8238. /**
  8239. * Returns a new array populated with 3 numeric elements : red, green and blue values.
  8240. */
  8241. asArray(): number[];
  8242. /**
  8243. * Returns the luminance value (float).
  8244. */
  8245. toLuminance(): number;
  8246. /**
  8247. * Multiply each Color3 rgb values by the passed Color3 rgb values in a new Color3 object.
  8248. * Returns this new object.
  8249. */
  8250. multiply(otherColor: Color3): Color3;
  8251. /**
  8252. * Multiply the rgb values of the Color3 and the passed Color3 and stores the result in the object "result".
  8253. * Returns the current Color3.
  8254. */
  8255. multiplyToRef(otherColor: Color3, result: Color3): Color3;
  8256. /**
  8257. * Boolean : True if the rgb values are equal to the passed ones.
  8258. */
  8259. equals(otherColor: Color3): boolean;
  8260. /**
  8261. * Boolean : True if the rgb values are equal to the passed ones.
  8262. */
  8263. equalsFloats(r: number, g: number, b: number): boolean;
  8264. /**
  8265. * Multiplies in place each rgb value by scale.
  8266. * Returns the updated Color3.
  8267. */
  8268. scale(scale: number): Color3;
  8269. /**
  8270. * Multiplies the rgb values by scale and stores the result into "result".
  8271. * Returns the unmodified current Color3.
  8272. */
  8273. scaleToRef(scale: number, result: Color3): Color3;
  8274. /**
  8275. * Returns a new Color3 set with the added values of the current Color3 and of the passed one.
  8276. */
  8277. add(otherColor: Color3): Color3;
  8278. /**
  8279. * Stores the result of the addition of the current Color3 and passed one rgb values into "result".
  8280. * Returns the unmodified current Color3.
  8281. */
  8282. addToRef(otherColor: Color3, result: Color3): Color3;
  8283. /**
  8284. * Returns a new Color3 set with the subtracted values of the passed one from the current Color3 .
  8285. */
  8286. subtract(otherColor: Color3): Color3;
  8287. /**
  8288. * Stores the result of the subtraction of passed one from the current Color3 rgb values into "result".
  8289. * Returns the unmodified current Color3.
  8290. */
  8291. subtractToRef(otherColor: Color3, result: Color3): Color3;
  8292. /**
  8293. * Returns a new Color3 copied the current one.
  8294. */
  8295. clone(): Color3;
  8296. /**
  8297. * Copies the rgb values from the source in the current Color3.
  8298. * Returns the updated Color3.
  8299. */
  8300. copyFrom(source: Color3): Color3;
  8301. /**
  8302. * Updates the Color3 rgb values from the passed floats.
  8303. * Returns the Color3.
  8304. */
  8305. copyFromFloats(r: number, g: number, b: number): Color3;
  8306. /**
  8307. * Updates the Color3 rgb values from the passed floats.
  8308. * Returns the Color3.
  8309. */
  8310. set(r: number, g: number, b: number): Color3;
  8311. /**
  8312. * Returns the Color3 hexadecimal code as a string.
  8313. */
  8314. toHexString(): string;
  8315. /**
  8316. * Returns a new Color3 converted to linear space.
  8317. */
  8318. toLinearSpace(): Color3;
  8319. /**
  8320. * Converts the Color3 values to linear space and stores the result in "convertedColor".
  8321. * Returns the unmodified Color3.
  8322. */
  8323. toLinearSpaceToRef(convertedColor: Color3): Color3;
  8324. /**
  8325. * Returns a new Color3 converted to gamma space.
  8326. */
  8327. toGammaSpace(): Color3;
  8328. /**
  8329. * Converts the Color3 values to gamma space and stores the result in "convertedColor".
  8330. * Returns the unmodified Color3.
  8331. */
  8332. toGammaSpaceToRef(convertedColor: Color3): Color3;
  8333. /**
  8334. * Creates a new Color3 from the string containing valid hexadecimal values.
  8335. */
  8336. static FromHexString(hex: string): Color3;
  8337. /**
  8338. * Creates a new Vector3 from the startind index of the passed array.
  8339. */
  8340. static FromArray(array: ArrayLike<number>, offset?: number): Color3;
  8341. /**
  8342. * Creates a new Color3 from integer values ( < 256).
  8343. */
  8344. static FromInts(r: number, g: number, b: number): Color3;
  8345. /**
  8346. * Creates a new Color3 with values linearly interpolated of "amount" between the start Color3 and the end Color3.
  8347. */
  8348. static Lerp(start: Color3, end: Color3, amount: number): Color3;
  8349. static Red(): Color3;
  8350. static Green(): Color3;
  8351. static Blue(): Color3;
  8352. static Black(): Color3;
  8353. static White(): Color3;
  8354. static Purple(): Color3;
  8355. static Magenta(): Color3;
  8356. static Yellow(): Color3;
  8357. static Gray(): Color3;
  8358. static Random(): Color3;
  8359. }
  8360. class Color4 {
  8361. r: number;
  8362. g: number;
  8363. b: number;
  8364. a: number;
  8365. /**
  8366. * Creates a new Color4 object from the passed float values ( < 1) : red, green, blue, alpha.
  8367. */
  8368. constructor(r: number, g: number, b: number, a: number);
  8369. /**
  8370. * Adds in place the passed Color4 values to the current Color4.
  8371. * Returns the updated Color4.
  8372. */
  8373. addInPlace(right: any): Color4;
  8374. /**
  8375. * Returns a new array populated with 4 numeric elements : red, green, blue, alpha values.
  8376. */
  8377. asArray(): number[];
  8378. /**
  8379. * Stores from the starting index in the passed array the Color4 successive values.
  8380. * Returns the Color4.
  8381. */
  8382. toArray(array: number[], index?: number): Color4;
  8383. /**
  8384. * Returns a new Color4 set with the added values of the current Color4 and of the passed one.
  8385. */
  8386. add(right: Color4): Color4;
  8387. /**
  8388. * Returns a new Color4 set with the subtracted values of the passed one from the current Color4.
  8389. */
  8390. subtract(right: Color4): Color4;
  8391. /**
  8392. * Subtracts the passed ones from the current Color4 values and stores the results in "result".
  8393. * Returns the Color4.
  8394. */
  8395. subtractToRef(right: Color4, result: Color4): Color4;
  8396. /**
  8397. * Creates a new Color4 with the current Color4 values multiplied by scale.
  8398. */
  8399. scale(scale: number): Color4;
  8400. /**
  8401. * Multiplies the current Color4 values by scale and stores the result in "result".
  8402. * Returns the Color4.
  8403. */
  8404. scaleToRef(scale: number, result: Color4): Color4;
  8405. /**
  8406. * Multipy an RGBA Color4 value by another and return a new Color4 object
  8407. * @param color The Color4 (RGBA) value to multiply by
  8408. * @returns A new Color4.
  8409. */
  8410. multiply(color: Color4): Color4;
  8411. /**
  8412. * Multipy an RGBA Color4 value by another and push the result in a reference value
  8413. * @param color The Color4 (RGBA) value to multiply by
  8414. * @param result The Color4 (RGBA) to fill the result in
  8415. * @returns the result Color4.
  8416. */
  8417. multiplyToRef(color: Color4, result: Color4): Color4;
  8418. /**
  8419. * Returns a string with the Color4 values.
  8420. */
  8421. toString(): string;
  8422. /**
  8423. * Returns the string "Color4"
  8424. */
  8425. getClassName(): string;
  8426. /**
  8427. * Return the Color4 hash code as a number.
  8428. */
  8429. getHashCode(): number;
  8430. /**
  8431. * Creates a new Color4 copied from the current one.
  8432. */
  8433. clone(): Color4;
  8434. /**
  8435. * Copies the passed Color4 values into the current one.
  8436. * Returns the updated Color4.
  8437. */
  8438. copyFrom(source: Color4): Color4;
  8439. /**
  8440. * Copies the passed float values into the current one.
  8441. * Returns the updated Color4.
  8442. */
  8443. copyFromFloats(r: number, g: number, b: number, a: number): Color4;
  8444. /**
  8445. * Copies the passed float values into the current one.
  8446. * Returns the updated Color4.
  8447. */
  8448. set(r: number, g: number, b: number, a: number): Color4;
  8449. /**
  8450. * Returns a string containing the hexadecimal Color4 code.
  8451. */
  8452. toHexString(): string;
  8453. /**
  8454. * Creates a new Color4 from the valid hexadecimal value contained in the passed string.
  8455. */
  8456. static FromHexString(hex: string): Color4;
  8457. /**
  8458. * Creates a new Color4 object set with the linearly interpolated values of "amount" between the left Color4 and the right Color4.
  8459. */
  8460. static Lerp(left: Color4, right: Color4, amount: number): Color4;
  8461. /**
  8462. * Set the passed "result" with the linearly interpolated values of "amount" between the left Color4 and the right Color4.
  8463. */
  8464. static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
  8465. /**
  8466. * Creates a new Color4 from the starting index element of the passed array.
  8467. */
  8468. static FromArray(array: ArrayLike<number>, offset?: number): Color4;
  8469. /**
  8470. * Creates a new Color4 from the passed integers ( < 256 ).
  8471. */
  8472. static FromInts(r: number, g: number, b: number, a: number): Color4;
  8473. static CheckColors4(colors: number[], count: number): number[];
  8474. }
  8475. class Vector2 {
  8476. x: number;
  8477. y: number;
  8478. /**
  8479. * Creates a new Vector2 from the passed x and y coordinates.
  8480. */
  8481. constructor(x: number, y: number);
  8482. /**
  8483. * Returns a string with the Vector2 coordinates.
  8484. */
  8485. toString(): string;
  8486. /**
  8487. * Returns the string "Vector2"
  8488. */
  8489. getClassName(): string;
  8490. /**
  8491. * Returns the Vector2 hash code as a number.
  8492. */
  8493. getHashCode(): number;
  8494. /**
  8495. * Sets the Vector2 coordinates in the passed array or Float32Array from the passed index.
  8496. * Returns the Vector2.
  8497. */
  8498. toArray(array: number[] | Float32Array, index?: number): Vector2;
  8499. /**
  8500. * Returns a new array with 2 elements : the Vector2 coordinates.
  8501. */
  8502. asArray(): number[];
  8503. /**
  8504. * Sets the Vector2 coordinates with the passed Vector2 coordinates.
  8505. * Returns the updated Vector2.
  8506. */
  8507. copyFrom(source: Vector2): Vector2;
  8508. /**
  8509. * Sets the Vector2 coordinates with the passed floats.
  8510. * Returns the updated Vector2.
  8511. */
  8512. copyFromFloats(x: number, y: number): Vector2;
  8513. /**
  8514. * Sets the Vector2 coordinates with the passed floats.
  8515. * Returns the updated Vector2.
  8516. */
  8517. set(x: number, y: number): Vector2;
  8518. /**
  8519. * Returns a new Vector2 set with the addition of the current Vector2 and the passed one coordinates.
  8520. */
  8521. add(otherVector: Vector2): Vector2;
  8522. /**
  8523. * Sets the "result" coordinates with the addition of the current Vector2 and the passed one coordinates.
  8524. * Returns the Vector2.
  8525. */
  8526. addToRef(otherVector: Vector2, result: Vector2): Vector2;
  8527. /**
  8528. * Set the Vector2 coordinates by adding the passed Vector2 coordinates.
  8529. * Returns the updated Vector2.
  8530. */
  8531. addInPlace(otherVector: Vector2): Vector2;
  8532. /**
  8533. * Returns a new Vector2 by adding the current Vector2 coordinates to the passed Vector3 x, y coordinates.
  8534. */
  8535. addVector3(otherVector: Vector3): Vector2;
  8536. /**
  8537. * Returns a new Vector2 set with the subtracted coordinates of the passed one from the current Vector2.
  8538. */
  8539. subtract(otherVector: Vector2): Vector2;
  8540. /**
  8541. * Sets the "result" coordinates with the subtraction of the passed one from the current Vector2 coordinates.
  8542. * Returns the Vector2.
  8543. */
  8544. subtractToRef(otherVector: Vector2, result: Vector2): Vector2;
  8545. /**
  8546. * Sets the current Vector2 coordinates by subtracting from it the passed one coordinates.
  8547. * Returns the updated Vector2.
  8548. */
  8549. subtractInPlace(otherVector: Vector2): Vector2;
  8550. /**
  8551. * Multiplies in place the current Vector2 coordinates by the passed ones.
  8552. * Returns the updated Vector2.
  8553. */
  8554. multiplyInPlace(otherVector: Vector2): Vector2;
  8555. /**
  8556. * Returns a new Vector2 set with the multiplication of the current Vector2 and the passed one coordinates.
  8557. */
  8558. multiply(otherVector: Vector2): Vector2;
  8559. /**
  8560. * Sets "result" coordinates with the multiplication of the current Vector2 and the passed one coordinates.
  8561. * Returns the Vector2.
  8562. */
  8563. multiplyToRef(otherVector: Vector2, result: Vector2): Vector2;
  8564. /**
  8565. * Returns a new Vector2 set with the Vector2 coordinates multiplied by the passed floats.
  8566. */
  8567. multiplyByFloats(x: number, y: number): Vector2;
  8568. /**
  8569. * Returns a new Vector2 set with the Vector2 coordinates divided by the passed one coordinates.
  8570. */
  8571. divide(otherVector: Vector2): Vector2;
  8572. /**
  8573. * Sets the "result" coordinates with the Vector2 divided by the passed one coordinates.
  8574. * Returns the Vector2.
  8575. */
  8576. divideToRef(otherVector: Vector2, result: Vector2): Vector2;
  8577. /**
  8578. * Returns a new Vector2 with current Vector2 negated coordinates.
  8579. */
  8580. negate(): Vector2;
  8581. /**
  8582. * Multiply the Vector2 coordinates by scale.
  8583. * Returns the updated Vector2.
  8584. */
  8585. scaleInPlace(scale: number): Vector2;
  8586. /**
  8587. * Returns a new Vector2 scaled by "scale" from the current Vector2.
  8588. */
  8589. scale(scale: number): Vector2;
  8590. /**
  8591. * Boolean : True if the passed vector coordinates strictly equal the current Vector2 ones.
  8592. */
  8593. equals(otherVector: Vector2): boolean;
  8594. /**
  8595. * Boolean : True if the passed vector coordinates are close to the current ones by a distance of epsilon.
  8596. */
  8597. equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean;
  8598. /**
  8599. * Returns the vector length (float).
  8600. */
  8601. length(): number;
  8602. /**
  8603. * Returns the vector squared length (float);
  8604. */
  8605. lengthSquared(): number;
  8606. /**
  8607. * Normalize the vector.
  8608. * Returns the updated Vector2.
  8609. */
  8610. normalize(): Vector2;
  8611. /**
  8612. * Returns a new Vector2 copied from the Vector2.
  8613. */
  8614. clone(): Vector2;
  8615. /**
  8616. * Returns a new Vector2(0, 0)
  8617. */
  8618. static Zero(): Vector2;
  8619. /**
  8620. * Returns a new Vector2(1, 1)
  8621. */
  8622. static One(): Vector2;
  8623. /**
  8624. * Returns a new Vector2 set from the passed index element of the passed array.
  8625. */
  8626. static FromArray(array: ArrayLike<number>, offset?: number): Vector2;
  8627. /**
  8628. * Sets "result" from the passed index element of the passed array.
  8629. */
  8630. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector2): void;
  8631. /**
  8632. * Retuns a new Vector2 located for "amount" (float) on the CatmullRom spline defined by the passed four Vector2.
  8633. */
  8634. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  8635. /**
  8636. * 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".
  8637. * If a coordinate of "value" is lower than "min" coordinates, the returned Vector2 is given this "min" coordinate.
  8638. * If a coordinate of "value" is greater than "max" coordinates, the returned Vector2 is given this "max" coordinate.
  8639. */
  8640. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  8641. /**
  8642. * Returns a new Vector2 located for "amount" (float) on the Hermite spline defined by the vectors "value1", "value3", "tangent1", "tangent2".
  8643. */
  8644. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  8645. /**
  8646. * Returns a new Vector2 located for "amount" (float) on the linear interpolation between the vector "start" adn the vector "end".
  8647. */
  8648. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  8649. /**
  8650. * Returns the dot product (float) of the vector "left" and the vector "right".
  8651. */
  8652. static Dot(left: Vector2, right: Vector2): number;
  8653. /**
  8654. * Returns a new Vector2 equal to the normalized passed vector.
  8655. */
  8656. static Normalize(vector: Vector2): Vector2;
  8657. /**
  8658. * Returns a new Vecto2 set with the minimal coordinate values from the "left" and "right" vectors.
  8659. */
  8660. static Minimize(left: Vector2, right: Vector2): Vector2;
  8661. /**
  8662. * Returns a new Vecto2 set with the maximal coordinate values from the "left" and "right" vectors.
  8663. */
  8664. static Maximize(left: Vector2, right: Vector2): Vector2;
  8665. /**
  8666. * Returns a new Vecto2 set with the transformed coordinates of the passed vector by the passed transformation matrix.
  8667. */
  8668. static Transform(vector: Vector2, transformation: Matrix): Vector2;
  8669. /**
  8670. * Transforms the passed vector coordinates by the passed transformation matrix and stores the result in the vector "result" coordinates.
  8671. */
  8672. static TransformToRef(vector: Vector2, transformation: Matrix, result: Vector2): void;
  8673. /**
  8674. * Boolean : True if the point "p" is in the triangle defined by the vertors "p0", "p1", "p2"
  8675. */
  8676. static PointInTriangle(p: Vector2, p0: Vector2, p1: Vector2, p2: Vector2): boolean;
  8677. /**
  8678. * Returns the distance (float) between the vectors "value1" and "value2".
  8679. */
  8680. static Distance(value1: Vector2, value2: Vector2): number;
  8681. /**
  8682. * Returns the squared distance (float) between the vectors "value1" and "value2".
  8683. */
  8684. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  8685. /**
  8686. * Returns a new Vecto2 located at the center of the vectors "value1" and "value2".
  8687. */
  8688. static Center(value1: Vector2, value2: Vector2): Vector2;
  8689. /**
  8690. * Returns the shortest distance (float) between the point "p" and the segment defined by the two points "segA" and "segB".
  8691. */
  8692. static DistanceOfPointFromSegment(p: Vector2, segA: Vector2, segB: Vector2): number;
  8693. }
  8694. class Vector3 {
  8695. x: number;
  8696. y: number;
  8697. z: number;
  8698. /**
  8699. * Creates a new Vector3 object from the passed x, y, z (floats) coordinates.
  8700. * A Vector3 is the main object used in 3D geometry.
  8701. * It can represent etiher the coordinates of a point the space, either a direction.
  8702. */
  8703. constructor(x: number, y: number, z: number);
  8704. /**
  8705. * Returns a string with the Vector3 coordinates.
  8706. */
  8707. toString(): string;
  8708. /**
  8709. * Returns the string "Vector3"
  8710. */
  8711. getClassName(): string;
  8712. /**
  8713. * Returns the Vector hash code.
  8714. */
  8715. getHashCode(): number;
  8716. /**
  8717. * Returns a new array with three elements : the coordinates the Vector3.
  8718. */
  8719. asArray(): number[];
  8720. /**
  8721. * Populates the passed array or Float32Array from the passed index with the successive coordinates of the Vector3.
  8722. * Returns the Vector3.
  8723. */
  8724. toArray(array: number[] | Float32Array, index?: number): Vector3;
  8725. /**
  8726. * Returns a new Quaternion object, computed from the Vector3 coordinates.
  8727. */
  8728. toQuaternion(): Quaternion;
  8729. /**
  8730. * Adds the passed vector to the current Vector3.
  8731. * Returns the updated Vector3.
  8732. */
  8733. addInPlace(otherVector: Vector3): Vector3;
  8734. /**
  8735. * Returns a new Vector3, result of the addition the current Vector3 and the passed vector.
  8736. */
  8737. add(otherVector: Vector3): Vector3;
  8738. /**
  8739. * Adds the current Vector3 to the passed one and stores the result in the vector "result".
  8740. * Returns the current Vector3.
  8741. */
  8742. addToRef(otherVector: Vector3, result: Vector3): Vector3;
  8743. /**
  8744. * Subtract the passed vector from the current Vector3.
  8745. * Returns the updated Vector3.
  8746. */
  8747. subtractInPlace(otherVector: Vector3): Vector3;
  8748. /**
  8749. * Returns a new Vector3, result of the subtraction of the passed vector from the current Vector3.
  8750. */
  8751. subtract(otherVector: Vector3): Vector3;
  8752. /**
  8753. * Subtracts the passed vector from the current Vector3 and stores the result in the vector "result".
  8754. * Returns the current Vector3.
  8755. */
  8756. subtractToRef(otherVector: Vector3, result: Vector3): Vector3;
  8757. /**
  8758. * Returns a new Vector3 set with the subtraction of the passed floats from the current Vector3 coordinates.
  8759. */
  8760. subtractFromFloats(x: number, y: number, z: number): Vector3;
  8761. /**
  8762. * Subtracts the passed floats from the current Vector3 coordinates and set the passed vector "result" with this result.
  8763. * Returns the current Vector3.
  8764. */
  8765. subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3;
  8766. /**
  8767. * Returns a new Vector3 set with the current Vector3 negated coordinates.
  8768. */
  8769. negate(): Vector3;
  8770. /**
  8771. * Multiplies the Vector3 coordinates by the float "scale".
  8772. * Returns the updated Vector3.
  8773. */
  8774. scaleInPlace(scale: number): Vector3;
  8775. /**
  8776. * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale".
  8777. */
  8778. scale(scale: number): Vector3;
  8779. /**
  8780. * Multiplies the current Vector3 coordinates by the float "scale" and stores the result in the passed vector "result" coordinates.
  8781. * Returns the current Vector3.
  8782. */
  8783. scaleToRef(scale: number, result: Vector3): Vector3;
  8784. /**
  8785. * Boolean : True if the current Vector3 and the passed vector coordinates are strictly equal.
  8786. */
  8787. equals(otherVector: Vector3): boolean;
  8788. /**
  8789. * Boolean : True if the current Vector3 and the passed vector coordinates are distant less than epsilon.
  8790. */
  8791. equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean;
  8792. /**
  8793. * Boolean : True if the current Vector3 coordinate equal the passed floats.
  8794. */
  8795. equalsToFloats(x: number, y: number, z: number): boolean;
  8796. /**
  8797. * Muliplies the current Vector3 coordinates by the passed ones.
  8798. * Returns the updated Vector3.
  8799. */
  8800. multiplyInPlace(otherVector: Vector3): Vector3;
  8801. /**
  8802. * Returns a new Vector3, result of the multiplication of the current Vector3 by the passed vector.
  8803. */
  8804. multiply(otherVector: Vector3): Vector3;
  8805. /**
  8806. * Multiplies the current Vector3 by the passed one and stores the result in the passed vector "result".
  8807. * Returns the current Vector3.
  8808. */
  8809. multiplyToRef(otherVector: Vector3, result: Vector3): Vector3;
  8810. /**
  8811. * Returns a new Vector3 set witth the result of the mulliplication of the current Vector3 coordinates by the passed floats.
  8812. */
  8813. multiplyByFloats(x: number, y: number, z: number): Vector3;
  8814. /**
  8815. * Returns a new Vector3 set witth the result of the division of the current Vector3 coordinates by the passed ones.
  8816. */
  8817. divide(otherVector: Vector3): Vector3;
  8818. /**
  8819. * Divides the current Vector3 coordinates by the passed ones and stores the result in the passed vector "result".
  8820. * Returns the current Vector3.
  8821. */
  8822. divideToRef(otherVector: Vector3, result: Vector3): Vector3;
  8823. /**
  8824. * Updates the current Vector3 with the minimal coordinate values between its and the passed vector ones.
  8825. * Returns the updated Vector3.
  8826. */
  8827. MinimizeInPlace(other: Vector3): Vector3;
  8828. /**
  8829. * Updates the current Vector3 with the maximal coordinate values between its and the passed vector ones.
  8830. * Returns the updated Vector3.
  8831. */
  8832. MaximizeInPlace(other: Vector3): Vector3;
  8833. /**
  8834. * Returns the length of the Vector3 (float).
  8835. */
  8836. length(): number;
  8837. /**
  8838. * Returns the squared length of the Vector3 (float).
  8839. */
  8840. lengthSquared(): number;
  8841. /**
  8842. * Normalize the current Vector3.
  8843. * Returns the updated Vector3.
  8844. */
  8845. normalize(): Vector3;
  8846. /**
  8847. * Returns a new Vector3 copied from the current Vector3.
  8848. */
  8849. clone(): Vector3;
  8850. /**
  8851. * Copies the passed vector coordinates to the current Vector3 ones.
  8852. * Returns the updated Vector3.
  8853. */
  8854. copyFrom(source: Vector3): Vector3;
  8855. /**
  8856. * Copies the passed floats to the current Vector3 coordinates.
  8857. * Returns the updated Vector3.
  8858. */
  8859. copyFromFloats(x: number, y: number, z: number): Vector3;
  8860. /**
  8861. * Copies the passed floats to the current Vector3 coordinates.
  8862. * Returns the updated Vector3.
  8863. */
  8864. set(x: number, y: number, z: number): Vector3;
  8865. /**
  8866. *
  8867. */
  8868. static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number;
  8869. /**
  8870. * Returns a new Vector3 set from the index "offset" of the passed array.
  8871. */
  8872. static FromArray(array: ArrayLike<number>, offset?: number): Vector3;
  8873. /**
  8874. * Returns a new Vector3 set from the index "offset" of the passed Float32Array.
  8875. * This function is deprecated. Use FromArray instead.
  8876. */
  8877. static FromFloatArray(array: Float32Array, offset?: number): Vector3;
  8878. /**
  8879. * Sets the passed vector "result" with the element values from the index "offset" of the passed array.
  8880. */
  8881. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector3): void;
  8882. /**
  8883. * Sets the passed vector "result" with the element values from the index "offset" of the passed Float32Array.
  8884. * This function is deprecated. Use FromArrayToRef instead.
  8885. */
  8886. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
  8887. /**
  8888. * Sets the passed vector "result" with the passed floats.
  8889. */
  8890. static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  8891. /**
  8892. * Returns a new Vector3 set to (0.0, 0.0, 0.0).
  8893. */
  8894. static Zero(): Vector3;
  8895. /**
  8896. * Returns a new Vector3 set to (1.0, 1.0, 1.0).
  8897. */
  8898. static One(): Vector3;
  8899. /**
  8900. * Returns a new Vector3 set to (0.0, 1.0, 0.0)
  8901. */
  8902. static Up(): Vector3;
  8903. /**
  8904. * Returns a new Vector3 set to (0.0, 0.0, 1.0)
  8905. */
  8906. static Forward(): Vector3;
  8907. /**
  8908. * Returns a new Vector3 set to (1.0, 0.0, 0.0)
  8909. */
  8910. static Right(): Vector3;
  8911. /**
  8912. * Returns a new Vector3 set to (-1.0, 0.0, 0.0)
  8913. */
  8914. static Left(): Vector3;
  8915. /**
  8916. * Returns a new Vector3 set with the result of the transformation by the passed matrix of the passed vector.
  8917. * This method computes tranformed coordinates only, not transformed direction vectors.
  8918. */
  8919. static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
  8920. /**
  8921. * Sets the passed vector "result" coordinates with the result of the transformation by the passed matrix of the passed vector.
  8922. * This method computes tranformed coordinates only, not transformed direction vectors.
  8923. */
  8924. static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  8925. /**
  8926. * Sets the passed vector "result" coordinates with the result of the transformation by the passed matrix of the passed floats (x, y, z).
  8927. * This method computes tranformed coordinates only, not transformed direction vectors.
  8928. */
  8929. static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  8930. /**
  8931. * Returns a new Vector3 set with the result of the normal transformation by the passed matrix of the passed vector.
  8932. * This methods computes transformed normalized direction vectors only.
  8933. */
  8934. static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
  8935. /**
  8936. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed vector.
  8937. * This methods computes transformed normalized direction vectors only.
  8938. */
  8939. static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  8940. /**
  8941. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed floats (x, y, z).
  8942. * This methods computes transformed normalized direction vectors only.
  8943. */
  8944. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  8945. /**
  8946. * Returns a new Vector3 located for "amount" on the CatmullRom interpolation spline defined by the vectors "value1", "value2", "value3", "value4".
  8947. */
  8948. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  8949. /**
  8950. * 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".
  8951. * If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one.
  8952. * If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one.
  8953. */
  8954. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  8955. /**
  8956. * Returns a new Vector3 located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2".
  8957. */
  8958. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  8959. /**
  8960. * Returns a new Vector3 located for "amount" (float) on the linear interpolation between the vectors "start" and "end".
  8961. */
  8962. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  8963. /**
  8964. * Sets the passed vector "result" with the result of the linear interpolation from the vector "start" for "amount" to the vector "end".
  8965. */
  8966. static LerpToRef(start: Vector3, end: Vector3, amount: number, result: Vector3): void;
  8967. /**
  8968. * Returns the dot product (float) between the vectors "left" and "right".
  8969. */
  8970. static Dot(left: Vector3, right: Vector3): number;
  8971. /**
  8972. * Returns a new Vector3 as the cross product of the vectors "left" and "right".
  8973. * The cross product is then orthogonal to both "left" and "right".
  8974. */
  8975. static Cross(left: Vector3, right: Vector3): Vector3;
  8976. /**
  8977. * Sets the passed vector "result" with the cross product of "left" and "right".
  8978. * The cross product is then orthogonal to both "left" and "right".
  8979. */
  8980. static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
  8981. /**
  8982. * Returns a new Vector3 as the normalization of the passed vector.
  8983. */
  8984. static Normalize(vector: Vector3): Vector3;
  8985. /**
  8986. * Sets the passed vector "result" with the normalization of the passed first vector.
  8987. */
  8988. static NormalizeToRef(vector: Vector3, result: Vector3): void;
  8989. static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
  8990. static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3;
  8991. static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
  8992. static Minimize(left: Vector3, right: Vector3): Vector3;
  8993. static Maximize(left: Vector3, right: Vector3): Vector3;
  8994. /**
  8995. * Returns the distance (float) between the vectors "value1" and "value2".
  8996. */
  8997. static Distance(value1: Vector3, value2: Vector3): number;
  8998. /**
  8999. * Returns the squared distance (float) between the vectors "value1" and "value2".
  9000. */
  9001. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  9002. /**
  9003. * Returns a new Vector3 located at the center between "value1" and "value2".
  9004. */
  9005. static Center(value1: Vector3, value2: Vector3): Vector3;
  9006. /**
  9007. * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
  9008. * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
  9009. * to something in order to rotate it from its local system to the given target system.
  9010. * Note : axis1, axis2 and axis3 are normalized during this operation.
  9011. * Returns a new Vector3.
  9012. */
  9013. static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3;
  9014. /**
  9015. * The same than RotationFromAxis but updates the passed ref Vector3 parameter instead of returning a new Vector3.
  9016. */
  9017. static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void;
  9018. }
  9019. class Vector4 {
  9020. x: number;
  9021. y: number;
  9022. z: number;
  9023. w: number;
  9024. /**
  9025. * Creates a Vector4 object from the passed floats.
  9026. */
  9027. constructor(x: number, y: number, z: number, w: number);
  9028. /**
  9029. * Returns the string with the Vector4 coordinates.
  9030. */
  9031. toString(): string;
  9032. /**
  9033. * Returns the string "Vector4".
  9034. */
  9035. getClassName(): string;
  9036. /**
  9037. * Returns the Vector4 hash code.
  9038. */
  9039. getHashCode(): number;
  9040. /**
  9041. * Returns a new array populated with 4 elements : the Vector4 coordinates.
  9042. */
  9043. asArray(): number[];
  9044. /**
  9045. * Populates the passed array from the passed index with the Vector4 coordinates.
  9046. * Returns the Vector4.
  9047. */
  9048. toArray(array: number[] | Float32Array, index?: number): Vector4;
  9049. /**
  9050. * Adds the passed vector to the current Vector4.
  9051. * Returns the updated Vector4.
  9052. */
  9053. addInPlace(otherVector: Vector4): Vector4;
  9054. /**
  9055. * Returns a new Vector4 as the result of the addition of the current Vector4 and the passed one.
  9056. */
  9057. add(otherVector: Vector4): Vector4;
  9058. /**
  9059. * Updates the passed vector "result" with the result of the addition of the current Vector4 and the passed one.
  9060. * Returns the current Vector4.
  9061. */
  9062. addToRef(otherVector: Vector4, result: Vector4): Vector4;
  9063. /**
  9064. * Subtract in place the passed vector from the current Vector4.
  9065. * Returns the updated Vector4.
  9066. */
  9067. subtractInPlace(otherVector: Vector4): Vector4;
  9068. /**
  9069. * Returns a new Vector4 with the result of the subtraction of the passed vector from the current Vector4.
  9070. */
  9071. subtract(otherVector: Vector4): Vector4;
  9072. /**
  9073. * Sets the passed vector "result" with the result of the subtraction of the passed vector from the current Vector4.
  9074. * Returns the current Vector4.
  9075. */
  9076. subtractToRef(otherVector: Vector4, result: Vector4): Vector4;
  9077. /**
  9078. * Returns a new Vector4 set with the result of the subtraction of the passed floats from the current Vector4 coordinates.
  9079. */
  9080. subtractFromFloats(x: number, y: number, z: number, w: number): Vector4;
  9081. /**
  9082. * Sets the passed vector "result" set with the result of the subtraction of the passed floats from the current Vector4 coordinates.
  9083. * Returns the current Vector4.
  9084. */
  9085. subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4;
  9086. /**
  9087. * Returns a new Vector4 set with the current Vector4 negated coordinates.
  9088. */
  9089. negate(): Vector4;
  9090. /**
  9091. * Multiplies the current Vector4 coordinates by scale (float).
  9092. * Returns the updated Vector4.
  9093. */
  9094. scaleInPlace(scale: number): Vector4;
  9095. /**
  9096. * Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float).
  9097. */
  9098. scale(scale: number): Vector4;
  9099. /**
  9100. * Sets the passed vector "result" with the current Vector4 coordinates multiplied by scale (float).
  9101. * Returns the current Vector4.
  9102. */
  9103. scaleToRef(scale: number, result: Vector4): Vector4;
  9104. /**
  9105. * Boolean : True if the current Vector4 coordinates are stricly equal to the passed ones.
  9106. */
  9107. equals(otherVector: Vector4): boolean;
  9108. /**
  9109. * Boolean : True if the current Vector4 coordinates are each beneath the distance "epsilon" from the passed vector ones.
  9110. */
  9111. equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean;
  9112. /**
  9113. * Boolean : True if the passed floats are strictly equal to the current Vector4 coordinates.
  9114. */
  9115. equalsToFloats(x: number, y: number, z: number, w: number): boolean;
  9116. /**
  9117. * Multiplies in place the current Vector4 by the passed one.
  9118. * Returns the updated Vector4.
  9119. */
  9120. multiplyInPlace(otherVector: Vector4): Vector4;
  9121. /**
  9122. * Returns a new Vector4 set with the multiplication result of the current Vector4 and the passed one.
  9123. */
  9124. multiply(otherVector: Vector4): Vector4;
  9125. /**
  9126. * Updates the passed vector "result" with the multiplication result of the current Vector4 and the passed one.
  9127. * Returns the current Vector4.
  9128. */
  9129. multiplyToRef(otherVector: Vector4, result: Vector4): Vector4;
  9130. /**
  9131. * Returns a new Vector4 set with the multiplication result of the passed floats and the current Vector4 coordinates.
  9132. */
  9133. multiplyByFloats(x: number, y: number, z: number, w: number): Vector4;
  9134. /**
  9135. * Returns a new Vector4 set with the division result of the current Vector4 by the passed one.
  9136. */
  9137. divide(otherVector: Vector4): Vector4;
  9138. /**
  9139. * Updates the passed vector "result" with the division result of the current Vector4 by the passed one.
  9140. * Returns the current Vector4.
  9141. */
  9142. divideToRef(otherVector: Vector4, result: Vector4): Vector4;
  9143. /**
  9144. * Updates the Vector4 coordinates with the minimum values between its own and the passed vector ones.
  9145. */
  9146. MinimizeInPlace(other: Vector4): Vector4;
  9147. /**
  9148. * Updates the Vector4 coordinates with the maximum values between its own and the passed vector ones.
  9149. */
  9150. MaximizeInPlace(other: Vector4): Vector4;
  9151. /**
  9152. * Returns the Vector4 length (float).
  9153. */
  9154. length(): number;
  9155. /**
  9156. * Returns the Vector4 squared length (float).
  9157. */
  9158. lengthSquared(): number;
  9159. /**
  9160. * Normalizes in place the Vector4.
  9161. * Returns the updated Vector4.
  9162. */
  9163. normalize(): Vector4;
  9164. /**
  9165. * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.
  9166. */
  9167. toVector3(): Vector3;
  9168. /**
  9169. * Returns a new Vector4 copied from the current one.
  9170. */
  9171. clone(): Vector4;
  9172. /**
  9173. * Updates the current Vector4 with the passed one coordinates.
  9174. * Returns the updated Vector4.
  9175. */
  9176. copyFrom(source: Vector4): Vector4;
  9177. /**
  9178. * Updates the current Vector4 coordinates with the passed floats.
  9179. * Returns the updated Vector4.
  9180. */
  9181. copyFromFloats(x: number, y: number, z: number, w: number): Vector4;
  9182. /**
  9183. * Updates the current Vector4 coordinates with the passed floats.
  9184. * Returns the updated Vector4.
  9185. */
  9186. set(x: number, y: number, z: number, w: number): Vector4;
  9187. /**
  9188. * Returns a new Vector4 set from the starting index of the passed array.
  9189. */
  9190. static FromArray(array: ArrayLike<number>, offset?: number): Vector4;
  9191. /**
  9192. * Updates the passed vector "result" from the starting index of the passed array.
  9193. */
  9194. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector4): void;
  9195. /**
  9196. * Updates the passed vector "result" from the starting index of the passed Float32Array.
  9197. */
  9198. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void;
  9199. /**
  9200. * Updates the passed vector "result" coordinates from the passed floats.
  9201. */
  9202. static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void;
  9203. /**
  9204. * Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0)
  9205. */
  9206. static Zero(): Vector4;
  9207. /**
  9208. * Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0)
  9209. */
  9210. static One(): Vector4;
  9211. /**
  9212. * Returns a new normalized Vector4 from the passed one.
  9213. */
  9214. static Normalize(vector: Vector4): Vector4;
  9215. /**
  9216. * Updates the passed vector "result" from the normalization of the passed one.
  9217. */
  9218. static NormalizeToRef(vector: Vector4, result: Vector4): void;
  9219. static Minimize(left: Vector4, right: Vector4): Vector4;
  9220. static Maximize(left: Vector4, right: Vector4): Vector4;
  9221. /**
  9222. * Returns the distance (float) between the vectors "value1" and "value2".
  9223. */
  9224. static Distance(value1: Vector4, value2: Vector4): number;
  9225. /**
  9226. * Returns the squared distance (float) between the vectors "value1" and "value2".
  9227. */
  9228. static DistanceSquared(value1: Vector4, value2: Vector4): number;
  9229. /**
  9230. * Returns a new Vector4 located at the center between the vectors "value1" and "value2".
  9231. */
  9232. static Center(value1: Vector4, value2: Vector4): Vector4;
  9233. /**
  9234. * Returns a new Vector4 set with the result of the normal transformation by the passed matrix of the passed vector.
  9235. * This methods computes transformed normalized direction vectors only.
  9236. */
  9237. static TransformNormal(vector: Vector4, transformation: Matrix): Vector4;
  9238. /**
  9239. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed vector.
  9240. * This methods computes transformed normalized direction vectors only.
  9241. */
  9242. static TransformNormalToRef(vector: Vector4, transformation: Matrix, result: Vector4): void;
  9243. /**
  9244. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed floats (x, y, z, w).
  9245. * This methods computes transformed normalized direction vectors only.
  9246. */
  9247. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, w: number, transformation: Matrix, result: Vector4): void;
  9248. }
  9249. interface ISize {
  9250. width: number;
  9251. height: number;
  9252. }
  9253. class Size implements ISize {
  9254. width: number;
  9255. height: number;
  9256. /**
  9257. * Creates a Size object from the passed width and height (floats).
  9258. */
  9259. constructor(width: number, height: number);
  9260. toString(): string;
  9261. /**
  9262. * Returns the string "Size"
  9263. */
  9264. getClassName(): string;
  9265. /**
  9266. * Returns the Size hash code.
  9267. */
  9268. getHashCode(): number;
  9269. /**
  9270. * Updates the current size from the passed one.
  9271. * Returns the updated Size.
  9272. */
  9273. copyFrom(src: Size): void;
  9274. /**
  9275. * Updates in place the current Size from the passed floats.
  9276. * Returns the updated Size.
  9277. */
  9278. copyFromFloats(width: number, height: number): Size;
  9279. /**
  9280. * Updates in place the current Size from the passed floats.
  9281. * Returns the updated Size.
  9282. */
  9283. set(width: number, height: number): Size;
  9284. /**
  9285. * Returns a new Size set with the multiplication result of the current Size and the passed floats.
  9286. */
  9287. multiplyByFloats(w: number, h: number): Size;
  9288. /**
  9289. * Returns a new Size copied from the passed one.
  9290. */
  9291. clone(): Size;
  9292. /**
  9293. * Boolean : True if the current Size and the passed one width and height are strictly equal.
  9294. */
  9295. equals(other: Size): boolean;
  9296. /**
  9297. * Returns the surface of the Size : width * height (float).
  9298. */
  9299. readonly surface: number;
  9300. /**
  9301. * Returns a new Size set to (0.0, 0.0)
  9302. */
  9303. static Zero(): Size;
  9304. /**
  9305. * Returns a new Size set as the addition result of the current Size and the passed one.
  9306. */
  9307. add(otherSize: Size): Size;
  9308. /**
  9309. * Returns a new Size set as the subtraction result of the passed one from the current Size.
  9310. */
  9311. subtract(otherSize: Size): Size;
  9312. /**
  9313. * Returns a new Size set at the linear interpolation "amount" between "start" and "end".
  9314. */
  9315. static Lerp(start: Size, end: Size, amount: number): Size;
  9316. }
  9317. class Quaternion {
  9318. x: number;
  9319. y: number;
  9320. z: number;
  9321. w: number;
  9322. /**
  9323. * Creates a new Quaternion from the passed floats.
  9324. */
  9325. constructor(x?: number, y?: number, z?: number, w?: number);
  9326. /**
  9327. * Returns a string with the Quaternion coordinates.
  9328. */
  9329. toString(): string;
  9330. /**
  9331. * Returns the string "Quaternion".
  9332. */
  9333. getClassName(): string;
  9334. /**
  9335. * Returns the Quaternion hash code.
  9336. */
  9337. getHashCode(): number;
  9338. /**
  9339. * Returns a new array populated with 4 elements : the Quaternion coordinates.
  9340. */
  9341. asArray(): number[];
  9342. /**
  9343. * Boolean : True if the current Quaterion and the passed one coordinates are strictly equal.
  9344. */
  9345. equals(otherQuaternion: Quaternion): boolean;
  9346. /**
  9347. * Returns a new Quaternion copied from the current one.
  9348. */
  9349. clone(): Quaternion;
  9350. /**
  9351. * Updates the current Quaternion from the passed one coordinates.
  9352. * Returns the updated Quaterion.
  9353. */
  9354. copyFrom(other: Quaternion): Quaternion;
  9355. /**
  9356. * Updates the current Quaternion from the passed float coordinates.
  9357. * Returns the updated Quaterion.
  9358. */
  9359. copyFromFloats(x: number, y: number, z: number, w: number): Quaternion;
  9360. /**
  9361. * Updates the current Quaternion from the passed float coordinates.
  9362. * Returns the updated Quaterion.
  9363. */
  9364. set(x: number, y: number, z: number, w: number): Quaternion;
  9365. /**
  9366. * Returns a new Quaternion as the addition result of the passed one and the current Quaternion.
  9367. */
  9368. add(other: Quaternion): Quaternion;
  9369. /**
  9370. * Returns a new Quaternion as the subtraction result of the passed one from the current Quaternion.
  9371. */
  9372. subtract(other: Quaternion): Quaternion;
  9373. /**
  9374. * Returns a new Quaternion set by multiplying the current Quaterion coordinates by the float "scale".
  9375. */
  9376. scale(value: number): Quaternion;
  9377. /**
  9378. * Returns a new Quaternion set as the quaternion mulplication result of the current one with the passed one "q1".
  9379. */
  9380. multiply(q1: Quaternion): Quaternion;
  9381. /**
  9382. * Sets the passed "result" as the quaternion mulplication result of the current one with the passed one "q1".
  9383. * Returns the current Quaternion.
  9384. */
  9385. multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion;
  9386. /**
  9387. * Updates the current Quaternion with the quaternion mulplication result of itself with the passed one "q1".
  9388. * Returns the updated Quaternion.
  9389. */
  9390. multiplyInPlace(q1: Quaternion): Quaternion;
  9391. /**
  9392. * Sets the passed "ref" with the conjugation of the current Quaternion.
  9393. * Returns the current Quaternion.
  9394. */
  9395. conjugateToRef(ref: Quaternion): Quaternion;
  9396. /**
  9397. * Conjugates in place the current Quaternion.
  9398. * Returns the updated Quaternion.
  9399. */
  9400. conjugateInPlace(): Quaternion;
  9401. /**
  9402. * Returns a new Quaternion as the conjugate of the current Quaternion.
  9403. */
  9404. conjugate(): Quaternion;
  9405. /**
  9406. * Returns the Quaternion length (float).
  9407. */
  9408. length(): number;
  9409. /**
  9410. * Normalize in place the current Quaternion.
  9411. * Returns the updated Quaternion.
  9412. */
  9413. normalize(): Quaternion;
  9414. /**
  9415. * Returns a new Vector3 set with the Euler angles translated from the current Quaternion.
  9416. */
  9417. toEulerAngles(order?: string): Vector3;
  9418. /**
  9419. * Sets the passed vector3 "result" with the Euler angles translated from the current Quaternion.
  9420. * Returns the current Quaternion.
  9421. */
  9422. toEulerAnglesToRef(result: Vector3, order?: string): Quaternion;
  9423. /**
  9424. * Updates the passed rotation matrix with the current Quaternion values.
  9425. * Returns the current Quaternion.
  9426. */
  9427. toRotationMatrix(result: Matrix): Quaternion;
  9428. /**
  9429. * Updates the current Quaternion from the passed rotation matrix values.
  9430. * Returns the updated Quaternion.
  9431. */
  9432. fromRotationMatrix(matrix: Matrix): Quaternion;
  9433. /**
  9434. * Returns a new Quaternion set from the passed rotation matrix values.
  9435. */
  9436. static FromRotationMatrix(matrix: Matrix): Quaternion;
  9437. /**
  9438. * Updates the passed quaternion "result" with the passed rotation matrix values.
  9439. */
  9440. static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void;
  9441. /**
  9442. * Returns a new Quaternion set to (0.0, 0.0, 0.0).
  9443. */
  9444. static Zero(): Quaternion;
  9445. /**
  9446. * Returns a new Quaternion as the inverted current Quaternion.
  9447. */
  9448. static Inverse(q: Quaternion): Quaternion;
  9449. /**
  9450. * Returns the identity Quaternion.
  9451. */
  9452. static Identity(): Quaternion;
  9453. static IsIdentity(quaternion: Quaternion): boolean;
  9454. /**
  9455. * Returns a new Quaternion set from the passed axis (Vector3) and angle in radians (float).
  9456. */
  9457. static RotationAxis(axis: Vector3, angle: number): Quaternion;
  9458. /**
  9459. * Sets the passed quaternion "result" from the passed axis (Vector3) and angle in radians (float).
  9460. */
  9461. static RotationAxisToRef(axis: Vector3, angle: number, result: Quaternion): Quaternion;
  9462. /**
  9463. * Retuns a new Quaternion set from the starting index of the passed array.
  9464. */
  9465. static FromArray(array: ArrayLike<number>, offset?: number): Quaternion;
  9466. /**
  9467. * Returns a new Quaternion set from the passed Euler float angles (y, x, z).
  9468. */
  9469. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
  9470. /**
  9471. * Sets the passed quaternion "result" from the passed float Euler angles (y, x, z).
  9472. */
  9473. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
  9474. /**
  9475. * Returns a new Quaternion from the passed float Euler angles expressed in z-x-z orientation
  9476. */
  9477. static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion;
  9478. /**
  9479. * Sets the passed quaternion "result" from the passed float Euler angles expressed in z-x-z orientation
  9480. */
  9481. static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void;
  9482. /**
  9483. * Returns a new Quaternion as the quaternion rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system.
  9484. * cf to Vector3.RotationFromAxis() documentation.
  9485. * Note : axis1, axis2 and axis3 are normalized during this operation.
  9486. */
  9487. static RotationQuaternionFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Quaternion): Quaternion;
  9488. /**
  9489. * Sets the passed quaternion "ref" with the quaternion rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system.
  9490. * cf to Vector3.RotationFromAxis() documentation.
  9491. * Note : axis1, axis2 and axis3 are normalized during this operation.
  9492. */
  9493. static RotationQuaternionFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Quaternion): void;
  9494. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  9495. static SlerpToRef(left: Quaternion, right: Quaternion, amount: number, result: Quaternion): void;
  9496. /**
  9497. * Returns a new Quaternion located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2".
  9498. */
  9499. static Hermite(value1: Quaternion, tangent1: Quaternion, value2: Quaternion, tangent2: Quaternion, amount: number): Quaternion;
  9500. }
  9501. class Matrix {
  9502. updateFlag: number;
  9503. m: Float32Array;
  9504. constructor();
  9505. /**
  9506. * Boolean : True is the matrix is the identity matrix
  9507. */
  9508. isIdentity(): boolean;
  9509. /**
  9510. * Returns the matrix determinant (float).
  9511. */
  9512. determinant(): number;
  9513. /**
  9514. * Returns the matrix underlying array.
  9515. */
  9516. toArray(): Float32Array;
  9517. /**
  9518. * Returns the matrix underlying array.
  9519. */
  9520. asArray(): Float32Array;
  9521. /**
  9522. * Inverts in place the Matrix.
  9523. * Returns the Matrix inverted.
  9524. */
  9525. invert(): Matrix;
  9526. /**
  9527. * Sets all the matrix elements to zero.
  9528. * Returns the Matrix.
  9529. */
  9530. reset(): Matrix;
  9531. /**
  9532. * Returns a new Matrix as the addition result of the current Matrix and the passed one.
  9533. */
  9534. add(other: Matrix): Matrix;
  9535. /**
  9536. * Sets the passed matrix "result" with the ddition result of the current Matrix and the passed one.
  9537. * Returns the Matrix.
  9538. */
  9539. addToRef(other: Matrix, result: Matrix): Matrix;
  9540. /**
  9541. * Adds in place the passed matrix to the current Matrix.
  9542. * Returns the updated Matrix.
  9543. */
  9544. addToSelf(other: Matrix): Matrix;
  9545. /**
  9546. * Sets the passed matrix with the current inverted Matrix.
  9547. * Returns the unmodified current Matrix.
  9548. */
  9549. invertToRef(other: Matrix): Matrix;
  9550. /**
  9551. * Inserts the translation vector (using 3 x floats) in the current Matrix.
  9552. * Returns the updated Matrix.
  9553. */
  9554. setTranslationFromFloats(x: number, y: number, z: number): Matrix;
  9555. /**
  9556. * Inserts the translation vector in the current Matrix.
  9557. * Returns the updated Matrix.
  9558. */
  9559. setTranslation(vector3: Vector3): Matrix;
  9560. /**
  9561. * Returns a new Vector3 as the extracted translation from the Matrix.
  9562. */
  9563. getTranslation(): Vector3;
  9564. /**
  9565. * Fill a Vector3 with the extracted translation from the Matrix.
  9566. */
  9567. getTranslationToRef(result: Vector3): Matrix;
  9568. /**
  9569. * Remove rotation and scaling part from the Matrix.
  9570. * Returns the updated Matrix.
  9571. */
  9572. removeRotationAndScaling(): Matrix;
  9573. /**
  9574. * Returns a new Matrix set with the multiplication result of the current Matrix and the passed one.
  9575. */
  9576. multiply(other: Matrix): Matrix;
  9577. /**
  9578. * Updates the current Matrix from the passed one values.
  9579. * Returns the updated Matrix.
  9580. */
  9581. copyFrom(other: Matrix): Matrix;
  9582. /**
  9583. * Populates the passed array from the starting index with the Matrix values.
  9584. * Returns the Matrix.
  9585. */
  9586. copyToArray(array: Float32Array, offset?: number): Matrix;
  9587. /**
  9588. * Sets the passed matrix "result" with the multiplication result of the current Matrix and the passed one.
  9589. */
  9590. multiplyToRef(other: Matrix, result: Matrix): Matrix;
  9591. /**
  9592. * Sets the Float32Array "result" from the passed index "offset" with the multiplication result of the current Matrix and the passed one.
  9593. */
  9594. multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix;
  9595. /**
  9596. * Boolean : True is the current Matrix and the passed one values are strictly equal.
  9597. */
  9598. equals(value: Matrix): boolean;
  9599. /**
  9600. * Returns a new Matrix from the current Matrix.
  9601. */
  9602. clone(): Matrix;
  9603. /**
  9604. * Returns the string "Matrix"
  9605. */
  9606. getClassName(): string;
  9607. /**
  9608. * Returns the Matrix hash code.
  9609. */
  9610. getHashCode(): number;
  9611. /**
  9612. * Decomposes the current Matrix into :
  9613. * - a scale vector3 passed as a reference to update,
  9614. * - a rotation quaternion passed as a reference to update,
  9615. * - a translation vector3 passed as a reference to update.
  9616. * Returns the boolean `true`.
  9617. */
  9618. decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean;
  9619. /**
  9620. * Returns a new Matrix as the extracted rotation matrix from the current one.
  9621. */
  9622. getRotationMatrix(): Matrix;
  9623. /**
  9624. * Extracts the rotation matrix from the current one and sets it as the passed "result".
  9625. * Returns the current Matrix.
  9626. */
  9627. getRotationMatrixToRef(result: Matrix): Matrix;
  9628. /**
  9629. * Returns a new Matrix set from the starting index of the passed array.
  9630. */
  9631. static FromArray(array: ArrayLike<number>, offset?: number): Matrix;
  9632. /**
  9633. * Sets the passed "result" matrix from the starting index of the passed array.
  9634. */
  9635. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Matrix): void;
  9636. /**
  9637. * Sets the passed "result" matrix from the starting index of the passed Float32Array by multiplying each element by the float "scale".
  9638. */
  9639. static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void;
  9640. /**
  9641. * Sets the passed matrix "result" with the 16 passed floats.
  9642. */
  9643. 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;
  9644. /**
  9645. * Returns the index-th row of the current matrix as a new Vector4.
  9646. */
  9647. getRow(index: number): Vector4;
  9648. /**
  9649. * Sets the index-th row of the current matrix with the passed Vector4 values.
  9650. * Returns the updated Matrix.
  9651. */
  9652. setRow(index: number, row: Vector4): Matrix;
  9653. /**
  9654. * Sets the index-th row of the current matrix with the passed 4 x float values.
  9655. * Returns the updated Matrix.
  9656. */
  9657. setRowFromFloats(index: number, x: number, y: number, z: number, w: number): Matrix;
  9658. /**
  9659. * Returns a new Matrix set from the 16 passed floats.
  9660. */
  9661. 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;
  9662. /**
  9663. * Returns a new Matrix composed by the passed scale (vector3), rotation (quaternion) and translation (vector3).
  9664. */
  9665. static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
  9666. /**
  9667. * Update a Matrix with values composed by the passed scale (vector3), rotation (quaternion) and translation (vector3).
  9668. */
  9669. static ComposeToRef(scale: Vector3, rotation: Quaternion, translation: Vector3, result: Matrix): void;
  9670. /**
  9671. * Returns a new indentity Matrix.
  9672. */
  9673. static Identity(): Matrix;
  9674. /**
  9675. * Sets the passed "result" as an identity matrix.
  9676. */
  9677. static IdentityToRef(result: Matrix): void;
  9678. /**
  9679. * Returns a new zero Matrix.
  9680. */
  9681. static Zero(): Matrix;
  9682. /**
  9683. * Returns a new rotation matrix for "angle" radians around the X axis.
  9684. */
  9685. static RotationX(angle: number): Matrix;
  9686. /**
  9687. * Returns a new Matrix as the passed inverted one.
  9688. */
  9689. static Invert(source: Matrix): Matrix;
  9690. /**
  9691. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the X axis.
  9692. */
  9693. static RotationXToRef(angle: number, result: Matrix): void;
  9694. /**
  9695. * Returns a new rotation matrix for "angle" radians around the Y axis.
  9696. */
  9697. static RotationY(angle: number): Matrix;
  9698. /**
  9699. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the Y axis.
  9700. */
  9701. static RotationYToRef(angle: number, result: Matrix): void;
  9702. /**
  9703. * Returns a new rotation matrix for "angle" radians around the Z axis.
  9704. */
  9705. static RotationZ(angle: number): Matrix;
  9706. /**
  9707. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the Z axis.
  9708. */
  9709. static RotationZToRef(angle: number, result: Matrix): void;
  9710. /**
  9711. * Returns a new rotation matrix for "angle" radians around the passed axis.
  9712. */
  9713. static RotationAxis(axis: Vector3, angle: number): Matrix;
  9714. /**
  9715. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the passed axis.
  9716. */
  9717. static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void;
  9718. /**
  9719. * Returns a new Matrix as a rotation matrix from the Euler angles (y, x, z).
  9720. */
  9721. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  9722. /**
  9723. * Sets the passed matrix "result" as a rotation matrix from the Euler angles (y, x, z).
  9724. */
  9725. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
  9726. /**
  9727. * Returns a new Matrix as a scaling matrix from the passed floats (x, y, z).
  9728. */
  9729. static Scaling(x: number, y: number, z: number): Matrix;
  9730. /**
  9731. * Sets the passed matrix "result" as a scaling matrix from the passed floats (x, y, z).
  9732. */
  9733. static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
  9734. /**
  9735. * Returns a new Matrix as a translation matrix from the passed floats (x, y, z).
  9736. */
  9737. static Translation(x: number, y: number, z: number): Matrix;
  9738. /**
  9739. * Sets the passed matrix "result" as a translation matrix from the passed floats (x, y, z).
  9740. */
  9741. static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
  9742. /**
  9743. * Returns a new Matrix whose values are the interpolated values for "gradien" (float) between the ones of the matrices "startValue" and "endValue".
  9744. */
  9745. static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  9746. /**
  9747. * Returns a new Matrix whose values are computed by :
  9748. * - decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices,
  9749. * - interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end,
  9750. * - recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices.
  9751. */
  9752. static DecomposeLerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  9753. /**
  9754. * 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".
  9755. * This methods works for a Left-Handed system.
  9756. */
  9757. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  9758. /**
  9759. * 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".
  9760. * This methods works for a Left-Handed system.
  9761. */
  9762. static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  9763. /**
  9764. * 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".
  9765. * This methods works for a Right-Handed system.
  9766. */
  9767. static LookAtRH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  9768. /**
  9769. * 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".
  9770. * This methods works for a Left-Handed system.
  9771. */
  9772. static LookAtRHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  9773. /**
  9774. * 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.
  9775. */
  9776. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  9777. /**
  9778. * 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.
  9779. */
  9780. static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void;
  9781. /**
  9782. * 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.
  9783. */
  9784. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  9785. /**
  9786. * 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.
  9787. */
  9788. static OrthoOffCenterLHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  9789. /**
  9790. * 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.
  9791. */
  9792. static OrthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  9793. /**
  9794. * 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.
  9795. */
  9796. static OrthoOffCenterRHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  9797. /**
  9798. * 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.
  9799. */
  9800. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  9801. /**
  9802. * 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.
  9803. */
  9804. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  9805. /**
  9806. * 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.
  9807. */
  9808. static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  9809. /**
  9810. * 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.
  9811. */
  9812. static PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  9813. /**
  9814. * 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.
  9815. */
  9816. static PerspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  9817. /**
  9818. * 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.
  9819. */
  9820. static PerspectiveFovWebVRToRef(fov: any, znear: number, zfar: number, result: Matrix, rightHanded?: boolean): void;
  9821. /**
  9822. * Returns the final transformation matrix : world * view * projection * viewport
  9823. */
  9824. static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
  9825. /**
  9826. * Returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the passed Matrix.
  9827. */
  9828. static GetAsMatrix2x2(matrix: Matrix): Float32Array;
  9829. /**
  9830. * Returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the passed Matrix.
  9831. */
  9832. static GetAsMatrix3x3(matrix: Matrix): Float32Array;
  9833. /**
  9834. * Compute the transpose of the passed Matrix.
  9835. * Returns a new Matrix.
  9836. */
  9837. static Transpose(matrix: Matrix): Matrix;
  9838. /**
  9839. * Returns a new Matrix as the reflection matrix across the passed plane.
  9840. */
  9841. static Reflection(plane: Plane): Matrix;
  9842. /**
  9843. * Sets the passed matrix "result" as the reflection matrix across the passed plane.
  9844. */
  9845. static ReflectionToRef(plane: Plane, result: Matrix): void;
  9846. /**
  9847. * Sets the passed matrix "mat" as a rotation matrix composed from the 3 passed left handed axis.
  9848. */
  9849. static FromXYZAxesToRef(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, result: Matrix): void;
  9850. /**
  9851. * Sets the passed matrix "result" as a rotation matrix according to the passed quaternion.
  9852. */
  9853. static FromQuaternionToRef(quat: Quaternion, result: Matrix): void;
  9854. }
  9855. class Plane {
  9856. normal: Vector3;
  9857. d: number;
  9858. /**
  9859. * Creates a Plane object according to the passed floats a, b, c, d and the plane equation : ax + by + cz + d = 0
  9860. */
  9861. constructor(a: number, b: number, c: number, d: number);
  9862. /**
  9863. * Returns the plane coordinates as a new array of 4 elements [a, b, c, d].
  9864. */
  9865. asArray(): number[];
  9866. /**
  9867. * Returns a new plane copied from the current Plane.
  9868. */
  9869. clone(): Plane;
  9870. /**
  9871. * Returns the string "Plane".
  9872. */
  9873. getClassName(): string;
  9874. /**
  9875. * Returns the Plane hash code.
  9876. */
  9877. getHashCode(): number;
  9878. /**
  9879. * Normalize the current Plane in place.
  9880. * Returns the updated Plane.
  9881. */
  9882. normalize(): Plane;
  9883. /**
  9884. * Returns a new Plane as the result of the transformation of the current Plane by the passed matrix.
  9885. */
  9886. transform(transformation: Matrix): Plane;
  9887. /**
  9888. * Returns the dot product (float) of the point coordinates and the plane normal.
  9889. */
  9890. dotCoordinate(point: any): number;
  9891. /**
  9892. * Updates the current Plane from the plane defined by the three passed points.
  9893. * Returns the updated Plane.
  9894. */
  9895. copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  9896. /**
  9897. * Boolean : True is the vector "direction" is the same side than the plane normal.
  9898. */
  9899. isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
  9900. /**
  9901. * Returns the signed distance (float) from the passed point to the Plane.
  9902. */
  9903. signedDistanceTo(point: Vector3): number;
  9904. /**
  9905. * Returns a new Plane from the passed array.
  9906. */
  9907. static FromArray(array: ArrayLike<number>): Plane;
  9908. /**
  9909. * Returns a new Plane defined by the three passed points.
  9910. */
  9911. static FromPoints(point1: any, point2: any, point3: any): Plane;
  9912. /**
  9913. * Returns a new Plane the normal vector to this plane at the passed origin point.
  9914. * Note : the vector "normal" is updated because normalized.
  9915. */
  9916. static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
  9917. /**
  9918. * Returns the signed distance between the plane defined by the normal vector at the "origin"" point and the passed other point.
  9919. */
  9920. static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
  9921. }
  9922. class Viewport {
  9923. x: number;
  9924. y: number;
  9925. width: number;
  9926. height: number;
  9927. /**
  9928. * Creates a Viewport object located at (x, y) and sized (width, height).
  9929. */
  9930. constructor(x: number, y: number, width: number, height: number);
  9931. toGlobal(renderWidth: number, renderHeight: number): Viewport;
  9932. /**
  9933. * Returns a new Viewport copied from the current one.
  9934. */
  9935. clone(): Viewport;
  9936. }
  9937. class Frustum {
  9938. /**
  9939. * Returns a new array of 6 Frustum planes computed by the passed transformation matrix.
  9940. */
  9941. static GetPlanes(transform: Matrix): Plane[];
  9942. /**
  9943. * Sets the passed array "frustumPlanes" with the 6 Frustum planes computed by the passed transformation matrix.
  9944. */
  9945. static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
  9946. }
  9947. enum Space {
  9948. LOCAL = 0,
  9949. WORLD = 1,
  9950. BONE = 2,
  9951. }
  9952. class Axis {
  9953. static X: Vector3;
  9954. static Y: Vector3;
  9955. static Z: Vector3;
  9956. }
  9957. class BezierCurve {
  9958. /**
  9959. * Returns the cubic Bezier interpolated value (float) at "t" (float) from the passed x1, y1, x2, y2 floats.
  9960. */
  9961. static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number;
  9962. }
  9963. enum Orientation {
  9964. CW = 0,
  9965. CCW = 1,
  9966. }
  9967. class Angle {
  9968. /**
  9969. * Creates an Angle object of "radians" radians (float).
  9970. */
  9971. constructor(radians: number);
  9972. /**
  9973. * Returns the Angle value in degrees (float).
  9974. */
  9975. degrees: () => number;
  9976. /**
  9977. * Returns the Angle value in radians (float).
  9978. */
  9979. radians: () => number;
  9980. /**
  9981. * Returns a new Angle object valued with the angle value in radians between the two passed vectors.
  9982. */
  9983. static BetweenTwoPoints(a: Vector2, b: Vector2): Angle;
  9984. /**
  9985. * Returns a new Angle object from the passed float in radians.
  9986. */
  9987. static FromRadians(radians: number): Angle;
  9988. /**
  9989. * Returns a new Angle object from the passed float in degrees.
  9990. */
  9991. static FromDegrees(degrees: number): Angle;
  9992. }
  9993. class Arc2 {
  9994. startPoint: Vector2;
  9995. midPoint: Vector2;
  9996. endPoint: Vector2;
  9997. centerPoint: Vector2;
  9998. radius: number;
  9999. angle: Angle;
  10000. startAngle: Angle;
  10001. orientation: Orientation;
  10002. /**
  10003. * Creates an Arc object from the three passed points : start, middle and end.
  10004. */
  10005. constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2);
  10006. }
  10007. class Path2 {
  10008. closed: boolean;
  10009. /**
  10010. * Creates a Path2 object from the starting 2D coordinates x and y.
  10011. */
  10012. constructor(x: number, y: number);
  10013. /**
  10014. * Adds a new segment until the passed coordinates (x, y) to the current Path2.
  10015. * Returns the updated Path2.
  10016. */
  10017. addLineTo(x: number, y: number): Path2;
  10018. /**
  10019. * 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.
  10020. * Returns the updated Path2.
  10021. */
  10022. addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2;
  10023. /**
  10024. * Closes the Path2.
  10025. * Returns the Path2.
  10026. */
  10027. close(): Path2;
  10028. /**
  10029. * Returns the Path2 total length (float).
  10030. */
  10031. length(): number;
  10032. /**
  10033. * Returns the Path2 internal array of points.
  10034. */
  10035. getPoints(): Vector2[];
  10036. /**
  10037. * Returns a new Vector2 located at a percentage of the Path2 total length on this path.
  10038. */
  10039. getPointAtLengthPosition(normalizedLengthPosition: number): Vector2;
  10040. /**
  10041. * Returns a new Path2 starting at the coordinates (x, y).
  10042. */
  10043. static StartingAt(x: number, y: number): Path2;
  10044. }
  10045. class Path3D {
  10046. path: Vector3[];
  10047. /**
  10048. * new Path3D(path, normal, raw)
  10049. * Creates a Path3D. A Path3D is a logical math object, so not a mesh.
  10050. * please read the description in the tutorial : http://doc.babylonjs.com/tutorials/How_to_use_Path3D
  10051. * path : an array of Vector3, the curve axis of the Path3D
  10052. * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.
  10053. * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.
  10054. */
  10055. constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean);
  10056. /**
  10057. * Returns the Path3D array of successive Vector3 designing its curve.
  10058. */
  10059. getCurve(): Vector3[];
  10060. /**
  10061. * Returns an array populated with tangent vectors on each Path3D curve point.
  10062. */
  10063. getTangents(): Vector3[];
  10064. /**
  10065. * Returns an array populated with normal vectors on each Path3D curve point.
  10066. */
  10067. getNormals(): Vector3[];
  10068. /**
  10069. * Returns an array populated with binormal vectors on each Path3D curve point.
  10070. */
  10071. getBinormals(): Vector3[];
  10072. /**
  10073. * Returns an array populated with distances (float) of the i-th point from the first curve point.
  10074. */
  10075. getDistances(): number[];
  10076. /**
  10077. * Forces the Path3D tangent, normal, binormal and distance recomputation.
  10078. * Returns the same object updated.
  10079. */
  10080. update(path: Vector3[], firstNormal?: Vector3): Path3D;
  10081. }
  10082. class Curve3 {
  10083. /**
  10084. * Returns a Curve3 object along a Quadratic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#quadratic-bezier-curve
  10085. * @param v0 (Vector3) the origin point of the Quadratic Bezier
  10086. * @param v1 (Vector3) the control point
  10087. * @param v2 (Vector3) the end point of the Quadratic Bezier
  10088. * @param nbPoints (integer) the wanted number of points in the curve
  10089. */
  10090. static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3;
  10091. /**
  10092. * Returns a Curve3 object along a Cubic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#cubic-bezier-curve
  10093. * @param v0 (Vector3) the origin point of the Cubic Bezier
  10094. * @param v1 (Vector3) the first control point
  10095. * @param v2 (Vector3) the second control point
  10096. * @param v3 (Vector3) the end point of the Cubic Bezier
  10097. * @param nbPoints (integer) the wanted number of points in the curve
  10098. */
  10099. static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3;
  10100. /**
  10101. * Returns a Curve3 object along a Hermite Spline curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#hermite-spline
  10102. * @param p1 (Vector3) the origin point of the Hermite Spline
  10103. * @param t1 (Vector3) the tangent vector at the origin point
  10104. * @param p2 (Vector3) the end point of the Hermite Spline
  10105. * @param t2 (Vector3) the tangent vector at the end point
  10106. * @param nbPoints (integer) the wanted number of points in the curve
  10107. */
  10108. static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3;
  10109. /**
  10110. * Returns a Curve3 object along a CatmullRom Spline curve :
  10111. * @param points (array of Vector3) the points the spline must pass through. At least, four points required.
  10112. * @param nbPoints (integer) the wanted number of points between each curve control points.
  10113. */
  10114. static CreateCatmullRomSpline(points: Vector3[], nbPoints: number): Curve3;
  10115. /**
  10116. * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.
  10117. * A Curve3 is designed from a series of successive Vector3.
  10118. * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
  10119. */
  10120. constructor(points: Vector3[]);
  10121. /**
  10122. * Returns the Curve3 stored array of successive Vector3
  10123. */
  10124. getPoints(): Vector3[];
  10125. /**
  10126. * Returns the computed length (float) of the curve.
  10127. */
  10128. length(): number;
  10129. /**
  10130. * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);
  10131. * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.
  10132. * curveA and curveB keep unchanged.
  10133. */
  10134. continue(curve: Curve3): Curve3;
  10135. }
  10136. class SphericalHarmonics {
  10137. L00: Vector3;
  10138. L1_1: Vector3;
  10139. L10: Vector3;
  10140. L11: Vector3;
  10141. L2_2: Vector3;
  10142. L2_1: Vector3;
  10143. L20: Vector3;
  10144. L21: Vector3;
  10145. L22: Vector3;
  10146. addLight(direction: Vector3, color: Color3, deltaSolidAngle: number): void;
  10147. scale(scale: number): void;
  10148. }
  10149. class SphericalPolynomial {
  10150. x: Vector3;
  10151. y: Vector3;
  10152. z: Vector3;
  10153. xx: Vector3;
  10154. yy: Vector3;
  10155. zz: Vector3;
  10156. xy: Vector3;
  10157. yz: Vector3;
  10158. zx: Vector3;
  10159. addAmbient(color: Color3): void;
  10160. static getSphericalPolynomialFromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial;
  10161. }
  10162. class PositionNormalVertex {
  10163. position: Vector3;
  10164. normal: Vector3;
  10165. constructor(position?: Vector3, normal?: Vector3);
  10166. clone(): PositionNormalVertex;
  10167. }
  10168. class PositionNormalTextureVertex {
  10169. position: Vector3;
  10170. normal: Vector3;
  10171. uv: Vector2;
  10172. constructor(position?: Vector3, normal?: Vector3, uv?: Vector2);
  10173. clone(): PositionNormalTextureVertex;
  10174. }
  10175. class Tmp {
  10176. static Color3: Color3[];
  10177. static Vector2: Vector2[];
  10178. static Vector3: Vector3[];
  10179. static Vector4: Vector4[];
  10180. static Quaternion: Quaternion[];
  10181. static Matrix: Matrix[];
  10182. }
  10183. }
  10184. declare module BABYLON {
  10185. class MorphTarget {
  10186. name: string;
  10187. animations: Animation[];
  10188. onInfluenceChanged: Observable<boolean>;
  10189. influence: number;
  10190. constructor(name: string, influence?: number);
  10191. readonly hasNormals: boolean;
  10192. readonly hasTangents: boolean;
  10193. setPositions(data: Float32Array | number[]): void;
  10194. getPositions(): Float32Array;
  10195. setNormals(data: Float32Array | number[]): void;
  10196. getNormals(): Float32Array;
  10197. setTangents(data: Float32Array | number[]): void;
  10198. getTangents(): Float32Array;
  10199. /**
  10200. * Serializes the current target into a Serialization object.
  10201. * Returns the serialized object.
  10202. */
  10203. serialize(): any;
  10204. static Parse(serializationObject: any): MorphTarget;
  10205. static FromMesh(mesh: AbstractMesh, name?: string, influence?: number): MorphTarget;
  10206. }
  10207. }
  10208. declare module BABYLON {
  10209. class MorphTargetManager {
  10210. constructor(scene?: Scene);
  10211. readonly uniqueId: number;
  10212. readonly vertexCount: number;
  10213. readonly supportsNormals: boolean;
  10214. readonly supportsTangents: boolean;
  10215. readonly numTargets: number;
  10216. readonly numInfluencers: number;
  10217. readonly influences: Float32Array;
  10218. getActiveTarget(index: number): MorphTarget;
  10219. getTarget(index: number): MorphTarget;
  10220. addTarget(target: MorphTarget): void;
  10221. removeTarget(target: MorphTarget): void;
  10222. /**
  10223. * Serializes the current manager into a Serialization object.
  10224. * Returns the serialized object.
  10225. */
  10226. serialize(): any;
  10227. static Parse(serializationObject: any, scene: Scene): MorphTargetManager;
  10228. }
  10229. }
  10230. declare module BABYLON {
  10231. interface PhysicsImpostorJoint {
  10232. mainImpostor: PhysicsImpostor;
  10233. connectedImpostor: PhysicsImpostor;
  10234. joint: PhysicsJoint;
  10235. }
  10236. class PhysicsEngine {
  10237. gravity: Vector3;
  10238. constructor(gravity?: Vector3, _physicsPlugin?: IPhysicsEnginePlugin);
  10239. setGravity(gravity: Vector3): void;
  10240. /**
  10241. * Set the time step of the physics engine.
  10242. * default is 1/60.
  10243. * To slow it down, enter 1/600 for example.
  10244. * To speed it up, 1/30
  10245. * @param {number} newTimeStep the new timestep to apply to this world.
  10246. */
  10247. setTimeStep(newTimeStep?: number): void;
  10248. dispose(): void;
  10249. getPhysicsPluginName(): string;
  10250. static Epsilon: number;
  10251. /**
  10252. * Adding a new impostor for the impostor tracking.
  10253. * This will be done by the impostor itself.
  10254. * @param {PhysicsImpostor} impostor the impostor to add
  10255. */
  10256. addImpostor(impostor: PhysicsImpostor): void;
  10257. /**
  10258. * Remove an impostor from the engine.
  10259. * This impostor and its mesh will not longer be updated by the physics engine.
  10260. * @param {PhysicsImpostor} impostor the impostor to remove
  10261. */
  10262. removeImpostor(impostor: PhysicsImpostor): void;
  10263. /**
  10264. * Add a joint to the physics engine
  10265. * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
  10266. * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
  10267. * @param {PhysicsJoint} the joint that will connect both impostors.
  10268. */
  10269. addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  10270. removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  10271. /**
  10272. * Called by the scene. no need to call it.
  10273. */
  10274. getPhysicsPlugin(): IPhysicsEnginePlugin;
  10275. getImpostorForPhysicsObject(object: IPhysicsEnabledObject): PhysicsImpostor;
  10276. getImpostorWithPhysicsBody(body: any): PhysicsImpostor;
  10277. }
  10278. interface IPhysicsEnginePlugin {
  10279. world: any;
  10280. name: string;
  10281. setGravity(gravity: Vector3): any;
  10282. setTimeStep(timeStep: number): any;
  10283. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  10284. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  10285. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  10286. generatePhysicsBody(impostor: PhysicsImpostor): any;
  10287. removePhysicsBody(impostor: PhysicsImpostor): any;
  10288. generateJoint(joint: PhysicsImpostorJoint): any;
  10289. removeJoint(joint: PhysicsImpostorJoint): any;
  10290. isSupported(): boolean;
  10291. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): any;
  10292. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): any;
  10293. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  10294. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  10295. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  10296. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  10297. setBodyMass(impostor: PhysicsImpostor, mass: number): any;
  10298. sleepBody(impostor: PhysicsImpostor): any;
  10299. wakeUpBody(impostor: PhysicsImpostor): any;
  10300. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): any;
  10301. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): any;
  10302. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  10303. dispose(): any;
  10304. }
  10305. }
  10306. declare module BABYLON {
  10307. interface PhysicsImpostorParameters {
  10308. mass: number;
  10309. friction?: number;
  10310. restitution?: number;
  10311. nativeOptions?: any;
  10312. }
  10313. interface IPhysicsEnabledObject {
  10314. position: Vector3;
  10315. rotationQuaternion: Quaternion;
  10316. scaling: Vector3;
  10317. rotation?: Vector3;
  10318. parent?: any;
  10319. getBoundingInfo?(): BoundingInfo;
  10320. computeWorldMatrix?(force: boolean): void;
  10321. getWorldMatrix?(): Matrix;
  10322. getChildMeshes?(): Array<AbstractMesh>;
  10323. getVerticesData?(kind: string): Array<number> | Float32Array;
  10324. getIndices?(): IndicesArray;
  10325. getScene?(): Scene;
  10326. }
  10327. class PhysicsImpostor {
  10328. object: IPhysicsEnabledObject;
  10329. type: number;
  10330. static DEFAULT_OBJECT_SIZE: Vector3;
  10331. static IDENTITY_QUATERNION: Quaternion;
  10332. uniqueId: number;
  10333. constructor(object: IPhysicsEnabledObject, type: number, _options?: PhysicsImpostorParameters, _scene?: Scene);
  10334. /**
  10335. * This function will completly initialize this impostor.
  10336. * It will create a new body - but only if this mesh has no parent.
  10337. * If it has, this impostor will not be used other than to define the impostor
  10338. * of the child mesh.
  10339. */
  10340. /**
  10341. * Should a new body be generated.
  10342. */
  10343. isBodyInitRequired(): boolean;
  10344. setScalingUpdated(updated: boolean): void;
  10345. /**
  10346. * Force a regeneration of this or the parent's impostor's body.
  10347. * Use under cautious - This will remove all joints already implemented.
  10348. */
  10349. forceUpdate(): void;
  10350. /**
  10351. * Gets the body that holds this impostor. Either its own, or its parent.
  10352. */
  10353. /**
  10354. * Set the physics body. Used mainly by the physics engine/plugin
  10355. */
  10356. physicsBody: any;
  10357. parent: PhysicsImpostor;
  10358. resetUpdateFlags(): void;
  10359. getObjectExtendSize(): Vector3;
  10360. getObjectCenter(): Vector3;
  10361. /**
  10362. * Get a specific parametes from the options parameter.
  10363. */
  10364. getParam(paramName: string): any;
  10365. /**
  10366. * Sets a specific parameter in the options given to the physics plugin
  10367. */
  10368. setParam(paramName: string, value: number): void;
  10369. /**
  10370. * Specifically change the body's mass option. Won't recreate the physics body object
  10371. */
  10372. setMass(mass: number): void;
  10373. getLinearVelocity(): Vector3;
  10374. setLinearVelocity(velocity: Vector3): void;
  10375. getAngularVelocity(): Vector3;
  10376. setAngularVelocity(velocity: Vector3): void;
  10377. /**
  10378. * Execute a function with the physics plugin native code.
  10379. * Provide a function the will have two variables - the world object and the physics body object.
  10380. */
  10381. executeNativeFunction(func: (world: any, physicsBody: any) => void): void;
  10382. /**
  10383. * Register a function that will be executed before the physics world is stepping forward.
  10384. */
  10385. registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  10386. unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  10387. /**
  10388. * Register a function that will be executed after the physics step
  10389. */
  10390. registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  10391. unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  10392. /**
  10393. * register a function that will be executed when this impostor collides against a different body.
  10394. */
  10395. registerOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor) => void): void;
  10396. unregisterOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>) => void): void;
  10397. /**
  10398. * this function is executed by the physics engine.
  10399. */
  10400. beforeStep: () => void;
  10401. /**
  10402. * this function is executed by the physics engine.
  10403. */
  10404. afterStep: () => void;
  10405. /**
  10406. * Legacy collision detection event support
  10407. */
  10408. onCollideEvent: (collider: BABYLON.PhysicsImpostor, collidedWith: BABYLON.PhysicsImpostor) => void;
  10409. onCollide: (e: {
  10410. body: any;
  10411. }) => void;
  10412. /**
  10413. * Apply a force
  10414. */
  10415. applyForce(force: Vector3, contactPoint: Vector3): void;
  10416. /**
  10417. * Apply an impulse
  10418. */
  10419. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  10420. /**
  10421. * A help function to create a joint.
  10422. */
  10423. createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): void;
  10424. /**
  10425. * Add a joint to this impostor with a different impostor.
  10426. */
  10427. addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  10428. /**
  10429. * Will keep this body still, in a sleep mode.
  10430. */
  10431. sleep(): void;
  10432. /**
  10433. * Wake the body up.
  10434. */
  10435. wakeUp(): void;
  10436. clone(newObject: IPhysicsEnabledObject): PhysicsImpostor;
  10437. dispose(): void;
  10438. setDeltaPosition(position: Vector3): void;
  10439. setDeltaRotation(rotation: Quaternion): void;
  10440. static NoImpostor: number;
  10441. static SphereImpostor: number;
  10442. static BoxImpostor: number;
  10443. static PlaneImpostor: number;
  10444. static MeshImpostor: number;
  10445. static CylinderImpostor: number;
  10446. static ParticleImpostor: number;
  10447. static HeightmapImpostor: number;
  10448. }
  10449. }
  10450. declare module BABYLON {
  10451. interface PhysicsJointData {
  10452. mainPivot?: Vector3;
  10453. connectedPivot?: Vector3;
  10454. mainAxis?: Vector3;
  10455. connectedAxis?: Vector3;
  10456. collision?: boolean;
  10457. nativeParams?: any;
  10458. }
  10459. /**
  10460. * This is a holder class for the physics joint created by the physics plugin.
  10461. * It holds a set of functions to control the underlying joint.
  10462. */
  10463. class PhysicsJoint {
  10464. type: number;
  10465. jointData: PhysicsJointData;
  10466. constructor(type: number, jointData: PhysicsJointData);
  10467. physicsJoint: any;
  10468. physicsPlugin: IPhysicsEnginePlugin;
  10469. /**
  10470. * Execute a function that is physics-plugin specific.
  10471. * @param {Function} func the function that will be executed.
  10472. * It accepts two parameters: the physics world and the physics joint.
  10473. */
  10474. executeNativeFunction(func: (world: any, physicsJoint: any) => void): void;
  10475. static DistanceJoint: number;
  10476. static HingeJoint: number;
  10477. static BallAndSocketJoint: number;
  10478. static WheelJoint: number;
  10479. static SliderJoint: number;
  10480. static PrismaticJoint: number;
  10481. static UniversalJoint: number;
  10482. static Hinge2Joint: number;
  10483. static PointToPointJoint: number;
  10484. static SpringJoint: number;
  10485. static LockJoint: number;
  10486. }
  10487. /**
  10488. * A class representing a physics distance joint.
  10489. */
  10490. class DistanceJoint extends PhysicsJoint {
  10491. constructor(jointData: DistanceJointData);
  10492. /**
  10493. * Update the predefined distance.
  10494. */
  10495. updateDistance(maxDistance: number, minDistance?: number): void;
  10496. }
  10497. class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {
  10498. constructor(type: number, jointData: PhysicsJointData);
  10499. /**
  10500. * Set the motor values.
  10501. * Attention, this function is plugin specific. Engines won't react 100% the same.
  10502. * @param {number} force the force to apply
  10503. * @param {number} maxForce max force for this motor.
  10504. */
  10505. setMotor(force?: number, maxForce?: number): void;
  10506. /**
  10507. * Set the motor's limits.
  10508. * Attention, this function is plugin specific. Engines won't react 100% the same.
  10509. */
  10510. setLimit(upperLimit: number, lowerLimit?: number): void;
  10511. }
  10512. /**
  10513. * This class represents a single hinge physics joint
  10514. */
  10515. class HingeJoint extends MotorEnabledJoint {
  10516. constructor(jointData: PhysicsJointData);
  10517. /**
  10518. * Set the motor values.
  10519. * Attention, this function is plugin specific. Engines won't react 100% the same.
  10520. * @param {number} force the force to apply
  10521. * @param {number} maxForce max force for this motor.
  10522. */
  10523. setMotor(force?: number, maxForce?: number): void;
  10524. /**
  10525. * Set the motor's limits.
  10526. * Attention, this function is plugin specific. Engines won't react 100% the same.
  10527. */
  10528. setLimit(upperLimit: number, lowerLimit?: number): void;
  10529. }
  10530. /**
  10531. * This class represents a dual hinge physics joint (same as wheel joint)
  10532. */
  10533. class Hinge2Joint extends MotorEnabledJoint {
  10534. constructor(jointData: PhysicsJointData);
  10535. /**
  10536. * Set the motor values.
  10537. * Attention, this function is plugin specific. Engines won't react 100% the same.
  10538. * @param {number} force the force to apply
  10539. * @param {number} maxForce max force for this motor.
  10540. * @param {motorIndex} the motor's index, 0 or 1.
  10541. */
  10542. setMotor(force?: number, maxForce?: number, motorIndex?: number): void;
  10543. /**
  10544. * Set the motor limits.
  10545. * Attention, this function is plugin specific. Engines won't react 100% the same.
  10546. * @param {number} upperLimit the upper limit
  10547. * @param {number} lowerLimit lower limit
  10548. * @param {motorIndex} the motor's index, 0 or 1.
  10549. */
  10550. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  10551. }
  10552. interface IMotorEnabledJoint {
  10553. physicsJoint: any;
  10554. setMotor(force?: number, maxForce?: number, motorIndex?: number): any;
  10555. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  10556. }
  10557. interface DistanceJointData extends PhysicsJointData {
  10558. maxDistance: number;
  10559. }
  10560. interface SpringJointData extends PhysicsJointData {
  10561. length: number;
  10562. stiffness: number;
  10563. damping: number;
  10564. }
  10565. }
  10566. declare module BABYLON {
  10567. class Particle {
  10568. position: Vector3;
  10569. direction: Vector3;
  10570. color: Color4;
  10571. colorStep: Color4;
  10572. lifeTime: number;
  10573. age: number;
  10574. size: number;
  10575. angle: number;
  10576. angularSpeed: number;
  10577. copyTo(other: Particle): void;
  10578. }
  10579. }
  10580. declare module BABYLON {
  10581. class ParticleSystem implements IDisposable, IAnimatable {
  10582. name: string;
  10583. static BLENDMODE_ONEONE: number;
  10584. static BLENDMODE_STANDARD: number;
  10585. animations: Animation[];
  10586. id: string;
  10587. renderingGroupId: number;
  10588. emitter: any;
  10589. emitRate: number;
  10590. manualEmitCount: number;
  10591. updateSpeed: number;
  10592. targetStopDuration: number;
  10593. disposeOnStop: boolean;
  10594. minEmitPower: number;
  10595. maxEmitPower: number;
  10596. minLifeTime: number;
  10597. maxLifeTime: number;
  10598. minSize: number;
  10599. maxSize: number;
  10600. minAngularSpeed: number;
  10601. maxAngularSpeed: number;
  10602. particleTexture: Texture;
  10603. layerMask: number;
  10604. customShader: any;
  10605. preventAutoStart: boolean;
  10606. /**
  10607. * An event triggered when the system is disposed.
  10608. * @type {BABYLON.Observable}
  10609. */
  10610. onDisposeObservable: Observable<ParticleSystem>;
  10611. onDispose: () => void;
  10612. updateFunction: (particles: Particle[]) => void;
  10613. blendMode: number;
  10614. forceDepthWrite: boolean;
  10615. gravity: Vector3;
  10616. direction1: Vector3;
  10617. direction2: Vector3;
  10618. minEmitBox: Vector3;
  10619. maxEmitBox: Vector3;
  10620. color1: Color4;
  10621. color2: Color4;
  10622. colorDead: Color4;
  10623. textureMask: Color4;
  10624. startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle) => void;
  10625. startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle) => void;
  10626. private particles;
  10627. constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
  10628. recycleParticle(particle: Particle): void;
  10629. getCapacity(): number;
  10630. isAlive(): boolean;
  10631. isStarted(): boolean;
  10632. start(): void;
  10633. stop(): void;
  10634. animate(): void;
  10635. render(): number;
  10636. dispose(): void;
  10637. clone(name: string, newEmitter: any): ParticleSystem;
  10638. serialize(): any;
  10639. static Parse(parsedParticleSystem: any, scene: Scene, rootUrl: string): ParticleSystem;
  10640. }
  10641. }
  10642. declare module BABYLON {
  10643. class SolidParticle {
  10644. idx: number;
  10645. color: Color4;
  10646. position: Vector3;
  10647. rotation: Vector3;
  10648. rotationQuaternion: Quaternion;
  10649. scaling: Vector3;
  10650. uvs: Vector4;
  10651. velocity: Vector3;
  10652. alive: boolean;
  10653. isVisible: boolean;
  10654. shapeId: number;
  10655. idxInShape: number;
  10656. /**
  10657. * Creates a Solid Particle object.
  10658. * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()
  10659. * `particleIndex` (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier.
  10660. * `positionIndex` (integer) is the starting index of the particle vertices in the SPS "positions" array.
  10661. * `model` (ModelShape) is a reference to the model shape on what the particle is designed.
  10662. * `shapeId` (integer) is the model shape identifier in the SPS.
  10663. * `idxInShape` (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))
  10664. * `modelBoundingInfo` is the reference to the model BoundingInfo used for intersection computations.
  10665. */
  10666. constructor(particleIndex: number, positionIndex: number, model: ModelShape, shapeId: number, idxInShape: number, sps: SolidParticleSystem, modelBoundingInfo?: BoundingInfo);
  10667. /**
  10668. * legacy support, changed scale to scaling
  10669. */
  10670. scale: Vector3;
  10671. /**
  10672. * legacy support, changed quaternion to rotationQuaternion
  10673. */
  10674. quaternion: Quaternion;
  10675. /**
  10676. * Returns a boolean. True if the particle intersects another particle or another mesh, else false.
  10677. * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)
  10678. * `target` is the object (solid particle or mesh) what the intersection is computed against.
  10679. */
  10680. intersectsMesh(target: Mesh | SolidParticle): boolean;
  10681. }
  10682. class ModelShape {
  10683. shapeID: number;
  10684. /**
  10685. * 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.
  10686. * SPS internal tool, don't use it manually.
  10687. */
  10688. constructor(id: number, shape: Vector3[], shapeUV: number[], posFunction: (particle: SolidParticle, i: number, s: number) => void, vtxFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void);
  10689. }
  10690. }
  10691. declare module BABYLON {
  10692. /**
  10693. * Full documentation here : http://doc.babylonjs.com/overviews/Solid_Particle_System
  10694. */
  10695. class SolidParticleSystem implements IDisposable {
  10696. /**
  10697. * The SPS array of Solid Particle objects. Just access each particle as with any classic array.
  10698. * Example : var p = SPS.particles[i];
  10699. */
  10700. particles: SolidParticle[];
  10701. /**
  10702. * The SPS total number of particles. Read only. Use SPS.counter instead if you need to set your own value.
  10703. */
  10704. nbParticles: number;
  10705. /**
  10706. * If the particles must ever face the camera (default false). Useful for planar particles.
  10707. */
  10708. billboard: boolean;
  10709. /**
  10710. * Recompute normals when adding a shape
  10711. */
  10712. recomputeNormals: boolean;
  10713. /**
  10714. * This a counter ofr your own usage. It's not set by any SPS functions.
  10715. */
  10716. counter: number;
  10717. /**
  10718. * The SPS name. This name is also given to the underlying mesh.
  10719. */
  10720. name: string;
  10721. /**
  10722. * The SPS mesh. It's a standard BJS Mesh, so all the methods from the Mesh class are avalaible.
  10723. */
  10724. mesh: Mesh;
  10725. /**
  10726. * This empty object is intended to store some SPS specific or temporary values in order to lower the Garbage Collector activity.
  10727. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#garbage-collector-concerns
  10728. */
  10729. vars: any;
  10730. /**
  10731. * This array is populated when the SPS is set as 'pickable'.
  10732. * Each key of this array is a `faceId` value that you can get from a pickResult object.
  10733. * Each element of this array is an object `{idx: int, faceId: int}`.
  10734. * `idx` is the picked particle index in the `SPS.particles` array
  10735. * `faceId` is the picked face index counted within this particle.
  10736. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#pickable-particles
  10737. */
  10738. pickedParticles: {
  10739. idx: number;
  10740. faceId: number;
  10741. }[];
  10742. /**
  10743. * Creates a SPS (Solid Particle System) object.
  10744. * `name` (String) is the SPS name, this will be the underlying mesh name.
  10745. * `scene` (Scene) is the scene in which the SPS is added.
  10746. * `updatable` (optional boolean, default true) : if the SPS must be updatable or immutable.
  10747. * `isPickable` (optional boolean, default false) : if the solid particles must be pickable.
  10748. * `particleIntersection` (optional boolean, default false) : if the solid particle intersections must be computed.
  10749. * `boundingSphereOnly` (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
  10750. * `bSphereRadiusFactor` (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
  10751. * Example : bSphereRadiusFactor = 1.0 / Math.sqrt(3.0) => the bounding sphere exactly matches a spherical mesh.
  10752. */
  10753. constructor(name: string, scene: Scene, options?: {
  10754. updatable?: boolean;
  10755. isPickable?: boolean;
  10756. particleIntersection?: boolean;
  10757. boundingSphereOnly?: boolean;
  10758. bSphereRadiusFactor?: number;
  10759. });
  10760. /**
  10761. * Builds the SPS underlying mesh. Returns a standard Mesh.
  10762. * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.
  10763. */
  10764. buildMesh(): Mesh;
  10765. /**
  10766. * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
  10767. * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
  10768. * Thus the particles generated from `digest()` have their property `position` set yet.
  10769. * `mesh` ( Mesh ) is the mesh to be digested
  10770. * `facetNb` (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any
  10771. * `delta` (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
  10772. * `number` (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets
  10773. */
  10774. digest(mesh: Mesh, options?: {
  10775. facetNb?: number;
  10776. number?: number;
  10777. delta?: number;
  10778. }): SolidParticleSystem;
  10779. /**
  10780. * Adds some particles to the SPS from the model shape. Returns the shape id.
  10781. * Please read the doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#create-an-immutable-sps
  10782. * `mesh` is any Mesh object that will be used as a model for the solid particles.
  10783. * `nb` (positive integer) the number of particles to be created from this model
  10784. * `positionFunction` is an optional javascript function to called for each particle on SPS creation.
  10785. * `vertexFunction` is an optional javascript function to called for each vertex of each particle on SPS creation
  10786. */
  10787. addShape(mesh: Mesh, nb: number, options?: {
  10788. positionFunction?: any;
  10789. vertexFunction?: any;
  10790. }): number;
  10791. /**
  10792. * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
  10793. * Returns the SPS.
  10794. */
  10795. rebuildMesh(): SolidParticleSystem;
  10796. /**
  10797. * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.
  10798. * This method calls `updateParticle()` for each particle of the SPS.
  10799. * For an animated SPS, it is usually called within the render loop.
  10800. * @param start The particle index in the particle array where to start to compute the particle property values _(default 0)_
  10801. * @param end The particle index in the particle array where to stop to compute the particle property values _(default nbParticle - 1)_
  10802. * @param update If the mesh must be finally updated on this call after all the particle computations _(default true)_
  10803. * Returns the SPS.
  10804. */
  10805. setParticles(start?: number, end?: number, update?: boolean): SolidParticleSystem;
  10806. /**
  10807. * Disposes the SPS.
  10808. * Returns nothing.
  10809. */
  10810. dispose(): void;
  10811. /**
  10812. * Visibilty helper : Recomputes the visible size according to the mesh bounding box
  10813. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  10814. * Returns the SPS.
  10815. */
  10816. refreshVisibleSize(): SolidParticleSystem;
  10817. /**
  10818. * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.
  10819. * @param size the size (float) of the visibility box
  10820. * note : this doesn't lock the SPS mesh bounding box.
  10821. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  10822. */
  10823. setVisibilityBox(size: number): void;
  10824. /**
  10825. * Sets the SPS as always visible or not
  10826. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  10827. */
  10828. isAlwaysVisible: boolean;
  10829. /**
  10830. * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.
  10831. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  10832. */
  10833. isVisibilityBoxLocked: boolean;
  10834. /**
  10835. * Tells to `setParticles()` to compute the particle rotations or not.
  10836. * Default value : true. The SPS is faster when it's set to false.
  10837. * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.
  10838. */
  10839. computeParticleRotation: boolean;
  10840. /**
  10841. * Tells to `setParticles()` to compute the particle colors or not.
  10842. * Default value : true. The SPS is faster when it's set to false.
  10843. * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.
  10844. */
  10845. computeParticleColor: boolean;
  10846. /**
  10847. * Tells to `setParticles()` to compute the particle textures or not.
  10848. * Default value : true. The SPS is faster when it's set to false.
  10849. * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.
  10850. */
  10851. computeParticleTexture: boolean;
  10852. /**
  10853. * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.
  10854. * Default value : false. The SPS is faster when it's set to false.
  10855. * Note : the particle custom vertex positions aren't stored values.
  10856. */
  10857. computeParticleVertex: boolean;
  10858. /**
  10859. * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.
  10860. */
  10861. computeBoundingBox: boolean;
  10862. /**
  10863. * This function does nothing. It may be overwritten to set all the particle first values.
  10864. * The SPS doesn't call this function, you may have to call it by your own.
  10865. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  10866. */
  10867. initParticles(): void;
  10868. /**
  10869. * This function does nothing. It may be overwritten to recycle a particle.
  10870. * The SPS doesn't call this function, you may have to call it by your own.
  10871. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  10872. */
  10873. recycleParticle(particle: SolidParticle): SolidParticle;
  10874. /**
  10875. * Updates a particle : this function should be overwritten by the user.
  10876. * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.
  10877. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  10878. * ex : just set a particle position or velocity and recycle conditions
  10879. */
  10880. updateParticle(particle: SolidParticle): SolidParticle;
  10881. /**
  10882. * Updates a vertex of a particle : it can be overwritten by the user.
  10883. * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.
  10884. * @param particle the current particle
  10885. * @param vertex the current index of the current particle
  10886. * @param pt the index of the current vertex in the particle shape
  10887. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#update-each-particle-shape
  10888. * ex : just set a vertex particle position
  10889. */
  10890. updateParticleVertex(particle: SolidParticle, vertex: Vector3, pt: number): Vector3;
  10891. /**
  10892. * This will be called before any other treatment by `setParticles()` and will be passed three parameters.
  10893. * This does nothing and may be overwritten by the user.
  10894. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  10895. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  10896. * @param update the boolean update value actually passed to setParticles()
  10897. */
  10898. beforeUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  10899. /**
  10900. * This will be called by `setParticles()` after all the other treatments and just before the actual mesh update.
  10901. * This will be passed three parameters.
  10902. * This does nothing and may be overwritten by the user.
  10903. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  10904. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  10905. * @param update the boolean update value actually passed to setParticles()
  10906. */
  10907. afterUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  10908. }
  10909. }
  10910. declare module BABYLON {
  10911. class ReflectionProbe {
  10912. name: string;
  10913. invertYAxis: boolean;
  10914. position: Vector3;
  10915. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  10916. samples: number;
  10917. refreshRate: number;
  10918. getScene(): Scene;
  10919. readonly cubeTexture: RenderTargetTexture;
  10920. readonly renderList: AbstractMesh[];
  10921. attachToMesh(mesh: AbstractMesh): void;
  10922. /**
  10923. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  10924. *
  10925. * @param renderingGroupId The rendering group id corresponding to its index
  10926. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  10927. */
  10928. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  10929. dispose(): void;
  10930. }
  10931. }
  10932. declare module BABYLON {
  10933. class BoundingBoxRenderer {
  10934. frontColor: Color3;
  10935. backColor: Color3;
  10936. showBackLines: boolean;
  10937. renderList: SmartArray<BoundingBox>;
  10938. constructor(scene: Scene);
  10939. reset(): void;
  10940. render(): void;
  10941. dispose(): void;
  10942. }
  10943. }
  10944. declare module BABYLON {
  10945. class DepthRenderer {
  10946. constructor(scene: Scene, type?: number);
  10947. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  10948. getDepthMap(): RenderTargetTexture;
  10949. dispose(): void;
  10950. }
  10951. }
  10952. declare module BABYLON {
  10953. class EdgesRenderer {
  10954. edgesWidthScalerForOrthographic: number;
  10955. edgesWidthScalerForPerspective: number;
  10956. constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean);
  10957. dispose(): void;
  10958. render(): void;
  10959. }
  10960. }
  10961. declare module BABYLON {
  10962. class GeometryBufferRenderer {
  10963. renderList: Mesh[];
  10964. readonly isSupported: boolean;
  10965. constructor(scene: Scene, ratio?: number);
  10966. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  10967. getGBuffer(): MultiRenderTarget;
  10968. dispose(): void;
  10969. }
  10970. }
  10971. declare module BABYLON {
  10972. class OutlineRenderer {
  10973. zOffset: number;
  10974. constructor(scene: Scene);
  10975. render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void;
  10976. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  10977. }
  10978. }
  10979. declare module BABYLON {
  10980. class RenderingGroup {
  10981. index: number;
  10982. onBeforeTransparentRendering: () => void;
  10983. /**
  10984. * Set the opaque sort comparison function.
  10985. * If null the sub meshes will be render in the order they were created
  10986. */
  10987. opaqueSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  10988. /**
  10989. * Set the alpha test sort comparison function.
  10990. * If null the sub meshes will be render in the order they were created
  10991. */
  10992. alphaTestSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  10993. /**
  10994. * Set the transparent sort comparison function.
  10995. * If null the sub meshes will be render in the order they were created
  10996. */
  10997. transparentSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  10998. /**
  10999. * Creates a new rendering group.
  11000. * @param index The rendering group index
  11001. * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied
  11002. * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied
  11003. * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied
  11004. */
  11005. constructor(index: number, scene: Scene, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number);
  11006. /**
  11007. * Render all the sub meshes contained in the group.
  11008. * @param customRenderFunction Used to override the default render behaviour of the group.
  11009. * @returns true if rendered some submeshes.
  11010. */
  11011. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void, renderSprites: boolean, renderParticles: boolean, activeMeshes: AbstractMesh[]): void;
  11012. /**
  11013. * Renders the opaque submeshes in the order from the opaqueSortCompareFn.
  11014. * @param subMeshes The submeshes to render
  11015. */
  11016. private renderOpaqueSorted(subMeshes);
  11017. /**
  11018. * Renders the opaque submeshes in the order from the alphatestSortCompareFn.
  11019. * @param subMeshes The submeshes to render
  11020. */
  11021. private renderAlphaTestSorted(subMeshes);
  11022. /**
  11023. * Renders the opaque submeshes in the order from the transparentSortCompareFn.
  11024. * @param subMeshes The submeshes to render
  11025. */
  11026. private renderTransparentSorted(subMeshes);
  11027. /**
  11028. * Renders the submeshes in a specified order.
  11029. * @param subMeshes The submeshes to sort before render
  11030. * @param sortCompareFn The comparison function use to sort
  11031. * @param cameraPosition The camera position use to preprocess the submeshes to help sorting
  11032. * @param transparent Specifies to activate blending if true
  11033. */
  11034. private static renderSorted(subMeshes, sortCompareFn, cameraPosition, transparent);
  11035. /**
  11036. * Renders the submeshes in the order they were dispatched (no sort applied).
  11037. * @param subMeshes The submeshes to render
  11038. */
  11039. private static renderUnsorted(subMeshes);
  11040. /**
  11041. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  11042. * are rendered back to front if in the same alpha index.
  11043. *
  11044. * @param a The first submesh
  11045. * @param b The second submesh
  11046. * @returns The result of the comparison
  11047. */
  11048. static defaultTransparentSortCompare(a: SubMesh, b: SubMesh): number;
  11049. /**
  11050. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  11051. * are rendered back to front.
  11052. *
  11053. * @param a The first submesh
  11054. * @param b The second submesh
  11055. * @returns The result of the comparison
  11056. */
  11057. static backToFrontSortCompare(a: SubMesh, b: SubMesh): number;
  11058. /**
  11059. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  11060. * are rendered front to back (prevent overdraw).
  11061. *
  11062. * @param a The first submesh
  11063. * @param b The second submesh
  11064. * @returns The result of the comparison
  11065. */
  11066. static frontToBackSortCompare(a: SubMesh, b: SubMesh): number;
  11067. /**
  11068. * Resets the different lists of submeshes to prepare a new frame.
  11069. */
  11070. prepare(): void;
  11071. dispose(): void;
  11072. /**
  11073. * Inserts the submesh in its correct queue depending on its material.
  11074. * @param subMesh The submesh to dispatch
  11075. */
  11076. dispatch(subMesh: SubMesh): void;
  11077. dispatchSprites(spriteManager: SpriteManager): void;
  11078. dispatchParticles(particleSystem: ParticleSystem): void;
  11079. }
  11080. }
  11081. declare module BABYLON {
  11082. class RenderingManager {
  11083. /**
  11084. * The max id used for rendering groups (not included)
  11085. */
  11086. static MAX_RENDERINGGROUPS: number;
  11087. /**
  11088. * The min id used for rendering groups (included)
  11089. */
  11090. static MIN_RENDERINGGROUPS: number;
  11091. /**
  11092. * Used to globally prevent autoclearing scenes.
  11093. */
  11094. static AUTOCLEAR: boolean;
  11095. constructor(scene: Scene);
  11096. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void;
  11097. reset(): void;
  11098. dispose(): void;
  11099. dispatchSprites(spriteManager: SpriteManager): void;
  11100. dispatchParticles(particleSystem: ParticleSystem): void;
  11101. dispatch(subMesh: SubMesh): void;
  11102. /**
  11103. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  11104. * This allowed control for front to back rendering or reversly depending of the special needs.
  11105. *
  11106. * @param renderingGroupId The rendering group id corresponding to its index
  11107. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  11108. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  11109. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  11110. */
  11111. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  11112. /**
  11113. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  11114. *
  11115. * @param renderingGroupId The rendering group id corresponding to its index
  11116. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  11117. * @param depth Automatically clears depth between groups if true and autoClear is true.
  11118. * @param stencil Automatically clears stencil between groups if true and autoClear is true.
  11119. */
  11120. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth?: boolean, stencil?: boolean): void;
  11121. }
  11122. }
  11123. declare module BABYLON {
  11124. class AnaglyphPostProcess extends PostProcess {
  11125. constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
  11126. }
  11127. }
  11128. declare module BABYLON {
  11129. class BlackAndWhitePostProcess extends PostProcess {
  11130. degree: number;
  11131. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  11132. }
  11133. }
  11134. declare module BABYLON {
  11135. class BlurPostProcess extends PostProcess {
  11136. direction: Vector2;
  11137. /**
  11138. * Gets the length in pixels of the blur sample region
  11139. */
  11140. /**
  11141. * Sets the length in pixels of the blur sample region
  11142. */
  11143. kernel: number;
  11144. /**
  11145. * Gets wether or not the blur is unpacking/repacking floats
  11146. */
  11147. /**
  11148. * Sets wether or not the blur needs to unpack/repack floats
  11149. */
  11150. packedFloat: boolean;
  11151. constructor(name: string, direction: Vector2, kernel: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
  11152. /**
  11153. * Best kernels are odd numbers that when divided by 2, their integer part is even, so 5, 9 or 13.
  11154. * Other odd kernels optimize correctly but require proportionally more samples, even kernels are
  11155. * possible but will produce minor visual artifacts. Since each new kernel requires a new shader we
  11156. * want to minimize kernel changes, having gaps between physical kernels is helpful in that regard.
  11157. * The gaps between physical kernels are compensated for in the weighting of the samples
  11158. * @param idealKernel Ideal blur kernel.
  11159. * @return Nearest best kernel.
  11160. */
  11161. /**
  11162. * Calculates the value of a Gaussian distribution with sigma 3 at a given point.
  11163. * @param x The point on the Gaussian distribution to sample.
  11164. * @return the value of the Gaussian function at x.
  11165. */
  11166. /**
  11167. * Generates a string that can be used as a floating point number in GLSL.
  11168. * @param x Value to print.
  11169. * @param decimalFigures Number of decimal places to print the number to (excluding trailing 0s).
  11170. * @return GLSL float string.
  11171. */
  11172. }
  11173. }
  11174. declare module BABYLON {
  11175. class ColorCorrectionPostProcess extends PostProcess {
  11176. constructor(name: string, colorTableUrl: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  11177. }
  11178. }
  11179. declare module BABYLON {
  11180. class ConvolutionPostProcess extends PostProcess {
  11181. kernel: number[];
  11182. constructor(name: string, kernel: number[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  11183. static EdgeDetect0Kernel: number[];
  11184. static EdgeDetect1Kernel: number[];
  11185. static EdgeDetect2Kernel: number[];
  11186. static SharpenKernel: number[];
  11187. static EmbossKernel: number[];
  11188. static GaussianKernel: number[];
  11189. }
  11190. }
  11191. declare module BABYLON {
  11192. class DisplayPassPostProcess extends PostProcess {
  11193. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  11194. }
  11195. }
  11196. declare module BABYLON {
  11197. class FilterPostProcess extends PostProcess {
  11198. kernelMatrix: Matrix;
  11199. constructor(name: string, kernelMatrix: Matrix, options: number | PostProcessOptions, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  11200. }
  11201. }
  11202. declare module BABYLON {
  11203. class FxaaPostProcess extends PostProcess {
  11204. texelWidth: number;
  11205. texelHeight: number;
  11206. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
  11207. }
  11208. }
  11209. declare module BABYLON {
  11210. class HighlightsPostProcess extends PostProcess {
  11211. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
  11212. }
  11213. }
  11214. declare module BABYLON {
  11215. class ImageProcessingPostProcess extends PostProcess {
  11216. colorGradingWeight: number;
  11217. colorCurves: ColorCurves;
  11218. cameraFov: number;
  11219. vignetteStretch: number;
  11220. vignetteCentreX: number;
  11221. vignetteCentreY: number;
  11222. vignetteWeight: number;
  11223. vignetteColor: BABYLON.Color4;
  11224. cameraContrast: number;
  11225. cameraExposure: number;
  11226. colorGradingTexture: BaseTexture;
  11227. vignetteBlendMode: number;
  11228. colorCurvesEnabled: boolean;
  11229. vignetteEnabled: boolean;
  11230. fromLinearSpace: boolean;
  11231. cameraToneMappingEnabled: boolean;
  11232. constructor(name: string, options: number | PostProcessOptions, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
  11233. static readonly VIGNETTEMODE_MULTIPLY: number;
  11234. static readonly VIGNETTEMODE_OPAQUE: number;
  11235. }
  11236. }
  11237. declare module BABYLON {
  11238. class PassPostProcess extends PostProcess {
  11239. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
  11240. }
  11241. }
  11242. declare module BABYLON {
  11243. type PostProcessOptions = {
  11244. width: number;
  11245. height: number;
  11246. };
  11247. class PostProcess {
  11248. name: string;
  11249. width: number;
  11250. height: number;
  11251. renderTargetSamplingMode: number;
  11252. clearColor: Color4;
  11253. autoClear: boolean;
  11254. alphaMode: number;
  11255. alphaConstants: Color4;
  11256. enablePixelPerfectMode: boolean;
  11257. scaleMode: number;
  11258. alwaysForcePOT: boolean;
  11259. samples: number;
  11260. /**
  11261. * An event triggered when the postprocess is activated.
  11262. * @type {BABYLON.Observable}
  11263. */
  11264. onActivateObservable: Observable<Camera>;
  11265. onActivate: (camera: Camera) => void;
  11266. /**
  11267. * An event triggered when the postprocess changes its size.
  11268. * @type {BABYLON.Observable}
  11269. */
  11270. onSizeChangedObservable: Observable<PostProcess>;
  11271. onSizeChanged: (postProcess: PostProcess) => void;
  11272. /**
  11273. * An event triggered when the postprocess applies its effect.
  11274. * @type {BABYLON.Observable}
  11275. */
  11276. onApplyObservable: Observable<Effect>;
  11277. onApply: (effect: Effect) => void;
  11278. /**
  11279. * An event triggered before rendering the postprocess
  11280. * @type {BABYLON.Observable}
  11281. */
  11282. onBeforeRenderObservable: Observable<Effect>;
  11283. onBeforeRender: (effect: Effect) => void;
  11284. /**
  11285. * An event triggered after rendering the postprocess
  11286. * @type {BABYLON.Observable}
  11287. */
  11288. onAfterRenderObservable: Observable<Effect>;
  11289. onAfterRender: (efect: Effect) => void;
  11290. outputTexture: WebGLTexture;
  11291. getCamera(): Camera;
  11292. readonly texelSize: Vector2;
  11293. constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number, vertexUrl?: string, indexParameters?: any, blockCompilation?: boolean);
  11294. getEngine(): Engine;
  11295. getEffect(): Effect;
  11296. shareOutputWith(postProcess: PostProcess): PostProcess;
  11297. updateEffect(defines?: string, uniforms?: string[], samplers?: string[], indexParameters?: any, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): void;
  11298. isReusable(): boolean;
  11299. /** invalidate frameBuffer to hint the postprocess to create a depth buffer */
  11300. markTextureDirty(): void;
  11301. activate(camera: Camera, sourceTexture?: WebGLTexture, forceDepthStencil?: boolean): void;
  11302. readonly isSupported: boolean;
  11303. readonly aspectRatio: number;
  11304. apply(): Effect;
  11305. dispose(camera?: Camera): void;
  11306. }
  11307. }
  11308. declare module BABYLON {
  11309. class PostProcessManager {
  11310. constructor(scene: Scene);
  11311. directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void;
  11312. dispose(): void;
  11313. }
  11314. }
  11315. declare module BABYLON {
  11316. class RefractionPostProcess extends PostProcess {
  11317. color: Color3;
  11318. depth: number;
  11319. colorLevel: number;
  11320. constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  11321. dispose(camera: Camera): void;
  11322. }
  11323. }
  11324. declare module BABYLON {
  11325. class StereoscopicInterlacePostProcess extends PostProcess {
  11326. constructor(name: string, rigCameras: Camera[], isStereoscopicHoriz: boolean, samplingMode?: number, engine?: Engine, reusable?: boolean);
  11327. }
  11328. }
  11329. declare module BABYLON {
  11330. enum TonemappingOperator {
  11331. Hable = 0,
  11332. Reinhard = 1,
  11333. HejiDawson = 2,
  11334. Photographic = 3,
  11335. }
  11336. class TonemapPostProcess extends PostProcess {
  11337. exposureAdjustment: number;
  11338. constructor(name: string, _operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number);
  11339. }
  11340. }
  11341. declare module BABYLON {
  11342. class VolumetricLightScatteringPostProcess extends PostProcess {
  11343. /**
  11344. * If not undefined, the mesh position is computed from the attached node position
  11345. * @type {{position: Vector3}}
  11346. */
  11347. attachedNode: {
  11348. position: Vector3;
  11349. };
  11350. /**
  11351. * Custom position of the mesh. Used if "useCustomMeshPosition" is set to "true"
  11352. * @type {Vector3}
  11353. */
  11354. customMeshPosition: Vector3;
  11355. /**
  11356. * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)
  11357. * @type {boolean}
  11358. */
  11359. useCustomMeshPosition: boolean;
  11360. /**
  11361. * If the post-process should inverse the light scattering direction
  11362. * @type {boolean}
  11363. */
  11364. invert: boolean;
  11365. /**
  11366. * The internal mesh used by the post-process
  11367. * @type {boolean}
  11368. */
  11369. mesh: Mesh;
  11370. useDiffuseColor: boolean;
  11371. /**
  11372. * Array containing the excluded meshes not rendered in the internal pass
  11373. */
  11374. excludedMeshes: AbstractMesh[];
  11375. /**
  11376. * Controls the overall intensity of the post-process
  11377. * @type {number}
  11378. */
  11379. exposure: number;
  11380. /**
  11381. * Dissipates each sample's contribution in range [0, 1]
  11382. * @type {number}
  11383. */
  11384. decay: number;
  11385. /**
  11386. * Controls the overall intensity of each sample
  11387. * @type {number}
  11388. */
  11389. weight: number;
  11390. /**
  11391. * Controls the density of each sample
  11392. * @type {number}
  11393. */
  11394. density: number;
  11395. /**
  11396. * @constructor
  11397. * @param {string} name - The post-process name
  11398. * @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)
  11399. * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to
  11400. * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering
  11401. * @param {number} samples - The post-process quality, default 100
  11402. * @param {number} samplingMode - The post-process filtering mode
  11403. * @param {BABYLON.Engine} engine - The babylon engine
  11404. * @param {boolean} reusable - If the post-process is reusable
  11405. * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided
  11406. */
  11407. constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene);
  11408. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  11409. /**
  11410. * Sets the new light position for light scattering effect
  11411. * @param {BABYLON.Vector3} The new custom light position
  11412. */
  11413. setCustomMeshPosition(position: Vector3): void;
  11414. /**
  11415. * Returns the light position for light scattering effect
  11416. * @return {BABYLON.Vector3} The custom light position
  11417. */
  11418. getCustomMeshPosition(): Vector3;
  11419. /**
  11420. * Disposes the internal assets and detaches the post-process from the camera
  11421. */
  11422. dispose(camera: Camera): void;
  11423. /**
  11424. * Returns the render target texture used by the post-process
  11425. * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process
  11426. */
  11427. getPass(): RenderTargetTexture;
  11428. /**
  11429. * Creates a default mesh for the Volumeric Light Scattering post-process
  11430. * @param {string} The mesh name
  11431. * @param {BABYLON.Scene} The scene where to create the mesh
  11432. * @return {BABYLON.Mesh} the default mesh
  11433. */
  11434. static CreateDefaultMesh(name: string, scene: Scene): Mesh;
  11435. }
  11436. }
  11437. declare module BABYLON {
  11438. class VRDistortionCorrectionPostProcess extends PostProcess {
  11439. aspectRatio: number;
  11440. constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics);
  11441. }
  11442. }
  11443. declare module BABYLON {
  11444. class Sprite {
  11445. name: string;
  11446. position: Vector3;
  11447. color: Color4;
  11448. width: number;
  11449. height: number;
  11450. angle: number;
  11451. cellIndex: number;
  11452. invertU: number;
  11453. invertV: number;
  11454. disposeWhenFinishedAnimating: boolean;
  11455. animations: Animation[];
  11456. isPickable: boolean;
  11457. actionManager: ActionManager;
  11458. size: number;
  11459. constructor(name: string, manager: SpriteManager);
  11460. playAnimation(from: number, to: number, loop: boolean, delay: number, onAnimationEnd: () => void): void;
  11461. stopAnimation(): void;
  11462. dispose(): void;
  11463. }
  11464. }
  11465. declare module BABYLON {
  11466. class SpriteManager {
  11467. name: string;
  11468. sprites: Sprite[];
  11469. renderingGroupId: number;
  11470. layerMask: number;
  11471. fogEnabled: boolean;
  11472. isPickable: boolean;
  11473. cellWidth: number;
  11474. cellHeight: number;
  11475. /**
  11476. * An event triggered when the manager is disposed.
  11477. * @type {BABYLON.Observable}
  11478. */
  11479. onDisposeObservable: Observable<SpriteManager>;
  11480. onDispose: () => void;
  11481. texture: Texture;
  11482. constructor(name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number);
  11483. intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): PickingInfo;
  11484. render(): void;
  11485. dispose(): void;
  11486. }
  11487. }
  11488. declare module BABYLON.Internals {
  11489. class _AlphaState {
  11490. /**
  11491. * Initializes the state.
  11492. */
  11493. constructor();
  11494. readonly isDirty: boolean;
  11495. alphaBlend: boolean;
  11496. setAlphaBlendConstants(r: number, g: number, b: number, a: number): void;
  11497. setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
  11498. setAlphaEquationParameters(rgb: number, alpha: any): void;
  11499. reset(): void;
  11500. apply(gl: WebGLRenderingContext): void;
  11501. }
  11502. }
  11503. declare module BABYLON.Internals {
  11504. class _DepthCullingState {
  11505. /**
  11506. * Initializes the state.
  11507. */
  11508. constructor();
  11509. readonly isDirty: boolean;
  11510. zOffset: number;
  11511. cullFace: number;
  11512. cull: boolean;
  11513. depthFunc: number;
  11514. depthMask: boolean;
  11515. depthTest: boolean;
  11516. reset(): void;
  11517. apply(gl: WebGLRenderingContext): void;
  11518. }
  11519. }
  11520. declare module BABYLON.Internals {
  11521. class _StencilState {
  11522. readonly isDirty: boolean;
  11523. stencilFunc: number;
  11524. stencilFuncRef: number;
  11525. stencilFuncMask: number;
  11526. stencilOpStencilFail: number;
  11527. stencilOpDepthFail: number;
  11528. stencilOpStencilDepthPass: number;
  11529. stencilMask: number;
  11530. stencilTest: boolean;
  11531. constructor();
  11532. reset(): void;
  11533. apply(gl: WebGLRenderingContext): void;
  11534. }
  11535. }
  11536. declare module BABYLON.Internals {
  11537. class AndOrNotEvaluator {
  11538. static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
  11539. }
  11540. }
  11541. declare module BABYLON {
  11542. interface IAssetTask {
  11543. onSuccess: (task: IAssetTask) => void;
  11544. onError: (task: IAssetTask) => void;
  11545. isCompleted: boolean;
  11546. run(scene: Scene, onSuccess: () => void, onError: () => void): any;
  11547. }
  11548. class MeshAssetTask implements IAssetTask {
  11549. name: string;
  11550. meshesNames: any;
  11551. rootUrl: string;
  11552. sceneFilename: string;
  11553. loadedMeshes: Array<AbstractMesh>;
  11554. loadedParticleSystems: Array<ParticleSystem>;
  11555. loadedSkeletons: Array<Skeleton>;
  11556. onSuccess: (task: IAssetTask) => void;
  11557. onError: (task: IAssetTask) => void;
  11558. isCompleted: boolean;
  11559. constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string);
  11560. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  11561. }
  11562. class TextFileAssetTask implements IAssetTask {
  11563. name: string;
  11564. url: string;
  11565. onSuccess: (task: IAssetTask) => void;
  11566. onError: (task: IAssetTask) => void;
  11567. isCompleted: boolean;
  11568. text: string;
  11569. constructor(name: string, url: string);
  11570. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  11571. }
  11572. class BinaryFileAssetTask implements IAssetTask {
  11573. name: string;
  11574. url: string;
  11575. onSuccess: (task: IAssetTask) => void;
  11576. onError: (task: IAssetTask) => void;
  11577. isCompleted: boolean;
  11578. data: ArrayBuffer;
  11579. constructor(name: string, url: string);
  11580. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  11581. }
  11582. class ImageAssetTask implements IAssetTask {
  11583. name: string;
  11584. url: string;
  11585. onSuccess: (task: IAssetTask) => void;
  11586. onError: (task: IAssetTask) => void;
  11587. isCompleted: boolean;
  11588. image: HTMLImageElement;
  11589. constructor(name: string, url: string);
  11590. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  11591. }
  11592. interface ITextureAssetTask extends IAssetTask {
  11593. onSuccess: (task: ITextureAssetTask) => void;
  11594. onError: (task: ITextureAssetTask) => void;
  11595. texture: Texture;
  11596. }
  11597. class TextureAssetTask implements ITextureAssetTask {
  11598. name: string;
  11599. url: string;
  11600. noMipmap: boolean;
  11601. invertY: boolean;
  11602. samplingMode: number;
  11603. onSuccess: (task: ITextureAssetTask) => void;
  11604. onError: (task: ITextureAssetTask) => void;
  11605. isCompleted: boolean;
  11606. texture: Texture;
  11607. constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number);
  11608. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  11609. }
  11610. class CubeTextureAssetTask implements IAssetTask {
  11611. name: string;
  11612. url: string;
  11613. extensions: string[];
  11614. noMipmap: boolean;
  11615. files: string[];
  11616. onSuccess: (task: IAssetTask) => void;
  11617. onError: (task: IAssetTask) => void;
  11618. isCompleted: boolean;
  11619. texture: CubeTexture;
  11620. constructor(name: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[]);
  11621. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  11622. }
  11623. class HDRCubeTextureAssetTask implements IAssetTask {
  11624. name: string;
  11625. url: string;
  11626. size: number;
  11627. noMipmap: boolean;
  11628. generateHarmonics: boolean;
  11629. useInGammaSpace: boolean;
  11630. usePMREMGenerator: boolean;
  11631. onSuccess: (task: IAssetTask) => void;
  11632. onError: (task: IAssetTask) => void;
  11633. isCompleted: boolean;
  11634. texture: HDRCubeTexture;
  11635. constructor(name: string, url: string, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean);
  11636. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  11637. }
  11638. class AssetsManager {
  11639. protected tasks: IAssetTask[];
  11640. protected waitingTasksCount: number;
  11641. onFinish: (tasks: IAssetTask[]) => void;
  11642. onTaskSuccess: (task: IAssetTask) => void;
  11643. onTaskError: (task: IAssetTask) => void;
  11644. useDefaultLoadingScreen: boolean;
  11645. constructor(scene: Scene);
  11646. addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask;
  11647. addTextFileTask(taskName: string, url: string): IAssetTask;
  11648. addBinaryFileTask(taskName: string, url: string): IAssetTask;
  11649. addImageTask(taskName: string, url: string): IAssetTask;
  11650. addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): ITextureAssetTask;
  11651. addCubeTextureTask(name: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[]): IAssetTask;
  11652. addHDRCubeTextureTask(name: string, url: string, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean): IAssetTask;
  11653. reset(): AssetsManager;
  11654. load(): AssetsManager;
  11655. }
  11656. }
  11657. declare module BABYLON {
  11658. class Database {
  11659. private callbackManifestChecked;
  11660. private currentSceneUrl;
  11661. private db;
  11662. private enableSceneOffline;
  11663. private enableTexturesOffline;
  11664. private manifestVersionFound;
  11665. private mustUpdateRessources;
  11666. private hasReachedQuota;
  11667. private isSupported;
  11668. private idbFactory;
  11669. static IsUASupportingBlobStorage: boolean;
  11670. static IDBStorageEnabled: boolean;
  11671. constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any);
  11672. static parseURL: (url: string) => string;
  11673. static ReturnFullUrlLocation: (url: string) => string;
  11674. checkManifestFile(): void;
  11675. openAsync(successCallback: any, errorCallback: any): void;
  11676. loadImageFromDB(url: string, image: HTMLImageElement): void;
  11677. private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?);
  11678. }
  11679. }
  11680. declare module BABYLON.Internals {
  11681. interface DDSInfo {
  11682. width: number;
  11683. height: number;
  11684. mipmapCount: number;
  11685. isFourCC: boolean;
  11686. isRGB: boolean;
  11687. isLuminance: boolean;
  11688. isCube: boolean;
  11689. }
  11690. class DDSTools {
  11691. static GetDDSInfo(arrayBuffer: any): DDSInfo;
  11692. private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  11693. private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  11694. private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  11695. static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void;
  11696. }
  11697. }
  11698. declare module BABYLON {
  11699. function expandToProperty(callback: string, targetKey?: string): (target: any, propertyKey: string) => void;
  11700. function serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  11701. function serializeAsTexture(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  11702. function serializeAsColor3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  11703. function serializeAsFresnelParameters(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  11704. function serializeAsVector2(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  11705. function serializeAsVector3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  11706. function serializeAsMeshReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  11707. function serializeAsColorCurves(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  11708. class SerializationHelper {
  11709. static Serialize<T>(entity: T, serializationObject?: any): any;
  11710. static Parse<T>(creationFunction: () => T, source: any, scene: Scene, rootUrl?: string): T;
  11711. static Clone<T>(creationFunction: () => T, source: T): T;
  11712. }
  11713. }
  11714. declare module BABYLON {
  11715. class DynamicFloatArrayElementInfo {
  11716. offset: number;
  11717. }
  11718. /**
  11719. * The purpose of this class is to store float32 based elements of a given size (defined by the stride argument) in a dynamic fashion, that is, you can add/free elements. You can then access to a defragmented/packed version of the underlying Float32Array by calling the pack() method.
  11720. * The intent is to maintain through time data that will be bound to a WebGlBuffer with the ability to change add/remove elements.
  11721. * It was first built to efficiently maintain the WebGlBuffer that contain instancing based data.
  11722. * Allocating an Element will return a instance of DynamicFloatArrayElement which contains the offset into the Float32Array of where the element starts, you are then responsible to copy your data using this offset.
  11723. * Beware, calling pack() may change the offset of some Entries because this method will defragment the Float32Array to replace empty elements by moving allocated ones at their location.
  11724. * This method will return an ArrayBufferView on the existing Float32Array that describes the used elements. Use this View to update the WebGLBuffer and NOT the "buffer" field of the class. The pack() method won't shrink/reallocate the buffer to keep it GC friendly, all the empty space will be put at the end of the buffer, the method just ensure there are no "free holes".
  11725. */
  11726. class DynamicFloatArray {
  11727. /**
  11728. * Construct an instance of the dynamic float array
  11729. * @param stride size of one element in float (i.e. not bytes!)
  11730. * @param initialElementCount the number of available entries at construction
  11731. */
  11732. constructor(stride: number, initialElementCount: number);
  11733. /**
  11734. * Allocate an element in the array.
  11735. * @return the element info instance that contains the offset into the main buffer of the element's location.
  11736. * Beware, this offset may change when you call pack()
  11737. */
  11738. allocElement(): DynamicFloatArrayElementInfo;
  11739. /**
  11740. * Free the element corresponding to the given element info
  11741. * @param elInfo the element that describe the allocated element
  11742. */
  11743. freeElement(elInfo: DynamicFloatArrayElementInfo): void;
  11744. /**
  11745. * This method will pack all the used elements into a linear sequence and put all the free space at the end.
  11746. * Instances of DynamicFloatArrayElement may have their 'offset' member changed as data could be copied from one location to another, so be sure to read/write your data based on the value inside this member after you called pack().
  11747. * @return the subArray that is the view of the used elements area, you can use it as a source to update a WebGLBuffer
  11748. */
  11749. pack(): Float32Array;
  11750. /**
  11751. * This is the main buffer, all elements are stored inside, you use the DynamicFloatArrayElement instance of a given element to know its location into this buffer, then you have the responsibility to perform write operations in this buffer at the right location!
  11752. * Don't use this buffer for a WebGL bufferSubData() operation, but use the one returned by the pack() method.
  11753. */
  11754. buffer: Float32Array;
  11755. /**
  11756. * Get the total count of entries that can fit in the current buffer
  11757. * @returns the elements count
  11758. */
  11759. readonly totalElementCount: number;
  11760. /**
  11761. * Get the count of free entries that can still be allocated without resizing the buffer
  11762. * @returns the free elements count
  11763. */
  11764. readonly freeElementCount: number;
  11765. /**
  11766. * Get the count of allocated elements
  11767. * @returns the allocated elements count
  11768. */
  11769. readonly usedElementCount: number;
  11770. /**
  11771. * Return the size of one element in float
  11772. * @returns the size in float
  11773. */
  11774. readonly stride: number;
  11775. compareValueOffset: number;
  11776. sortingAscending: boolean;
  11777. sort(): boolean;
  11778. }
  11779. }
  11780. declare module Earcut {
  11781. /**
  11782. * The fastest and smallest JavaScript polygon triangulation library for your WebGL apps
  11783. * @param data is a flat array of vertice coordinates like [x0, y0, x1, y1, x2, y2, ...].
  11784. * @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).
  11785. * @param dim is the number of coordinates per vertice in the input array (2 by default).
  11786. */
  11787. function earcut(data: number[], holeIndices: number[], dim: number): any[];
  11788. /**
  11789. * return a percentage difference between the polygon area and its triangulation area;
  11790. * used to verify correctness of triangulation
  11791. */
  11792. function deviation(data: number[], holeIndices: number[], dim: number, triangles: number[]): number;
  11793. /**
  11794. * turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
  11795. */
  11796. function flatten(data: number[][][]): {
  11797. vertices: any[];
  11798. holes: any[];
  11799. dimensions: number;
  11800. };
  11801. }
  11802. declare module BABYLON {
  11803. enum PoseEnabledControllerType {
  11804. VIVE = 0,
  11805. OCULUS = 1,
  11806. GENERIC = 2,
  11807. }
  11808. interface MutableGamepadButton {
  11809. value: number;
  11810. touched: boolean;
  11811. pressed: boolean;
  11812. }
  11813. class PoseEnabledControllerHelper {
  11814. static InitiateController(vrGamepad: any): OculusTouchController | ViveController;
  11815. }
  11816. class PoseEnabledController extends Gamepad implements PoseControlled {
  11817. vrGamepad: any;
  11818. devicePosition: Vector3;
  11819. deviceRotationQuaternion: Quaternion;
  11820. deviceScaleFactor: number;
  11821. position: Vector3;
  11822. rotationQuaternion: Quaternion;
  11823. controllerType: PoseEnabledControllerType;
  11824. rawPose: DevicePose;
  11825. constructor(vrGamepad: any);
  11826. update(): void;
  11827. updateFromDevice(poseData: DevicePose): void;
  11828. attachToMesh(mesh: AbstractMesh): void;
  11829. attachToPoseControlledCamera(camera: TargetCamera): void;
  11830. detachMesh(): void;
  11831. readonly mesh: AbstractMesh;
  11832. getForwardRay(length?: number): Ray;
  11833. }
  11834. interface GamepadButtonChanges {
  11835. changed: boolean;
  11836. pressChanged: boolean;
  11837. touchChanged: boolean;
  11838. valueChanged: boolean;
  11839. }
  11840. abstract class WebVRController extends PoseEnabledController {
  11841. onTriggerStateChangedObservable: Observable<ExtendedGamepadButton>;
  11842. onMainButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  11843. onSecondaryButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  11844. onPadStateChangedObservable: Observable<ExtendedGamepadButton>;
  11845. onPadValuesChangedObservable: Observable<StickValues>;
  11846. onButtonStateChange(callback: (controlledIndex: number, buttonIndex: number, state: ExtendedGamepadButton) => void): void;
  11847. pad: StickValues;
  11848. hand: string;
  11849. constructor(vrGamepad: any);
  11850. update(): void;
  11851. protected abstract handleButtonChange(buttonIdx: number, value: ExtendedGamepadButton, changes: GamepadButtonChanges): any;
  11852. abstract initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void): any;
  11853. }
  11854. class OculusTouchController extends WebVRController {
  11855. onSecondaryTriggerStateChangedObservable: Observable<ExtendedGamepadButton>;
  11856. onThumbRestChangedObservable: Observable<ExtendedGamepadButton>;
  11857. constructor(vrGamepad: any);
  11858. initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void): void;
  11859. readonly onAButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  11860. readonly onBButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  11861. readonly onXButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  11862. readonly onYButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  11863. protected handleButtonChange(buttonIdx: number, state: ExtendedGamepadButton, changes: GamepadButtonChanges): void;
  11864. }
  11865. class ViveController extends WebVRController {
  11866. constructor(vrGamepad: any);
  11867. initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void): void;
  11868. readonly onLeftButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  11869. readonly onRightButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  11870. readonly onMenuButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  11871. /**
  11872. * Vive mapping:
  11873. * 0: touchpad
  11874. * 1: trigger
  11875. * 2: left AND right buttons
  11876. * 3: menu button
  11877. */
  11878. protected handleButtonChange(buttonIdx: number, state: ExtendedGamepadButton, changes: GamepadButtonChanges): void;
  11879. }
  11880. }
  11881. interface ExtendedGamepadButton extends GamepadButton {
  11882. readonly pressed: boolean;
  11883. readonly touched: boolean;
  11884. readonly value: number;
  11885. }
  11886. declare module BABYLON {
  11887. class FilesInput {
  11888. static FilesToLoad: File[];
  11889. constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback: any, p_progressCallback: any, p_additionnalRenderLoopLogicCallback: any, p_textureLoadingCallback: any, p_startingProcessingFilesCallback: any);
  11890. monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void;
  11891. private renderFunction();
  11892. private drag(e);
  11893. private drop(eventDrop);
  11894. loadFiles(event: any): void;
  11895. reload(): void;
  11896. }
  11897. }
  11898. declare module BABYLON {
  11899. class Gamepads<T extends Gamepad> {
  11900. private babylonGamepads;
  11901. private oneGamepadConnected;
  11902. private isMonitoring;
  11903. private gamepadEventSupported;
  11904. private gamepadSupport;
  11905. constructor(ongamedpadconnected: (gamepad: T) => void, ongamedpaddisconnected?: (gamepad: T) => void);
  11906. dispose(): void;
  11907. }
  11908. class StickValues {
  11909. x: any;
  11910. y: any;
  11911. constructor(x: any, y: any);
  11912. }
  11913. class Gamepad {
  11914. id: string;
  11915. index: number;
  11916. browserGamepad: any;
  11917. type: number;
  11918. static GAMEPAD: number;
  11919. static GENERIC: number;
  11920. static XBOX: number;
  11921. static POSE_ENABLED: number;
  11922. constructor(id: string, index: number, browserGamepad: any, leftStickX?: number, leftStickY?: number, rightStickX?: number, rightStickY?: number);
  11923. onleftstickchanged(callback: (values: StickValues) => void): void;
  11924. onrightstickchanged(callback: (values: StickValues) => void): void;
  11925. leftStick: StickValues;
  11926. rightStick: StickValues;
  11927. update(): void;
  11928. }
  11929. class GenericPad extends Gamepad {
  11930. onbuttondown(callback: (buttonPressed: number) => void): void;
  11931. onbuttonup(callback: (buttonReleased: number) => void): void;
  11932. constructor(id: string, index: number, browserGamepad: any);
  11933. update(): void;
  11934. }
  11935. enum Xbox360Button {
  11936. A = 0,
  11937. B = 1,
  11938. X = 2,
  11939. Y = 3,
  11940. Start = 4,
  11941. Back = 5,
  11942. LB = 6,
  11943. RB = 7,
  11944. LeftStick = 8,
  11945. RightStick = 9,
  11946. }
  11947. enum Xbox360Dpad {
  11948. Up = 0,
  11949. Down = 1,
  11950. Left = 2,
  11951. Right = 3,
  11952. }
  11953. class Xbox360Pad extends Gamepad {
  11954. constructor(id: string, index: number, gamepad: any, xboxOne?: boolean);
  11955. onlefttriggerchanged(callback: (value: number) => void): void;
  11956. onrighttriggerchanged(callback: (value: number) => void): void;
  11957. leftTrigger: number;
  11958. rightTrigger: number;
  11959. onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
  11960. onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
  11961. ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
  11962. ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
  11963. buttonA: number;
  11964. buttonB: number;
  11965. buttonX: number;
  11966. buttonY: number;
  11967. buttonStart: number;
  11968. buttonBack: number;
  11969. buttonLB: number;
  11970. buttonRB: number;
  11971. buttonLeftStick: number;
  11972. buttonRightStick: number;
  11973. dPadUp: number;
  11974. dPadDown: number;
  11975. dPadLeft: number;
  11976. dPadRight: number;
  11977. update(): void;
  11978. }
  11979. }
  11980. interface Navigator {
  11981. getGamepads(func?: any): any;
  11982. webkitGetGamepads(func?: any): any;
  11983. msGetGamepads(func?: any): any;
  11984. webkitGamepads(func?: any): any;
  11985. }
  11986. declare module BABYLON.Internals {
  11987. /**
  11988. * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
  11989. * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
  11990. */
  11991. class KhronosTextureContainer {
  11992. arrayBuffer: any;
  11993. static HEADER_LEN: number;
  11994. static COMPRESSED_2D: number;
  11995. static COMPRESSED_3D: number;
  11996. static TEX_2D: number;
  11997. static TEX_3D: number;
  11998. glType: number;
  11999. glTypeSize: number;
  12000. glFormat: number;
  12001. glInternalFormat: number;
  12002. glBaseInternalFormat: number;
  12003. pixelWidth: number;
  12004. pixelHeight: number;
  12005. pixelDepth: number;
  12006. numberOfArrayElements: number;
  12007. numberOfFaces: number;
  12008. numberOfMipmapLevels: number;
  12009. bytesOfKeyValueData: number;
  12010. loadType: number;
  12011. /**
  12012. * @param {ArrayBuffer} arrayBuffer- contents of the KTX container file
  12013. * @param {number} facesExpected- should be either 1 or 6, based whether a cube texture or or
  12014. * @param {boolean} threeDExpected- provision for indicating that data should be a 3D texture, not implemented
  12015. * @param {boolean} textureArrayExpected- provision for indicating that data should be a texture array, not implemented
  12016. */
  12017. constructor(arrayBuffer: any, facesExpected: number, threeDExpected?: boolean, textureArrayExpected?: boolean);
  12018. switchEndainness(val: number): number;
  12019. /**
  12020. * It is assumed that the texture has already been created & is currently bound
  12021. */
  12022. uploadLevels(gl: WebGLRenderingContext, loadMipmaps: boolean): void;
  12023. }
  12024. }
  12025. declare module BABYLON {
  12026. interface ILoadingScreen {
  12027. displayLoadingUI: () => void;
  12028. hideLoadingUI: () => void;
  12029. loadingUIBackgroundColor: string;
  12030. loadingUIText: string;
  12031. }
  12032. class DefaultLoadingScreen implements ILoadingScreen {
  12033. constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
  12034. displayLoadingUI(): void;
  12035. hideLoadingUI(): void;
  12036. loadingUIText: string;
  12037. loadingUIBackgroundColor: string;
  12038. }
  12039. }
  12040. declare module BABYLON {
  12041. /**
  12042. * A class serves as a medium between the observable and its observers
  12043. */
  12044. class EventState {
  12045. /**
  12046. * If the callback of a given Observer set skipNextObservers to true the following observers will be ignored
  12047. */
  12048. constructor(mask: number, skipNextObservers?: boolean);
  12049. initalize(mask: number, skipNextObservers?: boolean): EventState;
  12050. /**
  12051. * An Observer can set this property to true to prevent subsequent observers of being notified
  12052. */
  12053. skipNextObservers: boolean;
  12054. /**
  12055. * Get the mask value that were used to trigger the event corresponding to this EventState object
  12056. */
  12057. mask: number;
  12058. }
  12059. /**
  12060. * Represent an Observer registered to a given Observable object.
  12061. */
  12062. class Observer<T> {
  12063. callback: (eventData: T, eventState: EventState) => void;
  12064. mask: number;
  12065. constructor(callback: (eventData: T, eventState: EventState) => void, mask: number);
  12066. }
  12067. /**
  12068. * The Observable class is a simple implementation of the Observable pattern.
  12069. * 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.
  12070. * This enable a more fine grained execution without having to rely on multiple different Observable objects.
  12071. * 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).
  12072. * 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.
  12073. */
  12074. class Observable<T> {
  12075. constructor();
  12076. /**
  12077. * Create a new Observer with the specified callback
  12078. * @param callback the callback that will be executed for that Observer
  12079. * @param mask the mask used to filter observers
  12080. * @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.
  12081. */
  12082. add(callback: (eventData: T, eventState: EventState) => void, mask?: number, insertFirst?: boolean): Observer<T>;
  12083. /**
  12084. * Remove an Observer from the Observable object
  12085. * @param observer the instance of the Observer to remove. If it doesn't belong to this Observable, false will be returned.
  12086. */
  12087. remove(observer: Observer<T>): boolean;
  12088. /**
  12089. * Remove a callback from the Observable object
  12090. * @param callback the callback to remove. If it doesn't belong to this Observable, false will be returned.
  12091. */
  12092. removeCallback(callback: (eventData: T, eventState: EventState) => void): boolean;
  12093. /**
  12094. * Notify all Observers by calling their respective callback with the given data
  12095. * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute
  12096. * @param eventData
  12097. * @param mask
  12098. */
  12099. notifyObservers(eventData: T, mask?: number): boolean;
  12100. /**
  12101. * return true is the Observable has at least one Observer registered
  12102. */
  12103. hasObservers(): boolean;
  12104. /**
  12105. * Clear the list of observers
  12106. */
  12107. clear(): void;
  12108. /**
  12109. * Clone the current observable
  12110. */
  12111. clone(): Observable<T>;
  12112. /**
  12113. * Does this observable handles observer registered with a given mask
  12114. * @param {number} trigger - the mask to be tested
  12115. * @return {boolean} whether or not one observer registered with the given mask is handeled
  12116. **/
  12117. hasSpecificMask(mask?: number): boolean;
  12118. }
  12119. }
  12120. declare module BABYLON {
  12121. /**
  12122. * This class describe a rectangle that were added to the map.
  12123. * You have access to its coordinates either in pixel or normalized (UV)
  12124. */
  12125. class PackedRect {
  12126. constructor(root: RectPackingMap, parent: PackedRect, pos: Vector2, size: Size);
  12127. /**
  12128. * @returns the position of this node into the map
  12129. */
  12130. readonly pos: Vector2;
  12131. /**
  12132. * @returns the size of the rectangle this node handles
  12133. */
  12134. readonly contentSize: Size;
  12135. /**
  12136. * Retrieve the inner position (considering the margin) and stores it into the res object
  12137. * @param res must be a valid Vector2 that will contain the inner position after this call
  12138. */
  12139. getInnerPosToRef(res: Vector2): void;
  12140. /**
  12141. * Retrieve the inner size (considering the margin) and stores it into the res object
  12142. * @param res must be a valid Size that will contain the inner size after this call
  12143. */
  12144. getInnerSizeToRef(res: Size): void;
  12145. /**
  12146. * Compute the UV of the top/left, top/right, bottom/right, bottom/left points of the rectangle this node handles into the map
  12147. * @returns And array of 4 Vector2, containing UV coordinates for the four corners of the Rectangle into the map
  12148. */
  12149. readonly UVs: Vector2[];
  12150. /**
  12151. * You may have allocated the PackedRect using over-provisioning (you allocated more than you need in order to prevent frequent deallocations/reallocations)
  12152. * and then using only a part of the PackRect.
  12153. * This method will return the UVs for this part by given the custom size of what you really use
  12154. * @param customSize must be less/equal to the allocated size, UV will be compute from this
  12155. */
  12156. getUVsForCustomSize(customSize: Size): Vector2[];
  12157. /**
  12158. * Free this rectangle from the map.
  12159. * Call this method when you no longer need the rectangle to be in the map.
  12160. */
  12161. freeContent(): void;
  12162. protected readonly isUsed: boolean;
  12163. protected findAndSplitNode(contentSize: Size): PackedRect;
  12164. private findNode(size);
  12165. private static TpsSize;
  12166. private splitNode(contentSize);
  12167. private attemptDefrag();
  12168. private clearNode();
  12169. private readonly isRecursiveFree;
  12170. protected evalFreeSize(size: number): number;
  12171. }
  12172. /**
  12173. * The purpose of this class is to pack several Rectangles into a big map, while trying to fit everything as optimally as possible.
  12174. * This class is typically used to build lightmaps, sprite map or to pack several little textures into a big one.
  12175. * Note that this class allows allocated Rectangles to be freed: that is the map is dynamically maintained so you can add/remove rectangle based on their life-cycle.
  12176. * In case you need a margin around the allocated rect, specify the amount in the margin argument during construction.
  12177. * In such case you will have to rely on innerPositionToRef and innerSizeToRef calls to get the proper size
  12178. */
  12179. class RectPackingMap extends PackedRect {
  12180. /**
  12181. * Create an instance of the object with a dimension using the given size
  12182. * @param size The dimension of the rectangle that will contain all the sub ones.
  12183. * @param margin The margin (empty space) created (in pixels) around the allocated Rectangles
  12184. */
  12185. constructor(size: Size, margin?: number);
  12186. /**
  12187. * Add a rectangle, finding the best location to store it into the map
  12188. * @param size the dimension of the rectangle to store
  12189. * @return the Node containing the rectangle information, or null if we couldn't find a free spot
  12190. */
  12191. addRect(size: Size): PackedRect;
  12192. /**
  12193. * Return the current space free normalized between [0;1]
  12194. * @returns {}
  12195. */
  12196. readonly freeSpace: number;
  12197. }
  12198. }
  12199. declare module BABYLON {
  12200. class SceneOptimization {
  12201. priority: number;
  12202. apply: (scene: Scene) => boolean;
  12203. constructor(priority?: number);
  12204. }
  12205. class TextureOptimization extends SceneOptimization {
  12206. priority: number;
  12207. maximumSize: number;
  12208. constructor(priority?: number, maximumSize?: number);
  12209. apply: (scene: Scene) => boolean;
  12210. }
  12211. class HardwareScalingOptimization extends SceneOptimization {
  12212. priority: number;
  12213. maximumScale: number;
  12214. constructor(priority?: number, maximumScale?: number);
  12215. apply: (scene: Scene) => boolean;
  12216. }
  12217. class ShadowsOptimization extends SceneOptimization {
  12218. apply: (scene: Scene) => boolean;
  12219. }
  12220. class PostProcessesOptimization extends SceneOptimization {
  12221. apply: (scene: Scene) => boolean;
  12222. }
  12223. class LensFlaresOptimization extends SceneOptimization {
  12224. apply: (scene: Scene) => boolean;
  12225. }
  12226. class ParticlesOptimization extends SceneOptimization {
  12227. apply: (scene: Scene) => boolean;
  12228. }
  12229. class RenderTargetsOptimization extends SceneOptimization {
  12230. apply: (scene: Scene) => boolean;
  12231. }
  12232. class MergeMeshesOptimization extends SceneOptimization {
  12233. static UpdateSelectionTree: boolean;
  12234. apply: (scene: Scene, updateSelectionTree?: boolean) => boolean;
  12235. }
  12236. class SceneOptimizerOptions {
  12237. targetFrameRate: number;
  12238. trackerDuration: number;
  12239. optimizations: SceneOptimization[];
  12240. constructor(targetFrameRate?: number, trackerDuration?: number);
  12241. static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  12242. static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  12243. static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  12244. }
  12245. class SceneOptimizer {
  12246. static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void;
  12247. }
  12248. }
  12249. declare module BABYLON {
  12250. class SceneSerializer {
  12251. static ClearCache(): void;
  12252. static Serialize(scene: Scene): any;
  12253. static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any;
  12254. }
  12255. }
  12256. declare module BABYLON {
  12257. class SmartArray<T> {
  12258. data: Array<T>;
  12259. length: number;
  12260. constructor(capacity: number);
  12261. push(value: any): void;
  12262. forEach(func: (content: T) => void): void;
  12263. pushNoDuplicate(value: any): boolean;
  12264. sort(compareFn: any): void;
  12265. reset(): void;
  12266. dispose(): void;
  12267. concat(array: any): void;
  12268. concatWithNoDuplicate(array: any): void;
  12269. indexOf(value: T): number;
  12270. contains(value: T): boolean;
  12271. }
  12272. }
  12273. declare module BABYLON {
  12274. /**
  12275. * This class implement a typical dictionary using a string as key and the generic type T as value.
  12276. * The underlying implementation relies on an associative array to ensure the best performances.
  12277. * The value can be anything including 'null' but except 'undefined'
  12278. */
  12279. class StringDictionary<T> {
  12280. /**
  12281. * This will clear this dictionary and copy the content from the 'source' one.
  12282. * If the T value is a custom object, it won't be copied/cloned, the same object will be used
  12283. * @param source the dictionary to take the content from and copy to this dictionary
  12284. */
  12285. copyFrom(source: StringDictionary<T>): void;
  12286. /**
  12287. * Get a value based from its key
  12288. * @param key the given key to get the matching value from
  12289. * @return the value if found, otherwise undefined is returned
  12290. */
  12291. get(key: string): T;
  12292. /**
  12293. * Get a value from its key or add it if it doesn't exist.
  12294. * This method will ensure you that a given key/data will be present in the dictionary.
  12295. * @param key the given key to get the matching value from
  12296. * @param factory the factory that will create the value if the key is not present in the dictionary.
  12297. * The factory will only be invoked if there's no data for the given key.
  12298. * @return the value corresponding to the key.
  12299. */
  12300. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  12301. /**
  12302. * Get a value from its key if present in the dictionary otherwise add it
  12303. * @param key the key to get the value from
  12304. * @param val if there's no such key/value pair in the dictionary add it with this value
  12305. * @return the value corresponding to the key
  12306. */
  12307. getOrAdd(key: string, val: T): T;
  12308. /**
  12309. * Check if there's a given key in the dictionary
  12310. * @param key the key to check for
  12311. * @return true if the key is present, false otherwise
  12312. */
  12313. contains(key: any): boolean;
  12314. /**
  12315. * Add a new key and its corresponding value
  12316. * @param key the key to add
  12317. * @param value the value corresponding to the key
  12318. * @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
  12319. */
  12320. add(key: string, value: T): boolean;
  12321. set(key: string, value: T): boolean;
  12322. /**
  12323. * Get the element of the given key and remove it from the dictionary
  12324. * @param key
  12325. */
  12326. getAndRemove(key: string): T;
  12327. /**
  12328. * Remove a key/value from the dictionary.
  12329. * @param key the key to remove
  12330. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  12331. */
  12332. remove(key: string): boolean;
  12333. /**
  12334. * Clear the whole content of the dictionary
  12335. */
  12336. clear(): void;
  12337. readonly count: number;
  12338. /**
  12339. * Execute a callback on each key/val of the dictionary.
  12340. * Note that you can remove any element in this dictionary in the callback implementation
  12341. * @param callback the callback to execute on a given key/value pair
  12342. */
  12343. forEach(callback: (key: string, val: T) => void): void;
  12344. /**
  12345. * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.
  12346. * If the callback returns null or undefined the method will iterate to the next key/value pair
  12347. * Note that you can remove any element in this dictionary in the callback implementation
  12348. * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned
  12349. */
  12350. first<TRes>(callback: (key: string, val: T) => TRes): TRes;
  12351. }
  12352. }
  12353. declare module BABYLON {
  12354. class Tags {
  12355. static EnableFor(obj: any): void;
  12356. static DisableFor(obj: any): void;
  12357. static HasTags(obj: any): boolean;
  12358. static GetTags(obj: any, asString?: boolean): any;
  12359. static AddTagsTo(obj: any, tagsString: string): void;
  12360. static RemoveTagsFrom(obj: any, tagsString: string): void;
  12361. static MatchesQuery(obj: any, tagsQuery: string): boolean;
  12362. }
  12363. }
  12364. declare module BABYLON {
  12365. class TextureTools {
  12366. /**
  12367. * Uses the GPU to create a copy texture rescaled at a given size
  12368. * @param texture Texture to copy from
  12369. * @param width Desired width
  12370. * @param height Desired height
  12371. * @return Generated texture
  12372. */
  12373. static CreateResizedCopy(texture: BABYLON.Texture, width: number, height: number, useBilinearMode?: boolean): BABYLON.Texture;
  12374. }
  12375. }
  12376. declare module BABYLON.Internals {
  12377. class TGATools {
  12378. static GetTGAHeader(data: Uint8Array): any;
  12379. static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void;
  12380. }
  12381. }
  12382. declare module BABYLON {
  12383. interface IAnimatable {
  12384. animations: Array<Animation>;
  12385. }
  12386. class Tools {
  12387. static BaseUrl: string;
  12388. static CorsBehavior: any;
  12389. static UseFallbackTexture: boolean;
  12390. private static fallbackTexture;
  12391. /**
  12392. * Interpolates between a and b via alpha
  12393. * @param a The lower value (returned when alpha = 0)
  12394. * @param b The upper value (returned when alpha = 1)
  12395. * @param alpha The interpolation-factor
  12396. * @return The mixed value
  12397. */
  12398. static Mix(a: number, b: number, alpha: number): number;
  12399. static Instantiate(className: string): any;
  12400. static SetImmediate(action: () => void): void;
  12401. static IsExponentOfTwo(value: number): boolean;
  12402. /**
  12403. * Find the next highest power of two.
  12404. * @param x Number to start search from.
  12405. * @return Next highest power of two.
  12406. */
  12407. static CeilingPOT(x: number): number;
  12408. /**
  12409. * Find the next lowest power of two.
  12410. * @param x Number to start search from.
  12411. * @return Next lowest power of two.
  12412. */
  12413. static FloorPOT(x: number): number;
  12414. /**
  12415. * Find the nearest power of two.
  12416. * @param x Number to start search from.
  12417. * @return Next nearest power of two.
  12418. */
  12419. static NearestPOT(x: number): number;
  12420. static GetExponentOfTwo(value: number, max: number, mode?: number): number;
  12421. static GetFilename(path: string): string;
  12422. static GetDOMTextContent(element: HTMLElement): string;
  12423. static ToDegrees(angle: number): number;
  12424. static ToRadians(angle: number): number;
  12425. static EncodeArrayBufferTobase64(buffer: ArrayBuffer): string;
  12426. static ExtractMinAndMaxIndexed(positions: number[] | Float32Array, indices: IndicesArray, indexStart: number, indexCount: number, bias?: Vector2): {
  12427. minimum: Vector3;
  12428. maximum: Vector3;
  12429. };
  12430. static ExtractMinAndMax(positions: number[] | Float32Array, start: number, count: number, bias?: Vector2, stride?: number): {
  12431. minimum: Vector3;
  12432. maximum: Vector3;
  12433. };
  12434. static Vector2ArrayFeeder(array: Array<Vector2> | Float32Array): (i: number) => Vector2;
  12435. static ExtractMinAndMaxVector2(feeder: (index: number) => Vector2, bias?: Vector2): {
  12436. minimum: Vector2;
  12437. maximum: Vector2;
  12438. };
  12439. static MakeArray(obj: any, allowsNullUndefined?: boolean): Array<any>;
  12440. static GetPointerPrefix(): string;
  12441. /**
  12442. * @param func - the function to be called
  12443. * @param requester - the object that will request the next frame. Falls back to window.
  12444. */
  12445. static QueueNewFrame(func: any, requester?: any): void;
  12446. static RequestFullscreen(element: any): void;
  12447. static ExitFullscreen(): void;
  12448. static SetCorsBehavior(url: string, img: HTMLImageElement): void;
  12449. static CleanUrl(url: string): string;
  12450. static LoadImage(url: any, onload: any, onerror: any, database: any): HTMLImageElement;
  12451. static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: (data: any) => void, database?: any, useArrayBuffer?: boolean, onError?: (request: XMLHttpRequest) => void): void;
  12452. /**
  12453. * Load a script (identified by an url). When the url returns, the
  12454. * content of this file is added into a new script element, attached to the DOM (body element)
  12455. */
  12456. static LoadScript(scriptUrl: string, onSuccess: () => void, onError?: () => void): void;
  12457. static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void;
  12458. static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void;
  12459. static FileAsURL(content: string): string;
  12460. static Format(value: number, decimals?: number): string;
  12461. static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
  12462. static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
  12463. static IsEmpty(obj: any): boolean;
  12464. static RegisterTopRootEvents(events: {
  12465. name: string;
  12466. handler: EventListener;
  12467. }[]): void;
  12468. static UnregisterTopRootEvents(events: {
  12469. name: string;
  12470. handler: EventListener;
  12471. }[]): void;
  12472. static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void, mimeType?: string): void;
  12473. static EncodeScreenshotCanvasData(successCallback?: (data: string) => void, mimeType?: string): void;
  12474. static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
  12475. static CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string, samples?: number): void;
  12476. static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
  12477. /**
  12478. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  12479. * Be aware Math.random() could cause collisions, but:
  12480. * "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"
  12481. */
  12482. static RandomId(): string;
  12483. static errorsCount: number;
  12484. static OnNewCacheEntry: (entry: string) => void;
  12485. static readonly NoneLogLevel: number;
  12486. static readonly MessageLogLevel: number;
  12487. static readonly WarningLogLevel: number;
  12488. static readonly ErrorLogLevel: number;
  12489. static readonly AllLogLevel: number;
  12490. static Log: (message: string) => void;
  12491. static Warn: (message: string) => void;
  12492. static Error: (message: string) => void;
  12493. static readonly LogCache: string;
  12494. static ClearLogCache(): void;
  12495. static LogLevels: number;
  12496. static readonly PerformanceNoneLogLevel: number;
  12497. static readonly PerformanceUserMarkLogLevel: number;
  12498. static readonly PerformanceConsoleLogLevel: number;
  12499. static PerformanceLogLevel: number;
  12500. static StartPerformanceCounter: (counterName: string, condition?: boolean) => void;
  12501. static EndPerformanceCounter: (counterName: string, condition?: boolean) => void;
  12502. static readonly Now: number;
  12503. /**
  12504. * This method will return the name of the class used to create the instance of the given object.
  12505. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.
  12506. * @param object the object to get the class name from
  12507. * @return the name of the class, will be "object" for a custom data type not using the @className decorator
  12508. */
  12509. static getClassName(object: any, isType?: boolean): string;
  12510. static first<T>(array: Array<T>, predicate: (item: T) => boolean): T;
  12511. /**
  12512. * This method will return the name of the full name of the class, including its owning module (if any).
  12513. * 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).
  12514. * @param object the object to get the class name from
  12515. * @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.
  12516. */
  12517. static getFullClassName(object: any, isType?: boolean): string;
  12518. /**
  12519. * 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.
  12520. * @param array
  12521. */
  12522. static arrayOrStringFeeder(array: any): (i: number) => number;
  12523. /**
  12524. * Compute the hashCode of a stream of number
  12525. * To compute the HashCode on a string or an Array of data types implementing the getHashCode() method, use the arrayOrStringFeeder method.
  12526. * @param feeder a callback that will be called until it returns null, each valid returned values will be used to compute the hash code.
  12527. * @return the hash code computed
  12528. */
  12529. static hashCodeFromStream(feeder: (index: number) => number): number;
  12530. }
  12531. /**
  12532. * This class is used to track a performance counter which is number based.
  12533. * The user has access to many properties which give statistics of different nature
  12534. *
  12535. * The implementer can track two kinds of Performance Counter: time and count
  12536. * 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.
  12537. * 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.
  12538. */
  12539. class PerfCounter {
  12540. static Enabled: boolean;
  12541. /**
  12542. * Returns the smallest value ever
  12543. */
  12544. readonly min: number;
  12545. /**
  12546. * Returns the biggest value ever
  12547. */
  12548. readonly max: number;
  12549. /**
  12550. * Returns the average value since the performance counter is running
  12551. */
  12552. readonly average: number;
  12553. /**
  12554. * Returns the average value of the last second the counter was monitored
  12555. */
  12556. readonly lastSecAverage: number;
  12557. /**
  12558. * Returns the current value
  12559. */
  12560. readonly current: number;
  12561. readonly total: number;
  12562. constructor();
  12563. /**
  12564. * Call this method to start monitoring a new frame.
  12565. * 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.
  12566. */
  12567. fetchNewFrame(): void;
  12568. /**
  12569. * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
  12570. * @param newCount the count value to add to the monitored count
  12571. * @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.
  12572. */
  12573. addCount(newCount: number, fetchResult: boolean): void;
  12574. /**
  12575. * Start monitoring this performance counter
  12576. */
  12577. beginMonitoring(): void;
  12578. /**
  12579. * Compute the time lapsed since the previous beginMonitoring() call.
  12580. * @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
  12581. */
  12582. endMonitoring(newFrame?: boolean): void;
  12583. }
  12584. /**
  12585. * Use this className as a decorator on a given class definition to add it a name and optionally its module.
  12586. * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.
  12587. * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified
  12588. * @param name The name of the class, case should be preserved
  12589. * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.
  12590. */
  12591. function className(name: string, module?: string): (target: Object) => void;
  12592. /**
  12593. * An implementation of a loop for asynchronous functions.
  12594. */
  12595. class AsyncLoop {
  12596. iterations: number;
  12597. index: number;
  12598. /**
  12599. * Constroctor.
  12600. * @param iterations the number of iterations.
  12601. * @param _fn the function to run each iteration
  12602. * @param _successCallback the callback that will be called upon succesful execution
  12603. * @param offset starting offset.
  12604. */
  12605. constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number);
  12606. /**
  12607. * Execute the next iteration. Must be called after the last iteration was finished.
  12608. */
  12609. executeNext(): void;
  12610. /**
  12611. * Break the loop and run the success callback.
  12612. */
  12613. breakLoop(): void;
  12614. /**
  12615. * Helper function
  12616. */
  12617. static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop;
  12618. /**
  12619. * A for-loop that will run a given number of iterations synchronous and the rest async.
  12620. * @param iterations total number of iterations
  12621. * @param syncedIterations number of synchronous iterations in each async iteration.
  12622. * @param fn the function to call each iteration.
  12623. * @param callback a success call back that will be called when iterating stops.
  12624. * @param breakFunction a break condition (optional)
  12625. * @param timeout timeout settings for the setTimeout function. default - 0.
  12626. * @constructor
  12627. */
  12628. static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void;
  12629. }
  12630. }
  12631. declare module BABYLON {
  12632. enum JoystickAxis {
  12633. X = 0,
  12634. Y = 1,
  12635. Z = 2,
  12636. }
  12637. class VirtualJoystick {
  12638. reverseLeftRight: boolean;
  12639. reverseUpDown: boolean;
  12640. deltaPosition: Vector3;
  12641. pressed: boolean;
  12642. private static vjCanvas;
  12643. private static vjCanvasContext;
  12644. private static vjCanvasWidth;
  12645. private static vjCanvasHeight;
  12646. private static halfWidth;
  12647. private static halfHeight;
  12648. constructor(leftJoystick?: boolean);
  12649. setJoystickSensibility(newJoystickSensibility: number): void;
  12650. /**
  12651. * Change the color of the virtual joystick
  12652. * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
  12653. */
  12654. setJoystickColor(newColor: string): void;
  12655. setActionOnTouch(action: () => any): void;
  12656. setAxisForLeftRight(axis: JoystickAxis): void;
  12657. setAxisForUpDown(axis: JoystickAxis): void;
  12658. releaseCanvas(): void;
  12659. }
  12660. }
  12661. declare module BABYLON {
  12662. class ArcRotateCameraGamepadInput implements ICameraInput<ArcRotateCamera> {
  12663. camera: ArcRotateCamera;
  12664. gamepad: Gamepad;
  12665. gamepadRotationSensibility: number;
  12666. gamepadMoveSensibility: number;
  12667. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12668. detachControl(element: HTMLElement): void;
  12669. checkInputs(): void;
  12670. getTypeName(): string;
  12671. getSimpleName(): string;
  12672. }
  12673. }
  12674. declare module BABYLON {
  12675. class ArcRotateCameraKeyboardMoveInput implements ICameraInput<ArcRotateCamera> {
  12676. camera: ArcRotateCamera;
  12677. keysUp: number[];
  12678. keysDown: number[];
  12679. keysLeft: number[];
  12680. keysRight: number[];
  12681. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12682. detachControl(element: HTMLElement): void;
  12683. checkInputs(): void;
  12684. getTypeName(): string;
  12685. getSimpleName(): string;
  12686. }
  12687. }
  12688. declare module BABYLON {
  12689. class ArcRotateCameraMouseWheelInput implements ICameraInput<ArcRotateCamera> {
  12690. camera: ArcRotateCamera;
  12691. wheelPrecision: number;
  12692. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12693. detachControl(element: HTMLElement): void;
  12694. getTypeName(): string;
  12695. getSimpleName(): string;
  12696. }
  12697. }
  12698. declare module BABYLON {
  12699. class ArcRotateCameraPointersInput implements ICameraInput<ArcRotateCamera> {
  12700. camera: ArcRotateCamera;
  12701. buttons: number[];
  12702. angularSensibilityX: number;
  12703. angularSensibilityY: number;
  12704. pinchPrecision: number;
  12705. panningSensibility: number;
  12706. pinchInwards: boolean;
  12707. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12708. detachControl(element: HTMLElement): void;
  12709. getTypeName(): string;
  12710. getSimpleName(): string;
  12711. }
  12712. }
  12713. declare module BABYLON {
  12714. class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<ArcRotateCamera> {
  12715. camera: ArcRotateCamera;
  12716. alphaCorrection: number;
  12717. betaCorrection: number;
  12718. gammaCorrection: number;
  12719. constructor();
  12720. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12721. checkInputs(): void;
  12722. detachControl(element: HTMLElement): void;
  12723. getTypeName(): string;
  12724. getSimpleName(): string;
  12725. }
  12726. }
  12727. declare module BABYLON {
  12728. class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera> {
  12729. constructor();
  12730. camera: FreeCamera;
  12731. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12732. detachControl(element: HTMLElement): void;
  12733. checkInputs(): void;
  12734. getTypeName(): string;
  12735. getSimpleName(): string;
  12736. }
  12737. }
  12738. declare module BABYLON {
  12739. class FreeCameraGamepadInput implements ICameraInput<FreeCamera> {
  12740. camera: FreeCamera;
  12741. gamepad: Gamepad;
  12742. gamepadAngularSensibility: number;
  12743. gamepadMoveSensibility: number;
  12744. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12745. detachControl(element: HTMLElement): void;
  12746. checkInputs(): void;
  12747. getTypeName(): string;
  12748. getSimpleName(): string;
  12749. }
  12750. }
  12751. declare module BABYLON {
  12752. class FreeCameraKeyboardMoveInput implements ICameraInput<FreeCamera> {
  12753. camera: FreeCamera;
  12754. keysUp: number[];
  12755. keysDown: number[];
  12756. keysLeft: number[];
  12757. keysRight: number[];
  12758. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12759. detachControl(element: HTMLElement): void;
  12760. checkInputs(): void;
  12761. getTypeName(): string;
  12762. getSimpleName(): string;
  12763. }
  12764. }
  12765. declare module BABYLON {
  12766. class FreeCameraMouseInput implements ICameraInput<FreeCamera> {
  12767. touchEnabled: boolean;
  12768. camera: FreeCamera;
  12769. buttons: number[];
  12770. angularSensibility: number;
  12771. private previousPosition;
  12772. constructor(touchEnabled?: boolean);
  12773. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12774. detachControl(element: HTMLElement): void;
  12775. getTypeName(): string;
  12776. getSimpleName(): string;
  12777. }
  12778. }
  12779. declare module BABYLON {
  12780. class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
  12781. camera: FreeCamera;
  12782. touchAngularSensibility: number;
  12783. touchMoveSensibility: number;
  12784. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12785. detachControl(element: HTMLElement): void;
  12786. checkInputs(): void;
  12787. getTypeName(): string;
  12788. getSimpleName(): string;
  12789. }
  12790. }
  12791. declare module BABYLON {
  12792. class FreeCameraVirtualJoystickInput implements ICameraInput<FreeCamera> {
  12793. camera: FreeCamera;
  12794. getLeftJoystick(): VirtualJoystick;
  12795. getRightJoystick(): VirtualJoystick;
  12796. checkInputs(): void;
  12797. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12798. detachControl(element: HTMLElement): void;
  12799. getTypeName(): string;
  12800. getSimpleName(): string;
  12801. }
  12802. }
  12803. declare module BABYLON {
  12804. class VRCameraMetrics {
  12805. hResolution: number;
  12806. vResolution: number;
  12807. hScreenSize: number;
  12808. vScreenSize: number;
  12809. vScreenCenter: number;
  12810. eyeToScreenDistance: number;
  12811. lensSeparationDistance: number;
  12812. interpupillaryDistance: number;
  12813. distortionK: number[];
  12814. chromaAbCorrection: number[];
  12815. postProcessScaleFactor: number;
  12816. lensCenterOffset: number;
  12817. compensateDistortion: boolean;
  12818. readonly aspectRatio: number;
  12819. readonly aspectRatioFov: number;
  12820. readonly leftHMatrix: Matrix;
  12821. readonly rightHMatrix: Matrix;
  12822. readonly leftPreViewMatrix: Matrix;
  12823. readonly rightPreViewMatrix: Matrix;
  12824. static GetDefault(): VRCameraMetrics;
  12825. }
  12826. }
  12827. declare module BABYLON {
  12828. class VRDeviceOrientationFreeCamera extends DeviceOrientationCamera {
  12829. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  12830. getClassName(): string;
  12831. }
  12832. class VRDeviceOrientationGamepadCamera extends VRDeviceOrientationFreeCamera {
  12833. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  12834. getClassName(): string;
  12835. }
  12836. class VRDeviceOrientationArcRotateCamera extends ArcRotateCamera {
  12837. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  12838. getClassName(): string;
  12839. }
  12840. }
  12841. declare var HMDVRDevice: any;
  12842. declare var VRDisplay: any;
  12843. declare var VRFrameData: any;
  12844. declare module BABYLON {
  12845. /**
  12846. * This is a copy of VRPose.
  12847. * IMPORTANT!! The data is right-hand data.
  12848. * @export
  12849. * @interface DevicePose
  12850. */
  12851. interface DevicePose {
  12852. readonly position?: Float32Array;
  12853. readonly linearVelocity?: Float32Array;
  12854. readonly linearAcceleration?: Float32Array;
  12855. readonly orientation?: Float32Array;
  12856. readonly angularVelocity?: Float32Array;
  12857. readonly angularAcceleration?: Float32Array;
  12858. }
  12859. interface PoseControlled {
  12860. position: Vector3;
  12861. rotationQuaternion: Quaternion;
  12862. devicePosition?: Vector3;
  12863. deviceRotationQuaternion: Quaternion;
  12864. rawPose: DevicePose;
  12865. deviceScaleFactor: number;
  12866. updateFromDevice(poseData: DevicePose): any;
  12867. }
  12868. interface WebVROptions {
  12869. trackPosition?: boolean;
  12870. positionScale?: number;
  12871. displayName?: string;
  12872. controllerMeshes?: boolean;
  12873. defaultLightningOnControllers?: boolean;
  12874. }
  12875. class WebVRFreeCamera extends FreeCamera implements PoseControlled {
  12876. private webVROptions;
  12877. rawPose: DevicePose;
  12878. devicePosition: Vector3;
  12879. deviceRotationQuaternion: any;
  12880. deviceScaleFactor: number;
  12881. controllers: Array<WebVRController>;
  12882. nonVRControllers: Array<Gamepad>;
  12883. rigParenting: boolean;
  12884. constructor(name: string, position: Vector3, scene: Scene, webVROptions?: WebVROptions);
  12885. onControllersAttached: (controllers: Array<WebVRController>) => void;
  12886. onNonVRControllerAttached: (controller: Gamepad) => void;
  12887. getControllerByName(name: string): WebVRController;
  12888. readonly leftController: WebVRController;
  12889. readonly rightController: WebVRController;
  12890. getForwardRay(length?: number): Ray;
  12891. updateFromDevice(poseData: DevicePose): void;
  12892. /**
  12893. * WebVR's attach control will start broadcasting frames to the device.
  12894. * Note that in certain browsers (chrome for example) this function must be called
  12895. * within a user-interaction callback. Example:
  12896. * <pre> scene.onPointerDown = function() { camera.attachControl(canvas); }</pre>
  12897. *
  12898. * @param {HTMLElement} element
  12899. * @param {boolean} [noPreventDefault]
  12900. *
  12901. * @memberOf WebVRFreeCamera
  12902. */
  12903. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  12904. detachControl(element: HTMLElement): void;
  12905. getClassName(): string;
  12906. resetToCurrentRotation(): void;
  12907. /**
  12908. * This function is called by the two RIG cameras.
  12909. * 'this' is the left or right camera (and NOT (!!!) the WebVRFreeCamera instance)
  12910. */
  12911. initControllers(): void;
  12912. }
  12913. }
  12914. declare module BABYLON {
  12915. interface IOctreeContainer<T> {
  12916. blocks: Array<OctreeBlock<T>>;
  12917. }
  12918. class Octree<T> {
  12919. maxDepth: number;
  12920. blocks: Array<OctreeBlock<T>>;
  12921. dynamicContent: T[];
  12922. constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, maxDepth?: number);
  12923. update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void;
  12924. addMesh(entry: T): void;
  12925. select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T>;
  12926. intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T>;
  12927. intersectsRay(ray: Ray): SmartArray<T>;
  12928. static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>) => void;
  12929. static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock<SubMesh>) => void;
  12930. }
  12931. }
  12932. declare module BABYLON {
  12933. class OctreeBlock<T> {
  12934. entries: T[];
  12935. blocks: Array<OctreeBlock<T>>;
  12936. constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void);
  12937. readonly capacity: number;
  12938. readonly minPoint: Vector3;
  12939. readonly maxPoint: Vector3;
  12940. addEntry(entry: T): void;
  12941. addEntries(entries: T[]): void;
  12942. select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void;
  12943. intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void;
  12944. intersectsRay(ray: Ray, selection: SmartArray<T>): void;
  12945. createInnerBlocks(): void;
  12946. }
  12947. }
  12948. declare module BABYLON {
  12949. /**
  12950. * Interface to implement to create a shadow generator compatible with BJS.
  12951. */
  12952. interface IShadowGenerator {
  12953. getShadowMap(): RenderTargetTexture;
  12954. getShadowMapForRendering(): RenderTargetTexture;
  12955. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  12956. prepareDefines(defines: MaterialDefines, lightIndex: number): void;
  12957. bindShadowLight(lightIndex: string, effect: Effect): void;
  12958. getTransformMatrix(): Matrix;
  12959. recreateShadowMap(): void;
  12960. serialize(): any;
  12961. dispose(): void;
  12962. }
  12963. class ShadowGenerator implements IShadowGenerator {
  12964. static readonly FILTER_NONE: number;
  12965. static readonly FILTER_POISSONSAMPLING: number;
  12966. static readonly FILTER_EXPONENTIALSHADOWMAP: number;
  12967. static readonly FILTER_BLUREXPONENTIALSHADOWMAP: number;
  12968. static readonly FILTER_CLOSEEXPONENTIALSHADOWMAP: number;
  12969. static readonly FILTER_BLURCLOSEEXPONENTIALSHADOWMAP: number;
  12970. bias: number;
  12971. blurBoxOffset: number;
  12972. blurScale: number;
  12973. blurKernel: number;
  12974. useKernelBlur: boolean;
  12975. depthScale: number;
  12976. filter: number;
  12977. usePoissonSampling: boolean;
  12978. useVarianceShadowMap: boolean;
  12979. useBlurVarianceShadowMap: boolean;
  12980. useExponentialShadowMap: boolean;
  12981. useBlurExponentialShadowMap: boolean;
  12982. useCloseExponentialShadowMap: boolean;
  12983. useBlurCloseExponentialShadowMap: boolean;
  12984. /**
  12985. * Returns the darkness value (float).
  12986. */
  12987. getDarkness(): number;
  12988. /**
  12989. * Sets the ShadowGenerator darkness value (float <= 1.0).
  12990. * Returns the ShadowGenerator.
  12991. */
  12992. setDarkness(darkness: number): ShadowGenerator;
  12993. /**
  12994. * Sets the ability to have transparent shadow (boolean).
  12995. * Returns the ShadowGenerator.
  12996. */
  12997. setTransparencyShadow(hasShadow: boolean): ShadowGenerator;
  12998. /**
  12999. * Returns a RenderTargetTexture object : the shadow map texture.
  13000. */
  13001. getShadowMap(): RenderTargetTexture;
  13002. /**
  13003. * Returns the most ready computed shadow map as a RenderTargetTexture object.
  13004. */
  13005. getShadowMapForRendering(): RenderTargetTexture;
  13006. /**
  13007. * Returns the associated light object.
  13008. */
  13009. getLight(): IShadowLight;
  13010. forceBackFacesOnly: boolean;
  13011. /**
  13012. * Creates a ShadowGenerator object.
  13013. * A ShadowGenerator is the required tool to use the shadows.
  13014. * Each light casting shadows needs to use its own ShadowGenerator.
  13015. * Required parameters :
  13016. * - `mapSize` (integer): the size of the texture what stores the shadows. Example : 1024.
  13017. * - `light`: the light object generating the shadows.
  13018. * - `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.
  13019. * Documentation : http://doc.babylonjs.com/tutorials/shadows
  13020. */
  13021. constructor(mapSize: number, light: IShadowLight, useFullFloatFirst?: boolean);
  13022. /**
  13023. * Boolean : true when the ShadowGenerator is finally computed.
  13024. */
  13025. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  13026. /**
  13027. * This creates the defines related to the standard BJS materials.
  13028. */
  13029. prepareDefines(defines: MaterialDefines, lightIndex: number): void;
  13030. /**
  13031. * This binds shadow lights related to the standard BJS materials.
  13032. * It implies the unifroms available on the materials are the standard BJS ones.
  13033. */
  13034. bindShadowLight(lightIndex: string, effect: Effect): void;
  13035. /**
  13036. * Returns a Matrix object : the updated transformation matrix.
  13037. */
  13038. getTransformMatrix(): Matrix;
  13039. recreateShadowMap(): void;
  13040. /**
  13041. * Disposes the ShadowGenerator.
  13042. * Returns nothing.
  13043. */
  13044. dispose(): void;
  13045. /**
  13046. * Serializes the ShadowGenerator and returns a serializationObject.
  13047. */
  13048. serialize(): any;
  13049. /**
  13050. * Parses a serialized ShadowGenerator and returns a new ShadowGenerator.
  13051. */
  13052. static Parse(parsedShadowGenerator: any, scene: Scene): ShadowGenerator;
  13053. }
  13054. }
  13055. declare module BABYLON.Internals {
  13056. }
  13057. declare module BABYLON {
  13058. /**
  13059. * The Physically based material base class of BJS.
  13060. *
  13061. * This offers the main features of a standard PBR material.
  13062. * For more information, please refer to the documentation :
  13063. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  13064. */
  13065. abstract class PBRBaseMaterial extends BABYLON.PushMaterial {
  13066. /**
  13067. * Intensity of the direct lights e.g. the four lights available in your scene.
  13068. * This impacts both the direct diffuse and specular highlights.
  13069. */
  13070. /**
  13071. * Intensity of the emissive part of the material.
  13072. * This helps controlling the emissive effect without modifying the emissive color.
  13073. */
  13074. /**
  13075. * Intensity of the environment e.g. how much the environment will light the object
  13076. * either through harmonics for rough material or through the refelction for shiny ones.
  13077. */
  13078. /**
  13079. * This is a special control allowing the reduction of the specular highlights coming from the
  13080. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  13081. */
  13082. /**
  13083. * Debug Control allowing disabling the bump map on this material.
  13084. */
  13085. /**
  13086. * The camera exposure used on this material.
  13087. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  13088. * This corresponds to a photographic exposure.
  13089. */
  13090. /**
  13091. * The camera contrast used on this material.
  13092. * This property is here and not in the camera to allow controlling contrast without full screen post process.
  13093. */
  13094. /**
  13095. * Color Grading 2D Lookup Texture.
  13096. * This allows special effects like sepia, black and white to sixties rendering style.
  13097. */
  13098. /**
  13099. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  13100. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  13101. * 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;
  13102. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  13103. */
  13104. /**
  13105. * AKA Diffuse Texture in standard nomenclature.
  13106. */
  13107. /**
  13108. * AKA Occlusion Texture in other nomenclature.
  13109. */
  13110. /**
  13111. * AKA Occlusion Texture Intensity in other nomenclature.
  13112. */
  13113. /**
  13114. * AKA Specular texture in other nomenclature.
  13115. */
  13116. /**
  13117. * Used to switch from specular/glossiness to metallic/roughness workflow.
  13118. */
  13119. /**
  13120. * Specifies the metallic scalar of the metallic/roughness workflow.
  13121. * Can also be used to scale the metalness values of the metallic texture.
  13122. */
  13123. /**
  13124. * Specifies the roughness scalar of the metallic/roughness workflow.
  13125. * Can also be used to scale the roughness values of the metallic texture.
  13126. */
  13127. /**
  13128. * Used to enable roughness/glossiness fetch from a separate chanel depending on the current mode.
  13129. * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
  13130. */
  13131. /**
  13132. * AKA Diffuse Color in other nomenclature.
  13133. */
  13134. /**
  13135. * AKA Specular Color in other nomenclature.
  13136. */
  13137. /**
  13138. * AKA Glossiness in other nomenclature.
  13139. */
  13140. /**
  13141. * source material index of refraction (IOR)' / 'destination material IOR.
  13142. */
  13143. /**
  13144. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  13145. */
  13146. /**
  13147. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  13148. * Materials half opaque for instance using refraction could benefit from this control.
  13149. */
  13150. /**
  13151. * In this mode, the emissive informtaion will always be added to the lighting once.
  13152. * A light for instance can be thought as emissive.
  13153. */
  13154. /**
  13155. * Secifies that the alpha is coming form the albedo channel alpha channel.
  13156. */
  13157. /**
  13158. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  13159. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  13160. */
  13161. /**
  13162. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  13163. */
  13164. /**
  13165. * Specifies if the metallic texture contains the roughness information in its alpha channel.
  13166. */
  13167. /**
  13168. * Specifies if the metallic texture contains the roughness information in its green channel.
  13169. */
  13170. /**
  13171. * Specifies if the metallic texture contains the metallness information in its blue channel.
  13172. */
  13173. /**
  13174. * Specifies if the metallic texture contains the ambient occlusion information in its red channel.
  13175. */
  13176. /**
  13177. * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
  13178. */
  13179. /**
  13180. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  13181. * The material will try to infer what glossiness each pixel should be.
  13182. */
  13183. /**
  13184. * Allows to work with scalar in linear mode. This is definitely a matter of preferences and tools used during
  13185. * the creation of the material.
  13186. */
  13187. /**
  13188. * BJS is using an harcoded light falloff based on a manually sets up range.
  13189. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  13190. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  13191. */
  13192. /**
  13193. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  13194. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  13195. */
  13196. /**
  13197. * Allows using the bump map in parallax mode.
  13198. */
  13199. /**
  13200. * Allows using the bump map in parallax occlusion mode.
  13201. */
  13202. /**
  13203. * Controls the scale bias of the parallax mode.
  13204. */
  13205. /**
  13206. * If sets to true, disables all the lights affecting the material.
  13207. */
  13208. /**
  13209. * Number of Simultaneous lights allowed on the material.
  13210. */
  13211. /**
  13212. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  13213. */
  13214. /**
  13215. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  13216. */
  13217. /**
  13218. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  13219. */
  13220. /**
  13221. * Defines the alpha limits in alpha test mode.
  13222. */
  13223. /**
  13224. * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.
  13225. */
  13226. /**
  13227. * If false, it allows the output of the shader to be in hdr space (e.g. more than one) which is useful
  13228. * in combination of post process in float or half float mode.
  13229. */
  13230. /**
  13231. * Instantiates a new PBRMaterial instance.
  13232. *
  13233. * @param name The material name
  13234. * @param scene The scene the material will be use in.
  13235. */
  13236. constructor(name: string, scene: Scene);
  13237. abstract getClassName(): string;
  13238. useLogarithmicDepth: boolean;
  13239. needAlphaBlending(): boolean;
  13240. needAlphaTesting(): boolean;
  13241. getAlphaTestTexture(): BaseTexture;
  13242. private convertColorToLinearSpaceToRef(color, ref);
  13243. private static convertColorToLinearSpaceToRef(color, ref, useScalarInLinear);
  13244. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, useScalarInLinearSpace: boolean, maxSimultaneousLights: number, usePhysicalLightFalloff: boolean): void;
  13245. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  13246. buildUniformLayout(): void;
  13247. unbind(): void;
  13248. bindOnlyWorldMatrix(world: Matrix): void;
  13249. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  13250. getAnimatables(): IAnimatable[];
  13251. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  13252. }
  13253. }
  13254. declare module BABYLON.Internals {
  13255. /**
  13256. * The Physically based simple base material of BJS.
  13257. *
  13258. * This enables better naming and convention enforcements on top of the pbrMaterial.
  13259. * It is used as the base class for both the specGloss and metalRough conventions.
  13260. */
  13261. abstract class PBRBaseSimpleMaterial extends PBRBaseMaterial {
  13262. /**
  13263. * Number of Simultaneous lights allowed on the material.
  13264. */
  13265. maxSimultaneousLights: number;
  13266. /**
  13267. * If sets to true, disables all the lights affecting the material.
  13268. */
  13269. disableLighting: boolean;
  13270. /**
  13271. * Environment Texture used in the material (this is use for both reflection and environment lighting).
  13272. */
  13273. environmentTexture: BaseTexture;
  13274. /**
  13275. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  13276. */
  13277. invertNormalMapX: boolean;
  13278. /**
  13279. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  13280. */
  13281. invertNormalMapY: boolean;
  13282. /**
  13283. * Normal map used in the model.
  13284. */
  13285. normalTexture: BaseTexture;
  13286. /**
  13287. * Emissivie color used to self-illuminate the model.
  13288. */
  13289. emissiveColor: Color3;
  13290. /**
  13291. * Emissivie texture used to self-illuminate the model.
  13292. */
  13293. emissiveTexture: BaseTexture;
  13294. /**
  13295. * Occlusion Channel Strenght.
  13296. */
  13297. occlusionStrength: number;
  13298. /**
  13299. * Occlusion Texture of the material (adding extra occlusion effects).
  13300. */
  13301. occlusionTexture: BaseTexture;
  13302. /**
  13303. * Defines the alpha limits in alpha test mode.
  13304. */
  13305. alphaCutOff: number;
  13306. /**
  13307. * Gets the current transparency mode.
  13308. */
  13309. /**
  13310. * Sets the transparency mode of the material.
  13311. */
  13312. transparencyMode: number;
  13313. /**
  13314. * Gets the current double sided mode.
  13315. */
  13316. /**
  13317. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  13318. */
  13319. doubleSided: boolean;
  13320. /**
  13321. * Specifies wether or not the alpha value of the albedo texture should be used.
  13322. */
  13323. /**
  13324. * Specifies wether or not the meshes using this material should be rendered in alpha blend mode.
  13325. */
  13326. needAlphaBlending(): boolean;
  13327. /**
  13328. * Specifies wether or not the meshes using this material should be rendered in alpha test mode.
  13329. */
  13330. needAlphaTesting(): boolean;
  13331. /**
  13332. * Instantiates a new PBRMaterial instance.
  13333. *
  13334. * @param name The material name
  13335. * @param scene The scene the material will be use in.
  13336. */
  13337. constructor(name: string, scene: Scene);
  13338. }
  13339. }
  13340. declare module BABYLON {
  13341. /**
  13342. * The Physically based material of BJS.
  13343. *
  13344. * This offers the main features of a standard PBR material.
  13345. * For more information, please refer to the documentation :
  13346. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  13347. */
  13348. class PBRMaterial extends PBRBaseMaterial {
  13349. /**
  13350. * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.
  13351. */
  13352. static readonly PBRMATERIAL_OPAQUE: number;
  13353. /**
  13354. * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
  13355. */
  13356. static readonly PBRMATERIAL_ALPHATEST: number;
  13357. /**
  13358. * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
  13359. */
  13360. static readonly PBRMATERIAL_ALPHABLEND: number;
  13361. /**
  13362. * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
  13363. * They are also discarded below the alpha cutoff threshold to improve performances.
  13364. */
  13365. static readonly PBRMATERIAL_ALPHATESTANDBLEND: number;
  13366. /**
  13367. * Intensity of the direct lights e.g. the four lights available in your scene.
  13368. * This impacts both the direct diffuse and specular highlights.
  13369. */
  13370. directIntensity: number;
  13371. /**
  13372. * Intensity of the emissive part of the material.
  13373. * This helps controlling the emissive effect without modifying the emissive color.
  13374. */
  13375. emissiveIntensity: number;
  13376. /**
  13377. * Intensity of the environment e.g. how much the environment will light the object
  13378. * either through harmonics for rough material or through the refelction for shiny ones.
  13379. */
  13380. environmentIntensity: number;
  13381. /**
  13382. * This is a special control allowing the reduction of the specular highlights coming from the
  13383. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  13384. */
  13385. specularIntensity: number;
  13386. /**
  13387. * Debug Control allowing disabling the bump map on this material.
  13388. */
  13389. disableBumpMap: boolean;
  13390. /**
  13391. * The camera exposure used on this material.
  13392. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  13393. * This corresponds to a photographic exposure.
  13394. */
  13395. cameraExposure: number;
  13396. /**
  13397. * The camera contrast used on this material.
  13398. * This property is here and not in the camera to allow controlling contrast without full screen post process.
  13399. */
  13400. cameraContrast: number;
  13401. /**
  13402. * Color Grading 2D Lookup Texture.
  13403. * This allows special effects like sepia, black and white to sixties rendering style.
  13404. */
  13405. cameraColorGradingTexture: BaseTexture;
  13406. /**
  13407. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  13408. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  13409. * 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;
  13410. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  13411. */
  13412. cameraColorCurves: ColorCurves;
  13413. /**
  13414. * AKA Diffuse Texture in standard nomenclature.
  13415. */
  13416. albedoTexture: BaseTexture;
  13417. /**
  13418. * AKA Occlusion Texture in other nomenclature.
  13419. */
  13420. ambientTexture: BaseTexture;
  13421. /**
  13422. * AKA Occlusion Texture Intensity in other nomenclature.
  13423. */
  13424. ambientTextureStrength: number;
  13425. opacityTexture: BaseTexture;
  13426. reflectionTexture: BaseTexture;
  13427. emissiveTexture: BaseTexture;
  13428. /**
  13429. * AKA Specular texture in other nomenclature.
  13430. */
  13431. reflectivityTexture: BaseTexture;
  13432. /**
  13433. * Used to switch from specular/glossiness to metallic/roughness workflow.
  13434. */
  13435. metallicTexture: BaseTexture;
  13436. /**
  13437. * Specifies the metallic scalar of the metallic/roughness workflow.
  13438. * Can also be used to scale the metalness values of the metallic texture.
  13439. */
  13440. metallic: number;
  13441. /**
  13442. * Specifies the roughness scalar of the metallic/roughness workflow.
  13443. * Can also be used to scale the roughness values of the metallic texture.
  13444. */
  13445. roughness: number;
  13446. /**
  13447. * Used to enable roughness/glossiness fetch from a separate chanel depending on the current mode.
  13448. * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
  13449. */
  13450. microSurfaceTexture: BaseTexture;
  13451. bumpTexture: BaseTexture;
  13452. lightmapTexture: BaseTexture;
  13453. refractionTexture: BaseTexture;
  13454. ambientColor: Color3;
  13455. /**
  13456. * AKA Diffuse Color in other nomenclature.
  13457. */
  13458. albedoColor: Color3;
  13459. /**
  13460. * AKA Specular Color in other nomenclature.
  13461. */
  13462. reflectivityColor: Color3;
  13463. reflectionColor: Color3;
  13464. emissiveColor: Color3;
  13465. /**
  13466. * AKA Glossiness in other nomenclature.
  13467. */
  13468. microSurface: number;
  13469. /**
  13470. * source material index of refraction (IOR)' / 'destination material IOR.
  13471. */
  13472. indexOfRefraction: number;
  13473. /**
  13474. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  13475. */
  13476. invertRefractionY: boolean;
  13477. opacityFresnelParameters: FresnelParameters;
  13478. emissiveFresnelParameters: FresnelParameters;
  13479. /**
  13480. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  13481. * Materials half opaque for instance using refraction could benefit from this control.
  13482. */
  13483. linkRefractionWithTransparency: boolean;
  13484. useLightmapAsShadowmap: boolean;
  13485. /**
  13486. * In this mode, the emissive informtaion will always be added to the lighting once.
  13487. * A light for instance can be thought as emissive.
  13488. */
  13489. useEmissiveAsIllumination: boolean;
  13490. /**
  13491. * Secifies that the alpha is coming form the albedo channel alpha channel.
  13492. */
  13493. useAlphaFromAlbedoTexture: boolean;
  13494. /**
  13495. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  13496. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  13497. */
  13498. useSpecularOverAlpha: boolean;
  13499. /**
  13500. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  13501. */
  13502. useMicroSurfaceFromReflectivityMapAlpha: boolean;
  13503. /**
  13504. * Specifies if the metallic texture contains the roughness information in its alpha channel.
  13505. */
  13506. useRoughnessFromMetallicTextureAlpha: boolean;
  13507. /**
  13508. * Specifies if the metallic texture contains the roughness information in its green channel.
  13509. */
  13510. useRoughnessFromMetallicTextureGreen: boolean;
  13511. /**
  13512. * Specifies if the metallic texture contains the metallness information in its blue channel.
  13513. */
  13514. useMetallnessFromMetallicTextureBlue: boolean;
  13515. /**
  13516. * Specifies if the metallic texture contains the ambient occlusion information in its red channel.
  13517. */
  13518. useAmbientOcclusionFromMetallicTextureRed: boolean;
  13519. /**
  13520. * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
  13521. */
  13522. useAmbientInGrayScale: boolean;
  13523. /**
  13524. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  13525. * The material will try to infer what glossiness each pixel should be.
  13526. */
  13527. useAutoMicroSurfaceFromReflectivityMap: boolean;
  13528. /**
  13529. * Allows to work with scalar in linear mode. This is definitely a matter of preferences and tools used during
  13530. * the creation of the material.
  13531. */
  13532. useScalarInLinearSpace: boolean;
  13533. /**
  13534. * BJS is using an harcoded light falloff based on a manually sets up range.
  13535. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  13536. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  13537. */
  13538. usePhysicalLightFalloff: boolean;
  13539. /**
  13540. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  13541. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  13542. */
  13543. useRadianceOverAlpha: boolean;
  13544. /**
  13545. * Allows using the bump map in parallax mode.
  13546. */
  13547. useParallax: boolean;
  13548. /**
  13549. * Allows using the bump map in parallax occlusion mode.
  13550. */
  13551. useParallaxOcclusion: boolean;
  13552. /**
  13553. * Controls the scale bias of the parallax mode.
  13554. */
  13555. parallaxScaleBias: number;
  13556. /**
  13557. * If sets to true, disables all the lights affecting the material.
  13558. */
  13559. disableLighting: boolean;
  13560. /**
  13561. * Number of Simultaneous lights allowed on the material.
  13562. */
  13563. maxSimultaneousLights: number;
  13564. /**
  13565. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  13566. */
  13567. invertNormalMapX: boolean;
  13568. /**
  13569. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  13570. */
  13571. invertNormalMapY: boolean;
  13572. /**
  13573. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  13574. */
  13575. twoSidedLighting: boolean;
  13576. /**
  13577. * Instantiates a new PBRMaterial instance.
  13578. *
  13579. * @param name The material name
  13580. * @param scene The scene the material will be use in.
  13581. */
  13582. constructor(name: string, scene: Scene);
  13583. getClassName(): string;
  13584. clone(name: string): PBRMaterial;
  13585. serialize(): any;
  13586. static Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial;
  13587. }
  13588. }
  13589. declare module BABYLON {
  13590. /**
  13591. * The PBR material of BJS following the metal roughness convention.
  13592. *
  13593. * This fits to the define PBR convention in the GLTF definition:
  13594. * https://github.com/KhronosGroup/glTF/tree/2.0/specification/2.0
  13595. */
  13596. class PBRMetallicRoughnessMaterial extends Internals.PBRBaseSimpleMaterial {
  13597. /**
  13598. * The base color has two different interpretations depending on the value of metalness.
  13599. * When the material is a metal, the base color is the specific measured reflectance value
  13600. * at normal incidence (F0). For a non-metal the base color represents the reflected diffuse color
  13601. * of the material.
  13602. */
  13603. baseColor: Color3;
  13604. /**
  13605. * Base texture of the metallic workflow. It contains both the baseColor information in RGB as
  13606. * well as opacity information in the alpha channel.
  13607. */
  13608. baseTexture: BaseTexture;
  13609. /**
  13610. * Specifies the metallic scalar value of the material.
  13611. * Can also be used to scale the metalness values of the metallic texture.
  13612. */
  13613. metallic: number;
  13614. /**
  13615. * Specifies the roughness scalar value of the material.
  13616. * Can also be used to scale the roughness values of the metallic texture.
  13617. */
  13618. roughness: number;
  13619. /**
  13620. * Texture containing both the metallic value in the B channel and the
  13621. * roughness value in the G channel to keep better precision.
  13622. */
  13623. metallicRoughnessTexture: BaseTexture;
  13624. /**
  13625. * Instantiates a new PBRMetalRoughnessMaterial instance.
  13626. *
  13627. * @param name The material name
  13628. * @param scene The scene the material will be use in.
  13629. */
  13630. constructor(name: string, scene: Scene);
  13631. /**
  13632. * Return the currrent class name of the material.
  13633. */
  13634. getClassName(): string;
  13635. /**
  13636. * Serialize the material to a parsable JSON object.
  13637. */
  13638. serialize(): any;
  13639. /**
  13640. * Parses a JSON object correponding to the serialize function.
  13641. */
  13642. static Parse(source: any, scene: Scene, rootUrl: string): PBRMetallicRoughnessMaterial;
  13643. }
  13644. }
  13645. declare module BABYLON {
  13646. /**
  13647. * The PBR material of BJS following the specular glossiness convention.
  13648. *
  13649. * This fits to the define PBR convention in the GLTF definition:
  13650. * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness
  13651. */
  13652. class PBRSpecularGlossinessMaterial extends Internals.PBRBaseSimpleMaterial {
  13653. /**
  13654. * Specifies the diffuse Color of the material.
  13655. */
  13656. diffuseColor: Color3;
  13657. /**
  13658. * Specifies the diffuse texture of the material. This can aslo contains the opcity value in its alpha
  13659. * channel.
  13660. */
  13661. diffuseTexture: BaseTexture;
  13662. /**
  13663. * Specifies the specular color of the material. This indicates how reflective is the material (none to mirror).
  13664. */
  13665. specularColor: Color3;
  13666. /**
  13667. * Specifies the glossiness of the material. This indicates "how sharp is the reflection".
  13668. */
  13669. glossiness: number;
  13670. /**
  13671. * Spectifies both the specular color RGB and the glossiness A of the material per pixels.
  13672. */
  13673. specularGlossinessTexture: BaseTexture;
  13674. /**
  13675. * Instantiates a new PBRSpecularGlossinessMaterial instance.
  13676. *
  13677. * @param name The material name
  13678. * @param scene The scene the material will be use in.
  13679. */
  13680. constructor(name: string, scene: Scene);
  13681. /**
  13682. * Return the currrent class name of the material.
  13683. */
  13684. getClassName(): string;
  13685. /**
  13686. * Serialize the material to a parsable JSON object.
  13687. */
  13688. serialize(): any;
  13689. /**
  13690. * Parses a JSON object correponding to the serialize function.
  13691. */
  13692. static Parse(source: any, scene: Scene, rootUrl: string): PBRSpecularGlossinessMaterial;
  13693. }
  13694. }
  13695. declare module BABYLON {
  13696. class BaseTexture {
  13697. static DEFAULT_ANISOTROPIC_FILTERING_LEVEL: number;
  13698. name: string;
  13699. hasAlpha: boolean;
  13700. getAlphaFromRGB: boolean;
  13701. level: number;
  13702. coordinatesIndex: number;
  13703. coordinatesMode: number;
  13704. wrapU: number;
  13705. wrapV: number;
  13706. anisotropicFilteringLevel: number;
  13707. isCube: boolean;
  13708. isRenderTarget: boolean;
  13709. readonly uid: string;
  13710. toString(): string;
  13711. animations: Animation[];
  13712. /**
  13713. * An event triggered when the texture is disposed.
  13714. * @type {BABYLON.Observable}
  13715. */
  13716. onDisposeObservable: Observable<BaseTexture>;
  13717. onDispose: () => void;
  13718. delayLoadState: number;
  13719. readonly isBlocking: boolean;
  13720. constructor(scene: Scene);
  13721. getScene(): Scene;
  13722. getTextureMatrix(): Matrix;
  13723. getReflectionTextureMatrix(): Matrix;
  13724. getInternalTexture(): WebGLTexture;
  13725. isReadyOrNotBlocking(): boolean;
  13726. isReady(): boolean;
  13727. getSize(): ISize;
  13728. getBaseSize(): ISize;
  13729. scale(ratio: number): void;
  13730. readonly canRescale: boolean;
  13731. delayLoad(): void;
  13732. clone(): BaseTexture;
  13733. releaseInternalTexture(): void;
  13734. dispose(): void;
  13735. serialize(): any;
  13736. }
  13737. }
  13738. declare module BABYLON {
  13739. /**
  13740. * This represents a color grading texture. This acts as a lookup table LUT, useful during post process
  13741. * It can help converting any input color in a desired output one. This can then be used to create effects
  13742. * from sepia, black and white to sixties or futuristic rendering...
  13743. *
  13744. * The only supported format is currently 3dl.
  13745. * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table/
  13746. */
  13747. class ColorGradingTexture extends BaseTexture {
  13748. /**
  13749. * The current internal texture size.
  13750. */
  13751. /**
  13752. * The current texture matrix. (will always be identity in color grading texture)
  13753. */
  13754. /**
  13755. * The texture URL.
  13756. */
  13757. url: string;
  13758. /**
  13759. * Empty line regex stored for GC.
  13760. */
  13761. /**
  13762. * Instantiates a ColorGradingTexture from the following parameters.
  13763. *
  13764. * @param url The location of the color gradind data (currently only supporting 3dl)
  13765. * @param scene The scene the texture will be used in
  13766. */
  13767. constructor(url: string, scene: Scene);
  13768. /**
  13769. * Returns the texture matrix used in most of the material.
  13770. * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).
  13771. */
  13772. getTextureMatrix(): Matrix;
  13773. /**
  13774. * Occurs when the file being loaded is a .3dl LUT file.
  13775. */
  13776. private load3dlTexture();
  13777. /**
  13778. * Starts the loading process of the texture.
  13779. */
  13780. private loadTexture();
  13781. /**
  13782. * Clones the color gradind texture.
  13783. */
  13784. clone(): ColorGradingTexture;
  13785. /**
  13786. * Called during delayed load for textures.
  13787. */
  13788. delayLoad(): void;
  13789. /**
  13790. * Binds the color grading to the shader.
  13791. * @param colorGrading The texture to bind
  13792. * @param effect The effect to bind to
  13793. */
  13794. static Bind(colorGrading: BaseTexture, effect: Effect): void;
  13795. /**
  13796. * Prepare the list of uniforms associated with the ColorGrading effects.
  13797. * @param uniformsList The list of uniforms used in the effect
  13798. * @param samplersList The list of samplers used in the effect
  13799. */
  13800. static PrepareUniformsAndSamplers(uniformsList: string[], samplersList: string[]): void;
  13801. /**
  13802. * Parses a color grading texture serialized by Babylon.
  13803. * @param parsedTexture The texture information being parsedTexture
  13804. * @param scene The scene to load the texture in
  13805. * @param rootUrl The root url of the data assets to load
  13806. * @return A color gradind texture
  13807. */
  13808. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): ColorGradingTexture;
  13809. /**
  13810. * Serializes the LUT texture to json format.
  13811. */
  13812. serialize(): any;
  13813. }
  13814. }
  13815. declare module BABYLON {
  13816. class CubeTexture extends BaseTexture {
  13817. url: string;
  13818. coordinatesMode: number;
  13819. static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture;
  13820. constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean, files?: string[], onLoad?: () => void, onError?: () => void, format?: number);
  13821. delayLoad(): void;
  13822. getReflectionTextureMatrix(): Matrix;
  13823. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture;
  13824. clone(): CubeTexture;
  13825. }
  13826. }
  13827. declare module BABYLON {
  13828. class DynamicTexture extends Texture {
  13829. constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number, format?: number);
  13830. readonly canRescale: boolean;
  13831. scale(ratio: number): void;
  13832. scaleTo(width: number, height: number): void;
  13833. getContext(): CanvasRenderingContext2D;
  13834. clear(): void;
  13835. update(invertY?: boolean): void;
  13836. drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void;
  13837. clone(): DynamicTexture;
  13838. }
  13839. }
  13840. declare module BABYLON {
  13841. /**
  13842. * This represents a texture coming from an HDR input.
  13843. *
  13844. * The only supported format is currently panorama picture stored in RGBE format.
  13845. * Example of such files can be found on HDRLib: http://hdrlib.com/
  13846. */
  13847. class HDRCubeTexture extends BaseTexture {
  13848. /**
  13849. * The texture URL.
  13850. */
  13851. url: string;
  13852. /**
  13853. * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.
  13854. */
  13855. coordinatesMode: number;
  13856. /**
  13857. * The spherical polynomial data extracted from the texture.
  13858. */
  13859. sphericalPolynomial: SphericalPolynomial;
  13860. /**
  13861. * Specifies wether the texture has been generated through the PMREMGenerator tool.
  13862. * This is usefull at run time to apply the good shader.
  13863. */
  13864. isPMREM: boolean;
  13865. /**
  13866. * Gets wether or not the texture is blocking during loading.
  13867. */
  13868. /**
  13869. * Sets wether or not the texture is blocking during loading.
  13870. */
  13871. isBlocking: boolean;
  13872. /**
  13873. * Instantiates an HDRTexture from the following parameters.
  13874. *
  13875. * @param url The location of the HDR raw data (Panorama stored in RGBE format)
  13876. * @param scene The scene the texture will be used in
  13877. * @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.
  13878. * @param noMipmap Forces to not generate the mipmap if true
  13879. * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
  13880. * @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)
  13881. * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
  13882. */
  13883. constructor(url: string, scene: Scene, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean, onLoad?: () => void, onError?: () => void);
  13884. /**
  13885. * Occurs when the file is a preprocessed .babylon.hdr file.
  13886. */
  13887. private loadBabylonTexture();
  13888. /**
  13889. * Occurs when the file is raw .hdr file.
  13890. */
  13891. private loadHDRTexture();
  13892. /**
  13893. * Starts the loading process of the texture.
  13894. */
  13895. private loadTexture();
  13896. clone(): HDRCubeTexture;
  13897. delayLoad(): void;
  13898. getReflectionTextureMatrix(): Matrix;
  13899. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): HDRCubeTexture;
  13900. serialize(): any;
  13901. /**
  13902. * Saves as a file the data contained in the texture in a binary format.
  13903. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  13904. * as the spherical used in the lighting.
  13905. * @param url The HDR file url.
  13906. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  13907. * @param onError Method called if any error happens during download.
  13908. * @return The packed binary data.
  13909. */
  13910. static generateBabylonHDROnDisk(url: string, size: number, onError?: (() => void)): void;
  13911. /**
  13912. * Serializes the data contained in the texture in a binary format.
  13913. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  13914. * as the spherical used in the lighting.
  13915. * @param url The HDR file url.
  13916. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  13917. * @param onError Method called if any error happens during download.
  13918. * @return The packed binary data.
  13919. */
  13920. static generateBabylonHDR(url: string, size: number, callback: ((ArrayBuffer: ArrayBuffer) => void), onError?: (() => void)): void;
  13921. }
  13922. }
  13923. declare module BABYLON {
  13924. class MapTexture extends Texture {
  13925. constructor(name: string, scene: Scene, size: ISize, samplingMode?: number, useMipMap?: boolean, margin?: number);
  13926. /**
  13927. * Allocate a rectangle of a given size in the texture map
  13928. * @param size the size of the rectangle to allocation
  13929. * @return the PackedRect instance corresponding to the allocated rect or null is there was not enough space to allocate it.
  13930. */
  13931. allocateRect(size: Size): PackedRect;
  13932. /**
  13933. * Free a given rectangle from the texture map
  13934. * @param rectInfo the instance corresponding to the rect to free.
  13935. */
  13936. freeRect(rectInfo: PackedRect): void;
  13937. /**
  13938. * Return the available space in the range of [O;1]. 0 being not space left at all, 1 being an empty texture map.
  13939. * This is the cumulated space, not the biggest available surface. Due to fragmentation you may not allocate a rect corresponding to this surface.
  13940. * @returns {}
  13941. */
  13942. readonly freeSpace: number;
  13943. /**
  13944. * Bind the texture to the rendering engine to render in the zone of a given rectangle.
  13945. * Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.
  13946. * Don't forget to call unbindTexture when you're done rendering
  13947. * @param rect the zone to render to
  13948. * @param clear true to clear the portion's color/depth data
  13949. */
  13950. bindTextureForRect(rect: PackedRect, clear: boolean): void;
  13951. /**
  13952. * Bind the texture to the rendering engine to render in the zone of the given size at the given position.
  13953. * Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.
  13954. * Don't forget to call unbindTexture when you're done rendering
  13955. * @param pos the position into the texture
  13956. * @param size the portion to fit the clip space to
  13957. * @param clear true to clear the portion's color/depth data
  13958. */
  13959. bindTextureForPosSize(pos: Vector2, size: Size, clear: boolean): void;
  13960. /**
  13961. * Unbind the texture map from the rendering engine.
  13962. * Call this method when you're done rendering. A previous call to bindTextureForRect has to be made.
  13963. * @param dumpForDebug if set to true the content of the texture map will be dumped to a picture file that will be sent to the internet browser.
  13964. */
  13965. unbindTexture(dumpForDebug?: boolean): void;
  13966. readonly canRescale: boolean;
  13967. clone(): MapTexture;
  13968. }
  13969. }
  13970. declare module BABYLON {
  13971. class MirrorTexture extends RenderTargetTexture {
  13972. mirrorPlane: Plane;
  13973. blurRatio: number;
  13974. blurKernel: number;
  13975. blurKernelX: number;
  13976. blurKernelY: number;
  13977. constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, type?: number, samplingMode?: number, generateDepthBuffer?: boolean);
  13978. clone(): MirrorTexture;
  13979. serialize(): any;
  13980. }
  13981. }
  13982. declare module BABYLON {
  13983. interface IMultiRenderTargetOptions {
  13984. generateMipMaps: boolean;
  13985. types: number[];
  13986. samplingModes: number[];
  13987. generateDepthBuffer: boolean;
  13988. generateStencilBuffer: boolean;
  13989. generateDepthTexture: boolean;
  13990. textureCount: number;
  13991. }
  13992. class MultiRenderTarget extends RenderTargetTexture {
  13993. readonly isSupported: boolean;
  13994. readonly textures: Texture[];
  13995. readonly depthTexture: Texture;
  13996. constructor(name: string, size: any, count: number, scene: Scene, options?: any);
  13997. samples: number;
  13998. resize(size: any): void;
  13999. dispose(): void;
  14000. releaseInternalTextures(): void;
  14001. }
  14002. }
  14003. declare module BABYLON {
  14004. class RawTexture extends Texture {
  14005. format: number;
  14006. constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  14007. update(data: ArrayBufferView): void;
  14008. static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  14009. static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  14010. static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  14011. static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  14012. static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  14013. }
  14014. }
  14015. declare module BABYLON {
  14016. /**
  14017. * Creates a refraction texture used by refraction channel of the standard material.
  14018. * @param name the texture name
  14019. * @param size size of the underlying texture
  14020. * @param scene root scene
  14021. */
  14022. class RefractionTexture extends RenderTargetTexture {
  14023. refractionPlane: Plane;
  14024. depth: number;
  14025. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  14026. clone(): RefractionTexture;
  14027. serialize(): any;
  14028. }
  14029. }
  14030. declare module BABYLON {
  14031. interface IRenderTargetOptions {
  14032. generateMipMaps: boolean;
  14033. type: number;
  14034. samplingMode: number;
  14035. generateDepthBuffer: boolean;
  14036. generateStencilBuffer: boolean;
  14037. }
  14038. class RenderTargetTexture extends Texture {
  14039. isCube: boolean;
  14040. static readonly REFRESHRATE_RENDER_ONCE: number;
  14041. static readonly REFRESHRATE_RENDER_ONEVERYFRAME: number;
  14042. static readonly REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  14043. /**
  14044. * Use this predicate to dynamically define the list of mesh you want to render.
  14045. * If set, the renderList property will be overwritten.
  14046. */
  14047. renderListPredicate: (AbstractMesh: AbstractMesh) => boolean;
  14048. /**
  14049. * Use this list to define the list of mesh you want to render.
  14050. */
  14051. renderList: AbstractMesh[];
  14052. renderParticles: boolean;
  14053. renderSprites: boolean;
  14054. coordinatesMode: number;
  14055. activeCamera: Camera;
  14056. customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents?: () => void) => void;
  14057. useCameraPostProcesses: boolean;
  14058. /**
  14059. * An event triggered when the texture is unbind.
  14060. * @type {BABYLON.Observable}
  14061. */
  14062. onAfterUnbindObservable: Observable<RenderTargetTexture>;
  14063. onAfterUnbind: () => void;
  14064. /**
  14065. * An event triggered before rendering the texture
  14066. * @type {BABYLON.Observable}
  14067. */
  14068. onBeforeRenderObservable: Observable<number>;
  14069. onBeforeRender: (faceIndex: number) => void;
  14070. /**
  14071. * An event triggered after rendering the texture
  14072. * @type {BABYLON.Observable}
  14073. */
  14074. onAfterRenderObservable: Observable<number>;
  14075. onAfterRender: (faceIndex: number) => void;
  14076. /**
  14077. * An event triggered after the texture clear
  14078. * @type {BABYLON.Observable}
  14079. */
  14080. onClearObservable: Observable<Engine>;
  14081. onClear: (Engine: Engine) => void;
  14082. readonly renderTargetOptions: IRenderTargetOptions;
  14083. constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean, samplingMode?: number, generateDepthBuffer?: boolean, generateStencilBuffer?: boolean, isMulti?: boolean);
  14084. samples: number;
  14085. resetRefreshCounter(): void;
  14086. refreshRate: number;
  14087. addPostProcess(postProcess: PostProcess): void;
  14088. clearPostProcesses(dispose?: boolean): void;
  14089. removePostProcess(postProcess: PostProcess): void;
  14090. isReady(): boolean;
  14091. getRenderSize(): number;
  14092. readonly canRescale: boolean;
  14093. scale(ratio: number): void;
  14094. getReflectionTextureMatrix(): Matrix;
  14095. resize(size: any): void;
  14096. render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void;
  14097. private renderToTarget(faceIndex, currentRenderList, currentRenderListLength, useCameraPostProcess, dumpForDebug);
  14098. /**
  14099. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  14100. * This allowed control for front to back rendering or reversly depending of the special needs.
  14101. *
  14102. * @param renderingGroupId The rendering group id corresponding to its index
  14103. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  14104. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  14105. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  14106. */
  14107. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  14108. /**
  14109. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  14110. *
  14111. * @param renderingGroupId The rendering group id corresponding to its index
  14112. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  14113. */
  14114. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  14115. clone(): RenderTargetTexture;
  14116. serialize(): any;
  14117. disposeFramebufferObjects(): void;
  14118. dispose(): void;
  14119. }
  14120. }
  14121. declare module BABYLON {
  14122. class Texture extends BaseTexture {
  14123. static NEAREST_SAMPLINGMODE: number;
  14124. static BILINEAR_SAMPLINGMODE: number;
  14125. static TRILINEAR_SAMPLINGMODE: number;
  14126. static EXPLICIT_MODE: number;
  14127. static SPHERICAL_MODE: number;
  14128. static PLANAR_MODE: number;
  14129. static CUBIC_MODE: number;
  14130. static PROJECTION_MODE: number;
  14131. static SKYBOX_MODE: number;
  14132. static INVCUBIC_MODE: number;
  14133. static EQUIRECTANGULAR_MODE: number;
  14134. static FIXED_EQUIRECTANGULAR_MODE: number;
  14135. static FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number;
  14136. static CLAMP_ADDRESSMODE: number;
  14137. static WRAP_ADDRESSMODE: number;
  14138. static MIRROR_ADDRESSMODE: number;
  14139. url: string;
  14140. uOffset: number;
  14141. vOffset: number;
  14142. uScale: number;
  14143. vScale: number;
  14144. uAng: number;
  14145. vAng: number;
  14146. wAng: number;
  14147. readonly noMipmap: boolean;
  14148. isBlocking: boolean;
  14149. constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean, format?: number);
  14150. updateURL(url: string): void;
  14151. delayLoad(): void;
  14152. updateSamplingMode(samplingMode: number): void;
  14153. getTextureMatrix(): Matrix;
  14154. getReflectionTextureMatrix(): Matrix;
  14155. clone(): Texture;
  14156. readonly onLoadObservable: Observable<boolean>;
  14157. static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, format?: number): Texture;
  14158. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture;
  14159. static LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, format?: number): Texture;
  14160. }
  14161. }
  14162. declare module BABYLON {
  14163. class VideoTexture extends Texture {
  14164. video: HTMLVideoElement;
  14165. /**
  14166. * Creates a video texture.
  14167. * Sample : https://doc.babylonjs.com/tutorials/01._Advanced_Texturing
  14168. * @param {Array} urlsOrVideo can be used to provide an array of urls or an already setup HTML video element.
  14169. * @param {BABYLON.Scene} scene is obviously the current scene.
  14170. * @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
  14171. * @param {boolean} invertY is false by default but can be used to invert video on Y axis
  14172. * @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
  14173. */
  14174. constructor(name: string, urlsOrVideo: string[] | HTMLVideoElement, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  14175. update(): boolean;
  14176. dispose(): void;
  14177. static CreateFromWebCam(scene: Scene, onReady: (videoTexture: VideoTexture) => void, constraints: {
  14178. minWidth: number;
  14179. maxWidth: number;
  14180. minHeight: number;
  14181. maxHeight: number;
  14182. deviceId: string;
  14183. }): void;
  14184. }
  14185. }
  14186. declare module BABYLON {
  14187. class CannonJSPlugin implements IPhysicsEnginePlugin {
  14188. world: any;
  14189. name: string;
  14190. constructor(_useDeltaForWorldStep?: boolean, iterations?: number);
  14191. setGravity(gravity: Vector3): void;
  14192. setTimeStep(timeStep: number): void;
  14193. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  14194. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  14195. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  14196. generatePhysicsBody(impostor: PhysicsImpostor): void;
  14197. removePhysicsBody(impostor: PhysicsImpostor): void;
  14198. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  14199. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  14200. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  14201. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  14202. isSupported(): boolean;
  14203. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  14204. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  14205. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  14206. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  14207. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  14208. sleepBody(impostor: PhysicsImpostor): void;
  14209. wakeUpBody(impostor: PhysicsImpostor): void;
  14210. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  14211. private enableMotor(joint, motorIndex?);
  14212. private disableMotor(joint, motorIndex?);
  14213. setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number, motorIndex?: number): void;
  14214. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number): void;
  14215. dispose(): void;
  14216. }
  14217. }
  14218. declare module BABYLON {
  14219. class OimoJSPlugin implements IPhysicsEnginePlugin {
  14220. world: any;
  14221. name: string;
  14222. constructor(iterations?: number);
  14223. setGravity(gravity: Vector3): void;
  14224. setTimeStep(timeStep: number): void;
  14225. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  14226. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  14227. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  14228. generatePhysicsBody(impostor: PhysicsImpostor): void;
  14229. removePhysicsBody(impostor: PhysicsImpostor): void;
  14230. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  14231. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  14232. isSupported(): boolean;
  14233. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  14234. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  14235. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  14236. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  14237. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  14238. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  14239. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  14240. sleepBody(impostor: PhysicsImpostor): void;
  14241. wakeUpBody(impostor: PhysicsImpostor): void;
  14242. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  14243. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
  14244. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  14245. dispose(): void;
  14246. }
  14247. }
  14248. declare module BABYLON {
  14249. class PostProcessRenderEffect {
  14250. applyParameters: (postProcess: PostProcess) => void;
  14251. constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean);
  14252. readonly isSupported: boolean;
  14253. addPass(renderPass: PostProcessRenderPass): void;
  14254. removePass(renderPass: PostProcessRenderPass): void;
  14255. addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void;
  14256. getPass(passName: string): void;
  14257. emptyPasses(): void;
  14258. getPostProcess(camera?: Camera): PostProcess;
  14259. }
  14260. }
  14261. declare module BABYLON {
  14262. class PostProcessRenderPass {
  14263. constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void);
  14264. setRenderList(renderList: Mesh[]): void;
  14265. getRenderTexture(): RenderTargetTexture;
  14266. }
  14267. }
  14268. declare module BABYLON {
  14269. class PostProcessRenderPipeline {
  14270. private static PASS_EFFECT_NAME;
  14271. private static PASS_SAMPLER_NAME;
  14272. constructor(engine: Engine, name: string);
  14273. readonly isSupported: boolean;
  14274. addEffect(renderEffect: PostProcessRenderEffect): void;
  14275. dispose(): void;
  14276. }
  14277. }
  14278. declare module BABYLON {
  14279. class PostProcessRenderPipelineManager {
  14280. constructor();
  14281. addPipeline(renderPipeline: PostProcessRenderPipeline): void;
  14282. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any;
  14283. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any;
  14284. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any;
  14285. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any;
  14286. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  14287. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  14288. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  14289. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  14290. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any;
  14291. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any;
  14292. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any;
  14293. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any;
  14294. update(): void;
  14295. }
  14296. }
  14297. declare module BABYLON.Internals {
  14298. /**
  14299. * Helper class dealing with the extraction of spherical polynomial dataArray
  14300. * from a cube map.
  14301. */
  14302. class CubeMapToSphericalPolynomialTools {
  14303. private static FileFaces;
  14304. /**
  14305. * Converts a cubemap to the according Spherical Polynomial data.
  14306. * This extracts the first 3 orders only as they are the only one used in the lighting.
  14307. *
  14308. * @param cubeInfo The Cube map to extract the information from.
  14309. * @return The Spherical Polynomial data.
  14310. */
  14311. static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial;
  14312. }
  14313. }
  14314. declare module BABYLON.Internals {
  14315. /**
  14316. * Header information of HDR texture files.
  14317. */
  14318. interface HDRInfo {
  14319. /**
  14320. * The height of the texture in pixels.
  14321. */
  14322. height: number;
  14323. /**
  14324. * The width of the texture in pixels.
  14325. */
  14326. width: number;
  14327. /**
  14328. * The index of the beginning of the data in the binary file.
  14329. */
  14330. dataPosition: number;
  14331. }
  14332. /**
  14333. * This groups tools to convert HDR texture to native colors array.
  14334. */
  14335. class HDRTools {
  14336. private static Ldexp(mantissa, exponent);
  14337. private static Rgbe2float(float32array, red, green, blue, exponent, index);
  14338. private static readStringLine(uint8array, startIndex);
  14339. /**
  14340. * Reads header information from an RGBE texture stored in a native array.
  14341. * More information on this format are available here:
  14342. * https://en.wikipedia.org/wiki/RGBE_image_format
  14343. *
  14344. * @param uint8array The binary file stored in native array.
  14345. * @return The header information.
  14346. */
  14347. static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo;
  14348. /**
  14349. * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.
  14350. * This RGBE texture needs to store the information as a panorama.
  14351. *
  14352. * More information on this format are available here:
  14353. * https://en.wikipedia.org/wiki/RGBE_image_format
  14354. *
  14355. * @param buffer The binary file stored in an array buffer.
  14356. * @param size The expected size of the extracted cubemap.
  14357. * @return The Cube Map information.
  14358. */
  14359. static GetCubeMapTextureData(buffer: ArrayBuffer, size: number): CubeMapInfo;
  14360. /**
  14361. * Returns the pixels data extracted from an RGBE texture.
  14362. * This pixels will be stored left to right up to down in the R G B order in one array.
  14363. *
  14364. * More information on this format are available here:
  14365. * https://en.wikipedia.org/wiki/RGBE_image_format
  14366. *
  14367. * @param uint8array The binary file stored in an array buffer.
  14368. * @param hdrInfo The header information of the file.
  14369. * @return The pixels data in RGB right to left up to down order.
  14370. */
  14371. static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array;
  14372. private static RGBE_ReadPixels_RLE(uint8array, hdrInfo);
  14373. }
  14374. }
  14375. declare module BABYLON.Internals {
  14376. /**
  14377. * CubeMap information grouping all the data for each faces as well as the cubemap size.
  14378. */
  14379. interface CubeMapInfo {
  14380. /**
  14381. * The pixel array for the front face.
  14382. * This is stored in RGB, left to right, up to down format.
  14383. */
  14384. front: Float32Array;
  14385. /**
  14386. * The pixel array for the back face.
  14387. * This is stored in RGB, left to right, up to down format.
  14388. */
  14389. back: Float32Array;
  14390. /**
  14391. * The pixel array for the left face.
  14392. * This is stored in RGB, left to right, up to down format.
  14393. */
  14394. left: Float32Array;
  14395. /**
  14396. * The pixel array for the right face.
  14397. * This is stored in RGB, left to right, up to down format.
  14398. */
  14399. right: Float32Array;
  14400. /**
  14401. * The pixel array for the up face.
  14402. * This is stored in RGB, left to right, up to down format.
  14403. */
  14404. up: Float32Array;
  14405. /**
  14406. * The pixel array for the down face.
  14407. * This is stored in RGB, left to right, up to down format.
  14408. */
  14409. down: Float32Array;
  14410. /**
  14411. * The size of the cubemap stored.
  14412. *
  14413. * Each faces will be size * size pixels.
  14414. */
  14415. size: number;
  14416. }
  14417. /**
  14418. * Helper class usefull to convert panorama picture to their cubemap representation in 6 faces.
  14419. */
  14420. class PanoramaToCubeMapTools {
  14421. private static FACE_FRONT;
  14422. private static FACE_BACK;
  14423. private static FACE_RIGHT;
  14424. private static FACE_LEFT;
  14425. private static FACE_DOWN;
  14426. private static FACE_UP;
  14427. /**
  14428. * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces).
  14429. *
  14430. * @param float32Array The source data.
  14431. * @param inputWidth The width of the input panorama.
  14432. * @param inputhHeight The height of the input panorama.
  14433. * @param size The willing size of the generated cubemap (each faces will be size * size pixels)
  14434. * @return The cubemap data
  14435. */
  14436. static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number): CubeMapInfo;
  14437. private static CreateCubemapTexture(texSize, faceData, float32Array, inputWidth, inputHeight);
  14438. private static CalcProjectionSpherical(vDir, float32Array, inputWidth, inputHeight);
  14439. }
  14440. }
  14441. declare namespace BABYLON.Internals {
  14442. /**
  14443. * Helper class to PreProcess a cubemap in order to generate mipmap according to the level of blur
  14444. * required by the glossinees of a material.
  14445. *
  14446. * This only supports the cosine drop power as well as Warp fixup generation method.
  14447. *
  14448. * This is using the process from CubeMapGen described here:
  14449. * https://seblagarde.wordpress.com/2012/06/10/amd-cubemapgen-for-physically-based-rendering/
  14450. */
  14451. class PMREMGenerator {
  14452. input: ArrayBufferView[];
  14453. inputSize: number;
  14454. outputSize: number;
  14455. maxNumMipLevels: number;
  14456. numChannels: number;
  14457. isFloat: boolean;
  14458. specularPower: number;
  14459. cosinePowerDropPerMip: number;
  14460. excludeBase: boolean;
  14461. fixup: boolean;
  14462. private static CP_MAX_MIPLEVELS;
  14463. private static CP_UDIR;
  14464. private static CP_VDIR;
  14465. private static CP_FACEAXIS;
  14466. private static CP_FACE_X_POS;
  14467. private static CP_FACE_X_NEG;
  14468. private static CP_FACE_Y_POS;
  14469. private static CP_FACE_Y_NEG;
  14470. private static CP_FACE_Z_POS;
  14471. private static CP_FACE_Z_NEG;
  14472. private static CP_EDGE_LEFT;
  14473. private static CP_EDGE_RIGHT;
  14474. private static CP_EDGE_TOP;
  14475. private static CP_EDGE_BOTTOM;
  14476. private static CP_CORNER_NNN;
  14477. private static CP_CORNER_NNP;
  14478. private static CP_CORNER_NPN;
  14479. private static CP_CORNER_NPP;
  14480. private static CP_CORNER_PNN;
  14481. private static CP_CORNER_PNP;
  14482. private static CP_CORNER_PPN;
  14483. private static CP_CORNER_PPP;
  14484. /**
  14485. * Constructor of the generator.
  14486. *
  14487. * @param input The different faces data from the original cubemap in the order X+ X- Y+ Y- Z+ Z-
  14488. * @param inputSize The size of the cubemap faces
  14489. * @param outputSize The size of the output cubemap faces
  14490. * @param maxNumMipLevels The max number of mip map to generate (0 means all)
  14491. * @param numChannels The number of channels stored in the cubemap (3 for RBGE for instance)
  14492. * @param isFloat Specifies if the input texture is in float or int (hdr is usually in float)
  14493. * @param specularPower The max specular level of the desired cubemap
  14494. * @param cosinePowerDropPerMip The amount of drop the specular power will follow on each mip
  14495. * @param excludeBase Specifies wether to process the level 0 (original level) or not
  14496. * @param fixup Specifies wether to apply the edge fixup algorythm or not
  14497. */
  14498. constructor(input: ArrayBufferView[], inputSize: number, outputSize: number, maxNumMipLevels: number, numChannels: number, isFloat: boolean, specularPower: number, cosinePowerDropPerMip: number, excludeBase: boolean, fixup: boolean);
  14499. /**
  14500. * Launches the filter process and return the result.
  14501. *
  14502. * @return the filter cubemap in the form mip0 [faces1..6] .. mipN [faces1..6]
  14503. */
  14504. filterCubeMap(): ArrayBufferView[][];
  14505. private init();
  14506. private filterCubeMapMipChain();
  14507. private getBaseFilterAngle(cosinePower);
  14508. private precomputeFilterLookupTables(srcCubeMapWidth);
  14509. private buildNormalizerSolidAngleCubemap(size);
  14510. private texelCoordToVect(faceIdx, u, v, size, fixup);
  14511. private vectToTexelCoord(x, y, z, size);
  14512. private areaElement(x, y);
  14513. private texelCoordSolidAngle(faceIdx, u, v, size);
  14514. private filterCubeSurfaces(srcCubeMap, srcSize, dstCubeMap, dstSize, filterConeAngle, specularPower);
  14515. private clearFilterExtents(filterExtents);
  14516. private determineFilterExtents(centerTapDir, srcSize, bboxSize, filterExtents);
  14517. private processFilterExtents(centerTapDir, dotProdThresh, filterExtents, srcCubeMap, srcSize, specularPower);
  14518. private fixupCubeEdges(cubeMap, cubeMapSize);
  14519. }
  14520. }
  14521. declare module BABYLON {
  14522. class CustomProceduralTexture extends ProceduralTexture {
  14523. constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  14524. private loadJson(jsonUrl);
  14525. isReady(): boolean;
  14526. render(useCameraPostProcess?: boolean): void;
  14527. updateTextures(): void;
  14528. updateShaderUniforms(): void;
  14529. animate: boolean;
  14530. }
  14531. }
  14532. declare module BABYLON {
  14533. class ProceduralTexture extends Texture {
  14534. isCube: boolean;
  14535. isEnabled: boolean;
  14536. onGenerated: () => void;
  14537. constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean, isCube?: boolean);
  14538. reset(): void;
  14539. isReady(): boolean;
  14540. resetRefreshCounter(): void;
  14541. setFragment(fragment: any): void;
  14542. refreshRate: number;
  14543. getRenderSize(): number;
  14544. resize(size: any, generateMipMaps: any): void;
  14545. setTexture(name: string, texture: Texture): ProceduralTexture;
  14546. setFloat(name: string, value: number): ProceduralTexture;
  14547. setFloats(name: string, value: number[]): ProceduralTexture;
  14548. setColor3(name: string, value: Color3): ProceduralTexture;
  14549. setColor4(name: string, value: Color4): ProceduralTexture;
  14550. setVector2(name: string, value: Vector2): ProceduralTexture;
  14551. setVector3(name: string, value: Vector3): ProceduralTexture;
  14552. setMatrix(name: string, value: Matrix): ProceduralTexture;
  14553. render(useCameraPostProcess?: boolean): void;
  14554. clone(): ProceduralTexture;
  14555. dispose(): void;
  14556. }
  14557. }
  14558. declare module BABYLON {
  14559. class DefaultRenderingPipeline extends PostProcessRenderPipeline implements IDisposable, IAnimatable {
  14560. readonly PassPostProcessId: string;
  14561. readonly HighLightsPostProcessId: string;
  14562. readonly BlurXPostProcessId: string;
  14563. readonly BlurYPostProcessId: string;
  14564. readonly CopyBackPostProcessId: string;
  14565. readonly ImageProcessingPostProcessId: string;
  14566. readonly FxaaPostProcessId: string;
  14567. readonly FinalMergePostProcessId: string;
  14568. pass: BABYLON.PassPostProcess;
  14569. highlights: BABYLON.HighlightsPostProcess;
  14570. blurX: BABYLON.BlurPostProcess;
  14571. blurY: BABYLON.BlurPostProcess;
  14572. copyBack: BABYLON.PassPostProcess;
  14573. fxaa: FxaaPostProcess;
  14574. imageProcessing: ImageProcessingPostProcess;
  14575. finalMerge: BABYLON.PassPostProcess;
  14576. animations: Animation[];
  14577. /**
  14578. * Specifies the size of the bloom blur kernel, relative to the final output size
  14579. */
  14580. bloomKernel: number;
  14581. /**
  14582. * Specifies the weight of the bloom in the final rendering
  14583. */
  14584. bloomWeight: number;
  14585. bloomScale: number;
  14586. bloomEnabled: boolean;
  14587. fxaaEnabled: boolean;
  14588. imageProcessingEnabled: boolean;
  14589. /**
  14590. * @constructor
  14591. * @param {string} name - The rendering pipeline name
  14592. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  14593. * @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)
  14594. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  14595. */
  14596. constructor(name: string, hdr: boolean, scene: Scene, cameras?: Camera[]);
  14597. dispose(): void;
  14598. serialize(): any;
  14599. static Parse(source: any, scene: Scene, rootUrl: string): DefaultRenderingPipeline;
  14600. }
  14601. }
  14602. declare module BABYLON {
  14603. class LensRenderingPipeline extends PostProcessRenderPipeline {
  14604. /**
  14605. * The chromatic aberration PostProcess id in the pipeline
  14606. * @type {string}
  14607. */
  14608. LensChromaticAberrationEffect: string;
  14609. /**
  14610. * The highlights enhancing PostProcess id in the pipeline
  14611. * @type {string}
  14612. */
  14613. HighlightsEnhancingEffect: string;
  14614. /**
  14615. * The depth-of-field PostProcess id in the pipeline
  14616. * @type {string}
  14617. */
  14618. LensDepthOfFieldEffect: string;
  14619. /**
  14620. * @constructor
  14621. *
  14622. * Effect parameters are as follow:
  14623. * {
  14624. * chromatic_aberration: number; // from 0 to x (1 for realism)
  14625. * edge_blur: number; // from 0 to x (1 for realism)
  14626. * distortion: number; // from 0 to x (1 for realism)
  14627. * grain_amount: number; // from 0 to 1
  14628. * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise
  14629. * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)
  14630. * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)
  14631. * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)
  14632. * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect
  14633. * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)
  14634. * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)
  14635. * blur_noise: boolean; // add a little bit of noise to the blur (default: true)
  14636. * }
  14637. * Note: if an effect parameter is unset, effect is disabled
  14638. *
  14639. * @param {string} name - The rendering pipeline name
  14640. * @param {object} parameters - An object containing all parameters (see above)
  14641. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  14642. * @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)
  14643. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  14644. */
  14645. constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]);
  14646. setEdgeBlur(amount: number): void;
  14647. disableEdgeBlur(): void;
  14648. setGrainAmount(amount: number): void;
  14649. disableGrain(): void;
  14650. setChromaticAberration(amount: number): void;
  14651. disableChromaticAberration(): void;
  14652. setEdgeDistortion(amount: number): void;
  14653. disableEdgeDistortion(): void;
  14654. setFocusDistance(amount: number): void;
  14655. disableDepthOfField(): void;
  14656. setAperture(amount: number): void;
  14657. setDarkenOutOfFocus(amount: number): void;
  14658. enablePentagonBokeh(): void;
  14659. disablePentagonBokeh(): void;
  14660. enableNoiseBlur(): void;
  14661. disableNoiseBlur(): void;
  14662. setHighlightsGain(amount: number): void;
  14663. setHighlightsThreshold(amount: number): void;
  14664. disableHighlights(): void;
  14665. /**
  14666. * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
  14667. */
  14668. dispose(disableDepthRender?: boolean): void;
  14669. }
  14670. }
  14671. declare module BABYLON {
  14672. class SSAO2RenderingPipeline extends PostProcessRenderPipeline {
  14673. /**
  14674. * The PassPostProcess id in the pipeline that contains the original scene color
  14675. * @type {string}
  14676. */
  14677. SSAOOriginalSceneColorEffect: string;
  14678. /**
  14679. * The SSAO PostProcess id in the pipeline
  14680. * @type {string}
  14681. */
  14682. SSAORenderEffect: string;
  14683. /**
  14684. * The horizontal blur PostProcess id in the pipeline
  14685. * @type {string}
  14686. */
  14687. SSAOBlurHRenderEffect: string;
  14688. /**
  14689. * The vertical blur PostProcess id in the pipeline
  14690. * @type {string}
  14691. */
  14692. SSAOBlurVRenderEffect: string;
  14693. /**
  14694. * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
  14695. * @type {string}
  14696. */
  14697. SSAOCombineRenderEffect: string;
  14698. /**
  14699. * The output strength of the SSAO post-process. Default value is 1.0.
  14700. * @type {number}
  14701. */
  14702. totalStrength: number;
  14703. /**
  14704. * Maximum depth value to still render AO. A smooth falloff makes the dimming more natural, so there will be no abrupt shading change.
  14705. * @type {number}
  14706. */
  14707. maxZ: number;
  14708. /**
  14709. * In order to save performances, SSAO radius is clamped on close geometry. This ratio changes by how much
  14710. * @type {number}
  14711. */
  14712. minZAspect: number;
  14713. /**
  14714. * Number of samples used for the SSAO calculations. Default value is 8
  14715. * @type {number}
  14716. */
  14717. /**
  14718. * Dynamically generated sphere sampler.
  14719. * @type {number[]}
  14720. */
  14721. /**
  14722. * Blur filter offsets
  14723. * @type {number[]}
  14724. */
  14725. samples: number;
  14726. /**
  14727. * Are we using bilateral blur ?
  14728. * @type {boolean}
  14729. */
  14730. expensiveBlur: boolean;
  14731. /**
  14732. * The radius around the analyzed pixel used by the SSAO post-process. Default value is 2.0
  14733. * @type {number}
  14734. */
  14735. radius: number;
  14736. /**
  14737. * The base color of the SSAO post-process
  14738. * The final result is "base + ssao" between [0, 1]
  14739. * @type {number}
  14740. */
  14741. base: number;
  14742. /**
  14743. * Support test.
  14744. * @type {boolean}
  14745. */
  14746. static readonly IsSupported: boolean;
  14747. /**
  14748. * @constructor
  14749. * @param {string} name - The rendering pipeline name
  14750. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  14751. * @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 }
  14752. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  14753. */
  14754. constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
  14755. /**
  14756. * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
  14757. */
  14758. dispose(disableGeometryBufferRenderer?: boolean): void;
  14759. }
  14760. }
  14761. declare module BABYLON {
  14762. class SSAORenderingPipeline extends PostProcessRenderPipeline {
  14763. /**
  14764. * The PassPostProcess id in the pipeline that contains the original scene color
  14765. * @type {string}
  14766. */
  14767. SSAOOriginalSceneColorEffect: string;
  14768. /**
  14769. * The SSAO PostProcess id in the pipeline
  14770. * @type {string}
  14771. */
  14772. SSAORenderEffect: string;
  14773. /**
  14774. * The horizontal blur PostProcess id in the pipeline
  14775. * @type {string}
  14776. */
  14777. SSAOBlurHRenderEffect: string;
  14778. /**
  14779. * The vertical blur PostProcess id in the pipeline
  14780. * @type {string}
  14781. */
  14782. SSAOBlurVRenderEffect: string;
  14783. /**
  14784. * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
  14785. * @type {string}
  14786. */
  14787. SSAOCombineRenderEffect: string;
  14788. /**
  14789. * The output strength of the SSAO post-process. Default value is 1.0.
  14790. * @type {number}
  14791. */
  14792. totalStrength: number;
  14793. /**
  14794. * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006
  14795. * @type {number}
  14796. */
  14797. radius: number;
  14798. /**
  14799. * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel
  14800. * Must not be equal to fallOff and superior to fallOff.
  14801. * Default value is 0.975
  14802. * @type {number}
  14803. */
  14804. area: number;
  14805. /**
  14806. * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel
  14807. * Must not be equal to area and inferior to area.
  14808. * Default value is 0.0
  14809. * @type {number}
  14810. */
  14811. fallOff: number;
  14812. /**
  14813. * The base color of the SSAO post-process
  14814. * The final result is "base + ssao" between [0, 1]
  14815. * @type {number}
  14816. */
  14817. base: number;
  14818. /**
  14819. * @constructor
  14820. * @param {string} name - The rendering pipeline name
  14821. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  14822. * @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 }
  14823. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  14824. */
  14825. constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
  14826. /**
  14827. * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
  14828. */
  14829. dispose(disableDepthRender?: boolean): void;
  14830. }
  14831. }
  14832. declare module BABYLON {
  14833. class StandardRenderingPipeline extends PostProcessRenderPipeline implements IDisposable, IAnimatable {
  14834. /**
  14835. * Public members
  14836. */
  14837. originalPostProcess: PostProcess;
  14838. downSampleX4PostProcess: PostProcess;
  14839. brightPassPostProcess: PostProcess;
  14840. gaussianBlurHPostProcesses: PostProcess[];
  14841. gaussianBlurVPostProcesses: PostProcess[];
  14842. textureAdderPostProcess: PostProcess;
  14843. luminancePostProcess: PostProcess;
  14844. luminanceDownSamplePostProcesses: PostProcess[];
  14845. hdrPostProcess: PostProcess;
  14846. textureAdderFinalPostProcess: PostProcess;
  14847. lensFlareFinalPostProcess: PostProcess;
  14848. hdrFinalPostProcess: PostProcess;
  14849. lensFlarePostProcess: PostProcess;
  14850. lensFlareComposePostProcess: PostProcess;
  14851. motionBlurPostProcess: PostProcess;
  14852. depthOfFieldPostProcess: PostProcess;
  14853. brightThreshold: number;
  14854. blurWidth: number;
  14855. horizontalBlur: boolean;
  14856. gaussianCoefficient: number;
  14857. gaussianMean: number;
  14858. gaussianStandardDeviation: number;
  14859. exposure: number;
  14860. lensTexture: Texture;
  14861. hdrMinimumLuminance: number;
  14862. hdrDecreaseRate: number;
  14863. hdrIncreaseRate: number;
  14864. lensColorTexture: Texture;
  14865. lensFlareStrength: number;
  14866. lensFlareGhostDispersal: number;
  14867. lensFlareHaloWidth: number;
  14868. lensFlareDistortionStrength: number;
  14869. lensStarTexture: Texture;
  14870. lensFlareDirtTexture: Texture;
  14871. depthOfFieldDistance: number;
  14872. depthOfFieldBlurWidth: number;
  14873. motionStrength: number;
  14874. animations: Animation[];
  14875. /**
  14876. * Private members
  14877. */
  14878. BloomEnabled: boolean;
  14879. DepthOfFieldEnabled: boolean;
  14880. LensFlareEnabled: boolean;
  14881. HDREnabled: boolean;
  14882. MotionBlurEnabled: boolean;
  14883. motionBlurSamples: number;
  14884. /**
  14885. * @constructor
  14886. * @param {string} name - The rendering pipeline name
  14887. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  14888. * @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)
  14889. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  14890. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  14891. */
  14892. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  14893. dispose(): void;
  14894. serialize(): any;
  14895. static Parse(source: any, scene: Scene, rootUrl: string): StandardRenderingPipeline;
  14896. static LuminanceSteps: number;
  14897. }
  14898. }
  14899. declare module BABYLON.GUI {
  14900. class AdvancedDynamicTexture extends DynamicTexture {
  14901. background: string;
  14902. idealWidth: number;
  14903. idealHeight: number;
  14904. renderAtIdealSize: boolean;
  14905. readonly layer: Layer;
  14906. constructor(name: string, width: number, height: number, scene: Scene, generateMipMaps?: boolean, samplingMode?: number);
  14907. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  14908. markAsDirty(): void;
  14909. addControl(control: Control): AdvancedDynamicTexture;
  14910. removeControl(control: Control): AdvancedDynamicTexture;
  14911. dispose(): void;
  14912. attach(): void;
  14913. attachToMesh(mesh: AbstractMesh): void;
  14914. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number): AdvancedDynamicTexture;
  14915. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Scene): AdvancedDynamicTexture;
  14916. }
  14917. }
  14918. declare module BABYLON.GUI {
  14919. class Measure {
  14920. left: number;
  14921. top: number;
  14922. width: number;
  14923. height: number;
  14924. constructor(left: number, top: number, width: number, height: number);
  14925. copyFrom(other: Measure): void;
  14926. isEqualsTo(other: Measure): boolean;
  14927. static Empty(): Measure;
  14928. }
  14929. }
  14930. declare module BABYLON.GUI {
  14931. class Matrix2D {
  14932. m: Float32Array;
  14933. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  14934. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  14935. determinant(): number;
  14936. invertToRef(result: Matrix2D): Matrix2D;
  14937. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  14938. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  14939. static Identity(): Matrix2D;
  14940. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  14941. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  14942. static RotationToRef(angle: number, result: Matrix2D): void;
  14943. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Matrix2D, result: Matrix2D): void;
  14944. }
  14945. }
  14946. declare module BABYLON.GUI {
  14947. class ValueAndUnit {
  14948. unit: number;
  14949. negativeValueAllowed: boolean;
  14950. ignoreAdaptiveScaling: boolean;
  14951. constructor(value: any, unit?: number, negativeValueAllowed?: boolean);
  14952. readonly isPercentage: boolean;
  14953. readonly isPixel: boolean;
  14954. readonly internalValue: number;
  14955. getValue(host: AdvancedDynamicTexture): number;
  14956. toString(host: AdvancedDynamicTexture): string;
  14957. fromString(source: string | number): boolean;
  14958. static readonly UNITMODE_PERCENTAGE: number;
  14959. static readonly UNITMODE_PIXEL: number;
  14960. }
  14961. }
  14962. declare module BABYLON.GUI {
  14963. class Control {
  14964. name: string;
  14965. ascent: number;
  14966. height: number;
  14967. descent: number;
  14968. };
  14969. isHitTestVisible: boolean;
  14970. isPointerBlocker: boolean;
  14971. readonly typeName: string;
  14972. /**
  14973. * An event triggered when the pointer move over the control.
  14974. * @type {BABYLON.Observable}
  14975. */
  14976. onPointerMoveObservable: Observable<Vector2>;
  14977. /**
  14978. * An event triggered when the pointer move out of the control.
  14979. * @type {BABYLON.Observable}
  14980. */
  14981. onPointerOutObservable: Observable<Control>;
  14982. /**
  14983. * An event triggered when the pointer taps the control
  14984. * @type {BABYLON.Observable}
  14985. */
  14986. onPointerDownObservable: Observable<Vector2>;
  14987. /**
  14988. * An event triggered when pointer up
  14989. * @type {BABYLON.Observable}
  14990. */
  14991. onPointerUpObservable: Observable<Vector2>;
  14992. /**
  14993. * An event triggered when pointer enters the control
  14994. * @type {BABYLON.Observable}
  14995. */
  14996. onPointerEnterObservable: Observable<Control>;
  14997. /**
  14998. * An event triggered when the control is marked as dirty
  14999. * @type {BABYLON.Observable}
  15000. */
  15001. onDirtyObservable: Observable<Control>;
  15002. alpha: number;
  15003. scaleX: number;
  15004. scaleY: number;
  15005. rotation: number;
  15006. transformCenterY: number;
  15007. transformCenterX: number;
  15008. horizontalAlignment: number;
  15009. verticalAlignment: number;
  15010. width: string | number;
  15011. height: string | number;
  15012. fontFamily: string;
  15013. fontSize: string | number;
  15014. color: string;
  15015. zIndex: number;
  15016. isVisible: boolean;
  15017. readonly isDirty: boolean;
  15018. paddingLeft: string | number;
  15019. paddingRight: string | number;
  15020. paddingTop: string | number;
  15021. paddingBottom: string | number;
  15022. left: string | number;
  15023. top: string | number;
  15024. linkOffsetX: string | number;
  15025. linkOffsetY: string | number;
  15026. readonly centerX: number;
  15027. readonly centerY: number;
  15028. constructor(name?: string);
  15029. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  15030. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  15031. moveToVector3(position: Vector3, scene: Scene): void;
  15032. linkWithMesh(mesh: AbstractMesh): void;
  15033. contains(x: number, y: number): boolean;
  15034. forcePointerUp(): void;
  15035. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  15036. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  15037. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  15038. static readonly VERTICAL_ALIGNMENT_TOP: number;
  15039. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  15040. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  15041. ascent: number;
  15042. height: number;
  15043. descent: number;
  15044. };
  15045. static AddHeader(control: Control, text: string, size: string | number, options: {
  15046. isHorizontal: boolean;
  15047. controlFirst: boolean;
  15048. }): StackPanel;
  15049. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  15050. }
  15051. }
  15052. declare module BABYLON.GUI {
  15053. class Container extends Control {
  15054. name: string;
  15055. background: string;
  15056. readonly children: Control[];
  15057. constructor(name?: string);
  15058. getChildByName(name: string): Control;
  15059. getChildByType(name: string, type: string): Control;
  15060. containsControl(control: Control): boolean;
  15061. addControl(control: Control): Container;
  15062. removeControl(control: Control): Container;
  15063. }
  15064. }
  15065. declare module BABYLON.GUI {
  15066. class StackPanel extends Container {
  15067. name: string;
  15068. isVertical: boolean;
  15069. constructor(name?: string);
  15070. }
  15071. }
  15072. declare module BABYLON.GUI {
  15073. class Rectangle extends Container {
  15074. name: string;
  15075. thickness: number;
  15076. cornerRadius: number;
  15077. constructor(name?: string);
  15078. }
  15079. }
  15080. declare module BABYLON.GUI {
  15081. class Ellipse extends Container {
  15082. name: string;
  15083. thickness: number;
  15084. constructor(name?: string);
  15085. }
  15086. }
  15087. declare var DOMImage: new (width?: number, height?: number) => HTMLImageElement;
  15088. declare module BABYLON.GUI {
  15089. class Line extends Control {
  15090. name: string;
  15091. dash: Array<number>;
  15092. connectedControl: Control;
  15093. x1: string | number;
  15094. y1: string | number;
  15095. x2: string | number;
  15096. y2: string | number;
  15097. lineWidth: number;
  15098. horizontalAlignment: number;
  15099. verticalAlignment: number;
  15100. private readonly _effectiveX2;
  15101. private readonly _effectiveY2;
  15102. constructor(name?: string);
  15103. }
  15104. }
  15105. declare var DOMImage: new (width?: number, height?: number) => HTMLImageElement;
  15106. declare module BABYLON.GUI {
  15107. class Slider extends Control {
  15108. name: string;
  15109. onValueChangedObservable: Observable<number>;
  15110. borderColor: string;
  15111. background: string;
  15112. barOffset: string | number;
  15113. thumbWidth: string | number;
  15114. minimum: number;
  15115. maximum: number;
  15116. value: number;
  15117. constructor(name?: string);
  15118. }
  15119. }
  15120. declare var DOMImage: new (width?: number, height?: number) => HTMLImageElement;
  15121. declare module BABYLON.GUI {
  15122. class Checkbox extends Control {
  15123. name: string;
  15124. thickness: number;
  15125. onIsCheckedChangedObservable: Observable<boolean>;
  15126. checkSizeRatio: number;
  15127. background: string;
  15128. isChecked: boolean;
  15129. constructor(name?: string);
  15130. }
  15131. }
  15132. declare var DOMImage: new (width?: number, height?: number) => HTMLImageElement;
  15133. declare module BABYLON.GUI {
  15134. class RadioButton extends Control {
  15135. name: string;
  15136. thickness: number;
  15137. group: string;
  15138. onIsCheckedChangedObservable: Observable<boolean>;
  15139. checkSizeRatio: number;
  15140. background: string;
  15141. isChecked: boolean;
  15142. constructor(name?: string);
  15143. }
  15144. }
  15145. declare module BABYLON.GUI {
  15146. class TextBlock extends Control {
  15147. name: string;
  15148. textWrapping: boolean;
  15149. text: string;
  15150. textHorizontalAlignment: number;
  15151. textVerticalAlignment: number;
  15152. constructor(name?: string, text?: string);
  15153. }
  15154. }
  15155. declare var DOMImage: new (width?: number, height?: number) => HTMLImageElement;
  15156. declare module BABYLON.GUI {
  15157. class Image extends Control {
  15158. name: string;
  15159. sourceLeft: number;
  15160. sourceTop: number;
  15161. sourceWidth: number;
  15162. sourceHeight: number;
  15163. autoScale: boolean;
  15164. stretch: number;
  15165. domImage: HTMLImageElement;
  15166. source: string;
  15167. constructor(name?: string, url?: string);
  15168. synchronizeSizeWithContent(): void;
  15169. static readonly STRETCH_NONE: number;
  15170. static readonly STRETCH_FILL: number;
  15171. static readonly STRETCH_UNIFORM: number;
  15172. static readonly STRETCH_EXTEND: number;
  15173. }
  15174. }
  15175. declare module BABYLON.GUI {
  15176. class Button extends Rectangle {
  15177. name: string;
  15178. pointerEnterAnimation: () => void;
  15179. pointerOutAnimation: () => void;
  15180. pointerDownAnimation: () => void;
  15181. pointerUpAnimation: () => void;
  15182. constructor(name?: string);
  15183. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  15184. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  15185. static CreateSimpleButton(name: string, text: string): Button;
  15186. }
  15187. }
  15188. declare var DOMImage: new (width?: number, height?: number) => HTMLImageElement;
  15189. declare module BABYLON.GUI {
  15190. class ColorPicker extends Control {
  15191. name: string;
  15192. onValueChangedObservable: Observable<Color3>;
  15193. value: Color3;
  15194. width: string | number;
  15195. height: string | number;
  15196. size: string | number;
  15197. constructor(name?: string);
  15198. }
  15199. }
  15200. declare var engine: BABYLON.Engine;