babylon.module.d.ts 784 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388
  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 _ALPHA_DISABLE;
  80. private static _ALPHA_ADD;
  81. private static _ALPHA_COMBINE;
  82. private static _ALPHA_SUBTRACT;
  83. private static _ALPHA_MULTIPLY;
  84. private static _ALPHA_MAXIMIZED;
  85. private static _ALPHA_ONEONE;
  86. private static _ALPHA_PREMULTIPLIED;
  87. private static _DELAYLOADSTATE_NONE;
  88. private static _DELAYLOADSTATE_LOADED;
  89. private static _DELAYLOADSTATE_LOADING;
  90. private static _DELAYLOADSTATE_NOTLOADED;
  91. private static _TEXTUREFORMAT_ALPHA;
  92. private static _TEXTUREFORMAT_LUMINANCE;
  93. private static _TEXTUREFORMAT_LUMINANCE_ALPHA;
  94. private static _TEXTUREFORMAT_RGB;
  95. private static _TEXTUREFORMAT_RGBA;
  96. private static _TEXTURETYPE_UNSIGNED_INT;
  97. private static _TEXTURETYPE_FLOAT;
  98. private static _TEXTURETYPE_HALF_FLOAT;
  99. private static _NEVER;
  100. private static _ALWAYS;
  101. private static _LESS;
  102. private static _EQUAL;
  103. private static _LEQUAL;
  104. private static _GREATER;
  105. private static _GEQUAL;
  106. private static _NOTEQUAL;
  107. private static HALF_FLOAT_OES;
  108. private static RGBA16F;
  109. private static RGBA32F;
  110. static readonly NEVER: number;
  111. static readonly ALWAYS: number;
  112. static readonly LESS: number;
  113. static readonly EQUAL: number;
  114. static readonly LEQUAL: number;
  115. static readonly GREATER: number;
  116. static readonly GEQUAL: number;
  117. static readonly NOTEQUAL: number;
  118. private static _KEEP;
  119. private static _REPLACE;
  120. private static _INCR;
  121. private static _DECR;
  122. private static _INVERT;
  123. private static _INCR_WRAP;
  124. private static _DECR_WRAP;
  125. static readonly KEEP: number;
  126. static readonly REPLACE: number;
  127. static readonly INCR: number;
  128. static readonly DECR: number;
  129. static readonly INVERT: number;
  130. static readonly INCR_WRAP: number;
  131. static readonly DECR_WRAP: number;
  132. static readonly ALPHA_DISABLE: number;
  133. static readonly ALPHA_ONEONE: number;
  134. static readonly ALPHA_ADD: number;
  135. static readonly ALPHA_COMBINE: number;
  136. static readonly ALPHA_SUBTRACT: number;
  137. static readonly ALPHA_MULTIPLY: number;
  138. static readonly ALPHA_MAXIMIZED: number;
  139. static readonly ALPHA_PREMULTIPLIED: number;
  140. static readonly DELAYLOADSTATE_NONE: number;
  141. static readonly DELAYLOADSTATE_LOADED: number;
  142. static readonly DELAYLOADSTATE_LOADING: number;
  143. static readonly DELAYLOADSTATE_NOTLOADED: number;
  144. static readonly TEXTUREFORMAT_ALPHA: number;
  145. static readonly TEXTUREFORMAT_LUMINANCE: number;
  146. static readonly TEXTUREFORMAT_LUMINANCE_ALPHA: number;
  147. static readonly TEXTUREFORMAT_RGB: number;
  148. static readonly TEXTUREFORMAT_RGBA: number;
  149. static readonly TEXTURETYPE_UNSIGNED_INT: number;
  150. static readonly TEXTURETYPE_FLOAT: number;
  151. static readonly TEXTURETYPE_HALF_FLOAT: number;
  152. static readonly Version: string;
  153. static CollisionsEpsilon: number;
  154. static CodeRepository: string;
  155. static ShadersRepository: string;
  156. isFullscreen: boolean;
  157. isPointerLock: boolean;
  158. cullBackFaces: boolean;
  159. renderEvenInBackground: boolean;
  160. preventCacheWipeBetweenFrames: boolean;
  161. enableOfflineSupport: typeof Database;
  162. scenes: Scene[];
  163. /**
  164. * Observable event triggered each time the rendering canvas is resized
  165. */
  166. onResizeObservable: Observable<Engine>;
  167. vrDisplaysPromise: any;
  168. private _vrDisplays;
  169. private _vrDisplayEnabled;
  170. private _oldSize;
  171. private _oldHardwareScaleFactor;
  172. private _vrAnimationFrameHandler;
  173. _gl: WebGLRenderingContext;
  174. private _renderingCanvas;
  175. private _windowIsBackground;
  176. private _webGLVersion;
  177. private _badOS;
  178. static audioEngine: AudioEngine;
  179. private _onBlur;
  180. private _onFocus;
  181. private _onFullscreenChange;
  182. private _onPointerLockChange;
  183. private _hardwareScalingLevel;
  184. private _caps;
  185. private _pointerLockRequested;
  186. private _alphaTest;
  187. private _isStencilEnable;
  188. private _loadingScreen;
  189. _drawCalls: PerfCounter;
  190. private _glVersion;
  191. private _glRenderer;
  192. private _glVendor;
  193. private _videoTextureSupported;
  194. private _renderingQueueLaunched;
  195. private _activeRenderLoops;
  196. private fpsRange;
  197. private previousFramesDuration;
  198. private fps;
  199. private deltaTime;
  200. private _depthCullingState;
  201. private _stencilState;
  202. private _alphaState;
  203. private _alphaMode;
  204. private _loadedTexturesCache;
  205. private _maxTextureChannels;
  206. private _activeTexture;
  207. private _activeTexturesCache;
  208. private _currentEffect;
  209. private _currentProgram;
  210. private _compiledEffects;
  211. private _vertexAttribArraysEnabled;
  212. private _cachedViewport;
  213. private _cachedVertexArrayObject;
  214. private _cachedVertexBuffers;
  215. private _cachedIndexBuffer;
  216. private _cachedEffectForVertexBuffers;
  217. private _currentRenderTarget;
  218. private _uintIndicesCurrentlySet;
  219. private _currentBoundBuffer;
  220. private _currentFramebuffer;
  221. private _currentBufferPointers;
  222. private _currentInstanceLocations;
  223. private _currentInstanceBuffers;
  224. private _textureUnits;
  225. private _workingCanvas;
  226. private _workingContext;
  227. private _externalData;
  228. private _bindedRenderFunction;
  229. private _vaoRecordInProgress;
  230. private _mustWipeVertexAttributes;
  231. private _texturesSupported;
  232. private _textureFormatInUse;
  233. readonly texturesSupported: Array<string>;
  234. readonly textureFormatInUse: string;
  235. /**
  236. * @constructor
  237. * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering
  238. * @param {boolean} [antialias] - enable antialias
  239. * @param options - further options to be sent to the getContext function
  240. */
  241. constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio?: boolean);
  242. readonly webGLVersion: number;
  243. /**
  244. * Returns true if the stencil buffer has been enabled through the creation option of the context.
  245. */
  246. readonly isStencilEnable: boolean;
  247. private _prepareWorkingCanvas();
  248. resetTextureCache(): void;
  249. getGlInfo(): {
  250. vendor: string;
  251. renderer: string;
  252. version: string;
  253. };
  254. getAspectRatio(camera: Camera, useScreen?: boolean): number;
  255. getRenderWidth(useScreen?: boolean): number;
  256. getRenderHeight(useScreen?: boolean): number;
  257. getRenderingCanvas(): HTMLCanvasElement;
  258. getRenderingCanvasClientRect(): ClientRect;
  259. setHardwareScalingLevel(level: number): void;
  260. getHardwareScalingLevel(): number;
  261. getLoadedTexturesCache(): WebGLTexture[];
  262. getCaps(): EngineCapabilities;
  263. readonly drawCalls: number;
  264. readonly drawCallsPerfCounter: PerfCounter;
  265. getDepthFunction(): number;
  266. setDepthFunction(depthFunc: number): void;
  267. setDepthFunctionToGreater(): void;
  268. setDepthFunctionToGreaterOrEqual(): void;
  269. setDepthFunctionToLess(): void;
  270. setDepthFunctionToLessOrEqual(): void;
  271. getStencilBuffer(): boolean;
  272. setStencilBuffer(enable: boolean): void;
  273. getStencilMask(): number;
  274. setStencilMask(mask: number): void;
  275. getStencilFunction(): number;
  276. getStencilFunctionReference(): number;
  277. getStencilFunctionMask(): number;
  278. setStencilFunction(stencilFunc: number): void;
  279. setStencilFunctionReference(reference: number): void;
  280. setStencilFunctionMask(mask: number): void;
  281. getStencilOperationFail(): number;
  282. getStencilOperationDepthFail(): number;
  283. getStencilOperationPass(): number;
  284. setStencilOperationFail(operation: number): void;
  285. setStencilOperationDepthFail(operation: number): void;
  286. setStencilOperationPass(operation: number): void;
  287. setDitheringState(value: boolean): void;
  288. /**
  289. * stop executing a render loop function and remove it from the execution array
  290. * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
  291. */
  292. stopRenderLoop(renderFunction?: () => void): void;
  293. _renderLoop(): void;
  294. /**
  295. * Register and execute a render loop. The engine can have more than one render function.
  296. * @param {Function} renderFunction - the function to continuously execute starting the next render loop.
  297. * @example
  298. * engine.runRenderLoop(function () {
  299. * scene.render()
  300. * })
  301. */
  302. runRenderLoop(renderFunction: () => void): void;
  303. /**
  304. * Toggle full screen mode.
  305. * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
  306. * @param {any} options - an options object to be sent to the requestFullscreen function
  307. */
  308. switchFullscreen(requestPointerLock: boolean): void;
  309. clear(color: Color4, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
  310. scissorClear(x: number, y: number, width: number, height: number, clearColor: Color4): void;
  311. /**
  312. * Set the WebGL's viewport
  313. * @param {BABYLON.Viewport} viewport - the viewport element to be used.
  314. * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used.
  315. * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used.
  316. */
  317. setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  318. /**
  319. * Directly set the WebGL Viewport
  320. * The x, y, width & height are directly passed to the WebGL call
  321. * @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.
  322. */
  323. setDirectViewport(x: number, y: number, width: number, height: number): Viewport;
  324. beginFrame(): void;
  325. endFrame(): void;
  326. /**
  327. * resize the view according to the canvas' size.
  328. * @example
  329. * window.addEventListener("resize", function () {
  330. * engine.resize();
  331. * });
  332. */
  333. resize(): void;
  334. /**
  335. * force a specific size of the canvas
  336. * @param {number} width - the new canvas' width
  337. * @param {number} height - the new canvas' height
  338. */
  339. setSize(width: number, height: number): void;
  340. isVRDevicePresent(callback: (result: boolean) => void): void;
  341. getVRDevice(name: string, callback: (device: any) => void): void;
  342. initWebVR(): void;
  343. enableVR(vrDevice: any): void;
  344. disableVR(): void;
  345. private _onVRFullScreenTriggered;
  346. private _getVRDisplays();
  347. bindFramebuffer(texture: WebGLTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number): void;
  348. private bindUnboundFramebuffer(framebuffer);
  349. unBindFramebuffer(texture: WebGLTexture, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
  350. generateMipMapsForCubemap(texture: WebGLTexture): void;
  351. flushFramebuffer(): void;
  352. restoreDefaultFramebuffer(): void;
  353. createUniformBuffer(elements: number[] | Float32Array): WebGLBuffer;
  354. createDynamicUniformBuffer(elements: number[] | Float32Array): WebGLBuffer;
  355. updateUniformBuffer(uniformBuffer: WebGLBuffer, elements: number[] | Float32Array, offset?: number, count?: number): void;
  356. private _resetVertexBufferBinding();
  357. createVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  358. createDynamicVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  359. updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: number[] | Float32Array, offset?: number, count?: number): void;
  360. private _resetIndexBufferBinding();
  361. createIndexBuffer(indices: IndicesArray): WebGLBuffer;
  362. bindArrayBuffer(buffer: WebGLBuffer): void;
  363. bindUniformBuffer(buffer?: WebGLBuffer): void;
  364. bindUniformBufferBase(buffer: WebGLBuffer, location: number): void;
  365. bindUniformBlock(shaderProgram: WebGLProgram, blockName: string, index: number): void;
  366. private bindIndexBuffer(buffer);
  367. private bindBuffer(buffer, target);
  368. updateArrayBuffer(data: Float32Array): void;
  369. private vertexAttribPointer(buffer, indx, size, type, normalized, stride, offset);
  370. private _bindIndexBufferWithCache(indexBuffer);
  371. private _bindVertexBuffersAttributes(vertexBuffers, effect);
  372. recordVertexArrayObject(vertexBuffers: {
  373. [key: string]: VertexBuffer;
  374. }, indexBuffer: WebGLBuffer, effect: Effect): WebGLVertexArrayObject;
  375. bindVertexArrayObject(vertexArrayObject: WebGLVertexArrayObject, indexBuffer: WebGLBuffer): void;
  376. bindBuffersDirectly(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
  377. private _unBindVertexArrayObject();
  378. bindBuffers(vertexBuffers: {
  379. [key: string]: VertexBuffer;
  380. }, indexBuffer: WebGLBuffer, effect: Effect): void;
  381. unbindInstanceAttributes(): void;
  382. releaseVertexArrayObject(vao: WebGLVertexArrayObject): void;
  383. _releaseBuffer(buffer: WebGLBuffer): boolean;
  384. createInstancesBuffer(capacity: number): WebGLBuffer;
  385. deleteInstancesBuffer(buffer: WebGLBuffer): void;
  386. updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[] | InstancingAttributeInfo[]): void;
  387. applyStates(): void;
  388. draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  389. drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void;
  390. drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  391. _releaseEffect(effect: Effect): void;
  392. 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;
  393. createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  394. createShaderProgram(vertexCode: string, fragmentCode: string, defines: string, context?: WebGLRenderingContext): WebGLProgram;
  395. getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
  396. getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  397. enableEffect(effect: Effect): void;
  398. setIntArray(uniform: WebGLUniformLocation, array: Int32Array): void;
  399. setIntArray2(uniform: WebGLUniformLocation, array: Int32Array): void;
  400. setIntArray3(uniform: WebGLUniformLocation, array: Int32Array): void;
  401. setIntArray4(uniform: WebGLUniformLocation, array: Int32Array): void;
  402. setFloatArray(uniform: WebGLUniformLocation, array: Float32Array): void;
  403. setFloatArray2(uniform: WebGLUniformLocation, array: Float32Array): void;
  404. setFloatArray3(uniform: WebGLUniformLocation, array: Float32Array): void;
  405. setFloatArray4(uniform: WebGLUniformLocation, array: Float32Array): void;
  406. setArray(uniform: WebGLUniformLocation, array: number[]): void;
  407. setArray2(uniform: WebGLUniformLocation, array: number[]): void;
  408. setArray3(uniform: WebGLUniformLocation, array: number[]): void;
  409. setArray4(uniform: WebGLUniformLocation, array: number[]): void;
  410. setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void;
  411. setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void;
  412. setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  413. setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  414. setFloat(uniform: WebGLUniformLocation, value: number): void;
  415. setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void;
  416. setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void;
  417. setBool(uniform: WebGLUniformLocation, bool: number): void;
  418. setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
  419. setColor3(uniform: WebGLUniformLocation, color3: Color3): void;
  420. setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void;
  421. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
  422. setDepthBuffer(enable: boolean): void;
  423. getDepthWrite(): boolean;
  424. setDepthWrite(enable: boolean): void;
  425. setColorWrite(enable: boolean): void;
  426. setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
  427. getAlphaMode(): number;
  428. setAlphaTesting(enable: boolean): void;
  429. getAlphaTesting(): boolean;
  430. wipeCaches(): void;
  431. /**
  432. * Set the compressed texture format to use, based on the formats you have, and the formats
  433. * supported by the hardware / browser.
  434. *
  435. * Khronos Texture Container (.ktx) files are used to support this. This format has the
  436. * advantage of being specifically designed for OpenGL. Header elements directly correspond
  437. * to API arguments needed to compressed textures. This puts the burden on the container
  438. * generator to house the arcane code for determining these for current & future formats.
  439. *
  440. * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
  441. * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
  442. *
  443. * Note: The result of this call is not taken into account when a texture is base64.
  444. *
  445. * @param {Array<string>} formatsAvailable- The list of those format families you have created
  446. * on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)
  447. *
  448. * Current families are astc, dxt, pvrtc, etc2, & etc1.
  449. * @returns The extension selected.
  450. */
  451. setTextureFormatToUse(formatsAvailable: Array<string>): string;
  452. /**
  453. * Usually called from BABYLON.Texture.ts. Passed information to create a WebGLTexture.
  454. * @param {string} urlArg- This contains one of the following:
  455. * 1. A conventional http URL, e.g. 'http://...' or 'file://...'
  456. * 2. A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
  457. * 3. An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
  458. *
  459. * @param {boolean} noMipmap- When true, no mipmaps shall be generated. Ignored for compressed textures. They must be in the file.
  460. * @param {boolean} invertY- When true, image is flipped when loaded. You probably want true. Ignored for compressed textures. Must be flipped in the file.
  461. * @param {Scene} scene- Needed for loading to the correct scene.
  462. * @param {number} samplingMode- Mode with should be used sample / access the texture. Default: TRILINEAR
  463. * @param {callback} onLoad- Optional callback to be called upon successful completion.
  464. * @param {callback} onError- Optional callback to be called upon failure.
  465. * @param {ArrayBuffer | HTMLImageElement} buffer- A source of a file previously fetched as either an ArrayBuffer (compressed or image format) or HTMLImageElement (image format)
  466. * @param {WebGLTexture} fallback- An internal argument in case the function must be called again, due to etc1 not having alpha capabilities.
  467. * @param {number} format- Internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures.
  468. *
  469. * @returns {WebGLTexture} for assignment back into BABYLON.Texture
  470. */
  471. createTexture(urlArg: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: ArrayBuffer | HTMLImageElement, fallBack?: WebGLTexture, format?: number): WebGLTexture;
  472. private _getInternalFormat(format);
  473. updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void;
  474. createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture;
  475. createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): WebGLTexture;
  476. updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void;
  477. updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean, format?: number): void;
  478. updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void;
  479. createRenderTargetTexture(size: any, options: any): WebGLTexture;
  480. private _setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height, samples?);
  481. updateRenderTargetTextureSampleCount(texture: WebGLTexture, samples: number): number;
  482. createRenderTargetCubeTexture(size: number, options?: any): WebGLTexture;
  483. createCubeTexture(rootUrl: string, scene: Scene, files: string[], noMipmap?: boolean, onLoad?: () => void, onError?: () => void, format?: number): WebGLTexture;
  484. updateTextureSize(texture: WebGLTexture, width: number, height: number): void;
  485. createRawCubeTexture(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer: ArrayBuffer) => ArrayBufferView[], mipmmapGenerator: ((faces: ArrayBufferView[]) => ArrayBufferView[][]), onLoad?: () => void, onError?: () => void): WebGLTexture;
  486. private _convertRGBtoRGBATextureData(rgbData, width, height, textureType);
  487. _releaseTexture(texture: WebGLTexture): void;
  488. private setProgram(program);
  489. bindSamplers(effect: Effect): void;
  490. private activateTexture(texture);
  491. _bindTextureDirectly(target: number, texture: WebGLTexture): void;
  492. _bindTexture(channel: number, texture: WebGLTexture): void;
  493. setTextureFromPostProcess(channel: number, postProcess: PostProcess): void;
  494. unbindAllTextures(): void;
  495. setTexture(channel: number, uniform: WebGLUniformLocation, texture: BaseTexture): void;
  496. private _setTexture(channel, texture);
  497. setTextureArray(channel: number, uniform: WebGLUniformLocation, textures: BaseTexture[]): void;
  498. _setAnisotropicLevel(key: number, texture: BaseTexture): void;
  499. readPixels(x: number, y: number, width: number, height: number): Uint8Array;
  500. /**
  501. * Add an externaly attached data from its key.
  502. * This method call will fail and return false, if such key already exists.
  503. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  504. * @param key the unique key that identifies the data
  505. * @param data the data object to associate to the key for this Engine instance
  506. * @return true if no such key were already present and the data was added successfully, false otherwise
  507. */
  508. addExternalData<T>(key: string, data: T): boolean;
  509. /**
  510. * Get an externaly attached data from its key
  511. * @param key the unique key that identifies the data
  512. * @return the associated data, if present (can be null), or undefined if not present
  513. */
  514. getExternalData<T>(key: string): T;
  515. /**
  516. * Get an externaly attached data from its key, create it using a factory if it's not already present
  517. * @param key the unique key that identifies the data
  518. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  519. * @return the associated data, can be null if the factory returned null.
  520. */
  521. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  522. /**
  523. * Remove an externaly attached data from the Engine instance
  524. * @param key the unique key that identifies the data
  525. * @return true if the data was successfully removed, false if it doesn't exist
  526. */
  527. removeExternalData(key: any): boolean;
  528. releaseInternalTexture(texture: WebGLTexture): void;
  529. unbindAllAttributes(): void;
  530. releaseEffects(): void;
  531. dispose(): void;
  532. displayLoadingUI(): void;
  533. hideLoadingUI(): void;
  534. loadingScreen: ILoadingScreen;
  535. loadingUIText: string;
  536. loadingUIBackgroundColor: string;
  537. attachContextLostEvent(callback: ((event: WebGLContextEvent) => void)): void;
  538. attachContextRestoredEvent(callback: ((event: WebGLContextEvent) => void)): void;
  539. getVertexShaderSource(program: WebGLProgram): string;
  540. getFragmentShaderSource(program: WebGLProgram): string;
  541. getFps(): number;
  542. getDeltaTime(): number;
  543. private _measureFps();
  544. private _canRenderToFloatFramebuffer();
  545. private _canRenderToHalfFloatFramebuffer();
  546. private _canRenderToFramebuffer(type);
  547. private _getWebGLTextureType(type);
  548. private _getRGBABufferInternalSizedFormat(type);
  549. static isSupported(): boolean;
  550. }
  551. }
  552. interface Window {
  553. mozIndexedDB(func: any): any;
  554. webkitIndexedDB(func: any): any;
  555. msIndexedDB: IDBFactory;
  556. IDBTransaction(func: any): any;
  557. webkitIDBTransaction(func: any): any;
  558. msIDBTransaction(func: any): any;
  559. IDBKeyRange(func: any): any;
  560. webkitIDBKeyRange(func: any): any;
  561. msIDBKeyRange(func: any): any;
  562. webkitURL: HTMLURL;
  563. webkitRequestAnimationFrame(func: any): any;
  564. mozRequestAnimationFrame(func: any): any;
  565. oRequestAnimationFrame(func: any): any;
  566. WebGLRenderingContext: WebGLRenderingContext;
  567. MSGesture: MSGesture;
  568. CANNON: any;
  569. SIMD: any;
  570. AudioContext: AudioContext;
  571. webkitAudioContext: AudioContext;
  572. PointerEvent: any;
  573. Math: Math;
  574. Uint8Array: Uint8ArrayConstructor;
  575. Float32Array: Float32ArrayConstructor;
  576. mozURL: any;
  577. msURL: any;
  578. VRFrameData: any;
  579. }
  580. interface WebGLRenderingContext {
  581. drawArraysInstanced(mode: number, first: number, count: number, primcount: number): void;
  582. drawElementsInstanced(mode: number, count: number, type: number, offset: number, primcount: number): void;
  583. vertexAttribDivisor(index: number, divisor: number): void;
  584. createVertexArray(): any;
  585. bindVertexArray(vao: WebGLVertexArrayObject): void;
  586. deleteVertexArray(vao: WebGLVertexArrayObject): void;
  587. blitFramebuffer(srcX0: number, srcY0: number, srcX1: number, srcY1: number, dstX0: number, dstY0: number, dstX1: number, dstY1: number, mask: number, filter: number): void;
  588. renderbufferStorageMultisample(target: number, samples: number, internalformat: number, width: number, height: number): void;
  589. bindBufferBase(target: number, index: number, buffer: WebGLBuffer | null): void;
  590. getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string): number;
  591. uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: number, uniformBlockBinding: number): void;
  592. MAX_SAMPLES: number;
  593. RGBA8: number;
  594. READ_FRAMEBUFFER: number;
  595. DRAW_FRAMEBUFFER: number;
  596. UNIFORM_BUFFER: number;
  597. }
  598. interface HTMLURL {
  599. createObjectURL(param1: any, param2?: any): any;
  600. }
  601. interface Document {
  602. exitFullscreen(): void;
  603. webkitCancelFullScreen(): void;
  604. mozCancelFullScreen(): void;
  605. msCancelFullScreen(): void;
  606. mozFullScreen: boolean;
  607. msIsFullScreen: boolean;
  608. fullscreen: boolean;
  609. mozPointerLockElement: HTMLElement;
  610. msPointerLockElement: HTMLElement;
  611. webkitPointerLockElement: HTMLElement;
  612. }
  613. interface HTMLCanvasElement {
  614. requestPointerLock(): void;
  615. msRequestPointerLock?(): void;
  616. mozRequestPointerLock?(): void;
  617. webkitRequestPointerLock?(): void;
  618. }
  619. interface CanvasRenderingContext2D {
  620. imageSmoothingEnabled: boolean;
  621. mozImageSmoothingEnabled: boolean;
  622. oImageSmoothingEnabled: boolean;
  623. webkitImageSmoothingEnabled: boolean;
  624. msImageSmoothingEnabled: boolean;
  625. }
  626. interface WebGLTexture {
  627. isReady: boolean;
  628. isCube: boolean;
  629. url: string;
  630. noMipmap: boolean;
  631. samplingMode: number;
  632. references: number;
  633. generateMipMaps: boolean;
  634. samples: number;
  635. type: number;
  636. onLoadedCallbacks: Array<Function>;
  637. _size: number;
  638. _baseWidth: number;
  639. _baseHeight: number;
  640. _width: number;
  641. _height: number;
  642. _workingCanvas: HTMLCanvasElement;
  643. _workingContext: CanvasRenderingContext2D;
  644. _framebuffer: WebGLFramebuffer;
  645. _depthStencilBuffer: WebGLRenderbuffer;
  646. _MSAAFramebuffer: WebGLFramebuffer;
  647. _MSAARenderBuffer: WebGLRenderbuffer;
  648. _cachedCoordinatesMode: number;
  649. _cachedWrapU: number;
  650. _cachedWrapV: number;
  651. _isDisabled: boolean;
  652. _generateStencilBuffer: boolean;
  653. _generateDepthBuffer: boolean;
  654. }
  655. interface WebGLBuffer {
  656. references: number;
  657. capacity: number;
  658. is32Bits: boolean;
  659. }
  660. interface MouseEvent {
  661. mozMovementX: number;
  662. mozMovementY: number;
  663. webkitMovementX: number;
  664. webkitMovementY: number;
  665. msMovementX: number;
  666. msMovementY: number;
  667. }
  668. interface MSStyleCSSProperties {
  669. webkitTransform: string;
  670. webkitTransition: string;
  671. }
  672. interface Navigator {
  673. getVRDisplays: () => any;
  674. mozGetVRDevices: (any: any) => any;
  675. isCocoonJS: boolean;
  676. getUserMedia: any;
  677. webkitGetUserMedia: any;
  678. mozGetUserMedia: any;
  679. msGetUserMedia: any;
  680. }
  681. interface HTMLVideoElement {
  682. mozSrcObject: any;
  683. }
  684. interface Screen {
  685. orientation: string;
  686. mozOrientation: string;
  687. }
  688. interface HTMLMediaElement {
  689. crossOrigin: string | null;
  690. }
  691. interface Math {
  692. fround(x: number): number;
  693. imul(a: number, b: number): number;
  694. }
  695. interface SIMDglobal {
  696. SIMD: SIMD;
  697. Math: Math;
  698. Uint8Array: Uint8ArrayConstructor;
  699. Float32Array: Float32ArrayConstructor;
  700. }
  701. interface SIMD {
  702. Float32x4: SIMD.Float32x4Constructor;
  703. Int32x4: SIMD.Int32x4Constructor;
  704. Int16x8: SIMD.Int16x8Constructor;
  705. Int8x16: SIMD.Int8x16Constructor;
  706. Uint32x4: SIMD.Uint32x4Constructor;
  707. Uint16x8: SIMD.Uint16x8Constructor;
  708. Uint8x16: SIMD.Uint8x16Constructor;
  709. Bool32x4: SIMD.Bool32x4Constructor;
  710. Bool16x8: SIMD.Bool16x8Constructor;
  711. Bool8x16: SIMD.Bool8x16Constructor;
  712. }
  713. interface GamepadPose {
  714. hasOrientation: boolean;
  715. hasPosition: boolean;
  716. position?: Float32Array;
  717. linearVelocity?: Float32Array;
  718. linearAcceleration?: Float32Array;
  719. orientation?: Float32Array;
  720. angularVelocity?: Float32Array;
  721. angularAcceleration?: Float32Array;
  722. }
  723. declare namespace SIMD {
  724. interface Float32x4 {
  725. constructor: Float32x4Constructor;
  726. valueOf(): Float32x4;
  727. toLocaleString(): string;
  728. toString(): string;
  729. }
  730. interface Float32x4Constructor {
  731. (s0?: number, s1?: number, s2?: number, s3?: number): Float32x4;
  732. prototype: Float32x4;
  733. extractLane(simd: SIMD.Float32x4, lane: number): number;
  734. swizzle(a: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  735. shuffle(a: SIMD.Float32x4, b: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  736. check(a: SIMD.Float32x4): SIMD.Float32x4;
  737. splat(n: number): SIMD.Float32x4;
  738. replaceLane(simd: SIMD.Float32x4, lane: number, value: number): SIMD.Float32x4;
  739. select(selector: SIMD.Bool32x4, a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  740. equal(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  741. notEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  742. lessThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  743. lessThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  744. greaterThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  745. greaterThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  746. add(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  747. sub(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  748. mul(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  749. div(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  750. neg(a: SIMD.Float32x4): SIMD.Float32x4;
  751. abs(a: SIMD.Float32x4): SIMD.Float32x4;
  752. min(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  753. max(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  754. minNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  755. maxNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  756. reciprocalApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  757. reciprocalSqrtApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  758. sqrt(a: SIMD.Float32x4): SIMD.Float32x4;
  759. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  760. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  761. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  762. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  763. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  764. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  765. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  766. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  767. fromInt32x4(value: SIMD.Int32x4): SIMD.Float32x4;
  768. fromUint32x4(value: SIMD.Uint32x4): SIMD.Float32x4;
  769. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Float32x4;
  770. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Float32x4;
  771. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Float32x4;
  772. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Float32x4;
  773. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Float32x4;
  774. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Float32x4;
  775. }
  776. interface Int32x4 {
  777. constructor: Int32x4Constructor;
  778. valueOf(): Int32x4;
  779. toLocaleString(): string;
  780. toString(): string;
  781. }
  782. interface Int32x4Constructor {
  783. (s0?: number, s1?: number, s2?: number, s3?: number): Int32x4;
  784. prototype: Int32x4;
  785. extractLane(simd: SIMD.Int32x4, lane: number): number;
  786. swizzle(a: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  787. shuffle(a: SIMD.Int32x4, b: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  788. check(a: SIMD.Int32x4): SIMD.Int32x4;
  789. splat(n: number): SIMD.Int32x4;
  790. replaceLane(simd: SIMD.Int32x4, lane: number, value: number): SIMD.Int32x4;
  791. select(selector: SIMD.Bool32x4, a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  792. equal(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  793. notEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  794. lessThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  795. lessThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  796. greaterThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  797. greaterThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  798. and(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  799. or(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  800. xor(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  801. not(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  802. add(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  803. sub(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  804. mul(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  805. neg(a: SIMD.Int32x4): SIMD.Int32x4;
  806. shiftLeftByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  807. shiftRightByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  808. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  809. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  810. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  811. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  812. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  813. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  814. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  815. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  816. fromFloat32x4(value: SIMD.Float32x4): SIMD.Int32x4;
  817. fromUint32x4(value: SIMD.Uint32x4): SIMD.Int32x4;
  818. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int32x4;
  819. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int32x4;
  820. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int32x4;
  821. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int32x4;
  822. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int32x4;
  823. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int32x4;
  824. }
  825. interface Int16x8 {
  826. constructor: Int16x8Constructor;
  827. valueOf(): Int16x8;
  828. toLocaleString(): string;
  829. toString(): string;
  830. }
  831. interface Int16x8Constructor {
  832. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Int16x8;
  833. prototype: Int16x8;
  834. extractLane(simd: SIMD.Int16x8, lane: number): number;
  835. swizzle(a: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  836. 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;
  837. check(a: SIMD.Int16x8): SIMD.Int16x8;
  838. splat(n: number): SIMD.Int16x8;
  839. replaceLane(simd: SIMD.Int16x8, lane: number, value: number): SIMD.Int16x8;
  840. select(selector: SIMD.Bool16x8, a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  841. equal(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  842. notEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  843. lessThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  844. lessThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  845. greaterThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  846. greaterThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  847. and(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  848. or(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  849. xor(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  850. not(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  851. add(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  852. sub(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  853. mul(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  854. neg(a: SIMD.Int16x8): SIMD.Int16x8;
  855. shiftLeftByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  856. shiftRightByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  857. addSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  858. subSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  859. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int16x8;
  860. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int16x8): SIMD.Int16x8;
  861. fromUint16x8(value: SIMD.Uint16x8): SIMD.Int16x8;
  862. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int16x8;
  863. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int16x8;
  864. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int16x8;
  865. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int16x8;
  866. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int16x8;
  867. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int16x8;
  868. }
  869. interface Int8x16 {
  870. constructor: Int8x16Constructor;
  871. valueOf(): Int8x16;
  872. toLocaleString(): string;
  873. toString(): string;
  874. }
  875. interface Int8x16Constructor {
  876. (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;
  877. prototype: Int8x16;
  878. extractLane(simd: SIMD.Int8x16, lane: number): number;
  879. 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;
  880. 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;
  881. check(a: SIMD.Int8x16): SIMD.Int8x16;
  882. splat(n: number): SIMD.Int8x16;
  883. replaceLane(simd: SIMD.Int8x16, lane: number, value: number): SIMD.Int8x16;
  884. select(selector: SIMD.Bool8x16, a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  885. equal(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  886. notEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  887. lessThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  888. lessThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  889. greaterThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  890. greaterThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  891. and(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  892. or(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  893. xor(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  894. not(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  895. add(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  896. sub(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  897. mul(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  898. neg(a: SIMD.Int8x16): SIMD.Int8x16;
  899. shiftLeftByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  900. shiftRightByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  901. addSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  902. subSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  903. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int8x16;
  904. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int8x16): SIMD.Int8x16;
  905. fromUint8x16(value: SIMD.Uint8x16): SIMD.Int8x16;
  906. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int8x16;
  907. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int8x16;
  908. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int8x16;
  909. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int8x16;
  910. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int8x16;
  911. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int8x16;
  912. }
  913. interface Uint32x4 {
  914. constructor: Uint32x4Constructor;
  915. valueOf(): Uint32x4;
  916. toLocaleString(): string;
  917. toString(): string;
  918. }
  919. interface Uint32x4Constructor {
  920. (s0?: number, s1?: number, s2?: number, s3?: number): Uint32x4;
  921. prototype: Uint32x4;
  922. extractLane(simd: SIMD.Uint32x4, lane: number): number;
  923. swizzle(a: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  924. shuffle(a: SIMD.Uint32x4, b: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  925. check(a: SIMD.Uint32x4): SIMD.Uint32x4;
  926. splat(n: number): SIMD.Uint32x4;
  927. replaceLane(simd: SIMD.Uint32x4, lane: number, value: number): SIMD.Uint32x4;
  928. select(selector: SIMD.Bool32x4, a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  929. equal(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  930. notEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  931. lessThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  932. lessThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  933. greaterThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  934. greaterThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  935. and(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  936. or(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  937. xor(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  938. not(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  939. add(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  940. sub(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  941. mul(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  942. shiftLeftByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  943. shiftRightByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  944. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  945. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  946. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  947. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  948. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  949. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  950. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  951. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  952. fromFloat32x4(value: SIMD.Float32x4): SIMD.Uint32x4;
  953. fromInt32x4(value: SIMD.Int32x4): SIMD.Uint32x4;
  954. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint32x4;
  955. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint32x4;
  956. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint32x4;
  957. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint32x4;
  958. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint32x4;
  959. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint32x4;
  960. }
  961. interface Uint16x8 {
  962. constructor: Uint16x8Constructor;
  963. valueOf(): Uint16x8;
  964. toLocaleString(): string;
  965. toString(): string;
  966. }
  967. interface Uint16x8Constructor {
  968. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Uint16x8;
  969. prototype: Uint16x8;
  970. extractLane(simd: SIMD.Uint16x8, lane: number): number;
  971. swizzle(a: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  972. 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;
  973. check(a: SIMD.Uint16x8): SIMD.Uint16x8;
  974. splat(n: number): SIMD.Uint16x8;
  975. replaceLane(simd: SIMD.Uint16x8, lane: number, value: number): SIMD.Uint16x8;
  976. select(selector: SIMD.Bool16x8, a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  977. equal(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  978. notEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  979. lessThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  980. lessThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  981. greaterThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  982. greaterThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  983. and(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  984. or(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  985. xor(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  986. not(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  987. add(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  988. sub(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  989. mul(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  990. shiftLeftByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  991. shiftRightByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  992. addSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  993. subSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  994. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint16x8;
  995. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint16x8): SIMD.Uint16x8;
  996. fromInt16x8(value: SIMD.Int16x8): SIMD.Uint16x8;
  997. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint16x8;
  998. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint16x8;
  999. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint16x8;
  1000. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint16x8;
  1001. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint16x8;
  1002. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint16x8;
  1003. }
  1004. interface Uint8x16 {
  1005. constructor: Uint8x16Constructor;
  1006. valueOf(): Uint8x16;
  1007. toLocaleString(): string;
  1008. toString(): string;
  1009. }
  1010. interface Uint8x16Constructor {
  1011. (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;
  1012. prototype: Uint8x16;
  1013. extractLane(simd: SIMD.Uint8x16, lane: number): number;
  1014. 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;
  1015. 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;
  1016. check(a: SIMD.Uint8x16): SIMD.Uint8x16;
  1017. splat(n: number): SIMD.Uint8x16;
  1018. replaceLane(simd: SIMD.Uint8x16, lane: number, value: number): SIMD.Uint8x16;
  1019. select(selector: SIMD.Bool8x16, a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  1020. equal(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  1021. notEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  1022. lessThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  1023. lessThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  1024. greaterThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  1025. greaterThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  1026. and(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  1027. or(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  1028. xor(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  1029. not(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  1030. add(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  1031. sub(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  1032. mul(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  1033. shiftLeftByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  1034. shiftRightByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  1035. addSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  1036. subSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  1037. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint8x16;
  1038. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint8x16): SIMD.Uint8x16;
  1039. fromInt8x16(value: SIMD.Int8x16): SIMD.Uint8x16;
  1040. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint8x16;
  1041. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint8x16;
  1042. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint8x16;
  1043. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint8x16;
  1044. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint8x16;
  1045. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint8x16;
  1046. }
  1047. interface Bool32x4 {
  1048. constructor: Bool32x4Constructor;
  1049. valueOf(): Bool32x4;
  1050. toLocaleString(): string;
  1051. toString(): string;
  1052. }
  1053. interface Bool32x4Constructor {
  1054. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean): Bool32x4;
  1055. prototype: Bool32x4;
  1056. extractLane(simd: SIMD.Bool32x4, lane: number): boolean;
  1057. check(a: SIMD.Bool32x4): SIMD.Bool32x4;
  1058. splat(n: boolean): SIMD.Bool32x4;
  1059. replaceLane(simd: SIMD.Bool32x4, lane: number, value: boolean): SIMD.Bool32x4;
  1060. allTrue(a: SIMD.Bool32x4): boolean;
  1061. anyTrue(a: SIMD.Bool32x4): boolean;
  1062. and(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  1063. or(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  1064. xor(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  1065. not(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  1066. }
  1067. interface Bool16x8 {
  1068. constructor: Bool16x8Constructor;
  1069. valueOf(): Bool16x8;
  1070. toLocaleString(): string;
  1071. toString(): string;
  1072. }
  1073. interface Bool16x8Constructor {
  1074. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean): Bool16x8;
  1075. prototype: Bool16x8;
  1076. extractLane(simd: SIMD.Bool16x8, lane: number): boolean;
  1077. check(a: SIMD.Bool16x8): SIMD.Bool16x8;
  1078. splat(n: boolean): SIMD.Bool16x8;
  1079. replaceLane(simd: SIMD.Bool16x8, lane: number, value: boolean): SIMD.Bool16x8;
  1080. allTrue(a: SIMD.Bool16x8): boolean;
  1081. anyTrue(a: SIMD.Bool16x8): boolean;
  1082. and(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  1083. or(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  1084. xor(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  1085. not(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  1086. }
  1087. interface Bool8x16 {
  1088. constructor: Bool8x16Constructor;
  1089. valueOf(): Bool8x16;
  1090. toLocaleString(): string;
  1091. toString(): string;
  1092. }
  1093. interface Bool8x16Constructor {
  1094. (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;
  1095. prototype: Bool8x16;
  1096. extractLane(simd: SIMD.Bool8x16, lane: number): boolean;
  1097. check(a: SIMD.Bool8x16): SIMD.Bool8x16;
  1098. splat(n: boolean): SIMD.Bool8x16;
  1099. replaceLane(simd: SIMD.Bool8x16, lane: number, value: boolean): SIMD.Bool8x16;
  1100. allTrue(a: SIMD.Bool8x16): boolean;
  1101. anyTrue(a: SIMD.Bool8x16): boolean;
  1102. and(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  1103. or(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  1104. xor(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  1105. not(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  1106. }
  1107. }
  1108. declare module BABYLON {
  1109. /**
  1110. * Node is the basic class for all scene objects (Mesh, Light Camera).
  1111. */
  1112. class Node {
  1113. name: string;
  1114. id: string;
  1115. uniqueId: number;
  1116. state: string;
  1117. metadata: any;
  1118. doNotSerialize: boolean;
  1119. animations: Animation[];
  1120. private _ranges;
  1121. onReady: (node: Node) => void;
  1122. private _childrenFlag;
  1123. private _isEnabled;
  1124. private _isReady;
  1125. _currentRenderId: number;
  1126. private _parentRenderId;
  1127. _waitingParentId: string;
  1128. private _scene;
  1129. _cache: any;
  1130. private _parentNode;
  1131. private _children;
  1132. parent: Node;
  1133. getClassName(): string;
  1134. /**
  1135. * An event triggered when the mesh is disposed.
  1136. * @type {BABYLON.Observable}
  1137. */
  1138. onDisposeObservable: Observable<Node>;
  1139. private _onDisposeObserver;
  1140. onDispose: () => void;
  1141. /**
  1142. * @constructor
  1143. * @param {string} name - the name and id to be given to this node
  1144. * @param {BABYLON.Scene} the scene this node will be added to
  1145. */
  1146. constructor(name: string, scene: Scene);
  1147. getScene(): Scene;
  1148. getEngine(): Engine;
  1149. getWorldMatrix(): Matrix;
  1150. _initCache(): void;
  1151. updateCache(force?: boolean): void;
  1152. _updateCache(ignoreParentClass?: boolean): void;
  1153. _isSynchronized(): boolean;
  1154. _markSyncedWithParent(): void;
  1155. isSynchronizedWithParent(): boolean;
  1156. isSynchronized(updateCache?: boolean): boolean;
  1157. hasNewParent(update?: boolean): boolean;
  1158. /**
  1159. * Is this node ready to be used/rendered
  1160. * @return {boolean} is it ready
  1161. */
  1162. isReady(): boolean;
  1163. /**
  1164. * Is this node enabled.
  1165. * If the node has a parent and is enabled, the parent will be inspected as well.
  1166. * @return {boolean} whether this node (and its parent) is enabled.
  1167. * @see setEnabled
  1168. */
  1169. isEnabled(): boolean;
  1170. /**
  1171. * Set the enabled state of this node.
  1172. * @param {boolean} value - the new enabled state
  1173. * @see isEnabled
  1174. */
  1175. setEnabled(value: boolean): void;
  1176. /**
  1177. * Is this node a descendant of the given node.
  1178. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
  1179. * @param {BABYLON.Node} ancestor - The parent node to inspect
  1180. * @see parent
  1181. */
  1182. isDescendantOf(ancestor: Node): boolean;
  1183. /**
  1184. * Evaluate the list of children and determine if they should be considered as descendants considering the given criterias
  1185. * @param {BABYLON.Node[]} results the result array containing the nodes matching the given criterias
  1186. * @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.
  1187. * @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.
  1188. */
  1189. _getDescendants(results: Node[], directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): void;
  1190. /**
  1191. * Will return all nodes that have this node as ascendant.
  1192. * @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.
  1193. * @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.
  1194. * @return {BABYLON.Node[]} all children nodes of all types.
  1195. */
  1196. getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];
  1197. /**
  1198. * Get all child-meshes of this node.
  1199. */
  1200. getChildMeshes(directDecendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];
  1201. /**
  1202. * Get all direct children of this node.
  1203. */
  1204. getChildren(predicate?: (node: Node) => boolean): Node[];
  1205. _setReady(state: boolean): void;
  1206. getAnimationByName(name: string): Animation;
  1207. createAnimationRange(name: string, from: number, to: number): void;
  1208. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  1209. getAnimationRange(name: string): AnimationRange;
  1210. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void;
  1211. serializeAnimationRanges(): any;
  1212. dispose(): void;
  1213. static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void;
  1214. }
  1215. }
  1216. declare module BABYLON {
  1217. interface IDisposable {
  1218. dispose(): void;
  1219. }
  1220. class PointerEventTypes {
  1221. static _POINTERDOWN: number;
  1222. static _POINTERUP: number;
  1223. static _POINTERMOVE: number;
  1224. static _POINTERWHEEL: number;
  1225. static _POINTERPICK: number;
  1226. static _POINTERTAP: number;
  1227. static _POINTERDOUBLETAP: number;
  1228. static readonly POINTERDOWN: number;
  1229. static readonly POINTERUP: number;
  1230. static readonly POINTERMOVE: number;
  1231. static readonly POINTERWHEEL: number;
  1232. static readonly POINTERPICK: number;
  1233. static readonly POINTERTAP: number;
  1234. static readonly POINTERDOUBLETAP: number;
  1235. }
  1236. class PointerInfoBase {
  1237. type: number;
  1238. event: PointerEvent | MouseWheelEvent;
  1239. constructor(type: number, event: PointerEvent | MouseWheelEvent);
  1240. }
  1241. /**
  1242. * This class is used to store pointer related info for the onPrePointerObservable event.
  1243. * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
  1244. */
  1245. class PointerInfoPre extends PointerInfoBase {
  1246. constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: any, localY: any);
  1247. localPosition: Vector2;
  1248. skipOnPointerObservable: boolean;
  1249. }
  1250. /**
  1251. * This type contains all the data related to a pointer event in Babylon.js.
  1252. * 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.
  1253. */
  1254. class PointerInfo extends PointerInfoBase {
  1255. pickInfo: PickingInfo;
  1256. constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: PickingInfo);
  1257. }
  1258. /**
  1259. * This class is used by the onRenderingGroupObservable
  1260. */
  1261. class RenderingGroupInfo {
  1262. /**
  1263. * The Scene that being rendered
  1264. */
  1265. scene: Scene;
  1266. /**
  1267. * The camera currently used for the rendering pass
  1268. */
  1269. camera: Camera;
  1270. /**
  1271. * The ID of the renderingGroup being processed
  1272. */
  1273. renderingGroupId: number;
  1274. /**
  1275. * The rendering stage, can be either STAGE_PRECLEAR, STAGE_PREOPAQUE, STAGE_PRETRANSPARENT, STAGE_POSTTRANSPARENT
  1276. */
  1277. renderStage: number;
  1278. /**
  1279. * Stage corresponding to the very first hook in the renderingGroup phase: before the render buffer may be cleared
  1280. * This stage will be fired no matter what
  1281. */
  1282. static STAGE_PRECLEAR: number;
  1283. /**
  1284. * Called before opaque object are rendered.
  1285. * This stage will be fired only if there's 3D Opaque content to render
  1286. */
  1287. static STAGE_PREOPAQUE: number;
  1288. /**
  1289. * Called after the opaque objects are rendered and before the transparent ones
  1290. * This stage will be fired only if there's 3D transparent content to render
  1291. */
  1292. static STAGE_PRETRANSPARENT: number;
  1293. /**
  1294. * Called after the transparent object are rendered, last hook of the renderingGroup phase
  1295. * This stage will be fired no matter what
  1296. */
  1297. static STAGE_POSTTRANSPARENT: number;
  1298. }
  1299. /**
  1300. * Represents a scene to be rendered by the engine.
  1301. * @see http://doc.babylonjs.com/page.php?p=21911
  1302. */
  1303. class Scene implements IAnimatable {
  1304. private static _FOGMODE_NONE;
  1305. private static _FOGMODE_EXP;
  1306. private static _FOGMODE_EXP2;
  1307. private static _FOGMODE_LINEAR;
  1308. static MinDeltaTime: number;
  1309. static MaxDeltaTime: number;
  1310. static readonly FOGMODE_NONE: number;
  1311. static readonly FOGMODE_EXP: number;
  1312. static readonly FOGMODE_EXP2: number;
  1313. static readonly FOGMODE_LINEAR: number;
  1314. autoClear: boolean;
  1315. clearColor: Color4;
  1316. ambientColor: Color3;
  1317. forceWireframe: boolean;
  1318. private _forcePointsCloud;
  1319. forcePointsCloud: boolean;
  1320. forceShowBoundingBoxes: boolean;
  1321. clipPlane: Plane;
  1322. animationsEnabled: boolean;
  1323. constantlyUpdateMeshUnderPointer: boolean;
  1324. useRightHandedSystem: boolean;
  1325. hoverCursor: string;
  1326. metadata: any;
  1327. /**
  1328. * An event triggered when the scene is disposed.
  1329. * @type {BABYLON.Observable}
  1330. */
  1331. onDisposeObservable: Observable<Scene>;
  1332. private _onDisposeObserver;
  1333. onDispose: () => void;
  1334. /**
  1335. * An event triggered before rendering the scene
  1336. * @type {BABYLON.Observable}
  1337. */
  1338. onBeforeRenderObservable: Observable<Scene>;
  1339. private _onBeforeRenderObserver;
  1340. beforeRender: () => void;
  1341. /**
  1342. * An event triggered after rendering the scene
  1343. * @type {BABYLON.Observable}
  1344. */
  1345. onAfterRenderObservable: Observable<Scene>;
  1346. private _onAfterRenderObserver;
  1347. afterRender: () => void;
  1348. /**
  1349. * An event triggered when the scene is ready
  1350. * @type {BABYLON.Observable}
  1351. */
  1352. onReadyObservable: Observable<Scene>;
  1353. /**
  1354. * An event triggered before rendering a camera
  1355. * @type {BABYLON.Observable}
  1356. */
  1357. onBeforeCameraRenderObservable: Observable<Camera>;
  1358. private _onBeforeCameraRenderObserver;
  1359. beforeCameraRender: () => void;
  1360. /**
  1361. * An event triggered after rendering a camera
  1362. * @type {BABYLON.Observable}
  1363. */
  1364. onAfterCameraRenderObservable: Observable<Camera>;
  1365. private _onAfterCameraRenderObserver;
  1366. afterCameraRender: () => void;
  1367. /**
  1368. * An event triggered when a camera is created
  1369. * @type {BABYLON.Observable}
  1370. */
  1371. onNewCameraAddedObservable: Observable<Camera>;
  1372. /**
  1373. * An event triggered when a camera is removed
  1374. * @type {BABYLON.Observable}
  1375. */
  1376. onCameraRemovedObservable: Observable<Camera>;
  1377. /**
  1378. * An event triggered when a light is created
  1379. * @type {BABYLON.Observable}
  1380. */
  1381. onNewLightAddedObservable: Observable<Light>;
  1382. /**
  1383. * An event triggered when a light is removed
  1384. * @type {BABYLON.Observable}
  1385. */
  1386. onLightRemovedObservable: Observable<Light>;
  1387. /**
  1388. * An event triggered when a geometry is created
  1389. * @type {BABYLON.Observable}
  1390. */
  1391. onNewGeometryAddedObservable: Observable<Geometry>;
  1392. /**
  1393. * An event triggered when a geometry is removed
  1394. * @type {BABYLON.Observable}
  1395. */
  1396. onGeometryRemovedObservable: Observable<Geometry>;
  1397. /**
  1398. * An event triggered when a mesh is created
  1399. * @type {BABYLON.Observable}
  1400. */
  1401. onNewMeshAddedObservable: Observable<AbstractMesh>;
  1402. /**
  1403. * An event triggered when a mesh is removed
  1404. * @type {BABYLON.Observable}
  1405. */
  1406. onMeshRemovedObservable: Observable<AbstractMesh>;
  1407. /**
  1408. * This Observable will be triggered for each stage of each renderingGroup of each rendered camera.
  1409. * The RenderinGroupInfo class contains all the information about the context in which the observable is called
  1410. * 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)
  1411. */
  1412. onRenderingGroupObservable: Observable<RenderingGroupInfo>;
  1413. animations: Animation[];
  1414. pointerDownPredicate: (Mesh: AbstractMesh) => boolean;
  1415. pointerUpPredicate: (Mesh: AbstractMesh) => boolean;
  1416. pointerMovePredicate: (Mesh: AbstractMesh) => boolean;
  1417. private _onPointerMove;
  1418. private _onPointerDown;
  1419. private _onPointerUp;
  1420. onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1421. onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1422. onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1423. onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1424. /**
  1425. * 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).
  1426. * You have the possibility to skip the 3D Engine process and the call to onPointerObservable by setting PointerInfoBase.skipOnPointerObservable to true
  1427. */
  1428. onPrePointerObservable: Observable<PointerInfoPre>;
  1429. /**
  1430. * Observable event triggered each time an input event is received from the rendering canvas
  1431. */
  1432. onPointerObservable: Observable<PointerInfo>;
  1433. readonly unTranslatedPointer: Vector2;
  1434. static DragMovementThreshold: number;
  1435. static LongPressDelay: number;
  1436. static DoubleClickDelay: number;
  1437. static ExclusiveDoubleClickMode: boolean;
  1438. private _initClickEvent;
  1439. private _initActionManager;
  1440. private _delayedSimpleClick;
  1441. private _delayedSimpleClickTimeout;
  1442. private _previousDelayedSimpleClickTimeout;
  1443. private _meshPickProceed;
  1444. private _previousButtonPressed;
  1445. private _previousHasSwiped;
  1446. private _currentPickResult;
  1447. private _previousPickResult;
  1448. private _isButtonPressed;
  1449. private _doubleClickOccured;
  1450. cameraToUseForPointers: Camera;
  1451. private _pointerX;
  1452. private _pointerY;
  1453. private _unTranslatedPointerX;
  1454. private _unTranslatedPointerY;
  1455. private _startingPointerPosition;
  1456. private _previousStartingPointerPosition;
  1457. private _startingPointerTime;
  1458. private _previousStartingPointerTime;
  1459. _mirroredCameraPosition: Vector3;
  1460. private _onKeyDown;
  1461. private _onKeyUp;
  1462. /**
  1463. * is fog enabled on this scene.
  1464. * @type {boolean}
  1465. */
  1466. private _fogEnabled;
  1467. fogEnabled: boolean;
  1468. private _fogMode;
  1469. fogMode: number;
  1470. fogColor: Color3;
  1471. fogDensity: number;
  1472. fogStart: number;
  1473. fogEnd: number;
  1474. /**
  1475. * is shadow enabled on this scene.
  1476. * @type {boolean}
  1477. */
  1478. private _shadowsEnabled;
  1479. shadowsEnabled: boolean;
  1480. /**
  1481. * is light enabled on this scene.
  1482. * @type {boolean}
  1483. */
  1484. private _lightsEnabled;
  1485. lightsEnabled: boolean;
  1486. /**
  1487. * All of the lights added to this scene.
  1488. * @see BABYLON.Light
  1489. * @type {BABYLON.Light[]}
  1490. */
  1491. lights: Light[];
  1492. /**
  1493. * All of the cameras added to this scene.
  1494. * @see BABYLON.Camera
  1495. * @type {BABYLON.Camera[]}
  1496. */
  1497. cameras: Camera[];
  1498. activeCameras: Camera[];
  1499. activeCamera: Camera;
  1500. /**
  1501. * All of the (abstract) meshes added to this scene.
  1502. * @see BABYLON.AbstractMesh
  1503. * @type {BABYLON.AbstractMesh[]}
  1504. */
  1505. meshes: AbstractMesh[];
  1506. private _geometries;
  1507. materials: Material[];
  1508. multiMaterials: MultiMaterial[];
  1509. private _defaultMaterial;
  1510. defaultMaterial: Material;
  1511. private _texturesEnabled;
  1512. texturesEnabled: boolean;
  1513. textures: BaseTexture[];
  1514. particlesEnabled: boolean;
  1515. particleSystems: ParticleSystem[];
  1516. spritesEnabled: boolean;
  1517. spriteManagers: SpriteManager[];
  1518. layers: Layer[];
  1519. highlightLayers: HighlightLayer[];
  1520. private _skeletonsEnabled;
  1521. skeletonsEnabled: boolean;
  1522. skeletons: Skeleton[];
  1523. morphTargetManagers: MorphTargetManager[];
  1524. lensFlaresEnabled: boolean;
  1525. lensFlareSystems: LensFlareSystem[];
  1526. collisionsEnabled: boolean;
  1527. private _workerCollisions;
  1528. collisionCoordinator: ICollisionCoordinator;
  1529. gravity: Vector3;
  1530. postProcessesEnabled: boolean;
  1531. postProcessManager: PostProcessManager;
  1532. private _postProcessRenderPipelineManager;
  1533. readonly postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
  1534. renderTargetsEnabled: boolean;
  1535. dumpNextRenderTargets: boolean;
  1536. customRenderTargets: RenderTargetTexture[];
  1537. useDelayedTextureLoading: boolean;
  1538. importedMeshesFiles: String[];
  1539. probesEnabled: boolean;
  1540. reflectionProbes: ReflectionProbe[];
  1541. database: any;
  1542. /**
  1543. * This scene's action manager
  1544. * @type {BABYLON.ActionManager}
  1545. */
  1546. actionManager: ActionManager;
  1547. _actionManagers: ActionManager[];
  1548. private _meshesForIntersections;
  1549. proceduralTexturesEnabled: boolean;
  1550. _proceduralTextures: ProceduralTexture[];
  1551. mainSoundTrack: SoundTrack;
  1552. soundTracks: SoundTrack[];
  1553. private _audioEnabled;
  1554. private _headphone;
  1555. simplificationQueue: SimplificationQueue;
  1556. private _engine;
  1557. private _totalMeshesCounter;
  1558. private _totalLightsCounter;
  1559. private _totalMaterialsCounter;
  1560. private _totalTexturesCounter;
  1561. private _totalVertices;
  1562. _activeIndices: PerfCounter;
  1563. _activeParticles: PerfCounter;
  1564. private _lastFrameDuration;
  1565. private _evaluateActiveMeshesDuration;
  1566. private _renderTargetsDuration;
  1567. _particlesDuration: PerfCounter;
  1568. private _renderDuration;
  1569. _spritesDuration: PerfCounter;
  1570. _activeBones: PerfCounter;
  1571. private _animationRatio;
  1572. private _animationTimeLast;
  1573. private _animationTime;
  1574. animationTimeScale: number;
  1575. _cachedMaterial: Material;
  1576. _cachedEffect: Effect;
  1577. _cachedVisibility: number;
  1578. private _renderId;
  1579. private _executeWhenReadyTimeoutId;
  1580. private _intermediateRendering;
  1581. private _viewUpdateFlag;
  1582. private _projectionUpdateFlag;
  1583. _toBeDisposed: SmartArray<IDisposable>;
  1584. private _pendingData;
  1585. private _activeMeshes;
  1586. private _processedMaterials;
  1587. private _renderTargets;
  1588. _activeParticleSystems: SmartArray<ParticleSystem>;
  1589. private _activeSkeletons;
  1590. private _softwareSkinnedMeshes;
  1591. private _renderingManager;
  1592. private _physicsEngine;
  1593. _activeAnimatables: Animatable[];
  1594. private _transformMatrix;
  1595. private _sceneUbo;
  1596. private _pickWithRayInverseMatrix;
  1597. private _edgesRenderers;
  1598. private _boundingBoxRenderer;
  1599. private _outlineRenderer;
  1600. private _viewMatrix;
  1601. private _projectionMatrix;
  1602. private _frustumPlanes;
  1603. readonly frustumPlanes: Plane[];
  1604. private _selectionOctree;
  1605. private _pointerOverMesh;
  1606. private _pointerOverSprite;
  1607. private _debugLayer;
  1608. private _depthRenderer;
  1609. private _uniqueIdCounter;
  1610. private _pickedDownMesh;
  1611. private _pickedUpMesh;
  1612. private _pickedDownSprite;
  1613. private _externalData;
  1614. private _uid;
  1615. offscreenRenderTarget: RenderTargetTexture;
  1616. /**
  1617. * @constructor
  1618. * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
  1619. */
  1620. constructor(engine: Engine);
  1621. readonly debugLayer: DebugLayer;
  1622. workerCollisions: boolean;
  1623. readonly selectionOctree: Octree<AbstractMesh>;
  1624. /**
  1625. * The mesh that is currently under the pointer.
  1626. * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
  1627. */
  1628. readonly meshUnderPointer: AbstractMesh;
  1629. /**
  1630. * Current on-screen X position of the pointer
  1631. * @return {number} X position of the pointer
  1632. */
  1633. readonly pointerX: number;
  1634. /**
  1635. * Current on-screen Y position of the pointer
  1636. * @return {number} Y position of the pointer
  1637. */
  1638. readonly pointerY: number;
  1639. getCachedMaterial(): Material;
  1640. getCachedEffect(): Effect;
  1641. getCachedVisibility(): number;
  1642. isCachedMaterialValid(material: Material, effect: Effect, visibility?: number): boolean;
  1643. getBoundingBoxRenderer(): BoundingBoxRenderer;
  1644. getOutlineRenderer(): OutlineRenderer;
  1645. getEngine(): Engine;
  1646. getTotalVertices(): number;
  1647. readonly totalVerticesPerfCounter: PerfCounter;
  1648. getActiveIndices(): number;
  1649. readonly totalActiveIndicesPerfCounter: PerfCounter;
  1650. getActiveParticles(): number;
  1651. readonly activeParticlesPerfCounter: PerfCounter;
  1652. getActiveBones(): number;
  1653. readonly activeBonesPerfCounter: PerfCounter;
  1654. getLastFrameDuration(): number;
  1655. readonly lastFramePerfCounter: PerfCounter;
  1656. getEvaluateActiveMeshesDuration(): number;
  1657. readonly evaluateActiveMeshesDurationPerfCounter: PerfCounter;
  1658. getActiveMeshes(): SmartArray<Mesh>;
  1659. getRenderTargetsDuration(): number;
  1660. getRenderDuration(): number;
  1661. readonly renderDurationPerfCounter: PerfCounter;
  1662. getParticlesDuration(): number;
  1663. readonly particlesDurationPerfCounter: PerfCounter;
  1664. getSpritesDuration(): number;
  1665. readonly spriteDuractionPerfCounter: PerfCounter;
  1666. getAnimationRatio(): number;
  1667. getRenderId(): number;
  1668. incrementRenderId(): void;
  1669. private _updatePointerPosition(evt);
  1670. private _createUbo();
  1671. /**
  1672. * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
  1673. * @param attachUp defines if you want to attach events to pointerup
  1674. * @param attachDown defines if you want to attach events to pointerdown
  1675. * @param attachMove defines if you want to attach events to pointermove
  1676. */
  1677. attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean): void;
  1678. detachControl(): void;
  1679. isReady(): boolean;
  1680. resetCachedMaterial(): void;
  1681. registerBeforeRender(func: () => void): void;
  1682. unregisterBeforeRender(func: () => void): void;
  1683. registerAfterRender(func: () => void): void;
  1684. unregisterAfterRender(func: () => void): void;
  1685. _addPendingData(data: any): void;
  1686. _removePendingData(data: any): void;
  1687. getWaitingItemsCount(): number;
  1688. /**
  1689. * Registers a function to be executed when the scene is ready.
  1690. * @param {Function} func - the function to be executed.
  1691. */
  1692. executeWhenReady(func: () => void): void;
  1693. _checkIsReady(): void;
  1694. /**
  1695. * Will start the animation sequence of a given target
  1696. * @param target - the target
  1697. * @param {number} from - from which frame should animation start
  1698. * @param {number} to - till which frame should animation run.
  1699. * @param {boolean} [loop] - should the animation loop
  1700. * @param {number} [speedRatio] - the speed in which to run the animation
  1701. * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
  1702. * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
  1703. * @return {BABYLON.Animatable} the animatable object created for this animation
  1704. * @see BABYLON.Animatable
  1705. * @see http://doc.babylonjs.com/page.php?p=22081
  1706. */
  1707. beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
  1708. beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  1709. getAnimatableByTarget(target: any): Animatable;
  1710. readonly Animatables: Animatable[];
  1711. /**
  1712. * Will stop the animation of the given target
  1713. * @param target - the target
  1714. * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
  1715. * @see beginAnimation
  1716. */
  1717. stopAnimation(target: any, animationName?: string): void;
  1718. private _animate();
  1719. getViewMatrix(): Matrix;
  1720. getProjectionMatrix(): Matrix;
  1721. getTransformMatrix(): Matrix;
  1722. setTransformMatrix(view: Matrix, projection: Matrix): void;
  1723. getSceneUniformBuffer(): UniformBuffer;
  1724. getUniqueId(): number;
  1725. addMesh(newMesh: AbstractMesh): void;
  1726. removeMesh(toRemove: AbstractMesh): number;
  1727. removeSkeleton(toRemove: Skeleton): number;
  1728. removeMorphTargetManager(toRemove: MorphTargetManager): number;
  1729. removeLight(toRemove: Light): number;
  1730. removeCamera(toRemove: Camera): number;
  1731. addLight(newLight: Light): void;
  1732. addCamera(newCamera: Camera): void;
  1733. /**
  1734. * Switch active camera
  1735. * @param {Camera} newCamera - new active camera
  1736. * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
  1737. */
  1738. switchActiveCamera(newCamera: Camera, attachControl?: boolean): void;
  1739. /**
  1740. * sets the active camera of the scene using its ID
  1741. * @param {string} id - the camera's ID
  1742. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1743. * @see activeCamera
  1744. */
  1745. setActiveCameraByID(id: string): Camera;
  1746. /**
  1747. * sets the active camera of the scene using its name
  1748. * @param {string} name - the camera's name
  1749. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1750. * @see activeCamera
  1751. */
  1752. setActiveCameraByName(name: string): Camera;
  1753. /**
  1754. * get a material using its id
  1755. * @param {string} the material's ID
  1756. * @return {BABYLON.Material|null} the material or null if none found.
  1757. */
  1758. getMaterialByID(id: string): Material;
  1759. /**
  1760. * get a material using its name
  1761. * @param {string} the material's name
  1762. * @return {BABYLON.Material|null} the material or null if none found.
  1763. */
  1764. getMaterialByName(name: string): Material;
  1765. getLensFlareSystemByName(name: string): LensFlareSystem;
  1766. getLensFlareSystemByID(id: string): LensFlareSystem;
  1767. getCameraByID(id: string): Camera;
  1768. getCameraByUniqueID(uniqueId: number): Camera;
  1769. /**
  1770. * get a camera using its name
  1771. * @param {string} the camera's name
  1772. * @return {BABYLON.Camera|null} the camera or null if none found.
  1773. */
  1774. getCameraByName(name: string): Camera;
  1775. /**
  1776. * get a bone using its id
  1777. * @param {string} the bone's id
  1778. * @return {BABYLON.Bone|null} the bone or null if not found
  1779. */
  1780. getBoneByID(id: string): Bone;
  1781. /**
  1782. * get a bone using its id
  1783. * @param {string} the bone's name
  1784. * @return {BABYLON.Bone|null} the bone or null if not found
  1785. */
  1786. getBoneByName(name: string): Bone;
  1787. /**
  1788. * get a light node using its name
  1789. * @param {string} the light's name
  1790. * @return {BABYLON.Light|null} the light or null if none found.
  1791. */
  1792. getLightByName(name: string): Light;
  1793. /**
  1794. * get a light node using its ID
  1795. * @param {string} the light's id
  1796. * @return {BABYLON.Light|null} the light or null if none found.
  1797. */
  1798. getLightByID(id: string): Light;
  1799. /**
  1800. * get a light node using its scene-generated unique ID
  1801. * @param {number} the light's unique id
  1802. * @return {BABYLON.Light|null} the light or null if none found.
  1803. */
  1804. getLightByUniqueID(uniqueId: number): Light;
  1805. /**
  1806. * get a particle system by id
  1807. * @param id {number} the particle system id
  1808. * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found.
  1809. */
  1810. getParticleSystemByID(id: string): ParticleSystem;
  1811. /**
  1812. * get a geometry using its ID
  1813. * @param {string} the geometry's id
  1814. * @return {BABYLON.Geometry|null} the geometry or null if none found.
  1815. */
  1816. getGeometryByID(id: string): Geometry;
  1817. /**
  1818. * add a new geometry to this scene.
  1819. * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
  1820. * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
  1821. * @return {boolean} was the geometry added or not
  1822. */
  1823. pushGeometry(geometry: Geometry, force?: boolean): boolean;
  1824. /**
  1825. * Removes an existing geometry
  1826. * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene.
  1827. * @return {boolean} was the geometry removed or not
  1828. */
  1829. removeGeometry(geometry: Geometry): boolean;
  1830. getGeometries(): Geometry[];
  1831. /**
  1832. * Get the first added mesh found of a given ID
  1833. * @param {string} id - the id to search for
  1834. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1835. */
  1836. getMeshByID(id: string): AbstractMesh;
  1837. getMeshesByID(id: string): Array<AbstractMesh>;
  1838. /**
  1839. * Get a mesh with its auto-generated unique id
  1840. * @param {number} uniqueId - the unique id to search for
  1841. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1842. */
  1843. getMeshByUniqueID(uniqueId: number): AbstractMesh;
  1844. /**
  1845. * Get a the last added mesh found of a given ID
  1846. * @param {string} id - the id to search for
  1847. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1848. */
  1849. getLastMeshByID(id: string): AbstractMesh;
  1850. /**
  1851. * Get a the last added node (Mesh, Camera, Light) found of a given ID
  1852. * @param {string} id - the id to search for
  1853. * @return {BABYLON.Node|null} the node found or null if not found at all.
  1854. */
  1855. getLastEntryByID(id: string): Node;
  1856. getNodeByID(id: string): Node;
  1857. getNodeByName(name: string): Node;
  1858. getMeshByName(name: string): AbstractMesh;
  1859. getSoundByName(name: string): Sound;
  1860. getLastSkeletonByID(id: string): Skeleton;
  1861. getSkeletonById(id: string): Skeleton;
  1862. getSkeletonByName(name: string): Skeleton;
  1863. getMorphTargetManagerById(id: number): MorphTargetManager;
  1864. isActiveMesh(mesh: Mesh): boolean;
  1865. /**
  1866. * Return a the first highlight layer of the scene with a given name.
  1867. * @param name The name of the highlight layer to look for.
  1868. * @return The highlight layer if found otherwise null.
  1869. */
  1870. getHighlightLayerByName(name: string): HighlightLayer;
  1871. /**
  1872. * Return a unique id as a string which can serve as an identifier for the scene
  1873. */
  1874. readonly uid: string;
  1875. /**
  1876. * Add an externaly attached data from its key.
  1877. * This method call will fail and return false, if such key already exists.
  1878. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  1879. * @param key the unique key that identifies the data
  1880. * @param data the data object to associate to the key for this Engine instance
  1881. * @return true if no such key were already present and the data was added successfully, false otherwise
  1882. */
  1883. addExternalData<T>(key: string, data: T): boolean;
  1884. /**
  1885. * Get an externaly attached data from its key
  1886. * @param key the unique key that identifies the data
  1887. * @return the associated data, if present (can be null), or undefined if not present
  1888. */
  1889. getExternalData<T>(key: string): T;
  1890. /**
  1891. * Get an externaly attached data from its key, create it using a factory if it's not already present
  1892. * @param key the unique key that identifies the data
  1893. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  1894. * @return the associated data, can be null if the factory returned null.
  1895. */
  1896. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  1897. /**
  1898. * Remove an externaly attached data from the Engine instance
  1899. * @param key the unique key that identifies the data
  1900. * @return true if the data was successfully removed, false if it doesn't exist
  1901. */
  1902. removeExternalData(key: any): boolean;
  1903. private _evaluateSubMesh(subMesh, mesh);
  1904. _isInIntermediateRendering(): boolean;
  1905. private _evaluateActiveMeshes();
  1906. private _activeMesh(sourceMesh, mesh);
  1907. updateTransformMatrix(force?: boolean): void;
  1908. private _renderForCamera(camera);
  1909. private _processSubCameras(camera);
  1910. private _checkIntersections();
  1911. render(): void;
  1912. private _updateAudioParameters();
  1913. audioEnabled: boolean;
  1914. private _disableAudio();
  1915. private _enableAudio();
  1916. headphone: boolean;
  1917. private _switchAudioModeForHeadphones();
  1918. private _switchAudioModeForNormalSpeakers();
  1919. enableDepthRenderer(): DepthRenderer;
  1920. disableDepthRenderer(): void;
  1921. freezeMaterials(): void;
  1922. unfreezeMaterials(): void;
  1923. dispose(): void;
  1924. readonly isDisposed: boolean;
  1925. disposeSounds(): void;
  1926. getWorldExtends(): {
  1927. min: Vector3;
  1928. max: Vector3;
  1929. };
  1930. createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
  1931. createPickingRay(x: number, y: number, world: Matrix, camera: Camera, cameraViewSpace?: boolean): Ray;
  1932. createPickingRayInCameraSpace(x: number, y: number, camera: Camera): Ray;
  1933. private _internalPick(rayFunction, predicate, fastCheck?);
  1934. private _internalMultiPick(rayFunction, predicate);
  1935. private _internalPickSprites(ray, predicate?, fastCheck?, camera?);
  1936. pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1937. pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1938. pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo;
  1939. multiPick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, camera?: Camera): PickingInfo[];
  1940. multiPickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean): PickingInfo[];
  1941. setPointerOverMesh(mesh: AbstractMesh): void;
  1942. getPointerOverMesh(): AbstractMesh;
  1943. setPointerOverSprite(sprite: Sprite): void;
  1944. getPointerOverSprite(): Sprite;
  1945. getPhysicsEngine(): PhysicsEngine;
  1946. /**
  1947. * Enables physics to the current scene
  1948. * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine
  1949. * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS.
  1950. * @return {boolean} was the physics engine initialized
  1951. */
  1952. enablePhysics(gravity?: Vector3, plugin?: IPhysicsEnginePlugin): boolean;
  1953. disablePhysicsEngine(): void;
  1954. isPhysicsEnabled(): boolean;
  1955. deleteCompoundImpostor(compound: any): void;
  1956. createDefaultCameraOrLight(createArcRotateCamera?: boolean): void;
  1957. private _getByTags(list, tagsQuery, forEach?);
  1958. getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[];
  1959. getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[];
  1960. getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[];
  1961. getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[];
  1962. /**
  1963. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  1964. * This allowed control for front to back rendering or reversly depending of the special needs.
  1965. *
  1966. * @param renderingGroupId The rendering group id corresponding to its index
  1967. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  1968. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  1969. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  1970. */
  1971. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  1972. /**
  1973. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  1974. *
  1975. * @param renderingGroupId The rendering group id corresponding to its index
  1976. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  1977. * @param depth Automatically clears depth between groups if true and autoClear is true.
  1978. * @param stencil Automatically clears stencil between groups if true and autoClear is true.
  1979. */
  1980. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth?: boolean, stencil?: boolean): void;
  1981. /**
  1982. * Will flag all materials as dirty to trigger new shader compilation
  1983. * @param predicate If not null, it will be used to specifiy if a material has to be marked as dirty
  1984. */
  1985. markAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
  1986. }
  1987. }
  1988. interface HTMLCanvasElement extends HTMLElement {
  1989. getContext(contextId: "webgl2" | "experimental-webgl2", contextAttributes?: WebGLContextAttributes): WebGL2RenderingContext | null;
  1990. }
  1991. interface ImageBitmap {
  1992. readonly width: number;
  1993. readonly height: number;
  1994. close(): void;
  1995. }
  1996. interface WebGL2RenderingContext extends WebGLRenderingContext {
  1997. readonly READ_BUFFER: number;
  1998. readonly UNPACK_ROW_LENGTH: number;
  1999. readonly UNPACK_SKIP_ROWS: number;
  2000. readonly UNPACK_SKIP_PIXELS: number;
  2001. readonly PACK_ROW_LENGTH: number;
  2002. readonly PACK_SKIP_ROWS: number;
  2003. readonly PACK_SKIP_PIXELS: number;
  2004. readonly COLOR: number;
  2005. readonly DEPTH: number;
  2006. readonly STENCIL: number;
  2007. readonly RED: number;
  2008. readonly RGB8: number;
  2009. readonly RGBA8: number;
  2010. readonly RGB10_A2: number;
  2011. readonly TEXTURE_BINDING_3D: number;
  2012. readonly UNPACK_SKIP_IMAGES: number;
  2013. readonly UNPACK_IMAGE_HEIGHT: number;
  2014. readonly TEXTURE_3D: number;
  2015. readonly TEXTURE_WRAP_R: number;
  2016. readonly MAX_3D_TEXTURE_SIZE: number;
  2017. readonly UNSIGNED_INT_2_10_10_10_REV: number;
  2018. readonly MAX_ELEMENTS_VERTICES: number;
  2019. readonly MAX_ELEMENTS_INDICES: number;
  2020. readonly TEXTURE_MIN_LOD: number;
  2021. readonly TEXTURE_MAX_LOD: number;
  2022. readonly TEXTURE_BASE_LEVEL: number;
  2023. readonly TEXTURE_MAX_LEVEL: number;
  2024. readonly MIN: number;
  2025. readonly MAX: number;
  2026. readonly DEPTH_COMPONENT24: number;
  2027. readonly MAX_TEXTURE_LOD_BIAS: number;
  2028. readonly TEXTURE_COMPARE_MODE: number;
  2029. readonly TEXTURE_COMPARE_FUNC: number;
  2030. readonly CURRENT_QUERY: number;
  2031. readonly QUERY_RESULT: number;
  2032. readonly QUERY_RESULT_AVAILABLE: number;
  2033. readonly STREAM_READ: number;
  2034. readonly STREAM_COPY: number;
  2035. readonly STATIC_READ: number;
  2036. readonly STATIC_COPY: number;
  2037. readonly DYNAMIC_READ: number;
  2038. readonly DYNAMIC_COPY: number;
  2039. readonly MAX_DRAW_BUFFERS: number;
  2040. readonly DRAW_BUFFER0: number;
  2041. readonly DRAW_BUFFER1: number;
  2042. readonly DRAW_BUFFER2: number;
  2043. readonly DRAW_BUFFER3: number;
  2044. readonly DRAW_BUFFER4: number;
  2045. readonly DRAW_BUFFER5: number;
  2046. readonly DRAW_BUFFER6: number;
  2047. readonly DRAW_BUFFER7: number;
  2048. readonly DRAW_BUFFER8: number;
  2049. readonly DRAW_BUFFER9: number;
  2050. readonly DRAW_BUFFER10: number;
  2051. readonly DRAW_BUFFER11: number;
  2052. readonly DRAW_BUFFER12: number;
  2053. readonly DRAW_BUFFER13: number;
  2054. readonly DRAW_BUFFER14: number;
  2055. readonly DRAW_BUFFER15: number;
  2056. readonly MAX_FRAGMENT_UNIFORM_COMPONENTS: number;
  2057. readonly MAX_VERTEX_UNIFORM_COMPONENTS: number;
  2058. readonly SAMPLER_3D: number;
  2059. readonly SAMPLER_2D_SHADOW: number;
  2060. readonly FRAGMENT_SHADER_DERIVATIVE_HINT: number;
  2061. readonly PIXEL_PACK_BUFFER: number;
  2062. readonly PIXEL_UNPACK_BUFFER: number;
  2063. readonly PIXEL_PACK_BUFFER_BINDING: number;
  2064. readonly PIXEL_UNPACK_BUFFER_BINDING: number;
  2065. readonly FLOAT_MAT2x3: number;
  2066. readonly FLOAT_MAT2x4: number;
  2067. readonly FLOAT_MAT3x2: number;
  2068. readonly FLOAT_MAT3x4: number;
  2069. readonly FLOAT_MAT4x2: number;
  2070. readonly FLOAT_MAT4x3: number;
  2071. readonly SRGB: number;
  2072. readonly SRGB8: number;
  2073. readonly SRGB8_ALPHA8: number;
  2074. readonly COMPARE_REF_TO_TEXTURE: number;
  2075. readonly RGBA32F: number;
  2076. readonly RGB32F: number;
  2077. readonly RGBA16F: number;
  2078. readonly RGB16F: number;
  2079. readonly VERTEX_ATTRIB_ARRAY_INTEGER: number;
  2080. readonly MAX_ARRAY_TEXTURE_LAYERS: number;
  2081. readonly MIN_PROGRAM_TEXEL_OFFSET: number;
  2082. readonly MAX_PROGRAM_TEXEL_OFFSET: number;
  2083. readonly MAX_VARYING_COMPONENTS: number;
  2084. readonly TEXTURE_2D_ARRAY: number;
  2085. readonly TEXTURE_BINDING_2D_ARRAY: number;
  2086. readonly R11F_G11F_B10F: number;
  2087. readonly UNSIGNED_INT_10F_11F_11F_REV: number;
  2088. readonly RGB9_E5: number;
  2089. readonly UNSIGNED_INT_5_9_9_9_REV: number;
  2090. readonly TRANSFORM_FEEDBACK_BUFFER_MODE: number;
  2091. readonly MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: number;
  2092. readonly TRANSFORM_FEEDBACK_VARYINGS: number;
  2093. readonly TRANSFORM_FEEDBACK_BUFFER_START: number;
  2094. readonly TRANSFORM_FEEDBACK_BUFFER_SIZE: number;
  2095. readonly TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: number;
  2096. readonly RASTERIZER_DISCARD: number;
  2097. readonly MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: number;
  2098. readonly MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: number;
  2099. readonly INTERLEAVED_ATTRIBS: number;
  2100. readonly SEPARATE_ATTRIBS: number;
  2101. readonly TRANSFORM_FEEDBACK_BUFFER: number;
  2102. readonly TRANSFORM_FEEDBACK_BUFFER_BINDING: number;
  2103. readonly RGBA32UI: number;
  2104. readonly RGB32UI: number;
  2105. readonly RGBA16UI: number;
  2106. readonly RGB16UI: number;
  2107. readonly RGBA8UI: number;
  2108. readonly RGB8UI: number;
  2109. readonly RGBA32I: number;
  2110. readonly RGB32I: number;
  2111. readonly RGBA16I: number;
  2112. readonly RGB16I: number;
  2113. readonly RGBA8I: number;
  2114. readonly RGB8I: number;
  2115. readonly RED_INTEGER: number;
  2116. readonly RGB_INTEGER: number;
  2117. readonly RGBA_INTEGER: number;
  2118. readonly SAMPLER_2D_ARRAY: number;
  2119. readonly SAMPLER_2D_ARRAY_SHADOW: number;
  2120. readonly SAMPLER_CUBE_SHADOW: number;
  2121. readonly UNSIGNED_INT_VEC2: number;
  2122. readonly UNSIGNED_INT_VEC3: number;
  2123. readonly UNSIGNED_INT_VEC4: number;
  2124. readonly INT_SAMPLER_2D: number;
  2125. readonly INT_SAMPLER_3D: number;
  2126. readonly INT_SAMPLER_CUBE: number;
  2127. readonly INT_SAMPLER_2D_ARRAY: number;
  2128. readonly UNSIGNED_INT_SAMPLER_2D: number;
  2129. readonly UNSIGNED_INT_SAMPLER_3D: number;
  2130. readonly UNSIGNED_INT_SAMPLER_CUBE: number;
  2131. readonly UNSIGNED_INT_SAMPLER_2D_ARRAY: number;
  2132. readonly DEPTH_COMPONENT32F: number;
  2133. readonly DEPTH32F_STENCIL8: number;
  2134. readonly FLOAT_32_UNSIGNED_INT_24_8_REV: number;
  2135. readonly FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: number;
  2136. readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: number;
  2137. readonly FRAMEBUFFER_ATTACHMENT_RED_SIZE: number;
  2138. readonly FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: number;
  2139. readonly FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: number;
  2140. readonly FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: number;
  2141. readonly FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: number;
  2142. readonly FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: number;
  2143. readonly FRAMEBUFFER_DEFAULT: number;
  2144. readonly UNSIGNED_INT_24_8: number;
  2145. readonly DEPTH24_STENCIL8: number;
  2146. readonly UNSIGNED_NORMALIZED: number;
  2147. readonly DRAW_FRAMEBUFFER_BINDING: number;
  2148. readonly READ_FRAMEBUFFER: number;
  2149. readonly DRAW_FRAMEBUFFER: number;
  2150. readonly READ_FRAMEBUFFER_BINDING: number;
  2151. readonly RENDERBUFFER_SAMPLES: number;
  2152. readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: number;
  2153. readonly MAX_COLOR_ATTACHMENTS: number;
  2154. readonly COLOR_ATTACHMENT1: number;
  2155. readonly COLOR_ATTACHMENT2: number;
  2156. readonly COLOR_ATTACHMENT3: number;
  2157. readonly COLOR_ATTACHMENT4: number;
  2158. readonly COLOR_ATTACHMENT5: number;
  2159. readonly COLOR_ATTACHMENT6: number;
  2160. readonly COLOR_ATTACHMENT7: number;
  2161. readonly COLOR_ATTACHMENT8: number;
  2162. readonly COLOR_ATTACHMENT9: number;
  2163. readonly COLOR_ATTACHMENT10: number;
  2164. readonly COLOR_ATTACHMENT11: number;
  2165. readonly COLOR_ATTACHMENT12: number;
  2166. readonly COLOR_ATTACHMENT13: number;
  2167. readonly COLOR_ATTACHMENT14: number;
  2168. readonly COLOR_ATTACHMENT15: number;
  2169. readonly FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: number;
  2170. readonly MAX_SAMPLES: number;
  2171. readonly HALF_FLOAT: number;
  2172. readonly RG: number;
  2173. readonly RG_INTEGER: number;
  2174. readonly R8: number;
  2175. readonly RG8: number;
  2176. readonly R16F: number;
  2177. readonly R32F: number;
  2178. readonly RG16F: number;
  2179. readonly RG32F: number;
  2180. readonly R8I: number;
  2181. readonly R8UI: number;
  2182. readonly R16I: number;
  2183. readonly R16UI: number;
  2184. readonly R32I: number;
  2185. readonly R32UI: number;
  2186. readonly RG8I: number;
  2187. readonly RG8UI: number;
  2188. readonly RG16I: number;
  2189. readonly RG16UI: number;
  2190. readonly RG32I: number;
  2191. readonly RG32UI: number;
  2192. readonly VERTEX_ARRAY_BINDING: number;
  2193. readonly R8_SNORM: number;
  2194. readonly RG8_SNORM: number;
  2195. readonly RGB8_SNORM: number;
  2196. readonly RGBA8_SNORM: number;
  2197. readonly SIGNED_NORMALIZED: number;
  2198. readonly COPY_READ_BUFFER: number;
  2199. readonly COPY_WRITE_BUFFER: number;
  2200. readonly COPY_READ_BUFFER_BINDING: number;
  2201. readonly COPY_WRITE_BUFFER_BINDING: number;
  2202. readonly UNIFORM_BUFFER: number;
  2203. readonly UNIFORM_BUFFER_BINDING: number;
  2204. readonly UNIFORM_BUFFER_START: number;
  2205. readonly UNIFORM_BUFFER_SIZE: number;
  2206. readonly MAX_VERTEX_UNIFORM_BLOCKS: number;
  2207. readonly MAX_FRAGMENT_UNIFORM_BLOCKS: number;
  2208. readonly MAX_COMBINED_UNIFORM_BLOCKS: number;
  2209. readonly MAX_UNIFORM_BUFFER_BINDINGS: number;
  2210. readonly MAX_UNIFORM_BLOCK_SIZE: number;
  2211. readonly MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: number;
  2212. readonly MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: number;
  2213. readonly UNIFORM_BUFFER_OFFSET_ALIGNMENT: number;
  2214. readonly ACTIVE_UNIFORM_BLOCKS: number;
  2215. readonly UNIFORM_TYPE: number;
  2216. readonly UNIFORM_SIZE: number;
  2217. readonly UNIFORM_BLOCK_INDEX: number;
  2218. readonly UNIFORM_OFFSET: number;
  2219. readonly UNIFORM_ARRAY_STRIDE: number;
  2220. readonly UNIFORM_MATRIX_STRIDE: number;
  2221. readonly UNIFORM_IS_ROW_MAJOR: number;
  2222. readonly UNIFORM_BLOCK_BINDING: number;
  2223. readonly UNIFORM_BLOCK_DATA_SIZE: number;
  2224. readonly UNIFORM_BLOCK_ACTIVE_UNIFORMS: number;
  2225. readonly UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: number;
  2226. readonly UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: number;
  2227. readonly UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: number;
  2228. readonly INVALID_INDEX: number;
  2229. readonly MAX_VERTEX_OUTPUT_COMPONENTS: number;
  2230. readonly MAX_FRAGMENT_INPUT_COMPONENTS: number;
  2231. readonly MAX_SERVER_WAIT_TIMEOUT: number;
  2232. readonly OBJECT_TYPE: number;
  2233. readonly SYNC_CONDITION: number;
  2234. readonly SYNC_STATUS: number;
  2235. readonly SYNC_FLAGS: number;
  2236. readonly SYNC_FENCE: number;
  2237. readonly SYNC_GPU_COMMANDS_COMPLETE: number;
  2238. readonly UNSIGNALED: number;
  2239. readonly SIGNALED: number;
  2240. readonly ALREADY_SIGNALED: number;
  2241. readonly TIMEOUT_EXPIRED: number;
  2242. readonly CONDITION_SATISFIED: number;
  2243. readonly WAIT_FAILED: number;
  2244. readonly SYNC_FLUSH_COMMANDS_BIT: number;
  2245. readonly VERTEX_ATTRIB_ARRAY_DIVISOR: number;
  2246. readonly ANY_SAMPLES_PASSED: number;
  2247. readonly ANY_SAMPLES_PASSED_CONSERVATIVE: number;
  2248. readonly SAMPLER_BINDING: number;
  2249. readonly RGB10_A2UI: number;
  2250. readonly INT_2_10_10_10_REV: number;
  2251. readonly TRANSFORM_FEEDBACK: number;
  2252. readonly TRANSFORM_FEEDBACK_PAUSED: number;
  2253. readonly TRANSFORM_FEEDBACK_ACTIVE: number;
  2254. readonly TRANSFORM_FEEDBACK_BINDING: number;
  2255. readonly TEXTURE_IMMUTABLE_FORMAT: number;
  2256. readonly MAX_ELEMENT_INDEX: number;
  2257. readonly TEXTURE_IMMUTABLE_LEVELS: number;
  2258. readonly TIMEOUT_IGNORED: number;
  2259. readonly MAX_CLIENT_WAIT_TIMEOUT_WEBGL: number;
  2260. bufferData(target: number, size: number, usage: number): void;
  2261. bufferData(target: number, srcData: ArrayBuffer | ArrayBufferView | null, usage: number): void;
  2262. bufferSubData(target: number, dstByteOffset: number, srcData: ArrayBuffer | ArrayBufferView): void;
  2263. bufferData(target: number, srcData: ArrayBufferView, usage: number, srcOffset: number, length?: number): void;
  2264. bufferSubData(target: number, dstByteOffset: number, srcData: ArrayBufferView, srcOffset: number, length?: number): void;
  2265. copyBufferSubData(readTarget: number, writeTarget: number, readOffset: number, writeOffset: number, size: number): void;
  2266. getBufferSubData(target: number, srcByteOffset: number, dstBuffer: ArrayBufferView, dstOffset?: number, length?: number): void;
  2267. blitFramebuffer(srcX0: number, srcY0: number, srcX1: number, srcY1: number, dstX0: number, dstY0: number, dstX1: number, dstY1: number, mask: number, filter: number): void;
  2268. framebufferTextureLayer(target: number, attachment: number, texture: WebGLTexture | null, level: number, layer: number): void;
  2269. invalidateFramebuffer(target: number, attachments: number[]): void;
  2270. invalidateSubFramebuffer(target: number, attachments: number[], x: number, y: number, width: number, height: number): void;
  2271. readBuffer(src: number): void;
  2272. getInternalformatParameter(target: number, internalformat: number, pname: number): any;
  2273. renderbufferStorageMultisample(target: number, samples: number, internalformat: number, width: number, height: number): void;
  2274. texStorage2D(target: number, levels: number, internalformat: number, width: number, height: number): void;
  2275. texStorage3D(target: number, levels: number, internalformat: number, width: number, height: number, depth: number): void;
  2276. texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void;
  2277. texImage2D(target: number, level: number, internalformat: number, format: number, type: number, source: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
  2278. texImage2D(target: number, level: number, internalformat: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
  2279. texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void;
  2280. texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, source: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
  2281. texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
  2282. texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pboOffset: number): void;
  2283. texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
  2284. texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, srcData: ArrayBufferView, srcOffset: number): void;
  2285. texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, pboOffset: number): void;
  2286. texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
  2287. texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, srcData: ArrayBufferView | null): void;
  2288. texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, srcData: ArrayBufferView, srcOffset: number): void;
  2289. texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pboOffset: number): void;
  2290. texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
  2291. texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, srcData: ArrayBufferView, srcOffset: number): void;
  2292. texSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, depth: number, format: number, type: number, pboOffset: number): void;
  2293. texSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, depth: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
  2294. texSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, depth: number, format: number, type: number, srcData: ArrayBufferView | null, srcOffset?: number): void;
  2295. copyTexSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, x: number, y: number, width: number, height: number): void;
  2296. compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, imageSize: number, offset: number): void;
  2297. compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, srcData: ArrayBufferView, srcOffset?: number, srcLengthOverride?: number): void;
  2298. compressedTexImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, imageSize: number, offset: number): void;
  2299. compressedTexImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, srcData: ArrayBufferView, srcOffset?: number, srcLengthOverride?: number): void;
  2300. compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, imageSize: number, offset: number): void;
  2301. compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, srcData: ArrayBufferView, srcOffset?: number, srcLengthOverride?: number): void;
  2302. compressedTexSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, depth: number, format: number, imageSize: number, offset: number): void;
  2303. compressedTexSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, depth: number, format: number, srcData: ArrayBufferView, srcOffset?: number, srcLengthOverride?: number): void;
  2304. getFragDataLocation(program: WebGLProgram, name: string): number;
  2305. uniform1ui(location: WebGLUniformLocation | null, v0: number): void;
  2306. uniform2ui(location: WebGLUniformLocation | null, v0: number, v1: number): void;
  2307. uniform3ui(location: WebGLUniformLocation | null, v0: number, v1: number, v2: number): void;
  2308. uniform4ui(location: WebGLUniformLocation | null, v0: number, v1: number, v2: number, v3: number): void;
  2309. uniform1fv(location: WebGLUniformLocation | null, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2310. uniform2fv(location: WebGLUniformLocation | null, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2311. uniform3fv(location: WebGLUniformLocation | null, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2312. uniform4fv(location: WebGLUniformLocation | null, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2313. uniform1iv(location: WebGLUniformLocation | null, data: Int32Array | number[], srcOffset?: number, srcLength?: number): void;
  2314. uniform2iv(location: WebGLUniformLocation | null, data: Int32Array | number[], srcOffset?: number, srcLength?: number): void;
  2315. uniform3iv(location: WebGLUniformLocation | null, data: Int32Array | number[], srcOffset?: number, srcLength?: number): void;
  2316. uniform4iv(location: WebGLUniformLocation | null, data: Int32Array | number[], srcOffset?: number, srcLength?: number): void;
  2317. uniform1uiv(location: WebGLUniformLocation | null, data: Uint32Array | number[], srcOffset?: number, srcLength?: number): void;
  2318. uniform2uiv(location: WebGLUniformLocation | null, data: Uint32Array | number[], srcOffset?: number, srcLength?: number): void;
  2319. uniform3uiv(location: WebGLUniformLocation | null, data: Uint32Array | number[], srcOffset?: number, srcLength?: number): void;
  2320. uniform4uiv(location: WebGLUniformLocation | null, data: Uint32Array | number[], srcOffset?: number, srcLength?: number): void;
  2321. uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2322. uniformMatrix3x2fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2323. uniformMatrix4x2fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2324. uniformMatrix2x3fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2325. uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2326. uniformMatrix4x3fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2327. uniformMatrix2x4fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2328. uniformMatrix3x4fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2329. uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | number[], srcOffset?: number, srcLength?: number): void;
  2330. vertexAttribI4i(index: number, x: number, y: number, z: number, w: number): void;
  2331. vertexAttribI4iv(index: number, values: Int32Array | number[]): void;
  2332. vertexAttribI4ui(index: number, x: number, y: number, z: number, w: number): void;
  2333. vertexAttribI4uiv(index: number, values: Uint32Array | number[]): void;
  2334. vertexAttribIPointer(index: number, size: number, type: number, stride: number, offset: number): void;
  2335. vertexAttribDivisor(index: number, divisor: number): void;
  2336. drawArraysInstanced(mode: number, first: number, count: number, instanceCount: number): void;
  2337. drawElementsInstanced(mode: number, count: number, type: number, offset: number, instanceCount: number): void;
  2338. drawRangeElements(mode: number, start: number, end: number, count: number, type: number, offset: number): void;
  2339. readPixels(x: number, y: number, width: number, height: number, format: number, type: number, dstData: ArrayBufferView | null): void;
  2340. readPixels(x: number, y: number, width: number, height: number, format: number, type: number, offset: number): void;
  2341. readPixels(x: number, y: number, width: number, height: number, format: number, type: number, dstData: ArrayBufferView, dstOffset: number): void;
  2342. drawBuffers(buffers: number[]): void;
  2343. clearBufferfv(buffer: number, drawbuffer: number, values: Float32Array | number[], srcOffset?: number): void;
  2344. clearBufferiv(buffer: number, drawbuffer: number, values: Int32Array | number[], srcOffset?: number): void;
  2345. clearBufferuiv(buffer: number, drawbuffer: number, values: Uint32Array | number[], srcOffset?: number): void;
  2346. clearBufferfi(buffer: number, drawbuffer: number, depth: number, stencil: number): void;
  2347. createQuery(): WebGLQuery | null;
  2348. deleteQuery(query: WebGLQuery | null): void;
  2349. isQuery(query: WebGLQuery | null): boolean;
  2350. beginQuery(target: number, query: WebGLQuery): void;
  2351. endQuery(target: number): void;
  2352. getQuery(target: number, pname: number): WebGLQuery | null;
  2353. getQueryParameter(query: WebGLQuery, pname: number): any;
  2354. createSampler(): WebGLSampler | null;
  2355. deleteSampler(sampler: WebGLSampler | null): void;
  2356. isSampler(sampler: WebGLSampler | null): boolean;
  2357. bindSampler(unit: number, sampler: WebGLSampler | null): void;
  2358. samplerParameteri(sampler: WebGLSampler, pname: number, param: number): void;
  2359. samplerParameterf(sampler: WebGLSampler, pname: number, param: number): void;
  2360. getSamplerParameter(sampler: WebGLSampler, pname: number): any;
  2361. fenceSync(condition: number, flags: number): WebGLSync | null;
  2362. isSync(sync: WebGLSync | null): boolean;
  2363. deleteSync(sync: WebGLSync | null): void;
  2364. clientWaitSync(sync: WebGLSync, flags: number, timeout: number): number;
  2365. waitSync(sync: WebGLSync, flags: number, timeout: number): void;
  2366. getSyncParameter(sync: WebGLSync, pname: number): any;
  2367. createTransformFeedback(): WebGLTransformFeedback | null;
  2368. deleteTransformFeedback(tf: WebGLTransformFeedback | null): void;
  2369. isTransformFeedback(tf: WebGLTransformFeedback | null): boolean;
  2370. bindTransformFeedback(target: number, tf: WebGLTransformFeedback | null): void;
  2371. beginTransformFeedback(primitiveMode: number): void;
  2372. endTransformFeedback(): void;
  2373. transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: number): void;
  2374. getTransformFeedbackVarying(program: WebGLProgram, index: number): WebGLActiveInfo | null;
  2375. pauseTransformFeedback(): void;
  2376. resumeTransformFeedback(): void;
  2377. bindBufferBase(target: number, index: number, buffer: WebGLBuffer | null): void;
  2378. bindBufferRange(target: number, index: number, buffer: WebGLBuffer | null, offset: number, size: number): void;
  2379. getIndexedParameter(target: number, index: number): any;
  2380. getUniformIndices(program: WebGLProgram, uniformNames: string[]): number[] | null;
  2381. getActiveUniforms(program: WebGLProgram, uniformIndices: number[], pname: number): any;
  2382. getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string): number;
  2383. getActiveUniformBlockParameter(program: WebGLProgram, uniformBlockIndex: number, pname: number): any;
  2384. getActiveUniformBlockName(program: WebGLProgram, uniformBlockIndex: number): string | null;
  2385. uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: number, uniformBlockBinding: number): void;
  2386. createVertexArray(): WebGLVertexArrayObject | null;
  2387. deleteVertexArray(vertexArray: WebGLVertexArrayObject | null): void;
  2388. isVertexArray(vertexArray: WebGLVertexArrayObject | null): boolean;
  2389. bindVertexArray(array: WebGLVertexArrayObject | null): void;
  2390. }
  2391. declare var WebGL2RenderingContext: {
  2392. prototype: WebGL2RenderingContext;
  2393. new (): WebGL2RenderingContext;
  2394. readonly ACTIVE_ATTRIBUTES: number;
  2395. readonly ACTIVE_TEXTURE: number;
  2396. readonly ACTIVE_UNIFORMS: number;
  2397. readonly ALIASED_LINE_WIDTH_RANGE: number;
  2398. readonly ALIASED_POINT_SIZE_RANGE: number;
  2399. readonly ALPHA: number;
  2400. readonly ALPHA_BITS: number;
  2401. readonly ALWAYS: number;
  2402. readonly ARRAY_BUFFER: number;
  2403. readonly ARRAY_BUFFER_BINDING: number;
  2404. readonly ATTACHED_SHADERS: number;
  2405. readonly BACK: number;
  2406. readonly BLEND: number;
  2407. readonly BLEND_COLOR: number;
  2408. readonly BLEND_DST_ALPHA: number;
  2409. readonly BLEND_DST_RGB: number;
  2410. readonly BLEND_EQUATION: number;
  2411. readonly BLEND_EQUATION_ALPHA: number;
  2412. readonly BLEND_EQUATION_RGB: number;
  2413. readonly BLEND_SRC_ALPHA: number;
  2414. readonly BLEND_SRC_RGB: number;
  2415. readonly BLUE_BITS: number;
  2416. readonly BOOL: number;
  2417. readonly BOOL_VEC2: number;
  2418. readonly BOOL_VEC3: number;
  2419. readonly BOOL_VEC4: number;
  2420. readonly BROWSER_DEFAULT_WEBGL: number;
  2421. readonly BUFFER_SIZE: number;
  2422. readonly BUFFER_USAGE: number;
  2423. readonly BYTE: number;
  2424. readonly CCW: number;
  2425. readonly CLAMP_TO_EDGE: number;
  2426. readonly COLOR_ATTACHMENT0: number;
  2427. readonly COLOR_BUFFER_BIT: number;
  2428. readonly COLOR_CLEAR_VALUE: number;
  2429. readonly COLOR_WRITEMASK: number;
  2430. readonly COMPILE_STATUS: number;
  2431. readonly COMPRESSED_TEXTURE_FORMATS: number;
  2432. readonly CONSTANT_ALPHA: number;
  2433. readonly CONSTANT_COLOR: number;
  2434. readonly CONTEXT_LOST_WEBGL: number;
  2435. readonly CULL_FACE: number;
  2436. readonly CULL_FACE_MODE: number;
  2437. readonly CURRENT_PROGRAM: number;
  2438. readonly CURRENT_VERTEX_ATTRIB: number;
  2439. readonly CW: number;
  2440. readonly DECR: number;
  2441. readonly DECR_WRAP: number;
  2442. readonly DELETE_STATUS: number;
  2443. readonly DEPTH_ATTACHMENT: number;
  2444. readonly DEPTH_BITS: number;
  2445. readonly DEPTH_BUFFER_BIT: number;
  2446. readonly DEPTH_CLEAR_VALUE: number;
  2447. readonly DEPTH_COMPONENT: number;
  2448. readonly DEPTH_COMPONENT16: number;
  2449. readonly DEPTH_FUNC: number;
  2450. readonly DEPTH_RANGE: number;
  2451. readonly DEPTH_STENCIL: number;
  2452. readonly DEPTH_STENCIL_ATTACHMENT: number;
  2453. readonly DEPTH_TEST: number;
  2454. readonly DEPTH_WRITEMASK: number;
  2455. readonly DITHER: number;
  2456. readonly DONT_CARE: number;
  2457. readonly DST_ALPHA: number;
  2458. readonly DST_COLOR: number;
  2459. readonly DYNAMIC_DRAW: number;
  2460. readonly ELEMENT_ARRAY_BUFFER: number;
  2461. readonly ELEMENT_ARRAY_BUFFER_BINDING: number;
  2462. readonly EQUAL: number;
  2463. readonly FASTEST: number;
  2464. readonly FLOAT: number;
  2465. readonly FLOAT_MAT2: number;
  2466. readonly FLOAT_MAT3: number;
  2467. readonly FLOAT_MAT4: number;
  2468. readonly FLOAT_VEC2: number;
  2469. readonly FLOAT_VEC3: number;
  2470. readonly FLOAT_VEC4: number;
  2471. readonly FRAGMENT_SHADER: number;
  2472. readonly FRAMEBUFFER: number;
  2473. readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;
  2474. readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;
  2475. readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;
  2476. readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;
  2477. readonly FRAMEBUFFER_BINDING: number;
  2478. readonly FRAMEBUFFER_COMPLETE: number;
  2479. readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;
  2480. readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;
  2481. readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;
  2482. readonly FRAMEBUFFER_UNSUPPORTED: number;
  2483. readonly FRONT: number;
  2484. readonly FRONT_AND_BACK: number;
  2485. readonly FRONT_FACE: number;
  2486. readonly FUNC_ADD: number;
  2487. readonly FUNC_REVERSE_SUBTRACT: number;
  2488. readonly FUNC_SUBTRACT: number;
  2489. readonly GENERATE_MIPMAP_HINT: number;
  2490. readonly GEQUAL: number;
  2491. readonly GREATER: number;
  2492. readonly GREEN_BITS: number;
  2493. readonly HIGH_FLOAT: number;
  2494. readonly HIGH_INT: number;
  2495. readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;
  2496. readonly IMPLEMENTATION_COLOR_READ_TYPE: number;
  2497. readonly INCR: number;
  2498. readonly INCR_WRAP: number;
  2499. readonly INT: number;
  2500. readonly INT_VEC2: number;
  2501. readonly INT_VEC3: number;
  2502. readonly INT_VEC4: number;
  2503. readonly INVALID_ENUM: number;
  2504. readonly INVALID_FRAMEBUFFER_OPERATION: number;
  2505. readonly INVALID_OPERATION: number;
  2506. readonly INVALID_VALUE: number;
  2507. readonly INVERT: number;
  2508. readonly KEEP: number;
  2509. readonly LEQUAL: number;
  2510. readonly LESS: number;
  2511. readonly LINEAR: number;
  2512. readonly LINEAR_MIPMAP_LINEAR: number;
  2513. readonly LINEAR_MIPMAP_NEAREST: number;
  2514. readonly LINES: number;
  2515. readonly LINE_LOOP: number;
  2516. readonly LINE_STRIP: number;
  2517. readonly LINE_WIDTH: number;
  2518. readonly LINK_STATUS: number;
  2519. readonly LOW_FLOAT: number;
  2520. readonly LOW_INT: number;
  2521. readonly LUMINANCE: number;
  2522. readonly LUMINANCE_ALPHA: number;
  2523. readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;
  2524. readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;
  2525. readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;
  2526. readonly MAX_RENDERBUFFER_SIZE: number;
  2527. readonly MAX_TEXTURE_IMAGE_UNITS: number;
  2528. readonly MAX_TEXTURE_SIZE: number;
  2529. readonly MAX_VARYING_VECTORS: number;
  2530. readonly MAX_VERTEX_ATTRIBS: number;
  2531. readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;
  2532. readonly MAX_VERTEX_UNIFORM_VECTORS: number;
  2533. readonly MAX_VIEWPORT_DIMS: number;
  2534. readonly MEDIUM_FLOAT: number;
  2535. readonly MEDIUM_INT: number;
  2536. readonly MIRRORED_REPEAT: number;
  2537. readonly NEAREST: number;
  2538. readonly NEAREST_MIPMAP_LINEAR: number;
  2539. readonly NEAREST_MIPMAP_NEAREST: number;
  2540. readonly NEVER: number;
  2541. readonly NICEST: number;
  2542. readonly NONE: number;
  2543. readonly NOTEQUAL: number;
  2544. readonly NO_ERROR: number;
  2545. readonly ONE: number;
  2546. readonly ONE_MINUS_CONSTANT_ALPHA: number;
  2547. readonly ONE_MINUS_CONSTANT_COLOR: number;
  2548. readonly ONE_MINUS_DST_ALPHA: number;
  2549. readonly ONE_MINUS_DST_COLOR: number;
  2550. readonly ONE_MINUS_SRC_ALPHA: number;
  2551. readonly ONE_MINUS_SRC_COLOR: number;
  2552. readonly OUT_OF_MEMORY: number;
  2553. readonly PACK_ALIGNMENT: number;
  2554. readonly POINTS: number;
  2555. readonly POLYGON_OFFSET_FACTOR: number;
  2556. readonly POLYGON_OFFSET_FILL: number;
  2557. readonly POLYGON_OFFSET_UNITS: number;
  2558. readonly RED_BITS: number;
  2559. readonly RENDERBUFFER: number;
  2560. readonly RENDERBUFFER_ALPHA_SIZE: number;
  2561. readonly RENDERBUFFER_BINDING: number;
  2562. readonly RENDERBUFFER_BLUE_SIZE: number;
  2563. readonly RENDERBUFFER_DEPTH_SIZE: number;
  2564. readonly RENDERBUFFER_GREEN_SIZE: number;
  2565. readonly RENDERBUFFER_HEIGHT: number;
  2566. readonly RENDERBUFFER_INTERNAL_FORMAT: number;
  2567. readonly RENDERBUFFER_RED_SIZE: number;
  2568. readonly RENDERBUFFER_STENCIL_SIZE: number;
  2569. readonly RENDERBUFFER_WIDTH: number;
  2570. readonly RENDERER: number;
  2571. readonly REPEAT: number;
  2572. readonly REPLACE: number;
  2573. readonly RGB: number;
  2574. readonly RGB565: number;
  2575. readonly RGB5_A1: number;
  2576. readonly RGBA: number;
  2577. readonly RGBA4: number;
  2578. readonly SAMPLER_2D: number;
  2579. readonly SAMPLER_CUBE: number;
  2580. readonly SAMPLES: number;
  2581. readonly SAMPLE_ALPHA_TO_COVERAGE: number;
  2582. readonly SAMPLE_BUFFERS: number;
  2583. readonly SAMPLE_COVERAGE: number;
  2584. readonly SAMPLE_COVERAGE_INVERT: number;
  2585. readonly SAMPLE_COVERAGE_VALUE: number;
  2586. readonly SCISSOR_BOX: number;
  2587. readonly SCISSOR_TEST: number;
  2588. readonly SHADER_TYPE: number;
  2589. readonly SHADING_LANGUAGE_VERSION: number;
  2590. readonly SHORT: number;
  2591. readonly SRC_ALPHA: number;
  2592. readonly SRC_ALPHA_SATURATE: number;
  2593. readonly SRC_COLOR: number;
  2594. readonly STATIC_DRAW: number;
  2595. readonly STENCIL_ATTACHMENT: number;
  2596. readonly STENCIL_BACK_FAIL: number;
  2597. readonly STENCIL_BACK_FUNC: number;
  2598. readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;
  2599. readonly STENCIL_BACK_PASS_DEPTH_PASS: number;
  2600. readonly STENCIL_BACK_REF: number;
  2601. readonly STENCIL_BACK_VALUE_MASK: number;
  2602. readonly STENCIL_BACK_WRITEMASK: number;
  2603. readonly STENCIL_BITS: number;
  2604. readonly STENCIL_BUFFER_BIT: number;
  2605. readonly STENCIL_CLEAR_VALUE: number;
  2606. readonly STENCIL_FAIL: number;
  2607. readonly STENCIL_FUNC: number;
  2608. readonly STENCIL_INDEX: number;
  2609. readonly STENCIL_INDEX8: number;
  2610. readonly STENCIL_PASS_DEPTH_FAIL: number;
  2611. readonly STENCIL_PASS_DEPTH_PASS: number;
  2612. readonly STENCIL_REF: number;
  2613. readonly STENCIL_TEST: number;
  2614. readonly STENCIL_VALUE_MASK: number;
  2615. readonly STENCIL_WRITEMASK: number;
  2616. readonly STREAM_DRAW: number;
  2617. readonly SUBPIXEL_BITS: number;
  2618. readonly TEXTURE: number;
  2619. readonly TEXTURE0: number;
  2620. readonly TEXTURE1: number;
  2621. readonly TEXTURE10: number;
  2622. readonly TEXTURE11: number;
  2623. readonly TEXTURE12: number;
  2624. readonly TEXTURE13: number;
  2625. readonly TEXTURE14: number;
  2626. readonly TEXTURE15: number;
  2627. readonly TEXTURE16: number;
  2628. readonly TEXTURE17: number;
  2629. readonly TEXTURE18: number;
  2630. readonly TEXTURE19: number;
  2631. readonly TEXTURE2: number;
  2632. readonly TEXTURE20: number;
  2633. readonly TEXTURE21: number;
  2634. readonly TEXTURE22: number;
  2635. readonly TEXTURE23: number;
  2636. readonly TEXTURE24: number;
  2637. readonly TEXTURE25: number;
  2638. readonly TEXTURE26: number;
  2639. readonly TEXTURE27: number;
  2640. readonly TEXTURE28: number;
  2641. readonly TEXTURE29: number;
  2642. readonly TEXTURE3: number;
  2643. readonly TEXTURE30: number;
  2644. readonly TEXTURE31: number;
  2645. readonly TEXTURE4: number;
  2646. readonly TEXTURE5: number;
  2647. readonly TEXTURE6: number;
  2648. readonly TEXTURE7: number;
  2649. readonly TEXTURE8: number;
  2650. readonly TEXTURE9: number;
  2651. readonly TEXTURE_2D: number;
  2652. readonly TEXTURE_BINDING_2D: number;
  2653. readonly TEXTURE_BINDING_CUBE_MAP: number;
  2654. readonly TEXTURE_CUBE_MAP: number;
  2655. readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;
  2656. readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;
  2657. readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;
  2658. readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;
  2659. readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;
  2660. readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;
  2661. readonly TEXTURE_MAG_FILTER: number;
  2662. readonly TEXTURE_MIN_FILTER: number;
  2663. readonly TEXTURE_WRAP_S: number;
  2664. readonly TEXTURE_WRAP_T: number;
  2665. readonly TRIANGLES: number;
  2666. readonly TRIANGLE_FAN: number;
  2667. readonly TRIANGLE_STRIP: number;
  2668. readonly UNPACK_ALIGNMENT: number;
  2669. readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;
  2670. readonly UNPACK_FLIP_Y_WEBGL: number;
  2671. readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;
  2672. readonly UNSIGNED_BYTE: number;
  2673. readonly UNSIGNED_INT: number;
  2674. readonly UNSIGNED_SHORT: number;
  2675. readonly UNSIGNED_SHORT_4_4_4_4: number;
  2676. readonly UNSIGNED_SHORT_5_5_5_1: number;
  2677. readonly UNSIGNED_SHORT_5_6_5: number;
  2678. readonly VALIDATE_STATUS: number;
  2679. readonly VENDOR: number;
  2680. readonly VERSION: number;
  2681. readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;
  2682. readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;
  2683. readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;
  2684. readonly VERTEX_ATTRIB_ARRAY_POINTER: number;
  2685. readonly VERTEX_ATTRIB_ARRAY_SIZE: number;
  2686. readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;
  2687. readonly VERTEX_ATTRIB_ARRAY_TYPE: number;
  2688. readonly VERTEX_SHADER: number;
  2689. readonly VIEWPORT: number;
  2690. readonly ZERO: number;
  2691. readonly READ_BUFFER: number;
  2692. readonly UNPACK_ROW_LENGTH: number;
  2693. readonly UNPACK_SKIP_ROWS: number;
  2694. readonly UNPACK_SKIP_PIXELS: number;
  2695. readonly PACK_ROW_LENGTH: number;
  2696. readonly PACK_SKIP_ROWS: number;
  2697. readonly PACK_SKIP_PIXELS: number;
  2698. readonly COLOR: number;
  2699. readonly DEPTH: number;
  2700. readonly STENCIL: number;
  2701. readonly RED: number;
  2702. readonly RGB8: number;
  2703. readonly RGBA8: number;
  2704. readonly RGB10_A2: number;
  2705. readonly TEXTURE_BINDING_3D: number;
  2706. readonly UNPACK_SKIP_IMAGES: number;
  2707. readonly UNPACK_IMAGE_HEIGHT: number;
  2708. readonly TEXTURE_3D: number;
  2709. readonly TEXTURE_WRAP_R: number;
  2710. readonly MAX_3D_TEXTURE_SIZE: number;
  2711. readonly UNSIGNED_INT_2_10_10_10_REV: number;
  2712. readonly MAX_ELEMENTS_VERTICES: number;
  2713. readonly MAX_ELEMENTS_INDICES: number;
  2714. readonly TEXTURE_MIN_LOD: number;
  2715. readonly TEXTURE_MAX_LOD: number;
  2716. readonly TEXTURE_BASE_LEVEL: number;
  2717. readonly TEXTURE_MAX_LEVEL: number;
  2718. readonly MIN: number;
  2719. readonly MAX: number;
  2720. readonly DEPTH_COMPONENT24: number;
  2721. readonly MAX_TEXTURE_LOD_BIAS: number;
  2722. readonly TEXTURE_COMPARE_MODE: number;
  2723. readonly TEXTURE_COMPARE_FUNC: number;
  2724. readonly CURRENT_QUERY: number;
  2725. readonly QUERY_RESULT: number;
  2726. readonly QUERY_RESULT_AVAILABLE: number;
  2727. readonly STREAM_READ: number;
  2728. readonly STREAM_COPY: number;
  2729. readonly STATIC_READ: number;
  2730. readonly STATIC_COPY: number;
  2731. readonly DYNAMIC_READ: number;
  2732. readonly DYNAMIC_COPY: number;
  2733. readonly MAX_DRAW_BUFFERS: number;
  2734. readonly DRAW_BUFFER0: number;
  2735. readonly DRAW_BUFFER1: number;
  2736. readonly DRAW_BUFFER2: number;
  2737. readonly DRAW_BUFFER3: number;
  2738. readonly DRAW_BUFFER4: number;
  2739. readonly DRAW_BUFFER5: number;
  2740. readonly DRAW_BUFFER6: number;
  2741. readonly DRAW_BUFFER7: number;
  2742. readonly DRAW_BUFFER8: number;
  2743. readonly DRAW_BUFFER9: number;
  2744. readonly DRAW_BUFFER10: number;
  2745. readonly DRAW_BUFFER11: number;
  2746. readonly DRAW_BUFFER12: number;
  2747. readonly DRAW_BUFFER13: number;
  2748. readonly DRAW_BUFFER14: number;
  2749. readonly DRAW_BUFFER15: number;
  2750. readonly MAX_FRAGMENT_UNIFORM_COMPONENTS: number;
  2751. readonly MAX_VERTEX_UNIFORM_COMPONENTS: number;
  2752. readonly SAMPLER_3D: number;
  2753. readonly SAMPLER_2D_SHADOW: number;
  2754. readonly FRAGMENT_SHADER_DERIVATIVE_HINT: number;
  2755. readonly PIXEL_PACK_BUFFER: number;
  2756. readonly PIXEL_UNPACK_BUFFER: number;
  2757. readonly PIXEL_PACK_BUFFER_BINDING: number;
  2758. readonly PIXEL_UNPACK_BUFFER_BINDING: number;
  2759. readonly FLOAT_MAT2x3: number;
  2760. readonly FLOAT_MAT2x4: number;
  2761. readonly FLOAT_MAT3x2: number;
  2762. readonly FLOAT_MAT3x4: number;
  2763. readonly FLOAT_MAT4x2: number;
  2764. readonly FLOAT_MAT4x3: number;
  2765. readonly SRGB: number;
  2766. readonly SRGB8: number;
  2767. readonly SRGB8_ALPHA8: number;
  2768. readonly COMPARE_REF_TO_TEXTURE: number;
  2769. readonly RGBA32F: number;
  2770. readonly RGB32F: number;
  2771. readonly RGBA16F: number;
  2772. readonly RGB16F: number;
  2773. readonly VERTEX_ATTRIB_ARRAY_INTEGER: number;
  2774. readonly MAX_ARRAY_TEXTURE_LAYERS: number;
  2775. readonly MIN_PROGRAM_TEXEL_OFFSET: number;
  2776. readonly MAX_PROGRAM_TEXEL_OFFSET: number;
  2777. readonly MAX_VARYING_COMPONENTS: number;
  2778. readonly TEXTURE_2D_ARRAY: number;
  2779. readonly TEXTURE_BINDING_2D_ARRAY: number;
  2780. readonly R11F_G11F_B10F: number;
  2781. readonly UNSIGNED_INT_10F_11F_11F_REV: number;
  2782. readonly RGB9_E5: number;
  2783. readonly UNSIGNED_INT_5_9_9_9_REV: number;
  2784. readonly TRANSFORM_FEEDBACK_BUFFER_MODE: number;
  2785. readonly MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: number;
  2786. readonly TRANSFORM_FEEDBACK_VARYINGS: number;
  2787. readonly TRANSFORM_FEEDBACK_BUFFER_START: number;
  2788. readonly TRANSFORM_FEEDBACK_BUFFER_SIZE: number;
  2789. readonly TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: number;
  2790. readonly RASTERIZER_DISCARD: number;
  2791. readonly MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: number;
  2792. readonly MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: number;
  2793. readonly INTERLEAVED_ATTRIBS: number;
  2794. readonly SEPARATE_ATTRIBS: number;
  2795. readonly TRANSFORM_FEEDBACK_BUFFER: number;
  2796. readonly TRANSFORM_FEEDBACK_BUFFER_BINDING: number;
  2797. readonly RGBA32UI: number;
  2798. readonly RGB32UI: number;
  2799. readonly RGBA16UI: number;
  2800. readonly RGB16UI: number;
  2801. readonly RGBA8UI: number;
  2802. readonly RGB8UI: number;
  2803. readonly RGBA32I: number;
  2804. readonly RGB32I: number;
  2805. readonly RGBA16I: number;
  2806. readonly RGB16I: number;
  2807. readonly RGBA8I: number;
  2808. readonly RGB8I: number;
  2809. readonly RED_INTEGER: number;
  2810. readonly RGB_INTEGER: number;
  2811. readonly RGBA_INTEGER: number;
  2812. readonly SAMPLER_2D_ARRAY: number;
  2813. readonly SAMPLER_2D_ARRAY_SHADOW: number;
  2814. readonly SAMPLER_CUBE_SHADOW: number;
  2815. readonly UNSIGNED_INT_VEC2: number;
  2816. readonly UNSIGNED_INT_VEC3: number;
  2817. readonly UNSIGNED_INT_VEC4: number;
  2818. readonly INT_SAMPLER_2D: number;
  2819. readonly INT_SAMPLER_3D: number;
  2820. readonly INT_SAMPLER_CUBE: number;
  2821. readonly INT_SAMPLER_2D_ARRAY: number;
  2822. readonly UNSIGNED_INT_SAMPLER_2D: number;
  2823. readonly UNSIGNED_INT_SAMPLER_3D: number;
  2824. readonly UNSIGNED_INT_SAMPLER_CUBE: number;
  2825. readonly UNSIGNED_INT_SAMPLER_2D_ARRAY: number;
  2826. readonly DEPTH_COMPONENT32F: number;
  2827. readonly DEPTH32F_STENCIL8: number;
  2828. readonly FLOAT_32_UNSIGNED_INT_24_8_REV: number;
  2829. readonly FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: number;
  2830. readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: number;
  2831. readonly FRAMEBUFFER_ATTACHMENT_RED_SIZE: number;
  2832. readonly FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: number;
  2833. readonly FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: number;
  2834. readonly FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: number;
  2835. readonly FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: number;
  2836. readonly FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: number;
  2837. readonly FRAMEBUFFER_DEFAULT: number;
  2838. readonly UNSIGNED_INT_24_8: number;
  2839. readonly DEPTH24_STENCIL8: number;
  2840. readonly UNSIGNED_NORMALIZED: number;
  2841. readonly DRAW_FRAMEBUFFER_BINDING: number;
  2842. readonly READ_FRAMEBUFFER: number;
  2843. readonly DRAW_FRAMEBUFFER: number;
  2844. readonly READ_FRAMEBUFFER_BINDING: number;
  2845. readonly RENDERBUFFER_SAMPLES: number;
  2846. readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: number;
  2847. readonly MAX_COLOR_ATTACHMENTS: number;
  2848. readonly COLOR_ATTACHMENT1: number;
  2849. readonly COLOR_ATTACHMENT2: number;
  2850. readonly COLOR_ATTACHMENT3: number;
  2851. readonly COLOR_ATTACHMENT4: number;
  2852. readonly COLOR_ATTACHMENT5: number;
  2853. readonly COLOR_ATTACHMENT6: number;
  2854. readonly COLOR_ATTACHMENT7: number;
  2855. readonly COLOR_ATTACHMENT8: number;
  2856. readonly COLOR_ATTACHMENT9: number;
  2857. readonly COLOR_ATTACHMENT10: number;
  2858. readonly COLOR_ATTACHMENT11: number;
  2859. readonly COLOR_ATTACHMENT12: number;
  2860. readonly COLOR_ATTACHMENT13: number;
  2861. readonly COLOR_ATTACHMENT14: number;
  2862. readonly COLOR_ATTACHMENT15: number;
  2863. readonly FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: number;
  2864. readonly MAX_SAMPLES: number;
  2865. readonly HALF_FLOAT: number;
  2866. readonly RG: number;
  2867. readonly RG_INTEGER: number;
  2868. readonly R8: number;
  2869. readonly RG8: number;
  2870. readonly R16F: number;
  2871. readonly R32F: number;
  2872. readonly RG16F: number;
  2873. readonly RG32F: number;
  2874. readonly R8I: number;
  2875. readonly R8UI: number;
  2876. readonly R16I: number;
  2877. readonly R16UI: number;
  2878. readonly R32I: number;
  2879. readonly R32UI: number;
  2880. readonly RG8I: number;
  2881. readonly RG8UI: number;
  2882. readonly RG16I: number;
  2883. readonly RG16UI: number;
  2884. readonly RG32I: number;
  2885. readonly RG32UI: number;
  2886. readonly VERTEX_ARRAY_BINDING: number;
  2887. readonly R8_SNORM: number;
  2888. readonly RG8_SNORM: number;
  2889. readonly RGB8_SNORM: number;
  2890. readonly RGBA8_SNORM: number;
  2891. readonly SIGNED_NORMALIZED: number;
  2892. readonly COPY_READ_BUFFER: number;
  2893. readonly COPY_WRITE_BUFFER: number;
  2894. readonly COPY_READ_BUFFER_BINDING: number;
  2895. readonly COPY_WRITE_BUFFER_BINDING: number;
  2896. readonly UNIFORM_BUFFER: number;
  2897. readonly UNIFORM_BUFFER_BINDING: number;
  2898. readonly UNIFORM_BUFFER_START: number;
  2899. readonly UNIFORM_BUFFER_SIZE: number;
  2900. readonly MAX_VERTEX_UNIFORM_BLOCKS: number;
  2901. readonly MAX_FRAGMENT_UNIFORM_BLOCKS: number;
  2902. readonly MAX_COMBINED_UNIFORM_BLOCKS: number;
  2903. readonly MAX_UNIFORM_BUFFER_BINDINGS: number;
  2904. readonly MAX_UNIFORM_BLOCK_SIZE: number;
  2905. readonly MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: number;
  2906. readonly MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: number;
  2907. readonly UNIFORM_BUFFER_OFFSET_ALIGNMENT: number;
  2908. readonly ACTIVE_UNIFORM_BLOCKS: number;
  2909. readonly UNIFORM_TYPE: number;
  2910. readonly UNIFORM_SIZE: number;
  2911. readonly UNIFORM_BLOCK_INDEX: number;
  2912. readonly UNIFORM_OFFSET: number;
  2913. readonly UNIFORM_ARRAY_STRIDE: number;
  2914. readonly UNIFORM_MATRIX_STRIDE: number;
  2915. readonly UNIFORM_IS_ROW_MAJOR: number;
  2916. readonly UNIFORM_BLOCK_BINDING: number;
  2917. readonly UNIFORM_BLOCK_DATA_SIZE: number;
  2918. readonly UNIFORM_BLOCK_ACTIVE_UNIFORMS: number;
  2919. readonly UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: number;
  2920. readonly UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: number;
  2921. readonly UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: number;
  2922. readonly INVALID_INDEX: number;
  2923. readonly MAX_VERTEX_OUTPUT_COMPONENTS: number;
  2924. readonly MAX_FRAGMENT_INPUT_COMPONENTS: number;
  2925. readonly MAX_SERVER_WAIT_TIMEOUT: number;
  2926. readonly OBJECT_TYPE: number;
  2927. readonly SYNC_CONDITION: number;
  2928. readonly SYNC_STATUS: number;
  2929. readonly SYNC_FLAGS: number;
  2930. readonly SYNC_FENCE: number;
  2931. readonly SYNC_GPU_COMMANDS_COMPLETE: number;
  2932. readonly UNSIGNALED: number;
  2933. readonly SIGNALED: number;
  2934. readonly ALREADY_SIGNALED: number;
  2935. readonly TIMEOUT_EXPIRED: number;
  2936. readonly CONDITION_SATISFIED: number;
  2937. readonly WAIT_FAILED: number;
  2938. readonly SYNC_FLUSH_COMMANDS_BIT: number;
  2939. readonly VERTEX_ATTRIB_ARRAY_DIVISOR: number;
  2940. readonly ANY_SAMPLES_PASSED: number;
  2941. readonly ANY_SAMPLES_PASSED_CONSERVATIVE: number;
  2942. readonly SAMPLER_BINDING: number;
  2943. readonly RGB10_A2UI: number;
  2944. readonly INT_2_10_10_10_REV: number;
  2945. readonly TRANSFORM_FEEDBACK: number;
  2946. readonly TRANSFORM_FEEDBACK_PAUSED: number;
  2947. readonly TRANSFORM_FEEDBACK_ACTIVE: number;
  2948. readonly TRANSFORM_FEEDBACK_BINDING: number;
  2949. readonly TEXTURE_IMMUTABLE_FORMAT: number;
  2950. readonly MAX_ELEMENT_INDEX: number;
  2951. readonly TEXTURE_IMMUTABLE_LEVELS: number;
  2952. readonly TIMEOUT_IGNORED: number;
  2953. readonly MAX_CLIENT_WAIT_TIMEOUT_WEBGL: number;
  2954. };
  2955. interface WebGLQuery extends WebGLObject {
  2956. }
  2957. declare var WebGLQuery: {
  2958. prototype: WebGLQuery;
  2959. new (): WebGLQuery;
  2960. };
  2961. interface WebGLSampler extends WebGLObject {
  2962. }
  2963. declare var WebGLSampler: {
  2964. prototype: WebGLSampler;
  2965. new (): WebGLSampler;
  2966. };
  2967. interface WebGLSync extends WebGLObject {
  2968. }
  2969. declare var WebGLSync: {
  2970. prototype: WebGLSync;
  2971. new (): WebGLSync;
  2972. };
  2973. interface WebGLTransformFeedback extends WebGLObject {
  2974. }
  2975. declare var WebGLTransformFeedback: {
  2976. prototype: WebGLTransformFeedback;
  2977. new (): WebGLTransformFeedback;
  2978. };
  2979. interface WebGLVertexArrayObject extends WebGLObject {
  2980. }
  2981. declare var WebGLVertexArrayObject: {
  2982. prototype: WebGLVertexArrayObject;
  2983. new (): WebGLVertexArrayObject;
  2984. };
  2985. declare module BABYLON {
  2986. class Action {
  2987. triggerOptions: any;
  2988. trigger: number;
  2989. _actionManager: ActionManager;
  2990. private _nextActiveAction;
  2991. private _child;
  2992. private _condition;
  2993. private _triggerParameter;
  2994. constructor(triggerOptions: any, condition?: Condition);
  2995. _prepare(): void;
  2996. getTriggerParameter(): any;
  2997. _executeCurrent(evt: ActionEvent): void;
  2998. execute(evt: ActionEvent): void;
  2999. skipToNextActiveAction(): void;
  3000. then(action: Action): Action;
  3001. _getProperty(propertyPath: string): string;
  3002. _getEffectiveTarget(target: any, propertyPath: string): any;
  3003. serialize(parent: any): any;
  3004. protected _serialize(serializedAction: any, parent?: any): any;
  3005. static _SerializeValueAsString: (value: any) => string;
  3006. static _GetTargetProperty: (target: Scene | Node) => {
  3007. name: string;
  3008. targetType: string;
  3009. value: string;
  3010. };
  3011. }
  3012. }
  3013. declare module BABYLON {
  3014. /**
  3015. * ActionEvent is the event beint sent when an action is triggered.
  3016. */
  3017. class ActionEvent {
  3018. source: any;
  3019. pointerX: number;
  3020. pointerY: number;
  3021. meshUnderPointer: AbstractMesh;
  3022. sourceEvent: any;
  3023. additionalData: any;
  3024. /**
  3025. * @constructor
  3026. * @param source The mesh or sprite that triggered the action.
  3027. * @param pointerX The X mouse cursor position at the time of the event
  3028. * @param pointerY The Y mouse cursor position at the time of the event
  3029. * @param meshUnderPointer The mesh that is currently pointed at (can be null)
  3030. * @param sourceEvent the original (browser) event that triggered the ActionEvent
  3031. */
  3032. constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any);
  3033. /**
  3034. * Helper function to auto-create an ActionEvent from a source mesh.
  3035. * @param source The source mesh that triggered the event
  3036. * @param evt {Event} The original (browser) event
  3037. */
  3038. static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent;
  3039. /**
  3040. * Helper function to auto-create an ActionEvent from a source mesh.
  3041. * @param source The source sprite that triggered the event
  3042. * @param scene Scene associated with the sprite
  3043. * @param evt {Event} The original (browser) event
  3044. */
  3045. static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent;
  3046. /**
  3047. * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
  3048. * @param scene the scene where the event occurred
  3049. * @param evt {Event} The original (browser) event
  3050. */
  3051. static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent;
  3052. static CreateNewFromPrimitive(prim: any, pointerPos: Vector2, evt?: Event, additionalData?: any): ActionEvent;
  3053. }
  3054. /**
  3055. * Action Manager manages all events to be triggered on a given mesh or the global scene.
  3056. * A single scene can have many Action Managers to handle predefined actions on specific meshes.
  3057. */
  3058. class ActionManager {
  3059. private static _NothingTrigger;
  3060. private static _OnPickTrigger;
  3061. private static _OnLeftPickTrigger;
  3062. private static _OnRightPickTrigger;
  3063. private static _OnCenterPickTrigger;
  3064. private static _OnPickDownTrigger;
  3065. private static _OnDoublePickTrigger;
  3066. private static _OnPickUpTrigger;
  3067. private static _OnLongPressTrigger;
  3068. private static _OnPointerOverTrigger;
  3069. private static _OnPointerOutTrigger;
  3070. private static _OnEveryFrameTrigger;
  3071. private static _OnIntersectionEnterTrigger;
  3072. private static _OnIntersectionExitTrigger;
  3073. private static _OnKeyDownTrigger;
  3074. private static _OnKeyUpTrigger;
  3075. private static _OnPickOutTrigger;
  3076. static readonly NothingTrigger: number;
  3077. static readonly OnPickTrigger: number;
  3078. static readonly OnLeftPickTrigger: number;
  3079. static readonly OnRightPickTrigger: number;
  3080. static readonly OnCenterPickTrigger: number;
  3081. static readonly OnPickDownTrigger: number;
  3082. static readonly OnDoublePickTrigger: number;
  3083. static readonly OnPickUpTrigger: number;
  3084. static readonly OnPickOutTrigger: number;
  3085. static readonly OnLongPressTrigger: number;
  3086. static readonly OnPointerOverTrigger: number;
  3087. static readonly OnPointerOutTrigger: number;
  3088. static readonly OnEveryFrameTrigger: number;
  3089. static readonly OnIntersectionEnterTrigger: number;
  3090. static readonly OnIntersectionExitTrigger: number;
  3091. static readonly OnKeyDownTrigger: number;
  3092. static readonly OnKeyUpTrigger: number;
  3093. static Triggers: {};
  3094. actions: Action[];
  3095. hoverCursor: string;
  3096. private _scene;
  3097. constructor(scene: Scene);
  3098. dispose(): void;
  3099. getScene(): Scene;
  3100. /**
  3101. * Does this action manager handles actions of any of the given triggers
  3102. * @param {number[]} triggers - the triggers to be tested
  3103. * @return {boolean} whether one (or more) of the triggers is handeled
  3104. */
  3105. hasSpecificTriggers(triggers: number[]): boolean;
  3106. /**
  3107. * Does this action manager handles actions of a given trigger
  3108. * @param {number} trigger - the trigger to be tested
  3109. * @return {boolean} whether the trigger is handeled
  3110. */
  3111. hasSpecificTrigger(trigger: number): boolean;
  3112. /**
  3113. * Does this action manager has pointer triggers
  3114. * @return {boolean} whether or not it has pointer triggers
  3115. */
  3116. readonly hasPointerTriggers: boolean;
  3117. /**
  3118. * Does this action manager has pick triggers
  3119. * @return {boolean} whether or not it has pick triggers
  3120. */
  3121. readonly hasPickTriggers: boolean;
  3122. /**
  3123. * Does exist one action manager with at least one trigger
  3124. * @return {boolean} whether or not it exists one action manager with one trigger
  3125. **/
  3126. static readonly HasTriggers: boolean;
  3127. /**
  3128. * Does exist one action manager with at least one pick trigger
  3129. * @return {boolean} whether or not it exists one action manager with one pick trigger
  3130. **/
  3131. static readonly HasPickTriggers: boolean;
  3132. /**
  3133. * Does exist one action manager that handles actions of a given trigger
  3134. * @param {number} trigger - the trigger to be tested
  3135. * @return {boolean} whether the trigger is handeled by at least one action manager
  3136. **/
  3137. static HasSpecificTrigger(trigger: number): boolean;
  3138. /**
  3139. * Registers an action to this action manager
  3140. * @param {BABYLON.Action} action - the action to be registered
  3141. * @return {BABYLON.Action} the action amended (prepared) after registration
  3142. */
  3143. registerAction(action: Action): Action;
  3144. /**
  3145. * Process a specific trigger
  3146. * @param {number} trigger - the trigger to process
  3147. * @param evt {BABYLON.ActionEvent} the event details to be processed
  3148. */
  3149. processTrigger(trigger: number, evt: ActionEvent): void;
  3150. _getEffectiveTarget(target: any, propertyPath: string): any;
  3151. _getProperty(propertyPath: string): string;
  3152. serialize(name: string): any;
  3153. static Parse(parsedActions: any, object: AbstractMesh, scene: Scene): void;
  3154. static GetTriggerName(trigger: number): string;
  3155. }
  3156. }
  3157. declare module BABYLON {
  3158. class Condition {
  3159. _actionManager: ActionManager;
  3160. _evaluationId: number;
  3161. _currentResult: boolean;
  3162. constructor(actionManager: ActionManager);
  3163. isValid(): boolean;
  3164. _getProperty(propertyPath: string): string;
  3165. _getEffectiveTarget(target: any, propertyPath: string): any;
  3166. serialize(): any;
  3167. protected _serialize(serializedCondition: any): any;
  3168. }
  3169. class ValueCondition extends Condition {
  3170. propertyPath: string;
  3171. value: any;
  3172. operator: number;
  3173. private static _IsEqual;
  3174. private static _IsDifferent;
  3175. private static _IsGreater;
  3176. private static _IsLesser;
  3177. static readonly IsEqual: number;
  3178. static readonly IsDifferent: number;
  3179. static readonly IsGreater: number;
  3180. static readonly IsLesser: number;
  3181. _actionManager: ActionManager;
  3182. private _target;
  3183. private _effectiveTarget;
  3184. private _property;
  3185. constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number);
  3186. isValid(): boolean;
  3187. serialize(): any;
  3188. static GetOperatorName(operator: number): string;
  3189. }
  3190. class PredicateCondition extends Condition {
  3191. predicate: () => boolean;
  3192. _actionManager: ActionManager;
  3193. constructor(actionManager: ActionManager, predicate: () => boolean);
  3194. isValid(): boolean;
  3195. }
  3196. class StateCondition extends Condition {
  3197. value: string;
  3198. _actionManager: ActionManager;
  3199. private _target;
  3200. constructor(actionManager: ActionManager, target: any, value: string);
  3201. isValid(): boolean;
  3202. serialize(): any;
  3203. }
  3204. }
  3205. declare module BABYLON {
  3206. class SwitchBooleanAction extends Action {
  3207. propertyPath: string;
  3208. private _target;
  3209. private _effectiveTarget;
  3210. private _property;
  3211. constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
  3212. _prepare(): void;
  3213. execute(): void;
  3214. serialize(parent: any): any;
  3215. }
  3216. class SetStateAction extends Action {
  3217. value: string;
  3218. private _target;
  3219. constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
  3220. execute(): void;
  3221. serialize(parent: any): any;
  3222. }
  3223. class SetValueAction extends Action {
  3224. propertyPath: string;
  3225. value: any;
  3226. private _target;
  3227. private _effectiveTarget;
  3228. private _property;
  3229. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  3230. _prepare(): void;
  3231. execute(): void;
  3232. serialize(parent: any): any;
  3233. }
  3234. class IncrementValueAction extends Action {
  3235. propertyPath: string;
  3236. value: any;
  3237. private _target;
  3238. private _effectiveTarget;
  3239. private _property;
  3240. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  3241. _prepare(): void;
  3242. execute(): void;
  3243. serialize(parent: any): any;
  3244. }
  3245. class PlayAnimationAction extends Action {
  3246. from: number;
  3247. to: number;
  3248. loop: boolean;
  3249. private _target;
  3250. constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition);
  3251. _prepare(): void;
  3252. execute(): void;
  3253. serialize(parent: any): any;
  3254. }
  3255. class StopAnimationAction extends Action {
  3256. private _target;
  3257. constructor(triggerOptions: any, target: any, condition?: Condition);
  3258. _prepare(): void;
  3259. execute(): void;
  3260. serialize(parent: any): any;
  3261. }
  3262. class DoNothingAction extends Action {
  3263. constructor(triggerOptions?: any, condition?: Condition);
  3264. execute(): void;
  3265. serialize(parent: any): any;
  3266. }
  3267. class CombineAction extends Action {
  3268. children: Action[];
  3269. constructor(triggerOptions: any, children: Action[], condition?: Condition);
  3270. _prepare(): void;
  3271. execute(evt: ActionEvent): void;
  3272. serialize(parent: any): any;
  3273. }
  3274. class ExecuteCodeAction extends Action {
  3275. func: (evt: ActionEvent) => void;
  3276. constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
  3277. execute(evt: ActionEvent): void;
  3278. }
  3279. class SetParentAction extends Action {
  3280. private _parent;
  3281. private _target;
  3282. constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
  3283. _prepare(): void;
  3284. execute(): void;
  3285. serialize(parent: any): any;
  3286. }
  3287. class PlaySoundAction extends Action {
  3288. private _sound;
  3289. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  3290. _prepare(): void;
  3291. execute(): void;
  3292. serialize(parent: any): any;
  3293. }
  3294. class StopSoundAction extends Action {
  3295. private _sound;
  3296. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  3297. _prepare(): void;
  3298. execute(): void;
  3299. serialize(parent: any): any;
  3300. }
  3301. }
  3302. declare module BABYLON {
  3303. class InterpolateValueAction extends Action {
  3304. propertyPath: string;
  3305. value: any;
  3306. duration: number;
  3307. stopOtherAnimations: boolean;
  3308. onInterpolationDone: () => void;
  3309. private _target;
  3310. private _effectiveTarget;
  3311. private _property;
  3312. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean, onInterpolationDone?: () => void);
  3313. _prepare(): void;
  3314. execute(): void;
  3315. serialize(parent: any): any;
  3316. }
  3317. }
  3318. declare module BABYLON {
  3319. class Animatable {
  3320. target: any;
  3321. fromFrame: number;
  3322. toFrame: number;
  3323. loopAnimation: boolean;
  3324. speedRatio: number;
  3325. onAnimationEnd: any;
  3326. private _localDelayOffset;
  3327. private _pausedDelay;
  3328. private _animations;
  3329. private _paused;
  3330. private _scene;
  3331. animationStarted: boolean;
  3332. constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any);
  3333. getAnimations(): Animation[];
  3334. appendAnimations(target: any, animations: Animation[]): void;
  3335. getAnimationByTargetProperty(property: string): Animation;
  3336. reset(): void;
  3337. enableBlending(blendingSpeed: number): void;
  3338. disableBlending(): void;
  3339. goToFrame(frame: number): void;
  3340. pause(): void;
  3341. restart(): void;
  3342. stop(animationName?: string): void;
  3343. _animate(delay: number): boolean;
  3344. }
  3345. }
  3346. declare module BABYLON {
  3347. class AnimationRange {
  3348. name: string;
  3349. from: number;
  3350. to: number;
  3351. constructor(name: string, from: number, to: number);
  3352. clone(): AnimationRange;
  3353. }
  3354. /**
  3355. * Composed of a frame, and an action function
  3356. */
  3357. class AnimationEvent {
  3358. frame: number;
  3359. action: () => void;
  3360. onlyOnce: boolean;
  3361. isDone: boolean;
  3362. constructor(frame: number, action: () => void, onlyOnce?: boolean);
  3363. }
  3364. class PathCursor {
  3365. private path;
  3366. private _onchange;
  3367. value: number;
  3368. animations: Animation[];
  3369. constructor(path: Path2);
  3370. getPoint(): Vector3;
  3371. moveAhead(step?: number): PathCursor;
  3372. moveBack(step?: number): PathCursor;
  3373. move(step: number): PathCursor;
  3374. private ensureLimits();
  3375. private markAsDirty(propertyName);
  3376. private raiseOnChange();
  3377. onchange(f: (cursor: PathCursor) => void): PathCursor;
  3378. }
  3379. class Animation {
  3380. name: string;
  3381. targetProperty: string;
  3382. framePerSecond: number;
  3383. dataType: number;
  3384. loopMode: number;
  3385. enableBlending: boolean;
  3386. private _keys;
  3387. private _offsetsCache;
  3388. private _highLimitsCache;
  3389. private _stopped;
  3390. _target: any;
  3391. private _blendingFactor;
  3392. private _easingFunction;
  3393. private _events;
  3394. targetPropertyPath: string[];
  3395. currentFrame: number;
  3396. allowMatricesInterpolation: boolean;
  3397. blendingSpeed: number;
  3398. private _originalBlendValue;
  3399. private _ranges;
  3400. static _PrepareAnimation(name: string, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction): Animation;
  3401. static CreateAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  3402. static CreateMergeAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  3403. constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number, enableBlending?: boolean);
  3404. /**
  3405. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  3406. */
  3407. toString(fullDetails?: boolean): string;
  3408. /**
  3409. * Add an event to this animation.
  3410. */
  3411. addEvent(event: AnimationEvent): void;
  3412. /**
  3413. * Remove all events found at the given frame
  3414. * @param frame
  3415. */
  3416. removeEvents(frame: number): void;
  3417. createRange(name: string, from: number, to: number): void;
  3418. deleteRange(name: string, deleteFrames?: boolean): void;
  3419. getRange(name: string): AnimationRange;
  3420. reset(): void;
  3421. isStopped(): boolean;
  3422. getKeys(): Array<{
  3423. frame: number;
  3424. value: any;
  3425. }>;
  3426. getHighestFrame(): number;
  3427. getEasingFunction(): IEasingFunction;
  3428. setEasingFunction(easingFunction: EasingFunction): void;
  3429. floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
  3430. floatInterpolateFunctionWithTangents(startValue: number, outTangent: number, endValue: number, inTangent: number, gradient: number): number;
  3431. quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
  3432. quaternionInterpolateFunctionWithTangents(startValue: Quaternion, outTangent: Quaternion, endValue: Quaternion, inTangent: Quaternion, gradient: number): Quaternion;
  3433. vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
  3434. vector3InterpolateFunctionWithTangents(startValue: Vector3, outTangent: Vector3, endValue: Vector3, inTangent: Vector3, gradient: number): Vector3;
  3435. vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2;
  3436. vector2InterpolateFunctionWithTangents(startValue: Vector2, outTangent: Vector2, endValue: Vector2, inTangent: Vector2, gradient: number): Vector2;
  3437. sizeInterpolateFunction(startValue: Size, endValue: Size, gradient: number): Size;
  3438. color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
  3439. matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  3440. clone(): Animation;
  3441. setKeys(values: Array<{
  3442. frame: number;
  3443. value: any;
  3444. }>): void;
  3445. private _getKeyValue(value);
  3446. private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?);
  3447. setValue(currentValue: any, blend?: boolean): void;
  3448. goToFrame(frame: number): void;
  3449. animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, blend?: boolean): boolean;
  3450. serialize(): any;
  3451. private static _ANIMATIONTYPE_FLOAT;
  3452. private static _ANIMATIONTYPE_VECTOR3;
  3453. private static _ANIMATIONTYPE_QUATERNION;
  3454. private static _ANIMATIONTYPE_MATRIX;
  3455. private static _ANIMATIONTYPE_COLOR3;
  3456. private static _ANIMATIONTYPE_VECTOR2;
  3457. private static _ANIMATIONTYPE_SIZE;
  3458. private static _ANIMATIONLOOPMODE_RELATIVE;
  3459. private static _ANIMATIONLOOPMODE_CYCLE;
  3460. private static _ANIMATIONLOOPMODE_CONSTANT;
  3461. static readonly ANIMATIONTYPE_FLOAT: number;
  3462. static readonly ANIMATIONTYPE_VECTOR3: number;
  3463. static readonly ANIMATIONTYPE_VECTOR2: number;
  3464. static readonly ANIMATIONTYPE_SIZE: number;
  3465. static readonly ANIMATIONTYPE_QUATERNION: number;
  3466. static readonly ANIMATIONTYPE_MATRIX: number;
  3467. static readonly ANIMATIONTYPE_COLOR3: number;
  3468. static readonly ANIMATIONLOOPMODE_RELATIVE: number;
  3469. static readonly ANIMATIONLOOPMODE_CYCLE: number;
  3470. static readonly ANIMATIONLOOPMODE_CONSTANT: number;
  3471. static Parse(parsedAnimation: any): Animation;
  3472. static AppendSerializedAnimations(source: IAnimatable, destination: any): any;
  3473. }
  3474. }
  3475. declare module BABYLON {
  3476. interface IEasingFunction {
  3477. ease(gradient: number): number;
  3478. }
  3479. class EasingFunction implements IEasingFunction {
  3480. private static _EASINGMODE_EASEIN;
  3481. private static _EASINGMODE_EASEOUT;
  3482. private static _EASINGMODE_EASEINOUT;
  3483. static readonly EASINGMODE_EASEIN: number;
  3484. static readonly EASINGMODE_EASEOUT: number;
  3485. static readonly EASINGMODE_EASEINOUT: number;
  3486. private _easingMode;
  3487. setEasingMode(easingMode: number): void;
  3488. getEasingMode(): number;
  3489. easeInCore(gradient: number): number;
  3490. ease(gradient: number): number;
  3491. }
  3492. class CircleEase extends EasingFunction implements IEasingFunction {
  3493. easeInCore(gradient: number): number;
  3494. }
  3495. class BackEase extends EasingFunction implements IEasingFunction {
  3496. amplitude: number;
  3497. constructor(amplitude?: number);
  3498. easeInCore(gradient: number): number;
  3499. }
  3500. class BounceEase extends EasingFunction implements IEasingFunction {
  3501. bounces: number;
  3502. bounciness: number;
  3503. constructor(bounces?: number, bounciness?: number);
  3504. easeInCore(gradient: number): number;
  3505. }
  3506. class CubicEase extends EasingFunction implements IEasingFunction {
  3507. easeInCore(gradient: number): number;
  3508. }
  3509. class ElasticEase extends EasingFunction implements IEasingFunction {
  3510. oscillations: number;
  3511. springiness: number;
  3512. constructor(oscillations?: number, springiness?: number);
  3513. easeInCore(gradient: number): number;
  3514. }
  3515. class ExponentialEase extends EasingFunction implements IEasingFunction {
  3516. exponent: number;
  3517. constructor(exponent?: number);
  3518. easeInCore(gradient: number): number;
  3519. }
  3520. class PowerEase extends EasingFunction implements IEasingFunction {
  3521. power: number;
  3522. constructor(power?: number);
  3523. easeInCore(gradient: number): number;
  3524. }
  3525. class QuadraticEase extends EasingFunction implements IEasingFunction {
  3526. easeInCore(gradient: number): number;
  3527. }
  3528. class QuarticEase extends EasingFunction implements IEasingFunction {
  3529. easeInCore(gradient: number): number;
  3530. }
  3531. class QuinticEase extends EasingFunction implements IEasingFunction {
  3532. easeInCore(gradient: number): number;
  3533. }
  3534. class SineEase extends EasingFunction implements IEasingFunction {
  3535. easeInCore(gradient: number): number;
  3536. }
  3537. class BezierCurveEase extends EasingFunction implements IEasingFunction {
  3538. x1: number;
  3539. y1: number;
  3540. x2: number;
  3541. y2: number;
  3542. constructor(x1?: number, y1?: number, x2?: number, y2?: number);
  3543. easeInCore(gradient: number): number;
  3544. }
  3545. }
  3546. declare module BABYLON {
  3547. class Analyser {
  3548. SMOOTHING: number;
  3549. FFT_SIZE: number;
  3550. BARGRAPHAMPLITUDE: number;
  3551. DEBUGCANVASPOS: {
  3552. x: number;
  3553. y: number;
  3554. };
  3555. DEBUGCANVASSIZE: {
  3556. width: number;
  3557. height: number;
  3558. };
  3559. private _byteFreqs;
  3560. private _byteTime;
  3561. private _floatFreqs;
  3562. private _webAudioAnalyser;
  3563. private _debugCanvas;
  3564. private _debugCanvasContext;
  3565. private _scene;
  3566. private _registerFunc;
  3567. private _audioEngine;
  3568. constructor(scene: Scene);
  3569. getFrequencyBinCount(): number;
  3570. getByteFrequencyData(): Uint8Array;
  3571. getByteTimeDomainData(): Uint8Array;
  3572. getFloatFrequencyData(): Uint8Array;
  3573. drawDebugCanvas(): void;
  3574. stopDebugCanvas(): void;
  3575. connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void;
  3576. dispose(): void;
  3577. }
  3578. }
  3579. declare module BABYLON {
  3580. class AudioEngine {
  3581. private _audioContext;
  3582. private _audioContextInitialized;
  3583. canUseWebAudio: boolean;
  3584. masterGain: GainNode;
  3585. private _connectedAnalyser;
  3586. WarnedWebAudioUnsupported: boolean;
  3587. unlocked: boolean;
  3588. onAudioUnlocked: () => any;
  3589. isMP3supported: boolean;
  3590. isOGGsupported: boolean;
  3591. readonly audioContext: AudioContext;
  3592. constructor();
  3593. private _unlockiOSaudio();
  3594. private _initializeAudioContext();
  3595. dispose(): void;
  3596. getGlobalVolume(): number;
  3597. setGlobalVolume(newVolume: number): void;
  3598. connectToAnalyser(analyser: Analyser): void;
  3599. }
  3600. }
  3601. declare module BABYLON {
  3602. class Sound {
  3603. name: string;
  3604. autoplay: boolean;
  3605. loop: boolean;
  3606. useCustomAttenuation: boolean;
  3607. soundTrackId: number;
  3608. spatialSound: boolean;
  3609. refDistance: number;
  3610. rolloffFactor: number;
  3611. maxDistance: number;
  3612. distanceModel: string;
  3613. private _panningModel;
  3614. onended: () => any;
  3615. private _playbackRate;
  3616. private _streaming;
  3617. private _startTime;
  3618. private _startOffset;
  3619. private _position;
  3620. private _localDirection;
  3621. private _volume;
  3622. private _isLoaded;
  3623. private _isReadyToPlay;
  3624. isPlaying: boolean;
  3625. isPaused: boolean;
  3626. private _isDirectional;
  3627. private _readyToPlayCallback;
  3628. private _audioBuffer;
  3629. private _soundSource;
  3630. private _streamingSource;
  3631. private _soundPanner;
  3632. private _soundGain;
  3633. private _inputAudioNode;
  3634. private _ouputAudioNode;
  3635. private _coneInnerAngle;
  3636. private _coneOuterAngle;
  3637. private _coneOuterGain;
  3638. private _scene;
  3639. private _connectedMesh;
  3640. private _customAttenuationFunction;
  3641. private _registerFunc;
  3642. private _isOutputConnected;
  3643. private _htmlAudioElement;
  3644. private _urlType;
  3645. /**
  3646. * Create a sound and attach it to a scene
  3647. * @param name Name of your sound
  3648. * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer
  3649. * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played
  3650. * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming
  3651. */
  3652. constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any);
  3653. dispose(): void;
  3654. isReady(): boolean;
  3655. private _soundLoaded(audioData);
  3656. setAudioBuffer(audioBuffer: AudioBuffer): void;
  3657. updateOptions(options: any): void;
  3658. private _createSpatialParameters();
  3659. private _updateSpatialParameters();
  3660. switchPanningModelToHRTF(): void;
  3661. switchPanningModelToEqualPower(): void;
  3662. private _switchPanningModel();
  3663. connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void;
  3664. /**
  3665. * Transform this sound into a directional source
  3666. * @param coneInnerAngle Size of the inner cone in degree
  3667. * @param coneOuterAngle Size of the outer cone in degree
  3668. * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)
  3669. */
  3670. setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void;
  3671. setPosition(newPosition: Vector3): void;
  3672. setLocalDirectionToMesh(newLocalDirection: Vector3): void;
  3673. private _updateDirection();
  3674. updateDistanceFromListener(): void;
  3675. setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void;
  3676. /**
  3677. * Play the sound
  3678. * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
  3679. * @param offset (optional) Start the sound setting it at a specific time
  3680. */
  3681. play(time?: number, offset?: number): void;
  3682. private _onended();
  3683. /**
  3684. * Stop the sound
  3685. * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.
  3686. */
  3687. stop(time?: number): void;
  3688. pause(): void;
  3689. setVolume(newVolume: number, time?: number): void;
  3690. setPlaybackRate(newPlaybackRate: number): void;
  3691. getVolume(): number;
  3692. attachToMesh(meshToConnectTo: AbstractMesh): void;
  3693. detachFromMesh(): void;
  3694. private _onRegisterAfterWorldMatrixUpdate(connectedMesh);
  3695. clone(): Sound;
  3696. getAudioBuffer(): AudioBuffer;
  3697. serialize(): any;
  3698. static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound;
  3699. }
  3700. }
  3701. declare module BABYLON {
  3702. class SoundTrack {
  3703. private _outputAudioNode;
  3704. private _inputAudioNode;
  3705. private _trackConvolver;
  3706. private _scene;
  3707. id: number;
  3708. soundCollection: Array<Sound>;
  3709. private _isMainTrack;
  3710. private _connectedAnalyser;
  3711. private _options;
  3712. private _isInitialized;
  3713. constructor(scene: Scene, options?: any);
  3714. private _initializeSoundTrackAudioGraph();
  3715. dispose(): void;
  3716. AddSound(sound: Sound): void;
  3717. RemoveSound(sound: Sound): void;
  3718. setVolume(newVolume: number): void;
  3719. switchPanningModelToHRTF(): void;
  3720. switchPanningModelToEqualPower(): void;
  3721. connectToAnalyser(analyser: Analyser): void;
  3722. }
  3723. }
  3724. declare module BABYLON {
  3725. class Bone extends Node {
  3726. name: string;
  3727. private static _tmpVecs;
  3728. private static _tmpQuat;
  3729. private static _tmpMats;
  3730. children: Bone[];
  3731. animations: Animation[];
  3732. length: number;
  3733. private _skeleton;
  3734. private _localMatrix;
  3735. private _restPose;
  3736. private _baseMatrix;
  3737. private _worldTransform;
  3738. private _absoluteTransform;
  3739. private _invertedAbsoluteTransform;
  3740. private _parent;
  3741. private _scaleMatrix;
  3742. private _scaleVector;
  3743. private _negateScaleChildren;
  3744. private _scalingDeterminant;
  3745. _matrix: Matrix;
  3746. constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix, restPose?: Matrix);
  3747. getParent(): Bone;
  3748. getLocalMatrix(): Matrix;
  3749. getBaseMatrix(): Matrix;
  3750. getRestPose(): Matrix;
  3751. returnToRest(): void;
  3752. getWorldMatrix(): Matrix;
  3753. getInvertedAbsoluteTransform(): Matrix;
  3754. getAbsoluteTransform(): Matrix;
  3755. position: Vector3;
  3756. rotation: Vector3;
  3757. rotationQuaternion: Quaternion;
  3758. scaling: Vector3;
  3759. updateMatrix(matrix: Matrix, updateDifferenceMatrix?: boolean): void;
  3760. _updateDifferenceMatrix(rootMatrix?: Matrix): void;
  3761. markAsDirty(): void;
  3762. copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired?: boolean, skelDimensionsRatio?: Vector3): boolean;
  3763. /**
  3764. * Translate the bone in local or world space.
  3765. * @param vec The amount to translate the bone.
  3766. * @param space The space that the translation is in.
  3767. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3768. */
  3769. translate(vec: Vector3, space?: Space, mesh?: AbstractMesh): void;
  3770. /**
  3771. * Set the postion of the bone in local or world space.
  3772. * @param position The position to set the bone.
  3773. * @param space The space that the position is in.
  3774. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3775. */
  3776. setPosition(position: Vector3, space?: Space, mesh?: AbstractMesh): void;
  3777. /**
  3778. * Set the absolute postion of the bone (world space).
  3779. * @param position The position to set the bone.
  3780. * @param mesh The mesh that this bone is attached to.
  3781. */
  3782. setAbsolutePosition(position: Vector3, mesh?: AbstractMesh): void;
  3783. /**
  3784. * Set the scale of the bone on the x, y and z axes.
  3785. * @param x The scale of the bone on the x axis.
  3786. * @param x The scale of the bone on the y axis.
  3787. * @param z The scale of the bone on the z axis.
  3788. * @param scaleChildren Set this to true if children of the bone should be scaled.
  3789. */
  3790. setScale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  3791. /**
  3792. * Scale the bone on the x, y and z axes.
  3793. * @param x The amount to scale the bone on the x axis.
  3794. * @param x The amount to scale the bone on the y axis.
  3795. * @param z The amount to scale the bone on the z axis.
  3796. * @param scaleChildren Set this to true if children of the bone should be scaled.
  3797. */
  3798. scale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  3799. /**
  3800. * Set the yaw, pitch, and roll of the bone in local or world space.
  3801. * @param yaw The rotation of the bone on the y axis.
  3802. * @param pitch The rotation of the bone on the x axis.
  3803. * @param roll The rotation of the bone on the z axis.
  3804. * @param space The space that the axes of rotation are in.
  3805. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3806. */
  3807. setYawPitchRoll(yaw: number, pitch: number, roll: number, space?: Space, mesh?: AbstractMesh): void;
  3808. /**
  3809. * Rotate the bone on an axis in local or world space.
  3810. * @param axis The axis to rotate the bone on.
  3811. * @param amount The amount to rotate the bone.
  3812. * @param space The space that the axis is in.
  3813. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3814. */
  3815. rotate(axis: Vector3, amount: number, space?: Space, mesh?: AbstractMesh): void;
  3816. /**
  3817. * Set the rotation of the bone to a particular axis angle in local or world space.
  3818. * @param axis The axis to rotate the bone on.
  3819. * @param angle The angle that the bone should be rotated to.
  3820. * @param space The space that the axis is in.
  3821. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3822. */
  3823. setAxisAngle(axis: Vector3, angle: number, space?: Space, mesh?: AbstractMesh): void;
  3824. /**
  3825. * Set the euler rotation of the bone in local of world space.
  3826. * @param rotation The euler rotation that the bone should be set to.
  3827. * @param space The space that the rotation is in.
  3828. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3829. */
  3830. setRotation(rotation: Vector3, space?: Space, mesh?: AbstractMesh): void;
  3831. /**
  3832. * Set the quaternion rotation of the bone in local of world space.
  3833. * @param quat The quaternion rotation that the bone should be set to.
  3834. * @param space The space that the rotation is in.
  3835. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3836. */
  3837. setRotationQuaternion(quat: Quaternion, space?: Space, mesh?: AbstractMesh): void;
  3838. /**
  3839. * Set the rotation matrix of the bone in local of world space.
  3840. * @param rotMat The rotation matrix that the bone should be set to.
  3841. * @param space The space that the rotation is in.
  3842. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3843. */
  3844. setRotationMatrix(rotMat: Matrix, space?: Space, mesh?: AbstractMesh): void;
  3845. private _rotateWithMatrix(rmat, space?, mesh?);
  3846. private _getNegativeRotationToRef(rotMatInv, space?, mesh?);
  3847. /**
  3848. * Get the scale of the bone
  3849. * @returns the scale of the bone
  3850. */
  3851. getScale(): Vector3;
  3852. /**
  3853. * Copy the scale of the bone to a vector3.
  3854. * @param result The vector3 to copy the scale to
  3855. */
  3856. getScaleToRef(result: Vector3): void;
  3857. /**
  3858. * Get the position of the bone in local or world space.
  3859. * @param space The space that the returned position is in.
  3860. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3861. * @returns The position of the bone
  3862. */
  3863. getPosition(space?: Space, mesh?: AbstractMesh): Vector3;
  3864. /**
  3865. * Copy the position of the bone to a vector3 in local or world space.
  3866. * @param space The space that the returned position is in.
  3867. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3868. * @param result The vector3 to copy the position to.
  3869. */
  3870. getPositionToRef(space: Space, mesh: AbstractMesh, result: Vector3): void;
  3871. /**
  3872. * Get the absolute position of the bone (world space).
  3873. * @param mesh The mesh that this bone is attached to.
  3874. * @returns The absolute position of the bone
  3875. */
  3876. getAbsolutePosition(mesh?: AbstractMesh): Vector3;
  3877. /**
  3878. * Copy the absolute position of the bone (world space) to the result param.
  3879. * @param mesh The mesh that this bone is attached to.
  3880. * @param result The vector3 to copy the absolute position to.
  3881. */
  3882. getAbsolutePositionToRef(mesh: AbstractMesh, result: Vector3): void;
  3883. /**
  3884. * Compute the absolute transforms of this bone and its children.
  3885. */
  3886. computeAbsoluteTransforms(): void;
  3887. private _syncScaleVector();
  3888. /**
  3889. * Get the world direction from an axis that is in the local space of the bone.
  3890. * @param localAxis The local direction that is used to compute the world direction.
  3891. * @param mesh The mesh that this bone is attached to.
  3892. * @returns The world direction
  3893. */
  3894. getDirection(localAxis: Vector3, mesh?: AbstractMesh): Vector3;
  3895. /**
  3896. * Copy the world direction to a vector3 from an axis that is in the local space of the bone.
  3897. * @param localAxis The local direction that is used to compute the world direction.
  3898. * @param mesh The mesh that this bone is attached to.
  3899. * @param result The vector3 that the world direction will be copied to.
  3900. */
  3901. getDirectionToRef(localAxis: Vector3, mesh: AbstractMesh, result: Vector3): void;
  3902. /**
  3903. * Get the euler rotation of the bone in local or world space.
  3904. * @param space The space that the rotation should be in.
  3905. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3906. * @returns The euler rotation
  3907. */
  3908. getRotation(space?: Space, mesh?: AbstractMesh): Vector3;
  3909. /**
  3910. * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space.
  3911. * @param space The space that the rotation should be in.
  3912. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3913. * @param result The vector3 that the rotation should be copied to.
  3914. */
  3915. getRotationToRef(space: Space, mesh: AbstractMesh, result: Vector3): void;
  3916. /**
  3917. * Get the quaternion rotation of the bone in either local or world space.
  3918. * @param space The space that the rotation should be in.
  3919. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3920. * @returns The quaternion rotation
  3921. */
  3922. getRotationQuaternion(space?: Space, mesh?: AbstractMesh): Quaternion;
  3923. /**
  3924. * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space.
  3925. * @param space The space that the rotation should be in.
  3926. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3927. * @param result The quaternion that the rotation should be copied to.
  3928. */
  3929. getRotationQuaternionToRef(space: Space, mesh: AbstractMesh, result: Quaternion): void;
  3930. /**
  3931. * Get the rotation matrix of the bone in local or world space.
  3932. * @param space The space that the rotation should be in.
  3933. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3934. * @returns The rotation matrix
  3935. */
  3936. getRotationMatrix(space: Space, mesh: AbstractMesh): Matrix;
  3937. /**
  3938. * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space.
  3939. * @param space The space that the rotation should be in.
  3940. * @param mesh The mesh that this bone is attached to. This is only used in world space.
  3941. * @param result The quaternion that the rotation should be copied to.
  3942. */
  3943. getRotationMatrixToRef(space: Space, mesh: AbstractMesh, result: Matrix): void;
  3944. /**
  3945. * Get the world position of a point that is in the local space of the bone.
  3946. * @param position The local position
  3947. * @param mesh The mesh that this bone is attached to.
  3948. * @returns The world position
  3949. */
  3950. getAbsolutePositionFromLocal(position: Vector3, mesh?: AbstractMesh): Vector3;
  3951. /**
  3952. * Get the world position of a point that is in the local space of the bone and copy it to the result param.
  3953. * @param position The local position
  3954. * @param mesh The mesh that this bone is attached to.
  3955. * @param result The vector3 that the world position should be copied to.
  3956. */
  3957. getAbsolutePositionFromLocalToRef(position: Vector3, mesh: AbstractMesh, result: Vector3): void;
  3958. /**
  3959. * Get the local position of a point that is in world space.
  3960. * @param position The world position
  3961. * @param mesh The mesh that this bone is attached to.
  3962. * @returns The local position
  3963. */
  3964. getLocalPositionFromAbsolute(position: Vector3, mesh?: AbstractMesh): Vector3;
  3965. /**
  3966. * Get the local position of a point that is in world space and copy it to the result param.
  3967. * @param position The world position
  3968. * @param mesh The mesh that this bone is attached to.
  3969. * @param result The vector3 that the local position should be copied to.
  3970. */
  3971. getLocalPositionFromAbsoluteToRef(position: Vector3, mesh: AbstractMesh, result: Vector3): void;
  3972. }
  3973. }
  3974. declare module BABYLON {
  3975. class BoneIKController {
  3976. private static _tmpVecs;
  3977. private static _tmpQuat;
  3978. private static _tmpMats;
  3979. targetMesh: AbstractMesh;
  3980. poleTargetMesh: AbstractMesh;
  3981. poleTargetBone: Bone;
  3982. targetPosition: Vector3;
  3983. poleTargetPosition: Vector3;
  3984. poleTargetLocalOffset: Vector3;
  3985. poleAngle: number;
  3986. mesh: AbstractMesh;
  3987. slerpAmount: number;
  3988. private _bone1Quat;
  3989. private _bone1Mat;
  3990. private _bone2Ang;
  3991. private _bone1;
  3992. private _bone2;
  3993. private _bone1Length;
  3994. private _bone2Length;
  3995. private _maxAngle;
  3996. private _maxReach;
  3997. private _rightHandedSystem;
  3998. private _bendAxis;
  3999. private _slerping;
  4000. private _adjustRoll;
  4001. maxAngle: number;
  4002. constructor(mesh: AbstractMesh, bone: Bone, options?: {
  4003. targetMesh?: AbstractMesh;
  4004. poleTargetMesh?: AbstractMesh;
  4005. poleTargetBone?: Bone;
  4006. poleTargetLocalOffset?: Vector3;
  4007. poleAngle?: number;
  4008. bendAxis?: Vector3;
  4009. maxAngle?: number;
  4010. slerpAmount?: number;
  4011. });
  4012. private _setMaxAngle(ang);
  4013. update(): void;
  4014. }
  4015. }
  4016. declare module BABYLON {
  4017. class BoneLookController {
  4018. private static _tmpVecs;
  4019. private static _tmpQuat;
  4020. private static _tmpMats;
  4021. /**
  4022. * The target Vector3 that the bone will look at.
  4023. */
  4024. target: Vector3;
  4025. /**
  4026. * The mesh that the bone is attached to.
  4027. */
  4028. mesh: AbstractMesh;
  4029. /**
  4030. * The bone that will be looking to the target.
  4031. */
  4032. bone: Bone;
  4033. /**
  4034. * The up axis of the coordinate system that is used when the bone is rotated.
  4035. */
  4036. upAxis: Vector3;
  4037. /**
  4038. * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
  4039. */
  4040. upAxisSpace: Space;
  4041. /**
  4042. * Used to make an adjustment to the yaw of the bone.
  4043. */
  4044. adjustYaw: number;
  4045. /**
  4046. * Used to make an adjustment to the pitch of the bone.
  4047. */
  4048. adjustPitch: number;
  4049. /**
  4050. * Used to make an adjustment to the roll of the bone.
  4051. */
  4052. adjustRoll: number;
  4053. /**
  4054. * 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).
  4055. */
  4056. slerpAmount: number;
  4057. private _minYaw;
  4058. private _maxYaw;
  4059. private _minPitch;
  4060. private _maxPitch;
  4061. private _minYawSin;
  4062. private _minYawCos;
  4063. private _maxYawSin;
  4064. private _maxYawCos;
  4065. private _midYawConstraint;
  4066. private _minPitchTan;
  4067. private _maxPitchTan;
  4068. private _boneQuat;
  4069. private _slerping;
  4070. private _transformYawPitch;
  4071. private _transformYawPitchInv;
  4072. private _firstFrameSkipped;
  4073. private _yawRange;
  4074. private _fowardAxis;
  4075. /**
  4076. * Get/set the minimum yaw angle that the bone can look to.
  4077. */
  4078. minYaw: number;
  4079. /**
  4080. * Get/set the maximum yaw angle that the bone can look to.
  4081. */
  4082. maxYaw: number;
  4083. /**
  4084. * Get/set the minimum pitch angle that the bone can look to.
  4085. */
  4086. minPitch: number;
  4087. /**
  4088. * Get/set the maximum pitch angle that the bone can look to.
  4089. */
  4090. maxPitch: number;
  4091. /**
  4092. * Create a BoneLookController
  4093. * @param mesh the mesh that the bone belongs to
  4094. * @param bone the bone that will be looking to the target
  4095. * @param target the target Vector3 to look at
  4096. * @param settings optional settings:
  4097. * - maxYaw: the maximum angle the bone will yaw to
  4098. * - minYaw: the minimum angle the bone will yaw to
  4099. * - maxPitch: the maximum angle the bone will pitch to
  4100. * - minPitch: the minimum angle the bone will yaw to
  4101. * - slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
  4102. * - upAxis: the up axis of the coordinate system
  4103. * - upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
  4104. * - yawAxis: set yawAxis if the bone does not yaw on the y axis
  4105. * - pitchAxis: set pitchAxis if the bone does not pitch on the x axis
  4106. * - adjustYaw: used to make an adjustment to the yaw of the bone
  4107. * - adjustPitch: used to make an adjustment to the pitch of the bone
  4108. * - adjustRoll: used to make an adjustment to the roll of the bone
  4109. **/
  4110. constructor(mesh: AbstractMesh, bone: Bone, target: Vector3, options?: {
  4111. maxYaw?: number;
  4112. minYaw?: number;
  4113. maxPitch?: number;
  4114. minPitch?: number;
  4115. slerpAmount?: number;
  4116. upAxis?: Vector3;
  4117. upAxisSpace?: Space;
  4118. yawAxis?: Vector3;
  4119. pitchAxis?: Vector3;
  4120. adjustYaw?: number;
  4121. adjustPitch?: number;
  4122. adjustRoll?: number;
  4123. });
  4124. /**
  4125. * Update the bone to look at the target. This should be called before the scene is rendered (use scene.registerBeforeRender()).
  4126. */
  4127. update(): void;
  4128. private _getAngleDiff(ang1, ang2);
  4129. private _getAngleBetween(ang1, ang2);
  4130. private _isAngleBetween(ang, ang1, ang2);
  4131. }
  4132. }
  4133. declare module BABYLON {
  4134. class Skeleton {
  4135. name: string;
  4136. id: string;
  4137. bones: Bone[];
  4138. dimensionsAtRest: Vector3;
  4139. needInitialSkinMatrix: boolean;
  4140. private _scene;
  4141. private _isDirty;
  4142. private _transformMatrices;
  4143. private _meshesWithPoseMatrix;
  4144. private _animatables;
  4145. private _identity;
  4146. private _synchronizedWithMesh;
  4147. private _ranges;
  4148. private _lastAbsoluteTransformsUpdateId;
  4149. /**
  4150. * An event triggered before computing the skeleton's matrices
  4151. * @type {BABYLON.Observable}
  4152. */
  4153. onBeforeComputeObservable: Observable<Skeleton>;
  4154. constructor(name: string, id: string, scene: Scene);
  4155. getTransformMatrices(mesh: AbstractMesh): Float32Array;
  4156. getScene(): Scene;
  4157. /**
  4158. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  4159. */
  4160. toString(fullDetails?: boolean): string;
  4161. /**
  4162. * Get bone's index searching by name
  4163. * @param {string} name is bone's name to search for
  4164. * @return {number} Indice of the bone. Returns -1 if not found
  4165. */
  4166. getBoneIndexByName(name: string): number;
  4167. createAnimationRange(name: string, from: number, to: number): void;
  4168. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  4169. getAnimationRange(name: string): AnimationRange;
  4170. /**
  4171. * Returns as an Array, all AnimationRanges defined on this skeleton
  4172. */
  4173. getAnimationRanges(): AnimationRange[];
  4174. /**
  4175. * note: This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences
  4176. */
  4177. copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean;
  4178. returnToRest(): void;
  4179. private _getHighestAnimationFrame();
  4180. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  4181. _markAsDirty(): void;
  4182. _registerMeshWithPoseMatrix(mesh: AbstractMesh): void;
  4183. _unregisterMeshWithPoseMatrix(mesh: AbstractMesh): void;
  4184. _computeTransformMatrices(targetMatrix: Float32Array, initialSkinMatrix: Matrix): void;
  4185. prepare(): void;
  4186. getAnimatables(): IAnimatable[];
  4187. clone(name: string, id: string): Skeleton;
  4188. enableBlending(blendingSpeed?: number): void;
  4189. dispose(): void;
  4190. serialize(): any;
  4191. static Parse(parsedSkeleton: any, scene: Scene): Skeleton;
  4192. computeAbsoluteTransforms(forceUpdate?: boolean): void;
  4193. getPoseMatrix(): Matrix;
  4194. }
  4195. }
  4196. declare module BABYLON {
  4197. class ArcRotateCamera extends TargetCamera {
  4198. alpha: number;
  4199. beta: number;
  4200. radius: number;
  4201. private _target;
  4202. private _targetHost;
  4203. target: Vector3;
  4204. inertialAlphaOffset: number;
  4205. inertialBetaOffset: number;
  4206. inertialRadiusOffset: number;
  4207. lowerAlphaLimit: any;
  4208. upperAlphaLimit: any;
  4209. lowerBetaLimit: number;
  4210. upperBetaLimit: number;
  4211. lowerRadiusLimit: any;
  4212. upperRadiusLimit: any;
  4213. inertialPanningX: number;
  4214. inertialPanningY: number;
  4215. angularSensibilityX: number;
  4216. angularSensibilityY: number;
  4217. pinchPrecision: number;
  4218. panningSensibility: number;
  4219. keysUp: number[];
  4220. keysDown: number[];
  4221. keysLeft: number[];
  4222. keysRight: number[];
  4223. wheelPrecision: number;
  4224. zoomOnFactor: number;
  4225. targetScreenOffset: Vector2;
  4226. allowUpsideDown: boolean;
  4227. _viewMatrix: Matrix;
  4228. _useCtrlForPanning: boolean;
  4229. _panningMouseButton: number;
  4230. inputs: ArcRotateCameraInputsManager;
  4231. _reset: () => void;
  4232. panningAxis: Vector3;
  4233. private _localDirection;
  4234. private _transformedDirection;
  4235. onCollide: (collidedMesh: AbstractMesh) => void;
  4236. checkCollisions: boolean;
  4237. collisionRadius: Vector3;
  4238. private _collider;
  4239. private _previousPosition;
  4240. private _collisionVelocity;
  4241. private _newPosition;
  4242. private _previousAlpha;
  4243. private _previousBeta;
  4244. private _previousRadius;
  4245. private _collisionTriggered;
  4246. private _targetBoundingCenter;
  4247. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);
  4248. _initCache(): void;
  4249. _updateCache(ignoreParentClass?: boolean): void;
  4250. private _getTargetPosition();
  4251. _isSynchronizedViewMatrix(): boolean;
  4252. attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean, panningMouseButton?: number): void;
  4253. detachControl(element: HTMLElement): void;
  4254. _checkInputs(): void;
  4255. private _checkLimits();
  4256. rebuildAnglesAndRadius(): void;
  4257. setPosition(position: Vector3): void;
  4258. setTarget(target: AbstractMesh | Vector3, toBoundingCenter?: boolean, allowSamePosition?: boolean): void;
  4259. _getViewMatrix(): Matrix;
  4260. private _onCollisionPositionChange;
  4261. zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void;
  4262. focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void;
  4263. /**
  4264. * @override
  4265. * Override Camera.createRigCamera
  4266. */
  4267. createRigCamera(name: string, cameraIndex: number): Camera;
  4268. /**
  4269. * @override
  4270. * Override Camera._updateRigCameras
  4271. */
  4272. _updateRigCameras(): void;
  4273. dispose(): void;
  4274. getClassName(): string;
  4275. }
  4276. }
  4277. declare module BABYLON {
  4278. class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
  4279. constructor(camera: ArcRotateCamera);
  4280. addMouseWheel(): ArcRotateCameraInputsManager;
  4281. addPointers(): ArcRotateCameraInputsManager;
  4282. addKeyboard(): ArcRotateCameraInputsManager;
  4283. addGamepad(): ArcRotateCameraInputsManager;
  4284. addVRDeviceOrientation(): ArcRotateCameraInputsManager;
  4285. }
  4286. }
  4287. declare module BABYLON {
  4288. class Camera extends Node {
  4289. inputs: CameraInputsManager<Camera>;
  4290. private static _PERSPECTIVE_CAMERA;
  4291. private static _ORTHOGRAPHIC_CAMERA;
  4292. private static _FOVMODE_VERTICAL_FIXED;
  4293. private static _FOVMODE_HORIZONTAL_FIXED;
  4294. private static _RIG_MODE_NONE;
  4295. private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH;
  4296. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL;
  4297. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;
  4298. private static _RIG_MODE_STEREOSCOPIC_OVERUNDER;
  4299. private static _RIG_MODE_VR;
  4300. private static _RIG_MODE_WEBVR;
  4301. static readonly PERSPECTIVE_CAMERA: number;
  4302. static readonly ORTHOGRAPHIC_CAMERA: number;
  4303. static readonly FOVMODE_VERTICAL_FIXED: number;
  4304. static readonly FOVMODE_HORIZONTAL_FIXED: number;
  4305. static readonly RIG_MODE_NONE: number;
  4306. static readonly RIG_MODE_STEREOSCOPIC_ANAGLYPH: number;
  4307. static readonly RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number;
  4308. static readonly RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number;
  4309. static readonly RIG_MODE_STEREOSCOPIC_OVERUNDER: number;
  4310. static readonly RIG_MODE_VR: number;
  4311. static readonly RIG_MODE_WEBVR: number;
  4312. static ForceAttachControlToAlwaysPreventDefault: boolean;
  4313. position: Vector3;
  4314. upVector: Vector3;
  4315. orthoLeft: any;
  4316. orthoRight: any;
  4317. orthoBottom: any;
  4318. orthoTop: any;
  4319. fov: number;
  4320. minZ: number;
  4321. maxZ: number;
  4322. inertia: number;
  4323. mode: number;
  4324. isIntermediate: boolean;
  4325. viewport: Viewport;
  4326. layerMask: number;
  4327. fovMode: number;
  4328. cameraRigMode: number;
  4329. interaxialDistance: number;
  4330. isStereoscopicSideBySide: boolean;
  4331. _cameraRigParams: any;
  4332. _rigCameras: Camera[];
  4333. _rigPostProcess: PostProcess;
  4334. protected _webvrViewMatrix: Matrix;
  4335. private _computedViewMatrix;
  4336. _projectionMatrix: Matrix;
  4337. private _doNotComputeProjectionMatrix;
  4338. private _worldMatrix;
  4339. _postProcesses: PostProcess[];
  4340. private _transformMatrix;
  4341. _activeMeshes: SmartArray<Mesh>;
  4342. private _globalPosition;
  4343. private _frustumPlanes;
  4344. private _refreshFrustumPlanes;
  4345. constructor(name: string, position: Vector3, scene: Scene);
  4346. getClassName(): string;
  4347. /**
  4348. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  4349. */
  4350. toString(fullDetails?: boolean): string;
  4351. readonly globalPosition: Vector3;
  4352. getActiveMeshes(): SmartArray<Mesh>;
  4353. isActiveMesh(mesh: Mesh): boolean;
  4354. _initCache(): void;
  4355. _updateCache(ignoreParentClass?: boolean): void;
  4356. _updateFromScene(): void;
  4357. _isSynchronized(): boolean;
  4358. _isSynchronizedViewMatrix(): boolean;
  4359. _isSynchronizedProjectionMatrix(): boolean;
  4360. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  4361. detachControl(element: HTMLElement): void;
  4362. update(): void;
  4363. _checkInputs(): void;
  4364. readonly rigCameras: Camera[];
  4365. readonly rigPostProcess: PostProcess;
  4366. private _cascadePostProcessesToRigCams();
  4367. attachPostProcess(postProcess: PostProcess, insertAt?: number): number;
  4368. detachPostProcess(postProcess: PostProcess, atIndices?: any): number[];
  4369. getWorldMatrix(): Matrix;
  4370. _getViewMatrix(): Matrix;
  4371. getViewMatrix(force?: boolean): Matrix;
  4372. _computeViewMatrix(force?: boolean): Matrix;
  4373. freezeProjectionMatrix(projection?: Matrix): void;
  4374. unfreezeProjectionMatrix(): void;
  4375. getProjectionMatrix(force?: boolean): Matrix;
  4376. getTranformationMatrix(): Matrix;
  4377. private updateFrustumPlanes();
  4378. isInFrustum(target: ICullable): boolean;
  4379. isCompletelyInFrustum(target: ICullable): boolean;
  4380. getForwardRay(length: number, transform: Matrix, origin: Vector3): Ray;
  4381. dispose(): void;
  4382. readonly leftCamera: FreeCamera;
  4383. readonly rightCamera: FreeCamera;
  4384. getLeftTarget(): Vector3;
  4385. getRightTarget(): Vector3;
  4386. setCameraRigMode(mode: number, rigParams: any): void;
  4387. private _getVRProjectionMatrix();
  4388. protected _updateCameraRotationMatrix(): void;
  4389. protected _updateWebVRCameraRotationMatrix(): void;
  4390. /**
  4391. * This function MUST be overwritten by the different WebVR cameras available.
  4392. * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.
  4393. */
  4394. protected _getWebVRProjectionMatrix(): Matrix;
  4395. /**
  4396. * This function MUST be overwritten by the different WebVR cameras available.
  4397. * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.
  4398. */
  4399. protected _getWebVRViewMatrix(): Matrix;
  4400. setCameraRigParameter(name: string, value: any): void;
  4401. /**
  4402. * needs to be overridden by children so sub has required properties to be copied
  4403. */
  4404. createRigCamera(name: string, cameraIndex: number): Camera;
  4405. /**
  4406. * May need to be overridden by children
  4407. */
  4408. _updateRigCameras(): void;
  4409. _setupInputs(): void;
  4410. serialize(): any;
  4411. clone(name: string): Camera;
  4412. getDirection(localAxis: Vector3): Vector3;
  4413. getDirectionToRef(localAxis: Vector3, result: Vector3): void;
  4414. static GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): () => Camera;
  4415. static Parse(parsedCamera: any, scene: Scene): Camera;
  4416. }
  4417. }
  4418. declare module BABYLON {
  4419. var CameraInputTypes: {};
  4420. interface ICameraInput<TCamera extends BABYLON.Camera> {
  4421. camera: TCamera;
  4422. getTypeName(): string;
  4423. getSimpleName(): string;
  4424. attachControl: (element: HTMLElement, noPreventDefault?: boolean) => void;
  4425. detachControl: (element: HTMLElement) => void;
  4426. checkInputs?: () => void;
  4427. }
  4428. interface CameraInputsMap<TCamera extends BABYLON.Camera> {
  4429. [name: string]: ICameraInput<TCamera>;
  4430. [idx: number]: ICameraInput<TCamera>;
  4431. }
  4432. class CameraInputsManager<TCamera extends BABYLON.Camera> {
  4433. attached: CameraInputsMap<TCamera>;
  4434. attachedElement: HTMLElement;
  4435. noPreventDefault: boolean;
  4436. camera: TCamera;
  4437. checkInputs: () => void;
  4438. constructor(camera: TCamera);
  4439. add(input: ICameraInput<TCamera>): void;
  4440. remove(inputToRemove: ICameraInput<TCamera>): void;
  4441. removeByType(inputType: string): void;
  4442. private _addCheckInputs(fn);
  4443. attachInput(input: ICameraInput<TCamera>): void;
  4444. attachElement(element: HTMLElement, noPreventDefault?: boolean): void;
  4445. detachElement(element: HTMLElement): void;
  4446. rebuildInputCheck(): void;
  4447. clear(): void;
  4448. serialize(serializedCamera: any): void;
  4449. parse(parsedCamera: any): void;
  4450. }
  4451. }
  4452. declare module BABYLON {
  4453. class DeviceOrientationCamera extends FreeCamera {
  4454. private _initialQuaternion;
  4455. private _quaternionCache;
  4456. constructor(name: string, position: Vector3, scene: Scene);
  4457. getClassName(): string;
  4458. _checkInputs(): void;
  4459. resetToCurrentRotation(axis?: Axis): void;
  4460. }
  4461. }
  4462. declare module BABYLON {
  4463. class FollowCamera extends TargetCamera {
  4464. radius: number;
  4465. rotationOffset: number;
  4466. heightOffset: number;
  4467. cameraAcceleration: number;
  4468. maxCameraSpeed: number;
  4469. lockedTarget: AbstractMesh;
  4470. constructor(name: string, position: Vector3, scene: Scene, lockedTarget?: AbstractMesh);
  4471. private getRadians(degrees);
  4472. private follow(cameraTarget);
  4473. _checkInputs(): void;
  4474. getClassName(): string;
  4475. }
  4476. class ArcFollowCamera extends TargetCamera {
  4477. alpha: number;
  4478. beta: number;
  4479. radius: number;
  4480. target: AbstractMesh;
  4481. private _cartesianCoordinates;
  4482. constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene);
  4483. private follow();
  4484. _checkInputs(): void;
  4485. getClassName(): string;
  4486. }
  4487. }
  4488. declare module BABYLON {
  4489. class FreeCamera extends TargetCamera {
  4490. ellipsoid: Vector3;
  4491. checkCollisions: boolean;
  4492. applyGravity: boolean;
  4493. inputs: FreeCameraInputsManager;
  4494. angularSensibility: number;
  4495. keysUp: number[];
  4496. keysDown: number[];
  4497. keysLeft: number[];
  4498. keysRight: number[];
  4499. onCollide: (collidedMesh: AbstractMesh) => void;
  4500. private _collider;
  4501. private _needMoveForGravity;
  4502. private _oldPosition;
  4503. private _diffPosition;
  4504. private _newPosition;
  4505. _localDirection: Vector3;
  4506. _transformedDirection: Vector3;
  4507. constructor(name: string, position: Vector3, scene: Scene);
  4508. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  4509. detachControl(element: HTMLElement): void;
  4510. private _collisionMask;
  4511. collisionMask: number;
  4512. _collideWithWorld(velocity: Vector3): void;
  4513. private _onCollisionPositionChange;
  4514. _checkInputs(): void;
  4515. _decideIfNeedsToMove(): boolean;
  4516. _updatePosition(): void;
  4517. dispose(): void;
  4518. getClassName(): string;
  4519. }
  4520. }
  4521. declare module BABYLON {
  4522. class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
  4523. constructor(camera: FreeCamera);
  4524. addKeyboard(): FreeCameraInputsManager;
  4525. addMouse(touchEnabled?: boolean): FreeCameraInputsManager;
  4526. addGamepad(): FreeCameraInputsManager;
  4527. addDeviceOrientation(): FreeCameraInputsManager;
  4528. addTouch(): FreeCameraInputsManager;
  4529. addVirtualJoystick(): FreeCameraInputsManager;
  4530. }
  4531. }
  4532. declare module BABYLON {
  4533. class GamepadCamera extends UniversalCamera {
  4534. gamepadAngularSensibility: number;
  4535. gamepadMoveSensibility: number;
  4536. constructor(name: string, position: Vector3, scene: Scene);
  4537. getClassName(): string;
  4538. }
  4539. }
  4540. declare module BABYLON {
  4541. class AnaglyphFreeCamera extends FreeCamera {
  4542. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  4543. getClassName(): string;
  4544. }
  4545. class AnaglyphArcRotateCamera extends ArcRotateCamera {
  4546. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene);
  4547. getClassName(): string;
  4548. }
  4549. class AnaglyphGamepadCamera extends GamepadCamera {
  4550. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  4551. getClassName(): string;
  4552. }
  4553. class AnaglyphUniversalCamera extends UniversalCamera {
  4554. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  4555. getClassName(): string;
  4556. }
  4557. class StereoscopicFreeCamera extends FreeCamera {
  4558. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  4559. getClassName(): string;
  4560. }
  4561. class StereoscopicArcRotateCamera extends ArcRotateCamera {
  4562. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  4563. getClassName(): string;
  4564. }
  4565. class StereoscopicGamepadCamera extends GamepadCamera {
  4566. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  4567. getClassName(): string;
  4568. }
  4569. class StereoscopicUniversalCamera extends UniversalCamera {
  4570. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  4571. getClassName(): string;
  4572. }
  4573. }
  4574. declare module BABYLON {
  4575. class TargetCamera extends Camera {
  4576. cameraDirection: Vector3;
  4577. cameraRotation: Vector2;
  4578. rotation: Vector3;
  4579. rotationQuaternion: Quaternion;
  4580. speed: number;
  4581. noRotationConstraint: boolean;
  4582. lockedTarget: any;
  4583. _currentTarget: Vector3;
  4584. _viewMatrix: Matrix;
  4585. _camMatrix: Matrix;
  4586. _cameraTransformMatrix: Matrix;
  4587. _cameraRotationMatrix: Matrix;
  4588. private _rigCamTransformMatrix;
  4589. _referencePoint: Vector3;
  4590. private _defaultUpVector;
  4591. _transformedReferencePoint: Vector3;
  4592. _lookAtTemp: Matrix;
  4593. _tempMatrix: Matrix;
  4594. _reset: () => void;
  4595. constructor(name: string, position: Vector3, scene: Scene);
  4596. getFrontPosition(distance: number): Vector3;
  4597. _getLockedTargetPosition(): Vector3;
  4598. _initCache(): void;
  4599. _updateCache(ignoreParentClass?: boolean): void;
  4600. _isSynchronizedViewMatrix(): boolean;
  4601. _computeLocalCameraSpeed(): number;
  4602. setTarget(target: Vector3): void;
  4603. /**
  4604. * Return the current target position of the camera. This value is expressed in local space.
  4605. */
  4606. getTarget(): Vector3;
  4607. _decideIfNeedsToMove(): boolean;
  4608. _updatePosition(): void;
  4609. _checkInputs(): void;
  4610. protected _updateCameraRotationMatrix(): void;
  4611. _getViewMatrix(): Matrix;
  4612. /**
  4613. * @override
  4614. * Override Camera.createRigCamera
  4615. */
  4616. createRigCamera(name: string, cameraIndex: number): Camera;
  4617. /**
  4618. * @override
  4619. * Override Camera._updateRigCameras
  4620. */
  4621. _updateRigCameras(): void;
  4622. private _getRigCamPosition(halfSpace, result);
  4623. getClassName(): string;
  4624. }
  4625. }
  4626. declare module BABYLON {
  4627. class TouchCamera extends FreeCamera {
  4628. touchAngularSensibility: number;
  4629. touchMoveSensibility: number;
  4630. constructor(name: string, position: Vector3, scene: Scene);
  4631. getClassName(): string;
  4632. _setupInputs(): void;
  4633. }
  4634. }
  4635. declare module BABYLON {
  4636. class UniversalCamera extends TouchCamera {
  4637. gamepadAngularSensibility: number;
  4638. gamepadMoveSensibility: number;
  4639. constructor(name: string, position: Vector3, scene: Scene);
  4640. getClassName(): string;
  4641. }
  4642. }
  4643. declare module BABYLON {
  4644. class VirtualJoysticksCamera extends FreeCamera {
  4645. constructor(name: string, position: Vector3, scene: Scene);
  4646. getClassName(): string;
  4647. }
  4648. }
  4649. declare module BABYLON {
  4650. class Collider {
  4651. radius: Vector3;
  4652. retry: number;
  4653. velocity: Vector3;
  4654. basePoint: Vector3;
  4655. epsilon: number;
  4656. collisionFound: boolean;
  4657. velocityWorldLength: number;
  4658. basePointWorld: Vector3;
  4659. velocityWorld: Vector3;
  4660. normalizedVelocity: Vector3;
  4661. initialVelocity: Vector3;
  4662. initialPosition: Vector3;
  4663. nearestDistance: number;
  4664. intersectionPoint: Vector3;
  4665. collidedMesh: AbstractMesh;
  4666. private _collisionPoint;
  4667. private _planeIntersectionPoint;
  4668. private _tempVector;
  4669. private _tempVector2;
  4670. private _tempVector3;
  4671. private _tempVector4;
  4672. private _edge;
  4673. private _baseToVertex;
  4674. private _destinationPoint;
  4675. private _slidePlaneNormal;
  4676. private _displacementVector;
  4677. private _collisionMask;
  4678. collisionMask: number;
  4679. _initialize(source: Vector3, dir: Vector3, e: number): void;
  4680. _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean;
  4681. _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean;
  4682. _testTriangle(faceIndex: number, trianglePlaneArray: Array<Plane>, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void;
  4683. _collide(trianglePlaneArray: Array<Plane>, pts: Vector3[], indices: IndicesArray, indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void;
  4684. _getResponse(pos: Vector3, vel: Vector3): void;
  4685. }
  4686. }
  4687. declare module BABYLON {
  4688. var CollisionWorker: string;
  4689. interface ICollisionCoordinator {
  4690. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  4691. init(scene: Scene): void;
  4692. destroy(): void;
  4693. onMeshAdded(mesh: AbstractMesh): any;
  4694. onMeshUpdated(mesh: AbstractMesh): any;
  4695. onMeshRemoved(mesh: AbstractMesh): any;
  4696. onGeometryAdded(geometry: Geometry): any;
  4697. onGeometryUpdated(geometry: Geometry): any;
  4698. onGeometryDeleted(geometry: Geometry): any;
  4699. }
  4700. interface SerializedMesh {
  4701. id: string;
  4702. name: string;
  4703. uniqueId: number;
  4704. geometryId: string;
  4705. sphereCenter: Array<number>;
  4706. sphereRadius: number;
  4707. boxMinimum: Array<number>;
  4708. boxMaximum: Array<number>;
  4709. worldMatrixFromCache: any;
  4710. subMeshes: Array<SerializedSubMesh>;
  4711. checkCollisions: boolean;
  4712. }
  4713. interface SerializedSubMesh {
  4714. position: number;
  4715. verticesStart: number;
  4716. verticesCount: number;
  4717. indexStart: number;
  4718. indexCount: number;
  4719. hasMaterial: boolean;
  4720. sphereCenter: Array<number>;
  4721. sphereRadius: number;
  4722. boxMinimum: Array<number>;
  4723. boxMaximum: Array<number>;
  4724. }
  4725. interface SerializedGeometry {
  4726. id: string;
  4727. positions: Float32Array;
  4728. indices: Uint32Array;
  4729. normals: Float32Array;
  4730. }
  4731. interface BabylonMessage {
  4732. taskType: WorkerTaskType;
  4733. payload: InitPayload | CollidePayload | UpdatePayload;
  4734. }
  4735. interface SerializedColliderToWorker {
  4736. position: Array<number>;
  4737. velocity: Array<number>;
  4738. radius: Array<number>;
  4739. }
  4740. enum WorkerTaskType {
  4741. INIT = 0,
  4742. UPDATE = 1,
  4743. COLLIDE = 2,
  4744. }
  4745. interface WorkerReply {
  4746. error: WorkerReplyType;
  4747. taskType: WorkerTaskType;
  4748. payload?: any;
  4749. }
  4750. interface CollisionReplyPayload {
  4751. newPosition: Array<number>;
  4752. collisionId: number;
  4753. collidedMeshUniqueId: number;
  4754. }
  4755. interface InitPayload {
  4756. }
  4757. interface CollidePayload {
  4758. collisionId: number;
  4759. collider: SerializedColliderToWorker;
  4760. maximumRetry: number;
  4761. excludedMeshUniqueId?: number;
  4762. }
  4763. interface UpdatePayload {
  4764. updatedMeshes: {
  4765. [n: number]: SerializedMesh;
  4766. };
  4767. updatedGeometries: {
  4768. [s: string]: SerializedGeometry;
  4769. };
  4770. removedMeshes: Array<number>;
  4771. removedGeometries: Array<string>;
  4772. }
  4773. enum WorkerReplyType {
  4774. SUCCESS = 0,
  4775. UNKNOWN_ERROR = 1,
  4776. }
  4777. class CollisionCoordinatorWorker implements ICollisionCoordinator {
  4778. private _scene;
  4779. private _scaledPosition;
  4780. private _scaledVelocity;
  4781. private _collisionsCallbackArray;
  4782. private _init;
  4783. private _runningUpdated;
  4784. private _runningCollisionTask;
  4785. private _worker;
  4786. private _addUpdateMeshesList;
  4787. private _addUpdateGeometriesList;
  4788. private _toRemoveMeshesArray;
  4789. private _toRemoveGeometryArray;
  4790. constructor();
  4791. static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
  4792. static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
  4793. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  4794. init(scene: Scene): void;
  4795. destroy(): void;
  4796. onMeshAdded(mesh: AbstractMesh): void;
  4797. onMeshUpdated: (mesh: AbstractMesh) => void;
  4798. onMeshRemoved(mesh: AbstractMesh): void;
  4799. onGeometryAdded(geometry: Geometry): void;
  4800. onGeometryUpdated: (geometry: Geometry) => void;
  4801. onGeometryDeleted(geometry: Geometry): void;
  4802. private _afterRender;
  4803. private _onMessageFromWorker;
  4804. }
  4805. class CollisionCoordinatorLegacy implements ICollisionCoordinator {
  4806. private _scene;
  4807. private _scaledPosition;
  4808. private _scaledVelocity;
  4809. private _finalPosition;
  4810. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  4811. init(scene: Scene): void;
  4812. destroy(): void;
  4813. onMeshAdded(mesh: AbstractMesh): void;
  4814. onMeshUpdated(mesh: AbstractMesh): void;
  4815. onMeshRemoved(mesh: AbstractMesh): void;
  4816. onGeometryAdded(geometry: Geometry): void;
  4817. onGeometryUpdated(geometry: Geometry): void;
  4818. onGeometryDeleted(geometry: Geometry): void;
  4819. private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?);
  4820. }
  4821. }
  4822. declare module BABYLON {
  4823. var WorkerIncluded: boolean;
  4824. class CollisionCache {
  4825. private _meshes;
  4826. private _geometries;
  4827. getMeshes(): {
  4828. [n: number]: SerializedMesh;
  4829. };
  4830. getGeometries(): {
  4831. [s: number]: SerializedGeometry;
  4832. };
  4833. getMesh(id: any): SerializedMesh;
  4834. addMesh(mesh: SerializedMesh): void;
  4835. removeMesh(uniqueId: number): void;
  4836. getGeometry(id: string): SerializedGeometry;
  4837. addGeometry(geometry: SerializedGeometry): void;
  4838. removeGeometry(id: string): void;
  4839. }
  4840. class CollideWorker {
  4841. collider: Collider;
  4842. private _collisionCache;
  4843. private finalPosition;
  4844. private collisionsScalingMatrix;
  4845. private collisionTranformationMatrix;
  4846. constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
  4847. collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void;
  4848. private checkCollision(mesh);
  4849. private processCollisionsForSubMeshes(transformMatrix, mesh);
  4850. private collideForSubMesh(subMesh, transformMatrix, meshGeometry);
  4851. private checkSubmeshCollision(subMesh);
  4852. }
  4853. interface ICollisionDetector {
  4854. onInit(payload: InitPayload): void;
  4855. onUpdate(payload: UpdatePayload): void;
  4856. onCollision(payload: CollidePayload): void;
  4857. }
  4858. class CollisionDetectorTransferable implements ICollisionDetector {
  4859. private _collisionCache;
  4860. onInit(payload: InitPayload): void;
  4861. onUpdate(payload: UpdatePayload): void;
  4862. onCollision(payload: CollidePayload): void;
  4863. }
  4864. }
  4865. declare module BABYLON {
  4866. class IntersectionInfo {
  4867. bu: number;
  4868. bv: number;
  4869. distance: number;
  4870. faceId: number;
  4871. subMeshId: number;
  4872. constructor(bu: number, bv: number, distance: number);
  4873. }
  4874. class PickingInfo {
  4875. hit: boolean;
  4876. distance: number;
  4877. pickedPoint: Vector3;
  4878. pickedMesh: AbstractMesh;
  4879. bu: number;
  4880. bv: number;
  4881. faceId: number;
  4882. subMeshId: number;
  4883. pickedSprite: Sprite;
  4884. getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3;
  4885. getTextureCoordinates(): Vector2;
  4886. }
  4887. }
  4888. declare module BABYLON {
  4889. class BoundingBox implements ICullable {
  4890. minimum: Vector3;
  4891. maximum: Vector3;
  4892. vectors: Vector3[];
  4893. center: Vector3;
  4894. centerWorld: Vector3;
  4895. extendSize: Vector3;
  4896. extendSizeWorld: Vector3;
  4897. directions: Vector3[];
  4898. vectorsWorld: Vector3[];
  4899. minimumWorld: Vector3;
  4900. maximumWorld: Vector3;
  4901. private _worldMatrix;
  4902. constructor(minimum: Vector3, maximum: Vector3);
  4903. getWorldMatrix(): Matrix;
  4904. setWorldMatrix(matrix: Matrix): BoundingBox;
  4905. _update(world: Matrix): void;
  4906. isInFrustum(frustumPlanes: Plane[]): boolean;
  4907. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  4908. intersectsPoint(point: Vector3): boolean;
  4909. intersectsSphere(sphere: BoundingSphere): boolean;
  4910. intersectsMinMax(min: Vector3, max: Vector3): boolean;
  4911. static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
  4912. static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
  4913. static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  4914. static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  4915. }
  4916. }
  4917. declare module BABYLON {
  4918. interface ICullable {
  4919. isInFrustum(frustumPlanes: Plane[]): boolean;
  4920. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  4921. }
  4922. class BoundingInfo implements ICullable {
  4923. minimum: Vector3;
  4924. maximum: Vector3;
  4925. boundingBox: BoundingBox;
  4926. boundingSphere: BoundingSphere;
  4927. private _isLocked;
  4928. constructor(minimum: Vector3, maximum: Vector3);
  4929. isLocked: boolean;
  4930. update(world: Matrix): void;
  4931. isInFrustum(frustumPlanes: Plane[]): boolean;
  4932. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  4933. _checkCollision(collider: Collider): boolean;
  4934. intersectsPoint(point: Vector3): boolean;
  4935. intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
  4936. }
  4937. }
  4938. declare module BABYLON {
  4939. class BoundingSphere {
  4940. minimum: Vector3;
  4941. maximum: Vector3;
  4942. center: Vector3;
  4943. radius: number;
  4944. centerWorld: Vector3;
  4945. radiusWorld: number;
  4946. private _tempRadiusVector;
  4947. constructor(minimum: Vector3, maximum: Vector3);
  4948. _update(world: Matrix): void;
  4949. isInFrustum(frustumPlanes: Plane[]): boolean;
  4950. intersectsPoint(point: Vector3): boolean;
  4951. static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
  4952. }
  4953. }
  4954. declare module BABYLON {
  4955. class Ray {
  4956. origin: Vector3;
  4957. direction: Vector3;
  4958. length: number;
  4959. private _edge1;
  4960. private _edge2;
  4961. private _pvec;
  4962. private _tvec;
  4963. private _qvec;
  4964. private _tmpRay;
  4965. private _rayHelper;
  4966. constructor(origin: Vector3, direction: Vector3, length?: number);
  4967. intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
  4968. intersectsBox(box: BoundingBox): boolean;
  4969. intersectsSphere(sphere: BoundingSphere): boolean;
  4970. intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
  4971. intersectsPlane(plane: Plane): number;
  4972. intersectsMesh(mesh: AbstractMesh, fastCheck?: boolean): PickingInfo;
  4973. intersectsMeshes(meshes: Array<AbstractMesh>, fastCheck?: boolean, results?: Array<PickingInfo>): Array<PickingInfo>;
  4974. private _comparePickingInfo(pickingInfoA, pickingInfoB);
  4975. private static smallnum;
  4976. private static rayl;
  4977. /**
  4978. * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
  4979. * @param sega the first point of the segment to test the intersection against
  4980. * @param segb the second point of the segment to test the intersection against
  4981. * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
  4982. * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
  4983. */
  4984. intersectionSegment(sega: Vector3, segb: Vector3, threshold: number): number;
  4985. static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
  4986. /**
  4987. * 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
  4988. * transformed to the given world matrix.
  4989. * @param origin The origin point
  4990. * @param end The end point
  4991. * @param world a matrix to transform the ray to. Default is the identity matrix.
  4992. */
  4993. static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
  4994. static Transform(ray: Ray, matrix: Matrix): Ray;
  4995. static TransformToRef(ray: Ray, matrix: Matrix, result: Ray): void;
  4996. }
  4997. }
  4998. declare module BABYLON.Debug {
  4999. class AxesViewer {
  5000. private _xline;
  5001. private _yline;
  5002. private _zline;
  5003. private _xmesh;
  5004. private _ymesh;
  5005. private _zmesh;
  5006. scene: Scene;
  5007. scaleLines: number;
  5008. constructor(scene: Scene, scaleLines?: number);
  5009. update(position: Vector3, xaxis: Vector3, yaxis: Vector3, zaxis: Vector3): void;
  5010. dispose(): void;
  5011. }
  5012. }
  5013. declare module BABYLON.Debug {
  5014. class BoneAxesViewer extends Debug.AxesViewer {
  5015. mesh: Mesh;
  5016. bone: Bone;
  5017. pos: Vector3;
  5018. xaxis: Vector3;
  5019. yaxis: Vector3;
  5020. zaxis: Vector3;
  5021. constructor(scene: Scene, bone: Bone, mesh: Mesh, scaleLines?: number);
  5022. update(): void;
  5023. dispose(): void;
  5024. }
  5025. }
  5026. declare module BABYLON {
  5027. class DebugLayer {
  5028. private _scene;
  5029. static InspectorURL: string;
  5030. private _inspector;
  5031. constructor(scene: Scene);
  5032. /** Creates the inspector window. */
  5033. private _createInspector(config?);
  5034. isVisible(): boolean;
  5035. hide(): void;
  5036. show(config?: {
  5037. popup?: boolean;
  5038. initialTab?: number;
  5039. parentElement?: HTMLElement;
  5040. newColors?: {
  5041. backgroundColor?: string;
  5042. backgroundColorLighter?: string;
  5043. backgroundColorLighter2?: string;
  5044. backgroundColorLighter3?: string;
  5045. color?: string;
  5046. colorTop?: string;
  5047. colorBot?: string;
  5048. };
  5049. }): void;
  5050. }
  5051. }
  5052. declare module BABYLON {
  5053. class RayHelper {
  5054. ray: Ray;
  5055. private _renderPoints;
  5056. private _renderLine;
  5057. private _renderFunction;
  5058. private _scene;
  5059. private _updateToMeshFunction;
  5060. private _attachedToMesh;
  5061. private _meshSpaceDirection;
  5062. private _meshSpaceOrigin;
  5063. static CreateAndShow(ray: Ray, scene: Scene, color: Color3): RayHelper;
  5064. constructor(ray: Ray);
  5065. show(scene: Scene, color: Color3): void;
  5066. hide(): void;
  5067. private _render();
  5068. attachToMesh(mesh: AbstractMesh, meshSpaceDirection?: Vector3, meshSpaceOrigin?: Vector3, length?: number): void;
  5069. detachFromMesh(): void;
  5070. private _updateToMesh();
  5071. dispose(): void;
  5072. }
  5073. }
  5074. declare module BABYLON.Debug {
  5075. /**
  5076. * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
  5077. */
  5078. class SkeletonViewer {
  5079. skeleton: Skeleton;
  5080. mesh: AbstractMesh;
  5081. autoUpdateBonesMatrices: boolean;
  5082. renderingGroupId: number;
  5083. color: Color3;
  5084. private _scene;
  5085. private _debugLines;
  5086. private _debugMesh;
  5087. private _isEnabled;
  5088. private _renderFunction;
  5089. constructor(skeleton: Skeleton, mesh: AbstractMesh, scene: Scene, autoUpdateBonesMatrices?: boolean, renderingGroupId?: number);
  5090. isEnabled: boolean;
  5091. private _getBonePosition(position, bone, meshMat, x?, y?, z?);
  5092. private _getLinesForBonesWithLength(bones, meshMat);
  5093. private _getLinesForBonesNoLength(bones, meshMat);
  5094. update(): void;
  5095. dispose(): void;
  5096. }
  5097. }
  5098. declare module BABYLON {
  5099. /**
  5100. * Highlight layer options. This helps customizing the behaviour
  5101. * of the highlight layer.
  5102. */
  5103. interface IHighlightLayerOptions {
  5104. /**
  5105. * Multiplication factor apply to the canvas size to compute the render target size
  5106. * used to generated the glowing objects (the smaller the faster).
  5107. */
  5108. mainTextureRatio?: number;
  5109. /**
  5110. * Enforces a fixed size texture to ensure resize independant blur.
  5111. */
  5112. mainTextureFixedSize?: number;
  5113. /**
  5114. * Multiplication factor apply to the main texture size in the first step of the blur to reduce the size
  5115. * of the picture to blur (the smaller the faster).
  5116. */
  5117. blurTextureSizeRatio?: number;
  5118. /**
  5119. * How big in texel of the blur texture is the vertical blur.
  5120. */
  5121. blurVerticalSize?: number;
  5122. /**
  5123. * How big in texel of the blur texture is the horizontal blur.
  5124. */
  5125. blurHorizontalSize?: number;
  5126. /**
  5127. * Alpha blending mode used to apply the blur. Default is combine.
  5128. */
  5129. alphaBlendingMode?: number;
  5130. /**
  5131. * The camera attached to the layer.
  5132. */
  5133. camera?: Camera;
  5134. }
  5135. /**
  5136. * The highlight layer Helps adding a glow effect around a mesh.
  5137. *
  5138. * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove
  5139. * glowy meshes to your scene.
  5140. *
  5141. * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!
  5142. */
  5143. class HighlightLayer {
  5144. name: string;
  5145. /**
  5146. * The neutral color used during the preparation of the glow effect.
  5147. * This is black by default as the blend operation is a blend operation.
  5148. */
  5149. static neutralColor: Color4;
  5150. /**
  5151. * Stencil value used for glowing meshes.
  5152. */
  5153. static glowingMeshStencilReference: number;
  5154. /**
  5155. * Stencil value used for the other meshes in the scene.
  5156. */
  5157. static normalMeshStencilReference: number;
  5158. private _scene;
  5159. private _engine;
  5160. private _options;
  5161. private _vertexBuffers;
  5162. private _indexBuffer;
  5163. private _downSamplePostprocess;
  5164. private _horizontalBlurPostprocess;
  5165. private _verticalBlurPostprocess;
  5166. private _cachedDefines;
  5167. private _glowMapGenerationEffect;
  5168. private _glowMapMergeEffect;
  5169. private _blurTexture;
  5170. private _mainTexture;
  5171. private _mainTextureDesiredSize;
  5172. private _meshes;
  5173. private _maxSize;
  5174. private _shouldRender;
  5175. private _instanceGlowingMeshStencilReference;
  5176. private _excludedMeshes;
  5177. /**
  5178. * Specifies whether or not the inner glow is ACTIVE in the layer.
  5179. */
  5180. innerGlow: boolean;
  5181. /**
  5182. * Specifies whether or not the outer glow is ACTIVE in the layer.
  5183. */
  5184. outerGlow: boolean;
  5185. /**
  5186. * Specifies wether the highlight layer is enabled or not.
  5187. */
  5188. isEnabled: boolean;
  5189. /**
  5190. * Gets the horizontal size of the blur.
  5191. */
  5192. /**
  5193. * Specifies the horizontal size of the blur.
  5194. */
  5195. blurHorizontalSize: number;
  5196. /**
  5197. * Gets the vertical size of the blur.
  5198. */
  5199. /**
  5200. * Specifies the vertical size of the blur.
  5201. */
  5202. blurVerticalSize: number;
  5203. /**
  5204. * Gets the camera attached to the layer.
  5205. */
  5206. readonly camera: Camera;
  5207. /**
  5208. * An event triggered when the highlight layer has been disposed.
  5209. * @type {BABYLON.Observable}
  5210. */
  5211. onDisposeObservable: Observable<HighlightLayer>;
  5212. /**
  5213. * An event triggered when the highlight layer is about rendering the main texture with the glowy parts.
  5214. * @type {BABYLON.Observable}
  5215. */
  5216. onBeforeRenderMainTextureObservable: Observable<HighlightLayer>;
  5217. /**
  5218. * An event triggered when the highlight layer is being blurred.
  5219. * @type {BABYLON.Observable}
  5220. */
  5221. onBeforeBlurObservable: Observable<HighlightLayer>;
  5222. /**
  5223. * An event triggered when the highlight layer has been blurred.
  5224. * @type {BABYLON.Observable}
  5225. */
  5226. onAfterBlurObservable: Observable<HighlightLayer>;
  5227. /**
  5228. * An event triggered when the glowing blurred texture is being merged in the scene.
  5229. * @type {BABYLON.Observable}
  5230. */
  5231. onBeforeComposeObservable: Observable<HighlightLayer>;
  5232. /**
  5233. * An event triggered when the glowing blurred texture has been merged in the scene.
  5234. * @type {BABYLON.Observable}
  5235. */
  5236. onAfterComposeObservable: Observable<HighlightLayer>;
  5237. /**
  5238. * An event triggered when the highlight layer changes its size.
  5239. * @type {BABYLON.Observable}
  5240. */
  5241. onSizeChangedObservable: Observable<HighlightLayer>;
  5242. /**
  5243. * Instantiates a new highlight Layer and references it to the scene..
  5244. * @param name The name of the layer
  5245. * @param scene The scene to use the layer in
  5246. * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
  5247. */
  5248. constructor(name: string, scene: Scene, options?: IHighlightLayerOptions);
  5249. /**
  5250. * Creates the render target textures and post processes used in the highlight layer.
  5251. */
  5252. private createTextureAndPostProcesses();
  5253. /**
  5254. * Checks for the readiness of the element composing the layer.
  5255. * @param subMesh the mesh to check for
  5256. * @param useInstances specify wether or not to use instances to render the mesh
  5257. * @param emissiveTexture the associated emissive texture used to generate the glow
  5258. * @return true if ready otherwise, false
  5259. */
  5260. private isReady(subMesh, useInstances, emissiveTexture);
  5261. /**
  5262. * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
  5263. */
  5264. render(): void;
  5265. /**
  5266. * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.
  5267. * @param mesh The mesh to exclude from the highlight layer
  5268. */
  5269. addExcludedMesh(mesh: Mesh): void;
  5270. /**
  5271. * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.
  5272. * @param mesh The mesh to highlight
  5273. */
  5274. removeExcludedMesh(mesh: Mesh): void;
  5275. /**
  5276. * Add a mesh in the highlight layer in order to make it glow with the chosen color.
  5277. * @param mesh The mesh to highlight
  5278. * @param color The color of the highlight
  5279. * @param glowEmissiveOnly Extract the glow from the emissive texture
  5280. */
  5281. addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly?: boolean): void;
  5282. /**
  5283. * Remove a mesh from the highlight layer in order to make it stop glowing.
  5284. * @param mesh The mesh to highlight
  5285. */
  5286. removeMesh(mesh: Mesh): void;
  5287. /**
  5288. * Returns true if the layer contains information to display, otherwise false.
  5289. */
  5290. shouldRender(): boolean;
  5291. /**
  5292. * Sets the main texture desired size which is the closest power of two
  5293. * of the engine canvas size.
  5294. */
  5295. private setMainTextureSize();
  5296. /**
  5297. * Force the stencil to the normal expected value for none glowing parts
  5298. */
  5299. private defaultStencilReference(mesh);
  5300. /**
  5301. * Dispose only the render target textures and post process.
  5302. */
  5303. private disposeTextureAndPostProcesses();
  5304. /**
  5305. * Dispose the highlight layer and free resources.
  5306. */
  5307. dispose(): void;
  5308. }
  5309. }
  5310. declare module BABYLON {
  5311. class Layer {
  5312. name: string;
  5313. texture: Texture;
  5314. isBackground: boolean;
  5315. color: Color4;
  5316. scale: Vector2;
  5317. offset: Vector2;
  5318. alphaBlendingMode: number;
  5319. alphaTest: boolean;
  5320. private _scene;
  5321. private _vertexBuffers;
  5322. private _indexBuffer;
  5323. private _effect;
  5324. private _alphaTestEffect;
  5325. /**
  5326. * An event triggered when the layer is disposed.
  5327. * @type {BABYLON.Observable}
  5328. */
  5329. onDisposeObservable: Observable<Layer>;
  5330. private _onDisposeObserver;
  5331. onDispose: () => void;
  5332. /**
  5333. * An event triggered before rendering the scene
  5334. * @type {BABYLON.Observable}
  5335. */
  5336. onBeforeRenderObservable: Observable<Layer>;
  5337. private _onBeforeRenderObserver;
  5338. onBeforeRender: () => void;
  5339. /**
  5340. * An event triggered after rendering the scene
  5341. * @type {BABYLON.Observable}
  5342. */
  5343. onAfterRenderObservable: Observable<Layer>;
  5344. private _onAfterRenderObserver;
  5345. onAfterRender: () => void;
  5346. constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
  5347. render(): void;
  5348. dispose(): void;
  5349. }
  5350. }
  5351. declare module BABYLON {
  5352. class LensFlare {
  5353. size: number;
  5354. position: number;
  5355. color: Color3;
  5356. texture: Texture;
  5357. alphaMode: number;
  5358. private _system;
  5359. constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
  5360. dispose: () => void;
  5361. }
  5362. }
  5363. declare module BABYLON {
  5364. class LensFlareSystem {
  5365. name: string;
  5366. lensFlares: LensFlare[];
  5367. borderLimit: number;
  5368. viewportBorder: number;
  5369. meshesSelectionPredicate: (mesh: Mesh) => boolean;
  5370. layerMask: number;
  5371. id: string;
  5372. private _scene;
  5373. private _emitter;
  5374. private _vertexBuffers;
  5375. private _indexBuffer;
  5376. private _effect;
  5377. private _positionX;
  5378. private _positionY;
  5379. private _isEnabled;
  5380. constructor(name: string, emitter: any, scene: Scene);
  5381. isEnabled: boolean;
  5382. getScene(): Scene;
  5383. getEmitter(): any;
  5384. setEmitter(newEmitter: any): void;
  5385. getEmitterPosition(): Vector3;
  5386. computeEffectivePosition(globalViewport: Viewport): boolean;
  5387. _isVisible(): boolean;
  5388. render(): boolean;
  5389. dispose(): void;
  5390. static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
  5391. serialize(): any;
  5392. }
  5393. }
  5394. declare module BABYLON {
  5395. class DirectionalLight extends Light implements IShadowLight {
  5396. position: Vector3;
  5397. direction: Vector3;
  5398. private _transformedDirection;
  5399. transformedPosition: Vector3;
  5400. private _worldMatrix;
  5401. shadowOrthoScale: number;
  5402. autoUpdateExtends: boolean;
  5403. shadowMinZ: number;
  5404. shadowMaxZ: number;
  5405. customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
  5406. private _orthoLeft;
  5407. private _orthoRight;
  5408. private _orthoTop;
  5409. private _orthoBottom;
  5410. /**
  5411. * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).
  5412. * The directional light is emitted from everywhere in the given direction.
  5413. * It can cast shawdows.
  5414. * Documentation : http://doc.babylonjs.com/tutorials/lights
  5415. */
  5416. constructor(name: string, direction: Vector3, scene: Scene);
  5417. protected _buildUniformLayout(): void;
  5418. /**
  5419. * Returns the string "DirectionalLight".
  5420. */
  5421. getClassName(): string;
  5422. /**
  5423. * Returns the DirectionalLight absolute position in the World.
  5424. */
  5425. getAbsolutePosition(): Vector3;
  5426. /**
  5427. * Sets the DirectionalLight direction toward the passed target (Vector3).
  5428. * Returns the updated DirectionalLight direction (Vector3).
  5429. */
  5430. setDirectionToTarget(target: Vector3): Vector3;
  5431. /**
  5432. * Return the depth scale used for the shadow map.
  5433. */
  5434. getDepthScale(): number;
  5435. /**
  5436. * Sets the passed matrix "matrix" as projection matrix for the shadows cast by the light according to the passed view matrix.
  5437. * Returns the DirectionalLight.
  5438. */
  5439. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): DirectionalLight;
  5440. /**
  5441. * Boolean : true by default.
  5442. */
  5443. needRefreshPerFrame(): boolean;
  5444. /**
  5445. * Boolean : false by default.
  5446. */
  5447. needCube(): boolean;
  5448. /**
  5449. * Returns the light direction (Vector3) for any passed face index.
  5450. */
  5451. getShadowDirection(faceIndex?: number): Vector3;
  5452. /**
  5453. * Computes the light transformed position in case the light is parented. Returns true if parented, else false.
  5454. */
  5455. computeTransformedPosition(): boolean;
  5456. /**
  5457. * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.
  5458. * Returns the DirectionalLight.
  5459. */
  5460. transferToEffect(effect: Effect, lightIndex: string): DirectionalLight;
  5461. _getWorldMatrix(): Matrix;
  5462. /**
  5463. * Returns the integer 1.
  5464. */
  5465. getTypeID(): number;
  5466. }
  5467. }
  5468. declare module BABYLON {
  5469. class HemisphericLight extends Light {
  5470. groundColor: Color3;
  5471. direction: Vector3;
  5472. private _worldMatrix;
  5473. /**
  5474. * Creates a HemisphericLight object in the scene according to the passed direction (Vector3).
  5475. * The HemisphericLight simulates the ambient environment light, so the passed direction is the light reflection direction, not the incoming direction.
  5476. * The HemisphericLight can't cast shadows.
  5477. * Documentation : http://doc.babylonjs.com/tutorials/lights
  5478. */
  5479. constructor(name: string, direction: Vector3, scene: Scene);
  5480. protected _buildUniformLayout(): void;
  5481. /**
  5482. * Returns the string "HemisphericLight".
  5483. */
  5484. getClassName(): string;
  5485. /**
  5486. * Sets the HemisphericLight direction towards the passed target (Vector3).
  5487. * Returns the updated direction.
  5488. */
  5489. setDirectionToTarget(target: Vector3): Vector3;
  5490. getShadowGenerator(): ShadowGenerator;
  5491. /**
  5492. * Sets the passed Effect object with the HemisphericLight normalized direction and color and the passed name (string).
  5493. * Returns the HemisphericLight.
  5494. */
  5495. transferToEffect(effect: Effect, lightIndex: string): HemisphericLight;
  5496. _getWorldMatrix(): Matrix;
  5497. /**
  5498. * Returns the integer 3.
  5499. */
  5500. getTypeID(): number;
  5501. }
  5502. }
  5503. declare module BABYLON {
  5504. interface IShadowLight extends Light {
  5505. id: string;
  5506. position: Vector3;
  5507. transformedPosition: Vector3;
  5508. name: string;
  5509. shadowMinZ: number;
  5510. shadowMaxZ: number;
  5511. computeTransformedPosition(): boolean;
  5512. getScene(): Scene;
  5513. customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
  5514. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  5515. getDepthScale(): number;
  5516. needRefreshPerFrame(): boolean;
  5517. needCube(): boolean;
  5518. getShadowDirection(faceIndex?: number): Vector3;
  5519. _shadowGenerator: IShadowGenerator;
  5520. }
  5521. class Light extends Node {
  5522. private static _LIGHTMAP_DEFAULT;
  5523. private static _LIGHTMAP_SPECULAR;
  5524. private static _LIGHTMAP_SHADOWSONLY;
  5525. /**
  5526. * If every light affecting the material is in this lightmapMode,
  5527. * material.lightmapTexture adds or multiplies
  5528. * (depends on material.useLightmapAsShadowmap)
  5529. * after every other light calculations.
  5530. */
  5531. static readonly LIGHTMAP_DEFAULT: number;
  5532. /**
  5533. * material.lightmapTexture as only diffuse lighting from this light
  5534. * adds pnly specular lighting from this light
  5535. * adds dynamic shadows
  5536. */
  5537. static readonly LIGHTMAP_SPECULAR: number;
  5538. /**
  5539. * material.lightmapTexture as only lighting
  5540. * no light calculation from this light
  5541. * only adds dynamic shadows from this light
  5542. */
  5543. static readonly LIGHTMAP_SHADOWSONLY: number;
  5544. diffuse: Color3;
  5545. specular: Color3;
  5546. intensity: number;
  5547. range: number;
  5548. private _includedOnlyMeshes;
  5549. includedOnlyMeshes: AbstractMesh[];
  5550. private _excludedMeshes;
  5551. excludedMeshes: AbstractMesh[];
  5552. private _excludeWithLayerMask;
  5553. excludeWithLayerMask: number;
  5554. private _includeOnlyWithLayerMask;
  5555. includeOnlyWithLayerMask: number;
  5556. private _lightmapMode;
  5557. lightmapMode: number;
  5558. radius: number;
  5559. _shadowGenerator: IShadowGenerator;
  5560. private _parentedWorldMatrix;
  5561. _excludedMeshesIds: string[];
  5562. _includedOnlyMeshesIds: string[];
  5563. _uniformBuffer: UniformBuffer;
  5564. /**
  5565. * Creates a Light object in the scene.
  5566. * Documentation : http://doc.babylonjs.com/tutorials/lights
  5567. */
  5568. constructor(name: string, scene: Scene);
  5569. protected _buildUniformLayout(): void;
  5570. /**
  5571. * Returns the string "Light".
  5572. */
  5573. getClassName(): string;
  5574. /**
  5575. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  5576. */
  5577. toString(fullDetails?: boolean): string;
  5578. /**
  5579. * Set the enabled state of this node.
  5580. * @param {boolean} value - the new enabled state
  5581. * @see isEnabled
  5582. */
  5583. setEnabled(value: boolean): void;
  5584. /**
  5585. * Returns the Light associated shadow generator.
  5586. */
  5587. getShadowGenerator(): IShadowGenerator;
  5588. /**
  5589. * Returns a Vector3, the absolute light position in the World.
  5590. */
  5591. getAbsolutePosition(): Vector3;
  5592. transferToEffect(effect: Effect, lightIndex: string): void;
  5593. _getWorldMatrix(): Matrix;
  5594. /**
  5595. * Boolean : True if the light will affect the passed mesh.
  5596. */
  5597. canAffectMesh(mesh: AbstractMesh): boolean;
  5598. /**
  5599. * Returns the light World matrix.
  5600. */
  5601. getWorldMatrix(): Matrix;
  5602. /**
  5603. * Disposes the light.
  5604. */
  5605. dispose(): void;
  5606. /**
  5607. * Returns the light type ID (integer).
  5608. */
  5609. getTypeID(): number;
  5610. /**
  5611. * Returns a new Light object, named "name", from the current one.
  5612. */
  5613. clone(name: string): Light;
  5614. /**
  5615. * Serializes the current light into a Serialization object.
  5616. * Returns the serialized object.
  5617. */
  5618. serialize(): any;
  5619. /**
  5620. * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.
  5621. * This new light is named "name" and added to the passed scene.
  5622. */
  5623. static GetConstructorFromName(type: number, name: string, scene: Scene): () => Light;
  5624. /**
  5625. * Parses the passed "parsedLight" and returns a new instanced Light from this parsing.
  5626. */
  5627. static Parse(parsedLight: any, scene: Scene): Light;
  5628. private _hookArrayForExcluded(array);
  5629. private _hookArrayForIncludedOnly(array);
  5630. private _resyncMeshes();
  5631. _markMeshesAsLightDirty(): void;
  5632. }
  5633. }
  5634. declare module BABYLON {
  5635. class PointLight extends Light implements IShadowLight {
  5636. private _worldMatrix;
  5637. transformedPosition: Vector3;
  5638. position: Vector3;
  5639. shadowMinZ: number;
  5640. shadowMaxZ: number;
  5641. customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
  5642. /**
  5643. * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.
  5644. * A PointLight emits the light in every direction.
  5645. * It can cast shadows.
  5646. * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :
  5647. * ```javascript
  5648. * var pointLight = new BABYLON.PointLight("pl", camera.position, scene);
  5649. * ```
  5650. * Documentation : http://doc.babylonjs.com/tutorials/lights
  5651. */
  5652. constructor(name: string, position: Vector3, scene: Scene);
  5653. protected _buildUniformLayout(): void;
  5654. /**
  5655. * Returns the string "PointLight"
  5656. */
  5657. getClassName(): string;
  5658. /**
  5659. * Returns a Vector3, the PointLight absolute position in the World.
  5660. */
  5661. getAbsolutePosition(): Vector3;
  5662. /**
  5663. * Computes the PointLight transformed position if parented. Returns true if ok, false if not parented.
  5664. */
  5665. computeTransformedPosition(): boolean;
  5666. /**
  5667. * Sets the passed Effect "effect" with the PointLight transformed position (or position, if none) and passed name (string).
  5668. * Returns the PointLight.
  5669. */
  5670. transferToEffect(effect: Effect, lightIndex: string): PointLight;
  5671. /**
  5672. * Boolean : returns true by default.
  5673. */
  5674. needCube(): boolean;
  5675. /**
  5676. * Boolean : returns false by default.
  5677. */
  5678. needRefreshPerFrame(): boolean;
  5679. /**
  5680. * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).
  5681. */
  5682. getShadowDirection(faceIndex?: number): Vector3;
  5683. /**
  5684. * Return the depth scale used for the shadow map.
  5685. */
  5686. getDepthScale(): number;
  5687. /**
  5688. * Sets the passed matrix "matrix" as a left-handed perspective projection matrix with the following settings :
  5689. * - fov = PI / 2
  5690. * - aspect ratio : 1.0
  5691. * - z-near and far equal to the active camera minZ and maxZ.
  5692. * Returns the PointLight.
  5693. */
  5694. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): PointLight;
  5695. _getWorldMatrix(): Matrix;
  5696. /**
  5697. * Returns the integer 0.
  5698. */
  5699. getTypeID(): number;
  5700. }
  5701. }
  5702. declare module BABYLON {
  5703. class SpotLight extends Light implements IShadowLight {
  5704. position: Vector3;
  5705. direction: Vector3;
  5706. angle: number;
  5707. exponent: number;
  5708. shadowMinZ: number;
  5709. shadowMaxZ: number;
  5710. transformedPosition: Vector3;
  5711. customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
  5712. private _transformedDirection;
  5713. private _worldMatrix;
  5714. /**
  5715. * Creates a SpotLight object in the scene with the passed parameters :
  5716. * - `position` (Vector3) is the initial SpotLight position,
  5717. * - `direction` (Vector3) is the initial SpotLight direction,
  5718. * - `angle` (float, in radians) is the spot light cone angle,
  5719. * - `exponent` (float) is the light decay speed with the distance from the emission spot.
  5720. * A spot light is a simply light oriented cone.
  5721. * It can cast shadows.
  5722. * Documentation : http://doc.babylonjs.com/tutorials/lights
  5723. */
  5724. constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
  5725. protected _buildUniformLayout(): void;
  5726. /**
  5727. * Returns the string "SpotLight".
  5728. */
  5729. getClassName(): string;
  5730. /**
  5731. * Returns the SpotLight absolute position in the World (Vector3).
  5732. */
  5733. getAbsolutePosition(): Vector3;
  5734. /**
  5735. * Return the depth scale used for the shadow map.
  5736. */
  5737. getDepthScale(): number;
  5738. /**
  5739. * 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.
  5740. * Returns the SpotLight.
  5741. */
  5742. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): SpotLight;
  5743. /**
  5744. * Boolean : false by default.
  5745. */
  5746. needCube(): boolean;
  5747. /**
  5748. * Boolean : false by default.
  5749. */
  5750. needRefreshPerFrame(): boolean;
  5751. /**
  5752. * Returns the SpotLight direction (Vector3) for any passed face index.
  5753. */
  5754. getShadowDirection(faceIndex?: number): Vector3;
  5755. /**
  5756. * Updates the SpotLight direction towards the passed target (Vector3).
  5757. * Returns the updated direction.
  5758. */
  5759. setDirectionToTarget(target: Vector3): Vector3;
  5760. /**
  5761. * Computes the SpotLight transformed position if parented. Returns true if parented, else false.
  5762. */
  5763. computeTransformedPosition(): boolean;
  5764. /**
  5765. * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.
  5766. * Return the SpotLight.
  5767. */
  5768. transferToEffect(effect: Effect, lightIndex: string): SpotLight;
  5769. _getWorldMatrix(): Matrix;
  5770. /**
  5771. * Returns the integer 2.
  5772. */
  5773. getTypeID(): number;
  5774. /**
  5775. * Returns the SpotLight rotation (Vector3).
  5776. */
  5777. getRotation(): Vector3;
  5778. }
  5779. }
  5780. declare module BABYLON {
  5781. /**
  5782. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  5783. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  5784. * 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;
  5785. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  5786. */
  5787. class ColorCurves {
  5788. private _dirty;
  5789. private _tempColor;
  5790. private _globalCurve;
  5791. private _highlightsCurve;
  5792. private _midtonesCurve;
  5793. private _shadowsCurve;
  5794. private _positiveCurve;
  5795. private _negativeCurve;
  5796. private _globalHue;
  5797. private _globalDensity;
  5798. private _globalSaturation;
  5799. private _globalExposure;
  5800. /**
  5801. * Gets the global Hue value.
  5802. * 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).
  5803. */
  5804. /**
  5805. * Sets the global Hue value.
  5806. * 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).
  5807. */
  5808. GlobalHue: number;
  5809. /**
  5810. * Gets the global Density value.
  5811. * 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.
  5812. * Values less than zero provide a filter of opposite hue.
  5813. */
  5814. /**
  5815. * Sets the global Density value.
  5816. * 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.
  5817. * Values less than zero provide a filter of opposite hue.
  5818. */
  5819. GlobalDensity: number;
  5820. /**
  5821. * Gets the global Saturation value.
  5822. * 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.
  5823. */
  5824. /**
  5825. * Sets the global Saturation value.
  5826. * 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.
  5827. */
  5828. GlobalSaturation: number;
  5829. private _highlightsHue;
  5830. private _highlightsDensity;
  5831. private _highlightsSaturation;
  5832. private _highlightsExposure;
  5833. /**
  5834. * Gets the highlights Hue value.
  5835. * 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).
  5836. */
  5837. /**
  5838. * Sets the highlights Hue value.
  5839. * 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).
  5840. */
  5841. HighlightsHue: number;
  5842. /**
  5843. * Gets the highlights Density value.
  5844. * 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.
  5845. * Values less than zero provide a filter of opposite hue.
  5846. */
  5847. /**
  5848. * Sets the highlights Density value.
  5849. * 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.
  5850. * Values less than zero provide a filter of opposite hue.
  5851. */
  5852. HighlightsDensity: number;
  5853. /**
  5854. * Gets the highlights Saturation value.
  5855. * 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.
  5856. */
  5857. /**
  5858. * Sets the highlights Saturation value.
  5859. * 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.
  5860. */
  5861. HighlightsSaturation: number;
  5862. /**
  5863. * Gets the highlights Exposure value.
  5864. * 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.
  5865. */
  5866. /**
  5867. * Sets the highlights Exposure value.
  5868. * 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.
  5869. */
  5870. HighlightsExposure: number;
  5871. private _midtonesHue;
  5872. private _midtonesDensity;
  5873. private _midtonesSaturation;
  5874. private _midtonesExposure;
  5875. /**
  5876. * Gets the midtones Hue value.
  5877. * 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).
  5878. */
  5879. /**
  5880. * Sets the midtones Hue value.
  5881. * 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).
  5882. */
  5883. MidtonesHue: number;
  5884. /**
  5885. * Gets the midtones Density value.
  5886. * 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.
  5887. * Values less than zero provide a filter of opposite hue.
  5888. */
  5889. /**
  5890. * Sets the midtones Density value.
  5891. * 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.
  5892. * Values less than zero provide a filter of opposite hue.
  5893. */
  5894. MidtonesDensity: number;
  5895. /**
  5896. * Gets the midtones Saturation value.
  5897. * 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.
  5898. */
  5899. /**
  5900. * Sets the midtones Saturation value.
  5901. * 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.
  5902. */
  5903. MidtonesSaturation: number;
  5904. /**
  5905. * Gets the midtones Exposure value.
  5906. * 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.
  5907. */
  5908. /**
  5909. * Sets the midtones Exposure value.
  5910. * 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.
  5911. */
  5912. MidtonesExposure: number;
  5913. private _shadowsHue;
  5914. private _shadowsDensity;
  5915. private _shadowsSaturation;
  5916. private _shadowsExposure;
  5917. /**
  5918. * Gets the shadows Hue value.
  5919. * 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).
  5920. */
  5921. /**
  5922. * Sets the shadows Hue value.
  5923. * 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).
  5924. */
  5925. ShadowsHue: number;
  5926. /**
  5927. * Gets the shadows Density value.
  5928. * 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.
  5929. * Values less than zero provide a filter of opposite hue.
  5930. */
  5931. /**
  5932. * Sets the shadows Density value.
  5933. * 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.
  5934. * Values less than zero provide a filter of opposite hue.
  5935. */
  5936. ShadowsDensity: number;
  5937. /**
  5938. * Gets the shadows Saturation value.
  5939. * 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.
  5940. */
  5941. /**
  5942. * Sets the shadows Saturation value.
  5943. * 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.
  5944. */
  5945. ShadowsSaturation: number;
  5946. /**
  5947. * Gets the shadows Exposure value.
  5948. * 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.
  5949. */
  5950. /**
  5951. * Sets the shadows Exposure value.
  5952. * 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.
  5953. */
  5954. ShadowsExposure: number;
  5955. /**
  5956. * Binds the color curves to the shader.
  5957. * @param colorCurves The color curve to bind
  5958. * @param effect The effect to bind to
  5959. */
  5960. static Bind(colorCurves: ColorCurves, effect: Effect): void;
  5961. /**
  5962. * Prepare the list of uniforms associated with the ColorCurves effects.
  5963. * @param uniformsList The list of uniforms used in the effect
  5964. */
  5965. static PrepareUniforms(uniformsList: string[]): void;
  5966. /**
  5967. * Returns color grading data based on a hue, density, saturation and exposure value.
  5968. * @param filterHue The hue of the color filter.
  5969. * @param filterDensity The density of the color filter.
  5970. * @param saturation The saturation.
  5971. * @param exposure The exposure.
  5972. * @param result The result data container.
  5973. */
  5974. private getColorGradingDataToRef(hue, density, saturation, exposure, result);
  5975. /**
  5976. * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
  5977. * @param value The input slider value in range [-100,100].
  5978. * @returns Adjusted value.
  5979. */
  5980. private static applyColorGradingSliderNonlinear(value);
  5981. /**
  5982. * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
  5983. * @param hue The hue (H) input.
  5984. * @param saturation The saturation (S) input.
  5985. * @param brightness The brightness (B) input.
  5986. * @result An RGBA color represented as Vector4.
  5987. */
  5988. private static fromHSBToRef(hue, saturation, brightness, result);
  5989. /**
  5990. * Returns a value clamped between min and max
  5991. * @param value The value to clamp
  5992. * @param min The minimum of value
  5993. * @param max The maximum of value
  5994. * @returns The clamped value.
  5995. */
  5996. private static clamp(value, min, max);
  5997. /**
  5998. * Clones the current color curve instance.
  5999. * @return The cloned curves
  6000. */
  6001. clone(): ColorCurves;
  6002. /**
  6003. * Serializes the current color curve instance to a json representation.
  6004. * @return a JSON representation
  6005. */
  6006. serialize(): any;
  6007. /**
  6008. * Parses the color curve from a json representation.
  6009. * @param source the JSON source to parse
  6010. * @return The parsed curves
  6011. */
  6012. static Parse(source: any): ColorCurves;
  6013. }
  6014. }
  6015. declare module BABYLON {
  6016. class EffectFallbacks {
  6017. private _defines;
  6018. private _currentRank;
  6019. private _maxRank;
  6020. private _mesh;
  6021. private _meshRank;
  6022. addFallback(rank: number, define: string): void;
  6023. addCPUSkinningFallback(rank: number, mesh: BABYLON.AbstractMesh): void;
  6024. readonly isMoreFallbacks: boolean;
  6025. reduce(currentDefines: string): string;
  6026. }
  6027. class EffectCreationOptions {
  6028. attributes: string[];
  6029. uniformsNames: string[];
  6030. uniformBuffersNames: string[];
  6031. samplers: string[];
  6032. defines: any;
  6033. fallbacks: EffectFallbacks;
  6034. onCompiled: (effect: Effect) => void;
  6035. onError: (effect: Effect, errors: string) => void;
  6036. indexParameters: any;
  6037. maxSimultaneousLights: number;
  6038. }
  6039. class Effect {
  6040. name: any;
  6041. defines: string;
  6042. onCompiled: (effect: Effect) => void;
  6043. onError: (effect: Effect, errors: string) => void;
  6044. onBind: (effect: Effect) => void;
  6045. uniqueId: number;
  6046. private static _uniqueIdSeed;
  6047. private _engine;
  6048. private _uniformBuffersNames;
  6049. private _uniformsNames;
  6050. private _samplers;
  6051. private _isReady;
  6052. private _compilationError;
  6053. private _attributesNames;
  6054. private _attributes;
  6055. private _uniforms;
  6056. _key: string;
  6057. private _indexParameters;
  6058. private _fallbacks;
  6059. private _program;
  6060. private _valueCache;
  6061. private static _baseCache;
  6062. 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);
  6063. readonly key: string;
  6064. isReady(): boolean;
  6065. getProgram(): WebGLProgram;
  6066. getAttributesNames(): string[];
  6067. getAttributeLocation(index: number): number;
  6068. getAttributeLocationByName(name: string): number;
  6069. getAttributesCount(): number;
  6070. getUniformIndex(uniformName: string): number;
  6071. getUniform(uniformName: string): WebGLUniformLocation;
  6072. getSamplers(): string[];
  6073. getCompilationError(): string;
  6074. getVertexShaderSource(): string;
  6075. getFragmentShaderSource(): string;
  6076. _loadVertexShader(vertex: any, callback: (data: any) => void): void;
  6077. _loadFragmentShader(fragment: any, callback: (data: any) => void): void;
  6078. private _dumpShadersSource(vertexCode, fragmentCode, defines);
  6079. private _processShaderConversion(sourceCode, isFragment, callback);
  6080. private _processIncludes(sourceCode, callback);
  6081. private _processPrecision(source);
  6082. private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?);
  6083. readonly isSupported: boolean;
  6084. _bindTexture(channel: string, texture: WebGLTexture): void;
  6085. setTexture(channel: string, texture: BaseTexture): void;
  6086. setTextureArray(channel: string, textures: BaseTexture[]): void;
  6087. setTextureFromPostProcess(channel: string, postProcess: PostProcess): void;
  6088. _cacheMatrix(uniformName: string, matrix: Matrix): boolean;
  6089. _cacheFloat2(uniformName: string, x: number, y: number): boolean;
  6090. _cacheFloat3(uniformName: string, x: number, y: number, z: number): boolean;
  6091. _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): boolean;
  6092. bindUniformBuffer(buffer: WebGLBuffer, name: string): void;
  6093. bindUniformBlock(blockName: string, index: number): void;
  6094. setIntArray(uniformName: string, array: Int32Array): Effect;
  6095. setIntArray2(uniformName: string, array: Int32Array): Effect;
  6096. setIntArray3(uniformName: string, array: Int32Array): Effect;
  6097. setIntArray4(uniformName: string, array: Int32Array): Effect;
  6098. setFloatArray(uniformName: string, array: Float32Array): Effect;
  6099. setFloatArray2(uniformName: string, array: Float32Array): Effect;
  6100. setFloatArray3(uniformName: string, array: Float32Array): Effect;
  6101. setFloatArray4(uniformName: string, array: Float32Array): Effect;
  6102. setArray(uniformName: string, array: number[]): Effect;
  6103. setArray2(uniformName: string, array: number[]): Effect;
  6104. setArray3(uniformName: string, array: number[]): Effect;
  6105. setArray4(uniformName: string, array: number[]): Effect;
  6106. setMatrices(uniformName: string, matrices: Float32Array): Effect;
  6107. setMatrix(uniformName: string, matrix: Matrix): Effect;
  6108. setMatrix3x3(uniformName: string, matrix: Float32Array): Effect;
  6109. setMatrix2x2(uniformName: string, matrix: Float32Array): Effect;
  6110. setFloat(uniformName: string, value: number): Effect;
  6111. setBool(uniformName: string, bool: boolean): Effect;
  6112. setVector2(uniformName: string, vector2: Vector2): Effect;
  6113. setFloat2(uniformName: string, x: number, y: number): Effect;
  6114. setVector3(uniformName: string, vector3: Vector3): Effect;
  6115. setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
  6116. setVector4(uniformName: string, vector4: Vector4): Effect;
  6117. setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
  6118. setColor3(uniformName: string, color3: Color3): Effect;
  6119. setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
  6120. private _recombineShader(node);
  6121. private _evaluateDefinesOnString(shaderString);
  6122. static ShadersStore: {};
  6123. static IncludesShadersStore: {};
  6124. }
  6125. }
  6126. declare module BABYLON {
  6127. class FresnelParameters {
  6128. private _isEnabled;
  6129. isEnabled: boolean;
  6130. leftColor: Color3;
  6131. rightColor: Color3;
  6132. bias: number;
  6133. power: number;
  6134. clone(): FresnelParameters;
  6135. serialize(): any;
  6136. static Parse(parsedFresnelParameters: any): FresnelParameters;
  6137. }
  6138. }
  6139. declare module BABYLON {
  6140. class MaterialDefines {
  6141. private _keys;
  6142. private _isDirty;
  6143. _renderId: number;
  6144. _areLightsDirty: boolean;
  6145. _areAttributesDirty: boolean;
  6146. _areTexturesDirty: boolean;
  6147. _areFresnelDirty: boolean;
  6148. _areMiscDirty: boolean;
  6149. _normals: boolean;
  6150. _uvs: boolean;
  6151. _needNormals: boolean;
  6152. _needUVs: boolean;
  6153. readonly isDirty: boolean;
  6154. markAsProcessed(): void;
  6155. markAsUnprocessed(): void;
  6156. markAllAsDirty(): void;
  6157. markAsLightDirty(): void;
  6158. markAsAttributesDirty(): void;
  6159. markAsTexturesDirty(): void;
  6160. markAsFresnelDirty(): void;
  6161. markAsMiscDirty(): void;
  6162. rebuild(): void;
  6163. isEqual(other: MaterialDefines): boolean;
  6164. cloneTo(other: MaterialDefines): void;
  6165. reset(): void;
  6166. toString(): string;
  6167. }
  6168. class Material {
  6169. private static _TriangleFillMode;
  6170. private static _WireFrameFillMode;
  6171. private static _PointFillMode;
  6172. static readonly TriangleFillMode: number;
  6173. static readonly WireFrameFillMode: number;
  6174. static readonly PointFillMode: number;
  6175. private static _ClockWiseSideOrientation;
  6176. private static _CounterClockWiseSideOrientation;
  6177. static readonly ClockWiseSideOrientation: number;
  6178. static readonly CounterClockWiseSideOrientation: number;
  6179. private static _TextureDirtyFlag;
  6180. private static _LightDirtyFlag;
  6181. private static _FresnelDirtyFlag;
  6182. private static _AttributesDirtyFlag;
  6183. private static _MiscDirtyFlag;
  6184. static readonly TextureDirtyFlag: number;
  6185. static readonly LightDirtyFlag: number;
  6186. static readonly FresnelDirtyFlag: number;
  6187. static readonly AttributesDirtyFlag: number;
  6188. static readonly MiscDirtyFlag: number;
  6189. id: string;
  6190. name: string;
  6191. checkReadyOnEveryCall: boolean;
  6192. checkReadyOnlyOnce: boolean;
  6193. state: string;
  6194. alpha: number;
  6195. protected _backFaceCulling: boolean;
  6196. backFaceCulling: boolean;
  6197. sideOrientation: number;
  6198. onCompiled: (effect: Effect) => void;
  6199. onError: (effect: Effect, errors: string) => void;
  6200. getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
  6201. doNotSerialize: boolean;
  6202. storeEffectOnSubMeshes: boolean;
  6203. /**
  6204. * An event triggered when the material is disposed.
  6205. * @type {BABYLON.Observable}
  6206. */
  6207. onDisposeObservable: Observable<Material>;
  6208. private _onDisposeObserver;
  6209. onDispose: () => void;
  6210. /**
  6211. * An event triggered when the material is bound.
  6212. * @type {BABYLON.Observable}
  6213. */
  6214. onBindObservable: Observable<AbstractMesh>;
  6215. private _onBindObserver;
  6216. onBind: (Mesh: AbstractMesh) => void;
  6217. /**
  6218. * An event triggered when the material is unbound.
  6219. * @type {BABYLON.Observable}
  6220. */
  6221. onUnBindObservable: Observable<Material>;
  6222. alphaMode: number;
  6223. disableDepthWrite: boolean;
  6224. private _fogEnabled;
  6225. fogEnabled: boolean;
  6226. pointSize: number;
  6227. zOffset: number;
  6228. wireframe: boolean;
  6229. pointsCloud: boolean;
  6230. fillMode: number;
  6231. _effect: Effect;
  6232. _wasPreviouslyReady: boolean;
  6233. private _useUBO;
  6234. private _scene;
  6235. private _fillMode;
  6236. private _cachedDepthWriteState;
  6237. protected _uniformBuffer: UniformBuffer;
  6238. constructor(name: string, scene: Scene, doNotAdd?: boolean);
  6239. /**
  6240. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  6241. * subclasses should override adding information pertainent to themselves
  6242. */
  6243. toString(fullDetails?: boolean): string;
  6244. /**
  6245. * Child classes can use it to update shaders
  6246. */
  6247. markAsDirty(flag: number): void;
  6248. getClassName(): string;
  6249. readonly isFrozen: boolean;
  6250. freeze(): void;
  6251. unfreeze(): void;
  6252. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  6253. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  6254. getEffect(): Effect;
  6255. getScene(): Scene;
  6256. needAlphaBlending(): boolean;
  6257. needAlphaTesting(): boolean;
  6258. getAlphaTestTexture(): BaseTexture;
  6259. markDirty(): void;
  6260. _preBind(effect?: Effect): void;
  6261. bind(world: Matrix, mesh?: Mesh): void;
  6262. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  6263. bindOnlyWorldMatrix(world: Matrix): void;
  6264. bindSceneUniformBuffer(effect: Effect, sceneUbo: UniformBuffer): void;
  6265. bindView(effect: Effect): void;
  6266. bindViewProjection(effect: Effect): void;
  6267. protected _afterBind(mesh: Mesh): void;
  6268. unbind(): void;
  6269. clone(name: string): Material;
  6270. getBindedMeshes(): AbstractMesh[];
  6271. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  6272. serialize(): any;
  6273. static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial;
  6274. static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): any;
  6275. }
  6276. }
  6277. declare module BABYLON {
  6278. class MaterialHelper {
  6279. static PrepareDefinesForMisc(mesh: AbstractMesh, scene: Scene, useLogarithmicDepth: boolean, pointsCloud: any, fogEnabled: boolean, defines: MaterialDefines): void;
  6280. static PrepareDefinesForFrameBoundValues(scene: Scene, engine: Engine, defines: MaterialDefines, useInstances: boolean): void;
  6281. static PrepareDefinesForAttributes(mesh: AbstractMesh, defines: MaterialDefines, useVertexColor: boolean, useBones: boolean, useMorphTargets?: boolean): void;
  6282. static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: MaterialDefines, specularSupported: boolean, maxSimultaneousLights?: number, disableLighting?: boolean): boolean;
  6283. static PrepareUniformsAndSamplersList(uniformsListOrOptions: string[] | EffectCreationOptions, samplersList?: string[], defines?: MaterialDefines, maxSimultaneousLights?: number): void;
  6284. static HandleFallbacksForShadows(defines: MaterialDefines, fallbacks: EffectFallbacks, maxSimultaneousLights?: number): void;
  6285. static PrepareAttributesForMorphTargets(attribs: string[], mesh: AbstractMesh, defines: MaterialDefines): void;
  6286. static PrepareAttributesForBones(attribs: string[], mesh: AbstractMesh, defines: MaterialDefines, fallbacks: EffectFallbacks): void;
  6287. static PrepareAttributesForInstances(attribs: string[], defines: MaterialDefines): void;
  6288. static BindLightShadow(light: Light, scene: Scene, mesh: AbstractMesh, lightIndex: string, effect: Effect, depthValuesAlreadySet: boolean): boolean;
  6289. static BindLightProperties(light: Light, effect: Effect, lightIndex: number): void;
  6290. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, maxSimultaneousLights?: number): void;
  6291. static BindFogParameters(scene: Scene, mesh: AbstractMesh, effect: Effect): void;
  6292. static BindBonesParameters(mesh: AbstractMesh, effect: Effect): void;
  6293. static BindMorphTargetParameters(abstractMesh: AbstractMesh, effect: Effect): void;
  6294. static BindLogDepth(defines: MaterialDefines, effect: Effect, scene: Scene): void;
  6295. static BindClipPlane(effect: Effect, scene: Scene): void;
  6296. }
  6297. }
  6298. declare module BABYLON {
  6299. class MultiMaterial extends Material {
  6300. subMaterials: Material[];
  6301. constructor(name: string, scene: Scene);
  6302. getSubMaterial(index: any): Material;
  6303. getClassName(): string;
  6304. isReady(mesh?: AbstractMesh): boolean;
  6305. clone(name: string, cloneChildren?: boolean): MultiMaterial;
  6306. serialize(): any;
  6307. }
  6308. }
  6309. declare module BABYLON {
  6310. /**
  6311. * The Physically based material of BJS.
  6312. *
  6313. * This offers the main features of a standard PBR material.
  6314. * For more information, please refer to the documentation :
  6315. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  6316. */
  6317. class PBRMaterial extends BABYLON.Material {
  6318. /**
  6319. * Intensity of the direct lights e.g. the four lights available in your scene.
  6320. * This impacts both the direct diffuse and specular highlights.
  6321. */
  6322. directIntensity: number;
  6323. /**
  6324. * Intensity of the emissive part of the material.
  6325. * This helps controlling the emissive effect without modifying the emissive color.
  6326. */
  6327. emissiveIntensity: number;
  6328. /**
  6329. * Intensity of the environment e.g. how much the environment will light the object
  6330. * either through harmonics for rough material or through the refelction for shiny ones.
  6331. */
  6332. environmentIntensity: number;
  6333. /**
  6334. * This is a special control allowing the reduction of the specular highlights coming from the
  6335. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  6336. */
  6337. specularIntensity: number;
  6338. private _lightingInfos;
  6339. /**
  6340. * Debug Control allowing disabling the bump map on this material.
  6341. */
  6342. disableBumpMap: boolean;
  6343. /**
  6344. * Debug Control helping enforcing or dropping the darkness of shadows.
  6345. * 1.0 means the shadows have their normal darkness, 0.0 means the shadows are not visible.
  6346. */
  6347. overloadedShadowIntensity: number;
  6348. /**
  6349. * Debug Control helping dropping the shading effect coming from the diffuse lighting.
  6350. * 1.0 means the shade have their normal impact, 0.0 means no shading at all.
  6351. */
  6352. overloadedShadeIntensity: number;
  6353. private _overloadedShadowInfos;
  6354. /**
  6355. * The camera exposure used on this material.
  6356. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  6357. * This corresponds to a photographic exposure.
  6358. */
  6359. cameraExposure: number;
  6360. /**
  6361. * The camera contrast used on this material.
  6362. * This property is here and not in the camera to allow controlling contrast without full screen post process.
  6363. */
  6364. cameraContrast: number;
  6365. /**
  6366. * Color Grading 2D Lookup Texture.
  6367. * This allows special effects like sepia, black and white to sixties rendering style.
  6368. */
  6369. cameraColorGradingTexture: BaseTexture;
  6370. /**
  6371. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  6372. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  6373. * 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;
  6374. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  6375. */
  6376. cameraColorCurves: ColorCurves;
  6377. private _cameraInfos;
  6378. private _microsurfaceTextureLods;
  6379. /**
  6380. * Debug Control allowing to overload the ambient color.
  6381. * This as to be use with the overloadedAmbientIntensity parameter.
  6382. */
  6383. overloadedAmbient: Color3;
  6384. /**
  6385. * Debug Control indicating how much the overloaded ambient color is used against the default one.
  6386. */
  6387. overloadedAmbientIntensity: number;
  6388. /**
  6389. * Debug Control allowing to overload the albedo color.
  6390. * This as to be use with the overloadedAlbedoIntensity parameter.
  6391. */
  6392. overloadedAlbedo: Color3;
  6393. /**
  6394. * Debug Control indicating how much the overloaded albedo color is used against the default one.
  6395. */
  6396. overloadedAlbedoIntensity: number;
  6397. /**
  6398. * Debug Control allowing to overload the reflectivity color.
  6399. * This as to be use with the overloadedReflectivityIntensity parameter.
  6400. */
  6401. overloadedReflectivity: Color3;
  6402. /**
  6403. * Debug Control indicating how much the overloaded reflectivity color is used against the default one.
  6404. */
  6405. overloadedReflectivityIntensity: number;
  6406. /**
  6407. * Debug Control allowing to overload the emissive color.
  6408. * This as to be use with the overloadedEmissiveIntensity parameter.
  6409. */
  6410. overloadedEmissive: Color3;
  6411. /**
  6412. * Debug Control indicating how much the overloaded emissive color is used against the default one.
  6413. */
  6414. overloadedEmissiveIntensity: number;
  6415. private _overloadedIntensity;
  6416. /**
  6417. * Debug Control allowing to overload the reflection color.
  6418. * This as to be use with the overloadedReflectionIntensity parameter.
  6419. */
  6420. overloadedReflection: Color3;
  6421. /**
  6422. * Debug Control indicating how much the overloaded reflection color is used against the default one.
  6423. */
  6424. overloadedReflectionIntensity: number;
  6425. /**
  6426. * Debug Control allowing to overload the microsurface.
  6427. * This as to be use with the overloadedMicroSurfaceIntensity parameter.
  6428. */
  6429. overloadedMicroSurface: number;
  6430. /**
  6431. * Debug Control indicating how much the overloaded microsurface is used against the default one.
  6432. */
  6433. overloadedMicroSurfaceIntensity: number;
  6434. private _overloadedMicroSurface;
  6435. /**
  6436. * AKA Diffuse Texture in standard nomenclature.
  6437. */
  6438. albedoTexture: BaseTexture;
  6439. /**
  6440. * AKA Occlusion Texture in other nomenclature.
  6441. */
  6442. ambientTexture: BaseTexture;
  6443. /**
  6444. * AKA Occlusion Texture Intensity in other nomenclature.
  6445. */
  6446. ambientTextureStrength: number;
  6447. opacityTexture: BaseTexture;
  6448. reflectionTexture: BaseTexture;
  6449. emissiveTexture: BaseTexture;
  6450. /**
  6451. * AKA Specular texture in other nomenclature.
  6452. */
  6453. reflectivityTexture: BaseTexture;
  6454. /**
  6455. * Used to switch from specular/glossiness to metallic/roughness workflow.
  6456. */
  6457. metallicTexture: BaseTexture;
  6458. /**
  6459. * Specifies the metallic scalar of the metallic/roughness workflow.
  6460. * Can also be used to scale the metalness values of the metallic texture.
  6461. */
  6462. metallic: number;
  6463. /**
  6464. * Specifies the roughness scalar of the metallic/roughness workflow.
  6465. * Can also be used to scale the roughness values of the metallic texture.
  6466. */
  6467. roughness: number;
  6468. /**
  6469. * Used to enable roughness/glossiness fetch from a separate chanel depending on the current mode.
  6470. * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
  6471. */
  6472. microSurfaceTexture: BaseTexture;
  6473. bumpTexture: BaseTexture;
  6474. lightmapTexture: BaseTexture;
  6475. refractionTexture: BaseTexture;
  6476. ambientColor: Color3;
  6477. /**
  6478. * AKA Diffuse Color in other nomenclature.
  6479. */
  6480. albedoColor: Color3;
  6481. /**
  6482. * AKA Specular Color in other nomenclature.
  6483. */
  6484. reflectivityColor: Color3;
  6485. reflectionColor: Color3;
  6486. emissiveColor: Color3;
  6487. /**
  6488. * AKA Glossiness in other nomenclature.
  6489. */
  6490. microSurface: number;
  6491. /**
  6492. * source material index of refraction (IOR)' / 'destination material IOR.
  6493. */
  6494. indexOfRefraction: number;
  6495. /**
  6496. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  6497. */
  6498. invertRefractionY: boolean;
  6499. opacityFresnelParameters: FresnelParameters;
  6500. emissiveFresnelParameters: FresnelParameters;
  6501. /**
  6502. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  6503. * Materials half opaque for instance using refraction could benefit from this control.
  6504. */
  6505. linkRefractionWithTransparency: boolean;
  6506. /**
  6507. * The emissive and albedo are linked to never be more than one (Energy conservation).
  6508. */
  6509. linkEmissiveWithAlbedo: boolean;
  6510. useLightmapAsShadowmap: boolean;
  6511. /**
  6512. * In this mode, the emissive informtaion will always be added to the lighting once.
  6513. * A light for instance can be thought as emissive.
  6514. */
  6515. useEmissiveAsIllumination: boolean;
  6516. /**
  6517. * Secifies that the alpha is coming form the albedo channel alpha channel.
  6518. */
  6519. useAlphaFromAlbedoTexture: boolean;
  6520. /**
  6521. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  6522. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  6523. */
  6524. useSpecularOverAlpha: boolean;
  6525. /**
  6526. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  6527. */
  6528. useMicroSurfaceFromReflectivityMapAlpha: boolean;
  6529. /**
  6530. * Specifies if the metallic texture contains the roughness information in its alpha channel.
  6531. */
  6532. useRoughnessFromMetallicTextureAlpha: boolean;
  6533. /**
  6534. * Specifies if the metallic texture contains the roughness information in its green channel.
  6535. */
  6536. useRoughnessFromMetallicTextureGreen: boolean;
  6537. /**
  6538. * Specifies if the metallic texture contains the metallness information in its blue channel.
  6539. */
  6540. useMetallnessFromMetallicTextureBlue: boolean;
  6541. /**
  6542. * Specifies if the metallic texture contains the ambient occlusion information in its red channel.
  6543. */
  6544. useAmbientOcclusionFromMetallicTextureRed: boolean;
  6545. /**
  6546. * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
  6547. */
  6548. useAmbientInGrayScale: boolean;
  6549. /**
  6550. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  6551. * The material will try to infer what glossiness each pixel should be.
  6552. */
  6553. useAutoMicroSurfaceFromReflectivityMap: boolean;
  6554. /**
  6555. * Allows to work with scalar in linear mode. This is definitely a matter of preferences and tools used during
  6556. * the creation of the material.
  6557. */
  6558. useScalarInLinearSpace: boolean;
  6559. /**
  6560. * BJS is using an harcoded light falloff based on a manually sets up range.
  6561. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  6562. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  6563. */
  6564. usePhysicalLightFalloff: boolean;
  6565. /**
  6566. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  6567. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  6568. */
  6569. useRadianceOverAlpha: boolean;
  6570. /**
  6571. * Allows using the bump map in parallax mode.
  6572. */
  6573. useParallax: boolean;
  6574. /**
  6575. * Allows using the bump map in parallax occlusion mode.
  6576. */
  6577. useParallaxOcclusion: boolean;
  6578. /**
  6579. * Controls the scale bias of the parallax mode.
  6580. */
  6581. parallaxScaleBias: number;
  6582. /**
  6583. * If sets to true, disables all the lights affecting the material.
  6584. */
  6585. disableLighting: boolean;
  6586. /**
  6587. * Number of Simultaneous lights allowed on the material.
  6588. */
  6589. maxSimultaneousLights: number;
  6590. /**
  6591. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  6592. */
  6593. invertNormalMapX: boolean;
  6594. /**
  6595. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  6596. */
  6597. invertNormalMapY: boolean;
  6598. /**
  6599. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  6600. */
  6601. twoSidedLighting: boolean;
  6602. private _renderTargets;
  6603. private _worldViewProjectionMatrix;
  6604. private _globalAmbientColor;
  6605. private _tempColor;
  6606. private _renderId;
  6607. private _defines;
  6608. private _cachedDefines;
  6609. private _useLogarithmicDepth;
  6610. /**
  6611. * Instantiates a new PBRMaterial instance.
  6612. *
  6613. * @param name The material name
  6614. * @param scene The scene the material will be use in.
  6615. */
  6616. constructor(name: string, scene: Scene);
  6617. getClassName(): string;
  6618. useLogarithmicDepth: boolean;
  6619. needAlphaBlending(): boolean;
  6620. needAlphaTesting(): boolean;
  6621. private _shouldUseAlphaFromAlbedoTexture();
  6622. getAlphaTestTexture(): BaseTexture;
  6623. private _checkCache(scene, mesh?, useInstances?);
  6624. private convertColorToLinearSpaceToRef(color, ref);
  6625. private static convertColorToLinearSpaceToRef(color, ref, useScalarInLinear);
  6626. private static _scaledAlbedo;
  6627. private static _scaledReflectivity;
  6628. private static _scaledEmissive;
  6629. private static _scaledReflection;
  6630. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, useScalarInLinearSpace: boolean, maxSimultaneousLights: number, usePhysicalLightFalloff: boolean): void;
  6631. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  6632. buildUniformLayout(): void;
  6633. unbind(): void;
  6634. bindOnlyWorldMatrix(world: Matrix): void;
  6635. private _myScene;
  6636. private _myShadowGenerator;
  6637. bind(world: Matrix, mesh?: Mesh): void;
  6638. getAnimatables(): IAnimatable[];
  6639. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  6640. clone(name: string): PBRMaterial;
  6641. serialize(): any;
  6642. static Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial;
  6643. }
  6644. }
  6645. declare module BABYLON {
  6646. class PushMaterial extends Material {
  6647. protected _activeEffect: Effect;
  6648. constructor(name: string, scene: Scene);
  6649. getEffect(): Effect;
  6650. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  6651. bindOnlyWorldMatrix(world: Matrix): void;
  6652. bind(world: Matrix, mesh?: Mesh): void;
  6653. protected _afterBind(mesh: Mesh, effect?: Effect): void;
  6654. protected _mustRebind(scene: Scene, effect: Effect, visibility?: number): boolean;
  6655. markAsDirty(flag: number): void;
  6656. protected _markAllSubMeshesAsDirty(func: (defines: MaterialDefines) => void): void;
  6657. protected _markAllSubMeshesAsTexturesDirty(): void;
  6658. protected _markAllSubMeshesAsFresnelDirty(): void;
  6659. protected _markAllSubMeshesAsLightsDirty(): void;
  6660. protected _markAllSubMeshesAsAttributesDirty(): void;
  6661. protected _markAllSubMeshesAsMiscDirty(): void;
  6662. }
  6663. }
  6664. declare module BABYLON {
  6665. class ShaderMaterial extends Material {
  6666. private _shaderPath;
  6667. private _options;
  6668. private _textures;
  6669. private _textureArrays;
  6670. private _floats;
  6671. private _floatsArrays;
  6672. private _colors3;
  6673. private _colors4;
  6674. private _vectors2;
  6675. private _vectors3;
  6676. private _vectors4;
  6677. private _matrices;
  6678. private _matrices3x3;
  6679. private _matrices2x2;
  6680. private _vectors3Arrays;
  6681. private _cachedWorldViewMatrix;
  6682. private _renderId;
  6683. constructor(name: string, scene: Scene, shaderPath: any, options: any);
  6684. getClassName(): string;
  6685. needAlphaBlending(): boolean;
  6686. needAlphaTesting(): boolean;
  6687. private _checkUniform(uniformName);
  6688. setTexture(name: string, texture: Texture): ShaderMaterial;
  6689. setTextureArray(name: string, textures: Texture[]): ShaderMaterial;
  6690. setFloat(name: string, value: number): ShaderMaterial;
  6691. setFloats(name: string, value: number[]): ShaderMaterial;
  6692. setColor3(name: string, value: Color3): ShaderMaterial;
  6693. setColor4(name: string, value: Color4): ShaderMaterial;
  6694. setVector2(name: string, value: Vector2): ShaderMaterial;
  6695. setVector3(name: string, value: Vector3): ShaderMaterial;
  6696. setVector4(name: string, value: Vector4): ShaderMaterial;
  6697. setMatrix(name: string, value: Matrix): ShaderMaterial;
  6698. setMatrix3x3(name: string, value: Float32Array): ShaderMaterial;
  6699. setMatrix2x2(name: string, value: Float32Array): ShaderMaterial;
  6700. setArray3(name: string, value: number[]): ShaderMaterial;
  6701. private _checkCache(scene, mesh?, useInstances?);
  6702. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  6703. bindOnlyWorldMatrix(world: Matrix): void;
  6704. bind(world: Matrix, mesh?: Mesh): void;
  6705. clone(name: string): ShaderMaterial;
  6706. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  6707. serialize(): any;
  6708. static Parse(source: any, scene: Scene, rootUrl: string): ShaderMaterial;
  6709. }
  6710. }
  6711. declare module BABYLON {
  6712. class StandardMaterialDefines extends MaterialDefines {
  6713. DIFFUSE: boolean;
  6714. AMBIENT: boolean;
  6715. OPACITY: boolean;
  6716. OPACITYRGB: boolean;
  6717. REFLECTION: boolean;
  6718. EMISSIVE: boolean;
  6719. SPECULAR: boolean;
  6720. BUMP: boolean;
  6721. PARALLAX: boolean;
  6722. PARALLAXOCCLUSION: boolean;
  6723. SPECULAROVERALPHA: boolean;
  6724. CLIPPLANE: boolean;
  6725. ALPHATEST: boolean;
  6726. ALPHAFROMDIFFUSE: boolean;
  6727. POINTSIZE: boolean;
  6728. FOG: boolean;
  6729. SPECULARTERM: boolean;
  6730. DIFFUSEFRESNEL: boolean;
  6731. OPACITYFRESNEL: boolean;
  6732. REFLECTIONFRESNEL: boolean;
  6733. REFRACTIONFRESNEL: boolean;
  6734. EMISSIVEFRESNEL: boolean;
  6735. FRESNEL: boolean;
  6736. NORMAL: boolean;
  6737. UV1: boolean;
  6738. UV2: boolean;
  6739. VERTEXCOLOR: boolean;
  6740. VERTEXALPHA: boolean;
  6741. NUM_BONE_INFLUENCERS: number;
  6742. BonesPerMesh: number;
  6743. INSTANCES: boolean;
  6744. GLOSSINESS: boolean;
  6745. ROUGHNESS: boolean;
  6746. EMISSIVEASILLUMINATION: boolean;
  6747. LINKEMISSIVEWITHDIFFUSE: boolean;
  6748. REFLECTIONFRESNELFROMSPECULAR: boolean;
  6749. LIGHTMAP: boolean;
  6750. USELIGHTMAPASSHADOWMAP: boolean;
  6751. REFLECTIONMAP_3D: boolean;
  6752. REFLECTIONMAP_SPHERICAL: boolean;
  6753. REFLECTIONMAP_PLANAR: boolean;
  6754. REFLECTIONMAP_CUBIC: boolean;
  6755. REFLECTIONMAP_PROJECTION: boolean;
  6756. REFLECTIONMAP_SKYBOX: boolean;
  6757. REFLECTIONMAP_EXPLICIT: boolean;
  6758. REFLECTIONMAP_EQUIRECTANGULAR: boolean;
  6759. REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
  6760. REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
  6761. INVERTCUBICMAP: boolean;
  6762. LOGARITHMICDEPTH: boolean;
  6763. REFRACTION: boolean;
  6764. REFRACTIONMAP_3D: boolean;
  6765. REFLECTIONOVERALPHA: boolean;
  6766. INVERTNORMALMAPX: boolean;
  6767. INVERTNORMALMAPY: boolean;
  6768. TWOSIDEDLIGHTING: boolean;
  6769. SHADOWFULLFLOAT: boolean;
  6770. CAMERACOLORGRADING: boolean;
  6771. CAMERACOLORCURVES: boolean;
  6772. MORPHTARGETS: boolean;
  6773. MORPHTARGETS_NORMAL: boolean;
  6774. MORPHTARGETS_TANGENT: boolean;
  6775. NUM_MORPH_INFLUENCERS: number;
  6776. constructor();
  6777. setReflectionMode(modeToEnable: string): void;
  6778. }
  6779. class StandardMaterial extends PushMaterial {
  6780. private _diffuseTexture;
  6781. diffuseTexture: BaseTexture;
  6782. private _ambientTexture;
  6783. ambientTexture: BaseTexture;
  6784. private _opacityTexture;
  6785. opacityTexture: BaseTexture;
  6786. private _reflectionTexture;
  6787. reflectionTexture: BaseTexture;
  6788. private _emissiveTexture;
  6789. emissiveTexture: BaseTexture;
  6790. private _specularTexture;
  6791. specularTexture: BaseTexture;
  6792. private _bumpTexture;
  6793. bumpTexture: BaseTexture;
  6794. private _lightmapTexture;
  6795. lightmapTexture: BaseTexture;
  6796. private _refractionTexture;
  6797. refractionTexture: BaseTexture;
  6798. ambientColor: Color3;
  6799. diffuseColor: Color3;
  6800. specularColor: Color3;
  6801. emissiveColor: Color3;
  6802. specularPower: number;
  6803. private _useAlphaFromDiffuseTexture;
  6804. useAlphaFromDiffuseTexture: boolean;
  6805. private _useEmissiveAsIllumination;
  6806. useEmissiveAsIllumination: boolean;
  6807. private _linkEmissiveWithDiffuse;
  6808. linkEmissiveWithDiffuse: boolean;
  6809. private _useSpecularOverAlpha;
  6810. useSpecularOverAlpha: boolean;
  6811. private _useReflectionOverAlpha;
  6812. useReflectionOverAlpha: boolean;
  6813. private _disableLighting;
  6814. disableLighting: boolean;
  6815. private _useParallax;
  6816. useParallax: boolean;
  6817. private _useParallaxOcclusion;
  6818. useParallaxOcclusion: boolean;
  6819. parallaxScaleBias: number;
  6820. private _roughness;
  6821. roughness: number;
  6822. indexOfRefraction: number;
  6823. invertRefractionY: boolean;
  6824. private _useLightmapAsShadowmap;
  6825. useLightmapAsShadowmap: boolean;
  6826. private _diffuseFresnelParameters;
  6827. diffuseFresnelParameters: FresnelParameters;
  6828. private _opacityFresnelParameters;
  6829. opacityFresnelParameters: FresnelParameters;
  6830. private _reflectionFresnelParameters;
  6831. reflectionFresnelParameters: FresnelParameters;
  6832. private _refractionFresnelParameters;
  6833. refractionFresnelParameters: FresnelParameters;
  6834. private _emissiveFresnelParameters;
  6835. emissiveFresnelParameters: FresnelParameters;
  6836. private _useReflectionFresnelFromSpecular;
  6837. useReflectionFresnelFromSpecular: boolean;
  6838. private _useGlossinessFromSpecularMapAlpha;
  6839. useGlossinessFromSpecularMapAlpha: boolean;
  6840. private _maxSimultaneousLights;
  6841. maxSimultaneousLights: number;
  6842. /**
  6843. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  6844. */
  6845. private _invertNormalMapX;
  6846. invertNormalMapX: boolean;
  6847. /**
  6848. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  6849. */
  6850. private _invertNormalMapY;
  6851. invertNormalMapY: boolean;
  6852. /**
  6853. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  6854. */
  6855. private _twoSidedLighting;
  6856. twoSidedLighting: boolean;
  6857. /**
  6858. * Color Grading 2D Lookup Texture.
  6859. * This allows special effects like sepia, black and white to sixties rendering style.
  6860. */
  6861. private _cameraColorGradingTexture;
  6862. cameraColorGradingTexture: BaseTexture;
  6863. /**
  6864. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  6865. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  6866. * 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;
  6867. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  6868. */
  6869. private _cameraColorCurves;
  6870. cameraColorCurves: ColorCurves;
  6871. customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines) => string;
  6872. protected _renderTargets: SmartArray<RenderTargetTexture>;
  6873. protected _worldViewProjectionMatrix: Matrix;
  6874. protected _globalAmbientColor: Color3;
  6875. protected _useLogarithmicDepth: boolean;
  6876. constructor(name: string, scene: Scene);
  6877. getClassName(): string;
  6878. useLogarithmicDepth: boolean;
  6879. needAlphaBlending(): boolean;
  6880. needAlphaTesting(): boolean;
  6881. protected _shouldUseAlphaFromDiffuseTexture(): boolean;
  6882. getAlphaTestTexture(): BaseTexture;
  6883. /**
  6884. * Child classes can use it to update shaders
  6885. */
  6886. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  6887. buildUniformLayout(): void;
  6888. unbind(): void;
  6889. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  6890. getAnimatables(): IAnimatable[];
  6891. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  6892. clone(name: string): StandardMaterial;
  6893. serialize(): any;
  6894. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial;
  6895. static _DiffuseTextureEnabled: boolean;
  6896. static DiffuseTextureEnabled: boolean;
  6897. static _AmbientTextureEnabled: boolean;
  6898. static AmbientTextureEnabled: boolean;
  6899. static _OpacityTextureEnabled: boolean;
  6900. static OpacityTextureEnabled: boolean;
  6901. static _ReflectionTextureEnabled: boolean;
  6902. static ReflectionTextureEnabled: boolean;
  6903. static _EmissiveTextureEnabled: boolean;
  6904. static EmissiveTextureEnabled: boolean;
  6905. static _SpecularTextureEnabled: boolean;
  6906. static SpecularTextureEnabled: boolean;
  6907. static _BumpTextureEnabled: boolean;
  6908. static BumpTextureEnabled: boolean;
  6909. static _LightmapTextureEnabled: boolean;
  6910. static LightmapTextureEnabled: boolean;
  6911. static _RefractionTextureEnabled: boolean;
  6912. static RefractionTextureEnabled: boolean;
  6913. static _ColorGradingTextureEnabled: boolean;
  6914. static ColorGradingTextureEnabled: boolean;
  6915. static _FresnelEnabled: boolean;
  6916. static FresnelEnabled: boolean;
  6917. }
  6918. }
  6919. declare module BABYLON {
  6920. class UniformBuffer {
  6921. private _engine;
  6922. private _buffer;
  6923. private _data;
  6924. private _bufferData;
  6925. private _dynamic;
  6926. private _uniformName;
  6927. private _uniformLocations;
  6928. private _uniformSizes;
  6929. private _uniformLocationPointer;
  6930. private _needSync;
  6931. private _cache;
  6932. private _noUBO;
  6933. private _currentEffect;
  6934. private static _MAX_UNIFORM_SIZE;
  6935. private static _tempBuffer;
  6936. /**
  6937. * Wrapper for updateUniform.
  6938. * @method updateMatrix3x3
  6939. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6940. * @param {Float32Array} matrix
  6941. */
  6942. updateMatrix3x3: (name: string, matrix: Float32Array) => void;
  6943. /**
  6944. * Wrapper for updateUniform.
  6945. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6946. * @param {Float32Array} matrix
  6947. */
  6948. updateMatrix2x2: (name: string, matrix: Float32Array) => void;
  6949. /**
  6950. * Wrapper for updateUniform.
  6951. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6952. * @param {number} x
  6953. */
  6954. updateFloat: (name: string, x: number) => void;
  6955. /**
  6956. * Wrapper for updateUniform.
  6957. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6958. * @param {number} x
  6959. * @param {number} y
  6960. */
  6961. updateFloat2: (name: string, x: number, y: number) => void;
  6962. /**
  6963. * Wrapper for updateUniform.
  6964. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6965. * @param {number} x
  6966. * @param {number} y
  6967. * @param {number} z
  6968. * @param {string} [suffix] Suffix to add to the uniform name.
  6969. */
  6970. updateFloat3: (name: string, x: number, y: number, z: number, suffix?: string) => void;
  6971. /**
  6972. * Wrapper for updateUniform.
  6973. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6974. * @param {number} x
  6975. * @param {number} y
  6976. * @param {number} z
  6977. * @param {number} w
  6978. * @param {string} [suffix] Suffix to add to the uniform name.
  6979. */
  6980. updateFloat4: (name: string, x: number, y: number, z: number, w: number, suffix?: string) => void;
  6981. /**
  6982. * Wrapper for updateUniform.
  6983. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6984. * @param {Matrix} A 4x4 matrix.
  6985. */
  6986. updateMatrix: (name: string, mat: Matrix) => void;
  6987. /**
  6988. * Wrapper for updateUniform.
  6989. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6990. * @param {Vector3} vector
  6991. */
  6992. updateVector3: (name: string, vector: Vector3) => void;
  6993. /**
  6994. * Wrapper for updateUniform.
  6995. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  6996. * @param {Vector4} vector
  6997. */
  6998. updateVector4: (name: string, vector: Vector4) => void;
  6999. /**
  7000. * Wrapper for updateUniform.
  7001. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7002. * @param {Color3} color
  7003. * @param {string} [suffix] Suffix to add to the uniform name.
  7004. */
  7005. updateColor3: (name: string, color: Color3, suffix?: string) => void;
  7006. /**
  7007. * Wrapper for updateUniform.
  7008. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7009. * @param {Color3} color
  7010. * @param {number} alpha
  7011. * @param {string} [suffix] Suffix to add to the uniform name.
  7012. */
  7013. updateColor4: (name: string, color: Color3, alpha: number, suffix?: string) => void;
  7014. /**
  7015. * Uniform buffer objects.
  7016. *
  7017. * Handles blocks of uniform on the GPU.
  7018. *
  7019. * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.
  7020. *
  7021. * For more information, please refer to :
  7022. * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object
  7023. */
  7024. constructor(engine: Engine, data?: number[], dynamic?: boolean);
  7025. /**
  7026. * Indicates if the buffer is using the WebGL2 UBO implementation,
  7027. * or just falling back on setUniformXXX calls.
  7028. */
  7029. readonly useUbo: boolean;
  7030. /**
  7031. * Indicates if the WebGL underlying uniform buffer is in sync
  7032. * with the javascript cache data.
  7033. */
  7034. readonly isSync: boolean;
  7035. /**
  7036. * Indicates if the WebGL underlying uniform buffer is dynamic.
  7037. * Also, a dynamic UniformBuffer will disable cache verification and always
  7038. * update the underlying WebGL uniform buffer to the GPU.
  7039. */
  7040. isDynamic(): boolean;
  7041. /**
  7042. * The data cache on JS side.
  7043. */
  7044. getData(): Float32Array;
  7045. /**
  7046. * The underlying WebGL Uniform buffer.
  7047. */
  7048. getBuffer(): WebGLBuffer;
  7049. /**
  7050. * std140 layout specifies how to align data within an UBO structure.
  7051. * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159
  7052. * for specs.
  7053. */
  7054. private _fillAlignment(size);
  7055. /**
  7056. * Adds an uniform in the buffer.
  7057. * Warning : the subsequents calls of this function must be in the same order as declared in the shader
  7058. * for the layout to be correct !
  7059. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7060. * @param {number|number[]} size Data size, or data directly.
  7061. */
  7062. addUniform(name: string, size: number | number[]): void;
  7063. /**
  7064. * Wrapper for addUniform.
  7065. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7066. * @param {Matrix} mat A 4x4 matrix.
  7067. */
  7068. addMatrix(name: string, mat: Matrix): void;
  7069. /**
  7070. * Wrapper for addUniform.
  7071. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7072. * @param {number} x
  7073. * @param {number} y
  7074. */
  7075. addFloat2(name: string, x: number, y: number): void;
  7076. /**
  7077. * Wrapper for addUniform.
  7078. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7079. * @param {number} x
  7080. * @param {number} y
  7081. * @param {number} z
  7082. */
  7083. addFloat3(name: string, x: number, y: number, z: number): void;
  7084. /**
  7085. * Wrapper for addUniform.
  7086. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7087. * @param {Color3} color
  7088. */
  7089. addColor3(name: string, color: Color3): void;
  7090. /**
  7091. * Wrapper for addUniform.
  7092. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7093. * @param {Color3} color
  7094. * @param {number} alpha
  7095. */
  7096. addColor4(name: string, color: Color3, alpha: number): void;
  7097. /**
  7098. * Wrapper for addUniform.
  7099. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7100. * @param {Vector3} vector
  7101. */
  7102. addVector3(name: string, vector: Vector3): void;
  7103. /**
  7104. * Wrapper for addUniform.
  7105. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7106. */
  7107. addMatrix3x3(name: string): void;
  7108. /**
  7109. * Wrapper for addUniform.
  7110. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  7111. */
  7112. addMatrix2x2(name: string): void;
  7113. /**
  7114. * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.
  7115. */
  7116. create(): void;
  7117. /**
  7118. * Updates the WebGL Uniform Buffer on the GPU.
  7119. * If the `dynamic` flag is set to true, no cache comparison is done.
  7120. * Otherwise, the buffer will be updated only if the cache differs.
  7121. */
  7122. update(): void;
  7123. /**
  7124. * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.
  7125. * @param {string} uniformName Name of the uniform, as used in the uniform block in the shader.
  7126. * @param {number[]|Float32Array} data Flattened data
  7127. * @param {number} size Size of the data.
  7128. */
  7129. updateUniform(uniformName: string, data: number[] | Float32Array, size: number): void;
  7130. private _updateMatrix3x3ForUniform(name, matrix);
  7131. private _updateMatrix3x3ForEffect(name, matrix);
  7132. private _updateMatrix2x2ForEffect(name, matrix);
  7133. private _updateMatrix2x2ForUniform(name, matrix);
  7134. private _updateFloatForEffect(name, x);
  7135. private _updateFloatForUniform(name, x);
  7136. private _updateFloat2ForEffect(name, x, y);
  7137. private _updateFloat2ForUniform(name, x, y);
  7138. private _updateFloat3ForEffect(name, x, y, z, suffix?);
  7139. private _updateFloat3ForUniform(name, x, y, z, suffix?);
  7140. private _updateFloat4ForEffect(name, x, y, z, w, suffix?);
  7141. private _updateFloat4ForUniform(name, x, y, z, w, suffix?);
  7142. private _updateMatrixForEffect(name, mat);
  7143. private _updateMatrixForUniform(name, mat);
  7144. private _updateVector3ForEffect(name, vector);
  7145. private _updateVector3ForUniform(name, vector);
  7146. private _updateVector4ForEffect(name, vector);
  7147. private _updateVector4ForUniform(name, vector);
  7148. private _updateColor3ForEffect(name, color, suffix?);
  7149. private _updateColor3ForUniform(name, color, suffix?);
  7150. private _updateColor4ForEffect(name, color, alpha, suffix?);
  7151. private _updateColor4ForUniform(name, color, alpha, suffix?);
  7152. /**
  7153. * Sets a sampler uniform on the effect.
  7154. * @param {string} name Name of the sampler.
  7155. * @param {Texture} texture
  7156. */
  7157. setTexture(name: string, texture: BaseTexture): void;
  7158. /**
  7159. * Directly updates the value of the uniform in the cache AND on the GPU.
  7160. * @param {string} uniformName Name of the uniform, as used in the uniform block in the shader.
  7161. * @param {number[]|Float32Array} data Flattened data
  7162. */
  7163. updateUniformDirectly(uniformName: string, data: number[] | Float32Array): void;
  7164. /**
  7165. * Binds this uniform buffer to an effect.
  7166. * @param {Effect} effect
  7167. * @param {string} name Name of the uniform block in the shader.
  7168. */
  7169. bindToEffect(effect: Effect, name: string): void;
  7170. /**
  7171. * Disposes the uniform buffer.
  7172. */
  7173. dispose(): void;
  7174. }
  7175. }
  7176. declare module BABYLON {
  7177. interface ISceneLoaderPluginExtensions {
  7178. [extension: string]: {
  7179. isBinary: boolean;
  7180. };
  7181. }
  7182. interface ISceneLoaderPlugin {
  7183. extensions: string | ISceneLoaderPluginExtensions;
  7184. importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean;
  7185. load: (scene: Scene, data: string, rootUrl: string) => boolean;
  7186. }
  7187. interface ISceneLoaderPluginAsync {
  7188. extensions: string | ISceneLoaderPluginExtensions;
  7189. importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onsuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onerror: () => void) => void;
  7190. loadAsync: (scene: Scene, data: string, rootUrl: string, onsuccess: () => void, onerror: () => void) => void;
  7191. }
  7192. class SceneLoader {
  7193. private static _ForceFullSceneLoadingForIncremental;
  7194. private static _ShowLoadingScreen;
  7195. static readonly NO_LOGGING: number;
  7196. static readonly MINIMAL_LOGGING: number;
  7197. static readonly SUMMARY_LOGGING: number;
  7198. static readonly DETAILED_LOGGING: number;
  7199. private static _loggingLevel;
  7200. static ForceFullSceneLoadingForIncremental: boolean;
  7201. static ShowLoadingScreen: boolean;
  7202. static loggingLevel: number;
  7203. private static _registeredPlugins;
  7204. private static _getDefaultPlugin();
  7205. private static _getPluginForExtension(extension);
  7206. private static _getPluginForFilename(sceneFilename);
  7207. private static _getDirectLoad(sceneFilename);
  7208. static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  7209. static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
  7210. 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;
  7211. /**
  7212. * Load a scene
  7213. * @param rootUrl a string that defines the root url for scene and resources
  7214. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  7215. * @param engine is the instance of BABYLON.Engine to use to create the scene
  7216. */
  7217. static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  7218. /**
  7219. * Append a scene
  7220. * @param rootUrl a string that defines the root url for scene and resources
  7221. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  7222. * @param scene is the instance of BABYLON.Scene to append to
  7223. */
  7224. static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  7225. }
  7226. }
  7227. declare module BABYLON {
  7228. class SIMDHelper {
  7229. private static _isEnabled;
  7230. static readonly IsEnabled: boolean;
  7231. static DisableSIMD(): void;
  7232. static EnableSIMD(): void;
  7233. }
  7234. }
  7235. declare module BABYLON {
  7236. const ToGammaSpace: number;
  7237. const ToLinearSpace = 2.2;
  7238. const Epsilon = 0.001;
  7239. class MathTools {
  7240. /**
  7241. * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
  7242. */
  7243. static WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
  7244. /**
  7245. * Returns a string : the upper case translation of the number i to hexadecimal.
  7246. */
  7247. static ToHex(i: number): string;
  7248. /**
  7249. * Returns -1 if value is negative and +1 is value is positive.
  7250. * Returns the value itself if it's equal to zero.
  7251. */
  7252. static Sign(value: number): number;
  7253. /**
  7254. * Returns the value itself if it's between min and max.
  7255. * Returns min if the value is lower than min.
  7256. * Returns max if the value is greater than max.
  7257. */
  7258. static Clamp(value: number, min?: number, max?: number): number;
  7259. }
  7260. class Scalar {
  7261. /**
  7262. * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
  7263. */
  7264. static Lerp(start: number, end: number, amount: number): number;
  7265. /**
  7266. * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
  7267. */
  7268. static Hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number;
  7269. }
  7270. class Color3 {
  7271. r: number;
  7272. g: number;
  7273. b: number;
  7274. /**
  7275. * Creates a new Color3 object from red, green, blue values, all between 0 and 1.
  7276. */
  7277. constructor(r?: number, g?: number, b?: number);
  7278. /**
  7279. * Returns a string with the Color3 current values.
  7280. */
  7281. toString(): string;
  7282. /**
  7283. * Returns the string "Color3".
  7284. */
  7285. getClassName(): string;
  7286. /**
  7287. * Returns the Color3 hash code.
  7288. */
  7289. getHashCode(): number;
  7290. /**
  7291. * Stores in the passed array from the passed starting index the red, green, blue values as successive elements.
  7292. * Returns the Color3.
  7293. */
  7294. toArray(array: number[] | Float32Array, index?: number): Color3;
  7295. /**
  7296. * Returns a new Color4 object from the current Color3 and the passed alpha.
  7297. */
  7298. toColor4(alpha?: number): Color4;
  7299. /**
  7300. * Returns a new array populated with 3 numeric elements : red, green and blue values.
  7301. */
  7302. asArray(): number[];
  7303. /**
  7304. * Returns the luminance value (float).
  7305. */
  7306. toLuminance(): number;
  7307. /**
  7308. * Multiply each Color3 rgb values by the passed Color3 rgb values in a new Color3 object.
  7309. * Returns this new object.
  7310. */
  7311. multiply(otherColor: Color3): Color3;
  7312. /**
  7313. * Multiply the rgb values of the Color3 and the passed Color3 and stores the result in the object "result".
  7314. * Returns the current Color3.
  7315. */
  7316. multiplyToRef(otherColor: Color3, result: Color3): Color3;
  7317. /**
  7318. * Boolean : True if the rgb values are equal to the passed ones.
  7319. */
  7320. equals(otherColor: Color3): boolean;
  7321. /**
  7322. * Boolean : True if the rgb values are equal to the passed ones.
  7323. */
  7324. equalsFloats(r: number, g: number, b: number): boolean;
  7325. /**
  7326. * Multiplies in place each rgb value by scale.
  7327. * Returns the updated Color3.
  7328. */
  7329. scale(scale: number): Color3;
  7330. /**
  7331. * Multiplies the rgb values by scale and stores the result into "result".
  7332. * Returns the unmodified current Color3.
  7333. */
  7334. scaleToRef(scale: number, result: Color3): Color3;
  7335. /**
  7336. * Returns a new Color3 set with the added values of the current Color3 and of the passed one.
  7337. */
  7338. add(otherColor: Color3): Color3;
  7339. /**
  7340. * Stores the result of the addition of the current Color3 and passed one rgb values into "result".
  7341. * Returns the unmodified current Color3.
  7342. */
  7343. addToRef(otherColor: Color3, result: Color3): Color3;
  7344. /**
  7345. * Returns a new Color3 set with the subtracted values of the passed one from the current Color3 .
  7346. */
  7347. subtract(otherColor: Color3): Color3;
  7348. /**
  7349. * Stores the result of the subtraction of passed one from the current Color3 rgb values into "result".
  7350. * Returns the unmodified current Color3.
  7351. */
  7352. subtractToRef(otherColor: Color3, result: Color3): Color3;
  7353. /**
  7354. * Returns a new Color3 copied the current one.
  7355. */
  7356. clone(): Color3;
  7357. /**
  7358. * Copies the rgb values from the source in the current Color3.
  7359. * Returns the updated Color3.
  7360. */
  7361. copyFrom(source: Color3): Color3;
  7362. /**
  7363. * Updates the Color3 rgb values from the passed floats.
  7364. * Returns the Color3.
  7365. */
  7366. copyFromFloats(r: number, g: number, b: number): Color3;
  7367. /**
  7368. * Updates the Color3 rgb values from the passed floats.
  7369. * Returns the Color3.
  7370. */
  7371. set(r: number, g: number, b: number): Color3;
  7372. /**
  7373. * Returns the Color3 hexadecimal code as a string.
  7374. */
  7375. toHexString(): string;
  7376. /**
  7377. * Returns a new Color3 converted to linear space.
  7378. */
  7379. toLinearSpace(): Color3;
  7380. /**
  7381. * Converts the Color3 values to linear space and stores the result in "convertedColor".
  7382. * Returns the unmodified Color3.
  7383. */
  7384. toLinearSpaceToRef(convertedColor: Color3): Color3;
  7385. /**
  7386. * Returns a new Color3 converted to gamma space.
  7387. */
  7388. toGammaSpace(): Color3;
  7389. /**
  7390. * Converts the Color3 values to gamma space and stores the result in "convertedColor".
  7391. * Returns the unmodified Color3.
  7392. */
  7393. toGammaSpaceToRef(convertedColor: Color3): Color3;
  7394. /**
  7395. * Creates a new Color3 from the string containing valid hexadecimal values.
  7396. */
  7397. static FromHexString(hex: string): Color3;
  7398. /**
  7399. * Creates a new Vector3 from the startind index of the passed array.
  7400. */
  7401. static FromArray(array: ArrayLike<number>, offset?: number): Color3;
  7402. /**
  7403. * Creates a new Color3 from integer values ( < 256).
  7404. */
  7405. static FromInts(r: number, g: number, b: number): Color3;
  7406. /**
  7407. * Creates a new Color3 with values linearly interpolated of "amount" between the start Color3 and the end Color3.
  7408. */
  7409. static Lerp(start: Color3, end: Color3, amount: number): Color3;
  7410. static Red(): Color3;
  7411. static Green(): Color3;
  7412. static Blue(): Color3;
  7413. static Black(): Color3;
  7414. static White(): Color3;
  7415. static Purple(): Color3;
  7416. static Magenta(): Color3;
  7417. static Yellow(): Color3;
  7418. static Gray(): Color3;
  7419. static Random(): Color3;
  7420. }
  7421. class Color4 {
  7422. r: number;
  7423. g: number;
  7424. b: number;
  7425. a: number;
  7426. /**
  7427. * Creates a new Color4 object from the passed float values ( < 1) : red, green, blue, alpha.
  7428. */
  7429. constructor(r: number, g: number, b: number, a: number);
  7430. /**
  7431. * Adds in place the passed Color4 values to the current Color4.
  7432. * Returns the updated Color4.
  7433. */
  7434. addInPlace(right: any): Color4;
  7435. /**
  7436. * Returns a new array populated with 4 numeric elements : red, green, blue, alpha values.
  7437. */
  7438. asArray(): number[];
  7439. /**
  7440. * Stores from the starting index in the passed array the Color4 successive values.
  7441. * Returns the Color4.
  7442. */
  7443. toArray(array: number[], index?: number): Color4;
  7444. /**
  7445. * Returns a new Color4 set with the added values of the current Color4 and of the passed one.
  7446. */
  7447. add(right: Color4): Color4;
  7448. /**
  7449. * Returns a new Color4 set with the subtracted values of the passed one from the current Color4.
  7450. */
  7451. subtract(right: Color4): Color4;
  7452. /**
  7453. * Subtracts the passed ones from the current Color4 values and stores the results in "result".
  7454. * Returns the Color4.
  7455. */
  7456. subtractToRef(right: Color4, result: Color4): Color4;
  7457. /**
  7458. * Creates a new Color4 with the current Color4 values multiplied by scale.
  7459. */
  7460. scale(scale: number): Color4;
  7461. /**
  7462. * Multiplies the current Color4 values by scale and stores the result in "result".
  7463. * Returns the Color4.
  7464. */
  7465. scaleToRef(scale: number, result: Color4): Color4;
  7466. /**
  7467. * Multipy an RGBA Color4 value by another and return a new Color4 object
  7468. * @param color The Color4 (RGBA) value to multiply by
  7469. * @returns A new Color4.
  7470. */
  7471. multiply(color: Color4): Color4;
  7472. /**
  7473. * Multipy an RGBA Color4 value by another and push the result in a reference value
  7474. * @param color The Color4 (RGBA) value to multiply by
  7475. * @param result The Color4 (RGBA) to fill the result in
  7476. * @returns the result Color4.
  7477. */
  7478. multiplyToRef(color: Color4, result: Color4): Color4;
  7479. /**
  7480. * Returns a string with the Color4 values.
  7481. */
  7482. toString(): string;
  7483. /**
  7484. * Returns the string "Color4"
  7485. */
  7486. getClassName(): string;
  7487. /**
  7488. * Return the Color4 hash code as a number.
  7489. */
  7490. getHashCode(): number;
  7491. /**
  7492. * Creates a new Color4 copied from the current one.
  7493. */
  7494. clone(): Color4;
  7495. /**
  7496. * Copies the passed Color4 values into the current one.
  7497. * Returns the updated Color4.
  7498. */
  7499. copyFrom(source: Color4): Color4;
  7500. /**
  7501. * Copies the passed float values into the current one.
  7502. * Returns the updated Color4.
  7503. */
  7504. copyFromFloats(r: number, g: number, b: number, a: number): Color4;
  7505. /**
  7506. * Copies the passed float values into the current one.
  7507. * Returns the updated Color4.
  7508. */
  7509. set(r: number, g: number, b: number, a: number): Color4;
  7510. /**
  7511. * Returns a string containing the hexadecimal Color4 code.
  7512. */
  7513. toHexString(): string;
  7514. /**
  7515. * Creates a new Color4 from the valid hexadecimal value contained in the passed string.
  7516. */
  7517. static FromHexString(hex: string): Color4;
  7518. /**
  7519. * Creates a new Color4 object set with the linearly interpolated values of "amount" between the left Color4 and the right Color4.
  7520. */
  7521. static Lerp(left: Color4, right: Color4, amount: number): Color4;
  7522. /**
  7523. * Set the passed "result" with the linearly interpolated values of "amount" between the left Color4 and the right Color4.
  7524. */
  7525. static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
  7526. /**
  7527. * Creates a new Color4 from the starting index element of the passed array.
  7528. */
  7529. static FromArray(array: ArrayLike<number>, offset?: number): Color4;
  7530. /**
  7531. * Creates a new Color4 from the passed integers ( < 256 ).
  7532. */
  7533. static FromInts(r: number, g: number, b: number, a: number): Color4;
  7534. static CheckColors4(colors: number[], count: number): number[];
  7535. }
  7536. class Vector2 {
  7537. x: number;
  7538. y: number;
  7539. /**
  7540. * Creates a new Vector2 from the passed x and y coordinates.
  7541. */
  7542. constructor(x: number, y: number);
  7543. /**
  7544. * Returns a string with the Vector2 coordinates.
  7545. */
  7546. toString(): string;
  7547. /**
  7548. * Returns the string "Vector2"
  7549. */
  7550. getClassName(): string;
  7551. /**
  7552. * Returns the Vector2 hash code as a number.
  7553. */
  7554. getHashCode(): number;
  7555. /**
  7556. * Sets the Vector2 coordinates in the passed array or Float32Array from the passed index.
  7557. * Returns the Vector2.
  7558. */
  7559. toArray(array: number[] | Float32Array, index?: number): Vector2;
  7560. /**
  7561. * Returns a new array with 2 elements : the Vector2 coordinates.
  7562. */
  7563. asArray(): number[];
  7564. /**
  7565. * Sets the Vector2 coordinates with the passed Vector2 coordinates.
  7566. * Returns the updated Vector2.
  7567. */
  7568. copyFrom(source: Vector2): Vector2;
  7569. /**
  7570. * Sets the Vector2 coordinates with the passed floats.
  7571. * Returns the updated Vector2.
  7572. */
  7573. copyFromFloats(x: number, y: number): Vector2;
  7574. /**
  7575. * Sets the Vector2 coordinates with the passed floats.
  7576. * Returns the updated Vector2.
  7577. */
  7578. set(x: number, y: number): Vector2;
  7579. /**
  7580. * Returns a new Vector2 set with the addition of the current Vector2 and the passed one coordinates.
  7581. */
  7582. add(otherVector: Vector2): Vector2;
  7583. /**
  7584. * Sets the "result" coordinates with the addition of the current Vector2 and the passed one coordinates.
  7585. * Returns the Vector2.
  7586. */
  7587. addToRef(otherVector: Vector2, result: Vector2): Vector2;
  7588. /**
  7589. * Set the Vector2 coordinates by adding the passed Vector2 coordinates.
  7590. * Returns the updated Vector2.
  7591. */
  7592. addInPlace(otherVector: Vector2): Vector2;
  7593. /**
  7594. * Returns a new Vector2 by adding the current Vector2 coordinates to the passed Vector3 x, y coordinates.
  7595. */
  7596. addVector3(otherVector: Vector3): Vector2;
  7597. /**
  7598. * Returns a new Vector2 set with the subtracted coordinates of the passed one from the current Vector2.
  7599. */
  7600. subtract(otherVector: Vector2): Vector2;
  7601. /**
  7602. * Sets the "result" coordinates with the subtraction of the passed one from the current Vector2 coordinates.
  7603. * Returns the Vector2.
  7604. */
  7605. subtractToRef(otherVector: Vector2, result: Vector2): Vector2;
  7606. /**
  7607. * Sets the current Vector2 coordinates by subtracting from it the passed one coordinates.
  7608. * Returns the updated Vector2.
  7609. */
  7610. subtractInPlace(otherVector: Vector2): Vector2;
  7611. /**
  7612. * Multiplies in place the current Vector2 coordinates by the passed ones.
  7613. * Returns the updated Vector2.
  7614. */
  7615. multiplyInPlace(otherVector: Vector2): Vector2;
  7616. /**
  7617. * Returns a new Vector2 set with the multiplication of the current Vector2 and the passed one coordinates.
  7618. */
  7619. multiply(otherVector: Vector2): Vector2;
  7620. /**
  7621. * Sets "result" coordinates with the multiplication of the current Vector2 and the passed one coordinates.
  7622. * Returns the Vector2.
  7623. */
  7624. multiplyToRef(otherVector: Vector2, result: Vector2): Vector2;
  7625. /**
  7626. * Returns a new Vector2 set with the Vector2 coordinates multiplied by the passed floats.
  7627. */
  7628. multiplyByFloats(x: number, y: number): Vector2;
  7629. /**
  7630. * Returns a new Vector2 set with the Vector2 coordinates divided by the passed one coordinates.
  7631. */
  7632. divide(otherVector: Vector2): Vector2;
  7633. /**
  7634. * Sets the "result" coordinates with the Vector2 divided by the passed one coordinates.
  7635. * Returns the Vector2.
  7636. */
  7637. divideToRef(otherVector: Vector2, result: Vector2): Vector2;
  7638. /**
  7639. * Returns a new Vector2 with current Vector2 negated coordinates.
  7640. */
  7641. negate(): Vector2;
  7642. /**
  7643. * Multiply the Vector2 coordinates by scale.
  7644. * Returns the updated Vector2.
  7645. */
  7646. scaleInPlace(scale: number): Vector2;
  7647. /**
  7648. * Returns a new Vector2 scaled by "scale" from the current Vector2.
  7649. */
  7650. scale(scale: number): Vector2;
  7651. /**
  7652. * Boolean : True if the passed vector coordinates strictly equal the current Vector2 ones.
  7653. */
  7654. equals(otherVector: Vector2): boolean;
  7655. /**
  7656. * Boolean : True if the passed vector coordinates are close to the current ones by a distance of epsilon.
  7657. */
  7658. equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean;
  7659. /**
  7660. * Returns the vector length (float).
  7661. */
  7662. length(): number;
  7663. /**
  7664. * Returns the vector squared length (float);
  7665. */
  7666. lengthSquared(): number;
  7667. /**
  7668. * Normalize the vector.
  7669. * Returns the updated Vector2.
  7670. */
  7671. normalize(): Vector2;
  7672. /**
  7673. * Returns a new Vector2 copied from the Vector2.
  7674. */
  7675. clone(): Vector2;
  7676. /**
  7677. * Returns a new Vector2(0, 0)
  7678. */
  7679. static Zero(): Vector2;
  7680. /**
  7681. * Returns a new Vector2 set from the passed index element of the passed array.
  7682. */
  7683. static FromArray(array: ArrayLike<number>, offset?: number): Vector2;
  7684. /**
  7685. * Sets "result" from the passed index element of the passed array.
  7686. */
  7687. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector2): void;
  7688. /**
  7689. * Retuns a new Vector2 located for "amount" (float) on the CatmullRom spline defined by the passed four Vector2.
  7690. */
  7691. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  7692. /**
  7693. * 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".
  7694. * If a coordinate of "value" is lower than "min" coordinates, the returned Vector2 is given this "min" coordinate.
  7695. * If a coordinate of "value" is greater than "max" coordinates, the returned Vector2 is given this "max" coordinate.
  7696. */
  7697. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  7698. /**
  7699. * Returns a new Vector2 located for "amount" (float) on the Hermite spline defined by the vectors "value1", "value3", "tangent1", "tangent2".
  7700. */
  7701. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  7702. /**
  7703. * Returns a new Vector2 located for "amount" (float) on the linear interpolation between the vector "start" adn the vector "end".
  7704. */
  7705. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  7706. /**
  7707. * Returns the dot product (float) of the vector "left" and the vector "right".
  7708. */
  7709. static Dot(left: Vector2, right: Vector2): number;
  7710. /**
  7711. * Returns a new Vector2 equal to the normalized passed vector.
  7712. */
  7713. static Normalize(vector: Vector2): Vector2;
  7714. /**
  7715. * Returns a new Vecto2 set with the minimal coordinate values from the "left" and "right" vectors.
  7716. */
  7717. static Minimize(left: Vector2, right: Vector2): Vector2;
  7718. /**
  7719. * Returns a new Vecto2 set with the maximal coordinate values from the "left" and "right" vectors.
  7720. */
  7721. static Maximize(left: Vector2, right: Vector2): Vector2;
  7722. /**
  7723. * Returns a new Vecto2 set with the transformed coordinates of the passed vector by the passed transformation matrix.
  7724. */
  7725. static Transform(vector: Vector2, transformation: Matrix): Vector2;
  7726. /**
  7727. * Transforms the passed vector coordinates by the passed transformation matrix and stores the result in the vector "result" coordinates.
  7728. */
  7729. static TransformToRef(vector: Vector2, transformation: Matrix, result: Vector2): void;
  7730. /**
  7731. * Boolean : True if the point "p" is in the triangle defined by the vertors "p0", "p1", "p2"
  7732. */
  7733. static PointInTriangle(p: Vector2, p0: Vector2, p1: Vector2, p2: Vector2): boolean;
  7734. /**
  7735. * Returns the distance (float) between the vectors "value1" and "value2".
  7736. */
  7737. static Distance(value1: Vector2, value2: Vector2): number;
  7738. /**
  7739. * Returns the squared distance (float) between the vectors "value1" and "value2".
  7740. */
  7741. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  7742. /**
  7743. * Returns a new Vecto2 located at the center of the vectors "value1" and "value2".
  7744. */
  7745. static Center(value1: Vector2, value2: Vector2): Vector2;
  7746. /**
  7747. * Returns the shortest distance (float) between the point "p" and the segment defined by the two points "segA" and "segB".
  7748. */
  7749. static DistanceOfPointFromSegment(p: Vector2, segA: Vector2, segB: Vector2): number;
  7750. }
  7751. class Vector3 {
  7752. x: number;
  7753. y: number;
  7754. z: number;
  7755. /**
  7756. * Creates a new Vector3 object from the passed x, y, z (floats) coordinates.
  7757. * A Vector3 is the main object used in 3D geometry.
  7758. * It can represent etiher the coordinates of a point the space, either a direction.
  7759. */
  7760. constructor(x: number, y: number, z: number);
  7761. /**
  7762. * Returns a string with the Vector3 coordinates.
  7763. */
  7764. toString(): string;
  7765. /**
  7766. * Returns the string "Vector3"
  7767. */
  7768. getClassName(): string;
  7769. /**
  7770. * Returns the Vector hash code.
  7771. */
  7772. getHashCode(): number;
  7773. /**
  7774. * Returns a new array with three elements : the coordinates the Vector3.
  7775. */
  7776. asArray(): number[];
  7777. /**
  7778. * Populates the passed array or Float32Array from the passed index with the successive coordinates of the Vector3.
  7779. * Returns the Vector3.
  7780. */
  7781. toArray(array: number[] | Float32Array, index?: number): Vector3;
  7782. /**
  7783. * Returns a new Quaternion object, computed from the Vector3 coordinates.
  7784. */
  7785. toQuaternion(): Quaternion;
  7786. /**
  7787. * Adds the passed vector to the current Vector3.
  7788. * Returns the updated Vector3.
  7789. */
  7790. addInPlace(otherVector: Vector3): Vector3;
  7791. /**
  7792. * Returns a new Vector3, result of the addition the current Vector3 and the passed vector.
  7793. */
  7794. add(otherVector: Vector3): Vector3;
  7795. /**
  7796. * Adds the current Vector3 to the passed one and stores the result in the vector "result".
  7797. * Returns the current Vector3.
  7798. */
  7799. addToRef(otherVector: Vector3, result: Vector3): Vector3;
  7800. /**
  7801. * Subtract the passed vector from the current Vector3.
  7802. * Returns the updated Vector3.
  7803. */
  7804. subtractInPlace(otherVector: Vector3): Vector3;
  7805. /**
  7806. * Returns a new Vector3, result of the subtraction of the passed vector from the current Vector3.
  7807. */
  7808. subtract(otherVector: Vector3): Vector3;
  7809. /**
  7810. * Subtracts the passed vector from the current Vector3 and stores the result in the vector "result".
  7811. * Returns the current Vector3.
  7812. */
  7813. subtractToRef(otherVector: Vector3, result: Vector3): Vector3;
  7814. /**
  7815. * Returns a new Vector3 set with the subtraction of the passed floats from the current Vector3 coordinates.
  7816. */
  7817. subtractFromFloats(x: number, y: number, z: number): Vector3;
  7818. /**
  7819. * Subtracts the passed floats from the current Vector3 coordinates and set the passed vector "result" with this result.
  7820. * Returns the current Vector3.
  7821. */
  7822. subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3;
  7823. /**
  7824. * Returns a new Vector3 set with the current Vector3 negated coordinates.
  7825. */
  7826. negate(): Vector3;
  7827. /**
  7828. * Multiplies the Vector3 coordinates by the float "scale".
  7829. * Returns the updated Vector3.
  7830. */
  7831. scaleInPlace(scale: number): Vector3;
  7832. /**
  7833. * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale".
  7834. */
  7835. scale(scale: number): Vector3;
  7836. /**
  7837. * Multiplies the current Vector3 coordinates by the float "scale" and stores the result in the passed vector "result" coordinates.
  7838. * Returns the current Vector3.
  7839. */
  7840. scaleToRef(scale: number, result: Vector3): Vector3;
  7841. /**
  7842. * Boolean : True if the current Vector3 and the passed vector coordinates are strictly equal.
  7843. */
  7844. equals(otherVector: Vector3): boolean;
  7845. /**
  7846. * Boolean : True if the current Vector3 and the passed vector coordinates are distant less than epsilon.
  7847. */
  7848. equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean;
  7849. /**
  7850. * Boolean : True if the current Vector3 coordinate equal the passed floats.
  7851. */
  7852. equalsToFloats(x: number, y: number, z: number): boolean;
  7853. /**
  7854. * Muliplies the current Vector3 coordinates by the passed ones.
  7855. * Returns the updated Vector3.
  7856. */
  7857. multiplyInPlace(otherVector: Vector3): Vector3;
  7858. /**
  7859. * Returns a new Vector3, result of the multiplication of the current Vector3 by the passed vector.
  7860. */
  7861. multiply(otherVector: Vector3): Vector3;
  7862. /**
  7863. * Multiplies the current Vector3 by the passed one and stores the result in the passed vector "result".
  7864. * Returns the current Vector3.
  7865. */
  7866. multiplyToRef(otherVector: Vector3, result: Vector3): Vector3;
  7867. /**
  7868. * Returns a new Vector3 set witth the result of the mulliplication of the current Vector3 coordinates by the passed floats.
  7869. */
  7870. multiplyByFloats(x: number, y: number, z: number): Vector3;
  7871. /**
  7872. * Returns a new Vector3 set witth the result of the division of the current Vector3 coordinates by the passed ones.
  7873. */
  7874. divide(otherVector: Vector3): Vector3;
  7875. /**
  7876. * Divides the current Vector3 coordinates by the passed ones and stores the result in the passed vector "result".
  7877. * Returns the current Vector3.
  7878. */
  7879. divideToRef(otherVector: Vector3, result: Vector3): Vector3;
  7880. /**
  7881. * Updates the current Vector3 with the minimal coordinate values between its and the passed vector ones.
  7882. * Returns the updated Vector3.
  7883. */
  7884. MinimizeInPlace(other: Vector3): Vector3;
  7885. /**
  7886. * Updates the current Vector3 with the maximal coordinate values between its and the passed vector ones.
  7887. * Returns the updated Vector3.
  7888. */
  7889. MaximizeInPlace(other: Vector3): Vector3;
  7890. /**
  7891. * Returns the length of the Vector3 (float).
  7892. */
  7893. length(): number;
  7894. /**
  7895. * Returns the squared length of the Vector3 (float).
  7896. */
  7897. lengthSquared(): number;
  7898. /**
  7899. * Normalize the current Vector3.
  7900. * Returns the updated Vector3.
  7901. */
  7902. normalize(): Vector3;
  7903. /**
  7904. * Returns a new Vector3 copied from the current Vector3.
  7905. */
  7906. clone(): Vector3;
  7907. /**
  7908. * Copies the passed vector coordinates to the current Vector3 ones.
  7909. * Returns the updated Vector3.
  7910. */
  7911. copyFrom(source: Vector3): Vector3;
  7912. /**
  7913. * Copies the passed floats to the current Vector3 coordinates.
  7914. * Returns the updated Vector3.
  7915. */
  7916. copyFromFloats(x: number, y: number, z: number): Vector3;
  7917. /**
  7918. * Copies the passed floats to the current Vector3 coordinates.
  7919. * Returns the updated Vector3.
  7920. */
  7921. set(x: number, y: number, z: number): Vector3;
  7922. /**
  7923. *
  7924. */
  7925. static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number;
  7926. /**
  7927. * Returns a new Vector3 set from the index "offset" of the passed array.
  7928. */
  7929. static FromArray(array: ArrayLike<number>, offset?: number): Vector3;
  7930. /**
  7931. * Returns a new Vector3 set from the index "offset" of the passed Float32Array.
  7932. * This function is deprecated. Use FromArray instead.
  7933. */
  7934. static FromFloatArray(array: Float32Array, offset?: number): Vector3;
  7935. /**
  7936. * Sets the passed vector "result" with the element values from the index "offset" of the passed array.
  7937. */
  7938. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector3): void;
  7939. /**
  7940. * Sets the passed vector "result" with the element values from the index "offset" of the passed Float32Array.
  7941. * This function is deprecated. Use FromArrayToRef instead.
  7942. */
  7943. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
  7944. /**
  7945. * Sets the passed vector "result" with the passed floats.
  7946. */
  7947. static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  7948. /**
  7949. * Returns a new Vector3 set to (0.0, 0.0, 0.0).
  7950. */
  7951. static Zero(): Vector3;
  7952. /**
  7953. * Returns a new Vector3 set to (0.0, 1.0, 0.0)
  7954. */
  7955. static Up(): Vector3;
  7956. /**
  7957. * Returns a new Vector3 set to (0.0, 0.0, 1.0)
  7958. */
  7959. static Forward(): Vector3;
  7960. /**
  7961. * Returns a new Vector3 set to (1.0, 0.0, 0.0)
  7962. */
  7963. static Right(): Vector3;
  7964. /**
  7965. * Returns a new Vector3 set to (-1.0, 0.0, 0.0)
  7966. */
  7967. static Left(): Vector3;
  7968. /**
  7969. * Returns a new Vector3 set with the result of the transformation by the passed matrix of the passed vector.
  7970. * This method computes tranformed coordinates only, not transformed direction vectors.
  7971. */
  7972. static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
  7973. /**
  7974. * Sets the passed vector "result" coordinates with the result of the transformation by the passed matrix of the passed vector.
  7975. * This method computes tranformed coordinates only, not transformed direction vectors.
  7976. */
  7977. static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  7978. /**
  7979. * Sets the passed vector "result" coordinates with the result of the transformation by the passed matrix of the passed floats (x, y, z).
  7980. * This method computes tranformed coordinates only, not transformed direction vectors.
  7981. */
  7982. static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  7983. /**
  7984. * Returns a new Vector3 set with the result of the normal transformation by the passed matrix of the passed vector.
  7985. * This methods computes transformed normalized direction vectors only.
  7986. */
  7987. static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
  7988. /**
  7989. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed vector.
  7990. * This methods computes transformed normalized direction vectors only.
  7991. */
  7992. static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  7993. /**
  7994. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed floats (x, y, z).
  7995. * This methods computes transformed normalized direction vectors only.
  7996. */
  7997. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  7998. /**
  7999. * Returns a new Vector3 located for "amount" on the CatmullRom interpolation spline defined by the vectors "value1", "value2", "value3", "value4".
  8000. */
  8001. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  8002. /**
  8003. * 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".
  8004. * If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one.
  8005. * If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one.
  8006. */
  8007. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  8008. /**
  8009. * Returns a new Vector3 located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2".
  8010. */
  8011. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  8012. /**
  8013. * Returns a new Vector3 located for "amount" (float) on the linear interpolation between the vectors "start" and "end".
  8014. */
  8015. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  8016. /**
  8017. * Sets the passed vector "result" with the result of the linear interpolation from the vector "start" for "amount" to the vector "end".
  8018. */
  8019. static LerpToRef(start: Vector3, end: Vector3, amount: number, result: Vector3): void;
  8020. /**
  8021. * Returns the dot product (float) between the vectors "left" and "right".
  8022. */
  8023. static Dot(left: Vector3, right: Vector3): number;
  8024. /**
  8025. * Returns a new Vector3 as the cross product of the vectors "left" and "right".
  8026. * The cross product is then orthogonal to both "left" and "right".
  8027. */
  8028. static Cross(left: Vector3, right: Vector3): Vector3;
  8029. /**
  8030. * Sets the passed vector "result" with the cross product of "left" and "right".
  8031. * The cross product is then orthogonal to both "left" and "right".
  8032. */
  8033. static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
  8034. /**
  8035. * Returns a new Vector3 as the normalization of the passed vector.
  8036. */
  8037. static Normalize(vector: Vector3): Vector3;
  8038. /**
  8039. * Sets the passed vector "result" with the normalization of the passed first vector.
  8040. */
  8041. static NormalizeToRef(vector: Vector3, result: Vector3): void;
  8042. private static _viewportMatrixCache;
  8043. private static _matrixCache;
  8044. static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
  8045. static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3;
  8046. static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
  8047. static Minimize(left: Vector3, right: Vector3): Vector3;
  8048. static Maximize(left: Vector3, right: Vector3): Vector3;
  8049. /**
  8050. * Returns the distance (float) between the vectors "value1" and "value2".
  8051. */
  8052. static Distance(value1: Vector3, value2: Vector3): number;
  8053. /**
  8054. * Returns the squared distance (float) between the vectors "value1" and "value2".
  8055. */
  8056. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  8057. /**
  8058. * Returns a new Vector3 located at the center between "value1" and "value2".
  8059. */
  8060. static Center(value1: Vector3, value2: Vector3): Vector3;
  8061. /**
  8062. * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
  8063. * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
  8064. * to something in order to rotate it from its local system to the given target system.
  8065. * Note : axis1, axis2 and axis3 are normalized during this operation.
  8066. * Returns a new Vector3.
  8067. */
  8068. static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3;
  8069. /**
  8070. * The same than RotationFromAxis but updates the passed ref Vector3 parameter instead of returning a new Vector3.
  8071. */
  8072. static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void;
  8073. }
  8074. class Vector4 {
  8075. x: number;
  8076. y: number;
  8077. z: number;
  8078. w: number;
  8079. /**
  8080. * Creates a Vector4 object from the passed floats.
  8081. */
  8082. constructor(x: number, y: number, z: number, w: number);
  8083. /**
  8084. * Returns the string with the Vector4 coordinates.
  8085. */
  8086. toString(): string;
  8087. /**
  8088. * Returns the string "Vector4".
  8089. */
  8090. getClassName(): string;
  8091. /**
  8092. * Returns the Vector4 hash code.
  8093. */
  8094. getHashCode(): number;
  8095. /**
  8096. * Returns a new array populated with 4 elements : the Vector4 coordinates.
  8097. */
  8098. asArray(): number[];
  8099. /**
  8100. * Populates the passed array from the passed index with the Vector4 coordinates.
  8101. * Returns the Vector4.
  8102. */
  8103. toArray(array: number[] | Float32Array, index?: number): Vector4;
  8104. /**
  8105. * Adds the passed vector to the current Vector4.
  8106. * Returns the updated Vector4.
  8107. */
  8108. addInPlace(otherVector: Vector4): Vector4;
  8109. /**
  8110. * Returns a new Vector4 as the result of the addition of the current Vector4 and the passed one.
  8111. */
  8112. add(otherVector: Vector4): Vector4;
  8113. /**
  8114. * Updates the passed vector "result" with the result of the addition of the current Vector4 and the passed one.
  8115. * Returns the current Vector4.
  8116. */
  8117. addToRef(otherVector: Vector4, result: Vector4): Vector4;
  8118. /**
  8119. * Subtract in place the passed vector from the current Vector4.
  8120. * Returns the updated Vector4.
  8121. */
  8122. subtractInPlace(otherVector: Vector4): Vector4;
  8123. /**
  8124. * Returns a new Vector4 with the result of the subtraction of the passed vector from the current Vector4.
  8125. */
  8126. subtract(otherVector: Vector4): Vector4;
  8127. /**
  8128. * Sets the passed vector "result" with the result of the subtraction of the passed vector from the current Vector4.
  8129. * Returns the current Vector4.
  8130. */
  8131. subtractToRef(otherVector: Vector4, result: Vector4): Vector4;
  8132. /**
  8133. * Returns a new Vector4 set with the result of the subtraction of the passed floats from the current Vector4 coordinates.
  8134. */
  8135. subtractFromFloats(x: number, y: number, z: number, w: number): Vector4;
  8136. /**
  8137. * Sets the passed vector "result" set with the result of the subtraction of the passed floats from the current Vector4 coordinates.
  8138. * Returns the current Vector4.
  8139. */
  8140. subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4;
  8141. /**
  8142. * Returns a new Vector4 set with the current Vector4 negated coordinates.
  8143. */
  8144. negate(): Vector4;
  8145. /**
  8146. * Multiplies the current Vector4 coordinates by scale (float).
  8147. * Returns the updated Vector4.
  8148. */
  8149. scaleInPlace(scale: number): Vector4;
  8150. /**
  8151. * Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float).
  8152. */
  8153. scale(scale: number): Vector4;
  8154. /**
  8155. * Sets the passed vector "result" with the current Vector4 coordinates multiplied by scale (float).
  8156. * Returns the current Vector4.
  8157. */
  8158. scaleToRef(scale: number, result: Vector4): Vector4;
  8159. /**
  8160. * Boolean : True if the current Vector4 coordinates are stricly equal to the passed ones.
  8161. */
  8162. equals(otherVector: Vector4): boolean;
  8163. /**
  8164. * Boolean : True if the current Vector4 coordinates are each beneath the distance "epsilon" from the passed vector ones.
  8165. */
  8166. equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean;
  8167. /**
  8168. * Boolean : True if the passed floats are strictly equal to the current Vector4 coordinates.
  8169. */
  8170. equalsToFloats(x: number, y: number, z: number, w: number): boolean;
  8171. /**
  8172. * Multiplies in place the current Vector4 by the passed one.
  8173. * Returns the updated Vector4.
  8174. */
  8175. multiplyInPlace(otherVector: Vector4): Vector4;
  8176. /**
  8177. * Returns a new Vector4 set with the multiplication result of the current Vector4 and the passed one.
  8178. */
  8179. multiply(otherVector: Vector4): Vector4;
  8180. /**
  8181. * Updates the passed vector "result" with the multiplication result of the current Vector4 and the passed one.
  8182. * Returns the current Vector4.
  8183. */
  8184. multiplyToRef(otherVector: Vector4, result: Vector4): Vector4;
  8185. /**
  8186. * Returns a new Vector4 set with the multiplication result of the passed floats and the current Vector4 coordinates.
  8187. */
  8188. multiplyByFloats(x: number, y: number, z: number, w: number): Vector4;
  8189. /**
  8190. * Returns a new Vector4 set with the division result of the current Vector4 by the passed one.
  8191. */
  8192. divide(otherVector: Vector4): Vector4;
  8193. /**
  8194. * Updates the passed vector "result" with the division result of the current Vector4 by the passed one.
  8195. * Returns the current Vector4.
  8196. */
  8197. divideToRef(otherVector: Vector4, result: Vector4): Vector4;
  8198. /**
  8199. * Updates the Vector4 coordinates with the minimum values between its own and the passed vector ones.
  8200. */
  8201. MinimizeInPlace(other: Vector4): Vector4;
  8202. /**
  8203. * Updates the Vector4 coordinates with the maximum values between its own and the passed vector ones.
  8204. */
  8205. MaximizeInPlace(other: Vector4): Vector4;
  8206. /**
  8207. * Returns the Vector4 length (float).
  8208. */
  8209. length(): number;
  8210. /**
  8211. * Returns the Vector4 squared length (float).
  8212. */
  8213. lengthSquared(): number;
  8214. /**
  8215. * Normalizes in place the Vector4.
  8216. * Returns the updated Vector4.
  8217. */
  8218. normalize(): Vector4;
  8219. /**
  8220. * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.
  8221. */
  8222. toVector3(): Vector3;
  8223. /**
  8224. * Returns a new Vector4 copied from the current one.
  8225. */
  8226. clone(): Vector4;
  8227. /**
  8228. * Updates the current Vector4 with the passed one coordinates.
  8229. * Returns the updated Vector4.
  8230. */
  8231. copyFrom(source: Vector4): Vector4;
  8232. /**
  8233. * Updates the current Vector4 coordinates with the passed floats.
  8234. * Returns the updated Vector4.
  8235. */
  8236. copyFromFloats(x: number, y: number, z: number, w: number): Vector4;
  8237. /**
  8238. * Updates the current Vector4 coordinates with the passed floats.
  8239. * Returns the updated Vector4.
  8240. */
  8241. set(x: number, y: number, z: number, w: number): Vector4;
  8242. /**
  8243. * Returns a new Vector4 set from the starting index of the passed array.
  8244. */
  8245. static FromArray(array: ArrayLike<number>, offset?: number): Vector4;
  8246. /**
  8247. * Updates the passed vector "result" from the starting index of the passed array.
  8248. */
  8249. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector4): void;
  8250. /**
  8251. * Updates the passed vector "result" from the starting index of the passed Float32Array.
  8252. */
  8253. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void;
  8254. /**
  8255. * Updates the passed vector "result" coordinates from the passed floats.
  8256. */
  8257. static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void;
  8258. /**
  8259. * Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0)
  8260. */
  8261. static Zero(): Vector4;
  8262. /**
  8263. * Returns a new normalized Vector4 from the passed one.
  8264. */
  8265. static Normalize(vector: Vector4): Vector4;
  8266. /**
  8267. * Updates the passed vector "result" from the normalization of the passed one.
  8268. */
  8269. static NormalizeToRef(vector: Vector4, result: Vector4): void;
  8270. static Minimize(left: Vector4, right: Vector4): Vector4;
  8271. static Maximize(left: Vector4, right: Vector4): Vector4;
  8272. /**
  8273. * Returns the distance (float) between the vectors "value1" and "value2".
  8274. */
  8275. static Distance(value1: Vector4, value2: Vector4): number;
  8276. /**
  8277. * Returns the squared distance (float) between the vectors "value1" and "value2".
  8278. */
  8279. static DistanceSquared(value1: Vector4, value2: Vector4): number;
  8280. /**
  8281. * Returns a new Vector4 located at the center between the vectors "value1" and "value2".
  8282. */
  8283. static Center(value1: Vector4, value2: Vector4): Vector4;
  8284. /**
  8285. * Returns a new Vector4 set with the result of the normal transformation by the passed matrix of the passed vector.
  8286. * This methods computes transformed normalized direction vectors only.
  8287. */
  8288. static TransformNormal(vector: Vector4, transformation: Matrix): Vector4;
  8289. /**
  8290. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed vector.
  8291. * This methods computes transformed normalized direction vectors only.
  8292. */
  8293. static TransformNormalToRef(vector: Vector4, transformation: Matrix, result: Vector4): void;
  8294. /**
  8295. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed floats (x, y, z, w).
  8296. * This methods computes transformed normalized direction vectors only.
  8297. */
  8298. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, w: number, transformation: Matrix, result: Vector4): void;
  8299. }
  8300. interface ISize {
  8301. width: number;
  8302. height: number;
  8303. }
  8304. class Size implements ISize {
  8305. width: number;
  8306. height: number;
  8307. /**
  8308. * Creates a Size object from the passed width and height (floats).
  8309. */
  8310. constructor(width: number, height: number);
  8311. toString(): string;
  8312. /**
  8313. * Returns the string "Size"
  8314. */
  8315. getClassName(): string;
  8316. /**
  8317. * Returns the Size hash code.
  8318. */
  8319. getHashCode(): number;
  8320. /**
  8321. * Updates the current size from the passed one.
  8322. * Returns the updated Size.
  8323. */
  8324. copyFrom(src: Size): void;
  8325. /**
  8326. * Updates in place the current Size from the passed floats.
  8327. * Returns the updated Size.
  8328. */
  8329. copyFromFloats(width: number, height: number): Size;
  8330. /**
  8331. * Updates in place the current Size from the passed floats.
  8332. * Returns the updated Size.
  8333. */
  8334. set(width: number, height: number): Size;
  8335. /**
  8336. * Returns a new Size set with the multiplication result of the current Size and the passed floats.
  8337. */
  8338. multiplyByFloats(w: number, h: number): Size;
  8339. /**
  8340. * Returns a new Size copied from the passed one.
  8341. */
  8342. clone(): Size;
  8343. /**
  8344. * Boolean : True if the current Size and the passed one width and height are strictly equal.
  8345. */
  8346. equals(other: Size): boolean;
  8347. /**
  8348. * Returns the surface of the Size : width * height (float).
  8349. */
  8350. readonly surface: number;
  8351. /**
  8352. * Returns a new Size set to (0.0, 0.0)
  8353. */
  8354. static Zero(): Size;
  8355. /**
  8356. * Returns a new Size set as the addition result of the current Size and the passed one.
  8357. */
  8358. add(otherSize: Size): Size;
  8359. /**
  8360. * Returns a new Size set as the subtraction result of the passed one from the current Size.
  8361. */
  8362. subtract(otherSize: Size): Size;
  8363. /**
  8364. * Returns a new Size set at the linear interpolation "amount" between "start" and "end".
  8365. */
  8366. static Lerp(start: Size, end: Size, amount: number): Size;
  8367. }
  8368. class Quaternion {
  8369. x: number;
  8370. y: number;
  8371. z: number;
  8372. w: number;
  8373. /**
  8374. * Creates a new Quaternion from the passed floats.
  8375. */
  8376. constructor(x?: number, y?: number, z?: number, w?: number);
  8377. /**
  8378. * Returns a string with the Quaternion coordinates.
  8379. */
  8380. toString(): string;
  8381. /**
  8382. * Returns the string "Quaternion".
  8383. */
  8384. getClassName(): string;
  8385. /**
  8386. * Returns the Quaternion hash code.
  8387. */
  8388. getHashCode(): number;
  8389. /**
  8390. * Returns a new array populated with 4 elements : the Quaternion coordinates.
  8391. */
  8392. asArray(): number[];
  8393. /**
  8394. * Boolean : True if the current Quaterion and the passed one coordinates are strictly equal.
  8395. */
  8396. equals(otherQuaternion: Quaternion): boolean;
  8397. /**
  8398. * Returns a new Quaternion copied from the current one.
  8399. */
  8400. clone(): Quaternion;
  8401. /**
  8402. * Updates the current Quaternion from the passed one coordinates.
  8403. * Returns the updated Quaterion.
  8404. */
  8405. copyFrom(other: Quaternion): Quaternion;
  8406. /**
  8407. * Updates the current Quaternion from the passed float coordinates.
  8408. * Returns the updated Quaterion.
  8409. */
  8410. copyFromFloats(x: number, y: number, z: number, w: number): Quaternion;
  8411. /**
  8412. * Updates the current Quaternion from the passed float coordinates.
  8413. * Returns the updated Quaterion.
  8414. */
  8415. set(x: number, y: number, z: number, w: number): Quaternion;
  8416. /**
  8417. * Returns a new Quaternion as the addition result of the passed one and the current Quaternion.
  8418. */
  8419. add(other: Quaternion): Quaternion;
  8420. /**
  8421. * Returns a new Quaternion as the subtraction result of the passed one from the current Quaternion.
  8422. */
  8423. subtract(other: Quaternion): Quaternion;
  8424. /**
  8425. * Returns a new Quaternion set by multiplying the current Quaterion coordinates by the float "scale".
  8426. */
  8427. scale(value: number): Quaternion;
  8428. /**
  8429. * Returns a new Quaternion set as the quaternion mulplication result of the current one with the passed one "q1".
  8430. */
  8431. multiply(q1: Quaternion): Quaternion;
  8432. /**
  8433. * Sets the passed "result" as the quaternion mulplication result of the current one with the passed one "q1".
  8434. * Returns the current Quaternion.
  8435. */
  8436. multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion;
  8437. /**
  8438. * Updates the current Quaternion with the quaternion mulplication result of itself with the passed one "q1".
  8439. * Returns the updated Quaternion.
  8440. */
  8441. multiplyInPlace(q1: Quaternion): Quaternion;
  8442. /**
  8443. * Sets the passed "ref" with the conjugation of the current Quaternion.
  8444. * Returns the current Quaternion.
  8445. */
  8446. conjugateToRef(ref: Quaternion): Quaternion;
  8447. /**
  8448. * Conjugates in place the current Quaternion.
  8449. * Returns the updated Quaternion.
  8450. */
  8451. conjugateInPlace(): Quaternion;
  8452. /**
  8453. * Returns a new Quaternion as the conjugate of the current Quaternion.
  8454. */
  8455. conjugate(): Quaternion;
  8456. /**
  8457. * Returns the Quaternion length (float).
  8458. */
  8459. length(): number;
  8460. /**
  8461. * Normalize in place the current Quaternion.
  8462. * Returns the updated Quaternion.
  8463. */
  8464. normalize(): Quaternion;
  8465. /**
  8466. * Returns a new Vector3 set with the Euler angles translated from the current Quaternion.
  8467. */
  8468. toEulerAngles(order?: string): Vector3;
  8469. /**
  8470. * Sets the passed vector3 "result" with the Euler angles translated from the current Quaternion.
  8471. * Returns the current Quaternion.
  8472. */
  8473. toEulerAnglesToRef(result: Vector3, order?: string): Quaternion;
  8474. /**
  8475. * Updates the passed rotation matrix with the current Quaternion values.
  8476. * Returns the current Quaternion.
  8477. */
  8478. toRotationMatrix(result: Matrix): Quaternion;
  8479. /**
  8480. * Updates the current Quaternion from the passed rotation matrix values.
  8481. * Returns the updated Quaternion.
  8482. */
  8483. fromRotationMatrix(matrix: Matrix): Quaternion;
  8484. /**
  8485. * Returns a new Quaternion set from the passed rotation matrix values.
  8486. */
  8487. static FromRotationMatrix(matrix: Matrix): Quaternion;
  8488. /**
  8489. * Updates the passed quaternion "result" with the passed rotation matrix values.
  8490. */
  8491. static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void;
  8492. /**
  8493. * Returns a new Quaternion set to (0.0, 0.0, 0.0).
  8494. */
  8495. static Zero(): Quaternion;
  8496. /**
  8497. * Returns a new Quaternion as the inverted current Quaternion.
  8498. */
  8499. static Inverse(q: Quaternion): Quaternion;
  8500. /**
  8501. * Returns the identity Quaternion.
  8502. */
  8503. static Identity(): Quaternion;
  8504. static IsIdentity(quaternion: Quaternion): boolean;
  8505. /**
  8506. * Returns a new Quaternion set from the passed axis (Vector3) and angle in radians (float).
  8507. */
  8508. static RotationAxis(axis: Vector3, angle: number): Quaternion;
  8509. /**
  8510. * Sets the passed quaternion "result" from the passed axis (Vector3) and angle in radians (float).
  8511. */
  8512. static RotationAxisToRef(axis: Vector3, angle: number, result: Quaternion): Quaternion;
  8513. /**
  8514. * Retuns a new Quaternion set from the starting index of the passed array.
  8515. */
  8516. static FromArray(array: ArrayLike<number>, offset?: number): Quaternion;
  8517. /**
  8518. * Returns a new Quaternion set from the passed Euler float angles (y, x, z).
  8519. */
  8520. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
  8521. /**
  8522. * Sets the passed quaternion "result" from the passed float Euler angles (y, x, z).
  8523. */
  8524. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
  8525. /**
  8526. * Returns a new Quaternion from the passed float Euler angles expressed in z-x-z orientation
  8527. */
  8528. static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion;
  8529. /**
  8530. * Sets the passed quaternion "result" from the passed float Euler angles expressed in z-x-z orientation
  8531. */
  8532. static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void;
  8533. /**
  8534. * Returns a new Quaternion as the quaternion rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system.
  8535. * cf to Vector3.RotationFromAxis() documentation.
  8536. * Note : axis1, axis2 and axis3 are normalized during this operation.
  8537. */
  8538. static RotationQuaternionFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Quaternion): Quaternion;
  8539. /**
  8540. * Sets the passed quaternion "ref" with the quaternion rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system.
  8541. * cf to Vector3.RotationFromAxis() documentation.
  8542. * Note : axis1, axis2 and axis3 are normalized during this operation.
  8543. */
  8544. static RotationQuaternionFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Quaternion): void;
  8545. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  8546. static SlerpToRef(left: Quaternion, right: Quaternion, amount: number, result: Quaternion): void;
  8547. /**
  8548. * Returns a new Quaternion located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2".
  8549. */
  8550. static Hermite(value1: Quaternion, tangent1: Quaternion, value2: Quaternion, tangent2: Quaternion, amount: number): Quaternion;
  8551. }
  8552. class Matrix {
  8553. private static _tempQuaternion;
  8554. private static _xAxis;
  8555. private static _yAxis;
  8556. private static _zAxis;
  8557. private static _updateFlagSeed;
  8558. updateFlag: number;
  8559. m: Float32Array;
  8560. _markAsUpdated(): void;
  8561. constructor();
  8562. /**
  8563. * Boolean : True is the matrix is the identity matrix
  8564. */
  8565. isIdentity(): boolean;
  8566. /**
  8567. * Returns the matrix determinant (float).
  8568. */
  8569. determinant(): number;
  8570. /**
  8571. * Returns the matrix underlying array.
  8572. */
  8573. toArray(): Float32Array;
  8574. /**
  8575. * Returns the matrix underlying array.
  8576. */
  8577. asArray(): Float32Array;
  8578. /**
  8579. * Inverts in place the Matrix.
  8580. * Returns the Matrix inverted.
  8581. */
  8582. invert(): Matrix;
  8583. /**
  8584. * Sets all the matrix elements to zero.
  8585. * Returns the Matrix.
  8586. */
  8587. reset(): Matrix;
  8588. /**
  8589. * Returns a new Matrix as the addition result of the current Matrix and the passed one.
  8590. */
  8591. add(other: Matrix): Matrix;
  8592. /**
  8593. * Sets the passed matrix "result" with the ddition result of the current Matrix and the passed one.
  8594. * Returns the Matrix.
  8595. */
  8596. addToRef(other: Matrix, result: Matrix): Matrix;
  8597. /**
  8598. * Adds in place the passed matrix to the current Matrix.
  8599. * Returns the updated Matrix.
  8600. */
  8601. addToSelf(other: Matrix): Matrix;
  8602. /**
  8603. * Sets the passed matrix with the current inverted Matrix.
  8604. * Returns the unmodified current Matrix.
  8605. */
  8606. invertToRef(other: Matrix): Matrix;
  8607. /**
  8608. * Inserts the translation vector (using 3 x floats) in the current Matrix.
  8609. * Returns the updated Matrix.
  8610. */
  8611. setTranslationFromFloats(x: number, y: number, z: number): Matrix;
  8612. /**
  8613. * Inserts the translation vector in the current Matrix.
  8614. * Returns the updated Matrix.
  8615. */
  8616. setTranslation(vector3: Vector3): Matrix;
  8617. /**
  8618. * Returns a new Vector3 as the extracted translation from the Matrix.
  8619. */
  8620. getTranslation(): Vector3;
  8621. /**
  8622. * Fill a Vector3 with the extracted translation from the Matrix.
  8623. */
  8624. getTranslationToRef(result: Vector3): Matrix;
  8625. /**
  8626. * Remove rotation and scaling part from the Matrix.
  8627. * Returns the updated Matrix.
  8628. */
  8629. removeRotationAndScaling(): Matrix;
  8630. /**
  8631. * Returns a new Matrix set with the multiplication result of the current Matrix and the passed one.
  8632. */
  8633. multiply(other: Matrix): Matrix;
  8634. /**
  8635. * Updates the current Matrix from the passed one values.
  8636. * Returns the updated Matrix.
  8637. */
  8638. copyFrom(other: Matrix): Matrix;
  8639. /**
  8640. * Populates the passed array from the starting index with the Matrix values.
  8641. * Returns the Matrix.
  8642. */
  8643. copyToArray(array: Float32Array, offset?: number): Matrix;
  8644. /**
  8645. * Sets the passed matrix "result" with the multiplication result of the current Matrix and the passed one.
  8646. */
  8647. multiplyToRef(other: Matrix, result: Matrix): Matrix;
  8648. /**
  8649. * Sets the Float32Array "result" from the passed index "offset" with the multiplication result of the current Matrix and the passed one.
  8650. */
  8651. multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix;
  8652. /**
  8653. * Boolean : True is the current Matrix and the passed one values are strictly equal.
  8654. */
  8655. equals(value: Matrix): boolean;
  8656. /**
  8657. * Returns a new Matrix from the current Matrix.
  8658. */
  8659. clone(): Matrix;
  8660. /**
  8661. * Returns the string "Matrix"
  8662. */
  8663. getClassName(): string;
  8664. /**
  8665. * Returns the Matrix hash code.
  8666. */
  8667. getHashCode(): number;
  8668. /**
  8669. * Decomposes the current Matrix into :
  8670. * - a scale vector3 passed as a reference to update,
  8671. * - a rotation quaternion passed as a reference to update,
  8672. * - a translation vector3 passed as a reference to update.
  8673. * Returns the boolean `true`.
  8674. */
  8675. decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean;
  8676. /**
  8677. * Returns a new Matrix as the extracted rotation matrix from the current one.
  8678. */
  8679. getRotationMatrix(): Matrix;
  8680. /**
  8681. * Extracts the rotation matrix from the current one and sets it as the passed "result".
  8682. * Returns the current Matrix.
  8683. */
  8684. getRotationMatrixToRef(result: Matrix): Matrix;
  8685. /**
  8686. * Returns a new Matrix set from the starting index of the passed array.
  8687. */
  8688. static FromArray(array: ArrayLike<number>, offset?: number): Matrix;
  8689. /**
  8690. * Sets the passed "result" matrix from the starting index of the passed array.
  8691. */
  8692. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Matrix): void;
  8693. /**
  8694. * Sets the passed "result" matrix from the starting index of the passed Float32Array by multiplying each element by the float "scale".
  8695. */
  8696. static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void;
  8697. /**
  8698. * Sets the passed matrix "result" with the 16 passed floats.
  8699. */
  8700. 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;
  8701. /**
  8702. * Returns the index-th row of the current matrix as a new Vector4.
  8703. */
  8704. getRow(index: number): Vector4;
  8705. /**
  8706. * Sets the index-th row of the current matrix with the passed Vector4 values.
  8707. * Returns the updated Matrix.
  8708. */
  8709. setRow(index: number, row: Vector4): Matrix;
  8710. /**
  8711. * Sets the index-th row of the current matrix with the passed 4 x float values.
  8712. * Returns the updated Matrix.
  8713. */
  8714. setRowFromFloats(index: number, x: number, y: number, z: number, w: number): Matrix;
  8715. /**
  8716. * Returns a new Matrix set from the 16 passed floats.
  8717. */
  8718. 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;
  8719. /**
  8720. * Returns a new Matrix composed by the passed scale (vector3), rotation (quaternion) and translation (vector3).
  8721. */
  8722. static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
  8723. /**
  8724. * Update a Matrix with values composed by the passed scale (vector3), rotation (quaternion) and translation (vector3).
  8725. */
  8726. static ComposeToRef(scale: Vector3, rotation: Quaternion, translation: Vector3, result: Matrix): void;
  8727. /**
  8728. * Returns a new indentity Matrix.
  8729. */
  8730. static Identity(): Matrix;
  8731. /**
  8732. * Sets the passed "result" as an identity matrix.
  8733. */
  8734. static IdentityToRef(result: Matrix): void;
  8735. /**
  8736. * Returns a new zero Matrix.
  8737. */
  8738. static Zero(): Matrix;
  8739. /**
  8740. * Returns a new rotation matrix for "angle" radians around the X axis.
  8741. */
  8742. static RotationX(angle: number): Matrix;
  8743. /**
  8744. * Returns a new Matrix as the passed inverted one.
  8745. */
  8746. static Invert(source: Matrix): Matrix;
  8747. /**
  8748. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the X axis.
  8749. */
  8750. static RotationXToRef(angle: number, result: Matrix): void;
  8751. /**
  8752. * Returns a new rotation matrix for "angle" radians around the Y axis.
  8753. */
  8754. static RotationY(angle: number): Matrix;
  8755. /**
  8756. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the Y axis.
  8757. */
  8758. static RotationYToRef(angle: number, result: Matrix): void;
  8759. /**
  8760. * Returns a new rotation matrix for "angle" radians around the Z axis.
  8761. */
  8762. static RotationZ(angle: number): Matrix;
  8763. /**
  8764. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the Z axis.
  8765. */
  8766. static RotationZToRef(angle: number, result: Matrix): void;
  8767. /**
  8768. * Returns a new rotation matrix for "angle" radians around the passed axis.
  8769. */
  8770. static RotationAxis(axis: Vector3, angle: number): Matrix;
  8771. /**
  8772. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the passed axis.
  8773. */
  8774. static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void;
  8775. /**
  8776. * Returns a new Matrix as a rotation matrix from the Euler angles (y, x, z).
  8777. */
  8778. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  8779. /**
  8780. * Sets the passed matrix "result" as a rotation matrix from the Euler angles (y, x, z).
  8781. */
  8782. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
  8783. /**
  8784. * Returns a new Matrix as a scaling matrix from the passed floats (x, y, z).
  8785. */
  8786. static Scaling(x: number, y: number, z: number): Matrix;
  8787. /**
  8788. * Sets the passed matrix "result" as a scaling matrix from the passed floats (x, y, z).
  8789. */
  8790. static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
  8791. /**
  8792. * Returns a new Matrix as a translation matrix from the passed floats (x, y, z).
  8793. */
  8794. static Translation(x: number, y: number, z: number): Matrix;
  8795. /**
  8796. * Sets the passed matrix "result" as a translation matrix from the passed floats (x, y, z).
  8797. */
  8798. static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
  8799. /**
  8800. * Returns a new Matrix whose values are the interpolated values for "gradien" (float) between the ones of the matrices "startValue" and "endValue".
  8801. */
  8802. static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  8803. /**
  8804. * Returns a new Matrix whose values are computed by :
  8805. * - decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices,
  8806. * - interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end,
  8807. * - recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices.
  8808. */
  8809. static DecomposeLerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  8810. /**
  8811. * 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".
  8812. * This methods works for a Left-Handed system.
  8813. */
  8814. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  8815. /**
  8816. * 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".
  8817. * This methods works for a Left-Handed system.
  8818. */
  8819. static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  8820. /**
  8821. * 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".
  8822. * This methods works for a Right-Handed system.
  8823. */
  8824. static LookAtRH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  8825. /**
  8826. * 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".
  8827. * This methods works for a Left-Handed system.
  8828. */
  8829. static LookAtRHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  8830. /**
  8831. * 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.
  8832. */
  8833. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  8834. /**
  8835. * 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.
  8836. */
  8837. static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void;
  8838. /**
  8839. * 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.
  8840. */
  8841. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  8842. /**
  8843. * 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.
  8844. */
  8845. static OrthoOffCenterLHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  8846. /**
  8847. * 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.
  8848. */
  8849. static OrthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  8850. /**
  8851. * 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.
  8852. */
  8853. static OrthoOffCenterRHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  8854. /**
  8855. * 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.
  8856. */
  8857. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  8858. /**
  8859. * 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.
  8860. */
  8861. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  8862. /**
  8863. * 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.
  8864. */
  8865. static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  8866. /**
  8867. * 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.
  8868. */
  8869. static PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  8870. /**
  8871. * 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.
  8872. */
  8873. static PerspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  8874. /**
  8875. * 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.
  8876. */
  8877. static PerspectiveFovWebVRToRef(fov: any, znear: number, zfar: number, result: Matrix, rightHanded?: boolean): void;
  8878. /**
  8879. * Returns the final transformation matrix : world * view * projection * viewport
  8880. */
  8881. static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
  8882. /**
  8883. * Returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the passed Matrix.
  8884. */
  8885. static GetAsMatrix2x2(matrix: Matrix): Float32Array;
  8886. /**
  8887. * Returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the passed Matrix.
  8888. */
  8889. static GetAsMatrix3x3(matrix: Matrix): Float32Array;
  8890. /**
  8891. * Compute the transpose of the passed Matrix.
  8892. * Returns a new Matrix.
  8893. */
  8894. static Transpose(matrix: Matrix): Matrix;
  8895. /**
  8896. * Returns a new Matrix as the reflection matrix across the passed plane.
  8897. */
  8898. static Reflection(plane: Plane): Matrix;
  8899. /**
  8900. * Sets the passed matrix "result" as the reflection matrix across the passed plane.
  8901. */
  8902. static ReflectionToRef(plane: Plane, result: Matrix): void;
  8903. /**
  8904. * Sets the passed matrix "mat" as a rotation matrix composed from the 3 passed left handed axis.
  8905. */
  8906. static FromXYZAxesToRef(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, result: Matrix): void;
  8907. /**
  8908. * Sets the passed matrix "result" as a rotation matrix according to the passed quaternion.
  8909. */
  8910. static FromQuaternionToRef(quat: Quaternion, result: Matrix): void;
  8911. }
  8912. class Plane {
  8913. normal: Vector3;
  8914. d: number;
  8915. /**
  8916. * Creates a Plane object according to the passed floats a, b, c, d and the plane equation : ax + by + cz + d = 0
  8917. */
  8918. constructor(a: number, b: number, c: number, d: number);
  8919. /**
  8920. * Returns the plane coordinates as a new array of 4 elements [a, b, c, d].
  8921. */
  8922. asArray(): number[];
  8923. /**
  8924. * Returns a new plane copied from the current Plane.
  8925. */
  8926. clone(): Plane;
  8927. /**
  8928. * Returns the string "Plane".
  8929. */
  8930. getClassName(): string;
  8931. /**
  8932. * Returns the Plane hash code.
  8933. */
  8934. getHashCode(): number;
  8935. /**
  8936. * Normalize the current Plane in place.
  8937. * Returns the updated Plane.
  8938. */
  8939. normalize(): Plane;
  8940. /**
  8941. * Returns a new Plane as the result of the transformation of the current Plane by the passed matrix.
  8942. */
  8943. transform(transformation: Matrix): Plane;
  8944. /**
  8945. * Returns the dot product (float) of the point coordinates and the plane normal.
  8946. */
  8947. dotCoordinate(point: any): number;
  8948. /**
  8949. * Updates the current Plane from the plane defined by the three passed points.
  8950. * Returns the updated Plane.
  8951. */
  8952. copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  8953. /**
  8954. * Boolean : True is the vector "direction" is the same side than the plane normal.
  8955. */
  8956. isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
  8957. /**
  8958. * Returns the signed distance (float) from the passed point to the Plane.
  8959. */
  8960. signedDistanceTo(point: Vector3): number;
  8961. /**
  8962. * Returns a new Plane from the passed array.
  8963. */
  8964. static FromArray(array: ArrayLike<number>): Plane;
  8965. /**
  8966. * Returns a new Plane defined by the three passed points.
  8967. */
  8968. static FromPoints(point1: any, point2: any, point3: any): Plane;
  8969. /**
  8970. * Returns a new Plane the normal vector to this plane at the passed origin point.
  8971. * Note : the vector "normal" is updated because normalized.
  8972. */
  8973. static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
  8974. /**
  8975. * Returns the signed distance between the plane defined by the normal vector at the "origin"" point and the passed other point.
  8976. */
  8977. static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
  8978. }
  8979. class Viewport {
  8980. x: number;
  8981. y: number;
  8982. width: number;
  8983. height: number;
  8984. /**
  8985. * Creates a Viewport object located at (x, y) and sized (width, height).
  8986. */
  8987. constructor(x: number, y: number, width: number, height: number);
  8988. toGlobal(renderWidth: number, renderHeight: number): Viewport;
  8989. /**
  8990. * Returns a new Viewport copied from the current one.
  8991. */
  8992. clone(): Viewport;
  8993. }
  8994. class Frustum {
  8995. /**
  8996. * Returns a new array of 6 Frustum planes computed by the passed transformation matrix.
  8997. */
  8998. static GetPlanes(transform: Matrix): Plane[];
  8999. /**
  9000. * Sets the passed array "frustumPlanes" with the 6 Frustum planes computed by the passed transformation matrix.
  9001. */
  9002. static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
  9003. }
  9004. enum Space {
  9005. LOCAL = 0,
  9006. WORLD = 1,
  9007. BONE = 2,
  9008. }
  9009. class Axis {
  9010. static X: Vector3;
  9011. static Y: Vector3;
  9012. static Z: Vector3;
  9013. }
  9014. class BezierCurve {
  9015. /**
  9016. * Returns the cubic Bezier interpolated value (float) at "t" (float) from the passed x1, y1, x2, y2 floats.
  9017. */
  9018. static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number;
  9019. }
  9020. enum Orientation {
  9021. CW = 0,
  9022. CCW = 1,
  9023. }
  9024. class Angle {
  9025. private _radians;
  9026. /**
  9027. * Creates an Angle object of "radians" radians (float).
  9028. */
  9029. constructor(radians: number);
  9030. /**
  9031. * Returns the Angle value in degrees (float).
  9032. */
  9033. degrees: () => number;
  9034. /**
  9035. * Returns the Angle value in radians (float).
  9036. */
  9037. radians: () => number;
  9038. /**
  9039. * Returns a new Angle object valued with the angle value in radians between the two passed vectors.
  9040. */
  9041. static BetweenTwoPoints(a: Vector2, b: Vector2): Angle;
  9042. /**
  9043. * Returns a new Angle object from the passed float in radians.
  9044. */
  9045. static FromRadians(radians: number): Angle;
  9046. /**
  9047. * Returns a new Angle object from the passed float in degrees.
  9048. */
  9049. static FromDegrees(degrees: number): Angle;
  9050. }
  9051. class Arc2 {
  9052. startPoint: Vector2;
  9053. midPoint: Vector2;
  9054. endPoint: Vector2;
  9055. centerPoint: Vector2;
  9056. radius: number;
  9057. angle: Angle;
  9058. startAngle: Angle;
  9059. orientation: Orientation;
  9060. /**
  9061. * Creates an Arc object from the three passed points : start, middle and end.
  9062. */
  9063. constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2);
  9064. }
  9065. class Path2 {
  9066. private _points;
  9067. private _length;
  9068. closed: boolean;
  9069. /**
  9070. * Creates a Path2 object from the starting 2D coordinates x and y.
  9071. */
  9072. constructor(x: number, y: number);
  9073. /**
  9074. * Adds a new segment until the passed coordinates (x, y) to the current Path2.
  9075. * Returns the updated Path2.
  9076. */
  9077. addLineTo(x: number, y: number): Path2;
  9078. /**
  9079. * 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.
  9080. * Returns the updated Path2.
  9081. */
  9082. addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2;
  9083. /**
  9084. * Closes the Path2.
  9085. * Returns the Path2.
  9086. */
  9087. close(): Path2;
  9088. /**
  9089. * Returns the Path2 total length (float).
  9090. */
  9091. length(): number;
  9092. /**
  9093. * Returns the Path2 internal array of points.
  9094. */
  9095. getPoints(): Vector2[];
  9096. /**
  9097. * Returns a new Vector2 located at a percentage of the Path2 total length on this path.
  9098. */
  9099. getPointAtLengthPosition(normalizedLengthPosition: number): Vector2;
  9100. /**
  9101. * Returns a new Path2 starting at the coordinates (x, y).
  9102. */
  9103. static StartingAt(x: number, y: number): Path2;
  9104. }
  9105. class Path3D {
  9106. path: Vector3[];
  9107. private _curve;
  9108. private _distances;
  9109. private _tangents;
  9110. private _normals;
  9111. private _binormals;
  9112. private _raw;
  9113. /**
  9114. * new Path3D(path, normal, raw)
  9115. * Creates a Path3D. A Path3D is a logical math object, so not a mesh.
  9116. * please read the description in the tutorial : http://doc.babylonjs.com/tutorials/How_to_use_Path3D
  9117. * path : an array of Vector3, the curve axis of the Path3D
  9118. * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.
  9119. * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.
  9120. */
  9121. constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean);
  9122. /**
  9123. * Returns the Path3D array of successive Vector3 designing its curve.
  9124. */
  9125. getCurve(): Vector3[];
  9126. /**
  9127. * Returns an array populated with tangent vectors on each Path3D curve point.
  9128. */
  9129. getTangents(): Vector3[];
  9130. /**
  9131. * Returns an array populated with normal vectors on each Path3D curve point.
  9132. */
  9133. getNormals(): Vector3[];
  9134. /**
  9135. * Returns an array populated with binormal vectors on each Path3D curve point.
  9136. */
  9137. getBinormals(): Vector3[];
  9138. /**
  9139. * Returns an array populated with distances (float) of the i-th point from the first curve point.
  9140. */
  9141. getDistances(): number[];
  9142. /**
  9143. * Forces the Path3D tangent, normal, binormal and distance recomputation.
  9144. * Returns the same object updated.
  9145. */
  9146. update(path: Vector3[], firstNormal?: Vector3): Path3D;
  9147. private _compute(firstNormal);
  9148. private _getFirstNonNullVector(index);
  9149. private _getLastNonNullVector(index);
  9150. private _normalVector(v0, vt, va);
  9151. }
  9152. class Curve3 {
  9153. private _points;
  9154. private _length;
  9155. /**
  9156. * Returns a Curve3 object along a Quadratic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#quadratic-bezier-curve
  9157. * @param v0 (Vector3) the origin point of the Quadratic Bezier
  9158. * @param v1 (Vector3) the control point
  9159. * @param v2 (Vector3) the end point of the Quadratic Bezier
  9160. * @param nbPoints (integer) the wanted number of points in the curve
  9161. */
  9162. static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3;
  9163. /**
  9164. * Returns a Curve3 object along a Cubic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#cubic-bezier-curve
  9165. * @param v0 (Vector3) the origin point of the Cubic Bezier
  9166. * @param v1 (Vector3) the first control point
  9167. * @param v2 (Vector3) the second control point
  9168. * @param v3 (Vector3) the end point of the Cubic Bezier
  9169. * @param nbPoints (integer) the wanted number of points in the curve
  9170. */
  9171. static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3;
  9172. /**
  9173. * Returns a Curve3 object along a Hermite Spline curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#hermite-spline
  9174. * @param p1 (Vector3) the origin point of the Hermite Spline
  9175. * @param t1 (Vector3) the tangent vector at the origin point
  9176. * @param p2 (Vector3) the end point of the Hermite Spline
  9177. * @param t2 (Vector3) the tangent vector at the end point
  9178. * @param nbPoints (integer) the wanted number of points in the curve
  9179. */
  9180. static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3;
  9181. /**
  9182. * Returns a Curve3 object along a CatmullRom Spline curve :
  9183. * @param points (array of Vector3) the points the spline must pass through. At least, four points required.
  9184. * @param nbPoints (integer) the wanted number of points between each curve control points.
  9185. */
  9186. static CreateCatmullRomSpline(points: Vector3[], nbPoints: number): Curve3;
  9187. /**
  9188. * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.
  9189. * A Curve3 is designed from a series of successive Vector3.
  9190. * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
  9191. */
  9192. constructor(points: Vector3[]);
  9193. /**
  9194. * Returns the Curve3 stored array of successive Vector3
  9195. */
  9196. getPoints(): Vector3[];
  9197. /**
  9198. * Returns the computed length (float) of the curve.
  9199. */
  9200. length(): number;
  9201. /**
  9202. * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);
  9203. * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.
  9204. * curveA and curveB keep unchanged.
  9205. */
  9206. continue(curve: Curve3): Curve3;
  9207. private _computeLength(path);
  9208. }
  9209. class SphericalHarmonics {
  9210. L00: Vector3;
  9211. L1_1: Vector3;
  9212. L10: Vector3;
  9213. L11: Vector3;
  9214. L2_2: Vector3;
  9215. L2_1: Vector3;
  9216. L20: Vector3;
  9217. L21: Vector3;
  9218. L22: Vector3;
  9219. addLight(direction: Vector3, color: Color3, deltaSolidAngle: number): void;
  9220. scale(scale: number): void;
  9221. }
  9222. class SphericalPolynomial {
  9223. x: Vector3;
  9224. y: Vector3;
  9225. z: Vector3;
  9226. xx: Vector3;
  9227. yy: Vector3;
  9228. zz: Vector3;
  9229. xy: Vector3;
  9230. yz: Vector3;
  9231. zx: Vector3;
  9232. addAmbient(color: Color3): void;
  9233. static getSphericalPolynomialFromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial;
  9234. }
  9235. class PositionNormalVertex {
  9236. position: Vector3;
  9237. normal: Vector3;
  9238. constructor(position?: Vector3, normal?: Vector3);
  9239. clone(): PositionNormalVertex;
  9240. }
  9241. class PositionNormalTextureVertex {
  9242. position: Vector3;
  9243. normal: Vector3;
  9244. uv: Vector2;
  9245. constructor(position?: Vector3, normal?: Vector3, uv?: Vector2);
  9246. clone(): PositionNormalTextureVertex;
  9247. }
  9248. class Tmp {
  9249. static Color3: Color3[];
  9250. static Vector2: Vector2[];
  9251. static Vector3: Vector3[];
  9252. static Vector4: Vector4[];
  9253. static Quaternion: Quaternion[];
  9254. static Matrix: Matrix[];
  9255. }
  9256. }
  9257. declare module BABYLON {
  9258. class AbstractMesh extends Node implements IDisposable, ICullable, IGetSetVerticesData {
  9259. private static _BILLBOARDMODE_NONE;
  9260. private static _BILLBOARDMODE_X;
  9261. private static _BILLBOARDMODE_Y;
  9262. private static _BILLBOARDMODE_Z;
  9263. private static _BILLBOARDMODE_ALL;
  9264. static readonly BILLBOARDMODE_NONE: number;
  9265. static readonly BILLBOARDMODE_X: number;
  9266. static readonly BILLBOARDMODE_Y: number;
  9267. static readonly BILLBOARDMODE_Z: number;
  9268. static readonly BILLBOARDMODE_ALL: number;
  9269. private _facetPositions;
  9270. private _facetNormals;
  9271. private _facetPartitioning;
  9272. private _facetNb;
  9273. private _partitioningSubdivisions;
  9274. private _partitioningBBoxRatio;
  9275. private _facetDataEnabled;
  9276. private _facetParameters;
  9277. private _bbSize;
  9278. private _subDiv;
  9279. /**
  9280. * Read-only : the number of facets in the mesh
  9281. */
  9282. readonly facetNb: number;
  9283. /**
  9284. * The number (integer) of subdivisions per axis in the partioning space
  9285. */
  9286. partitioningSubdivisions: number;
  9287. /**
  9288. * The ratio (float) to apply to the bouding box size to set to the partioning space.
  9289. * Ex : 1.01 (default) the partioning space is 1% bigger than the bounding box.
  9290. */
  9291. partitioningBBoxRatio: number;
  9292. /**
  9293. * Read-only boolean : is the feature facetData enabled ?
  9294. */
  9295. readonly isFacetDataEnabled: boolean;
  9296. /**
  9297. * An event triggered when this mesh collides with another one
  9298. * @type {BABYLON.Observable}
  9299. */
  9300. onCollideObservable: Observable<AbstractMesh>;
  9301. private _onCollideObserver;
  9302. onCollide: () => void;
  9303. /**
  9304. * An event triggered when the collision's position changes
  9305. * @type {BABYLON.Observable}
  9306. */
  9307. onCollisionPositionChangeObservable: Observable<Vector3>;
  9308. private _onCollisionPositionChangeObserver;
  9309. onCollisionPositionChange: () => void;
  9310. /**
  9311. * An event triggered after the world matrix is updated
  9312. * @type {BABYLON.Observable}
  9313. */
  9314. onAfterWorldMatrixUpdateObservable: Observable<AbstractMesh>;
  9315. definedFacingForward: boolean;
  9316. position: Vector3;
  9317. private _rotation;
  9318. private _rotationQuaternion;
  9319. private _scaling;
  9320. billboardMode: number;
  9321. visibility: number;
  9322. alphaIndex: number;
  9323. infiniteDistance: boolean;
  9324. isVisible: boolean;
  9325. isPickable: boolean;
  9326. showBoundingBox: boolean;
  9327. showSubMeshesBoundingBox: boolean;
  9328. isBlocker: boolean;
  9329. renderingGroupId: number;
  9330. private _material;
  9331. material: Material;
  9332. private _receiveShadows;
  9333. receiveShadows: boolean;
  9334. renderOutline: boolean;
  9335. outlineColor: Color3;
  9336. outlineWidth: number;
  9337. renderOverlay: boolean;
  9338. overlayColor: Color3;
  9339. overlayAlpha: number;
  9340. private _hasVertexAlpha;
  9341. hasVertexAlpha: boolean;
  9342. private _useVertexColors;
  9343. useVertexColors: boolean;
  9344. private _computeBonesUsingShaders;
  9345. computeBonesUsingShaders: boolean;
  9346. private _numBoneInfluencers;
  9347. numBoneInfluencers: number;
  9348. private _applyFog;
  9349. applyFog: boolean;
  9350. scalingDeterminant: number;
  9351. useOctreeForRenderingSelection: boolean;
  9352. useOctreeForPicking: boolean;
  9353. useOctreeForCollisions: boolean;
  9354. layerMask: number;
  9355. /**
  9356. * True if the mesh must be rendered in any case.
  9357. */
  9358. alwaysSelectAsActiveMesh: boolean;
  9359. /**
  9360. * This scene's action manager
  9361. * @type {BABYLON.ActionManager}
  9362. */
  9363. actionManager: ActionManager;
  9364. physicsImpostor: BABYLON.PhysicsImpostor;
  9365. private _checkCollisions;
  9366. private _collisionMask;
  9367. private _collisionGroup;
  9368. ellipsoid: Vector3;
  9369. ellipsoidOffset: Vector3;
  9370. private _collider;
  9371. private _oldPositionForCollisions;
  9372. private _diffPositionForCollisions;
  9373. private _newPositionForCollisions;
  9374. collisionMask: number;
  9375. collisionGroup: number;
  9376. private _meshToBoneReferal;
  9377. edgesWidth: number;
  9378. edgesColor: Color4;
  9379. _edgesRenderer: EdgesRenderer;
  9380. private _localWorld;
  9381. _worldMatrix: Matrix;
  9382. private _absolutePosition;
  9383. private _collisionsTransformMatrix;
  9384. private _collisionsScalingMatrix;
  9385. _positions: Vector3[];
  9386. private _isDirty;
  9387. _masterMesh: AbstractMesh;
  9388. _boundingInfo: BoundingInfo;
  9389. private _pivotMatrix;
  9390. _isDisposed: boolean;
  9391. _renderId: number;
  9392. subMeshes: SubMesh[];
  9393. _submeshesOctree: Octree<SubMesh>;
  9394. _intersectionsInProgress: AbstractMesh[];
  9395. private _isWorldMatrixFrozen;
  9396. _unIndexed: boolean;
  9397. _poseMatrix: Matrix;
  9398. _lightSources: Light[];
  9399. _waitingActions: any;
  9400. _waitingFreezeWorldMatrix: boolean;
  9401. private _skeleton;
  9402. _bonesTransformMatrices: Float32Array;
  9403. skeleton: Skeleton;
  9404. constructor(name: string, scene: Scene);
  9405. /**
  9406. * Returns the string "AbstractMesh"
  9407. */
  9408. getClassName(): string;
  9409. /**
  9410. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  9411. */
  9412. toString(fullDetails?: boolean): string;
  9413. _resyncLightSources(): void;
  9414. _resyncLighSource(light: Light): void;
  9415. _removeLightSource(light: Light): void;
  9416. private _markSubMeshesAsDirty(func);
  9417. _markSubMeshesAsLightDirty(): void;
  9418. _markSubMeshesAsAttributesDirty(): void;
  9419. _markSubMeshesAsMiscDirty(): void;
  9420. /**
  9421. * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z.
  9422. * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
  9423. * Default : (0.0, 0.0, 0.0)
  9424. */
  9425. rotation: Vector3;
  9426. /**
  9427. * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
  9428. * Default : (1.0, 1.0, 1.0)
  9429. */
  9430. scaling: Vector3;
  9431. /**
  9432. * Rotation Quaternion property : this a Quaternion object depicting the mesh rotation by using a unit quaternion.
  9433. * It's null by default.
  9434. * 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)
  9435. */
  9436. rotationQuaternion: Quaternion;
  9437. /**
  9438. * Copies the paramater passed Matrix into the mesh Pose matrix.
  9439. * Returns the AbstractMesh.
  9440. */
  9441. updatePoseMatrix(matrix: Matrix): AbstractMesh;
  9442. /**
  9443. * Returns the mesh Pose matrix.
  9444. * Returned object : Matrix
  9445. */
  9446. getPoseMatrix(): Matrix;
  9447. /**
  9448. * Disables the mesh edger rendering mode.
  9449. * Returns the AbstractMesh.
  9450. */
  9451. disableEdgesRendering(): AbstractMesh;
  9452. /**
  9453. * Enables the edge rendering mode on the mesh.
  9454. * This mode makes the mesh edges visible.
  9455. * Returns the AbstractMesh.
  9456. */
  9457. enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): AbstractMesh;
  9458. /**
  9459. * Returns true if the mesh is blocked. Used by the class Mesh.
  9460. * Returns the boolean `false` by default.
  9461. */
  9462. readonly isBlocked: boolean;
  9463. /**
  9464. * Returns the mesh itself by default, used by the class Mesh.
  9465. * Returned type : AbstractMesh
  9466. */
  9467. getLOD(camera: Camera): AbstractMesh;
  9468. /**
  9469. * Returns 0 by default, used by the class Mesh.
  9470. * Returns an integer.
  9471. */
  9472. getTotalVertices(): number;
  9473. /**
  9474. * Returns null by default, used by the class Mesh.
  9475. * Returned type : integer array
  9476. */
  9477. getIndices(): IndicesArray;
  9478. /**
  9479. * Returns the array of the requested vertex data kind. Used by the class Mesh. Returns null here.
  9480. * Returned type : float array or Float32Array
  9481. */
  9482. getVerticesData(kind: string): number[] | Float32Array;
  9483. /**
  9484. * Sets the vertex data of the mesh geometry for the requested `kind`.
  9485. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  9486. * The `data` are either a numeric array either a Float32Array.
  9487. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  9488. * 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).
  9489. * Note that a new underlying VertexBuffer object is created each call.
  9490. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  9491. *
  9492. * Possible `kind` values :
  9493. * - BABYLON.VertexBuffer.PositionKind
  9494. * - BABYLON.VertexBuffer.UVKind
  9495. * - BABYLON.VertexBuffer.UV2Kind
  9496. * - BABYLON.VertexBuffer.UV3Kind
  9497. * - BABYLON.VertexBuffer.UV4Kind
  9498. * - BABYLON.VertexBuffer.UV5Kind
  9499. * - BABYLON.VertexBuffer.UV6Kind
  9500. * - BABYLON.VertexBuffer.ColorKind
  9501. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9502. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9503. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9504. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9505. *
  9506. * Returns the Mesh.
  9507. */
  9508. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): Mesh;
  9509. /**
  9510. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  9511. * If the mesh has no geometry, it is simply returned as it is.
  9512. * The `data` are either a numeric array either a Float32Array.
  9513. * No new underlying VertexBuffer object is created.
  9514. * 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.
  9515. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  9516. *
  9517. * Possible `kind` values :
  9518. * - BABYLON.VertexBuffer.PositionKind
  9519. * - BABYLON.VertexBuffer.UVKind
  9520. * - BABYLON.VertexBuffer.UV2Kind
  9521. * - BABYLON.VertexBuffer.UV3Kind
  9522. * - BABYLON.VertexBuffer.UV4Kind
  9523. * - BABYLON.VertexBuffer.UV5Kind
  9524. * - BABYLON.VertexBuffer.UV6Kind
  9525. * - BABYLON.VertexBuffer.ColorKind
  9526. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9527. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9528. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9529. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9530. *
  9531. * Returns the Mesh.
  9532. */
  9533. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): Mesh;
  9534. /**
  9535. * Sets the mesh indices.
  9536. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  9537. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  9538. * This method creates a new index buffer each call.
  9539. * Returns the Mesh.
  9540. */
  9541. setIndices(indices: IndicesArray, totalVertices?: number): Mesh;
  9542. /** Returns false by default, used by the class Mesh.
  9543. * Returns a boolean
  9544. */
  9545. isVerticesDataPresent(kind: string): boolean;
  9546. /**
  9547. * Returns the mesh BoundingInfo object or creates a new one and returns it if undefined.
  9548. * Returns a BoundingInfo
  9549. */
  9550. getBoundingInfo(): BoundingInfo;
  9551. /**
  9552. * Sets a mesh new object BoundingInfo.
  9553. * Returns the AbstractMesh.
  9554. */
  9555. setBoundingInfo(boundingInfo: BoundingInfo): AbstractMesh;
  9556. readonly useBones: boolean;
  9557. _preActivate(): void;
  9558. _preActivateForIntermediateRendering(renderId: number): void;
  9559. _activate(renderId: number): void;
  9560. /**
  9561. * Returns the last update of the World matrix
  9562. * Returns a Matrix.
  9563. */
  9564. getWorldMatrix(): Matrix;
  9565. /**
  9566. * Returns directly the last state of the mesh World matrix.
  9567. * A Matrix is returned.
  9568. */
  9569. readonly worldMatrixFromCache: Matrix;
  9570. /**
  9571. * Returns the current mesh absolute position.
  9572. * Retuns a Vector3.
  9573. */
  9574. readonly absolutePosition: Vector3;
  9575. /**
  9576. * Prevents the World matrix to be computed any longer.
  9577. * Returns the AbstractMesh.
  9578. */
  9579. freezeWorldMatrix(): AbstractMesh;
  9580. /**
  9581. * Allows back the World matrix computation.
  9582. * Returns the AbstractMesh.
  9583. */
  9584. unfreezeWorldMatrix(): this;
  9585. /**
  9586. * True if the World matrix has been frozen.
  9587. * Returns a boolean.
  9588. */
  9589. readonly isWorldMatrixFrozen: boolean;
  9590. private static _rotationAxisCache;
  9591. /**
  9592. * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.
  9593. * space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
  9594. * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
  9595. * The passed axis is also normalized.
  9596. * Returns the AbstractMesh.
  9597. */
  9598. rotate(axis: Vector3, amount: number, space?: Space): AbstractMesh;
  9599. /**
  9600. * Translates the mesh along the axis vector for the passed distance in the given space.
  9601. * space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
  9602. * Returns the AbstractMesh.
  9603. */
  9604. translate(axis: Vector3, distance: number, space?: Space): AbstractMesh;
  9605. /**
  9606. * Adds a rotation step to the mesh current rotation.
  9607. * x, y, z are Euler angles expressed in radians.
  9608. * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.
  9609. * This means this rotation is made in the mesh local space only.
  9610. * It's useful to set a custom rotation order different from the BJS standard one YXZ.
  9611. * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.
  9612. * ```javascript
  9613. * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);
  9614. * ```
  9615. * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.
  9616. * 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.
  9617. * Returns the AbstractMesh.
  9618. */
  9619. addRotation(x: number, y: number, z: number): AbstractMesh;
  9620. /**
  9621. * Retuns the mesh absolute position in the World.
  9622. * Returns a Vector3.
  9623. */
  9624. getAbsolutePosition(): Vector3;
  9625. /**
  9626. * Sets the mesh absolute position in the World from a Vector3 or an Array(3).
  9627. * Returns the AbstractMesh.
  9628. */
  9629. setAbsolutePosition(absolutePosition: Vector3): AbstractMesh;
  9630. /**
  9631. * Perform relative position change from the point of view of behind the front of the mesh.
  9632. * This is performed taking into account the meshes current rotation, so you do not have to care.
  9633. * Supports definition of mesh facing forward or backward.
  9634. * @param {number} amountRight
  9635. * @param {number} amountUp
  9636. * @param {number} amountForward
  9637. *
  9638. * Returns the AbstractMesh.
  9639. */
  9640. movePOV(amountRight: number, amountUp: number, amountForward: number): AbstractMesh;
  9641. /**
  9642. * Calculate relative position change from the point of view of behind the front of the mesh.
  9643. * This is performed taking into account the meshes current rotation, so you do not have to care.
  9644. * Supports definition of mesh facing forward or backward.
  9645. * @param {number} amountRight
  9646. * @param {number} amountUp
  9647. * @param {number} amountForward
  9648. *
  9649. * Returns a new Vector3.
  9650. */
  9651. calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
  9652. /**
  9653. * Perform relative rotation change from the point of view of behind the front of the mesh.
  9654. * Supports definition of mesh facing forward or backward.
  9655. * @param {number} flipBack
  9656. * @param {number} twirlClockwise
  9657. * @param {number} tiltRight
  9658. *
  9659. * Returns the AbstractMesh.
  9660. */
  9661. rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): AbstractMesh;
  9662. /**
  9663. * Calculate relative rotation change from the point of view of behind the front of the mesh.
  9664. * Supports definition of mesh facing forward or backward.
  9665. * @param {number} flipBack
  9666. * @param {number} twirlClockwise
  9667. * @param {number} tiltRight
  9668. *
  9669. * Returns a new Vector3.
  9670. */
  9671. calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
  9672. /**
  9673. * Sets a new pivot matrix to the mesh.
  9674. * Returns the AbstractMesh.
  9675. */
  9676. setPivotMatrix(matrix: Matrix): AbstractMesh;
  9677. /**
  9678. * Returns the mesh pivot matrix.
  9679. * Default : Identity.
  9680. * A Matrix is returned.
  9681. */
  9682. getPivotMatrix(): Matrix;
  9683. _isSynchronized(): boolean;
  9684. _initCache(): void;
  9685. markAsDirty(property: string): AbstractMesh;
  9686. /**
  9687. * Updates the mesh BoundingInfo object and all its children BoundingInfo objects also.
  9688. * Returns the AbstractMesh.
  9689. */
  9690. _updateBoundingInfo(): AbstractMesh;
  9691. /**
  9692. * Update a mesh's children BoundingInfo objects only.
  9693. * Returns the AbstractMesh.
  9694. */
  9695. _updateSubMeshesBoundingInfo(matrix: Matrix): AbstractMesh;
  9696. /**
  9697. * Computes the mesh World matrix and returns it.
  9698. * If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.
  9699. * If the parameter `force` is let to `false` (default), the current cached World matrix is returned.
  9700. * If the parameter `force`is set to `true`, the actual computation is done.
  9701. * Returns the mesh World Matrix.
  9702. */
  9703. computeWorldMatrix(force?: boolean): Matrix;
  9704. /**
  9705. * If you'd like to be called back after the mesh position, rotation or scaling has been updated.
  9706. * @param func: callback function to add
  9707. *
  9708. * Returns the AbstractMesh.
  9709. */
  9710. registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): AbstractMesh;
  9711. /**
  9712. * Removes a registered callback function.
  9713. * Returns the AbstractMesh.
  9714. */
  9715. unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): AbstractMesh;
  9716. /**
  9717. * Sets the mesh position in its local space.
  9718. * Returns the AbstractMesh.
  9719. */
  9720. setPositionWithLocalVector(vector3: Vector3): AbstractMesh;
  9721. /**
  9722. * Returns the mesh position in the local space from the current World matrix values.
  9723. * Returns a new Vector3.
  9724. */
  9725. getPositionExpressedInLocalSpace(): Vector3;
  9726. /**
  9727. * Translates the mesh along the passed Vector3 in its local space.
  9728. * Returns the AbstractMesh.
  9729. */
  9730. locallyTranslate(vector3: Vector3): AbstractMesh;
  9731. private static _lookAtVectorCache;
  9732. lookAt(targetPoint: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number, space?: Space): AbstractMesh;
  9733. attachToBone(bone: Bone, affectedMesh: AbstractMesh): AbstractMesh;
  9734. detachFromBone(): AbstractMesh;
  9735. /**
  9736. * Returns `true` if the mesh is within the frustum defined by the passed array of planes.
  9737. * A mesh is in the frustum if its bounding box intersects the frustum.
  9738. * Boolean returned.
  9739. */
  9740. isInFrustum(frustumPlanes: Plane[]): boolean;
  9741. /**
  9742. * Returns `true` if the mesh is completely in the frustum defined be the passed array of planes.
  9743. * A mesh is completely in the frustum if its bounding box it completely inside the frustum.
  9744. * Boolean returned.
  9745. */
  9746. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  9747. /**
  9748. * True if the mesh intersects another mesh or a SolidParticle object.
  9749. * 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)
  9750. * Returns a boolean.
  9751. */
  9752. intersectsMesh(mesh: AbstractMesh | SolidParticle, precise?: boolean): boolean;
  9753. /**
  9754. * Returns true if the passed point (Vector3) is inside the mesh bounding box.
  9755. * Returns a boolean.
  9756. */
  9757. intersectsPoint(point: Vector3): boolean;
  9758. getPhysicsImpostor(): PhysicsImpostor;
  9759. getPositionInCameraSpace(camera?: Camera): Vector3;
  9760. /**
  9761. * Returns the distance from the mesh to the active camera.
  9762. * Returns a float.
  9763. */
  9764. getDistanceToCamera(camera?: Camera): number;
  9765. applyImpulse(force: Vector3, contactPoint: Vector3): AbstractMesh;
  9766. setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): AbstractMesh;
  9767. /**
  9768. * Property checkCollisions : Boolean, whether the camera should check the collisions against the mesh.
  9769. * Default `false`.
  9770. */
  9771. checkCollisions: boolean;
  9772. moveWithCollisions(velocity: Vector3): AbstractMesh;
  9773. private _onCollisionPositionChange;
  9774. /**
  9775. * This function will create an octree to help to select the right submeshes for rendering, picking and collision computations.
  9776. * Please note that you must have a decent number of submeshes to get performance improvements when using an octree.
  9777. * Returns an Octree of submeshes.
  9778. */
  9779. createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
  9780. _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): AbstractMesh;
  9781. _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): AbstractMesh;
  9782. _checkCollision(collider: Collider): AbstractMesh;
  9783. _generatePointsArray(): boolean;
  9784. /**
  9785. * Checks if the passed Ray intersects with the mesh.
  9786. * Returns an object PickingInfo.
  9787. */
  9788. intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
  9789. /**
  9790. * Clones the mesh, used by the class Mesh.
  9791. * Just returns `null` for an AbstractMesh.
  9792. */
  9793. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh;
  9794. /**
  9795. * Disposes all the mesh submeshes.
  9796. * Returns the AbstractMesh.
  9797. */
  9798. releaseSubMeshes(): AbstractMesh;
  9799. /**
  9800. * Disposes the AbstractMesh.
  9801. * Some internal references are kept for further use.
  9802. * By default, all the mesh children are also disposed unless the parameter `doNotRecurse` is set to `true`.
  9803. * Returns nothing.
  9804. */
  9805. dispose(doNotRecurse?: boolean): void;
  9806. /**
  9807. * Returns a new Vector3 what is the localAxis, expressed in the mesh local space, rotated like the mesh.
  9808. * This Vector3 is expressed in the World space.
  9809. */
  9810. getDirection(localAxis: Vector3): Vector3;
  9811. /**
  9812. * Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh.
  9813. * localAxis is expressed in the mesh local space.
  9814. * result is computed in the Wordl space from the mesh World matrix.
  9815. * Returns the AbstractMesh.
  9816. */
  9817. getDirectionToRef(localAxis: Vector3, result: Vector3): AbstractMesh;
  9818. setPivotPoint(point: Vector3, space?: Space): AbstractMesh;
  9819. /**
  9820. * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.
  9821. */
  9822. getPivotPoint(): Vector3;
  9823. /**
  9824. * Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space.
  9825. * Returns the AbstractMesh.
  9826. */
  9827. getPivotPointToRef(result: Vector3): AbstractMesh;
  9828. /**
  9829. * Returns a new Vector3 set with the mesh pivot point World coordinates.
  9830. */
  9831. getAbsolutePivotPoint(): Vector3;
  9832. /**
  9833. * Defines the passed mesh as the parent of the current mesh.
  9834. * Returns the AbstractMesh.
  9835. */
  9836. setParent(mesh: AbstractMesh): AbstractMesh;
  9837. /**
  9838. * Adds the passed mesh as a child to the current mesh.
  9839. * Returns the AbstractMesh.
  9840. */
  9841. addChild(mesh: AbstractMesh): AbstractMesh;
  9842. /**
  9843. * Removes the passed mesh from the current mesh children list.
  9844. * Returns the AbstractMesh.
  9845. */
  9846. removeChild(mesh: AbstractMesh): AbstractMesh;
  9847. /**
  9848. * Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates.
  9849. * Returns the AbstractMesh.
  9850. */
  9851. getAbsolutePivotPointToRef(result: Vector3): AbstractMesh;
  9852. /**
  9853. * Initialize the facet data arrays : facetNormals, facetPositions and facetPartitioning.
  9854. * Returns the AbstractMesh.
  9855. */
  9856. private _initFacetData();
  9857. /**
  9858. * Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.
  9859. * This method can be called within the render loop.
  9860. * 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.
  9861. * Returns the AbstractMesh.
  9862. */
  9863. updateFacetData(): AbstractMesh;
  9864. /**
  9865. * Returns the facetLocalNormals array.
  9866. * The normals are expressed in the mesh local space.
  9867. */
  9868. getFacetLocalNormals(): Vector3[];
  9869. /**
  9870. * Returns the facetLocalPositions array.
  9871. * The facet positions are expressed in the mesh local space.
  9872. */
  9873. getFacetLocalPositions(): Vector3[];
  9874. /**
  9875. * Returns the facetLocalPartioning array.
  9876. */
  9877. getFacetLocalPartitioning(): number[][];
  9878. /**
  9879. * Returns the i-th facet position in the world system.
  9880. * This method allocates a new Vector3 per call.
  9881. */
  9882. getFacetPosition(i: number): Vector3;
  9883. /**
  9884. * Sets the reference Vector3 with the i-th facet position in the world system.
  9885. * Returns the AbstractMesh.
  9886. */
  9887. getFacetPositionToRef(i: number, ref: Vector3): AbstractMesh;
  9888. /**
  9889. * Returns the i-th facet normal in the world system.
  9890. * This method allocates a new Vector3 per call.
  9891. */
  9892. getFacetNormal(i: number): Vector3;
  9893. /**
  9894. * Sets the reference Vector3 with the i-th facet normal in the world system.
  9895. * Returns the AbstractMesh.
  9896. */
  9897. getFacetNormalToRef(i: number, ref: Vector3): this;
  9898. /**
  9899. * 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).
  9900. */
  9901. getFacetsAtLocalCoordinates(x: number, y: number, z: number): number[];
  9902. /**
  9903. * Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found.
  9904. * If the parameter projected (vector3) is passed, it is set as the (x,y,z) World projection on the facet.
  9905. * 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.
  9906. * If facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position.
  9907. * 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.
  9908. */
  9909. getClosestFacetAtCoordinates(x: number, y: number, z: number, projected?: Vector3, checkFace?: boolean, facing?: boolean): number;
  9910. /**
  9911. * Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found.
  9912. * If the parameter projected (vector3) is passed, it is set as the (x,y,z) local projection on the facet.
  9913. * 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.
  9914. * If facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position.
  9915. * 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.
  9916. */
  9917. getClosestFacetAtLocalCoordinates(x: number, y: number, z: number, projected?: Vector3, checkFace?: boolean, facing?: boolean): number;
  9918. /**
  9919. * Returns the object "parameter" set with all the expected parameters for facetData computation by ComputeNormals()
  9920. */
  9921. getFacetDataParameters(): any;
  9922. /**
  9923. * Disables the feature FacetData and frees the related memory.
  9924. * Returns the AbstractMesh.
  9925. */
  9926. disableFacetData(): AbstractMesh;
  9927. /**
  9928. * Creates new normals data for the mesh.
  9929. * @param updatable.
  9930. */
  9931. createNormals(updatable: boolean): void;
  9932. }
  9933. }
  9934. declare module BABYLON {
  9935. class Buffer {
  9936. private _engine;
  9937. private _buffer;
  9938. private _data;
  9939. private _updatable;
  9940. private _strideSize;
  9941. private _instanced;
  9942. constructor(engine: any, data: number[] | Float32Array, updatable: boolean, stride: number, postponeInternalCreation?: boolean, instanced?: boolean);
  9943. createVertexBuffer(kind: string, offset: number, size: number, stride?: number): VertexBuffer;
  9944. isUpdatable(): boolean;
  9945. getData(): number[] | Float32Array;
  9946. getBuffer(): WebGLBuffer;
  9947. getStrideSize(): number;
  9948. getIsInstanced(): boolean;
  9949. create(data?: number[] | Float32Array): void;
  9950. update(data: number[] | Float32Array): void;
  9951. updateDirectly(data: Float32Array, offset: number, vertexCount?: number): void;
  9952. dispose(): void;
  9953. }
  9954. }
  9955. declare module BABYLON {
  9956. class CSG {
  9957. private polygons;
  9958. matrix: Matrix;
  9959. position: Vector3;
  9960. rotation: Vector3;
  9961. rotationQuaternion: Quaternion;
  9962. scaling: Vector3;
  9963. static FromMesh(mesh: Mesh): CSG;
  9964. private static FromPolygons(polygons);
  9965. clone(): CSG;
  9966. private toPolygons();
  9967. union(csg: CSG): CSG;
  9968. unionInPlace(csg: CSG): void;
  9969. subtract(csg: CSG): CSG;
  9970. subtractInPlace(csg: CSG): void;
  9971. intersect(csg: CSG): CSG;
  9972. intersectInPlace(csg: CSG): void;
  9973. inverse(): CSG;
  9974. inverseInPlace(): void;
  9975. copyTransformAttributes(csg: CSG): CSG;
  9976. buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh;
  9977. toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh;
  9978. }
  9979. }
  9980. declare module BABYLON {
  9981. class Geometry implements IGetSetVerticesData {
  9982. id: string;
  9983. delayLoadState: number;
  9984. delayLoadingFile: string;
  9985. onGeometryUpdated: (geometry: Geometry, kind?: string) => void;
  9986. private _scene;
  9987. private _engine;
  9988. private _meshes;
  9989. private _totalVertices;
  9990. private _indices;
  9991. private _vertexBuffers;
  9992. private _isDisposed;
  9993. private _extend;
  9994. private _boundingBias;
  9995. _delayInfo: any;
  9996. private _indexBuffer;
  9997. _boundingInfo: BoundingInfo;
  9998. _delayLoadingFunction: (any: any, geometry: Geometry) => void;
  9999. _softwareSkinningRenderId: number;
  10000. private _vertexArrayObjects;
  10001. /**
  10002. * 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
  10003. * @returns The Bias Vector
  10004. */
  10005. boundingBias: Vector2;
  10006. constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh);
  10007. readonly extend: {
  10008. minimum: Vector3;
  10009. maximum: Vector3;
  10010. };
  10011. getScene(): Scene;
  10012. getEngine(): Engine;
  10013. isReady(): boolean;
  10014. readonly doNotSerialize: boolean;
  10015. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  10016. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
  10017. removeVerticesData(kind: string): void;
  10018. setVerticesBuffer(buffer: VertexBuffer): void;
  10019. updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void;
  10020. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean): void;
  10021. private updateBoundingInfo(updateExtends, data);
  10022. _bind(effect: Effect, indexToBind?: WebGLBuffer): void;
  10023. getTotalVertices(): number;
  10024. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): number[] | Float32Array;
  10025. getVertexBuffer(kind: string): VertexBuffer;
  10026. getVertexBuffers(): {
  10027. [key: string]: VertexBuffer;
  10028. };
  10029. isVerticesDataPresent(kind: string): boolean;
  10030. getVerticesDataKinds(): string[];
  10031. setIndices(indices: IndicesArray, totalVertices?: number): void;
  10032. getTotalIndices(): number;
  10033. getIndices(copyWhenShared?: boolean): IndicesArray;
  10034. getIndexBuffer(): WebGLBuffer;
  10035. _releaseVertexArrayObject(effect: Effect): void;
  10036. releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
  10037. applyToMesh(mesh: Mesh): void;
  10038. private updateExtend(data?, stride?);
  10039. private _applyToMesh(mesh);
  10040. private notifyUpdate(kind?);
  10041. load(scene: Scene, onLoaded?: () => void): void;
  10042. private _queueLoad(scene, onLoaded?);
  10043. /**
  10044. * Invert the geometry to move from a right handed system to a left handed one.
  10045. */
  10046. toLeftHanded(): void;
  10047. isDisposed(): boolean;
  10048. private _disposeVertexArrayObjects();
  10049. dispose(): void;
  10050. copy(id: string): Geometry;
  10051. serialize(): any;
  10052. private toNumberArray(origin);
  10053. serializeVerticeData(): any;
  10054. static ExtractFromMesh(mesh: Mesh, id: string): Geometry;
  10055. /**
  10056. * You should now use Tools.RandomId(), this method is still here for legacy reasons.
  10057. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  10058. * Be aware Math.random() could cause collisions, but:
  10059. * "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"
  10060. */
  10061. static RandomId(): string;
  10062. static ImportGeometry(parsedGeometry: any, mesh: Mesh): void;
  10063. static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Geometry;
  10064. }
  10065. module Geometry.Primitives {
  10066. class _Primitive extends Geometry {
  10067. private _canBeRegenerated;
  10068. private _beingRegenerated;
  10069. constructor(id: string, scene: Scene, _canBeRegenerated?: boolean, mesh?: Mesh);
  10070. canBeRegenerated(): boolean;
  10071. regenerate(): void;
  10072. asNewGeometry(id: string): Geometry;
  10073. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  10074. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
  10075. _regenerateVertexData(): VertexData;
  10076. copy(id: string): Geometry;
  10077. serialize(): any;
  10078. }
  10079. class Ribbon extends _Primitive {
  10080. pathArray: Vector3[][];
  10081. closeArray: boolean;
  10082. closePath: boolean;
  10083. offset: number;
  10084. side: number;
  10085. constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  10086. _regenerateVertexData(): VertexData;
  10087. copy(id: string): Geometry;
  10088. }
  10089. class Box extends _Primitive {
  10090. size: number;
  10091. side: number;
  10092. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  10093. _regenerateVertexData(): VertexData;
  10094. copy(id: string): Geometry;
  10095. serialize(): any;
  10096. static Parse(parsedBox: any, scene: Scene): Box;
  10097. }
  10098. class Sphere extends _Primitive {
  10099. segments: number;
  10100. diameter: number;
  10101. side: number;
  10102. constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  10103. _regenerateVertexData(): VertexData;
  10104. copy(id: string): Geometry;
  10105. serialize(): any;
  10106. static Parse(parsedSphere: any, scene: Scene): Geometry.Primitives.Sphere;
  10107. }
  10108. class Disc extends _Primitive {
  10109. radius: number;
  10110. tessellation: number;
  10111. side: number;
  10112. constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  10113. _regenerateVertexData(): VertexData;
  10114. copy(id: string): Geometry;
  10115. }
  10116. class Cylinder extends _Primitive {
  10117. height: number;
  10118. diameterTop: number;
  10119. diameterBottom: number;
  10120. tessellation: number;
  10121. subdivisions: number;
  10122. side: number;
  10123. constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  10124. _regenerateVertexData(): VertexData;
  10125. copy(id: string): Geometry;
  10126. serialize(): any;
  10127. static Parse(parsedCylinder: any, scene: Scene): Geometry.Primitives.Cylinder;
  10128. }
  10129. class Torus extends _Primitive {
  10130. diameter: number;
  10131. thickness: number;
  10132. tessellation: number;
  10133. side: number;
  10134. constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  10135. _regenerateVertexData(): VertexData;
  10136. copy(id: string): Geometry;
  10137. serialize(): any;
  10138. static Parse(parsedTorus: any, scene: Scene): Geometry.Primitives.Torus;
  10139. }
  10140. class Ground extends _Primitive {
  10141. width: number;
  10142. height: number;
  10143. subdivisions: number;
  10144. constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh);
  10145. _regenerateVertexData(): VertexData;
  10146. copy(id: string): Geometry;
  10147. serialize(): any;
  10148. static Parse(parsedGround: any, scene: Scene): Geometry.Primitives.Ground;
  10149. }
  10150. class TiledGround extends _Primitive {
  10151. xmin: number;
  10152. zmin: number;
  10153. xmax: number;
  10154. zmax: number;
  10155. subdivisions: {
  10156. w: number;
  10157. h: number;
  10158. };
  10159. precision: {
  10160. w: number;
  10161. h: number;
  10162. };
  10163. constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  10164. w: number;
  10165. h: number;
  10166. }, precision: {
  10167. w: number;
  10168. h: number;
  10169. }, canBeRegenerated?: boolean, mesh?: Mesh);
  10170. _regenerateVertexData(): VertexData;
  10171. copy(id: string): Geometry;
  10172. }
  10173. class Plane extends _Primitive {
  10174. size: number;
  10175. side: number;
  10176. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  10177. _regenerateVertexData(): VertexData;
  10178. copy(id: string): Geometry;
  10179. serialize(): any;
  10180. static Parse(parsedPlane: any, scene: Scene): Geometry.Primitives.Plane;
  10181. }
  10182. class TorusKnot extends _Primitive {
  10183. radius: number;
  10184. tube: number;
  10185. radialSegments: number;
  10186. tubularSegments: number;
  10187. p: number;
  10188. q: number;
  10189. side: number;
  10190. constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  10191. _regenerateVertexData(): VertexData;
  10192. copy(id: string): Geometry;
  10193. serialize(): any;
  10194. static Parse(parsedTorusKnot: any, scene: Scene): Geometry.Primitives.TorusKnot;
  10195. }
  10196. }
  10197. }
  10198. declare module BABYLON {
  10199. class GroundMesh extends Mesh {
  10200. generateOctree: boolean;
  10201. private _worldInverse;
  10202. private _heightQuads;
  10203. _subdivisionsX: number;
  10204. _subdivisionsY: number;
  10205. _width: number;
  10206. _height: number;
  10207. _minX: number;
  10208. _maxX: number;
  10209. _minZ: number;
  10210. _maxZ: number;
  10211. constructor(name: string, scene: Scene);
  10212. getClassName(): string;
  10213. readonly subdivisions: number;
  10214. readonly subdivisionsX: number;
  10215. readonly subdivisionsY: number;
  10216. optimize(chunksCount: number, octreeBlocksSize?: number): void;
  10217. /**
  10218. * Returns a height (y) value in the Worl system :
  10219. * the ground altitude at the coordinates (x, z) expressed in the World system.
  10220. * Returns the ground y position if (x, z) are outside the ground surface.
  10221. */
  10222. getHeightAtCoordinates(x: number, z: number): number;
  10223. /**
  10224. * Returns a normalized vector (Vector3) orthogonal to the ground
  10225. * at the ground coordinates (x, z) expressed in the World system.
  10226. * Returns Vector3(0.0, 1.0, 0.0) if (x, z) are outside the ground surface.
  10227. */
  10228. getNormalAtCoordinates(x: number, z: number): Vector3;
  10229. /**
  10230. * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground
  10231. * at the ground coordinates (x, z) expressed in the World system.
  10232. * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.
  10233. * Returns the GroundMesh.
  10234. */
  10235. getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): GroundMesh;
  10236. /**
  10237. * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()
  10238. * if the ground has been updated.
  10239. * This can be used in the render loop.
  10240. * Returns the GroundMesh.
  10241. */
  10242. updateCoordinateHeights(): GroundMesh;
  10243. private _getFacetAt(x, z);
  10244. private _initHeightQuads();
  10245. private _computeHeightQuads();
  10246. serialize(serializationObject: any): void;
  10247. static Parse(parsedMesh: any, scene: Scene): GroundMesh;
  10248. }
  10249. }
  10250. declare module BABYLON {
  10251. /**
  10252. * Creates an instance based on a source mesh.
  10253. */
  10254. class InstancedMesh extends AbstractMesh {
  10255. private _sourceMesh;
  10256. private _currentLOD;
  10257. constructor(name: string, source: Mesh);
  10258. /**
  10259. * Returns the string "InstancedMesh".
  10260. */
  10261. getClassName(): string;
  10262. readonly receiveShadows: boolean;
  10263. readonly material: Material;
  10264. readonly visibility: number;
  10265. readonly skeleton: Skeleton;
  10266. readonly renderingGroupId: number;
  10267. /**
  10268. * Returns the total number of vertices (integer).
  10269. */
  10270. getTotalVertices(): number;
  10271. readonly sourceMesh: Mesh;
  10272. /**
  10273. * Returns a float array or a Float32Array of the requested kind of data : positons, normals, uvs, etc.
  10274. */
  10275. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  10276. /**
  10277. * Sets the vertex data of the mesh geometry for the requested `kind`.
  10278. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  10279. * The `data` are either a numeric array either a Float32Array.
  10280. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  10281. * 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).
  10282. * Note that a new underlying VertexBuffer object is created each call.
  10283. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  10284. *
  10285. * Possible `kind` values :
  10286. * - BABYLON.VertexBuffer.PositionKind
  10287. * - BABYLON.VertexBuffer.UVKind
  10288. * - BABYLON.VertexBuffer.UV2Kind
  10289. * - BABYLON.VertexBuffer.UV3Kind
  10290. * - BABYLON.VertexBuffer.UV4Kind
  10291. * - BABYLON.VertexBuffer.UV5Kind
  10292. * - BABYLON.VertexBuffer.UV6Kind
  10293. * - BABYLON.VertexBuffer.ColorKind
  10294. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10295. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10296. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10297. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10298. *
  10299. * Returns the Mesh.
  10300. */
  10301. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): Mesh;
  10302. /**
  10303. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  10304. * If the mesh has no geometry, it is simply returned as it is.
  10305. * The `data` are either a numeric array either a Float32Array.
  10306. * No new underlying VertexBuffer object is created.
  10307. * 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.
  10308. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  10309. *
  10310. * Possible `kind` values :
  10311. * - BABYLON.VertexBuffer.PositionKind
  10312. * - BABYLON.VertexBuffer.UVKind
  10313. * - BABYLON.VertexBuffer.UV2Kind
  10314. * - BABYLON.VertexBuffer.UV3Kind
  10315. * - BABYLON.VertexBuffer.UV4Kind
  10316. * - BABYLON.VertexBuffer.UV5Kind
  10317. * - BABYLON.VertexBuffer.UV6Kind
  10318. * - BABYLON.VertexBuffer.ColorKind
  10319. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10320. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10321. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10322. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10323. *
  10324. * Returns the Mesh.
  10325. */
  10326. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): Mesh;
  10327. /**
  10328. * Sets the mesh indices.
  10329. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  10330. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  10331. * This method creates a new index buffer each call.
  10332. * Returns the Mesh.
  10333. */
  10334. setIndices(indices: IndicesArray, totalVertices?: number): Mesh;
  10335. /**
  10336. * Boolean : True if the mesh owns the requested kind of data.
  10337. */
  10338. isVerticesDataPresent(kind: string): boolean;
  10339. /**
  10340. * Returns an array of indices (IndicesArray).
  10341. */
  10342. getIndices(): IndicesArray;
  10343. readonly _positions: Vector3[];
  10344. /**
  10345. * Sets a new updated BoundingInfo to the mesh.
  10346. * Returns the mesh.
  10347. */
  10348. refreshBoundingInfo(): InstancedMesh;
  10349. _preActivate(): InstancedMesh;
  10350. _activate(renderId: number): InstancedMesh;
  10351. /**
  10352. * Returns the current associated LOD AbstractMesh.
  10353. */
  10354. getLOD(camera: Camera): AbstractMesh;
  10355. _syncSubMeshes(): InstancedMesh;
  10356. _generatePointsArray(): boolean;
  10357. /**
  10358. * Creates a new InstancedMesh from the current mesh.
  10359. * - name (string) : the cloned mesh name
  10360. * - newParent (optional Node) : the optional Node to parent the clone to.
  10361. * - doNotCloneChildren (optional boolean, default `false`) : if `true` the model children aren't cloned.
  10362. *
  10363. * Returns the clone.
  10364. */
  10365. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh;
  10366. /**
  10367. * Disposes the InstancedMesh.
  10368. * Returns nothing.
  10369. */
  10370. dispose(doNotRecurse?: boolean): void;
  10371. }
  10372. }
  10373. declare module BABYLON {
  10374. class LinesMesh extends Mesh {
  10375. useVertexColor: boolean;
  10376. color: Color3;
  10377. alpha: number;
  10378. /**
  10379. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  10380. * This margin is expressed in world space coordinates, so its value may vary.
  10381. * Default value is 0.1
  10382. * @returns the intersection Threshold value.
  10383. */
  10384. /**
  10385. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  10386. * This margin is expressed in world space coordinates, so its value may vary.
  10387. * @param value the new threshold to apply
  10388. */
  10389. intersectionThreshold: number;
  10390. private _intersectionThreshold;
  10391. private _colorShader;
  10392. constructor(name: string, scene: Scene, parent?: Node, source?: LinesMesh, doNotCloneChildren?: boolean, useVertexColor?: boolean);
  10393. /**
  10394. * Returns the string "LineMesh"
  10395. */
  10396. getClassName(): string;
  10397. readonly material: Material;
  10398. readonly checkCollisions: boolean;
  10399. createInstance(name: string): InstancedMesh;
  10400. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): LinesMesh;
  10401. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): LinesMesh;
  10402. dispose(doNotRecurse?: boolean): void;
  10403. /**
  10404. * Returns a new LineMesh object cloned from the current one.
  10405. */
  10406. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh;
  10407. }
  10408. }
  10409. declare module BABYLON {
  10410. class _InstancesBatch {
  10411. mustReturn: boolean;
  10412. visibleInstances: InstancedMesh[][];
  10413. renderSelf: boolean[];
  10414. }
  10415. class Mesh extends AbstractMesh implements IGetSetVerticesData {
  10416. static _FRONTSIDE: number;
  10417. static _BACKSIDE: number;
  10418. static _DOUBLESIDE: number;
  10419. static _DEFAULTSIDE: number;
  10420. static _NO_CAP: number;
  10421. static _CAP_START: number;
  10422. static _CAP_END: number;
  10423. static _CAP_ALL: number;
  10424. /**
  10425. * Mesh side orientation : usually the external or front surface
  10426. */
  10427. static readonly FRONTSIDE: number;
  10428. /**
  10429. * Mesh side orientation : usually the internal or back surface
  10430. */
  10431. static readonly BACKSIDE: number;
  10432. /**
  10433. * Mesh side orientation : both internal and external or front and back surfaces
  10434. */
  10435. static readonly DOUBLESIDE: number;
  10436. /**
  10437. * Mesh side orientation : by default, `FRONTSIDE`
  10438. */
  10439. static readonly DEFAULTSIDE: number;
  10440. /**
  10441. * Mesh cap setting : no cap
  10442. */
  10443. static readonly NO_CAP: number;
  10444. /**
  10445. * Mesh cap setting : one cap at the beginning of the mesh
  10446. */
  10447. static readonly CAP_START: number;
  10448. /**
  10449. * Mesh cap setting : one cap at the end of the mesh
  10450. */
  10451. static readonly CAP_END: number;
  10452. /**
  10453. * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
  10454. */
  10455. static readonly CAP_ALL: number;
  10456. /**
  10457. * An event triggered before rendering the mesh
  10458. * @type {BABYLON.Observable}
  10459. */
  10460. onBeforeRenderObservable: Observable<Mesh>;
  10461. /**
  10462. * An event triggered after rendering the mesh
  10463. * @type {BABYLON.Observable}
  10464. */
  10465. onAfterRenderObservable: Observable<Mesh>;
  10466. /**
  10467. * An event triggered before drawing the mesh
  10468. * @type {BABYLON.Observable}
  10469. */
  10470. onBeforeDrawObservable: Observable<Mesh>;
  10471. private _onBeforeDrawObserver;
  10472. onBeforeDraw: () => void;
  10473. delayLoadState: number;
  10474. instances: InstancedMesh[];
  10475. delayLoadingFile: string;
  10476. _binaryInfo: any;
  10477. private _LODLevels;
  10478. onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
  10479. private _morphTargetManager;
  10480. morphTargetManager: MorphTargetManager;
  10481. _geometry: Geometry;
  10482. _delayInfo: any;
  10483. _delayLoadingFunction: (any: any, mesh: Mesh) => void;
  10484. _visibleInstances: any;
  10485. private _renderIdForInstances;
  10486. private _batchCache;
  10487. private _instancesBufferSize;
  10488. private _instancesBuffer;
  10489. private _instancesData;
  10490. private _overridenInstanceCount;
  10491. _shouldGenerateFlatShading: boolean;
  10492. private _preActivateId;
  10493. private _sideOrientation;
  10494. private _areNormalsFrozen;
  10495. private _sourcePositions;
  10496. private _sourceNormals;
  10497. private _source;
  10498. readonly source: BABYLON.Mesh;
  10499. /**
  10500. * @constructor
  10501. * @param {string} name The value used by scene.getMeshByName() to do a lookup.
  10502. * @param {Scene} scene The scene to add this mesh to.
  10503. * @param {Node} parent The parent of this mesh, if it has one
  10504. * @param {Mesh} source An optional Mesh from which geometry is shared, cloned.
  10505. * @param {boolean} doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
  10506. * When false, achieved by calling a clone(), also passing False.
  10507. * This will make creation of children, recursive.
  10508. * @param {boolean} clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.
  10509. */
  10510. constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean);
  10511. /**
  10512. * Returns the string "Mesh".
  10513. */
  10514. getClassName(): string;
  10515. /**
  10516. * Returns a string.
  10517. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  10518. */
  10519. toString(fullDetails?: boolean): string;
  10520. /**
  10521. * True if the mesh has some Levels Of Details (LOD).
  10522. * Returns a boolean.
  10523. */
  10524. readonly hasLODLevels: boolean;
  10525. private _sortLODLevels();
  10526. /**
  10527. * Add a mesh as LOD level triggered at the given distance.
  10528. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  10529. * @param {number} distance The distance from the center of the object to show this level
  10530. * @param {Mesh} mesh The mesh to be added as LOD level
  10531. * @return {Mesh} This mesh (for chaining)
  10532. */
  10533. addLODLevel(distance: number, mesh: Mesh): Mesh;
  10534. /**
  10535. * Returns the LOD level mesh at the passed distance or null if not found.
  10536. * It is related to the method `addLODLevel(distance, mesh)`.
  10537. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  10538. * Returns an object Mesh or `null`.
  10539. */
  10540. getLODLevelAtDistance(distance: number): Mesh;
  10541. /**
  10542. * Remove a mesh from the LOD array
  10543. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  10544. * @param {Mesh} mesh The mesh to be removed.
  10545. * @return {Mesh} This mesh (for chaining)
  10546. */
  10547. removeLODLevel(mesh: Mesh): Mesh;
  10548. /**
  10549. * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.
  10550. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  10551. */
  10552. getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh;
  10553. /**
  10554. * Returns the mesh internal Geometry object.
  10555. */
  10556. readonly geometry: Geometry;
  10557. /**
  10558. * Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
  10559. */
  10560. getTotalVertices(): number;
  10561. /**
  10562. * Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
  10563. * 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.
  10564. * You can force the copy with forceCopy === true
  10565. * Returns null if the mesh has no geometry or no vertex buffer.
  10566. * Possible `kind` values :
  10567. * - BABYLON.VertexBuffer.PositionKind
  10568. * - BABYLON.VertexBuffer.UVKind
  10569. * - BABYLON.VertexBuffer.UV2Kind
  10570. * - BABYLON.VertexBuffer.UV3Kind
  10571. * - BABYLON.VertexBuffer.UV4Kind
  10572. * - BABYLON.VertexBuffer.UV5Kind
  10573. * - BABYLON.VertexBuffer.UV6Kind
  10574. * - BABYLON.VertexBuffer.ColorKind
  10575. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10576. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10577. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10578. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10579. */
  10580. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): number[] | Float32Array;
  10581. /**
  10582. * Returns the mesh VertexBuffer object from the requested `kind` : positions, indices, normals, etc.
  10583. * Returns `undefined` if the mesh has no geometry.
  10584. * Possible `kind` values :
  10585. * - BABYLON.VertexBuffer.PositionKind
  10586. * - BABYLON.VertexBuffer.UVKind
  10587. * - BABYLON.VertexBuffer.UV2Kind
  10588. * - BABYLON.VertexBuffer.UV3Kind
  10589. * - BABYLON.VertexBuffer.UV4Kind
  10590. * - BABYLON.VertexBuffer.UV5Kind
  10591. * - BABYLON.VertexBuffer.UV6Kind
  10592. * - BABYLON.VertexBuffer.ColorKind
  10593. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10594. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10595. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10596. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10597. */
  10598. getVertexBuffer(kind: any): VertexBuffer;
  10599. /**
  10600. * Returns a boolean depending on the existence of the Vertex Data for the requested `kind`.
  10601. * Possible `kind` values :
  10602. * - BABYLON.VertexBuffer.PositionKind
  10603. * - BABYLON.VertexBuffer.UVKind
  10604. * - BABYLON.VertexBuffer.UV2Kind
  10605. * - BABYLON.VertexBuffer.UV3Kind
  10606. * - BABYLON.VertexBuffer.UV4Kind
  10607. * - BABYLON.VertexBuffer.UV5Kind
  10608. * - BABYLON.VertexBuffer.UV6Kind
  10609. * - BABYLON.VertexBuffer.ColorKind
  10610. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10611. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10612. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10613. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10614. */
  10615. isVerticesDataPresent(kind: string): boolean;
  10616. /**
  10617. * Returns a string : the list of existing `kinds` of Vertex Data for this mesh.
  10618. * Possible `kind` values :
  10619. * - BABYLON.VertexBuffer.PositionKind
  10620. * - BABYLON.VertexBuffer.UVKind
  10621. * - BABYLON.VertexBuffer.UV2Kind
  10622. * - BABYLON.VertexBuffer.UV3Kind
  10623. * - BABYLON.VertexBuffer.UV4Kind
  10624. * - BABYLON.VertexBuffer.UV5Kind
  10625. * - BABYLON.VertexBuffer.UV6Kind
  10626. * - BABYLON.VertexBuffer.ColorKind
  10627. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10628. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10629. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10630. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10631. */
  10632. getVerticesDataKinds(): string[];
  10633. /**
  10634. * Returns a positive integer : the total number of indices in this mesh geometry.
  10635. * Returns zero if the mesh has no geometry.
  10636. */
  10637. getTotalIndices(): number;
  10638. /**
  10639. * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
  10640. * 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.
  10641. * Returns an empty array if the mesh has no geometry.
  10642. */
  10643. getIndices(copyWhenShared?: boolean): IndicesArray;
  10644. readonly isBlocked: boolean;
  10645. /**
  10646. * Boolean : true once the mesh is ready after all the delayed process (loading, etc) are complete.
  10647. */
  10648. isReady(): boolean;
  10649. /**
  10650. * Boolean : true if the mesh has been disposed.
  10651. */
  10652. isDisposed(): boolean;
  10653. /**
  10654. * Sets the mesh side orientation : BABYLON.Mesh.FRONTSIDE, BABYLON.Mesh.BACKSIDE, BABYLON.Mesh.DOUBLESIDE or BABYLON.Mesh.DEFAULTSIDE
  10655. * tuto : http://doc.babylonjs.com/tutorials/Discover_Basic_Elements#side-orientation
  10656. */
  10657. sideOrientation: number;
  10658. /**
  10659. * Boolean : true if the normals aren't to be recomputed on next mesh `positions` array update.
  10660. * This property is pertinent only for updatable parametric shapes.
  10661. */
  10662. readonly areNormalsFrozen: boolean;
  10663. /**
  10664. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  10665. * It has no effect at all on other shapes.
  10666. * It prevents the mesh normals from being recomputed on next `positions` array update.
  10667. * Returns the Mesh.
  10668. */
  10669. freezeNormals(): Mesh;
  10670. /**
  10671. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  10672. * It has no effect at all on other shapes.
  10673. * It reactivates the mesh normals computation if it was previously frozen.
  10674. * Returns the Mesh.
  10675. */
  10676. unfreezeNormals(): Mesh;
  10677. /**
  10678. * Overrides instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
  10679. */
  10680. overridenInstanceCount: number;
  10681. _preActivate(): Mesh;
  10682. _preActivateForIntermediateRendering(renderId: number): Mesh;
  10683. _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): Mesh;
  10684. /**
  10685. * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
  10686. * This means the mesh underlying bounding box and sphere are recomputed.
  10687. * Returns the Mesh.
  10688. */
  10689. refreshBoundingInfo(): Mesh;
  10690. _createGlobalSubMesh(): SubMesh;
  10691. subdivide(count: number): void;
  10692. /**
  10693. * Sets the vertex data of the mesh geometry for the requested `kind`.
  10694. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  10695. * The `data` are either a numeric array either a Float32Array.
  10696. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  10697. * 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).
  10698. * Note that a new underlying VertexBuffer object is created each call.
  10699. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  10700. *
  10701. * Possible `kind` values :
  10702. * - BABYLON.VertexBuffer.PositionKind
  10703. * - BABYLON.VertexBuffer.UVKind
  10704. * - BABYLON.VertexBuffer.UV2Kind
  10705. * - BABYLON.VertexBuffer.UV3Kind
  10706. * - BABYLON.VertexBuffer.UV4Kind
  10707. * - BABYLON.VertexBuffer.UV5Kind
  10708. * - BABYLON.VertexBuffer.UV6Kind
  10709. * - BABYLON.VertexBuffer.ColorKind
  10710. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10711. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10712. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10713. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10714. *
  10715. * Returns the Mesh.
  10716. */
  10717. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): Mesh;
  10718. markVerticesDataAsUpdatable(kind: string, updatable?: boolean): void;
  10719. /**
  10720. * Sets the mesh VertexBuffer.
  10721. * Returns the Mesh.
  10722. */
  10723. setVerticesBuffer(buffer: VertexBuffer): Mesh;
  10724. /**
  10725. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  10726. * If the mesh has no geometry, it is simply returned as it is.
  10727. * The `data` are either a numeric array either a Float32Array.
  10728. * No new underlying VertexBuffer object is created.
  10729. * 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.
  10730. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  10731. *
  10732. * Possible `kind` values :
  10733. * - BABYLON.VertexBuffer.PositionKind
  10734. * - BABYLON.VertexBuffer.UVKind
  10735. * - BABYLON.VertexBuffer.UV2Kind
  10736. * - BABYLON.VertexBuffer.UV3Kind
  10737. * - BABYLON.VertexBuffer.UV4Kind
  10738. * - BABYLON.VertexBuffer.UV5Kind
  10739. * - BABYLON.VertexBuffer.UV6Kind
  10740. * - BABYLON.VertexBuffer.ColorKind
  10741. * - BABYLON.VertexBuffer.MatricesIndicesKind
  10742. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  10743. * - BABYLON.VertexBuffer.MatricesWeightsKind
  10744. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  10745. *
  10746. * Returns the Mesh.
  10747. */
  10748. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): Mesh;
  10749. /**
  10750. * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.
  10751. * tuto : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions
  10752. * The parameter `positionFunction` is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything.
  10753. * The parameter `computeNormals` is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update.
  10754. * Returns the Mesh.
  10755. */
  10756. updateMeshPositions(positionFunction: any, computeNormals?: boolean): Mesh;
  10757. /**
  10758. * Creates a un-shared specific occurence of the geometry for the mesh.
  10759. * Returns the Mesh.
  10760. */
  10761. makeGeometryUnique(): Mesh;
  10762. /**
  10763. * Sets the mesh indices.
  10764. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  10765. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  10766. * This method creates a new index buffer each call.
  10767. * Returns the Mesh.
  10768. */
  10769. setIndices(indices: IndicesArray, totalVertices?: number): Mesh;
  10770. /**
  10771. * Invert the geometry to move from a right handed system to a left handed one.
  10772. * Returns the Mesh.
  10773. */
  10774. toLeftHanded(): Mesh;
  10775. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): Mesh;
  10776. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): Mesh;
  10777. /**
  10778. * Registers for this mesh a javascript function called just before the rendering process.
  10779. * This function is passed the current mesh.
  10780. * Return the Mesh.
  10781. */
  10782. registerBeforeRender(func: (mesh: AbstractMesh) => void): Mesh;
  10783. /**
  10784. * Disposes a previously registered javascript function called before the rendering.
  10785. * This function is passed the current mesh.
  10786. * Returns the Mesh.
  10787. */
  10788. unregisterBeforeRender(func: (mesh: AbstractMesh) => void): Mesh;
  10789. /**
  10790. * Registers for this mesh a javascript function called just after the rendering is complete.
  10791. * This function is passed the current mesh.
  10792. * Returns the Mesh.
  10793. */
  10794. registerAfterRender(func: (mesh: AbstractMesh) => void): Mesh;
  10795. /**
  10796. * Disposes a previously registered javascript function called after the rendering.
  10797. * This function is passed the current mesh.
  10798. * Return the Mesh.
  10799. */
  10800. unregisterAfterRender(func: (mesh: AbstractMesh) => void): Mesh;
  10801. _getInstancesRenderList(subMeshId: number): _InstancesBatch;
  10802. _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): Mesh;
  10803. _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix, effectiveMaterial?: Material) => void, effectiveMaterial?: Material): Mesh;
  10804. /**
  10805. * Triggers the draw call for the mesh.
  10806. * Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager.
  10807. * Returns the Mesh.
  10808. */
  10809. render(subMesh: SubMesh, enableAlphaMode: boolean): Mesh;
  10810. private _onBeforeDraw(isInstance, world, effectiveMaterial);
  10811. /**
  10812. * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
  10813. */
  10814. getEmittedParticleSystems(): ParticleSystem[];
  10815. /**
  10816. * Returns an array populated with ParticleSystem objects whose the mesh or its children are the emitter.
  10817. */
  10818. getHierarchyEmittedParticleSystems(): ParticleSystem[];
  10819. _checkDelayState(): Mesh;
  10820. private _queueLoad(mesh, scene);
  10821. /**
  10822. * Boolean, true is the mesh in the frustum defined by the Plane objects from the `frustumPlanes` array parameter.
  10823. */
  10824. isInFrustum(frustumPlanes: Plane[]): boolean;
  10825. /**
  10826. * Sets the mesh material by the material or multiMaterial `id` property.
  10827. * The material `id` is a string identifying the material or the multiMaterial.
  10828. * This method returns the Mesh.
  10829. */
  10830. setMaterialByID(id: string): Mesh;
  10831. /**
  10832. * Returns as a new array populated with the mesh material and/or skeleton, if any.
  10833. */
  10834. getAnimatables(): IAnimatable[];
  10835. /**
  10836. * Modifies the mesh geometry according to the passed transformation matrix.
  10837. * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.
  10838. * The mesh normals are modified accordingly the same transformation.
  10839. * tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  10840. * Note that, under the hood, this method sets a new VertexBuffer each call.
  10841. * Returns the Mesh.
  10842. */
  10843. bakeTransformIntoVertices(transform: Matrix): Mesh;
  10844. /**
  10845. * Modifies the mesh geometry according to its own current World Matrix.
  10846. * The mesh World Matrix is then reset.
  10847. * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.
  10848. * tuto : tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  10849. * Note that, under the hood, this method sets a new VertexBuffer each call.
  10850. * Returns the Mesh.
  10851. */
  10852. bakeCurrentTransformIntoVertices(): Mesh;
  10853. _resetPointsArrayCache(): Mesh;
  10854. _generatePointsArray(): boolean;
  10855. /**
  10856. * Returns a new Mesh object generated from the current mesh properties.
  10857. * This method must not get confused with createInstance().
  10858. * The parameter `name` is a string, the name given to the new mesh.
  10859. * The optional parameter `newParent` can be any Node object (default `null`).
  10860. * The optional parameter `doNotCloneChildren` (default `false`) allows/denies the recursive cloning of the original mesh children if any.
  10861. * 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.
  10862. */
  10863. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): Mesh;
  10864. /**
  10865. * Disposes the mesh.
  10866. * This also frees the memory allocated under the hood to all the buffers used by WebGL.
  10867. */
  10868. dispose(doNotRecurse?: boolean): void;
  10869. /**
  10870. * Modifies the mesh geometry according to a displacement map.
  10871. * 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.
  10872. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  10873. * This method returns nothing.
  10874. * The parameter `url` is a string, the URL from the image file is to be downloaded.
  10875. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  10876. * 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.
  10877. * The parameter `uvOffset` is an optional vector2 used to offset UV.
  10878. * The parameter `uvScale` is an optional vector2 used to scale UV.
  10879. *
  10880. * Returns the Mesh.
  10881. */
  10882. applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void, uvOffset?: Vector2, uvScale?: Vector2): Mesh;
  10883. /**
  10884. * Modifies the mesh geometry according to a displacementMap buffer.
  10885. * 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.
  10886. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  10887. * This method returns nothing.
  10888. * 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.
  10889. * The parameters `heightMapWidth` and `heightMapHeight` are positive integers to set the width and height of the buffer image.
  10890. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  10891. * The parameter `uvOffset` is an optional vector2 used to offset UV.
  10892. * The parameter `uvScale` is an optional vector2 used to scale UV.
  10893. *
  10894. * Returns the Mesh.
  10895. */
  10896. applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number, uvOffset?: Vector2, uvScale?: Vector2): Mesh;
  10897. /**
  10898. * Modify the mesh to get a flat shading rendering.
  10899. * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.
  10900. * This method returns the Mesh.
  10901. * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
  10902. */
  10903. convertToFlatShadedMesh(): Mesh;
  10904. /**
  10905. * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.
  10906. * In other words, more vertices, no more indices and a single bigger VBO.
  10907. * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
  10908. * Returns the Mesh.
  10909. */
  10910. convertToUnIndexedMesh(): Mesh;
  10911. /**
  10912. * Inverses facet orientations and inverts also the normals with `flipNormals` (default `false`) if true.
  10913. * This method returns the Mesh.
  10914. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  10915. */
  10916. flipFaces(flipNormals?: boolean): Mesh;
  10917. /**
  10918. * Creates a new InstancedMesh object from the mesh model.
  10919. * An instance shares the same properties and the same material than its model.
  10920. * Only these properties of each instance can then be set individually :
  10921. * - position
  10922. * - rotation
  10923. * - rotationQuaternion
  10924. * - setPivotMatrix
  10925. * - scaling
  10926. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_Instances
  10927. * Warning : this method is not supported for Line mesh and LineSystem
  10928. */
  10929. createInstance(name: string): InstancedMesh;
  10930. /**
  10931. * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.
  10932. * After this call, all the mesh instances have the same submeshes than the current mesh.
  10933. * This method returns the Mesh.
  10934. */
  10935. synchronizeInstances(): Mesh;
  10936. /**
  10937. * Simplify the mesh according to the given array of settings.
  10938. * Function will return immediately and will simplify async. It returns the Mesh.
  10939. * @param settings a collection of simplification settings.
  10940. * @param parallelProcessing should all levels calculate parallel or one after the other.
  10941. * @param type the type of simplification to run.
  10942. * @param successCallback optional success callback to be called after the simplification finished processing all settings.
  10943. */
  10944. simplify(settings: Array<ISimplificationSettings>, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): Mesh;
  10945. /**
  10946. * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
  10947. * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
  10948. * This should be used together with the simplification to avoid disappearing triangles.
  10949. * Returns the Mesh.
  10950. * @param successCallback an optional success callback to be called after the optimization finished.
  10951. */
  10952. optimizeIndices(successCallback?: (mesh?: Mesh) => void): Mesh;
  10953. serialize(serializationObject: any): void;
  10954. _syncGeometryWithMorphTargetManager(): void;
  10955. /**
  10956. * Returns a new Mesh object what is a deep copy of the passed mesh.
  10957. * The parameter `parsedMesh` is the mesh to be copied.
  10958. * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
  10959. */
  10960. static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh;
  10961. /**
  10962. * Creates a ribbon mesh.
  10963. * Please consider using the same method from the MeshBuilder class instead.
  10964. * 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.
  10965. *
  10966. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  10967. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  10968. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  10969. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  10970. * 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.
  10971. * 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.
  10972. * 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
  10973. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10974. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10975. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10976. */
  10977. static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene?: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  10978. /**
  10979. * Creates a plane polygonal mesh. By default, this is a disc.
  10980. * Please consider using the same method from the MeshBuilder class instead.
  10981. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  10982. * 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.
  10983. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10984. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10985. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10986. */
  10987. static CreateDisc(name: string, radius: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  10988. /**
  10989. * Creates a box mesh.
  10990. * Please consider using the same method from the MeshBuilder class instead.
  10991. * The parameter `size` sets the size (float) of each box side (default 1).
  10992. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  10993. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  10994. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  10995. */
  10996. static CreateBox(name: string, size: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  10997. /**
  10998. * Creates a sphere mesh.
  10999. * Please consider using the same method from the MeshBuilder class instead.
  11000. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  11001. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  11002. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11003. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11004. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11005. */
  11006. static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  11007. /**
  11008. * Creates a cylinder or a cone mesh.
  11009. * Please consider using the same method from the MeshBuilder class instead.
  11010. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  11011. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  11012. * 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.
  11013. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  11014. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  11015. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11016. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11017. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11018. */
  11019. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene?: Scene, updatable?: any, sideOrientation?: number): Mesh;
  11020. /**
  11021. * Creates a torus mesh.
  11022. * Please consider using the same method from the MeshBuilder class instead.
  11023. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  11024. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  11025. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  11026. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11027. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11028. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11029. */
  11030. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  11031. /**
  11032. * Creates a torus knot mesh.
  11033. * Please consider using the same method from the MeshBuilder class instead.
  11034. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  11035. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  11036. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  11037. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  11038. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11039. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11040. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11041. */
  11042. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  11043. /**
  11044. * Creates a line mesh.
  11045. * Please consider using the same method from the MeshBuilder class instead.
  11046. * 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.
  11047. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  11048. * The parameter `points` is an array successive Vector3.
  11049. * 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
  11050. * When updating an instance, remember that only point positions can change, not the number of points.
  11051. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11052. */
  11053. static CreateLines(name: string, points: Vector3[], scene?: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  11054. /**
  11055. * Creates a dashed line mesh.
  11056. * Please consider using the same method from the MeshBuilder class instead.
  11057. * 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.
  11058. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  11059. * The parameter `points` is an array successive Vector3.
  11060. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  11061. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  11062. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  11063. * 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
  11064. * When updating an instance, remember that only point positions can change, not the number of points.
  11065. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11066. */
  11067. static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene?: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  11068. /**
  11069. * Creates an extruded shape mesh.
  11070. * 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.
  11071. * Please consider using the same method from the MeshBuilder class instead.
  11072. *
  11073. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  11074. * 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
  11075. * extruded along the Z axis.
  11076. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  11077. * 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.
  11078. * The parameter `scale` (float, default 1) is the value to scale the shape.
  11079. * 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
  11080. * 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
  11081. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  11082. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11083. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11084. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11085. */
  11086. static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene?: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  11087. /**
  11088. * Creates an custom extruded shape mesh.
  11089. * 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.
  11090. * Please consider using the same method from the MeshBuilder class instead.
  11091. *
  11092. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  11093. * 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
  11094. * extruded along the Z axis.
  11095. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  11096. * 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
  11097. * and the distance of this point from the begining of the path :
  11098. * ```javascript
  11099. * var rotationFunction = function(i, distance) {
  11100. * // do things
  11101. * return rotationValue; }
  11102. * ```
  11103. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  11104. * 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
  11105. * and the distance of this point from the begining of the path :
  11106. * ```javascript
  11107. * var scaleFunction = function(i, distance) {
  11108. * // do things
  11109. * return scaleValue;}
  11110. * ```
  11111. * It must returns a float value that will be the scale value applied to the shape on each path point.
  11112. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  11113. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  11114. * 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
  11115. * 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
  11116. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  11117. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11118. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11119. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11120. */
  11121. 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;
  11122. /**
  11123. * Creates lathe mesh.
  11124. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  11125. * Please consider using the same method from the MeshBuilder class instead.
  11126. * 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
  11127. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  11128. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  11129. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  11130. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11131. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11132. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11133. */
  11134. static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  11135. /**
  11136. * Creates a plane mesh.
  11137. * Please consider using the same method from the MeshBuilder class instead.
  11138. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  11139. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11140. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11141. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11142. */
  11143. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  11144. /**
  11145. * Creates a ground mesh.
  11146. * Please consider using the same method from the MeshBuilder class instead.
  11147. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  11148. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  11149. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11150. */
  11151. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh;
  11152. /**
  11153. * Creates a tiled ground mesh.
  11154. * Please consider using the same method from the MeshBuilder class instead.
  11155. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  11156. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  11157. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  11158. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  11159. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  11160. * numbers of subdivisions on the ground width and height of each tile.
  11161. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11162. */
  11163. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  11164. w: number;
  11165. h: number;
  11166. }, precision: {
  11167. w: number;
  11168. h: number;
  11169. }, scene: Scene, updatable?: boolean): Mesh;
  11170. /**
  11171. * Creates a ground mesh from a height map.
  11172. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  11173. * Please consider using the same method from the MeshBuilder class instead.
  11174. * The parameter `url` sets the URL of the height map image resource.
  11175. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  11176. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  11177. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  11178. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  11179. * 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).
  11180. * This function is passed the newly built mesh :
  11181. * ```javascript
  11182. * function(mesh) { // do things
  11183. * return; }
  11184. * ```
  11185. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11186. */
  11187. 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;
  11188. /**
  11189. * Creates a tube mesh.
  11190. * 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.
  11191. * Please consider using the same method from the MeshBuilder class instead.
  11192. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  11193. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  11194. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  11195. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  11196. * 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.
  11197. * It must return a radius value (positive float) :
  11198. * ```javascript
  11199. * var radiusFunction = function(i, distance) {
  11200. * // do things
  11201. * return radius; }
  11202. * ```
  11203. * 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
  11204. * 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
  11205. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11206. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11207. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11208. */
  11209. static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
  11210. (i: number, distance: number): number;
  11211. }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  11212. /**
  11213. * Creates a polyhedron mesh.
  11214. * Please consider using the same method from the MeshBuilder class instead.
  11215. * 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
  11216. * to choose the wanted type.
  11217. * The parameter `size` (positive float, default 1) sets the polygon size.
  11218. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  11219. * 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`.
  11220. * 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
  11221. * 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)`).
  11222. * 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
  11223. * 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.
  11224. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11225. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11226. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11227. */
  11228. static CreatePolyhedron(name: string, options: {
  11229. type?: number;
  11230. size?: number;
  11231. sizeX?: number;
  11232. sizeY?: number;
  11233. sizeZ?: number;
  11234. custom?: any;
  11235. faceUV?: Vector4[];
  11236. faceColors?: Color4[];
  11237. updatable?: boolean;
  11238. sideOrientation?: number;
  11239. }, scene: Scene): Mesh;
  11240. /**
  11241. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  11242. * Please consider using the same method from the MeshBuilder class instead.
  11243. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  11244. * 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`).
  11245. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  11246. * 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.
  11247. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11248. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11249. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11250. */
  11251. static CreateIcoSphere(name: string, options: {
  11252. radius?: number;
  11253. flat?: boolean;
  11254. subdivisions?: number;
  11255. sideOrientation?: number;
  11256. updatable?: boolean;
  11257. }, scene: Scene): Mesh;
  11258. /**
  11259. * Creates a decal mesh.
  11260. * Please consider using the same method from the MeshBuilder class instead.
  11261. * 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.
  11262. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  11263. * The parameter `normal` (Vector3, default Vector3.Up) sets the normal of the mesh where the decal is applied onto in World coordinates.
  11264. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  11265. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  11266. */
  11267. static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;
  11268. /**
  11269. * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  11270. */
  11271. setPositionsForCPUSkinning(): Float32Array;
  11272. /**
  11273. * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  11274. */
  11275. setNormalsForCPUSkinning(): Float32Array;
  11276. /**
  11277. * Updates the vertex buffer by applying transformation from the bones.
  11278. * Returns the Mesh.
  11279. *
  11280. * @param {skeleton} skeleton to apply
  11281. */
  11282. applySkeleton(skeleton: Skeleton): Mesh;
  11283. /**
  11284. * Returns an object `{min:` Vector3`, max:` Vector3`}`
  11285. * This min and max Vector3 are the minimum and maximum vectors of each mesh bounding box from the passed array, in the World system
  11286. */
  11287. static MinMax(meshes: AbstractMesh[]): {
  11288. min: Vector3;
  11289. max: Vector3;
  11290. };
  11291. /**
  11292. * Returns a Vector3, the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array.
  11293. */
  11294. static Center(meshesOrMinMaxVector: any): Vector3;
  11295. /**
  11296. * Merge the array of meshes into a single mesh for performance reasons.
  11297. * @param {Array<Mesh>} meshes - The vertices source. They should all be of the same material. Entries can empty
  11298. * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
  11299. * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
  11300. * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
  11301. * @param {boolean} subdivideWithSubMeshes - When true (false default), subdivide mesh to his subMesh array with meshes source.
  11302. */
  11303. static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh, subdivideWithSubMeshes?: boolean): Mesh;
  11304. }
  11305. }
  11306. declare module BABYLON {
  11307. type IndicesArray = number[] | Int32Array | Uint32Array | Uint16Array;
  11308. interface IGetSetVerticesData {
  11309. isVerticesDataPresent(kind: string): boolean;
  11310. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): number[] | Float32Array;
  11311. getIndices(copyWhenShared?: boolean): IndicesArray;
  11312. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
  11313. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
  11314. setIndices(indices: IndicesArray): void;
  11315. }
  11316. class VertexData {
  11317. positions: number[] | Float32Array;
  11318. normals: number[] | Float32Array;
  11319. tangents: number[] | Float32Array;
  11320. uvs: number[] | Float32Array;
  11321. uvs2: number[] | Float32Array;
  11322. uvs3: number[] | Float32Array;
  11323. uvs4: number[] | Float32Array;
  11324. uvs5: number[] | Float32Array;
  11325. uvs6: number[] | Float32Array;
  11326. colors: number[] | Float32Array;
  11327. matricesIndices: number[] | Float32Array;
  11328. matricesWeights: number[] | Float32Array;
  11329. matricesIndicesExtra: number[] | Float32Array;
  11330. matricesWeightsExtra: number[] | Float32Array;
  11331. indices: IndicesArray;
  11332. set(data: number[] | Float32Array, kind: string): void;
  11333. /**
  11334. * Associates the vertexData to the passed Mesh.
  11335. * Sets it as updatable or not (default `false`).
  11336. * Returns the VertexData.
  11337. */
  11338. applyToMesh(mesh: Mesh, updatable?: boolean): VertexData;
  11339. /**
  11340. * Associates the vertexData to the passed Geometry.
  11341. * Sets it as updatable or not (default `false`).
  11342. * Returns the VertexData.
  11343. */
  11344. applyToGeometry(geometry: Geometry, updatable?: boolean): VertexData;
  11345. /**
  11346. * Updates the associated mesh.
  11347. * Returns the VertexData.
  11348. */
  11349. updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): VertexData;
  11350. /**
  11351. * Updates the associated geometry.
  11352. * Returns the VertexData.
  11353. */
  11354. updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): VertexData;
  11355. private _applyTo(meshOrGeometry, updatable?);
  11356. private _update(meshOrGeometry, updateExtends?, makeItUnique?);
  11357. /**
  11358. * Transforms each position and each normal of the vertexData according to the passed Matrix.
  11359. * Returns the VertexData.
  11360. */
  11361. transform(matrix: Matrix): VertexData;
  11362. /**
  11363. * Merges the passed VertexData into the current one.
  11364. * Returns the modified VertexData.
  11365. */
  11366. merge(other: VertexData): VertexData;
  11367. private _mergeElement(source, other);
  11368. /**
  11369. * Serializes the VertexData.
  11370. * Returns a serialized object.
  11371. */
  11372. serialize(): any;
  11373. /**
  11374. * Returns the object VertexData associated to the passed mesh.
  11375. */
  11376. static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean, forceCopy?: boolean): VertexData;
  11377. /**
  11378. * Returns the object VertexData associated to the passed geometry.
  11379. */
  11380. static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean, forceCopy?: boolean): VertexData;
  11381. private static _ExtractFrom(meshOrGeometry, copyWhenShared?, forceCopy?);
  11382. /**
  11383. * Creates the vertexData of the Ribbon.
  11384. */
  11385. static CreateRibbon(options: {
  11386. pathArray: Vector3[][];
  11387. closeArray?: boolean;
  11388. closePath?: boolean;
  11389. offset?: number;
  11390. sideOrientation?: number;
  11391. invertUV?: boolean;
  11392. uvs?: Vector2[];
  11393. colors?: Color4[];
  11394. }): VertexData;
  11395. /**
  11396. * Creates the VertexData of the Box.
  11397. */
  11398. static CreateBox(options: {
  11399. size?: number;
  11400. width?: number;
  11401. height?: number;
  11402. depth?: number;
  11403. faceUV?: Vector4[];
  11404. faceColors?: Color4[];
  11405. sideOrientation?: number;
  11406. }): VertexData;
  11407. /**
  11408. * Creates the VertexData of the Sphere.
  11409. */
  11410. static CreateSphere(options: {
  11411. segments?: number;
  11412. diameter?: number;
  11413. diameterX?: number;
  11414. diameterY?: number;
  11415. diameterZ?: number;
  11416. arc?: number;
  11417. slice?: number;
  11418. sideOrientation?: number;
  11419. }): VertexData;
  11420. /**
  11421. * Creates the VertexData of the Cylinder or Cone.
  11422. */
  11423. static CreateCylinder(options: {
  11424. height?: number;
  11425. diameterTop?: number;
  11426. diameterBottom?: number;
  11427. diameter?: number;
  11428. tessellation?: number;
  11429. subdivisions?: number;
  11430. arc?: number;
  11431. faceColors?: Color4[];
  11432. faceUV?: Vector4[];
  11433. hasRings?: boolean;
  11434. enclose?: boolean;
  11435. sideOrientation?: number;
  11436. }): VertexData;
  11437. /**
  11438. * Creates the VertexData of the Torus.
  11439. */
  11440. static CreateTorus(options: {
  11441. diameter?: number;
  11442. thickness?: number;
  11443. tessellation?: number;
  11444. sideOrientation?: number;
  11445. }): VertexData;
  11446. /**
  11447. * Creates the VertexData of the LineSystem.
  11448. */
  11449. static CreateLineSystem(options: {
  11450. lines: Vector3[][];
  11451. }): VertexData;
  11452. /**
  11453. * Create the VertexData of the DashedLines.
  11454. */
  11455. static CreateDashedLines(options: {
  11456. points: Vector3[];
  11457. dashSize?: number;
  11458. gapSize?: number;
  11459. dashNb?: number;
  11460. }): VertexData;
  11461. /**
  11462. * Creates the VertexData of the Ground.
  11463. */
  11464. static CreateGround(options: {
  11465. width?: number;
  11466. height?: number;
  11467. subdivisions?: number;
  11468. subdivisionsX?: number;
  11469. subdivisionsY?: number;
  11470. }): VertexData;
  11471. /**
  11472. * Creates the VertexData of the TiledGround.
  11473. */
  11474. static CreateTiledGround(options: {
  11475. xmin: number;
  11476. zmin: number;
  11477. xmax: number;
  11478. zmax: number;
  11479. subdivisions?: {
  11480. w: number;
  11481. h: number;
  11482. };
  11483. precision?: {
  11484. w: number;
  11485. h: number;
  11486. };
  11487. }): VertexData;
  11488. /**
  11489. * Creates the VertexData of the Ground designed from a heightmap.
  11490. */
  11491. static CreateGroundFromHeightMap(options: {
  11492. width: number;
  11493. height: number;
  11494. subdivisions: number;
  11495. minHeight: number;
  11496. maxHeight: number;
  11497. colorFilter: Color3;
  11498. buffer: Uint8Array;
  11499. bufferWidth: number;
  11500. bufferHeight: number;
  11501. }): VertexData;
  11502. /**
  11503. * Creates the VertexData of the Plane.
  11504. */
  11505. static CreatePlane(options: {
  11506. size?: number;
  11507. width?: number;
  11508. height?: number;
  11509. sideOrientation?: number;
  11510. }): VertexData;
  11511. /**
  11512. * Creates the VertexData of the Disc or regular Polygon.
  11513. */
  11514. static CreateDisc(options: {
  11515. radius?: number;
  11516. tessellation?: number;
  11517. arc?: number;
  11518. sideOrientation?: number;
  11519. }): VertexData;
  11520. /**
  11521. * Creates the VertexData of the IcoSphere.
  11522. */
  11523. static CreateIcoSphere(options: {
  11524. radius?: number;
  11525. radiusX?: number;
  11526. radiusY?: number;
  11527. radiusZ?: number;
  11528. flat?: boolean;
  11529. subdivisions?: number;
  11530. sideOrientation?: number;
  11531. }): VertexData;
  11532. /**
  11533. * Creates the VertexData of the Polyhedron.
  11534. */
  11535. static CreatePolyhedron(options: {
  11536. type?: number;
  11537. size?: number;
  11538. sizeX?: number;
  11539. sizeY?: number;
  11540. sizeZ?: number;
  11541. custom?: any;
  11542. faceUV?: Vector4[];
  11543. faceColors?: Color4[];
  11544. flat?: boolean;
  11545. sideOrientation?: number;
  11546. }): VertexData;
  11547. /**
  11548. * Creates the VertexData of the Torus Knot.
  11549. */
  11550. static CreateTorusKnot(options: {
  11551. radius?: number;
  11552. tube?: number;
  11553. radialSegments?: number;
  11554. tubularSegments?: number;
  11555. p?: number;
  11556. q?: number;
  11557. sideOrientation?: number;
  11558. }): VertexData;
  11559. /**
  11560. * @param {any} - positions (number[] or Float32Array)
  11561. * @param {any} - indices (number[] or Uint16Array)
  11562. * @param {any} - normals (number[] or Float32Array)
  11563. * options (optional) :
  11564. * facetPositions : optional array of facet positions (vector3)
  11565. * facetNormals : optional array of facet normals (vector3)
  11566. * facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation
  11567. * subDiv : optional partitioning data about subdivsions on each axis (int), required for facetPartitioning computation
  11568. * ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation
  11569. * bbSize : optional bounding box size data, required for facetPartitioning computation
  11570. * bInfo : optional bounding info, required for facetPartitioning computation
  11571. */
  11572. static ComputeNormals(positions: any, indices: any, normals: any, options?: {
  11573. facetNormals?: any;
  11574. facetPositions?: any;
  11575. facetPartitioning?: any;
  11576. ratio?: number;
  11577. bInfo?: any;
  11578. bbSize?: Vector3;
  11579. subDiv?: any;
  11580. useRightHandedSystem?: boolean;
  11581. }): void;
  11582. private static _ComputeSides(sideOrientation, positions, indices, normals, uvs);
  11583. /**
  11584. * Creates a new VertexData from the imported parameters.
  11585. */
  11586. static ImportVertexData(parsedVertexData: any, geometry: Geometry): void;
  11587. }
  11588. }
  11589. declare module BABYLON {
  11590. class MeshBuilder {
  11591. private static updateSideOrientation(orientation, scene);
  11592. /**
  11593. * Creates a box mesh.
  11594. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#box
  11595. * The parameter `size` sets the size (float) of each box side (default 1).
  11596. * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value than `size`).
  11597. * 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).
  11598. * Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  11599. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11600. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11601. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11602. */
  11603. static CreateBox(name: string, options: {
  11604. size?: number;
  11605. width?: number;
  11606. height?: number;
  11607. depth?: number;
  11608. faceUV?: Vector4[];
  11609. faceColors?: Color4[];
  11610. sideOrientation?: number;
  11611. updatable?: boolean;
  11612. }, scene: Scene): Mesh;
  11613. /**
  11614. * Creates a sphere mesh.
  11615. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#sphere
  11616. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  11617. * 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`).
  11618. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  11619. * 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
  11620. * 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).
  11621. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11622. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11623. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11624. */
  11625. static CreateSphere(name: string, options: {
  11626. segments?: number;
  11627. diameter?: number;
  11628. diameterX?: number;
  11629. diameterY?: number;
  11630. diameterZ?: number;
  11631. arc?: number;
  11632. slice?: number;
  11633. sideOrientation?: number;
  11634. updatable?: boolean;
  11635. }, scene: any): Mesh;
  11636. /**
  11637. * Creates a plane polygonal mesh. By default, this is a disc.
  11638. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#disc
  11639. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  11640. * 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.
  11641. * 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
  11642. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11643. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11644. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11645. */
  11646. static CreateDisc(name: string, options: {
  11647. radius?: number;
  11648. tessellation?: number;
  11649. arc?: number;
  11650. updatable?: boolean;
  11651. sideOrientation?: number;
  11652. }, scene: Scene): Mesh;
  11653. /**
  11654. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  11655. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#icosphere
  11656. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  11657. * 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`).
  11658. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  11659. * 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.
  11660. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11661. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11662. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11663. */
  11664. static CreateIcoSphere(name: string, options: {
  11665. radius?: number;
  11666. radiusX?: number;
  11667. radiusY?: number;
  11668. radiusZ?: number;
  11669. flat?: boolean;
  11670. subdivisions?: number;
  11671. sideOrientation?: number;
  11672. updatable?: boolean;
  11673. }, scene: Scene): Mesh;
  11674. /**
  11675. * Creates a ribbon mesh.
  11676. * 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.
  11677. *
  11678. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  11679. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  11680. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  11681. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  11682. * 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.
  11683. * 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.
  11684. * 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
  11685. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11686. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11687. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  11688. * 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.
  11689. * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values.
  11690. * 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
  11691. * if you set `closePath` to `true`, there's one extra vertex per path in the geometry.
  11692. * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time.
  11693. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11694. */
  11695. static CreateRibbon(name: string, options: {
  11696. pathArray: Vector3[][];
  11697. closeArray?: boolean;
  11698. closePath?: boolean;
  11699. offset?: number;
  11700. updatable?: boolean;
  11701. sideOrientation?: number;
  11702. instance?: Mesh;
  11703. invertUV?: boolean;
  11704. uvs?: Vector2[];
  11705. colors?: Color4[];
  11706. }, scene?: Scene): Mesh;
  11707. /**
  11708. * Creates a cylinder or a cone mesh.
  11709. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#cylinder-or-cone
  11710. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  11711. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  11712. * 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.
  11713. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  11714. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  11715. * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.
  11716. * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.
  11717. * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.
  11718. * 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).
  11719. * 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
  11720. * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7
  11721. * 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
  11722. * 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.
  11723. * If `enclose` is false, a ring surface is one element.
  11724. * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
  11725. * 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
  11726. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11727. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11728. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11729. */
  11730. static CreateCylinder(name: string, options: {
  11731. height?: number;
  11732. diameterTop?: number;
  11733. diameterBottom?: number;
  11734. diameter?: number;
  11735. tessellation?: number;
  11736. subdivisions?: number;
  11737. arc?: number;
  11738. faceColors?: Color4[];
  11739. faceUV?: Vector4[];
  11740. updatable?: boolean;
  11741. hasRings?: boolean;
  11742. enclose?: boolean;
  11743. sideOrientation?: number;
  11744. }, scene: any): Mesh;
  11745. /**
  11746. * Creates a torus mesh.
  11747. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus
  11748. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  11749. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  11750. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  11751. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11752. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11753. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11754. */
  11755. static CreateTorus(name: string, options: {
  11756. diameter?: number;
  11757. thickness?: number;
  11758. tessellation?: number;
  11759. updatable?: boolean;
  11760. sideOrientation?: number;
  11761. }, scene: any): Mesh;
  11762. /**
  11763. * Creates a torus knot mesh.
  11764. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus-knot
  11765. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  11766. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  11767. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  11768. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  11769. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11770. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11771. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11772. */
  11773. static CreateTorusKnot(name: string, options: {
  11774. radius?: number;
  11775. tube?: number;
  11776. radialSegments?: number;
  11777. tubularSegments?: number;
  11778. p?: number;
  11779. q?: number;
  11780. updatable?: boolean;
  11781. sideOrientation?: number;
  11782. }, scene: any): Mesh;
  11783. /**
  11784. * Creates a line system mesh.
  11785. * A line system is a pool of many lines gathered in a single mesh.
  11786. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#linesystem
  11787. * 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.
  11788. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function.
  11789. * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
  11790. * 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
  11791. * 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
  11792. * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
  11793. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11794. */
  11795. static CreateLineSystem(name: string, options: {
  11796. lines: Vector3[][];
  11797. updatable: boolean;
  11798. instance?: LinesMesh;
  11799. }, scene: Scene): LinesMesh;
  11800. /**
  11801. * Creates a line mesh.
  11802. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lines
  11803. * 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.
  11804. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  11805. * The parameter `points` is an array successive Vector3.
  11806. * 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
  11807. * When updating an instance, remember that only point positions can change, not the number of points.
  11808. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11809. */
  11810. static CreateLines(name: string, options: {
  11811. points: Vector3[];
  11812. updatable?: boolean;
  11813. instance?: LinesMesh;
  11814. }, scene: Scene): LinesMesh;
  11815. /**
  11816. * Creates a dashed line mesh.
  11817. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#dashed-lines
  11818. * 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.
  11819. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  11820. * The parameter `points` is an array successive Vector3.
  11821. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  11822. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  11823. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  11824. * 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
  11825. * When updating an instance, remember that only point positions can change, not the number of points.
  11826. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11827. */
  11828. static CreateDashedLines(name: string, options: {
  11829. points: Vector3[];
  11830. dashSize?: number;
  11831. gapSize?: number;
  11832. dashNb?: number;
  11833. updatable?: boolean;
  11834. instance?: LinesMesh;
  11835. }, scene: Scene): LinesMesh;
  11836. /**
  11837. * Creates an extruded shape mesh.
  11838. * 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.
  11839. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#extruded-shapes
  11840. *
  11841. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  11842. * 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
  11843. * extruded along the Z axis.
  11844. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  11845. * 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.
  11846. * The parameter `scale` (float, default 1) is the value to scale the shape.
  11847. * 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
  11848. * 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
  11849. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  11850. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11851. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11852. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  11853. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11854. */
  11855. static ExtrudeShape(name: string, options: {
  11856. shape: Vector3[];
  11857. path: Vector3[];
  11858. scale?: number;
  11859. rotation?: number;
  11860. cap?: number;
  11861. updatable?: boolean;
  11862. sideOrientation?: number;
  11863. instance?: Mesh;
  11864. invertUV?: boolean;
  11865. }, scene: Scene): Mesh;
  11866. /**
  11867. * Creates an custom extruded shape mesh.
  11868. * 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.
  11869. * tuto :http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#custom-extruded-shapes
  11870. *
  11871. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  11872. * 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
  11873. * extruded along the Z axis.
  11874. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  11875. * 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
  11876. * and the distance of this point from the begining of the path :
  11877. * ```javascript
  11878. * var rotationFunction = function(i, distance) {
  11879. * // do things
  11880. * return rotationValue; }
  11881. * ```
  11882. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  11883. * 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
  11884. * and the distance of this point from the begining of the path :
  11885. * ```javascript
  11886. * var scaleFunction = function(i, distance) {
  11887. * // do things
  11888. * return scaleValue;}
  11889. * ```
  11890. * It must returns a float value that will be the scale value applied to the shape on each path point.
  11891. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  11892. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  11893. * 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
  11894. * 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
  11895. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  11896. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11897. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11898. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  11899. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11900. */
  11901. static ExtrudeShapeCustom(name: string, options: {
  11902. shape: Vector3[];
  11903. path: Vector3[];
  11904. scaleFunction?: any;
  11905. rotationFunction?: any;
  11906. ribbonCloseArray?: boolean;
  11907. ribbonClosePath?: boolean;
  11908. cap?: number;
  11909. updatable?: boolean;
  11910. sideOrientation?: number;
  11911. instance?: Mesh;
  11912. invertUV?: boolean;
  11913. }, scene: Scene): Mesh;
  11914. /**
  11915. * Creates lathe mesh.
  11916. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  11917. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lathe
  11918. *
  11919. * 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
  11920. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  11921. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  11922. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  11923. * 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.
  11924. * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
  11925. * 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
  11926. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11927. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11928. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  11929. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11930. */
  11931. static CreateLathe(name: string, options: {
  11932. shape: Vector3[];
  11933. radius?: number;
  11934. tessellation?: number;
  11935. arc?: number;
  11936. closed?: boolean;
  11937. updatable?: boolean;
  11938. sideOrientation?: number;
  11939. cap?: number;
  11940. invertUV?: boolean;
  11941. }, scene: Scene): Mesh;
  11942. /**
  11943. * Creates a plane mesh.
  11944. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  11945. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  11946. * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value than `size`).
  11947. * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane.
  11948. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  11949. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  11950. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11951. */
  11952. static CreatePlane(name: string, options: {
  11953. size?: number;
  11954. width?: number;
  11955. height?: number;
  11956. sideOrientation?: number;
  11957. updatable?: boolean;
  11958. sourcePlane?: Plane;
  11959. }, scene: Scene): Mesh;
  11960. /**
  11961. * Creates a ground mesh.
  11962. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  11963. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  11964. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  11965. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11966. */
  11967. static CreateGround(name: string, options: {
  11968. width?: number;
  11969. height?: number;
  11970. subdivisions?: number;
  11971. subdivisionsX?: number;
  11972. subdivisionsY?: number;
  11973. updatable?: boolean;
  11974. }, scene: any): Mesh;
  11975. /**
  11976. * Creates a tiled ground mesh.
  11977. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tiled-ground
  11978. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  11979. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  11980. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  11981. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  11982. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  11983. * numbers of subdivisions on the ground width and height of each tile.
  11984. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  11985. */
  11986. static CreateTiledGround(name: string, options: {
  11987. xmin: number;
  11988. zmin: number;
  11989. xmax: number;
  11990. zmax: number;
  11991. subdivisions?: {
  11992. w: number;
  11993. h: number;
  11994. };
  11995. precision?: {
  11996. w: number;
  11997. h: number;
  11998. };
  11999. updatable?: boolean;
  12000. }, scene: Scene): Mesh;
  12001. /**
  12002. * Creates a ground mesh from a height map.
  12003. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  12004. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#ground-from-a-height-map
  12005. * The parameter `url` sets the URL of the height map image resource.
  12006. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  12007. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  12008. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  12009. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  12010. * 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.
  12011. * 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).
  12012. * This function is passed the newly built mesh :
  12013. * ```javascript
  12014. * function(mesh) { // do things
  12015. * return; }
  12016. * ```
  12017. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  12018. */
  12019. static CreateGroundFromHeightMap(name: string, url: string, options: {
  12020. width?: number;
  12021. height?: number;
  12022. subdivisions?: number;
  12023. minHeight?: number;
  12024. maxHeight?: number;
  12025. colorFilter?: Color3;
  12026. updatable?: boolean;
  12027. onReady?: (mesh: GroundMesh) => void;
  12028. }, scene: Scene): GroundMesh;
  12029. /**
  12030. * Creates a tube mesh.
  12031. * 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.
  12032. *
  12033. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tube
  12034. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  12035. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  12036. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  12037. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  12038. * 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.
  12039. * It must return a radius value (positive float) :
  12040. * ```javascript
  12041. * var radiusFunction = function(i, distance) {
  12042. * // do things
  12043. * return radius; }
  12044. * ```
  12045. * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc.
  12046. * 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
  12047. * 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
  12048. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  12049. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  12050. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  12051. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  12052. */
  12053. static CreateTube(name: string, options: {
  12054. path: Vector3[];
  12055. radius?: number;
  12056. tessellation?: number;
  12057. radiusFunction?: {
  12058. (i: number, distance: number): number;
  12059. };
  12060. cap?: number;
  12061. arc?: number;
  12062. updatable?: boolean;
  12063. sideOrientation?: number;
  12064. instance?: Mesh;
  12065. invertUV?: boolean;
  12066. }, scene: Scene): Mesh;
  12067. /**
  12068. * Creates a polyhedron mesh.
  12069. *
  12070. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#polyhedron
  12071. * 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
  12072. * to choose the wanted type.
  12073. * The parameter `size` (positive float, default 1) sets the polygon size.
  12074. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  12075. * 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`.
  12076. * 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
  12077. * 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)`).
  12078. * 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
  12079. * 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.
  12080. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  12081. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  12082. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  12083. */
  12084. static CreatePolyhedron(name: string, options: {
  12085. type?: number;
  12086. size?: number;
  12087. sizeX?: number;
  12088. sizeY?: number;
  12089. sizeZ?: number;
  12090. custom?: any;
  12091. faceUV?: Vector4[];
  12092. faceColors?: Color4[];
  12093. flat?: boolean;
  12094. updatable?: boolean;
  12095. sideOrientation?: number;
  12096. }, scene: Scene): Mesh;
  12097. /**
  12098. * Creates a decal mesh.
  12099. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#decals
  12100. * 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.
  12101. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  12102. * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates.
  12103. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  12104. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  12105. */
  12106. static CreateDecal(name: string, sourceMesh: AbstractMesh, options: {
  12107. position?: Vector3;
  12108. normal?: Vector3;
  12109. size?: Vector3;
  12110. angle?: number;
  12111. }): Mesh;
  12112. private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance, invertUV);
  12113. }
  12114. }
  12115. declare module BABYLON.Internals {
  12116. class MeshLODLevel {
  12117. distance: number;
  12118. mesh: Mesh;
  12119. constructor(distance: number, mesh: Mesh);
  12120. }
  12121. }
  12122. declare module BABYLON {
  12123. /**
  12124. * A simplifier interface for future simplification implementations.
  12125. */
  12126. interface ISimplifier {
  12127. /**
  12128. * Simplification of a given mesh according to the given settings.
  12129. * Since this requires computation, it is assumed that the function runs async.
  12130. * @param settings The settings of the simplification, including quality and distance
  12131. * @param successCallback A callback that will be called after the mesh was simplified.
  12132. * @param errorCallback in case of an error, this callback will be called. optional.
  12133. */
  12134. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void;
  12135. }
  12136. /**
  12137. * Expected simplification settings.
  12138. * Quality should be between 0 and 1 (1 being 100%, 0 being 0%);
  12139. */
  12140. interface ISimplificationSettings {
  12141. quality: number;
  12142. distance: number;
  12143. optimizeMesh?: boolean;
  12144. }
  12145. class SimplificationSettings implements ISimplificationSettings {
  12146. quality: number;
  12147. distance: number;
  12148. optimizeMesh: boolean;
  12149. constructor(quality: number, distance: number, optimizeMesh?: boolean);
  12150. }
  12151. interface ISimplificationTask {
  12152. settings: Array<ISimplificationSettings>;
  12153. simplificationType: SimplificationType;
  12154. mesh: Mesh;
  12155. successCallback?: () => void;
  12156. parallelProcessing: boolean;
  12157. }
  12158. class SimplificationQueue {
  12159. private _simplificationArray;
  12160. running: any;
  12161. constructor();
  12162. addTask(task: ISimplificationTask): void;
  12163. executeNext(): void;
  12164. runSimplification(task: ISimplificationTask): void;
  12165. private getSimplifier(task);
  12166. }
  12167. /**
  12168. * The implemented types of simplification.
  12169. * At the moment only Quadratic Error Decimation is implemented.
  12170. */
  12171. enum SimplificationType {
  12172. QUADRATIC = 0,
  12173. }
  12174. class DecimationTriangle {
  12175. vertices: Array<DecimationVertex>;
  12176. normal: Vector3;
  12177. error: Array<number>;
  12178. deleted: boolean;
  12179. isDirty: boolean;
  12180. borderFactor: number;
  12181. deletePending: boolean;
  12182. originalOffset: number;
  12183. constructor(vertices: Array<DecimationVertex>);
  12184. }
  12185. class DecimationVertex {
  12186. position: Vector3;
  12187. id: any;
  12188. q: QuadraticMatrix;
  12189. isBorder: boolean;
  12190. triangleStart: number;
  12191. triangleCount: number;
  12192. originalOffsets: Array<number>;
  12193. constructor(position: Vector3, id: any);
  12194. updatePosition(newPosition: Vector3): void;
  12195. }
  12196. class QuadraticMatrix {
  12197. data: Array<number>;
  12198. constructor(data?: Array<number>);
  12199. det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number;
  12200. addInPlace(matrix: QuadraticMatrix): void;
  12201. addArrayInPlace(data: Array<number>): void;
  12202. add(matrix: QuadraticMatrix): QuadraticMatrix;
  12203. static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix;
  12204. static DataFromNumbers(a: number, b: number, c: number, d: number): number[];
  12205. }
  12206. class Reference {
  12207. vertexId: number;
  12208. triangleId: number;
  12209. constructor(vertexId: number, triangleId: number);
  12210. }
  12211. /**
  12212. * An implementation of the Quadratic Error simplification algorithm.
  12213. * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf
  12214. * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS
  12215. * @author RaananW
  12216. */
  12217. class QuadraticErrorSimplification implements ISimplifier {
  12218. private _mesh;
  12219. private triangles;
  12220. private vertices;
  12221. private references;
  12222. private initialized;
  12223. private _reconstructedMesh;
  12224. syncIterations: number;
  12225. aggressiveness: number;
  12226. decimationIterations: number;
  12227. boundingBoxEpsilon: number;
  12228. constructor(_mesh: Mesh);
  12229. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void;
  12230. private isTriangleOnBoundingBox(triangle);
  12231. private runDecimation(settings, submeshIndex, successCallback);
  12232. private initWithMesh(submeshIndex, callback, optimizeMesh?);
  12233. private init(callback);
  12234. private reconstructMesh(submeshIndex);
  12235. private initDecimatedMesh();
  12236. private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr);
  12237. private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles);
  12238. private identifyBorder();
  12239. private updateMesh(identifyBorders?);
  12240. private vertexError(q, point);
  12241. private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?);
  12242. }
  12243. }
  12244. declare module BABYLON {
  12245. class Polygon {
  12246. static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[];
  12247. static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[];
  12248. static Parse(input: string): Vector2[];
  12249. static StartingAt(x: number, y: number): Path2;
  12250. }
  12251. class PolygonMeshBuilder {
  12252. private _points;
  12253. private _outlinepoints;
  12254. private _holes;
  12255. private _name;
  12256. private _scene;
  12257. private _epoints;
  12258. private _eholes;
  12259. private _addToepoint(points);
  12260. constructor(name: string, contours: Path2, scene: Scene);
  12261. constructor(name: string, contours: Vector2[], scene: Scene);
  12262. addHole(hole: Vector2[]): PolygonMeshBuilder;
  12263. build(updatable?: boolean, depth?: number): Mesh;
  12264. private addSide(positions, normals, uvs, indices, bounds, points, depth, flip);
  12265. }
  12266. }
  12267. declare module BABYLON {
  12268. class SubMesh implements ICullable {
  12269. materialIndex: number;
  12270. verticesStart: number;
  12271. verticesCount: number;
  12272. indexStart: any;
  12273. indexCount: number;
  12274. linesIndexCount: number;
  12275. private _mesh;
  12276. private _renderingMesh;
  12277. private _boundingInfo;
  12278. private _linesIndexBuffer;
  12279. _lastColliderWorldVertices: Vector3[];
  12280. _trianglePlanes: Plane[];
  12281. _lastColliderTransformMatrix: Matrix;
  12282. _renderId: number;
  12283. _alphaIndex: number;
  12284. _distanceToCamera: number;
  12285. _id: number;
  12286. _materialDefines: MaterialDefines;
  12287. _materialEffect: Effect;
  12288. private _currentMaterial;
  12289. readonly effect: Effect;
  12290. setEffect(effect: Effect, defines?: MaterialDefines): void;
  12291. constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
  12292. readonly IsGlobal: boolean;
  12293. /**
  12294. * Returns the submesh BoudingInfo object.
  12295. */
  12296. getBoundingInfo(): BoundingInfo;
  12297. /**
  12298. * Sets the submesh BoundingInfo.
  12299. * Return the SubMesh.
  12300. */
  12301. setBoundingInfo(boundingInfo: BoundingInfo): SubMesh;
  12302. /**
  12303. * Returns the mesh of the current submesh.
  12304. */
  12305. getMesh(): AbstractMesh;
  12306. /**
  12307. * Returns the rendering mesh of the submesh.
  12308. */
  12309. getRenderingMesh(): Mesh;
  12310. /**
  12311. * Returns the submesh material.
  12312. */
  12313. getMaterial(): Material;
  12314. /**
  12315. * Sets a new updated BoundingInfo object to the submesh.
  12316. * Returns the SubMesh.
  12317. */
  12318. refreshBoundingInfo(): SubMesh;
  12319. _checkCollision(collider: Collider): boolean;
  12320. /**
  12321. * Updates the submesh BoundingInfo.
  12322. * Returns the Submesh.
  12323. */
  12324. updateBoundingInfo(world: Matrix): SubMesh;
  12325. /**
  12326. * True is the submesh bounding box intersects the frustum defined by the passed array of planes.
  12327. * Boolean returned.
  12328. */
  12329. isInFrustum(frustumPlanes: Plane[]): boolean;
  12330. /**
  12331. * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes.
  12332. * Boolean returned.
  12333. */
  12334. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  12335. /**
  12336. * Renders the submesh.
  12337. * Returns it.
  12338. */
  12339. render(enableAlphaMode: boolean): SubMesh;
  12340. /**
  12341. * Returns a new Index Buffer.
  12342. * Type returned : WebGLBuffer.
  12343. */
  12344. getLinesIndexBuffer(indices: IndicesArray, engine: Engine): WebGLBuffer;
  12345. /**
  12346. * True is the passed Ray intersects the submesh bounding box.
  12347. * Boolean returned.
  12348. */
  12349. canIntersects(ray: Ray): boolean;
  12350. /**
  12351. * Returns an object IntersectionInfo.
  12352. */
  12353. intersects(ray: Ray, positions: Vector3[], indices: IndicesArray, fastCheck?: boolean): IntersectionInfo;
  12354. /**
  12355. * Creates a new Submesh from the passed Mesh.
  12356. */
  12357. clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
  12358. /**
  12359. * Disposes the Submesh.
  12360. * Returns nothing.
  12361. */
  12362. dispose(): void;
  12363. /**
  12364. * Creates a new Submesh from the passed parameters :
  12365. * - materialIndex (integer) : the index of the main mesh material.
  12366. * - startIndex (integer) : the index where to start the copy in the mesh indices array.
  12367. * - indexCount (integer) : the number of indices to copy then from the startIndex.
  12368. * - mesh (Mesh) : the main mesh to create the submesh from.
  12369. * - renderingMesh (optional Mesh) : rendering mesh.
  12370. */
  12371. static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
  12372. }
  12373. }
  12374. declare module BABYLON {
  12375. class VertexBuffer {
  12376. private _buffer;
  12377. private _kind;
  12378. private _offset;
  12379. private _size;
  12380. private _stride;
  12381. private _ownsBuffer;
  12382. constructor(engine: any, data: number[] | Float32Array | Buffer, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number, instanced?: boolean, offset?: number, size?: number);
  12383. /**
  12384. * Returns the kind of the VertexBuffer (string).
  12385. */
  12386. getKind(): string;
  12387. /**
  12388. * Boolean : is the VertexBuffer updatable ?
  12389. */
  12390. isUpdatable(): boolean;
  12391. /**
  12392. * Returns an array of numbers or a Float32Array containing the VertexBuffer data.
  12393. */
  12394. getData(): number[] | Float32Array;
  12395. /**
  12396. * Returns the WebGLBuffer associated to the VertexBuffer.
  12397. */
  12398. getBuffer(): WebGLBuffer;
  12399. /**
  12400. * Returns the stride of the VertexBuffer (integer).
  12401. */
  12402. getStrideSize(): number;
  12403. /**
  12404. * Returns the offset (integer).
  12405. */
  12406. getOffset(): number;
  12407. /**
  12408. * Returns the VertexBuffer total size (integer).
  12409. */
  12410. getSize(): number;
  12411. /**
  12412. * Boolean : is the WebGLBuffer of the VertexBuffer instanced now ?
  12413. */
  12414. getIsInstanced(): boolean;
  12415. /**
  12416. * Creates the underlying WebGLBuffer from the passed numeric array or Float32Array.
  12417. * Returns the created WebGLBuffer.
  12418. */
  12419. create(data?: number[] | Float32Array): void;
  12420. /**
  12421. * Updates the underlying WebGLBuffer according to the passed numeric array or Float32Array.
  12422. * Returns the updated WebGLBuffer.
  12423. */
  12424. update(data: number[] | Float32Array): void;
  12425. /**
  12426. * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.
  12427. * Returns the directly updated WebGLBuffer.
  12428. */
  12429. updateDirectly(data: Float32Array, offset: number): void;
  12430. /**
  12431. * Disposes the VertexBuffer and the underlying WebGLBuffer.
  12432. */
  12433. dispose(): void;
  12434. private static _PositionKind;
  12435. private static _NormalKind;
  12436. private static _TangentKind;
  12437. private static _UVKind;
  12438. private static _UV2Kind;
  12439. private static _UV3Kind;
  12440. private static _UV4Kind;
  12441. private static _UV5Kind;
  12442. private static _UV6Kind;
  12443. private static _ColorKind;
  12444. private static _MatricesIndicesKind;
  12445. private static _MatricesWeightsKind;
  12446. private static _MatricesIndicesExtraKind;
  12447. private static _MatricesWeightsExtraKind;
  12448. static readonly PositionKind: string;
  12449. static readonly NormalKind: string;
  12450. static readonly TangentKind: string;
  12451. static readonly UVKind: string;
  12452. static readonly UV2Kind: string;
  12453. static readonly UV3Kind: string;
  12454. static readonly UV4Kind: string;
  12455. static readonly UV5Kind: string;
  12456. static readonly UV6Kind: string;
  12457. static readonly ColorKind: string;
  12458. static readonly MatricesIndicesKind: string;
  12459. static readonly MatricesWeightsKind: string;
  12460. static readonly MatricesIndicesExtraKind: string;
  12461. static readonly MatricesWeightsExtraKind: string;
  12462. }
  12463. }
  12464. declare module BABYLON {
  12465. class MorphTarget {
  12466. name: string;
  12467. animations: Animation[];
  12468. private _positions;
  12469. private _normals;
  12470. private _tangents;
  12471. private _influence;
  12472. onInfluenceChanged: Observable<boolean>;
  12473. influence: number;
  12474. constructor(name: string, influence?: number);
  12475. readonly hasNormals: boolean;
  12476. readonly hasTangents: boolean;
  12477. setPositions(data: Float32Array | number[]): void;
  12478. getPositions(): Float32Array;
  12479. setNormals(data: Float32Array | number[]): void;
  12480. getNormals(): Float32Array;
  12481. setTangents(data: Float32Array | number[]): void;
  12482. getTangents(): Float32Array;
  12483. /**
  12484. * Serializes the current target into a Serialization object.
  12485. * Returns the serialized object.
  12486. */
  12487. serialize(): any;
  12488. static Parse(serializationObject: any): MorphTarget;
  12489. static FromMesh(mesh: AbstractMesh, name?: string, influence?: number): MorphTarget;
  12490. }
  12491. }
  12492. declare module BABYLON {
  12493. class MorphTargetManager {
  12494. private _targets;
  12495. private _targetObservable;
  12496. private _activeTargets;
  12497. private _scene;
  12498. private _influences;
  12499. private _supportsNormals;
  12500. private _supportsTangents;
  12501. private _vertexCount;
  12502. private _uniqueId;
  12503. constructor(scene?: Scene);
  12504. readonly uniqueId: number;
  12505. readonly vertexCount: number;
  12506. readonly supportsNormals: boolean;
  12507. readonly supportsTangents: boolean;
  12508. readonly numTargets: number;
  12509. readonly numInfluencers: number;
  12510. readonly influences: Float32Array;
  12511. getActiveTarget(index: number): MorphTarget;
  12512. getTarget(index: number): MorphTarget;
  12513. addTarget(target: MorphTarget): void;
  12514. removeTarget(target: MorphTarget): void;
  12515. /**
  12516. * Serializes the current manager into a Serialization object.
  12517. * Returns the serialized object.
  12518. */
  12519. serialize(): any;
  12520. private _onInfluenceChanged(needUpdate);
  12521. private _syncActiveTargets(needUpdate);
  12522. static Parse(serializationObject: any, scene: Scene): MorphTargetManager;
  12523. }
  12524. }
  12525. declare module BABYLON {
  12526. class Particle {
  12527. position: Vector3;
  12528. direction: Vector3;
  12529. color: Color4;
  12530. colorStep: Color4;
  12531. lifeTime: number;
  12532. age: number;
  12533. size: number;
  12534. angle: number;
  12535. angularSpeed: number;
  12536. copyTo(other: Particle): void;
  12537. }
  12538. }
  12539. declare module BABYLON {
  12540. class ParticleSystem implements IDisposable, IAnimatable {
  12541. name: string;
  12542. static BLENDMODE_ONEONE: number;
  12543. static BLENDMODE_STANDARD: number;
  12544. animations: Animation[];
  12545. id: string;
  12546. renderingGroupId: number;
  12547. emitter: any;
  12548. emitRate: number;
  12549. manualEmitCount: number;
  12550. updateSpeed: number;
  12551. targetStopDuration: number;
  12552. disposeOnStop: boolean;
  12553. minEmitPower: number;
  12554. maxEmitPower: number;
  12555. minLifeTime: number;
  12556. maxLifeTime: number;
  12557. minSize: number;
  12558. maxSize: number;
  12559. minAngularSpeed: number;
  12560. maxAngularSpeed: number;
  12561. particleTexture: Texture;
  12562. layerMask: number;
  12563. customShader: any;
  12564. preventAutoStart: boolean;
  12565. /**
  12566. * An event triggered when the system is disposed.
  12567. * @type {BABYLON.Observable}
  12568. */
  12569. onDisposeObservable: Observable<ParticleSystem>;
  12570. private _onDisposeObserver;
  12571. onDispose: () => void;
  12572. updateFunction: (particles: Particle[]) => void;
  12573. blendMode: number;
  12574. forceDepthWrite: boolean;
  12575. gravity: Vector3;
  12576. direction1: Vector3;
  12577. direction2: Vector3;
  12578. minEmitBox: Vector3;
  12579. maxEmitBox: Vector3;
  12580. color1: Color4;
  12581. color2: Color4;
  12582. colorDead: Color4;
  12583. textureMask: Color4;
  12584. startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle) => void;
  12585. startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle) => void;
  12586. private particles;
  12587. private _capacity;
  12588. private _scene;
  12589. private _stockParticles;
  12590. private _newPartsExcess;
  12591. private _vertexData;
  12592. private _vertexBuffer;
  12593. private _vertexBuffers;
  12594. private _indexBuffer;
  12595. private _effect;
  12596. private _customEffect;
  12597. private _cachedDefines;
  12598. private _scaledColorStep;
  12599. private _colorDiff;
  12600. private _scaledDirection;
  12601. private _scaledGravity;
  12602. private _currentRenderId;
  12603. private _alive;
  12604. private _started;
  12605. private _stopped;
  12606. private _actualFrame;
  12607. private _scaledUpdateSpeed;
  12608. constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
  12609. recycleParticle(particle: Particle): void;
  12610. getCapacity(): number;
  12611. isAlive(): boolean;
  12612. isStarted(): boolean;
  12613. start(): void;
  12614. stop(): void;
  12615. _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void;
  12616. private _update(newParticles);
  12617. private _getEffect();
  12618. animate(): void;
  12619. render(): number;
  12620. dispose(): void;
  12621. clone(name: string, newEmitter: any): ParticleSystem;
  12622. serialize(): any;
  12623. static Parse(parsedParticleSystem: any, scene: Scene, rootUrl: string): ParticleSystem;
  12624. }
  12625. }
  12626. declare module BABYLON {
  12627. class SolidParticle {
  12628. idx: number;
  12629. color: Color4;
  12630. position: Vector3;
  12631. rotation: Vector3;
  12632. rotationQuaternion: Quaternion;
  12633. scaling: Vector3;
  12634. uvs: Vector4;
  12635. velocity: Vector3;
  12636. alive: boolean;
  12637. isVisible: boolean;
  12638. _pos: number;
  12639. _model: ModelShape;
  12640. shapeId: number;
  12641. idxInShape: number;
  12642. _modelBoundingInfo: BoundingInfo;
  12643. _boundingInfo: BoundingInfo;
  12644. _sps: SolidParticleSystem;
  12645. /**
  12646. * Creates a Solid Particle object.
  12647. * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()
  12648. * `particleIndex` (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier.
  12649. * `positionIndex` (integer) is the starting index of the particle vertices in the SPS "positions" array.
  12650. * `model` (ModelShape) is a reference to the model shape on what the particle is designed.
  12651. * `shapeId` (integer) is the model shape identifier in the SPS.
  12652. * `idxInShape` (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))
  12653. * `modelBoundingInfo` is the reference to the model BoundingInfo used for intersection computations.
  12654. */
  12655. constructor(particleIndex: number, positionIndex: number, model: ModelShape, shapeId: number, idxInShape: number, sps: SolidParticleSystem, modelBoundingInfo?: BoundingInfo);
  12656. /**
  12657. * legacy support, changed scale to scaling
  12658. */
  12659. scale: Vector3;
  12660. /**
  12661. * legacy support, changed quaternion to rotationQuaternion
  12662. */
  12663. quaternion: Quaternion;
  12664. /**
  12665. * Returns a boolean. True if the particle intersects another particle or another mesh, else false.
  12666. * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)
  12667. * `target` is the object (solid particle or mesh) what the intersection is computed against.
  12668. */
  12669. intersectsMesh(target: Mesh | SolidParticle): boolean;
  12670. }
  12671. class ModelShape {
  12672. shapeID: number;
  12673. _shape: Vector3[];
  12674. _shapeUV: number[];
  12675. _positionFunction: (particle: SolidParticle, i: number, s: number) => void;
  12676. _vertexFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void;
  12677. /**
  12678. * 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.
  12679. * SPS internal tool, don't use it manually.
  12680. */
  12681. constructor(id: number, shape: Vector3[], shapeUV: number[], posFunction: (particle: SolidParticle, i: number, s: number) => void, vtxFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void);
  12682. }
  12683. }
  12684. declare module BABYLON {
  12685. /**
  12686. * Full documentation here : http://doc.babylonjs.com/overviews/Solid_Particle_System
  12687. */
  12688. class SolidParticleSystem implements IDisposable {
  12689. /**
  12690. * The SPS array of Solid Particle objects. Just access each particle as with any classic array.
  12691. * Example : var p = SPS.particles[i];
  12692. */
  12693. particles: SolidParticle[];
  12694. /**
  12695. * The SPS total number of particles. Read only. Use SPS.counter instead if you need to set your own value.
  12696. */
  12697. nbParticles: number;
  12698. /**
  12699. * If the particles must ever face the camera (default false). Useful for planar particles.
  12700. */
  12701. billboard: boolean;
  12702. /**
  12703. * Recompute normals when adding a shape
  12704. */
  12705. recomputeNormals: boolean;
  12706. /**
  12707. * This a counter ofr your own usage. It's not set by any SPS functions.
  12708. */
  12709. counter: number;
  12710. /**
  12711. * The SPS name. This name is also given to the underlying mesh.
  12712. */
  12713. name: string;
  12714. /**
  12715. * The SPS mesh. It's a standard BJS Mesh, so all the methods from the Mesh class are avalaible.
  12716. */
  12717. mesh: Mesh;
  12718. /**
  12719. * This empty object is intended to store some SPS specific or temporary values in order to lower the Garbage Collector activity.
  12720. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#garbage-collector-concerns
  12721. */
  12722. vars: any;
  12723. /**
  12724. * This array is populated when the SPS is set as 'pickable'.
  12725. * Each key of this array is a `faceId` value that you can get from a pickResult object.
  12726. * Each element of this array is an object `{idx: int, faceId: int}`.
  12727. * `idx` is the picked particle index in the `SPS.particles` array
  12728. * `faceId` is the picked face index counted within this particle.
  12729. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#pickable-particles
  12730. */
  12731. pickedParticles: {
  12732. idx: number;
  12733. faceId: number;
  12734. }[];
  12735. private _scene;
  12736. private _positions;
  12737. private _indices;
  12738. private _normals;
  12739. private _colors;
  12740. private _uvs;
  12741. private _positions32;
  12742. private _normals32;
  12743. private _fixedNormal32;
  12744. private _colors32;
  12745. private _uvs32;
  12746. private _index;
  12747. private _updatable;
  12748. private _pickable;
  12749. private _isVisibilityBoxLocked;
  12750. private _alwaysVisible;
  12751. private _shapeCounter;
  12752. private _copy;
  12753. private _shape;
  12754. private _shapeUV;
  12755. private _color;
  12756. private _computeParticleColor;
  12757. private _computeParticleTexture;
  12758. private _computeParticleRotation;
  12759. private _computeParticleVertex;
  12760. private _computeBoundingBox;
  12761. private _cam_axisZ;
  12762. private _cam_axisY;
  12763. private _cam_axisX;
  12764. private _axisX;
  12765. private _axisY;
  12766. private _axisZ;
  12767. private _camera;
  12768. private _particle;
  12769. private _camDir;
  12770. private _rotMatrix;
  12771. private _invertMatrix;
  12772. private _rotated;
  12773. private _quaternion;
  12774. private _vertex;
  12775. private _normal;
  12776. private _yaw;
  12777. private _pitch;
  12778. private _roll;
  12779. private _halfroll;
  12780. private _halfpitch;
  12781. private _halfyaw;
  12782. private _sinRoll;
  12783. private _cosRoll;
  12784. private _sinPitch;
  12785. private _cosPitch;
  12786. private _sinYaw;
  12787. private _cosYaw;
  12788. private _w;
  12789. private _mustUnrotateFixedNormals;
  12790. private _minimum;
  12791. private _maximum;
  12792. private _scale;
  12793. private _translation;
  12794. private _minBbox;
  12795. private _maxBbox;
  12796. private _particlesIntersect;
  12797. _bSphereOnly: boolean;
  12798. _bSphereRadiusFactor: number;
  12799. /**
  12800. * Creates a SPS (Solid Particle System) object.
  12801. * `name` (String) is the SPS name, this will be the underlying mesh name.
  12802. * `scene` (Scene) is the scene in which the SPS is added.
  12803. * `updatable` (optional boolean, default true) : if the SPS must be updatable or immutable.
  12804. * `isPickable` (optional boolean, default false) : if the solid particles must be pickable.
  12805. * `particleIntersection` (optional boolean, default false) : if the solid particle intersections must be computed.
  12806. * `boundingSphereOnly` (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
  12807. * `bSphereRadiusFactor` (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
  12808. * Example : bSphereRadiusFactor = 1.0 / Math.sqrt(3.0) => the bounding sphere exactly matches a spherical mesh.
  12809. */
  12810. constructor(name: string, scene: Scene, options?: {
  12811. updatable?: boolean;
  12812. isPickable?: boolean;
  12813. particleIntersection?: boolean;
  12814. boundingSphereOnly?: boolean;
  12815. bSphereRadiusFactor?: number;
  12816. });
  12817. /**
  12818. * Builds the SPS underlying mesh. Returns a standard Mesh.
  12819. * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.
  12820. */
  12821. buildMesh(): Mesh;
  12822. /**
  12823. * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
  12824. * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
  12825. * Thus the particles generated from `digest()` have their property `position` set yet.
  12826. * `mesh` ( Mesh ) is the mesh to be digested
  12827. * `facetNb` (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any
  12828. * `delta` (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
  12829. * `number` (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets
  12830. */
  12831. digest(mesh: Mesh, options?: {
  12832. facetNb?: number;
  12833. number?: number;
  12834. delta?: number;
  12835. }): SolidParticleSystem;
  12836. private _unrotateFixedNormals();
  12837. private _resetCopy();
  12838. private _meshBuilder(p, shape, positions, meshInd, indices, meshUV, uvs, meshCol, colors, meshNor, normals, idx, idxInShape, options);
  12839. private _posToShape(positions);
  12840. private _uvsToShapeUV(uvs);
  12841. private _addParticle(idx, idxpos, model, shapeId, idxInShape, bInfo?);
  12842. /**
  12843. * Adds some particles to the SPS from the model shape. Returns the shape id.
  12844. * Please read the doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#create-an-immutable-sps
  12845. * `mesh` is any Mesh object that will be used as a model for the solid particles.
  12846. * `nb` (positive integer) the number of particles to be created from this model
  12847. * `positionFunction` is an optional javascript function to called for each particle on SPS creation.
  12848. * `vertexFunction` is an optional javascript function to called for each vertex of each particle on SPS creation
  12849. */
  12850. addShape(mesh: Mesh, nb: number, options?: {
  12851. positionFunction?: any;
  12852. vertexFunction?: any;
  12853. }): number;
  12854. private _rebuildParticle(particle);
  12855. /**
  12856. * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
  12857. * Returns the SPS.
  12858. */
  12859. rebuildMesh(): SolidParticleSystem;
  12860. /**
  12861. * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.
  12862. * This method calls `updateParticle()` for each particle of the SPS.
  12863. * For an animated SPS, it is usually called within the render loop.
  12864. * @param start The particle index in the particle array where to start to compute the particle property values _(default 0)_
  12865. * @param end The particle index in the particle array where to stop to compute the particle property values _(default nbParticle - 1)_
  12866. * @param update If the mesh must be finally updated on this call after all the particle computations _(default true)_
  12867. * Returns the SPS.
  12868. */
  12869. setParticles(start?: number, end?: number, update?: boolean): SolidParticleSystem;
  12870. private _quaternionRotationYPR();
  12871. private _quaternionToRotationMatrix();
  12872. /**
  12873. * Disposes the SPS.
  12874. * Returns nothing.
  12875. */
  12876. dispose(): void;
  12877. /**
  12878. * Visibilty helper : Recomputes the visible size according to the mesh bounding box
  12879. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  12880. * Returns the SPS.
  12881. */
  12882. refreshVisibleSize(): SolidParticleSystem;
  12883. /**
  12884. * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.
  12885. * @param size the size (float) of the visibility box
  12886. * note : this doesn't lock the SPS mesh bounding box.
  12887. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  12888. */
  12889. setVisibilityBox(size: number): void;
  12890. /**
  12891. * Sets the SPS as always visible or not
  12892. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  12893. */
  12894. isAlwaysVisible: boolean;
  12895. /**
  12896. * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.
  12897. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  12898. */
  12899. isVisibilityBoxLocked: boolean;
  12900. /**
  12901. * Tells to `setParticles()` to compute the particle rotations or not.
  12902. * Default value : true. The SPS is faster when it's set to false.
  12903. * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.
  12904. */
  12905. computeParticleRotation: boolean;
  12906. /**
  12907. * Tells to `setParticles()` to compute the particle colors or not.
  12908. * Default value : true. The SPS is faster when it's set to false.
  12909. * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.
  12910. */
  12911. computeParticleColor: boolean;
  12912. /**
  12913. * Tells to `setParticles()` to compute the particle textures or not.
  12914. * Default value : true. The SPS is faster when it's set to false.
  12915. * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.
  12916. */
  12917. computeParticleTexture: boolean;
  12918. /**
  12919. * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.
  12920. * Default value : false. The SPS is faster when it's set to false.
  12921. * Note : the particle custom vertex positions aren't stored values.
  12922. */
  12923. computeParticleVertex: boolean;
  12924. /**
  12925. * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.
  12926. */
  12927. computeBoundingBox: boolean;
  12928. /**
  12929. * This function does nothing. It may be overwritten to set all the particle first values.
  12930. * The SPS doesn't call this function, you may have to call it by your own.
  12931. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  12932. */
  12933. initParticles(): void;
  12934. /**
  12935. * This function does nothing. It may be overwritten to recycle a particle.
  12936. * The SPS doesn't call this function, you may have to call it by your own.
  12937. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  12938. */
  12939. recycleParticle(particle: SolidParticle): SolidParticle;
  12940. /**
  12941. * Updates a particle : this function should be overwritten by the user.
  12942. * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.
  12943. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  12944. * ex : just set a particle position or velocity and recycle conditions
  12945. */
  12946. updateParticle(particle: SolidParticle): SolidParticle;
  12947. /**
  12948. * Updates a vertex of a particle : it can be overwritten by the user.
  12949. * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.
  12950. * @param particle the current particle
  12951. * @param vertex the current index of the current particle
  12952. * @param pt the index of the current vertex in the particle shape
  12953. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#update-each-particle-shape
  12954. * ex : just set a vertex particle position
  12955. */
  12956. updateParticleVertex(particle: SolidParticle, vertex: Vector3, pt: number): Vector3;
  12957. /**
  12958. * This will be called before any other treatment by `setParticles()` and will be passed three parameters.
  12959. * This does nothing and may be overwritten by the user.
  12960. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  12961. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  12962. * @param update the boolean update value actually passed to setParticles()
  12963. */
  12964. beforeUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  12965. /**
  12966. * This will be called by `setParticles()` after all the other treatments and just before the actual mesh update.
  12967. * This will be passed three parameters.
  12968. * This does nothing and may be overwritten by the user.
  12969. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  12970. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  12971. * @param update the boolean update value actually passed to setParticles()
  12972. */
  12973. afterUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  12974. }
  12975. }
  12976. declare module BABYLON {
  12977. interface PhysicsImpostorJoint {
  12978. mainImpostor: PhysicsImpostor;
  12979. connectedImpostor: PhysicsImpostor;
  12980. joint: PhysicsJoint;
  12981. }
  12982. class PhysicsEngine {
  12983. private _physicsPlugin;
  12984. gravity: Vector3;
  12985. constructor(gravity?: Vector3, _physicsPlugin?: IPhysicsEnginePlugin);
  12986. setGravity(gravity: Vector3): void;
  12987. /**
  12988. * Set the time step of the physics engine.
  12989. * default is 1/60.
  12990. * To slow it down, enter 1/600 for example.
  12991. * To speed it up, 1/30
  12992. * @param {number} newTimeStep the new timestep to apply to this world.
  12993. */
  12994. setTimeStep(newTimeStep?: number): void;
  12995. dispose(): void;
  12996. getPhysicsPluginName(): string;
  12997. static Epsilon: number;
  12998. private _impostors;
  12999. private _joints;
  13000. /**
  13001. * Adding a new impostor for the impostor tracking.
  13002. * This will be done by the impostor itself.
  13003. * @param {PhysicsImpostor} impostor the impostor to add
  13004. */
  13005. addImpostor(impostor: PhysicsImpostor): void;
  13006. /**
  13007. * Remove an impostor from the engine.
  13008. * This impostor and its mesh will not longer be updated by the physics engine.
  13009. * @param {PhysicsImpostor} impostor the impostor to remove
  13010. */
  13011. removeImpostor(impostor: PhysicsImpostor): void;
  13012. /**
  13013. * Add a joint to the physics engine
  13014. * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
  13015. * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
  13016. * @param {PhysicsJoint} the joint that will connect both impostors.
  13017. */
  13018. addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  13019. removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  13020. /**
  13021. * Called by the scene. no need to call it.
  13022. */
  13023. _step(delta: number): void;
  13024. getPhysicsPlugin(): IPhysicsEnginePlugin;
  13025. getImpostorForPhysicsObject(object: IPhysicsEnabledObject): PhysicsImpostor;
  13026. getImpostorWithPhysicsBody(body: any): PhysicsImpostor;
  13027. }
  13028. interface IPhysicsEnginePlugin {
  13029. world: any;
  13030. name: string;
  13031. setGravity(gravity: Vector3): any;
  13032. setTimeStep(timeStep: number): any;
  13033. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  13034. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  13035. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  13036. generatePhysicsBody(impostor: PhysicsImpostor): any;
  13037. removePhysicsBody(impostor: PhysicsImpostor): any;
  13038. generateJoint(joint: PhysicsImpostorJoint): any;
  13039. removeJoint(joint: PhysicsImpostorJoint): any;
  13040. isSupported(): boolean;
  13041. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): any;
  13042. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): any;
  13043. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  13044. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  13045. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  13046. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  13047. setBodyMass(impostor: PhysicsImpostor, mass: number): any;
  13048. sleepBody(impostor: PhysicsImpostor): any;
  13049. wakeUpBody(impostor: PhysicsImpostor): any;
  13050. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): any;
  13051. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): any;
  13052. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  13053. dispose(): any;
  13054. }
  13055. }
  13056. declare module BABYLON {
  13057. interface PhysicsImpostorParameters {
  13058. mass: number;
  13059. friction?: number;
  13060. restitution?: number;
  13061. nativeOptions?: any;
  13062. }
  13063. interface IPhysicsEnabledObject {
  13064. position: Vector3;
  13065. rotationQuaternion: Quaternion;
  13066. scaling: Vector3;
  13067. rotation?: Vector3;
  13068. parent?: any;
  13069. getBoundingInfo?(): BoundingInfo;
  13070. computeWorldMatrix?(force: boolean): void;
  13071. getWorldMatrix?(): Matrix;
  13072. getChildMeshes?(): Array<AbstractMesh>;
  13073. getVerticesData?(kind: string): Array<number> | Float32Array;
  13074. getIndices?(): IndicesArray;
  13075. getScene?(): Scene;
  13076. }
  13077. class PhysicsImpostor {
  13078. object: IPhysicsEnabledObject;
  13079. type: number;
  13080. private _options;
  13081. private _scene;
  13082. static DEFAULT_OBJECT_SIZE: Vector3;
  13083. static IDENTITY_QUATERNION: Quaternion;
  13084. private _physicsEngine;
  13085. private _physicsBody;
  13086. private _bodyUpdateRequired;
  13087. private _onBeforePhysicsStepCallbacks;
  13088. private _onAfterPhysicsStepCallbacks;
  13089. private _onPhysicsCollideCallbacks;
  13090. private _deltaPosition;
  13091. private _deltaRotation;
  13092. private _deltaRotationConjugated;
  13093. private _parent;
  13094. uniqueId: number;
  13095. private _joints;
  13096. constructor(object: IPhysicsEnabledObject, type: number, _options?: PhysicsImpostorParameters, _scene?: Scene);
  13097. /**
  13098. * This function will completly initialize this impostor.
  13099. * It will create a new body - but only if this mesh has no parent.
  13100. * If it has, this impostor will not be used other than to define the impostor
  13101. * of the child mesh.
  13102. */
  13103. _init(): void;
  13104. private _getPhysicsParent();
  13105. /**
  13106. * Should a new body be generated.
  13107. */
  13108. isBodyInitRequired(): boolean;
  13109. setScalingUpdated(updated: boolean): void;
  13110. /**
  13111. * Force a regeneration of this or the parent's impostor's body.
  13112. * Use under cautious - This will remove all joints already implemented.
  13113. */
  13114. forceUpdate(): void;
  13115. /**
  13116. * Gets the body that holds this impostor. Either its own, or its parent.
  13117. */
  13118. /**
  13119. * Set the physics body. Used mainly by the physics engine/plugin
  13120. */
  13121. physicsBody: any;
  13122. parent: PhysicsImpostor;
  13123. resetUpdateFlags(): void;
  13124. getObjectExtendSize(): Vector3;
  13125. getObjectCenter(): Vector3;
  13126. /**
  13127. * Get a specific parametes from the options parameter.
  13128. */
  13129. getParam(paramName: string): any;
  13130. /**
  13131. * Sets a specific parameter in the options given to the physics plugin
  13132. */
  13133. setParam(paramName: string, value: number): void;
  13134. /**
  13135. * Specifically change the body's mass option. Won't recreate the physics body object
  13136. */
  13137. setMass(mass: number): void;
  13138. getLinearVelocity(): Vector3;
  13139. setLinearVelocity(velocity: Vector3): void;
  13140. getAngularVelocity(): Vector3;
  13141. setAngularVelocity(velocity: Vector3): void;
  13142. /**
  13143. * Execute a function with the physics plugin native code.
  13144. * Provide a function the will have two variables - the world object and the physics body object.
  13145. */
  13146. executeNativeFunction(func: (world: any, physicsBody: any) => void): void;
  13147. /**
  13148. * Register a function that will be executed before the physics world is stepping forward.
  13149. */
  13150. registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  13151. unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  13152. /**
  13153. * Register a function that will be executed after the physics step
  13154. */
  13155. registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  13156. unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  13157. /**
  13158. * register a function that will be executed when this impostor collides against a different body.
  13159. */
  13160. registerOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor) => void): void;
  13161. unregisterOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>) => void): void;
  13162. private _tmpPositionWithDelta;
  13163. private _tmpRotationWithDelta;
  13164. /**
  13165. * this function is executed by the physics engine.
  13166. */
  13167. beforeStep: () => void;
  13168. /**
  13169. * this function is executed by the physics engine.
  13170. */
  13171. afterStep: () => void;
  13172. /**
  13173. * Legacy collision detection event support
  13174. */
  13175. onCollideEvent: (collider: BABYLON.PhysicsImpostor, collidedWith: BABYLON.PhysicsImpostor) => void;
  13176. onCollide: (e: {
  13177. body: any;
  13178. }) => void;
  13179. /**
  13180. * Apply a force
  13181. */
  13182. applyForce(force: Vector3, contactPoint: Vector3): void;
  13183. /**
  13184. * Apply an impulse
  13185. */
  13186. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  13187. /**
  13188. * A help function to create a joint.
  13189. */
  13190. createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): void;
  13191. /**
  13192. * Add a joint to this impostor with a different impostor.
  13193. */
  13194. addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  13195. /**
  13196. * Will keep this body still, in a sleep mode.
  13197. */
  13198. sleep(): void;
  13199. /**
  13200. * Wake the body up.
  13201. */
  13202. wakeUp(): void;
  13203. clone(newObject: IPhysicsEnabledObject): PhysicsImpostor;
  13204. dispose(): void;
  13205. setDeltaPosition(position: Vector3): void;
  13206. setDeltaRotation(rotation: Quaternion): void;
  13207. static NoImpostor: number;
  13208. static SphereImpostor: number;
  13209. static BoxImpostor: number;
  13210. static PlaneImpostor: number;
  13211. static MeshImpostor: number;
  13212. static CylinderImpostor: number;
  13213. static ParticleImpostor: number;
  13214. static HeightmapImpostor: number;
  13215. }
  13216. }
  13217. declare module BABYLON {
  13218. interface PhysicsJointData {
  13219. mainPivot?: Vector3;
  13220. connectedPivot?: Vector3;
  13221. mainAxis?: Vector3;
  13222. connectedAxis?: Vector3;
  13223. collision?: boolean;
  13224. nativeParams?: any;
  13225. }
  13226. /**
  13227. * This is a holder class for the physics joint created by the physics plugin.
  13228. * It holds a set of functions to control the underlying joint.
  13229. */
  13230. class PhysicsJoint {
  13231. type: number;
  13232. jointData: PhysicsJointData;
  13233. private _physicsJoint;
  13234. protected _physicsPlugin: IPhysicsEnginePlugin;
  13235. constructor(type: number, jointData: PhysicsJointData);
  13236. physicsJoint: any;
  13237. physicsPlugin: IPhysicsEnginePlugin;
  13238. /**
  13239. * Execute a function that is physics-plugin specific.
  13240. * @param {Function} func the function that will be executed.
  13241. * It accepts two parameters: the physics world and the physics joint.
  13242. */
  13243. executeNativeFunction(func: (world: any, physicsJoint: any) => void): void;
  13244. static DistanceJoint: number;
  13245. static HingeJoint: number;
  13246. static BallAndSocketJoint: number;
  13247. static WheelJoint: number;
  13248. static SliderJoint: number;
  13249. static PrismaticJoint: number;
  13250. static UniversalJoint: number;
  13251. static Hinge2Joint: number;
  13252. static PointToPointJoint: number;
  13253. static SpringJoint: number;
  13254. static LockJoint: number;
  13255. }
  13256. /**
  13257. * A class representing a physics distance joint.
  13258. */
  13259. class DistanceJoint extends PhysicsJoint {
  13260. constructor(jointData: DistanceJointData);
  13261. /**
  13262. * Update the predefined distance.
  13263. */
  13264. updateDistance(maxDistance: number, minDistance?: number): void;
  13265. }
  13266. class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {
  13267. constructor(type: number, jointData: PhysicsJointData);
  13268. /**
  13269. * Set the motor values.
  13270. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13271. * @param {number} force the force to apply
  13272. * @param {number} maxForce max force for this motor.
  13273. */
  13274. setMotor(force?: number, maxForce?: number): void;
  13275. /**
  13276. * Set the motor's limits.
  13277. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13278. */
  13279. setLimit(upperLimit: number, lowerLimit?: number): void;
  13280. }
  13281. /**
  13282. * This class represents a single hinge physics joint
  13283. */
  13284. class HingeJoint extends MotorEnabledJoint {
  13285. constructor(jointData: PhysicsJointData);
  13286. /**
  13287. * Set the motor values.
  13288. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13289. * @param {number} force the force to apply
  13290. * @param {number} maxForce max force for this motor.
  13291. */
  13292. setMotor(force?: number, maxForce?: number): void;
  13293. /**
  13294. * Set the motor's limits.
  13295. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13296. */
  13297. setLimit(upperLimit: number, lowerLimit?: number): void;
  13298. }
  13299. /**
  13300. * This class represents a dual hinge physics joint (same as wheel joint)
  13301. */
  13302. class Hinge2Joint extends MotorEnabledJoint {
  13303. constructor(jointData: PhysicsJointData);
  13304. /**
  13305. * Set the motor values.
  13306. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13307. * @param {number} force the force to apply
  13308. * @param {number} maxForce max force for this motor.
  13309. * @param {motorIndex} the motor's index, 0 or 1.
  13310. */
  13311. setMotor(force?: number, maxForce?: number, motorIndex?: number): void;
  13312. /**
  13313. * Set the motor limits.
  13314. * Attention, this function is plugin specific. Engines won't react 100% the same.
  13315. * @param {number} upperLimit the upper limit
  13316. * @param {number} lowerLimit lower limit
  13317. * @param {motorIndex} the motor's index, 0 or 1.
  13318. */
  13319. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  13320. }
  13321. interface IMotorEnabledJoint {
  13322. physicsJoint: any;
  13323. setMotor(force?: number, maxForce?: number, motorIndex?: number): any;
  13324. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  13325. }
  13326. interface DistanceJointData extends PhysicsJointData {
  13327. maxDistance: number;
  13328. }
  13329. interface SpringJointData extends PhysicsJointData {
  13330. length: number;
  13331. stiffness: number;
  13332. damping: number;
  13333. }
  13334. }
  13335. declare module BABYLON {
  13336. class AnaglyphPostProcess extends PostProcess {
  13337. private _passedProcess;
  13338. constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
  13339. }
  13340. }
  13341. declare module BABYLON {
  13342. class BlackAndWhitePostProcess extends PostProcess {
  13343. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13344. }
  13345. }
  13346. declare module BABYLON {
  13347. class BlurPostProcess extends PostProcess {
  13348. direction: Vector2;
  13349. blurWidth: number;
  13350. constructor(name: string, direction: Vector2, blurWidth: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13351. }
  13352. }
  13353. declare module BABYLON {
  13354. class ColorCorrectionPostProcess extends PostProcess {
  13355. private _colorTableTexture;
  13356. constructor(name: string, colorTableUrl: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13357. }
  13358. }
  13359. declare module BABYLON {
  13360. class ConvolutionPostProcess extends PostProcess {
  13361. kernel: number[];
  13362. constructor(name: string, kernel: number[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13363. static EdgeDetect0Kernel: number[];
  13364. static EdgeDetect1Kernel: number[];
  13365. static EdgeDetect2Kernel: number[];
  13366. static SharpenKernel: number[];
  13367. static EmbossKernel: number[];
  13368. static GaussianKernel: number[];
  13369. }
  13370. }
  13371. declare module BABYLON {
  13372. class DisplayPassPostProcess extends PostProcess {
  13373. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13374. }
  13375. }
  13376. declare module BABYLON {
  13377. class FilterPostProcess extends PostProcess {
  13378. kernelMatrix: Matrix;
  13379. constructor(name: string, kernelMatrix: Matrix, options: number | PostProcessOptions, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13380. }
  13381. }
  13382. declare module BABYLON {
  13383. class FxaaPostProcess extends PostProcess {
  13384. texelWidth: number;
  13385. texelHeight: number;
  13386. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13387. }
  13388. }
  13389. declare module BABYLON {
  13390. class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable {
  13391. /**
  13392. * Public members
  13393. */
  13394. /**
  13395. * Gaussian blur coefficient
  13396. * @type {number}
  13397. */
  13398. gaussCoeff: number;
  13399. /**
  13400. * Gaussian blur mean
  13401. * @type {number}
  13402. */
  13403. gaussMean: number;
  13404. /**
  13405. * Gaussian blur standard deviation
  13406. * @type {number}
  13407. */
  13408. gaussStandDev: number;
  13409. /**
  13410. * Gaussian blur multiplier. Multiplies the blur effect
  13411. * @type {number}
  13412. */
  13413. gaussMultiplier: number;
  13414. /**
  13415. * Exposure, controls the overall intensity of the pipeline
  13416. * @type {number}
  13417. */
  13418. exposure: number;
  13419. /**
  13420. * Minimum luminance that the post-process can output. Luminance is >= 0
  13421. * @type {number}
  13422. */
  13423. minimumLuminance: number;
  13424. /**
  13425. * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance
  13426. * @type {number}
  13427. */
  13428. maximumLuminance: number;
  13429. /**
  13430. * Increase rate for luminance: eye adaptation speed to dark
  13431. * @type {number}
  13432. */
  13433. luminanceIncreaserate: number;
  13434. /**
  13435. * Decrease rate for luminance: eye adaptation speed to bright
  13436. * @type {number}
  13437. */
  13438. luminanceDecreaseRate: number;
  13439. /**
  13440. * Minimum luminance needed to compute HDR
  13441. * @type {number}
  13442. */
  13443. brightThreshold: number;
  13444. /**
  13445. * Private members
  13446. */
  13447. private _guassianBlurHPostProcess;
  13448. private _guassianBlurVPostProcess;
  13449. private _brightPassPostProcess;
  13450. private _textureAdderPostProcess;
  13451. private _downSampleX4PostProcess;
  13452. private _originalPostProcess;
  13453. private _hdrPostProcess;
  13454. private _hdrCurrentLuminance;
  13455. private _hdrOutputLuminance;
  13456. static LUM_STEPS: number;
  13457. private _downSamplePostProcesses;
  13458. private _scene;
  13459. private _needUpdate;
  13460. /**
  13461. * @constructor
  13462. * @param {string} name - The rendering pipeline name
  13463. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  13464. * @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)
  13465. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  13466. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  13467. */
  13468. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  13469. /**
  13470. * Tells the pipeline to update its post-processes
  13471. */
  13472. update(): void;
  13473. /**
  13474. * Returns the current calculated luminance
  13475. */
  13476. getCurrentLuminance(): number;
  13477. /**
  13478. * Returns the currently drawn luminance
  13479. */
  13480. getOutputLuminance(): number;
  13481. /**
  13482. * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras
  13483. */
  13484. dispose(): void;
  13485. /**
  13486. * Creates the HDR post-process and computes the luminance adaptation
  13487. */
  13488. private _createHDRPostProcess(scene, ratio);
  13489. /**
  13490. * Texture Adder post-process
  13491. */
  13492. private _createTextureAdderPostProcess(scene, ratio);
  13493. /**
  13494. * Down sample X4 post-process
  13495. */
  13496. private _createDownSampleX4PostProcess(scene, ratio);
  13497. /**
  13498. * Bright pass post-process
  13499. */
  13500. private _createBrightPassPostProcess(scene, ratio);
  13501. /**
  13502. * Luminance generator. Creates the luminance post-process and down sample post-processes
  13503. */
  13504. private _createLuminanceGeneratorPostProcess(scene);
  13505. /**
  13506. * Gaussian blur post-processes. Horizontal and Vertical
  13507. */
  13508. private _createGaussianBlurPostProcess(scene, ratio);
  13509. }
  13510. }
  13511. declare module BABYLON {
  13512. class LensRenderingPipeline extends PostProcessRenderPipeline {
  13513. /**
  13514. * The chromatic aberration PostProcess id in the pipeline
  13515. * @type {string}
  13516. */
  13517. LensChromaticAberrationEffect: string;
  13518. /**
  13519. * The highlights enhancing PostProcess id in the pipeline
  13520. * @type {string}
  13521. */
  13522. HighlightsEnhancingEffect: string;
  13523. /**
  13524. * The depth-of-field PostProcess id in the pipeline
  13525. * @type {string}
  13526. */
  13527. LensDepthOfFieldEffect: string;
  13528. private _scene;
  13529. private _depthTexture;
  13530. private _grainTexture;
  13531. private _chromaticAberrationPostProcess;
  13532. private _highlightsPostProcess;
  13533. private _depthOfFieldPostProcess;
  13534. private _edgeBlur;
  13535. private _grainAmount;
  13536. private _chromaticAberration;
  13537. private _distortion;
  13538. private _highlightsGain;
  13539. private _highlightsThreshold;
  13540. private _dofDistance;
  13541. private _dofAperture;
  13542. private _dofDarken;
  13543. private _dofPentagon;
  13544. private _blurNoise;
  13545. /**
  13546. * @constructor
  13547. *
  13548. * Effect parameters are as follow:
  13549. * {
  13550. * chromatic_aberration: number; // from 0 to x (1 for realism)
  13551. * edge_blur: number; // from 0 to x (1 for realism)
  13552. * distortion: number; // from 0 to x (1 for realism)
  13553. * grain_amount: number; // from 0 to 1
  13554. * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise
  13555. * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)
  13556. * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)
  13557. * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)
  13558. * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect
  13559. * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)
  13560. * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)
  13561. * blur_noise: boolean; // add a little bit of noise to the blur (default: true)
  13562. * }
  13563. * Note: if an effect parameter is unset, effect is disabled
  13564. *
  13565. * @param {string} name - The rendering pipeline name
  13566. * @param {object} parameters - An object containing all parameters (see above)
  13567. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  13568. * @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)
  13569. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  13570. */
  13571. constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]);
  13572. setEdgeBlur(amount: number): void;
  13573. disableEdgeBlur(): void;
  13574. setGrainAmount(amount: number): void;
  13575. disableGrain(): void;
  13576. setChromaticAberration(amount: number): void;
  13577. disableChromaticAberration(): void;
  13578. setEdgeDistortion(amount: number): void;
  13579. disableEdgeDistortion(): void;
  13580. setFocusDistance(amount: number): void;
  13581. disableDepthOfField(): void;
  13582. setAperture(amount: number): void;
  13583. setDarkenOutOfFocus(amount: number): void;
  13584. enablePentagonBokeh(): void;
  13585. disablePentagonBokeh(): void;
  13586. enableNoiseBlur(): void;
  13587. disableNoiseBlur(): void;
  13588. setHighlightsGain(amount: number): void;
  13589. setHighlightsThreshold(amount: number): void;
  13590. disableHighlights(): void;
  13591. /**
  13592. * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
  13593. */
  13594. dispose(disableDepthRender?: boolean): void;
  13595. private _createChromaticAberrationPostProcess(ratio);
  13596. private _createHighlightsPostProcess(ratio);
  13597. private _createDepthOfFieldPostProcess(ratio);
  13598. private _createGrainTexture();
  13599. }
  13600. }
  13601. declare module BABYLON {
  13602. class PassPostProcess extends PostProcess {
  13603. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
  13604. }
  13605. }
  13606. declare module BABYLON {
  13607. type PostProcessOptions = {
  13608. width: number;
  13609. height: number;
  13610. };
  13611. class PostProcess {
  13612. name: string;
  13613. width: number;
  13614. height: number;
  13615. renderTargetSamplingMode: number;
  13616. clearColor: Color4;
  13617. enablePixelPerfectMode: boolean;
  13618. samples: number;
  13619. private _camera;
  13620. private _scene;
  13621. private _engine;
  13622. private _options;
  13623. private _reusable;
  13624. private _textureType;
  13625. _textures: SmartArray<WebGLTexture>;
  13626. _currentRenderTextureInd: number;
  13627. private _effect;
  13628. private _samplers;
  13629. private _fragmentUrl;
  13630. private _vertexUrl;
  13631. private _parameters;
  13632. private _scaleRatio;
  13633. /**
  13634. * An event triggered when the postprocess is activated.
  13635. * @type {BABYLON.Observable}
  13636. */
  13637. onActivateObservable: Observable<Camera>;
  13638. private _onActivateObserver;
  13639. onActivate: (camera: Camera) => void;
  13640. /**
  13641. * An event triggered when the postprocess changes its size.
  13642. * @type {BABYLON.Observable}
  13643. */
  13644. onSizeChangedObservable: Observable<PostProcess>;
  13645. private _onSizeChangedObserver;
  13646. onSizeChanged: (postProcess: PostProcess) => void;
  13647. /**
  13648. * An event triggered when the postprocess applies its effect.
  13649. * @type {BABYLON.Observable}
  13650. */
  13651. onApplyObservable: Observable<Effect>;
  13652. private _onApplyObserver;
  13653. onApply: (effect: Effect) => void;
  13654. /**
  13655. * An event triggered before rendering the postprocess
  13656. * @type {BABYLON.Observable}
  13657. */
  13658. onBeforeRenderObservable: Observable<Effect>;
  13659. private _onBeforeRenderObserver;
  13660. onBeforeRender: (effect: Effect) => void;
  13661. /**
  13662. * An event triggered after rendering the postprocess
  13663. * @type {BABYLON.Observable}
  13664. */
  13665. onAfterRenderObservable: Observable<Effect>;
  13666. private _onAfterRenderObserver;
  13667. onAfterRender: (efect: Effect) => void;
  13668. 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);
  13669. updateEffect(defines?: string): void;
  13670. isReusable(): boolean;
  13671. /** invalidate frameBuffer to hint the postprocess to create a depth buffer */
  13672. markTextureDirty(): void;
  13673. activate(camera: Camera, sourceTexture?: WebGLTexture): void;
  13674. readonly isSupported: boolean;
  13675. apply(): Effect;
  13676. dispose(camera?: Camera): void;
  13677. }
  13678. }
  13679. declare module BABYLON {
  13680. class PostProcessManager {
  13681. private _scene;
  13682. private _indexBuffer;
  13683. private _vertexBuffers;
  13684. constructor(scene: Scene);
  13685. private _prepareBuffers();
  13686. _prepareFrame(sourceTexture?: WebGLTexture): boolean;
  13687. directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void;
  13688. _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture, faceIndex?: number, postProcesses?: PostProcess[]): void;
  13689. dispose(): void;
  13690. }
  13691. }
  13692. declare module BABYLON {
  13693. class RefractionPostProcess extends PostProcess {
  13694. color: Color3;
  13695. depth: number;
  13696. colorLevel: number;
  13697. private _refRexture;
  13698. constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13699. dispose(camera: Camera): void;
  13700. }
  13701. }
  13702. declare module BABYLON {
  13703. class SSAORenderingPipeline extends PostProcessRenderPipeline {
  13704. /**
  13705. * The PassPostProcess id in the pipeline that contains the original scene color
  13706. * @type {string}
  13707. */
  13708. SSAOOriginalSceneColorEffect: string;
  13709. /**
  13710. * The SSAO PostProcess id in the pipeline
  13711. * @type {string}
  13712. */
  13713. SSAORenderEffect: string;
  13714. /**
  13715. * The horizontal blur PostProcess id in the pipeline
  13716. * @type {string}
  13717. */
  13718. SSAOBlurHRenderEffect: string;
  13719. /**
  13720. * The vertical blur PostProcess id in the pipeline
  13721. * @type {string}
  13722. */
  13723. SSAOBlurVRenderEffect: string;
  13724. /**
  13725. * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
  13726. * @type {string}
  13727. */
  13728. SSAOCombineRenderEffect: string;
  13729. /**
  13730. * The output strength of the SSAO post-process. Default value is 1.0.
  13731. * @type {number}
  13732. */
  13733. totalStrength: number;
  13734. /**
  13735. * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006
  13736. * @type {number}
  13737. */
  13738. radius: number;
  13739. /**
  13740. * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel
  13741. * Must not be equal to fallOff and superior to fallOff.
  13742. * Default value is 0.975
  13743. * @type {number}
  13744. */
  13745. area: number;
  13746. /**
  13747. * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel
  13748. * Must not be equal to area and inferior to area.
  13749. * Default value is 0.0
  13750. * @type {number}
  13751. */
  13752. fallOff: number;
  13753. /**
  13754. * The base color of the SSAO post-process
  13755. * The final result is "base + ssao" between [0, 1]
  13756. * @type {number}
  13757. */
  13758. base: number;
  13759. private _scene;
  13760. private _depthTexture;
  13761. private _randomTexture;
  13762. private _originalColorPostProcess;
  13763. private _ssaoPostProcess;
  13764. private _blurHPostProcess;
  13765. private _blurVPostProcess;
  13766. private _ssaoCombinePostProcess;
  13767. private _firstUpdate;
  13768. private _ratio;
  13769. /**
  13770. * @constructor
  13771. * @param {string} name - The rendering pipeline name
  13772. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  13773. * @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 }
  13774. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  13775. */
  13776. constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
  13777. /**
  13778. * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
  13779. */
  13780. dispose(disableDepthRender?: boolean): void;
  13781. private _createBlurPostProcess(ratio);
  13782. private _createSSAOPostProcess(ratio);
  13783. private _createSSAOCombinePostProcess(ratio);
  13784. private _createRandomTexture();
  13785. }
  13786. }
  13787. declare module BABYLON {
  13788. class StandardRenderingPipeline extends PostProcessRenderPipeline implements IDisposable, IAnimatable {
  13789. /**
  13790. * Public members
  13791. */
  13792. originalPostProcess: PostProcess;
  13793. downSampleX4PostProcess: PostProcess;
  13794. brightPassPostProcess: PostProcess;
  13795. gaussianBlurHPostProcesses: PostProcess[];
  13796. gaussianBlurVPostProcesses: PostProcess[];
  13797. textureAdderPostProcess: PostProcess;
  13798. luminancePostProcess: PostProcess;
  13799. luminanceDownSamplePostProcesses: PostProcess[];
  13800. hdrPostProcess: PostProcess;
  13801. textureAdderFinalPostProcess: PostProcess;
  13802. lensFlareFinalPostProcess: PostProcess;
  13803. hdrFinalPostProcess: PostProcess;
  13804. lensFlarePostProcess: PostProcess;
  13805. lensFlareComposePostProcess: PostProcess;
  13806. motionBlurPostProcess: PostProcess;
  13807. depthOfFieldPostProcess: PostProcess;
  13808. brightThreshold: number;
  13809. blurWidth: number;
  13810. horizontalBlur: boolean;
  13811. gaussianCoefficient: number;
  13812. gaussianMean: number;
  13813. gaussianStandardDeviation: number;
  13814. exposure: number;
  13815. lensTexture: Texture;
  13816. hdrMinimumLuminance: number;
  13817. hdrDecreaseRate: number;
  13818. hdrIncreaseRate: number;
  13819. lensColorTexture: Texture;
  13820. lensFlareStrength: number;
  13821. lensFlareGhostDispersal: number;
  13822. lensFlareHaloWidth: number;
  13823. lensFlareDistortionStrength: number;
  13824. lensStarTexture: Texture;
  13825. lensFlareDirtTexture: Texture;
  13826. depthOfFieldDistance: number;
  13827. depthOfFieldBlurWidth: number;
  13828. motionStrength: number;
  13829. animations: Animation[];
  13830. /**
  13831. * Private members
  13832. */
  13833. private _scene;
  13834. private _depthRenderer;
  13835. private _currentDepthOfFieldSource;
  13836. private _currentHDRSource;
  13837. private _hdrCurrentLuminance;
  13838. private _motionBlurSamples;
  13839. private _depthOfFieldEnabled;
  13840. private _lensFlareEnabled;
  13841. private _hdrEnabled;
  13842. private _motionBlurEnabled;
  13843. DepthOfFieldEnabled: boolean;
  13844. LensFlareEnabled: boolean;
  13845. HDREnabled: boolean;
  13846. MotionBlurEnabled: boolean;
  13847. motionBlurSamples: number;
  13848. /**
  13849. * @constructor
  13850. * @param {string} name - The rendering pipeline name
  13851. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  13852. * @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)
  13853. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  13854. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  13855. */
  13856. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  13857. private _createDownSampleX4PostProcess(scene, ratio);
  13858. private _createBrightPassPostProcess(scene, ratio);
  13859. private _createGaussianBlurPostProcesses(scene, ratio, indice, blurWidthKey?);
  13860. private _createTextureAdderPostProcess(scene, ratio);
  13861. private _createLuminancePostProcesses(scene, textureType);
  13862. private _createHdrPostProcess(scene, ratio);
  13863. private _createLensFlarePostProcess(scene, ratio);
  13864. private _createDepthOfFieldPostProcess(scene, ratio);
  13865. private _createMotionBlurPostProcess(scene, ratio);
  13866. dispose(): void;
  13867. serialize(): any;
  13868. static Parse(source: any, scene: Scene, rootUrl: string): StandardRenderingPipeline;
  13869. static LuminanceSteps: number;
  13870. }
  13871. }
  13872. declare module BABYLON {
  13873. class StereoscopicInterlacePostProcess extends PostProcess {
  13874. private _stepSize;
  13875. private _passedProcess;
  13876. constructor(name: string, rigCameras: Camera[], isStereoscopicHoriz: boolean, samplingMode?: number, engine?: Engine, reusable?: boolean);
  13877. }
  13878. }
  13879. declare module BABYLON {
  13880. enum TonemappingOperator {
  13881. Hable = 0,
  13882. Reinhard = 1,
  13883. HejiDawson = 2,
  13884. Photographic = 3,
  13885. }
  13886. class TonemapPostProcess extends PostProcess {
  13887. private _operator;
  13888. exposureAdjustment: number;
  13889. constructor(name: string, _operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number);
  13890. }
  13891. }
  13892. declare module BABYLON {
  13893. class VolumetricLightScatteringPostProcess extends PostProcess {
  13894. private _volumetricLightScatteringPass;
  13895. private _volumetricLightScatteringRTT;
  13896. private _viewPort;
  13897. private _screenCoordinates;
  13898. private _cachedDefines;
  13899. /**
  13900. * If not undefined, the mesh position is computed from the attached node position
  13901. * @type {{position: Vector3}}
  13902. */
  13903. attachedNode: {
  13904. position: Vector3;
  13905. };
  13906. /**
  13907. * Custom position of the mesh. Used if "useCustomMeshPosition" is set to "true"
  13908. * @type {Vector3}
  13909. */
  13910. customMeshPosition: Vector3;
  13911. /**
  13912. * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)
  13913. * @type {boolean}
  13914. */
  13915. useCustomMeshPosition: boolean;
  13916. /**
  13917. * If the post-process should inverse the light scattering direction
  13918. * @type {boolean}
  13919. */
  13920. invert: boolean;
  13921. /**
  13922. * The internal mesh used by the post-process
  13923. * @type {boolean}
  13924. */
  13925. mesh: Mesh;
  13926. useDiffuseColor: boolean;
  13927. /**
  13928. * Array containing the excluded meshes not rendered in the internal pass
  13929. */
  13930. excludedMeshes: AbstractMesh[];
  13931. /**
  13932. * Controls the overall intensity of the post-process
  13933. * @type {number}
  13934. */
  13935. exposure: number;
  13936. /**
  13937. * Dissipates each sample's contribution in range [0, 1]
  13938. * @type {number}
  13939. */
  13940. decay: number;
  13941. /**
  13942. * Controls the overall intensity of each sample
  13943. * @type {number}
  13944. */
  13945. weight: number;
  13946. /**
  13947. * Controls the density of each sample
  13948. * @type {number}
  13949. */
  13950. density: number;
  13951. /**
  13952. * @constructor
  13953. * @param {string} name - The post-process name
  13954. * @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)
  13955. * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to
  13956. * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering
  13957. * @param {number} samples - The post-process quality, default 100
  13958. * @param {number} samplingMode - The post-process filtering mode
  13959. * @param {BABYLON.Engine} engine - The babylon engine
  13960. * @param {boolean} reusable - If the post-process is reusable
  13961. * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided
  13962. */
  13963. constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene);
  13964. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  13965. /**
  13966. * Sets the new light position for light scattering effect
  13967. * @param {BABYLON.Vector3} The new custom light position
  13968. */
  13969. setCustomMeshPosition(position: Vector3): void;
  13970. /**
  13971. * Returns the light position for light scattering effect
  13972. * @return {BABYLON.Vector3} The custom light position
  13973. */
  13974. getCustomMeshPosition(): Vector3;
  13975. /**
  13976. * Disposes the internal assets and detaches the post-process from the camera
  13977. */
  13978. dispose(camera: Camera): void;
  13979. /**
  13980. * Returns the render target texture used by the post-process
  13981. * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process
  13982. */
  13983. getPass(): RenderTargetTexture;
  13984. private _meshExcluded(mesh);
  13985. private _createPass(scene, ratio);
  13986. private _updateMeshScreenCoordinates(scene);
  13987. /**
  13988. * Creates a default mesh for the Volumeric Light Scattering post-process
  13989. * @param {string} The mesh name
  13990. * @param {BABYLON.Scene} The scene where to create the mesh
  13991. * @return {BABYLON.Mesh} the default mesh
  13992. */
  13993. static CreateDefaultMesh(name: string, scene: Scene): Mesh;
  13994. }
  13995. }
  13996. declare module BABYLON {
  13997. class VRDistortionCorrectionPostProcess extends PostProcess {
  13998. aspectRatio: number;
  13999. private _isRightEye;
  14000. private _distortionFactors;
  14001. private _postProcessScaleFactor;
  14002. private _lensCenterOffset;
  14003. private _scaleIn;
  14004. private _scaleFactor;
  14005. private _lensCenter;
  14006. constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics);
  14007. }
  14008. }
  14009. declare module BABYLON {
  14010. class ReflectionProbe {
  14011. name: string;
  14012. private _scene;
  14013. private _renderTargetTexture;
  14014. private _projectionMatrix;
  14015. private _viewMatrix;
  14016. private _target;
  14017. private _add;
  14018. private _attachedMesh;
  14019. invertYAxis: boolean;
  14020. position: Vector3;
  14021. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  14022. samples: number;
  14023. refreshRate: number;
  14024. getScene(): Scene;
  14025. readonly cubeTexture: RenderTargetTexture;
  14026. readonly renderList: AbstractMesh[];
  14027. attachToMesh(mesh: AbstractMesh): void;
  14028. dispose(): void;
  14029. }
  14030. }
  14031. declare module BABYLON {
  14032. class BoundingBoxRenderer {
  14033. frontColor: Color3;
  14034. backColor: Color3;
  14035. showBackLines: boolean;
  14036. renderList: SmartArray<BoundingBox>;
  14037. private _scene;
  14038. private _colorShader;
  14039. private _vertexBuffers;
  14040. private _indexBuffer;
  14041. constructor(scene: Scene);
  14042. private _prepareRessources();
  14043. reset(): void;
  14044. render(): void;
  14045. dispose(): void;
  14046. }
  14047. }
  14048. declare module BABYLON {
  14049. class DepthRenderer {
  14050. private _scene;
  14051. private _depthMap;
  14052. private _effect;
  14053. private _viewMatrix;
  14054. private _projectionMatrix;
  14055. private _transformMatrix;
  14056. private _worldViewProjection;
  14057. private _cachedDefines;
  14058. constructor(scene: Scene, type?: number);
  14059. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  14060. getDepthMap(): RenderTargetTexture;
  14061. dispose(): void;
  14062. }
  14063. }
  14064. declare module BABYLON {
  14065. class EdgesRenderer {
  14066. edgesWidthScalerForOrthographic: number;
  14067. edgesWidthScalerForPerspective: number;
  14068. private _source;
  14069. private _linesPositions;
  14070. private _linesNormals;
  14071. private _linesIndices;
  14072. private _epsilon;
  14073. private _indicesCount;
  14074. private _lineShader;
  14075. private _ib;
  14076. private _buffers;
  14077. private _checkVerticesInsteadOfIndices;
  14078. constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean);
  14079. private _prepareRessources();
  14080. dispose(): void;
  14081. private _processEdgeForAdjacencies(pa, pb, p0, p1, p2);
  14082. private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2);
  14083. private _checkEdge(faceIndex, edge, faceNormals, p0, p1);
  14084. _generateEdgesLines(): void;
  14085. render(): void;
  14086. }
  14087. }
  14088. declare module BABYLON {
  14089. class OutlineRenderer {
  14090. private _scene;
  14091. private _effect;
  14092. private _cachedDefines;
  14093. constructor(scene: Scene);
  14094. render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void;
  14095. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  14096. }
  14097. }
  14098. declare module BABYLON {
  14099. class RenderingGroup {
  14100. index: number;
  14101. private _scene;
  14102. private _opaqueSubMeshes;
  14103. private _transparentSubMeshes;
  14104. private _alphaTestSubMeshes;
  14105. private _particleSystems;
  14106. private _spriteManagers;
  14107. private _activeVertices;
  14108. private _opaqueSortCompareFn;
  14109. private _alphaTestSortCompareFn;
  14110. private _transparentSortCompareFn;
  14111. private _renderOpaque;
  14112. private _renderAlphaTest;
  14113. private _renderTransparent;
  14114. onBeforeTransparentRendering: () => void;
  14115. /**
  14116. * Set the opaque sort comparison function.
  14117. * If null the sub meshes will be render in the order they were created
  14118. */
  14119. opaqueSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  14120. /**
  14121. * Set the alpha test sort comparison function.
  14122. * If null the sub meshes will be render in the order they were created
  14123. */
  14124. alphaTestSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  14125. /**
  14126. * Set the transparent sort comparison function.
  14127. * If null the sub meshes will be render in the order they were created
  14128. */
  14129. transparentSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  14130. /**
  14131. * Creates a new rendering group.
  14132. * @param index The rendering group index
  14133. * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied
  14134. * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied
  14135. * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied
  14136. */
  14137. constructor(index: number, scene: Scene, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number);
  14138. /**
  14139. * Render all the sub meshes contained in the group.
  14140. * @param customRenderFunction Used to override the default render behaviour of the group.
  14141. * @returns true if rendered some submeshes.
  14142. */
  14143. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void, renderSprites: boolean, renderParticles: boolean, activeMeshes: AbstractMesh[]): void;
  14144. /**
  14145. * Renders the opaque submeshes in the order from the opaqueSortCompareFn.
  14146. * @param subMeshes The submeshes to render
  14147. */
  14148. private renderOpaqueSorted(subMeshes);
  14149. /**
  14150. * Renders the opaque submeshes in the order from the alphatestSortCompareFn.
  14151. * @param subMeshes The submeshes to render
  14152. */
  14153. private renderAlphaTestSorted(subMeshes);
  14154. /**
  14155. * Renders the opaque submeshes in the order from the transparentSortCompareFn.
  14156. * @param subMeshes The submeshes to render
  14157. */
  14158. private renderTransparentSorted(subMeshes);
  14159. /**
  14160. * Renders the submeshes in a specified order.
  14161. * @param subMeshes The submeshes to sort before render
  14162. * @param sortCompareFn The comparison function use to sort
  14163. * @param cameraPosition The camera position use to preprocess the submeshes to help sorting
  14164. * @param transparent Specifies to activate blending if true
  14165. */
  14166. private static renderSorted(subMeshes, sortCompareFn, cameraPosition, transparent);
  14167. /**
  14168. * Renders the submeshes in the order they were dispatched (no sort applied).
  14169. * @param subMeshes The submeshes to render
  14170. */
  14171. private static renderUnsorted(subMeshes);
  14172. /**
  14173. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  14174. * are rendered back to front if in the same alpha index.
  14175. *
  14176. * @param a The first submesh
  14177. * @param b The second submesh
  14178. * @returns The result of the comparison
  14179. */
  14180. static defaultTransparentSortCompare(a: SubMesh, b: SubMesh): number;
  14181. /**
  14182. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  14183. * are rendered back to front.
  14184. *
  14185. * @param a The first submesh
  14186. * @param b The second submesh
  14187. * @returns The result of the comparison
  14188. */
  14189. static backToFrontSortCompare(a: SubMesh, b: SubMesh): number;
  14190. /**
  14191. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  14192. * are rendered front to back (prevent overdraw).
  14193. *
  14194. * @param a The first submesh
  14195. * @param b The second submesh
  14196. * @returns The result of the comparison
  14197. */
  14198. static frontToBackSortCompare(a: SubMesh, b: SubMesh): number;
  14199. /**
  14200. * Resets the different lists of submeshes to prepare a new frame.
  14201. */
  14202. prepare(): void;
  14203. dispose(): void;
  14204. /**
  14205. * Inserts the submesh in its correct queue depending on its material.
  14206. * @param subMesh The submesh to dispatch
  14207. */
  14208. dispatch(subMesh: SubMesh): void;
  14209. dispatchSprites(spriteManager: SpriteManager): void;
  14210. dispatchParticles(particleSystem: ParticleSystem): void;
  14211. private _renderParticles(activeMeshes);
  14212. private _renderSprites();
  14213. }
  14214. }
  14215. declare module BABYLON {
  14216. class RenderingManager {
  14217. /**
  14218. * The max id used for rendering groups (not included)
  14219. */
  14220. static MAX_RENDERINGGROUPS: number;
  14221. /**
  14222. * The min id used for rendering groups (included)
  14223. */
  14224. static MIN_RENDERINGGROUPS: number;
  14225. /**
  14226. * Used to globally prevent autoclearing scenes.
  14227. */
  14228. static AUTOCLEAR: boolean;
  14229. private _scene;
  14230. private _renderingGroups;
  14231. private _depthStencilBufferAlreadyCleaned;
  14232. private _currentIndex;
  14233. private _autoClearDepthStencil;
  14234. private _customOpaqueSortCompareFn;
  14235. private _customAlphaTestSortCompareFn;
  14236. private _customTransparentSortCompareFn;
  14237. private _renderinGroupInfo;
  14238. constructor(scene: Scene);
  14239. private _clearDepthStencilBuffer(depth?, stencil?);
  14240. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void;
  14241. reset(): void;
  14242. dispose(): void;
  14243. private _prepareRenderingGroup(renderingGroupId);
  14244. dispatchSprites(spriteManager: SpriteManager): void;
  14245. dispatchParticles(particleSystem: ParticleSystem): void;
  14246. dispatch(subMesh: SubMesh): void;
  14247. /**
  14248. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  14249. * This allowed control for front to back rendering or reversly depending of the special needs.
  14250. *
  14251. * @param renderingGroupId The rendering group id corresponding to its index
  14252. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  14253. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  14254. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  14255. */
  14256. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  14257. /**
  14258. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  14259. *
  14260. * @param renderingGroupId The rendering group id corresponding to its index
  14261. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  14262. * @param depth Automatically clears depth between groups if true and autoClear is true.
  14263. * @param stencil Automatically clears stencil between groups if true and autoClear is true.
  14264. */
  14265. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth?: boolean, stencil?: boolean): void;
  14266. }
  14267. }
  14268. declare module BABYLON {
  14269. class Sprite {
  14270. name: string;
  14271. position: Vector3;
  14272. color: Color4;
  14273. width: number;
  14274. height: number;
  14275. angle: number;
  14276. cellIndex: number;
  14277. invertU: number;
  14278. invertV: number;
  14279. disposeWhenFinishedAnimating: boolean;
  14280. animations: Animation[];
  14281. isPickable: boolean;
  14282. actionManager: ActionManager;
  14283. private _animationStarted;
  14284. private _loopAnimation;
  14285. private _fromIndex;
  14286. private _toIndex;
  14287. private _delay;
  14288. private _direction;
  14289. private _frameCount;
  14290. private _manager;
  14291. private _time;
  14292. private _onAnimationEnd;
  14293. size: number;
  14294. constructor(name: string, manager: SpriteManager);
  14295. playAnimation(from: number, to: number, loop: boolean, delay: number, onAnimationEnd: () => void): void;
  14296. stopAnimation(): void;
  14297. _animate(deltaTime: number): void;
  14298. dispose(): void;
  14299. }
  14300. }
  14301. declare module BABYLON {
  14302. class SpriteManager {
  14303. name: string;
  14304. sprites: Sprite[];
  14305. renderingGroupId: number;
  14306. layerMask: number;
  14307. fogEnabled: boolean;
  14308. isPickable: boolean;
  14309. cellWidth: number;
  14310. cellHeight: number;
  14311. /**
  14312. * An event triggered when the manager is disposed.
  14313. * @type {BABYLON.Observable}
  14314. */
  14315. onDisposeObservable: Observable<SpriteManager>;
  14316. private _onDisposeObserver;
  14317. onDispose: () => void;
  14318. private _capacity;
  14319. private _spriteTexture;
  14320. private _epsilon;
  14321. private _scene;
  14322. private _vertexData;
  14323. private _buffer;
  14324. private _vertexBuffers;
  14325. private _indexBuffer;
  14326. private _effectBase;
  14327. private _effectFog;
  14328. texture: Texture;
  14329. constructor(name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number);
  14330. private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize);
  14331. intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): PickingInfo;
  14332. render(): void;
  14333. dispose(): void;
  14334. }
  14335. }
  14336. declare module BABYLON.Internals {
  14337. class _AlphaState {
  14338. private _isAlphaBlendDirty;
  14339. private _isBlendFunctionParametersDirty;
  14340. private _alphaBlend;
  14341. private _blendFunctionParameters;
  14342. /**
  14343. * Initializes the state.
  14344. */
  14345. constructor();
  14346. readonly isDirty: boolean;
  14347. alphaBlend: boolean;
  14348. setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
  14349. reset(): void;
  14350. apply(gl: WebGLRenderingContext): void;
  14351. }
  14352. }
  14353. declare module BABYLON.Internals {
  14354. class _DepthCullingState {
  14355. private _isDepthTestDirty;
  14356. private _isDepthMaskDirty;
  14357. private _isDepthFuncDirty;
  14358. private _isCullFaceDirty;
  14359. private _isCullDirty;
  14360. private _isZOffsetDirty;
  14361. private _depthTest;
  14362. private _depthMask;
  14363. private _depthFunc;
  14364. private _cull;
  14365. private _cullFace;
  14366. private _zOffset;
  14367. /**
  14368. * Initializes the state.
  14369. */
  14370. constructor();
  14371. readonly isDirty: boolean;
  14372. zOffset: number;
  14373. cullFace: number;
  14374. cull: boolean;
  14375. depthFunc: number;
  14376. depthMask: boolean;
  14377. depthTest: boolean;
  14378. reset(): void;
  14379. apply(gl: WebGLRenderingContext): void;
  14380. }
  14381. }
  14382. declare module BABYLON.Internals {
  14383. class _StencilState {
  14384. private _isStencilTestDirty;
  14385. private _isStencilMaskDirty;
  14386. private _isStencilFuncDirty;
  14387. private _isStencilOpDirty;
  14388. private _stencilTest;
  14389. private _stencilMask;
  14390. private _stencilFunc;
  14391. private _stencilFuncRef;
  14392. private _stencilFuncMask;
  14393. private _stencilOpStencilFail;
  14394. private _stencilOpDepthFail;
  14395. private _stencilOpStencilDepthPass;
  14396. readonly isDirty: boolean;
  14397. stencilFunc: number;
  14398. stencilFuncRef: number;
  14399. stencilFuncMask: number;
  14400. stencilOpStencilFail: number;
  14401. stencilOpDepthFail: number;
  14402. stencilOpStencilDepthPass: number;
  14403. stencilMask: number;
  14404. stencilTest: boolean;
  14405. constructor();
  14406. reset(): void;
  14407. apply(gl: WebGLRenderingContext): void;
  14408. }
  14409. }
  14410. declare module BABYLON.Internals {
  14411. class AndOrNotEvaluator {
  14412. static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
  14413. private static _HandleParenthesisContent(parenthesisContent, evaluateCallback);
  14414. private static _SimplifyNegation(booleanString);
  14415. }
  14416. }
  14417. declare module BABYLON {
  14418. interface IAssetTask {
  14419. onSuccess: (task: IAssetTask) => void;
  14420. onError: (task: IAssetTask) => void;
  14421. isCompleted: boolean;
  14422. run(scene: Scene, onSuccess: () => void, onError: () => void): any;
  14423. }
  14424. class MeshAssetTask implements IAssetTask {
  14425. name: string;
  14426. meshesNames: any;
  14427. rootUrl: string;
  14428. sceneFilename: string;
  14429. loadedMeshes: Array<AbstractMesh>;
  14430. loadedParticleSystems: Array<ParticleSystem>;
  14431. loadedSkeletons: Array<Skeleton>;
  14432. onSuccess: (task: IAssetTask) => void;
  14433. onError: (task: IAssetTask) => void;
  14434. isCompleted: boolean;
  14435. constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string);
  14436. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  14437. }
  14438. class TextFileAssetTask implements IAssetTask {
  14439. name: string;
  14440. url: string;
  14441. onSuccess: (task: IAssetTask) => void;
  14442. onError: (task: IAssetTask) => void;
  14443. isCompleted: boolean;
  14444. text: string;
  14445. constructor(name: string, url: string);
  14446. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  14447. }
  14448. class BinaryFileAssetTask implements IAssetTask {
  14449. name: string;
  14450. url: string;
  14451. onSuccess: (task: IAssetTask) => void;
  14452. onError: (task: IAssetTask) => void;
  14453. isCompleted: boolean;
  14454. data: ArrayBuffer;
  14455. constructor(name: string, url: string);
  14456. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  14457. }
  14458. class ImageAssetTask implements IAssetTask {
  14459. name: string;
  14460. url: string;
  14461. onSuccess: (task: IAssetTask) => void;
  14462. onError: (task: IAssetTask) => void;
  14463. isCompleted: boolean;
  14464. image: HTMLImageElement;
  14465. constructor(name: string, url: string);
  14466. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  14467. }
  14468. interface ITextureAssetTask extends IAssetTask {
  14469. onSuccess: (task: ITextureAssetTask) => void;
  14470. onError: (task: ITextureAssetTask) => void;
  14471. texture: Texture;
  14472. }
  14473. class TextureAssetTask implements ITextureAssetTask {
  14474. name: string;
  14475. url: string;
  14476. noMipmap: boolean;
  14477. invertY: boolean;
  14478. samplingMode: number;
  14479. onSuccess: (task: ITextureAssetTask) => void;
  14480. onError: (task: ITextureAssetTask) => void;
  14481. isCompleted: boolean;
  14482. texture: Texture;
  14483. constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number);
  14484. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  14485. }
  14486. class CubeTextureAssetTask implements IAssetTask {
  14487. name: string;
  14488. url: string;
  14489. extensions: string[];
  14490. noMipmap: boolean;
  14491. files: string[];
  14492. onSuccess: (task: IAssetTask) => void;
  14493. onError: (task: IAssetTask) => void;
  14494. isCompleted: boolean;
  14495. texture: CubeTexture;
  14496. constructor(name: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[]);
  14497. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  14498. }
  14499. class HDRCubeTextureAssetTask implements IAssetTask {
  14500. name: string;
  14501. url: string;
  14502. size: number;
  14503. noMipmap: boolean;
  14504. generateHarmonics: boolean;
  14505. useInGammaSpace: boolean;
  14506. usePMREMGenerator: boolean;
  14507. onSuccess: (task: IAssetTask) => void;
  14508. onError: (task: IAssetTask) => void;
  14509. isCompleted: boolean;
  14510. texture: HDRCubeTexture;
  14511. constructor(name: string, url: string, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean);
  14512. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  14513. }
  14514. class AssetsManager {
  14515. private _scene;
  14516. protected tasks: IAssetTask[];
  14517. protected waitingTasksCount: number;
  14518. onFinish: (tasks: IAssetTask[]) => void;
  14519. onTaskSuccess: (task: IAssetTask) => void;
  14520. onTaskError: (task: IAssetTask) => void;
  14521. useDefaultLoadingScreen: boolean;
  14522. constructor(scene: Scene);
  14523. addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask;
  14524. addTextFileTask(taskName: string, url: string): IAssetTask;
  14525. addBinaryFileTask(taskName: string, url: string): IAssetTask;
  14526. addImageTask(taskName: string, url: string): IAssetTask;
  14527. addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): ITextureAssetTask;
  14528. private _decreaseWaitingTasksCount();
  14529. private _runTask(task);
  14530. reset(): AssetsManager;
  14531. load(): AssetsManager;
  14532. }
  14533. }
  14534. declare module BABYLON {
  14535. class Database {
  14536. private callbackManifestChecked;
  14537. private currentSceneUrl;
  14538. private db;
  14539. private enableSceneOffline;
  14540. private enableTexturesOffline;
  14541. private manifestVersionFound;
  14542. private mustUpdateRessources;
  14543. private hasReachedQuota;
  14544. private isSupported;
  14545. private idbFactory;
  14546. static IsUASupportingBlobStorage: boolean;
  14547. static IDBStorageEnabled: boolean;
  14548. constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any);
  14549. static parseURL: (url: string) => string;
  14550. static ReturnFullUrlLocation: (url: string) => string;
  14551. checkManifestFile(): void;
  14552. openAsync(successCallback: any, errorCallback: any): void;
  14553. loadImageFromDB(url: string, image: HTMLImageElement): void;
  14554. private _loadImageFromDBAsync(url, image, notInDBCallback);
  14555. private _saveImageIntoDBAsync(url, image);
  14556. private _checkVersionFromDB(url, versionLoaded);
  14557. private _loadVersionFromDBAsync(url, callback, updateInDBCallback);
  14558. private _saveVersionIntoDBAsync(url, callback);
  14559. private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?);
  14560. private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?);
  14561. private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?);
  14562. }
  14563. }
  14564. declare module BABYLON.Internals {
  14565. interface DDSInfo {
  14566. width: number;
  14567. height: number;
  14568. mipmapCount: number;
  14569. isFourCC: boolean;
  14570. isRGB: boolean;
  14571. isLuminance: boolean;
  14572. isCube: boolean;
  14573. }
  14574. class DDSTools {
  14575. static GetDDSInfo(arrayBuffer: any): DDSInfo;
  14576. private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  14577. private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  14578. private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  14579. static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void;
  14580. }
  14581. }
  14582. declare module BABYLON {
  14583. function expandToProperty(callback: string): (target: any, propertyKey: string) => void;
  14584. function serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14585. function serializeAsTexture(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14586. function serializeAsColor3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14587. function serializeAsFresnelParameters(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14588. function serializeAsVector2(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14589. function serializeAsVector3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14590. function serializeAsMeshReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14591. function serializeAsColorCurves(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  14592. class SerializationHelper {
  14593. static Serialize<T>(entity: T, serializationObject?: any): any;
  14594. static Parse<T>(creationFunction: () => T, source: any, scene: Scene, rootUrl?: string): T;
  14595. static Clone<T>(creationFunction: () => T, source: T): T;
  14596. }
  14597. }
  14598. declare module BABYLON {
  14599. class DynamicFloatArrayElementInfo {
  14600. offset: number;
  14601. }
  14602. /**
  14603. * 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.
  14604. * The intent is to maintain through time data that will be bound to a WebGlBuffer with the ability to change add/remove elements.
  14605. * It was first built to efficiently maintain the WebGlBuffer that contain instancing based data.
  14606. * 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.
  14607. * 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.
  14608. * 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".
  14609. */
  14610. class DynamicFloatArray {
  14611. /**
  14612. * Construct an instance of the dynamic float array
  14613. * @param stride size of one element in float (i.e. not bytes!)
  14614. * @param initialElementCount the number of available entries at construction
  14615. */
  14616. constructor(stride: number, initialElementCount: number);
  14617. /**
  14618. * Allocate an element in the array.
  14619. * @return the element info instance that contains the offset into the main buffer of the element's location.
  14620. * Beware, this offset may change when you call pack()
  14621. */
  14622. allocElement(): DynamicFloatArrayElementInfo;
  14623. /**
  14624. * Free the element corresponding to the given element info
  14625. * @param elInfo the element that describe the allocated element
  14626. */
  14627. freeElement(elInfo: DynamicFloatArrayElementInfo): void;
  14628. /**
  14629. * This method will pack all the used elements into a linear sequence and put all the free space at the end.
  14630. * 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().
  14631. * @return the subArray that is the view of the used elements area, you can use it as a source to update a WebGLBuffer
  14632. */
  14633. pack(): Float32Array;
  14634. private _moveElement(element, destOffset);
  14635. private _growBuffer();
  14636. /**
  14637. * 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!
  14638. * Don't use this buffer for a WebGL bufferSubData() operation, but use the one returned by the pack() method.
  14639. */
  14640. buffer: Float32Array;
  14641. /**
  14642. * Get the total count of entries that can fit in the current buffer
  14643. * @returns the elements count
  14644. */
  14645. readonly totalElementCount: number;
  14646. /**
  14647. * Get the count of free entries that can still be allocated without resizing the buffer
  14648. * @returns the free elements count
  14649. */
  14650. readonly freeElementCount: number;
  14651. /**
  14652. * Get the count of allocated elements
  14653. * @returns the allocated elements count
  14654. */
  14655. readonly usedElementCount: number;
  14656. /**
  14657. * Return the size of one element in float
  14658. * @returns the size in float
  14659. */
  14660. readonly stride: number;
  14661. compareValueOffset: number;
  14662. sortingAscending: boolean;
  14663. sort(): boolean;
  14664. private _allEntries;
  14665. private _freeEntries;
  14666. private _stride;
  14667. private _lastUsed;
  14668. private _firstFree;
  14669. private _sortTable;
  14670. private _sortedTable;
  14671. }
  14672. }
  14673. declare module Earcut {
  14674. /**
  14675. * The fastest and smallest JavaScript polygon triangulation library for your WebGL apps
  14676. * @param data is a flat array of vertice coordinates like [x0, y0, x1, y1, x2, y2, ...].
  14677. * @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).
  14678. * @param dim is the number of coordinates per vertice in the input array (2 by default).
  14679. */
  14680. function earcut(data: number[], holeIndices: number[], dim: number): any[];
  14681. /**
  14682. * return a percentage difference between the polygon area and its triangulation area;
  14683. * used to verify correctness of triangulation
  14684. */
  14685. function deviation(data: number[], holeIndices: number[], dim: number, triangles: number[]): number;
  14686. /**
  14687. * turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
  14688. */
  14689. function flatten(data: number[][][]): {
  14690. vertices: any[];
  14691. holes: any[];
  14692. dimensions: number;
  14693. };
  14694. }
  14695. declare module BABYLON {
  14696. enum PoseEnabledControllerType {
  14697. VIVE = 0,
  14698. OCULUS = 1,
  14699. GENERIC = 2,
  14700. }
  14701. interface MutableGamepadButton {
  14702. value: number;
  14703. touched: boolean;
  14704. pressed: boolean;
  14705. }
  14706. class PoseEnabledControllerHelper {
  14707. static InitiateController(vrGamepad: any): OculusTouchController | ViveController;
  14708. }
  14709. class PoseEnabledController extends Gamepad implements PoseControlled {
  14710. vrGamepad: any;
  14711. devicePosition: Vector3;
  14712. deviceRotationQuaternion: Quaternion;
  14713. deviceScaleFactor: number;
  14714. position: Vector3;
  14715. rotationQuaternion: Quaternion;
  14716. controllerType: PoseEnabledControllerType;
  14717. private _calculatedPosition;
  14718. private _calculatedRotation;
  14719. rawPose: DevicePose;
  14720. _mesh: AbstractMesh;
  14721. private _poseControlledCamera;
  14722. private _leftHandSystemQuaternion;
  14723. constructor(vrGamepad: any);
  14724. update(): void;
  14725. updateFromDevice(poseData: DevicePose): void;
  14726. attachToMesh(mesh: AbstractMesh): void;
  14727. attachToPoseControlledCamera(camera: TargetCamera): void;
  14728. detachMesh(): void;
  14729. readonly mesh: AbstractMesh;
  14730. getForwardRay(length?: number): Ray;
  14731. }
  14732. interface GamepadButtonChanges {
  14733. changed: boolean;
  14734. pressChanged: boolean;
  14735. touchChanged: boolean;
  14736. valueChanged: boolean;
  14737. }
  14738. abstract class WebVRController extends PoseEnabledController {
  14739. onTriggerStateChangedObservable: Observable<ExtendedGamepadButton>;
  14740. onMainButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  14741. onSecondaryButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  14742. onPadStateChangedObservable: Observable<ExtendedGamepadButton>;
  14743. onPadValuesChangedObservable: Observable<StickValues>;
  14744. protected _buttons: Array<MutableGamepadButton>;
  14745. private _onButtonStateChange;
  14746. onButtonStateChange(callback: (controlledIndex: number, buttonIndex: number, state: ExtendedGamepadButton) => void): void;
  14747. pad: StickValues;
  14748. hand: string;
  14749. constructor(vrGamepad: any);
  14750. update(): void;
  14751. protected abstract handleButtonChange(buttonIdx: number, value: ExtendedGamepadButton, changes: GamepadButtonChanges): any;
  14752. abstract initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void): any;
  14753. private _setButtonValue(newState, currentState, buttonIndex);
  14754. private _changes;
  14755. private _checkChanges(newState, currentState);
  14756. }
  14757. class OculusTouchController extends WebVRController {
  14758. private _defaultModel;
  14759. onSecondaryTriggerStateChangedObservable: Observable<ExtendedGamepadButton>;
  14760. onThumbRestChangedObservable: Observable<ExtendedGamepadButton>;
  14761. constructor(vrGamepad: any);
  14762. initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void): void;
  14763. readonly onAButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  14764. readonly onBButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  14765. readonly onXButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  14766. readonly onYButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  14767. protected handleButtonChange(buttonIdx: number, state: ExtendedGamepadButton, changes: GamepadButtonChanges): void;
  14768. }
  14769. class ViveController extends WebVRController {
  14770. private _defaultModel;
  14771. constructor(vrGamepad: any);
  14772. initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void): void;
  14773. readonly onLeftButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  14774. readonly onRightButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  14775. readonly onMenuButtonStateChangedObservable: Observable<ExtendedGamepadButton>;
  14776. /**
  14777. * Vive mapping:
  14778. * 0: touchpad
  14779. * 1: trigger
  14780. * 2: left AND right buttons
  14781. * 3: menu button
  14782. */
  14783. protected handleButtonChange(buttonIdx: number, state: ExtendedGamepadButton, changes: GamepadButtonChanges): void;
  14784. }
  14785. }
  14786. interface ExtendedGamepadButton extends GamepadButton {
  14787. readonly pressed: boolean;
  14788. readonly touched: boolean;
  14789. readonly value: number;
  14790. }
  14791. declare module BABYLON {
  14792. class FilesInput {
  14793. private _engine;
  14794. private _currentScene;
  14795. private _canvas;
  14796. private _sceneLoadedCallback;
  14797. private _progressCallback;
  14798. private _additionnalRenderLoopLogicCallback;
  14799. private _textureLoadingCallback;
  14800. private _startingProcessingFilesCallback;
  14801. private _elementToMonitor;
  14802. static FilesToLoad: File[];
  14803. private _sceneFileToLoad;
  14804. private _filesToLoad;
  14805. 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);
  14806. monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void;
  14807. private renderFunction();
  14808. private drag(e);
  14809. private drop(eventDrop);
  14810. loadFiles(event: any): void;
  14811. reload(): void;
  14812. }
  14813. }
  14814. declare module BABYLON {
  14815. class Gamepads<T extends Gamepad> {
  14816. private babylonGamepads;
  14817. private oneGamepadConnected;
  14818. private isMonitoring;
  14819. private gamepadEventSupported;
  14820. private gamepadSupport;
  14821. private _callbackGamepadConnected;
  14822. private _onGamepadConnectedEvent;
  14823. private _onGamepadDisonnectedEvent;
  14824. private static gamepadDOMInfo;
  14825. constructor(ongamedpadconnected: (gamepad: T) => void);
  14826. dispose(): void;
  14827. private _onGamepadConnected(gamepad);
  14828. private _addNewGamepad(gamepad);
  14829. private _onGamepadDisconnected(evt);
  14830. private _startMonitoringGamepads();
  14831. private _stopMonitoringGamepads();
  14832. private _checkGamepadsStatus();
  14833. private _updateGamepadObjects();
  14834. }
  14835. class StickValues {
  14836. x: any;
  14837. y: any;
  14838. constructor(x: any, y: any);
  14839. }
  14840. class Gamepad {
  14841. id: string;
  14842. index: number;
  14843. browserGamepad: any;
  14844. type: number;
  14845. private _leftStick;
  14846. private _rightStick;
  14847. private _leftStickAxisX;
  14848. private _leftStickAxisY;
  14849. private _rightStickAxisX;
  14850. private _rightStickAxisY;
  14851. private _onleftstickchanged;
  14852. private _onrightstickchanged;
  14853. static GAMEPAD: number;
  14854. static GENERIC: number;
  14855. static XBOX: number;
  14856. static POSE_ENABLED: number;
  14857. constructor(id: string, index: number, browserGamepad: any, leftStickX?: number, leftStickY?: number, rightStickX?: number, rightStickY?: number);
  14858. onleftstickchanged(callback: (values: StickValues) => void): void;
  14859. onrightstickchanged(callback: (values: StickValues) => void): void;
  14860. leftStick: StickValues;
  14861. rightStick: StickValues;
  14862. update(): void;
  14863. }
  14864. class GenericPad extends Gamepad {
  14865. id: string;
  14866. index: number;
  14867. gamepad: any;
  14868. private _buttons;
  14869. private _onbuttondown;
  14870. private _onbuttonup;
  14871. onbuttondown(callback: (buttonPressed: number) => void): void;
  14872. onbuttonup(callback: (buttonReleased: number) => void): void;
  14873. constructor(id: string, index: number, gamepad: any);
  14874. private _setButtonValue(newValue, currentValue, buttonIndex);
  14875. update(): void;
  14876. }
  14877. enum Xbox360Button {
  14878. A = 0,
  14879. B = 1,
  14880. X = 2,
  14881. Y = 3,
  14882. Start = 4,
  14883. Back = 5,
  14884. LB = 6,
  14885. RB = 7,
  14886. LeftStick = 8,
  14887. RightStick = 9,
  14888. }
  14889. enum Xbox360Dpad {
  14890. Up = 0,
  14891. Down = 1,
  14892. Left = 2,
  14893. Right = 3,
  14894. }
  14895. class Xbox360Pad extends Gamepad {
  14896. private _leftTrigger;
  14897. private _rightTrigger;
  14898. private _onlefttriggerchanged;
  14899. private _onrighttriggerchanged;
  14900. private _onbuttondown;
  14901. private _onbuttonup;
  14902. private _ondpaddown;
  14903. private _ondpadup;
  14904. private _buttonA;
  14905. private _buttonB;
  14906. private _buttonX;
  14907. private _buttonY;
  14908. private _buttonBack;
  14909. private _buttonStart;
  14910. private _buttonLB;
  14911. private _buttonRB;
  14912. private _buttonLeftStick;
  14913. private _buttonRightStick;
  14914. private _dPadUp;
  14915. private _dPadDown;
  14916. private _dPadLeft;
  14917. private _dPadRight;
  14918. private _isXboxOnePad;
  14919. constructor(id: string, index: number, gamepad: any, xboxOne?: boolean);
  14920. onlefttriggerchanged(callback: (value: number) => void): void;
  14921. onrighttriggerchanged(callback: (value: number) => void): void;
  14922. leftTrigger: number;
  14923. rightTrigger: number;
  14924. onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
  14925. onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
  14926. ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
  14927. ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
  14928. private _setButtonValue(newValue, currentValue, buttonType);
  14929. private _setDPadValue(newValue, currentValue, buttonType);
  14930. buttonA: number;
  14931. buttonB: number;
  14932. buttonX: number;
  14933. buttonY: number;
  14934. buttonStart: number;
  14935. buttonBack: number;
  14936. buttonLB: number;
  14937. buttonRB: number;
  14938. buttonLeftStick: number;
  14939. buttonRightStick: number;
  14940. dPadUp: number;
  14941. dPadDown: number;
  14942. dPadLeft: number;
  14943. dPadRight: number;
  14944. update(): void;
  14945. }
  14946. }
  14947. interface Navigator {
  14948. getGamepads(func?: any): any;
  14949. webkitGetGamepads(func?: any): any;
  14950. msGetGamepads(func?: any): any;
  14951. webkitGamepads(func?: any): any;
  14952. }
  14953. declare module BABYLON.Internals {
  14954. /**
  14955. * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
  14956. * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
  14957. */
  14958. class KhronosTextureContainer {
  14959. arrayBuffer: any;
  14960. static HEADER_LEN: number;
  14961. static COMPRESSED_2D: number;
  14962. static COMPRESSED_3D: number;
  14963. static TEX_2D: number;
  14964. static TEX_3D: number;
  14965. glType: number;
  14966. glTypeSize: number;
  14967. glFormat: number;
  14968. glInternalFormat: number;
  14969. glBaseInternalFormat: number;
  14970. pixelWidth: number;
  14971. pixelHeight: number;
  14972. pixelDepth: number;
  14973. numberOfArrayElements: number;
  14974. numberOfFaces: number;
  14975. numberOfMipmapLevels: number;
  14976. bytesOfKeyValueData: number;
  14977. loadType: number;
  14978. /**
  14979. * @param {ArrayBuffer} arrayBuffer- contents of the KTX container file
  14980. * @param {number} facesExpected- should be either 1 or 6, based whether a cube texture or or
  14981. * @param {boolean} threeDExpected- provision for indicating that data should be a 3D texture, not implemented
  14982. * @param {boolean} textureArrayExpected- provision for indicating that data should be a texture array, not implemented
  14983. */
  14984. constructor(arrayBuffer: any, facesExpected: number, threeDExpected?: boolean, textureArrayExpected?: boolean);
  14985. switchEndainness(val: number): number;
  14986. /**
  14987. * It is assumed that the texture has already been created & is currently bound
  14988. */
  14989. uploadLevels(gl: WebGLRenderingContext, loadMipmaps: boolean): void;
  14990. private _upload2DCompressedLevels(gl, loadMipmaps);
  14991. }
  14992. }
  14993. declare module BABYLON {
  14994. interface ILoadingScreen {
  14995. displayLoadingUI: () => void;
  14996. hideLoadingUI: () => void;
  14997. loadingUIBackgroundColor: string;
  14998. loadingUIText: string;
  14999. }
  15000. class DefaultLoadingScreen implements ILoadingScreen {
  15001. private _renderingCanvas;
  15002. private _loadingText;
  15003. private _loadingDivBackgroundColor;
  15004. private _loadingDiv;
  15005. private _loadingTextDiv;
  15006. constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
  15007. displayLoadingUI(): void;
  15008. hideLoadingUI(): void;
  15009. loadingUIText: string;
  15010. loadingUIBackgroundColor: string;
  15011. private _resizeLoadingUI;
  15012. }
  15013. }
  15014. declare module BABYLON {
  15015. /**
  15016. * A class serves as a medium between the observable and its observers
  15017. */
  15018. class EventState {
  15019. /**
  15020. * If the callback of a given Observer set skipNextObservers to true the following observers will be ignored
  15021. */
  15022. constructor(mask: number, skipNextObservers?: boolean);
  15023. initalize(mask: number, skipNextObservers?: boolean): EventState;
  15024. /**
  15025. * An Observer can set this property to true to prevent subsequent observers of being notified
  15026. */
  15027. skipNextObservers: boolean;
  15028. /**
  15029. * Get the mask value that were used to trigger the event corresponding to this EventState object
  15030. */
  15031. mask: number;
  15032. }
  15033. /**
  15034. * Represent an Observer registered to a given Observable object.
  15035. */
  15036. class Observer<T> {
  15037. callback: (eventData: T, eventState: EventState) => void;
  15038. mask: number;
  15039. constructor(callback: (eventData: T, eventState: EventState) => void, mask: number);
  15040. }
  15041. /**
  15042. * The Observable class is a simple implementation of the Observable pattern.
  15043. * 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.
  15044. * This enable a more fine grained execution without having to rely on multiple different Observable objects.
  15045. * 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).
  15046. * 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.
  15047. */
  15048. class Observable<T> {
  15049. _observers: Observer<T>[];
  15050. private _eventState;
  15051. constructor();
  15052. /**
  15053. * Create a new Observer with the specified callback
  15054. * @param callback the callback that will be executed for that Observer
  15055. * @param mask the mask used to filter observers
  15056. * @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.
  15057. */
  15058. add(callback: (eventData: T, eventState: EventState) => void, mask?: number, insertFirst?: boolean): Observer<T>;
  15059. /**
  15060. * Remove an Observer from the Observable object
  15061. * @param observer the instance of the Observer to remove. If it doesn't belong to this Observable, false will be returned.
  15062. */
  15063. remove(observer: Observer<T>): boolean;
  15064. /**
  15065. * Remove a callback from the Observable object
  15066. * @param callback the callback to remove. If it doesn't belong to this Observable, false will be returned.
  15067. */
  15068. removeCallback(callback: (eventData: T, eventState: EventState) => void): boolean;
  15069. /**
  15070. * Notify all Observers by calling their respective callback with the given data
  15071. * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute
  15072. * @param eventData
  15073. * @param mask
  15074. */
  15075. notifyObservers(eventData: T, mask?: number): boolean;
  15076. /**
  15077. * return true is the Observable has at least one Observer registered
  15078. */
  15079. hasObservers(): boolean;
  15080. /**
  15081. * Clear the list of observers
  15082. */
  15083. clear(): void;
  15084. /**
  15085. * Clone the current observable
  15086. */
  15087. clone(): Observable<T>;
  15088. /**
  15089. * Does this observable handles observer registered with a given mask
  15090. * @param {number} trigger - the mask to be tested
  15091. * @return {boolean} whether or not one observer registered with the given mask is handeled
  15092. **/
  15093. hasSpecificMask(mask?: number): boolean;
  15094. }
  15095. }
  15096. declare module BABYLON {
  15097. /**
  15098. * This class describe a rectangle that were added to the map.
  15099. * You have access to its coordinates either in pixel or normalized (UV)
  15100. */
  15101. class PackedRect {
  15102. constructor(root: RectPackingMap, parent: PackedRect, pos: Vector2, size: Size);
  15103. /**
  15104. * @returns the position of this node into the map
  15105. */
  15106. readonly pos: Vector2;
  15107. /**
  15108. * @returns the size of the rectangle this node handles
  15109. */
  15110. readonly contentSize: Size;
  15111. /**
  15112. * Retrieve the inner position (considering the margin) and stores it into the res object
  15113. * @param res must be a valid Vector2 that will contain the inner position after this call
  15114. */
  15115. getInnerPosToRef(res: Vector2): void;
  15116. /**
  15117. * Retrieve the inner size (considering the margin) and stores it into the res object
  15118. * @param res must be a valid Size that will contain the inner size after this call
  15119. */
  15120. getInnerSizeToRef(res: Size): void;
  15121. /**
  15122. * Compute the UV of the top/left, top/right, bottom/right, bottom/left points of the rectangle this node handles into the map
  15123. * @returns And array of 4 Vector2, containing UV coordinates for the four corners of the Rectangle into the map
  15124. */
  15125. readonly UVs: Vector2[];
  15126. /**
  15127. * You may have allocated the PackedRect using over-provisioning (you allocated more than you need in order to prevent frequent deallocations/reallocations)
  15128. * and then using only a part of the PackRect.
  15129. * This method will return the UVs for this part by given the custom size of what you really use
  15130. * @param customSize must be less/equal to the allocated size, UV will be compute from this
  15131. */
  15132. getUVsForCustomSize(customSize: Size): Vector2[];
  15133. /**
  15134. * Free this rectangle from the map.
  15135. * Call this method when you no longer need the rectangle to be in the map.
  15136. */
  15137. freeContent(): void;
  15138. protected readonly isUsed: boolean;
  15139. protected findAndSplitNode(contentSize: Size): PackedRect;
  15140. private findNode(size);
  15141. private static TpsSize;
  15142. private splitNode(contentSize);
  15143. private attemptDefrag();
  15144. private clearNode();
  15145. private readonly isRecursiveFree;
  15146. protected evalFreeSize(size: number): number;
  15147. protected _root: RectPackingMap;
  15148. protected _parent: PackedRect;
  15149. private _contentSize;
  15150. private _initialSize;
  15151. private _leftNode;
  15152. private _rightNode;
  15153. private _bottomNode;
  15154. private _pos;
  15155. protected _size: Size;
  15156. }
  15157. /**
  15158. * The purpose of this class is to pack several Rectangles into a big map, while trying to fit everything as optimally as possible.
  15159. * This class is typically used to build lightmaps, sprite map or to pack several little textures into a big one.
  15160. * 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.
  15161. * In case you need a margin around the allocated rect, specify the amount in the margin argument during construction.
  15162. * In such case you will have to rely on innerPositionToRef and innerSizeToRef calls to get the proper size
  15163. */
  15164. class RectPackingMap extends PackedRect {
  15165. /**
  15166. * Create an instance of the object with a dimension using the given size
  15167. * @param size The dimension of the rectangle that will contain all the sub ones.
  15168. * @param margin The margin (empty space) created (in pixels) around the allocated Rectangles
  15169. */
  15170. constructor(size: Size, margin?: number);
  15171. /**
  15172. * Add a rectangle, finding the best location to store it into the map
  15173. * @param size the dimension of the rectangle to store
  15174. * @return the Node containing the rectangle information, or null if we couldn't find a free spot
  15175. */
  15176. addRect(size: Size): PackedRect;
  15177. /**
  15178. * Return the current space free normalized between [0;1]
  15179. * @returns {}
  15180. */
  15181. readonly freeSpace: number;
  15182. _margin: number;
  15183. }
  15184. }
  15185. declare module BABYLON {
  15186. class SceneOptimization {
  15187. priority: number;
  15188. apply: (scene: Scene) => boolean;
  15189. constructor(priority?: number);
  15190. }
  15191. class TextureOptimization extends SceneOptimization {
  15192. priority: number;
  15193. maximumSize: number;
  15194. constructor(priority?: number, maximumSize?: number);
  15195. apply: (scene: Scene) => boolean;
  15196. }
  15197. class HardwareScalingOptimization extends SceneOptimization {
  15198. priority: number;
  15199. maximumScale: number;
  15200. private _currentScale;
  15201. constructor(priority?: number, maximumScale?: number);
  15202. apply: (scene: Scene) => boolean;
  15203. }
  15204. class ShadowsOptimization extends SceneOptimization {
  15205. apply: (scene: Scene) => boolean;
  15206. }
  15207. class PostProcessesOptimization extends SceneOptimization {
  15208. apply: (scene: Scene) => boolean;
  15209. }
  15210. class LensFlaresOptimization extends SceneOptimization {
  15211. apply: (scene: Scene) => boolean;
  15212. }
  15213. class ParticlesOptimization extends SceneOptimization {
  15214. apply: (scene: Scene) => boolean;
  15215. }
  15216. class RenderTargetsOptimization extends SceneOptimization {
  15217. apply: (scene: Scene) => boolean;
  15218. }
  15219. class MergeMeshesOptimization extends SceneOptimization {
  15220. static _UpdateSelectionTree: boolean;
  15221. static UpdateSelectionTree: boolean;
  15222. private _canBeMerged;
  15223. apply: (scene: Scene, updateSelectionTree?: boolean) => boolean;
  15224. }
  15225. class SceneOptimizerOptions {
  15226. targetFrameRate: number;
  15227. trackerDuration: number;
  15228. optimizations: SceneOptimization[];
  15229. constructor(targetFrameRate?: number, trackerDuration?: number);
  15230. static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  15231. static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  15232. static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  15233. }
  15234. class SceneOptimizer {
  15235. static _CheckCurrentState(scene: Scene, options: SceneOptimizerOptions, currentPriorityLevel: number, onSuccess?: () => void, onFailure?: () => void): void;
  15236. static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void;
  15237. }
  15238. }
  15239. declare module BABYLON {
  15240. class SceneSerializer {
  15241. static ClearCache(): void;
  15242. static Serialize(scene: Scene): any;
  15243. static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any;
  15244. }
  15245. }
  15246. declare module BABYLON {
  15247. class SmartArray<T> {
  15248. data: Array<T>;
  15249. length: number;
  15250. private _id;
  15251. private _duplicateId;
  15252. constructor(capacity: number);
  15253. push(value: any): void;
  15254. forEach(func: (content: T) => void): void;
  15255. pushNoDuplicate(value: any): boolean;
  15256. sort(compareFn: any): void;
  15257. reset(): void;
  15258. dispose(): void;
  15259. concat(array: any): void;
  15260. concatWithNoDuplicate(array: any): void;
  15261. indexOf(value: T): number;
  15262. contains(value: T): boolean;
  15263. private static _GlobalId;
  15264. }
  15265. }
  15266. declare module BABYLON {
  15267. /**
  15268. * This class implement a typical dictionary using a string as key and the generic type T as value.
  15269. * The underlying implementation relies on an associative array to ensure the best performances.
  15270. * The value can be anything including 'null' but except 'undefined'
  15271. */
  15272. class StringDictionary<T> {
  15273. /**
  15274. * This will clear this dictionary and copy the content from the 'source' one.
  15275. * If the T value is a custom object, it won't be copied/cloned, the same object will be used
  15276. * @param source the dictionary to take the content from and copy to this dictionary
  15277. */
  15278. copyFrom(source: StringDictionary<T>): void;
  15279. /**
  15280. * Get a value based from its key
  15281. * @param key the given key to get the matching value from
  15282. * @return the value if found, otherwise undefined is returned
  15283. */
  15284. get(key: string): T;
  15285. /**
  15286. * Get a value from its key or add it if it doesn't exist.
  15287. * This method will ensure you that a given key/data will be present in the dictionary.
  15288. * @param key the given key to get the matching value from
  15289. * @param factory the factory that will create the value if the key is not present in the dictionary.
  15290. * The factory will only be invoked if there's no data for the given key.
  15291. * @return the value corresponding to the key.
  15292. */
  15293. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  15294. /**
  15295. * Get a value from its key if present in the dictionary otherwise add it
  15296. * @param key the key to get the value from
  15297. * @param val if there's no such key/value pair in the dictionary add it with this value
  15298. * @return the value corresponding to the key
  15299. */
  15300. getOrAdd(key: string, val: T): T;
  15301. /**
  15302. * Check if there's a given key in the dictionary
  15303. * @param key the key to check for
  15304. * @return true if the key is present, false otherwise
  15305. */
  15306. contains(key: any): boolean;
  15307. /**
  15308. * Add a new key and its corresponding value
  15309. * @param key the key to add
  15310. * @param value the value corresponding to the key
  15311. * @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
  15312. */
  15313. add(key: string, value: T): boolean;
  15314. set(key: string, value: T): boolean;
  15315. /**
  15316. * Get the element of the given key and remove it from the dictionary
  15317. * @param key
  15318. */
  15319. getAndRemove(key: string): T;
  15320. /**
  15321. * Remove a key/value from the dictionary.
  15322. * @param key the key to remove
  15323. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  15324. */
  15325. remove(key: string): boolean;
  15326. /**
  15327. * Clear the whole content of the dictionary
  15328. */
  15329. clear(): void;
  15330. readonly count: number;
  15331. /**
  15332. * Execute a callback on each key/val of the dictionary.
  15333. * Note that you can remove any element in this dictionary in the callback implementation
  15334. * @param callback the callback to execute on a given key/value pair
  15335. */
  15336. forEach(callback: (key: string, val: T) => void): void;
  15337. /**
  15338. * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.
  15339. * If the callback returns null or undefined the method will iterate to the next key/value pair
  15340. * Note that you can remove any element in this dictionary in the callback implementation
  15341. * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned
  15342. */
  15343. first<TRes>(callback: (key: string, val: T) => TRes): TRes;
  15344. private _count;
  15345. private _data;
  15346. }
  15347. }
  15348. declare module BABYLON {
  15349. class Tags {
  15350. static EnableFor(obj: any): void;
  15351. static DisableFor(obj: any): void;
  15352. static HasTags(obj: any): boolean;
  15353. static GetTags(obj: any, asString?: boolean): any;
  15354. static AddTagsTo(obj: any, tagsString: string): void;
  15355. static _AddTagTo(obj: any, tag: string): void;
  15356. static RemoveTagsFrom(obj: any, tagsString: string): void;
  15357. static _RemoveTagFrom(obj: any, tag: string): void;
  15358. static MatchesQuery(obj: any, tagsQuery: string): boolean;
  15359. }
  15360. }
  15361. declare module BABYLON.Internals {
  15362. class TGATools {
  15363. private static _TYPE_NO_DATA;
  15364. private static _TYPE_INDEXED;
  15365. private static _TYPE_RGB;
  15366. private static _TYPE_GREY;
  15367. private static _TYPE_RLE_INDEXED;
  15368. private static _TYPE_RLE_RGB;
  15369. private static _TYPE_RLE_GREY;
  15370. private static _ORIGIN_MASK;
  15371. private static _ORIGIN_SHIFT;
  15372. private static _ORIGIN_BL;
  15373. private static _ORIGIN_BR;
  15374. private static _ORIGIN_UL;
  15375. private static _ORIGIN_UR;
  15376. static GetTGAHeader(data: Uint8Array): any;
  15377. static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void;
  15378. static _getImageData8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  15379. static _getImageData16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  15380. static _getImageData24bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  15381. static _getImageData32bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  15382. static _getImageDataGrey8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  15383. static _getImageDataGrey16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  15384. }
  15385. }
  15386. declare module BABYLON {
  15387. interface IAnimatable {
  15388. animations: Array<Animation>;
  15389. }
  15390. class Tools {
  15391. static BaseUrl: string;
  15392. static CorsBehavior: any;
  15393. static UseFallbackTexture: boolean;
  15394. private static fallbackTexture;
  15395. static Instantiate(className: string): any;
  15396. static SetImmediate(action: () => void): void;
  15397. static IsExponentOfTwo(value: number): boolean;
  15398. static GetExponentOfTwo(value: number, max: number): number;
  15399. static GetFilename(path: string): string;
  15400. static GetDOMTextContent(element: HTMLElement): string;
  15401. static ToDegrees(angle: number): number;
  15402. static ToRadians(angle: number): number;
  15403. static EncodeArrayBufferTobase64(buffer: ArrayBuffer): string;
  15404. static ExtractMinAndMaxIndexed(positions: number[] | Float32Array, indices: IndicesArray, indexStart: number, indexCount: number, bias?: Vector2): {
  15405. minimum: Vector3;
  15406. maximum: Vector3;
  15407. };
  15408. static ExtractMinAndMax(positions: number[] | Float32Array, start: number, count: number, bias?: Vector2, stride?: number): {
  15409. minimum: Vector3;
  15410. maximum: Vector3;
  15411. };
  15412. static Vector2ArrayFeeder(array: Array<Vector2> | Float32Array): (i: number) => Vector2;
  15413. static ExtractMinAndMaxVector2(feeder: (index: number) => Vector2, bias?: Vector2): {
  15414. minimum: Vector2;
  15415. maximum: Vector2;
  15416. };
  15417. static MakeArray(obj: any, allowsNullUndefined?: boolean): Array<any>;
  15418. static GetPointerPrefix(): string;
  15419. /**
  15420. * @param func - the function to be called
  15421. * @param requester - the object that will request the next frame. Falls back to window.
  15422. */
  15423. static QueueNewFrame(func: any, requester?: any): void;
  15424. static RequestFullscreen(element: any): void;
  15425. static ExitFullscreen(): void;
  15426. static SetCorsBehavior(url: string, img: HTMLImageElement): void;
  15427. static CleanUrl(url: string): string;
  15428. static LoadImage(url: any, onload: any, onerror: any, database: any): HTMLImageElement;
  15429. static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: (data: any) => void, database?: any, useArrayBuffer?: boolean, onError?: (request: XMLHttpRequest) => void): void;
  15430. /**
  15431. * Load a script (identified by an url). When the url returns, the
  15432. * content of this file is added into a new script element, attached to the DOM (body element)
  15433. */
  15434. static LoadScript(scriptUrl: string, onSuccess: () => void, onError?: () => void): void;
  15435. static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void;
  15436. static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void;
  15437. static FileAsURL(content: string): string;
  15438. static Format(value: number, decimals?: number): string;
  15439. static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
  15440. static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
  15441. static IsEmpty(obj: any): boolean;
  15442. static RegisterTopRootEvents(events: {
  15443. name: string;
  15444. handler: EventListener;
  15445. }[]): void;
  15446. static UnregisterTopRootEvents(events: {
  15447. name: string;
  15448. handler: EventListener;
  15449. }[]): void;
  15450. static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void, mimeType?: string): void;
  15451. static EncodeScreenshotCanvasData(successCallback?: (data: string) => void, mimeType?: string): void;
  15452. static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
  15453. static CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string, samples?: number): void;
  15454. static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
  15455. /**
  15456. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  15457. * Be aware Math.random() could cause collisions, but:
  15458. * "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"
  15459. */
  15460. static RandomId(): string;
  15461. private static _NoneLogLevel;
  15462. private static _MessageLogLevel;
  15463. private static _WarningLogLevel;
  15464. private static _ErrorLogLevel;
  15465. private static _LogCache;
  15466. static errorsCount: number;
  15467. static OnNewCacheEntry: (entry: string) => void;
  15468. static readonly NoneLogLevel: number;
  15469. static readonly MessageLogLevel: number;
  15470. static readonly WarningLogLevel: number;
  15471. static readonly ErrorLogLevel: number;
  15472. static readonly AllLogLevel: number;
  15473. private static _AddLogEntry(entry);
  15474. private static _FormatMessage(message);
  15475. private static _LogDisabled(message);
  15476. private static _LogEnabled(message);
  15477. private static _WarnDisabled(message);
  15478. private static _WarnEnabled(message);
  15479. private static _ErrorDisabled(message);
  15480. private static _ErrorEnabled(message);
  15481. static Log: (message: string) => void;
  15482. static Warn: (message: string) => void;
  15483. static Error: (message: string) => void;
  15484. static readonly LogCache: string;
  15485. static ClearLogCache(): void;
  15486. static LogLevels: number;
  15487. private static _PerformanceNoneLogLevel;
  15488. private static _PerformanceUserMarkLogLevel;
  15489. private static _PerformanceConsoleLogLevel;
  15490. private static _performance;
  15491. static readonly PerformanceNoneLogLevel: number;
  15492. static readonly PerformanceUserMarkLogLevel: number;
  15493. static readonly PerformanceConsoleLogLevel: number;
  15494. static PerformanceLogLevel: number;
  15495. static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  15496. static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  15497. static _StartUserMark(counterName: string, condition?: boolean): void;
  15498. static _EndUserMark(counterName: string, condition?: boolean): void;
  15499. static _StartPerformanceConsole(counterName: string, condition?: boolean): void;
  15500. static _EndPerformanceConsole(counterName: string, condition?: boolean): void;
  15501. static StartPerformanceCounter: (counterName: string, condition?: boolean) => void;
  15502. static EndPerformanceCounter: (counterName: string, condition?: boolean) => void;
  15503. static readonly Now: number;
  15504. /**
  15505. * This method will return the name of the class used to create the instance of the given object.
  15506. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.
  15507. * @param object the object to get the class name from
  15508. * @return the name of the class, will be "object" for a custom data type not using the @className decorator
  15509. */
  15510. static getClassName(object: any, isType?: boolean): string;
  15511. static first<T>(array: Array<T>, predicate: (item: T) => boolean): T;
  15512. /**
  15513. * This method will return the name of the full name of the class, including its owning module (if any).
  15514. * 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).
  15515. * @param object the object to get the class name from
  15516. * @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.
  15517. */
  15518. static getFullClassName(object: any, isType?: boolean): string;
  15519. /**
  15520. * 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.
  15521. * @param array
  15522. */
  15523. static arrayOrStringFeeder(array: any): (i: number) => number;
  15524. /**
  15525. * Compute the hashCode of a stream of number
  15526. * To compute the HashCode on a string or an Array of data types implementing the getHashCode() method, use the arrayOrStringFeeder method.
  15527. * @param feeder a callback that will be called until it returns null, each valid returned values will be used to compute the hash code.
  15528. * @return the hash code computed
  15529. */
  15530. static hashCodeFromStream(feeder: (index: number) => number): number;
  15531. }
  15532. /**
  15533. * This class is used to track a performance counter which is number based.
  15534. * The user has access to many properties which give statistics of different nature
  15535. *
  15536. * The implementer can track two kinds of Performance Counter: time and count
  15537. * 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.
  15538. * 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.
  15539. */
  15540. class PerfCounter {
  15541. static Enabled: boolean;
  15542. /**
  15543. * Returns the smallest value ever
  15544. */
  15545. readonly min: number;
  15546. /**
  15547. * Returns the biggest value ever
  15548. */
  15549. readonly max: number;
  15550. /**
  15551. * Returns the average value since the performance counter is running
  15552. */
  15553. readonly average: number;
  15554. /**
  15555. * Returns the average value of the last second the counter was monitored
  15556. */
  15557. readonly lastSecAverage: number;
  15558. /**
  15559. * Returns the current value
  15560. */
  15561. readonly current: number;
  15562. readonly total: number;
  15563. constructor();
  15564. /**
  15565. * Call this method to start monitoring a new frame.
  15566. * 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.
  15567. */
  15568. fetchNewFrame(): void;
  15569. /**
  15570. * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
  15571. * @param newCount the count value to add to the monitored count
  15572. * @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.
  15573. */
  15574. addCount(newCount: number, fetchResult: boolean): void;
  15575. /**
  15576. * Start monitoring this performance counter
  15577. */
  15578. beginMonitoring(): void;
  15579. /**
  15580. * Compute the time lapsed since the previous beginMonitoring() call.
  15581. * @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
  15582. */
  15583. endMonitoring(newFrame?: boolean): void;
  15584. private _fetchResult();
  15585. private _startMonitoringTime;
  15586. private _min;
  15587. private _max;
  15588. private _average;
  15589. private _current;
  15590. private _totalValueCount;
  15591. private _totalAccumulated;
  15592. private _lastSecAverage;
  15593. private _lastSecAccumulated;
  15594. private _lastSecTime;
  15595. private _lastSecValueCount;
  15596. }
  15597. /**
  15598. * Use this className as a decorator on a given class definition to add it a name and optionally its module.
  15599. * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.
  15600. * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified
  15601. * @param name The name of the class, case should be preserved
  15602. * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.
  15603. */
  15604. function className(name: string, module?: string): (target: Object) => void;
  15605. /**
  15606. * An implementation of a loop for asynchronous functions.
  15607. */
  15608. class AsyncLoop {
  15609. iterations: number;
  15610. private _fn;
  15611. private _successCallback;
  15612. index: number;
  15613. private _done;
  15614. /**
  15615. * Constroctor.
  15616. * @param iterations the number of iterations.
  15617. * @param _fn the function to run each iteration
  15618. * @param _successCallback the callback that will be called upon succesful execution
  15619. * @param offset starting offset.
  15620. */
  15621. constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number);
  15622. /**
  15623. * Execute the next iteration. Must be called after the last iteration was finished.
  15624. */
  15625. executeNext(): void;
  15626. /**
  15627. * Break the loop and run the success callback.
  15628. */
  15629. breakLoop(): void;
  15630. /**
  15631. * Helper function
  15632. */
  15633. static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop;
  15634. /**
  15635. * A for-loop that will run a given number of iterations synchronous and the rest async.
  15636. * @param iterations total number of iterations
  15637. * @param syncedIterations number of synchronous iterations in each async iteration.
  15638. * @param fn the function to call each iteration.
  15639. * @param callback a success call back that will be called when iterating stops.
  15640. * @param breakFunction a break condition (optional)
  15641. * @param timeout timeout settings for the setTimeout function. default - 0.
  15642. * @constructor
  15643. */
  15644. static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void;
  15645. }
  15646. }
  15647. declare module BABYLON {
  15648. enum JoystickAxis {
  15649. X = 0,
  15650. Y = 1,
  15651. Z = 2,
  15652. }
  15653. class VirtualJoystick {
  15654. reverseLeftRight: boolean;
  15655. reverseUpDown: boolean;
  15656. deltaPosition: Vector3;
  15657. pressed: boolean;
  15658. private static _globalJoystickIndex;
  15659. private static vjCanvas;
  15660. private static vjCanvasContext;
  15661. private static vjCanvasWidth;
  15662. private static vjCanvasHeight;
  15663. private static halfWidth;
  15664. private static halfHeight;
  15665. private _action;
  15666. private _axisTargetedByLeftAndRight;
  15667. private _axisTargetedByUpAndDown;
  15668. private _joystickSensibility;
  15669. private _inversedSensibility;
  15670. private _rotationSpeed;
  15671. private _inverseRotationSpeed;
  15672. private _rotateOnAxisRelativeToMesh;
  15673. private _joystickPointerID;
  15674. private _joystickColor;
  15675. private _joystickPointerPos;
  15676. private _joystickPreviousPointerPos;
  15677. private _joystickPointerStartPos;
  15678. private _deltaJoystickVector;
  15679. private _leftJoystick;
  15680. private _joystickIndex;
  15681. private _touches;
  15682. private _onPointerDownHandlerRef;
  15683. private _onPointerMoveHandlerRef;
  15684. private _onPointerUpHandlerRef;
  15685. private _onPointerOutHandlerRef;
  15686. private _onResize;
  15687. constructor(leftJoystick?: boolean);
  15688. setJoystickSensibility(newJoystickSensibility: number): void;
  15689. private _onPointerDown(e);
  15690. private _onPointerMove(e);
  15691. private _onPointerUp(e);
  15692. /**
  15693. * Change the color of the virtual joystick
  15694. * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
  15695. */
  15696. setJoystickColor(newColor: string): void;
  15697. setActionOnTouch(action: () => any): void;
  15698. setAxisForLeftRight(axis: JoystickAxis): void;
  15699. setAxisForUpDown(axis: JoystickAxis): void;
  15700. private _clearCanvas();
  15701. private _drawVirtualJoystick();
  15702. releaseCanvas(): void;
  15703. }
  15704. }
  15705. declare module BABYLON {
  15706. class VRCameraMetrics {
  15707. hResolution: number;
  15708. vResolution: number;
  15709. hScreenSize: number;
  15710. vScreenSize: number;
  15711. vScreenCenter: number;
  15712. eyeToScreenDistance: number;
  15713. lensSeparationDistance: number;
  15714. interpupillaryDistance: number;
  15715. distortionK: number[];
  15716. chromaAbCorrection: number[];
  15717. postProcessScaleFactor: number;
  15718. lensCenterOffset: number;
  15719. compensateDistortion: boolean;
  15720. readonly aspectRatio: number;
  15721. readonly aspectRatioFov: number;
  15722. readonly leftHMatrix: Matrix;
  15723. readonly rightHMatrix: Matrix;
  15724. readonly leftPreViewMatrix: Matrix;
  15725. readonly rightPreViewMatrix: Matrix;
  15726. static GetDefault(): VRCameraMetrics;
  15727. }
  15728. }
  15729. declare module BABYLON {
  15730. class VRDeviceOrientationFreeCamera extends DeviceOrientationCamera {
  15731. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  15732. getClassName(): string;
  15733. }
  15734. class VRDeviceOrientationGamepadCamera extends VRDeviceOrientationFreeCamera {
  15735. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  15736. getClassName(): string;
  15737. }
  15738. class VRDeviceOrientationArcRotateCamera extends ArcRotateCamera {
  15739. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  15740. getClassName(): string;
  15741. }
  15742. }
  15743. declare var HMDVRDevice: any;
  15744. declare var VRDisplay: any;
  15745. declare var VRFrameData: any;
  15746. declare module BABYLON {
  15747. /**
  15748. * This is a copy of VRPose.
  15749. * IMPORTANT!! The data is right-hand data.
  15750. * @export
  15751. * @interface DevicePose
  15752. */
  15753. interface DevicePose {
  15754. readonly position?: Float32Array;
  15755. readonly linearVelocity?: Float32Array;
  15756. readonly linearAcceleration?: Float32Array;
  15757. readonly orientation?: Float32Array;
  15758. readonly angularVelocity?: Float32Array;
  15759. readonly angularAcceleration?: Float32Array;
  15760. }
  15761. interface PoseControlled {
  15762. position: Vector3;
  15763. rotationQuaternion: Quaternion;
  15764. devicePosition?: Vector3;
  15765. deviceRotationQuaternion: Quaternion;
  15766. rawPose: DevicePose;
  15767. deviceScaleFactor: number;
  15768. updateFromDevice(poseData: DevicePose): any;
  15769. }
  15770. interface WebVROptions {
  15771. trackPosition?: boolean;
  15772. positionScale?: number;
  15773. displayName?: string;
  15774. controllerMeshes?: boolean;
  15775. defaultLightningOnControllers?: boolean;
  15776. }
  15777. class WebVRFreeCamera extends FreeCamera implements PoseControlled {
  15778. private webVROptions;
  15779. _vrDevice: any;
  15780. rawPose: DevicePose;
  15781. private _vrEnabled;
  15782. private _specsVersion;
  15783. private _attached;
  15784. private _oldSize;
  15785. private _oldHardwareScaleFactor;
  15786. private _frameData;
  15787. private _quaternionCache;
  15788. private _positionOffset;
  15789. protected _descendants: Array<Node>;
  15790. devicePosition: Vector3;
  15791. deviceRotationQuaternion: any;
  15792. deviceScaleFactor: number;
  15793. controllers: Array<WebVRController>;
  15794. private _onControllersAttached;
  15795. rigParenting: boolean;
  15796. private _lightOnControllers;
  15797. constructor(name: string, position: Vector3, scene: Scene, webVROptions?: WebVROptions);
  15798. onControllersAttached: (controllers: Array<WebVRController>) => void;
  15799. getControllerByName(name: string): WebVRController;
  15800. private _leftController;
  15801. readonly leftController: WebVRController;
  15802. private _rightController;
  15803. readonly rightController: WebVRController;
  15804. getForwardRay(length?: number): Ray;
  15805. _checkInputs(): void;
  15806. updateFromDevice(poseData: DevicePose): void;
  15807. /**
  15808. * WebVR's attach control will start broadcasting frames to the device.
  15809. * Note that in certain browsers (chrome for example) this function must be called
  15810. * within a user-interaction callback. Example:
  15811. * <pre> scene.onPointerDown = function() { camera.attachControl(canvas); }</pre>
  15812. *
  15813. * @param {HTMLElement} element
  15814. * @param {boolean} [noPreventDefault]
  15815. *
  15816. * @memberOf WebVRFreeCamera
  15817. */
  15818. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15819. detachControl(element: HTMLElement): void;
  15820. getClassName(): string;
  15821. resetToCurrentRotation(): void;
  15822. _updateRigCameras(): void;
  15823. /**
  15824. * This function is called by the two RIG cameras.
  15825. * 'this' is the left or right camera (and NOT (!!!) the WebVRFreeCamera instance)
  15826. */
  15827. protected _getWebVRViewMatrix(): Matrix;
  15828. protected _getWebVRProjectionMatrix(): Matrix;
  15829. initControllers(): void;
  15830. }
  15831. }
  15832. declare module BABYLON {
  15833. class ArcRotateCameraGamepadInput implements ICameraInput<ArcRotateCamera> {
  15834. camera: ArcRotateCamera;
  15835. gamepad: Gamepad;
  15836. private _gamepads;
  15837. gamepadRotationSensibility: number;
  15838. gamepadMoveSensibility: number;
  15839. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15840. detachControl(element: HTMLElement): void;
  15841. checkInputs(): void;
  15842. private _onNewGameConnected(gamepad);
  15843. getTypeName(): string;
  15844. getSimpleName(): string;
  15845. }
  15846. }
  15847. declare module BABYLON {
  15848. class ArcRotateCameraKeyboardMoveInput implements ICameraInput<ArcRotateCamera> {
  15849. camera: ArcRotateCamera;
  15850. private _keys;
  15851. private _onKeyDown;
  15852. private _onKeyUp;
  15853. private _onLostFocus;
  15854. keysUp: number[];
  15855. keysDown: number[];
  15856. keysLeft: number[];
  15857. keysRight: number[];
  15858. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15859. detachControl(element: HTMLElement): void;
  15860. checkInputs(): void;
  15861. getTypeName(): string;
  15862. getSimpleName(): string;
  15863. }
  15864. }
  15865. declare module BABYLON {
  15866. class ArcRotateCameraMouseWheelInput implements ICameraInput<ArcRotateCamera> {
  15867. camera: ArcRotateCamera;
  15868. private _wheel;
  15869. private _observer;
  15870. wheelPrecision: number;
  15871. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15872. detachControl(element: HTMLElement): void;
  15873. getTypeName(): string;
  15874. getSimpleName(): string;
  15875. }
  15876. }
  15877. declare module BABYLON {
  15878. class ArcRotateCameraPointersInput implements ICameraInput<ArcRotateCamera> {
  15879. camera: ArcRotateCamera;
  15880. buttons: number[];
  15881. angularSensibilityX: number;
  15882. angularSensibilityY: number;
  15883. pinchPrecision: number;
  15884. panningSensibility: number;
  15885. private _isPanClick;
  15886. pinchInwards: boolean;
  15887. private _pointerInput;
  15888. private _observer;
  15889. private _onMouseMove;
  15890. private _onGestureStart;
  15891. private _onGesture;
  15892. private _MSGestureHandler;
  15893. private _onLostFocus;
  15894. private _onContextMenu;
  15895. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15896. detachControl(element: HTMLElement): void;
  15897. getTypeName(): string;
  15898. getSimpleName(): string;
  15899. }
  15900. }
  15901. declare module BABYLON {
  15902. class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<ArcRotateCamera> {
  15903. camera: ArcRotateCamera;
  15904. alphaCorrection: number;
  15905. betaCorrection: number;
  15906. gammaCorrection: number;
  15907. private _alpha;
  15908. private _beta;
  15909. private _gamma;
  15910. private _dirty;
  15911. private _offsetOrientation;
  15912. private _deviceOrientationHandler;
  15913. constructor();
  15914. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15915. _onOrientationEvent(evt: DeviceOrientationEvent): void;
  15916. checkInputs(): void;
  15917. detachControl(element: HTMLElement): void;
  15918. getTypeName(): string;
  15919. getSimpleName(): string;
  15920. }
  15921. }
  15922. declare module BABYLON {
  15923. class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera> {
  15924. private _camera;
  15925. private _screenOrientationAngle;
  15926. private _constantTranform;
  15927. private _screenQuaternion;
  15928. private _alpha;
  15929. private _beta;
  15930. private _gamma;
  15931. constructor();
  15932. camera: FreeCamera;
  15933. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15934. private _orientationChanged;
  15935. private _deviceOrientation;
  15936. detachControl(element: HTMLElement): void;
  15937. checkInputs(): void;
  15938. getTypeName(): string;
  15939. getSimpleName(): string;
  15940. }
  15941. }
  15942. declare module BABYLON {
  15943. class FreeCameraGamepadInput implements ICameraInput<FreeCamera> {
  15944. camera: FreeCamera;
  15945. gamepad: Gamepad;
  15946. private _gamepads;
  15947. gamepadAngularSensibility: number;
  15948. gamepadMoveSensibility: number;
  15949. private _cameraTransform;
  15950. private _deltaTransform;
  15951. private _vector3;
  15952. private _vector2;
  15953. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15954. detachControl(element: HTMLElement): void;
  15955. checkInputs(): void;
  15956. private _onNewGameConnected(gamepad);
  15957. getTypeName(): string;
  15958. getSimpleName(): string;
  15959. }
  15960. }
  15961. declare module BABYLON {
  15962. class FreeCameraKeyboardMoveInput implements ICameraInput<FreeCamera> {
  15963. camera: FreeCamera;
  15964. private _keys;
  15965. private _onKeyDown;
  15966. private _onKeyUp;
  15967. keysUp: number[];
  15968. keysDown: number[];
  15969. keysLeft: number[];
  15970. keysRight: number[];
  15971. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15972. detachControl(element: HTMLElement): void;
  15973. checkInputs(): void;
  15974. getTypeName(): string;
  15975. _onLostFocus(e: FocusEvent): void;
  15976. getSimpleName(): string;
  15977. }
  15978. }
  15979. declare module BABYLON {
  15980. class FreeCameraMouseInput implements ICameraInput<FreeCamera> {
  15981. touchEnabled: boolean;
  15982. camera: FreeCamera;
  15983. buttons: number[];
  15984. angularSensibility: number;
  15985. private _pointerInput;
  15986. private _onMouseMove;
  15987. private _observer;
  15988. private previousPosition;
  15989. constructor(touchEnabled?: boolean);
  15990. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  15991. detachControl(element: HTMLElement): void;
  15992. getTypeName(): string;
  15993. getSimpleName(): string;
  15994. }
  15995. }
  15996. declare module BABYLON {
  15997. class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
  15998. camera: FreeCamera;
  15999. private _offsetX;
  16000. private _offsetY;
  16001. private _pointerCount;
  16002. private _pointerPressed;
  16003. private _pointerInput;
  16004. private _observer;
  16005. private _onLostFocus;
  16006. touchAngularSensibility: number;
  16007. touchMoveSensibility: number;
  16008. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  16009. detachControl(element: HTMLElement): void;
  16010. checkInputs(): void;
  16011. getTypeName(): string;
  16012. getSimpleName(): string;
  16013. }
  16014. }
  16015. declare module BABYLON {
  16016. class FreeCameraVirtualJoystickInput implements ICameraInput<FreeCamera> {
  16017. camera: FreeCamera;
  16018. private _leftjoystick;
  16019. private _rightjoystick;
  16020. getLeftJoystick(): VirtualJoystick;
  16021. getRightJoystick(): VirtualJoystick;
  16022. checkInputs(): void;
  16023. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  16024. detachControl(element: HTMLElement): void;
  16025. getTypeName(): string;
  16026. getSimpleName(): string;
  16027. }
  16028. }
  16029. declare module BABYLON {
  16030. interface IOctreeContainer<T> {
  16031. blocks: Array<OctreeBlock<T>>;
  16032. }
  16033. class Octree<T> {
  16034. maxDepth: number;
  16035. blocks: Array<OctreeBlock<T>>;
  16036. dynamicContent: T[];
  16037. private _maxBlockCapacity;
  16038. private _selectionContent;
  16039. private _creationFunc;
  16040. constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, maxDepth?: number);
  16041. update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void;
  16042. addMesh(entry: T): void;
  16043. select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T>;
  16044. intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T>;
  16045. intersectsRay(ray: Ray): SmartArray<T>;
  16046. static _CreateBlocks<T>(worldMin: Vector3, worldMax: Vector3, entries: T[], maxBlockCapacity: number, currentDepth: number, maxDepth: number, target: IOctreeContainer<T>, creationFunc: (entry: T, block: OctreeBlock<T>) => void): void;
  16047. static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>) => void;
  16048. static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock<SubMesh>) => void;
  16049. }
  16050. }
  16051. declare module BABYLON {
  16052. class OctreeBlock<T> {
  16053. entries: T[];
  16054. blocks: Array<OctreeBlock<T>>;
  16055. private _depth;
  16056. private _maxDepth;
  16057. private _capacity;
  16058. private _minPoint;
  16059. private _maxPoint;
  16060. private _boundingVectors;
  16061. private _creationFunc;
  16062. constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void);
  16063. readonly capacity: number;
  16064. readonly minPoint: Vector3;
  16065. readonly maxPoint: Vector3;
  16066. addEntry(entry: T): void;
  16067. addEntries(entries: T[]): void;
  16068. select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void;
  16069. intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void;
  16070. intersectsRay(ray: Ray, selection: SmartArray<T>): void;
  16071. createInnerBlocks(): void;
  16072. }
  16073. }
  16074. declare module BABYLON {
  16075. interface IShadowGenerator {
  16076. getShadowMap(): RenderTargetTexture;
  16077. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  16078. dispose(): void;
  16079. }
  16080. class ShadowGenerator implements IShadowGenerator {
  16081. private static _FILTER_NONE;
  16082. private static _FILTER_EXPONENTIALSHADOWMAP;
  16083. private static _FILTER_POISSONSAMPLING;
  16084. private static _FILTER_BLUREXPONENTIALSHADOWMAP;
  16085. static readonly FILTER_NONE: number;
  16086. static readonly FILTER_POISSONSAMPLING: number;
  16087. static readonly FILTER_EXPONENTIALSHADOWMAP: number;
  16088. static readonly FILTER_BLUREXPONENTIALSHADOWMAP: number;
  16089. private _filter;
  16090. blurScale: number;
  16091. private _blurBoxOffset;
  16092. private _bias;
  16093. private _lightDirection;
  16094. private _depthScale;
  16095. forceBackFacesOnly: boolean;
  16096. bias: number;
  16097. blurBoxOffset: number;
  16098. depthScale: number;
  16099. filter: number;
  16100. useVarianceShadowMap: boolean;
  16101. useExponentialShadowMap: boolean;
  16102. usePoissonSampling: boolean;
  16103. useBlurVarianceShadowMap: boolean;
  16104. useBlurExponentialShadowMap: boolean;
  16105. private _light;
  16106. private _scene;
  16107. private _shadowMap;
  16108. private _shadowMap2;
  16109. private _darkness;
  16110. private _transparencyShadow;
  16111. private _effect;
  16112. private _viewMatrix;
  16113. private _projectionMatrix;
  16114. private _transformMatrix;
  16115. private _worldViewProjection;
  16116. private _cachedPosition;
  16117. private _cachedDirection;
  16118. private _cachedDefines;
  16119. private _currentRenderID;
  16120. private _downSamplePostprocess;
  16121. private _boxBlurPostprocess;
  16122. private _mapSize;
  16123. private _currentFaceIndex;
  16124. private _currentFaceIndexCache;
  16125. private _useFullFloat;
  16126. /**
  16127. * Creates a ShadowGenerator object.
  16128. * A ShadowGenerator is the required tool to use the shadows.
  16129. * Each light casting shadows needs to use its own ShadowGenerator.
  16130. * Required parameters :
  16131. * - `mapSize` (integer), the size of the texture what stores the shadows. Example : 1024.
  16132. * - `light` : the light object generating the shadows.
  16133. * Documentation : http://doc.babylonjs.com/tutorials/shadows
  16134. */
  16135. constructor(mapSize: number, light: IShadowLight);
  16136. /**
  16137. * Boolean : true when the ShadowGenerator is finally computed.
  16138. */
  16139. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  16140. /**
  16141. * Returns a RenderTargetTexture object : the shadow map texture.
  16142. */
  16143. getShadowMap(): RenderTargetTexture;
  16144. /**
  16145. * Returns the most ready computed shadow map as a RenderTargetTexture object.
  16146. */
  16147. getShadowMapForRendering(): RenderTargetTexture;
  16148. /**
  16149. * Returns the associated light object.
  16150. */
  16151. getLight(): IShadowLight;
  16152. /**
  16153. * Returns a Matrix object : the updated transformation matrix.
  16154. */
  16155. getTransformMatrix(): Matrix;
  16156. /**
  16157. * Returns the darkness value (float).
  16158. */
  16159. getDarkness(): number;
  16160. /**
  16161. * Sets the ShadowGenerator darkness value (float <= 1.0).
  16162. * Returns the ShadowGenerator.
  16163. */
  16164. setDarkness(darkness: number): ShadowGenerator;
  16165. /**
  16166. * Sets the ability to have transparent shadow (boolean).
  16167. * Returns the ShadowGenerator.
  16168. */
  16169. setTransparencyShadow(hasShadow: boolean): ShadowGenerator;
  16170. private _packHalf(depth);
  16171. /**
  16172. * Disposes the ShadowGenerator.
  16173. * Returns nothing.
  16174. */
  16175. dispose(): void;
  16176. /**
  16177. * Serializes the ShadowGenerator and returns a serializationObject.
  16178. */
  16179. serialize(): any;
  16180. /**
  16181. * Parses a serialized ShadowGenerator and returns a new ShadowGenerator.
  16182. */
  16183. static Parse(parsedShadowGenerator: any, scene: Scene): ShadowGenerator;
  16184. }
  16185. }
  16186. declare module BABYLON {
  16187. class BaseTexture {
  16188. static DEFAULT_ANISOTROPIC_FILTERING_LEVEL: number;
  16189. name: string;
  16190. private _hasAlpha;
  16191. hasAlpha: boolean;
  16192. getAlphaFromRGB: boolean;
  16193. level: number;
  16194. coordinatesIndex: number;
  16195. private _coordinatesMode;
  16196. coordinatesMode: number;
  16197. wrapU: number;
  16198. wrapV: number;
  16199. anisotropicFilteringLevel: number;
  16200. isCube: boolean;
  16201. isRenderTarget: boolean;
  16202. readonly uid: string;
  16203. toString(): string;
  16204. animations: Animation[];
  16205. /**
  16206. * An event triggered when the texture is disposed.
  16207. * @type {BABYLON.Observable}
  16208. */
  16209. onDisposeObservable: Observable<BaseTexture>;
  16210. private _onDisposeObserver;
  16211. onDispose: () => void;
  16212. delayLoadState: number;
  16213. _cachedAnisotropicFilteringLevel: number;
  16214. private _scene;
  16215. _texture: WebGLTexture;
  16216. private _uid;
  16217. constructor(scene: Scene);
  16218. getScene(): Scene;
  16219. getTextureMatrix(): Matrix;
  16220. getReflectionTextureMatrix(): Matrix;
  16221. getInternalTexture(): WebGLTexture;
  16222. isReady(): boolean;
  16223. getSize(): ISize;
  16224. getBaseSize(): ISize;
  16225. scale(ratio: number): void;
  16226. readonly canRescale: boolean;
  16227. _removeFromCache(url: string, noMipmap: boolean): void;
  16228. _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture;
  16229. delayLoad(): void;
  16230. clone(): BaseTexture;
  16231. releaseInternalTexture(): void;
  16232. dispose(): void;
  16233. serialize(): any;
  16234. }
  16235. }
  16236. declare module BABYLON {
  16237. /**
  16238. * This represents a color grading texture. This acts as a lookup table LUT, useful during post process
  16239. * It can help converting any input color in a desired output one. This can then be used to create effects
  16240. * from sepia, black and white to sixties or futuristic rendering...
  16241. *
  16242. * The only supported format is currently 3dl.
  16243. * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table/
  16244. */
  16245. class ColorGradingTexture extends BaseTexture {
  16246. /**
  16247. * The current internal texture size.
  16248. */
  16249. private _size;
  16250. /**
  16251. * The current texture matrix. (will always be identity in color grading texture)
  16252. */
  16253. private _textureMatrix;
  16254. /**
  16255. * The texture URL.
  16256. */
  16257. url: string;
  16258. /**
  16259. * Empty line regex stored for GC.
  16260. */
  16261. private static _noneEmptyLineRegex;
  16262. /**
  16263. * Instantiates a ColorGradingTexture from the following parameters.
  16264. *
  16265. * @param url The location of the color gradind data (currently only supporting 3dl)
  16266. * @param scene The scene the texture will be used in
  16267. */
  16268. constructor(url: string, scene: Scene);
  16269. /**
  16270. * Returns the texture matrix used in most of the material.
  16271. * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).
  16272. */
  16273. getTextureMatrix(): Matrix;
  16274. /**
  16275. * Occurs when the file being loaded is a .3dl LUT file.
  16276. */
  16277. private load3dlTexture();
  16278. /**
  16279. * Starts the loading process of the texture.
  16280. */
  16281. private loadTexture();
  16282. /**
  16283. * Clones the color gradind texture.
  16284. */
  16285. clone(): ColorGradingTexture;
  16286. /**
  16287. * Called during delayed load for textures.
  16288. */
  16289. delayLoad(): void;
  16290. /**
  16291. * Binds the color grading to the shader.
  16292. * @param colorGrading The texture to bind
  16293. * @param effect The effect to bind to
  16294. */
  16295. static Bind(colorGrading: BaseTexture, effect: Effect): void;
  16296. /**
  16297. * Prepare the list of uniforms associated with the ColorGrading effects.
  16298. * @param uniformsList The list of uniforms used in the effect
  16299. * @param samplersList The list of samplers used in the effect
  16300. */
  16301. static PrepareUniformsAndSamplers(uniformsList: string[], samplersList: string[]): void;
  16302. /**
  16303. * Parses a color grading texture serialized by Babylon.
  16304. * @param parsedTexture The texture information being parsedTexture
  16305. * @param scene The scene to load the texture in
  16306. * @param rootUrl The root url of the data assets to load
  16307. * @return A color gradind texture
  16308. */
  16309. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): ColorGradingTexture;
  16310. /**
  16311. * Serializes the LUT texture to json format.
  16312. */
  16313. serialize(): any;
  16314. }
  16315. }
  16316. declare module BABYLON {
  16317. class CubeTexture extends BaseTexture {
  16318. url: string;
  16319. coordinatesMode: number;
  16320. private _noMipmap;
  16321. private _files;
  16322. private _extensions;
  16323. private _textureMatrix;
  16324. private _format;
  16325. static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture;
  16326. constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean, files?: string[], onLoad?: () => void, onError?: () => void, format?: number);
  16327. delayLoad(): void;
  16328. getReflectionTextureMatrix(): Matrix;
  16329. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture;
  16330. clone(): CubeTexture;
  16331. }
  16332. }
  16333. declare module BABYLON {
  16334. class DynamicTexture extends Texture {
  16335. private _generateMipMaps;
  16336. private _canvas;
  16337. private _context;
  16338. constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number, format?: number);
  16339. readonly canRescale: boolean;
  16340. private _recreate(textureSize);
  16341. scale(ratio: number): void;
  16342. scaleTo(width: number, height: number): void;
  16343. getContext(): CanvasRenderingContext2D;
  16344. clear(): void;
  16345. update(invertY?: boolean): void;
  16346. drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void;
  16347. clone(): DynamicTexture;
  16348. }
  16349. }
  16350. declare module BABYLON {
  16351. /**
  16352. * This represents a texture coming from an HDR input.
  16353. *
  16354. * The only supported format is currently panorama picture stored in RGBE format.
  16355. * Example of such files can be found on HDRLib: http://hdrlib.com/
  16356. */
  16357. class HDRCubeTexture extends BaseTexture {
  16358. private static _facesMapping;
  16359. private _useInGammaSpace;
  16360. private _generateHarmonics;
  16361. private _noMipmap;
  16362. private _extensions;
  16363. private _textureMatrix;
  16364. private _size;
  16365. private _usePMREMGenerator;
  16366. private _isBABYLONPreprocessed;
  16367. private _onLoad;
  16368. private _onError;
  16369. /**
  16370. * The texture URL.
  16371. */
  16372. url: string;
  16373. /**
  16374. * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.
  16375. */
  16376. coordinatesMode: number;
  16377. /**
  16378. * The spherical polynomial data extracted from the texture.
  16379. */
  16380. sphericalPolynomial: SphericalPolynomial;
  16381. /**
  16382. * Specifies wether the texture has been generated through the PMREMGenerator tool.
  16383. * This is usefull at run time to apply the good shader.
  16384. */
  16385. isPMREM: boolean;
  16386. /**
  16387. * Instantiates an HDRTexture from the following parameters.
  16388. *
  16389. * @param url The location of the HDR raw data (Panorama stored in RGBE format)
  16390. * @param scene The scene the texture will be used in
  16391. * @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.
  16392. * @param noMipmap Forces to not generate the mipmap if true
  16393. * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
  16394. * @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)
  16395. * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
  16396. */
  16397. constructor(url: string, scene: Scene, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean, onLoad?: () => void, onError?: () => void);
  16398. /**
  16399. * Occurs when the file is a preprocessed .babylon.hdr file.
  16400. */
  16401. private loadBabylonTexture();
  16402. /**
  16403. * Occurs when the file is raw .hdr file.
  16404. */
  16405. private loadHDRTexture();
  16406. /**
  16407. * Starts the loading process of the texture.
  16408. */
  16409. private loadTexture();
  16410. clone(): HDRCubeTexture;
  16411. delayLoad(): void;
  16412. getReflectionTextureMatrix(): Matrix;
  16413. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): HDRCubeTexture;
  16414. serialize(): any;
  16415. /**
  16416. * Saves as a file the data contained in the texture in a binary format.
  16417. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  16418. * as the spherical used in the lighting.
  16419. * @param url The HDR file url.
  16420. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  16421. * @param onError Method called if any error happens during download.
  16422. * @return The packed binary data.
  16423. */
  16424. static generateBabylonHDROnDisk(url: string, size: number, onError?: (() => void)): void;
  16425. /**
  16426. * Serializes the data contained in the texture in a binary format.
  16427. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  16428. * as the spherical used in the lighting.
  16429. * @param url The HDR file url.
  16430. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  16431. * @param onError Method called if any error happens during download.
  16432. * @return The packed binary data.
  16433. */
  16434. static generateBabylonHDR(url: string, size: number, callback: ((ArrayBuffer: ArrayBuffer) => void), onError?: (() => void)): void;
  16435. }
  16436. }
  16437. declare module BABYLON {
  16438. class MapTexture extends Texture {
  16439. private _rectPackingMap;
  16440. private _size;
  16441. private _replacedViewport;
  16442. constructor(name: string, scene: Scene, size: ISize, samplingMode?: number, useMipMap?: boolean, margin?: number);
  16443. /**
  16444. * Allocate a rectangle of a given size in the texture map
  16445. * @param size the size of the rectangle to allocation
  16446. * @return the PackedRect instance corresponding to the allocated rect or null is there was not enough space to allocate it.
  16447. */
  16448. allocateRect(size: Size): PackedRect;
  16449. /**
  16450. * Free a given rectangle from the texture map
  16451. * @param rectInfo the instance corresponding to the rect to free.
  16452. */
  16453. freeRect(rectInfo: PackedRect): void;
  16454. /**
  16455. * Return the available space in the range of [O;1]. 0 being not space left at all, 1 being an empty texture map.
  16456. * This is the cumulated space, not the biggest available surface. Due to fragmentation you may not allocate a rect corresponding to this surface.
  16457. * @returns {}
  16458. */
  16459. readonly freeSpace: number;
  16460. /**
  16461. * Bind the texture to the rendering engine to render in the zone of a given rectangle.
  16462. * 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.
  16463. * Don't forget to call unbindTexture when you're done rendering
  16464. * @param rect the zone to render to
  16465. * @param clear true to clear the portion's color/depth data
  16466. */
  16467. bindTextureForRect(rect: PackedRect, clear: boolean): void;
  16468. /**
  16469. * Bind the texture to the rendering engine to render in the zone of the given size at the given position.
  16470. * 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.
  16471. * Don't forget to call unbindTexture when you're done rendering
  16472. * @param pos the position into the texture
  16473. * @param size the portion to fit the clip space to
  16474. * @param clear true to clear the portion's color/depth data
  16475. */
  16476. bindTextureForPosSize(pos: Vector2, size: Size, clear: boolean): void;
  16477. /**
  16478. * Unbind the texture map from the rendering engine.
  16479. * Call this method when you're done rendering. A previous call to bindTextureForRect has to be made.
  16480. * @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.
  16481. */
  16482. unbindTexture(dumpForDebug?: boolean): void;
  16483. readonly canRescale: boolean;
  16484. clone(): MapTexture;
  16485. }
  16486. }
  16487. declare module BABYLON {
  16488. class MirrorTexture extends RenderTargetTexture {
  16489. mirrorPlane: Plane;
  16490. private _transformMatrix;
  16491. private _mirrorMatrix;
  16492. private _savedViewMatrix;
  16493. constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, type?: number, samplingMode?: number, generateDepthBuffer?: boolean);
  16494. clone(): MirrorTexture;
  16495. serialize(): any;
  16496. }
  16497. }
  16498. declare module BABYLON {
  16499. class RawTexture extends Texture {
  16500. format: number;
  16501. constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  16502. update(data: ArrayBufferView): void;
  16503. static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  16504. static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  16505. static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  16506. static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  16507. static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  16508. }
  16509. }
  16510. declare module BABYLON {
  16511. /**
  16512. * Creates a refraction texture used by refraction channel of the standard material.
  16513. * @param name the texture name
  16514. * @param size size of the underlying texture
  16515. * @param scene root scene
  16516. */
  16517. class RefractionTexture extends RenderTargetTexture {
  16518. refractionPlane: Plane;
  16519. depth: number;
  16520. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  16521. clone(): RefractionTexture;
  16522. serialize(): any;
  16523. }
  16524. }
  16525. declare module BABYLON {
  16526. interface IRenderTargetOptions {
  16527. generateMipMaps: boolean;
  16528. type: number;
  16529. samplingMode: number;
  16530. generateDepthBuffer: boolean;
  16531. generateStencilBuffer: boolean;
  16532. }
  16533. class RenderTargetTexture extends Texture {
  16534. isCube: boolean;
  16535. static _REFRESHRATE_RENDER_ONCE: number;
  16536. static _REFRESHRATE_RENDER_ONEVERYFRAME: number;
  16537. static _REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  16538. static readonly REFRESHRATE_RENDER_ONCE: number;
  16539. static readonly REFRESHRATE_RENDER_ONEVERYFRAME: number;
  16540. static readonly REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  16541. /**
  16542. * Use this predicate to dynamically define the list of mesh you want to render.
  16543. * If set, the renderList property will be overwritten.
  16544. */
  16545. renderListPredicate: (AbstractMesh: AbstractMesh) => boolean;
  16546. /**
  16547. * Use this list to define the list of mesh you want to render.
  16548. */
  16549. renderList: AbstractMesh[];
  16550. renderParticles: boolean;
  16551. renderSprites: boolean;
  16552. coordinatesMode: number;
  16553. activeCamera: Camera;
  16554. customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents?: () => void) => void;
  16555. useCameraPostProcesses: boolean;
  16556. /**
  16557. * An event triggered when the texture is unbind.
  16558. * @type {BABYLON.Observable}
  16559. */
  16560. onAfterUnbindObservable: Observable<RenderTargetTexture>;
  16561. private _onAfterUnbindObserver;
  16562. onAfterUnbind: () => void;
  16563. /**
  16564. * An event triggered before rendering the texture
  16565. * @type {BABYLON.Observable}
  16566. */
  16567. onBeforeRenderObservable: Observable<number>;
  16568. private _onBeforeRenderObserver;
  16569. onBeforeRender: (faceIndex: number) => void;
  16570. /**
  16571. * An event triggered after rendering the texture
  16572. * @type {BABYLON.Observable}
  16573. */
  16574. onAfterRenderObservable: Observable<number>;
  16575. private _onAfterRenderObserver;
  16576. onAfterRender: (faceIndex: number) => void;
  16577. /**
  16578. * An event triggered after the texture clear
  16579. * @type {BABYLON.Observable}
  16580. */
  16581. onClearObservable: Observable<Engine>;
  16582. private _onClearObserver;
  16583. onClear: (Engine: Engine) => void;
  16584. private _size;
  16585. _generateMipMaps: boolean;
  16586. private _renderingManager;
  16587. _waitingRenderList: string[];
  16588. private _doNotChangeAspectRatio;
  16589. private _currentRefreshId;
  16590. private _refreshRate;
  16591. private _textureMatrix;
  16592. private _samples;
  16593. protected _renderTargetOptions: IRenderTargetOptions;
  16594. readonly renderTargetOptions: IRenderTargetOptions;
  16595. constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean, samplingMode?: number, generateDepthBuffer?: boolean, generateStencilBuffer?: boolean);
  16596. samples: number;
  16597. resetRefreshCounter(): void;
  16598. refreshRate: number;
  16599. _shouldRender(): boolean;
  16600. isReady(): boolean;
  16601. getRenderSize(): number;
  16602. readonly canRescale: boolean;
  16603. scale(ratio: number): void;
  16604. getReflectionTextureMatrix(): Matrix;
  16605. resize(size: any): void;
  16606. render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void;
  16607. renderToTarget(faceIndex: number, currentRenderList: AbstractMesh[], currentRenderListLength: number, useCameraPostProcess: boolean, dumpForDebug: boolean): void;
  16608. /**
  16609. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  16610. * This allowed control for front to back rendering or reversly depending of the special needs.
  16611. *
  16612. * @param renderingGroupId The rendering group id corresponding to its index
  16613. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  16614. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  16615. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  16616. */
  16617. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  16618. /**
  16619. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  16620. *
  16621. * @param renderingGroupId The rendering group id corresponding to its index
  16622. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  16623. */
  16624. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  16625. clone(): RenderTargetTexture;
  16626. serialize(): any;
  16627. }
  16628. }
  16629. declare module BABYLON {
  16630. class Texture extends BaseTexture {
  16631. static NEAREST_SAMPLINGMODE: number;
  16632. static BILINEAR_SAMPLINGMODE: number;
  16633. static TRILINEAR_SAMPLINGMODE: number;
  16634. static EXPLICIT_MODE: number;
  16635. static SPHERICAL_MODE: number;
  16636. static PLANAR_MODE: number;
  16637. static CUBIC_MODE: number;
  16638. static PROJECTION_MODE: number;
  16639. static SKYBOX_MODE: number;
  16640. static INVCUBIC_MODE: number;
  16641. static EQUIRECTANGULAR_MODE: number;
  16642. static FIXED_EQUIRECTANGULAR_MODE: number;
  16643. static FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number;
  16644. static CLAMP_ADDRESSMODE: number;
  16645. static WRAP_ADDRESSMODE: number;
  16646. static MIRROR_ADDRESSMODE: number;
  16647. url: string;
  16648. uOffset: number;
  16649. vOffset: number;
  16650. uScale: number;
  16651. vScale: number;
  16652. uAng: number;
  16653. vAng: number;
  16654. wAng: number;
  16655. readonly noMipmap: boolean;
  16656. private _noMipmap;
  16657. _invertY: boolean;
  16658. private _rowGenerationMatrix;
  16659. private _cachedTextureMatrix;
  16660. private _projectionModeMatrix;
  16661. private _t0;
  16662. private _t1;
  16663. private _t2;
  16664. private _cachedUOffset;
  16665. private _cachedVOffset;
  16666. private _cachedUScale;
  16667. private _cachedVScale;
  16668. private _cachedUAng;
  16669. private _cachedVAng;
  16670. private _cachedWAng;
  16671. private _cachedCoordinatesMode;
  16672. _samplingMode: number;
  16673. private _buffer;
  16674. private _deleteBuffer;
  16675. protected _format: number;
  16676. private _delayedOnLoad;
  16677. private _delayedOnError;
  16678. private _onLoadObservarble;
  16679. constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean, format?: number);
  16680. delayLoad(): void;
  16681. updateSamplingMode(samplingMode: number): void;
  16682. private _prepareRowForTextureGeneration(x, y, z, t);
  16683. getTextureMatrix(): Matrix;
  16684. getReflectionTextureMatrix(): Matrix;
  16685. clone(): Texture;
  16686. readonly onLoadObservable: Observable<boolean>;
  16687. static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, format?: number): Texture;
  16688. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture;
  16689. static LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, format?: number): Texture;
  16690. }
  16691. }
  16692. declare module BABYLON {
  16693. class VideoTexture extends Texture {
  16694. video: HTMLVideoElement;
  16695. private _autoLaunch;
  16696. private _lastUpdate;
  16697. private _generateMipMaps;
  16698. /**
  16699. * Creates a video texture.
  16700. * Sample : https://doc.babylonjs.com/tutorials/01._Advanced_Texturing
  16701. * @param {Array} urlsOrVideo can be used to provide an array of urls or an already setup HTML video element.
  16702. * @param {BABYLON.Scene} scene is obviously the current scene.
  16703. * @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
  16704. * @param {boolean} invertY is false by default but can be used to invert video on Y axis
  16705. * @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
  16706. */
  16707. constructor(name: string, urlsOrVideo: string[] | HTMLVideoElement, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  16708. private _createTexture();
  16709. update(): boolean;
  16710. static CreateFromWebCam(scene: Scene, onReady: (videoTexture: VideoTexture) => void, constraints: {
  16711. minWidth: number;
  16712. maxWidth: number;
  16713. minHeight: number;
  16714. maxHeight: number;
  16715. deviceId: string;
  16716. }): void;
  16717. }
  16718. }
  16719. declare module BABYLON.Internals {
  16720. }
  16721. declare module BABYLON {
  16722. class CannonJSPlugin implements IPhysicsEnginePlugin {
  16723. private _useDeltaForWorldStep;
  16724. world: any;
  16725. name: string;
  16726. private _physicsMaterials;
  16727. private _fixedTimeStep;
  16728. private _currentCollisionGroup;
  16729. constructor(_useDeltaForWorldStep?: boolean, iterations?: number);
  16730. setGravity(gravity: Vector3): void;
  16731. setTimeStep(timeStep: number): void;
  16732. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  16733. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  16734. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  16735. generatePhysicsBody(impostor: PhysicsImpostor): void;
  16736. private _processChildMeshes(mainImpostor);
  16737. removePhysicsBody(impostor: PhysicsImpostor): void;
  16738. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  16739. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  16740. private _addMaterial(name, friction, restitution);
  16741. private _checkWithEpsilon(value);
  16742. private _createShape(impostor);
  16743. private _createHeightmap(object, pointDepth?);
  16744. private _minus90X;
  16745. private _plus90X;
  16746. private _tmpPosition;
  16747. private _tmpQuaternion;
  16748. private _tmpDeltaPosition;
  16749. private _tmpDeltaRotation;
  16750. private _tmpUnityRotation;
  16751. private _updatePhysicsBodyTransformation(impostor);
  16752. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  16753. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  16754. isSupported(): boolean;
  16755. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  16756. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  16757. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  16758. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  16759. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  16760. sleepBody(impostor: PhysicsImpostor): void;
  16761. wakeUpBody(impostor: PhysicsImpostor): void;
  16762. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  16763. private enableMotor(joint, motorIndex?);
  16764. private disableMotor(joint, motorIndex?);
  16765. setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number, motorIndex?: number): void;
  16766. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number): void;
  16767. dispose(): void;
  16768. }
  16769. }
  16770. declare module BABYLON {
  16771. class OimoJSPlugin implements IPhysicsEnginePlugin {
  16772. world: any;
  16773. name: string;
  16774. constructor(iterations?: number);
  16775. setGravity(gravity: Vector3): void;
  16776. setTimeStep(timeStep: number): void;
  16777. private _tmpImpostorsArray;
  16778. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  16779. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  16780. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  16781. generatePhysicsBody(impostor: PhysicsImpostor): void;
  16782. private _tmpPositionVector;
  16783. removePhysicsBody(impostor: PhysicsImpostor): void;
  16784. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  16785. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  16786. isSupported(): boolean;
  16787. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  16788. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  16789. private _getLastShape(body);
  16790. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  16791. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  16792. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  16793. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  16794. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  16795. sleepBody(impostor: PhysicsImpostor): void;
  16796. wakeUpBody(impostor: PhysicsImpostor): void;
  16797. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  16798. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
  16799. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  16800. dispose(): void;
  16801. }
  16802. }
  16803. declare module BABYLON {
  16804. class PostProcessRenderEffect {
  16805. private _engine;
  16806. private _postProcesses;
  16807. private _getPostProcess;
  16808. private _singleInstance;
  16809. private _cameras;
  16810. private _indicesForCamera;
  16811. private _renderPasses;
  16812. private _renderEffectAsPasses;
  16813. _name: string;
  16814. applyParameters: (postProcess: PostProcess) => void;
  16815. constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean);
  16816. readonly isSupported: boolean;
  16817. _update(): void;
  16818. addPass(renderPass: PostProcessRenderPass): void;
  16819. removePass(renderPass: PostProcessRenderPass): void;
  16820. addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void;
  16821. getPass(passName: string): void;
  16822. emptyPasses(): void;
  16823. _attachCameras(cameras: Camera): any;
  16824. _attachCameras(cameras: Camera[]): any;
  16825. _detachCameras(cameras: Camera): any;
  16826. _detachCameras(cameras: Camera[]): any;
  16827. _enable(cameras: Camera): any;
  16828. _enable(cameras: Camera[]): any;
  16829. _disable(cameras: Camera): any;
  16830. _disable(cameras: Camera[]): any;
  16831. getPostProcess(camera?: Camera): PostProcess;
  16832. private _linkParameters();
  16833. private _linkTextures(effect);
  16834. }
  16835. }
  16836. declare module BABYLON {
  16837. class PostProcessRenderPass {
  16838. private _enabled;
  16839. private _renderList;
  16840. private _renderTexture;
  16841. private _scene;
  16842. private _refCount;
  16843. _name: string;
  16844. constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void);
  16845. _incRefCount(): number;
  16846. _decRefCount(): number;
  16847. _update(): void;
  16848. setRenderList(renderList: Mesh[]): void;
  16849. getRenderTexture(): RenderTargetTexture;
  16850. }
  16851. }
  16852. declare module BABYLON {
  16853. class PostProcessRenderPipeline {
  16854. private _engine;
  16855. private _renderEffects;
  16856. private _renderEffectsForIsolatedPass;
  16857. protected _cameras: Camera[];
  16858. _name: string;
  16859. private static PASS_EFFECT_NAME;
  16860. private static PASS_SAMPLER_NAME;
  16861. constructor(engine: Engine, name: string);
  16862. readonly isSupported: boolean;
  16863. addEffect(renderEffect: PostProcessRenderEffect): void;
  16864. _enableEffect(renderEffectName: string, cameras: Camera): any;
  16865. _enableEffect(renderEffectName: string, cameras: Camera[]): any;
  16866. _disableEffect(renderEffectName: string, cameras: Camera): any;
  16867. _disableEffect(renderEffectName: string, cameras: Camera[]): any;
  16868. _attachCameras(cameras: Camera, unique: boolean): any;
  16869. _attachCameras(cameras: Camera[], unique: boolean): any;
  16870. _detachCameras(cameras: Camera): any;
  16871. _detachCameras(cameras: Camera[]): any;
  16872. _enableDisplayOnlyPass(passName: any, cameras: Camera): any;
  16873. _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any;
  16874. _disableDisplayOnlyPass(cameras: Camera): any;
  16875. _disableDisplayOnlyPass(cameras: Camera[]): any;
  16876. _update(): void;
  16877. dispose(): void;
  16878. }
  16879. }
  16880. declare module BABYLON {
  16881. class PostProcessRenderPipelineManager {
  16882. private _renderPipelines;
  16883. constructor();
  16884. addPipeline(renderPipeline: PostProcessRenderPipeline): void;
  16885. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any;
  16886. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any;
  16887. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any;
  16888. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any;
  16889. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  16890. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  16891. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  16892. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  16893. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any;
  16894. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any;
  16895. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any;
  16896. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any;
  16897. update(): void;
  16898. }
  16899. }
  16900. declare module BABYLON.Internals {
  16901. /**
  16902. * Helper class dealing with the extraction of spherical polynomial dataArray
  16903. * from a cube map.
  16904. */
  16905. class CubeMapToSphericalPolynomialTools {
  16906. private static FileFaces;
  16907. /**
  16908. * Converts a cubemap to the according Spherical Polynomial data.
  16909. * This extracts the first 3 orders only as they are the only one used in the lighting.
  16910. *
  16911. * @param cubeInfo The Cube map to extract the information from.
  16912. * @return The Spherical Polynomial data.
  16913. */
  16914. static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial;
  16915. }
  16916. }
  16917. declare module BABYLON.Internals {
  16918. /**
  16919. * Header information of HDR texture files.
  16920. */
  16921. interface HDRInfo {
  16922. /**
  16923. * The height of the texture in pixels.
  16924. */
  16925. height: number;
  16926. /**
  16927. * The width of the texture in pixels.
  16928. */
  16929. width: number;
  16930. /**
  16931. * The index of the beginning of the data in the binary file.
  16932. */
  16933. dataPosition: number;
  16934. }
  16935. /**
  16936. * This groups tools to convert HDR texture to native colors array.
  16937. */
  16938. class HDRTools {
  16939. private static Ldexp(mantissa, exponent);
  16940. private static Rgbe2float(float32array, red, green, blue, exponent, index);
  16941. private static readStringLine(uint8array, startIndex);
  16942. /**
  16943. * Reads header information from an RGBE texture stored in a native array.
  16944. * More information on this format are available here:
  16945. * https://en.wikipedia.org/wiki/RGBE_image_format
  16946. *
  16947. * @param uint8array The binary file stored in native array.
  16948. * @return The header information.
  16949. */
  16950. static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo;
  16951. /**
  16952. * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.
  16953. * This RGBE texture needs to store the information as a panorama.
  16954. *
  16955. * More information on this format are available here:
  16956. * https://en.wikipedia.org/wiki/RGBE_image_format
  16957. *
  16958. * @param buffer The binary file stored in an array buffer.
  16959. * @param size The expected size of the extracted cubemap.
  16960. * @return The Cube Map information.
  16961. */
  16962. static GetCubeMapTextureData(buffer: ArrayBuffer, size: number): CubeMapInfo;
  16963. /**
  16964. * Returns the pixels data extracted from an RGBE texture.
  16965. * This pixels will be stored left to right up to down in the R G B order in one array.
  16966. *
  16967. * More information on this format are available here:
  16968. * https://en.wikipedia.org/wiki/RGBE_image_format
  16969. *
  16970. * @param uint8array The binary file stored in an array buffer.
  16971. * @param hdrInfo The header information of the file.
  16972. * @return The pixels data in RGB right to left up to down order.
  16973. */
  16974. static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array;
  16975. private static RGBE_ReadPixels_RLE(uint8array, hdrInfo);
  16976. }
  16977. }
  16978. declare module BABYLON.Internals {
  16979. /**
  16980. * CubeMap information grouping all the data for each faces as well as the cubemap size.
  16981. */
  16982. interface CubeMapInfo {
  16983. /**
  16984. * The pixel array for the front face.
  16985. * This is stored in RGB, left to right, up to down format.
  16986. */
  16987. front: Float32Array;
  16988. /**
  16989. * The pixel array for the back face.
  16990. * This is stored in RGB, left to right, up to down format.
  16991. */
  16992. back: Float32Array;
  16993. /**
  16994. * The pixel array for the left face.
  16995. * This is stored in RGB, left to right, up to down format.
  16996. */
  16997. left: Float32Array;
  16998. /**
  16999. * The pixel array for the right face.
  17000. * This is stored in RGB, left to right, up to down format.
  17001. */
  17002. right: Float32Array;
  17003. /**
  17004. * The pixel array for the up face.
  17005. * This is stored in RGB, left to right, up to down format.
  17006. */
  17007. up: Float32Array;
  17008. /**
  17009. * The pixel array for the down face.
  17010. * This is stored in RGB, left to right, up to down format.
  17011. */
  17012. down: Float32Array;
  17013. /**
  17014. * The size of the cubemap stored.
  17015. *
  17016. * Each faces will be size * size pixels.
  17017. */
  17018. size: number;
  17019. }
  17020. /**
  17021. * Helper class usefull to convert panorama picture to their cubemap representation in 6 faces.
  17022. */
  17023. class PanoramaToCubeMapTools {
  17024. private static FACE_FRONT;
  17025. private static FACE_BACK;
  17026. private static FACE_RIGHT;
  17027. private static FACE_LEFT;
  17028. private static FACE_DOWN;
  17029. private static FACE_UP;
  17030. /**
  17031. * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces).
  17032. *
  17033. * @param float32Array The source data.
  17034. * @param inputWidth The width of the input panorama.
  17035. * @param inputhHeight The height of the input panorama.
  17036. * @param size The willing size of the generated cubemap (each faces will be size * size pixels)
  17037. * @return The cubemap data
  17038. */
  17039. static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number): CubeMapInfo;
  17040. private static CreateCubemapTexture(texSize, faceData, float32Array, inputWidth, inputHeight);
  17041. private static CalcProjectionSpherical(vDir, float32Array, inputWidth, inputHeight);
  17042. }
  17043. }
  17044. declare namespace BABYLON.Internals {
  17045. /**
  17046. * Helper class to PreProcess a cubemap in order to generate mipmap according to the level of blur
  17047. * required by the glossinees of a material.
  17048. *
  17049. * This only supports the cosine drop power as well as Warp fixup generation method.
  17050. *
  17051. * This is using the process from CubeMapGen described here:
  17052. * https://seblagarde.wordpress.com/2012/06/10/amd-cubemapgen-for-physically-based-rendering/
  17053. */
  17054. class PMREMGenerator {
  17055. input: ArrayBufferView[];
  17056. inputSize: number;
  17057. outputSize: number;
  17058. maxNumMipLevels: number;
  17059. numChannels: number;
  17060. isFloat: boolean;
  17061. specularPower: number;
  17062. cosinePowerDropPerMip: number;
  17063. excludeBase: boolean;
  17064. fixup: boolean;
  17065. private static CP_MAX_MIPLEVELS;
  17066. private static CP_UDIR;
  17067. private static CP_VDIR;
  17068. private static CP_FACEAXIS;
  17069. private static CP_FACE_X_POS;
  17070. private static CP_FACE_X_NEG;
  17071. private static CP_FACE_Y_POS;
  17072. private static CP_FACE_Y_NEG;
  17073. private static CP_FACE_Z_POS;
  17074. private static CP_FACE_Z_NEG;
  17075. private static CP_EDGE_LEFT;
  17076. private static CP_EDGE_RIGHT;
  17077. private static CP_EDGE_TOP;
  17078. private static CP_EDGE_BOTTOM;
  17079. private static CP_CORNER_NNN;
  17080. private static CP_CORNER_NNP;
  17081. private static CP_CORNER_NPN;
  17082. private static CP_CORNER_NPP;
  17083. private static CP_CORNER_PNN;
  17084. private static CP_CORNER_PNP;
  17085. private static CP_CORNER_PPN;
  17086. private static CP_CORNER_PPP;
  17087. private static _vectorTemp;
  17088. private static _sgFace2DMapping;
  17089. private static _sgCubeNgh;
  17090. private static _sgCubeEdgeList;
  17091. private static _sgCubeCornerList;
  17092. private _outputSurface;
  17093. private _normCubeMap;
  17094. private _filterLUT;
  17095. private _numMipLevels;
  17096. /**
  17097. * Constructor of the generator.
  17098. *
  17099. * @param input The different faces data from the original cubemap in the order X+ X- Y+ Y- Z+ Z-
  17100. * @param inputSize The size of the cubemap faces
  17101. * @param outputSize The size of the output cubemap faces
  17102. * @param maxNumMipLevels The max number of mip map to generate (0 means all)
  17103. * @param numChannels The number of channels stored in the cubemap (3 for RBGE for instance)
  17104. * @param isFloat Specifies if the input texture is in float or int (hdr is usually in float)
  17105. * @param specularPower The max specular level of the desired cubemap
  17106. * @param cosinePowerDropPerMip The amount of drop the specular power will follow on each mip
  17107. * @param excludeBase Specifies wether to process the level 0 (original level) or not
  17108. * @param fixup Specifies wether to apply the edge fixup algorythm or not
  17109. */
  17110. constructor(input: ArrayBufferView[], inputSize: number, outputSize: number, maxNumMipLevels: number, numChannels: number, isFloat: boolean, specularPower: number, cosinePowerDropPerMip: number, excludeBase: boolean, fixup: boolean);
  17111. /**
  17112. * Launches the filter process and return the result.
  17113. *
  17114. * @return the filter cubemap in the form mip0 [faces1..6] .. mipN [faces1..6]
  17115. */
  17116. filterCubeMap(): ArrayBufferView[][];
  17117. private init();
  17118. private filterCubeMapMipChain();
  17119. private getBaseFilterAngle(cosinePower);
  17120. private precomputeFilterLookupTables(srcCubeMapWidth);
  17121. private buildNormalizerSolidAngleCubemap(size);
  17122. private texelCoordToVect(faceIdx, u, v, size, fixup);
  17123. private vectToTexelCoord(x, y, z, size);
  17124. private areaElement(x, y);
  17125. private texelCoordSolidAngle(faceIdx, u, v, size);
  17126. private filterCubeSurfaces(srcCubeMap, srcSize, dstCubeMap, dstSize, filterConeAngle, specularPower);
  17127. private clearFilterExtents(filterExtents);
  17128. private determineFilterExtents(centerTapDir, srcSize, bboxSize, filterExtents);
  17129. private processFilterExtents(centerTapDir, dotProdThresh, filterExtents, srcCubeMap, srcSize, specularPower);
  17130. private fixupCubeEdges(cubeMap, cubeMapSize);
  17131. }
  17132. }
  17133. declare module BABYLON {
  17134. class CustomProceduralTexture extends ProceduralTexture {
  17135. private _animate;
  17136. private _time;
  17137. private _config;
  17138. private _texturePath;
  17139. constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  17140. private loadJson(jsonUrl);
  17141. isReady(): boolean;
  17142. render(useCameraPostProcess?: boolean): void;
  17143. updateTextures(): void;
  17144. updateShaderUniforms(): void;
  17145. animate: boolean;
  17146. }
  17147. }
  17148. declare module BABYLON {
  17149. class ProceduralTexture extends Texture {
  17150. isCube: boolean;
  17151. private _size;
  17152. _generateMipMaps: boolean;
  17153. isEnabled: boolean;
  17154. private _doNotChangeAspectRatio;
  17155. private _currentRefreshId;
  17156. private _refreshRate;
  17157. onGenerated: () => void;
  17158. private _vertexBuffers;
  17159. private _indexBuffer;
  17160. private _effect;
  17161. private _uniforms;
  17162. private _samplers;
  17163. private _fragment;
  17164. _textures: Texture[];
  17165. private _floats;
  17166. private _floatsArrays;
  17167. private _colors3;
  17168. private _colors4;
  17169. private _vectors2;
  17170. private _vectors3;
  17171. private _matrices;
  17172. private _fallbackTexture;
  17173. private _fallbackTextureUsed;
  17174. constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean, isCube?: boolean);
  17175. reset(): void;
  17176. isReady(): boolean;
  17177. resetRefreshCounter(): void;
  17178. setFragment(fragment: any): void;
  17179. refreshRate: number;
  17180. _shouldRender(): boolean;
  17181. getRenderSize(): number;
  17182. resize(size: any, generateMipMaps: any): void;
  17183. private _checkUniform(uniformName);
  17184. setTexture(name: string, texture: Texture): ProceduralTexture;
  17185. setFloat(name: string, value: number): ProceduralTexture;
  17186. setFloats(name: string, value: number[]): ProceduralTexture;
  17187. setColor3(name: string, value: Color3): ProceduralTexture;
  17188. setColor4(name: string, value: Color4): ProceduralTexture;
  17189. setVector2(name: string, value: Vector2): ProceduralTexture;
  17190. setVector3(name: string, value: Vector3): ProceduralTexture;
  17191. setMatrix(name: string, value: Matrix): ProceduralTexture;
  17192. render(useCameraPostProcess?: boolean): void;
  17193. clone(): ProceduralTexture;
  17194. dispose(): void;
  17195. }
  17196. }
  17197. export = BABYLON;