babylon.d.ts 291 KB

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