babylon.d.ts 266 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630
  1. declare module BABYLON {
  2. class _DepthCullingState {
  3. private _isDepthTestDirty;
  4. private _isDepthMaskDirty;
  5. private _isDepthFuncDirty;
  6. private _isCullFaceDirty;
  7. private _isCullDirty;
  8. private _isZOffsetDirty;
  9. private _depthTest;
  10. private _depthMask;
  11. private _depthFunc;
  12. private _cull;
  13. private _cullFace;
  14. private _zOffset;
  15. isDirty: boolean;
  16. zOffset: number;
  17. cullFace: number;
  18. cull: boolean;
  19. depthFunc: number;
  20. depthMask: boolean;
  21. depthTest: boolean;
  22. reset(): void;
  23. apply(gl: WebGLRenderingContext): void;
  24. }
  25. class _AlphaState {
  26. private _isAlphaBlendDirty;
  27. private _isBlendFunctionParametersDirty;
  28. private _alphaBlend;
  29. private _blendFunctionParameters;
  30. isDirty: boolean;
  31. alphaBlend: boolean;
  32. setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
  33. reset(): void;
  34. apply(gl: WebGLRenderingContext): void;
  35. }
  36. class EngineCapabilities {
  37. maxTexturesImageUnits: number;
  38. maxTextureSize: number;
  39. maxCubemapTextureSize: number;
  40. maxRenderTextureSize: number;
  41. standardDerivatives: boolean;
  42. s3tc: any;
  43. textureFloat: boolean;
  44. textureAnisotropicFilterExtension: any;
  45. maxAnisotropy: number;
  46. instancedArrays: any;
  47. uintIndices: boolean;
  48. highPrecisionShaderSupported: boolean;
  49. }
  50. /**
  51. * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio.
  52. */
  53. class Engine {
  54. private static _ALPHA_DISABLE;
  55. private static _ALPHA_ADD;
  56. private static _ALPHA_COMBINE;
  57. private static _ALPHA_SUBTRACT;
  58. private static _ALPHA_MULTIPLY;
  59. private static _ALPHA_MAXIMIZED;
  60. private static _ALPHA_ONEONE;
  61. private static _DELAYLOADSTATE_NONE;
  62. private static _DELAYLOADSTATE_LOADED;
  63. private static _DELAYLOADSTATE_LOADING;
  64. private static _DELAYLOADSTATE_NOTLOADED;
  65. private static _TEXTUREFORMAT_ALPHA;
  66. private static _TEXTUREFORMAT_LUMINANCE;
  67. private static _TEXTUREFORMAT_LUMINANCE_ALPHA;
  68. private static _TEXTUREFORMAT_RGB;
  69. private static _TEXTUREFORMAT_RGBA;
  70. private static _TEXTURETYPE_UNSIGNED_INT;
  71. private static _TEXTURETYPE_FLOAT;
  72. static ALPHA_DISABLE: number;
  73. static ALPHA_ONEONE: number;
  74. static ALPHA_ADD: number;
  75. static ALPHA_COMBINE: number;
  76. static ALPHA_SUBTRACT: number;
  77. static ALPHA_MULTIPLY: number;
  78. static ALPHA_MAXIMIZED: number;
  79. static DELAYLOADSTATE_NONE: number;
  80. static DELAYLOADSTATE_LOADED: number;
  81. static DELAYLOADSTATE_LOADING: number;
  82. static DELAYLOADSTATE_NOTLOADED: number;
  83. static TEXTUREFORMAT_ALPHA: number;
  84. static TEXTUREFORMAT_LUMINANCE: number;
  85. static TEXTUREFORMAT_LUMINANCE_ALPHA: number;
  86. static TEXTUREFORMAT_RGB: number;
  87. static TEXTUREFORMAT_RGBA: number;
  88. static TEXTURETYPE_UNSIGNED_INT: number;
  89. static TEXTURETYPE_FLOAT: number;
  90. static Version: string;
  91. static Epsilon: number;
  92. static CollisionsEpsilon: number;
  93. static CodeRepository: string;
  94. static ShadersRepository: string;
  95. isFullscreen: boolean;
  96. isPointerLock: boolean;
  97. cullBackFaces: boolean;
  98. renderEvenInBackground: boolean;
  99. enableOfflineSupport: boolean;
  100. scenes: Scene[];
  101. _gl: WebGLRenderingContext;
  102. private _renderingCanvas;
  103. private _windowIsBackground;
  104. static audioEngine: AudioEngine;
  105. private _onBlur;
  106. private _onFocus;
  107. private _onFullscreenChange;
  108. private _onPointerLockChange;
  109. private _hardwareScalingLevel;
  110. private _caps;
  111. private _pointerLockRequested;
  112. private _alphaTest;
  113. private _loadingScreen;
  114. private _drawCalls;
  115. private _glVersion;
  116. private _glRenderer;
  117. private _glVendor;
  118. private _videoTextureSupported;
  119. private _renderingQueueLaunched;
  120. private _activeRenderLoops;
  121. private fpsRange;
  122. private previousFramesDuration;
  123. private fps;
  124. private deltaTime;
  125. private _depthCullingState;
  126. private _alphaState;
  127. private _alphaMode;
  128. private _loadedTexturesCache;
  129. _activeTexturesCache: BaseTexture[];
  130. private _currentEffect;
  131. private _compiledEffects;
  132. private _vertexAttribArrays;
  133. private _cachedViewport;
  134. private _cachedVertexBuffers;
  135. private _cachedIndexBuffer;
  136. private _cachedEffectForVertexBuffers;
  137. private _currentRenderTarget;
  138. private _uintIndicesCurrentlySet;
  139. private _workingCanvas;
  140. private _workingContext;
  141. /**
  142. * @constructor
  143. * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering
  144. * @param {boolean} [antialias] - enable antialias
  145. * @param options - further options to be sent to the getContext function
  146. */
  147. constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: {
  148. antialias?: boolean;
  149. preserveDrawingBuffer?: boolean;
  150. }, adaptToDeviceRatio?: boolean);
  151. private _prepareWorkingCanvas();
  152. getGlInfo(): {
  153. vendor: string;
  154. renderer: string;
  155. version: string;
  156. };
  157. getAspectRatio(camera: Camera): number;
  158. getRenderWidth(): number;
  159. getRenderHeight(): number;
  160. getRenderingCanvas(): HTMLCanvasElement;
  161. getRenderingCanvasClientRect(): ClientRect;
  162. setHardwareScalingLevel(level: number): void;
  163. getHardwareScalingLevel(): number;
  164. getLoadedTexturesCache(): WebGLTexture[];
  165. getCaps(): EngineCapabilities;
  166. drawCalls: number;
  167. resetDrawCalls(): void;
  168. setDepthFunctionToGreater(): void;
  169. setDepthFunctionToGreaterOrEqual(): void;
  170. setDepthFunctionToLess(): void;
  171. setDepthFunctionToLessOrEqual(): void;
  172. /**
  173. * stop executing a render loop function and remove it from the execution array
  174. * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
  175. */
  176. stopRenderLoop(renderFunction?: () => void): void;
  177. _renderLoop(): void;
  178. /**
  179. * Register and execute a render loop. The engine can have more than one render function.
  180. * @param {Function} renderFunction - the function to continuesly execute starting the next render loop.
  181. * @example
  182. * engine.runRenderLoop(function () {
  183. * scene.render()
  184. * })
  185. */
  186. runRenderLoop(renderFunction: () => void): void;
  187. /**
  188. * Toggle full screen mode.
  189. * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
  190. */
  191. switchFullscreen(requestPointerLock: boolean): void;
  192. clear(color: any, backBuffer: boolean, depthStencil: boolean): void;
  193. /**
  194. * Set the WebGL's viewport
  195. * @param {BABYLON.Viewport} viewport - the viewport element to be used.
  196. * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used.
  197. * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used.
  198. */
  199. setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  200. setDirectViewport(x: number, y: number, width: number, height: number): void;
  201. beginFrame(): void;
  202. endFrame(): void;
  203. /**
  204. * resize the view according to the canvas' size.
  205. * @example
  206. * window.addEventListener("resize", function () {
  207. * engine.resize();
  208. * });
  209. */
  210. resize(): void;
  211. /**
  212. * force a specific size of the canvas
  213. * @param {number} width - the new canvas' width
  214. * @param {number} height - the new canvas' height
  215. */
  216. setSize(width: number, height: number): void;
  217. bindFramebuffer(texture: WebGLTexture, faceIndex?: number): void;
  218. unBindFramebuffer(texture: WebGLTexture, disableGenerateMipMaps?: boolean): void;
  219. generateMipMapsForCubemap(texture: WebGLTexture): void;
  220. flushFramebuffer(): void;
  221. restoreDefaultFramebuffer(): void;
  222. private _resetVertexBufferBinding();
  223. createVertexBuffer(vertices: number[]): WebGLBuffer;
  224. createDynamicVertexBuffer(capacity: number): WebGLBuffer;
  225. updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: any, offset?: number): void;
  226. private _resetIndexBufferBinding();
  227. createIndexBuffer(indices: number[]): WebGLBuffer;
  228. bindBuffers(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
  229. bindMultiBuffers(vertexBuffers: VertexBuffer[], indexBuffer: WebGLBuffer, effect: Effect): void;
  230. _releaseBuffer(buffer: WebGLBuffer): boolean;
  231. createInstancesBuffer(capacity: number): WebGLBuffer;
  232. deleteInstancesBuffer(buffer: WebGLBuffer): void;
  233. updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[]): void;
  234. unBindInstancesBuffer(instancesBuffer: WebGLBuffer, offsetLocations: number[]): void;
  235. applyStates(): void;
  236. draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  237. drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void;
  238. _releaseEffect(effect: Effect): void;
  239. createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  240. createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  241. createShaderProgram(vertexCode: string, fragmentCode: string, defines: string): WebGLProgram;
  242. getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
  243. getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  244. enableEffect(effect: Effect): void;
  245. setArray(uniform: WebGLUniformLocation, array: number[]): void;
  246. setArray2(uniform: WebGLUniformLocation, array: number[]): void;
  247. setArray3(uniform: WebGLUniformLocation, array: number[]): void;
  248. setArray4(uniform: WebGLUniformLocation, array: number[]): void;
  249. setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void;
  250. setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void;
  251. setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  252. setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  253. setFloat(uniform: WebGLUniformLocation, value: number): void;
  254. setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void;
  255. setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void;
  256. setBool(uniform: WebGLUniformLocation, bool: number): void;
  257. setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
  258. setColor3(uniform: WebGLUniformLocation, color3: Color3): void;
  259. setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void;
  260. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
  261. setDepthBuffer(enable: boolean): void;
  262. getDepthWrite(): boolean;
  263. setDepthWrite(enable: boolean): void;
  264. setColorWrite(enable: boolean): void;
  265. setAlphaMode(mode: number): void;
  266. getAlphaMode(): number;
  267. setAlphaTesting(enable: boolean): void;
  268. getAlphaTesting(): boolean;
  269. wipeCaches(): void;
  270. setSamplingMode(texture: WebGLTexture, samplingMode: number): void;
  271. createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture;
  272. updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void;
  273. createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture;
  274. createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number, forceExponantOfTwo?: boolean): WebGLTexture;
  275. updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void;
  276. updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean): void;
  277. updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void;
  278. createRenderTargetTexture(size: any, options: any): WebGLTexture;
  279. createRenderTargetCubeTexture(size: number, options?: any): WebGLTexture;
  280. createCubeTexture(rootUrl: string, scene: Scene, extensions: string[], noMipmap?: boolean): WebGLTexture;
  281. _releaseTexture(texture: WebGLTexture): void;
  282. bindSamplers(effect: Effect): void;
  283. _bindTexture(channel: number, texture: WebGLTexture): void;
  284. setTextureFromPostProcess(channel: number, postProcess: PostProcess): void;
  285. setTexture(channel: number, texture: BaseTexture): void;
  286. _setAnisotropicLevel(key: number, texture: BaseTexture): void;
  287. readPixels(x: number, y: number, width: number, height: number): Uint8Array;
  288. releaseInternalTexture(texture: WebGLTexture): void;
  289. dispose(): void;
  290. displayLoadingUI(): void;
  291. hideLoadingUI(): void;
  292. loadingScreen: ILoadingScreen;
  293. loadingUIText: string;
  294. loadingUIBackgroundColor: string;
  295. getFps(): number;
  296. getDeltaTime(): number;
  297. private _measureFps();
  298. static isSupported(): boolean;
  299. }
  300. }
  301. interface Window {
  302. mozIndexedDB(func: any): any;
  303. webkitIndexedDB(func: any): any;
  304. IDBTransaction(func: any): any;
  305. webkitIDBTransaction(func: any): any;
  306. msIDBTransaction(func: any): any;
  307. IDBKeyRange(func: any): any;
  308. webkitIDBKeyRange(func: any): any;
  309. msIDBKeyRange(func: any): any;
  310. webkitURL: HTMLURL;
  311. webkitRequestAnimationFrame(func: any): any;
  312. mozRequestAnimationFrame(func: any): any;
  313. oRequestAnimationFrame(func: any): any;
  314. WebGLRenderingContext: WebGLRenderingContext;
  315. MSGesture: MSGesture;
  316. CANNON: any;
  317. SIMD: any;
  318. AudioContext: AudioContext;
  319. webkitAudioContext: AudioContext;
  320. }
  321. interface HTMLURL {
  322. createObjectURL(param1: any, param2?: any): any;
  323. }
  324. interface Document {
  325. exitFullscreen(): void;
  326. webkitCancelFullScreen(): void;
  327. mozCancelFullScreen(): void;
  328. msCancelFullScreen(): void;
  329. mozFullScreen: boolean;
  330. msIsFullScreen: boolean;
  331. fullscreen: boolean;
  332. mozPointerLockElement: HTMLElement;
  333. msPointerLockElement: HTMLElement;
  334. webkitPointerLockElement: HTMLElement;
  335. }
  336. interface HTMLCanvasElement {
  337. requestPointerLock(): void;
  338. msRequestPointerLock(): void;
  339. mozRequestPointerLock(): void;
  340. webkitRequestPointerLock(): void;
  341. }
  342. interface CanvasRenderingContext2D {
  343. imageSmoothingEnabled: boolean;
  344. mozImageSmoothingEnabled: boolean;
  345. oImageSmoothingEnabled: boolean;
  346. webkitImageSmoothingEnabled: boolean;
  347. }
  348. interface WebGLTexture {
  349. isReady: boolean;
  350. isCube: boolean;
  351. url: string;
  352. noMipmap: boolean;
  353. samplingMode: number;
  354. references: number;
  355. generateMipMaps: boolean;
  356. _size: number;
  357. _baseWidth: number;
  358. _baseHeight: number;
  359. _width: number;
  360. _height: number;
  361. _workingCanvas: HTMLCanvasElement;
  362. _workingContext: CanvasRenderingContext2D;
  363. _framebuffer: WebGLFramebuffer;
  364. _depthBuffer: WebGLRenderbuffer;
  365. _cachedCoordinatesMode: number;
  366. _cachedWrapU: number;
  367. _cachedWrapV: number;
  368. _isDisabled: boolean;
  369. }
  370. interface WebGLBuffer {
  371. references: number;
  372. capacity: number;
  373. is32Bits: boolean;
  374. }
  375. interface MouseEvent {
  376. mozMovementX: number;
  377. mozMovementY: number;
  378. webkitMovementX: number;
  379. webkitMovementY: number;
  380. msMovementX: number;
  381. msMovementY: number;
  382. }
  383. interface MSStyleCSSProperties {
  384. webkitTransform: string;
  385. webkitTransition: string;
  386. }
  387. interface Navigator {
  388. getVRDevices: () => any;
  389. mozGetVRDevices: (any: any) => any;
  390. isCocoonJS: boolean;
  391. }
  392. interface Screen {
  393. orientation: string;
  394. mozOrientation: string;
  395. }
  396. declare module BABYLON {
  397. /**
  398. * Node is the basic class for all scene objects (Mesh, Light Camera).
  399. */
  400. class Node {
  401. parent: Node;
  402. name: string;
  403. id: string;
  404. uniqueId: number;
  405. state: string;
  406. animations: Animation[];
  407. onReady: (node: Node) => void;
  408. private _childrenFlag;
  409. private _isEnabled;
  410. private _isReady;
  411. _currentRenderId: number;
  412. private _parentRenderId;
  413. _waitingParentId: string;
  414. private _scene;
  415. _cache: any;
  416. /**
  417. * @constructor
  418. * @param {string} name - the name and id to be given to this node
  419. * @param {BABYLON.Scene} the scene this node will be added to
  420. */
  421. constructor(name: string, scene: Scene);
  422. getScene(): Scene;
  423. getEngine(): Engine;
  424. getWorldMatrix(): Matrix;
  425. _initCache(): void;
  426. updateCache(force?: boolean): void;
  427. _updateCache(ignoreParentClass?: boolean): void;
  428. _isSynchronized(): boolean;
  429. _markSyncedWithParent(): void;
  430. isSynchronizedWithParent(): boolean;
  431. isSynchronized(updateCache?: boolean): boolean;
  432. hasNewParent(update?: boolean): boolean;
  433. /**
  434. * Is this node ready to be used/rendered
  435. * @return {boolean} is it ready
  436. */
  437. isReady(): boolean;
  438. /**
  439. * Is this node enabled.
  440. * If the node has a parent and is enabled, the parent will be inspected as well.
  441. * @return {boolean} whether this node (and its parent) is enabled.
  442. * @see setEnabled
  443. */
  444. isEnabled(): boolean;
  445. /**
  446. * Set the enabled state of this node.
  447. * @param {boolean} value - the new enabled state
  448. * @see isEnabled
  449. */
  450. setEnabled(value: boolean): void;
  451. /**
  452. * Is this node a descendant of the given node.
  453. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
  454. * @param {BABYLON.Node} ancestor - The parent node to inspect
  455. * @see parent
  456. */
  457. isDescendantOf(ancestor: Node): boolean;
  458. _getDescendants(list: Node[], results: Node[]): void;
  459. /**
  460. * Will return all nodes that have this node as parent.
  461. * @return {BABYLON.Node[]} all children nodes of all types.
  462. */
  463. getDescendants(): Node[];
  464. _setReady(state: boolean): void;
  465. }
  466. }
  467. declare module BABYLON {
  468. interface IDisposable {
  469. dispose(): void;
  470. }
  471. /**
  472. * Represents a scene to be rendered by the engine.
  473. * @see http://doc.babylonjs.com/page.php?p=21911
  474. */
  475. class Scene {
  476. private static _FOGMODE_NONE;
  477. private static _FOGMODE_EXP;
  478. private static _FOGMODE_EXP2;
  479. private static _FOGMODE_LINEAR;
  480. static MinDeltaTime: number;
  481. static MaxDeltaTime: number;
  482. static FOGMODE_NONE: number;
  483. static FOGMODE_EXP: number;
  484. static FOGMODE_EXP2: number;
  485. static FOGMODE_LINEAR: number;
  486. autoClear: boolean;
  487. clearColor: any;
  488. ambientColor: Color3;
  489. /**
  490. * A function to be executed before rendering this scene
  491. * @type {Function}
  492. */
  493. beforeRender: () => void;
  494. /**
  495. * A function to be executed after rendering this scene
  496. * @type {Function}
  497. */
  498. afterRender: () => void;
  499. /**
  500. * A function to be executed when this scene is disposed.
  501. * @type {Function}
  502. */
  503. onDispose: () => void;
  504. beforeCameraRender: (camera: Camera) => void;
  505. afterCameraRender: (camera: Camera) => void;
  506. forceWireframe: boolean;
  507. forcePointsCloud: boolean;
  508. forceShowBoundingBoxes: boolean;
  509. clipPlane: Plane;
  510. animationsEnabled: boolean;
  511. private _onPointerMove;
  512. private _onPointerDown;
  513. private _onPointerUp;
  514. onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  515. onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  516. cameraToUseForPointers: Camera;
  517. private _pointerX;
  518. private _pointerY;
  519. private _meshUnderPointer;
  520. _mirroredCameraPosition: Vector3;
  521. private _onKeyDown;
  522. private _onKeyUp;
  523. /**
  524. * is fog enabled on this scene.
  525. * @type {boolean}
  526. */
  527. fogEnabled: boolean;
  528. fogMode: number;
  529. fogColor: Color3;
  530. fogDensity: number;
  531. fogStart: number;
  532. fogEnd: number;
  533. /**
  534. * is shadow enabled on this scene.
  535. * @type {boolean}
  536. */
  537. shadowsEnabled: boolean;
  538. /**
  539. * is light enabled on this scene.
  540. * @type {boolean}
  541. */
  542. lightsEnabled: boolean;
  543. /**
  544. * All of the lights added to this scene.
  545. * @see BABYLON.Light
  546. * @type {BABYLON.Light[]}
  547. */
  548. lights: Light[];
  549. onNewLightAdded: (newLight?: Light, positionInArray?: number, scene?: Scene) => void;
  550. onLightRemoved: (removedLight?: Light) => void;
  551. /**
  552. * All of the cameras added to this scene.
  553. * @see BABYLON.Camera
  554. * @type {BABYLON.Camera[]}
  555. */
  556. cameras: Camera[];
  557. onNewCameraAdded: (newCamera?: Camera, positionInArray?: number, scene?: Scene) => void;
  558. onCameraRemoved: (removedCamera?: Camera) => void;
  559. activeCameras: Camera[];
  560. activeCamera: Camera;
  561. /**
  562. * All of the (abstract) meshes added to this scene.
  563. * @see BABYLON.AbstractMesh
  564. * @type {BABYLON.AbstractMesh[]}
  565. */
  566. meshes: AbstractMesh[];
  567. onNewMeshAdded: (newMesh?: AbstractMesh, positionInArray?: number, scene?: Scene) => void;
  568. onMeshRemoved: (removedMesh?: AbstractMesh) => void;
  569. private _geometries;
  570. onGeometryAdded: (newGeometry?: Geometry) => void;
  571. onGeometryRemoved: (removedGeometry?: Geometry) => void;
  572. materials: Material[];
  573. multiMaterials: MultiMaterial[];
  574. defaultMaterial: StandardMaterial;
  575. texturesEnabled: boolean;
  576. textures: BaseTexture[];
  577. particlesEnabled: boolean;
  578. particleSystems: ParticleSystem[];
  579. spritesEnabled: boolean;
  580. spriteManagers: SpriteManager[];
  581. layers: Layer[];
  582. skeletonsEnabled: boolean;
  583. skeletons: Skeleton[];
  584. lensFlaresEnabled: boolean;
  585. lensFlareSystems: LensFlareSystem[];
  586. collisionsEnabled: boolean;
  587. private _workerCollisions;
  588. collisionCoordinator: ICollisionCoordinator;
  589. gravity: Vector3;
  590. postProcessesEnabled: boolean;
  591. postProcessManager: PostProcessManager;
  592. postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
  593. renderTargetsEnabled: boolean;
  594. dumpNextRenderTargets: boolean;
  595. customRenderTargets: RenderTargetTexture[];
  596. useDelayedTextureLoading: boolean;
  597. importedMeshesFiles: String[];
  598. probesEnabled: boolean;
  599. reflectionProbes: ReflectionProbe[];
  600. database: any;
  601. /**
  602. * This scene's action manager
  603. * @type {BABYLON.ActionManager}
  604. */
  605. actionManager: ActionManager;
  606. _actionManagers: ActionManager[];
  607. private _meshesForIntersections;
  608. proceduralTexturesEnabled: boolean;
  609. _proceduralTextures: ProceduralTexture[];
  610. mainSoundTrack: SoundTrack;
  611. soundTracks: SoundTrack[];
  612. private _audioEnabled;
  613. private _headphone;
  614. simplificationQueue: SimplificationQueue;
  615. private _engine;
  616. private _totalVertices;
  617. _activeIndices: number;
  618. _activeParticles: number;
  619. private _lastFrameDuration;
  620. private _evaluateActiveMeshesDuration;
  621. private _renderTargetsDuration;
  622. _particlesDuration: number;
  623. private _renderDuration;
  624. _spritesDuration: number;
  625. private _animationRatio;
  626. private _animationStartDate;
  627. _cachedMaterial: Material;
  628. private _renderId;
  629. private _executeWhenReadyTimeoutId;
  630. _toBeDisposed: SmartArray<IDisposable>;
  631. private _onReadyCallbacks;
  632. private _pendingData;
  633. private _onBeforeRenderCallbacks;
  634. private _onAfterRenderCallbacks;
  635. private _activeMeshes;
  636. private _processedMaterials;
  637. private _renderTargets;
  638. _activeParticleSystems: SmartArray<ParticleSystem>;
  639. private _activeSkeletons;
  640. private _softwareSkinnedMeshes;
  641. _activeBones: number;
  642. private _renderingManager;
  643. private _physicsEngine;
  644. _activeAnimatables: Animatable[];
  645. private _transformMatrix;
  646. private _pickWithRayInverseMatrix;
  647. private _edgesRenderers;
  648. private _boundingBoxRenderer;
  649. private _outlineRenderer;
  650. private _viewMatrix;
  651. private _projectionMatrix;
  652. private _frustumPlanes;
  653. private _selectionOctree;
  654. private _pointerOverMesh;
  655. private _debugLayer;
  656. private _depthRenderer;
  657. private _uniqueIdCounter;
  658. /**
  659. * @constructor
  660. * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
  661. */
  662. constructor(engine: Engine);
  663. debugLayer: DebugLayer;
  664. workerCollisions: boolean;
  665. SelectionOctree: Octree<AbstractMesh>;
  666. /**
  667. * The mesh that is currently under the pointer.
  668. * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
  669. */
  670. meshUnderPointer: AbstractMesh;
  671. /**
  672. * Current on-screen X position of the pointer
  673. * @return {number} X position of the pointer
  674. */
  675. pointerX: number;
  676. /**
  677. * Current on-screen Y position of the pointer
  678. * @return {number} Y position of the pointer
  679. */
  680. pointerY: number;
  681. getCachedMaterial(): Material;
  682. getBoundingBoxRenderer(): BoundingBoxRenderer;
  683. getOutlineRenderer(): OutlineRenderer;
  684. getEngine(): Engine;
  685. getTotalVertices(): number;
  686. getActiveIndices(): number;
  687. getActiveParticles(): number;
  688. getActiveBones(): number;
  689. getLastFrameDuration(): number;
  690. getEvaluateActiveMeshesDuration(): number;
  691. getActiveMeshes(): SmartArray<Mesh>;
  692. getRenderTargetsDuration(): number;
  693. getRenderDuration(): number;
  694. getParticlesDuration(): number;
  695. getSpritesDuration(): number;
  696. getAnimationRatio(): number;
  697. getRenderId(): number;
  698. incrementRenderId(): void;
  699. private _updatePointerPosition(evt);
  700. attachControl(): void;
  701. detachControl(): void;
  702. isReady(): boolean;
  703. resetCachedMaterial(): void;
  704. registerBeforeRender(func: () => void): void;
  705. unregisterBeforeRender(func: () => void): void;
  706. registerAfterRender(func: () => void): void;
  707. unregisterAfterRender(func: () => void): void;
  708. _addPendingData(data: any): void;
  709. _removePendingData(data: any): void;
  710. getWaitingItemsCount(): number;
  711. /**
  712. * Registers a function to be executed when the scene is ready.
  713. * @param {Function} func - the function to be executed.
  714. */
  715. executeWhenReady(func: () => void): void;
  716. _checkIsReady(): void;
  717. /**
  718. * Will start the animation sequence of a given target
  719. * @param target - the target
  720. * @param {number} from - from which frame should animation start
  721. * @param {number} to - till which frame should animation run.
  722. * @param {boolean} [loop] - should the animation loop
  723. * @param {number} [speedRatio] - the speed in which to run the animation
  724. * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
  725. * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
  726. * @return {BABYLON.Animatable} the animatable object created for this animation
  727. * @see BABYLON.Animatable
  728. * @see http://doc.babylonjs.com/page.php?p=22081
  729. */
  730. beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
  731. beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  732. getAnimatableByTarget(target: any): Animatable;
  733. /**
  734. * Will stop the animation of the given target
  735. * @param target - the target
  736. * @see beginAnimation
  737. */
  738. stopAnimation(target: any): void;
  739. private _animate();
  740. getViewMatrix(): Matrix;
  741. getProjectionMatrix(): Matrix;
  742. getTransformMatrix(): Matrix;
  743. setTransformMatrix(view: Matrix, projection: Matrix): void;
  744. addMesh(newMesh: AbstractMesh): void;
  745. removeMesh(toRemove: AbstractMesh): number;
  746. removeLight(toRemove: Light): number;
  747. removeCamera(toRemove: Camera): number;
  748. addLight(newLight: Light): void;
  749. addCamera(newCamera: Camera): void;
  750. /**
  751. * sets the active camera of the scene using its ID
  752. * @param {string} id - the camera's ID
  753. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  754. * @see activeCamera
  755. */
  756. setActiveCameraByID(id: string): Camera;
  757. /**
  758. * sets the active camera of the scene using its name
  759. * @param {string} name - the camera's name
  760. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  761. * @see activeCamera
  762. */
  763. setActiveCameraByName(name: string): Camera;
  764. /**
  765. * get a material using its id
  766. * @param {string} the material's ID
  767. * @return {BABYLON.Material|null} the material or null if none found.
  768. */
  769. getMaterialByID(id: string): Material;
  770. /**
  771. * get a material using its name
  772. * @param {string} the material's name
  773. * @return {BABYLON.Material|null} the material or null if none found.
  774. */
  775. getMaterialByName(name: string): Material;
  776. getLensFlareSystemByName(name: string): LensFlareSystem;
  777. getCameraByID(id: string): Camera;
  778. getCameraByUniqueID(uniqueId: number): Camera;
  779. /**
  780. * get a camera using its name
  781. * @param {string} the camera's name
  782. * @return {BABYLON.Camera|null} the camera or null if none found.
  783. */
  784. getCameraByName(name: string): Camera;
  785. /**
  786. * get a light node using its name
  787. * @param {string} the light's name
  788. * @return {BABYLON.Light|null} the light or null if none found.
  789. */
  790. getLightByName(name: string): Light;
  791. /**
  792. * get a light node using its ID
  793. * @param {string} the light's id
  794. * @return {BABYLON.Light|null} the light or null if none found.
  795. */
  796. getLightByID(id: string): Light;
  797. /**
  798. * get a light node using its scene-generated unique ID
  799. * @param {number} the light's unique id
  800. * @return {BABYLON.Light|null} the light or null if none found.
  801. */
  802. getLightByUniqueID(uniqueId: number): Light;
  803. /**
  804. * get a geometry using its ID
  805. * @param {string} the geometry's id
  806. * @return {BABYLON.Geometry|null} the geometry or null if none found.
  807. */
  808. getGeometryByID(id: string): Geometry;
  809. /**
  810. * add a new geometry to this scene.
  811. * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
  812. * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
  813. * @return {boolean} was the geometry added or not
  814. */
  815. pushGeometry(geometry: Geometry, force?: boolean): boolean;
  816. /**
  817. * Removes an existing geometry
  818. * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene.
  819. * @return {boolean} was the geometry removed or not
  820. */
  821. removeGeometry(geometry: Geometry): boolean;
  822. getGeometries(): Geometry[];
  823. /**
  824. * Get the first added mesh found of a given ID
  825. * @param {string} id - the id to search for
  826. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  827. */
  828. getMeshByID(id: string): AbstractMesh;
  829. /**
  830. * Get a mesh with its auto-generated unique id
  831. * @param {number} uniqueId - the unique id to search for
  832. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  833. */
  834. getMeshByUniqueID(uniqueId: number): AbstractMesh;
  835. /**
  836. * Get a the last added mesh found of a given ID
  837. * @param {string} id - the id to search for
  838. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  839. */
  840. getLastMeshByID(id: string): AbstractMesh;
  841. /**
  842. * Get a the last added node (Mesh, Camera, Light) found of a given ID
  843. * @param {string} id - the id to search for
  844. * @return {BABYLON.Node|null} the node found or null if not found at all.
  845. */
  846. getLastEntryByID(id: string): Node;
  847. getNodeByID(id: string): Node;
  848. getNodeByName(name: string): Node;
  849. getMeshByName(name: string): AbstractMesh;
  850. getSoundByName(name: string): Sound;
  851. getLastSkeletonByID(id: string): Skeleton;
  852. getSkeletonById(id: string): Skeleton;
  853. getSkeletonByName(name: string): Skeleton;
  854. isActiveMesh(mesh: Mesh): boolean;
  855. private _evaluateSubMesh(subMesh, mesh);
  856. private _evaluateActiveMeshes();
  857. private _activeMesh(mesh);
  858. updateTransformMatrix(force?: boolean): void;
  859. private _renderForCamera(camera);
  860. private _processSubCameras(camera);
  861. private _checkIntersections();
  862. render(): void;
  863. private _updateAudioParameters();
  864. audioEnabled: boolean;
  865. private _disableAudio();
  866. private _enableAudio();
  867. headphone: boolean;
  868. private _switchAudioModeForHeadphones();
  869. private _switchAudioModeForNormalSpeakers();
  870. enableDepthRenderer(): DepthRenderer;
  871. disableDepthRenderer(): void;
  872. dispose(): void;
  873. disposeSounds(): void;
  874. getWorldExtends(): {
  875. min: Vector3;
  876. max: Vector3;
  877. };
  878. createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
  879. createPickingRay(x: number, y: number, world: Matrix, camera: Camera, cameraViewSpace?: boolean): Ray;
  880. createPickingRayInCameraSpace(x: number, y: number, camera: Camera): Ray;
  881. private _internalPick(rayFunction, predicate, fastCheck?);
  882. private _internalPickSprites(ray, predicate?, fastCheck?, camera?);
  883. pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  884. pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  885. pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo;
  886. setPointerOverMesh(mesh: AbstractMesh): void;
  887. getPointerOverMesh(): AbstractMesh;
  888. getPhysicsEngine(): PhysicsEngine;
  889. enablePhysics(gravity: Vector3, plugin?: IPhysicsEnginePlugin): boolean;
  890. disablePhysicsEngine(): void;
  891. isPhysicsEnabled(): boolean;
  892. setGravity(gravity: Vector3): void;
  893. createCompoundImpostor(parts: any, options: PhysicsBodyCreationOptions): any;
  894. deleteCompoundImpostor(compound: any): void;
  895. createDefaultCameraOrLight(): void;
  896. private _getByTags(list, tagsQuery, forEach?);
  897. getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[];
  898. getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[];
  899. getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[];
  900. getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[];
  901. }
  902. }
  903. declare module BABYLON {
  904. class Action {
  905. triggerOptions: any;
  906. trigger: number;
  907. _actionManager: ActionManager;
  908. private _nextActiveAction;
  909. private _child;
  910. private _condition;
  911. private _triggerParameter;
  912. constructor(triggerOptions: any, condition?: Condition);
  913. _prepare(): void;
  914. getTriggerParameter(): any;
  915. _executeCurrent(evt: ActionEvent): void;
  916. execute(evt: ActionEvent): void;
  917. then(action: Action): Action;
  918. _getProperty(propertyPath: string): string;
  919. _getEffectiveTarget(target: any, propertyPath: string): any;
  920. }
  921. }
  922. declare module BABYLON {
  923. /**
  924. * ActionEvent is the event beint sent when an action is triggered.
  925. */
  926. class ActionEvent {
  927. source: any;
  928. pointerX: number;
  929. pointerY: number;
  930. meshUnderPointer: AbstractMesh;
  931. sourceEvent: any;
  932. additionalData: any;
  933. /**
  934. * @constructor
  935. * @param source The mesh or sprite that triggered the action.
  936. * @param pointerX The X mouse cursor position at the time of the event
  937. * @param pointerY The Y mouse cursor position at the time of the event
  938. * @param meshUnderPointer The mesh that is currently pointed at (can be null)
  939. * @param sourceEvent the original (browser) event that triggered the ActionEvent
  940. */
  941. constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any);
  942. /**
  943. * Helper function to auto-create an ActionEvent from a source mesh.
  944. * @param source The source mesh that triggered the event
  945. * @param evt {Event} The original (browser) event
  946. */
  947. static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent;
  948. /**
  949. * Helper function to auto-create an ActionEvent from a source mesh.
  950. * @param source The source sprite that triggered the event
  951. * @param scene Scene associated with the sprite
  952. * @param evt {Event} The original (browser) event
  953. */
  954. static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent;
  955. /**
  956. * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
  957. * @param scene the scene where the event occurred
  958. * @param evt {Event} The original (browser) event
  959. */
  960. static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent;
  961. }
  962. /**
  963. * Action Manager manages all events to be triggered on a given mesh or the global scene.
  964. * A single scene can have many Action Managers to handle predefined actions on specific meshes.
  965. */
  966. class ActionManager {
  967. private static _NothingTrigger;
  968. private static _OnPickTrigger;
  969. private static _OnLeftPickTrigger;
  970. private static _OnRightPickTrigger;
  971. private static _OnCenterPickTrigger;
  972. private static _OnPointerOverTrigger;
  973. private static _OnPointerOutTrigger;
  974. private static _OnEveryFrameTrigger;
  975. private static _OnIntersectionEnterTrigger;
  976. private static _OnIntersectionExitTrigger;
  977. private static _OnKeyDownTrigger;
  978. private static _OnKeyUpTrigger;
  979. private static _OnPickUpTrigger;
  980. static NothingTrigger: number;
  981. static OnPickTrigger: number;
  982. static OnLeftPickTrigger: number;
  983. static OnRightPickTrigger: number;
  984. static OnCenterPickTrigger: number;
  985. static OnPointerOverTrigger: number;
  986. static OnPointerOutTrigger: number;
  987. static OnEveryFrameTrigger: number;
  988. static OnIntersectionEnterTrigger: number;
  989. static OnIntersectionExitTrigger: number;
  990. static OnKeyDownTrigger: number;
  991. static OnKeyUpTrigger: number;
  992. static OnPickUpTrigger: number;
  993. actions: Action[];
  994. private _scene;
  995. constructor(scene: Scene);
  996. dispose(): void;
  997. getScene(): Scene;
  998. /**
  999. * Does this action manager handles actions of any of the given triggers
  1000. * @param {number[]} triggers - the triggers to be tested
  1001. * @return {boolean} whether one (or more) of the triggers is handeled
  1002. */
  1003. hasSpecificTriggers(triggers: number[]): boolean;
  1004. /**
  1005. * Does this action manager handles actions of a given trigger
  1006. * @param {number} trigger - the trigger to be tested
  1007. * @return {boolean} whether the trigger is handeled
  1008. */
  1009. hasSpecificTrigger(trigger: number): boolean;
  1010. /**
  1011. * Does this action manager has pointer triggers
  1012. * @return {boolean} whether or not it has pointer triggers
  1013. */
  1014. hasPointerTriggers: boolean;
  1015. /**
  1016. * Does this action manager has pick triggers
  1017. * @return {boolean} whether or not it has pick triggers
  1018. */
  1019. hasPickTriggers: boolean;
  1020. /**
  1021. * Registers an action to this action manager
  1022. * @param {BABYLON.Action} action - the action to be registered
  1023. * @return {BABYLON.Action} the action amended (prepared) after registration
  1024. */
  1025. registerAction(action: Action): Action;
  1026. /**
  1027. * Process a specific trigger
  1028. * @param {number} trigger - the trigger to process
  1029. * @param evt {BABYLON.ActionEvent} the event details to be processed
  1030. */
  1031. processTrigger(trigger: number, evt: ActionEvent): void;
  1032. _getEffectiveTarget(target: any, propertyPath: string): any;
  1033. _getProperty(propertyPath: string): string;
  1034. }
  1035. }
  1036. declare module BABYLON {
  1037. class Condition {
  1038. _actionManager: ActionManager;
  1039. _evaluationId: number;
  1040. _currentResult: boolean;
  1041. constructor(actionManager: ActionManager);
  1042. isValid(): boolean;
  1043. _getProperty(propertyPath: string): string;
  1044. _getEffectiveTarget(target: any, propertyPath: string): any;
  1045. }
  1046. class ValueCondition extends Condition {
  1047. propertyPath: string;
  1048. value: any;
  1049. operator: number;
  1050. private static _IsEqual;
  1051. private static _IsDifferent;
  1052. private static _IsGreater;
  1053. private static _IsLesser;
  1054. static IsEqual: number;
  1055. static IsDifferent: number;
  1056. static IsGreater: number;
  1057. static IsLesser: number;
  1058. _actionManager: ActionManager;
  1059. private _target;
  1060. private _property;
  1061. constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number);
  1062. isValid(): boolean;
  1063. }
  1064. class PredicateCondition extends Condition {
  1065. predicate: () => boolean;
  1066. _actionManager: ActionManager;
  1067. constructor(actionManager: ActionManager, predicate: () => boolean);
  1068. isValid(): boolean;
  1069. }
  1070. class StateCondition extends Condition {
  1071. value: string;
  1072. _actionManager: ActionManager;
  1073. private _target;
  1074. constructor(actionManager: ActionManager, target: any, value: string);
  1075. isValid(): boolean;
  1076. }
  1077. }
  1078. declare module BABYLON {
  1079. class SwitchBooleanAction extends Action {
  1080. propertyPath: string;
  1081. private _target;
  1082. private _property;
  1083. constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
  1084. _prepare(): void;
  1085. execute(): void;
  1086. }
  1087. class SetStateAction extends Action {
  1088. value: string;
  1089. private _target;
  1090. constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
  1091. execute(): void;
  1092. }
  1093. class SetValueAction extends Action {
  1094. propertyPath: string;
  1095. value: any;
  1096. private _target;
  1097. private _property;
  1098. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  1099. _prepare(): void;
  1100. execute(): void;
  1101. }
  1102. class IncrementValueAction extends Action {
  1103. propertyPath: string;
  1104. value: any;
  1105. private _target;
  1106. private _property;
  1107. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  1108. _prepare(): void;
  1109. execute(): void;
  1110. }
  1111. class PlayAnimationAction extends Action {
  1112. from: number;
  1113. to: number;
  1114. loop: boolean;
  1115. private _target;
  1116. constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition);
  1117. _prepare(): void;
  1118. execute(): void;
  1119. }
  1120. class StopAnimationAction extends Action {
  1121. private _target;
  1122. constructor(triggerOptions: any, target: any, condition?: Condition);
  1123. _prepare(): void;
  1124. execute(): void;
  1125. }
  1126. class DoNothingAction extends Action {
  1127. constructor(triggerOptions?: any, condition?: Condition);
  1128. execute(): void;
  1129. }
  1130. class CombineAction extends Action {
  1131. children: Action[];
  1132. constructor(triggerOptions: any, children: Action[], condition?: Condition);
  1133. _prepare(): void;
  1134. execute(evt: ActionEvent): void;
  1135. }
  1136. class ExecuteCodeAction extends Action {
  1137. func: (evt: ActionEvent) => void;
  1138. constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
  1139. execute(evt: ActionEvent): void;
  1140. }
  1141. class SetParentAction extends Action {
  1142. private _parent;
  1143. private _target;
  1144. constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
  1145. _prepare(): void;
  1146. execute(): void;
  1147. }
  1148. class PlaySoundAction extends Action {
  1149. private _sound;
  1150. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  1151. _prepare(): void;
  1152. execute(): void;
  1153. }
  1154. class StopSoundAction extends Action {
  1155. private _sound;
  1156. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  1157. _prepare(): void;
  1158. execute(): void;
  1159. }
  1160. }
  1161. declare module BABYLON {
  1162. class InterpolateValueAction extends Action {
  1163. propertyPath: string;
  1164. value: any;
  1165. duration: number;
  1166. stopOtherAnimations: boolean;
  1167. onInterpolationDone: () => void;
  1168. private _target;
  1169. private _property;
  1170. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean, onInterpolationDone?: () => void);
  1171. _prepare(): void;
  1172. execute(): void;
  1173. }
  1174. }
  1175. declare module BABYLON {
  1176. class Animatable {
  1177. target: any;
  1178. fromFrame: number;
  1179. toFrame: number;
  1180. loopAnimation: boolean;
  1181. speedRatio: number;
  1182. onAnimationEnd: any;
  1183. private _localDelayOffset;
  1184. private _pausedDelay;
  1185. private _animations;
  1186. private _paused;
  1187. private _scene;
  1188. animationStarted: boolean;
  1189. constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any);
  1190. appendAnimations(target: any, animations: Animation[]): void;
  1191. getAnimationByTargetProperty(property: string): Animation;
  1192. reset(): void;
  1193. pause(): void;
  1194. restart(): void;
  1195. stop(): void;
  1196. _animate(delay: number): boolean;
  1197. }
  1198. }
  1199. declare module BABYLON {
  1200. class Animation {
  1201. name: string;
  1202. targetProperty: string;
  1203. framePerSecond: number;
  1204. dataType: number;
  1205. loopMode: number;
  1206. private _keys;
  1207. private _offsetsCache;
  1208. private _highLimitsCache;
  1209. private _stopped;
  1210. _target: any;
  1211. private _easingFunction;
  1212. targetPropertyPath: string[];
  1213. currentFrame: number;
  1214. allowMatricesInterpolation: boolean;
  1215. static CreateAndStartAnimation(name: string, mesh: AbstractMesh, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  1216. constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number);
  1217. reset(): void;
  1218. isStopped(): boolean;
  1219. getKeys(): any[];
  1220. getEasingFunction(): IEasingFunction;
  1221. setEasingFunction(easingFunction: EasingFunction): void;
  1222. floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
  1223. quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
  1224. vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
  1225. vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2;
  1226. color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
  1227. matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  1228. clone(): Animation;
  1229. setKeys(values: Array<any>): void;
  1230. private _getKeyValue(value);
  1231. private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?);
  1232. animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number): boolean;
  1233. private static _ANIMATIONTYPE_FLOAT;
  1234. private static _ANIMATIONTYPE_VECTOR3;
  1235. private static _ANIMATIONTYPE_QUATERNION;
  1236. private static _ANIMATIONTYPE_MATRIX;
  1237. private static _ANIMATIONTYPE_COLOR3;
  1238. private static _ANIMATIONTYPE_VECTOR2;
  1239. private static _ANIMATIONLOOPMODE_RELATIVE;
  1240. private static _ANIMATIONLOOPMODE_CYCLE;
  1241. private static _ANIMATIONLOOPMODE_CONSTANT;
  1242. static ANIMATIONTYPE_FLOAT: number;
  1243. static ANIMATIONTYPE_VECTOR3: number;
  1244. static ANIMATIONTYPE_VECTOR2: number;
  1245. static ANIMATIONTYPE_QUATERNION: number;
  1246. static ANIMATIONTYPE_MATRIX: number;
  1247. static ANIMATIONTYPE_COLOR3: number;
  1248. static ANIMATIONLOOPMODE_RELATIVE: number;
  1249. static ANIMATIONLOOPMODE_CYCLE: number;
  1250. static ANIMATIONLOOPMODE_CONSTANT: number;
  1251. }
  1252. }
  1253. declare module BABYLON {
  1254. interface IEasingFunction {
  1255. ease(gradient: number): number;
  1256. }
  1257. class EasingFunction implements IEasingFunction {
  1258. private static _EASINGMODE_EASEIN;
  1259. private static _EASINGMODE_EASEOUT;
  1260. private static _EASINGMODE_EASEINOUT;
  1261. static EASINGMODE_EASEIN: number;
  1262. static EASINGMODE_EASEOUT: number;
  1263. static EASINGMODE_EASEINOUT: number;
  1264. private _easingMode;
  1265. setEasingMode(easingMode: number): void;
  1266. getEasingMode(): number;
  1267. easeInCore(gradient: number): number;
  1268. ease(gradient: number): number;
  1269. }
  1270. class CircleEase extends EasingFunction implements IEasingFunction {
  1271. easeInCore(gradient: number): number;
  1272. }
  1273. class BackEase extends EasingFunction implements IEasingFunction {
  1274. amplitude: number;
  1275. constructor(amplitude?: number);
  1276. easeInCore(gradient: number): number;
  1277. }
  1278. class BounceEase extends EasingFunction implements IEasingFunction {
  1279. bounces: number;
  1280. bounciness: number;
  1281. constructor(bounces?: number, bounciness?: number);
  1282. easeInCore(gradient: number): number;
  1283. }
  1284. class CubicEase extends EasingFunction implements IEasingFunction {
  1285. easeInCore(gradient: number): number;
  1286. }
  1287. class ElasticEase extends EasingFunction implements IEasingFunction {
  1288. oscillations: number;
  1289. springiness: number;
  1290. constructor(oscillations?: number, springiness?: number);
  1291. easeInCore(gradient: number): number;
  1292. }
  1293. class ExponentialEase extends EasingFunction implements IEasingFunction {
  1294. exponent: number;
  1295. constructor(exponent?: number);
  1296. easeInCore(gradient: number): number;
  1297. }
  1298. class PowerEase extends EasingFunction implements IEasingFunction {
  1299. power: number;
  1300. constructor(power?: number);
  1301. easeInCore(gradient: number): number;
  1302. }
  1303. class QuadraticEase extends EasingFunction implements IEasingFunction {
  1304. easeInCore(gradient: number): number;
  1305. }
  1306. class QuarticEase extends EasingFunction implements IEasingFunction {
  1307. easeInCore(gradient: number): number;
  1308. }
  1309. class QuinticEase extends EasingFunction implements IEasingFunction {
  1310. easeInCore(gradient: number): number;
  1311. }
  1312. class SineEase extends EasingFunction implements IEasingFunction {
  1313. easeInCore(gradient: number): number;
  1314. }
  1315. class BezierCurveEase extends EasingFunction implements IEasingFunction {
  1316. x1: number;
  1317. y1: number;
  1318. x2: number;
  1319. y2: number;
  1320. constructor(x1?: number, y1?: number, x2?: number, y2?: number);
  1321. easeInCore(gradient: number): number;
  1322. }
  1323. }
  1324. declare module BABYLON {
  1325. class Analyser {
  1326. SMOOTHING: number;
  1327. FFT_SIZE: number;
  1328. BARGRAPHAMPLITUDE: number;
  1329. DEBUGCANVASPOS: {
  1330. x: number;
  1331. y: number;
  1332. };
  1333. DEBUGCANVASSIZE: {
  1334. width: number;
  1335. height: number;
  1336. };
  1337. private _byteFreqs;
  1338. private _byteTime;
  1339. private _floatFreqs;
  1340. private _webAudioAnalyser;
  1341. private _debugCanvas;
  1342. private _debugCanvasContext;
  1343. private _scene;
  1344. private _registerFunc;
  1345. private _audioEngine;
  1346. constructor(scene: Scene);
  1347. getFrequencyBinCount(): number;
  1348. getByteFrequencyData(): Uint8Array;
  1349. getByteTimeDomainData(): Uint8Array;
  1350. getFloatFrequencyData(): Uint8Array;
  1351. drawDebugCanvas(): void;
  1352. stopDebugCanvas(): void;
  1353. connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void;
  1354. dispose(): void;
  1355. }
  1356. }
  1357. declare module BABYLON {
  1358. class AudioEngine {
  1359. private _audioContext;
  1360. private _audioContextInitialized;
  1361. canUseWebAudio: boolean;
  1362. masterGain: GainNode;
  1363. private _connectedAnalyser;
  1364. WarnedWebAudioUnsupported: boolean;
  1365. audioContext: AudioContext;
  1366. constructor();
  1367. private _initializeAudioContext();
  1368. dispose(): void;
  1369. getGlobalVolume(): number;
  1370. setGlobalVolume(newVolume: number): void;
  1371. connectToAnalyser(analyser: Analyser): void;
  1372. }
  1373. }
  1374. declare module BABYLON {
  1375. class Sound {
  1376. name: string;
  1377. autoplay: boolean;
  1378. loop: boolean;
  1379. useCustomAttenuation: boolean;
  1380. soundTrackId: number;
  1381. spatialSound: boolean;
  1382. refDistance: number;
  1383. rolloffFactor: number;
  1384. maxDistance: number;
  1385. distanceModel: string;
  1386. private _panningModel;
  1387. onended: () => any;
  1388. private _playbackRate;
  1389. private _startTime;
  1390. private _startOffset;
  1391. private _position;
  1392. private _localDirection;
  1393. private _volume;
  1394. private _isLoaded;
  1395. private _isReadyToPlay;
  1396. isPlaying: boolean;
  1397. isPaused: boolean;
  1398. private _isDirectional;
  1399. private _readyToPlayCallback;
  1400. private _audioBuffer;
  1401. private _soundSource;
  1402. private _soundPanner;
  1403. private _soundGain;
  1404. private _inputAudioNode;
  1405. private _ouputAudioNode;
  1406. private _coneInnerAngle;
  1407. private _coneOuterAngle;
  1408. private _coneOuterGain;
  1409. private _scene;
  1410. private _connectedMesh;
  1411. private _customAttenuationFunction;
  1412. private _registerFunc;
  1413. private _isOutputConnected;
  1414. /**
  1415. * Create a sound and attach it to a scene
  1416. * @param name Name of your sound
  1417. * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer
  1418. * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played
  1419. * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel
  1420. */
  1421. constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any);
  1422. dispose(): void;
  1423. private _soundLoaded(audioData);
  1424. setAudioBuffer(audioBuffer: AudioBuffer): void;
  1425. updateOptions(options: any): void;
  1426. private _createSpatialParameters();
  1427. private _updateSpatialParameters();
  1428. switchPanningModelToHRTF(): void;
  1429. switchPanningModelToEqualPower(): void;
  1430. private _switchPanningModel();
  1431. connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void;
  1432. /**
  1433. * Transform this sound into a directional source
  1434. * @param coneInnerAngle Size of the inner cone in degree
  1435. * @param coneOuterAngle Size of the outer cone in degree
  1436. * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)
  1437. */
  1438. setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void;
  1439. setPosition(newPosition: Vector3): void;
  1440. setLocalDirectionToMesh(newLocalDirection: Vector3): void;
  1441. private _updateDirection();
  1442. updateDistanceFromListener(): void;
  1443. setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void;
  1444. /**
  1445. * Play the sound
  1446. * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
  1447. */
  1448. play(time?: number): void;
  1449. private _onended();
  1450. /**
  1451. * Stop the sound
  1452. * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.
  1453. */
  1454. stop(time?: number): void;
  1455. pause(): void;
  1456. setVolume(newVolume: number, time?: number): void;
  1457. setPlaybackRate(newPlaybackRate: number): void;
  1458. getVolume(): number;
  1459. attachToMesh(meshToConnectTo: AbstractMesh): void;
  1460. private _onRegisterAfterWorldMatrixUpdate(connectedMesh);
  1461. }
  1462. }
  1463. declare module BABYLON {
  1464. class SoundTrack {
  1465. private _audioEngine;
  1466. private _outputAudioNode;
  1467. private _inputAudioNode;
  1468. private _trackConvolver;
  1469. private _scene;
  1470. id: number;
  1471. soundCollection: Array<Sound>;
  1472. private _isMainTrack;
  1473. private _connectedAnalyser;
  1474. constructor(scene: Scene, options?: any);
  1475. dispose(): void;
  1476. AddSound(sound: Sound): void;
  1477. RemoveSound(sound: Sound): void;
  1478. setVolume(newVolume: number): void;
  1479. switchPanningModelToHRTF(): void;
  1480. switchPanningModelToEqualPower(): void;
  1481. connectToAnalyser(analyser: Analyser): void;
  1482. }
  1483. }
  1484. declare module BABYLON {
  1485. class Bone extends Node {
  1486. name: string;
  1487. children: Bone[];
  1488. animations: Animation[];
  1489. private _skeleton;
  1490. private _matrix;
  1491. private _baseMatrix;
  1492. private _worldTransform;
  1493. private _absoluteTransform;
  1494. private _invertedAbsoluteTransform;
  1495. private _parent;
  1496. constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix);
  1497. getParent(): Bone;
  1498. getLocalMatrix(): Matrix;
  1499. getBaseMatrix(): Matrix;
  1500. getWorldMatrix(): Matrix;
  1501. getInvertedAbsoluteTransform(): Matrix;
  1502. getAbsoluteMatrix(): Matrix;
  1503. updateMatrix(matrix: Matrix): void;
  1504. private _updateDifferenceMatrix();
  1505. markAsDirty(): void;
  1506. }
  1507. }
  1508. declare module BABYLON {
  1509. class Skeleton {
  1510. name: string;
  1511. id: string;
  1512. bones: Bone[];
  1513. private _scene;
  1514. private _isDirty;
  1515. private _transformMatrices;
  1516. private _animatables;
  1517. private _identity;
  1518. constructor(name: string, id: string, scene: Scene);
  1519. getTransformMatrices(): Float32Array;
  1520. getScene(): Scene;
  1521. _markAsDirty(): void;
  1522. prepare(): void;
  1523. getAnimatables(): IAnimatable[];
  1524. clone(name: string, id: string): Skeleton;
  1525. }
  1526. }
  1527. declare module BABYLON {
  1528. class Collider {
  1529. radius: Vector3;
  1530. retry: number;
  1531. velocity: Vector3;
  1532. basePoint: Vector3;
  1533. epsilon: number;
  1534. collisionFound: boolean;
  1535. velocityWorldLength: number;
  1536. basePointWorld: Vector3;
  1537. velocityWorld: Vector3;
  1538. normalizedVelocity: Vector3;
  1539. initialVelocity: Vector3;
  1540. initialPosition: Vector3;
  1541. nearestDistance: number;
  1542. intersectionPoint: Vector3;
  1543. collidedMesh: AbstractMesh;
  1544. private _collisionPoint;
  1545. private _planeIntersectionPoint;
  1546. private _tempVector;
  1547. private _tempVector2;
  1548. private _tempVector3;
  1549. private _tempVector4;
  1550. private _edge;
  1551. private _baseToVertex;
  1552. private _destinationPoint;
  1553. private _slidePlaneNormal;
  1554. private _displacementVector;
  1555. _initialize(source: Vector3, dir: Vector3, e: number): void;
  1556. _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean;
  1557. _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean;
  1558. _testTriangle(faceIndex: number, trianglePlaneArray: Array<Plane>, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void;
  1559. _collide(trianglePlaneArray: Array<Plane>, pts: Vector3[], indices: number[], indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void;
  1560. _getResponse(pos: Vector3, vel: Vector3): void;
  1561. }
  1562. }
  1563. declare module BABYLON {
  1564. var CollisionWorker: string;
  1565. interface ICollisionCoordinator {
  1566. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  1567. init(scene: Scene): void;
  1568. destroy(): void;
  1569. onMeshAdded(mesh: AbstractMesh): any;
  1570. onMeshUpdated(mesh: AbstractMesh): any;
  1571. onMeshRemoved(mesh: AbstractMesh): any;
  1572. onGeometryAdded(geometry: Geometry): any;
  1573. onGeometryUpdated(geometry: Geometry): any;
  1574. onGeometryDeleted(geometry: Geometry): any;
  1575. }
  1576. interface SerializedMesh {
  1577. id: string;
  1578. name: string;
  1579. uniqueId: number;
  1580. geometryId: string;
  1581. sphereCenter: Array<number>;
  1582. sphereRadius: number;
  1583. boxMinimum: Array<number>;
  1584. boxMaximum: Array<number>;
  1585. worldMatrixFromCache: any;
  1586. subMeshes: Array<SerializedSubMesh>;
  1587. checkCollisions: boolean;
  1588. }
  1589. interface SerializedSubMesh {
  1590. position: number;
  1591. verticesStart: number;
  1592. verticesCount: number;
  1593. indexStart: number;
  1594. indexCount: number;
  1595. hasMaterial: boolean;
  1596. sphereCenter: Array<number>;
  1597. sphereRadius: number;
  1598. boxMinimum: Array<number>;
  1599. boxMaximum: Array<number>;
  1600. }
  1601. interface SerializedGeometry {
  1602. id: string;
  1603. positions: Float32Array;
  1604. indices: Int32Array;
  1605. normals: Float32Array;
  1606. }
  1607. interface BabylonMessage {
  1608. taskType: WorkerTaskType;
  1609. payload: InitPayload | CollidePayload | UpdatePayload;
  1610. }
  1611. interface SerializedColliderToWorker {
  1612. position: Array<number>;
  1613. velocity: Array<number>;
  1614. radius: Array<number>;
  1615. }
  1616. enum WorkerTaskType {
  1617. INIT = 0,
  1618. UPDATE = 1,
  1619. COLLIDE = 2,
  1620. }
  1621. interface WorkerReply {
  1622. error: WorkerReplyType;
  1623. taskType: WorkerTaskType;
  1624. payload?: any;
  1625. }
  1626. interface CollisionReplyPayload {
  1627. newPosition: Array<number>;
  1628. collisionId: number;
  1629. collidedMeshUniqueId: number;
  1630. }
  1631. interface InitPayload {
  1632. }
  1633. interface CollidePayload {
  1634. collisionId: number;
  1635. collider: SerializedColliderToWorker;
  1636. maximumRetry: number;
  1637. excludedMeshUniqueId?: number;
  1638. }
  1639. interface UpdatePayload {
  1640. updatedMeshes: {
  1641. [n: number]: SerializedMesh;
  1642. };
  1643. updatedGeometries: {
  1644. [s: string]: SerializedGeometry;
  1645. };
  1646. removedMeshes: Array<number>;
  1647. removedGeometries: Array<string>;
  1648. }
  1649. enum WorkerReplyType {
  1650. SUCCESS = 0,
  1651. UNKNOWN_ERROR = 1,
  1652. }
  1653. class CollisionCoordinatorWorker implements ICollisionCoordinator {
  1654. private _scene;
  1655. private _scaledPosition;
  1656. private _scaledVelocity;
  1657. private _collisionsCallbackArray;
  1658. private _init;
  1659. private _runningUpdated;
  1660. private _runningCollisionTask;
  1661. private _worker;
  1662. private _addUpdateMeshesList;
  1663. private _addUpdateGeometriesList;
  1664. private _toRemoveMeshesArray;
  1665. private _toRemoveGeometryArray;
  1666. constructor();
  1667. static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
  1668. static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
  1669. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  1670. init(scene: Scene): void;
  1671. destroy(): void;
  1672. onMeshAdded(mesh: AbstractMesh): void;
  1673. onMeshUpdated: (mesh: AbstractMesh) => void;
  1674. onMeshRemoved(mesh: AbstractMesh): void;
  1675. onGeometryAdded(geometry: Geometry): void;
  1676. onGeometryUpdated: (geometry: Geometry) => void;
  1677. onGeometryDeleted(geometry: Geometry): void;
  1678. private _afterRender;
  1679. private _onMessageFromWorker;
  1680. }
  1681. class CollisionCoordinatorLegacy implements ICollisionCoordinator {
  1682. private _scene;
  1683. private _scaledPosition;
  1684. private _scaledVelocity;
  1685. private _finalPosition;
  1686. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  1687. init(scene: Scene): void;
  1688. destroy(): void;
  1689. onMeshAdded(mesh: AbstractMesh): void;
  1690. onMeshUpdated(mesh: AbstractMesh): void;
  1691. onMeshRemoved(mesh: AbstractMesh): void;
  1692. onGeometryAdded(geometry: Geometry): void;
  1693. onGeometryUpdated(geometry: Geometry): void;
  1694. onGeometryDeleted(geometry: Geometry): void;
  1695. private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?);
  1696. }
  1697. }
  1698. declare module BABYLON {
  1699. var WorkerIncluded: boolean;
  1700. class CollisionCache {
  1701. private _meshes;
  1702. private _geometries;
  1703. getMeshes(): {
  1704. [n: number]: SerializedMesh;
  1705. };
  1706. getGeometries(): {
  1707. [s: number]: SerializedGeometry;
  1708. };
  1709. getMesh(id: any): SerializedMesh;
  1710. addMesh(mesh: SerializedMesh): void;
  1711. removeMesh(uniqueId: number): void;
  1712. getGeometry(id: string): SerializedGeometry;
  1713. addGeometry(geometry: SerializedGeometry): void;
  1714. removeGeometry(id: string): void;
  1715. }
  1716. class CollideWorker {
  1717. collider: Collider;
  1718. private _collisionCache;
  1719. private finalPosition;
  1720. private collisionsScalingMatrix;
  1721. private collisionTranformationMatrix;
  1722. constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
  1723. collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void;
  1724. private checkCollision(mesh);
  1725. private processCollisionsForSubMeshes(transformMatrix, mesh);
  1726. private collideForSubMesh(subMesh, transformMatrix, meshGeometry);
  1727. private checkSubmeshCollision(subMesh);
  1728. }
  1729. interface ICollisionDetector {
  1730. onInit(payload: InitPayload): void;
  1731. onUpdate(payload: UpdatePayload): void;
  1732. onCollision(payload: CollidePayload): void;
  1733. }
  1734. class CollisionDetectorTransferable implements ICollisionDetector {
  1735. private _collisionCache;
  1736. onInit(payload: InitPayload): void;
  1737. onUpdate(payload: UpdatePayload): void;
  1738. onCollision(payload: CollidePayload): void;
  1739. }
  1740. }
  1741. declare module BABYLON {
  1742. class IntersectionInfo {
  1743. bu: number;
  1744. bv: number;
  1745. distance: number;
  1746. faceId: number;
  1747. subMeshId: number;
  1748. constructor(bu: number, bv: number, distance: number);
  1749. }
  1750. class PickingInfo {
  1751. hit: boolean;
  1752. distance: number;
  1753. pickedPoint: Vector3;
  1754. pickedMesh: AbstractMesh;
  1755. bu: number;
  1756. bv: number;
  1757. faceId: number;
  1758. subMeshId: number;
  1759. pickedSprite: Sprite;
  1760. getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3;
  1761. getTextureCoordinates(): Vector2;
  1762. }
  1763. }
  1764. declare module BABYLON {
  1765. class ArcRotateCamera extends TargetCamera {
  1766. alpha: number;
  1767. beta: number;
  1768. radius: number;
  1769. target: any;
  1770. inertialAlphaOffset: number;
  1771. inertialBetaOffset: number;
  1772. inertialRadiusOffset: number;
  1773. lowerAlphaLimit: any;
  1774. upperAlphaLimit: any;
  1775. lowerBetaLimit: number;
  1776. upperBetaLimit: number;
  1777. lowerRadiusLimit: any;
  1778. upperRadiusLimit: any;
  1779. angularSensibilityX: number;
  1780. angularSensibilityY: number;
  1781. wheelPrecision: number;
  1782. pinchPrecision: number;
  1783. panningSensibility: number;
  1784. inertialPanningX: number;
  1785. inertialPanningY: number;
  1786. keysUp: number[];
  1787. keysDown: number[];
  1788. keysLeft: number[];
  1789. keysRight: number[];
  1790. zoomOnFactor: number;
  1791. targetScreenOffset: Vector2;
  1792. pinchInwards: boolean;
  1793. allowUpsideDown: boolean;
  1794. private _keys;
  1795. _viewMatrix: Matrix;
  1796. private _attachedElement;
  1797. private _onContextMenu;
  1798. private _onPointerDown;
  1799. private _onPointerUp;
  1800. private _onPointerMove;
  1801. private _wheel;
  1802. private _onMouseMove;
  1803. private _onKeyDown;
  1804. private _onKeyUp;
  1805. private _onLostFocus;
  1806. _reset: () => void;
  1807. private _onGestureStart;
  1808. private _onGesture;
  1809. private _MSGestureHandler;
  1810. private _localDirection;
  1811. private _transformedDirection;
  1812. private _isRightClick;
  1813. private _isCtrlPushed;
  1814. onCollide: (collidedMesh: AbstractMesh) => void;
  1815. checkCollisions: boolean;
  1816. collisionRadius: Vector3;
  1817. private _collider;
  1818. private _previousPosition;
  1819. private _collisionVelocity;
  1820. private _newPosition;
  1821. private _previousAlpha;
  1822. private _previousBeta;
  1823. private _previousRadius;
  1824. private _collisionTriggered;
  1825. angularSensibility: number;
  1826. constructor(name: string, alpha: number, beta: number, radius: number, target: any, scene: Scene);
  1827. _getTargetPosition(): Vector3;
  1828. _initCache(): void;
  1829. _updateCache(ignoreParentClass?: boolean): void;
  1830. _isSynchronizedViewMatrix(): boolean;
  1831. attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean): void;
  1832. detachControl(element: HTMLElement): void;
  1833. _checkInputs(): void;
  1834. private _checkLimits();
  1835. setPosition(position: Vector3): void;
  1836. setTarget(target: Vector3): void;
  1837. _getViewMatrix(): Matrix;
  1838. private _onCollisionPositionChange;
  1839. zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void;
  1840. focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void;
  1841. /**
  1842. * @override
  1843. * Override Camera.createRigCamera
  1844. */
  1845. createRigCamera(name: string, cameraIndex: number): Camera;
  1846. /**
  1847. * @override
  1848. * Override Camera._updateRigCameras
  1849. */
  1850. _updateRigCameras(): void;
  1851. }
  1852. }
  1853. declare module BABYLON {
  1854. class VRCameraMetrics {
  1855. hResolution: number;
  1856. vResolution: number;
  1857. hScreenSize: number;
  1858. vScreenSize: number;
  1859. vScreenCenter: number;
  1860. eyeToScreenDistance: number;
  1861. lensSeparationDistance: number;
  1862. interpupillaryDistance: number;
  1863. distortionK: number[];
  1864. chromaAbCorrection: number[];
  1865. postProcessScaleFactor: number;
  1866. lensCenterOffset: number;
  1867. compensateDistortion: boolean;
  1868. aspectRatio: number;
  1869. aspectRatioFov: number;
  1870. leftHMatrix: Matrix;
  1871. rightHMatrix: Matrix;
  1872. leftPreViewMatrix: Matrix;
  1873. rightPreViewMatrix: Matrix;
  1874. static GetDefault(): VRCameraMetrics;
  1875. }
  1876. class Camera extends Node {
  1877. position: Vector3;
  1878. private static _PERSPECTIVE_CAMERA;
  1879. private static _ORTHOGRAPHIC_CAMERA;
  1880. private static _FOVMODE_VERTICAL_FIXED;
  1881. private static _FOVMODE_HORIZONTAL_FIXED;
  1882. private static _RIG_MODE_NONE;
  1883. private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH;
  1884. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL;
  1885. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;
  1886. private static _RIG_MODE_STEREOSCOPIC_OVERUNDER;
  1887. private static _RIG_MODE_VR;
  1888. static PERSPECTIVE_CAMERA: number;
  1889. static ORTHOGRAPHIC_CAMERA: number;
  1890. static FOVMODE_VERTICAL_FIXED: number;
  1891. static FOVMODE_HORIZONTAL_FIXED: number;
  1892. static RIG_MODE_NONE: number;
  1893. static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number;
  1894. static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number;
  1895. static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number;
  1896. static RIG_MODE_STEREOSCOPIC_OVERUNDER: number;
  1897. static RIG_MODE_VR: number;
  1898. upVector: Vector3;
  1899. orthoLeft: any;
  1900. orthoRight: any;
  1901. orthoBottom: any;
  1902. orthoTop: any;
  1903. fov: number;
  1904. minZ: number;
  1905. maxZ: number;
  1906. inertia: number;
  1907. mode: number;
  1908. isIntermediate: boolean;
  1909. viewport: Viewport;
  1910. layerMask: number;
  1911. fovMode: number;
  1912. cameraRigMode: number;
  1913. _cameraRigParams: any;
  1914. _rigCameras: Camera[];
  1915. private _computedViewMatrix;
  1916. _projectionMatrix: Matrix;
  1917. private _worldMatrix;
  1918. _postProcesses: PostProcess[];
  1919. _postProcessesTakenIndices: any[];
  1920. _activeMeshes: SmartArray<Mesh>;
  1921. private _globalPosition;
  1922. constructor(name: string, position: Vector3, scene: Scene);
  1923. globalPosition: Vector3;
  1924. getActiveMeshes(): SmartArray<Mesh>;
  1925. isActiveMesh(mesh: Mesh): boolean;
  1926. _initCache(): void;
  1927. _updateCache(ignoreParentClass?: boolean): void;
  1928. _updateFromScene(): void;
  1929. _isSynchronized(): boolean;
  1930. _isSynchronizedViewMatrix(): boolean;
  1931. _isSynchronizedProjectionMatrix(): boolean;
  1932. attachControl(element: HTMLElement): void;
  1933. detachControl(element: HTMLElement): void;
  1934. _update(): void;
  1935. _checkInputs(): void;
  1936. attachPostProcess(postProcess: PostProcess, insertAt?: number): number;
  1937. detachPostProcess(postProcess: PostProcess, atIndices?: any): number[];
  1938. getWorldMatrix(): Matrix;
  1939. _getViewMatrix(): Matrix;
  1940. getViewMatrix(force?: boolean): Matrix;
  1941. _computeViewMatrix(force?: boolean): Matrix;
  1942. getProjectionMatrix(force?: boolean): Matrix;
  1943. dispose(): void;
  1944. setCameraRigMode(mode: number, rigParams: any): void;
  1945. private _getVRProjectionMatrix();
  1946. setCameraRigParameter(name: string, value: any): void;
  1947. /**
  1948. * May needs to be overridden by children so sub has required properties to be copied
  1949. */
  1950. createRigCamera(name: string, cameraIndex: number): Camera;
  1951. /**
  1952. * May needs to be overridden by children
  1953. */
  1954. _updateRigCameras(): void;
  1955. }
  1956. }
  1957. declare module BABYLON {
  1958. class DeviceOrientationCamera extends FreeCamera {
  1959. private _offsetX;
  1960. private _offsetY;
  1961. private _orientationGamma;
  1962. private _orientationBeta;
  1963. private _initialOrientationGamma;
  1964. private _initialOrientationBeta;
  1965. private _attachedCanvas;
  1966. private _orientationChanged;
  1967. angularSensibility: number;
  1968. moveSensibility: number;
  1969. constructor(name: string, position: Vector3, scene: Scene);
  1970. attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void;
  1971. detachControl(canvas: HTMLCanvasElement): void;
  1972. _checkInputs(): void;
  1973. }
  1974. }
  1975. declare module BABYLON {
  1976. class FollowCamera extends TargetCamera {
  1977. radius: number;
  1978. rotationOffset: number;
  1979. heightOffset: number;
  1980. cameraAcceleration: number;
  1981. maxCameraSpeed: number;
  1982. target: AbstractMesh;
  1983. constructor(name: string, position: Vector3, scene: Scene);
  1984. private getRadians(degrees);
  1985. private follow(cameraTarget);
  1986. _checkInputs(): void;
  1987. }
  1988. class ArcFollowCamera extends TargetCamera {
  1989. alpha: number;
  1990. beta: number;
  1991. radius: number;
  1992. target: AbstractMesh;
  1993. private _cartesianCoordinates;
  1994. constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene);
  1995. private follow();
  1996. _checkInputs(): void;
  1997. }
  1998. }
  1999. declare module BABYLON {
  2000. class FreeCamera extends TargetCamera {
  2001. ellipsoid: Vector3;
  2002. keysUp: number[];
  2003. keysDown: number[];
  2004. keysLeft: number[];
  2005. keysRight: number[];
  2006. checkCollisions: boolean;
  2007. applyGravity: boolean;
  2008. angularSensibility: number;
  2009. onCollide: (collidedMesh: AbstractMesh) => void;
  2010. private _keys;
  2011. private _collider;
  2012. private _needMoveForGravity;
  2013. private _oldPosition;
  2014. private _diffPosition;
  2015. private _newPosition;
  2016. private _attachedElement;
  2017. private _localDirection;
  2018. private _transformedDirection;
  2019. private _onMouseDown;
  2020. private _onMouseUp;
  2021. private _onMouseOut;
  2022. private _onMouseMove;
  2023. private _onKeyDown;
  2024. private _onKeyUp;
  2025. _onLostFocus: (e: FocusEvent) => any;
  2026. _waitingLockedTargetId: string;
  2027. constructor(name: string, position: Vector3, scene: Scene);
  2028. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2029. detachControl(element: HTMLElement): void;
  2030. _collideWithWorld(velocity: Vector3): void;
  2031. private _onCollisionPositionChange;
  2032. _checkInputs(): void;
  2033. _decideIfNeedsToMove(): boolean;
  2034. _updatePosition(): void;
  2035. }
  2036. }
  2037. declare module BABYLON {
  2038. class GamepadCamera extends FreeCamera {
  2039. private _gamepad;
  2040. private _gamepads;
  2041. angularSensibility: number;
  2042. moveSensibility: number;
  2043. constructor(name: string, position: Vector3, scene: Scene);
  2044. private _onNewGameConnected(gamepad);
  2045. _checkInputs(): void;
  2046. dispose(): void;
  2047. }
  2048. }
  2049. declare module BABYLON {
  2050. class AnaglyphFreeCamera extends FreeCamera {
  2051. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2052. }
  2053. class AnaglyphArcRotateCamera extends ArcRotateCamera {
  2054. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene);
  2055. }
  2056. class AnaglyphGamepadCamera extends GamepadCamera {
  2057. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2058. }
  2059. class StereoscopicFreeCamera extends FreeCamera {
  2060. constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene);
  2061. }
  2062. class StereoscopicArcRotateCamera extends ArcRotateCamera {
  2063. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isSideBySide: boolean, scene: Scene);
  2064. }
  2065. class StereoscopicGamepadCamera extends GamepadCamera {
  2066. constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene);
  2067. }
  2068. }
  2069. declare module BABYLON {
  2070. class TargetCamera extends Camera {
  2071. cameraDirection: Vector3;
  2072. cameraRotation: Vector2;
  2073. rotation: Vector3;
  2074. speed: number;
  2075. noRotationConstraint: boolean;
  2076. lockedTarget: any;
  2077. _currentTarget: Vector3;
  2078. _viewMatrix: Matrix;
  2079. _camMatrix: Matrix;
  2080. _cameraTransformMatrix: Matrix;
  2081. _cameraRotationMatrix: Matrix;
  2082. private _rigCamTransformMatrix;
  2083. _referencePoint: Vector3;
  2084. _transformedReferencePoint: Vector3;
  2085. _lookAtTemp: Matrix;
  2086. _tempMatrix: Matrix;
  2087. _reset: () => void;
  2088. _waitingLockedTargetId: string;
  2089. constructor(name: string, position: Vector3, scene: Scene);
  2090. getFrontPosition(distance: number): Vector3;
  2091. _getLockedTargetPosition(): Vector3;
  2092. _initCache(): void;
  2093. _updateCache(ignoreParentClass?: boolean): void;
  2094. _isSynchronizedViewMatrix(): boolean;
  2095. _computeLocalCameraSpeed(): number;
  2096. setTarget(target: Vector3): void;
  2097. getTarget(): Vector3;
  2098. _decideIfNeedsToMove(): boolean;
  2099. _updatePosition(): void;
  2100. _checkInputs(): void;
  2101. _getViewMatrix(): Matrix;
  2102. _getVRViewMatrix(): Matrix;
  2103. /**
  2104. * @override
  2105. * Override Camera.createRigCamera
  2106. */
  2107. createRigCamera(name: string, cameraIndex: number): Camera;
  2108. /**
  2109. * @override
  2110. * Override Camera._updateRigCameras
  2111. */
  2112. _updateRigCameras(): void;
  2113. private _getRigCamPosition(halfSpace, result);
  2114. }
  2115. }
  2116. declare module BABYLON {
  2117. class TouchCamera extends FreeCamera {
  2118. private _offsetX;
  2119. private _offsetY;
  2120. private _pointerCount;
  2121. private _pointerPressed;
  2122. private _attachedCanvas;
  2123. private _onPointerDown;
  2124. private _onPointerUp;
  2125. private _onPointerMove;
  2126. angularSensibility: number;
  2127. moveSensibility: number;
  2128. constructor(name: string, position: Vector3, scene: Scene);
  2129. attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void;
  2130. detachControl(canvas: HTMLCanvasElement): void;
  2131. _checkInputs(): void;
  2132. }
  2133. }
  2134. declare module BABYLON {
  2135. class VirtualJoysticksCamera extends FreeCamera {
  2136. private _leftjoystick;
  2137. private _rightjoystick;
  2138. constructor(name: string, position: Vector3, scene: Scene);
  2139. getLeftJoystick(): VirtualJoystick;
  2140. getRightJoystick(): VirtualJoystick;
  2141. _checkInputs(): void;
  2142. dispose(): void;
  2143. }
  2144. }
  2145. declare module BABYLON {
  2146. class DebugLayer {
  2147. private _scene;
  2148. private _camera;
  2149. private _transformationMatrix;
  2150. private _enabled;
  2151. private _labelsEnabled;
  2152. private _displayStatistics;
  2153. private _displayTree;
  2154. private _displayLogs;
  2155. private _globalDiv;
  2156. private _statsDiv;
  2157. private _statsSubsetDiv;
  2158. private _optionsDiv;
  2159. private _optionsSubsetDiv;
  2160. private _logDiv;
  2161. private _logSubsetDiv;
  2162. private _treeDiv;
  2163. private _treeSubsetDiv;
  2164. private _drawingCanvas;
  2165. private _drawingContext;
  2166. private _syncPositions;
  2167. private _syncData;
  2168. private _syncUI;
  2169. private _onCanvasClick;
  2170. private _clickPosition;
  2171. private _ratio;
  2172. private _identityMatrix;
  2173. private _showUI;
  2174. private _needToRefreshMeshesTree;
  2175. shouldDisplayLabel: (node: Node) => boolean;
  2176. shouldDisplayAxis: (mesh: Mesh) => boolean;
  2177. axisRatio: number;
  2178. accentColor: string;
  2179. customStatsFunction: () => string;
  2180. constructor(scene: Scene);
  2181. private _refreshMeshesTreeContent();
  2182. private _renderSingleAxis(zero, unit, unitText, label, color);
  2183. private _renderAxis(projectedPosition, mesh, globalViewport);
  2184. private _renderLabel(text, projectedPosition, labelOffset, onClick, getFillStyle);
  2185. private _isClickInsideRect(x, y, width, height);
  2186. isVisible(): boolean;
  2187. hide(): void;
  2188. show(showUI?: boolean, camera?: Camera): void;
  2189. private _clearLabels();
  2190. private _generateheader(root, text);
  2191. private _generateTexBox(root, title, color);
  2192. private _generateAdvancedCheckBox(root, leftTitle, rightTitle, initialState, task, tag?);
  2193. private _generateCheckBox(root, title, initialState, task, tag?);
  2194. private _generateButton(root, title, task, tag?);
  2195. private _generateRadio(root, title, name, initialState, task, tag?);
  2196. private _generateDOMelements();
  2197. private _displayStats();
  2198. }
  2199. }
  2200. declare module BABYLON {
  2201. class BoundingBox {
  2202. minimum: Vector3;
  2203. maximum: Vector3;
  2204. vectors: Vector3[];
  2205. center: Vector3;
  2206. extendSize: Vector3;
  2207. directions: Vector3[];
  2208. vectorsWorld: Vector3[];
  2209. minimumWorld: Vector3;
  2210. maximumWorld: Vector3;
  2211. private _worldMatrix;
  2212. constructor(minimum: Vector3, maximum: Vector3);
  2213. getWorldMatrix(): Matrix;
  2214. _update(world: Matrix): void;
  2215. isInFrustum(frustumPlanes: Plane[]): boolean;
  2216. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  2217. intersectsPoint(point: Vector3): boolean;
  2218. intersectsSphere(sphere: BoundingSphere): boolean;
  2219. intersectsMinMax(min: Vector3, max: Vector3): boolean;
  2220. static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
  2221. static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
  2222. static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  2223. static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  2224. }
  2225. }
  2226. declare module BABYLON {
  2227. class BoundingInfo {
  2228. minimum: Vector3;
  2229. maximum: Vector3;
  2230. boundingBox: BoundingBox;
  2231. boundingSphere: BoundingSphere;
  2232. constructor(minimum: Vector3, maximum: Vector3);
  2233. _update(world: Matrix): void;
  2234. isInFrustum(frustumPlanes: Plane[]): boolean;
  2235. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  2236. _checkCollision(collider: Collider): boolean;
  2237. intersectsPoint(point: Vector3): boolean;
  2238. intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
  2239. }
  2240. }
  2241. declare module BABYLON {
  2242. class BoundingSphere {
  2243. minimum: Vector3;
  2244. maximum: Vector3;
  2245. center: Vector3;
  2246. radius: number;
  2247. centerWorld: Vector3;
  2248. radiusWorld: number;
  2249. private _tempRadiusVector;
  2250. constructor(minimum: Vector3, maximum: Vector3);
  2251. _update(world: Matrix): void;
  2252. isInFrustum(frustumPlanes: Plane[]): boolean;
  2253. intersectsPoint(point: Vector3): boolean;
  2254. static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
  2255. }
  2256. }
  2257. declare module BABYLON {
  2258. class Layer {
  2259. name: string;
  2260. texture: Texture;
  2261. isBackground: boolean;
  2262. color: Color4;
  2263. onDispose: () => void;
  2264. private _scene;
  2265. private _vertexDeclaration;
  2266. private _vertexStrideSize;
  2267. private _vertexBuffer;
  2268. private _indexBuffer;
  2269. private _effect;
  2270. constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
  2271. render(): void;
  2272. dispose(): void;
  2273. }
  2274. }
  2275. declare module BABYLON {
  2276. class LensFlare {
  2277. size: number;
  2278. position: number;
  2279. color: Color3;
  2280. texture: Texture;
  2281. private _system;
  2282. constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
  2283. dispose: () => void;
  2284. }
  2285. }
  2286. declare module BABYLON {
  2287. class LensFlareSystem {
  2288. name: string;
  2289. lensFlares: LensFlare[];
  2290. borderLimit: number;
  2291. meshesSelectionPredicate: (mesh: Mesh) => boolean;
  2292. layerMask: number;
  2293. private _scene;
  2294. private _emitter;
  2295. private _vertexDeclaration;
  2296. private _vertexStrideSize;
  2297. private _vertexBuffer;
  2298. private _indexBuffer;
  2299. private _effect;
  2300. private _positionX;
  2301. private _positionY;
  2302. private _isEnabled;
  2303. constructor(name: string, emitter: any, scene: Scene);
  2304. isEnabled: boolean;
  2305. getScene(): Scene;
  2306. getEmitter(): any;
  2307. setEmitter(newEmitter: any): void;
  2308. getEmitterPosition(): Vector3;
  2309. computeEffectivePosition(globalViewport: Viewport): boolean;
  2310. _isVisible(): boolean;
  2311. render(): boolean;
  2312. dispose(): void;
  2313. }
  2314. }
  2315. declare module BABYLON {
  2316. class DirectionalLight extends Light implements IShadowLight {
  2317. direction: Vector3;
  2318. position: Vector3;
  2319. private _transformedDirection;
  2320. transformedPosition: Vector3;
  2321. private _worldMatrix;
  2322. shadowOrthoScale: number;
  2323. constructor(name: string, direction: Vector3, scene: Scene);
  2324. getAbsolutePosition(): Vector3;
  2325. setDirectionToTarget(target: Vector3): Vector3;
  2326. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  2327. supportsVSM(): boolean;
  2328. needRefreshPerFrame(): boolean;
  2329. computeTransformedPosition(): boolean;
  2330. transferToEffect(effect: Effect, directionUniformName: string): void;
  2331. _getWorldMatrix(): Matrix;
  2332. }
  2333. }
  2334. declare module BABYLON {
  2335. class HemisphericLight extends Light {
  2336. direction: Vector3;
  2337. groundColor: Color3;
  2338. private _worldMatrix;
  2339. constructor(name: string, direction: Vector3, scene: Scene);
  2340. setDirectionToTarget(target: Vector3): Vector3;
  2341. getShadowGenerator(): ShadowGenerator;
  2342. transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void;
  2343. _getWorldMatrix(): Matrix;
  2344. }
  2345. }
  2346. declare module BABYLON {
  2347. interface IShadowLight {
  2348. position: Vector3;
  2349. direction: Vector3;
  2350. transformedPosition: Vector3;
  2351. name: string;
  2352. computeTransformedPosition(): boolean;
  2353. getScene(): Scene;
  2354. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  2355. supportsVSM(): boolean;
  2356. needRefreshPerFrame(): boolean;
  2357. _shadowGenerator: ShadowGenerator;
  2358. }
  2359. class Light extends Node {
  2360. diffuse: Color3;
  2361. specular: Color3;
  2362. intensity: number;
  2363. range: number;
  2364. includeOnlyWithLayerMask: number;
  2365. includedOnlyMeshes: AbstractMesh[];
  2366. excludedMeshes: AbstractMesh[];
  2367. excludeWithLayerMask: number;
  2368. _shadowGenerator: ShadowGenerator;
  2369. private _parentedWorldMatrix;
  2370. _excludedMeshesIds: string[];
  2371. _includedOnlyMeshesIds: string[];
  2372. constructor(name: string, scene: Scene);
  2373. getShadowGenerator(): ShadowGenerator;
  2374. getAbsolutePosition(): Vector3;
  2375. transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void;
  2376. _getWorldMatrix(): Matrix;
  2377. canAffectMesh(mesh: AbstractMesh): boolean;
  2378. getWorldMatrix(): Matrix;
  2379. dispose(): void;
  2380. }
  2381. }
  2382. declare module BABYLON {
  2383. class PointLight extends Light {
  2384. position: Vector3;
  2385. private _worldMatrix;
  2386. private _transformedPosition;
  2387. constructor(name: string, position: Vector3, scene: Scene);
  2388. getAbsolutePosition(): Vector3;
  2389. transferToEffect(effect: Effect, positionUniformName: string): void;
  2390. getShadowGenerator(): ShadowGenerator;
  2391. _getWorldMatrix(): Matrix;
  2392. }
  2393. }
  2394. declare module BABYLON {
  2395. class SpotLight extends Light implements IShadowLight {
  2396. position: Vector3;
  2397. direction: Vector3;
  2398. angle: number;
  2399. exponent: number;
  2400. transformedPosition: Vector3;
  2401. private _transformedDirection;
  2402. private _worldMatrix;
  2403. constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
  2404. getAbsolutePosition(): Vector3;
  2405. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  2406. supportsVSM(): boolean;
  2407. needRefreshPerFrame(): boolean;
  2408. setDirectionToTarget(target: Vector3): Vector3;
  2409. computeTransformedPosition(): boolean;
  2410. transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void;
  2411. _getWorldMatrix(): Matrix;
  2412. }
  2413. }
  2414. declare module BABYLON {
  2415. class EffectFallbacks {
  2416. private _defines;
  2417. private _currentRank;
  2418. private _maxRank;
  2419. addFallback(rank: number, define: string): void;
  2420. isMoreFallbacks: boolean;
  2421. reduce(currentDefines: string): string;
  2422. }
  2423. class Effect {
  2424. name: any;
  2425. defines: string;
  2426. onCompiled: (effect: Effect) => void;
  2427. onError: (effect: Effect, errors: string) => void;
  2428. onBind: (effect: Effect) => void;
  2429. private _engine;
  2430. private _uniformsNames;
  2431. private _samplers;
  2432. private _isReady;
  2433. private _compilationError;
  2434. private _attributesNames;
  2435. private _attributes;
  2436. private _uniforms;
  2437. _key: string;
  2438. private _program;
  2439. private _valueCache;
  2440. constructor(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], engine: any, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void);
  2441. isReady(): boolean;
  2442. getProgram(): WebGLProgram;
  2443. getAttributesNames(): string[];
  2444. getAttributeLocation(index: number): number;
  2445. getAttributeLocationByName(name: string): number;
  2446. getAttributesCount(): number;
  2447. getUniformIndex(uniformName: string): number;
  2448. getUniform(uniformName: string): WebGLUniformLocation;
  2449. getSamplers(): string[];
  2450. getCompilationError(): string;
  2451. _loadVertexShader(vertex: any, callback: (data: any) => void): void;
  2452. _loadFragmentShader(fragment: any, callback: (data: any) => void): void;
  2453. private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?);
  2454. _bindTexture(channel: string, texture: WebGLTexture): void;
  2455. setTexture(channel: string, texture: BaseTexture): void;
  2456. setTextureFromPostProcess(channel: string, postProcess: PostProcess): void;
  2457. _cacheFloat2(uniformName: string, x: number, y: number): void;
  2458. _cacheFloat3(uniformName: string, x: number, y: number, z: number): void;
  2459. _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): void;
  2460. setArray(uniformName: string, array: number[]): Effect;
  2461. setArray2(uniformName: string, array: number[]): Effect;
  2462. setArray3(uniformName: string, array: number[]): Effect;
  2463. setArray4(uniformName: string, array: number[]): Effect;
  2464. setMatrices(uniformName: string, matrices: Float32Array): Effect;
  2465. setMatrix(uniformName: string, matrix: Matrix): Effect;
  2466. setMatrix3x3(uniformName: string, matrix: Float32Array): Effect;
  2467. setMatrix2x2(uniformname: string, matrix: Float32Array): Effect;
  2468. setFloat(uniformName: string, value: number): Effect;
  2469. setBool(uniformName: string, bool: boolean): Effect;
  2470. setVector2(uniformName: string, vector2: Vector2): Effect;
  2471. setFloat2(uniformName: string, x: number, y: number): Effect;
  2472. setVector3(uniformName: string, vector3: Vector3): Effect;
  2473. setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
  2474. setVector4(uniformName: string, vector4: Vector4): Effect;
  2475. setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
  2476. setColor3(uniformName: string, color3: Color3): Effect;
  2477. setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
  2478. static ShadersStore: {};
  2479. }
  2480. }
  2481. declare module BABYLON {
  2482. class Material {
  2483. name: string;
  2484. private static _TriangleFillMode;
  2485. private static _WireFrameFillMode;
  2486. private static _PointFillMode;
  2487. static TriangleFillMode: number;
  2488. static WireFrameFillMode: number;
  2489. static PointFillMode: number;
  2490. private static _ClockWiseSideOrientation;
  2491. private static _CounterClockWiseSideOrientation;
  2492. static ClockWiseSideOrientation: number;
  2493. static CounterClockWiseSideOrientation: number;
  2494. id: string;
  2495. checkReadyOnEveryCall: boolean;
  2496. checkReadyOnlyOnce: boolean;
  2497. state: string;
  2498. alpha: number;
  2499. backFaceCulling: boolean;
  2500. sideOrientation: number;
  2501. onCompiled: (effect: Effect) => void;
  2502. onError: (effect: Effect, errors: string) => void;
  2503. onDispose: () => void;
  2504. onBind: (material: Material, mesh: Mesh) => void;
  2505. getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
  2506. alphaMode: number;
  2507. disableDepthWrite: boolean;
  2508. fogEnabled: boolean;
  2509. _effect: Effect;
  2510. _wasPreviouslyReady: boolean;
  2511. private _scene;
  2512. private _fillMode;
  2513. private _cachedDepthWriteState;
  2514. pointSize: number;
  2515. zOffset: number;
  2516. wireframe: boolean;
  2517. pointsCloud: boolean;
  2518. fillMode: number;
  2519. constructor(name: string, scene: Scene, doNotAdd?: boolean);
  2520. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  2521. getEffect(): Effect;
  2522. getScene(): Scene;
  2523. needAlphaBlending(): boolean;
  2524. needAlphaTesting(): boolean;
  2525. getAlphaTestTexture(): BaseTexture;
  2526. trackCreation(onCompiled: (effect: Effect) => void, onError: (effect: Effect, errors: string) => void): void;
  2527. _preBind(): void;
  2528. bind(world: Matrix, mesh?: Mesh): void;
  2529. bindOnlyWorldMatrix(world: Matrix): void;
  2530. unbind(): void;
  2531. clone(name: string): Material;
  2532. getBindedMeshes(): AbstractMesh[];
  2533. dispose(forceDisposeEffect?: boolean): void;
  2534. copyTo(other: Material): void;
  2535. }
  2536. }
  2537. declare module BABYLON {
  2538. class MultiMaterial extends Material {
  2539. subMaterials: Material[];
  2540. constructor(name: string, scene: Scene);
  2541. getSubMaterial(index: any): Material;
  2542. isReady(mesh?: AbstractMesh): boolean;
  2543. clone(name: string): MultiMaterial;
  2544. }
  2545. }
  2546. declare module BABYLON {
  2547. class PBRMaterial extends Material {
  2548. albedoColor: Color3;
  2549. private _worldViewProjectionMatrix;
  2550. private _globalAmbientColor;
  2551. private _scaledDiffuse;
  2552. private _scaledSpecular;
  2553. private _renderId;
  2554. private _defines;
  2555. private _cachedDefines;
  2556. constructor(name: string, scene: Scene);
  2557. needAlphaBlending(): boolean;
  2558. needAlphaTesting(): boolean;
  2559. getAlphaTestTexture(): BaseTexture;
  2560. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  2561. bindOnlyWorldMatrix(world: Matrix): void;
  2562. bind(world: Matrix, mesh?: Mesh): void;
  2563. getAnimatables(): IAnimatable[];
  2564. dispose(forceDisposeEffect?: boolean): void;
  2565. clone(name: string): PBRMaterial;
  2566. }
  2567. }
  2568. declare module BABYLON {
  2569. class ShaderMaterial extends Material {
  2570. private _shaderPath;
  2571. private _options;
  2572. private _textures;
  2573. private _floats;
  2574. private _floatsArrays;
  2575. private _colors3;
  2576. private _colors4;
  2577. private _vectors2;
  2578. private _vectors3;
  2579. private _vectors4;
  2580. private _matrices;
  2581. private _matrices3x3;
  2582. private _matrices2x2;
  2583. private _cachedWorldViewMatrix;
  2584. private _renderId;
  2585. constructor(name: string, scene: Scene, shaderPath: any, options: any);
  2586. needAlphaBlending(): boolean;
  2587. needAlphaTesting(): boolean;
  2588. private _checkUniform(uniformName);
  2589. setTexture(name: string, texture: Texture): ShaderMaterial;
  2590. setFloat(name: string, value: number): ShaderMaterial;
  2591. setFloats(name: string, value: number[]): ShaderMaterial;
  2592. setColor3(name: string, value: Color3): ShaderMaterial;
  2593. setColor4(name: string, value: Color4): ShaderMaterial;
  2594. setVector2(name: string, value: Vector2): ShaderMaterial;
  2595. setVector3(name: string, value: Vector3): ShaderMaterial;
  2596. setVector4(name: string, value: Vector4): ShaderMaterial;
  2597. setMatrix(name: string, value: Matrix): ShaderMaterial;
  2598. setMatrix3x3(name: string, value: Float32Array): ShaderMaterial;
  2599. setMatrix2x2(name: string, value: Float32Array): ShaderMaterial;
  2600. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  2601. bindOnlyWorldMatrix(world: Matrix): void;
  2602. bind(world: Matrix, mesh?: Mesh): void;
  2603. clone(name: string): ShaderMaterial;
  2604. dispose(forceDisposeEffect?: boolean): void;
  2605. }
  2606. }
  2607. declare module BABYLON {
  2608. class FresnelParameters {
  2609. isEnabled: boolean;
  2610. leftColor: Color3;
  2611. rightColor: Color3;
  2612. bias: number;
  2613. power: number;
  2614. clone(): FresnelParameters;
  2615. }
  2616. class StandardMaterial extends Material {
  2617. diffuseTexture: BaseTexture;
  2618. ambientTexture: BaseTexture;
  2619. opacityTexture: BaseTexture;
  2620. reflectionTexture: BaseTexture;
  2621. emissiveTexture: BaseTexture;
  2622. specularTexture: BaseTexture;
  2623. bumpTexture: BaseTexture;
  2624. lightmapTexture: BaseTexture;
  2625. ambientColor: Color3;
  2626. diffuseColor: Color3;
  2627. specularColor: Color3;
  2628. specularPower: number;
  2629. emissiveColor: Color3;
  2630. useAlphaFromDiffuseTexture: boolean;
  2631. useEmissiveAsIllumination: boolean;
  2632. useReflectionFresnelFromSpecular: boolean;
  2633. useSpecularOverAlpha: boolean;
  2634. disableLighting: boolean;
  2635. roughness: number;
  2636. lightmapThreshold: number;
  2637. diffuseFresnelParameters: FresnelParameters;
  2638. opacityFresnelParameters: FresnelParameters;
  2639. reflectionFresnelParameters: FresnelParameters;
  2640. emissiveFresnelParameters: FresnelParameters;
  2641. useGlossinessFromSpecularMapAlpha: boolean;
  2642. private _renderTargets;
  2643. private _worldViewProjectionMatrix;
  2644. private _globalAmbientColor;
  2645. private _scaledDiffuse;
  2646. private _scaledSpecular;
  2647. private _renderId;
  2648. private _defines;
  2649. private _cachedDefines;
  2650. constructor(name: string, scene: Scene);
  2651. needAlphaBlending(): boolean;
  2652. needAlphaTesting(): boolean;
  2653. private _shouldUseAlphaFromDiffuseTexture();
  2654. getAlphaTestTexture(): BaseTexture;
  2655. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  2656. unbind(): void;
  2657. bindOnlyWorldMatrix(world: Matrix): void;
  2658. bind(world: Matrix, mesh?: Mesh): void;
  2659. getAnimatables(): IAnimatable[];
  2660. dispose(forceDisposeEffect?: boolean): void;
  2661. clone(name: string): StandardMaterial;
  2662. static DiffuseTextureEnabled: boolean;
  2663. static AmbientTextureEnabled: boolean;
  2664. static OpacityTextureEnabled: boolean;
  2665. static ReflectionTextureEnabled: boolean;
  2666. static EmissiveTextureEnabled: boolean;
  2667. static SpecularTextureEnabled: boolean;
  2668. static BumpTextureEnabled: boolean;
  2669. static FresnelEnabled: boolean;
  2670. static LightmapEnabled: boolean;
  2671. }
  2672. }
  2673. declare module BABYLON {
  2674. interface ISceneLoaderPlugin {
  2675. extensions: string;
  2676. importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean;
  2677. load: (scene: Scene, data: string, rootUrl: string) => boolean;
  2678. }
  2679. class SceneLoader {
  2680. private static _ForceFullSceneLoadingForIncremental;
  2681. private static _ShowLoadingScreen;
  2682. static ForceFullSceneLoadingForIncremental: boolean;
  2683. static ShowLoadingScreen: boolean;
  2684. private static _registeredPlugins;
  2685. private static _getPluginForFilename(sceneFilename);
  2686. static RegisterPlugin(plugin: ISceneLoaderPlugin): void;
  2687. static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, e: any) => void): void;
  2688. /**
  2689. * Load a scene
  2690. * @param rootUrl a string that defines the root url for scene and resources
  2691. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  2692. * @param engine is the instance of BABYLON.Engine to use to create the scene
  2693. */
  2694. static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  2695. /**
  2696. * Append a scene
  2697. * @param rootUrl a string that defines the root url for scene and resources
  2698. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  2699. * @param scene is the instance of BABYLON.Scene to append to
  2700. */
  2701. static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  2702. }
  2703. }
  2704. declare module BABYLON {
  2705. class Particle {
  2706. position: Vector3;
  2707. direction: Vector3;
  2708. color: Color4;
  2709. colorStep: Color4;
  2710. lifeTime: number;
  2711. age: number;
  2712. size: number;
  2713. angle: number;
  2714. angularSpeed: number;
  2715. copyTo(other: Particle): void;
  2716. }
  2717. }
  2718. declare module BABYLON {
  2719. class ParticleSystem implements IDisposable {
  2720. name: string;
  2721. static BLENDMODE_ONEONE: number;
  2722. static BLENDMODE_STANDARD: number;
  2723. id: string;
  2724. renderingGroupId: number;
  2725. emitter: any;
  2726. emitRate: number;
  2727. manualEmitCount: number;
  2728. updateSpeed: number;
  2729. targetStopDuration: number;
  2730. disposeOnStop: boolean;
  2731. minEmitPower: number;
  2732. maxEmitPower: number;
  2733. minLifeTime: number;
  2734. maxLifeTime: number;
  2735. minSize: number;
  2736. maxSize: number;
  2737. minAngularSpeed: number;
  2738. maxAngularSpeed: number;
  2739. particleTexture: Texture;
  2740. layerMask: number;
  2741. onDispose: () => void;
  2742. updateFunction: (particles: Particle[]) => void;
  2743. blendMode: number;
  2744. forceDepthWrite: boolean;
  2745. gravity: Vector3;
  2746. direction1: Vector3;
  2747. direction2: Vector3;
  2748. minEmitBox: Vector3;
  2749. maxEmitBox: Vector3;
  2750. color1: Color4;
  2751. color2: Color4;
  2752. colorDead: Color4;
  2753. textureMask: Color4;
  2754. startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3) => void;
  2755. startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3) => void;
  2756. private particles;
  2757. private _capacity;
  2758. private _scene;
  2759. private _vertexDeclaration;
  2760. private _vertexStrideSize;
  2761. private _stockParticles;
  2762. private _newPartsExcess;
  2763. private _vertexBuffer;
  2764. private _indexBuffer;
  2765. private _vertices;
  2766. private _effect;
  2767. private _customEffect;
  2768. private _cachedDefines;
  2769. private _scaledColorStep;
  2770. private _colorDiff;
  2771. private _scaledDirection;
  2772. private _scaledGravity;
  2773. private _currentRenderId;
  2774. private _alive;
  2775. private _started;
  2776. private _stopped;
  2777. private _actualFrame;
  2778. private _scaledUpdateSpeed;
  2779. constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
  2780. recycleParticle(particle: Particle): void;
  2781. getCapacity(): number;
  2782. isAlive(): boolean;
  2783. isStarted(): boolean;
  2784. start(): void;
  2785. stop(): void;
  2786. _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void;
  2787. private _update(newParticles);
  2788. private _getEffect();
  2789. animate(): void;
  2790. render(): number;
  2791. dispose(): void;
  2792. clone(name: string, newEmitter: any): ParticleSystem;
  2793. }
  2794. }
  2795. declare module BABYLON {
  2796. class Color3 {
  2797. r: number;
  2798. g: number;
  2799. b: number;
  2800. constructor(r?: number, g?: number, b?: number);
  2801. toString(): string;
  2802. toArray(array: number[], index?: number): Color3;
  2803. toColor4(alpha?: number): Color4;
  2804. asArray(): number[];
  2805. toLuminance(): number;
  2806. multiply(otherColor: Color3): Color3;
  2807. multiplyToRef(otherColor: Color3, result: Color3): Color3;
  2808. equals(otherColor: Color3): boolean;
  2809. equalsFloats(r: number, g: number, b: number): boolean;
  2810. scale(scale: number): Color3;
  2811. scaleToRef(scale: number, result: Color3): Color3;
  2812. add(otherColor: Color3): Color3;
  2813. addToRef(otherColor: Color3, result: Color3): Color3;
  2814. subtract(otherColor: Color3): Color3;
  2815. subtractToRef(otherColor: Color3, result: Color3): Color3;
  2816. clone(): Color3;
  2817. copyFrom(source: Color3): Color3;
  2818. copyFromFloats(r: number, g: number, b: number): Color3;
  2819. toHexString(): string;
  2820. static FromHexString(hex: string): Color3;
  2821. static FromArray(array: number[], offset?: number): Color3;
  2822. static FromInts(r: number, g: number, b: number): Color3;
  2823. static Lerp(start: Color3, end: Color3, amount: number): Color3;
  2824. static Red(): Color3;
  2825. static Green(): Color3;
  2826. static Blue(): Color3;
  2827. static Black(): Color3;
  2828. static White(): Color3;
  2829. static Purple(): Color3;
  2830. static Magenta(): Color3;
  2831. static Yellow(): Color3;
  2832. static Gray(): Color3;
  2833. }
  2834. class Color4 {
  2835. r: number;
  2836. g: number;
  2837. b: number;
  2838. a: number;
  2839. constructor(r: number, g: number, b: number, a: number);
  2840. addInPlace(right: any): Color4;
  2841. asArray(): number[];
  2842. toArray(array: number[], index?: number): Color4;
  2843. add(right: Color4): Color4;
  2844. subtract(right: Color4): Color4;
  2845. subtractToRef(right: Color4, result: Color4): Color4;
  2846. scale(scale: number): Color4;
  2847. scaleToRef(scale: number, result: Color4): Color4;
  2848. toString(): string;
  2849. clone(): Color4;
  2850. copyFrom(source: Color4): Color4;
  2851. toHexString(): string;
  2852. static FromHexString(hex: string): Color4;
  2853. static Lerp(left: Color4, right: Color4, amount: number): Color4;
  2854. static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
  2855. static FromArray(array: number[], offset?: number): Color4;
  2856. static FromInts(r: number, g: number, b: number, a: number): Color4;
  2857. }
  2858. class Vector2 {
  2859. x: number;
  2860. y: number;
  2861. constructor(x: number, y: number);
  2862. toString(): string;
  2863. toArray(array: number[], index?: number): Vector2;
  2864. asArray(): number[];
  2865. copyFrom(source: Vector2): Vector2;
  2866. copyFromFloats(x: number, y: number): Vector2;
  2867. add(otherVector: Vector2): Vector2;
  2868. addVector3(otherVector: Vector3): Vector2;
  2869. subtract(otherVector: Vector2): Vector2;
  2870. subtractInPlace(otherVector: Vector2): Vector2;
  2871. multiplyInPlace(otherVector: Vector2): Vector2;
  2872. multiply(otherVector: Vector2): Vector2;
  2873. multiplyToRef(otherVector: Vector2, result: Vector2): Vector2;
  2874. multiplyByFloats(x: number, y: number): Vector2;
  2875. divide(otherVector: Vector2): Vector2;
  2876. divideToRef(otherVector: Vector2, result: Vector2): Vector2;
  2877. negate(): Vector2;
  2878. scaleInPlace(scale: number): Vector2;
  2879. scale(scale: number): Vector2;
  2880. equals(otherVector: Vector2): boolean;
  2881. equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean;
  2882. length(): number;
  2883. lengthSquared(): number;
  2884. normalize(): Vector2;
  2885. clone(): Vector2;
  2886. static Zero(): Vector2;
  2887. static FromArray(array: number[], offset?: number): Vector2;
  2888. static FromArrayToRef(array: number[], offset: number, result: Vector2): void;
  2889. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  2890. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  2891. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  2892. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  2893. static Dot(left: Vector2, right: Vector2): number;
  2894. static Normalize(vector: Vector2): Vector2;
  2895. static Minimize(left: Vector2, right: Vector2): Vector2;
  2896. static Maximize(left: Vector2, right: Vector2): Vector2;
  2897. static Transform(vector: Vector2, transformation: Matrix): Vector2;
  2898. static Distance(value1: Vector2, value2: Vector2): number;
  2899. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  2900. }
  2901. class Vector3 {
  2902. x: number;
  2903. y: number;
  2904. z: number;
  2905. constructor(x: number, y: number, z: number);
  2906. toString(): string;
  2907. asArray(): number[];
  2908. toArray(array: number[], index?: number): Vector3;
  2909. toQuaternion(): Quaternion;
  2910. addInPlace(otherVector: Vector3): Vector3;
  2911. add(otherVector: Vector3): Vector3;
  2912. addToRef(otherVector: Vector3, result: Vector3): Vector3;
  2913. subtractInPlace(otherVector: Vector3): Vector3;
  2914. subtract(otherVector: Vector3): Vector3;
  2915. subtractToRef(otherVector: Vector3, result: Vector3): Vector3;
  2916. subtractFromFloats(x: number, y: number, z: number): Vector3;
  2917. subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3;
  2918. negate(): Vector3;
  2919. scaleInPlace(scale: number): Vector3;
  2920. scale(scale: number): Vector3;
  2921. scaleToRef(scale: number, result: Vector3): void;
  2922. equals(otherVector: Vector3): boolean;
  2923. equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean;
  2924. equalsToFloats(x: number, y: number, z: number): boolean;
  2925. multiplyInPlace(otherVector: Vector3): Vector3;
  2926. multiply(otherVector: Vector3): Vector3;
  2927. multiplyToRef(otherVector: Vector3, result: Vector3): Vector3;
  2928. multiplyByFloats(x: number, y: number, z: number): Vector3;
  2929. divide(otherVector: Vector3): Vector3;
  2930. divideToRef(otherVector: Vector3, result: Vector3): Vector3;
  2931. MinimizeInPlace(other: Vector3): Vector3;
  2932. MaximizeInPlace(other: Vector3): Vector3;
  2933. length(): number;
  2934. lengthSquared(): number;
  2935. normalize(): Vector3;
  2936. clone(): Vector3;
  2937. copyFrom(source: Vector3): Vector3;
  2938. copyFromFloats(x: number, y: number, z: number): Vector3;
  2939. static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number;
  2940. static FromArray(array: number[], offset?: number): Vector3;
  2941. static FromFloatArray(array: Float32Array, offset?: number): Vector3;
  2942. static FromArrayToRef(array: number[], offset: number, result: Vector3): void;
  2943. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
  2944. static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  2945. static Zero(): Vector3;
  2946. static Up(): Vector3;
  2947. static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
  2948. static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  2949. static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  2950. static TransformCoordinatesToRefSIMD(vector: Vector3, transformation: Matrix, result: Vector3): void;
  2951. static TransformCoordinatesFromFloatsToRefSIMD(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  2952. static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
  2953. static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  2954. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  2955. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  2956. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  2957. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  2958. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  2959. static Dot(left: Vector3, right: Vector3): number;
  2960. static Cross(left: Vector3, right: Vector3): Vector3;
  2961. static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
  2962. static Normalize(vector: Vector3): Vector3;
  2963. static NormalizeToRef(vector: Vector3, result: Vector3): void;
  2964. static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
  2965. static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3;
  2966. static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
  2967. static Minimize(left: Vector3, right: Vector3): Vector3;
  2968. static Maximize(left: Vector3, right: Vector3): Vector3;
  2969. static Distance(value1: Vector3, value2: Vector3): number;
  2970. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  2971. static Center(value1: Vector3, value2: Vector3): Vector3;
  2972. /**
  2973. * Given three orthogonal left-handed oriented Vector3 axis in space (target system),
  2974. * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
  2975. * to something in order to rotate it from its local system to the given target system.
  2976. */
  2977. static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3;
  2978. /**
  2979. * The same than RotationFromAxis but updates the passed ref Vector3 parameter.
  2980. */
  2981. static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void;
  2982. }
  2983. class Vector4 {
  2984. x: number;
  2985. y: number;
  2986. z: number;
  2987. w: number;
  2988. constructor(x: number, y: number, z: number, w: number);
  2989. toString(): string;
  2990. asArray(): number[];
  2991. toArray(array: number[], index?: number): Vector4;
  2992. addInPlace(otherVector: Vector4): Vector4;
  2993. add(otherVector: Vector4): Vector4;
  2994. addToRef(otherVector: Vector4, result: Vector4): Vector4;
  2995. subtractInPlace(otherVector: Vector4): Vector4;
  2996. subtract(otherVector: Vector4): Vector4;
  2997. subtractToRef(otherVector: Vector4, result: Vector4): Vector4;
  2998. subtractFromFloats(x: number, y: number, z: number, w: number): Vector4;
  2999. subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4;
  3000. negate(): Vector4;
  3001. scaleInPlace(scale: number): Vector4;
  3002. scale(scale: number): Vector4;
  3003. scaleToRef(scale: number, result: Vector4): void;
  3004. equals(otherVector: Vector4): boolean;
  3005. equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean;
  3006. equalsToFloats(x: number, y: number, z: number, w: number): boolean;
  3007. multiplyInPlace(otherVector: Vector4): Vector4;
  3008. multiply(otherVector: Vector4): Vector4;
  3009. multiplyToRef(otherVector: Vector4, result: Vector4): Vector4;
  3010. multiplyByFloats(x: number, y: number, z: number, w: number): Vector4;
  3011. divide(otherVector: Vector4): Vector4;
  3012. divideToRef(otherVector: Vector4, result: Vector4): Vector4;
  3013. MinimizeInPlace(other: Vector4): Vector4;
  3014. MaximizeInPlace(other: Vector4): Vector4;
  3015. length(): number;
  3016. lengthSquared(): number;
  3017. normalize(): Vector4;
  3018. clone(): Vector4;
  3019. copyFrom(source: Vector4): Vector4;
  3020. copyFromFloats(x: number, y: number, z: number, w: number): Vector4;
  3021. static FromArray(array: number[], offset?: number): Vector4;
  3022. static FromArrayToRef(array: number[], offset: number, result: Vector4): void;
  3023. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void;
  3024. static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void;
  3025. static Zero(): Vector4;
  3026. static Normalize(vector: Vector4): Vector4;
  3027. static NormalizeToRef(vector: Vector4, result: Vector4): void;
  3028. static Minimize(left: Vector4, right: Vector4): Vector4;
  3029. static Maximize(left: Vector4, right: Vector4): Vector4;
  3030. static Distance(value1: Vector4, value2: Vector4): number;
  3031. static DistanceSquared(value1: Vector4, value2: Vector4): number;
  3032. static Center(value1: Vector4, value2: Vector4): Vector4;
  3033. }
  3034. class Quaternion {
  3035. x: number;
  3036. y: number;
  3037. z: number;
  3038. w: number;
  3039. constructor(x?: number, y?: number, z?: number, w?: number);
  3040. toString(): string;
  3041. asArray(): number[];
  3042. equals(otherQuaternion: Quaternion): boolean;
  3043. clone(): Quaternion;
  3044. copyFrom(other: Quaternion): Quaternion;
  3045. copyFromFloats(x: number, y: number, z: number, w: number): Quaternion;
  3046. add(other: Quaternion): Quaternion;
  3047. subtract(other: Quaternion): Quaternion;
  3048. scale(value: number): Quaternion;
  3049. multiply(q1: Quaternion): Quaternion;
  3050. multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion;
  3051. length(): number;
  3052. normalize(): Quaternion;
  3053. toEulerAngles(): Vector3;
  3054. toEulerAnglesToRef(result: Vector3): Quaternion;
  3055. toRotationMatrix(result: Matrix): Quaternion;
  3056. fromRotationMatrix(matrix: Matrix): Quaternion;
  3057. static FromRotationMatrix(matrix: Matrix): Quaternion;
  3058. static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void;
  3059. static Inverse(q: Quaternion): Quaternion;
  3060. static Identity(): Quaternion;
  3061. static RotationAxis(axis: Vector3, angle: number): Quaternion;
  3062. static FromArray(array: number[], offset?: number): Quaternion;
  3063. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
  3064. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
  3065. static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion;
  3066. static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void;
  3067. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  3068. }
  3069. class Matrix {
  3070. private static _tempQuaternion;
  3071. private static _xAxis;
  3072. private static _yAxis;
  3073. private static _zAxis;
  3074. m: Float32Array;
  3075. isIdentity(): boolean;
  3076. determinant(): number;
  3077. toArray(): Float32Array;
  3078. asArray(): Float32Array;
  3079. invert(): Matrix;
  3080. reset(): Matrix;
  3081. add(other: Matrix): Matrix;
  3082. addToRef(other: Matrix, result: Matrix): Matrix;
  3083. addToSelf(other: Matrix): Matrix;
  3084. invertToRef(other: Matrix): Matrix;
  3085. invertToRefSIMD(other: Matrix): Matrix;
  3086. setTranslation(vector3: Vector3): Matrix;
  3087. multiply(other: Matrix): Matrix;
  3088. copyFrom(other: Matrix): Matrix;
  3089. copyToArray(array: Float32Array, offset?: number): Matrix;
  3090. multiplyToRef(other: Matrix, result: Matrix): Matrix;
  3091. multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix;
  3092. multiplyToArraySIMD(other: Matrix, result: Matrix, offset?: number): void;
  3093. equals(value: Matrix): boolean;
  3094. clone(): Matrix;
  3095. decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean;
  3096. static FromArray(array: number[], offset?: number): Matrix;
  3097. static FromArrayToRef(array: number[], offset: number, result: Matrix): void;
  3098. static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void;
  3099. 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;
  3100. 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;
  3101. static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
  3102. static Identity(): Matrix;
  3103. static IdentityToRef(result: Matrix): void;
  3104. static Zero(): Matrix;
  3105. static RotationX(angle: number): Matrix;
  3106. static Invert(source: Matrix): Matrix;
  3107. static RotationXToRef(angle: number, result: Matrix): void;
  3108. static RotationY(angle: number): Matrix;
  3109. static RotationYToRef(angle: number, result: Matrix): void;
  3110. static RotationZ(angle: number): Matrix;
  3111. static RotationZToRef(angle: number, result: Matrix): void;
  3112. static RotationAxis(axis: Vector3, angle: number): Matrix;
  3113. static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void;
  3114. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  3115. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
  3116. static Scaling(x: number, y: number, z: number): Matrix;
  3117. static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
  3118. static Translation(x: number, y: number, z: number): Matrix;
  3119. static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
  3120. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  3121. static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  3122. static LookAtLHToRefSIMD(eyeRef: Vector3, targetRef: Vector3, upRef: Vector3, result: Matrix): void;
  3123. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  3124. static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void;
  3125. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  3126. static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  3127. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  3128. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  3129. static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, fovMode?: number): void;
  3130. static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
  3131. static GetAsMatrix2x2(matrix: Matrix): Float32Array;
  3132. static GetAsMatrix3x3(matrix: Matrix): Float32Array;
  3133. static Transpose(matrix: Matrix): Matrix;
  3134. static Reflection(plane: Plane): Matrix;
  3135. static ReflectionToRef(plane: Plane, result: Matrix): void;
  3136. }
  3137. class Plane {
  3138. normal: Vector3;
  3139. d: number;
  3140. constructor(a: number, b: number, c: number, d: number);
  3141. asArray(): number[];
  3142. clone(): Plane;
  3143. normalize(): Plane;
  3144. transform(transformation: Matrix): Plane;
  3145. dotCoordinate(point: any): number;
  3146. copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  3147. isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
  3148. signedDistanceTo(point: Vector3): number;
  3149. static FromArray(array: number[]): Plane;
  3150. static FromPoints(point1: any, point2: any, point3: any): Plane;
  3151. static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
  3152. static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
  3153. }
  3154. class Viewport {
  3155. x: number;
  3156. y: number;
  3157. width: number;
  3158. height: number;
  3159. constructor(x: number, y: number, width: number, height: number);
  3160. toGlobal(engine: any): Viewport;
  3161. }
  3162. class Frustum {
  3163. static GetPlanes(transform: Matrix): Plane[];
  3164. static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
  3165. }
  3166. class Ray {
  3167. origin: Vector3;
  3168. direction: Vector3;
  3169. length: number;
  3170. private _edge1;
  3171. private _edge2;
  3172. private _pvec;
  3173. private _tvec;
  3174. private _qvec;
  3175. constructor(origin: Vector3, direction: Vector3, length?: number);
  3176. intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
  3177. intersectsBox(box: BoundingBox): boolean;
  3178. intersectsSphere(sphere: any): boolean;
  3179. intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
  3180. static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
  3181. /**
  3182. * 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
  3183. * transformed to the given world matrix.
  3184. * @param origin The origin point
  3185. * @param end The end point
  3186. * @param world a matrix to transform the ray to. Default is the identity matrix.
  3187. */
  3188. static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
  3189. static Transform(ray: Ray, matrix: Matrix): Ray;
  3190. }
  3191. enum Space {
  3192. LOCAL = 0,
  3193. WORLD = 1,
  3194. }
  3195. class Axis {
  3196. static X: Vector3;
  3197. static Y: Vector3;
  3198. static Z: Vector3;
  3199. }
  3200. class BezierCurve {
  3201. static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number;
  3202. }
  3203. enum Orientation {
  3204. CW = 0,
  3205. CCW = 1,
  3206. }
  3207. class Angle {
  3208. private _radians;
  3209. constructor(radians: number);
  3210. degrees: () => number;
  3211. radians: () => number;
  3212. static BetweenTwoPoints(a: Vector2, b: Vector2): Angle;
  3213. static FromRadians(radians: number): Angle;
  3214. static FromDegrees(degrees: number): Angle;
  3215. }
  3216. class Arc2 {
  3217. startPoint: Vector2;
  3218. midPoint: Vector2;
  3219. endPoint: Vector2;
  3220. centerPoint: Vector2;
  3221. radius: number;
  3222. angle: Angle;
  3223. startAngle: Angle;
  3224. orientation: Orientation;
  3225. constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2);
  3226. }
  3227. class PathCursor {
  3228. private path;
  3229. private _onchange;
  3230. value: number;
  3231. animations: Animation[];
  3232. constructor(path: Path2);
  3233. getPoint(): Vector3;
  3234. moveAhead(step?: number): PathCursor;
  3235. moveBack(step?: number): PathCursor;
  3236. move(step: number): PathCursor;
  3237. private ensureLimits();
  3238. private markAsDirty(propertyName);
  3239. private raiseOnChange();
  3240. onchange(f: (cursor: PathCursor) => void): PathCursor;
  3241. }
  3242. class Path2 {
  3243. private _points;
  3244. private _length;
  3245. closed: boolean;
  3246. constructor(x: number, y: number);
  3247. addLineTo(x: number, y: number): Path2;
  3248. addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2;
  3249. close(): Path2;
  3250. length(): number;
  3251. getPoints(): Vector2[];
  3252. getPointAtLengthPosition(normalizedLengthPosition: number): Vector2;
  3253. static StartingAt(x: number, y: number): Path2;
  3254. }
  3255. class Path3D {
  3256. path: Vector3[];
  3257. private _curve;
  3258. private _distances;
  3259. private _tangents;
  3260. private _normals;
  3261. private _binormals;
  3262. private _raw;
  3263. /**
  3264. * new Path3D(path, normal, raw)
  3265. * path : an array of Vector3, the curve axis of the Path3D
  3266. * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.
  3267. * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.
  3268. */
  3269. constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean);
  3270. getCurve(): Vector3[];
  3271. getTangents(): Vector3[];
  3272. getNormals(): Vector3[];
  3273. getBinormals(): Vector3[];
  3274. getDistances(): number[];
  3275. update(path: Vector3[], firstNormal?: Vector3): Path3D;
  3276. private _compute(firstNormal);
  3277. private _getFirstNonNullVector(index);
  3278. private _getLastNonNullVector(index);
  3279. private _normalVector(v0, vt, va);
  3280. }
  3281. class Curve3 {
  3282. private _points;
  3283. private _length;
  3284. static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3;
  3285. static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3;
  3286. static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3;
  3287. constructor(points: Vector3[]);
  3288. getPoints(): Vector3[];
  3289. length(): number;
  3290. continue(curve: Curve3): Curve3;
  3291. private _computeLength(path);
  3292. }
  3293. class PositionNormalVertex {
  3294. position: Vector3;
  3295. normal: Vector3;
  3296. constructor(position?: Vector3, normal?: Vector3);
  3297. clone(): PositionNormalVertex;
  3298. }
  3299. class PositionNormalTextureVertex {
  3300. position: Vector3;
  3301. normal: Vector3;
  3302. uv: Vector2;
  3303. constructor(position?: Vector3, normal?: Vector3, uv?: Vector2);
  3304. clone(): PositionNormalTextureVertex;
  3305. }
  3306. class SIMDHelper {
  3307. private static _isEnabled;
  3308. static IsEnabled: boolean;
  3309. static DisableSIMD(): void;
  3310. static EnableSIMD(): void;
  3311. }
  3312. }
  3313. declare module BABYLON {
  3314. class AbstractMesh extends Node implements IDisposable {
  3315. private static _BILLBOARDMODE_NONE;
  3316. private static _BILLBOARDMODE_X;
  3317. private static _BILLBOARDMODE_Y;
  3318. private static _BILLBOARDMODE_Z;
  3319. private static _BILLBOARDMODE_ALL;
  3320. static BILLBOARDMODE_NONE: number;
  3321. static BILLBOARDMODE_X: number;
  3322. static BILLBOARDMODE_Y: number;
  3323. static BILLBOARDMODE_Z: number;
  3324. static BILLBOARDMODE_ALL: number;
  3325. definedFacingForward: boolean;
  3326. position: Vector3;
  3327. rotation: Vector3;
  3328. rotationQuaternion: Quaternion;
  3329. scaling: Vector3;
  3330. billboardMode: number;
  3331. visibility: number;
  3332. alphaIndex: number;
  3333. infiniteDistance: boolean;
  3334. isVisible: boolean;
  3335. isPickable: boolean;
  3336. showBoundingBox: boolean;
  3337. showSubMeshesBoundingBox: boolean;
  3338. onDispose: any;
  3339. isBlocker: boolean;
  3340. skeleton: Skeleton;
  3341. renderingGroupId: number;
  3342. material: Material;
  3343. receiveShadows: boolean;
  3344. actionManager: ActionManager;
  3345. renderOutline: boolean;
  3346. outlineColor: Color3;
  3347. outlineWidth: number;
  3348. renderOverlay: boolean;
  3349. overlayColor: Color3;
  3350. overlayAlpha: number;
  3351. hasVertexAlpha: boolean;
  3352. useVertexColors: boolean;
  3353. applyFog: boolean;
  3354. computeBonesUsingShaders: boolean;
  3355. scalingDeterminant: number;
  3356. useOctreeForRenderingSelection: boolean;
  3357. useOctreeForPicking: boolean;
  3358. useOctreeForCollisions: boolean;
  3359. layerMask: number;
  3360. alwaysSelectAsActiveMesh: boolean;
  3361. _physicImpostor: number;
  3362. _physicsMass: number;
  3363. _physicsFriction: number;
  3364. _physicRestitution: number;
  3365. private _checkCollisions;
  3366. ellipsoid: Vector3;
  3367. ellipsoidOffset: Vector3;
  3368. private _collider;
  3369. private _oldPositionForCollisions;
  3370. private _diffPositionForCollisions;
  3371. private _newPositionForCollisions;
  3372. onCollide: (collidedMesh: AbstractMesh) => void;
  3373. private _meshToBoneReferal;
  3374. edgesWidth: number;
  3375. edgesColor: Color4;
  3376. _edgesRenderer: EdgesRenderer;
  3377. private _localScaling;
  3378. private _localRotation;
  3379. private _localTranslation;
  3380. private _localBillboard;
  3381. private _localPivotScaling;
  3382. private _localPivotScalingRotation;
  3383. private _localMeshReferalTransform;
  3384. private _localWorld;
  3385. _worldMatrix: Matrix;
  3386. private _rotateYByPI;
  3387. private _absolutePosition;
  3388. private _collisionsTransformMatrix;
  3389. private _collisionsScalingMatrix;
  3390. _positions: Vector3[];
  3391. private _isDirty;
  3392. _masterMesh: AbstractMesh;
  3393. _boundingInfo: BoundingInfo;
  3394. private _pivotMatrix;
  3395. _isDisposed: boolean;
  3396. _renderId: number;
  3397. subMeshes: SubMesh[];
  3398. _submeshesOctree: Octree<SubMesh>;
  3399. _intersectionsInProgress: AbstractMesh[];
  3400. private _onAfterWorldMatrixUpdate;
  3401. private _isWorldMatrixFrozen;
  3402. _waitingActions: any;
  3403. _waitingFreezeWorldMatrix: boolean;
  3404. constructor(name: string, scene: Scene);
  3405. disableEdgesRendering(): void;
  3406. enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void;
  3407. isBlocked: boolean;
  3408. getLOD(camera: Camera): AbstractMesh;
  3409. getTotalVertices(): number;
  3410. getIndices(): number[];
  3411. getVerticesData(kind: string): number[];
  3412. isVerticesDataPresent(kind: string): boolean;
  3413. getBoundingInfo(): BoundingInfo;
  3414. useBones: boolean;
  3415. _preActivate(): void;
  3416. _activate(renderId: number): void;
  3417. getWorldMatrix(): Matrix;
  3418. worldMatrixFromCache: Matrix;
  3419. absolutePosition: Vector3;
  3420. freezeWorldMatrix(): void;
  3421. unfreezeWorldMatrix(): void;
  3422. isWorldMatrixFrozen: boolean;
  3423. rotate(axis: Vector3, amount: number, space: Space): void;
  3424. translate(axis: Vector3, distance: number, space: Space): void;
  3425. getAbsolutePosition(): Vector3;
  3426. setAbsolutePosition(absolutePosition: Vector3): void;
  3427. /**
  3428. * Perform relative position change from the point of view of behind the front of the mesh.
  3429. * This is performed taking into account the meshes current rotation, so you do not have to care.
  3430. * Supports definition of mesh facing forward or backward.
  3431. * @param {number} amountRight
  3432. * @param {number} amountUp
  3433. * @param {number} amountForward
  3434. */
  3435. movePOV(amountRight: number, amountUp: number, amountForward: number): void;
  3436. /**
  3437. * Calculate relative position change from the point of view of behind the front of the mesh.
  3438. * This is performed taking into account the meshes current rotation, so you do not have to care.
  3439. * Supports definition of mesh facing forward or backward.
  3440. * @param {number} amountRight
  3441. * @param {number} amountUp
  3442. * @param {number} amountForward
  3443. */
  3444. calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
  3445. /**
  3446. * Perform relative rotation change from the point of view of behind the front of the mesh.
  3447. * Supports definition of mesh facing forward or backward.
  3448. * @param {number} flipBack
  3449. * @param {number} twirlClockwise
  3450. * @param {number} tiltRight
  3451. */
  3452. rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void;
  3453. /**
  3454. * Calculate relative rotation change from the point of view of behind the front of the mesh.
  3455. * Supports definition of mesh facing forward or backward.
  3456. * @param {number} flipBack
  3457. * @param {number} twirlClockwise
  3458. * @param {number} tiltRight
  3459. */
  3460. calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
  3461. setPivotMatrix(matrix: Matrix): void;
  3462. getPivotMatrix(): Matrix;
  3463. _isSynchronized(): boolean;
  3464. _initCache(): void;
  3465. markAsDirty(property: string): void;
  3466. _updateBoundingInfo(): void;
  3467. _updateSubMeshesBoundingInfo(matrix: Matrix): void;
  3468. computeWorldMatrix(force?: boolean): Matrix;
  3469. /**
  3470. * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated
  3471. * @param func: callback function to add
  3472. */
  3473. registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
  3474. unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
  3475. setPositionWithLocalVector(vector3: Vector3): void;
  3476. getPositionExpressedInLocalSpace(): Vector3;
  3477. locallyTranslate(vector3: Vector3): void;
  3478. lookAt(targetPoint: Vector3, yawCor: number, pitchCor: number, rollCor: number): void;
  3479. attachToBone(bone: Bone, affectedMesh: AbstractMesh): void;
  3480. detachFromBone(): void;
  3481. isInFrustum(frustumPlanes: Plane[]): boolean;
  3482. isCompletelyInFrustum(camera?: Camera): boolean;
  3483. intersectsMesh(mesh: AbstractMesh, precise?: boolean): boolean;
  3484. intersectsPoint(point: Vector3): boolean;
  3485. setPhysicsState(impostor?: any, options?: PhysicsBodyCreationOptions): any;
  3486. getPhysicsImpostor(): number;
  3487. getPhysicsMass(): number;
  3488. getPhysicsFriction(): number;
  3489. getPhysicsRestitution(): number;
  3490. getPositionInCameraSpace(camera?: Camera): Vector3;
  3491. getDistanceToCamera(camera?: Camera): number;
  3492. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  3493. setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void;
  3494. updatePhysicsBodyPosition(): void;
  3495. checkCollisions: boolean;
  3496. moveWithCollisions(velocity: Vector3): void;
  3497. private _onCollisionPositionChange;
  3498. /**
  3499. * This function will create an octree to help select the right submeshes for rendering, picking and collisions
  3500. * Please note that you must have a decent number of submeshes to get performance improvements when using octree
  3501. */
  3502. createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
  3503. _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): void;
  3504. _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): void;
  3505. _checkCollision(collider: Collider): void;
  3506. _generatePointsArray(): boolean;
  3507. intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
  3508. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh;
  3509. releaseSubMeshes(): void;
  3510. dispose(doNotRecurse?: boolean): void;
  3511. }
  3512. }
  3513. declare module BABYLON {
  3514. class CSG {
  3515. private polygons;
  3516. matrix: Matrix;
  3517. position: Vector3;
  3518. rotation: Vector3;
  3519. rotationQuaternion: Quaternion;
  3520. scaling: Vector3;
  3521. static FromMesh(mesh: Mesh): CSG;
  3522. private static FromPolygons(polygons);
  3523. clone(): CSG;
  3524. private toPolygons();
  3525. union(csg: CSG): CSG;
  3526. unionInPlace(csg: CSG): void;
  3527. subtract(csg: CSG): CSG;
  3528. subtractInPlace(csg: CSG): void;
  3529. intersect(csg: CSG): CSG;
  3530. intersectInPlace(csg: CSG): void;
  3531. inverse(): CSG;
  3532. inverseInPlace(): void;
  3533. copyTransformAttributes(csg: CSG): CSG;
  3534. buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh;
  3535. toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh;
  3536. }
  3537. }
  3538. declare module BABYLON {
  3539. class Geometry implements IGetSetVerticesData {
  3540. id: string;
  3541. delayLoadState: number;
  3542. delayLoadingFile: string;
  3543. onGeometryUpdated: (geometry: Geometry, kind?: string) => void;
  3544. private _scene;
  3545. private _engine;
  3546. private _meshes;
  3547. private _totalVertices;
  3548. private _indices;
  3549. private _vertexBuffers;
  3550. private _isDisposed;
  3551. _delayInfo: any;
  3552. private _indexBuffer;
  3553. _boundingInfo: BoundingInfo;
  3554. _delayLoadingFunction: (any: any, geometry: Geometry) => void;
  3555. constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh);
  3556. getScene(): Scene;
  3557. getEngine(): Engine;
  3558. isReady(): boolean;
  3559. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  3560. setVerticesData(kind: string, data: number[], updatable?: boolean, stride?: number): void;
  3561. updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void;
  3562. updateVerticesData(kind: string, data: number[], updateExtends?: boolean): void;
  3563. getTotalVertices(): number;
  3564. getVerticesData(kind: string, copyWhenShared?: boolean): number[];
  3565. getVertexBuffer(kind: string): VertexBuffer;
  3566. getVertexBuffers(): VertexBuffer[];
  3567. isVerticesDataPresent(kind: string): boolean;
  3568. getVerticesDataKinds(): string[];
  3569. setIndices(indices: number[], totalVertices?: number): void;
  3570. getTotalIndices(): number;
  3571. getIndices(copyWhenShared?: boolean): number[];
  3572. getIndexBuffer(): any;
  3573. releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
  3574. applyToMesh(mesh: Mesh): void;
  3575. private _applyToMesh(mesh);
  3576. private notifyUpdate(kind?);
  3577. load(scene: Scene, onLoaded?: () => void): void;
  3578. isDisposed(): boolean;
  3579. dispose(): void;
  3580. copy(id: string): Geometry;
  3581. static ExtractFromMesh(mesh: Mesh, id: string): Geometry;
  3582. static RandomId(): string;
  3583. }
  3584. module Geometry.Primitives {
  3585. class _Primitive extends Geometry {
  3586. private _beingRegenerated;
  3587. private _canBeRegenerated;
  3588. constructor(id: string, scene: Scene, vertexData?: VertexData, canBeRegenerated?: boolean, mesh?: Mesh);
  3589. canBeRegenerated(): boolean;
  3590. regenerate(): void;
  3591. asNewGeometry(id: string): Geometry;
  3592. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  3593. setVerticesData(kind: string, data: number[], updatable?: boolean): void;
  3594. _regenerateVertexData(): VertexData;
  3595. copy(id: string): Geometry;
  3596. }
  3597. class Ribbon extends _Primitive {
  3598. pathArray: Vector3[][];
  3599. closeArray: boolean;
  3600. closePath: boolean;
  3601. offset: number;
  3602. side: number;
  3603. constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  3604. _regenerateVertexData(): VertexData;
  3605. copy(id: string): Geometry;
  3606. }
  3607. class Box extends _Primitive {
  3608. size: number;
  3609. side: number;
  3610. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  3611. _regenerateVertexData(): VertexData;
  3612. copy(id: string): Geometry;
  3613. }
  3614. class Sphere extends _Primitive {
  3615. segments: number;
  3616. diameter: number;
  3617. side: number;
  3618. constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  3619. _regenerateVertexData(): VertexData;
  3620. copy(id: string): Geometry;
  3621. }
  3622. class Disc extends _Primitive {
  3623. radius: number;
  3624. tessellation: number;
  3625. side: number;
  3626. constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  3627. _regenerateVertexData(): VertexData;
  3628. copy(id: string): Geometry;
  3629. }
  3630. class Cylinder extends _Primitive {
  3631. height: number;
  3632. diameterTop: number;
  3633. diameterBottom: number;
  3634. tessellation: number;
  3635. subdivisions: number;
  3636. side: number;
  3637. constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  3638. _regenerateVertexData(): VertexData;
  3639. copy(id: string): Geometry;
  3640. }
  3641. class Torus extends _Primitive {
  3642. diameter: number;
  3643. thickness: number;
  3644. tessellation: number;
  3645. side: number;
  3646. constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  3647. _regenerateVertexData(): VertexData;
  3648. copy(id: string): Geometry;
  3649. }
  3650. class Ground extends _Primitive {
  3651. width: number;
  3652. height: number;
  3653. subdivisions: number;
  3654. constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh);
  3655. _regenerateVertexData(): VertexData;
  3656. copy(id: string): Geometry;
  3657. }
  3658. class TiledGround extends _Primitive {
  3659. xmin: number;
  3660. zmin: number;
  3661. xmax: number;
  3662. zmax: number;
  3663. subdivisions: {
  3664. w: number;
  3665. h: number;
  3666. };
  3667. precision: {
  3668. w: number;
  3669. h: number;
  3670. };
  3671. constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  3672. w: number;
  3673. h: number;
  3674. }, precision: {
  3675. w: number;
  3676. h: number;
  3677. }, canBeRegenerated?: boolean, mesh?: Mesh);
  3678. _regenerateVertexData(): VertexData;
  3679. copy(id: string): Geometry;
  3680. }
  3681. class Plane extends _Primitive {
  3682. size: number;
  3683. side: number;
  3684. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  3685. _regenerateVertexData(): VertexData;
  3686. copy(id: string): Geometry;
  3687. }
  3688. class TorusKnot extends _Primitive {
  3689. radius: number;
  3690. tube: number;
  3691. radialSegments: number;
  3692. tubularSegments: number;
  3693. p: number;
  3694. q: number;
  3695. side: number;
  3696. constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  3697. _regenerateVertexData(): VertexData;
  3698. copy(id: string): Geometry;
  3699. }
  3700. }
  3701. }
  3702. declare module BABYLON {
  3703. class GroundMesh extends Mesh {
  3704. generateOctree: boolean;
  3705. private _worldInverse;
  3706. _subdivisions: number;
  3707. constructor(name: string, scene: Scene);
  3708. subdivisions: number;
  3709. optimize(chunksCount: number, octreeBlocksSize?: number): void;
  3710. getHeightAtCoordinates(x: number, z: number): number;
  3711. }
  3712. }
  3713. declare module BABYLON {
  3714. /**
  3715. * Creates an instance based on a source mesh.
  3716. */
  3717. class InstancedMesh extends AbstractMesh {
  3718. private _sourceMesh;
  3719. private _currentLOD;
  3720. constructor(name: string, source: Mesh);
  3721. receiveShadows: boolean;
  3722. material: Material;
  3723. visibility: number;
  3724. skeleton: Skeleton;
  3725. getTotalVertices(): number;
  3726. sourceMesh: Mesh;
  3727. getVerticesData(kind: string): number[];
  3728. isVerticesDataPresent(kind: string): boolean;
  3729. getIndices(): number[];
  3730. _positions: Vector3[];
  3731. refreshBoundingInfo(): void;
  3732. _preActivate(): void;
  3733. _activate(renderId: number): void;
  3734. getLOD(camera: Camera): AbstractMesh;
  3735. _syncSubMeshes(): void;
  3736. _generatePointsArray(): boolean;
  3737. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh;
  3738. dispose(doNotRecurse?: boolean): void;
  3739. }
  3740. }
  3741. declare module BABYLON {
  3742. class LinesMesh extends Mesh {
  3743. color: Color3;
  3744. alpha: number;
  3745. private _colorShader;
  3746. constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean);
  3747. material: Material;
  3748. isPickable: boolean;
  3749. checkCollisions: boolean;
  3750. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void;
  3751. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void;
  3752. intersects(ray: Ray, fastCheck?: boolean): any;
  3753. dispose(doNotRecurse?: boolean): void;
  3754. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh;
  3755. }
  3756. }
  3757. declare module BABYLON {
  3758. class _InstancesBatch {
  3759. mustReturn: boolean;
  3760. visibleInstances: InstancedMesh[][];
  3761. renderSelf: boolean[];
  3762. }
  3763. class Mesh extends AbstractMesh implements IGetSetVerticesData {
  3764. static _FRONTSIDE: number;
  3765. static _BACKSIDE: number;
  3766. static _DOUBLESIDE: number;
  3767. static _DEFAULTSIDE: number;
  3768. static _NO_CAP: number;
  3769. static _CAP_START: number;
  3770. static _CAP_END: number;
  3771. static _CAP_ALL: number;
  3772. static FRONTSIDE: number;
  3773. static BACKSIDE: number;
  3774. static DOUBLESIDE: number;
  3775. static DEFAULTSIDE: number;
  3776. static NO_CAP: number;
  3777. static CAP_START: number;
  3778. static CAP_END: number;
  3779. static CAP_ALL: number;
  3780. delayLoadState: number;
  3781. instances: InstancedMesh[];
  3782. delayLoadingFile: string;
  3783. _binaryInfo: any;
  3784. private _LODLevels;
  3785. onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
  3786. _geometry: Geometry;
  3787. private _onBeforeRenderCallbacks;
  3788. private _onAfterRenderCallbacks;
  3789. _delayInfo: any;
  3790. _delayLoadingFunction: (any: any, mesh: Mesh) => void;
  3791. _visibleInstances: any;
  3792. private _renderIdForInstances;
  3793. private _batchCache;
  3794. private _worldMatricesInstancesBuffer;
  3795. private _worldMatricesInstancesArray;
  3796. private _instancesBufferSize;
  3797. _shouldGenerateFlatShading: boolean;
  3798. private _preActivateId;
  3799. private _sideOrientation;
  3800. private _areNormalsFrozen;
  3801. private _sourcePositions;
  3802. private _sourceNormals;
  3803. /**
  3804. * @constructor
  3805. * @param {string} name - The value used by scene.getMeshByName() to do a lookup.
  3806. * @param {Scene} scene - The scene to add this mesh to.
  3807. * @param {Node} parent - The parent of this mesh, if it has one
  3808. * @param {Mesh} source - An optional Mesh from which geometry is shared, cloned.
  3809. * @param {boolean} doNotCloneChildren - When cloning, skip cloning child meshes of source, default False.
  3810. * When false, achieved by calling a clone(), also passing False.
  3811. * This will make creation of children, recursive.
  3812. */
  3813. constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean);
  3814. hasLODLevels: boolean;
  3815. private _sortLODLevels();
  3816. /**
  3817. * Add a mesh as LOD level triggered at the given distance.
  3818. * @param {number} distance - the distance from the center of the object to show this level
  3819. * @param {BABYLON.Mesh} mesh - the mesh to be added as LOD level
  3820. * @return {BABYLON.Mesh} this mesh (for chaining)
  3821. */
  3822. addLODLevel(distance: number, mesh: Mesh): Mesh;
  3823. getLODLevelAtDistance(distance: number): Mesh;
  3824. /**
  3825. * Remove a mesh from the LOD array
  3826. * @param {BABYLON.Mesh} mesh - the mesh to be removed.
  3827. * @return {BABYLON.Mesh} this mesh (for chaining)
  3828. */
  3829. removeLODLevel(mesh: Mesh): Mesh;
  3830. getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh;
  3831. geometry: Geometry;
  3832. getTotalVertices(): number;
  3833. getVerticesData(kind: string, copyWhenShared?: boolean): number[];
  3834. getVertexBuffer(kind: any): VertexBuffer;
  3835. isVerticesDataPresent(kind: string): boolean;
  3836. getVerticesDataKinds(): string[];
  3837. getTotalIndices(): number;
  3838. getIndices(copyWhenShared?: boolean): number[];
  3839. isBlocked: boolean;
  3840. isReady(): boolean;
  3841. isDisposed(): boolean;
  3842. sideOrientation: number;
  3843. areNormalsFrozen: boolean;
  3844. /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */
  3845. freezeNormals(): void;
  3846. /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */
  3847. unfreezeNormals(): void;
  3848. _preActivate(): void;
  3849. _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): void;
  3850. refreshBoundingInfo(): void;
  3851. _createGlobalSubMesh(): SubMesh;
  3852. subdivide(count: number): void;
  3853. setVerticesData(kind: any, data: any, updatable?: boolean, stride?: number): void;
  3854. updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void;
  3855. updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void;
  3856. updateMeshPositions(positionFunction: any, computeNormals?: boolean): void;
  3857. makeGeometryUnique(): void;
  3858. setIndices(indices: number[], totalVertices?: number): void;
  3859. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void;
  3860. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void;
  3861. registerBeforeRender(func: (mesh: AbstractMesh) => void): void;
  3862. unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void;
  3863. registerAfterRender(func: (mesh: AbstractMesh) => void): void;
  3864. unregisterAfterRender(func: (mesh: AbstractMesh) => void): void;
  3865. _getInstancesRenderList(subMeshId: number): _InstancesBatch;
  3866. _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): void;
  3867. _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix) => void): void;
  3868. render(subMesh: SubMesh, enableAlphaMode: boolean): void;
  3869. getEmittedParticleSystems(): ParticleSystem[];
  3870. getHierarchyEmittedParticleSystems(): ParticleSystem[];
  3871. getChildren(): Node[];
  3872. _checkDelayState(): void;
  3873. isInFrustum(frustumPlanes: Plane[]): boolean;
  3874. setMaterialByID(id: string): void;
  3875. getAnimatables(): IAnimatable[];
  3876. bakeTransformIntoVertices(transform: Matrix): void;
  3877. bakeCurrentTransformIntoVertices(): void;
  3878. _resetPointsArrayCache(): void;
  3879. _generatePointsArray(): boolean;
  3880. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): Mesh;
  3881. dispose(doNotRecurse?: boolean): void;
  3882. applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void;
  3883. applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void;
  3884. convertToFlatShadedMesh(): void;
  3885. flipFaces(flipNormals?: boolean): void;
  3886. createInstance(name: string): InstancedMesh;
  3887. synchronizeInstances(): void;
  3888. /**
  3889. * Simplify the mesh according to the given array of settings.
  3890. * Function will return immediately and will simplify async.
  3891. * @param settings a collection of simplification settings.
  3892. * @param parallelProcessing should all levels calculate parallel or one after the other.
  3893. * @param type the type of simplification to run.
  3894. * @param successCallback optional success callback to be called after the simplification finished processing all settings.
  3895. */
  3896. simplify(settings: Array<ISimplificationSettings>, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void;
  3897. /**
  3898. * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
  3899. * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
  3900. * This should be used together with the simplification to avoid disappearing triangles.
  3901. * @param successCallback an optional success callback to be called after the optimization finished.
  3902. */
  3903. optimizeIndices(successCallback?: (mesh?: Mesh) => void): void;
  3904. static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  3905. static CreateRibbon(name: string, options: {
  3906. pathArray: Vector3[][];
  3907. closeArray?: boolean;
  3908. closePath?: boolean;
  3909. offset?: number;
  3910. updatable?: boolean;
  3911. sideOrientation?: number;
  3912. instance?: Mesh;
  3913. }, scene?: Scene): Mesh;
  3914. static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  3915. static CreateDisc(name: string, options: {
  3916. radius: number;
  3917. tessellation: number;
  3918. updatable?: boolean;
  3919. sideOrientation?: number;
  3920. }, scene: Scene): Mesh;
  3921. static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  3922. static CreateBox(name: string, options: {
  3923. width?: number;
  3924. height?: number;
  3925. depth?: number;
  3926. faceUV?: Vector4[];
  3927. faceColors?: Color4[];
  3928. sideOrientation?: number;
  3929. updatable?: boolean;
  3930. }, scene: Scene): Mesh;
  3931. static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  3932. static CreateSphere(name: string, options: {
  3933. segments?: number;
  3934. diameter?: number;
  3935. diameterX?: number;
  3936. diameterY?: number;
  3937. diameterZ?: number;
  3938. arc?: number;
  3939. slice?: number;
  3940. sideOrientation?: number;
  3941. updatable?: boolean;
  3942. }, scene: any): Mesh;
  3943. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh;
  3944. static CreateCylinder(name: string, options: {
  3945. height?: number;
  3946. diameterTop?: number;
  3947. diameterBottom?: number;
  3948. diameter?: number;
  3949. tessellation?: number;
  3950. subdivisions?: number;
  3951. arc: number;
  3952. faceColors?: Color4[];
  3953. faceUV?: Vector4[];
  3954. updatable?: boolean;
  3955. sideOrientation?: number;
  3956. }, scene: any): Mesh;
  3957. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  3958. static CreateTorus(name: string, options: {
  3959. diameter?: number;
  3960. thickness?: number;
  3961. tessellation?: number;
  3962. updatable?: boolean;
  3963. sideOrientation?: number;
  3964. }, scene: any): Mesh;
  3965. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  3966. static CreateTorusKnot(name: string, options: {
  3967. radius?: number;
  3968. tube?: number;
  3969. radialSegments?: number;
  3970. tubularSegments?: number;
  3971. p?: number;
  3972. q?: number;
  3973. updatable?: boolean;
  3974. sideOrientation?: number;
  3975. }, scene: any): Mesh;
  3976. static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  3977. static CreateLines(name: string, options: {
  3978. points: Vector3[];
  3979. updatable?: boolean;
  3980. instance?: LinesMesh;
  3981. }, scene: Scene): LinesMesh;
  3982. static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  3983. static CreateDashedLines(name: string, options: {
  3984. points: Vector3[];
  3985. dashSize?: number;
  3986. gapSize?: number;
  3987. dashNb?: number;
  3988. updatable?: boolean;
  3989. instance?: LinesMesh;
  3990. }, scene: Scene): LinesMesh;
  3991. static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  3992. static ExtrudeShape(name: string, options: {
  3993. shape: Vector3[];
  3994. path: Vector3[];
  3995. scale?: number;
  3996. rotation?: number;
  3997. cap?: number;
  3998. updatable?: boolean;
  3999. sideOrientation?: number;
  4000. instance?: Mesh;
  4001. }, scene: Scene): Mesh;
  4002. static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: any, rotationFunction: any, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  4003. static ExtrudeShapeCustom(name: string, options: {
  4004. shape: Vector3[];
  4005. path: Vector3[];
  4006. scaleFunction?;
  4007. rotationFunction?;
  4008. ribbonCloseArray?: boolean;
  4009. ribbonClosePath?: boolean;
  4010. cap?: number;
  4011. updatable?: boolean;
  4012. sideOrientation?: number;
  4013. instance?: Mesh;
  4014. }, scene: Scene): Mesh;
  4015. private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance);
  4016. static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  4017. static CreateLathe(name: string, options: {
  4018. shape: Vector3[];
  4019. radius?: number;
  4020. tessellation?: number;
  4021. arc?: number;
  4022. closed: boolean;
  4023. updatable?: boolean;
  4024. sideOrientation?: number;
  4025. }, scene: Scene): Mesh;
  4026. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  4027. static CreatePlane(name: string, options: {
  4028. size?: number;
  4029. width?: number;
  4030. height?: number;
  4031. sideOrientation?: number;
  4032. updatable?: boolean;
  4033. }, scene: Scene): Mesh;
  4034. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh;
  4035. static CreateGround(name: string, options: {
  4036. width?: number;
  4037. height?: number;
  4038. subdivisions?: number;
  4039. updatable?: boolean;
  4040. }, scene: any): Mesh;
  4041. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  4042. w: number;
  4043. h: number;
  4044. }, precision: {
  4045. w: number;
  4046. h: number;
  4047. }, scene: Scene, updatable?: boolean): Mesh;
  4048. static CreateTiledGround(name: string, options: {
  4049. xmin?: number;
  4050. zmin?: number;
  4051. xmax?: number;
  4052. zmax?: number;
  4053. subdivisions?: {
  4054. w: number;
  4055. h: number;
  4056. };
  4057. precision?: {
  4058. w: number;
  4059. h: number;
  4060. };
  4061. updatable?: boolean;
  4062. }, scene: Scene): Mesh;
  4063. static CreateGroundFromHeightMap(name: string, url: string, options: {
  4064. width?: number;
  4065. height?: number;
  4066. subdivisions?: number;
  4067. minHeight?: number;
  4068. maxHeight?: number;
  4069. updatable?: boolean;
  4070. onReady?: (mesh: GroundMesh) => void;
  4071. }, scene: Scene): any;
  4072. static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void): any;
  4073. static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
  4074. (i: number, distance: number): number;
  4075. }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  4076. static CreateTube(name: string, options: {
  4077. path: Vector3[];
  4078. radius?: number;
  4079. tessellation?: number;
  4080. radiusFunction?: {
  4081. (i: number, distance: number): number;
  4082. };
  4083. cap?: number;
  4084. arc?: number;
  4085. updatable?: boolean;
  4086. sideOrientation?: number;
  4087. instance?: Mesh;
  4088. }, scene: Scene): Mesh;
  4089. static CreateDecal(name: string, sourceMesh: AbstractMesh, options: {
  4090. position?: Vector3;
  4091. normal?: Vector3;
  4092. size?: Vector3;
  4093. angle?: number;
  4094. }): any;
  4095. static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): any;
  4096. /**
  4097. * Update the vertex buffers by applying transformation from the bones
  4098. * @param {skeleton} skeleton to apply
  4099. */
  4100. applySkeleton(skeleton: Skeleton): Mesh;
  4101. static MinMax(meshes: AbstractMesh[]): {
  4102. min: Vector3;
  4103. max: Vector3;
  4104. };
  4105. static Center(meshesOrMinMaxVector: any): Vector3;
  4106. /**
  4107. * Merge the array of meshes into a single mesh for performance reasons.
  4108. * @param {Array<Mesh>} meshes - The vertices source. They should all be of the same material. Entries can empty
  4109. * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
  4110. * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
  4111. * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
  4112. */
  4113. static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh;
  4114. }
  4115. }
  4116. declare module BABYLON {
  4117. interface IGetSetVerticesData {
  4118. isVerticesDataPresent(kind: string): boolean;
  4119. getVerticesData(kind: string, copyWhenShared?: boolean): number[];
  4120. getIndices(copyWhenShared?: boolean): number[];
  4121. setVerticesData(kind: string, data: number[], updatable?: boolean): void;
  4122. updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void;
  4123. setIndices(indices: number[]): void;
  4124. }
  4125. class VertexData {
  4126. positions: number[];
  4127. normals: number[];
  4128. uvs: number[];
  4129. uvs2: number[];
  4130. uvs3: number[];
  4131. uvs4: number[];
  4132. uvs5: number[];
  4133. uvs6: number[];
  4134. colors: number[];
  4135. matricesIndices: number[];
  4136. matricesWeights: number[];
  4137. indices: number[];
  4138. set(data: number[], kind: string): void;
  4139. applyToMesh(mesh: Mesh, updatable?: boolean): void;
  4140. applyToGeometry(geometry: Geometry, updatable?: boolean): void;
  4141. updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void;
  4142. updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void;
  4143. private _applyTo(meshOrGeometry, updatable?);
  4144. private _update(meshOrGeometry, updateExtends?, makeItUnique?);
  4145. transform(matrix: Matrix): void;
  4146. merge(other: VertexData): void;
  4147. static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData;
  4148. static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData;
  4149. private static _ExtractFrom(meshOrGeometry, copyWhenShared?);
  4150. static CreateRibbon(options: {
  4151. pathArray: Vector3[][];
  4152. closeArray?: boolean;
  4153. closePath?: boolean;
  4154. offset?: number;
  4155. sideOrientation?: number;
  4156. }): VertexData;
  4157. static CreateBox(options: {
  4158. size?: number;
  4159. width?: number;
  4160. height?: number;
  4161. depth?: number;
  4162. faceUV?: Vector4[];
  4163. faceColors?: Color4[];
  4164. sideOrientation?: number;
  4165. }): VertexData;
  4166. static CreateSphere(options: {
  4167. segments?: number;
  4168. diameter?: number;
  4169. diameterX?: number;
  4170. diameterY?: number;
  4171. diameterZ?: number;
  4172. arc?: number;
  4173. slice?: number;
  4174. sideOrientation?: number;
  4175. }): VertexData;
  4176. static CreateCylinder(options: {
  4177. height?: number;
  4178. diameterTop?: number;
  4179. diameterBottom?: number;
  4180. diameter?: number;
  4181. tessellation?: number;
  4182. subdivisions?: number;
  4183. arc?: number;
  4184. faceColors?: Color4[];
  4185. faceUV?: Vector4[];
  4186. sideOrientation?: number;
  4187. }): VertexData;
  4188. static CreateTorus(options: {
  4189. diameter?: number;
  4190. thickness?: number;
  4191. tessellation?: number;
  4192. sideOrientation?: number;
  4193. }): VertexData;
  4194. static CreateLines(options: {
  4195. points: Vector3[];
  4196. }): VertexData;
  4197. static CreateDashedLines(options: {
  4198. points: Vector3[];
  4199. dashSize?: number;
  4200. gapSize?: number;
  4201. dashNb?: number;
  4202. }): VertexData;
  4203. static CreateGround(options: {
  4204. width?: number;
  4205. height?: number;
  4206. subdivisions?: number;
  4207. }): VertexData;
  4208. static CreateTiledGround(options: {
  4209. xmin: number;
  4210. zmin: number;
  4211. xmax: number;
  4212. zmax: number;
  4213. subdivisions: any;
  4214. precision: any;
  4215. }): VertexData;
  4216. static CreateGroundFromHeightMap(options: {
  4217. width: number;
  4218. height: number;
  4219. subdivisions: number;
  4220. minHeight: number;
  4221. maxHeight: number;
  4222. buffer: Uint8Array;
  4223. bufferWidth: number;
  4224. bufferHeight: number;
  4225. }): VertexData;
  4226. static CreatePlane(options: {
  4227. size?: number;
  4228. width?: number;
  4229. height?: number;
  4230. sideOrientation?: number;
  4231. }): VertexData;
  4232. static CreateDisc(options: {
  4233. radius?: number;
  4234. tessellation?: number;
  4235. sideOrientation?: number;
  4236. }): VertexData;
  4237. static CreateTorusKnot(options: {
  4238. radius?: number;
  4239. tube?: number;
  4240. radialSegments?: number;
  4241. tubularSegments?: number;
  4242. p?: number;
  4243. q?: number;
  4244. sideOrientation?: number;
  4245. }): VertexData;
  4246. /**
  4247. * @param {any} - positions (number[] or Float32Array)
  4248. * @param {any} - indices (number[] or Uint16Array)
  4249. * @param {any} - normals (number[] or Float32Array)
  4250. */
  4251. static ComputeNormals(positions: any, indices: any, normals: any): void;
  4252. private static _ComputeSides(sideOrientation, positions, indices, normals, uvs);
  4253. }
  4254. }
  4255. declare module BABYLON.Internals {
  4256. class MeshLODLevel {
  4257. distance: number;
  4258. mesh: Mesh;
  4259. constructor(distance: number, mesh: Mesh);
  4260. }
  4261. }
  4262. declare module BABYLON {
  4263. /**
  4264. * A simplifier interface for future simplification implementations.
  4265. */
  4266. interface ISimplifier {
  4267. /**
  4268. * Simplification of a given mesh according to the given settings.
  4269. * Since this requires computation, it is assumed that the function runs async.
  4270. * @param settings The settings of the simplification, including quality and distance
  4271. * @param successCallback A callback that will be called after the mesh was simplified.
  4272. * @param errorCallback in case of an error, this callback will be called. optional.
  4273. */
  4274. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void;
  4275. }
  4276. /**
  4277. * Expected simplification settings.
  4278. * Quality should be between 0 and 1 (1 being 100%, 0 being 0%);
  4279. */
  4280. interface ISimplificationSettings {
  4281. quality: number;
  4282. distance: number;
  4283. optimizeMesh?: boolean;
  4284. }
  4285. class SimplificationSettings implements ISimplificationSettings {
  4286. quality: number;
  4287. distance: number;
  4288. optimizeMesh: boolean;
  4289. constructor(quality: number, distance: number, optimizeMesh?: boolean);
  4290. }
  4291. interface ISimplificationTask {
  4292. settings: Array<ISimplificationSettings>;
  4293. simplificationType: SimplificationType;
  4294. mesh: Mesh;
  4295. successCallback?: () => void;
  4296. parallelProcessing: boolean;
  4297. }
  4298. class SimplificationQueue {
  4299. private _simplificationArray;
  4300. running: any;
  4301. constructor();
  4302. addTask(task: ISimplificationTask): void;
  4303. executeNext(): void;
  4304. runSimplification(task: ISimplificationTask): void;
  4305. private getSimplifier(task);
  4306. }
  4307. /**
  4308. * The implemented types of simplification.
  4309. * At the moment only Quadratic Error Decimation is implemented.
  4310. */
  4311. enum SimplificationType {
  4312. QUADRATIC = 0,
  4313. }
  4314. class DecimationTriangle {
  4315. vertices: Array<DecimationVertex>;
  4316. normal: Vector3;
  4317. error: Array<number>;
  4318. deleted: boolean;
  4319. isDirty: boolean;
  4320. borderFactor: number;
  4321. deletePending: boolean;
  4322. originalOffset: number;
  4323. constructor(vertices: Array<DecimationVertex>);
  4324. }
  4325. class DecimationVertex {
  4326. position: Vector3;
  4327. id: any;
  4328. q: QuadraticMatrix;
  4329. isBorder: boolean;
  4330. triangleStart: number;
  4331. triangleCount: number;
  4332. originalOffsets: Array<number>;
  4333. constructor(position: Vector3, id: any);
  4334. updatePosition(newPosition: Vector3): void;
  4335. }
  4336. class QuadraticMatrix {
  4337. data: Array<number>;
  4338. constructor(data?: Array<number>);
  4339. det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number;
  4340. addInPlace(matrix: QuadraticMatrix): void;
  4341. addArrayInPlace(data: Array<number>): void;
  4342. add(matrix: QuadraticMatrix): QuadraticMatrix;
  4343. static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix;
  4344. static DataFromNumbers(a: number, b: number, c: number, d: number): number[];
  4345. }
  4346. class Reference {
  4347. vertexId: number;
  4348. triangleId: number;
  4349. constructor(vertexId: number, triangleId: number);
  4350. }
  4351. /**
  4352. * An implementation of the Quadratic Error simplification algorithm.
  4353. * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf
  4354. * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS
  4355. * @author RaananW
  4356. */
  4357. class QuadraticErrorSimplification implements ISimplifier {
  4358. private _mesh;
  4359. private triangles;
  4360. private vertices;
  4361. private references;
  4362. private initialized;
  4363. private _reconstructedMesh;
  4364. syncIterations: number;
  4365. aggressiveness: number;
  4366. decimationIterations: number;
  4367. boundingBoxEpsilon: number;
  4368. constructor(_mesh: Mesh);
  4369. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void;
  4370. private isTriangleOnBoundingBox(triangle);
  4371. private runDecimation(settings, submeshIndex, successCallback);
  4372. private initWithMesh(submeshIndex, callback, optimizeMesh?);
  4373. private init(callback);
  4374. private reconstructMesh(submeshIndex);
  4375. private initDecimatedMesh();
  4376. private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr);
  4377. private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles);
  4378. private identifyBorder();
  4379. private updateMesh(identifyBorders?);
  4380. private vertexError(q, point);
  4381. private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?);
  4382. }
  4383. }
  4384. declare module BABYLON {
  4385. class Polygon {
  4386. static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[];
  4387. static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[];
  4388. static Parse(input: string): Vector2[];
  4389. static StartingAt(x: number, y: number): Path2;
  4390. }
  4391. class PolygonMeshBuilder {
  4392. private _swctx;
  4393. private _points;
  4394. private _outlinepoints;
  4395. private _holes;
  4396. private _name;
  4397. private _scene;
  4398. constructor(name: string, contours: Path2, scene: Scene);
  4399. constructor(name: string, contours: Vector2[], scene: Scene);
  4400. addHole(hole: Vector2[]): PolygonMeshBuilder;
  4401. build(updatable?: boolean, depth?: number): Mesh;
  4402. private addSide(positions, normals, uvs, indices, bounds, points, depth, flip);
  4403. }
  4404. }
  4405. declare module BABYLON {
  4406. class SubMesh {
  4407. materialIndex: number;
  4408. verticesStart: number;
  4409. verticesCount: number;
  4410. indexStart: any;
  4411. indexCount: number;
  4412. linesIndexCount: number;
  4413. private _mesh;
  4414. private _renderingMesh;
  4415. private _boundingInfo;
  4416. private _linesIndexBuffer;
  4417. _lastColliderWorldVertices: Vector3[];
  4418. _trianglePlanes: Plane[];
  4419. _lastColliderTransformMatrix: Matrix;
  4420. _renderId: number;
  4421. _alphaIndex: number;
  4422. _distanceToCamera: number;
  4423. _id: number;
  4424. constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
  4425. getBoundingInfo(): BoundingInfo;
  4426. getMesh(): AbstractMesh;
  4427. getRenderingMesh(): Mesh;
  4428. getMaterial(): Material;
  4429. refreshBoundingInfo(): void;
  4430. _checkCollision(collider: Collider): boolean;
  4431. updateBoundingInfo(world: Matrix): void;
  4432. isInFrustum(frustumPlanes: Plane[]): boolean;
  4433. render(enableAlphaMode: boolean): void;
  4434. getLinesIndexBuffer(indices: number[], engine: any): WebGLBuffer;
  4435. canIntersects(ray: Ray): boolean;
  4436. intersects(ray: Ray, positions: Vector3[], indices: number[], fastCheck?: boolean): IntersectionInfo;
  4437. clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
  4438. dispose(): void;
  4439. static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
  4440. }
  4441. }
  4442. declare module BABYLON {
  4443. class VertexBuffer {
  4444. private _mesh;
  4445. private _engine;
  4446. private _buffer;
  4447. private _data;
  4448. private _updatable;
  4449. private _kind;
  4450. private _strideSize;
  4451. constructor(engine: any, data: number[], kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number);
  4452. isUpdatable(): boolean;
  4453. getData(): number[];
  4454. getBuffer(): WebGLBuffer;
  4455. getStrideSize(): number;
  4456. create(data?: number[]): void;
  4457. update(data: number[]): void;
  4458. updateDirectly(data: Float32Array, offset: number): void;
  4459. dispose(): void;
  4460. private static _PositionKind;
  4461. private static _NormalKind;
  4462. private static _UVKind;
  4463. private static _UV2Kind;
  4464. private static _UV3Kind;
  4465. private static _UV4Kind;
  4466. private static _UV5Kind;
  4467. private static _UV6Kind;
  4468. private static _ColorKind;
  4469. private static _MatricesIndicesKind;
  4470. private static _MatricesWeightsKind;
  4471. static PositionKind: string;
  4472. static NormalKind: string;
  4473. static UVKind: string;
  4474. static UV2Kind: string;
  4475. static UV3Kind: string;
  4476. static UV4Kind: string;
  4477. static UV5Kind: string;
  4478. static UV6Kind: string;
  4479. static ColorKind: string;
  4480. static MatricesIndicesKind: string;
  4481. static MatricesWeightsKind: string;
  4482. }
  4483. }
  4484. declare module BABYLON {
  4485. interface IPhysicsEnginePlugin {
  4486. initialize(iterations?: number): any;
  4487. setGravity(gravity: Vector3): void;
  4488. runOneStep(delta: number): void;
  4489. registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any;
  4490. registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any;
  4491. unregisterMesh(mesh: AbstractMesh): any;
  4492. applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void;
  4493. createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean;
  4494. dispose(): void;
  4495. isSupported(): boolean;
  4496. updateBodyPosition(mesh: AbstractMesh): void;
  4497. }
  4498. interface PhysicsBodyCreationOptions {
  4499. mass: number;
  4500. friction: number;
  4501. restitution: number;
  4502. }
  4503. interface PhysicsCompoundBodyPart {
  4504. mesh: Mesh;
  4505. impostor: number;
  4506. }
  4507. class PhysicsEngine {
  4508. gravity: Vector3;
  4509. private _currentPlugin;
  4510. constructor(plugin?: IPhysicsEnginePlugin);
  4511. _initialize(gravity?: Vector3): void;
  4512. _runOneStep(delta: number): void;
  4513. _setGravity(gravity: Vector3): void;
  4514. _registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any;
  4515. _registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any;
  4516. _unregisterMesh(mesh: AbstractMesh): void;
  4517. _applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void;
  4518. _createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean;
  4519. _updateBodyPosition(mesh: AbstractMesh): void;
  4520. dispose(): void;
  4521. isSupported(): boolean;
  4522. static NoImpostor: number;
  4523. static SphereImpostor: number;
  4524. static BoxImpostor: number;
  4525. static PlaneImpostor: number;
  4526. static MeshImpostor: number;
  4527. static CapsuleImpostor: number;
  4528. static ConeImpostor: number;
  4529. static CylinderImpostor: number;
  4530. static ConvexHullImpostor: number;
  4531. static Epsilon: number;
  4532. }
  4533. }
  4534. declare module BABYLON {
  4535. class ReflectionProbe {
  4536. name: string;
  4537. private _scene;
  4538. private _renderTargetTexture;
  4539. private _projectionMatrix;
  4540. private _viewMatrix;
  4541. private _target;
  4542. private _add;
  4543. private _attachedMesh;
  4544. position: Vector3;
  4545. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  4546. refreshRate: number;
  4547. getScene(): Scene;
  4548. cubeTexture: RenderTargetTexture;
  4549. renderList: AbstractMesh[];
  4550. attachToMesh(mesh: AbstractMesh): void;
  4551. dispose(): void;
  4552. }
  4553. }
  4554. declare module BABYLON {
  4555. class BoundingBoxRenderer {
  4556. frontColor: Color3;
  4557. backColor: Color3;
  4558. showBackLines: boolean;
  4559. renderList: SmartArray<BoundingBox>;
  4560. private _scene;
  4561. private _colorShader;
  4562. private _vb;
  4563. private _ib;
  4564. constructor(scene: Scene);
  4565. private _prepareRessources();
  4566. reset(): void;
  4567. render(): void;
  4568. dispose(): void;
  4569. }
  4570. }
  4571. declare module BABYLON {
  4572. class DepthRenderer {
  4573. private _scene;
  4574. private _depthMap;
  4575. private _effect;
  4576. private _viewMatrix;
  4577. private _projectionMatrix;
  4578. private _transformMatrix;
  4579. private _worldViewProjection;
  4580. private _cachedDefines;
  4581. constructor(scene: Scene, type?: number);
  4582. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  4583. getDepthMap(): RenderTargetTexture;
  4584. dispose(): void;
  4585. }
  4586. }
  4587. declare module BABYLON {
  4588. class EdgesRenderer {
  4589. private _source;
  4590. private _linesPositions;
  4591. private _linesNormals;
  4592. private _linesIndices;
  4593. private _epsilon;
  4594. private _indicesCount;
  4595. private _lineShader;
  4596. private _vb0;
  4597. private _vb1;
  4598. private _ib;
  4599. private _buffers;
  4600. private _checkVerticesInsteadOfIndices;
  4601. constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean);
  4602. private _prepareRessources();
  4603. dispose(): void;
  4604. private _processEdgeForAdjacencies(pa, pb, p0, p1, p2);
  4605. private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2);
  4606. private _checkEdge(faceIndex, edge, faceNormals, p0, p1);
  4607. _generateEdgesLines(): void;
  4608. render(): void;
  4609. }
  4610. }
  4611. declare module BABYLON {
  4612. class OutlineRenderer {
  4613. private _scene;
  4614. private _effect;
  4615. private _cachedDefines;
  4616. constructor(scene: Scene);
  4617. render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void;
  4618. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  4619. }
  4620. }
  4621. declare module BABYLON {
  4622. class RenderingGroup {
  4623. index: number;
  4624. private _scene;
  4625. private _opaqueSubMeshes;
  4626. private _transparentSubMeshes;
  4627. private _alphaTestSubMeshes;
  4628. private _activeVertices;
  4629. constructor(index: number, scene: Scene);
  4630. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void): boolean;
  4631. prepare(): void;
  4632. dispatch(subMesh: SubMesh): void;
  4633. }
  4634. }
  4635. declare module BABYLON {
  4636. class RenderingManager {
  4637. static MAX_RENDERINGGROUPS: number;
  4638. private _scene;
  4639. private _renderingGroups;
  4640. private _depthBufferAlreadyCleaned;
  4641. constructor(scene: Scene);
  4642. private _renderParticles(index, activeMeshes);
  4643. private _renderSprites(index);
  4644. private _clearDepthBuffer();
  4645. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void;
  4646. reset(): void;
  4647. dispatch(subMesh: SubMesh): void;
  4648. }
  4649. }
  4650. declare module BABYLON {
  4651. class AnaglyphPostProcess extends PostProcess {
  4652. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  4653. }
  4654. }
  4655. declare module BABYLON {
  4656. class BlackAndWhitePostProcess extends PostProcess {
  4657. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  4658. }
  4659. }
  4660. declare module BABYLON {
  4661. class BlurPostProcess extends PostProcess {
  4662. direction: Vector2;
  4663. blurWidth: number;
  4664. constructor(name: string, direction: Vector2, blurWidth: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  4665. }
  4666. }
  4667. declare module BABYLON {
  4668. class ColorCorrectionPostProcess extends PostProcess {
  4669. private _colorTableTexture;
  4670. constructor(name: string, colorTableUrl: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  4671. }
  4672. }
  4673. declare module BABYLON {
  4674. class ConvolutionPostProcess extends PostProcess {
  4675. kernel: number[];
  4676. constructor(name: string, kernel: number[], ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  4677. static EdgeDetect0Kernel: number[];
  4678. static EdgeDetect1Kernel: number[];
  4679. static EdgeDetect2Kernel: number[];
  4680. static SharpenKernel: number[];
  4681. static EmbossKernel: number[];
  4682. static GaussianKernel: number[];
  4683. }
  4684. }
  4685. declare module BABYLON {
  4686. class DisplayPassPostProcess extends PostProcess {
  4687. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  4688. }
  4689. }
  4690. declare module BABYLON {
  4691. class FilterPostProcess extends PostProcess {
  4692. kernelMatrix: Matrix;
  4693. constructor(name: string, kernelMatrix: Matrix, ratio: number, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  4694. }
  4695. }
  4696. declare module BABYLON {
  4697. class FxaaPostProcess extends PostProcess {
  4698. texelWidth: number;
  4699. texelHeight: number;
  4700. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  4701. }
  4702. }
  4703. declare module BABYLON {
  4704. class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable {
  4705. /**
  4706. * Public members
  4707. */
  4708. /**
  4709. * Gaussian blur coefficient
  4710. * @type {number}
  4711. */
  4712. gaussCoeff: number;
  4713. /**
  4714. * Gaussian blur mean
  4715. * @type {number}
  4716. */
  4717. gaussMean: number;
  4718. /**
  4719. * Gaussian blur standard deviation
  4720. * @type {number}
  4721. */
  4722. gaussStandDev: number;
  4723. /**
  4724. * Exposure, controls the overall intensity of the pipeline
  4725. * @type {number}
  4726. */
  4727. exposure: number;
  4728. /**
  4729. * Minimum luminance that the post-process can output. Luminance is >= 0
  4730. * @type {number}
  4731. */
  4732. minimumLuminance: number;
  4733. /**
  4734. * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance
  4735. * @type {number}
  4736. */
  4737. maximumLuminance: number;
  4738. /**
  4739. * Increase rate for luminance: eye adaptation speed to dark
  4740. * @type {number}
  4741. */
  4742. luminanceIncreaserate: number;
  4743. /**
  4744. * Decrease rate for luminance: eye adaptation speed to bright
  4745. * @type {number}
  4746. */
  4747. luminanceDecreaseRate: number;
  4748. /**
  4749. * Minimum luminance needed to compute HDR
  4750. * @type {number}
  4751. */
  4752. brightThreshold: number;
  4753. /**
  4754. * Private members
  4755. */
  4756. private _guassianBlurHPostProcess;
  4757. private _guassianBlurVPostProcess;
  4758. private _brightPassPostProcess;
  4759. private _textureAdderPostProcess;
  4760. private _downSampleX4PostProcess;
  4761. private _originalPostProcess;
  4762. private _hdrPostProcess;
  4763. private _hdrCurrentLuminance;
  4764. private _hdrOutputLuminance;
  4765. static LUM_STEPS: number;
  4766. private _downSamplePostProcesses;
  4767. private _scene;
  4768. private _needUpdate;
  4769. /**
  4770. * @constructor
  4771. * @param {string} name - The rendering pipeline name
  4772. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  4773. * @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)
  4774. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  4775. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  4776. */
  4777. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  4778. /**
  4779. * Tells the pipeline to update its post-processes
  4780. */
  4781. update(): void;
  4782. /**
  4783. * Returns the current calculated luminance
  4784. */
  4785. getCurrentLuminance(): number;
  4786. /**
  4787. * Returns the currently drawn luminance
  4788. */
  4789. getOutputLuminance(): number;
  4790. /**
  4791. * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras
  4792. */
  4793. dispose(): void;
  4794. /**
  4795. * Creates the HDR post-process and computes the luminance adaptation
  4796. */
  4797. private _createHDRPostProcess(scene, ratio);
  4798. /**
  4799. * Texture Adder post-process
  4800. */
  4801. private _createTextureAdderPostProcess(scene, ratio);
  4802. /**
  4803. * Down sample X4 post-process
  4804. */
  4805. private _createDownSampleX4PostProcess(scene, ratio);
  4806. /**
  4807. * Bright pass post-process
  4808. */
  4809. private _createBrightPassPostProcess(scene, ratio);
  4810. /**
  4811. * Luminance generator. Creates the luminance post-process and down sample post-processes
  4812. */
  4813. private _createLuminanceGeneratorPostProcess(scene);
  4814. /**
  4815. * Gaussian blur post-processes. Horizontal and Vertical
  4816. */
  4817. private _createGaussianBlurPostProcess(scene, ratio);
  4818. }
  4819. }
  4820. declare module BABYLON {
  4821. class LensRenderingPipeline extends PostProcessRenderPipeline {
  4822. /**
  4823. * The chromatic aberration PostProcess id in the pipeline
  4824. * @type {string}
  4825. */
  4826. LensChromaticAberrationEffect: string;
  4827. /**
  4828. * The highlights enhancing PostProcess id in the pipeline
  4829. * @type {string}
  4830. */
  4831. HighlightsEnhancingEffect: string;
  4832. /**
  4833. * The depth-of-field PostProcess id in the pipeline
  4834. * @type {string}
  4835. */
  4836. LensDepthOfFieldEffect: string;
  4837. private _scene;
  4838. private _depthTexture;
  4839. private _grainTexture;
  4840. private _chromaticAberrationPostProcess;
  4841. private _highlightsPostProcess;
  4842. private _depthOfFieldPostProcess;
  4843. private _edgeBlur;
  4844. private _grainAmount;
  4845. private _chromaticAberration;
  4846. private _distortion;
  4847. private _highlightsGain;
  4848. private _highlightsThreshold;
  4849. private _dofDistance;
  4850. private _dofAperture;
  4851. private _dofDarken;
  4852. private _dofPentagon;
  4853. private _blurNoise;
  4854. /**
  4855. * @constructor
  4856. *
  4857. * Effect parameters are as follow:
  4858. * {
  4859. * chromatic_aberration: number; // from 0 to x (1 for realism)
  4860. * edge_blur: number; // from 0 to x (1 for realism)
  4861. * distortion: number; // from 0 to x (1 for realism)
  4862. * grain_amount: number; // from 0 to 1
  4863. * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise
  4864. * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)
  4865. * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)
  4866. * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)
  4867. * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect
  4868. * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)
  4869. * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)
  4870. * blur_noise: boolean; // add a little bit of noise to the blur (default: true)
  4871. * }
  4872. * Note: if an effect parameter is unset, effect is disabled
  4873. *
  4874. * @param {string} name - The rendering pipeline name
  4875. * @param {object} parameters - An object containing all parameters (see above)
  4876. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  4877. * @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)
  4878. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  4879. */
  4880. constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]);
  4881. setEdgeBlur(amount: number): void;
  4882. disableEdgeBlur(): void;
  4883. setGrainAmount(amount: number): void;
  4884. disableGrain(): void;
  4885. setChromaticAberration(amount: number): void;
  4886. disableChromaticAberration(): void;
  4887. setEdgeDistortion(amount: number): void;
  4888. disableEdgeDistortion(): void;
  4889. setFocusDistance(amount: number): void;
  4890. disableDepthOfField(): void;
  4891. setAperture(amount: number): void;
  4892. setDarkenOutOfFocus(amount: number): void;
  4893. enablePentagonBokeh(): void;
  4894. disablePentagonBokeh(): void;
  4895. enableNoiseBlur(): void;
  4896. disableNoiseBlur(): void;
  4897. setHighlightsGain(amount: number): void;
  4898. setHighlightsThreshold(amount: number): void;
  4899. disableHighlights(): void;
  4900. /**
  4901. * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
  4902. */
  4903. dispose(disableDepthRender?: boolean): void;
  4904. private _createChromaticAberrationPostProcess(ratio);
  4905. private _createHighlightsPostProcess(ratio);
  4906. private _createDepthOfFieldPostProcess(ratio);
  4907. private _createGrainTexture();
  4908. }
  4909. }
  4910. declare module BABYLON {
  4911. class PassPostProcess extends PostProcess {
  4912. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  4913. }
  4914. }
  4915. declare module BABYLON {
  4916. class PostProcess {
  4917. name: string;
  4918. onApply: (effect: Effect) => void;
  4919. onBeforeRender: (effect: Effect) => void;
  4920. onAfterRender: (effect: Effect) => void;
  4921. onSizeChanged: () => void;
  4922. onActivate: (camera: Camera) => void;
  4923. width: number;
  4924. height: number;
  4925. renderTargetSamplingMode: number;
  4926. clearColor: Color4;
  4927. private _camera;
  4928. private _scene;
  4929. private _engine;
  4930. private _renderRatio;
  4931. private _reusable;
  4932. private _textureType;
  4933. _textures: SmartArray<WebGLTexture>;
  4934. _currentRenderTextureInd: number;
  4935. private _effect;
  4936. constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], ratio: number | any, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number);
  4937. isReusable(): boolean;
  4938. activate(camera: Camera, sourceTexture?: WebGLTexture): void;
  4939. apply(): Effect;
  4940. dispose(camera?: Camera): void;
  4941. }
  4942. }
  4943. declare module BABYLON {
  4944. class PostProcessManager {
  4945. private _scene;
  4946. private _indexBuffer;
  4947. private _vertexDeclaration;
  4948. private _vertexStrideSize;
  4949. private _vertexBuffer;
  4950. constructor(scene: Scene);
  4951. private _prepareBuffers();
  4952. _prepareFrame(sourceTexture?: WebGLTexture): boolean;
  4953. directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void;
  4954. _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture, faceIndex?: number, postProcesses?: PostProcess[]): void;
  4955. dispose(): void;
  4956. }
  4957. }
  4958. declare module BABYLON {
  4959. class RefractionPostProcess extends PostProcess {
  4960. color: Color3;
  4961. depth: number;
  4962. colorLevel: number;
  4963. private _refRexture;
  4964. constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  4965. dispose(camera: Camera): void;
  4966. }
  4967. }
  4968. declare module BABYLON {
  4969. class SSAORenderingPipeline extends PostProcessRenderPipeline {
  4970. /**
  4971. * The PassPostProcess id in the pipeline that contains the original scene color
  4972. * @type {string}
  4973. */
  4974. SSAOOriginalSceneColorEffect: string;
  4975. /**
  4976. * The SSAO PostProcess id in the pipeline
  4977. * @type {string}
  4978. */
  4979. SSAORenderEffect: string;
  4980. /**
  4981. * The horizontal blur PostProcess id in the pipeline
  4982. * @type {string}
  4983. */
  4984. SSAOBlurHRenderEffect: string;
  4985. /**
  4986. * The vertical blur PostProcess id in the pipeline
  4987. * @type {string}
  4988. */
  4989. SSAOBlurVRenderEffect: string;
  4990. /**
  4991. * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
  4992. * @type {string}
  4993. */
  4994. SSAOCombineRenderEffect: string;
  4995. /**
  4996. * The output strength of the SSAO post-process. Default value is 1.0.
  4997. * @type {number}
  4998. */
  4999. totalStrength: number;
  5000. /**
  5001. * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0002
  5002. * @type {number}
  5003. */
  5004. radius: number;
  5005. /**
  5006. * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel
  5007. * Must not be equal to fallOff and superior to fallOff.
  5008. * Default value is 0.0075
  5009. * @type {number}
  5010. */
  5011. area: number;
  5012. /**
  5013. * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel
  5014. * Must not be equal to area and inferior to area.
  5015. * Default value is 0.0002
  5016. * @type {number}
  5017. */
  5018. fallOff: number;
  5019. private _scene;
  5020. private _depthTexture;
  5021. private _randomTexture;
  5022. private _originalColorPostProcess;
  5023. private _ssaoPostProcess;
  5024. private _blurHPostProcess;
  5025. private _blurVPostProcess;
  5026. private _ssaoCombinePostProcess;
  5027. private _firstUpdate;
  5028. /**
  5029. * @constructor
  5030. * @param {string} name - The rendering pipeline name
  5031. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  5032. * @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 }
  5033. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  5034. */
  5035. constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
  5036. /**
  5037. * Returns the horizontal blur PostProcess
  5038. * @return {BABYLON.BlurPostProcess} The horizontal blur post-process
  5039. */
  5040. getBlurHPostProcess(): BlurPostProcess;
  5041. /**
  5042. * Returns the vertical blur PostProcess
  5043. * @return {BABYLON.BlurPostProcess} The vertical blur post-process
  5044. */
  5045. getBlurVPostProcess(): BlurPostProcess;
  5046. /**
  5047. * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
  5048. */
  5049. dispose(disableDepthRender?: boolean): void;
  5050. private _createSSAOPostProcess(ratio);
  5051. private _createSSAOCombinePostProcess(ratio);
  5052. private _createRandomTexture();
  5053. }
  5054. }
  5055. declare module BABYLON {
  5056. class StereoscopicInterlacePostProcess extends PostProcess {
  5057. private _stepSize;
  5058. constructor(name: string, camB: Camera, postProcessA: PostProcess, isStereoscopicHoriz: boolean, samplingMode?: number);
  5059. }
  5060. }
  5061. declare module BABYLON {
  5062. enum TonemappingOperator {
  5063. Hable = 0,
  5064. Reinhard = 1,
  5065. HejiDawson = 2,
  5066. Photographic = 3,
  5067. }
  5068. class TonemapPostProcess extends PostProcess {
  5069. private _operator;
  5070. private _exposureAdjustment;
  5071. constructor(name: string, operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number);
  5072. }
  5073. }
  5074. declare module BABYLON {
  5075. class VolumetricLightScatteringPostProcess extends PostProcess {
  5076. private _volumetricLightScatteringPass;
  5077. private _volumetricLightScatteringRTT;
  5078. private _viewPort;
  5079. private _screenCoordinates;
  5080. private _cachedDefines;
  5081. private _customMeshPosition;
  5082. /**
  5083. * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)
  5084. * @type {boolean}
  5085. */
  5086. useCustomMeshPosition: boolean;
  5087. /**
  5088. * If the post-process should inverse the light scattering direction
  5089. * @type {boolean}
  5090. */
  5091. invert: boolean;
  5092. /**
  5093. * The internal mesh used by the post-process
  5094. * @type {boolean}
  5095. */
  5096. mesh: Mesh;
  5097. /**
  5098. * Set to true to use the diffuseColor instead of the diffuseTexture
  5099. * @type {boolean}
  5100. */
  5101. useDiffuseColor: boolean;
  5102. /**
  5103. * Array containing the excluded meshes not rendered in the internal pass
  5104. */
  5105. excludedMeshes: AbstractMesh[];
  5106. /**
  5107. * Controls the overall intensity of the post-process
  5108. * @type {number}
  5109. */
  5110. exposure: number;
  5111. /**
  5112. * Dissipates each sample's contribution in range [0, 1]
  5113. * @type {number}
  5114. */
  5115. decay: number;
  5116. /**
  5117. * Controls the overall intensity of each sample
  5118. * @type {number}
  5119. */
  5120. weight: number;
  5121. /**
  5122. * Controls the density of each sample
  5123. * @type {number}
  5124. */
  5125. density: number;
  5126. /**
  5127. * @constructor
  5128. * @param {string} name - The post-process name
  5129. * @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)
  5130. * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to
  5131. * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering
  5132. * @param {number} samples - The post-process quality, default 100
  5133. * @param {number} samplingMode - The post-process filtering mode
  5134. * @param {BABYLON.Engine} engine - The babylon engine
  5135. * @param {boolean} reusable - If the post-process is reusable
  5136. * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided
  5137. */
  5138. constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene);
  5139. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  5140. /**
  5141. * Sets the new light position for light scattering effect
  5142. * @param {BABYLON.Vector3} The new custom light position
  5143. */
  5144. setCustomMeshPosition(position: Vector3): void;
  5145. /**
  5146. * Returns the light position for light scattering effect
  5147. * @return {BABYLON.Vector3} The custom light position
  5148. */
  5149. getCustomMeshPosition(): Vector3;
  5150. /**
  5151. * Disposes the internal assets and detaches the post-process from the camera
  5152. */
  5153. dispose(camera: Camera): void;
  5154. /**
  5155. * Returns the render target texture used by the post-process
  5156. * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process
  5157. */
  5158. getPass(): RenderTargetTexture;
  5159. private _meshExcluded(mesh);
  5160. private _createPass(scene, ratio);
  5161. private _updateMeshScreenCoordinates(scene);
  5162. /**
  5163. * Creates a default mesh for the Volumeric Light Scattering post-process
  5164. * @param {string} The mesh name
  5165. * @param {BABYLON.Scene} The scene where to create the mesh
  5166. * @return {BABYLON.Mesh} the default mesh
  5167. */
  5168. static CreateDefaultMesh(name: string, scene: Scene): Mesh;
  5169. }
  5170. }
  5171. declare module BABYLON {
  5172. class VRDistortionCorrectionPostProcess extends PostProcess {
  5173. aspectRatio: number;
  5174. private _isRightEye;
  5175. private _distortionFactors;
  5176. private _postProcessScaleFactor;
  5177. private _lensCenterOffset;
  5178. private _scaleIn;
  5179. private _scaleFactor;
  5180. private _lensCenter;
  5181. constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics);
  5182. }
  5183. }
  5184. declare module BABYLON {
  5185. class Sprite {
  5186. name: string;
  5187. position: Vector3;
  5188. color: Color4;
  5189. width: number;
  5190. height: number;
  5191. angle: number;
  5192. cellIndex: number;
  5193. invertU: number;
  5194. invertV: number;
  5195. disposeWhenFinishedAnimating: boolean;
  5196. animations: Animation[];
  5197. isPickable: boolean;
  5198. actionManager: ActionManager;
  5199. private _animationStarted;
  5200. private _loopAnimation;
  5201. private _fromIndex;
  5202. private _toIndex;
  5203. private _delay;
  5204. private _direction;
  5205. private _frameCount;
  5206. private _manager;
  5207. private _time;
  5208. size: number;
  5209. constructor(name: string, manager: SpriteManager);
  5210. playAnimation(from: number, to: number, loop: boolean, delay: number): void;
  5211. stopAnimation(): void;
  5212. _animate(deltaTime: number): void;
  5213. dispose(): void;
  5214. }
  5215. }
  5216. declare module BABYLON {
  5217. class SpriteManager {
  5218. name: string;
  5219. cellSize: number;
  5220. sprites: Sprite[];
  5221. renderingGroupId: number;
  5222. layerMask: number;
  5223. onDispose: () => void;
  5224. fogEnabled: boolean;
  5225. isPickable: boolean;
  5226. private _capacity;
  5227. private _spriteTexture;
  5228. private _epsilon;
  5229. private _scene;
  5230. private _vertexDeclaration;
  5231. private _vertexStrideSize;
  5232. private _vertexBuffer;
  5233. private _indexBuffer;
  5234. private _vertices;
  5235. private _effectBase;
  5236. private _effectFog;
  5237. constructor(name: string, imgUrl: string, capacity: number, cellSize: number, scene: Scene, epsilon?: number, samplingMode?: number);
  5238. private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize);
  5239. intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): PickingInfo;
  5240. render(): void;
  5241. dispose(): void;
  5242. }
  5243. }
  5244. declare module BABYLON.Internals {
  5245. class AndOrNotEvaluator {
  5246. static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
  5247. private static _HandleParenthesisContent(parenthesisContent, evaluateCallback);
  5248. private static _SimplifyNegation(booleanString);
  5249. }
  5250. }
  5251. declare module BABYLON {
  5252. interface IAssetTask {
  5253. onSuccess: (task: IAssetTask) => void;
  5254. onError: (task: IAssetTask) => void;
  5255. isCompleted: boolean;
  5256. run(scene: Scene, onSuccess: () => void, onError: () => void): any;
  5257. }
  5258. class MeshAssetTask implements IAssetTask {
  5259. name: string;
  5260. meshesNames: any;
  5261. rootUrl: string;
  5262. sceneFilename: string;
  5263. loadedMeshes: Array<AbstractMesh>;
  5264. loadedParticleSystems: Array<ParticleSystem>;
  5265. loadedSkeletons: Array<Skeleton>;
  5266. onSuccess: (task: IAssetTask) => void;
  5267. onError: (task: IAssetTask) => void;
  5268. isCompleted: boolean;
  5269. constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string);
  5270. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  5271. }
  5272. class TextFileAssetTask implements IAssetTask {
  5273. name: string;
  5274. url: string;
  5275. onSuccess: (task: IAssetTask) => void;
  5276. onError: (task: IAssetTask) => void;
  5277. isCompleted: boolean;
  5278. text: string;
  5279. constructor(name: string, url: string);
  5280. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  5281. }
  5282. class BinaryFileAssetTask implements IAssetTask {
  5283. name: string;
  5284. url: string;
  5285. onSuccess: (task: IAssetTask) => void;
  5286. onError: (task: IAssetTask) => void;
  5287. isCompleted: boolean;
  5288. data: ArrayBuffer;
  5289. constructor(name: string, url: string);
  5290. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  5291. }
  5292. class ImageAssetTask implements IAssetTask {
  5293. name: string;
  5294. url: string;
  5295. onSuccess: (task: IAssetTask) => void;
  5296. onError: (task: IAssetTask) => void;
  5297. isCompleted: boolean;
  5298. image: HTMLImageElement;
  5299. constructor(name: string, url: string);
  5300. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  5301. }
  5302. class TextureAssetTask implements IAssetTask {
  5303. name: string;
  5304. url: string;
  5305. noMipmap: boolean;
  5306. invertY: boolean;
  5307. samplingMode: number;
  5308. onSuccess: (task: IAssetTask) => void;
  5309. onError: (task: IAssetTask) => void;
  5310. isCompleted: boolean;
  5311. texture: Texture;
  5312. constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number);
  5313. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  5314. }
  5315. class AssetsManager {
  5316. private _tasks;
  5317. private _scene;
  5318. private _waitingTasksCount;
  5319. onFinish: (tasks: IAssetTask[]) => void;
  5320. onTaskSuccess: (task: IAssetTask) => void;
  5321. onTaskError: (task: IAssetTask) => void;
  5322. useDefaultLoadingScreen: boolean;
  5323. constructor(scene: Scene);
  5324. addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask;
  5325. addTextFileTask(taskName: string, url: string): IAssetTask;
  5326. addBinaryFileTask(taskName: string, url: string): IAssetTask;
  5327. addImageTask(taskName: string, url: string): IAssetTask;
  5328. addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): IAssetTask;
  5329. private _decreaseWaitingTasksCount();
  5330. private _runTask(task);
  5331. reset(): AssetsManager;
  5332. load(): AssetsManager;
  5333. }
  5334. }
  5335. declare module BABYLON {
  5336. class Database {
  5337. private callbackManifestChecked;
  5338. private currentSceneUrl;
  5339. private db;
  5340. private enableSceneOffline;
  5341. private enableTexturesOffline;
  5342. private manifestVersionFound;
  5343. private mustUpdateRessources;
  5344. private hasReachedQuota;
  5345. private isSupported;
  5346. private idbFactory;
  5347. static IsUASupportingBlobStorage: boolean;
  5348. static IDBStorageEnabled: boolean;
  5349. constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any);
  5350. static parseURL: (url: string) => string;
  5351. static ReturnFullUrlLocation: (url: string) => string;
  5352. checkManifestFile(): void;
  5353. openAsync(successCallback: any, errorCallback: any): void;
  5354. loadImageFromDB(url: string, image: HTMLImageElement): void;
  5355. private _loadImageFromDBAsync(url, image, notInDBCallback);
  5356. private _saveImageIntoDBAsync(url, image);
  5357. private _checkVersionFromDB(url, versionLoaded);
  5358. private _loadVersionFromDBAsync(url, callback, updateInDBCallback);
  5359. private _saveVersionIntoDBAsync(url, callback);
  5360. private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?);
  5361. private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?);
  5362. private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?);
  5363. }
  5364. }
  5365. declare module BABYLON {
  5366. class FilesInput {
  5367. private _engine;
  5368. private _currentScene;
  5369. private _canvas;
  5370. private _sceneLoadedCallback;
  5371. private _progressCallback;
  5372. private _additionnalRenderLoopLogicCallback;
  5373. private _textureLoadingCallback;
  5374. private _startingProcessingFilesCallback;
  5375. private _elementToMonitor;
  5376. static FilesTextures: any[];
  5377. static FilesToLoad: any[];
  5378. private _sceneFileToLoad;
  5379. private _filesToLoad;
  5380. 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);
  5381. monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void;
  5382. private renderFunction();
  5383. private drag(e);
  5384. private drop(eventDrop);
  5385. loadFiles(event: any): void;
  5386. reload(): void;
  5387. }
  5388. }
  5389. declare module BABYLON {
  5390. class Gamepads {
  5391. private babylonGamepads;
  5392. private oneGamepadConnected;
  5393. private isMonitoring;
  5394. private gamepadEventSupported;
  5395. private gamepadSupportAvailable;
  5396. private _callbackGamepadConnected;
  5397. private buttonADataURL;
  5398. private static gamepadDOMInfo;
  5399. constructor(ongamedpadconnected: (gamepad: Gamepad) => void);
  5400. private _insertGamepadDOMInstructions();
  5401. private _insertGamepadDOMNotSupported();
  5402. dispose(): void;
  5403. private _onGamepadConnected(evt);
  5404. private _addNewGamepad(gamepad);
  5405. private _onGamepadDisconnected(evt);
  5406. private _startMonitoringGamepads();
  5407. private _stopMonitoringGamepads();
  5408. private _checkGamepadsStatus();
  5409. private _updateGamepadObjects();
  5410. }
  5411. class StickValues {
  5412. x: any;
  5413. y: any;
  5414. constructor(x: any, y: any);
  5415. }
  5416. class Gamepad {
  5417. id: string;
  5418. index: number;
  5419. browserGamepad: any;
  5420. private _leftStick;
  5421. private _rightStick;
  5422. private _onleftstickchanged;
  5423. private _onrightstickchanged;
  5424. constructor(id: string, index: number, browserGamepad: any);
  5425. onleftstickchanged(callback: (values: StickValues) => void): void;
  5426. onrightstickchanged(callback: (values: StickValues) => void): void;
  5427. leftStick: StickValues;
  5428. rightStick: StickValues;
  5429. update(): void;
  5430. }
  5431. class GenericPad extends Gamepad {
  5432. id: string;
  5433. index: number;
  5434. gamepad: any;
  5435. private _buttons;
  5436. private _onbuttondown;
  5437. private _onbuttonup;
  5438. onbuttondown(callback: (buttonPressed: number) => void): void;
  5439. onbuttonup(callback: (buttonReleased: number) => void): void;
  5440. constructor(id: string, index: number, gamepad: any);
  5441. private _setButtonValue(newValue, currentValue, buttonIndex);
  5442. update(): void;
  5443. }
  5444. enum Xbox360Button {
  5445. A = 0,
  5446. B = 1,
  5447. X = 2,
  5448. Y = 3,
  5449. Start = 4,
  5450. Back = 5,
  5451. LB = 6,
  5452. RB = 7,
  5453. LeftStick = 8,
  5454. RightStick = 9,
  5455. }
  5456. enum Xbox360Dpad {
  5457. Up = 0,
  5458. Down = 1,
  5459. Left = 2,
  5460. Right = 3,
  5461. }
  5462. class Xbox360Pad extends Gamepad {
  5463. private _leftTrigger;
  5464. private _rightTrigger;
  5465. private _onlefttriggerchanged;
  5466. private _onrighttriggerchanged;
  5467. private _onbuttondown;
  5468. private _onbuttonup;
  5469. private _ondpaddown;
  5470. private _ondpadup;
  5471. private _buttonA;
  5472. private _buttonB;
  5473. private _buttonX;
  5474. private _buttonY;
  5475. private _buttonBack;
  5476. private _buttonStart;
  5477. private _buttonLB;
  5478. private _buttonRB;
  5479. private _buttonLeftStick;
  5480. private _buttonRightStick;
  5481. private _dPadUp;
  5482. private _dPadDown;
  5483. private _dPadLeft;
  5484. private _dPadRight;
  5485. onlefttriggerchanged(callback: (value: number) => void): void;
  5486. onrighttriggerchanged(callback: (value: number) => void): void;
  5487. leftTrigger: number;
  5488. rightTrigger: number;
  5489. onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
  5490. onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
  5491. ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
  5492. ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
  5493. private _setButtonValue(newValue, currentValue, buttonType);
  5494. private _setDPadValue(newValue, currentValue, buttonType);
  5495. buttonA: number;
  5496. buttonB: number;
  5497. buttonX: number;
  5498. buttonY: number;
  5499. buttonStart: number;
  5500. buttonBack: number;
  5501. buttonLB: number;
  5502. buttonRB: number;
  5503. buttonLeftStick: number;
  5504. buttonRightStick: number;
  5505. dPadUp: number;
  5506. dPadDown: number;
  5507. dPadLeft: number;
  5508. dPadRight: number;
  5509. update(): void;
  5510. }
  5511. }
  5512. interface Navigator {
  5513. getGamepads(func?: any): any;
  5514. webkitGetGamepads(func?: any): any;
  5515. msGetGamepads(func?: any): any;
  5516. webkitGamepads(func?: any): any;
  5517. }
  5518. declare module BABYLON {
  5519. interface ILoadingScreen {
  5520. displayLoadingUI: () => void;
  5521. hideLoadingUI: () => void;
  5522. loadingUIBackgroundColor: string;
  5523. loadingUIText: string;
  5524. }
  5525. class DefaultLoadingScreen implements ILoadingScreen {
  5526. private _renderingCanvas;
  5527. private _loadingText;
  5528. private _loadingDivBackgroundColor;
  5529. private _loadingDiv;
  5530. private _loadingTextDiv;
  5531. constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
  5532. displayLoadingUI(): void;
  5533. hideLoadingUI(): void;
  5534. loadingUIText: string;
  5535. loadingUIBackgroundColor: string;
  5536. private _resizeLoadingUI;
  5537. }
  5538. }
  5539. declare module BABYLON {
  5540. class SceneOptimization {
  5541. priority: number;
  5542. apply: (scene: Scene) => boolean;
  5543. constructor(priority?: number);
  5544. }
  5545. class TextureOptimization extends SceneOptimization {
  5546. priority: number;
  5547. maximumSize: number;
  5548. constructor(priority?: number, maximumSize?: number);
  5549. apply: (scene: Scene) => boolean;
  5550. }
  5551. class HardwareScalingOptimization extends SceneOptimization {
  5552. priority: number;
  5553. maximumScale: number;
  5554. private _currentScale;
  5555. constructor(priority?: number, maximumScale?: number);
  5556. apply: (scene: Scene) => boolean;
  5557. }
  5558. class ShadowsOptimization extends SceneOptimization {
  5559. apply: (scene: Scene) => boolean;
  5560. }
  5561. class PostProcessesOptimization extends SceneOptimization {
  5562. apply: (scene: Scene) => boolean;
  5563. }
  5564. class LensFlaresOptimization extends SceneOptimization {
  5565. apply: (scene: Scene) => boolean;
  5566. }
  5567. class ParticlesOptimization extends SceneOptimization {
  5568. apply: (scene: Scene) => boolean;
  5569. }
  5570. class RenderTargetsOptimization extends SceneOptimization {
  5571. apply: (scene: Scene) => boolean;
  5572. }
  5573. class MergeMeshesOptimization extends SceneOptimization {
  5574. static _UpdateSelectionTree: boolean;
  5575. static UpdateSelectionTree: boolean;
  5576. private _canBeMerged;
  5577. apply: (scene: Scene, updateSelectionTree?: boolean) => boolean;
  5578. }
  5579. class SceneOptimizerOptions {
  5580. targetFrameRate: number;
  5581. trackerDuration: number;
  5582. optimizations: SceneOptimization[];
  5583. constructor(targetFrameRate?: number, trackerDuration?: number);
  5584. static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  5585. static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  5586. static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  5587. }
  5588. class SceneOptimizer {
  5589. static _CheckCurrentState(scene: Scene, options: SceneOptimizerOptions, currentPriorityLevel: number, onSuccess?: () => void, onFailure?: () => void): void;
  5590. static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void;
  5591. }
  5592. }
  5593. declare module BABYLON {
  5594. class SceneSerializer {
  5595. static Serialize(scene: Scene): any;
  5596. static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any;
  5597. }
  5598. }
  5599. declare module BABYLON {
  5600. class SmartArray<T> {
  5601. data: Array<T>;
  5602. length: number;
  5603. private _id;
  5604. private _duplicateId;
  5605. constructor(capacity: number);
  5606. push(value: any): void;
  5607. pushNoDuplicate(value: any): void;
  5608. sort(compareFn: any): void;
  5609. reset(): void;
  5610. concat(array: any): void;
  5611. concatWithNoDuplicate(array: any): void;
  5612. indexOf(value: any): number;
  5613. private static _GlobalId;
  5614. }
  5615. }
  5616. declare module BABYLON {
  5617. class SmartCollection {
  5618. count: number;
  5619. items: any;
  5620. private _keys;
  5621. private _initialCapacity;
  5622. constructor(capacity?: number);
  5623. add(key: any, item: any): number;
  5624. remove(key: any): number;
  5625. removeItemOfIndex(index: number): number;
  5626. indexOf(key: any): number;
  5627. item(key: any): any;
  5628. getAllKeys(): any[];
  5629. getKeyByIndex(index: number): any;
  5630. getItemByIndex(index: number): any;
  5631. empty(): void;
  5632. forEach(block: (item: any) => void): void;
  5633. }
  5634. }
  5635. declare module BABYLON {
  5636. class Tags {
  5637. static EnableFor(obj: any): void;
  5638. static DisableFor(obj: any): void;
  5639. static HasTags(obj: any): boolean;
  5640. static GetTags(obj: any): any;
  5641. static AddTagsTo(obj: any, tagsString: string): void;
  5642. static _AddTagTo(obj: any, tag: string): void;
  5643. static RemoveTagsFrom(obj: any, tagsString: string): void;
  5644. static _RemoveTagFrom(obj: any, tag: string): void;
  5645. static MatchesQuery(obj: any, tagsQuery: string): boolean;
  5646. }
  5647. }
  5648. declare module BABYLON.Internals {
  5649. interface DDSInfo {
  5650. width: number;
  5651. height: number;
  5652. mipmapCount: number;
  5653. isFourCC: boolean;
  5654. isRGB: boolean;
  5655. isLuminance: boolean;
  5656. isCube: boolean;
  5657. }
  5658. class DDSTools {
  5659. static GetDDSInfo(arrayBuffer: any): DDSInfo;
  5660. private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  5661. private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  5662. private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  5663. static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void;
  5664. }
  5665. }
  5666. declare module BABYLON.Internals {
  5667. class TGATools {
  5668. private static _TYPE_NO_DATA;
  5669. private static _TYPE_INDEXED;
  5670. private static _TYPE_RGB;
  5671. private static _TYPE_GREY;
  5672. private static _TYPE_RLE_INDEXED;
  5673. private static _TYPE_RLE_RGB;
  5674. private static _TYPE_RLE_GREY;
  5675. private static _ORIGIN_MASK;
  5676. private static _ORIGIN_SHIFT;
  5677. private static _ORIGIN_BL;
  5678. private static _ORIGIN_BR;
  5679. private static _ORIGIN_UL;
  5680. private static _ORIGIN_UR;
  5681. static GetTGAHeader(data: Uint8Array): any;
  5682. static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void;
  5683. 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;
  5684. 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;
  5685. 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;
  5686. 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;
  5687. 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;
  5688. 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;
  5689. }
  5690. }
  5691. declare module BABYLON {
  5692. interface IAnimatable {
  5693. animations: Array<Animation>;
  5694. }
  5695. interface ISize {
  5696. width: number;
  5697. height: number;
  5698. }
  5699. class Tools {
  5700. static BaseUrl: string;
  5701. static ToHex(i: number): string;
  5702. static SetImmediate(action: () => void): void;
  5703. static IsExponentOfTwo(value: number): boolean;
  5704. static GetExponentOfTwo(value: number, max: number): number;
  5705. static GetFilename(path: string): string;
  5706. static GetDOMTextContent(element: HTMLElement): string;
  5707. static ToDegrees(angle: number): number;
  5708. static ToRadians(angle: number): number;
  5709. static ExtractMinAndMaxIndexed(positions: number[], indices: number[], indexStart: number, indexCount: number): {
  5710. minimum: Vector3;
  5711. maximum: Vector3;
  5712. };
  5713. static ExtractMinAndMax(positions: number[], start: number, count: number): {
  5714. minimum: Vector3;
  5715. maximum: Vector3;
  5716. };
  5717. static MakeArray(obj: any, allowsNullUndefined?: boolean): Array<any>;
  5718. static GetPointerPrefix(): string;
  5719. static QueueNewFrame(func: any): void;
  5720. static RequestFullscreen(element: any): void;
  5721. static ExitFullscreen(): void;
  5722. static CleanUrl(url: string): string;
  5723. static LoadImage(url: string, onload: any, onerror: any, database: any): HTMLImageElement;
  5724. static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void;
  5725. static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void;
  5726. static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void;
  5727. static FileAsURL(content: string): string;
  5728. static Clamp(value: number, min?: number, max?: number): number;
  5729. static Sign(value: number): number;
  5730. static Format(value: number, decimals?: number): string;
  5731. static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
  5732. static WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
  5733. static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
  5734. static IsEmpty(obj: any): boolean;
  5735. static RegisterTopRootEvents(events: {
  5736. name: string;
  5737. handler: EventListener;
  5738. }[]): void;
  5739. static UnregisterTopRootEvents(events: {
  5740. name: string;
  5741. handler: EventListener;
  5742. }[]): void;
  5743. static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: String) => void): void;
  5744. static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: String) => void): void;
  5745. static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
  5746. private static _NoneLogLevel;
  5747. private static _MessageLogLevel;
  5748. private static _WarningLogLevel;
  5749. private static _ErrorLogLevel;
  5750. private static _LogCache;
  5751. static errorsCount: number;
  5752. static OnNewCacheEntry: (entry: string) => void;
  5753. static NoneLogLevel: number;
  5754. static MessageLogLevel: number;
  5755. static WarningLogLevel: number;
  5756. static ErrorLogLevel: number;
  5757. static AllLogLevel: number;
  5758. private static _AddLogEntry(entry);
  5759. private static _FormatMessage(message);
  5760. static Log: (message: string) => void;
  5761. private static _LogDisabled(message);
  5762. private static _LogEnabled(message);
  5763. static Warn: (message: string) => void;
  5764. private static _WarnDisabled(message);
  5765. private static _WarnEnabled(message);
  5766. static Error: (message: string) => void;
  5767. private static _ErrorDisabled(message);
  5768. private static _ErrorEnabled(message);
  5769. static LogCache: string;
  5770. static ClearLogCache(): void;
  5771. static LogLevels: number;
  5772. private static _PerformanceNoneLogLevel;
  5773. private static _PerformanceUserMarkLogLevel;
  5774. private static _PerformanceConsoleLogLevel;
  5775. private static _performance;
  5776. static PerformanceNoneLogLevel: number;
  5777. static PerformanceUserMarkLogLevel: number;
  5778. static PerformanceConsoleLogLevel: number;
  5779. static PerformanceLogLevel: number;
  5780. static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  5781. static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  5782. static _StartUserMark(counterName: string, condition?: boolean): void;
  5783. static _EndUserMark(counterName: string, condition?: boolean): void;
  5784. static _StartPerformanceConsole(counterName: string, condition?: boolean): void;
  5785. static _EndPerformanceConsole(counterName: string, condition?: boolean): void;
  5786. static StartPerformanceCounter: (counterName: string, condition?: boolean) => void;
  5787. static EndPerformanceCounter: (counterName: string, condition?: boolean) => void;
  5788. static Now: number;
  5789. static GetFps(): number;
  5790. }
  5791. /**
  5792. * An implementation of a loop for asynchronous functions.
  5793. */
  5794. class AsyncLoop {
  5795. iterations: number;
  5796. private _fn;
  5797. private _successCallback;
  5798. index: number;
  5799. private _done;
  5800. /**
  5801. * Constroctor.
  5802. * @param iterations the number of iterations.
  5803. * @param _fn the function to run each iteration
  5804. * @param _successCallback the callback that will be called upon succesful execution
  5805. * @param offset starting offset.
  5806. */
  5807. constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number);
  5808. /**
  5809. * Execute the next iteration. Must be called after the last iteration was finished.
  5810. */
  5811. executeNext(): void;
  5812. /**
  5813. * Break the loop and run the success callback.
  5814. */
  5815. breakLoop(): void;
  5816. /**
  5817. * Helper function
  5818. */
  5819. static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop;
  5820. /**
  5821. * A for-loop that will run a given number of iterations synchronous and the rest async.
  5822. * @param iterations total number of iterations
  5823. * @param syncedIterations number of synchronous iterations in each async iteration.
  5824. * @param fn the function to call each iteration.
  5825. * @param callback a success call back that will be called when iterating stops.
  5826. * @param breakFunction a break condition (optional)
  5827. * @param timeout timeout settings for the setTimeout function. default - 0.
  5828. * @constructor
  5829. */
  5830. static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void;
  5831. }
  5832. }
  5833. declare module BABYLON {
  5834. enum JoystickAxis {
  5835. X = 0,
  5836. Y = 1,
  5837. Z = 2,
  5838. }
  5839. class VirtualJoystick {
  5840. reverseLeftRight: boolean;
  5841. reverseUpDown: boolean;
  5842. deltaPosition: Vector3;
  5843. pressed: boolean;
  5844. private static _globalJoystickIndex;
  5845. private static vjCanvas;
  5846. private static vjCanvasContext;
  5847. private static vjCanvasWidth;
  5848. private static vjCanvasHeight;
  5849. private static halfWidth;
  5850. private static halfHeight;
  5851. private _action;
  5852. private _axisTargetedByLeftAndRight;
  5853. private _axisTargetedByUpAndDown;
  5854. private _joystickSensibility;
  5855. private _inversedSensibility;
  5856. private _rotationSpeed;
  5857. private _inverseRotationSpeed;
  5858. private _rotateOnAxisRelativeToMesh;
  5859. private _joystickPointerID;
  5860. private _joystickColor;
  5861. private _joystickPointerPos;
  5862. private _joystickPreviousPointerPos;
  5863. private _joystickPointerStartPos;
  5864. private _deltaJoystickVector;
  5865. private _leftJoystick;
  5866. private _joystickIndex;
  5867. private _touches;
  5868. private _onPointerDownHandlerRef;
  5869. private _onPointerMoveHandlerRef;
  5870. private _onPointerUpHandlerRef;
  5871. private _onPointerOutHandlerRef;
  5872. private _onResize;
  5873. constructor(leftJoystick?: boolean);
  5874. setJoystickSensibility(newJoystickSensibility: number): void;
  5875. private _onPointerDown(e);
  5876. private _onPointerMove(e);
  5877. private _onPointerUp(e);
  5878. /**
  5879. * Change the color of the virtual joystick
  5880. * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
  5881. */
  5882. setJoystickColor(newColor: string): void;
  5883. setActionOnTouch(action: () => any): void;
  5884. setAxisForLeftRight(axis: JoystickAxis): void;
  5885. setAxisForUpDown(axis: JoystickAxis): void;
  5886. private _clearCanvas();
  5887. private _drawVirtualJoystick();
  5888. releaseCanvas(): void;
  5889. }
  5890. }
  5891. declare module BABYLON {
  5892. class VRDeviceOrientationFreeCamera extends FreeCamera {
  5893. _alpha: number;
  5894. _beta: number;
  5895. _gamma: number;
  5896. private _offsetOrientation;
  5897. private _deviceOrientationHandler;
  5898. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean);
  5899. _onOrientationEvent(evt: DeviceOrientationEvent): void;
  5900. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  5901. detachControl(element: HTMLElement): void;
  5902. }
  5903. }
  5904. declare var HMDVRDevice: any;
  5905. declare var PositionSensorVRDevice: any;
  5906. declare module BABYLON {
  5907. class WebVRFreeCamera extends FreeCamera {
  5908. _hmdDevice: any;
  5909. _sensorDevice: any;
  5910. _cacheState: any;
  5911. _cacheQuaternion: Quaternion;
  5912. _cacheRotation: Vector3;
  5913. _vrEnabled: boolean;
  5914. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean);
  5915. private _getWebVRDevices(devices);
  5916. _checkInputs(): void;
  5917. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  5918. detachControl(element: HTMLElement): void;
  5919. }
  5920. }
  5921. declare module BABYLON {
  5922. interface IOctreeContainer<T> {
  5923. blocks: Array<OctreeBlock<T>>;
  5924. }
  5925. class Octree<T> {
  5926. maxDepth: number;
  5927. blocks: Array<OctreeBlock<T>>;
  5928. dynamicContent: T[];
  5929. private _maxBlockCapacity;
  5930. private _selectionContent;
  5931. private _creationFunc;
  5932. constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, maxDepth?: number);
  5933. update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void;
  5934. addMesh(entry: T): void;
  5935. select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T>;
  5936. intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T>;
  5937. intersectsRay(ray: Ray): SmartArray<T>;
  5938. 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;
  5939. static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>) => void;
  5940. static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock<SubMesh>) => void;
  5941. }
  5942. }
  5943. declare module BABYLON {
  5944. class OctreeBlock<T> {
  5945. entries: T[];
  5946. blocks: Array<OctreeBlock<T>>;
  5947. private _depth;
  5948. private _maxDepth;
  5949. private _capacity;
  5950. private _minPoint;
  5951. private _maxPoint;
  5952. private _boundingVectors;
  5953. private _creationFunc;
  5954. constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void);
  5955. capacity: number;
  5956. minPoint: Vector3;
  5957. maxPoint: Vector3;
  5958. addEntry(entry: T): void;
  5959. addEntries(entries: T[]): void;
  5960. select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void;
  5961. intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void;
  5962. intersectsRay(ray: Ray, selection: SmartArray<T>): void;
  5963. createInnerBlocks(): void;
  5964. }
  5965. }
  5966. declare module BABYLON {
  5967. class ShadowGenerator {
  5968. private static _FILTER_NONE;
  5969. private static _FILTER_VARIANCESHADOWMAP;
  5970. private static _FILTER_POISSONSAMPLING;
  5971. private static _FILTER_BLURVARIANCESHADOWMAP;
  5972. static FILTER_NONE: number;
  5973. static FILTER_VARIANCESHADOWMAP: number;
  5974. static FILTER_POISSONSAMPLING: number;
  5975. static FILTER_BLURVARIANCESHADOWMAP: number;
  5976. private _filter;
  5977. blurScale: number;
  5978. private _blurBoxOffset;
  5979. private _bias;
  5980. private _lightDirection;
  5981. bias: number;
  5982. blurBoxOffset: number;
  5983. filter: number;
  5984. useVarianceShadowMap: boolean;
  5985. usePoissonSampling: boolean;
  5986. useBlurVarianceShadowMap: boolean;
  5987. private _light;
  5988. private _scene;
  5989. private _shadowMap;
  5990. private _shadowMap2;
  5991. private _darkness;
  5992. private _transparencyShadow;
  5993. private _effect;
  5994. private _viewMatrix;
  5995. private _projectionMatrix;
  5996. private _transformMatrix;
  5997. private _worldViewProjection;
  5998. private _cachedPosition;
  5999. private _cachedDirection;
  6000. private _cachedDefines;
  6001. private _currentRenderID;
  6002. private _downSamplePostprocess;
  6003. private _boxBlurPostprocess;
  6004. private _mapSize;
  6005. constructor(mapSize: number, light: IShadowLight);
  6006. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  6007. getShadowMap(): RenderTargetTexture;
  6008. getShadowMapForRendering(): RenderTargetTexture;
  6009. getLight(): IShadowLight;
  6010. getTransformMatrix(): Matrix;
  6011. getDarkness(): number;
  6012. setDarkness(darkness: number): void;
  6013. setTransparencyShadow(hasShadow: boolean): void;
  6014. private _packHalf(depth);
  6015. dispose(): void;
  6016. }
  6017. }
  6018. declare module BABYLON.Internals {
  6019. }
  6020. declare module BABYLON {
  6021. class BaseTexture {
  6022. name: string;
  6023. delayLoadState: number;
  6024. hasAlpha: boolean;
  6025. getAlphaFromRGB: boolean;
  6026. level: number;
  6027. isCube: boolean;
  6028. isRenderTarget: boolean;
  6029. animations: Animation[];
  6030. onDispose: () => void;
  6031. coordinatesIndex: number;
  6032. coordinatesMode: number;
  6033. wrapU: number;
  6034. wrapV: number;
  6035. anisotropicFilteringLevel: number;
  6036. _cachedAnisotropicFilteringLevel: number;
  6037. private _scene;
  6038. _texture: WebGLTexture;
  6039. constructor(scene: Scene);
  6040. getScene(): Scene;
  6041. getTextureMatrix(): Matrix;
  6042. getReflectionTextureMatrix(): Matrix;
  6043. getInternalTexture(): WebGLTexture;
  6044. isReady(): boolean;
  6045. getSize(): ISize;
  6046. getBaseSize(): ISize;
  6047. scale(ratio: number): void;
  6048. canRescale: boolean;
  6049. _removeFromCache(url: string, noMipmap: boolean): void;
  6050. _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture;
  6051. delayLoad(): void;
  6052. clone(): BaseTexture;
  6053. releaseInternalTexture(): void;
  6054. dispose(): void;
  6055. }
  6056. }
  6057. declare module BABYLON {
  6058. class CubeTexture extends BaseTexture {
  6059. url: string;
  6060. coordinatesMode: number;
  6061. private _noMipmap;
  6062. private _extensions;
  6063. private _textureMatrix;
  6064. constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean);
  6065. clone(): CubeTexture;
  6066. delayLoad(): void;
  6067. getReflectionTextureMatrix(): Matrix;
  6068. }
  6069. }
  6070. declare module BABYLON {
  6071. class DynamicTexture extends Texture {
  6072. private _generateMipMaps;
  6073. private _canvas;
  6074. private _context;
  6075. constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number);
  6076. canRescale: boolean;
  6077. scale(ratio: number): void;
  6078. getContext(): CanvasRenderingContext2D;
  6079. clear(): void;
  6080. update(invertY?: boolean): void;
  6081. drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void;
  6082. clone(): DynamicTexture;
  6083. }
  6084. }
  6085. declare module BABYLON {
  6086. class MirrorTexture extends RenderTargetTexture {
  6087. mirrorPlane: Plane;
  6088. private _transformMatrix;
  6089. private _mirrorMatrix;
  6090. private _savedViewMatrix;
  6091. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  6092. clone(): MirrorTexture;
  6093. }
  6094. }
  6095. declare module BABYLON {
  6096. class RawTexture extends Texture {
  6097. format: number;
  6098. constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  6099. update(data: ArrayBufferView): void;
  6100. static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  6101. static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  6102. static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  6103. static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  6104. static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  6105. }
  6106. }
  6107. declare module BABYLON {
  6108. class RenderTargetTexture extends Texture {
  6109. isCube: boolean;
  6110. static _REFRESHRATE_RENDERONCE: number;
  6111. static _REFRESHRATE_RENDERONEVERYFRAME: number;
  6112. static _REFRESHRATE_RENDERONEVERYTWOFRAME: number;
  6113. static REFRESHRATE_RENDERONCE: number;
  6114. static REFRESHRATE_RENDERONEVERYFRAME: number;
  6115. static REFRESHRATE_RENDERONEVERYTWOFRAME: number;
  6116. renderList: AbstractMesh[];
  6117. renderParticles: boolean;
  6118. renderSprites: boolean;
  6119. coordinatesMode: number;
  6120. onBeforeRender: (faceIndex: number) => void;
  6121. onAfterRender: (faceIndex: number) => void;
  6122. onAfterUnbind: () => void;
  6123. onClear: (engine: Engine) => void;
  6124. activeCamera: Camera;
  6125. customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents?: () => void) => void;
  6126. private _size;
  6127. _generateMipMaps: boolean;
  6128. private _renderingManager;
  6129. _waitingRenderList: string[];
  6130. private _doNotChangeAspectRatio;
  6131. private _currentRefreshId;
  6132. private _refreshRate;
  6133. private _textureMatrix;
  6134. constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean);
  6135. resetRefreshCounter(): void;
  6136. refreshRate: number;
  6137. _shouldRender(): boolean;
  6138. isReady(): boolean;
  6139. getRenderSize(): number;
  6140. canRescale: boolean;
  6141. scale(ratio: number): void;
  6142. getReflectionTextureMatrix(): Matrix;
  6143. resize(size: any, generateMipMaps?: boolean): void;
  6144. render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void;
  6145. renderToTarget(faceIndex: number, currentRenderList: AbstractMesh[], useCameraPostProcess: boolean, dumpForDebug: boolean): void;
  6146. clone(): RenderTargetTexture;
  6147. }
  6148. }
  6149. declare module BABYLON {
  6150. class Texture extends BaseTexture {
  6151. static NEAREST_SAMPLINGMODE: number;
  6152. static BILINEAR_SAMPLINGMODE: number;
  6153. static TRILINEAR_SAMPLINGMODE: number;
  6154. static EXPLICIT_MODE: number;
  6155. static SPHERICAL_MODE: number;
  6156. static PLANAR_MODE: number;
  6157. static CUBIC_MODE: number;
  6158. static PROJECTION_MODE: number;
  6159. static SKYBOX_MODE: number;
  6160. static INVCUBIC_MODE: number;
  6161. static CLAMP_ADDRESSMODE: number;
  6162. static WRAP_ADDRESSMODE: number;
  6163. static MIRROR_ADDRESSMODE: number;
  6164. url: string;
  6165. uOffset: number;
  6166. vOffset: number;
  6167. uScale: number;
  6168. vScale: number;
  6169. uAng: number;
  6170. vAng: number;
  6171. wAng: number;
  6172. private _noMipmap;
  6173. _invertY: boolean;
  6174. private _rowGenerationMatrix;
  6175. private _cachedTextureMatrix;
  6176. private _projectionModeMatrix;
  6177. private _t0;
  6178. private _t1;
  6179. private _t2;
  6180. private _cachedUOffset;
  6181. private _cachedVOffset;
  6182. private _cachedUScale;
  6183. private _cachedVScale;
  6184. private _cachedUAng;
  6185. private _cachedVAng;
  6186. private _cachedWAng;
  6187. private _cachedCoordinatesMode;
  6188. _samplingMode: number;
  6189. private _buffer;
  6190. private _deleteBuffer;
  6191. constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean);
  6192. delayLoad(): void;
  6193. updateSamplingMode(samplingMode: number): void;
  6194. private _prepareRowForTextureGeneration(x, y, z, t);
  6195. getTextureMatrix(): Matrix;
  6196. getReflectionTextureMatrix(): Matrix;
  6197. clone(): Texture;
  6198. static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture;
  6199. }
  6200. }
  6201. declare module BABYLON {
  6202. class VideoTexture extends Texture {
  6203. video: HTMLVideoElement;
  6204. private _autoLaunch;
  6205. private _lastUpdate;
  6206. constructor(name: string, urls: string[], scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  6207. update(): boolean;
  6208. }
  6209. }
  6210. declare module BABYLON {
  6211. class CannonJSPlugin implements IPhysicsEnginePlugin {
  6212. checkWithEpsilon: (value: number) => number;
  6213. private _world;
  6214. private _registeredMeshes;
  6215. private _physicsMaterials;
  6216. initialize(iterations?: number): void;
  6217. private _checkWithEpsilon(value);
  6218. runOneStep(delta: number): void;
  6219. setGravity(gravity: Vector3): void;
  6220. registerMesh(mesh: AbstractMesh, impostor: number, options?: PhysicsBodyCreationOptions): any;
  6221. private _createSphere(radius, mesh, options?);
  6222. private _createBox(x, y, z, mesh, options?);
  6223. private _createPlane(mesh, options?);
  6224. private _createConvexPolyhedron(rawVerts, rawFaces, mesh, options?);
  6225. private _addMaterial(friction, restitution);
  6226. private _createRigidBodyFromShape(shape, mesh, mass, friction, restitution);
  6227. registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any;
  6228. private _unbindBody(body);
  6229. unregisterMesh(mesh: AbstractMesh): void;
  6230. applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void;
  6231. updateBodyPosition: (mesh: AbstractMesh) => void;
  6232. createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3): boolean;
  6233. dispose(): void;
  6234. isSupported(): boolean;
  6235. }
  6236. }
  6237. declare module BABYLON {
  6238. class OimoJSPlugin implements IPhysicsEnginePlugin {
  6239. private _world;
  6240. private _registeredMeshes;
  6241. private _checkWithEpsilon(value);
  6242. initialize(iterations?: number): void;
  6243. setGravity(gravity: Vector3): void;
  6244. registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any;
  6245. registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any;
  6246. private _createBodyAsCompound(part, options, initialMesh);
  6247. unregisterMesh(mesh: AbstractMesh): void;
  6248. private _unbindBody(body);
  6249. /**
  6250. * Update the body position according to the mesh position
  6251. * @param mesh
  6252. */
  6253. updateBodyPosition: (mesh: AbstractMesh) => void;
  6254. applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void;
  6255. createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean;
  6256. dispose(): void;
  6257. isSupported(): boolean;
  6258. private _getLastShape(body);
  6259. runOneStep(time: number): void;
  6260. }
  6261. }
  6262. declare module BABYLON {
  6263. class PostProcessRenderEffect {
  6264. private _engine;
  6265. private _postProcesses;
  6266. private _getPostProcess;
  6267. private _singleInstance;
  6268. private _cameras;
  6269. private _indicesForCamera;
  6270. private _renderPasses;
  6271. private _renderEffectAsPasses;
  6272. _name: string;
  6273. applyParameters: (postProcess: PostProcess) => void;
  6274. constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean);
  6275. _update(): void;
  6276. addPass(renderPass: PostProcessRenderPass): void;
  6277. removePass(renderPass: PostProcessRenderPass): void;
  6278. addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void;
  6279. getPass(passName: string): void;
  6280. emptyPasses(): void;
  6281. _attachCameras(cameras: Camera): any;
  6282. _attachCameras(cameras: Camera[]): any;
  6283. _detachCameras(cameras: Camera): any;
  6284. _detachCameras(cameras: Camera[]): any;
  6285. _enable(cameras: Camera): any;
  6286. _enable(cameras: Camera[]): any;
  6287. _disable(cameras: Camera): any;
  6288. _disable(cameras: Camera[]): any;
  6289. getPostProcess(camera?: Camera): PostProcess;
  6290. private _linkParameters();
  6291. private _linkTextures(effect);
  6292. }
  6293. }
  6294. declare module BABYLON {
  6295. class PostProcessRenderPass {
  6296. private _enabled;
  6297. private _renderList;
  6298. private _renderTexture;
  6299. private _scene;
  6300. private _refCount;
  6301. _name: string;
  6302. constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void);
  6303. _incRefCount(): number;
  6304. _decRefCount(): number;
  6305. _update(): void;
  6306. setRenderList(renderList: Mesh[]): void;
  6307. getRenderTexture(): RenderTargetTexture;
  6308. }
  6309. }
  6310. declare module BABYLON {
  6311. class PostProcessRenderPipeline {
  6312. private _engine;
  6313. private _renderEffects;
  6314. private _renderEffectsForIsolatedPass;
  6315. private _cameras;
  6316. _name: string;
  6317. private static PASS_EFFECT_NAME;
  6318. private static PASS_SAMPLER_NAME;
  6319. constructor(engine: Engine, name: string);
  6320. addEffect(renderEffect: PostProcessRenderEffect): void;
  6321. _enableEffect(renderEffectName: string, cameras: Camera): any;
  6322. _enableEffect(renderEffectName: string, cameras: Camera[]): any;
  6323. _disableEffect(renderEffectName: string, cameras: Camera): any;
  6324. _disableEffect(renderEffectName: string, cameras: Camera[]): any;
  6325. _attachCameras(cameras: Camera, unique: boolean): any;
  6326. _attachCameras(cameras: Camera[], unique: boolean): any;
  6327. _detachCameras(cameras: Camera): any;
  6328. _detachCameras(cameras: Camera[]): any;
  6329. _enableDisplayOnlyPass(passName: any, cameras: Camera): any;
  6330. _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any;
  6331. _disableDisplayOnlyPass(cameras: Camera): any;
  6332. _disableDisplayOnlyPass(cameras: Camera[]): any;
  6333. _update(): void;
  6334. }
  6335. }
  6336. declare module BABYLON {
  6337. class PostProcessRenderPipelineManager {
  6338. private _renderPipelines;
  6339. constructor();
  6340. addPipeline(renderPipeline: PostProcessRenderPipeline): void;
  6341. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any;
  6342. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any;
  6343. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any;
  6344. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any;
  6345. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  6346. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  6347. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  6348. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  6349. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any;
  6350. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any;
  6351. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any;
  6352. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any;
  6353. update(): void;
  6354. }
  6355. }
  6356. declare module BABYLON {
  6357. class CustomProceduralTexture extends ProceduralTexture {
  6358. private _animate;
  6359. private _time;
  6360. private _config;
  6361. private _texturePath;
  6362. constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  6363. private loadJson(jsonUrl);
  6364. isReady(): boolean;
  6365. render(useCameraPostProcess?: boolean): void;
  6366. updateTextures(): void;
  6367. updateShaderUniforms(): void;
  6368. animate: boolean;
  6369. }
  6370. }
  6371. declare module BABYLON {
  6372. class ProceduralTexture extends Texture {
  6373. private _size;
  6374. _generateMipMaps: boolean;
  6375. isEnabled: boolean;
  6376. private _doNotChangeAspectRatio;
  6377. private _currentRefreshId;
  6378. private _refreshRate;
  6379. private _vertexBuffer;
  6380. private _indexBuffer;
  6381. private _effect;
  6382. private _vertexDeclaration;
  6383. private _vertexStrideSize;
  6384. private _uniforms;
  6385. private _samplers;
  6386. private _fragment;
  6387. _textures: Texture[];
  6388. private _floats;
  6389. private _floatsArrays;
  6390. private _colors3;
  6391. private _colors4;
  6392. private _vectors2;
  6393. private _vectors3;
  6394. private _matrices;
  6395. private _fallbackTexture;
  6396. private _fallbackTextureUsed;
  6397. constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  6398. reset(): void;
  6399. isReady(): boolean;
  6400. resetRefreshCounter(): void;
  6401. setFragment(fragment: any): void;
  6402. refreshRate: number;
  6403. _shouldRender(): boolean;
  6404. getRenderSize(): number;
  6405. resize(size: any, generateMipMaps: any): void;
  6406. private _checkUniform(uniformName);
  6407. setTexture(name: string, texture: Texture): ProceduralTexture;
  6408. setFloat(name: string, value: number): ProceduralTexture;
  6409. setFloats(name: string, value: number[]): ProceduralTexture;
  6410. setColor3(name: string, value: Color3): ProceduralTexture;
  6411. setColor4(name: string, value: Color4): ProceduralTexture;
  6412. setVector2(name: string, value: Vector2): ProceduralTexture;
  6413. setVector3(name: string, value: Vector3): ProceduralTexture;
  6414. setMatrix(name: string, value: Matrix): ProceduralTexture;
  6415. render(useCameraPostProcess?: boolean): void;
  6416. clone(): ProceduralTexture;
  6417. dispose(): void;
  6418. }
  6419. }
  6420. declare module BABYLON {
  6421. class WoodProceduralTexture extends ProceduralTexture {
  6422. private _ampScale;
  6423. private _woodColor;
  6424. constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  6425. updateShaderUniforms(): void;
  6426. ampScale: number;
  6427. woodColor: Color3;
  6428. }
  6429. class FireProceduralTexture extends ProceduralTexture {
  6430. private _time;
  6431. private _speed;
  6432. private _autoGenerateTime;
  6433. private _fireColors;
  6434. private _alphaThreshold;
  6435. constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  6436. updateShaderUniforms(): void;
  6437. render(useCameraPostProcess?: boolean): void;
  6438. static PurpleFireColors: Color3[];
  6439. static GreenFireColors: Color3[];
  6440. static RedFireColors: Color3[];
  6441. static BlueFireColors: Color3[];
  6442. fireColors: Color3[];
  6443. time: number;
  6444. speed: Vector2;
  6445. alphaThreshold: number;
  6446. }
  6447. class CloudProceduralTexture extends ProceduralTexture {
  6448. private _skyColor;
  6449. private _cloudColor;
  6450. constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  6451. updateShaderUniforms(): void;
  6452. skyColor: Color4;
  6453. cloudColor: Color4;
  6454. }
  6455. class GrassProceduralTexture extends ProceduralTexture {
  6456. private _grassColors;
  6457. private _herb1;
  6458. private _herb2;
  6459. private _herb3;
  6460. private _groundColor;
  6461. constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  6462. updateShaderUniforms(): void;
  6463. grassColors: Color3[];
  6464. groundColor: Color3;
  6465. }
  6466. class RoadProceduralTexture extends ProceduralTexture {
  6467. private _roadColor;
  6468. constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  6469. updateShaderUniforms(): void;
  6470. roadColor: Color3;
  6471. }
  6472. class BrickProceduralTexture extends ProceduralTexture {
  6473. private _numberOfBricksHeight;
  6474. private _numberOfBricksWidth;
  6475. private _jointColor;
  6476. private _brickColor;
  6477. constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  6478. updateShaderUniforms(): void;
  6479. numberOfBricksHeight: number;
  6480. numberOfBricksWidth: number;
  6481. jointColor: Color3;
  6482. brickColor: Color3;
  6483. }
  6484. class MarbleProceduralTexture extends ProceduralTexture {
  6485. private _numberOfTilesHeight;
  6486. private _numberOfTilesWidth;
  6487. private _amplitude;
  6488. private _marbleColor;
  6489. private _jointColor;
  6490. constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  6491. updateShaderUniforms(): void;
  6492. numberOfTilesHeight: number;
  6493. numberOfTilesWidth: number;
  6494. jointColor: Color3;
  6495. marbleColor: Color3;
  6496. }
  6497. }