babylon.d.ts 282 KB

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